# Geometric Information-Theoretic Compression Pipeline for Parameter Golf ## The Core Idea: Three Theorems That Chain Together The current SOTA (1.0810 BPB) uses GPTQ with per-row scalar INT6 quantization + Brotli entropy coding. This pipeline is ad-hoc: it doesn't exploit the geometric structure of the weight space. Three theorems from information geometry and random matrix theory tell us exactly how to do better. --- ## Theorem 1: The Marchenko-Pastur Spectral Separation (RMT-KD, arxiv 2602.22345) **Statement**: For a trained weight matrix W ∈ ℝ^{m×n}, the eigenvalue spectrum of WW^T decomposes into: - A **noise bulk** predicted by the Marchenko-Pastur law (random matrix theory) - **Signal eigenvalues** that exceed the bulk edge λ₊ = σ²(1 + √(m/n))² **Proof sketch**: Under the assumption that the "noise" component of W behaves like an iid random matrix with variance σ², the Marchenko-Pastur law gives the limiting spectral density. Eigenvalues above λ₊ correspond to learned structure; those below are noise that can be discarded. **Implication for Parameter Golf**: Before quantizing, we can project each weight matrix onto its signal subspace (eigenvalues > λ₊). This removes the noise bulk — which is high-entropy and hard to compress — leaving only the low-rank signal, which has far lower entropy. RMT-KD achieves 80% parameter reduction with +1.8% accuracy on BERT. **Concrete operation**: For each weight matrix W: 1. Compute SVD: W = UΣV^T 2. Estimate noise variance σ² from calibration data 3. Compute MP bulk edge: λ₊ = σ²(1 + √(m/n))² 4. Keep only singular values σᵢ > √λ₊, zero out the rest 5. Store the truncated SVD: W ≈ U_k Σ_k V_k^T where k = #{σᵢ > √λ₊} --- ## Theorem 2: Incoherence Processing via Randomized Hadamard Transform (QuIP#, arxiv 2402.04396) **Statement**: For any weight matrix W ∈ ℝ^{m×n} and Hessian H ∈ ℝ^{n×n}, the Randomized Hadamard Transform (RHT) produces W̃ = U·S_U·W·S_V·V^T and H̃ = V·S_V·H·S_V·V^T such that: - W̃ is μ_W-incoherent with μ_W = 2log(4mn/δ) - H̃ is μ_H-incoherent with μ_H = √(2log(2n²/δ)) with probability ≥ 1-δ. **What this means**: Incoherent matrices have no outliers — all entries are approximately the same magnitude. This is *exactly* the condition under which scalar quantization is near-optimal (approaching the Shannon rate-distortion bound). Without incoherence processing, outliers force the quantizer to waste bits on large dynamic ranges. **Mathematical fact (Zador's theorem)**: For a d-dimensional source with distribution f(x), the minimum achievable MSE distortion at rate R bits/sample is: ``` D*(R) ≈ (1/(2πe)) · (∫f(x)^{d/(d+2)} dx)^{(d+2)/d} · 2^{-2R} ``` For a uniform (incoherent) distribution, this achieves the best possible rate. For a distribution with outliers, the distortion is strictly worse. **Implication**: Apply RHT before quantization to make the weights maximally amenable to fixed-rate coding. This is provably better than the current SDClip approach (which clips outliers but doesn't eliminate them). **Concrete operation**: 1. Generate random sign vectors S_U, S_V ∈ {±1}^n 2. W̃ = Had(diag(S_U) · Had(diag(S_V) · W^T)^T) — O(n log n) via Fast Walsh-Hadamard 3. H̃ = Had(diag(S_V) · Had(diag(S_V) · H)^T) 4. Quantize W̃ (now incoherent) with LDLQ adaptive rounding 5. At inference: dequantize W̃_q, then undo the transform: W_q = Had^{-1}(W̃_q) **Key advantage**: The Hadamard transform is its own inverse (H^{-1} = H^T = H/n) and costs O(n log n). No extra storage needed — just store the random signs (n bits per matrix). --- ## Theorem 3: Optimal Distortion Rate via Sphere Quantization (TurboQuant, arxiv 2504.19874) **Statement (Theorem 1)**: For any vector x ∈ S^{d-1} on the unit sphere, TurboQuant achieves: ``` D_mse ≤ (√3 · π / 2) · 4^{-b} ``` at b bits per coordinate, which is within a constant factor (≈2.7×) of the information-theoretic lower bound. **How it works**: 1. Apply a random rotation Π to the weight vector 2. After rotation, each coordinate follows a Beta distribution → nearly Gaussian in high dimensions 3. Coordinates become nearly independent → apply optimal scalar quantizer per coordinate 4. The optimal scalar quantizer centroids are precomputed (continuous k-means on Beta distribution) **This is the Pyramid Vector Quantization (PVQ) insight** (arxiv 2410.16926): by reparameterizing weights as direction (on the sphere) + scale, we can use the integer lattice on the sphere as an implicit codebook. No explicit codebook storage needed. PVQ achieves signal-to-quantization-noise ratios close to the optimal E8 lattice. **For Parameter Golf**: PVQ at groupsize 8-16 achieves ~1 dB better SQNR than scalar INT6, equivalent to ~0.5 extra bits of precision for free. At Llama-3 70B, PVQ achieves 3.25 bits/weight retaining 98% downstream accuracy. --- ## The Complete Pipeline: RMT → RHT → PVQ Chain the three theorems into a principled compression pipeline: ``` Training (standard) → Spectral Truncation (RMT) → Incoherence Processing (RHT) → Spherical Quantization (PVQ) → Entropy Coding (Brotli) ``` ### Step 1: Train as usual Standard training with Muon + current SOTA recipe (11L × 512d, etc.) ### Step 2: Spectral Truncation (post-training) For each weight matrix W: ```python U, S, Vt = torch.linalg.svd(W, full_matrices=False) # Estimate noise floor via Marchenko-Pastur aspect_ratio = W.shape[0] / W.shape[1] sigma_sq = median(S**2) / (1 + sqrt(aspect_ratio))**2 # robust estimator lambda_plus = sigma_sq * (1 + sqrt(aspect_ratio))**2 threshold = sqrt(lambda_plus) mask = S > threshold W_trunc = (U[:, mask] * S[mask]) @ Vt[mask, :] ``` This removes ~20-40% of singular values (noise), reducing effective rank and entropy. ### Step 3: Incoherence Processing (pre-quantization) ```python # Randomized Hadamard Transform — O(n log n) S_signs = torch.randint(0, 2, (n,)) * 2 - 1 # random ±1 W_hat = hadamard_transform(diag(S_signs) @ W_trunc.T).T H_hat = hadamard_transform(diag(S_signs) @ H @ diag(S_signs)) ``` Now W_hat is μ-incoherent: no outliers, uniform magnitude distribution. ### Step 4: Hessian-Aware PVQ Quantization ```python # Decompose into direction (on sphere) + scale (amplitude) rows = W_hat.reshape(-1, group_size) # group_size = 8 or 16 scales = rows.norm(dim=1, keepdim=True) directions = rows / scales.clamp_min(1e-10) # Quantize direction via PVQ (project onto integer lattice on L1 sphere) K = 2**bits - 1 # number of pulses q_directions = pvq_quantize(directions, K) # maps to integer lattice q_scales = quantize_beta(scales, bits=4) # optimal Beta quantizer for amplitudes # Encode: PVQ codes are uniquely decodable, no explicit codebook needed codes = pvq_encode(q_directions) # combinatorial number system ``` ### Step 5: Entropy Coding Apply Brotli-11 to the quantized byte stream. Because: - Spectral truncation removed high-entropy noise → lower entropy - Incoherence processing uniformized magnitudes → better compression - PVQ encodes more information per bit than scalar INT6 → fewer total bits ### Step 6: Inference (dequantization) ```python # Reverse pipeline q_directions = pvq_decode(codes) rows_hat = q_directions * q_scales W_hat = rows_hat.reshape(m, n) # Undo Hadamard W_q = hadamard_transform(diag(S_signs) @ W_hat.T).T # RHT is its own inverse up to scaling ``` --- ## Why This Beats Current GPTQ + Brotli | Property | GPTQ + SDClip + Brotli | RMT → RHT → PVQ + Brotli | |----------|------------------------|---------------------------| | Outlier handling | Clips to k×std (heuristic) | Hadamard provably eliminates outliers (μ = O(log n)) | | Quantization | Scalar per-row INT6 | Vector PVQ on sphere (1 dB better SQNR) | | Noise removal | None | MP spectral truncation removes noise bulk | | Rate-distortion | ~2-3 dB from Shannon bound | ~1 dB from Shannon bound (TurboQuant Thm 1) | | Codebook storage | None (good) | None (PVQ uses implicit lattice) | | Dequant overhead | Simple: q × scale | Hadamard + PVQ decode (~O(n log n)) | | Proven guarantees | GPTQ has LDLQ optimality only | All three steps have proven bounds | ### Expected Gain Each improvement compounds: - Spectral truncation: ~15-25% fewer effective parameters to store (removes noise) - RHT incoherence: ~0.5-1.0 bits/weight better effective precision - PVQ vs scalar: ~0.5-1.0 dB better SQNR at same bits Combined: **equivalent to gaining ~1-2 extra bits of precision**, which is like going from INT6 to INT7-8 quality at the same storage budget. Or equivalently, **fitting ~20-30% more effective parameters in 16MB**. At the scaling law, 20-30% more effective parameters ≈ **-0.005 to -0.015 BPB**. --- ## Mathematical Elegance The pipeline has a clean information-geometric interpretation: 1. **RMT Truncation** = project onto the **signal manifold** (remove directions with < noise-level curvature on the loss landscape) 2. **RHT Incoherence** = isometrically embed the weight space into a **maximally spread** coordinate system (minimize the max-coordinate ratio, which is the entropy-penalty for scalar coding) 3. **PVQ Quantization** = encode on the **sphere** using the optimal integer lattice (the L1-sphere lattice approaches Zador's bound for spherically symmetric sources) Each step reduces entropy while provably preserving signal. The composition is provably near-optimal: within a constant factor of the information-theoretic minimum description length for the learned weight distribution. --- ## Implementation Complexity The full pipeline adds ~150 lines of code to the existing GPTQ path: - SVD for spectral truncation: `torch.linalg.svd` (already in PyTorch) - Hadamard transform: fast WHT in ~20 lines (bit-reversal + butterfly ops) - PVQ quantize/encode/decode: ~80 lines (Algorithm 1-3 from the PVQ paper) - No external libraries needed. No GPU kernels needed for the quantization path (it runs post-training on CPU). The inference overhead (Hadamard + PVQ decode) adds ~5-10% to eval time, well within the 10-minute eval budget. --- ## References 1. **Marchenko-Pastur Spectral Separation**: "Spectral Geometry for Deep Learning" (arxiv 2602.22345, 2026) — 80% compression, +1.8% accuracy on BERT via MP bulk edge estimation 2. **Incoherence + RHT**: "QuIP#: Even Better LLM Quantization" (arxiv 2402.04396, 2024) — proven O(log n) incoherence bound, 2-bit quantization retaining >95% quality on Llama-3 70B 3. **PVQ on Sphere**: "Pyramid Vector Quantization for LLMs" (arxiv 2410.16926, 2024) — SQNR close to E8 optimal, 3.25 bits/weight on Llama-3 70B retaining 98% accuracy 4. **TurboQuant Bounds**: "Online Vector Quantization with Near-optimal Distortion Rate" (arxiv 2504.19874, 2025) — proven within 2.7× of Shannon lower bound at all bit-widths 5. **Fisher-Weighted SVD**: "Generalized Fisher-Weighted SVD" (arxiv 2505.17974, 2025) — Kronecker-factored Fisher for optimal low-rank approximation respecting parameter importance 6. **Zador's Theorem** (1963): Asymptotic distortion-rate function for vector quantization — the theoretical floor our pipeline approaches