khalilelghoul01/decision-lab

Experimental 350M typed decision model: shared-cache inference, local WebGPU SDK, reproducible training and honest evaluations. MIT source.

Python

1

7 commits

updated Sep 18, 2026

See the code
machine-learning
onnx
research
small-language-models
structured-output
typescript
webgpu

See what people are saying (1)

SourceMessageScoreDate

I tried Jev-style typed decisions with a 350M browser model. The failures were more useful than the benchmark (r/SideProject)

Jev from TypeSafe AI made me wonder how far typed decisions could be pushed with a genuinely small local model, so I built an independent open-source experiment called Decision Lab. The model reads shared context once, reuses the cache for every field, scores a fixed set of allowed answers, then…

1

Sep 18, 2026

README

Decision Lab

A small model that scores decisions and returns typed JSON, without generating output token by token.

An open research experiment built on a fine-tuned 350M model. It runs locally in a WebGPU browser or Python. Inspired by Jev's typed decision interface; independently implemented and unaffiliated with Jev or TypeSafe.

Live playground · Run locally · How it works · Results · SDK · Contribute · Documentation

How it works

  1. Turn each field into a question with a fixed set of allowed answers.
  2. Process the shared context once and cache the model's state.
  3. Score each question's answers while reusing that cache.
  4. Convert scores to probabilities and assemble JSON in code.
flowchart LR
    A[Context] --> B[Shared cache]
    B --> C[Field scores]
    C --> D[Typed JSON]

The runtime supports Choice (a label), Noul (P(yes)), and Score (an expected ordinal index). It uses one prefill plus question processing, not one total forward pass. Valid JSON does not guarantee correct decisions. Detailed architecture · Short explanation to share

Try it

Open decision-lab.loomens.com for the complete browser playground. It includes editable Jev-shaped requests, Choice, Noul and Score visualizations, raw JSON, an on-device speed benchmark, numerical parity checks, and the frozen workflow evaluation suite. Model inference runs in your browser; prompts are not sent to a server.

To run it yourself, use Node.js 20+, Python 3.12+, and a browser with WebGPU and shader-f16:

git clone https://github.com/khalilelghoul01/decision-lab.git
cd decision-lab
python3 scripts/download_model.py
npm --prefix sdk ci --ignore-scripts
npm --prefix sdk run build
npm --prefix browser ci --ignore-scripts
npm --prefix browser run dev

Open the printed URL. /diagnostics.html exposes the low-level runtime checks and /sdk.html shows the model-loader lifecycle. Prompts stay local; the first load includes roughly 296 MB of weights and shader compilation.

Prefer a ready-built demo? Download decision-lab-browser-demo.zip from Releases, extract it, and run python3 -m http.server 8000 --bind 127.0.0.1 inside the folder. Open http://localhost:8000/sdk.html.

Current results

This is a concept and experiment, with substantial accuracy limits.

MeasurementReleased INT4 model
Held-out public tasks, 1,600 examples83.0% accuracy
Known workflow suite, 240 fields / 84 records59.6% fields / 19.0% exact records
Warm four-field browser request, one / two option orders92 / 148 ms

Timing is the median of five warm runs on an M4 Mac mini with 16 GB, excluding loading. Public-task accuracy was measured on ONNX CPU; workflow accuracy on actual WebGPU. The workflow suite is a known regression set, not a blind test. Full methodology, baselines and failures.

The current limit is 32 questions, 2–8 choices per question, and 1,024 tokens per complete field prompt. Fields are independent and can contradict each other. Confidence is not a guarantee of correctness. Training uses supervised cross-entropy plus calibration; this release does not implement RLCD.

Find your way around

DirectoryPurpose
sdk/TypeScript model loader and typed API
browser/Playground and SDK demo
python/Native runtime, training, export and tests
docs/Architecture, results, dataset and training guides
research/Frozen evaluation evidence and regression fixtures
examples/Sample requests and schemas
scripts/Verified model downloads and release tools

Independent evaluation cases, better training data, calibration, and browser performance work are welcome. Contribution guide.

License

Original source is MIT. Model weights retain the separate LFM Open License; public datasets retain their upstream terms. Attribution and notices.

Contributors

khalilelghoul01/decision-lab

Experimental 350M typed decision model: shared-cache inference, local WebGPU SDK, reproducible training and honest evaluations. MIT source.

Python

1

7 commits

updated Sep 18, 2026

See the code
machine-learning
onnx
research
small-language-models
structured-output
typescript
webgpu

See what people are saying (1)

SourceMessageScoreDate

I tried Jev-style typed decisions with a 350M browser model. The failures were more useful than the benchmark (r/SideProject)

Jev from TypeSafe AI made me wonder how far typed decisions could be pushed with a genuinely small local model, so I built an independent open-source experiment called Decision Lab. The model reads shared context once, reuses the cache for every field, scores a fixed set of allowed answers, then…

1

Sep 18, 2026

README

Decision Lab

A small model that scores decisions and returns typed JSON, without generating output token by token.

An open research experiment built on a fine-tuned 350M model. It runs locally in a WebGPU browser or Python. Inspired by Jev's typed decision interface; independently implemented and unaffiliated with Jev or TypeSafe.

Live playground · Run locally · How it works · Results · SDK · Contribute · Documentation

How it works

  1. Turn each field into a question with a fixed set of allowed answers.
  2. Process the shared context once and cache the model's state.
  3. Score each question's answers while reusing that cache.
  4. Convert scores to probabilities and assemble JSON in code.
flowchart LR
    A[Context] --> B[Shared cache]
    B --> C[Field scores]
    C --> D[Typed JSON]

The runtime supports Choice (a label), Noul (P(yes)), and Score (an expected ordinal index). It uses one prefill plus question processing, not one total forward pass. Valid JSON does not guarantee correct decisions. Detailed architecture · Short explanation to share

Try it

Open decision-lab.loomens.com for the complete browser playground. It includes editable Jev-shaped requests, Choice, Noul and Score visualizations, raw JSON, an on-device speed benchmark, numerical parity checks, and the frozen workflow evaluation suite. Model inference runs in your browser; prompts are not sent to a server.

To run it yourself, use Node.js 20+, Python 3.12+, and a browser with WebGPU and shader-f16:

git clone https://github.com/khalilelghoul01/decision-lab.git
cd decision-lab
python3 scripts/download_model.py
npm --prefix sdk ci --ignore-scripts
npm --prefix sdk run build
npm --prefix browser ci --ignore-scripts
npm --prefix browser run dev

Open the printed URL. /diagnostics.html exposes the low-level runtime checks and /sdk.html shows the model-loader lifecycle. Prompts stay local; the first load includes roughly 296 MB of weights and shader compilation.

Prefer a ready-built demo? Download decision-lab-browser-demo.zip from Releases, extract it, and run python3 -m http.server 8000 --bind 127.0.0.1 inside the folder. Open http://localhost:8000/sdk.html.

Current results

This is a concept and experiment, with substantial accuracy limits.

MeasurementReleased INT4 model
Held-out public tasks, 1,600 examples83.0% accuracy
Known workflow suite, 240 fields / 84 records59.6% fields / 19.0% exact records
Warm four-field browser request, one / two option orders92 / 148 ms

Timing is the median of five warm runs on an M4 Mac mini with 16 GB, excluding loading. Public-task accuracy was measured on ONNX CPU; workflow accuracy on actual WebGPU. The workflow suite is a known regression set, not a blind test. Full methodology, baselines and failures.

The current limit is 32 questions, 2–8 choices per question, and 1,024 tokens per complete field prompt. Fields are independent and can contradict each other. Confidence is not a guarantee of correctness. Training uses supervised cross-entropy plus calibration; this release does not implement RLCD.

Find your way around

DirectoryPurpose
sdk/TypeScript model loader and typed API
browser/Playground and SDK demo
python/Native runtime, training, export and tests
docs/Architecture, results, dataset and training guides
research/Frozen evaluation evidence and regression fixtures
examples/Sample requests and schemas
scripts/Verified model downloads and release tools

Independent evaluation cases, better training data, calibration, and browser performance work are welcome. Contribution guide.

License

Original source is MIT. Model weights retain the separate LFM Open License; public datasets retain their upstream terms. Attribution and notices.

Contributors

Languages

Python

56.5%

TypeScript

37.6%

JavaScript

3.4%

CSS

1.7%