A Practical Guide to LLM Music Taste and Recommendation
This article explains why general-purpose LLMs tend to produce bland, repetitive music recommendations and how to turn subjective "taste" into engineering constraints. It covers breaking listening preferences into acoustic, mood, structural, and context dimensions, using a two-stage recall-and-rerank pipeline with explicit scoring, balancing hit rate against diversity, maintaining a structured preference profile across turns, and evaluating recommendations without labeled data. It also lists common failure modes with fixes and offers advice for moving from personal use to a small-scale service.
1. Background: Why Recommending Music Is Harder Than It Looks
The first time most people ask an LLM for music recommendations, they get a list that looks reasonable but feels flat: popular singles, vague genre labels, and tracks that are all highly similar to each other. The reason is not mysterious. Recommending a song involves at least three layers of judgment: acoustic features (tempo, timbre, energy, key), semantic tags (genre, mood, scene, language), and personal context (what has been on repeat lately, listening time of day, device and setting). Most general-purpose chat models are only good at the second layer, have no stable perception of the first, and have no access at all to the third.
Treating taste as something mystical does not help with engineering. A more workable approach is to decompose taste into actionable constraints: style consistency, mood curve, the ratio of familiar to unfamiliar, and an explainable reason. Once the constraints are written down clearly, the stability of the model’s output improves significantly.
2. Turning “Sounds Good” into Computable Dimensions
In practice, map subjective impressions onto a few dimensions first, then have the model answer around those dimensions:
- Acoustic dimensions: BPM range, energy, acoustic/electronic ratio, low-frequency share, vocal dryness/wetness.
- Mood dimensions: dark/bright, tense/relaxed, lonely/euphoric, plus the curve of mood over time.
- Structural dimensions: presence of an obvious drop, minimal sections, suitability for looping.
- Context dimensions: commuting, late night, working out, focused work — different scenes tolerate failure differently.
Put these dimensions into the prompt and the model stops “going by feeling” and instead aligns item by item against a checklist. A sketch of such a prompt (pseudocode, structure only):
Known seed track: <title / artist style description>Output 5 candidates, each including:1) where it aligns with the seed in BPM/energy/timbre2) one deliberate difference (avoid complete sameness)3) one verifiable reason (cite specific listening characteristics)Constraints: do not return tracks common on mainstream charts; any language is fine; avoid ambiguity between different tracks with the same title.
3. Candidate Generation and Reranking: Two Stages Beat One Shot
Asking the model for the final answer in one shot tends to produce a pile of safe choices. A more engineering-friendly approach is two stages:
- Recall stage: ask the model for 15–20 broad candidates, focusing only on style and mood alignment, allowing rough matches.
- Rerank stage: have it score and sort by “distance from the seed,” “similarity among candidates,” and “surprise,” then take the top 5.
The key to the rerank stage is defining “distance” explicitly. Have the model give each candidate three scores: consistency, novelty, and loopability (0–10). The final score can be a simple weighted sum:
final = 0.5 * consistency + 0.3 * novelty + 0.2 * loopability
The benefit is auditability: when results are poor, you can pinpoint whether consistency was insufficient, candidates were too conservative, or the loopability judgment was wrong, instead of vaguely blaming “bad taste.”
4. Hit Rate and Diversity: A Pair of Metrics to Balance
The original text mentions “at least 3–4 out of 5 hits,” which is really a subjective blend of two metrics. In engineering terms, split them:
- Hit rate (Hit@5): the share of the 5 tracks you would actually add to a playlist.
- Coverage: how broad the range of genres/languages/eras is across consecutive rounds.
- Repeat rate: the share of tracks recurring across rounds; a high value means the candidate pool is exhausted.
- Explanation usefulness: whether reasons cite verifiable listening characteristics rather than empty words.
Chasing only hit rate degrades the model into a “popular-track parrot”; chasing only diversity produces noise unrelated to your taste. A practical compromise: each round, fix 3 high-consistency tracks + 1 cross-genre probe + 1 “archaeology” pick in the same style but from a different era or region.
5. Context Management: Let the Model Remember Your “Auditory Coordinates”
Across multiple turns, the model needs a continuously updated preference profile. Maintain a structured summary rather than relying on long conversation history:
{"anchors": ["dark synths", "heavy low end", "ethereal female vocals"],"avoid": ["over-compressed pop choruses", "solo piano only"],"recent_loops": ["a certain kind of electronic single"],"scene": "late-night commute"}
After each round, write the user’s positive feedback (added to playlist) and negative feedback (skipped) back into this profile. The next prompt then carries only the profile and the seed track, which saves tokens and keeps the model from being distracted by irrelevant early information. If you connect your own service, the profile can live in object storage or a database, with a message queue handling asynchronous updates and a logging service recording impressions and feedback for later offline analysis.
6. Evaluation: Approximate Assessment Without Labels
When labeled data for music recommendation is unavailable, use three approximate methods:
- Blind comparison: for the same set of seeds, have different configurations each produce 5 tracks, hide the sources, and rank them manually.
- Consistency check: sample the same prompt multiple times and measure the overlap of the top 5 to gauge stability.
- Counterfactual check: deliberately give contradictory constraints (e.g., “minimal” and “information overload”) and see whether the model flags the conflict instead of forcing an answer.
Sample evaluation table structure:
| Configuration | Hit@5 | Coverage | Repeat rate | Explanation usefulness |
|---|---|---|---|---|
| Single-pass generation | 2.4 | Low | High | Medium |
| Two-stage rerank | 3.6 | Medium | Low | High |
7. Common Failure Modes and Fixes
- Style drift: popular tracks sneak into the candidates. Fix: add a hard constraint in the prompt to exclude tracks common on charts.
- Same-title ambiguity: works by different artists with the same title get confused. Fix: require “artist + style description” instead of the title alone.
- Homogeneity: the 5 tracks are near-variants of one song. Fix: force one deliberate difference to be labeled for each track.
- Vague reasons: comments like “sounds great.” Fix: require each reason to include at least one verifiable feature (BPM, timbre, section structure).
- Scene mismatch: high-energy tracks recommended for a late-night scene. Fix: write the scene into the profile and use it as a hard filter.
8. Implementation Advice: From Personal Use to a Small-Scale Service
For personal use, start with three steps: seed + two stages + profile write-back. To serve a small group, add a candidate pool cache (to reduce repeated sampling), monitoring and alerts (tracking swings in hit rate and repeat rate), and canary comparison (splitting traffic between old and new prompts for evaluation). When model calls are involved, use a unified model gateway for rate limiting and logging, and avoid scattering rerank logic across business code.
The core conclusion is not complicated: in engineering terms, “taste” is equivalent to “clearly written constraints + two-stage generation + a writable preference profile + quantifiable evaluation.” When all four are in place, recommendations shift from “occasionally impressive” to “reliably usable,” no longer depending on luck.
