△ Mechanism confirmed, baseline not beaten 2026

Contraction-Gauge Quantization

Implementation & benchmark of arXiv:2607.18745 — Contraction-Gauge Preconditioning for Quantized Matrix Multiplication

Usefulness8/10
Difficulty5/10
Novelty6/10

Source paper: Contraction-Gauge Preconditioning for Quantized Matrix Multiplication arXiv:2607.18745 ⓘ · analyzed Aug 30, 2026

AI-generated research hypothesis, automatically tested. Not peer-reviewed.

Idea description

Before quantizing a matrix product, reparameterize its factors as A'=AT and B'=T^{-1}B, preserving the exact full-precision product while changing the quantization difficulty of each factor. Choose a positive diagonal T=diag(t_1,...,t_K) that minimizes predicted post-quantization product error, rather than using output-channel scaling or a fixed heuristic grid. The gauge can be shared across several products when transformed-copy cost matters.

Formulas

$$AB=(AT)(T^{-1}B),\qquad T\in\mathrm{GL}(K).$$
$$\widehat{A}=A'+E_A,\qquad \widehat{B}=B'+E_B,\qquad A'=AT,\qquad B'=T^{-1}B.$$
$$\mathbb{E}\left[\left\|\widehat{A}\widehat{B}-A'B'\right\|_F^2\right]=\sum_{i=1}^{m}\sum_{j=1}^{n}\sum_{k=1}^{K}\left[v^A_{ik}(B'_{kj})^2+(A'_{ik})^2v^B_{kj}+v^A_{ik}v^B_{kj}\right].$$
$$J(t)=\sum_{i,j,k}\left[v^A_{ik}(t)(t_k^{-1}B_{kj})^2+(A_{ik}t_k)^2v^B_{kj}(t)+v^A_{ik}(t)v^B_{kj}(t)\right],\qquad \ell_k\le t_k\le u_k.$$

Mathematical statement

The contraction-gauge identity is AB=(AT)(T^{-1}B), where A is in R^{m x K}, B is in R^{K x n}, and T is an invertible K x K matrix acting on the shared contraction index. Let A'=AT and B'=T^{-1}B. After quantization, let A_hat=A'+E_A and B_hat=B'+E_B, where E_A and E_B have mutually independent, zero-mean entrywise errors with variances vA_{ik}=E[E_A,ik^2] and vB_{kj}=E[E_B,kj^2]. Expanding A_hat B_hat-A'B' and using independence gives the exact expected squared Frobenius error E[||A_hat B_hat-A'B'||_F^2] = sum_{i,j,k}[vA_{ik}(B'_{kj})^2+(A'_{ik})^2 vB_{kj}+vA_{ik}vB_{kj}]. For a positive diagonal gauge T=diag(t_1,...,t_K), A'_{ik}=A_{ik}t_k and B'_{kj}=t_k^{-1}B_{kj}. Optimize J(t) over positive bounds l_k <= t_k <= u_k. The variances are analytic for subtractive dither or stochastic rounding and can be estimated from calibration data for deterministic round-to-nearest quantization.

Implementation notes

(1) Integration point: modify the offline quantization pipeline for a linear layer or any explicit matrix product Y=AB. Do not alter the full-precision network. Insert a diagonal gauge on the contraction dimension, storing A'=A diag(t) and B'=diag(t)^{-1}B before calibration and quantization. At inference, multiply the two quantized factors as usual.

(2) Pseudocode:

collect calibration tensors A and B
initialize z_k=0, with t_k=exp(z_k)
repeat for coordinate descent or bounded L-BFGS:
    Ap[i,k] = A[i,k] * exp(z[k])
    Bp[k,j] = exp(-z[k]) * B[k,j]
    quantize Ap and Bp or evaluate their quantizer residuals
    estimate vA[i,k] and vB[k,j]
    J = sum_i,j,k(vA[i,k]*Bp[k,j]^2 + Ap[i,k]^2*vB[k,j] + vA[i,k]*vB[k,j])
    update z while log(l_k) <= z_k <= log(u_k)
select the lowest-J gauge, then permanently quantize Ap and Bp

(3) Computed from the paper's mathematics: the transformed factors and the three-term product-error objective. Estimated empirically: quantizer variances, clipping scales, and useful gauge bounds. For RTN, use vA[i,k]=(Q(Ap[i,k])-Ap[i,k])^2 and the analogous expression for B; for stochastic rounding, average squared residuals over several random quantizations.

(4) First cheap experiment: quantize ResNet-18 linearized convolution products or a small transformer MLP on CIFAR-10 or WikiText-2 at 4 and 8 bits. Compare the identity gauge, a SmoothQuant-style baseline, and the optimized diagonal gauge at identical bitwidth and tensor count. Record predicted versus realized product MSE, end-to-end accuracy or perplexity, and calibration time. A successful result is at least 10 percent lower product MSE and improved 4-bit accuracy without increasing stored parameter count.

Verification

Mechanism confirmed, baseline not beaten

Stage 1 · Toy mechanism gate: Passed ✓

Stage 2 · Mechanism transferred to benchmark: Confirmed ✓

Stage 2 · Practical benchmark result: No measurable effect

Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works

Stage 1 — Mechanism check agent confidence 9/10

Built a readable toy implementation of diagonal contraction-gauge quantization, including the exact AB=(AT)(T^{-1}B) check, the three-term expected-error objective, bounded coordinate optimization, and deterministic RTN evaluation. The mechanism manifested clearly: the derived optimum matched coordinate optimization to 2.5e-13 relative gap, Monte Carlo matched the analytic objective within 0.21%, and the predicted scaling laws t∝rho^0.5 and t∝vA^0.25 were observed exactly. On the fixed 4-bit toy product, the optimized gauge reduced realized product MSE by 18.86% versus the identity gauge.

Agent confidence
9/10
Baseline
Identity gauge RTN product MSE = 2.6762852613; predicted objective MSE = 0.0408943292
Idea
Optimized gauge RTN product MSE = 2.1714702988, an 18.8625% reduction; predicted objective MSE = 0.0182755578; observed/predicted scaling slopes: rho 0.500/0.500 and A-noise 0.250/0.250

Limitations: Only a small synthetic matrix product was tested, not a neural network or CIFAR/LM accuracy. The experiment used fixed global quantization steps and did not compare SmoothQuant, per-channel scales, calibration cost, storage overhead, or shared gauges across multiple products; deterministic RTN clipping effects were not systematically swept.

How to run: python3 gauge_quantization_experiment.py

Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.18745)

No significant difference vs. the tuned baseline (+0.6%, p=0.3074, wins 3 / 8 paired seeds).

Benchmark
Tabular regression (Friedman)
Model
mlp_tiny
Paired seeds
8
Baseline mean
7.4354
Idea mean
7.4797
Effect (Δ)
0.0444 (+0.6%; negative = idea better)
Wins
3 / 8 paired seeds
p-value
0.3074 (permutation test, 20 000 shuffles)
Smallest detectable effect
±1.3%
Mechanism
Confirmed ✓
Practical effect
No effect
Baseline tuning
swept over 3 configs
Limitations:

Only the tabular Friedman#1 regression track and mlp_tiny were tested; vision, sequence, dynamics, larger MLPs, 8-bit quantization, SmoothQuant/per-channel alternative baselines, multi-layer gauge sharing, and calibration-time benchmarking were not tested. The implementation quantizes the first MLP linear product and its calibrated input factor, rather than all network products.

How to run: python3 bench_gauge.py

Verdict computed by deterministic test code from paired-seed statistics — not by the language model.

Stage 2 — Benchmark latest Failed ✗

Agent confidence: 9/10

Implemented Contraction-Gauge Quantization as a local modification of the tabular mlp_tiny benchmark, using identical training, architecture, learning-rate sweep, and paired seeds for baseline and idea. The trained-model mechanism signature was confirmed: predicted product-MSE reduction was 17.97% and observed reduction was 17.64%. However, end-to-end test MSE was slightly worse for the idea (7.47975 vs 7.43537), with paired delta +0.04438 and permutation p=0.3074; therefore the promised benchmark win was not observed.

Baseline
Best identity-gauge configuration lr=0.006; full 8-seed test MSE mean=7.4353720546, std=0.2633394514; per-seed=[7.1245622635,7.8929858208,7.2902455330,7.4139800072,7.1990704536,7.4280114174,7.3056483269,7.8284726143]
Baseline sweep
lr=0.0015 mean=11.3008294106; lr=0.003 mean=7.8546483517; lr=0.006 mean=7.4304434061
Idea
Best optimized-gauge configuration lr=0.006; full 8-seed test MSE mean=7.4797495008, std=0.3400021487; per-seed=[7.0012540817,8.0549974442,7.2812762260,7.2792034149,7.2723517418,7.5362048149,7.4451713562,7.9675369263]; paired delta=+0.0443774462, idea wins=3/8, permutation p=0.3074
Idea sweep
lr=0.0015 mean=11.7511212826; lr=0.003 mean=8.0470248461; lr=0.006 mean=7.4797495008
Mechanism signature
Predicted first-product MSE identity=0.0032598630, gauge=0.0026742214, reduction=17.9652%; observed first-product MSE identity=0.0033838625, gauge=0.0027870808, reduction=17.6361%; confirmed=true

Benchmark result

No significant difference vs. the tuned baseline (+0.6%, p=0.3074, wins 3 / 8 paired seeds).

Benchmark
Tabular regression (Friedman)
Model
mlp_tiny
Paired seeds
8
Baseline mean
7.4354
Idea mean
7.4797
Effect (Δ)
0.0444 (+0.6%; negative = idea better)
Wins
3 / 8 paired seeds
p-value
0.3074 (permutation test, 20 000 shuffles)
Smallest detectable effect
±1.3%
Mechanism
Confirmed ✓
Practical effect
No effect
Baseline tuning
swept over 3 configs
Limitations:

Only the tabular Friedman#1 regression track and mlp_tiny were tested; vision, sequence, dynamics, larger MLPs, 8-bit quantization, SmoothQuant/per-channel alternative baselines, multi-layer gauge sharing, and calibration-time benchmarking were not tested. The implementation quantizes the first MLP linear product and its calibrated input factor, rather than all network products.

How to run: python3 bench_gauge.py

Artifacts

Implementation overview ⬇ Download all as ZIP 6 files · code, reports and structured results