33 Downloads Updated 1 week ago
ollama run brnpistone/Gemma-4-26B-AgentCoder-q4-k-m
Updated 1 week ago
1 week ago
45b78962100d · 18GB
Q4_K_M GGUF edition of Gemma-4-26B-A4B-AgentCoder, with an FP16 vision projector, packaged for Ollama.
This package contains the quantized version of Bruno Pistone’s Gemma 4 AgentCoder fine-tune. The source model was post-trained with Group Relative Policy Optimization (GRPO) and Reinforcement Learning from AI Feedback (RLAIF) for agentic coding and multi-turn tool-use conversations.
The language-model weights use Q4_K_M quantization. A separate FP16 vision projector is included in the Ollama package for image inputs. Ollama reports support for text completion, vision, tool calling, and thinking.
Training adapted language attention and shared MLP projections with LoRA. Vision modules and fused routed-expert parameters remained frozen. The GRPO examples contained text and recorded tool responses; the training process did not execute tools or train on images/video.
The training results below describe the source fine-tune before quantization. They are not measurements of Q4_K_M quality, speed, or accuracy.
Install Ollama 0.40.18 or newer, then pull and run the published model:
ollama pull brnpistone/Gemma-4-26B-AgentCoder-q4-k-m
ollama run brnpistone/Gemma-4-26B-AgentCoder-q4-k-m
The pull includes both the text model and the vision projector.
curl http://localhost:11434/api/chat \
-H 'Content-Type: application/json' \
-d '{
"model": "brnpistone/Gemma-4-26B-AgentCoder-q4-k-m",
"messages": [
{"role": "user", "content": "Write a Python function that returns the largest file in a directory."}
],
"think": false,
"stream": false
}'
The answer is returned in message.content. Set think to true to enable reasoning; Ollama returns reasoning in message.thinking. The currently published model defaults to thinking enabled.
Install the Python client if needed:
pip install -U ollama
Pass a local image through the message’s images field:
from ollama import chat
response = chat(
model="brnpistone/Gemma-4-26B-AgentCoder-q4-k-m",
messages=[
{
"role": "user",
"content": "Describe this image and identify any visible error messages.",
"images": ["./image.png"],
}
],
think=False,
)
print(response.message.content)
The image capability is inherited from Gemma 4. Image quality was not evaluated by the text/tool-use GRPO run or by a separate quantized-model evaluation.
Pass function schemas through Ollama’s tools field:
from ollama import chat
response = chat(
model="brnpistone/Gemma-4-26B-AgentCoder-q4-k-m",
messages=[{"role": "user", "content": "List the files in /tmp."}],
tools=[
{
"type": "function",
"function": {
"name": "list_files",
"description": "List the files in a directory.",
"parameters": {
"type": "object",
"properties": {"path": {"type": "string"}},
"required": ["path"],
},
},
}
],
think=True,
)
for call in response.message.tool_calls or []:
print(call.function.name, call.function.arguments)
The model requests tool calls; the calling application executes the functions. To continue a conversation, append the returned assistant message and the corresponding tool-result messages, then call chat again. Ollama handles Gemma’s tool protocol and exposes structured tool_calls; callers do not need to construct the model’s special tokens manually.
These are the settings in the published package:
| Setting | Value |
|---|---|
| Temperature | 1.0 |
| Top-p | 0.95 |
| Top-k | 64 |
| Repeat penalty | 1.0 |
| Stop strings | <eos>, <turn\|>, <\|tool_response> |
| Configured model context limit | 262,144 tokens |
| Thinking controls | think: true / think: false |
The context limit is the model’s configured maximum. Ollama’s allocated context depends on runtime settings and available memory; options.num_ctx can set the requested context length per API call. Allow additional RAM/VRAM for context and runtime buffers beyond the weight-file sizes below.
The package uses Ollama’s built-in Gemma 4 renderer (gemma4, resolved as gemma4-large for this model) and the gemma4 output parser. The stored Modelfile also contains an explicit Go TEMPLATE, but the built-in renderer takes precedence at runtime. Inspect the package with:
ollama show brnpistone/Gemma-4-26B-AgentCoder-q4-k-m
ollama show brnpistone/Gemma-4-26B-AgentCoder-q4-k-m --modelfile
Use the model’s packaged prompt handling and stop strings when serving. The <|tool_response> stop marks a tool handoff, allowing the application to supply the real tool result.
The published Ollama manifest includes these two GGUF weight layers:
| Component | Quantization | Size |
|---|---|---|
| Text model | Q4_K_M | 16.796 GB / 15.643 GiB |
| Vision projector | FP16 | 1.193 GB / 1.111 GiB |
| Total weight files | Mixed, as above | 17.989 GB / 16.754 GiB |
The corresponding local filenames are google-gemma-4-26b-agentcoder-q4-k-m.gguf and mmproj-google-gemma-4-26b-agentcoder-f16.gguf. Pulling the Ollama model manages these layers automatically.
| Architecture property | Value |
|---|---|
| GGUF family | gemma4 |
| Text-model parameters reported by Ollama | 25.2B |
| Full source model, including vision | Approximately 25.81B parameters |
| Active parameters | Approximately 4B per token, following the base A4B architecture |
| Text decoder layers | 30: 25 sliding-attention and 5 global-attention layers |
| Hidden size | 2,816 |
| Routed experts | 128, with top-8 routing |
| Sliding attention window | 1,024 tokens |
| Global / sliding attention head dimension | 512 / 256 |
| Vision encoder | 27 layers, hidden size 1,152 |
| Inputs / outputs | Text and images / generated text and structured tool calls |
Quantization reduces weight storage and can change generation quality. No BF16-versus-Q4_K_M accuracy comparison or throughput benchmark is reported for this package.
The settings and results in this section were checked against the submitted args.yaml, saved LoRA adapter configuration, final trainer_state.json, train_results.json, and SageMaker job records.
| Run property | Verified value |
|---|---|
| Training job | gemma4-26b-a4b-grpo-2026-11-23-18-39-49-038 |
| Dates | November 23–24, 2026 |
| Region / status | us-east-1 / Completed |
| Hardware | 2 × ml.p5.48xlarge, totaling 16 × H100 80 GB |
| Training method | GRPO with an LLM judge; DAPO loss and group reward scaling |
| Judge | Kimi K3.1 through Amazon Bedrock |
| Judge score | Rubric score from 0 to 10, normalized to 0–1 |
| Epochs / optimizer steps | 1 / 230 |
| Trainer runtime | 78,581.65 seconds, approximately 21 h 49 min 42 s |
| SageMaker-reported training / billable duration | 79,034 seconds, approximately 21 h 57 min 14 s |
The judge rubric rewards gathering relevant evidence, selecting tools with usable arguments, identifying root causes, and verifying results. It penalizes unsupported claims, choosing a tool without calling it, wrong-tool calls, symptom-only fixes, and padding. It judges the next assistant turn rather than requiring the entire user task to finish in that turn.
| Parameter | Value |
|---|---|
| Generations per prompt | 8 |
| Steps per generation | 2 |
| Per-device training batch size | 2 |
| Gradient accumulation | 4 |
| Effective optimizer-step batch | 128 completions / 16 prompts across 16 GPUs |
| Maximum completion length | 768 tokens |
| Truncated completions | Masked out of the policy loss |
| Sampling temperature | 1.0 |
KL coefficient (beta) |
0.04 |
| Loss / reward scaling | dapo / group |
| Learning rate | 1.68e-6 |
| Scheduler / warmup | Cosine / 23 steps |
| Optimizer | adamw_torch_fused |
| Weight decay / maximum gradient norm | 0.01 / 0.5 |
| Seed | 42 |
| Precision / attention | BF16 / PyTorch SDPA |
| Parallelism | FSDP2 hybrid sharding: 8-way sharding within each node, replication across 2 nodes |
| Activation checkpointing | Enabled through FSDP |
| Evaluation strategy | no |
self_attn.q_proj, k_proj, v_proj, o_proj, and shared mlp.gate_proj, up_proj, down_proj modules.| Split | Decision points | Distinct initial user requests |
|---|---|---|
| Training | 3,686 | 468 |
| Validation | 334 | 51 |
| Total | 4,020 | 519 |
The local prepared datasets match the S3 objects supplied to this job. There is no overlap in initial user-request content between the two splits.
Each row contains a serialized conversation in prompt, a reference next-turn answer, rejection_type, and turn_index. The histories include system, user, assistant, and recorded tool messages. Rejection categories cover wrong tools, speculation without action, and failing to call a tool with or without reasoning.
The validation split was provided to the job, but automatic evaluation was disabled. No held-out score is reported for this run.
The following table averages the per-step values in the final trainer_state.json. “Early” means optimizer steps 1–23; “late” means steps 208–230. These are the first and last 10% of the 230-step run.
| Metric | Early mean | Late mean |
|---|---|---|
| Judge reward, 0–1 | 0.7350 | 0.7252 |
| Completion length, tokens | 230.11 | 228.79 |
| Clipped completion fraction | 3.057% | 3.091% |
| Policy KL | 0.002458 | 0.005371 |
Mean logged reward across all 230 steps was 0.7303. The late-window mean was 0.0098 lower than the early-window mean, a 1.34% relative decrease. These summaries compare different training batches and do not constitute a controlled before/after evaluation of the model.
One substantial KL outlier was recorded at step 152: KL 138.84 and loss 5.3094. Median KL across the run was 0.001835, and final-step KL was 0.002005; a single overall KL average would obscure that outlier. The saved final training loss was 0.02602. The per-step judge failure and timeout metrics were zero throughout the run.
These measurements describe optimization on the training prompts using the training judge. They do not demonstrate improved coding accuracy, tool-use success, or general capability on an independent benchmark.
| Component | Version or configuration |
|---|---|
| Python | 3.12.16 |
| PyTorch, as logged in the container | 2.13.0+cu130 |
| SageMaker container tag | 2.13.0-cu133-amzn2023-sagemaker |
| Transformers | 5.23.0 |
| TRL | 1.10.0 |
| PEFT | 0.21.3 |
| Accelerate | 1.16.0 |
| Datasets | 5.0.1 |
| Attention implementation | sdpa |
The source run’s validation split was not evaluated, and no independent coding, tool-use, or vision benchmark is reported for this quantized package. The logged reward values measure the training judge’s assessment on training prompts. They do not establish an improvement over the base model or measure the effect of quantization.
Tool execution, checking results, and handling side effects belong to the application using the model.
@misc{pistone2026gemma4agentcoderq4,
title={Gemma-4-26B-AgentCoder-Q4-K-M},
author={Bruno Pistone},
year={2026},
note={Q4\_K\_M GGUF edition of a GRPO/RLAIF fine-tuned Gemma 4 model},
url={https://ollama.com/brnpistone/Gemma-4-26B-AgentCoder-q4-k-m}
}