AI platform project 03
A RAG change is a release.
Chunk size, k, a similarity floor or a new embedding model can each quietly break answers. This project treats every one of them as a release candidate that has to pass an evaluation gate.
Pipeline and gate
Real evaluation results
All three views use the committed results in results/. The top two are real runs; the third is a hands-on drill on the same metrics.
Where should the abstention floor sit?
Real sweep from python -m evaluation.sweep: the tuned config re-evaluated at 11 floors. Below the floor the pipeline says “I can't answer that”. Dashed lines are the gate thresholds.
- abstention_accuracy 0.25 < 1
Only 0.10 to 0.14 pass. That window rests on 4 unanswerable questions, and the sweep ran on the same golden set the gate uses. Treat it as a hint, then confirm on held-out questions.
Four candidate configs through the gate
Committed results from python -m evaluation.run, run in this order. A pass registers a new MLflow model version and moves the champion alias.
| config | verdict |
|---|---|
| baseline90-word chunks, k=4, floor 0.12 | pass |
| candidate-badwhole docs, k=1, no floor, superseded docs on | blockedhit_rate 0.84 < 0.9; mrr 0.84 < 0.85 (+2) |
| candidate-loose60-word chunks, floor 0.08 | blockedabstention_accuracy 0.50 < 1 |
| candidate-tuned60-word chunks, floor 0.10 | pass |
With v2 as champion, re-submitting the old baseline is blocked. Its answer accuracy is 0.08 lower, past the 0.05 tolerance, even though it clears every threshold.
Score a retrieval by hand
Question: “When does the deployment change freeze start?” Only deploy-process is relevant. Reorder the results and change k to see each metric move.
- 1deploy-process-2024superseded Jenkins runbook: freeze Thursday 17:00
- 2deploy-processcurrent: freeze Friday 15:00 UTC
- 3incident-severitymentions SEV1/SEV2, not the freeze · outside top-k
- 4oncall-policyrotation changes Monday 10:00 · outside top-k
The stale runbook ranks first. An extractive or LLM answer will likely say Thursday 17:00. That is exactly how candidate-bad failed. A status filter removes it before ranking.
Test me
Concept checks, scenario calls and numbers from the real runs. Answer, then read why. Wrong answers can be retried at the end.
Run it yourself
Free: pytest -q (17 tests), then python -m evaluation.run --config configs/candidate-bad.yaml to watch the gate block it. mlflow ui shows the runs and registry. docker compose adds pgvector and an MLflow server. Optional Terraform creates a Bedrock Knowledge Base on Aurora pgvector and an Azure AI Search service. It is validated but has not been applied.