CNLP key terms
CNLP · Get comfortable with the vocabulary.
- Tokenization
- Related: Subword Tokenization, Byte Pair Encoding, Vocabulary
Splitting raw text into smaller units called tokens, such as words, subwords, or characters, before any model can process it. The choice of tokenizer shapes vocabulary size, sequence length, and downstream accuracy.
- Subword Tokenization
- Related: Byte Pair Encoding, WordPiece, Out-of-Vocabulary Handling
A segmentation strategy that breaks rare words into frequent pieces while keeping common words whole, balancing vocabulary size against coverage of unseen words. It is the default for modern neural language models.
- Byte Pair Encoding
- Related: Subword Tokenization, WordPiece, Vocabulary
A data-driven subword algorithm that starts from characters and repeatedly merges the most frequent adjacent pair into a new symbol. The resulting merge table defines how any input string is segmented at inference time.
- WordPiece
- Related: Byte Pair Encoding, Subword Tokenization, Masked Language Modeling
A subword algorithm similar to byte pair encoding but selecting merges by likelihood gain rather than raw frequency. It is the tokenizer used by BERT-family models and marks continuation pieces with a special prefix.
- Out-of-Vocabulary Handling
- Related: Vocabulary, Subword Tokenization, Tokenization
The policy a system uses when an input token is absent from its vocabulary, such as mapping it to an unknown token, decomposing it into subwords, or hashing it. Poor handling silently degrades accuracy on rare names and domain jargon.
- Vocabulary
- Related: Tokenization, Subword Tokenization, Embedding
The fixed set of tokens a model can represent, each mapped to an integer identifier. Its size trades off memory and embedding parameters against the average number of tokens needed per word.
- Stop Word Removal
- Related: Lemmatization, TF-IDF, Bag of Words
Deleting very frequent function words such as articles and prepositions before classical feature extraction. It shrinks feature space but can destroy negation and phrase structure, so it is usually avoided for neural and sequence-labeling models.
- Lemmatization
- Related: Stemming, Part-of-Speech Tagging, Stop Word Removal
Reducing a word to its dictionary base form using vocabulary and part-of-speech knowledge, so that 'running' becomes 'run'. It is linguistically motivated and more accurate but slower than simple suffix stripping.
- Stemming
- Related: Lemmatization, TF-IDF, Bag of Words
A fast heuristic that chops word endings using rule patterns, often producing non-words such as 'studi'. It groups morphological variants for retrieval-style tasks but is cruder than dictionary-based normalization.
- TF-IDF
- Related: Bag of Words, Cosine Similarity, Inverted Index
A weighting scheme that multiplies a term's frequency in a document by the inverse of the number of documents containing it, so common words count less. It converts text into sparse vectors usable by linear classifiers and search rankers.
- Bag of Words
- Related: TF-IDF, N-gram, Embedding
A representation that counts token occurrences and ignores order, producing a sparse document vector. It is cheap and interpretable but loses word order, negation scope, and multiword meaning.
- N-gram
- Related: Bag of Words, Perplexity, Language Model
A contiguous sequence of n tokens, used to capture local word order in features or in a probabilistic language model. Larger n captures more context but multiplies sparsity and parameter count.
- Language Model
- Related: N-gram, Perplexity, Autoregressive Generation
A model that assigns probabilities to sequences of tokens, usually by predicting the next token given preceding context. It underpins autocomplete, machine translation decoding, speech recognition rescoring, and generative assistants.
- Perplexity
- Related: Language Model, Cross-Entropy Loss, Bilingual Evaluation Understudy
The exponentiated average negative log-likelihood a language model assigns to held-out text. Lower values mean the model is less surprised by real data, but scores are only comparable across models sharing the same tokenizer and vocabulary.
- Cosine Similarity
- Related: TF-IDF, Embedding, Semantic Search
The cosine of the angle between two vectors, ranging from minus one to one and ignoring magnitude. It is the standard way to compare document, sentence, or embedding vectors in retrieval and clustering.
- Naive Bayes Classifier
- Related: TF-IDF, Logistic Regression, Precision and Recall
A probabilistic text classifier that applies Bayes' theorem while assuming features are conditionally independent given the class. Despite the false assumption it is a strong, fast baseline for spam filtering and topic tagging.
- Logistic Regression
- Related: Naive Bayes Classifier, TF-IDF, Precision and Recall
A linear model that predicts class probabilities through a sigmoid or softmax over weighted features. With sparse text features it remains a fast, interpretable, hard-to-beat baseline for many classification tasks.
- Conditional Random Field
- Related: Named Entity Recognition, Part-of-Speech Tagging, Bidirectional Encoder Representations from Transformers
A structured sequence-labeling model that scores whole label sequences and learns transition constraints between adjacent tags. It was the standard for named entity recognition before neural encoders, and it prevents invalid tag transitions.
- Part-of-Speech Tagging
- Related: Named Entity Recognition, Conditional Random Field, Lemmatization
Assigning each token a grammatical category such as noun, verb, or determiner. Tags feed downstream parsing, lemmatization, and entity extraction, and are usually produced by a sequence-labeling model over contextual representations.
- Named Entity Recognition
- Related: Conditional Random Field, Part-of-Speech Tagging, Bidirectional Encoder Representations from Transformers
Detecting spans of text that denote people, organizations, locations, dates, or domain-specific entities and labeling their type. It is a token-classification task central to resume parsing, compliance screening, and information extraction.
- Word Embedding
- Related: Word2Vec, Contextual Embedding, Cosine Similarity
A dense low-dimensional vector learned for each token so that semantically similar words land near each other. Embeddings replace sparse counts as model input and enable similarity, clustering, and transfer learning.
- Word2Vec
- Related: Word Embedding, Contextual Embedding, Cosine Similarity
A family of shallow neural models that learn word vectors by predicting a word from its neighbors, or neighbors from a word, over a large corpus. The resulting static vectors capture analogies but give one vector per word regardless of context.
- Contextual Embedding
- Related: Word Embedding, Bidirectional Encoder Representations from Transformers, Attention Mechanism
A vector for a token computed from its surrounding sentence, so the same word receives different representations in different contexts. It resolves polysemy and is the output of transformer encoders used for transfer learning.
- Attention Mechanism
- Related: Self-Attention, Transformer Architecture, Contextual Embedding
A learned weighting that lets each position gather information from other positions, with weights computed from query-key similarity. It provides content-based, parallelizable context mixing and is the core operation of transformer models.
- Self-Attention
- Related: Attention Mechanism, Transformer Architecture, Positional Encoding
Attention where queries, keys, and values all come from the same sequence, so every token aggregates information from the other tokens in that sequence. Stacked layers build deep contextual representations without recurrence.
- Transformer Architecture
- Related: Self-Attention, Positional Encoding, Bidirectional Encoder Representations from Transformers
A sequence model built from stacked blocks of self-attention and position-wise feed-forward layers with residual connections and normalization. Removing recurrence allows massive parallel training and long-range dependency modeling.
- Positional Encoding
- Related: Transformer Architecture, Self-Attention, Context Window
Information injected into token representations so a transformer can tell where each token sits in the sequence, since attention itself is order-blind. It may be fixed sinusoidal patterns or learned embeddings, and modern variants use rotary or relative schemes.
- Bidirectional Encoder Representations from Transformers
- Related: Masked Language Modeling, Fine-Tuning, Contextual Embedding
A pretrained encoder trained to predict randomly masked tokens using both left and right context. Fine-tuning its contextual representations set strong baselines for classification, question answering, and entity recognition.
- Masked Language Modeling
- Related: Bidirectional Encoder Representations from Transformers, Fine-Tuning, Autoregressive Generation
A pretraining objective that hides a random subset of input tokens and trains the model to recover them from surrounding context. It forces bidirectional understanding and is the basis of encoder-only pretraining.
- Autoregressive Generation
- Related: Large Language Model, Context Window, Hallucination
Producing text one token at a time, each conditioned on all previously generated tokens. Decoding choices such as greedy, beam, or sampling with temperature control creativity, repetition, and latency.
- Large Language Model
- Related: Autoregressive Generation, Prompt Engineering, Fine-Tuning
A transformer with billions of parameters pretrained on vast text corpora to predict the next token, then aligned with instruction tuning or preference optimization. It performs many tasks through prompting rather than task-specific training.
- Context Window
- Related: Autoregressive Generation, Retrieval-Augmented Generation, Positional Encoding
The maximum number of tokens a model can attend to in a single request, covering both input and generated output. Exceeding it forces truncation, chunking, or summarization, and longer windows raise memory and cost.
- Prompt Engineering
- Related: Few-Shot Prompting, Large Language Model, Hallucination
Designing instructions, examples, and output constraints in a model's input to elicit reliable behavior without changing weights. Techniques include few-shot exemplars, role framing, chain-of-thought cues, and structured output requests.
- Few-Shot Prompting
- Related: Prompt Engineering, Fine-Tuning, Large Language Model
Placing a small number of worked input-output examples inside the prompt so the model infers the task pattern. It improves format adherence and accuracy for niche tasks but consumes context and can bias toward example artifacts.
- Fine-Tuning
- Related: Few-Shot Prompting, Bidirectional Encoder Representations from Transformers, Catastrophic Forgetting
Continuing training of a pretrained model on a smaller labeled dataset so its weights adapt to a specific task or style. It beats prompting when labeled data exists and behavior must be consistent and compact.
- Retrieval-Augmented Generation
- Related: Semantic Search, Hallucination, Context Window
A pattern that retrieves relevant passages from an external index and inserts them into the prompt so the model answers from grounded evidence. It reduces hallucination and lets knowledge update without retraining weights.
- Semantic Search
- Related: Cosine Similarity, Retrieval-Augmented Generation, Inverted Index
Retrieval ranked by meaning similarity between embedded queries and documents rather than literal keyword overlap. It handles paraphrase and synonyms but needs a tuned embedding model and often hybrid scoring with lexical search.
- Inverted Index
- Related: TF-IDF, Semantic Search, N-gram
A data structure mapping each term to the list of documents containing it, with positions and frequencies. It enables fast keyword lookup and scoring in search engines and underpins lexical retrieval baselines.
- Hallucination
- Related: Retrieval-Augmented Generation, Large Language Model, Red Teaming
Fluent model output that is factually wrong or unsupported by any source. It arises because generation optimizes plausibility, not truth, and is mitigated with grounding, citations, abstention options, and human review.
- Precision and Recall
- Related: Confusion Matrix, Macro-Averaged F1, Naive Bayes Classifier
Precision is the share of predicted positives that are correct; recall is the share of true positives that were found. Their harmonic mean, F1, summarizes both, and the trade-off should follow the cost of each error type.
- Macro-Averaged F1
- Related: Precision and Recall, Confusion Matrix, Data Drift
F1 computed per class and then averaged with equal weight across classes, so rare classes matter as much as frequent ones. It is preferred over accuracy on imbalanced label sets where majority-class performance dominates.
- Confusion Matrix
- Related: Precision and Recall, Macro-Averaged F1, Data Drift
A table of predicted versus actual class counts that reveals which classes are being mixed up. Inspecting it guides error analysis, threshold tuning, and targeted data collection better than a single aggregate score.
- Bilingual Evaluation Understudy
- Related: Perplexity, Human Evaluation, Cross-Entropy Loss
A translation metric that scores generated text against reference outputs by counting matching n-grams, with a penalty for overly short output. It correlates imperfectly with human judgment and ignores meaning and paraphrase.
- Human Evaluation
- Related: Bilingual Evaluation Understudy, Red Teaming, Hallucination
Judging model outputs with annotators using defined rubrics such as relevance, fluency, and factuality. It is the ground truth for generative quality but needs clear guidelines, calibration, and inter-annotator agreement checks to be trustworthy.
- Data Drift
- Related: Confusion Matrix, Model Monitoring, Catastrophic Forgetting
A change in the statistical distribution of production inputs or outputs relative to the training data, degrading model accuracy over time. Monitoring feature and prediction distributions triggers retraining or rollback before quality visibly collapses.
- Model Monitoring
- Related: Data Drift, Model Registry, Shadow Deployment
Continuously tracking production metrics such as latency, error rates, prediction distributions, and business outcomes to detect degradation. It closes the loop between deployment and retraining and should include alerting thresholds and dashboards.
- Shadow Deployment
- Related: Model Monitoring, A/B Testing, Model Registry
Running a new model alongside the live one on real traffic without serving its output to users, then comparing behavior offline. It exposes failures and latency issues before any user impact, at the cost of duplicated compute.
- A/B Testing
- Related: Shadow Deployment, Model Monitoring, Human Evaluation
Splitting live traffic between a control and a variant model, then comparing a predefined business or quality metric with statistical testing. It establishes causal impact but requires enough traffic and careful guardrails against harm.
- Model Registry
- Related: Model Monitoring, Shadow Deployment, Data Drift
A versioned catalog of trained models with metadata on training data, hyperparameters, evaluation scores, and approval status. It makes deployments reproducible and auditable and supports rollback to a known-good artifact.
- Red Teaming
- Related: Hallucination, Human Evaluation, Data Drift
Adversarial probing of a system to surface harmful, biased, or unsafe outputs before release. For language models it includes jailbreak attempts, prompt injection, and edge-case prompts, with findings driving mitigation and guardrails.
- Cross-Entropy Loss
- Related: Perplexity, Fine-Tuning, Catastrophic Forgetting
The negative log-likelihood of the correct class under the model's predicted distribution, used as the standard training objective for classification and language modeling. Minimizing it pushes probability mass toward the observed targets.
- Catastrophic Forgetting
- Related: Fine-Tuning, Cross-Entropy Loss, Data Drift
Loss of previously learned capability when a model is trained on a new task or domain. It is mitigated by rehearsal data, parameter-efficient tuning, regularization, and evaluation suites that check old tasks after updates.