Relation Networks for learning to reason about object relationships
A Simple Neural Network Module for Relational Reasoning introduced Relation Networks (RNs)—a simple but powerful architecture for learning to reason about relationships between objects.
The Problem
Standard neural networks struggle with relational reasoning:
- “Is object A larger than object B?”
- “What is between the red and blue objects?”
- “Are there more circles than squares?”
These require comparing pairs of entities—not easily captured by standard architectures.
Relation Networks
The key insight: explicitly consider all pairs of objects:
where:
- are object representations
- processes each pair (the “relation” function)
- aggregates all pairwise relations
Interactive Demo
Explore relational reasoning on simple visual scenes:
Relational Reasoning
Why Pairs Matter
For objects, RN considers all pairs. This:
- Captures relations regardless of object order
- Scales to variable numbers of objects
- Avoids hardcoding specific relations
Architecture Details
For visual QA:
- CNN extracts feature map from image
- Objects = spatial locations in feature map
- Question embedding concatenated to each pair
- g network (MLP) processes each triple
- Sum over all pairs
- f network (MLP) produces answer
Results on CLEVR
CLEVR is a visual reasoning benchmark with questions like “What size is the cylinder that is left of the brown metal thing?”
| Model | Accuracy |
|---|---|
| CNN + LSTM | 42.7% |
| CNN + LSTM + Attention | 68.5% |
| Relation Network | 95.5% |
| Human | 92.6% |
RNs achieved superhuman performance!
Key Properties
Permutation invariant: Summing over pairs is order-independent
Relation-centric: Explicitly models pairwise interactions
Data efficient: Strong inductive bias for relational tasks
Beyond Vision
RNs also improved:
- Text QA (bAbI dataset)
- Physical reasoning (predicting dynamics)
- Graph problems (when combined with GNNs)
Connection to Attention
Self-attention can be viewed as a form of relation network:
Both aggregate pairwise interactions.
Key Paper
- A Simple Neural Network Module for Relational Reasoning — Santoro et al. (2017)
https://arxiv.org/abs/1706.01427