Abstract
Modern large-scale recommender systems are built upon computation-intensive infrastructure and usually suffer from a huge difference in traffic between peak and off-peak periods. In peak periods, it is challenging to perform real-time computation for each request due to the limited budget of computational resources. The recommendation with a cache is a solution to this problem, where a user-wise result cache is used to provide recommendations when the recommender system cannot afford a real-time computation. However, the cached recommendations are usually suboptimal compared to real-time computation, and it is challenging to determine the items in the cache for each user. In this paper, we provide a cache-aware reinforcement learning (CARL) method to jointly optimize the recommendation by real-time computation and by the cache. We formulate the problem as a Markov decision process with user states and a cache state, where the cache state represents whether the recommender system performs recommendations by real-time computation or by the cache. The computational load of the recommender system determines the cache state. We perform reinforcement learning based on such a model to improve user engagement over multiple requests. Moreover, we show that the cache will introduce a challenge called critic dependency, which deteriorates the performance of reinforcement learning. To tackle this challenge, we propose an eigenfunction learning (EL) method to learn independent critics for CARL. Experiments show that CARL can significantly improve the users' engagement when considering the result cache. CARL has been fully launched in Kwai app, serving over 100 million users.
Introduction: The Challenge of Peak Traffic
In large-scale applications like Kwai, a short-video platform, user traffic fluctuates significantly throughout the day. During peak hours, queries-per-second (QPS) can surge, making it computationally prohibitive to perform complex, real-time deep learning ranking for every single request.
To maintain system stability, these platforms employ a result cache. When a user makes a request during a low-load period, the system computes a large batch of recommendations (e.g., $L$ items), serves the top $K$, and caches the remaining $L-K$ items. If the server becomes overloaded during subsequent requests, it bypasses real-time computation and serves the next batch of items directly from the cache.
While effective for system stability, cached results are inherently "stale" because they do not reflect the user's most recent interactions. Traditional Reinforcement Learning (RL) agents often fail in these environments because they assume every action is executed in real-time, leading to unstable training and suboptimal performance when their recommendations are eventually pulled from a cache.
Methods: Cache-Aware Reinforcement Learning (CARL)
The researchers at Kuaishou Technology developed CARL to explicitly account for the infrastructure's state within the recommendation logic.
1. Modeling the Cache State
The problem is formulated as a Markov Decision Process (MDP) that incorporates a cache state ($C_t$). This binary state indicates whether a recommendation is generated via real-time computation ($C_t=0$) or retrieved from the cache ($C_t=1$). Unlike typical MDP states, $C_t$ is primarily driven by external system load rather than direct user actions.
2. Addressing Critic Dependency
A major technical hurdle in this setup is critic dependency. In standard Actor-Critic RL, the "Critic" estimates the long-term value of an action. In a cached system, the value of a real-time action ($Q_0$) is mathematically coupled with the value of future cached states ($Q_1$). Because system load is stochastic, this coupling introduces noise that hinders model convergence.
3. Eigenfunction Learning (EL)
To decouple these values, the authors introduced Eigenfunction Learning. Instead of directly learning $Q_0$ and $Q_1$, the model learns two independent "eigen" functions:
- $\Lambda_a$: Captures the performance gap between real-time and cached recommendations.
- $\Lambda_b$: Represents a weighted sum of rewards across states.
By training on these decoupled functions, the RL agent can ignore the "noise" of fluctuating system traffic while still optimizing for its long-term impact on user engagement.
Experimental Results
The CARL-EL framework was deployed in the Kwai app, serving over 100 million users. Online A/B testing revealed significant improvements:
- Engagement Gains: CARL-EL increased Session Watch Time by +0.545% and Daily Watch Time by +0.586% compared to standard RL baselines.
- Accuracy: The model achieved a lower "Critic Loss" (0.25) than TD3 (0.33), validating the effectiveness of the eigenfunction approach in stabilizing value estimation.
- Efficiency: While removing the cache entirely would yield slightly higher engagement (+0.642%), it would increase compute costs by 67.6%. CARL-EL captures nearly all of those gains (+0.586%) with no additional compute overhead.
Conclusion
CARL demonstrates that recommender systems should treat server infrastructure as part of the learning environment. By acknowledging the reality of result caching and using Eigenfunction Learning to handle the resulting mathematical dependencies, the system achieves a superior balance between recommendation quality and computational efficiency. Future work may involve jointly optimizing the ranking policy with the caching trigger itself to further refine performance.
Summary updated