LLM Compass At a Glance
A knowledge compass for LLM training algorithms — this single page covers every algorithm: one sentence, the core formula, and when to use it. Build a full mental map in five minutes; click "Details →" for derivations, pseudocode, and tuning notes.
How to use this compass → · Notation →
Supervised Fine-Tuning
SFT
Supervised fine-tuning on instruction–response pairs turns a base model into an instruction follower.
When to use: the first step of all post-training. Details →
Key engineering sub-topics: Full Fine-Tuning · Data Construction · Chat Template · Sequence Packing · Loss Masking
LoRA & Variants
LoRA
Freeze
When to use: the default for memory-constrained fine-tuning. Details →
QLoRA
Store the frozen base in 4-bit NF4, dequantize on the fly for compute; the LoRA adapter trains as usual.
When to use: fine-tuning large models on a single GPU / very low memory, trading training speed. Details →
DoRA
Decompose weights into magnitude × direction: train the magnitude directly, update the direction via LoRA — learning dynamics closer to full fine-tuning.
When to use: chasing quality at low rank. Details →
AdaLoRA
Parameterize the update in SVD form
When to use: tight parameter budgets with uneven module importance. Details →
rsLoRA
Change the scaling factor from
When to use: a one-line free win at rank ≥ 64. Details →
LoRA+
Give the
When to use: a free speedup for any LoRA run. Details →
PiSSA
Initialize
When to use: faster convergence; pairs with quantization to shrink quantization error. Details →
Preference Optimization (DPO Family)
DPO
Solve the KL-constrained RLHF objective in closed form, collapsing "train an RM + run RL" into a single classification loss.
When to use: the default alignment method when paired preference data is available. Details →
IPO
Under deterministic preferences DPO pushes the reward gap to infinity; IPO switches to a squared loss that pulls the gap toward a fixed target.
When to use: when DPO clearly overfits the preference data. Details →
KTO
No paired data required — one sample plus a good/bad label; the loss borrows loss aversion from prospect theory.
When to use: only binary feedback (thumbs up/down) is available. Details →
ORPO
SFT loss + odds-ratio penalty: a single stage that "learns to answer + aligns preferences" with no reference model.
When to use: skipping the two-stage SFT → DPO pipeline. Details →
SimPO
Reference-free: the implicit reward becomes the length-normalized average logprob, plus a target margin
When to use: tight memory, or plagued by length inflation. Details →
CPO
Approximate the reference with a uniform prior to get an upper bound of the DPO loss, plus an SFT term to prevent chosen-probability collapse.
When to use: reference-free training that must preserve generation quality (e.g., translation). Details →
RLHF / Reinforcement Learning
The shared RL objective:
Reward Model
Train a scoring model on preference data with the Bradley-Terry loss; it supplies the reward for RL.
When to use: the prerequisite of RLHF; its quality caps the RL ceiling. Details →
PPO
Clip the importance-sampling ratio to bound each policy update; advantages via GAE (requires training a critic).
When to use: classic RLHF; ample resources and token-level credit assignment needed. Details →
GRPO
Drop the critic: sample a group of responses per prompt; the group-standardized reward is the advantage.
When to use: the current mainstream for reasoning RL (the DeepSeek-R1 recipe). Details →
RLOO
Back to REINFORCE: each response uses the mean reward of the other
When to use: the simplest unbiased group-sampling option. Details →
REINFORCE++
REINFORCE plus PPO's stabilizers (token-level KL, clip, global-batch advantage normalization) — no group sampling needed.
When to use: lightweight option when the sampling budget is one response per prompt. Details →
Agent & Skills
Tool Use Training
Teach the model to issue schema-correct function calls and digest the results; mostly SFT, with preference optimization refining call decisions. Details →
Agent Skills
Package procedures and tool knowledge into "instructions + scripts + resources" skill bundles — loaded on demand, no weight changes. Details →
Agentic RL
Extend the episode from single-turn generation to multi-turn "generate → execute → observe" loops, optimizing the policy against task-outcome rewards. Details →
Multi-Agent
Planner / executor / reviewer agents collaborate; orchestration patterns and credit assignment are the core problems. Details →