ARCHITECTURE
Hybrid Routing: Let the Model Read the Question, Not Choose the Answer
By Subhojit Banerjee (Staff Engineering) · Dec 2026 · 4 min read
Embedding similarity is not operational relevance. Splitting question parsing from deterministic decision-tree routing makes retrieval testable in CI.
Most RAG pipelines let embedding similarity decide which document the agent sees. Similarity is not relevance. "Consumer lag after deploy" and "consumer lag after rebalance" look almost the same to an embedding model and require opposite runbooks.
Splitting Understanding from Selection
Our Kafka copilot splits routing into two clean steps:
- The model’s job is understanding the question. It turns "orders topic is backing up since lunch" into structured terms: symptom = consumer lag, scope = topic, trigger = unknown.
- Code’s job is choosing the runbook. A decision tree maps those terms to exactly one node. Same terms, same runbook, every time. The agent then reads the whole document, never a fragment.
Testable Routing and Written Revisit Triggers
If no node matches, the agent states that it does not have a runbook for this and logs a miss. A miss becomes a demand signal, and the most frequent gaps turn into new runbooks through a reviewed PR.
What we gain is CI testability. A property test feeds thousands of generated questions through the tree and fails the build if any answer cites content outside the reviewed corpus. You cannot write that test for a vector search.
Anthropic reported something similar about their internal analytics agent: adding raw retrieval barely moved accuracy, while curated context and structure did the work.
Vector search is not banned. It sits behind an interface with a written trigger: when the corpus grows large enough that the tree stops scaling, measured by eval precision, vector search enters as a second path and the two get merged. Routing dozens of operational runbooks does not need a vector database. It needs a tree you can test.
Key Takeaways
- Use the LLM to normalize messy natural language into structured symptom terms, not to pick documents by cosine similarity.
- Route deterministically to one complete document so citations and coverage can be verified in CI.
- Defer vector search behind an explicit interface trigger tied to measured eval precision.