translategemma_nvfp4_gguf
GGUF conversion of kaitchup/translategemma-4b-it-NVFP4 (compressed-tensors NVFP4 checkpoint),
converted with convert_hf_to_gguf.py from llama.cpp. Weights are NVFP4; token_embd and output
stay BF16. Size about 4.5 GB.
Important: needs a patched llama.cpp
Stock llama.cpp builds produce NaN / junk tokens (<unusedNN>) with this file, because
src/models/gemma3.cpp does not pass the FFN scale tensors (ffn_up_s, ffn_gate_s, ffn_down_s)
to build_ffn. gemma3-ffn-scale.patch fixes this. Once the fix is merged upstream, the patch will
no longer be needed.
The patch was tested on llama.cpp commit f2cc7282ce0042641df55e0e563b75e824e2b647 (2026-10-11). On newer commits it may need a small manual adjustment.
Usage
./build_and_run.sh clones llama.cpp, applies the patch, builds with CUDA (Blackwell, arch 120a),
and starts llama-server. Then:
curl http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"messages": [{"role": "user", "content": "Artificial intelligence is changing the world."}],
"chat_template_kwargs": {"source_lang_code": "en", "target_lang_code": "ar"},
"max_tokens": 256, "temperature": 0
}'
Tested on RTX 5060 Ti: correct en to ar output, about 95-100 tokens/s.
For other GPUs, change CMAKE_CUDA_ARCHITECTURES (the native FP4 path needs Blackwell).
Credits and license
Base model: Google TranslateGemma. Quantized checkpoint: kaitchup. This repo is subject to the Gemma Terms of Use.