Millisecond "Zero-Generation" Probabilistic Decisions with a 4B Model: Full-Parameter JEV Fine-Tuning of Qwen3.5-4B with AReno

Summary: On a single Google Colab Pro A100 40GB GPU, we ran full-parameter fine-tuning of Qwen3.5-4B using the open-source AReno framework with the LM-Label zero-generation protocol (--sgl-jev), selective bidirectional attention (--bi-attn), and soft-probability teacher distillation for 4.24 hours (1,000 steps). On a held-out 4,000-question test set, Top-1 accuracy jumped from 59.00% to 81.65% (+22.65%), KL divergence from the teacher distribution dropped 9.4x, Brier score fell 6.7x, and ordinal score MAE dropped by 73.0%. Across two unseen diagnostic quiz suites totaling 27 practical cases, the trained model achieved a 100% pass rate.


1. Why Build a Dedicated Decision Model?

In production agent pipelines and enterprise workflows, models spend far more time making fast, structured decisions than writing essays:

  • Ticket routing: Should this customer message go to billing, technical support, security, or product?
  • Safety and compliance guardrails: Is this prompt an injection attempt? Does this contract trigger a risk-control exception?
  • Agent tool routing: Should the agent query the internal SQL database, search the web, or send an email next?
  • Incident and quality triage: Is this alert a P0 site-wide outage or a P3 cosmetic nitpick?

Using a general-purpose chat LLM for these tasks introduces three well-known bottlenecks:

  1. High latency: Autoregressive decoding of JSON or chain-of-thought (CoT) requires dozens of sequential decode steps even for a short 30-token answer, making it hard to fit into high-concurrency online paths.
  2. Brittle parsing: One extra polite sentence or missing quote breaks downstream JSON parsers.
  3. Chronic overconfidence: Instruction-tuned chat models tend to produce sharp, near one-hot predictions—often assigning 99.9% confidence even to ambiguous or underspecified inputs, making raw probabilities unusable for risk thresholds or human-in-the-loop escalation.

The JEV typed-decision paradigm abstracts these workloads into three core primitives and outputs a calibrated probability distribution in a single forward pass (output_tokens = 0):

Decision Primitive Purpose Candidate Label Protocol Core Output
choice Multi-class selection / routing (2–255 options) A–Z (auto two-letter single tokens beyond 26) Full option probabilities + Top-1 choice
noul Binary yes/no judgment (guardrails, approvals) yes (true) / no (false) Continuous probability P(true)
score Ordinal grading (2–10 severity/quality levels) 0–9 Level probabilities + expected value $\mathbb{E}[\text{score}]$

2. Architecture Choices: Why --sgl-jev, --bi-attn, and Qwen3.5-4B?

1. Route 2 (--sgl-jev): Reuse the Native LM Head for Single-Prefill Comparison

AReno supports two primary routes for training decision models:

  • Route 1 (dedicated scalar head, --algo jev): Attaches a linear scoring head and scores each (state, option) pair independently. It scales well to huge candidate pools, but options cannot attend to one another—making comparative elimination difficult in a single pass.
  • Route 2 (native LM-label protocol, --sgl-jev): Packs the state, question instructions, and all candidate criteria into a single standard chat prompt (with thinking strictly disabled, enable_thinking=False). At the final answer-boundary position, it reads logits directly from the native LM head for the single-token candidate labels (A/B/C/D, yes/no, 0/1/2/3) and applies softmax over that candidate subset.

During training, AReno’s label_jev_loss_fn computes restricted cross-entropy strictly over the candidate label set $\mathcal{C}$:

$$\mathcal{L} = -\sum_{i \in \mathcal{C}} q_i \log \frac{\exp(z_i / T)}{\sum_{j \in \mathcal{C}} \exp(z_j / T)}$$

Here $z_i$ is the LM-head logit for candidate label $i$ at the answer boundary, and $q_i$ can be either a hard one-hot label or a soft probability distribution distilled from a stronger teacher model.

This design yields three practical advantages:

  1. Zero extra parameters and zero decode tokens: No custom classification head is needed; a single prefill produces the entire distribution (output_tokens = 0), preserving native compatibility with AReno and SGLang serving.
  2. Built-in comparative reasoning and elimination: Because every candidate appears in the same context, the model naturally handles “none of the above” and subtle distinctions among near-duplicate options.
  3. Smooth transfer from pretraining: Fine-tuning adjusts the relative ordering of existing LM-head label tokens rather than initializing a classification head from scratch, allowing fast convergence on modest datasets.

2. Enabling --bi-attn: Letting Late Rules Illuminate Early Context

Standard autoregressive LLMs use strictly causal attention: while reading token 100, the model has no visibility into a late policy exception at token 500 or the candidate options at the end of the prompt.

Qwen/Qwen3.5-4B uses a 3:1 hybrid architecture across its 32 layers (24 Gated DeltaNet linear-attention layers and 8 full-attention layers). AReno’s --bi-attn flag takes clean advantage of this split:

  • Convert all 8 full-attention layers to bidirectional attention: Setting is_causal = false (persisted in both config.json and label_jev_config.json) lets late exception clauses, instructions, and candidate criteria attend bidirectionally back to earlier state details.
  • Keep all 24 Gated DeltaNet layers linear: Preserves linear-time recurrence efficiency without paying the memory and compute penalty of full-layer quadratic bidirectional attention.
1
2
3
4
5
6
flowchart LR
A["State + Question + Criteria (thinking=False)"] --> B["Qwen3.5-4B: 24x Gated DeltaNet + 8x Bi-Attn"]
B --> C["Native LM Head Logits at Answer Boundary"]
C --> D["Slice Candidate Label Subset (A-Z / yes,no / 0-9)"]
D --> E["Restricted Softmax (output_tokens = 0)"]
E --> F["choice / noul / score Distribution and Expected Value"]

3. End-to-End Training Walkthrough: Data Recipe, Memory Budget, and Convergence

1. Data Recipe: Soft Teacher Distillation + Multi-Domain Hard Mix (53 Workflows)

To combine sharp probability calibration with broad cross-domain generalization, we prepared 16,000 training questions and 4,000 held-out test questions on a free Colab CPU runtime using prepare_data.py, spanning 53 distinct workflows:

Split Source Questions Soft / Hard Target Mix Role
Training core LocalLLaMA/typed-decisions 12,000 11,954 soft distributions + 46 hard 4 enterprise workflows (invoice_processing, agent_trace_observability, customer_service, security_incidents, 3,000 each) driving soft-target distillation and calibration
Training diversity mix ZefanCai/Open-Jev-v1.1 (community-hard-mix-v2-redistributable) 4,000 4,000 multi-domain hard labels Spans 49 diverse sub-domains (contract audits, browser forms, Git/shell diagnostics, rubric judging, NLI logic) to prevent domain overfitting
Held-out test set LocalLLaMA/typed-decisions (test split) 4,000 3,996 soft distributions + 4 hard choice 1,200 / noul 1,200 / score 1,600 for clean evaluation

Two crucial preprocessing details:

  1. Zero-truncation pre-validation: Route 2 rejects silent prompt truncation (which could slice off trailing options or corrupt the answer boundary). We ran every question through the actual Qwen/Qwen3.5-4B tokenizer and encode_question beforehand—training lengths came in at P50 315, P95 644, max 1,007 tokens (test max 584), achieving 0 dropped samples under max_seq_len=2048.
  2. Shuffling training option order (--shuffle-choice-order): Randomizing choice option positions during training eliminates position bias (such as defaulting to option A or the last option) and improves permutation stability at inference time.

2. Single-GPU Memory Budget: Why an A100 40GB Was Necessary

Despite its 4B name, Qwen/Qwen3.5-4B is natively a multimodal architecture containing a frozen vision tower and MTP layers (4.66B total parameters, roughly 8.8 GB on disk):

  • L4 (22 GB) finding: Even with --adam-4bit and activation checkpointing enabled, full-parameter fine-tuning sat near ~21 GiB and hit OOM due to weights, BF16 gradients, workspace buffers, and allocator fragmentation.
  • Colab Pro A100-SXM4-40GB stable setup:
    • Install flash-linear-attention (fla 0.5.2), required for BF16 CUDA backward passes on Qwen3.5’s 24 Gated DeltaNet layers.
    • Enable --adam-4bit, compressing full-parameter optimizer states to just 2.40 GiB.
    • Enable --activation-checkpointing, holding peak VRAM at 31.29 GiB allocated / 33.68 GiB reserved with comfortable headroom.

Core training command (2 epochs, 1,000 total steps):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
areno train \
--sgl-jev \
--bi-attn \
--ckpt Qwen/Qwen3.5-4B \
--dataset-path data/train.jsonl \
--save-path outputs/qwen35-4b-sgl-jev-bi-attn \
--world-size 1 \
--tp-size 1 \
--batch-size 32 \
--mini-bs 2 \
--max-context-len 2048 \
--adam-4bit \
--activation-checkpointing \
--lr 1e-5 \
--min-lr 1e-6 \
--lr-decay-style cosine \
--lr-decay-steps 1000 \
--epochs 2 \
--seed 17

3. Training Curve: Smooth 1,000-Step Convergence with Zero NaNs

Completing 2 full epochs (1,000 steps, monotonically covering all 16,000 training questions each epoch) took 15,250.6 seconds (4.24 hours), with a steady median of 15.20s/step. Including evaluation and quiz runs, the entire A100 session used roughly 41.8 Colab Compute Units.

Training Window (100-step mean) Epoch Train Loss ↓ Train Acc ↑ Median Grad Norm Ending LR
Steps 1 – 100 0 0.8750 70.19% 34.8 9.78e-6
Steps 201 – 300 0 0.7110 83.03% 19.2 8.16e-6
Steps 401 – 500 (end of Ep 1) 0 0.6662 84.75% 14.1 5.51e-6
Steps 601 – 700 1 0.6245 89.69% 7.8 2.87e-6
Steps 901 – 1000 (end of Ep 2) 1 0.6029 90.66% 5.3 1.00e-6

Notable training behavior: On step 1—when the 8 full-attention layers first switched from causal to bidirectional—the raw gradient norm spiked to 329.47, which gradient clipping (1.0) absorbed cleanly. Median gradient norm then decayed smoothly from 34.8 down to 5.3 with 0 NaN or Inf events across all 1,000 steps.


4. Evaluation Results: Beyond Accuracy to Calibrated Distributions

1. Quantitative Results on the 4,000-Question Test Set (Base vs Trained)

Comparing zero-shot base Qwen3.5-4B (causal) against our fine-tuned Qwen3.5-4B (--sgl-jev --bi-attn) on the exact same 4,000-question test.jsonl:

Slice Count Top-1 Acc ↑ Cross-Entropy ↓ Teacher Entropy $H(p)$ True KL ↓ ($\text{CE} - H$) Brier Score ↓
Overall 4,000 59.00% -> 81.65% (+22.65%) 1.4242 -> 0.8370 0.7674 0.6568 -> 0.0696 (9.4x lower) 0.2594 -> 0.0387 (6.7x lower)
choice 1,200 62.50% -> 79.17% (+16.67%) 1.6881 -> 0.9603 0.8638 0.8243 -> 0.0965 (8.5x lower) 0.2758 -> 0.0510
noul 1,200 70.33% -> 86.00% (+15.67%) 0.7405 -> 0.4903 0.4537 0.2868 -> 0.0366 (7.8x lower) 0.1882 -> 0.0280
score 1,600 47.88% -> 80.25% (+32.38%) 1.7391 -> 1.0046 0.9303 0.8088 -> 0.0743 (10.9x lower) 0.3005 -> 0.0374

On ordinal score grading, expected-value MAE dropped from 0.6602 down to 0.1784 (a 73.0% error reduction).

Interpreting Two Subtle Metrics

  1. Why did Cross-Entropy finish at 0.8370 instead of near zero?
    Because 3,996 out of 4,000 test examples have soft teacher probability targets rather than 0/1 hard labels. The irreducible Shannon entropy floor of those soft targets is $H(p_{\text{teacher}}) = 0.7674$—even an oracle matching the teacher identically cannot score below 0.7674.
    Subtracting that entropy floor reveals that true KL divergence plummeted from 0.6568 to 0.0696 nats (closing 89.4% of the gap to the teacher distribution). Comparing end-of-training KL (0.6029 - 0.5611 = 0.0418) against test KL (0.0696) confirms virtually no overfitting.

  2. Why did full-vocabulary label_mass dip slightly from 98.5% to 90.8%?
    This is an expected mathematical property of label_jev_loss_fn: the loss applies log_softmax solely over the candidate label IDs row[ids], without explicitly penalizing a uniform shift relative to the rest of the 248K vocabulary. Because serving (LabelDecisionScorer) likewise normalizes strictly over the candidate labels, a 90.8%–96.1% label mass is completely healthy and has zero negative impact on output probabilities.


2. Qualitative Audit on 27 Unseen Diagnostic Cases

To verify real-world generalization beyond the benchmark split, we ran two completely unseen diagnostic suites covering bilingual scenarios, adversarial edge cases, and reversed option-order checks:

  • 15-case multi-domain diagnostic suite (support routing, prompt-injection defense, SQLi code review, late-clause reversal, elimination, uncertainty calibration, 10-way microservice routing): pass rate rose from 13/15 (86.7%) to 15/15 (100.0%), with 3/3 reverse-order consistency.
  • 12-case independent edge/adversarial suite (legal preservation holds, strict numeric boundaries, duplicate approvers, severity grading): maintained 12/12 (100.0%) pass rate and 6/6 reverse-order consistency, while cutting mean reverse-order drift (TVD) from 0.0545 to 0.0445.

Four standout cases illustrate the behavioral upgrade:

Case 1: Late Policy Exception in a Long Document (--bi-attn Probe)

  • Scenario: A 7-item procurement meeting log states a 500K annual budget cap and director approval up to 200K, followed by unrelated facility notes. Item 6 introduces a late risk exception: any single vendor quote above 450K requires written CFO review and cannot be signed by a director. Item 7 presents a 480K quote already signed by the director. Question: “Can this contract be signed now without CFO review?” (expected P(true) <= 0.20).
  • Base (Causal): P(true) = 0.223 (FAIL) — causal attention is anchored by earlier budget/director cues.
  • Trained (Bi-Attn): P(true) = 0.060 (PASS) — bidirectional full attention links the late exception cleanly back to the quote and blocks the violation.

Case 2: Dual-Intent Ambiguous Ticket (Soft-Distillation Calibration)

  • Scenario: A customer reports two equally urgent problems in one message: being double-charged on their credit card (billing) AND being locked out of the dashboard by an SSO login error (technical), with candidates billing / technical / marketing / hr.
  • Base: technical: 86.4%, billing: 13.3% — overconfident and blind to the billing failure.
  • Trained: billing: 54.4%, technical: 42.4%, with irrelevant classes (marketing + hr) totaling just 3.2%.
  • Practical takeaway: In production routing, a close top-2 probability split (0.54 vs 0.42) is an actionable signal to trigger parallel multi-team dispatch or human review—something a brittle argmax cannot provide.

Case 3: Low-Severity Ordinal Calibration

  • Scenario: A website footer still displays Copyright 2025 instead of 2026 while all production functionality is healthy; rate severity on a 0–4 scale (expected E[score] <= 0.80).
  • Base: Assigned 96.6% probability to level 1, yielding E[score] = 1.008 (FAIL).
  • Trained: Raised level 0 probability to 30.0%, bringing expected severity down to E[score] = 0.770 (PASS).

Case 4: Strict Boundary Conditions and Option-Order Stability

  • Exact threshold equality: Policy triggers a reminder only when wait time exceeds 30 minutes; ticket has waited exactly 30 minutes. Should a reminder be sent?
    • Base: P(true) = 0.407 (wavering near the decision boundary)
    • Trained: P(true) = 0.148 (cleanly separates > from >=)
  • Permutation stability on legal hold (archive_hold): Reversing the four option positions caused a massive probability shift of TVD = 0.2248 on the base model; the trained model cut that drift by more than half to 0.0922.

5. One-Command Deployment as a Zero-Generation Decision Service

The saved checkpoint automatically bundles label_jev_config.json (recording bi_attn=true, temperature, max context length, and chat_template_sha256) alongside config.json (text_config.is_causal = false).

Launching the native AReno serving endpoint takes one command—it automatically restores bidirectional attention and refuses to start if someone accidentally passes --no-bi-attn:

1
2
3
4
5
6
areno serve \
--model-path outputs/jev_qwen35_run/qwen35-4b-sgl-jev-bi-attn-final \
--sgl-jev \
--tp-size 1 \
--world-size 1 \
--port 8000

On Apple Silicon Macs, adding --backend mlx (and optionally --q4 for 4-bit quantization) lets you serve the same decision checkpoint locally with a small memory footprint.

Sending a single JSON payload to POST /v1/systemone evaluates choice, noul, and score questions against the same state in one call:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"state": "The core payment gateway is seeing intermittent TLS handshake timeouts. Order success rate dropped from 99.9% to 91% over the last 5 minutes, and 3 enterprise customers have reported failures.",
"questions": {
"owner": {
"type": "choice",
"instructions": "Which team should be paged into the incident channel first?",
"criteria": {
"payments_sre": "Payment gateway availability, TLS timeouts, and core reliability",
"frontend": "Browser UI layout and client-side JavaScript errors",
"finance": "Reconciliation, invoicing, and accounting settlements"
}
},
"page_oncall": {
"type": "noul",
"instructions": "Should we immediately trigger a PagerDuty alert for the on-call engineer?"
},
"severity": {
"type": "score",
"instructions": "Rate incident severity from 0 (lowest) to 3 (highest).",
"criteria": ["P3 low", "P2 partial impact", "P1 core degraded", "P0 full outage"]
}
}
}

The endpoint returns full calibrated probability distributions, expected scores, and usage.output_tokens = 0—no regex extraction, no malformed JSON, and prefill-level latency.


6. Takeaways and Next Steps

This experiment validates a practical systems principle: for fast, intuitive “System-1” decisions—routing, guardrails, triage, and scoring—you do not need a giant LLM generating verbose JSON token by token. Combining a 4B hybrid backbone, selective bidirectional attention, soft teacher distillation, and native LM-head scoring produces an accurate, well-calibrated, low-latency decision engine on a single cloud GPU.

To adapt this recipe to your own production domain:

  1. Distill soft labels offline from a frontier teacher: Collect 5,000–10,000 real domain logs, generate soft target distributions with a strong model, and mix in 20%–30% diverse open decision data to guard against overfitting.
  2. Gate releases on both distributions and counterfactuals: Track KL divergence, Brier score, and reverse-order TVD alongside Top-1 accuracy, paired with a hand-crafted regression suite of late-exception and ambiguous-boundary probes.
  3. Pair System-1 and System-2 in production: Put the 4B JEV model at the front door for millisecond routing and confidence gating—auto-execute high-confidence decisions, and escalate uncertain or high-entropy cases (like a 0.54 vs 0.42 split) to a larger reasoning model or human operator.