On Sampling Strategies for Neural Network-based Collaborative Filtering

06/23/2017 ∙ by Ting Chen, et al. ∙ Association for Computing Machinery Etsy 0

Recent advances in neural networks have inspired people to design hybrid recommendation algorithms that can incorporate both (1) user-item interaction information and (2) content information including image, audio, and text. Despite their promising results, neural network-based recommendation algorithms pose extensive computational costs, making it challenging to scale and improve upon. In this paper, we propose a general neural network-based recommendation framework, which subsumes several existing state-of-the-art recommendation algorithms, and address the efficiency issue by investigating sampling strategies in the stochastic gradient descent training for the framework. We tackle this issue by first establishing a connection between the loss functions and the user-item interaction bipartite graph, where the loss function terms are defined on links while major computation burdens are located at nodes. We call this type of loss functions "graph-based" loss functions, for which varied mini-batch sampling strategies can have different computational costs. Based on the insight, three novel sampling strategies are proposed, which can significantly improve the training efficiency of the proposed framework (up to × 30 times speedup in our experiments), as well as improving the recommendation performance. Theoretical analysis is also provided for both the computational cost and the convergence. We believe the study of sampling strategies have further implications on general graph-based loss functions, and would also enable more research under the neural network-based recommendation framework.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1. Introduction

Collaborative Filtering (CF) has been one of the most effective methods in recommender systems, and methods like matrix factorization (Koren, 2008; Koren et al., 2009; Salakhutdinov and Mnih, 2011) are widely adopted. However, one of its limitation is the dealing of “cold-start” problem, where there are few or no observed interactions for new users or items, such as in news recommendation. To overcome this problem, hybrid methods are proposed to incorporate side information (Rendle, 2010; Chen et al., 2012; Singh and Gordon, 2008), or item content information (Wang and Blei, 2011; Gopalan et al., 2014) into the recommendation algorithm. Although these methods can deal with side information to some extent, they are not effective for extracting features in complicated data, such as image, audio and text. On the contrary, deep neural networks have been shown very powerful at extracting complicated features from those data automatically (Krizhevsky et al., 2012; Kim, 2014)

. Hence, it is natural to combine deep learning with traditional collaborative filtering for recommendation tasks, as seen in recent studies

(Wang et al., 2015; Bansal et al., 2016; Zheng et al., 2016; Chen et al., 2017).

In this work, we generalize several state-of-the-art neural network-based recommendation algorithms (Van den Oord et al., 2013; Bansal et al., 2016; Chen et al., 2017), and propose a more general framework that combines both collaborative filtering and deep neural networks in a unified fashion. The framework inherits the best of two worlds: (1) the power of collaborative filtering at capturing user preference via their interaction with items, and (2) that of deep neural networks at automatically extracting high-level features from content data. However, it also comes with a price. Traditional CF methods, such as sparse matrix factorization (Salakhutdinov and Mnih, 2011; Koren, 2008), are usually fast to train, while the deep neural networks in general are much more computationally expensive (Krizhevsky et al., 2012). Combining these two models in a new recommendation framework can easily increase computational cost by hundreds of times, thus require a new design of the training algorithm to make it more efficient.

We tackle the computational challenges by first establishing a connection between the loss functions and the user-item interaction bipartite graph. We realize the key issue when combining the CF and deep neural networks are in: the loss function terms are defined over the links, and thus sampling is on links for the stochastic gradient training, while the main computational burdens are located at nodes (e.g., Convolutional Neural Network computation for image of an item). For this type of loss functions, varied mini-batch sampling strategies can lead to different computational costs, depending on how many node computations are required in a mini-batch. The existing stochastic sampling techniques, such as IID sampling, are inefficient, as they do not take into account the node computations that can be potentially shared across links/data points.

Inspired by the connection established, we propose three novel sampling strategies for the general framework that can take coupled computation costs across user-item interactions into consideration. The first strategy is Stratified Sampling, which try to amortize costly node computation by partitioning the links into different groups based on nodes (called stratum), and sample links based on these groups. The second strategy is Negative Sharing, which is based on the observation that interaction/link computation is fast, so once a mini-batch of user-item tuples are sampled, we share the nodes for more links by creating additional negative links between nodes in the same batch. Both strategies have their pros and cons, and to keep their advantages while avoid their weakness, we form the third strategy by combining the above two strategies. Theoretical analysis of computational cost and convergence is also provided.

Our contributions can be summarized as follows.

  • We propose a general hybrid recommendation framework (Neural Network-based Collaborative Filtering) combining CF and content-based methods with deep neural networks, which generalize several state-of-the-art approaches.

  • We establish a connection between the loss functions and the user-item interaction graph, based on which, we propose sampling strategies that can significantly improve training efficiency (up to times faster in our experiments) as well as the recommendation performance of the proposed framework.

  • We provide both theoretical analysis and empirical experiments to demonstrate the superiority of the proposed methods.

2. A General Framework for Neural Network-based Collaborative Filtering

In this section, we propose a general framework for neural network-based Collaborative Filtering that incorporates both interaction and content information.

2.1. Text Recommendation Problem

In this work, we use the text recommendation task (Wang and Blei, 2011; Wang et al., 2015; Bansal et al., 2016; Chen et al., 2017) as an illustrative application for the proposed framework. However, the proposed framework can be applied to more scenarios such as music and video recommendations.

We use and to denote features of user and item , respectively. In text recommendation setting, we set

to one-hot vector indicating

’s user id (i.e. a binary vector with only one at the -th position)111Other user profile features can be included, if available., and as the text sequence, i.e. . A response matrix is used to denote the historical interactions between users and articles, where indicates interaction between a user and an article , such as “click-or-not” and “like-or-not”. Furthermore, we consider as implicit feedback in this work, which means only positive interactions are provided, and non-interactions are treated as negative feedback implicitly.

Given user/item features and their historical interaction , the goal is to learn a model which can rank new articles for an existing user based on this user’s interests and an article’s text content.

2.2. Functional Embedding

In most of existing matrix factorization techniques (Koren, 2008; Koren et al., 2009; Salakhutdinov and Mnih, 2011), each user/item ID is associated with a latent vector or

(i.e., embedding), which can be considered as a simple linear transformation from the one-hot vector represented by their IDs, i.e.

( is the embedding/weight matrix). Although simple, this direct association of user/item ID with representation make it less flexible and unable to incorporate features such as text and image.

In order to effectively incorporate user and item features such as content information, it has been proposed to replace embedding vectors or

with functions such as decision trees

(Zhou et al., 2011) and some specific neural networks (Bansal et al., 2016; Chen et al., 2017). Generalizing the existing work, we propose to replace the original embedding vectors and with general differentiable functions and that take user/item features as their inputs. Since the user/item embeddings are the output vectors of functions, we call this approach Functional Embedding. After embeddings are computed, a score function can be defined based on these embeddings for a user/item pair , such as vector dot product (used in this work), or a general neural network.

Figure 1. The functional embedding framework.

The model framework is shown in Figure 1

. It is easy to see that our framework is very general, as it does not explicitly specify the feature extraction functions, as long as the functions are differentiable. In practice, these function can be specified with neural networks such as CNN or RNN, for extracting high-level information from image, audio, or text sequence. When there are no features associated, it degenerates to conventional matrix factorization where user/item IDs are used as their features.

For simplicity, we will denote the output of and by and , which are the embedding vectors for user and item .

2.3. Loss Functions for Implicit Feedback

In many real-world applications, users only provide positive signals according to their preferences, while negative signals are usually implicit. This is usually referred as “implicit feedback” (Pan et al., 2008; Hu et al., 2008; Rendle et al., 2009). In this work, we consider two types of loss functions that can handle recommendation tasks with implicit feedback, namely, pointwise loss functions and pairwise loss functions.

Pointwise loss
SG-loss (Mikolov and Dean, 2013): -
MSE-loss (Van den Oord et al., 2013):
Pairwise loss
Log-loss (Rendle et al., 2009): -
Hinge-loss (Weimer et al., 2008):
Table 1. Examples of loss functions for recommendation.

Pointwise loss functions have been applied to such problems in many existing work. In (Van den Oord et al., 2013; Wang et al., 2015; Bansal et al., 2016), mean square loss (MSE) has been applied where “negative terms” are weighted less. And skip-gram (SG) loss has been successfully utilized to learn robust word embedding (Mikolov and Dean, 2013).

These two loss functions are summarized in Table 1. Note that we use a weighted expectation term over all negative samples, which can be approximated with small number of samples. We can also abstract the pointwise loss functions into the following form:


where is (empirical) data distribution, is user-defined negative data distribution, is user defined weights for the different user-item pairs, denotes the set of all parameters, denotes the loss function on a single positive pair , and denotes the loss on a single negative pair. Generally speaking, given a user , pointwise loss function encourages her score with positive items , and discourage her score with negative items .

When it comes to ranking problem as commonly seen in implicit feedback setting, some have argued that the pairwise loss would be advantageous (Rendle et al., 2009; Weimer et al., 2008), as pairwise loss encourages ranking of positive items above negative items for the given user. Different from pointwise counterparts, pairwise loss functions are defined on a triplet of , where is a positive item and is a negative item to the user . Table 1 also gives two instances of such loss functions used in existing papers (Rendle et al., 2009; Weimer et al., 2008) (with being the pre-defined “margin” parameter). We can also abstract pairwise loss functions by the following form:


where the notations are similarly defined as in Eq. 1 and denotes the loss function on the triplet .

2.4. Stochastic Gradient Descent Training and Computational Challenges

To train the model, we use stochastic gradient descent based algorithms (Bottou, 2010; Kingma and Ba, 2014), which are widely used for training matrix factorization and neural networks. The main flow of the training algorithm is summarized in Algorithm 1.

  while not converged do
     // mini-batch sampling
     draw a mini-batch of user-item tuples 222Draw a mini-batch of user-item triplets if a pairwise loss function is adopted.
     // forward pass
     compute , and their interaction
     compute the loss function
     // backward pass
     compute gradients and apply SGD updates
  end while
Algorithm 1 Standard model training procedure

By adopting the functional embedding with (deep) neural networks, we can increase the power of the model, but it also comes with a cost. Figure 2 shows the training time (for CiteULike data) with different item functions , namely linear embedding taking item id as feature (equivalent to conventional MF), CNN-based content embedding, and RNN/LSTM-based content embedding. We see orders of magnitude increase of training time for the latter two embedding functions, which may create barriers to adopt models under this framework.

Breaking down the computation cost of the framework, there are three major parts of computational cost. The first part is the user based computation (denoted by time units per user), which includes forward computation of user function , and backward computation of the function output w.r.t. its parameters. The second part is the item based computation (denoted by time units per item), which similarly includes forward computation of item function , as well as the back computation. The third part is the computation for interaction function (denoted by time units per interaction). The total computational cost for a mini-batch is then , with some other minor operations which we assume ignorable. In the text recommendation application, user IDs are used as user features (which can be seen as linear layer on top of the one-hot inputs), (deep) neural networks are used for text sequences, vector dot product is used as interaction function, thus the dominant computational cost is (orders of magnitude larger than and ). In other words, we assume in this work.

Figure 2.

Model training time per epoch with different types of item functions (in log-scale).

3. Mini-Batch Sampling Strategies For Efficient Model Training

In this section, we propose and discuss different sampling strategies that can improve the efficiency of the model training.

3.1. Computational Cost in a Graph View

Before the discussion of different sampling strategies, we motivate our readers by first making a connection between the loss functions and the bipartite graph of user-item interactions. In the loss functions laid out before, we observed that each loss function term in Eq. 1, namely, , involves a pair of user and item, which corresponds to a link in their interaction graph. And two types of links corresponding to two types of loss terms in the loss functions, i.e., positive links/terms and negative links/terms. Similar analysis holds for pairwise loss in Eq. 2, though there are slight differences as each single loss function corresponds to a pair of links with opposite signs on the graph. We can also establish a correspondence between user/item functions and nodes in the graph, i.e., to user node and to item node . The connection is illustrated in Figure 3. Since the loss functions are defined over the links, we name them “graph-based” loss functions to emphasize the connection.

Figure 3. The bipartite interaction graph for pointwise loss functions, where loss functions are defined over links. The pairwise loss functions are defined over pairs of links.

The key observation for graph-based loss functions is that: the loss functions are defined over links, but the major computational burden are located at nodes (due to the use of costly function). Since each node is associated with multiple links, which are corresponding to multiple loss function terms, the computational costs of loss functions over links are coupled (as they may share the same nodes) when using mini-batch based SGD. Hence, varied sampling strategies yield different computational costs. For example, when we put links connected to the same node together in a mini-batch, the computational cost can be lowered as there are fewer to compute333This holds for both forward and backward computation. For the latter, the gradient from different links can be aggregated before back-propagating to .. This is in great contrast to conventional optimization problems, where each loss function term dose not couple with others in terms of computation cost.

(a) Negative
(b) Stratified (by Items)
(c) Negative Sharing
(d) Stratified with N.S.
Figure 4. Illustration of four different sampling strategies. 3(b)-3(d) are the proposed sampling strategies. Red lines denote positive links/interactions, and black lines denote negative links/interactions.

3.2. Existing Mini-Batch Sampling Strategies

In standard SGD sampler, (positive) data samples are drawn uniformly at random for gradient computation. Due to the appearance of negative samples, we draw negative samples from some predefined probability distribution, i.e.

. We call this approach “IID Sampling”, since each positive link is dependently and identical distributed, and the same holds for negative links (with a different distribution).

Many existing algorithms with graph-based loss functions (Mikolov and Dean, 2013; Tang et al., 2015; Bansal et al., 2016) adopt the “Negative Sampling” strategy, in which negative samples are drawn whenever a positive example is drawn. The negative samples are sampled based on the positive ones by replacing the items in the positive samples. This is illustrated in Algorithm 2 and Figure 3(a).

  Require: number of positive links in a mini-batch , number of negative links per positive one:
  draw positive links uniformly at random
  for each of positive links do
     draw negative links by replacing true item with
  end for
Algorithm 2 Negative Sampling (Mikolov et al., 2013; Tang et al., 2015; Bansal et al., 2016)

The IID Sampling strategy dose not take into account the property of graph-based loss functions, since samples are completely independent of each other. Hence, the computational cost in a single mini-batch cannot be amortized across different samples, leading to very extensive computations with (deep) neural networks. The Negative Sampling does not really help, since the item function computation cost is the dominant one. To be more specific, consider a mini-batch with links sampled by IID Sampling or Negative Sampling, we have to conduct item based computation times, since items in a mini-batch are likely to be non-overlapping with sufficient large item sets.

3.3. The Proposed Sampling Strategies

3.3.1. Stratified Sampling (by Items)

Motivated by the connection between the loss functions and the bipartite interaction graph as shown in Figure 3, we propose to sample links that share nodes, in particular those with high computational cost (i.e. for item function in our case). By doing so, the computational cost within a mini-batch can be amortized, since fewer costly functions are computed (in both forward and backward propagations).

In order to achieve this, we (conceptually) partition the links, which correspond to loss function terms, into strata. A stratum in the strata is a set of links on the bipartite graph sharing the same source or destination node. Instead of drawing links directly for training, we will first draw stratum and then draw both positive and negative links. Since we want each stratum to share the same item, we can directly draw an item and then sample its links. The details are given in Algorithm 3 and illustrated in Figure 3(b).

  Require: number of positive links in a mini-batch: , number of positive links per stratum: , number of negative links per positive one:
     draw an item
     draw positive users of uniformly at random
     draw negative users
  until a mini-batch of positive links are sampled
Algorithm 3 Stratified Sampling (by Items)

Compared to Negative Sampling in Algorithm 2, there are several differences: (1) Stratified Sampling can be based on either item or user, but in the negative sampling only negative items are drawn; and (2) each node in stratified sampling can be associated with more than 1 positive link (i.e., , which can help improve the speedup as shown below), while in negative sampling each node is only associated with one positive link.

Now we consider its speedup for a mini-batch including positive links/interactions and negative ones, which contains users and items. The Stratified Sampling (by Items) only requires computations of functions, while the Negative Sampling requires computations. Assuming , i.e. the computation cost is dominated by the item function , the Stratified Sampling (by Items) can provide times speedup in a mini-batch. With as used in some of our experiments, it yields to speedup optimally. However, it is worth pointing out that item-based Stratified Sampling cannot be applied to pairwise loss functions, which compare preferences over items based on a given user.

3.3.2. Negative Sharing

The idea of Negative Sharing is inspired from a different aspect of the connection between the loss functions and the bipartite interaction graph. Since , i.e. the computational cost of interaction function (dot product) is ignorable compared to that of item function, when a mini-batch of users and items are sampled, increasing the number of interactions among them may not result in a significant increase of computational cost. This can be achieved by creating a complete bipartite graph for a mini-batch by adding negative links between all non-interaction pairs between users and items. Using this strategy, we can draw NO negative links at all!

More specifically, consider the IID Sampling, when positive links are sampled, there will be users and items involved (assuming the sizes of user set and item set are much larger than ). Note that, there are non-interactions in the mini-batch, which are not considered in IID Sampling or Negative Sampling, instead they draw additional negative samples. Since the main computational cost of training is on the node computation and the node set is fixed given the batch of positive links, we can share the nodes for negative links without increasing much of computational burdens. Based on this idea, Algorithm 4 summarizes an extremely simple sampling procedure, and it is illustrated in Figure 3(c).

  Require: number of positive links in a mini-batch:
  draw positive user-item pairs uniformly at random
  construct negative pairs by connecting non-linked users and items in the batch
Algorithm 4 Negative Sharing

Since Negative Sharing avoids sampling negative links, it only contains items while in Negative Sampling contains items. So it can provide times speedup compared to Negative Sampling (assuming , and total interaction cost is still insignificant). Given the batch size is usually larger than (e.g., in our experiments), much more negative links (e.g. ) will also be considered, this is helpful for both faster convergence and better performance, which is shown in our experiments. However, as the number of negative samples increases, the performance and the convergence will not be improved linearly. diminishing return is expected.

3.3.3. Stratified Sampling with Negative Sharing

The two strategies above can both reduce the computational cost by smarter sampling of the mini-batch. However, they both have weakness: Stratified Sampling cannot deal with pairwise loss and it is still dependent on the number of negative examples , and Negative Sharing introduces a lot of negative samples which may be unnecessary due to diminishing return.

The good news is, the two sampling strategies are proposed from different perspectives, and combining them together can preserve their advantages while avoid their weakness. This leads to the Stratified Sampling with Negative Sharing, which can be applied to both pointwise and pairwise loss functions, and it can have flexible ratio between positive and negative samples (i.e. more positive links given the same negative links compared to Negative Sharing). To do so, basically we sample positive links according to Stratified Sampling, and then sample/create negative links by treating non-interactions as negative links. The details are given in Algorithm 5 and illustrated in Figure 3(d).

  Require: number of positive links in a mini-batch: , number of positive links per stratum:
     draw an item
     draw positive users of item uniformly at random
  until a mini-batch of items are sampled
  construct negative pairs by connecting non-linked users and items in the batch
Algorithm 5 Stratified Sampling with Negative Sharing

Computationally, Stratified Sampling with Negative Sharing only involve item nodes in a mini-batch, so it can provide the same times speedup over Negative Sampling as Stratified Sampling (by Items) does, but it will utilize much more negative links compared to Negative Sampling. For example, in our experiments with , we have negative links per positive one, much larger than in Negative Sampling, and only requires times of computations compared to Negative Sharing.


Sampling # pos. links # neg. links # # # pointwise pairwise
IID (Bottou, 2010) vec
Negative (Mikolov et al., 2013; Tang et al., 2015; Bansal et al., 2016) vec
Stratified (by Items) vec
Negative Sharing mat
Stratified with N.S. mat


Table 2. Computational cost analysis for a batch of positive links. We use vec to denote vector multiplication, and mat to denote matrix multiplication. Since in practice, the theoretical speedup per iteration can be approximated by comparing the number of computation, which is colored red below. The number of iterations to reach a referenced loss is related to the number of negative links in each mini-batch.

3.3.4. Implementation Details

When the negative/noise distribution is not unigram444Unigram means proportional to item frequency, such as node degree in user-item interaction graph., we need to adjust the loss function in order to make sure the stochastic gradient is unbiased. For pointwise loss, each of the negative term is adjusted by multiplying a weight of ; for pairwise loss, each term based on a triplet of is adjusted by multiplying a weight of where is the sampled negative item.

Instead of sampling, we prefer to use shuffling as much as we can, which produces unbiased samples while yielding zero variance. This can be a useful trick for achieving better performance when the number of drawn samples are not large enough for each loss terms. For IID and Negative Sampling, this can be easily done for positive links by simply shuffling them. As for the Stratified Sampling (w./wo. Negative Sharing), instead of shuffling the positive links directly, we shuffle the randomly formed strata (where each stratum contains roughly a single item)

555This can be done by first shuffling users associated with each item, and then concatenating all links according to items in random order, random strata is then formed by segmenting the list.. All other necessary sampling operations required are sampling from discrete distributions, which can be done in with Alias method.

In Negative Sharing (w./wo. Stratified Sampling), We can compute the user-item interactions with more efficient operator, i.e. replacing the vector dot product between each pair of with matrix multiplication between , where , . Since matrix multiplication is higher in BLAS level than vector multiplication (Ji et al., 2016), even we increase the number of interactions, with medium matrix size (e.g. 1000 1000) it does not affect the computational cost much in practice.

3.4. Computational Cost and Convergence Analysis

Here we provide a summary for the computational cost for different sampling strategies discussed above, and also analyze their convergences. Two aspects that can lead to speedup are analyzed: (1) the computational cost for a mini-batch, i.e. per iteration, and (2) the number of iterations required to reach some referenced loss.

3.4.1. Computational Cost

To fairly compare different sampling strategies, we fix the same number of positive links in each of the mini-batch, which correspond to the positive terms in the loss function. Table 2 shows the computational cost of different sampling strategies for a given mini-batch. Since in practice, we approximate the theoretical speedup per iteration by comparing the number of computation. We can see that the proposed sampling strategies can provide , by Negative Sharing, or , by Stratified Sampling (w./w.o. Negative Sharing), times speedup for each iteration compared to IID Sampling or Negative Sampling. As for the number of iterations to reach a reference loss, it is related to number of negative samples utilized, which is analyzed below.

3.4.2. Convergence Analysis

We want to make sure the SGD training under the proposed sampling strategies can converge correctly. The necessary condition for this to hold is the stochastic gradient estimator has to be unbiased, which leads us to the following lemma.

Lemma 1 ().

(unbiased stochastic gradient) Under sampling Algorithm 2, 3, 4, and 5, we have . In other words, the stochastic mini-batch gradient equals to true gradient in expectation.

This holds for both pointwise loss and pairwise loss. It is guaranteed since we draw samples stochastically and re-weight certain samples accordingly. The detailed proof can be found in the supplementary material.

Given this lemma, we can further analyze the convergence behavior of the proposed sampling behaviors. Due to the highly non-linear and non-convex functions composed by (deep) neural networks, the convergence rate is usually difficult to analyze. So we show the SGD with the proposed sampling strategies follow a local convergence bound (similar to (Ghadimi and Lan, 2013; Reddi et al., 2016)).

Proposition 1 ().

(local convergence) Suppose has -bounded gradient; let where , and is the minimizer to . Then, the following holds for the proposed sampling strategies given in Algorithm 2, 3, 4, 5

The detailed proof is also given in the supplementary material.

Furthermore, utilizing more negative links in each mini-batch can lower the expected stochastic gradient variance. As shown in (Zhao and Zhang, 2014, 2015), the reduction of variance can lead to faster convergence. This suggests that Negative Sharing (w./wo. Stratified Sampling) has better convergence than the Stratified Sampling (by Items).

4. Experiments

4.1. Data Sets

Two real-world text recommendation data sets are used for the experiments. The first data set CiteULike, collected from CiteULike.org, is provided in (Wang and Blei, 2011). The CiteULike data set contains users bookmarking papers, where each paper is associated with a title and an abstract. The second data set is a random subset of Yahoo! News data set 666https://webscope.sandbox.yahoo.com/catalog.php?datatype=r&did=75, which contains users clicking on news presented at Yahoo!. There are 5,551 users and 16,980 items, and total of 204,986 positive interactions in CiteULike data. As for Yahoo! News data, there are 10,000 users, 58,579 items and 515,503 interactions.

Following (Chen et al., 2017), we select a portion (20%) of items to form the pool of test items. All user interactions with those test items are held-out during training, only the remaining user-item interactions are used as training data, which simulates the scenarios for recommending newly-emerged text articles.

4.2. Experimental Settings

The main purpose of experiments is to compare the efficiency and effectiveness of our proposed sampling strategies against existing ones. So we mainly compare Stratified Sampling, Negative Sharing, and Stratified Sampling with Negative Sharing, against IID sampling and Negative Sampling. It is worth noting that several existing state-of-the-art models (Van den Oord et al., 2013; Bansal et al., 2016; Chen et al., 2017) are special cases of our framework (e.g. using MSE-loss/Log-loss with CNN or RNN), so they are compared to other loss functions under our framework.

Evaluation Metrics

For recommendation performance, we follow (Wang et al., 2015; Bansal et al., 2016) and use recall@M. As pointed out in (Wang et al., 2015), the precision is not a suitable performance measure since non interactions may be due to (1) the user is not interested in the item, or (2) the user does not pay attention to its existence. More specifically, for each user, we rank candidate test items based on the predicted scores, and then compute recall@M based on the list. Finally the recall@M is averaged over all users.

As for the computational cost, we mainly measure it in three dimensions: the training time for each iteration (or epoch equivalently, since batch size is fixed for all methods), the number of iterations needed to reach a referenced loss, and the total amount of computation time needed to reach the same loss. In our experiments, we use the smallest loss obtained by IID sampling in the maximum 30 epochs as referenced loss. Noted that all time measure mentioned here is in Wall Time.

Parameter Settings

The key parameters are tuned with validation set, while others are simply set to reasonable values. We adopt Adam (Kingma and Ba, 2014) as the stochastic optimizer. We use the same batch size for all sampling strategies, we use the number of positive link per sampled stratum , learning rate is set to 0.001 for MSE-loss, and 0.01 for others. is set to 0.1 for Hinge-loss, and 10 for others. is set to 8 for MSE-loss, and 128 for others. We set number of negative examples for convolutional neural networks, and for RNN/LSTM due to the GPU memory limit. All experiments are run with Titan X GPUs. We use unigram noise/negative distribution.

For CNN, we adopt the structure similar in (Kim, 2014), and use 50 filters with filter size of 3. Regularization is added using both weight decay on user embedding and dropout on item embedding. For RNN, we use LSTM (Hochreiter and Schmidhuber, 1997) with 50 hidden units. For both models, the dimensions of user and word embedding are set to 50. Early stop is utilized, and the experiments are run to maximum 30 epochs.

4.3. Speedup Under Different Sampling Strategies

CiteULike News
Model Sampling Per it. # of it. Total Per it. # of it. Total
CNN Negative 1.02 1.00 1.02 1.03 1.03 1.06
Stratified 8.83 0.97 8.56 6.40 0.97 6.20
N.S. 8.42 2.31 19.50 6.54 2.21 14.45
Strat. w. N.S. 15.53 1.87 29.12 11.49 2.17 24.98
LSTM Negative 0.99 0.96 0.95 1.0 1.25 1.25
Stratified 3.1 0.77 2.38 3.12 1.03 3.22
N.S. 2.87 2.45 7.03 2.78 4.14 11.5
Strat. w. N.S. 3.4 2.22 7.57 3.13 3.32 10.41
Table 3. Comparisons of speedup for different sampling strategies against IID Sampling: per iteration, # of iteration, and total speedup.
(a) Citeulike (epoch)
(b) Citeulike (wall time)
(c) News (epoch)
(d) News (wall time)
Figure 5. Training loss curves (all methods have the same number of positive samples in a mini-batch)
(a) Citeulike (epoch)
(b) Citeulike (wall time)
(c) News (epoch)
(d) News (wall time)
Figure 6. Test performance/recall curves (all methods have the same number of positive samples in a mini-batch).

Table 3 breaks down the speedup into (1) speedup for training on a given mini-batch, (2) number of iterations (to reach referenced cost) speedup, and (3) the total speedup, which is product of the first two. Different strategies are compared against IID Sampling. It is shown that Negative Sampling has similar computational cost as IID Sampling, which fits our projection. All three proposed sampling strategies can significantly reduce the computation cost within a mini-batch. Moreover, the Negative Sharing and Stratified Sampling with Negative Sharing can further improve the convergence w.r.t. the number of iterations, which demonstrates the benefit of using larger number of negative examples.

Figure 5 and 6 shows the convergence curves of both loss and test performance for different sampling strategies (with CNN + SG-loss). In both figures, we measure progress every epoch, which is equivalent to a fixed number of iterations since all methods have the same batch size . In both figures, we can observe mainly two types of convergences behavior. Firstly, in terms of number of iterations, Negative Sharing (w./wo. Stratified Sampling) converge fastest, which attributes to the number of negative samples used. Secondly, in terms of wall time, Negative Sharing (w./wo. Stratified Sampling) and Stratified Sampling (by Items) are all significantly faster than baseline sampling strategies, i.e. IID Sampling and Neagtive Sampling. It is also interesting to see that that overfitting occurs earlier as convergence speeds up, which does no harm as early stopping can be used.

For Stratified Sampling (w./wo. negative sharing), the number of positive links per stratum can also play a role to improve speedup as we analyzed before. As shown in Figure 7, the convergence time as well as recommendation performance can both be improved with a reasonable , such as 4 or 8 in our case.

(a) Loss (Stratified)
(b) Loss (Stratified with N.S.)
(c) Recall (Stratified)
(d) Recall (Stratified with N.S.)
Figure 7. The number of positive links per stratum VS loss and performance.

4.4. Recommendation Performance Under Different Sampling Strategies

It is shown in above experiments that the proposed sampling strategies are significantly faster than the baselines. But we would also like to further access the recommendation performance by adopting the proposed strategies.

Table 4 compares the proposed sampling strategies with CNN/RNN models and four loss functions (both pointwise and pairwise). We can see that IID Sampling, Negative Sampling and Stratified Sampling (by Items) have similar recommendation performances, which is expected since they all utilize same amount of negative links. For Negative Sharing and Stratified Sampling with Negative Sharing, since there are much more negative samples utilized, their performances are significantly better. We also observe that the current recommendation models based on MSE-loss (Van den Oord et al., 2013; Bansal et al., 2016) can be improved by others such as SG-loss and pairwise loss functions (Chen et al., 2017).

CiteULike News
Model Sampling SG-loss MSE-loss Hinge-loss Log-loss SG-loss MSE-loss Hinge-loss Log-loss
CNN IID 0.4746 0.4437 - - 0.1091 0.0929 - -
Negative 0.4725 0.4408 0.4729 0.4796 0.1083 0.0956 0.1013 0.1009
Stratified 0.4761 0.4394 - - 0.1090 0.0913 - -
Negative Sharing 0.4866 0.4423 0.4794 0.4769 0.1131 0.0968 0.0909 0.0932
Stratified with N.S. 0.4890 0.4535 0.4790 0.4884 0.1196 0.1043 0.1059 0.1100
LSTM IID 0.4479 0.4718 - - 0.0971 0.0998 - -
Negative 0.4371 0.4668 0.4321 0.4540 0.0977 0.0977 0.0718 0.0711
Stratified 0.4344 0.4685 - - 0.0966 0.0996 - -
Negative Sharing 0.4629 0.4839 0.4605 0.4674 0.1121 0.0982 0.0806 0.0862
Stratified with N.S. 0.4742 0.4877 0.4703 0.4730 0.1051 0.1098 0.1017 0.1002
Table 4. Recall@50 for different sampling strategies under different models and losses.

To further investigate the superior performance brought by Negative Sharing. We study the number of negative examples and the convergence performance. Figure 8 shows the test performance against various . As shown in the figure, we observe a clear diminishing return in the improvement of performance. However, the performance seems still increasing even we use 20 negative examples, which explains why our proposed method with negative sharing can result in better performance.

(a) CiteULike
(b) News
Figure 8. The number of negatives VS performances.

5. Related Work

Collaborative filtering (Koren et al., 2009) has been one of the most effective methods in recommender systems, and methods like matrix factorization (Koren, 2008; Salakhutdinov and Mnih, 2011) are widely adopted. While many papers focus on the explicit feedback setting such as rating prediction, implicit feedback is found in many real-world scenarios and studied by many papers as well (Pan et al., 2008; Hu et al., 2008; Rendle et al., 2009). Although collaborative filtering techniques are powerful, they suffer from the so-called “cold-start” problem since side/content information is not well leveraged. To address the issue and improve performance, hybrid methods are proposed to incorporate side information (Singh and Gordon, 2008; Rendle, 2010; Zhou et al., 2011; Chen et al., 2012; Chen and Sun, 2017), as well as content information (Wang and Blei, 2011; Gopalan et al., 2014; Wang et al., 2015; Chen et al., 2017).

Deep Neural Networks (DNNs) have been showing extraordinary abilities to extract high-level features from raw data, such as video, audio, and text (Collobert et al., 2011; Kim, 2014; Zhang et al., 2015)

. Compared to traditional feature detectors, such as SIFT and n-grams, DNNs and other embedding methods

(Tang et al., 2015; Chen et al., 2016; Chen and Sun, 2017) can automatically extract better features that produce higher performance in various tasks. To leverage the extraordinary feature extraction or content understanding abilities of DNNs for recommender systems, recent efforts are made in combining collaborative filtering and neural networks (Van den Oord et al., 2013; Wang et al., 2015; Bansal et al., 2016; Chen et al., 2017). (Wang et al., 2015)

adopts autoencoder for extracting item-side text information for article recommendation,

(Bansal et al., 2016) adopts RNN/GRU to better understand the text content. (Chen et al., 2017) proposes to use CNN and pairwise loss functions, and also incorporate unsupervised text embedding. The general functional embedding framework in this work subsumes existing models (Van den Oord et al., 2013; Bansal et al., 2016; Chen et al., 2017).

Stochastic Gradient Descent (Bottou, 2010) and its variants (Kingma and Ba, 2014)

have been widely adopted in training machine learning models, including neural networks. Samples are drawn uniformly at random (IID) so that the stochastic gradient vector equals to the true gradient in expectation. In the setting where negative examples are overwhelming, such as in word embedding (e.g., Word2Vec

(Mikolov and Dean, 2013)) and network embedding (e.g., LINE (Tang et al., 2015)) tasks, negative sampling is utilized. Recent efforts have been made to improve SGD convergence by (1) reducing the variance of stochastic gradient estimator, or (2) distributing the training over multiple workers. Several sampling techniques, such as stratified sampling (Zhao and Zhang, 2014) and importance sampling (Zhao and Zhang, 2015) are proposed to achieve the variance reduction. Different from their work, we improve sampling strategies in SGD by reducing the computational cost of a mini-batch while preserving, or even increasing, the number of data points in the mini-batch. Sampling techniques are also studied in (Gemulla et al., 2011; Zhuang et al., 2013) to distribute the computation of matrix factorization, their objectives in sampling strategy design are reducing the parameter overlapping and cache miss. We also find that the idea of sharing negative examples is exploited to speed up word embedding training in (Ji et al., 2016).

6. Discussions

While it is discussed under content-based collaborative filtering problem in this work, the study of sampling strategies for “graph-based” loss functions have further implications. The IID sampling strategy is simple and popular for SGD-based training, since the loss function terms usually do not share the common computations. So no matter how a mini-batch is formed, it almost bears the same amount of computation. This assumption is shattered by models that are defined under graph structure, with applications in social and knowledge graph mining

(Bordes et al., 2013), image caption ranking (Lin and Parikh, 2016), and so on. For those scenarios, we believe better sampling strategies can result in much faster training than that with IID sampling.

We would also like to point out limitations of our work. The first one is the setting of implicit feedback. When the problem is posed under explicit feedback, Negative Sharing can be less effective since the constructed negative samples may not overlap with the explicit negative ones. The second one is the assumption of efficient computation for interaction functions. When we use neural networks as interaction functions, we may need to consider constructing negative samples more wisely for Negative Sharing as it will also come with a noticeable cost.

7. Conclusions and Future Work

In this work, we propose a hybrid recommendation framework, combining conventional collaborative filtering with (deep) neural networks. The framework generalizes several existing state-of-the-art recommendation models, and embody potentially more powerful ones. To overcome the high computational cost brought by combining “cheap” CF with “expensive” NN, we first establish the connection between the loss functions and the user-item interaction bipartite graph, and then point out the computational costs can vary with different sampling strategies. Based on this insight, we propose three novel sampling strategies that can significantly improve the training efficiency of the proposed framework, as well as the recommendation performance.

In the future, there are some promising directions. Firstly, based on the efficient sampling techniques of this paper, we can more efficiently study different neural networks and auxiliary information for building hybrid recommendation models. Secondly, we can also study the effects of negative sampling distributions and its affect on the design of more efficient sampling strategies. Lastly but not least, it would also be interesting to apply our sampling strategies in a distributed training environments where multi-GPUs and multi-machines are considered.


The authors would like to thank anonymous reviewers for helpful suggestions. The authors would also like to thank NVIDIA for the donation of one Titan X GPU. This work is partially supported by NSF CAREER #1741634.


  • (1)
  • Bansal et al. (2016) Trapit Bansal, David Belanger, and Andrew McCallum. 2016. Ask the GRU: Multi-task Learning for Deep Text Recommendations. In RecSys’16. 107–114.
  • Bordes et al. (2013) Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. In NIPS’13. 2787–2795.
  • Bottou (2010) Léon Bottou. 2010. Large-scale machine learning with stochastic gradient descent. In COMPSTAT’2010. Springer, 177–186.
  • Chen et al. (2017) Ting Chen, Liangjie Hong, Yue Shi, and Yizhou Sun. 2017. Joint Text Embedding for Personalized Content-based Recommendation. In arXiv preprint arXiv:1706.01084.
  • Chen and Sun (2017) Ting Chen and Yizhou Sun. 2017. Task-Guided and Path-Augmented Heterogeneous Network Embedding for Author Identification. In WSDM’17. 295–304.
  • Chen et al. (2016) Ting Chen, Lu-An Tang, Yizhou Sun, Zhengzhang Chen, and Kai Zhang. 2016.

    Entity Embedding-based Anomaly Detection for Heterogeneous Categorical Events. In

    IJCAI’16. Miami.
  • Chen et al. (2012) Tianqi Chen, Weinan Zhang, Qiuxia Lu, Kailong Chen, Zhao Zheng, and Yong Yu. 2012. SVDFeature: a toolkit for feature-based collaborative filtering. Journal of Machine Learning Research 13, Dec (2012), 3619–3622.
  • Collobert et al. (2011) Ronan Collobert, Jason Weston, Léon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel Kuksa. 2011. Natural language processing (almost) from scratch. Journal of Machine Learning Research 12, Aug (2011), 2493–2537.
  • Gemulla et al. (2011) Rainer Gemulla, Erik Nijkamp, Peter J Haas, and Yannis Sismanis. 2011. Large-scale matrix factorization with distributed stochastic gradient descent. In KDD’11. 69–77.
  • Ghadimi and Lan (2013) Saeed Ghadimi and Guanghui Lan. 2013. Stochastic first-and zeroth-order methods for nonconvex stochastic programming. SIAM Journal on Optimization 23, 4 (2013), 2341–2368.
  • Gopalan et al. (2014) Prem K Gopalan, Laurent Charlin, and David Blei. 2014. Content-based recommendations with poisson factorization. In NIPS’14. 3176–3184.
  • Hochreiter and Schmidhuber (1997) Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation 9, 8 (1997), 1735–1780.
  • Hu et al. (2008) Yifan Hu, Yehuda Koren, and Chris Volinsky. 2008. Collaborative filtering for implicit feedback datasets. In ICDM’08. 263–272.
  • Ji et al. (2016) Shihao Ji, Nadathur Satish, Sheng Li, and Pradeep Dubey. 2016. Parallelizing word2vec in shared and distributed memory. arXiv preprint arXiv:1604.04661 (2016).
  • Kim (2014) Yoon Kim. 2014. Convolutional neural networks for sentence classification. arXiv preprint arXiv:1408.5882 (2014).
  • Kingma and Ba (2014) Diederik Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980 (2014).
  • Koren (2008) Yehuda Koren. 2008. Factorization meets the neighborhood: a multifaceted collaborative filtering model. In KDD’08. 426–434.
  • Koren et al. (2009) Yehuda Koren, Robert Bell, Chris Volinsky, et al. 2009. Matrix factorization techniques for recommender systems. Computer 42, 8 (2009), 30–37.
  • Krizhevsky et al. (2012) Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. 2012. Imagenet classification with deep convolutional neural networks. In NIPS’12. 1097–1105.
  • Lin and Parikh (2016) Xiao Lin and Devi Parikh. 2016. Leveraging visual question answering for image-caption ranking. In ECCV’16. Springer, 261–277.
  • Mikolov et al. (2013) Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781 (2013).
  • Mikolov and Dean (2013) T Mikolov and J Dean. 2013. Distributed representations of words and phrases and their compositionality. NIPS’13 (2013).
  • Pan et al. (2008) Rong Pan, Yunhong Zhou, Bin Cao, Nathan N Liu, Rajan Lukose, Martin Scholz, and Qiang Yang. 2008. One-class collaborative filtering. In ICDM’08. 502–511.
  • Reddi et al. (2016) Sashank J Reddi, Ahmed Hefny, Suvrit Sra, Barnabas Poczos, and Alex Smola. 2016. Stochastic Variance Reduction for Nonconvex Optimization. In ICML’16. 314–323.
  • Rendle (2010) Steffen Rendle. 2010. Factorization machines. In ICDM’10. 995–1000.
  • Rendle et al. (2009) Steffen Rendle, Christoph Freudenthaler, Zeno Gantner, and Lars Schmidt-Thieme. 2009. BPR: Bayesian personalized ranking from implicit feedback. In UAI’09. AUAI Press, 452–461.
  • Salakhutdinov and Mnih (2011) Ruslan Salakhutdinov and Andriy Mnih. 2011. Probabilistic matrix factorization. In NIPS’11, Vol. 20. 1–8.
  • Singh and Gordon (2008) Ajit P Singh and Geoffrey J Gordon. 2008. Relational learning via collective matrix factorization. In KDD’08. 650–658.
  • Tang et al. (2015) Jian Tang, Meng Qu, Mingzhe Wang, Ming Zhang, Jun Yan, and Qiaozhu Mei. 2015. Line: Large-scale information network embedding. In WWW’15. 1067–1077.
  • Van den Oord et al. (2013) Aaron Van den Oord, Sander Dieleman, and Benjamin Schrauwen. 2013. Deep content-based music recommendation. In NIPS’13. 2643–2651.
  • Wang and Blei (2011) Chong Wang and David M Blei. 2011. Collaborative topic modeling for recommending scientific articles. In KDD’11. 448–456.
  • Wang et al. (2015) Hao Wang, Naiyan Wang, and Dit-Yan Yeung. 2015. Collaborative deep learning for recommender systems. In KDD’15. 1235–1244.
  • Weimer et al. (2008) Markus Weimer, Alexandros Karatzoglou, and Alex Smola. 2008. Improving maximum margin matrix factorization. Machine Learning 72, 3 (2008), 263–276.
  • Zhang et al. (2015) Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In NIPS’15. 649–657.
  • Zhao and Zhang (2014) Peilin Zhao and Tong Zhang. 2014. Accelerating minibatch stochastic gradient descent using stratified sampling. arXiv preprint arXiv:1405.3080 (2014).
  • Zhao and Zhang (2015) Peilin Zhao and Tong Zhang. 2015. Stochastic Optimization with Importance Sampling for Regularized Loss Minimization. In ICML’15. 1–9.
  • Zheng et al. (2016) Yin Zheng, Bangsheng Tang, Wenkui Ding, and Hanning Zhou. 2016. A Neural Autoregressive Approach to Collaborative Filtering. In ICML’16. 764–773.
  • Zhou et al. (2011) Ke Zhou, Shuang-Hong Yang, and Hongyuan Zha. 2011. Functional matrix factorizations for cold-start recommendation. In SIGIR’11. 315–324.
  • Zhuang et al. (2013) Yong Zhuang, Wei-Sheng Chin, Yu-Chin Juan, and Chih-Jen Lin. 2013. A fast parallel SGD for matrix factorization in shared memory systems. In Recsys. 249–256.

Supplementary Material

Appendix A Proofs

Here we give the proofs for both the lemma and the proposition introduced in the main paper. For brevity, throughout we assume by default the loss function is the pointwise loss of Eq. (1) in the main paper. Proofs are only given for the pointwise loss, but it can be similarly derived for the pairwise loss. We start by first introducing some definitions.

Definition 1 ().

A function is - if there is a constant such that

Such an assumption is very common in the analysis of first-order methods. In the following proof, we assume any loss functions is -.

Property 1 ().

(Quadratic Upper Bound) A - function has the following property

Definition 2 ().

We say a function has a - gradient if for all and any .

For each training iteration, we first sample a mini-batch of links (denoted by ) of both positive links () and negative links (), according to the sampling algorithm (one of the Algorithm 2, 3, 4, 5), and then the stochastic gradient is computed and applied to the parameters as follows:


Here we use to denote the gradient of loss function given a pair of . And , are the number of positive and negative links in the batch , respectively.

Lemma 1 ().

(unbiased stochastic gradient) Under sampling Algorithm 2, 3, 4, 5, we have . In other words, the stochastic mini-batch gradient equals to true gradient in expectation.


Below we prove this lemma for each for the sampling Algorithm. For completeness, we also show the proof for Uniform Sampling as follows. The main idea is show the expectation of stochastic gradient computed in a randomly formed mini-batch equal to the true gradient of objective in Eq. 1.

IID Sampling

The positive links in the batch are i.i.d. samples from (i.e. drawn uniformly at random from all positive links), and the negative links in are i.i.d. samples from , thus we have


The first equality is due to the definition of sampling procedure, the second equality is due to the definition of expectation, and the final equality is due to the definition of pointwise loss function in Eq. 1.

Negative Sampling

In Negative Sampling, we have batch consists of i.i.d. samples of positive links, and conditioning on each positive link, negative links are sampled by replacing items in the same i.i.d. manner. Positive links are sampled from , and negative items are sampled from , thus we have


The first equality is due to the definition of sampling procedure, and the second equality is due to the properties of joint probability distribution and expectation.

Stratified Sampling (by Items)

In Stratified Sampling (by Items), a batch consists of links samples drawn in two steps: (1) draw an item , and (2) draw positive users and negative users respectively. Additionally, negative terms are also re-weighted, thus we have


The first equality is due to the definition of sampling procedure, and the second, the third and the forth equality is due to the properties of joint probability distribution and expectation.

Negative Sharing

In Negative Sharing, we only draw positive links uniformly at random (i.e. ), while constructing negative links from sharing the items in the batch. So the batch we use for computing gradient consists of both positive links and negative links.

Although we do not draw negative links directly, we can still calculate their probability according to the probability distribution from which we draw the positive links. So a pair of constructed negative link in the batch is drawn from . Additionally, negative terms are also re-weighted, we have


The first equality is due to the definition of sampling procedure, and the second equality is due to the properties of joint probability distribution and expectation.

Stratified Sampling with Negative Sharing

Under this setting, we follow a two-step sampling procedure: (1) draw an item , and (2) draw positive users . Negative links are constructed from independently drawn items in the same batch. So the batch consists of positive links and negative links.

We can use the same method as in Negative Sharing to calculate the probability of sampled negative links, which is also . Again, negative terms are re-weighted, thus we have


The first equality is due to the definition of sampling procedure, and the second, third and fourth equality is due to the properties of joint probability distribution and expectation. ∎

Proposition 1 ().

Suppose has -bounded gradient; let where , and is the minimizer to . Then, the following holds for the sampling strategies given in Algorithm 2, 3, 4, 5


With the property of - function , we have


By applying the stochastic update equation, lemma 1, i.e. , we have


Combining results in Eq. 9 and 10, with assumption that the function is -, we have

Rearranging the above equation we obtain


By summing Eq. 11 from to and setting , we have


By setting

We obtain the desired result. ∎

Appendix B Vector Dot Product Versus Matrix multiplication

Here we provide some empirical evidence for the computation time difference of replacing vector dot product with matrix multiplication. Since vector dot product can be batched by element-wise matrix multiplication followed by summing over each row. We compare two operations between two square matrices of size : (1) element-wise matrix multiplication, and (2) matrix multiplication. A straightforward implementation of the former has algorithmic complexity of , while the latter has . However, modern computation devices such as GPUs are better optimized for the latter, so when the matrix size is relatively small, their computation time can be quite similar. This is demonstrated in Figure 9. In our choice of batch size and embedding dimension, , so the computation time is comparable. Furthermore, , so even several times increase would also be ignorable.

Figure 9. The computation time ratio between matrix multiplication and element-wise matrix multiplication for different square matrix sizes.

Appendix C Functional Embedding Versus Functional Regularization

In this work we propose a functional embedding framework, in which the embedding of a user/item is obtained by some function such as neural networks. We notice another approach is to penalize the distance between user/item embedding and the function output (instead of equate them directly as in functional embedding), which we refer as functional regularization, and it is used in (Wang et al., 2015). More specifically, functional regularization emits following form of loss function:

Here we point out its main issue, which does not appear in Functional Embedding. In order to equate the two embedding vectors, we need to increase . However, setting large will slow down the training progress under coordinate descent. The gradient w.r.t. is , so when is large, , which means cannot be effectively updated by interaction information.