HuggingFace镜像/d1-2B
模型介绍
文件和版本
分析
Liquid AI
API 试用 文档 博客

d1-2B

d1-2B 是一个面向文本、图像和视频的决策模型,基于 LFM3-VL-2B 构建。它通过单次前向传播即可返回校准后的答案,无需生成 token。

  • 同类最优: 在开源 d1 模型中,它在平均表现及我们超过一百项决策基准测试的评测板上均名列前茅,以不足 d1-3B 三分之二的参数量超越了后者。
  • 超越分类: 它还能提取文本、数字和日期及其对应跨度,定位图像中的物体,并以区间形式估算数量。
  • 毫秒级决策: 在 NVIDIA H100 上每次决策仅需 5.7 ms,在 AMD MI325X 上仅需 3.8 ms,且单次调用可对同一状态提出任意数量的问题。

有关开源 d1 的更多信息,请查阅我们的发布博客。

模型详情


LFM3 系列包含基座模型、文本模型、视觉模型、音频模型、全模态模型和决策模型。d1-2B 面向文本、图像和视频进行决策,d1-Omni-2B 则额外支持音频。

属性规格
检查点后训练决策模型,基于 LFM3-VL-2B 构建
参数量1.92B
架构LFM3 主干网络,24 层:13 层门控短卷积、5 层滑动窗口注意力、6 层全局注意力
上下文长度128K tokens
词表大小128,000 tokens
输入一个状态(文本或 JSON)、图片或视频,以及任意数量的命名问题
输出带概率的类型化答案,无生成 token
支持语言英语、阿拉伯语、中文、法语、德语、意大利语、日语、韩语、葡萄牙语、西班牙语、越南语、泰语、印尼语、印地语、俄语、波兰语
许可证LFM Open License v1.0

d1-2B 适用于任何需要决策的流水线环节:路由与分诊、审核与安全护栏、意图与主题分类、文档与表单信息提取、评判与重排序、视觉检测等。它不是聊天模型。

知识密集型问题更适合使用更大的模型,且当状态超过约 64K tokens 时,答案的可靠性会下降。对于计数和评分类任务,估算结果较为可靠;对于自由量估算,可靠性则稍低。

推理


d1-2B 基于 Transformers 运行,使用其专属的模型代码。它通过单次前向传播即可读取答案,因此无需设置任何采样参数。

Transformers 快速上手:

pip install "transformers>=5.19" torch torchvision pillow
import torch
from transformers import AutoModel

device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
dtype = torch.float32 if device == "cpu" else torch.bfloat16
model = AutoModel.from_pretrained("LiquidAI/d1-2B", trust_remote_code=True, dtype=dtype).to(device)

# Several named questions over one state, answered in one pass
questions = {
    "refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"},  # yes/no: P(yes)
    "team": {"type": "choice", "instructions": "Which team should handle this?",
             "criteria": {"billing": "Charges, refunds, invoices", "shipping": "Delivery and parcels",
                          "technical": "App or site faults"}},
    "topics": {"type": "choice", "multiple": True, "instructions": "Which topics does the message raise?",
               "criteria": {"billing": "Payments and charges", "delivery": "Shipping and parcels",
                            "login": "Signing in to the account"}},
    "urgency": {"type": "score", "instructions": "How urgent is this ticket?", "criteria": ["low", "medium", "high"]},
}
out = model.system_one("I was charged twice and my parcel never arrived. Please refund one charge.", questions)
a = out["answers"]
urgency = a["urgency"]["legend"][str(int(a["urgency"]["score"]))]
print(round(a["refund"]["noul"], 2), a["team"]["choice"], a["topics"]["choices"], urgency)
# 1.0 billing ['billing', 'delivery'] medium
文档中的值
invoice = "ACME SA\nInvoice 2026-117\nTotal due: 1 234,50 EUR\nPay before 03/04/2026 (day/month/year)"
out = model.system_one(invoice, {
    "payee": {"type": "text", "instructions": "Who issued the invoice?"},
    "total": {"type": "number", "instructions": "How much is due?"},
    "due": {"type": "date", "instructions": "By when must it be paid?"},
    "vat": {"type": "number", "instructions": "How much VAT is charged?"},
})
a = out["answers"]
print(a["payee"]["text"], a["total"]["number"], a["due"]["date"], a["vat"]["number"])
# ACME SA 1234.5 2026-04-03 None
图片与边界框

统计数量、定位单个对象,或列出所有实例(max 最多读取该数量):

from transformers.image_utils import load_image

image = load_image("http://images.cocodataset.org/val2017/000000039769.jpg")  # two cats on a sofa
out = model.system_one(None, {
    "cats": {"type": "number", "instructions": "How many cats are there?", "range": [0, 10], "step": 1},
    "remote": {"type": "box", "instructions": "Where is the remote control on the left?"},
    "every_cat": {"type": "boxes", "instructions": "Every cat.", "max": 4},
}, media=[image])
a = out["answers"]
print(a["cats"]["number"], a["every_cat"]["count"], {k: round(v, 2) for k, v in a["remote"]["box"].items()})
# 2.0 2 {'top': 0.15, 'bottom': 0.24, 'left': 0.06, 'right': 0.28}
一次调用发出多个请求
tickets = ["Where is my parcel? It was due Monday.", "The app crashes when I open settings."]
for out in model.system_one_batch([(t, {"team": questions["team"]}) for t in tickets]):
    print(out["answers"]["team"]["choice"])
# shipping
# technical
调用方式
调用功能说明
system_one(state, questions, media=None)对单个状态一次性提出多个命名问题。media 可包含图片(PIL 图像或 {"type": "image", "path": ...})和视频帧序列({"type": "video", "video": [PIL images], "fps": 24})。
system_one_batch([(state, questions[, media]), ...])单次调用批量处理多个请求。
set_size=(适用于以上任一调用)设定每次与状态一同读取的问题数量。默认值为模型的训练大小(16)。增大该值可提升速度,但会略微降低文本类问题的精度。

状态可以是字符串、任意 JSON 值,或者当媒体本身即为完整状态时的 None。每次调用返回 {"answers": {name: answer}, "usage": {"input_tokens": n, "output_tokens": 0}}。

问题类型
type问题描述返回字段
noul是或否noul:P(yes)
choice从 criteria 指定的选项({name: description})中选择一个choice、confidence、probabilities
choice 配合 multiple: true从 criteria 指定的选项中选多个choices、probabilities(每个选项各自的 P(yes))
score2 到 10 个有序等级,criteria 从最低到最高依次列出score(中位数等级)、confidence、probabilities、legend
text、number、date从状态中读取一个值对应类型的字段(数值附带 unit,日期为 ISO 8601 格式)、span、found
number 配合 range估算值,步长为 stepnumber(中位数)、interval(p10, p90)
box、boxes单张图片中的一个对象,或所有实例(最多 16 个,或由 max 指定上限)box(top、bottom、left、right 为相对于图片的分数)、found、confidence,或 boxes 与 count

当 found 低于 0.5 时,视为值或框不存在,此时返回 None。请在自身业务数据上校准任何决策阈值。

性能


基准测试

d1-2B 在我们内部的决策基准测试中,平均分和大多数单项基准测试中均领先于其他开源 d1 系列模型,以不到 d1-3B 三分之二的参数量超越后者。

基准测试d1
2B
d1-omni
600M
d1-Omni
2B
d1
3B
决策
Decision Index 公开测试套件(v0.3)51.118.349.049.0
DecisionBench (Hanno Labs) v177.158.776.473.1
Decision Bench (decisionbench.ai) v485.257.984.783.6
Fast Decisions58.8–56.859.3
JevBench v1.4.177.958.075.376.2
ImajevBench v2.0-lite75.521.772.364.0
WorkflowEvals81.648.877.174.4
Typed Decisions61.357.563.165.0
我们内部的测试板(涵盖一百余项公开与私有基准测试)63.2–61.858.8
视觉
AI2D76.737.171.579.9
BLINK66.237.763.559.2
CountQA51.426.845.442.6
CV-Bench86.140.884.082.1
ERQA45.827.342.539.8
HallusionBench72.152.667.565.3
MMBench87.954.285.284.9
MME85.461.083.982.1
MMMU-Pro26.411.924.118.5
MMRB254.248.352.649.5
MMStar67.531.961.359.9
MMVP82.754.081.377.0
NaturalBench81.558.880.079.8
POPE88.782.789.988.6
V*76.435.676.473.8
VisualPuzzles29.926.226.929.5
VisualWebBench96.214.988.671.4
VL-RewardBench69.348.168.865.0
平均70.242.867.765.4
评估详情

四个模型均在相同的评测项上使用相同的评分标准,因此 d1-3B 和 d1-omni-600M 的部分数值与其各自模型卡片上的略有差异。d1-omni-600M 没有 Fast Decisions 和 board 分数。Average 是四个模型均有的公开基准的无权重平均值,因此不包含 Fast Decisions 和我们的 board。图像基准按每个基准选项上的决策来读取,每个基准最多 1,000 行。其中三个已饱和:POPE、MME 和 VisualWebBench。

速度

在 H100 和 M5 Pro 上,使用 bf16 精度,model.compile() 后的热调用,取 20 次调用的中位数,三次运行中取最优。首次调用时编译大约需要一分钟。

硬件单问题3 个问题5K token 状态384 px 图片单个框多个框单次调用 64 个状态
NVIDIA H100 PCIe5.7 ms7.6 ms52 ms12.3 ms16.1 ms24.4 ms1,132 / s
AMD MI325X3.8 ms5.6 ms44 ms8.7 ms11.2 ms16.5 ms1,699 / s
Apple M5 Pro (mps)18.6 ms26.5 ms753 ms45.2 ms53.5 ms100 ms109 / s

引用


@article{liquidAI2026opend1,
  author  = {Liquid AI},
  title   = {Open d1: Edge decision models for text, vision, and audio},
  journal = {Liquid AI Blog},
  year    = {2026},
  note    = {https://www.liquid.ai/blog/open-d1},
}
@article{liquidAI2026LFM3,
  author  = {Liquid AI},
  title   = {Introducing LFM3: Every Modality for Specialized Intelligence},
  journal = {Liquid AI Blog},
  year    = {2026},
  note    = {https://www.liquid.ai/blog/lfm3},
}

如有问题或反馈,请加入 Discord。如需自定义部署和微调支持,请联系 Liquid AI。