Skip to content
mlmentorship

Design Spotify's homepage

Compose coherent music shelves under page-level utility, repetition, editorial, freshness and privacy constraints rather than sorting unrelated local scores.

Published · 7 min read ·Role-specific ·Advanced

ML breadth · active recall

Practice before you read

8 minutes. Explain the mechanism, why it works, when it fails, and one alternative.

ML breadth · closed-book attempt

Design Spotify's homepage

Explain the mechanism, why it works, when it fails, and one alternative.

Problem

Context. A Spotify-like homepage combines shelves for different listening intents; the invented candidates below can overlap. Task. Choose two shelves under the stated page-utility model, then explain selection, ordering, feedback, and evaluation in a full design. Distinguish choosing a pair from choosing its display order. Constraints. Use the stipulated common utility units and pair penalties only for this toy calculation. Respect eligibility and policy boundaries; do not present the example as Spotify's internal implementation or a causal user-benefit estimate. Design a Spotify-like homepage with coherent shelves for familiar favorites, discovery, new releases and editorial selections. These names illustrate the surface, not Spotify's current internal implementation. Choose two shelves from three eligible candidates. For this toy calculation only, local scores share utility units; showing A with B incurs an overlap penalty of four. Other pair penalties are zero, and every pair meets the hard policy constraints. | Shelf | Intent and illustrative contents | Local score | | --- | --- | ---: | | A | Familiar: songs 1, 2 | 6 | | B | Repeat: songs 1, 3 | 5 | | C | Discovery: songs 4, 5 | 4 | Which pair wins page utility, and does that calculation establish its display order?

08:00recommended time

Closing or reloading clears the scratchpad. Only score, weak rubric dimensions, attempt count, and retry date can be stored locally.

Reading depth

Design a music homepage whose selected shelves work together rather than merely ranking each shelf independently.

Problem

Context. A Spotify-like homepage combines shelves for different listening intents; the invented candidates below can overlap.

Task. Choose two shelves under the stated page-utility model, then explain selection, ordering, feedback, and evaluation in a full design. Distinguish choosing a pair from choosing its display order.

Constraints. Use the stipulated common utility units and pair penalties only for this toy calculation. Respect eligibility and policy boundaries; do not present the example as Spotify’s internal implementation or a causal user-benefit estimate.

Design a Spotify-like homepage with coherent shelves for familiar favorites, discovery, new releases and editorial selections. These names illustrate the surface, not Spotify’s current internal implementation.

Choose two shelves from three eligible candidates. For this toy calculation only, local scores share utility units; showing A with B incurs an overlap penalty of four. Other pair penalties are zero, and every pair meets the hard policy constraints.

ShelfIntent and illustrative contentsLocal score
AFamiliar: songs 1, 26
BRepeat: songs 1, 35
CDiscovery: songs 4, 54

Which pair wins page utility, and does that calculation establish its display order?

Picture: A Shelf Is One Page Candidate

Keep each shelf’s coherent item list intact, then compare whole-page choices.

PairRaw local scorePair penaltyPage utility
A+B1147
A+C10010
B+C909

Sorting local scores selects A+B; the explicit page objective selects A+C. This symmetric utility determines membership, not relative position. Ordering needs a position-sensitive policy and exposure evidence.

Local scores versus whole-page utility

The lower-scoring shelf wins when it avoids an expensive duplicate

A lower-scoring shelf can improve the whole pageShelf scores are A=6, B=5, C=4. A+B repeats a song and pays penalty 4; A+C wins at 10.Repeated song identity reduceswhole-page utilityA six + B five; same song repeatssongXsongX6 + 5 - 4 = 7A six + C four; no duplicate penaltysongXnew6 + 4 = 10
Derivation
Two strong shelves can make a weaker page when they repeat the same songToy shelves A, B, and C contain song IDs one-two, one-three, and four-five, with local scores six, five, and four. Repeated song one creates the declared four-unit overlap penalty for A plus B, giving seven. A plus C gives ten and B plus C nine. Membership does not determine display order.Toy whole-page utility, not measuredlistener valueAsong 1song 2score 6Bsong 1song 3score 5Csong 4song 5score 4A + B: 6 + 5 - 4 repeated-song penalty = 7A + C = 10 > B + C = 9Choose intact A and C; display order is aseparate choice.
Song 1 appears in both A and B. The declared overlap penalty makes A + C the best pair. Shelf order remains unresolved.
Check: Why is shelf C selected over higher-scoring B when composing the whole page?
Read it this way: Shelf scores are A=6, B=5, C=4. A+B repeats a song and pays penalty 4; A+C wins at 10.
Why does choosing the two highest-scoring shelves lose to A+C?

Decision Contract

StageRequired state
ShelfID, intent, content membership, eligibility, score semantics and generator version
PageCandidate shelves, session context, position/exposure, utility and hard constraints
EditorialAuthorized curation, market/rights constraints, commitments and overrides
FreshnessCache/version dependencies, privacy scope, expiry and invalidation
EvaluationSeparate local, page and mature long-term targets, assignment, uncertainty and guardrails

Local click, completion and listen-time scores do not automatically share units. Use a defensible composer model or explicit common utility, and validate whole-page interactions. Specify diversity within shelves, across shelf intents and over time. Keep safety/rights constraints separate from soft novelty or repetition penalties.

Change 1: No Personal History or Preferences

New task. A new user supplies no optional preferences.

Picture and change. Use permitted context, eligible editorial/content priors and bounded exploration. Test new-user outcomes and abandonment; no universal familiar-first ordering is established.

Check. Weak evidence does not authorize demographic inference or a fixed interaction-count switch.

Use when. Personalized shelf scores lack support.

Change 2: One Item Just Finished

New task. Recent activity changes one shelf while most cached candidates remain valid.

Picture and change. Invalidate affected compatible state when useful; recheck page-wide repetition and policy constraints. Keep version, session, privacy and eligibility dependencies in cache keys/invalidation rules.

Check. A high hit rate can hide stale or duplicated content.

Use when. Recomputing every shelf is unnecessary.

Failure: Every Shelf Wins the Same Click

Independent local optimization can repeat one artist and intent across the page. Local engagement then overstates the value of the composed session.

Transfer Check

Must every shelf have a learned multi-stage ranker?

Reasoned Answer

No. Recently played can use recency; editorial shelves can be curated. Use retrieval and learned ranking only when justified by the shelf’s requirements.

Shelf and Page Evidence

Familiar, discovery and new-release shelves need different definitions of useful listening, novelty and freshness. Do not define discovery solely as distance from history or assume novelty improves retention. Content features can support eligible new items before interactions; any exposure boost remains bounded by policy and quality.

Multi-task heads can estimate listen, completion, save, share and return outcomes on their proper populations. Combining calibrated heads does not automatically yield a calibrated utility or correct exposure bias. Log position, slate, eligibility and selection policy; counterfactual estimates require support and valid assumptions.

Choose an end-to-end latency/cost target from product needs, then measure it under load. Cache duration depends on content, policy and session change, not a universal refresh interval. Compare composer changes with an appropriate randomized baseline and predefined local/page/long-term targets. Set experiment duration from outcome maturity, cycles and power; there is no mandatory four-to-eight-week window. Check attrition, creator/content coverage, satisfaction and operational guardrails before staged release and rollback readiness.

Sources


Related: Design YouTube’s recommender, Two-tower vs cross-encoder: when to use which?, System design case study: building personalized search ranking.