Domain Neighborhood
Attention & Transformers
The sequence model backbone: tokenization, self-attention, positional encodings, and the transformer block that powers modern LLMs.
Start here. Predict once, then carry the invariant forward.
q_ik_jsoftmaxΣ α_ij v_jStabilize the first mechanism, make one prediction, then move one node forward.
Recommended Route
Start here, then follow the prerequisites forward.
This sequence is ordered for learning rather than inventory. Published notebooks with an unavailable prerequisite—or a same-domain route step that depends on one—are labeled in the full inventory instead of being presented as ready steps.
- 01Scaled Dot-Product Attention & Transformer Layers
The core transformer operation: compute attention weights from query-key dot products, then mix values to copy information across a sequence.
18 mincodedemoafter Maximum Likelihood, Dot ProductCheck Maximum Likelihood first if the symbols feel slippery.
- 02Rotary Position Embeddings (RoPE)
A positional encoding that rotates queries and keys so attention depends on relative position via phase differences.
14 mincodedemoafter Scaled Dot-Product Attention & Transformer LayersWhy this follows: Rotary Position Embeddings (RoPE) uses Scaled Dot-Product Attention & Transformer Layers directly.
- 03Layer Normalization & RMSNorm
Normalize one token/example vector across features: LayerNorm centers and scales, while RMSNorm keeps RMS-based scaling without mean-centering.
14 mincodedemoafter Scaled Dot-Product Attention & Transformer Layers, Residual Connections & Skip ConnectionsWhy this follows: both pages keep the attention transformers thread active.
- 04Tokenization & Vocabulary Design
How text becomes token IDs: segmentation, BPE/unigram tokenizers, and the tradeoffs that shape cost and capability.
14 mincodedemoafter Maximum Likelihood, Representation Learning & Embedding GeometryWhy this follows: both pages keep the attention transformers thread active.
- 05Efficient Attention at Scale: KV Cache, GQA & FlashAttention
How attention becomes practical at long context: KV caching for decoding, grouped-query attention, and IO-aware kernels like FlashAttention.
26 mincodedemoafter Scaled Dot-Product Attention & Transformer Layers, Rotary Position Embeddings (RoPE), Efficiency: Quantization, Distillation, LoRA & Sparse MoEWhy this follows: both pages keep the attention transformers thread active.
- 06Long Context Engineering: RoPE Scaling, KV Compression & Memory Optimization
How frontier LLMs stretch context windows: positional extrapolation (RoPE scaling) plus KV cache memory tricks (GQA, paging, quantization, compression).
22 mincodedemoafter Scaled Dot-Product Attention & Transformer Layers, Rotary Position Embeddings (RoPE), Efficient Attention at Scale: KV Cache, GQA & FlashAttentionWhy this follows: Long Context Engineering: RoPE Scaling, KV Compression & Memory Optimization uses Efficient Attention at Scale: KV Cache, GQA & FlashAttention directly.
- 07FlashAttention: IO-Aware Attention
A fused, tiled attention implementation that avoids materializing the full T x T matrix by using an online softmax, reducing memory traffic and speeding up long-context training/inference.
18 mincodedemoafter Efficient Attention at Scale: KV Cache, GQA & FlashAttention, Long Context Engineering: RoPE Scaling, KV Compression & Memory OptimizationWhy this follows: FlashAttention: IO-Aware Attention uses Long Context Engineering: RoPE Scaling, KV Compression & Memory Optimization directly.
All Published Notebooks
Browse the territory.
Scaled Dot-Product Attention & Transformer Layers
The core transformer operation: compute attention weights from query-key dot products, then mix values to copy information across a sequence.
Rotary Position Embeddings (RoPE)
A positional encoding that rotates queries and keys so attention depends on relative position via phase differences.
Layer Normalization & RMSNorm
Normalize one token/example vector across features: LayerNorm centers and scales, while RMSNorm keeps RMS-based scaling without mean-centering.
Tokenization & Vocabulary Design
How text becomes token IDs: segmentation, BPE/unigram tokenizers, and the tradeoffs that shape cost and capability.
Efficient Attention at Scale: KV Cache, GQA & FlashAttention
How attention becomes practical at long context: KV caching for decoding, grouped-query attention, and IO-aware kernels like FlashAttention.
Long Context Engineering: RoPE Scaling, KV Compression & Memory Optimization
How frontier LLMs stretch context windows: positional extrapolation (RoPE scaling) plus KV cache memory tricks (GQA, paging, quantization, compression).
FlashAttention: IO-Aware Attention
A fused, tiled attention implementation that avoids materializing the full T x T matrix by using an online softmax, reducing memory traffic and speeding up long-context training/inference.
Advanced Bridges