TL;DR
DegreeSpar introduces a unified optimization framework for secure Transformer inference by treating nonlinear polynomial degrees as a shared coordinate for compression. By jointly optimizing for nonlinear approximation, token pruning, and model pruning within this single "degree space," it achieves 2.29×–6.63× speedups over standard secure inference baselines with significantly better accuracy preservation than modularly stacked compression methods.
What Problem Does This Paper Address?
Deploying Transformers in privacy-sensitive environments requires secure inference frameworks based on Homomorphic Encryption (HE) and Secure Multi-Party Computation (MPC). While these protect data, they are orders of magnitude slower than plaintext execution. The primary bottleneck is nonlinear computation (Softmax and GeLU), which requires expensive interactive protocols or complex polynomial approximations.
Existing compression techniques—like token pruning, model pruning, and polynomial approximation—usually operate in separate optimization silos. When these methods are "stacked" to reach aggressive efficiency targets, their independent errors and perturbations accumulate, leading to a collapse in model accuracy. For instance, the authors show that stacking standard methods reduces ViT-S accuracy from 80.20% to 76.41%, whereas their joint approach maintains 80.12%.
Methods
The core innovation of DegreeSpar is the formulation of secure Transformer compression as structured degree sparsification.
- Shared Degree Space: The authors represent nonlinear evaluations using degree matrices ($M_{N \times N}$ for Softmax and $M_{N \times D}$ for GeLU). In the cryptographic domain, the polynomial degree directly dictates the number of expensive secure multiplications and squarings.
- Structured Sparsity: Instead of just reducing degrees entry-wise, DegreeSpar organizes these variables into computation-aligned groups:
- Token-aligned sparsity: Zeroing out a row in the degree matrix corresponds to removing a token entirely.
- Dimension-aligned sparsity: Zeroing out a column corresponds to pruning a model dimension (e.g., in the FFN layer).
- Approximation-Aware Training: To make the model robust to the high numerical errors of very low-degree polynomials (e.g., degree-2), the authors use adaptive noise injection for Softmax and soft-boundary training for GeLU. This "headroom" allows the optimizer to push for even lower degrees without losing accuracy.
- Secure Execution: During inference, the system uses a privacy-preserving Variance-Guided CLS Attention (VCA) score to rank tokens and an oblivious sorting/routing protocol to prune them without revealing which specific tokens were dropped to the server.
Datasets
The authors evaluated DegreeSpar across both vision and language tasks:
- Vision: ImageNet-1K using ViT-Small, ViT-Base, and ViT-Large.
- Language: BERT-Base evaluated on the IMDB dataset and the GLUE benchmark (specifically CoLA, SST-2, and MNLI).
Key Insights and Ideas
- Degree as a Unified Metric: The "aha moment" is realizing that polynomial degree is the perfect common denominator. It is a direct proxy for cryptographic cost and can be structured to represent both fine-grained approximation and coarse-grained structural pruning.
- Joint vs. Modular: The paper proves that coordinating compression is essential. By optimizing all components together, the model can "balance" the error budget across different layers and types of operations.
- VCA over Raw Attention: In early Transformer layers, raw attention is often a poor indicator of token importance. VCA uses feature variance in shallow layers and transitions to [CLS] attention in deeper layers, providing a more stable signal for secure token pruning.
Key Results
- Significant Speedups: DegreeSpar achieved speedups ranging from 2.29× to 6.63× across various models and tasks compared to uncompressed secure baselines.
- Superior Accuracy-Latency Trade-off: On BERT/SST-2, DegreeSpar reached 92.68% accuracy in 110.55 seconds. In comparison, CipherPrune (the previous state-of-the-art hybrid approach) took 167.26 seconds to reach essentially the same accuracy (92.66%).
- Robustness: Approximation-aware training recovered ViT-Base accuracy from 78.12% (naive low-degree) to 81.28%, providing the necessary stability for aggressive compression.
Limitations and Future Work
- Offline Training Cost: While inference is fast, the one-time offline optimization process takes between 1 to 6 hours on NVIDIA A100 GPUs, depending on the model and dataset.
- Threat Model: The current work assumes a two-party semi-honest setting. Extending these structured sparsity benefits to malicious adversary models or multi-party settings (more than two parties) remains an open area.
- Fixed Budgets: The token retention budgets are fixed per layer after training to ensure data-independent execution shapes. Exploring more dynamic but still secure budget allocations could be a future direction.
Summary updated