MultiTRON is a session-based transformer capable of computing an efficient approximation of the Pareto front on multi-objective session-based recommendation tasks. This repository contains the official PyTorch Lightning implementation for our paper, accepted at ACM RecSys 2024: Pareto Front Approximation for Multi-Objective Session-Based Recommender Systems, authored by Timo Wilm, Philipp Normann and Felix Stepprath.
This work introduces MultiTRON, an approach that adapts Pareto front approximation techniques to multi-objective session-based recommender systems using a transformer neural network. Our approach optimizes trade-offs between key metrics such as click-through and conversion rates by training on sampled preference vectors. A significant advantage is that after training, a single model can access the entire Pareto front, allowing it to be tailored to meet the specific requirements of different stakeholders by adjusting an additional input vector that weights the objectives. We validate the modelβs performance through extensive offline and online evaluation. For broader application and research, the source code is made available. The results confirm the modelβs ability to manage multiple recommendation objectives effectively, offering a flexible tool for diverse business needs.
- Clone the repository:
git clone https://github.com/otto-de/MultiTRON.git
- Install the dependencies:
pip install pipenv
pipenv install --dev
- Execute the test scripts:
pipenv run pytest
- Install 7zip, gzip, and zip utilities on your system:
sudo apt-get install 7zip gzip unzip
- Prepare a dataset (e.g., diginetica, yoochoose or otto):
./prepare.sh yoochoose
- Run the main script with a configuration file:
pipenv run python -m src --config-filename yoochoose/tron_200hs_3l_256bs_10epoch_beta05_reg05
- After training compute the Pareto front for 25 points with the configuration file and a checkpoint:
pipenv run python -m src.pareto_front --config-filename yoochoose/tron_200hs_3l_256bs_10epoch_beta05_reg05 --checkpoint lightning_logs/version_1/checkpoints/multitron-yoochoose-epoch\=9-test_loss\=1.745.ckpt --number-points 25
- To visualize the Pareto Front run:
pipenv run python -m src.visualize --parteo-front-filename pareto-front.json --plot True
.
βββ Pipfile
βββ Pipfile.lock
βββ README.md
βββ configs # Contains experiment configuration files
βββ doc # Contains the paper and related files
βββ prepare.sh # Script to prepare datasets
βββ src # Source code for the models, Pareto front and visualization
βββ test # Test scripts
The config folder contains JSON configuration files for all experiments performed in our research. These configurations detail the model's parameters and options.
Here's an explanation of each parameter in the config file:
dataset
: The dataset to be used for training (e.g., "diginetica", "yoochoose", "otto").beta
: The two dimensionel diriclet vector to draw samples from during training.regularization
: The penalty of the non-uniformity loss (approximated EPO loss) regularization term.hidden_size
: The size of the hidden layers and item embeddings.num_layers
: The number of layers in the model.dropout
: The dropout rate applied to the model's layers.num_batch_negatives
: The number of negative samples from the batch. Limited bybatch_size
- 1.num_uniform_negatives
: The number of uniformly sampled negatives.reject_uniform_session_items
: If true, items from the same session won't be used as uniform negatives. Becomes slow ifnum_uniform_negatives
is large.reject_in_batch_items
: If true, items from the same session won't be used as batch negatives.sampling_style
: The style of negative sampling to use (e.g., "eventwise", "sessionwise", "batchwise"). Has significant impact on training speed.topk_sampling
: If true, top-k negative sampling is enabled.topk_sampling_k
: Iftopk_sampling
is true, this parameter specifies the number of top k negative samples to be used for training.loss
: The loss function to use (e.g., only ssm_and_be is implemented).max_epochs
: The maximum number of training epochs.batch_size
: The batch size used for training and validation.max_session_length
: The maximum length of a session. Longer sessions will be truncated.lr
: The learning rate for the optimizer.limit_val_batches
: The fraction of validation data to use for the validation step.accelerator
: The device type to be used for training (e.g., "gpu", "cpu").overfit_batches
: The fraction or number of batches of training data to use for overfitting. Set to 0 for no overfitting. See PyTorch Lightning docs for more details.share_embeddings
: If true, the embedding weights are shared between the input and output layers.output_bias
: If true, includes bias in the output layer.shuffling_style
: The style of shuffling to use for the training dataset (e.g., "no_shuffling", "shuffling_with_replacement", "shuffling_without_replacement").optimizer
: The optimizer to use for training (e.g., "adam", "adagrad")
{
"dataset": "otto",
"beta": [0.5, 0.5],
"regularization_penalty": 1.0,
"hidden_size": 200,
"num_layers": 3,
"dropout": 0.05,
"num_batch_negatives": 32,
"num_uniform_negatives": 16384,
"reject_uniform_session_items": false,
"reject_in_batch_items": true,
"sampling_style": "batchwise",
"topk_sampling": true,
"topk_sampling_k": 100,
"loss": "ssm_and_be",
"max_epochs": 10,
"batch_size": 256,
"max_session_length": 50,
"lr": 0.0001,
"limit_val_batches": 1.0,
"accelerator": "gpu",
"overfit_batches": 0,
"share_embeddings": true,
"output_bias": false,
"shuffling_style": "no_shuffling",
"optimizer": "adam"
}
For all config files used in our experiments, refer to the configs directory.
Contributions to MultiTRON are welcome and appreciated. For issues or suggestions for improvements, please open an issue or create a pull request. We believe that open source knowledge sharing is the best way to advance the field of recommender systems.
If MultiTRON aids your research, please consider citing our work:
@inproceedings{wilm2024pareto,
title={Pareto Front Approximation for Multi-Objective Session-Based Recommender Systems},
author={Wilm, Timo and Normann, Philipp and Stepprath, Felix},
year={2024}
}
This project is MIT licensed.
For any queries or questions, please reach out to us via our LinkedIn profiles:
For specific issues related to the codebase or for feature requests, please create a new issue on our GitHub page.
If this project aids your research or you find it interesting, we would appreciate it if you could star β the repository. Thanks for your support!