134 2 weeks ago

vision tools thinking
ollama run mukunthpr/gemma4-e4b-code

Details

2 weeks ago

1922c6e7dcbd · 9.6GB ·

gemma4
·
8B
·
Q4_K_M
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR US
<|think|> You are Gemma 4 E4B Coding Edition, a local-first senior software engineer and coding agen
{ "min_p": 0.05, "num_ctx": 32768, "num_predict": 16384, "temperature": 1, "top_

Readme

Gemma 4 E4B Code

A coding-focused Ollama variant of Gemma 4 E4B, designed for software development, debugging, code review, refactoring, testing, and agent-style coding workflows.

Quick start

ollama run mukunthpr/gemma4-e4b-code

What this model is

gemma4-e4b-code is a Modelfile-based coding variant of the existing Gemma 4 E4B model. It does not claim new trained weights or a new fine-tune. The coding behavior comes from the model configuration, system prompt, and runtime settings.

It is intended to be a strong general-purpose local coding assistant while remaining practical on consumer hardware, including Apple Silicon Macs.

Built for coding

The system prompt is tuned to prioritize:

  • Correct, runnable code over vague pseudocode
  • Clear reasoning about implementation choices
  • Debugging from error messages and existing code
  • Refactoring with minimal unnecessary changes
  • Tests and edge cases
  • Existing project conventions and APIs
  • Secure, maintainable implementations
  • Concise explanations when the user mainly needs code

Context and output

Gemma 4 E4B supports long-context workloads. This variant uses runtime context sizing rather than trying to force one maximum configuration onto every computer.

The included adaptive runtime selects a context profile based on installed system memory and launches the same model with appropriate Ollama runtime settings.

The default profiles are:

System memory Default context
16 GB 32K
24 GB 48K
32 GB 64K
48 GB 96K
64+ GB 128K

These are starting profiles, not hard hardware requirements. Actual performance depends on macOS, other running applications, model loading state, and the rest of the Ollama configuration.

Adaptive runtime

The runtime file optimises the model for your specfic hardware The runtime is distributed separately from the model because a static Ollama model definition cannot inspect the host machine’s available memory and change its own context dynamically. Run it using the following series of commands immediately after pulling the model from Ollama.

curl -fsSL https://raw.githubusercontent.com/mukunthpr-dev/gemma4-e4b-code/main/run-gemma4-code-mac.sh -o run-gemma4-code-mac.sh
chmod +x run-gemma4-code-mac.sh
./run-gemma4-code-mac.sh

This will optimize the downloaded model to your specific hardware, using the above listed profiles and turn on a few settings automatically for optimization.

Examples

Build a project

Create a small FastAPI service with typed request/response models,
SQLite persistence, pytest tests, and a clean project structure.
Show every file needed to run it.

Debug code

Here is the error and the relevant code. Identify the root cause,
explain why it happens, and give the smallest correct fix.

Refactor

Refactor this module for readability and testability without changing
its public API. Return the revised code and explain the important changes.

Code review

Review this pull request for correctness, edge cases, maintainability,
and likely regressions. Prioritize concrete findings over style comments.

Recommended use

This model is aimed at:

  • Writing new code
  • Debugging
  • Refactoring
  • Code review
  • Unit/integration test generation
  • API and library usage
  • Repository-level reasoning
  • Documentation for codebases
  • Local coding agents

Hardware

This is a local model intended to run through Ollama. Apple Silicon Macs are a primary target for the included adaptive macOS runtime, but the published model itself is not restricted to Macs.

For memory-constrained systems, a smaller context is generally more practical than forcing the maximum context size. For larger-memory systems, the runtime can select a larger context profile.

License and attribution

This variant is derived from Gemma 4 E4B. Please review and comply with the upstream Gemma terms and the terms of any software or code used with the model before redistribution or deployment.

Feedback

Useful feedback includes:

  • Coding tasks where the model fails
  • Languages/frameworks where results are especially strong or weak
  • Context sizes that perform well on different hardware
  • Reproducible bugs in the runtime launcher

This project is focused on making a practical, hardware-aware coding experience around Gemma 4 E4B through Ollama.