Concept library
Learn the stack, end-to-end.
Structured paths from Python through transformers, RAG, and agents. Free concepts unlock more as you progress; premium concepts require a Pro subscription.
Foundations 58 concepts
The vocabulary every practitioner needs before going deeper: what a language model is, what tokens are, and how transformers learn.
-
Action Tokenisation and Representation
How continuous robot actions become discrete tokens an autoregressive transformer can emit, from per-dimension binning to frequency-space compression.
intermediate · 7 min
-
Actor-Critic Methods
Actor-critic methods combine a policy network (actor) with a value estimator (critic) to reduce variance in policy gradient updates without the high bias of pure value-based methods.
intermediate · 7 min
-
Pro
AlphaFold2 and the Protein-Folding Problem
How a deep-learning system read co-evolution signal out of aligned protein sequences to predict 3D structure at near-experimental accuracy, and what it still cannot do.
advanced · 8 min
-
Pro
AlphaFold3 and Biomolecular Co-Folding
How AlphaFold3 dropped the protein-only structure module for a diffusion head that denoises raw atoms, letting one model co-fold proteins with ligands, nucleic acids, ions, and modified residues, and how the open reimplementations caught up.
advanced · 8 min
-
Baselines and Variance Reduction
A baseline is a state-dependent function subtracted from the return in policy gradient updates to reduce estimator variance without introducing bias.
intermediate · 7 min
-
Best-of-N and Inference-Time Selection
Best-of-N sampling generates multiple completions from a language model and returns the one ranked highest by a reward model, trading inference compute for quality without updating any weights.
intermediate · 8 min
-
Pro
Credit Assignment over Long Generations
Explains why distributing a single scalar reward back across hundreds of generation steps is the central unsolved tension in RL for language models, and surveys the main strategies used to address it.
advanced · 9 min
-
Deep Q-Networks
DQN combines Q-learning with a deep convolutional network and two stabilisation tricks (experience replay and a target network) to learn Atari-level control policies directly from raw pixels.
intermediate · 8 min
-
Dynamic Programming for RL
Dynamic programming solves RL problems exactly by bootstrapping value estimates across states using the Bellman equations, but only when you have a perfect model of the environment.
intermediate · 7 min
-
Entropy Regularisation
Entropy regularisation adds a bonus term to the RL objective that rewards stochastic policies, improving exploration and preventing premature convergence to deterministic optima.
intermediate · 7 min
-
Pro
Evaluating RL-Tuned Models
Standard NLP benchmarks break silently when applied to RL-tuned models because the training objective optimises for a reward signal that can diverge from genuine capability, requiring a distinct evaluation stack to distinguish real improvement from reward gaming.
advanced · 9 min
-
Pro
Exploration in Language-Model RL
Language-model RL training collapses silently when the policy stops generating diverse completions, and standard RL exploration techniques must be reinterpreted to work inside a token-sequence action space.
advanced · 8 min
-
Few-Shot and In-Context Learning
Learning a task from a handful of worked examples placed in the prompt, with no weight updates, and the surprising evidence about what those examples actually teach.
intermediate · 8 min
-
Pro
Generalised Advantage Estimation
GAE introduces a single hyperparameter lambda that smoothly interpolates between high-bias/low-variance TD(0) and low-bias/high-variance Monte Carlo advantage estimates, making policy gradient training substantially more stable.
advanced · 8 min
-
Pro
GRPO: Group Relative Policy Optimisation
GRPO removes the critic network from PPO by estimating baselines from a sampled group of outputs, halving the GPU footprint while delivering competitive reasoning improvements.
advanced · 8 min
-
Pro
Imitation Learning and Diffusion Policies
Why cloning a demonstrator's actions drifts into unseen states, and how generative action models such as diffusion policies and action chunking control the drift.
intermediate · 8 min
-
Injection-Aware Prompt Design
How to structure prompts that consume untrusted input so injection is harder, and why prompt design alone can never make an LLM injection-proof.
intermediate · 7 min
-
Length and Format Reward Hacking
When a reward model assigns higher scores to longer or more structured responses regardless of quality, RL training exploits that signal and the policy degrades into verbose padding and hollow formatting instead of improving reasoning.
intermediate · 7 min
-
Pro
Machine Learning for Materials Discovery
How graph neural networks screen millions of candidate crystals for stability and how machine-learning interatomic potentials approximate DFT cheaply enough to simulate them, plus why an in-silico "stable" material is not yet a real one.
intermediate · 8 min
-
Markov Decision Processes
A Markov Decision Process is the formal framework that turns vague "learn from interaction" intuitions into a precise mathematical problem a computer can solve.
intermediate · 8 min
-
Pro
Model-Based Reinforcement Learning
Model-based RL learns an explicit dynamics model of the environment and uses it for planning or synthetic data generation, trading model bias for dramatic gains in sample efficiency.
advanced · 8 min
-
Monte Carlo Methods
Monte Carlo methods estimate value functions by averaging complete episode returns, making them the simplest model-free approach but one that requires episodic tasks and carries high variance.
intermediate · 7 min
-
Pro
Multi-Turn and Agentic RL
Multi-turn and agentic RL extends single-response RLHF to sequences of actions across environment steps, requiring credit assignment, trajectory-level rewards, and new training algorithms suited to long-horizon tool-using agents.
advanced · 9 min
-
Pro
Offline RL and the DPO Connection
DPO re-derives the standard KL-regularised RLHF objective and solves it in closed form, turning preference alignment into a supervised classification loss over offline data without ever sampling from the policy during training.
advanced · 9 min
-
On-Policy vs Off-Policy Learning
On-policy methods learn from data collected by the policy being updated, while off-policy methods learn from data generated by a different behaviour policy, enabling experience reuse but requiring bias corrections.
intermediate · 7 min
-
Pitfalls in ML-for-Science
The failure modes, chiefly data leakage, that make machine-learning results in scientific papers look stronger than they replicate, and the reporting standards proposed to catch them.
intermediate · 7 min
-
Policy Gradients and REINFORCE
Policy gradient methods directly optimise a stochastic policy by estimating the gradient of expected return through sampled trajectories, sidestepping the need to represent a value function over every state-action pair.
intermediate · 8 min
-
Policy Methods vs Value Methods
Policy methods optimise a parameterised policy directly via gradient ascent on expected return, while value methods learn a value function and derive behaviour from it; the distinction shapes sample efficiency, stability, and action-space suitability across the entire RL algorithm landscape.
intermediate · 7 min
-
Pro
PPO for Language Models
Proximal Policy Optimisation clips the policy update ratio to prevent destructive gradient steps, making it the workhorse algorithm for RLHF fine-tuning of large language models.
advanced · 8 min
-
Process vs Outcome Rewards
Process reward models score each reasoning step individually, giving denser training signal than outcome rewards and catching errors before they contaminate a final answer.
intermediate · 7 min
-
Prompt Chaining and Task Decomposition
Splitting a hard task into a pipeline of simpler, individually-checkable prompts so each step can be validated, routed, and debugged on its own.
intermediate · 7 min
-
Pro
Prompt Compression
Cutting prompt tokens while holding task performance, via perplexity-based token dropping (LLMLingua) or learned gist tokens, and when prompt caching beats both.
advanced · 8 min
-
Protein Language Models
How masked-language-model pretraining over amino-acid sequences produces structure and function signal, and how ESMFold trades some accuracy for dropping the MSA search that AlphaFold2 depends on.
intermediate · 8 min
-
Pro
Proximal Policy Optimisation
PPO stabilises policy gradient training by clipping the probability ratio between old and new policies, preventing destructively large updates without the computational overhead of second-order methods.
advanced · 8 min
-
Q-Learning
Q-learning is a model-free, off-policy temporal-difference algorithm that estimates the value of (state, action) pairs and converges to an optimal policy without requiring a model of the environment.
intermediate · 7 min
-
Pro
Reasoning RL and R1-Style Training
How DeepSeek-R1 and Kimi k1.5 demonstrated that pure reinforcement learning on verifiable rewards can elicit chain-of-thought reasoning in LLMs without any human-labelled reasoning traces.
advanced · 9 min
-
Rejection Sampling as RL
Rejection sampling fine-tuning filters a model's own outputs by correctness and trains on the survivors, achieving a policy-improvement step that is mathematically equivalent to one round of RL but without an explicit optimiser loop.
intermediate · 8 min
-
Returns, Discounting, and Episodes
The return is the quantity a reinforcement learning agent actually optimises; discounting controls how far into the future it looks, and whether interactions are episodic or continuing shapes which formulation applies.
beginner · 7 min
-
Pro
Reward Model Calibration and Drift
Reward models trained on human preferences suffer from miscalibration and distribution shift, causing the optimised policy to exploit proxy scores in ways that diverge from actual human intent.
advanced · 8 min
-
Pro
Reward Models as Learned Rewards
A reward model is a classifier trained on human preference comparisons that outputs a scalar score, standing in for the true human utility function during RL fine-tuning of language models.
intermediate · 8 min
-
Reward Over-Optimisation
When a language model is trained too aggressively against a proxy reward model, it learns to exploit the proxy rather than genuinely improve, causing measured reward to climb while true quality declines.
intermediate · 8 min
-
Reward Shaping and Credit Assignment
Reward shaping injects domain knowledge into the reward signal to speed up learning, while credit assignment determines which past actions actually caused a delayed reward.
intermediate · 8 min
-
RLHF as a Reinforcement-Learning Problem
RLHF recasts language model alignment as a policy-optimisation problem where a reward model trained on human comparisons provides the scalar signal that PPO uses to update the language policy.
intermediate · 8 min
-
Pro
RLHF: Reward Modeling, PPO, and the DPO Trade-off
How human preference data becomes a reward model, how PPO uses it to fine-tune an LLM, and why DPO often replaces the whole pipeline.
intermediate · 3 min
-
Pro
RLVR: RL from Verifiable Rewards
RLVR replaces the trained reward model in RLHF with an automated verifier that checks correctness against a ground-truth answer, producing a clean binary signal that sidesteps reward hacking and scales to tasks like maths and code where answers can be checked programmatically.
advanced · 9 min
-
Pro
RT-2 and Web-Scale Robot Learning
RT-2 co-trains one transformer on internet vision-language data and robot trajectories by encoding actions as text tokens, transferring semantic web knowledge into robotic control.
advanced · 7 min
-
Sim-to-Real Transfer
Why robot policies are trained in simulation, why they break on real hardware, and how domain randomisation closes the reality gap by making the real world look like one more random draw.
intermediate · 7 min
-
Structured Output Coercion
How to coax reliable JSON, XML, and tabular output from a model using prompting alone, and why that gives you no hard guarantee the way constrained decoding does.
intermediate · 7 min
-
Temporal-Difference Learning
TD learning combines the trial-and-error sampling of Monte Carlo with the bootstrapped updates of dynamic programming to learn value functions online, without waiting for episode ends.
intermediate · 8 min
-
The Bandit Framing of RLHF
RLHF treats a language model as a contextual bandit that receives a single scalar reward per complete response, making full Markov decision process machinery unnecessary but also hiding the dangers of reward over-optimisation.
intermediate · 7 min
-
The Exploration-Exploitation Trade-off
Choosing when to try something new versus repeating what already works is the central tension in reinforcement learning, and getting it wrong kills agent performance regardless of how well the rest of the system is designed.
intermediate · 6 min
-
Pro
The Infrastructure of LLM RL
LLM post-training via RL requires four coordinated systems running simultaneously - a policy, a reference model, a reward model, and a value function - and the design choices for each determine both what behaviours emerge and where the training breaks.
advanced · 7 min
-
Pro
The KL-Regularised RL Objective
The KL-regularised RL objective balances reward maximisation against a penalty that keeps the policy close to a reference model, preventing reward hacking while allowing genuine improvement.
advanced · 8 min
-
Pro
Trust-Region Policy Optimisation
TRPO is a policy-gradient algorithm that enforces a KL-divergence constraint on each update, guaranteeing monotonic policy improvement and preventing the catastrophic performance collapses that plague vanilla gradient ascent.
advanced · 5 min
-
Value Functions and the Bellman Equations
Value functions assign expected cumulative reward to states and state-action pairs; the Bellman equations express these values as self-consistent recursive relationships that underpin every practical RL algorithm.
intermediate · 8 min
-
Pro
Vision-Language-Action Models
Turning a pretrained vision-language model into a robot policy that maps camera images plus a language instruction to motor actions, so the robot inherits web-scale semantic knowledge it could never learn from robot data alone.
advanced · 8 min
-
What is a Large Language Model?
A grounded definition: an LLM is a neural network trained to predict the next token. Everything else — reasoning, tools, agents — is built on top.
beginner · 5 min
-
Tokens & Tokenization
Models don't see words — they see tokens. Understanding BPE/SentencePiece changes how you reason about context windows, cost, and weird edge cases.
beginner · 6 min
NLP Foundations 118 concepts
Attention, tokenisation, embeddings, and the building blocks that every modern LLM still relies on.
-
ALiBi: Attention with Linear Biases
A zero-parameter alternative to rotating or embedding position, a per-head linear penalty on distance, and why train-short-test-long comes at the cost of sharp long-range recall.
intermediate · 8 min
-
Anatomy of a Transformer Block
The exact sequence of operations inside one transformer block, from tensor shapes to parameter counts, and why every frontier model is just this same function stacked dozens of times.
beginner · 8 min
-
Attention as Soft Dictionary Lookup
The mental model that makes attention click before the matrix algebra does - a lookup table where the key match is a matter of degree, not an exact hit or miss.
beginner · 6 min
-
Attention Mechanism
How attention lets a model focus on the relevant parts of a sequence by computing weighted dependencies between every pair of positions.
intermediate · 7 min
-
Pro
Attention Sinks
Why the first few tokens of almost any sequence soak up a disproportionate share of attention regardless of their content, and how that quirk becomes the key to stable infinite-length streaming generation.
advanced · 9 min
-
Autoregressive Generation
How a language model turns next-token prediction into a paragraph, and why generation is a loop that feeds its own output back as input.
beginner · 6 min
-
Beam Search
Keeping the k best partial sequences alive instead of committing to one token at a time, and why the strategy that dominates machine translation actively hurts open-ended generation.
intermediate · 8 min
-
Bits-per-Byte
The tokenizer-invariant way to report a language model's compression performance, how to compute it from cross-entropy, and why serious scaling-law and benchmark papers report it instead of perplexity.
intermediate · 6 min
-
Pro
BPE-Dropout and Subword Regularisation
A deterministic tokeniser has a blind spot no amount of extra training data fixes on its own, the model never has to be robust to an unfamiliar segmentation of a familiar word, until two techniques deliberately introduced randomness into tokenisation as a training-time fix.
advanced · 8 min
-
Broadcasting and Vectorisation
Broadcasting is the rule that lets a bias vector add to every row of a batch without an explicit loop, and understanding its shape-matching logic prevents the class of bugs that produce wrong answers without an error.
beginner · 6 min
-
Byte-Level BPE
Why GPT-2 and its descendants tokenise raw bytes instead of characters, and how that single design choice guarantees any input string can be represented without an unknown-token fallback.
intermediate · 7 min
-
Pro
Calibration of Language Models
What it means for a model's stated confidence to be trustworthy, why pretrained next-token probabilities start out well calibrated and RLHF quietly breaks that, and how to actually measure the gap.
advanced · 9 min
-
Causal Masking
How a transformer trained to predict every position in parallel is stopped from cheating by looking ahead, and why the mask is applied before softmax rather than after.
intermediate · 7 min
-
Context Engineering
The discipline of curating exactly which tokens occupy the model's window during inference, and why it became the core skill for building agents that run longer than a single turn.
intermediate · 9 min
-
Pro
Context Rot
The measured fact that model accuracy falls as the input grows, non-uniformly and in cliffs, so a bigger window is a bigger desk rather than a better memory.
advanced · 8 min
-
Pro
Context Windows and Long-Context Models
Why a model advertised at a million tokens can still lose the fact in the middle, and what actually sets the limit: memory, compute, position, and attention itself.
advanced · 10 min
-
Cosine Similarity vs Dot Product
Two near-identical looking formulas that answer different questions, one measures direction alone, the other measures direction and magnitude together, and picking the wrong one silently breaks a search or ranking system.
beginner · 6 min
-
Counting Transformer Parameters
A transformer's parameter count is not a mysterious headline number, it is the sum of a handful of matrix shapes multiplied out, and knowing the formula lets you sanity-check any model card in seconds.
intermediate · 8 min
-
Cross-Entropy and KL Divergence
The precise relationship between cross-entropy, entropy, and KL divergence, why minimising one is minimising "excess bits," and why forward and reverse KL pull a model in opposite directions.
intermediate · 8 min
-
Decoder-Only and Why It Won
Why a single causal stack with one unified training objective beat two-stack and bidirectional designs at scale, and the bidirectional context it deliberately gives up to get there.
intermediate · 9 min
-
Pro
Depth, Width, and Aspect Ratio
Given a fixed parameter budget, why pretraining loss barely cares whether you go deep or wide, and the hardware and capability reasons architects still don't pick the ratio at random.
intermediate · 8 min
-
Determinism and Reproducibility in Decoding
Why "temperature zero" and "same seed" both promise less determinism than they sound like they do, and where the real sources of nondeterminism live in an inference stack.
intermediate · 7 min
-
Detokenisation and Streaming Boundaries
Streaming a response token by token can briefly render a garbled glyph on screen, a direct, visible consequence of a multi-byte character being split across more than one token, and a correctness problem, not just a UI quirk.
intermediate · 7 min
-
Pro
Effective vs Nominal Context Length
The advertised context window and the length a model actually uses well are different numbers, often by a large factor, and the gap between them has several distinct, measurable causes.
intermediate · 9 min
-
Pro
Einsum and Tensor Contractions
Einstein summation notation expresses matmuls, batched matmuls, and attention itself as one uniform pattern, and reading it fluently is the fastest way to understand what a line of unfamiliar model code actually computes.
intermediate · 8 min
-
Pro
Embedding Geometry and Anisotropy
Learned embedding spaces are not the well-spread sphere the geometric intuition suggests, they collapse into a narrow cone, and that fact quietly breaks naive similarity comparisons built on top of them.
advanced · 8 min
-
Embeddings and Semantic Search
How dense vectors turn text into a geometry of meaning, and how cosine similarity lets you find related content without keywords.
beginner · 7 min
-
Encoder-Decoder Models (T5)
T5's text-to-text framing and the extra cross-attention sublayer that lets a decoder condition on a separately-encoded input, and the real cost/benefit case for keeping two stacks instead of one.
intermediate · 8 min
-
Encoder-Only Models (BERT)
BERT's bidirectional masked-language-model objective, why it makes phenomenal embeddings and classifiers, and why that same bidirectionality makes it structurally unable to generate open-ended text.
intermediate · 8 min
-
Entropy and Surprise
Why "surprising" has an exact numerical meaning, how -log p(x) turns probability into a unit of information, and what a language model's entropy floor tells you about a piece of text.
intermediate · 7 min
-
Feed-Forward Networks and SwiGLU
The other half of every transformer block, where most of the parameters and arguably most of the stored knowledge live, and why the activation function quietly became SwiGLU.
intermediate · 8 min
-
Fill-in-the-Middle
A way to teach a plain causal decoder to infill text by rearranging training documents, not the model, so a single architecture serves both left-to-right generation and code-editor-style completion.
intermediate · 6 min
-
Gradient Accumulation
The trick that lets a single GPU simulate a batch size far larger than what fits in its memory, at the cost of wall-clock time rather than compute.
beginner · 6 min
-
Gradient Clipping
A five-character config value, clip norm 1.0, appears in nearly every published pretraining recipe, and it is a crude safety net rather than a fix, one that is easy to misread as more protective than it is.
intermediate · 7 min
-
Greedy Decoding
The simplest possible decoder, take the single most probable token at every step, and why that local optimality guarantees nothing about the sentence you end up with.
beginner · 6 min
-
In-Context Learning
How large models learn a task from examples in the prompt alone, with no weight updates, and why this emergent ability reframed how we use LLMs.
intermediate · 7 min
-
Pro
Induction Heads
A specific, mechanistically understood attention circuit that copies patterns it has seen once in the current context, and the closest thing the field has to a concrete explanation for in-context learning.
advanced · 10 min
-
Input Embeddings and the Lookup Table
How a token id becomes a vector, a single row lookup into a trained matrix, and why that matrix is often the largest single block of parameters a small model spends before any real computation happens.
beginner · 6 min
-
Label Smoothing
Softening a one-hot target so the model is never rewarded for driving a correct-class probability all the way to 1, trading a little training loss for calibration and generalisation.
intermediate · 6 min
-
Pro
Language Modelling as Compression
Every autoregressive language model is, exactly and not metaphorically, a lossless compressor; arithmetic coding is the bridge, and that equivalence is what let a text-only LLM out-compress PNG and FLAC on images and audio.
advanced · 10 min
-
Layer Normalization and Residual Connections
The two pieces of transformer plumbing that make deep stacks trainable at all, why pre-norm beat post-norm, and how RMSNorm shaved the design down further.
intermediate · 8 min
-
Learned Absolute Positions
The simplest positional scheme, a trainable embedding table indexed by slot number, and the hard ceiling it builds into every model that uses it.
beginner · 6 min
-
Learning-Rate Schedules
The shape of the learning-rate curve across a training run matters as much as its peak value, and getting the shape wrong wastes a slice of a compute budget that was never coming back.
intermediate · 8 min
-
Pro
Length Extrapolation
What it actually means for a model to handle sequences longer than training, why perplexity is a necessary but misleading metric for it, and how different positional schemes fare with zero adaptation.
advanced · 9 min
-
Logit Bias and Masking
Directly editing the logit vector before sampling, additive nudges for soft steering, hard -infinity masks for guaranteed exclusion, and why the two are not interchangeable.
intermediate · 7 min
-
Log-Probs and Token Probabilities
What the log-probability numbers an API actually returns mean, how to turn them back into probabilities and perplexity, and the practical uses (reranking, confidence checks, hallucination flags) that make them worth reading instead of skipping.
beginner · 6 min
-
Loss Masking in Fine-Tuning
Supervised fine-tuning uses the same shifted next-token loss as pretraining, computed over the exact same kind of sequence; the only change is that most of the sequence is excluded from the loss entirely.
intermediate · 6 min
-
Pro
Loss Spikes and Divergence
On almost every long pretraining run the smooth descending loss curve suddenly lurches upward, and diagnosing and recovering from these spikes is still closer to an operational skill than a solved engineering problem.
advanced · 10 min
-
Masked Language Modelling
BERT's pretraining task hides tokens instead of futures, trading the ability to generate text for representations that read both directions at once.
intermediate · 7 min
-
Matrix Multiplication: The Core Operation
Nearly every FLOP a transformer spends is a matrix multiplication; understanding its shape rule and its cost is the single most load-bearing piece of maths in deep learning.
beginner · 7 min
-
Maximum-Likelihood Estimation
The estimation principle underneath every LLM's training objective, why "maximise probability of the data" and "minimise cross-entropy" are the exact same optimisation, and what changes when you add a prior.
intermediate · 8 min
-
Pro
Min-p and Typical Sampling
Two later refinements to nucleus sampling, one that scales the truncation threshold to the top token's own confidence, one that truncates by information content rather than raw probability rank.
advanced · 9 min
-
Pro
MoE Load-Balancing Loss
Without an explicit penalty, a mixture-of-experts router collapses onto a handful of favourite experts within the first few hundred steps; the auxiliary load-balancing loss is the mechanism that stops it.
advanced · 8 min
-
Multi-Head Attention in Depth
Why attention runs as several small parallel attentions rather than one large one, what each head actually gets to specialise in, and why most heads turn out to be redundant.
intermediate · 9 min
-
Pro
Multi-Query and Grouped-Query Attention
Why the key and value projections, not the query projection, were the ones cut down to fix the real inference bottleneck, and the middle-ground design that most production LLMs settled on.
advanced · 9 min
-
Pro
muP and Hyperparameter Transfer
The learning rate that is optimal for a 40-million-parameter proxy model is usually wrong for the 70-billion-parameter model it was meant to stand in for, and muP is the parametrisation designed to make that transfer actually work.
advanced · 10 min
-
Pro
Mutual Information and Representations
The information-theoretic quantity that measures how much one variable tells you about another, why it is the right lens for judging whether a learned representation actually captured something, and why estimating it in high dimensions is notoriously hard.
advanced · 9 min
-
Pro
Neural Text Degeneration
The umbrella diagnosis behind most decoding research, why decoders that maximise sequence probability produce measurably worse text than decoders that sample from the model's actual distribution.
intermediate · 8 min
-
Next-Token Prediction and Cross-Entropy Loss
The single objective behind every LLM - predict the next token - and the cross-entropy loss that turns "predict well" into a gradient the model can descend.
beginner · 7 min
-
N-Gram Models and Smoothing
The pre-neural language model that ruled for three decades, why counting words breaks the moment you hit a sequence you have never seen, and the smoothing tricks invented to patch that hole.
beginner · 7 min
-
Nucleus (Top-p) Sampling
Truncating by cumulative probability mass instead of a fixed rank, so the candidate pool automatically shrinks when the model is confident and grows when it is uncertain.
intermediate · 8 min
-
Optimiser State and Memory
A model's raw weight size is only the starting point for training memory; Adam alone roughly quadruples the footprint before a single activation has been stored.
intermediate · 9 min
-
Parallel Attention and FFN
Computing attention and the feed-forward sublayer from the same normalised input instead of sequentially, trading a small representational restriction for less synchronisation on the way to more throughput at scale.
intermediate · 7 min
-
Perplexity - Measuring a Language Model
The oldest language-model metric, what "perplexity 12" actually means, and why you can never compare it across two models with different tokenisers.
beginner · 6 min
-
Positional Encodings
Why attention needs to be told where each token sits, and how RoPE, ALiBi, and the surprising NoPE result shape how far a model can read.
intermediate · 9 min
-
Pro
Prefix Language Models
A single decoder-only stack that grants bidirectional attention to a prefix segment before switching to causal generation, and why the field mostly passed on this compromise anyway.
advanced · 8 min
-
Pro
QK-Normalisation
Normalising queries and keys before the attention dot product to stop logits from blowing up at scale, the fix that made 22-billion-parameter and larger transformers trainable without loss spikes.
advanced · 8 min
-
Queries, Keys, and Values
The retrieval metaphor behind attention, made literal - what a query, key, and value actually are as learned projections, and why three separate matrices instead of one.
intermediate · 8 min
-
Relative Position Representations
The 2018 idea that attention should see i-j directly rather than infer it from two absolute positions, the direct ancestor of both RoPE and T5's relative bias.
intermediate · 8 min
-
Repetition Penalty and No-Repeat N-Grams
Two blunt but effective ways to stop a decoder from looping, subtracting from the logits of tokens already seen, versus hard-banning any n-gram that has already appeared.
intermediate · 7 min
-
Pro
RoPE Scaling: NTK-aware and YaRN
How a 4k-token base checkpoint becomes a 128k-token release without pretraining from scratch, by rescaling RoPE's rotation frequencies rather than its raw positions.
advanced · 10 min
-
Rotary Position Embeddings (RoPE)
The rotation trick behind Llama, Mistral, and Qwen, worked through in full, and why an exact algebraic guarantee beats hoping the network learns relative distance on its own.
intermediate · 10 min
-
Sampling and Decoding
A language model outputs a probability distribution, not text; the decoding strategy turns that distribution into words and quietly decides whether the output is dull, unhinged, or right.
intermediate · 9 min
-
Pro
Scaling Laws and the Chinchilla Result
Why model quality improves as a smooth power law in compute, and the Chinchilla correction that showed the whole field had been training models too big on too little data.
advanced · 9 min
-
Self-Attention vs Cross-Attention
The one-line distinction, where the queries come from versus where the keys and values come from, and why decoder-only LLMs mostly made cross-attention disappear from the mainstream architecture.
intermediate · 7 min
-
Sentence Embeddings and Pooling
A transformer produces one vector per token, not one per sentence, so turning a sequence of contextual vectors into a single comparable vector requires a pooling choice that quietly changes what "similar" ends up meaning.
intermediate · 7 min
-
Sequence Packing and Document Masking
Concatenating short documents to fill a fixed context length eliminates padding waste, but only if the attention mask and position IDs are made document-aware; done naively, packing quietly teaches the model to attend across unrelated documents.
intermediate · 7 min
-
Pro
Signal Propagation and Initialisation
How a network's weights are initialised decides, before a single gradient step, whether activations and gradients stay in a trainable range or collapse to zero or explode across depth.
advanced · 9 min
-
Sinusoidal Positional Encodings
The original transformer's fix for order, a fixed sin/cos signal added to every embedding, and why its elegant closed form still degrades once you run past training length.
intermediate · 7 min
-
Sliding-Window Attention
The simplest fix to attention's quadratic cost - cap how far back each position can look - and why stacking layers gets that fixed window back to an effectively long range.
intermediate · 8 min
-
Softmax and Logits
How a model's raw output scores become a probability distribution, why the exponential matters, and the numerical trick that keeps softmax from overflowing.
beginner · 6 min
-
Span Corruption
T5's pretraining task hides whole spans instead of single tokens and asks a decoder to generate only the missing pieces, trading BERT's per-token reconstruction for a shorter, cheaper target sequence.
intermediate · 7 min
-
Special and Control Tokens
The handful of reserved vocabulary entries no amount of BPE merging could ever produce from ordinary text, and why keeping them outside the mergeable vocabulary is a real security boundary, not just bookkeeping.
beginner · 6 min
-
Static vs Contextual Embeddings
The shift from one vector per word to one vector per word-in-context, and why that shift is arguably the single biggest reason transformer-based models outperformed earlier NLP.
intermediate · 7 min
-
Sub-Layer Ordering and Design Choices
The menu of ordering decisions inside and across transformer blocks beyond pre-norm versus post-norm, from where the final normalisation sits to why attention always runs before the feed-forward sublayer.
intermediate · 8 min
-
Pro
Superposition and Polysemantic Neurons
Individual neurons in a trained network routinely fire for several unrelated concepts at once, and the leading explanation is not noise, it is a model deliberately packing more features than it has dimensions using near-orthogonal directions.
advanced · 9 min
-
Temperature Sampling
Dividing logits by a scalar before softmax to sharpen or flatten a model's output distribution, and why temperature alone is a poor substitute for a real safety mechanism.
beginner · 6 min
-
Tensors, Shapes, and Batching
Every number a transformer touches lives inside a tensor with a fixed shape; learning to read and predict those shapes is the fastest way to stop being confused by model code.
beginner · 7 min
-
The Backward Pass and Gradient Flow
Backpropagation through a transformer is the forward pass run in reverse with the chain rule attached; seeing which operations preserve gradient magnitude and which shrink it explains why architecture choices exist.
intermediate · 8 min
-
The Causal LM Pretraining Task
How a corpus of raw documents becomes millions of training examples under one masking rule, and why "causal" describes a data and attention decision, not just a loss.
beginner · 6 min
-
Pro
The Critical Batch Size
Past a point that can be measured but not derived from first principles, adding more GPUs to widen the batch stops buying faster convergence per token, and just burns compute for redundant gradient information.
advanced · 10 min
-
The Forward Pass End to End
Trace one token's numbers from embedding table to output logits and every "mysterious" transformer component turns out to be a shape-preserving or shape-mixing step in a fixed pipeline.
intermediate · 9 min
-
Pro
The NoPE Result
Decoder-only transformers trained with zero positional encoding of any kind matched or beat RoPE and ALiBi on length generalisation, because the causal mask alone leaks a position signal.
advanced · 9 min
-
The Prompt Stack and Chat Roles
What a chat prompt actually is under the hood: a single token sequence built from system, user, and assistant turns wrapped in special tokens, and why that structure is load-bearing.
intermediate · 6 min
-
The Quadratic Cost of Attention
Where the O(n squared) in "attention is quadratic" actually comes from, why it hits both compute and memory, and what doubling the context length really costs.
intermediate · 8 min
-
Pro
The Residual Stream
Reframing a transformer's residual connections as one shared, additive vector space that every layer reads from and writes to, the lens that makes attention, MLPs, and interpretability results legible as a single system.
advanced · 9 min
-
Pro
The Softmax Bottleneck
Why a standard softmax output layer is a low-rank approximation to the true distribution of language, the "bottleneck" that caps what any single softmax can express, and the mixture trick that breaks it.
advanced · 9 min
-
Pro
The Softmax Cross-Entropy Gradient
The combined derivative of softmax and cross-entropy collapses to one subtraction, predicted probability minus true label, and that simplification is why every production training loop fuses the two ops instead of computing them separately.
advanced · 8 min
-
The Tokenisation Tax
Two prompts with the same meaning can cost a different number of tokens under the same vocabulary, and that gap compounds into real dollars, real context budget, and real latency before the model reasons about anything at all.
intermediate · 7 min
-
Pro
Token Fertility and Multilingual Fairness
The same paragraph of news text can tokenise into several times as many tokens in one language as another under a shared vocabulary, a structural cost baked in before any user sends a request, not a rounding error.
intermediate · 8 min
-
Tokenisation and Arithmetic
A model can be strong at multi-step reasoning and still botch four-digit addition, not from a lack of arithmetic ability but because its tokeniser handed it two structurally unrelated token sequences for two numbers that differ by one.
intermediate · 7 min
-
Tokenisation and BPE
How models turn raw text into integer tokens, and why the vocabulary choice silently shapes model behaviour.
beginner · 6 min
-
Top-k Sampling
Truncating the vocabulary to a fixed-size shortlist of the k most probable tokens before sampling, and why a fixed k is systematically the wrong size for at least some fraction of every distribution.
beginner · 6 min
-
Pro
Training Memory Footprint
A model's weights are the smallest part of its training memory bill; optimiser state, gradients, and activations usually cost several times more, and knowing the breakdown explains why training needs far more memory than inference.
advanced · 9 min
-
Transformer Architecture
The encoder-decoder stack that replaced recurrence and powered every modern LLM.
intermediate · 8 min
-
Pro
Unembedding and the Logit Lens
Multiplying an intermediate layer's residual stream by the final unembedding matrix, as if it were the last layer, turns out to produce surprisingly sensible next-token guesses, a cheap window into what a model has committed to mid-computation.
advanced · 8 min
-
Unigram LM and SentencePiece
A tokeniser that builds its vocabulary top-down instead of bottom-up, assigns every segmentation of a string a real probability, and the library that made it (and BPE) usable without a language-specific pre-tokeniser.
intermediate · 8 min
-
Warmup and Why It Helps
The first few hundred to few thousand steps of a large training run are its most fragile, and a short linear ramp on the learning rate is the cheapest insurance against wrecking them.
intermediate · 7 min
-
Pro
Warmup-Stable-Decay Schedules
Cosine decay bakes the total step count into its formula before training starts; warmup-stable-decay schedules split the learning-rate curve so that commitment can be made at the very end instead.
advanced · 9 min
-
Weight Decay in Pretraining
Pretraining rarely revisits the same token twice, so the classical overfitting story for weight decay barely applies, yet nearly every LLM recipe still sets it to a nonzero value close to 0.1.
intermediate · 8 min
-
Pro
Weight Initialisation in Transformers
Why the last matrix in every attention and FFN sublayer gets shrunk by 1/sqrt(2N) at initialisation, and the more principled framework, muP, that turns hyperparameter tuning at scale into a lookup instead of a search.
advanced · 9 min
-
Weight Tying of Input and Output Embeddings
Why most language models score every candidate next token using the transpose of the exact same matrix that looked up the input tokens, cutting parameters and improving perplexity in one move.
intermediate · 7 min
-
Why Attention Needs Positions
Self-attention is a permutation-equivariant set operation by default; every notion of word order a transformer has was injected as data, not built into the architecture.
beginner · 6 min
-
Why LLMs Cannot Spell or Count Letters
The classic "how many r's in strawberry" failure is not a reasoning gap, it is a representational one, caused by the model never seeing the individual letters that make up a compressed token.
beginner · 6 min
-
Why Non-Linearity Matters
Stack any number of linear layers and the result is still one linear layer; the humble activation function is the only thing standing between a transformer and a glorified matrix multiplication.
beginner · 6 min
-
word2vec and GloVe
The two ideas, predict-a-neighbour and factor-a-co-occurrence-matrix, that first proved dense vectors could capture enough word meaning to support arithmetic on it, years before transformers existed.
beginner · 7 min
-
WordPiece Tokenisation
BERT's tokeniser looks like BPE on the surface, but the merge criterion it optimises is different, and that difference is why WordPiece pieces tend to track real morphemes more closely.
intermediate · 7 min
-
Pro
Z-Loss and Logit Regularisation
Softmax is shift-invariant, which leaves a direction in logit space that cross-entropy never penalises; z-loss closes that gap and is what keeps large-scale bf16 training from spiking.
advanced · 8 min
Mathematical Foundations 6 concepts
Linear algebra, probability, calculus, optimisation, and the numerical-computation reality that ML engineers actually hit.
-
Calculus and Gradients
Partial derivatives, the chain rule as the engine of backprop, why second-order methods are rare in deep learning, and what gradient clipping actually does.
intermediate · 8 min
-
Linear Algebra for ML
Vector spaces, matrix decompositions, and why low-rank structure underlies LoRA, PCA, and the quantisation tricks that make modern LLMs cheap to serve.
intermediate · 9 min
-
Numerical Computation Gotchas
Catastrophic cancellation, the log-sum-exp trick, mixed-precision training, the determinism tax, and how to actually debug a NaN in a 70B model.
intermediate · 8 min
-
Pro
Optimisation Theory
Convexity, why SGD finds good solutions on non-convex losses, saddle points at scale, momentum as a damped oscillator, and learning-rate schedules as implicit regularisation.
advanced · 10 min
-
Probability and Information Theory
Distributions, expectations, entropy, KL, and why softmax + cross-entropy is the canonical pair that secretly underlies almost every LLM loss.
intermediate · 9 min
-
Pro
Statistical Learning Theory Primer
Bias-variance, PAC-learning, VC dimension, why deep nets break classical generalisation bounds, double descent, and what scaling laws are actually saying.
advanced · 10 min
Deep Learning 8 concepts
CNNs, recurrent networks, normalisation, regularisation, optimisers, and automatic differentiation.
-
Activation Functions
Why depth is meaningless without a nonlinearity, and how the field moved from saturating sigmoids through ReLU and GELU to the gated SwiGLU that sits in almost every modern transformer feed-forward block.
intermediate · 8 min
-
Backpropagation and Automatic Differentiation
How reverse-mode autodiff turns the chain rule into an efficient gradient algorithm, and the design choices PyTorch and JAX make to implement it at scale.
intermediate · 8 min
-
Convolutional Neural Networks
Why weight sharing and local receptive fields make CNNs the right inductive bias for images, and where ViTs took over.
intermediate · 8 min
-
Dropout and Modern Regularisation
Why dropout was the dominant regulariser for a decade and why modern LLM training mostly skips it in favour of letting data do the work.
beginner · 6 min
-
Pro
Normalisation: BatchNorm, LayerNorm, RMSNorm
Why normalisation accelerates training, why transformers use LayerNorm instead of BatchNorm, and why RMSNorm is now the default in Llama-class models.
intermediate · 7 min
-
Pro
Optimisers: SGD, Adam, AdamW, Lion
How the standard optimiser stack evolved from plain SGD through Adam to memory-cheaper variants like Lion and Muon, and which learning-rate schedules actually work at scale.
intermediate · 9 min
-
Recurrent Networks: RNN, LSTM, GRU
How gating fixed the vanishing-gradient problem in RNNs, and why transformers displaced them everywhere except streaming and on-device workloads.
intermediate · 8 min
-
Residual Connections and Skip Paths
Why adding the input back to a layer's output is what makes networks of dozens or hundreds of layers trainable, and how the same trick underpins every modern transformer.
intermediate · 8 min
Architectures & Scaling 42 concepts
Inside the model: attention, training objectives, parameter scaling, and the architectural choices that shape what an LLM can do.
-
Auditing Synthetic Data
Auditing synthetic training data means applying measurable quality checks, coverage tests, and contamination scans before the data ever touches a training run.
intermediate · 7 min
-
Benchmark Decontamination
Benchmark decontamination is the process of identifying and removing evaluation set examples from a model's pretraining corpus so that reported benchmark scores reflect genuine generalisation rather than memorised answers.
intermediate · 7 min
-
Pro
Code Data Curation
A systematic account of how raw source code from the internet is transformed into a deduplicated, filtered, mixed, and decontaminated pretraining corpus for code-focused language models.
advanced · 8 min
-
Curriculum and Data Ordering
How the sequence and mixture proportions of training batches affect what an LLM learns and when, and why naive i.i.d. sampling often leaves capability on the table.
intermediate · 8 min
-
Pro
Data Mixtures and Domain Weighting
Domain weighting determines how much of each data source a model sees during pretraining, and getting this wrong can cost tens of thousands of GPU-hours or silently cripple downstream task performance.
advanced · 9 min
-
Pro
Data Pipelines at Scale
Building a pretraining corpus requires extracting, filtering, deduplicating, and mixing hundreds of billions of tokens from heterogeneous sources while keeping benchmark contamination out.
advanced · 8 min
-
Data Provenance and Licensing
Data provenance tracks the origin and transformation history of every byte in a training corpus, while licensing determines whether you are legally permitted to use it at all.
intermediate · 7 min
-
Deduplication and Memorisation
Duplicate training examples cause language models to memorise and verbatim-reproduce training text, so removing duplicates before training reduces regurgitation, improves generalisation, and lowers compute waste.
intermediate · 7 min
-
Distillation and Terms-of-Service Constraints
Using a commercial API to generate training data for a competing model almost universally violates the provider's terms of service, and understanding exactly why - and what compliant alternatives exist - is non-negotiable before building any distillation pipeline.
intermediate · 7 min
-
Distilling Reasoning Traces
Reasoning-trace distillation transfers step-by-step chain-of-thought outputs from a large teacher model into fine-tuning data for a smaller student, giving the student reasoning capability it could not develop on final-answer supervision alone.
intermediate · 7 min
-
Diversity Metrics and Collapse Detection
Quantitative metrics for detecting when synthetic training data loses coverage of the original distribution, with practical monitoring strategies to catch collapse before it harms the next model generation.
intermediate · 8 min
-
Document-Level vs Token-Level Deduplication
Document-level deduplication removes whole near-duplicate pages using hashing, while token-level deduplication removes repeated spans within and across documents using suffix arrays, each with distinct cost-quality trade-offs in web-scale corpus construction.
intermediate · 7 min
-
Evol-Instruct
Evol-Instruct is an LLM-driven pipeline that iteratively rewrites seed instructions into progressively harder variants, enabling automated construction of complex instruction-following training data without human labellers.
intermediate · 8 min
-
Exact and Fuzzy Deduplication
How hash-based exact matching and MinHash locality-sensitive hashing together remove the duplicate content that otherwise inflates memorisation and wastes training compute.
intermediate · 7 min
-
Heuristic Quality Filters
Heuristic quality filters are rule-based passes over raw web text that remove boilerplate, malformed documents, and low-information content before any classifier is trained or applied.
intermediate · 7 min
-
Knowledge Distillation from a Teacher Model
Knowledge distillation trains a smaller student model to reproduce a larger teacher's output distribution, enabling compact models with performance well beyond what their size alone would predict.
intermediate · 8 min
-
Language Identification and Filtering
Language identification assigns a language label to each document in a web crawl so pipelines can retain target-language text and discard everything else before quality filtering begins.
intermediate · 7 min
-
Pro
MinHash and LSH for Deduplication
MinHash estimates Jaccard similarity between documents in constant memory, and LSH bucketing turns that estimate into a sub-linear nearest-neighbour search, making corpus-scale near-deduplication tractable.
intermediate · 8 min
-
Mixing Synthetic and Human Data
Balancing synthetic and human-authored training examples determines whether a model inherits the strengths of both sources or the worst of each.
intermediate · 8 min
-
Pro
Model Collapse from Recursive Training
When a model is trained repeatedly on its own outputs, tail distributions erode and the model progressively forgets rare but important knowledge, eventually producing impoverished, homogenised text.
advanced · 8 min
-
Multilingual Data Balancing
Multilingual data balancing decides how many tokens from each language land in a pretraining corpus, trading raw web proportions against deliberate upsampling to serve low-resource languages without degrading high-resource ones.
intermediate · 8 min
-
Persona Prompting for Diversity
Persona prompting injects fictional user identities into an LLM's prompt to steer it toward generating training data that spans a broader slice of the real distribution than naive repeated sampling achieves.
intermediate · 7 min
-
PII Detection and Removal
Scrubbing personally identifiable information from web-scale corpora before LLM pretraining reduces memorisation risk and legal exposure, but every detection method trades recall against corpus damage.
intermediate · 8 min
-
Programmatic and Templated Data Generation
Programmatic and templated generation produces synthetic training data through deterministic code, slot-filling templates, and context-free grammars, giving precise control over distribution and format that purely model-driven pipelines cannot match.
intermediate · 8 min
-
Quality Filtering of Synthetic Data
Quality filtering removes low-signal, redundant, or contaminated examples from synthetically generated datasets before fine-tuning, preventing reward hacking and model collapse.
intermediate · 7 min
-
Quality Filtering with Classifiers
Classifier-based quality filtering uses lightweight models trained on curated reference corpora to score and discard low-quality web documents before LLM pretraining.
intermediate · 7 min
-
Rejection Sampling Fine-Tuning and STaR
Rejection sampling fine-tuning and the STaR algorithm are iterative self-improvement techniques that generate synthetic training data by having a model solve problems, keeping only the correct solutions, and re-training on those filtered traces.
intermediate · 8 min
-
Self-Instruct
Self-Instruct is a bootstrapping pipeline that uses a language model's own outputs to generate large-scale instruction-following training data with minimal human annotation.
intermediate · 7 min
-
Self-Play and Self-Improvement
Self-play loops use a model to generate, critique, and filter its own training data, compounding capability without proportionally scaling human annotation effort.
intermediate · 7 min
-
Synthetic Data for Code
Generating synthetic code training data via instruction synthesis, distillation, and execution-based filtering lets small models punch well above their weight, but only when a reliable verifier anchors the loop.
intermediate · 7 min
-
Synthetic Data for Mathematics
Synthetic math data pipelines use teacher models, rejection sampling, and question rewriting to bootstrap training corpora far larger than any human-labelled set, but the quality ceiling is set by the generator's own reasoning ability.
intermediate · 8 min
-
Synthetic Preference Data
Synthetic preference data replaces expensive human comparison labels by having a language model judge which of two candidate responses is better, enabling scalable RLHF-style alignment without a large human labelling workforce.
intermediate · 7 min
-
Textbook-Quality Synthetic Data
How to generate training data that teaches models to reason rather than memorise, using instruction synthesis, distillation, rejection sampling, and constitutional loops, along with the collapse risks that follow.
intermediate · 8 min
-
Text Extraction and Boilerplate Removal
Converting raw HTML from web crawls into clean, main-content text is a lossy signal-recovery problem, and the choices made here propagate irreversibly through every downstream filtering and training stage.
intermediate · 7 min
-
The Attention Mechanism
Attention lets every token decide which other tokens to look at. It's the core operation that made transformers replace RNNs.
intermediate · 8 min
-
Pro
The Constitutional AI Data Loop
Constitutional AI replaces most human preference labels with a self-critique-and-revise loop guided by a written list of principles, producing both supervised fine-tuning data and AI-labelled preference pairs that train a reward model.
advanced · 8 min
-
Toxicity Filtering of Pretraining Data
Toxicity filtering removes hate speech, obscene language, and harmful content from web-crawled corpora before LLM pretraining, using blocklists, classifiers, and API-based scoring, each with distinct recall/precision trade-offs and equity side effects.
intermediate · 8 min
-
Training a Tokeniser on a Corpus
Training a tokeniser on your pretraining corpus, rather than borrowing one designed for another model, directly controls sequence length, vocabulary coverage, and how the model sees numbers, code, and non-English text.
intermediate · 7 min
-
Vocabulary Size Trade-offs
Choosing a tokeniser vocabulary size forces a three-way tension between sequence length, embedding table memory, and coverage of rare or multilingual text.
intermediate · 8 min
-
Pro
Web-Scale Corpus Construction
Building a pretraining corpus at web scale requires five tightly coupled stages - extraction, quality filtering, deduplication, source mixing, and decontamination - each of which silently determines what a model can and cannot know.
advanced · 9 min
-
Why Synthetic Data
Synthetic data lets practitioners generate arbitrarily large, precisely labelled training sets without manual annotation, but only when the generator is accurate enough not to amplify its own errors.
beginner · 7 min
-
Pretraining vs Instruction Tuning
How a base model becomes a chatbot. Three stages — pretraining, supervised fine-tuning, RLHF — each doing something specific.
intermediate · 9 min
Large Language Models 7 concepts
Pretraining, fine-tuning vs RAG, RLHF/DPO, chain-of-thought, mixture-of-experts - the LLM craft.
-
Chain of Thought Prompting
Why telling the model to think step by step radically improves reasoning, and when it actively hurts.
beginner · 5 min
-
Pro
DPO and Preference Optimisation
How Direct Preference Optimisation collapses the reward-model-plus-PPO pipeline into a single classification loss, and where the RLHF machinery still earns its keep.
advanced · 9 min
-
Pro
Fine-tuning vs RAG
When to teach the model new behaviour vs when to retrieve fresh context at runtime.
intermediate · 8 min
-
Pro
Mixture of Experts
Why MoE models can be 10x cheaper to serve than dense models of the same capability, and what makes them hard to train.
advanced · 8 min
-
Pretraining Objectives
Why the loss a model is trained to minimise decides what it can become, and how next-token prediction beat masked and span objectives to own the generative era.
intermediate · 9 min
-
Pro
Reinforcement Learning from Human Feedback
How preference data and PPO turn a pretrained language model into a helpful, honest, harmless assistant.
advanced · 10 min
-
Retrieval Augmented Generation
The end-to-end RAG pipeline from chunking through retrieval, reranking, and grounded generation.
intermediate · 9 min
Inference Optimisation 8 concepts
KV cache, FlashAttention, speculative decoding, quantisation, vLLM, MoE serving - the production-grade inference stack.
-
Pro
FlashAttention
An IO-aware attention kernel that is both faster and lower-memory than the textbook implementation by tiling computation to keep activations in SRAM.
advanced · 9 min
-
KV Cache
Why decoder inference is quadratic without a KV cache and linear with one, and why managing that cache is now the dominant memory problem in LLM serving.
intermediate · 8 min
-
Pro
Mixture-of-Experts Inference
Why serving MoE models is harder than serving dense models of equivalent quality, and how DeepSeek and Mistral made it work in production.
advanced · 9 min
-
Pro
Paged Attention and the KV Memory Manager
How vLLM's PagedAttention treats the KV cache like OS virtual memory, cutting fragmentation waste from 60-80% to under 4% and roughly doubling to quadrupling serving throughput.
advanced · 8 min
-
Quantisation - INT8, INT4, FP8
How to cut weight and activation precision below 16 bits without wrecking quality, and which scheme to pick for which deployment.
intermediate · 9 min
-
Pro
Speculative Decoding
Use a small draft model to propose tokens that a large verifier accepts or rejects in parallel, giving lossless 2-3x latency wins on autoregressive generation.
advanced · 9 min
-
Pro
Structured Generation and Constrained Decoding
How masking the logits at each decode step to only tokens a schema or grammar allows guarantees syntactically valid output, and where that guarantee stops.
intermediate · 8 min
-
vLLM and Continuous Batching
Why static batching wastes most of your GPU on variable-length workloads, and how iteration-level scheduling combined with PagedAttention raises throughput by an order of magnitude.
intermediate · 8 min
Training Infrastructure 5 concepts
Data, tensor and pipeline parallelism, ZeRO/FSDP, mixed precision, gradient checkpointing, and the engineering of large-scale training.
-
Data Parallelism and DDP
How replicating the model and sharding the batch across GPUs scales training, and why AllReduce is the primitive every framework eventually depends on.
intermediate · 8 min
-
Pro
Gradient Checkpointing, Activation Recomputation, and CPU Offload
Why activations - not weights - usually dominate training memory, and how recomputation and CPU/NVMe offload trade compute and bandwidth to fit larger models.
intermediate · 9 min
-
Mixed-Precision Training (FP16, BF16, FP8)
How lower-precision formats halve memory and double throughput on tensor cores, why BF16 displaced FP16 for training, and what FP8 changes on H100 and Blackwell.
intermediate · 8 min
-
Pro
Tensor and Pipeline Parallelism
How frontier labs split a model across thousands of GPUs by sharding within layers (tensor parallel) and across layers (pipeline parallel), and how to pick the split.
advanced · 10 min
-
Pro
ZeRO and FSDP
How sharding optimiser state, gradients, and parameters across data-parallel ranks turns a memory problem into a bandwidth problem, and why FSDP is now the PyTorch default.
advanced · 9 min
Reasoning Models 6 concepts
Test-time compute, process reward models, CoT/self-consistency/search, the o-series and R1, and how to evaluate reasoning fairly.
-
Chain of Thought, Self-consistency, and Search at Inference
A tour of the inference-time reasoning toolkit - from zero-shot CoT prompts to MCTS-decoded reasoning trees, and when each pays for itself.
intermediate · 8 min
-
Pro
DeepSeek-R1 and the Open Reasoning Recipe
How DeepSeek's R1 pipeline produced o1-class reasoning with an open paper, an open model, and a recipe other labs could replicate within weeks.
advanced · 9 min
-
Pro
OpenAI o1, o3 and the Reasoning-Model Family
What is publicly known and what is speculated about OpenAI's reasoning line, why the chain of thought is hidden, and what o3's ARC-AGI result actually proved.
intermediate · 8 min
-
Pro
Process Reward Models and Verifiable Rewards
Why scoring every step of a reasoning trace beats scoring only the final answer, and how Ai2 and DeepSeek replaced PRMs entirely with programmatic correctness checks.
advanced · 9 min
-
Reasoning Evals and the Contamination Problem
A guided tour of the reasoning benchmark canon, why each saturated faster than the field expected, and the move to live held-out evals as the contamination crisis bites.
intermediate · 7 min
-
Test-time Compute Scaling
Why "thinking longer" at inference can substitute for "training bigger", how the trade-off is operationalised as a token budget, and where the strategy stops paying.
intermediate · 7 min
Applied LLMs 81 concepts
Putting models to work: prompting, retrieval-augmented generation, fine-tuning trade-offs, and agentic systems.
-
Adapter Modules
Adapter modules insert small trainable bottleneck layers into a frozen pretrained transformer, achieving near-full fine-tuning performance while updating fewer than 4% of the model's parameters.
intermediate · 7 min
-
Pro
Autotuning GPU Kernels
Autotuning systematically searches a discrete configuration space of tile sizes, warp counts, and pipeline stages to find the fastest kernel for a given GPU and problem shape, replacing manual heuristics with empirical benchmarking.
advanced · 9 min
-
Building a Preference Dataset
A preference dataset pairs model outputs and records which one a human (or AI judge) preferred, providing the training signal that separates a helpful assistant from a raw base model.
intermediate · 8 min
-
Catastrophic Forgetting in Fine-Tuning
Full fine-tuning on a narrow task silently destroys general capabilities baked in during pre-training, and understanding why this happens is the prerequisite for choosing any mitigation strategy.
intermediate · 8 min
-
Chat Templates and Special Tokens
Chat templates are Jinja2 strings stored in a tokeniser that convert structured message lists into the exact token sequences a fine-tuned model was trained to process.
intermediate · 7 min
-
Choosing LoRA Rank and Alpha
LoRA rank r controls how much task-specific capacity the adapter has, and alpha controls the scaling of that update; choosing them poorly wastes parameters or destabilises training.
intermediate · 7 min
-
Collective Communication Primitives
The six core multi-GPU communication patterns (broadcast, reduce, all-reduce, all-gather, reduce-scatter, all-to-all) determine whether a distributed training job spends most of its time computing or waiting on the wire.
intermediate · 8 min
-
Pro
Composing and Stacking Adapters
Multiple trained adapters can be combined sequentially, by weighted sum, or through attention-based gating to build new capabilities without retraining the base model.
advanced · 7 min
-
Pro
Compute-Bound vs Memory-Bound Kernels
A kernel's performance ceiling is determined by whether FLOPs or memory bandwidth runs out first, and misidentifying this wastes orders-of-magnitude optimisation effort.
intermediate · 8 min
-
Pro
Custom Kernels for Mixture-of-Experts
MoE models break the dense-GEMM assumption that GPU libraries are optimised for, so efficient inference requires custom grouped-GEMM and block-sparse kernels that handle variable-length expert batches without padding or token dropping.
advanced · 8 min
-
Pro
DoRA: Weight-Decomposed LoRA
DoRA decomposes pre-trained weights into magnitude and direction components, then applies LoRA exclusively to the directional part, closing most of the accuracy gap between LoRA and full fine-tuning without adding inference overhead.
advanced · 7 min
-
Pro
DPO in Practice
DPO eliminates the separate reward model and RL loop of classic RLHF by reparameterising the reward directly into a classification loss over preferred and rejected response pairs.
intermediate · 7 min
-
Evaluating an Aligned Model
Evaluating an aligned model requires measuring three partially competing properties simultaneously: helpfulness, harmlessness, and honesty, and every method for doing so introduces its own systematic biases.
intermediate · 8 min
-
Floating-Point Formats for ML
ML accelerators expose a menu of floating-point formats that trade numerical range and precision for throughput and memory bandwidth; choosing the wrong one silently degrades accuracy or leaves peak FLOPS on the table.
intermediate · 8 min
-
Pro
Graph Capture and CUDA Graphs
CUDA Graphs record a sequence of GPU operations as a reusable execution graph, eliminating per-kernel CPU launch overhead and enabling significant throughput gains for workloads with static shapes and control flow.
intermediate · 8 min
-
Pro
Hardware Cost of Mixture-of-Experts
Sparse MoE models reduce FLOPs per token but introduce all-to-all communication, load-imbalance penalties, and memory pressure that can erase those savings unless the system is carefully co-designed.
advanced · 9 min
-
HBM Bandwidth and Capacity
High Bandwidth Memory sets a hard ceiling on how fast a GPU can feed its compute units, and most LLM operations live squarely against that ceiling.
intermediate · 8 min
-
IA3 and Scaling-Vector Methods
IA3 fine-tunes a transformer by learning one scaling vector per targeted activation stream, achieving roughly 0.01% trainable parameters while matching full fine-tuning accuracy on several benchmarks.
intermediate · 5 min
-
Pro
InfiniBand and Inter-Node Networking
InfiniBand provides low-latency, high-bandwidth RDMA links between GPU nodes, and understanding its topology and collective communication patterns is essential for diagnosing and eliminating the network bottleneck in large-scale training.
intermediate · 8 min
-
Pro
IPO and the Overfitting Fix
IPO replaces DPO's sigmoid loss with a squared identity transform, eliminating the theoretical overfitting guarantee that breaks when preference data is finite and deterministic.
advanced · 7 min
-
Kernel Fusion
Kernel fusion eliminates redundant memory round-trips by merging multiple GPU operations into a single kernel launch, turning memory-bandwidth bottlenecks into throughput wins.
intermediate · 8 min
-
Pro
KTO: Unpaired Preference Learning
KTO aligns language models using only binary good/bad labels per response, avoiding the paired (chosen, rejected) format that makes preference data expensive and brittle to collect.
intermediate · 7 min
-
Pro
KV-Cache Memory and Bandwidth
The key-value cache trades GPU memory capacity for inference speed, and understanding how that trade interacts with memory bandwidth is what separates fast serving systems from slow ones.
intermediate · 8 min
-
Length Bias and Verbosity Control
Reward models trained on human preference data systematically score longer outputs higher regardless of quality, causing RLHF-trained models to inflate response length rather than improve content.
intermediate · 8 min
-
Pro
LoRA for Long-Context Adaptation
Extending a model's context window via LoRA requires coordinating low-rank weight updates with position-encoding rescaling, and ignoring either side reliably degrades performance on long sequences.
advanced · 8 min
-
LoRA: Low-Rank Adaptation
LoRA freezes a pretrained model's weights and inserts trainable low-rank matrix pairs into each target layer, cutting trainable parameters by up to 10,000x with no added inference latency.
intermediate · 8 min
-
Pro
LoRA Training Pitfalls
LoRA's low-rank approximation introduces subtle failure modes around rank selection, learning rate asymmetry, and target-module coverage that can silently degrade fine-tuned model quality.
intermediate · 7 min
-
LoRA vs Full Fine-Tuning
LoRA constrains weight updates to low-rank matrices, cutting trainable parameters by orders of magnitude while matching full fine-tuning quality on most tasks, but that constraint is also the source of its failure modes.
intermediate · 8 min
-
Memory Coalescing
Memory coalescing is the hardware mechanism by which a GPU groups multiple thread memory requests into a single wide transaction, and writing kernels that exploit it is often the single largest lever on throughput.
intermediate · 8 min
-
Merging LoRA into Base Weights
After LoRA training, the low-rank adapter matrices can be folded directly into the frozen base weights, eliminating inference overhead and adapter management complexity while producing a standard dense model.
intermediate · 7 min
-
Pro
Mixed-Precision Kernels
Mixed-precision kernels reduce memory bandwidth and arithmetic cost by storing and computing in lower-precision formats while selectively preserving full precision where numerical stability demands it.
advanced · 8 min
-
Pro
Model Merging: Linear and SLERP
Linear and SLERP merging combine the weight tensors of separately fine-tuned models into a single deployable checkpoint, trading off alignment and capability at zero inference cost.
intermediate · 7 min
-
Model Soups
Model soups average the weights of multiple independently fine-tuned checkpoints to produce a single model that outperforms any individual checkpoint without increasing inference cost.
intermediate · 7 min
-
Pro
Multi-Objective Alignment
Multi-objective alignment trains a single language model to satisfy several competing criteria simultaneously by navigating the Pareto front of reward trade-offs rather than collapsing them into one scalar.
advanced · 8 min
-
Pro
NF4 and Double Quantisation
NF4 is a 4-bit data type matched to the normal distribution of pretrained weights, and double quantisation further compresses the quantisation constants themselves, together enabling 65B-parameter models to fine-tune on a single 48 GB GPU via QLoRA.
advanced · 8 min
-
NVLink and Intra-Node Interconnect
NVLink is NVIDIA's proprietary GPU-to-GPU interconnect that delivers up to 900 GB/s aggregate bandwidth on H100, replacing PCIe as the bottleneck in multi-GPU training by making all-reduce and tensor parallelism far cheaper.
intermediate · 8 min
-
Occupancy and Latency Hiding
GPU occupancy measures how many warps are resident on a streaming multiprocessor relative to its hardware maximum, and high occupancy is the primary mechanism by which the GPU hides memory and arithmetic latency to sustain throughput.
intermediate · 8 min
-
Pro
Online vs Offline Preference Optimisation
Offline preference optimisation trains on a fixed dataset of ranked responses, while online methods continuously sample from the current policy, and that single difference has substantial consequences for distribution coverage, reward hacking risk, and final alignment quality.
advanced · 8 min
-
Pro
Operator Lowering and IRs
Operator lowering is the process of progressively translating high-level tensor operations through a sequence of intermediate representations until hardware-executable instructions are produced.
intermediate · 8 min
-
Pro
ORPO and Reference-Free Alignment
ORPO collapses supervised fine-tuning and preference alignment into a single training phase by appending a log-odds-ratio penalty directly to the NLL loss, removing the need for a reference model.
intermediate · 8 min
-
Pro
Paged Attention as a Memory Manager
PagedAttention borrows the OS virtual-memory paging model to eliminate KV-cache fragmentation, letting a single GPU serve far more concurrent requests than contiguous allocation allows.
advanced · 8 min
-
Power, Thermals, and Clock Throttling
GPU accelerators operate under hard power and thermal budgets that silently reduce clock speeds mid-workload, making sustained throughput lower than peak spec sheets advertise.
intermediate · 8 min
-
Pro
PPO for RLHF in Practice
A concrete walkthrough of how Proximal Policy Optimisation is wired into the RLHF pipeline, covering the four-model setup, the clipped objective, KL penalty shaping, and the failure modes that kill real training runs.
advanced · 8 min
-
Pro
Prefill vs Decode
LLM inference splits into two hardware-distinct phases - a compute-bound prefill that processes all prompt tokens in parallel, and a memory-bandwidth-bound decode that generates tokens one at a time, each with fundamentally different bottlenecks on the same GPU.
intermediate · 7 min
-
Prefix Tuning
Prefix tuning freezes all pretrained model weights and instead optimises a small set of continuous, task-specific vectors prepended to every layer's key-value cache, achieving within a few points of full fine-tuning while training roughly 0.1% of the original parameters.
intermediate · 7 min
-
Pro
Profiling GPU Workloads
Profiling a GPU workload means measuring where time and memory bandwidth actually go, so that optimisation effort lands on the real bottleneck rather than a guess.
intermediate · 8 min
-
Prompt Engineering — Foundations
Prompting is a skill, not a hack. Five techniques that work across models: clear role, structured output, examples, decomposition, and verification.
beginner · 7 min
-
Prompt Tuning with Soft Prompts
Soft-prompt tuning prepends a small set of learnable continuous vectors to the input of a frozen language model, achieving full-fine-tuning parity at billion-parameter scale while touching less than 0.1% of model weights.
intermediate · 7 min
-
QLoRA: 4-bit Base with LoRA
QLoRA reduces the GPU memory needed to fine-tune a 65-billion-parameter model from hundreds of gigabytes to a single 48 GB card by storing the frozen base model in 4-bit precision and training only small LoRA adapters at full 16-bit precision.
intermediate · 7 min
-
Pro
Quantised GEMM Kernels
Quantised GEMM kernels replace 16-bit or 32-bit matrix multiplications with 8-bit or 4-bit integer arithmetic, cutting memory bandwidth and compute cost while preserving model accuracy through careful scaling and outlier handling.
advanced · 9 min
-
Reading an Accelerator Datasheet
A datasheet number means nothing without the four unit-aware ratios that reveal whether your workload will actually be compute-bound or memory-bound on that chip.
intermediate · 8 min
-
Reward Hacking in Alignment
Reward hacking occurs when a model maximises its training reward signal through behaviours that violate the designer's intent, undermining alignment despite high measured scores.
intermediate · 7 min
-
Reward Modelling in Practice
A reward model is a learned surrogate for human preference that RLHF uses to provide a differentiable training signal, and its quality determines how aligned the final policy is.
intermediate · 8 min
-
RLAIF and Constitutional Feedback
RLAIF replaces human preference labels with an AI judge, and Constitutional AI extends this by encoding a written list of principles so the model critiques and revises its own outputs before any RL training begins.
intermediate · 9 min
-
Pro
Roofline-Guided Kernel Optimisation
The roofline model maps a kernel's arithmetic intensity against hardware ceilings to diagnose whether compute or memory bandwidth is the binding constraint, and directs every subsequent optimisation decision.
advanced · 8 min
-
Pro
Serving Many LoRA Adapters
How specialised inference systems batch requests across hundreds of distinct LoRA adapters without duplicating the base model weights on GPU.
advanced · 8 min
-
Shared Memory and Tiling
Shared memory is a programmer-controlled on-chip SRAM that lets a thread block reuse data without re-fetching it from global memory, and tiling is the technique that makes that reuse systematic.
intermediate · 7 min
-
Supervised Fine-Tuning for Instructions
Supervised fine-tuning on curated instruction-response pairs is the first step that transforms a raw pretrained language model into a model that reliably follows human instructions.
intermediate · 7 min
-
Pro
Tensor Cores and Matrix Engines
Tensor Cores are specialised matrix-multiply-accumulate units on modern GPUs that deliver peak FLOP/s only when operand shapes and numeric formats are chosen correctly.
intermediate · 8 min
-
The CUDA Programming Model
CUDA organises GPU execution into a three-level hierarchy of grids, blocks, and threads, and every performance decision traces back to how well that hierarchy is exploited.
intermediate · 8 min
-
Pro
The FLOPs of a Transformer Forward Pass
A systematic derivation of how many floating-point operations a single transformer forward pass costs, and why that number dictates hardware choice, batch strategy, and scaling decisions.
intermediate · 8 min
-
The GPU Execution Model
GPUs execute thousands of threads in lockstep groups called warps; understanding that hierarchy and where threads stall is the single most important mental model for writing fast GPU code.
intermediate · 8 min
-
The GPU Memory Hierarchy
A GPU's memory is a multi-tier hierarchy where bandwidth drops and latency rises by orders of magnitude as you move outward from registers to HBM, and the speed of your kernel is almost always determined by which tier bottlenecks it.
intermediate · 8 min
-
The Intrinsic-Dimension Hypothesis
Pre-trained language models can be fine-tuned in a surprisingly low-dimensional subspace of their parameter space, and measuring that dimension explains why parameter-efficient methods work at all.
intermediate · 7 min
-
The KL Penalty and Reference Model
The KL penalty constrains a fine-tuned language model to stay statistically close to its pre-trained reference, preventing reward hacking while preserving the capabilities built during pretraining.
intermediate · 7 min
-
The Memory Maths of Fine-Tuning
Fine-tuning a 7B-parameter model with full gradients and Adam state consumes roughly 112 GB of GPU memory; parameter-efficient methods cut that by an order of magnitude by training only a tiny fraction of weights.
intermediate · 8 min
-
Pro
The Memory Wall and Arithmetic Intensity
Arithmetic intensity determines whether a GPU kernel is memory-bound or compute-bound, and almost every LLM inference operation sits on the wrong side of that line.
intermediate · 8 min
-
The Post-Training Pipeline
A structured walkthrough of the four-stage process that converts a raw pretrained language model into a deployable assistant, from supervised fine-tuning through reward modelling, RLHF, and preference-optimisation alternatives.
intermediate · 8 min
-
The Roofline Model
The Roofline Model bounds attainable hardware performance using two ceilings - peak compute throughput and peak memory bandwidth - letting you diagnose whether a kernel wastes silicon or wasits time waiting for data.
intermediate · 8 min
-
Pro
TIES and DARE Merging
TIES and DARE are two parameter-space merging algorithms that resolve weight interference when combining multiple fine-tuned models into one, avoiding retraining entirely.
advanced · 8 min
-
Pro
torch.compile and TorchInductor
torch.compile traces PyTorch graphs at runtime via TorchDynamo, then lowers them through TorchInductor to fused Triton or C++ kernels, delivering 20-36% throughput gains with no model rewrites.
intermediate · 8 min
-
TPU Systolic Arrays
A systolic array is a grid of multiply-accumulate units wired to pass partial sums directly between neighbours, letting Google's TPU sustain 92 TOPS on matrix multiplication without repeatedly hitting off-chip memory.
intermediate · 7 min
-
Triton: Python-Level GPU Kernels
Triton lets you write GPU kernels in Python by operating on tiles of data rather than individual threads, and its compiler handles shared-memory management, coalescing, and vectorisation automatically.
intermediate · 8 min
-
What a CUDA Kernel Is
A CUDA kernel is a C++ function that runs simultaneously on thousands of GPU threads, each identified by a coordinate in a structured grid, and understanding this execution model is the prerequisite for reasoning about throughput in any deep-learning workload.
beginner · 7 min
-
When Not to Write a Custom Kernel
Writing a CUDA kernel is expensive to maintain and easy to get wrong; this concept maps the decision boundary between writing one and leaning on existing compilers and libraries.
intermediate · 7 min
-
Which Layers to Adapt
Choosing which transformer weight matrices to inject LoRA or adapter modules into determines both the parameter budget and downstream task quality, and the right choice is not self-evident.
intermediate · 7 min
-
Pro
Why FlashAttention Is a Kernel Story
FlashAttention achieves its speedups not by reducing FLOPs but by restructuring the attention computation into a single tiled CUDA kernel that fits working data in on-chip SRAM, eliminating the dominant cost of round-tripping through GPU HBM.
advanced · 8 min
-
Why GEMMs Dominate
Almost every compute-heavy operation in a neural network reduces to a matrix multiply, which is why hardware and compilers optimise almost exclusively for GEMM throughput.
intermediate · 7 min
-
Why Parameter-Efficient Fine-Tuning
Parameter-efficient fine-tuning methods adapt large pretrained models to new tasks by training only a small fraction of parameters, making customisation practical without the compute and storage costs of full fine-tuning.
intermediate · 7 min
-
Pro
Writing a Fused Softmax
A fused softmax kernel collapses three separate memory-bound passes over a matrix row into one, cutting HBM traffic by roughly 4x and turning a memory-bound operation into a compute-limited one.
intermediate · 8 min
-
Pro
XLA and Just-In-Time Compilation
XLA compiles a whole computation graph into fused, hardware-specific kernels at runtime, trading a one-time compilation cost for sustained throughput gains across GPUs and TPUs.
intermediate · 8 min
Agents & Tool Use 13 concepts
Function calling, ReAct, multi-step planning, and the workflow-vs-agent boundary that decides whether your design ships.
-
Pro
Agent Evaluation Harnesses
Single-output accuracy says nothing about an agent that takes thirty steps; evaluating agents means scoring trajectories, environment state, and reliability across runs.
advanced · 10 min
-
Agent Frameworks Compared
LangGraph, CrewAI, AutoGen, and the OpenAI Agents SDK solve different problems; the harder question is whether you need a framework at all.
intermediate · 9 min
-
Pro
Agentic AI and ReAct
From single tool calls to multi-step agents that plan, act, observe, and recover from errors.
advanced · 9 min
-
Agentic Loops and stop_reason Handling
The agentic loop lifecycle - sending requests, inspecting stop_reason, executing tools, and appending results. The foundation of every autonomous Claude agent.
intermediate · 8 min
-
Pro
Agent Memory Architectures
An agent whose only memory is its context window is amnesiac between sessions; persistent memory is the architecture that decides what to keep, where, and how to retrieve it.
advanced · 10 min
-
CLAUDE.md Configuration and Claude Code Workflows
CLAUDE.md hierarchy, .claude/rules/ with glob patterns, custom commands and skills, plan mode vs direct execution, and CI/CD integration.
intermediate · 10 min
-
Pro
Context Management and Reliability Patterns
Context preservation across long interactions, escalation decision-making, error propagation in multi-agent systems, and information provenance.
advanced · 10 min
-
Model Context Protocol (MCP)
The open standard that replaces bespoke per-tool integrations with one protocol, so any compliant client can talk to any compliant server.
intermediate · 8 min
-
Multi-Agent Coordinator-Subagent Architecture
Hub-and-spoke multi-agent design with coordinator delegation, isolated subagent context, parallel execution, and iterative refinement loops.
advanced · 10 min
-
Programmatic Enforcement vs Prompt-Based Guidance
When to use hooks and programmatic prerequisites for guaranteed compliance versus system prompt instructions for probabilistic guidance.
intermediate · 6 min
-
Prompt Engineering and Structured Output Patterns
Explicit criteria, few-shot prompting, tool_use with JSON schemas, validation-retry loops, and the Message Batches API.
intermediate · 9 min
-
Tool Interface Design and MCP Integration
Writing effective tool descriptions, structured error responses, MCP server scoping, and the distinction between MCP tools and resources.
intermediate · 9 min
-
Tool Use and Function Calling
How models invoke external tools to fetch data, run code, and take actions in the world.
intermediate · 7 min
Evaluation & MLOps 7 concepts
Public benchmarks, HELM, custom evals, LLM-as-judge, red-teaming, model registries, and production monitoring.
-
Pro
Custom Evals and LLM-as-Judge
Why every production team eventually builds its own eval set, and how to use LLM judges without being fooled by their well-documented biases.
intermediate · 9 min
-
HELM and Holistic Evaluation
Why a single accuracy number is gameable, and how Stanford's HELM, BIG-bench, and lm-evaluation-harness push evaluation toward a multi-axis picture.
intermediate · 7 min
-
LLM Observability Tooling
How tracing an LLM app captures the full fan-out of model and tool calls behind one user request, and how LangSmith, Langfuse, Helicone, and Phoenix differ in what they instrument.
intermediate · 8 min
-
Model Registry, Lineage, and Reproducibility
The infrastructure that answers "which dataset, code, and hyperparameters produced this checkpoint?" - and why you only miss it the first time you cannot reproduce a model.
intermediate · 7 min
-
Pro
Production Monitoring and Drift Detection
How to catch silent regressions in deployed LLMs by monitoring input drift, output quality, and per-user randomised experiments before users tell you something is broken.
intermediate · 9 min
-
Public Benchmarks - MMLU, GPQA, HumanEval, MATH
A tour of the academic benchmarks that anchor frontier model launches, and why most of them are saturating, contaminated, or both.
intermediate · 8 min
-
Pro
Red-Teaming and Adversarial Evaluation
Why benign benchmark scores do not predict how a deployed model behaves under attack, and the human and automated methods used to find the failures first.
advanced · 9 min
Safety & Alignment 6 concepts
Prompt injection, jailbreaks, Constitutional AI, sycophancy, mechanistic interpretability, and frontier-alignment evaluations.
-
Alignment Evaluations and Frontier-Model Risk
How frontier labs and governments measure dangerous capabilities, what an eval-gated release looks like, and where the regulatory regime sits in 2026.
intermediate · 8 min
-
Pro
Constitutional AI and RLAIF
How Anthropic replaced human harmlessness labels with a written constitution and a critique-and-revise loop, and why this makes alignment auditable.
advanced · 9 min
-
Pro
Jailbreaks and Refusal Robustness
How attackers reliably bypass model refusal training, why post-hoc filters are necessary but never sufficient, and how AILuminate measures what remains.
intermediate · 9 min
-
Pro
Mechanistic Interpretability Primer
How sparse autoencoders extract human-interpretable features from model activations, what circuit-level analysis buys you for safety, and where the science is still contested.
advanced · 10 min
-
Prompt Injection
Why LLMs cannot reliably tell instructions from data, how indirect injection weaponises retrieved content, and which partial defences are worth deploying.
intermediate · 8 min
-
Pro
Sycophancy, Deception, and Reward Hacking
Why preference-trained models learn to please rather than to be right, what alignment faking is, and why evaluating during training can mislead you.
advanced · 9 min
LLM Systems 6 concepts
Vector databases, hybrid retrieval, prompt-cache infrastructure, gateways and routing, token accounting, and multi-tenant serving.
-
Hybrid Retrieval - BM25 + Vector + Reranking
Why pure vector search misses exact-match queries, how RRF combines lexical and semantic results, and where a cross-encoder reranker buys back the precision you lost.
intermediate · 8 min
-
Pro
LLM Gateways and Routing
Why every serious LLM deployment ends up behind a gateway, and how to choose between LiteLLM, Portkey, OpenRouter, and rolling your own.
intermediate · 9 min
-
Pro
Multi-Tenant Serving and Isolation
Serving many tenants from one model is cheap and easy; giving each tenant their own fine-tune is expensive and hard. S-LoRA and per-request LoRA serving collapse the trade-off, but only for tenants who can share a base model.
advanced · 10 min
-
Pro
Prompt Caching Infrastructure
How Anthropic, OpenAI, and vLLM let you reuse the KV cache of repeated prefixes, what the cache key actually is, and the patterns that turn cache hit rate into a real bill reduction.
intermediate · 9 min
-
Token Accounting, Billing, and Quotas
Why a single token counter is not enough, how to attribute spend across users and features without losing your mind, and the patterns that prevent one bad actor from spending the whole month's budget on a Tuesday afternoon.
intermediate · 8 min
-
Vector Databases Compared - pgvector, Qdrant, Milvus, Weaviate, LanceDB
A practitioner's guide to picking a vector store, weighing index trade-offs against the operational cost of running yet another database alongside your primary store.
intermediate · 9 min
Vision & Multimodal 46 concepts
Vision transformers, CLIP-style contrastive models, diffusion, segmentation, and the multimodal LLM stack that fuses text, image, audio, and video.
-
Attention Failures in TTS
Attention-based TTS systems fail in predictable ways - word skipping, repetition, and unstable alignment - and understanding the mechanics behind each failure mode is essential for building reliable speech synthesis pipelines.
intermediate · 7 min
-
Audio Features and Spectrograms
Raw audio waveforms are rarely fed directly to speech models; this concept explains how and why they are first converted into spectrogram-based representations that compress perceptual information into a learnable 2-D grid.
beginner · 8 min
-
Bark and Fully Generative Audio
Bark is a transformer-based model that generates speech, music, and nonverbal audio from text by autoregressively predicting discrete audio codec tokens, without any phoneme pipeline or continuous acoustic model.
intermediate · 8 min
-
Beam Search Decoding in ASR
Beam search decoding navigates the exponentially large label sequence space in ASR by maintaining a fixed-width frontier of the most probable partial hypotheses at each step, making it the default inference strategy for CTC, RNN-T, and attention-based models.
intermediate · 8 min
-
Causal and Chunked Attention for Streaming
Streaming ASR requires attention mechanisms that never look at future audio; causal masking and chunked attention are the two principal techniques, each trading latency against accuracy in different ways.
intermediate · 8 min
-
Contrastive Vision-Language: CLIP
How a 400M image-text contrastive objective produced a shared embedding space that does zero-shot classification, retrieval, and grounding without any task-specific labels.
intermediate · 8 min
-
CTC: Connectionist Temporal Classification
CTC is a training objective that lets a neural network learn to align variable-length audio to text without any hand-labelled frame-level annotations.
intermediate · 8 min
-
Pro
Diffusion Models
How learning to invert a noise process became the dominant generative recipe for images, video, and audio, and why Flow Matching and DiTs are reshaping the recipe in 2024.
advanced · 10 min
-
Pro
Diffusion Models for Speech
Diffusion models iteratively denoise random Gaussian noise into speech waveforms or mel-spectrograms, achieving sample quality that matches autoregressive vocoders at a fraction of the sequential compute cost.
advanced · 8 min
-
Duration Modelling and Alignment
Duration modelling assigns how many audio frames each phoneme occupies; alignment is the mechanism that learns or infers that mapping from text-audio pairs without manual annotation.
intermediate · 8 min
-
Endpointing and Voice Activity Detection
Endpointing and voice activity detection are the mechanisms that decide when a user has finished speaking, directly controlling the latency and correctness of every streaming ASR system.
intermediate · 8 min
-
Evaluating TTS with MOS
Mean Opinion Score is the field's primary yardstick for TTS naturalness, but its reliability hinges on listener pool design, anchoring, and context choices that most papers under-report.
intermediate · 8 min
-
FastSpeech and Non-Autoregressive TTS
FastSpeech eliminates the sequential mel-frame dependency of autoregressive TTS by predicting all frames in parallel, trading model simplicity for a duration predictor and a length regulator.
intermediate · 8 min
-
Griffin-Lim and Classical Vocoders
Griffin-Lim is an iterative phase-recovery algorithm that converts a magnitude spectrogram back into a waveform without any learned parameters, and understanding it clarifies exactly what neural vocoders had to replace and why.
intermediate · 8 min
-
HiFi-GAN and Neural Vocoders
Neural vocoders convert acoustic feature representations into raw audio waveforms, and HiFi-GAN achieves near-human quality at 167x real-time speed using a multi-scale, multi-period GAN architecture.
intermediate · 8 min
-
Pro
HuBERT and Discrete Audio Units
HuBERT pre-trains a speech encoder by predicting offline k-means cluster labels for masked audio frames, producing discrete unit sequences that rival phoneme transcriptions without any text supervision.
advanced · 8 min
-
Pro
Language-Model Fusion
Language-model fusion techniques inject text-only knowledge into end-to-end ASR models at inference time or training time, and the correct method depends on how much implicit language bias the acoustic model has already absorbed.
advanced · 8 min
-
Listen, Attend and Spell
LAS is a purely sequence-to-sequence ASR model that replaces HMMs, CTC, and explicit pronunciation dictionaries with a pyramidal RNN encoder and an attention-based character decoder trained end-to-end.
intermediate · 8 min
-
Pro
Multimodal LLMs: LLaVA, Flamingo, GPT-4V
The vision-encoder-plus-projector-plus-LLM recipe that dominates open multimodal models, why Flamingo's perceiver design still matters for video, and what native-multimodal frontier models do differently.
advanced · 9 min
-
Neural Audio Codecs
Neural audio codecs compress waveforms into discrete token sequences using learned vector quantisation, enabling language models to generate speech token-by-token.
intermediate · 8 min
-
Prosody and Style Control
How TTS systems encode and manipulate pitch, duration, energy, and speaking style so that synthesised speech sounds intended rather than merely intelligible.
intermediate · 8 min
-
Residual Vector Quantisation
Residual vector quantisation stacks multiple codebooks to approximate a continuous audio embedding with increasingly fine-grained corrections, making it the compression backbone of modern neural audio codecs.
intermediate · 8 min
-
Robustness to Noise and Accents
How modern ASR systems are trained and adapted to handle environmental noise, channel distortions, and speaker accent variability without collapsing to near-zero accuracy.
intermediate · 8 min
-
Pro
Segment Anything (SAM) and Dense Prediction
How promptable segmentation became a foundation-model task, what SAM's encoder-decoder split was designed for, and where it still loses to specialist models.
intermediate · 7 min
-
Speaker Diarisation
Speaker diarisation segments an audio recording into speaker-homogeneous regions and assigns each region a speaker identity, answering the question "who spoke when" without necessarily transcribing what was said.
intermediate · 8 min
-
Streaming TTS and Latency
Streaming TTS pipelines generate and deliver audio incrementally to cut time-to-first-audio from several seconds to under 300 ms, but doing so imposes hard trade-offs on chunk size, model architecture, and prosodic coherence.
intermediate · 7 min
-
Streaming vs Offline ASR
Streaming ASR emits partial transcripts incrementally as audio arrives, trading access to future context for low latency, while offline ASR processes the full utterance and consistently achieves lower word error rates.
intermediate · 7 min
-
Tacotron 2
Tacotron 2 is a two-stage neural TTS pipeline that converts text to mel spectrograms with a sequence-to-sequence model, then synthesises raw audio with a conditioned WaveNet vocoder, achieving near-human MOS scores.
intermediate · 8 min
-
Text Normalisation and Phonemisation
Text normalisation converts raw written text into a speakable form, and phonemisation maps those words to phoneme sequences; together they determine what a TTS system says before any audio is generated.
intermediate · 8 min
-
The Acoustic Model and Vocoder Split
Modern neural TTS splits the problem into two specialised sub-networks - an acoustic model that maps text to a compact spectral representation, and a vocoder that reconstructs a full audio waveform from that representation.
intermediate · 8 min
-
The ASR Problem and Pipeline
Automatic speech recognition converts a raw audio waveform into a word sequence by solving an alignment problem that classical NLP never had to face.
beginner · 7 min
-
The Conformer Architecture
The Conformer interleaves convolution and multi-head self-attention inside each encoder block to capture both fine-grained local acoustic patterns and long-range sequence dependencies, achieving state-of-the-art ASR accuracy on LibriSpeech.
intermediate · 8 min
-
The CTC Blank Token and Alignment
The CTC blank token is a special output symbol that lets a neural network emit one label per time-step without needing a hand-crafted alignment between audio frames and characters.
intermediate · 7 min
-
The Mel-Spectrogram Interface
The mel spectrogram is the agreed-upon intermediate representation that decouples acoustic modelling from waveform generation in modern TTS pipelines.
intermediate · 7 min
-
Pro
The RNN-Transducer
The RNN-Transducer is a fully neural, streaming-capable sequence transduction model that replaces CTC's conditional independence assumption with a learned label-context network, enabling accurate on-device speech recognition.
advanced · 9 min
-
The TTS Problem and Pipeline
Text-to-speech converts a string of characters into a waveform through a chain of normalisation, acoustic modelling, and synthesis stages, each introducing its own failure modes.
beginner · 7 min
-
Pro
VALL-E: TTS as Token Language Modelling
VALL-E reformulates text-to-speech as a conditional language modelling problem over discrete audio codec tokens, enabling zero-shot voice cloning from a three-second recording by treating acoustic context the same way GPT treats a few-shot text prompt.
advanced · 8 min
-
Video, Audio, and Any-to-Any Models
How Whisper, V-JEPA, Sora-class video generators, MusicGen, and unified any-to-any models extend the multimodal stack beyond static images.
intermediate · 9 min
-
Vision Transformers (ViT)
How treating an image as a sequence of patches let pure transformers beat CNNs once data crossed the 300M-image mark, and what the architecture gave up to get there.
intermediate · 8 min
-
wav2vec 2.0 and Self-Supervised Audio
wav2vec 2.0 learns speech representations from raw audio without transcripts by masking latent features and solving a contrastive task over learned discrete units, then fine-tunes on as little as ten minutes of labelled speech to reach competitive word error rates.
intermediate · 8 min
-
WaveNet
WaveNet is a fully autoregressive convolutional neural network that models raw audio waveforms one sample at a time, achieving near-human speech quality at the cost of extremely slow sequential generation.
intermediate · 7 min
-
Whisper's Multitask Decoder
Whisper conditions a single sequence-to-sequence decoder on a prefix of special tokens that specify language, task, and timestamp behaviour, allowing one model to handle transcription, translation, and language identification without any task-specific heads.
intermediate · 7 min
-
Whisper: Weakly-Supervised ASR
Whisper trains a sequence-to-sequence Transformer on 680,000 hours of weakly-supervised internet audio to achieve robust multilingual speech recognition without task-specific fine-tuning.
intermediate · 8 min
-
Why Sequence Length Is Hard in Audio
Audio produces roughly 100 frames per second of speech, making sequence lengths 10-50x longer than equivalent text, and this mismatch drives almost every architectural and training decision in modern ASR.
intermediate · 7 min
-
Word Error Rate and ASR Evaluation
Word Error Rate measures ASR accuracy as the minimum edit distance between a hypothesis and a reference transcript, normalised by reference length, but its apparent simplicity hides a nest of normalisation choices that make numbers across papers routinely incomparable.
intermediate · 8 min
-
Pro
Zero-Shot Voice Cloning
Zero-shot voice cloning synthesises speech in the voice of an unseen speaker from a short reference recording, without any fine-tuning at inference time.
advanced · 8 min