NLP Interview Questions and Answers, Grouped by Topic
Thirty-five NLP interview questions on tokenization, TF-IDF, n-gram language models, word2vec and GloVe, seq2seq, BERT, text classification, NER and metrics such as BLEU and ROUGE, each with a short answer and a lesson or problem to practise it.
What NLP interview questions should you expect?
NLP interview questions ask you to explain how text is turned into features and models, from tokenization, TF-IDF and n-gram language models to word embeddings, sequence models, BERT, text classification, named entity recognition and the metrics used to evaluate them. Many interviews also include a coding question where you implement one of these methods from scratch. TensorTonic pairs each of the 35 questions below with a lesson that explains the answer, a coding problem that checks your implementation against tests, or a section of the Cracking NLP study plan, which has 35 problems in five sections.
The questions are grouped by topic in roughly the order an NLP interview moves through them, and each one has a short model answer written in full sentences. This guide covers classic and core NLP. Questions about large language models, such as self-attention internals, the KV cache, LoRA, RLHF and RAG, are in the LLM interview questions guide, and general neural network questions are in the deep learning interview questions guide.
What text preprocessing and tokenization questions come up in NLP interviews?
Text preprocessing and tokenization questions ask how raw text is cleaned and split into units a model can count or embed. Interviewers start here because every later choice, from the vocabulary size to how unseen words are handled, depends on it.
Which preprocessing steps would you apply to raw text, and which would you skip for a pretrained transformer?
Typical preprocessing steps are Unicode normalization, lowercasing, removing or separating punctuation, collapsing whitespace and, for count-based models, removing stopwords. These steps shrink the vocabulary and help bag-of-words and n-gram models, where every distinct string is a separate feature. A pretrained transformer should get the text in the form its own tokenizer expects, so you skip stopword removal and stemming and lowercase only if the model was trained on lowercased text, since words such as "not" carry meaning the model has learned to use. Practise with Text Normalization and Remove Stopwords From a Token List.
What is the difference between stemming and lemmatization?
Stemming cuts words down with suffix-stripping rules, as the Porter stemmer does, so it is fast and can produce strings that are not words, such as "studi" from "studies". Lemmatization looks words up in a vocabulary and uses the part of speech to return the dictionary form, so "better" as an adjective becomes "good" and "ran" becomes "run". Stemming is enough for search and count-based features, and lemmatization is preferred when the output has to be readable or the exact word sense matters. Practise with Stemming vs Lemmatization.
Why do modern NLP models use subword tokenization, and how does WordPiece differ from BPE?
Subword tokenization keeps the vocabulary to a fixed size while still covering rare and unseen words, because an unknown word can be split into known pieces instead of mapping to a single unknown token. BPE builds its vocabulary by repeatedly merging the most frequent adjacent pair of symbols. WordPiece, which BERT uses, merges the pair that most increases the likelihood of the training data, which works out to the pair's count divided by the product of the counts of its two parts, and it marks pieces that continue a word with a "##" prefix. Read the WordPiece lesson in the BERT research track and Tokenization in the Transformer, and see the LLM interview questions guide for how a BPE tokenizer is trained and applied. Practise the splitting step with Subword Tokenization.
How do you compute the edit distance between two words?
You compute the Levenshtein edit distance with dynamic programming over a table where each cell holds the distance between a prefix of the first word and a prefix of the second. Each cell takes the minimum of the cell above plus one for a deletion, the cell to the left plus one for an insertion, and the diagonal cell plus zero or one depending on whether the two current characters match. The answer is in the bottom-right cell, the time cost is the product of the two lengths, and keeping only the previous row cuts the memory to one row. Edit distance is the basis of simple spell correction, which ranks dictionary words by their distance to a misspelling. Practise with Edit Distance and Spell Correction.
What bag of words and TF-IDF questions do interviewers ask?
Bag of words and TF-IDF questions ask how a document becomes a sparse vector of word weights and how those vectors are compared. They are a common first coding question because the code is short and the edge cases are easy to get wrong.
What is a bag-of-words representation, and what does it lose?
A bag-of-words representation turns a document into a vector with one entry per vocabulary word, holding the count or presence of that word in the document. It loses word order, so "dog bites man" and "man bites dog" get the same vector, and it treats every word as unrelated to every other word, so "car" and "automobile" share nothing. Adding bigrams to the vocabulary recovers some local order at the cost of a much larger and sparser vector. Practise with Bag-of-Words Vector.
How is TF-IDF computed, and why does the IDF term help?
TF-IDF multiplies a term's frequency in a document by its inverse document frequency, which is usually the log of the number of documents divided by the number of documents that contain the term. The IDF term lowers the weight of words that appear almost everywhere, such as "the", and raises the weight of words that are rare across the collection and so say more about a particular document. Libraries often add one inside and outside the log so that no term gets a zero or undefined weight, and the resulting vectors are usually L2-normalized. Practise with TF-IDF Vectorizer.
Why compare TF-IDF vectors with cosine similarity, and how does BM25 improve on TF-IDF for search?
Cosine similarity divides the dot product of two vectors by the product of their lengths, so it measures how similar their word distributions are regardless of how long each document is. BM25 is a ranking function that builds on the same idea and adds two corrections. Term frequency saturates, controlled by a parameter usually called k1, so the tenth mention of a word adds much less than the first, and scores are normalized by document length relative to the average, controlled by a parameter b. Practise with Cosine Similarity and BM25 Ranking.
What n-gram language model and smoothing questions should you prepare for?
N-gram questions ask how a language model can be built from counts alone and how it handles word sequences it never saw in training. They test probability and the chain rule more directly than any neural model does.
What is an n-gram language model, and how are its probabilities estimated?
An n-gram language model predicts each word from only the previous n minus one words, which is a Markov assumption applied to the chain rule of probability. Its probabilities are estimated by counting, so a bigram probability is the count of the word pair divided by the count of the first word. Sentences are padded with start and end tokens so that the first word has a context and the model assigns probability to where a sentence stops. The perplexity lesson explains how such a model is scored on held-out text, and you can build one in N-gram Language Model.
Why do n-gram models need smoothing, and how do add-one and Kneser-Ney smoothing work?
N-gram models need smoothing because any n-gram missing from the training data gets a probability of zero, which makes the probability of a whole test sentence zero and its perplexity infinite. Add-one or Laplace smoothing adds one to every count and the vocabulary size to every denominator, which is simple and moves too much probability to unseen events. Kneser-Ney subtracts a fixed discount from each observed count and gives the freed probability to a lower-order model based on how many different contexts a word follows, so a word such as "Francisco", which is frequent but almost always follows "San", gets little probability in new contexts. Backoff and interpolation are the two ways of combining higher-order and lower-order estimates.
How do you choose n for an n-gram model?
You choose n by trading context against sparsity, because a larger n captures longer dependencies while the number of possible n-grams grows exponentially and most of them are never seen. Bigram and trigram models are the usual choices for small corpora, and larger values only help when there is a great deal of text. The practical method is to compare perplexity on held-out text for a few values of n with the same smoothing method, and this sparsity problem is the main reason neural language models replaced n-gram models.
What word embedding questions come up, from word2vec to GloVe?
Word embedding questions ask how dense word vectors are learned from raw text and why words with similar meanings end up close together. Expect to explain the training objective and the tricks that make training affordable.
How does word2vec learn word embeddings, and what is the difference between skip-gram and CBOW?
Word2vec learns embeddings by training a shallow model to predict words from their neighbours, based on the idea that words appearing in similar contexts have similar meanings. Skip-gram takes the centre word and predicts each word in a window around it, while CBOW averages the vectors of the context words and predicts the centre word. Skip-gram is slower and tends to give better vectors for rare words, and CBOW trains faster on large corpora. Read the skip-gram pairs lesson and the CBOW forward pass lesson in the Word2Vec research track, then practise with Word2Vec.
What is negative sampling, and why does word2vec need it?
Negative sampling replaces the softmax over the whole vocabulary, which would cost one dot product per vocabulary word for every training pair, with a set of small binary classification problems. For each real pair of a word and a context word, the model raises the sigmoid of their dot product and lowers it for a few noise words drawn at random. The noise words are drawn from the unigram distribution raised to the power three-quarters, which samples rare words more often than their raw frequency would. Read the skip-gram negative sampling loss lesson and the noise distribution lesson.
Why does word2vec subsample frequent words?
Word2vec subsamples frequent words because words such as "the" and "of" appear in so many windows that they dominate training while telling the model little about their neighbours. Each occurrence of a word is dropped with a probability that rises with the word's frequency, using one minus the square root of a small threshold divided by the frequency. This speeds up training and improves the vectors of less frequent words, which now appear in more of the remaining windows. Read the subsampling lesson in the Word2Vec research track.
How does GloVe differ from word2vec, and what does FastText add?
GloVe learns embeddings from a global word co-occurrence matrix, fitting the dot product of two word vectors plus two bias terms to the log of how often the words co-occur, with a weighted least-squares loss that limits the influence of very frequent pairs. Word2vec instead learns from one local window at a time with a predictive loss, and the two methods give vectors of similar quality in practice. FastText extends skip-gram by representing each word as the sum of vectors for its character n-grams, so it can build a vector for a word it never saw and shares information between words such as "teach" and "teacher". Practise with GloVe and FastText.
What are the limits of static word embeddings, and how do you evaluate them?
Static word embeddings give each word a single vector, so a word with several senses, such as "bank", gets one vector that mixes all of them, and the vectors also absorb social biases from the training text. Contextual embeddings from models such as BERT fix the first problem by giving each occurrence of a word its own vector based on the sentence. Static embeddings are evaluated intrinsically with word similarity scores and analogies, such as the vector for king minus man plus woman landing near queen, and extrinsically by how much they help a downstream task. Practise the similarity measure used in these evaluations with Cosine Similarity.
What RNN, seq2seq and early attention questions do NLP interviews ask?
Sequence model questions ask how recurrent networks read text one token at a time, how encoder-decoder models translate one sequence into another, and why attention was added to them. The gating details of LSTM and GRU cells are covered in the deep learning interview questions guide, so this section focuses on how they are used for language.
How is an RNN used for language, and what limits it?
An RNN reads a sentence one token at a time and updates a hidden state that summarizes everything it has read so far, which it can use to predict the next word or classify the whole sentence. Its two main limits are that the steps must run in order, which makes training hard to parallelize, and that gradients shrink or grow as they pass back through many steps, so long-range dependencies are hard to learn. LSTM and GRU cells reduce the gradient problem with gates and an additive state, and the deep learning interview questions guide covers how. Read the backpropagation through time lesson, then practise with RNN Step Forward (Tanh Cell) and LSTM Cell.
How does an encoder-decoder seq2seq model work, and what is teacher forcing?
An encoder-decoder model reads the source sentence with an encoder RNN, passes its final hidden state to a decoder RNN as a summary, and the decoder then generates the target sentence one token at a time. Teacher forcing means that during training the decoder receives the true previous target token at each step instead of its own prediction, which makes training faster and more stable. The cost is exposure bias, since at inference the decoder sees its own predictions and has never practised recovering from its own mistakes. The Recurrent networks section of the Cracking Deep Learning study plan has a sequence-to-sequence forward pass to implement.
Why was attention first added to seq2seq models?
Attention was first added to seq2seq models because squeezing a whole source sentence into one fixed-size vector made translation quality fall as sentences grew longer. Bahdanau attention lets the decoder look back at every encoder hidden state at each step, scoring each one against the current decoder state with a small feed-forward network and using the softmax of those scores to form a weighted context vector. Luong attention later replaced the feed-forward scoring with a dot product, and the transformer kept the weighted sum while removing recurrence altogether. Read Attention in the Transformer, and see the LLM interview questions guide for the self-attention questions that follow.
How does beam search work, and why does it need length normalization?
Beam search keeps the k most probable partial sequences at each decoding step, extends each one by every possible next token, and keeps the k best of the results, which finds higher-probability outputs than greedy decoding at k times the cost. Because every extra token multiplies in another probability below one, raw scores favour short outputs. Length normalization divides each sequence's total log probability by its length, often raised to a power between zero and one, so that longer and complete outputs can compete. Beam search suits tasks with one right answer such as translation, while sampling suits open-ended generation. Practise with Beam Search Decoding and Text Generation Sampling.
What BERT and GPT pretraining questions should you expect in an NLP interview?
Pretraining questions ask how BERT-style encoders are trained, how they differ from GPT-style decoders and how a pretrained encoder is adapted to a task. NLP roles ask about encoders far more often than LLM roles do, because classification, tagging and retrieval still run on them.
How does masked language modelling work, and why does BERT not mask every selected token?
Masked language modelling hides some input tokens and trains the model to predict them from the context on both sides. BERT selects 15 percent of the tokens, replaces 80 percent of those with a [MASK] token, replaces 10 percent with a random token and leaves 10 percent unchanged, and computes the loss only on the selected positions. The random and unchanged cases exist because [MASK] never appears when the model is fine-tuned, so the model must learn to build a useful representation for every token and not only for masked ones. Read the masked language model lesson in the BERT research track, then practise with Masked Language Modeling.
What is next sentence prediction, and why did later models drop it?
Next sentence prediction trains BERT to tell whether the second of two text segments really followed the first in the source document or was drawn at random, using the output at the [CLS] position. It was meant to help tasks that reason about pairs of sentences, such as question answering and entailment. RoBERTa found that removing it and training on longer runs of contiguous text matched or improved results, and the usual explanation is that the random negatives can often be spotted from a change of topic alone. Read the next sentence prediction lesson in the BERT research track, then practise with Next Sentence Prediction.
What is the difference between BERT-style and GPT-style pretraining, and when would you use each?
BERT-style models are encoders with bidirectional attention trained to fill in masked tokens, so every token's representation uses the whole sentence. GPT-style models are decoders with causal attention trained to predict the next token, so they can generate text one token at a time. Encoders are the usual choice for classification, tagging, extractive question answering and embeddings, where the full input is available, and decoders are the choice for generation and for tasks phrased as instructions. Read GPT Pretraining: How Next-Token Prediction Works for the decoder objective.
How do you fine-tune BERT for classification, token tagging and extractive question answering?
You fine-tune BERT by adding a small task head on top of the pretrained encoder and training the whole model on labelled data with a low learning rate. Sentence classification uses the final [CLS] vector, usually after BERT's pooler layer, followed by a linear layer and a softmax. Token tagging applies a linear layer to every token's output vector, and extractive question answering learns a start score and an end score for every token and picks the highest-scoring valid span in the passage. Read the fine-tuning lesson and the pooler lesson in the BERT research track, then practise with Token Classification and Span Extraction.
What text classification questions do interviewers ask?
Text classification questions ask how you would build a classifier for sentiment, topics or spam, and how you would judge it. Interviewers want to see a sensible baseline before a large model and a metric that fits the class balance.
How would you build a text classifier, and what baseline would you start with?
You would start with a TF-IDF vectorizer over words and bigrams followed by logistic regression or a linear SVM, because it trains in seconds, is easy to inspect and is often hard to beat on short texts with clear keywords. If the baseline falls short, fine-tuning a pretrained encoder such as BERT is the usual next step, and it helps most when meaning depends on word order, negation or context. Comparing the two on the same validation split tells you whether the extra cost of the larger model is worth it. Practise with Text Classification and Logistic Regression from Scratch.
How does Naive Bayes classify text, and why does it work despite its assumption?
Multinomial Naive Bayes picks the class with the highest prior probability multiplied by the probability of each word in the document given that class, and it assumes the words are independent once the class is known. The word probabilities come from counts in each class with add-one smoothing, so an unseen word does not set the whole product to zero, and the computation is done in log space to avoid underflow. The independence assumption is wrong for real text, and the classifier still ranks classes well because it only needs the correct class to score highest, even when its probabilities are badly calibrated. The Gaussian Naive Bayes problem applies the same rule to continuous features.
How do you evaluate a text classifier when the classes are imbalanced?
You evaluate an imbalanced text classifier with precision, recall and F1 for each class, because accuracy can look high when the model always predicts the majority class. Macro-averaged F1 gives every class equal weight, so it shows how the model does on rare classes, while micro-averaged F1 pools every prediction and is dominated by the common classes. A confusion matrix shows which classes are being mixed up, and a precision-recall curve helps pick a threshold for a binary task. Read the machine learning evaluation metrics guide, then practise with Precision, Recall and Average Precision.
What NER and sequence labelling questions come up in NLP interviews?
Sequence labelling questions ask how a model assigns a label to every token, as in named entity recognition and part-of-speech tagging. The interesting parts are the label scheme, the dependencies between neighbouring labels and the alignment with subword tokens.
What is named entity recognition, and how does BIO tagging turn it into token classification?
Named entity recognition finds spans of text that name things such as people, organizations and places and labels each span with its type. BIO tagging turns this into one label per token, where B marks the first token of an entity, I marks a token inside the same entity and O marks a token outside any entity, so "New York" becomes B-LOC followed by I-LOC. The B tag lets two entities of the same type sit next to each other without merging, and a decoder reads the spans back out of the tag sequence. Practise with Named Entity Recognition.
How does an HMM tag parts of speech, and how does the Viterbi algorithm find the best tag sequence?
A hidden Markov model treats the tags as hidden states that follow one another with transition probabilities and emit the observed words with emission probabilities, and both sets are estimated from counts in tagged text. The Viterbi algorithm finds the most probable tag sequence with dynamic programming, keeping for each position and each tag the best score of any path that ends there along with a pointer to the previous tag. Following the pointers back from the best final tag gives the answer, and the cost is the sentence length times the square of the number of tags. Practise tagging with POS Tagging.
Why add a CRF layer on top of a BiLSTM or BERT tagger?
A CRF layer scores the whole label sequence at once, adding learned transition scores between neighbouring labels to the per-token scores from the encoder. A tagger that picks each label independently can output sequences that make no sense, such as I-PER straight after O, and the CRF learns to give those transitions low scores. Training maximizes the likelihood of the correct sequence using the forward algorithm, and inference finds the best sequence with the Viterbi algorithm. Practise the decoding step first through the Viterbi question above, since the CRF uses the same back pointers.
How do you align word-level labels with subword tokens when fine-tuning a tagger?
You align word-level labels with subword tokens by giving the label to the first subword of each word and marking the remaining subwords so the loss ignores them. In PyTorch this is usually done by setting their label to minus one hundred, which is the default ignore index of the cross-entropy loss, and special tokens and padding are masked the same way. At prediction time you read the label from the first subword of each word, which keeps the output aligned with the original words for evaluation. Practise batching variable-length token sequences with Pad Sequences.
How do NLP interviews test evaluation metrics such as BLEU, ROUGE, perplexity and F1?
NLP interviews test evaluation metrics by asking you to compute one by hand or in code and then say what it misses. Each metric suits a different task, so expect a follow-up about when you would not trust it.
What does perplexity measure, and how does it relate to cross-entropy?
Perplexity measures how well a language model predicts held-out text, and it equals the exponential of the average cross-entropy per token, or two to the power of the cross-entropy when that is measured in bits. It is the inverse of the geometric mean of the probabilities the model gave to the actual tokens, so lower is better. Perplexity depends on the vocabulary and tokenization, so it is only comparable between models evaluated on the same text with the same tokens. Read the perplexity lesson and the cross-entropy lesson, then practise with Perplexity Computation.
How is BLEU computed?
BLEU is computed from modified n-gram precisions for n from one to four, where each n-gram in the candidate counts only up to the number of times it appears in any single reference, so repeating a correct word cannot inflate the score. The four precisions are combined with a geometric mean and multiplied by a brevity penalty, which is one when the candidate is longer than the reference and the exponential of one minus the reference length over the candidate length otherwise. BLEU is designed for a whole corpus, and sentence-level BLEU needs smoothing because a single missing four-gram makes the geometric mean zero. Practise with BLEU Score.
What is ROUGE, and how does it differ from BLEU?
ROUGE is a family of overlap metrics for summarization that focuses on recall, measuring how much of the reference summary the candidate covers. ROUGE-N counts the overlapping n-grams as a fraction of the n-grams in the reference, and ROUGE-L uses the longest common subsequence of the two texts to give credit for words that appear in the same order even with gaps between them. BLEU focuses on precision because a translation should not add words the reference lacks, while ROUGE focuses on recall because a summary should not leave out key content. Practise with Evaluation Metrics (BLEU, ROUGE).
How is F1 computed for named entity recognition?
F1 for named entity recognition is usually computed at the entity level, where a predicted entity counts as correct only if both its span boundaries and its type exactly match a gold entity. Precision is the share of predicted entities that are correct, recall is the share of gold entities that were found, and F1 is their harmonic mean. Token-level accuracy is misleading here because most tokens are O, so a model that tags nothing as an entity still gets a high accuracy. Read the machine learning evaluation metrics guide for how precision, recall and F1 trade off.
Why are BLEU and ROUGE not enough to judge generated text?
BLEU and ROUGE are not enough because they only count word overlap with the references, so a correct paraphrase with different wording scores poorly and a fluent answer with one wrong fact can score well. They also depend heavily on how many references are available and on tokenization details, which makes scores from different papers hard to compare. Teams usually add human ratings or model-based judges for open-ended outputs, and the LLM interview questions guide covers those evaluation methods.
Which NLP interview questions ask you to write code?
The NLP interview questions that ask you to write code are the ones whose answer is a short function over strings, counts or small arrays, such as normalization, bag of words, TF-IDF, cosine similarity, a word2vec step, masking for a language model and metrics such as BLEU and perplexity. Dynamic programming questions such as edit distance and the Viterbi algorithm also come up in live rounds. The table lists these tasks, what an interviewer checks in each and where to practise them.
| Task | What the interviewer checks | Practice |
|---|---|---|
| Text normalization and stopwords | Unicode handling, lowercasing, punctuation and empty inputs | Text Normalization, Remove Stopwords From a Token List |
| Bag of words | A fixed vocabulary order and words that are not in the vocabulary | Bag-of-Words Vector |
| TF-IDF | Document frequency counts, the IDF formula and row normalization | TF-IDF Vectorizer |
| Cosine similarity | Dividing by the vector norms and handling an all-zero vector | Cosine Similarity |
| Word2vec training | Context windows, the sigmoid loss and the gradient for both embedding tables | Word2Vec |
| Masked language modelling | Selecting positions, the 80, 10 and 10 split and a loss on selected positions only | Masked Language Modeling |
| BLEU | Clipped n-gram counts, the geometric mean and the brevity penalty | BLEU Score |
| Perplexity | Averaging log probabilities over tokens and taking the exponential at the end | Perplexity Computation |
| Edit distance and n-gram models | The dynamic programming table, smoothed counts and unseen words | Edit Distance, N-gram Language Model |
For the general shape of a live implementation round, including how to split the time and how answers are graded, read the ML coding interview questions guide.
How should you practise NLP interview questions?
You should practise NLP interview questions by answering each one out loud in about two minutes, checking your answer against the linked lesson, and then implementing the method in code. Writing a TF-IDF vectorizer or a BLEU function yourself exposes the edge cases that a spoken answer skips, and those edge cases are what interviewers ask about next.
- Work through one topic at a time and read the lesson for any question you cannot answer out loud, using the research tracks on BERT, Word2Vec, RNNs, LSTMs and the Transformer for the model questions.
- Solve the linked problem for each question, writing the code from a blank file before looking at any reference.
- Follow the Cracking NLP study plan for an ordered path through the same material.
- Review entropy, cross-entropy and perplexity in the information theory lessons before the metric questions.
- Take a timed assessment when you have finished a group of topics, so that you practise writing the code under the time pressure of a real round.
The Cracking NLP study plan has 35 problems in the five sections below, in the order the plan presents them.
| Section | What it covers |
|---|---|
| Text preprocessing | Tokenization, normalization, regular expressions, padding, stemming and lemmatization, sentence splitting, edit distance and subword vocabularies |
| Embeddings and representations | Bag of words, TF-IDF, n-gram language models, Word2Vec, GloVe, FastText and sentence embeddings |
| Sequence models | Named entity recognition, part-of-speech tagging, text classification, language modeling and spell correction |
| Transformers for NLP | Masked language modeling, next sentence prediction, token classification, span extraction, beam search and sampling |
| Advanced NLP | Perplexity, MinHash deduplication, BLEU and ROUGE, tokenizer training, document ranking and byte-pair encoding |
TensorTonic also has two timed interview assessments that include NLP problems.
| Assessment | What it covers | Format |
|---|---|---|
| NLP Fundamentals Sprint | Preprocessing, retrieval, evaluation and decoding | 60 minutes, 3 problems |
| ML, DL, and NLP Sprint | ML, DL and NLP fundamentals from scratch | 75 minutes, 6 problems |
What mistakes do candidates make in NLP interviews?
The most common mistakes in NLP interviews are skipping the simple baseline, leaving out the details that make a method work, and reporting a metric in a way that hides how the model really performs. Each one is easy to fix once you know to look for it.
- Reaching for a fine-tuned transformer before trying a TF-IDF baseline makes it hard to show that the larger model was worth its cost.
- Removing stopwords or lowercasing text before a pretrained transformer throws away information the model was trained to use, such as negation and casing.
- Forgetting smoothing in an n-gram model gives unseen n-grams a probability of zero and makes perplexity infinite on any realistic test set.
- Describing word2vec with a full softmax and no negative sampling or subsampling misses the parts that made it fast enough to train on large corpora.
- Explaining masked language modelling without the 80, 10 and 10 replacement split leaves out the reason the model works when no [MASK] tokens appear at fine-tuning time.
- Labelling every subword of a word during NER fine-tuning, or measuring tagging quality with token accuracy, makes the reported scores look better than the model is.
- Computing BLEU without clipping the n-gram counts or without the brevity penalty lets a short or repetitive output score far too high.
- Comparing perplexity between models with different tokenizers gives a number that does not mean what it seems to mean.
The guide to the mistakes that lose ML interviews covers the broader mistakes that apply to every round.
Practice this
- TF-IDF Vectorizer covers the counting, IDF weighting and normalization behind the most common classic NLP coding question.
- Word2Vec turns the embedding questions into a training step you can explain line by line.
- BLEU Score makes you handle clipped counts and the brevity penalty that interviewers check for in metric questions.
Then test yourself under time pressure with the NLP Fundamentals Sprint, or continue with the Cracking NLP study plan.
How should you prepare for an NLP interview?
Prepare for an NLP interview by answering each common question out loud in about two minutes and then implementing the method behind it in code. Start with tokenization, TF-IDF and n-gram language models, move on to word embeddings, sequence models and BERT, and finish with the evaluation metrics that every NLP task is judged by. A timed mock round at the end shows whether you can write the same code under pressure.
Are classic NLP methods such as TF-IDF and n-grams still asked in interviews?
Classic NLP methods are still asked in interviews, because they test whether you understand counting, sparsity, smoothing and probability without a neural network hiding the details. TF-IDF with a linear model is also a common baseline that interviewers expect you to try before fine-tuning a transformer. N-gram models lead naturally into perplexity, which is still the standard intrinsic measure for language models.
What is the difference between NLP and LLM interview questions?
NLP interview questions cover the full range of methods for working with text, from preprocessing and sparse features to embeddings, sequence labelling, BERT-style encoders and task metrics such as BLEU and F1. LLM interview questions focus on large decoder-only models, including attention internals, training at scale, inference, fine-tuning and alignment. Many roles ask both, and the two sets meet at tokenization, pretraining objectives and perplexity.
Do NLP interviews include coding questions?
Many NLP interviews include at least one coding question where you implement a text method from scratch in Python or NumPy. Common tasks are a tokenizer or text normalizer, a bag-of-words or TF-IDF vectorizer, an n-gram model with smoothing, edit distance, the Viterbi algorithm, a word2vec training step and a metric such as BLEU or perplexity. The interviewer usually checks edge cases such as empty inputs, unseen words and division by zero as closely as the main logic.
What maths do you need for an NLP interview?
You need basic probability, logarithms and some linear algebra for an NLP interview. Probability covers n-gram models, Naive Bayes, smoothing and hidden Markov models, logarithms and entropy cover cross-entropy and perplexity, and dot products and vector norms cover embeddings and cosine similarity. Dynamic programming is the main algorithmic idea, since edit distance, Viterbi and beam search all depend on it.
Related guides
- LLM interview questions: 43 questions with answers
- Deep learning interview questions with answers
- ML coding interview questions: 20 to implement
- Machine learning evaluation metrics
- How to prepare for an ML engineer interview
- How to implement the Transformer from Attention Is All You Need, step by step
- How to learn NLP from scratch, one stage at a time