Space-Optimal Streaming Algorithms via Efficient Encodings

Liudeng Wang, David Woodruff, Shenghao Xie, Samson ZhouNeurIPS 2026

TL;DR

When summarizing massive datasets on the fly, streaming algorithms have historically paid a "memory tax"—requiring extra storage that grows with the length of the data stream compared to offline methods that can see all the data at once. This paper proves that this tax isn't inevitable. By cleverly compressing intermediate summaries relative to a single global reference, streaming algorithms can match the exact memory footprint of the best offline algorithms, completely independent of how many data points stream by.

What Problem Does This Paper Address?

Imagine trying to summarize a firehose of $n$ high-dimensional data points when you only get one look at each point before it disappears. A standard strategy is to maintain a coreset: a tiny, weighted subset of the data that behaves nearly identically to the full dataset for downstream tasks like clustering or linear regression.

If you have the luxury of storing the whole dataset on disk (the offline setting), the number of memory words needed for a coreset depends only on the data's dimensionality ($d$) and your target accuracy ($\varepsilon$)—not on the total number of points ($n$).

In the streaming setting, however, you have to make immediate, irrevocable decisions. Standard techniques—like online sensitivity sampling (keeping points that look important right now) or merge-and-reduce (building a binary tree of summaries and repeatedly merging them)—accumulate small errors or excess samples over time. Compensating for this has always introduced logarithmic or doubly-logarithmic space overheads in $n$. For years, computer scientists wondered: does processing data in a stream inherently require more memory than processing it offline?

Methods

The authors build upon a standard hybrid pipeline: first, filter the incoming stream using online sampling, and second, feed the survivors into a merge-and-reduce tree. Normally, storing the active tree nodes in high precision still leaves a stubborn $\text{poly}(\log \log n)$ memory overhead.

What is new here is Global Efficient Encoding. Instead of storing every active node's coreset in full, raw floating-point precision, the algorithm maintains one rough, constant-factor approximation of the entire stream in high precision. Every active coreset in the merge-and-reduce tree is then compressed ("quantized") by storing only low-precision offsets relative to that single global reference. When a new data point arrives, the algorithm reconstructs the current summary on the fly to decide whether to sample the new arrival.

Because geometry differs across problems, the authors design custom encodings for three foundational tasks:

  • $(k, z)$-Clustering (which generalizes $k$-means and $k$-medians): Each coreset point is decomposed into its nearest rough cluster center plus a directional offset, with the offset coordinates rounded to powers of $(1 + \varepsilon')$.
  • $L_p$ Subspace Embeddings (compressing a tall matrix while preserving vector norms): Rounding matrix rows directly can cause catastrophic cancellation errors. Instead, the authors first multiply the stream by a deterministic preconditioner derived from a well-conditioned basis, ensuring no single row dominates the error before quantizing.
  • Projection-Cost Preserving (PCP) Sketches (used for low-rank matrix approximation): Summaries are split into a "head" (projected onto the top-$k$ singular vectors of the global sketch, stored in high precision) and a residual "tail" (quantized coarsely).

Datasets

While the paper is primarily theoretical, the authors validate their $k$-means clustering algorithm empirically on the MNIST dataset ($n = 70,000$ images of handwritten digits, $d = 784$ pixel features, $k = 10$ clusters). No new benchmark datasets are introduced.

Key Insights and Ideas

  • Sacrificing local validity for global optimality: When tree nodes are rounded against a global reference rather than their own local data blocks, an individual node's decoded summary is no longer a valid coreset for its specific slice of the stream! The "aha" moment is realizing this doesn't matter—when combined, the errors across all active nodes add up to just a tiny fraction of the total stream's objective cost.
  • Preconditioning tames quantization noise: In linear algebra sketches, naive rounding fails because two large numbers might cancel out in a dot product, leaving behind huge relative rounding noise. Preconditioning spreads importance evenly across rows so quantization errors stay proportional to row sensitivities.
  • Shrinking bits into words: Under the standard streaming convention where one "word" of memory holds $\Theta(\log(nd))$ bits, reducing per-point storage overheads to $\text{polylog}(\log n)$ bits means those extra factors vanish into $o(1)$ words—eliminating the $n$-dependence entirely.

Key Results

Across the board, the authors eliminate the dependence on stream length $n$ (in words of memory), matching the space complexity of optimal offline coresets:

  • $(k, z)$-Clustering: Achieves $\tilde{\mathcal{O}}\left(\frac{dk}{\min(\varepsilon^4, \varepsilon^{2+z})}\right)$ words of space—the first streaming algorithm completely independent of $n$ and aspect ratio $\Delta$.
Comparison of memory words required for streaming (k,z)-clustering
  • $L_p$ Subspace Embeddings: Uses an optimal $\tilde{\mathcal{O}}(d^2/\varepsilon^2)$ words for $p \le 2$ and $\tilde{\mathcal{O}}(d^{p/2+1}/\varepsilon^2)$ words for $p > 2$, shedding all $\text{polylog}(n)$ factors.
Comparison of memory words required for streaming Lp subspace embeddings
  • PCP Sketches: Uses $\frac{k^2}{\varepsilon^2} \cdot \text{polylog}(\frac{1}{\varepsilon}, \log(nd\kappa)) + \tilde{\mathcal{O}}(\frac{dk}{\varepsilon^2})$ words, preventing dimension $d$ from multiplying any $n$-dependent terms.
  • Empirical Memory Savings: On MNIST, across target coreset budgets from 20 to 200 points, the efficient encoding framework cuts peak memory usage (in bits) by ~40% compared to the state-of-the-art streaming baseline, while keeping $k$-means clustering costs within 2%.

Limitations and Future Work

The main trade-off for optimal space is update time. Because the algorithm decodes the sketch on every arrival to compute online sampling probabilities:

  • For $(k, z)$-clustering, estimating online sensitivities by enumerating candidate sets of $k$ centers can take exponential time in $k$.
  • For $L_p$ embeddings and PCP sketches, amortized update times are polynomial in $d$ (assuming $n \gg \text{poly}(d, 1/\varepsilon)$), governed by matrix multiplication exponents needed to compute Lewis weights and ridge leverage scores.

The authors leave speeding up these update times—without giving back a single word of their hard-won space optimality—as an open challenge for future work.

Summary updated

Abstract

We study the problem of constructing coresets on data streams: Given a dataset of $n$ points in $\mathbb{R}^d$ arriving sequentially, the goal is to maintain a small weighted subset that accurately approximates the objective values of the entire dataset for a given class of query functions. Previous methods like merge-and-reduce and online sensitivity sampling required more space than the size of an optimal such subset in the offline setting. In this work, we show that such overheads are not necessary by presenting space-optimal streaming algorithms for central high-dimensional optimization problems such as Euclidean $(k,z)$-clustering and $L_p$ subspace embeddings, as well as applications to projection-cost preserving sketches. For $(k,z)$-clustering, our streaming algorithm uses memory independent of the number $n$ of input points (in words of memory) and the aspect ratio $\Delta$, yielding a coreset with an optimal $\tilde{\mathcal{O}}\left(\frac{dk}{\min(\varepsilon^4,\varepsilon^{z+2})}\right)$ words of memory for accuracy parameter $\varepsilon\in(0,1)$. For $L_p$ subspace embeddings, where the rows of matrix $\mathbf{A} \in \mathbb{R}^{n \times d}$ arrive in an insertion-only stream, we achieve an efficient algorithm that uses optimal space for different ranges of $p$: $\tilde{\mathcal{O}}\left(\frac{d^2}{\varepsilon^2}\right)$ words for $p\le 2$ and $\tilde{\mathcal{O}}\left(\frac{d^{p/2+1}}{\varepsilon^2}\right)$ words for $p>2$, both independent of the number of rows $n$. Thus, our work shows that streaming algorithms can match offline algorithms in space complexity.
BibTeX
@inproceedings{wang2026space,
  author = {Liudeng Wang and David Woodruff and Shenghao Xie and Samson Zhou},
  title = {{Space-Optimal Streaming Algorithms via Efficient Encodings}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=7fVfD6Nmw4},
}
Figure