Skip to content
プロジェクト

概要

CPU-optimized LLM inference engine (C)

AI・機械学習

この数値の測り方

できること

  • Web chat and an OpenAI-compatible /v1/chat/completions, with streaming, cancel, optional API key and CORS, /metrics, and --parallel N to serve several users at once
  • Sampling controls, JSON mode (--json), speculative decoding (--draft-model), best-of-N (--best-of) and tree search (--mcts)
  • LoRA adapters (--lora), image input (--vision), RAG memory (--memory-db), a tool-use agent (/agent in the terminal chat), watermarking (--watermark)
  • KV cache in f32, int8 or int4 (--kv-type), on disk when RAM runs out (--kv-offload), with prompt caching (--prompt-cache)

計測したスター増加

24時間
+1
7日間
+1
15日間
+2
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Project Zero

CI License: MIT

An LLM inference engine for CPUs, written from scratch in C. One binary (pz), no GPU, no Python, no third-party libraries. It runs ternary models (BitNet b1.58, Falcon3-1.58bit, Ternary-Bonsai), mixture-of-experts models (DeepSeek-V2, Qwen3-MoE) and ordinary GGUF models, and serves them over an OpenAI-compatible API with a built-in web chat.

Project Zero in 20 seconds: an LLM on a CPU, no GPU (click to play)
Project Zero in 20 seconds. BitNet b1.58 2B at 25.2 tok/s and SmolLM2-135M at 151.8 tok/s on a 4-vCPU Xeon, 128 tokens, best of 3 (details).

pz answering a question with BitNet b1.58-2B-4T on a 4-vCPU Xeon

Quick start

Linux x86-64:

curl -fsSL https://raw.githubusercontent.com/shifulegend/project-zero/master/install.sh | sh
curl -fL -o SmolLM2-135M-Instruct-f16.gguf \
  https://huggingface.co/bartowski/SmolLM2-135M-Instruct-GGUF/resolve/main/SmolLM2-135M-Instruct-f16.gguf
pz --model SmolLM2-135M-Instruct-f16.gguf --prompt "What is the capital of France?"
pz --model SmolLM2-135M-Instruct-f16.gguf --server --port 8080   # web chat at http://localhost:8080

The installer checks the release checksum and needs no root. To build from source instead:

git clone https://github.com/shifulegend/project-zero.git && cd project-zero
make demo   # builds, downloads SmolLM2-135M, prints "The capital of France is Paris."

You need GCC or Clang (with its C++ compiler, for the chat-template parser), make, pthreads and libm. GGUF models need a CPU with at least AVX2 on x86; BitNet runs on any x86-64-v2 CPU. Installer options, manual install and pz config (saved settings): docs/INSTALL.md.

Benchmarks

Decode speed in tokens per second, best of 3 runs, temperature 0, nothing else running on the machine, measured with a native build (make release). The portable binary the installer fetches reaches 92% of that speed on BitNet 2B and about 89% on SmolLM2-135M F16 on an AVX-512 VNNI Xeon (details). Older runs, other machines and methods: docs/BENCHMARK.md.

Intel Xeon @ 2.10 GHz (AVX-512 VNNI), 4 vCPU — 2026-11-18

500 tokens per run (DeepSeek: 200). Tok/s at 4 threads; the chart has 1–4 threads. Before a result is timed, each engine's perplexity on a fixed text must be within 1% of the reference engine's. bitnet.cpp is built with the squared-ReLU feed-forward activation that BitNet 2B-4T specifies (patch).

Model Project Zero llama.cpp ik_llama.cpp bitnet.cpp
SmolLM2-135M F16 99.4 71.0 92.7 –
SmolLM2-1.7B Q4_K_M 18.8 17.6 22.3 –
BitNet b1.58 2B-4T, official I2_S GGUF 20.8 – 20.8 (converted to IQ2_BN) 20.2
DeepSeek-V2-Lite-Chat Q4_K_S 14.9 12.3 15.4 –

Decode tok/s vs threads on the 2.10 GHz Xeon: Project Zero, llama.cpp, ik_llama.cpp and bitnet.cpp

Logs and screenshots: sweep · DeepSeek.

--classifier int4 (4-bit output layer) runs BitNet 2B-4T at 26.7 tok/s, 28% above the default, at 4.4% higher perplexity. The self-check measures about 9% on its short passage, so keeping int4 needs --quality-tolerance 10; the default bar is 1%.

Output quality: perplexity is within 0.9% of llama.cpp on SmolLM2-135M and 1.7B, Mamba-130m and DeepSeek-V2-Lite (results, older report).

Post your own numbers in Discussion #3.

Models

Tested end to end:

Model Format
BitNet b1.58 2B-4T converted .bin, official I2_S GGUF
Falcon3-3B-Instruct-1.58bit I2_S GGUF
Ternary-Bonsai-27B (Qwen 3.5 hybrid) Q2_0 GGUF
DeepSeek-V2-Lite-Chat Q4_K_S, Q2_K GGUF
Qwen3-8B, Qwen3-0.6B, Qwen2.5-0.5B-Instruct Q4_K_M, Q8_0 GGUF
SmolLM2-135M / 1.7B-Instruct F16, Q8_0, Q4_K_M GGUF
Mamba-130m F16 GGUF

Other models with these architectures load the same way. Qwen3-MoE loads but has not been tested yet. The official BitNet GGUF's own chat template makes the model generate nothing, so pz uses a built-in corrected one for it; --chat-template-file replaces either.

Features

  • Web chat and an OpenAI-compatible /v1/chat/completions, with streaming, cancel, optional API key and CORS, /metrics, and --parallel N to serve several users at once
  • Sampling controls, JSON mode (--json), speculative decoding (--draft-model), best-of-N (--best-of) and tree search (--mcts)
  • LoRA adapters (--lora), image input (--vision), RAG memory (--memory-db), a tool-use agent (/agent in the terminal chat), watermarking (--watermark)
  • KV cache in f32, int8 or int4 (--kv-type), on disk when RAM runs out (--kv-offload), with prompt caching (--prompt-cache)
  • A model's layers split across machines (--remote-layers)
  • The fastest SIMD path picked at startup: AVX-512 VNNI, AVX-512, AVX-VNNI, AVX2, ARM NEON/dotprod or scalar. A first-run calibration changes that choice only when it measures another path clearly faster; --no-calibrate turns it off (for reproducible benchmarks).
  • An accuracy probe (pz --self-check, POST /v1/selfcheck, Settings in the web UI): a quantised LM head (--classifier int8|int4) that costs more than --quality-tolerance percent perplexity (default 1) falls back to BF16; --act-quant picks int8 or float activations for ternary models.

Every flag: pz --help. Every web UI control and API route: docs/WEBUI_GUIDE.md.

Web chat, light theme Settings, dark theme
Web chat showing a reply with token counts Settings panel with sampling and server defaults

Development

make release   # optimised build for this CPU
make test      # all tests, under AddressSanitizer and UBSan
make dist      # portable x86-64 binary, as shipped in releases

Kernels are in src/math/, model loading in src/core/, the forward pass in src/transformer/, the server in src/api/ and the web UI in webui/src/. How the kernels work: docs/KERNEL_INTERNALS.md. What is done and planned: docs/architecture/IMPLEMENTATION_PLAN.md.

Read CONTRIBUTING.md before opening a pull request. Open problems where help is welcome:

  • Q4_K on dense models. Qwen3-8B Q4_K_M is 1.6–1.9× slower than llama.cpp on the same machine. Six attempts are written up in the investigation.

Changes in each release: CHANGELOG.md. Reporting a vulnerability: SECURITY.md.

If you like my work or if it helped you, buy me a coffee or A100😉 Sponsor shifulegend

License

MIT

関連プロジェクトを探す

読み込み中…