Repository navigation
Conversation
…ailure probability at the source's distinct bound (#1207 PR 8) distinct_count_guarantee_over_source reads classic HLL's and a distinct-count UnivMon's guarantees (kept dead since PR 4 for this) and binds their failure probability at SourceFacts::max_distinct_per_evaluation, for Stage 3's (K).
CandidateErrorModel (milp/error_bounds.rs): each physical candidate's own guarantee (a sketch state's: the largest error per metric and failure probability of the statistics read from its group; none for a read whose bound needs values not proven non-negative, a windowed or merged state that does not keep the guarantee, or a family without an error model), its error contract per metric (error_propagation), and ceilings of E and D used as M. AccuracyVariables E/F per execution and metric, D/H, U (no guarantee); accuracy_constraints: E >= eps_loc + sum beta F, F >= E_u - M(1-y), the metric rule and validity caps on selected edges, D by a union bound, and the root checks E_v <= eps_q, D_v <= delta_q / n, U_v = 0 when z = 1, for every query the accuracy model does not accept regardless of its guarantee. After the solve, each query's composed guarantee is checked with the model and evidence; an output none accepts is SelectedPlanFailedCheck. AccuracyCheckInputs carries the front ends' query roots (G_q and the accept-regardless policy). Tests: #1207's problem example, the DDSketch sign condition, failure probabilities adding, big-M only on selected edges, and the reference enumeration under (K).
…ee per metric; an exact target's limits are exact (#1207 PR 8)
…o some query (#1207 PR 8)
…ignore mode; a whole-result failure probability over 1,000 series (#1207 PR 8)
…its edge; (K) applies unless the model or evidence may accept outputs regardless; one G per query for (K) and the check; no ceiling cap; tighter HiGHS tolerances under (K) (#1207 PR 8) - The error of reading a state is a constant per edge (u, c) for the consumer's statistic(s) on the producer's theta (E_c >= sum eps_uc y + ...), so one query's read no longer changes another's (a DDSketch read at the maximum keeps its guarantee when a p50 read of the same state has none). - root_accuracy_limits follows the AccuracyModel/AccuracyEvidenceProvider contract (may_accept_regardless_of_guarantee, may_provide_evidence): (K) applies to every query or none; the per-query pre-ASAP accept-regardless call is gone. - values_per_result is computed once from the lowered roots and used by both (K) and the check after the solve; a short query_roots slice is an EntryCount error. - Ceilings stop after one round per execution (a valid M for every acyclic selection) with no cap, which could make unrelated plans infeasible. - OwnGuarantee renamed ErrorBounds (read errors and composed errors). - Tests: the regression test above; the DDSketch sign test checks the declared case too; the big-M test's description matches it.
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.
Stacked on #1237 (PR 7, execution contexts). Part of #1207 (PR 8 of the order), #1204 item 3, #1203. Draft; not to be merged on its own (one merge unit, PRs 0–9).
Why
Until this PR nothing checked a query's composed accuracy: Stage 3 selected the cheapest sizes the edges' parameter floors allowed, and a floor is only a pruning cap (Pass 2 takes the largest cap over the queries, and a target whose metric the family does not state leaves the input unbounded). PR 6 showed the result (handoff H1):$E_c$ , $D_c$ composed over the selected edges with big-M, checked at each query root.
quantile_over_time(0.99, latency_ms[60m])with a rank target of 0.01 selected six DDSketch windows atalpha0.1, a relative error of 10 % that says nothing about rank. The concepts doc §4 and #1204 item 3 define constraint (K): per-candidate error boundsWhat
asap_accuracy::estimators::local_guarantee), with the conditions PR 4 removed with node-tree propagation brought back: a DDSketch interior quantile and a Count-Min count hold only over values proven non-negative; a windowed or merged state keeps a guarantee only when its family's merged error does; a distinct count over a source's own rows takes its failure probability at the source's declared distinct bound (classic HLL, distinct-count UnivMon: the PR 4 dead code, now used).ErrorSelectingPlan::SelectedPlanFailedCheck(the PR 0 variant, now constructed).IgnoreAccuracyGuarantees), asked on the root the front ends lowered (AccuracyCheckInputs::query_roots, new).todo!("#1207 PR 8 …")is implemented (accuracy_constraints); thedead_codeallowances for PR 8 are gone (AccuracyVariables,accuracy_constraints, HLLclassic_guarantee, UnivMondistinct_guarantee,incomplete_top_layer_statistic).Not here: tools and snapshots (PR 9); latency (L) and resource budgets (B) are out of scope (#1204 items 5, 6).
Representation, rules, enumeration (#1207 (a)/(b)/(c))
CandidateErrorModel::composed_errors) and agrees with the MILP on Tracking: implement the optimization formulation (memo candidates, properties, edges y_{u,c,i}, MILP) as named code per stage #1207's problem example under 12 cost/target sets (targets that admit a plan and targets that admit none).Notation → code
OwnGuarantee::{error_bound, failure_probability}(per metric), fromCandidateErrorModel::new(own_guarantee,read_guarantee)CandidateErrorModel::{factor, validity_cap}(fromLogicalRequirements::error_propagation, per metric)CandidateErrorModel::{error_bound_ceiling, failure_probability_ceiling}(the producer's / output's ceiling)AccuracyVariables::{error_bound, error_bound_of_input, failure_probability, failure_probability_of_input}(keys:Execution, input, metric index)accuracy_constraints(model.rs)RootAccuracyLimits(root_accuracy_limits, per query;Nonewhere (K) does not apply)values_per_resultofAccuracyCheckInputs::query_roots[q]accuracy_constraints:RootAccuracyLimits::error_bound_limit[m] = 0for a metric the target does not acceptHow
select_planbuildsCandidateErrorModel::new(physical, data): per physical candidate, its own guarantee, its error contracts in the five metrics, and ceilings (rounds of $\bar E_{c,m} = \varepsilon^{\mathrm{loc}}{c,m} + \sum_i \beta{c,i,m} \max_{u \in P_{c,i}} \bar E_{u,m}$ over admissible edges until stable, at most one round per candidate; capped atroot_accuracy_limits(entries, query_roots, data, model): per query,Nonewhen the model accepts its output regardless of its guarantee; otherwisemax_values_covered(scope, G_q). A scalar root that combines outputs (notscalar(v)) requires exact references.solve_selection: when some query has limits,accuracy_variablesandaccuracy_constraintsadd (K) per execution andaccepted_accuracycomposes each query's error over the selected DAG (composed_errors, no big-M), states it over the target's scope, and checks it with the model, then the evidence, then the accept-regardless rule.Major algorithm changes
Stage 3: constraint (K)
quantile_over_time(0.99, latency_ms[60m]), rank 0.01, selected DDSketchalpha0.1 windows (relative error, not rank); the ratio p99/p50 at relative 0.03 could takealpha0.02 for both operands (each within its floor, composedthe_problem_example_meets_each_query_target_at_its_root,a_ddsketch_interior_quantile_needs_non_negative_values,failure_probabilities_add_along_the_selected_edges,a_producer_s_error_counts_only_on_its_selected_edge,the_milp_agrees_with_the_reference_enumeration_under_accuracy, end to endeach_query_meets_its_target_at_its_root.metric_can_meet, no cross-metric conversion); a model with conversions is only consulted after the solve. Evidence (output_guarantee) cannot make (K) feasible. Latency (L) and budgets (B) out of scope.Deleted (replaced in this PR)
todo!("#1207 PR 8: constraint (K)")and thedead_codeallowances onAccuracyVariables,accuracy_constraints#[allow(dead_code)]on HLLclassic_guarantee, UnivMondistinct_guarantee,incomplete_top_layer_statisticdistinct_count_guarantee_over_sourceaccepted_accuracythat accepted every sketch output in its target's metric without a checkaccepted_accuracyover the composed guarantee (model, evidence, accept-regardless),composed_guaranteesAccuracyVariableskeyed byPhysicalCandidateId(Vec)HashMap)accuracy_constraints(physical, selection, accuracy)accuracy_constraints(inputs, selection, variables, accuracy)ErrorSelectingPlan::SelectedPlanFailedCheck(PR 0) is now constructed; its doc no longer mentions budget shares.New abstractions not in #1207 or the doc (pending approval)
AccuracyCheckInputs::query_roots: &[QueryRoot](pub;PlanningModels::accuracy_check_inputsnow takes the roots): Stage 3 readsvalues_per_result) and asks the model whether it accepts the query's output regardless of its guarantee.asap_accuracy::estimators::distinct_count_guarantee_over_source(parameters, source, max_distinct)(pub): classic HLL / distinct-count UnivMon guarantee with δ bound at the source's declared distinct bound.milp/error_bounds.rs):CandidateErrorModel(own guarantee, contracts per metric, ceilings,composed_errors),OwnGuarantee,RootAccuracyLimits(+EXACT),root_accuracy_limits,returns_its_output_unchanged,METRICS/METRIC_COUNT; private helpersown_guarantee,statistics_read,read_guarantee,proven_non_negative,raw_data_samples_of_metric,source_distinct_bound,state_family.AccuracyVariablesbeyond the doc'swithout_guarantee, part of the output without a guarantee), plus per-execution keys (doc §4:accuracy_variables(creates the family; PR 0 had only the struct andaccuracy_constraints).scalar(v)/ a scalar subquery requires exact references; unknown δ counts as 1.Decisions taken conservatively (please confirm)
IgnoreAccuracyGuarantees(PR 4 question). Ignore mode turns off only (K) (root limitsNonefor every query). Pass 2'svalues_non_negative); otherwise no guarantee (Spec questions
with_failure_probability). Options: (a) add δ variants to the lists (KLLfailure_probability, CMS depth); (b) keep as is (such queries are exact or infeasible). 4 planner tests now fail for this (below); I did not change their workloads.Concat) can carry a rank error from one producer and a relative error from another, soAccuracyEvidenceProvider::output_guarantee) is per candidate output and cannot enter the MILP; it is read only in the post-solve check, so evidence can no longer make an output without a theoretical guarantee selectable. Acceptable, or should the accept-regardless pre-check also consult evidence on the lowered root?k1404 and Tracking: implement the optimization formulation (memo candidates, properties, edges y_{u,c,i}, MILP) as named code per stage #1207's example DDSketchalpha0.002 wherek269 /alpha0.01 meet the targets at the same objective.Lower-PR items (not changed)
RejectionCause::CountMinWeightsNotProvenNonNegativeis never constructed: PR 6 deleted the executability check (nodes_with_proven_non_negative_weights); a Count-Min over unproven weights is now only "no guarantee" under (K), and in ignore mode it can be selected and the executor refuses it (PR 5/6).RejectionCause::{LatencyBoundExceeded, LatencyOverRepeatInterval, OverClusterCapacity}never constructed ((L), (B) out of scope; PR 6).raw_data_samples_of_metricis duplicated: Pass 1's (realization.rs) is crate-private; Stage 3 needs the same walk and cannot depend on Pass 1. Moving it toasap-typeschanges PR 3.docs/design_docs/proposals/planner-layering.mdlines ~277, 313, 372–421 (memo concepts table and the ratio-of-quantiles example) still describeroot_node,input_groups,accuracy_budget_partsand pre-Tracking: implement the optimization formulation (memo candidates, properties, edges y_{u,c,i}, MILP) as named code per stage #1207 counts (PR 0/PR 3 doc; numbers come from PR 9's re-baselinedstage_pipeline).crates/devtools/src/bin/asap_planner.rs:90comment namesaccuracy_budget_parts(PR 9 tool).local_guaranteegives a Count-MinTopKread a frequency bound (old code had none for top-k membership); unchanged.Verification
In progress: independent review and the test table follow in the next body update.