NCF
Recommender that learns the user-item interaction with a neural network instead of a dot product.
Tabular and recommender · 19 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 392.6K
- Operations
- 19
- Framework
- PyTorch
- Recurrent
- No
- Published
- WWW 2017
- Cited by
- 199 (as of 16 October 2026)
- Authors
- Xiangnan He, Lizi Liao, Hanwang Zhang and others
- License
- Apache-2.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m1830
- Graph hash
- 670d0a3cfdfa8f89e05cb93b96d3313561fb8f090d14ab5aee4a20a6c55f7bac
- Skeleton hash
- 16e22537b2668c323f98399d451229d7665253ae09f416562379a2edc66c98c2
- Architecture hash
- b5f0968a67857989e88d933dd655032e300afd1bf2f0869e9f15fc318caf0c71
- Diagram SHA-256
- 746c182934319f723096a07182c9eb72b2a9a64760ed63554c8b6e3e5bb5ff2f
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
Neural Collaborative Filtering (NCF) brings neural networks to the core problem of recommendation: collaborative filtering from implicit feedback. Earlier deep models for recommendation still modelled the user-item interaction itself with matrix factorization and an inner product on the latent features. NCF replaces that inner product with a neural architecture that can learn an arbitrary function from data. The framework is generic enough to express and generalize matrix factorization as a special case.
The inputs are just the identities of a user and an item, one-hot encoded into sparse vectors. An embedding layer projects each to a dense vector, which plays the role of the latent vector in a latent factor model. Two instantiations follow: GMF, which applies a linear kernel to the latent feature interactions, and MLP, which learns the interaction function with a non-linear kernel. The MLP path exists because a plain concatenation of the two embeddings captures no interaction between user and item latent features, so hidden layers are stacked on the concatenated vector. NeuMF, the model traced here, fuses the two: GMF and MLP learn separate embeddings and their last hidden layers are concatenated. The authors describe this as combining the linearity of matrix factorization with the non-linearity of deep networks, and named it Neural Matrix Factorization. Training treats recommendation as binary classification with a log loss, which the authors note had rarely been investigated in the recommendation literature. Because the NeuMF objective is non-convex, the paper initializes it from separately pretrained GMF and MLP models.
The copy traced here is a third-party PyTorch port whose author reports that it replicates the performance of the original NCF.
Key idea. Replacing the inner product of matrix factorization with a learned neural interaction function over user and item embeddings, with NeuMF fusing a linear GMF path and a non-linear MLP path by concatenating their last hidden layers.
- ncf
- neural collaborative filtering
- neumf
- neural matrix factorization
- gmf
- generalized matrix factorization
- recommendation
- collaborative filtering
- implicit feedback
- movielens
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{he2017neuralcollaborativefiltering,
title={Neural Collaborative Filtering},
author={Xiangnan He and Lizi Liao and Hanwang Zhang and Liqiang Nie and Xia Hu and Tat-Seng Chua},
year={2017},
eprint={1708.05031},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/1708.05031},
}