Repository navigation
Description
Queue rank 45/48 · Difficulty 4/5 · Status on main: partially_fixed
NVBug: https://nvbugspro.nvidia.com/bug/5973371 · NVBug priority: Unprioritized (Severity 2 - Application Crash) · ARB: none set
GitHub: no issue for the literal KeyError. Related merged PRs: #2872 (external-sink token capture), #3974 (make attributed incomplete-capture masking optional), #3823 (SWE empty-response token preservation), #4102 (external-harness docs)
Summary
SAP ran GRPO/RL training with a custom NeMo-Gym agent. Conversations that produced an assistant turn without a tool call carried no token ids, so NeMo-RL's rollout postprocessing crashed with KeyError: 'token_ids'. The crash is raised inside NeMo-RL, but the root cause is a NeMo-Gym rollout emitted as trainable while lacking per-turn generation token ids. SAP did not share source; only screenshots exist.
Reproduction
Run a custom external harness against vllm_model_for_training and collect rollouts for training where at least one assistant turn is a plain text answer (no tool call) whose model call is not captured. Feed the rollouts to NeMo-RL GRPO postprocessing.
Root cause
A turn whose model call is not routed through training-token capture (missing /ng-rollout/<id>/training-token-capture prefix, or an unattributable terminal) produces an assistant message with no generation_token_ids. The trainer indexes token_ids unconditionally and crashes instead of skipping the sample (the exact NeMo-RL line is a hypothesis; the Gym-side gap is the tokenless trainable turn).
Status on main (partially_fixed)
The Gym-side contract to avoid emitting tokenless trainable rollouts now exists. nemo_gym/token_id_capture/consumer.py:191: mask = mask or not any(item.get("generation_token_ids") for item in response.get("output", [])) makes an empty delivery non-trainable unconditionally (this safety net is consumer.py:191, not PR #3974, whose scope is making attributed masking optional). delivery.py:60 rollout_carries_token_ids; docs state it sets mask_sample: true (external-agent-harnesses.mdx:37). SWE empty-final tokens preserved (#3823). responses_converter.py:120 still emits a plain assistant message when token_information is None. Remaining: the literal KeyError hardening lives in NeMo-RL (must honor mask_sample); SAP's exact scenario was never reproduced/closed.
Proposed fix
- Verify on main that a tokenless custom-agent turn yields
mask_sample: true. 2. Confirm NeMo-RL honorsmask_sample/ tolerates missingtoken_ids; if not, the crash-closing fix is in NVIDIA-NeMo/RL (external). 3. The only actionable Gym-side item is an optional native-path guard inresponses_converter.pyso a training rollout never emits an unmasked tokenless assistant turn, plus a unit test mirroringswe_agents/tests/test_empty_sampled_trajectory.py.
Validation
Re-run QA: testcases/integrations/training_contract.py, real_vllm_training_contract.py, token_capture_auxiliary_requests.py, nemo_rl_recipe_wiring.py. Gym units: tests/unit_tests/test_token_id_capture.py, test_terminal_attribution.py, test_rollout_collection.py.
Triage
Difficulty 4/5 — cross-repo contract (Gym mask vs NeMo-RL KeyError), reproduction needs vLLM/GPU + a trainer. Effort ~12 h. Needs GPU/model: yes. External dependency: NeMo-RL (NVIDIA-NeMo/RL) rollout postprocessing.
Reviewer notes
Verifier confirmed partially_fixed and difficulty 4 (high confidence); all QA testcase names verified. Corrections applied: the unconditional empty-delivery safety net is reattributed to consumer.py:191 (not #3974, whose real scope is making attributed masking optional); stated plainly that the sole actionable Gym-side item is the optional responses_converter.py guard + unit test, while the crash-closing fix belongs to NeMo-RL. (Estimate 4 stored as the team's nearest point, L.)
Activity