Series

LLM Internals

Interactive, visual deep-dives into the techniques behind modern LLMs: attention variants, KV cache, LoRA, RLHF, quantization, and more.

19 published guides ยท 30 topics

Attention and inference

Training and fine-tuning

Read guide

GPT Pretraining

How raw text becomes shifted labels, causal attention, cross-entropy loss, and a trained next-token predictor.

Read guide

LoRA (Low-Rank Adaptation)

Learn how low-rank adapters fine-tune Transformer linear layers while pretrained model weights stay frozen.

Read guide

QLoRA

Learn how quantization and LoRA adapters reduce the memory needed to fine-tune large language models.

Read guide

Gradient Accumulation

Learn how microbatches, gradient averaging, and token-aware loss normalization make larger training batches fit in memory.

Read guide

RLHF

Learn how demonstrations, human preferences, reward models, and policy updates shape a language model's responses.

Read guide

PPO (Proximal Policy Optimization)

Learn how advantages, probability ratios, and clipped objectives guide policy updates during language model training.

Read guide

GRPO (Group Relative Policy Optimization)

Learn how groups of responses, relative rewards, and clipped token updates train a language model without a learned critic.

Read guide

Direct Preference Optimization (DPO)

Learn how preferred and rejected answers, a fixed reference model, and a pairwise loss guide language model fine-tuning.

Coming soon

Weight Initialization

Variance propagation, gradient flow, and depth scaling. Why initialization makes or breaks training.

Coming soon

Chinchilla Scaling Laws

Power laws, compute-optimal frontiers, and why GPT-3 was massively over-parameterized.

Coming soon

Model Merging

Combine fine-tuned models without retraining using TIES, DARE, and SLERP.

Efficiency and scaling

Read guide

Quantization

Discretization, rounding errors, and the math of compressing model weights.

Read guide

Mixture of Experts (MoE)

Learn how routers choose sparse expert pathways for each token, from the forward pass to distributed inference.

Read guide

Mixed Precision Training

Learn how FP16, BF16, FP32, and loss scaling work together to reduce the cost of training language models.

Coming soon

Model Compression

Magnitude pruning, knowledge distillation, and shrinking models by 90% with minimal loss.

Coming soon

Structured Pruning

Layer pruning, head pruning, and hardware-friendly module-level compression.

Coming soon

Tensor vs Pipeline Parallelism

Matrix partitioning, communication costs, and bubble time. How to scale across GPUs.

Coming soon

DeepSpeed ZeRO

Zero Redundancy Optimizer for trillion-parameter training.