WiTi BitNet: An Alternative QNM-Based Conversion Pipeline and Chat Runtime for BitNet AI Models
Year: 2026
Type: article
Abstract: This record documents WiTi BitNet, an independent, standalone alternative pipeline for converting and running 1.58-bit ternary Large Language Models (specifically BitNet-b1.58-2B-4T) on local CPUs without relying on the GGUF/GGML ecosystem used by the official microsoft/BitNet (bitnet.cpp) implementation. Overview & Key ComponentsI2_S to q1r Conversion Pipeline (bitnet_to_qnm1bit.py): Unpacks 2-bit packed I2_S ternary weights {-1, 0, +1}, dequantizes with BF16 tensor scales, and re-packs them into the row-wise q1r format ([f16 scale][K/4 bytes of 2-bit codes]) refined via 3 iterations of least-squares optimization, stored inside standard safetensors with embedded qnm.index metadata.Native C Runtime & SIMD Dispatch (qnm_chat_bitnet.c, qnm_runtime.c): Maps safetensors directly via mmap and executes a Llama-based forward pass (GQA, RoPE, ReLU², sub-norm) with KV-cache. Includes runtime CPUID dispatch supporting AVX2 (gather LUT), SSE4.1 (shift-unpack fallback), and scalar kernels, alongside a Byte-Level BPE decoder fix (eliminating UTF-8 mojibake) and greedy decoding with repetition penalty (window 128) and no-repeat 8-gram blocking.Native Qt 6 C++ GUI (gui_native/): Provides a lightweight desktop chat interface with session controls, token/thread/penalty settings, Indonesian/English system language switching, and an integrated help/license dialog.Summary of Local Measurements (BitNet-b1.58-2B-4T)Storage Footprint: 1,180 MB (~1.18 GB) in q1r format (~5 KB total scale overhead), approximately 130 MB smaller than the block-wise q1m variant (1.31 GB) and comparable to the original I2_S file (1.179 GB).Numerical Parity: Matches the top-5 logit predictions of the reference PyTorch implementation on initial token tests and achieves bitwise parity on quantize_q16.Single-Thread CPU Performance: ~4.4–4.5 tokens/sec decode speed (~4.3 tok/s prefill) on a 12th Gen Intel Core i5-1235U (Debian GNU/Linux 13, GCC 14.2.0, -O3 -mavx2 -mfma), and ~2.0 tokens/sec in portable -msse2 builds. Scope & Disclaimer This publication strictly documents an alternative engineering implementation for research, educational, and local runtime experimentation purposes. It makes no claim of superiority, higher speed, higher accuracy, or replacement over the official microsoft/BitNet (bitnet.cpp) framework. All reported figures represent local measurements on a single machine rather than independent cross-platform benchmarks. LicenseWiTi BitNet Software & Documentation: POKDARTIK-NC (Kelompok Masyarakat Sadar TIK — Non-Commercial License; permitted for personal, educational, and non-commercial research use with attribution).Third-Party Components: Retain their respective original licenses (MIT for Microsoft BitNet model weights, Apache-2.0 for Hugging Face safetensors and Transformers, BSD-3-Clause for PyTorch and NumPy, LGPL/GPL for Qt 6, and PSF for Python).
Author: Sulistiowati, Erni
Language: English
Subfield: Computer Vision and Pattern Recognition
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7238778708
FWCI:
Cites:
Cited by:
Related to:
