Conversation
zzylol
force-pushed
the
stack/509-w7a-pass2-sizing
branch
from
October 4, 2026 18:25
63d6468 to
3c07c2d
Compare
zzylol
force-pushed
the
stack/509-w7a-univmon-accuracy
branch
from
October 4, 2026 18:25
5a7d78d to
aab5e7e
Compare
This was referenced Oct 4, 2026
Draft
…umers The summary-capability rule gains a frequency-moments key: a distinct count (one column), an L2 norm and an entropy over the same input and window share one UnivMon (#509 Example 2). UnivMon's shape does not depend on the requirement, so the three alternatives are the same state. The UnivMon accuracy model still certifies only the exact total. The published UnivMon bounds (Liu et al., SIGCOMM 2016, via Braverman and Ostrovsky) are asymptotic. The shipped kernel's heuristic recurrence, a fixed top-heap per layer with an L2/sqrt(heap) cut, does not meet their per-layer cover premise. Distinct count, L2 and entropy therefore stay uncertified. The reasoning is documented, and a test pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol
force-pushed
the
stack/509-w7a-pass2-sizing
branch
from
October 5, 2026 06:21
3c07c2d to
cf0df8a
Compare
zzylol
force-pushed
the
stack/509-w7a-univmon-accuracy
branch
from
October 5, 2026 06:21
aab5e7e to
a6e5cda
Compare
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.
Rebased on main d4869a7 (DF 54).
Wave 1 chain: #594 → #593 → #592 → #591 → #595 → #596 → #597 → #598 → #599 (on #589)
Part of #509 (Example 2), #580 item E (accuracy part).
Why
#509 Example 2 has one UnivMon serving a distinct count, an entropy and an L2 norm, sized for the strictest requirement. Two things blocked it: the summary-capability rule (#595) knew only quantiles, and UnivMon certified only its total, so Stage 3 rejected every other UnivMon estimate.
What
FrequencyMomentskey.Cardinalityover at most one column,FrequencyL2andFrequencyEntropyover the same input, window, grouping and column share one UnivMon. All members of the key are re-sized for the strictest requirement (W5). UnivMon's shape does not depend on ε, so the three UnivMon alternatives are one state. The other summaries (for example the distinct count's HLL) are re-sized for the strictest ε.accuracy/estimators/univmon.rsdocuments why:(heap_size, rows, cols, layers).asap_sketchlib::UnivMon::calc_g_sum_heuristickeeps a fixed top-heap_sizeheap per layer, read through that layer's CountSketch. For distinct counts it also drops items belowL2/√heap_size. Nothing bounds the probability that a heap is a cover, so the theorem's premise does not hold. Even with complete heaps, a CountSketch estimate can be ≤ 0 for a present item, so the distinct count is not certified there either.calc_l2reads the recursive sum, not that estimate.estimators::size_paramsis unchanged, since it has no bound to invert (UnivMon keeps its fixed candidate shape). This is documented onunivmon::size_params.Before / After
distinct_over_time(src[1m])at ε = 0.02,entropy_over_time(src[1m])at ε = 0.05 andl2_over_time(src[1m])at ε = 0.01, throughe2e_plan(frequency_moments_share_one_univmon_in_the_stage_pipeline):So for PromQL the new key changes no selection today. I checked this: the new pipeline test also passes on #595's rule. The key matters when pre-ASAP CSE merges nothing (SQL's unkeyed scans, for example
COUNT(DISTINCT)next to a future SQL entropy/L2), or once UnivMon is sized per ε. The test pins the shared outcome either way.Tests
univmon::tests::only_the_total_is_certifiedpins that the total is certified and the three readouts are not.summary_capability::tests::frequency_moments_share_one_univmon.summary_sharing::frequency_moments_share_one_univmon_in_the_stage_pipelineis the 3-consumer case throughplan_stagesvia the facade.Gate
fmt and clippy (
-D warnings) are clean.cargo test --workspace: 1,531 passed and 7 ignored, against 1,528 and 7 on #595 and 1,517 and 10 on #589. That is +3 new tests. The Example 1 fixture regenerates byte-identically.Gaps
🤖 Generated with Claude Code