Inspiration
A club treasurer asks an AI tool for each event's budget. Its SQL says $355 for the November meeting, not the real $205: it counts each budget line once per expense. Nothing flags it.
What it does
- Text-to-SQL on a laptop GPU (Qwen2.5-Coder-3B-Instruct, 4-bit). Data rows never leave the laptop; opt-in "Radio the tower" sends Gemini only the schema and question.
- A trust score, from the model's internal activity plus simpler signals, flags likely-wrong answers before you use them.
- A rule-based checker catches double-counted totals and shows a corrected query: auto-written for simple cases, marked hand-written for the club budget.
How we built it
- Labelled 2,563 questions ourselves by execution match (held-out BIRD and Spider dev, 31 databases).
- Stacked a layer-26 activation probe with token confidence and query shape; tested on unseen databases.
- Runs logged to MLflow on Databricks.
Results (held-out BIRD dev)
- Telling right SQL from wrong: trust score AUROC 0.901, the model's own token confidence 0.754.
- Answers scoring 0.8+ (Cruise, 14% of questions) were right 85% of the time, against 36% for the model alone.
- The checker found 31 hand-checked bugs in BIRD's own answer key; dropping those questions moves our score by only 0.002.
Challenges
OmniSQL-7B was too slow on our 6 GB GPU, so we swapped to the 3B model.
Accomplishments
Everything except Gemini runs offline on a laptop.
What we learned
- Most signal is in cheap features; the probe adds +0.005 AUROC.
- Four ideas failed bars we set in advance. One: the trust score (earlier build) did not transfer to Gemini's SQL.
What's next
- Calibrate per database: on 7 of 31, the average score misses real accuracy by over 0.10.
- Retrain on a stronger local model; report the answer-key bugs to BIRD.
Built With
- bitsandbytes
- css
- databricks
- fastapi
- gemini
- html
- javascript
- mlflow
- python
- pytorch
- qwen
- scikit-learn
- sqlglot
- sqlite
- transformers
- websockets