Docent · Jun 28, 2026 · 1 min read
RAG is mostly retrieval
The generation half of retrieval-augmented generation gets the attention because it’s the part that talks back. But the quality of the answer is decided upstream, in chunking, embedding, and ranking — long before a token is produced.
Relevance is a cosine similarity of normalised vectors, — rank by it, take the top-, and most “model” problems turn out to be index problems:
A tiny retriever, in practice:
import numpy as np
def top_k(query_vec, doc_vecs, k=5):
q = query_vec / np.linalg.norm(query_vec)
d = doc_vecs / np.linalg.norm(doc_vecs, axis=1, keepdims=True)
return np.argsort(-(d @ q))[:k]
Placeholder body. The real piece walks through a small, honest index.