Sublime: Sublinear Error & Space for Unbounded Skewed Streams

Navid Eslami, Ioana Bercea, Rasmus Pagh, Niv Dayan

TL;DR

This paper introduces "Sublime," a novel framework that significantly improves the accuracy and memory efficiency of frequency estimation sketches for data streams. Sublime tackles two major challenges: memory waste from skewed data distributions and increasing error in fixed-size sketches as streams grow indefinitely.

What Problem Does This Paper Address?

Modern stream processing systems need to track the frequency of items in real-time. However, exact counting is often infeasible due to memory constraints. Probabilistic data structures called "frequency estimation sketches" are used as an approximation. The paper identifies two key limitations of existing sketches:

  1. Skewed Workloads: Many real-world data streams have "heavy hitters" (a few items appearing very frequently) and many items appearing rarely. Standard sketches use fixed-size counters for all items, leading to wasted memory on storing leading zeros for the frequent items' small counts.
  2. Unbounded Data Growth: Data streams can grow indefinitely. Existing sketches have a fixed number of counters, meaning their estimation error increases linearly with the stream's length. This makes it impossible to maintain a consistent accuracy guarantee as the stream grows.

Methods

Sublime is a framework that enhances existing frequency estimation sketches (like Count-Min Sketch and Count Sketch) by addressing the identified problems:

  • Accommodating Skew (Variable-Length Counters): Sublime uses a novel encoding scheme called VALE (Variable-Length Encoding). It starts with short "stubs" for counters and dynamically elongates them with "extensions" when a counter overflows. These extensions are stored efficiently within the same cache line as the stub, and specialized bit manipulation routines (rank and select operations) are used for fast access. This avoids wasting memory on unused bits for small counts.
  • Accommodating Unbounded Growth (Dynamic Expansion): Sublime dynamically expands the number of counters in the sketch as the stream grows. This is achieved by periodically doubling the sketch's capacity. The expansion threshold can be configured, allowing users to tune the trade-off between accuracy and memory usage. For deletions, Sublime supports contractions to reclaim memory.
  • Generalization: Sublime is designed as a framework and is applied to Count-Min Sketch (SublimeCMS), Count Sketch (SublimeCS), and Misra-Gries (SublimeMG), demonstrating its broad applicability.

Datasets

The paper evaluates Sublime using three real-world stream datasets:

  • Kosarak: 8 million clicks from a news portal, highly skewed (Zipfian exponent ≈ 3.5).
  • WebDocs: 300 million words from online documents, skewed (Zipfian exponent ≈ 1.0).
  • CAIDA: 27 million network connection tuples, skewed (Zipfian exponent ≈ 2.0).

Additionally, they use synthetic datasets generated with varying Zipfian exponents to test skew tolerance and a TPC-H workload for join size estimation.

Key Insights and Ideas

  • Variable-length counters are crucial for skew: The VALE encoding effectively tackles memory wastage by adapting counter size to item frequency, a problem overlooked by fixed-size counters.
  • Dynamic expansion is key for unbounded streams: The ability to grow the sketch's capacity as the stream grows is essential for maintaining bounded error, a problem that has been largely unaddressed for frequency estimation sketches.
  • A tunable accuracy-memory trade-off: Sublime offers a spectrum of accuracy-memory trade-offs by allowing users to configure expansion policies, making it adaptable to diverse application needs.
  • Sublinear error and space are achievable: The framework demonstrates that it's possible to achieve error and memory usage that grow sublinearly with stream length, a significant improvement over existing linear scaling.

Key Results

  • Accuracy: SublimeCMS achieved up to an order of magnitude lower estimation error than most baselines on real-world workloads, and significantly lower errors (2-3 orders of magnitude) than CMS when handling unbounded growth. SublimeCS also showed substantial improvements in accuracy for unbiased estimation tasks.
  • Memory Efficiency: Sublime achieved a smaller memory footprint compared to baselines with similar accuracy, especially under skewed workloads and with adaptive VALE tuning.
  • Performance: Sublime maintained competitive or superior insertion and query performance compared to baselines, often by leveraging optimized bit manipulation and hardware instructions. Expansions and contractions were found to have minimal overhead (around 0.5% of processing time).
  • Join Size Estimation: Sublime provided more accurate join size estimates than traditional CMS and CS, with expandable versions outperforming fixed-size counterparts.

Limitations and Future Work

  • Single-threaded implementation: The current implementation is single-threaded. The authors suggest significant performance gains could be achieved through parallelization, such as using thread-local sketches and merging them.
  • Concurrent updates with dynamic resizing: Studying the interplay of concurrent updates with expansions, contractions, and adaptive tuning is identified as an interesting future research direction.
  • Generalization to other statistics: The framework's principles are expected to be applicable to other data stream statistics like quantiles and cardinalities, opening new research avenues.

Summary updated

Abstract

Modern stream processing systems often need to track the frequency of distinct keys in a data stream in real-time. Since maintaining exact counts can require a prohibitive amount of memory, many applications rely on compact, probabilistic data structures known as frequency estimation sketches to approximate them. However, mainstream frequency estimation sketches fall short in two critical aspects. First, they are memory-inefficient under skewed workloads because they use uniformly-sized counters to count the keys, thus wasting memory on storing the leading zeros of many small counts. Second, their estimation error deteriorates at least linearly with the length of the stream --- which may grow indefinitely --- because they rely on a fixed number of counters. We present Sublime, a framework that generalizes frequency estimation sketches to address these challenges. To reduce memory footprint under skew, Sublime begins with short counters and dynamically elongates them as they overflow, storing their extensions within the same cache line. It employs efficient bit manipulation routines to quickly locate and access a counter's extensions. To maintain accuracy as the stream grows, Sublime also expands its number of counters at a configurable rate, exposing a new spectrum of accuracy-memory tradeoffs that applications can tune to their needs. We apply Sublime to both Count-Min Sketch and Count Sketch. Through theoretical analysis and empirical evaluation, we show that Sublime significantly improves accuracy and memory over the state of the art while maintaining competitive or superior performance.
BibTeX
@inproceedings{eslami2026sublime,
  author = {Navid Eslami and Ioana Bercea and Rasmus Pagh and Niv Dayan},
  title = {{Sublime: Sublinear Error \& Space for Unbounded Skewed Streams}},
  booktitle = {Proceedings of the ACM on Management of Data},
  year = {2026},
  doi = {10.1145/3802116},
}
Figure