Activation-Weighted Low-Rank Compression of Transformer Weights

Sambhav · Research project, 2025
Source code: github.com/Sambhav242005/Weighted-Lowrank-Compression
Open reader view →

Abstract

Standard SVD compression of transformer weights fails at 3x ratios because it minimizes error in weight space rather than activation space. This work proposes an activation-weighted fitting method that uses calibration data to identify which weight directions the model actually uses. At the same compression budget, the method reduces perplexity degradation by 5–7x across three architectures (GPT-2, Gemma-3, Qwen2.5). On Gemma-3-1B, the compressed model scores below the original’s perplexity — a denoising effect. The method requires no gradient steps and solves each matrix in closed form.

1. Introduction

A large language model stores knowledge in weight matrices — grids of numbers with millions of entries. Compression replaces these with simpler approximations that use less memory.

The standard approach, truncated SVD, asks which directions carry the most mathematical energy and keeps those. But the model does not use all directions equally. Some receive a flood of activation traffic every time the model runs. Others are barely touched. SVD spends its limited budget on directions that look big on paper but do not matter to the model’s computation.

The proposed method asks which directions the model actually uses, and spends the budget on those.

Analogy. Compressing a road network by preserving the roads with the most asphalt would keep wide abandoned highways while destroying busy city streets. Preserving the roads with the most traffic is more useful. That is what activation-weighted compression does — it preserves the computational pathways the model actually travels.

2. Why standard compression fails

When a transformer’s weight matrix is compressed using truncated SVD, each individual layer’s error looks small, but the full model’s performance collapses. On GPT-2 Small, plain SVD at 3x compression raises perplexity by 21%. On Gemma-3-1B, it raises it by 72%.

Two competing explanations have been proposed:

Hypothesis 1 — Drift accumulation

Approximation errors compound through the residual stream. Later layers receive inputs they were never trained on, so even a good per-layer fit does not guarantee a good network.

Hypothesis 2 — Wrong norm

SVD minimizes error in weight space (Frobenius norm), but what matters is error under the activation distribution. SVD wastes rank on directions the model never excites.

Finding: The answer is overwhelmingly hypothesis 2. A closed-form fit that minimizes activation-space error recovers a full compression tier that plain SVD destroys. The “drift wall” is largely an artifact of the approximation method, not a fundamental limit.

3. Method

For a linear layer y = Wx, the approach captures calibration activations using a forward hook, then solves a simple optimization: minimize activation-space error with a weight-space anchor to prevent divergence in unobserved directions.

Mathematical formulation

The objective finds a rank-r approximation Ẍhat; minimizing:

L(Ẍ) = (1/n) Σᵢ ||(W − Ẍ)xᵢ||² + β ||Ẍ − W||²_F

The first term is the activation-space error (what the network actually sees). The second is a weight-space anchor that prevents the fit from diverging in directions the calibration data never excites.

Let G = XXᵀ (Gram matrix) and C = (Y−b)Xᵀ + βnW (cross-moment). The unconstrained minimizer is:

M* = C (G + βnI)⁻¹

The result is truncated to rank r in the G-weighted norm — the norm in which the original objective measures error.

Algorithm

For each target module:

  1. Capture input activations X and outputs Y over calibration chunks (forward hooks)
  2. Subtract bias from Y if present
  3. Compute G = XXᵀ + βnI and C = YXᵀ + βnW
  4. Solve M* = CG⁻¹ (eigenspace solve with ridge regularization)
  5. Truncate to rank r in the G-weighted norm
  6. Write back the compressed factors

One hyperparameter: β (anchor strength). Optimal in [0.1, 0.3]; all results use β = 0.1.

Why the anchor matters

Without the anchor (β = 0), the problem is ill-posed in directions the calibration data never excites. The fit can produce arbitrarily large weights in those directions without any penalty, leading to divergence. The anchor keeps the compressed model close to the original in regions where there is no activation evidence.

4. Visualization

Two compression methods applied to the same weight matrix. Drag to rotate, scroll to zoom.

Initializing...
1. Full matrix
2. Find busy paths
3. SVD flattens all
4. Weighted bends to fit
5. Compare results

Hover to pause. Cycle: 6s per stage.

5. Results

Same model, same target matrices (attention output projections), same rank (one-sided 3x compression), same evaluation protocol (WikiText-2 test split). The only difference: SVD optimizes in weight space; the proposed method optimizes in activation space.

Figure 1. Perplexity delta at 3x compression (lower is better)
+80% +60% +40% +20% 0% −10% GPT-2 +21% +3.6% Gemma-3 +72% −4.5% Qwen2.5 +26% +3.8% Plain SVD Weighted fit
Negative values indicate the compressed model outperforms the original.

Cross-scale comparison

ModelBaseline PPLSVDWeightedFactor
GPT-2 Small (124M)56.47+21.34%+3.58%5.9x
Gemma-3-1B70.40+71.86%−4.45%16.2x
Qwen2.5-7B-Instruct12.29+26.31%+3.84%6.9x

PPL = perplexity (lower is better). Negative values mean the compressed model outperforms the original.

Figure 2. Ratio frontier — perplexity delta vs compression ratio (GPT-2 Small)
+400% +300% +200% +100% 2x 3x 4x 6x 8x +0.1% +3.6% +152% +262% +374% +3.6% +18% +53% +94% SVD Weighted
The weighted fit recovers a full compression tier: weighted 4x beats SVD 3x while storing less.
Compression as denoising — can compression improve the model?

The Gemma-3-1B result is notable: the compressed model scores below the teacher’s perplexity (−4.45% on 50 texts, −7.34% on 200 texts) with no fine-tuning. Logit-space analysis shows the student is not a copy — it has higher output entropy (2.19 to 2.47) and lower NLL, suggesting it is less overconfident and better calibrated.

Interpretation: directions of W that are never excited by natural text carry no signal but contribute weight-space capacity for spurious logits. Activation-weighted truncation removes them, flattening spurious peaks and moving mass onto correct tokens — denoising.

This claim rests on one architecture and one family. Three-seed replication and a second architecture are needed before claiming it broadly.

Factor quantization — int8 is lossless

On Qwen2.5-7B (rank 1194), quantizing the compressed factors to int8 is effectively lossless (+3.80% vs +3.86% for fp16), achieving 3.0x per-matrix storage reduction. int4 quantization costs an additional +4.4pp but remains within the quality gate.

Figure 3. Per-layer sensitivity — perplexity delta by layer (GPT-2 Small, 3x)
Layer 0 Layer 1 Layer 2 Layer 3 Layer 4 Layer 5 Layer 6 Layer 7 Layer 8 Layer 9 Layer 10 Layer 11 0% +5% +10% +15% +20% Lower sensitivity Higher sensitivity
Middle layers (3–6) are most sensitive to compression. Outer layers tolerate rank reduction better.

Ratio frontier — detailed

Both methods compress the same weight matrix by replacing it with a lower-rank approximation. SVD picks the directions with the most mathematical energy, regardless of whether the model uses them. The proposed method uses calibration data to identify which directions receive actual activation traffic, then allocates the budget to those directions instead.

At 2x compression, both methods produce negligible quality loss. The gap opens at 3x: SVD raises perplexity by 21% while the weighted fit adds only 3.6%. Beyond 3x, SVD collapses rapidly — the model becomes essentially useless at 4x (+152%). The weighted fit degrades more gracefully, remaining usable at 4x (+18%) and only becoming impractical at 6x and beyond.

The key observation: weighted 4x beats SVD 3x while storing 25% fewer parameters. The method recovers an entire compression tier that plain SVD destroys.

Ratio (rank)SVD deltaWeighted delta
2x (384)+5.50%+0.10%
3x (256)+21.34%+3.58%
4x (192)+152.13%+17.94%
6x (128)+261.86%+53.38%
8x (96)+374.49%+94.18%

6. Claims

Supported by current evidence

  • Activation-weighted fitting outperforms plain SVD at the same rank budget on attention output projections across three architectures (GPT-2, Gemma-3, Qwen2.5).
  • The improvement factor is 5–7x in perplexity delta at 3x compression.
  • int8 factor quantization is effectively lossless for the fitted subspace.
  • The “drift wall” at 3x compression is largely an artifact of the approximation norm, not a fundamental limit of scale.

Suggestive, needs additional validation

  • Compression can act as denoising (Gemma-3-1B beats the teacher). Requires multi-seed replication and a second architecture.
  • The hybrid low-rank + quantized residual design outperforms pure int4 on o_proj. Requires MLP-family evaluation where the payoff should concentrate.

Open — not currently claimed

  • Algorithmic novelty over ASVD or EoRA — head-to-head comparison not yet run.
  • Whole-model compression — only attention output projections are demonstrated at 3x.
  • Deployment readiness — warmed-up latency, peak memory, and fused kernel behavior are unmeasured.
  • Downstream task performance — only perplexity has been evaluated.

7. What this paper does not claim

  • This work does not claim that low-rank compression universally beats quantization for storage. Quantization dominates pure storage; the value here is quality-at-rank and the denoising effect.
  • This work does not claim that every transformer matrix is equally compressible. Only attention output projections are viable at 3x; MLP families break even with weighted fitting.
  • This work does not claim that activation weighting solves all compression problems. It is one technique with specific scope and tradeoffs.
  • This work does not claim deployment readiness. The compressed representation changes the compute graph; latency and memory implications are uncharacterized.
  • This work does not claim that the denoising effect is general. It has been observed on one architecture and requires multi-seed replication.

8. Limitations

Scope of compression

Only attention output projections are demonstrated at 3x. MLP matrices — which contain 80% of parameters — break even with weighted fitting at this ratio. Whole-model compression requires budget reallocation across families, which has not been shown.

Statistical robustness

Most results are single calibration/fit runs. A ±1pp robustness test on disjoint calibration data shows stability, but multi-seed statistics are not yet available.

Evaluation scope

Evaluation is limited to perplexity on WikiText-2 (50–200 texts). No downstream-task evaluation, no pre-registered drift metric alongside PPL.

Latency and memory

Factored form changes the compute graph. Warmed-up latency and peak memory are unmeasured. Without a fused low-rank kernel, the storage win does not automatically become a speed win.

9. What did not work

Direct pruning

Deleting 50% of weights (even using activation-aware selection) raised GPT-2 perplexity from 36 to 79 — still 2x worse than the original. At 90% pruning, perplexity exceeds 15,000. Pruning and low-rank compression are fundamentally different operations: pruning removes structure entirely, while low-rank compression redistributes it.

Student-input refitting

Trying to anticipate drift by fitting against the compressed model’s own activations (rather than the original model’s) consistently lost ~1pp across all settings. Anticipating drift is not the lever; fixing the norm is.

MLP compression at 3x

Weighted fitting on MLP matrices (c_fc, c_proj) produced 76–2149% PPL increases at 3x ratio. MLP families do not have enough redundancy at this compression level, even with activation-aware fitting.

Reference neurons

Using reference neurons to encode weight matrices was consistently less efficient than matched SVD at every rank level tested. This confirmed SVD as the right baseline for comparisons.

Glossary

TermDefinition
Low-rankA matrix represented using fewer underlying dimensions. Instead of storing every entry, two smaller matrices whose product approximates the original.
SVDSingular Value Decomposition. A standard method for finding the most important directions in a matrix. The default tool for low-rank approximation.
ActivationThe signal produced inside a neural network when an input passes through a layer. Activations indicate which parts of the network are “firing” for a given input.
Calibration dataRepresentative inputs used to observe the model’s activation patterns before compression.
RankThe number of independent directions retained by the compressed representation. Higher rank = more faithful to the original but less compression.
Perplexity (PPL)A language-model metric measuring how well the model predicts text. Lower is better. A PPL of 36 is good; 15,000 means the model is essentially random.
Gram matrixA matrix summarizing which directions appear frequently in the calibration activations. Defines the geometry in which compression error is measured.

References

  1. Frantar et al. “GPTQ: Accurate post-training quantization for generative pre-trained transformers.” arXiv:2210.17323, 2022.
  2. Frantar & Alistarh. “SparseGPT: Massive language models can be accurately pruned in one-shot.” arXiv:2301.00774, 2023.
  3. Lin et al. “AWQ: Activation-aware weight quantization for LLM compression and acceleration.” arXiv:2306.00978, 2023.
  4. Yuan et al. “ASVD: Activation-aware singular value decomposition for large language model compression.” arXiv:2312.05821, 2023.
  5. Liu et al. “EoRA: Fine-tuning-free compensation for compressed LLM with eigenspace low-rank approximation.” arXiv:2410.21271, 2024.
  6. Arai & Ichikawa. “Quantization error propagation: Revisiting layer-wise post-training quantization.” arXiv:2504.09629, 2025.
  7. Li et al. “SVDQuant: Absorbing outliers by low-rank components for 4-bit diffusion models.” arXiv:2411.05007, 2024.
  8. Merity et al. “Pointer sentinel mixture models.” arXiv:1609.07843, 2016.