Skip to content

fix(config): reject exclude_attention_sinks on paths that ignore it (#4447) - #4525

Merged
Qubitium merged 1 commit into
mainfrom
fix/attention-sink-coverage-4447
Nov 17, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/attention-sink-coverage-4447

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

Fixes #4447. Every method/path now either implements exclude_attention_sinks or rejects it, and checkpoint metadata always reflects what actually ran.

Path Decision
GPTQ top-level accept, mask runs, meta true
GPTQ + top-level GPTAQ/FOEM reject
GPTQ dynamic sinks only apply per-module, mask runs, rule serialized
GPTQ dynamic GPTAQ/FOEM + sinks reject
QQQ (top-level and dynamic) reject
VPTQ (top-level and dynamic) reject
AWQ / ParoQuant (top-level and dynamic) reject
EXL3 (top-level and dynamic) reject
MACaQ / FP8 / NF12 / TT-blockfloat / bitsandbytes / GGUF reject

Key fix: rejecting at construction made pre-fix VPTQ/QQQ checkpoints unloadable, because from_quant_config lifts meta.exclude_attention_sinks into the constructor. Load is now lenient: unsupported legacy metadata is coerced to false with a warning and re-saved truthfully; explicit construction still raises.

Validation

  • pytest tests/test_attention_sink_config_coverage_4447.py -q → 37 passed (includes an nsamples A/B proof that the dynamic copy changes the Hessian)
  • pytest tests/test_gptq.py -q → 74 passed, 3 skipped
  • config suites → 79 passed
  • ruff check clean

Residual: directly constructing GPTAQ/FOEM after mutating qcfg.exclude_attention_sinks bypasses the processor clone guard; load-time repair is warn-and-coerce by design.

Resolves #4447.

…4447)

The attention-sink mask is only implemented by the plain GPTQ Hessian
path, but the flag was accepted (and serialized as true) by VPTQ, by
dynamic overrides that were never applied, by per-module GPTAQ/FOEM
rules, and by the AWQ/ParoQuant factory.

- mark GPTQConfig as mask-capable; QQQ/VPTQ reject the flag explicitly
- copy and validate dynamic exclude_attention_sinks in the module clone
- reject dynamic GPTAQ/FOEM rules that would ignore the mask, re-check
  after the clone applies mutable dynamic edits
- reject the flag in the factory for every method without the mask
  (AWQ, ParoQuant, EXL3, MACaQ, FP8, NF12, TT-blockfloat, bnb, GGUF)
- keep legacy checkpoints loadable: repair metadata that claims true on
  a path that never masked, and warn instead of raising
@Qubitium
Qubitium merged commit ede121c into main Nov 17, 2026
9 checks passed
@Qubitium
Qubitium deleted the fix/attention-sink-coverage-4447 branch November 17, 2026 00:59
Qubitium added a commit that referenced this pull request Nov 17, 2026
…mask (#4393)

Move the attention-sink opt-in from `GPTQConfig.exclude_attention_sinks` to
the calibration config, `quantize(..., calibration_exclude_attention_sinks=True)`
(`CalibrationConfig.exclude_attention_sinks`), and apply it once, in the
shared calibration keep-mask, so every calibration method drops the same rows.

Rule: every attended BOS token is excluded (the leading one, after left or
right padding, and each document-boundary BOS of concatenated calibration).
Nothing else is: a tokenizer without a BOS token (Qwen2/2.5/3) keeps every
row and its checkpoint is bitwise identical to the default run (#4459).

- `LoopProcessor.calibration_keep_mask` edits the padding mask per batch;
  `_mask_tls.padding_value` keeps the padding-only mask for forward-visible
  consumers (MoE padding zeroing, NVFP4 amax, EXL3/DeepSeek-V4 router
  evidence). Token totals and the zero-sample threshold use the retained rows.
- Consumers: GPTQ/GPTAQ/FOEM/native capture, QQQ, MACaQ, EXL3 capture, AWQ
  features and token-row structure, calibrated FP8 GSQ. Natively routed
  experts and VLM batches whose sequence cannot be placed keep their rows.
- VPTQ rejects the option (PPL 4.5-4.7x worse on Llama-3.2-1B/-Instruct);
  ParoQuant and staged GSQ reject it; `quantize()` rejects a
  `dynamic[...].exclude_attention_sinks` rule.
- Remove the GPTQConfig field and its per-method plumbing from #4440,
  #4525, #4526 and #4610 (`attention_sink_mask_supported`, factory/dynamic/load
  sanitizers, `GPTQ._attention_sink_row_keep`, `attention_sink_bos_flags`).
  `GPTQConfig(exclude_attention_sinks=...)` now raises `TypeError`.
- Supersede the GPTQ-only #4568 fix (#4610): the BOS positions are resolved
  from the prepared `input_ids` and `tokenizer.bos_token_id` when the
  processor is built, before `release_calibration_dataset()`, for every
  calibration method; #4610's per-batch decision cache in `GPTQProcessor`,
  its dynamic gating and its Hessian-share signature field are removed.
- Provenance: `meta.calibration_exclude_attention_sinks: true` only when on.
- test_llama3_2: forward the switch through the new kwarg and re-baseline the
  slow metrics for the new rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium added a commit that referenced this pull request Nov 17, 2026
…mask (#4393) (#4663)

* feat(calibration): exclude attention sinks in the shared calibration mask (#4393)

Move the attention-sink opt-in from `GPTQConfig.exclude_attention_sinks` to
the calibration config, `quantize(..., calibration_exclude_attention_sinks=True)`
(`CalibrationConfig.exclude_attention_sinks`), and apply it once, in the
shared calibration keep-mask, so every calibration method drops the same rows.

Rule: every attended BOS token is excluded (the leading one, after left or
right padding, and each document-boundary BOS of concatenated calibration).
Nothing else is: a tokenizer without a BOS token (Qwen2/2.5/3) keeps every
row and its checkpoint is bitwise identical to the default run (#4459).

- `LoopProcessor.calibration_keep_mask` edits the padding mask per batch;
  `_mask_tls.padding_value` keeps the padding-only mask for forward-visible
  consumers (MoE padding zeroing, NVFP4 amax, EXL3/DeepSeek-V4 router
  evidence). Token totals and the zero-sample threshold use the retained rows.
- Consumers: GPTQ/GPTAQ/FOEM/native capture, QQQ, MACaQ, EXL3 capture, AWQ
  features and token-row structure, calibrated FP8 GSQ. Natively routed
  experts and VLM batches whose sequence cannot be placed keep their rows.
- VPTQ rejects the option (PPL 4.5-4.7x worse on Llama-3.2-1B/-Instruct);
  ParoQuant and staged GSQ reject it; `quantize()` rejects a
  `dynamic[...].exclude_attention_sinks` rule.
- Remove the GPTQConfig field and its per-method plumbing from #4440,
  #4525, #4526 and #4610 (`attention_sink_mask_supported`, factory/dynamic/load
  sanitizers, `GPTQ._attention_sink_row_keep`, `attention_sink_bos_flags`).
  `GPTQConfig(exclude_attention_sinks=...)` now raises `TypeError`.
- Supersede the GPTQ-only #4568 fix (#4610): the BOS positions are resolved
  from the prepared `input_ids` and `tokenizer.bos_token_id` when the
  processor is built, before `release_calibration_dataset()`, for every
  calibration method; #4610's per-batch decision cache in `GPTQProcessor`,
  its dynamic gating and its Hessian-share signature field are removed.
- Provenance: `meta.calibration_exclude_attention_sinks: true` only when on.
- test_llama3_2: forward the switch through the new kwarg and re-baseline the
  slow metrics for the new rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(gptq): keep process_batch signature compatible with its overrides

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant