Machine Learning Natural Language Processing 4 — Questions and Answers
Question 1: What is the role of positional encoding in the original Transformer model?
- To normalize token embeddings before attention
- To inject sequence order information since attention is permutation-invariant (Correct answer)
- To reduce the dimensionality of token embeddings
- To initialize the softmax output layer
Correct answer: To inject sequence order information since attention is permutation-invariant
Positional encodings add order information to token embeddings because self-attention treats all positions equivalently without them.
Question 2: In text classification, what does the macro-averaged F1 score compute?
- F1 weighted by class frequency
- The unweighted mean of per-class F1 scores (Correct answer)
- F1 on only the majority class
- F1 computed on the full token sequence
Correct answer: The unweighted mean of per-class F1 scores
Macro-averaged F1 calculates F1 independently for each class and averages them equally, treating all classes as equally important regardless of size.
Question 3: Which NLP task involves assigning a structured predicate-argument representation to a sentence, identifying who did what to whom?
- Semantic Role Labeling (SRL) (Correct answer)
- Named Entity Recognition
- Sentiment Analysis
- Textual Entailment
Correct answer: Semantic Role Labeling (SRL)
SRL labels arguments of predicates (verbs) with semantic roles like Agent, Patient, and Instrument, revealing the meaning structure of a sentence.
Question 4: What does 'hallucination' mean in the context of large language models?
- The model refusing to generate text
- The model generating fluent but factually incorrect or fabricated content (Correct answer)
- The model repeating input tokens verbatim
- The model producing very short outputs
Correct answer: The model generating fluent but factually incorrect or fabricated content
Hallucination refers to LLMs confidently generating plausible-sounding text that is factually wrong or unsupported by the provided context.
Question 5: Which decoding strategy introduces randomness by sampling from the top-p cumulative probability mass rather than the full vocabulary?
- Greedy decoding
- Beam search
- Nucleus (top-p) sampling (Correct answer)
- Temperature=0 sampling
Correct answer: Nucleus (top-p) sampling
Nucleus sampling restricts the sampling pool to the smallest set of tokens whose cumulative probability exceeds p, balancing diversity and coherence.
Question 6: In Retrieval-Augmented Generation (RAG), what is the primary role of the retriever component?
- To fine-tune the language model on domain data
- To fetch relevant documents from an external knowledge base given a query (Correct answer)
- To rerank the model's output tokens by likelihood
- To tokenize the user query before generation
Correct answer: To fetch relevant documents from an external knowledge base given a query
The retriever fetches semantically relevant passages from an indexed corpus, which are then provided as context to the generator to ground its responses.
Question 7: What is the key difference between extractive and abstractive summarization?
- Extractive summarization uses neural networks; abstractive does not
- Extractive copies spans from the source; abstractive generates novel text (Correct answer)
- Abstractive summarization is always shorter than extractive
- Extractive models require more training data
Correct answer: Extractive copies spans from the source; abstractive generates novel text
Extractive summarization selects and concatenates sentences from the original document, while abstractive summarization paraphrases and generates new phrasing.
What is the role of positional encoding in the original Transformer model?