Skip to content
Computer vision

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 moreDetails
• 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.
Discuss Telegram 0

Will it run?

Runs in 4-bit

Full precision does not fit, a quantised version does: quality barely changes down to 8 bits, more noticeably at 4 bits.

  • BF16weights 48 GB · ready files53 GB
  • FP8 / INT8recommendedweights 24 GB27 GB
  • 4-bitweights 14 GB15 GB

Tip: go 8-bit.FP8 / INT8 is within about a percent of full precision in quality, takes half the memory and runs faster on RTX 40/50 and H100. Full precision only pays off for fine-tuning.

Estimate: weights plus working memory. Long videos, high resolutions and long contexts need more.

Run it on Massed Compute

The script downloads the model to the rented machine. How to run it is in the model card.

  1. 1. Rent a machine with a fitting GPU

    Open Massed Compute
  2. 2. Paste the script into the machine's terminal

    Connect over SSH (the Massed Compute panel shows the command) or open a terminal on the machine's desktop.

    HF_TOKEN / CIVITAI_TOKENThe script starts with token lines: paste yours between the quotes. The Hugging Face token is for gated models, the Civitai one for Civitai models.

    # br1-pist/Gemma-4-27B-AgentCoder
    mkdir -p ~/models
    curl -LsSf https://astral.sh/uv/install.sh | sh
    source "$HOME/.local/bin/env"
    uv tool install "huggingface_hub[cli]"
    hf download br1-pist/Gemma-4-27B-AgentCoder --local-dir ~/models/Gemma-4-27B-AgentCoder
    # The model is in ~/models. How to run it is in the model card (link above).
    Add more LoRAs to Gemma-4-27B-AgentCoder
  3. 3. Use it

    The model is in ~/models. How to run it is in the model card (link above).

Stop the machine in the panel when you are done: it bills by the minute while it runs.

How to speed it up

Picked for this model type. Choose your hardware above to see what fits you exactly.

  • FlashAttention 44.0.0b40from November 18, 2026new release

    fastest exact attention on B200

    Kernels for Blackwell (beta). Exact attention without quantisation — fine for everything, LLMs included.

    How to enable: pip install flash-attn-4; vLLM and SGLang pick it up themselves.

    Earlier generations (2)
    • FlashAttention 3 — The Hopper (H100/H200) version with FP8.
    • FlashAttention 2 — The standard for RTX 30/40/50 and A100: exact attention without the memory cost of long contexts.
  • torch.compile2.15.0from October 28, 2026new release

    10–30% for free

    Compiles the model for your GPU. Slower first run, faster afterwards.

    How to enable: model = torch.compile(model); in ComfyUI the TorchCompileModel node.

Model family

  1. gemma-4-26B-A4Bfamily root
  2. gemma-4-26B-A4B-it
  3. Gemma-4-27B-AgentCoder

New posts about versions of gemma-4-26B-A4B (quants, finetunes, LoRAs) will show up under the bell.

Quantised versions 12All on Hugging Face
Fine-tunes 12All on Hugging Face
Merges 5All on Hugging Face

About the model

br1-pist/Gemma-4-27B-AgentCoder
Author
br1-pist
Category
Computer vision
Released
Posted

On NeyroLearn

Hugging Face

00

Ask AI about this model

Answered by Gemini 4 · the chat is kept only in this tab

Comments