Repository navigation
fix(rag): keep scanned pages readable and read them with a model the PC has - #6261
Conversation
…PC has Scanned Arabic pages were shrunk until the text was unreadable, so the vision model returned little or nothing and those pages couldn't be searched. Images now keep their resolution within the model's limits. Indexing also uses the PC's chat model when it can read images, so a 64 GB PC running Qwen3.6 doesn't need Gemma downloaded just to read a scan.
A PC running Qwen3.6 with Gemma configured for vision swapped models to read each scan, evicting chat. A tested vision model already in memory is now used as it is; a text-only chat model is passed over for Gemma, which is smaller.
|
Verdict: Request changes. One lint failure and a docs claim that's wrong for some users; the code change itself is sound. Scanned pages no longer get halved until small print is unreadable. They now switch to JPEG at full resolution. Indexing also stops asking for a vision model
Real-world evidenceN/A: no evidence bundle was produced for this run, and the PR description shows no real indexing run. This verdict comes from reading the code only. The PR's own test plan item, indexing a scanned Arabic PDF on a PC without Qwen3-VL, is still worth doing before merge, because it's the cold-start path this fix targets. 🔍 Technical details🟡 Unused (i.e. delete the 🟡 Docs say nothing else is needed, but a text-only 🟢 Exact-string match misses 🟢 An explicit 🟢 One Strengths
|
Indexing sent every image to the vision model, about 22 seconds each, so a 229-page report took 30 minutes. Of 310 images read across seven documents, 252 gave no text, and pages with under 100 characters held 90% of what was gained. Images are now read on pages with under 200 characters of their own text, which still covers scans. Charts on text-heavy pages are left unread, and the document's metadata counts those pages.
|
🟡 The new "skip images on text pages" rule drops content users can search today, and the chat guide doesn't say so. Any PDF page with 200 or more characters of its own text no longer has its images read. That covers the usual report page with a chart or diagram, so chart labels, figure text and screenshots on those pages stop being indexed. The rule is in the SDK spec, but the user guide still reads as if every image in a PDF is read whenever a vision model is available. The only trace is a count in the metadata and a log line. Add a line to the chat guide that says which images are skipped. Consider also adding a 🔍 Technical details
|
The chat guide read as if every image were read whenever a vision model is available.
…Gemma download step The new image-page tests built their PDFs with PyMuPDF, which GAIA bans (AGPL) and no lane installs, so they skipped everywhere and failed the unit lane's skip check. They now build PDFs with reportlab, like the other PDFium tests. The chat guide said nothing else is needed for the VLM, but gaia init skips Gemma when the user sets a default_model, so a text-only one leaves scans unreadable. The download step is back for that case.
Scanned pages were shrunk until the text couldn't be read, so dense Arabic contracts lost up to all of their words, and indexing asked for a vision model
gaia initnever downloads. Pages now keep their resolution, reading 92–96% of words on five dense real pages, up from 0–93% depending on the model.Indexing now uses a tested vision model that's already loaded, then the chat model if it can read images, then Gemma. A PC running a text-only chat model switches to Gemma, the smaller choice. Gemma alone would have made indexing about 4 times slower, so images are now read only on pages with under 200 characters of their own text. Of 310 images read across seven documents, 252 gave no text, and pages short of text held 90% of what was gained. A 229-page report drops from 30 minutes to seconds of extraction, and scans still read in full. The cost: charts and text inside pictures on text-heavy pages can't be searched.
Refs #6166
Test plan
python -m pytest tests/unit/rag