Retrieved article excerpt
Open article · Retrieved 2026-11-15T21:21:27.279147+00:00
Sep 1, 2026[Research](https://www.mercor.com/blog/?category=research)
# Training frontier knowledge work agents: A 397B RL training guide with SkyRL
Mercor, and SkyRL
Mercor, and SkyRL
Share
*A step-by-step account of how we post-trained Qwen3.5-397B-A17B: we focus on the often overlooked infrastructure and derisking work preceding the hero run, show even stronger improvements on a larger model, and release the full training script.*
This is the third post in our series on post-training open models with Mercor’s expert data. In January, we showed that [fewer than 1,000 expert-labeled tasks](https://www.mercor.com/blog/expert-data-drives-model-performance/) could nearly double an open-weight model’s score on APEX-Agents. In February, we [scaled the dataset to roughly 2,000 cases](https://www.mercor.com/blog/scaling-data-apex-agents/). The resulting model, Applied Compute: Small, post-trained from GLM-4.7 355B, took the top spot in corporate law and fourth place overall. Both runs used a proprietary RL stack. This post opens the recipe: we reproduce those gains on public SkyRL, extend them to 397B parameters, and release the full training script, the model weights, and the eval traces.
The open-source community has made real progress on how to train competitive coding agents [1,2] at 27B to 32B parameters. Much less research is shared publicly about knowledge work agents, because realistic environments are costly to build and long-horizon rollouts are costly to train on.
We address this gap by post-training Qwen3.6-35B-A3B with reinforcement learning (RL) to surpass Opus 4.5 on APEX-Agents [3], a benchmark of 480 realistic knowledge-work tasks. We then extended the best recipe to Qwen3.5-397B-A17B, which improved Pass@1 by 70% relative, from 16.11% to 27.29%. The script is designed to run on proprietary data, but we document the full task format so you can point it at your own.
***Figure 1:*** *Pass@1 on the held-out APEX-Agents benchmark, before and after post-training on 1,928 expert-created APEX-Agents off-the-shelf tasks.*
***Figure 2:*** *Gains by domain. Darker bars are the post-trained* *`-Mercor`* *models. The 35B gains most in corporate law; the 397B gains most in management consulting.*
We take the final checkpoint of each run and refer to them as `Qwen3.5-397B-A17B-Mercor` and `Qwen3.6-35B-A3B-Mercor`.
In this blogpost, we give a step-by-step guide to frontier RL training for complex knowledge work, with the best practices we found and the lessons we learned.
Full training source code, model weights, and eval traces can be found at:
- [github.com/Mercor-Intelligence/ApexAgents-SkyRL-Recipe](https://github.com/Mercor-Intelligence/ApexAgents-SkyRL-Recipe)
- [huggingface.co/collections/mercor/apexagents-skyrl-recipe](https://huggingface.co/collections/mercor/apexagents-skyrl-recipe)
This blogpost is organized as the following:
- Background: APEX-Agents and our training setup
- Step 1: Environment, harness, and token accounting
- Step 2: RL systems tuning
- Step 3: The overfitting run
- Step 4: Algorithm ablations on the 35B
- Step 5: The 397B hero run
- Step 6: Evaluation and generalization
- Lessons and forward-looking
Steps 1 to 3 are de-risking. We do not spend significant compute until Step 4.
## Background: APEX-Agents and our training setup
[APEX-Agents](https://www.mercor.com/blog/introducing-apex-agents/) is Mercor’s frontier benchmark for long-horizon cross-application tasks in professional services. Unlike prompt-only tasks, each task lives in a world: a simulated company holding dozens of PDFs, spreadsheets, and slideshows, plus chat and email servers. Many tasks share one world. The agent works through MCP tools or code execution. The 480 benchmark tasks and all their files are public on Hugging Face, and you can read a [sample investment banking task](https://www.mercor.com/apex/apex-agents-leaderboard/investment-banking-analyst-agent/#sample-task) on the leaderboard.
We focus on RL without SFT warmup because RL is the hardest part of post-training to get right. We use SkyRL, built at Berkeley Sky Computing Lab in collaboration with Anyscale, for three reasons: it integrates arbitrary agent harnesses easily, it supports fully-async training, and its Tinker-compatible training loop lets us swap compute backends.
We anchor our study using APEX-Agents off-the-shelf (OTS) datasets: 1,928 expert-created tasks in management consulting, investment banking, and corporate law. They have the same shape as the public benchmark, but none of their worlds or prompts appear in it, so there is no contamination.
## Step 1: Environment, harness, and token accounting
Get the environment and harness right before any RL. That means three things: robust environment infrastructure (failed trajectories waste GPU hours and bias the reward), a correct harness (quirks teach the model to route around *your harness*, burning exploration budget that should go to the task), and exact token accounting.
### 1.0 What runs where (both compute and code)
We use Harbor for both the data format and rollout lifecycle management. Harbor comes from the team behind Terminal-Bench: it evaluates and optimizes agents in container environments, runs trials in parallel across sandbox providers like Modal and Daytona, and generates rollouts for RL. On top of it we implement our own `BaseAgent` ([code here](https://github.com/Mercor-Intelligence/ApexAgents-SkyRL-Recipe/blob/main/apex_agents_skyrl_recipe/agents/archipelago.py)), equivalent to Mercor’s [archipelago loop agent](https://github.com/Mercor-Intelligence/archipelago/tree/main/agents/runner/agents/loop_agent).
A Mercor OTS data delivery ships each world as an `image.tar`, which we push to ECR; at trial time Modal pulls that image to boot the sandbox. The image holds the world’s filesystem and runs the MCP servers that operate on it (Docs, PDF, Email, Chat). The agent loop connects to the sandbox’s MCP servers and exposes their tools to the LLM. In our setup the agent loop runs on the GPU nodes; it could equally run inside the environment sandbox, in a separate container, or on other CPU nodes in the Ray cluster.
***Figure 3:*** *What runs where for one RL trial.* ***Left:*** *training data is a HuggingFace dataset of prebuilt Harbor task directories (prompt, config, verifier), and each trial consumes one task directory.* ***Middle:*** *on the Ray GPU cluster, SkyRL provides the fully-async training loop, the vLLM engines, and in-flight NCCL weight sync; each trial runs as its own Ray task, where Harbor’s* *`Trial`* *drives the rollout lifecycle (env start → agent.run() → verify → teardown) around our* *`ArchipelagoAgent`**, which exchanges raw token IDs with the engines.* ***Right:*** *every trial gets a Modal sandbox booted from its world’s ECR image, exposing MCP servers over the world’s filesystem; after the agent finishes, Harbor runs the verifier in-sandbox, and the reward joins the trajectory flowing back to the trainer.*
The [recipe repo](https://github.com/Mercor-Intelligence/ApexAgents-SkyRL-Recipe) is deliberately small: SkyRL and Harbor are pip-installed dependencies, no forks, and the code you write is a handful of files.
```
ApexAgents-SkyRL-Recipe/
├── apex_agents_skyrl_recipe/
│ ├── entrypoints/
│ │ └── main_tito_harbor_fully_async.py # entrypoint: wires our config into
│ │ # SkyRL's fully-async trainer
│ ├── tito_harbor_generator.py # the one piece of SkyRL code you write:
│ │ # implements GeneratorInterface, runs each
│ │ # trial as a Ray task via harbor's Trial
│ ├── agents/
│ │ └── archipelago.py # the MCP tool-calling agent, a harbor
│ │ # BaseAgent subclass; the rest of agents/
│ │ # are its helpers (e.g. TITO bookkeeping)
│ └── harbor_trial_config/
│ └── archipelago_tito.yaml # agent + trial config: timeouts, retries,
│ # sandbox settings
│
└── scripts/ # launch scripts holding every SkyRL training
# knob we tuned in Steps 2 and 4
```
### 1.1 Environment infrastructure robustness
Once you know what runs where, the job is to drive environment failures down and keep the GPUs busy. This is largely a whack-a-mole process, but to give you a flavor:
- **Put a timeout on everything.** File downloads, MCP interactions, container teardown. Anything without a timeout will eventually hang a rollout for its entire end-to-end budget.
- **Bypass LLM-judge rate limits.** An eval pass generates modest judge traffic, but RL at 800+ concurrent rollouts hits rate limits hard. Round-robin across judge API keys if needed and retry with backoff, as in [`agents/llm.py`](https://github.com/Mercor-Intelligence/ApexAgents-SkyRL-Recipe/blob/main/apex_agents_skyrl_recipe/agents/llm.py).
- **Isolate MCP clients per process.** Sharing one Python process across hundreds of agent loops caused constant MCP disconnects, making the environment an unnecessary bottleneck. We run each agent loop as its own Ray task.
- **Classify every remaining error** as fail-the-trial vs. retry. One benefit of building on Harbor is that much of this fault tolerance already exists (search `@retry` in `harbor-framework/harbor`); the patches we added on top are in [`agents/archipelago.py`](https://github.com/Mercor-Intelligence/ApexAgents-SkyRL-Recipe/blob/main/apex_agents_skyrl_recipe/agents/archipelago.py), and the failure signatures we match on are in [`metrics_helper.py`](https://github.com/Mercor-Intelligence/ApexAgents-SkyRL-Recipe/blob/main/apex_agents_skyrl_recipe/metrics_helper.py).
**Suggestion.** Run an evaluation pass over your full training set at the concurrency you expect during RL, 300–600 rollouts for us, and drive the non-model error rate as close to zero as possible before training. Step 2 covers how we picked that ceiling. Do not rely on “masking errors during RL” too much.
### 1.2 Optimize the harness
With the infrastructure stable, look at the harness itself. Run an evaluation pass with the untrained model, then read the traces: how many failures reflect genuine model limitations, and how many come from harness quirks or outright bugs? Minimize the latter before RL, so training teaches real capability instead of workarounds.
These issues only surface by reading traces. That is slow manual work, but coding agents automate it well: ask them to systematically analyze traces and use metrics like per-tool failure rates to find patterns. Issues we found this way include:
- Some Python packages were initially missing from the sandbox, so agents burned many turns discovering what was actually installed, or fell back to sometimes-less-ergonomic MCP servers.
- The PowerPoint MCP tool returned `None` for every call even when it succeeded. We patched the MCP tool implementation in [`slides_output_validation_fix.py`](https://github.com/Mercor-Intelligence/ApexAgents-SkyRL-Recipe/blob/main/apex_agents_skyrl_recipe/agents/slides_output_validation_fix.py).
- The PDF-reader MCP tool flattens 2-D layout into 1-D text, garbling multi-column tables. We nudged the model to use the Python package `pdfplumber` instead.
These additions to the harness also helped:
- Nudge the model to wrap up when it is close to exhausting its context budget.
- When tool-call parsing fails, prompt the model to retry instead of failing the trajectory outright.
- Truncate tool results to a fixed token/char budget so a single call cannot blow the context.
Together these fixes raised the base Qwen3.6-35B-A3B from 22.74% to 28.69% mean reward, with zero training. Those fixes bought roughly what one epoch of training would have bought on the unfixed harness.
All harness tweaks are in the released codebase.
### 1.3 Token-in-token-out (TITO