Qwen3.8-27B Decision v0.4
A text decision model trained on a Qwen3.8-27B backbone. It takes a state, a question and 2–255 ordered choices and scores their probabilities in one forward pass. This is an independent reproduction of a Jev-style decision interface. It is not a release from TypeSafe.
Transformers
On a CUDA machine with room for the weights (we used one H100 80 GB), install a CUDA build of PyTorch. Our reference environment used PyTorch 2.13.0, Transformers 5.16.1 and Accelerate 1.14.0.
pip install "transformers==5.16.1" "accelerate==1.14.0" safetensors
import torch
from transformers import AutoModel
model_id = "Ernnnn/Qwen3.8-27B-Decision-v0.4"
model = AutoModel.from_pretrained(
model_id, trust_remote_code=True, dtype=torch.bfloat16,
device_map={"": "cuda:0"}, attn_implementation="sdpa",
)
request = {
"state": "The customer wants to change a flight and has not provided a booking number.",
"question": "What should the agent do next?",
"options": ["Look up the booking", "Ask for the booking number", "Transfer to a human"],
}
for answer in model.decide(**request):
print(answer["option"], f'{answer["probability"]:.2%}')
Look up the booking 0.10%
Ask for the booking number 99.86%
Transfer to a human 0.04%
Each result contains the original zero-based index, option text and probability. A decision accepts one question and 2–255 ordered text options. The model reads the prompt in one pass and applies a softmax over those options. The default limit is 12,288 input tokens. To use the 65,536-token evaluation setting, install a compatible FlashAttention 2 build, load with attn_implementation="flash_attention_2", and pass max_length=65536 to decide. An oversized request raises an error so that all candidates stay intact.
vLLM
For offline batch inference, vLLM can compute the decision-marker representation with its pooling runner. The Transformers processor supplied with this checkpoint formats the prompt and projects that representation through the original FP32 choice weights. All 16 full-attention layers see the whole prompt, while the other 48 layers keep their causal recurrence. Keep prefix caching and chunked prefill off so that later options can influence earlier positions. On five short test requests spanning choice, yes/no and ordered ratings, both backends selected the same answers. The largest per-option probability difference was 0.30 percentage points. The public benchmark scores below were measured with Transformers.
Install vLLM 0.32.0 in a compatible CUDA environment. The following example uses one 80 GB H100 and a 2,048-token limit for short decisions. Run it in a separate process from the Transformers example so each engine has the GPU to itself.
from vllm import LLM
from vllm.config import PoolerConfig
model_id = "Ernnnn/Qwen3.8-27B-Decision-v0.4"
llm = LLM(
model=model_id, runner="pooling", convert="embed", dtype="bfloat16",
hf_overrides={"is_causal": False},
pooler_config=PoolerConfig(pooling_type="LAST", use_activation=False),
enable_prefix_caching=False, enable_chunked_prefill=False,
max_model_len=2048, max_num_batched_tokens=2048, max_num_seqs=4,
gpu_memory_utilization=0.88, enforce_eager=True,
)
from transformers import AutoProcessor
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
options = ["Look up the booking", "Ask for the booking number", "Transfer to a human"]
ids = processor.token_ids(
state="The customer wants to change a flight and has not provided a booking number.",
question="What should the agent do next?", options=options, max_length=2048,
)
pooled = llm.embed([{"prompt_token_ids": ids}])[0]
answers = processor.score_embedding(pooled.outputs.embedding, options)
print(max(answers, key=lambda a: a["probability"])["option"])
# Ask for the booking number
To batch decisions, pass multiple token-ID prompts to embed and score each returned vector against its own options in their original order. Ordinary LLM.generate() and chat completions use causal text generation. The vLLM recipe above uses a complete bidirectional prefill, unnormalized last-token pooling and the checkpoint's decision head.
Training recipe
Data and targets
We fine-tuned Qwen3.8-27B on 1,199,832 decision records. Of these, 999,832 came from the Tasksource decision training split and 200,000 from a mixture spanning knowledge, language, retrieval, tools and arts. The mixture contains repeated inputs. Counting identical states, questions and sets of options as one input gives 1,112,792 distinct inputs. During data preparation, text was shortened in 1,605 overlength Tasksource records and reserved token strings were escaped in seven records. Tasksource dataset revision
| Task | Training records | Records with multiple nonzero targets | Target representation |
|---|---|---|---|
| Choice | 950,008 | 46,171 | One probability per option, in the supplied order |
| Yes/no | 131,670 | 13,212 | Two probabilities in the order false, true |
| Ordered rating | 118,154 | 32,631 | One probability per level, in the supplied scale order |
Each input contains a state, a question and the ordered options. Each option has a position token. A separate decision token follows the final option and the chat-template suffix. The target distribution is supplied only to the loss. In the final mixture, 92,014 records assign positive target mass to more than one option. For example, if a customer wants to reschedule a flight and has not supplied a booking number, an illustrative training target for ["Look up the booking", "Ask for the booking number", "Transfer to a human"] is [0, 1, 0]. A rating can carry a soft target such as [0, 0, 0, 0.7, 0.3].
Decision head and objective
The training head projects the final decision-token representation to 255 candidate positions in FP32. For a question with K options, the softmax and loss use only its first K logits. We compute cross-entropy against the target distribution and average over examples. For one example this takes two PyTorch operations.
log_probs = logits[:num_options].float().log_softmax(dim=-1)
loss = -(target[:num_options] * log_probs).sum()
We made all 16 full-attention layers bidirectional so that earlier state tokens can incorporate the question and options that follow them. The 48 linear-attention layers retain their causal recurrence. The historical causal configuration scored 60.46 on Decision Index Public at 12K, and the released bidirectional configuration scored 65.17. Both used the same training data and principal training settings. The historical score used causal vLLM inference and the released score used bidirectional Transformers inference.
Optimization
| Setting | Value |
|---|---|
| Trainable weights | LoRA on full-attention, linear-attention and MLP projections, plus the 255-row decision head |
| Trainable parameters | 234,761,216 (0.91% of parameters in the training model) |
| LoRA | Rank 32, alpha 64, dropout 0 |
| Precision | Frozen backbone in BF16. Trainable parameters, gradients, Adam moments, soft labels and head projection in FP32 |
| Optimizer and schedule | Fused AdamW, weight decay 0.01, 188 warmup steps to a peak learning rate of 0.0001, then linear decay |
| Batching | Eight H100s with data parallelism, 24 examples per GPU per optimizer update (192 globally). Examples grouped by length, with up to 12,294 padded tokens per microbatch on each GPU |
| Training length | Up to 8,196 input tokens per example, one epoch, 6,250 optimizer steps, seed 42 |
The final training loop took 11 h 17 min, about 90.3 H100 GPU-hours. We selected the one-epoch endpoint in advance and evaluated intermediate checkpoints retrospectively. Decision Index Public at 12K reached 64.43 at step 4,500, 65.16 at step 6,000 and 65.17 at step 6,250. The release merges the final LoRA adapters into the backbone and preserves the FP32 decision readout.
Evaluation
| Benchmark | This model, final | Jev 1.14 public reference |
|---|---|---|
| Decision Index Public (public score, 12K input for this model) | 65.17 | 60.70 |
| JevBench Public (micro accuracy, 231 items) | 88.74% | 87.45% |
| DecisionBench (micro accuracy, 23,900 items, 64K input for this model) | 77.04% | 73.66% |
Reference scores are from the Decision Index public snapshot and JevalKit snapshot. The Decision Index value is the public component. No private Full score is reported. A complete audit of overlap between training data and public benchmarks is pending. On DecisionBench the largest gain was on yes/no decisions; ordinal Score accuracy was lower than the reference.
Deployment
The 12 weight shards total 56.34 GB (52.47 GiB). A 64,308-token forward pass on one H100 80 GB used 65.46 GiB peak allocated and 72.95 GiB peak reserved GPU memory. Online serving capacity and latency depend on batch size, kernels and input length. Start with one concurrent decision and benchmark the intended workload.
Base checkpoint: Qwen/Qwen3.8-27B. The upstream Apache 2.0 license is included. Modifications include decision-token training, bidirectional full-attention layers and merged fine-tuned weights.