Learning-based Sketches for Frequency Estimation in Data Streams without Ground Truth

Xinyu Yuan, Yan Qiao, Meng Li, Zhenchun Wei, Cuiying Feng, Zonghui Wang, Wenzhi Chen

Here is a concise, engaging summary of the paper designed for researchers and engineers interested in streaming algorithms and machine learning.

TL;DR

Traditional data stream sketches trade accuracy for memory, while recent learning-augmented alternatives require impractical offline training with real-world ground truth. UCL-sketch bridges this gap by introducing a fully unsupervised, online-trained neural solver that recovers per-key frequencies directly from sketch counters. It achieves near-oracle accuracy under tight memory budgets while delivering a 500x decoding speedup over traditional compressive sensing methods.

What Problem Does This Problem Address?

In applications like network traffic monitoring and database management, estimating the frequency of items in massive, high-speed data streams is critical. Because storing every item is impossible, engineers use sketches (compact data structures like Count-Min Sketch) to approximate frequencies using limited memory.

However, traditional sketches suffer from hash collisions, leading to coarse estimates. Recently, "learning-augmented" sketches have tried using machine learning oracles to predict heavy hitters. Unfortunately, these methods require offline training with labeled datasets or exact ground-truth frequencies—which are rarely available in real-time streaming environments. They also struggle to adapt to distribution drift and introduce significant processing overhead.

Equation-based sketches use Compressive Sensing (CS) to solve these collisions mathematically, but their iterative optimization solvers (like Orthogonal Matching Pursuit) are computationally heavy and too slow for real-time queries.

Methods

UCL-sketch (Unsupervised Compressive Learning Sketch) splits its architecture into a fast data plane and an intelligent control plane:

  • Data Plane: It maintains a heavy filter (hash table) to catch frequent items, a standard Count-Min (CM) sketch for the remaining items, and a Bloom Filter for new key identification.
  • Control Plane (The Learned Solver): Instead of using slow, iterative optimization algorithms to solve the under-constrained linear system created by hash collisions, the authors deploy a neural network solver.
Fig. 1. Comparison between the previous learning-augmented sketches and our studied learning-based sketch: In our approach, we empower the sketch with learning technologies in the recovery phase to improve streaming throughput. The model is online trained using just compressed counters in the sketch, which is much more practical and efficient than the prior works.

The core innovations that make this work are:

  1. Equivariant Learning (GT-Free Training): To train the neural network without ground truth, the authors leverage the mathematical properties of the sketch matrix alongside the natural "Zipfian" (heavy-tailed) distribution of data streams. The loss function forces the network to be invariant to specific virtual transformations, allowing it to accurately navigate the "null space" of the sketch matrix without ever seeing the true frequencies.
  2. Scalable Architecture via Logical Buckets: To prevent the model's parameter size from exploding as new keys arrive, the key space is divided into logical buckets. These buckets share parameters using sinusoidal position embeddings, keeping the memory footprint minimal and constant.

Datasets

The authors evaluated their approach on both real-world and synthetic workloads:

  • CAIDA (2018): Real network traffic data from a backbone link (~100K distinct keys, 1M packets).
  • Kosarak: Anonymized click-stream data from a Hungarian news portal (~25K unique keys).
  • Retail: Market basket data from a Belgian supermarket (~16K unique keys).
  • Synthetic Workloads: Four datasets explicitly generated to follow Zipf’s law with varying skewness parameters (from 1.2 to 1.5), containing up to 214K distinct items.

Key Insights and Ideas

  • Learning Beyond the Range Space: The most significant "aha moment" is that a neural network can learn to invert a compressed sketch matrix without ground truth by exploiting structural priors (like Zipf's law) via self-supervised equivariant loss.
  • Regularization via Parameter Sharing: Splitting the key space into logical buckets wasn't just a scalability trick; the authors found that parameter sharing acts as a form of regularization, preventing the model from overfitting and helping it generalize to future, unseen counters.
  • Amortized Computation: Moving the heavy mathematical lifting to an online background training process allows query-time frequency estimation to become a fast, single-forward-pass operation.

Key Results

  • Superior Accuracy: Under tight memory budgets (<64KB), UCL-sketch achieved an Average Absolute Error (AAE) that was 6 to 20 times smaller than state-of-the-art sketches (including Count-Min, Count Sketch, Elastic Sketch, and Nitrosketch).
  • Massive Speedup: When compared to traditional equation-based sketches that rely on iterative optimization solvers, UCL-sketch achieved an average decoding speedup of nearly 500x, keeping inference times under 0.5 seconds.
  • Extreme Memory Efficiency: Thanks to the scalable bucket architecture, the model required only 1MB of memory to track 500K unique items, compared to over 250MB required by a non-scalable baseline network.

Limitations and Future Work

  • Zipfian Dependency: The mathematical guarantees and loss functions partly rely on the assumption that the underlying data follows a heavy-tailed/Zipfian distribution. Performance might degrade on streams with highly uniform distributions.
  • Bloom Filter Overhead: As the stream grows, ensuring a low number of missed keys requires the Bloom Filter's space to scale almost linearly. The authors note that designing a more compact key-tracking structure is a vital next step.

Summary updated

Abstract

Estimating the frequency of items on the high-volume, fast data stream has been extensively studied in many areas, such as database and network measurement. Traditional sketches provide only coarse estimates under strict memory constraints. Although some learning-augmented methods have emerged recently, they typically rely on offline training with real frequencies or/and labels, which are often unavailable. Moreover, these methods suffer from slow update speeds, limiting their suitability for real-time processing despite offering only marginal accuracy improvements. To overcome these challenges, we propose UCL-sketch, a practical learning-based paradigm for per-key frequency estimation. Our design introduces two key innovations: (i) an online training mechanism based on equivalent learning that requires no ground truth (GT), and (ii) a highly scalable architecture leveraging logically structured estimation buckets to scale to real-world data stream. The UCL-sketch, which utilizes compressive sensing (CS), converges to an estimator that provably yields a error bound far lower than that of prior works, without sacrificing the speed of processing. Extensive experiments on both real-world and synthetic datasets demonstrate that our approach outperforms previously proposed approaches regarding per-key accuracy and distribution. Notably, under extremely tight memory budgets, its quality almost matches that of an (infeasible) omniscient oracle. Moreover, compared to the existing equation-based sketch, UCL-sketch achieves an average decoding speedup of nearly 500 times. To help further research and development, our code is publicly available at https://github.com/Y-debug-sys/UCL-sketch.
BibTeX
@article{yuan2026learning,
  author = {Xinyu Yuan and Yan Qiao and Meng Li and Zhenchun Wei and Cuiying Feng and Zonghui Wang and Wenzhi Chen},
  title = {{Learning-based Sketches for Frequency Estimation in Data Streams without Ground Truth}},
  journal = {IEEE Transactions on Knowledge and Data Engineering},
  year = {2026},
  doi = {10.1109/tkde.2026.3675012},
}
Figure