Run this model with HF Jobs
Run google/gemma-4-E2B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/google/gemma-4-E2B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/google/gemma-4-E2B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use google/gemma-4-E2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-4-E2B with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("google/gemma-4-E2B") model = AutoModelForMultimodalLM.from_pretrained("google/gemma-4-E2B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
[Bug] Reasoning content is being redacted by the chat template
I’m seeing that the current chat template does not render reasoning (reasoning / reasoning_content) for standard assistant messages unless tool_calls are present.
This makes it unclear whether this is intended behavior or a limitation/bug in the template logic.
Minimal Repro:
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a short joke about saving RAM."},
{
"role": "assistant",
"reasoning": "Need a short memory pun.",
"content": "I wrote a RAM joke, but I forgot to cache it."
},
]
print(tokenizer.apply_chat_template(
conversation=messages,
tokenize=False,
add_generation_prompt=False,
enable_thinking=True
))
Observed Behavior:
Output does not include the reasoning:
<bos><|turn>system
<|think|>
You are a helpful assistant.
<turn|>
<|turn>user Write a short joke about saving RAM.
<turn|>
<|turn>model I wrote a RAM joke, but I forgot to cache it.<turn|>
Expected Behavior:
If reasoning (or reasoning_content) is present, I would expect it to be rendered, e.g.:
<bos><|turn>system
<|think|>
You are a helpful assistant.<turn|>
<|turn>user
Write a short joke about saving RAM.<turn|>
<|turn>model
<|channel>thought
Need a short memory pun.
<channel|>
I wrote a RAM joke, but I forgot to cache it.<turn|>
This bevaviour is however common in HF as well as unsloth.
Relevant Template Logic:
{%- if thinking_text and loop.index0 > ns_turn.last_user_idx and message.get('tool_calls') -%}
This effectively prevents reasoning from being emitted for:
non-tool-call assistant messages
standard chat use cases
Questions:
Is reasoning intentionally restricted to tool-call flows?
Should enable_thinking=True also enable reasoning rendering for normal assistant messages?
Would it be acceptable to relax the condition to something like:
{%- if role == 'model' and thinking_text -%}
or gate it via enable_thinking instead?
Why this matters:
Limits usability of reasoning for standard chat scenarios
Makes enable_thinking behavior unclear/incomplete
Prevents consistent debugging/inspection of model reasoning