Layer-wise dynamic rank for compressing large language models

Zhendong Mi, Bian Sun, Grace Li Zhang, Shaoyi Huang

TL;DR

D-Rank is a novel post-training compression framework for Large Language Models (LLMs) that replaces uniform Singular Value Decomposition (SVD) truncation with layer-wise dynamic rank allocation. By utilizing a novel "effective rank" metric and a Lagrange multiplier optimization scheme, D-Rank preserves critical information in dense middle layers and key attention matrices ($W^V$), yielding significantly lower perplexity, higher reasoning accuracy, and superior throughput compared to standard SVD baselines.

What Problem Does This Paper Address?

As Large Language Models (LLMs) scale up, their massive memory and computational footprints make deployment costly and hardware-intensive. While post-training compression using Singular Value Decomposition (SVD) is a popular way to reduce model size without expensive retraining, existing methods suffer from a major flaw: they apply a uniform compression ratio across all layers.

This uniform approach ignores intra-layer heterogeneity. In LLMs, information density follows a U-shaped distribution—middle layers encode rich, complex features, while early and late layers contain highly redundant information. Treating all layers equally results in aggressive information loss in critical parts of the network. Furthermore, standard cross-layer weight-sharing techniques fail on modern architectures that use Grouped-Query Attention (GQA), such as LLaMA-3, because their key/value projection matrices are already architecturally slimmed down.

Methods

The authors introduce D-Rank, a framework designed to dynamically balance rank allocation across layers and attention matrices:

  1. Effective Rank Metric: To quantify information density, the authors propose "effective rank," a metric calculated using the spectral entropy of scaled weight matrices. A higher effective rank indicates higher information density and less redundancy.
  2. Lagrangian Optimization: Instead of guessing the optimal rank for each layer, D-Rank formulates rank allocation as a constrained optimization problem. Using Lagrange multipliers, it automatically assigns more rank budget to layers with higher information density under a fixed global compression ratio.
  3. Attention Layer Rebalancing: The authors discover that information is unevenly distributed within the attention mechanism itself. D-Rank introduces an adjustment ratio ($\beta$) to shift a portion of the rank budget away from the lower-density query ($W^Q$) and key ($W^K$) matrices and into the information-rich value ($W^V$) matrices.
  4. GQA Adaptation: To prevent severe reconstruction errors in GQA-based models like LLaMA-3, D-Rank isolates individual layers (setting group size $n=1$) rather than forcing joint cross-layer compression.
Figure 1: The overall pipeline of our proposed D-Rank

Datasets

The authors evaluated D-Rank across two primary categories of benchmarks:

  • Language Modeling: PTB, WikiText-2, and C4.
  • Zero-shot Reasoning: MathQA, PIQA, ARC-easy, ARC-challenge, HellaSwag, WinoGrande, and OpenbookQA (evaluated via the LM-Evaluation-Harness framework).

Key Insights and Ideas

  • The $W^V$ Information Oasis: One of the paper's most striking findings is the massive imbalance within attention layers. The effective rank of the value matrix ($W^V$) consistently skyrockets past 1,000, while the query ($W^Q$) and key ($W^K$) matrices hover below 50. This implies that $W^V$ requires far more capacity to avoid performance degradation.
Effective ranks of grouped W^Q, W^K, W^V matrices for LLaMA-7B
  • The GQA Bottleneck Explained: The paper clarifies why previous cross-layer weight-sharing methods degrade on newer models like LLaMA-3. Because GQA already slims down the column dimensions of $W^K$ and $W^V$, grouping multiple layers for joint SVD forces an overly aggressive compression that destroys model performance.

Key Results

D-Rank consistently outperforms state-of-the-art SVD baselines (like SVD-LLM and Basis Sharing) across multiple model families (LLaMA, LLaMA-2, LLaMA-3, and Mistral):

  • Massive Perplexity Reductions: On LLaMA-3-8B at a 20% compression ratio, D-Rank achieves a perplexity of 44.87 on the C4 dataset—over 15 points lower than the Basis Sharing baseline (60.08).
  • Higher Reasoning Accuracy: For LLaMA-7B at a 40% compression ratio, D-Rank delivers up to 5% higher zero-shot reasoning accuracy than standard uniform SVD methods.
  • Hardware Throughput Gains: Because it optimizes matrix dimensions efficiently, D-Rank achieves the highest inference speed among all tested methods. At 50% compression on LLaMA-7B, it reaches nearly 2,200 tokens/second, representing a 60% throughput gain over the uncompressed dense model.

Limitations and Future Work

While highly effective, the paper notes a few limitations:

  • Error Accumulation at High Compression: When the compression ratio exceeds 40%, accumulated truncation errors cause downstream layer inputs to deviate significantly from their original values. Although the authors mitigate this using adaptive downstream weight updates, extreme compression remains a challenge.
  • Hyperparameter Tuning: The attention rebalancing strategy relies on the adjustment ratio $\beta$. While the authors find that a value between 0.3 and 0.4 consistently works best, this parameter still requires manual tuning.
  • Future Directions: The authors suggest that combining D-Rank's layer-wise dynamic allocation with other compression paradigms, such as quantization or knowledge distillation, could yield even more powerful hardware accelerations.

Summary updated

BibTeX
@misc{mi2025layer,
  author = {Zhendong Mi and Bian Sun and Grace Li Zhang and Shaoyi Huang},
  title = {{Layer-wise dynamic rank for compressing large language models}},
  year = {2025},
  eprint = {2509.25622},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.25622},
}
Figure