Papers
Topics
Authors
Recent
AI Research Assistant
AI Research Assistant
Well-researched responses based on relevant abstracts and paper content.
Custom Instructions Pro
Preferences or requirements that you'd like Emergent Mind to consider when generating responses.
Gemini 2.5 Flash
Gemini 2.5 Flash 89 tok/s
Gemini 2.5 Pro 43 tok/s Pro
GPT-5 Medium 24 tok/s Pro
GPT-5 High 24 tok/s Pro
GPT-4o 112 tok/s Pro
Kimi K2 199 tok/s Pro
GPT OSS 120B 449 tok/s Pro
Claude Sonnet 4 37 tok/s Pro
2000 character limit reached

Weighted Quantile Sketch: Algorithms & Applications

Updated 22 September 2025
  • Weighted quantile sketching is a technique using statistical methods and streaming algorithms to efficiently compute quantiles for data with arbitrary positive weights.
  • It generalizes traditional quantile estimators by adapting structures like the GK extension and KLL algorithms, ensuring low memory usage and fast update times.
  • Its applications span network monitoring, real-time analytics, and regression analysis, providing robust quantile estimations in massive, weighted data streams.

Weighted quantile sketching is an area comprising statistical methods and streaming algorithms designed to efficiently compute quantiles and related distributional summaries when observations carry arbitrary positive weights. Weighted quantile sketches generalize classic unweighted quantile estimators and streaming data structures by considering the importance or replication factor of each data point, allowing applications ranging from robust regression and risk estimation to online monitoring and cardinality estimation in massive data streams.

1. Principles and Motivation

Weighted quantile sketch techniques address scenarios where each observation xix_i is equipped with an associated nonnegative weight wiw_i. The generalized empirical quantile function tracks the locations in the sorted list of observations, with location determined not by indices i/ni/n but by cumulative normalized weights wˉi=wi/jwj\bar{w}_i = w_i/\sum_j w_j and cumulative sums si=j=1iwˉjs_i = \sum_{j=1}^i \bar{w}_j. This approach is essential in cases with duplicated, replicated, or differently significant records, as encountered in mixture modeling, time series with temporal decay, or data streams with frequency counts.

A central requirement for weighted quantile sketching is consistency: if all wiw_i are equal, the estimator reduces to its classical unweighted form. Additionally, zero-weight observations must not affect the outcome, and the method should be stable under small perturbations in weights.

2. Algorithmic Streaming Sketches

Greenwald–Khanna (GK) Extension

Classical streaming quantile summaries use deterministic comparison-based algorithms such as the Greenwald–Khanna (GK) structure, which achieves O(1ϵlog(ϵn))O(\frac{1}{\epsilon}\log(\epsilon n)) space for nn elements and guarantees additive rank error ϵn\epsilon n. When each element comes with weight wiw_i, the naive approach of inserting each item wiw_i times causes update time to scale with wiw_i, which is computationally prohibitive [y]. The first nontrivial deterministic extension of GK for weighted inputs maintains a compact representation and achieves O(1ϵlog(ϵn))O(\frac{1}{\epsilon}\log(\epsilon n)) space and O(log(1/ϵ)+loglog(ϵn))O(\log(1/\epsilon)+\log\log(\epsilon n)) update time per element, provided weights are bounded. This matches tight space lower bounds for comparison-based summaries (Assadi et al., 2023).

The critical data structure adapts the GK summary: it stores tuples (v,g,Δ)(v, g, \Delta) tracking value vv, lower bound gg on cumulative weight below vv, and uncertainty Δ\Delta on the weight window. Update procedures merge segments of consecutive items, adjusting gg and Δ\Delta to accommodate arbitrary weights and ensuring the summary maintains the quantile rank invariant with respect to cumulative weights.

KLL and Weighted Compactor Algorithms

Algorithms in the KLL family extend naturally to weighted streams, providing randomized sketches with improved space–accuracy trade-offs and O(logn)O(\log n) update complexity for weighted arrivals (Ivkin et al., 2019). Weighted item support is achieved either by binary decomposition of weights (base-2 representation feeding updates across compactor levels) or weight-aware compactor structures where weights for pairs (a,wa)(a, w_a), (b,wb)(b, w_b) are merged via probabilistic retention and weight summing. These methods avoid the linear cost in wiw_i associated with naive duplication.

Furthermore, memory usage is minimized by employing shared packed arrays and lazy compaction, ensuring practical efficiency in embedded and high-throughput scenarios.

3. Weighted Quantile Estimators

Generic frameworks for weighted quantile estimation revise classical estimators such as linear interpolation-based types or the Harrell–Davis estimator (Akinshin, 2023). For a sample x1,,xnx_1,\dots,x_n and normalized weights wˉi\bar{w}_i, cumulative sums ti=j=1iwˉ(j)t^*_i = \sum_{j=1}^i \bar{w}_{(j)} (indexed by ordered statistics) replace uniform spacing.

Weighted Harrell–Davis estimator takes the form: Q(x,w,p)=i=1nWHD,ix(i),Q^*(x,w,p) = \sum_{i=1}^{n} W^*_{\mathrm{HD}, i}\, x_{(i)}, where WHD,i=Iti(α,β)Iti1(α,β)W^*_{\mathrm{HD}, i} = I_{t^*_i}(\alpha^*,\beta^*) - I_{t^*_{i-1}}(\alpha^*,\beta^*), and effective sample size n=(wi)2/wi2n^* = (\sum w_i)^2/\sum w_i^2 replaces nn.

For time series quantile exponential smoothing, exponentially decaying weights (e.g., wi=2(ni)/t1/2w_i = 2^{-(n-i)/t_{1/2}} for half-life t1/2t_{1/2}) are employed, yielding adaptable estimates of evolving distributional tails. Robust "trimmed" versions further increase resistance to outliers by restricting the weight function to highest density intervals.

In mixture models, quantile estimation can be performed via weighted combinations of separate component CDFs, with the estimator respecting mixture weights and continuity requirements.

4. Applications in Data Streams and Real-Time Analytics

Weighted quantile sketches are indispensable in massive streaming applications:

  • Network Monitoring: Quantile summaries (e.g., p99 latencies) over weighted streams quickly detect performance anomalies, with sketches such as KLL or DDSketch adapted for weighted samples. DDSketch and its variants (UDDSketch) provide relative error guarantees and support full mergeability, maintaining accuracy across distributed systems and arbitrary data distributions (Masson et al., 2019, Epicoco et al., 2020).
  • Per-Item Quantiles: In network analytics, SQUAD and similar algorithms efficiently track quantiles for heavy hitters in the presence of weights, combining reservoir sampling and sketching to minimize space complexity and enable accurate tail estimation (Shahout et al., 2022).
  • Weighted Cardinality Estimation: QSketch applies quantization to weighted cardinality, estimating sums of weights of unique elements with extreme memory efficiency (8 bits per register) and O(1)O(1) update time, outperforming traditional continuous-register sketches such as Lemiesz’s method or FastGM (Qi et al., 27 Jun 2024).
  • Regression Analysis: Weighted quantile regression techniques exploit replication in covariate groups, yielding more efficient estimators in contexts such as climate modeling or financial risk analysis. Weighted-average quantile regression further interfaces with quantile sketching by modeling integrated effects over the conditional quantile function (Jana et al., 2019, Chetverikov et al., 2022).

5. Theoretical Guarantees and Complexity

Deterministic streaming summaries for weighted quantiles match known lower bounds: O(1ϵlogn)O(\frac{1}{\epsilon}\log n) or O(1ϵlog(ϵn))O(\frac{1}{\epsilon}\log(\epsilon n)) space (Assadi et al., 2023), [y]. Randomized sketches, including KLL variants, achieve improved constant factors and fast update time (O(logn)O(\log n)) for weighted items (Ivkin et al., 2019).

Weighted quantile estimators based on linear combinations of order statistics and effective sample size provide stable, consistent inference even under arbitrary weighting, and are robust to zero-weight items and small perturbations (Akinshin, 2023).

In streaming contexts, algorithms maintain error guarantees in rank or relative quantile estimation. For instance, DDSketch achieves for any quantile query qq that the returned estimate x~q\tilde{x}_q satisfies xqx~qαxq|x_q-\tilde{x}_q|\leq \alpha x_q, with memory requirements scaling logarithmically in dataset size (Masson et al., 2019).

QSketch’s quantization and dynamic updating yield O(1)O(1) update complexity and retain accuracy within 30% of state-of-the-art, using only $1/8$ the memory (Qi et al., 27 Jun 2024).

6. Extensions and Open Directions

Weighted quantile sketching remains an active research area with several open directions:

  • Robust Regression and Adaptive Weighting: Extensions to nonlinear or high-dimensional quantile regression using machine learning for conditional CDF estimation, adaptive weight function selection, and streaming updates (Chetverikov et al., 2022).
  • Cardinality, Frequency Moments, ℓₚ‐Sampling: Generalizing sketches for cardinality to support efficient sampling without replacement (WOR ℓₚ) allows accurate estimation of frequency-based statistics and tail quantiles even under heavy-weight skew (Cohen et al., 2020).
  • Distributed and Concurrent Algorithms: Multi-threaded and distributed sketch architectures (e.g., Quancurrent) support high-throughput, low-latency quantile inference, with potential extensions for weighted inputs via modified hierarchical weighting logic (Elias-Zada et al., 2022).
  • Real-Time Monitoring and Anomaly Detection: Applications extend to networked systems, cache management, and anomaly detection where weighted events and updates drive statistical summaries under tight constraints (Ben-Basat et al., 2022, Qi et al., 27 Jun 2024).

Weighted quantile sketching thus offers foundational tools for modern data analytics, combining statistical rigor, computational efficiency, and adaptability to arbitrary weighting schemes. Its integration into streaming systems, regression modeling, and density estimation continues to foster advances in scalable, online, and robust statistical computing.

Forward Email Streamline Icon: https://streamlinehq.com

Follow Topic

Get notified by email when new papers are published related to Weighted Quantile Sketch.