Skip to content

bench: measure hydra-kll without subset fan-out (one key per grouping) #165

Closed as not planned

Description

@milindsrivastava1997

Found in review of #160 (S4b of #143).

Problem

The optimizer models hydra-kll as one sketch keyed by the grouping G: each sample hashes its joined G value into the grid and updates the KLL cell there, so the sketch holds exactly card(G) subpopulations. S4b's eligibility gate (card(G) ≤ subpopulations) assumes this.

The measured rows fan out instead. aqpbm-cli/src/rows/materialise.rs:30 joins the label columns with ;, and asap_sketchlib 0.2.2's Hydra::update splits on ; and inserts into all 2^D − 1 non-empty subsets. On hydra_kll_disjoint_labels.yaml (D = 2) that means 3 inserts per sample: key1, key2, key1;key2. Compared with the intended sketch, the rows:

  • overstate insert CPU by about 3×;
  • understate accuracy: the cells carry N·(2^D−1) units of mass instead of N, so there is more collision noise in the same r×c;
  • misreport load: subpopulations counts only the probed key1 groups, not what the sketch held.

Fix

Measure hydra-kll with one subkey per sample. Any of these works:

  • 0.2.2: join the grouping values with a separator other than ;, so update sees one part (D = 1);
  • asap_sketchlib 0.3 framework Hydra::with_schema(r, c, ["series"], kll) with the joined label set as the single column;
  • the portable HydraKllSketch (message_pack_format/portable/hydra_kll.rs), which never fans out.

Then re-measure the hydra-kll rows (ideally at several group counts too, per the S5 note on #143), with subpopulations equal to the number of distinct joined keys.

Also check that ASAPQuery's HydraKLL engine path keys by the joined grouping without fan-out. Otherwise the deployed sketch won't match the costed one.

🤖 Generated with Claude Code

Activity

  1. milindsrivastava1997 commented on Oct 7, 2026

    @milindsrivastava1997
    ContributorAuthor

    Scope decisions

    1. Only hydra-kll changes. It is the only Hydra variant the optimizer prices. The hydra-cms, hydra-cs, hydra-hll and hydra-univmon rows keep the library's subset fan-out: they benchmark asap_sketchlib's Hydra as it ships, and nothing consumes them.
    2. One insert per sample, on the framework Hydra. The hydra-kll rows join label values with \u{1f} (SERIES_SEPARATOR), which Hydra::update doesn't split on, instead of ;. Queries join with the same separator. The join happens at materialisation, off the timed insert path.
    3. Scored over the full label set. subpop-rank-error for hydra-kll groups by every label column, not just key1. The polars baseline groups by the full key (no fan_out), so subpopulations is the number of distinct label sets, which is what the optimizer's card(G) ≤ subpopulations gate assumes.
    4. Rebase onto main (feat(rqe-optimizer): family properties, shared fixed-size sketches and DeltaSet key tracker #160, rqe-optimizer: split SumOrCount and TopK; deny unknown AtomicCostEntry fields #163), and update the measured_at_group_count comment in rqe-optimizer/src/candidates.rs, which cites this issue.
    5. Sweep group counts in this PR. Three specs differ only in key1's population, 2 / 20 / 200 values, so with key2 (zipf over 50) the sketch holds about 100 / 1k / 10k groups. Row count, key2 and the value distribution don't change. The export script runs every HYDRA_KLL_CONFIGS entry on each spec, merge-accuracy runs included. No pipeline change is needed: same_cell keys on the full table description, so the specs are separate cells, and the optimizer's gate already takes the smallest measured group count ≥ card(G). The stale comments in the existing spec (key1 as "the column the comparator groups by", key2 skew for "subset fan-out") get fixed.

    Out of scope

    🤖 Generated with Claude Code

  2. removed their assignment
    on Oct 7, 2026
  3. zzylol commented on Oct 10, 2026

    @zzylol
    Collaborator

    Closing: the scope here (measure hydra-kll with one key per grouping, no subset fan-out) contradicts the Hydra admission design in #193.

    (decided by @zzylol)

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions