Large-Scale Graph Building in Dynamic Environments: Low Latency and High Quality

Filipe Miguel Gonçalves de Almeida, Cj Carey, Hendrik Fichtenberger, Jonathan Halcrow, Silvio Lattanzi, André Linhares, Tao Meng, Ashkan Norouzi-Fard, Nikos Parotsidis, Bryan Perozzi, David SimchaarXiv 2025 · DOI

Abstract

Building and maintaining high-quality similarity graphs for massive, multimodal datasets in real-time is a significant industrial challenge. Traditional batch-processing systems like Google’s Grale excel at quality but struggle with the "dynamic gap"—the need to handle thousands of updates per second with millisecond query latency. This paper introduces Dynamic GUS (Dynamic Grale Using ScaNN), a system that bridges this gap by mapping multimodal features into sparse embeddings and leveraging the ScaNN library for efficient retrieval. Dynamic GUS achieves sub-second freshness and millisecond-level latency, significantly improving real-world applications such as Android Security.

1. Introduction

In modern industrial applications, data is characterized by high volume, multimodal complexity, and rapid mutation. For instance, a YouTube video comprises text, images, and audio, and thousands of such items are uploaded every second. Constructing a similarity graph—where edges represent relationships between items—is crucial for tasks like recommendation and security. While offline systems like Grale provide high-quality graphs, they cannot support real-time updates or low-latency neighborhood queries for new data points. Dynamic GUS addresses these limitations by providing a scalable, low-latency framework for dynamic graph maintenance.

2. Methodology and System Design

The core innovation of Dynamic GUS lies in its approach to candidate generation and scoring, transforming the offline batch process into a streamlined online service.

2.1 Sparse Embedding Generation

To handle multimodal data without the overhead of complex dense vector transformations, Dynamic GUS utilizes sparse embeddings. The system applies Locality Sensitive Hashing (LSH) to various feature types to assign "bucket IDs." These IDs serve as dimensions in a high-dimensional sparse vector. If two points fall into the same bucket, they share a non-zero value in that dimension, indicating potential similarity. This approach allows the system to capture complex relationships using only local information. Notably, the authors provide a theoretical bridge showing that this sparse search is functionally equivalent to the candidate generation in the original offline Grale system, ensuring consistent quality.

2.2 ScaNN Integration and Two-Step Scoring

Dynamic GUS employs ScaNN (Scalable Nearest Neighbor) as its primary search engine. The process follows a two-step scoring mechanism:

  1. Retrieval: ScaNN identifies a set of candidate neighbors based on the sparse embeddings.
  2. Refinement: A pre-trained, high-fidelity machine learning model (e.g., a Deep Neural Network) scores these candidates to establish the final graph edges.

To optimize quality, the system incorporates techniques like Filtering (removing overly common buckets) and IDF weighting (prioritizing rare, informative buckets).

2.3 Dynamic Operations

The system supports two primary real-time operations: point insertion/updates and neighborhood computation.

Figure 1: The workflow for inserting or updating a data point in Dynamic GUS.

As shown in Figure 1, when a new point $p$ is received, the Embedding Generator creates its sparse representation, which is then indexed by ScaNN. This process occurs in sub-seconds, ensuring the graph remains fresh.

Figure 2: The neighborhood computation process for a query point.

For queries, as illustrated in Figure 2, the system retrieves candidates $Q$ via ScaNN and then applies a Similarity Scorer to produce the final set of neighbors and scores $(Q, S)$.

3. Experimental Evaluation

The system was evaluated on large-scale benchmarks and in a production environment.

3.1 Benchmarks

Using the Open Graph Benchmark (OGB), Dynamic GUS was tested on:

  • ogbn-arxiv: ~169k papers. Median latency: 10–20 ms.
  • ogbn-products: ~2.4M products. Median latency: 5–25 ms.

The system demonstrated the ability to handle hundreds of thousands of mutations per second, maintaining high throughput even at scale.

3.2 Real-World Impact: Android Security

Dynamic GUS was deployed to enhance Android Security and Privacy. By enabling real-time graph updates, the system allowed for the detection of harmful applications four times faster than previous methods. Furthermore, the "action rate" (the percentage of identified threats that were successfully mitigated) increased by 40%.

4. Conclusion

Dynamic GUS represents a significant advancement in real-time graph building. By combining sparse LSH-based embeddings with the optimized retrieval capabilities of ScaNN, the system achieves the quality of offline batch processing with the latency required for interactive applications. Future work will focus on addressing model staleness through online learning and optimizing memory footprints for billion-scale datasets.

Summary updated

Abstract

Learning and constructing large-scale graphs has attracted attention in recent decades, resulting in a rich literature that introduced various systems, tools, and algorithms. Grale is one of such tools that is designed for offline environments and is deployed in more than 50 different industrial settings at Google. Grale is widely applicable because of its ability to efficiently learn and construct a graph on datasets with multiple types of features. However, it is often the case that applications require the underlying data to evolve continuously and rapidly and the updated graph needs to be available with low latency. Such setting make the use of Grale prohibitive. While there are Approximate Nearest Neighbor (ANN) systems that handle dynamic updates with low latency, they are mostly limited to similarities over a single embedding. In this work, we introduce a system that inherits the advantages and the quality of Grale, and maintains a graph construction in a dynamic setting with tens of milliseconds of latency per request. We call the system Dynamic Grale Using ScaNN (Dynamic GUS). Our system has a wide range of applications with over 10 deployments at Google. One of the applications is in Android Security and Privacy, where Dynamic Grale Using ScaNN enables capturing harmful applications 4 times faster, before they can reach users.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
ogbn-arxivDynamic Grale Using ScaNN (Dynamic GUS)Median wall-clock insertion time0.29msdynamic
Source quote
L323: Furthermore, we also measured the median wall clock time for insertions of points into the datasets, which is 0.29ms for ogbn-arxiv (95%ile = 0.54ms) and 0.42ms for ogbn-products (95%ile = 0.78ms).
ogbn-productsDynamic Grale Using ScaNN (Dynamic GUS)Median wall-clock insertion time0.42msdynamic
Source quote
L323: Furthermore, we also measured the median wall clock time for insertions of points into the datasets, which is 0.29ms for ogbn-arxiv (95%ile = 0.54ms) and 0.42ms for ogbn-products (95%ile = 0.78ms).
BibTeX
@misc{almeida2025large,
  author = {Filipe Miguel Gonçalves de Almeida and CJ Carey and Hendrik Fichtenberger and Jonathan Halcrow and Silvio Lattanzi and André Linhares and Tao Meng and Ashkan Norouzi-Fard and Nikos Parotsidis and Bryan Perozzi and David Simcha},
  title = {{Large-Scale Graph Building in Dynamic Environments: Low Latency and High Quality}},
  year = {2025},
  eprint = {2507.10139},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.10139},
}
Figure