Should you fine-tune a local LLM or add retrieval?

Use retrieval when the answer depends on changing documents. Consider a fine-tune when the inputs contain enough information but the model repeatedly misses a stable format or behavior.

Add retrieval when the model needs facts from changing documents; consider fine-tuning when the facts are already present but it repeatedly misses a stable behavior. Start with one diagnostic: paste the correct manual passage into the prompt and see whether the answer becomes accurate.

Identify whether information or behavior is missing

For an internal support assistant, ask a question whose answer depends on the current manual. First run it without evidence, then supply the exact relevant passage. If the second answer is correct, you have a strong reason to improve evidence delivery before training. If it still fails, inspect the prompt and compare a stronger base model before assuming an adapter will solve it.

Separate factual correctness from format. A model might correctly explain a return policy but fail to produce your required fields. Conversely, it might return immaculate JSON containing an obsolete policy. Those are different failures and deserve different remedies.

Observed failure First intervention Success criterion
Correct passage fixes the answer Retrieval and document freshness Relevant passage reaches the prompt
Facts are right, repeated output format is wrong Clear examples, schema-constrained output and validation before training Format passes on unseen cases
Correct passage still yields wrong reasoning Prompt or base-model comparison Accurate answer with identical evidence
Facts change every week Versioned retrieval source New rule replaces the old one promptly

A tuned model can also use retrieval. Keep the evidence source and behavioral adaptation separately testable so a failure has somewhere specific to investigate.

Use retrieval for facts you need to inspect and replace

The original retrieval-augmented generation research combines a generator with an external document index. In a practical local assistant, retrieval selects passages for the question and supplies them as input. The document collection can be updated separately from the generator's weights.

Budget for the evidence you actually pass. Suppose a question and instructions use 1,000 tokens, you retrieve four passages of 600 tokens each, and reserve 1,000 for the answer. Total allowance = 1,000 + 4 × 600 + 1,000 = 4,400 tokens. For this illustrative prompt budget, add any conversation history and template overhead separately.

Keep document IDs and section names with each passage. Ask the answer to identify supporting sections, and reject citations that were not supplied. Test whether the right passage appears among retrieved results separately from whether the model uses it correctly. Ensure search returns the governing rule before judging the generated answer.

For a changing manual, include a fixture where an old policy and its replacement both exist. Your ingestion and retrieval rules should make the current version identifiable. Do not train a fresh adapter every time a support phone number or refund period changes.

Understand what LoRA and QLoRA change

LoRA freezes pretrained weights and learns low-rank update matrices for selected layers. Instead of training every entry of a large matrix, it represents an update using two smaller matrices. The original LoRA paper describes this parameter-efficient adaptation method.

For a concrete matrix example, a 4,096 × 4,096 weight matrix contains 16,777,216 entries. A rank-16 update uses matrices with 4,096 × 16 and 16 × 4,096 entries, totaling 131,072. The ratio is 16,777,216 ÷ 131,072 = 128, so this example trains 128 times fewer update entries than a full matrix. Repeat that calculation for each targeted matrix, then budget the rest of the training memory separately.

QLoRA combines low-rank adapters with a frozen 4-bit quantized base model. Its paper describes NormalFloat 4-bit quantization, double quantization and paged optimizers as memory-saving techniques. Gradients train the adapters through the frozen quantized model. You still need memory for activations, adapter parameters and training state.

Hugging Face PEFT documents preparing quantized models with prepare_model_for_kbit_training and configuring adapters with LoraConfig. Its quantization guide uses target_modules="all-linear" for QLoRA-style targeting. Rank, target modules, sequence length and the chosen quantization backend belong in the training record. Budget training memory separately from inference memory.

Keep the adapter paired with its exact base checkpoint and tokenizer. Evaluate the assembled model through the runtime you will deploy, including its output template. Use held-out application checks alongside training loss.

Try it on your workload

Create 30 fictional support questions from several manual sections. Reserve ten questions from different documents or customer scenarios as a held-out set before adjusting prompts or creating training examples. Keep near-duplicate questions together so a paraphrase of a training example does not become your evidence of generalization.

Compare three initial conditions: the base model alone, the base model with the correct passage supplied directly, and the base model with passages selected by retrieval. For each answer, score factual accuracy, evidence support and output format. If direct evidence helps but retrieved evidence does not, improve search or chunking first.

For JSON-format failures, try schema-constrained output and application validation before training. Ollama accepts a JSON Schema in format; validate field contents separately against the source. Consider a small adapter experiment using only the training portion when the remaining errors concern field selection or another stable behavior. Compare the tuned model with and without retrieval on the untouched held-out questions. Include an unanswerable question and a revised policy to check that training did not encourage confident answers when evidence is missing.

Record preparation hours, training time, inference token counts and reviewer corrections. A modest accuracy gain can still be unattractive if maintaining examples and retraining consumes more effort than a simpler retrieval fix. Conversely, a stable high-volume task may justify that maintenance when the improvement holds on new cases.

How to decide

Choose retrieval when direct evidence repairs factual answers and the knowledge changes. Choose an adapter experiment when repeated behavioral failures persist with sufficient evidence, good prompts and applicable schema constraints. Combine them only when each adds a measured benefit on held-out work. Keep a base-model fallback and a versioned document collection for diagnosis.

Compare three evidence strategies at once for about 5 cents

Three evaluation agents testing evidence strategies on google/gemma-4-31b-it cost about 5 cents in tokens on TrustedRouter. In this illustrative comparison, assign one agent each to no evidence, supplied passages and retrieved passages, using the same approved questions. Each condition consumes 100,000 input and 20,000 output tokens. On 2026-11-22, catalog prices rounded to $0.106 per million input and $0.359 per million output tokens. Input = 3 × 100,000 = 300,000; output = 3 × 20,000 = 60,000. Cost = 0.3 × $0.106 + 0.06 × $0.359 = $0.05334, about 5 cents.

On one local GPU, these agents share its throughput, and requests beyond its parallel capacity wait in line; through a per-token API they can run concurrently, with the same token bill as running them one after another. Compare factual accuracy, evidence support and format against your local baseline before investing in a training pipeline. This budgets inference for the comparison; plan adapter training separately.

Prices change; check the live catalog, current models, agent setup and API setup. For approved remote evaluation, use the confidential API guide and eligible route prices. Local remains better when document or training-example rules require on-device handling.

Sources

Related local LLM decisions