Abstract
VisFocus is a novel OCR-free framework designed to enhance dense document understanding by making vision encoders "prompt-aware." By injecting user queries directly into the visual encoding process through a cross-attention merging layer (ViLMA) and a specialized pre-training task (LMPM), VisFocus learns to prioritize relevant text patches. The model achieves state-of-the-art results for its size class on benchmarks such as DocVQA and ChartQA, demonstrating significant improvements in handling information-dense visual documents.
Introduction
Visual Document Understanding (VDU) is the task of extracting structured information from document images like PDFs, forms, and charts. Traditional pipelines rely on external Optical Character Recognition (OCR) engines, which are computationally expensive and prone to error propagation. While recent "OCR-free" models like Donut and Pix2Struct eliminate the OCR step by using end-to-end vision-to-language architectures, they often process document images independently of the user's query. In "dense" documents—those with high text density and complex layouts—this leads to inefficient use of the vision encoder's capacity.
VisFocus addresses this by enabling the vision encoder to "know what it is looking for" during the encoding process. This selective attention mimics human scanning behavior, where a reader looks for specific keywords to locate relevant information rather than reading every word of a long document.
Methodology
The VisFocus framework introduces two primary innovations to bridge the gap between visual encoding and language prompts.
Vision-Language Merging Attention (ViLMA)
Standard hierarchical vision transformers, such as Swin, use patch-merging layers to reduce image resolution as features move deeper into the network. VisFocus replaces these with ViLMA layers. In these layers, visual features undergo cross-attention with the user's prompt before down-sampling. This mechanism allows the model to weigh visual patches based on their relevance to the query, ensuring that the features passed to the language model (LM) are already filtered for importance.
Localized Masked Prompt Modeling (LMPM)
To train the model to utilize the ViLMA layers effectively, the authors developed the LMPM pre-training task. The model is presented with a random text snippet from the document as a "prompt," with certain words masked (e.g., "The [MASK] is located in [MASK]"). The model must then use visual features to locate the specific region in the document and predict the missing words. This forces the vision encoder to learn a "search and focus" behavior during pre-training.
Prompt Dropout
To prevent the language model from becoming overly dependent on the vision encoder, the authors occasionally omit the prompt from the LM during training. This strategy forces the vision encoder to produce highly descriptive and focused features that can independently support the final answer generation.
Experimental Results
VisFocus was evaluated across five diverse VQA benchmarks, including DocVQA, InfoVQA, and ChartQA. The model achieved state-of-the-art performance among models of comparable scale.
- DocVQA: The base model achieved 72.9 ANLS, a +1.2 improvement over the baseline.
- ChartQA: VisFocus saw a significant jump of +4.6 points (57.1 RA).
- Efficiency: The VisFocus-S model (132M trainable parameters) outperformed much larger models like UReader, proving that architectural focus is often more valuable than raw parameter count.
Key Insights
The performance gap between VisFocus and standard models is most pronounced in dense documents. In documents containing over 800 words, VisFocus outperformed the baseline by 2.3 points, compared to a 0.7-point improvement on simpler documents. This confirms the intuition that early interaction between vision and language is critical for processing crowded visual information.
Limitations and Future Work
While VisFocus excels at text-centric tasks, its ability to focus on non-textual visual elements in complex diagrams without labels remains an area for improvement. Additionally, the LMPM task requires text location data during pre-training. Future research may explore more diverse prompt-aware tasks that incorporate layout or structural queries.
Conclusion
VisFocus demonstrates that integrating language prompts into the early stages of visual encoding significantly improves OCR-free document understanding. By focusing the encoder's limited capacity on relevant regions, VisFocus achieves superior accuracy and efficiency, particularly for dense and complex document types.
Summary updated