TL;DR
Graph contrastive learning (GCL) for recommendation often relies on random perturbations that accidentally destroy crucial user-item relationship data. This paper introduces CoGCL, a framework that uses end-to-end learned discrete codes to generate reliable, structurally enriched, and semantically relevant contrastive views. By replacing random noise with collaborative-rich discrete codes, CoGCL significantly boosts recommendation performance, especially for sparse datasets.
What Problem Does This Paper Address?
Graph Neural Networks (GNNs) excel at collaborative filtering by modeling high-order user-item interactions. To combat data sparsity, researchers often turn to Graph Contrastive Learning (GCL), which creates alternative "views" of the data to provide self-supervised signals.
However, standard GCL methods generate these views via random perturbations—like dropping edges stochastically or adding random noise to embeddings. The authors demonstrate that these random changes often disrupt the very collaborative information the model is trying to learn. In fact, their empirical analysis reveals that aligning positive pairs under these noisy perturbations can actually mislead model learning, meaning existing GCL methods rely almost entirely on pushing negative pairs apart rather than effectively pulling positive pairs together.
Methods
The authors propose CoGCL (Code-governed Graph Contrastive Learning), which replaces random perturbations with discrete codes to guide view generation. The framework consists of four main components:
- End-to-End Discrete Code Learning: User and item representations from a GNN encoder (LightGCN) are passed through a multi-level vector quantizer (using Residual Quantization or Product Quantization) optimized via cosine similarity. This maps continuous embeddings into discrete IDs (codes) that capture latent collaborative semantics.
- Virtual Neighbor Augmentation: Instead of randomly dropping edges, CoGCL uses the learned codes to expand the graph. An interaction edge can be augmented by either replacing a neighbor item with its corresponding codes or adding the codes as virtual neighbors. This provides well-founded structural expansion based on actual interactions.
- Semantic Relevance Sampling: CoGCL identifies distinct users or items that share discrete codes or share interaction targets, treating them as positive pairs to enhance semantic clustering.
- Triple-View Graph Contrastive Learning: The model optimizes a joint loss function combining standard recommendation loss (BPR), discrete code learning loss, and contrastive losses across three views: two structurally augmented views and one semantically sampled view.
Datasets
The framework was evaluated on four public datasets varying in domain, scale, and sparsity:
- Instrument (subset of the Amazon2023 benchmark)
- Office (subset of the Amazon2023 benchmark)
- Gowalla (a location-based social network dataset)
- Alibaba-iFashion (a highly sparse fashion recommendation dataset)
Key Insights and Ideas
- The Illusion of Alignment: An empirical analysis (shown in Figure 2) reveals that in existing GCL methods, disabling the alignment of positive pairs has minimal negative impact. This proves that random perturbations make positive alignment ineffective, and the benefits of standard GCL mostly come from representation uniformity (pushing negatives apart).
- Discrete Codes as Safe Harbors: Mapping continuous embeddings to discrete codes acts as a regularizer that preserves collaborative semantics, allowing for structural expansion without introducing arbitrary noise.
- Virtual Neighbors for Sparse Users: Treating discrete codes as virtual neighbors effectively densifies the graph for low-interaction users, leading to massive performance gains where traditional GNNs struggle.
Key Results
- State-of-the-Art Performance: CoGCL consistently outperformed all baseline models (including SGL, SimGCL, and LightGCL) across all datasets. For instance, it achieved a 16.43% relative improvement in Recall@5 on the Office dataset compared to the best baseline.
- Tackling Data Sparsity: As shown in Figure 6, CoGCL delivers its most pronounced improvements in highly sparse user groups, validating its ability to alleviate data sparsity through code-based augmentation.
- Ablation Verification: Ablation studies confirmed that both structural operators ("add" and "replace") and semantic sampling strategies contribute significantly to the final performance.
Limitations and Future Work
The authors note that future work will focus on improving the scalability of the framework to handle even larger web-scale graphs efficiently. Additionally, they plan to extend the code-governed contrastive learning paradigm to other recommendation tasks, such as click-through rate (CTR) prediction and sequential recommendation.
Summary updated