EN PL

Local LLM and RAG - Documents, Tests and Conclusions

Local model using retrieved document passages to produce an answer with sources

RAG in practice

I connected a local model to my own documents. I tested information retrieval and whether answers stayed faithful to the sources.

The trials showed that both the retrieved passages and their use in the answer need checking.

Who is this for? People using RAG to analyse procedures, security controls and GRC documents.

Tags: technical project / LLM and RAG Published: Updated: 11 min read

The problem: answers must be grounded in the document

I wanted to ask questions about my own documents and receive answers that preserved their content, conditions and exceptions. A source reference alone was not enough: the model could receive an incomplete passage or misuse the information available.

In an access management procedure, omitting a condition can change the meaning of a recommendation. Even a simple question about a control name requires an exact match, rather than a similar entry. I therefore needed to assess retrieval separately from faithfulness to the source.

ISMS documents and procedures are demanding material for RAG: omitting a condition, exception or responsibility can change the meaning of an answer. Running locally can limit the transfer of content outside your own environment and increase control over data. Confidentiality still depends on service configuration, access and data storage.

The trials aimed to locate the source of errors and assess whether additional configuration delivered a benefit worth maintaining.

RAG - brief definitions

The goal was an answer faithful to my own document. RAG supplies selected passages to the model; these need to be assessed alongside the answer.

ConceptMeaningIn this project
RAGRetrieving material and adding it to the question before generating an answer.A custom implementation, followed by Open WebUI RAG.
ChunkA section of a document prepared for retrieval, such as several entries from a list of controls.Lists of entries and headings; I checked what reached the context.
EmbeddingA numerical representation of text used for similarity search.Part of document indexing.
QdrantA database that stores vectors and supports searching them.Used in the first implementation with a custom importer.
Hybrid searchCombines semantic matching with keywords.Enabled in the settings of the later series.
RerankingReordering retrieved passages to rank those that better match the question higher.Configured in Open WebUI; a settings entry alone does not prove that the model ran.
GraphRAGA RAG approach using a graph of relationships between information.Not tested.
Model fine-tuningAdditional training that changes model parameters. A separate method, not a RAG retrieval stage.Not tested.

Solutions tested

I served the model through LM Studio and used Open WebUI for conversations. I tested two ways of supplying documents: a custom Qdrant integration and the RAG functionality built into Open WebUI.

Custom importer and Qdrant

The importer prepared chunks and embeddings, while an API intermediary exposed search. I checked imports, search results and answers to questions about an IAM procedure.

Document and question flow with the custom importer
RAG scope diagram: document ingestion and question handling. Arrows represent data flow, not the distribution of services across hosts.
Build stage · Qdrant collections
Qdrant collections used in successive import variants
Historical collections show successive import variants. Changes in chunk counts document how the material was divided, not answer quality. Click the image to open it at full size.
Improvement stage · custom importer
Custom document importer interface for RAG tests
The revised importer supplied more complete exception conditions. Even then, the final answer still needed a completeness check. Click the image to open it at full size.

RAG within Open WebUI

I then simplified document handling by using Open WebUI. This reduced the maintenance of custom integration code. I continued to assess retrieval and answer quality separately.

Document and question flow in Open WebUI
Open WebUI RAG diagram. Selected passages and the question reach the local model through LM Studio.
Open WebUI knowledge bases
Test stage · Open WebUI knowledge bases
Separate Open WebUI knowledge bases with test materials
I organised test materials into separate knowledge bases to check different ways of supplying a document to a conversation. Click the image to open it at full size.

Test methodology

The tests used Polish questions and documents. Screenshots preserve the original evidence; English wording in this article is explanatory, not a separate English-language test run.

This is a case study, not a model ranking. The first stage covered integration and an IAM procedure. In later trials, I used a short list of controls with unambiguous reference answers.

  • Document: an original list of 93 control names in four groups, using unofficial Polish translations. It is neither the full standard nor an implementation guide.
  • Question about an entry: the exact identifier and name of the control concerning the use of cloud services. The expected answer was A.5.23 and the name given in the list.
  • Question about structure: the four groups, their counts and whether the material contains implementation instructions. Expected: A.5: 37, A.6: 8, A.7: 14, A.8: 34, and no such instructions.
  • Conversation history: I started each trial in a new chat, without previous questions, answers or corrections. I did not compare these results with a conversation containing history, so I cannot assess whether retaining it would improve or worsen the answers.
  • Checks: the correct passage supplied directly, a limit change followed by a return to its previous value, and the original list compared with a version using ### headings.
  • Evidence: the source text, visible retrieved passages and final answer. The interface's thinking text was an additional trace, not proof of correctness.

Limitations: individual diagnostic trials, incomplete logs of effective settings and no complete record of every request. The sources panel does not prove that the whole document was read. I do not calculate an overall success rate or claim hardware superiority.

Changes to questions and parameters do not constitute a fully controlled experiment. I describe improvement after a change as an observation, not automatically as its effect.

Technical details and results

How I assess an answer

  • Entry selection: A.5.23 and the exact name in the material. Selecting another entry is a substantive error.
  • Identifier precision: “23.” is the list item number. “23. A.5.23” identifies the right entry but fails the exact-identifier requirement.
  • Completeness: a question about groups requires all four groups and the correct counts.
  • Faithfulness to the source: an unsupported additional claim is an error even if the main answer is correct. Without a full reading, claims about the whole document are not justified.

I describe results against these criteria without calculating an aggregate score.

Environment and settings

ItemTest record
EnvironmentLM Studio and Open WebUI; the earlier implementation used a custom importer and Qdrant. A laptop with an RTX 4060 Laptop GPU, 8 GB VRAM, and supporting services running on Linux.
ModelsEarlier document trials: Qwen2.5-7B-Instruct. The later control-list series: Qwen3-8B, GGUF Q4_K_M, context 16,384. Unless noted otherwise, the table reports this later series. This is not a model comparison.
Document splittingSettings: 1,000 characters, overlap 100 (100 characters shared between adjacent chunks). Embedding: all-MiniLM-L6-v2.
RetrievalFull-context mode (supplying the entire document rather than selected passages) off; hybrid search on. Top K = 5; Top K Reranker, a parameter related to the result limit during reranking, changed 3 → 5 → 3; relevance threshold = 0.
RerankerThe model field contained BAAI/bge-reranker-v2-m3. Without a complete execution trace, I do not attribute the results solely to this model.
Missing dataThe temperature of every conversation and the full context of every request were not confirmed. The interface's thinking time does not measure the entire process.

How to run a similar small test

  1. Define the reference answer. Choose a document and a question with an unambiguous answer. Record the required information and claims the source does not support.
  2. Keep a record. Save the question, settings, retrieved passages and answer. Mark anything you could not verify.
  3. Separate the causes of error. First check whether the required content was retrieved, then whether the model used it correctly.
  4. Change one element. Repeat the same question in a new conversation. If results improve, perform a check such as returning to the previous value. One success does not establish consistent reliability.

Below are a question and a list excerpt for a reading test. A retrieval test requires uploading the full document.

Detailed test record

All trials below used Qwen3-8B and question P1. Baseline settings are listed above. Full model requests and independent confirmation of every setting for each trial were not retained.

P1: Based on the supplied list, provide the exact identifier and name of the control concerning the use of cloud services. Do not add implementation guidance. If you cannot access the list, state this.

The question comes from the test protocol; it is not visible in every answer screenshot. The wording above is an English translation of the Polish test question.

Trial and configurationVisible passagesAnswer and assessment
R-P1-01
Original list, baseline
A.8.1–23, A.6.1–8, A.5.1–20. A.5.23 absent from the panel.A.5.20. Incorrect entry selected.
D-R-01
Top K Reranker 3 → 5, as reported by the operator
Five passages. The first: A.5.20–35, containing A.5.23.A.5.23 and the correct name. Correct answer.
D-R-RETURN3-01
Return to 3 according to the protocol; no settings screenshot
Three passages matching the first three from D-R-01. A.5.23 available.“23. A.5.23”, correct name. Correct selection, identifier precision error.
D-STRUCT A/B
Original / ### headings; unchanged settings according to the protocol
A: panel not supplied. B: separate headings A.5.23, A.8.21, A.7.4.A: correct identifier and name. B: correct entry, but “23.” added to the identifier. No improvement demonstrated.
Sample material for your own trial

The original Polish test excerpt below uses my own translations, not official wording from the standard:

19. A.5.19 Bezpieczeństwo informacji w relacjach z dostawcami
20. A.5.20 Uwzględnianie bezpieczeństwa informacji w umowach z dostawcami
23. A.5.23 Bezpieczeństwo informacji przy korzystaniu z usług chmurowych

Expected answer: A.5.23 Bezpieczeństwo informacji przy korzystaniu z usług chmurowych. This excerpt tests reading information. It does not reproduce retrieval across the full list of 93 entries.

Working with documents

TrialObserved resultImplication
Required passage missingThe sources panels stopped A.5 at entry 20. In the RAG trial, the model selected A.5.20 instead of A.5.23.Retrieval was incomplete, and the model also guessed.
Counting groupsThe model reported three groups and counts of 20 and 23, despite headings stating 37 and 34. A.7 was not retrieved.Two issues: a missing passage and misuse of information already available.
More complete sourcesAfter retrieving the introduction and four headings, it correctly reported A.5 = 37, A.6 = 8, A.7 = 14, A.8 = 34.In this case, the answer matched the source.
Limit 3 → 5 → 3After the increase, A.5.23 appeared and the answer was correct. After returning to 3, the required passage was still retrieved.An increase in the limit alone was not confirmed as the fix.
### headingsBoth the original and the heading variant identified A.5.23. The heading variant returned individual entries; the original's sources panel was not retained for this pair.The retrieved material changed, but improved answer quality was not demonstrated.
Identifier precisionIn some answers selecting the correct control, the model returned “23. A.5.23”.The entry was correct, but its list number was incorrectly included in the identifier.
“Search the entire document”The model identified the entry and added claims about the remaining content. There is no evidence of a full reading.The instruction does not establish that the entire document was searched.
Evidence: incorrect and correct answers about groups
Earlier answer with three groups and incorrect counts
Earlier trial: the model treated the visible passages as the entire list.
Later answer with four groups and correct counts
Later trial: the panel contained the introduction and headings for all groups. This compares cases, rather than isolating the effect of one parameter.

Earlier integration trials

EventResult and significance
Context limit exceededA request of 17,330 tokens against a 16,384 limit returned HTTP 400. Successful request execution must be established first.
IAM procedureAfter importer changes, a more complete passage on exceptions appeared in search results, but the answer still omitted important conditions.

Changes and their effects

ChangeEffectRemaining issue
Simpler integrationMoving to Open WebUI RAG reduced maintenance of the custom importer and intermediary.Answer quality still required testing.
Inspecting retrieved passagesThis distinguished the absence of A.5.23 from misinterpretation of headings.A correct passage alone does not prevent unsupported additions.
Changing the list structureIndividual entries were visible in the sources panel of the heading variant.No answer-quality advantage demonstrated; the identifier error remained.

I do not treat the K change as a confirmed fix. The collected trials also did not establish a need to change the embedding model. Any further change should address a specific, reproduced error.

Lessons from testing

  • I check three things separately: whether the request executed, whether the right data was retrieved, and whether the answer preserved its meaning.
  • I distinguish “not found” from “does not exist”. The selected passages limit what can be claimed about the entire document.
  • I check exceptions and conditions. In the IAM procedure, omitting a condition changes the meaning of the answer even when the retrieved passage is relevant.
  • I do not judge success by the number of sources. One document can supply several passages, and a correct reference does not prove a correct conclusion.
  • I use small diagnostic tests. Returning to the previous value and checking with the correct passage provided more insight than further arbitrary tuning.

Conclusions from my project

Key findings

I tested whether a local model could retrieve and correctly use information from documents. Errors occurred both in retrieval and in interpreting available content. The practical lesson is to assess the source, retrieved context and final answer separately. Increasing the result limit alone was not confirmed as a fix.

The right passage is a prerequisite for a good answer, not a guarantee. The trials showed both retrieval gaps and omissions of information already present in the context. I therefore check the document, retrieved passages and answer as separate stages.

For my use case, I chose simpler document handling in Open WebUI. This was a decision about integration maintenance costs, not a general assessment of Qdrant or proof that one architecture is superior.

I did not establish that increasing K or adding headings alone improves answers. I did demonstrate specific cases of faithful reading when the necessary content was supplied. For GRC tasks, I still check important conditions directly in the source.

Scope of use at this stage: the trials did not establish that the tested solution reliably preserves document content, including conditions and exceptions. I treat it as an aid to finding information, not a standalone basis for access, risk or compliance decisions. Before using an answer, I check it against the source. This conclusion concerns the described environment and trials, not all RAG solutions.

Implications for information security and GRC

  • Problem: an answer can sound credible despite incomplete context or an omitted condition present in the source.
  • Risk: using such an answer without checking it can lead to an incorrect decision or compliance assessment.
  • Requirements: verify conditions and exceptions in the document before deciding. Retain the question, source version, settings, retrieved passages and answer as a verification record, marking missing data. A record of passages alone does not prove answer correctness or a search of the entire document.

My observations and other research

The following publications provide a reference point, not independent confirmation of my environment's effectiveness. I refer to the specified preprint versions.

PublicationConnection to my trialsLimits of the comparison
AquiLLM, version 3The authors describe greater reliability in direct retrieval than in synthesis and resolving ambiguity. My observed omissions and unsupported additions are consistent with the need to assess faithfulness separately.A different domain, environment and methodology. I did not reproduce the study or compare numerical results.
Faithfulness-QA, version 2The paper proposes data for testing whether a model follows its context when it conflicts with learned knowledge. Faithfulness to the source also mattered in my trials.I did not use this dataset or controlled entity substitutions. Questions about the control list do not reproduce that method.

Conclusion: the observations support the need to check answer faithfulness. They do not confirm the effectiveness of training methods, architectural superiority or the scale of effects reported by others.

Sources and documentation

The results are based on my own test materials, screenshots and invocation records from October 2026. The documentation below describes the tools; it does not replace evidence of an individual trial's execution.

Questions and answers

Does RAG guarantee a correct answer?

No. In these trials, errors resulted both from missing passages and from interpreting content that had been retrieved.

Did increasing K solve the problem?

Improvement followed the change but persisted after returning to the lower value. I did not confirm the effect of the limit alone.

Did adding a heading to every entry help?

In the comparison, both variants identified A.5.23, the control concerning cloud services. The heading variant returned individual list entries, but the model added the list number “23.” to the identifier. Improved answer quality after adding headings was not demonstrated.

Is asking to search the entire document sufficient?

It does not prove a full reading. Check which passages were actually supplied to the model.

Why did I simplify the solution?

Built-in RAG reduced maintenance of the custom importer and intermediary. It did not remove the need to check answers.

How can I start a small test?

Choose a document and a question with a known answer. Save the retrieved passages and answer. Change one element and perform a check that addresses a specific hypothesis.

Was this project useful?