Migrated from the rl-toolkit snapshot deployed for the 2026-09-15 production run (toolkit e191cf1 plus uncommitted changes). PRIME-RL is now a submodule on dphn/prime-rl@trinity; the v0 envs, parity tests, OPD experiment, and old configs are not carried over.
4.8 KiB
Trinity
RL training for arcee-ai/Trinity-Mini on
PRIME-RL: the decensor and Nemotron environments, the production recipe, and the scripts to
run it.
| Path | Contents |
|---|---|
envs/ |
Verifiers v1 environment packages: decensor, the four nemotron_* tasksets, and nemotron_guard (shared anti-hacking guard and subtask mixing) |
configs/rl.toml |
The production recipe |
scripts/ |
Training-host setup, launch, and preflight checks |
serving/judge/ |
Gemma judge replicas behind nginx |
prime-rl/ |
Submodule: dphn/prime-rl, branch trinity |
Pinned stack
| Component | Version |
|---|---|
| PRIME-RL | upstream 31ff561 + dphn/prime-rl@trinity (LoRA warm start, longer adapter-reload timeouts) |
| renderers | upstream bdb96b0 + dphn/renderers@trinity (text-level Hermes tool parser) |
| verifiers | b13ba60 (unmodified) |
| Policy | arcee-ai/Trinity-Mini@cdb81e8130815fec299cccc8f8700004b8366e1e |
| Judge / simulated user | google/gemma-4-26B-A4B-it@4d7ae4984b7db7de8f8457170b3f1a419ee76d52, vLLM 0.29.0 |
Recipe
One 8×H200 node: 2 trainer GPUs, 6 inference GPUs as TP2×DP3 (EP6), compiled with CUDA
graphs and prefix caching. q/k/v/o LoRA (rank 128, alpha 256), Muon at 8e-6, 2,048
rollouts per step in groups of 16, 512 rollouts in flight, 500 steps. Decensor supplies half
of each batch; the four Nemotron envs share the other half. Activation offloading is off;
selective activation checkpointing and optimizer CPU offload are on.
The judge runs separately: four RTX PRO 6000s, one Gemma replica per GPU, behind nginx. All judge and simulated-user clients share one endpoint. The decensor judge and simulated user are each capped at 192 concurrent requests, the best throughput measured on that hardware.
Running
Clone with submodules from the pid1 Gitea (the training host needs an SSH key for it), copy
.env.example to .env and fill it in.
Judge host:
serving/judge/setup.sh
JUDGE_ALLOW_IPS="<train host inbound IP> <train host outbound IP>" serving/judge/start.sh 4
Training host:
scripts/bootstrap.sh
PYTHONHASHSEED=0 uv run --project prime-rl --no-sync python scripts/prepare_data.py
JUDGE_BASE_URL=http://JUDGE_HOST:3001/v1 scripts/launch.sh --dry-run
tmux new -s trinity 'JUDGE_BASE_URL=http://JUDGE_HOST:3001/v1 scripts/launch.sh'
launch.sh renders the judge URL into outputs/rl.toml, checks HF/W&B credentials and the
pinned model revision, checks that the judge rejects unauthenticated requests and answers
authenticated ones, then starts rl. Extra arguments are passed to rl.
Tests (in any venv with prime-rl/deps/{verifiers,renderers}, the envs, and
transformers==5.6.2 installed):
pytest envs prime-rl/deps/renderers/tests/test_hermes.py
Don't run PRIME-RL's own test suite on a live training host: its session cleanup kills every
torchrun and vLLM process.
Things that bit us
- Trinity has no
<tool_call>token. It tokenizes as ordinary text, so every upstream token-id parser silently finds no tool calls. The renderers fork adds a text-levelhermesparser that handles reasoning prefill, Markdown, and delimiters inside JSON strings. Inference uses vLLM'shermestool parser anddeepseek_r1reasoning parser; the renderer usesthink. PYTHONHASHSEED=0is required. The guard's subtask mixing seeds its shuffles withhash(subtask), so the training mix changes from process to process without it.- Tool-calling eval uses
seed = 46. It is the first seed at or above 43 whose eval prefix doesn't overlap the training pool; seed 42 overlapped 4 of 16 rows. - Inference
lora_target_modulesmust match the trainer's targets. If it's unset, vLLM wraps MoE experts in LoRA layers it doesn't need. - Adapter reloads are slow under load. Live TP2/DP3 reloads took 86–129 s, hence the fork's 300 s read timeout and 600 s retry budget. The timeouts don't fix PRIME-RL's unsupervised background weight-update task; if it dies, the run needs a restart.
- Launcher-owned inference is all-or-nothing. If inference dies, the launcher kills the whole
process tree. To restart training without restarting inference, run
uv run inferenceseparately and point training at it withdeployment.num_infer_gpus = 0,inference = "None"andorchestrator.model.client.base_url. - Warm start only restores adapter weights.
model.lora.init_path(set on both trainer and orchestrator) copies an attention-only adapter; optimizer, scheduler and step counters start fresh, so use a new output directory. - Rewards add, they don't multiply. Verifiers sums
@vf.rewardvalues, so decensor's multiplicative reward is computed inside a single reward. A gate must return0.0; raising fails the rollout and retries it instead of scoring it.