[qoc] Extract pad_batch() into a helper to training_batch.py#1527
Merged
CharlieFRuan merged 2 commits intoNovaSky-AI:mainfrom Apr 17, 2026
Merged
[qoc] Extract pad_batch() into a helper to training_batch.py#1527CharlieFRuan merged 2 commits intoNovaSky-AI:mainfrom
pad_batch() into a helper to training_batch.py#1527CharlieFRuan merged 2 commits intoNovaSky-AI:mainfrom
Conversation
This was referenced Apr 17, 2026
CharlieFRuan
added a commit
that referenced
this pull request
Apr 19, 2026
Rebase PR #1479 onto current main (post-PRs #1507/#1526/#1527/#1529). The original E2E fix's `pad_batch` change is dropped since #1529's prompt-based mini-batch boundaries removed the need to pad to `mini_batch_size * n_samples`. - merge_stepwise_output() in trainer_utils.py collapses multi-turn step-wise GeneratorOutput sequences into single sequences when consecutive turns share a common prefix, reducing training cost from O(T^2) to O(T). - trainer.py: call merge before extracting generator fields, update uids from merged trajectory_ids, emit generate/num_seq_{before,after}_merge. - Add generator.merge_stepwise_output config flag. - run_search.sh: MERGE_STEPWISE env var. - 16 CPU-only tests covering all 3 merging cases, partial merges, and validation asserts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In preparation for merging in #1483, where we will pad at mini batch level, we extract
pad_batch()into a helper function intraining_batch.pythat is TrainingInputBatch-in and TrainingInputBatch-out.Note that for
trainer.py,pad_size > 0only when step-wise training as of now.The tinker engine codepath also has the same logic, where now can be de-duplicated.
Added unit tests for this method.