Alignment

Wiki chapters and blog posts about Alignment.

Wiki

LLM-as-a-Judge: Using a Model as the Grader, Its Biases and Calibration

LLM-as-a-Judge lets a strong model score answers or compare them in pairs: cheap and scalable, but prone to position bias, length bias and misjudged math. Covers the judging modes, bias mitigation, measuring agreement with humans, and Bradley–Terry ranking.

Intermediate 21 min read

Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits

Mechanistic interpretability reverse-engineers a trained network into a readable algorithm. Three CPU experiments cover superposition and sparse autoencoders for finding features, the logit lens and activation patching for locating causes, and why the choice of ablation changes the answer.

Advanced 46 min read

Preference Optimization: From RLHF to DPO

After SFT a model follows instructions, but its answers are not always the ones people prefer. Preference optimization aligns it using comparisons: RLHF trains a reward model and optimizes with PPO, while DPO reduces the pipeline to a classification-style loss on preference pairs.

Advanced 17 min read

Reinforcement Learning for Reasoning: RLVR and GRPO

Since o1 and DeepSeek-R1, making a model think longer before answering has become the main line of post-training. Why verifiable rewards (RLVR) can replace a reward model, how GRPO drops the value model, and the recipe and pitfalls of R1-Zero and R1.

Advanced 21 min read

Reward Models: Turning Human Preferences into a Score to Optimize

A reward model scores a prompt-and-response pair with one number, trained on pairwise comparisons; RLHF, rejection sampling and best-of-n all use it. This page derives the Bradley–Terry loss, measures the accuracy ceiling set by label noise, and reproduces overoptimization in simulation.

Intermediate 46 min read

Reinforcement Learning Basics: Policy Gradients, Advantages and PPO

Policy gradients, baselines, GAE, PPO clipping and the KL penalty are the toolkit behind RLHF and reasoning RL. This page measures each on a toy task small enough to enumerate exactly: how baselines cut variance, why clipping is not a trust region, and where the KL belongs.

Intermediate 58 min read

Hallucination and Calibration: Why Models Sound Sure and Are Wrong

Hallucination is fluent output that contradicts the facts or the sources a model was given. This page covers two taxonomies, the floor set by facts seen only once, why binary grading rewards guessing, and three runnable simulations of calibration, temperature scaling and abstaining.

Intermediate 38 min read

Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications

Prompt injection makes a model treat untrusted content as instructions; a jailbreak makes it ignore its safety training. Attackers, targets and defenses differ. This page gives the threat models, six architectural defenses and a runnable worst-case simulation of what each defense stops.

Intermediate 39 min read

Blog posts

Direct Preference Optimization: Your Language Model is Secretly a Reward Model

DPO replaces 'reward model plus PPO' with one classification-style loss: given only preference pairs and a frozen reference model, it optimizes the same KL-constrained objective as RLHF. This post checks the derivation, runs a toy world for the frontier and training dynamics, and covers limits.

Paper notes NeurIPS 2023

InstructGPT: Training Language Models to Follow Instructions with Human Feedback

OpenAI's 2022 InstructGPT paper: supervised fine-tuning on about 13,000 human demonstrations, a reward model trained on human rankings of about 33,000 prompts, then PPO. A 1.3B InstructGPT beat the 175B GPT-3 in labeler evaluations. This breakdown checks the data, loss and results, and their limits.

Paper notes NeurIPS 2022

Learning to Summarize: A Reward Model from Human Preferences, Optimized with PPO

OpenAI ran the full RLHF pipeline on Reddit TL;DR summaries: collect human pairwise comparisons, train a reward model, then optimize the policy with KL-penalized PPO. A 1.3B human-feedback model beat a supervised model 10 times larger. Code checks the KL optimum and over-optimization.

Paper notes NeurIPS 2020 2020

Topics