Home / use case

A private document assistant on Ollama with Qwen3 1.7B that says when the answer isn't there

At a glance
Models & engines
qwen3:1.7b in Ollama writes the answers
nomic-embed-text in Ollama handles search
The only network traffic goes to Ollama on 127.0.0.1:11434
Key gotcha
In all three misses, search found the right text and the 1.7B model fumbled the answer, so read the cited source before you trust the answer text

What they built

Mike Dufour wanted to see how far a small local model gets on a plain job: answer questions from a folder of documents, cite the source, and say "Not in the documents." when the answer isn't there. Nothing was allowed to leave the machine.

The result is three Python scripts that use only the standard library, plus two models in Ollama: qwen3:1.7b writes the answers and nomic-embed-text handles search. The code, test questions and every answer from the last run are on GitHub.

The test corpus is the OWASP Top 10 for LLM Applications 2026 plus the README of the author's own security scanner. He pitches the setup at law firms, accountants and other small offices that hold files they won't paste into a cloud chatbot.

Setup

  • qwen3:1.7b in Ollama writes the answers
  • nomic-embed-text in Ollama handles search
  • Three Python scripts, standard library only: ingest.py, ask.py, eval.py
  • The only network traffic goes to Ollama on 127.0.0.1:11434

How it works

  1. ingest.py splits each markdown file at headings and paragraphs into chunks of about 800 characters, embeds them and writes index.json
  2. ask.py embeds the question, takes the 4 most similar chunks by cosine similarity and asks the model to answer only from those excerpts and cite their numbers
  3. If the best chunk scores below a threshold, or the model says the excerpts don't contain the answer, it prints "Not in the documents." and stops
  4. eval.py asks 20 questions the documents answer and 5 they don't

Results & numbers

  • Indexing 230 chunks from 11 files took about 10 seconds
  • 17 of 20 answerable questions came back with the right source and an expected keyword
  • All 5 unanswerable questions were refused
  • Search alone put the expected file in the top 4 chunks for all 20 answerable questions
  • With the model already loaded, a question took about 0.5 to 0.7 seconds

Gotchas

  • In all three misses, search found the right text and the 1.7B model fumbled the answer, so read the cited source before you trust the answer text
  • The similarity threshold (0.642) was set on the same 25 questions that are scored, so the refusal record will look better than on new questions
  • The score moves by a question or two between runs; an earlier run of the same code got 18 of 20
  • It reads English markdown only, so PDFs and tables are out for now
  • There is no access control or per-user separation: it is a single-folder, single-user proof
“In all three cases search found the right text and the 1.7B model fumbled the answer.”— Mike Dufour

Do it yourself

  1. Install Ollama and pull qwen3:1.7b and nomic-embed-text
  2. Put your markdown files in one folder
  3. Run python3 ingest.py to chunk, embed and write index.json
  4. Ask with python3 ask.py "your question"
  5. Run python3 eval.py --calibrate on your own test questions to set the refusal threshold
python3 ingest.py
python3 ask.py "What is Denial of Wallet?"
python3 eval.py --calibrate
Source: DEV Community (Mike Dufour) · Published 2026-12-03 · Added 2026-12-04. This write-up summarizes the original source; see it for full details.

Similar setups

MapNet: permission-aware local RAG over your folders on a CPU laptop with Ollama

Gal built MapNet, an MIT research prototype that keeps a live map of folders, files and sections so a small Ollama model only reads the few passages it needs, and published where it loses to embedding everything.

Gal on X · 2026-11-15

Company Brain: a private consultancy RAG on a 16 GB MacBook Air M4 with Ollama and Open WebUI

Ángeles Hernández Acosta’s KeepCoding final project runs Qwen3.5-4B via Ollama on a 16 GB MacBook Air M4, answers only from local documents with citations, and scored 16/22 on a locked final exam run on 6 November 2026.

GitHub · 2026-11-06

A CPU-only PDF question-answering API with Ollama, Qwen2.5 1.5B and ChromaDB

A developer who wanted to keep documents inside the private network built a small RAG app on a PC with no active GPU: PDFs are indexed into ChromaDB and a local FastAPI endpoint answers questions with Qwen2.5 1.5B on Ollama.

DEV Community (RafterKode) · 2026-12-03

A local news-reading agent on Ollama that loses internet access while it thinks

A developer built News Scout, a Qwen3 14B agent on Ollama that picks IT stories from five RSS feeds, then split each run so the model reads the cached feeds inside a macOS sandbox with no internet.

DEV Community (MediBlackSand) · 2026-12-03