{
  "slug": "count-min-sketch",
  "term": "Count-Min sketch",
  "aliases": [
    "CM sketch",
    "CountMinSketch"
  ],
  "definition": "A Count-Min sketch summarizes a stream using hashed counter rows and estimates an item's frequency from the minimum of its addressed counters.",
  "note": "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. [cm]\n\nWidth 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. [cm] [caffeine]\n\nBasic 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. [cm]",
  "related": [
    "tinylfu",
    "cache-admission"
  ],
  "citations": [
    {
      "id": "cm",
      "title": "Cormode and Muthukrishnan. An Improved Data Stream Summary: The Count-Min Sketch and its Applications. Author preprint, 16 Dec 2003, sections 2-4.1 and 6.",
      "url": "https://www.cs.ox.ac.uk/people/graham.cormode/pubs/papers/cm-full.pdf",
      "accessed": "2026-11-07"
    },
    {
      "id": "caffeine",
      "title": "Caffeine project. Efficiency: Window TinyLFU and its 4-bit Count-Min frequency sketch.",
      "url": "https://github.com/ben-manes/caffeine/wiki/Efficiency",
      "accessed": "2026-10-29"
    }
  ],
  "provenance": [
    "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.",
    "The note covers basic linear counters, including valid deletions with nonnegative true frequencies. It does not transfer the theorem to arbitrary cache-policy variants."
  ],
  "status": "research",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-07"
}
