Relational inductive biases, deep learning, and graph networks

Peter W. Battaglia, Jessica B. Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andrew Ballard, Justin Gilmer, George Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, Razvan Pascanu

Introduction

A key signature of human intelligence is the ability to make “infinite use of finite means” (Humboldt,, 1836; Chomsky,, 1965), in which a small set of elements (such as words) can be productively composed in limitless ways (such as into new sentences). This reflects the principle of combinatorial generalization, that is, constructing new inferences, predictions, and behaviors from known building blocks. Here we explore how to improve modern AI’s capacity for combinatorial generalization by biasing learning towards structured representations and computations, and in particular, systems that operate on graphs.

Humans’ capacity for combinatorial generalization depends critically on our cognitive mechanisms for representing structure and reasoning about relations. We represent complex systems as compositions of entities and their interactionsWhether this entails a “language of thought” (Fodor,, 1975) is beyond the scope of this work. (Navon,, 1977; McClelland and Rumelhart,, 1981; Plaut et al.,, 1996; Marcus,, 2001; Goodwin and Johnson-Laird,, 2005; Kemp and Tenenbaum,, 2008), such as judging whether a haphazard stack of objects is stable (Battaglia et al.,, 2013). We use hierarchies to abstract away from fine-grained differences, and capture more general commonalities between representations and behaviors (Botvinick,, 2008; Tenenbaum et al.,, 2011), such as parts of an object, objects in a scene, neighborhoods in a town, and towns in a country. We solve novel problems by composing familiar skills and routines (Anderson,, 1982), for example traveling to a new location by composing familiar procedures and objectives, such as “travel by airplane”, “to San Diego”, “eat at”, and “an Indian restaurant”. We draw analogies by aligning the relational structure between two domains and drawing inferences about one based on corresponding knowledge about the other (Gentner and Markman,, 1997; Hummel and Holyoak,, 2003).

Kenneth Craik’s “The Nature of Explanation” (1943), connects the compositional structure of the world to how our internal mental models are organized:

…[a human mental model] has a similar relation-structure to that of the process it imitates. By ‘relation-structure’ I do not mean some obscure non-physical entity which attends the model, but the fact that it is a working physical model which works in the same way as the process it parallels… physical reality is built up, apparently, from a few fundamental types of units whose properties determine many of the properties of the most complicated phenomena, and this seems to afford a sufficient explanation of the emergence of analogies between mechanisms and similarities of relation-structure among these combinations without the necessity of any theory of objective universals. (Craik,, 1943, page 51-55)

That is, the world is compositional, or at least, we understand it in compositional terms. When learning, we either fit new knowledge into our existing structured representations, or adjust the structure itself to better accommodate (and make use of) the new and the old (Tenenbaum et al.,, 2006; Griffiths et al.,, 2010; Ullman et al.,, 2017).

The question of how to build artificial systems which exhibit combinatorial generalization has been at the heart of AI since its origins, and was central to many structured approaches, including logic, grammars, classic planning, graphical models, causal reasoning, Bayesian nonparametrics, and probabilistic programming (Chomsky,, 1957; Nilsson and Fikes,, 1970; Pearl,, 1986, 2009; Russell and Norvig,, 2009; Hjort et al.,, 2010; Goodman et al.,, 2012; Ghahramani,, 2015). Entire sub-fields have focused on explicit entity- and relation-centric learning, such as relational reinforcement learning (Džeroski et al.,, 2001) and statistical relational learning (Getoor and Taskar,, 2007). A key reason why structured approaches were so vital to machine learning in previous eras was, in part, because data and computing resources were expensive, and the improved sample complexity afforded by structured approaches’ strong inductive biases was very valuable.

In contrast with past approaches in AI, modern deep learning methods (LeCun et al.,, 2015; Schmidhuber,, 2015; Goodfellow et al.,, 2016) often follow an “end-to-end” design philosophy which emphasizes minimal a priori representational and computational assumptions, and seeks to avoid explicit structure and “hand-engineering”. This emphasis has fit well with—and has perhaps been affirmed by—the current abundance of cheap data and cheap computing resources, which make trading off sample efficiency for more flexible learning a rational choice. The remarkable and rapid advances across many challenging domains, from image classification (Krizhevsky et al.,, 2012; Szegedy et al.,, 2017), to natural language processing (Sutskever et al.,, 2014; Bahdanau et al.,, 2015), to game play (Mnih et al.,, 2015; Silver et al.,, 2016; Moravčík et al.,, 2017), are a testament to this minimalist principle. A prominent example is from language translation, where sequence-to-sequence approaches (Sutskever et al.,, 2014; Bahdanau et al.,, 2015) have proven very effective without using explicit parse trees or complex relationships between linguistic entities.

Despite deep learning’s successes, however, important critiques (Marcus,, 2001; Shalev-Shwartz et al.,, 2017; Lake et al.,, 2017; Lake and Baroni,, 2018; Marcus, 2018a, ; Marcus, 2018b, ; Pearl,, 2018; Yuille and Liu,, 2018) have highlighted key challenges it faces in complex language and scene understanding, reasoning about structured data, transferring learning beyond the training conditions, and learning from small amounts of experience. These challenges demand combinatorial generalization, and so it is perhaps not surprising that an approach which eschews compositionality and explicit structure struggles to meet them.

When deep learning’s connectionist (Rumelhart et al.,, 1987) forebears were faced with analogous critiques from structured, symbolic positions (Fodor and Pylyshyn,, 1988; Pinker and Prince,, 1988), there was a constructive effort (Bobrow and Hinton,, 1990; Marcus,, 2001) to address the challenges directly and carefully. A variety of innovative sub-symbolic approaches for representing and reasoning about structured objects were developed in domains such as analogy-making, linguistic analysis, symbol manipulation, and other forms of relational reasoning (Smolensky,, 1990; Hinton,, 1990; Pollack,, 1990; Elman,, 1991; Plate,, 1995; Eliasmith,, 2013), as well as more integrative theories for how the mind works (Marcus,, 2001). Such work also helped cultivate more recent deep learning advances which use distributed, vector representations to capture rich semantic content in text (Mikolov et al.,, 2013; Pennington et al.,, 2014), graphs (Narayanan et al.,, 2016, 2017), algebraic and logical expressions (Allamanis et al.,, 2017; Evans et al.,, 2018), and programs (Devlin et al.,, 2017; Chen et al., 2018b, ).

We suggest that a key path forward for modern AI is to commit to combinatorial generalization as a top priority, and we advocate for integrative approaches to realize this goal. Just as biology does not choose between nature versus nurture—it uses nature and nurture jointly, to build wholes which are greater than the sums of their parts—we, too, reject the notion that structure and flexibility are somehow at odds or incompatible, and embrace both with the aim of reaping their complementary strengths. In the spirit of numerous recent examples of principled hybrids of structure-based methods and deep learning (e.g., Reed and De Freitas,, 2016; Garnelo et al.,, 2016; Ritchie et al.,, 2016; Wu et al.,, 2017; Denil et al.,, 2017; Hudson and Manning,, 2018), we see great promise in synthesizing new techniques by drawing on the full AI toolkit and marrying the best approaches from today with those which were essential during times when data and computation were at a premium.

Recently, a class of models has arisen at the intersection of deep learning and structured approaches, which focuses on approaches for reasoning about explicitly structured data, in particular graphs (e.g. Scarselli et al., 2009b, ; Bronstein et al.,, 2017; Gilmer et al.,, 2017; Wang et al., 2018c, ; Li et al.,, 2018; Kipf et al.,, 2018; Gulcehre et al.,, 2018). What these approaches all have in common is a capacity for performing computation over discrete entities and the relations between them. What sets them apart from classical approaches is how the representations and structure of the entities and relations—and the corresponding computations—can be learned, relieving the burden of needing to specify them in advance. Crucially, these methods carry strong relational inductive biases, in the form of specific architectural assumptions, which guide these approaches towards learning about entities and relations (Mitchell,, 1980), which we, joining many others (Spelke et al.,, 1992; Spelke and Kinzler,, 2007; Marcus,, 2001; Tenenbaum et al.,, 2011; Lake et al.,, 2017; Lake and Baroni,, 2018; Marcus, 2018b, ), suggest are an essential ingredient for human-like intelligence.

In the remainder of the paper, we examine various deep learning methods through the lens of their relational inductive biases, showing that existing methods often carry relational assumptions which are not always explicit or immediately evident. We then present a general framework for entity- and relation-based reasoning—which we term graph networks—for unifying and extending existing methods which operate on graphs, and describe key design principles for building powerful architectures using graph networks as building blocks. We have also released an open-source library for building graph networks, which can be found here: github.com/deepmind/graph_nets.

Relational inductive biases

Many approaches in machine learning and AI which have a capacity for relational reasoning (Box 2) use a relational inductive bias. While not a precise, formal definition, we use this term to refer generally to inductive biases (Box 2) which impose constraints on relationships and interactions among entities in a learning process.

Creative new machine learning architectures have rapidly proliferated in recent years, with (perhaps not surprisingly given the thesis of this paper) practitioners often following a design pattern of composing elementary building blocks to form more complex, deepThis pattern of composition in depth is ubiquitous in deep learning, and is where the “deep” comes from. computational hierarchies and graphsRecent methods (Liu et al.,, 2018) even automate architecture construction via learned graph editing procedures.. Building blocks such as “fully connected” layers are stacked into “multilayer perceptrons” (MLPs), “convolutional layers” are stacked into “convolutional neural networks” (CNNs), and a standard recipe for an image processing network is, generally, some variety of CNN composed with a MLP. This composition of layers provides a particular type of relational inductive bias—that of hierarchical processing—in which computations are performed in stages, typically resulting in increasingly long range interactions among information in the input signal. As we explore below, the building blocks themselves also carry various relational inductive biases (Table 1). Though beyond the scope of this paper, various non-relational inductive biases are used in deep learning as well: for example, activation non-linearities, weight decay, dropout (Srivastava et al.,, 2014), batch and layer normalization (Ioffe and Szegedy,, 2015; Ba et al.,, 2016), data augmentation, training curricula, and optimization algorithms all impose constraints on the trajectory and outcome of learning.

To explore the relational inductive biases expressed within various deep learning methods, we must identify several key ingredients, analogous to those in Box 2: what are the entities, what are the relations, and what are the rules for composing entities and relations, and computing their implications? In deep learning, the entities and relations are typically expressed as distributed representations, and the rules as neural network function approximators; however, the precise forms of the entities, relations, and rules vary between architectures. To understand these differences between architectures, we can further ask how each supports relational reasoning by probing:

The arguments to the rule functions (e.g., which entities and relations are provided as input).

How the rule function is reused, or shared, across the computational graph (e.g., across different entities and relations, across different time or processing steps, etc.).

How the architecture defines interactions versus isolation among representations (e.g., by applying rules to draw conclusions about related entities, versus processing them separately).

Perhaps the most common building block is a fully connected layer (Rosenblatt,, 1961). Typically implemented as a non-linear vector-valued function of vector inputs, each element, or “unit”, of the output vector is the dot product between a weight vector, followed by an added bias term, and finally a non-linearity such as a rectified linear unit (ReLU). As such, the entities are the units in the network, the relations are all-to-all (all units in layer ii are connected to all units in layer jj), and the rules are specified by the weights and biases. The argument to the rule is the full input signal, there is no reuse, and there is no isolation of information (Figure 1a). The implicit relational inductive bias in a fully connected layer is thus very weak: all input units can interact to determine any output unit’s value, independently across outputs (Table 1).

1.2 Convolutional layers

Another common building block is a convolutional layer (Fukushima,, 1980; LeCun et al.,, 1989). It is implemented by convolving an input vector or tensor with a kernel of the same rank, adding a bias term, and applying a point-wise non-linearity. The entities here are still individual units (or grid elements, e.g. pixels), but the relations are sparser. The differences between a fully connected layer and a convolutional layer impose some important relational inductive biases: locality and translation invariance (Figure 1b). Locality reflects that the arguments to the relational rule are those entities in close proximity with one another in the input signal’s coordinate space, isolated from distal entities. Translation invariance reflects reuse of the same rule across localities in the input. These biases are very effective for processing natural image data because there is high covariance within local neighborhoods, which diminishes with distance, and because the statistics are mostly stationary across an image (Table 1).

1.3 Recurrent layers

A third common building block is a recurrent layer (Elman,, 1990), which is implemented over a sequence of steps. Here, we can view the inputs and hidden states at each processing step as the entities, and the Markov dependence of one step’s hidden state on the previous hidden state and the current input, as the relations. The rule for combining the entities takes a step’s inputs and hidden state as arguments to update the hidden state. The rule is reused over each step (Figure 1c), which reflects the relational inductive bias of temporal invariance (similar to a CNN’s translational invariance in space). For example, the outcome of some physical sequence of events should not depend on the time of day. RNNs also carry a bias for locality in the sequence via their Markovian structure (Table 1).

2 Computations over sets and graphs

While the standard deep learning toolkit contains methods with various forms of relational inductive biases, there is no “default” deep learning component which operates on arbitrary relational structure. We need models with explicit representations of entities and relations, and learning algorithms which find rules for computing their interactions, as well as ways of grounding them in data. Importantly, entities in the world (such as objects and agents) do not have a natural order; rather, orderings can be defined by the properties of their relations. For example, the relations between the sizes of a set of objects can potentially be used to order them, as can their masses, ages, toxicities, and prices. Invariance to ordering—except in the face of relations—is a property that should ideally be reflected by a deep learning component for relational reasoning.

Sets are a natural representation for systems which are described by entities whose order is undefined or irrelevant; in particular, their relational inductive bias does not come from the presence of something, but rather from the absence. For illustration, consider the task of predicting the center of mass of a solar system comprised of nn planets, whose attributes (e.g., mass, position, velocity, etc.) are denoted by {x1,x2,,xn}\{\mathbf{x}_{1},\mathbf{x}_{2},\dots,\mathbf{x}_{n}\}. For such a computation, the order in which we consider the planets does not matter because the state can be described solely in terms of aggregated, averaged quantities. However, if we were to use a MLP for this task, having learned the prediction for a particular input (x1,x2,,xn)(\mathbf{x}_{1},\mathbf{x}_{2},\dots,\mathbf{x}_{n}) would not necessarily transfer to making a prediction for the same inputs under a different ordering (xn,x1,,x2)(\mathbf{x}_{n},\mathbf{x}_{1},\dots,\mathbf{x}_{2}). Since there are n!n! such possible permutations, in the worst case, the MLP could consider each ordering as fundamentally different, and thus require an exponential number of input/output training examples to learn an approximating function. A natural way to handle such combinatorial explosion is to only allow the prediction to depend on symmetric functions of the inputs’ attributes. This might mean computing shared per-object features {f(x1),,f(xn)}\{f(\mathbf{x}_{1}),\dots,f(\mathbf{x}_{n})\} which are then aggregated in a symmetric way (for example, by taking their mean). Such an approach is the essence of the Deep Sets and related models (Zaheer et al.,, 2017; Edwards and Storkey,, 2016; Pevnỳ and Somol,, 2017), which we explore further in Section 4.2.3.

Of course, permutation invariance is not the only important form of underlying structure in many problems. For example, each object in a set may be affected by pairwise interactions with the other objects in the set (Hartford et al.,, 2018). In our planets scenario, consider now the task of predicting each individual planet’s position after a time interval, Δt\Delta t. In this case, using aggregated, averaged information is not enough because the movement of each planet depends on the forces the other planets are exerting on it. Instead, we could compute the state of each object as xi=f(xi,jg(xi,xj))\textbf{x}_{i}^{\prime}=f(\textbf{x}_{i},\sum_{j}g(\textbf{x}_{i},\textbf{x}_{j})), where gg could compute the force induced by the jj-th planet on the ii-th planet, and ff could compute the future state of the ii-th planet which results from the forces and dynamics. The fact that we use the same gg everywhere is again a consequence of the global permutation invariance of the system; however, it also supports a different relational structure because gg now takes two arguments rather than one.We could extend this same analysis to increasingly entangled structures that depend on relations among triplets (i.e., g(xi,xj,xk)g(\textbf{x}_{i},\textbf{x}_{j},\textbf{x}_{k})), quartets, and so on. We note that if we restrict these functions to only operate on subsets of xi\mathbf{x}_{i} which are spatially close, then we end back up with something resembling CNNs. In the most entangled sense, where there is a single relation function g(x1,,xn)g(\textbf{x}_{1},\ldots{},\textbf{x}_{n}), we end back up with a construction similar to a fully connected layer.

The above solar system examples illustrate two relational structures: one in which there are no relations, and one which consists of all pairwise relations. Many real-world systems (such as in Figure 2) have a relational structure somewhere in between these two extremes, however, with some pairs of entities possessing a relation and others lacking one. In our solar system example, if the system instead consists of the planets and their moons, one may be tempted to approximate it by neglecting the interactions between moons of different planets. In practice, this means computing interactions only between some pairs of objects, i.e. xi=f(xi,jδ(i)g(xi,xj))x_{i}^{\prime}=f(\textbf{x}_{i},\sum_{j\in\delta(i)}g(\textbf{x}_{i},\textbf{x}_{j})), where δ(i){1,,n}\delta(i)\subseteq\{1,\dots,n\} is a neighborhood around node ii. This corresponds to a graph, in that the ii-th object only interacts with a subset of the other objects, described by its neighborhood. Note, the updated states still do not depend in the order in which we describe the neighborhood.The invariance which this model enforces is the invariance under isomorphism of the graph.

Graphs, generally, are a representation which supports arbitrary (pairwise) relational structure, and computations over graphs afford a strong relational inductive bias beyond that which convolutional and recurrent layers can provide.

Graph networks

Neural networks that operate on graphs, and structure their computations accordingly, have been developed and explored extensively for more than a decade under the umbrella of “graph neural networks” (Gori et al.,, 2005; Scarselli et al.,, 2005; Scarselli et al., 2009a, ; Li et al.,, 2016), but have grown rapidly in scope and popularity in recent years. We survey the literature on these methods in the next sub-section (3.1). Then in the remaining sub-sections, we present our graph networks framework, which generalizes and extends several lines of work in this area.

Models in the graph neural network family (Gori et al.,, 2005; Scarselli et al.,, 2005; Scarselli et al., 2009a, ; Li et al.,, 2016) have been explored in a diverse range of problem domains, across supervised, semi-supervised, unsupervised, and reinforcement learning settings. They have been effective at tasks thought to have rich relational structure, such as visual scene understanding tasks (Raposo et al.,, 2017; Santoro et al.,, 2017) and few-shot learning (Garcia and Bruna,, 2018). They have also been used to learn the dynamics of physical systems (Battaglia et al.,, 2016; Chang et al.,, 2017; Watters et al.,, 2017; van Steenkiste et al.,, 2018; Sanchez-Gonzalez et al.,, 2018) and multi-agent systems (Sukhbaatar et al.,, 2016; Hoshen,, 2017; Kipf et al.,, 2018), to reason about knowledge graphs (Bordes et al.,, 2013; Oñoro-Rubio et al.,, 2017; Hamaguchi et al.,, 2017), to predict the chemical properties of molecules (Duvenaud et al.,, 2015; Gilmer et al.,, 2017), to predict traffic on roads (Li et al.,, 2017; Cui et al.,, 2018), to classify and segment images and videos (Wang et al., 2018c, ; Hu et al.,, 2017) and 3D meshes and point clouds (Wang et al., 2018d, ), to classify regions in images (Chen et al., 2018a, ), to perform semi-supervised text classification (Kipf and Welling,, 2017), and in machine translation (Vaswani et al.,, 2017; Shaw et al.,, 2018; Gulcehre et al.,, 2018). They have been used within both model-free (Wang et al., 2018b, ) and model-based (Hamrick et al.,, 2017; Pascanu et al.,, 2017; Sanchez-Gonzalez et al.,, 2018) continuous control, for model-free reinforcement learning (Hamrick et al.,, 2018; Zambaldi et al.,, 2018), and for more classical approaches to planning (Toyer et al.,, 2017).

Many traditional computer science problems, which involve reasoning about discrete entities and structure, have also been explored with graph neural networks, such as combinatorial optimization (Bello et al.,, 2016; Nowak et al.,, 2017; Dai et al.,, 2017), boolean satisfiability (Selsam et al.,, 2018), program representation and verification (Allamanis et al.,, 2018; Li et al.,, 2016), modeling cellular automata and Turing machines (Johnson,, 2017), and performing inference in graphical models (Yoon et al.,, 2018). Recent work has also focused on building generative models of graphs (Li et al.,, 2018; De Cao and Kipf,, 2018; You et al.,, 2018; Bojchevski et al.,, 2018), and unsupervised learning of graph embeddings (Perozzi et al.,, 2014; Tang et al.,, 2015; Grover and Leskovec,, 2016; García-Durán and Niepert,, 2017).

The works cited above are by no means an exhaustive list, but provide a representative cross-section of the breadth of domains for which graph neural networks have proven useful. We point interested readers to a number of existing reviews which examine the body of work on graph neural networks in more depth. In particular, Scarselli et al., 2009a provides an authoritative overview of early graph neural network approaches. Bronstein et al., (2017) provides an excellent survey of deep learning on non-Euclidean data, and explores graph neural nets, graph convolution networks, and related spectral approaches. Recently, Gilmer et al., (2017) introduced the message-passing neural network (MPNN), which unified various graph neural network and graph convolutional network approaches (Monti et al.,, 2017; Bruna et al.,, 2014; Henaff et al.,, 2015; Defferrard et al.,, 2016; Niepert et al.,, 2016; Kipf and Welling,, 2017; Bronstein et al.,, 2017) by analogy to message-passing in graphical models. In a similar vein, Wang et al., 2018c introduced the non-local neural network (NLNN), which unified various “self-attention”-style methods (Vaswani et al.,, 2017; Hoshen,, 2017; Veličković et al.,, 2018) by analogy to methods from computer vision and graphical models for capturing long range dependencies in signals.

2 Graph network (GN) block

We now present our graph networks (GN) framework, which defines a class of functions for relational reasoning over graph-structured representations. Our GN framework generalizes and extends various graph neural network, MPNN, and NLNN approaches (Scarselli et al., 2009a, ; Gilmer et al.,, 2017; Wang et al., 2018c, ), and supports constructing complex architectures from simple building blocks. Note, we avoided using the term “neural” in the “graph network” label to reflect that they can be implemented with functions other than neural networks, though here our focus is on neural network implementations.

The main unit of computation in the GN framework is the GN block, a “graph-to-graph” module which takes a graph as input, performs computations over the structure, and returns a graph as output. As described in Box 3.2, entities are represented by the graph’s nodes, relations by the edges, and system-level properties by global attributes. The GN framework’s block organization emphasizes customizability and synthesizing new architectures which express desired relational inductive biases. The key design principles are: Flexible representations (see Section 4.1); Configurable within-block structure (see Section 4.2); and Composable multi-block architectures (see Section 4.3).

We introduce a motivating example to help make the GN formalism more concrete. Consider predicting the movements a set of rubber balls in an arbitrary gravitational field, which, instead of bouncing against one another, each have one or more springs which connect them to some (or all) of the others. We will refer to this running example throughout the definitions below, to motivate the graph representation and the computations operating over it. Figure 2 depicts some other common scenarios that can be represented by graphs and reasoned over using graph networks.

Within our GN framework, a graph is defined as a 3-tuple G=(u,V,E)G=\left(\mathbf{u},V,E\right) (see Box 3.2 for details of graph representations). The u\mathbf{u} is a global attribute; for example, u\mathbf{u} might represent the gravitational field. The V={vi}i=1:NvV=\{\mathbf{v}_{i}\}_{i=1:N^{v}} is the set of nodes (of cardinality NvN^{v}), where each vi\mathbf{v}_{i} is a node’s attribute. For example, VV might represent each ball, with attributes for position, velocity, and mass. The E={(ek,rk,sk)}k=1:NeE=\{\left(\mathbf{e}_{k},r_{k},s_{k}\right)\}_{k=1:N^{e}} is the set of edges (of cardinality NeN^{e}), where each ek\mathbf{e}_{k} is the edge’s attribute, rkr_{k} is the index of the receiver node, and sks_{k} is the index of the sender node. For example, EE might represent the presence of springs between different balls, and their corresponding spring constants.

2.2 Internal structure of a GN block

A GN block contains three “update” functions, ϕ\phi, and three “aggregation” functions, ρ\rho,

where Ei={(ek,rk,sk)}rk=i,  k=1:NeE^{\prime}_{i}=\left\{\left(\mathbf{e}^{\prime}_{k},r_{k},s_{k}\right)\right\}_{r_{k}=i,\;k=1:N^{e}}, V={vi}i=1:NvV^{\prime}=\left\{\mathbf{v}^{\prime}_{i}\right\}_{i=1:N^{v}}, and E=iEi={(ek,rk,sk)}k=1:NeE^{\prime}=\bigcup_{i}E_{i}^{\prime}=\left\{\left(\mathbf{e}^{\prime}_{k},r_{k},s_{k}\right)\right\}_{k=1:N^{e}}.

The ϕe\phi^{e} is mapped across all edges to compute per-edge updates, the ϕv\phi^{v} is mapped across all nodes to compute per-node updates, and the ϕu\phi^{u} is applied once as the global update. The ρ\rho functions each take a set as input, and reduce it to a single element which represents the aggregated information. Crucially, the ρ\rho functions must be invariant to permutations of their inputs, and should take variable numbers of arguments (e.g., elementwise summation, mean, maximum, etc.).

2.3 Computational steps within a GN block

When a graph, GG, is provided as input to a GN block, the computations proceed from the edge, to the node, to the global level. Figure 3 shows a depiction of which graph elements are involved in each of these computations, and Figure 4(a) shows a full GN block, with its update and aggregation functions. Algorithm 1 shows the following steps of computation:

ϕe\phi^{e} is applied per edge, with arguments (ek,vrk,vsk,u)(\mathbf{e}_{k},\mathbf{v}_{r_{k}},\mathbf{v}_{s_{k}},\mathbf{u}), and returns ek\mathbf{e}^{\prime}_{k}. In our springs example, this might correspond to the forces or potential energies between two connected balls. The set of resulting per-edge outputs for each node, ii, is, Ei={(ek,rk,sk)}rk=i,  k=1:NeE^{\prime}_{i}=\left\{\left(\mathbf{e}^{\prime}_{k},r_{k},s_{k}\right)\right\}_{r_{k}=i,\;k=1:N^{e}}. And E=iEi={(ek,rk,sk)}k=1:NeE^{\prime}=\bigcup_{i}E_{i}^{\prime}=\left\{\left(\mathbf{e}^{\prime}_{k},r_{k},s_{k}\right)\right\}_{k=1:N^{e}} is the set of all per-edge outputs.

ϕv\phi^{v} is applied to each node ii, to compute an updated node attribute, vi\mathbf{v}^{\prime}_{i}. In our running example, ϕv\phi^{v} may compute something analogous to the updated position, velocity, and kinetic energy of each ball. The set of resulting per-node outputs is, V={vi}i=1:NvV^{\prime}=\left\{\mathbf{v}^{\prime}_{i}\right\}_{i=1:N^{v}}.

ρeu\rho^{e\rightarrow u} is applied to EE^{\prime}, and aggregates all edge updates, into eˉ\mathbf{\bar{e}}^{\prime}, which will then be used in the next step’s global update. In our running example, ρeu\rho^{e\rightarrow u} may compute the summed forces (which should be zero, in this case, due to Newton’s third law) and the springs’ potential energies.

ρvu\rho^{v\rightarrow u} is applied to VV^{\prime}, and aggregates all node updates, into vˉ\mathbf{\bar{v}}^{\prime}, which will then be used in the next step’s global update. In our running example, ρvu\rho^{v\rightarrow u} might compute the total kinetic energy of the system.

ϕu\phi^{u} is applied once per graph, and computes an update for the global attribute, u\mathbf{u}^{\prime}. In our running example, ϕu\phi^{u} might compute something analogous to the net forces and total energy of the physical system.

Note, though we assume this sequence of steps here, the order is not strictly enforced: it is possible to reverse the update functions to proceed from global, to per-node, to per-edge updates, for example. Kearnes et al., (2016) computes edge updates from nodes in a similar manner.

2.4 Relational inductive biases in graph networks

Our GN framework imposes several strong relational inductive biases when used as components in a learning process. First, graphs can express arbitrary relationships among entities, which means the GN’s input determines how representations interact and are isolated, rather than those choices being determined by the fixed architecture. For example, the assumption that two entities have a relationship—and thus should interact—is expressed by an edge between the entities’ corresponding nodes. Similarly, the absence of an edge expresses the assumption that the nodes have no relationship and should not influence each other directly.

Second, graphs represent entities and their relations as sets, which are invariant to permutations. This means GNs are invariant to the order of these elementsNote, an ordering can be imposed by encoding the indices in the node or edge attributes, or via the edges themselves (e.g. by encoding a chain or partial ordering)., which is often desirable. For example, the objects in a scene do not have a natural ordering (see Sec. 2.2).

Third, a GN’s per-edge and per-node functions are reused across all edges and nodes, respectively. This means GNs automatically support a form of combinatorial generalization (see Section 5.1): because graphs are composed of edges, nodes, and global features, a single GN can operate on graphs of different sizes (numbers of edges and nodes) and shapes (edge connectivity).

Design principles for graph network architectures

The GN framework can be used to implement a wide variety of architectures, in accordance with the design principles listed above in Section 3.2, which also correspond to the sub-sections (4.1, 4.2, and 4.3) below. In general, the framework is agnostic to specific attribute representations and functional forms. Here, however, we focus mainly on deep learning architectures, which allow GNs to act as learnable graph-to-graph function approximators.

Graph networks support highly flexible graph representations in two ways: first, in terms of the representation of the attributes; and second, in terms of the structure of the graph itself.

The global, node, and edge attributes of a GN block can use arbitrary representational formats. In deep learning implementations, real-valued vectors and tensors are most common. However, other data structures such as sequences, sets, or even graphs could also be used.

The requirements of the problem will often determine what representations should be used for the attributes. For example, when the input data is an image, the attributes might be represented as tensors of image patches; however, when the input data is a text document, the attributes might be sequences of words corresponding to sentences.

For each GN block within a broader architecture, the edge and node outputs typically correspond to lists of vectors or tensors, one per edge or node, and the global outputs correspond to a single vector or tensor. This allows a GN’s output to be passed to other deep learning building blocks such as MLPs, CNNs, and RNNs.

The output of a GN block can also be tailored to the demands of the task. In particular,

An edge-focused GN uses the edges as output, for example to make decisions about interactions among entities (Kipf et al.,, 2018; Hamrick et al.,, 2018).

A node-focused GN uses the nodes as output, for example to reason about physical systems (Battaglia et al.,, 2016; Chang et al.,, 2017; Wang et al., 2018b, ; Sanchez-Gonzalez et al.,, 2018).

A graph-focused GN uses the globals as output, for example to predict the potential energy of a physical system (Battaglia et al.,, 2016), the properties of a molecule (Gilmer et al.,, 2017), or answers to questions about a visual scene (Santoro et al.,, 2017).

The nodes, edges, and global outputs can also be mixed-and-matched depending on the task. For example, Hamrick et al., (2018) used both the output edge and global attributes to compute a policy over actions.

1.2 Graph structure

When defining how the input data will be represented as a graph, there are generally two scenarios: first, the input explicitly specifies the relational structure; and second, the relational structure must be inferred or assumed. These are not hard distinctions, but extremes along a continuum.

Examples of data with more explicitly specified entities and relations include knowledge graphs, social networks, parse trees, optimization problems, chemical graphs, road networks, and physical systems with known interactions. Figures 2a-d illustrate how such data can be expressed as graphs.

Examples of data where the relational structure is not made explicit, and must be inferred or assumed, include visual scenes, text corpora, programming language source code, and multi-agent systems. In these types of settings, the data may be formatted as a set of entities without relations, or even just a vector or tensor (e.g., an image). If the entities are not specified explicitly, they might be assumed, for instance, by treating each word in a sentence (Vaswani et al.,, 2017) or each local feature vector in a CNN’s output feature map, as a node (Watters et al.,, 2017; Santoro et al.,, 2017; Wang et al., 2018c, ) (Figures 2e-f). Or, it might be possible to use a separate learned mechanism to infer entities from an unstructured signal (Luong et al.,, 2015; Mnih et al.,, 2014; Eslami et al.,, 2016; van Steenkiste et al.,, 2018). If relations are not available, the simplest approach is to instantiate all possible directed edges between entities (Figure 2f). This can be prohibitive for large numbers of entities, however, because the number of possible edges grows quadratically with the number of nodes. Thus developing more sophisticated ways of inferring sparse structure from unstructured data (Kipf et al.,, 2018) is an important future direction.

2 Configurable within-block structure

where [x,y,z][\mathbf{x},\mathbf{y},\mathbf{z}] indicates vector/tensor concatenation. For vector attributes, a MLP is often used for ϕ\phi, while for tensors such as image feature maps, CNNs may be more suitable.

The ϕ\phi functions can also use RNNs, which requires an additional hidden state as input and output. Figure 4(b) shows a very simple version of a GN block with RNNs as ϕ\phi functions: there is no message-passing in this formulation, and this type of block might be used for recurrent smoothing of some dynamic graph states. Of course, RNNs as ϕ\phi functions could also be used in a full GN block (Figure 4(a)).

A variety of other architectures can be expressed in the GN framework, often as different function choices and within-block configurations. The remaining sub-sections explore how a GN’s within-block structure can be configured in different ways, with examples of published work which uses such configurations. See the Appendix for details.

Gilmer et al., (2017)’s MPNN generalizes a number of previous architectures and can be translated naturally into the GN formalism. Following the MPNN paper’s terminology (see Gilmer et al., (2017), pages 2-4):

the message function, MtM_{t}, plays the role of the GN’s ϕe\phi^{e}, but does not take u\mathbf{u} as input,

elementwise summation is used for the GN’s ρev\rho^{e\rightarrow v},

the update function, UtU_{t}, plays the role of the GN’s ϕv\phi^{v},

the readout function, RR, plays the role of the GN’s ϕu\phi^{u}, but does not take u\mathbf{u} or EE^{\prime} as input, and thus an analog to the GN’s ρeu\rho^{e\rightarrow u} is not required;

dmasterd_{master} serves a roughly similar purpose to the GN’s u\mathbf{u}, but is defined as an extra node connected to all others, and thus does not influence the edge and global updates directly. It can then be represented in the GN’s VV.

Figure 4(c) shows how an MPNN is structured, according to the GN framework. For details and various MPNN architectures, see the Appendix.

2.2 Non-local neural networks (NLNN)

Wang et al., 2018c ’s NLNN, which unifies various “intra-/self-/vertex-/graph-attention” approaches (Lin et al.,, 2017; Vaswani et al.,, 2017; Hoshen,, 2017; Veličković et al.,, 2018; Shaw et al.,, 2018), can also be translated into the GN formalism. The label “attention” refers to how the nodes are updated: each node update is based on a weighted sum of (some function of) the node attributes of its neighbors, where the weight between a node and one of its neighbors is computed by a scalar pairwise function between their attributes (and then normalized across neighbors). The published NLNN formalism does not explicitly include edges, and instead computes pairwise attention weights between all nodes. But various NLNN-compliant models, such as the vertex attention interaction network (Hoshen,, 2017) and graph attention network (Veličković et al.,, 2018), are able to handle explicit edges by effectively setting to zero the weights between nodes which do not share an edge.

As Figures 4(d) and 5 illustrate, the ϕe\phi^{e} is factored into the scalar pairwise-interaction function which returns the unnormalized attention term, denoted αe(vrk,vsk)=ak\alpha^{e}\left(\mathbf{v}_{r_{k}},\mathbf{v}_{s_{k}}\right)=a^{\prime}_{k}, and a vector-valued non-pairwise term, denoted βe(vsk)=bk\beta^{e}\left(\mathbf{v}_{s_{k}}\right)=\mathbf{b}^{\prime}_{k}. In the ρev\rho^{e\rightarrow v} aggregation, the aka_{k}^{\prime} terms are normalized across each receiver’s edges, bk\mathbf{b}^{\prime}_{k}, and elementwise summed:

In the NLNN paper’s terminology (see Wang et al., 2018c , pages 2-4):

their ff plays the role of the above α\alpha,

their gg plays the role of the above β\beta.

This formulation may be helpful for focusing only on those interactions which are most relevant for the downstream task, especially when the input entities were a set, from which a graph was formed by adding all possible edges between them.

Vaswani et al., (2017)’s multi-headed self-attention mechanism adds an interesting feature, where the ϕe\phi^{e} and ρev\rho^{e\rightarrow v} are implemented by a parallel set of functions, whose results are concatenated together as the final step of ρev\rho^{e\rightarrow v}. This can be interpreted as using typed edges, where the different types index into different ϕe\phi^{e} component functions, analogous to Li et al., (2016).

For details and various NLNN architectures, see the Appendix.

2.3 Other graph network variants

The full GN (Equation 2) can be used to predict a full graph, or any subset of (u,V,E)\left(\mathbf{u}^{\prime},V^{\prime},E^{\prime}\right), as outlined in Section 4.1.1. For example, to predict a global property of a graph, VV^{\prime} and EE^{\prime} can just be ignored. Similarly, if global, node, or edge attributes are unspecified in the inputs, those vectors can be zero-length, i.e., not taken as explicit input arguments. The same idea applies for other GN variants which do not use the full set of mapping (ϕ\phi) and reduction (ρ\rho) functions. For instance, Interaction Networks (Battaglia et al.,, 2016; Watters et al.,, 2017) and the Neural Physics Engine (Chang et al.,, 2017) use a full GN but for the absence of the global to update the edge properties (see Appendix for details).

Various models, including CommNet (Sukhbaatar et al.,, 2016), structure2vec (Dai et al.,, 2016) (in the version of (Dai et al.,, 2017)), and Gated Graph Sequence Neural Networks (Li et al.,, 2016) have used a ϕe\phi^{e} which does not directly compute pairwise interactions, but instead ignore the receiver node, operating only on the sender node and in some cases an edge attribute. This can be expressed by implementations of ϕe\phi^{e} with the following signatures, such as:

Relation Networks (Raposo et al.,, 2017; Santoro et al.,, 2017) bypass the node update entirely and predict the global output from pooled edge information directly (see also Figure 4(e)),

Deep Sets (Zaheer et al.,, 2017) bypass the edges update completely and predict the global output from pooled nodes information directly (Figure 4(f)),

PointNet (Qi et al.,, 2017) use similar update rule, with a max-aggregation for ρvu\rho^{v\rightarrow u} and a two-step node update.

3 Composable multi-block architectures

Arbitrary numbers of GN blocks can be composed, as show in Figure 6(a). The blocks can be unshared (different functions and/or parameters, analogous to layers of a CNN), GN1GN2GNM\textrm{GN}_{1}\neq\textrm{GN}_{2}\neq\dots\neq\textrm{GN}_{M}, or shared (reused functions and parameters, analogous to an unrolled RNN), GN1=GN2==GNM\textrm{GN}_{1}=\textrm{GN}_{2}=\dots=\textrm{GN}_{M}. The white box around the GNcore\textrm{GN}_{core} in Figure 6(a) represents MM repeated internal processing sub-steps, with either shared or unshared GN blocks. Shared configurations are analogous to message-passing (Gilmer et al.,, 2017), where the same local update procedure is applied iteratively to propagate information across the structure (Figure 7). If we exclude the global u\mathbf{u} (which aggregates information from across the nodes and edges), the information that a node has access to after mm steps of propagation is determined by the set of nodes and edges that are at most mm hops away. This can be interpreted as breaking down a complex computation into smaller elementary steps. The steps can also be used to capture sequentiality in time. In our ball-spring example, if each propagation step predicts the physical dynamics over one time step of duration Δt\Delta t, then the MM propagation steps result in a total simulation time of, M ⁣ ⁣ΔtM\!\cdot\!\Delta t.

A common architecture design is what we call the encode-process-decode configuration (Hamrick et al., (2018); also see Figure 6(b)a): an input graph, GinpG_{\textrm{inp}} is transformed into a latent representation, G0G_{0}, by an encoder, GNenc\text{GN}_{\textrm{enc}}; a shared core block, GNcore\text{GN}_{\textrm{core}}, is applied MM times to return GMG_{M}; and finally an output graph, GoutG_{\textrm{out}}, is decoded by GNdec\text{GN}_{\textrm{dec}}. For example, in our running example, the encoder might compute the initial forces and interaction energies between the balls, the core might apply an elementary dynamics update, and the decoder might read out the final positions from the updated graph state.

Similar to the encode-process-decode design, recurrent GN-based architectures can be built by maintaining a hidden graph, GhidtG^{t}_{\textrm{hid}}, taking as input an observed graph, GinptG^{t}_{\textrm{inp}}, and returning an output graph, GouttG^{t}_{\textrm{out}}, on each step (see Figure 6(c)). This type of architecture can be particularly useful for predicting sequences of graphs, such as predicting the trajectory of a dynamical system over time (e.g. Sanchez-Gonzalez et al.,, 2018). The encoded graph, output by GNenc\text{GN}_{\textrm{enc}}, must have the same structure as GhidtG^{t}_{\textrm{hid}}, and they can be easily combined by concatenating their corresponding ek\mathbf{e}_{k}, vi\mathbf{v}_{i}, and u\mathbf{u} vectors (where the upward arrow merges into the left-hand horizontal arrow in Figure 6(c)), before being passed to GNcore\textrm{GN}_{\textrm{core}}. For the output, the GhidtG^{t}_{\textrm{hid}} is copied (where the right-hand horizontal arrow splits into the downward arrow in Figure 6(c)) and decoded by GNdec\textrm{GN}_{\textrm{dec}}. This design reuses GN blocks in several ways: GNenc\textrm{GN}_{\textrm{enc}}, GNdec\textrm{GN}_{\textrm{dec}}, and GNcore\textrm{GN}_{\textrm{core}} are shared across each step, tt; and within each step, GNcore\textrm{GN}_{\textrm{core}} may perform multiple shared sub-steps.

Various other techniques for designing GN-based architectures can be useful. Graph skip connections, for example, would concatenate a GN block’s input graph, GmG_{m}, with its output graph, Gm+1G_{m+1}, before proceeding to further computations. Merging and smoothing input and hidden graph information, as in Figure 6(c), can use LSTM- or GRU-style gating schemes, instead of simple concatenation (Li et al.,, 2016). Or distinct, recurrent GN blocks (e.g. Figure 4(b)) can be composed before and/or after other GN blocks, to improve stability in the representations over multiple propagation steps (Sanchez-Gonzalez et al.,, 2018).

4 Implementing graph networks in code

Similar to CNNs (see Figure 1), which are naturally parallelizable (e.g. on GPUs), GNs have a natural parallel structure: since the ϕe\phi^{e} and ϕv\phi^{v} functions in Equation 1 are shared over the edges and nodes, respectively, they can be computed in parallel. In practice, this means that with respect to ϕe\phi^{e} and ϕv\phi^{v}, the nodes and edges can be treated like the batch dimension in typical mini-batch training regimes. Moreover, several graphs can be naturally batched together by treating them as disjoint components of a larger graph. With some additional bookkeeping, this allows batching together the computations made on several independent graphs.

Reusing ϕe\phi^{e} and ϕv\phi^{v} also improves GNs’ sample efficiency. Again, analogous to a convolutional kernel, the number of samples which are used to optimize a GN’s ϕe\phi^{e} and ϕv\phi^{v} functions is the number of edges and nodes, respectively, across all training graphs. For example, in the balls example from Sec. 3.2, a scene with four balls which are all connected by springs will provide twelve (4×34\times 3) examples of the contact interaction between them.

We have released an open-source software library for building GNs, which can be found here: github.com/deepmind/graph_nets. See Box 4.3 for an overview.

5 Summary

In this section, we have discussed the design principles behind graph networks: flexible representations, configurable within-block structure, and composable multi-block architectures. These three design principles combine in our framework which is extremely flexible and applicable to a wide range of domains ranging from perception, language, and symbolic reasoning. And, as we will see in the remainder of this paper, the strong relational inductive bias possessed by graph networks supports combinatorial generalization, thus making it a powerful tool both in terms of implementation and theory.

Discussion

In this paper, we analyzed the extent to which relational inductive bias exists in deep learning architectures like MLPs, CNNs, and RNNs, and concluded that while CNNs and RNNs do contain relational inductive biases, they cannot naturally handle more structured representations such as sets or graphs. We advocated for building stronger relational inductive biases into deep learning architectures by highlighting an underused deep learning building block called a graph network, which performs computations over graph-structured data. Our graph network framework unifies existing approaches that also operate over graphs, and provides a straightforward interface for assembling graph networks into complex, sophisticated architectures.

The structure of GNs naturally supports combinatorial generalization because they do not perform computations strictly at the system level, but also apply shared computations across the entities and across the relations as well. This allows never-before-seen systems to be reasoned about, because they are built from familiar components, in a way that reflects von Humboldt’s “infinite use of finite means” (Humboldt,, 1836; Chomsky,, 1965).

A number of studies have explored GNs’ capacity for combinatorial generalization. Battaglia et al., (2016) found that GNs trained to make one-step physical state predictions could simulate thousands of future time steps, and also exhibit accurate zero-shot transfer to physical systems with double, or half, the number of entities experienced during training. Sanchez-Gonzalez et al., (2018) found similar results in more complex physical control settings, including that GNs trained as forward models on simulated multi-joint agents could generalize to agents with new numbers of joints. Hamrick et al., (2018) and Wang et al., 2018b each found that GN-based decision-making policies could transfer to novel numbers of entities as well. In combinatorial optimization problems, Bello et al., (2016); Nowak et al., (2017); Dai et al., (2017); Kool and Welling, (2018) showed that GNs could generalize well to problems of much different sizes than they had been trained on. Similarly, Toyer et al., (2017) showed generalization to different sizes of planning problems, and Hamilton et al., (2017) showed generalization to producing useful node embeddings for previously unseen data. On boolean SAT problems, Selsam et al., (2018) demonstrated generalization both to different problem sizes and across problem distributions: their model retained good performance upon strongly modifying the distribution of the input graphs and its typical local structure.

These striking examples of combinatorial generalization are not entirely surprising, given GNs’ entity- and relation-centric organization, but nonetheless provide important support for the view that embracing explicit structure and flexible learning is a viable approach toward realizing better sample efficiency and generalization in modern AI.

2 Limitations of graph networks

One limitation of GNs’ and MPNNs’ form of learned message-passing (Shervashidze et al.,, 2011) is that it cannot be guaranteed to solve some classes of problems, such as discriminating between certain non-isomorphic graphs. Kondor et al., (2018) suggested that covarianceCovariance means, roughly, that the activations vary in a predictable way as a function of the ordering of the incoming edges. (Cohen and Welling,, 2016; Kondor and Trivedi,, 2018), rather than invariance to permutations of the nodes and edges is preferable, and proposed “covariant compositional networks” which can preserve structural information, and allow it to be ignored only if desired.

More generally, while graphs are a powerful way of representing structure information, they have limits. For example, notions like recursion, control flow, and conditional iteration are not straightforward to represent with graphs, and, minimally, require additional assumptions (e.g., in interpreting abstract syntax trees). Programs and more “computer-like” processing can offer greater representational and computational expressivity with respect to these notions, and some have argued they are an important component of human cognition (Tenenbaum et al.,, 2011; Lake et al.,, 2015; Goodman et al.,, 2015).

3 Open questions

Although we are excited about the potential impacts that graph networks can have, we caution that these models are only one step forward. Realizing the full potential of graph networks will likely be far more challenging than organizing their behavior under one framework, and indeed, there are a number of unanswered questions regarding the best ways to use graph networks.

One pressing question is: where do the graphs come from that graph networks operate over? One of the hallmarks of deep learning has been its ability to perform complex computations over raw sensory data, such as images and text, yet it is unclear the best ways to convert sensory data into more structured representations like graphs. One approach (which we have already discussed) assumes a fully connected graph structure between spatial or linguistic entities, such as in the literature on self-attention (Vaswani et al.,, 2017; Wang et al., 2018c, ). However, such representations may not correspond exactly to the “true” entities (e.g., convolutional features do not directly correspond to objects in a scene). Moreover, many underlying graph structures are much more sparse than a fully connected graph, and it is an open question how to induce this sparsity. Several lines of active research are exploring these issues (Watters et al.,, 2017; van Steenkiste et al.,, 2018; Li et al.,, 2018; Kipf et al.,, 2018) but as of yet there is no single method which can reliably extract discrete entities from sensory data. Developing such a method is an exciting challenge for future research, and once solved will likely open the door for much more powerful and flexible reasoning algorithms.

A related question is how to adaptively modify graph structures during the course of computation. For example, if an object fractures into multiple pieces, a node representing that object also ought to split into multiple nodes. Similarly, it might be useful to only represent edges between objects that are in contact, thus requiring the ability to add or remove edges depending on context. The question of how to support this type of adaptivity is also actively being researched, and in particular, some of the methods used for identifying the underlying structure of a graph may be applicable (e.g. Li et al.,, 2018; Kipf et al.,, 2018).

Human cognition makes the strong assumption that the world is composed of objects and relations (Spelke and Kinzler,, 2007), and because GNs make a similar assumption, their behavior tends to be more interpretable. The entities and relations that GNs operate over often correspond to things that humans understand (such as physical objects), thus supporting more interpretable analysis and visualization (e.g., as in Selsam et al.,, 2018). An interesting direction for future work is to further explore the interpretability of the behavior of graph networks.

4 Integrative approaches for learning and structure

While our focus here has been on graphs, one takeaway from this paper is less about graphs themselves and more about the approach of blending powerful deep learning approaches with structured representations. We are excited by related approaches which have explored this idea for other types of structured representations and computations, such as linguistic trees (Socher et al., 2011a, ; Socher et al., 2011b, ; Socher et al.,, 2012, 2013; Tai et al.,, 2015; Andreas et al.,, 2016), partial tree traversals in a state-action graph (Guez et al.,, 2018; Farquhar et al.,, 2018), hierarchical action policies (Andreas et al.,, 2017), multi-agent communication channels (Foerster et al.,, 2016), “capsules” (Sabour et al.,, 2017), and programs (Parisotto et al.,, 2017). Other methods have attempted to capture different types of structure by mimicking key hardware and software components in computers and how they transfer information between each other, such as persistent slotted storage, registers, memory I/O controllers, stacks, and queues (e.g. Dyer et al.,, 2015; Grefenstette et al.,, 2015; Joulin and Mikolov,, 2015; Sukhbaatar et al.,, 2015; Kurach et al.,, 2016; Graves et al.,, 2016).

5 Conclusion

Recent advances in AI, propelled by deep learning, have been transformative across many important domains. Despite this, a vast gap between human and machine intelligence remains, especially with respect to efficient, generalizable learning. We argue for making combinatorial generalization a top priority for AI, and advocate for embracing integrative approaches which draw on ideas from human cognition, traditional computer science, standard engineering practice, and modern deep learning. Here we explored flexible learning-based approaches which implement strong relational inductive biases to capitalize on explicitly structured representations and computations, and presented a framework called graph networks, which generalize and extend various recent approaches for neural networks applied to graphs. Graph networks are designed to promote building complex architectures using customizable graph-to-graph building blocks, and their relational inductive biases promote combinatorial generalization and improved sample efficiency over other standard machine learning building blocks.

Despite their benefits and potential, however, learnable models which operate on graphs are only a stepping stone on the path toward human-like intelligence. We are optimistic about a number of other relevant, and perhaps underappreciated, research directions, including marrying learning-based approaches with programs (Ritchie et al.,, 2016; Andreas et al.,, 2016; Gaunt et al.,, 2016; Evans and Grefenstette,, 2018; Evans et al.,, 2018), developing model-based approaches with an emphasis on abstraction (Kansky et al.,, 2017; Konidaris et al.,, 2018; Zhang et al.,, 2018; Hay et al.,, 2018), investing more heavily in meta-learning (Wang et al.,, 2016; Wang et al., 2018a, ; Finn et al.,, 2017), and exploring multi-agent learning and interaction as a key catalyst for advanced intelligence (Nowak,, 2006; Ohtsuki et al.,, 2006). These directions each involve rich notions of entities, relations, and combinatorial generalization, and can potentially benefit, and benefit from, greater interaction with approaches for learning relational reasoning over explicitly structured representations.

Acknowledgements

We thank Tobias Pfaff, Danilo Rezende, Nando de Freitas, Murray Shanahan, Thore Graepel, John Jumper, Demis Hassabis, and the broader DeepMind and Google communities for valuable feedback and support.

References

Appendix: Formulations of additional models

In this appendix we give more examples of how published networks can fit in the frame defined by Equation 1.

Interaction Networks (Battaglia et al.,, 2016; Watters et al.,, 2017) and the Neural Physics Engine Chang et al., (2017) use a full GN but for the absence of the global to update the edge properties:

That work also included an extension to the above formulation which output global, rather than per-node, predictions:

Non-pairwise interactions

Gated Graph Sequence Neural Networks (GGS-NN) (Li et al.,, 2016) use a slightly generalized formulation where each edge has an attached type tk{1,..,T}t_{k}\in\{1,..,T\}, and the updates are:

CommNet (Sukhbaatar et al.,, 2016) (in the slightly more general form described by (Hoshen,, 2017)) uses:

Attention-based approaches

The various attention-based approaches use a ϕe\phi^{e} which is factored into a scalar pairwise-interaction function which returns the unnormalized attention term, denoted αe(vrk,vsk)=ak\alpha^{e}\left(\mathbf{v}_{r_{k}},\mathbf{v}_{s_{k}}\right)=a^{\prime}_{k}, and a vector-valued non-pairwise term, denoted βe(vsk)=bk\beta^{e}\left(\mathbf{v}_{s_{k}}\right)=\mathbf{b}^{\prime}_{k},

The single-headed self-attention (SA) in the Transformer architecture (Vaswani et al.,, 2017), implements the non-local formulation as:

Vertex Attention Interaction Networks (Hoshen,, 2017) are very similar to single-headed SA, but use Euclidean distance for the attentional similarity metric, with shared parameters across the attention inputs’ embeddings, and also use the input node feature in the node update function,

Graph Attention Networks (Veličković et al.,, 2018) are also similar to multi-headed SA, but use a neural network as the attentional similarity metric, with shared parameters across the attention inputs’ embeddings:

Stretching beyond the specific non-local formulation, Shaw et al., (2018) extended multi-headed SA with relative position encodings. “Relative” refers to an encoding of the spatial distance between nodes in a sequence or other signal in a metric space. This can be expressed in GN language as an edge attribute ek\mathbf{e}_{k}, and replacing the βe(vsk)\beta^{e}\left(\mathbf{v}_{s_{k}}\right) from multi-headed SA above with:

Belief Propagation embeddings

Finally, we briefly summarize how the general “structure2vec” algorithm of Dai et al., (2016) can fit into our framework. In order to do so, we need to slightly modify our main Equation 1, i.e.:

Edges’ features now takes the meaning of “message” between their receiver and sender; note that there is only one set of parameters to learn for both the edges and nodes updates.