How it works
contextlift treats business context like application code. A change to a rule, dbt metric, semantic view, or worked example does not ship on intuition; it runs in a paired experiment against real SQL execution on a held-out question set.
Two arms, one difference
Every spec/ repository compiles into two strict arms:
| Arm | Name | Contents |
|---|---|---|
| Control | Arm 0d | spec/schema/ only: the physical table and column descriptions the estate already had. |
| Treatment | Arm 1 | spec/schema/ plus authored context: rules/, authored/, vocabulary/, examples/, and relationships.yaml. |
Because Arm 0d is a strict subset of Arm 1, any accuracy delta belongs exclusively to the authored context change. Giving Arm 0d zero schema descriptions would credit authored rules for baseline metadata the warehouse already carried.
Execution accuracy and sealed holdouts
Every predicted query and every gold query runs read-only against your real database:
- Result sets are compared as normalized multisets (ordered when the gold query specifies
ORDER BY), with1e-4relative float tolerance,--timeout(default60s), and--row-cap(default500rows). splitpartitions the gold set deterministically by hash into a working set (curate.csv) fortriage,draft-rules,suggest, and worked examples, and a held-out set (holdout.csv) recorded in.contextlift/holdout_ledger.json. Reading the holdout a second time requires interactive/dev/ttyconfirmation.
Paired statistics, verdicts, and safety badges
Each question is answered by both arms, producing paired flips (c fixed, b broke) and question-level lift 100 * (c - b) / n with an exact two-sided McNemar p-value and a 95% paired Tango score interval (metrics.paired_difference_interval, continuity-corrected).
Every round emits one verdict word in strict precedence order:
| Verdict | Meaning |
|---|---|
INVALID | A pre-flight or post-run gate failed (leakage, template twins, unwaived lint refusals, copied answer key, or insufficient power). Scores are not publishable. |
REAL GAIN | Statistically significant positive lift (p < 0.05, lift > 0) on held-out questions with all gates passing. |
REAL LOSS | Statistically significant negative lift (p < 0.05, lift < 0). The context harmed accuracy. |
OVERFIT | Working set gained significantly and the working-minus-holdout gap interval excludes zero. More questions do not fix this. |
UNDERPOWERED | Held-out set is too small to detect --target-lift even in the best case (6 unanimous flips is the smallest exact McNemar result at p < 0.05). |
NO CHANGE | Held-out set had sufficient power and zero questions flipped in either direction. |
NOT PROVEN | Held-out set had sufficient power, some questions moved, and p >= 0.05. |
Because positive average lift can hide regressions, every verdict also carries an independent safety badge (ablate.safety_word):
| Safety badge | Condition |
|---|---|
SAFE | 0 held-out questions broke (b == 0). |
MIXED | Positive net lift, but at least one previously working question broke (c > b > 0). Broken question IDs are printed beside the badge. |
REGRESSION | Context broke at least as many questions as it fixed (b >= c, b > 0). |
Before making the first paid call, round runs six free refusal gates: table coverage, project match, resolvable lift, leakage and template twins, lint (including live --db enum checks), and budget/TTY confirmation. After a round, attribute parses SQL ASTs to rank suspect rules and bisect binary-searches the rule set to confirm causality.
Results
Every published number is pinned by a test in tests/ to a committed run in docs/evidence/ or examples/. The machine-readable source of truth is docs/assets/results.json.
| Context change | Questions | Lift, points [95% CI] | McNemar p | Verdict | Evidence |
|---|---|---|---|---|---|
| BIRD evidence sentences written by people, 3 databases (K=1, no holdout split) | 39 | +23.1 [+1.2, +43.6] | 0.0352 | REAL GAIN | examples/bird/run.py |
| BIRD evidence sentences, 11 databases (25.4% selective coverage, oracle table routing) | 65 | +18.5 [+4.6, +32.7] | 0.0044* | REAL GAIN | examples/bird/enterprise_result.json |
| BEAVER verified-query worked examples, 97-table warehouse | 69 | +10.1 [+0.2, +21.8] | 0.0391 | REAL GAIN | examples/beaver/result.json |
| LookML read into rules, no written descriptions | 102 | +2.0 [-4.8, +9.3] | 0.6875 | NOT PROVEN | round-2026-09-12.txt |
| Oracle selection vs 22 KB blob, 3 databases | 450 | -2.2 [-5.9, +1.4] | 0.2451 | NOT PROVEN | blob-vs-selection.txt |
| Oracle selection vs 22 KB blob, Toxicology | 139 | -8.6 [-17.0, -0.8] | 0.0290 | REAL LOSS | blob-vs-selection.txt |
| Repairing quoted enum literals against live column values | 450 | +1.3 [-1.1, +3.9] | 0.3075 | NOT PROVEN | repaired-literals.txt |
\*On the 11-database BIRD run (K=3, 65 targeted questions), 15 questions flipped up across all 3 reps, 3 broke across all 3 reps, and 11 were unstable across reps. The table's p = 0.0044 is the question-clustered majority-vote McNemar p-value recorded in enterprise_result.json; exact two-sided McNemar on the 15/3 unanimous flips alone is p = 0.0075, and the Tango interval [+4.6, +32.7] is recomputed directly from 15 fixed and 3 broke over 65 questions.
Reproduce the committed runs offline with zero keys and zero network:
make example-bird
make example-beaver
make example-bird-enterprise
make example-thelook
Three findings that shaped contextlift
- Sending everything beat perfect retrieval. Giving each question only its oracle-selected sentence instead of the full 22 KB bundle scored -2.2 points across 450 questions (
NOT PROVEN) and -8.6 points[-17.0, -0.8]on Toxicology (7 fixed, 19 broke,p = 0.0290,REAL LOSS). (Run) - A BI model with no written descriptions is not context. Reading LookML straight into rules without human business descriptions scored +2.0 points over 102 held-out questions (
p = 0.6875,NOT PROVEN), and carried a silent schema mismatch (orders.idvs BigQueryorders.order_id). (Run) - Models almost never ask for more context. Instructed to reply
INSUFFICIENTrather than guess, the model escalated on only 2 of 139 questions (1.4%, with no positive control). (Run)
On the 97-table BEAVER warehouse, hand-written rules scored -0.7 points on the working set; switching to leak-checked verified-query worked examples (3 template twins banned) delivered +10.1 points [+0.2, +21.8] (p = 0.0391, REAL GAIN, 1 regression dw_247).
Retraction postmortem (WITHDRAWN)
An earlier v0.1.0 class ablation on thelook reported a worked-examples penalty (-27.0 points [-37.8, -16.2] and -24.3 points [-34.8, -13.9], with cost per correct answer halving from $0.0004 to $0.0002). Those figures were WITHDRAWN on 2026-12-02 (v0.2.0):
- Root cause:
_cmd_classesscored rawCaApiRunnerreplies without calling_lookups(), grading 22 Conversational AnalyticsmatchedQueryhits (pred_sql=None,matched_exampleset) as0/22PRED_ERROR. - Scope: that run was one schema, one model, one repetition, and carried the scoring bug above.
- Record: the raw run stays committed in docs/evidence/classes-thelook-cost.txt and the full postmortem is archived in docs/research/CASE_STUDY.md.
Research archive
For long-form proofs and campaign narratives, see Case study, Walkthrough, Methodology, Practices, Context sources, Onboarding, and Roadmap.