Repository navigation
feat(exl3): add bounded covariance accumulation with an FP64 outer sum - #3587
Merged
Qubitium merged 2 commits intoNov 8, 2026
Merged
Conversation
Qubitium
force-pushed
the
upstream/09-bounded-covariance-20261108
branch
from
November 8, 2026 07:59
16dc7b0 to
ef7a8c5
Compare
Qubitium
reviewed
Nov 8, 2026
Qubitium
left a comment
Collaborator
There was a problem hiding this comment.
Review: layer 9/36 — bounded covariance accumulator
Rebased onto the layer-8 branch (ea590da0); no conflicts. Diff vs the predecessor is only the two new files (gptqmodel/utils/exl3_hessian.py, tests/test_exl3_hessian_accumulator.py). Pushed as ef7a8c5e.
Verified
tests/test_exl3_hessian_accumulator.py→ 20 passedruff checkclean- CUDA probe (RTX 5090): 301×64 FP16 rows, relative error 7.1e-8 vs an FP64 oracle; setting
allow_tf32=Trueraises the guard as intended
Fixed
- CI-blocking lint —
format/check.shrunsruff checkovertests, and the new test trippedE702(semicolon statements) plusI001(import order) in both files. Rewrote the test in repo style and sorted the module imports. No behavior change; all 20 tests still pass. The PR could not have merged as-is.
Functional review
The accumulator itself is sound: inputs are validated (dtype, width, nonempty, finite), each chunk is converted to FP32 and multiplied as mm(value.T, value), the product is accumulated into an FP64 tensor, any failure poisons the instance, and snapshot() returns owned FP32 storage with a finite-representability check. The tests are genuinely independent (FP64 oracles, exact chunk boundaries, half-ULP ties, cancellation, poison state).
Notes (not blockers)
- Default
device="cuda:0"hardcodes a device index.None(current device) or"cpu"would be less surprising on multi-GPU or CPU-only hosts; callers can already override it. torch.isfinite(product).all()runs per chunk and forces a GPU sync plus a full read of thewidth×widthFP32 product. For wide layers with many 128-row chunks this is significant overhead. If that matters, check the FP64 running sum once peradd(or at a coarser cadence) instead.- The TF32 guard raises before entering the try block, so
_failedstays False and the caller can fix the setting and retry — that looks intentional, worth keeping explicit. - The class is not thread-safe and does not document it.
- The module is not exported from
gptqmodel/utils/__init__.pyand is not wired into the pipeline, matching the stated "fork remainder" scope.
Qubitium
marked this pull request as ready for review
November 8, 2026 08:10
Qubitium
force-pushed
the
upstream/09-bounded-covariance-20261108
branch
2 times, most recently
from
November 8, 2026 08:21
b15b48d to
4c75347
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.
Qubitium
force-pushed
the
upstream/09-bounded-covariance-20261108
branch
from
November 8, 2026 08:35
4c75347 to
5181cdb
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
Add an explicit reusable accumulator that computes FP32 products over at most 128 actual input rows, accumulates products in FP64, and returns owned FP32 snapshots. Reject invalid geometry, nonfinite inputs and failed partial states. The utility does not change the default quantization pipeline; native-source consumers remain in the fork remainder.
Stack
Layer 9/36 of a dependency-ordered fork extraction. Depends on #3586. Review only this layer.
GitHub requires this cross-fork PR to target upstream
main, so its Files changed tab includes earlier stack layers. After the predecessor lands, rebase this branch and retarget the next layer; do not merge later layers out of order. No predecessor is merged automatically.Tests
20 passed in 0.27 seconds. Used Python 3.12, Torch 2.14.1, Transformers 5.19.0. No model quantization, GPU work, downloads, or heavyweight model validation. Unit fixtures are small and CPU execution is constrained to one math thread.
Review and remaining validation
This layer and its dependency diff were reviewed for scope, existing extension points, and compatibility with the resolved fork snapshot. New focused regression coverage is included. Kept as a draft for maintainer review; hardware paths and end-to-end model behavior have not been revalidated in this session. No speed claim. Original integration/history is preserved in tpurtell#3.
Independent FP64 covariance reference covers FP16/BF16/FP32 inputs, row-product boundaries, cancellation, signed zero, half-ULP storage neighbors and failure poisoning. Normalized matrix error is asserted below
1e-6, and discrete/storage boundary cases match exactly. CPU checks passed; actual GPU full-stream covariance validation is a readiness blocker, and production pipeline integration remains deferred.