Series in the AI archive · Part 1 · Architecture
A coding assistant can complete an unfinished function, follow a request to change it, or run a test and revise its patch. Each response can come from the same kind of decoder. The difference is partly in what its training rewarded and partly in what its runtime lets it observe. To understand a modern training recipe, follow the evidence available at each stage. The first stage sees written continuations. For the supervised-learning setup, see the earlier primer . Later stages may see demonstrations, choices between responses, or the result of executing an action.
Pretraining · Where next-token loss comes from Link to heading
Take a token sequence $x_1,\ldots,x_T$ preceded by a start token. The probability of the sequence is the product of successive conditional probabilities. If we fit the model by maximizing that probability, taking a negative logarithm turns the product into a sum to minimize. Dividing by $T$ yields the mean over predicted positions for this example. GPT-3
Here $\theta$ denotes the weights and $p_\theta$ is the distribution after the vocabulary softmax. At a single position, the target distribution puts all its mass on the observed token. Its cross-entropy with the prediction is therefore the negative log probability of that token. Assigning the target probability $1/2$ costs about $0.693$ nats. Assigning it $1/4$ costs about $1.386$ nats. The loss is sensitive to confidently missing the observed continuation.
During training, the prefixes come from the dataset. A causal mask allows a batch of positions to be scored in parallel while preserving the conditioning in the equation. During generation, the model consumes its own chosen tokens and computes new probabilities as the prefix grows. That difference matters for agents. The input after the first tool call depends on the action the model actually chose. A response assembled from demonstrations alone offers limited evidence about how the model will recover from an unfamiliar observation. Transformer · SWE-Gym
The recipe includes the data, the budget, and the checkpoints Link to heading
Filtering, deduplication, and mixture weights decide what the loss emphasizes before a GPU computes a gradient. Chinchilla varied model size and token count under training compute constraints. Its result gives a reason to consider the two together. A deployment with high inference volume can justify a different trade-off because the model pays its training bill once and its serving bill on every use. Parallelism addresses another part of the budget. Data parallelism divides examples, tensor parallelism divides operations inside a layer, and pipeline parallelism places groups of layers on different devices. Their communication and scheduling costs determine how effectively those devices are used. Chinchilla · Megatron-LM
Olmo 3 is a useful recipe to inspect because it releases checkpoints and training artifacts across stages. Compare base, intermediate, and post-trained checkpoints on the same held-out task, with the same prompt and evaluation. That reveals where behavior changed in the released pipeline. To attribute the change to a particular data source or objective, run a comparison that holds the other changes fixed. Olmo 3
Post-training · What counts as a good response? Link to heading
| Stage or method | What supplies the signal | What to inspect |
|---|---|---|
| Continued pretraining or midtraining | Text from a changed mixture, such as more code or longer sequences | Which data, context lengths, and number of updates changed |
| Supervised instruction tuning | A desired response or action sequence given an input | Which response tokens contribute to the loss and how representative the demonstrations are |
| Preference optimization | Human or model judgments comparing responses to the same input | Who supplied the preferences and what the comparison rubric rewards |
| Reinforcement learning with verifiable rewards | A checker, such as an answer matcher or executable test, scores a sampled output or trajectory | Which outcomes can earn a reward and which failures the checker misses |
InstructGPT demonstrates a pipeline with supervised demonstrations, a reward model fitted to human comparisons, and reinforcement learning against that reward. Direct preference optimization (DPO) uses preference pairs to optimize the policy directly against a reference policy. One way to read its objective is to compare how much the learned policy changes the odds of the preferred response over the rejected response relative to the reference. In both cases the preference data determine what the learner sees as better. InstructGPT · DPO
Reinforcement learning · A checker scores the answer, then what? Link to heading
Imagine a model trying to compute $18\times7$. The training environment has a checker for the final answer, 126. A supervised demonstration supplies a target solution token by token. Here the model supplies its own candidates. The checker can distinguish a correct answer from an incorrect one even when it has no opinion about how the model arrived there. DeepSeek-R1-Zero studied reasoning rewards without an initial supervised fine-tuning stage. The released R1 model uses additional training stages. DeepSeek-R1 · R1 preprint
For a fixed prompt, let $y$ be the completion and $r(y)$ its reward. With a fixed checker and a reward independent of the model parameters once $y$ is given, the simplest score-function identity explains how a scalar reward can move token probabilities. Start by differentiating the expected reward. Use $\nabla p=p\nabla\log p$, then factor the probability of a completion into token conditionals. REINFORCE, Williams 1992 · DeepSeekMath, §4
With terminal rewards alone, each sampled token in a completion gets the same outcome-derived multiplier before any additional credit-assignment machinery. A correct answer can reinforce a useful deduction, an unnecessary detour, or a lucky guess. That is the central trade-off. A checker can scale feedback without annotating every step, while leaving the learner to infer which steps earned the reward. A process verifier provides another way to give feedback along the way, but it introduces its own question about what counts as a valid intermediate step. Let’s Verify Step by Step
GRPO compares completions sampled for the same prompt. In the illustration the mean is 0.25, so the centered scores are 0.75 and −0.25. With four zeros, centering gives the group no relative reward signal. These are the centered rewards shown before normalization. The full method uses group normalization, a clipped objective, and a KL penalty in the DeepSeekMath formulation. The formula above describes the basic policy-gradient mechanism. DeepSeekMath, §4
LoRA is a way to adapt a checkpoint to a new task. Keep the original weights fixed and train small low-rank updates in selected layers. LoRA paper
What changes when the agent learns from a trace? Link to heading
In a research agent, a terminal reward might say only that the final claim lacked support. A useful execution trace can show the difference between three causes. The correct paper never appeared in the candidate set, the right passage reached the model and was ignored, or a compaction step dropped a condition required for the claim. Those traces suggest changes at different layers. They also depend on what the harness records. A trace is evidence about what happened in a particular run. Turning it into training data requires a judgment about what should have happened. March research-agent case study · SWE-Gym, ICML 2025
| What changes | What the next attempt receives | What to check |
|---|---|---|
| External memory | A retained lesson or evidence record in context, with the checkpoint held fixed | Whether it applies to the next task. Reflexion illustrates verbal feedback stored in episodic memory. Reflexion |
| Model weights | A new checkpoint trained on selected demonstrations, comparisons, or rewarded trajectories | Whether it generalizes to held-out inputs and harnesses. SWE-Gym supplies runnable repository tasks and publishes agent trajectories. SWE-Gym |
| The harness | A revised loop rule, such as reopening original evidence after a summary | Whether the change helps at a comparable budget, with the model checkpoint held fixed. Recursive Harness Self-Improvement, 2026 preprint |
How researchers test revisions to the harness
A harness can use failed traces to propose a change, evaluate the candidate, and use an accepted revision to produce the next round of traces and candidate changes. In a particular design, the agent that proposes changes may itself inherit the revised harness. That is the recursive step. Keep the evaluator, holdout tasks, and authority to promote a version outside the candidate’s control so the scores remain comparable across rounds.
Diagram source
flowchart TD
A["Run the current harness"] --> B["Collect checked traces"]
B --> C["Propose a loop revision"]
C --> D{"Pass a fixed evaluation?"}
D -->|Yes| E["Promote the candidate"]
E --> A
D -->|No| F["Keep the current version"]
STOP studied an improver program that modifies its own scaffolding around a language model. The Darwin Gödel Machine preprint studied self-modifying coding agents whose candidate revisions were evaluated on benchmarks. A 2026 preprint on Recursive Harness Self-Improvement iterates a prompt-level specification of the loop and reports improvements on 30 synthetic machine-learning research tasks. These experiments show improvements in particular scaffolds or harnesses under defined evaluation. Whether improvements transfer to a different workload, survive repeated holdout checks, or feed back into stronger model weights are separate questions. STOP · Darwin Gödel Machine · Recursive Harness Self-Improvement
What I would test next Link to heading
To find out whether training improved recovery after a failed tool call, I would replay the same failed calls and their observations to two checkpoints, with the same harness and call budget, then let each attempt recovery. Then I would hold the checkpoint fixed and vary which observations the harness returns. Score recovery separately from final completion. For the harness revision, freeze the checkpoint and test on queries from papers whose traces the reviser never saw. The first comparison tests for a difference between checkpoints. The second tests whether the observation is useful under that policy. Together they are more informative than a single score for an agent stack.
Part 3 follows a fixed checkpoint into the serving system and shows where time and memory go during a request.