Downloads · 30 days
22
4% of all-time downloads
code-and-canvas/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-MLX-OptiQ-8bit
gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-MLX-OptiQ-8bit is a machine learning model from code-and-canvas. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Gemma 4 12B - Agentic & Coding (MLX 8-bit OptiQ)
Downloads · 30 days
22
4% of all-time downloads
All-time downloads
513
Public
Parameters
11.9B
8.9 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors8.9 GB · 100%
How the weights are stored.
U322B · 85%
From the Hugging Face model README
Gemma 4 12B - Agentic & Coding (MLX 8-bit OptiQ)
An 8-bit quantized, Apple Silicon-optimized version of the agentic Gemma 4 12B model, fine-tuned for coding, terminal usage, tool-use, and multi-step reasoning. Built on top of yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2 and quantized with OptiQ for higher precision inference on MLX.
| Feature | Details |
|---|---|
| Base Model | google/gemma-4-12B-it |
| Fine-tune | yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2 |
| Quantization | 8-bit OptiQ (affine mode, group_size=64) |
| Framework | MLX (Optimized for Apple Silicon: M1/M2/M3/M4, macOS) |
| Architecture | Gemma4UnifiedForConditionalGeneration (supports text, image, audio, video tokens) |
| Parameters | 12B |
| Context Length | 262,144 tokens (sliding window: 1024) |
| License | Apache 2.0 |
| Download Size | ~13.4 GB (safetensors) |
✅ Coding – Writes, debugs, and explains code (Python, JavaScript, etc.) with chain-of-thought reasoning.
✅ Agentic Workflows – Uses tools, terminal commands, and multi-step reasoning (e.g., grep, ls, cat).
✅ Tool-Use – Emits structured Gemma 4 native tool calls (compatible with OpenAI-style tools API).
✅ Multimodal Ready – Supports image, audio, and video tokens (token IDs: 258880, 258881, 258884).
✅ Grounded Reasoning – Does not fabricate file paths, function signatures, or values (0% hallucination rate in testing).
✅ Higher Precision – 8-bit quantization retains more accuracy than 4-bit, ideal for tasks requiring finer detail.
| Benchmark | Score | Notes |
|---|---|---|
| tau2-bench telecom | ~55% | 3.5× better than base gemma-4-12B-it (~15%) on agentic tasks. |
| MMLU-Pro | Slightly ↓ | Trade-off for coding/agentic specialization (expected). |
| Fabrication Probe | 0% | No hallucinations (matches base model grounding). |
🔬 Methodology: Local evaluation, Q8_0 quant, greedy decoding, self-simulated user, 20 tasks. Not directly comparable to published leaderboards (different harness/user simulator).
✨ 8-bit vs 4-bit: Higher precision (8-bit) typically yields better accuracy for complex reasoning and coding tasks, at the cost of ~2× larger model size (~13.4 GB vs ~6.7 GB).
pip install mlx mlx-lm transformers
from mlx_lm import load, generate
model, tokenizer = load("code-and-canvas/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-MLX-OptiQ-8bit")
prompt = """Write a Python function to check if a string is a valid IPv4 address."""
response = generate(model, tokenizer, prompt=prompt, temp=1.0, top_p=0.95)
print(response)
messages = [
{"role": "user", "content": "Explain quantum computing in simple terms."}
]
# Enable thinking (default: True)
response = generate(
model,
tokenizer,
prompt=tokenizer.apply_chat_template(messages, add_generation_prompt=True),
temp=1.0,
top_p=0.95,
max_tokens=512
)
print(response)
The model emits Gemma 4 native tool calls (e.g., <|tool_call>call:grep{...}<tool_call|>).
Use with llama.cpp (recommended for agents):
# Requires a recent llama.cpp with gemma4_unified support
llama-server \
-m gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-MLX-OptiQ-8bit-Q8_0.gguf \
--jinja \
-ngl 99 \
--tools your_tools.json
| Setting | Value |
|---|---|
| Quantization | 8-bit (OptiQ, affine, group_size=64) |
| Hidden Size | 3,840 |
| Attention Heads | 16 |
| Intermediate Size | 15,360 |
| Layers | 48 |
| Sliding Window | 1,024 |
| Max Position Embeddings | 262,144 |
| Vocab Size | 262,144 |
{
"temperature": 1.0,
"top_k": 64,
"top_p": 0.95,
"do_sample": true,
"bos_token_id": 2,
"eos_token_id": [1, 106, 50],
"pad_token_id": 0
}
| Token Type | ID |
|---|---|
| BOS | 2 |
| EOS | 1, 106, 50 |
| PAD | 0 |
| Image | 258880 |
| Audio | 258881 |
| Video | 258884 |
| BOA (Begin Audio) | 256000 |
| BOI (Begin Image) | 255999 |
| EOI (End Image) | 258882 |
| EOA (End Audio) | 258883 |
| File | Description |
|---|---|
config.json | Model architecture and quantization config (8-bit OptiQ). |
generation_config.json | Default generation parameters. |
chat_template.jinja | Jinja template for chat formatting (supports thinking, tool calls, multimodal). |
model-*.safetensors | Quantized model weights (8-bit OptiQ). |
tokenizer.json | Tokenizer configuration. |
tokenizer_config.json | Tokenizer metadata. |
grep, ls, cat, etc.| Aspect | 4-bit | 8-bit |
|---|---|---|
| Model Size | ~6.7 GB | ~13.4 GB |
| Precision | Lower | Higher |
| Speed | Faster | Slightly slower |
| VRAM Usage | Lower | Higher |
| Accuracy | Good | Better |
💡 Choose 8-bit if:
- You need higher accuracy for complex tasks.
- You have enough VRAM/storage (~13.4 GB).
- You prioritize quality over speed.
google/gemma-4-12B-it (Google’s instruction-tuned Gemma 4).yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2
Apache 2.0 – Free to use, modify, and redistribute. (Inherited from Google’s Gemma 4 release.)
Write a Python script to:
1. Read a CSV file.
2. Clean missing values.
3. Plot a histogram of the first numeric column.
I have a file called data.json. How do I:
1. Check if it exists?
2. Count the number of lines?
3. Extract all email addresses from it?
You are a terminal assistant. Use tools to help the user.
User: List all Python files in /home/user/projects and count their lines.
[Image of a Python error traceback]
What is causing this error, and how do I fix it?
🚀 Happy Hacking! Built with ❤️ by Code and Canvas.