Turbocharging LinkedIn’s Recommendation Systems with SGLang

Steven Shimizu
10 min readadvanced
--
View Original

Overview

The article discusses how LinkedIn enhanced its recommendation systems using SGLang, an open-source LLM serving framework. It highlights the integration of multi-item scoring techniques and optimizations that significantly improved latency and performance in ranking tasks.

What You'll Learn

1

How to integrate multi-item scoring in recommendation systems

2

Why optimizing attention kernels improves LLM performance

3

How to implement latency hiding techniques in LLM workflows

Key Questions Answered

How does multi-item scoring improve LinkedIn's recommendation system?
Multi-item scoring allows the concatenation of multiple candidate items with a member prompt, enabling the model to return ranking scores in a single request. This approach reduces overhead from repeated prompts, improving efficiency and reducing latency significantly.
What were the latency improvements achieved with SGLang optimizations?
The multi-item scoring optimization decreased latency for ranking 50 items by 69% compared to the baseline single-item scoring approach. Additional improvements from FlashInfer and SGLang updates further reduced latency by approximately 16% overall.
What is the significance of the Knock-Knock technique in LLM workflows?
The Knock-Knock technique allows for preemptive execution of LLM on user context while item retrieval occurs, effectively hiding the latency of member prompt prefill. This results in a significant reduction in overall latency, enhancing the user experience.

Key Statistics & Figures

Latency reduction for ranking 50 items
69%
Compared to the baseline single-item scoring approach with prefix caching enabled.
Additional latency reduction from FlashInfer FA3
~11%
Compared to the prior FA2 implementation.
Overall latency reduction from SGLang updates
5%
Achieved by upgrading from SGLang 0.4.1.post6 to 0.4.3.post2.
Overall latency decrease from Knock-Knock technique
~38%
Reduced from 520ms to 200ms.

Technologies & Tools

Backend
Sglang
An open-source LLM serving framework used for optimizing LinkedIn's recommendation systems.
Backend
Flashattention 3
An optimized attention backend integrated into SGLang to enhance performance for long-context inference.
Backend
Fp8
A precision format used in SGLang to improve performance metrics while maintaining accuracy.

Key Actionable Insights

1
Implement multi-item scoring to reduce overhead in ranking tasks.
By allowing multiple candidate items to be processed in a single prompt, you can significantly enhance the efficiency of your recommendation system, especially under high traffic conditions.
2
Optimize attention kernels to improve LLM performance.
Utilizing advanced attention mechanisms like FlashAttention 3 can lead to substantial performance gains, particularly for workloads with long input contexts.
3
Adopt latency hiding techniques to enhance user experience.
By executing LLM processes in parallel with data retrieval, you can minimize perceived latency and improve responsiveness in applications reliant on real-time recommendations.

Common Pitfalls

1
Relying solely on single-item scoring can lead to inefficiencies.
This method incurs significant overhead due to repeated prompts. Transitioning to multi-item scoring can mitigate this issue and enhance performance.