Improving Vision-and-Language Reasoning via Spatial Relations Modeling

Cheng Yang, Rui Xu, Ye Guo, Peixiang Huang, Yiru Chen, Wenkui Ding, Zhongyuan Wang, Hong Zhou

Abstract

Current Vision-and-Language (V&L) models often struggle with complex reasoning tasks because they treat visual objects as isolated entities, ignoring the rich spatial context of a scene. We present a novel framework that explicitly models spatial relationships through two new pre-training tasks: Object Position Regression (OPR) and Spatial Relation Classification (SRC). By reconstructing a Spatial Relation Graph, our model learns to understand object layouts and geometric dependencies. This approach achieves state-of-the-art performance on benchmarks like Visual Commonsense Reasoning (VCR), VQA 2.0, and NLVR², demonstrating that spatial awareness is a critical component for deep multimodal understanding.

Introduction

State-of-the-art V&L models, such as UNITER and ViLBERT, have successfully leveraged BERT-like pre-training objectives—namely Masked Language Modeling (MLM) and Image-Text Matching (ITM)—to align text and visual modalities. However, these objectives are primarily "text-heavy." They focus on predicting missing words or matching global captions to images, often overlooking the intricate spatial distribution of objects within a scene.

For tasks requiring high-level reasoning, such as Visual Commonsense Reasoning (VCR), the "where" and "how" of object placement are as important as the "what." Understanding why a person is looking away from a companion requires more than just identifying the two people; it requires recognizing their relative positions and orientations. Existing models typically lack this granular spatial awareness, treating the visual modality as a collection of independent region features.

Figure 1: Overview of the proposed spatial relations modeling compared to standard BERT-like pre-training tasks.

Methods: Modeling the Spatial Relation Graph

To address this gap, we propose a "Spatial Relations Modeling" framework integrated into standard transformer-based V&L architectures. The core of this approach is the Spatial Relation Graph, where nodes represent individual objects (defined by their bounding box coordinates) and edges represent the geometric relationships between them.

We introduce two self-supervised pre-training tasks designed to force the model to reconstruct this graph:

1. Object Position Regression (OPR)

In the OPR task, the model is provided with the visual features of an object, but its location information (the bounding box) is masked. The model must predict a 5-dimensional coordinate vector $(x_1, y_1, x_2, y_2, \text{area})$ by attending to the surrounding text and other unmasked visual regions. This task encourages the model to learn the absolute positioning of objects based on contextual clues.

2. Spatial Relation Classification (SRC)

While OPR focuses on individual nodes, SRC focuses on the edges of the graph. The model examines pairs of objects and predicts their spatial relationship. Interestingly, we found that complex semantic labels (e.g., "sitting on," "next to") are not necessary for effective pre-training. Instead, we use a geometric proxy: the Intersection over Union (IoU). By discretizing the IoU into 10 "bins," we transform the relationship prediction into a classification task. This provides a stable and "free" supervision signal that captures how objects overlap or relate geometrically.

Figure 5: Detailed architecture of the Spatial Relation Graph and the OPR/SRC task flow through the Transformer.

These tasks are interleaved with standard objectives like MLM and Masked Region Classification (MRC) during the pre-training phase.

Experimental Results

We evaluated our model on three major V&L reasoning benchmarks using visual features from a BUTD (Bottom-Up and Top-Down) detector.

Visual Commonsense Reasoning (VCR)

VCR is the most challenging benchmark as it requires answering questions and providing rationales. Our model achieved a significant performance boost, reaching 73.4% accuracy on the holistic $Q \to AR$ setting. This represents a substantial improvement over previous state-of-the-art models like ERNIE-ViL (66.4%).

VQA 2.0 and NLVR²

The benefits of spatial modeling extended to standard VQA and NLVR² tasks. On VQA 2.0, our large model achieved a new SOTA of 75.6% on the test-std set. On NLVR², which requires reasoning across pairs of images, the model reached 82.2% accuracy.

Ablation Studies

Ablation experiments confirmed the necessity of both tasks. Removing OPR or SRC led to a consistent drop in performance across all benchmarks. This suggests that absolute position awareness and relative relational awareness are complementary and both essential for complex multimodal reasoning.

Discussion and Key Insights

A key takeaway from this work is that geometry serves as an excellent self-supervision signal. By using coordinates and IoU, we avoid the need for expensive human-annotated semantic relationships while still capturing the underlying scene structure. Furthermore, quantitative analysis of the transformer's attention maps revealed that these spatial tasks guide the model to "look" at more relevant visual regions, improving the interpretability and focus of the attention mechanism.

Conclusion and Future Work

By explicitly modeling spatial relations, we have demonstrated a path toward more robust and "spatially-aware" V&L models. While our approach relies on a frozen object detector, future work could explore end-to-end architectures where the detector itself benefits from spatial relational feedback. Additionally, moving from discrete IoU bins to more continuous spatial representations remains an intriguing challenge for the field.

Summary updated

BibTeX
@inproceedings{yang2024improving,
  author = {Cheng Yang and Rui Xu and Ye Guo and Peixiang Huang and Yiru Chen and Wenkui Ding and Zhongyuan Wang and Hong Zhou},
  title = {{Improving Vision-and-Language Reasoning via Spatial Relations Modeling}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  doi = {10.1109/wacv57701.2024.00082},
}
Figure