LearnQuestion bank

How would you let users generate a playlist from a free-text prompt while still using the existing recommendation stack?

Applied LLMSystem designHard

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • LLM parses prompt into structured constraints/search queries, not tracks
  • Retrieve candidates from catalogue embeddings; existing recommender re-ranks per user
  • LLM selects only provided catalogue IDs; title/description written after selection
  • Cache popular prompts/embeddings/rankings; small fast parser, heavier model only for wording
  • Safety: prompt-injection handling, content/age filtering, refuse/re-scope harmful prompts
  • Eval: offline relevance/editorial review; online saves, skips, listening time, diversity/freshness, preference tuning

In full

I’d treat the LLM as a planner, not the source of truth: it converts the free-text prompt into structured constraints and search queries (mood, genre, energy, duration, exclusions), then we retrieve candidate tracks from catalogue embeddings and let the existing recommender re-rank them for that user, so personalisation stays in the stack. The LLM is only allowed to choose from the catalogue IDs it is given and must return structured JSON with IDs, title, and description; anything it cannot ground is dropped or re-queried, never invented. I’d generate the title/description after selection, keep the track list deterministic, and cache popular prompts plus embeddings/rankings to control latency and cost at scale, with a small fast model for parsing and the heavier model only for wording. Safety would include prompt-injection handling, content/age filtering, and refusing or re-scoping harmful requests rather than producing unsafe playlists. I’d evaluate offline with relevance judgements and editorial review, then online with saves, skips, listening time, diversity/freshness, and preference feedback used to tune the planner and ranking.

Corrected by an independent AI reviewer.

What a strong answer covers

  • LLM turns the prompt into structured constraints or search queries; retrieval over catalogue embeddings; personalised ranking by the existing recommender; LLM writes title/description
  • The LLM only selects catalogue IDs it was given — never invents tracks
  • Eval: offline relevance judgements; online saves, skips, listening time; diversity and freshness; editorial review; preference tuning
  • Latency and cost at very large scale; caching popular prompts; prompt safety

Common mistakes

  • Letting the LLM generate track names directly
  • dropping personalisation