Classical RAG · completed baseline

FakeCompanyABC — Traditional RAG

A fully local study of retrieval quality, policy routing, reranking, grounded generation, and evaluator reliability over a fictional HR-policy corpus. The goal was not just to build RAG, but to measure each stage and understand why it succeeds or fails.

100final benchmark questions
1.000Hit@3 · preferred pipeline
0.950Source Precision@3
~67 mspreferred retrieval · CPU
0.6BQwen generator size
Research design

Measure first, then improve the pipeline

The experiments were intentionally staged: establish a dense baseline, inspect its failures, reduce policy-space noise, test reranking, and only then evaluate answer generation.

01HR corpus5 fictional Markdown policies
→
02Chunking400/80, 700/120, 1000/150
→
03Nomic + ChromaDense semantic retrieval
→
04Failure analysisExact evidence + source relevance
→
05TF-IDF routingSelect likely policy file(s)
→
06Optional rerankerCross-encoder Top-5 → Top-3
→
07Qwen generationGrounded Top-3 context
→
08EvaluationRAGAS + secondary judge + manual check
Stack

Fully local baseline

Embeddings: nomic-embed-text (768-D)
Vector DB: ChromaDB
Generator: qwen3:0.6b
Local judge: qwen2.5:1.5b-instruct + RAGAS

Evaluation principle

Retrieval before generation

Ground truth stores exact source evidence, allowing Hit@K, Recall@K, Precision@K and MRR to be measured without depending on the generator.

Design constraint

CPU-conscious

Latency was measured because an improvement that is too expensive on CPU is not automatically the preferred system.

Evaluations 1–3

Dense baseline, then chunking and failure analysis

The first 20-question benchmark showed that Top-3 coverage was already strong, but additional chunks often came from the wrong policy.

Initial dense retrieval · 20 questions

MetricK=1K=3K=5
Hit@K0.8001.0001.000
Recall@K0.7751.0001.000
Precision@K0.8000.3670.220
MRR——0.883

Interpretation: the required evidence was normally present by Top-3, but extra retrieved chunks diluted precision.

Chunking experiment

Size / overlapChunksHit@1Recall@1Recall@3Prec@3MRR@5
400 / 80380.8000.7250.9500.3830.892
700 / 120220.8000.7751.0000.3670.883
1000 / 150160.7000.6501.0000.3670.825

700 / 120 was selected: complete Recall@3 with fewer chunks than 400/80; 1000/150 reduced first-rank quality.

Failure diagnosis: dense retrieval was usually finding the answer, but semantically similar language from unrelated HR policies could enter Top-3. This shifted the research question from “how do I retrieve more?” to “how do I keep the search space cleaner?”
Evaluations 4–6

Policy routing fixed the main source-level error

TF-IDF was used only to select likely policy files. Dense Nomic retrieval still ranked chunks inside that candidate search space.

QueryUser questionNo manual keyword rules
→
RouteTF-IDF policy scoresUp to 2 candidate files; fallback when weak/ambiguous
→
EmbedNomic query vectorsearch_query: prefix
→
RetrieveChroma Top-3Dense search within selected scope

20-question source-cleanliness result

15 / 60wrong-policy chunks · dense
→
2 / 60wrong-policy chunks · routed

≈87% reduction in wrong-policy chunks. Questions containing any wrong-policy chunk dropped from 11/20 to 1/20.

Why a new metric was needed

Exact Evidence Precision@3 stayed at 0.367, because a correct-policy chunk can be useful without containing the exact evidence string. Source Precision@3 exposed the improvement:

Dense only~.750
TF-IDF + dense~.967

Ranking on the original 20 questions

16 / 20first evidence at rank 1
18 / 20within rank 2
20 / 20within rank 3 · MRR@3 0.883

Because all 20 questions already had correct evidence inside Top-3, the benchmark was too easy to meaningfully study reranking. This motivated a harder 100-question set.

Evaluations 7–9

Harder 100-question retrieval benchmark

The benchmark deliberately includes paraphrases, scenarios, thresholds, negative conditions, location rules, approval conditions, historical/current distinctions and cross-policy questions.

64hard questions
36medium questions
51multi-evidence
19multi-source
100total questions

Final three-system comparison · Top-3

MetricDense onlyTF-IDF + denseTF-IDF + dense + reranker
Hit@10.7300.7900.840
Hit@30.9901.0001.000
Recall@30.9380.9380.947
Evidence Precision@30.4200.4130.420
Source Precision@30.8470.9500.963
MRR@30.8500.8880.917

Ranking-quality snapshot

Dense · MRR@3.850
Routed · MRR@3.888
Reranked · MRR@3.917

The cross-encoder improved first-relevant ranking for 11 questions, worsened 7, and left 82 unchanged.

CPU latency trade-off

StageAverage
Nomic query embedding64.32 ms
Dense after embedding1.76 ms
TF-IDF + dense after embedding2.97 ms
TF-IDF + dense + reranker after embedding (cross-encoder/ms-marco-MiniLM-L6-v2)401.08 ms

Approximate total retrieval: ~66 ms dense, ~67 ms routed dense, ~465 ms reranked.

Selected retrieval design: TF-IDF + dense. The reranker achieved the best aggregate ranking metrics, but policy routing delivered most of the practical benefit for almost no additional CPU latency.
Evaluations 10–13

Grounded generation and judge comparison

The generator was deliberately kept small so that retrieval and grounding quality remained visible rather than being masked by a large model's prior knowledge.

RouteTF-IDFPolicy candidate selection
→
RetrieveNomic + ChromaTop-3 context
→
Generateqwen3:0.6bContext-only HR answer
→
Judge ARAGAS + Qwen2.5Local, reproducible
→
Judge BGPT-5.6 SolSame saved answers; secondary evaluation

Final four-case generation comparison · 100 questions

PipelineJudgeFaithfulnessFactual correctnessSemantic similarityAnswer relevancy
DenseRAGAS + Qwen2.50.8010.6520.779—
TF-IDF + DenseRAGAS + Qwen2.50.7540.6680.778—
DenseGPT-5.6 Sol0.8310.753—0.912
TF-IDF + DenseGPT-5.6 Sol0.8480.775—0.921

Context changed

36 / 100questions had different retrieved context after routing

Answer changed

32 / 100generated answers changed

Manual judge check

5representative questions reviewed manually

GPT-5.6 Sol aligned much better with the manual judgments than the smaller local judge in this small spot-check.

Interpretation: generation scores are diagnostic, not absolute truth. The disagreement between judges became a result in itself: evaluator quality can become an evaluation bottleneck.
Main conclusion

A simple routing layer beat complexity on the accuracy/speed trade-off.

The project showed that retrieval should be diagnosed before adding heavier components. TF-IDF policy routing substantially cleaned the search space at negligible cost; cross-encoder reranking improved ranking further but added ~400 ms CPU latency. The resulting classical pipeline is preserved as the baseline for the GraphRAG study.