Logo/
Sam

Shared by Sam

Log in

Make a lecture like this from your own PDF

Drop a PDF, slides or notes here. You'll sign up, then yours starts.

0:00 / 8:14

0:00 / 8:14Exam-Eve Triage
NLP Units 1–2: Exam-Eve High-Yield Briefing
Sam

Shared by Sam

Summary

Full transcript

0:00What should you study first when an NLP exam covers two units and your time is limited? Not the historical timeline, start with the ideas that turn most directly into marks. Six key items remain, and this is the order: first, n-gram probability and sparse data, then perplexity, then minimum edit distance, then finite state models and tokenization, finally, foundations and challenges. Why this order? The first topics are formula-heavy and full of easy-to-mix-up decisions. The later topics are mainly definitions and comparisons. In every item, use the same exam cycle: define it in one sentence, spot the trap. Recognize how the question is phrased and apply one reliable rule. Keep that rhythm in mind. We begin with the highest payoff scoring area, how an n-gram model assigns probability to a sequence of words.

0:53An n-gram model estimates the next word from a short history. A unigram uses one word, its probability is the word count divided by the total number of words. A bigram uses two consecutive words, count the pair, then divide by the count of the first word. A trigram uses three consecutive words. Uses three: count the three word sequence, then divide by the count of its two word history. The shortcut is simple: the n in n-gram tells you how many consecutive words are in the unit. The model uses a Markov assumption, meaning it keeps only limited recent context instead of the entire sentence. Now the trap: in an unsmoothed model, an unseen n-gram isn't merely unlikely, its probability is exactly zero.

1:37Laplace or add-one smoothing adds one One to every count, making unseen events non-zero, but it can give too much probability to rare events. If asked for the fastest rule, identify the order, use the matching count formula, and check whether smoothing is specified. Self-check: What probability does an unseen bigram receive without smoothing? Zero. That zero probability problem leads directly to the next distinction. Once smoothing is on the table, exam questions often ask how different n-gram orders are combined. Interpolation combines them all, its form is lambda one times the unigram probability plus lambda two times the bigram probability. Plus lambda three times the trigram probability, the weights must add to one. Backoff is different; it tries the highest order model first. If the trigram is unavailable, it falls back to the bigram.

2:34If that is unavailable, it falls back to the unigram. Here is the trap examiners love: both methods use multiple orders so they can sound interchangeable, they aren't. Interpolation means combine, backoff means fall back only when needed. If the question shows lambda If it waits and asks for a weighted sum, choose interpolation. If it describes a trigram to bigram to unigram search, choose backoff. Self-check: Which method always combines all levels? Interpolation. Which method changes levels only when the higher order estimate is unavailable? Backoff. That distinction is a reliable two-mark answer. Perplexity asks a practical question: how surprised is the language model by a test sequence? For a sequence of n words, the formula is P P of w equals the probability of the whole sequence raised to the power negative one over n.

3:28You may also see log likelihood written as the log of the sequence probability. The interpretation matters more than the symbol. Lower perplexity usually means the model predicts the test text with less uncertainty. The trap is saying that lower is always better without checking the setup. Compare perplexity only under comparable conditions, such as the same evaluation data and a compatible task. A likely question is: Define perplexity, calculate it from a sequence probability, or interpret two scores? The fastest reliable method is three steps: use the probability of the complete sequence, apply the negative one over n exponent, then explain the result as predictive uncertainty. Self-check: What does a lower perplexity indicate? Better prediction under comparable conditions. Do not confuse it with accuracy. Perplexity evaluates probability assigned to sequences.

4:22Minimum edit distance measures how many unit cost edits transform one string into another. The allowed operations are insertion, deletion, and substitution. In the Levenshtein setting, each costs one, while matching characters cost zero. The exam procedure is mechanical, so don't improvise. First, initialize the top row and left column as zero, one, two, and so on. Next, fill each cell using the minimum of three routes: from the top for deletion, from the left for insertion, or from the diagonal for substitution or match. The recurrence is d of i comma j equals the minimum of d of i minus one comma j plus one, d of i comma j minus one plus one, and d of i minus one comma j minus one plus the cost. Finally, read the bottom right cell, that is the distance.

5:14For d o g to cow, two substitutions are enough: d becomes c and g becomes w, so the distance is two. Trap: reversing the directions or forgetting that a match costs zero. Self-check: which cell contains the final distance? Bottom right. Now separate two ideas that are often collapsed: an FSA or finite state automaton reads a string and accepts or rejects it; its five-tuple is Q, sigma, delta, q0, and F. States, alphabet, transition function, start state, and final states. A DFA has one possible transition for each state and input pair, an nDFA may have several. An FST is different because it maps one representation to another. In morphology, the word structure of a word is built from morphemes, its smallest meaningful or grammatical units. The source's example maps "cats" to "cat" plus n plus p l.

6:13That is a mapping, not just acceptance. Then comes tokenization. Word tokens are natural but must handle punctuation, contractions, URLs, and emojis. Character tokens handle unknown words but create longer sequences. Subwords reduce out-of-vocabulary problems. The trap is assuming one tokenizer works everywhere. If the question mentions unknown words, think character or subword. If it emphasizes OOV reduction, choose subword. Self-check: What doesn't f. As he'd do, it maps representations. One key item remains: the low payoff background that still appears in short answer questions. Remember the evolution as rules, grammar, statistics, machine learning, deep learning, and transformers. The recurring NLP challenges are ambiguity, limited resources, rich morphology, missing context, domain adaptation, multilingual and code-switched text, and computational cost. The exam move isn't to write a history.

7:15Essay: Match the keyword to the problem it names. Now take the final walk-in sheet. N-grams estimate word sequence probability, and an unseen event is zero without smoothing. Laplace adds one but can distort rare event probabilities. Interpolation combines orders, backoff falls back. Perplexity measures predictive uncertainty, and lower is better only under comparable conditions. Minimum edit distance uses top for deletion, left for insertion, diagonal for sub- Substitution or match and bottom right for the answer. FSA accepts or rejects, FST maps forms. Tokenization is a task and language choice. The top three traps are zero versus merely small, combine versus fallback, and incomparable perplexity scores. The one thing to write down when the exam starts is the formula and mnemonic block: the n-gram rules, the edit distance directions, and interpolation equals combine, backoff equals fallback.

Ask AI about this video

Answers cite the source. Free account, no credit card.