# OKF vs RAG: You’re Embedding Documents You Should Be Filtering

> Source: <https://blog.devgenius.io/okf-vs-rag-youre-embedding-documents-you-should-be-filtering-a3079af6842c?source=rss----4e2c1156667e---4>
> Published: 2026-07-28 08:54:00+00:00

Member-only story

# OKF vs RAG: You’re Embedding Documents You Should Be Filtering

## 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.

Run this experiment before you disagree with me.

Take 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?”

Both 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.
