Stanford Researchers Introduce TRACE: A Capability-Targeted Agentic Training System That Turns Recurrent Agent Failures Into Synthetic RL Environment

Agentic LLMs often fail the same way, again and again. A Stanford research team traced this to missing, reusable capabilities. Their system, TRACE, diagnoses those gaps and trains for them directly.

TRACE stands for Turning Recurrent Agent failures into Capability-targeted training Environments. It was released open-source under an MIT license.

What problem does TRACE solve?

To understand the design, first consider why agents fail. They lack specific skills that tasks demand, like retrieving the right record or verifying a precondition.

Two mainstream fixes spend compute poorly. Direct RL or SFT gives sparse rewards that never say which skill was missing. Broad synthetic data is untargeted, so budget flows to skills the model already has.

However, TRACE observes that failures are not random. A small set of deficits accounts for most failed trajectories. Therefore, each recurring deficit can become its own dense, verifiable training signal.

How does TRACE work?

Given that findings, TRACE runs an automated four-step pipeline. Each step is driven by an LLM agent following a markdown prompt.

Step 1: Contrastive capability analysis

The base agent generates rollouts in the target environment. An analysis agent splits them into successful and failed sets. It then labels every trajectory-capability pair as NA, PRESENT, or LACKING.

A capability is retained only when it is contrastive and high-coverage. Specifically, its contrastive gap must clear δ = 0.20 and coverage must clear ρ = 0.10. Consequently, the pipeline keeps skills whose absence concentrates in failures.

Step 2: Targeted environment synthesis

Next, a generation agent builds one synthetic environment per retained capability. Each environment isolates a single capability while preserving the target’s tool schemas and format.

Task instances are procedurally generated from random seeds. Because generation and verification are algorithmic, rewards need no human labels or LLM judge.

Step 3: Capability adapter training

Then each capability gets one LoRA (Low-Rank Adaptation) adapter, trained on its synthetic environment. The training algorithm is GRPO (Group Relative Policy Optimization). The base model stays frozen throughout.

GRPO groups rollouts by shared seed, so scenarios are identical within a group. Rewards are then normalized within each group to isolate the policy’s contribution.

Step 4: MoE composition with token-level routing

Finally, TRACE composes the adapters into a Mixture-of-Experts (MoE) model. The backbone and adapters stay frozen, and only lightweight token-level gates are trained.

At inference, each token is routed top-1 to a single capability adapter. This lets the model switch experts mid-trajectory.



How TRACE Works — Interactive Explainer

Interactive Explainer

How TRACE Turns Agent Failures Into Targeted Training

TRACE diagnoses the capabilities an agent lacks, builds one verifiable environment per gap, trains a LoRA expert for each, then routes tokens across experts. Step through the pipeline below.

1 · Contrastive Capability Analysis

Split rollouts into pass / fail, then keep gaps that separate them.

Passed  (D⁺)

Failed  (D⁻)

Retained if Δ ≥ 0.20 and Cov ≥ 0.10

2 · Targeted Environment Synthesis

One seeded, auto-verifiable environment is generated per capability.

3 · Capability Adapter Training (GRPO)

Rollouts share a seed; rewards are normalized within the group.

0%LoRA Δc  (~5.3%)

🔒 Base model frozen · only Δc updates

4 · MoE Composition · Token-Level Routing

A learned gate routes each token top-1 to a single capability expert.

Pick a task above to route its tokens.



Result · τ²-Bench overall pass rate (Qwen3-30B-A3B)

Targeted training and MoE composition beat prompt optimization and single-adapter baselines.

Built from arXiv:2604.05336 · code. Numbers are from the paper.  •  Marktechpost