Trained weights and artifacts for tmoula/trivago-recsys-moe, the Polanyi Labs prototype. It does session-based hotel recommendation on the Trivago RecSys Challenge 2019 data. It also includes an experimental persona-conditioned mixture-of-experts bridge that transfers retail browsing behaviour (Yoochoose, RecSys Challenge 2015) into the travel domain.
The code (model classes, preprocessing, training and inference scripts) lives on GitHub. This repo only hosts the files too large for git.
| File | Size | What it is |
|---|---|---|
context_sasrec_best.pt |
413 MB | ContextAwareSASRec state dict: 103M params, 400,277 hotel/reference tokens, 10 action types, hidden size 128, 2 transformer layers, 4 heads |
mappings.pkl |
10 MB | action2idx, ref2idx, idx2ref for the checkpoint above. Rebuilt from the sorted train.csv so the ids line up with the checkpoint |
sasrec_source_encoder.pt |
67 MB | Phase 1 SASRecSourceEncoder (52,739 Yoochoose items, hidden size 256, 4 layers), pre-trained on next-click prediction |
archetypes.json |
small | 7 behavioural shopper archetypes (K-Means over Yoochoose sessions): label, description, centroid features |
persona_P_vectors.npy |
2.8 MB | [50000, 7] persona-to-archetype mixtures for the 50k Nemotron personas |
archetype_embeddings_v2.npy |
29 KB | [7, 1024] unit-normalized BAAI/bge-large-en-v1.5 embeddings of the archetype descriptions |
git clone https://github.com/tmoula/trivago-recsys-moe && cd trivago-recsys-moe
pip install -e .
python scripts/download_weights.py # pulls this repo into ./artifacts
python scripts/recommend.py --events "search for destination:0" "interaction item image:9753022" "clickout item:9753022"
Or in Python:
import pickle, torch
from huggingface_hub import hf_hub_download
from trivago_moe.models import ContextAwareSASRec
repo = "tmoula/trivago-recsys-moe"
mappings = pickle.load(open(hf_hub_download(repo, "mappings.pkl"), "rb"))
model = ContextAwareSASRec(num_refs=mappings["NUM_REFS"], num_actions=mappings["NUM_ACTION_TYPES"])
model.load_state_dict(torch.load(hf_hub_download(repo, "context_sasrec_best.pt"), map_location="cpu"))
model.eval()
The model takes two left-padded [batch, 20] tensors, ref_ids and action_ids, and returns logits over all 400,278 tokens (index 0 is padding). Decode the results with mappings["idx2ref"].
| Data | Trivago RecSys 2019 train.csv: 649,297 sessions that contain a clickout, split randomly 80/10/10 |
| Target | the last clickout item reference in each session |
| Input | the last 20 (reference, action type) events of the session |
| Optimisation | Adam, lr 1e-3, StepLR(5, 0.5), batch 2048, 20 epochs, best val HR@10 checkpoint, 1×A100 |
| Metric (test split) | Value |
|---|---|
| HR@10 | 0.753 |
| HR@20 | 0.755 |
⚠️ These numbers are inflated by target leakage. The input window includes the target clickout itself, so the model mostly learns to copy the last clicked hotel. That is why HR@10 and HR@20 are almost the same. Treat this checkpoint as a pipeline and demo artifact, not a benchmark result. The GitHub repo has a leak-free training option (
scripts/train_context_sasrec.py --exclude-target).
Other known limitations:
"0" for empty), so check that a predicted id is a real hotel before showing it to users.See Known issues on GitHub for details.
Code and weights: MIT. The underlying datasets keep their own terms.
context_sasrec_best.pt 394 MiBsasrec_source_encoder.pt 64 MiB