Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

From Past To Path: Masked History Learning for Next-Item Prediction in Generative Recommendation

ACL 2026 Main Conference

This is the official repository for MHL, accepted to ACL 2026 Main Conference.

MHL is a novel training framework for generative recommendation that shifts the objective from simple next-step prediction to deep comprehension of history. It augments the standard autoregressive objective with an auxiliary task of reconstructing masked historical items, compelling the model to understand "why" an item path is formed from the user's past behaviors. The framework features an entropy-guided masking policy that intelligently targets the most informative historical items, and a curriculum learning scheduler that progressively transitions from history reconstruction to future prediction.

MHL Method


Quick Setup

Create and activate a new conda environment named MHL_env:

conda create -n MHL_env python=3.10 -y && conda activate MHL_env && pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124 && pip install -r requirements.txt

Repository Structure

genrec/
├── pipeline.py              # Training/evaluation orchestration
├── trainer.py               # Training logic with curriculum learning scheduler
├── model.py                 # Abstract model base class
├── dataset.py               # Abstract dataset base class
├── tokenizer.py             # Abstract tokenizer base class
├── evaluator.py             # Metrics computation (recall, NDCG)
├── utils.py                 # Configuration, logging, utilities
├── default.yaml             # Default training configuration
├── models/
│   └── MHL/
│       ├── model.py         # Core MHL model implementation
│       ├── tokenizer.py     # Semantic ID tokenization
│       └── config.yaml      # Model-specific hyperparameters
└── datasets/
    └── AmazonReviews2014/
        ├── dataset.py       # Amazon dataset loader
        └── config.yaml      # Dataset configuration

Configuration Files

Key hyperparameters are organized across three configuration files:

File Description
genrec/default.yaml Default training settings (batch size, learning rate, epochs, evaluation metrics)
genrec/models/MHL/config.yaml Model architecture (codebooks, masking strategy, curriculum learning parameters)
genrec/datasets/AmazonReviews2014/config.yaml Dataset configuration (category, metadata type, split strategy)

Quick Start

Sports and Outdoors

CUDA_VISIBLE_DEVICES=0 python main.py \
    --category=Sports_and_Outdoors \
    --lr=0.003 \
    --temperature=0.03 \
    --n_codebook=32 \
    --num_beams=100 \
    --n_edges=200 \
    --propagation_steps=2 \
    --mask_strategy=entropy_token \
    --mask_ratio=0.10 \
    --recon_loss_weight=1.2

Beauty

CUDA_VISIBLE_DEVICES=0 python main.py \
    --category=Beauty \
    --lr=0.01 \
    --temperature=0.03 \
    --n_codebook=16 \
    --num_beams=100 \
    --n_edges=100 \
    --propagation_steps=3 \
    --mask_strategy=entropy_token \
    --mask_ratio=0.15 \
    --recon_loss_weight=1.0

Toys and Games

CUDA_VISIBLE_DEVICES=0 python main.py \
    --category=Toys_and_Games \
    --lr=0.003 \
    --temperature=0.03 \
    --n_codebook=32 \
    --num_beams=200 \
    --n_edges=100 \
    --propagation_steps=5 \
    --mask_strategy=entropy_token \
    --mask_ratio=0.05 \
    --recon_loss_weight=1.8

About

[ACL 2026] From Past To Path: Masked History Learning for Next-Item Prediction in Generative Recommendation

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages