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

The Heavy Hitter Oracle: Enhancing Frequency Estimation in Skewed Data Streams

Lisa Schmierer, Ioana-Oriana BerceaNeurIPS 2026

TL;DR

Recent research suggests supercharging classic data-streaming algorithms with machine-learned "oracles" that predict the most frequent items ahead of time. This paper plays the friendly skeptic, proving that classical algorithms only need a tiny bit more memory to match these complex learned setups—and introduces SpaceR, a dead-simple, randomized one-pass algorithm that achieves near-perfect accuracy without needing any predictions at all. If you love seeing a clever coin toss match the performance of heavy machine learning machinery, this one is for you.

What Problem Does This Paper Address?

Imagine trying to count how often every unique IP address appears in a massive internet traffic stream. With millions of items flying by and strict memory limits, you can't keep an exact counter for everything. Instead, engineers rely on compact, approximate data structures called sketches.

Real-world streams are usually heavily skewed (following a Zipfian distribution): a few "heavy hitters" appear constantly, while a massive "long tail" of rare items appears once or twice. Recently, researchers introduced learning-augmented algorithms to exploit this. They pair a standard sketch with a machine-learned "oracle" (often a neural network) trained to predict the heavy hitters. Heavy hitters get their own VIP exact counters, keeping them from polluting the sketch used for everything else.

The catch? Prior work largely ignores the elephant in the room: training and storing a neural network takes massive compute, memory, and multiple passes over the data—defeating the whole purpose of a lightweight, single-pass streaming algorithm! The authors ask: Are these complex oracles actually buying us much, and can we get the same accuracy in a single pass without them?

Methods

The authors tackle the problem from three angles—two theoretical reality-checks and one new algorithm:

  1. Tighter Math for CountSketch++ (CS++): CS++ is a state-of-the-art classical (unlearned) sketching algorithm. The authors re-analyze its error bounds on skewed streams to see how it truly stacks up against learned methods.
  2. The "Trivial Alternative": Standard learned CS++ splits its memory budget $B$ in half: $B/2$ for tracking predicted heavy hitters, and $B/2$ for a CS++ sketch to handle the rest. The authors propose a "Trivial Alternative" that tracks the $B/2$ predicted heavy hitters and simply throws away the sketch, blindly guessing 0 for every other item.
  3. SpaceR (New Algorithm): Classic deterministic algorithms like SpaceSaving maintain a fixed-size heap of counters; when a new untracked item arrives, it evicts the item with the smallest count ($c_{\min}$) and takes its place with count $c_{\min} + 1$. SpaceR adds a randomized twist: when an untracked item arrives, you flip a biased coin. With probability $p = 1/k$ (where $k$ is the number of heavy hitters you care about), you let it into the heap via SpaceSaving's rule. With probability $1 - p$, you completely ignore it.
Figure 1: Visualization of the update mechanism of SpaceR.

Datasets

To keep things grounded and comparable to prior work, the authors evaluate their methods on two fronts:

  • Synthetic Zipfian Data: A generated stream of $n = 10^6$ distinct elements where the $i$-th most popular element appears $\lceil n/i \rceil$ times.
  • CAIDA Dataset: Real-world, anonymized internet backbone traffic from January 2019, comprising ~29.9 million packets across 326,358 unique source IP addresses.

Key Insights and Ideas

  • Oracles only save a logarithmic sliver of memory: By tightening the theoretical error bound of unlearned CS++, the authors prove that giving classical CS++ just slightly more space—$\Theta(B \log B)$ instead of $\Theta(B)$—matches the theoretical performance of learned CS++ equipped with perfect predictions.
  • Guessing zero is shockingly effective: In skewed streams, if your oracle successfully catches the heavy hitters, the remaining items are so rare that guessing 0 for all of them (the Trivial Alternative) yields the exact same asymptotic error as running a sophisticated sketch on them.
  • The "Coin Toss" shield: Deterministic SpaceSaving suffers from "thrashing"—a flood of rare, one-off items constantly evicts elements from the heap before true heavy hitters can establish a foothold. SpaceR's coin toss filters out the noisy long tail. Once a true heavy hitter gets lucky and enters the heap, every subsequent appearance is counted deterministically, allowing its counter to rapidly outgrow $c_{\min}$ and become practically immune to eviction.
Table 1: Comparison of expected weighted error bounds for B words of memory and Zipfian frequencies, i.e., fi ∝1

Key Results

Crucially, the authors enforce a fair memory budget $B$ in their experiments, counting the space needed to store the oracle itself alongside the sketch.

  • Trivial Alternative vs. Learned CS++: When paired with a high-quality predictor (either a Perfect Oracle or SpaceR), the Trivial Alternative achieves nearly identical weighted errors to Learned CS++ on both synthetic and CAIDA datasets, despite using only half the memory in the estimation pass. (Learned CS++ only wins when paired with weaker predictors like Misra-Gries, where the backup sketch catches the oracle's mistakes.)
Figure 2: Comparison of weighted errors for different oracles in the first pass, combined with either the Trivial Alternative or a CS++ in the second. Results are listed by oracle. In the second pass, the learned CS++ dedicates B/2 space to track exact counts for the heavy hitters and employs a CS++ sketch with the remaining B/2 space. Note that the Trivial Alternative only ever stores the heavy hitters. That is, it only uses a fraction of the available space budget in the second pass.
  • One-Pass SpaceR Matches Two-Pass Baselines: Running SpaceR directly in a single pass achieves performance parity with the strongest two-pass baseline (a Perfect Oracle + Learned CS++). It remains stable and recovers near-perfect frequencies even under tight space budgets as low as $B = 4 \log(n)$ (e.g., 34 to 608 words of memory), dramatically outperforming deterministic SpaceSaving and Misra-Gries.

Limitations and Future Work

  • Missing Theory for SpaceR: While the authors provide rock-solid proofs for CS++ and the Trivial Alternative, SpaceR's stellar performance is currently purely empirical. Proving formal theoretical error bounds for randomized admission policies like SpaceR remains an open challenge.
  • Skewness Assumption: Both the theoretical proofs and experiments focus heavily on standard Zipfian distributions ($\alpha = 1$). How well SpaceR and the Trivial Alternative generalize to flatter, less skewed data distributions is left for future exploration.

Summary updated

BibTeX
@inproceedings{schmierer2026heavy,
  author = {Lisa Schmierer and Ioana-Oriana Bercea},
  title = {{The Heavy Hitter Oracle: Enhancing Frequency Estimation in Skewed Data Streams}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=9VgqSRdGiR},
}
Figure