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>
453 lines
16 KiB
TOML
453 lines
16 KiB
TOML
# Trinity-Mini RL (GRPO) on modern prime-rl (verifiers v1, vLLM 0.32).
|
|
# 2048 rollouts/step; decensor at 50%.
|
|
# `ratio` is a relative sampling weight between sources: share = ratio_i / sum(ratios) * batch_size.
|
|
# decensor ratio 4.0 == sum of the four nemotron (1.0 each) -> decensor 1024, each nemotron 256.
|
|
# Blending WITHIN an env is `taskset.mix` (see the per-env blocks below) — `ratio` does not
|
|
# reach subtasks, so without `mix` a taskset's blend is dictated by raw source file size.
|
|
#
|
|
# ${JUDGE_BASE_URL} is substituted by scripts/launch.sh; do not pass this file to `rl` directly.
|
|
|
|
# The run writes to output_dir / run.name = outputs/trinity-mini. `run.name` must stay fixed
|
|
# for `[resume]` to find the previous checkpoints; it is also the W&B run name.
|
|
output_dir = "outputs"
|
|
clean = false
|
|
max_steps = 500
|
|
seq_len = 32768 # prompt + completion budget; matches inference max_model_len
|
|
|
|
[run]
|
|
name = "trinity-mini"
|
|
|
|
[monitors]
|
|
prime = "None" # no Prime platform run (on by default upstream; needs a Prime API key)
|
|
|
|
[monitors.wandb]
|
|
project = "prime-rl"
|
|
name = "trinity-mini"
|
|
|
|
[monitors.file]
|
|
|
|
[log]
|
|
level = "info"
|
|
|
|
[model]
|
|
name = "arcee-ai/Trinity-Mini"
|
|
|
|
# 8x H200: 2 train + 6 infer (inference TP2 x DP3)
|
|
[deployment]
|
|
num_train_gpus = 2
|
|
num_infer_gpus = 6
|
|
|
|
[ckpt]
|
|
interval = 25 # checkpoint before the ~step-38 weight-swap hang so restarts resume
|
|
keep_last = 2
|
|
keep_interval = 100
|
|
|
|
# Resume from the latest checkpoint under outputs/trinity-mini; a fresh run dir starts from
|
|
# scratch (the launcher logs "No checkpoints found ... Starting from scratch").
|
|
[resume]
|
|
|
|
[orchestrator]
|
|
batch_size = 2048 # rollouts per step
|
|
|
|
# Fixed in-flight cap (min = max = initial): judging/multi-turn work also occupies episode
|
|
# slots. The adaptive controller would otherwise ramp past what the judge host absorbs.
|
|
[orchestrator.concurrency]
|
|
initial_inflight = 512
|
|
min_inflight = 512
|
|
max_inflight = 512
|
|
|
|
# Trinity isn't in renderers.base.MODEL_RENDERER_MAP, so DefaultRenderer applies the model
|
|
# chat_template. tool_parser "hermes" matches the model card's `--tool-call-parser hermes`.
|
|
# The toolkit's renderer-level Hermes patch recognizes Trinity's multi-token delimiters
|
|
# outside reasoning and code examples; it preserves surrounding content and token spans.
|
|
# reasoning_parser "think" surfaces <think> traces into message.reasoning so the nemotron
|
|
# anti-hacking guards (reasoning_required) can read them — <think> IS a real token here.
|
|
[orchestrator.renderer]
|
|
name = "default"
|
|
tool_parser = "hermes"
|
|
reasoning_parser = "think"
|
|
|
|
[orchestrator.train]
|
|
group_size = 16 # GRPO group -> 128 prompts/step
|
|
|
|
[orchestrator.train.sampling]
|
|
temperature = 1.0
|
|
max_completion_tokens = 16384 # Trinity is reasoning-verbose; keep high
|
|
|
|
# Shuffle each finite taskset once before the sampler cycles it in that order. The old
|
|
# orchestrator shuffled every taskset (and reshuffled on each pass); the new default
|
|
# cycles in load() order.
|
|
[orchestrator.train.select]
|
|
shuffle = true
|
|
|
|
# --- decensor env — 1024 rollouts (50%). Agentic-review archive implementation. ---
|
|
# The archive uses the difficulty-filtered dataset, per-turn structured review, validated
|
|
# simulated-user follow-ups, and fail-closed service errors. Keep the per-turn cap at 8k so
|
|
# up to six turns stay within Trinity's 32k context budget.
|
|
#
|
|
# The package exports DecensorEnv, so each row runs as a conversation: the simulated user
|
|
# writes validated follow-ups until the row's target_turns (1-6, decaying by
|
|
# turn_decay_ratio) and every assistant turn is reviewed. The policy seat is
|
|
# `env.assistant`. (Runs before 2026-11 under verifiers b13ba60 never loaded DecensorEnv
|
|
# and trained on the first turn only.)
|
|
#
|
|
# Every source zeroes groups whose advantages are all 0, as the old default
|
|
# zero_advantage post-batch filter did.
|
|
[[orchestrator.train.source]]
|
|
name = "decensor"
|
|
ratio = 4.0
|
|
curriculum = { gates = { zero_advantage = { type = "advantage_range" } } }
|
|
# More workers expose parallel reviews; each worker has two review slots.
|
|
serve.pool = { type = "elastic", multiplex = 8, max_workers = 96 }
|
|
env.taskset.id = "decensor-v1"
|
|
env.taskset.num_examples = 2000
|
|
env.taskset.dataset_seed = 42
|
|
env.taskset.difficulty = "easy"
|
|
env.taskset.turn_decay_ratio = 0.5
|
|
env.taskset.max_turns = 6
|
|
env.taskset.style_probability = 0.25
|
|
env.taskset.markdown_probability = 0.50
|
|
env.taskset.enable_length_prompts = true
|
|
env.taskset.task.unclear_answer_penalty_multiplier = 0.1
|
|
env.taskset.task.meta_commentary_multiplier = 0.01
|
|
env.taskset.task.word_count_tolerance_percent = 0.60
|
|
env.taskset.task.enable_word_count = true
|
|
env.taskset.task.enable_structured_markers = true
|
|
env.taskset.task.enable_markdown_judges = true
|
|
env.taskset.task.enable_reasoning_trace = true
|
|
env.taskset.task.enable_reasoning_trace_is_clear = true
|
|
env.taskset.task.enable_meta_commentary = true
|
|
env.taskset.task.reasoning_enabled = true
|
|
env.assistant.harness = { id = "null" }
|
|
env.assistant.runtime = { type = "subprocess" }
|
|
env.assistant.max_turns = 6 # = taskset.max_turns; the conversation cap
|
|
env.assistant.max_output_tokens = 8192
|
|
env.assistant.timeout.rollout = 1800
|
|
|
|
# per-turn generation cap 8k for decensor only (nemotron keeps the global 16k)
|
|
[orchestrator.train.source.sampling]
|
|
max_completion_tokens = 8192
|
|
|
|
# decensor judge + simulated user, both on the shared gemma endpoint
|
|
[orchestrator.train.source.env.taskset.task.judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
min_p = 0.05
|
|
disable_thinking = true
|
|
max_concurrent_requests = 192
|
|
|
|
[orchestrator.train.source.env.taskset.task.judge.sampling]
|
|
temperature = 0.0
|
|
max_tokens = 1024
|
|
|
|
[orchestrator.train.source.env.taskset.task.user]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
temperature = 1.0
|
|
min_p = 0.0
|
|
max_tokens = 256
|
|
max_concurrent_requests = 192
|
|
|
|
# --- nemotron-knowledge — 256 rollouts. Shared gemma judge, full guard ON. ---
|
|
[[orchestrator.train.source]]
|
|
name = "nemotron-knowledge"
|
|
ratio = 1.0
|
|
curriculum = { gates = { zero_advantage = { type = "advantage_range" } } }
|
|
env.taskset.id = "nemotron-knowledge-v1"
|
|
env.taskset.dataset = "all"
|
|
env.taskset.mix_total = 20000
|
|
env.agent.harness = { id = "null" }
|
|
env.agent.runtime = { type = "subprocess" }
|
|
env.agent.timeout.rollout = 900
|
|
|
|
[orchestrator.train.source.env.taskset.task.guard]
|
|
reasoning_required = true
|
|
|
|
[orchestrator.train.source.env.taskset.task.guard.judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
[orchestrator.train.source.env.taskset.task.equivalence_judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
# qa_abstention is 3.1k rows against mcqa's 617k, so without a weight it is ~0.5% of the
|
|
# blend — 4 distinct prompts across 50 steps. `mix_total` bounds the pool: weights are a
|
|
# share of THIS many prompts, and a subtask with fewer rows than its quota is cycled. 20k is
|
|
# ~2.5x what 500 steps consume, so keep it modest or small sources repeat heavily (qa has
|
|
# only 3.1k unique prompts, so 0.1 already means each is seen ~2x per pass).
|
|
[orchestrator.train.source.env.taskset.mix.mcqa]
|
|
weight = 0.9
|
|
|
|
[orchestrator.train.source.env.taskset.mix.qa_abstention]
|
|
weight = 0.1
|
|
|
|
# --- nemotron-reasoning — 256 rollouts. math graded by math-verify; science by judge. ---
|
|
[[orchestrator.train.source]]
|
|
name = "nemotron-reasoning"
|
|
ratio = 1.0
|
|
curriculum = { gates = { zero_advantage = { type = "advantage_range" } } }
|
|
env.taskset.id = "nemotron-reasoning-v1"
|
|
env.taskset.dataset = "all"
|
|
env.taskset.mix_total = 20000
|
|
env.agent.harness = { id = "null" }
|
|
env.agent.runtime = { type = "subprocess" }
|
|
env.agent.timeout.rollout = 900
|
|
|
|
[orchestrator.train.source.env.taskset.task.guard]
|
|
reasoning_required = true
|
|
|
|
[orchestrator.train.source.env.taskset.task.guard.judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
[orchestrator.train.source.env.taskset.task.equivalence_judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
# Source sizes are science 150k / rg 15k / arc 10k / math 3.7k, so plain concatenation ran
|
|
# 83% science and 2% math — and routed 83% of the env's compute through the slow judge.
|
|
[orchestrator.train.source.env.taskset.mix.math]
|
|
weight = 0.35
|
|
|
|
[orchestrator.train.source.env.taskset.mix.science]
|
|
weight = 0.30
|
|
|
|
[orchestrator.train.source.env.taskset.mix.reasoning_gym]
|
|
weight = 0.25
|
|
|
|
# arc_agi is exact-match on a full grid and the model is at ~0% — kept small until it shows
|
|
# signal. `difficulty_bucket` filtering is the next lever if it stays flat.
|
|
[orchestrator.train.source.env.taskset.mix.arc_agi]
|
|
weight = 0.10
|
|
|
|
# --- nemotron-instruction-following — 256 rollouts. ---
|
|
[[orchestrator.train.source]]
|
|
name = "nemotron-instruction-following"
|
|
ratio = 1.0
|
|
curriculum = { gates = { zero_advantage = { type = "advantage_range" } } }
|
|
env.taskset.id = "nemotron-instruction-following-v1"
|
|
env.taskset.dataset = "all"
|
|
env.taskset.mix_total = 20000
|
|
env.agent.harness = { id = "null" }
|
|
env.agent.runtime = { type = "subprocess" }
|
|
env.agent.timeout.rollout = 900
|
|
|
|
[orchestrator.train.source.env.taskset.task.guard]
|
|
reasoning_required = true
|
|
|
|
[orchestrator.train.source.env.taskset.task.guard.judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
# calendar / adversarial / ultra-judge grader (IFJudgeConfig)
|
|
[orchestrator.train.source.env.taskset.task.judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
# Size-proportional blending starved the judge subtasks to ~0.6% each — 5 distinct rows
|
|
# across 50 steps. ifeval stays dominant since its checkers are deterministic and cheap.
|
|
# (`identity` was removed from the env: its rubric demanded the model claim to be Nemotron.)
|
|
[orchestrator.train.source.env.taskset.mix.ifeval]
|
|
weight = 0.34
|
|
|
|
[orchestrator.train.source.env.taskset.mix.structured_v2_direct]
|
|
weight = 0.12
|
|
|
|
[orchestrator.train.source.env.taskset.mix.structured_v2_diversified]
|
|
weight = 0.12
|
|
|
|
[orchestrator.train.source.env.taskset.mix.citation_format]
|
|
weight = 0.08
|
|
|
|
[orchestrator.train.source.env.taskset.mix.freeform_formatting]
|
|
weight = 0.08
|
|
|
|
[orchestrator.train.source.env.taskset.mix.calendar]
|
|
weight = 0.08
|
|
|
|
[orchestrator.train.source.env.taskset.mix.multichallenge]
|
|
weight = 0.05
|
|
|
|
[orchestrator.train.source.env.taskset.mix.adversarial]
|
|
weight = 0.05
|
|
|
|
[orchestrator.train.source.env.taskset.mix.sysbench]
|
|
weight = 0.03
|
|
|
|
[orchestrator.train.source.env.taskset.mix.cfbench]
|
|
weight = 0.03
|
|
|
|
[orchestrator.train.source.env.taskset.mix.inverse_ifeval]
|
|
weight = 0.02
|
|
|
|
# --- nemotron-tool-calling — 256 rollouts. Native schemas, one assistant action. ---
|
|
# exclude_message_actions ON (default): drops "reply-in-prose, no tool call" rows so they
|
|
# don't fight tool emission under the shared reward.
|
|
#
|
|
# `swe_pivot` is gone from the env entirely (unwinnable exact-match on a shell script), which
|
|
# also removes the over-length prompts; max_prompt_chars is belt-and-braces so a row that
|
|
# can't fit the context is dropped rather than scored 0 for generating nothing.
|
|
#
|
|
# The bundled harness sends tools through the native API and finishes after one response.
|
|
# No tool is dispatched: pivot rows grade the next action, not an execution outcome.
|
|
# Do not substitute a looping null harness or a truncating max_turns stop.
|
|
[[orchestrator.train.source]]
|
|
name = "nemotron-tool-calling"
|
|
ratio = 1.0
|
|
curriculum = { gates = { zero_advantage = { type = "advantage_range" } } }
|
|
env.taskset.id = "nemotron-tool-calling-v1"
|
|
env.taskset.dataset = "all"
|
|
env.taskset.mix_total = 20000
|
|
env.taskset.exclude_message_actions = true
|
|
env.taskset.max_prompt_chars = 60000
|
|
env.agent.harness = { id = "nemotron-tool-calling-v1" }
|
|
env.agent.runtime = { type = "subprocess" }
|
|
env.agent.max_output_tokens = 16384
|
|
env.agent.timeout.rollout = 900
|
|
|
|
# function_calling has the best signal of the pivot subtasks (21% positive vs 12%) but is
|
|
# only ~9.6k rows against tool_use_pivot's ~50k, so it needs an explicit share.
|
|
[orchestrator.train.source.env.taskset.mix.tool_use_pivot]
|
|
weight = 0.6
|
|
|
|
[orchestrator.train.source.env.taskset.mix.function_calling]
|
|
weight = 0.4
|
|
|
|
[orchestrator.train.source.env.taskset.task.guard]
|
|
reasoning_required = true
|
|
allow_renderer_stripped_tool_calls = true
|
|
|
|
[orchestrator.train.source.env.taskset.task.guard.judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
# --- eval — small and timed out so it can't hog the pool at step 0 ---
|
|
# `select.limit` takes the first 16 tasks in load() order (the old `num_examples = 16`).
|
|
[orchestrator.eval]
|
|
interval = 50
|
|
group_size = 1
|
|
|
|
[orchestrator.eval.select]
|
|
limit = 16
|
|
|
|
[orchestrator.eval.sampling]
|
|
temperature = 1.0
|
|
max_completion_tokens = 16384
|
|
|
|
[[orchestrator.eval.source]]
|
|
name = "nemotron-knowledge"
|
|
env.taskset.id = "nemotron-knowledge-v1"
|
|
env.taskset.dataset = "all"
|
|
env.agent.harness = { id = "null" }
|
|
env.agent.runtime = { type = "subprocess" }
|
|
env.agent.timeout.rollout = 900
|
|
|
|
[orchestrator.eval.source.env.taskset.task.guard.judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
[orchestrator.eval.source.env.taskset.task.equivalence_judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
[[orchestrator.eval.source]]
|
|
name = "nemotron-tool-calling"
|
|
env.taskset.seed = 46 # Disjoint eval prefix; training seed unchanged
|
|
env.taskset.id = "nemotron-tool-calling-v1"
|
|
env.taskset.dataset = "all"
|
|
env.taskset.exclude_message_actions = true
|
|
env.agent.harness = { id = "nemotron-tool-calling-v1" }
|
|
env.agent.runtime = { type = "subprocess" }
|
|
env.agent.timeout.rollout = 900
|
|
|
|
[orchestrator.eval.source.env.taskset.task.guard.judge]
|
|
base_url = "${JUDGE_BASE_URL}"
|
|
model = "google/gemma-4-26B-A4B-it"
|
|
api_key_var = "VLLM_API_KEY"
|
|
|
|
# --- trainer — Trinity afmoe MoE, LoRA ---
|
|
[trainer]
|
|
dist_timeout_seconds = 1800
|
|
|
|
[trainer.model]
|
|
attn = "flash_attention_2"
|
|
ep = 2 # expert parallel across the 2 train GPUs (128 experts / 2)
|
|
offload = "optimizer" # optimizer states in CPU RAM, weights on GPU
|
|
cp = 1
|
|
fused_lm_head_token_chunk_size = 1024
|
|
ac_offloading = "None" # disabled since the 2026-09-14 no-offload run; peak memory was not re-measured
|
|
|
|
# Selective AC now names what to SAVE (everything else is recomputed); the old config named
|
|
# what to recompute (norm, attn_proj, linear_attn, routed_experts). Saving only the attention
|
|
# kernels and collectives recomputes norms, projections and routed experts as before.
|
|
[trainer.model.ac]
|
|
mode = "selective"
|
|
freq = 1
|
|
targets = ["flash_attn", "flash_attn_3", "prime_rl_attn", "prime_rl_ring", "_c10d_functional", "prime_rl_collectives", "deepep"]
|
|
|
|
# rank 128: the max vLLM's fused_moe_lora kernel allows for this MoE. alpha kept at 2x rank.
|
|
[trainer.model.lora]
|
|
rank = 128
|
|
alpha = 256
|
|
dropout = 0.0
|
|
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj"]
|
|
|
|
[trainer.optim]
|
|
type = "muon" # Trinity-Mini was pretrained with Muon
|
|
lr = 8e-6
|
|
weight_decay = 0.0
|
|
max_norm = 1.0
|
|
nesterov = false # the old dion Muon call never passed nesterov (dion default False)
|
|
|
|
# --- inference — vLLM, native tools + reasoning parser ---
|
|
# TP2 x DP3 across the 6 inference GPUs. With expert parallelism enabled this gives EP6:
|
|
# attention is TP-sharded within each DP replica and routed experts are sharded across all
|
|
# six ranks. This is the intended DP experiment; the earlier TP4/DP1 layout was the only
|
|
# known-good Trinity layout, so smoke-test engine startup before a long run.
|
|
[inference.vllm]
|
|
max_model_len = 32768
|
|
tensor_parallel_size = 2
|
|
data_parallel_size = 3
|
|
gpu_memory_utilization = 0.90
|
|
enable_lora = true
|
|
lora_target_modules = ["q_proj", "k_proj", "v_proj", "o_proj"]
|
|
enable_prefix_caching = true
|
|
max_loras = 8
|
|
max_cpu_loras = 32
|
|
max_lora_rank = 128
|
|
api_server_count = 1
|
|
enable_expert_parallel = true
|
|
seed = 0
|
|
# Compile/CUDA graphs require a TP2/DP3 startup and adapter-reload preflight.
|
|
enforce_eager = false
|
|
tool_call_parser = "hermes"
|
|
reasoning_parser = "deepseek_r1"
|
|
# Per-DP-rank scheduler cap. With three DP ranks this permits up to 6,144
|
|
# scheduled sequences across the inference node (subject to available KV cache).
|
|
max_num_seqs = 2048
|
|
|
|
# The weights are cached locally; going offline keeps startup deterministic and stops the
|
|
# Hub rate-limiting us on restarts. Datasets are fetched by the orchestrator and the env
|
|
# worker pools, not here.
|
|
[inference.env_vars]
|
|
HF_HUB_OFFLINE = "1"
|
|
|
|
[trainer.env_vars]
|
|
HF_HUB_OFFLINE = "1"
|
|
|
|
# LoRA adapters reach vLLM through the filesystem.
|
|
[weight_broadcast]
|
|
type = "filesystem"
|