Bump prime-rl to trinity-dsv41: upstream main, PR #4057 (DeepSeek V4.1 Flash) with the engram port onto the shared n-gram module, and renderers tracking its trinity-dsv41 branch (v0.2.0 + the Hermes parser). Port the envs to the current verifiers v1 API, rl.toml to the new config schema (IPO loss kept as the new default), and bootstrap/launch/prepare scripts to the new layout. Decensor now runs DecensorEnv: the simulated user writes reviewed follow-ups up to each row's target_turns and every assistant turn is judged. Earlier runs trained on the first turn only. tests/test_multiturn_env.py drives the full loop against a mock endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.3 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-dsv41 |
Pinned stack
| Component | Version |
|---|---|
| PRIME-RL | upstream main eed0e44c + PR #4057 (DeepSeek-V4.1) + dphn/prime-rl@trinity-dsv41 (LoRA warm start, longer adapter-reload timeouts) |
| renderers | upstream main + PR #192 (DeepSeek-V4.1 renderer) + dphn/renderers@trinity-dsv41 (text-level Hermes tool parser) |
| verifiers | 72d08a0b6 (v0.4.2.dev, unmodified) |
| vLLM (training) | 0.32.0 (PRIME-RL lock) |
| 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, a fixed 512 episodes 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, which launches inference, the trainer, the orchestrator
and one env-worker-pool per source. Extra arguments are passed to rl. The run writes to
outputs/trinity-mini (output_dir / run.name) and resumes from its latest checkpoint.
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 (from the recipe's[inference]block, so the server keepsvllm.enable_loraandvllm.max_lora_rank = 128, whichrlonly fills in for inference it owns) and point training at it withdeployment.num_infer_gpus = 0,inference = "None"andorchestrator.model.client.base_url. - Warm start only restores adapter weights.
trainer.model.lora.init_pathcopies an attention-only adapter; optimizer, scheduler and step counters start fresh, so use a newrun.name. - 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.