feat(examples): vision-first document RAG (ColQwen2.5 + Florence-2-DocVQA)#178
Open
svonava wants to merge 1 commit into
Open
feat(examples): vision-first document RAG (ColQwen2.5 + Florence-2-DocVQA)#178svonava wants to merge 1 commit into
svonava wants to merge 1 commit into
Conversation
…2-DocVQA A multi-tenant retrieval + QA example that keeps OCR out of the score path. Pages are encoded as images with ColQwen2.5, MaxSim ranks them via late interaction, and Florence-2-FT-DocVQA reads the top page to produce a textual answer. An optional Qwen3-VL-Reranker-2B second stage stays in the visual modality so layout cues survive both ranking stages. Exercises encode + extract (and score when enabled). Includes a synthetic 3-tenant corpus, a PIL renderer that turns each entry into a PNG, a FastAPI server, and a minimal UI that shows the page image alongside the answer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/vision-doc-rag/. ColQwen2.5 ranks pages by reading them as images, Florence-2-FT-DocVQA reads the top page and produces a textual answer. OCR never enters the score path, so charts, tables, screenshots, and layout cues survive end-to-end.clienttag, queries are scoped via a Python filter before MaxSim. Same corpus serves multiple tenants with no per-tenant index.Qwen/Qwen3-VL-Reranker-2Bsecond stage stays in the visual modality (off by default — gated on a cluster-side bugfix).SIE features
vidore/colqwen2.5-v0.2encode(multivector, image + text)sie_sdk.scoring.maxsimQwen/Qwen3-VL-Reranker-2Bscoremynkchaudhry/Florence-2-FT-DocVQAextractwithinstruction=<question>mynkchaudhry/Florence-2-FT-DocVQAextractProject layout
Test plan
data/fetch_dataset.pygenerates 12 pages across 3 tenantsdata/render_pages.pyrenders 12 PNGs (1024×1280) via PIL with a fallback font pathvidore/colqwen2.5-v0.2returns a[~740, 128]multivector on the dev cluster (verified before a cluster-side wedge took the worker out — see notes)sie_sdk.scoring.maxsim(query_mv, [doc_mv])returns the expected high score for a matched pageBAAI/bge-reranker-v2-m3returns sensible scores on text inputs (sanity test, separate from the visual reranker)instruction=<question>returns a focused answer rather than an OCR dump (depends on the cluster's Florence-2 adapter routing the task token correctly)Notes for reviewers
The visual reranker is configured but disabled by default in
config.yaml. There's a known cluster-side adapter issue where JSON image inputs are not base64-decoded before reaching the preprocessor; once that lands, flipsearch.visual_rerank: trueand the second stage runs in the same modality as retrieval.The synthetic corpus is intentionally domain-mixed (engineering runbooks, HR policies, finance procedures) so queries clearly disambiguate by tenant and the visual layout matters more than keyword overlap.