Instructions to use PelaAI/KnowLine-2B-Gen1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PelaAI/KnowLine-2B-Gen1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="PelaAI/KnowLine-2B-Gen1") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("PelaAI/KnowLine-2B-Gen1") model = AutoModelForMultimodalLM.from_pretrained("PelaAI/KnowLine-2B-Gen1", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PelaAI/KnowLine-2B-Gen1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PelaAI/KnowLine-2B-Gen1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PelaAI/KnowLine-2B-Gen1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/PelaAI/KnowLine-2B-Gen1
- SGLang
How to use PelaAI/KnowLine-2B-Gen1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "PelaAI/KnowLine-2B-Gen1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PelaAI/KnowLine-2B-Gen1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "PelaAI/KnowLine-2B-Gen1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PelaAI/KnowLine-2B-Gen1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use PelaAI/KnowLine-2B-Gen1 with Docker Model Runner:
docker model run hf.co/PelaAI/KnowLine-2B-Gen1
Download README.zh.md from PelaAI/KnowLine-2B-Gen1: direct link, hf CLI and curl.
- Browser
- Download file 7.28 kB
-
https://huggingface.co/PelaAI/KnowLine-2B-Gen1/resolve/main/README.zh.md
- Command line
-
hf download hf://PelaAI/KnowLine-2B-Gen1/README.zh.md
-
curl -L -o README.zh.md https://huggingface.co/PelaAI/KnowLine-2B-Gen1/resolve/main/README.zh.md
license: apache-2.0
library_name: transformers
base_model: Qwen/Qwen3.5-2B
base_model_relation: finetune
pipeline_tag: image-text-to-text
language:
- en
- zh
KnowLine-2B-Gen1
推理说明 · English · 权重 Apache-2.0 · 同时发布:KnowLine-0.8B-Gen1 · 同系列:KnowLine-9B-Gen1、KnowLine-4B-Gen5.5
KnowLine-2B-Gen1 是基于 Qwen3.5-2B 的 2B 决策模型:输入结构化的状态和一道或多道有类型的问题(选择题、是否题、有序打分题),输出各选项的概率。它直接读取各选项标签的概率,作答时不生成自由文本。KnowLine 由 PelaAI 开发。
亮点:
- Decision Index 0.3 公开套件:52.23(自测,用本仓库的文件全新完整运行,读两遍;140,178 个可评分请求全部作答,无错误)。榜单的完整分来自维护者的私有运行,本模型尚未评出。
- 小而快: 单张 H20、一次一个请求,中位数 30.0 ms、平均 60.6 ms。
- 其他公开评测: C-Eval 67.0,JevBench / JevBench 难题集 77.5 / 55.9,见评测。
- 校准过的概率: 权重里折入了读出温度 T = 1.32(在留出数据上拟合)。按榜单的方法在公开套件上计算,ECE 为 0.016-0.025。
- S1MB(English v1,本地运行): 137 个基准上 Task Avg 44.85(26,269 个判断,无失败、无弃答)。
它做什么
- 带命名选项的选择题;
- 是否题;
- 有序打分题;
- 读出温度折入语言模型的 norm,前端按温度 1 读取;
- 短的纯文本请求读两遍(单遍不超过 3,000 token)。
快速开始
安装带 CUDA 的 PyTorch、transformers 和 SGLang 0.5.21,然后启动仓库里的前端:
bash serve_knowline.sh /path/to/KnowLine-2B-Gen1 0 8080
前端提供 /v1/systemone 接口,请求示例见英文说明。
- 前端:
knowline_server.py、knowline_engine.py和knowline_layout.py实现了下文所有结果所用的打分前端;temperatures.json要和serve_knowline.sh放在一起。 - 关闭思考: 前端渲染提示词时关闭思考(
enable_thinking=False)。本仓库附带的 Qwen3.5-2B 对话模板默认开启思考,自己拼提示词时请传enable_thinking=False。 - 完整设置: 见 INFERENCE.md。
Gen1 是怎么做出来的
- 底座模型: Qwen/Qwen3.5-2B。
- 训练: LoRA 监督微调一个 epoch(rank 32,alpha 64,只训语言模型的线性层),合并为 bf16 权重,每行最多 12,288 token。发布的是训练终点的权重。训练样本包括由大语言模型教师编写并标注的决策任务。
- 读出温度: T = 1.32,在留出数据上拟合后折入
model.language_model.norm.weight(见CALIBRATION.json)。temperatures.json把打分题的 logit 除以 0.7576(= 1/1.32),所以打分题按等效温度 1.0 读出。 - 图片: 没有图片训练,视觉塔是底座模型的。
训练数据不在本仓库中。
横向对比
规模相近的榜单条目,取自 Decision Index 榜单快照 multimodalart/jev-decision-index @ c130faf6 (data generated 2026-10-29 14:04 UTC)。DI 0.4.1 完整分来自维护者的私有运行。
| 模型 | 规模 | DI 0.3 公开 | DI 0.4.1 完整 | 来源 |
|---|---|---|---|---|
| KnowLine-2B-Gen1 | 2B | 52.23 | 尚未评出 | 自测,官方工具 |
| StartLux-Decision v1.1 2B | 2.3B | 59.23 | 40.11 | 榜单 |
| baselabs joey-1 (2B) | 2.7B | 63.30 | 35.91 | 榜单 |
| Jev-Style 2B v4 | 2.2B | 44.37 | 34.53 | 榜单 |
| Sieve 2B v3 | 2.3B | 53.51 | 34.45 | 榜单 |
评测
Decision Index 0.3 完整公开套件
2026-10-29 用本仓库的文件测得(bf16,读两遍):
| 项目 | 结果 |
|---|---|
| 公开 Decision Index | 52.23 |
| 公开原始指数 | 64.24 |
| 请求数 / 可评分请求数 | 140,620 / 140,178 |
| 可评分作答 / 错误 / 不支持 | 140,178 / 0 / 0 |
| 一次一个请求:中位数 / 平均 / 第 95 百分位 | 30.0 / 60.6 / 214.9 ms |
- 怎么跑的: 用官方工具(commit
62d2f51)全新运行 0.3 公开套件,请求发到用serve_knowline.sh启动的四台相同 H20 服务,客户端 32 个分片。没有请求需要重试,没有输入被截断。 - 硬件: 以上是 H20 上的测量,不是榜单的参考硬件。
其他公开评测
本次发布的两个模型,同样的文件和推理方式:
| 评测 | 2B-Gen1 | 0.8B-Gen1 |
|---|---|---|
| C-Eval(4 个大类,宏平均) | 67.0 | 56.3 |
| JevBench / JevBench 难题集 | 77.5 / 55.9 | 71.9 / 49.5 |
S1MB(English v1)
在本地对本仓库 commit 9f3cde88 运行 S1MB English v1 类别(评测器 9ad06fea,数据集 10bcb8c6,运行 ID knowline-2b-gen1-en-20261029-001):137 个基准、18,701 个案例、26,269 个判断,无失败、无弃答。Task Avg 44.85(选择题 57.4,是否题 48.4,打分题 28.7)。这是评测器的任务平均分,不是 Borda 排名或榜单名次。
校准
按 Decision Index 榜单描述的方法在 0.3 公开套件上计算(各基准等权,置信度 = 所选选项的概率,10 个等宽分箱);榜单没有公布具体用哪些基准,所以给出合理基准集合上的范围。
| 指标 | KnowLine-2B-Gen1 |
|---|---|
| ECE(越低越好) | 0.016-0.025 |
| Brier 分数(越低越好) | 0.36-0.38 |
| 置信度 ≥ 95% 却答错 | 0.6-0.7% |
| 平均置信度 / 准确率 | 0.73-0.74 / 0.70-0.72 |
- 建议: 如果你的用法依赖概率阈值,请在自己的数据上检查校准。
披露
- 去污染: 训练前对完整训练文件做了标准和严格两种去污染,针对 Decision Index 公开套件和我们报告的公开基准。这不排除底座模型预训练阶段接触过相关数据。
- 公开套件: Decision Index 公开套件是公开的;榜单的私有测试分数可能更低。
局限
- 小模型: 2B 模型在知识和推理较重的问题上明显低于我们更大的模型(例如 C-Eval 67.0、JevBench 难题集 55.9)。
- 植入的指令: 请把不可信的内容放在状态的数据字段里,不要拼进指令,并清楚地隔开;输入中植入的指令可能影响模型的答案。
- 校准: 概率在平均意义上是校准的,并非在每个领域都如此;请在自己的数据上检查。
- 图片: 没有图片训练,图片用法是零样本的。
- 思考模式: 请使用仓库里的前端或传
enable_thinking=False;按对话模板的默认设置,模型会进入训练中没有用过的思考模式。 - 长请求: 受模型和推理服务的上下文长度限制;前端不会截断请求。
- 不是聊天助手: 它是结构化的决策读出模型。
许可
权重和代码按 Apache 2.0 发布。SHA256SUMS 覆盖本仓库的所有文件。Qwen3.5-2B 底座模型仍受其自身许可和条款约束。
引用
见英文说明。