Visualizing Yelp's LLM Query Understanding

1. Query Segmentation & Spell Correction

The LLM identifies and labels semantic parts of a search query, correcting misspellings simultaneously.

Input Query
"healthy fod near me"
LLM Processing
LLM
(e.g., GPT-4 / Fine-tuned Model)
Retrieval Augmented Generation (RAG)
RAG Input:
Viewed Businesses: ["Salad Place", "Green Bowl"]
Output Segmentation
topic healthy food location near me
[Spell Corrected: fod -> food]
Input Query
"pet-friendly sf restaurants open now"
LLM Processing
LLM
(e.g., GPT-4 / Fine-tuned Model)
Output Segmentation
topic pet-friendly location sf topic restaurants time open now

Benefit: This segmentation helps refine search location (e.g., understanding "sf" means San Francisco), improve business name matching, and apply relevant filters automatically. Spell correction ensures misspelled queries still yield good results. RAG helps distinguish business names from topics/locations.

2. Review Highlights Generation

The LLM generates a list of related phrases for a query. These phrases are then used to find and highlight relevant snippets in user reviews, helping users quickly see why a business matches their search.

Input Query
"dinner before a broadway show"
LLM Processing
LLM
(e.g., GPT-4 / Fine-tuned Model)
Retrieval Augmented Generation (RAG)
RAG Input:
Relevant Categories: [Theater District Restaurants, Pre-Theater Menus]
Output: Expanded Phrases
  • - pre-show dinner
  • - theater district dining
  • - close to broadway
  • - quick bite before theater
  • - pre-theater menu
  • - convenient for shows

Application: Highlighting Review Snippets

Generated Phrase: "pre-show dinner"

"... came here for a pre-show dinner and it was perfect! Fast service and delicious food, just steps away from the theater..."

- User Review Snippet

Benefit: By generating semantically related phrases (not just keywords), the LLM helps surface highly relevant review snippets, even if the user's exact query words aren't present. This significantly improves the user's ability to quickly assess if a business meets their specific needs (like needing a quick dinner near a theater). RAG helps tailor phrases based on typical business categories associated with the query.

Overall Yelp LLM Process (Simplified)

1. Formulation & POC

Define task, prototype with powerful LLM (e.g., GPT-4), test on head queries.

2. Scaling Up

Create golden dataset, fine-tune smaller/cheaper LLM (e.g., GPT4o-mini), pre-compute for high-volume queries.

3. Production Rollout

Serve pre-computed results (cache), optionally use real-time smaller model (e.g., BERT/T5/GPT4o-mini) for tail queries.