How Does Spotify Know What You Want to Hear Next?
Simple explanation of cosine similarity. A guide for dummies
Picture this: you’re driving on ECR at sunset, and "Vaseegara" starts playing. You smile—it’s the perfect vibe. The next song? "Kadhal Sadugudu." And you’re like, “Wow, Spotify gets me!” But have you ever wondered how it knows what to play next?
Here’s the secret: it’s all about math, mood, and music, working together like well made...sandwich
How Songs Get Their “Personality”
When a song like "Vaseegara" is uploaded, Spotify uses its AI to listen to it. Not the way you do, with lyrics and feelings—it analyzes its audio features, assigning numbers to capture the song's essence. The following is an example parameter
Energy: How intense or laid-back is it? "Vaseegara" is smooth and calm, so it scores low, while "Vaathi Coming" is high-energy and gets a big number.
Tempo: How fast is it? Measured in beats per minute (BPM), "Kadhal Sadugudu" has a medium pace, while "Vaathi Coming" races ahead.
Mood/Valence: How cheerful or emotional does it feel? A love song like "Vaseegara" has low valence (emotional), while "Vaathi Coming" is pure kuthu energy (high valence).
Spotify assigns each song a vector—a fancy way of saying, “This song lives in a specific spot in a 3D space.”
How Cosine Similarity Finds Your Next Favorite Song
Now, let’s talk about cosine similarity in simple terms
Imagine every song is a dot in a huge 3D space. The closer two dots are, the more similar the songs feel. If the dots for "Vaseegara" and "Kadhal Sadugudu" are practically overlapping, Spotify says, “These vibes match!” and lines them up in your queue.
Here’s how cosine similarity works in plain terms:
It looks at the angle between two song vectors.
A smaller angle = more similarity = songs that feel like they belong together.
A larger angle = totally different vibes (e.g., "Vaseegara" vs. "Vaathi Coming").
Simply the system calculates how close two songs are in 'vibe' and recommends accordingly.
Who Decides What Makes a Melody or Dance Song?
It’s not all Spotify’s doing. Here’s how songs are tagged:
AI Analysis: Spotify's system uses audio analysis to extract features like energy, tempo, and valence. These create the “vector” for each song.
Artist Metadata: When artists upload tracks, they sometimes add tags like “Romantic” or “Dance.”
Crowdsourced Learning: If thousands of people add "Vaseegara" to their “Melody Mood” playlists, Spotify learns from that behavior too.
Everything helps in mapping the song in the right vector space!
This Is How AI Understands Everything!
Here's what's really cool: this same concept powers Large Language Models (LLMs) and pretty much every AI system you use daily. Just like Spotify maps songs in this 3D space, LLMs map words and meanings the same way. When you type "cat" and "kitten," these words are neighbors in the AI's understanding space—just like how "Vaseegara" and "Kadhal Sadugudu" are musical neighbors.
This same technology is behind:
Netflix knowing your next binge-worthy show
Amazon suggesting products you'll love
Instagram showing you posts you'll like
Dating apps finding your potential matches
So next time you're vibing to that perfectly curated Spotify playlist, remember: nobody is stalking you, it's just math and AI is really good with making most best probable patterns.