Repository navigation
fix(pipeline): drain eval pipeline naturally to prevent batch leak - #314
Merged
shijieliu merged 1 commit intoMar 2, 2026
Merged
Conversation
…tch contamination The prefetch pipeline (PrefetchTrainPipelineSparseDist) keeps 2 batches in its internal queue (_batch_i, _batch_ip1). When eval uses a truncated iterator (max_eval_iters < len(eval_loader)), the pipeline never drains, leaving stale eval batches that contaminate the first training iterations after eval. Fix: limit the eval iterator to exactly max_eval_iters via islice and switch the eval loop to StopIteration-driven (while/try), so the pipeline exhausts its iterator and drains its batch queue naturally. Also remove the now-unnecessary flush_pipeline() method from all pipeline classes.
shijieliu
approved these changes
Mar 2, 2026
Contributor
Greptile SummaryFixed a subtle but critical pipeline contamination bug where truncated eval iterations ( The fix has two key changes:
This allows the pipeline to drain its internal batch queue ( Confidence Score: 5/5
Important Files Changed
Last reviewed commit: cbb7e21 |
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.
The prefetch pipeline (PrefetchTrainPipelineSparseDist) keeps 2 batches in its internal queue (_batch_i, _batch_ip1). When eval uses a truncated iterator (max_eval_iters < len(eval_loader)), the pipeline never drains, leaving stale eval batches that contaminate the first training iterations after eval.
Fix: limit the eval iterator to exactly max_eval_iters via islice and switch the eval loop to StopIteration-driven (while/try), so the pipeline exhausts its iterator and drains its batch queue naturally.
Also remove the now-unnecessary flush_pipeline() method from all pipeline classes.
Description
Checklist