Abstract
Large Pre-trained Language Models (PLMs) face significant deployment challenges due to high computational costs and the rigidity of traditional acceleration methods. We present Variator, a framework that introduces lightweight, "plug-and-play" compression modules to accelerate PLMs by reducing the sequence length of hidden representations. By adding less than 1% in new parameters to a frozen backbone, Variator achieves over 50% reduction in computational costs with minimal performance degradation. This modular approach allows for flexible, real-time scaling of inference speed to meet fluctuating hardware demands.
Introduction
The proliferation of massive Pre-trained Language Models (PLMs) like T5 and LLaMA has revolutionized NLP, but their inference costs remain a barrier to widespread application. Traditional acceleration techniques, such as distillation and pruning, typically produce static models. This rigidity leads to two primary issues: the inability to handle dynamic server workloads where latency requirements vary, and significant storage overhead from maintaining multiple compressed versions of the same model.
Variator addresses these challenges by decoupling the compression mechanism from the model weights, allowing for modular "plugins" that can be swapped to adjust the speed-accuracy trade-off without re-training or re-loading the entire backbone.
Methodology
The Variator framework consists of compact neural network layers inserted around the Feed-Forward Network (FFN) components of a frozen PLM.
Architecture
The core of Variator lies in two primary components:
- Hidden Compression Layer: This module aggregates a group of $k$ hidden vectors into a single representative vector using a weighted average, effectively reducing the sequence length by a factor of $k$.
- Hidden Decompression Layer: To maintain token-level granularity for specific tasks, this layer reconstructs the original sequence length from the compressed representation using an "Adapter" structure.
Training Strategy
To ensure high-fidelity compression, the authors employ a two-stage training process while keeping the original PLM weights frozen:
- Plugin Pre-training: Plugins are first trained on a large, task-agnostic corpus (e.g., Wikipedia) to learn general data compression patterns.
- Plugin Adaptation: The modules are then fine-tuned on specific downstream tasks. In both stages, Knowledge Distillation is used to encourage the compressed model to mimic the behavior of the original, uncompressed backbone.
Key Insights and Results
The evaluation of Variator across seven diverse NLP benchmarks, including MNLI, SQuAD, and SST-2, yielded several critical insights:
- Sequence Length as a Bottleneck: Variator demonstrates that reducing sequence length is a highly effective lever for acceleration, as Transformer complexity is heavily tied to token count.
- Efficiency and Footprint: On T5-base, Variator reduced computational costs (FLOPs) by 53.2% while staying within 2% of the original performance, adding only 0.9% additional parameters.
- Scaling Robustness: As the backbone model size increases (e.g., T5-XXLarge), the performance gap between compressed and original models narrows, suggesting that larger models are more resilient to sequence-level compression.
- Neuron-Level Sparsity: Analysis revealed that at high compression ratios (32x), less than 0.2% of FFN neurons were activated, indicating that Variator learns highly efficient, information-dense representations.
Conclusion
Variator provides a flexible and efficient solution for deploying large-scale PLMs. By focusing on sequence length compression through lightweight plugins, it enables dynamic inference scaling with minimal storage and computational overhead. Future work will explore extending these techniques to auto-regressive decoding and KV cache compression to further optimize modern decoder-only architectures like LLaMA.
Summary updated