HAPENS: Hardness-Personalized Negative Sampling for Implicit
Collaborative Filtering
Haoxin Liu Yong Shi Qingwei Lin
∗
Pu Zhao
∗
Mirror Xu Dongmei Zhang
Si Qin
shi.yong@microsoft.com qlin@microsoft.com
liuhaoxinthu@gmail.com
mirrorxu@microsoft.com dongmeiz@microsoft.com
puzhao@microsoft.com
Microsoft Bing, Beijing Microsoft Research, Beijing
siqin@microsoft.com
China China
Microsoft Research, Beijing
China
ABSTRACT
For training implicit collaborative fltering (ICF) models, hard neg-
ative sampling (HNS) has become a state-of-the-art solution for ob-
taining negative signals from massive uninteracted items. However,
selecting appropriate hardness levels for personalized recommenda-
tions remains a fundamental, yet underexplored, problem. Previous
HNS works have primarily adjusted the hardness level by tuning
a single hyperparameter. However, applying the same hardness
level to each user is unsuitable due to varying user behavioral char-
acteristics, the quantity and quality of user records, and diferent
consistencies of models’ inductive biases. Moreover, increasing the
number of hyperparameters is not practical due to the massive
number of users. To address this important and challenging prob-
lem, we propose a model-agnostic and practical approach called
hardness-personalized negative sampling (HAPENS). HAPENS
uses a two-stage approach: in stage one, it trains the ICF model
with a customized objective function that optimizes its worst per-
formance on each user’s interacted item set. In stage two, it utilizes
these worst performances as personalized hardness levels with a
well-designed sampling distribution, and trains the fnal model with
the same architecture. We evaluated HAPENS on the collected Bing
advertising dataset and one public dataset, and the comprehensive
experimental results demonstrate its robustness and superiority.
Moreover, HAPENS has delivered signifcant benefts to the Bing
advertising system. To the best of our knowledge, we are the frst
to study this important and challenging problem.
CCS CONCEPTS
• Information systems → Data mining.
KEYWORDS
Personalization; Collaborative Filtering; Negative Sampling;
ACM Reference Format:
Haoxin Liu, Pu Zhao, Si Qin, Yong Shi, Mirror Xu, Qingwei Lin, and Dong-
mei Zhang. 2023. HAPENS: Hardness-Personalized Negative Sampling for
∗
Corresponding author
Permission to make digital or hard copies of part or all of this work for personal or
classroom use is granted without fee provided that copies are not made or distributed
for proft or commercial advantage and that copies bear this notice and the full citation
on the frst page. Copyrights for third-party components of this work must be honored.
For all other uses, contact the owner/author(s).
WWW ’23 Companion, April 30–May 04, 2023, Austin, TX, USA
© 2023 Copyright held by the owner/author(s).
ACM ISBN 978-1-4503-9419-2/23/04.
https://doi.org/10.1145/3543873.3584631
Implicit Collaborative Filtering. In Companion Proceedings of the ACM Web
Conference 2023 (WWW ’23 Companion), April 30–May 04, 2023, Austin, TX,
USA. ACM, New York, NY, USA, 5 pages. https://doi.org/10.1145/3543873.
3584631
1 INTRODUCTION
As a critical technology for personalized recommendation, collab-
orative fltering (CF)[8, 10, 17] learns user preferences through
observed interactions between users and items. Compared to ex-
plicit feedback such as ratings, implicit feedback such as clicks
and purchases are more accessible. In this paper, we focus on im-
plicit CF, which is an important research topic that has received
much attention and is widely applied in real-world recommender
systems[2, 5, 13, 23].
In addition to the natural scarcity of negative signals, efciency
must be ensured due to the massive number of items. Therefore,
real-world recommender systems have widely adopted negative
sampling, which samples a subset of a user’s uninteracted items
based on a certain strategy [6, 21, 23]. Attempts to improve the
quality of negative samples can be mainly grouped into two types.
Static Negative Sampling (SNS)[1, 12] adopts a static distribu-
tion specifed before training. The distribution is based on some
heuristic information, such as the degree of nodes[12]. On the other
hand, Hard Negative Sampling (HNS) [22ś25] replaces the static
distribution with a dynamic distribution that changes during model
training. The goal of HNS is to fnd informative samples that are
intuitively items that are mapped nearby but should be far apart.
As shown in [22ś25], HNS methods signifcantly beneft recom-
mendation performance by enhancing click-through rates
It should be noted that samples that are excessively difcult may
not only produce false negatives, but also impede the training of
the model. Conversely, overly simple samples may not be infor-
mative. As a result, the difculty level is a critical factor for the
efectiveness of HNS but has received insufcient exploration. Pre-
vious HNS methods have primarily adjusted the level of difculty
by tuning a single hyperparameter. However, we argue that the
same difculty level may not be suitable for all users. Factors such
as the quantity and quality of the user’s interacted item set, as
well as the consistency of the model’s inductive bias, will result in
diferent requirements for the level of difculty. The overall optimal
level of difculty may be too difcult or too easy for certain users.
Therefore, it is imperative to propose a solution to the problem of
personalized hard negative sampling (PHNS).
However, the problem of PHNS is far from trivial. It is imprac-
tical to set independent hyperparameters for each user, and even
376