count-min-sketch · research · also CM sketch, CountMinSketch

Count-Min sketch

A Count-Min sketch summarizes a stream using hashed counter rows and estimates an item's frequency from the minimum of its addressed counters.

Related Observatory article: Read on hesela.com

Basic updates add the same weight to one counter per row. With nonnegative true key frequencies, exact arithmetic and no aging or saturation, collisions can only inflate an estimate. The minimum reduces inflation but does not guarantee correct ordering between items. Deletions are allowed if true frequencies remain nonnegative. Nonnegative bucket values alone do not prove this. [1]

Width and depth set an additive error bound relative to current total stream mass for a fixed query, with probability over the hash choice. This is not a fixed percentage error for every rare key or a simultaneous guarantee for every key and time. Capped, aged cache-policy counters cannot automatically inherit the cumulative-count guarantee. [1] [2]

Basic sketches with the same dimensions and hash functions combine by counter-wise addition, not sums of minimum estimates. Key encoding and counted units must also agree. Merging overlapping observations counts them again: this is addition, not deduplication. Saturation, rounding and data-dependent updates require separate analysis. [1]

Conservative update: for positive weight c, raise each addressed counter to max(counter, minimum + c), using the pre-update minimum. Compatible insertion-only sketches can still be added: estimates remain between true counts and basic Count-Min estimates, but need not match one-stream replay. [3]

Windowing: subtracting cumulative conservative snapshots can undercount. With A=(0,0) and B=(0,1), after A then B, subtracting the A snapshot gives B an estimate of 0, not 1. Removing an immutable bucket from its exact table sum is a different, valid operation. [4]

Relations

related
CountSketch, Turnstile stream, TinyLFU, Cache admission

Citations

  1. Cormode and Muthukrishnan. The Count-Min Sketch and its Applications. Author preprint, 16 Dec 2003, sections 2-4.1 and 6. (accessed 2026-11-07)
  2. Caffeine project. Efficiency: Window TinyLFU and its 4-bit Count-Min frequency sketch. (accessed 2026-10-29)
  3. Goyal, Daume III and Cormode. Sketch Algorithms for Estimating Point Queries in NLP. EMNLP-CoNLL 2012, sections 2 and 2.2. (accessed 2026-11-20)
  4. Hesela. Conservative Count-Min: merge, snapshot subtraction and weighted-update evidence. Exact model and tests. (accessed 2026-11-20)
Sources & caveats
  • The linked author manuscript is dated 16 December 2003; the journal article appeared in Journal of Algorithms 55(1), 58-75 (2005), DOI 10.1016/j.jalgor.2003.12.001.
  • Basic linear counters allow valid deletions; conservative-update guarantees here require positive updates, compatible addresses and exact unsaturated arithmetic. No claim covers arbitrary cache-policy variants.
  • The linked evidence uses constructed two-row, two-column examples and exact integer enumeration, not a workload sample or a measured error probability. It also checks weighted updates against repeated unit increments.
  • Conservative-update row totals need not equal each other or the sum of input weights. Retain total stream mass separately when interpreting the additive error bound. [3] [4]

JSON: /data/terms/count-min-sketch.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Count-Min sketch. Hesela. 2026-11-20. https://hesela.dev/terms/count-min-sketch/