Bitnet
微软官方 1-bit LLM 推理框架,在 CPU 上运行 1.58-bit 量化大语言模型,速度提升 1.4-6x、能耗降低 55-82%,单 CPU 可运行 100B 参数模型,达到人类阅读速度 Skill: Bitnet Owner: cn-big-cabbage Summary: 微软官方 1-bit LLM 推理框架,在 CPU 上运行 1.58-bit 量化大语言模型,速度提升 1.4-6x、能耗降低 55-82%,单 CPU 可运行 100B 参数模型,达到人类阅读速度 Tags: latest:0.1.1 Version history: v0.1.1 | 2026-06-16T10:09:06.774Z | auto - Update to version 0.1.1 - Added _meta.json file for enhanced metadata management - Updated SKILL.md: metadata structure improved (now nested under "openclaw" and with "bins" requirements) - Remove
Rank
62
Safety
84
Downloads
982
Updated
Oct 11, 2026
Version
0.1.1
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 982 downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 982 downloadsadoption · observed Oct 11, 2026
- Latest release
- 0.1.1release · observed Jun 16, 2026
- Handshake status
- UNKNOWNsecurity
What changed
Newest first. Only changes that point at a source are listed.
Release 0.1.1release
- Update to version 0.1.1 - Added _meta.json file for enhanced metadata management - Updated SKILL.md: metadata structure improved (now nested under "openclaw" and with "bins" requirements) - Removed skill-card.md for simplification of documentation files
Observed Jun 16, 2026 · source
Install and run
Setup complexity: low.
clawhub skill install s17dbd0j0kazk5ay31x9kv1z3n84f04v:bitnet- Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-cn-big-cabbage-bitnet/snapshot"
Run-check
$0.02 USD1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.
Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.
Documentation
CLAWHUB
38,348 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: bitnet
description: 微软官方 1-bit LLM 推理框架,在 CPU 上运行 1.58-bit 量化大语言模型,速度提升 1.4-6x、能耗降低 55-82%,单 CPU 可运行 100B 参数模型,达到人类阅读速度
version: 0.1.1
metadata:
openclaw:
requires:
bins:
- python3
- cmake
emoji: ⚡
homepage: https://github.com/microsoft/BitNet
---
# BitNet — 1-bit LLM 本地高效推理
bitnet.cpp 是微软研究院发布的官方 1-bit LLM 推理框架,基于 llama.cpp 构建,专为 BitNet b1.58 系列模型优化。在 x86 CPU 上速度提升 2.37-6.17 倍,能耗降低 71-82%;在 ARM CPU 上速度提升 1.37-5.07 倍,能耗降低 55-70%。单台消费级 CPU 即可以 5-7 tokens/秒的速度运行 100B 参数模型,达到人类阅读速度,彻底改变本地 LLM 部署的经济性。
## 核心使用场景
- **CPU 本地 LLM 推理**:无需 GPU,在消费级 CPU 上运行数十亿参数模型
- **边缘设备部署**:极低能耗,适合嵌入式设备、笔记本电脑、服务器 CPU
- **隐私敏感场景**:完全本地运行,数据不离开设备
- **大规模批量推理**:多线程优化,节省数据中心能源成本
- **学术研究**:研究 1-bit LLM 量化技术和推理优化
## AI 辅助使用流程
1. **环境搭建** — AI 创建 conda 环境并安装编译依赖(Python、CMake、Clang)
2. **克隆仓库** — AI 执行 `git clone --recursive https://github.com/microsoft/BitNet.git`
3. **下载模型** — AI 使用 `huggingface-cli download` 下载官方 BitNet 模型
4. **编译环境** — AI 运行 `python setup_env.py` 量化模型并编译推理内核
5. **运行推理** — AI 执行 `python run_inference.py` 进行对话或文本生成
6. **性能测试** — AI 运行 `python e2e_benchmark.py` 测量吞吐量和延迟
## 关键章节导航
- [安装指南](guides/01-installation.md) — 依赖安装、conda 环境、模型下载
- [快速开始](guides/02-quickstart.md) — 编译量化、运行推理、对话模式
- [高级用法](guides/03-advanced-usage.md) — GPU 推理、性能测试、多线程配置
- [故障排查](troubleshooting.md) — 编译错误、模型加载失败、性能问题
## AI 助手能力
使用本技能时,AI 可以:
- ✅ 搭建 conda 环境并安装编译依赖(CMake、Clang)
- ✅ 克隆 BitNet 仓库并安装 Python 依赖
- ✅ 使用 `huggingface-cli` 下载指定 BitNet 模型
- ✅ 运行 `setup_env.py` 完成量化和环境配置
- ✅ 执行 `run_inference.py` 进行对话推理
- ✅ 运行 `e2e_benchmark.py` 测试推理性能
- ✅ 配置多线程参数优化吞吐量
## 核心功能
- ✅ **极速 CPU 推理** — x86 CPU 提升 2.4-6.2x,ARM CPU 提升 1.4-5.1x
- ✅ **超低能耗** — 比传统 INT8 推理节能 55-82%
- ✅ **大模型单 CPU** — 100B 模型在单 CPU 以 5-7 tokens/秒运行
- ✅ **官方量化内核** — I2_S、TL1、TL2 三种针对不同硬件优化的内核
- ✅ **GPU 支持** — 官方 GPU 推理内核(2025 年发布)
- ✅ **多模型支持** — BitNet-b1.58 2B/3B、Llama3-8B-1.58bit、Falcon3 系列
- ✅ **对话模式** — `-cnv` 标志启用交互式聊天(系统提示支持)
- ✅ **性能基准** — 内置 `e2e_benchmark.py` 测量 tokens/秒和能耗
## 快速示例
```bash
# 克隆并进入项目
git clone --recursive https://github.com/microsoft/BitNet.git
cd BitNet
# 安装依赖
conda create -n bitnet-cpp python=3.9 && conda activate bitnet-cpp
pip install -r requirements.txt
# 下载官方模型并量化
huggingface-cli download microsoft/BitNet-b1.58-2B-4T-gguf --local-dir models/BitNet-b1.58-2B-4T
python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s
# 运行对话推理
python run_inference.py \
-m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \
-p "You are a helpful assistant" \
-cnv
```
## 安装要求
| 依赖 | 版本要求 |
|------|---------|
| Python | >= 3.9 |
| CMake | >= 3.22 |
| Clang | >= 18 |
| conda | 推荐(环境隔离) |
| 磁盘空间 | 模型约 1-20 GB |
## 项目链接
- GitHub:https://github.com/microsoft/BitNet
- 官方模型(HuggingFace):https://huggingface.co/microsoft/BitNet-b1.58-2B-4T
- GPU 推理文档:https://github.com/microsoft/BitNet/blob/main/gpu/README.md
- 技术报告:https://arxiv.org/abs/2410.16144_meta.json
{
"ownerId": "kn7c5ry95ff7x22mt3fx6j0q3d81p8t3",
"slug": "bitnet",
"version": "0.1.1",
"publishedAt": 1781604546774
}guides/01-installation.md
# 安装指南 ## 适用场景 - 在 Linux/macOS/Windows 上从源码构建 BitNet - 配置 conda 环境和编译依赖 - 下载官方模型并完成量化 --- ## 环境要求 | 依赖 | 版本 | 安装方式 | |------|------|---------| | Python | >= 3.9 | conda 或系统 Python | | CMake | >= 3.22 | `conda install cmake` | | Clang | >= 18 | 系统包管理器 | | conda | 任意 | [Miniconda](https://docs.conda.io/en/latest/miniconda.html) | --- ## macOS 安装 > **AI 可自动执行** ```bash # 安装 Homebrew(如未安装) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # 安装编译依赖 brew install llvm cmake # 配置 Clang 路径(Apple Silicon) export PATH="/opt/homebrew/opt/llvm/bin:$PATH" export CC=/opt/homebrew/opt/llvm/bin/clang export CXX=/opt/homebrew/opt/llvm/bin/clang++ # 验证版本 clang --version # 需要 >= 18 cmake --version # 需要 >= 3.22 ``` --- ## Linux (Ubuntu/Debian) 安装 ```bash # 安装 Clang 18 bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" # 安装 CMake sudo apt-get install -y cmake # 验证 clang-18 --version cmake --version ``` --- ## Windows 安装 在 Windows 上需要 Visual Studio 2022: 1. 下载 [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) 2. 在安装程序中勾选: - Desktop-development with C++ - C++-CMake Tools for Windows - C++-Clang Compiler for Windows - MS-Build Support for LLVM-Toolset (clang) 3. 使用 **Developer Command Prompt for VS2022** 运行所有命令 --- ## 克隆并安装 Python 依赖 ```bash # 克隆(必须使用 --recursive 拉取子模块) git clone --recursive https://github.com/microsoft/BitNet.git cd BitNet # 创建 conda 环境 conda create -n bitnet-cpp python=3.9 conda activate bitnet-cpp # 安装 Python 依赖 pip install -r requirements.txt ``` --- ## 下载模型 ### 官方推荐模型(BitNet-b1.58-2B-4T) ```bash # 使用 huggingface-cli 下载 GGUF 格式 pip install huggingface_hub huggingface-cli download microsoft/BitNet-b1.58-2B-4T-gguf \ --local-dir models/BitNet-b1.58-2B-4T ``` ### 其他支持的模型 ```bash # 较小的 700M 模型(测试用) huggingface-cli download 1bitLLM/bitnet_b1_58-large \ --local-dir models/bitnet_b1_58-large # 3.3B 模型 huggingface-cli download 1bitLLM/bitnet_b1_58-3B \ --local-dir models/bitnet_b1_58-3B ``` --- ## 编译量化环境 ```bash # 使用本地模型路径(x86 推荐 i2_s,ARM 推荐 tl1) python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s # ARM CPU 使用 TL1 内核 python setup_env.py -md models/BitNet-b1.58-2B-4T -q tl1 # 使用预调优内核参数(可能更快) python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s --use-pretuned ``` 编译成功后,会在模型目录生成 `ggml-model-i2_s.gguf` 文件。 --- ## 完成确认检查清单 - [ ] `clang --version` 显示 >= 18 - [ ] `cmake --version` 显示 >= 3.22 - [ ] `git clone --recursive` 成功(含子模块) - [ ] `pip install -r requirements.txt` 无报错 - [ ] 模型下载完成(几百 MB 到几 GB) - [ ] `setup_env.py` 执行成功,生成 `.gguf` 文件 --- ## 下一步 - [快速开始](02-quickstart.md) — 运行推理、对话模式、性能测试
guides/02-quickstart.md
# 快速开始 ## 适用场景 - 运行 BitNet 模型进行文本生成和对话 - 使用对话模式进行交互式聊天 - 测试模型推理性能 --- ## 运行基础推理 完成安装后,运行第一个推理: ```bash # 确认 conda 环境已激活 conda activate bitnet-cpp # 单次文本生成 python run_inference.py \ -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \ -p "The future of AI is" \ -n 128 ``` 参数说明: - `-m`:模型文件路径(`ggml-model-i2_s.gguf`) - `-p`:提示词(prompt) - `-n`:生成 token 数量(默认 128) --- ## 对话模式(推荐) 使用 `-cnv` 标志进入交互式对话模式,`-p` 变为系统提示: ```bash python run_inference.py \ -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \ -p "You are a helpful AI assistant. Answer concisely and accurately." \ -cnv ``` 启动后进入交互式提示符,输入问题即可对话: ``` > What is machine learning? Machine learning is a subset of artificial intelligence that enables systems to learn... > Explain it like I'm five Imagine teaching a dog tricks... ``` 按 `Ctrl+C` 退出对话。 --- ## 调整推理参数 ```bash # 增加并发线程数(提高速度) python run_inference.py \ -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \ -p "Explain quantum computing" \ -t 8 \ # 使用 8 个线程 -n 256 \ # 生成 256 个 token -c 4096 # 上下文窗口大小 # 调整温度(创意度) python run_inference.py \ -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \ -p "Write a poem about the moon" \ -temp 0.8 \ # 0.0=确定性,1.0=创意,>1.0=随机 -n 200 ``` --- ## 性能基准测试 ```bash # 基础基准(默认:128 token 生成,512 token 提示) python e2e_benchmark.py \ -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf # 自定义基准 python e2e_benchmark.py \ -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \ -n 256 \ # 生成 256 个 token -p 1024 \ # 使用 1024 token 的提示 -t 4 # 使用 4 个线程 ``` 典型输出示例(Apple M2): ``` Model: BitNet-b1.58-2B-4T Threads: 4 Prompt processing: 125 tokens/sec Token generation: 18.5 tokens/sec Total time: 8.2s ``` --- ## 不同量化类型对比 ```bash # 安装 I2_S 量化(x86 推荐) python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s python run_inference.py -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf -p "test" -n 50 # 安装 TL1 量化(ARM 推荐,如 Apple Silicon) python setup_env.py -md models/BitNet-b1.58-2B-4T -q tl1 python run_inference.py -m models/BitNet-b1.58-2B-4T/ggml-model-tl1.gguf -p "test" -n 50 ``` --- ## 使用 Falcon3 模型(已有指令调优) ```bash # 下载 Falcon3 指令模型(支持更好的对话能力) huggingface-cli download tiiuae/Falcon3-3B-Instruct-1.58bit-gguf \ --local-dir models/Falcon3-3B-Instruct python setup_env.py -md models/Falcon3-3B-Instruct -q i2_s # 对话模式 python run_inference.py \ -m models/Falcon3-3B-Instruct/ggml-model-i2_s.gguf \ -p "You are Falcon, a helpful assistant." \ -cnv ``` --- ## 完成确认检查清单 - [ ] `run_inference.py` 成功生成文本(非空输出) - [ ] 对话模式(`-cnv`)可以持续多轮对话 - [ ] `e2e_benchmark.py` 输出 tokens/sec 指标 - [ ] 生成速度基本达到预期(2B 模型 CPU 上应 > 5 tokens/sec) --- ## 下一步 - [高级用法](03-advanced-usage.md) — GPU 推理、多线程优化、更大模型
guides/03-advanced-usage.md
# 高级用法
## GPU 推理
BitNet 官方 GPU 内核(2025 年 5 月发布),支持 CUDA GPU 加速:
```bash
# 查看 GPU 推理文档
cat gpu/README.md
# GPU 版本需要 CUDA 环境
# 参考: https://github.com/microsoft/BitNet/blob/main/gpu/README.md
```
---
## 多线程性能优化
CPU 线程数对性能影响显著,建议实验找到最优值:
```bash
# 测试不同线程数的性能
for threads in 1 2 4 8; do
echo "=== Threads: $threads ==="
python e2e_benchmark.py \
-m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \
-t $threads \
-n 128 \
-p 256
done
```
**经验规则:**
- 单用户推理:物理核心数的 50-75%
- 服务化推理:物理核心数的 100%
- 超线程(HT)对推理加速有限,优先使用物理核心数
---
## 使用嵌入量化(减少内存)
```bash
# 启用嵌入量化(进一步降低内存使用)
python setup_env.py \
-md models/BitNet-b1.58-2B-4T \
-q i2_s \
--quant-embd # 嵌入量化到 f16
```
---
## 不同模型大小的性能对比
```bash
# 对比不同大小模型的速度
# 700M 模型
python e2e_benchmark.py -m models/bitnet_b1_58-large/ggml-model-i2_s.gguf -t 4
# 2.4B 官方模型
python e2e_benchmark.py -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf -t 4
# 3.3B 模型(ARM 专用 TL1 内核)
python e2e_benchmark.py -m models/bitnet_b1_58-3B/ggml-model-tl1.gguf -t 4
```
典型速度参考(Apple M2):
| 模型 | 速度 | 内存 |
|------|------|------|
| bitnet_b1_58-large (700M) | ~45 t/s | ~0.5 GB |
| BitNet-b1.58-2B-4T (2.4B) | ~18 t/s | ~1.2 GB |
| bitnet_b1_58-3B (3.3B) | ~12 t/s | ~1.8 GB |
---
## 使用预调优内核
预调优内核为特定硬件配置优化了 tile 大小等参数:
```bash
# 使用预调优参数(通常比默认快 15-100%)
python setup_env.py \
-md models/BitNet-b1.58-2B-4T \
-q i2_s \
--use-pretuned
```
---
## 最新优化内核(2026 年 1 月)
新版并行内核实现,带可配置 tiling 和嵌入量化支持:
```bash
# 查看优化指南
cat src/README.md
# 该优化在原实现基础上额外提速 1.15-2.1x
# 无需额外配置,setup_env.py 自动使用最新内核
```
---
## 内存估算
BitNet 模型的内存使用公式(约):
| 参数量 | I2_S 量化内存 |
|--------|--------------|
| 700M | ~0.5 GB |
| 2.4B | ~1.5 GB |
| 3.3B | ~2.0 GB |
| 8.0B | ~5.0 GB |
BitNet 1.58-bit 量化比传统 FP16(~2 bytes/param)约低 87%,运行 100B 模型仅需约 20 GB 内存。
---
## 批量文本生成(无对话)
```python
# 通过 Python 脚本批量生成
import subprocess
prompts = [
"Translate to French: Hello world",
"Summarize in one sentence: Machine learning is...",
"What is the capital of Japan?",
]
for prompt in prompts:
result = subprocess.run(
[
"python", "run_inference.py",
"-m", "models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf",
"-p", prompt,
"-n", "100",
"-t", "4",
],
capture_output=True, text=True
)
print(f"Prompt: {prompt[:50]}...")
print(f"Output: {result.stdout[:200]}")
print()
```
---
## 完成确认检查清单
- [ ] 多线程测试找到最优线程数
- [ ] 预调优内核性能明显提升(可选)
- [ ] GPU 推理配置成功(如有 NVIDIA GPU)
- [ ] 嵌入量化降低内存使用(可选)
---
## 相关链接
- [故障排查](../troubleshooting.md)
- [GPU 推理文档](https://github.com/microsoft/BitNet/blob/main/gpu/README.md)
- [优化指南](https://github.com/microsoft/BitNet/blob/main/src/README.md)
- [技术论文](https://arxiv.org/abs/2410.16144)AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
- Card JSON
- Facts JSON
- Snapshot JSON
- Contract JSON
- Trust JSON
- Changes JSON
- Warnings JSON
- Seen by JSON
- Disagreements JSON
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/cn-big-cabbage/skills/bitnet",
"sourceUrl": "https://clawhub.ai/cn-big-cabbage/skills/bitnet",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T22:46:25.354Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-cn-big-cabbage-bitnet/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-cn-big-cabbage-bitnet/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T22:46:25.354Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "982 downloads",
"href": "https://clawhub.ai/cn-big-cabbage/bitnet",
"sourceUrl": "https://clawhub.ai/cn-big-cabbage/bitnet",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T22:46:25.354Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "0.1.1",
"href": "https://clawhub.ai/cn-big-cabbage/bitnet",
"sourceUrl": "https://clawhub.ai/cn-big-cabbage/bitnet",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-06-16T10:09:06.774Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-cn-big-cabbage-bitnet/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-cn-big-cabbage-bitnet/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 0.1.1",
"description": "- Update to version 0.1.1 - Added _meta.json file for enhanced metadata management - Updated SKILL.md: metadata structure improved (now nested under \"openclaw\" and with \"bins\" requirements) - Removed skill-card.md for simplification of documentation files",
"href": "https://clawhub.ai/cn-big-cabbage/bitnet",
"sourceUrl": "https://clawhub.ai/cn-big-cabbage/bitnet",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-06-16T10:09:06.774Z",
"isPublic": true
}
]
}Record generated Oct 12, 2026.
For crawlers
This page is free to read. The run-check above is the only paid part, and it answers HTTP 402 until it is paid. Everything else here is public.
- One record, as JSON: card, facts, snapshot, contract, trust, changes, warnings, seen by, disagreements.
- Every agent, one feed: /.well-known/ai-catalog.json
- What this site sells, and the price: /.well-known/x402
- Paid run-check: /api/v1/agents/clawhub-cn-big-cabbage-bitnet/run-check
