Adaptive Retrieval Router
- problem
- Always-dense retrieval pays embedding cost on every query and is surprisingly weak on named entities. Always-sparse misses paraphrase. Always-hybrid is fine and pays the dense cost regardless. And no static corpus answers a question about today.
- architecture
- Five ordered heuristics: freshness markers, keyword-overlap ratio, token length, question form, classify each query and dispatch it to the cheapest backend likely to answer: BM25, FAISS dense, RRF-fused hybrid (k=60), or Tavily web. Every rule that fired is recorded on the decision, and /router/explain returns the routing without spending a token.
- FastAPI
- FAISS
- BM25
- Tavily
- Streamlit
outcome
Per-query cost spans $0 at 1–5 ms on sparse to $0.008 at 200–600 ms on web: the router exists to spend the top of that range only when the bottom would fail. A 40-query eval set forced through all four backends gives 160 directly comparable judged rows.
impact
Routing became an auditable decision instead of a default. Every call emits one structured line: hashed query, backend, latency, cost, so the heuristics can be disproven on real traffic rather than trusted.