# Prototypical Graph Contrastive Learning for Recommendation
## 3 Methodology
### Graph Neural Network Backbone  
Graph neural networks can learn neighborhood information of nodes, generating embeddings for users and items with potential preferences. They propagate node information to high-order neighborhoods through layer-wise propagation. Specifically, in ProtoRec, LightGCN [4] is adopted as the fundamental framework for the GNN module to learn the interaction information between users and items. Compared to LightGCN, ProtoRec combines the extracted prototype information to design a feature augmentation module and a single-view prototype contrastive learning method to optimize the recommendation performance of the entire model. The performance improvement of LightGCN primar ily stems from its efficient aggregation of neighborhood information. As the number of propagation layers increases, the stacking of feature transformations and nonlinear activations exacerbates the over-smoothing of embeddings and significantly increases model complexity, making it unsuitable for real-time recommendation on large-scale data [4; 17]. Therefore, LightGCN eliminates these two components during the aggregation process. The \(l\)-th embedding propagation layer is represented as  
\[\mathbf{E^{(l)}}=\overline{\mathbf{A}}\cdot\mathbf{E^{(l-1)}} \tag{3}\]  
To enrich the embeddings of users and items and mitigate the impact of over-smoothing, a weighted sum function is employed to aggregate embeddings from different layers to obtain the final embedding:  
\[\mathbf{E}=\frac{1}{L}\sum_{l=1}^{L}\mathbf{E^{(l)}} \tag{4}\]  
where \(\mathbf{E}\in\mathbb{R}^{(M+N)\times d}\) represents the final embedding of GNN. To facilitate subsequent calculations, the embedding matrix \(\mathbf{E}\) is split into \(e^{(u)}\in\mathbb{R}^{M\times d}\) and \(e^{(i)}\in\mathbb{R}^{N\times d}\), representing user and item embeddings, respectively. The steps shown in Equations (3) and (4) correspond to the \"GCNs\" module in Figure 1. The probability prediction score \(\hat{y}_{ui}\) for the interaction between user \(u\) and item \(i\) is represented in inner product form as \(\hat{y}_{ui}=e_{u}^{(u)}e_{i}^{(i)}\). To encourage observed interaction probabilities to be higher than unobserved ones, ProtoRec employs Bayesian Personalized Ranking (BPR) [18] loss as its optimization objective. Formally, the BPR loss is represented as  
\[\mathcal{L}_{bpr}=\sum_{(u,i^{+},i^{-})\in\mathcal{O}}-\log(\sigma(\hat{y}_{ ui^{+}}-\hat{y}_{ui^{-}})) \tag{5}\]  
where \(\log(\cdot)\) and \(\sigma(\cdot)\) denote the logarithm and sigmoid functions, respectively. User \(u\) along with its corresponding positive item \(i^{+}\) and negative item \(i^{-}\) belong to interaction set \(\mathcal{O}=\{(u,i^{+},i^{-})|\mathbf{R}_{ui^{+}}=1,\mathbf{R}_{ui^{-}}=0\}\). Equation (5) corresponds to the \"BPR\" module in Figure 1.  
Figure 1: The overall model framework of ProtoRec. The (**upper**) part of the figure illustrates the message aggregation process of graph convolution, while the (**lower**) part represents the augmentation process based on prototype information.  
By optimizing the BPR loss, ProtoRec can effectively learn the neighborhood information of nodes and predict whether there is a latent preference between users and items. However, just as users in daily life often have interests in certain categories of items (electronics, cosmetics, clothing, etc.), users and items belonging to the same category are mutually associated. Next, we extract preference prototypes from embeddings of numerous users and items and construct latent neighborhood relationships.