Comparisons / Two-Tower vs Neural Collaborative Filtering
Two-Tower vs Neural Collaborative Filtering
Retrieval by dot product against a learned interaction.
Neural Collaborative Filtering has 35M fewer parameters than Two-Tower: 3 layers added, 4 removed, 5 changed.
Two-Tower
- Layers
- 10
- Parameters
- 70M
- Input
- 1
- Output
- 1 × 1
- Forward-passes
- yes
- Est. train cost
- $0.065
Neural Collaborative Filtering
- Layers
- 9
- Parameters
- 35M
- Input
- 1
- Output
- 1 × 1
- Forward-passes
- yes
- Est. train cost
- $0.053
The deltas
Every number is Neural Collaborative Filtering relative to Two-Tower.
Which GPUs each one fits
Memory for the graph at the input shape both declare. A highlighted row is a card one of them fits and the other does not, which is the difference that decides a purchase.
| GPU | Two-Tower | Neural Collaborative Filtering |
|---|---|---|
| T4 16GB | fits | fits |
| A100 40GB | fits | fits |
| H100 80GB | fits | fits |
Layer by layer
Aligned in topological order. 4 of 16 rows are the same layer with the same parameters.
Hide all 16 rows
| Two-Tower | Neural Collaborative Filtering | ||||||
|---|---|---|---|---|---|---|---|
| Layer | Params | Output | Layer | Params | Output | ||
| 1 | same | User Input Input | 1 | User ID Input | 1 | ||
| 2 | same | Item Input Input | 1 | Item ID Input | 1 | ||
| 3 | changed embeddingDim | User Embed Embedding | 6.4M | 1 × 64 | User Embedding Embedding | 3.2M | 1 × 32 |
| 4 | changed embeddingDim | Item Embed Embedding | 64M | 1 × 64 | Item Embedding Embedding | 32M | 1 × 32 |
| 5 | removed | User FC 1 Linear | 8.3K | 1 × 128 | — | ||
| 6 | added | — | Concat [u; i] Concatenate | 1 × 64 | |||
| 7 | changed outFeatures | Item FC 1 Linear | 8.3K | 1 × 128 | MLP 1 Linear | 4.2K | 1 × 64 |
| 8 | removed | User ReLU Relu | 1 × 128 | — | |||
| 9 | same | Item ReLU Relu | 1 × 128 | ReLU 1 Relu | 1 × 64 | ||
| 10 | changed inFeatures, outFeatures | User Tower Out Linear | 8.3K | 1 × 64 | MLP 2 Linear | 2.1K | 1 × 32 |
| 11 | added | — | ReLU 2 Relu | 1 × 32 | |||
| 12 | changed inFeatures, outFeatures | Item Tower Out Linear | 8.3K | 1 × 64 | Score Head Linear | 33 | 1 × 1 |
| 13 | removed | Item Transpose Permute | 64 × 1 | — | |||
| 14 | removed | Dot Score Matmul | 1 × 1 | — | |||
| 15 | added | — | Sigmoid Sigmoid | 1 × 1 | |||
| 16 | same | Score Output | 1 × 1 | P(click) Output | 1 × 1 | ||
What this is not
- Parameter counts are derived from the graph, not read from a checkpoint. They are exact for a graph that is fully specified and approximate for one that is not.
- Cost and GPU fit are estimates from the graph under one set of assumptions, not measurements of a run.
Take it further
Open either graph in the editor, change it, and check it again: Two-Tower · Neural Collaborative Filtering
Compare any two models of your own, including anything on Hugging Face: the comparison tool.
Machine-readable: this page as markdown ·
the pair index ·
POST https://www.neurarch.com/api/v1/plan for a graph of your own.