NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Relationships from Entity Stream

Martin Andrews, Sam WitteveenarXiv 2019

Abstract

Relational reasoning is a central component of intelligent behavior, but has proven difficult for neural networks to learn. The Relation Network (RN) module was recently proposed by DeepMind to solve such problems, and demonstrated state-of-the-art results on a number of datasets. However, the RN module scales quadratically in the size of the input, since it calculates relationship factors between every patch in the visual field, including those that do not correspond to entities. In this paper, we describe an architecture that enables relationships to be determined from a stream of entities obtained by an attention mechanism over the input field. The model is trained end-to-end, and demonstrates equivalent performance with greater interpretability while requiring only a fraction of the model parameters of the original RN module.

Introduction

Relational reasoning—the ability to understand how different objects in a scene relate to one another (e.g., "Is the cube behind the sphere?")—is a cornerstone of human intelligence but remains a significant challenge for neural networks. The current standard, the Relation Network (RN), addresses this by comparing every single patch of an image to every other patch. While effective, this "brute force" approach suffers from two major flaws: it scales quadratically ($O(N^2)$) with image resolution, and it lacks grounding, as the model spends equal effort relating empty background patches as it does actual objects.

This paper introduces an "Entity Stream" architecture that performs relational reasoning by sequentially attending to relevant objects in a scene rather than comparing every possible pair of image patches. This approach achieves performance comparable to the state-of-the-art RN but uses significantly fewer parameters and offers much greater interpretability through visual attention maps.

Methodology

The proposed architecture replaces the all-to-all comparison of the RN with a sequential process involving two main recurrent neural network (RNN) components:

  • The Entity Finder (EF): This module acts like a spotlight. At each timestep, it uses an attention mechanism to "query" the image and extract a specific entity (a vector representing a patch's color, shape, and location).
  • The Entity Stream: The sequence of entities picked out by the EF creates a "symbolic-like" internal representation of the scene.
  • The Relationship Finder (RF): This second RNN "listens" to the Entity Stream and processes the sequence to produce the final answer to a question.
Comparison between the baseline Relation Network (a) and the proposed Entity Stream architecture (b).

A key technical contribution is the comparison between Soft Attention and Hard Attention. To prevent the model from "cheating" by averaging multiple patches to answer counting questions in a single step, the authors use the Gumbel-Softmax trick to implement hard attention. This forces the model to pick exactly one "pure" entity at a time, improving logical grounding.

Detailed view of the Entity Stream mechanism, showing the interaction between the Entity Finder and Relationship Finder RNNs.

Experimental Setup

The model was evaluated on Sort-of-CLEVR, a simplified version of the CLEVR dataset consisting of 2D images with six geometric shapes of different colors. Questions were categorized into:

  • Non-Relational: e.g., "What is the color of the shape at location X?"
  • Relational: e.g., "What is the shape of the object furthest from the red object?"

Results and Discussion

The Entity Stream models achieved results on par with the much larger Relation Network while being significantly more lightweight. The Soft Entity Stream (RFS) actually outperformed the original RN while using roughly 1/9th of the parameters.

Model Non-Relational Accuracy Relational Accuracy Parameters (Size in Bytes)
Relation Network (RN) 99% 93% 1,463,513
Entity Stream (Soft) 99% 95% 166,380
Entity Stream (Hard) 99% 93% 408,364

Beyond efficiency, the architecture provides high interpretability. Because the model generates an Entity Stream, researchers can visualize exactly which parts of the image the model "looked at" and in what order to answer a question, turning the "black box" of the neural network into a visible sequence of steps.

Conclusion

The Entity Stream architecture demonstrates that "smarter selection" can be more effective than brute-force computation for complex reasoning. While successful on Sort-of-CLEVR, future work will involve testing the architecture on more complex, real-world images and exploring multi-stream architectures for multi-part reasoning tasks. The authors also suggest exploring reinforcement learning techniques to help the model learn cases where the correct answer is non-differentiable.

Summary updated

BibTeX
@misc{andrews2019relationships,
  author = {Martin Andrews and Sam Witteveen},
  title = {{Relationships from Entity Stream}},
  year = {2019},
  eprint = {1909.03315},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1909.03315},
}
Figure