Elamur Research

A2N: Attending to Neighbors for Knowledge Graph Inference

Paper · 2019 · Trapit Bansal, Da-Cheng Juan, Sujith Ravi et al.

Summary

A knowledge graph records facts as links between entities. It can tell us where a person lived or which instruments a musician played, yet leave out other facts about the same people. A2N addresses the problem of filling those gaps. Given an entity and a relationship such as nationality, it ranks the entities that could complete the fact. Its central idea is that the relationships already recorded for the person can help answer the question, and their usefulness depends on which fact is missing.

Earlier approaches commonly learned a fixed vector for each entity and used it in every query. A2N keeps such a vector as a starting point and builds a second, query-specific representation from the entity’s immediate neighborhood. Each neighbor contributes both an entity and the relation that connects it to the source. A2N assigns these pairs weights, combines their vectors, and uses the result alongside the original entity vector to score possible answers. When the query concerns nationality, a place of residence can carry more weight than it would in a query asking about the person’s profession.

The authors test A2N on FB15k-237 and WN18RR. When the source is given and only the target is missing, A2N leads the reported comparisons across all four ranking metrics on both benchmarks. Its mean reciprocal rank, which rewards placing the recorded answer near the top, is 0.422 on FB15k-237 and 0.49 on WN18RR. The comparison is more mixed when the test also asks for missing sources. A2N has the highest mean reciprocal rank on WN18RR at 0.45, while ConvE leads on FB15k-237 with 0.325 against A2N’s 0.317.

The authors inspect individual predictions to see what the neighbor weights reveal. In their nationality example for Oprah Winfrey, a relationship to a place can move her representation toward a region of the vector space that helps the system rank the United States highly. The authors interpret this as a way to use information spanning multiple graph links. A2N reads the source’s immediate neighbors and relies on learned vectors for the rest of the association. The displayed weights show which neighboring facts contributed to that representation. They leave open which other facts the system relied on to connect those neighbors to its answer.

Deep dive: A2N: Attending to Neighbors for Knowledge Graph Inference

A2N ranks missing links in knowledge graphs by weighting a different set of an entity’s known relationships for each prediction. · about 33 minutes to read

The problem and its context

What it means to fill a gap

A graph fact has a direction. In a statement that a person lived in a place, the person occupies the source position, the place occupies the target position, and the relation tells us what connects them. Another statement involving those entities could use a different relation and carry a different meaning. A collection of such statements is therefore more informative than a list of which names occur together. The labels on the links make it possible to ask which place a person lived in, which country a person is associated with by nationality, or which geographical area contains a location.

The authors take graph incompleteness as the starting point. Graphs assembled by people or by automated methods can both leave facts unrecorded. The paper points to Open Information Extraction from the Web in discussing the problem. Completion starts with the links already available and tries to identify plausible additional ones. The distinctive constraint in this paper is that the entity to be placed in the blank comes from the graph’s entity inventory. An answer proposes a new relationship involving entities that the task already knows how to name.

For a target query, the source and relation are given. A nationality query for a named person has this form. A source query gives the relation and target instead. Asking who has a particular nationality reverses which participant is missing while preserving the meaning of the relation. These versions have the same structure as exercises in filling a blank, but they put different demands on an inference system. A named person brings a particular neighborhood of observed facts. A country given as the target can correspond to many people, each of whom is a legitimate answer. The paper considers both directions because a system for completing facts can be asked to work from either end.

It helps to separate the input graph from the answer the evaluator has recorded. A triple can be absent from the graph seen by the system and still be known to the evaluator. This is how a graph with gaps can support a test with checkable answers. The system assigns scores to candidates, and the evaluator checks how high the designated answer appears. The fact that it was held back gives the experiment its force. A lookup of the visible triple alone cannot complete that particular query.

What fixed representations ask of an entity vector

The paper situates A2N among approaches that represent entities and relations with embeddings. An embedding is a list of learned numbers. Its value comes from how it is used with other vectors. In graph completion, a scoring function combines the vectors for the source, relation, and proposed target. Training makes the combinations corresponding to observed links score well against alternatives. At test time the same function can evaluate triples that were absent during training. The numbers in the vectors are shaped by the task of scoring relationships.

The earlier work described in the paper gives several ways to implement that scoring function. TransE treats a relation as a translation in the embedding space, so a source shifted according to the relation should be compatible with the target. DistMult gives a relation control over how strongly each coordinate of the source and target contributes to their score. ComplEx extends the representation into complex space, while ConvE uses convolution over the representations involved in a prediction. Different choices give the score different ways to express compatibility. The papers associated with the first three approaches are Translating Embeddings for Modeling Multi-relational Data, Embedding Entities and Relations for Learning and Inference in Knowledge Bases, and Complex Embeddings for Simple Link Prediction.

With a fixed entity embedding, a query can still change the answer because the scoring function receives the relation. A profession query and a nationality query apply different relation parameters to the same source vector. The authors’ concern is about what information reaches that score. Every useful feature about the source, including features that matter only for particular questions, must be available through a single learned representation if that representation is the sole input about the entity. The graph may also contain individual observations that would be useful to bring into the computation at the moment a question is asked.

The authors illustrate that distinction through a person linked to Maui by residence. The place can be useful evidence for a query about nationality because its embedding can reflect relationships connecting it to the United States. The corresponding vector need only help with this question. Its usefulness says little about how a place vector would serve a query about occupation. The question is whether the completion system can select a fact for its relevance to the current relation and incorporate that fact into the representation it scores.

How earlier approaches used the graph

One alternative is to search for a succession of links. A path-based system can start from the query entity, follow an edge to another entity, and continue until it reaches a candidate answer. The authors discuss earlier reinforcement-learning approaches that learn to make such choices. They compare directly with MINERVA in the target prediction experiment and also identify DeepPath as work in this area. This line of research matters to A2N because facts separated by more than one edge can be useful even when the first edge has a different label from the relation in the query. DeepPath: A Reinforcement Learning Method for Knowledge Graph Reasoning

Another line of work learns node representations from nearby nodes. The paper discusses graph convolution and graph attention in this connection. These approaches make the surrounding graph part of how a node is represented. The authors distinguish the particular form of neighborhood composition they need for completion. The relation supplied in the query should alter the mixture for a given source. A representation aggregated from the neighborhood and then used for every relation leaves this choice to the downstream scoring step. Semi-Supervised Classification with Graph Convolutional Networks and Graph Attention Networks

A previous neighborhood mixture approach comes closer to the paper’s starting point. As the authors describe it, that approach learns a mixture for a neighborhood that stays fixed across questions. It also uses parameters specific to entity–relation pairs. A2N draws on separately learned entity and relation vectors and composes them when it encodes a neighbor. The difference matters when an entity and a relation have been seen individually but their pairing is new. With separate vectors, the components needed for the computation are available. How informative the composition will be remains an empirical question.

The paper also connects its approach to memory networks used for question answering. The analogy concerns the use of a question to weight stored information. In A2N, the material to consult consists of graph facts adjacent to the source. Those facts come with relation labels, and the answer is chosen by ranking entity candidates. This gives the paper a specific design problem within the broader study of knowledge representation and reasoning. It must encode a labeled neighboring fact, judge its relevance to a question, and convert the result into scores over possible answers. Key-Value Memory Networks for Directly Reading Documents and Ask Me Anything: Dynamic Memory Networks for Natural Language Processing

The method, step by step

From a question to an updated source vector

Suppose the input gives a person and asks for their nationality. A2N starts from the person’s learned vector and the vector for nationality. It also retrieves the graph facts attached to that person. A fact about where they lived contributes a pair, consisting of the residence relation and the place. A fact about a different aspect of their life contributes a different pair. The relation label is part of the evidence in each case. The system can therefore distinguish links to the same entity made under different relations.

A2N turns every pair into a vector and asks how well that vector fits the question. Here, a question consists of both the source and the requested relation. The system converts the neighbors’ scores into weights that sum to one. A highly weighted fact contributes more to the pooled vector, while several moderately weighted facts can contribute together. A2N then joins the pooled vector to the original source vector and maps the combination back to the embedding size used by the scoring function. This last operation gives the scorer a representation with access to the original entity information as well as the evidence retrieved from its neighborhood.

Once the source has been represented for this question, A2N uses the same resulting vector to evaluate every possible answer. It applies the query relation and compares the source representation with each candidate’s learned entity vector. The candidate that receives the highest score is placed first. A new question for the same person repeats the weighting and aggregation with a different relation, so the same visible graph can supply different evidence without requiring a permanently stored vector for every question.

How A2N ranks answers to a graph query

The steps in order.

How A2N ranks answers to a graph queryStep 1: Start with the source entity and query relation1. Start with the source entity and query relationStep 2: Retrieve the source’s labeled neighbors2. Retrieve the source’s labeled neighborsStep 3: Encode each neighbor relation and entity together3. Encode each neighbor relation and entity togetherStep 4: Score and normalize neighbors for the query4. Score and normalize neighbors for the queryStep 5: Pool neighbor vectors using their weights5. Pool neighbor vectors using their weightsStep 6: Combine the pool with the base source vector6. Combine the pool with the base source vectorStep 7: Score and rank candidate entities7. Score and rank candidate entities

The graph and the scoring function

The notation distinguishes the entities that appear in the graph, the relations linking them, and the vectors used to score facts. The paper uses an integer index set to refer to entities and relations by their identifiers.

[X] = {1, …, X}

Here X is the size of the index set, and [X] contains the integers from 1 through X. The braces mark a set, and … stands for the consecutive indices between its endpoints. The paper uses this convention to refer to all the entity identifiers or all the relation identifiers without giving the names individually.

G := {(s, r, t)}

Here G is the observed graph, represented as a set of triples. The symbol := marks a definition. Each ordered triple contains a source entity s, a relation r, and a target entity t. The source and target come from [Vₑ], where Vₑ is the number of entities. The relation comes from [Vᵣ], where Vᵣ is the number of relations. The same entity can appear in either entity position across different triples.

q := (s, r, ?)

Here q is the target query, s is the given source, r is the given relation, and ? marks the missing target. Replacing the blank with a candidate creates a triple that can be scored. The intended completion is a fact absent from the observed graph, so the same formalism covers both asking the question and specifying what kind of gap the answer should fill.

The paper uses DistMult for the score. Each entity and each relation has an embedding of the same dimension. DistMult uses corresponding coordinates of the source and target, scaling their interaction by the corresponding coordinate of the relation vector.

f(s, r, t) = s̃ᵀ Diag(r̃) t̃

Here f gives the scalar compatibility score of the triple with source s, relation r, and target t. The tildes identify their vectors s̃, r̃, and t̃. The superscript ᵀ transposes the column vector for the source into a row. Diag(r̃) is a square matrix with the entries of the relation vector on its diagonal and zeros elsewhere. Its height and width both equal the embedding dimension, written k in the paper’s notation. The product takes the source and target entries at each coordinate, weights their interaction by the relation entry at that coordinate, and adds the contributions into a single score.

This diagonal structure is why a change in the query relation can make different coordinates matter, even when the entity vectors are held fixed. A2N gives DistMult something further to work with by changing the source vector itself. The paper chooses DistMult for its simplicity and its performance when tuned, and presents the neighborhood representation as something that could be paired with other scoring functions. The reported experiments use DistMult for both neighbor relevance and final answer scoring.

What counts as a neighbor

A2N treats a labeled edge out of the source as the unit of neighborhood evidence. The item to encode has an entity at its far end and a relation identifying the connection. This definition also explains how the paper brings information from incoming links into the computation through inverse relations added to the graph.

Nₛ := {(rᵢ, eᵢ) | (s, rᵢ, eᵢ) ∈ G}

Here Nₛ is the neighborhood of source s. The index i identifies a neighboring fact. Its relation is rᵢ, and its entity is eᵢ. The vertical bar means “such that,” and ∈ G means that the triple on its left is present in the graph G. An entity appearing under distinct relations can give rise to distinct pairs. An entity connected only through a more distant chain has no entry by virtue of that chain alone.

An inverse relation expresses an observed link in the opposite direction with a corresponding relation label. Adding these links increases the facts that can be reached directly from an entity under the outgoing-neighborhood definition. It also preserves the information about which direction the original fact took. This matters when a query starts from an entity that occurred as the target of a recorded link. Information from that link can reach the attention step through the inverse relation.

The vector for each neighboring fact is obtained by projecting its relation and entity vectors together. This allows the same neighbor entity to make different contributions when it is connected by different relations. The projection parameters are shared among neighboring facts.

ñᵢ = Wₙ [r̃ᵢ; ẽᵢ⁰]

Here ñᵢ is the vector representing neighbor i. The vector r̃ᵢ represents that neighbor’s relation, and ẽᵢ⁰ is the base vector for its entity. The superscript ⁰ marks a base embedding. The brackets with a semicolon denote concatenation, which places the entries of one vector after those of the other. Wₙ is the learned linear projection from that concatenation to the common embedding size. It has K rows and 2K columns, where K is the embedding dimension written as k in the earlier notation. The product applies the same projection regardless of which source owns the neighboring fact.

The query relation and the relation on the neighbor have different jobs. The query relation names the missing fact the system wants to complete. The neighbor relation names an available fact that could help. For nationality, a residence link can be useful even though it expresses a different relationship. The projection uses the residence label and the place to represent that piece of evidence. The attention calculation then uses the nationality relation to judge whether the resulting vector is useful in this particular query.

How the query changes the weights

The neighbor vector occupies the candidate position in a DistMult-style score. This score uses the base source embedding, so the attention calculation can begin before the query-specific source embedding exists. The notation nᵢ in the score stands for a neighboring fact regarded as a candidate for attention.

aᵢ = f(s, r, nᵢ) = (s̃⁰)ᵀ Diag(r̃) ñᵢ

Here aᵢ is the raw attention score for neighbor i. The function f uses the same form as the triple score, with s the given source, r the query relation, and nᵢ the neighbor in the position ordinarily occupied by a target. The vector s̃⁰ is the source’s base embedding, ᵀ denotes transpose, and Diag(r̃) places the query relation’s vector on the diagonal. The final factor ñᵢ is the encoded neighbor from the previous step. The product gives one number reflecting how the source and query relation jointly match that encoded fact.

The paper calls this bilinear attention. With the relation held fixed, the score is linear in the source vector when the neighbor is fixed, and linear in the neighbor vector when the source is fixed. Changing the relation changes the diagonal weights used in both operations. This construction ties the relevance judgment to the particular entity as well as to what the question asks. Two people with some of the same neighboring facts can produce different scores, just as the same person can produce different scores for different requested relations.

The raw scores are then normalized over the neighbors. The operation used is a softmax, which gives higher-scoring neighbors larger weights and puts the weights on a common scale within the query.

pᵢ = exp(aᵢ) / ∑ⱼ₌₁^{|Nₛ|} exp(aⱼ)

Here pᵢ is the normalized attention weight for neighbor i, and exp is the exponential function. The numerator uses that neighbor’s score aᵢ. The denominator uses ∑ to add the exponentiated scores exp(aⱼ) over all neighbors, with j running from 1 through the number of neighbors |Nₛ|. The slashes around Nₛ in ordinary speech are cardinality bars in the formula, so they count items in the neighborhood. The division makes the resulting weights sum to one across the neighbors being considered.

The normalization gives the weight a relative meaning. It describes how much of the pooled vector’s weighting is assigned to a fact among the alternatives available to that query. A larger raw score for one item can reduce the shares given to the others even when their own raw scores stay the same. The attention weights are intermediate quantities. The probabilities used in training to distinguish the recorded target from sampled alternatives are formed later from a separate collection of scores.

How the evidence reaches the answer score

A2N pools the encoded neighbors using those weights. This turns a collection of evidence items into a vector with the size expected by the next stage, whatever the number of items participating in the collection.

ŝ = ∑ᵢ₌₁^{|Nₛ|} pᵢ ñᵢ

Here ŝ is the pooled neighborhood representation for source s under the current query. The sum ∑ takes each neighbor indexed by i, from 1 through the neighborhood size |Nₛ|. It multiplies the neighbor vector ñᵢ by its scalar weight pᵢ before adding it. The hat distinguishes this intermediate representation from the base embedding and from the final source vector. A strongly weighted item has more influence on the pool, and the vectors of several items can contribute at the same time.

The original source embedding enters again after pooling. The paper gives the system a learned projection that can draw on the pool and on what the base embedding already encodes about the entity.

s̃ = Wₛ [ŝ; s̃⁰]

Here s̃ is the source representation that will actually be used to rank answers. Wₛ is the source projection matrix, with K rows and 2K columns for embedding dimension K. The bracketed expression concatenates the pooled vector ŝ with the base embedding s̃⁰. The projection returns a vector of dimension K. Since the pool was formed using the question, the resulting vector can vary with the query even though the base source embedding and the projection parameters stay the same.

The answer score uses the resulting source vector, the query relation, and a candidate target’s base embedding. This is the same DistMult expression as before, now with the two entity positions filled by representations produced in different ways.

f(s, r, t) = s̃ᵀ Diag(r̃) t̃⁰

Here f measures the compatibility of source s, relation r, and candidate target t. The source vector s̃ is the query-specific result of pooling and projection, and ᵀ transposes it. Diag(r̃) applies the query relation’s coordinate weights. The vector t̃⁰ is the candidate’s base entity embedding, identified by the superscript ⁰. In a target query, the same s̃ and r̃ are used for all candidate targets. Sorting the scores yields the predicted order over the entity inventory.

The authors’ reason for using a similar score in both places is that the projected neighbor vectors can occupy a space compatible with the target representations. Consider again nationality for a person linked to Maui. The system can give the residence fact a high weight, and its contribution can help produce a source vector that is compatible with the United States under nationality. The example depends on what the graph has taught the embeddings about places and countries. The scoring calculation has no step that takes Maui as a new source and retrieves its outgoing links for this particular question.

How the parameters are learned

Training begins with randomly initialized parameters. The learned quantities include the base entity vectors, the relation vectors, and the neighbor and source projections. An observed triple supplies a positive answer. The authors hide its target and sample entities that would give triples absent from the graph when inserted into that target position. Those candidates serve as negatives for the training operation.

t⁻ = {e | (s, r, e) ∉ G}

Here t⁻ represents the set described by the paper for choosing negatives. The variable e runs over entity candidates, s is the source and r the relation of the positive example, and ∉ G means the proposed triple is absent from the observed graph G. The vertical bar imposes that condition on the set. The procedure draws a sample of these entities. A candidate’s status as a negative follows from absence in the graph, which can occur even when the corresponding statement would be true outside it.

The system scores the positive and sampled negatives using the same query representation. A softmax over those scores gives the recorded answer a likelihood relative to the alternatives. Training adjusts the embeddings and projections to increase that likelihood. This gives the attention mechanism supervision through the answer. When a neighboring fact helps place the positive answer above the sampled negatives, the learning signal can affect how the fact is encoded, how its weight is computed, and how the pool contributes to the source representation.

The authors repeat the training process in the other prediction direction by hiding the source given the relation and target. They also add inverse relations across the graph to enlarge the neighborhoods available to attention. Thus direction enters both what the system is asked to predict and which observed facts it can consult. The same fitted system is later used for the target-only evaluation and the evaluation that combines both directions.

The authors select hyper-parameters using validation Hits@10, the share of validation queries for which the recorded answer falls within the top results at that cutoff. They try embedding dimensions of 128, 256, and 512 and choose 512. They consider 500, 1000, and 2000 negative samples per training query and use 2000. The batch size, or the number of examples grouped for an update, is chosen as 1024 from settings of 256, 512, 1024, and 2048. These values describe the selected training setup. The paper reports final test rankings separately.

The optimizer uses a fixed learning rate of 0.001, with its two averaging coefficients set to 0.9 and 0.999. The authors cap the gradient norm at 10 to limit the size of unusually large gradients. They use dropout on all embeddings and after both projections. Dropout randomly suppresses some activations during training. Its probability is shared across these locations, chosen as 0.3 on both datasets from 0.4, 0.3, 0.2, and 0.1. Adam: A Method for Stochastic Optimization

A separate cap affects the evidence itself. At most 500 neighbors are used for an entity. When the available neighborhood exceeds that cap, the authors select a random subset. The embedding dimension fixes the width of the vectors and projections, while this cap limits the number of neighbor items the procedure handles. Since the attention scores are normalized over the participating items, the contents of that subset determine what evidence can enter the pooled representation on a given computation.

Experiments and results

The test asks for ranks

The experiments use FB15k-237 and WN18RR as benchmarks for graph completion. Both support the same basic test. There is a set of held-out triples, and every triple can furnish a query with its target removed or a query with its source removed. The authors report an evaluation limited to target queries and a separate evaluation that uses queries in both directions. That distinction changes the set of questions being averaged. It is essential when comparing numerical results, even for the same system and dataset. FB15k-237 is credited to Representing Text for Joint Embedding of Text and Knowledge Bases.

At evaluation time, the recorded answer is ranked among graph entities. The procedure filters out other entities that would complete the same query with a known true fact, checking the training, validation, and test splits for such answers. If a query has several recorded completions, one can be the designated answer on the current test while the others are removed from its competitors. This makes the recorded answer’s rank less dependent on the presence of alternatives that the dataset itself already regards as correct. The filter still depends on which truths the benchmark has recorded.

Mean reciprocal rank, abbreviated MRR, averages the reciprocal of the designated answer’s rank across queries. A first-place answer contributes more than an answer further down the list. Hits@N measures the share of queries on which the answer is inside the first N positions. The paper reports Hits@1, Hits@3, and Hits@10. Hits@1 is exact agreement with the first ranked answer, while the larger cutoffs allow room for competing candidates. A system can therefore improve the frequency of first-place answers while another retrieves the designated answer within the wider shortlist more often.

There is also a difference between the ranking test and the training comparison. Training uses a set of sampled negatives along with the positive answer. Evaluation considers the graph’s entity inventory with the known-answer filter applied. A training setting of 2000 negatives describes the learning procedure. A test metric describes where the answer appeared under the larger ranking procedure. The two operations use scores from the same system for different purposes.

Predicting a missing target

For target-only evaluation, the authors take baseline scores from the MINERVA study, which tuned its systems for that task. The comparison includes a fixed-vector DistMult scorer, ComplEx, ConvE, and the path-search system MINERVA. A2N is evaluated using the system already trained to predict both sources and targets. The comparison therefore tests how well that fitted system answers target queries against published results whose baselines were tuned for that setting.

On FB15k-237, A2N has the highest MRR at 0.422. ConvE is the closest system on this measure at 0.410. A2N also leads on Hits@1 with 0.328 against ConvE’s 0.313, on Hits@3 with 0.464 against 0.457, and on Hits@10 with 0.608 against 0.600. These are all test results for missing targets. In this comparison the order of the leading systems holds both at first place and at the wider cutoffs, so the MRR result is accompanied by gains across the reported views of the ranking.

FB15k-237 target-only test mean reciprocal rank

A2N leads the reported target-ranking systems, with ConvE closest.

FB15k-237 target-only test mean reciprocal rankDistMult: 0.370DistMult0.370ComplEx: 0.394ComplEx0.394ConvE: 0.410ConvE0.410MINERVA: 0.293MINERVA0.293A2N (this paper): 0.422A2N (this paper)0.422
The numbers
System or settingMRR
DistMult0.370
ComplEx0.394
ConvE0.410
MINERVA0.293
A2N (this paper)0.422

The path-search comparison is particularly relevant to the method. On the FB15k-237 target-only test, MINERVA has Hits@1 of 0.217, Hits@3 of 0.329, and Hits@10 of 0.456. The corresponding A2N results of 0.328, 0.464, and 0.608 show that the system using local attention and learned representations ranks the benchmark’s answers more effectively in this setting. The experiment compares the complete systems. The difference incorporates everything about how each one generates scores, including the use of distinct inference procedures.

On WN18RR, A2N has target-only MRR of 0.49. MINERVA is the nearest comparator on that metric at 0.45 and is also nearest on Hits@3, with 0.46 against A2N’s 0.50. The closest system depends on where in the ranking the test looks. ConvE reaches Hits@10 of 0.52, compared with A2N’s 0.55, while DistMult and MINERVA each have Hits@1 of 0.41 against A2N’s 0.45. The consistent result is that A2N is ahead at each reported cutoff. The identities of the closest baselines change across those cutoffs.

WN18RR target-only test mean reciprocal rank

A2N leads on missing targets, with MINERVA the strongest baseline on this metric.

WN18RR target-only test mean reciprocal rankDistMult: 0.43DistMult0.43ComplEx: 0.42ComplEx0.42ConvE: 0.44ConvE0.44MINERVA: 0.45MINERVA0.45A2N (this paper): 0.49A2N (this paper)0.49
The numbers
System or settingMRR
DistMult0.43
ComplEx0.42
ConvE0.44
MINERVA0.45
A2N (this paper)0.49

The target-only results also show what the neighborhood architecture adds in comparison with the reported DistMult baseline at the level of a complete system. Both use the same basic kind of triple score. On FB15k-237, the baseline’s Hits@1 is 0.275 and A2N’s is 0.328. On WN18RR, the corresponding values are 0.41 and 0.45. That comparison gives a reader a reference point for the additional neighborhood computation. Establishing which part of that computation accounts for the difference would require keeping more of the training and architecture fixed across variants.

Predicting in both directions

The source-and-target evaluation compares A2N with DistMult, ComplEx, ConvE, and R-GCN, a relational graph convolution approach. The authors use their own tuned DistMult implementation in this comparison. Other baseline results are reported from the corresponding papers. The source-and-target table is a different comparison from the target-only table both in the test queries and in the origins of the baseline values.

On FB15k-237, ConvE leads this test on all four metrics. Its MRR is 0.325 and A2N’s is 0.317. ConvE also has Hits@1 of 0.237, Hits@3 of 0.356, and Hits@10 of 0.501. A2N records 0.232, 0.348, and 0.486 on those respective measures. A2N is second among the systems reported on each of these metrics. The head-to-head outcome on FB15k-237 thus depends on the prediction directions included in the comparison. A2N leads the target-only test, while ConvE leads the combined test.

FB15k-237 source-and-target test mean reciprocal rank

ConvE leads when both query directions are included, with A2N next.

FB15k-237 source-and-target test mean reciprocal rankDistMult: 0.278DistMult0.278ComplEx: 0.247ComplEx0.247R-GCN: 0.249R-GCN0.249ConvE: 0.325ConvE0.325A2N (this paper): 0.317A2N (this paper)0.317
The numbers
System or settingMRR
DistMult0.278
ComplEx0.247
R-GCN0.249
ConvE0.325
A2N (this paper)0.317

The WN18RR combined test gives a different pattern. A2N records MRR of 0.45, ahead of ComplEx at 0.44 and of ConvE and DistMult at 0.43 each. It also has the highest Hits@1 at 0.42, with ComplEx next at 0.41. At Hits@3, A2N and ComplEx tie at 0.46. At Hits@10, ConvE leads with 0.52, while A2N and ComplEx receive 0.51. R-GCN has no result reported for WN18RR in the table. The WN18RR lead is therefore clearest on the measures that place particular emphasis on the head of the ranking.

The authors observe that results generally look better when the test asks only for targets. An example helps explain their interpretation. A query asking for the nationality of a specified person has a different degree of ambiguity from a query asking for a person with United States nationality. The latter can be completed by many people. Filtering removes alternative answers already recorded in the data, but the graph’s incompleteness can leave other plausible candidates in the list. The authors expect that neighborhood attention will be of limited help for particularly broad source queries.

For A2N, the contrast across protocols is visible on both datasets. Its FB15k-237 MRR is 0.422 for the target-only test and 0.317 for the source-and-target test. Its WN18RR MRR is 0.49 for the target-only test and 0.45 for the source-and-target test. These are results from the same trained system. The benchmark changes which questions count, and the comparison with other systems changes along with it. The paper reports an average over both directions in the combined test, so the combined table does not give the missing-source results as a separate set of rankings.

What the ablations show

The paper has no controlled component ablation. It offers comparisons with other complete systems, examples of attention changing with the question, and a cosine-similarity inspection of the learned entity vectors. Together these analyses address whether the mechanism behaves as intended in particular cases and whether it is compatible with good completion performance. They provide different kinds of evidence from a component test that removes only query conditioning, only the base source vector, or only access to labeled neighbors while keeping the rest of the setup fixed.

What changes when the question changes

The Oprah Winfrey example follows a single source across different questions. The neighborhood belongs to the same person in both cases, so observing different weights is direct evidence that the learned procedure uses the question when it distributes attention. The figure displays selected high-weight neighbors. The important comparison is between the roles of the same available facts under the different queries. The system can give prominence to a residence link on nationality because the weighting operation receives nationality as an input.

This example shows why inspecting labeled facts is more informative than seeing only the names of the neighboring entities. The relationship by which a place is connected to a person makes a difference to what the fact could say about them. The procedure gives that relation a place both in the vector encoding and in the interpretation of the resulting display. When the relevant item concerns residence, the reader can see a connection to the nationality question that would be harder to identify from a list of unnamed vector coordinates.

The example also makes the authors’ account of implicit multi-hop inference concrete. The person has a direct edge to a place. Knowledge tying that place to a country can be reflected in the embeddings learned from the rest of the graph. The system attends to the direct edge and scores the candidate country from the resulting source representation. The displayed weight concerns the edge to the place. The country connection is an interpretation of how the learned scoring geometry could bridge the rest of the inference.

What different kinds of queries bring forward

The appendix examines a profession query for Bill Payne. The highlighted evidence includes a recording contribution as a synthesizer and a connection to playing keyboards. These facts are expressed through relations different from the desired profession. The authors describe how the system can use them to infer musician. The example makes clear that a neighbor can matter because it supplies evidence for another relation. The query and the neighbor are allowed to describe different facts about the same person.

For Burt Young, the query asks about nationality, and the authors point to place of birth among the kinds of neighbors that receive attention. They also describe places of residence as useful for such questions. The relationship label differentiates the significance of the geographical evidence. A birthplace and a residence may both suggest a country association, even though each can hold independently of nationality. The mechanism learns to make use of the association seen in the graph, and the example lets a reader assess whether the retrieved facts make sense in context.

In a time-zone query, the available evidence includes a location’s state and metropolitan area. These neighboring facts can place the source geographically in ways that help rank a time-zone entity. The reasoning has the same shape as the nationality example at the level of the architecture. It begins by assigning weight to information directly attached to the source and finishes by matching a target using the requested relation. The entities and relation labels are different, which gives the paper an example of the same procedure operating outside the biographical queries.

Viewed together, these examples show a range of evidence types that the learned attention can surface. The profession query brings forward information about musical activity. The nationality and time-zone queries bring forward different forms of geographical information. The inspection is useful at the level of particular predictions because a reader can compare the query, the evidence, and the resulting answer. It does not measure the frequency with which the same pattern occurs across either benchmark.

What the base embeddings capture

The authors also examine the initial entity vectors before neighborhood attention. They retrieve nearby vectors using cosine similarity, which compares the direction of the vectors. This is a separate analysis from the attention examples. A nearest neighbor in this analysis is close in the embedding space. An attention neighbor is an entity connected to the source by an observed labeled edge and weighted for a particular query. The same word therefore describes two different relationships to a source entity in the paper.

Among the base embeddings close to Two and a Half Men is How I Met Your Mother. The University of Oxford is close to the University of Cambridge, and Edinburgh is close to places including Aberdeen and Glasgow. These cases support the authors’ observation that the embeddings can group entities with related functions or roles. Such groupings can help explain why combining suitable neighbor vectors can move a source representation towards a useful part of the embedding space. The table samples those groupings. It supplies no aggregate measure of their consistency.

The base-vector inspection is also relevant to the difference between selecting evidence and supplying the answer. The attention step supplies a weighted mixture of vectors that already carry information learned from the graph. The final projection and DistMult score use that information to evaluate candidate entities. Finding related entities near one another gives the authors a reason to think that the intermediate representation can be useful. The inspection does not separately measure how much of an answer was recoverable from the source’s base embedding before the mixture was added.

What the baseline comparisons can establish

DistMult is a natural comparison because A2N retains its form of answer scoring. The target-only results show that supplying a query-specific source representation can work well in a system built around that score. The published DistMult runs and A2N differ in more than the presence of attention, including their fitted representations and the computations supplying them. A reader can attribute the reported ranking difference to the systems as evaluated. The evidence is too coarse to assign it to a particular set of neighbor weights.

R-GCN serves a different comparison because it brings graph neighborhoods into the representation. Its comparison with A2N on the FB15k-237 combined test indicates how the two completed systems rank answers under the same reported protocol. It does not hold the neighborhood encoder constant while changing only whether the query can influence the mixture. The paper’s claim that query-conditioned composition is a useful design choice draws on both the ranking results and the examples showing that the weights do indeed change in a meaningful way.

MINERVA clarifies a related distinction. The stronger target-only scores for A2N show that explicitly searching for paths is unnecessary to attain the better reported answer ranks in that comparison. The attention examples then offer a possible account of how some multi-fact answers can arise without search. A query-level analysis that identified which held-out facts require particular paths, and measured success separately on those facts, would address a narrower question than the ranking tables or neighbor examples answer.

Limitations

Limits the authors identify

The authors explicitly expect attention to have limited value for generic missing-source queries. The nationality example specifies a relation and country, which may fit a broad set of people. Neighbor attention can identify information relevant to that country and relation, but relevance is compatible with many answers. This is a limitation of what the query singles out as well as of what the source representation can do. The authors use it to explain why predicting sources alongside targets is generally a harder setting in their experiments.

They also present joint inference over text and graph facts as future work. The implemented mechanism in the experiments collects graph neighbors. One extension the authors envisage is to attend to textual mentions of entities as additional evidence. That would widen the input beyond structured links and change what needs to be encoded and selected. The paper’s current results concern graph completion on the two benchmarks, with no reported experiment combining the two kinds of evidence.

The paper emphasizes that the learned parameter count is independent of neighborhood size. In comparing with a previous fixed mixture approach, the authors give the following order for their entity and relation parameter inventory.

O(Vₑ + Vᵣ)

Here O denotes the order of growth, Vₑ is the number of entities, and Vᵣ is the number of relations. The plus sign expresses that separate entries for entities and relations are counted together. The order describes growth with the inventory sizes at a fixed embedding dimension. A2N additionally has shared projections whose sizes are determined by that dimension.

For the earlier approach that allocates parameters to entity–relation pairs, the paper gives the following possible order.

O(Vₑ × Vᵣ)

Here O again denotes an order of growth, and Vₑ and Vᵣ are the entity and relation counts. The multiplication sign represents the potential inventory of pairs. The comparison concerns how many trainable representations the two designs may need as the inventories increase. It does not measure the time needed to gather evidence or to rank the answers.

The neighborhood cap qualifies the practical reach of the aggregation. A source with more than 500 neighbors has a randomly sampled subset used in its representation. The architecture can attach separate weights to all the items that enter the pool, so this implementation choice bounds the work for one query. The evidence available to that operation is correspondingly bounded. If a useful fact falls outside the sample, its potential relevance cannot affect the weights or the answer on that computation.

Limits that follow from the design and evaluation

The composition of separately learned vectors makes a new pairing of known components representable. That is narrower than demonstrated performance on unseen entities or entirely new relations. The equations assume base vectors for the source, neighboring entities, and candidate answers, as well as vectors for relations. The experiments rank candidates drawn from the benchmark entity inventory. They do not establish how to initialize a missing entity’s vector, how well a newly introduced relation would work, or how much graph evidence would be needed to make either case reliable.

Local access also defines the strength of the multi-hop claim. The system calculates attention over immediate neighbors of the query entity, including those available through inverse links. Information from farther away can reach the prediction insofar as it has been captured in learned vectors and scoring parameters. The qualitative cases are consistent with that account. They cannot identify a necessary downstream edge in a specific computation, certify a particular chain of facts, or show how reliability changes with the length of the chain. These would be separate claims about the mechanism.

Attention weights are visible and attached to recognizable facts, which supports the paper’s characterisation of A2N as interpretable. Their meaning is specific to the pooling operation. The final ranking also depends on the base source embedding, the source projection, the query relation, and the candidate’s base embedding. A large neighbor weight alone cannot show whether removing that fact would change the top answer. The examples establish which items received emphasis within the neighborhood pool. They do not constitute interventions on the predictions.

The ranking scores have a similarly bounded interpretation. For training, sampled negatives are selected because their proposed triples are absent from the observed graph. For testing, the filter removes other known correct answers and leaves the remaining graph entities as candidates. Both choices are understandable for an incomplete dataset, and both depend on its records. A plausible completion can still be treated as a negative during training or as a competitor to the designated test answer. Good filtered ranks establish agreement with the held-out benchmark facts under that protocol. They cannot certify every highly ranked new fact as true.

The paper reports the scores of the systems as fitted, with comparative values coming from more than one source. This breadth gives the reader useful context about competitive performance. It limits how much of a score difference can be assigned to query conditioning alone. The paper does not report a matching uniform-weight or query-independent variant with the same projections and training setup. Similarly, it reports point results in its main comparison tables and gives no variability across runs or statistical test alongside them. The comparisons establish the reported ordering. Claims about its stability require further evidence.

Parameter sharing has a further practical boundary. Even with a fixed set of projection weights, the method computes scores for the neighbors it considers and then scores candidates from the entity inventory. Restricting the neighborhood reduces the first kind of work. It does not reduce the number of answer candidates described in the evaluation protocol. The paper gives the parameter comparison and neighborhood cap but supplies no measured runtime or memory comparison in its experiments. Its empirical case is about how answers rank.

Finally, the examples illuminate the paper’s mechanism through selected queries and selected nearest neighbors. The examples are sufficiently concrete to let readers inspect why a place, an instrument, or an administrative area might matter to a prediction. They leave open how frequently attention finds similarly relevant evidence, how often it gives prominence to misleading associations, and how performance depends on the available neighborhood. The benchmark averages and the examples answer complementary questions. The averages describe the answers’ ranks, and the examples show how some of those predictions can be examined.

What came after

Low-Dimensional Hyperbolic Knowledge Graph Embeddings (2020) cites A2N and addresses a different aspect of graph representation. Its title identifies the use of hyperbolic embeddings at low dimensionality. A2N’s contribution concerns how a representation is assembled for the current question, by selecting and combining observed facts around the source. The citation establishes a connection between the papers. It leaves open whether the later work adopted, modified, or compared A2N’s neighborhood attention.

Cite

Cite as Trapit Bansal, Da-Cheng Juan, Sujith Ravi and Andrew McCallum. 2019. A2N: Attending to Neighbors for Knowledge Graph Inference. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/p19-1431

@inproceedings{bansal2019a2n,
  title = {{A2N: Attending to Neighbors for Knowledge Graph Inference}},
  author = {Trapit Bansal, Da-Cheng Juan, Sujith Ravi and Andrew McCallum},
  booktitle = {Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1431},
  url = {https://doi.org/10.18653/v1/p19-1431}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/bansal-2019-a2n-attending-neighbors-knowledge-graph/