GAP: A Graph-aware Language Model Framework for Knowledge Graph-to-Text Generation
Paper · 2022 · Anthony Colas, Mehrdad Alvandipour and Daisy Zhe Wang
Summary
A database can record who took part in a debate, where it happened and what it was about. Turning those records into prose requires keeping each fact attached to the right people and places while deciding how to tell the story. GAP studies this problem for a knowledge graph. A graph stores each fact as a relation between entities. A description has to express those relations in sentences, often combining facts that the graph stores separately.
GAP starts with BART, a pretrained text generator. It writes the graph as a sequence of labeled facts so that BART can interpret the names and relation phrases in context. It then groups the resulting token representations by the entity or relation they belong to. A separate attention operation lets these graph components exchange information with their neighbors. A mask determines which exchanges are allowed, and an optional learned bias changes their weight according to the kind of connection. The encoder adds the resulting graph information back to the token representations that support text generation.
The authors fine-tune GAP on paired graphs and descriptions without adding a graph-specific pretraining stage. On the WebNLG v2.0 test set, its best configuration reaches a BLEU score of 66.20, compared with 64.55 for fine-tuned BART and 65.92 for JointGT with its full set of additional pretraining tasks. On the EventNarrative test set, GAP reaches 35.08 BLEU against BART’s 31.38. The best system varies with the metric. JointGT leads on METEOR in the WebNLG comparison and on ROUGE-L and BERTScore in the EventNarrative comparison.
The controlled comparisons show why the choice of neighbors matters. Letting relations attend directly to other relations gives the weakest WebNLG BLEU result among the masks tested without a type bias. The same broad mask gives the highest BLEU once the bias is enabled. The authors also find that GAP leads the reported WebNLG comparisons when fine-tuned on small fractions of the training data. Their examples show both more natural phrasing and factual errors, including wrong dates in event descriptions. The experiments establish that a graph-aware encoder can compete with additional graph-specific pretraining in these settings. The scores and examples leave open how reliably it preserves individual facts.
Deep dive: GAP: A Graph-aware Language Model Framework for Knowledge Graph-to-Text Generation
GAP adds graph structure to a pretrained text generator and tests how it affects knowledge graph descriptions on WebNLG and EventNarrative. · about 36 minutes to read
The problem and its context
Turning linked records into a description
A graph and a paragraph organize the same subject in different ways. A graph can put an event at the center and connect it separately to its location, date, participants and topic. A paragraph has to put those facts in an order and indicate which ones belong together. It can name an event once and use the same sentence to express its location and date. It can present two participants as a pair even though each participant has a separate connection to the event. Producing readable prose involves making such choices while preserving what the connections say.
The paper introduces the task with the Great Debate. The graph links the event to the National Museum of Natural History, Harlow Shapley and Heber Doust Curtis. It also supplies a topic, Astronomy, and an alternative name for the event. A generator has to recognize that the names designate participants in the same event, that the museum is its location and that the alternative name refers to the event itself. The wording of a relation can suggest a phrase to use, but its position in the graph determines which facts that phrase should connect.
This is why the paper treats text generation as a problem of interpreting structure as well as choosing words. A reader of the graph can see the shared event at a glance. A generator that receives the facts in a row sees the event label in several places. The repeated label carries a clue, and the markers around it can identify its role within each fact. The generator still has to work out how the different occurrences fit together for the description it is writing.
The authors place graph-to-text generation in the context of work on dialogue responses grounded in knowledge, question answering, stories and event narration. They also distinguish the inputs they study from those in Abstract Meaning Representation-to-text. Their account characterizes those inputs as following a more restricted, densely connected structure. A knowledge graph can have relatively few links among its components. A suitable encoder therefore has to account for the connections actually present in a particular input, including graphs whose relations are distributed unevenly among entities.
Sparsity concerns the graph’s connections, not how short the resulting description must be. An event can have several properties that each attach to the same central entity, with few links among the other entities. A paragraph about that event can still be substantial. Conversely, a small graph can involve a chain of facts where attaching a phrase to the wrong entity changes the meaning. The paper’s architectural question is whether providing the actual neighborhood helps a pretrained generator manage these distinctions.
What earlier encoders made available
The authors describe earlier graph encoders that built representations from neighboring nodes. Such systems first processed the graph and then generated text from the resulting representations. The neighborhood supplied a direct way to determine which pieces of input could inform each other. Graph Attention Networks are part of the background the authors give for learning from connected data.
Other graph-to-text work used a more global encoder based on the Transformer and attention. In the authors’ account, some of these systems computed self-attention over all graph nodes. Self-attention lets an input item build a contextual representation using other items in the same input. A global view therefore gives every node a chance to incorporate information from distant parts of the graph. The set of available interactions in such an operation can be much broader than the set of connections recorded by the graph.
A separate line of work started from pretrained text generators. Systems such as BART, GPT and T5 could be adapted to graph-to-text by writing each graph as an input string. This is called linearization. It gives the generator a sequence of familiar inputs, including words and markers, and lets it use what it learned during language pretraining. The paper notes that this approach had sometimes already surpassed graph-based encoders. That result made the pretrained text encoder an attractive starting point even for work whose main interest was graph structure. BART · T5 · Text-to-Text Pre-Training for Data-to-Text Tasks
A linearized graph retains the labels of its entities and relations. With delimiters, it also retains which terms form each fact. What changes is the form in which the graph presents the connection between facts. A link obvious in a graph drawing may be encoded by a name that appears in distant parts of the sequence. A global attention operation can bring the distant occurrences together. Its access pattern, taken by itself, gives the same opportunity to tokens that have no direct graph link. GAP keeps this global pathway and introduces another operation whose access pattern is determined by the graph.
Some prior work adapted generators through a further stage of pretraining before task-specific fine-tuning. Fine-tuning here means updating a pretrained system on examples of the graph-to-text task. The preceding, additional stage used a larger graph-and-text collection and designed objectives that could be applied to it. One example in the paper’s account is asking a system to recover text that has been masked while it has access to a complete graph. Such a task can teach correspondence between graph records and wording before supervised training on a particular benchmark. Building and processing the extra data carries a cost.
KGPT and JointGT are the paper’s main examples of that approach. KGPT adds graph-to-text generation on the KGText corpus before fine-tuning. JointGT uses graph reconstruction, text reconstruction and graph–text alignment on KGText. The authors also discuss prior efforts to combine pretraining and graph encoders. They characterize JointGT’s graph attention as allowing connectivity among all nodes and emphasize that it does not update relation representations in the way GAP can. They cite graph convolution adapters for Abstract Meaning Representation-to-text as another example of bringing graph computation into a pretrained system.
An additional strand of earlier work used relative position to influence attention. In a sequence, relative position can say how far apart items occur. For the graph-to-text approaches discussed by the authors, a structural position can also encode how nodes are situated relative to each other. GAP asks a related question about the kind of connection involved. An entity linking to another entity and a relation linking to an entity can call for different weights even when both pairs count as neighbors. Self-Attention with Relative Position Representations
GAP brings these strands together around an architectural question. If the starting encoder already has useful representations for language, what graph information should be made explicit during fine-tuning? The authors propose giving the global token encoder and the local graph operation different jobs. The former reads the labels in the context of the whole input. The latter exchanges information between entities and relations according to a chosen neighborhood. Changing the neighborhood or the weighting of connections then becomes an experimental intervention, while the pretrained starting point stays the same.
The method, step by step
From triples to tokens
The input is a graph of entities and labeled relations. For the generator, a fact takes the form of a head entity, a relation and a tail entity. The labels head and tail identify the roles of the entities within that fact. In an event-location fact, for instance, the event can occupy the head position and a venue the tail position. The relation tells the generator what the venue has to do with the event. Other triples can reuse the event in a different role or connect a participant to another entity.
The paper gives the graph and its edge set the following form.
G = (V, E), E ⊂ V × R × V
G is the input graph. V is the set of entity vertices, E is the set of edges and R is the set of available relations. The Cartesian products denoted by × enumerate combinations of an entity, a relation and another entity in that order. The subset symbol ⊂ says that the graph records selected combinations. Each entry in E records which relation connects the first entity to the last. Later formulas reuse the letter V for attention values, where its meaning is determined by the operation.
GAP prepares the graph for the text encoder by listing its triples in a sequence. Special tokens delimit each triple and indicate its head, relation and tail. These markers make the roles available to the encoder even where adjacent labels would be hard to parse from the text alone. The spelling of a label stays available too. A relation with a multiword name goes through this stage as part of the same kind of input sequence as a multiword entity name.
The input sequence and the graph view can be understood as two arrangements of the same example. A landmark name that occurs in more than one triple has several positions in the sequence. In the graph view, those occurrences can contribute to one representation of the corresponding entity. The reverse mapping later tells the encoder where to return the information calculated for that entity. The method therefore needs to retain which token occurrences belong to each graph component as it prepares the sequence.
How GAP turns an input graph into text
The steps in order.
Reading the full sequence
Within an encoder layer, the global attention operation begins with a vector for each sequence position. A vector represents a token numerically. Its contents can already reflect context from earlier layers. The operation lets a position draw on information from the entire linearization, which is why the paper calls it global. For example, two occurrences of the event name can inform each other even if they are separated by markers and by the words of other triples.
Attention uses queries, keys and values. The query represents what a position is looking for in the other positions. A key contributes to how strongly a position matches that query. The corresponding value supplies the information added to the result when the match receives weight. The same input vectors provide all three, through separate learned projections. This is self-attention because the items doing the looking and the items they can look at come from the same sequence.
In the following equations a layer index is written as a superscript on the representations and as a subscript on the weights. The superscripts on W label the three projections.
Q = Xˡ⁻¹ Wₗᑫ
Q is the matrix of queries for layer l. Xˡ⁻¹ collects the token vectors available from the preceding layer, indexed by l minus one. Wₗᑫ is the learned query projection for layer l. Adjacent matrix symbols denote matrix multiplication, and the equals sign specifies how to construct Q.
K = Xˡ⁻¹ Wₗᵏ
K is the matrix of keys. Xˡ⁻¹ is the same collection of incoming token vectors, and l again indexes the current layer. Wₗᵏ is the learned projection that turns those vectors into keys. This gives the encoder a separate way to represent what a position offers as a candidate match.
V = Xˡ⁻¹ Wₗᵛ
V is the matrix of attention values. Xˡ⁻¹ is again the matrix of incoming token representations, and Wₗᵛ is the learned value projection at layer l. A key governs the match, while its corresponding value is the vector mixed into the result.
The paper describes the incoming token matrix with the following shape.
Xˡ⁻¹ ∈ ℝⁿˣᵈ
Xˡ⁻¹ is the token representation entering layer l. The membership symbol ∈ indicates that it belongs to a space of real matrices, denoted by ℝ with the shape n by d. The n rows correspond to input tokens and the d columns hold the features of their representations. The attention equation uses dₖ for the vector dimension used in scaling the query–key scores.
Xˡ = Attn(Q, K, V) = softmax(QKᵀ / √dₖ) V
Xˡ is the contextualized token representation at layer l after this global attention. Attn names the attention operation. Q, K and V are the query, key and value matrices. The superscript ᵀ transposes K, so QKᵀ compares each query with each key. The slash divides those scores by √dₖ, the square root of the attention vector dimension. Row-wise softmax converts the scores for each query into weights that sum to one. Multiplying by V mixes the value vectors using those weights, giving each token its updated representation.
The global operation can be initialized with parameters from the pretrained text generator. In the experiments, BART supplies that starting point. Suppose a relation label has several words. Each word’s representation can reflect the other words of that label as well as the entities around it in the sequence. This is useful preparation for the graph operation. The graph component will receive a vector that already reflects how its constituent tokens were used in the full input.
Pooling the sequence into graph components
The next operation changes what a row represents. In global attention a row stands for a token position. In graph attention a row stands for an entity or a relation. Token-level rows would be awkward for defining graph neighbors. A multiword place name could occupy several positions, and a repeated name could contribute positions scattered through the sequence. A graph neighborhood is defined for the place as a graph component. Pooling brings its associated positions together.
GAP uses averaging for this step. It takes the contextualized token vectors belonging to an entity or relation, including the corresponding positions when the component recurs, and averages them into a single vector. The resulting row can then participate in graph attention. An entity and a relation both receive a row, even though the input graph formally defines vertices as entities and represents relations as part of its edges. This expanded set of attention items is what lets GAP update relations directly.
X_gˡ = pooling(Xˡ)
X_gˡ is the graph-component representation at layer l, with g indicating the graph view. Xˡ is the token representation from global attention at that layer. The function pooling averages the token vectors assigned to each graph component. It returns a row for each component represented in the graph operation.
X_gˡ ∈ ℝᵐˣᵈ
X_gˡ is the pooled representation at layer l. The membership symbol ∈ and ℝ indicate a matrix of real numbers, with m rows and d columns. Here m denotes graph components and d gives the width of their vector representations. The unpadded graph view has fewer rows than the token sequence in the paper’s formulation. For parallel processing, the authors use a fixed capacity large enough for the graphs being processed and use masking to address valid entries in that representation.
A pooled entity vector can carry information from several triples before it exchanges anything in the graph operation. That follows from the construction: global attention can use the whole input, and pooling can average occurrences from different positions. Thus a local graph mask makes the next exchange local. Its effect concerns which pooled rows may contribute directly to another row. It does not erase the wider context already present in those rows.
Choosing which neighbors can contribute
In the graph operation, queries, keys and values are projected from X_gˡ using learned graph-attention parameters. The entries of the attention score matrix now compare graph components. A query might correspond to the Great Debate as an entity or to a relation such as participant. The columns represent possible sources of information for that query. The authors use a matrix M to decide which sources are available.
A row for an entity can permit neighboring entities, incident relations or both. A row for a relation can likewise be configured to receive information from neighboring entities or neighboring relations. This choice is made separately for the two query roles. It is possible, for instance, for an entity to receive information from an incident relation while that relation receives information only from its entity neighbors. The framework can express that combination because the rows specify receiving components and the columns specify the components they can draw from.
The mask is an expanded adjacency representation. An adjacency matrix for a graph typically says which vertices are connected. Here the rows and columns also include relations, so the mask can regulate exchanges involving a relation as an item. The mask contributes zero where a source is allowed and negative infinity where it is blocked. After softmax, a blocked entry gets no weight in this operation. An allowed entry can receive a different weight depending on the learned query and key and, where used, its connection type.
The paper writes mask variants with a superscript giving the target types available to entity queries and a subscript giving those available to relation queries. The symbols e and r refer to entities and relations. For instance, the mask whose entity queries can use both kinds of neighbor and whose relation queries can use only entities can be written Mᵉ˒ʳₑ. The diagram in the paper contrasts it with a mask in which queries of either kind can use only neighboring entities. That difference leaves the entity queries with fewer sources in the latter configuration. The authors use the contrast later to examine how access to a relation label is associated with changes in the prose.
Allowing a connection is a decision about eligibility. If an entity query has access to several neighbors, the corresponding scores still determine how much their values contribute. The graph mask has a different role from taking the mean in pooling. Pooling assigns the corresponding token vectors to a component and averages them. Graph attention learns how to mix the component vectors available under the chosen mask.
Learning a preference by connection type
The second addition to graph attention represents connection types. The authors give a pair of components an integer code based on whether the items are connected and whether they are entities or relations. An entity–relation pair shares a code in both query directions. The formulation can still give different weights in those directions because the query and key scores are ordered and the mask can impose different rules on the corresponding rows.
Tᵢⱼ = ⎧ 0 if the items are unconnected
⎪ 1 if the items are neighboring entities
⎨ 2 if the items form a connected entity–edge pair
⎩ 3 if the items are adjacent relations
Tᵢⱼ is the entry in the type matrix T for query item i and key item j. The braces give the cases for assigning it a code. The values 0, 1, 2 and 3 label, respectively, unconnected items, neighboring entities, a connected entity and edge, and adjacent relations. The codes stand for categories. Their numerical order carries no stated meaning about how strong a connection should be.
γ : ℤ → ℝ
The symbol γ names the learned lookup. The colon introduces its domain and range, and the arrow indicates the direction of the mapping. ℤ denotes the integers used for the type codes and ℝ denotes real-valued outputs. The lookup places one learned scalar at each position of T according to that position’s code. The resulting matrix is written γ(T).
The graph operation combines the content-based scores, the mask and the type bias before converting scores to weights.
X̃_gˡ = Attn₍M,T₎(Q, K, V) = softmax(QKᵀ / √dₖ + M + γ(T)) V
X̃_gˡ is the updated graph-component matrix at layer l. The tilde indicates the update, and g distinguishes graph rows from token rows. Attn₍M,T₎ denotes attention conditioned on mask M and type matrix T. Q, K and V are the queries, keys and values projected from the pooled graph representation. As in global attention, Kᵀ is transposed, the product QKᵀ gives pair scores and √dₖ scales them. The plus signs add M and the looked-up type biases γ(T) to those scores. Softmax acts across the keys for each query. The final product with V mixes the allowed graph values.
The order of these operations explains how GAP can use both a firm rule and a learned preference. If the mask blocks a connection, adding a finite type bias leaves it blocked. Within a mask that allows both entity and relation neighbors, different biases can shift their relative weights. A broad mask can therefore learn some of the behavior of a narrower mask by giving low weight to a category it still permits. A restricted mask provides fewer connection categories over which that preference can operate.
The bias is shared by items with the same connection type. It can help express a general preference, such as giving adjacent relations less influence, while the query–key term remains free to distinguish particular items. The type code describes the structural role of a pair. It does not assign a separate learned bias to each named predicate, such as participant or location. That vocabulary is available through the vectors built from the sequence.
Returning the update to the decoder’s input
The graph attention output has a row for each graph component, whereas the rest of the text-generation pathway uses token positions. GAP gathers the component updates back into the sequence using the mapping established during preparation. Positions that belonged to a component can receive the corresponding graph vector. Adding this vector to the contextual token representation lets several positions of a multiword or repeated label share a graph update while retaining their separate token representations.
X̃ˡ = gather(X̃_gˡ) + Xˡ
X̃ˡ is the resulting token representation from layer l. The gather function maps the updated graph rows in X̃_gˡ to their associated token positions. Xˡ is the token representation produced by global attention at that layer. The plus sign denotes a residual addition, meaning that the graph result is added to the existing representation. The output has the token-level arrangement needed by the succeeding language processing and eventual decoding.
The decoder then produces the description from the encoded input. The graph signal reaches it through token vectors that have passed through both the global and graph-aware operations. This is an encoder modification. It changes what data the decoder receives and is trained to use. The decoding process does not check off every input triple as it writes, so the presence of a graph connection in the encoder cannot by itself guarantee that the corresponding fact appears correctly in the output.
How the system was trained
The authors initialize the pretrained part with the Hugging Face bart-base checkpoint and keep the global attention hyper-parameters at their defaults while experimenting with graph attention. The training examples pair an input graph with its reference description. GAP is fine-tuned on those pairs. The authors do not first adapt it on KGText or run a separate graph reconstruction or alignment objective. They state that they released the code publicly.
The implementation uses byte-pair encoding, a form of subword tokenization. Its vocabulary size is 50,265. A label can therefore correspond to several sequence positions even when a reader would regard it as a single name or word. The graph pooling step operates on the positions associated with that component after tokenization. The appendix reports a batch size of 16 and uses Adam to update the parameters.
For the two datasets, the appendix lists 6 global layers and 6 graph-aware layers. It lists a node setting of 50 for WebNLG and 60 for EventNarrative, with a relation setting of 60 for both. The larger node setting accommodates the larger event graphs. The listed embedding size is 128. These are configuration values for the implementation, so the node setting should not be read as a count of vertices in a typical example.
The training table gives 1600 warmup steps and evaluation periods of 500 for WebNLG and 5000 for EventNarrative. It lists a beam size of 5 and a length penalty of 1 for both. Beam size controls how many candidate continuations the search retains as it generates text. For EventNarrative the appendix reports a maximum output size of 512. The authors select systems by validation BLEU and report training each system on two NVIDIA RTX 2080 Ti GPUs.
The appendix gives inconsistent learning rates. Its prose reports 3e-5, while its table lists 2.00E-05 for both datasets. It does not identify which value produced the reported results. The table and narrative otherwise agree on details such as the batch size and the use of a larger graph capacity for EventNarrative. The learning rate is therefore a specific uncertainty when reconstructing the training setup from the paper.
Experiments and results
What the datasets test
WebNLG associates small sets of DBpedia facts with descriptions written by human annotators. The paper uses WebNLG v2.0 and its official split. It reports 34,352 training, 4,316 validation and 4,224 test graph–text pairs. A graph has up to 7 triples and can have more than one reference description. A count of graph–text pairs therefore need not equal a count of distinct graphs.
The references offer examples of how a writer can arrange and combine the facts. Several descriptions can be adequate for the same graph, and different references may choose different words for a relation. This is a useful setting for testing whether an encoder helps a generator produce text close to descriptions people wrote for the input. It also means that the target of an automatic comparison is a set of written realizations, with all the variation that entails.
EventNarrative takes a different route to producing supervised pairs. It starts with event graphs from EventKG and Wikidata and matches them with sentences from Wikipedia. Its official split contains 179,543 training, 1,000 validation and 22,441 test graph–text pairs. The paper reports more unique graph components than in WebNLG and includes event graphs larger than WebNLG’s upper limit.
The origin of the references affects what counts as a good description. In WebNLG, annotators verbalize the given records. In EventNarrative, a Wikipedia sentence can contain details about the event that the matched graph omits. A system can consequently miss part of the reference while staying within the data it was given. The paper’s errors illustrate this distinction, alongside cases where a system supplies unsupported or incorrect information. The two datasets test the same broad task under different relationships between input and reference.
The authors explore mask and type settings on WebNLG and take selected configurations to EventNarrative because of computational constraints. The latter experiment therefore asks whether promising graph encoders help on a larger event-centric dataset. It provides limited evidence about how to choose among all the masks for that dataset. The WebNLG experiments carry most of the evidence about which connections to allow.
What the comparisons measure
The baseline closest to GAP is BART fine-tuned on the supervised task. This baseline uses the pretrained generator and a linearized input without GAP’s additional graph attention. Comparing it with GAP asks whether the new encoder helps when both approaches start from the same kind of pretrained system and use graph–text supervision. The comparison also changes the amount of encoder computation and the number of parameters, so the mask ablations matter when interpreting what accounts for the benefit.
WebNLG also includes a graph convolutional encoder, an earlier WebNLG system by Shimorina and Gardent, and versions of KGPT with and without additional pretraining. The JointGT rows separate additional BART-style pretraining on KGText from JointGT’s graph–text pretraining objectives. The BART-style condition uses text infilling and sentence permutation. This comparison helps distinguish gains from exposure to extra training on that corpus from gains associated with objectives tailored to graphs and their descriptions.
For EventNarrative the paper takes the reported BART and T5 baseline scores from the dataset’s earlier work and adapts JointGT with the hyper-parameters from its own paper. The adaptation extends the comparison to a graph–text pretraining system on the event benchmark. Because the baselines come from different sources or adaptations, the score table is a benchmark comparison across systems. It does not establish that each benefited equally from tuning for EventNarrative.
The main automatic metrics are BLEU, METEOR and ROUGE-L. BLEU scores overlap between generated text and reference text using sequences of words. The three metrics give different views of how closely an output resembles a reference. METEOR and ROUGE-L provide additional comparisons alongside BLEU, and the EventNarrative table also reports BERTScore. Agreement across columns strengthens a claim about a comparison. Different rankings indicate that any overall claim depends on what the evaluation rewards. BLEU · METEOR · ROUGE
The scores describe relationships between generated and reference texts. They do not directly trace each phrase to the graph. For instance, two systems can both name a person and an event from the input but disagree about the person’s role. Their vocabulary may still overlap with the same reference. A less literal description can also score lower in spite of expressing the graph correctly. The paper’s qualitative analyses help make sense of these possibilities, though they do not assign their frequency across the test set.
WebNLG results
On the WebNLG v2.0 test set, both reported main GAP configurations improve on fine-tuned BART in BLEU, METEOR and ROUGE-L. GAP with the broad mask and the connection-type bias gets 66.20 BLEU. GAP with the more selective mask and no type bias gets 65.92, the same reported BLEU as JointGT with full additional pretraining. Fine-tuned BART gets 64.55. The chart includes distinct pretraining conditions because they are central to the paper’s question about what the change in architecture can replace.
Systems compared by BLEU on the WebNLG v2.0 test set
GAP with connection-type encoding leads the comparison, and GAP without it ties fully pretrained JointGT.
The numbers
| System or setting | BLEU |
|---|---|
| Shimorina and Gardent | 61.00 |
| KGPT without additional pretraining | 62.30 |
| KGPT with additional pretraining | 64.11 |
| Fine-tuned BART | 64.55 |
| JointGT with BART-style additional pretraining | 64.60 |
| JointGT with graph–text additional pretraining | 65.92 |
| GAP with selective mask | 65.92 |
| GAP with broad mask and type encoding (this paper) | 66.20 |
METEOR yields a different ranking. On the same WebNLG test set, BART scores 46.51. The selective-mask GAP scores 46.81 and the type-encoded GAP scores 46.77. JointGT with graph–text pretraining leads at 47.15, and JointGT with BART-style additional pretraining scores 46.78. On ROUGE-L, BART scores 75.13, fully pretrained JointGT scores 76.1 and the two GAP settings reach 76.22 and 76.36, respectively. The strongest evidence against full JointGT is thus on BLEU and ROUGE-L. JointGT retains the advantage on METEOR.
The paper reports 153M parameters for each of the two main GAP settings and 160M for the JointGT settings in the WebNLG comparison. BART has 140M. The change therefore adds parameters to the BART baseline while using fewer than the reported JointGT configurations. It also dispenses with the extra pretraining stage used by the competitive JointGT rows. These are two concrete aspects of the comparison. The table does not give training times or a common accounting of computation across all stages.
An important detail is how much of the result appears without the learned type bias. The selective mask alone reaches the same reported BLEU as fully pretrained JointGT and exceeds BART on the other main metrics. The small further BLEU lead of the broad, type-encoded setting is the strongest WebNLG headline result. Taken together, the rows suggest that most of the competitive result is already available through a well-chosen neighborhood, while learning from connection types provides another way to organize the graph attention.
EventNarrative results
The BLEU ranking on the EventNarrative test set also favors GAP. Fine-tuned BART scores 31.38, and the JointGT adaptation scores 31.19. The selective mask reaches 34.02. The broad mask with the type bias reaches 35.08. This is the same ordering between the two GAP configurations as in the main WebNLG BLEU comparison. The underlying data here contain a wider set of components and include longer graphs.
Systems compared by BLEU on the EventNarrative test set
Both GAP settings lead the baselines, with the highest score going to the setting with type encoding.
The numbers
| System or setting | BLEU |
|---|---|
| T5 | 12.8 |
| JointGT | 31.19 |
| Fine-tuned BART | 31.38 |
| GAP with selective mask | 34.02 |
| GAP with broad mask and type encoding (this paper) | 35.08 |
On EventNarrative test METEOR, BART scores 26.68 and JointGT scores 26.58. The selective-mask GAP scores 26.93, and the broad, type-encoded setting leads at 27.50. On ROUGE-L, BART scores 62.65. The GAP settings score 62.90 and 64.28, while JointGT leads with 64.91. That column illustrates how a system can have more overlap of the kind measured by ROUGE-L while sitting lower in the BLEU ranking.
The EventNarrative test BERTScores are also close for the leading systems in the table. BART records 93.12, the selective-mask GAP 93.13 and the type-encoded GAP 93.38. JointGT scores 93.68, and T5 scores 89.59. The benefit of the graph-aware encoder relative to BART is most apparent in BLEU among these reported comparisons. The small change in BERTScore between BART and the selective-mask setting illustrates why the BLEU ranking by itself gives an incomplete picture of how the outputs compare.
There is an inconsistency between the EventNarrative discussion and its score table. The discussion attributes the stated improvements over BART to the selective mask. The strongest GAP values in the table are assigned to the broad mask with type encoding, and the selective mask has its own lower scores. The direct comparisons above follow the configuration labels in the table. They show a benefit for each reported GAP configuration over BART on the three main metrics, with the stronger result belonging to the type-encoded setting.
What the ablations show
The effect of changing who can attend to whom
The mask ablation keeps the GAP framework and changes the allowed graph connections. The authors first compare masks without the type bias on the WebNLG v2.0 test set. This comparison asks whether it helps to select the neighborhood more carefully after the encoder already has access to the full input through global attention. It also distinguishes the value of letting entities read relations from the value of letting relations read one another.
The selective mask, where an entity can read neighboring entities and relations while a relation can read only nearby entities, reaches 65.92 BLEU. With the broadest mask, where both kinds of query can read both kinds of neighboring component, BLEU is 64.64. The difference in what is accessible to relation queries matters within this comparison. Allowing direct exchanges among relation neighbors gives the encoder more ways to mix the graph information, but the mask ablation shows a lower score when that option is available without a learned type preference.
The mask that limits both kinds of query to entities scores 65.11 BLEU. Its result sits between the broadest mask and the selective mask. This helps identify a distinction within the general idea of sparse attention. Suppressing relation-to-relation attention can help even when the remaining mask is restrictive. Giving entities access to their incident relations as well as entity neighbors can be helpful in its own right. Those relation vectors carry the contextualized language of the predicates, which can inform how the entity is described.
The other restricted setting in the comparison scores 65.86 BLEU, 46.86 METEOR and 76.28 ROUGE-L. The selective mask that leads these configurations in BLEU scores 46.81 METEOR and 76.22 ROUGE-L. The WebNLG ablation thus identifies two close contenders whose ordering depends on the metric. It gives clearer evidence about the weaker behavior of unrestricted relation-to-relation exchanges than it does about a single best mask across evaluation criteria.
The structural intervention is local to graph attention. In all these settings a relation’s token representation has already been contextualized by global attention. When the mask blocks a direct relation-to-relation contribution, it limits one pathway for mixing relation information. Other pathways through the token sequence and through neighboring entities remain available. This is why the evidence supports an encoder design choice about direct exchanges, with a narrower interpretation than saying the generator benefits from ignoring other relations altogether.
When type encoding changes the ranking
The type ablation repeats the WebNLG comparison after adding the learned bias. The broadest mask moves from 64.64 to 66.20 BLEU. Its ROUGE-L moves from 75.04 to 76.36. The change is important because the broad mask can keep its topology while learning different score adjustments for different structural categories. The result is consistent with the authors’ interpretation that the generator can reduce the influence of some admitted connections while retaining those connections for cases in which they are helpful.
Effect of type encoding on BLEU for the WebNLG v2.0 test set
The broad mask gives the lowest score shown without type encoding and the highest score with it.
The numbers
| System or setting | BLEU |
|---|---|
| Broad mask without type encoding | 64.64 |
| Selective mask without type encoding | 65.92 |
| Selective mask with type encoding | 65.34 |
| Broad mask with type encoding (this paper) | 66.20 |
The selective mask tells the opposite story. Its BLEU falls from 65.92 to 65.34 with type encoding. On the WebNLG test set its METEOR goes from 46.81 to 46.31 and its ROUGE-L from 76.22 to 75.59. The other restricted setting drops from 65.86 to 65.43 BLEU but has a different pattern from that of the broad mask. For the entities-only target mask, adding the bias raises BLEU from 65.11 to 65.24 and lowers ROUGE-L from 75.62 to 75.44. The effect therefore depends on which choices the mask leaves open and on which score is used.
The authors’ explanation rests on the different roles of the mask and the bias. A selective mask has already eliminated some interactions. A bias added afterwards can only change the balance among the remaining sources. In the broad setting, the learned scores can approximate aspects of a more selective pattern without imposing the same prohibition on every example. Because the scores also depend on queries and keys, an individual tokenized relation can affect an entity differently from another relation of the same structural category.
There is a distinction between this explanation and evidence that the generator has learned a particular rule. The tables establish that bias and mask interact: changing the bias changes which mask performs best. A test of the precise mechanism would have to establish what weights the system learns across examples, and whether changing particular graph-attention pathways reliably changes corresponding facts or wording. The paper offers an example of that investigation with attention visualizations.
Fine-tuning with fewer supervised examples
The WebNLG few-shot learning comparison varies the fraction of labeled training data. It retains the pretrained starting points and asks how the respective systems fare when the graph-to-text pairs for fine-tuning are scarce. This comparison bears directly on the authors’ claim about replacing an additional training stage with architectural information. A system with an explicit graph neighborhood can use that information on every example, even when it receives comparatively few supervised pairs.
At 0.5% of the WebNLG training data, BLEU scores are 33.92 for BART, 37.18 for JointGT and 39.50 for GAP with the broad mask and type encoding. At 1%, they are 39.08, 42.26 and 44.03 in the same order. The ranking holds with more labeled data in this experiment. At 5%, the scores are 52.24, 54.41 and 55.68, and at 10% they are 56.58, 57.73 and 58.30.
Every fraction therefore favors the reported GAP setting over the two comparison systems. The comparison also shows that exposing graph structure does not remove the need for task examples. GAP’s BLEU is lower with the smallest fraction than with the larger fractions, and the full WebNLG experiment gives a higher score. The result supports the use of the graph-aware encoder under reduced supervision, while its strength still depends on what supervised examples are available.
This is evidence from WebNLG and for the selected GAP configuration. The experiment does not separate the contribution of the broad mask from that of the type bias under every data fraction. It also provides no parallel few-shot result for the event benchmark. Its specific contribution is to show that the full architectural alternative to additional graph-specific pretraining is competitive when the supervised WebNLG set is restricted in the reported way.
Breaking out shorter and longer graphs
The authors group the WebNLG v2.0 test graphs into sets with 1-3 and 4-7 triples. The size analysis asks whether the same mask is appropriate as the description has more facts to connect. The selective mask scores 71.48 BLEU in the 1-3 group and 61.53 in the 4-7 group. The broadest mask without the type bias scores 69.74 and 60.57 for those groups. The authors see the clearer separation on smaller graphs, where opening additional direct exchanges among relations appears less useful.
One of the other restricted masks scores 71.28 BLEU on the 1-3 group and 61.59 on the 4-7 group. The mask where both kinds of queries use entity neighbors scores 70.18 and 61.05. These comparisons show why the full-set BLEU ordering need not hold in every group. The selective mask leads for the shorter WebNLG graphs, while another restricted mask gets the highest reported BLEU in the longer group. The shared fall across all settings is a stronger pattern than the exact ordering among the longer-graph scores.
The appendix gives an EventNarrative size breakdown for the selective mask. Its test BLEU is 44.48 for the 1-3 triples group, 23.86 for 4-7 and 11.47 for the group labeled 7+. The dataset counts attached to those groups are 16,103, 5,152 and 1,184. The authors describe the last group as containing graphs beyond WebNLG’s maximum. By spanning a range unavailable in WebNLG, EventNarrative makes it possible to observe the notably low reference overlap on the longer event graphs.
Graph size here is a property of the grouped examples. As the graphs get larger, their events, graph components or associated text can also change. The analysis does not hold a graph fixed and add triples while keeping the reference conditions comparable. It identifies a setting where generation scores are lower, for the configuration tested. It cannot determine how much of the change comes from the number of triples itself.
What individual outputs reveal
The authors examine attention weights for a WebNLG graph about the novel Aenir. The graph includes the related book Above the Veil and information about country and language. The first comparison uses the selective mask and the mask under which both kinds of query attend only to entities. Both heatmaps show fairly even weights among the items made available by their masks. The visible difference is thus largely in the paths each mask admits.
In the selective setting, the entity associated with Australia and the country relation can attend to one another. Above the Veil can also attend to the country relation. The resulting description includes a country phrase. In the more restrictive setting, entity queries cannot use the country relation directly, and the authors find that the corresponding output adds some repetition rather than expressing that piece of information. The comparison connects a concrete change in available graph information to a concrete change in the generated text.
A further comparison uses the broad mask with type encoding on the same input. Its output uses a concise sequel expression and a publication phrase for Australia. The authors consider the wording potentially more natural than the corresponding output of the selective mask, even though it has slightly lower BLEU for the example. They also observe lower attention between the Australia-related entity and the country relation in this configuration and suggest a possible connection to the wording.
The heatmaps show which graph items received weight in a particular encoder operation. They help formulate an explanation about the text, especially where a mask makes a route available in one setting and removes it in another. The variants also differ in how their parameters were trained, and the final text depends on other encoder operations and the decoder. A displayed weight by itself therefore cannot establish that a given connection caused a particular phrase. QA-GNN
A separate appendix measure counts the entities from the graph that appear in the generation relative to those that appear in the reference. The selective mask scores 94.06 without the type bias and 94.04 with it on this WebNLG test measure. The broad mask scores 93.82 and 94.28, respectively. These scores show that the tested settings frequently recover the entity names counted by the measure. An output can still put a named entity in the wrong role or attach an incorrect descriptor. The authors point to sentence structure and descriptors as areas for investigation even when entity accuracy is high.
The additional WebNLG examples make the same point in ordinary prose. Two type-encoded variants sometimes generate identical text and sometimes express similar information using different phrasing, as in the descriptions of Alan Bean’s nationality and career. In the example about Al Anderson, one variant omits the band name NRBQ. That omission matters to the graph description even when the rest of the output is fluent and contains several other correct names. Entity overlap and aggregate language metrics only partly capture such behavior.
Limitations
Limits identified by the authors
Computational constraints restricted how much of the framework the authors could explore. They kept BART’s global attention settings at their defaults and investigated the graph settings chiefly on WebNLG. EventNarrative received selected configurations because it was more expensive to use for experiments. This leaves uncertainty about whether another mask or a different balance between global and graph computation would work better for that benchmark. It also limits the evidence for adopting the same settings across other pretrained starting points.
The authors call for more specific evaluation measures for graph-to-text. The Aenir comparison supplies a reason. A description can read more naturally to them while scoring lower on the reference-overlap measure. The example is a qualitative judgment about particular outputs. The paper does not report a human evaluation that establishes a general preference for GAP’s wording. For a graph-to-text system, a measure of how well the generated sentences preserve relations would address a different question from whether the wording resembles the reference.
The EventNarrative examples show errors that have different origins. In the example about the Sport Page Handicap, the paired Wikipedia text mentions Ozone Park and an age condition for the horses. The authors checked the graph and found neither detail there. In the Cork hurling example, the reference names the Cork County Board, which is also absent from the graph. Such omissions can lower reference similarity even when the generator stays within its input. They expose a difficulty in a benchmark made by matching graphs to existing text.
Other event outputs make positive claims that the authors identify as wrong. In the Mississippi gubernatorial election example, the outputs misrepresent the Democratic candidacy. The Cork hurling descriptions name the 112th staging where the reference says 103rd. The Battle of Ignacewo descriptions give incorrect dates, and one loses the correct village reference. These failures persist in spite of the graph-aware encoder. They qualify any reading of the benchmark gains as evidence of dependable factual narration.
The paper mentions possible uses for structured data in medical, clinical and news settings. Its experiments concern WebNLG and EventNarrative. The authors also acknowledge the possibility of disinformation from generative systems. Those discussions describe potential uses and risks. They do not supply a tested method for verifying individual claims in the resulting descriptions, a requirement that would matter when the text informs decisions about events or records.
Limits visible in the experimental setup
The central comparison establishes that GAP can obtain competitive scores without the additional pretraining stages used by KGPT and JointGT. It does not measure how much computation or wall-clock time a common training platform would save. Parameter counts and the absence of an extra training stage are concrete distinctions. The architectural addition also increases the parameter count over BART, and the paper does not report the inference cost of the new attention operations. The amount saved depends on which systems and stages are being compared.
The fine-tuned BART baseline shows the effect of introducing the graph-aware encoder as a package. The package includes pooling, a new attention operation, its graph connectivity and a residual update, with type encoding in selected runs. The mask and type ablations show that the structure of the package matters. A capacity-matched encoder with an additional token operation would answer a different question about how much of the improvement depends specifically on using graph components. The paper does not report that comparison.
The experiments describe a framework that can be used with a pretrained generator such as BART, but the reported GAP implementation uses BART. The EventNarrative T5 score is a baseline result. It gives no direct evidence for how GAP’s graph operations would interact with a different pretrained encoder. Similarly, training and testing on the official splits establish results for those benchmarks. The paper does not isolate performance on unseen graph topologies, relation categories or domains to establish how far the reported advantages transfer.
There are also reasons to treat small differences with care. The WebNLG tables report close scores for several conditions, and the better setting changes from one metric to another. The paper does not give uncertainty estimates for the comparisons. The results are sufficiently specific to state which scores the experimental runs obtained. They leave less support for claims about whether a particular small difference would persist across repeated training runs or under a different validation sample.
The score and error analyses offer partial views of factual fidelity. Entity accuracy captures whether names appear relative to a reference. The size breakdown identifies groups on which BLEU is lower. The examples distinguish missing input facts from incorrect generated claims. None of those analyses alone measures correct verbalization of every triple, preservation of its direction and arguments, or the rate of unsupported statements. The existence of those errors and their frequency are separate questions. The paper illustrates the former without estimating the latter across the benchmarks.
What came after
The later work linked to GAP is the 2023 roadmap on unifying language models and knowledge graphs. Its subject is broader than generating descriptions of graphs. GAP addresses one concrete instance of that subject by bringing explicit graph connections into the encoder of a pretrained text generator. The roadmap cites GAP, establishing a connection between that design and the broader research agenda. The citation alone does not establish that the roadmap adopted the neighborhood mask, reused the connection-type bias or tested either component in a new system.
Cite
Cite as Anthony Colas, Mehrdad Alvandipour and Daisy Zhe Wang. 2022. GAP: A Graph-aware Language Model Framework for Knowledge Graph-to-Text Generation. Proceedings of the 29th International Conference on Computational Linguistics.
@inproceedings{colas2022gap,
title = {{GAP: A Graph-aware Language Model Framework for Knowledge Graph-to-Text Generation}},
author = {Anthony Colas, Mehrdad Alvandipour and Daisy Zhe Wang},
booktitle = {Proceedings of the 29th International Conference on Computational Linguistics},
year = {2022},
url = {https://aclanthology.org/2022.coling-1.506/}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/colas-2022-gap-graph-aware-language-model/