Fine-tuning, RLHF & Alignment·Question 59 of 61Advanced

You are turning someone else's open-weight MoE base model into an agentic coding model. Why add a mid-training stage before RL, what goes into a few trillion tokens of mid-training data, and what ablation would show the stage was worth its compute?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

A recent public example is Cognition's SWE-2 Flash (November 2026). It starts from Thinking Machines' Inkling-Small, a MoE with 276B total and 12B active parameters, and for the first time in Cognition's recipe adds a mid-training stage of a few trillion tokens (scientific articles, blogs, code and other sources) before RL.

Full worked answer with diagram

A recent public example is Cognition's SWE-2 Flash (November 2026). It starts from Thinking Machines' Inkling-Small, a MoE with 276B total and 12B active parameters, and for the first time in Cognition's recipe adds a mid-training stage of a few trillion tokens (scientific articles, blogs, code and other sources) before RL.

Why before RL. RL sharpens behaviour the policy already produces with some probability; it is a poor and expensive way to teach knowledge or a new distribution. Each RL token costs a rollout, often with tool execution, and carries a sparse scalar signal. A general-purpose base may be thin on what an agentic coder needs: whole repositories in long context, diffs and commit histories, issue and review threads, terminal sessions, tool-call formats. Mid-training moves the distribution with dense next-token loss at pretraining cost per token, so RL starts from a policy that already samples plausible trajectories.

What goes in the mix:

  • Code at repository granularity: files concatenated by repo for long context, with history, diffs, commit messages, PRs and issue discussions.
  • Technical prose: documentation, papers, engineering blogs, Q&A.
  • Agent-shaped data: real or synthetic trajectories in the target tool-call format, kept a small share so the model does not overfit one harness.
  • Replay of general data (often 10-30%) to limit forgetting, since this is someone else's base and you do not know its original mixture.
  • Hygiene: dedup against itself and the base's likely sources, licence filtering, and strict decontamination against every benchmark you will report.

Training details that bite on MoE: restart at a lower peak learning rate than pretraining with a warmup and an anneal, keep the load-balancing mechanism on, and watch per-expert token share, because a domain shift can collapse routing onto a few experts.

Is it worth the compute? Rough sizing: 6 x 12B active x 3T tokens is about 2.2e23 FLOPs, around 150k H100-hours at 40% utilisation, and more in practice because MoE runs below dense utilisation. That needs evidence.

The ablation that convinces:

  1. Run the same RL recipe from the base and from the mid-trained checkpoint, and add a compute-matched control: give the base the mid-training compute as extra RL or SFT. Without that control you have only shown that more compute helps.
  2. Compare RL learning curves, not just endpoints. Mid-training should show higher starting reward and faster climb.
  3. Measure pass@k at large k before RL. If mid-training raises pass@64 on held-out tasks, RL has more correct behaviour to sharpen.
  4. Evaluate held-out agentic tasks from repositories and task families absent from mid-training data, plus a general-capability suite for regressions.

If the mid-trained run beats the compute-matched control on held-out agentic tasks without regressions elsewhere, the stage earned its compute.

Worth sketching. Optional to draw, but the compute-matched control is the box candidates forget.

flowchart LR
    A["Open-weight MoE base"] --> B["Mid-training<br/>(few trillion tokens)"]
    B --> C["SFT and RL"]
    A --> D["Same compute spent<br/>as extra RL or SFT"]
    C --> E{"Held-out agentic tasks<br/>and regression suite"}
    D --> E

What a good answer covers

  • A recent public example is Cognition's SWE-2 Flash (November 2026)
  • It starts from Thinking Machines' Inkling-Small, a MoE with 276B total and 12B active parameters, and…
  • RL sharpens behaviour the policy already produces with some probability; it is a poor and expensive way…
  • Each RL token costs a rollout, often with tool execution, and carries a sparse scalar signal
  • A general-purpose base may be thin on what an agentic coder needs

Key terms: Why before RL · What goes in the mix

Interviewer follow-ups to expect

  1. How would you pick the general-data replay ratio without running a dozen full mid-training runs?

  2. What routing statistics would make you stop the run early?

  3. Why might pass@1 drop after mid-training even when the stage is working?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep