# Graph Convolutional Networks for Text Classification

Text GCN classifies documents by graph convolution over the whole corpus

Yao, Liang, Mao, Chengsheng, Luo, Yuan · arXiv · 2018-9-15

- **Problem** Convolutional and recurrent text classifiers read words in short windows, so they miss word co-occurrence across a whole corpus, which links words far apart.
- **Method** Text GCN puts documents and words as nodes in one corpus graph, weighted by TF-IDF and PMI. A two-layer graph convolution is then trained with labels on the document nodes.
- **Results** On 20-Newsgroups, Text GCN reached 0.8634 ± 0.0009 accuracy, against 0.8516 ± 0.0029 for SWEM, the strongest comparison method there.

## Why a corpus-level graph

Convolutional and recurrent text classifiers read words in short consecutive windows, which captures nearby syntax and meaning well. Their weak point is the global word co-occurrence across a corpus, which links words that sit far apart in different documents.

The authors instead place documents and words together as nodes in one graph built from the whole corpus, so classification becomes node classification. Earlier graph methods for text either treated each document or sentence as its own graph of word nodes, or depended on citation links between documents. The corpus graph here needs neither, which the authors state as the difference from that prior work.

## Building the text graph

Each node receives a one-hot vector, so the input feature matrix is an identity matrix with one row per word and per document. The model therefore starts without pre-trained word embeddings or external knowledge, and all word and document representations are learned during training.

A document-word edge takes the TF-IDF weight of the word in that document, combining the count of the word in the document with an inverse document frequency. In preliminary experiments, TF-IDF weights gave better results than term frequency alone.

Word-word edges come from a fixed-size sliding window slid over every document, which gives co-occurrence statistics for the whole corpus. The weight is point-wise mutual information, \\\\(\\\\mathrm{PMI}(i,j)=\\\\log \\\\frac{p(i,j)}{p(i)\\\\,p(j)}\\\\), where \\\\(p(i,j)=\\\\#W(i,j)/\\\\#W\\\\) and \\\\(p(i)=\\\\#W(i)/\\\\#W\\\\) are estimated from counts of sliding windows, with \\\\(\\\\#W\\\\) the total number of windows.

Only pairs with a positive PMI get an edge, since a negative value is read as little or no semantic correlation. In preliminary experiments, PMI weights beat raw co-occurrence counts.

Each node is connected to itself, and the diagonal of the adjacency matrix is set to 1.

## Two-layer propagation and classifier

One graph convolution layer lets each node see only its immediate neighbors. Stacking layers extends the reach.

The full model is \\\\(Z=\\\\mathrm{softmax}(\\\\tilde A\\\\,\\\\mathrm{ReLU}(\\\\tilde A X W\_0) W\_1)\\\\). The second-layer node embeddings have one column per class, so the softmax turns them into class probabilities.

Two layers let a node exchange information with nodes at most two steps away. Two documents with no direct edge can therefore influence each other through a shared word. In preliminary experiments, two layers beat one layer, and more layers did not improve results. The authors read the propagation as a form of Laplacian smoothing that averages a node with its second-order neighbors, and they argue that label information flows from document nodes through word nodes to the rest of the graph.

## Training with labeled documents

Training minimizes a cross-entropy error summed over the labeled documents and over the output classes, \\\\(\\\\mathcal{L}=-\\\\sum\_{d\\\\in Y\_D}\\\\sum\_{f=1}^{F} Y\_{df}\\\\ln Z\_{df}\\\\), where \\\\(Y\\\\) is the label indicator matrix and \\\\(F\\\\) is the number of classes. Unlabeled documents and all word nodes enter the loss only through the graph, since the sum runs over labeled documents alone.

The weights \\\\(W\_0\\\\) and \\\\(W\_1\\\\) are updated by gradient descent.

Text GCN uses a first-layer embedding size of 200 and a sliding window size of 20, with learning rate 0.02 and dropout rate 0.5. The authors report that small changes to the other settings did not change results much. Training uses Adam for at most 200 epochs, with 10% of the training set held out as validation, and stops when the validation loss has not decreased for 10 consecutive epochs.

## Benchmark accuracy against baselines

Five corpora are used: 20-Newsgroups with 18,846 documents, Ohsumed restricted to single-label documents (7,400), R8 and R52 from Reuters 21578, and MR. Stop words were removed and words appearing fewer than 5 times were dropped for 20NG, R8, R52 and Ohsumed, while MR kept all words after cleaning.

Each model was run 10 times, and Text GCN's mean accuracy on 20-Newsgroups was 0.8634 ± 0.0009, against 0.8516 ± 0.0029 for SWEM, the strongest comparison method on that corpus. On R8, Text GCN reached 0.9707 ± 0.0010 against 0.9699 ± 0.0012 for Graph-CNN-C, a small margin.

On R52, Text GCN reached 0.9356 ± 0.0018, above SWEM at 0.9294 ± 0.0024. On Ohsumed it reached 0.6836 ± 0.0056, against 0.6386 ± 0.0053 for Graph-CNN-C. The paper reports these gains over baselines as significant with a t-test at p \< 0.05 on the four corpora 20NG, R8, R52 and Ohsumed.

Among the non-graph baselines, TF-IDF + LR at 0.8319 ± 0.0000 beat CNN-rand at 0.7693 ± 0.0061 on 20-Newsgroups, and PTE and fastText beat PV-DBOW and PV-DM. The authors attribute the gap between PV-DBOW and PV-DM on one side and PTE and fastText on the other to supervised learning of document embeddings, which lets label information shape them.

## Accuracy with few labeled documents

The authors reduced the training sets of 20NG and R8 to 1%, 5%, 10% and 20% of their original size and evaluated several of the best-performing models at each proportion.

With 20% of the 20NG training documents, Text GCN reached 0.8063 ± 0.0025. With only 1% of the R8 training documents, it reached 0.8830 ± 0.0027, which the authors report as higher than some baselines trained on the full training set. The authors relate this to GCN's known good performance at low label rates, and read it as label information spreading over the whole graph.

## Window size and embedding dimension

On R8 and MR, the window size was varied from 5 to 30, and accuracy rose as the window grew. The average accuracy stops increasing once the window size exceeds 15. The authors read this as small windows giving too little global co-occurrence, while large windows add edges between weakly related nodes.

The first-layer embedding dimension was varied from 0 to 300 on R8 and MR, and the authors observed trends similar to the window study. Low dimensions may fail to spread label information across the graph, while high dimensions brought no gain and cost more training time.

## Inspecting the learned embeddings

The authors use t-SNE to project 200-dimensional first-layer and 20-dimensional second-layer test document embeddings for 20NG, together with PV-DBOW and PTE. The second-layer embeddings look more separable than the first-layer ones, and this is a visual judgement rather than a measured score.

For word embeddings, each word is given the label of its largest second-layer dimension and plotted with t-SNE, and words with the same label tend to sit together. The top ten words per class in Table 3 include jpeg, graphics and image for comp.graphics, and similar lists for sci.space, sci.med and rec.autos.

## Limitations

The GCN is transductive because unlabeled test documents are included in training, so Text GCN cannot quickly produce embeddings or predictions for unseen test documents. The authors name inductive GCN (Hamilton, Ying, and Leskovec 2017) and fast GCN (Chen, Ma, and Xiao 2018) as possible routes.

On MR, Text GCN scored 0.7674 ± 0.0020, below CNN-non-static at 0.7775 ± 0.0072. The authors give three reasons: GCN ignores word order, the MR graph has few document-word and word-word edges because the documents are short and the windows few, and CNN and LSTM use pre-trained embeddings while Text GCN uses only the target corpus.

The label-rate tests cover only 20NG and R8, and the embedding visualizations cover only 20NG. The main comparison uses five corpora with 10 runs per model, and the preliminary checks on layer count and edge weighting are reported only in the text.

## Paper info

- **Authors**: Yao, Liang, Mao, Chengsheng, Luo, Yuan
- **Venue**: arXiv · Preprint
- **First published**: 2018-9-15
- **Added**: 2026-11-12
- **Updated**: 2018-11-13
- **Version**: v3
- **arXiv**: 1809.05679
- **Category**: cs.CL · cs.AI
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1809.05679v3) · [PDF ↗](https://arxiv.org/pdf/1809.05679v3)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Yao, Liang, Mao, Chengsheng, Luo, Yuan (2018). Graph Convolutional Networks for Text Classification. arXiv:1809.05679v3. https://arxiv.org/abs/1809.05679v3

**BibTeX**

```
@misc{liang2018graph,
  title = {{Graph Convolutional Networks for Text Classification}},
  author = {Yao, Liang and Mao, Chengsheng and Luo, Yuan},
  year = {2018},
  eprint = {1809.05679},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1809.05679v3}
}
```

## Related papers

- [Deeper Insights into Graph Convolutional Networks for Semi-Supervised Learning](https://refivu.com/en/papers/a2134edc-a5ef-48b2-9ec4-982cfed2a085-deeper-insights-into-graph-convolutional-networks-for-semi.md)
- [RandAugment: Practical automated data augmentation with a reduced search space](https://refivu.com/en/papers/8b56147c-5b9a-4e55-85b2-0f0992053956-randaugment-practical-automated-data-augmentation-with-a.md)
- [Simplifying Graph Convolutional Networks](https://refivu.com/en/papers/e44b1726-1294-4944-949a-e3035e872bc5-simplifying-graph-convolutional-networks.md)
- [MixHop: Higher-Order Graph Convolutional Architectures via Sparsified Neighborhood Mixing](https://refivu.com/en/papers/1250a8b5-0d20-48a6-bf8a-8ec6a0c220d1-mixhop-higher-order-graph-convolutional-architectures-via.md)
- [1D Convolutional Neural Networks and Applications: A Survey](https://refivu.com/en/papers/03cdd780-b48e-4098-95e8-ba82fd387ae9-1d-convolutional-neural-networks-and-applications-a-survey.md)
- [4D Spatio-Temporal ConvNets: Minkowski Convolutional Neural Networks](https://refivu.com/en/papers/bb10cb3b-b1cc-4119-9de1-8503fdbd27ff-4d-spatio-temporal-convnets-minkowski-convolutional-neural.md)

## Other paper commentary

- [Two-Stream Adaptive Graph Convolutional Networks for Skeleton-Based Action Recognition](https://refivu.com/en/papers/34b4bb2a-43de-4874-9031-6b02160d4003-two-stream-adaptive-graph-convolutional-networks-for.md)
- [Connecting the Dots: Multivariate Time Series Forecasting with Graph Neural Networks](https://refivu.com/en/papers/f0231d70-9d15-48d0-aa7c-c83cefdf69ab-connecting-the-dots-multivariate-time-series-forecasting.md)
- [KGAT: Knowledge Graph Attention Network for Recommendation](https://refivu.com/en/papers/c8788d47-0620-4271-bfbc-99d522ade86e-kgat-knowledge-graph-attention-network-for-recommendation.md)
- [SuperGlue: Learning Feature Matching with Graph Neural Networks](https://refivu.com/en/papers/9343403c-486b-4202-af8a-3329d26b1dad-superglue-learning-feature-matching-with-graph-neural.md)
- [Open3D: A Modern Library for 3D Data Processing](https://refivu.com/en/papers/d0e7cf62-d439-416d-a785-974f817c8a48-open3d-a-modern-library-for-3d-data-processing.md)
- [PCT: Point cloud transformer](https://refivu.com/en/papers/54b01448-d153-4635-92bf-22ab3866d1ae-pct-point-cloud-transformer.md)
- [Learning Deep CNN Denoiser Prior for Image Restoration](https://refivu.com/en/papers/e6af5c0e-57ae-4b96-acf1-3a40058beb53-learning-deep-cnn-denoiser-prior-for-image-restoration.md)
- [BinaryConnect: Training Deep Neural Networks with binary weights during propagations](https://refivu.com/en/papers/50c59bf6-7b51-443a-b99a-d2bbc087f3e9-binaryconnect-training-deep-neural-networks-with-binary.md)
- [Self-critical Sequence Training for Image Captioning](https://refivu.com/en/papers/04b028af-36f0-4ffd-b470-072e66a024c9-self-critical-sequence-training-for-image-captioning.md)
- [Bilinear CNNs for Fine-grained Visual Recognition](https://refivu.com/en/papers/6ca2f2f1-4711-4b74-898b-dcb3662ffa1f-bilinear-cnns-for-fine-grained-visual-recognition.md)
- [Time Series Forecasting With Deep Learning: A Survey](https://refivu.com/en/papers/780d7359-7e46-4268-a1a4-b0f1171c7abd-time-series-forecasting-with-deep-learning-a-survey.md)
- [Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision](https://refivu.com/en/papers/fe9f3871-e0e0-4933-a807-febf612d4db8-scaling-up-visual-and-vision-language-representation.md)

## Terms in this paper

- [ADAM](https://refivu.com/en/terms/0e9ad0199e08-adam)
- [ReLU](https://refivu.com/en/terms/7b22f5612f6c-relu)
- [GloVe](https://refivu.com/en/terms/8a6b3410f3dd-glove)
- [test accuracy](https://refivu.com/en/terms/021c3c30b755-test-accuracy)
- [GCN](https://refivu.com/en/terms/6be0326c6c22-gcn)
- [TF-IDF](https://refivu.com/en/terms/b8fd079027e3-tf-idf)
- [sliding window](https://refivu.com/en/terms/36584a6497c3-sliding-window)
- [MR](https://refivu.com/en/terms/8b735ad0001e-mr)
- [Laplacian smoothing](https://refivu.com/en/terms/5b765be91f12-laplacian-smoothing)
- [CNN-non-static](https://refivu.com/en/terms/54675d6d1476-cnn-non-static)
- [PV-DBOW](https://refivu.com/en/terms/dd253beb24bd-pv-dbow)
- [Softmax classifier](https://refivu.com/en/terms/f4eb67199e6b-softmax-classifier)
- [transductive](https://refivu.com/en/terms/3cb3141f0ac4-transductive)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/3f1e8027-a608-4e71-87f0-2bdbf0fd5a7f-graph-convolutional-networks-for-text-classification)
