11 yesterday

vision tools thinking audio
ollama run mohamedbastawih/gemma4-coder:12b-mlx

Details

yesterday

0aa68a53526a · 7.7GB

{"architectures":["Gemma4UnifiedForConditionalGeneration"],"audio_config":{"_name_or_path":"","archi
{ "bos_token_id": 2, "do_sample": true, "eos_token_id": [ 1, 106, 50 ], "pad_token_id": 0, "suppress
{"producer":{"name":"modelopt","version":"0.45.0.dev110+g04f58166a"},"quantization":{"quant_algo":"M
{ "audio_ms_per_token": 40, "audio_seq_length": 750, "feature_extractor": { "audio_samples_per_token
{ "version": "1.0", "truncation": null, "padding": null, "added_tokens": [ { "id": 0, "content": "<p
{ "audio_token": "<|audio|>", "backend": "tokenizers", "boa_token": "<|audio>", "boi_token": "<|imag
{ "architectures": [ "Gemma4UnifiedAssistantForCausalLM" ], "audio_token_id": 258881, "backbone_hidd
{ "bos_token_id": 2, "do_sample": true, "eos_token_id": 1, "pad_token_id": 0, "suppress_tokens": [ 2
{ "version": "1.0", "truncation": null, "padding": null, "added_tokens": [ { "id": 0, "content": "<p
{ "audio_token": "<|audio|>", "backend": "tokenizers", "boa_token": "<|audio>", "boi_token": "<|imag
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR US
You are an expert software engineer. Your goal is to help the user edit code, run commands, and anal
{ "num_ctx": 65536, "temperature": 0.1, "top_k": 64, "top_p": 0.95 }
725 tensors

Readme

Technical Documentation: gemma4-coder:12b-mlx

1. Overview

Model Identifier: mohamedbastawih/gemma4-coder:12b-mlx
Library Source: ollama.com/mohamedbastawih/gemma4-coder:12b-mlx
Role: Local OpenCode Agent
Primary Objective: To serve as the intelligence engine for an autonomous coding agent capable of interacting with local development environments, managing file systems, and executing code.

Gemma4-e4b-coding is specifically tuned to bridge the gap between a standard LLM and a functional software engineer. It does not just suggest code; it generates actionable instructions (tool calls) to manipulate files and run commands locally.


2. Agentic Capabilities

The model is optimized for the following “Agent” behaviors:

🛠️ Tool-Use & Function Calling

The model is trained to recognize when a natural language request requires a system action. Instead of a conversational response, it outputs a structured payload that a local controller (the Agent Wrapper) can execute.

📂 Local File System Integration

The model is designed to work with an agent that provides the following permissions: * Read/Analyze: The ability to ingest existing codebases to understand context before proposing changes. * Write/Modify: The ability to create new files or apply precise edits to existing source code. * Project Mapping: The ability to list directories to navigate complex project architectures.

🔄 Autonomous Coding Loop

The model operates on an Observation \(\rightarrow\) Thought \(\rightarrow\) Action cycle: 1. Observe: Read the file or error message. 2. Think: Determine the logical fix or feature implementation. 3. Act: Call the write_file or execute_cmd tool.


3. Implementation & Architecture

Model Acquisition

To use this model as the core of your agent, pull it directly from the Ollama library:

ollama pull mohamedbastawih/gemma4-e4b-coding

The Agent Workflow

Because LLMs cannot directly touch your hardware, Gemma4-e4b-coding acts as the Brain, while a local script (Python/Node.js) acts as the Hands.

Sequence of Operation: 1. User Input: “Update the API endpoint in server.js to handle 404 errors.” 2. Model Inference: Gemma4-e4b-coding triggers a tool call: \(\rightarrow\) {"action": "read_file", "path": "server.js"} 3. Local Wrapper: Reads the file \(\rightarrow\) Feeds content back to the model. 4. Model Inference: Processes code \(\rightarrow\) Generates the fix: \(\rightarrow\) {"action": "write_file", "path": "server.js", "content": "...updated code..."} 5. Local Wrapper: Commits the change to the disk.

Supported Tool Signatures

The model is optimized to produce the following JSON-style calls:

Tool Parameter Purpose
read_file path Retrieves file content for analysis.
write_file path, content Creates or updates a local file.
list_dir path Explores the project folder structure.
execute_cmd command Runs terminal commands (tests, installs, etc).

4. Usage Guide

Starting the Agent

Depending on your local wrapper, you can run the model via:

ollama run mohamedbastawih/gemma4-e4b-coding

Recommended Prompting Strategy

To get the best agentic performance, provide a system prompt that reinforces its role:

“You are the OpenCode Agent. You have access to a local filesystem. Do not just explain the code; use the provided tools to read, write, and verify your changes. Always read a file before editing it.”


5. Safety & Security

⚠️ Warning: This model is designed to generate commands that modify your local files.

  • Sandboxing: It is highly recommended to run the agent inside a Docker container or a dedicated project directory.
  • Confirmation Layer: We recommend implementing a “Human-in-the-Loop” verification step in your wrapper where the user must approve any write_file or execute_cmd action.
  • Read-Only Mode: For auditing code, the agent can be restricted to only using the read_file and list_dir tools.

Comparison Summary

Feature Standard Gemma Gemma4-e4b-coding (Agent)
Output Style Descriptive/Conversational Actionable/Tool-Oriented
File Interaction Copy/Paste Manual Direct Read/Write (via Wrapper)
Project Context User-provided snippets Full Directory Analysis
Execution Suggests commands Triggers actual shell execution
Availability General ollama pull mohamedbastawih/gemma4-e4b-coding