A developer encountered issues with their retrieval-augmented generation (RAG) system when a cosine similarity threshold of 0.8, previously used as a safety measure, began rejecting all responses. This occurred after switching embedding models, which altered the scale of similarity scores. The root cause identified is embedding anisotropy, where most models group vectors into a narrow cone, leading to artificially high similarity scores for unrelated texts. The developer suggests calibrating thresholds on labeled data, recalibrating with model changes, or using relative signals and rerankers instead of raw cosine similarity. AI
IMPACT Highlights the need for careful calibration of similarity thresholds in RAG systems when changing embedding models.
RANK_REASON Developer shares a technical post-mortem on a RAG system issue.
- Bert
- cosine similarity
- Embedding Anisotropy
- Ethayarajh
- GPT-2
- Kubernetes
- Naples
- retrieval-augmented generation
AI-generated summary · Google Gemini · from 1 sources. How we write summaries →