System One Models:
Jev and Laya

Structured decoding with LLMs

Renato Vicente · 24 Sep 2026

  1. Problem
  2. The idea
  3. Model
  4. Mechanism
  5. Numbers
  6. Jev, Laya
Agentic Complex Systems
Universidade
de São Paulo
Universidade de São Paulo
Introduction2 / 50

RLCD: Reinforcement Learning
for Calibrated Decisions.

The acronym comes from TypeSafe and names post-training that teaches the model to decide with calibrated confidence.

The repository we study uses the name but trains nothing: it runs the original Qwen2.5-1.5B and performs parallel constrained decoding at inference time.

huggingface.co/harshatheg/Qwen-2.5-1B-RLCD

TypeSafe: typesafe.ai

  • Input: a text and a schema of closed fields.
  • Output: valid JSON and one probability per field.
  • Model: Qwen2.5-1.5B in 4 bits, with MLX.
Introduction3 / 50

What is known about RLCD training

TypeSafe published the training objective, but not the method.

  • Objective: the probability of each decision should track the accuracy rate.
  • Output: typed decisions, each with a distribution over the options.
  • Contrast: RLHF rewards what pleases raters and concentrates mass on a single style.
Introduction4 / 50

Choice: one option from a set

POST https://api.typesafe.ai/v1/systemone request response { "state": "Help! My payouts have been failing for 3 days.", "model": "jev-latest", "questions": { "department": { "type": "choice", "instructions": "Which team should handle this?", "criteria": { "billing": "Payments, invoicing, refunds", "technical": "Bugs, outages, integrations", "sales": "Pricing, upgrades, new accounts" } } } } { "model": "jev-1.13.0", "answers": { "department": { "type": "choice", "choice": "billing", "probabilities": { "billing": 0.88, "technical": 0.12, "sales": 0.0 }, "confidence": 0.81 } }, "usage": { "input_tokens": 318, "output_tokens": 34 } }
TypeSafe API reference, unaltered. The response gives the chosen option, the distribution over all three, and the confidence.
Introduction5 / 50

Noul: does the condition hold or not?

POST https://api.typesafe.ai/v1/systemone request response { "state": "Help! My payouts have been failing for 3 days.", "model": "jev-latest", "questions": { "is_urgent": { "type": "noul", "instructions": "Does this convey urgency?", "criteria": { "true": "Explicitly time-sensitive", "false": "No urgency expressed" } } } } { "model": "jev-1.13.0", "answers": { "is_urgent": { "type": "noul", "noul": 0.95 } }, "usage": { "input_tokens": 307, "output_tokens": 20 } }
TypeSafe API reference, unaltered. The response is a single number: the probability that the answer is yes.
Introduction6 / 50

Score: a degree on an ordered scale

POST https://api.typesafe.ai/v1/systemone request response { "state": "Help! My payouts have been failing for 3 days.", "model": "jev-latest", "questions": { "frustration": { "type": "score", "instructions": "How frustrated is the customer?", "criteria": ["Calm", "Frustrated", "Very angry"] } } } { "model": "jev-1.13.0", "answers": { "frustration": { "type": "score", "score": 1.05, "legend": { "0": "Calm", "1": "Frustrated", "2": "Very angry" }, "probabilities": { "0": 0.0, "1": 0.95, "2": 0.05 }, "confidence": 0.92 } }, "usage": { "input_tokens": 304, "output_tokens": 18 } }
TypeSafe API reference, unaltered. The score is the mean of the levels weighted by the probabilities: 1 × 0.95 + 2 × 0.05 = 1.05.
  1. 01Problem
  2. The idea
  3. Model
  4. Mechanism
  5. Numbers
  6. Jev, Laya

The problem

Block 1 of 6

Why does a JSON generated by an LLM cost hundreds of sequential passes?

01 · The problem8 / 50

The files of the fraud example

presets/fintech_fraud.json run_parallel_generation(...) { "id": "fintech_fraud", … "title", "description" "context": "TRANSACTION ALERT #TX-98421\nTimestamp: 2026-09-15 03:14:22 UTC\nCardholder: Sarah Jenkins (Account ID: US-99120)\nTransaction Amount: ,850.00 USD\nMerchan … (831 characters)", "schema": { "is_fraudulent": { "type": "boolean", "description": "Whether transaction is fraudulent" }, "risk_tier": { "type": "enum", "description": "Calculated risk tier", "choices": [ "LOW", "MEDIUM", "HIGH", "CRITICAL" ] }, … 26 more fields } } { "mode": "parallel_constrained_calibrated", "elapsed_ms": 506.26, "prefill_ms": 283.59, "suffix_eval_ms": 183.66, "total_tokens_generated": 0, "sequential_forward_passes": 1, "is_valid_json": true, "schema_match": true, "parsed_json": { "is_fraudulent": { "value": true, "prob": 0.954 }, "risk_tier": { "value": "HIGH", "prob": 0.7433 }, … 26 more fields }, "field_telemetry": { … }, "has_calibrated_probabilities": true, "num_fields": 28 }
Unaltered excerpts; "…" marks omissions, and the long context lines were wrapped only to fit.
01 · The problem9 / 50

In autoregressive generation,
each token costs one pass.

Each JSON token depends on the previous one, so the passes through the model happen one after another.

TAR=tprefill+∑k=1Ktstep(k) T_{\text{AR}} = t_{\text{prefill}} + \sum_{k=1}^{K} t_{\text{step}}(k)

With 28 fields, Qwen2.5-1.5B produced 288 tokens. Of these, only 27 choose a value, since one field was left out; the rest is syntax: braces, quotes and field names the program already knew in advance.

01 · The problem10 / 50

Where the 288 passes go

288 squares, one per model pass: 27 choose a value, 33 complete values, 109 write field names and 119 are punctuation and formatting.
01 · The problem11 / 50

Valid syntax
does not guarantee a valid schema.

The JSON closes without a syntax error and still may omit fields or contain values outside the list.

  • Fraud: the field account_takeover_suspected was left out.
  • Fraud: secondary_anomaly received an option from another field.
  • Support: the field ticket_priority was left out.
  1. Problem
  2. 02The idea
  3. Model
  4. Mechanism
  5. Numbers
  6. Jev, Laya

The idea

Block 2 of 6

If each value belongs to a closed list, why generate it token by token?

02 · The idea13 / 50

When the possible answers are known, deciding means comparing logits, not generating text.

The principle of parallel constrained decoding

02 · The idea14 / 50

The method combines
four pieces.

  1. The context and the field catalog go through the prefill only once and stay in the KV cache.
  2. The cache is replicated for each field, and the 28 suffixes are evaluated in one batched pass.
  3. In each field, only the tokens of the valid options enter the logit contest.
  4. The JSON is assembled by the program; the model only chooses the values.
  1. Problem
  2. The idea
  3. 03Model
  4. Mechanism
  5. Numbers
  6. Jev, Laya

Inside the model

Block 3 of 6

Which parts of Qwen2.5 does the engine use, and what does each one cost?

03 · Inside the model16 / 50

A 4-bit Qwen2.5-1.5B, piece by piece

tokens 646 embedding 151,936 × 1,536 decoder block × 28 RMSNorm grouped-query attention, RoPE Q 12 heads · K and V 2 · 128 dim. + residual RMSNorm SwiGLU MLP · 1,536 to 8,960 + residual RMSNorm final head embedding transposed slice C logits both yellow boxes are one matrix
1,543,714,304 parameters in 4 bits, with a scale and an offset every 64 weights: 869 MB. The slice is the engine's only piece.
03 · Inside the model17 / 50

The SwiGLU MLP in one formula

Three weight matrices, fixed after training, transform the vector of each token.

MLP(x)=Wdown(SiLU(Wgate x)⊙Wup x) \mathrm{MLP}(x) = W_{\text{down}} \big( \mathrm{SiLU}(W_{\text{gate}}\, x) \odot W_{\text{up}}\, x \big)
SiLU(z)=z1+e−z \mathrm{SiLU}(z) = \frac{z}{1 + e^{-z}}

The product ⊙ \odot is elementwise. There is no bias.

The output, also of size 1,536, is added to the residual.

03 · Inside the model18 / 50

How the SwiGLU MLP transforms a vector

Miniature SwiGLU MLP: a 4-entry vector goes through two projections to 8 units, one of them through the SiLU function; the two are multiplied elementwise and the result returns to 4 outputs.
03 · Inside the model19 / 50

How the weights fit in 4 bits

A group of 64 weights quantized to 4 bits: each weight is rounded to one of 16 levels between the group's minimum and maximum; in memory, 8 four-bit values fill a 32-bit word, and the group stores a scale and an offset in 16 bits.
03 · Inside the model20 / 50

The tokens through Qwen and through RLCD

Two panels: on the left, the original Qwen runs a prefill and then 288 one-token passes through the 28 blocks; on the right, RLCD runs the same prefill, copies the cache 28 times and decides the 28 fields in one batched pass.
03 · Inside the model21 / 50

Each piece, with shapes and cost

List of the model's pieces with parameters: embedding 233 million, attention 5.5 million per block, MLP 41.3 million per block, final norm, shared head and logit slice.
03 · Inside the model22 / 50

Twelve queries, two keys:
the cache is six times smaller.

With grouped-query attention, each stored token takes 28,672 bytes across the 28 layers.

2×28×2×128×2=28 672 bytes 2 \times 28 \times 2 \times 128 \times 2 = 28\,672 \ \text{bytes}

The factors are K and V, 28 layers, 2 heads, 128 dimensions and 2 bytes in fp16. With one K and V head per query, it would be 172 kB per token, and the broadcast to 28 fields would exceed 3.7 GB.

03 · Inside the model23 / 50

The KV cache, position by position

The KV cache as 28 bands, one per layer, each with K and V; 646 prompt positions occupy 768 reserved ones, and the broadcast creates 28 copies.
03 · Inside the model24 / 50

The price of the cache broadcast

With 646 tokens and 28 fields: model weights 868.5 MB, one copy of the cache 22.0 MB, broadcast 616.6 MB.
03 · Inside the model25 / 50

Three quarters of the parameters are in the MLPs

MLPs, 28 blocks: 1,156M, 74.9% embedding and head, shared: 233M, 15.1% attention, 28 blocks: 154M, 10.0% norms: 87,552 parameters, too small to show
Weight-by-weight count from the safetensors shapes: 1,543,714,304 in total.
03 · Inside the model26 / 50

The same layers in three regimes

Tensor shapes in the batched pass: tokens 28 by 11, cache 28 by 2 by 657 by 128, logits 28 by 11 by 151,936.
03 · Inside the model27 / 50

What the engine computes
and what it throws away.

Three measurements on the fraud preset show where the model does more, or less, work than the engine needs.

stagemeasurementwhat it means
Prefill287 ms, versus 347 msthe output head is not evaluated
Broadcast616.6 MB28 copies of the 22.0 MB cache
Batched pass46.8M logits76 are read; they cost 24 of 183 ms
  1. Problem
  2. The idea
  3. Model
  4. 04Mechanism
  5. Numbers
  6. Jev, Laya

The mechanism

Block 4 of 6

What happens, field by field, inside the single pass?

04 · The mechanism29 / 50

One prefill and one branch per field

single prefill per-field suffix, one batched pass logit slice and softmax context + catalog KV cache "is_fraudulent": "risk_tier": " "recommended_action": " … up to field 28 true 0.95 HIGH 0.74 MANUAL_REVIEW 0.51
Fraud alert: the context is read once, and each field ends in a valid value together with its probability.
04 · The mechanism30 / 50

The prompt ends by opening the JSON,
and stops there.

the prefill prompt, 646 tokens then each branch appends one line <|im_start|> system Classify JSON attributes: "is_fraudulent": Whether transaction is fraudulent "risk_tier": Calculated risk tier "recommended_action": Immediate mitigation action … 24 more fields "account_takeover_suspected": Whether cardholder … <|im_end|> <|im_start|> user TRANSACTION ALERT #TX-98421 Timestamp: 2026-09-15 03:14:22 UTC … 9 more alert lines Two-Factor Authentication: SMS 2FA prompt bypassed … <|im_end|> <|im_start|> assistant { the prompt stops here "is_fraudulent": "risk_tier": " "recommended_action": " … one suffix per field, 28 in all The next token, after the quote, is the field's decision.
Real prompt of the fraud case, assembled by the repository; "…" marks omissions. In gray, the special tokens of the chat format.
04 · The mechanism31 / 50

Each field receives
a copy of the cache.

We repeat the cache M times along the batch axis, and the M suffixes are evaluated in a single pass.

b_cache = []
for c in cache:
    nc = copy.copy(c)
    nc.keys = mx.repeat(c.keys, M, axis=0)
    nc.values = mx.repeat(c.values, M, axis=0)
    b_cache.append(nc)

# batch row i: '  "risk_tier": "'
out = model(suffixes_batch, cache=b_cache)
logits_i = out[i, fim_i, :]  # the decision for field i
04 · The mechanism32 / 50

Only the field's options
compete for the decision.

Of the roughly 152 thousand logits in the vocabulary, we read only those of the first token of each option.

P(ci)=ezi/T∑j=1Cezj/T P(c_i) = \frac{e^{z_i/T}}{\sum_{j=1}^{C} e^{z_j/T}}

A boolean compares 2 logits; risk_tier, 4.

04 · The mechanism33 / 50

The logit slice at another temperature

Probabilities of recommended_action at T equal to 1: MANUAL_REVIEW 0.51, BLOCK_TRANSACTION 0.44, the others below 0.03.
04 · The mechanism34 / 50

The probability indicates when to doubt

MANUAL_REVIEW 0.51 BLOCK_TRANSACTION 0.44 APPROVE 0.02 FREEZE_ACCOUNT 0.02 CHALLENGE_2FA 0.004
Field recommended_action in the fraud alert: manual review beats blocking by 0.51 to 0.44.
04 · The mechanism35 / 50

How much probability falls on the options

probability on the field's options rest of the vocabulary, 151,936 tokens loss_prevention_priority 1.4% risk_tier 1.2% confidence_score_tier 0.8% counterparty_jurisdiction_r… 0.5% sanctions_screening_risk 0.5% primary_anomaly 0.2% chargeback_probability 0.08% recommended_action 0.06% merchant_category_risk 0.01% velocity_score < 0.01% secondary_anomaly < 0.01% aml_sar_filing_required < 0.01% requires_identity_verificat… < 0.01% can_auto_block < 0.01% notify_cardholder_sms < 0.01% block_card_immediately < 0.01% freeze_online_banking < 0.01% auto_reverse_transfer < 0.01% notify_cardholder_email < 0.01% escalate_to_fiu < 0.01% account_takeover_suspected < 0.01% is_fraudulent < 0.01% fraud_ring_association < 0.01% requires_human_escalation < 0.01% alert_clearing_house < 0.01% device_fingerprint_mismatch < 0.01% tor_exit_node_detected < 0.01% fincen_flag_threshold < 0.01%
Fraud case, 28 fields: the schema options receive at most 1.4% of the next-token probability. Measured on the M4 Pro.
04 · The mechanism36 / 50

What the model wanted to write

For booleans, it wants 1 or 0; for enums, another word or another spelling.

fieldin the schemapreferred tokenon the options
tor_exit_node_detectedtrue, false1, 0.99< 0.01%
requires_human_escalationtrue, false1, 0.97< 0.01%
risk_tierLOW to CRITICALHigh, 0.461.2%
recommended_actionAPPROVE to FREEZE, 5 optionsNotify, 0.130.06%
04 · The mechanism37 / 50

Where the 0.51 and the 0.44 come from

The slice renormalizes probabilities that the model considers almost impossible.

P(c)=pvocab(c)∑jpvocab(j) P(c) = \frac{p_{\text{vocab}}(c)}{\sum_{j} p_{\text{vocab}}(j)}
recommended_actionin the vocabularyin the slice
MANUAL_REVIEW0.000280.51
BLOCK_TRANSACTION0.000250.44
the other three0.000030.05
04 · The mechanism38 / 50

When the options start the same way

The common prefix becomes part of the suffix, and the decision falls on the first token where the options differ.

For SEV_0_CRITICAL, SEV_1_MAJOR and their neighbors, the suffix ends in "SEV_, and the contest is among the digits.

  1. Problem
  2. The idea
  3. Model
  4. Mechanism
  5. 05Numbers
  6. Jev, Laya

The numbers

Block 5 of 6

How much do we gain on an M4 Pro, and where does the remaining time go?

05 · The numbers40 / 50

Both decoding methods in the four scenarios

In the fraud scenario, the baseline generates 288 tokens in 2467 ms; the parallel method decides 28 fields in 521 ms.
05 · The numbers41 / 50

From 3.6 to 4.8 times faster,
measured on this Mac.

Qwen2.5-1.5B-Instruct in 4 bits, with MLX on an M4 Pro; median of three runs per scenario.

scenariofieldsautoregressiveparallelspeedup
Fraud282493 ms521 ms4.8×
Code security282681 ms708 ms3.8×
Support282524 ms661 ms3.8×
Customs, 255 options4825 ms227 ms3.6×
05 · The numbers42 / 50

The prefill tends to be the largest share

autoregressive prefill batched pass rest Fraud 2493 ms 521 ms Code 2681 ms 708 ms Support 2524 ms 661 ms Customs 825 ms 227 ms
All bars are on the same scale. In the 28-field scenarios, the prefill takes about 290 ms, close to half of the total.
05 · The numbers43 / 50

Why 4.8 times
and not 288?

Sequential passes drop from 288 to one, but the prefill remains, and the batched pass is wide.

In the fraud scenario, the prefill takes 294 of the 521 ms, more than half of the time. From here on, shortening the prompt likely pays off more than speeding up the decision.

05 · The numbers44 / 50

Where the speedup saturates

Curve of the predicted speedup as a function of the number of fields, rising from 2.5 times with 1 field to close to 6 times with 64 fields.
  1. Problem
  2. The idea
  3. Model
  4. Mechanism
  5. Numbers
  6. 06Jev, Laya

Jev and Laya

Block 6 of 6

What changes when the classifier is trained to decide?

06 · Jev and Laya46 / 50

Laya: one [MASK] for each option

the input for one question [CLS] choice question: Which team should handle `body`? [SEP] [MASK] billing: payments [MASK] tech: bugs [MASK] other: general [SEP] {"subject": "Refund request", "body": "I was billed twice..."} [SEP] ModernBERT-large, 395M parameters, bidirectional 28 layers, width 1,024: each token sees all the others + question-type embedding: choice 0, score 1, noul 2 decision head: 2 transformer layers, 25M option scorer, 1M each [MASK] state becomes an option logit fed to softmax(z / T) act or escalate, 0.3M [CLS] + 4 distribution statistics give P(act) and P(escalate to a human) probabilities and confidence automatic decision or human review What changes relative to the lecture repository The options are written into the input text. The encoder reads the sequence both ways. A trained head scores each option. Softmax stays within the options.
Redrawn from Nandakishor M's diagram; the input sequence is the example from the paper itself. 421M parameters in total.
06 · Jev and Laya47 / 50

Laya's training:
proper scoring rules.

The reward is maximal when the stated probability matches the actual frequency of correct answers.

R(q,y)=Slog⁡+0.5 Ssph−Srps R(q, y) = S_{\log} + 0.5\, S_{\text{sph}} - S_{\text{rps}}

Logarithmic, spherical and ranked probability scores, optimized by REINFORCE with noise on the logits.

06 · Jev and Laya48 / 50

Jev, Laya and the lecture repository

JevLayarepository
modelnot publishedModernBERT-large, 395MQwen2.5-1.5B
scores the optionsnot publishedhead trained on [MASK]first-token logit
calibration trainingRLCD, not publishedproper rules, publishednone
act or escalatethresholds in codededicated headnone
weights and codeclosedopenopen
06 · Jev and Laya49 / 50

Reinforcement learning
or supervised learning?

With known labels, calibration comes from the scoring rule; reinforcement does not explain it.

Closing50 / 50

The way these technologies are being developed encourages commercial exaggeration (hype). Ideas and people are mythologized, and precedence is conveniently ignored. Similar ideas were proposed in the following papers: arxiv.org/abs/2503.23303 and arxiv.org/abs/2510.01237

Produced with the assistance of Claude Opus 5.5
Agentic Complex Systems
Universidade
de São Paulo
Universidade de São Paulo