Skip to content

Add async non-colated PPO + connect to Gym rollout - #3185

Draft
HeyyyyyyG wants to merge 103 commits into
mainfrom
jiaqiz/ppo-dev
Draft

HeyyyyyyG wants to merge 103 commits into
mainfrom
jiaqiz/ppo-dev

Conversation

@HeyyyyyyG

@HeyyyyyyG HeyyyyyyG commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

Overview: Bring PPO to feature parity with GRPO — add non-colocated generation, asynchronous training, and NeMo-Gym
rollout support, plus the train/inference-mismatch diagnostics and resume/robustness fixes that go with them.

  • Non-colocated generation for PPO — split policy + value (train cluster) from vLLM generation (inference cluster)
    with an NCCL-collective weight refit, mirroring GRPO (vLLM-only; SGLang/Megatron-generation rejected). Ports GRPO's train/inference mismatch diagnostics to PPO: gen_kl_error, token_mult_prob_error, sequence-level mismatch masking, and the W&B mismatch plot.
  • Asynchronous PPO (async_ppo_train) — a continuous background AsyncTrajectoryCollector + ReplayBuffer; value recomputed once per outer step at train time; critic-warmup trajectory banking via a two-boundary warmup_max_trajectory_age_steps; in-flight weight updates; and freeze-aware trajectory-age logging (true policy-age vs. gen-version age).
  • NeMo-Gym rollout for PPO — sync and async — setup() spins up the NemoGym actor overlapped with vLLM deferred model load; gym rollouts are wired into ppo_train, validate, and the shared async collector. reward_penalties (reward-zeroing, applied pre-GAE → GAE-compatible) and mask_sample are honored; the GRPO advantage-overwrite penalties are explicitly rejected for PPO (they'd break GAE's advantage/return consistency). Adds examples/nemo_gym/run_ppo_nemo_gym.py + a Math/RLVR config.
  • Resume & robustness fixes — correctly restore the value optimizer + replay buffer on resume (fixes a critic-LR
    V-shape); drop the survivorship-biased incomplete frontier target on resume (configurable, default off); and cycle
    the async collector's dataloader across epochs (fixes a silent buffer-stall hang on resume once a finite dataset is
    exhausted).
  • Tests — unit coverage (non-colocated setup guards, async guards, validate dispatch incl. gym, warmup-age
    boundaries, replay-buffer restore, collector epoch-cycling) and functional smoke tests (ppo_non_colocated.sh,
    ppo_async.sh, ppo_nemo_gym.sh, ppo_async_gym.sh). Sync + async NeMo-Gym validated end-to-end on GB200.

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

RayenTian and others added 29 commits June 30, 2026 20:43
… config

Copy the GB200/aarch64 async-GRPO SWE launcher and its megatron config
into examples/swe_bench for the oci-hsg-cs-001 cluster:
- run_grpo_swe2_scale_gen_hsg.sh (single-knob NUM_VLLM_REPLICAS, ALIGN_BASELINE
  switch, LUSTRE_UV_CACHE_SEED default, 4 GPU/node geometry)
- grpo_qwen3_30b_async_swe.yaml (incl. megatron_cfg.use_fused_weighted_squared_relu)

Signed-off-by: ruit <[email protected]>
…riton MoE)

- rename config to grpo_qwen3_30b_async_swe_hsg.yaml with the GB200 fixes:
  megatron_cfg.use_fused_weighted_squared_relu + vllm_kwargs.moe_backend=triton
  (triton MoE backend avoids the weight-refit broadcast_weights_for_collective hang)
- run_grpo_swe2_scale_gen_hsg.sh: point CONFIG_FILE at the hsg yaml and default
  CONTAINER to the baked nightly-063026-gymvenvs image (has /opt/gym_venvs prebuilt
  so gym spinup skips the concurrent venv build that deadlocks on the uv cache lock)

Signed-off-by: ruit <[email protected]>
… creds

Remove the hardcoded source of ${HOME}/script/export_env_vars.sh (a personal
file). Users export their own HF_HOME/HF_TOKEN/WANDB_API_KEY/etc. before running.

Signed-off-by: ruit <[email protected]>
Set DEFAULT_MODEL_PATH to the SWE1 step_230_hf checkpoint and TRAIN/VAL_DATA_PATH
to the r2e_gym_subset dataset (train=val) so the hsg launcher reproduces the
baseline SWE2 run by default. All three remain overridable via env.

Signed-off-by: ruit <[email protected]>
…ic_val

The r2e_gym_subset set has instances with no matching sif on this cluster
(missing container -> 500, batch never fills -> step stalls). Revert the
launcher defaults to the runnable balanced_language (train) + swe_public_val.

Signed-off-by: ruit <[email protected]>
…skip-training

- add examples/swe_bench/run_grpo_nano_v3_5_swe_scale_gen_hsg.sh: single-knob
  (NUM_VLLM_REPLICAS) launcher, 3 modes — ALIGN_BASELINE (32-node baseline,
  CP16/EP32), default (scale train+gen from the validated CP2/EP8 2-node/DP
  base), and SKIP_TRAINING (gen benchmark: pin train to 1 node, scale only gen).
  Segment auto-picks the largest of {16,8,4,2,1} dividing each worker group;
  wandb staging redirected off the coreai quota; 60min idle-reaper exemption.
- add examples/swe_bench/grpo_nano_v3_5_swe_hsg.yaml.
- gen-benchmark skip-training support (NRL_GEN_BENCHMARK_SKIP_TRAINING) in
  grpo.py / lm_policy.py / base_policy_worker.py (per #2930): skip
  optimizer build + policy.train(), NCCL-free keep-alive matmul to avoid the
  idle-GPU reaper while training is skipped.
- MegatronConfig.mtp_num_layers accepts None (int | None) so MTP can be disabled
  on hybrid (NemotronH) models where 0 still trips the mtp_num_layers>0 assertion.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: ruit <[email protected]>
The multi-platform lock (aarch64 + x86_64) requires both to jointly
resolve. Pinning a custom vLLM whose own transitive deps (e.g.
flashinfer-python) differ per version can make the unused x86_64 split
unsatisfiable and block the whole lock/sync, even though we only ever
build/run on aarch64 (GB200/GB300). Per uv's own hint on this failure.
Signed-off-by: Jiaqi Zeng <[email protected]>
Signed-off-by: Jiaqi Zeng <[email protected]>
…diagnostics

PPO previously required colocated generation and had no visibility into
train/inference logprob mismatch, unlike GRPO. Ports both capabilities from
GRPO's proven implementations: separate train/inference clusters with NCCL
collective weight refit (SGLang guarded as unsupported non-colocated), and
the sequence-level mismatch masking, W&B mismatch plot, and gen_kl_error
logging GRPO already surfaces.

Signed-off-by: Jiaqi Zeng <[email protected]>
Signed-off-by: Jiaqi Zeng <[email protected]>
Signed-off-by: Jiaqi Zeng <[email protected]>
Signed-off-by: Jiaqi Zeng <[email protected]>
Add async PPO training (async_ppo_train) mirroring async GRPO: an
AsyncTrajectoryCollector + ReplayBuffer Ray-actor pipeline with a
weight-version staleness window, critic-warmup trajectory banking
(warmup_max_trajectory_age_steps), in-flight weight updates, and
freeze-aware trajectory-age diagnostics.

Also route async rollouts through validate(), fix replay-buffer and
value-optimizer checkpoint/resume, and add unit + functional
(ppo_async.sh) coverage.

Signed-off-by: Jiaqi Zeng <[email protected]>
…n resume

The partially-generated frontier target saved in the async replay buffer
holds only the fast-completing (short) rollouts, so keeping and gap-filling
it on resume trains the first post-resume step on a systematically shorter,
higher-reward batch — a dip in mean_gen_tokens_per_sample and a reward spike
after every resume.

Add ppo.async_ppo.drop_incomplete_targets_on_restore (default false =
historical gap-fill behavior). When true, incomplete restored targets are
dropped and regenerated fresh (unbiased batch, at the cost of a one-target
generation bubble at resume). Complete banked targets are always kept and
replayed exactly.

Signed-off-by: Jiaqi Zeng <[email protected]>
Finish the partial NeMo-Gym port for PPO so it reaches GRPO parity:

- setup(): spin up the NeMo-Gym actor via the vLLM deferred-load path,
  bundling policy+value+vLLM as one GPU task while the gym overlaps
  (CPU/HTTP); add nemo_gym_actor to the return tuple.
- ppo_train(): complete the gym rollout call (max_seq_len, effort_config,
  reward_penalty_config, thinking_tags, stop_token_ids/stop_strings=None).
- validate(): add the gym branch (3-way dispatch) — closes the
  NemoGym.step() NotImplementedError crash gap.
- async_ppo_train(): drop the gym-off guard; gym rollouts run inside the
  shared AsyncTrajectoryCollector, which now reads master_config.reward_penalties.
- reward_penalties (reward-zeroing, pre-GAE) are wired functional and
  GAE-compatible; mask_sample is honored in both training loops (mirrors
  GRPO); the advantage-overwrite penalties (invalid_tool_call_advantage /
  malformed_thinking_advantage) are explicitly rejected for PPO (they'd break
  GAE advantage/return consistency).
- Harden the collector gym branch to clear stop_token_ids/stop_strings by
  construction (avoids a swallowed assert -> silent buffer stall).

Add examples/nemo_gym/run_ppo_nemo_gym.py + ppo_math_rlvr_nemo_gym.yaml
(Math/RLVR), unit coverage for the validate gym dispatch, and functional
tests ppo_nemo_gym.sh (sync) + ppo_async_gym.sh (async). Both smoke tests
pass on GB200 (DAPO17k, Qwen2.5-0.5B) end to end.

Signed-off-by: Jiaqi Zeng <[email protected]>
The AsyncTrajectoryCollector iterated the training dataloader with a single,
non-cycling `for batch in self.dataloader`. A finite dataset is consumed once
and the loop returns, stopping the collector and silently stalling the replay
buffer (the driver waits on buffer_size=0 forever). This bites hardest on
RESUME: the checkpoint saves the collector's real dataloader position, and a
restored StatefulDataLoader whose samples_yielded is already at the epoch end
yields ZERO batches on the first epoch — so the run hangs immediately after
resume (observed at step 195 of a 218-batch DAPOMath17K run).

Wrap the loop in `while self.running:` so it cycles epochs, mirroring sync
ppo_train/grpo_train's `while epoch < max_num_epochs: for batch in dataloader`.
StatefulDataLoader resume-once semantics (next_iter_state cleared after the
first iterator) mean the resumed partial epoch yields its remainder and fresh
full epochs follow; a two-empty-epoch guard fails loudly on a genuinely empty
dataset instead of busy-spinning. Add unit tests for the resume-exhaustion
recovery, multi-epoch cycling, and the empty-dataset guard. Shared with async GRPO.

Signed-off-by: Jiaqi Zeng <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

HeyyyyyyG and others added 28 commits September 14, 2026 12:23
…y scopemix1300 chain snapshots)

Co-Authored-By: Claude Fable 5 <[email protected]>
…ows)

Cherry-pick of nemo-rl-internal geshen/compact 6c396b9c9 'feat: add scripts
and md' onto jiaqiz/ppo-dev, resolving ~23 conflict regions. One env rollout
(opencode session tree) now yields one training row per (session, segment)
trace; reward/advantage stay rollout-scoped and broadcast to sibling traces.

Resolution choices:
- nemo_gym.py: kept our batch-collect + NaN-retry + rowidx-resort
  run_rollouts (returns list-of-traces per row); kept our list-based
  seen_token_ids with geshen's richer contiguity diagnostics; empty rollouts
  now emit a masked dummy trace instead of raising (required for multi-trace;
  loud warning retained).
- rollouts.py: kept our flat run_async_nemo_gym_rollout (no group
  accumulation) and grafted the trace flatten into it; penalties count per
  rollout via shared full_result; effort shaping passes one trace per
  rollout; graft_nemo_gym_input_fields expands input fields through
  rollout_local_idx.
- grpo.py: kept our aggregate_rollout_metrics/_clip_grpo_advantages/
  _apply_configured_message_level_advantage_penalties helpers and
  benchmark-gated training; took geshen's rollout-level advantage broadcast,
  unique-rollout batch check, DP-padding with masked duplicate rows,
  multi_trace/* metrics, and gbs override; dropped the OPD sample-stats and
  base-era metric tails our side had already removed.
- rollout_manager.py (unused outside tests): fail-loud on multi-trace rows.
- Dropped geshen's launcher script; kept multi_trace.md + his GRPO yaml as
  reference.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ace debug jsonl)

trace_metadata on each trace, _rollout_debug_info per rollout, and the
per-step rollout_debug_step*.jsonl writer. Adaptations: seq-error tensors
exposed via a tensor_out param on compute_and_apply_seq_logprob_error_masking
(our loop returns only scalar metrics); kept our
_apply_configured_message_level_advantage_penalties (already returns
invalid-tool-call metrics) over the inline by-kind instrumentation; re-added
expand_rollout_field; dropped the OPD logging tails our branch had removed.

Co-Authored-By: Claude Fable 5 <[email protected]>
…observability)

multi_trace_metrics.py, _trace_kind/_termination_kind/_compaction_rollout_metrics
helpers, kind stamped into trace_metadata, per-trace diagnostics merged into
step metrics, sum/count exact aggregation via finalize_sum_count_metrics
grafted onto our aggregate_rollout_metrics helper. Kept our penalty-4
implementation over the _rollout_has_think_tag_violation refactor.

Co-Authored-By: Claude Fable 5 <[email protected]>
…trainable tokens by kind)

Co-Authored-By: Claude Fable 5 <[email protected]>
…ubagent); drop his AGENTS_LOG

Co-Authored-By: Claude Fable 5 <[email protected]>
…_traces gate

PPO arm of the subagent-training comparison. Async PPO now accepts one
training row per trace:
- env.nemo_gym.train_on_all_session_traces (default false) gates trace
  fan-out at the adapter — false keeps only the root session's traces, so
  existing configs reproduce legacy behavior against a plural-responses Gym.
- Buffer backfill + positional trace_group_ids/trace_rollout_ids (sibling
  traces have different prompts, so prompt-token grouping is impossible).
- Batch check counts unique ROLLOUTS; rows vary step to step.
- DP padding by duplicating row 0 with sample_mask=0 (policy+value share
  train_data); variable-row batches train as ONE global batch via gbs
  override on policy.train and all value_model.train calls.
- GAE/critic stay strictly per-sequence: each trace carries the rollout's
  terminal reward and gets its own A_t = R - V(s_t). No advantage broadcast
  (that is the GRPO arm's semantics).
- Fail-loud guards: privileged critic, residual_baseline=true, turn_gae with
  padding, and the sync PPO path all reject multi-trace batches.
- Observability: compute_multi_trace_diagnostics + multi_trace/* composition
  metrics + per-trace rollout_debug_step*.jsonl (same schema as the GRPO
  loop, plus value_first_token), train_data jsonl sliced to unpadded rows,
  dump payload group ids from explicit trace ids instead of idx//GPP.

Co-Authored-By: Claude Fable 5 <[email protected]>
Derived from grpo_nano_v3_5_swe_cmh.yaml (this repo's known-good GRPO
schema): env block swapped to swebench_opencode_training.yaml with the PPO
arm's agent settings (agent_max_turns 400, tests timeout 900, full SIF
list) and the same reward_penalties block for penalty parity. Launchers
set train_on_all_session_traces, the fork pin, data, and model.

Co-Authored-By: Claude Fable 5 <[email protected]>
…arity

From the pre-launch adversarial review:
- FATAL: async-PPO metrics masked_select mixed padded advantages with
  unpadded flat_messages token mask — crashed the run on the first step
  that actually fans out traces. Sliced to num_unpadded_traces (matches
  the GRPO loop).
- token_mult_prob_error plot: sliced train_data tensors to unpadded rows
  (padding rows NaN the argmax and index past prompt_lengths).
- validation + train/reward now count each ROLLOUT once (first trace),
  not per padded trace.
- train_on_all_session_traces=false now strips token arrays from
  filtered-out subagent responses (they rode along in full_result into
  the replay buffer and logs).
- DP padding multiple now covers the VALUE model's dp/mbs/logprob_bs too
  (was policy-only; value parallelism is independently configurable).
- GRPO arm yaml parity: adam_beta2 0.95/eps 1e-10 (match PPO policy
  optimizer; eps 1e-8 is a hidden ~0.64x LR on MoE experts),
  overlap_param_gather false, vllm disable_custom_all_reduce true
  (TP-4 custom-allreduce deadlock fix), -5 advantage overwrites disabled
  (PPO arm structurally cannot apply them).

Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
- no root-session trace under train_on_all_session_traces=false is a
  harness bug -> raise, don't silently train on subagent traces in a
  root-only arm
- value.train_micro_batch_size is required config -> direct index, no
  fallback to the policy's value
- train_data['values'] always exists in PPO -> direct index in the debug
  writer, no None placeholder column

Metric semantics note: the per-rollout dedup of train/reward and
validation accuracy is a no-op on legacy single-trace batches (one trace
per rollout) — old-PPO curves remain directly comparable.

Co-Authored-By: Claude Fable 5 <[email protected]>
- analysis/compaction/compaction_codepath.html: his analysis artifact
- grpo_ultra_swe_e2e_opencode_compaction.yaml: his repo's config schema —
  not runnable here and easy to --config by mistake; multi_trace.md stays
  as the design doc

Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
reward_mean/num_samples dedup to first traces (a row mean would overweight
delegation-heavy rollouts and corrupt pi0@k pool selection); a rollout is
truncated if ANY trace hit the cap; adds num_traces / num_subagent_traces /
num_compaction_traces / num_empty_rollouts for coverage analysis. Legacy
single-trace shards keep the old record shape.

Co-Authored-By: Claude Fable 5 <[email protected]>
- split_group_responses cuts at ROLLOUT boundaries (a positional row cut
  would put a rollout's root trace in train and its subagent trace in
  heldout — label leakage via the shared reward)
- step batch check counts rollouts; value forward/train row-pad to the
  value model's dp x mbs with explicit gbs (trace rows vary per step)
- train_on_truncated flag (TRAIN ONLY, default false): keep truncated
  rollouts in the value loss — the budget is part of the environment and
  a truncated rollout's evaluated reward is a legitimate MC return sample.
  Heldout always applies the overlong mask (historical EV yardstick).
  Pairs with the existing train_on_env_masked for timeouts/OOM.
- soft group-mean targets average over ROLLOUTS (first traces), broadcast
  to all trace rows
- estimator group ids from explicit per-row shard_group_id (prompt-token
  grouping is meaningless across sibling traces)
- trajectory-level AUCs (terminal, within-group) + heldout reward dedup to
  first traces; per-token EV metrics deliberately stay over ALL traces
- privileged critic + multi-trace shards -> NotImplementedError

Co-Authored-By: Claude Fable 5 <[email protected]>
…ctor

spinup_nemo_gym built NemoGymConfig without the multi-trace gate (unlike
ppo.py/grpo.py), so the actor defaulted to root-only filtering and every
collection silently dropped subagent traces. Pipeclean probes 3825667/68
confirmed: 18/32 rollouts spawned subagents (num_segments=2 in
rollout_info), 0 subagent traces stored.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ubagent traces per sample

The headline question for the subagent arm is whether delegating actually
solves more, and nothing reported it. _compaction_rollout_metrics now splits
every rollout on "did it spawn a subagent session" and emits reward/resolved
as /sum + /count pairs, so finalize_sum_count_metrics derives the means
exactly over the step's rollouts (wandb: train/{reward,resolved}/by_delegation*).

Both an all-rollouts and an unmasked-only pair are emitted, and the unmasked
one is the comparison to read: an env-masked rollout scores 0 regardless of
the policy, and delegating rollouts run longer so they take more env faults --
on the live pi_0 collection they are masked at 8.6% vs 20.9%, which the
all-rollouts split would report as a capability gap.
mask_sample/by_delegation/{bucket}/count exposes that yield gap directly.

Also adds subagent_traces_per_sample (min/max/mean/median/stddev) and
delegation_rate. This counts TRACES, not the sessions the existing
subagent_sessions_per_sample counts: a subagent that compacts contributes
several traces from one session, and traces are what the loss sees. Note the
min/max are only meaningful in PPO/GRPO, where the metric is computed over the
whole step's batch; rollout_collection mean-merges per-episode metric dicts, so
its shards report min = max = mean.

Metric semantics of every pre-existing key are unchanged (regression-checked).

Co-Authored-By: Claude Fable 5 <[email protected]>
The mc0 fix has been shipping to jobs since 2026-09-19 only because
code_snapshot.sh rsyncs working-tree files for every tracked path, so the
submodule's checked-out files travel even though the superproject still
pointed at ed5dd415. That makes the running collection's behaviour
unreproducible from the repo: a fresh clone would check out the old Gym and
silently lose opencode_max_compactions, and with it the only off-switch for
reactive compaction on context overflow.

No file content changes -- this records the pin that every pipeclean round 4
onward and the live pi_0 collection already ran with.

Co-Authored-By: Claude Fable 5 <[email protected]>
…id rollout scratch)

The 3-line export is the only piece needed from geshen's dc9e45ab: the
generated Ray launcher strips SLURM_* from its environment, and the SWE gym's
runtime_scratch_dir (/raid/scratch/temp_swe_${oc.env:NRL_SLURM_JOB_ID})
resolves the allocation ID through this preserved variable. The rest of that
commit (replay buffer / trajectory collector / log-sync disable) is
deliberately not taken.

Launchers must now (a) bind /raid/scratch:/raid/scratch into the container and
(b) mkdir the job-scoped parent per node in SETUP_COMMAND — done for the
subagent collect launcher; the PPO/GRPO arm launchers need the same two lines
before their smokes.

Co-Authored-By: Claude Fable 5 <[email protected]>
…-level)

The guard rejected privilege + multi-trace outright, citing "the reference-block
remap assumes one trace per rollout". That assumption does not hold up: both
build_swe_privileged_value_inputs and remap_by_response_mask are strictly
PER ROW — the block is prefixed to each row's own message log, and values are
carried back row i -> row i by matching response-token counts. Neither has any
notion of rollouts or groups, so a subagent trace is simply another row.

Verified on a real subagent shard (group_00000960, 32 rollouts -> 45 rows):
45/45 rows resolve a golden patch, including all 13 subagent trace rows, and
the group has exactly one instance_id — so sibling traces hit the same
block_cache entry and receive a byte-identical block. The within-task
no-confound argument therefore survives multi-trace unchanged: the block is
constant across every trace of every sibling rollout.

Turn-level + multi-trace stays rejected, now with an accurate reason: the
anchor remap into the augmented batch is what is actually unverified there.

Co-Authored-By: Claude Fable 5 <[email protected]>
…multi-trace

The blind path already padded rows to the value workers' data-parallel size;
the privileged path did not, because before multi-trace the row count was
always groups x gpp and therefore a clean multiple. With subagent traces the
count is variable — 32 groups x 32 rollouts + their subagent traces = 1281
rows — and the value worker rejects it:

    AssertionError: Batch size (1281) is not a multiple of shards (8)

Pad the augmented batch the same way and slice the padded rows back off the
returned values, so the remap to the policy layout still sees exactly the real
rows.

_pad_rows_for_value now treats sample_mask as optional. The augmented batch is
inference-only at this point (sample_mask and returns are grafted on later, at
the train call), so requiring the key would just trade this crash for a
KeyError; padded rows carry no loss there and are dropped immediately.

The value TRAIN call was already padded (to value_dp * train_micro_batch_size)
and is unaffected.

Co-Authored-By: Claude Fable 5 <[email protected]>
The opencode fork the SWE arms run was a hand-maintained local mirror at
ppo/nv-opencode, reachable only on this filesystem. Every launcher pointed
OPENCODE_REPO at that path, so standing the stack up on another cluster meant
recreating the mirror by hand and hoping the SHA matched.

It is now a submodule at 3rdparty/opencode-workspace/nv-opencode, mirroring the
layout geshen's repo already uses, so `git submodule update --init` reproduces
the exact pinned tree anywhere.

Getting it onto a remote took a detour worth recording. The pin's TREE contains
a 16 MiB marketing video (plus two ~25 MiB compiled binaries), and this GitLab
enforces a 5 MiB max-file-size push rule whose project-level override is capped
at 5 by group policy — so a plain push of this history is impossible, and the
LFS fix the error suggests would rewrite history and change ebfb82f03, which is
the one thing that must not move (it is baked into launchers, provenance and
the in-flight collection campaign). Resolved by forking geshen/nv-opencode
server-side into jiaqiz/nv-opencode: a fork copies objects on the server, so
push rules never run. The merge branch jiaqiz/subagent-compaction (4f39cc301,
sdd/dev + geshen, previously existing on exactly one disk with no remote copy)
then pushed cleanly on top, because its oversized blobs already existed
server-side.

Tracks branch geshen-compaction-prod rather than geshen/compact: the latter is
geshen's moving working branch, and a submodule that follows it would silently
drift on `submodule update --remote`. The gitlink pins the commit regardless;
the branch field only matters for explicit remote updates.

Cloned with --dissociate so the checkout carries its own objects and does not
depend on the old mirror's path continuing to exist.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ot rollout_local_idx

split_group_responses derived rollout boundaries from rollout_local_idx. That
field is stamped per SAMPLE batch, and collection generates each rollout as its
own single-sample batch — so once a group is assembled every row reads 0 and
the function reports any group as exactly one rollout:

    AssertionError: response slice [0, 24) out of range for a group of
    1 rollouts (34 trace rows)

which killed every job the moment heldout_responses_per_group was enabled (it
is the only caller, so nothing exercised this until now).

trace_in_rollout_idx is the authoritative boundary marker — each 0 starts a new
rollout and a rollout's traces are contiguous — and it is what the manifest
stats and the env-mask census already rely on. Rollout ids are now derived from
it by counting zeros; the non-decreasing check is replaced by asserting row 0
starts a rollout, which the construction guarantees.

Verified on the shard that crashed (group_00000960: 45 trace rows / 32
rollouts, previously misread as 1): split(0,24) -> 33 rows / 24 rollouts,
split(24,32) -> 12 rows / 8 rollouts, no rows lost and neither slice starts
mid-rollout, so no rollout's traces straddle the train/heldout cut (they share
a reward, so straddling would leak the label).

Co-Authored-By: Claude Fable 5 <[email protected]>
…en-level)

Same lift as critic_pretrain (1ba899a): the reference-block builder and
remap_by_response_mask are strictly per-row, so subagent traces are just more
rows carrying the same instance's byte-identical block. What the old blanket
guard was actually protecting against is an ALIGNMENT gap specific to this
loop: multi-trace DP/mbs padding duplicates row 0 of train_data AFTER
repeated_batch is frozen, and the augmented batch is built from
repeated_batch — leaving it short by the padding rows. Every downstream
consumer assumes row-for-row alignment: the values remap (aug->train), the
returns remap (train->aug), the sample_mask copy, and value_model.train with
gbs = padded row count.

Fix: pad the augmented batch identically (dup row 0) right after it is built.
Duplicating row 0 on both sides keeps per-row response-token counts equal,
which remap_by_response_mask asserts; padded rows carry sample_mask 0 from the
copy, so they train nothing. Verified by simulation at the real shapes
(1281 -> 1288 rows): both remap directions carry values exactly, padded rows
masked.

The math privileged critic (value.privileged_critic) stays rejected under
multi-trace — its prompt/response split is unverified there. turn_gae +
multi-trace remains rejected at the padding site; residual_baseline unchanged.

Co-Authored-By: Claude Fable 5 <[email protected]>
@terrykong terrykong added the CI:L1 Run doctests, unit tests, and functional tests label Nov 5, 2026
@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants