Have you ever wondered why Spotify always seems to recommend music that you want to listen to? The home screen features playlists titled “Jump Back In”, “Daily Mix” and “On Repeat” which always seems to feature music you’d want to listen to.
Spotify is the largest music streaming platform and offers a constant stream of new music recommendations. It differentiates itself from other streaming giants like Apple Music and Amazon Prime Music platforms through the use of algorithmic based playlists and recommendations. Instead of paying humans to create playlists or using community created playlists, Spotify relies on data to curate music for each unique individual.
Let’s look into how Spotify’s algorithm works and how they’re able to make such accurate music recommendations.
The BaRT System
Spotify’s recommendations begin with a multi-armed AI system called Bandits for Recommendations as Treatments (BaRT). The BaRT model has two components: exploitation and exploration.
The exploitation model recommends content based on previous habits and historical data that produces the highest user engagement. It uses all the data known about the individual such as listening history, songs skipped and playlists created. This is a form of collaborative filtering where the system recommends songs that are similar to what the user has listened to in the past.
The exploitation side of the BaRT system filters through songs with high and low certainty based on information about their relevance pulled from previous data on the individual. If a song has not been played often and there’s not enough data to prove the relevancy of the song to the individual, then the system might ignore recommending that song to the user.
The exploitation model fails when it comes to recommending songs to new users because it relies on pre-existing data to make recommendations. However, the BaRT system accounts for that failure by introducing the exploration model.
The exploration model recommends content that the algorithm is uncertain will hold relevance to the user. This allows the system to gather data on the user if there is not enough pre-existing information available to adequately use the exploitation model.
The exploration model is useful to recommend content to new users and recommend new items uploaded to Spotify. It makes recommendations based on music that’s popular around you and what’s popular globally.
If you haven’t listened to a song yet, Spotify needs to know if you’ll be interested in listening to it, so it recommends it to the user with the intention of gaining information about that user’s listening habits.
The 30 Second Rule
This leads us into how the BaRT system makes specific recommendations for each user. Former product director, Matthew Ogle, said the sweet spot for making recommendations comes at 30 seconds of listening to a song. The BaRT algorithm looks at how long someone listens to a song. If the user listens to a song for longer than 30 seconds, then the system defines that as a successful recommendation. If they skip the song before 30 seconds, the algorithm will not recommend that song again.
Natural Language Processing
Another way Spotify tracks songs and artists to make recommendations is through Natural Language Processing (NLP). NLP analyzes what people are writing about certain artists or songs by scouring through social media, blog posts and articles.
When Spotify acquired Echo Nest, the self-titled “music intelligence company,” they became able to identify top terms relating to each song and make recommendations based on songs that have similar terms through NLP. The system recognizes descriptive words associated with songs and classifies the songs into groups with similar descriptions. Spotify is then able to group together those similar songs and make more specialized recommendations.
The Cold Start Problem and Raw Audio
Issues with collaborative filtering arise with the introduction of new music and smaller artists. These previous recommendation systems work well with music that’s already been uploaded and listened to by users. However, solely using these songs ignores the new artists and unpopular songs. If no one is talking about a song or artist on social media, NLP cannot pick up descriptive terms about it and won’t be able to recommend it. This is referred to as the cold start problem where there’s not enough data on the songs and artists to make adequate recommendations to users.
Spotify solves this issue by processing the raw audio files from each song. Spotify converts the raw audio to a mel spectrogram and sends it through a convolutional neural network. Basically, the audio that is converted to the mel spectrogram is a time-frequency representation of the audio that mimics the human hearing response. At the end of the mathematical process, the spectrogram releases information about the characteristics of the song like estimated time signature, key, tempo, mode and loudness.
By analyzing the key characteristics of the song, Spotify is able to determine its similarity with other songs and make recommendations based on how the song sounds compared with others. That’s how Spotify recommends smaller artists and newer songs so users are not only listening to popular music from larger artists.
This article discussed how Spotify’s algorithm works to recommend the perfect songs for you.
We looked at:
- The BaRT System with exploitative and explorative models. This is how Spotify recommends songs based on data from previous listening habits and popular music that others listen to.
- The 30 second rule explains that Spotify’s algorithm filters out songs based on how quickly a user skips the recommended song.
- Natural Language Processing uses written information on the internet to group songs into similar categories based on descriptive words about those songs.
- Spotify processes the raw audio of songs to assign characteristics of how the song sounds to the human ear.