Jinfeng-Xu/Multimodal-Recommendation-Library
A Continuously Updated Library for Advanced Models for Multimodal Recommendation
MRLib: A Library for Multimodal Recommendation
MRLib (short for Multimodal Recommendation Library) is an open-source, research-oriented codebase for building and testing multimodal recommender systems — recommendation algorithms that use not just user–item interactions but also extra "modalities" like images, text, or audio attached to items.
What problem does it solve?
Recommender systems suggest items (products, videos, etc.) to users. Traditional systems only use interaction data (who clicked/bought what). Multimodal recommenders additionally exploit item content — e.g., a product photo, a movie's text description, or a video's audio track — to make better suggestions. MRLib gives researchers a single, unified place to implement, train, and compare such models.
Key features (from the README)
- Automatic modality discovery — The library automatically detects feature files named
*_feat.npyor*_feat.ptin your dataset folder. It supports visual, textual, audio, and other modalities, and loads only the ones that exist for a given dataset. No manual configuration needed. - Intelligent graph caching — Many multimodal models build an "item graph" (connections between similar items). MRLib caches these graphs per model, verifies that cached parameters match the current configuration, and stores metadata about how the graph was built — so you don't rebuild expensive graphs repeatedly.
- Real-time visualization — During training, it plots loss and metrics live, and automatically identifies the best epoch.
- Continuous updates — The model list is regularly extended with state-of-the-art methods from top conferences.
- Dataset support — Includes Amazon datasets (Baby, Sports, Clothing, Pet, Office, Toys, Beauty, etc.), video datasets (TikTok, Microlens), and custom datasets with a clearly specified format.
Supported models
The README lists 26 models, sorted by publication year, from VBPR (AAAI 2016) to IIMRec (ACM MM 2026). They come from venues like AAAI, ACM MM, WWW, SIGIR, KDD, NeurIPS, CIKM, WSDM, ECAI, and IEEE TMM. Each model has a link to its paper. Examples include MMGCN, LATTICE, BM3, MMSSL, FREEDOM, LGMRec, DiffMM, MENTOR, SMORE, COHESION, SSR, HPMRec, and others.
Quick start
# Clone and install (tested with CUDA 12.1)
git clone https://github.com/Jinfeng-Xu/Multimodal-Recommendation-Library
cd Multimodal-Recommendation-Library
pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
# Run a model on a dataset
python src/main.py -m HPMRec -d baby
# Specify a GPU
python src/main.py -m COHESION -d sports --gpu_id 1
# Disable visualization
python src/main.py -m FREEDOM -d clothing --no-vis
Models are configured via YAML files in src/configs/model/ — e.g., HPMRec.yaml contains settings like embedding size, number of layers, and regularization weights.
Dataset format
Each dataset lives in a folder named after it, containing:
{dataset_name}.inter— a tab-separated file with columnsuserID,itemID,x_label, wherex_labelis0for training,1for validation, and2for testing.- Optional feature files like
visual_feat.npy,textual_feat.npy, or any*_feat.npy/*_feat.pt— each a matrix of shape[num_items, feature_dim].
Architecture
The code is organized as:
MRS/
├── src/
│ ├── main.py # Entry point
│ ├── models/ # Model implementations (hpmrec.py, cohesion.py, ...)
│ ├── utils/ # graph_cache.py, dataset.py, dataloader.py, visualization.py, quick_start.py
│ ├── configs/model/ # YAML model configurations
│ └── log/ # Training logs & visualizations
data/ # Datasets
data/cache/ # Graph caches
(Note: the README's architecture diagram uses the folder name MRS/, while the project itself is called MRLib.)
Performance benchmarks
The README includes a detailed benchmark table for the Baby dataset, reporting test-set metrics — Recall, NDCG, Precision, and MAP at cutoffs 10, 20, and 50 — for all 26 models. Medals (🥇/🥈/🥉) mark the top three values per metric. According to the table, IIMRec achieves the best or tied-best score on nearly every metric on this dataset. Results for other datasets are said to be "coming soon."
Advanced usage
- Evaluation metrics — Defaults are Recall@N and NDCG@N with N = 10 or 20. The full set includes Recall, NDCG, Precision, and MAP at @5, @10, @20, @50.
- Adding a custom model — Create a file in
src/models/, inherit fromGeneralRecommender, implement four methods (__init__,forward,calculate_loss,full_sort_predict), and add a YAML config. - Graph cache management — A
GraphCacheManagerutility lets you save and load item graphs with metadata. - Custom visualization — A
TrainingVisualizerutility logs per-epoch metrics and saves plots.
Contributing, citation, license
- Contributions are welcome — bug fixes via pull requests, and new models following the existing code style.
- If you use the library in research, the README asks you to cite a survey paper (TMM 2026) on multimodal recommender systems.
- The project is released under the MIT License.
- The code structure is based on the MMRec project, and the paper list references the Awesome-Multimodal-Recommender-Systems repository.
Contact
Questions and discussions go through GitHub Issues and GitHub Discussions on the project page.
Related
- Project
- Project
- Project
- Project
- Project