Building a local AI knowledge base is relatively straightforward.
The practical starting point: inspect the retrieved passages, measure a baseline and fix the first failing stage. A larger model cannot reliably compensate for missing evidence.
Making it reliable is harder.
You can have:
- a good local language model
- a working vector database
- correctly indexed documents
- a modern embedding model
and still get poor answers.
The reason is often not the language model.
It is retrieval.
If the system gives the model the wrong information, even an excellent model may produce a convincing but incorrect answer.
That leads to one of the most important principles in Retrieval-Augmented Generation:
A RAG system can only answer as well as it retrieves.
In our previous Insight, we looked at how to build a private local AI knowledge base using documents, embeddings, retrieval and a local language model.
Now we move to the next question:
How do you make it actually work well?
Start by separating retrieval from generation
When a RAG system gives a bad answer, there are two fundamentally different possibilities.
Retrieval failed
The correct information was never given to the language model.
Generation failed
The system retrieved the correct information, but the language model misunderstood it or answered poorly.
These problems require completely different fixes.
If retrieval is bad, changing from an 8B model to a 30B model may accomplish very little.
The larger model still receives the wrong information.
Before changing the language model, inspect what the retrieval system actually found.
This is why a useful RAG system should make its retrieved sources visible.
Example: the model is not always the problem
Imagine you have a company knowledge base containing an installation manual.
The user asks:
How do I reset device X200 after error 47?
The correct instructions are on page 63.
But the retrieval system returns:
- a general troubleshooting section
- instructions for device X100
- a product overview
- a paragraph mentioning error codes generally
The language model now has a problem.
It may try to create a useful answer from those sources.
The result might sound perfectly reasonable.
But the correct information was never available.
This is a retrieval problem, not necessarily an AI model problem.
1. Check document extraction first
Before optimizing embeddings, vector databases or models, inspect the raw text extracted from your documents.
This sounds basic.
It is also one of the easiest things to overlook.
PDFs can contain:
- multiple columns
- tables
- headers
- footers
- images
- OCR errors
- page numbers
- repeated navigation text
A document might look perfect to a human while producing terrible extracted text.
For example, a table may become:
Product X200 Error 47 Reset X300 Voltage X100
instead of preserving the actual rows and columns.
No embedding model can reliably recover information that was destroyed during document extraction.
Before doing anything more sophisticated:
open the extracted text and read it.
2. Chunking can make or break retrieval
Documents usually need to be divided into smaller pieces before they are indexed.
These pieces are called chunks.
There is no universal ideal chunk size.
If the chunks are too small, important context can disappear.
For example:
“The system must be restarted.”
may be separated from:
“This applies only to firmware version 4.2 and later.”
Retrieving only the first sentence could produce the wrong answer.
But chunks that are too large create another problem.
A single chunk might contain:
- several unrelated topics
- multiple procedures
- unnecessary background information
The embedding now represents all of them at once.
That can make retrieval less precise.
The goal is not to create the smallest possible chunks.
It is to create chunks that contain a useful unit of meaning.
3. Respect document structure
Fixed-size chunking is easy.
It is not always the best approach.
Documents often already contain useful structure:
- titles
- headings
- sections
- chapters
- paragraphs
- lists
- tables
Whenever possible, preserve that structure.
Instead of cutting every document mechanically after a certain number of characters or tokens, you can try to keep logical sections together.
For example:
Troubleshooting
→ Error 47
→ Cause
→ Resolution
→ Verification
is a much more useful retrieval unit than arbitrary slices that cut through the middle of the procedure.
The more structured your source documents are, the more value you can often get from structure-aware chunking.
4. Add useful metadata
A chunk should not contain only text.
It should also know where it came from.
Useful metadata can include:
- document name
- page number
- section
- department
- product
- document version
- language
- date
- document type
- access level
Metadata serves two purposes.
First, it helps users verify answers.
Second, it lets the retrieval system narrow the search.
Imagine a company has manuals for ten product generations.
A user asks about:
Product X200
Instead of searching every document equally, the system can first filter:
product = X200
and only then perform semantic retrieval.
That can dramatically reduce irrelevant results.
5. Semantic search is powerful — but not enough
Vector search is excellent at finding similar meanings.
If the document says:
Restore the unit to factory configuration.
and the user asks:
How do I reset the device?
semantic search can recognize the relationship.
But semantic search has weaknesses.
Consider a query such as:
X200-E47
That exact product/error identifier may be extremely important.
A semantic embedding may treat it as a relatively weak signal.
Traditional keyword search may find it immediately.
Combining search methods is worth testing when your evaluation set reveals these misses.
6. Use hybrid search
Hybrid search combines:
semantic search
and
keyword search
The semantic side matches similarity in meaning.
The keyword side matches terms. Tokenization and identifier handling still matter.
This is especially useful for documents containing:
- product IDs
- error codes
- names
- abbreviations
- version numbers
- legislation references
- technical terminology
Imagine the query:
Reset procedure for X200 firmware 4.7 after E47
Semantic search understands:
reset procedure
Keyword search strongly matches:
X200
4.7
E47
Test the combined results against your baseline; hybrid search is not automatically better for every collection. Qdrant documents semantic and lexical retrieval as complementary methods.
7. Do not send every search result to the model
Another common mistake is retrieving too much information.
It can feel logical:
If five chunks are useful, twenty must be better.
Not necessarily.
More context can mean:
- more noise
- contradictory information
- larger prompts
- higher memory use
- slower inference
- less attention on the relevant evidence
The goal is not to maximize the amount of retrieved text.
The goal is to retrieve the smallest useful evidence set.
For many workloads, a handful of strong sources is better than dozens of weak ones.
8. Reranking can improve the shortlist
A useful retrieval pipeline can happen in two stages.
Stage 1 — retrieve broadly
Use vector search, keyword search or both to find perhaps 10–30 potential matches.
Stage 2 — rerank
A separate reranking model evaluates those candidates more carefully and decides which are most relevant.
The final language model might receive only the best three or five. These counts are starting examples, not universal settings. Measure relevance and latency on your own documents.
This lets the first search prioritize recall:
Do not miss potentially useful information.
while the reranker prioritizes precision:
Put the best evidence first.
Qdrant’s reranking tutorial explains the candidate-first approach. Its example uses cloud inference; adapt it to local models if documents must remain local.
Reranking adds another component to the system, so it should not automatically be included in every small project.
But when basic retrieval reaches its limits, it can be a powerful next step.
9. Filters can be more useful than a larger model
Suppose an organization has:
- HR documents
- finance documents
- technical documentation
- sales material
An employee asks:
What is the approval process for travel expenses?
Without filtering, retrieval may search everything.
A better system may first identify:
department = finance
and
document_type = policy
Then search only that subset.
This can help, but topic filters need testing. A policy may apply across departments. If the intended department or version is unclear, ask for clarification or search a broader authorized set instead of silently excluding the right source.
For business systems, good metadata and filtering can provide more value than moving to a much larger LLM.
10. Keep document versions under control
This problem becomes important surprisingly quickly.
Imagine your knowledge base contains:
Travel Policy 2025
and
Travel Policy 2026
The old policy says:
Manager approval required above €500.
The new policy says:
Manager approval required above €300.
If both documents are retrieved, the language model may receive contradictory information.
A production knowledge base needs a strategy for:
- document versions
- expired documents
- superseded procedures
- duplicate files
Possible solutions include metadata such as:
valid_from
valid_until
version
status = current
The retrieval layer can then prioritize or restrict results to current documents.
11. Retrieval permissions matter
A business knowledge base should not assume that every user can access every document.
Imagine the same RAG system contains:
- general company instructions
- HR documents
- salary information
- management material
- customer contracts
Retrieval must respect access permissions before information reaches the language model.
The correct architecture is:
User permissions
→ filter accessible documents
→ retrieve information
→ send allowed context to the model
Not:
retrieve everything
→ ask the model not to reveal restricted information
Security should be enforced before generation.
The model should not be the access-control system.
Apply authorization to every retrieval path, including keyword search, reranking inputs, caches and source links. A department label alone is not an access policy. Test that unauthorized excerpts never reach the model or the user. Treat retrieved documents as untrusted data, not instructions that can override system rules.
12. Tell the model when not to answer
A good RAG system should be allowed to say:
I could not find enough information in the available sources.
This is extremely important.
Without this instruction, language models often try to be helpful even when the evidence is weak.
For knowledge-base use, a missing answer is often better than an invented one.
You can instruct the model to:
- answer only from supplied sources
- cite its sources
- distinguish facts from interpretation
- state when evidence is insufficient
- avoid filling gaps from general knowledge
This does not eliminate hallucinations.
But it establishes better behavior. Test unanswerable questions: an instruction alone does not guarantee abstention.
13. Require source citations
A useful answer might look like:
Travel expenses above €300 require approval from the employee’s manager before booking.
Source: Travel Policy 2026, Section 4.3
The important feature is not the citation format.
It is traceability.
The user should be able to:
- see the source
- open it
- verify the claim
This changes the interaction from:
Trust the AI
to:
Use the AI to find and explain evidence.
That is a stronger pattern for business use. A citation alone does not prove the claim is supported; check the cited passage and the user’s permission to open it.
14. Create a real evaluation set
You cannot reliably improve a RAG system by randomly chatting with it.
Create a test set.
For a small project, twenty questions may already be enough to learn a lot.
Each question should have:
- a known correct answer
- a known source document
- ideally a known relevant section
For example:
| Question | Expected source |
|---|---|
| What is the travel approval limit? | Travel Policy 2026 |
| How is error E47 resolved? | X200 Service Manual |
| Who approves emergency purchases? | Procurement Procedure |
| How long are customer records retained? | Data Retention Policy |
Now you can test the system repeatedly. Include exact identifiers, paraphrases, multiple document versions, questions with no answer and permission-boundary tests. A set of twenty is a pilot baseline, not proof of production reliability.
Method note: all device names, policies, thresholds and scores in this article are illustrative examples, not Latu Solutions benchmark results.
15. Measure retrieval separately
For every test question, ask:
Was the correct document retrieved?
Then:
Was the correct section in the top results?
Only after that ask:
Was the generated answer correct?
This distinction matters.
Imagine 20 test questions produce:
- correct source retrieved: 18/20
- correct answer: 14/20
This suggests retrieval is stronger than generation on this small test set. Check whether the retrieved passages contain all the evidence needed; finding the right document alone is not enough.
Generation or prompting may need work.
But if:
- correct source retrieved: 9/20
- correct answer: 8/20
the retrieval layer is the first target to investigate.
Record passage-level hit rate at a fixed result count, answer correctness, citation support, abstention on missing evidence, permission failures and response latency. Keep the same questions and scoring criteria between runs. Ragas lists separate retrieval and answer-quality metrics; manual scoring is enough to start. Automated evaluators may call external models, so check the data path before adopting one.
16. Build a failure log
When a question fails, record why.
Useful categories include:
- document extraction failure
- wrong chunk
- missing metadata
- semantic search miss
- keyword search miss
- outdated document
- conflicting documents
- permissions issue
- correct retrieval but bad generation
- insufficient source information
After 50–100 real questions, patterns begin to appear.
Those patterns tell you what to improve.
Without this data, RAG development easily becomes guesswork.
17. Do not optimize everything at once
A common mistake is changing:
- embedding model
- chunk size
- vector database
- LLM
- prompt
- retrieval count
at the same time.
Then the system improves.
But you do not know why.
Instead, establish a baseline.
For example:
Baseline
- 20 test questions
- correct source in top 5: 75%
- correct answers: 70%
Then change one major variable.
Test again.
Now you can tell whether the change helped.
This is much closer to engineering than simply trying different AI models until something feels better.
A practical improvement ladder
A useful progression is:
Level 1 — Establish a safe, measurable baseline
- one document collection
- basic extraction, chunking and embeddings
- vector search and a local model
- visible source citations
- a small evaluation set
- access controls before shared use
Evaluation and permissions belong at the start, not at the end.
Level 2 — Improve document processing
Fix text extraction, structure, metadata and chunk boundaries where tests show failures.
Level 3 — Add hybrid retrieval when needed
Combine semantic and keyword search if exact terms are being missed.
Level 4 — Refine relevance filters
Use product, version, date or document type where they help. Keep authorization enforced at every level.
Level 5 — Test reranking
Retrieve candidates and rerank them when the relevance improvement justifies the added latency and memory.
Retest after every change. Keep the architecture as simple as the workload allows.
Example: improving a technical manual assistant
Imagine the first version works like this:
Question
→ semantic search
→ top 5 chunks
→ local model
Users report that error codes are often missed.
Do not immediately replace the language model.
Instead:
Step 1
Add keyword search.
Step 2
Combine keyword and semantic results.
Step 3
Add metadata for:
- product
- firmware
- manual version
Step 4
Filter using those fields when they appear in the question.
Step 5
Only if necessary, add reranking.
The system may improve dramatically without changing the main language model at all.
Example: internal company policies
Suppose employees ask questions about:
- travel
- remote work
- purchases
- information security
The initial system retrieves both old and new policies.
The solution may not involve AI at all.
Add metadata:
status = current
and prevent obsolete documents from entering normal retrieval.
This illustrates a broader point:
Many RAG problems are information-management problems disguised as AI problems.
Clean data matters.
Small local models can still work well
A strong retrieval layer can also reduce how much the language model needs to know independently.
If the system gives a smaller model:
- the correct evidence
- concise context
- clear instructions
- structured sources
the model has a much easier task.
For many business knowledge-base workloads, improving retrieval may therefore be more valuable than buying hardware just to run a larger model.
This does not mean model quality is irrelevant.
It means the model is only one component.
What should remain local?
A privacy-oriented implementation can still keep the entire retrieval pipeline on infrastructure you control:
Documents
→ local parsing
→ local embeddings
→ local vector/keyword index
→ local reranking
→ local language model
→ local interface
No cloud model is required by the architecture itself.
But every added component should be checked.
A locally hosted language model does not make external embedding, OCR, reranking or analytics services local.
Always understand the entire data path.
What hardware does improved RAG require?
Basic retrieval is usually not the most demanding part of the system.
Your main language model will often consume significantly more compute and memory.
Embedding models can be relatively lightweight.
Keyword search can run efficiently on CPUs.
Vector-index memory depends on chunk count, vector dimensions, index type and metadata. Measure the full pipeline, including simultaneous users. Large embedding or reranking models can also compete with the chat model for limited VRAM.
Reranking adds additional compute, but it operates on a small candidate set rather than the entire document collection.
This makes RAG attractive for local AI:
you can improve answer quality without necessarily scaling the main language model.
A practical RAG quality checklist
Before blaming your model, check:
- Was the source document parsed correctly?
- Is the information inside a sensible chunk?
- Was the correct document retrieved?
- Was the correct section ranked highly?
- Would exact keyword search help?
- Can metadata narrow the search?
- Are old document versions excluded?
- Are permissions applied before retrieval?
- Did the model receive too much irrelevant context?
- Can the user verify the answer from a source?
If any of these fail, a larger language model may not solve the actual problem.
The business perspective
This matters because an internal AI assistant needs more than impressive demos.
Employees need to trust it.
That requires:
- relevant answers
- current information
- source traceability
- predictable behavior
- correct access controls
- measurable quality
A system that answers confidently but retrieves the wrong policy is worse than traditional document search.
A system that quickly finds the correct policy, shows the source and explains it clearly can provide real value.
That is the standard local RAG systems should aim for.
Continue learning
This article continues the Latu Solutions Local AI series.
In the previous article:
How to Build a Private Local AI Knowledge Base With Your Own Documents
we covered the basic architecture:
documents
→ chunks
→ embeddings
→ retrieval
→ local language model
→ cited answer
This article adds the next layer:
good retrieval
→ better evidence
→ more reliable answers
The next step is not necessarily adding more AI.
It is measuring whether the system actually works.
The practical answer
If your local RAG system gives poor answers, do not immediately download a larger model.
First inspect what the model received.
Improve:
document quality
→ chunking
→ metadata
→ hybrid search
→ filtering
→ reranking
where your test results identify the bottleneck. Start evaluation before changing the pipeline and keep permissions enforced throughout.
Keep the architecture as simple as the workload allows.
Measure retrieval independently from generation.
Require source citations.
And remember:
The best RAG system is not the one with the largest model. It is the one that consistently retrieves the right evidence.
Your AI. Your computer. Your data.
The Hardware Checker connection
Before changing models, check what your PC can run. The checker estimates model compatibility; it does not benchmark retrieval quality, complete RAG memory use or concurrent users.
For background, read Is Local AI Really Private? and explore the Local AI guide.
Ready to improve your document assistant?
Start with one document collection and twenty questions with verifiable answers. Record where retrieval fails before buying hardware or adding components.
Planning a private knowledge base for your business? Contact Latu Solutions to discuss a focused pilot.

