Repository navigation
Conversation
Qubitium
force-pushed
the
upstream/11-exl3-numerical-diagnostics-20261108
branch
from
November 8, 2026 08:07
91c8c45 to
cdfc330
Compare
Qubitium
reviewed
Nov 8, 2026
Qubitium
left a comment
Collaborator
There was a problem hiding this comment.
Review: layer 11/36 — Hessian conditioning + projection diagnostics
Rebased onto the layer-10 branch (ded8fcc1); no conflicts. Diff vs the predecessor is the quantizer, the two tests, the doc page and the README link. Pushed as cdfc330d.
Validated on hardware (this layer touches the quantizer, so I ran it)
- CUDA (RTX 5090, sm_120):
tests/kernels/test_exllamav3_kernel.py+tests/test_exl3_hessian_symmetry.py→ 22 passed (18 kernel, 4 symmetry), 4.1s - ROCm (R9700, gfx1201): symmetry → 4 passed; kernel file → 9 passed, 9 skipped (the native EXL3 reference tests skip under ROCm as expected)
- CPU: symmetry → 3 passed, 1 skipped
ruff checkclean- Manual probe of
reconstruct_exl3_tensorsagainstExllamaV3TorchLinearfor 3inst/mcg/mul1: max abs diff ~0.003, consistent with the FP16 runtime reconstruction
Fixed
- CI-blocking import order —
tests/kernels/test_exllamav3_kernel.pytrippedI001; the repo gate runsruff checkovertests. Sorted. - Wrong exception type for bad inputs —
regularize_and_transform_hessian_didsu.shape/diag_mean.numel()before type checks, so a non-tensor raisedAttributeErrorinstead of the intendedValueError. Addedisinstanceguards. - Diagonal regularizer regression — the FP64 congruence used
transformed[idx, idx] += regularization, which builds index tensors and does a gather/scatter on every projection. Replaced withtransformed.diagonal().add_(regularization)(the original code's stated intent).
Notes (not blockers)
_random_signs()is now unused in this tree (kept for "upstream backends"). It is dead code until a later layer wires it.- Sign sequence change:
svused to come from aseed+1stream; it now continues the single projection-local generator aftersu. Still deterministic, but the same seed produces different weights than the previous layer. Confirm this is the intended fork sequence. "seed": Nonenow raisesValueError("must be an integer"), whereas the old path fell back to the global RNG. IfNonemeans "unseeded", it needs handling.quant_args["error_metrics"]can contain NaN/Inf (it reports*_finiteflags rather than rejecting). Any later JSON persistence withallow_nan=Falsewould fail.reconstruct_exl3_tensorshas no automated test. It works (manually checked above); a kernel-test case comparing it to the native module would lock it in.reconstruction_error_metricsrequires 16×16 divisibility. That is safe: EXL3 weights are multiples of the 128-wide Hadamard blocks.- The
K <= 8guard is correct, not over-tight:reconstruct_kernel_instancescovers K=1..8 andexl3_packed::bit_count = 8. restore_hessian_symmetry_allocates(H + H.T) * 0.5(two temporaries);symmetric = H + H.T; symmetric *= 0.5would halve that.
The FP64 congruence + symmetry restoration is the right shape for this fix: it preserves the sigma_reg margin, records the contract and correction magnitude, and the CUDA symmetry test confirms the 2048-wide expert-down case stays positive-definite.
Qubitium
marked this pull request as ready for review
November 8, 2026 08:10
Qubitium
force-pushed
the
upstream/11-exl3-numerical-diagnostics-20261108
branch
2 times, most recently
from
November 8, 2026 08:22
17762c5 to
2cdc454
Compare
The new test file used semicolons (E702) and unsorted imports (I001), and the module import block was unsorted; format/check.sh runs ruff check over tests, so the PR could not merge as-is. No behavior change: 20 tests still pass.
…utputs - Keep progress.json until the destination rename commits. A crash after the complete manifest is written but before the rename now resumes the finished shards instead of recomputing them; add a rename-crash regression test. - Reject manifest/progress shard paths that escape the root or are symlinks. - Make _fsync_directory a no-op off POSIX; clean up _atomic_json temp files on failure and write them 0644. - Declare xxhash (the writer hashes every shard, so it is not recovery-only) and raise a clear ImportError when it is missing.
Extract the existing working fork feature for first maintainer feedback. Preserve carried code and tests; limit validation to lightweight structural checks. See the linked mechanism reference for actual API/call and failure paths.
- Reject non-tensor su/diag_mean with ValueError instead of AttributeError. - Use diagonal().add_() for the FP64 regularizer; advanced indexing built index tensors and a gather/scatter pair on every projection. - Sort imports in the kernel test (CI ruff I001 gate).
Qubitium
force-pushed
the
upstream/11-exl3-numerical-diagnostics-20261108
branch
from
November 8, 2026 08:36
2cdc454 to
90f87ad
Compare
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
Carry the fork quantizer changes for FP64 Hessian congruence, symmetry restoration, per-projection RNG isolation, and structured reconstruction/Hessian error metrics. Preserve the existing arithmetic and failure evidence rather than redesigning it.
This is layer 11/36, extracted from an already-used fork for initial maintainer feedback. It depends on #3588. Review only this feature; the cross-fork Files changed view is cumulative because the PR targets upstream
main.Incremental change: 5 files, +601/−46 lines, including carried tests and the mechanism reference. No merge is automatic. Review value and API shape first; substantial rework can follow that feedback.
Flow and existing-code boundary
flowchart TD S0["regularize_and_transform_hessian_"] S1["restore_hessian_symmetry_"] S2["quantize_exl3"] S3["reconstruction_error_metrics"] E["RuntimeError, ValueError"] S0 -->|"calls where selected"| S1 S0 -->|"raises on rejected input/state"| E S1 -->|"raises on rejected input/state"| E S3 -->|"raises on rejected input/state"| E style E fill:#fee,stroke:#b22gptqmodel/exllamav3/modules/quant/exl3_lib/quantize.py:688:regularize_and_transform_hessian_gptqmodel/exllamav3/modules/quant/exl3_lib/quantize.py:666:restore_hessian_symmetry_gptqmodel/exllamav3/modules/quant/exl3_lib/quantize.py:1014gptqmodel/exllamav3/modules/quant/exl3_lib/quantize.py:1266:quantize_exl3gptqmodel/exllamav3/modules/quant/exl3_lib/quantize.py:1053:reconstruction_error_metricsCommitted reference: docs/exl3-numerical-diagnostics.md, linked from README. Class entry points/calls and rejected-state paths describe code present in this branch, rather than planned integrations.
Validation
Carried test files:
tests/test_exl3_hessian_symmetry.py,tests/kernels/test_exllamav3_kernel.pyThis packaging pass checked Python parsing, whitespace, dependency order and balanced Mermaid blocks. The author reports successful prior use of these features. Per the requested resource limit and feedback-first scope, existing model quantization, GPU/ROCm tests, heavyweight CPU workloads and full model benchmarks were not rerun; no new performance or model-accuracy claim is made. Tests accompanying earlier stack layers retain their previously reported results.