Preface - Transformer System
A technical study of foundation models, from learning objectives and Transformer architecture to training, execution, and deployment, followed by autonomous-agent infrastructure around a fixed trained model.
A technical study of foundation models, from learning objectives and Transformer architecture to training, execution, and deployment, followed by autonomous-agent infrastructure around a fixed trained model.
A derivation- and implementation-oriented study of how contextual Transformer rows become pooled vectors, sequence and token predictions, extractive spans, and retrieval scores without an autoregressive generation loop.
The reusable production method behind Transformer System: corpus audits, owner graphs, non-compressible depth, bounded research loops, executable evidence, visual provenance, publication closure, and a bootstrap prompt for a constrained reinforcement learning series.
A source-audited study of extrapolation: scale-ordered validation, alternative scaling-law families, predictive model selection, repeated data, dependence, and effective-data constraints.
A source-audited study of over-training, downstream metric behavior, lifecycle cost, measured serving demand, uncertainty-aware artifact selection, pilot gates, and a training authorization that hands release and rollback requirements to the serving and deployment modules.
A source-audited study of neural scaling experiments: measurement contracts, power laws, joint model-data loss surfaces, compute-optimal allocation, paper-contract comparison, fitting, and uncertainty.
A mechanism-level reconstruction of knowledge distillation: student architecture, teacher supervision, matched targets, prefix distributions, teacher access, and online or cached training execution.
A mechanism-level reconstruction of Transformer pruning: removal units, masks, dependency closure, sparse and smaller-dense artifacts, recovery, and the runtime proof required before zeros become acceleration.
A derivation- and implementation-oriented study of how images, documents, audio, video, tools, and actions become addressable units with aligned spatial, temporal, and structural metadata.
A derivation- and implementation-oriented comparison of modality encoders, linear and nonlinear projectors, learned-query resamplers, prefix fusion, gated cross-attention, and their training and runtime contracts.
A tensor- and state-machine study of multimodal placeholder expansion, sequence packing, attention and loss masks, training stages, prefill/decode execution, media caching, batching, and safe reuse.
A derivation- and implementation-oriented study of exact KV offload, compute-near-data attention, hierarchical residency, query-dependent retrieval, recallable memory, consistency, fallback, and serving evaluation.
A quantitative bridge from Transformer tensor algebra to GPU execution: kernels, grids, blocks, warps, SM residency, registers, shared memory, coalescing, tiling, fusion, roofline limits, and profiler evidence.
A quantitative reconstruction of FlashAttention-3 and FlashAttention-4: Hopper TMA/WGMMA pipelines, Blackwell TMEM and 2-CTA MMA, softmax bottlenecks, FP8 accuracy, backward scheduling, and benchmark evidence.
A quantitative reconstruction of multi-query and grouped-query attention: KV-head ownership, checkpoint conversion, cache bytes, logical broadcast, grouped decode reuse, tensor parallelism, and failure diagnosis.
A tensor-, algebra-, and kernel-level reconstruction of Multi-Head Latent Attention: latent KV cache state, decoupled RoPE, weight absorption, DeepSeek reference paths, FlashMLA scheduling, FP8 cache layout, sparse variants, and parity diagnosis.
A tensor-to-cluster study of MoE execution: logical and physical experts, variable-size dispatch, all-to-all communication, grouped and block-sparse kernels, prefill/decode modes, expert replication, topology, overlap, precision, observability, and failure recovery.
A rigorous study of why low-rank adaptation can work and where it fails: intrinsic-dimension measurement, matrix manifolds, SVD reconstruction, factor redundancy, initialization gradients, NTK preservation, expressive-power bounds, feature learning, and forgetting.
A tensor-level study of routing outside FFN experts: Mixture of Attention Heads, SwitchHead, Mixture-of-Depths, causal route prediction, per-layer KV consequences, MoD+MoE composition, and staged multimodal sparse training.
A mechanism-level study of mixtures of LoRA adapters: routing granularity, joint versus post-hoc training, HydraLoRA factor sharing, router collapse, static and dynamic composition, continual low-rank state, and multi-adapter runtime integration.
A derivation-, tensor-, training-, and runtime-level comparison of draft models, retrieval and prompt lookup, self-speculation, dependent draft heads, multi-candidate exact sampling, token-tree construction, and hardware-aware tree optimization.
A derivation-, state-, scheduler-, and operations-level treatment of continuous-batch speculative decoding, adaptive draft budgets, goodput control, target and draft cache synchronization, evaluation, canary release, and rollback.
A statistical, systems, and release-engineering treatment of quantized deployment decisions: immutable candidate tuples, paired non-inferiority tests, workload-shaped latency and goodput curves, memory and energy ledgers, Pareto selection, shadow and canary release, production observability, and cache-safe rollback.
A derivation- and implementation-oriented treatment of LLM quantization outliers: geometric diagnostics, mixed-precision decomposition, SmoothQuant scaling, affine shifts, fixed and learned rotations, structured learned transforms, graph fusion, calibration, and runtime cost.
A derivation- and implementation-oriented treatment of scalar weight-only post-training quantization: round-to-nearest, layer reconstruction geometry, OBD/OBS/OBQ, GPTQ compensation and lazy block updates, AWQ activation-aware scaling, calibration state, packed artifacts, and runtime kernels.
A derivation- and implementation-oriented treatment of extreme weight-only compression: sensitivity-weighted nonuniform codebooks, dense-and-sparse exceptions, SpQR's hierarchical representation, AQLM additive codebooks, QuIP# incoherence and E8 lattice codes, VPTQ second-order vector quantization, artifact bit ledgers, and runtime decoder contracts.
A derivation- and implementation-oriented treatment of request-dependent quantization: dynamic activation scales, integer GEMM epilogues, attention scale placement, persistent KV-cache rate and metadata, streaming append state, KIVI, KVQuant, PrefixQuant, QServe W4A8KV4, production FP8 cache formats, and serving correctness.
A derivation- and implementation-oriented treatment of quantization-aware training: fake-quant arithmetic, straight-through gradients, learned step sizes and clipping, observer schedules, LLM-QAT data-free distillation, weight/activation/KV insertion sites, efficient QAT variants, distributed training state, and export parity.
A derivation- and implementation-oriented treatment of native low-bit Transformer design: BitLinear, binary and ternary weight codes, latent-weight optimization, variance control, BitNet b1.58, OneBit SVID and distillation, activation-lowering variants, distributed scale ownership, and the boundary between a code alphabet and an executable runtime.
A byte-, tensor-, graph-, and kernel-level treatment of quantized deployment artifacts: safetensors, GGUF, ONNX QDQ/QOperator, packing and alignment, sharding, converter and loader state machines, topology-aware placement, kernel admission, parity ladders, startup memory, security, and runtime integration across vLLM, TorchAO, TensorRT-LLM, and llama.cpp.
A derivation- and implementation-oriented study of Transformer MLPs: position-wise channel mixing, activation and GLU variants, SwiGLU width matching, backward flow, fused execution, knowledge interpretations, and memory alternatives.
A derivation- and implementation-oriented reconstruction of residual learning, LayerNorm and RMSNorm geometry, backward flow, Pre-LN/Post-LN ordering, depth scaling, dropout, and Transformer block variants.
A derivation- and implementation-oriented reconstruction of vocabulary projection, logits and loss gradients, weight tying, score processors, temperature, top-k/top-p, beam search, and local token-selection policy.
A derivation- and implementation-oriented study of LoRA: low-rank update geometry, tensor shapes, forward and backward passes, initialization, scaling, optimizer state, target-module selection, and the limits of the low-rank assumption.
A mechanism-level comparison of major LoRA variants: quantized-base training, adaptive rank allocation, rank-stable scaling, factor-specific optimization, frozen-factor activation savings, SVD initialization, quantization-aware initialization, and magnitude/direction decomposition.
A systems study of serving many LoRA adapters over one base model: heterogeneous batching, segmented kernels, paging, residency, merge and hotswap semantics, request/KV compatibility, scheduling, observability, and failure recovery.
A tensor- and runtime-level study of EAGLE feature autoregression, shifted-token conditioning, draft training, dynamic trees, HASS context alignment, and the EAGLE-3 design transition.
A formula-, tensor-, code-, and runtime-level study of DeepSeek-V3 multi-token prediction modules, shared embeddings and heads, teacher forcing, released weight structure, KV ownership, and speculative serving.
A derivation- and implementation-oriented foundation for model quantization: affine maps, error, scale shapes, quantized matrix multiplication, accumulator bounds, packed storage, kernel execution, and effective memory cost.
A derivation- and implementation-oriented treatment of quantization calibration: observer state, clipping objectives, representative corpora, output-aware error, sensitivity scans, Hessian alternatives, mixed-precision optimization, and runtime-feasible precision maps.
A code-, shape-, and systems-oriented study of packed multi-head attention, target-by-source cross-attention, head composition, conditional head routing, concatenation, and output projection.
A code- and shape-oriented study note on scaled dot-product attention: Q/K/V, score tensors, finite bias, visibility masks, softmax over keys, dropout, and weighted value mixing.
A cost- and shape-oriented study note on Mixture-of-Experts layers, dense FFN baselines, top-k routing, token dispatch, expert capacity, overflow, and total-vs-active parameter ledgers.
A systems-oriented study note on scaled Mixture-of-Experts routing, load balancing, expert parallelism, all-to-all communication, shared experts, fine-grained experts, device-limited routing, and DeepSeek-style MoE.
A distribution- and serving-state-oriented study note on speculative decoding, draft models, target verification, exact speculative sampling, correction distributions, acceptance rate, speedup ledgers, and KV rollback.
A mechanism-oriented study note on Medusa decoding heads, same-model candidate generation, candidate trees, tree attention masks, typical acceptance, Medusa-1, Medusa-2, and branch KV state.
A mechanism-oriented study note on Lookahead decoding, Jacobi iterations, 2D windows, n-gram pools, lookahead and verification branches, exactness, masks, and KV state.
A derivation- and implementation-oriented study of multi-token prediction objectives, shifted labels, shared-trunk gradients, prediction-head designs, training memory, and the boundary between denser supervision and faster inference.
A serving-oriented study note on KV cache lifecycle, prefill, decode, TTFT, TPOT, memory admission, and why autoregressive inference turns attention state into a scheduler problem.
A serving-scheduler study note on static batching failure, iteration-level scheduling, continuous batching, chunked prefill, TTFT, TPOT, goodput, and KV-aware admission control.
A derivation- and implementation-oriented study of physical KV layout, PagedAttention, vAttention, exact prefix identity, RadixAttention, ownership, and execution reuse.
A systems-oriented study of long-context KV pressure, sliding windows, attention sinks, H2O, SnapKV, PyramidKV, PyramidInfer, layer/head budgets, and the accuracy contracts behind lossy cache policies.
A systems-oriented study note on prefill/decode interference, chunked prefill, disaggregated serving, KV transfer, placement, routing, goodput, and exact cache handoff contracts.
A code- and shape-oriented study note on Transformer cost: parameters, activations, FLOPs, memory traffic, prefill, decode, and why FLOPs alone do not predict runtime.
A tensor- and code-oriented reconstruction of FlashAttention-1: online softmax, exact tiled attention, HBM traffic, backward recomputation, masks, and backend evidence.
A kernel-oriented reconstruction of FlashAttention-2 work partitioning, parallelism across sequence rows, prefill/decode shape changes, and the boundary where decode requires a different schedule.
A derivation- and implementation-oriented study of one-token decode, Flash-Decoding, exact partial-softmax reduction, FlashMask, GQA-aware cache access, SDPA dispatch, and the FA2-to-FA3 kernel boundary.
A derivation-, training-, runtime-, and evaluation-oriented reconstruction of context extension: positional extrapolation, interpolation, recurrence, learned segment summaries, frequency scaling, adaptation, and effective-context tests.
A complete derivation and implementation trace for rotary position embedding: relative-offset identity, pair layouts, frequency bases, partial rotary, numerical precision, cache integration, and paper/runtime variants.
A derivation- and implementation-oriented reconstruction of absolute coordinates, sinusoidal bases, learned positions, relative representations, attention bias, cache offsets, and positional design choices.
A derivation- and implementation-oriented reconstruction of input embedding lookup, initialization, gradient flow, factorization, weight tying, and the handoff from initial rows to contextual computation.
How text becomes model input: learning and applying tokenizers, preserving IDs and offsets, formatting conversations, batching sequences, and checking compatibility.
A derivation- and implementation-oriented study of one autoregressive request: prompt state, prefill/decode, last-row logits, token selection, KV append timing, positions, stopping, beam reorder, streaming, and cache equivalence.
A derivation- and code-path reconstruction of Transformer training: shifted supervision, causal/padding/packed/loss masks, cross-entropy and smoothing, accumulation, Adam, Noam scheduling, mixed precision, distributed parallelism, checkpoints, and reproducibility.
A reading guide to Transformer System: what each module explains, the questions behind its articles, and where to find their main sources.
Sequence modeling from information dependencies to executable Transformer architectures: recurrence, convolution, attention, training, and inference.