{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/optimal-quantile-approximation-in-streams","title":"Optimal Quantile Approximation in Streams","arxiv_id":"1603.05346","date":"2016-03-17","proceeding":null,"authors":["Zohar Karnin","Kevin Lang","Edo Liberty"],"abstract":"This paper resolves one of the longest standing basic problems in the streaming computational model. Namely, optimal construction of quantile sketches. An $\\varepsilon$ approximate quantile sketch receives a stream of items $x_1,\\ldots,x_n$ and allows one to approximate the rank of any query up to additive error $\\varepsilon n$ with probability at least $1-\\delta$. The rank of a query $x$ is the number of stream items such that $x_i \\le x$. The minimal sketch size required for this task is trivially at least $1/\\varepsilon$. Felber and Ostrovsky obtain a $O((1/\\varepsilon)\\log(1/\\varepsilon))$ space sketch for a fixed $\\delta$. To date, no better upper or lower bounds were known even for randomly permuted streams or for approximating a specific quantile, e.g.,\\ the median. This paper obtains an $O((1/\\varepsilon)\\log \\log (1/\\delta))$ space sketch and a matching lower bound. This resolves the open problem and proves a qualitative gap between randomized and deterministic quantile sketching. One of our contributions is a novel representation and modification of the widely used merge-and-reduce construction. This subtle modification allows for an analysis which is both tight and extremely simple. Similar techniques should be useful for improving other sketching objectives and geometric coreset constructions.","url_abs":"https://arxiv.org/abs/1603.05346v2","url_pdf":"https://arxiv.org/pdf/1603.05346v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"links_only","authors_date_abstract":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license), from the Kaggle arXiv metadata snapshot of 2026-09-12"},"code_links":[{"paper_slug":"optimal-quantile-approximation-in-streams","repo_url":"https://github.com/edoliberty/streaming-quantiles","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"optimal-quantile-approximation-in-streams","repo_url":"https://github.com/zkarnin/quantiles-biased-python-experimental","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1603.05346","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1603.05346"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/edoliberty/streaming-quantiles","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zkarnin/quantiles-biased-python-experimental","reach":{"status":"ok"}}],"summary":{"unverified":1},"by_repo_kind":{"listed":{"samples":1,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"2fc778574409e4a8","entry":"trailing_ones_binary","repo":"edoliberty/streaming-quantiles","repo_kind":"listed","path":"relativeErrorSketch-experimental.py","file_url":"https://github.com/edoliberty/streaming-quantiles/blob/HEAD/relativeErrorSketch-experimental.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2fc778574409e4a8"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}