Intermediate 12 minDaily plan

Paperless-ngx and Ollama: organizing your documents

BestLLMfor — Paperless-ngx — Sort with Ollama

Paperless-ngx scans, OCRs, and files invoices, letters, and contracts; connecting Ollama to it adds title and tag suggestions, plus natural-language querying of your documents. This paperless-ngx ollama guide covers a setup where the model runs on the same machine, how to build the index, and above all where human review fits in: the AI suggests, you decide. It's based on the Paperless-ngx 3.4.0 documentation; the procedure was not reproduced for this guide, and no model output in it is presented as observed.

By Mohamed Meguedmi·Update 2026-12-06·Tested on Windows, macOS, and Linux

#Paperless-ngx and Ollama: what AI adds to document filing

Paperless-ngx can already classify without an LLM. Each document goes through OCR (OCRmyPDF and Tesseract), then a classic machine learning classifier, trained locally on your own documents, suggests the correspondent, type, tags, and storage path according to the matching rules (Auto, exact word, regular expression, etc.). This works well as soon as you have a few dozen documents already sorted by category, and it requires neither a GPU nor a language model.

The AI features described in the version 3.4.0 documentation (the AI section of docs/advanced_usage.md) add two things the classic classifier doesn't do: generating a readable title from the content, and answering a question about one document or across all indexed documents. The model can be served by Ollama, which lets you keep processing on your machine, provided you verify each link in the chain described below.

Suggestions
Title, tags, and other metadata suggested from the document text. These are suggestions shown in the interface for you to accept or ignore.
Document Q&A
A conversation about a single document or the indexed collection, following the RAG approach: relevant excerpts are retrieved through semantic search and then passed to the model along with the question.
What AI doesn't replace
OCR, the classic classifier, matching rules, and workflows all stay in place. A language model can get a date, amount, or correspondent wrong, so a human still needs to check before you rely on any metadata.

#Paperless-ngx version and prerequisites

The complete kit for building your own local RAG.

Benefit from our experience and a guided path to build your local RAG and work with your own documents.

  • Lifetime online access
  • PDF + files
  • Refunded within 30 days

AI features are a recent addition to Paperless-ngx, and their settings change from one version to the next. This guide follows the documentation frozen at tag v3.4.0 of the official repository. Before making any changes, note the version you actually have installed and read the documentation for that tag, not the main branch.

Terminal — check the installed version
# Depuis le dossier qui contient votre docker-compose.yml
docker compose images webserver

# La version figure aussi dans l'interface web (Paramètres, ou pied du menu latéral selon la version)
# Pour la figer, épinglez l'image au lieu d'utiliser :latest, par exemple :
#   image: ghcr.io/paperless-ngx/paperless-ngx:3.4.0
Paperless-ngx deployed with Docker Compose
The examples are based on the official Compose files, where the main service is named webserver. Adjust accordingly if you use a bare-metal installation.
Recent backup
Run an export with document_exporter and back up the volumes before changing the configuration. Suggestions don't change anything on their own, but an image update does.
OCR configured for French
PAPERLESS_OCR_LANGUAGE: fra if your documents are in French. The model reads only the extracted text: mediocre OCR yields mediocre suggestions.
Memory for the model
Rough guide at Q4_K_M: a 7B needs about 5 GB of VRAM, a 14B about 9 GB. A model with 8 to 9 billion parameters such as qwen3.5:9b falls between the two; a 12 GB RTX 3060 or a 24 GB Mac M4 Pro is enough for this size. Without a GPU, processing is still possible on the CPU, just more slowly.
Fictitious test documents
Three or four made-up PDFs (an invoice from a fictional supplier, a template letter) to validate the pipeline before running real documents through it.

#Step 1: Run Ollama alongside Paperless-ngx

Paperless-ngx runs in a container, so from its point of view, localhost means the container itself, not your machine. Ollama's default address, http://localhost:11434, therefore won't work as-is from Paperless. The cleanest solution is to add Ollama as a service in the same Compose file without publishing its port: only the project's containers can then reach it, at http://ollama:11434.

docker-compose.yml — service to add (excerpt)
services:
  ollama:
    image: ollama/ollama
    restart: unless-stopped
    volumes:
      - ollama:/root/.ollama
    # Pas de section ports : Ollama reste joignable uniquement
    # depuis le réseau interne du projet Compose.
    # GPU NVIDIA (nécessite NVIDIA Container Toolkit) :
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

volumes:
  ollama:
Terminal — start Ollama and download the model
docker compose up -d ollama
docker compose exec ollama ollama pull qwen3.5:9b
docker compose exec ollama ollama list

# Vérifier que le conteneur Paperless joint Ollama (200 attendu)
docker compose exec webserver python3 -c "import urllib.request; print(urllib.request.urlopen('http://ollama:11434/api/tags').status)"

If Ollama is already installed natively on the machine, you can keep it: the address to give Paperless then becomes the host's address as seen from the container (host.docker.internal under Docker Desktop, or an extra_hosts entry with host-gateway on Linux). In that case, Ollama must listen on an interface reachable by the container, which potentially exposes it to the local network as well: Ollama has no built-in authentication, so filter it at the firewall or use the Compose variant above instead.

!
Verify that the model is truly local
Ollama also offers "cloud" models whose inference runs on Ollama's servers rather than on your GPU (their names carry a cloud suffix). With such a model, your document text leaves the machine even if Paperless points to your Ollama. Check the exact model name with ollama list and ollama show avant specifying it in Paperless.

#Step 2: Enable Paperless-ngx AI with the Ollama backend

AI is disabled by default. You enable it through environment variables on the webserver service, described on the Configuration page of the documentation (docs/configuration.md for the same tag). Depending on the version, some settings can also be changed from the application configuration in the admin interface. The names below belong to the PAPERLESS_AI_ family: check them against the Configuration page for your version before copying them, because a typo in a variable name is silently ignored.

docker-compose.env or the environment section of the webserver service
# Activation des fonctions d'IA
PAPERLESS_AI_ENABLED: "true"

# Modèle de langage servi par Ollama, dans le même projet Compose
PAPERLESS_AI_LLM_BACKEND: "ollama"
PAPERLESS_AI_LLM_ENDPOINT: "http://ollama:11434"
PAPERLESS_AI_LLM_MODEL: "qwen3.5:9b"

# Modèle d'embeddings pour l'index (recherche sémantique)
# Valeurs admises et modèle par défaut : voir docs/configuration.md de votre version
PAPERLESS_AI_LLM_EMBEDDING_BACKEND: "huggingface"

# OCR en français, indépendant de l'IA mais déterminant pour sa qualité
PAPERLESS_OCR_LANGUAGE: "fra"
Terminal — apply the configuration
docker compose up -d
docker compose logs --tail=100 webserver
PAPERLESS_AI_LLM_BACKEND
Selects the language model provider. With ollama, requests go to the address set in PAPERLESS_AI_LLM_ENDPOINT. The other documented value targets an OpenAI-compatible API, which may be a remote service.
PAPERLESS_AI_LLM_MODEL
The exact model name as shown in ollama list, including the tag. A name that doesn't exist on the server causes an error when a suggestion is generated, not at startup.
PAPERLESS_AI_LLM_EMBEDDING_BACKEND
The model that turns documents into vectors for the index. The Hugging Face backend computes embeddings inside the Paperless container, but the model first has to be downloaded from the Hub: plan for that network access on first use, or a pre-populated cache if the machine is isolated.
Choosing the language model
A mid-size multilingual instruct model is enough to suggest a title and tags. A bigger model won't fix bad OCR, so start small and compare results on your dummy documents.

#Step 3: Build and maintain the document index

Document chat relies on a vector index that is separate from Paperless's full-text search index. It's built from each document's OCR text, which is split into chunks and then converted into vectors by the embedding model. Until this index exists and is up to date, chat can't retrieve the relevant passages.

  1. 01
    Initial indexing
    The documentation provides a management command for the AI features index (document_llmindex), with a full rebuild and an incremental update. In the Docker image, management commands are called directly by name via docker compose exec webserver. Display the help first to confirm which subcommands are available in your version.
  2. 02
    Scheduled update
    A scheduled task updates the index regularly; its frequency is set with a cron-style variable documented on the Configuration page (PAPERLESS_AI_LLM_INDEX_TASK_CRON). Between two runs, a newly added document may not be queryable yet.
  3. 03
    Rebuilding after changing the embedding model
    Vectors computed by two different models are not comparable. If you change PAPERLESS_AI_LLM_EMBEDDING_BACKEND or the associated model, run a full rebuild rather than an update.
  4. 04
    Monitor the duration
    On a large archive, the first run can take a long time, especially on CPU. Run it outside working hours and watch the worker logs; no reference duration is given here, since it depends on volume, hardware, and model.
Terminal — index commands (check the help first)
# Afficher les options disponibles dans votre version
docker compose exec webserver document_llmindex --help

# Reconstruction complète (premier passage ou changement de modèle d'embeddings)
docker compose exec webserver document_llmindex rebuild

# Mise à jour incrémentale
docker compose exec webserver document_llmindex update

#Step 4: title and tag suggestions, with human review

Once AI is enabled, suggestions appear in a document's detail view, in the same place as the classic classifier's suggestions. They aren't applied automatically: you click the ones you want to keep, then save. That's the behavior to preserve in your workflow, so avoid any automation that would accept suggestions without review.

  1. 01
    Flag incoming documents with an inbox tag
    Paperless-ngx lets you designate a tag as an inbox tag: it's applied to every new document. Use it as your “to review” queue instead of inventing a parallel workflow.
  2. 02
    Open the document and compare it with the file
    Read the title suggestion alongside the document preview, not just the OCR text. A date or amount misread by OCR can end up in the suggested title.
  3. 03
    Accept, correct, or ignore
    Keep only tags that already exist in your filing scheme. If the model suggests a new tag, check whether it duplicates an existing one ("Facture" and "Factures") before creating it.
  4. 04
    Remove the inbox tag
    This step records human approval: a document without this tag has been reviewed. A saved view filtered on the tag lists everything still waiting for review.
  5. 05
    Fix the rules instead of repeating corrections
    If you keep correcting the same thing, adjust the correspondent or document type matching, or create a deterministic workflow. The classic classifier also learns from your corrections when it's retrained.
→
Keep the two mechanisms separate
Let workflows and matching rules handle what's certain (a recognized sender, a dedicated consumption folder), and save AI suggestions for what requires reading: the title and topic tags. That way, when an error shows up, you'll know where each piece of metadata came from.

#Step 5: Query your documents in natural language

Chat lets you ask a question about an open document or about all indexed documents, for example "What is the end date of the Exemple SARL contract?". Paperless retrieves the closest chunks from the index, passes them to the model along with the question, and the model writes an answer. This is how a classic RAG works, with its strengths and limitations.

Verify the source
A fluent answer is not proof. Open the cited document and find the relevant sentence before acting on a due date or an amount.
Long documents
Only a few chunks are sent, and the context window configured on the Ollama side limits what the model reads. Information outside the selected chunks can be ignored without warning.
Index lagging behind
A document added after the last update run can't be queried yet. If you just imported a batch, run the update again.
Access permissions
If multiple accounts share the instance, use dummy documents and an account with restricted permissions to verify that the conversation draws only on documents visible to that account. Don't assume this behavior without checking it in your version.

#Where your document data goes

Enabling AI in Paperless-ngx doesn't, on its own, guarantee that your documents stay on the machine. Document text is sent to the language model for every suggestion and every conversation, and to the embedding model during indexing. So everything depends on where these two models run.

Ollama in the same Compose project, local model
The text stays on the machine. This is the setup described in this guide.
Ollama on another server
The text travels over the network to that server, in plaintext if the connection isn't encrypted. On a local network you control, that's a defensible choice; over the Internet, your documents leave your infrastructure.
OpenAI-compatible backend pointing to a third-party service
Your documents' text is sent to this provider and is subject to its terms. The Paperless-ngx documentation itself flags this privacy concern.
Cloud model via Ollama
Same situation as a third-party service, despite a local address on the Paperless side (see the warning in step 1).
Downloads
Pulling the Docker images, the Ollama model, and the Hugging Face embedding model requires network access. These downloads don't send out your documents, but they do reveal that the installation exists.
i
Local doesn't mean anonymous
Local processing keeps you from sending your documents to a third party; it doesn't anonymize them. Names, addresses, and numbers remain in plain text in the database, the vector index, and the backups. Protect these volumes like the rest of the archive (disk encryption, restricted access, encrypted backups).

#Troubleshooting Paperless-ngx with Ollama

No AI suggestions in the UI
Check that PAPERLESS_AI_ENABLED is actually being read (container recreated with docker compose up -d after the change), that the installed version offers these features, and review the webserver logs at startup.
Connection error to Ollama
The localhost address was used from inside the container, the ollama service isn't running, or native Ollama is listening only on 127.0.0.1. Rerun the Python test from step 1 inside the webserver container.
Model not found
The name in PAPERLESS_AI_LLM_MODEL doesn't exactly match ollama list (missing tag, capitalization). Copy the name from the command output.
Suggestions very slow or failing
Either the model is loading on the first request, or there isn't enough VRAM and Ollama falls back to the CPU. Check docker compose logs ollama, and pick a smaller model or a Q4_K_M quantization.
Inconsistent titles
First, check the document's OCR content in Paperless: empty or error-ridden text (wrong OCR language setting, poor-quality scan) explains most nonsensical suggestions.
Chat ignores a document
The index is out of date, or it was built with a different embedding model. Run an update, or a full rebuild if you changed models.
Terminal — useful logs
docker compose logs --tail=200 webserver
docker compose logs --tail=200 ollama

# Modèles chargés en mémoire et part GPU/CPU
docker compose exec ollama ollama ps
i
Sources and status of this guide
Primary reference: Paperless-ngx documentation pinned to tag v3.4.0, https://github.com/paperless-ngx/paperless-ngx/blob/v3.4.0/docs/advanced_usage.md, supplemented by docs/configuration.md from the same tag for variable names. This procedure was written from the documentation and not reproduced: no suggestion, model response, indexing time, or measurement is presented as observed. Search volume for the query "paperless ngx ollama" was not measured; no traffic data is claimed.

#Go further

Understanding document chat
Local RAG: an introduction (/guide/rag-local-introduction), covering chunking, embeddings, and the limits of semantic search.
Improve OCR upstream
Free PDF OCR with OCRmyPDF (/guide/ocr-pdf-gratuit-ocrmypdf), the engine used by Paperless-ngx, to understand what determines the quality of the extracted text.
Ollama in a container
Ollama with Docker: installation and first model (/guide/ollama-docker-installation-guide), covering GPU access in Docker and model management.
Don't expose Ollama
Securing your Ollama server (/guide/securiser-serveur-ollama), if Ollama runs on a different machine from Paperless-ngx.
Did this guide help you?

Feedback, an error, or a clarification? Let us know—it improves the guide for everyone.