Run this model with HF Jobs

Run Xylolabs/gemma-4-12B-it-Tenstorrent-Tensix on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Xylolabs/gemma-4-12B-it-Tenstorrent-Tensix. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Xylolabs/gemma-4-12B-it-Tenstorrent-Tensix on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Xylolabs

gemma-4-12B-it for Tenstorrent Tensix

Base model Formats License Code Tenstorrent Tensix

These weights from google/gemma-4-12B-it are quantized for Tenstorrent Tensix NPUs, with each format in its own folder.

Folders

Folder Formats Size (GB, packed) Mean KL to BF16 Top-1 (%)
Xylolabs BFP4 bfp4/ Attention and MLP bfloat4_b, with the tied LM head and embedding, norms, audio, vision, and all other tensors in bf16 8.146 0.12030 87.96
Xylolabs BFP8 bfp8/ Attention and MLP bfloat8_b, with the tied LM head and embedding, norms, audio, vision, and all other tensors in bf16 13.596 0.00183 98.35

All files and rivals: BENCHMARKS.md

KL and top-1 cover 8,048 positions of English and Korean text (WikiText-2 test, Korean Wikipedia), in the chat template.

How to run

Use Transformers 5.10.0 or later with PyTorch and accelerate.

hf download Xylolabs/gemma-4-12B-it-Tenstorrent-Tensix --include "bfp4/*" --local-dir gemma-4-12B-it-Tenstorrent-Tensix
hf download Xylolabs/gemma-4-12B-it-Tenstorrent-Tensix --include "bfp8/*" --local-dir gemma-4-12B-it-Tenstorrent-Tensix
from transformers import AutoProcessor, Gemma4UnifiedForConditionalGeneration

d = "gemma-4-12B-it-Tenstorrent-Tensix/bfp4"
processor = AutoProcessor.from_pretrained(d)
model = Gemma4UnifiedForConditionalGeneration.from_pretrained(d, dtype="bfloat16", device_map="auto")

messages = [{"role": "user", "content": [{"type": "text", "text": "What is the capital of France?"}]}]
inputs = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=True,
                                       return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=64)
print(processor.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Run on Tensix

Pack one matrix.

import json
import torch
import ttnn
from safetensors import safe_open

d = "gemma-4-12B-it-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 gemma-4-12B-it-Tenstorrent-Tensix/bfp4/pack_tensix.py gemma-4-12B-it-Tenstorrent-Tensix/bfp4
python gemma-4-12B-it-Tenstorrent-Tensix/bfp4/verify_grid.py gemma-4-12B-it-Tenstorrent-Tensix/bfp4

Add --device to pack_tensix.py to round-trip the packed values. For BFP8, replace bfp4 with bfp8 in every path above.

Updates

  • 2026-12-05: Moved the full comparison to BENCHMARKS.md.
  • 2026-11-29: Merged the BFP4 and BFP8 repos into one repo with a folder per format.
  • 2026-11-22: bfp4/ and bfp8/: Corrected the bf16 size in the summary to match the evaluation table.

License

Apache 2.0, as declared by the base model (LICENSE). The changes are listed in NOTICE.

pack_tensix.py and verify_grid.py are from tensix-bfp-gptq commit 5c52065, under the same license.

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},
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Xylolabs/gemma-4-12B-it-Tenstorrent-Tensix

Quantized
(434)
this model

Collections including Xylolabs/gemma-4-12B-it-Tenstorrent-Tensix

Paper for Xylolabs/gemma-4-12B-it-Tenstorrent-Tensix