---
title: "Systematic Generalization with Edge Transformers — Bergen 2021"
description: "Edge Transformers use triangular attention to combine relations, improving generalization to unfamiliar combinations in reasoning and parsing tasks."
canonical: "https://research.elamur.ai/free/en/papers/bergen-2021-systematic-generalization-edge-transformers/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/bergen-2021-systematic-generalization-edge-transformers/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2021](https://md.research.elamur.ai/free/en/papers/2021/) / Systematic Generalization with Edge Transformers

# Systematic Generalization with Edge Transformers

Paper · 2021 · Leon Bergen, Timothy J. O'Donnell and Dzmitry Bahdanau

**Authors:** [Leon Bergen](https://md.research.elamur.ai/free/en/authors/leon-bergen/), [Timothy J. O'Donnell](https://md.research.elamur.ai/free/en/authors/timothy-j-o-donnell/) and [Dzmitry Bahdanau](https://md.research.elamur.ai/free/en/authors/dzmitry-bahdanau/) · **Year:** 2021 · **Venue:** arXiv:2112.00578 · **Licence:** [CC BY 4.0 (arXiv)](http://creativecommons.org/licenses/by/4.0/)

[**0** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W3212682848) · [arXiv:2112.00578](https://openalex.org/S4306400194) · [licence](http://creativecommons.org/licenses/by/4.0/)

- [PDF](https://arxiv.org/pdf/2112.00578)
- [arXiv 2112.00578](https://arxiv.org/abs/2112.00578)
- [OpenAlex](https://openalex.org/W3212682848)

Citations: OpenAlex, 2026-10-14.

## Summary

A system can learn what individual words or relations mean and still struggle to use them together in an unfamiliar way. A family relationship offers a simple example. If one person is the mother of a second, and the second is the mother of a third, the relationship between the first and the third follows from a pattern that applies regardless of who the people are. Systematic generalization is the ability to reuse familiar pieces and patterns of this kind in combinations absent from training. The authors ask whether an architecture can make this reuse easier by giving relations a place of their own in the computation. Their starting point is the [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/).

An Edge Transformer stores a vector for each ordered pair of input items. An item might be a person in a family graph or a token in a sentence. To update the vector connecting two items, triangular attention considers routes that pass through a shared intermediate item. It combines the vectors for the two edges along each route and learns how much weight to give the resulting contribution. The family example explains the importance of the shared item. The middle person must be the same in both mother relations for the grandmother inference to follow. Logic programming supplies the analogy, while training supplies the transformations and weights.

The authors test this architecture on the noiseless graph version of CLUTRR, on syntactic trees and executable queries derived from CFQ questions, and on graph representations of sentence meanings in COGS. On CLUTRR, the Edge Transformer generalizes to longer chains more successfully than the graph attention and relation-aware baselines. Its advantage on CFQ is clearest on the harder splits for [dependency parsing](https://md.research.elamur.ai/free/en/concepts/dependency-parsing/). In the original CFQ query task, it reaches 24.67 ± 1.27% mean exact-match accuracy across the maximum compound divergence splits, the best reported result in the paper’s comparison of encoder–decoder systems trained without pretraining. On the COGS generalization split, it reaches 87.4 ± 0.4% accuracy, the highest result the paper reports for that benchmark. Both query prediction and COGS test forms of [semantic parsing](https://md.research.elamur.ai/free/en/concepts/semantic-parsing/).

The ablations help explain where the gains come from. Removing one of the two edges from the information carried by each triangle consistently hurts CLUTRR and CFQ dependency parsing. Changing how the architecture selects triangles hurts CLUTRR and COGS. Giving every layer its own weights has a particularly large cost on the tested CFQ dependency split. The added computation is the main practical tradeoff. Time and memory grow cubically with the number of input items, which led the authors to filter long training queries in CFQ. They make the experimental code available in the EdgeTransformer repository.

## Deep dive: Systematic Generalization with Edge Transformers

Edge Transformers use triangular attention to combine relations, improving generalization to unfamiliar combinations in reasoning and parsing tasks. · about 32 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What a held-out combination tests

An ordinary train–test split can hold out complete examples while leaving their organizing patterns well represented in training. A system might then succeed by applying a pattern it has already encountered to different words or names. A compositional split poses a more specific challenge. It keeps the building blocks familiar and reserves some ways of putting them together for testing. A test failure can therefore occur even when the words, individual relations, or rules of combination have all appeared in training.

That distinction matters for language understanding because the meaning of a sentence depends on how its parts fit together. Recognizing the words in a question does only part of the work. A system may also have to identify the grammatical connections between those words or produce a query whose structure expresses those connections. The same issue arises in relational reasoning. A system may recognize the label on every link in a chain and still fail to infer the relationship between the people at its ends. The paper treats both as cases of reusing known components under a shift in their arrangement. [Reasoning](https://md.research.elamur.ai/free/en/topics/reasoning/)

The benchmarks discussed in the paper give the shift a concrete form. A family-relation problem can demand a longer chain than the system saw during training. A question-parsing split can hold back larger constructions while preserving a similar distribution of elementary pieces. A sentence-to-meaning task can ask the system to interpret familiar words in more complex configurations. These choices probe different aspects of systematicity. Longer chains test repeated application of relational computations. Novel syntactic constructions can change which pieces attach to one another even when the individual words are familiar.

The authors situate the problem in earlier evaluations of compositionality, where train–test splits were deliberately constructed to expose such differences. The work they discuss includes studies of the conditions under which a learned system can recombine familiar parts, as well as efforts to improve generalization by augmenting training data, inducing programs, using meta-learning, or designing an architecture for a particular task. The Edge Transformer takes up the architectural question. If the task calls for combining relations, the authors ask what information the system should carry from layer to layer and which states it should combine in an update. [Compositionality decomposed](https://md.research.elamur.ai/free/en/papers/hupkes-2019-compositionality-decomposed-neural-networks-generalise/) · [Systematic Generalization: What Is Required and Can It Be Learned?](https://md.research.elamur.ai/free/en/papers/bahdanau-2018-systematic-generalization-required-learned/) · [Good-Enough Compositional Data Augmentation](https://md.research.elamur.ai/free/en/papers/andreas-2020-good-enough-compositional-data-augmentation/)

#### What a Transformer has to keep track of

The classical Transformer carries a vector for each input item. In a sentence, a token’s vector can change as the token gathers information from other positions. In self-attention, an item supplies a query, other items supply keys and values, and the matches between query and keys determine how strongly the values contribute. The update can bring information from a distant position into the current token’s representation. The part that persists to the next layer is the updated representation of each item. [Attention Is All You Need](https://md.research.elamur.ai/free/en/papers/vaswani-2017-attention-all-need/)

The authors give this operation a deliberately simple logical reading. A new vector at an item can be viewed as an inferred bundle of properties, computed from the bundles available in the previous layer. A property such as being red concerns an individual entity. A relation such as being part of something concerns an entity together with a particular counterpart. The paper’s analogy treats a classical Transformer as naturally organized around the first kind of information. Attention can produce a useful interaction between two items when needed, but a lasting record of that interaction has to be represented within the vectors the architecture carries forward.

Consider what that means for a family graph. The vector for one person might have to encode that a mother relation exists and also identify the person to whom it applies. It could have to carry other relations and their targets at the same time. The paper allows that a classical Transformer can learn representations that do this. Its hypothesis concerns the learning burden. A dedicated vector for a particular ordered pair gives the architecture a fixed location in which to accumulate information about that pair. The identity of the counterpart is then part of the address of the vector.

Relation-aware attention offers an intermediate case. It supplies pairwise features such as relative position along with the ordinary item representations. A pair feature can help the system pay attention differently to a nearby token and a distant one. In the formulation discussed by the authors, the feature comes from the label of the edge and remains fixed through processing. The Edge Transformer borrows the idea of representing a pair and makes its representation an evolving state. A relative position can provide the initial information for that state, which later layers can enrich with evidence from elsewhere in the input. [Self-Attention with Relative Position Representations](https://md.research.elamur.ai/free/en/papers/shaw-2018-self-attention-relative-position-representations/)

Graph neural networks furnish a different comparison. The paper describes them as working with sparse graphs and notes that some incorporate features on the links or maintain changing edge representations. This makes the presence of edges alone an insufficient description of the contribution. The distinctive choice is to update an edge using other edges arranged as a route between the same endpoints. Graph Attention Networks are a relevant benchmark because they already supply an attention-based architecture for graph data. The paper also identifies an inside–outside autoencoder as a close technical precedent. That architecture keeps vectors for pairs of input nodes and constrains its attention by the spans of the input. [Graph Attention Networks](https://md.research.elamur.ai/free/en/papers/veli-vckovic-2017-graph-attention-networks/)

#### What logic programming contributes

The logic analogy points to the computation the authors want to make easy. In a grandmother inference, knowing that one person is somebody’s mother and that somebody is another person’s mother is useful only if the two occurrences of “somebody” refer to the same person. In a logical rule, the two premises express this requirement by sharing a variable. Unification is the process that makes the premises agree on a binding for that variable. From the architecture’s perspective, the important operation is to look up two relations whose endpoints already agree at a shared node.

There was already work on differentiable theorem proving, which uses embeddings for logical expressions and adapts backward chaining from Prolog. Backward chaining begins with a claim to be established and asks which premises could support it. An Edge Transformer instead updates the representations of all pairs through the same attention operation. A family rule helps explain the shape of the computation, while the actual states and transformations are learned. Training provides target labels, trees, or output sequences. The architecture uses the same general update with each of these forms of supervision. [End-to-End Differentiable Proving](https://md.research.elamur.ai/free/en/papers/rocktaschel-2017-end-end-differentiable-proving/)

The paper also places its proposal alongside earlier attempts to change the cost of attention. Work on recurrent processing, sparse connections, and kernel approximations sought ways to handle the computational and memory costs of ordinary attention. Here the authors use additional computation to make a particular kind of relational interaction directly available. The motivation for that expenditure is easiest to see when the answer itself concerns a pair, but the experiments also ask whether the same internal organization helps when the answer must be generated as a sequence. [ETC](https://md.research.elamur.ai/free/en/papers/ainslie-2020-etc-encoding-long-structured-inputs/) · [Performer](https://md.research.elamur.ai/free/en/papers/choromanski-2020-rethinking-attention-performers/)

### The method, step by step

#### Give each ordered pair its own state

Start by deciding what counts as an input item. In the family graph, the items are people. In a sentence, they are token positions, so two occurrences of the same word occupy different nodes. The architecture provides an edge state for every ordered pair of nodes. Reversing the order gives a different location in the state. This matters for relations such as mother, where the order of the participants determines who stands in the relation to whom. A pair can also begin and end at the same node. Such a self-edge gives the architecture a place to hold information about an individual item.

The graph used to organize this computation is complete. A family graph may state relations for only some pairs, but all pairs have states in which information can accumulate. The known edges are initialized with their labels, and a null label is possible for a pair without a stated relation. The edge whose label is being queried can thus collect information through intermediate people. In a sentence, every pair likewise gets an initial state even though the sentence arrives as a sequence. The system can produce a graph because these locations are already available internally.

The following flow applies to the processing inside the architecture. The last step differs according to what the task asks the system to predict.

How the Edge Transformer updates and reads pair states The steps in order.

The state has the following shape.

```
X ∈ ℝⁿˣⁿˣᵈ
```

Here X is the full state, ∈ means “belongs to,” and ℝ denotes real-valued entries. The dimensions are n by n by d, where n is the number of nodes and d is the number of features in each vector. The first two axes select the start and end nodes. At that location, the third axis contains the vector, written below as x(i,j) for the edge from node i to node j. The two node axes are what let the architecture address pairs directly.

#### From the logical analogy to a layer update

The authors summarize their reading of ordinary Transformer attention using a Prolog-like expression. It describes the direction of the computation from the earlier node states to a new one.

```
X(ℓ+1; 1) ⊢ₐ X(ℓ; 1), X(ℓ; 2), …, X(ℓ; n)
```

In this expression X is a node-state function, ℓ is the current layer, and ℓ+1 is the next layer. The entries after the semicolon identify nodes, from 1 through n, with the ellipsis standing for the intervening positions. The turnstile points from the inputs on the right to the inferred state on the left. Its subscript a refers to the learned attention mechanism. The expression is an analogy for a learned vector operation. In logic programming the turnstile has an implication reading, while here the computation produces an activation vector.

The corresponding relational sketch places a pair on the left and pairs on the right.

```
X(ℓ+1; 1,2) ⊢ₐ X(ℓ; 1,1), X(ℓ; 1,2), …, X(ℓ; 2,1), X(ℓ; 2,2), …
```

Here X represents edge states. The layer arguments ℓ and ℓ+1 and the attention turnstile have the same roles as before. The two arguments following the semicolon give the ordered endpoints, with 1 and 2 serving as example node indices. The ellipses stand for additional earlier edge states. This sketch says that an updated relation draws on earlier relations. The actual attention equations specify which pairs participate in any particular update.

In the family analogy, the constraint on the intermediate node can be written as follows.

```
grandmother(x,y) ⊢ₐ mother(x,z), mother(z,y)
```

The symbols x and y identify the endpoints of the proposed grandmother relation. The variable z denotes the intervening person, and both instances of z must have the same binding. The two mother expressions on the right are premises of the example inference. The turnstile again carries the paper’s attention subscript a, connecting the logical pattern to the learned computation. In triangular attention, explicitly indexing both edges by the same intermediate node supplies this matching condition before any scoring takes place.

For a real update, take one destination edge from i to j. For every candidate intermediate node ℓ, the layer looks up the edge from i to ℓ and the edge from ℓ to j. Together with the destination edge, these form the triangle that gives the operation its name. The candidates include cases where an intermediate node coincides with an endpoint, because the graph has self-edges. The operation has to decide how strongly each candidate contributes and what information it contributes. The paper gives those jobs separate projections.

#### Score paths and determine what they carry

For a single attention head, the first edge supplies a query vector.

```
q(i,ℓ) = Wᵠ x(i,ℓ)
```

The symbol q(i,ℓ) is the projected query for the edge from i to ℓ. Here i is the source of the destination edge, ℓ is a candidate intermediate node, and x(i,ℓ) is the current state of the first edge along the route. Wᵠ is the learned query projection. In the single-head equation it maps a vector with d features to a vector with d features.

The second edge supplies a key vector.

```
k(ℓ,j) = Wᵏ x(ℓ,j)
```

The symbol k(ℓ,j) is the projected key for the edge from ℓ to j, where j is the destination of the edge being updated. The input x(ℓ,j) is the current state of that second edge and Wᵏ is its learned key projection. The indices on q and k are important. Their inner product compares two states from the same route, with the common ℓ linking the arrival point of one edge to the departure point of the other.

The layer turns these comparisons into attention weights.

```
α(i,ℓ,j) = softmaxₗ [q(i,ℓ) · k(ℓ,j) / √d]
```

Here α(i,ℓ,j) is the weight of the route from i to j through ℓ. The subscript ₗ on softmax indicates normalization over all candidate intermediate nodes for these fixed endpoints. The operation assigns each candidate a positive weight and makes the weights sum to one. The dot denotes an inner product between the query q(i,ℓ) and the key k(ℓ,j), and √d scales that score by the square root of the single-head feature dimension d. A candidate is therefore scored on how its two edges match, and its weight depends on the scores of the other routes available for the same destination edge.

The information carried by each route is computed separately.

```
v(i,ℓ,j) = (V¹ x(i,ℓ)) ⊙ (V² x(ℓ,j))
```

The symbol v(i,ℓ,j) denotes the value vector for the route from i through ℓ to j. V¹ and V² are learned matrices for the first and second edge respectively. The superscripts distinguish the matrices. The two x terms are the current edge states, and ⊙ multiplies corresponding features after the projections. This product gives a route value whose features depend on both links. In the family analogy, strong evidence about one mother relation on its own does not necessarily give the projected pair the feature pattern associated with the whole chain.

The scores and values meet in the update for the destination edge.

```
a(i,j) = Wᵒ ∑ₗ α(i,ℓ,j) v(i,ℓ,j)
```

Here a(i,j) is the attention output for the edge from i to j, and Wᵒ is the learned output projection. The summation ∑ₗ ranges over the n possible intermediate nodes ℓ. For each one, the scalar weight α multiplies the route value v. The weighted vectors are added and projected into the space of the edge state. The query, key, value, and output matrices in these single-head expressions are square matrices with dimension d along each axis. The equations display the linear transformations without their bias terms.

The distinction between scoring and carrying information lets several intermediate nodes participate in an update. One route can receive most of the weight, or several routes can contribute. Even if two routes receive comparable weights, they can carry different vectors because their underlying edge states differ. The resulting mixture is learned from prediction objectives. The attention weights are scores within that mixture, with no logical truth value assigned to them in the architecture.

#### Assemble heads and apply the layer again

The multi-head version computes several such mixtures in parallel. Each head has its own query, key, and value projections, with output width d divided by the number of heads. The head outputs are collected before the final output projection.

```
a(i,j) = Wᵒ concat(a¹(i,j), …, aᵐ(i,j))
```

The symbols a¹(i,j) through aᵐ(i,j) are the separate head outputs for edge i to j before the shared output projection. The superscripts index the heads, m is their total number, and the ellipsis represents the intervening heads. The function concat joins their vectors along the feature axis. Wᵒ maps the resulting vector back into the edge representation, yielding a(i,j). The authors describe Einstein summation as a convenient way to implement these products and sums in batches.

The paper wraps this attention operation in a layer with normalization, a residual addition, and a feed-forward transformation.

```
X′ = FFN(LN(X + TriangularAttention(LN(X))))
```

Here X is the incoming tensor of edge states and X′ is the layer’s output. LN denotes layer normalization, which the paper describes in terms of rescaling feature activations across the edge states. TriangularAttention applies the route computation to the normalized input. The plus sign adds its output to the original X, so the existing state enters the next operation along with the update. LN then normalizes the resulting activations. FFN is a fully connected feed-forward network with one hidden layer. It has 4 times d hidden units, where d is the width of an edge vector, and it acts independently at each ordered pair. [Layer Normalization](https://md.research.elamur.ai/free/en/papers/ba-2016-layer-normalization/)

A single layer combines states from the preceding layer. As layers are stacked, an edge can combine information that has already been aggregated from other routes. This is how repeated updates can build on intermediate relational information without providing the network with a hand-written inference procedure. By default, the authors tie the weights across layers. The same learned projections and transformations are applied repeatedly to a changing tensor. The untied variant assigns separate parameters to each layer. The paper takes the weight-sharing precedent from [Universal Transformers](https://md.research.elamur.ai/free/en/papers/dehghani-2018-universal-transformers/).

#### Initialize the input and read the appropriate output

With an edge-labeled graph, a trainable embedding turns each label into its initial vector. A graph label and a null label have embeddings in the same representational space. With a sentence, the token itself starts on the self-edge for its position. Pairwise states start with information about relative position, including the zero offset on the diagonal.

```
x⁰(i,j) = { e(tᵢ) + a(0) if i = j; a(i − j) if i ≠ j }
```

The symbol x⁰(i,j) is the initial state for the ordered pair i to j, and the superscript 0 marks initialization. The token at position i is tᵢ. The learned function e maps that token to a vector of width d. In this formula a is the relative-position embedding function, distinct from the attention output a(i,j). Its argument i − j is the signed difference between the two positions, and a(0) is its value on a self-edge. The equality and inequality conditions distinguish self-edges from all other edges. The initial off-diagonal representation thus identifies a relative position, and later updates can bring in token information.

For a graph label prediction, a linear layer can convert the final state of an edge into scores for the possible labels. Cross-entropy trains those scores to give high probability to the correct label. The paper uses this arrangement directly in CLUTRR. A graph-wide classification can use a designated edge or pool multiple edge states. Labels for individual nodes can come from their self-edges, as in COGS. These choices let each task use the part of the tensor whose indices correspond to the required output.

A sequence output uses an encoder and decoder. First, the encoder processes the input and produces a tensor of pair states. The decoder incorporates this tensor into its own initial state, giving its edge updates access to the encoded input. It then generates output tokens from left to right. At each output position, a linear projection of the self-edge provides the scores for the next token. In the CFQ application, the input sequence is a question and the output sequence is its SPARQL query.

The paper adapts causal masking to triangular attention when computing training log-likelihoods. A causal mask limits the information available at a decoding position so that predictions depend on permitted earlier output context. In the edge architecture, the operation being masked is organized around paths through intermediate nodes, so the mask has to apply to triangular attention. This preserves the left-to-right prediction setup when the desired training outputs are already available as sequences. The paper describes the decoder connection and the masking principle at this level.

### Experiments and results

#### Reading the different tests

The benchmarks are synthetic and use controlled partitions. Their shared idea is to reserve new combinations for evaluation while keeping the constituents and the rules that combine them familiar. The particular evidence differs from one task to the next. CLUTRR asks for a relation label at a specified pair. CFQ dependency parsing asks for a tree over the words of a question. The original CFQ task asks for a query sequence. COGS uses a graph representing the meaning of a sentence. The certainty required by a correct prediction changes with the output, from a single edge label to a complete structure or sequence.

The authors report means with standard errors for their tabulated results. A mean describes the aggregate across runs, and the standard error describes the precision of that estimate. Some comparison results come from earlier papers. For CFQ query prediction, the authors convert the 95% confidence intervals from the comparison papers into standard errors. The tables and figures therefore combine new runs and results from prior experiments, with the reporting conventions identified for each task.

#### CLUTRR family relations

The graph version of CLUTRR provides a set of family facts and a pair of people whose relationship must be predicted. In the example the paper discusses, two people are sons of the same person and one of the sons has an uncle. The system is asked to infer the corresponding uncle relation for the other son. The relational composition matters because the target edge is missing from the input. In the noiseless version, the supplied graph contains the facts needed for the inference, keeping the focus on combining those relations.

The paper uses k for the relation length, the number of supporting steps needed for the target. It trains on lengths k = 2, 3, 4 with the original 15k training examples. For the shorter training range, k = 2, 3, the authors use the original benchmark code to generate a 35k training set. They use the larger set to reduce variability when measuring generalization in that condition. The evaluation spans relation lengths from 2 to 10. The longer test cases extend beyond the training range, so they show how a system handles additional reasoning steps after learning on shorter chains.

The Edge Transformer embeds the input labels, repeatedly updates all the pair states, and reads the final vector for the queried pair. A linear layer turns that vector into relation scores, and cross-entropy provides supervision. A relation-aware Transformer, RAT, also embeds the input edge labels. Its node states start at zero, and it predicts the target by concatenating the final vectors of the two queried nodes and applying a linear layer. That readout leaves the system to gather the evidence into the node representations.

The relation-updating variant, RRAT, supplies a closer comparison. Its node updates follow RAT, while its edge update takes the two endpoint states, concatenates them, and applies a linear transformation. It has separate feed-forward components for nodes and edges, and its answer is read from the queried edge. RAT and RRAT therefore differ in whether edge states evolve and where the final prediction is read. RRAT and Edge Transformer further differ in how the edge gets updated. The RRAT edge receives information through its endpoints, and the Edge Transformer computes its update from paths of adjacent edges. The authors also include Graph Attention Network results from the original CLUTRR work for the k = 2, 3, 4 condition.

The result is relation prediction accuracy broken down by test length. The Edge Transformer leads the baselines by wide margins under both training regimes. The curves for Edge Transformer, RAT, and RRAT average 10 runs. Evaluating by length is important here. A single overall accuracy would mix test cases whose lengths were represented during training with cases requiring longer combinations. The Graph Attention Network comparison applies to the original training regime. The newly generated training set for k = 2, 3 provides the comparison among the systems run on that set.

#### CFQ dependency trees

Compositional Freebase Questions, or CFQ, was created to test whether a system can map questions to database queries when the larger structures in the questions differ between training and test. The benchmark’s maximum compound divergence splits, abbreviated MCD, seek similar distributions of elementary units and dissimilar distributions of compounds. The paper illustrates the resulting shift with a question that uses a form of “was” followed by two noun phrases. The system may know the words and have seen the phrases separately but encounter that question structure only at test time.

The dependency version of CFQ asks for the grammatical tree of each question. Nodes are token positions, and a labeled dependency records a grammatical link between a head and a dependent. This setup puts the requested output close to the architecture’s internal representation. The authors train the Edge Transformer to score a dependency label or a null label between positions i and j, directly from that pair’s edge state. They use Stanza’s spanning-tree-based algorithm to assemble the scores into a tree. The assembly step enforces the structured output, while the edge scores supply evidence for the links it chooses.

The paper compares this setup with Stanza’s BiLSTM baseline and variants using a classical Transformer or a Universal Transformer. A BiLSTM is a bidirectional recurrent architecture for encoding a sequence. For the baselines, a biaffine layer scores dependency labels using a pair of node representations. The Edge Transformer instead supplies a vector already indexed by both positions. With approximately 100K training questions, the experiment compares different ways to represent the information that the parsing algorithm needs. [Deep Biaffine Attention for Neural Dependency Parsing](https://md.research.elamur.ai/free/en/papers/dozat-2016-deep-biaffine-attention-neural-dependency/)

The two metrics separate partly correct structure from a fully correct parse. Labeled attachment score, LAS, measures correctness of the labeled links and is described by the paper as an F1 measure of partial tree correctness. Exact match, EM, credits a question when the whole predicted tree is correct. A system can therefore achieve a high LAS while losing exact matches across sentences that each contain a bad link. This makes the EM margin particularly informative when the task requires a usable complete tree.

MCD1 gives near-perfect results for both the Edge Transformer and the BiLSTM, with the classical Transformer behind them. On MCD2 and MCD3, the authors describe the Edge Transformer’s exact-match advantage over the baselines as 17-30% EM accuracy. The three splits therefore differ in how strongly they separate the encoders. The BiLSTM comparison comes from the earlier dependency-parsing study. The Transformer, Universal Transformer, and Edge Transformer results average 10 runs.

For CLUTRR and CFQ dependency parsing, the authors use grid search and describe a shared search procedure for the Edge Transformer and the relevant Transformer baselines. They vary width, batch size, learning rate, head count, and depth. The depth ranges differ. Transformer runs search from 5 to 8 layers and Edge Transformer runs from 6 to 8. For CLUTRR, the choice is made on k = 2, 3 and then kept for k = 2, 3, 4. Dependency parsing configurations are chosen using a random sample comprising 1% of the official random split. The chosen settings are carried over to the MCD splits. According to the appendix, one dependency run for either CLUTRR or CFQ finishes in under 30 minutes using one GPU.

#### CFQ question-to-query translation

In the original CFQ task, the target is a SPARQL query for a knowledge graph. A natural-language question gives the information request, and the generated tokens have to express the corresponding conditions and connections in query syntax. This requires the encoder–decoder arrangement, including the left-to-right output process. An entire query is scored by exact match. The semantic task consequently tests whether pair-state processing can help even when there is no direct edge-label readout for the final answer. [Knowledge graphs](https://md.research.elamur.ai/free/en/topics/knowledge-graphs/)

This experiment also exposes a substantial change in resource requirements. The decoder inputs can exceed 100 tokens for some examples. The authors discard training examples with target queries longer than 50 tokens to make Edge Transformer training feasible. With that restriction, they report 1-2 days of training on 4 NVIDIA V100 GPUs. Their expensive sequence-to-sequence setup gives them fewer opportunities to search Edge Transformer configurations than the graph-output experiments do.

The authors first tune the Universal Transformer, which they had found stronger than the classical Transformer in preliminary work. They make a few changes to its selected configuration when trying the Edge Transformer. To tune the baseline, they use the random split and reduce its training data from approximately 90K examples to approximately 20K. The smaller training set is intended to make differences among hyper-parameter settings easier to see. The MCD splits are reserved for compositional evaluation. The appendix reports better results with longer training and specifies 100 training epochs for the reported runs.

On the MCD splits, the results for each split average 30 Universal Transformer runs and 5 Edge Transformer runs. The Edge Transformer reaches 24.67 ± 1.27% exact-match accuracy averaged across the MCD splits. The authors describe this as roughly 3 percentage points ahead of the comparable competition and the best result among the non-pretrained encoder–decoder systems in their comparison. The scope of that comparison matters because the paper distinguishes systems trained from scratch from those using pretraining.

On the filtered random split, the Edge Transformer reaches 99.08 ± 0.1% exact-match accuracy and the Universal Transformer reaches 98.45 ± 0.08%. Both systems are much more accurate on this random partition than the MCD result reported for the Edge Transformer. The two partitions ask different questions. The random split tests query prediction under the filtered random setup, whereas the MCD splits deliberately shift the distribution of larger structures. The random-split chart compares the two architectures within the same evaluation.

CFQ semantic parsing exact match on the filtered random split The Edge Transformer leads the Universal Transformer on complete query matches.

**The numbers**

| System or setting | exact match accuracy % |
| --- | --- |
| Universal Transformer | 98.45 |
| Edge Transformer (this paper) | 99.08 |

#### COGS sentence meanings

COGS asks for a formal representation of what a sentence means. Its generalization split includes combinations of familiar words and phrases that differ from those in the training examples, with sentences that can be more complex than those observed during training. The original benchmark expresses the output as a logical form. The Edge Transformer experiments use an existing graph representation of these parses. The graph supplies positions that can be labeled and links that can be predicted directly. [COGS](https://md.research.elamur.ai/free/en/papers/kim-2020-cogs-compositional-generalization-challenge-based/)

In this representation, nodes correspond to input tokens and carry category information, such as a semantic role or a part of speech. The Edge Transformer reads each kind of node label from the token’s self-edge with a separate linear layer. Links encode parent–child relationships. For each token, the system scores all incoming candidate edges with a linear layer and normalizes across the candidate parent positions. Following the source of the graph representation, a node with no parent is treated as its own parent. The self-edge can therefore supply both token-level information and a candidate for the parent decision.

The authors use the architecture settings of the earlier Transformer graph predictor as their guide. The earlier system combines two standard layers with a dedicated output attention head, so the depth comparison counts three stages of query–key attention. The Edge Transformer uses three layers and the default optimizer settings. The authors conduct no separate COGS hyper-parameter search for it. The comparison thus measures the performance of this Edge Transformer configuration on the existing graph task.

The Edge Transformer reaches 87.4 ± 0.4% accuracy on the COGS generalization split. The authors report an advantage of 9 percentage points over the earlier graph-prediction baselines. They also compare with results on the original sequence formulation, including 82% accuracy for a lexicon-equipped LSTM and 81% for a Transformer with carefully chosen initialization. The sequence systems predict a serialized parse, while the Edge Transformer predicts the graph representation. The reported graph baseline provides the closer architectural comparison, and the sequence scores give context for the best performance reported across output formulations.

COGS generalization accuracy for graph and sequence prediction The Edge Transformer graph predictor exceeds the reported sequence prediction accuracies.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Lexicon-equipped LSTM, sequence output | 82 |
| Transformer with tuned initialization, sequence output | 81 |
| Edge Transformer, graph output (this paper) | 87.4 |

### What the ablations show

#### Alter the content of a path

The first architectural change considered here removes the second edge from the route’s value. The weighting equations still use the query from the first edge and the key from the second. What changes is the vector mixed into the destination state.

```
v(i,ℓ,j) = V¹ x(i,ℓ)
```

Here v(i,ℓ,j) is the value for the route from i to j through ℓ. The symbol x(i,ℓ) denotes only the first edge state, and V¹ is its learned value projection. The indices i, ℓ, and j retain their meanings from full triangular attention. The second edge remains relevant through the attention weight for this route, but the content selected by that weight has no second projected factor.

This difference can be seen with the family example. The score can still depend on whether the first and second mother relations fit together. Once the score is computed, the value represents the first edge alone. The base architecture lets features from the second edge help shape the vector itself. That gives the next layer access to information expressed by the pair of links, in addition to the extent to which the route was selected.

The authors report that this value ablation consistently worsens performance on CLUTRR and CFQ dependency parsing. The effect therefore appears both when the system receives a graph of explicit family facts and when it starts from words and positions and has to predict a tree. The comparison supports the usefulness of combining both edge states in the route value. It leaves open whether the same multiplicative combination is preferable to other ways of combining both links, since those alternatives are outside this ablation.

#### Alter the comparison used to choose a path

Another variant keeps the two-edge value and changes the source of the key. It uses the destination edge’s state as the key input.

```
k(i,j) = Wᵏ x(i,j)
```

Here k(i,j) is the key used for the edge being updated, x(i,j) is its incoming state, and Wᵏ is the learned key projection. The positions i and j are the fixed endpoints. In the ablated score, this key is compared with the query from the edge i to ℓ. As ℓ changes, the query changes and the key stays the same for that destination edge. The second route edge from ℓ to j still contributes to the value.

The contrast identifies a particular decision inside the attention mechanism. In the base system, the score compares the first and second segments of a route. Under the ablation, it compares the first segment with the current representation of the destination edge. This retains a way to select intermediate nodes, but the score no longer directly evaluates the compatibility of the two consecutive segments. The variant therefore tests whether the shape of the score matters even when the value still combines both links.

The attention ablation hurts CLUTRR and COGS. On CLUTRR, the value and attention ablations both provide evidence about how the system uses routes. One changes what a route carries, and the other changes the comparison used to weight it. The COGS result extends the evidence about scoring to an output graph derived from sentences. The authors emphasize different effects across the tasks, so a change that hurts on one benchmark should be read in the context of that benchmark and the part of the update it modifies.

#### Give each layer separate parameters

The weight-sharing ablation keeps the pair states and triangular routing while giving each layer its own learned parameters. A tied architecture can apply the same transformation to information at different stages of aggregation. With separate parameters, a layer can instead specialize to the stage at which it is used. Whether specialization helps is an empirical question. The paper’s motivation for sharing is compatible with a repeated computation, such as deriving new intermediate relations and then using them in further updates.

The authors find some evidence of a deterioration on CLUTRR when training is restricted to k = 2, 3. They report a large effect on CFQ dependency parsing, where the ablations use MCD3. The dependency result establishes that the benefits of the tested architecture depend in part on how the layer parameters are used across depth. It does not isolate a single explanation for that dependence. Parameter sharing changes the number of independently learned weights and the constraint that the same transformation must apply throughout the stack.

The protocols are relevant to the strength of the comparisons. The authors rerun hyper-parameter selection for the CLUTRR ablations and retain the base configuration for the other ablation experiments. The CLUTRR appendix clarifies that selection takes place in the shorter training regime and that the settings are carried over to the other regime. For CFQ dependency parsing and COGS, the reported effects describe the architectural changes under the same settings used by the base Edge Transformer. The ablation tables average 10 runs. That makes each contrast an average over repeated training, while the fixed-settings results leave room for what a separate search might have found.

The RRAT comparison provides related evidence outside the formal ablations. RRAT already has changing edge states and predicts from the queried edge. Its lower CLUTRR accuracy shows that an edge-based readout and dynamic edge states, in that implementation, do not suffice to obtain the Edge Transformer’s results. Together with the route ablations, the comparison supports the authors’ emphasis on the arrangement of the computation, including which link pairs meet in a score and which link pairs contribute content.

### Limitations

#### Limits identified by the authors

The primary limitation is the cost of processing every possible intermediate node for every pair of endpoints.

```
O(n³)
```

Here O gives the order of growth, n is the number of input nodes, and the superscript ³ denotes cubic growth. The paper reports this scaling for computation and memory usage. The stored edge state has two node axes, but triangular attention adds a candidate intermediate node for each destination pair. The difference between the size of the persistent state and the size of the attention computation becomes consequential as the input grows.

The authors say their hardware experience allows training on inputs of up to about a hundred entities. The CFQ query experiment gives a concrete case of the constraint. They shorten the training distribution by removing examples with queries longer than 50 tokens, and even then report substantial training time. That cost also restricts their search for an Edge Transformer configuration. The semantic CFQ results describe the system under those training conditions.

The authors propose reducing the number of nodes when working with longer text. An Edge Transformer could focus on salient elements such as noun-phrase heads or named entities, while ordinary Transformer processing handles the broader input. They suggest hybrid architectures and pretraining on raw text as possible future work. Their experiments establish results for the evaluated systems and leave the proposed hybrid design untested. [Named entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/)

#### Limits of the evidence

The benchmarks give the authors control over what changes between training and evaluation. That control also narrows the claim. CLUTRR supplies a clean graph with the needed evidence, so it tests how the system combines given links. A system reasoning from a story would additionally have to identify the people, extract their relationships, and decide which statements matter. The experiment leaves those stages outside the task. Its longest evaluated chains also have a defined bound. Success within that range is evidence for extrapolation over the tested lengths, with no guarantee for arbitrary chain lengths.

CFQ illustrates why accuracy must stay attached to the output and split it measures. The dependency variant awards partial credit through LAS and whole-tree credit through EM. Query prediction evaluates a complete SPARQL sequence. Near-perfect dependency results on MCD1 and the large margins on the other dependency splits are evidence about the tree task. The 24.67 ± 1.27% mean exact match across MCD splits for query prediction shows how much harder the generative evaluation remains under the reported setup. The strong filtered random-split result provides a reference point for predicting queries when the partition imposes a different distribution shift.

The COGS evidence likewise depends on the output representation. The architecture uses token-label classifiers and parent prediction on an existing graph formulation of the semantic parses. That is a natural use of the edge tensor. The comparison with earlier graph predictors keeps the output formulation closer, while comparisons with sequence predictors include a change in how the semantic representation is produced. The headline accuracy supports graph-based semantic parsing on the benchmark. The paper does not run the Edge Transformer as a COGS sequence predictor, so it cannot isolate how much of the comparison with sequence scores comes from the architecture alone.

The rule analogy explains how the architecture makes certain relational operations available. The experiments measure predictions and compare selected design variants. A route receives its weight through learned vector projections, and a state can mix contributions from several routes. The ablations show that the full operation is beneficial in the reported conditions, with no direct examination of whether a particular prediction corresponds to a stable, readable logical rule. Establishing that would require evidence about the learned computation beyond its accuracy under the tested changes.

The comparisons also use different tuning procedures and run counts according to the task. The graph tasks permit a broader search, CFQ query prediction relies heavily on settings selected for a cheaper baseline, and COGS inherits architecture settings from prior Transformer work. Those choices specify the systems to which the results apply. The paper’s central empirical claim is that the tested edge-state architecture, with updates that join relations through a common node, improves performance on these compositional benchmarks. The experiments give no general estimate of its performance on longer, noisier, or differently structured inputs.

### What came after

The subsequent adoption of Edge Transformer’s triangular attention and pair states remains undocumented here. The authors’ own proposal for combining edge-based processing over selected nodes with ordinary attention over longer inputs is a direction they identify for future research.

## Cite

Cite as Leon Bergen, Timothy J. O'Donnell and Dzmitry Bahdanau. 2021. Systematic Generalization with Edge Transformers. arXiv:2112.00578.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.2112.00578](https://doi.org/10.48550/arxiv.2112.00578) · [arXiv 2112.00578](https://arxiv.org/abs/2112.00578)

```bibtex
@misc{bergen2021systematic,
  title = {{Systematic Generalization with Edge Transformers}},
  author = {Leon Bergen, Timothy J. O'Donnell and Dzmitry Bahdanau},
  year = {2021},
  doi = {10.48550/arxiv.2112.00578},
  eprint = {2112.00578},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2112.00578}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
