TheoLeeCJ/openjev

Semantic ifs from open models, on a 3090 at home. Independent; not affiliated with Jev or TypeSafe.

Python

1,479

9 commits

updated Sep 18, 2026

See the code

See what people are saying (1)

SourceMessageScoreDate

OpenJev

No idea at all what this particular project called openjev is doing, but https://github.com/TheoLeeCJ/openjev and https://github.com/ekzhang/openjev-sglang (neither of which I have any relation to) generate a single token, rather than JSON structured output. I wrote up this technique here:…

0

Sep 18, 2026

README

SemIf (formerly OpenJev)

Semantic ifs from open models, on a 3090 at home.

Independent project; not affiliated with Jev or TypeSafe.

Wow! No waitlist. Run it in your browser today.

Measured replay: typed decisions appear together while JSON streams token by token

Same frozen 4B model · same state · same 21 questions · measured separately, aligned at t=0 in the replay

Independent research project. SemIf was formerly called OpenJev. It is not affiliated with or endorsed by TypeSafe. Jev, TypeSafe, and other names and marks are the property of their respective owners. No infringement is intended.

Some AI company asks you to join a waitlist; SemIf runs in your browser today

Most agent decisions are small: route this, retry that, does the evidence support X? A chat model can answer them, but it spends time generating text that software immediately parses back into an if statement.

Jev is TypeSafe's closed service for runtime-defined semantic decisions. This project reproduces that interface pattern with open models; it does not reproduce Jev's undisclosed model or training.

This baseline reads typed option probabilities directly from a model. No answer sentence, JSON repair, or decoding loop.

Latest changes — 2026-09-18

  • Added MiniCPM5 2B and Qwen3.5 4B to the browser demo.
  • Added Unsloppify site, a switch to a conventional interface.

Quick start

Python 3.10+, CUDA, and a GPU that can hold a 4B BF16 model:

python -m venv .venv
. .venv/bin/activate
export HF_HOME=/path/to/large-drive/huggingface
pip install -e '.[test]'

Run the owned examples:

CUDA_VISIBLE_DEVICES=0 semif-score \
  --mode direct \
  --model Qwen/Qwen3.5-4B \
  --revision 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a \
  --input examples/decisions.jsonl \
  --output results.jsonl

Each result contains typed option scores, timing, the exact model revision, and a prompt hash.

If every row has the same exact state, switch to --mode shared to prefill it once and evaluate the criteria in parallel.

How it works

flowchart LR
    S[Unstructured state] --> M[4B model]
    C[Runtime criteria] --> M
    O[Typed options] --> M
    M -- native option logits --> P[Probabilities]
  • Runtime-defined: criteria and option descriptions arrive with the request.
  • Decision-native: one forward pass reads declared option logits; no answer token is sampled.
  • Shared-state aware: one long state can be prefetched once, then branched across many criteria.
  • Auditable: the owned fixture, exact runners, row-level outputs, revisions, prompts, and known failures are committed.

Speed

Decisions versus a compact generated array

Same frozen Qwen3.5-4B, same owned state, same 21 binary criteria, one RTX 3090:

Output pathTimeOutput tokensResult
Direct typed logits, median of 31.023 s021 probability pairs
Autoregressive JSON array, median of 35.332 s111Valid ordered 21-value array

The compact generative baseline emits only ordered "yes"/"no" values—no keys, confidence objects, or explanations. Its median first-token time was 0.489 s, but completing the array took 5.21× as long as direct readout. All three arrays were valid and identical. Their choices agreed with direct argmax on 18/21 criteria, so this is a systems comparison rather than a claim that the two readouts are semantically equivalent. Exact prompt, outputs, token timeline, and runs are committed.

Reusing a state across 21 decisions

On an owned 37-state × 21-criterion workload:

Execution pathDecisions/s777 decisions
Fresh direct scoring2.33333.1 s
Serial prefix reuse10.7572.3 s
Parallel suffixes20.0338.8 s
Native reranker1.86417.3 s

The owned 37×21 fixture, direct/reuse runner, reranker runner, raw timings, and row-level predictions are included. The fast reuse paths are experimental: BF16 execution changed 5–6 of 777 argmaxes relative to fresh scoring.

Quality

Browser model ladder

SystemBrowser artifactDownloadAuthored balanced accuracyPerturbation balanced accuracyTypeSafe subset agreement
Qwen3-0.6BQ8_0639 MB0.4400.5280.407
MiniCPM5-2BQ4_K_M1.56 GB0.6860.6930.637
Qwen3.5-4BQ4_K_M3.01 GB0.8130.7660.845
Published JevClosed hosted service0.883

Native BF16 scores. Browser builds use quantized GGUF. Jev is TypeSafe's published result on the same 102-row subset.

General decision baseline

Frozen workloadRowsDirect logits (4B)Native reranker (4B)Published Jev
Authored decisions, balanced accuracy1440.8130.625
WANLI, balanced accuracy2560.6370.522
TypeSafe selected subset, modal agreement102 across 20 cases0.8450.5600.883
Every judgment grid, accuracy360.8060.694
Every action firewall, composed accuracy10 actions0.7000.700
Every code retrieval, Recall@16 queries1.0001.000
Every company knowledge, Recall@17 queries0.9290.929

The reranker remained strong at retrieval ranking, but direct logits were the better general-decision baseline.

The Jev number is read from TypeSafe's published records; we did not run a live Jev endpoint. The comparison covers the 102 rows that could be aligned from public artifacts, not TypeSafe's reported 711-row aggregate.

Input

{
  "id": "route-1",
  "state": "Customer cannot access an account after a password reset.",
  "question": "Which queue should handle this request?",
  "options": [
    {"id": "access", "description": "Account access support."},
    {"id": "billing", "description": "Billing support."}
  ]
}

Returned probabilities are conditional on the supplied options. Calibrate and validate them on the workload where they will make decisions. state may also be a nonempty JSON object or array. Direct modes preserve it as structured JSON; reranker mode renders it as document text.

Documentation

Star history

SemIf star history

Evaluation sources

Model weights and third-party source records are not included. Upstream models retain their licenses. Project code is released under the MIT License.

Contributors

TheoLeeCJ

9 commits

TheoLeeCJ/openjev

Semantic ifs from open models, on a 3090 at home. Independent; not affiliated with Jev or TypeSafe.

Python

1,479

9 commits

updated Sep 18, 2026

See the code

See what people are saying (1)

SourceMessageScoreDate

OpenJev

No idea at all what this particular project called openjev is doing, but https://github.com/TheoLeeCJ/openjev and https://github.com/ekzhang/openjev-sglang (neither of which I have any relation to) generate a single token, rather than JSON structured output. I wrote up this technique here:…

0

Sep 18, 2026

README

SemIf (formerly OpenJev)

Semantic ifs from open models, on a 3090 at home.

Independent project; not affiliated with Jev or TypeSafe.

Wow! No waitlist. Run it in your browser today.

Measured replay: typed decisions appear together while JSON streams token by token

Same frozen 4B model · same state · same 21 questions · measured separately, aligned at t=0 in the replay

Independent research project. SemIf was formerly called OpenJev. It is not affiliated with or endorsed by TypeSafe. Jev, TypeSafe, and other names and marks are the property of their respective owners. No infringement is intended.

Some AI company asks you to join a waitlist; SemIf runs in your browser today

Most agent decisions are small: route this, retry that, does the evidence support X? A chat model can answer them, but it spends time generating text that software immediately parses back into an if statement.

Jev is TypeSafe's closed service for runtime-defined semantic decisions. This project reproduces that interface pattern with open models; it does not reproduce Jev's undisclosed model or training.

This baseline reads typed option probabilities directly from a model. No answer sentence, JSON repair, or decoding loop.

Latest changes — 2026-09-18

  • Added MiniCPM5 2B and Qwen3.5 4B to the browser demo.
  • Added Unsloppify site, a switch to a conventional interface.

Quick start

Python 3.10+, CUDA, and a GPU that can hold a 4B BF16 model:

python -m venv .venv
. .venv/bin/activate
export HF_HOME=/path/to/large-drive/huggingface
pip install -e '.[test]'

Run the owned examples:

CUDA_VISIBLE_DEVICES=0 semif-score \
  --mode direct \
  --model Qwen/Qwen3.5-4B \
  --revision 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a \
  --input examples/decisions.jsonl \
  --output results.jsonl

Each result contains typed option scores, timing, the exact model revision, and a prompt hash.

If every row has the same exact state, switch to --mode shared to prefill it once and evaluate the criteria in parallel.

How it works

flowchart LR
    S[Unstructured state] --> M[4B model]
    C[Runtime criteria] --> M
    O[Typed options] --> M
    M -- native option logits --> P[Probabilities]
  • Runtime-defined: criteria and option descriptions arrive with the request.
  • Decision-native: one forward pass reads declared option logits; no answer token is sampled.
  • Shared-state aware: one long state can be prefetched once, then branched across many criteria.
  • Auditable: the owned fixture, exact runners, row-level outputs, revisions, prompts, and known failures are committed.

Speed

Decisions versus a compact generated array

Same frozen Qwen3.5-4B, same owned state, same 21 binary criteria, one RTX 3090:

Output pathTimeOutput tokensResult
Direct typed logits, median of 31.023 s021 probability pairs
Autoregressive JSON array, median of 35.332 s111Valid ordered 21-value array

The compact generative baseline emits only ordered "yes"/"no" values—no keys, confidence objects, or explanations. Its median first-token time was 0.489 s, but completing the array took 5.21× as long as direct readout. All three arrays were valid and identical. Their choices agreed with direct argmax on 18/21 criteria, so this is a systems comparison rather than a claim that the two readouts are semantically equivalent. Exact prompt, outputs, token timeline, and runs are committed.

Reusing a state across 21 decisions

On an owned 37-state × 21-criterion workload:

Execution pathDecisions/s777 decisions
Fresh direct scoring2.33333.1 s
Serial prefix reuse10.7572.3 s
Parallel suffixes20.0338.8 s
Native reranker1.86417.3 s

The owned 37×21 fixture, direct/reuse runner, reranker runner, raw timings, and row-level predictions are included. The fast reuse paths are experimental: BF16 execution changed 5–6 of 777 argmaxes relative to fresh scoring.

Quality

Browser model ladder

SystemBrowser artifactDownloadAuthored balanced accuracyPerturbation balanced accuracyTypeSafe subset agreement
Qwen3-0.6BQ8_0639 MB0.4400.5280.407
MiniCPM5-2BQ4_K_M1.56 GB0.6860.6930.637
Qwen3.5-4BQ4_K_M3.01 GB0.8130.7660.845
Published JevClosed hosted service0.883

Native BF16 scores. Browser builds use quantized GGUF. Jev is TypeSafe's published result on the same 102-row subset.

General decision baseline

Frozen workloadRowsDirect logits (4B)Native reranker (4B)Published Jev
Authored decisions, balanced accuracy1440.8130.625
WANLI, balanced accuracy2560.6370.522
TypeSafe selected subset, modal agreement102 across 20 cases0.8450.5600.883
Every judgment grid, accuracy360.8060.694
Every action firewall, composed accuracy10 actions0.7000.700
Every code retrieval, Recall@16 queries1.0001.000
Every company knowledge, Recall@17 queries0.9290.929

The reranker remained strong at retrieval ranking, but direct logits were the better general-decision baseline.

The Jev number is read from TypeSafe's published records; we did not run a live Jev endpoint. The comparison covers the 102 rows that could be aligned from public artifacts, not TypeSafe's reported 711-row aggregate.

Input

{
  "id": "route-1",
  "state": "Customer cannot access an account after a password reset.",
  "question": "Which queue should handle this request?",
  "options": [
    {"id": "access", "description": "Account access support."},
    {"id": "billing", "description": "Billing support."}
  ]
}

Returned probabilities are conditional on the supplied options. Calibrate and validate them on the workload where they will make decisions. state may also be a nonempty JSON object or array. Direct modes preserve it as structured JSON; reranker mode renders it as document text.

Documentation

Star history

SemIf star history

Evaluation sources

Model weights and third-party source records are not included. Upstream models retain their licenses. Project code is released under the MIT License.

Contributors

TheoLeeCJ

9 commits

Languages

Python

75.6%

JavaScript

16.4%

HTML

8.0%