Hybrid GNNs for Recommendations

View as Markdown

Hybrid graph neural networks (GNNs) model both repeat purchases and exploration in one recommendation model. They combine a GNN backbone with separate scoring mechanisms for familiar and new items, then learn how to balance those behaviors for each user.

Source title: Understanding Hybrid Graph Neural Networks for Recommendations
Originally published: July 17, 2024
Authors: Matthias Fey and Weihua Hu

The recommendation problem

Recommendation systems power e-commerce, food delivery, and streaming platforms. Users behave in fundamentally different ways. Some are repeaters who buy the same items repeatedly, while others are explorers who continually seek novelty.

Most users do both depending on context. A customer might repeatedly order from the same grocery store while exploring new restaurants. Capturing both patterns in one model is the central challenge.

Why traditional approaches struggle

Production recommendation systems commonly use complex multi-stage pipelines. They combine candidate-generation steps such as collaborative filtering, content-based retrieval, and popularity fallbacks, then blend those candidates with ranking-model ensembles.

These pipelines also face cold start for users with sparse histories, limited data diversity, and the maintenance burden of many models that each capture a narrow part of user behavior.

Analogy: A traditional recommendation pipeline is like a restaurant with separate chefs for appetizers, entrees, and desserts, each working independently. A hybrid GNN is one chef who understands the whole meal and how each course relates to a diner’s preferences.

The limitation of a multi-stage pipeline is not only its engineering cost. Each stage optimizes independently, so cross-pattern signals between repeat and exploratory behavior can be lost.

Why graph neural networks

Four-stage recommendation GNN pipeline: represent users and items as a bipartite graph, sample each user's neighborhood, perform message passing, and predict future user-item links.

Recommendation data naturally forms a bipartite graph. Users and items are nodes, while purchases, clicks, and orders are edges between them. Those edges can carry timestamps, prices, ratings, and other features, and multiple edges can connect the same user-item pair to represent repeat purchases over time.

This turns recommendation into a link-prediction task: given prior interactions, predict the user-item edges that will form in the future.

GNNs learn directly from this connectivity instead of relying only on hand-engineered features. When a GNN processes a user node, it aggregates signals from neighboring items, which can in turn aggregate signals from other users who interacted with them. Multi-hop message passing therefore captures collaborative patterns automatically.

Traditional models require an engineer to encode features such as purchase counts by category, average time between orders, or co-purchase frequency. A GNN can learn these relationships from the graph without manually specifying them.

Graph structure can encode co-purchased items, clusters of users with shared behavior, and changing interaction patterns that a flat feature table cannot represent directly.

The hybrid GNN architecture

Hybrid GNN architecture with repeat scoring for previously seen items, explore scoring for new items, and a learned repetition scalar that balances the two scores per user.

The hybrid GNN uses one GNN backbone and two different scoring mechanisms, unified by a learned, user-specific repetition scalar.

For each user, the model samples a one-hop neighborhood containing previously interacted items and their features, such as timestamps, prices, and categories. A heterogeneous GNN computes embeddings for users and items in that subgraph.

The architecture then has three parallel components:

Repeat scoring

For items a user has previously interacted with, the model applies a multi-layer perceptron (MLP) to the GNN-computed embeddings. Because these items appear in the sampled subgraph, the model can use rich context: when the user last purchased the item, how often they buy it, and how it relates to other purchases.

Explore scoring

For items outside the user’s subgraph, the model takes an inner product between the user’s GNN embedding and shallow item embeddings. This resembles the standard two-tower recommendation architecture, but functions as one component of the larger hybrid model.

Repetition scalar

An MLP predicts a per-user scalar that balances repeat and explore scores. Users with a stronger tendency to repurchase receive a higher repetition weight, while explorers receive a lower one. This is learned from each user’s interaction history rather than set as a global hyperparameter.

Analogy: In music recommendations, repeat scoring handles “play it again” behavior and explore scoring handles “discover weekly.” The repetition scalar can learn that a listener replays music during weekday commutes but explores on weekend evenings.

All three components train end-to-end in one optimization loop. The model does not require separate training stages or hand-tuned blending weights.

Kaggle H&M benchmark results

The hybrid GNN was evaluated on Kaggle’s H&M Personalized Fashion Recommendations challenge. The dataset contains 1.4 million users, 106,000 items, and 31.7 million interactions across two years of purchase history.

The task is to predict the top 12 items that each user will purchase in the next seven days, measured by Mean Average Precision at 12 (MAP@12).

MethodMAP@12Compared with hybrid GNN
Hybrid GNN0.031Baseline
Kaggle top 10%0.024-23%
Kaggle median0.021-32%

The source reports that the hybrid GNN placed in the top 1% of more than 3,000 submissions and achieved 47% better performance than the Kaggle median. It used the raw interaction graph without feature engineering, and training and inference ran in approximately two hours on a single GPU.

Why both scoring approaches matter

Scoring approachMAP@12Hybrid GNN advantage
Approach 1 only - MLP for seen items0.023+35%
Approach 2 only - inner product / two-tower0.015+107%
Full hybrid GNN0.031Baseline

Neither individual approach matches the full model. The source reports that explore-only scoring, the standard two-tower pattern, reaches 0.015 MAP@12, while repeat-only scoring reaches 0.023.

Production results: food delivery

Comparison of a traditional multi-stage pipeline, a two-tower explore-only model, and a hybrid GNN that combines repeat and exploratory behavior in one model.

The source describes a deployment at a major food delivery service for restaurant recommendations, covering more than 600,000 restaurant options with a seven-day prediction window.

MethodMAP@12
Hybrid GNN0.32
Approach 1 only - repeat scoring0.31
Approach 2 only - explore scoring0.27

In food delivery, repeat scoring comes close to the full hybrid model because reordering restaurants is common. The exploratory component still improves results by covering the 10 to 20% of orders in which users try something new. The source attributes more than $100 million in additional sales to that marginal improvement.

The source’s central result is structural: a single end-to-end model can capture interactions between repeat and exploratory behavior that independent pipeline stages cannot share.

Technical advantages and trade-offs

Zero feature engineering and end-to-end optimization

The model can work from user IDs, item IDs, timestamps, and available node or edge features. It learns temporal patterns, co-occurrence signals, and useful feature combinations from the graph. The repeat scorer, explore scorer, and repetition scalar share gradients during training, so each learns alongside the others.

Scalability

On H&M, the source reports that 1.4 million users, 106,000 items, and 31.7 million interactions trained in roughly two hours on one GPU. One-hop neighbor sampling bounds per-user computation as the total graph grows.

Where the approach fits

Hybrid GNNs are strongest where users exhibit both repeat and exploratory behavior, including e-commerce, food delivery, streaming, and grocery. For one-time purchases such as real estate or automobiles, repeat scoring adds less value, although the GNN backbone can still model relational patterns.

Implications for recommendation teams

Production workflow from raw timestamped interactions through bipartite graph construction and hybrid GNN training to top-K recommendations.

Repeat behavior should be treated as a first-class signal rather than discarded as already known. The food-delivery results show why it can dominate in repeat-heavy domains.

Graph structure can replace much of the feature-engineering workflow by retaining relationships, time, and connectivity in the input representation. When one model is expressive enough to learn both behavioral modes, it can be simpler to operate than a specialized ensemble.

A hybrid GNN simplifies recommendation architecture by using fewer models, fewer stages, and fewer hand-tuned parameters while modeling both repeated and novel interactions.