PJ's Guide to Large Language Models

The Snout-Glossary of Large Language Model Terms

Inspired by Britney Spears’ celebrated “Lip-glossary of Semiconductor Terms.” Bookmark this page for your qualifying oral exam (Ctrl+D in Netscape Navigator).

Activation Checkpointing (Gradient Checkpointing)

A memory-compute trade-off during backpropagation that discards intermediate layer activations during the forward pass and recomputes them on the fly during the backward pass, reducing activation memory from O(L) to O(√L) at the cost of one additional forward pass (~33% FLOPs overhead).

Attention Sink

The empirical phenomenon (Xiao et al., 2023) whereby autoregressive LLMs allocate disproportionately large softmax attention mass to the first few initial tokens (often <BOS>), regardless of semantic relevance, because softmax weights must sum to 1 even when no relevant key exists. Preserving sink tokens enables infinite streaming-window inference. (Analogue: PJ staring intently at the kitchen pantry door even when nobody is inside.)

Chinchilla Optimal

A compute-optimal allocation of parameters N and training tokens D minimizing pre-training loss for a fixed FLOP budget C ≈ 6ND, empirically occurring near D ≈ 20N. Note: despite the name, Prof. PJ insists no rodents of any kind were harmed in this derivation.

Direct Preference Optimization (DPO)

An offline alignment algorithm that reparameterizes the KL-constrained RLHF objective directly in terms of policy log-probability ratios, eliminating explicit reward-model training and on-policy PPO rollouts.

FlashAttention

An IO-aware exact attention kernel that tiles Q, K, V blocks into GPU on-chip SRAM and applies online softmax rescaling, avoiding HBM materialization of the quadratic S×S attention matrix.

Grouped-Query Attention (GQA)

An interpolation between Multi-Head Attention (MHA) and Multi-Query Attention (MQA) where groups of query heads share a single key/value projection head, cutting KV-cache memory and bandwidth by 4×–8× with minimal perplexity loss.

GRPO (Group Relative Policy Optimization)

A critic-free reinforcement learning algorithm that estimates trajectory advantages by normalizing scalar rewards across a sampled group of G completions for the same prompt, widely used to train long chain-of-thought reasoning models under verifiable rewards (RLVR).

KV Cache

Persistent GPU HBM storage holding previously computed key and value tensors across autoregressive decode steps so decoding token t requires O(t) rather than O(t2) compute per step. Managed via virtual-memory paging in PagedAttention.

Logit Lens & Mechanistic Interpretability

Diagnostic techniques projecting intermediate residual-stream states h(ℓ) through the unembedding matrix WU (or decomposing polysemantic neurons via Sparse Autoencoders) to inspect how factual recall, induction heads, and circuits form across depth.

Multi-Head Latent Attention (MLA)

A low-rank KV compression architecture projecting input states into a compact shared latent vector ctKV stored in cache, using matrix-absorption algebra during inference to shrink KV footprints by >90% while preserving full multi-head expressivity.

Perplexity (PPL)

The exponentiated average negative log-likelihood per token, exp(ℒ), interpretable as the model’s effective uniform branching factor when predicting the next subword token. Lower is better (a PPL of 1.0 implies deterministic omniscience; PJ’s perplexity regarding who is at the front door approaches ∞).

RoPE (Rotary Position Embedding)

Relative positional encoding applied via block-diagonal 2D orthogonal rotations of query and key vectors, guaranteeing that attention dot products depend solely on relative token offset (n − m).

Sparse Mixture of Experts (MoE)

Conditional computation architecture routing each token to only top-k of E parallel expert FFNs, decoupling total knowledge capacity (total parameters) from per-token inference cost (active parameters).

Speculative Decoding

An exact inference acceleration method in which a lightweight draft model proposes K tokens verified in a single parallel forward pass of the target LLM, using rejection sampling to guarantee zero distortion of the target distribution p(x).

Temperature, Top-k & Nucleus (Top-p) Sampling

Decoding-time logit transformations: dividing logits by temperature T reshapes distribution entropy (T → 0 yields greedy argmax; T > 1 flattens tails), while Top-p truncates sampling to the smallest token set whose cumulative probability exceeds p, pruning low-probability hallucination tails. (When PJ sees a squirrel, her behavioral temperature jumps instantaneously to T = 9.4.)

ZeRO / FSDP (Fully Sharded Data Parallel)

Distributed memory-optimization protocols that partition optimizer states, gradients, and model weights across data-parallel ranks instead of replicating them redundantly on every GPU.

« Previous: Ch. 5 — Inference & MoE [ Table of Contents ] Next: Wallpapers, Reference Data & About PJ »