fix(rollout): stop on every EOS id in the model's generation config #9161
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.65) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 336 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.348
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.065
Real PR Conversation Timeline
1 comments
"Review active on #9161"
general
weight: 0.35
delock
Fixes #9157.
Summary
HybridEngineRolloutended responses only on the tokenizer'seos_token_id, so a model whosegeneration_configlists more EOS ids (Qwen3, Llama 3.1) kept decoding past them tomax_new_tokens. Every path now stops on the tokenizer's id and every id ingeneration_config.eos_token_id.Changes
_eos_token_ids()returns the tokenizer's EOS id, then the generation config's ids, without duplicates or negative ids (generate()ignores a list that holds one)._generation_kwargs(generate()and the ZeRO-3 stopping criterion),_pad_after_eoson the static path,_is_eosin both continuous loops, and every EOS check of_generate_graph. A single id is still passed togenerate()as a scalar.Behavior change: setting only
tokenizer.eos_token_idto an id that never occurs no longer disables EOS when the generation config lists one; setgeneration_config.eos_token_id = Noneas well. The v1 test models now do.Tests
test_eos_token_ids_merge_tokenizer_and_generation_config(an id, a list, overlap, no config, a negative tokenizer id);test_continuous_rows_end_on_a_generation_config_eos_id;test_non_zero3_generation_stops_on_every_eos_id, replacingtest_non_zero3_generation_uses_native_eos, checks thatgenerate()gets the list and that a row ends at its first id of either kind.test_every_path_stops_on_a_generation_config_eos_idon static, static graph, continuous and continuous graph, againstgenerate()with the same generation config. All four cases fail on master.Validation
Hardware and software: 2× NVIDIA A100-SXM4-40GB (driver 595.71.05), PyTorch 2.14.1+cu130, CUDA 13.0, Python 3.12.15, Transformers 5.19.0.
| Command | Result |
|---|---|
|
pytest tests/unit/v1/test_hybrid_engine_rollout_v1.py(2 GPUs) | 50 passed, 1 skipped (opt-in pretrained test) ||
pytest tests/unit/runtime/rollout| 195 passed, 3 skipped (two 4-GPU classes, one model download) |Reproduction on Qwen3-0.6B, fp32 greedy, with an extra EOS id the model generates midway: master generates the full 32 tokens on every path; this PR stops each row where
generate()does (3, 32, 4, 14 tokens) on all four paths.Performance: one
torch.isinover a few ids per step in place of an equality check; not measured separately.Compatibility matrix: single GPU and AutoTP 2 with ZeRO 0, fp32, on the paths above; ZeRO-3 is covered by the CPU tests of the stopping criterion, not on GPU.
AI assistance
This PR was written with AI assistance (Claude Code). The submitter reviewed every changed line and ran the tests above.