Introduction
Data-to-Text (D2T) generation is the task of producing natural language descriptions from structured data, such as knowledge graphs or infoboxes. While recent advances in large-scale pretraining have significantly improved text generation, effectively bridging the gap between structured graph inputs and sequential text outputs remains a challenge. Existing methods typically either flatten the graph into a sequence, losing structural information, or employ Graph Neural Networks (GNNs), which often struggle to capture the full sequential nuance of text labels within the graph.
This paper introduces R2D2 (Relational Text Decoding with Transformers), a framework designed to unify graph structure and sequential text modeling. By treating graph components as distinct text segments and introducing a relation-aware attention mechanism within a pretrained XLNet backbone, R2D2 achieves state-of-the-art performance across multiple complex benchmarks.
The Representation Gap in Data-to-Text
The authors identify a fundamental "representation gap" in current D2T approaches. Traditional Sequence-to-Sequence (Seq2Seq) models require flattening the input graph into a linear string. While this leverages powerful pretrained language models, it discards the rich relational topology of the source data. Conversely, GNN-based models preserve the graph structure but typically represent text labels as fixed-dimensional vectors. This "micro-level" compression loses the sequential information inherent in multi-word labels (e.g., "Scotland national football team").
Methodology
Levi Graph Transformation
To address the micro-level representation issue, R2D2 treats every node and edge in the input graph as a text segment. To handle edges that contain descriptive text (predicates), the model employs a Levi graph transformation. In this format, original edges are converted into new nodes, ensuring that every component of the graph—whether a subject, object, or relationship—is represented as a sequence of tokens.
Relational Multi-Segment Attention
The core of R2D2 is its modified attention mechanism, built upon the XLNet architecture. Unlike standard Transformers that treat the input as a single sequence, R2D2 utilizes a relational multi-segment attention score. This score is composed of three distinct parts:
- Content-wise: Standard token-to-token attention.
- Position-wise: Modeling the relative positioning of tokens within and across segments.
- Segment-wise: The "relational" component where the model learns specific embeddings for different graphical relationships (e.g., "head-to-predicate", "tail-to-predicate", or "unrelated-node").
By using XLNet as a backbone, the model maintains a bidirectional view of the source segments while generating the target text autoregressively. The attention mask ensures that the model respects the graph's topology while attending to the context.
Experimental Evaluation and Results
The model was evaluated on four diverse D2T benchmarks, including WikiBio, AGENDA, WebNLG, and E2E, as well as a novel application using MIMIC-III clinical notes. R2D2 achieved state-of-the-art (SOTA) or highly competitive results across all evaluated tasks:
- WikiBio: Reached a BLEU score of 46.23, surpassing the previous SOTA of 44.89.
- AGENDA: Significantly outperformed the GraphWriter baseline (17.30 vs. 14.3 BLEU).
- WebNLG: Achieved a BLEU score of 53.77, outperforming the DataTurner model.
Structure as a Regularizer
A key finding from the ablation studies is that explicitly modeling graph structure acts as a powerful regularizer. This is particularly evident in few-shot scenarios. On the WikiBio task, R2D2 trained on only 12% of the data (70k samples) achieved a BLEU score of 44.40—nearly matching the previous SOTA trained on the full dataset. This suggests that the relational attention mechanism allows the model to generalize better from limited examples by leveraging the inherent structure of the data.
Conclusion
R2D2 demonstrates that it is not necessary to choose between the structural strengths of GNNs and the sequential power of pretrained Transformers. By representing graphs as collections of text segments and incorporating relational awareness into the attention mechanism, R2D2 provides a robust solution for complex data-to-text generation tasks. Future work will focus on mitigating hallucinations in low-resource settings and extending the framework to other graph-based reasoning tasks.
Summary updated