DocVXQA: Context-Aware Visual Explanations for Document Question Answering

Mohamed Ali Souibgui, Changkyu Choi, Andrey Barsky, Kangsoo Jung, Ernest Valveny, Dimosthenis Karatzas

Abstract

Large Vision-Language Models (LVLMs) have demonstrated remarkable capabilities in extracting information from complex documents, yet they often operate as "black boxes," providing answers without clear justification. This lack of transparency is a significant barrier to adoption in high-stakes fields such as finance, law, and healthcare. We present DocVXQA, a novel self-explainable framework for Document Visual Question Answering (DocVQA). By integrating a learnable mask head and leveraging the Information Bottleneck principle alongside retrieval-based mask priors, DocVXQA generates precise, context-aware visual heatmaps that justify its predictions. Our results demonstrate that DocVXQA significantly outperforms standard attention-based methods in human interpretability while maintaining competitive performance on benchmark datasets.

1. Introduction

As AI systems are increasingly deployed to process invoices, contracts, and medical records, the need for explainability has become paramount. While current models can identify a "Total Amount" or a "Due Date" with high accuracy, they rarely provide a human-readable rationale for their choices. Existing explainability techniques, such as raw attention maps, are often too noisy or fragmented to be useful, frequently highlighting irrelevant text or failing to show the surrounding context necessary for verification.

DocVXQA addresses this gap by forcing the model to "show its work." Instead of post-hoc analysis, the framework is designed to be self-explaining by construction, producing visual masks that highlight the minimal yet sufficient evidence required to answer a specific question.

2. The DocVXQA Framework

The architecture of DocVXQA is built upon a standard DocVQA backbone (such as Pix2Struct or Donut) enhanced with a specialized Mask Head. This head generates a relevance map over the document image, which serves as the visual explanation.

2.1 The Information Bottleneck Principle

The training objective of DocVXQA is rooted in the Information Bottleneck (IB) principle. The model is optimized to find a trade-off between two competing goals:

  1. Minimality: Using the smallest possible region of the image to reduce noise.
  2. Sufficiency: Ensuring the selected region contains all the information necessary to produce the correct answer.

2.2 Context-Awareness via Mask Priors

A common pitfall in self-explaining models is "answer-overfitting," where the model learns to highlight only the specific characters of the answer (e.g., just the digits of a total) while ignoring the labels that give those digits meaning (e.g., the word "Total"). To combat this, DocVXQA incorporates a mask prior derived from ColPali, a pretrained retrieval model. This prior guides the model to include relevant context, ensuring the explanation reflects the full reasoning path—such as the row and column headers in a complex table.

2.3 Optimization and Loss Functions

The framework is optimized using a multi-faceted loss function:

  • Cross-Entropy Loss: Ensures the accuracy of the generated answer.
  • $L_1$ and Continuity Loss: Encourages the mask to be sparse and spatially coherent, preventing fragmented explanations.
  • MSE Alignment: Aligns the learned mask with the contextually rich ColPali prior.

3. Experimental Evaluation

3.1 Datasets

The framework was rigorously tested across three diverse benchmarks:

  • DocVQA: The industry-standard benchmark for document understanding.
  • PFL-DocVQA: A dataset focused on privacy-aware document processing.
  • InfographicVQA: A challenge involving complex, non-linear layouts and diverse visual elements.

3.2 Quantitative Results

DocVXQA achieves a superior balance between task performance and explanation efficiency. On the DocVQA dataset, the model achieved an Average Normalized Levenshtein Similarity (ANLS) of 0.54 while only requiring 23% of the image pixels to justify its answer. This demonstrates that the model can successfully isolate the most relevant information without sacrificing significant accuracy.

3.3 Human Interpretability

In a user study involving 42 participants, DocVXQA's explanations were compared against several baselines. The results highlighted a clear preference for the DocVXQA approach:

  • Context-awareness: Scored 4.49/5, significantly higher than the 3.97 achieved by the next best baseline.
  • Clarity: Scored 3.56/5.
  • User Preference: In head-to-head comparisons, participants preferred DocVXQA’s visual justifications 64.7% of the time over the ColPali+Pix2Struct baseline.

4. Discussion and Limitations

While DocVXQA represents a significant step forward, it introduces an "explanation tax." The model's raw accuracy (0.51 ANLS on DocVQA) is slightly lower than a standard, unmasked version of the same backbone (0.56 ANLS). This occurs because the model must simultaneously learn to process both the full image and the masked variations. Additionally, the current pipeline relies on a post-processing step to group relevance maps into bounding boxes for optimal visual presentation.

5. Conclusion

DocVXQA demonstrates that it is possible to build Document AI systems that are both powerful and transparent. By moving beyond raw attention and incorporating context-aware priors, the framework provides justifications that align with human reasoning. Future work will focus on scaling this approach to larger vision-language models and further narrowing the performance gap between explainable and "black-box" architectures.

Summary updated

BibTeX
@inproceedings{souibgui2025docvxqa,
  author = {Mohamed Ali Souibgui and Changkyu Choi and Andrey Barsky and Kangsoo Jung and Ernest Valveny and Dimosthenis Karatzas},
  title = {{DocVXQA: Context-Aware Visual Explanations for Document Question Answering}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=wex0vL4c2Y},
}
Figure