reflex: a System One decision model (LoRA for Qwen/Qwen3.5-4B)

Give it some state and a list of questions with fixed answers. It answers all of them in one pass and returns a calibrated probability for every option. It never writes free text, so it cannot invent an answer that is not on your list, and there is nothing to parse.

This repo holds a LoRA adapter (plus the fitted calibration temperature) for reflex, an open re-creation of TypeSafe's Jev. The adapter was trained with a proper scoring rule on public datasets and synthetic data.

Status (2026-09-19): superseded for general use. Controls run after this adapter was published showed that the frozen Qwen/Qwen3.5-4B with reflex's current default prompt and no calibration file scores better on data neither was trained on, and better on the public JevBench items (hard tier 0.658 vs 0.604, calibration error 0.086 vs 0.117). The adapter is sharper on inputs that resemble its training mix and worse on long, ambiguous ones. Full numbers and the reasoning: docs/results/frozen-vs-trained.md.

Recommended: git checkout stable && uv run reflex-serve --stable in the reflex repo (no adapter). This adapter stays published for reproducibility and as a worked example of the fine-tuning recipe, which is the right tool when you have labels from your own workload.

Quick start (this adapter)

pip install uv && git clone https://github.com/kshetrajna12/reflex && cd reflex && uv sync
uv run reflex-serve --model Qwen/Qwen3.5-4B --adapter kshetrajna12/reflex-qwen3.5-4b-lora --host 0.0.0.0 --port 8000

The adapter and its calibration.json are pulled from this repo automatically. Any CUDA GPU with 16 GB or more works; the first request compiles kernels for about 20 s.

curl -s localhost:8000/v1/systemone -H 'content-type: application/json' -d '{
  "state": {"ticket": "My payouts have failed three times this week and nobody replied."},
  "questions": {
    "queue":    {"type": "choice", "instructions": "Which team should handle this?",
                 "criteria": {"payments": "payouts, refunds", "account": "login, 2FA", "other": null}},
    "escalate": {"type": "noul",   "instructions": "Should this be escalated to a manager?"},
    "urgency":  {"type": "score",  "instructions": "How urgent is this?",
                 "criteria": ["can wait a week", "handle today", "blocked right now"]}
  }
}'
{
  "answers": {
    "queue":    {"type": "choice", "choice": "payments",
                 "probabilities": {"payments": 0.97, "account": 0.02, "other": 0.01}, "confidence": 0.91},
    "escalate": {"type": "noul", "noul": 0.71},
    "urgency":  {"type": "score", "score": 1.77, "probabilities": {"0": 0.05, "1": 0.13, "2": 0.82},
                 "legend": {"0": "can wait a week", "1": "handle today", "2": "blocked right now"}, "confidence": 0.62}
  },
  "usage": {"input_tokens": 258, "state_tokens": 79, "question_tokens": 179, "state_cache_hit": false}
}

In Python, without a server:

from reflex import Engine, SystemOneRequest

engine = Engine.load("Qwen/Qwen3.5-4B", adapter_path="kshetrajna12/reflex-qwen3.5-4b-lora")   # calibration picked up from the repo
resp = engine.answer(SystemOneRequest(
    state={"email": "I was charged twice this month, please fix."},
    questions={
        "team":  {"type": "choice", "instructions": "Which team?", "criteria": {"billing": None, "technical": None, "sales": None}},
        "angry": {"type": "noul", "instructions": "Is the customer angry?"},
    },
))
resp.answers["team"].probabilities, resp.answers["angry"].noul

The request and response shapes are the same as TypeSafe's hosted /v1/systemone, so Jev client code works against a reflex server unchanged.

The three question types

type asks you get back
noul "is this true?" noul: probability of yes
choice "which one of these?" (up to 26 options) choice, probabilities per option, confidence
score "how much, on this ordered scale?" (2 to 10 levels) score (probability-weighted level), probabilities, legend, confidence

state can be a string or any JSON, and can carry images as {"type": "image", "source": "<path, URL or data: URI>"} (the base model is natively multimodal). All questions in a request are answered independently, in parallel, over one encoding of the state, so asking twenty questions about one document costs about the same as asking one.

What it is good for

  • Routing and triage: support tickets, incidents, pull-request hunks ("does a senior reviewer need to read this?"), with thresholds you choose in code.
  • Guardrails on LLM output: is this answer grounded in the source, does it contain PII, is it in scope, as numbers you can threshold, at a small fraction of the cost of the model that wrote the answer.
  • Bulk labelling and reranking: score millions of rows overnight; the probabilities become features.
  • Not for: generating text, arithmetic, or anything that needs a chain of reasoning.

How it was trained

reflex-calibrate attaches LoRA adapters and minimises a proper scoring rule (cross-entropy against a hard or soft target) on the model's label-restricted next-token logits, the supervised form of Jev's "RLCD". Data came from reflex-data: public datasets (banking77, CLINC, MMLU-Pro, civil_comments with soft toxicity labels, HaluEval, MS MARCO, HelpSteer2 with per-rater score distributions, a GitHub code-review set) plus synthetic, correct-by-construction data for instruction adequacy, rule-based routing and reading probabilities off stated base rates. No benchmark items were used; an 8-gram overlap check against JevBench's public items is part of the pipeline.

Fitted calibration temperature: 1.544 (applied automatically when served through reflex).

Held-out evaluation at training time

### all
n=2082  acc=0.7963  ECE=0.0661  Brier=0.2985  NLL=0.6334  mean_conf=0.8507  fidelity=0.7589
  conf-bin   mean_conf  accuracy  count
  [0.13,0.20)     0.175     0.000      3
  [0.20,0.27)     0.240     0.250     28
  [0.27,0.33)     0.294     0.206     34
  [0.33,0.40)     0.366     0.383     47
  [0.40,0.47)     0.435     0.345     58
  [0.47,0.53)     0.500     0.585    106
  [0.53,0.60)     0.568     0.593     86
  [0.60,0.67)     0.631     0.609     69
  [0.67,0.73)     0.701     0.628     78
  [0.73,0.80)     0.774     0.608     79
  [0.80,0.87)     0.836     0.732     97
  [0.87,0.93)     0.908     0.717    145
  [0.93,1.00)     0.988     0.942   1252

### adequacy_synth
n=100  acc=0.9400  ECE=0.0570  Brier=0.0971  NLL=0.2574  mean_conf=0.9767
  conf-bin   mean_conf  accuracy  count
  [0.47,0.53)     0.531     0.000      2
  [0.53,0.60)     0.593     1.000      1
  [0.67,0.73)     0.679     1.000      1
  [0.73,0.80)     0.798     1.000      1
  [0.87,0.93)     0.915     1.000      1
  [0.93,1.00)     0.996     0.957     94

### banking77
n=200  acc=0.9350  ECE=0.0551  Brier=0.1170  NLL=0.3259  mean_conf=0.9857
  conf-bin   mean_conf  accuracy  count
  [0.60,0.67)     0.658     0.500      2
  [0.73,0.80)     0.781     1.000      2
  [0.80,0.87)     0.828     0.667      3
  [0.87,0.93)     0.892     0.500      6
  [0.93,1.00)     0.997     0.957    187

### base_rates_synth
n=100  acc=0.9800  ECE=0.3625  Brier=0.2556  NLL=0.5043  mean_conf=0.6175  fidelity=0.9350
  conf-bin   mean_conf  accuracy  count
  [0.33,0.40)     0.362     1.000      1
  [0.40,0.47)     0.446     0.750      8
  [0.47,0.53)     0.498     1.000     22
  [0.53,0.60)     0.568     1.000     21
  [0.60,0.67)     0.632     1.000     14
  [0.67,0.73)     0.699     1.000     13
  [0.73,0.80)     0.769     1.000     11
  [0.80,0.87)     0.831     1.000      7
  [0.87,0.93)     0.908     1.000      3

### civil_comments
n=250  acc=0.9560  ECE=0.0440  Brier=0.0766  NLL=0.1458  mean_conf=0.9343  fidelity=0.8131
  conf-bin   mean_conf  accuracy  count
  [0.47,0.53)     0.531     1.000      1
  [0.53,0.60)     0.577     0.500      2
  [0.60,0.67)     0.632     0.667      3
  [0.67,0.73)     0.700     1.000      5
  [0.73,0.80)     0.784     0.667      9
  [0.80,0.87)     0.835     0.917     12
  [0.87,0.93)     0.914     0.857     28
  [0.93,1.00)     0.968     0.995    190

### clinc
n=200  acc=0.9350  ECE=0.0451  Brier=0.0976  NLL=0.2604  mean_conf=0.9778
  conf-bin   mean_conf  accuracy  count
  [0.47,0.53)     0.500     0.500      2
  [0.53,0.60)     0.583     0.000      2
  [0.60,0.67)     0.634     0.000      1
  [0.67,0.73)     0.702     0.333      3
  [0.80,0.87)     0.839     0.333      3
  [0.87,0.93)     0.885     1.000      2
  [0.93,1.00)     0.997     0.973    187

### codereview
n=320  acc=0.7750  ECE=0.1927  Brier=0.4177  NLL=1.0124  mean_conf=0.9591
  conf-bin   mean_conf  accuracy  count
  [0.47,0.53)     0.500     1.000      1
  [0.53,0.60)     0.562     1.000      2
  [0.60,0.67)     0.637     0.500      2
  [0.67,0.73)     0.688     0.667      3
  [0.73,0.80)     0.777     0.000      1
  [0.80,0.87)     0.839     0.750      4
  [0.87,0.93)     0.916     0.611     54
  [0.93,1.00)     0.982     0.814    253

### halueval
n=200  acc=0.9850  ECE=0.0149  Brier=0.0284  NLL=0.0695  mean_conf=0.9975
  conf-bin   mean_conf  accuracy  count
  [0.87,0.93)     0.917     1.000      3
  [0.93,1.00)     0.999     0.985    197

### helpsteer2
n=125  acc=0.4400  ECE=0.1607  Brier=0.6694  NLL=1.3336  mean_conf=0.5753
  conf-bin   mean_conf  accuracy  count
  [0.20,0.27)     0.251     1.000      1
  [0.27,0.33)     0.287     0.333      3
  [0.33,0.40)     0.356     0.500      4
  [0.40,0.47)     0.437     0.111      9
  [0.47,0.53)     0.497     0.367     30
  [0.53,0.60)     0.564     0.455     33
  [0.60,0.67)     0.623     0.444     18
  [0.67,0.73)     0.688     0.545     11
  [0.73,0.80)     0.780     0.400      5
  [0.80,0.87)     0.836     0.700     10
  [0.87,0.93)     0.877     1.000      1

### helpsteer2_soft
n=125  acc=0.3680  ECE=0.1058  Brier=0.7793  NLL=1.5859  mean_conf=0.4103  fidelity=0.5902
  conf-bin   mean_conf  accuracy  count
  [0.20,0.27)     0.248     0.375      8
  [0.27,0.33)     0.291     0.235     17
  [0.33,0.40)     0.365     0.371     35
  [0.40,0.47)     0.433     0.300     30
  [0.47,0.53)     0.496     0.591     22
  [0.53,0.60)     0.559     0.222      9
  [0.60,0.67)     0.647     0.000      2
  [0.67,0.73)     0.681     1.000      2

### mmlu_pro
n=200  acc=0.5700  ECE=0.1429  Brier=0.5537  NLL=1.2712  mean_conf=0.6951
  conf-bin   mean_conf  accuracy  count
  [0.13,0.20)     0.175     0.000      3
  [0.20,0.27)     0.237     0.158     19
  [0.27,0.33)     0.299     0.143     14
  [0.33,0.40)     0.374     0.286      7
  [0.40,0.47)     0.433     0.364     11
  [0.47,0.53)     0.496     0.312     16
  [0.53,0.60)     0.556     1.000      4
  [0.60,0.67)     0.620     0.400     10
  [0.67,0.73)     0.710     0.556      9
  [0.73,0.80)     0.764     0.500     10
  [0.80,0.87)     0.844     0.667     12
  [0.87,0.93)     0.898     0.500     18
  [0.93,1.00)     0.981     0.940     67

### msmarco
n=200  acc=0.6550  ECE=0.1583  Brier=0.4644  NLL=0.6593  mean_conf=0.7742
  conf-bin   mean_conf  accuracy  count
  [0.47,0.53)     0.522     0.800     10
  [0.53,0.60)     0.583     0.417     12
  [0.60,0.67)     0.639     0.706     17
  [0.67,0.73)     0.707     0.452     31
  [0.73,0.80)     0.775     0.525     40
  [0.80,0.87)     0.836     0.696     46
  [0.87,0.93)     0.897     0.862     29
  [0.93,1.00)     0.960     0.933     15

### rule_routing_synth
n=62  acc=1.0000  ECE=0.0007  Brier=0.0000  NLL=0.0007  mean_conf=0.9993
  conf-bin   mean_conf  accuracy  count
  [0.93,1.00)     0.999     1.000     62

Limits and honesty

  • A 4B model: it judges text well and reads rules reasonably, but it cannot do date or money arithmetic and it degrades on multi-thousand-token policy documents.
  • Calibration was measured on the sources above. Check a few hundred of your own labelled examples before trusting a threshold, and route low-confidence cases to a person or a reasoning model.
  • Base model weights: Qwen, Apache-2.0. Adapter and code: MIT.
Downloads last month
44
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for kshetrajna12/reflex-qwen3.5-4b-lora

Finetuned
Qwen/Qwen3.5-4B
Adapter
(1,070)
this model

Space using kshetrajna12/reflex-qwen3.5-4b-lora 1