TL;DR
Dynamic graph random walks (DGRW) power applications like recommendation systems and Graph Neural Networks (GNNs), but their runtime probability calculations typically demand massive memory buffers and trigger severe GPU workload imbalance. FlowWalker is a GPU-based DGRW framework that replaces costly probability table construction with parallel reservoir sampling, slashing auxiliary memory from $O(d)$ to $O(1)$ per query. By combining this sampling strategy with a "sampler-centric" architecture and dynamic scheduling, FlowWalker achieves up to 72.1× speedup over state-of-the-art GPU baselines and cuts end-to-end random walk time in ByteDance’s production friend recommendation pipeline from 35% down to 3%.
What Problem Does This Paper Address?
Random walks (RW) extract structural connectivity by simulating traversals across graphs. While static walks (e.g., DeepWalk) use fixed transition probabilities that can be precalculated, modern applications increasingly rely on Dynamic Graph Random Walks (DGRW) like Node2Vec and MetaPath. In DGRW, transition probabilities depend on query states (such as previously visited nodes or edge label schemas) and must be determined on the fly.
Running DGRW on GPUs has historically hit two brick walls:
- Memory Bloat: Standard sampling techniques—such as Inverse Transform Sampling (ITS) and Alias Table Sampling (ALS)—require an $O(d)$ probability buffer per query, where $d$ is the node degree. To avoid dynamic allocations, prior GPU frameworks pre-allocate buffers sized to the maximum degree ($O(d_{\max})$). On graphs with high degree skew (e.g., Twitter, where $d_{\max} \approx 3 \times 10^6$), a single query can demand over 11 MB, choking GPU concurrency and triggering Out-of-Memory (OOM) errors.
- Workload Imbalance: Real-world graphs follow power-law degree distributions. Allocating fixed GPU thread resources to queries leads to severe thread divergence and idle execution units across warps and thread blocks.
Methods
FlowWalker rethinks GPU graph traversal from the hardware perspective using three core components:
- Parallel Reservoir Sampling (DPRS & ZPRS): Instead of materializing an entire probability table, FlowWalker models neighbor selection as streaming reservoir sampling, requiring only $O(1)$ memory per query:
- Direct Parallel Reservoir Sampling (DPRS): Chunks neighbor lists across $k$ threads using inclusive prefix sums and parallel reductions. However, on long sequences, frequent inter-thread synchronization introduces communication bottlenecks ($O(\frac{n}{k} \log k)$).
- Zig-Zag Parallel Reservoir Sampling (ZPRS): Threads read neighbor weights in an interleaved ("zig-zag") layout. ZPRS scans weights twice but collapses the synchronization down to just two collective operations across the entire sequence ($O(\frac{n}{k} + \log k)$), unlocking maximum memory bandwidth on modern GPU architectures.
- Sampler-Centric Abstraction & Two-Stage Execution: Rather than assigning a thread group to follow a single query through its entire walk, queries stay pinned to a thread block’s local task pool in fast shared memory. Within each block, execution runs in two stages:
- Warp Samplers concurrently process low-degree nodes ($d \le 1024$).
- A cooperative Block Sampler processes remaining high-degree nodes ($d > 1024$) one by one.
- Fine-Grained Dynamic Scheduling & Double Buffering: Thread blocks greedily grab queries from a global task pool via atomic increments. When sequence outputs exceed on-board GPU memory, FlowWalker divides queries into batches and uses two alternating CUDA streams (ping-pong buffering) to overlap host-to-device I/O with computation.
Datasets
The authors evaluated FlowWalker on 10 real-world graphs spanning social networks, citation networks, and web graphs:
- Stanford SNAP:
com-youtube(YT),cit-patents(CP),Livejournal(LJ),Orkut(OK), andFriendster(FS). - Laboratory for Web Algorithmics (LAW):
EU-2015(EU),Arabic-2005(AB),UK-2005(UK),Twitter(TW), andSK-2005(SK).
Dataset sizes range from 0.05 GB (YT: 1.1M nodes, 6M edges) up to 27.16 GB (SK: 51M nodes, 3.6B edges, $d_{\max} = 8.5\text{M}$). No new benchmark was introduced, but all baseline algorithms were evaluated in dynamic execution mode.
Key Insights and Ideas
- Trading ALUs for Memory: Reservoir sampling requires generating a random number for every single visited edge, which is traditionally inefficient on CPUs. On GPUs, however, arithmetic instructions and random number generators (RNG) are cheap compared to global memory allocations and memory bus contention.
- Zig-Zag Scanning Beats Synchronization: While ZPRS inspects edge weights twice, slashing synchronization primitives (prefix sums and reductions) from $O(n/k)$ down to two operations yields massive speedups on wide GPU architectures.
- Elimination of Global Auxiliary State: FlowWalker stores zero auxiliary sampling data structures in GPU global memory. All bookkeeping sits inside registers and shared memory.
Key Results
- End-to-End Speedups: FlowWalker was the only framework to finish all workloads without crashing or exceeding an 8-hour time limit. It delivered up to 752.2× speedup over ThunderRW (CPU), 72.1× over Skywalker (GPU), 92.2× over DGL (GPU), and 16.4× over LightRW (FPGA).
- Flat Memory Footprint: At $10^6$ queries, FlowWalker maintained an auxiliary global memory footprint of ~0.30 GB across all datasets. In contrast, Skywalker consumed up to 63.6 GB of extra memory on skewed graphs like
SK-2005. - ByteDance Production Pipeline: In an end-to-end training epoch of Douyin friend recommendations (227M users, 2.71B edges), dynamic random walks previously consumed 3.49 hours (35% of the 10-hour pipeline). FlowWalker reduced this step to 13 minutes (3% of total time).
Limitations and Future Work
- Heavy Edge Weight Computation: Because ZPRS scans neighbor weights twice, DPRS can outperform ZPRS when evaluating transition probabilities requires computationally expensive formulas.
- RNG Bottlenecks: Massive parallel random number generation remains a primary execution cost. FlowWalker optimizes RNG layout in shared memory, but further hardware-level RNG optimizations are left to future work.
- Graph Compression: FlowWalker currently executes on uncompressed graphs, though integrating graph compression techniques (e.g., GraSS) could allow scaling to even larger graphs on single GPUs.
Summary updated