Skip to content

NLP Engineer interview questions

100 real questions with model answers and explanations for NLP Engineer I candidates.

See a NLP Engineer resume example

Practice with flashcards

Spaced repetition · Hunter Pass

Questions

nlpnormalizationci-cd

Unicode normalization makes visually equivalent text use a consistent character representation before analysis.

  • The word café can store é as one code point or as e plus a combining accent.
  • NFC usually composes characters, while NFKC also folds compatibility forms such as full-width Latin letters.
  • The chosen form must be applied consistently because changing it between training and inference creates false vocabulary differences.

Why interviewers ask this: The interviewer checks whether you recognize that visually identical strings can have different underlying representations.

normalization

Text normalization should remove irrelevant variation without deleting distinctions the task needs.

  • Lowercasing can help a simple search model match Apple and apple, but it removes a useful company-versus-fruit clue for NER.
  • Accent removal may improve noisy matching, yet it can merge distinct words or names in languages such as Spanish and French.
  • A good pipeline records task-specific choices and applies the same operations to training, validation, and incoming text.

Why interviewers ask this: A strong answer treats normalization as a task-dependent choice rather than an automatic cleanup recipe.

tokenssentence-split

Sentence tokenization must distinguish real sentence boundaries from punctuation used inside a sentence.

  • A period may belong to an abbreviation such as Dr. or to a decimal such as 3.14.
  • Quotes, ellipses, and headings require language-aware boundary rules rather than one delimiter.
  • Libraries such as spaCy use trained or rule-based components that preserve character offsets for later annotation.

Why interviewers ask this: The interviewer is evaluating whether you understand boundary ambiguity and the value of established tokenizers.

tokenstokenization

A word tokenizer should define boundaries consistently while preserving pieces that carry meaning for the task.

  • Repeated spaces and line breaks are separators in many corpora, but their original offsets may still be needed.
  • Punctuation is often emitted as separate tokens so commas and question marks remain available as features.
  • English contractions may become do plus n't or stay as don't, so labels and downstream models must use the same convention.

Why interviewers ask this: The interviewer checks whether you can explain tokenization as a documented convention with downstream consequences.

stemminglemmatization

Stemming applies rough affix rules, while lemmatization returns a dictionary base form using linguistic information.

  • A stemmer may reduce studies and studying to studi without producing a valid word.
  • A lemmatizer can map was to be when it knows the token is a verb.
  • Stemming is fast for search features, whereas lemmatization is preferable when readable or grammatically meaningful forms matter.

Why interviewers ask this: The interviewer wants a precise distinction plus a realistic reason to choose either method.

stop-words

Removing frequent function words can shrink simple feature spaces, but it can also erase task-critical meaning.

  • Words such as the and of often add little to a bag-of-words topic classifier.
  • Removing not from not good can reverse the sentiment signal, and removing who can hurt question classification.
  • Modern transformer tokenizers normally keep stop words because context and word order are part of the learned representation.

Why interviewers ask this: A strong answer rejects blanket stop-word removal and connects the choice to the model and task.

word-ngrams

Word n-grams preserve short local sequences that a unigram representation loses.

  • A bigram feature can distinguish not good from good even when both contain the token good.
  • Higher-order n-grams capture more phrase structure but create a much larger and sparser vocabulary.
  • A practical baseline often combines unigrams and bigrams with a minimum document-frequency cutoff.

Why interviewers ask this: The interviewer checks whether you understand both the added phrase signal and the sparsity cost.

char-ngrams

Character n-grams are useful when spelling fragments and word shapes remain informative despite noisy or unseen words.

  • They can connect run, running, and runner through shared character sequences.
  • They are robust to some typos and work well for language identification and user-generated text.
  • They produce many features and can match accidental fragments, so n-gram range and frequency thresholds need validation.

Why interviewers ask this: The interviewer is evaluating whether you know the robustness benefit and the larger feature-space cost.

bag-of-words

Bag of words encodes a document by the counts or presence of vocabulary terms while discarding their order.

  • With vocabulary cat, sat, mat, each document becomes one numeric coordinate per listed term.
  • The representation is easy to inspect and works well with linear classifiers as a baseline.
  • It cannot distinguish dog bites man from man bites dog when both sentences contain the same token counts.

Why interviewers ask this: The interviewer checks that you can describe the representation, its practical value, and its central limitation.

tf-idf

TF-IDF gives a term more weight when it is frequent in one document but uncommon across the collection.

  • Term frequency measures how strongly the term appears in the current document, often with count or log scaling.
  • Inverse document frequency downweights corpus-wide words by using the number of documents containing the term.
  • The resulting vectors make distinctive terms such as tokenizer outweigh ubiquitous terms such as document in search or classification.

Why interviewers ask this: The interviewer wants to see that you can explain both factors and why their product is useful.

bag-of-wordstf-idf

They are stored sparsely because each document uses only a small fraction of the full vocabulary.

  • A corpus with 100,000 terms may have only 80 nonzero term values in one short document.
  • Formats such as CSR store nonzero values and their indices instead of allocating every zero.
  • Sparse-aware scikit-learn models can train directly on this representation without converting it to a dense array.

Why interviewers ask this: The interviewer checks whether you connect text vocabulary size to memory-efficient data structures.

tf-idfsimilarity

Cosine similarity measures how closely two vector directions align, largely ignoring their absolute lengths.

  • It is the dot product divided by the product of the two vector norms.
  • Two documents with similar TF-IDF proportions can score highly even when one is much longer.
  • A value near 1 means aligned nonnegative text vectors, while a zero vector needs explicit handling because its norm is zero.

Why interviewers ask this: The interviewer evaluates your geometric intuition and awareness of the zero-vector edge case.

nlpfeature-engineeringembeddings

A one-hot vector identifies a vocabulary item, while a learned embedding represents it with dense trainable features.

  • One-hot vectors have vocabulary-sized dimensions and every pair of distinct words is equally orthogonal.
  • Embeddings use far fewer dimensions, such as 300, and place words with related usage nearer each other.
  • One-hot inputs are simple and exact, but learned vectors can share statistical information across related words.

Why interviewers ask this: The interviewer checks whether you understand identity features versus learned similarity-bearing representations.

word2veccbowskip-gram

CBOW predicts a center word from nearby words, while skip-gram predicts nearby words from the center word.

  • For the phrase the cat sleeps, CBOW can use the and sleeps to predict cat.
  • Skip-gram can use cat to predict surrounding tokens such as the and sleeps.
  • CBOW is often faster on frequent patterns, while skip-gram can learn better representations for less frequent words.

Why interviewers ask this: The interviewer wants a beginner-level account of the two prediction directions and their common trade-off.

glove

GloVe learns word vectors from aggregate word co-occurrence statistics across a corpus.

  • It builds on how often words appear near one another rather than only processing isolated training windows online.
  • Ratios of co-occurrence probabilities help encode relationships between words such as ice, steam, solid, and gas.
  • Like Word2Vec, standard GloVe assigns one static vector to each vocabulary word regardless of sentence context.

Why interviewers ask this: The interviewer checks whether you know GloVe's corpus-level co-occurrence basis and static nature.

fasttext

FastText represents a word using its character n-grams in addition to a whole-word vector.

  • The word playing can share fragments such as play with played and player.
  • Shared fragments improve vectors for rare words and allow an approximate vector for an unseen spelling.
  • This helps morphologically rich languages, although unrelated words can also share misleading character pieces.

Why interviewers ask this: The interviewer evaluates whether you can connect subword composition to rare and unseen word handling.

nlpembeddingscontextual-embeddings

Static embeddings give a word one vector, while contextual embeddings produce a vector based on the surrounding sentence.

  • Word2Vec gives bank the same vector in river bank and bank account.
  • A BERT encoder can represent those two occurrences differently because each token attends to its context.
  • Contextual vectors capture ambiguity better but require a larger model and more computation than a lookup table.

Why interviewers ask this: The interviewer checks whether you understand why context changes a token representation and what it costs.

tokensoov

A tokenizer vocabulary maps recognized tokens to integer IDs, and an out-of-vocabulary item has no direct entry in that mapping.

  • A word-level tokenizer may replace an unseen surname with a single unknown token and lose its spelling.
  • Subword tokenizers usually split the surname into known pieces instead of discarding it entirely.
  • The tokenizer vocabulary must match the model checkpoint because each ID selects a specific learned embedding.

Why interviewers ask this: The interviewer wants a clear link between vocabulary, unknown inputs, token IDs, and model compatibility.

feature-engineeringtokensbpe

BPE repeatedly merges frequent adjacent symbols, then applies the learned merges to split new text into subwords.

  • Training starts from small units such as characters or bytes and merges pairs like l plus o when they occur often.
  • Frequent words may become one token, while rare words remain several reusable pieces.
  • The merge list and base vocabulary determine the exact segmentation, so training and inference must share them.

Why interviewers ask this: The interviewer checks whether you understand BPE as learned frequent-pair merging rather than arbitrary word splitting.

tokenswordpiece

WordPiece builds a subword vocabulary and segments a word into pieces selected from that fixed vocabulary.

  • Common words may stay intact, while uncommon words become pieces such as play and ##ing in BERT-style notation.
  • Its vocabulary construction favors useful merges based on a likelihood-related score rather than raw pair frequency alone.
  • If no valid sequence of pieces exists, implementations can emit an unknown token.

Why interviewers ask this: The interviewer evaluates whether you can distinguish WordPiece's vocabulary-based segmentation from word-level tokenization and BPE.

Locked questions

  • 21

    How does a unigram subword tokenizer choose a segmentation?

    tokenizationunigram-tokenizertokens
  • 22

    What is an attention mask in a padded transformer batch?

    nlpattention-maskbatch
  • 23

    Why are padding and truncation used when preparing transformer inputs?

    nlptruncationcss
  • 24

    How does maximum sequence length affect an NLP model?

    nlp
  • 25

    What roles do training, validation, and test splits play for a text model?

    validation
  • 26

    How can duplicate or related texts cause leakage between dataset splits?

    leakage
  • 27

    Why do label quality and class imbalance matter in text classification?

    classificationimbalance
  • 28

    How do precision, recall, and F1 describe a classifier?

    evaluation
  • 29

    How do macro, micro, and weighted F1 differ for multiclass text classification?

    classification
  • 30

    What does a confusion matrix show for a text classifier?

    evaluation
  • 31

    When is a precision-recall curve more informative than an ROC curve?

    evaluation
  • 32

    What does BLEU measure, and what are its main limitations?

    bleu
  • 33

    How should you interpret a ROUGE score for a summarization system?

    rougesystem-design
  • 34

    How do exact match and token F1 evaluate extractive question answering?

    tokensdecision-makingllm-eval
  • 35

    What signals can a language identification model use?

    language-id
  • 36

    What does part-of-speech tagging assign to a sentence?

    pos-tagging
  • 37

    What does dependency parsing represent?

    dependenciesdependency-parsing
  • 38

    What does named entity recognition predict, and why do entity spans matter?

    ner
  • 39

    How do BIO and BILOU tags encode entity spans?

    bio-tagsbilou-tags
  • 40

    What is text classification, and how does it differ from sequence labeling?

    classificationsequence-labeling
  • 41

    What does an extractive question-answering model predict?

  • 42

    Why is BERT suited to NER while T5 is naturally suited to translation?

    bertt5
  • 43

    How does an LSTM process a token sequence, and why does a bidirectional LSTM help with tagging?

    tokenslstmconcurrency
  • 44

    What does a transformer encoder produce for an input sentence?

    nlptransformer
  • 45

    How does a 1D CNN over token embeddings detect local text patterns, and what is the pooling trade-off?

    nlpembeddingstokens
  • 46

    What does BERT learn from masked-language-model pretraining?

    bert
  • 47

    What is a task head, and what changes during fine-tuning?

    fine-tuning
  • 48

    How are tokenized text batches represented in PyTorch?

    tokensbatchpytorch
  • 49

    What roles do a Hugging Face tokenizer, model, and pipeline play?

    tokensci-cd
  • 50

    How do spaCy pipelines and annotation guidelines support reliable NLP data?

    nlpci-cd
  • 51

    A review classifier treats café and café as different tokens, and curly apostrophes create extra vocabulary entries. How would you fix the preprocessing?

    tokens
  • 52

    After removing stop words, your sentiment model gives similar features to good and not good. What would you change?

    stop-words
  • 53

    A social-media sentiment dataset contains 😊, #NeverAgain, and #GreatService, but the current cleaner deletes them. How would you revise it?

  • 54

    Your sentence splitter breaks Dr. Smith arrived at 3 p.m. into several sentences. How would you debug and fix it?

  • 55

    Adding stemming lowers intent-classification F1 because distinct product terms collapse to the same stem. What would you do?

    classificationdistinctstemming
  • 56

    You receive 8,000 labeled support messages and need a credible classification baseline by the end of the day. What would you build?

    classification
  • 57

    A notebook crashes when it calls toarray on a TF-IDF matrix with 200,000 documents and 100,000 features. How would you fix it?

    tf-idf
  • 58

    A text classifier scores 99 percent in validation, but you discover copied messages in both training and validation data. What would you do?

    validation
  • 59

    A moderation model performs well on a random split, but many messages from the same user or thread appear on both sides. How would you resplit the data?

    concurrency
  • 60

    Only 3 percent of support tickets are urgent, and the classifier predicts the majority class almost every time. How would you try class weights?

  • 61

    A toxicity classifier uses a 0.5 cutoff, but the team wants to catch more harmful messages even if reviewers see more false alarms. How would you choose a threshold?

    thresholding
  • 62

    Your binary classifier produced 40 true positives, 10 false positives, 20 false negatives, and 930 true negatives. What does this confusion matrix tell you?

    evaluation
  • 63

    A three-class intent model has 94 percent accuracy but only 58 percent macro F1. How would you explain the disagreement?

    conflict
  • 64

    Your NER training file contains the sequence O, I-ORG, I-ORG for an organization mention. Why is this a BIO error, and how would you handle it?

    bio-tags
  • 65

    A word-level NER dataset is tokenized into subwords, so the logits have one position per subtoken while the labels still have one per word. How would you align them with word_ids?

    tokens
  • 66

    The gold entity New York in I love New York. is highlighted as New Yor because its character end offset is wrong. How would you fix the span logic?

  • 67

    spaCy doc.char_span returns None for several annotated entities even though their text looks correct. What would you inspect?

  • 68

    Your annotations mark both Bank of America and America as entities, but assigning them to spaCy doc.ents fails. How would you represent this?

  • 69

    Two annotators disagree on 25 percent of organization entities in a 200-document pilot. What would you do before training?

    conflict
  • 70

    Annotators label product names inconsistently because the guideline only says mark products. How would you improve the guideline?

  • 71

    A random split leaves only two examples of a rare intent in validation. How would you create a better classification split?

    classificationvalidation
  • 72

    You load a BERT classifier checkpoint with a tokenizer from another model, and predictions become nonsensical. What would you check first?

    tokensbert
  • 73

    A padded batch gives different predictions from single-example inference because the model attends to padding tokens. How would you fix it?

    batchinferencetokens
  • 74

    A local tokenizer sends a 900-token sequence to an encoder that supports 512 because truncation is disabled, causing an index or tensor-shape runtime error. How would you fix it?

    tokenstruncationindexes
  • 75

    A Hugging Face training DataLoader fails because tokenized examples have different lengths. Which data collator would you use?

    tokens
  • 76

    A three-class training run fails with a classifier-head shape error after loading a checkpoint trained for two labels. What would you change?

  • 77

    Validation predictions change on repeated runs over the same saved model because dropout remains active. What is the local fix?

    validation
  • 78

    Training loss behaves strangely because gradients from every batch keep accumulating. What line is probably missing from the loop?

    batch
  • 79

    A small text classifier's loss becomes NaN after a few updates, and gradient norms spike. What basic checks would you make?

  • 80

    PyTorch raises Expected all tensors to be on the same device during training. How would you fix it?

    pytorch
  • 81

    Two runs of the same notebook produce noticeably different validation scores. How would you make the experiment more reproducible?

    reproducibilityvalidationexperiments
  • 82

    A Hugging Face Dataset.map call is slow because the tokenizer processes one row at a time. How would you use batched mapping correctly?

    tokensbatchconcurrency
  • 83

    After loading an exported CSV, accented text is garbled and some labels appear under the wrong column. How would you diagnose it?

    schema
  • 84

    You need a repeatable 10,000-row sample of labeled messages from SQL for a local experiment. How would you query and validate it?

    sqlqueriesvalidation
  • 85

    An NER model reports 98 percent token accuracy but misses many complete person names. Which evaluation would you add?

    tokensllm-eval
  • 86

    A question-answering model highlights the wrong substring even though the gold answer text exists in the context. How would you verify answer offsets?

  • 87

    A summarizer has a high ROUGE score, but reviewers say it preserves wording while changing important facts. How would you evaluate it?

    llm-evaldecision-makingrouge
  • 88

    A multilingual classifier works on plain English but fails on names such as Łódź and on Turkish casing. What preprocessing would you review?

  • 89

    A service has separate English and Spanish classifiers, but short and mixed-language messages are routed incorrectly. How would you improve language-ID routing?

  • 90

    A FastText-based classifier encounters a new misspelled domain word that is absent from the word list. How would you inspect its representation?

    fasttext
  • 91

    You need to classify 5,000 local sentences with a Hugging Face model without running out of memory. How would you implement batch inference?

    batchinferencememory
  • 92

    A REST classification endpoint crashes when text is missing, blank, or replaced by a list with 100,000 items. What validation would you add?

    restendpointsvalidation
  • 93

    A Docker image starts the NLP API but fails with model artifact not found, while the same code works on the host. What would you check?

    dockerartifactsapi
  • 94

    Your classification API returns 0 and 1, but clients need negative and positive. Where would you fix the response?

    classificationapi
  • 95

    A teammate cannot reproduce the result from your Jupyter notebook after pulling the project. What would you include to make it reproducible?

    reproducibilitydebuggingpython
  • 96

    Overall intent F1 is acceptable, but users report many errors on short messages and Spanish text. How would you perform slice-based error analysis?

  • 97

    A general text classifier confuses two intents whenever users mention internal product codes such as ZX-410. How would you handle the domain vocabulary?

  • 98

    Before training on 30,000 newly annotated NER sentences, what simple quality checks would you run?

  • 99

    A teammate proposes fine-tuning a transformer immediately for a 2,000-row sentiment dataset. What baseline would you require first?

    nlpfine-tuning
  • 100

    A classifier is correct in the notebook but the local API predicts a different label for the same sentence. How would you debug it?

    api