Abstract
The reasoning abilities of Large Language Models (LLMs) can be improved by structurally denoising their weights, yet existing techniques primarily focus on denoising the feed-forward network (FFN) of the transformer block, and can not efficiently utilise the Multi-head Attention (MHA) block, which is the core of transformer architectures. To address this issue, we propose a novel intuitive framework that, at its very core, performs MHA compression through a multi-head tensorisation process and the Tucker decomposition. This enables both higher-dimensional structured denoising and compression of the MHA weights, by enforcing a shared higher-dimensional subspace across the weights of the multiple attention heads. We demonstrate that this approach consistently enhances the reasoning capabilities of LLMs across multiple benchmark datasets, and for both encoder-only and decoder-only architectures, while achieving compression rates of up to $\sim 250$ times in the MHA weights, all without requiring any additional data, training, or fine-tuning. Furthermore, we show that the proposed method can be seamlessly combined with existing FFN-only-based denoising techniques to achieve further improvements in LLM reasoning performance.
Introduction
It is a well-known observation in deep learning that Large Language Models (LLMs) are significantly overparameterized. Recent research suggests that post-training structural compression of weights—such as using Singular Value Decomposition (SVD) to remove low-rank components—can actually improve reasoning performance. This process effectively "denoises" the model by stripping away random artifacts and noise memorized during the training phase.
However, existing state-of-the-art methods like LASER and TRAWL primarily yield these reasoning improvements when applied to the Feed-Forward Network (FFN) layers. When applied to the Multi-Head Attention (MHA) layers, these methods often fail to maintain performance. This failure stems from treating MHA weight matrices independently, ignoring the inherent relationship between attention heads. TensorLLM addresses this by modeling the intuition that attention heads within a layer share a latent subspace while specializing in distinct tasks.
Methodology
TensorLLM introduces a three-step post-training framework to successfully denoise and compress MHA blocks:
- Multi-head Tensorisation: Instead of treating query ($W^Q$), key ($W^K$), value ($W^V$), and output ($W^O$) projections as independent 2D matrices, they are split by attention head and stacked into a single 4D tensor representing the entire MHA layer.
- Tucker Decomposition with Shared Factor Matrices: A specialized Tucker decomposition is applied to this 4D tensor. The framework enforces shared factor matrices across all heads in a layer to define a common abstraction subspace, while allowing each head to maintain a unique, smaller "core tensor" for specialization.
- Low-Rank Approximation: By truncating the decomposition and discarding the smallest components, the model is structurally denoised and compressed.
This approach is entirely post-training and requires no additional data or fine-tuning.
Experimental Results
The framework was evaluated using RoBERTa (125M), GPT-J (6B), and LLaMA 2 (7B) across four reasoning benchmarks: HotPotQA, FEVER, Bios Profession, and BigBench-WikidataQA.
Enhanced Reasoning and Compression
As shown in the experimental data, TensorLLM consistently improved test accuracy compared to uncompressed baselines across all models and datasets. Notably, the method achieved massive compression ratios for MHA weights, reaching up to 247.3x on GPT-J for the HotPotQA dataset while simultaneously improving accuracy.
Synergy with FFN Methods
A key finding is that TensorLLM is complementary to existing FFN-focused methods. When combined with LASER (applied to FFN blocks), the hybrid approach achieved the highest test accuracies across nearly all combinations, demonstrating that MHA and FFN denoising provide additive benefits.
Conclusion
TensorLLM provides a powerful, training-free method for enhancing LLM reasoning through structured denoising of the MHA block. By leveraging multi-head tensorisation and shared factor matrices, it achieves significant compression and performance gains. Future work will focus on automating hyperparameter selection for multilinear ranks to allow for more generalizable, out-of-the-box application across diverse architectures.
Summary updated