arXiv:2608.27413cs.IRAug 2026

Manuscript Offprint

arXiv:2608.27413

Scaling Graph Neural Networks for Friend Recommendation: Multi-Hash User Embeddings and Temporal Neighbor Sampling

Maksim Utushkin, Andrei Ovsiannikov, Alexander D'yakonov

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Friend recommendation is inherently graph-structured: the relevance of a potential connection depends on multi-hop social context rather than user attributes alone. However, deploying message-passing GNNs on a production-scale social graph with hundreds of millions of users and tens of billions of edges requires addressing numerous modeling and systems challenges. We present a scalable end-to-end GNN ranking system for production social graphs, focusing on two design choices that are critical in this setting: multi-hash ID embeddings and temporal neighbor sampling. Multi-hash embeddings are common for high-cardinality features, but industrial GNN systems typically either ignore trainable IDs or accept full embedding tables — exceeding 200 GB for our graph. We integrate multi-hash as the primary node representation, reducing the ID-embedding table size by >98% while preserving ranking quality. Temporal neighbor sampling is well understood in principle, but existing implementations scan full adjacency lists — a non-starter for users with tens of thousands of friends. We implement timestamp-sorted CSR storage with binary search, reducing the per-node temporal sampling cost from O(deg⁡(v)+k)\mathcal{O}(\deg(v) + k) to O(log⁡deg⁡(v)+k)\mathcal{O}(\log \deg(v) + k). Beyond these components, we show that this combination scales and yields measurable production impact. On a graph with 194M users and 28B edges, offline ablations isolate each design choice's contribution. In an online A/B test, our system increases friend additions from recommendations by 16% and unique friend adders by 11.5% over a strong production baseline. We release our framework for distributed training and inference on large temporal graphs.

Keywords: friend recommendation, graph neural networks, industrial recommender systems, large-scale graph learning, social graph mining, multi-hash embeddings, temporal neighbor sampling.

1 Introduction

Friend recommendation, often surfaced to users as “People You May Know” (PYMK), is a core mechanic of any social network: it drives growth and connectivity of the social graph and, indirectly, downstream content consumption. In production, the task is typically organized as a two-stage funnel of candidate generation followed by ranking, with the ranker applied across several recommendation surfaces. In this paper we focus on the ranking stage and treat it as a learning-to-rank problem over user–candidate pairs.

The signal that matters most for friend ranking lives in the structure of the social graph: who is connected to whom, how dense the local neighborhood around a user is, and how the neighborhoods of two users overlap. Graph neural networks (GNNs) are a natural fit, because message passing aggregates exactly this multi-hop information into a node representation. There is by now a sizable body of work on GNNs for recommendation, and several industrial systems have reported online wins from GNN-based rankers [1, 2, 3, 4].

In our experience, applying a GNN at this scale is less a question of which message-passing layer to use and more about a number of design decisions that dominate everything else in practice.

∗^{*}Accepted at the 35th ACM International Conference on Information and Knowledge Management (CIKM 2026).

Three constraints shape the system in practice. (i) Scale: our graph has roughly 194M nodes and 28B edges, so storage and sampling are engineering problems in their own right. (ii) Weak node content: profile attributes carry little signal, but a trainable per-user ID table is not affordable — a 200M×256200M \times 256 float32 table is itself ≈205\approx 205 GB. (iii) Dynamic graph: training on time-ordered events while message-passing over the end-of-dataset graph leaks future edges; the obvious fix becomes bottleneck for hub users with deg⁡∼104\deg \sim 10^4.

Our approach. We tackle the three constraints with two design choices we found load-bearing in practice. User IDs enter the GNN through a multi-hash layer that maps every user into a shared table of size B≪∣V∣B \ll |V|, replacing the infeasible ∣V∣×d|V| \times d table at the cost of bounded hash collisions. Temporal neighbor sampling is implemented over timestamp-sorted CSR with a binary-search cutoff, so each sampling step becomes barely slower in practice. The encoder itself is a GATv2 with two role-specific heads (recipient and candidate), trained as binary classification over the impression log.

Contributions. We make the following contributions:

• We integrate multi-hash ID embeddings as a first-class input layer for an industrial GNN ranker, reducing the ID-embedding table from >200 GB to 2 GB (<1%) while matching the quality of a full ∣V∣×d|V| \times d table.

• We describe a binary-search-based temporal neighbor sampler over timestamp-sorted CSR, with O(log⁡du+K)\mathcal{O}(\log d_u + K) per-call cost against O(du+K)\mathcal{O}(d_u + K) for the naive scan used by mainstream GNN libraries, eliminating a ≈2.5×\approx 2.5 \times overhead at training time.

• We describe the end-to-end pipeline — CSR storage, decoupled CPU sampling and GPU training, offline embedding refresh — that lets the system run on a single 8-GPU host despite a 225 GB graph and 28B edges.

• We report offline ablations isolating the contribution of each design choice and online A/B results on a production social network: +16% friend additions and +11.5% unique adders over a strong production baseline.

• We release the implementation of the training and inference framework described in this paper including the components needed to train and refresh GNN embeddings over large timestamped CSR graphs. The code is available at https://github.com/makut/VK-GNN.

References (28)