Skip to content

fix(awq): keep one in eight single-row quotas at the sink position (#5310) - #5315

Merged
Qubitium merged 1 commit into
mainfrom
fix/awq-sink-share-5310
Nov 19, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/awq-sink-share-5310

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Fixes #5310. Follow-up to #5289 (which fixed #5265).

Problem

#5289 moved every single-row token quota to the batch centre. That fixed the
Llama collapse (#5265: 91.7 -> 22.5) but removed the BOS/attention-sink rows
from the sample entirely, and the AWQ scale search then never saw the outlier
channels those positions carry: Qwen2.5-0.5B at batch_size=1 measured 28.01
PPL against 24.92 at batch_size=4 and 24.82 for RTN.

Both extremes are bad, so the choice must not be all-or-nothing.

Change

AWQProcessor._single_token_row(length, ordinal) keeps row 0 for one
single-row quota in eight
and the batch centre for the rest, in both branches
(quota == 1 and retained_tokens < batch_count). The ordinal counts
single-row quotas in batch order, so the sink rows are spread over the
calibration stream instead of clustering at its start.

Tests

tests/test_awq_token_row_position_5265.py now bounds the sink share from both
sides instead of forbidding position 0:

  • test_single_row_quota_keeps_a_bounded_sink_share -- 64 short documents keep
    exactly 8 sink rows (batches 0, 8, 16, ...), the other 56 keep the centre.
  • test_single_row_quotas_bound_the_sink_share -- sweeps lengths and budgets;
    the share stays in [1%, 50%].
  • test_budget_below_batch_count_mixes_sink_and_centre and
    test_a_single_batch_still_keeps_its_first_row.

4 of these fail on main (0% sink share); the pre-#5289 code (100%) also fails
the two-sided bound. test_awq_token_rows_bounded_capture_5137 and
test_awq_weight_mean expectations return to row 0 for their single-batch plans.
Docs (docs/awq-calibration-aggregation.md) describe the 1/8 rule.

Relevant suites: 200 passed, 1 skipped. The end-to-end PPL numbers above are the
issue's measurements of this exact rule; the plan-level share is what the tests
pin here (512 -> 64 sink rows).

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