Repository navigation
Conversation
…eLength verl recipe publishers round the SequenceLength label down to a power of 2 for the hub enum and publish the exact token budget as the length params' override max, so enforcing the label rejected recipes' own defaults (verl-grpo-rlvr-gemma-4-e4b-it-lora: 16384 + 4096 against a 20480 budget labelled "16K"). A length param's max is now the ceiling only when it rounds down to the label and every such param agrees on it; otherwise the label stays the ceiling, so a generic bound such as llmft's 131072 on a "4K" recipe, or params that disagree, never loosen the check. X-AI-Tool: Kiro X-AI-Prompt: Fix the SDK length check rejecting RLVR recipe defaults on Gemma 4 E4B without loosening it for other recipe families
There was a problem hiding this comment.
🤖 AI code review
This PR refines the sequence-length ceiling used by validate_length_constraints(). Instead of always treating the recipe's SequenceLength label (rounded to a power of 2) as the ceiling, _sequence_length_ceiling() now adopts a length param's declared max as the budget when it rounds down to the label (label <= max < 2*label) and all such params agree; otherwise it falls back to the label. This fixes verl recipes (e.g. Gemma-4 GRPO RLVR) whose own defaults were rejected before submission. The change is well-scoped, the options_dict variable is in scope at the call site, imports (Dict, Any, Optional) are present, and it is covered by targeted unit tests plus an end-to-end case. I found no correctness, security, or backward-compatibility problems.
Reviewed commit a6d5e98. Automated review; verify before acting.
Summary
validate_length_constraints()enforced the recipe'sSequenceLengthlabel as the prompt+response ceiling. verl recipe publishers round that label down to a power of 2 for the hub enum and publish the exact token budget as the length params' overridemax, so the SDK rejected verl recipes' own defaults. Example:verl-grpo-rlvr-gemma-4-e4b-it-loradefaults to 16384 + 4096 against a 20480-token budget labelled "16K", so every RLVR job that kept the defaults failed before submission.A length param's
maxis now the ceiling only when it rounds down to the label (label <= max < 2 * label) and every such param agrees on it. Any othermaxis not the recipe's budget, and params that disagree are not trusted, so in both cases the label stays the ceiling:maxdataset_max_len131072SequenceLengthThe sum check itself is unchanged: prompt + response over the ceiling is still rejected.
Testing
_sequence_length_ceilingcovering the verl budget, a generic max outside the label's bucket (llmft), a max below the label, params that disagree, and a missing label; plus an end-to-end case using the Gemma recipe's real override shape (defaults pass, 16384 + 4097 is rejected).test_finetune_utils.py,test_common.py,test_rlvr_trainer.py,test_rlaif_trainer.py: 242 passed, 6 skipped.sagemaker-trainunit suite: 3508 passed, 19 skipped, 4 failed. The 4 failures are intraining_session/test_clients.py, fail identically onmaster, and come from the test host having nodefaultAWS profile.Catalog diff. Old and new ceilings computed with the real functions for every recipe in the us-west-2
SageMakerPublicHub(767 models, 437 recipes with override params):verl-*, new ceiling = the length params' declaredmaxLive hub probe.
RLVRTrainerbuilt forhuggingface-vlm-gemma-4-e4b-itLoRA (hub 1.8.3) with default lengths, thenvalidate_length_constraints()called directly:masterraises20480 exceeds ... (16384); this branch passes; this branch withmax_response_length=4097raises20481 exceeds ... (20480).GPU run. One serverless RLVR LoRA job on
verl-grpo-rlvr-gemma-4-e4b-it-lorawith this branch and the recipe's default lengths (16384 + 4096),max_epochs=1.train(dry_run=True)passed, then the job completed all 10 steps with no length assert or OOM, and registered its model package. The container ran withdata.max_prompt_length16384,max_response_length4096, vLLM--max_model_len 20480andppo_max_token_len_per_gpu20480. Billable time was 2315 s.