MELODI: Similarity-Identity Decoupling for Lightweight Ranking
Organizations: Amazon International Machine Learning Melbourne, Australia
Abstract
For latency-constrained candidate ranking, we propose a similarity-identity decoupling framework that separates target-history compatibility from target-only information. We study two orders for computing pooled similarity, similarity-then-pool and pool-then-similarity, and identify linearity of the similarity operator in its history argument, for each fixed target, as sufficient for their equivalence, justifying the cheaper pool-then-similarity form. We instantiate the framework as multi-head efficient lightweight operator for decoupling identity and similarity (MELODI), whose similarity branch combines target-conditioned multi-head history pooling with a single residual-free cross layer that is linear in its pooled-history input and whose identity branch is problem-dependent. On public benchmark datasets, MELODI matches or surpasses the evaluated target-aware and target-agnostic baselines. On two large-scale industrial datasets, its area under the precision-recall curve (AUPRC), normalised discounted cumulative gain (NDCG), and recall values are equal to or higher than those of the evaluated target-aware baselines. Processor measurements show lower latency than the evaluated candidate-conditioned baselines at large candidate counts, further reduced by request-local history reuse.
Figures & tables
| Symbol | Description | Symbol | Description |
| Framework | |||
| Candidate set of size | History matrix of length | ||
| History item and generic target; the candidate index on is dropped | Framework history and target widths | ||
| Non-negative attention distribution over the history items | Target-aware pooled history | ||
| Similarity operator; linear in its history argument where SP/PS equivalence is invoked (Def. 3.2 ) | Similarity-operator output width | ||
| Pooled similarity under similarity-then-pool and pool-then-similarity orderings | Matrix in | ||
| Steam | ML-25M | |||||
|---|---|---|---|---|---|---|
| Model | HIT@10 | NDCG@10 | MRR | HIT@10 | NDCG@10 | MRR |
| SASRec (target-agnostic) | .7677 .0032 | .4997 .0029 | .4279 .0029 | .9327 .0017 | .7234 .0038 | .6595 .0043 |
| TA-Transformer (1 layer, 1 head) | .7741 .0043 | .5128 .0062 | .4425 .0065 | .9283 .0016 | .7158 .0031 | .6512 .0035 |
| DIN | .7817 .0029 | .5253 .0045 | .4561 .0049 | .9399 .0021 | .7347 .0063 | .6719 .0074 |
| DIN + DCN-v2 | .7851 .0029 | .5300 .0021 | .4609 .0017 | .9436 .0003 | .7467 .0022 | .6862 .0029 |
| MELODI (4 experts, 1 layer) | .7940 .0019 | .5409 .0016 | .4720 .0016 | .9503 .0006 | .7605 .0016 | .7017 .0019 |
| Dataset | Model | HIT@1 | HIT@5 | HIT@10 | NDCG@5 | NDCG@10 | MRR |
|---|---|---|---|---|---|---|---|
| Steam | SASRec (history-only LN) | 0.2168 | 0.5554 | 0.7198 | 0.3917 | 0.4451 | 0.3736 |
| SASRec | 0.2738 | 0.6198 | 0.7704 | 0.4540 | 0.5029 | 0.4311 | |
| TA-Transformer (1 layer, 1 head) | 0.2809 | 0.6235 | 0.7695 | 0.4599 | 0.5073 | 0.4370 | |
| DIN | 0.3082 | 0.6465 | 0.7848 | 0.4855 | 0.5304 | 0.4616 | |
| DIN + DCN-v2 | 0.3060 | 0.6439 | 0.7823 | 0.4834 | 0.5284 | 0.4598 | |
| MELODI (4 experts, 1 layer) | 0.3196 | 0.6563 | 0.7923 | 0.4963 | 0.5405 | 0.4720 |
| Model | Sampled | Hard | Full |
|---|---|---|---|
| Steam | |||
| SASRec | .4311 | .0636 | .0351 |
| TA-Transformer (1L, 1H) | .4370 | .0623 | .0340 |
| DIN | .4616 | .0748 | .0457 |
| DIN + DCN-v2 | .4598 | .0731 | .0434 |
| CAN | .4611 | .0785 | .0388 |
| Steam | ML-25M | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Model | NDCG@10 | Flat. | Reuse | Benefit | NDCG@10 | Flat. | Reuse | Benefit | ||
| TA-Transformer (1 layer, 1 head) | ||||||||||
| DIN | ||||||||||
| DIN + DCN-v2 | ||||||||||
| MELODI (4 experts, 1 layer) | ||||||||||
| Overall | Segment-1 | Segment-2 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Model | AUROC | AUPRC | N@20 | R@20 | AUROC | AUPRC | N@20 | R@20 | AUROC | AUPRC | N@20 | R@20 |
| Tabular baseline | – | – | – | – | – | – | – | – | – | – | – | – |
| TA-Transformer | +2.5 | +22.2 | +8.8 | +5.8 | +2.3 | +28.6 | +11.1 | +3.8 | +3.1 | +11.1 | +6.9 | +7.1 |
| DIN | +2.8 | +16.7 | +8.8 | +6.0 | +2.6 | +22.4 | +11.8 | +4.6 | +3.4 | +7.4 | +6.4 | +6.7 |
| MELODI | +2.9 | +25.0 | +11.3 | +7.1 | +2.5 | +32.7 | +15.4 | +5.5 | +3.6 | +11.1 | +7.9 | +8.1 |
| Overall | Identifier available | Identifier unavailable | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Model | AUROC | AUPRC | N@20 | R@20 | AUROC | AUPRC | N@20 | R@20 | AUROC | AUPRC | N@20 | R@20 |
| Tabular baseline | – | – | – | – | – | – | – | – | – | – | – | – |
| TA-Transformer | +2.0 | +6.5 | +2.3 | +2.3 | +2.3 | 3.3 | +3.5 | +4.9 | +1.6 | +12.5 | +2.3 | +0.9 |
| DIN | +2.5 | +6.5 | +2.7 | +3.1 | +3.1 | +3.3 | +5.6 | +7.4 | +1.9 | +10.2 | +1.6 | 0.0 |
| MELODI | +2.0 | +7.8 | +3.2 | +4.2 | +2.8 | +3.3 | +5.6 | +8.4 | +1.0 | +10.2 | +2.3 | +1.3 |
| # | Configuration | Steam | ML-25M |
|---|---|---|---|
| 1 | Anchor: 1 layer, no residual, cross-only scorer | .4720 | .7033 |
| 2 | target self-cross | .4702 | .6882 |
| 3a | target residual | .4722 | .7023 |
| 3b | pooled-history residual | .4716 | .7023 |
| 4a | second layer; identity also deepened | .4771 | .7086 |
| 4b | second layer; identity fixed | .4794 | .7019 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Flat. | Reuse | Benefit |
|---|---|---|---|
| DIN | M | M | |
| DIN + DCN-v2 | M | M | |
| MELODI (1 layer, 4 experts) | M | M | |
| MELODI (2 layers, 4 experts) | M | M | |
| MELODI (1 layer, 8 experts) | M | M |
| Aspect | DCN-v2 self-cross | Our user–target cross |
|---|---|---|
| Inputs | One feature vector , self-crossed. | Pooled history and target , with a target projection . |
| Core operation | (no residual), with computed from and gates on . | |
| Residual connection | Included, carries the previous layer state forward. | Dropped. The output contains only similarity, and the identity branch handles target-only content. |
| Head structure | Single-stream, no attention heads. | Each head operates on -dimensional slices of and ; concatenation gives . |
| Expert structure | Mixture of experts is global: , dense across all dimensions. | The same -dimensional experts are reused across heads, producing independent blocks . Relative to a width- DCN-v2 layer, the expert-term ratio is . |
| Gating | Single gate vector shared across all dimensions. | Per-head gate vector , so each head mixes the experts independently instead of sharing one mixture across all dimensions. |
| Steam | ML-25M | |||
|---|---|---|---|---|
| Configuration | Both | Pinned | Both | Pinned |
| 1 similarity layer | ||||
| 2 similarity layers | ||||
| Component | Effect (Steam / ML-25M) | Recommendation |
|---|---|---|
| Remove target self-cross from identity branch | / | Retain the tested identity branch because removal gives lower reported MRR |
| Pooled-history residual | / | Omit to keep a pure interaction signal |
| Second similarity layer | / | Use one layer to retain the stated SP/PS guarantee |
| Uncrossed pooled history and projected target in MLP | / | Retain the fixed cross-only scorer |
| Projected target without uncrossed pooled history | / | If the scorer receives uncrossed inputs, pair the target with pooled history |
| Expert count | Changes sign across settings | Use 4 experts as the fixed default |
| Steam | ML-25M | |||||||
|---|---|---|---|---|---|---|---|---|
| Model | Params | HIT@10 | NDCG@10 | MRR | HIT@10 | NDCG@10 | MRR | Latency |
| TA-Transformer (1L, 1H) | 61.6k | .7695 | .5073 | .4370 | .9302 | .7189 | .6546 | 15.0 / 17.1 |
| TA-Transformer (2L, 2H) | 95.0k | .7960 | .5421 | .4727 | .9407 | .7399 | .6783 | 29.3 / 29.0 |
| TA-Transformer (2L, 2H, ) | 128.1k | .8080 | .5562 | .4867 | .9461 | .7519 | .6921 | 32.4 / 31.3 |
| MELODI | 132.9k | .7923 | .5405 | .4720 | .9510 | .7619 | .7033 | 2.0 / 2.0 |
| Model | Latency ( ) | NDCG@20 gain (%) |
|---|---|---|
| Tabular baseline | 1.0 | – |
| TA-Transformer | 201.8 | +8.8 |
| DIN | 80.9 | +8.8 |
| MELODI (candidate-flattened) | 40.0 | +11.3 |
| MELODI (history reused) | 15.6 | +11.3 |
| Model | Latency ( ) | NDCG@20 gain (%) |
|---|---|---|
| Tabular baseline | 1.0 | – |
| TA-Transformer | 142.1 | +2.3 |
| DIN | 55.1 | +2.7 |
| MELODI (candidate-flattened) | 18.7 | +3.2 |
| MELODI (history reused) | 4.9 | +3.2 |
| Dataset / Model | Flat. | Reuse | Lower bound |
|---|---|---|---|
| Industrial-A: MELODI | |||
| Industrial-B: MELODI |
| Model | Parameters | Configurations |
|---|---|---|
| SASRec | 127,936 | 2 |
| TA-Transformer (1 layer, 1 head) | 61,569 | 1 |
| TA-Transformer (2 layers, 2 heads) | 95,041 | 1 |
| TA-Transformer (2 layers, 2 heads, ) | 128,065 | 1 |
| DIN | 52,802 | 1 |
| DIN + DCN-v2 | 90,314 | 1 |
| Steam | ML-25M | |
| Users | 281,354 | 162,541 |
| Items | 11,961 | 32,720 |
| Item-table size | 11,963 | 32,722 |
| Training examples | 2,706,396 | 3,226,917 |
| Training prefixes per user | All | 20 most recent |
| Embedding source | all-MiniLM-L6-v2 (384-d) | all-MiniLM-L6-v2 (384-d) |
Learning to Rank
Learning to rank develops models that order items by relevance or utility for search, recommendations, and other decisions.
See all 315 papers