Table with columns: Tensors, Format| Tensors | Format |
|---|
| attention q, o (42 layers) | bfloat4_b, 4.5 bits a weight |
| attention k, v (24 layers) | bfloat4_b, 4.5 bits a weight |
| MLP gate, up, down (42 layers) | bfloat4_b, 4.5 bits a weight |
| LM head (tied to the embedding), embedding, norms and every other tensor | bf16, as in the base model |
audio_tower, embed_audio, embed_vision, vision_tower | bf16, unchanged |
9.96 bits a weight on average, 9.37 GB packed. quant4.json lists each projection's format. Quantized with
GPTQ and a per-block exponent search, calibrated on 65,536 tokens of WikiText-2 and Korean Wikipedia.
The token and per-layer embeddings stay bf16 (16 bits a weight); the quantized attention and MLP projections use 4.5 bits a weight, so the average over all language-model weights is higher.
Only the language model was quantized and evaluated.
Quickstart
from transformers import AutoModelForCausalLM, AutoTokenizer repo = "Xylolabs/gemma-4-E4B-Tenstorrent-Tensix-BFP4"tok = AutoTokenizer.from_pretrained(repo)model = AutoModelForCausalLM.from_pretrained(repo, dtype="bfloat16", device_map="auto") inputs = tok("The capital of France is", return_tensors="pt").to(model.device)out = model.generate(**inputs, max_new_tokens=16)print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
This is the pretrained model: it continues text and has no chat template.
Run on Tensix
Checked with ttnn 0.81.1 on ttsim, Tenstorrent's Blackhole simulator. Pack one matrix and
check that no value changed (TT-NN reads weights as [in, out]):
import jsonimport torchimport ttnnfrom safetensors import safe_open d = "gemma-4-E4B-Tenstorrent-Tensix-BFP4" # hf download Xylolabs/gemma-4-E4B-Tenstorrent-Tensix-BFP4 --local-dir gemma-4-E4B-Tenstorrent-Tensix-BFP4name = "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 pack_tensix.py gemma-4-E4B-Tenstorrent-Tensix-BFP4 checks every matrix this way (--device also round-trips it
through device DRAM). python verify_grid.py gemma-4-E4B-Tenstorrent-Tensix-BFP4 checks the grid with torch alone. The
same values also pack exactly into ttnn.bfloat8_b.
tt-transformers and tt-forge were not run with this checkpoint.
Evaluation
Table with columns: Bits a weight, Size (GB), Mean KL to BF16, Top-1 (%), Answers right, Lost | Bits a weight | Size (GB) | Mean KL to BF16 | Top-1 (%) | Answers right | Lost |
|---|
| BF16 (google/gemma-4-E4B) | 16 | 15.04 | 0 | 100 | 27 of 28 | - |
| this model | 9.96 | 9.365 | 0.05101 | 89.21 | 23 of 28 | 1 |
| Q4_K_M, blk.N.proj Q8_0 (llama.cpp) | 5.67 | 5.349 | 0.24892 | 76.39 | 20 of 28 | 4 |
KL and top-1 cover 8,176 positions of English and Korean text (WikiText-2 test, Korean Wikipedia), as plain
text. Answers are 28 short prompts with automatic checks, in completion form, 3-shot. "Lost" means right in
BF16 but wrong or broken here; near ties are not counted. Q4_K_M was made from the same checkpoint with
llama.cpp v0.9.0 (cd959bae) and no importance matrix; its sha256 is
c2bd4c28df4a70b6de17427a394c6acb6d22bf3a2ca8d9b9368bd896ce024c9a. This Q4_K_M keeps Gemma 4's per-layer
projection blk.N.proj at Q8_0: llama.cpp's own Q4_K_M puts that tensor in Q4_K and reads a mean KL of 1.108
with 11 lost. Our bar: mean KL at most 1.5 times Q4_K_M's and at most one more lost answer. Passed: 0.20 times
Q4_K_M's KL, 1 lost against 4.
These numbers measure closeness to BF16, not task quality. Speed is not reported here.
License
Apache 2.0, as the base model's card says; its repository has no LICENSE file, so LICENSE holds the standard
text. The changes are listed in NOTICE. pack_tensix.py and verify_grid.py are by Xylolabs under the same
license. Provided as is, without warranty. Not affiliated with or endorsed by Tenstorrent.
Citation
@misc{gemmateam2026gemma4, title={Gemma 4 Technical Report}, author={Gemma Team}, year={2026}, eprint={2607.02770}, archivePrefix={arXiv}, primaryClass={cs.CL}, url={https://arxiv.org/abs/2607.02770},}