RAG (retrieval-augmented generation)
Graphify glossary
A pipeline that chunks documents, embeds them as vectors, and retrieves the most similar chunks at query time — lookup by resemblance, not structure.
RAG — retrieval-augmented generation — is a pipeline that chunks documents into pieces, embeds each chunk as a vector, and at query time retrieves the top-k chunks most similar to the question, pasting them into the model's context. It's the default architecture for giving language models access to information they weren't trained on, and for fuzzy lookup over prose it works well: ask about a policy, get the paragraphs that discuss it.
Code breaks its core assumption. The signal in a codebase isn't in what any chunk says — it's in how the pieces relate, and chunking destroys exactly those relationships. A function and its callers live in different files; a schema and the code that queries it share almost no vocabulary; the answer to 'what breaks if this changes?' isn't written down anywhere, so no chunk contains it. Similarity retrieval returns text that resembles the question and hopes the model can stitch the structure back together in its head.
There's also an explainability gap. A retrieved chunk arrives with a score — 0.83 — that says nothing about why it's relevant or whether the relationship it implies is real. A graph traversal is its own explanation: the answer is a path, every node on it is a real file you can open, and every edge carries a provenance tag saying whether it was extracted from the AST or inferred by a model.
None of this makes RAG useless — it makes it the wrong shape for structural questions about code. The full comparison, including where similarity search genuinely wins, is on the Graphify vs RAG page.
Related terms
- Vector embedding — A list of numbers representing the meaning of a piece of text, used to measure similarity — answers 'what looks like this?', not 'what calls this?'
- Knowledge graph — A data structure that stores entities and typed relationships between them, so software can follow how things connect instead of searching flat text.
- Traversal / hop — Following edges from node to node — one hop is a single edge, a traversal is a path of them. How graphs answer multi-step questions.