Introduction
Graph Neural Networks (GNNs) have become a cornerstone of modern recommendation systems due to their ability to model complex user-item interactions. However, these models frequently encounter the challenge of data sparsity, where the limited number of interactions per user makes it difficult to learn robust representations. Contrastive Learning (CL) has emerged as a popular solution, typically involving the creation of multiple "augmented" views of the graph to teach the model invariant features.
Despite their success, existing Graph Contrastive Learning (GCL) methods often rely on random perturbations, such as edge dropping (e.g., SGL) or adding Gaussian noise to embeddings (e.g., SimGCL). These "blind" augmentations can inadvertently destroy critical collaborative signals, especially in sparse datasets where every interaction is vital. This paper introduces CoGCL (Code-based Graph Contrastive Learning), a framework designed to replace random noise with reliable, informative augmentations grounded in learned discrete codes.
Methodology: Code-based Graph Contrastive Learning
CoGCL shifts the paradigm from random perturbation to structured augmentation through several key components:
1. End-to-End Discrete Code Learning
The core of CoGCL is the mapping of continuous GNN embeddings into structured discrete codes. Using a multi-level vector quantizer (Residual Quantization), the model represents users and items as a sequence of discrete IDs. This process is learned end-to-end, allowing the "categories" or codes to evolve alongside the recommendation task.
2. Virtual Neighbor Augmentation and Semantic Sampling
Instead of removing edges, CoGCL treats these discrete codes as "virtual nodes." By adding edges between users/items and their corresponding codes, the model effectively densifies the interaction graph based on learned semantic features. Furthermore, Semantic Relevance Sampling identifies positive pairs by finding users who share similar codes or have interacted with the same items, providing a more stable signal than random noise.
3. Triple-View Contrastive Learning
The final architecture aligns three distinct views: the original interaction graph, a neighborhood-augmented view (using codes as virtual neighbors), and a semantically relevant view. This triple-view approach ensures that the model captures both structural and semantic similarities.
Experimental Evaluation
The authors evaluated CoGCL on four public benchmarks: Amazon Instrument, Amazon Office, Gowalla, and iFashion. These datasets represent various scales and degrees of sparsity.
Key Results
- Performance Gains: CoGCL consistently outperformed state-of-the-art baselines like LightGCL, SimGCL, and NCL. Notably, on the sparse Office dataset, CoGCL achieved a 16.43% improvement in Recall@5 and a 17.14% improvement in NDCG@5 over the strongest baseline.
- The "Alignment" Paradox: Empirical analysis revealed that in traditional GCL, the "alignment" of perturbed views often contributes minimally to performance because the perturbations are too destructive. CoGCL resolves this by ensuring that augmented views remain informative.
- Robustness to Sparsity: While edge-dropping methods like SGL often struggle with sparse graphs, CoGCL's performance gains were most pronounced in these scenarios, as the discrete codes act as "latent bridges" between isolated nodes.
Conclusion
CoGCL addresses the fundamental limitations of random augmentation in graph contrastive learning. By leveraging discrete quantization to create reliable virtual neighbors, the framework provides a more stable and informative training signal for recommendation systems. This approach not only improves performance on sparse datasets but also maintains inference efficiency, as the code-based components are only utilized during the training phase. Future work may explore the interpretability of these learned codes and their application to sequential recommendation and click-through rate prediction.
Summary updated