LLM Fine-Tuning vs RAG: Decision Guide Interview Prep
When to use RAG, KB-Routing, fine-tuning, or the hybrid route-then-RAG pattern — decision framework, trade-off comparison table, and production pitfalls.
Quick answer
The decision in one line: add knowledge with retrieval (RAG or KB-Routing), change behavior with fine-tuning, and reach for fine-tuning last because it is the most expensive to build and keep current.
"Should we fine-tune?" is often the wrong first question, and interviewers experienced with production AI systems know it.
Editorial review
Written by
CompoundLearn editorial team
Wireless / RF / hardware engineering
Reviewed by
CompoundLearn editorial team
Wireless / RF / hardware engineering
Last reviewed
Built from curated topic maps, editorial validation, and subject-matter review so the page stays aligned with the interview intent and the current content pipeline.

Key points
- Add knowledge with retrieval (RAG or KB-Routing); change behavior, style, or format with fine-tuning. Reach for fine-tuning last — it is the most expensive to build and to keep current.
- Try prompt engineering first: a stronger grounding instruction, few-shot examples, or pasting the document into a long-context window often closes the gap for free.
- RAG vs KB-Routing turns on one behavior: in RAG the LLM synthesizes a fresh answer from retrieved chunks; in KB-Routing it follows a retrieved template and only fills slots. Same retrieval substrate, opposite output guarantees.
- The production default for mixed traffic is hybrid route-then-RAG: an intent classifier sends predictable queries to templates and falls through to RAG below a confidence threshold — that threshold is the load-bearing tuning knob (target ~95% router precision).
- Before fine-tuning, run the oracle retrieval ablation — inject the known-correct document straight into the prompt. If that lifts quality, the bottleneck is retrieval, not the generator, and a better embedding/reranker/chunking beats fine-tuning at far lower cost.
- Fine-tuning in practice means parameter-efficient adapters (LoRA/QLoRA), not full re-training; total cost of ownership for a fine-tune pipeline runs roughly 10-50x a comparable RAG system once data curation and re-tuning cycles are counted.
- KB-Routing fails silently: a confident, well-formed answer from the wrong or stale template is harder to catch than an obviously hallucinated RAG answer. Version templates like code and gate them on a last-reviewed date.
What it is
The decision in one line: add knowledge with retrieval (RAG or KB-Routing), change behavior with fine-tuning, and reach for fine-tuning last because it is the most expensive to build and keep current. Before any of them, try prompt engineering — a better system prompt, few-shot examples, or simply pasting the relevant document into the context window often closes the gap for free, and the 2025 LaRA benchmark (ICML) found that with a capable long-context model, stuffing the corpus into a 128K window can match or beat a retrieval pipeline on some task types. Escalate only when prompting plateaus. RAG, KB-Routing, and fine-tuning are three complementary strategies for adapting a language model to a domain or adding new knowledge. They look similar — all involve retrieving from a knowledge base or shaping model behavior — but they produce very different systems. The question that separates them: do you want the LLM to compose freely, or to follow a script? RAG (Retrieval-Augmented Generation) (see /topics/rag-retrieval-augmented-generation) retrieves content chunks from a knowledge base, stuffs them into the LLM prompt as context, and asks the model to synthesize an answer. Every answer is composed at runtime; no two responses to the same question are guaranteed to be identical. The knowledge base controls what facts the model has access to; the model controls how those facts are expressed. This produces flexible, fluent answers grounded in retrievable sources — but introduces hallucination risk when the model blends retrieved facts with its parametric knowledge. KB-Routing retrieves a predetermined template or workflow from a knowledge base and asks the LLM to follow it, filling variable slots but not composing freely. Two queries with the same intent produce structurally similar answers. This pattern trades flexibility for predictability: lower hallucination risk, deterministic response shape, faster and cheaper per query. The primary failure modes are routing precision failures (wrong template selected) and stale templates (the policy changed but the template was never updated). KB-Routing is the right choice when the answer is one of a finite, known set of responses — FAQ entries, policy rules, structured workflows. Fine-tuning updates model weights by training on domain-specific data. Unlike RAG and KB-Routing, it cannot access information added after training without re-tuning. Its strength is teaching the model new reasoning patterns, response styles, or deep domain terminology that context-window injection cannot replicate. Most teams never do full fine-tuning — they use parameter-efficient methods (LoRA and its quantized variant QLoRA), which freeze the base weights and train small low-rank adapters, cutting GPU cost and memory by an order of magnitude while staying mergeable per task. Even so the cost is real: data curation, overfitting and catastrophic-forgetting management, held-out evaluation, and a re-tuning cycle whenever the domain shifts. A common middle path is retrieval-augmented fine-tuning (RAFT), which trains the model to ignore distractor passages and answer only from the relevant ones — fine-tuning the model to be better *at* RAG rather than to memorize facts. A common architecture for mixed traffic combines all three. A lightweight intent classifier at the front of the pipeline triages each query: predictable intents go to KB-Routing (fast, cheap, verifiable); open-ended synthesis queries go to a RAG pipeline backed by LlamaIndex, LangChain, or Haystack; queries below the router's confidence threshold fall through to RAG automatically. The router's confidence threshold — the value below which a query is treated as out-of-distribution — is the single most important tuning knob in this architecture. Case study: most production customer-support agents, banking assistants, and engineering on-call bots use this hybrid pattern. Refund-policy questions, PIN resets, and business-hours queries hit KB-Routing templates. "Explain why service X is paging" or "compare these two contract terms" routes to RAG. The asymmetry is visible from response latency — template responses are crisp and sub-100ms; RAG responses are 1-3 seconds.
Why interviewers ask
"Should we fine-tune?" is often the wrong first question, and interviewers experienced with production AI systems know it. Jumping to fine-tuning before measuring RAG faithfulness and retrieval recall is a pattern that signals inexperience with the trade-offs. The real question is: which failure mode does your system have, and which strategy addresses it? Interviewers use this topic to surface engineers who can navigate the decision framework, not just name the techniques. The hiring signal is in the diagnostic process: can the candidate explain when each strategy is appropriate, measure when RAG is insufficient (using oracle retrieval ablation, RAGAS context precision, faithfulness score), estimate fine-tuning costs and data requirements, and design a hybrid routing architecture that serves mixed-intent production traffic efficiently? Strong answers demonstrate operational depth. RAG pipelines need vector database management (see /topics/vector-databases-and-embeddings), embedding model versioning, reranker tuning, chunking strategy calibration, and continuous faithfulness monitoring. KB-Routing needs template versioning (templates should be treated like code in git, reviewed via PR, linked to source-of-truth documents). Fine-tuned models need data curation pipelines, rigorous held-out evaluation, and a re-tuning cycle whenever the domain shifts. Neither approach is "set and forget" — total cost of ownership, not just per-query inference cost, drives the architecture decision. The deeper hiring signal is the ability to decompose failures. Can the candidate distinguish a retrieval recall failure from a generation faithfulness failure? Can they explain the oracle ablation technique for measuring RAG ceilings? Do they understand why KB-Routing's "stale template" failure mode is more dangerous than RAG hallucination — because confidently wrong structured answers are harder to detect than obviously vague or uncertain ones? These questions separate engineers who have operated these systems in production from those who have only read about them.
Common mistakes
The most common mistake is over-RAG: routing queries through a full retrieval-and-synthesis pipeline when a template lookup would return a faster, cheaper, and more reliable answer. A query like "what is your return policy" does not need synthesis — it needs the current return-policy text, returned deterministically. Running this through RAG every time costs LLM-generation budget on a query whose answer is already known. The opposite mistake is under-RAG: building an ever-expanding template library when the long tail belongs in retrieval. Teams start with KB-Routing for the first 10 intent patterns, then keep adding templates until they have 200-500. When a novel query arrives that matches no template above the confidence threshold, the system either routes to the closest wrong template (confidently wrong) or returns "I don't know" (losing the user). The manageable template budget is typically 30-100; beyond that, the long tail belongs in RAG. Bad chunking is the most-overlooked RAG failure. Chunks too short (50 tokens) lose context and cause confabulation; chunks too long (5,000 tokens) bury the relevant sentence and degrade faithfulness. Standard chunk sizes are 256-1,024 tokens with 20-50 token overlap — but the right value depends on document structure and query distribution and is worth measuring on your actual data, not assumed from benchmark defaults. Missing the faithfulness measurement layer is a critical gap. Teams deploy RAG without automated faithfulness evaluation, then discover months later that retrieval drift (stale or contradictory documents in the knowledge base) or a model upgrade has caused silent quality degradation. RAGAS faithfulness and context precision should run in CI against a held-out regression set and as an online sampled metric in production (see /topics/llm-evaluation-best-practices). Treat faithfulness below threshold as a structural gate that blocks deployment — not a dashboard number the team gets around to noticing. Finally: treating fine-tuning as the default accuracy fix without first diagnosing the bottleneck. If retrieval recall is low, fine-tuning the generator does nothing. If generation faithfulness is low because the grounding instruction is weak, fine-tuning is the wrong fix — strengthening the system prompt and running RAGAS is faster and cheaper.
RAG vs KB-Routing vs Fine-tuning vs Hybrid — Eight Decision Axes
| Axis | RAG | KB-Routing | Fine-tuning | Hybrid (route-then-RAG) |
|---|---|---|---|---|
| What is retrieved / changed | Content chunks from a knowledge base | Predetermined templates or workflows | Model weights updated via training | Templates for known intents; RAG for the long tail |
| LLM's job | Synthesize new content from retrieved passages | Follow a retrieved script, fill variable slots | Apply learned reasoning or style patterns | Follow template OR synthesize, depending on route |
| Output variability | High — new prose each time | Low — template controls response shape | Low-to-medium — style fixed by training | Low on routed path; high on RAG path |
| Knowledge freshness | Dynamic — add documents without retraining | Dynamic — update templates without retraining | Static — frozen at training time, requires re-training to update | Dynamic — both template and RAG layers update without retraining |
| Primary failure mode | Hallucination; retrieval miss (wrong documents) | Mis-routing; stale templates | Overfitting; catastrophic forgetting; stale parametric knowledge | Mis-routing on edge cases; template maintenance burden |
| Verifiability | High with enforced citations — each claim traceable to a retrieved passage (vanilla RAG without citation enforcement is not) | Very high — deterministic template + intent audit trail | Low — no source citation from model weights | High (KB path); high (RAG path with citations) |
| Cost profile | Low setup; per-query embedding + LLM generation cost | Very low per-query — no LLM synthesis on template path | High upfront (GPU compute + data curation); low inference | Moderate — savings on deterministic majority; full cost on RAG path |
| When to use | Open Q&A, summarization, proprietary or live data synthesis | Customer support FAQs, regulated outputs, structured workflows | Style adaptation, deep reasoning patterns, domain terminology change | Mixed-intent production traffic; the default for most enterprise agents |
Sample interview questions
- A product team is building a customer-support agent. Refund-policy questions account for 60% of traffic; the rest are open-ended. Which architecture is the production default for mixed-intent traffic?
- A. Pure RAG over the entire knowledge base — consistent retrieval for all query types.
- B. Pure KB-Routing with a template for every possible query — maximum predictability.
- C. Hybrid: route predictable refund-policy queries to templates (KB-Routing); fall through to RAG for the long-tail open-ended queries. ✓
- D. Fine-tune the model on past support transcripts so it learns both response styles.
Option C is correct. The production-default hybrid pattern routes predictable intents to predetermined templates (KB-Routing) and falls through to RAG for everything else. KB-Routing on the 60% deterministic majority reduces cost, latency, and hallucination risk compared with synthesizing the same canned answer through RAG each time. RAG handles the unpredictable 20-40% long tail, where synthesis capability is actually needed. Option A is wrong. Running every query through RAG burns LLM-generation cost and context budget on queries whose answer is already known and unchanging — this is the over-RAG failure: reaching for retrieval-and-synthesis when a template lookup would do. Option B is wrong. Template count is finite and maintainable up to roughly 30-100 intents; beyond that, the maintenance burden collapses. The under-RAG failure is the mirror image — trying to template the long tail fails when novel queries inevitably arrive. Option D is wrong. Fine-tuning changes model weights to improve synthesis or reasoning patterns, not to encode answers to specific policy questions. Training on past transcripts does not help the model stay current as the refund policy changes over time. Production reality: most customer-support agents, banking assistants, and regulated-domain bots use this hybrid pattern. The router's confidence threshold is the single most important tuning knob — tune it against a held-out intent set to balance false-routing rate against template-coverage.
- What is the key behavioral difference between RAG and KB-Routing that makes them operationally distinct — even though both retrieve from a knowledge base and end with an LLM call?
- A. RAG uses dense embeddings; KB-Routing uses BM25 sparse retrieval.
- B. In RAG the LLM synthesizes new content from retrieved passages; in KB-Routing the LLM follows a predetermined template, filling variable slots but not composing freely. ✓
- C. RAG requires a vector database; KB-Routing works with any SQL database.
- D. KB-Routing is an older term for RAG — they are the same pattern with different names.
Option B is correct. This is the central operational distinction: RAG retrieves content chunks and asks the LLM to synthesize a new answer from them — every answer is composed at runtime, high output variability, high flexibility, and hallucination risk from generation. KB-Routing retrieves a predetermined template (a response shape with variable slots) and asks the LLM to follow it — the output shape is controlled, deterministic for the same intent, low hallucination risk, and fast. Same retrieval substrate; completely different post-retrieval behavior. Option A is wrong. Both patterns can use dense embeddings or BM25 in their retrieval layer. The choice of retrieval algorithm is orthogonal to whether the post-retrieval step is synthesis or template-following. Option C is wrong. Both patterns can use any backend (vector databases, SQL, YAML registries). Database type does not determine which pattern applies. Option D is wrong. Treating them as synonyms is a costly conflation. A system designed for RAG will be blindsided when the LLM produces fluent-but-unsupported answers; a system designed for KB-Routing will fail on novel queries the template library never anticipated. Production reality: KB-Routing produces structurally similar answers for queries with the same intent — two identical-intent queries always get the same template-shaped response. RAG may produce slightly different wording each time. That predictability difference is what makes KB-Routing appropriate for regulated or compliance-sensitive outputs.
- RAGAS faithfulness measures whether a RAG answer is supported by retrieved passages. What critical quality dimension does faithfulness NOT cover?
- A. Faithfulness measures real-world factual correctness. It misses grammatical quality.
- B. Faithfulness measures whether the answer stays within the bounds of the retrieved context. It does not measure whether the retrieved passages themselves are correct, current, or complete. ✓
- C. Faithfulness and context precision are the same RAGAS metric — the distinction is only terminology.
- D. Faithfulness measures citation formatting. It misses semantic relevance to the query.
Option B is correct. RAGAS faithfulness is a retrieval-conditioned consistency metric: it checks whether each factual claim in the generated answer can be attributed to a retrieved passage. If the retrieved passages are outdated, incorrect, or incomplete, a high faithfulness score tells you the generator did not hallucinate beyond them — not that the answer is actually correct. A system running RAGAS faithfulness on a stale or wrong knowledge base will score highly and still mislead users. Option A is wrong. Faithfulness is not a real-world factual correctness measure. A grammatically perfect answer that introduces facts not in the retrieved passages will score low on faithfulness; a factually wrong answer that faithfully reproduces its (wrong) retrieved context will score high. Option C is wrong. RAGAS separates faithfulness, answer relevance, context precision, and context recall as distinct metrics. Context precision measures whether retrieved passages were actually relevant to the query — a different question from whether the generator stayed within them. Option D is wrong. Citation formatting is not what faithfulness measures. Faithfulness checks semantic grounding (each claim traceable to a retrieved passage), not formatting. Production reality: faithfulness should be paired with a knowledge-base freshness audit. High faithfulness on a stale KB is a false confidence signal. Run faithfulness as both a CI gate and an online sampled metric, and track it per model release — a model upgrade can quietly shift faithfulness because the new model leans harder on its parametric priors.
- When is adding a cross-encoder reranker to a RAG pipeline most justified?
- A. Always — rerankers improve results in every RAG pipeline regardless of current precision.
- B. When retrieval recall is high but precision is low: the initial retrieval returns many candidates, but many are only loosely relevant, and the LLM needs a cleaner top-k to reduce prompt noise. ✓
- C. Only when using pgvector — other vector databases handle reranking automatically.
- D. When the knowledge base exceeds 100,000 documents.
Option B is correct. A cross-encoder reranker (Cohere Rerank or a fine-tuned cross-encoder) re-scores each candidate by passing the query and document through the model together and emitting a single relevance score — no separate embedding (ColBERT, by contrast, is a late-interaction model, not a cross-encoder). This is more accurate than the bi-encoder similarity scores used in first-stage retrieval, but with higher latency (typically 100-300ms for a cloud API reranker). The cost is worth paying when first-stage retrieval has high recall (right documents in the candidate set) but low precision (many irrelevant documents mixed in). The reranker surgically re-orders, letting the LLM see a cleaner top-k. Option A is wrong. When first-stage precision is already high (the top-5 retrieved documents are already the right ones), a reranker adds latency with no quality benefit. Reranking cannot create relevance where it does not exist in the candidate set. Option C is wrong. pgvector does not have any special relationship with reranking. All vector databases serve candidate sets that can be fed to a reranker; the choice of vector store does not determine whether reranking is needed. Option D is wrong. Knowledge base size affects retrieval cost and index strategy, not whether reranking is valuable. A small KB with poor first-stage precision may need a reranker far more than a large KB with well-calibrated embeddings. Production reality: measure precision@k before committing to a reranker. If precision@5 is already 0.8+, the added latency is hard to justify. If precision@5 is 0.4-0.6 and recall@20 is 0.9+, a reranker is a high-value addition. Chunking and reranker tuning are the two most-overlooked RAG levers — teams reach for fine-tuning while leaving both untouched.
- A RAG system retrieves the correct documents for a query but the final answer still contains claims not present in any retrieved passage. What is the failure?
- A. The embedding model is not capturing query semantics correctly.
- B. The generator LLM is not sufficiently constrained to ground its answer in retrieved context — the system prompt instruction to stay within provided passages is absent, weak, or overridden by the model's parametric knowledge. ✓
- C. The vector database index is corrupted and returning wrong results.
- D. The context window is too small to fit all retrieved passages.
Option B is correct. When retrieval is verified correct (right documents in context) but the model still produces claims beyond them, the failure is in the generation constraint: the model is drawing on its parametric knowledge (training-data weights) to supplement or embellish the retrieved information rather than staying within it. This happens when the grounding instruction ("answer only based on the provided context") is absent, too weak, or overridden by the model's training distribution. The fix is a stronger grounding instruction, combined with faithfulness scoring (RAGAS or HHEM-2.1) that penalizes claims not attributable to retrieved passages. Option A is wrong. The premise states retrieval is correct — the right documents are being retrieved. The embedding model is not the failure point here. Option C is wrong. A corrupted index would cause wrong or missing documents, not hallucination beyond correct retrieved context. Option D is wrong. A context window too small to fit all passages is a truncation problem — some documents are cut off — which is a different failure mode from generation beyond correct context. Production reality: "stay within the context" grounding instructions need to be explicit, tested, and measured. Run RAGAS faithfulness on a held-out set where you have verified the retrieved context is correct. If faithfulness is low despite correct retrieval, strengthening the grounding instruction is the highest-leverage fix before reaching for fine-tuning.
- What is the standard diagnostic for measuring whether a RAG pipeline has reached its performance ceiling before committing to fine-tuning?
- A. If the RAG system achieves 80% accuracy on a test set, it has hit its ceiling.
- B. Oracle retrieval ablation: inject known-correct documents directly into the prompt, bypassing retrieval entirely, to isolate whether failures are in retrieval or generation. ✓
- C. Run 10 manual test queries. If 3 or more fail, fine-tuning is needed.
- D. Compare RAG performance against a fine-tuned model baseline on a 100-example set.
Option B is correct. The oracle retrieval ablation bypasses the retrieval component entirely by injecting the known-correct document(s) directly into the LLM prompt. This isolates generation from retrieval. If oracle-context performance is significantly higher than end-to-end RAG performance, retrieval is the bottleneck — optimize the embedding model, reranker, or chunking strategy before touching weights. If oracle-context performance is close to end-to-end performance, retrieval is working but the generator is the bottleneck — at that point, fine-tuning on domain-specific synthesis patterns may genuinely help. Option A is wrong. An 80% accuracy number without an oracle ablation does not reveal whether the remaining 20% failures are in retrieval or generation. You cannot diagnose the bottleneck from end-to-end accuracy alone. Option C is wrong. 10 manual test queries is too small for statistical reliability, introduces selection bias, and provides no decomposition into retrieval vs generation failures. Option D is wrong. A comparison against a fine-tuned baseline tells you which system currently performs better, but not whether RAG has headroom before it plateaus. Teams that skip this step and jump to fine-tuning often discover they fine-tuned around a retrieval problem that a better embedding model or reranker would have fixed at far lower cost. Production reality: the oracle ablation is the highest-leverage diagnostic step in RAG engineering. Run it before any significant investment in fine-tuning, reranker evaluation, or retrieval-algorithm changes.
- A KB-Routing system is giving customers confidently wrong answers about refund eligibility. Given the KB-Routing failure-mode taxonomy, what is the most likely root cause?
- A. The LLM is hallucinating beyond the retrieved template — this is the standard RAG hallucination failure.
- B. The router is mis-classifying query intent OR the matched template is stale — the two primary KB-Routing failure modes. ✓
- C. The vector database embedding index is out of date.
- D. The system prompt is too long, causing the model to forget the template.
Option B is correct. RAG and KB-Routing fail differently. In KB-Routing, the two primary failure modes are: (1) routing precision failure — the intent classifier selects the wrong template for the query; and (2) stale templates — the template was written when the policy was different and was never updated. A confidently wrong answer about refund eligibility, structurally well-formed, is the KB-Routing signature failure: a plausible template response to the wrong question, or the right template with outdated data. This is harder to detect than RAG hallucination precisely because the response looks well-formed. Option A is wrong. RAG hallucination (generating claims beyond retrieved context) is a different failure mode. KB-Routing does not ask the LLM to synthesize beyond the retrieved template — it follows it. The failure here is in the template path, not in free-form generation. Option C is wrong. KB-Routing retrieves templates, not content chunks for synthesis. Outdated embedding indices would affect which template is matched (routing precision), not the template content itself. Stale templates are the more specific and likely cause. Option D is wrong. Context-length issues cause truncation or repetition, not structurally coherent but factually wrong answers. Production reality: the fix for stale templates is to link each template to a source-of-truth document with a last_reviewed date, and have CI fail when the template is older than its source. Version templates in git, review changes via PR, and run CI checks on length and completeness.
- When should a team escalate from single-pass RAG to agentic RAG (Self-RAG, CRAG, or LangGraph agentic loops)?
- A. Immediately — agentic RAG always outperforms single-pass RAG.
- B. When the knowledge base exceeds 1 million documents.
- C. When single-pass quality has plateaued on measured failures, multi-hop questions are common, or retrieval quality varies materially by query and requires self-evaluation. ✓
- D. Agentic RAG is only useful for code-generation tasks, not knowledge Q&A.
Option C is correct. There is a three-step escalation ladder: (1) single-pass RAG — cheapest, sufficient for most queries; (2) agentic RAG — when single-pass quality plateaus, multi-hop questions are common, or retrieval quality varies materially by query; (3) GraphRAG/hybrid — when cross-document relationship traversal is a common query pattern. Agentic RAG (Self-RAG, CRAG, LangGraph agentic retrieval) adds latency and cost by allowing the LLM to decide when to retrieve, what to query, and how many rounds to run. Start at (1) and escalate only on measured failures, not anticipated ones. Option A is wrong. Agentic RAG adds latency and cost; on single-hop factual queries where single-pass retrieval is already high quality, the agentic loop produces no improvement and degrades user experience. Option B is wrong. Knowledge base size is not the escalation criterion. Large but single-hop knowledge bases work well with single-pass RAG. Small knowledge bases with multi-hop relationship questions may need agentic RAG. Option D is wrong. Agentic RAG is used across knowledge Q&A, research summarization, engineering on-call assistants, and other domains. Code generation is not a distinguishing criterion. Production reality: measure single-pass quality on your actual query distribution first. Run the oracle retrieval ablation. Only if oracle-context performance is high but end-to-end performance plateaus does agentic multi-pass retrieval become worth the latency and cost.
Frequently asked questions
- What is the fundamental question that determines whether to use RAG or KB-Routing?
- One question separates them: do you want the LLM to compose freely, or to follow a script? If the answer is open-ended and every response should be different, use RAG — the LLM synthesizes new content from retrieved passages. If the answer is one of a finite, known set of policies, FAQ entries, or workflows, use KB-Routing — the LLM follows a predetermined template, filling variable slots without free-form generation. Most production systems use both: KB-Routing for the predictable majority (fast, cheap, deterministic), RAG for the open-ended long tail (flexible, higher cost, higher hallucination risk). The hybrid pattern routes by intent confidence, falling through to RAG when no template matches above the confidence threshold.
- When does RAG beat fine-tuning for adding domain knowledge?
- RAG wins when the knowledge changes frequently (new documents are immediately available without retraining), when verifiability is required (each claim can be traced back to a retrieved passage), or when data volume makes training expensive or leads to catastrophic forgetting. Fine-tuning wins when the goal is behavioral change — adapting output style, response format, reasoning patterns, or domain terminology — rather than knowledge injection. The practical rule: start with RAG and measure retrieval recall and answer faithfulness. Fine-tune only if RAG plateaus on generation quality after retrieval is already working well.
- What are the primary failure modes of KB-Routing, and how do they differ from RAG failures?
- KB-Routing fails in two ways: (1) routing precision failure — the intent classifier maps the query to the wrong template, producing a confident and well-formed but irrelevant answer; and (2) stale templates — a template written months ago no longer reflects the current policy, and queries get the old answer silently. These are harder to detect than RAG hallucination because KB-Routing responses look structurally clean even when wrong. RAG fails via hallucination (claims beyond retrieved context) and retrieval miss (wrong or missing documents). The fix for KB-Routing is to version templates like code, link each to a source-of-truth with a last-reviewed date, and run CI checks when templates diverge from their source.
- What is the router confidence threshold, and why is it the load-bearing knob in a hybrid pipeline?
- The confidence threshold on the intent classifier is the value below which a query falls through from KB-Routing to the RAG fallback path. Too high a threshold and edge-case queries get wrong template responses; too low and the template path is bypassed for queries it would handle well. Tune this threshold against a held-out validation set, targeting router precision around 95% — measuring false-routing rate on misclassified queries. Open-source routers such as semantic-router provide calibrated per-route thresholds out of the box. Always define a RAG fallback; a router without a fallback produces silent failures on out-of-distribution queries.
- How do you measure whether a RAG pipeline has hit its performance ceiling before committing to fine-tuning?
- Use oracle retrieval ablation: inject the known-correct document(s) directly into the LLM prompt, bypassing retrieval entirely, and measure answer quality. If oracle-context performance is significantly higher than end-to-end RAG performance, retrieval is the bottleneck — optimize the embedding model, chunking strategy, or add a reranker. If oracle-context performance is similar to end-to-end performance, retrieval is working but the generator is the bottleneck, and fine-tuning on domain-specific synthesis patterns may help. Teams that skip this diagnostic and jump to fine-tuning frequently discover they fine-tuned around a retrieval problem that better embeddings or a reranker would have fixed at far lower cost.
- What is domain-stratified RAG, and when should you use it?
- Domain-stratified RAG routes every query through RAG, but a domain classifier first fans the query out to a domain-specific RAG pipeline — legal queries to a legal-only retriever, medical queries to a medical-only retriever, and so on. Each domain pipeline has its own chunk corpus, embedding model, reranker, and faithfulness thresholds. This reduces the retrieval search space by 5-50x on large, stratified knowledge bases, makes per-domain tuning feasible, and prevents cross-domain retrieval noise. Use it when the knowledge base is large and stratified and per-domain precision matters more than the overhead of maintaining separate pipelines. For homogeneous knowledge bases, a single pipeline is simpler and sufficient.
- What is agentic RAG, and when does single-pass RAG justify escalating to it?
- Agentic RAG gives the LLM control over the retrieval loop — deciding when to retrieve, what to query, and when it has enough context. Variants include Self-RAG (the model emits special tokens to request retrieval and critiques retrieved content), CRAG (retrieves, evaluates quality, falls back to web search if KB is insufficient), and LangGraph agentic loops (the retriever is a tool the agent calls). Escalate from single-pass only when measured failures are in multi-hop questions requiring multiple retrieval rounds, when retrieval quality varies materially by query and self-evaluation helps, or when single-pass quality has plateaued after thorough optimization. Start at single-pass and escalate on evidence, not anticipation.
- Why is it a mistake to chunk templates into the RAG corpus and let retrieval pick which template to use?
- Template selection requires intent classification — mapping a query to the closest known behavior in a finite set. Embedding models are trained for semantic similarity across general text, not for disambiguating between behavioral templates that may look similar on surface text but differ in what workflow they trigger. Stuffing templates into a chunk corpus "and letting RAG figure out which template applies" produces poor routing precision because the embedding space was not built for that purpose. Use a dedicated intent classifier (rule-based, embedding-based semantic router, classifier model, or small LLM classifier) for routing, and a separate RAG pipeline for content retrieval. Conflating them degrades both.
- What does the hybrid route-then-RAG pattern look like in production, and what OSS tools implement it?
- The hybrid pattern routes by intent confidence at the front of the pipeline. A lightweight classifier (semantic-router, LangChain RouterChain, or LlamaIndex Router Query Engine) maps each query to a known intent above a confidence threshold and sends it to the matching template path; queries below the threshold fall through to a full RAG pipeline backed by LlamaIndex, LangChain, or Haystack. The control flow is small — a route_then_template() step returns a template response or "FALLBACK", and on FALLBACK you call rag_answer(). Most production customer-support agents, banking assistants, and engineering on-call bots run this architecture: templates for the 70-80% predictable volume, RAG for the 20-30% long tail.
- If a model has a 128K or 1M context window, do you still need RAG, or can you paste the whole corpus in?
- Long context and retrieval solve overlapping problems, and the right answer depends on corpus size, task type, and the model's actual long-context ability. For a corpus that fits in the window, pasting it in (sometimes called "cache-augmented generation") removes the retrieval failure mode entirely and can match or beat RAG — the 2025 LaRA benchmark found no universal winner across 32K and 128K contexts and four QA task types. But long context does not scale: every query re-pays the token cost of the full corpus, latency climbs with input length, and models degrade on facts buried mid-context (the "lost in the middle" effect). RAG stays cheaper per query, scales past any window, and is auditable via citations. Practical rule: if the relevant material is small and changes rarely, long-context prompting is the simplest baseline; once the corpus is large or per-query cost matters, retrieval wins.
- Should I try prompt engineering before RAG or fine-tuning?
- Yes — it is the cheapest rung and frequently sufficient. Many failures attributed to "the model doesn't know our domain" are really weak instructions: no explicit grounding directive, no few-shot examples of the desired format, or a system prompt that lets the model fall back on its training priors. Fixing the prompt costs an afternoon and zero infrastructure. The escalation order is prompt engineering → RAG or KB-Routing (when the model needs facts it was never trained on, or facts that change) → fine-tuning (when the bottleneck is durable behavior — tone, schema compliance, reasoning style — that no amount of context injection fixes). Skipping the first rung is how teams end up fine-tuning around a problem a better prompt would have solved.
- How do you keep RAG answers verifiable with citations, and why does it matter?
- Require the LLM to emit explicit citation markers (e.g., [chunk 2] or [doc-id]) in a structured format, then have downstream code verify that every claim carries one. Without enforced citations, RAG answers are unverifiable — you cannot detect when the model is blending retrieved facts with parametric knowledge. An adversarial faithfulness critic that checks whether cited chunks actually support each claim is the next layer; RAGAS faithfulness and Vectara's HHEM open hallucination-evaluation model automate it in CI and online production sampling. Treat citation-presence as a structural quality gate, not a dashboard metric — a RAG answer without citations should fail the gate regardless of how fluent it reads.
Related topics
Essential AI-Native Skills for LLM Fine-Tuning vs RAG: Decision Guide
Modern engineering work increasingly uses AI tools for design and code review, debugging, documentation, test and testbench generation, and workflow automation. The goal is not to let AI replace engineering judgment — it is to move faster while keeping verification discipline.
- Use AI to explain unfamiliar code, logs, waveforms, datasheets, or test failures.
- Break large problems into small, reviewable steps you can verify independently.
- Ask AI for hypotheses, then validate them against tests, measurements, simulations, or lab data.
- Version-control your analysis scripts, testbenches, and configs — keep changes small and reviewable.
- Document your assumptions, design tradeoffs, and debugging decisions.
- Verify AI output before trusting it: run the checks that fit the domain — unit tests, linters, simulations, or bench/lab measurements.
- Review AI output for correctness, edge cases, and real-world consequences.
Next up: LLM Fine-Tuning vs RAG: Decision Guide practice
The adaptive practice engine is already live for core wireless, RF, and ML domains. LLM Fine-Tuning vs RAG: Decision Guide questions — covering production realities, not just framework syntax — are in active development. Join the early-access list to get them first.
