[Paper Review] Learning to Hash with Graph Neural Networks for Recommender Systems
This paper proposes HashGNN, a novel end-to-end framework that jointly learns continuous graph embeddings and discrete binary hash codes using graph neural networks for efficient recommendation retrieval. By introducing a guided straight-through estimator to stabilize training and optimizing both link reconstruction and ranking preservation, HashGNN achieves performance comparable to continuous models while accelerating inference by multiple times.
Graph representation learning has attracted much attention in supporting high quality candidate search at scale. Despite its effectiveness in learning embedding vectors for objects in the user-item interaction network, the computational costs to infer users' preferences in continuous embedding space are tremendous. In this work, we investigate the problem of hashing with graph neural networks (GNNs) for high quality retrieval, and propose a simple yet effective discrete representation learning framework to jointly learn continuous and discrete codes. Specifically, a deep hashing with GNNs (HashGNN) is presented, which consists of two components, a GNN encoder for learning node representations, and a hash layer for encoding representations to hash codes. The whole architecture is trained end-to-end by jointly optimizing two losses, i.e., reconstruction loss from reconstructing observed links, and ranking loss from preserving the relative ordering of hash codes. A novel discrete optimization strategy based on straight through estimator (STE) with guidance is proposed. The principal idea is to avoid gradient magnification in back-propagation of STE with continuous embedding guidance, in which we begin from learning an easier network that mimic the continuous embedding and let it evolve during the training until it finally goes back to STE. Comprehensive experiments over three publicly available and one real-world Alibaba company datasets demonstrate that our model not only can achieve comparable performance compared with its continuous counterpart but also runs multiple times faster during inference.
Motivation & Objective
- To address the inefficiency of continuous embedding inference in large-scale recommender systems' recall stage.
- To bridge the gap between high-quality continuous embeddings and efficient binary hashing for scalable retrieval.
- To enable end-to-end training of deep hashing with graph neural networks, overcoming the non-differentiability of the sign function.
- To preserve relative ranking order in hash codes to ensure effective Hamming space retrieval.
- To develop a stable optimization strategy that avoids gradient noise in discrete hashing training.
Proposed method
- A two-stream architecture: a GNN encoder for continuous node representations and a hash layer for mapping to binary codes via the sign function.
- Joint optimization of two losses: reconstruction loss to recover observed user-item interactions and ranking loss to preserve relative similarity ordering of hash codes.
- A novel guided straight-through estimator (STE) that uses continuous embedding signals to stabilize gradient back-propagation through the sign function.
- Dynamic adjustment of the trade-off hyperparameter $p$ to gradually shift from continuous to discrete optimization, improving training stability and convergence.
- Triplets of (user, positive item, negative item) are used to construct ranking signals for the ranking loss.
- The model is trained end-to-end with back-propagation, where the guided STE enables effective gradient flow despite the non-differentiable sign operation.
Experimental results
Research questions
- RQ1Can deep hashing with GNNs achieve performance on par with continuous embeddings while enabling faster inference?
- RQ2How can gradient flow be stabilized through the non-differentiable sign function in end-to-end hashing training?
- RQ3Does preserving relative ranking order in hash codes improve retrieval effectiveness in Hamming space?
- RQ4How does the dynamic adjustment of the optimization trajectory affect model convergence and performance?
- RQ5Can the proposed method be flexibly extended to various GNN architectures in recommendation systems?
Key findings
- HashGNN achieves retrieval performance comparable to its continuous GNN counterpart on three public and one real-world Alibaba dataset.
- The model runs multiple times faster during inference than continuous embedding-based methods due to compact binary codes.
- The guided straight-through estimator significantly improves training stability and performance compared to standard STE, reducing gradient noise.
- Dynamic adjustment of the hyperparameter $p$ leads to better performance than fixed $p$, as it decomposes the hard discrete optimization into easier sub-tasks.
- The model is robust to varying numbers of triplets, with optimal performance when 4–10 triplets per user are used.
- Increasing the hash code dimension $K$ improves performance, especially at smaller values, though gains diminish at larger $K$.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.