Kev: Tiny Jev-like family of decision models built on top of Qwen3.5

Kev: Tiny Jev-like family of decision models built on top of Qwen3.5

Kev: 基于 Qwen3.5 构建的微型 Jev 类决策模型系列

Kev Small Jev-like decision models you can train and run yourself. Kev is a family of small decision models built on Qwen3.5 and based on the architecture described in Jev’s Architecture Unmasked. You can use the pretrained weights or train your own. The API matches TypeSafe’s System One, so you can point their Python SDK at your local server.

Kev 是一系列你可以自行训练和运行的小型决策模型。Kev 基于 Qwen3.5 构建,其架构参考了《Jev’s Architecture Unmasked》一文。你可以使用预训练权重,也可以训练自己的模型。其 API 与 TypeSafe 的 System One 兼容,因此你可以将他们的 Python SDK 指向你的本地服务器。

Highlights 0.8B, 4B, and 9B models, with training code and evaluation data. Yes/no (noul), multiple-choice (choice), and rating (score) questions in the same request. Questions share the input text but can’t read each other. Runs on CUDA, ROCm, and Apple Silicon. The 4B and 9B models fit a 32 GB Mac using bf16; see Serving Performance for what to expect on a Mac.

亮点包括 0.8B、4B 和 9B 模型,并附带训练代码和评估数据。支持在同一请求中处理是非题(noul)、多选题(choice)和评分题(score)。问题共享输入文本,但彼此独立。支持在 CUDA、ROCm 和 Apple Silicon 上运行。4B 和 9B 模型在使用 bf16 时可适配 32GB 内存的 Mac;有关 Mac 上的性能表现,请参阅“Serving Performance”。

A web playground for trying your own inputs and checking how option order affects the answers. Or try Kev-4B and Kev-0.8B in the browser at huggingface.co/spaces/jaredpalmer/kev, no install needed.

提供了一个 Web 演练场,用于测试你的输入并查看选项顺序如何影响答案。或者,你也可以直接在浏览器中访问 huggingface.co/spaces/jaredpalmer/kev 试用 Kev-4B 和 Kev-0.8B,无需安装。

Quick Start

快速开始

You’ll need Python 3.12+ and uv. 你需要 Python 3.12+ 和 uv。

git clone https://github.com/jaredpalmer/kev.git && cd kev
uv sync --extra serve
KEV_DTYPE=bf16 uv run --extra serve python -m kev.serve --run jaredpalmer/kev-4b --port 8009

This starts Kev-4B locally. The first run downloads the adapter and base model. —run also accepts a local checkpoint directory or a Hub revision, such as jaredpalmer/kev-4b@qwen3 for the previous generation.

这将启动本地的 Kev-4B。首次运行时会下载适配器和基础模型。--run 参数也接受本地检查点目录或 Hub 版本号,例如 jaredpalmer/kev-4b@qwen3(用于上一代模型)。

In another terminal, send it a ticket: 在另一个终端中,发送一个工单:

curl -s localhost:8009/v1/systemone -H 'content-type: application/json' -d '{ "state": "Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card.", "model": "kev-latest", "questions": { "department": {"type": "choice", "instructions": "Which team should handle this?", "criteria": {"returns": "Exchanges, refunds, wrong or damaged items", "shipping": "Delivery status, delays, lost packages", "billing": "Charges, invoices, payment problems"}}, "escalate": {"type": "noul", "instructions": "Does this need urgent human attention?"}, "frustration": {"type": "score", "instructions": "How frustrated is the customer?", "criteria": ["Calm", "Frustrated", "Very angry"]} }}'

Example response from Kev-4B, running in bf16 on an Apple M5: 以下是 Kev-4B 在 Apple M5 上以 bf16 运行的响应示例:

{
  "model": "kev-latest",
  "answers": {
    "department": { "type": "choice", "choice": "returns", "confidence": 0.21, "probabilities": { "returns": 0.47, "shipping": 0.28, "billing": 0.25 } },
    "escalate": { "type": "noul", "noul": 0.93 },
    "frustration": { "type": "score", "score": 1.44, "confidence": 0.78, "legend": { "0": "Calm", "1": "Frustrated", "2": "Very angry" }, "probabilities": { "0": 0.00, "1": 0.56, "2": 0.44 } }
  },
  "usage": { "input_tokens": 101, "output_tokens": 161 },
  "latency_ms": 495
}

The ticket mentions a return, a late delivery, and a billing problem, and the department probabilities say so. That is the point of getting probabilities back instead of a single label. 该工单提到了退货、延迟送达和账单问题,部门概率分布也反映了这一点。这就是获取概率分布而非单一标签的意义所在。

Python

Python 使用

The TypeSafe SDK is included in uv sync --extra serve: TypeSafe SDK 已包含在 uv sync --extra serve 中:

from typesafe_sdk import Choice, Noul, Score, TypeSafeClient

client = TypeSafeClient(
    api_key="local",
    base_url="http://127.0.0.1:8009",
    model="kev-latest",
)

response = client.system_one(
    state="I was charged twice. Please fix this ASAP.",
    questions={
        "billing": Noul(instructions="Is this ticket about billing?"),
        "tone": Choice(
            instructions="What is the customer's tone?",
            criteria={"calm": None, "frustrated": None, "angry": None},
        ),
        "urgency": Score(
            instructions="How urgent is this ticket?",
            criteria=["can wait", "this week", "today"],
        ),
    },
)

print(response.nouls["billing"].noul)
print(response.choices["tone"].choice)
print(response.scores["urgency"].score)

Playground

演练场

With the server still running, open another terminal. You’ll need Node 20.9+: 保持服务器运行,打开另一个终端。你需要 Node 20.9+:

cd playground
npm install
npm run dev -- -p 3001

Open localhost:3001, load a preset, and edit the text and questions. Press ⌘↵ to run it. “Packed vs separate” compares asking all questions at once with asking them one at a time. “Permute” runs a Choice question with six option orders. There are also presets for testing question isolation and fake delimiter tokens. There’s a chess demo, too. The board is the input, legal moves are Choice options, and a Score question rates the position. You can play against Kev or let it play itself. Games are saved in localStorage.

打开 localhost:3001,加载预设,编辑文本和问题。按 ⌘↵ 运行。“Packed vs separate”用于对比一次性提问与逐个提问的区别。“Permute”以六种选项顺序运行选择题。此外还有用于测试问题隔离和伪分隔符标记的预设。还有一个国际象棋演示:棋盘作为输入,合法走法作为选择题选项,评分题用于评估局面。你可以与 Kev 对弈,也可以让它自己下。游戏进度保存在 localStorage 中。

Models

模型

Start with Kev-4B. Use Kev-9B when accuracy and calibration matter more than memory. Use Kev-0.8B if you need the smallest model. All three are built on Qwen3.5 bases with the same training data and settings.

建议从 Kev-4B 开始。当准确性和校准比内存更重要时,请使用 Kev-9B。如果你需要最小的模型,请使用 Kev-0.8B。这三款模型均基于 Qwen3.5,并使用相同的训练数据和设置。

(Table omitted for brevity, please refer to original article for detailed metrics)

Each cell is development / test. “Trained sources” means held-out examples from the datasets used to train Kev. “New sources” means datasets and policy rule types Kev wasn’t trained on. Every model was evaluated on the same development sets (decision-v7, transfer-v4) and the same test sets, which were read once per released checkpoint, after model selection. Lower Brier is better.

每个单元格显示的是开发集/测试集数据。“Trained sources”指 Kev 训练数据集中预留的样本。“New sources”指 Kev 未经训练的数据集和策略规则类型。每个模型都在相同的开发集(decision-v7, transfer-v4)和测试集上进行了评估,测试集在模型选择后,每个发布的检查点仅读取一次。Brier 分数越低越好。

Kev-9B trails Jev by 3.5 points on the new-source development set (0.822 vs 0.857) and scores 0.852 on the test set, which Jev hasn’t been run on. We don’t know which datasets Jev was trained on, so this isn’t a controlled comparison of the two architectures.

Kev-9B 在新来源开发集上比 Jev 落后 3.5 个百分点(0.822 对 0.857),在测试集上得分为 0.852(Jev 未在该测试集上运行)。由于我们不知道 Jev 的训练数据集,因此这并非两种架构之间的受控对比。

All three models were updated on 2026-09-21 with a short second training pass on generated examples: policy cases with explicit day counts, and cases whose deciding evidence was removed, trained toward a uniform answer. On the test set this moved Kev-9B from 0.837 to 0.852 (95% CI +0.8 to +2.9 points), Kev-4B from 0.832 to 0.837, and Kev-0.8B from 0.668 to 0.684. The previous weights are at revision v7-base. Details and costs are in the model cards and PLAN.md. Probabilities are calibrated by default. Each checkpoint stores a temperature (about 2.1–2.4) fitt

这三款模型均于 2026 年 9 月 21 日进行了更新,通过对生成样本的简短二次训练:包括带有明确天数计数的策略案例,以及移除了决定性证据的案例,并向统一答案进行训练。在测试集上,Kev-9B 从 0.837 提升至 0.852(95% 置信区间 +0.8 至 +2.9 个百分点),Kev-4B 从 0.832 提升至 0.837,Kev-0.8B 从 0.668 提升至 0.684。之前的权重位于 v7-base 版本。详细信息和成本请参阅模型卡和 PLAN.md。概率默认经过校准。每个检查点都存储了一个温度值(约 2.1–2.4)…