Fouad Salkini
Fouad SalkiniTech Lead & Architect
Published on 2026-09-21 02:0526 viewsPart 5 of Autonomous Engineering Systems

Demystifying Jev: How Open-Source Qwen 2.5 and Parallel Constrained Decoding Run 70ms Decisions Locally

When TypeSafe AI raised $40M for Jev's parallel decision architecture, open-source engineers asked: can we run this locally? How Harsha Gundala's Qwen-2.5-1B-RLCD achieved 7x faster structured inference on Apple Silicon using KV-cache broadcasting.

#Qwen#Jev#Apple Silicon#MLX#Parallel Decoding#AI Architecture
Demystifying Jev: How Open-Source Qwen 2.5 and Parallel Constrained Decoding Run 70ms Decisions Locally

When Diogo Almeida’s TypeSafe AI announced Jev—raising $40M on the promise of eliminating text generation in favor of calibrated, parallel System-1 agent decisions—it sent shockwaves through the enterprise AI ecosystem.

Inevitably, the tech community asked the million-dollar question: Is this proprietary magic, or can open-source engineering demystify it?

In a viral social video, creator Massalski Yauhen (@y.massalski) asked Alibaba’s Qwen model whether China had already built a Jev equivalent. Qwen returned a legendary response:

“Within hours of launch, an engineer (Harsha Gundala, working from a Qwen base) posted a Qwen-2.5-1B model trained the same way, joking they built in stealth for two years and he did it in two hours.”

While Qwen humorously conflated Gundala’s nationality, the underlying project was 100% real: harshatheg/Qwen-2.5-1B-RLCD on Hugging Face.

By applying Parallel Constrained Decoding (PCD) to a 4-bit Qwen-2.5-1.5B-Instruct model on Apple Silicon (MLX), the open-source community proved you can execute 70ms, 100% valid calibrated agent decisions directly on consumer hardware.

Here is the exact mathematical and architectural breakdown of how it works.


1. The Bottleneck: The Autoregressive Trap

In standard structured output engines (e.g., Guidance, Outlines, or standard JSON mode), a model extracts fields sequentially.

For an N-field JSON schema, traditional LLMs execute hundreds of sequential forward passes:

Latency = ∑ t_forward(i)   [where K ~ 150–300 sequential tokens]
Autoregressive Sequential Decoding (Slow):
[Context] ──> Token 1 ──> Token 2 ──> Token 3 ──> ... ──> Token 250 (400-1,900 ms)

Even if you use constrained context-free grammars (CFGs) to mask invalid tokens, you are still bound by the fundamental physics of autoregressive memory bandwidth: one forward pass per token.


2. The Breakthrough: KV-Cache Broadcasting

Parallel Constrained Decoding fundamentally divorces structured classification from token-by-token text generation:

Parallel Constrained Decoding (PCD):
[Context + Schema] ──(Single Prefill)──> [Unified KV-Cache]

               ┌───────────────────────────────┼───────────────────────────────┐
               ▼                               ▼                               ▼
       [Field 1: Enum Choice]         [Field 2: Boolean Flag]        [Field 3: Action Tier]
       (Sub-Vocab Logit Mask)         (Sub-Vocab Logit Mask)         (Sub-Vocab Logit Mask)
               │                               │                               │
               ▼                               ▼                               ▼
        89ms Forward Pass              68ms Forward Pass              75ms Forward Pass

The 5-Step Execution Pipeline:

  1. Prefix Prefill Once: The context (e.g., transaction logs, system alerts, code diffs) is prefilled into the Key-Value (KV) cache exactly once.
  2. KV-Cache Broadcasting: In Apple Silicon Unified Memory, the KV-cache is broadcast across all target schema fields concurrently.
  3. Sub-Vocabulary Projection: For each target field, the model does not evaluate the full 152,000 Qwen vocabulary. It masks out all tokens except the valid candidate options (e.g., ["LOW", "ELEVATED", "SUSPICIOUS", "CRITICAL"]).
  4. Calibrated Softmax Probability: The exact confidence score is computed directly over the candidate logit slice: P(c_i) = exp(z_i / T) / ∑ exp(z_j / T)
  5. Programmatic Assembly: The verified categorical values and confidence floats are assembled directly into standard JSON in memory. Zero repair loops, zero hallucinated keys.

3. Real-World Benchmarks on Apple Silicon (M4 Max)

The performance figures published by Gundala demonstrate why this architecture is a game-changer for autonomous coding and triage agents:

Production Scenario Schema Fields Autoregressive Baseline Parallel Constrained (MLX) Speedup Valid Syntax
Fintech Fraud Routing 4 fields 420 ms 75 ms 5.6x 100%
Code Security Audit 4 fields 380 ms 68 ms 5.6x 100%
High-Cardinality Tariff 1 field (255 choices) 500 ms 89 ms 5.6x 100%
Support Triage Matrix 28 fields 1,900 ms 270 ms 7.0x 100%

All of this executes within a 1.1 GB unified memory footprint on a standard MacBook.


4. Production Implementation: Python & MLX

Here is how you wire this up in a local agent harness:

# Production Parallel Constrained Decoding with Qwen 2.5
from mlx_lm import load
import mlx.core as mx
import numpy as np

model, tokenizer = load("harshatheg/Qwen-2.5-1B-RLCD")

def evaluate_agent_action(context: str, allowed_actions: list[str]) -> dict:
    prompt = f"<|im_start|>system\nRoute this action.<|im_end|>\n<|im_start|>user\n{context}<|im_end|>\n<|im_start|>assistant\n"
    
    # 1. Prefill context once
    tokens = tokenizer.encode(prompt)
    logits = model(mx.array([tokens]))[:, -1, :]
    
    # 2. Extract candidate token IDs
    candidate_ids = [tokenizer.encode(" " + act)[-1] for act in allowed_actions]
    
    # 3. Compute calibrated Softmax slice
    candidate_logits = np.array(logits[0, candidate_ids])
    exp_logits = np.exp(candidate_logits - np.max(candidate_logits))
    probs = exp_logits / exp_logits.sum()
    
    best_idx = np.argmax(probs)
    return {
        "action": allowed_actions[best_idx],
        "confidence": float(probs[best_idx])
    }

# Execution: sub-80ms on M-series Mac
decision = evaluate_agent_action(
    "Git diff modifies /etc/pam.d/common-auth without test fixtures.",
    ["APPROVE_PR", "REQUEST_CHANGES", "TRIGGER_SECURITY_ESCALATION"]
)
print(decision)
# {'action': 'TRIGGER_SECURITY_ESCALATION', 'confidence': 0.9981}

The Verdict

What Big Tech markets as proprietary breakthroughs often boils down to pragmatic computer science primitives:

  • Eliminating autoregressive token loops.
  • Reusing the KV-cache across parallel evaluations.
  • Constraining probability distributions to predefined action spaces.

Between closed APIs like Jev ($0.042/1M tokens) and open-source models like Qwen-2.5-1B-RLCD (free, local, 75ms latency), systems engineers no longer have an excuse for slow, non-deterministic agent middleware.

System-1 decision primitives are officially commoditized.

Fouad Salkini

Written by Fouad Salkini (فؤاد سلقيني)

General Manager & Tech Lead at Tripnologies and Sync Studios. Systems Architect focusing on AI coding agents, DevOps, and quantitative systems.