Transformers 纳入实验性 JEV 决策头支持
JEV
AI 前沿Copyright 2026 The HuggingFace Team. All rights reserved.
依据 Apache License, Version 2.0(以下简称“许可证”)授权;除非遵守该许可证,否则你不得使用本文件。你可以通过以下网址获取许可证副本:http://www.apache.org/licenses/LICENSE-2.0
除非适用法律要求或有书面约定,按本许可证分发的软件均按“现状”("AS IS")提供,不附带任何明示或默示的保证或条件。有关许可和限制的具体条款,请参阅许可证。
⚠️ 注意,此文件使用 Markdown,但包含我们 doc-builder 的特定语法(类似 MDX),你的 Markdown 查看器可能无法正确渲染。
这个模型于 2026-11-09 贡献给了 Hugging Face Transformers。
JEV
警告
决策模型、
decision流水线和DecisionConfig均处于实验阶段:其 API 可能随时变更,且可能不经弃用通知。
JEV 是一种决策头,它在提示的最后一个 token 位置使用线性层对单 token 标签评分,并像语言模型头的 logits 一样进行软上限处理。它由 JEV 引入,GEV 也使用它。
[JevForDecision] 表示检查点的模型及其头,就像 ForCausalLM 表示模型及其 lm_head 一样。它会读取检查点随其头部提供的文件,这些文件与权重并列放置(对于 vLLM 决策模型是 readout.safetensors 和 decision_config.json;对于 JEV 是 head.safetensors 和 judge_config.json)。
from transformers import pipeline
decide = pipeline("decision", model="autotrust/GEV-26B-Decide")
decide(
{
"state": "I was charged twice for my order and want a refund.",
"questions": {"refund": {"type": "noul", "instructions": "Is a refund requested?"}},
}
)有关图像素材,请参阅决策流水线。
不使用流水线时,决策模型的使用方式类似于 generate:决策配置使用聊天模板为每个问题渲染一个提示(也可以为所有问题渲染一个提示),decide 对每个问题的选项评分,然后 Question.answer 把分数转换成答案:
重要
from_pretrained不会加载存放在子文件夹中的检查点 LoRA(decision_config.adapter,例如 JEV 的adapter/)。流水线会替你加载;不使用流水线时,请像下面这样自行调用load_adapter,否则模型会使用基础权重作答。
import torch
from transformers import AutoTokenizer, JevForDecision
repo = "autotrust/JEV-9B"
model = JevForDecision.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
tokenizer, config = AutoTokenizer.from_pretrained(repo), model.decision_config # read from the checkpoint's files
if config.adapter: # JEV keeps its LoRA in a subfolder: `from_pretrained` doesn't load it, the pipeline does
model.load_adapter(repo, adapter_kwargs={"subfolder": config.adapter})
request = {
"state": "I was charged twice for my order and I want my money back today.",
"questions": {
"refund": {"type": "noul", "instructions": "Does the customer ask for a refund?"},
"urgency": {"type": "score", "criteria": ["Can wait", "This week", "Today", "Now"]},
},
}
answers = {}
for inputs, questions in config.prepare_inputs(request, tokenizer):
scores = model.decide(**inputs, decision_questions=questions)
answers |= {q.name: q.answer(s.softmax(-1).tolist()) for q, s in zip(questions, scores)}同一个头会读取 pplx-decider 和 d3 的 255 个答案编码;它们的 Qwen3.5 主干会关注整个提示(is_causal=False 位于 text_config 中,属于其 JevForDecision)。它们的头(readout.safetensors)和设置(decision_config.json)按原样读取,这些文件与其权重并列放置:
pipeline("decision", model="vllm-sr/d3")(request) # or perplexity-ai/pplx-decider-v1.1-27bJevConfig
[[autodoc]] JevConfig
JevForDecision
[[autodoc]] JevForDecision - forward
来源:Hugging Face Transformers 官方项目 · github.com