## Exploiting Preferences in Loss Functions for Sequential Recommendation via Weak Transitivity

Hyunsoo Chung Omnious AI Seoul, South Korea hyunsoo.chung@omnious.com

Jungtaek Kim University of Pittsburgh Pittsburgh, Pennsylvania, United States jungtaek.kim@pitt.edu

Hyungeun Jo Omnious AI Seoul, South Korea hyungeun.jo@omnious.com

## ABSTRACT

A choice of optimization objective is immensely pivotal in the design of a recommender system as it affects the general modeling process of a user's intent from previous interactions. Existing approaches mainly adhere to three categories of loss functions: pairwise, pointwise, and setwise loss functions. Despite their effectiveness, a critical and common drawback of such objectives is viewing the next observed item as a unique positive while considering all remaining items equally negative. Such a binary label assignment is generally limited to assuring a higher recommendation score of the positive item, neglecting potential structures induced by varying preferences between other unobserved items. To alleviate this issue, we propose a novel method that extends original objectives to explicitly leverage the different levels of preferences as relative orders between their scores. Finally, we demonstrate the superior performance of our method compared to baseline objectives.

## CCS CONCEPTS

· Information systems → Recommender systems .

## KEYWORDS

Sequential recommendation, Loss functions, Transitivity

## ACMReference Format:

Hyunsoo Chung, Jungtaek Kim, Hyungeun Jo, and Hyungwon Choi. 2024. Exploiting Preferences in Loss Functions for Sequential Recommendation via Weak Transitivity. In Proceedings of the 33rd ACM International Conference on Information and Knowledge Management (CIKM '24), October 21-25, 2024, Boise, ID, USA. ACM, New York, NY, USA, 5 pages. https: //doi.org/10.1145/3627673.3679920

## 1 INTRODUCTION

Distinguishing items by relevance to an each user's previous interaction history is the essence of most applied sequential recommender

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.

CIKM '24, October 21-25, 2024, Boise, ID, USA

© 2024 Copyright held by the owner/author(s). Publication rights licensed to ACM. ACM ISBN 979-8-4007-0436-9/24/10

https://doi.org/10.1145/3627673.3679920

Hyungwon Choi Omnious AI Seoul, South Korea hyungwon.choi@omnious.com

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00326v1-figure-a50123e9-e18f-4e24-8eac-99822c4c2d87.jpg)

Item Subsets

Figure 1: Average recommendation scores of item subsets on the Amazon Beauty dataset trained with BPR (red solid), BCE (blue solid), and our transitive extensions (hatch). Each item subset in 𝑥 -axis equally consists of 20% of the total items divided based on their popularity. Bars with diagonal hatch assume that a user generally prefer popular items whereas bars with horizontal hatch regard niche items more preferred.

systems. Conventional approaches [12, 23, 24, 30] frame this task as learning the feature representations of a chronologically-ordered list of user's interacted items and a candidate item. By computing the inner product between two vectors, we then obtain a recommendation score that quantitatively indicates the relevance. On that basis, a prevalent training process reformulates the problem into a supervised learning framework with binary labels, where the next interacted item of each user becomes a unique positive to its sequence of previous items. Such a procedure often accompanies negative sampling [3-5, 7, 15, 21] among the rest of items since the score computation of all items during each training step inevitably results in severe inefficiency [14, 33].

In this line of research, numerous approaches have adopted advanced neural networks as feature encoders [2, 8-10, 13, 16, 27, 28, 35, 36] to capture more complex correlations. Apart from vast architectural improvements, the majority of models yet utilize one of three types of loss functions as an optimization objective: pairwise, e.g., BPR [22], pointwise, e.g., BCE [1, 34], and setwise, e.g., SSM [29] functions. While the formulation of each function

varies, they all share the desired result of increasing the score of the unique positive than the scores of the other items. Notably, most recent studies on loss functions and negative sampling strategies [4, 7, 11, 25, 26, 31, 32] aim for improved training efficiency and robustness to false negatives within three core objectives. Despite their effectiveness, the model trained with such objectives consequently learns to regard unobserved items as equally negative with their labels simply set to zero. In real-world recommendation, however, a subset of negative items is occasionally more favorable than the other due to various side factors, e.g., item popularity. Unfortunately, the current scheme of binary label assignments hinders from fully taking advantage of diverse levels of preferences among unobserved items.

To address the aforementioned issue, we first derive an inductive relation, dubbed weak transitivity, which represents preferencedriven orders of item scores. We then propose novel extensions of original loss functions that directly leverage this weak transitivity in their forms. Consequently, the recommendation scores of unobserved items are aligned with respect to their preferences. Figure 1 highlights such a property of resulting recommendation policy trained with our proposed family of objectives. Opposed to the results of BPR [22] and BCE [13], item scores from our transitive extensions TransBPRpop and TransBCEpop (horizontal hatch) are generally proportional to their popularity. Meanwhile, scores from TransBPRniche and TransBCEniche (diagonal hatch) are inversely proportional to their popularity, favoring more niche (i.e., unique) items. To cap it all, we serve the predefined preferences of items as an additional supervisory factor for their recommendation scores.

It is noteworthy that in this work we do not propose any new distributions for negative sampling but instead introduce the modification of original objectives. Hence, we solely utilize a combination of item popularity and uniform distributions for negative sampling, easily accessible in implicit settings. We validate the effectiveness of our proposed extensions compared to the original loss functions and their renowned variants on four sequential recommendation benchmarks. In all settings, our approaches substantially improve the recommendation performance compared to baseline methods.

## 2 BACKGROUND

In this section, we describe a sequential recommendation task and the details of representative loss functions for recommendation.

## 2.1 Problem Statement

Let U = { 𝑢 , . . . , 𝑢 1 𝑀 } and I = { 𝑖 1 , . . . , 𝑖 𝑁 } denote a set of users and items where 𝑀 and 𝑁 are maximum numbers of users and items, respectively. Given a chronologically ordered history ℎ 𝑢 = { 𝑖 𝑢 1 , . . . , 𝑖 𝑢 𝑡 } of observed items for a user 𝑢 , a goal of sequential recommendation is to recommend the most relevant next item 𝑖 𝑢 𝑡 + 1 . We first embed the history ℎ 𝑢 and a candidate item 𝑖 onto vectors ℎ ′ 𝑢 and 𝑖 ′ , respectively. Accordingly, a recommendation score ˆ 𝑠 𝑢𝑖 is calculated via an inner product between two embeddings.

## 2.2 Training Objectives

Pairwise Objective. Bayesian personalized ranking (BPR) [22] models personalized ranking of items. It forces the score of the positive (i.e., next interacted) item to be higher than the scores

Table 1: Statistics of four preprocessed datasets.

| Dataset   | #Interactions   | #Users   | #Items   |   Density |
|-----------|-----------------|----------|----------|-----------|
| Beauty    | 198,502         | 22,363   | 12,101   |   0.00073 |
| Toys      | 167,597         | 19,412   | 11,924   |   0.00072 |
| Sports    | 296,337         | 35,598   | 18,357   |   0.00045 |
| Yelp      | 317,182         | 30,499   | 20,068   |   0.00052 |

of the rest unobserved items. With a dataset D 𝑠 composed of a triplet ( 𝑢, 𝑖, 𝑗 ) of which item 𝑖 as a positive and item 𝑗 as a sampled negative to a user 𝑢 , the corresponding loss is formulated as follows:

$$\mathcal { L } _ { B P R } = - \sum _ { ( u, i, j ) \in \mathcal { D } _ { s } } \log \sigma ( \hat { s } _ { u i } - \hat { s } _ { u j } ), \quad \quad ( 1 )$$

where 𝜎 (·) is a sigmoid function. A resulting term 𝜎 𝑠 ( ˆ 𝑢𝑖 -ˆ 𝑠 𝑢𝑗 ) is the probability of a user 𝑢 preferring an item 𝑖 more than an item 𝑗 .

Pointwise Objective. Similar to the pairwise loss form, binary cross-entropy (BCE) [13] casts the recommendation problem into binary classification with a single sampled negative. Hence with a dataset D 𝑠 of a triplet ( 𝑢, 𝑖, 𝑗 ) , the loss is defined as below:

$$\mathcal { L } _ { \text{BCE} } = - \sum _ { ( u, i, j ) \in \mathcal { D } _ { s } } \log ( \sigma ( \hat { s } _ { u i } ) ) + \log ( 1 - \sigma ( \hat { s } _ { u j } ) ). \quad ( 2 )$$

Setwise Objective. The sampled softmax loss (SSM) [29] turns the problem into a multi-class classification with a finite number of sampled negatives. With a dataset D 𝑚 of a triplet ( 𝑢, 𝑖, N ) 𝑗 consisting of the positive 𝑖 and a set of multiple negative samples N 𝑗 to the user 𝑢 , the loss optimizes the probability of the positive as:

$$\mathcal { L } _ { \text{SSM} } = - \sum _ { ( u, i, \mathcal { N } _ { j } ) \in \mathcal { D } _ { m } } \log \frac { \exp ( \hat { s } _ { u i } ) } { \exp ( \hat { s } _ { u i } ) + \sum _ { j \in \mathcal { N } _ { j } } \exp ( \hat { s } _ { u j } ) }. \quad ( 3 )$$

## 3 OUR METHOD

Here, we introduce weak transitivity between unobserved items, and then describe how to integrate it to original objectives.

## 3.1 Weak Transitivity

Inducing orders on recommendation scores of unobserved items requires a model to sample two or more negatives differing in preferences. In a basic form, let 𝑝 1 and 𝑝 2 represent two different sampling distributions for negatives. Given a user 𝑢 and its positive 𝑖 , wesample a negative 𝑗 from 𝑝 1 and 𝑘 from 𝑝 2 where 𝑖 ≠ 𝑗 ≠ 𝑘 . Since the positive 𝑖 is the most preferred item to the user 𝑢 , a transitive relation ˆ 𝑠 𝑢𝑖 &gt; ˆ 𝑠 𝑢𝑗 &gt; ˆ 𝑠 𝑢𝑘 holds true when 𝑗 is more preferred than 𝑘 . Strict transitivity then corresponds to a scheme where any 𝑗 from 𝑝 1 is guaranteed to be more preferred than any 𝑘 from 𝑝 2. However, when the sampled negative 𝑗 is actually less preferable than 𝑘 , the relation ˆ 𝑠 𝑢𝑖 &gt; ˆ 𝑠 𝑢𝑗 &gt; ˆ 𝑠 𝑢𝑘 is violated. We refer this scheme as weak transitivity which allows such occasional violations.

The concept of transitivity with multiple negatives is straightforward as well. Instead of sampling a single negative from each distribution, we sample a set of negatives N 𝑗 = { 𝑗 1 , . . . , 𝑗 𝑛 } from 𝑝 1 and N 𝑘 = { 𝑘 , . . . , 𝑘 1 𝑛 } from 𝑝 2. Consequently, with ˆ 𝑠 N 𝑗 = { ˆ 𝑠 𝑢𝑗 1 , . . . , 𝑠 ˆ 𝑢𝑗 𝑛 } and ˆ 𝑠 N 𝑘 = { ˆ 𝑠 𝑢𝑘 1 , . . . , 𝑠 ˆ 𝑢𝑘 𝑛 } , a transitive relation

Table 2: Quantitative results of different methods on public datasets in terms of HR and NDCG. The number of recommended items is fixed to 10. Reported metrics in bold are best performing methods whereas underlined numbers are second to the best.

| Type   | Loss           | Beauty   | Beauty   | Toys   | Toys   | Sports   | Sports   | Yelp   | Yelp   |
|--------|----------------|----------|----------|--------|--------|----------|----------|--------|--------|
| Type   | Loss           | HR       | NDCG     | HR     | NDCG   | HR       | NDCG     | HR     | NDCG   |
|        | BPR            | 0.0470   | 0.0213   | 0.0518 | 0.0244 | 0.0263   | 0.0122   | 0.0555 | 0.0328 |
|        | GBPR           | 0.0529   | 0.0246   | 0.0618 | 0.0281 | 0.0277   | 0.0121   | 0.0607 | 0.0346 |
|        | TransBPR pop   | 0.0674   | 0.0293   | 0.0747 | 0.0338 | 0.0397   | 0.0179   | 0.0576 | 0.0362 |
|        | TransBPR niche | 0.0651   | 0.0289   | 0.0777 | 0.0358 | 0.0372   | 0.0171   | 0.0566 | 0.0355 |
|        | BCE            | 0.0511   | 0.0229   | 0.0590 | 0.0274 | 0.0290   | 0.0130   | 0.0529 | 0.0306 |
|        | gBCE 1         | 0.0545   | 0.0245   | 0.0656 | 0.0297 | 0.0294   | 0.0135   | 0.0551 | 0.0319 |
|        | TransBCE pop   | 0.0730   | 0.0324   | 0.0805 | 0.0372 | 0.0413   | 0.0186   | 0.0561 | 0.0360 |
|        | TransBCE niche | 0.0720   | 0.0322   | 0.0800 | 0.0369 | 0.0399   | 0.0179   | 0.0569 | 0.0358 |
|        | SSM            | 0.0656   | 0.0318   | 0.0673 | 0.0351 | 0.0381   | 0.0185   | 0.0616 | 0.0350 |
|        | InfoNCE        | 0.0632   | 0.0318   | 0.0742 | 0.0395 | 0.0363   | 0.0188   | 0.0483 | 0.0255 |
|        | BPR-DNS        | 0.0776   | 0.0356   | 0.0839 | 0.0386 | 0.0406   | 0.0187   | 0.0523 | 0.0349 |
|        | gBCE N         | 0.0725   | 0.0362   | 0.0783 | 0.0407 | 0.0415   | 0.0205   | 0.0632 | 0.0359 |
|        | TransSSM pop   | 0.0843   | 0.0395   | 0.0922 | 0.0439 | 0.0499   | 0.0229   | 0.0693 | 0.0418 |
|        | TransSSM niche | 0.0774   | 0.0370   | 0.0874 | 0.0417 | 0.0399   | 0.0187   | 0.0642 | 0.0385 |

is modified as ˆ 𝑠 𝑢𝑖 &gt; max ˆ ( 𝑠 N ) 𝑗 &gt; min ˆ ( 𝑠 N ) 𝑗 &gt; max ˆ ( 𝑠 N ) 𝑘 with the same criteria for weak and strict cases.

where 𝜃 is learnable parameters of the model. Similarly, the extension of the BCE function is formulated as below:

## 3.2 Extensions with Weak Transitivity

We propose novel extensions of original training objectives that resolves the limitation of binary label assignments by incorporating the derived transitive relation to the loss formulation. We first introduce two sampling schemes by utilizing an item popularity distribution 𝑝 pop and a uniform distribution 𝑝 unif :

$$\mathcal { D } _ { s } ^ { \prime } ( \text{pop} ) = \{ ( u, i, j, k ) \ | \ j \sim p _ { \text{pop} }, k \sim p _ { \text{unif} } \}, \quad ( 4 )$$

$$\mathcal { D } _ { s } ^ { \prime } ( \text{niche} ) = \{ ( u, i, j, k ) \ | \ j \sim p _ { \text{unif} }, k \sim p _ { \text{pop} } \}, \quad ( 5 )$$

where 𝑗 is the more preferred negative and 𝑘 is the less preferred one. The mini-batch D ′ ( 𝑠 pop ) assumes that a user generally prefers popular items whereas D ′ ( 𝑠 niche ) regards niche items more favored. Our extension of the BPR objective with transitivity is then given by the following:

$$\mathcal { L } _ { \text{TransBPR} } = - \sum _ { ( u, i, j, k ) \in \mathcal { D } _ { s } ^ { \prime } \underbrace { \log \sigma ( \hat { s } _ { u i } - \hat { s } _ { u j } ) } _ { \text{original} } } + \underbrace { \log \sigma ( \hat { s } _ { u j } - \hat { s } _ { u k } ) } _ { \text{preference} } \quad \text{As sir} \quad \text{$\frac{As sir}$} _ { - }$$

where 𝛾 is a balancing coefficient for two terms. In essence, the preference term encourages the score of 𝑗 to be higher than that of 𝑘 while the original term assures it to be smaller than that of 𝑖 . As a consequence, our objective explicitly imposes the transitive relation ˆ 𝑠 𝑢𝑖 &gt; ˆ 𝑠 𝑢𝑗 &gt; ˆ 𝑠 𝑢𝑘 to recommendation scores. Combining the proposed formulation with the previously introduced sampling schemes, we obtain two distinct training objectives as follows:

$$\text{TransBPR} _ { \text{pop} } = \mathcal { L } _ { \text{TransBPR} } ( \mathcal { D } _ { s } ^ { \prime } ( \text{pop} ) ; \theta ), \quad \ \ ( 7 ) \quad \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$$

$$\text{TransBPR} _ { \text{niche} } = \mathcal { L } _ { \text{TransBPR} } ( \mathcal { D } _ { s } ^ { \prime } ( \text{niche} ) ; \theta ), \quad \ ( 8 ) \quad \text{iter}$$

$$\mathcal { L } _ { \text{TransBCE} } = & - \sum _ { ( u, i, j, k ) \in \mathcal { D } _ { s } ^ { \prime } } \left [ \log ( \sigma ( \hat { s } _ { u i } ) ) + \log ( 1 - \sigma ( \hat { s } _ { u j } ) ) \\ & + \gamma \left ( \log ( \sigma ( \hat { s } _ { u j } ) ) + \log ( 1 - \sigma ( \hat { s } _ { u k } ) ) \right ) \right ].$$

Naturally, TransBCEpop and TransBCEniche are two consequent training schemes with D ′ ( 𝑠 pop ) and D ′ ( 𝑠 niche , respectively. For ) the setwise loss function, we sample a set of items N 𝑗 and N 𝑘 from each distribution instead of sampling a single item 𝑗 or 𝑘 :

$$\mathcal { D } _ { m } ^ { \prime } ( \text{pop} ) = \{ ( u, i, \mathcal { N } _ { j }, \mathcal { N } _ { k } ) \ | \ \mathcal { N } _ { j } \sim p _ { \text{pop} }, \mathcal { N } _ { k } \sim p _ { \text{unif} } \}, \quad ( 1 0 )$$

$$\mathcal { D } _ { m } ^ { \prime } ( \text{niche} ) = \{ ( u, i, \mathcal { N } _ { j }, \mathcal { N } _ { k } ) \ | \ \mathcal { N } _ { j } \sim p _ { \text{unif} }, \mathcal { N } _ { k } \sim p _ { \text{pop} } \}. \quad ( 1 1 )$$

A corresponding extension for the SSM loss function is given by:

$$\text{red} \quad \text{$\mathcal{Ccomp}} { \text{using extension for use} \, \infty$} \, \text{in some way} \,. \\ \text{fers} \quad \text{$\mathcal{L}_{TransSSM}=-} \sum _ { ( u, i, N _ { j }, N _ { k } ) \in \mathcal { D } _ { m } ^ { \prime } } \left [ \log \frac { \exp ( \hat { s } _ { u i } ) } { \exp ( \hat { s } _ { u i } ) + \sum _ { j \in N _ { j } } \exp ( \hat { s } _ { u j } ) } \\ & + \gamma \frac { 1 } { | N _ { j } | } \sum _ { j \in N _ { j } } \log \frac { \exp ( \hat { s } _ { u j } ) } { \exp ( \hat { s } _ { u j } ) + \sum _ { k \in N _ { k } } \exp ( \hat { s } _ { u k } ) } \right ]. \ ( 1 2 ) \\ \quad \text{$\mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$} \quad \mathcal{.}$}$$

As similar to previous extensions, TransSSMpop and TransSSM niche employs either D ′ 𝑚 ( pop ) or D ′ 𝑚 ( niche ) for negative sampling.

One thing to note is that our introduced sampling strategies D ′ 𝑠 and D ′ 𝑚 are both weak transitive. Nonetheless, modifying them to a strict setting can be readily accomplished if we can quantify the preference of each item. For instance, we can reformulate the mini-batch construction for pairwise and pointwise objectives as:

$$\mathcal { D } _ { s } ^ { \dagger } ( \text{pop} ) = \{ ( u, i, j, k ) \ | \ f ( j ) > f ( k ), j \sim p _ { \text{pop} }, k \sim p _ { \text{unif} } \}, \ ( 1 3 )$$

$$\mathcal { D } _ { s } ^ { \dagger } ( \text{niche} ) = \{ ( u, i, j, k ) \ | \ f ( j ) < f ( k ), j \sim p _ { \text{unif} }, k \sim p _ { \text{pop} } \}, \ ( 1 4 )$$

where 𝑓 (·) denotes a function that measures the popularity of an item. However, we argue that such strict transitivity rather hurts the quality of the resulting recommendation policy.

Table 3: Comparison of our methods with strict transitivity and weak transitivity in the Amazon Beauty dataset.

| Method         |             | HR            | NDCG          |
|----------------|-------------|---------------|---------------|
| TransBPR pop   | Strict Weak | 0.0508        | 0.0229 0.0293 |
|                | Strict      | 0.0674 0.0571 | 0.0252        |
| TransBPR niche | Weak        | 0.0651        | 0.0289        |
| TransBCE pop   | Strict Weak | 0.0697 0.0730 | 0.0311        |
|                |             | 0.0635        | 0.0324        |
| TransBCE niche | Strict      |               | 0.0282        |
|                | Weak        | 0.0720        | 0.0322        |
| TransSSM pop   | Strict      | 0.0631        | 0.0309        |
|                | Weak        | 0.0843        | 0.0395        |
| TransSSM niche | Strict      | 0.0700        | 0.0346        |

## 4 EXPERIMENTS

In this section, we conduct experiments to compare our proposed extensions to original objectives and their variants.

## 4.1 Experimental Setup

Datasets. We employ public sequential recommendation tasks from different domains: Beauty Toys , , and Sports , which are product review datasets introduced by Amazon.com [17], and Yelp , which is a widely tested business recommendation dataset. Detailed statistics of preprocessed datasets are reported in Table 1.

Evaluation Settings and Metrics. For dataset partitioning, we adopt the conventional leave-one-out strategy [13, 23] to assure the quality of the trained recommender system. Then, we recommend 𝐾 items with the highest recommendation scores from the entire item pool. For evaluation, we adopt two common top𝐾 metrics, HR@ 𝐾 and NDCG@ 𝐾 with 𝐾 fixed to 10.

Baselines. We fix a model architecture to SASRec [13] and switch only a training objective. For baselines, we compare our method against BPR [22], GBPR [19], BCE [13], SSM [29], InfoNCE [18], BPRDNS [31], and gBCE [20]. Here, gBCE 1 and gBCE N denote gBCE with a single negative and multiple negatives, respectively.

Hyperparameters. For all objectives, We train with a fixed batch size of 256, a learning rate of 0.0003, and a maximum sequence length of 50. The SASRec model is with 2 layers and 1 attention head with an embedding dimension of 256. For setwise objectives, we sample 100 negatives in total. Our proposed TransSSM sets cardinality of N 𝑗 and N 𝑘 to 50 such that they sum to 100. A balancing coefficient 𝛾 is selected from { 0 5 1 0 1 5 . , . , . } .

## 4.2 Performance Comparison

Table 2 summarizes the performance of models trained with different optimization objectives. In general, our proposed objectives outperform three original objectives and their notable variants in both metrics within all benchmarks. Particularly, we recognize

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00326v1-figure-3740684a-d3dc-4413-9e3c-5ab8e87f3811.jpg)

(a) log 𝜎 𝑥 ( ˆ 𝑢𝑖𝑗 ) of TransBPRpop

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00326v1-figure-8ed4499b-275b-44c0-a0a1-04a225a087d4.jpg)

)

(ˆ

σ xujk log

(b) log 𝜎 𝑥 ( ˆ 𝑢𝑗𝑘 ) of TransBPRpop

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00326v1-figure-6d4e6faf-6d3e-4b62-91f1-495dfcf62c32.jpg)

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00326v1-figure-f7034218-dafe-4eb5-bf56-95cf59b443a5.jpg)

)

(ˆ

σ xujk log

(d)

log

𝜎 𝑥

(

ˆ

𝑢𝑗𝑘

)

of TransBPRniche

Figure 2: Average values of each loss term in TransBPR with Weak (blue), Strict (red), and Disjoint (yellow) transitivity.

TransSSMpop obtain the highest performance among all baselines in all datasets. Such results demonstrate that inducing preference order through weak transitivity consistently improves the performance regardless of base loss functions. Typically, we observe our extensions with popularity preference (e.g., TransSSMpop) achieve commonly improved metrics compared to niche preference (e.g., TransSSMniche ). Hence, exploiting popularity as the preference indicator is particularly effective regardless of datasets. Though, we find recommendations with niche preference performs on par with best-performing baselines or often even better.

## 4.3 Transitivity Analysis

As seen in Table 3, we observe comparatively higher performance with weak transitivity. We hypothesize that the number of uninformative (i.e., easy) negatives [21, 26] increases more within the strict transitivity as training proceeds. To validate the claim, we report how average value of each term in the BPR extension, log 𝜎 𝑥 ( ˆ 𝑢𝑖𝑗 ) and log 𝜎 𝑥 ( ˆ 𝑢𝑗𝑘 ) , changes throughout the training with different schemes. Here, we compare three classes of transitivity: Weak , i.e., (4) and (5), Strict , i.e., (13) and (14), and Disjoint , i.e., a specific case of Strict that sets 50% of total items with high preference as a support for 𝑝 pop and the rest for 𝑝 niche . Results in Figure 2 illustrate more steep decline of the preference term, log 𝜎 𝑥 ( ˆ 𝑢𝑗𝑘 ) , as the transitivity becomes more strict. Thus, weak transitivity provides the most informative gradients, increasing the training effectiveness.

## 5 CONCLUSION

In this work, we identified the common and crucial disadvantage of binary label assignments within conventional recommendation objectives. To overcome this limitation, we have proposed novel extensions that directly exploit the preference differences of unobserved items. Through extensive experiments, we demonstrated the effectiveness of our method with the thorough analysis. As future work, the uniformity of normalized embeddings [6] can be applied to our framework to improve recommendation performance more.

## REFERENCES

- [1] Jianxin Chang, Chen Gao, Yu Zheng, Yiqun Hui, Yanan Niu, Yang Song, Depeng Jin, and Yong Li. 2021. Sequential recommendation with graph neural networks. In Proceedings of the ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR) . ACM, Virtual, 378-387.
- [2] Mengru Chen, Chao Huang, Lianghao Xia, Wei Wei, Yong Xu, and Ronghua Luo. 2023. Heterogeneous graph contrastive learning for recommendation. In Proceedings of the ACM International Conference on Web Search and Data Mining (WSDM) . ACM, Singapore, Singapore, 544-552.
- [3] Ting Chen, Yizhou Sun, Yue Shi, and Liangjie Hong. 2017. On sampling strategies for neural network-based collaborative filtering. In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD) . ACM, Halifax, Nova Scotia, Canada, 767-776.
- [4] Xiao Chen, Wenqi Fan, Jingfan Chen, Haochen Liu, Zitao Liu, Zhaoxiang Zhang, and Qing Li. 2023. Fairly adaptive negative sampling for recommendations. In Proceedings of the Web Conference (WWW) . ACM, Autin, TX, USA, 3723-3733.
- [5] Yongjun Chen, Jia Li, Zhiwei Liu, Nitish Shirish Keskar, Huan Wang, Julian McAuley, and Caiming Xiong. 2022. Generating Negative Samples for Sequential Recommendation. arXiv preprint arXiv:2208.03645 August (2022), 1-11.
- [6] Hyunsoo Chung and Jungtaek Kim. 2023. Leveraging Uniformity of Normalized Embeddings for Sequential Recommendation. In Neural Information Processing Systems Workshop on Self-Supervised Learning - Theory and Practice (SSL-TP) . NeurIPS, New Orleans, LA, USA, 1-9.
- [7] Jingtao Ding, Yuhan Quan, Quanming Yao, Yong Li, and Depeng Jin. 2020. Simplify and robustify negative sampling for implicit collaborative filtering. In Advances in Neural Information Processing Systems (NeurIPS) , Vol. 33. Curran Associates, Virtual, 1094-1105.
- [8] Ziwei Fan, Zhiwei Liu, Yu Wang, Alice Wang, Zahra Nazari, Lei Zheng, Hao Peng, and Philip S Yu. 2022. Sequential recommendation via stochastic self-attention. In Proceedings of the Web Conference (WWW) . ACM, Lyon, France, 2036-2047.
- [9] Ziwei Fan, Zhiwei Liu, Jiawei Zhang, Yun Xiong, Lei Zheng, and Philip S Yu. 2021. Continuous-time sequential recommendation with temporal graph collaborative transformer. In Proceedings of the ACM International Conference on Information and Knowledge Management (CIKM) . ACM, Virtual, 433-442.
- [10] Xiangnan He, Kuan Deng, Xiang Wang, Yan Li, Yongdong Zhang, and Meng Wang. 2020. LightGCN: Simplifying and powering graph convolution network for recommendation. In Proceedings of the ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR) . ACM, Virtual, 639-648.
- [11] José Miguel Hernández-Lobato, Neil Houlsby, and Zoubin Ghahramani. 2014. Probabilistic Matrix Factorization with Non-Random Missing Data. In Proceedings of the International Conference on Machine Learning (ICML) . JMLR, Beijing, China, 1512-1520.
- [12] Balázs Hidasi, Alexandros Karatzoglou, Linas Baltrunas, and Domonkos Tikk. 2016. Session-based recommendations with recurrent neural networks. In Proceedings of the International Conference on Learning Representations (ICLR) . ICLR, San Juan, Puerto Rico, 1-10.
- [13] Wang-Cheng Kang and Julian McAuley. 2018. Self-attentive sequential recommendation. In Proceedings of the IEEE International Conference on Data Mining (ICDM) . IEEE, Singapore, Singapore, 197-206.
- [14] Anton Klenitskiy and Alexey Vasilev. 2023. Turning Dross Into Gold Loss: is BERT4Rec really better than SASRec?. In Proceedings of the ACM International Conference on Recommender Systems (RecSys) . ACM, Singapore, Singapore, 11201125.
- [15] Defu Lian, Qi Liu, and Enhong Chen. 2020. Personalized ranking with importance sampling. In Proceedings of the Web Conference (WWW) . ACM, Taipei, Taiwan, 1093-1103.
- [16] Fan Liu, Zhiyong Cheng, Lei Zhu, Zan Gao, and Liqiang Nie. 2021. Interest-aware message-passing GCN for recommendation. In Proceedings of the Web Conference (WWW) . ACM, Ljubljana, Slovenia, 1296-1305.
- [17] Julian McAuley, Christopher Targett, Qinfeng Shi, and Anton Van Den Hengel. 2015. Image-based recommendations on styles and substitutes. In Proceedings of the ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR) . ACM, Shanghai, China, 43-52.
- [18] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. 2018. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748 July (2018), 1-13.
- [19] Weike Pan and Li Chen. 2013. Gbpr: Group preference based bayesian personalized ranking for one-class collaborative filtering. In Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI) . IJCAI, Beijing, China, 2691-2697.
- [20] Aleksandr Vladimirovich Petrov and Craig Macdonald. 2023. gsasrec: Reducing overconfidence in sequential recommendation trained with negative sampling. In Proceedings of the ACM International Conference on Recommender Systems (RecSys) . ACM, Singapore, Singapore, 116-128.
- [21] Steffen Rendle and Christoph Freudenthaler. 2014. Improving pairwise learning for item recommendation from implicit feedback. In Proceedings of the ACM International Conference on Web Search and Data Mining (WSDM) . ACM, New
- [36] Kun Zhou, Hui Yu, Wayne Xin Zhao, and Ji-Rong Wen. 2022. Filter-enhanced MLP is all you need for sequential recommendation. In Proceedings of the Web Conference (WWW) . ACM, Lyon, France, 2388-2399.

|           | York, NY, USA, 273-282.                                                                                                                                                                                                                                                                                                                                                                                                        |
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [22]      | Steffen Rendle, Christoph Freudenthaler, Zeno Gantner, and Lars Schmidt-Thieme. 2009. BPR: Bayesian personalized ranking from implicit feedback. In Proceed- ings of the Conference on Uncertainty in Artificial Intelligence (UAI) . AUAI Press, Montreal, Quebec, Canada, 452-461.                                                                                                                                           |
| [23]      | Fei Sun, Jun Liu, Jian Wu, Changhua Pei, Xiao Lin, Wenwu Ou, and Peng Jiang. 2019. BERT4Rec: Sequential recommendation with bidirectional encoder repre- sentations from transformer. In Proceedings of the ACM International Conference on Information and Knowledge Management (CIKM) . ACM, Beijing, China, 1441- 1450.                                                                                                     |
| [24]      | Jiaxi Tang and Ke Wang. 2018. Personalized top-n sequential recommendation via convolutional sequence embedding. In Proceedings of the ACM International Conference on Web Search and Data Mining (WSDM) . ACM, Los Angeles, CA, USA, 565-573.                                                                                                                                                                                 |
| [25]      | Jun Wang, Lantao Yu, Weinan Zhang, Yu Gong, Yinghui Xu, Benyou Wang, Peng Zhang, and Dell Zhang. 2017. Irgan: A minimax game for unifying generative and discriminative information retrieval models. In Proceedings of the ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR) . ACM, Tokyo, Japan, 515-524.                                                                                    |
| [26]      | Peifeng Wang, Shuangyin Li, and Rong Pan. 2018. Incorporating gan for nega- tive sampling in knowledge representation learning. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI) . AAAI Press, New Orleans, LA, USA, 2005-2012.                                                                                                                                                                         |
| [27]      | Xiang Wang, Xiangnan He, Meng Wang, Fuli Feng, and Tat-Seng Chua. 2019. Neural Graph Collaborative Filtering. In Proceedings of the ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR) . ACM, Paris, France, 165-174.                                                                                                                                                                           |
| [28]      | Jiancan Wu, Xiang Wang, Fuli Feng, Xiangnan He, Liang Chen, Jianxun Lian, and Xing Xie. 2021. Self-supervised graph learning for recommendation. In Proceed- ings of the ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR) . ACM, Virtual, 726-735.                                                                                                                                            |
| [29]      | Jiancan Wu, Xiang Wang, Xingyu Gao, Jiawei Chen, Hongcheng Fu, and Tianyu Qiu. 2024. On the effectiveness of sampled softmax loss for item recommendation. ACM Transactions on Information Systems 42, 4 (2024), 1-26.                                                                                                                                                                                                         |
| [30]      | Liwei Wu, Shuqing Li, Cho-Jui Hsieh, and James Sharpnack. 2020. SSE-PT: Sequential recommendation via personalized transformer. In Proceedings of the ACM International Conference on Recommender Systems (RecSys) . ACM, Virtual, 328-337.                                                                                                                                                                                    |
| [31]      | Weinan Zhang, Tianqi Chen, Jun Wang, and Yong Yu. 2013. Optimizing top-n collaborative filtering via dynamic negative item sampling. In Proceedings of the ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR) . ACM, Dublin, Ireland, 785-788.                                                                                                                                                  |
| [32]      | Yongqi Zhang, Quanming Yao, Yingxia Shao, and Lei Chen. 2019. NSCaching: simple and efficient negative sampling for knowledge graph embedding. In Inter- national Conference on Data Engineering (ICDE) . IEEE, Chicago, IL, USA, 614-625.                                                                                                                                                                                     |
| [33]      | Chang Zhou, Jianxin Ma, Jianwei Zhang, Jingren Zhou, and Hongxia Yang. 2021. Contrastive learning for debiased candidate generation in large-scale recom- mender systems. In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD) . ACM, Virtual, 3985-3995.                                                                                                                                  |
| [34]      | Huachi Zhou, Qiaoyu Tan, Xiao Huang, Kaixiong Zhou, and Xiaoling Wang. 2021. Temporal augmented graph neural networks for session-based recommendations. In Proceedings of the ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR) . ACM, Virtual, 1798-1802.                                                                                                                                    |
| [35] [36] | Kun Zhou, Hui Wang, Wayne Xin Zhao, Yutao Zhu, Sirui Wang, Fuzheng Zhang, Zhongyuan Wang, and Ji-Rong Wen. 2020. S3-Rec: Self-Supervised Learning for Sequential Recommendation with Mutual Information Maximization. In Pro- ceedings of the ACM International Conference on Information and Knowledge Management (CIKM) . ACM, Virtual, 1893--1902. Kun Zhou, Hui Yu, Wayne Xin Zhao, and Ji-Rong Wen. 2022. Filter-enhanced |
Hyunsoo Chung Jungtaek Kim Hyungeun Jo Hyungwon Choi
Exploiting Preferences in Loss Functions for Sequential Recommendation via Weak Transitivity
A choice of optimization objective is immensely pivotal in the design of a
recommender system as it affects the general modeling process of a user's
intent from previous interactions. Existing approaches mainly adhere to three
categories of loss functions: pairwise, pointwise, and setwise loss functions.
Despite their effectiveness, a critical and common drawback of such objectives
is viewing the next observed item as a unique positive while considering all
remaining items equally negative. Such a binary label assignment is generally
limited to assuring a higher recommendation score of the positive item,
neglecting potential structures induced by varying preferences between other
unobserved items. To alleviate this issue, we propose a novel method that
extends original objectives to explicitly leverage the different levels of
preferences as relative orders between their scores. Finally, we demonstrate
the superior performance of our method compared to baseline objectives.