Improving Graph Convolutional Networks with Transformer Layer in social-based items recommendation

Thi Linh Hoang, Tuan Dung Pham, Viet Cuong TaKSE 2021 · DOI

Abstract

In this work, we have proposed an approach for improving the GCN for predicting ratings in social networks. Our model is expanded from the standard model with several layers of transformer architecture. The main focus of the paper is on the encoder architecture for node embedding in the network. Using the embedding layer from the graph-based convolution layer, the attention mechanism could rearrange the feature space to get a more efficient embedding for the downstream task. The experiments showed that our proposed architecture achieves better performance than GCN on the traditional link prediction task.

Introduction

Traditional recommendation systems often rely on Matrix Factorization (MF), which models user-item interactions but frequently ignores the rich "social fabric" surrounding users. While Graph Convolutional Networks (GCNs) have improved this by modeling information diffusion across social and interaction graphs, they can struggle to capture complex, non-local patterns within the embedding space.

The authors identify a gap: GCNs are excellent at aggregating local neighborhood information, but they lack the sophisticated attention mechanisms needed to "rearrange" those features for specific downstream tasks like rating prediction. The challenge is to create a model that leverages both the explicit graph structure (who trusts whom) and the latent patterns in how users interact with items.

Methodology

The proposed Graph Transformer Network (GTN) is a multi-stage pipeline designed to refine node embeddings through a combination of spatial aggregation and feature-space attention.

Overview of the GTN architecture and the detailed Transformer encoder block.
  1. Graph Convolutional Layers: The model starts with two GCN layers. These layers perform neighborhood normalization and aggregation, distilling the initial node features and graph topology into a preliminary embedding. The authors found that two layers were optimal; a third layer led to "over-smoothing," where node embeddings became indistinguishable from their neighbors.
  2. Transformer Encoder: The output from the GCN is fed into a Transformer encoder. Unlike standard GCNs, the Transformer uses Multi-head Attention to discover frequent patterns and dependencies within the feature space. This step refines the embeddings, making them more "predictive" for the final task.
  3. Link Prediction Head: To predict a rating, the model concatenates the refined embeddings of a user and an item. This combined vector is passed through a simple Linear layer to output a numerical rating.
  4. Optimization: The model is trained using Mean Squared Error (MSE) loss and the Adam optimizer. To handle large social graphs, a re-indexing technique creates sub-graphs for mini-batch processing.

Experimental Setup

The model was evaluated on two classic social-based recommendation benchmarks:

  • Ciao: A dataset from a social networking site containing ~7,300 users, 105,000 items, and a "trust" network.
  • Epinions: A larger dataset with ~18,000 users and 261,000 items, featuring a "Web of Trust."

Both datasets provide explicit ratings (1-5 stars) and social connection data.

Results and Discussion

The GTN model outperformed several strong baselines, including Probabilistic Matrix Factorization (PMF), Neural Collaborative Filtering (NeuMF), and GraphRec.

Training loss comparison across different models, showing GTN achieving the lowest stable loss over 50 epochs.
  • Accuracy: On the Ciao dataset, GTN achieved an RMSE of 0.9732, significantly lower than the standard GCN's 1.0605.
  • Multi-head Attention: Experiments showed that increasing the number of attention heads (up to 3) consistently improved performance, suggesting that user preferences are multi-faceted and benefit from representation in different subspaces.
  • Comparison to GraphRec: Even against GraphRec—a dedicated GNN for social recommendation—GTN showed superior predictive power, validating the addition of the Transformer layers.

Conclusion

The GTN architecture demonstrates that GCNs and Transformers are complementary: GCNs handle spatial relationships, while Transformer layers handle feature relationships. While the model achieves state-of-the-art accuracy, it faces challenges regarding computational overhead, requiring more GPU memory (11.4 GB vs. 7.8 GB for GCN) and longer training times. Future work will focus on optimizing the attention mechanism to reduce resource intensity without sacrificing accuracy.

Summary updated

BibTeX
@inproceedings{hoang2021improving,
  author = {Thi Linh Hoang and Tuan Dung Pham and Viet Cuong Ta},
  title = {{Improving Graph Convolutional Networks with Transformer Layer in social-based items recommendation}},
  booktitle = {KSE},
  year = {2021},
  doi = {10.1109/kse53942.2021.9648823},
}
Figure