Abstract
Large language models (LLMs) have demonstrated remarkable performance across a wide range of industrial applications, from search and recommendation systems to generative tasks. Although scaling laws indicate that larger models generally yield better generalization and performance, their substantial computational requirements often render them impractical for many real-world scenarios at scale. In this paper, we present a comprehensive set of insights for training and deploying small language models (SLMs) that deliver high performance for a variety of industry use cases. We focus on two key techniques: (1) knowledge distillation and (2) model compression via structured pruning and quantization. These approaches enable SLMs to retain much of the quality of their larger counterparts while significantly reducing training/serving costs and latency. We detail the impact of these techniques on a variety of use cases in a large professional social network platform and share deployment lessons, including hardware optimization strategies that improve speed and throughput for both predictive and reasoning-based applications in Recommendation Systems.
Introduction
In modern Recommendation Systems (RecSys), latency is a critical constraint. While "Scaling Laws" suggest that larger models (100B+ parameters) offer superior performance, their substantial computational overhead makes real-time serving for millions of users impractical. This paper addresses the "deployment gap" by presenting a practical blueprint for shrinking massive Foundation Models (FMs) into high-performance Small Language Models (SLMs) of 1B–8B parameters without losing the sophisticated reasoning and ranking capabilities of their larger counterparts.
Methodology: The Distill-Prune-Redistill Pipeline
The core contribution is a specialized three-stage workflow designed to maintain the performance of large models within a smaller footprint.
- Initial Distillation: A small "student" model is trained to mimic the output probabilities (logits) of a large "teacher" model using Forward Kullback-Leibler (FKL) divergence.
- One-Shot Structured Pruning: Utilizing the OSSCAR algorithm, the team removes entire redundant structures—specifically neurons in the Feed-Forward Networks (MLP) and Attention Heads. Structured pruning is preferred over unstructured methods because it leads to immediate hardware speedups without requiring specialized kernels.
- Re-distillation: The pruned model undergoes a final round of distillation to recover any quality lost during the pruning stage.
For serving, the models leverage SGLang with FP8 quantization on NVIDIA H100 GPUs, utilizing RadixAttention (prefix caching) to handle long user histories efficiently.
Experimental Results and Insights
The researchers evaluated their approach using a mix of internal industrial RecSys data and public reasoning benchmarks (e.g., OpenThoughts, AIME).
Distillation vs. Fine-Tuning
A key finding is that standard Supervised Fine-Tuning (SFT) is insufficient for recovering performance after pruning. Logit-based Knowledge Distillation (KD) is significantly more effective at preserving the teacher's "nuance."
As shown in the figure above, an 8B model pruned to 6.4B lost only 0.06% AUC when using KD, compared to a much steeper 0.47% loss using standard SFT. Similar trends were observed for 3B models, where KD limited the loss to 0.15% compared to 1.21% for SFT.
Hardware Efficiency and Latency
In long-context recommendation tasks, the attention mechanism was identified as the primary latency hog. Pruning attention heads yielded a 40% reduction in attention latency and a 28% overall speedup in the prefill stage. By optimizing the serving stack with FP8 and prefix caching, 32k context windows became viable for real-time ranking.
The Teacher Size Paradox
Interestingly, a larger teacher is not always better. For a 1.5B student, a 3B teacher sometimes outperformed a 7B teacher in single-stage setups. This suggests that the "knowledge gap" between teacher and student must be manageable for effective transfer; if the gap is too large, the student may fail to converge effectively.
Conclusion
By combining structured pruning with multi-stage distillation, this work demonstrates that it is possible to reduce model size by over 20x while maintaining near-original performance. These techniques enable the deployment of reasoning-capable models in high-traffic, latency-sensitive environments. Future work will explore combining structured pruning with sparse attention mechanisms to further push the boundaries of efficiency as inference engines evolve.
Summary updated