Paper commentary
Neural Graph Collaborative Filtering
Graph propagation of embeddings captures collaborative signal for better recommendations
- Problem Embeddings built only from IDs and attributes leave the collaborative signal in user-item interactions unencoded. Models then lean on the interaction function to make up for the weaker representation.
- Method NGCF, Neural Graph Collaborative Filtering, propagates user and item embeddings over the user-item bipartite graph. Stacked propagation layers are concatenated and scored by inner product, trained with BPR loss.
- Results NGCF reaches recall@20 of 0.1569 on Gowalla, 11.68% above the strongest baseline. It is also evaluated on Yelp2018∗ and Amazon-Book against MF, NeuMF, CMN and HOP-Rec.
Why ID-based embeddings miss collaborative signal
Many recommenders represent each user and item as a learned vector and score a pair with a simple function of those two vectors. That vector is usually computed from descriptive features such as an ID or attributes, while the interaction history mainly enters through the training objective. The authors argue that this leaves the collaborative signal, the behavioural similarity hidden in user-item interactions, outside the embedding.
When an embedding carries little of that signal, the interaction function has to make up for the weaker representation. Encoding interactions directly into embeddings is hard in practice, because interaction counts can reach millions and the useful signal becomes difficult to distil. The proposed route is to use high-order connectivity in the interaction graph as the carrier of that signal.
Reading collaborative signal from longer paths
Take u1 as the target user. The path u1 ← i2 ← u2 shows that u1 and u2 behave alike, since both consumed i2. Extending the path to u1 ← i2 ← u2 ← i4 suggests that i4 is a likely item for u1, because the similar user u2 consumed it. Counting paths of length three, i4 connects to u1 through two paths while i5 connects through one, which the authors use to rank i4 above i5.
Instead of expanding the interaction graph into a tree, which is complex to implement, the method propagates embeddings on the graph itself, in the style of graph neural networks. Two stacked layers capture the u1 ← i2 ← u2 similarity and three layers capture the candidate i4, while trainable weights between layers set how strongly each information flow counts.
HOP-Rec also uses high-order connectivity, but only to enrich its training data, and its prediction model remains MF.
The authors claim that NGCF explicitly encodes collaborative signal in the form of high-order connectivity by performing embedding propagation.
What one propagation layer computes
Each user and item starts as a row of one learnable look-up table, with embedding size d, and the table is optimized end to end. The table is written as \( E=[e_{u_1},\dots,e_{u_N},e_{i_1},\dots,e_{i_M}] \), with users first and items after them. Refining these ID embeddings through the user-item graph, rather than feeding them directly into an interaction layer as MF or NeuMF do, is what makes the embeddings carry the collaborative signal.
The first step builds a message from each connected item i to user u, using the item embedding, the user embedding and the coefficient p_{ui}. The message takes the form \[ m_{u\leftarrow i} = \frac{1}{\sqrt{|N_u||N_i|}}\left(W_1 e_i + W_2 (e_i \odot e_u)\right) \] where \( W_1, W_2 \in \mathbb{R}^{d'\times d} \) are trainable and \( d' \) is the transformation size.
The coefficient is the graph Laplacian norm, the inverse square root of the product of the two neighbourhood sizes, which acts as a discount on the message. The element-wise product term makes the message depend on how similar the item and user embeddings are, so similar items pass more messages, whereas conventional graph convolution uses only the neighbour's own embedding.
Aggregating messages and stacking layers
A user's new first-layer representation is the sum of the messages from its neighbours plus a self-connection message, passed through LeakyReLU. The formula is \[ e_u^{(1)} = \mathrm{LeakyReLU}\left(m_{u\leftarrow u} + \sum_{i\in N_u} m_{u\leftarrow i}\right) \]. The self-connection message is \( m_{u\leftarrow u} = W_1 e_u \), so the original features are kept, and it reuses the weight matrix of the neighbour message.
LeakyReLU lets the aggregated messages keep small negative values as well as positive ones.
In layer \( l \) each user is updated from the previous layer's embeddings, so after \( l \) layers the user has received messages from its \( l \)-hop neighbours. The layer-wise update is \[ e_u^{(l)} = \mathrm{LeakyReLU}\left(m_{u\leftarrow u}^{(l)} + \sum_{i\in N_u} m_{u\leftarrow i}^{(l)}\right) \] with messages \( m_{u\leftarrow i}^{(l)} = p_{ui}\left(W_1^{(l)} e_i^{(l-1)} + W_2^{(l)}(e_i^{(l-1)}\odot e_u^{(l-1)})\right) \) and \( m_{u\leftarrow u}^{(l)} = W_1^{(l)} e_u^{(l-1)} \).
Each \( W_1^{(l)} \) and \( W_2^{(l)} \) has size \( d_l \times d_{l-1} \), so the transformation size can change from layer to layer.
The same update can be written for the whole graph at once as \[ E^{(l)} = \mathrm{LeakyReLU}\left((L+I)E^{(l-1)}W_1^{(l)} + LE^{(l-1)}\odot E^{(l-1)}W_2^{(l)}\right) \], where \( E^{(0)} = E \) and \( I \) is the identity matrix. Because the whole graph is updated in one matrix step, the method avoids the node sampling that graph convolution networks often need on large graphs.
Final embeddings, score and training objective
After L layers, a user has the representations from layer 1 to layer L, and these are concatenated with the initial embedding to form the final user vector. The formula is \( e_u^* = e_u^{(0)} \| \cdots \| e_u^{(L)} \), and items are handled in the same way. Concatenation adds no parameters to learn, and the authors note that weighted averages, max pooling or LSTMs could also be used, each implying a different assumption about combining orders.
The preference score is the inner product of the final user and item vectors, \( \hat{y}_{NGCF}(u,i) = e_u^{*\top} e_i^* \). The authors keep this interaction function deliberately simple so that the gains come from the embedding function, leaving neural interaction functions for future work.
Training uses the pairwise BPR loss, which pushes the score of an observed item above that of an unobserved one, written as \[ \mathrm{Loss} = \sum_{(u,i,j)\in O} -\ln\sigma(\hat{y}_{ui}-\hat{y}_{uj}) + \lambda\|\Theta\|_2^2 \]. Here \( \Theta \) collects the embedding table and all transformation matrices, and \( \lambda \) sets the strength of the L2 regularization.
Parameters are updated with mini-batch Adam over randomly sampled triples \( (u,i,j) \), using gradients of this loss.
How NGCF contains SVD++ and FISM
Setting L to one and removing the transformation matrix and the nonlinearity gives a simplified model the authors call NGCF-SVD. Setting one of the two coefficients to \( 1/\sqrt{|N_u|} \) and the other to 0 recovers SVD++. Setting the item-side coefficient to 0 turns the model into FISM, which the authors describe as another special case.
Parameter cost, dropout and training time
Beyond the embedding table, each propagation layer adds two matrices of size \( d_l \times d_{l-1} \), so NGCF uses about \( 2Ld_ld_{l-1} \) more parameters than MF. The authors describe Gowalla as having 20K users and 40K items; with embedding size 64 and three layers of size 64×64, MF has 4.5 million parameters while NGCF adds 0.024 million.
Message dropout drops outgoing messages in the propagation step with probability p1. Node dropout removes (M+N)p2 nodes of the Laplacian matrix in each layer, where p2 is the dropout ratio. Both are used only during training and are switched off at test time.
The per-layer cost of the matrix multiplication is \( O(|R^+| d_l d_{l-1}) \), where \( |R^+| \) is the number of nonzero entries of the Laplacian matrix. Under the same settings on Gowalla, MF and NGCF take about 20s and 80s per training epoch, and about 80s and 260s for inference over all test instances. These timings are empirical measurements from one dataset, so they say little about the other two datasets.
Datasets, split and evaluation protocol
Experiments use Gowalla, Yelp2018∗ and Amazon-Book, all filtered with the 10-core setting so that users and items keep at least ten interactions. Gowalla has 1,027,370 interactions with density 0.00084, Yelp2018∗ has 1,561,406 interactions with density 0.00130, and Amazon-Book has 2,984,108 interactions with density 0.00062. For each user, 80% of historical interactions form the training set and the rest the test set, and 10% of the training interactions serve as validation for tuning.
Each observed interaction is paired with one negative item the user has not consumed.
Quality is measured by recall@K and ndcg@K with K = 20, averaged over all test users. The ndcg metric was re-implemented to match the standard definition, and all methods were rerun. Baselines are MF, NeuMF, CMN, HOP-Rec, GC-MC and PinSage, all trained with the BPR loss.
The embedding size is 64 for all models, and the optimizer is Adam with batch size 1024 for all models except HOP-Rec. Learning rate, L2 coefficient and dropout ratio were chosen by grid search, and training stops early when recall@20 on validation data does not rise for 50 successive epochs. Without other specification, NGCF uses three propagation layers, node dropout ratio 0.0 and message dropout ratio 0.1.
Overall comparison with baselines
Against the strongest baseline in each dataset, the authors report recall@20 improvements of 11.68%, 11.97% and 9.61% on Gowalla, Yelp2018∗ and Amazon-Book. The authors report the gains as statistically significant from one-sample t-tests at p-value below 0.05.
MF is the weakest model on all three datasets, and NeuMF improves on it in every case, which the authors read as a sign that nonlinear feature interaction helps. The authors note that neither MF nor NeuMF models connectivity during embedding learning, which they take to explain their weaker representations. GC-MC falls below NeuMF on Yelp2018∗ in ndcg@20, which the authors attribute to GC-MC not fully exploring nonlinear feature interactions.
CMN generally beats GC-MC, which the authors attribute to its attention over neighbours rather than GC-MC's equal or heuristic weights. PinSage trails CMN on Gowalla and Amazon-Book but is much stronger on Yelp2018∗, and HOP-Rec gives large gains in most cases. Compared with CMN and GC-MC, which use only first-order neighbours, NGCF stacks propagation layers, and compared with PinSage it concatenates outputs from several layers instead of using only the last one.
Behaviour for users with few interactions
Test users are divided into four groups with equal total interactions, and on Gowalla the per-user interaction thresholds are less than 24, 50, 117 and 1014. Figure 4 reports ndcg@20 for each group on the three datasets.
NGCF and HOP-Rec outperform all other baselines on every user group, which the authors take to show that high-order connectivity helps representation learning for inactive users. On Gowalla the gains over the best baselines are 8.49% and 7.79% in the two sparsest groups, against 1.29% in the densest group.
Effect of depth and layer design
Depths from 1 to 4 layers were searched, and on Yelp2018∗ recall rises from 0.0543 for NGCF-1 to 0.0579 for NGCF-3. On Amazon-Book recall rises from 0.0313 for NGCF-1 to 0.0337 for NGCF-3, and on Gowalla it rises from 0.1556 to 0.1569. On Gowalla, NGCF-2 is slightly below NGCF-1 with recall 0.1547 against 0.1556 and ndcg 0.1307 against 0.1315, so the claimed gain of NGCF-2 over NGCF-1 does not hold on that dataset for recall or ndcg.
The authors attribute the depth gains to second-order connectivity carrying collaborative user similarity and third-order connectivity carrying collaborative signal.
NGCF-4 overfits on Yelp2018∗, with recall 0.0566 and ndcg 0.0461 against 0.0579 and 0.0477 for NGCF-3. The authors suggest that too deep an architecture introduces noise into the representations, and they see only marginal gains from a fourth layer on the other two datasets.
The ablation replaces the element-wise interaction term in the message with the message forms of PinSage, GC-MC, or SVD++, giving NGCF-1 variants called NGCF-1PinSage, NGCF-1GC-MC and NGCF-1SVD++. Full NGCF-1 has recall 0.1556 on Gowalla against 0.1517, 0.1523 and 0.1534 for SVD++, GC-MC and PinSage style variants, and it also has the highest ndcg on each dataset.
The authors attribute the gap to the element-wise term, which makes messages depend on the affinity between user and item, and they note that the other variants use only linear transformations. When the outputs of all layers are concatenated, the NGCF-1PinSage and NGCF-1GC-MC variants beat PinSage and GC-MC, which the authors read as support for layer aggregation; this comparison sets two different architectures against each other.
Dropout settings and convergence
On Gowalla, node dropout with p2 at 0.2 reaches recall@20 of 0.1514, while message dropout reaches 0.1506. The authors report that node dropout performs better than message dropout across the sweep, and they attribute this to removing all outgoing messages of a node, which makes the model robust to node-level effects as well as edge-level ones.
The dropout ratios were varied for message dropout p1 and node dropout p2 across the three datasets.
Per epoch, the test recall of NGCF rises faster than that of MF on all three datasets, and the authors explain this by indirectly connected users and items being involved in each mini-batch. Only recall is plotted per epoch, and ndcg is omitted because it follows a similar trend.
What the learned embeddings look like
Six users were chosen at random from Gowalla, together with their relevant items, and their representations were compared as the propagation depth changes. The comparison contrasts MF, which is NGCF-0, with NGCF-3 using t-SNE projections. The items shown come from the test set and were not paired with the users during training.
In NGCF-3 the points for items consumed by the same user form discernible clusters, which the authors read as connectivity being reflected in the embedding space. For users such as 12201 and 6880, the historical items sit closer together in NGCF-3 than in MF, which the authors take as qualitative evidence that propagation injects collaborative signal.
Limits of the evidence
SpectralCF was not included as a baseline because its eigen-decomposition was too costly in time and resources on the larger datasets. Experiments use only three 10-core datasets with the 80% and 10% split, so other sparsity levels and domains were not tested beyond these. The only interaction function tested is the inner product, and neural interaction functions were not explored.
Depth is not uniformly helpful: four layers overfit on Yelp2018∗ and NGCF-2 is below NGCF-1 on Gowalla. The training and inference timings come from Gowalla only, with NGCF about four times slower than MF per training epoch under those settings. Attention over neighbours and adversarial robustness were not tested, and the authors leave both to future work.
The ndcg metric was re-implemented and the Yelp2018∗ preprocessing was changed, so earlier published numbers are not directly comparable.
Paper info
- Authors
- Xiang Wang, Xiangnan He, Meng Wang, Fuli Feng, Tat-Seng Chua
- Venue
- arXiv · Preprint
- First published
- 2019-5-20
- Added
- 2026-11-12
- Updated
- 2020-7-3
- Version
- v2
- arXiv
- 1905.08108
- DOI
- 10.1145/3331184.3331267
- Category
- cs.IR · cs.LG · cs.SI
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Xiang Wang, Xiangnan He, Meng Wang, Fuli Feng, Tat-Seng Chua (2019). Neural Graph Collaborative Filtering. arXiv:1905.08108v2. https://doi.org/10.1145/3331184.3331267
BibTeX
@article{wang2019neural,
title = {{Neural Graph Collaborative Filtering}},
author = {Xiang Wang and Xiangnan He and Meng Wang and Fuli Feng and Tat-Seng Chua},
year = {2019},
eprint = {1905.08108},
archivePrefix = {arXiv},
doi = {10.1145/3331184.3331267},
url = {https://arxiv.org/abs/1905.08108v2}
}