|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>Yelp LLM Query Understanding</title> |
|
<script src="https://cdn.tailwindcss.com"></script> |
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> |
|
<style> |
|
|
|
body { |
|
font-family: 'Inter', sans-serif; |
|
background-color: #f8fafc; |
|
} |
|
|
|
.arrow { |
|
position: relative; |
|
width: 100%; |
|
height: 2px; |
|
background-color: #6b7280; |
|
margin: 1.5rem 0; |
|
} |
|
.arrow::after { |
|
content: ''; |
|
position: absolute; |
|
right: -1px; |
|
top: -4px; |
|
width: 0; |
|
height: 0; |
|
border-top: 5px solid transparent; |
|
border-bottom: 5px solid transparent; |
|
border-left: 8px solid #6b7280; |
|
} |
|
.dashed-arrow { |
|
position: relative; |
|
width: 100%; |
|
height: 2px; |
|
background-image: linear-gradient(to right, #9ca3af 33%, rgba(255,255,255,0) 0%); |
|
background-position: bottom; |
|
background-size: 8px 2px; |
|
background-repeat: repeat-x; |
|
margin: 1rem 0; |
|
} |
|
.dashed-arrow::after { |
|
content: ''; |
|
position: absolute; |
|
right: -1px; |
|
top: -4px; |
|
width: 0; |
|
height: 0; |
|
border-top: 5px solid transparent; |
|
border-bottom: 5px solid transparent; |
|
border-left: 8px solid #9ca3af; |
|
} |
|
.highlight-topic { background-color: #bfdbfe; color: #1e40af; } |
|
.highlight-location { background-color: #bbf7d0; color: #15803d; } |
|
.highlight-time { background-color: #fef08a; color: #a16207; } |
|
.highlight-name { background-color: #fed7aa; color: #9a3412; } |
|
.highlight-question { background-color: #fbcfe8; color: #9d174d; } |
|
.highlight-spellcorrect { text-decoration: underline wavy #dc2626; } |
|
.tag { |
|
display: inline-block; |
|
padding: 0.1rem 0.4rem; |
|
border-radius: 0.25rem; |
|
font-size: 0.75rem; |
|
font-weight: 500; |
|
margin-right: 0.25rem; |
|
white-space: nowrap; |
|
} |
|
.llm-box { |
|
border: 2px solid #fbbf24; |
|
background-color: #fefce8; |
|
} |
|
.rag-box { |
|
border: 2px dashed #a5b4fc; |
|
background-color: #eef2ff; |
|
} |
|
.input-box, .output-box { |
|
border: 2px solid #9ca3af; |
|
background-color: #ffffff; |
|
} |
|
.card { |
|
background-color: white; |
|
border-radius: 0.75rem; |
|
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); |
|
padding: 1.5rem; |
|
margin-bottom: 2rem; |
|
} |
|
.section-title { |
|
font-size: 1.5rem; |
|
font-weight: 600; |
|
margin-bottom: 1rem; |
|
color: #1f2937; |
|
} |
|
.step-label { |
|
font-size: 0.875rem; |
|
font-weight: 500; |
|
color: #4b5563; |
|
margin-bottom: 0.5rem; |
|
text-align: center; |
|
} |
|
</style> |
|
</head> |
|
<body class="p-4 md:p-8"> |
|
|
|
<h1 class="text-3xl md:text-4xl font-bold text-center mb-8 md:mb-12 text-gray-900"> |
|
Visualizing Yelp's LLM Query Understanding |
|
</h1> |
|
|
|
<div class="card"> |
|
<h2 class="section-title">1. Query Segmentation & Spell Correction</h2> |
|
<p class="text-gray-700 mb-6">The LLM identifies and labels semantic parts of a search query, correcting misspellings simultaneously.</p> |
|
|
|
<div class="grid grid-cols-1 md:grid-cols-5 gap-4 items-start"> |
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">Input Query</div> |
|
<div class="input-box p-3 rounded-lg w-full text-center shadow"> |
|
"healthy fod near me" |
|
</div> |
|
</div> |
|
|
|
<div class="flex items-center justify-center md:mt-10"> |
|
<div class="arrow w-16 md:w-full"></div> |
|
</div> |
|
|
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">LLM Processing</div> |
|
<div class="llm-box p-3 rounded-lg w-full text-center shadow mb-2"> |
|
<span class="font-semibold text-amber-700">LLM</span> |
|
<div class="text-xs text-amber-600">(e.g., GPT-4 / Fine-tuned Model)</div> |
|
</div> |
|
<div class="step-label mt-2">Retrieval Augmented Generation (RAG)</div> |
|
<div class="rag-box p-2 rounded-lg w-full text-center shadow text-xs"> |
|
<span class="font-semibold text-indigo-700">RAG Input:</span> |
|
<div class="text-indigo-600">Viewed Businesses: ["Salad Place", "Green Bowl"]</div> |
|
</div> |
|
</div> |
|
|
|
<div class="flex items-center justify-center md:mt-10"> |
|
<div class="arrow w-16 md:w-full"></div> |
|
</div> |
|
|
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">Output Segmentation</div> |
|
<div class="output-box p-3 rounded-lg w-full text-center shadow"> |
|
<span class="tag highlight-topic">topic</span> <span class="highlight-spellcorrect">healthy food</span> <span class="tag highlight-location">location</span> near me |
|
<div class="text-xs text-red-600 mt-1">[Spell Corrected: fod -> food]</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="grid grid-cols-1 md:grid-cols-5 gap-4 items-start mt-12 pt-8 border-t border-gray-200"> |
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">Input Query</div> |
|
<div class="input-box p-3 rounded-lg w-full text-center shadow"> |
|
"pet-friendly sf restaurants open now" |
|
</div> |
|
</div> |
|
|
|
<div class="flex items-center justify-center md:mt-10"> |
|
<div class="arrow w-16 md:w-full"></div> |
|
</div> |
|
|
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">LLM Processing</div> |
|
<div class="llm-box p-3 rounded-lg w-full text-center shadow mb-2"> |
|
<span class="font-semibold text-amber-700">LLM</span> |
|
<div class="text-xs text-amber-600">(e.g., GPT-4 / Fine-tuned Model)</div> |
|
</div> |
|
<div class="h-12"></div> |
|
</div> |
|
|
|
<div class="flex items-center justify-center md:mt-10"> |
|
<div class="arrow w-16 md:w-full"></div> |
|
</div> |
|
|
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">Output Segmentation</div> |
|
<div class="output-box p-3 rounded-lg w-full text-center shadow"> |
|
<span class="tag highlight-topic">topic</span> pet-friendly <span class="tag highlight-location">location</span> sf <span class="tag highlight-topic">topic</span> restaurants <span class="tag highlight-time">time</span> open now |
|
</div> |
|
</div> |
|
</div> |
|
<p class="text-sm text-gray-600 mt-8"> |
|
<span class="font-semibold">Benefit:</span> 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. |
|
</p> |
|
</div> |
|
|
|
<div class="card"> |
|
<h2 class="section-title">2. Review Highlights Generation</h2> |
|
<p class="text-gray-700 mb-6">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.</p> |
|
|
|
<div class="grid grid-cols-1 md:grid-cols-5 gap-4 items-start"> |
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">Input Query</div> |
|
<div class="input-box p-3 rounded-lg w-full text-center shadow"> |
|
"dinner before a broadway show" |
|
</div> |
|
</div> |
|
|
|
<div class="flex items-center justify-center md:mt-10"> |
|
<div class="arrow w-16 md:w-full"></div> |
|
</div> |
|
|
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">LLM Processing</div> |
|
<div class="llm-box p-3 rounded-lg w-full text-center shadow mb-2"> |
|
<span class="font-semibold text-amber-700">LLM</span> |
|
<div class="text-xs text-amber-600">(e.g., GPT-4 / Fine-tuned Model)</div> |
|
</div> |
|
<div class="step-label mt-2">Retrieval Augmented Generation (RAG)</div> |
|
<div class="rag-box p-2 rounded-lg w-full text-center shadow text-xs"> |
|
<span class="font-semibold text-indigo-700">RAG Input:</span> |
|
<div class="text-indigo-600">Relevant Categories: [Theater District Restaurants, Pre-Theater Menus]</div> |
|
</div> |
|
</div> |
|
|
|
<div class="flex items-center justify-center md:mt-10"> |
|
<div class="arrow w-16 md:w-full"></div> |
|
</div> |
|
|
|
<div class="flex flex-col items-center"> |
|
<div class="step-label">Output: Expanded Phrases</div> |
|
<div class="output-box p-3 rounded-lg w-full text-left text-sm shadow"> |
|
<ul> |
|
<li>- pre-show dinner</li> |
|
<li>- theater district dining</li> |
|
<li>- close to broadway</li> |
|
<li>- quick bite before theater</li> |
|
<li>- pre-theater menu</li> |
|
<li>- convenient for shows</li> |
|
</ul> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="mt-12 pt-8 border-t border-gray-200"> |
|
<h3 class="text-lg font-semibold mb-3 text-gray-800 text-center">Application: Highlighting Review Snippets</h3> |
|
<div class="flex flex-col md:flex-row items-center justify-center gap-4"> |
|
<div class="output-box p-3 rounded-lg shadow text-sm w-full md:w-1/3"> |
|
<span class="font-semibold">Generated Phrase:</span> "pre-show dinner" |
|
</div> |
|
<div class="flex items-center justify-center"> |
|
<div class="dashed-arrow w-16 md:w-10 transform md:rotate-0 rotate-90"></div> |
|
</div> |
|
<div class="bg-gray-100 p-4 rounded-lg shadow w-full md:w-2/3"> |
|
<p class="text-sm text-gray-700 italic">"... came here for a <strong class='bg-yellow-200 px-1 rounded'>pre-show dinner</strong> and it was perfect! Fast service and delicious food, just steps away from the theater..."</p> |
|
<p class="text-xs text-gray-500 mt-1">- User Review Snippet</p> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<p class="text-sm text-gray-600 mt-8"> |
|
<span class="font-semibold">Benefit:</span> 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. |
|
</p> |
|
</div> |
|
|
|
<div class="card bg-gradient-to-r from-blue-50 to-indigo-50"> |
|
<h2 class="section-title text-blue-900">Overall Yelp LLM Process (Simplified)</h2> |
|
<div class="flex flex-col md:flex-row justify-between items-center gap-4 text-center"> |
|
<div class="p-3 bg-white rounded-lg shadow flex-1"> |
|
<div class="font-semibold text-blue-700 mb-1">1. Formulation & POC</div> |
|
<p class="text-xs text-gray-600">Define task, prototype with powerful LLM (e.g., GPT-4), test on head queries.</p> |
|
</div> |
|
<div class="text-blue-600 font-bold text-2xl mx-2">→</div> |
|
<div class="p-3 bg-white rounded-lg shadow flex-1"> |
|
<div class="font-semibold text-blue-700 mb-1">2. Scaling Up</div> |
|
<p class="text-xs text-gray-600">Create golden dataset, fine-tune smaller/cheaper LLM (e.g., GPT4o-mini), pre-compute for high-volume queries.</p> |
|
</div> |
|
<div class="text-blue-600 font-bold text-2xl mx-2">→</div> |
|
<div class="p-3 bg-white rounded-lg shadow flex-1"> |
|
<div class="font-semibold text-blue-700 mb-1">3. Production Rollout</div> |
|
<p class="text-xs text-gray-600">Serve pre-computed results (cache), optionally use real-time smaller model (e.g., BERT/T5/GPT4o-mini) for tail queries.</p> |
|
</div> |
|
</div> |
|
</div> |
|
</body> |
|
</html> |
|
|