[Paper Review] GNN-LM: Language Modeling based on Global Contexts via GNN
GNN-LM proposes a novel language modeling framework that enhances sequence prediction by integrating global context via graph neural networks (GNNs). It constructs a heterogeneous graph linking input tokens to semantically similar neighbor contexts from the training corpus, enabling GNNs to aggregate cross-context information for improved decoding. The method achieves a new state-of-the-art perplexity of 14.8 on WikiText-103, a 3.9-point improvement over the base model.
Inspired by the notion that ``{\it to copy is easier than to memorize}``, in this work, we introduce GNN-LM, which extends the vanilla neural language model (LM) by allowing to reference similar contexts in the entire training corpus. We build a directed heterogeneous graph between an input context and its semantically related neighbors selected from the training corpus, where nodes are tokens in the input context and retrieved neighbor contexts, and edges represent connections between nodes. Graph neural networks (GNNs) are constructed upon the graph to aggregate information from similar contexts to decode the token. This learning paradigm provides direct access to the reference contexts and helps improve a model's generalization ability. We conduct comprehensive experiments to validate the effectiveness of the GNN-LM: GNN-LM achieves a new state-of-the-art perplexity of 14.8 on WikiText-103 (a 3.9 point improvement over its counterpart of the vanilla LM model), and shows substantial improvement on One Billion Word and Enwiki8 datasets against strong baselines. In-depth ablation studies are performed to understand the mechanics of GNN-LM. \footnote{The code can be found at https://github.com/ShannonAI/GNN-LM
Motivation & Objective
- To address the limitations of memorization-based language models that struggle with rare or long-tail examples due to heavy reliance on internal parameterization.
- To explore whether referencing similar training contexts (an 'open-book' strategy) improves generalization and reduces perplexity in language modeling.
- To design a structured mechanism that effectively integrates retrieved neighbor contexts into the decoding process using graph-based representation learning.
- To evaluate the effectiveness of combining GNN-LM with k-NN language modeling for further performance gains.
Proposed method
- The model constructs a directed heterogeneous graph where nodes represent tokens from the input context and its k nearest neighbor contexts retrieved via dense vector similarity.
- Two types of edges are defined: intra-context edges connecting tokens within the same context (input or neighbor), and inter-context edges linking tokens from neighbor contexts to the input context.
- A graph neural network (GNN) aggregates representations across both intra- and inter-context edges, updating node-level representations to capture cross-context dependencies.
- The updated representation of the last token in the input context is used to predict the next token via a softmax layer over the vocabulary.
- The framework is combined with k-NN-LM to further boost performance by interpolating predictions from nearest neighbors.
- Retrieval of neighbor contexts is performed using dense vector representations of context sequences, with similarity measured via cosine distance.
Experimental results
Research questions
- RQ1Can integrating semantically similar training contexts as external references improve language model performance beyond memorization?
- RQ2How does the use of a heterogeneous graph structure enhance information flow between input and retrieved neighbor contexts?
- RQ3What is the contribution of GNN-based message passing in aggregating cross-context knowledge for next-token prediction?
- RQ4How does the combination of GNN-LM with k-NN-LM affect perplexity and generalization on standard benchmarks?
Key findings
- GNN-LM achieves a new state-of-the-art perplexity of 14.8 on the WikiText-103 benchmark, representing a 3.9-point improvement over the base language model.
- The model shows substantial improvements on both One Billion Word and Enwik8 datasets, outperforming strong baselines across all three benchmarks.
- Ablation studies confirm that both intra-context and inter-context message passing in the GNN contribute significantly to performance gains.
- The integration of k-NN-LM with GNN-LM leads to a synergistic performance boost, demonstrating the complementarity of retrieval-based and graph-based methods.
- Complexity analysis shows that the method remains scalable, though retrieval and graph construction remain computational bottlenecks for large-scale datasets.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.