Show and Tell: Hyphae BitNet Runtime - exact CPU inference, C ABI, serving, Bonsai Q1, and reproducible evidence #615
Mario Gutierrez (terrizoaguimor)
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi BitNet community,
We are sharing Hyphae BitNet Runtime, an open-source fork of Microsoft BitNet focused on correctness-first CPU inference, an embeddable runtime/API, and reproducible numerical and performance evidence.
The project started from Microsoft BitNet commit
0b341e5, with the corresponding llama.cpp engine now vendored in-tree and pinned by both commit and exact Git tree hash. Upstream imports are reviewed manually and must pass the numerical and hardware validation gates.Repository: https://github.com/Hyphae-Research-Foundation/hyphae-bitnet
Latest release: https://github.com/Hyphae-Research-Foundation/hyphae-bitnet/releases/tag/v0.3.3
The current source/package version is 0.3.2. Hyphae/Celiums contributions are Apache-2.0; retained upstream code keeps its original MIT/BSD and third-party licensing. This is an independent community project and is not affiliated with, sponsored by, endorsed by, or supported by Microsoft.
What changed from the upstream baseline
1. A strict and documented I2_S numerical contract
We made the BitNet b1.58 2B I2_S path explicit and testable rather than relying on implementation assumptions:
-1 -> 0,0 -> 1,+1 -> 2);y = (D - S) rho;The equations, byte layout, bounds, and non-claims are documented in the numerical contract. Exact epilogues and Q1 packing/correction live in the small in-tree
celiums-exactmodule, which is called by both kernels and test oracles so the tests do not silently reimplement different math.We also added structural GGUF validation for architecture, file type, required projections, dimensions, packed byte counts, and finite scales.
2. A real runtime/product surface instead of a
llama-cliwrapperThe public binary is
hyphae-bitnet(celiums-bitnetremains as a compatibility alias) with:run: one-shot generation;serve: native HTTP completion server;bench: JSONL prefill/decode evidence;validate: checked model loading;version: product, engine, tree, profile, and strictness provenance.There is an experimental C ABI with opaque Runtime, Model, Session, and Request handles. It includes tokenization/detokenization, prefill, single-token decode, copied logits, sampling, synchronous streaming callbacks, stop sequences, cooperative cancellation, and model/runtime provenance without exposing llama.cpp or GGML types.
The HTTP server implements a deliberately limited OpenAI-shaped completions/chat subset with SSE, health/model endpoints, Prometheus metrics, body/token/concurrency limits, and cancellation on client disconnect. Non-loopback binding is refused unless authentication is configured or an explicit unsafe override is supplied.
We also repaired an ABI mistake made during 0.3.1 development: the released v0.3.0 option layouts and by-value return convention are frozen, while newer RAM/layout/family/sequence controls use sized
_exstructs and caller-buffer initializers. A frozen v0.3.0 client is compiled and run in CI against the current shared library.3. RAM is an explicit serving lever, with fail-closed accounting
Packed GGUF remains the durable store. Optional ISA-specific compute layouts are materialized as a bounded working set, not as an unaccounted copy:
--ram-budget-bytes;RAM_BUDGET_EXCEEDEDbefore crossing the cap;n_seq > 1is rejected because decode currently uses sequence 0 only rather than pretending to support safe multi-sequence serving.4. Exact Q1 CPU work for Bonsai 27B
In addition to the certified BitNet 2B I2_S target, the runtime has an explicit opt-in CPU text family for the pre-quantized Bonsai 27B Q1_0 model (
qwen35, file type 40):dot = d_w d_x (2P - S);Whole-model testing showed the SVE2 prototype was exact but slower than the NEON path, so it remains opt-in rather than being promoted based on an isolated kernel result. Likewise, Q8 activation reuse was exact but neutral at the measured whole-model scale. We retained the evidence and the conservative default.
We intentionally do not ship LUT-GEMM or T-MAC in the strict paths because those methods are approximate. The goal here is exact integer accumulation first.
5. Optional local AI gateway, kept outside the inference process
An optional Rust gateway composes the native loopback server with authenticated Hyphae UDS and provides bounded local RAG/memory, BM25 and vector/ANN/hybrid retrieval, semantic cache, durable generation receipts, proof verification, dataset/artifact/lineage/evaluation registries, and a separate MCP stdio adapter.
The gateway is process-separated: Hyphae is not linked into GGML or the inference C ABI.
6. Reproducibility and release engineering
The repository now includes:
native,avx2, andscalarrelease archives;docs/instead of only headline numbers.Models and validation scope
microsoft/BitNet-b1.58-2B-4T, I2_SBonsai-27B-Q1_0.gguf, Q1_0Model files are not redistributed. Production users should pin the publisher revision and model digest.
A few measured results, with caveats
These are hardware-specific historical receipts, not universal claims:
Raw receipts and methodology are linked from the README and the vendored CPU hot-path review.
Current limits
To keep the claims precise, the supported product is currently:
Where community contributions would help most
We would especially value:
The detailed history is in CHANGES.md, and the repository contains the tests, benchmark JSON, threat model, release manifests, and exactness documentation needed to challenge the claims.
Feedback, independent measurements, bug reports, and pull requests are very welcome. If anyone is interested in reproducing a specific kernel or model-backed gate, we can help identify the exact model revision, digest, build profile, and evidence command.
All reactions