Home / use case

A CPU-only PDF assistant that cites the page and refuses to guess

At a glance
Hardware
Standard Linux server, CPU only, no GPU
Models & engines
PDF parsing and OCR: PyMuPDF + pdfplumber + RapidOCR (ONNX, CPU)
Embeddings: FastEmbed with BAAI/bge-small-en-v1.5 (384-dimensional vectors) on ONNX Runtime
LLM: Ollama with qwen2.5:3b at temperature 0.0
Key gotcha
Dumping raw PDF text and slicing every 800 characters gave rough answers: tables turned into scrambled words and sentences were cut mid-thought.

What they built

Sujith Ravikumar, a cloud engineer, built his first end-to-end AI application: a focused assistant that answers questions strictly from local technical reference manuals instead of a general-purpose chatbot.

The goal was to stop engineers hunting through dense multi-page PDFs with Ctrl+F. Every answer cites the exact source file and page number so it can be checked, and the assistant says "I don't know" when the answer isn't in the documents.

He set two hard constraints from day one: zero external cloud APIs, so documents and queries stay inside the server, and CPU-only execution on standard Linux compute with no dedicated GPU.

Setup

  • Standard Linux server, CPU only, no GPU
  • PDF parsing and OCR: PyMuPDF + pdfplumber + RapidOCR (ONNX, CPU)
  • Embeddings: FastEmbed with BAAI/bge-small-en-v1.5 (384-dimensional vectors) on ONNX Runtime
  • Vector store: local persistent ChromaDB
  • LLM: Ollama with qwen2.5:3b at temperature 0.0
  • Serving: FastAPI + Uvicorn + systemd behind a reverse proxy

How it works

  1. PDFs are split into 800-character chunks with a 120-character overlap; grid tables are converted to Markdown pipe tables before chunking, and every chunk keeps its page_number metadata.
  2. Before calling the LLM, the retriever checks the top vector match: if it scores below 0.70 cosine similarity, the pipeline stops and returns a fallback message.
  3. Chunks that pass are wrapped in explicit context boundaries with a prompt that tells the model to answer only from the context and reply only with INSUFFICIENT_EVIDENCE if the answer isn't there.
  4. The embedding model and vector index load once at FastAPI startup so queries don't pay cold-load costs, and a /health dashboard shows service health, indexed chunks, active models and retrieval vs. generation latency.

Results & numbers

  • He calls it an honest v1 pilot: it handles single-turn, cited technical questions reliably and serves concurrent queries in roughly 1.5 to 4 seconds on CPU.
  • When asked a question not covered by its documents, it checked its similarity score and refused to guess.

Gotchas

  • Dumping raw PDF text and slicing every 800 characters gave rough answers: tables turned into scrambled words and sentences were cut mid-thought.
  • Even with a strict system prompt, compact models still try to guess when a question shares keywords with an indexed manual, which is why the similarity gate runs before the LLM.
  • Not done yet: hybrid keyword search for error codes and part numbers, multi-turn memory and token streaming.
“practical AI isn't magic—it's good data pipelines, sensible guardrails, and solid systems engineering.”— Sujith Ravikumar

Do it yourself

  1. Install Ollama on a Linux server and pull qwen2.5:3b.
  2. Extract each PDF with PyMuPDF and pdfplumber, run RapidOCR for images, and convert tables to Markdown.
  3. Chunk at 800 characters with 120 overlap, keeping the page number on every chunk.
  4. Embed the chunks with FastEmbed (bge-small-en-v1.5) into a persistent local ChromaDB.
  5. On each question, stop with a fallback if the top match scores below 0.70; otherwise send the chunks to qwen2.5:3b at temperature 0 with a context-only prompt that returns INSUFFICIENT_EVIDENCE when unsure.
  6. Serve it with FastAPI and Uvicorn under systemd, loading models once at startup.
Answer the <question> using ONLY the facts inside <context>.
- Do not use outside knowledge or guess missing values.
- If the context does not contain enough information, reply ONLY with: INSUFFICIENT_EVIDENCE
Source: DEV Community (Sujith Ravikumar) · Published 2026-11-19 · Added 2026-11-21. This write-up summarizes the original source; see it for full details.

Similar setups

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

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

Hearth: a household assistant on Ollama, and proving nothing leaves the house

Hearth answers family questions from manuals and papers with citations, handles voice, notes and reminders, and runs on one home computer; its builders tested small models, prompt injection, and three ways of proving no data leaves.

DEV Community (WeekendAiProjects) · 2026-11-23

A local contract and invoice agent whose citations are checked by code

Gonzalo Blasco built a laptop-only agent that answers questions about contracts and invoices and only accepts a citation if its quote literally appears in the retrieved chunk; Gemma 4 12B got 18 of 18 of his test questions right.

DEV Community (Gonzalo Blasco) · 2026-11-21