Instructions to use merlijn70w/bitnet-kv260-weights with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use merlijn70w/bitnet-kv260-weights with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="merlijn70w/bitnet-kv260-weights")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("merlijn70w/bitnet-kv260-weights", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use merlijn70w/bitnet-kv260-weights with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "merlijn70w/bitnet-kv260-weights" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "merlijn70w/bitnet-kv260-weights", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/merlijn70w/bitnet-kv260-weights
- SGLang
How to use merlijn70w/bitnet-kv260-weights 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 "merlijn70w/bitnet-kv260-weights" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "merlijn70w/bitnet-kv260-weights", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "merlijn70w/bitnet-kv260-weights" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "merlijn70w/bitnet-kv260-weights", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use merlijn70w/bitnet-kv260-weights with Docker Model Runner:
docker model run hf.co/merlijn70w/bitnet-kv260-weights
bitnet-kv260-weights
The weights of microsoft/bitnet-b1.58-2B-4T,
repacked into the byte layout that the FPGA fabric of a Xilinx Kria KV260 streams directly.
They are used by bitnet-kv260, which runs all 30 layers of the model on a KV260: every ternary matrix-vector product is streamed through four engines in the programmable logic, while attention, the norms and the exact top-K rescore of the output head run on the board's four Cortex-A53 cores.
These files are a repacking, not a retraining. No weight value is changed. The setup script of that
project downloads them, checks every file against the sizes and MD5 sums recorded in manifest.json
and head_t.json, and refuses to continue on a mismatch.
Files
| file | bytes | what it is |
|---|---|---|
model3.bin |
417,546,240 | every ternary matrix of all 30 layers, base-3 packed, five trits a byte, 80 weights a 128-bit beat, row-major per neuron |
embed_bf16.bin |
656,670,720 | the token embedding, bf16, unchanged from the checkpoint |
head_i8.bin |
328,335,360 | the tied output head, quantised per row to int8 |
head3_t.bin |
65,667,072 | a ternary approximation of the output head, base-3 packed, streamed by the fabric to shortlist candidates |
head_scale.bin |
513,024 | the per-row scales of head_i8.bin, float32 |
head_t_scale.bin |
513,024 | the per-row scales of head3_t.bin, float32 |
norms.bin |
1,761,280 | every norm weight, float32, unchanged from the checkpoint |
manifest.json |
78,011 | the geometry, the offsets of all 210 matrices, and the size and MD5 of every file |
head_t.json |
1,099 | the ternary head's layout, its rule, and its size and MD5 |
tokenizer.json is deliberately not here. The project fetches it from
microsoft/bitnet-b1.58-2B-4T directly.
How the output head works
The head is two stages and the result is exactly the argmax of the int8 head. Stage one streams the
ternary approximation through the fabric and takes the best 256 rows. Stage two recomputes those 256
rows exactly from head_i8.bin on the processors and takes the argmax. Measured over 2,115 real
hidden states, the true argmax never fell below rank 56 in the approximation, so a shortlist of 256
covers it with a factor of 4.6 in hand.
Licence and attribution
MIT, because these files are derived from microsoft/bitnet-b1.58-2B-4T, which is MIT.
Copyright (c) Microsoft Corporation. MIT License.
embed_bf16.bin and norms.bin are byte-for-byte the checkpoint's own tensors. The rest are
derivatives of its tensors. If you redistribute them, the MIT notice travels with them.
The original model is described in arXiv:2504.12285. Microsoft's own model card notes: "We do not recommend using BitNet b1.58 in commercial or real-world applications without further testing and development."
Note that the code of the KV260 project is Apache 2.0, for its patent grant over the hardware architecture. Only these weight files are MIT. The two licences are separate and both apply where they say they do.
Model tree for merlijn70w/bitnet-kv260-weights
Base model
microsoft/bitnet-b1.58-2B-4T