Repository navigation
test(protocol): assert the exclusion contract, not the emitted dynamic key - #6442
Merged
Merged
Conversation
…c key `_compile_negative_match_dynamic` prefixes every `-:` selector with `.*(?:...)` because protocol selectors are evaluated with `pcre.search` while `dynamic` rules are start-anchored (`pcre.match`); without the prefix a selector such as `down_proj` excludes in the protocol and quantizes in the compiled config (#4197). The compiled key is therefore not textually equal to the raw selector. The three Llama-3.2 protocol integration tests still compared the whole `cfg.dynamic` dict against `{f"-:{LAYER0_ONLY_NEGATIVE_MATCH}": {}}`, so all six nodes (GPTQ/AWQ/GGUF × Python/YAML) failed on the first assertion and never reached the model. They only skip on a CPU host, which is why the breakage was invisible outside a GPU run. Assert the contract instead: exactly one `-:` rule, and `dynamic_get()` reports `False` for layers 1..32 while leaving layer 0 and layer 33 alone. This mirrors `tests/test_protocol_negative_search_4197.py` and `tests/protocol/test_protocol.py`, which already pin the wrapped form. Verified on an RTX 4090 (SM 8.9, matching the recorded baselines): GPTQ Python 1 passed (231.9s), GPTQ YAML 1 passed (173.6s), GGUF Python 1 passed (220.4s), GGUF YAML 1 passed (210.9s), each with all four eval deltas inside the allowed band. The AWQ pair cannot run here (its gate needs Hopper or newer); its config assertion passes on CPU. Non-vacuity: the new assertion still fails when the exclusion is replaced by a pattern that matches nothing, when a second rule is added, and when the `-:` prefix is dropped.
Qubitium
marked this pull request as ready for review
November 29, 2026 20:04
Qubitium
added a commit
that referenced
this pull request
Nov 30, 2026
- llama3.2 bitsandbytes: pin fast-layer prefix and assert 4-bit buffers - cohere_compass: monkeypatch load_model_config; replay must keep None rotary - base: honor rope_parameters[layer_type] = None in layer-type replay - unlimited_ocr: read the legacy processor_config.json; add unit regression - locateanything/minicpm_o: let the port own the processor - ovis 1.6: pin FP16 for the Marlin kernel - dream: gate the remote-only tokenizer on the documented bypass Rebased onto 8d52eb9. The llama3.2 gptq/gguf protocol hunks were dropped: #6442 (9fb990d) already fixes the same stale `cfg.dynamic` assertion in both files by asserting the exclusion contract, so main's version is kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium
added a commit
that referenced
this pull request
Nov 30, 2026
- llama3.2 bitsandbytes: pin fast-layer prefix and assert 4-bit buffers - cohere_compass: monkeypatch load_model_config; replay must keep None rotary - base: honor rope_parameters[layer_type] = None in layer-type replay - unlimited_ocr: read the legacy processor_config.json; add unit regression - locateanything/minicpm_o: let the port own the processor - ovis 1.6: pin FP16 for the Marlin kernel - dream: gate the remote-only tokenizer on the documented bypass Rebased onto 47aa824. The llama3.2 gptq/gguf protocol hunks were dropped: #6442 (9fb990d) already fixes the same stale `cfg.dynamic` assertion in both files by asserting the exclusion contract, so main's version is kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Three Llama-3.2 protocol integration test files have been red on every GPU host, failing at the first assertion before any model is loaded. They only skip on a CPU host, so the breakage was invisible outside a GPU run. No issue tracks this; it surfaced during a sweep of
main=a4471c53b.Root cause — the test asserts a string the compiler no longer emits
gptqmodel/quantization/protocol.py::_compile_negative_match_dynamic:That prefix is deliberate and is the fix for #4197. The compiled key is therefore not textually equal to the raw selector.
All three tests still compared the whole dict against the raw pattern:
For this particular pattern the two are semantically identical — it already starts with
.*, sopcre.matchandpcre.searchagree on every module name. Only the string differs. That is why this is a stale expectation and not a product bug.Affected nodes — 6, across 3 files
tests/models/test_llama3_2_gptq_protocol.pyTestLlama3_2_GPTQProtocol{Python,YAML}tests/models/awq/test_llama3_2_awq_protocol.pyTestLlama3_2_AWQProtocol{Python,YAML}tests/models/test_llama3_2_gguf_protocol.pyTestLlama3_2_GGUFProtocol{Python,YAML}All six fail identically. Reproduce without a GPU, since the assertion is pure config logic:
Fix — assert the exclusion contract
This mirrors the two places that already pin this contract and are green:
tests/test_protocol_negative_search_4197.py— asserts(config.dynamic_get(name) is False) == protocol_excludesfor four parametrized selectors, including-:*.tests/protocol/test_protocol.py:372-416— asserts the wrapped form{r"-:.*(?:.*layers\.2.*)": {}}for both Python and YAML sources.Nothing was widened. The test still pins "one negative selector produces exactly one exclusion rule", still requires the
-:prefix, and now additionally pins which layers are excluded (1–32) and which are not (0, 33) — which the string comparison never did.Non-vacuity
The new assertion was checked against three deliberate regressions:
len(cfg.dynamic) == 1)-:prefix droppedVerification — full integration runs on an RTX 4090
Baselines were recorded on SM 8.9, so all runs were pinned to an idle 4090 (
CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES=<n>), never the SM 12.0 card.TestLlama3_2_GPTQProtocolPythonAssertionErrorTestLlama3_2_GPTQProtocolYAMLAssertionErrorTestLlama3_2_GGUFProtocolPythonAssertionErrorTestLlama3_2_GGUFProtocolYAMLAssertionErrorEach run quantized only layer 0 (
_assert_only_first_layer_quantizedpassed; kernel histograms were{MarlinLinear}/{GGUFTorchLinear}), and every eval landed inside its band. The GPTQ and GGUF pairs each produced identical numbers across their Python and YAML variants, which is the expected determinism:The AWQ pair cannot run on this host — its gate requires Hopper or newer and the available cards are Ada (SM 8.9). That is a pre-existing environment gate, unrelated to this change. Its config assertion, which is the part this PR touches, was verified green on CPU.
Other checks:
tests/test_protocol_negative_search_4197.py+tests/protocol/→ 73 passed, 4 skipped (confirms the wrapping contract is intact and my reading of it is right).test_llama3_2*files → 51 tests collected, 0 errors.ruff checkon all three files → clean.Scope
Tests only; no product code changed.
LAYER0_ONLY_NEGATIVE_MATCHis still used to build the protocol in each file, so no dead constant.Why this went unnoticed
test_gc.py-style CPU-only nodes are cheap, but these are GPU integration nodes that skip on a CPU host — so a CPU sweep sees green, and CI runs only 8 curated files, none of which is a protocol integration test. A lane that runs the CPU-visible subset would still not catch it; catching this class needs either the GPU lane or a CPU-reachable assertion. The config assertion in these tests is CPU-reachable (as the repro above shows), which is the cheapest way to make the next occurrence visible.