Repository navigation
Build real GOLD trainers in the on-policy generation tests - #7613
Merged
Merged
Conversation
22 tasks done
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
cmpatino
approved these changes
Oct 12, 2026
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.
This PR runs the GOLD on-policy generation tests on a real trainer, its real tokenizer and model, instead of a trainer built with
__new__, hand-written tokenizers and a scripted model.Part of #7565.
Motivation
These tests skipped
__init__, set the attributes the method under test read by hand, and decoded with fake tokenizers that mapped a few token ids to letters, so they could not notice a change in how the trainer is set up or in how a real tokenizer decodes special and pad tokens. One of them replaced the trainer's own_process_completions_to_bufferto capture its arguments. Only vLLM cannot run in the test environment.Changes
unwrap_model_for_generation._process_completions_to_buffer's arguments now checks the buffered inputs it produces.Note
Low Risk
Test-only refactor with no production code changes; slightly heavier tests due to real model init and generation.
Overview
Refactors GOLD on-policy generation tests to exercise a fully constructed
GOLDTrainer(tiny Qwen2 student/teacher + zen dataset) instead of__new__shells with hand-rolled tokenizers and dummy models.Adds shared helpers
_gold_trainer,_gold_vllm_trainer, andRecordingVLLMGenerationso vLLM is stubbed while everything else stays real. Tests now derive token ids and expected prompt/completion text from the trainerβs tokenizer, call instance methods (_process_completions_to_buffer,_generate_on_policy_for_slices,_generate_non_vllm_for_slices), and assert buffered tensors/text logs end-to-end. The non-vLLM path no longer patchesunwrap_model_for_generationor fakesmodel.generate; the completion-buffer test asserts outputs instead of intercepting_process_completions_to_bufferarguments.Reviewed by Cursor Bugbot for commit 19d108e. Bugbot is set up for automated code reviews on this repo. Configure here.