Gemma 4 E4B MTP drafter (ONNX, WebGPU)
Files for multi-token-prediction (speculative) decoding of Gemma 4 E4B in the browser with onnxruntime-web.
onnx/model_chain2_q4.onnx: two draft steps ofgoogle/gemma-4-E4B-it-assistantin one graph, with the target's own 4-bit token embedding and the argmax. Weights 4-bit (MatMulNBits, block 32), math in float32.onnx/decoder_model_merged_q4f16_hidden.onnx: the graph ofonnx-community/gemma-4-E4B-it-ONNXdecoder_model_merged_q4f16.onnxwith one added output,mtp_hidden(the final-norm hidden state). It has no weights: load it with the upstreamdecoder_model_merged_q4f16.onnx_dataanddecoder_model_merged_q4f16.onnx_data_1as external data.
Build: ONNX_CONVERSION/tools/export_gemma4_target_hidden.py and
export_gemma4_drafter_chain.py in the WebGPU Platform repository.
Parity: at context lengths 37, 511, 513, 514, 1500, 3000, each draft step picks the same token as the Hugging Face reference forward when both get the same step input, and the embedding equals the target's own within one float16 step.
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support
Model tree for RASMUS/gemma-4-E4B-it-mtp-ONNX
Base model
google/gemma-4-E4B-it-assistant