Install anywhere
pip install sqlite-predict · npm install sqlite-predict · cargo add sqlite-predict
forecast(), detect_anomalies(), and predict() become functions you call
over your own rows: forecast and detect_anomalies are aggregates that
compose with WHERE, joins, and GROUP BY; predict is a scalar that composes
with row-level SELECT, WHERE, and joins, so ORMs and query builders work
unchanged. The core is one small C99 file with no
dependencies, so it runs in your app, on a phone, in the browser, or in the
per-database state an AI agent keeps.
-- forecast a metric 24 steps ahead: plain SQL supplies the rowsSELECT forecast(ts, value, 24) FROM readings;
-- GROUP BY splits the series. WHERE, joins, and bound parameters-- compose, so ORMs and query builders work unchanged.SELECT city, forecast(ts, value, 24) FROM readings GROUP BY city;
-- and when a stronger model is too heavy to call per query:-- distill it once into a few-KB native student that lives in your-- database, then serve the student in microsecondsSELECT model_id FROM distill_forecast('SELECT * FROM windows', '{"context":96,"horizon":24,"student_id":"traffic-v1"}');SELECT forecast(ts, value, 24, '{"model":"traffic-v1"}') FROM readings;Install anywhere
pip install sqlite-predict · npm install sqlite-predict · cargo add sqlite-predict
Zero dependencies
Pure C99. No ONNX runtime, no GPU, no network at serve time.
Distill once, serve forever
Compress your own model, or a foundation model you are licensed to distill, into a few-KB student that lives in your database and snapshots, forks, and syncs with it. See Distillation.
Measured, reproducible numbers
~0.89 MASE distilled forecasting, SOTA-level anomaly detection, calibrated intervals. See Benchmarks.
Every way to predict on tables makes you pick one: build the pipeline, pay the meter, or call a function where the data already lives.
Why SELECT forecast(…)
A SQL function at your data. Zero-shot in seconds; distill a teacher once and serve its student in microseconds, forever. No pipeline, no endpoint, no meter.
Why not an ML pipeline?
Great algorithms. The cost is the pipeline around them: export, features, container, deploy.
Why not AutoML?
Automates the fit. Keeps the pipeline, the infrastructure, and the wait before a first answer.
Why not a prediction API?
Seconds to a first answer, and the frontier lives here. But your rows ride along on every metered call.
The honest asterisk: a frontier model called zero-shot is still the accuracy ceiling. The benchmarks measure the gap; a distilled student typically gives up about half a point of accuracy against its teacher.