Introduction
Deploying Large Language Models (LLMs) on mobile devices presents a significant engineering challenge due to strict hardware constraints. While modern flagship smartphones may boast 12GB of DRAM, mobile operating systems often restrict individual applications to using only 10–20% of that capacity. This memory bottleneck necessitates aggressive model compression.
Traditional compression research has largely focused on quantization (reducing bit-width) or width-based pruning (removing attention heads or FFN channels). However, FoldGPT identifies a critical alternative: depth redundancy. In many state-of-the-art LLMs, the outputs of consecutive layers exhibit extremely high similarity, often exceeding a cosine similarity of 0.9. This suggests that many layers perform redundant computations. FoldGPT exploits this redundancy to shrink the model's memory footprint without a substantial loss in performance.
Methodology
FoldGPT utilizes a three-stage pipeline to compress models by combining gated block removal with grouped parameter sharing.
1. Gated Block Removal
Unlike static methods that rank layer importance in isolation, FoldGPT introduces learnable gating parameters for each block. These gates are trained with a "smoothed L0" penalty, encouraging the model to polarize gates toward zero (removal) or one (retention). This approach accounts for the "coupling effect"—the interdependent nature of layers—resulting in a more optimal pruning strategy than simple similarity metrics.
2. Grouped Parameter Sharing
For the remaining blocks, FoldGPT applies a "folding" strategy. Blocks are organized into groups where a "parent" block shares its weights with several "child" blocks. To maintain expressivity, child blocks are equipped with a small set of learnable scaling coefficients. This drastically reduces the number of unique parameters stored in memory and improves cache hit rates during inference.
3. Tail-Layer Distillation & Fine-tuning
To recover performance lost during pruning and sharing, a lightweight fine-tuning stage is employed. The authors use Low-Rank Adaptation (LoRA) alongside a specialized distillation strategy focused on the final layers. This ensures the compressed model's outputs closely match the original teacher model.
Key Insights
- Depth vs. Width: Experiments indicate that depth-based structural pruning often outperforms width-based pruning for the same parameter budget. Removing entire layers is more effective than removing individual heads or channels.
- The Coupling Factor: Identifying redundant combinations of layers via learnable gates is superior to evaluating layers in a vacuum. This dynamic identification is a core strength of the FoldGPT approach.
- Efficiency Gains: Parameter sharing provides dual benefits: it reduces DRAM usage and improves inference latency by allowing the device to keep shared weights in the cache for longer periods.
Results and Performance
FoldGPT demonstrates state-of-the-art performance across several benchmarks:
- LLaMA-2-7B: At a 27% pruning rate, FoldGPT significantly outperformed other methods like SliceGPT and LLMPruner, retaining ~89.6% of dense performance. When pushed to an extreme 36% parameter reduction through combined removal and sharing, it maintained 96.25% of the original model's performance.
- Gemma-2B: On smaller architectures, FoldGPT achieved a 17.5% compression rate while retaining 94.39% of benchmark accuracy, outperforming ShortGPT.
Limitations and Future Work
FoldGPT is currently optimized for architectures with "stacked" identical blocks, such as standard Transformers. It may require adaptation for heterogeneous architectures like OpenELM, where block configurations vary. Additionally, while the theoretical memory savings are clear, the full hardware acceleration benefits of grouped parameter sharing will require the development of custom inference engines to maximize cache efficiency. Future work will focus on these engineering implementations and refining the granularity of the folding process.
Summary updated