Recommender Systems with GNNs
What you'll learn: How to model users and items as a bipartite graph and apply GNNs to predict user preferences through collaborative filtering.
Core Idea
Traditional recommender systems treat users and items separately, using matrix factorization or neural networks on isolated features. But recommendations are inherently relational: users interact with items, items share similarities, and users have social connections. Graph Neural Networks excel here by treating recommendation as a graph learning problem.
User-Item Bipartite Graphs
A bipartite graph has two disjoint node sets: users and items. Edges connect users to items they've interacted with (clicked, purchased, rated). There are no user-user or item-item edges in the pure bipartite structure, though these can be added in heterogeneous graph extensions.
Think of it like a dance: users on one side, items on the other, and edges represent who's dancing with what. The pattern of connections reveals preferences.
How GNNs Enable Collaborative Filtering
GNNs perform message passing across this bipartite graph:
- User embeddings aggregate information from items they've interacted with
- Item embeddings aggregate information from users who liked them
- Multiple layers capture higher-order connectivity: "users who liked items that users like me also liked"
This naturally implements collaborative filtering: the network learns that if you and I liked similar items, we might enjoy each other's other choices. Unlike matrix factorization, GNNs can incorporate node features (user demographics, item attributes) and edge features (ratings, timestamps).
The final recommendation score is typically computed as the dot product between learned user and item embeddings, making link prediction between unseen user-item pairs straightforward.
Key Takeaway: GNNs transform recommender systems into graph link prediction tasks on user-item bipartite graphs, naturally encoding collaborative filtering through neighborhood aggregation and enabling rich feature integration beyond simple rating matrices.