Skip to content

Official implementation of "A BERT-Based Multi-Embedding Fusion Method Using Review Text for Recommendation" (Expert Systems, 2025)

Notifications You must be signed in to change notification settings

fkid009/MFNR-Pytorch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A BERT-Based Multi-Embedding Fusion Method Using Review Text for Recommendation

Official implementation of the paper:

Lim, H., Li, Q., Yang, S., & Kim, J. (2025). A BERT‐Based Multi‐Embedding Fusion Method Using Review Text for Recommendation. Expert Systems, 42(5), e70041. Paper Link

Overview

This repository provides the official implementation of MFNR (Multi-Embedding Fusion Network for Recommendation), which enhances review-based recommendation by combining multiple pre-trained language models. MFNR integrates BERT and RoBERTa embeddings to capture richer user and item features from textual reviews. Experiments on Amazon and Goodreads datasets show that MFNR outperforms baseline models with an average improvement of 9.18% in RMSE and 14.81% in MAE, demonstrating the effectiveness of the multi-embedding fusion approach for recommender systems.

Requirements

  • Python 3.10
  • pandas==2.2.3
  • numpy==1.26.4
  • ipykernel==6.29.5
  • scikit-learn==1.5.2
  • transformers==4.44.2
  • torch==2.4.1
  • torchvision==0.19.1
  • pyarrow==17.0.0

Install dependencies:

pip install -r requirements.txt

Repository Structure

Below is the project structure for quick reference.

├── data/                        # Dataset directory
│   ├── raw/                     # Original (unprocessed) datasets
│   └── processed/               # Preprocessed data for training/evaluation
│
├── model/                       # Model definitions and checkpoints
│
├── src/                         # Core source code
│   ├── bert.py                  # BERT-based embedding and feature extraction module
│   ├── config.yaml              # Model and training configuration file
│   ├── path.py                  # Path and directory management utilities
│   └── utils.py                 # Helper functions (data loading, metrics, etc.)
│
├── main.py                      # Entry point for model training and evaluation
│
├── requirements.txt             # Python package dependencies
│
├── README.md                    # Project documentation
│
└── .gitignore                   # Git ignore configuration

Model Description

MFNR (Multi-Embedding Fusion Network for Recommendation) is a review-based recommendation model that leverages BERT and RoBERTa to extract rich semantic features from textual reviews.

The model consists of two parallel networks:

  • UPM (User Preference Modeling): captures user preferences from reviews written by users.
  • IFM (Item Feature Modeling): extracts item features from reviews written about items.

Both networks share the same architecture but focus on different perspectives. The latent representations generated by UPM and IFM are combined and passed through a rating prediction network, which models nonlinear user–item interactions to predict ratings.

MFNR Model Architecture

How to Run

Environment Setup

Create a virtual environment and install all dependencies:

conda create -n mfnr python=3.10
conda activate mfnr
pip install -r requirements.txt

Data Preparation

Place your dataset in the data/raw/ folder and preprocess it:

# Example: preprocess raw data and save to data/processed/
python src/utils.py --mode preprocess

Train the Model

Run the training script with configuration file:

python main.py --config src/config.yaml --mode train

Evaluate the Model

After training, evaluate using the saved checkpoint:

python main.py --config src/config.yaml --mode test

Experimental Results

The performance of MFNR was evaluated on four real-world review datasets: Industrial and Scientific, Musical Instruments, Prime Pantry, and Goodreads. Results show that the proposed model consistently outperforms existing baselines in both RMSE and MAE metrics.

Model Industrial and Scientific Musical Instruments Prime Pantry Goodreads
RMSEMAE RMSEMAE RMSEMAE RMSEMAE
MF1.4301.3421.4331.3441.4211.3311.2460.967
PMF1.2771.2451.3081.2701.2801.2391.2220.960
HFT1.2751.0561.2711.0681.2131.0151.1210.875
DeepCoNN1.2310.9291.1710.9161.1420.9041.1130.778
NARRE1.1260.8431.1040.8411.0900.8420.9760.749
DAML1.1020.8391.0990.8331.0330.8260.9690.739
AENAR1.1000.8361.0980.8311.0280.8170.9680.738
SAFMR1.1000.8331.0970.8301.0230.8020.9660.735
Proposed (MFNR)1.0870.8031.0940.8231.0170.7630.9650.724

Citation

If you find this work useful in your research, please cite our paper:

@article{lim2025bert,
  title     = {A BERT-Based Multi-Embedding Fusion Method Using Review Text for Recommendation},
  author    = {Lim, H. and Li, Q. and Yang, S. and Kim, J.},
  journal   = {Expert Systems},
  volume    = {42},
  number    = {5},
  pages     = {e70041},
  year      = {2025},
  publisher = {Wiley},
  doi       = {10.1111/exsy.70041}
}

Contact

For questions, collaborations, or feedback, please contact:
Qinglong Li (이청용)
Assistant Professor, Division of Computer Engineering, Hansung University
Email: leecy@hansung.ac.kr

Last updated: October 2025

About

Official implementation of "A BERT-Based Multi-Embedding Fusion Method Using Review Text for Recommendation" (Expert Systems, 2025)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%