Reference

Glossary

Training & Customization Fine-Tuning & Model Customization

Glossary

Every technical term used in the course, defined in plain language. Terms are grouped by theme and alphabetized within each group. When a definition references another term, that term is usually defined nearby or in another section. The module where a term is first explained in depth is noted in (M##).

Autoregressive generation

Producing text one token at a time, feeding each generated token back in to predict the next. How LLMs write. (M01)

Base model / Foundation model / Pretrained model

A model that has only been through pretraining. Broadly knowledgeable but generic; it just continues text rather than following instructions. (M01)

Catastrophic forgetting

When fine-tuning on a narrow task makes the model worse at things it used to do well. A key risk to manage. (M05)

Context length / Context window

The maximum amount of text (in tokens) a model can consider at once, e.g., “8k context” = 8,192 tokens. (M01)

Embedding

A list of numbers (a vector) representing a token’s “meaning” as coordinates in a high-dimensional space; similar meanings sit close together. (M01)

Fine-tuning

Continuing to train a pretrained model on a smaller, focused dataset to specialize its behavior, skill, or style. (M00, M02)

Inference

Using a trained model to generate outputs (as opposed to training it). (M00)

Instruct model / Chat model

A base model that has gone through post-training (SFT + preference tuning) so it follows instructions and chats. The “ready to use” version. (M01)

LLM (Large Language Model)

A large neural network trained to predict the next token in text, capable of language tasks. (M01)

Parameters / Weights

The numbers that make up a model. “8B” = 8 billion parameters. Training adjusts these. (M01)

Post-training

The fine-tuning steps (SFT, preference tuning) applied after pretraining to turn a base model into a helpful assistant. (M01)

Pretraining

The initial, expensive phase where a model learns language by predicting the next token across enormous amounts of text. (M01)

RAG (Retrieval-Augmented Generation)

Giving a model relevant information at inference time by retrieving it from a knowledge source and inserting it into the prompt. The tool for knowledge, vs fine-tuning for behavior. (M02)

Self-supervised learning

Learning without human labels by using the data itself as the answer (e.g., predicting the next word). How pretraining works. (M01)

Token

The unit of text a model reads/writes, roughly a word-piece (~4 characters / ~0.75 words in English). (M01)

Tokenizer

The component that converts text into tokens (and back). Must match the model it was trained with. (M01, M04)

Transformer

The neural-network architecture behind modern LLMs, a stack of layers each containing attention and an MLP. (M01)

Attention

The mechanism letting each token look at other tokens and pull in relevant information. Uses Query, Key, Value, and Output projections. (M01)

FFN (Feed-Forward Network) / MLP

The per-token processing sub-layer in a Transformer block; holds much of the model’s parameters and knowledge. (M01)

Layer / Block

One repeating unit of a Transformer (attention + MLP). Models stack many (e.g., 32). (M01)

LM head / Unembedding

The final layer that converts the model’s internal representation into a probability for every token in the vocabulary. (M01)

Q, K, V, O (Query, Key, Value, Output projections)

The four weight matrices in attention; the most common place to attach LoRA adapters. (M01, M07)

RoPE scaling

A technique to extend a model’s usable context length by adjusting its positional encoding. (M15)

Backpropagation (backprop)

The algorithm that computes the gradient for every weight efficiently. Done automatically by frameworks. (M03)

Batch / Batch size

A group of examples processed together for one weight update; batch size = how many. (M03)

Cross-entropy loss

The standard loss for language models; high when the model gave low probability to the correct token. (M03)

Early stopping

Halting training when validation loss stops improving, to prevent overfitting. (M03)

Effective batch size

per_device_batch_size × gradient_accumulation_steps — the real batch size after accumulation. (M03)

Epoch

One full pass through the entire training dataset. Fine-tuning often uses just 1–3. (M03)

Gradient

The direction and steepness of the loss “slope” for each weight; tells you which way to nudge it. (M03)

Gradient accumulation

Summing gradients over several mini-batches before updating, to simulate a larger batch with less memory. (M03)

Gradient checkpointing

Saving memory by recomputing intermediate activations during backprop instead of storing them; costs extra compute. (M08)

Gradient descent

The core training algorithm: repeatedly step “downhill” to reduce loss. (M03)

Hyperparameter

A setting you choose before/around training (learning rate, epochs, rank, etc.), as opposed to the learned weights. (M05)

Learning rate

The size of each gradient-descent step; the single most important hyperparameter. (M03)

Learning-rate schedule

How the learning rate changes over training (e.g., cosine decay). (M03)

Loss

A single number measuring how wrong the model’s predictions are. Training minimizes it. (M03)

Optimizer (Adam / AdamW / 8-bit Adam)

The algorithm that applies gradients to weights, with adaptive step sizes and momentum. Adam stores extra state per weight. (M03)

Overfitting

When the model memorizes training data instead of learning general patterns; good on train, bad on new data. (M03)

Paged optimizer

An optimizer that offloads state to CPU RAM during memory spikes to avoid crashes (from QLoRA). (M08)

Perplexity

A friendlier transform of loss: roughly “how many tokens was the model wavering between.” Lower is better. (M03)

Underfitting

When the model hasn’t learned enough; both train and validation loss stay high. (M03)

Warmup

Starting with a tiny learning rate and ramping up over the first steps, for stability. (M03)

Weight decay

A regularization technique that discourages large weights, helping prevent overfitting. (M03)

Chat template

The model-specific format (with special tokens) for laying out system/user/assistant turns. Must match the model. Applied via apply_chat_template. (M04)

Data card

A short document recording a dataset’s source, size, splits, cleaning, and limitations. (M10)

Data leakage

When test (or validation) examples also appear in training, making evaluation falsely optimistic. (M04, M10)

Deduplication

Removing exact and near-duplicate examples from a dataset. (M10)

Instruction format

A data shape of instruction / optional input / output (e.g., Alpaca-style). (M04)

JSONL (JSON Lines)

A file format with one JSON object per line; the common format for training data. (M04)

Label masking / Completion-only loss

Computing loss only on the assistant’s tokens, so the model learns to respond, not to parrot the prompt. (M04)

Max sequence length

The token cap per training example; longer ones get truncated. Drives memory use. (M04)

Packing

Concatenating multiple short examples into one sequence to reduce wasted padding and speed training. (M04)

Padding

Filler tokens added so examples in a batch are the same length; ignored in the loss. (M04)

Preference format

Data shaped as prompt / chosen / rejected, used for preference tuning. (M04, M12)

Train / Validation / Test split

Dividing data into what the model learns from, what you watch for overfitting, and what you score once at the end. (M04)

Truncation

Cutting off text that exceeds the max sequence length; can silently break examples. (M04)

Adapter

A small trainable module inserted into a frozen model (the original PEFT idea); also a loose name for a LoRA’s saved weights. (M06)

AdaLoRA

A LoRA variant that adaptively allocates rank across layers. (M07)

BitFit

A selective PEFT method that trains only the bias terms. (M06)

Continued pretraining (domain-adaptive pretraining)

Extra next-token-prediction training on in-domain text to inject domain knowledge before SFT. (M15)

DoRA

A LoRA variant that decomposes weights into magnitude and direction; often a small quality gain. (M07)

Full fine-tuning

Updating all of a model’s weights. Maximum flexibility, maximum cost. (M05)

LoRA (Low-Rank Adaptation)

The leading PEFT method: freeze the model and train small low-rank “patch” matrices (A and B) added to the weights. (M07)

lora_alpha

The LoRA scaling factor; effective scaling is alpha / r. Often set to r or 2r. (M07)

lora_dropout

Dropout applied within the LoRA path to reduce overfitting. (M07)

Merge (merge_and_unload)

Folding a LoRA adapter into the base weights so there’s zero inference overhead. (M07)

Model merging (soups / TIES / DARE)

Combining multiple fully fine-tuned models’ weights into one without retraining. (M15)

MoE (Mixture-of-Experts)

An architecture with many expert sub-networks and a router that activates a few per token. (M15)

ORPO

A method combining SFT and preference tuning into one step, no reference model needed. (M12)

PEFT (Parameter-Efficient Fine-Tuning)

The family of methods that train only a tiny number of new parameters while freezing the base model. (M06)

PiSSA

A LoRA variant with smarter initialization from the base weights’ principal components. (M07)

Prefix tuning / Prompt tuning / P-Tuning

Additive PEFT methods that prepend trainable “virtual tokens” (soft prompts) to the input. (M06)

QLoRA

LoRA on top of a 4-bit quantized base model, enabling fine-tuning of large models on a single GPU. (M08)

Rank (r)

The size of a LoRA patch’s bottleneck; controls its capacity. Common starting values 8–16. (M07)

rsLoRA (rank-stabilized LoRA)

A LoRA variant that rescales so high ranks train more stably. (M07)

SFT (Supervised Fine-Tuning)

Fine-tuning on input→desired-output examples; the workhorse technique. (M05)

Soft prompt

Trainable input vectors that act like a learned prompt expressed as numbers. (M06)

Target modules

Which weight matrices receive LoRA adapters (e.g., q/k/v/o projections, MLP layers, or “all-linear”). (M07)

Beta (DPO)

The DPO parameter controlling how strongly to stay near the reference (SFT) model. (M12)

DPO (Direct Preference Optimization)

A simpler alternative to RLHF that trains directly on chosen/rejected pairs, no reward model or RL needed. The common default. (M12)

IPO / KTO / SimPO

Variants of DPO with different objectives or data needs (KTO uses single good/bad labels, not pairs). (M12)

KL-divergence penalty

A “leash” keeping the tuned model from drifting too far from the original, preventing reward hacking. (M12)

PPO (Proximal Policy Optimization)

The reinforcement-learning algorithm used in classic RLHF. (M12)

Preference tuning

Teaching a model judgment/taste by training on “this response is better than that one.” (M12)

Reward hacking

When a model games the reward signal to score high without genuinely being better. (M12)

Reward model

In RLHF, a separate model trained to score responses by predicted human preference. (M12)

RLAIF (RL from AI Feedback)

Preference tuning where the “better/worse” labels come from an AI rather than humans. (M12)

RLHF (Reinforcement Learning from Human Feedback)

The original preference-tuning approach: train a reward model, then optimize the LLM against it with RL. (M12)

Distillation

Using a strong “teacher” model to generate outputs to train a smaller “student” model. (M09)

Evol-Instruct

Generating data by prompting a model to make existing examples harder and more varied. (M09)

LLM-as-a-judge

Using a strong model to score or compare outputs, for filtering data or evaluating models. (M09, M11)

Mode collapse (in generation)

When generated data lacks diversity, repeating similar outputs. (M09)

Model collapse

Degradation that can occur when models are trained repeatedly on model-generated data. (M09)

Self-Instruct

Generating new instructions (and answers) from a small seed set to bootstrap a dataset. (M09)

Synthetic data

Training examples generated by an AI model rather than collected from humans. (M09)

AWQ

A post-training quantization method for fast, accurate GPU inference. (M08, M14)

Batching / Continuous batching

Processing many requests together to use the GPU efficiently; the main cost lever in serving. (M14)

bitsandbytes

The library that handles 4-bit/8-bit quantization for QLoRA. (M08)

Double quantization

Quantizing the quantization constants too, saving extra memory (from QLoRA). (M08)

FP32 / FP16 / BF16

32-, 16-bit floating-point precisions. BF16 is the stable 16-bit default for training. (M08)

GGUF

A file format (llama.cpp/Ollama) for running quantized models efficiently on CPU/Mac. (M08, M14)

GPTQ

A post-training quantization method for efficient GPU inference. (M08, M14)

Guardrails

Input/output filters around a deployed model that block unsafe or disallowed content. (M14)

INT8 / INT4

8- and 4-bit integer precisions used in quantization. (M08)

KV cache

Cached attention Keys/Values for already-generated tokens; speeds generation but uses memory that grows with context and concurrency. (M14)

llama.cpp

A lightweight engine for running quantized models on CPU/GPU/Mac. (M14)

NF4 (NormalFloat4)

The 4-bit format used by QLoRA, designed to match how weights are distributed. (M08)

Ollama

A simple tool for running GGUF models locally; great for prototyping. (M14)

PagedAttention

vLLM’s memory-management technique enabling efficient batched serving. (M14)

Precision

How many bits are used to store each weight; more bits = more exact but more memory. (M08)

Quantization

Converting weights to lower precision to save memory, with little quality loss if done well. (M08)

Quantization level (Q4_K_M, etc.)

Named trade-offs of size vs quality for GGUF models. (M08, M14)

TGI (Text Generation Inference)

Hugging Face’s production model-serving engine. (M14)

Time-to-first-token / Tokens-per-second

The two components of latency: how fast output starts, and how fast it streams. (M14)

vLLM

A high-performance GPU serving engine with continuous batching and LoRA support; the default for serious serving. (M14)

Axolotl

A higher-level, config-driven fine-tuning framework. (M00)

datasets (Hugging Face)

Library for loading and processing training data. (M00)

peft (Hugging Face)

Library implementing LoRA and other PEFT methods. (M00, M07)

PyTorch

The underlying deep-learning framework that runs the math on the GPU. (M00)

transformers (Hugging Face)

The standard library for loading models and tokenizers. (M00)

trl (Transformer Reinforcement Learning)

Library providing ready-made trainers (SFTTrainer, DPOTrainer). (M00, M05)

Unsloth

A library that makes LoRA/QLoRA fine-tuning faster and more memory-efficient. (M00)

Accuracy / Precision / Recall / F1

Standard metrics for objective tasks like classification. (M11)

A/B comparison (blinded)

Showing raters two outputs for the same prompt without revealing which model produced which, and asking which is better. (M11)

Baseline

A reference point (e.g., the un-fine-tuned base model) you compare your model against on the same test set. (M11)

BLEU / ROUGE / METEOR

Word-overlap metrics for generation tasks; weak proxies, use cautiously. (M11)

BERTScore

An embedding-based metric comparing meaning rather than exact words. (M11)

Position bias / Length bias

Tendencies of LLM judges to favor a certain answer position or longer answers; must be controlled for. (M11)

Regression testing

Checking the fine-tuned model didn’t get worse at general tasks it should still handle. (M11)

Test set

Held-out, ideally real, examples used once at the end to score the model honestly. (M04, M11)

Win rate

The fraction of comparisons your model wins in A/B evaluation. (M11)

⬅️ Back to: Course Index