Ternary-Bonsai-2-9B (dense bf16, Hugging Face transformers)
Unofficial community conversion; not affiliated with or endorsed by Prism ML.
Created using Bonsai by Prism ML.
This is a dense bf16 Qwen3_5ForConditionalGeneration checkpoint converted from
Prism ML's MLX pack
prism-ml/Ternary-Bonsai-2-9B-mlx-2bit
at revision f4e28a59531731c41b6dfac88cf271bd58f0a287. It loads in stock transformers with no custom code.
The multi-token-prediction head is not included (mtp_num_hidden_layers: 0).
Conversion method
- Language model, 202 packed linears plus the token embedding and
lm_head. Each 2-bit affine weight is dequantized exactly in float32 ((code - 1) * scale, group 128). The blockwise Hadamard rotation that Prism ML folded into the stored weights is then undone per contiguous 4096-column block of the input dimension:W = (W_folded @ H) / sqrt(4096) * signs, whereHis the Sylvester Hadamard matrix andsignsis the pack's own explicit sign vector for that input width. The result is rounded to bf16. - RMSNorm weights (
input_layernorm,post_attention_layernorm,norm,q_norm,k_norm) are shifted by -1.0 to the transformers(1 + w)convention. The gated GDN norm (linear_attn.norm) andA_logare kept in float32 unchanged. - Layouts:
conv1dweights go from MLX(C, K, 1)to PyTorch(C, 1, K); the visionpatch_embedgoes from MLX channel-last to PyTorch(O, C, T, H, W). - Vision tower (FP16 in the pack) and all other tensors are cast to bf16.
- The tensor key set and shard layout follow
Qwen/Qwen3.5-9B at revision
c202236235762e1c871ad0ccb60c8ee5ba337b9a, without themtp.*tensors.
The ternary benefit is not retained. This checkpoint stores the dense bf16 weights (~18.8 GB), not the 2-bit packing; it trades the small footprint for compatibility with standard transformers tooling. For the compact on-device format, use the original MLX or GGUF packs from Prism ML.
Credits
- Model: Ternary Bonsai 2 9B by Prism ML, built from
Qwen3.5-9B (Copyright 2026 Alibaba Cloud), both Apache 2.0. See
NOTICE.txtandLICENSE. - The Hadamard unfold (
load_hadamard_spec,unfold,refold) is adapted from PipeNetwork/bonsai2-mlx at revisiond5129fc16286d4e7413eb998f3d075bde5e71ac6(Apache 2.0).
License
Apache 2.0, following the base model and the source pack.