Downloads · 30 days
312
4% of all-time downloads
HackAfterDark/gemma-4-e4b-it-mtp-assistant-ultralight
gemma-4-e4b-it-mtp-assistant-ultralight is a machine learning model from HackAfterDark. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for gguf. The card lists the license as apache-2.0.
This is a custom-converted Multi-Token Prediction (MTP) drafter for Google Gemma 4 7.5B. It has been surgically optimized to provide massive speedups (40-60+ t/s) on consumer-grade hardware like the NVIDIA RTX 3060.
Downloads · 30 days
312
4% of all-time downloads
All-time downloads
8.8K
Public
Repo size
834 MB
Likes
13
Public
Click a slice to open those files.
.gguf834 MB · 100%
From the Hugging Face model README
This is a custom-converted Multi-Token Prediction (MTP) drafter for Google Gemma 4 7.5B. It has been surgically optimized to provide massive speedups (40-60+ t/s) on consumer-grade hardware like the NVIDIA RTX 3060.
Unlike standard conversions that pad the assistant to match the main model's 7.5B footprint, this version uses a Bridge-Slicing Strategy:
Despite the heavy pruning, this drafter maintains a high acceptance rate (0.70 - 1.00) on common tasks, effectively doubling or tripling generation speed.
🛠️ How to Replicate the GGUF Conversion
If you want to modify the architecture further or audit the process, use the following uv command. This ensures the environment has the latest gguf-py logic required for MTP.
Prerequisites: Install uv.
uv run \
--with torch \
--with sentencepiece \
--with transformers \
--with safetensors \
--with numpy \
--with "gguf @ git+https://github.com/ggml-org/llama.cpp.git#subdirectory=gguf-py" \
python ./convert_hf_to_gguf_latest.py \
./path/to/gemma-4-assistant-hf/ \
--outfile ./gemma-4-e4b-it-mtp-assistant-ultralight.f16.gguf \
--outtype f16
This was tested on a Dell Precision T7910 (yup, it's old, I know) with dual Xeons, 64GB system RAM and an RTX 3060 with 12GB VRAM. If you are using an RTX 3060 you can start with the example below and tune it from there.
Note: If you are on a multi-socket system, taskset is highly recommended to eliminate NUMA latency (ie. taskset -c 0-11 ./llama-server ...).
./llama-server \
--model ./gemma-4-E4B-it-Q4_K_M.gguf \
--model-draft ./gemma-4-e4b-it-mtp-assistant-ultralight.f16.gguf \
-c 32768 \
-np 1 \
-ngl 43 \
--swa-full \
--kv-unified \
--cache-type-k q4_0 \
--cache-type-v q4_0 \
--spec-draft-n-max 8 \
-b 128 -ub 128 \
-t 12 -tb 12 \
--flash-attn on \
--mlock \
--no-numa \
--jinja
--swa-full: Mandatory for Gemma 4 to prevent KV cache re-processing loops.--spec-draft-n-max 8: 8 to 12 is seems to be the sweet spot for this drafter. It allows for a long enough stride without tanking the acceptance rate.--kv-unified: Allows the main model and drafter to share prompt context memory.-b 128 / -ub 128: Keeps the batch size tight for lower latency during the "verify" phase.💡 Note on Performance: On the RTX 3060, the standard llama.cpp (without MTP) is currently faster due to memory bandwidth saturation. This MTP Drafter is primarily intended for 3090/4090 users or researchers looking to exploit Multi-Token Prediction architecture.
Using llama.cpp (Without MTP)
Why does inference (without MTP) actually hits higher peak tokens-per-second (57 t/s) than the MTP-enabled setup (49 t/s) on the RTX 3060. Here is why:
The conversion was performed using a modified hf-to-gguf script that implements a resilient mapper for the MTP bridge. It slices the 2560-width hidden state of the main model down to 256 for the assistant while maintaining the 4-layer MTP head structure.
Architecture: Gemma4 (MTP-enabled)
Precision: F16
Layers: 4 (Assistant)
Params: ~407M (Effective)
If you find this "Ultra-Light" drafter useful, feel free to reach out or tag me in your benchmarks!