Skip to content

fix(vision): read images with a tested model already on disk - #6825

Merged
kovtcharov-amd merged 3 commits into
amd:mainfrom
kovtcharov:fix/vision-uses-downloaded-tested-model
Nov 6, 2026
Merged

kovtcharov-amd merged 3 commits into
amd:mainfrom
kovtcharov:fix/vision-uses-downloaded-tested-model

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Someone who set GAIA up on a cloud model and later downloaded Qwen3.6-35B-A3B couldn't ask about an image: both image tools stopped at "Gemma-4-E4B is not downloaded (about 5.97 GB)… download it under Settings > Model", even though Qwen3.6 reads images and is tested for it. Now, when the vision model GAIA picked by default isn't downloaded, it reads with a tested image-reading model that is (a loaded one first), and only asks for the download when none is on disk. A vision model chosen in setup is never swapped, untested models are never picked, and reading images stays off while chat runs on the NPU.

Test plan

  • pytest tests/unit/test_vision_uses_downloaded_model.py: cloud chat with Qwen downloaded and Gemma missing reads with Qwen; with neither it still names Gemma; NPU stays off; a setup choice and untested models are never swapped. The Qwen cases fail on main with the user's exact message
  • pytest tests/unit/test_vlm_extraction_failures.py tests/unit/test_default_vision_model.py tests/unit/test_vision_off_on_npu.py tests/unit/rag
  • Replay in the app: cloud chat, Qwen downloaded, image question DeepSeek chat with Qwen3.6 downloaded and Gemma not: the image tools read it ("violet-otter-92") instead of asking for a Gemma download.
  • Replay in the app: document indexing on a cloud chat with Qwen downloaded and no Gemma. index_document on planted.png indexed one chunk, and a library search returned "violet-otter-92" (integration build, DeepSeek chat).

On a cloud chat with no default_model, the image tools asked for a ~6 GB
Gemma download even when Qwen3.6-35B-A3B, a tested image reader, was
already downloaded.

- When the resolved vision model is a tested default the catalog lists as
  not downloaded, the VLM client reads with a downloaded VISION_CHAT_MODELS
  entry instead, preferring one already loaded.
- A vision_model chosen in setup, or any model outside the tested set, is
  never replaced; with no tested reader on disk the download prompt still
  names Gemma. The NPU rule is unchanged.
- The tool result now names the model that actually read the image.
@github-actions github-actions Bot added documentation Documentation changes devops DevOps/infrastructure changes llm LLM backend changes tests Test changes performance Performance-critical changes labels Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Verdict: Request changes

When GAIA's default image reader (Gemma) isn't downloaded but another tested one (Qwen3.6 or Flash) is, the image tools in chat now use the one on disk instead of telling the user to download Gemma. That fix works and is well guarded. Document search doesn't get it, though, and the docs say it does.

  • Indexing a scanned PDF or an image file still fails with "download Gemma". Document search checks that Gemma is installed before it reaches the new swap, so the user with Qwen on disk from the PR description still gets the old error. The edited "Document Indexing Requirements" note in the chat guide promises the opposite. Either route indexing through the same swap, or limit the docs to the chat image tools.
  • No run in the real app yet. The one test-plan item that would show this works in the app ("cloud chat, Qwen downloaded, image question") is still unchecked. Please attach that run, plus a document-indexing run once the gap above is fixed.

Real-world evidence

N/A: no evidence bundle was produced for this run. This verdict rests on reading the code. I also couldn't run the tests here because pytest isn't installed in this environment.

🔍 Technical details

Issues

🟡 The swap never runs for document indexing (src/gaia/rag/sdk.py:1656, src/gaia/rag/sdk.py:2821)
Both document-indexing paths call vlm.check_availability() before extract_from_image. That method uses list_models() with show_all=False, which returns only downloaded models (lemonade_client.py:7491). With Gemma missing it returns False. Scanned PDFs then skip their images and print "Download model: Gemma-4-E4B-it-GGUF". A standalone image raises ImageExtractionError("vision model … is not available"). In neither case is _refuse_missing_vlm / downloaded_vision_model reached. resident_vision_model only helps when Qwen is already loaded, not merely downloaded.
That makes three claims inaccurate: the docs/guides/chat.mdx indexing note, the CLAUDE.md line ("the image tools and RAG read with…"), and arguably the vision_model row in cli.mdx.
Possible fix: resolve the substitute before the availability gate, either with a public VLMClient method that runs the catalog check and swaps self.vlm_model, called before check_availability(), or by making check_availability consult downloaded_vision_model. Then add a RAG test: an image file and a scanned PDF, Gemma not downloaded and Qwen downloaded, asserting the read uses Qwen.

🟡 No evidence from the real app (PR test plan)
This changes what the user sees in the Agent UI image tools, but the replay item is unchecked and there's no run or screenshot. Please attach the tool result (it now reports "model": "Qwen3.6-35B-A3B-GGUF") from a real cloud chat session.

🟢 An explicit caller choice is swapped too (src/gaia/llm/lemonade_client.py:580)
downloaded_vision_model only protects vision_model from config. A caller that explicitly passes Gemma is swapped silently, apart from an info log: StructuredExtractor's hard-coded default, or VLMClient(vlm_model=GEMMA) from code. That's probably fine for a default, but the docstring's "only a tested default is replaced" reads stronger than what the code does.

Strengths

  • The swap has tight bounds: it only replaces a tested default, never a setup choice or an untested model, and reading images stays off on the NPU. A test pins each case.
  • Preferring an already-loaded model avoids evicting the resident one, and a failed health read falls back to a logged warning rather than being swallowed.
  • The tool result now reports the model that actually read the image, not the one that was configured.

Indexing a scanned PDF or an image file still asked for Gemma when Qwen3.6
was downloaded: document search gates on VLMClient.check_availability,
which only looked for the configured model and never reached the swap.

- check_availability now switches to a downloaded VISION_CHAT_MODELS entry
  through the same rule as the image tools; the NPU stays vision-off.
- The image-file path reports the model that actually read the image.
- Docstring now says what the swap replaces: any tested name except the
  vision_model chosen in setup.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Document indexing now gets the same swap: a scanned PDF or an image file indexes with Qwen3.6 when it's on disk and Gemma isn't. Reading images stays off on the NPU, and with no tested reader downloaded the error still names Gemma. The chat image tools were replayed in the app (DeepSeek chat, Qwen downloaded); the indexing path is covered by tests but not yet replayed in the app.

🔍 Technical details
  • VLMClient.check_availability (the gate both RAG paths call) now falls back to _use_downloaded_tested_model, which reads the show_all catalog and applies downloaded_vision_model. _refuse_missing_vlm shares the same helper.
  • _extract_text_from_image reports vlm.vlm_model after the gate, so its messages name the model that read the image.
  • New tests in tests/unit/test_vision_uses_downloaded_model.py run through the real RAGSDK and VLMClient, with only the Lemonade transport mocked. They cover a scanned PDF and an image file reading with Qwen, an image file with no tested reader still naming Gemma, and the NPU refusing. On the previous head, the two Qwen cases failed with the "download Gemma" error.
  • Docstring changed to match the code (🟢): any VISION_CHAT_MODELS name is replaced whoever passed it, except the vision_model chosen in setup. CLAUDE.md now names both call sites.
  • Merged origin/main. 898 passed, 2 skipped across the vision, RAG, and tests/test_rag.py suites.

@github-actions github-actions Bot added the rag RAG system changes label Nov 6, 2026
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 6, 2026
Merged via the queue into amd:main with commit 18026c2 Nov 6, 2026
55 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the fix/vision-uses-downloaded-tested-model branch November 6, 2026 20:39
@kovtcharov-amd kovtcharov-amd mentioned this pull request Nov 7, 2026
6 of 12 tasks
kovtcharov-amd added a commit to rezamuliawijaya/gaia that referenced this pull request Nov 7, 2026
## Why this matters

v0.26.0 makes the first reply in a new chat much faster by loading tools
on demand (amd#6449), and adds long recordings and video links (amd#6451),
read aloud in both apps (amd#6489), a live system usage strip (amd#6548),
cloud spend in the composer (amd#6775), local problem reports for failed
model calls (amd#6665) and GAIA on stock GNOME without a tray (amd#6868).
Among the fixes, a duplicated edit can no longer damage a file and
long-running agents on macOS keep answering. 31 commits since v0.25.4;
the notes are in `docs/releases/v0.26.0.mdx` and credit 4 outside
contributors.

This is a minor: 7 `feat` commits, and dynamic tool loading drops two
environment variables and the old Beta toggle (listed under Breaking
Changes). Merging it moves main to 0.26.0 so `v0.26.0-rc1` can be tagged
right after v0.25.4 publishes. The changelog is regenerated before the
final.

## Test plan

- [x] `python util/validate_release_notes.py docs/releases/v0.26.0.mdx
--tag v0.26.0` passes, and with `--tag v0.26.0-rc1`
- [x] `mintlify validate` (from `docs/`) passes; the notes have no
unescaped `<` or `{`
- [x] Narrative word count is 391, under the 600 cap for a minor
- [x] `python util/release_versions.py --check`, `python
util/check_doc_links.py --internal-only` and `python
util/check_doc_versions.py` pass
- [x] `python util/check_component_core_api.py --release-version 0.26.0`
passes
- [x] `pytest tests/unit/test_docs_json_release.py
tests/unit/test_check_component_core_api.py
tests/unit/test_release_tag.py tests/unit/test_hub_core_version_gate.py
tests/unit/test_release_versions.py
hub/agents/gaia/python/tests/test_npm_doc_min_version.py`: 232 passed
- [ ] CI green on the merge commit
- [ ] `release_train_dryrun.yml` passes on that commit before the RC tag

<details>
<summary>🔍 Technical details</summary>

- `test_release_versions.py` simulated a core bump to a hard-coded
`0.26.0`, which is a no-op once the tree is on 0.26.0. It now bumps to
the next minor above whatever the tree declares.
- The flagship agent stays at 0.3.5; its `amd-gaia` floors and
`min_gaia_version` move to 0.26.0 through `--stamp`, and its npm
CHANGELOG's `[Unreleased]` quotes the new minimum.
`hub/components/agent-ui/` is no longer published and is left alone.
- `RELEASED_DAEMON_API` no longer exists (amd#5394); the core API guard
reads released versions from PyPI.
</details>

## Evals to re-run on the RC tag

LLM-affecting PRs merged without per-PR evals; run these on
`v0.26.0-rc1`:

- `gaia_tool_selection`, `tool_selection`, `gaia_core` and
`context_retention` for dynamic tool loading (amd#6449, amd#6842)
- `gaia_media` and `gaia_voice` (amd#6451, amd#6489, amd#6825)
- `gaia_data` and `gaia_honesty` (amd#6828, amd#6831, amd#6817)
- `gaia_files` (amd#6844)
- `adversarial` (amd#6837)
- `memory` and `gaia_memory` (amd#6828, amd#6843)
- `gaia_email` (amd#6842)

## Release checklist

- [ ] Merge once v0.25.4 has published; amd#6114 (flagship follows core) is
not part of this release PR
- [ ] Freeze main, wait for green CI on the exact commit, pass
`release_train_dryrun.yml`, then push `v0.26.0-rc1` (the RC freezes its
own flagship; no agent release needed)
- [ ] Before the final: release the flagship from the release commit
(`agent-pkg-gaia-v<next>`), merge its pin-lock PR, and pass
`check_flagship_release.py`
- [ ] Regenerate the changelog if main gains commits before the final
tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps/infrastructure changes documentation Documentation changes llm LLM backend changes performance Performance-critical changes rag RAG system changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants