MS-DS Master of Data science Natural Language Processing 4 — Questions and Answers
Question 1: What does the term 'word sense disambiguation' (WSD) refer to in NLP?
- Converting words to their morphological root form
- Determining which meaning of a polysemous word is intended in context (Correct answer)
- Identifying whether two words are synonyms in a lexicon
- Detecting misspelled words in a document
Correct answer: Determining which meaning of a polysemous word is intended in context
WSD is the task of automatically identifying the correct sense of an ambiguous word (e.g., 'bank' as financial institution vs. river bank) given its context.
Question 2: In information retrieval, what does TF-IDF measure and why is the IDF component important?
- Term frequency normalized by document length; IDF removes stopwords
- How often a term appears in a document weighted by how rare it is across all documents; IDF down-weights common terms (Correct answer)
- Inverse document frequency only; TF is a secondary correction factor
- Token frequency in a query weighted by its position; IDF adjusts for query length
Correct answer: How often a term appears in a document weighted by how rare it is across all documents; IDF down-weights common terms
TF-IDF multiplies term frequency (importance within a document) by inverse document frequency (rarity across corpus), giving high scores to terms that are distinctive for a document.
Question 3: Which decoding strategy for sequence generation introduces randomness by sampling from the top-k most probable tokens at each step?
- Greedy decoding
- Beam search
- Top-k sampling (Correct answer)
- Viterbi decoding
Correct answer: Top-k sampling
Top-k sampling restricts the sampling distribution to the k highest-probability tokens at each step, balancing diversity and coherence in generated text.
Question 4: What is the primary benefit of using subword tokenization over word-level tokenization for NLP models?
- Subword models train faster because vocabularies are smaller
- Subword tokenization handles morphological variants and rare words without requiring an open vocabulary (Correct answer)
- Subword models avoid the need for positional encodings
- Subword tokenization produces fixed-length representations for all words
Correct answer: Subword tokenization handles morphological variants and rare words without requiring an open vocabulary
By splitting rare or unknown words into frequent subword units, methods like BPE and WordPiece eliminate out-of-vocabulary issues while keeping vocabulary size tractable.
Question 5: In the context of large language model fine-tuning, what does RLHF (Reinforcement Learning from Human Feedback) accomplish?
- It pre-trains the base language model on a reward signal instead of next-token prediction
- It aligns model outputs with human preferences by training a reward model and optimizing with PPO (Correct answer)
- It replaces supervised fine-tuning by directly querying humans during inference
- It reduces model size through human-guided pruning of attention heads
Correct answer: It aligns model outputs with human preferences by training a reward model and optimizing with PPO
RLHF first trains a reward model on human preference comparisons, then fine-tunes the LLM using PPO to maximize expected reward while minimizing KL divergence from the SFT policy.
Question 6: Which property of contextualized embeddings makes them superior to static embeddings for tasks like named entity recognition?
- They use larger vocabulary sizes than static embeddings
- They produce different vector representations for the same word depending on surrounding context (Correct answer)
- They require fewer training examples due to orthogonal initialization
- They encode syntactic parse trees directly in the embedding space
Correct answer: They produce different vector representations for the same word depending on surrounding context
Contextualized embeddings (e.g., from BERT or ELMo) capture polysemy and contextual nuance by producing token representations that reflect the entire surrounding sentence.
Question 7: What is the purpose of the [CLS] token in BERT and how is it typically used for classification tasks?
- It marks the boundary between two sentences in a pair
- Its final hidden state aggregates sentence-level information and is fed to a classification head (Correct answer)
- It triggers the masked language modeling objective for the following token
- It serves as a positional anchor for the first token's encoding
Correct answer: Its final hidden state aggregates sentence-level information and is fed to a classification head
BERT prepends [CLS] to every input; after encoding, its final-layer representation is treated as the pooled sentence embedding and passed to a linear classifier for sentence-level tasks.
What does the term 'word sense disambiguation' (WSD) refer to in NLP?