Skip to content

[TEST] Regression from #5175 (fix of #5137): test_awq_gpt_neo_packed_replay_5085 red on main - its _pack_token_rows spy is never called now that token rows are sampled at capture, so #5085's position cap has no working guard #5215

Closed

Description

@Qubitium

Found on main @ 396b5f0 (also unchanged on 63da42c), CPU / RTX 4090 host, torch 2.15.

What is wrong

#5175 (fix of #5137) moved token-row sampling from replay time (AWQProcessor._pack_token_rows) to capture time (_record_input_feature -> _token_row_plan_for_module / _compute_token_row_quotas). The dense path no longer calls _pack_token_rows at all.

tests/test_awq_gpt_neo_packed_replay_5085.py (added by #5120 for #5085) proves the GPT-Neo position cap by monkeypatching AWQProcessor._pack_token_rows with a spy and asserting on the packed lengths it saw. Since #5175 the spy is never called, so two of its tests are red on every host:

$ pytest -q tests/test_awq_gpt_neo_packed_replay_5085.py
FAILED tests/test_awq_gpt_neo_packed_replay_5085.py::test_awq_gpt_neo_batch_of_two_quantizes_within_the_limit
    assert seen, "the search must pack token rows"   ->  assert []
FAILED tests/test_awq_gpt_neo_packed_replay_5085.py::test_control_batch_of_one_keeps_every_row
========================= 2 failed, 3 passed =========================

On 0b1aea0f5^ (just before #5175) the same file gives 5 passed.

The product behaviour is still correct: I quantized a random tiny GPT-Neo (max_position_embeddings=128, 2 layers) with AWQConfig(bits=4, group_size=128) and CalibrationConfig(batch_size=4) on 32 C4 docs. On main the replayed features are (1, 128, 256) / (1, 128, 1024), at the limit, and no scale-group fallback fires. Before #5120 the same run raised The size of tensor a (128) must match the size of tensor b (512). But the regression test for #5085 no longer checks anything on the path that runs. The _cap_token_rows call in _token_row_plan_for_module (and in the streaming reservoir's budget_cap) could be dropped and nothing would go red, because the file is already red.

Suggested fix

Make the #5085 test observe the path that runs now. For example, spy on _token_row_plan_for_module (assert plan.max_tokens <= limit), or assert on the per-module retained row count / the shape of the features _layer_input_features returns (shape[-2] <= max_position_embeddings). Keep the existing _pack_token_rows unit coverage only where that function is still used.

Test that should have caught it

#5175's CI run should have run tests/test_awq_gpt_neo_packed_replay_5085.py. It is a CPU test (@pytest.mark.cpu), so it fails on CPU-only runners too. The AWQ CPU suites were moved out of pull-request CI in #5117, which is probably why it was missed. At least the AWQ regression files touched by a PR's diff should run in PR CI.

Severity

Low (test-only). Two tests are red on main, and #5085's position cap has no working regression guard.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-fb5145b84190 is no longer working on this issue.

    The issue is free to claim.

    Fixed by #5220.

  2. added a commit that references this issue on Nov 18, 2026
  3. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    Same root cause, one more red file on main @ 396b5f0 (CPU, no GPU needed): #5175 added a row_counts= keyword to AWQProcessor._pack_token_aligned_kwargs (gptqmodel/looper/awq_processor.py:2430, call site row_counts=row_counts). The spy in tests/test_awq_hash_moe_kept_rows_5015.py:88 (def spy(self, provenance, batch_indices, *rest)) does not accept keyword arguments, so 3 of its tests fail:

    FAILED tests/test_awq_hash_moe_kept_rows_5015.py::test_packed_input_ids_follow_the_padded_kept_grid
    FAILED tests/test_awq_hash_moe_kept_rows_5015.py::test_unpadded_single_row_batches_are_unaffected
    FAILED tests/test_awq_hash_moe_kept_rows_5015.py::test_packed_input_ids_follow_the_kept_grid_with_sinks_excluded
    E   TypeError: _run_awq.<locals>.spy() got an unexpected keyword argument 'row_counts'
        gptqmodel/looper/awq_processor.py:2431
    

    So #5015's kept-row guard is also off until the spy forwards **kwargs (def spy(self, provenance, batch_indices, *rest, **kw): out = original(self, provenance, batch_indices, *rest, **kw)). This file is in the AWQ CPU list that #5117 moved out of PR CI, which is probably why neither break was seen.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions