Skip to content

Optimize asymmetric 2-bit zero-point search - #3013

Merged
Qubitium merged 1 commit into
mainfrom
agent/optimize-w2-zero-point
Aug 11, 2026
Merged

Optimize asymmetric 2-bit zero-point search#3013
Qubitium merged 1 commit into
mainfrom
agent/optimize-w2-zero-point

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

  • evaluate both adjacent integer zero-point orientations during asymmetric 2-bit MSE range search
  • select the scale and zero-point pair with the lower configured reconstruction objective
  • add a synthetic regression covering a distribution where the alternate orientation reduces error

Root cause

An affine 2-bit grid has four codes. With zero point 2 its reconstructed levels are proportional to [-2, -1, 0, 1]; with zero point 1 they are proportional to [-1, 0, 1, 2].

The existing range search rounded the ideal affine zero point before measuring reconstruction error. At two bits, that rounding decision chooses which side receives the fourth level, so range geometry could select the orientation independently of the MSE objective.

For each scale candidate, this change retains the rounded zero point and also evaluates the other adjacent legal integer zero point. The previous candidate remains in the search set, so the selected local objective cannot become worse.

Scope

The additional candidate is restricted to bits=2, sym=False, non-groupwise affine quantization when MSE range search is enabled. Symmetric quantization, other bit widths, groupwise signed quantization, configuration, packing, and serialized formats are unchanged.

Validation

  • pytest -q tests/test_gptq.py: 3 passed, 4 accelerator-only tests skipped
  • synthetic regression selects zero point 1 and has lower MSE than the prior zero-point-2 candidate restriction
  • critical Ruff rules (E9,F63,F7,F82) passed on changed files
  • Python compilation and git diff --check passed

@Qubitium
Qubitium marked this pull request as ready for review August 11, 2026 06:55
@Qubitium
Qubitium merged commit fe8aecb into main Aug 11, 2026
6 checks passed
@Qubitium
Qubitium deleted the agent/optimize-w2-zero-point branch August 11, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant