stamsam/Gemma_4_Gem_e4b_multimodal-NF4
<div align="center"><img src="Gem%20e4b.png" alt="Gemma 4 Gem E4B" width="80%"><br><br><b>Format: 4-bit NF4</b> | <b>Base: google/gemma-4-E4B-it</b> | <b>4.5B effective / ~8B incl. embeddings</b></div>
Gemma 4 Gem E4B Multimodal
A fine-tuned version of google/gemma-4-E4B-it optimized for local coding, tool use, instruction following, and structured output. Trained on an H100 via 5-stage distillation pipeline (SFT + DPO + HF curriculum augmentation).
Hard fails reduced by 76% vs stock E4B (17 → 4 on full40 benchmark).
Model Details
This model includes the original vision and audio encoders from google/gemma-4-E4B-it, allowing it to process images, audio, and text inputs. The text backbone has been fine-tuned; vision/audio encoders are from the base model.
Training Datasets
- stage_elite_blend (1,920 rows) — Openthoughts/Hermes/XLam gold-standard reasoning
- Agentic CoT Coding SFT (429 rows) — Multi-step coding agent tasks
- Glaive Function Calling v2 (1,000 rows) — Tool-use and JSON schema compliance
Benchmark Results
Comparison against stock google/gemma-4-E4B-it (4-bit):
Leaderboard Context
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "stamsam/Gemma_4_Gem_e4b_multimodal_4-bit-NF4"
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_path,
device_map="auto",
torch_dtype="auto",
trust_remote_code=True,
)
messages = [{"role": "user", "content": "Write a function to deduplicate a list"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))Training Details
- Hardware: NVIDIA H100 80GB SXM
- Framework: PyTorch 2.11 + PEFT + bitsandbytes 4-bit QLoRA
- LoRA config: r=8, alpha=16, targetmodules=q/k/v/o/gate/up/downproj
- Training time: ~30 minutes total across all stages
