Transformers glossary
95 key terms, each in one sentence, with the lesson that teaches it.
#
- [CLS] token
- a special, learned token prepended to a sequence, whose final output summarizes the whole input for classification.
- Vision Transformers
A
- Absolute position
- a token's fixed index within the sequence (0, 1, 2, …), as opposed to its position relative to another token.
- Learned Positional Embeddings
- Active parameters
- the subset of a model's total parameters actually used to process a given input — can be far smaller than the total in an MoE model.
- Mixture-of-Experts Transformer Blocks
- All-reduce
- combining (here, summing) partial results computed on different devices into one final result.
- Splitting a Transformer Across Devices
- Associativity
- the property that matrix multiplication gives the same result regardless of grouping, which the linear-order trick relies on.
- Linear Attention Approximations
- Attention-pair cost
- the number of query-key comparisons an attention computation makes, used here as a simple proxy for compute cost.
- Choosing an Architecture Family for a Task
- Autoregressive
- generating output one step at a time, where each new output becomes part of the input for the next step.
- Decoder-Only Architectures
- Autoregressive generation
- producing a sequence one token at a time, each depending on everything generated before it.
- KV-Caching for Autoregressive Inference
B
- Batching
- grouping multiple inference requests together to process in a single pass, amortizing fixed per-batch overhead.
- Inference Serving Trade-offs
- Bidirectional attention
- attention that allows looking both backward and forward in a sequence, as opposed to causal (backward-only) attention.
- Encoder-Only Architectures
C
- Causal mask
- blocks every query from attending to positions later than itself in the sequence.
- Attention Masks: Padding and Causal Masking
- Causal masking
- restricting attention so a position can only see itself and earlier positions, never later ones.
- Decoder-Only Architectures
- Chunk
- the portion of a split weight matrix stored and computed on one device.
- Splitting a Transformer Across Devices
- Co-occurrence score
- WordPiece's merge criterion, a pair's frequency divided by the product of its two pieces' individual frequencies.
- WordPiece and SentencePiece
- Combined sequence
- a single sequence built by concatenating vectors from more than one modality.
- Multimodal Transformers as an Architecture Pattern
- Correction factor
- the rescaling term that keeps a running softmax computation consistent as new blocks of data arrive.
- IO-Aware Attention Computation
- Cross-attention
- attention where queries come from one sequence and keys/values come from a separately computed sequence.
- Encoder-Decoder Architectures as a Pattern
- Cross-modal attention
- attention weights spreading across positions from different modalities within one computation.
- Multimodal Transformers as an Architecture Pattern
D
- d_ff
- the width of the feed-forward sublayer's hidden layer, conventionally 4 times d_model.
- The Feed-Forward Sublayer
- the feed-forward sublayer's hidden width, conventionally 4 times d_model.
- Counting a Transformer's Parameters and FLOPs
- d_model
- the width of every vector flowing through a transformer's layers.
- Token Embeddings and Embedding Scaling
- Decoder-only
- a transformer architecture using causal masking throughout, suited to generating text one token at a time.
- Decoder-Only Architectures
- Direction-preserving
- a transformation that outputs a positive scalar multiple of its input, leaving relative proportions and signs unchanged.
- RMSNorm vs LayerNorm
E
- Effective receptive field
- how far information can travel across multiple stacked layers, even when each individual layer's range is limited.
- Sparse and Local (Windowed) Attention
- Elementwise multiplication (⊙)
- multiplying two vectors position by position, combining the gate and up projections.
- Modern Feed-Forward Variants: SwiGLU and GeGLU
- Embedding scaling
- multiplying a looked-up embedding by √d_model before it is combined with positional information.
- Token Embeddings and Embedding Scaling
- Embedding table
- the lookup matrix mapping each vocabulary entry to a vector, sized vocabulary_size × d_model.
- Vocabulary Size and Out-of-Vocabulary Trade-offs
- a vocabulary_size × d_model matrix, one row per token, learned during training.
- Token Embeddings and Embedding Scaling
- Encoder-decoder architecture
- a transformer combining a bidirectional encoder stack, a causal decoder stack, and cross-attention connecting them.
- Encoder-Decoder Architectures as a Pattern
- Encoder-only
- a transformer architecture using only padding masking, with no causal restriction — every position attends to every other.
- Encoder-Only Architectures
- End-of-word marker
- a symbol marking where one word ends, preventing merges across word boundaries.
- Byte Pair Encoding
- End-to-end
- covering every stage from raw input to final output, with no stage skipped or special-cased.
- Capstone: Assembling a Tiny Transformer from the Ground Up
- Expansion-then-projection
- widening a vector to a larger hidden dimension before compressing it back to the original width.
- The Feed-Forward Sublayer
- Expert
- one of several parallel feed-forward sublayers in a mixture-of-experts block.
- Mixture-of-Experts Transformer Blocks
F
- Feature map (φ)
- a function applied to queries and keys in place of softmax, chosen to make the linear-order computation valid.
- Linear Attention Approximations
- FLOPs (floating-point operations)
- a measure of computational work, roughly proportional to parameter count for one forward pass through a token.
- Counting a Transformer's Parameters and FLOPs
G
- Gate
- a projection passed through an activation function, controlling how much of a parallel projection's value passes through.
- Modern Feed-Forward Variants: SwiGLU and GeGLU
- Grouped-query attention (GQA)
- sharing one key/value projection per group of heads, a middle ground between standard multi-head attention and MQA.
- Multi-Query and Grouped-Query Attention
I
- IO-aware
- designed around minimizing data movement between slow and fast memory, not just minimizing arithmetic operations.
- IO-Aware Attention Computation
K
- KV cache
- stored keys and values for every token generated so far, reused instead of recomputed at each new step.
- KV-Caching for Autoregressive Inference
L
- Latency
- the total time a single request takes, including both time spent waiting to be batched and time spent being processed.
- Inference Serving Trade-offs
- Length extrapolation
- a model's ability to behave sensibly on sequences longer than anything seen during training.
- ALiBi and Length Extrapolation
- Linear attention
- an attention computation reorganized to scale linearly, rather than quadratically, with sequence length.
- Linear Attention Approximations
- Linear bias
- a penalty that grows proportionally with distance, subtracted directly from an attention score.
- ALiBi and Length Extrapolation
- Local attention
- attention restricted to a neighbourhood around each position, instead of the full sequence.
- Sparse and Local (Windowed) Attention
- Logit
- an unnormalized score for one vocabulary entry, before any softmax turns it into a probability.
- Weight Tying
- Lossless tokenization
- a scheme where the original text can be exactly reconstructed from its tokens, with no ambiguity about spacing.
- WordPiece and SentencePiece
M
- Masked language modeling (MLM)
- a training objective that predicts a masked-out token from its surrounding bidirectional context.
- Encoder-Only Architectures
- Masked score
- an attention score set to negative infinity before the softmax, guaranteeing zero attention weight.
- Attention Masks: Padding and Causal Masking
- max_length
- the largest sequence position a learned positional table has an entry for.
- Learned Positional Embeddings
- Merge
- combining the most frequent adjacent symbol pair into one new symbol, BPE's single training step.
- Byte Pair Encoding
- Message passing
- a GNN's mechanism for propagating information only between directly connected nodes.
- Graph Transformers
- Modality
- a type of data (text, image, audio) that can be converted into a token sequence its own way.
- Tokenizing Beyond Text
- a type of input data (text, image, audio) with its own front-end producing vectors of a shared width.
- Multimodal Transformers as an Architecture Pattern
- Multi-query attention (MQA)
- sharing a single key/value projection across every attention head.
- Multi-Query and Grouped-Query Attention
N
- Non-embedding parameters
- a model's parameters excluding the embedding table, often reported separately in scaling-law analysis.
- Counting a Transformer's Parameters and FLOPs
- num_kv_heads
- the number of distinct key/value projections, which can be fewer than the number of query heads.
- Multi-Query and Grouped-Query Attention
O
- Online (running) softmax
- computing softmax incrementally over blocks, using a running maximum and sum, instead of requiring the full row at once.
- IO-Aware Attention Computation
- Output projection
- the matrix mapping a final hidden state to a score (logit) for every vocabulary entry.
- Weight Tying
P
- Padding mask
- blocks every query from attending to positions that are only padding, not real tokens.
- Attention Masks: Padding and Causal Masking
- Patch
- a fixed-size, non-overlapping square region of an image, flattened into one vector.
- Tokenizing Beyond Text
- Patch embedding
- a learned linear projection turning a flattened image patch into a model-width vector.
- Vision Transformers
- Patchifying
- cutting an input into fixed-size pieces as a deterministic alternative to learned tokenization.
- Tokenizing Beyond Text
- Pipeline
- the ordered sequence of stages — tokenization, embedding, transformer blocks, output projection — that turns raw text into a prediction.
- Capstone: Assembling a Tiny Transformer from the Ground Up
- Position-wise
- applied identically and independently to each position in a sequence, with no mixing between positions.
- The Feed-Forward Sublayer
- Positional table
- a trained embedding table indexed by sequence position instead of token id.
- Learned Positional Embeddings
- Post-norm
- normalizing the sum of a sublayer's input and output, after they're added together.
- Layer Normalization Placement: Pre-Norm vs Post-Norm
- Pre-norm
- normalizing only the copy of the input fed into a sublayer, leaving the residual stream itself unnormalized.
- Layer Normalization Placement: Pre-Norm vs Post-Norm
Q
- Quadratic recomputation
- the wasted cost of recomputing every earlier token's key and value at every single generation step, without caching.
- KV-Caching for Autoregressive Inference
R
- Relative position
- positional information expressed as the distance between two tokens, rather than either token's absolute index.
- Relative Position and RoPE
- Residual connection
- adding a sublayer's input to its output, instead of replacing the input entirely.
- Residual Connections in Transformers
- Residual stream
- the running sum of contributions carried forward through a stack of residual-connected layers.
- Layer Normalization Placement: Pre-Norm vs Post-Norm
- RMSNorm
- normalization that rescales a vector by its root-mean-square, without subtracting the mean.
- RMSNorm vs LayerNorm
- Rotary position embedding (RoPE)
- a positional scheme that rotates queries and keys so attention scores depend only on relative distance.
- Relative Position and RoPE
- Rotation angle
- the position-proportional angle RoPE uses to rotate a vector's paired dimensions.
- Relative Position and RoPE
- Router
- a small learned network that scores each expert for a given input and selects the top few.
- Mixture-of-Experts Transformer Blocks
S
- Sequence-to-sequence
- a task that transforms one complete input sequence into a different output sequence, such as translation.
- Encoder-Decoder Architectures as a Pattern
- Sequence-to-sequence task
- a task whose output is a genuine transformation of a separate input, the natural fit for encoder-decoder.
- Choosing an Architecture Family for a Task
- Shortest-path distance
- the minimum number of edges connecting two nodes in a graph, computed via breadth-first search.
- Graph Transformers
- Signal preservation
- how much of an original input's information survives after passing through many layers.
- Residual Connections in Transformers
- Slope
- a fixed, per-head constant controlling how steeply ALiBi's bias penalizes distance.
- ALiBi and Length Extrapolation
- Stacking
- repeating the same block structure many times, with independently trained weights at each depth, to build a full transformer.
- Assembling One Transformer Block
- Structural bias
- an attention-score adjustment based on graph structure, used in place of a hard adjacency mask.
- Graph Transformers
- Sublayer
- one of the two main computations inside a transformer block — the attention sublayer or the feed-forward sublayer.
- Residual Connections in Transformers
- one of the two main computations (attention or feed-forward) inside a transformer block.
- Assembling One Transformer Block
- Subword token
- a vocabulary entry smaller than a whole word but larger than a single character.
- Byte Pair Encoding
- SwiGLU / GeGLU
- gated feed-forward designs using SiLU or GELU, respectively, as the gating activation.
- Modern Feed-Forward Variants: SwiGLU and GeGLU
T
- Task shape
- whether a task has no generated output, one continuous growing sequence, or two separate input/output sequences.
- Choosing an Architecture Family for a Task
- Tensor parallelism
- splitting a single weight matrix's rows or columns across multiple devices.
- Splitting a Transformer Across Devices
- Throughput
- the rate at which requests are processed, typically requests or tokens per second.
- Inference Serving Trade-offs
- Tokens per word
- how many vocabulary entries, on average, one word decomposes into — falls as vocabulary size grows.
- Vocabulary Size and Out-of-Vocabulary Trade-offs
- Transformer block
- the repeated unit of a transformer, containing one attention sublayer and one feed-forward sublayer, each wrapped in normalization and a residual connection.
- Assembling One Transformer Block
U
- Untrained weights
- randomly initialized parameters, used here to verify the pipeline's mechanics rather than to produce a meaningful prediction.
- Capstone: Assembling a Tiny Transformer from the Ground Up
V
- Vision Transformer (ViT)
- a transformer applied to image patches, using no convolutional layers.
- Vision Transformers
- Vocabulary size
- the total number of distinct entries a tokenizer can produce, set by how many merges (or equivalent) its training ran for.
- Vocabulary Size and Out-of-Vocabulary Trade-offs
W
- Weight tying
- reusing the input embedding table as the output projection instead of training a separate matrix.
- Weight Tying
- Whitespace marker (▁)
- a visible symbol standing in for a space, letting SentencePiece treat spaces as ordinary, mergeable symbols.
- WordPiece and SentencePiece
- Window radius
- the fixed distance within which a position may attend to its neighbours under windowed attention.
- Sparse and Local (Windowed) Attention
No term matches that filter.