translategemma-4b-it-NVFP4
NVFP4 W4A4 quantization of google/translategemma-4b-it for vLLM on Blackwell GPUs. I calibrated it with GPTQ on European-language translation pairs. This is an unofficial build, not affiliated with Google.
- Weights take 3.1 GiB in vLLM with text-only serving, against 7.4 GiB for BF16. The download is 3.8 GB.
- Batched short-cell translation runs at about 250 to 280 cells/s, 2× BF16's 123.
- COMET-22 on WMT24++ EU pairs is 82.32, against 82.80 for BF16. That's a drop of 0.48.
- vLLM's OpenAI-compatible server accepts a plain-string prompt. Google's structured message format still works.
A 4B model loses more to 4-bit weights and activations than the 12B does. If you can spare the memory, the FP8 build is almost lossless at 176 cells/s. Pick this one when speed or memory matters more than the last half point of COMET.
Every language-model linear layer is NVFP4, which means FP4 weights and activations in groups of 16 with FP8 scales. GPTQ chooses the weight rounding. The vision tower, the projector and the embeddings stay in BF16.
Calibration. 576 OPUS-100 pairs, EN→CS/DE/ES/FR/IT/NL/PL/PT and PL→EN, rendered with the TranslateGemma prompt
followed by the reference translation. The recipe and scripts are in quantization/.
Changes from a plain llm-compressor export
- The duplicate
lm_head.weightis gone. The embeddings are tied, so vLLM never reads it, and the download is 1.3 GB smaller. max_position_embeddingsis 32,768 instead of 131,072. vLLM precomputes the RoPE table of the global layers for 8 ×max_position_embeddingspositions because of the linear ×8 scaling, and that memory comes out of the KV cache. TranslateGemma's own card gives a 2K-token input context.chat_template.jinjaalso accepts<<<source>>>CODE<<<target>>>CODE<<<text>>>TEXTas a plain string or as a single text part. vLLM 0.26's server drops thesource_lang_codeandtarget_lang_codefields from chat messages, so Google's structured format never reaches the template there. The plain-string form renders exactly the same prompt.
I regenerated all 8,640 test segments from this repo with plain-string prompts, and they match the outputs of the
unmodified export. NOTICE lists these changes as the Gemma terms require.
Quality
Test set. All non-canary segments of WMT24++, google/wmt24pp. That's 960 per direction and 8,640 in total,
covering news, social, speech and literary text. EN→X uses the original English source. PL→EN reverses the EN→PL
pair, so the Polish post-edited reference becomes the source and the original English becomes the reference.
Metrics. COMET-22 with Unbabel/wmt22-comet-da, scaled ×100, and corpus chrF from sacrebleu.
Setup. Greedy decoding on vLLM 0.26.0. One desktop RTX 5070 Ti 16 GB, capped at an 11.5 GB budget with
gpu_memory_utilization ≈ 0.74 to mimic a 12 GB laptop GPU.
| EN→CS | EN→DE | EN→ES | EN→FR | EN→IT | EN→NL | EN→PL | EN→PT | PL→EN | All | chrF | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| BF16 reference | 84.43 | 81.86 | 82.80 | 81.24 | 83.84 | 83.46 | 83.77 | 82.60 | 81.16 | 82.80 | 55.4 |
| this model, NVFP4 GPTQ | 83.63 | 81.38 | 82.43 | 80.53 | 83.74 | 83.20 | 82.97 | 82.18 | 80.82 | 82.32 | 54.7 |
Czech and Polish lose the most, about 0.8 each.
Other TranslateGemma-4B builds
Same tests, same 11.5 GB budget. Cells/s comes from 4,000 short cells, EN→X and 1 to 40 words each, submitted in one batch. Structure is protected tokens kept / cells fully intact, from the test described below.
| build | COMET-22 | vs BF16 | structure | cells/s |
|---|---|---|---|---|
| BF16 | 82.80 | – | 81.5% / 84.0% | 123 |
| translategemma-4b-it-FP8 | 82.79 | −0.01 | 80.0% / 82.9% | 176 |
| this model | 82.32 | −0.48 | 72.6% / 74.9% | ~250–280 |
| mydubber-org/translategemma-4b-text-W4A16 | 82.31* | −0.49 | 71.9% / 74.9% | 119 |
| kaitchup/translategemma-4b-it-NVFP4 | 81.82* | −0.98 | 77.0% / 77.1% | ~250–330 |
* Only after a fix on my side. As published on 2026-11-07, kaitchup's generation_config.json has no
eos_token_id, so every generation in vLLM runs until max_tokens; I added [1, 106]. The mydubber repo ships a
generic Gemma chat template instead of TranslateGemma's, which scores 77.73 with many chatty replies; I rendered its
prompts with Google's template.
This model and kaitchup's run at the same speed. Back-to-back runs on one GPU put both between 248 and 327 cells/s, and the spread between runs was larger than the gap between models.
Structure test. 175 Excel-style cells in each of PL, DE, FR, ES and CS, with 270 tokens that must survive
verbatim: {placeholders}, %s, %1$s, {{var}}, ${var}, HTML tags, URLs, e-mails, SKUs, inline code and line
breaks. Even BF16 TranslateGemma-4B keeps only 81.5%. It rewrites <b> tags and translates [PENDING] labels. This
build drops more placeholders on top of that, so check the output if your cells carry them.
Which model to use
On a 12 GB card I'd pick Hy-MT2-7B-NVFP4. On the same tests it scored 84.66 COMET-22, ran 213 cells/s and kept 99.3% of protected tokens with its keep-structure prompt. This build makes sense on 6 to 8 GB cards or next to other models on a shared GPU.
Usage with vLLM
Needs a Blackwell GPU for NVFP4. Tested with vLLM 0.26.0, text only.
vllm serve kurcontko/translategemma-4b-it-NVFP4 --language-model-only --max-model-len 2048 \
--gpu-memory-utilization 0.9
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="-")
text = "Warning: do not exceed 230 V.\nDisconnect power before cleaning."
r = client.chat.completions.create(model="kurcontko/translategemma-4b-it-NVFP4", temperature=0,
messages=[{"role": "user", "content": f"<<<source>>>en<<<target>>>pl<<<text>>>{text}"}])
print(r.choices[0].message.content)
Language codes come from the base model's template, for example en, pl, de-DE, pt-PT or es-MX. With
transformers, the structured message format from the base model card works unchanged.
If the engine fails at start-up while JIT-compiling FlashInfer's sampling kernels with CUDA compiler and CUDA toolkit headers are incompatible, set VLLM_USE_FLASHINFER_SAMPLER=0.
Limitations
- Evaluated on the 9 directions above only, with COMET-22 and chrF. No human evaluation.
- I have not tested image translation with this checkpoint. The vision tower is the unchanged BF16 one.
License
Gemma is provided under and subject to the Gemma Terms of Use found at
ai.google.dev/gemma/terms. Use of this model must comply with the
Gemma Prohibited Use Policy. This repository holds a modified,
quantized version of google/translategemma-4b-it. The changes are listed above and in NOTICE. Calibration data is
OPUS-100.
- Downloads last month
- 20
Model tree for kurcontko/translategemma-4b-it-NVFP4
Base model
google/translategemma-4b-it