Knowledge-Based Counterfactual Queries for Visual Question Answering

Theodoti Stoikou, Maria Lymperaiou, Giorgos Stamou

Abstract

Visual Question Answering (VQA) has been a popular task that combines vision and language, with numerous relevant implementations in literature. Even though there are some attempts that approach explainability and robustness issues in VQA models, very few of them employ counterfactuals as a means of probing such challenges in a model-agnostic way. In this work, we propose a systematic method for explaining the behavior and investigating the robustness of VQA models through counterfactual perturbations. For this reason, we exploit structured knowledge bases to perform deterministic, optimal and controllable word-level replacements targeting the linguistic modality, and we then evaluate the model's response against such counterfactual inputs. Finally, we qualitatively extract local and global explanations based on counterfactual responses, which are ultimately proven insightful towards interpreting VQA model behaviors. By performing a variety of perturbation types, targeting different parts of speech of the input question, we gain insights to the reasoning of the model, through the comparison of its responses in different adversarial circumstances. Overall, we reveal possible biases in the decision-making process of the model, as well as expected and unexpected patterns, which impact its performance quantitatively and qualitatively, as indicated by our analysis.

Introduction

Visual Question Answering (VQA) models have achieved remarkable performance, yet they often remain "black boxes." A critical concern in the field is whether these models are performing genuine multimodal reasoning or simply exploiting statistical shortcuts and linguistic biases within the training data. While previous research has focused heavily on visual bias, this paper introduces a systematic, model-agnostic framework to probe the robustness and explainability of VQA models using knowledge-based counterfactuals. By swapping or deleting specific words in a question, the authors reveal hidden linguistic biases and reasoning patterns that cause state-of-the-art models to fail even when semantic changes are minimal.

Methodology

The core of the proposed framework is the generation of counterfactual queries: versions of the original question with minimal, deterministic changes designed to test specific linguistic concepts. To ensure these changes are semantically valid, the approach leverages external knowledge sources:

The proposed framework pipeline, showing how knowledge hierarchies inform question perturbations to probe VQA model behavior and extract explanations.
  • WordNet Hierarchy: Used for word-level replacements based on lexical relationships, including synonyms, hypernyms/hyponyms (e.g., "dog" to "canine" or "labrador"), and siblings (e.g., swapping "cat" for "dog").
  • Color Relatedness Hierarchy: A custom hierarchy based on RGB distances used to test sensitivity to color descriptions, ranging from "Color Maximal" (distant colors) to "Color Minimal" (nearly identical shades).
  • Structural Deletions: Removing key nouns to observe how the model handles linguistic ambiguity.
Examples of the various perturbation types applied to a base question to create counterfactual queries.

Experimental Results

The framework was evaluated using the ViLT (Vision-and-Language Transformer) model on the VQA-v2 and Visual Genome (VG) datasets. The study found that even semantically minimal changes led to a significant drop in performance, with accuracy declining by 15-20% or more across experiments.

Key Insights

  • Linguistic Overfitting: Models often show an "unwanted attachment" to specific common words. For instance, swapping the verb "see" with a synonym like "watch" or "understand" often caused the model to fail, suggesting it has memorized patterns rather than learning the underlying concept of perception.
  • Color Sensitivity: In the VQA-v2 dataset, "Color Maximal" perturbations caused a 34.2% decline in accuracy. Surprisingly, even "Color Minimal" changes (nearly identical colors) caused a 31% decline, revealing a lack of robustness to slight phrasing variations.
  • Visual Dominance: When a key noun is deleted, the model rarely expresses uncertainty. Instead, it typically defaults to naming the most dominant object in the image, showing that the visual modality often overrides the linguistic one when the text is ambiguous.
  • Generalization Gaps: While the model reasoned well over hierarchical changes for animals, it failed significantly when dealing with clothing categories, such as struggling to generalize "shirt" to "garment."

Conclusion and Future Work

This study serves as a proof of concept for using structured knowledge to diagnose the internal reasoning of VQA models. The results highlight that current models are highly sensitive to linguistic variations that do not change the fundamental meaning of a query. Future work aims to expand this framework to multiple-choice VQA and other multimodal tasks, as well as crafting similar knowledge-based counterfactuals for the visual modality.

Summary updated

Abstract

Visual Question Answering (VQA) has been a popular task that combines vision and language, with numerous relevant implementations in literature. Even though there are some attempts that approach explainability and robustness issues in VQA models, very few of them employ counterfactuals as a means of probing such challenges in a model-agnostic way. In this work, we propose a systematic method for explaining the behavior and investigating the robustness of VQA models through counterfactual perturbations. For this reason, we exploit structured knowledge bases to perform deterministic, optimal and controllable word-level replacements targeting the linguistic modality, and we then evaluate the model's response against such counterfactual inputs. Finally, we qualitatively extract local and global explanations based on counterfactual responses, which are ultimately proven insightful towards interpreting VQA model behaviors. By performing a variety of perturbation types, targeting different parts of speech of the input question, we gain insights to the reasoning of the model, through the comparison of its responses in different adversarial circumstances. Overall, we reveal possible biases in the decision-making process of the model, as well as expected and unexpected patterns, which impact its performance quantitatively and qualitatively, as indicated by our analysis.
BibTeX
@inproceedings{stoikou2023knowledge,
  author = {Theodoti Stoikou and Maria Lymperaiou and Giorgos Stamou},
  title = {{Knowledge-Based Counterfactual Queries for Visual Question Answering}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  url = {https://openreview.net/forum?id=We0DfwpwTa},
}
Figure