NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Text Level Graph Neural Network for Text Classification

Lianzhe Huang, Dehong Ma, Sujian Li, Xiaodong Zhang, Houfeng Wang

Abstract

Graph Neural Networks (GNNs) have emerged as a powerful tool for text classification due to their ability to model complex, non-linear relationships between words. However, existing corpus-level GNNs, such as Text-GCN, face significant challenges in production environments, including excessive memory consumption and an inability to handle online classification for unseen documents. We present a novel Text-Level GNN (TLGNN) that constructs individual graphs for each document. By utilizing a sliding window for local context and sharing global parameters across documents, TLGNN achieves state-of-the-art accuracy while reducing memory requirements by over 90%. This approach effectively bridges the gap between the relational modeling of GNNs and the efficiency required for real-time applications.

Introduction

Text classification is a cornerstone of natural language processing, with applications ranging from sentiment analysis to news categorization. While traditional models like CNNs and LSTMs focus on sequential data, Graph Neural Networks (GNNs) have recently gained traction for their capacity to capture global word co-occurrence patterns.

Despite their success, models like Text-GCN are limited by their "corpus-level" architecture. By building a single massive graph for the entire dataset, these models suffer from "Memory Bloat"—requiring gigabytes of GPU memory for even moderately sized corpora—and the "Static Problem," where the model cannot easily classify new documents without re-calculating the entire graph. This paper introduces the Text-Level GNN (TLGNN), a leaner and faster alternative designed for real-world scalability.

Methodology

The core innovation of TLGNN is the shift from a global corpus graph to individual, text-specific graphs.

Graph Construction

For any given document, the model identifies unique words as nodes. Edges are established between words that appear within a small sliding window of size $p$. This ensures that the graph captures local semantic context without the noise of distant, unrelated word pairings.

Architecture of the Text-Level GNN illustrating the transition from text to local graph structures and the message-passing mechanism.

Global Parameter Sharing and Message Passing

To ensure the model retains "global" linguistic knowledge, word embeddings and edge weights are shared across all document graphs. For instance, the relationship between "Apple" and "iPhone" is learned as a global parameter, applied whenever these words co-occur in any text-level graph.

The model employs a non-spectral message-passing mechanism (MPM). Each word node aggregates information from its neighbors using a max-reduction function. A trainable "keep" variable, $\eta$, allows the model to dynamically decide how much of a word's original representation to retain versus how much contextual information to integrate from its neighbors.

Experimental Results

The TLGNN was evaluated on three standard benchmarks: R8, R52, and Ohsumed. The Ohsumed dataset, consisting of medical abstracts, is particularly challenging due to its technical vocabulary.

Performance and Accuracy

TLGNN consistently outperformed traditional sequence models and previous graph-based approaches. As shown in the table below, the model achieved superior accuracy across all datasets.

Comparison of classification accuracy between TLGNN and baseline models across three datasets.

Notably, on the R52 dataset, the model reached 94.6% accuracy, surpassing Text-GCN's 93.7%. On the Ohsumed dataset, it achieved 69.4%, representing a significant improvement over the previous state-of-the-art.

Memory Efficiency

A primary advantage of TLGNN is its efficiency. By avoiding the construction of a corpus-wide adjacency matrix, the model drastically reduces memory overhead. In tests on the Ohsumed dataset, Text-GCN required approximately 13.5 GB of memory, whereas TLGNN required only 1.1 GB—a reduction of over 90%. This makes the model viable for deployment on standard hardware and suitable for online, real-time classification tasks.

Discussion and Insights

The authors' analysis revealed that local context is highly effective for text classification. Optimal results were achieved with a small window size (typically $p=3$). Interestingly, performance tended to degrade as the window size increased, suggesting that fully connected or overly dense graphs introduce irrelevant noise that can confuse the model.

Furthermore, the use of trainable edge weights rather than fixed statistical measures (like PMI) allows the network to learn which word relationships are truly predictive for the classification task. The inclusion of a "public edge" for rare word pairings further prevents overfitting on sparse data.

Conclusion

The Text-Level GNN represents a significant step forward in making graph-based text classification practical. By moving to a per-document graph structure, the model achieves high accuracy with a fraction of the memory required by previous methods. This architecture finally enables GNNs to be used in dynamic, online environments where efficiency and the ability to handle unseen data are paramount.

Summary updated

BibTeX
@inproceedings{huang2019text,
  author = {Lianzhe Huang and Dehong Ma and Sujian Li and Xiaodong Zhang and Houfeng Wang},
  title = {{Text Level Graph Neural Network for Text Classification}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2019},
  doi = {10.18653/v1/d19-1345},
}
Figure