These weights from Cloudflare/clef are quantized for Tenstorrent Tensix NPUs (Wormhole, Blackhole), with the files in bfp4/.
Folders
| Folder | Formats | Size (GB, packed) | Mean KL to BF16 | Answers |
|---|---|---|---|---|
bfp4/ |
MLP bfloat4_b; attention and DeltaNet bfloat8_b; the rest bf16 | 23.59 | 0.0093908380 | 36/40 |
| Original BF16 backbone and head | - | - | 0 | 35/40 |
| Same-base llama.cpp Q4_K_M backbone, original BF16 head and lexical table | - | - | 0.0081680764 | 35/40 |
Mean KL compares the allowed-option distributions across the same 44 records, 55 questions and 40 labeled questions, with records from 152 to 16,384 tokens. Answers: 40 labeled questions.
How to run
hf download Xylolabs/clef-Tenstorrent-Tensix --include "bfp4/*" --local-dir clef-Tenstorrent-Tensix
Use Transformers 5.23.0 and PyTorch with CUDA.
import sys
sys.path.insert(0, "clef-Tenstorrent-Tensix/bfp4")
import torch
from joint_schema_model import collate_records, encode_record, load_release_model
model, processor = load_release_model("clef-Tenstorrent-Tensix/bfp4", device="cuda")
record = {
"state": {"invoice": {"vendor": "Acme", "total": 1250.0, "currency": "USD", "status": "overdue"}},
"questions": {
"status": {
"type": "choice",
"instructions": "What is the invoice status?",
"criteria": {"paid": "Invoice is paid.", "overdue": "Invoice is past due.", "draft": "Not sent."},
},
"large": {"type": "noul", "instructions": "Is the total above 1000 USD?"},
},
}
encoded = encode_record(processor.tokenizer, record, processor=processor)
batch = collate_records([encoded], processor.tokenizer.pad_token_id, torch.device("cuda"))
with torch.inference_mode():
logits = model(batch)[0]
for question, question_logits in zip(encoded.questions, logits):
probabilities = question_logits.float().softmax(-1).tolist()
print(question.question_id, dict(zip(question.option_ids, probabilities)))
The model evaluates every allowed option in one forward pass.
Run on Tensix
The quantized backbone projections use TT-NN's [in, out] matrix layout:
import json
import torch
import ttnn
from safetensors import safe_open
d = "clef-Tenstorrent-Tensix/bfp4"
name = "model.language_model.layers.0.mlp.down_proj.weight"
fmt = json.load(open(f"{d}/quant4.json"))["layers"]["0"]["mlp.down_proj"]["format"]
dtype = {"bfp4": ttnn.bfloat4_b, "bfp8": ttnn.bfloat8_b}[fmt]
shard = json.load(open(f"{d}/model.safetensors.index.json"))["weight_map"][name]
with safe_open(f"{d}/{shard}", "pt") as f:
w = f.get_tensor(name).t().contiguous()
device = ttnn.open_device(device_id=0)
w_tt = ttnn.as_tensor(w, dtype=dtype, layout=ttnn.TILE_LAYOUT,
device=device, memory_config=ttnn.DRAM_MEMORY_CONFIG)
assert torch.equal(ttnn.to_torch(w_tt).float(), w.float())
ttnn.close_device(device)
python clef-Tenstorrent-Tensix/bfp4/pack_tensix.py clef-Tenstorrent-Tensix/bfp4
python clef-Tenstorrent-Tensix/bfp4/verify_grid.py clef-Tenstorrent-Tensix/bfp4
Use --as bfp8 with the packing script to pack in BFP8.
Add --device to round-trip the packed values.
Updates
- 2026-11-27: Renamed from clef-Tenstorrent-Tensix-BFP4; files now in bfp4/.
License
Apache 2.0, as the original model and generic Cloudflare code (LICENSE). Changes are documented in NOTICE;
original Xylolabs helpers use the same Apache 2.0 terms (CODE_LICENSE).
pack_tensix.py and verify_grid.py are tensix-bfp-gptq v0.1.0's tools, unchanged.
Each folder carries its own LICENSE and NOTICE.
Citation
Cite the original Cloudflare/clef release.