SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\begin{array}{l} \underbrace{\max\{0,\{s(u,j) - s(u,i) + \delta_{j}\}_{j\in\mathcal{N}_{u}}\}}_{\text{Hardness-aware ranking criterion}}\approx \log (\exp (0) + \sum_{j = 1}^{| \mathcal{N}_{u}|}\exp (s(u,j) - s(u,i) + \delta_{j})) \\ = \log \left\{1 + \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \exp \left(\delta_ {j}\right) \exp \left(s (u, j) - s (u, i)\right) \right\} \\ = \log \left\{1 + \left| \mathcal {N} _ {u} \right| \sum_ {j = 1} ^ {\left| \mathcal {N} _ {u} \right|} \frac {\exp \left(\delta_ {j}\right)}{\left| \mathcal {N} _ {u} \right|} \exp (s (u, j) - s (u, i)) \right\} \\ = \underbrace {- \log \left\{\frac {\exp (s (u , i))}{\exp (s (u , i)) + \left| \mathcal {N} _ {u} \right| \sum_ {j = 1} ^ {\left| \mathcal {N} _ {u} \right|} \frac {\exp (\delta_ {j})}{\left| \mathcal {N} _ {u} \right|} \exp (s (u , j))} \right\}} _ {\text {A d v I n f o N C E}} \tag {13} \\ \end{array}
$$
Drawing inspiration from adversarial training [48], we utilize a min-max game that allows for alternating training of the model between predicting hardness and refining the CF model. Formally, we formulate the AdvInfoNCE learning framework as the following optimization problem:
$$
\min  _ {\theta} \mathcal {L} _ {\text {A d v I n f o N C E}} = \min  _ {\theta} \max  _ {\Delta \in \mathbb {C} (\eta)} - \sum_ {(u, i) \in \mathcal {O} ^ {+}} \log \frac {\exp (s (u , i))}{\exp (s (u , i)) + | \mathcal {N} _ {u} | \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \frac {\exp \left(\delta_ {j} ^ {(u , i)}\right)}{| \mathcal {N} _ {u} |} \exp (s (u , j))} \tag {14}
$$
where  $\frac{\exp(\delta_j^{(u,i)})}{|\mathcal{N}_u|} \in \mathbb{C}(\eta, (u,i)) = (\frac{1}{|\mathcal{N}_u|} - \epsilon, \frac{1}{|\mathcal{N}_u|} + \epsilon)$ , and  $\epsilon$  is a hyperparameter that regulates the upper-bound deviation of hardness. In practice,  $\epsilon$  is regulated by the number of adversarial training epochs under a fixed learning rate (refer to Algorithm 1).
If we further define  $\frac{\exp(\delta_j^{(u,i)})}{|\mathcal{N}_u|}$  as  $p(j|(u,i))$ , which signifies the likelihood of selecting item  $j$  as a negative sample for the user-item pair  $(u,i)$ , we can rewrite the AdvInfoNCE loss as:
$$
\min  _ {\theta} \mathcal {L} _ {\text {A d v I n f o N C E}} = \min  _ {\theta} \max  _ {p (\cdot | \cdot)} - \sum_ {(u, i) \in \mathcal {O} ^ {+}} \log \frac {\exp (s (u , i))}{\exp (s (u , i)) + | \mathcal {N} _ {u} | \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} p (j | (u , i)) \exp (s (u , j))} \tag {15}
$$
B.2 Proof of Theorem
Theorem 3.1. We define  $\delta_j^{(u,i)}\doteq \log (|\mathcal{N}_u|\cdot p(j|(u,i))$  , where  $p(j|(u,i))$  is the probability of sampling negative item  $j$  for observed interaction  $(u,i)$  . Then, optimizing AdvInfoNCE loss is equivalent to solving Kullback-Leibler (KL) divergence-constrained distributionally robust optimization (DRO) problems over negative sampling:
$$
\min  _ {\theta} \mathcal {L} _ {\text {A d v I n f o N C E}} \Longleftrightarrow \min  _ {\theta} \max  _ {p (j | (u, i)) \in \mathbb {P}} \mathbb {E} _ {P} \left[ \exp \left(s (u, j) - s (u, i)\right): \mathcal {D} _ {K L} \left(P _ {0} | | P\right) \leq \eta \right] \tag {8}
$$
Proof. We denote the relative hardness of negative item  $j$  with respect to observed interaction  $(u, i)$  as  $\delta_j^{(u,i)}$  and redefine it as  $\log(|\mathcal{N}_u| \cdot p(j|(u,i))$ ). In this definition,  $|\mathcal{N}u|$  is the number of negative
samples for each user  $u$ , and  $p(j|(u,i))$  is the probability of selecting item  $j$  as a negative sample for a given user-item pair  $(u,i)$ .
With the constraint that  $\sum_{j=1}^{|N_u|} p(j|(u,i)) = 1$ , we can recalculate the average hardness as follows:
$$
\begin{array}{l} \frac {1}{| \mathcal {N} _ {u} |} \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \delta_ {j} ^ {(u, i)} = \frac {1}{| \mathcal {N} _ {u} |} \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \log (| \mathcal {N} _ {u} | \cdot p (j | (u, i))) \\ = - \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \frac {1}{| \mathcal {N} _ {u} |} \log \left(\frac {1}{| \mathcal {N} _ {u} |} \cdot \frac {1}{p (j | (u , i))}\right) \\ = - \mathcal {D} _ {K L} (P _ {0} | | P) \tag {16} \\ \end{array}
$$
In this formulation,  $P_0$  represents the distribution of uniformly drawn negative samples, where  $p_0(j|(u,i)) = \frac{1}{|\mathcal{N}_u|}$ . Meanwhile,  $P$  denotes the distribution of negative sampling, represented as  $p(j|(u,i))$ .
Since  $p(j|(u,i)) \in \mathbb{C}(\eta, (u,i)) = (\frac{1}{|\mathcal{N}_u|} - \epsilon, \frac{1}{|\mathcal{N}_u|} + \epsilon)$ , we further define  $\eta = -\log(1 - \frac{\epsilon^2}{|\mathcal{N}_u|})$ . Thus, the feasible zone presented above is equivalent to a relaxed constraint  $\mathcal{D}_{KL}(P_0||P) \leq \eta$ .
The AdvInfoNCE loss for all observations can be rewritten in a different form by reorganizing and simplifying the Eq (15):
$$
\begin{array}{l} \min  _ {\theta} \mathcal {L} _ {\text {A d v I n f o N C E}} = \min  _ {\theta} \sum_ {(u, i) \in \mathcal {O} ^ {+}} \max  _ {p (j | (u, i)) \in \mathbb {P}} \log \left\{1 + \left| \mathcal {N} _ {u} \right| \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} p (j | (u, i)) \exp (s (u, j) - s (u, i)) \right\} \\ \Longleftrightarrow \min  _ {\theta} \sum_ {(u, i) \in \mathcal {O} ^ {+}} \max  _ {p (j | (u, i)) \in \mathbb {P}} \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} p (j | (u, i)) \exp (s (u, j) - s (u, i)) \\ \Longleftrightarrow \min  _ {\theta} \sum_ {(u, i) \in \mathcal {O} ^ {+}} \sup  _ {p (j | (u, i)) \in \mathbb {P}} \mathbb {E} _ {P} [ \exp (s (u, j) - s (u, i)) ] \tag {17} \\ \end{array}
$$
The equation presented above exemplifies a widely encountered formulation of the Distributionally Robust Optimization (DRO) problem [49] where the ambiguity set of the probability distribution is defined by the Kullback-Leibler (KL) divergence  $\mathcal{D}_{KL}(P_0||P)\leq \eta$ .
B.3 Gradients Analysis
In this section, we delve into the crucial role of hardness  $\delta_{j}$  in controlling the penalty strength on hard negative samples. The analysis begins with the main part of AdvInfoNCE for a single positive interaction  $(u,i)$ , as defined in Eq (13), primarily due to its simplicity. For the sake of notation simplicity, let us denote it as:
$$
\mathcal {L} _ {\mathrm {A d v}} (u, i) = - \log \left\{\frac {\exp (s (u , i))}{\exp (s (u , i)) + \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \exp (\delta_ {j}) \exp (s (u , j))} \right\} \tag {18}
$$
Then the gradient with respect to the positive representations  $\phi_{\theta}(i)$  of item  $i$  is formulated as:
$$
\begin{array}{l} - \nabla_ {i} \mathcal {L} _ {\mathrm {A d v}} (u, i) = \frac {\partial \mathcal {L} _ {\mathrm {A d v}} (u , i)}{\partial s (u , i)} \cdot \frac {\partial s (u , i)}{\partial \phi_ {\theta} (i)} \\ = \left(1 - \frac {\exp (s (u , i))}{\exp (s (u , i)) + \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \exp (\delta_ {j}) \exp (s (u , j))}\right) \cdot \frac {\phi_ {\theta} (i)}{\tau} \tag {19} \\ \end{array}
$$
The gradients with respect to the negative representations  $\phi_{\theta}(j)$  of item  $j$  is given by:
$$
\begin{array}{l} - \nabla_ {j} \mathcal {L} _ {\mathrm {A d v}} (u, i) = \frac {\partial \mathcal {L} _ {\mathrm {A d v}} (u , i)}{\partial s (u , j)} \cdot \frac {\partial s (u , j)}{\partial \phi_ {\theta} (j)} \\ = \frac {\exp (\delta_ {j}) \exp (s (u , j))}{\exp (s (u , i)) + \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \exp (\delta_ {j}) \exp (s (u , j))} \cdot \frac {\phi_ {\theta} (j)}{\tau} \\ = \exp (\delta_ {j}) \{1 - \frac {\exp (s (u , i))}{\exp (s (u , i)) + \sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \exp (\delta_ {j}) \exp (s (u , j))} \} \frac {\exp (s (u , j))}{\sum_ {j = 1} ^ {| \mathcal {N} _ {u} |} \exp (\delta_ {j}) \exp (s (u , j))} \frac {\phi_ {\theta} (j)}{\tau} \\ \end{array}
$$
Clearly, for a given user  $u$ , the gradient with respect to the positive item  $i$  equals the sum of gradients of all negative items, in accordance with the findings in [38]. The hardness  $\exp(\delta_j)$  dictates the importance of negative gradients. Specifically, the gradients relating to the negative item  $j$  in Eq (20) correlate proportionally to the hardness term  $\exp(\delta_j)$ , which shows that the AdvInfoNCE loss function is hardness-aware.
B.4 Align Top-K evaluation metric
Discounted Cumulative Gain (DCG) is a commonly used ranking metric in top-  $K$  recommendation tasks. In DCG, the relevance of an item's contribution to the utility decreases logarithmically in relation to its position in the ranked list. This mimics the behavior of a user who is less likely to scrutinize items that are positioned lower in the ranking. Formally, DCG over rank  $\pi_s(u,i)$  is defined as follows:
$$
D C G \left(\pi_ {s} (u, \mathcal {I}), \mathbf {y}\right) = \sum_ {i = 1} ^ {| \mathcal {I} |} \frac {2 ^ {y _ {i}} - 1}{\log_ {2} \left(1 + \pi_ {s} (u , i)\right)} \tag {21}
$$
Where  $\pi_s(u,\mathcal{I})$  is a ranked list over  $\mathcal{I}$ , as determined by the similarity function  $s$  for user  $u$ , and  $\mathbf{y}$  is a label vector that indicates whether an interaction has occurred previously or not. Then  $\pi_s(u,i)$  is the rank of item  $i$ . Building on the research presented in [68], we explore how well AdvInfoNCE aligns with DCG for our purposes.
Under our proposed fine-grained hardness ranking criteria defined in Eq (11), the  $\pi_s(u,i)$  can be obtained as follows:
$$
\begin{array}{l} \pi_ {s} (u, i) = 1 + \sum_ {j \in \mathcal {I} \backslash \{i \}} \mathbb {1} (s (u, j) - s (u, i) + \delta_ {j} > 0) \\ \leq 1 + \sum_ {j \in \mathcal {I} \backslash \{i \}} \exp (s (u, j) - s (u, i) + \delta_ {j}). \tag {22} \\ \end{array}
$$
The last inequality is satisfied by  $\mathbb{1}(x > 0) \leq \exp(x)$ .
$$
\begin{array}{l} - \log [ D C G (\pi_ {s} (u, \mathcal {I}), \mathbf {y}) ] = - \log \left[ \sum_ {i = 1} ^ {| \mathcal {I} |} \frac {2 ^ {y _ {i}} - 1}{\log_ {2} (1 + \pi_ {s} (u , i))} \right] \\ \leq - \log \left[ \frac {1}{\log_ {2} (1 + \pi_ {s} (u , i))} \right] \leq - \log \left[ \frac {1}{\pi_ {s} (u , i)} \right] \\ \leq - \log \left(\frac {1}{1 + \sum_ {j \in \mathcal {I} \backslash \{i \}} \exp (s (u , j) - s (u , i) + \delta_ {j})}\right) \\ = - \log (\frac {\exp (s (u , i))}{\exp (s (u , i)) + \sum_ {j \in \mathcal {I} \backslash \{i \}} \exp (s (u , j) + \delta_ {j})}) \\ = \mathcal {L} _ {\mathrm {A d v}} (u, i) \leq \mathcal {L} _ {\mathrm {A d v I n f o N C E}} \tag {23} \\ \end{array}
$$
Suppose that there are  $K$  items in  $\mathcal{I}$  that are interacted with  $u$ , let them to be  $\{1,2,\dots ,K\}$  without loss of generality. Then
$$
D C G \left(\pi_ {s} (u, \mathcal {I}), \mathbf {y}\right) \leq \sum_ {i = 1} ^ {K} \frac {1}{\log_ {2} (1 + i)}, \tag {24}
$$
the equality holds if and only if the interactions  $\{(u,i):i = 1,2,\dots ,K\}$  are ranked top-K. For a given  $u$
$$
\begin{array}{l} \sum_ {i = 1} ^ {K} \mathcal {L} _ {\mathrm {A d v}} (u, i) = \sum_ {i = 1} ^ {K} - \log (\frac {\exp (s (u , i))}{\exp (s (u , i)) + \sum_ {j \in \mathcal {I} \backslash \{i \}} \exp (s (u , j) + \delta_ {j})}) \\ = \sum_ {i = 1} ^ {K} \log (1 + \sum_ {j \in \mathcal {I} \backslash \{i \}} \exp (s (u, j) - \exp (s (u, i)) + \delta_ {j})) \\ \geq \sum_ {i = 1} ^ {K} \log \left(1 + \sum_ {j \in \mathcal {I} \backslash \{i \}} e ^ {- 1}\right) = \sum_ {i = 1} ^ {K} \log \left(1 + \left(\left| \mathcal {I} \right| - 1\right) e ^ {- 1}\right) (25) \\ \geq \sum_ {i = 1} ^ {K} \frac {1}{\log_ {2} (1 + i)} \geq D C G \left(\pi_ {s} (u, \mathcal {I}), \mathbf {y}\right). (26) \\ \end{array}
$$
The inequality in Eq (25) holds under the common usage of  $s(u, i) \in [0, 1]$ , the first inequality in Eq (26) holds when  $|\mathcal{I}| \geq 6$ , while the second inequality in Eq (26) holds by Eq (24).
Therefore, by Eq (23) and Eq (26),
$$
\mathcal {L} _ {\text {A d v I n f o N C E}} \geq D C G \left(\pi_ {s} (u, \mathcal {I}), \mathbf {y}\right) \geq \exp \left(- \mathcal {L} _ {\text {A d v I n f o N C E}}\right). \tag {27}
$$
Consequently, minimizing  $\mathcal{L}_{\mathrm{AdvInfoNCE}}$  is equivalent to minimizing  $DCG(\pi_s(u,\mathcal{I}),\mathbf{y})$
C.1 Experimental Settings
- KuaiRec [56] is a real-world dataset sourced from the recommendation logs of KuaiShou, a platform for sharing short videos. The unbiased testing data consist of dense ratings from 1411 users for 3327 items, with the training data being relatively sparse. We categorize items that have a viewing duration exceeding twice the length of the short video as positive interactions.
- Yahoo!R3 [57] is a dataset that encompasses ratings for songs. The training set is comprised of 311,704 user-selected ratings ranging from 1 to 5. The test set includes ratings for ten songs randomly exposed to each user. Interactions with items receiving a rating of 4 or higher are considered positive in our experiments.
- Coat [58] records online shopping interactions of customers purchasing coats. The training set, characterized as a biased dataset, comprises ratings provided by users for 24 items they have chosen. The test set, on the other hand, contains ratings for 16 coats that were randomly exposed to each user. Ratings in Coat follow a 5-point scale, and interactions involving items with a rating of 4 or above are classified as positive instances in our experiments.
- Tencent [10] is collected from the Tencent's short-video platform. We sort the items according to their popularity in descending order and divide them into 50 groups. Each group, defined by its popularity rank, is assigned a certain number of interactions, denoted by  $N_{i}$ , for inclusion in the test set. The quantity  $N_{i}$  is calculated based on  $N_{0} \cdot \gamma^{-\frac{i - 1}{49}}$ , where  $N_{0}$  is the maximum number of interactions across all test groups and  $\gamma$  denotes the extent of the long-tail distribution. A lower value of gamma indicates a stronger deviation from the original distribution, thus yielding a more evenly distributed test set. To ensure that the validation set mirrored the long-tail distribution of
Table 3: Dataset statistics.
KuaiRec	Yahoo!R3	Coat	Tencent
#Users	7,176	14,382	290	95,709
#Items	10,728	1,000	295	41,602
#Interactions	1,304,453	129,748	2,776	2,937,228
Density	0.0169	0.0090	0.0324	0.0007
Table 4: The performance comparison on unbiased datasets over the MF backbone. The improvement achieved by AdvInfoNCE is significant ( $p$ -value  $< 0.05$ ).
Yahoo!R3	Coat
Recall	NDCG	Recall	NDCG
BPR (Rendle et al., 2012)	0.1189	0.0546	0.2782	0.1748
InfoNCE (van den Oord et al., 2018)	0.1478	0.0694	0.2683	0.1961
CCL (Mao et al., 2021)	0.1458-1.35%	0.0689-0.72%	0.2682-0.04%	0.1712-12.70%
BC Loss (Zhang et al., 2022)	0.1492+0.95%	0.0698+0.58%	0.2698+0.56%	0.1959-0.10%
Adap-τ (Chen et al., 2023)	0.1512+2.30%	0.0694+0.43%	0.2712+1.08%	0.1986+1.27%
AdvInfoNCE	0.1523*+3.04%	0.0710*+2.31%	0.2905*+8.27%	0.1999*+1.94%
the training set and no side information of the test set is leaked, the remaining interactions are randomly divided into training and validation sets at a ratio of 60:10.
Baselines. In this study, we conduct a comprehensive evaluation of AdvInfoNCE using two widely adopted collaborative filtering backbones, MF [50] and LightGCN [51]. We thoroughly compare AdvInfoNCE with two categories of the latest CL-based CF methods: augmentation-based baselines (SGL [13], NCL [52], XSimGCL [27]) and loss-based baselines (CCL [53], BC Loss [54], Adap-7 [55]).
- SGL [13] leverages data-heuristic graph augmentation techniques to generate augmented views. It then employs contrastive learning on the augmented views and the original embeddings.
- NCL [52] implements contrastive learning on two types of neighbors: structural neighbors and semantic neighbors. Structural neighbors are represented by the embeddings derived from even-numbered layers in a Graph Neural Network (GNN). Semantic neighbors comprise nodes with similar features or preferences, clustered through the Expectation-Maximization (EM) algorithm.
- XSimGCL [27] directly infuses noise into graph embeddings from the mid-layer of LightGCN to generate augmented views. This method arises from experimental observations indicating that CF models are relatively insensitive to graph augmentation. Instead, the key determinant of their performance lies in the application of contrastive loss.
- CCL [53] proposes a variant of contrastive loss based on cosine similarity. Specifically, it implements a strategy for filtering out negative samples lacking substantial information by employing a margin, denoted as  $m$ .
- BC Loss [54] integrates a bias-aware margin into the contrastive loss to alleviate popularity bias. Specifically, the bias-aware margin is learned via a specialized popularity branch, which only utilizes the statistical popularity of users and items to train an additional CF model.
- Adap- $\tau$  [55] proposes to automatically search the temperature of InfoNCE. Moreover, a fine-grained temperature is assigned for each user according to their previous loss.
Evaluation Metrics. We apply the all-ranking strategy, in which all items, with the exception of the positive ones present in the training set, are ranked by the collaborative filtering model for each user. An exception is KuaiRec, where the unbiased test set clusters in a small matrix [56]. This unique structure leads to a failure of the all-ranking strategy as the test set is not randomly selected from the whole user-item matrix. Consequently, for KuaiRec, we rank only the 3327 fully exposed items during the testing phase.
C.2 Performance over the MF Backbone
Given that the implementation of augmentation-based methods is tied to the LightGCN architecture, we compare AdvInfoNCE using the Matrix Factorization (MF) backbone against only loss-based methods. As shown in Table 4 and 5, AdvInfoNCE consistently surpasses all collaborative filtering baselines with modified contrastive losses. Moreover, similar to the trend observed with the LightGCN backbone, AdvInfoNCE excels on test sets exhibiting higher distribution shifts, while still preserving remarkable performance on the in-distribution validation set. The superior performance of AdvInfoNCE across both the LightGCN and MF backbones emphasizes its model-agnostic characteristic. We advocate for considering AdvInfoNCE as a standard loss in recommender systems.
Table 5: The performance comparison on the Tencent dataset over the MF backbone. The improvement achieved by AdvInfoNCE is significant ( $p$ -value  $< 0.05$ ).
HR	γ = 200 Recall	NDCG	HR	γ = 10 Recall	NDCG	HR	γ = 2 Recall	NDCG	Validation NDCG
BPR (Rendle et al., 2012)	0.0835	0.0299	0.0164	0.0516	0.0190	0.0102	0.0357	0.0141	0.008	0.0533
InfoNCE (van den Oord et al., 2018)	0.1476	0.0538	0.0318	0.0920	0.0334	0.0194	0.0627	0.0233	0.0141	0.0856
CCL (Mao et al., 2021)	0.1395	0.0523	0.0317	0.0930	0.0353	0.0221	0.0683	0.0266	0.0170	0.0782
BC Loss (Zhang et al., 2022)	0.1546	0.0575	0.0349	0.1011	0.0378	0.0228	0.0737	0.0280	0.0178	0.0864
Adap-τ (Chen et al., 2023)	0.1398	0.0512	0.0302	0.0876	0.0316	0.0182	0.0591	0.0221	0.0134	0.0844
AdvInfoNCE	0.1606*	0.0595*	0.0355*	0.1111*	0.0412*	0.0249*	0.0813*	0.0308*	0.0189*	0.0860
Imp.% over the strongest baseline	3.87%	3.52%	1.86%	9.86%	8.86%	9.38%	10.33%	9.87%	6.28%	-
Imp.% over InfoNCE	8.84%	10.51%	11.77%	20.81%	23.52%	28.41%	29.64%	31.97%	33.69%	-
Table 6: The performance comparison on the Tencent dataset over extensive backbones. The improvement achieved by AdvInfoNCE is significant  $(p$ -value  $<< 0.05)$ .
γ = 200	γ = 10	γ = 2	Validation
HR	Recall	NDCG	HR	Recall	NDCG	HR	Recall	NDCG	NDCG
UltraGCN (Mao et al., 2021)	0.0930	0.0343	0.0190	0.0567	0.0215	0.0119	0.0400	0.0157	0.0095	0.0682
UltraGCN + InfoNCE	0.1436	0.0519	0.0303	0.0896	0.0324	0.0189	0.0617	0.0227	0.0135	0.0842
UltraGCN + AdvInfoNCE	0.1538	0.0569	0.0338	0.1025	0.0380	0.0227	0.0726	0.0276	0.0168	0.0883
VGAE (Kipf and Welling, 2016) + InfoNCE	0.1482	0.0536	0.0315	0.0923	0.0338	0.0202	0.0640	0.0237	0.0141	0.0823
VGAE + AdvInfoNCE	0.1588*	0.0589*	0.0353*	0.1069*	0.0395*	0.0239*	0.0778*	0.0296*	0.0182*	0.0871
C.3 Performance over Extensive Backbones
To validate the generalization ability of AdvInfoNCE, we conducted experiments on additional backbones, including UltraGCN [69] and an adapted version of VGAE [70]. The results in Table 6 indicate that AdvInfoNCE performs excellently across various backbones, which showcases the generalization ability of AdvInfoNCE.
C.4 Performance Comparison with Extensive Baselines
We compare AdvInfoNCE on the LightGCN backbone with extensive baselines on Tencent. The results in Table 7 show that AdvInfoNCE also outperforms almost all the latest debiasing [10, 71] and hard negative mining algorithms [72].
C.5 Training Cost
Let  $n$  be the number of items,  $d$  be the embedding size,  $N$  be the number of negative sampling,  $M = |\mathcal{O}^{+}|$  be the number of observed interactions,  $B$  be the batch size and  $N_{b}$  be the number of mini-batches within one batch. In AdvInfoNCE, the similarity calculation for one positive item with  $N$  negative items costs  $O((N + 1)d)$ , and the hardness calculation costs  $O(Nd)$ . The total training costs of one epoch without backward propagation are summarized in Table 8. The training cost of AdvInfoNCE is a little higher than BPR loss, sharing the same complexity with InfoNCE.
In Table 9, we present both the per-epoch and total time costs for each baseline model on the Tencent dataset. As evidenced, augmentation-based contrastive learning (CL) baselines significantly cut down the overall training time, while loss-based CL baselines exhibit a complexity similar to that of InfoNCE. Surprisingly, compared to InfoNCE, AdvInfoNCE introduces only a marginal increase in computational complexity during the training phase.
D Discussion about AdvInfoNCE
D.1 Algorithm
Algorithm 1 depicts the detailed procedure of AdvInfoNCE. Here we uniformly sample  $N$  negative items for each observed interaction and multiply a large weighting parameter  $K$  in front of each negative item, as a surrogate of the whole negative set  $\mathcal{N}_u$ . Specifically, we adversarially train the hardness  $\delta_j^{(u,i)}$  at a fixed interval before reaching the maximum adversarial training epochs  $E_{adv}$ . The precise methods for computing the hardness  $\delta_j^{(u,i)}$  are further discussed in Section D.4.
Table 7: The performance comparison on the Tencent dataset with extensive baselines. The improvement achieved by AdvInfoNCE is significant ( $p$ -value  $< 0.05$ ).
HR	γ = 200 Recall	NDCG	HR	γ = 10 Recall	NDCG	HR	γ = 2 Recall	NDCG	Validation NDCG
XIR (Chen et al., 2022)	0.1463	0.0538	0.0326	0.0936	0.0341	0.0211	0.0642	0.0245	0.0154	0.0883
sDRO (Wen et al., 2022)	0.1455	0.0516	0.0286	0.0857	0.0304	0.0166	0.0552	0.0205	0.0110	0.0872
InvCF (Zhang et al., 2023)	0.1651	0.0605	0.0331	0.1061	0.0386	0.0204	0.0722	0.0272	0.0149	0.0912
AdvInfoNCE	0.1600	0.0594	0.0356*	0.1087*	0.0403*	0.0243*	0.0774*	0.0295*	0.0180*	0.0879
Table 8: Time Complexity
+BPR	+InfoNCE	+CCL	+BC Loss	+Adap τ	+AdvInfoNCE
Backbone	O(NbBd)	O(NbB(N+1)d)	O(NbB(N+1)d)	O(NbB(N+1)d)	O(NbB(N+1)d+(M+n)d)	O(NbB(N+1)d)
D.2 Effect of the Fine-grained Hardness on KuaiRec
We conduct the same experiments as Section 4.2.1 on KuaiRec, to investigate how the fine-grained hardness affects the out-of-distribution performance.