Gemma-4-26B-AgentCoder
a language model for agentic coding and tool use
2 min read
The Gemma-4-26B-A4B-AgentCoder model was created by Bruno Pistone based on the instruction-tuned google/gemma-4-26B-A4B-it model (around 25.8 billion parameters with an A4B architecture) using GRPO (Group Relative Policy Optimization) with RLAIF (Reinforcement Learning from AI Feedback). The training aimed to improve skills in gathering evidence, selecting appropriate tools, reasoning about root causes of problems, and verifying claims during multi-turn dialogues. The model combines weights in BF16 format and retains the base model's architecture, including image processing components. It is suitable for building advanced programming assistants, repository exploration, and managing scenarios with function calling.
Key features
- Coding specialization: optimized for agentic coding tasks, code analysis, and building multi-turn conversations.
- Tool calling support: trained to correctly select tools and pass arguments using special markup syntax.
- Reasoning control: supports a thinking mode via chat template parameters (
enable_thinking=True). - Efficient fine-tuning: adapted using LoRA on attention mechanisms and MLP projections while keeping visual modules and experts frozen.
What you can do
- IDE integration: embed the model as a local assistant for writing code and searching files.
- Agent creation: set up an autonomous agent to perform multi-step tasks in the terminal or file system using function calling.
- Repository analysis automation: use it to explore code structure, find bugs, and verify hypotheses.
Example
Running response generation using the transformers library:
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
model_path = "."
processor = AutoProcessor.from_pretrained(model_path)
model = AutoModelForImageTextToText.from_pretrained(
model_path,
dtype="auto",
device_map="auto",
attn_implementation="sdpa",
)
model.eval()
messages = [
{
"role": "user",
"content":
[
{
"type": "text",
"text": "Write a Python function that returns the largest file in a directory.",
}
],
}
]
inputs = processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
enable_thinking=False,
).to(model.device)
with torch.inference_mode():
output = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=1.0,
top_p=0.95,
top_k=64,
)
print(processor.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Read more
Details• License: Apache 2.0 (Google Gemma 4 License).
• Architecture:
Gemma4ForConditionalGeneration, 30 text decoder layers, 128 routed experts with top-8 routing.• Hardware requirements: the model contains 32 safetensors shards with a total weight of about 51.61 GB; running it requires a powerful accelerator.
• Training: 230 optimization steps using a Kimi K3.1 judge via Amazon Bedrock.










Comments