Home / use case

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

At a glance
Models & engines
PC with no active GPU, Ollama in CPU-only mode
Ollama 0.40.16 installed with the official script as a systemd service
qwen2.5:1.5b, about 986 MB
Key gotcha
With no GPU detected, Ollama warns that it will run in CPU-only mode

What they built

RafterKode has been interested in LLMs that can be installed locally, with the goal of controlling the data provided and keeping it from spreading outside the private network. This first RAG project is the result.

The PC has no active GPU, so Ollama runs in CPU-only mode. The author picked Qwen2.5 1.5B (about 986 MB) because only French and English are needed.

An ingest script turns PDFs into text, chunks and embeddings stored in a local ChromaDB database, so documents don't have to be reprocessed every time. A FastAPI app then answers questions about the indexed documents on 127.0.0.1.

Setup

  • PC with no active GPU, Ollama in CPU-only mode
  • Ollama 0.40.16 installed with the official script as a systemd service
  • qwen2.5:1.5b, about 986 MB
  • Python venv with fastapi, uvicorn, chromadb, pymupdf and requests

How it works

  1. Indexing: PDF → Text → Chunks → Embeddings → ChromaDB
  2. app/ingest.py indexes the files in documents/ and stores them in database/
  3. app/api.py serves an /ask endpoint with uvicorn on 127.0.0.1:8000
  4. Ollama is limited to one loaded model, no parallel requests, a 2,048-token context, and unloads the model after use

Results & numbers

  • A POST to /ask returns JSON with the question, the generated answer, the source documents and the page numbers

Gotchas

  • With no GPU detected, Ollama warns that it will run in CPU-only mode
  • The context length is capped at 2,048 tokens to save RAM
  • Dependency versions are not pinned because this is a local environment, not production
“My PC does not have an active GPU, so my LLM will run exclusively on the CPU.”— RafterKode

Do it yourself

  1. Install Ollama with curl -fsSL https://ollama.com/install.sh | sh and check it with ollama --version and systemctl status ollama
  2. Run ollama pull qwen2.5:1.5b
  3. Add the memory settings with sudo systemctl edit ollama, then daemon-reload and restart
  4. Create a venv and install fastapi, uvicorn, chromadb, pymupdf and requests
  5. Put PDFs in documents/ and run python app/ingest.py
  6. Start uvicorn app.api:app --host 127.0.0.1 --port 8000 and POST a question to /ask
[Service]
Environment="OLLAMA_MAX_LOADED_MODELS=1"
Environment="OLLAMA_NUM_PARALLEL=1"
Environment="OLLAMA_CONTEXT_LENGTH=2048"
Environment="OLLAMA_KEEP_ALIVE=0"
Source: DEV Community (RafterKode) · Published 2026-12-03 · Added 2026-12-03. This write-up summarizes the original source; see it for full details.

Similar setups

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

A cloud engineer built a question-answering service over technical PDF manuals that runs entirely on a standard Linux server with no GPU, using Ollama with qwen2.5:3b, and answers only from the documents with file and page citations.

DEV Community (Sujith Ravikumar) · 2026-11-21

A private OpenAI-compatible LLM API on an AMD GPU with llama.cpp

A Vietnamese developer's notes on building llama.cpp for AMD cards, choosing between Vulkan and ROCm, and running llama-server as a locked-down systemd service that existing OpenAI SDK code can call.

DEV Community (EME GUG) · 2026-11-27

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

Gist: an offline exam-prep partner that mines past papers with Ollama

A student built Gist so a friend could study from lecture PDFs and three-plus years of past exam papers without uploading copyrighted course material anywhere; parsing, embeddings, search and the LLM all run on the laptop with Wi-Fi off.

DEV Community (Hacktoberfest Build for a Friend) · 2026-10-20