Learning to Route: A Rule-Driven Agent Framework for Hybrid-Source Retrieval-Augmented Generation
This paper proposes a rule-driven agent framework for Hybrid-Source Retrieval-Augmented Generation that dynamically routes queries between relational databases and unstructured documents using adaptive rules and meta-caching to achieve higher accuracy and efficiency than existing static or learned baselines.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are a super-smart but slightly forgetful librarian (the Large Language Model, or LLM). You know a lot of general facts because you've read millions of books, but you don't know the specific, up-to-the-minute details of your town's library, bank, or hospital records.
When someone asks you a question, you have two ways to find the answer:
- The Document Shelf: You pull out general books and articles (unstructured documents). Great for stories, opinions, and broad explanations.
- The Database Vault: You go to the secure, organized filing cabinets (relational databases). Great for exact numbers, dates, and strict facts like "What was the profit last quarter?"
The Problem: The "Kitchen Sink" Approach
Most current systems try to be safe by throwing everything at the librarian. They say, "Here are 5 books and the entire bank vault, please find the answer."
The paper argues this is a terrible idea for three reasons:
- Confusion: If you ask, "What's the temperature?" and you hand the librarian a 500-page history book and a weather log, the history book might distract them.
- Cost & Speed: Reading 500 pages takes time and money (computing power).
- Mismatch: Some questions only need the bank vault (e.g., "How much is in account #123?"). Others only need the books (e.g., "Why is the sky blue?"). Mixing them often makes the answer worse.
The Solution: The "Smart Router"
The authors propose a new system called Learning to Route. Think of this as hiring a sharp, experienced Traffic Cop who stands at the entrance of the library.
Instead of letting every question go to the "Kitchen Sink" (everything), the Traffic Cop looks at the question and decides: "Do you need the books, the vault, or just the librarian's own brain?"
Here is how their system works, using a simple analogy:
1. The Traffic Cop (Rule-Driven Routing Agent)
This isn't a mysterious black box. It's a cop following a clear Rulebook.
- Rule: "If the question asks for a number or a date, send it to the Database Vault."
- Rule: "If the question asks 'Why' or 'How' about a concept, send it to the Document Shelf."
- Rule: "If it's a simple definition, just let the Librarian answer from memory."
This is fast, transparent, and cheap. You can see exactly why the cop made a decision.
2. The Rulebook Editor (Rule-Making Expert Agent)
What if the Rulebook isn't perfect? Maybe the cop keeps sending "How much money?" questions to the wrong place.
The system has a Rulebook Editor who watches the results. If the cop makes a mistake, the Editor says, "Hey, I noticed that when people ask about 'revenue,' we should send them to the Vault, not the Books. Let's update the rule."
This allows the system to learn and get smarter over time without needing a massive amount of training data.
3. The "Cheat Sheet" (Path-Level Meta-Cache)
Imagine the Traffic Cop has to stop and think for every single question. That's slow.
But, people often ask the same questions or very similar ones (e.g., "What was the revenue in Q1?" vs. "What was the revenue in Q2?").
The system keeps a Cheat Sheet (Cache). If someone asks a question that sounds like one they asked yesterday, the cop just looks at the sheet and says, "Oh, we already decided this one goes to the Vault!"
Crucially: This cheat sheet remembers where to send the question, not the answer itself. This is important because if the bank vault updates its numbers today, the old answer is wrong, but the decision to check the vault is still correct.
Why This Matters
The paper tested this on three different types of questions (financial, general knowledge, etc.) and found:
- Accuracy: It got more answers right because it didn't get confused by irrelevant information.
- Speed & Cost: It used fewer "tokens" (words processed) because it didn't waste time reading the wrong books.
- Reliability: It was more consistent than systems that just guess or try to use everything at once.
The Bottom Line
Instead of blindly throwing every question at a giant pile of information, this framework teaches the AI to think like a human expert: "Do I need a quick fact from a spreadsheet, or a detailed explanation from a book?" By using simple, clear rules to make that choice, the system becomes faster, cheaper, and much more accurate.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.