Automatic Music Playlist Generation via Simulation-based Reinforcement Learning

Federico Tomasi, Joseph Cauteruccio, Surya Kanoria, Kamil Ciosek, Matteo Rinaldi, Zhenwen Dai · DOI

TL;DR

Spotify researchers have developed a reinforcement learning (RL) framework for playlist generation that optimizes directly for user satisfaction by training agents within a simulated environment. By introducing a novel Action Head DQN (AH-DQN), they successfully navigated the combinatorially explosive action spaces inherent in music recommendation, demonstrating that offline simulation performance is a reliable predictor of real-world A/B test success.

What Problem Does This Paper Address?

Traditional music recommendation systems typically rely on collaborative filtering or sequence modeling. These methods often depend on proxy assumptions—for instance, assuming a "good" playlist consists of tracks a user would rate highly. However, these proxies frequently misalign with actual industrial metrics like total streaming time or user retention. A playlist of high-rated songs might lack acoustic coherence or fail to match the user's current context (e.g., mixing heavy metal with lullabies).

Reinforcement Learning (RL) offers a solution by optimizing for long-term rewards (satisfaction) rather than immediate clicks. The challenge? The action space is massive. Selecting a 30-track playlist from a pool of just 1,000 candidates results in roughly $10^{89}$ possible combinations—far beyond the capacity of standard RL algorithms. Furthermore, existing "slate" recommendation techniques assume a user picks only one item from a list, which doesn't apply to playlists where users consume multiple items sequentially.

Methods

The authors propose a model-based RL approach that decomposes the combinatorial nightmare into a sequence of tractable steps.

  1. The World Model (Simulator): Instead of training directly on live users, they built a simulator using historical interaction data. They compared two types of user behavior models:
  2. CWM (Conditional World Model): A non-sequential model that treats track responses as independent.
  3. SWM (Sequential World Model): An LSTM-based model that captures the dynamics of a listening session, where a user's response to track $N$ depends on tracks $1$ through $N-1$.
  4. Action Head DQN (AH-DQN): Standard DQNs output a vector of Q-values for a fixed set of actions. This fails in music streaming where the "candidate pool" of songs changes constantly. The AH-DQN (illustrated in Figure 2) takes both the state features and item features as inputs to produce a single Q-value for that specific track. This allows the model to generalize to new tracks and dynamic pools.
Figure 2: Action-head network. Both observation and action features are taken in input in order to estimate the Q value.
  1. The Training Loop: The agent iteratively picks one track at a time. The simulator predicts the user's response (skip, complete, etc.), updates the state, and provides a reward, as shown in the reinforcement learning loop in Figure 1.
Figure 1: Reinforcement learning loop in a simulation-based environment.

Datasets

  • Public: The Spotify Music Streaming Sessions Dataset, containing 160 million sessions, was used for initial offline empirical evaluation.
  • Proprietary: Internal Spotify streaming data was used to train the production-grade world models and agents.
  • Scale: The online A/B tests involved a massive sample of 2 million users and 2.8 million unique tracks across 4 million sessions.

Key Insights and Ideas

  • Simulation as a Safety Net: The core "aha moment" is that a sufficiently accurate user simulator allows researchers to iterate on complex RL policies without risking the user experience on the live platform.
  • Generalization is Key: By feeding track features into the Q-network (the "Action Head" approach), the agent learns the characteristics of successful recommendations rather than just memorizing specific track IDs.
  • The Offline-Online Bridge: One of the most significant findings is the strong correlation between the simulator's predicted performance and actual online results (Figure 5). This validates simulation as a robust tool for offline policy evaluation in recommender systems.
Figure 5: Simulated performance (estimated by the SWM) with respect to online reward (with true user responses) for the compared four different policies.

Key Results

  • Offline Superiority: In simulations, the AH-DQN significantly outperformed random baselines, concentrating rewards in the "high satisfaction" zone (Figure 3).
  • Online Success: In live A/B tests, the RL agent achieved a 10.17% relative increase in Completion-Count per session compared to the production control group (Figure 6).
  • Robustness: The agent's performance was statistically indistinguishable from (or better than) strong greedy baselines (CWM-GMPC), proving that the RL approach can match industrial-grade heuristics while providing a framework for further optimization.
Figure 6: Percent difference in average completion count per- session relative to control.

Limitations and Future Work

  • User Model Bottleneck: The agent's ceiling is defined by the accuracy of the world model. If the simulator doesn't capture specific nuances of human behavior, the agent won't learn to exploit them.
  • Training Complexity: Training against the sequential SWM is significantly harder due to increased stochasticity compared to the simpler CWM.
  • Future Directions: The authors suggest exploring Transformer-based architectures for the world model to better capture long-range session dependencies and investigating ensemble methods to increase the robustness of user response predictions.

Summary updated

BibTeX
@inproceedings{tomasi2023automatic,
  author = {Federico Tomasi and Joseph Cauteruccio and Surya Kanoria and Kamil Ciosek and Matteo Rinaldi and Zhenwen Dai},
  title = {{Automatic Music Playlist Generation via Simulation-based Reinforcement Learning}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2023},
}
Figure