Introduction
Deploying Large Language Models (LLMs) on edge devices like smartphones is a critical step toward ensuring user privacy and offline reliability. However, the sheer size of state-of-the-art models remains a significant barrier. While unstructured pruning can reduce model size, it rarely translates to real-world speedups on standard hardware. Conversely, traditional structured pruning often degrades model performance sharply at high compression ratios by disrupting the delicate interconnections between layers.
Presented at ACL 2024, TransAct is a structured pruning framework designed to address these challenges. It achieves high compression (up to 80%) while maintaining significant intelligence and delivering substantial inference speedups on mobile hardware.
Methodology: Intra-module Low-rank Architecture
The core innovation of TransAct lies in its architectural approach to pruning. Most structured pruning methods narrow the entire model's hidden dimension ($H$), which flows through the residual stream. This often causes "unrecoverable damage" to the model's capacity.
TransAct introduces an intra-module low-rank architecture. Instead of pruning the inter-module activations (the residual stream), it targets the "transitional activations" within the Multi-Head Attention (MHA) and Multi-Layer Perceptron (MLP) modules. By preserving the sensitive inter-module dimensions and slimming down the internal "transitional" work, TransAct creates a more resilient pruned structure.
Activation-Guided Metric
TransAct utilizes an activation-guided metric to determine which components to prune. Recognizing that LLMs contain specific "outlier" activations that carry disproportionate amounts of information, the authors developed a metric that evaluates both general magnitude and maximum outlier values. An $\alpha$ factor is used to amplify these outliers, ensuring that critical attention heads or neurons are preserved even if their average activation is low.
Iterative Pruning and Fine-tuning
Rather than a single "one-shot" pruning step, TransAct employs an iterative process. The model is pruned in stages, with each stage followed by short bursts of fine-tuning. This allows the remaining weights to adapt and "heal" from the loss of pruned parameters. For the final model, the authors used 800 million tokens for iterative pruning and 50 billion tokens from the RedPajama-V1 dataset for post-training.
Key Results: Efficiency and Latency
TransAct demonstrates superior efficiency compared to existing state-of-the-art methods like Sheared-LLaMA and LLM-Pruner.
Mobile Performance
When deployed on a Xiaomi 14 (Snapdragon 8 Gen 3) using 4-bit quantization, TransAct-1.3B (pruned from LLaMA2-7B) achieved a 75-80% reduction in latency compared to the original 7B model. This speedup is consistent across various prefix and decoding lengths, making it highly suitable for real-time edge applications.
KV Cache and FLOPs
A major bottleneck for LLMs on edge devices is the Key-Value (KV) cache, which limits context length. By pruning attention heads directly, TransAct reduces the KV cache footprint by up to 81%. Additionally, TransAct-1.3B achieves 20% more FLOPs savings than Sheared-LLaMA at a comparable parameter count.
Accuracy at High Compression
At 80% compression, TransAct-1.3B retained approximately 78% of the original LLaMA2-7B's performance across a wide battery of benchmarks (including ARC, BoolQ, and HellaSwag). It significantly outperformed competing methods in zero-shot tasks like TriviaQA and TruthfulQA, proving that its architectural choices successfully preserve the model's underlying "intelligence."
Conclusion
TransAct represents a significant advancement in LLM compression. By co-designing the pruning architecture and metrics to focus on transitional activations, it enables deep pruning without the typical performance collapse. Its ability to deliver high-speed inference and reduced memory footprints on mobile hardware brings the goal of ubiquitous, local LLM deployment closer to reality. Future work may explore combining TransAct with dynamic compression techniques or applying its principles to non-Transformer architectures.
Summary updated