Knowledge Retrieval
Finding the Right Answer
Why Retrieval Matters
Classification tells you WHAT the customer needs. Retrieval finds the answer. This is the step that determines whether the AI gives a helpful, specific response or a generic "please check our help center."
A great retrieval system finds "How to Reset Your Password" (KB-001, 342 helpful votes) within milliseconds when someone asks "I can't log in after changing my password." A bad one returns irrelevant results or nothing at all.
Key Concepts
The Two-Path Architecture
Support retrieval uses two paths, and always tries the fast one first:
Path 1: FAQ Fast Path (< 1ms)
80% of support queries are variations of 15-20 common questions. Title and tag matching identifies these instantly without running expensive vector search. "How do I reset my password?" matches "How to Reset Your Password" via direct title overlap.
Path 2: Full Hybrid Search (50-200ms)
For queries that don't match a known FAQ, combine keyword search with semantic search:
| Search Type | Strength | Example |
|---|---|---|
| Keyword | Exact terms, IDs, code | "Error 429", "POL-001" |
| Semantic | Meaning, synonyms | "can't access" ≈ "login issues" |
| Filtered | Metadata constraints | topic=authentication, source=kb |
Source Type Boosting
Not all sources are equally authoritative for answering questions:
| Source | Boost | Rationale |
|---|---|---|
| Knowledge base | +0.2 | Curated, reviewed, maintained |
| Product docs | +0.15 | Official, versioned |
| Escalation rules | +0.1 | Operational, current |
| Tickets | +0.05 | Historical, may be outdated |
| CSAT | +0.0 | Survey data, not answers |
This means a KB article about password resets always outranks a 6-month-old resolved ticket about the same topic.
Popularity Signals
For KB articles, helpful votes provide a crowd-sourced relevance signal. An article with 342 helpful votes is more likely to be the right answer than one with 5 votes. This is the same principle as PageRank — popular content is more likely to be relevant.
The popularity boost is capped at 0.1 to prevent a popular-but-outdated article from outranking a new-but-accurate one.
Snippet Extraction
KB articles are long (500-2,000 words), but the response should cite a specific, relevant passage. Snippet extraction:
The snippet includes character offsets for UI highlighting and a relevance score for confidence calculation.
Architecture Pattern
Customer Query
│
├──→ FAQ Matcher ──→ Found? ──→ Return article + snippet
│ │
│ No
│ │
└──→ Hybrid Search ──→ Score & Rank ──→ Top-K results
│
├── Keyword match (title + content)
├── Source type boost
├── Popularity boost
└── Pre-filter by topic/categoryCategory-Aware Search
When the classifier says the topic is "authentication", the retriever can limit search to authentication-related documents before scoring. This narrows the search space and improves precision.
Query Expansion
"Can't log in" and "unable to access my account" mean the same thing but share no words. Query expansion adds synonyms from a support terminology map:
What You'll Build
Glossary
| Term | Meaning |
|---|---|
| FAQ fast path | Title/tag matching for common questions (<1ms) |
| Hybrid search | Combining keyword and semantic search |
| Source boosting | Increasing scores for authoritative sources (KB > tickets) |
| Snippet extraction | Finding the most relevant paragraph in a long article |
| Query expansion | Adding synonyms to improve recall |
| Reciprocal Rank Fusion | Method for combining results from multiple search strategies |
This is chapter 3 of AI Customer Support Agent.
Get the full hands-on course — free during early access. Build the complete system. Your projects become your portfolio.
View course details