LLM-Based Recommendations

By Ludovico Bessi, Senior ML Engineer at Google ยท Updated

LLM-based recommendations use large language models for what classic recommenders lack: world knowledge, language understanding and reasoning about cold-start items and explicit requests. In practice LLMs are used mostly to generate features, embeddings, labels and explanations, rather than to rank millions of items directly.

Why LLMs Are Interesting for Recommendations

Large language models bring three things classic recommenders lack:

  1. World knowledge. An LLM knows that a thriller novel and its film adaptation are related, without any co-engagement data.
  2. Language understanding. They read item descriptions, reviews and free-text user requests.
  3. Reasoning and generation. They can explain recommendations, hold a conversation, and follow instructions like "something like this but shorter and less violent".

They also bring serious costs: latency, compute, hallucination, and difficulty using the huge interaction logs that drive classic recommenders. Most production value today comes from using LLMs around the core recommender rather than as it.

Pattern 1: LLMs as Feature and Content Encoders

The most widespread use. LLMs (or smaller text encoders derived from them) turn item text โ€” titles, descriptions, transcripts, reviews โ€” into embeddings and structured attributes.

  • Content embeddings for the item tower in retrieval and as ranking features, which especially helps cold-start items.
  • Attribute extraction: genre, topic, tone, product attributes, safety labels, generated offline at catalog scale.
  • User profile summaries: an LLM summarizes a user's long history into text or an embedding that other models use.

This is cheap at serving time because the LLM runs offline or nearline, once per item rather than once per request.

Pattern 2: LLMs as Rankers

Prompt an LLM with the user's context and a list of candidates and ask it to score or order them:

  • Pointwise: "How likely is this user to enjoy this item? Answer yes or no", using the probability of "yes" as a score.
  • Listwise: give the LLM a list of candidates and ask for an ordering.

Research (for example, work evaluating LLMs as zero-shot rankers) found LLMs can rank reasonably without task-specific training but struggle with position bias in the prompt and with using interaction history well. Fine-tuned LLM rankers do much better, and in text-heavy domains โ€” job matching, search, people search โ€” they can beat classic rankers on relevance.

The production challenge is cost. Common solutions:

  • Distill the large LLM ranker into a small model (a few hundred million parameters) that serves at scale.
  • Prefill-only scoring: read a score from the logits of a single forward pass, with no generation.
  • Shared-prefix batching: the user context is processed once and reused across candidates.
  • Compressed item representations: items enter the prompt as a few learned embedding tokens instead of full text.

LinkedIn has published details of semantic search and ranking systems built this way, including LLM judges, distillation into small language models and embedding-injection techniques (see LinkedIn's MixLM).

Pattern 3: LLMs as Judges and Labelers

Human relevance labels are slow and expensive. LLMs can grade (query, item) relevance at scale following a written policy:

  • Generate training labels for rankers, especially for relevance rather than engagement.
  • Evaluate offline at scale, as a cheaper proxy before A/B tests.
  • Audit quality and policy compliance of recommendations.

The judge itself must be validated against human labels, and its biases (verbosity, position in the prompt) monitored.

Pattern 4: Conversational and Generative Recommendation

LLMs enable recommenders that users talk to: "find me a sci-fi book like The Martian but with a female lead". Architectures typically combine:

  • The LLM for understanding the request and generating the response,
  • A conventional retriever (search or embedding index) for real catalog items,
  • Grounding so the LLM only recommends items that exist (avoiding hallucinated products or titles).

Early research such as P5 (2022) cast many recommendation tasks into a unified text-to-text format. Practical systems keep the catalog lookup outside the LLM to guarantee items are real and available.

Pattern 5: LLM Backbones for Sequence Recommendation

Some work fine-tunes LLMs to predict the next item from a user's history, with items represented as text or as special tokens (semantic IDs). This merges the LLM's world knowledge with collaborative signals. It is promising, especially for cold start and cross-domain recommendation, but costly; see Sequential Generative Recommenders and Foundation Models for Recommendations.

Limitations

  • Collaborative signal: LLMs do not natively know that users who watch A also watch B; that knowledge lives in interaction logs.
  • Item vocabularies: millions of constantly changing items do not fit naturally into a fixed vocabulary.
  • Latency and cost: per-request LLM calls are orders of magnitude more expensive than classic rankers.
  • Freshness: what is trending today is not in the LLM's weights.
  • Evaluation: fluent explanations can mask poor recommendations.

A Practical Adoption Path

  1. Use LLMs offline to enrich item content and attributes.
  2. Use LLM judges to generate relevance labels and evaluation sets.
  3. Add LLM-derived embeddings to retrieval and ranking.
  4. For text-heavy domains, train an LLM ranker and distill it to a small model for serving.
  5. Consider conversational interfaces where users express explicit intent.

Key Takeaways

  1. LLMs add world knowledge, language understanding and reasoning, at high cost.
  2. Most production value comes from LLMs as offline encoders, labelers and judges.
  3. LLM rankers work best in text-heavy domains and are served via distillation and prefill-only scoring.
  4. Conversational recommenders must ground the LLM in a real catalog.
  5. Collaborative signals, item vocabularies, latency and freshness remain the main limitations.