Abstract
In sponsored search, determining ad relevance in real-time is critical for user experience and revenue, particularly for "cold start" ads that lack pre-computed features. While Transformer-based models like BERT offer high accuracy, their computational demands often exceed the strict latency budgets of production environments. This paper introduces SwiftPruner, a framework that utilizes a reinforced mutator within an evolutionary search algorithm to discover optimal layer-wise pruning strategies. By tailoring sparsity to specific hardware constraints, SwiftPruner enables high-performance BERT inference on standard CPUs. Experimental results at Microsoft Bing demonstrate a 43.46% reduction in latency and an 11.7% decrease in cold-start ad defects.
1. Introduction
Sponsored search systems must evaluate the relevance of query-ad pairs within milliseconds. Traditionally, this is achieved by pre-calculating ad features offline. However, this approach fails for new or modified ads—the "cold start" problem—forcing the system to rely on less accurate, lightweight models. To bridge this gap, modern systems require real-time, online inference of sophisticated models like BERT.
The primary challenge is the latency-accuracy trade-off. Standard BERT models, even in their "mini" configurations, struggle to meet the sub-2-millisecond latency requirements of search engines when running on standard CPUs. SwiftPruner addresses this by moving beyond uniform pruning, instead employing an automated, hardware-aware search to find the most efficient layer-wise configuration.
2. The SwiftPruner Framework
SwiftPruner optimizes model efficiency by exploring a non-uniform search space, recognizing that different layers of a Transformer contribute differently to its overall performance and latency.
2.1 Search Space and Architecture
The researchers focused on BERT-Mini (a 4-layer architecture). The search space for pruning included:
- Attention Heads: Each layer could retain between 1 and 4 heads.
- Feed-Forward Network (FFN) Dimensions: The intermediate dimensions were subject to 100 different levels of sparsity.
This configuration results in a search space of approximately $2 \times 10^{10}$ possible model variants, making manual tuning or exhaustive search impossible.
2.2 Reinforced Aging Evolution
To navigate this vast space, SwiftPruner utilizes Reinforced Aging Evolution. This method combines two paradigms:
- Evolutionary Algorithms (EA): A population of model candidates is maintained and evolved over time.
- Reinforcement Learning (RL): Instead of using random mutations, SwiftPruner employs an RNN-based Reinforced Mutator. This controller acts as an agent that learns which specific layers to prune and to what degree, optimizing the mutation process to favor high-reward architectures.
2.3 Latency-Aware Optimization
The reward function for the RL agent balances accuracy (measured via ROC AUC) against a strict hardware latency limit of 1900μs. To avoid the bottleneck of measuring every candidate on physical hardware, the framework uses a Random Forest regressor to predict latency based on the model's configuration. Models exceeding the latency threshold receive a heavy penalty, ensuring the search stays within production constraints.
3. Experimental Results
3.1 Performance and Efficiency
SwiftPruner significantly outperformed standard uniform pruning techniques. Key findings include:
- Latency Reduction: SwiftPruner reduced BERT-Mini's latency by 43.46% on standard CPUs with a negligible AUC loss of only 0.32%.
- Accuracy Gains: At the target 1900μs latency, SwiftPruner achieved a 0.86% higher AUC than state-of-the-art uniform pruning baselines.
3.2 Real-World Impact at Microsoft Bing
The optimized model, deployed as SwiftBERT, underwent live A/B testing in the Bing search environment. The deployment yielded substantial improvements in the cold-start segment:
- 11.7% reduction in defective (irrelevant) ads.
- 2.37% increase in click-through rate (CTR).
- 7.94% increase in revenue per mille (RPM).
4. Discussion: Insights into Model Redundancy
The search process revealed critical insights into the nature of Transformer redundancy:
- Non-Uniform Redundancy: Deeper layers in tiny Transformers are significantly more redundant than earlier layers. SwiftPruner consistently retained more attention heads in the first two layers while aggressively pruning the third and fourth.
- FFN Sparsity: The Feed-Forward Networks often contained more "dead weight" than the attention mechanisms. In high-speed configurations, FFN dimensions were sometimes pruned by over 99%.
- Hardware Sensitivity: Latency on CPUs does not scale linearly with parameter count due to specific mathematical optimization "cliffs" in runtimes like ONNX. SwiftPruner’s search-based approach successfully identified these hardware-specific sweet spots.
5. Conclusion
SwiftPruner demonstrates that automated, layer-wise pruning guided by reinforcement learning can make real-time BERT inference viable on standard hardware. By accounting for hardware-specific latency characteristics and non-uniform layer redundancy, the framework provides a robust solution for the cold-start problem in sponsored search. Future work will explore the application of SwiftPruner to dynamic ad generation and other vertical search domains.
Summary updated