Instructions to use google/gemma-4-E2B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-4-E2B-it with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("google/gemma-4-E2B-it") model = AutoModelForMultimodalLM.from_pretrained("google/gemma-4-E2B-it", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- AMD Developer Cloud
Weak at generating structured output.
Hello Google team,
This model is pretty weak when I requires it generate structured output, like json one.
Hope you guys will improve it in the gemma5.
Thank a lot.
@panaga10
I use LangChain with response_format (https://docs.langchain.com/oss/python/langchain/structured-output).
Basically, I use the same system prompt, output structure, etc., and only switch between models, such as Gemma 4 E2B, E4B, and 12B.
- The E2B model often fails to generate the structured output, and many APIs are called (through vLLM) before the correct output is generated.
- The E4B is much better.
- The 12B rarely fails.
I can’t share my code or data, sorry about that.
I’m looking for a truly small model (under 4B) for an assistant, so I have tried the models above. I see that E2B is very fast, but it’s pretty weak when searching web content (finding data from web pages). E4B is better, while 12B is strong enough.