SHEN YIFull-Stack & AI

Paris • Singapore • Shanghai

RAG Formation · Reference

Query handling and reranking

A standalone cheat sheet for learning and testing RAG quality on this site.

$ reference --status
▸ course RAG Formation
▸ mode standalone reference
▸ status Complete
● learn → test → verify

Reference sheet

Query handling and reranking

The guided RAG Formation course content is complete; this reference is available for self-directed practice.

One-line rule

A larger top-k can hide a retrieval failure by adding noise; it does not diagnose the problem.

Core terms

TermMeaning
Query normalizationTurning a user’s question into useful search forms: the original question, extracted document IDs, normalized acronyms, or translated terms. The one technique here you can actually test live.
RerankingA real service exists (aperag/llm/rerank/rerank_service.py) with a documented fallback policy — graph results prioritized first — but nothing in the live /api/v1/search//api/v1/qa path calls it. Retrieval today is a rough first pass with no reordering step, full stop.
DeduplicationAlso more limited than it sounds: dedup today only applies to the citations list, matched by filename. The chunk text actually placed in the LLM's prompt is never deduplicated.

Evidence card

NeedRecordDon't claim
BaselineCommand, configuration, observed resultThe baseline is a target.
ChangeOne hypothesis or decisionYou can tell what caused the result when several things changed.
MetricRecord the expected source, baseline hit state, one changed query form, and the same metric after the change.One metric tells you everything about quality.
SafetyA failure and a regression caseA fluent answer proves the system is reliable.

Local command

cd demo
python3 eval.py run --mode retrieval --workspace meridian_demo --category reference_lookup --tag lesson-08-baseline

Artifact: A retrieval experiment card that can prove or disprove a hypothesis, with a metric, baseline, regression check, and stop condition.

Continue learning: Open the matching standalone lesson · Course roadmap