Repository navigation
test(awq): guard #5085's position cap on the capture-time token-row plan (#5215) - #5220
Merged
Merged
Conversation
…lan (#5215) #5175 moved token-row sampling from replay (AWQProcessor._pack_token_rows) to capture (_token_row_plan_for_module), so the #5085 regression test's spy was never called and its two integration tests were red on main while the cap itself had no working guard. Spy on the plan that now decides the replay length and assert plan.max_tokens and sum(plan.quotas) stay within max_position_embeddings; the batch-of-two case also proves the cap fires (uncapped budget 80 > 64). The batch-of-one control now uses a single document so it asserts that every row is kept, and a direct unit test keeps the legacy packer's cap covered.
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.
Fixes #5215.
Problem
#5175 moved token-row sampling from replay (
AWQProcessor._pack_token_rows) to capture (_token_row_plan_for_module/_compute_token_row_quotas), sotests/test_awq_gpt_neo_packed_replay_5085.py's_pack_token_rowsspy was never called. Two of its tests were red onmain:The product behaviour was still correct, but #5085's position cap had no working guard: dropping
_cap_token_rowsfrom_token_row_plan_for_modulewould not turn anything red.Fix
_token_row_plan_for_moduleinstead: assertplan.max_tokens <= max_position_embeddingsandsum(plan.quotas) <= max_position_embeddings.max(plan.budget) > _LIMITwhilemax(plan.max_tokens) == _LIMIT, proving the cap is what keeps the replay legal.plan.quotas == [40])._pack_token_rowscap for the no-provenance fallback.Verification
pytest tests/test_awq_gpt_neo_packed_replay_5085.py -q→ 6 passed (was 2 failed, 3 passed)._cap_token_rowsfrom_token_row_plan_for_module):test_awq_gpt_neo_batch_of_two_quantizes_within_the_limitfails as intended.ruff checkclean.