Method reference Β· retrieval
Vector RAG (top-k retrieval)
First, embed all your notes. When a user asks a question, embed the question too. Then, find the most similar note chunks and paste them into the prompt. The model only sees what you give it. But similarity doesn't tell you which information is most current.
Embeddings + vector DB
Scales to huge corpora
Similarity β recency / authority
Correctness depends on the agent choosing to retrieve
What it is
Vector RAG turns your documents into numbers called vectors. When a user asks a question, it turns the question into a vector, too. It then finds the most similar document chunks (the top-k nearest neighbors). These chunks are added to the model's prompt for context. The model doesn't memorize the documents. It only sees the chunks provided for that specific question. In our test, we used an all-MiniLM search_memory tool to find the top chunks from our notes.
Setup
- Chunk β Split your documents into smaller passages. You can split them by section or into fixed-size pieces. The size of these chunks is the most important factor for quality.
- Embed β Turn each chunk into a vector using an embedding model like all-MiniLM-L6-v2. Store this vector along with the original text and its details, like its file path and timestamp.
- Store β Load the vectors into a special database called an index. Examples include FAISS, Chroma, pgvector, Qdrant, or Pinecone.
- Retrieve β When a user asks a question, embed it. Find the most similar chunks (the top-k). Then, add them to the prompt. If a document changes, you must update the index. Otherwise, your information will become outdated.
Architecture sketch
repo/
ββ docs/ # the corpus: notes, decisions, PRDs, threads
ββ ingest/
β ββ chunk.py # docs β passages (fixed | semantic | by-heading)
β ββ embed.py # passages β vectors (e.g. all-MiniLM-L6-v2)
ββ store/index # {vector, text, meta:{path,heading,mtime}}
ββ retriever.py # query β embed β top-k ANN (+ BM25 hybrid + rerank)
ββ agent.py # search_memory(query) tool β top-k chunks β prompt β LLM
The model only sees the retrieved chunks, not all your documents. This helps it handle large amounts of information. But it's also a risk. If the right answer isn't in the top few chunks, the model will never see it.
Pros & cons
Strengths
- Works with huge document sets. You can store millions of chunks but only use a few in the prompt. The number of documents doesn't limit the prompt size.
- Easy to update. You don't need to retrain the model. Just edit a document, re-embed it, and the new information is ready to be found.
- Keeps data private. You can search a user's private data without training the main model on it.
- Provides sources. Because it uses specific chunks, you can see where the information came from. This makes it easier to check for errors.
Weaknesses
- Similarity isn't authority. The system doesn't know what's new or what's the final decision. It often returns outdated information that just looks similar.
- Finds matching words, not meaning. It can pull up fragments that contain the right keywords but miss the actual point.
- Splitting documents can break them. If a key fact is split between two chunks, the model can't answer questions about it.
- Gets outdated easily. You must re-process every document that changes. If you don't, the search index won't match the real documents.
- The 'top-k' setting is unreliable. It's hard to find a value for 'k' (how many chunks to retrieve) that works consistently.
- If retrieval fails, the model makes things up. When it gets the wrong context, it will still answer confidently, but incorrectly.
Common user feedback
This feedback comes mainly from Hacker News. The point about 'top-k' instability is from a research paper. We also cite Cline, a company that sells an alternative to Vector RAG. They are a biased source, but many others share their complaint.
- Similarity finds fragments that miss the point. An engineer at Cline said: βvector similarity often retrieves fragments that mention the right keywords but miss the actual implementation logic.β (HN, vendor-flagged).
- The best chunk can get a low similarity score. Someone on Hacker News wrote: βyou leave perfectly cromulent results on the table because they didnβt have the right cosine score in a vacuum.β (HN) β this is the classic problem of finding a similar but incorrect document.
- It can return old information. When asked βwhat happened last week in the NFL,β one tool βtold me about a Buffalo Bills game from last year.β (HN).
- 'Top-k' is an unstable setting, a research paper found. The authors wrote: βWe were unable to find an optimal value of Kβ¦ we must conclude that this additional hyperparameter is unstable. This is a downside of using RAG in practice.β (Ovadia et al., arXiv).
- The system is designed in a way that creates stale data. As Cline's blog says: βEvery merge is a potential divergence between reality and your AIβs understanding.β (Cline blog, vendor-flagged). Keeping the index up to date is a constant effort.
How it did in our benchmark
We tested this using only a search_memory tool with an all-MiniLM model. The score shows how many of the 6 facts were current. We averaged the results of 3 runs.
This test showed two kinds of failure. A capable model like Opus scored 6/6. But its success depends on the model
choosing to search for information. Haiku scored
0/6 because it made zero tool calls. It never used the
search_memory tool, even though the facts were easy to find. A deeper problem also exists. The system ranks results by
similarity, not authority. It might retrieve an old, plausible document instead of the current one. Vector RAG scales well, but it isn't built to know which decision is final.
See the full results β