An inter- and intra-attention model for multi-behavior recommendation

Shereen Elsayed, Ahmed Rashed, Lars Schmidt-ThiemeInt. J. Data Sci. Anal 2025

Introduction

In modern e-commerce and content platforms, user interaction is rarely a single-step process. Before a final purchase or high-value action occurs, users typically engage in a variety of "auxiliary" behaviors, such as clicking an item, adding it to a wishlist, or favoriting it. These multi-behavior sequences provide a rich tapestry of user intent that traditional single-behavior recommendation systems often overlook.

IIARec (Inter- and Intra-attention Recommendation) is a novel framework designed to harness these diverse signals. By employing a hierarchical attention mechanism and tracking historical behavior patterns, IIARec significantly improves the accuracy of sequential recommendations on large-scale datasets.

The Challenge of Multi-Behavior Sequences

Existing recommendation models often fall into two traps. Graph-based models (GNNs) are excellent at capturing relationships between items and behaviors but often struggle to maintain the strict temporal order of interactions, which is vital for understanding a user's evolving journey. On the other hand, standard sequential models like SASRec treat all interactions as equal, failing to distinguish between a casual click and a high-intent "add-to-cart" action.

IIARec bridges this gap by explicitly modeling the nuances of different behavior types while preserving the chronological flow of the user's history.

The IIARec Architecture

The model processes user sequences through a sophisticated pipeline that separates behavior-specific patterns before integrating them into a global context.

The overall architecture of the IIARec model, showing the flow from ID and indicator embeddings to the hierarchical attention layers.

Historical Behavior Indicators (HBI)

A key innovation in IIARec is the use of Historical Behavior Indicators (HBI). Instead of relying solely on an item's ID, the model tracks the frequency of each behavior type for that item within the user's history. This allows the model to differentiate between an item a user has clicked once versus one they have favorited multiple times, providing a much clearer signal of preference.

An example of a multi-behavior sequence where items are associated with specific action types and frequency indicators.

Hierarchical Masked Attention

The core of the model is its two-stage attention mechanism:

  1. Intra-behavior Attention: The model first applies self-attention specifically to items associated with the same behavior (e.g., analyzing only the sequence of "clicks"). This captures deep patterns within specific intent types, such as a user's browsing style.
  2. Inter-behavior Attention: Following the intra-behavior stage, the model applies attention across the entire sequence. This allows it to learn how different behaviors influence each other over time—for instance, how a series of "clicks" on various items might eventually converge into a "purchase" of a specific product.

Multitask Learning and Stability

To further refine its understanding of user intent, IIARec is trained using a multitask learning objective. It simultaneously solves two problems:

  • Item Ranking: Predicting which specific item the user will interact with next.
  • Behavior Prediction: Predicting the type of the next interaction (e.g., will the user click or buy?).

This auxiliary task forces the model to learn more robust behavioral representations. Additionally, the model utilizes ReZero residual connections—initializing residual weights to zero—to ensure stable training even as the attention architecture grows deeper.

Experimental Results

IIARec was evaluated against state-of-the-art baselines (including KHGT, MBHT, and CARCA) across four major datasets: Taobao, Tianchi, Yelp, and MovieLens. The results demonstrated significant performance gains:

  • Taobao: Achieved a 10.66% improvement in Hit Ratio (HR@10) and a 10.12% improvement in NDCG@10 over the best baseline.
  • Tianchi: Showed a 6.37% improvement in HR@10 and 7.76% in NDCG@10.

The model proved particularly effective in e-commerce settings where the frequency of auxiliary behaviors (like "favoriting") is a strong predictor of future purchases.

Conclusion

By separating behavior-specific signals before integrating them into a global temporal sequence, IIARec offers a more nuanced approach to multi-behavior recommendation. Its success highlights that how a user interacts with a platform is just as important as what they are looking at. While the hierarchical approach adds computational complexity, the gains in recommendation accuracy make it a compelling framework for modern, high-traffic e-commerce environments.

Summary updated

BibTeX
@article{elsayed2025inter,
  author = {Shereen Elsayed and Ahmed Rashed and Lars Schmidt-Thieme},
  title = {{An inter- and intra-attention model for multi-behavior recommendation}},
  journal = {Int. J. Data Sci. Anal.},
  year = {2025},
  doi = {10.1007/s41060-025-00839-3},
}
Figure