Skip to content

Decide

A System One model in the browser.

Fast, typed decisions from text, on the user's device, with confidence you can trust. When it isn't sure, it asks an LLM and learns from the answer.

the app crashes when I open settings

bug_report93%
feature_request7%
praise0%
question0%

Sure: answered on this device

93.1%on 77 banking intents with a 156 kB trained head
81%answered on device once it has learned from Llama 3.1 8B (70% before)
0.9 = 90%calibrated: an answer at 0.9 is right about 90% of the time
3.6 kBadded to your page; the model runs in a worker

A few lines of code

ts
import { createDecider } from "decidekit";

const d = await createDecider();
const { choice, confidence } = await d.decide(
  "my card still hasn't arrived",
  ["card_arrival", "lost_card", "refund"],
);
// choice: "card_arrival", typed as your labels

Watch it learn from an LLM

It starts out knowing only twelve label names. What it's sure of, it answers itself; the rest goes to an LLM, and every eight answers it retrains. The LLM's answers were recorded once, so the demo is free to watch.

What's a System One model?

Kahneman called fast, intuitive thinking System 1, and slow, careful thinking System 2. A System One model is the fast kind: it doesn't write anything, it reads the text once and picks one of the options you give it. That makes it quick, cheap and safe to wire into code.

Think of Decide as a local Jev. TypeSafe's Jev is a System One model behind an API; Decide runs on the user's device, so each decision is free, private and a few milliseconds. Jev hands back a confidence and leaves the unsure cases to your code. Decide can send them to an LLM, its System 2, and learn from the answer, so it needs the LLM less over time.

Further reading: System One models (TypeSafe) · Introducing Jev · Confidence in Jev · Thinking, Fast and Slow

Typed choices

The answer is always one of your labels, typed as their literal union. No parsing, no made-up labels.

Confidence you can trust

Trained heads are calibrated: an answer at 0.9 is right about 90% of the time, so a threshold means what it says.

Learns from an LLM

Wrap your LLM call in withFallback: unsure texts go to it, its answers become training data, and it gets asked less.

Runs in the tab

A 34 MB model in a web worker, cached after the first visit. It adds 3.6 kB to your page bundle.

Trains on the device

Train a head from a few examples per label in seconds, without sending the text anywhere.

Browser, Node, React, switch

The same API everywhere, React hooks, and a decider for the switch harness.

What it's for

Cut the LLM bill

Answer the easy majority on device; send only unsure texts to an LLM, which teaches it as it goes.

Route support messages

Billing, bug, account: route a message, and show the right help while the user is still typing.

Command palettes

"Make it darker" to theme.dark, in milliseconds and offline.

Games

Read typed player chat and commands with no server.

Sensitive text

Health, finance and internal tools: training and deciding stay on the device.

Agent harnesses

A free decision model for switch, with an LLM as its teacher.

Go further

PlaygroundDocsHow it worksResearch: when the LLM is wrongLaunch postnpmDiscussionsDiscord