Skip to content

About

Bilingual deep dive, 20-line local reproduction, 10k+ latency probes & production patterns for TypeSafe Jev (single-step discriminator)

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

Reading Jev: Millisecond Decisions & Engineering Limits

A bilingual technical deep dive, local reproduction, and production architecture guide for non-autoregressive single-step discriminator models (TypeSafe Jev).

English | 中文

Read Live Essay Live Demo

Reading Jev — interactive bilingual essay and single-step vs autoregressive benchmark


Three Key Findings Before You Deploy It

  1. 80× longer context adds only ~160 ms — Across 10k+ real API probes, median latency rises from 57.5 ms (360 tokens) to 218.0 ms (29,835 tokens), and stays flat at 70–100 ms up to 100 concurrent questions via shared KV-prefix prefill.
  2. Speed ≠ calibrated confidence — Raw last-token logits from a local Qwen 2.5 7B model agreed with the calibrated Jev API only ~73.8% of the time, while still printing softmax confidence > 0.90 on wrong predictions. Never auto-allow on uncalibrated local logits.
  3. Hard single-step ceiling — One forward pass cannot do multi-hop chain-of-thought reasoning, and full attention means candidate order and irrelevant dummy options shift log-odds. Pair it with deterministic rules or escalate low-confidence cases to an LLM.

Table of Contents (Read Online with Interactive Charts)

Chapter Focus Direct Link
01. What Is Jev System-1 discriminator vs. System-2 LLM; the 3 primitives (choice, score, noul) Read Ch. 01
02. Under the Hood Zero-token forward pass, logit masking, NLI cross-encoder, KV-cache prefix sharing, RLCD calibration Read Ch. 02
03. 20 Lines of Code Local Qwen-0.5B single-pass reproduction vs. Cloudflare Workers / @ai-sdk/typesafe-ai Read Ch. 03
04. 10k+ Probes & Benchmarks Long-context latency (360 → 30k tokens), concurrency scaling (1 → 1,500), laptop logit comparison Read Ch. 04
05. Failure Modes Missing CoT, option-order bias, irrelevant-option interference, uncalibrated logits Read Ch. 05
06. Four Production Patterns Speculative fan-out, confidence gate, composite scoring, hierarchical classification Read Ch. 06
07. Production Architecture Hybrid routing, cost/latency math, 3 gateway shapes, ReflexGate design Read Ch. 07
08. Ecosystem Map Open reproductions (Qwen-2.5-1B-RLCD, openjev, jev-on-a-laptop, jev-phishing-bench) Read Ch. 08
09. Should You Use It? Fit vs. non-fit checklist and 3-way trade-off (rules vs. discriminator vs. LLM) Read Ch. 09

Minimal Local Reproduction (Zero Autoregressive Tokens)

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Qwen/Qwen2.5-0.5B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")

prompt = "Classify intent: 'I want a refund.' Options: [complaint, inquiry, after_sales]"
labels = ["complaint", "inquiry", "after_sales"]
ids = [tokenizer.encode(w)[0] for w in labels]

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    probs = torch.softmax(model(inputs.input_ids).logits[0, -1, ids], dim=-1)

for label, p in zip(labels, probs):
    print(f"{label}: {p.item():.4f}")

Runnable Examples, Evals & Manuscripts

Build & Preview the Static Essay Locally
uv run --with markdown --with pygments python3 scripts/build_site.py
python3 -m http.server 8765

About

Bilingual deep dive, 20-line local reproduction, 10k+ latency probes & production patterns for TypeSafe Jev (single-step discriminator)

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages