
Triplet Losses-based Matrix Factorization for Robust
Recommendations
Flavio Giobergia1
1Department of Control and Computer Engineering, Politecnico di Torino, Turin, Italy
Abstract
Much like other learning-based models, recommender systems can be aected by biases in the training data. While typical
evaluation metrics (e.g. hit rate) are not concerned with them, some categories of nal users are heavily aected by these
biases. In this work, we propose using multiple triplet losses terms to extract meaningful and robust representations of users
and items. We empirically evaluate the soundness of such representations through several “bias-aware” evaluation metrics, as
well as in terms of stability to changes in the training set and agreement of the predictions variance w.r.t. that of each user.
Keywords
recommender systems, matrix factorization, contrastive learning
1. Introduction
Recommender systems are a fundamental part of almost
any experience of online users. The possibility of rec-
ommending options tailored to each individual user is
one of the key contributors to the success of many com-
panies and services. The metrics that are commonly
used in literature to evaluate these models (e.g. hit rate)
are typically only concerned with the overall quality of
the model, regardless of the behaviors of such models
on particular partitions of data. This results in recom-
mender systems typically learning the preferences of the
“majority”. This in turn implies a poorer quality of recom-
mendations for users/items that belong to the long tail
of the distribution. In an eort to steer the research fo-
cus to addressing this problem, the EvalRS challenge [
1
].
This challenge, based on the RecList framework [
2
], pro-
poses a recommendation problem with a multi-faceted
evaluation, where the quality of any solution is not only
evaluated in terms of overall performance, but also based
on the results obtained on various partitions of users and
items. In this paper, we present a possible recommender
system that addresses the problem proposed by EvalRS.
The solution is based on matrix factorization by fram-
ing an objective function that aligns users and items in
the same embedding space. The matrices are learned by
minimizing a loss function that includes multiple triplet
losses terms. Dierently from what is typically done (i.e.
aligning an anchor user to a positive and a negative item),
in this work we propose additionally using triplet terms
for users and items separately.
The full extent of the challenge is described in detail in
[
1
]. In short, the goal of the challenge is to recommend
EvalRS at CIKM 2022
"avio.giobergia@polito.it (F. Giobergia)
0000-0001-8806-7979 (F. Giobergia)
©2022 Copyright for this paper by its authors. Use permitted under Creative Commons License
Attribution 4.0 International (CC BY 4.0).
CEUR
Workshop
Proceedings
http://ceur-ws.org
ISSN 1613-0073
CEUR Workshop Proceedings (CEUR-WS.org)
songs to a set of users, given their previous interactions
with other songs. The provided dataset is based on a
subset of the openly available LFM-1b dataset [
3
]. The
source code for the proposed solution has been made
available on GitHub 1.
2. Methodology
In this section we present the proposed methodology,
highlighting the main aspects of interest. No data prepro-
cessing has been applied to the original data, although
some approaches have been attempted (see Section 4).
The proposed methodology, as explained below, allows
ranking all items based on estimated compatibility with
any given user. We produce the nal list of
𝑘
recommen-
dations by stochastically selecting items from the ordered
list of songs, weighting each song with the inverse of its
position in the list.
2.1. Loss definition
Matrix factorization techniques have long been known
to achieve high performance in various recommendation
challenges [
4
]. This approach consists in aligning vec-
tor representations for two separate entities, users and
items (songs, in this case). This alignment task is a recur-
ring one: a commonly adopted approach to solving this
problem is through the optimization of a triplet loss [5].
A triplet loss is a loss that requires identifying an an-
chor point, as well as a positive and a negative point, i.e.
points that should either lie close to (positive) or far from
(negative) the anchor point.
Users and songs can thus be projected to a common
embedding space in a way that users are placed close to
songs they like and away from songs they do not like.
1https://github.com/fgiobergia/CIKM-evalRS-2022
arXiv:2210.12098v1 [cs.IR] 21 Oct 2022