Conversation
With probability --never_give_up, an unsolved zero-std prompt group is requeued under a retry-suffixed prompt id instead of being filtered. Its completions are buffered across accumulation calls until a later attempt in the chain has learning signal, at which point the attempts are merged and the group's advantage baseline is taken over the whole chain and re-anchored on the positive (max-reward) samples. - New open_instruct/data_loader_utils.py: chain-id/retry-suffix helpers, NeverGiveUpAccumulationState + pending-state pop/store with age filtering, the "accept only when strictly better" rule, GenerationResult merge/select, and compute_grouped_advantages (variable group sizes + filtered NGU baseline + always-on anchor-positives rescaling). - data_loader.py: split the monolithic process_group into a pure process_group + maybe_dont_resample_prompt + maybe_filter_group + maybe_replenish_prompt pipeline; Group/BatchStatistics carry per-group sample/baseline counts; make_batch_from_groups no longer assumes uniform generation_config.n; the DataPreparationActor owns one NGU state and routes NGU runs through compute_grouped_advantages (non-NGU path unchanged). - Config: never_give_up, maintain_pending_ngu_age, maintain_pending_ngu_completions. - scripts/train/debug/never_give_up_single_gpu.sh smoke test. - Unit tests for the helpers and maybe_filter_group. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MgMKAvj3BM4HuZuZwCSAck
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MgMKAvj3BM4HuZuZwCSAck
This branch has not been deployed
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.
What
Adds the never_give_up (NGU) GRPO retry mechanism, ported clean off the long-lived
ngubranch (only the core mechanism + its advantage baseline — nongu_seq_multipliercontinuations, noreinforce_ada_est, nobatch_by=completions, no utilization-metric changes).With probability
--never_give_up, an unsolved zero-std prompt group (one that would otherwise be filtered byfilter_zero_std_samples) is requeued under a retry-suffixed prompt id ({epoch}_{index}_1,_2, ...) instead of being dropped. Its completions are buffered across accumulation calls until a later attempt in the chain finally has learning signal, at which point:Two design choices from the
ngubranch are hardcoded here (with explaining comments) rather than exposed as knobs:How
open_instruct/data_loader_utils.py: chain-id / retry-suffix helpers,NeverGiveUpAccumulationState+ pending-state pop/store with model-step age filtering, the accept rule,GenerationResultmerge/select, andcompute_grouped_advantages(variable group sizes, filtered NGU baseline, always-on anchor-positives rescaling).data_loader.py: the monolithicprocess_groupis split into a pureprocess_group+maybe_dont_resample_prompt+maybe_filter_group+maybe_replenish_promptpipeline.Group/BatchStatisticscarry per-groupsample_count/baseline_sample_count/baseline_reward_sum/attempt_count;make_batch_from_groupsno longer assumes a uniformgeneration_config.nper group.DataPreparationActorowns one NGU state and routes NGU runs (never_give_up > 0) throughcompute_grouped_advantages. The non-NGU path is unchanged (never_give_up == 0keeps the originalscores.reshape(-1, n)math, byte-for-byte).--never_give_up(float prob),--maintain_pending_ngu_age,--maintain_pending_ngu_completions.never_give_up > 0is rejected together withmask_truncated_completions(would desync merged-group counts).no_resampling_pass_rateset, the "exclude this index" call now happens just before replenishing rather than just after — no training-behavior change in practice.Tests
open_instruct/test_data_loader_utils.py(new): chain ids, accept rule, pending-state round-trip / age filtering, andcompute_grouped_advantages— including a regression test that it reproduces the old inlinereshapeadvantages for uniform groups.open_instruct/test_data_loader.py:maybe_filter_group— zero-std filter with NGU off, requeue + buffer with NGU on, and accept + merge (sample_count/baseline_sample_count== 2n,attempt_count== 2).uv run pytest open_instruct/test_data_loader.py open_instruct/test_data_loader_utils.py— green.make style && make quality— ruff clean;ty checkunchanged frommain(51 pre-existing).Smoke test
scripts/train/debug/never_give_up_single_gpu.sh(=single_gpu_on_beaker.sh+--never_give_up 1.0).Runs:
GPU_TESTS=bypass