Compare commits

...
Author SHA1 Message Date
samsjaandGitHub b127f0375b fix(orchestrator): use atomic writes for checkpoint saves (#2992)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Write checkpoints to a temp file then atomically rename into place, so a
killed process can't leave a corrupt progress.pt that breaks restarts.

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
2026-07-10 12:15:53 -07:00
4bbf967a57 feat: adapt to verifiers task-centric Task/TaskData split (#2987)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* feat: adapt to verifiers task-centric Task/TaskData split

Companion to PrimeIntellect-ai/verifiers#1948: Trace is now generic over
TaskData (DataT), the wire task type is WireTaskData, and vf.Task is the
behavior class — placeholder wire tasks construct vf.TaskData. Taskset
knobs that moved onto TaskConfig nest under taskset.task in configs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/verifiers (from_trace is an opt-in hook)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/research-environments to the task-centric port

All v1 envs in research-environments now speak the task-centric API
(PrimeIntellect-ai/research-environments#650); general_agent's tools
placement knob nests under taskset.task like the other moved knobs.
Full unit suite green against the pinned branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat: adapt to the nested trace.task carrier

Companion to verifiers recording the producing task class on the trace
(trace.task -> {type, data}): dispatcher placeholders wrap their rows in
vf.TraceTask (type="Task" — no behavior class ever ran), readers nest
(.task.idx -> .task.data.idx), and the wandb sample tables keep showing
the row. Bumps both submodule pins.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/verifiers (compact harness nested-task fix)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/verifiers (simplify-API merge + review fixes)

Compat-audited: every surface prime-rl imports is unchanged or already
adapted; unit suite green (544) and 10-step reverse_text/gsm8k debug
runs healthy against the pinned tip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(configs): glm45air search judges nest under taskset.task

main's new search config predates the task-centric knob move: plugged
judges live at taskset.task.judges and browsecomp's judge endpoint at
taskset.task.judge.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump submodule pins (codex feature-tool disable, sandbox version fix)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/verifiers (replay recomputes from scratch)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/verifiers to main (task-centric tasks merged)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/research-environments (verifiers dev443 floors)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/research-environments (python floor + prerelease test fix)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/research-environments (port changelogs)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/research-environments (swe taskset ports)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/research-environments (stale comment)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump deps/research-environments to main (v1 ports merged) + relock

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 12:11:43 -07:00
samsjaandGitHub cdb1480c66 fix(trainer): reduce filesystem churn in nccl weight broadcast (#2991)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Only the master rank polls the filesystem for NCCL_READY markers; all
other ranks wait on a dist.barrier() instead. This eliminates redundant
filesystem polling across trainer ranks on multi-node setups.

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
2026-07-10 12:10:43 -07:00
samsjaandGitHub f34efdbf49 fix(orchestrator): allow final nccl batch through dispatch gate (#2990)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
The trainer skips the final NCCL weight broadcast (nccl_broadcast_unused
in train.py: step >= max_steps - 1) because the inference NCCL group is
torn down before that broadcast lands. As a result policy.version never
reaches the final step.

The orchestrator's dispatch gate (update_dispatch_gate) was unaware of
this: it pauses dispatch when lead > TARGET_LAG, waiting for a policy
version the trainer will never publish. Once the rollout buffer can't
cover the last batch on its own, the run deadlocks.

This mirrors the trainer's nccl_broadcast_unused condition in the gate:
when building the final batch under NCCL, let it through regardless of
lead. The last batch is meant to build on the penultimate policy anyway.

Signed-off-by: Sami Jaghouar <sami.jaghouar@gmail.com>
2026-07-10 11:49:35 -07:00
9b47b777aa feat(models): dense Qwen3.5 custom attention (#2984)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
Implement dense Qwen3.5 (Qwen3_5ForCausalLM / Qwen3_5Model) on the
PrimeRL attention modules, reusing the Qwen3.5-MoE building blocks
(GatedDeltaNet, gated SDPA/flash attention, RMSNorm, rotary embedding)
so ring/ulysses CP substitution patches the dense and MoE models
consistently:

- New models/qwen3_5 package: decoder layer dispatching on
  layer_types (linear_attention / full_attention), flash varlen
  cu_seqlens from position_ids, identity state-dict conversion
  (dense HF layout matches PrimeRL layout).
- Shared normalize_qwen3_5_attn_implementation on the MoE module
  (eager→sdpa, kernels-community/vllm-flash-attn3→flash_attention_3),
  consumed by both models' attention factories and
  _check_and_adjust_attn_implementation.
- Register Qwen3_5TextConfig / Qwen3_5ForCausalLM in AutoConfig and
  the custom causal-LM mapping; hook dense Qwen3_5GatedFlashAttention
  into substitute_ring_attn / substitute_ulysses_attn.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 18:55:35 -07:00
1877714656 exp: search + terminal ablations (#2915)
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
* exp: GLM-4.5-Air RL configs for the search + terminal env domains

Two self-contained 2-train + 4-infer-node configs (configs/glm45air_search_terminal/) mirroring
configs/debug/v1/glm45air_scaleswe.toml (glm4_moe router replay, glm-4.5 renderer, cp=8 ulysses,
muon, LM-head chunking, AC/offload), with GRPO + linear length penalty, the rlm harness, and the
prime runtime for every env under a single per-run label:

- search.toml (label glm45air-search): rlm `search` skill; train deepdive-v1 / papersearchqa-v1
  (split=train) / wideseek-v1 (split=hybrid), eval browsecomp-v1 / openseeker-v1 / redsearcher-v1.
- terminal.toml (label glm45air-terminal): rlm ipython; train scaleswe-v1 / r2e-gym-v1, eval
  swebench-verified-v1 (use_prime_registry) / swebench-pro-v1 / terminal-bench-2-v1.

Both validate via RLConfig.model_validate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: correct search/terminal env sets

- search: openseeker-v1 + redsearcher-v1 are train sources (move from eval); deepdive stays train
  (qa_rl; no held-out eval split). Eval is browsecomp-v1.
- terminal: SWE (scaleswe/r2e-gym) is a separate domain — train on the terminal sets instead
  (openthoughts-tblite-v1 = terminal-bench-lite, uuid-ctf-v1 = synthetic forensic CTF). Keep the
  sandbox-benchmark evals (terminal-bench-2-v1 primary; swebench-verified/pro as references).

Both pass RLConfig.model_validate; all env ids are locked in pyproject.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: full eval at avg@1 (drop num_examples/group_size caps); terminal evals tb2 only

Eval blocks now use the defaults (num_examples=-1 → all, group_size=1 → avg@1). Terminal evals on
terminal-bench-2-v1 only for now (dropped the swebench-verified/pro cross-domain evals).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: bump verifiers to forward_env; forward SERPER_API_KEY on search envs

Bump deps/verifiers 62ba2212 -> 842f6b18 (verifiers main incl. forward_env on
HarnessConfig) and set forward_env = ["SERPER_API_KEY"] on every search harness,
so the rlm search skill gets the key inside the prime sandbox. SERPER_API_KEY must
be exported in the launch environment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: consolidate glm45air configs under configs/glm45air/; 131k ctx, node-local caches

Move search/terminal configs into configs/glm45air/ alongside swe.toml (rebased
from exp/scaleswe-lp). All three: seq_len/max_model_len -> 131072; drop default
inference args (gpu_memory_utilization, enable_prefix_caching) and eval
skip_first_step; node-local caches (/tmp/.{vllm,triton,flashinfer}-cache-$(whoami)).
search/terminal get the linear length penalty at 0.1 on all three terms.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: terminal-lego train env + Qwen3-235B judge for search envs

- terminal.toml: train env -> terminal-lego-v1 (drops openthoughts-tblite + uuid-ctf);
  eval stays terminal-bench-2-v1 only.
- research-environments submodule -> feat/terminal-lego-v1-port (adds terminal-lego-v1);
  registered in pyproject envs extra + tool.uv.sources; uv.lock updated.
- search.toml: judge -> Qwen/Qwen3-235B-A22B-Instruct-2507 (temperature 0) on all six
  search envs (judge client already defaults to PI inference).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: add papersearchqa held-out test eval, cap large evals at 500, drop default project_dir

- search.toml: add papersearchqa `test` split as an eval env (held-out signal);
  cap browsecomp (1266) and papersearchqa-test (5000) evals at num_examples=500.
- drop `project_dir = "."` from all three configs (it is the SlurmConfig default).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: split wandb projects (search-ablations / terminal-ablations); drop stale length-penalty comment

- search.toml -> wandb project "search-ablations"; terminal.toml -> "terminal-ablations".
- remove the stale "GRPO + linear length penalty (... default weights)" comment (weights are 0.1).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: static node-local cache dirs (drop $(whoami))

inference.env_vars are passed literally to vLLM (not shell-expanded), so
"$(whoami)" landed verbatim in the FlashInfer ninja build path and broke it
("bad $-escape"), disabling the allreduce-norm fusion. Nodes are exclusive, so
per-user suffixes are unnecessary: use static /tmp/.{vllm,triton,flashinfer}-cache.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: search judge uses default sampling (drop temperature=0 override)

Remove sampling={temperature=0} from the Qwen3-235B judge on all search envs;
keep the model override, let the judge use its default sampling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: search+terminal batch_size 256->512, max_inflight 512->768

Raise per-step batch (256->512 groups) and inflight-rollout concurrency
cap (512->768) for both glm45air search and terminal ablations. The
prior 512 cap sat ~42% utilized under the weight-sync barrier, so lift
concurrency and grow the batch to keep inference busier per step.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: search v2 run — job/wandb name glm45air-search-v2

Fresh search ablation from step 0 on the pulled branch (vLLM 0.24 +
dispatch-gate fixes) with the new 512 batch / 768 inflight config.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: hardcode prime sandbox cleanup label in glm45air configs

Decouple pre_run_command's sandbox-delete label from $SLURM_JOB_NAME and
pin it to each run's harness label. Fixes search.toml, where job_name
(glm45air-search-v2) diverged from the harness label (glm45air-search),
so pre-run cleanup targeted a label no sandbox carried.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: search v2 — train openseeker+redsearcher, eval browsecomp, batch 256 / concurrency 512

Trim search train set to openseeker + redsearcher and eval to browsecomp
only. Drop orchestrator batch_size 512->256 and max_inflight_rollouts
768->512 to match the swe runs (was over-driving inference).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp: search v3 — rlm auto-compaction (train draw 65536-131072 per task, eval fixed 98304)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* exp: terminal train on tmax-v1; eval swebench-verified + terminal-bench-2

- swap terminal train env terminal-lego -> tmax-v1 (TMax Harbor taskset)
- eval both swebench-verified and terminal-bench-2 every 20 steps
- bump research-environments to latest main (adds the tmax-v1 taskset)
- bump verifiers to origin/main (dev422), required by latest research-envs
  (browsecomp-v1 + others now pin verifiers>=0.1.15.dev422)
- register tmax-v1 in pyproject envs + sources; relock

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* exp: search v3 — migrate judge config to plugged judges list (post vf-bump schema)

openseeker/redsearcher: taskset.judge is gone; declare [[taskset.judges]] reference
entries (reward key 'correct', A/B verdicts, Qwen3-235B judge model). Note the
taskset-plugged BC-style prompt is replaced by the reference judge's stock prompt.
browsecomp keeps its taskset.judge field (still valid on BrowseCompConfig).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* exp: terminal v2 — bump job + wandb name to glm45air-terminal-v2

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* exp: keep base run names in configs — version suffix goes on the launch CLI

(--slurm.job-name / --wandb.name, e.g. glm45air-search-v3)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* exp(glm45air): terminal + search ablation config updates

terminal:
- terminal-bench-2 eval at avg@4 (group_size=4)
- add weight-0 rlm + swe rubric monitors (GLM-5.2 judge) on train + eval envs
- drop length penalty on output tokens (input/turns kept)
- run prime runtime as micro-VM (vm=true)

search:
- add weight-0 rlm rubric monitor (GLM-5.2 judge) on train + eval envs
- drop length penalty on turns + output tokens (input kept)
- run prime runtime as micro-VM (vm=true)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp(glm45air): trim header comment blocks from search + terminal configs

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp(glm45air): drop tmax taskset inline comment

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp(glm45air): disable idle_timeout on vm prime runtimes

The Prime API rejects idle_timeout_minutes for VM sandboxes (HTTP 422),
and the prime runtime defaults idle_timeout to 1h. A debug eval rollout on
scaleswe-v1 + swebench-verified-v1 (vm=true, use_prime_registry) failed at
provisioning until idle_timeout was cleared. Set idle_timeout = "None" on
every vm=true prime runtime (coerced to None; VM lifetime stays bounded by
timeout_minutes). Re-ran both envs: VM provisions, image pulls from the
prime registry, rollout runs to the 10-turn cap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp(glm45air): run swe config on prime micro-VM

Match the terminal/search ablations: run scaleswe train + swebench-verified
eval on vm=true prime runtimes with idle_timeout = "None" (the Prime API
rejects idle_timeout_minutes for VM sandboxes). Also set use_prime_registry
on the scaleswe taskset so its image resolves from the Prime platform
registry (pullable on the VM), matching swebench-verified.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* exp(glm45air): comment out rlm/swe rubric monitors (vm-only test)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: register tmax-v1 taskset in pyproject

The terminal ablation config references the tmax-v1 taskset, but the
package was never added to the envs extra, so config loading failed
with ModuleNotFoundError.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* exp: align swe/terminal ablation configs with search

- swe: length penalty on input tokens + turns only (drop output-token
  term), matching terminal
- terminal: batch_size 256 / max_inflight_rollouts 512, matching
  swe and search
- swe + terminal: rlm auto-compaction like search — train draws a
  per-task threshold in [65536, 131072], eval compacts at 98304

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 17:26:59 -07:00
30 changed files with 975 additions and 114 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ max_completion_tokens = 768
[[orchestrator.train.env]]
name = "alphabet-sort"
taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, power_per_turn = false }
taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
harness = { id = "null", runtime = { type = "subprocess" } }
[inference] # Default inference config
+1 -1
View File
@@ -41,7 +41,7 @@ name = "qwen3"
[[orchestrator.train.env]]
# v1 general-agent solver taskset; the tool server is colocated in the harness's modal sandbox.
taskset = { id = "general-agent-v1", tools = { colocated = true } }
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } } }
harness = { id = "null", runtime = { type = "modal" } }
[inference]
+177
View File
@@ -0,0 +1,177 @@
# exp: GLM-4.5-Air (100B MoE) RL across our v1 SEARCH-domain envs — bring-your-own-search QA, run
# through the rlm harness (its built-in `search` skill) on a prime sandbox. GRPO + linear length
# penalty. 2 train + 4 infer nodes. Single run label (glm45air-search) for all envs.
max_steps = 1000
seq_len = 131072
# Redirect compile/JIT caches to node-local /tmp (per user + job) to avoid contended shared-FS caches.
[env_vars]
TRITON_CACHE_DIR = "/tmp/.triton-cache"
[slurm]
job_name = "glm45air-search"
partition = "all"
# Clean up this run's orphaned prime sandboxes before launch (hardcoded label, matches the harness labels below).
pre_run_command = 'timeout 120 prime sandbox delete --label "glm45air-search" -y || true'
[deployment]
type = "multi_node"
num_train_nodes = 2
num_infer_nodes = 1
num_infer_replicas = 4
[wandb]
project = "search-ablations"
name = "glm45air-search"
[weight_broadcast]
type = "nccl"
timeout = 3600
[ckpt]
interval = 50
keep_last = 1
resume_step = -1
[model]
name = "zai-org/GLM-4.5-Air"
# --- Trainer ---
[trainer]
dist_timeout_seconds = 3600
enable_router_replay = true
[trainer.model]
impl = "custom"
attn = "flash_attention_3"
cp = 8
cp_style = "ulysses"
fused_lm_head_token_chunk_size = 1024
optim_cpu_offload = true
[trainer.model.ac]
[trainer.model.ac_offloading]
max_inflight_activations = 1
[trainer.model.compile]
[trainer.ckpt]
skip_gather_master_weights = true
skip_optimizer = true
[trainer.optim]
type = "muon"
# --- Orchestrator ---
[orchestrator]
batch_size = 256
group_size = 16
max_off_policy_steps = 32
max_inflight_rollouts = 512
[orchestrator.renderer]
name = "glm-4.5"
thinking_retention = "all"
[orchestrator.algo]
type = "grpo"
[orchestrator.algo.length_penalty]
type = "linear"
num_output_tokens_weight = 0.0
num_input_tokens_weight = 0.1
num_turns_weight = 0.0
[orchestrator.prime_monitor]
# --- Train: the search envs with usable training data (rlm `search` skill, prime sandbox) ---
# openseeker/redsearcher pre-plug a `reference` judge; declaring `judges` here replaces that
# entry wholesale (keep `name`/`question_field`/`choices` in sync with the taskset defaults —
# the plugged BC-style prompt is replaced by the reference judge's stock prompt).
[[orchestrator.train.env]]
name = "openseeker"
harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] } }
[orchestrator.train.env.taskset]
id = "openseeker-v1"
[[orchestrator.train.env.taskset.task.judges]]
id = "reference"
name = "correct"
model = "Qwen/Qwen3-235B-A22B-Instruct-2507"
question_field = "question"
choices = ["A", "B"]
# # Metric-only monitor (weight 0): rlm harness-mechanics rubric, judged by GLM-5.2.
# [[orchestrator.train.env.taskset.task.judges]]
# id = "rubric"
# name = "rlm"
# path = "deps/research-environments/rubrics/rlm.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
[[orchestrator.train.env]]
name = "redsearcher"
harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] } }
[orchestrator.train.env.taskset]
id = "redsearcher-v1" # optional `difficulty` filter (easy/medium/hard)
[[orchestrator.train.env.taskset.task.judges]]
id = "reference"
name = "correct"
model = "Qwen/Qwen3-235B-A22B-Instruct-2507"
question_field = "question"
choices = ["A", "B"]
# # Metric-only monitor (weight 0): rlm harness-mechanics rubric, judged by GLM-5.2.
# [[orchestrator.train.env.taskset.task.judges]]
# id = "rubric"
# name = "rlm"
# path = "deps/research-environments/rubrics/rlm.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
# --- Eval: BrowseComp held-out test, every 20 steps (incl. step 0) ---
[orchestrator.eval]
interval = 20
[[orchestrator.eval.env]]
name = "browsecomp"
num_examples = 500 # full set is 1266; cap eval at 500
harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] } }
timeout = { rollout = 3600 }
[orchestrator.eval.env.taskset]
id = "browsecomp-v1"
task = { judge = { model = "Qwen/Qwen3-235B-A22B-Instruct-2507" } }
# # Metric-only monitor (weight 0): rlm harness-mechanics rubric, judged by GLM-5.2.
# [[orchestrator.eval.env.taskset.task.judges]]
# id = "rubric"
# name = "rlm"
# path = "deps/research-environments/rubrics/rlm.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
# --- Inference ---
[inference]
enable_return_routed_experts = true
# vLLM + FlashInfer caches on node-local /tmp.
[inference.env_vars]
VLLM_CACHE_ROOT = "/tmp/.vllm-cache"
FLASHINFER_WORKSPACE_BASE = "/tmp/.flashinfer-cache"
[inference.model]
max_model_len = 131072
[inference.parallel]
tp = 8
+15 -19
View File
@@ -3,9 +3,9 @@
# the routed-expert decisions returned by inference via enable_return_routed_experts) — GLM-4.5-Air is
# a glm4_moe model, which supports routed_experts.
#
# GRPO uses the linear length penalty with the output-token, input-token, and turns coefficients all
# set to 0.1. Each term is pass_rate-scaled and normalized by the group's own max before the GRPO
# baseline subtraction.
# GRPO uses the linear length penalty with the input-token and turns coefficients set to 0.1. Each
# term is pass_rate-scaled and normalized by the group's own max before the GRPO baseline
# subtraction.
#
# 2 train + 4 infer nodes. Trainer uses cp=8 (ulysses) plus
# the memory improvements from the GLM-5.1 prod run (research-prod rlm5/prod.toml): LM-head token
@@ -14,19 +14,18 @@
# configs/debug/v1/scaleswe.toml + GLM-4.5-Air model settings from the int5 opencode configs.
max_steps = 1000
seq_len = 65536
seq_len = 131072
# Redirect compile/JIT caches to node-local /tmp (per user + job) to avoid
# slow/contended shared-FS caches and FS lock deadlocks.
[env_vars]
TRITON_CACHE_DIR = "/tmp/triton-cache-$USER-$SLURM_JOB_ID"
TRITON_CACHE_DIR = "/tmp/.triton-cache"
[slurm]
job_name = "glm45air-swe"
project_dir = "."
partition = "all"
# Clean up this run's orphaned prime sandboxes before launch (label == SLURM job name).
pre_run_command = 'timeout 120 prime sandbox delete --label "$SLURM_JOB_NAME" -y || true'
# Clean up this run's orphaned prime sandboxes before launch (hardcoded label, matches the harness labels below).
pre_run_command = 'timeout 120 prime sandbox delete --label "glm45air-swe" -y || true'
[deployment]
type = "multi_node"
@@ -89,9 +88,9 @@ max_inflight_rollouts = 512
[orchestrator.algo]
type = "grpo"
# Linear length penalty at coef 0.1 on all three terms (output tokens, input tokens, turns).
[orchestrator.algo.length_penalty]
num_output_tokens_weight = 0.1
type = "linear"
num_output_tokens_weight = 0.0
num_input_tokens_weight = 0.1
num_turns_weight = 0.1
@@ -101,8 +100,8 @@ thinking_retention = "all"
[[orchestrator.train.env]]
name = "scaleswe"
taskset = { id = "scaleswe-v1" }
harness = { id = "rlm", runtime = { type = "prime", labels = ["glm45air-swe"] } }
taskset = { id = "scaleswe-v1", use_prime_registry = true }
harness = { id = "rlm", summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] } }
[orchestrator.prime_monitor]
@@ -110,28 +109,25 @@ harness = { id = "rlm", runtime = { type = "prime", labels = ["glm45air-swe"] }
[orchestrator.eval]
interval = 20
skip_first_step = false
[[orchestrator.eval.env]]
name = "swebench-verified"
taskset = { id = "swebench-verified-v1", use_prime_registry = true }
harness = { id = "rlm", runtime = { type = "prime", labels = ["glm45air-swe"] } }
harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] } }
timeout = { rollout = 3600 }
# --- Inference ---
[inference]
gpu_memory_utilization = 0.85
enable_prefix_caching = true
enable_return_routed_experts = true
# vLLM + FlashInfer caches on node-local /tmp (see [env_vars]).
[inference.env_vars]
VLLM_CACHE_ROOT = "/tmp/.vllm_cache_$(whoami)"
FLASHINFER_WORKSPACE_BASE = "/tmp/flashinfer-$(whoami)"
VLLM_CACHE_ROOT = "/tmp/.vllm-cache"
FLASHINFER_WORKSPACE_BASE = "/tmp/.flashinfer-cache"
[inference.model]
max_model_len = 65536
max_model_len = 131072
[inference.parallel]
tp = 8
+181
View File
@@ -0,0 +1,181 @@
# exp: GLM-4.5-Air (100B MoE) RL across our v1 TERMINAL-domain envs — agentic shell/sandbox tasks
# run through the rlm harness (ipython-only) on a prime sandbox. Each task ships its own Docker image
# (NEEDS_CONTAINER) injected into the sandbox; grading is host-side inside the container. GRPO +
# linear length penalty. 2 train + 4 infer nodes. Single run label (glm45air-terminal) for all envs.
max_steps = 1000
seq_len = 131072
# Redirect compile/JIT caches to node-local /tmp (per user + job) to avoid contended shared-FS caches.
[env_vars]
TRITON_CACHE_DIR = "/tmp/.triton-cache"
[slurm]
job_name = "glm45air-terminal"
partition = "all"
# Clean up this run's orphaned prime sandboxes before launch (hardcoded label, matches the harness labels below).
pre_run_command = 'timeout 120 prime sandbox delete --label "glm45air-terminal" -y || true'
[deployment]
type = "multi_node"
num_train_nodes = 2
num_infer_nodes = 1
num_infer_replicas = 4
[wandb]
project = "terminal-ablations"
name = "glm45air-terminal"
[weight_broadcast]
type = "nccl"
timeout = 3600
[ckpt]
interval = 50
keep_last = 1
resume_step = -1
[model]
name = "zai-org/GLM-4.5-Air"
# --- Trainer ---
[trainer]
dist_timeout_seconds = 3600
enable_router_replay = true
[trainer.model]
impl = "custom"
attn = "flash_attention_3"
cp = 8
cp_style = "ulysses"
fused_lm_head_token_chunk_size = 1024
optim_cpu_offload = true
[trainer.model.ac]
[trainer.model.ac_offloading]
max_inflight_activations = 1
[trainer.model.compile]
[trainer.ckpt]
skip_gather_master_weights = true
skip_optimizer = true
[trainer.optim]
type = "muon"
# --- Orchestrator ---
[orchestrator]
batch_size = 256
group_size = 16
max_off_policy_steps = 32
max_inflight_rollouts = 512
[orchestrator.renderer]
name = "glm-4.5"
thinking_retention = "all"
[orchestrator.algo]
type = "grpo"
[orchestrator.algo.length_penalty]
type = "linear"
num_output_tokens_weight = 0.0
num_input_tokens_weight = 0.1
num_turns_weight = 0.1
[orchestrator.prime_monitor]
# --- Train: tmax (per-task Docker image in a prime sandbox, rlm ipython) ---
[[orchestrator.train.env]]
name = "tmax"
harness = { id = "rlm", summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
[orchestrator.train.env.taskset]
id = "tmax-v1"
# # Metric-only monitors (weight 0): rlm harness-mechanics + swe code-usage rubrics, judged by GLM-5.2.
# [[orchestrator.train.env.taskset.judges]]
# id = "rubric"
# name = "rlm"
# path = "deps/research-environments/rubrics/rlm.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
# [[orchestrator.train.env.taskset.judges]]
# id = "rubric"
# name = "swe"
# path = "deps/research-environments/rubrics/swe.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
# --- Eval: swebench-verified (avg@1) + terminal-bench-2 (full, avg@4) every 20 steps, incl. step 0 ---
[orchestrator.eval]
interval = 20
[[orchestrator.eval.env]]
name = "swebench-verified"
harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
timeout = { rollout = 3600 }
[orchestrator.eval.env.taskset]
id = "swebench-verified-v1"
use_prime_registry = true
# [[orchestrator.eval.env.taskset.judges]]
# id = "rubric"
# name = "rlm"
# path = "deps/research-environments/rubrics/rlm.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
# [[orchestrator.eval.env.taskset.judges]]
# id = "rubric"
# name = "swe"
# path = "deps/research-environments/rubrics/swe.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
[[orchestrator.eval.env]]
name = "terminal-bench-2"
group_size = 4 # avg@4
harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
timeout = { rollout = 3600 }
[orchestrator.eval.env.taskset]
id = "terminal-bench-2-v1"
# [[orchestrator.eval.env.taskset.judges]]
# id = "rubric"
# name = "rlm"
# path = "deps/research-environments/rubrics/rlm.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
# [[orchestrator.eval.env.taskset.judges]]
# id = "rubric"
# name = "swe"
# path = "deps/research-environments/rubrics/swe.toml"
# model = "zai-org/GLM-5.2"
# weight = 0.0
# --- Inference ---
[inference]
enable_return_routed_experts = true
# vLLM + FlashInfer caches on node-local /tmp.
[inference.env_vars]
VLLM_CACHE_ROOT = "/tmp/.vllm-cache"
FLASHINFER_WORKSPACE_BASE = "/tmp/.flashinfer-cache"
[inference.model]
max_model_len = 131072
[inference.parallel]
tp = 8
+1 -1
+2
View File
@@ -122,6 +122,7 @@ envs = [
"swelego-v1",
"tau2-bench-v1",
"terminal-bench-2-v1",
"tmax-v1",
"unscramble-v1",
"uuid-ctf-v1",
"verbatim-copy-v1",
@@ -295,6 +296,7 @@ swebench-verified-v1 = { path = "deps/research-environments/environments/swe/swe
swelego-v1 = { path = "deps/research-environments/environments/swe/swelego_v1", editable = true }
tau2-bench-v1 = { path = "deps/research-environments/environments/tau2_bench_v1", editable = true }
terminal-bench-2-v1 = { path = "deps/research-environments/environments/terminal_bench_2_v1", editable = true }
tmax-v1 = { path = "deps/research-environments/environments/tmax_v1", editable = true }
unscramble-v1 = { path = "deps/research-environments/environments/unscramble_v1", editable = true }
uuid-ctf-v1 = { path = "deps/research-environments/environments/uuid_ctf_v1", editable = true }
verbatim-copy-v1 = { path = "deps/research-environments/environments/verbatim_copy_v1", editable = true }
+2 -2
View File
@@ -53,11 +53,11 @@ class OPSDAlgorithm(Algorithm):
def _demonstration(self, rollout: Rollout) -> str:
demonstration = rollout.info.get(self.demo_key)
if demonstration is None:
demonstration = getattr(rollout.task, self.demo_key, None)
demonstration = getattr(rollout.task.data, self.demo_key, None)
if demonstration is None:
raise ValueError(
f"opsd requires '{self.demo_key}' in the trace info dict or on the task "
f"(env '{rollout.env_name}', task {rollout.task.idx})."
f"(env '{rollout.env_name}', task {rollout.task.data.idx})."
)
return demonstration
+14 -2
View File
@@ -3,6 +3,9 @@
from __future__ import annotations
import contextlib
import os
import tempfile
import time
from dataclasses import asdict
from pathlib import Path
@@ -27,8 +30,17 @@ class CheckpointManager:
ckpt_path = self.get_ckpt_path(step)
ckpt_path.mkdir(parents=True, exist_ok=True)
start = time.perf_counter()
with open(ckpt_path / "progress.pt", "wb") as f:
torch.save({"progress": progress}, f)
# Save to a temporary file and do an atomic rename, to avoid corrupting the last
# file if the process gets killed while writing
fd, tmp_name = tempfile.mkstemp(dir=ckpt_path, prefix="progress.pt.", suffix=".tmp")
try:
with os.fdopen(fd, "wb") as f:
torch.save({"progress": progress}, f)
os.replace(tmp_name, ckpt_path / "progress.pt")
except BaseException:
with contextlib.suppress(OSError):
os.unlink(tmp_name)
raise
get_logger().debug(
f"Orchestrator checkpoint saved to {ckpt_path} in {format_time(time.perf_counter() - start)}"
)
+6 -3
View File
@@ -506,7 +506,10 @@ class RolloutDispatcher:
except Exception as exc:
get_logger().warning(f"Rollout task failed in group {meta.group_id} ({meta.env_name}): {exc!r}")
task_idx = group.task_idx if group is not None else -1
rollouts = [Rollout(task=vf.Task(idx=task_idx, prompt=None)) for _ in range(meta.rollout_count)]
rollouts = [
Rollout(task=vf.TraceTask(type="Task", data=vf.TaskData(idx=task_idx, prompt=None)))
for _ in range(meta.rollout_count)
]
for r in rollouts:
r.capture_error(exc)
is_synth_exception = True
@@ -574,7 +577,7 @@ class RolloutDispatcher:
for _, meta in claimed:
for _ in range(meta.rollout_count):
trace = Rollout(
task=vf.Task(idx=task_idx, prompt=None),
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=task_idx, prompt=None)),
errors=[vf.Error(type="Cancelled", message="Off-policy cancel")],
stop_condition="error",
)
@@ -600,7 +603,7 @@ class RolloutDispatcher:
unscheduled_cancelled = group.rollouts_to_schedule
for _ in range(unscheduled_cancelled):
trace = Rollout(
task=vf.Task(idx=task_idx, prompt=None),
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=task_idx, prompt=None)),
errors=[vf.Error(type="Cancelled", message="Off-policy cancel")],
stop_condition="error",
)
+5 -5
View File
@@ -5,12 +5,12 @@ external one given by ``config.address``) and an ``EnvClient`` to drive it. The
orchestrator never *runs* an environment: it asks the server for ``info``
(``num_tasks`` + whether group scoring is needed), then runs rollouts purely by
**task index**. The server returns a ``Trace`` (a plain ``model_dump`` — derived values are
properties, not serialized) which we validate into a ``Trace[WireTask]`` — a real ``vf.Trace``
properties, not serialized) which we validate into a ``Trace[WireTaskData]`` — a real ``vf.Trace``
(never a loose dict) whose task keeps the env's
task-specific fields as extras (``WireTask`` allows them). The orchestrator never imports the
task-specific fields as extras (``WireTaskData`` allows them). The orchestrator never imports the
env package: the env's *type* and *runtime* both live only in the server, and the orchestrator
drives it purely by task index. (Nothing here reads typed env task fields — only ``task.idx``
and a full ``task.model_dump``, both of which ``WireTask`` preserves.)
and a full ``task.model_dump``, both of which ``WireTaskData`` preserves.)
"""
from __future__ import annotations
@@ -35,10 +35,10 @@ from prime_rl.orchestrator.sampler import Sampler
from prime_rl.orchestrator.types import Rollout
from prime_rl.utils.logger import get_logger
# Every wire trace validates into this type. WireTask (extra="allow") keeps the env's task
# Every wire trace validates into this type. WireTaskData (extra="allow") keeps the env's task
# fields without importing the env package — the orchestrator never reads them typed (only
# task.idx + task.model_dump).
ROLLOUT_TYPE = Rollout[vf.WireTask]
ROLLOUT_TYPE = Rollout[vf.WireTaskData]
# Max wait for a spawned env server to bind and report its address. The child
# loads the taskset (possibly downloading a dataset) before reporting, so this
+1 -1
View File
@@ -96,7 +96,7 @@ class EvalSink:
if not group:
return
env_name = group[0].env_name
task_idx = group[0].task.idx
task_idx = group[0].task.data.idx
eval_step = group[0].eval_step
bucket = self.pending_batches[(env_name, eval_step)]
bucket.extend(group)
+10 -1
View File
@@ -814,9 +814,18 @@ class Orchestrator:
are 1-indexed while policy versions stay 0-indexed, so the shipped-batch
count is ``progress.step - 1``."""
lead = (self.progress.step - 1) - self.policy.version
# The trainer skips the final NCCL weight broadcast (inference group is
# torn down), so policy.version never reaches the last step. Without this
# the gate deadlocks waiting for a version that will never be published.
# The last batch uses the penultimate policy anyway, so let it through.
building_final_batch_nccl = (
self.config.weight_broadcast.type == "nccl"
and self.config.max_steps is not None
and self.progress.step >= self.config.max_steps - 1
)
gate = self.dispatcher.dispatch_allowed
was_set = gate.is_set()
if lead > TARGET_LAG:
if lead > TARGET_LAG and not building_final_batch_nccl:
if was_set:
get_logger().info(
"Pausing dispatcher to prevent orchestrator from racing from trainer. Waiting for new policy..."
+1 -1
View File
@@ -160,7 +160,7 @@ class TrainSink:
if not group:
return
env_name = group[0].env_name
task_idx = group[0].task.idx
task_idx = group[0].task.data.idx
survivors = [r for r in group if not r.has_error]
num_errored = len(group) - len(survivors)
+2 -2
View File
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Generic, Literal, Protocol
import verifiers.v1 as vf
from pydantic import ConfigDict, Field
from verifiers.v1.task import TaskT
from verifiers.v1.task import DataT
from prime_rl.transport import TrainingSample
@@ -69,7 +69,7 @@ class GroupState:
policy_version_at_start: int = 0
class Rollout(vf.Trace[TaskT], Generic[TaskT]):
class Rollout(vf.Trace[DataT], Generic[DataT]):
"""A completed rollout: the env's typed ``vf.Trace`` *is* the rollout — prime-rl's
orchestration metadata lives on it directly (set by the dispatcher once the rollout
returns), so there's no wrapper. Train vs eval is the ``kind`` discriminator. All metadata
+4
View File
@@ -8,6 +8,7 @@ from transformers.models.auto.auto_factory import _BaseAutoModelClass, _LazyAuto
from transformers.models.auto.configuration_auto import CONFIG_MAPPING_NAMES
from transformers.models.llama.configuration_llama import LlamaConfig
from transformers.models.qwen3.configuration_qwen3 import Qwen3Config
from transformers.models.qwen3_5.configuration_qwen3_5 import Qwen3_5TextConfig
from prime_rl.trainer.models.afmoe import AfmoeConfig, AfmoeForCausalLM
from prime_rl.trainer.models.base import PreTrainedModelPrimeRL
@@ -20,6 +21,7 @@ from prime_rl.trainer.models.llama import LlamaForCausalLM
from prime_rl.trainer.models.minimax_m2 import MiniMaxM2Config, MiniMaxM2ForCausalLM
from prime_rl.trainer.models.nemotron_h import NemotronHConfig, NemotronHForCausalLM
from prime_rl.trainer.models.qwen3 import Qwen3ForCausalLM
from prime_rl.trainer.models.qwen3_5 import Qwen3_5ForCausalLM
from prime_rl.trainer.models.qwen3_5_moe import Qwen3_5MoeConfig, Qwen3_5MoeForCausalLM
from prime_rl.trainer.models.qwen3_moe import Qwen3MoeConfig, Qwen3MoeForCausalLM
@@ -31,6 +33,7 @@ AutoConfig.register("laguna", LagunaConfig, exist_ok=True)
AutoConfig.register("minimax_m2", MiniMaxM2Config, exist_ok=True)
AutoConfig.register("nemotron_h", NemotronHConfig, exist_ok=True)
AutoConfig.register("qwen3_moe", Qwen3MoeConfig, exist_ok=True)
AutoConfig.register("qwen3_5_text", Qwen3_5TextConfig, exist_ok=True)
AutoConfig.register("qwen3_5_moe_text", Qwen3_5MoeConfig, exist_ok=True)
# GptOssConfig is just HF's class - already registered by transformers, no override needed.
@@ -44,6 +47,7 @@ _CUSTOM_CAUSAL_LM_MAPPING.register(LagunaConfig, LagunaForCausalLM, exist_ok=Tru
_CUSTOM_CAUSAL_LM_MAPPING.register(MiniMaxM2Config, MiniMaxM2ForCausalLM, exist_ok=True)
_CUSTOM_CAUSAL_LM_MAPPING.register(NemotronHConfig, NemotronHForCausalLM, exist_ok=True)
_CUSTOM_CAUSAL_LM_MAPPING.register(Qwen3MoeConfig, Qwen3MoeForCausalLM, exist_ok=True)
_CUSTOM_CAUSAL_LM_MAPPING.register(Qwen3_5TextConfig, Qwen3_5ForCausalLM, exist_ok=True)
_CUSTOM_CAUSAL_LM_MAPPING.register(Qwen3_5MoeConfig, Qwen3_5MoeForCausalLM, exist_ok=True)
_CUSTOM_CAUSAL_LM_MAPPING.register(GptOssConfig, GptOssForCausalLM, exist_ok=True)
@@ -340,3 +340,7 @@ def substitute_ring_attn(
from prime_rl.trainer.models.qwen3_5_moe.modeling_qwen3_5_moe import Qwen3_5MoeGatedFlashAttention
Qwen3_5MoeGatedFlashAttention._compute_attention = _ring_compute_attention
from prime_rl.trainer.models.qwen3_5.modeling_qwen3_5 import Qwen3_5GatedFlashAttention
Qwen3_5GatedFlashAttention._compute_attention = _ring_compute_attention
@@ -189,6 +189,10 @@ def substitute_ulysses_attn(
Qwen3_5MoeGatedFlashAttention._compute_attention = _ulysses_compute_attention
from prime_rl.trainer.models.qwen3_5.modeling_qwen3_5 import Qwen3_5GatedFlashAttention
Qwen3_5GatedFlashAttention._compute_attention = _ulysses_compute_attention
def substitute_hf_ulysses_attn(process_group: dist.ProcessGroup) -> None:
"""Patch HF's `_flash_attention_forward` to use Ulysses all-to-all + local FA2.
@@ -0,0 +1,3 @@
from .modeling_qwen3_5 import Qwen3_5ForCausalLM, Qwen3_5Model, Qwen3_5PreTrainedModel
__all__ = ["Qwen3_5ForCausalLM", "Qwen3_5Model", "Qwen3_5PreTrainedModel"]
@@ -0,0 +1,305 @@
import functools
from typing import Optional, Union
import torch
from torch import Tensor, nn
from transformers.cache_utils import Cache
from transformers.generation import GenerationMixin
from transformers.modeling_layers import GradientCheckpointingLayer
from transformers.modeling_outputs import BaseModelOutputWithPast
from transformers.models.qwen3_5.configuration_qwen3_5 import Qwen3_5TextConfig
from transformers.models.qwen3_5.modeling_qwen3_5 import (
Qwen3_5PreTrainedModel as HFQwen3_5PreTrainedModel,
)
from transformers.processing_utils import Unpack
from transformers.utils import TransformersKwargs
from prime_rl.trainer.models.base import PreTrainedModelPrimeRL
from prime_rl.trainer.models.layers.lm_head import PrimeLmOutput
from prime_rl.trainer.models.layers.mlp import MLP, MLPConfig
from prime_rl.trainer.models.qwen3_5_moe.modeling_qwen3_5_moe import (
Qwen3_5MoeGatedAttentionConfig,
Qwen3_5MoeGatedDeltaNet,
Qwen3_5MoeGatedFlashAttention,
Qwen3_5MoeGatedSDPAAttention,
Qwen3_5MoeRMSNorm,
Qwen3_5MoeRotaryEmbedding,
normalize_qwen3_5_attn_implementation,
)
from prime_rl.utils.sequence import get_cu_seqlens_from_position_ids
class Qwen3_5GatedSDPAAttention(Qwen3_5MoeGatedSDPAAttention):
pass
class Qwen3_5GatedFlashAttention(Qwen3_5MoeGatedFlashAttention):
pass
QWEN35_ATTN_IMPL2CLASS = {
"sdpa": Qwen3_5GatedSDPAAttention,
"flash_attention_2": functools.partial(Qwen3_5GatedFlashAttention, flash_attn_version=2),
"flash_attention_3": functools.partial(Qwen3_5GatedFlashAttention, flash_attn_version=3),
"fa4": functools.partial(Qwen3_5GatedFlashAttention, flash_attn_version=4),
}
def _get_gated_attention(config: Qwen3_5TextConfig) -> nn.Module:
attn_config = Qwen3_5MoeGatedAttentionConfig(
hidden_size=config.hidden_size,
head_dim=config.head_dim,
num_attention_heads=config.num_attention_heads,
num_key_value_heads=config.num_key_value_heads,
rms_norm_eps=config.rms_norm_eps,
attention_bias=config.attention_bias,
attention_dropout=config.attention_dropout,
)
attn_impl = normalize_qwen3_5_attn_implementation(config._attn_implementation)
config._attn_implementation = attn_impl
if attn_impl not in QWEN35_ATTN_IMPL2CLASS:
supported = list(QWEN35_ATTN_IMPL2CLASS.keys())
raise ValueError(
f"Qwen3.5 attention does not support '{config._attn_implementation}'. "
f"Supported implementations: {supported}."
)
return QWEN35_ATTN_IMPL2CLASS[attn_impl](attn_config)
def _create_rotary_emb(config: Qwen3_5TextConfig) -> Qwen3_5MoeRotaryEmbedding:
return Qwen3_5MoeRotaryEmbedding(config)
class Qwen3_5DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Qwen3_5TextConfig, layer_idx: int):
super().__init__()
self.hidden_size = config.hidden_size
self.layer_type = config.layer_types[layer_idx]
if self.layer_type == "linear_attention":
self.linear_attn = Qwen3_5MoeGatedDeltaNet(config)
elif self.layer_type == "full_attention":
self.self_attn = _get_gated_attention(config)
else:
raise ValueError(f"Unsupported Qwen3.5 layer type: {self.layer_type}")
mlp_config = MLPConfig(
hidden_size=config.hidden_size,
intermediate_size=config.intermediate_size,
gate_act=config.hidden_act,
bias=False,
)
self.mlp = MLP(mlp_config)
self.input_layernorm = Qwen3_5MoeRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.post_attention_layernorm = Qwen3_5MoeRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
def forward(
self,
hidden_states: torch.Tensor,
position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
cu_seqlens: torch.LongTensor | None = None,
max_seqlen: int | None = None,
) -> torch.FloatTensor:
residual = hidden_states
hidden_states = self.input_layernorm(hidden_states)
if self.layer_type == "linear_attention":
hidden_states = self.linear_attn(hidden_states, cu_seqlens=cu_seqlens)
else:
hidden_states, _ = self.self_attn(
hidden_states=hidden_states,
position_embeddings=position_embeddings,
cu_seqlens=cu_seqlens,
max_seqlen=max_seqlen,
)
hidden_states = residual + hidden_states
residual = hidden_states
hidden_states = self.post_attention_layernorm(hidden_states)
hidden_states = self.mlp(hidden_states)
return residual + hidden_states
class Qwen3_5PreTrainedModel(PreTrainedModelPrimeRL, HFQwen3_5PreTrainedModel):
config_class = Qwen3_5TextConfig
base_model_prefix = "model"
supports_gradient_checkpointing = True
_no_split_modules = ["Qwen3_5DecoderLayer"]
_skip_keys_device_placement = ["past_key_values"]
_supports_flash_attn = True
_supports_sdpa = True
_supports_flex_attn = False
_supports_attention_backend = True
_can_compile_fullgraph = False
_can_record_outputs = {
"hidden_states": Qwen3_5DecoderLayer,
}
def _check_and_adjust_attn_implementation(
self, attn_implementation: str | None, is_init_check: bool = False, allow_all_kernels: bool = False
) -> str:
attn_impl = normalize_qwen3_5_attn_implementation(attn_implementation or "sdpa")
if attn_impl not in QWEN35_ATTN_IMPL2CLASS:
supported = list(QWEN35_ATTN_IMPL2CLASS.keys())
raise ValueError(
f"Qwen3.5 attention does not support '{attn_implementation}'. Supported implementations: {supported}."
)
return attn_impl
@classmethod
def is_hf_state_dict(cls, state_dict: dict[str, Tensor]) -> bool:
return True
@classmethod
def is_prime_state_dict(cls, state_dict: dict[str, Tensor]) -> bool:
return True
@classmethod
def convert_to_hf(cls, state_dict: dict[str, Tensor]) -> dict[str, Tensor]:
return state_dict
@classmethod
def convert_to_prime(cls, state_dict: dict[str, Tensor]) -> dict[str, Tensor]:
return state_dict
@classmethod
def convert_layer_to_hf(cls, state_dict: dict[str, Tensor], layer_idx: int) -> dict[str, Tensor]:
return state_dict
@classmethod
def convert_layer_to_prime(cls, state_dict: dict[str, Tensor], layer_idx: int) -> dict[str, Tensor]:
return state_dict
class Qwen3_5Model(Qwen3_5PreTrainedModel):
def __init__(self, config: Qwen3_5TextConfig):
config._attn_implementation = normalize_qwen3_5_attn_implementation(config._attn_implementation)
super().__init__(config)
self.padding_idx = config.pad_token_id
self.vocab_size = config.vocab_size
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
self.layers = nn.ModuleList(
[Qwen3_5DecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
)
self.norm = Qwen3_5MoeRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
self.rotary_emb = _create_rotary_emb(config)
self.gradient_checkpointing = False
self.post_init()
def forward(
self,
input_ids: Optional[torch.LongTensor] = None,
position_ids: Optional[torch.LongTensor] = None,
inputs_embeds: Optional[torch.FloatTensor] = None,
) -> BaseModelOutputWithPast:
if (input_ids is None) ^ (inputs_embeds is not None):
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
if inputs_embeds is None:
inputs_embeds = self.embed_tokens(input_ids)
if position_ids is None:
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device).unsqueeze(0)
flash_attn_enabled = self.config._attn_implementation in ("flash_attention_2", "flash_attention_3", "fa4")
if flash_attn_enabled:
cu_seqlens, max_seqlen = get_cu_seqlens_from_position_ids(position_ids)
torch._dynamo.mark_dynamic(cu_seqlens, 0)
else:
cu_seqlens = None
max_seqlen = None
hidden_states = inputs_embeds
position_embeddings = self.rotary_emb(hidden_states, position_ids)
for decoder_layer in self.layers:
hidden_states = decoder_layer(
hidden_states,
position_embeddings=position_embeddings,
cu_seqlens=cu_seqlens,
max_seqlen=max_seqlen,
)
hidden_states = self.norm(hidden_states)
return BaseModelOutputWithPast(last_hidden_state=hidden_states)
class Qwen3_5ForCausalLM(Qwen3_5PreTrainedModel, GenerationMixin):
_tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
_checkpoint_conversion_mapping = {}
_tp_plan = {"lm_head": "colwise_gather_output"}
_pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
def __init__(self, config, **kwargs):
super().__init__(config, **kwargs)
self.model = Qwen3_5Model(config)
self.vocab_size = config.vocab_size
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
self.post_init()
def get_input_embeddings(self):
return self.model.embed_tokens
def set_input_embeddings(self, value):
self.model.embed_tokens = value
def set_decoder(self, decoder):
self.model = decoder
def get_decoder(self):
return self.model
def forward(
self,
input_ids: Optional[torch.LongTensor] = None,
attention_mask: Optional[torch.Tensor] = None,
position_ids: Optional[torch.LongTensor] = None,
past_key_values: Optional[Cache] = None,
inputs_embeds: Optional[torch.FloatTensor] = None,
labels: Optional[torch.LongTensor] = None,
use_cache: Optional[bool] = None,
logits_to_keep: Union[int, torch.Tensor] = 0,
temperature: Union[torch.Tensor, None] = None,
**kwargs: Unpack[TransformersKwargs],
) -> PrimeLmOutput:
assert use_cache is None, "use_cache is not supported for custom qwen3_5 for now"
assert past_key_values is None, "past_key_values is not supported for custom qwen3_5 for now"
if position_ids is None:
if inputs_embeds is not None:
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device).unsqueeze(0)
elif input_ids is not None:
position_ids = torch.arange(input_ids.shape[1], device=input_ids.device).unsqueeze(0)
outputs = self.model(
input_ids=input_ids,
position_ids=position_ids,
inputs_embeds=inputs_embeds,
)
hidden_states = outputs.last_hidden_state
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
return self.lm_head(
hidden_states[:, slice_indices, :],
labels[:, slice_indices] if labels is not None else None,
temperature=temperature,
)
def init_buffers_post_meta(self):
lm_rope = self.model.rotary_emb
if hasattr(lm_rope, "rope_init_fn"):
inv_freq, lm_rope.attention_scaling = lm_rope.rope_init_fn(lm_rope.config, lm_rope.inv_freq.device)
lm_rope.inv_freq.copy_(inv_freq)
__all__ = [
"Qwen3_5ForCausalLM",
"Qwen3_5GatedFlashAttention",
"Qwen3_5Model",
"Qwen3_5PreTrainedModel",
]
@@ -551,6 +551,14 @@ QWEN35MOE_ATTN_IMPL2CLASS = {
}
def normalize_qwen3_5_attn_implementation(attn_impl: str) -> str:
if attn_impl == "eager":
return "sdpa"
if attn_impl == "kernels-community/vllm-flash-attn3":
return "flash_attention_3"
return attn_impl
# ---------------------------------------------------------------------------
# Decoder layer
# ---------------------------------------------------------------------------
@@ -567,9 +575,8 @@ def _get_gated_attention(config: Qwen3_5MoeConfig) -> nn.Module:
attention_dropout=config.attention_dropout,
)
attn_impl = config._attn_implementation
if attn_impl == "eager":
attn_impl = "sdpa"
attn_impl = normalize_qwen3_5_attn_implementation(config._attn_implementation)
config._attn_implementation = attn_impl
if attn_impl not in QWEN35MOE_ATTN_IMPL2CLASS:
supported = list(QWEN35MOE_ATTN_IMPL2CLASS.keys())
@@ -783,6 +790,17 @@ class Qwen3_5MoePreTrainedModel(PreTrainedModelPrimeRL):
"hidden_states": Qwen3_5MoeDecoderLayer,
}
def _check_and_adjust_attn_implementation(
self, attn_implementation: str | None, is_init_check: bool = False, allow_all_kernels: bool = False
) -> str:
attn_impl = normalize_qwen3_5_attn_implementation(attn_implementation or "sdpa")
if attn_impl not in QWEN35MOE_ATTN_IMPL2CLASS:
supported = list(QWEN35MOE_ATTN_IMPL2CLASS.keys())
raise ValueError(
f"Qwen3.5-MoE attention does not support '{attn_implementation}'. Supported implementations: {supported}."
)
return attn_impl
@classmethod
def is_hf_state_dict(cls, state_dict: dict[str, Tensor]) -> bool:
return any(
@@ -819,6 +837,7 @@ class Qwen3_5MoePreTrainedModel(PreTrainedModelPrimeRL):
class Qwen3_5MoeModel(Qwen3_5MoePreTrainedModel):
def __init__(self, config: Qwen3_5MoeConfig):
config._attn_implementation = normalize_qwen3_5_attn_implementation(config._attn_implementation)
super().__init__(config)
self.padding_idx = config.pad_token_id
self.vocab_size = config.vocab_size
+5 -2
View File
@@ -4,6 +4,7 @@ from pathlib import Path
from typing import Callable, Generator, cast
import torch
import torch.distributed as dist
import torch.nn as nn
from torch import Tensor
from torch.distributed.tensor import DTensor
@@ -200,7 +201,7 @@ class NCCLWeightBroadcast(WeightBroadcast):
# `_compute_notified_runs` is a pure function of SPMD-replicated state on
# multi_run_manager, so every trainer rank derives the same list. Only
# the master touches the filesystem to notify the orchestrator, but all
# ranks must wait on NCCL_READY before entering the broadcast path:
# ranks must wait for the inference pool before entering the broadcast path:
# the broadcast preparation (DTensor resolution, quantization) enqueues
# collectives on non-master ranks, and if those ranks start prep before
# the orchestrator has paused inference, the collectives sit unmatched
@@ -208,7 +209,9 @@ class NCCLWeightBroadcast(WeightBroadcast):
notified_runs = self._compute_notified_runs()
if self.world.is_master:
self._notify_orchestrator(notified_runs)
self._wait_for_nccl_ready(notified_runs)
self._wait_for_nccl_ready(notified_runs)
if self.world.world_size > 1:
dist.barrier()
self.nccl_broadcast_sender.broadcast_weights(model, step)
self.logger.debug(f"Weights broadcasted in {time.perf_counter() - start_time:.2f}s")
+4 -4
View File
@@ -225,8 +225,8 @@ class WandbMonitor(Monitor):
sample = {
"step": step,
"env_name": rollout.env_name,
"task": _loggable_task(trace.task),
"task_idx": trace.task.idx,
"task": _loggable_task(trace.task.data),
"task_idx": trace.task.data.idx,
"messages": self.tokenizer.decode(token_ids),
"input_ids": str(token_ids),
"reward": trace.reward,
@@ -263,8 +263,8 @@ class WandbMonitor(Monitor):
sample = {
"step": step,
"env": env_name,
"task": _loggable_task(trace.task),
"task_idx": trace.task.idx,
"task": _loggable_task(trace.task.data),
"task_idx": trace.task.data.idx,
"completion": completion,
"reward": trace.reward,
}
+2 -2
View File
@@ -82,8 +82,8 @@ def _build_rollout(
)
parent = len(nodes) - 1
rollout = Rollout[vf.Task](
task=vf.Task(idx=0, prompt=None),
rollout = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
nodes=nodes,
rewards={"reward": reward},
metrics=metrics or {},
+15 -3
View File
@@ -161,7 +161,9 @@ def _make_rollout(
samples: list[TrainingSample],
advantages: list[float] | None = None,
) -> Rollout:
rollout = Rollout(task=vf.Task(idx=0, prompt=None), nodes=[], rewards={}, env_name="test-env")
rollout = Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)), nodes=[], rewards={}, env_name="test-env"
)
rollout.samples = samples
rollout.advantages = advantages
return rollout
@@ -253,7 +255,12 @@ def _two_turn_rollout(observation_role: str = "tool") -> Rollout:
_node(obs_message, parent=1, sampled=False, token_ids=[5, 6]),
_node(AssistantMessage(content="A2"), parent=2, sampled=True, token_ids=[7, 8], logprobs=[-0.3, -0.4]),
]
rollout = Rollout(task=vf.Task(idx=0, prompt=None), nodes=nodes, rewards={"r": 1.0}, env_name="test-env")
rollout = Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
nodes=nodes,
rewards={"r": 1.0},
env_name="test-env",
)
rollout.samples = trace_to_samples(rollout, env_name="test-env")
return rollout
@@ -299,7 +306,12 @@ def test_echo_weights_only_content_tokens_when_is_content_present():
),
_node(AssistantMessage(content="A2"), parent=2, sampled=True, token_ids=[7, 8], logprobs=[-0.3, -0.4]),
]
rollout = Rollout(task=vf.Task(idx=0, prompt=None), nodes=nodes, rewards={"r": 1.0}, env_name="test-env")
rollout = Rollout(
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
nodes=nodes,
rewards={"r": 1.0},
env_name="test-env",
)
rollout.samples = trace_to_samples(rollout, env_name="test-env")
algo = _echo_algorithm() # tool bodies at 0.1
asyncio.run(algo.score_rollout(rollout))
+5 -3
View File
@@ -57,7 +57,9 @@ def _make_rollout(
]
else:
nodes = [_assistant_node(completion_ids, completion_logprobs)]
rollout = Rollout[vf.Task](task=vf.Task(idx=0, prompt=""), nodes=nodes, rewards={"reward": reward})
rollout = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt="")), nodes=nodes, rewards={"reward": reward}
)
rollout.env_name = "test"
rollout.group_id = uuid.uuid4()
return rollout
@@ -135,8 +137,8 @@ def test_gibberish_aligns_logprobs_under_generation_prompt_scaffold():
it; reading the aligned branch streams detects it."""
gibberish_filter = _make_gibberish_filter()
rollout = Rollout[vf.Task](
task=vf.Task(idx=0, prompt=""),
rollout = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt="")),
nodes=[_scaffold_assistant_node([50, 80, 120_000], [-1.0, -0.5, gibberish_filter.logprob_threshold - 1.0])],
rewards={"reward": 1.0},
)
+110
View File
@@ -0,0 +1,110 @@
import inspect
from unittest.mock import MagicMock
import pytest
import torch
from transformers.models.qwen3_5.configuration_qwen3_5 import Qwen3_5TextConfig
from transformers.models.qwen3_5.modeling_qwen3_5 import Qwen3_5ForCausalLM as HFQwen3_5ForCausalLM
from prime_rl.trainer.models.layers.attn import FlashAttention, substitute_ring_attn
from prime_rl.trainer.models.qwen3_5 import Qwen3_5ForCausalLM, Qwen3_5Model
from prime_rl.trainer.models.qwen3_5.modeling_qwen3_5 import Qwen3_5GatedFlashAttention
from prime_rl.trainer.models.qwen3_5_moe import Qwen3_5MoeConfig
def _tiny_text_config(attn_impl: str = "sdpa") -> Qwen3_5TextConfig:
config = Qwen3_5TextConfig(
vocab_size=128,
hidden_size=64,
intermediate_size=128,
num_hidden_layers=2,
layer_types=["linear_attention", "full_attention"],
num_attention_heads=4,
num_key_value_heads=2,
head_dim=16,
max_position_embeddings=128,
linear_key_head_dim=8,
linear_value_head_dim=8,
linear_num_key_heads=4,
linear_num_value_heads=8,
linear_conv_kernel_dim=4,
)
config._attn_implementation = attn_impl
return config
def _tiny_moe_config(attn_impl: str = "sdpa") -> Qwen3_5MoeConfig:
config = Qwen3_5MoeConfig(
vocab_size=128,
hidden_size=64,
num_hidden_layers=2,
layer_types=["linear_attention", "full_attention"],
num_attention_heads=4,
num_key_value_heads=2,
head_dim=16,
max_position_embeddings=128,
linear_key_head_dim=8,
linear_value_head_dim=8,
linear_num_key_heads=4,
linear_num_value_heads=8,
linear_conv_kernel_dim=4,
moe_intermediate_size=128,
shared_expert_intermediate_size=128,
num_experts=4,
num_experts_per_tok=2,
use_grouped_mm=False,
)
config._attn_implementation = attn_impl
return config
def test_qwen3_5_dense_matches_hf_state_keys_on_meta():
config = _tiny_text_config()
with torch.device("meta"):
hf_model = HFQwen3_5ForCausalLM(config)
prime_model = Qwen3_5ForCausalLM(config)
assert set(prime_model.state_dict()) == set(hf_model.state_dict())
for name, tensor in prime_model.state_dict().items():
assert tensor.shape == hf_model.state_dict()[name].shape, name
@pytest.mark.parametrize("attn_impl", ["flash_attention_3", "kernels-community/vllm-flash-attn3"])
def test_qwen3_5_full_attention_uses_custom_class(attn_impl: str):
config = _tiny_text_config(attn_impl=attn_impl)
with torch.device("meta"):
model = Qwen3_5Model(config)
assert isinstance(model.layers[1].self_attn, Qwen3_5GatedFlashAttention)
assert model.config._attn_implementation == "flash_attention_3"
assert "ALL_ATTENTION_FUNCTIONS" not in inspect.getsource(type(model.layers[1].self_attn).forward)
def test_qwen3_5_moe_full_attention_normalizes_fa3_hub_alias():
from prime_rl.trainer.models.qwen3_5_moe.modeling_qwen3_5_moe import (
Qwen3_5MoeGatedFlashAttention,
Qwen3_5MoeModel,
)
config = _tiny_moe_config(attn_impl="kernels-community/vllm-flash-attn3")
with torch.device("meta"):
model = Qwen3_5MoeModel(config)
assert isinstance(model.layers[1].self_attn, Qwen3_5MoeGatedFlashAttention)
assert model.config._attn_implementation == "flash_attention_3"
def test_qwen3_5_ring_patches_dense_flash_attention():
from prime_rl.trainer.models.afmoe.modeling_afmoe import AfmoeFlashAttention
from prime_rl.trainer.models.qwen3_5_moe.modeling_qwen3_5_moe import Qwen3_5MoeGatedFlashAttention
originals = {
cls: cls._compute_attention
for cls in (FlashAttention, AfmoeFlashAttention, Qwen3_5MoeGatedFlashAttention, Qwen3_5GatedFlashAttention)
}
try:
substitute_ring_attn(process_group=MagicMock(), heads_k_stride=1)
assert Qwen3_5GatedFlashAttention._compute_attention is not originals[Qwen3_5GatedFlashAttention]
finally:
for cls, method in originals.items():
cls._compute_attention = method
+5 -3
View File
@@ -35,8 +35,8 @@ def _build_rollout(*, example_id: int, reward: float, task: str) -> Rollout:
sampled=True,
),
]
rollout = Rollout[vf.Task](
task=vf.Task(idx=example_id, prompt=f"prompt-{example_id}"),
rollout = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=example_id, prompt=f"prompt-{example_id}")),
nodes=nodes,
rewards={"reward": reward},
)
@@ -80,7 +80,9 @@ def test_rollouts_to_parquet_bytes_skips_rollouts_without_trajectory():
monitor.run_id = "run-456"
rollout_with_branches = _build_rollout(example_id=1, reward=1.0, task="task-a")
rollout_without_branches = Rollout[vf.Task](task=vf.Task(idx=2, prompt="missing-trajectory"))
rollout_without_branches = Rollout[vf.TaskData](
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=2, prompt="missing-trajectory"))
)
assert rollout_without_branches.branches == []
parquet_bytes = monitor._rollouts_to_parquet_bytes(
Generated
+67 -54
View File
@@ -76,7 +76,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -91,7 +91,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -106,7 +106,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -282,7 +282,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -306,7 +306,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -423,7 +423,7 @@ dependencies = [
requires-dist = [
{ name = "httpx" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -929,7 +929,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -1357,7 +1357,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -1413,7 +1413,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "pydantic" },
{ name = "verifiers", extras = ["harbor"], specifier = ">=0.1.15.dev411" },
{ name = "verifiers", extras = ["harbor"], specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -1531,7 +1531,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -1546,7 +1546,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -1799,7 +1799,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "orjson" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -1814,7 +1814,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -1863,7 +1863,7 @@ requires-dist = [
{ name = "setuptools", specifier = "<78" },
{ name = "spacy" },
{ name = "syllapy" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -1884,7 +1884,7 @@ requires-dist = [
{ name = "immutabledict" },
{ name = "langdetect" },
{ name = "nltk" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2276,7 +2276,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets", specifier = ">=2.0.0" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2341,7 +2341,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "huggingface-hub" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2395,7 +2395,7 @@ requires-dist = [
{ name = "markdown", specifier = ">=3.5.1" },
{ name = "math-verify", specifier = ">=0.8.0" },
{ name = "sympy", specifier = ">=1.12.0" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2435,7 +2435,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "longcot", git = "https://github.com/LongHorizonReasoning/longcot.git?rev=6a569ab" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2452,7 +2452,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "longcot", git = "https://github.com/LongHorizonReasoning/longcot.git?rev=6a569ab" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2467,7 +2467,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets", specifier = ">=3.0" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2537,7 +2537,7 @@ dependencies = [
requires-dist = [
{ name = "math-verify", specifier = ">=0.8.0" },
{ name = "prime-sandboxes", specifier = ">=0.2.19" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2552,7 +2552,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2596,7 +2596,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2739,7 +2739,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -2813,7 +2813,7 @@ dependencies = [
requires-dist = [
{ name = "filelock" },
{ name = "httpx" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -3326,7 +3326,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "huggingface-hub" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -3343,7 +3343,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -3362,7 +3362,7 @@ requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "python-dateutil" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -3444,7 +3444,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -3581,7 +3581,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev443" }]
[[package]]
name = "orderly-set"
@@ -3662,7 +3662,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -3704,7 +3704,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "nltk", specifier = ">=3.8" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -4013,6 +4013,7 @@ envs = [
{ name = "swelego-v1" },
{ name = "tau2-bench-v1" },
{ name = "terminal-bench-2-v1" },
{ name = "tmax-v1" },
{ name = "unscramble-v1" },
{ name = "uuid-ctf-v1" },
{ name = "verbatim-copy-v1" },
@@ -4155,6 +4156,7 @@ requires-dist = [
{ name = "tenacity", specifier = ">=8.2.0" },
{ name = "terminal-bench-2-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/terminal_bench_2_v1" },
{ name = "tilelang", specifier = ">=0.1.8" },
{ name = "tmax-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/tmax_v1" },
{ name = "torch", specifier = ">=2.9.0", index = "https://download.pytorch.org/whl/cu128" },
{ name = "torchaudio", index = "https://download.pytorch.org/whl/cu128" },
{ name = "torchdata", specifier = ">=0.11.0" },
@@ -4255,7 +4257,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev443" }]
[[package]]
name = "prometheus-client"
@@ -4713,7 +4715,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev434" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -4764,7 +4766,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -4967,7 +4969,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "huggingface-hub" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -4994,7 +4996,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev434" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -5120,7 +5122,7 @@ wheels = [
[[package]]
name = "simpleqa-v1"
version = "0.1.0"
version = "0.2.0"
source = { editable = "deps/research-environments/environments/simpleqa_v1" }
dependencies = [
{ name = "datasets" },
@@ -5132,12 +5134,12 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
name = "simpleqa-verified-v1"
version = "0.1.0"
version = "0.2.0"
source = { editable = "deps/research-environments/environments/simpleqa_verified_v1" }
dependencies = [
{ name = "datasets" },
@@ -5149,7 +5151,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev422" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -5384,7 +5386,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev434" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev443" }]
[[package]]
name = "swebench-verified-v1"
@@ -5395,7 +5397,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev434" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev443" }]
[[package]]
name = "swelego-v1"
@@ -5409,7 +5411,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev434" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -5477,7 +5479,7 @@ dependencies = [
[[package]]
name = "tau2-bench-v1"
version = "0.2.0"
version = "0.3.0"
source = { editable = "deps/research-environments/environments/tau2_bench_v1" }
dependencies = [
{ name = "tau2" },
@@ -5488,7 +5490,7 @@ dependencies = [
requires-dist = [
{ name = "audioop-lts", marker = "python_full_version >= '3.13'" },
{ name = "tau2", git = "https://github.com/sierra-research/tau2-bench.git?rev=337326e" },
{ name = "verifiers", specifier = ">=0.1.15.dev424" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -5538,7 +5540,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev443" }]
[[package]]
name = "textarena"
@@ -5675,6 +5677,17 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/c6/a7/f4bfb86f87e107703146e703204cec2c0eae2492b633e0052b0ace3febb6/tilelang-0.1.9-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:77ab0ee2f40f66ea015b6b21426d482751e28cbc635ef9d1198cbd6502454a7c", size = 42110365, upload-time = "2026-04-22T09:17:18.292Z" },
]
[[package]]
name = "tmax-v1"
version = "0.1.0"
source = { editable = "deps/research-environments/environments/tmax_v1" }
dependencies = [
{ name = "verifiers", extra = ["harbor"] },
]
[package.metadata]
requires-dist = [{ name = "verifiers", extras = ["harbor"], specifier = ">=0.1.15.dev443" }]
[[package]]
name = "tokenizers"
version = "0.22.2"
@@ -5996,7 +6009,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "datasets" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -6017,7 +6030,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev443" }]
[[package]]
name = "uvicorn"
@@ -6066,7 +6079,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "faker", specifier = ">=20.0.0" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -6754,7 +6767,7 @@ wheels = [
[[package]]
name = "wideseek-v1"
version = "0.1.0"
version = "0.2.0"
source = { editable = "deps/research-environments/environments/wideseek_v1" }
dependencies = [
{ name = "datasets" },
@@ -6766,7 +6779,7 @@ dependencies = [
requires-dist = [
{ name = "datasets" },
{ name = "openai" },
{ name = "verifiers", specifier = ">=0.1.15.dev411" },
{ name = "verifiers", specifier = ">=0.1.15.dev443" },
]
[[package]]
@@ -6823,7 +6836,7 @@ dependencies = [
]
[package.metadata]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev411" }]
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev443" }]
[[package]]
name = "wordle"