Theodore Lee · 2026-09-18 · major
SemIf (formerly OpenJev) — typed decisions without generating JSON
SemIf, formerly OpenJev, reads typed option probabilities straight out of an open 4B model in one forward pass. On an RTX 3090 it answers 21 binary criteria in 1.023 seconds, against 5.332 seconds to generate the same JSON array.
An open take on the 'semantic if': read typed option probabilities from a small model instead of asking it to write JSON.
Key specs
| GitHub stars | 1,679 |
|---|---|
| Speedup vs json | 5.21x |
Quick facts
| Maker | Theodore Lee (independent) |
|---|---|
| License | MIT; upstream model licenses apply |
| Best open model | Qwen3.5-4B, 0.813 balanced accuracy |
| Browser models | Qwen3-0.6B 639 MB, MiniCPM5-2B 1.56 GB, Qwen3.5-4B 3.01 GB |
| Hardware | One RTX 3090, or WebGPU in a browser |
| Apple Silicon | Native MLX backend |
Benchmarks
| Published Jev (hosted) | 88.3% | |
|---|---|---|
| SemIf — Qwen3.5-4B | 84.5% | |
| SemIf — MiniCPM5-2B | 63.7% | |
| SemIf — Qwen3-0.6B | 40.7% |
What is it?
SemIf, renamed from OpenJev, reads the probability of each answer you allow straight out of a small open model in a single forward pass. Nothing is written out — no answer sentence, no JSON to repair, no decoding loop. The criteria and the option descriptions arrive with the request, so the decisions are defined at runtime rather than baked into a fine-tune. Theodore Lee released the code under MIT and the project reached 621 points on Hacker News on 18 September 2026.
How does it work?
One forward pass takes the unstructured state, the runtime criteria and the typed options, and the declared option logits are read back as probabilities. When many criteria share the same long state, that state is prefilled once and then branched: serial prefix reuse reaches 10.75 decisions a second and parallel suffixes reach 20.03, against 2.33 for scoring every row fresh. A browser build runs the same path on WebGPU with quantized GGUF weights, and macOS has a native MLX backend.
Why does it matter?
Most agent decisions are small — route this, retry that, does the evidence support X — and paying a chat model to write a sentence your code immediately parses back into an if statement is slow. Here 21 binary criteria take 1.023 seconds and zero output tokens on one RTX 3090, where the same frozen model needs 5.332 seconds and 111 tokens for the equivalent JSON array. The fixtures, runners, raw timings, prompt hashes and known failures are all committed, so anyone can rerun the numbers.
Who is it for?
backend and agent engineers
Frequently asked questions
- Is SemIf the same model as TypeSafe's Jev?
- SemIf reproduces the Jev interface pattern with frozen open models, not Jev itself. The author states plainly that the project is independent, is not affiliated with TypeSafe, and does not reproduce Jev's undisclosed model or its training. What is shared is the idea: runtime-defined criteria and typed options in, typed probabilities out.
- How close does SemIf get to Jev's accuracy?
- SemIf with Qwen3.5-4B agrees with the reference answers on 0.845 of a 102-row subset drawn from TypeSafe's public evaluations, where Jev's published figure on the same rows is 0.883. The author notes the comparison covers only those 102 alignable rows, not TypeSafe's reported 711-row aggregate, and that no live Jev endpoint was called.
- How much faster is SemIf than asking a model to write JSON?
- On one RTX 3090 with a frozen Qwen3.5-4B, SemIf answers 21 binary criteria in 1.023 seconds and emits zero output tokens. The same model writing a compact JSON array takes 5.332 seconds and 111 tokens — 5.21 times longer. When many criteria share one state, parallel suffix evaluation reaches 20.03 decisions a second versus 2.33 for fresh scoring.
- What hardware do I need to run SemIf?
- SemIf needs Python 3.10 or newer, CUDA, and a GPU that can hold a 4B BF16 model; the published timings come from a single RTX 3090. Apple Silicon users can install the MLX extra and pass --backend mlx instead. There is also a browser build that runs quantized GGUF weights on WebGPU with no install at all.
- Can I trust the probabilities SemIf returns?
- SemIf returns probabilities that are conditional on the options you supply, and the author asks you to calibrate and validate them on your own workload before wiring them into decisions. The faster reuse paths carry a caveat too: BF16 execution changed 5 to 6 of 777 argmax choices compared with fresh scoring, so they are marked experimental.
Try it
pip install -e '.[test]' && semif-score --mode direct --model Qwen/Qwen3.5-4B