How the system answers a question
A question flows through retrieval (vector + keyword) then a single synthesis pass. Four AI components, all env-driven so swaps don't need a code change.
Why these four roles?
Embedding turns text into a semantic vector. Used both at ingest (per chunk) and at query time (per question). The vector store finds K nearest neighbours by cosine distance — that's the semantic-similarity leg.
BM25 is a keyword scoring algorithm (no model). Catches exact regulatory phrases and defined terms where semantic similarity misses. Combined with the vector results via Reciprocal Rank Fusion — parameter-free, outperforms linear score fusion on heterogeneous retrievers.
Reranker is a cross-encoder that re-scores the merged top candidates against the query directly — picks up nuance bi-encoder embeddings can't. Top-K after reranker reaches synthesis.
Synthesis is the "smart" LLM. Receives the chunks plus terminology bridges (from the lexicon) and writes a grounded structured answer with citations.
Fast LLM handles utility calls off the critical path: chunk enrichment at ingest, HyDE query expansion, CRAG retry decisions, self-query filter extraction, the eval judge.