Preview Retrieval Before Your Local LLM Runs
Preview the files your local LLM will receive before inference. This simple gate catches bad retrieval while the fix is still cheap and clear.
My local model did no work last night. That was the useful result.
The daily brief builder found source files for four sections. It ranked them, wrote the paths into a report, and stopped before inference. I could inspect the retrieval plan without asking the model to explain a bad answer after the fact.
The short version: Add a preview stage between retrieval and local inference. Record the selected files, scores, section names, and review rule. If the source set is wrong, fix retrieval before the model spends a token.

Why preview retrieval before running a local LLM?
A local model can write a fluent answer from the wrong files. That failure looks like a model problem, but the model never had a fair shot. It received stale notes, weak matches, or sources from the wrong part of the vault.
Inference makes the mistake harder to see. Once prose exists, I start reviewing the prose. A preview keeps the earlier question visible: did the system choose the right evidence?
This matters more with private data. My source paths, ranking signals, and logs stay on owned hardware. I can inspect them without sending the vault to an external API. The local model verifier loop applies the same idea after generation. Preview is the gate before generation.
What did the preview-only run record?
The July 12 vault model lab report built four brief sections: decisions, coding, learning, and growth. Each section listed four candidate sources. The report also recorded zero model calls, zero inference latency, zero citation errors, and zero redaction issues.
Those zeroes do not prove answer quality. No answer existed. They prove that retrieval can be inspected as its own stage.
The report included exact paths such as a dated Request, a prior 5090 model-lab report, a context-engineering note, and a private reflection report. It also showed the match terms and ranking score for each candidate. That is enough detail to catch an obviously wrong source before a prompt is assembled.
What should a retrieval preview contain?
I want five fields for every candidate: destination section, source path, score, matched terms, and interaction mode. The path tells me what will be read. The score and terms tell me why it was selected. The mode tells me whether the run may generate, ask for review, or stop.
Keep the preview boring. Markdown is fine. JSON is fine. A table is fine. The artifact only needs to survive the run and make the selection reproducible.
The important part is separation. Retrieval should produce a source manifest. Prompt assembly should consume that manifest. Inference should not reach back into the vault and silently choose different files.
How do you decide whether the preview can advance?
Start with simple checks. Require at least one source for each requested section. Reject files outside the allowed roots. Flag stale sources when freshness matters. Block duplicate paths that crowd out better evidence. Require a human review for sensitive material or actions that change state.
Then inspect the manifest. Ask whether each source could support the requested output. A coding brief should not rank a personal reflection above the current code report. A decision brief should not treat an old brainstorm as a current decision.
If the preview fails, stop there. A clean stop is cheaper than a polished hallucination. I use the same fail-safe principle in my local LLM timeout guard: leave a useful artifact, name the blocked stage, and do not pretend the run completed.
Where does the local model fit after approval?
After the source manifest passes, the local model gets a bounded job. It receives the approved sources, the requested sections, and an output schema. It does not get permission to search the whole vault again.
That boundary makes debugging faster. A weak answer now has two clear causes. Either the approved evidence was insufficient, or the model failed to use it. I can change retrieval without changing the prompt, or change the prompt without changing retrieval.
This also makes model swaps safer. I can feed the same approved manifest to two local models and compare their answers against identical evidence. The source set stops moving under the test.
What is the smallest useful implementation?
Write one preview file per run. Put the run ID and interaction mode at the top. Group candidates by requested section. Include the source path and selection reason. End with an explicit verdict: approved for inference, needs review, or blocked.
Do not start with embeddings, a new database, or a large evaluation suite. Use the retrieval system you already have. Expose its choices first. Once the mistakes are visible, improve the specific ranking rule that caused them.
Accompanying prompt
What the prompt does: This prompt reviews a local LLM retrieval manifest and decides whether its source set is safe and relevant enough for inference.
Copy/paste this prompt:
Copy-ready prompt
Paste the exact block into your coding agent.
No article chrome, no footnotes, no formatting drift.
This prompt and every other one we publish live in the free prompt library.
Copy the block above.
I publish the measured local-model runs, failures, and fixes in The 5090 Reports. Join the list to get the next artifact.
Get the local AI lab notes
Benchmark rows, VRAM fit checks, quant choices, and what actually runs on consumer GPUs. M-F, only when there is something worth sending.
Patrick Hughes
Building BMD HODL — a one-person AI-operated holding company. Nashville, Tennessee. Twenty-Two agents.
More writing
- 6 min
Pin Your Context Window or Pay the Reload Tax
Change num_ctx in Ollama and it reloads the whole model. On my RTX 5090 that meant 140 seconds of dead air per context swap. Here is how to stop paying it.
- 5 min
Will That Local Model Fit? Do the VRAM Math First
A local LLM needs about half a gigabyte of VRAM per billion parameters at Q4, then KV cache and context stack on top. Here is how to know a model fits before you download 40 GB.
- 6 min
Pin Your Local LLM Context Size Before You Build a Router
Changing context size can reload a local model before every request. A measured RTX 5090 sweep shows why context belongs in the routing key.
- 6 min
When Claude hits a weekly limit, your agent fleet still needs a third CLI
Claude and Codex both went dark. Here is the tertiary Gemini path I wired, with honest qa_reviewer stamps.
- 8 min
I built a self-improving code model on one RTX 5090. Here is what actually worked.
Six pieces, one consumer GPU, no cloud. The honest results: some parts worked, some were flat, and one idea changed everything.