GRPO 训练代码可扩展到 32 个 H100,用于长期终端/编码任务。基础代理现在是 Stanford TerminalBench 系统的顶级 Qwen3 代理。
GRPO 训练代码可扩展到 32 个 H100,用于长期终端/编码任务。基础代理现在是 Stanford TerminalBench 系统的顶级 Qwen3 代理。
TL;DR:
This project builds upon the rLLM framework developed by UC Berkeley Sky Lab, extending it with custom environments and infrastructure specifically designed for terminal-based agent training.
This image shows my training code running at full throttle on 32x H100's, distributed across a 4x bare metal node cluster, training Qwen3-32B. Thank you Hyperbolic for such a streamlined experience! This was fun!
Due to the extreme cost of this level of compute, I was not able to run it forever! So I made sure it worked and also ran the code on less extravagent hardware setups too.
I also ran Qwen3-32B training for longer on a 2x bare metal node cluster with 16x H100s:
Also 1 VM instance with 8x H100s:
My longest training run was using 2xA100s on a single VM instance, where I trained Qwen3-8B for over 60 steps:
Note: I did not expect the 8B to begin learning the complex behaviours required to solve the tasks in the dataset. However it was great to run the training through the dataset and ensure the code is stable.
Terminal bench is a brilliant benchmark created by Stanford and Laude Institute to quantify agents' ability to complete complex tasks in the terminal.
Through prompt engineering & custom tool design, my Qwen3-32B agent outperformed Stanford's Terminus-Qwen3-235B-30A MoE agent, as well as Deepseek R1 & OpenAI's GPT-4.1 with Codex agent, to become the highest scoring Qwen3 agent on the leaderboard.
The results.json for the eval run can be found here.
I am sure that with the compute budget for training, my agent would climb the leaderboard significantly.
My motivation behind this entire project was to place on the leaderboard of terminal bench by using RL to train a sophisticated LLM agent. In order to do so, I developed the tools (inspired by Claude Code) which a capable AI agent would use to help complete complex terminal/coding tasks, as well as a system message which encouraged the agent to use those tools and approach the task in a specific way.
These tools can be found here and include:
Note: Technically the agent could have access to only the bash tool and would still have the same capabilites as all these tools above. Saving the development time and maintenance. However by providing clear APIs to specific tools, it enables the agent to understand and leverage tools much more effectively.
The agent communicates through a structured XML/YAML format that ensures reliable parsing and execution:
operations:
- action: add
content: "Find and analyze all Python test files"
- action: add
content: "Run pytest and fix any failing tests"
view_all: true
cmd: 'find . -name "*.py" -path "*/test*" | head -10'
timeout_secs: 30
This architecture provides:
As well as developing these tools, I also wrote out a system prompt which encourages best practices such as:
With this system message & tool combination + a capable LLM (I chose Qwen3-32B), I was able to place 19th on the terminal bench leaderboard (currently under submission) with a score of 13.75%. This outperformed:
The agent can be seen here.
I would be extremely excited to see where Qwen3-32B would be on the leaderboard if I could afford to pay for the compute cost of a proper RL run!
As mentioned above, the compute costs of a full training run on a 32B LLM for long horizon terminal/coding tasks are not accessible for me, however the training code and dataset is ready to go and has been tested to train stably on hardware setups from 2x A100s all the way to 32x H100s.
To provide meaningful supervision during RL, rewards were computed using two complementary methods:
To ensure the LLM judge provided accurate and consistent scoring during RL training, I developed a simple evaluation system:
To analyze judge model performance:
# Run evaluation on a specific model
uv run python evaluation/llm_as_a_judge_evals/judge_eval.py --model openrouter/openai/gpt-4.1 --attempts 3
# Generate performance report showing best models
uv run python evaluation/llm_as_a_judge_evals/report.py
Top 5 Judge Models Performance:
| Rank | Model | Pass Rate | Avg Score |
|---|---|---|---|
| 1 | Claude Sonnet 4 | 46.67% | 0.26 |
| 2 | Claude 3.5 Haiku | 46.67% | 0.70 |
| 3 | Qwen3 Coder | 26.67% | 0.76 |
| 4 | Devstral Medium | 23.33% | 0.50 |
| 5 | Kimi K2 | 23.33% | 0.53 |
Claude Sonnet 4 ranks #1 despite having the same pass rate as Haiku because its significantly lower average score (0.26 vs 0.70) indicates stricter, more accurate judging (on the eval dataset). Lower scores mean the model better identifies problematic agent behaviors that other judges miss.
Other models tested include: GPT-4.1, Gemma-3-27B-IT, Qwen3-32B, and Qwen3-235B-A22B.
To handle overloaded models, token limits or performance requirements during long training runs, the infrastructure supports hot-swapping between different LLM judge backends:
switch_judge_backend.py and switching documentationExample workflow:
# Start with Claude Code CLI
python training_scripts/launch_training.py prod_32b_8_gpus
# Need to change? Switch to Lite
暂无开放 Issues,或尚未同步最近议题。