{"slug": "okf-vs-rag-youre-embedding-documents-you-should-be-filtering", "title": "OKF vs RAG: You’re Embedding Documents You Should Be Filtering", "summary": "A developer argues that vector databases cannot distinguish between current and deprecated document versions, citing a gross margin example where two nearly identical definitions yield cosine similarity around 0.91. The author claims retrieval pipelines lack semantic awareness of correctness, proposing that YAML-based filtering should replace embedding-based retrieval for version-sensitive data in agent stacks.", "body_md": "Member-only story\n\n# OKF vs RAG: You’re Embedding Documents You Should Be Filtering\n\n## Your vector database cannot tell a deprecated metric from a current one. A YAML field can. Here’s where retrieval actually belongs in an agent stack, and where it never did.\n\nRun this experiment before you disagree with me.\n\nTake two metric definitions from your data warehouse docs. The current one: “Gross margin: revenue minus cost of goods sold, where COGS includes shipping and fulfillment as of FY2026.” And the old one your team retired in February: “Gross margin: revenue minus cost of goods sold, excluding shipping and fulfillment.” Embed both with whatever model you’re using — text-embedding-3-small, a local Ollama model, doesn’t matter. Now query: “how do we calculate gross margin?”\n\nBoth come back with a cosine similarity somewhere around 0.91. Sometimes the deprecated one ranks first, because it happens to phrase the formula more directly. Your retrieval pipeline has no idea one of these definitions is wrong. It cannot have any idea. Semantic similarity is the only signal it has, and the two definitions are semantically almost identical — that’s precisely why one replaced the other.", "url": "https://wpnews.pro/news/okf-vs-rag-youre-embedding-documents-you-should-be-filtering", "canonical_source": "https://blog.devgenius.io/okf-vs-rag-youre-embedding-documents-you-should-be-filtering-a3079af6842c?source=rss----4e2c1156667e---4", "published_at": "2026-07-28 08:54:00+00:00", "updated_at": "2026-07-28 09:28:23.054132+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "ai-agents", "ai-tools"], "entities": ["Ollama", "text-embedding-3-small"], "alternates": {"html": "https://wpnews.pro/news/okf-vs-rag-youre-embedding-documents-you-should-be-filtering", "markdown": "https://wpnews.pro/news/okf-vs-rag-youre-embedding-documents-you-should-be-filtering.md", "text": "https://wpnews.pro/news/okf-vs-rag-youre-embedding-documents-you-should-be-filtering.txt", "jsonld": "https://wpnews.pro/news/okf-vs-rag-youre-embedding-documents-you-should-be-filtering.jsonld"}}