Model guide
Gemma 4 E2B Instruct
Gemma 4 E2B is the smaller effective-parameter option for text, image and supported audio-input workflows. Its stored weights are larger than the E2B label suggests because the model includes per-layer embeddings. Use the exact modality setup below; an audio example may use different files from the GGUF text-and-image path.
At a glance
- Parameters
- 5.12B
- Accepts
- Text · Image · Audio
- Returns
- Text
- Published context limit
- 131,072 tokens
- Model format
- safetensors · GGUF
- Software and download hosts
- Ollama · MLX. Follow the exact setup below; this list does not establish support for every format, input type or software version.
- Suggested compression
- Q4_K_M
- Model-weight download
- Q4_K_M weights · 3.43 GBlmstudio-community (community conversion)gemma-4-E2B-it-Q4_K_M.gguf
- Media companion download
- mmproj-gemma-4-E2B-it-BF16.gguf · 0.99 GB. Both downloads total 4.41 GB.
- Languages
- 35+ supported languages; pre-trained on 140+ languages
- License
- Apache 2.0
Will it fit?
Gemma 4 E2B Instruct · Q4_K_M download. Fit depends on your computer, the app you run it in and the conversation length you need. Audio processing and media companion files need additional memory.
Check on your computerBest for
- Try the smaller Gemma 4 E model on the pictured entrance notice. Check the day and entrance before moving to a larger download.
Choose something else when
- The image exercise does not test audio. Use the separate native setup for that input.
Using image input
Image setup: follow the image check.
Using audio
Use a client that supports this exact model's audio pipeline and the matching media companion when required. A text-only chat does not use speech. Measure peak memory for your audio workload.
First setup
Check a representative task
Check one image through a supported Gemma 4 E2B image path; this does not test audio.
Setup for this check: Open llama.cpp image setup and start the server with the matching projector.
In the llama.cpp vision session, attach this image and paste the question below. Keep the answer key out of the prompt. Crop to the table if you cannot save the image.
Which entrance should a visitor use on the closure day? State the day as well. Do not invent opening hours.
Check the result: South entrance on Tuesday; no opening hours are provided.
The image attachment and matching image-processing components must actually be loaded. A text-only run, or an answer inferred from pasted text, does not pass the image check. This small fixture does not establish accuracy on scans, complex charts or real documents.
For audio, use the publisher's Transformers workflow with google/gemma-4-E2B-it. This downloads native weights, not the smaller GGUF listed on this page; dtype and device allocation change memory needs. Install python -m pip install -U transformers torch torchvision librosa accelerate. Use a Transformers release containing AutoModelForMultimodalLM and Gemma 4 support; update it if either is unavailable.
Record a short non-sensitive WAV saying “The meeting starts at ten thirty” as meeting.wav beside example.py. Save and run:
from transformers import AutoProcessor, AutoModelForMultimodalLM
repo = "google/gemma-4-E2B-it"
processor = AutoProcessor.from_pretrained(repo)
model = AutoModelForMultimodalLM.from_pretrained(repo, dtype="auto", device_map="auto")
messages = [{"role": "user", "content": [
{"type": "text", "text": "Transcribe this English speech into English text."},
{"type": "audio", "audio": "meeting.wav"}
]}]
inputs = processor.apply_chat_template(messages, tokenize=True, return_dict=True,
return_tensors="pt", add_generation_prompt=True).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Run python example.py. Check that the transcription preserves 10:30; output is text, not spoken audio. Keep audio below the publisher's 30-second limit. An allocation error means this native workflow needs more memory or a different supported allocation.
For an image check in the same program, replace messages with the following, using a local photo meeting.png of a note reading Meeting 10:30:
messages = [{"role": "user", "content": [
{"type": "image", "url": "meeting.png"},
{"type": "text", "text": "What meeting time is written here?"}
]}]
Keep image content before text, rerun the input-processing and generation lines, and check the answer against the photo. An interrupted response is not a completed answer.
This creates a 4,096-token copy of gemma4:e2b-it-q4_K_M named gemma-4-e2b-it-short-context. Save the following as a file named Modelfile in your working folder:
FROM gemma4:e2b-it-q4_K_M
PARAMETER num_ctx 4096
Then run these commands from that folder:
ollama pull gemma4:e2b-it-q4_K_M
ollama create gemma-4-e2b-it-short-context -f ./Modelfile
ollama run gemma-4-e2b-it-short-context
Run the task check. Attach the image in a client that supports image input for this model. While the model is loaded, run ollama ps in another terminal and check CONTEXT and PROCESSOR.
The recorded Ollama package is Q4_K_M: 3.50 GB of model weights and 0.99 GB of media companion weights, plus 0.10 GB for its bundled draft model. Use Ollama 0.30.9 or a supporting newer release. A Hugging Face GGUF or MLX checkpoint is a separate representation; choose the matching source and runner in the memory calculator.
See Ollama context settings and the Modelfile instructions.
Open LM Studio’s Discover tab, search for lmstudio-community/gemma-4-E2B-it-GGUF, and download gemma-4-E2B-it-Q4_K_M.gguf (Q4_K_M, 3.43 GB). See the download files. Select the file in Chat, set context to 4,096, then load it. These instructions load text only. To run the image task check, select the llama.cpp tab and complete its matching-projector setup. Do not assume that loading this file in LM Studio also loaded its image components. If it will not load, open LM Studio Model Will Not Load.
Open a terminal in the extracted llama.cpp release folder. On Windows, replace ./llama-server below with .\llama-server.exe:
Image input with mmproj-gemma-4-E2B-it-BF16.gguf
Download mmproj-gemma-4-E2B-it-BF16.gguf into the extracted llama.cpp folder.
./llama-server -hf lmstudio-community/gemma-4-E2B-it-GGUF -hff gemma-4-E2B-it-Q4_K_M.gguf --mmproj "mmproj-gemma-4-E2B-it-BF16.gguf" -c 4096 --host 127.0.0.1 --port 8080
Open the local chat at http://127.0.0.1:8080, attach the image from the task check, and run that check. Press Ctrl+C in the server terminal before switching to the text-only setup.
Text only
./llama-server -hf lmstudio-community/gemma-4-E2B-it-GGUF -hff gemma-4-E2B-it-Q4_K_M.gguf --no-mmproj -c 4096 --host 127.0.0.1 --port 8080
The server downloads the selected model. Wait for the model to load, then open http://127.0.0.1:8080 in your browser. Keep the server terminal open; press Ctrl+C there to stop the server. The file list identifies the exact download. If the command fails: Unknown architecture? Update the runner. Allocation failed? Retry with less context or a smaller weight file. This command deliberately disables the projector for a text-only baseline.
Load the model, start a fresh chat and time your usual prompt. Record time until the first useful word and time until the full answer. Note the processor, context and output length when comparing another run. Use the same picture at the same resolution.
