contextlift

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:

ArmNameContents
ControlArm 0dspec/schema/ only: the physical table and column descriptions the estate already had.
TreatmentArm 1spec/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:

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:

VerdictMeaning
INVALIDA pre-flight or post-run gate failed (leakage, template twins, unwaived lint refusals, copied answer key, or insufficient power). Scores are not publishable.
REAL GAINStatistically significant positive lift (p < 0.05, lift > 0) on held-out questions with all gates passing.
REAL LOSSStatistically significant negative lift (p < 0.05, lift < 0). The context harmed accuracy.
OVERFITWorking set gained significantly and the working-minus-holdout gap interval excludes zero. More questions do not fix this.
UNDERPOWEREDHeld-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 CHANGEHeld-out set had sufficient power and zero questions flipped in either direction.
NOT PROVENHeld-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 badgeCondition
SAFE0 held-out questions broke (b == 0).
MIXEDPositive net lift, but at least one previously working question broke (c > b > 0). Broken question IDs are printed beside the badge.
REGRESSIONContext 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 changeQuestionsLift, points [95% CI]McNemar pVerdictEvidence
BIRD evidence sentences written by people, 3 databases (K=1, no holdout split)39+23.1 [+1.2, +43.6]0.0352REAL GAINexamples/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 GAINexamples/bird/enterprise_result.json
BEAVER verified-query worked examples, 97-table warehouse69+10.1 [+0.2, +21.8]0.0391REAL GAINexamples/beaver/result.json
LookML read into rules, no written descriptions102+2.0 [-4.8, +9.3]0.6875NOT PROVENround-2026-09-12.txt
Oracle selection vs 22 KB blob, 3 databases450-2.2 [-5.9, +1.4]0.2451NOT PROVENblob-vs-selection.txt
Oracle selection vs 22 KB blob, Toxicology139-8.6 [-17.0, -0.8]0.0290REAL LOSSblob-vs-selection.txt
Repairing quoted enum literals against live column values450+1.3 [-1.1, +3.9]0.3075NOT PROVENrepaired-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

  1. 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)
  2. 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.id vs BigQuery orders.order_id). (Run)
  3. Models almost never ask for more context. Instructed to reply INSUFFICIENT rather 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):

Research archive

For long-form proofs and campaign narratives, see Case study, Walkthrough, Methodology, Practices, Context sources, Onboarding, and Roadmap.