FewShotTextGCN: K-hop neighborhood regularization for few-shot learning on graphs

Niels van der Heijden, Ekaterina Shutova, Helen Yannakoudakis

TL;DR

FewShotTextGCN is a novel graph-based approach that enables high-performance document classification in low-resource settings without any language model pre-training. By introducing structural regularization and simplifying graph construction, it outperforms standard graph methods by up to 17% in accuracy and rivals massive Transformer models like XLM-R using only a fraction of the parameters.

What Problem Does This Paper Address?

Modern Natural Language Processing (NLP) is dominated by Pretrained Language Models (PLMs) like BERT and XLM-R. While these models are incredibly powerful, they suffer from two major drawbacks:

  1. Data Hunger: They require massive amounts of text for pre-training, which simply doesn't exist for the vast majority of the world's 7,000+ languages.
  2. Computational Cost: They are massive, environmentally expensive to train, and require significant hardware to run.

Graph Neural Networks (GNNs), specifically the TextGCN framework, emerged as an alternative that treats document classification as a node-classification task on a word-document graph. However, TextGCN struggles when labeled data is scarce (the "few-shot" scenario). The authors of this paper set out to make graph-based text classification robust enough to handle typologically diverse languages with as few as 20 training samples.

Methods

The authors introduce FewShotTextGCN, which improves upon the original TextGCN through three key innovations:

  • K-hop Neighborhood Regularization (K-NR): Specifically, they use a 2-hop version (2-NR). This is an unsupervised contrastive learning technique. The intuition is simple: if two documents share many words, they should be closer in the feature space. The model samples an "anchor" document, finds a shared word, and then identifies a "positive" document that also contains that word. A triplet loss then forces the anchor to be closer to the positive document than to a randomly sampled negative one.
  • Simplified Graph Construction: The original TextGCN creates edges between words based on Pointwise Mutual Information (PMI). The authors found that for few-shot learning, these word-word edges are actually noisy and redundant. By removing them, they created a graph that is ~7 times less dense, significantly reducing memory requirements while actually improving accuracy in low-resource settings.
  • Adaptive Pseudo-Labeling: They adapted a technique to leverage unlabeled document nodes. The model generates "pseudo-labels" for unlabeled documents where it has high confidence, effectively increasing the training signal without requiring more human-annotated data.

Datasets

The researchers evaluated their method on two primary benchmarks across ten different language settings:

  • MLDoc: A balanced subset of the Reuters Corpus Volume 2, covering 8 languages: English, Spanish, French, German, Italian, Russian, Japanese, and Chinese.
  • Reuters-21578: Specifically the R8 and R52 subsets, which are standard English benchmarks for topic classification.

Key Insights and Ideas

  • Sparsity is a Strength: One of the most surprising findings is that removing word-word edges (PMI edges) makes the model better at few-shot learning. In dense graphs, representations can become "over-smoothed," making it hard to distinguish between classes when labels are sparse. A leaner graph keeps the signal clear.
  • Structural Regularization as a Proxy for Pre-training: By using 2-NR, the model learns the semantic relationships between documents based purely on the graph's topology. This acts as a form of "pre-training" that doesn't require billions of tokens of raw text.
  • Parameter Efficiency: FewShotTextGCN achieves its results using only about 1% of the parameters of a typical PLM. This makes it a highly attractive option for edge computing or researchers with limited GPU resources.

Key Results

The quantitative improvements are substantial, particularly when labeled data is extremely limited.

  • Few-Shot Performance: In the 2% training data setting (roughly 20 samples), FewShotTextGCN outperformed the original TextGCN by an average of 17% absolute accuracy across the MLDoc languages.
  • Rivaling the Giants: As shown in the performance breakdown (Figure 1), FewShotTextGCN performs on par with or even better than mBERT and XLM-R in low-resource settings (1% and 2% training data), despite the PLMs having access to massive pre-training data that the GNN does not.
Table 1: Comparison of FewShotTextGCN against PLMs and TextGCN across various data settings.
  • Efficiency Gains: The ablation study (Figure 2) highlights that the simplified graph construction ($V_d - V_w$) not only uses significantly fewer edges (e.g., 1M vs 7.4M for German) but consistently yields higher accuracy in the 2% and 5% data regimes.
Table 2: Ablation study showing the impact of removing word-word edges on accuracy and graph density.

Limitations and Future Work

While FewShotTextGCN is a major step forward for low-resource NLP, the authors note a few limitations:

  • Word Order: Because it uses a word-document graph, the model is essentially a "bag-of-words" approach. It doesn't capture the nuances of word order, which might be critical for tasks like sentiment analysis.
  • Training Speed: Adding the 2-NR regularization loss slows down convergence. While standard TextGCN might converge in 200 steps, FewShotTextGCN often requires 700 to 900 steps.
  • Task Scope: The study focused on topic classification. Future work is needed to see if these graph properties hold for more complex NLU tasks.

The authors suggest that K-NR could be generalized to other heterogeneous graphs, such as social networks or product-user networks, where $K > 2$ might be used to bridge different types of entities.

Summary updated

Abstract

We present FewShotTextGCN, a novel method designed to effectively utilize the properties of word-document graphs for improved learning in low-resource settings. We introduce K-hop Neighbourhood Regularization, a regularizer for heterogeneous graphs, and show that it stabilizes and improves learning when only a few training samples are available. We furthermore propose a simplification in the graph-construction method, which results in a graph that is $\sim$7 times less dense and yields better performance in little-resource settings while performing on par with the state of the art in high-resource settings. Finally, we introduce a new variant of Adaptive Pseudo-Labeling tailored for word-document graphs. When using as little as 20 samples for training, we outperform a strong TextGCN baseline with 17% in absolute accuracy on average over eight languages. We demonstrate that our method can be applied to document classification without any language model pretraining on a wide range of typologically diverse languages while performing on par with large pretrained language models.
BibTeX
@inproceedings{heijden2023fewshottextgcn,
  author = {Niels van der Heijden and Ekaterina Shutova and Helen Yannakoudakis},
  title = {{FewShotTextGCN: K-hop neighborhood regularization for few-shot learning on graphs}},
  booktitle = {EACL},
  year = {2023},
}
Figure