AnimeRecBERT is a personalized anime recommendation system based on BERT transformer architecture. Adapted from https://github.com/jaywonchung/BERT4Rec-VAE-Pytorch, this project introduces customizations tailored for an anime recommendation system and inference. Main dataset has 1.77M users and 148M ratings, in this project we used a subset of 560K users and 54M ratings for efficiency.
Full dataset used in this repo: https://github.com/MRamazan/AnimeRecBERT-Hybrid
This project provides a solid foundation for further development in personalized anime recommendation using transformer-based models.
- π No positional encoding, since the dataset contains no temporal information, i removed positional encoding and it performed better.
- π Anime-specific user-item dataset
- π₯οΈ GUI interface for real-time recommendations
- π Web Demo
In kaggle notebooks, full dataset used for training and inference instead of subset like in web demo.
Interactive Recommender notebook: https://www.kaggle.com/code/ramazanturann/animerecommenderbert-inference
Train notebook: https://www.kaggle.com/code/ramazanturann/animerecommenderbert-train
Web Demo: www.animerecbert.online (may be down due to 512MB free ram limit)
Huggingface Space: https://huggingface.co/spaces/mramazan/AnimeRecBERT
https://github.com/MRamazan/AnimeRecBertWeb
Model trained on a large-scale dataset with 560,000 users and 54 million ratings. Below are the Top-K recommendation metrics:
|
|
git clone https://github.com/MRamazan/AnimeRecBERT
cd AnimeRecBERTpython3 -m venv venv
source venv/bin/activate
python -m venv venv
venv\Scripts\activate
curl -L -o Data/AnimeRatings54M/animeratings-mini-54m.zip \
https://www.kaggle.com/api/v1/datasets/download/ramazanturann/animeratings-mini-54m
unzip Data/AnimeRatings54M/animeratings-mini-54m.zip -d Data/AnimeRatings54M/curl -L -o Data\AnimeRatings54M\animeratings-mini-54m.zip `
https://www.kaggle.com/api/v1/datasets/download/ramazanturann/animeratings-mini-54m
Expand-Archive -Path 'Data\AnimeRatings54M\animeratings-mini-54m.zip' -DestinationPath 'Data\AnimeRatings54M'Install PyTorch from https://pytorch.org/get-started/locally/
pip install -r requirements.txtpython inference_gui.py \
-c Data/AnimeRatings54M/pretrained_bert.pth \
-d Data/preprocessed/AnimeRatings54M_min_rating7-min_uc10-min_sc10-splitleave_one_out/dataset.pkl \
-a Data/AnimeRatings54M/animes.json \
--inference True \
--template train_bert you can set parameters in templates.py file
# This script will train, validate and test the model.
# Training not required for inference.
python main.py --template train_bert | # | Anime Title |
|---|---|
| 1 | Youkoso Jitsuryoku Shijou Shugi no Kyoushitsu e |
| 2 | Giji Harem |
| 3 | Ijiranaide, Nagatoro-san |
| 4 | 86 (Eighty-Six) |
| 5 | Mushoku Tensei: Isekai Ittara Honki Dasu |
| 6 | Made in Abyss |
| 7 | Shangri-La Frontier: Kusoge Hunter, Kamige ni Idoman to su |
| 8 | Vanitas no Karte |
| 9 | Jigokuraku |
Note: The position of favorites does not affect inference results, as the model uses only the presence of items (not sequence).
| Rank | Anime Title | Score |
|---|---|---|
| #1 | Yofukashi no Uta | 14.1062 |
| #2 | Summertime Render | 12.8611 |
| #3 | Mushoku Tensei II: Isekai Ittara Honki Dasu | 12.8518 |
| #4 | Tengoku Daimakyou | 12.7181 |
| #5 | Jujutsu Kaisen | 12.3117 |
| #6 | Horimiya | 12.0604 |
| #7 | Chainsaw Man | 11.7838 |
| #8 | 86 Part 2 | 11.7756 |
| #9 | Mushoku Tensei: Isekai Ittara Honki Dasu Part 2 | 11.6520 |
| #10 | Ore dake Level Up na Ken (Solo Leveling) | 11.6396 |
| #11 | Kage no Jitsuryokusha ni Naritakute! 2nd Season | 11.6270 |
| #12 | Youkoso Jitsuryoku Shijou Shugi no Kyoushitsu e 2nd Season | 11.5398 |
| #13 | Sousou no Frieren | 11.5376 |
| #14 | Tonikaku Kawaii (Tonikawa: Over the Moon for You) | 11.5205 |
| #15 | Cyberpunk: Edgerunners | 11.5020 |
| #16 | Tenki no Ko (Weathering With You) | 11.5014 |
| #17 | Dandadan | 11.4893 |
| #18 | Spy x Family | 11.4581 |
| #19 | Make Heroine ga Oosugiru! | 11.4468 |
| #20 | Boku no Kokoro no Yabai Yatsu | 11.4122 |
Out of the Top 20 recommendations, 10 titles were already in my completed/favorites list β showing strong personalization performance.
| Watched & Liked? β | Title |
|---|---|
| β | Mushoku Tensei II: Isekai Ittara Honki Dasu |
| β | Mushoku Tensei: Isekai Ittara Honki Dasu Part 2 |
| β | Youkoso Jitsuryoku Shijou Shugi no Kyoushitsu e 2nd Season |
| β | Make Heroine ga Oosugiru! |
| β | Spy x Family |
| β | Dandadan |
| β | 86 Part 2 |
| β | Jujutsu Kaisen |
| β | Chainsaw Man |
| β | Cyberpunk: Edgerunners |
Iβm genuinely excited to watch the remaining anime as well β even with a quick glance, itβs clear theyβre a great fit for my taste.

