Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions configs/datagen/hydra_columns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
# Reported throughput is records per second, which is the denominator that stays
# comparable as `d` changes.
#
# The columns here share the default alphabet, so their value domains overlap: a
# query for label `"abc"` cannot distinguish the key1 group from the key2 group,
# and the estimate absorbs both. This is #74, and it is the reason the `polars`
# rows do not score zero on this file. Give each column its own
# `string.alphabet` to make the domains disjoint, and the baselines drop to
# exactly zero.
# The columns here share the default alphabet, so their value domains overlap.
# The sketch is not affected: asap_sketchlib 0.3.0 keys each subset by column
# (`key1:abc`), so a key1 value never collides with the same key2 value. The
# `polars` exact baselines still build untagged subset keys (the 0.2.2
# encoding, `polars_shared.rs`), so on this file they merge the key1 and key2
# groups and do not score zero (#74; docs/rqe_optimizer_hydra.md §5.2). Give
# each column its own `string.alphabet` and the baselines drop to exactly zero.

column_num: 3
column_label: [key1, key2, value]
Expand Down
9 changes: 5 additions & 4 deletions configs/datagen/hydra_kll_disjoint_labels.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# `hydra_columns_f64.yaml` with a separate alphabet per label column, so a key1
# value can never render the same as a key2 value (#74). On the shared alphabet
# a key1 query also picks up the matching key2 group, and that collision shows
# up as rank error; here the `polars` baseline scores zero and any rank error
# is the sketch's. `export_rqe_optimizer_costs.sh` priced `hydra-kll` on it
# value can never render the same as a key2 value (#74). The sketch keys each
# subset by column (asap_sketchlib 0.3.0), so it doesn't need this; the
# `polars` baseline still builds untagged subset keys, and on the shared
# alphabet it merges a key1 group with the matching key2 group. Here the
# baseline scores zero and any rank error is the sketch's. `export_rqe_optimizer_costs.sh` priced `hydra-kll` on it
# until #174; HydraKLL has no saturation curve, so nothing measures it now.

column_num: 3
Expand Down
2 changes: 1 addition & 1 deletion docs/rqe_optimizer_TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ implemented, what is next, and what is intentionally deferred.
- Real query concurrency in the snapshot objective, whose memory assumes every
query runs at once (cost by use holds query memory only while it runs).
- Bursty load; CPU is a mean over time.
- Admitting Hydra.
- Admitting Hydra ([rqe_optimizer_hydra.md](rqe_optimizer_hydra.md)).
- Key labels `K` (PerGroup + PerKey sizes).
- RQE churn, replanning, and migration cost.
- Temporal pre-merging; v1 merges selected base instances at query time.
Expand Down
6 changes: 4 additions & 2 deletions docs/rqe_optimizer_candidates.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
This document is the canonical design for candidate construction, eligibility
(accuracy included), finer-to-coarser roll-ups and dominance pruning. What a
candidate costs, and the MILP that maps RAQEs to candidates, are in
[Cost models](rqe_optimizer_cost_model.md).
[Cost models](rqe_optimizer_cost_model.md); Hydra is in
[Hydra](rqe_optimizer_hydra.md).

## Candidate deployments

Expand Down Expand Up @@ -223,7 +224,8 @@ univmon-cardinality, KLL and DDSketch. These don't, and serve only
`k` can hold keys that are in none of its fine groups' heaps.
- **Hydra**. It inserts every label subset of its schema, so a coarse
grouping inside the schema is answered directly from the grid, never by
merging fine groups; it is not a candidate today.
merging fine groups; it is not a candidate today
([Hydra](rqe_optimizer_hydra.md)).

- **Cost**: ingest, compaction and storage stay at `G_d`; the query job merges
`I_d · n − I_r` times and answers `card(G_r)` groups
Expand Down
41 changes: 24 additions & 17 deletions docs/rqe_optimizer_cost_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
This document is the one home for what a candidate costs (§3's table), the
canonical cost-by-use model with its MILP, and the still-supported
snapshot-AUC objective. Candidates and eligibility are in
[Candidate generation and eligibility](rqe_optimizer_candidates.md).
[Candidate generation and eligibility](rqe_optimizer_candidates.md); Hydra
is in [Hydra](rqe_optimizer_hydra.md).

## Model status and relationship

Expand All @@ -17,7 +18,8 @@ snapshot-AUC objective. Candidates and eligibility are in
query memory is summed as if concurrent, there is no worker fan-out or
compaction, and latency is serial query work. It is not the evaluation's
billing model.
- **Hydra** is future work, not a candidate today.
- **Hydra** is future work, not a candidate today; see
[Hydra](rqe_optimizer_hydra.md).

The two implemented objectives share the same resource primitives and §3's
table; they differ in how they account for them over time, and in latency
Expand Down Expand Up @@ -375,11 +377,12 @@ The model uses `I_d × m`, where `I_d` is instances per window:
- Shared + Fixed: `I_d = 1`. In code this is the family property
`one_fixed_size_sketch_for_all_groups`, true only for HydraKLL. It applies
to memory and merge; query stays `card(G_r) × c_qry`, one probe per answered group.
A fixed-size sketch degrades as groups grow, so it is eligible only when
`card(G_d)` is at most the `subpopulations` its row was measured at. This
models a sketch keyed by the joined `G` value alone; the current rows fan
out to every label subset (sketch-bench#165), and merging several windows
is not yet measured (sketch-bench#166).
Today's code also requires `card(G_d)` to be at most the `subpopulations`
its row was measured at. That is necessary, not sufficient: a Hydra
group's error depends on the grid's fanned-out mass against the group's
own size, not on the group count alone, so admission needs the measured
predicate of [Hydra](rqe_optimizer_hydra.md) §2.4. HydraKLL is never a
candidate today, so the check decides nothing.

PerGroup + PerKey is deferred until a family needs it: it needs the key labels
`K`, the metric's labels minus `G`. So for every family in use, nothing scales
Expand All @@ -389,17 +392,20 @@ many endpoints it counts.
Side by side, what each family puts into §3's table (every phase then
follows from it):

| | KLL (per group) | exact-sum (per-group normalized) | HydraKLL (shared, fixed) |
|---|---|---|---|
| `m`, `c_mrg` in the row | one group's | whole ÷ groups | whole sketch |
| `I_d` (instances per window) | `card(G_d)` | `card(G_d)` | 1 |
| `I_r` (states a query ends with) | `card(G_r)` | `card(G_r)` | 1 |
| probes per query (`c_qry`) | `card(G_r)` | `card(G_r)` | `card(G_r)` |
| key tracker part | none | none | DeltaSet, `I_d = card(G_d)` |
| rolls up (`G_r ⊂ G_d`) | yes | yes | no |
| | KLL (per group) | exact-sum (per-group normalized) |
|---|---|---|
| `m`, `c_mrg` in the row | one group's | whole ÷ groups |
| `I_d` (instances per window) | `card(G_d)` | `card(G_d)` |
| `I_r` (states a query ends with) | `card(G_r)` | `card(G_r)` |
| probes per query (`c_qry`) | `card(G_r)` | `card(G_r)` |
| key tracker part | none | none |
| rolls up (`G_r ⊂ G_d`) | yes | yes |

A Hydra grid is the Shared + Fixed case, `I_d = I_r = 1`; its row, probes
and key tracker are in [Hydra](rqe_optimizer_hydra.md) §3.

HydraKLL has `FamilyProperties` but is in no capability's family list, so it
is never a candidate.
is never a candidate; see [Hydra](rqe_optimizer_hydra.md).

### Family properties and key tracker

Expand All @@ -418,7 +424,8 @@ Each family has properties, hardcoded by variant in `family_properties`
and is dropped if the cost table has none; a deployment without its tracker
is never eligible. The cost table may hold at most one DeltaSet row.

The tracker is priced as an exact accumulator on the same `x`, `y` and `G`,
The tracker is priced as an exact accumulator on the same `x`, `y` and `G`
(Hydra's tracker grouping is open: [Hydra](rqe_optimizer_hydra.md) §6.1),
in every phase: ingest, merge (union of the `n_i` windows' key sets), query
(enumerate keys) and storage. Its `m` is per key, so it adds `card(G_d) × m_ds`
per window. The AutoSketch baseline skips shared fixed-size families for now
Expand Down
Loading
Loading