Repository navigation
Conversation
… measured accuracy table study_saturation.py --phase hll-tail runs hll-tail-study (a standalone crate pinning the asap_sketchlib commit the planner's executor runs) over lg_k 12..18, distinct counts 1..1e6 (10 per decade) and states merged from 1, 6, 60 and 360 panes, 2,000 trials per point. It measures HyperLogLogSparse, read as the executor reads it, and writes the error not exceeded except with probability delta, worst over counts and panes, as ASAPPlanner's MeasuredSketchAccuracy JSON. --phase univmon-tail does the same for the planner's UnivMon shapes (distinct count and entropy) with univmon-tail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 10-per-decade count grid stepped over the error spike near n = 2.4 * 2^lg_k (the estimate crosses 2.5 * 2^lg_k and switches estimators), so the table understated the worst error by up to 2x (p16 0.0150 vs 0.0319). --phase hll-tail now also runs, per precision, counts at 0.01 m steps over [2.25, 2.6] m and 0.05 m over [2.0, 3.2] m (one pane: merging changes no state; 1,000 trials). New worst at delta 0.05: p12 0.0507 ... p18 0.0297; the least precision meeting rel 0.05 is 13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ASAPPlanner had no failure probability for HLL's distinct count or for UnivMon's distinct count and entropy, so under an accuracy target it pruned them. This PR adds
--phase hll-tailand--phase univmon-tail. They measure the per-value tail error (the error not exceeded except with probability δ, worst over counts and merged panes) on the exact state the planner's executor runs, and write it in the planner'sMeasuredSketchAccuracyJSON format. Example: HLL lg_k 13 has worst relative error 0.0426 at δ 0.05 over distinct counts 1..1e6 (including the estimator's switch band) and 1–360 panes, so p13 is the least precision meeting rel 0.05 / δ 0.05 per value. p12 misses at 0.0507.Review guide
main. Read first:hll-tail-study/src/main.rs(trial definition) andhll_tail/hll_tail_worst/measured_accuracy_tableinscripts/studies/study_saturation.py.hll-tail-study/src/bin/univmon-tail.rsandunivmon_tail. Docs:docs/saturation_study.md, "HLL per-value tail error".hll-tail-study/is its own workspace. It pins asap_sketchlibd28d5a6(feat(hll): HyperLogLogSparse — exact hash set up to m/8, then classic registers asap_sketchlib#275, the sparse HLL the executor now keeps), not the benchmark's pin.Behavior: before → after
Before: no such phase; the planner's HLL guarantee had an unknown failure probability. After:
out_hll/hll_measured_accuracy.json(7 entries, lg_k 12..18) andout_um/univmon_measured_accuracy.json(32 entries). ASAPPlanner loads them with--measured-accuracy.HLL,
HyperLogLogSparse, worst relative error per value. Decade grid at 2,000 trials, plus the switch band at 1,000 trials. Merged and unmerged states give identical errors in all 406 decade-grid (lg_k, n) pairs; the error is 0 below m/8 items.Every worst case is in the switch band near 2.4·2^lg_k, about 0.05·2^lg_k wide. Review finding (fixed in 87f3ce2): the first version used only the 10-per-decade grid, stepped over the band, and understated the error by up to 2× (p16 0.0150 → 0.0319). The least precision meeting rel 0.05 at δ 0.05 is 13.
UnivMon results are in the doc. Entropy within 0.1 bits at δ 0.05 needs 14,349 columns or more at 19 layers (13,500 × 5 × 56,817 × 19 gives 0.020 bits).
Interfaces
scripts/studies/study_saturation.py,hll-tail-study/Usage: see Behavior. The planner side is ProjectASAP/ASAPPlanner
feat/hll-measured-accuracy:crates/accuracy/measured/{hll_distinct,univmon}.jsonandasap_planner --measured-accuracy.Algorithm changes
Measured per-value bound. Problem: HLL's standard error states no failure probability. Steps:
Correctness: requests are only answered at the recorded δ ≥ 3/trials; the planner never extrapolates. Complexity: O(trials · Σ n · |panes|) updates. The HLL run took about 3 h on 16–32 threads. UnivMon's 16 shapes took about 25 min on 14 threads. Limits: the result is an empirical estimate, not a proof. Items are random 64-bit values hashed by the state.
Decisions and open questions
Verification
python3 scripts/studies/test_study_saturation.pycargo build --release, fmt, clippyFollow-ups (deferred)
🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi