English | 简体中文 | 🤗 Qev-0.8B | 🤗 Qev-2B | 🤗 Qev-4B | 🤗 Qev-9B | 🤗 Training data
Qev fine-tunes Qwen into a decision model. Give it context, a question, and candidate answers; get a choice and a probability for every option. One model handles Choice, Noul (yes/no), and Score (ordered ratings).
This repository provides the model architecture, training and evaluation code, Python interface, and checkpoint tools. Train on your own examples or load a Qev checkpoint for inference.
| Start here | What you can do |
|---|---|
| Get model weights | Compare Qev-0.8B, Qev-2B, Qev-4B and Qev-9B and find their checkpoint details |
| Run a model | Get decisions and option probabilities through Python or JSONL |
| Train a model | Prepare labelled data, train from Qwen, or fine-tune an existing Qev checkpoint |
| View evaluation | Compare benchmark results across Qev and reference models |
| Choose a model | Qev-0.8B | Qev-2B | Qev-4B | Qev-9B |
|---|---|---|---|---|
| Role | Smallest model, distilled directly from the Qwen base | Compact model with response distillation | Mid-sized model distilled directly from the Qwen base | Largest decision model |
| Get started | 0.8B model weights | 2B model weights | 4B model weights | 9B model weights |
Use Python 3.12. From the repository root, create an environment, install a hardware-compatible PyTorch 2.8.0 build inside it, then install Qev:
python3.12 -m venv .venv
source .venv/bin/activate
# Install the PyTorch 2.8.0 build for your hardware in this environment first.
python -m pip install -e .For development and testing, use python -m pip install -e '.[test]'. You can first check the complete pipeline on CPU without downloading a model:
python scripts/smoke.py --out runs/smokeThis uses a tiny random Qwen to exercise data preparation, training, resume and inference. See the training guide for environment and device details.
Load the model once in your process, then submit requests:
from qev import Qev
# Choose "AustinFu/Qev-0.8B", "AustinFu/Qev-2B", "AustinFu/Qev-4B" or "AustinFu/Qev-9B".
model = Qev.from_pretrained(
"AustinFu/Qev-9B", device="cuda"
)
answers = model.predict({
"state": "I was charged twice. Please help immediately.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {"billing": "Charges and refunds", "shipping": "Delivery problems"},
}
},
})
print(answers["department"]["choice"])
print(answers["department"]["probabilities"])Use noul for a yes/no question and receive P(true). Use score for a rubric and receive its level distribution and expectation. All three tasks · Input/output contract.
When the state keeps growing, such as a conversation or an agent trajectory, open a session. Each appended chunk is computed once on top of the cached state, and all questions of a prediction read that cache together in shared forward passes:
session = model.session("Order 812: the customer reports a duplicate charge.")
session.predict({"human": {"type": "noul", "instructions": "Does this need a human agent?"}})
session.extend("\nAgent: a refund has been issued.")
answers = session.predict({"resolved": {"type": "noul", "instructions": "Is the issue resolved?"}})
session.close() # release the cached stateThe session state is the concatenation of each chunk's tokens; see incremental sessions for tokenization, limits and memory. Questions read the cached state in place, and long states are computed in chunks, so Qev.from_pretrained(..., max_state=50000) serves states far beyond the released 4,096-token limit; the models were trained on states up to 4,096 tokens, and accuracy drops when long unrelated text precedes the state (measurement).
python -m qev.predict \
--checkpoint AustinFu/Qev-9B \
--input examples/requests.jsonl --out runs/predictions.jsonl \
--device cuda --weights-dtype checkpointThe default uses shared-prefix caching. Add --reference for the execution used in the reported evaluation. Output files must be new; precision and length options are in the loading guide.
Recorded Snake and Crafter decision replays from the 9B research models showing action selection and candidate probabilities in the environment. Click either animation for the MP4 version. The recordings retain the research name, BranchKev, in their interface.
Snake · Sequential action selection |
Crafter · Survival and crafting |
Qev organizes inputs as state → question → candidate. Candidate branches read the shared context and produce their own summaries. The set head combines the question and option summaries, using the same scoring function for variable numbers of options. The implementation provides full causal reference execution, prefix caching, and tree execution with branched DeltaNet state.
Architecture and equations · Interactive Chinese decision-head walkthrough
Precision: All Qev sizes use BF16 backbone computation; Kev and JevAny use FP32. Qev's decision head remains in FP32.
Scores (%): accuracy for the original benchmarks; official Decision Index raw scores for GSM8K, ChessBench and BPoMP, with BPoMP averaged across poem variants. Bold marks the best displayed score within the 9B, 4B, 2B and sub-billion groups, including ties. The sub-billion comparison uses Qev-0.8B and NanoJev-0.6B; “—” means not evaluated. Jev is a reference. JevAny uses the standard 4B Pointer release in both this table and the cover. The cover compares Qev-4B, JevAny-4B Pointer, Kev-4B and Jev.
Full evaluation guide: model comparisons, methods, ablations and original results
Training examples use the same state and questions as inference, with a label on each question. Choice labels are candidate IDs, Noul labels are booleans, and Score labels are zero-based level indices. Related records should share a group_id.
| Data | Contents | Entry point |
|---|---|---|
| Included examples | Six training and two validation requests, covering all three tasks | examples/ |
| Qev-train | 2,442 synthetic training examples: alignment, document rules, world knowledge and controlled boundary questions | Dataset and synthesis methods |
| Your data | Labelled or soft-target JSONL requests | Data format |
| 9B research recipe | 38,198 main and 2,883 late records; the full corpus is not bundled | Composition and availability |
python -m qev.prepare \
--input examples/train.jsonl --validation examples/dev.jsonl \
--out data/supportWithout an explicit validation file, the preparer splits by group deterministically. It checks train/dev overlap in IDs, groups and exact inputs. The small included examples demonstrate the workflow; they cannot establish training gains.
On a CUDA GPU, initialize a new domain-training run from a Qev-9B checkpoint:
python -m qev.train \
--config configs/qev-9b-finetune.json \
--data data/support --out runs/support \
--init-checkpoint AustinFu/Qev-9B--init-checkpoint loads model parameters and starts a fresh optimizer and schedule. --resume continues the same run with its original data checks. Omit initialization to start from the Qwen base in the configuration.
The formal four-GPU recipe uses rank 64, global batch 32, two epochs, and a late-training partition. Single-GPU use, distributed training, resume and full fine-tuning are documented in the training guide.
Qev-0.8B starts from Qwen3.5-0.8B-Base and learns the Qev-9B teacher’s option probabilities in one stage. Use the distillation recipe or fine-tune the released model on labelled data. Training method and commands.
Use configs/qev-4b.json to train from the Qwen base with teacher-probability cross entropy, or configs/qev-4b-finetune.json to adapt AustinFu/Qev-4B on labelled data. Training method and commands.
Qev-2B first learns the Qev-9B v0.1.0 teacher's option probabilities with cross entropy. It then learns from programmatic context edits mixed with original-question replay, matching both teacher probabilities and representation changes. See the 2B distillation guide for data preparation, both training stages and the loss equations.
Architecture · Training · 2B distillation · Checkpoints · Data and outputs · Evaluation · Contributing
Run python -m pytest -q and python scripts/check_release.py to check the code and documentation. The validation record lists the actual checks and GPU skips.
Qev builds on Qwen and adapts delimiter, rendering, LoRA-target and cache-fork conventions from Jared Palmer's Kev. Qev code, adaptation weights, documentation and original illustrations use Apache-2.0. Attribution and the licenses for Qwen, Kev, JevBench and external dependencies are listed in third-party notices.
We thank the following projects and author for their work and inspiration:
- Jared Palmer's Kev: thank you for open-sourcing the training data. Qev's training data is primarily sourced from or developed with reference to Kev's released data.
- BranchKev: the research work on candidate-branch encoding, decision heads and training workflows provided the foundation for Qev's standalone release. See NOTICE and code lineage for the code lineage.
- Jev / the TypeSafe team: thank you for advancing decision models and providing public API documentation for typed decisions and probability outputs.
- Archer Hume — Jev’s Architecture Unmasked: thank you for the independent API experiments and architectural analysis, offering useful perspectives on shared-state computation, question isolation and interactions between candidate answers.

