Skip to content

LLM OCR (OpenAI) marks clearly legible invoice as "unreadable scan" #792

Description

@daFlo

Summary

With AI OCR enabled (OCR_PROVIDER=llm, OpenAI vision), some invoices that are clearly legible to a human and to a GPT vision model are treated as essentially "unreadable" by paperless-gpt (poor extraction, titles like "unreadable scan", missing vendor/total etc.).

The same PDF, when inspected manually and via a direct GPT vision call, can be parsed just fine (vendor, invoice number, date, line item, totals, IBAN…).

This makes me suspect that the PDF→image rendering/downscaling inside the LLM OCR pipeline is too aggressive, especially for small text in headers/footers.

Environment

  • paperless-gpt: v0.23.0 (Docker)
  • Paperless-ngx: v2.20.0 (Docker)
  • LLM provider: OpenAI (cloud)
  • OCR provider: llm
  • Vision LLM: gpt-4o-mini
  • Deployment: Docker / Portainer on a NAS

Relevant config

environment:
  - LLM_PROVIDER=openai
  - OPENAI_API_KEY=<redacted>
  - LLM_MODEL=gpt-4o-mini

  - OCR_PROVIDER=llm
  - VISION_LLM_PROVIDER=openai
  - VISION_LLM_MODEL=gpt-4o-mini
  - OCR_PROCESS_MODE=image

  - MANUAL_TAG=paperless-gpt
  - AUTO_TAG=paperless-gpt-auto
  - AUTO_OCR_TAG=paperless-gpt-ocr-auto

From the logs I see that OCR_PROVIDER=llm only supports OCR_PROCESS_MODE=image (pdf/whole_pdf are rejected as invalid).

Expected vs actual

Expected:

AI OCR should be able to reliably extract at least the basics from this invoice (document type, vendor, invoice number, date, total, etc.), or at least not label it as unreadable when the majority of the content is clear.

Actual:

For this invoice, LLM OCR behaves as if the scan was very poor: key fields are missed and the generated title/description may classify it as an "unreadable scan", even though the original PDF looks perfectly fine.

Questions / request

Is there a way (or could you add one) to configure the render resolution/DPI or max image size for OCR_PROVIDER=llm, so that small header/footer text survives better?

Would you consider adding a mode for OpenAI where the original PDF can be passed directly to the vision model instead of going through PDF→image→downscale first?

Alternatively, could the default prompts/logic for LLM OCR be adjusted so that partially readable documents are treated as "best effort" instead of quickly falling back to "unreadable scan"?

Sample document / privacy

I cannot attach the original invoice PDF here because it contains my full legal name and address.

However, I’m happy to share the PDF with you privately (e.g. via email or another private channel) if that would help to reproduce and debug the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions