Which parts of a 397B RL recipe change with scale?

Mercor published a full 397B RL training recipe. Sorting its 14 lessons by whether they change with model scale shows which work stays in the cluster and which work you repeat at every checkpoint.

Write it once: Mercor's 14 lessons sorted by whether they change between a 35B and a 397B policy. Nine are the same at every scale (harness fixes, timeouts, process isolation, error policy, trace reading, token-in/token-out, overfit check, multi-pass evals, ablation screen), two are mixed (judge rate limits, logprob mismatch), and three change with scale (rollout GPUs vs KV cache, Megatron parallelism, the RL systems work).

This is part 1.1 of the RL training series.

It's almost the end of 2026, the year of agents, and for any of you RL practitioners out there post-training agents on your own proprietary tasks, I consider Mercor's 397B RL training guide essential reading. They've taken `Qwen3.5-397B-A17B` from 16.11% to 27.29% Pass@1 on held-out APEX-Agents tasks with SkyRL, Harbor and a Ray cluster, and to all of our benefit, they've published the recipe, the configs, the ablation table, and the eval traces. In this four-part series, I'm going to break it down and show you how to make this recipe durable and robust to infrastructure failures.

One sentence in their training recipe has stuck with me:

"the only real difference between a 35B run and a 397B run is the RL systems work."

The algorithm (DPPO, `prompt_mean` loss aggregation, a context nudge) was chosen on the 35B dev model and carried to the 397B, and what had to be rebuilt was the cluster around it. We've written about this idea before here, but in this series I wanted to further unpack the idea of the scale-invariant and scale-dependent components to an RL workload.

If you've read the μTransfer paper (Tensor Programs V), the split between algorithm and infrastructure will feel familiar. μP's contribution is to find the quantities that stay fixed as the model grows, tune them once on a small proxy, and stop re-tuning them at every size. The Mercor recipe has its own version of that split. Some of its lessons are about the model's size and the cluster it runs on, where you'll reconfigure those settings at every scale. Others are about the harness, the data and the evals, which don't care how many parameters the policy has and which you'll run hundreds of times.

I sorted all fourteen of the guide's lessons, and for each one I wrote down what the recipe already does about it and what (if anything) a durable AI runtime like Union.ai adds.

What's a scale-invariant lesson?

  • Scale-invariant: the work and its answer are the same for a 35B and a 397B policy. Fixing a PDF tool, classifying errors, deciding how many eval passes make a tie.
  • Scale-dependent: the answer changes with the model or the cluster. Megatron parallelism, how many vLLM engines it takes before the trainer stops waiting, KV-cache-bound concurrency.
  • Mixed: the lesson applies at every scale but its numbers don't (judge rate limits at 300 vs 800 concurrent rollouts).

The fourteen lessons, sorted

#Lesson (from the guide)Changes with scale?What the recipe already doesWhat a durable runtime adds
1Harness fixes alone took the untrained 35B "from 22.74% to 28.69% mean reward, with zero training"NoRead traces by hand, plus a coding-agent pass over all dataHarness as a versioned input to a cached eval, so a fix re-runs only the cells it touches (part 3)
2"Anything without a timeout will eventually hang a rollout for its entire end-to-end budget"No (the values do)Harbor agent timeouts, LLM call timeoutsA per-action backstop timeout that names the stuck trial and keeps its logs; the in-process timeouts stay where they are
3One Python process shared by hundreds of agent loops "caused constant MCP disconnects"NoOne Ray task per trialEquivalent isolation (a pod or a replica slot per trial), plus a durable record of each finished trial
4"RL at 800+ concurrent rollouts hits rate limits hard"MixedRound-robin API keys, backoff, a trajectory rate limiterRetries with backoff per action, and judge calls that are memoized so a retry doesn't pay twice. It doesn't make 429s go away
5"Classify every remaining error" as fail-the-trial or retryNoPer-trial retries, AgentTimeout never retried, masking rules per prompt groupTyped retry policies per task, and non-retryable errors that fail fast. Mostly what the recipe has
6Harness bugs found by reading traces (a PowerPoint tool returning `None`, a PDF tool flattening tables, missing packages)NoManual reading plus an agent passA cached trace-mining pipeline that re-labels when the classifier changes (part 2)
7Token-in/token-out; re-tokenizing silently misaligns trainingNoRewrote the harness to use `/completions`Nothing. This one lives in the harness
8Overfit 32 tasks first to check learnabilityNoA separate synchronous runThe same pipeline with a smaller input, sharing the cached data prep
9Single-pass evals vary ±1–3 points; use 3-pass means; under ~1 point is a tieNoThree passes, run by handEval cells cached per (checkpoint × harness × task × pass), so a fourth pass costs one pass
10Train/inference logprob mismatch under ~0.03 (it caught a vLLM CPU-offload bug)MixedA check over a few stepsLittle. The check lives inside the trainer
11Add rollout GPUs until `wait_for_generation_buffer` is 0; KV cache caps concurrencyYes12:4 nodes for the 35B, 12:8 for the 397BNothing inside the cluster
12Megatron parallelism sweep in "one overnight Claude Code session"YesAn overnight agent sessionA sweep as a fan-out of short runs whose results persist. Modest
13`prompt_mean` +3.9, nudge +3.0, DPPO ≈ GLM-5 lossNo (it transferred)13 full-weight ablations on the 35BA question worth testing: would a cheaper screen pick the same winner? (part 4)
14"The only real difference between a 35B run and a 397B run is the RL systems work"YesAnyscale cluster, S3 checkpoints, `resume_mode=latest`Substrate only. Keep the Ray cluster warm across driver restarts, as Ray's detached actors already allow

By my count, nine of the fourteen are scale-invariant, three are scale-dependent, and two are mixed. And of the nine scale-invariant ones, the recipe already handles three about as well as anything would (2, 3, 7).

If you sort the same fourteen by where the work happens, they fall into three places:

Diagram of the guide's 14 lessons by where their work lives. Inside the cluster (SkyRL, Megatron, vLLM, Ray): 10 logprob mismatch, 11 rollout GPUs, 12 Megatron parallelism, 14 the RL systems work. Already handled in the recipe: 2 timeouts, 3 one Ray task per trial, 7 token-in/token-out. Around the cluster: 1 harness fixes, 4 judge rate limits, 5 error policy, 6 trace reading, 8 overfit check, 9 multi-pass evals, 13 ablation screen.
The lessons that change between a 35B and a 397B run sit inside the cluster. Most of the rest sit around it, in work that gets repeated on every harness fix, checkpoint and dataset.

Where doesn't a durable runtime help?

Rows 10, 11, 12 and 14 are where a 397B run actually differs from a 35B run, and almost none of that is outside the cluster. You can see the difference in Mercor's own launch scripts. Diff `run_qwen36_35b_fully_async.sh` against `run_qwen35_397b_fully_async.sh` and the algorithm block doesn't appear in the diff at all, while the cluster lines all do (trimmed and regrouped here):

Copied to clipboard!
 # Algorithm: DPPO (binary TV) + prompt_mean, GLM-5-paper clips       (same in both scripts)
 export POLICY_LOSS_TYPE=${POLICY_LOSS_TYPE:-dppo}
 LOSS_REDUCTION="${LOSS_REDUCTION:-prompt_mean}"

-MODEL_NAME="${MODEL_NAME:-Qwen/Qwen3.6-35B-A3B}"
+MODEL_NAME="${MODEL_NAME:-Qwen/Qwen3.5-397B-A17B}"
-GPU_MEMORY_UTILIZATION="${GPU_MEMORY_UTILIZATION:-0.85}"
+GPU_MEMORY_UTILIZATION="${GPU_MEMORY_UTILIZATION:-0.93}"
-NUM_INFERENCE_ENGINES="${NUM_INFERENCE_ENGINES:-10}"
+NUM_INFERENCE_ENGINES="${NUM_INFERENCE_ENGINES:-12}"
-POLICY_NUM_NODES="${POLICY_NUM_NODES:-4}"
-MEGATRON_TP="${MEGATRON_TP:-8}"
-MEGATRON_EP="${MEGATRON_EP:-8}"
-MEGATRON_CP="${MEGATRON_CP:-1}"
-MEGATRON_PP="${MEGATRON_PP:-1}"
+POLICY_NUM_NODES="${POLICY_NUM_NODES:-8}"
+MEGATRON_TP="${MEGATRON_TP:-4}"
+MEGATRON_EP="${MEGATRON_EP:-16}"
+MEGATRON_CP="${MEGATRON_CP:-2}"
+MEGATRON_PP="${MEGATRON_PP:-4}"
-# Rate limiting (550 = 660 * 10/12, scaled with the engine count)
+# Rate limiting
-MAX_CONCURRENCY="${MAX_CONCURRENCY:-550}"
+MAX_CONCURRENCY="${MAX_CONCURRENCY:-300}"
+# S3 checkpointing is a must at 397B (no NFS; per-node disks can't be re-merged).
+CKPT_PATH="${CKPT_PATH:-$S3_PATH/$RUN_NAME/ckpt}"

The public 35B script is sized for a 14-node cluster, so it runs 10 engines where the guide's run had 12, and scales the concurrency cap down to match. The rest of the scale work is in budgeting 3,600 s for NCCL warm-up on cold nodes, pinning the entrypoint to a node with 370 GB of spare host RAM, and sizing KV cache against rollout concurrency, all of which is handled by SkyRL, Megatron, vLLM and Ray. Ray already restarts actors and retries tasks, and a detached named actor outlives its driver. The Flyte side of our own SkyRL experiments (design notes) is built on exactly those Ray features, and the most a runtime adds there is a durable record of which steps finished, so a crashed driver replays them instead of redoing them.

Where does work have to rerun?

The scale-invariant rows have something in common: you run them constantly. Every harness fix is a re-eval. Every new checkpoint is three passes over 480 tasks. Every new dataset involves an overfit run, a trace read and a harness audit before a single gradient step. By the guide's own accounting, the harness fixes alone "bought roughly what one epoch of training would have bought."

That work has the shape that perfectly fits a durable runtime. It fans out to thousands of trials, it fails in small pieces (one sandbox, one judge call), and most of it doesn't need to run twice. In code, the trick is to make each piece a task whose cache is keyed by its inputs. Stripped down to pseudocode, an eval looks like this:

Copied to clipboard!
@env.task(cache="auto", retries=3)
async def run_trial(task: TaskSpec, checkpoint: str, harness: Harness, pass_idx: int) -> Trajectory:
    ...  # one sandbox, one agent loop, one trajectory

@env.task(cache="auto")
async def grade(traj: Trajectory, task: TaskSpec, rubric: Rubric) -> Graded:
    ...  # verifier + judge, run on a stored trajectory

@env.task
async def evaluate(checkpoint: str, harness: Harness, tasks: list[TaskSpec], rubric: Rubric, passes: int = 3):
    cells = [(t, p) for t in tasks for p in range(passes)]
    trajs = await asyncio.gather(*(run_trial(t, checkpoint, harness, p) for t, p in cells))
    return await asyncio.gather(*(grade(tr, t, rubric) for tr, (t, _) in zip(trajs, cells)))

Every input that changes the answer is in a function signature, so each kind of change pays only for the steps that read it. A harness fix gets a new `Harness.version`, which runs the new version's cells once and leaves the old ones as the baseline. A fourth pass runs one pass. A new rubric re-grades stored trajectories without re-rolling them, and a new failure category re-labels traces without re-parsing them:

Animated matrix of five changes against five pipeline steps (data and worlds, rollouts, grading, failure labels, summary), lighting up one change at a time. Fixing a tool re-runs rollouts, grading, labels and summary for the new harness version, with data cached. Adding a fourth eval pass and adding a model run only the new cells. Changing the judge rubric re-runs grading only. Adding a failure category re-runs labels only. The trace audit ran 28 label chunks with downloads cached; the leaderboard ran Sonnet's 72 cells and reused 60 of Haiku's.
The two annotated rows are real runs from parts 2 and 3; the rest follow from the same cache keys.

The other three posts in this series test whether the scale-invariant work behaves this way, on public data and runnable code:

  1. What 1,068 Terminal-Bench traces say: a pipeline that reads Mercor's published eval traces end to end and labels every failure.
  2. Your harness is an input: a real Claude agent on a synthetic company drive, run on two harness versions that reproduce the bug classes the guide describes, with every eval cell cached.
  3. Can a LoRA screen pick the right ablation?: the guide's loss-aggregation ablation, run as LoRA adapters and at full weight on a small model, to see whether the rankings agree.

Recap

  • Scale-dependent (rows 10–12 and 14): parallelism, engine counts, KV-bound concurrency, warm-up budgets. These stay in SkyRL, Megatron, vLLM and Ray.
  • Already solved in the recipe (rows 2, 3, 7): timeouts, process isolation, token-in/token-out.
  • Scale-invariant and repeated (rows 1, 4, 5, 6, 8, 9, 13): harness evals, trace reading, error policy, overfit checks, multi-pass evals, ablation screens. Write these once as cached, versioned steps, and each new checkpoint, harness or dataset pays only for its own cells.

Try it

Copied to clipboard!
git clone https://github.com/unionai/unionai-examples
cd unionai-examples/v2/tutorials/agentic_rl_evals
flyte run trace_audit.py audit --classify false   # Mercor's Terminal-Bench traces, features only
flyte run harness_eval.py compare_harnesses       # harness v1 vs v2, every cell cached

In the next post, I'll start on the scale-invariant list with lesson 6, reading eval traces. Mercor published 1,068 of them for Terminal-Bench 2.1, and I'll show you what a pipeline that reads every one of them says about where agent time goes and how the agents fail.

View full code on GitHub →
Sign up

30 day free trial

Try the devbox
No items found.