Peking University's ResearchBoost-Agent Speeds Up ML Training by up to 9.59x
Peking University's open-source agent profiles training code, applies kernel-level optimizations, and keeps only speedups that a frozen judge verifies bitwise or within seed noise.
Takeaways
- Peking University's ResearchBoost-Agent autonomously profiles and optimizes AI training code via Codex or Claude Code.
- Reports 1.07x to 9.59x speedups across 17 projects spanning LLM, MLLM, image, video, embodied AI and science.
- A frozen hashed judge enforces structure, benefit, bitwise and 3-sigma statistical equivalence gates.
- One /goal session loops profile, edit, time, check inside a bubblewrap sandbox with read-only judge files.
- Nine skill cards cover profiling, fusion, FSDP multi-forward, kernel utilization and diffusion performance.
- Two-line prompt install; reuses existing Codex/Claude logins or standard API keys.
A Peking University team has open-sourced ResearchBoost-Agent (RBA), a workflow that uses OpenAI Codex or Anthropic Claude Code to profile and optimize machine-learning training scripts. A validation suite created before optimization checks every candidate for structural, numerical, and statistical equivalence with the original run.
RBA targets implementation overhead such as inefficient kernels, excessive kernel launches, synchronization, and slow data pipelines. Removing those bottlenecks can shorten experiments while preserving the model, training recipe, and accepted numerical behavior.
Reported gains range from 1.07× to 9.59×
The authors report results from 17 projects across six research domains. Each speedup compares an optimized implementation with its own baseline, using baseline runtime divided by optimized runtime.
| Project | Workload | Speedup |
|---|---|---|
| Faster-Motus | RoboTwin 2.0 fine-tuning with 27,244 episodes | 9.59× |
| Faster-RAE | Stage-one decoder and GAN training | 5.32× |
| Faster-LLaVA | LLaVA-1.5-7B stage-two fine-tuning | 2.39× |
| NanoChat | D24 FP8 training | 1.07× |
Because every project uses a local baseline, the ratios show available headroom within each setup. GPU model, driver, framework version, batch size, and data path can all change the measured gain. The repository contains the full results.
A referee the agent cannot edit
A faster training run can conceal changed semantics through a precision swap, reordered collective operation, skipped synchronization, or altered data sequence. RBA treats each candidate as untrusted and runs four gates in order, stopping at the first failure.
- Structure: Selected training entry points must remain unchanged under abstract syntax tree comparison, which compares parsed code structure. Loaded data, execution phases, call counts, random-number-generator fingerprints, learning-rate values, and cross-rank synchronization events must also match exactly.
- Benefit: The measured speedup must exceed
max(1.02, 1 + 2 × baseline spread). This sets a minimum improvement of 2% and raises the threshold when baseline timings vary. - Bitwise equality: Every tensor recorded by short deterministic test cases must match the baseline bit for bit.
- Statistical equivalence: A paired training trajectory runs with the first frozen random seed. For every endpoint metric, absolute bias must remain within three times the baseline’s seed-to-seed standard deviation.
Before optimization starts, a formulating agent runs the baseline twice to confirm bitwise-identical records, computes and freezes the seed-to-seed variance, and submits intentionally invalid candidates to verify that every gate rejects the relevant failure. It then hashes the judge files and writes the objective to GOAL.md.
The judge is mounted read-only inside a Bubblewrap sandbox, a lightweight Linux isolation mechanism. The coding agent can inspect the tests and thresholds while the sandbox and stored hashes prevent it from modifying the referee.
One guarded optimization loop
After the judge is sealed, one persistent Codex or Claude Code /goal session receives the workspace, assigned GPUs, and optimization skill cards. Each round follows the same sequence:
- Profile the current best version to locate the largest measured bottleneck.
- Edit one hotspot behind a feature switch so the change can be timed and reverted independently.
- Run
bench.py timeto measure the candidate against the frozen baseline. - Run
bench.py checkafter the candidate reaches the target speedup, applying all structural and numerical gates.
Nine bundled skill cards cover profiling, benchmark design, numerical validation, operation fusion, and multi-forward execution under Fully Sharded Data Parallel. The newer kernel-utilization-analysis card checks GPU streaming-multiprocessor coverage, kernels limited by launch overhead, and achieved memory bandwidth against the hardware peak.
Long-running sessions can survive restarts and usage limits through claw-orchestrator, which preserves continuity for the active optimization task.
From repository to first run
Running RBA requires a Linux GPU host, an existing training repository, a working baseline command, and access to Codex or Claude Code. The workflow also needs enough free disk space for its workspace and benchmark records.
The documented entry point is a two-line prompt that directs the coding agent to the RBA repository and its FORMULATOR_BRIEF template. The template has no required placeholders. The formulator inspects the repository, available GPUs, and free disk space before proposing detected settings and requesting confirmation.
- The code and training command to optimize
- The GPUs assigned to the run
- The working directory
- The workload and numerical precision
- The target speedup
Authentication can reuse an existing Codex or Claude Code login. API-based runs can instead use OPENAI_API_KEY or ANTHROPIC_API_KEY.
Headroom and hard limits
RBA fits training and fine-tuning workloads whose implementation can change while the declared recipe remains fixed. The published results point to three productive categories:
- Fine-tuning jobs with expensive data pipelines or many short, launch-bound kernels, including RoboTwin, LLaVA, and MiniMax-H3.
- Research codebases with custom training loops that have received little kernel-level profiling.
- Multi-stage pipelines such as RAE’s decoder and GAN training, where several fusion opportunities can accumulate.
Highly optimized training frameworks such as Megatron may leave less implementation headroom. Serving systems such as vLLM also sit outside the workflow’s main training focus. Algorithmic bottlenecks require changes to the model or recipe, which the frozen judge is designed to reject.
The acceptance rules also constrain aggressive numerical optimizations. Precision swaps, altered reductions, and reordered synchronization commonly fail the bitwise or three-sigma gates when they change recorded behavior.
The guarantees remain bounded by the judge’s coverage and the representativeness of its benchmark cases. Reproduction on different hardware or software versions can produce different timings even when the optimized code passes the same semantic checks.
The project blog describes a broader goal of feeding saved compute into additional experiments. The repository also maintains a wishlist where developers can submit projects for the team to attempt to accelerate.