NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Mergeable Sketches for Distributed Data Aggregation

26 concepts17 papers1 proposal

When analyzing massive datasets, data is rarely sitting in a single memory bank on a single machine. Instead, it is typically distributed across thousands of servers, streaming in continuously over network interfaces, or partitioned across parallel processing cores.

To compute global statistics—such as the number of unique visitors, the 99th percentile of network latency, or heavy-hitter frequencies—the naive approach requires centralizing the raw data or re-sorting it globally. This creates massive network bottlenecks and violates strict memory constraints.

A more elegant solution lies in mergeable sketches: compact, probabilistic data structures that summarize a dataset. A sketch $S(D)$ is fully mergeable if there exists a computationally cheap merge operator $\oplus$ such that:

$$S(D_1) \oplus S(D_2) = S(D_1 \cup D_2)$$

Crucially, the accuracy and variance of the merged sketch are identical to a sketch built by observing the entire unified dataset $D_1 \cup D_2$ from scratch. This property allows distributed nodes to process local data streams completely independently and combine their summaries with minimal communication overhead.

But why can these lossy, highly compressed summaries be combined so seamlessly without losing information? The answer lies in three core architectural patterns: linearity, data-independent structural alignment, and compressed-domain algebra.


Linearity and Additive Counter Arrays

The most intuitive reason a sketch can be merged is mathematical linearity. If the mapping from a raw data element to its representation in the sketch is a linear transformation, then aggregating two sketches reduces to simple element-wise addition.

Consider frequency estimation in large-scale natural language processing. Goyal et al. (2010) and Goyal et al. (2011) demonstrate that by utilizing Count-Min sketches—which map items to fixed-size arrays via independent hash functions—individual text corpora can be processed on separate machines. Because the underlying operations are just counter increments, the local sketches can be merged via element-wise array addition. This allows a single machine to effectively aggregate statistics from tens of gigabytes of distributed web data without global synchronization.

This additive property extends to high-dimensional spaces and continuous distributions:

  • Kernel Density Estimation (KDE): Shrivastava and Coleman and Coleman in their work on RACE sketches leverage Locality Sensitive Hashing (LSH) to map high-dimensional streaming data into arrays of integer counters. Because the counters are additive, local density estimates from distributed sensor networks can be summed element-wise to construct a global kernel density estimate without ever sharing raw data points.
  • Tensor Decompositions: For massive multi-dimensional arrays, Guo et al. show that Tucker approximations can be maintained via linear sketching operations. Partial sketches computed from sequential data slices or distinct nodes are simply added together to form a valid global sketch of the tensor.
  • Stream Sampling: Linearity also unlocks complex sampling behaviors. Cormode and Jowhari outline how $\ell_p$ samplers operate as linear transformations of an input vector. This allows sketches to be updated or merged via simple arithmetic even when items are both added and deleted from the stream. As a result, Cohen et al. demonstrate that $\ell_p$-sampling without replacement can be achieved across distributed servers by merging local composable sketches to maintain a consistent global sample.

Structural Alignment via Data-Independence

Linearity is straightforward when dealing with counters, but what happens when we want to track non-linear statistics, such as quantiles or rank-based errors?

If two independent servers build adaptive histograms or trees to track their local data distributions, their bucket boundaries will inevitably diverge based on their local inputs. Trying to merge two histograms with mismatched boundaries introduces massive interpolation errors.

To solve this, mergeable quantile sketches enforce data-independent structural alignment.

Server A (Local Data):  [1.2, 1.5, 4.1]  -->  | Bucket 1 (1-2): 2 | Bucket 2 (2-4): 0 | Bucket 3 (4-8): 1 |
                                                            + (Simple Element-wise Sum)
Server B (Local Data):  [1.8, 2.3, 3.9]  -->  | Bucket 1 (1-2): 1 | Bucket 2 (2-4): 2 | Bucket 3 (4-8): 0 |
                                                            =
Global Merged Sketch:                         | Bucket 1 (1-2): 3 | Bucket 2 (2-4): 2 | Bucket 3 (4-8): 1 |

In their paper introducing DDSketch, Rim and Lee and Lee guarantee relative-error bounds for quantiles by using fixed, data-independent logarithmic bucket boundaries. Because the boundaries are predetermined and identical across all nodes, merging two sketches requires no complex geometry or re-sorting; workers simply sum the corresponding bucket counts.

An alternative way to achieve data-independence is to avoid buckets entirely and instead track global statistical moments. Gan et al. show that a distribution can be compactly summarized by maintaining a small set of standard and logarithmic moments. Because moments are inherently additive across datasets ($\sum x_i^k$), merging two distinct distribution summaries reduces to a 50-nanosecond vector addition task, perfectly suited for vectorized CPU instructions.


Compressed-Domain Algebra

For cardinality estimation (counting unique elements), sketches like HyperLogLog (HLL) track the maximum number of leading zeros observed in the hashed bitstrings of elements. While HLL sketches are mergeable via an element-wise MAX operation, large-scale systems often compress these sketches to minimize network bandwidth during distributed aggregation.

Decompressing thousands of sketches at a central aggregator only to merge them creates a massive CPU bottleneck. Modern mergeable sketches circumvent this by operating directly within the compressed domain.

Karppa and Pagh introduce HyperLogLogLog, which compresses register values into small 3-bit offsets relative to a dynamically shifting base value. They demonstrate that these compressed sketches can be merged directly without full decompression, allowing distributed nodes to aggregate cardinality data while preserving low communication and memory overhead.

Similarly, when evaluating complex set expressions across distributed databases, Ting introduces novel direct-merge operations that allow compressed sketches to compute both unions and intersections efficiently.

This mathematical consistency ensures that as sketches are passed up an aggregation tree, the variance of the final estimate behaves predictably. As proven by Dasgupta et al. through their "1-Goodness" condition within the Theta-Sketch Framework, merging sketches using a consistent growth rule guarantees that the statistical precision of the final aggregated sketch is identical to processing a single unified data stream.


Scaling Beyond Single Machines

By transforming global data aggregation from a heavy distributed sorting problem into a series of local computations followed by cheap algebraic merges, this paradigm fundamentally changes what is possible in constrained environments:

  • Relative-Error Quantiles: Karnin et al. design ReqSketch, which provides highly accurate relative-error guarantees for extreme quantiles (like SLA tail latencies). It achieves full mergeability through a bitwise OR operation on the internal state of its compactors, making it highly effective for parallel streaming pipelines.
  • Matrix Properties: Jiang et al. demonstrate that non-adaptive sketching functions can act as a parallelizable primitive for matrix trace estimation, matching the accuracy of sequential optimization algorithms without requiring iterative coordination.
  • Hardware-Constrained Networks: In highly distributed, memory-limited environments like programmable network switches, Ben-Basat et al. show that integrating fully-mergeable sketches into distributed network protocols allows switches to compute global network statistics (such as heavy hitters) with a round complexity that scales logarithmically relative to the input size.

Ultimately, mergeable sketches work because they decouple data collection from data aggregation. By mapping raw inputs into structures governed by linearity, data-independent boundaries, or compressed algebraic properties, they ensure that the act of combining summaries is as mathematically sound as it is computationally trivial.

Key Foundational Work

Sketching Techniques for Large Scale NLP (2010) — contributed 2 concept elements to this direction.
Approximate Aggregation Techniques for Sensor Databases (2004) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_linear_sketch_mergeability_3c2135dc,
  title = {linear sketch mergeability},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/linear-sketch-mergeability/rdr_3c2135dc222549adbd9f85ca921d156d},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-28},
}

This exact version (version 1, frozen text):

@misc{lacuna_linear_sketch_mergeability_3c2135dc_v1,
  title = {linear sketch mergeability},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/linear-sketch-mergeability/rdr_3c2135dc222549adbd9f85ca921d156d/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-28},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake