TL;DR
Transformers are computationally expensive, and existing token pruning methods often rely on flawed attention scores and rigid pruning rates. This paper introduces AD-TP (Attribution-Driven Adaptive Token Pruning), a method that uses Integrated Gradients to accurately identify important tokens and dynamically adjusts the pruning ratio based on sequence complexity. The result is a massive ~7.8× reduction in FLOPs on GLUE tasks without sacrificing accuracy, making Transformer inference significantly faster and cheaper.
What Problem Does This Paper Address?
The self-attention mechanism in Transformers scales quadratically with sequence length, creating a massive computational bottleneck for long texts. To speed up inference, researchers use token pruning—identifying and dropping less important words (tokens) from the sequence so the model has less data to process.
However, current token pruning methods suffer from two major blind spots:
- Flawed Importance Metrics: Most methods use attention weights to decide which tokens to keep. But attention measures token-to-token interaction, which doesn't always correlate with a token's actual semantic contribution to the final prediction.
- Rigid Pruning Ratios: Existing methods usually apply a fixed pruning threshold across the board. This ignores the reality of language: a simple, straightforward sentence might only need 20% of its tokens retained to be understood, while a highly complex, nuanced sentence might need 80%.
Methods
To fix these issues, the authors propose AD-TP, which shifts the paradigm from attention-driven pruning to attribution-driven adaptive pruning.
- Integrated Gradients (IG) for Saliency: Instead of looking at attention scores, the authors use IG during training. IG is an attribution method that calculates the exact marginal contribution of each input feature to the model's final prediction. This serves as the "ground truth" for token importance.
- Attribution-Aware Adaptive Token Retainer: Because calculating IG during inference would be far too slow, the authors introduce a lightweight neural module added to the input layer. It consists of two parts:
- Token Saliency Predictor (TSP): A small network trained to mimic the IG scores, predicting how important each token is on the fly.
- Adaptive Retention Ratio Predictor (ARP): A module that looks at the global
[CLS]token to gauge the complexity of the specific input sequence, dynamically selecting a target retention ratio (e.g., keep 30% vs. keep 70%) from a predefined list. - Distillation and Dual Normalization: The model is trained using a teacher-student knowledge distillation framework. To ensure the smaller student model learns the correct token importance from the teacher, the authors introduce a "dual normalization" strategy that aligns the scale of the IG attribution scores between the two models.
Datasets
The authors evaluated AD-TP on a standard suite of NLP benchmarks:
- GLUE Benchmark: 8 diverse natural language understanding tasks (CoLA, RTE, QQP, MRPC, SST-2, MNLI, QNLI, STS-B).
- Long-Sequence Datasets: SQuAD v2.0 (Question Answering) and 20News (Document Classification) to test the method's viability on longer, more computationally demanding texts.
Key Insights and Ideas
- Attention is not explanation: The authors empirically demonstrate that using attention scores to rank tokens leaves a lot of performance on the table. Attribution methods are vastly superior at identifying the tokens that actually drive the model's reasoning.
- One size does not fit all: Forcing a static pruning ratio across an entire dataset leads to suboptimal compression. As shown in the sequence length distributions below, datasets have massive variance in length and complexity. By allowing the model to dynamically predict a retention ratio per sequence, AD-TP avoids over-pruning hard sentences and under-pruning easy ones.
- Train heavy, run light: By using the computationally expensive IG method only as a supervisory signal during training, the authors successfully teach a lightweight MLP to approximate these scores. This gives the model the accuracy benefits of IG without the massive inference-time penalty.
Key Results
- Massive Efficiency Gains: On the GLUE benchmark, AD-TP (using a 6-layer student model) reduced FLOPs by an average of 7.8× while actually improving performance by 0.6% compared to the unpruned student baseline.
- Dominating Long Sequences: On the 20News dataset, the 6-layer AD-TP model beat the unpruned 12-layer BERT-base in accuracy, while requiring 8.74× fewer FLOPs.
- Real-World Latency: Theoretical FLOP reductions translated well to wall-clock speedups. On an RTX 3060 GPU, end-to-end inference latency dropped by 30% to 55% (e.g., 51.5% faster on SST-2 and 42.8% faster on SQuAD).
- Beating the State-of-the-Art: AD-TP consistently outperformed existing top-tier pruning methods like ToP, LTP, and PoWER-BERT under identical computational budgets.
Limitations and Future Work
- Input-Layer Only: The current AD-TP architecture only applies pruning at the initial input/embedding layer. The authors note that extending this adaptive pruning mechanism dynamically across deeper layers of the Transformer is a prime direction for future research.
- Training Overhead: Because calculating Integrated Gradients and running a teacher model is computationally intensive, the training time for AD-TP increases by about 20–30% compared to standard BERT training.
- Hardware Testing: While GPU latency was measured, the authors plan to evaluate AD-TP on mobile and edge CPUs to further validate its real-world deployment efficiency in resource-constrained environments.
Summary updated