Q-Mask: Query-driven Causal Masks for Text Anchoring in OCR-Oriented Vision-Language Models
Organizations: MiLM Plus, Xiaomi Inc
Abstract
Optical Character Recognition (OCR) is increasingly regarded as a foundational capability for modern vision-language models (VLMs), enabling them not only to read text in images but also to support downstream reasoning in real-world visual question answering (VQA). However, practical applications further require reliable text anchors, i.e., accurately grounding queried text to its corresponding spatial region. To systematically evaluate this capability, we introduce TextAnchor-Bench (TABench), a benchmark for fine-grained text-region grounding, which reveals that both general-purpose and OCR-specific VLMs still struggle to establish accurate and stable text anchors. To address this limitation, we propose Q-Mask, a precise OCR framework built upon a causal query-driven mask decoder (CQMD). Inspired by chain-of-thought reasoning, Q-Mask performs causal visual decoding that sequentially generates query-conditioned visual masks before producing the final OCR output. This visual CoT paradigm disentangles where the text is from what the text is, enforcing grounded evidence acquisition prior to recognition and enabling explicit text anchor construction during inference. To train CQMD, we construct TextAnchor-26M, a large-scale dataset of image-text pairs annotated with fine-grained masks corresponding to specific textual elements, encouraging stable text-region correspondences and injecting strong spatial priors into VLM training. Extensive experiments demonstrate that Q-Mask substantially improves text anchoring and understanding across diverse visual scenes.
Figures & tables
| Model | Size | (%) | (%) | Overall (%) |
| Gemini 3.0 Pro DeepMind (2025) | Closed | 25.85 | 62.58 | 44.22 |
| GPT 5.2 OpenAI (2025) | Closed | 10.64 | 0.64 | 5.64 |
| Kimi K2.5 Team et al. (2026a) | 1T | 49.54 | 57.73 | 53.64 |
| Qwen3.5 Qwen Team (2026) | 397B | 61.10 | 72.80 | 66.95 |
| Qwen3-VL-Instruct Bai et al. (2025a) | 235B | 60.90 | 60.40 | 60.65 |
| DeepSeek OCR2 Wei et al. (2026a) | 3B | – | 11.66 | 5.83 |
| Model | Size | ChartQA | DocVQA | InfoVQA | TextVQA | OCRBench |
| Closed-source Generalist Models | ||||||
| Gemini 3.0 Pro DeepMind (2025) | Closed | - | - | 57.2 | - | 940 |
| GPT 5.2 OpenAI (2025) | Closed | 57.0 | 91.7 | 84.0 | 72.8 | 807 |
| Claude-3.5-Sonnet Anthropic (2024a) | Closed | 90.8 | 95.2 | 74.3 | 74.1 | 788 |
| GPT-4o Achiam et al. (2023) | Closed | 85.7 | 92.8 | 66.4 | 70.5 | 736 |
| Claude-3-Opus Anthropic (2024b) | Closed | 80.8 | 89.3 | 55.6 | 67.5 | 694 |
| Category | Samples | Ratio | R2T/T2R | Source |
| SceneText | 2,760 | 50.6% | 1,380/1,380 | HierText 2,712; ICDAR2015 48 |
| Receipt | 560 | 10.3% | 280/280 | SVRD 560 |
| Ticket | 460 | 8.4% | 230/230 | SVRD 371; HierText 89 |
| WarehouseSlip | 390 | 7.2% | 195/195 | SVRD 390 |
| Report | 280 | 5.1% | 140/140 | SVRD 139; HierText 141 |
| ChineseDocument | 270 | 5.0% | 135/135 | CDLA 270 |
| Model family | Supported task(s) | Native coordinate/interface | Adaptation in TABench |
| Qwen-series | R2T + T2R | ; absolute or relative varies by version | coordinate conversion only |
| GLM-4.6V | R2T + T2R | ; relative coordinates in | use native relative-coordinate format |
| Gemini 3.0 Pro | R2T + T2R | reorder prompt/parser to native convention | |
| Kimi K2.5 | R2T + T2R | normalized coordinates in | convert GT/predictions to normalized format |
| DeepSeek OCR2 | T2R | grounding prompt with <|ref|> tags | rewrite natural-language query to native grounding prompt |
| Component | #Instances | Ratio | Usage |
| Scene text | 14.4M | 54.0% | Stage-1 |
| Synthetic text | 10.8M | 40.4% | Stage-1 |
| Academic document pages | 1.53M | 5.7% | Stage-1 |
| VQA with causal mask | 10K | — | Stage-2 only |
| Total | 26.7M | 100% |
| Category | Number | Datasets |
| Text Recognition | 3.2M | CASIA-HWDB2 Liu et al. (2013) , K12_Printing Wiedmann et al. (2025) , ORAND-CAR-2014 Diem et al. (2014) , rendered_text Wendler (2023) , IAM Marti and Bunke (2002) , IIIT5K Mishra et al. (2012) , Imgur5K Krishnan et al. (2021) , VisualMRC Tanaka et al. (2021) , SROIE Huang et al. (2019) , multiple public CAPTCHA datasets, COCO-Text Veit et al. (2016) |
| Charts / tables | 3.9M | ChartQA Masry et al. (2022) , Chart2Text Kantharaj et al. (2022) , CoSyn-400K Yang et al. (2025) , HiTab Cheng et al. (2022) , InfographicVQA Mathew et al. (2022) , LRV-Chart, SciTSR Chi et al. (2019) , SimChart9K Xia et al. (2023) , TabMWP Lu et al. (2022) , VisText Tang et al. (2023) , UniChart Masry et al. (2023) , SynthChartNet Nassar et al. (2025) ; Lysak et al. (2023) , ArxivQA Li et al. (2024a) , DVQA Kafle et al. (2018) , FigureQA Kahou et al. (2017) , FinQA Chen et al. (2021b) , FUNSD Jaume et al. (2019) , MMC Liu et al. (2023) , PlotQA Methani et al. (2020) , RoBUT Zhao et al. (2023) , TAT-QA Zhu et al. (2021) , VQAonBD Baviskar et al. (2021) ; Biten et al. (2019) ; Tito et al. (2021) ; Zheng et al. (2021) , Block-Diagram-Datasets Bhushan and Lee (2022) |
| Documents | 5.7M | DocVQA Mathew et al. (2021) , DocReason25K Hu et al. (2024b) , Sujet Sujet AI (2024) , PDF-VQA Ding et al. (2023) , TAT-DQA Zhu et al. (2022) , DocDownstream Hu et al. (2025) , DocStruct4M Hu et al. (2024b) , Docmatix Hu et al. (2024a) , UReader Ye et al. (2023) |
| Formula recognition | 2.4M | UniMER-1M Wang et al. (2024a) , SynthFormulaNet Nassar et al. (2025) ; Gervais et al. (2024) , HME100K Yuan et al. (2022) , latex_handwritten Wiedmann et al. (2025) , LatexFormulas OleehyO (2023) , Chrome_Writing Wendler (2023) |
| General OCR VQA | 7.1M | EST-VQA Wang et al. (2020) , MTVQA Tang et al. (2025) , ST-VQA Biten et al. (2019) , TextVQA_train Singh et al. (2019) , WebSRC Chen et al. (2021a) , LSVT Sun et al. (2019) , ReCTS Zhang et al. (2019) , RCTW Shi et al. (2017) , ArT Chng et al. (2019) , COCO-Text Veit et al. (2016) , EATEN Guo et al. (2019) , invoices_receipts Cruz and Castelli (2022) |
| Stage-1 resampled subset | 1.0M | A resampled subset drawn from the scene-text, synthetic-text, and academic-document components of TextAnchor-26M |
Explore similar work
SimpleOCR: Rendering Visualized Questions to Teach MLLMs to Read
read'' text embedded in images, or do they merely rely on parametric shortcuts in the text prompt? In this work, we diagnose this issue by introducing the Visualized-Question (VQ) setting, where text queries are rendered directly onto images to structurally mandate visual engagement. Our diagnostic experiments on Qwen2.5-VL reveal a startling capability-utilization gap: despite possessing strong OCR capabilities, models suffer a performance degradation of up to 12.7% in the VQ setting, exposing a deep-seated modality laziness.'' To bridge this gap, we propose SimpleOCR, a plug-and-play training strategy that imposes a structural constraint on the learning process. By transforming training samples into the VQ format with randomized styles, SimpleOCR effectively invalidates text-based shortcuts, compelling the model to activate and optimize its visual text extraction pathways. Empirically, SimpleOCR yields robust gains without architectural modifications. On four representative OOD benchmarks, it surpasses the base model by 5.4% and GRPO based on original images by 2.7%, while exhibiting extreme data efficiency, achieving superior performance with 30x fewer samples (8.5K) than recent RL-based methods. Furthermore, its plug-and-play nature allows seamless integration with advanced RL strategies like NoisyRollout to yield complementary improvements. Code is available at https://github.com/aiming-lab/SimpleOCR.