Image-Text-to-Text
Transformers
Safetensors
English
Chinese
qwen3_5
qwen3.5
decision-model
structured-prediction
text-classification
conversational
Instructions to use PelaAI/KnowLine-0.8B-Gen1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PelaAI/KnowLine-0.8B-Gen1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="PelaAI/KnowLine-0.8B-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-0.8B-Gen1") model = AutoModelForMultimodalLM.from_pretrained("PelaAI/KnowLine-0.8B-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-0.8B-Gen1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PelaAI/KnowLine-0.8B-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-0.8B-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-0.8B-Gen1
- SGLang
How to use PelaAI/KnowLine-0.8B-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-0.8B-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-0.8B-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-0.8B-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-0.8B-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-0.8B-Gen1 with Docker Model Runner:
docker model run hf.co/PelaAI/KnowLine-0.8B-Gen1
File size: 7,366 Bytes
01952e5 6f35883 01952e5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ---
license: apache-2.0
library_name: transformers
base_model: Qwen/Qwen3.5-0.8B
base_model_relation: finetune
pipeline_tag: image-text-to-text
language:
- en
- zh
---
# KnowLine-0.8B-Gen1
[推理说明](INFERENCE.md) · [English](README.md) · 权重 Apache-2.0 · 同时发布:[KnowLine-2B-Gen1](https://huggingface.co/PelaAI/KnowLine-2B-Gen1) · 同系列:[KnowLine-9B-Gen1](https://huggingface.co/PelaAI/KnowLine-9B-Gen1)、[KnowLine-4B-Gen5.5](https://huggingface.co/PelaAI/KnowLine-4B-Gen5.5)
KnowLine-0.8B-Gen1 是基于 Qwen3.5-0.8B 的 0.8B 决策模型:输入结构化的状态和一道或多道有类型的问题(选择题、是否题、有序打分题),输出各选项的概率。它直接读取各选项标签的概率,作答时不生成自由文本。KnowLine 由 PelaAI 团队开发。
亮点:
- **Decision Index 0.3 公开套件:44.51**(自测,用本仓库的文件全新完整运行,读两遍;140,178 个可评分请求全部作答,无错误)。榜单的完整分来自维护者的私有运行,本模型尚未评出。
- **小而快:** 单张 H20、一次一个请求,中位数 24.6 ms、平均 39.6 ms。
- **其他公开基准:** C-Eval 56.3,JevBench / JevBench 难题集 71.9 / 49.5,见[评测](#评测)。
- **校准过的概率:** 权重里折入了读出温度 T = 1.54(在留出数据上拟合)。按榜单的方法在公开套件上计算,ECE 为 0.008-0.012。
- **S1MB(English v1,本地运行):** 137 个基准上 Task Avg 34.17(26,269 个判断,无失败、无弃答)。
## 它做什么
- 带命名选项的选择题;
- 是否题;
- 有序打分题;
- 读出温度折入语言模型的 norm,前端按温度 1 读取;
- 短的纯文本请求读两遍(单遍不超过 3,000 token)。
## 快速开始
安装带 CUDA 的 PyTorch、`transformers` 和 SGLang 0.5.21,然后启动仓库里的前端:
```bash
bash serve_knowline.sh /path/to/KnowLine-0.8B-Gen1 0 8080
```
前端提供 `/v1/systemone` 接口,请求示例见[英文说明](README.md#quickstart)。
- **前端:** `knowline_server.py`、`knowline_engine.py` 和 `knowline_layout.py` 实现了下文所有结果所用的打分前端;`temperatures.json` 要和 `serve_knowline.sh` 放在一起。
- **关闭思考:** 前端渲染提示词时关闭思考(`enable_thinking=False`)。本仓库附带的 Qwen3.5-0.8B 对话模板默认开启思考,自己拼提示词时请传 `enable_thinking=False`。
- **完整设置:** 见 [INFERENCE.md](INFERENCE.md)。
## Gen1 是怎么做出来的
- **底座模型:** [Qwen/Qwen3.5-0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B)。
- **训练:** LoRA 监督微调一个 epoch(rank 32,alpha 64,只训语言模型的线性层),合并为 bf16 权重,每行最多 12,288 token。发布的是训练终点的权重。训练样例包含由 LLM 教师模型编写并标注的决策任务。
- **读出温度:** T = 1.54,在留出数据上拟合后折入 `model.language_model.norm.weight`(见 `CALIBRATION.json`)。`temperatures.json` 把打分题的 logit 除以 0.6494(= 1/1.54),所以打分题按等效温度 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-0.8B-Gen1** | 0.8B | **44.51** | 尚未评出 | 自测,官方工具 |
| GLiClass v4 edge (0.4B) | 0.4B | 47.49 | 31.21 | 榜单 |
| OneJev1.6-0.8B | 0.9B | 48.76 | 29.58 | 榜单 |
| crystal-0.8b | 0.9B | 42.79 | 29.37 | 榜单 |
| vLLM-SR vela3-fast (0.4B) | 0.4B | 50.36 | 29.27 | 榜单 |
| StartLux-Decision v1.1 0.8B | 0.9B | 53.79 | 28.88 | 榜单 |
## 评测
### Decision Index 0.3 完整公开套件
2026-10-29 用本仓库的文件测得(bf16,读两遍):
| 项目 | 结果 |
|---|---:|
| 公开 Decision Index | **44.51** |
| 公开原始指数 | 58.35 |
| 请求数 / 可评分请求数 | 140,620 / 140,178 |
| 可评分作答 / 错误 / 不支持 | 140,178 / 0 / 0 |
| 一次一个请求:中位数 / 平均 / 第 95 百分位 | 24.6 / 39.6 / 117.3 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 `b76c79d4` 运行 S1MB English v1 类别(评测器 `9ad06fea`,数据集 `10bcb8c6`,运行 ID `knowline-08b-gen1-en-20261029-001`):137 个基准、18,701 个案例、26,269 个判断,无失败、无弃答。Task Avg 34.17(选择题 47.2,是否题 37.1,打分题 18.3)。这是评测器的任务平均分,不是 Borda 排名或榜单名次。
### 校准
按 Decision Index 榜单描述的方法在 0.3 公开套件上计算(各基准等权,置信度 = 所选选项的概率,10 个等宽分箱);榜单没有公布具体用哪些基准,所以给出合理基准集合上的范围。
| 指标 | KnowLine-0.8B-Gen1 |
|---|---:|
| ECE(越低越好) | 0.008-0.012 |
| Brier 分数(越低越好) | 0.41-0.43 |
| 置信度 ≥ 95% 却答错 | 0.3% |
| 平均置信度 / 准确率 | 0.66-0.67 / 0.66-0.68 |
- **建议:** 如果你的用法依赖概率阈值,请在自己的数据上检查校准。
## 披露
- **去污染:** 训练前对完整训练文件做了标准和严格两种去污染,针对 Decision Index 公开套件和我们报告的公开基准。这不排除底座模型预训练阶段接触过相关数据。
- **公开套件:** Decision Index 公开套件是公开的;榜单的私有测试分数可能更低。
## 局限
- **小模型:** 0.8B 模型在知识和推理较重的问题上明显低于我们更大的模型(例如 C-Eval 56.3、JevBench 难题集 49.5)。
- **植入的指令:** 请把不可信的内容放在状态的数据字段里,不要拼进指令,并清楚地隔开;输入中植入的指令可能影响模型的答案。
- **校准:** 概率在平均意义上是校准的,并非在每个领域都如此;请在自己的数据上检查。
- **图片:** 没有图片训练,图片用法是零样本的。
- **思考模式:** 请使用仓库里的前端或传 `enable_thinking=False`;按对话模板的默认设置,模型会进入训练中没有用过的思考模式。
- **长请求:** 受模型和推理服务的上下文长度限制;前端不会截断请求。
- **不是聊天助手:** 它是结构化的决策读出模型。
## 许可
权重和代码按 Apache 2.0 发布。`SHA256SUMS` 覆盖本仓库的所有文件。Qwen3.5-0.8B 底座模型仍受其自身许可和条款约束。
## 引用
见[英文说明](README.md#citation)。
|