Systems · Week 4

RAG grounding

Retrieval that constrains generation — failure modes when context is wrong or empty.

RAG grounding

Business constraint

Answers must cite retrieved snippets. Hallucinated policies are unacceptable for internal tools.

Naive v0

Embed query, take top-k, dump into prompt. No score floor. No freshness. No citation enforcement.

Failure drill

Irrelevant chunks dominate. Stale docs win on similarity. Model invents citations. Hot documents crowd the index unevenly.

Evolution path

Iteration 1

Score thresholds + hybrid retrieval. Refuse to answer when evidence is weak.

Iteration 2

Rank memories with composite scores (lab memory-rank): relevance, recency, trust, diversity.

Iteration 3

Cache retrievals with soft TTL; invalidate on corpus update. Evaluate groundedness, not only BLEU vibes.

Implementation cut

Productize "I don't know" . Log retrieval ids with answers. Treat ranking as a systems control loop.

Numbers

Groundedness eval score. Empty-retrieval rate. p95 retrieval latency. Stale-doc incident rate.

Pattern tags

Self-check

  1. What happens without a score floor?
  2. Why composite ranking?
  3. How do you handle empty retrieval?
  4. What should you cache?
  5. What metric catches hallucinations better than fluency?

Walkthrough

Recordings will appear here when published. Until then, work the failure drill and lab locally — pause after each iteration and write the metric that moved.

Lab package: see /systems/labs/memory-rank/.

Open lab: memory-rank