Pre-Training a Graph Recurrent Network for Language Representation

Yile Wang, Linyi Yang, Zhiyang Teng, Ming Zhou, Yue ZhangarXiv 2022 · DOI · arXiv

Abstract

While Transformer-based models dominate modern natural language processing, their quadratic computational complexity and representation redundancy present significant challenges for long-document processing and efficient scaling. This paper introduces a pre-trained Graph Recurrent Network (GRN) that serves as a linear-complexity alternative. By modeling sentences as graphs with local token-level communication and a decoupled global sentence state, the proposed architecture achieves performance comparable to BERT while offering substantial speedups for long sequences and producing more diverse, isotropic representations.

Introduction

The current NLP landscape is primarily defined by the success of self-attention mechanisms. However, Transformers suffer from two major drawbacks: quadratic time complexity ($O(n^2)$) relative to sequence length and contextualized feature redundancy. The self-attention mechanism requires every token to attend to every other token, making the processing of long documents computationally expensive and environmentally taxing. Furthermore, recent studies suggest that the "anisotropy" of Transformer embeddings—where vectors cluster into a narrow cone—limits their expressiveness.

This research investigates whether a non-Transformer architecture, specifically a Graph Recurrent Network (GRN), can bridge the gap between computational efficiency and high-quality language representation.

Methods

The authors adapt the Sentence-state LSTM (S-LSTM) architecture for large-scale self-supervised pre-training.

The Graph Architecture

Instead of a fully connected attention matrix, the model treats each sequence as a graph. This structure consists of:

  • Token Nodes: Each word is a node connected to its immediate left and right neighbors.
  • Sentence Node: A global node connected to every token node, providing a decoupled "summary" of the sequence.
  • Bi-directional Edges: Information flows both ways between neighbors and between tokens and the global state.
Overall architecture of the pre-trained GRN, illustrating the encoding layer with token and sentence nodes and the inference layer for masked language modeling.

The Update Mechanism

Unlike standard LSTMs that process tokens sequentially, this GRN updates all nodes in parallel across multiple layers (recurrent steps). It uses an LSTM-style gating mechanism (input, forget, and output gates) to control information flow. To improve parameter efficiency, the authors employ cross-layer parameter sharing, similar to the ALBERT architecture.

Pre-training

The model is pre-trained using Masked Language Modeling (MLM). In this setup, 15% of tokens are masked, and the model must predict them based on the graph-structured context provided by the encoding layer.

Key Insights and Ideas

Linear Complexity ($O(n)$)

Because each token only communicates with its immediate neighbors and one global node, the computation scales linearly. This makes the model significantly more efficient for long-form text compared to the quadratic scaling of standard Transformers.

Comparison of communication patterns across different architectures: (a) RNN, (b) CNN, (c) Transformer, and (d) the proposed GRN model.

Decoupled Global State and Diversity

In Transformers, the [CLS] token is treated like any other token. In this GRN, the sentence node is structurally distinct. This decoupling appears to mitigate the "representation degeneration" problem. Using Principal Component Analysis (PCA), the authors found that the GRN's representations are less redundant than BERT's; it takes more principal components to explain the same amount of variance in the GRN's features, suggesting the model captures more varied information per token.

Anisotropy Mitigation

The GRN produces a more uniform (isotropic) distribution of embeddings. While BERT embeddings are highly positively correlated (clustered), the GRN embeddings show a wider range of similarity scores, including negative relationships, which enhances the expressiveness of the feature space.

Key Results

  • Competitive Accuracy: On the GLUE benchmark, the GRN achieved an average score of 78.67, outperforming ELMo (69.65) and DistilBERT (77.87), and remaining within 1.5 points of BERT-base (80.18).
  • Inference Speedup: For sequences of length 512, the GRN is 2x to 3x faster than RoBERTa-base.
  • Long Sequence Scalability: In CPU runtime tests for sequences up to 10,000 tokens, the GRN maintained near-linear growth, outperforming specialized "Longformers" for sequences under 8,500 tokens.
  • Parameter Efficiency: By sharing parameters across layers, the model remains compact (approx. 186M parameters for the large version) while maintaining high capacity.

Conclusion

The pre-trained Graph Recurrent Network offers a compelling alternative to the Transformer for language representation. By achieving linear complexity without sacrificing significant accuracy, it opens new doors for processing long-form documents efficiently. Future work will explore extending this architecture to sequence-to-sequence frameworks for generative tasks like translation and summarization.

Summary updated

Abstract

Transformer-based pre-trained models have gained much advance in recent years, becoming one of the most important backbones in natural language processing. Recent work shows that the attention mechanism inside Transformer may not be necessary, both convolutional neural networks and multi-layer perceptron based models have also been investigated as Transformer alternatives. In this paper, we consider a graph recurrent network for language model pre-training, which builds a graph structure for each sequence with local token-level communications, together with a sentence-level representation decoupled from other tokens. The original model performs well in domain-specific text classification under supervised training, however, its potential in learning transfer knowledge by self-supervised way has not been fully exploited. We fill this gap by optimizing the architecture and verifying its effectiveness in more general language understanding tasks, for both English and Chinese languages. As for model efficiency, instead of the quadratic complexity in Transformer-based models, our model has linear complexity and performs more efficiently during inference. Moreover, we find that our model can generate more diverse outputs with less contextualized feature redundancy than existing attention-based models.
BibTeX
@misc{wang2022pre,
  author = {Yile Wang and Linyi Yang and Zhiyang Teng and Ming Zhou and Yue Zhang},
  title = {{Pre-Training a Graph Recurrent Network for Language Representation}},
  year = {2022},
  eprint = {2209.03834},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2209.03834},
}
Figure