AI-Powered Knowledge Retrieval
I run a locally hosted AI system called Mun, built around my own collection of books, manuals, reference material and technical discussions. The aim is to have an assistant that can search those resources and use the information it finds to support its responses, rather than relying exclusively on what the language model already knows.
The setup combines local language and embedding models, document ingestion, a searchable knowledge database, illustration retrieval, web searching and a dedicated administration portal. Since the original build, I have expanded the knowledge library with Stack Exchange datasets, separated active data from archival storage and made a number of changes to improve the speed and responsiveness of the system. Here’s a look at how everything fits together.
The system runs on a dedicated headless Linux Mint machine equipped with:
- Intel Core i7-4790K.
- 32 GB of system memory (approximately 31 GiB usable in Linux).
- NVIDIA GeForce GTX 1070 with 8 GB of VRAM.
For local model management, I use LM Studio. My current models are:
- Qwen 3.5 4B Q8_0: handles conversational AI and response generation.
- Nomic Embed Text v1.5: converts text into numerical embeddings for semantic searching.
The document ingestion system is a custom browser-based application called Ingestion Management. I use it to upload reference material, assign subject categories, analyse documents and monitor processing jobs. It accepts PDFs, EPUBs, XLSX spreadsheets, CSV files and several text-based formats, including TXT, Markdown, JSON and LOG files.
Different file formats need different treatment. Ordinary text can be extracted and divided into searchable passages, while PDFs may contain tables, scanned pages and illustrations. Spreadsheets require their rows, columns and cell references to be preserved so their contents remain understandable.
The application prepares the extracted material as chunks and sends it to Nomic Embed Text v1.5. The resulting text, vector embeddings and metadata are stored in ChromaDB, using the mun_knowledge collection. Original source documents are retained, and the processing jobs include duplicate checks, progress reporting, cancellation and rollback handling.
A separate collection, mun_images, stores searchable descriptions and references for supported illustrations. This means the knowledge library can contain both ordinary document passages and material that can be retrieved visually.
PDFs are ingested directly using a page-aware extraction pipeline. Mun reads native text, identifies supported tables and retains page information so that retrieved passages can be traced back to the original document. When tables can be detected reliably, their rows and columns are represented separately from the surrounding text.
The pipeline also uses Tesseract OCR for pages containing little or no selectable text. Mun checks whether such pages contain visible material and automatically runs OCR where appropriate. Pages with usable native text don’t require OCR, and apparently blank pages can be skipped. The recovered text is included in the knowledge library with its page reference and an indication that OCR results are unverified.
This allows a single PDF to contain native text, scanned content and structured tables without requiring a separate file-conversion step. The original PDF remains available as the source for page references and illustration retrieval.
Mun also processes XLSX and CSV files. For Excel workbooks, the extractor reads worksheet names, populated cells, formula expressions and cached calculation results. It preserves cell coordinates and identifies groups of information within worksheets, including tables and calculation areas arranged alongside one another.
The ingestion interface includes a spreadsheet preview that shows the extracted regions and proposed RAG chunks. This is useful for checking how a complicated worksheet will be represented before it is added to the knowledge library. CSV files are parsed with their row and column structure in mind rather than treated simply as a block of unformatted text.
Stored formula results are not recalculated by the ingestion application, so they are treated as cached values rather than independently verified calculations. The aim is to make structured information searchable while retaining enough of its original context to interpret it sensibly.
A separate image pipeline makes supported illustrations searchable alongside text. EPUB files can provide embedded illustrations with nearby headings and captions, while PDFs can provide captioned raster figures with page references.
For each indexed illustration, Mun records descriptive context and creates an embedding from that text. The resulting image records are stored in mun_images, independently of the main text collection. This is caption- and context-based retrieval rather than a model visually analysing every image.
The image files themselves do not need to be permanently duplicated in a separate repository. Mun retains a reference to the original EPUB or PDF and serves the requested illustration directly from that document when it is needed. This helps keep storage usage manageable while making diagrams and figures available with relevant answers. Uncaptioned illustrations and some vector-only diagrams are not always detected.
Alongside my own documents, Mun now searches locally indexed material from Ask Ubuntu and Super User. Each site has its own ChromaDB collection, separate from the document and illustration indexes. Original compressed archives, structured SQLite databases and ingestion checkpoints are retained so I can inspect the imported data or rebuild the indexes later.
When I ask a question, Mun searches the active text collections using a single question embedding. The returned passages are ranked together by semantic distance, rather than reserving a fixed number of results for each collection. Up to five local passages are selected, subject to relevance and discussion-diversity limits. Community citations link directly to the original question or answer where recognised.
This gives the system access to a larger body of technical knowledge without training a new model. As with any community-sourced information, the original answers can be outdated or incomplete, so I still check the cited material before applying important advice.
The system uses Retrieval-Augmented Generation (RAG) to connect the language model to my knowledge library. When I submit a question, my retrieval API starts two operations concurrently. One searches the web through SearXNG, while the other creates a query embedding and searches ChromaDB for semantically related text from documents and the imported Stack Exchange collections.
Once both searches have finished, the API combines up to six web results and five local passages with the conversation history and sends that context to Qwen through LM Studio. The selected reasoning mode determines whether the model performs internal reasoning before producing its answer.
As the answer is generated, the API forwards the text to Open WebUI and resolves individual citation markers against the retrieved source metadata. Relevant illustrations can be appended afterwards. If one retrieval operation fails, the other can still provide context. The language model itself is unchanged by adding documents or importing community knowledge.
One of the main challenges with running a language model on older hardware is the amount of time spent processing the prompt and generating a response. I have been working on both the inference configuration and the application surrounding the model, rather than simply trying to reduce the amount of information available to it.
Increasing the evaluation and physical batch sizes from 512/128 to 2048/2048 reduced median prompt-processing latency by approximately 19.7% on average across four tested prompt lengths. For a prompt of roughly 16,400 tokens, the measured time to first token fell from 73.1 seconds to 58.8 seconds. Native prompt caching also works, although experiments with reorganising the RAG prompt and changing checkpoint spacing did not produce a useful improvement.
The original chat API waited for Qwen to finish the entire answer before returning it to the interface. Mun now forwards answer tokens as they arrive. In one virtual-memory test, the first answer appeared after 23.4 seconds of inference, with the response finishing after 46.2 seconds. That illustrates the benefit of streaming, rather than a reduction in raw model generation time.
I have also added three selectable modes to Open WebUI:
- Auto: uses local keyword and length rules to select a reasoning mode.
- Fast: disables internal reasoning for direct responses.
- Think: enables internal reasoning for more involved tasks.
All three use the same model and retrieval pipeline. In a comparison using the same question about Docker and virtual machines, Fast began answering in 9.6 seconds and Think in 24.7 seconds after inference began. Auto selected Fast for that question. These were individual observations, not a controlled answer-quality comparison. Reasoning can still be useful for complex work, and Auto is deliberately a simple heuristic rather than another model.
Web and local retrieval now overlap as well. Across three test requests, concurrent retrieval averaged 1.065 seconds, compared with an estimated sequential average of 1.245 seconds. The absolute saving is small, but it requires no reduction in source counts or ranking quality. Recognised background title and tag requests also bypass retrieval and reasoning entirely, reducing unnecessary work and keeping those prompts out of the web-search pipeline.

For the conversational interface, I use Open WebUI, connected to my custom retrieval API. This provides a familiar chat interface while keeping the document-searching and response-generation logic under my own control.
A separate administration portal provides monitoring and system management. It includes resource usage, model logs, service status and controls, database statistics, document searching, and dedicated Help and Documentation pages.
The Ingestion Management interface handles document uploads, suitability analysis, spreadsheet previews and processing jobs. It also provides storage reporting and a downloadable knowledge inventory in CSV format. The inventory includes document titles, categories and file sizes, along with the number of indexed text chunks and whether each document has searchable illustrations, including their image counts.
Together, these interfaces let me operate the system through a browser rather than relying on terminal commands for everyday tasks.
The model dropdown now includes the three reasoning aliases alongside the original model entry. I have also updated the systemd dependencies so that restarting LM Studio automatically restarts the ingestion and question-answering applications. This has been tested with all six monitored services responding successfully after the restart.
Each application has a specific responsibility. LM Studio runs the language and embedding models; Ingestion Management extracts and indexes reference material; ChromaDB stores searchable documents, community passages and illustration descriptions; SearXNG provides external web results; and my retrieval API coordinates concurrent searching, prompt assembly, reasoning selection and live response delivery. Open WebUI provides the chat interface, while the administration portal handles monitoring and management.
The language model and vector database run locally. Ordinary questions still pass through SearXNG, which may forward queries to external search providers, so the system is locally hosted rather than completely isolated from the internet.
What I find most interesting about this setup is how much more useful a relatively small local language model becomes when it has access to an independently maintained knowledge library. I can organise my own reference material, add public technical datasets, search everything by meaning and use it to support answers without depending entirely on the model’s built-in knowledge.
The combination of text, tables, OCR and indexed illustrations is particularly useful for technical books and manuals, where important information isn’t always contained in ordinary paragraphs. There are still limitations in retrieval, document extraction, grouped citation formatting and automatic reasoning selection, but the system gives me a practical, expandable AI environment running on hardware and software that I control. The recent performance changes have made it more responsive without requiring a new graphics card or a smaller model.