AI Glossary / Deep learning / Advanced
Relation network
Definition
A relation network is a neural-network module designed to learn from relationships between pairs of represented objects. In the formulation introduced by Santoro and colleagues, a shared function processes object pairs, the resulting vectors are summed, and another function converts the aggregate into an output. The architecture encourages relational computation; the useful relationships themselves must be learned.
What it means
Identifying a red object and deciding whether it is larger than a blue object are different tasks. The second requires a comparison. A relation network provides a structured way to compute such interactions rather than asking a generic predictor to discover the entire comparison mechanism from an undifferentiated input.
Here, an object means an input representation. It might describe a physical item, a sentence, or a region of an image feature map. It does not necessarily correspond to a perfectly detected, separately labeled real-world entity.
How it works
Represent the input objects as vectors. Apply the same learned pair function, commonly a multilayer perceptron, to each selected pair. Sum the pair outputs, then apply a learned output function. A question representation can also condition the pair computations when answering questions about a scene.
The original all-pairs formulation considers ordered pairs, including self-pairs, giving n squared pair evaluations for n objects. Variants may restrict which pairs are considered. Shared parameters make the pair rule reusable, but do not remove the cost of evaluating many pairs.
Summation makes the aggregate insensitive to a permutation of the object list when the objects and pair set remain otherwise unchanged. This does not force the pair function to be symmetric: the relation from A to B can differ from the relation from B to A.
Three practical examples
- A visual-question-answering prototype compares represented shapes to answer a question about relative size or position. Its success depends on both the object representations and the learned comparison.
- A text experiment combines sentence representations in pairs to answer a question requiring evidence from multiple statements. It is evaluated on held-out questions rather than assumed to perform reliable logical deduction.
- A physical-system model processes pairs of represented moving bodies to predict a system property. The team checks generalization to unfamiliar arrangements and object counts before treating it as useful outside its training setting.
Think of it this way
Imagine a reviewer examining pairs of entries in a catalog, recording a short comparison for each pair, and then combining the notes to answer a question. A relation network learns both how to form the comparison notes and how to use their aggregate. The notes are numerical representations, not necessarily readable statements or explanations.
Worked example
Use three toy objects with scalar values 1, 3, and 6. For an arithmetic illustration, let the pair function return the absolute difference between its two inputs, and let the output function simply return the sum. These are chosen functions, not a trained model.
The nine ordered pair differences, including self-pairs, are: from 1 to [1, 3, 6], [0, 2, 5]; from 3 to those values, [2, 0, 3]; and from 6, [5, 3, 0]. Their sum is 20. Reordering the object list changes the arrangement of the calculations but leaves the total at 20.
Using only the three unordered distinct pairs would instead give 2 + 5 + 3 = 10. The difference demonstrates why pair conventions must be specified. The result is a summary of differences, not an answer to every possible question about the objects. A learned relation network uses vector-valued functions and a task objective to obtain a useful output.
Illustrative case study
Fictional Maple Lessons develops a prototype for answering questions about simple educational diagrams. Its input representation includes each detected shape's position, color, and size. A relation module compares pairs while receiving a representation of the question.
The team initially obtains strong results on diagrams with three objects. It then tests crowded diagrams and finds errors associated with missed objects and unfamiliar arrangements. Engineers separately evaluate object extraction and question answering, and compare the model with a baseline. This invented case illustrates why relational architecture is only one part of a dependable system; it does not claim successful deployment or universal reasoning ability.
Common misconceptions and mistakes
A relation network is not a relational database, and its learned relation vectors need not be explicit logical predicates. A shared pair function is not proof of causal understanding. Reordering a fixed set is also different from adding or deleting objects: the latter changes the sum and may change the answer.
Do not confuse invariance to list order with symmetry inside each pair. All-pairs processing can become expensive as object count grows. Finally, names vary across research: another paper using the phrase relation network may describe a different architecture or task, so identify the formulation rather than relying on the label alone.
Business use
This architecture can support experiments in which interactions between represented entities are central to the prediction. Before adopting it, define the entities, available attributes, target output, and pair-selection rule. Inspect whether the representations contain the information needed to answer the intended question.
Measure performance on new combinations, object counts, and question types, alongside runtime and upstream extraction errors. Doubling the number of objects quadruples the number of ordered all-pairs evaluations. A good benchmark score is evidence about that evaluation, not a guarantee that the system can reason reliably across arbitrary business situations.
People also ask
Does the model need labeled relationships for every pair?
Not necessarily. The pair and output functions can be learned from an end-task training objective.
Is it a graph neural network?
It is closely related to neural computation over graphs, but the original module aggregates all pair relations into an output rather than defining every possible graph-network architecture.
Can it explain its answer?
Its internal relation vectors do not automatically provide a faithful human explanation.
Check your understanding
Why are there nine pair evaluations for three objects?
Answer: The stated convention includes every ordered pair and all three self-pairs.
Why does reordering the toy inputs preserve the result?
Answer: The same pair differences are summed in a different order.
Would adding an object necessarily preserve the output?
Answer: No. It adds pair computations and changes the aggregate.
Related terms
- Graph neural network
- Multilayer perceptron
- Aggregation
- Relational reasoning
- object representation
- permutation invariance
- visual question answering
- pairwise interaction
Learn next
Add a fourth toy object with value 8 and count the new ordered pairs before calculating their differences. Then compare a summed pair representation with a model that first updates each object's representation from its neighbors. Explain which information each design retains for its next stage.
More in Deep learning
- Recurrent neural network - A recurrent neural network, or RNN, is a neural-network architecture that processes sequential information using a state updated through repeated computations.
- Recursive Neural Network - A recursive neural network is a neural model that repeatedly combines representations of smaller components to represent a larger structured object.
- Region Based Convolutional Neural Networks - Region-based convolutional neural networks are object-detection approaches that analyze candidate image regions using convolutional features to identify...
- Reservoir computing - Reservoir computing is an approach to processing time-dependent information in which an input drives a dynamical system, called a reservoir, and a readout...
- Residual Neural Network - A residual neural network is a neural network built with blocks that add a learned transformation to a shortcut transformation of the block's input.
- Restricted Boltzmann Machine - A restricted Boltzmann machine, or RBM, is an energy-based probabilistic model with visible units representing observed data and hidden units representing...
Sources
Santoro and colleagues, A simple neural network module for relational reasoning, 2017; the original pair-function, summation, and output-function formulation: https://arxiv.org/pdf/1706.01427
Previous: Relation Instance Next: Relation Profile