Single-modality retrieval edge cases లో fail అవుతుంది: dense vectors rare tokens మరియు IDs miss చేస్తాయి; pure lexical paraphrase మరియు semantic similarity miss చేస్తుంది. Hybrid retrieval complementary signals - dense semantic, sparse lexical, structured metadata, temporal freshness - ను fuse చేసి stable high-precision candidate sets ఇస్తుంది. ఈ article architecture, normalization, scoring fusion, failure handling, evaluation వివరంగా చెబుతుంది.
Motivation
Failure scenarios:
- Proper nouns / SKU codes dense model వల్ల miss కావడం.
- Pricing change queries temporal boost లేక stale snapshot తేవడం.
- Long natural questions sparse-only system లో stopwords పై over-weight కావడం.
- Lexical anchoring లేని semantically broad pages పై vector false positives.
Hybrid orthogonal evidence dimensions capture చేసి ఇవి mitigate చేస్తుంది.
Component Layering
Recommended flow:
- Query Embedding -> ANN search (k_vec)
- Lexical Search (BM25 / SPLADE / Elasticsearch) (k_lex)
- Union -> Score Normalization (per source scaling)
- Metadata Filter Pass (locale, access_tier, page_type)
- Diversity & Freshness Adjustments
- Optional Cross/Mono Re-Ranker
- Final Truncation (top K)
Audit కోసం raw pre-fusion scores maintain చేయండి.
Query Normalization
Steps:
- Unicode normalize NFKC
- Lowercase; answer formatting కు కావాలంటే casing snapshot preserve చేయండి.
- Tokenize చేసి stopwords preserve చేయండి; semantic embeddings context leverage చేయగలవు.
- Synonym / Alias Expansion: internal product codename mapping కోసం alternative tokens append చేయండి; model prompt లో insert చేయవద్దు, sparse retrieval కోసమే.
- Numeric & Version Extraction: targeted lexical scoring కోసం X.Y.Z patterns capture చేయండి.
Metadata & Attribute Filters
Initial candidate union తరువాత filters apply చేస్తే recall loss minimize అవుతుంది. Common fields: locale, access_tier, page_type, product_area, updated_bucket. Leakage re-ranking ను influence చేయకుండా security filters (tenant / tier) scoring fusion కంటే ముందు enforce చేయండి. Inspection కోసం filtered_out set return చేసే debug mode ఇవ్వండి.
Re-Ranking Strategy
Top N (10-20) పై lightweight cross-encoder వాడండి. Latency budget దాటితే degrade: re-rank skip చేయండి లేదా candidate count తగ్గించి lexical weight పెంచండి. Cost justify చేయడానికి re_rank_delta = MRR_post - MRR_pre track చేయండి. Short TTL లో identical union sets కు re-rank results cache చేయండి.
Freshness & Temporal Signals
freshness_weight = exp(-lambda * age_days) compute చేయండి, lambda content type ప్రకారం tuned (pricing higher, API stable lower). Combine: final_score = w_sem * sem_score + w_lex * lex_score + w_fresh * freshness_weight + w_meta * meta_priors. Dominance నివారించడానికి ప్రతి component మొదట normalize చేయండి (z-score లేదా min-max).
Failure Modes
| Failure | Cause | Mitigation |
|---|---|---|
| Popularity Bias | Overweight lexical tf-idf | Cap term frequency contribution |
| Stale Results | Freshness weight mis-tuned | Recalibrate lambda using evaluation set |
| Locale Leakage | Late filter application | Move security filters earlier |
| Semantic Drift | Embedding model upgrade | Dual-index and A/B compare before rollout |
| Over-fusion Noise | Unbounded union size | Limit union, diversity pruning |
Evaluation Framework
Experiments:
- Ablation: vector only, lexical only, hybrid w/o rerank, full - Recall@k, MRR measure చేయండి.
- Fusion Weight Tuning: validation gold set ఉపయోగించి weights grid search చేయండి.
- Latency Budget: configuration వారీ mean + P95 retrieval latency track చేయండి.
- Drift: head vs tail queries కు weekly relative recall change monitor చేయండి.
Config hashes తో evaluation manifest maintain చేయండి.
Optimization Loop
Cycle:
- retrieval traces log చేయండి: query, candidates, scores, source_tag.
- mis-hits identify చేయండి: downstream low faithfulness లేదా low citation count; root cause classify - missing lexical candidate, semantic false positive, stale content.
- weights / thresholds adjust చేసి offline suite run చేయండి.
- new fusion weights ను feature flag వెనుక canary చేయండి.
- statistically significant improvement వస్తే promote చేయండి.
Key Takeaways
- Hybrid retrieval tunable dials ఉన్న system - relentlessly instrument చేయండి.
- Security & access filters ముందే apply చేయండి; leakage scoring లోకి రానివ్వండి.
- Re-ranking measurable MRR / Recall lift తో latency justify చేయాలి.
- Temporal decay outdated, high-authority pages dominate కాకుండా చేస్తుంది.
- Fusion changes ను code లాగా treat చేయండి: version, evaluate, roll forward లేదా back.