Keyboard

Shortcuts

Command palette
K
Home
gh
About
ga
Projects
gp
Expertise
gx
Journal
gj
Contact
gc
Copy email
e
Call
c
Toggle theme
t
Show this help
?

↑↓ to navigate · Enter to open · Esc to close

AI & agents

Snapshot-tested RAG: reliable, not magic

TL;DR Useful RAG = clean docs + evaluated retriever + constrained prompt. Else, polite hallucination.

20 Mar 2026 · Nicolas Albert

  • rag
  • embeddings
  • pgvector
  • evaluation
Snapshot-tested RAG: reliable, not magic

1 min read Reading 0%

RAG (retrieval-augmented generation) promises « answer from your docs ». Without discipline, it invents credible citations. Three lines of defense.

1. Clean documents

We clean, split into coherent chunks (not mid-sentence), and store in pgvector. A rotten chunk = a rotten source.

2. An evaluated retriever

We measure precision@k: on a labelled question set, do the right chunks surface? If not, we fix chunking or embedding before touching the LLM.

3. A constrained prompt

The instruction forbids answering without retrieved context and requires citing the source. Not « per the docs », but « source #2 ».

RAG isn't magic: it's a pipeline you test like code.

← Back to journal

Contact me Call