      DocVXQA: Context-Aware Visual Explanations for Document Question
                               Answering


        Mohamed Ali Souibgui * 1 Changkyu Choi * 2 Andrey Barsky 1 Kangsoo Jung 3 Ernest Valveny 1
                                         Dimosthenis Karatzas 1


                         Abstract
     We propose DocVXQA, a novel framework for
     visually self-explainable document question an-
     swering. The framework is designed not only to
     produce accurate answers to questions but also
     to learn visual heatmaps that highlight contextu-
     ally critical regions, thereby offering interpretable
     justifications for the model’s decisions. To inte-
     grate explanations into the learning process, we
     quantitatively formulate explainability principles
     as explicit learning objectives. Unlike conven-
     tional methods that emphasize only the regions
     pertinent to the answer, our framework delivers ex-
     planations that are contextually sufficient while re-
     maining representation-efficient. This fosters user
     trust while achieving a balance between predic-
     tive performance and interpretability in DocVQA
     applications. Extensive experiments, including
                                                                    Figure 1. An illustration of the relevant regions in a DocVQA
     human evaluation, provide strong evidence sup-
                                                                    model (highlighted zones), produced by extracting the raw at-
     porting the effectiveness of our method. The                   tention maps from the last layer (top) and by using our method
     code is available at https://github.com/                       (bottom) for the question “ ‘Pleasure to burn since 1913’, Which
     dali92002/DocVXQA.                                             cigarette’s tagline is this?”. Here, the answer given correctly by
                                                                    the model is “Camel”.

1. Introduction
                                                                    tual and visual modalities at scale (Wang et al., 2024; Zhao
Document visual question answering (DocVQA) is essen-               et al., 2024; Rasheed et al., 2024; Parashar et al., 2024).
tial for automatically extracting information from visually
                                                                    Despite these promising advances in terms of utility,
complex, multi-modal documents including invoices, re-
                                                                    DocVQA relies on large, opaque neural network archi-
ports, and contracts (Appalaraju et al., 2024; Blau et al.,
                                                                    tectures that function as “black boxes,” offering limited
2024; Tito et al., 2023; Mathew et al., 2021). This task
                                                                    transparency into how they generate answers. This lack
requires interpreting the question and generating an answer
                                                                    of transparency is particularly concerning in high-stakes
through natural language, given a specific document. Re-
                                                                    domains such as finance (Wu et al., 2023), healthcare (Li
cently, DocVQA models have increasingly leveraged large
                                                                    et al., 2024), and law (Abdallah et al., 2023), where trust
vision-language models for their ability to process both tex-
                                                                    in AI-driven decision-making is crucial. In addition, ex-
  *
    Equal contribution 1 Computer Vision Center, Universitat        isting explainable methods for DocVQA primarily rely on
Autònoma de Barcelona, Spain 2 UiT The Arctic University of        visualizing attention maps to highlight relevant regions in-
Norway, Norway 3 Inria, France. Correspondence to: Mohamed          fluencing the model’s predictions. However, as illustrated
Ali Souibgui <msouibgui@cvc.uab.cat>.                               in Figure 1 (above), these attention-based explanations are
Proceedings of the 42 nd International Conference on Machine        often noisy or imprecise, failing to justify the reasoning be-
Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025         hind the answer. Instead of offering clear insights, they tend
by the author(s).                                                   to broadly highlight all occurrences of the answer without

                                                                1
                      DocVXQA: Context-Aware Visual Explanations for Document Question Answering

contextualizing why it was selected.                                 planations along with answer predictions. (2) We formalize
                                                                     explainability as an explicit learning objective with the in-
To address this limitation and enhance the transparency
                                                                     formation bottleneck principle. (3) We make our design
of DocVQA models, we propose a novel self-explainable
                                                                     model-agnostic and lightweight, thus, compatible with ex-
framework called DocVXQA, which learns to provide
                                                                     isting pretrained DocVQA models and requiring minimal ar-
context-aware explanations to the answers in the form of
                                                                     chitectural changes. (4) We conduct extensive experiments,
relevance maps. Note that self-explainable models generate
                                                                     including human evaluations, to validate the effectiveness
interpretable outputs by design, in contrast to post-hoc ap-
                                                                     of the proposed approach.
proaches that provide explanations retrospectively (Møller
et al., 2024; Choi et al., 2024; Gautam et al., 2023; 2022).
While these methods have been explored from a methodolog-            2. Related Work
ical perspective, their application in the context of DocVQA
                                                                     2.1. Document visual question answering
remains largely unexplored. To the best of our knowledge,
our framework is the first self-explainable DocVQA model             Typical DocVQA models are reaching good performances
designed to generate visual explanations that align with tex-        using visual and textual features within transformer-based
tual answers. This approach enhances both transparency               encoder-decoder architectures to generate answers (Ap-
and user trust in model predictions.                                 palaraju et al., 2024; Tito et al., 2023; Powalski et al., 2021;
                                                                     Xu et al., 2020). In this setup, text is extrtacted with OCR
To enhance transparency without disrupting established
                                                                     systems. However, despite their strong best-case perfor-
DocVQA models, we propose a strategy that learns gen-
                                                                     mance, these methods are prone to errors introduced by
erating explanations while maintaining compatibility with
                                                                     OCR inaccuracies and face difficulty in domains that are
available pretrained models. We build upon the widely used
                                                                     more reliant on visual features.
Pix2Struct (Lee et al., 2023) model, trained for DocVQA
task. With minimal alterations to the existing architecture–         In contrast, OCR-free end-to-end models (Lee et al., 2023;
thus avoiding significant impacts on performance or the              Aggarwal et al., 2023; Kim et al., 2022; Davis et al., 2022;
need for extensive retraining–our method first learns a mask         Kim et al., 2021) predict answers directly from document im-
over the document image as an explanation, and then uses             ages, utilizing pre-training objectives to interpret text with-
the masked image as an input to the same network to answer           out relying on OCR. More recently, Large Vision-Language
the question. This sequential learning process ensures that          Models (VLMs) like GPT-4 (Achiam et al., 2023) set new
the generated explanations directly contribute to the answer.        benchmarks in DocVQA performance, but their high com-
                                                                     putational requirements and closed-source nature limit their
The core contribution of our DocVXQA lies in learning an
                                                                     accessibility. There has also been a gradual emergence of
effective mask designed to enhance human understanding.
                                                                     smaller, open source models trained with instruction tuning
Grounded in a philosophical foundation of good explana-
                                                                     (Wang et al., 2024; Zhang et al., 2023; Ye et al., 2023), but
tion (Choi et al., 2024; Sokol & Flach, 2020), our approach
                                                                     all these models fall short in providing explanations that
aims to develop a method that learns mask representations
                                                                     support the reason behind their predictions. Among the
that are both contextually sufficient and representation-
                                                                     OCR-free models, Pix2Struct (Lee et al., 2023) is designed
efficient. To achieve this, we frame the trade-off between
                                                                     for visually-situated language understanding tasks. It uses
these objectives within the information bottleneck princi-
                                                                     a pretraining strategy called screenshot parsing, converting
ple (Tishby & Zaslavsky, 2015), ensuring a balance between
                                                                     masked web page screenshots into simplified HTML rep-
retaining relevant contextual information and minimizing
                                                                     resentations. The model incorporates variable-resolution
redundancy in the representation. Additionally, to prevent
                                                                     input, preserving the aspect ratios for diverse document lay-
overfitting in mask learning and to enhance the generalizabil-
                                                                     outs. Thus, avoiding the significant reduction in original
ity of the explanations, we integrate additional pretrained
                                                                     image resolution, which make it successful in performing
models (Faysse et al., 2024; Yu et al., 2024a), which infer
                                                                     DocVQA without requiring external OCR systems.
the mask representation as a prior and interact with the main
model to refine the explanation learning process, ensuring
robust and reliable outcomes. This approach offers more              2.2. Explainability in vision and language
precise and contextually relevant justifications. Notably,           Current vision-and-language model explanations rely heav-
although our focus is on Pix2Struct (Lee et al., 2023), our          ily on self-attention mechanisms to generate relevance maps,
method is inherently model-agnostic, allowing seamless               highlighting the regions that contribute to the model’s de-
integration with various DocVQA architectures.                       cision (Bousselham et al., 2024; Chefer et al., 2021b;a).
Our main contributions are as follows: (1) We introduce              However, attention maps are often noisy (Abnar & Zuidema,
DocVXQA, the first self-explainable DocVQA framework                 2020), making it challenging to extract meaningful insights
that learns to generate visually grounded context-aware ex-          into the model’s reasoning. Recently, in the domain of


                                                                 2
                      DocVXQA: Context-Aware Visual Explanations for Document Question Answering

DocVQA, new approaches have been introduced to pro-                    function (Bang et al., 2021; Rudin, 2019; Alvarez Melis &
vide more fine-grained grounding by explicitly localizing              Jaakkola, 2018), and architectural adjustments of the net-
answer regions (Mohammadshirazi et al., 2024; Zhou et al.,             work to enhance transparency (Gautam et al., 2023; 2022;
2024). These methods, however, require annotated answer                Alvarez Melis & Jaakkola, 2018). These approaches mark a
locations during training, leading to the development of               shift from the traditionally opaque ’black-box’ neural net-
new datasets containing such annotations (Giovannini et al.,           works to a more transparent and understandable framework.
2025). While effective in the case of extractive DocVQA
tasks (where the answer string is found explicitly in the doc-         2.4. Information theoretic learning
ument), these approaches introduce a significant annotation
cost and remain limited in their ability to capture the con-           Information theory provides a robust foundation for quanti-
text that explain why an answer is correct. Consequently,              fying data representation through metrics such as entropy,
there remains a need for explanation techniques that not               divergence, and mutual information (Principe, 2010; Shan-
only identify specific answer locations but also provide a             non, 1948). Building on this foundation, recent learning
reasoning context beyond simple spatial answer grounding.              systems have embraced these principles (Skean et al., 2025;
                                                                       Yu et al., 2024b; 2019; Tishby & Zaslavsky, 2015) and
                                                                       evolved through various innovative approaches (Jenssen,
2.3. Learning to explain
                                                                       2024; Choi et al., 2024).
Model explainability has gained significant attention in
recent years, aiming to provide insights into neural net-              3. Method
work decision-making (Covert et al., 2021). A common
approach is to generate saliency maps that highlight input             3.1. Visually self-explainable DocVQA: Enhancing
regions relevant to predictions (Schulz et al., 2020; Selvaraju             context awareness through a learnable mask
et al., 2017). In this context, the saliency map is a set of
                                                                       We propose DocVXQA, a novel framework for visually
relevance scores over input pixels, intended to reveal the
                                                                       self-explainable document question answering. At a high
model’s reasoning. Earlier explainability methods provide
                                                                       level, this framework provides not only the answer to a ques-
post-hoc explanations, i.e., get explanation without chang-
                                                                       tion but also a visual explanation in the form of a relevance
ing the trained model weights or architecture (Shrikumar
                                                                       map (Müller, 2024; Zhang et al., 2024). The core innovation
et al., 2017; Selvaraju et al., 2017; Ribeiro et al., 2016;
                                                                       of our method lies in learning the relevance map-based ex-
Bach et al., 2015). Gradient-based methods such as Grad-
                                                                       planations while simultaneously improving their reliability.
CAM (Selvaraju et al., 2017), LRP (Bach et al., 2015), and
                                                                       To achieve this, we quantitatively formalize philosophically
DeepLIFT (Shrikumar et al., 2017) calculate saliency maps
                                                                       defined explainability principles (Sokol & Flach, 2020) and
through backpropagation of model output gradients to the
                                                                       integrate them into a unified objective function, enabling
input or feature space. While these methods are easy to
                                                                       end-to-end training. Our framework builds upon the widely
implement, they often suffer from gradient shattering, lead-
                                                                       recognized Pix2Struct architecture (Lee et al., 2023), adapt-
ing to noisy and imprecise explanations. Another line of
                                                                       ing it effectively for this domain.
post-hoc explanation research is perturbation-based meth-
ods. This approach observes output changes by processing
a set of perturbed images, each occluding different regions
of the original image. Examples include LIME (Ribeiro                  Minimality-sufficiency trade-off In formulating explain-
et al., 2016), Occlusion (Zeiler & Fergus, 2014), and RISE             ability principles, DocVXQA draws inspiration from the in-
(Petsiuk, 2018). While these methods often produce more                formation bottleneck (IB) framework (Tishby & Zaslavsky,
reliable attributions, their effectiveness is constrained by the       2015), which seeks to construct a compact representation
high computational cost of sampling a sufficient number of             T of input data X that preserves only the information
meaningful perturbations.                                              essential for predicting a target variable Y . This frame-
                                                                       work balances the trade-off between reducing the mutual
Unlike post-hoc approaches, self-explainable methods (Choi             information I(X; T ) to compress irrelevant data and max-
et al., 2024; Møller et al., 2024; Rudin, 2019; Alvarez Melis          imizing I(T ; Y ) to retain predictive power. To implement
& Jaakkola, 2018) embed explainability directly into the               self-explainability within the conventional DocVQA setting,
training process, ensuring that models learn to generate in-           we strategically define the bottleneck representation T as
terpretable explanations alongside predictions. Instead of             the masked input, T = X ⊙ M , where ⊙ represents the
relying on external attribution techniques, these models are           Hadamard product that masks out irrelevant information
designed to provide built-in reasoning. Among the vari-                within X, and M is a learnable mask. This formulation pro-
ous approaches to self-explainable deep learning methods,              vides a self-explaining mask in the form of region discovery,
two main strategies stand out: the integration of mathemati-           highlighting the most relevant regions of the input (Choi
cally formulated explainability principles into the objective          et al., 2024; Zhmoginov et al., 2021). With these terms, the

                                                                   3
                       DocVXQA: Context-Aware Visual Explanations for Document Question Answering




Figure 2. Overview of the proposed DocVXQA framework: ① The input question and the full document image are sent to both the
pretrained Pix2Struct ENC-DEC and a pretrained ColPali model. ② The mask head (MASK) generates a learnable mask based on the
decoder output and positional embeddings. ③ ColPali provides a mask prior, highlighting the relevant regions of the input document in
relation to the question. ④ The learnable mask, guided by the mask prior, is combined with the original document to create the masked
image, where only the highlighted parts are kept visible. ⑤ The masked image is processed through the Pix2Struct network. ⑥ The text
head (TEXT) predicts the answer to the question based on the masked input.


objective function LIB is expressed as:                                As shown in the figure, our framework also incorporates a
                                                                       pretrained ColPali model (Faysse et al., 2024). The details
      min LIB = βI(X; X ⊙ M ) − I(X ⊙ M ; Y ),               (1)       of its role and integration are discussed in Sec. 3.4.
with hyperparameter β balancing the contrasting terms.
                                                                       3.2. Learning sufficient explanation via cross-entropy
These two terms reflect the philosophical foundation of ex-
                                                                       Upon learning the bottleneck representation, the mask M
planation, and the principles that define what an effective
                                                                       must forward contextually sufficient information to the
explanation should be (Choi et al., 2024; Sokol & Flach,
                                                                       model to answer the question by maximizing the mutual
2020). We frame these principles as minimality and suffi-
                                                                       information I(X ⊙ M ; Y ). Following (Amjad & Geiger,
ciency, using them as learning criteria to guide the model
                                                                       2019), we approximate this by minimizing the cross-entropy
as direct learning signals. Minimality emphasizes present-
                                                                       loss CE(Ŷ , Y ),
ing only the most pertinent information for understanding a
model’s decision, while sufficiency ensures that explanations
                                                                          max I(X ⊙ M ; Y ) = H(Y ) −H(Y | X ⊙ M )
remain consistent and contribute decisively to predicting a                                   | {z }
correct answer.                                                                                   constant                        (2)
                                                                                 ⇐⇒ min H(Y | X ⊙ M ) ≃ CE(Y ; Ŷ ),
Figure 2 provides an overview of our framework. We build
on a pretrained Pix2Struct model as the baseline, updating             where H(Y ) and H(Y | X ⊙ M ) are the marginal and
the encoder, the newly added mask head, and the text head              conditional entropies of Y , respectively. Ŷ denotes the
to enable the learning of a self-explainable mask representa-          model prediction. Note that H(Y ) is constant because the
tion. When a question and a document image are provided                label Y is fixed.
as inputs, the model first predicts a mask, introducing the
minimality term I(X; X ⊙ M ) to encourage the removal of
                                                                       3.3. Learning minimal explanation via continuity loss
irrelevant information. The masked input is then processed
                                                                            with L1 norm
by the model, together with the same question, to predict
the answer based on the masked representation, captured                Minimality is achieved by reducing the mutual informa-
by I(X ⊙ M ; Y ). Note that the decoder of the Pix2Struct              tion between the full document input X and the masked
model remains frozen to ensure consistent text prediction.             input X ⊙ M , resulting in a representation-efficient mask.

                                                                   4
                      DocVXQA: Context-Aware Visual Explanations for Document Question Answering

Contrary to the belief that estimating mutual information is         derstanding model as a source of prior knowledge to guide
inherently challenging (Poole et al., 2019; Belghazi et al.,         mask learning. We utilize its inference results of this model
2018), recent studies (Skean et al., 2024; Yu et al., 2019)          as prior information to facilitate interactive mask learning
have demonstrated that it can be computed deterministically          within our framework. While many models can be used for
when combined with kernel density estimation (Yu et al.,             this purpose, we employ ColPali (Faysse et al., 2024) in
2019; Giraldo et al., 2014). This approach to quantifying            our implementation. ColPali is a vision-language retrieval
mutual information is deterministic and integrates seam-             model. Its architecture integrates visual patches and textual
lessly with gradient descent over mini-batches. However,             tokens to generate multi-vector representations. These rep-
despite extensive experimentation, this approach did not             resentations are then subjected to a late interaction matching
yield the expected results. A potential limitation may stem          mechanism (Liu et al., 2024; Khattab & Zaharia, 2020),
from the model’s sensitivity to hyperparameter tuning, par-          which maximizes the interaction between each question to-
ticularly when dealing with high-dimensional image data,             ken and its corresponding relevant tokens in the document
which could have restricted its capacity to reach optimal            image. This provides a degree of explainability by visu-
performance.                                                         alizing question-document interactions through heatmaps,
                                                                     offering insights into the model’s decision-making process.
As an alternative, we propose a novel step by integrating a
                                                                     Although these visualizations often fail to align with human
continuity loss, as known as anisotropic total variation (Bui
                                                                     intuition or provide comprehensive explanations due to their
et al., 2023; Johnson et al., 2016) combined with the L1
                                                                     reliance on attention distributions, we use them as a prior
norm to enforce sparsity and smoothness in the generated
                                                                     mask and refine them within our DocVXQA framework to
relevance masks. The L1 norm promotes sparsity by penal-
                                                                     enhance relevance and interpretability.
izing the magnitude of mask values, ensuring that only the
most essential regions of the input are highlighted, thereby
producing concise and focused explanations. In parallel,             3.5. Proposed learning objective
the continuity loss enhances spatial coherence by minimiz-           Our model achieves the following: (1) it learns to make
ing abrupt transitions between adjacent regions in the mask.         predictions with masked input documents via cross-entropy
This is achieved by penalizing the L1 norm of horizontal             loss LCE (Sec.3.2), (2) it minimizes the highlighted re-
and vertical differences in the reconstructed 2D relevance           gions to ensure concise and focused explanations via LL1
mask. Together, these complementary objectives enable                (Sec.3.3), and (3) it generates more context-aware explana-
the model to highlight minimal yet structurally coherent             tions through tokens interaction with the ColPali signals via
regions of importance. By fostering smoothness and mini-             LM SE (Sec.3.4). The complete objective function LVXQA is
mality, this approach mitigates the risk of producing noisy          defined as:
or fragmented masks, ensuring that the explanations are not
only interpretable but also intuitively aligned with human
understanding.                                                         min LVXQA =γLM SE (Mp ; M )
                                                                                                                               (3)
3.4. Learning context-aware explanations through token                                + βLL1 (X; X ⊙ M ) + LCE (Y ; Ŷ ),
     interactions
Through our experiments with training the model using
                                                                     where LM SE aligns the learned mask with the prior Mp
the objective function in Equation (1), we identified that
                                                                     derived from ColPali, LL1 encourages sparsity in the high-
the learned mask often overfits to regions directly corre-
                                                                     lighted regions, and LCE represents the cross-entropy loss
sponding to the answer (see Figure 7 in Appendix). This
                                                                     for prediction accuracy. The hyperparameters γ and β bal-
overfitting reduces the mask’s utility, rendering it a mere
                                                                     ance the contributions of each term. All components of
visual reproduction of the textual answer rather than provid-
                                                                     the objective function are optimized simultaneously in an
ing meaningful, context-aware insights. Such masks lack
                                                                     end-to-end fashion. As explanations M emerge naturally
the ability to highlight broader, equally relevant information
                                                                     through this integrated optimization process, our framework
related to the question, leading to unreliable explanations.
                                                                     inherently exhibits self-explainability.
To address this issue, we emphasize the need to regularize
the mask-learning process, not only to mitigate overfitting          3.6. Postprocessing
but also to enable learning more generalizable explanations.
Specifically, we aim to create context-aware explanations            For a more human understandable relevance maps, a postpro-
that identify and integrate the most relevant information            cessing stage is applied, consists in enclosing the connected
across the broader input space. To achieve this, we incor-           relevance regions with bounding boxes and keep only k
porate a publicly available, pretrained vision-language un-          boxes with high relevance score. This step, applied only in
                                                                     the inference stage, is further detailed in Appendix A.1.

                                                                 5
                        DocVXQA: Context-Aware Visual Explanations for Document Question Answering


            M ETHOD                 M ASK T HRESH .     D OC VQA (M ATHEW ET AL ., 2021)          PFL-D OC VQA (T ITO ET AL ., 2024)
                                                        ACC . ↑    ANLS ↑       P IX . R ATIO ↓   ACC . ↑   ANLS ↑        P IX . R ATIO ↓
    P IX 2S TRUCT, UNMASKED
                                            –             0.56       0.68              1           0.80       0.92              1
        (L EE ET AL ., 2023)
    O UR MODEL , UNMASKED                   –             0.51       0.65              1           0.57       0.79              1

                                          0.05            0.34       0.46           0.38           0.06       0.13            0.27
                                          0.10            0.20       0.32           0.20           0.04       0.10            0.17
        R AW ATTENTION
                                          0.25            0.07       0.13           0.08           0.01       0.04            0.09
                                          0.50            0.03       0.08           0.04           0.00       0.01            0.05
     ATTENTION ROLLOUT                   0.01             0.03       0.07           0.04           0.00       0.02            0.03
  (A BNAR & Z UIDEMA , 2020)           1 × 10−5           0.06       0.11           0.07           0.00       0.03            0.05
          G RAD -CAM
                                          0.50            0.01       0.05           0.18           0.00       0.03            0.16
   (S ELVARAJU ET AL ., 2017)
    C OL PALI+P IX 2S TRUCT
                                          0.50            0.38       0.50           0.23           0.28       0.39            0.18
    (FAYSSE ET AL ., 2024)
                                          0.70            0.38       0.54           0.23           0.43       0.66            0.22
              O URS
                                          0.80            0.30       0.46           0.11           0.33       0.54            0.13

Table 1. Evaluation of various explainability methods under different mask threshold settings on the DocVQA task. The results demonstrate
the trade-offs between the interpretability and utility of the different approaches. The unmasked approaches are set for reference as upper
bounds for utility.


4. Experiments and Results                                                raw attention (obtained from Pix2Struct’s last layer) and
                                                                          attention rollout (Abnar & Zuidema, 2020), which use
4.1. Experimental Setup                                                   aggregated attention weights across all layers to provide a
We posit that a good explanation map should highlight all                 more holistic view of the model’s focus.
the critical regions necessary to answer a question while               • Gradient Baselines: We implemented Grad-CAM (Sel-
minimizing irrelevant areas correctly, thus being both suffi-             varaju et al., 2017), adapting it for the autoregressive
cient and minimal. We experimentally compare our method                   sequence output layer by applying it to each output token
against several baseline techniques to evaluate both qualities.           from the decoder and aggregating the resulting maps.
The evaluation process is structured as follows: explanation            • Retrieval Baseline: This approach utilizes ColPali (Faysse
masks are generated using different methods, then postpro-                et al., 2024), a retrieval-based framework. Here, the in-
cessed and binarized to keep only the relevant information                put (question + answer) is first processed by ColPali on
when applied to the original document image. After that,                  its own to generate a heatmap as the explanation. This
masks are applied and the resulting image is passed to our                heatmap is then applied to the image, which is subse-
fine-tuned Pix2Struct to predict the answer. Predicted an-                quently passed to the Pix2Struct model for prediction. We
swer is compared with the ground truth (GT) using accuracy                call this baseline ColPali+Pix2Struct.
and average normalized Levenshtein similarity (ANLS) to
assess the sufficiency. Furthermore, the proportion of high-            4.3. Results
lighted relevant regions in the mask relative to the total
                                                                        Quantitative Evaluation The results obtained are sum-
image area, referred to as the pixel ratio, is calculated to
                                                                        marized in Table 1, where different methods are evaluated to
measure mask minimality. An ideal method achieves a fa-
                                                                        balance utility and explainability. As a reference for upper
vorable trade-off between explanation utility (accuracy and
                                                                        bound utility, we include results for unmasked images using
ANLS) and minimality (pixel ratio). The experiments are
                                                                        the original Pix2Struct model and our trained model. Al-
done on two datasets, DocVQA (Mathew et al., 2021) and
                                                                        though our model exhibits a slight decrease in performance,
PFL-DocVQA (Tito et al., 2024).
                                                                        this can be attributed to the challenge of simultaneously
                                                                        managing both masked and clear images during training.
4.2. Baselines
                                                                        Our approach stands out among the explainable methods,
We compare our approach against three categories of base-               achieving the best utility in terms of accuracy and ANLS
line methods:                                                           while maintaining a modest pixel ratio. This highlights the
• Attention Baselines: In this category, we include both                method’s ability to focus on the most critical regions of the


                                                                    6
                      DocVXQA: Context-Aware Visual Explanations for Document Question Answering




         Original Image               Raw Attention (0.5)              Raw Attention (0.1)             Raw Attention (0.05)




      ColPali+Pix2Struct                   Att. rollout                     Grad-CAM                        Ours (0.7)

Figure 3. A comparison of explanations generated by different methods for the question “What is the total amount?” with the model’s
answer being “$180,000”. Relevance maps with different (thresholds) are applied to the input image to keep only the relevant regions.
Best viewed at high zoom. Additional qualitative results across diverse contextual scenarios are provided in Appendix B.3.

input image, providing concise yet effective explanations.           ter utility at the same ratio, as well as significantly better
In contrast, raw attention exhibits reasonable performance           performance on the PFL-DocVQA dataset, which further
when the mask threshold is set very low, as this results in          shows the efficacy of our approach.
large pixel ratios that cover a significant portion of the im-
age. However, as the threshold increases, raw attention’s            Qualitative Evaluation To reflect the results presented
utility metrics degrade significantly, suggesting it strug-          in Table 1, we illustrate the relevance masks generated by
gles to maintain performance when forced to operate with             different methods in Figure 3. Each method was tasked with
smaller, more answer-overfitted explanations. Attention              explaining the model’s response to the question “What is the
rollout, while offering a more comprehensive aggregation             total amount?”, where the predicted answer is “$180,000”.
of attention weights across layers, performs poorly overall.         The explanation masks are overlaid on the input image to
Its failure to accurately localize relevant regions is likely        highlight regions deemed relevant for the prediction. From
due to the propagation of errors (missing the contextual             the visualizations, it is evident that our method produces
regions) across layers, which focused the relevant regions           explanations that are both precise and comprehensive. Com-
only around the answer. Grad-CAM, despite its popularity,            pared to baseline methods, such as ColPali+Pix2Struct,
also shows weak performance in this context. This can be             Attention Rollout, and Raw Attention, our approach suc-
attributed to the challenges of adapting Grad-CAM to autore-         cessfully isolates all the textual elements contributing to the
gressive sequence models, where token-level aggregation              final answer in a relevance map that is easy to visually pro-
may reduce its ability to generate precise explanations. Fi-         cess by a human, while avoiding irrelevant regions. Notably,
nally, the ColPali+Pix2Struct approach demonstrates com-             Grad-CAM focuses on certain parts of the document that
petitive utility metrics with reasonable pixel ratios on the         do not contain all the required information to answer the
DocVQA dataset, however, our method achieves even bet-               question by the model.

                                                                 7
                       DocVXQA: Context-Aware Visual Explanations for Document Question Answering


                                                                             S     M      TI    ACC . ↑    ANLS ↑       P IXEL R ATIO ↓
                                                                                                  0.51        0.65             1
                                                                                                  0.19        0.36            0.02
                                                                                                  0.38        0.54            0.23

                                                                          Table 2. Ablation study on the impact of different learning objec-
                                                                          tives. S: sufficiency, M: minimality, TI: Token Interactions.



                                                                            M ETHOD                        C ONTEXT ↑        C LARITY ↑
                                                                            R AW ATTENTION (0.25)          2.90 ± 0.48       2.75 ± 0.42
                                                                            R AW ATTENTION (0.50)          2.26 ± 0.54       2.34 ± 0.60
                                                                            C OL PALI+P IX 2S TRUCT        3.97 ± 0.25       3.02 ± 0.42
Figure 4. Performance of our method with and without postpro-               O URS (0.7)                    4.49 ± 0.26       3.56 ± 0.41
cessing, under different thresholds applied to the relevance masks.
                                                                          Table 3. Results of the human evaluation of the explanation quality
When these masked images were fed back into the model,                    for different methods. Participants rated on a scale of 1 to 5.
all methods except Grad-CAM produced the correct answer.
However, this does not necessarily indicate good relevance
maps. In such scenarios, highlighting only any number                     This indicates that the model identifies the entire image as
will lead the DocVQA to use it as an answer, even without                 relevant, maximizing coverage but lacking precision. When
evidence that it corresponds to the “total”. Our method lever-            both sufficiency and minimality losses are employed, the
ages the most clear and context-aware explanation. This                   Pixel Ratio drastically decreases to 0.02, demonstrating the
results in an accurate visualization of the reasoning process,            effectiveness of minimality in constraining the mask to small
which enhances users’ ability to understand the model’s                   regions that are necessary to answer the question. However,
decision-making, and fosters greater trust and confidence in              this extreme reduction leads to overfitting, as the model
the system.                                                               disregards accompanying context that may be important for
                                                                          generalization. Consequently, both Accuracy and ANLS sig-
                                                                          nificantly decrease on the test data, highlighting a trade-off
Effect of Post-processing To study the impact of postpro-
                                                                          between precision and informativeness. Finally, the inclu-
cessing and thresholding on the resultant masks, we perform
                                                                          sion of token interactions loss (S+M+TI) balances these
the experiment presented in Figure 4. The experiment high-
                                                                          trade-offs, improving mask coverage on the context leading
light the trade-offs between precision and coverage when ap-
                                                                          to achieving significant gains in Accuracy and ANLS.
plying different thresholds and when using postprocessing.
Lower thresholds achieve higher Accuracy and ANLS but at
the cost of significantly larger Pixel Ratios, indicating less            Human Evaluation The goal of developing explainable
precise localization of relevance regions. As the threshold               DocVQA models is to enhance human trust in these systems.
increases, Pixel Ratio decreases, leading to more focused                 To experimentally assess the quality of the explanations, we
masks but with a corresponding decline in Accuracy and                    conducted a human evaluation study with 42 impartial par-
ANLS. When postprocessing is applied, the results show an                 ticipants, blind to the details of our method. We used 10
improvement in the accuracy and ANLS with a reduction in                  example document images. For each image, participants
Pixel ratio with a threshold ≥ 0.7. This improvement under-               were shown a corresponding question, the ground truth (GT)
scores the importance of postprocessing as a critical step in             answer, and four different explanation masks generated from
refining the outputs of our method, balancing relevance and               relevance maps of the top-performing methods seen in Ta-
mask quality.                                                             ble 1, based on the trade-offs between Accuracy, ANLS,
                                                                          and Pixel Ratio–this includes ColPali, raw attention, and
                                                                          our own method. Participants were asked to evaluate each
Learning Objectives In our method, three learning objec-
                                                                          explanation on two key criteria, rated on a scale of 1 to 5:
tives are used during training: Sufficiency (S), Minimality
(M), and Token Interactions (TI). To evaluate their individ-              • Context-awareness of the explanation: Participants re-
ual and combined contributions to performance, we con-                      sponded to the question: “How confident are you (1-5)
ducted an ablation study, as shown in Table 2. The first                    to answer the question using only this masked image?”
row, where only the sufficiency loss is applied, achieves the               This question assesses whether the explanation directly
highest Accuracy and ANLS but has the largest Pixel Ratio.                  supports the answer and provides all the necessary context

                                                                      8
                     DocVXQA: Context-Aware Visual Explanations for Document Question Answering

  to answer.                                                        aligned with human reasoning. This is achieved by formu-
• Clarity of the explanation: Participants responded to the         lating and including fundamental explainability principles
  question: “Does the masked image include only all the             directly into the learning process. Our extensive evaluations
  necessary information in a clear, concise, and comprehen-         demonstrate the effectiveness of our framework.
  sive way to fully explain the model’s reasoning? Rate on
                                                                    Future research will explore the generalization of our
  a scale (1-5).” This question evaluates the extent to which
                                                                    method across diverse DocVQA architectures and datasets,
  the explanation provides thorough, focused and human
                                                                    as well as optimizing the trade-off between explainability
  comprehensive coverage of the relevant content.
                                                                    and task performance. We envision DocVXQA as a step-
The results of the human evaluation are presented in Table 3.       ping stone toward robust, transparent, and user-centric AI
As shown, our method outperforms all baselines in both              solutions in document intelligence.
context-awareness and clarity, achieving the highest scores,
compared to ColPali and Raw Attention variants. These               Acknowledgments
results highlight our method’s ability to generate clear ex-
planations that enable participants to confidently answer           We thank all participants for their contributions to the hu-
questions without the original image, while also providing          man preference study. This work has been supported by the
comprehensive and focused masks that include only the nec-          Consolidated Research Group 2021 SGR 01559 from the
essary information. Thus, using our method enhances user            Research and University Department of the Catalan Gov-
trust and understanding of the model’s predictions.                 ernment, and by project PID2023-146426NB-100 funded
                                                                    by MCIU/AEI/10.13039/501100011033 and FSE+. This
Furthermore, we conducted another human preference study            work has been funded by the European Lighthouse on Safe
to directly compare the masks of our method against the             and Secure AI (ELSA) from the European Union’s Horizon
top-performing baseline in the previous study, that is Col-         Europe programme under grant agreement No 101070617.
Pali+Pix2Struct. In total, 12 participants evaluated 21 ran-        The work of Changkyu Choi is supported by Visual Intelli-
domly selected question-answer pairs (252 trials in total).         gence, a centre for research-based innovation funded by the
As a result, our method was preferred in 163 trials (64.7%;         Research Council of Norway and its consortium partners
95% CI [58.4%, 70.6%], p << 0.001), with all participants           (RCN grant no. 309439).
(12/12) favoring our approach overall. Thus, our method
is offering a significantly more compact and interpretable
explanations than ColPali+Pix2Struct.                               Impact Statement
                                                                    To the best of our knowledge, this work is the first to
Model Agnosticity Our DocVXQA framework is de-                      introduce explainability into the DocVQA applications.
signed to be model-agnostic. To demonstrate its architec-           As DocVQA systems are increasingly deployed in high-
tural flexibility, we implemented it with Donut (Kim et al.,        stakes domains such as banking, healthcare, and public
2021) as an alternative to Pix2Struct. Notably, Donut and           administration–where automated document understanding
Pix2Struct differ fundamentally in how they incorporate the         aims to reduce human involvement–the demand for trans-
question. Pix2Struct renders the question directly onto the         parent and trustworthy models becomes paramount. Our
input image, while Donut tokenizes the question and uses it         approach addresses this urgent gap by enabling interpretabil-
to condition the decoder during generation. To accommo-             ity of DocVQA models, which is essential for ensuring re-
date this difference, we adapt our method by modifying the          liability, fostering user trust, and facilitating responsible
mask head to also incorporate the encoded question. Quali-          deployment of AI in sensitive real-world contexts.
tative results presented in Appendix B.4 illustrate that our
method consistently identifies relevant regions across both
backbones, validating its model-agnostic design.
                                                                    References
                                                                    Abdallah, A., Piryani, B., and Jatowt, A. Exploring the state
5. Conclusion                                                         of the art in legal qa systems. Journal of Big Data, 10(1):
                                                                     127, 2023.
This paper introduced DocVXQA, the first self-explainable
model for DocVQA, enhancing interpretability by learn-              Abnar, S. and Zuidema, W. Quantifying attention flow in
ing relevance maps that elucidate the model’s decisions.              transformers. In Proceedings of the 58th Annual Meet-
Unlike conventional approaches that rely on post-hoc ex-              ing of the Association for Computational Linguistics, pp.
planations or merely justify answers without deep contex-            4190–4197, 2020.
tual grounding, DocVXQA inherently generates visual and
context-aware explanations to the answers, ensuring that            Achiam, J., Adler, S., Agarwal, S., Ahmad, L., Akkaya, I.,
the model’s process remains transparent, interpretable, and           Aleman, F. L., Almeida, D., Altenschmidt, J., Altman, S.,

                                                                9
                      DocVXQA: Context-Aware Visual Explanations for Document Question Answering

  Anadkat, S., et al. Gpt-4 technical report. arXiv preprint          Chefer, H., Gur, S., and Wolf, L. Generic attention-model
  arXiv:2303.08774, 2023.                                               explainability for interpreting bi-modal and encoder-
                                                                        decoder transformers. In Proceedings of the IEEE/CVF
Aggarwal, K., Khandelwal, A., Tanmay, K., Khan, O. M.,                  International Conference on Computer Vision, pp. 397–
  Liu, Q., Choudhury, M., Chauhan, H. H., Som, S.,                      406, 2021a.
  Chaudhary, V., and Tiwary, S. Dublin–document un-
  derstanding by language-image network. arXiv preprint               Chefer, H., Gur, S., and Wolf, L. Transformer interpretabil-
  arXiv:2305.14218, 2023.                                               ity beyond attention visualization. In Proceedings of the
                                                                        IEEE/CVF conference on computer vision and pattern
Alvarez Melis, D. and Jaakkola, T. Towards robust in-
                                                                        recognition, pp. 782–791, 2021b.
  terpretability with self-explaining neural networks. Ad-
  vances in neural information processing systems, 31,                Choi, C., Yu, S., Kampffmeyer, M., Salberg, A.-B., Hande-
  2018.                                                                 gard, N. O., and Jenssen, R. Dib-x: Formulating explain-
Amjad, R. A. and Geiger, B. C. Learning representations for             ability principles for a self-explainable model through
 neural network-based classification using the information              information theoretic learning. In ICASSP 2024-2024
 bottleneck principle. IEEE transactions on pattern analy-              IEEE International Conference on Acoustics, Speech and
 sis and machine intelligence, 42(9):2225–2239, 2019.                   Signal Processing (ICASSP), pp. 7170–7174. IEEE, 2024.

Appalaraju, S., Tang, P., Dong, Q., Sankaran, N., Zhou,               Covert, I., Lundberg, S., and Lee, S.-I. Explaining by remov-
 Y., and Manmatha, R. Docformerv2: Local features for                   ing: A unified framework for model explanation. Journal
  document understanding. In Proceedings of the AAAI                    of Machine Learning Research, 22(209):1–90, 2021.
 Conference on Artificial Intelligence, volume 38, pp. 709–
 718, 2024.                                                           Davis, B., Morse, B., Price, B., Tensmeyer, C., Wigington,
                                                                        C., and Morariu, V. End-to-end document recognition
Bach, S., Binder, A., Montavon, G., Klauschen, F., Müller,             and understanding with dessurt. In European Conference
  K.-R., and Samek, W. On pixel-wise explanations for                   on Computer Vision, pp. 280–296. Springer, 2022.
  non-linear classifier decisions by layer-wise relevance
  propagation. PloS one, 10(7):e0130140, 2015.                        Faysse, M., Sibille, H., Wu, T., Omrani, B., Viaud, G.,
                                                                        Hudelot, C., and Colombo, P. Colpali: Efficient document
Bang, S., Xie, P., Lee, H., Wu, W., and Xing, E. Explaining             retrieval with vision language models. arXiv preprint
  a black-box by using a deep variational information bot-              arXiv:2407.01449, 2024.
  tleneck approach. In Proceedings of the AAAI conference
  on artificial intelligence, volume 35, pp. 11396–11404,             Gautam, S., Boubekki, A., Hansen, S., Salahuddin, S.,
  2021.                                                                 Jenssen, R., Höhne, M., and Kampffmeyer, M. Protovae:
                                                                        A trustworthy self-explainable prototypical variational
Belghazi, I., Baratin, A., Rajeshwar, S., Ozair, S., Bengio,
                                                                        model. Advances in Neural Information Processing Sys-
  Y., Courville, A., and Hjelm, R. D. Mine: Mutual in-
                                                                        tems, 35:17940–17952, 2022.
  formation neural estimation. In Proceedings of the 35th
  International Conference on Machine Learning (ICML),                Gautam, S., Höhne, M. M.-C., Hansen, S., Jenssen, R., and
  volume 80, pp. 531–540. PMLR, 2018.                                   Kampffmeyer, M. This looks more like that: Enhancing
Blau, T., Fogel, S., Ronen, R., Golts, A., Ganz, R., Ben Avra-          self-explaining models by prototypical relevance propa-
  ham, E., Aberdam, A., Tsiper, S., and Litman, R. Gram:                gation. Pattern Recognition, 136:109172, 2023.
  Global reasoning for multi-page vqa. In Proceedings
  of the IEEE/CVF Conference on Computer Vision and                   Giovannini, S., Coppini, F., Gemelli, A., and Marinai, S.
  Pattern Recognition, pp. 15598–15607, 2024.                           Boundingdocs: a unified dataset for document ques-
                                                                        tion answering with spatial annotations. arXiv preprint
Bousselham, W., Petersen, F., Ferrari, V., and Kuehne, H.               arXiv:2501.03403, 2025.
  Grounding everything: Emerging localization properties
  in vision-language transformers. In Proceedings of the              Giraldo, L. G. S., Rao, M., and Principe, J. C. Measures
  IEEE/CVF Conference on Computer Vision and Pattern                    of entropy from data using infinitely divisible kernels.
  Recognition, pp. 3828–3837, 2024.                                     IEEE Transactions on Information Theory, 61(1):535–
                                                                        548, 2014.
Bui, K., Lou, Y., Park, F., and Xin, J. Weighted anisotropic–
  isotropic total variation for poisson denoising. In 2023            Jenssen, R. Map it to visualize representations. In The
  IEEE International Conference on Image Processing                     Twelfth International Conference on Learning Represen-
  (ICIP), pp. 1020–1024. IEEE, 2023.                                    tations, 2024.

                                                                 10
                     DocVXQA: Context-Aware Visual Explanations for Document Question Answering

Johnson, J., Alahi, A., and Fei-Fei, L. Perceptual losses           Møller, B. L., Igel, C., Wickstrøm, K. K., Sporring, J.,
  for real-time style transfer and super-resolution. In Com-         Jenssen, R., and Ibragimov, B. Finding nem-u: Explain-
  puter Vision–ECCV 2016: 14th European Conference,                  ing unsupervised representation learning through neural
  Amsterdam, The Netherlands, October 11-14, 2016, Pro-              network generated explanation masks. In Forty-first In-
  ceedings, Part II 14, pp. 694–711. Springer, 2016.                 ternational Conference on Machine Learning, 2024.

Khattab, O. and Zaharia, M. Colbert: Efficient and effective        Müller, R. How explainable ai affects human performance:
  passage search via contextualized late interaction over            A systematic review of the behavioural consequences
  bert. In Proceedings of the 43rd International ACM SIGIR           of saliency maps. International Journal of Human–
  conference on research and development in Information              Computer Interaction, pp. 1–32, 2024.
  Retrieval, pp. 39–48, 2020.                                       Parashar, S., Lin, Z., Liu, T., Dong, X., Li, Y., Ramanan,
                                                                      D., Caverlee, J., and Kong, S. The neglected tails in
Kim, G., Hong, T., Yim, M., Park, J., Yim, J., Hwang,
                                                                      vision-language models. In Proceedings of the IEEE/CVF
  W., Yun, S., Han, D., and Park, S. Donut: Document
                                                                      Conference on Computer Vision and Pattern Recognition,
  understanding transformer without ocr. arXiv preprint
                                                                      pp. 12988–12997, 2024.
  arXiv:2111.15664, 2021.
                                                                    Petsiuk, V.   Rise: Randomized input sampling for
Kim, G., Hong, T., Yim, M., Nam, J., Park, J., Yim, J.,               explanation of black-box models.  arXiv preprint
  Hwang, W., Yun, S., Han, D., and Park, S. Ocr-free docu-            arXiv:1806.07421, 2018.
  ment understanding transformer. In European Conference
  on Computer Vision, pp. 498–517. Springer, 2022.                  Poole, B., Ozair, S., Van Den Oord, A., Alemi, A., and
                                                                      Tucker, G. On variational bounds of mutual information.
Lee, K., Joshi, M., Turc, I. R., Hu, H., Liu, F., Eisensch-           In International Conference on Machine Learning, pp.
  los, J. M., Khandelwal, U., Shaw, P., Chang, M.-W.,                 5171–5180. PMLR, 2019.
  and Toutanova, K. Pix2struct: Screenshot parsing as               Powalski, R., Borchmann, Ł., Jurkiewicz, D., Dwojak, T.,
  pretraining for visual language understanding. In Inter-            Pietruszka, M., and Pałka, G. Going full-tilt boogie on
  national Conference on Machine Learning, pp. 18893–                 document understanding with text-image-layout trans-
  18912. PMLR, 2023.                                                  former. In Document Analysis and Recognition–ICDAR
Li, C., Wong, C., Zhang, S., Usuyama, N., Liu, H., Yang, J.,          2021: 16th International Conference, Lausanne, Switzer-
   Naumann, T., Poon, H., and Gao, J. Llava-med: Training             land, September 5–10, 2021, Proceedings, Part II 16, pp.
   a large language-and-vision assistant for biomedicine in           732–747. Springer, 2021.
   one day. Advances in Neural Information Processing               Principe, J. C. Information theoretic learning: Renyi’s
  Systems, 36, 2024.                                                  entropy and kernel perspectives. Springer Science &
                                                                      Business Media, 2010.
Liu, Q., Guo, G., Mao, J., Dou, Z., Wen, J.-R., Jiang, H.,
  Zhang, X., and Cao, Z. An analysis on matching mech-              Rasheed, H., Maaz, M., Shaji, S., Shaker, A., Khan, S.,
  anisms and token pruning for late-interaction models.               Cholakkal, H., Anwer, R. M., Xing, E., Yang, M.-H., and
  ACM Transactions on Information Systems, 42(5):1–28,                Khan, F. S. Glamm: Pixel grounding large multimodal
  2024.                                                               model. In Proceedings of the IEEE/CVF Conference on
                                                                      Computer Vision and Pattern Recognition, pp. 13009–
Mathew, M., Karatzas, D., and Jawahar, C. Docvqa: A                   13018, 2024.
 dataset for vqa on document images. In Proceedings
                                                                    Ribeiro, M. T., Singh, S., and Guestrin, C. ” why should
 of the IEEE/CVF winter conference on applications of
                                                                      i trust you?” explaining the predictions of any classifier.
 computer vision, pp. 2200–2209, 2021.
                                                                      In Proceedings of the 22nd ACM SIGKDD international
Mathew, M., Bagal, V., Tito, R., Karatzas, D., Valveny,               conference on knowledge discovery and data mining, pp.
 E., and Jawahar, C. Infographicvqa. In Proceedings                   1135–1144, 2016.
 of the IEEE/CVF Winter Conference on Applications of               Rudin, C. Stop explaining black box machine learning
 Computer Vision, pp. 1697–1706, 2022.                                models for high stakes decisions and use interpretable
                                                                      models instead. Nature machine intelligence, 1(5):206–
Mohammadshirazi, A., Neogi, P. P. G., Lim, S.-N., and
                                                                      215, 2019.
 Ramnath, R. Dlava: Document language and vision assis-
 tant for answer localization with enhanced interpretability        Schulz, K., Sixt, L., Tombari, F., and Landgraf, T. Re-
 and trustworthiness. arXiv preprint arXiv:2412.00151,                stricting the flow: Information bottlenecks for attribution.
 2024.                                                                arXiv preprint arXiv:2001.00396, 2020.

                                                               11
                     DocVXQA: Context-Aware Visual Explanations for Document Question Answering

Selvaraju, R. R., Cogswell, M., Das, A., Vedantam, R.,               Ye, J., Hu, A., Xu, H., Ye, Q., Yan, M., Xu, G., Li, C., Tian,
  Parikh, D., and Batra, D. Grad-cam: Visual explana-                  J., Qian, Q., Zhang, J., et al. Ureader: Universal ocr-
  tions from deep networks via gradient-based localization.            free visually-situated language understanding with mul-
  In Proceedings of the IEEE international conference on               timodal large language model. In The 2023 Conference
  computer vision, pp. 618–626, 2017.                                  on Empirical Methods in Natural Language Processing,
                                                                       2023.
Shannon, C. E. A mathematical theory of communication.
  The Bell system technical journal, 27(3):379–423, 1948.            Yu, S., Giraldo, L. G. S., Jenssen, R., and Principe, J. C.
                                                                       Multivariate extension of matrix-based rényi’s α-order
Shrikumar, A., Greenside, P., and Kundaje, A. Learning
                                                                       entropy functional. IEEE transactions on pattern analysis
  important features through propagating activation differ-
                                                                       and machine intelligence, 42(11):2960–2966, 2019.
  ences. In International conference on machine learning,
  pp. 3145–3153. PMlR, 2017.                                         Yu, S., Tang, C., Xu, B., Cui, J., Ran, J., Yan, Y., Liu,
Skean, O., Dhakal, A., Jacobs, N., and Giraldo, L. G. S.               Z., Wang, S., Han, X., Liu, Z., et al. Visrag: Vision-
  Frossl: Frobenius norm minimization for self-supervised              based retrieval-augmented generation on multi-modality
  learning. Proceedings of the European Conference on                  documents. arXiv preprint arXiv:2410.10594, 2024a.
  Computer Vision (ECCV), 2024.                                      Yu, S., Yu, X., Løkse, S., Jenssen, R., and Principe, J. C.
Skean, O., Dhakal, A., Jacobs, N., and Sanchez Giraldo,                Cauchy-schwarz divergence information bottleneck for
  L. G. Frossl: Frobenius norm minimization for efficient              regression. In The Twelfth International Conference on
  multiview self-supervised learning. In European Confer-              Learning Representations, 2024b.
  ence on Computer Vision, pp. 69–85. Springer, 2025.                Zeiler, M. D. and Fergus, R. Visualizing and understand-
Sokol, K. and Flach, P. Explainability fact sheets: a                  ing convolutional networks. In Computer Vision–ECCV
  framework for systematic assessment of explainable ap-               2014: 13th European Conference, Zurich, Switzerland,
  proaches. In Proceedings of the 2020 conference on                   September 6-12, 2014, Proceedings, Part I 13, pp. 818–
  fairness, accountability, and transparency, pp. 56–67,               833. Springer, 2014.
  2020.
                                                                     Zhang, H., Torres, F., Sicre, R., Avrithis, Y., and Ayache, S.
Tishby, N. and Zaslavsky, N. Deep learning and the infor-              Opti-cam: Optimizing saliency maps for interpretability.
  mation bottleneck principle. In 2015 ieee information                Computer Vision and Image Understanding, 248:104101,
  theory workshop (itw), pp. 1–5. IEEE, 2015.                          2024.

Tito, R., Karatzas, D., and Valveny, E. Hierarchical multi-          Zhang, Y., Zhang, R., Gu, J., Zhou, Y., Lipka, N., Yang,
  modal transformers for multipage docvqa. Pattern Recog-              D., and Sun, T. Llavar: Enhanced visual instruction
  nition, 144:109834, 2023.                                            tuning for text-rich image understanding. arXiv preprint
                                                                       arXiv:2306.17107, 2023.
Tito, R., Nguyen, K., Tobaben, M., Kerkouche, R., Souibgui,
   M. A., Jung, K., Jälkö, J., D’Andecy, V. P., Joseph, A.,        Zhao, Y., Pang, T., Du, C., Yang, X., Li, C., Cheung, N.-
   Kang, L., et al. Privacy-aware document visual question             M. M., and Lin, M. On evaluating adversarial robustness
   answering. In International Conference on Document                  of large vision-language models. Advances in Neural
  Analysis and Recognition, pp. 199–218. Springer, 2024.               Information Processing Systems, 36, 2024.
Wang, P., Bai, S., Tan, S., Wang, S., Fan, Z., Bai, J., Chen,        Zhmoginov, A., Fischer, I., and Sandler, M. Information-
 K., Liu, X., Wang, J., Ge, W., et al. Qwen2-vl: Enhancing             bottleneck approach to salient region discovery. In Ma-
 vision-language model’s perception of the world at any                chine Learning and Knowledge Discovery in Databases:
 resolution. arXiv preprint arXiv:2409.12191, 2024.                    European Conference, ECML PKDD 2020, Ghent, Bel-
                                                                       gium, September 14–18, 2020, Proceedings, Part III, pp.
Wu, S., Irsoy, O., Lu, S., Dabravolski, V., Dredze, M.,
                                                                       531–546. Springer, 2021.
 Gehrmann, S., Kambadur, P., Rosenberg, D., and Mann,
 G. Bloomberggpt: A large language model for finance.                Zhou, Y., Chen, Y., Lin, H., Yang, S., Zhu, L., Qi, Z.,
 arXiv preprint arXiv:2303.17564, 2023.                                Ma, C., and Shan, Y. Doge: Towards versatile vi-
Xu, Y., Li, M., Cui, L., Huang, S., Wei, F., and Zhou, M.              sual document grounding and referring. arXiv preprint
  Layoutlm: Pre-training of text and layout for document               arXiv:2411.17125, 2024.
  image understanding. In Proceedings of the 26th ACM
 SIGKDD international conference on knowledge discov-
  ery & data mining, pp. 1192–1200, 2020.

                                                                12
                                                          Appendix


To ensure consistency, we continue the numbering of figures and tables from the main paper. The first references in the
Appendix begin with Figure 5 and Table 4.

A. Implementation Details
A.1. Postprocessing
The relevance map produced by our method is passed throught a postprocessing step that envolve 2 stages: (1) background
removal, (2) connected region bounding. In the following we detail each step, noting that for a fair comparison, these three
steps are applied to all the methods presented in Table 1:

Background Removal. Since the output mask may highlight irrelevant background regions, we first filter out the
highlighted regions that fall input image tokens that represent background. In other words, we discard tokens whose encoded
patch variance are below a threshold of 0.01, as they are considered background in the document images, where in this
domain the background is usually blank. This step ensures that only informative regions contribute to the final relevance
map. In Figure 5, we show an extreme case of this scenario, where the produced relevance map contain a lot of background
regions, after applying this postprocessing step, we can see that the quality of the map is significantly improved.




                                                          Predicted Mask                            Predicted Mask
                  Original
                                                         (with bg regions)                        (without bg regions)

Figure 5. Visualization of the background removal step in our methods. Question: “What is the estimated budget of ‘conduct analysis of
decision makers/ information targets’ in research and development?”. Model answer “$ 7,000.00”.

Bounding connected regions. After filtering out background regions, the remaining mask effectively highlights relevant
information, as shown in Figure 5. However, the raw mask may still appear fragmented and less intuitive for users.
To enhance interpretability, we apply an additional postprocessing step that identifies connected components within the
relevance map and encloses them in bounding boxes. We chose this approach because text in documents is best highlighted
using bounding boxes, ensuring clear visibility and structured localization. Unlike other forms of heatmaps, which may
appear vague or ambiguous, bounding boxes provide a precise, easily interpretable representation of the model’s focus
which facilitate its processing by human users.

                                                                 13
                       DocVXQA: Context-Aware Visual Explanations for Document Question Answering

After that, we rank these regions based on their confidence scores and retain only the top k most relevant boxes. This step,
shown in Figure 6, ensures that the final explanation is both compact and user-friendly. In our study, we experimented with
different values of k and found that k = 3 provided the best balance between conciseness and completeness.




                                                                                                     Predicted Mask
                  Original                                Predicted Mask
                                                                                                (with full postprocessing)

Figure 6. Visualization of connecting the relevance regions in the heatmap and keeping only 1 region with top confidence score (k = 1).
Question: “What is the estimated budget of ‘conduct analysis of decision makers/ information targets’ in research and development?”.
Model answer “$ 7,000.00”.


A.2. Mask head
The implemented mask head is a fully connected neural network (MLP-based decoder) designed to process an input consists
of the concatenation of the encoded tokens (features), decoder attentions and the positional encoding. The mask head
generates a relevance score for each token, producing a relevance map that highlights the most important regions in terms of
influence on the final answer. During training, the output of the mask head is passed through a Sigmoid activation function
to ensure that the values are normalized between 0 and 1, applied to the input image, and then passed to the Pix2Struct
component for the masked image prediction.

A.3. Hyperparameters
We summarize the values of the hyperparameters used in this paper. We not that the Pix2Struct component is first fine-tuned
on the DocVQA dataset (Mathew et al., 2021), then our proposed model is trained according to the settings presented in
Table 4. Note that in our work, we use the base version of Pix2Struct with 282M parameters. The model is composed of 12
encoder and 12 decoder layers with a hidden size of 768.



                                       H YPERPARAMETER                               VALUE
                                       L EARNING R ATE                              1 × 10−7
                                       BATCH S IZE                                      5
                                       O PTIMIZER                                   A DAM W
                                       γ                                               0.5
                                       β                                                5
                                       T HRESHOLD (k) FOR P OSTPROCESSING               3

                                               Table 4. H YPERPARAMETER S ETTINGS


                                                                 14
                       DocVXQA: Context-Aware Visual Explanations for Document Question Answering

B. Additional Results
B.1. Selection of k.
As illustrated in Figure 6, during the post-processing step, we retain only the top-k most relevant boxes. We conducted an
ablation study to evaluate the impact of different k values and found that k = 3 offers the best trade-off between conciseness
and completeness. The full results across various k values are reported in Table 5. As shown, k = 3 is considered the best
choice for a good trade-off between interpretability and utility.




                                          k      ACCURACY       ANLS       P IXEL R ATIO
                                           1        0.36         0.52           0.21
                                           2        0.38         0.53           0.23
                                           3        0.38         0.54           0.24
                                           4        0.39         0.55           0.25
                                           5        0.39         0.55           0.26
                                           8        0.40         0.56           0.28
                                          10        0.41         0.57           0.29
                                          15        0.42         0.58           0.31
                                          20        0.43         0.58           0.32
                                          50        0.45         0.59           0.38
                                         100        0.45         0.60           0.40

                        Table 5. A study on varying the number of top relevant boxes during post-processing.




B.2. The effect of using token interactions.
As we discussed in Section 3.4, training the model using the objective function in Equation (1) (without the use of token
interactivity loss), lead to overfitting to the regions that directly corresponding to the answer. This overfitting reduces the
mask’s utility, rendering it a mere visual reproduction of the textual answer rather than providing meaningful, context-aware
insights. This can be seen in Figure 7, where we show qualitative results of our method.

                                                                15
                      DocVXQA: Context-Aware Visual Explanations for Document Question Answering




    What is the total foreign exchange
                                                    Clear Answer: “450.4”                      Clear Answer: “450.4”
    used for raw materials(Rs.lac)??
            Answer: “450.4”                        Masked Answer: “450.4”                    Masked Answer: “450.4”




          What is the equipment
                                                    Clear Answer: “6,000”                      Clear Answer: “6,000”
          maintenance expenses?
            Answer: “6,000”                        Masked Answer: “6,000”                    Masked Answer: “6,000”




        What is the delivery point
                                                 Clear Answer: “philips bank”               Clear Answer: “miops Reid”
         mentioned in the form?
       GT Answer: “phipps bend”                Masked Answer: “philips bank”            Masked Answer: “shipping pound”

Figure 7. Visualization of the effect of using token interactions in our method. Left: Original Image. Middle: Masked image with
relevance map learned without token interactions loss. Right: Masked image with relevance map learned with token interactions loss.

                                                                16
                       DocVXQA: Context-Aware Visual Explanations for Document Question Answering

B.3. Additional qualitative results
In this section, we present the results of the applied relevant regions masks on the images (right) across diverse contextual
scenarios, in comparison to the corresponding full images (left).

Complex layouts       We test our approach on documents with complex layouts from the InfographicVQA dataset (Mathew
et al., 2022).




Figure 8. Question: What is the total percentage of Palestinians residing at places other than West Bank and Arab countries?
Answer: 32.6 % (correct).




Figure 9. Question: What is the percentage of women with disabilities in low income countries?
Answer: 22.1 % (correct).




                                                                 17
                    DocVXQA: Context-Aware Visual Explanations for Document Question Answering

Densely populated documents We present results on documents containing dense textual content.




    Figure 10. Question: Under Private service how many patients were discharged in Neurology?    Answer: 696 (correct).




         Figure 11. Question: What is the estimated cost of Space costs and Rentals?         Answer: 700 (correct).




                                                              18
                    DocVXQA: Context-Aware Visual Explanations for Document Question Answering

Degraded quality We present results on documents with degraded visual quality.




                   Figure 12. Question: What is the page number?                       Answer: 9 (correct).




          Figure 13. Question: How many cases of artworks are there in the shipment?            Answer: 1 (correct).




          Figure 14. Question: Which bank’s check is this?            Answer: The chase manhattan bank (correct).




                                                             19
                     DocVXQA: Context-Aware Visual Explanations for Document Question Answering

B.4. Results with a different backbone
In this section, we show the results of DocVXQA using the Donut backbone (Kim et al., 2021), and compare it with the
Pix2Struct backbone. The obtained results are given in Figure 15, Figure 16 and Figure 17, demonstrating the model-agnostic
capability of our method. These figures highlight the relevant regions produced by DocVXQA using two different backbones
while answering the same questions.




              Figure 15. Question: Who is this question addressed to?                   Answer: bob bexon (correct).




         Figure 16. Question: What is the amount for publising one poster / abstract?           Answer: $8,500 (correct).




                                                               20
                 DocVXQA: Context-Aware Visual Explanations for Document Question Answering




Figure 17. Question: what type of communication is issued by Biomet, inc.?   Answer: royalty payment form (correct).




                                                          21
