Neural collaborative filtering (NCF) is a recommendation framework that models the interaction between a user and an item with a neural network instead of the fixed dot product used in classic matrix factorization. In recommender systems, it learns user and item embeddings from past behavior, usually implicit feedback such as clicks or purchases, and predicts how likely a user is to engage with each item.
NCF was introduced in 2017 and became one of the most cited bridges between collaborative filtering and deep learning. Its best-known form, NeuMF, combines a generalized matrix factorization branch with a multilayer perceptron, and its later re-evaluation has made it an important lesson in how recommendation models should be benchmarked.
How neural collaborative filtering works
NCF maps each user ID and each item ID to a dense embedding vector and passes these vectors through learned layers that output an interaction score between 0 and 1. The model is trained so that observed user-item pairs receive high scores and unobserved pairs receive low scores.
Because implicit feedback contains only positive signals, training relies on negative sampling: for each observed interaction, a few items the user has not interacted with, typically four negatives per positive, are sampled and treated as negatives. The loss is binary cross-entropy, which turns recommendation into a pointwise classification problem.
The original framework defines three model variants, which differ in how embeddings are combined.
| Variant | How embeddings interact | Strength |
|---|---|---|
| GMF | Element-wise product followed by a weighted output layer | Generalizes matrix factorization with learned weights |
| MLP | Concatenation followed by several hidden layers | Can, in principle, learn non-linear interactions |
| NeuMF | Fuses the GMF and MLP branches before the output | Combines linear and non-linear signals |
In NeuMF, the two branches keep separate embeddings, and their final hidden vectors are concatenated into one prediction layer. The original authors reported that pretraining both branches separately before joint training improved results.
Key design choices and hyperparameters
NCF performance depends heavily on embedding size, the number of negative samples and the depth of the MLP tower. A common MLP design uses a tower structure in which each hidden layer has half the width of the previous one.
| Setting | Common range | Effect |
|---|---|---|
| Embedding dimension | 8 to 64 | Larger sizes capture more detail but risk overfitting |
| Negatives per positive | 1 to 10 | More negatives sharpen ranking at higher training cost |
| MLP hidden layers | 1 to 4 | Deeper towers add capacity with diminishing returns |
| Learning rate | 0.0001 to 0.005 | Too high destabilizes embedding training |
| Regularization | L2 or dropout | Controls overfitting on sparse users |
The standard evaluation protocol is leave-one-out: the latest interaction of each user is held out, and the model ranks it against a sample of non-interacted items using hit ratio and NDCG at 10. This protocol has itself become controversial, as described below.
NCF compared with matrix factorization and later models
The central claim of NCF was that a learned interaction function should outperform the dot product. A widely discussed 2020 re-examination showed that a carefully tuned dot-product model matches or beats the MLP-based variant, and that an MLP has difficulty learning even a simple dot product from data.
| Approach | Interaction function | Practical serving | Current standing |
|---|---|---|---|
| Matrix factorization | Dot product | Fast nearest-neighbor retrieval | Strong, well-understood baseline |
| NeuMF | GMF plus MLP fusion | Requires scoring each candidate | Historical reference point |
| Two-tower model | Dot product of deep encoders | Fast nearest-neighbor retrieval | Industry standard for retrieval |
| DeepFM and Wide & Deep | Feature crosses plus deep layers | Used in ranking stages | Common for CTR prediction |
| LightGCN | Graph propagation then dot product | Fast nearest-neighbor retrieval | Strong academic baseline |
The serving difference matters. A dot-product score supports maximum inner product search, so millions of items can be searched in milliseconds. An MLP score does not, so NCF is suitable mainly for re-ranking a short candidate list produced by another model in a multi-stage ranking pipeline.
When neural collaborative filtering is useful
NCF remains useful as a teaching model and a benchmark, and it can serve in production when the candidate set is small and only interaction IDs are available. Its weakness is that the basic form uses no side features, so content, context and time must be added through extensions.
| Situation | Suggested choice | Reason |
|---|---|---|
| Learning deep recommenders | NCF or NeuMF | Clear structure and well-known datasets |
| Retrieval from millions of items | Two-tower or matrix factorization | Supports approximate nearest-neighbor search |
| Rich user and item features | DeepFM or a feature-based ranker | NCF ignores side information by default |
| Strong order effects | Sequential models such as SASRec | NCF treats interactions as unordered |
| Re-ranking a few hundred candidates | NeuMF is workable | Per-candidate scoring cost is acceptable |
Limitations and evaluation pitfalls
The most important lesson from NCF concerns evaluation practice, not architecture. Many reported gains disappeared when baselines were tuned properly or when full ranking replaced sampled ranking.
- Weak baselines: comparing against untuned matrix factorization exaggerates the benefit of the neural model.
- Sampled metrics: ranking against 100 random negatives can reorder models compared with ranking the full catalog.
- Cold start problem: like all ID-based collaborative filtering, NCF cannot represent new users or items without interactions.
- Popularity bias: uniform negative sampling tends to favor popular items unless sampling or loss is adjusted.
In simple terms
Neural collaborative filtering is a way for a service to guess what you will like based on what you and people similar to you have done before. Each person and each product gets a short list of numbers that describes its taste or character.
Older methods compare those lists with one fixed formula. NCF instead lets a small neural network learn the comparison. The idea was influential, but later tests showed that the simple formula, used carefully, often works just as well.
A practical example
An online bookstore with about 200,000 active customers and 50,000 titles wants better suggestions on its home page. It has purchase and click histories but little structured book metadata, which makes ID-based collaborative filtering a natural fit.
The data team first builds a tuned matrix factorization model to retrieve 500 candidates per customer. It then trains a NeuMF model with 32-dimensional embeddings and four negative samples per purchase to re-rank those candidates, and it evaluates both models with full-catalog ranking metrics on the most recent week of purchases.
The re-ranking stage adds a modest gain in recall at 10 over the tuned baseline, smaller than early research papers suggested but stable across weeks. The team keeps the two-stage design and treats the tuned factorization model as the benchmark every future model must beat.