Scaling Down, Serving Fast: Compressing and Deploying Efficient LLMs for Recommendation Systems

Kayhan Behdin, Ata Fatahibaarzi, Qingquan Song, Yun Dai, Aman Gupta, Zhipeng Wang, Shao Tang, Hejian Sang, Gregory Dexter, Sirou Zhu, Siyu Zhu, Tejas Dharamsi, Vignesh Kothapalli, Zhoutong Fu, Yihan Cao, Pin-Lun Hsu, Fedor Borisyuk, Natesh Pillai, Luke Simon, Rahul Mazumder

This paper presents a robust pipeline for "scaling down" massive Large Language Models (LLMs) into efficient Small Language Models (SLMs) specifically optimized for high-throughput, low-latency recommendation systems (RecSys). By combining knowledge distillation, structured pruning, and quantization, the authors demonstrate how to achieve a 20x reduction in model size while maintaining near-original performance on complex ranking and reasoning tasks.

TL;DR

LinkedIn researchers share their production-proven recipe for compressing 100B+ parameter foundation models into serving-ready SLMs. By using a multi-stage pipeline of distillation and structured pruning, they achieved significant latency reductions (e.g., a 28% speedup in prefill latency) with negligible impact on recommendation quality.

What Problem Does This Paper Address?

In the world of industrial recommendation systems, there is a constant tension between model quality and serving cost. While "scaling laws" suggest that bigger models perform better, deploying a 100B+ parameter model for real-time ranking is often economically and technically infeasible due to extreme latency and infrastructure costs.

Existing compression techniques like quantization or pruning often lead to a "utility gap"—a noticeable drop in accuracy that product teams cannot accept. This paper tackles the challenge of bridging that gap, providing a practical methodology to create SLMs that inherit the "intelligence" of their giant counterparts but fit within the strict latency budgets of a professional social network.

Methods

The authors propose a three-stage compression pipeline, illustrated in the overview below:

Figure 1: Overview of the process of creating SLMs via distillation and compression.
  1. Distillation on the Full Model: They start by transferring knowledge from a large internal Foundation Model (FM) to a smaller student (e.g., Llama-3 8B or 3B). They found that Forward KL (FKL) divergence was the most effective loss function for this stage.
  2. One-Shot Structured Pruning: They use the OSSCAR algorithm to remove redundant neurons in MLP layers and attention heads. Unlike unstructured pruning, structured pruning results in smaller, dense matrices that provide immediate hardware acceleration.
  3. Re-distillation: After pruning, the model typically loses some accuracy. The authors perform a second round of distillation, using the unpruned student as the teacher, to recover the lost performance.

For reasoning tasks, they highlight a two-stage distillation approach: an initial word-level distillation followed by an on-policy distillation phase (where the model learns from its own generated sequences), which consistently outperformed single-stage methods.

Datasets

  • Internal RecSys Data: A massive dataset of user-item interactions (likes, clicks, etc.) from LinkedIn, featurized as text to allow the LLM to generalize across heterogeneous tasks.
  • OpenThoughts: A reasoning dataset used to distill Qwen-3 models.
  • Public Benchmarks: Evaluation was performed on standard benchmarks including AIME 2024/2025 (for reasoning), PIQA, and ARC (for general knowledge).
  • C4: Used as a generic calibration dataset for pruning, though the authors found task-specific data to be superior.

Key Insights and Ideas

  • KD > SFT: Knowledge Distillation (KD) is vastly superior to standard Supervised Fine-Tuning (SFT) for model compression. As shown in Figure 2, KD significantly mitigates the performance drop seen when moving to smaller model sizes.

    Figure 2: Comparison of Distillation and SFT on the Foundation Model. Knowledge distillation consistently outperforms SFT by effectively leveraging teacher su- pervision to preserve and enhance performance.
  • The Attention Bottleneck: In long-context scenarios (common in RecSys where user history is long), the attention mechanism becomes the primary latency bottleneck. Pruning attention heads yielded a 40% improvement in attention latency, contributing to a 28% overall speedup in the prefill phase.

    Figure 4: Latency breakdown of a single Transformer block for pruned and unpruned models. At longer con- text sizes, attention is a bottleneck.
  • Calibration Data Matters: Using just 350–700 task-specific examples for pruning calibration was more effective than using thousands of generic examples from the C4 dataset.

  • Gradual is Better: Pruning a model in multiple smaller steps with distillation in between (gradual pruning) recovers AUC better than a single aggressive pruning step.

Key Results

  • Massive Compression: Successfully reduced model size by over 20x (from a 100B+ MoE foundation model to serving-ready SLMs).
  • Latency Gains: As model size decreases, Time to First Token (TTFT) drops drastically. For a 16k context, the 2.1B pruned model achieved a P99 TTFT of ~184ms compared to over 1000ms for the original FM.

    Figure 3: P99 TTFT (ms) for various LLMs
  • Reasoning Improvements: On reasoning tasks, the distillation recipe improved student model performance by more than 20% on internal metrics and significantly boosted scores on public benchmarks like AIME.

  • Quantization Efficiency: For deployment on H100 GPUs, FP8 quantization provided the best balance of speed and quality. On older A100s, INT8 (W8A8) was preferred for prefill-heavy tasks.

Limitations and Future Work

The authors identify two main areas for future exploration:

  1. Sparse Attention: While techniques like "Star Attention" show promise for >3x speedups, they are currently incompatible with the SGLang inference engine used in LinkedIn's production environment.
  2. Unstructured Pruning: This work focused on structured pruning for its hardware-friendly nature. However, combining unstructured sparsity with structured methods could potentially push compression ratios even further without sacrificing quality.
  3. Scope: The study is limited to Recommendation Systems; the authors note that these techniques might require adaptation for other domains.

Summary updated

BibTeX
@misc{behdin2025scaling,
  author = {Kayhan Behdin and Ata Fatahibaarzi and Qingquan Song and Yun Dai and Aman Gupta and Zhipeng Wang and Shao Tang and Hejian Sang and Gregory Dexter and Sirou Zhu and Siyu Zhu and Tejas Dharamsi and Vignesh Kothapalli and Zhoutong Fu and Yihan Cao and Pin-Lun Hsu and Fedor Borisyuk and Natesh Pillai and Luke Simon and Rahul Mazumder},
  title = {{Scaling Down, Serving Fast: Compressing and Deploying Efficient LLMs for Recommendation Systems}},
  year = {2025},
  eprint = {2502.14305},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.14305},
}
Figure