Repository navigation
Conversation
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.
Summary
_use_ggml_cpu_matmulbecame unconditional in 77930e3, so the GGUF_CPP CPU path always runs ggml's Q8 activation quantization while the docs still presented 2e-2 as a bound. That bound was measured only on Gaussian activations. ggml quantizes activations in 256-element blocks, so one large channel raises the scale for its whole block: the #4316 repro (16 of 4096 channels x100) reaches 3.3e-2 .. 3.8e-2 relative and 7.6e-2 .. 8.4e-2 worst row, over 4x the claimed bound. The exact path was reachable only through an env var or by switching the whole engine toGGUF_TORCH.What Changed
GGUFCppKernel.__init__acceptsexact_matmul: Optional[bool] = None.Trueselects the exact torch/dequantize path (GGUF_TORCHnumerics),Falserequests native ggml, andNone(default) keeps the existing capability-based native choice. The constructor argument wins over the process-wideGPTQMODEL_GGUF_CPP_NATIVE_MATMULenv var; callers that pass nothing see no behaviour change.GGML_NATIVE_MATMUL_ERROR_BOUND(2e-2) is retained as the Gaussian envelope the native path is validated against, and is no longer described as a universal bound. AddedGGML_NATIVE_MATMUL_OUTLIER_ERROR_ENVELOPE = 1e-1, the recorded worst-row envelope for the outlier repro (not a universal bound).docs/gguf-cpp-activation-quantization.md: separates Gaussian from outlier measurements, adds the [BUG] GGUF_CPP's documented 2e-2 activation-quantization bound is exceeded 2–4× with outlier channels, and the CPU path now always uses the lossy native matmul (incomplete fix of #4219) #4316 repro and its numbers, explains why the Q8_K 256-element block layout has no activation-independent bound, and documents the three ways to force the exact path.tests/test_gguf_cpp_matmul_accuracy_4316.py.Tests
The 10
test_gguf_all_formats.pyfailures are pre-existing on pristineorigin/main: they are bf16rtol=2e-3tolerance failures in the dense/fused paths, reproduced from agit archive HEADof the parent commit before this change. They are unrelated to the CPU path selector.ruff checkpasses on both changed Python files.CUDA C++ extensions are not built in this container, so the CUDA-specific cases skip; the issue repro and all new tests are CPU-only.
Model Support / Module Plan
N/A — no new model types or registry entries.
Fixes #4316