Repository navigation
fix(hf): materialize 3-bit symmetric qzeros + fix INT3 legacy fixture (#6375) - #6392
Merged
Merged
Conversation
added 3 commits
November 29, 2026 13:15
The HF bridge defers symmetric qzeros and regenerates them from the constant zero point. qzeros_symmetric_word() only defines a single constant word for 2/4/8-bit continuous packing, so every 3-bit symmetric HF load raised after #6386. Pack the constant 3-bit zero point with the 10-1-10-1-10 layout instead.
Qubitium
marked this pull request as ready for review
November 29, 2026 13:31
This was referenced Nov 29, 2026
Qubitium
added a commit
that referenced
this pull request
Nov 29, 2026
* test(qzeros): pin the symmetric-qzeros state machine invariants Six changes landed on the symmetric ``qzeros`` path in one day (#6388, #6392, #6391, #6395, #6409 and the pending #6157 normalization). Each was verified on its own; nothing pinned the combination, and a later edit can satisfy one fix while breaking another. The state machine has three markers (``_HF_LEGACY_QZEROS``, ``_HF_CHECKPOINT_SYM``, ``_HF_DEFER_SYM_QZEROS``) and two word encodings, selected by ``_load_target_qzeros_format()``. The tests assert: - a 32-aligned legacy projection never defers, and a real floor-width mismatch always does (#6409 / #6396); - an asymmetric floor-width checkpoint is refused, never silently wrong; - a deferred module materializes to the standard shape with a resolved layout that agrees with the one the kernel decodes; - materialization is idempotent across 2/3/4/8-bit; - the deferral marker and a materialized buffer are mutually exclusive; - a float ``qzeros`` buffer (int4pack affine offsets) is never filled with a packed word -- skipped until the #6157 normalizer exists; - a clean checkpoint's word survives the load, and every pre- and post-#2983 producer lands on the same decoded zero point. ``qzero_format()`` is deliberately not read as a decode answer before ``_qzeros_format_established``: every kernel is ``REQUIRES_FORMAT_V2``, so the constructor placeholder ``1`` disagrees with the decoded ``2`` until a load resolves it (#4377). That distinction is the whole reason the first #6157 draft corrupted clean checkpoints. Test-only. Verified 49 passed / 13 skipped on main (a4471c5) and 50 / 12 with #6419 applied; 68 passed / 17 skipped together with the four existing qzeros test files, so there is no global-state pollution. Every skip is a kernel-geometry or environment gate with a precise reason. * test(qzeros): spell out the unreachable return after a pytest.skip ``_legacy_module_or_skip`` ended with a bare ``pytest.skip(...)`` call, which reads as an implicit ``return None`` to static analysis and made CodeQL flag the function for mixing explicit and implicit returns. ``pytest.skip`` raises, so the added return is unreachable; it exists only to make every non-exceptional path explicit, and the comment says so. Behaviour unchanged: 49 passed, 13 skipped, identical to before. --------- Co-authored-by: agent <agent@local>
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.
Follow-up to #6388
#6388 fixed the pre-7.0 INT3 v1 qzero corruption and added
tests/test_int3_legacy_qzeros_6375.py. It merged onto a main that already contained #6386, and two #6386 interactions leave the new test red on main:WordLeveltokenizer has only special tokens, so the new tokenizer-usability guard rejects it (cannot encode ordinary text). Add ordinary word tokens to the vocabulary._materialize_hf_sym_qzeros(), butqzeros_symmetric_word()only defines a single constant word for 2/4/8-bit continuous packing. Every 3-bit symmetric HF load raiseslegacy GPTQ qzeros padding is only defined for 2/4/8-bit continuous packing, got bits=3. Pack the constant 3-bit zero point with the 10-1-10-1-10 layout instead.The PR also adds coverage for the plain-HF re-save retag path introduced by #6388.
Fixes #6375
Verification
tests/test_int3_legacy_qzeros_6375.py(11 tests) passes on merged main1615accf9with this PR: 11 passed.