Model-agnostic plug & play library for transferring and calibrating a trained recommender's scores onto cold-start items, plus a reproducible benchmark
Project description
English | Русский
warm-transfer
Model-agnostic plug&play library for transferring and calibrating the scores of an already-trained recommendation model onto new (cold-start) items under extreme sparsity, plus a reproducible benchmark.
Idea: you have a trained model of arbitrary architecture — the library "wraps" on top of its scores and ranks new products/content for which there are still no (or almost no) interactions. You don't need to retrain the model, and you don't need access to its internals either.
Structure
warmtransfer— lightweight core (plug&play). Works with donor scores + content. Installs without heavy recsys dependencies.methods/— cold-start methods (baselines, KNN, LinMap, Stacking, scale&shift, attention-KNN…)metrics/— our own correct metrics (Recall/Precision/MAP/NDCG@k, MRR, AUC, RelaImpr)similarity/— content similarity cold→warm (optional)
warmtransfer.bench— benchmark (heavy dependencies, extrabench).datasets/— loaders (ML-1M/20M, Goodbooks, KION/KION-text, Amazon Toys/-text, MIND/-text)splitters/— honest pseudo-cold split (anti-leakage)adapters/— donor models (ALS, BPR, CatBoost, EASE, Two-Tower)runner.py— running the matrix of datasets × donors × methods × baselines
Key result
The model-agnostic methods LinMap (Ridge: content → donor score vector) and stacking_plus
(hybrid: linmap signal + personalized popularity) beat the strong personalized
Grouped MP across a matrix of 8 dataset loaders × 5 donors (seed=42): score transfer beats
the baseline on per-user AUC in 36 of 40 dataset×donor cells (90%). The 4 misses are mostly on
ML-1M, where the baseline AUC (~0.72) is already strong. The five donors span four model families
(matrix factorization als/bpr, GBDT catboost, linear item-item ease, neural two_tower) — they are a
diversity axis for observing how transfer holds across donor types, not competitors to rank.
Naive methods (knn/attention/debiased/embedding_avg) lose to the baseline — they pull in neighbor
popularity. Caveat: these numbers are a single seed; targeted multi-seed runs on the marginal
cells are still pending. Details and tables — docs/results/full_matrix.md.
Plug&play usage (core, without the benchmark)
import numpy as np
import pandas as pd
from warmtransfer.columns import Columns as C
from warmtransfer.methods import LinMap
from warmtransfer.types import ItemFeatures, TransferInputs
warm_features = ItemFeatures(
item_ids=np.array([10, 11]),
matrix=np.array([[1.0, 0.0], [0.0, 1.0]]),
feature_names=["genre_action", "genre_drama"],
)
cold_features = ItemFeatures(
item_ids=np.array([20]),
matrix=np.array([[1.0, 0.0]]),
feature_names=["genre_action", "genre_drama"],
)
donor_scores = pd.DataFrame(
{
C.User: [1, 1, 2, 2],
C.Item: [10, 11, 10, 11],
C.Score: [5.0, 1.0, 1.0, 5.0],
}
)
# bring your own warm donor scores + content of warm/cold items
inputs = TransferInputs(
donor_scores=donor_scores,
warm_features=warm_features,
cold_features=cold_features,
)
reco = LinMap(alpha=1.0).fit(inputs, seed=42).predict(
user_ids=np.array([1, 2]),
cold_item_ids=np.array([20]),
)
Full runnable example: examples/quickstart.py.
Installation
uv sync # core + dev only
uv sync --extra bench # + donor engines and benchmark infrastructure
uv sync --extra all # + deep (torch)
Running
uv run pytest -q # core tests
uv run python examples/quickstart.py # minimal plug&play example
uv run warmbench --list-components # available datasets/donors/methods
uv run warmbench --config configs/example.yaml --dry-run
uv run warmbench --config configs/example.yaml # example benchmark run
Documentation
The documentation site is built with MkDocs Material (like RecTools) and published to
GitHub Pages automatically (.github/workflows/docs.yml) after a push to the GitHub repository.
Locally:
uv sync --group docs
uv run mkdocs serve # local preview at http://127.0.0.1:8000
uv run mkdocs build # static site in site/
Page sources:
docs/methods.md— description of the methodsdocs/datasets.md— description of the datasetsdocs/eval-protocol.md— split and metrics protocol (anti-leakage)docs/results/— result tables (full matrix, spread across seeds, ablations)docs/api.md— auto-generated API reference
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file warm_transfer-0.1.0.tar.gz.
File metadata
- Download URL: warm_transfer-0.1.0.tar.gz
- Upload date:
- Size: 298.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5a0488e31585478273c1cf2d3d85222fba0de13d674d968c67d148ee76afb68
|
|
| MD5 |
9ec25cb41e64b2c7956ef0b55d1a5983
|
|
| BLAKE2b-256 |
b9b2fb8ecf304ee7ac2c84882ae8d65c8beb5046d492b89a581e98b781d536d8
|
File details
Details for the file warm_transfer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: warm_transfer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 91.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c186b209e17e22cd5c04650f0c81add47dd43e2a0bc7e72f37ca205c7c0d626
|
|
| MD5 |
71d2466552cfba4350054cb0d6580b71
|
|
| BLAKE2b-256 |
9928f2a4d080518a334670afc82f7c48cb10b7efe639f42cb1d2925a69ea8af9
|