Models

Atlas with CodeGemma 7B (Ollama): Fill-in-the-Middle on 8GB in 2026

Updated 6 min read

CodeGemma 7B (Ollama) is Google's Gemma-derived code model at 5.0GB, and its distinguishing feature is fill-in-the-middle training, which makes it unusually good at completing inside an existing function rather than writing one from scratch. That maps directly onto Atlas edits that patch into existing code. Pricing is Free (self-hosted). The catch is the context window: 8K tokens (8,192), the smallest of any model worth recommending here.

What is fill-in-the-middle training and why does it help Atlas?

CodeGemma 7B (Ollama) was explicitly trained on fill-in-the-middle, meaning it completes inside an existing function rather than writing one from scratch. That pays off on Atlas edits that patch into existing code, which is what most agent turns actually are, at a 5.0GB download.

An Atlas edit is rarely a blank file. Atlas computes a unified diff for every file edit and surfaces it for approval before writing, and a diff is by definition a patch into surrounding context. CodeGemma 7B was trained for exactly that shape: given the code before and after a gap, produce the middle. Models trained mostly on left-to-right completion have to reconstruct the whole region to fill a hole in it. CodeGemma 7B does not, and on patch-shaped work it shows. Google ships code, instruct, and v1.1 tags at the same 5.0GB, so you can pick the head that matches your workload.

How much VRAM does CodeGemma 7B need?

CodeGemma 7B (Ollama) is a 5.0GB download and takes roughly 7GB to serve, so it fits an 8GB card with room for a short KV cache. Pull it with ollama pull codegemma:7b, which is aliased to :latest and :instruct.

The 8GB card is the target hardware for CodeGemma 7B, and the fit is deliberately tight: roughly 7GB resident leaves about 1GB for the KV cache. That is workable precisely because the context window is small. An 8K token (8,192) cache does not grow the way a 128K one would, so the memory profile stays predictable across a session. If you want a single-model offline Atlas setup, set small_model to the same codegemma:7b tag. If memory is tight, point small_model at a 2B tag instead and keep the 5.0GB weights resident.

Is an 8K context enough for an Atlas agent?

An 8K token (8,192) context is the smallest window of any model worth recommending, and with CodeGemma 7B (Ollama) it constrains agent turns hard. Do not inflate it in config: register codegemma:7b with limit.context 8192 and limit.output 4096, because 8K is real.

The temptation with a small window is to lie to the config and hope. Do not. Instead, make retrieval carry the weight. Atlas searches code with hybrid semantic and keyword retrieval fused by reciprocal rank fusion, and it indexes code by AST declarations using tree-sitter, not blind line windows. Configure Atlas to retrieve narrowly over those tree-sitter chunks rather than dumping whole files, and 8K tokens goes to the specific declarations CodeGemma 7B needs to patch. That is the only strategy that makes an 8K window viable in an agent loop, and it happens to suit a fill-in-the-middle model very well.

What does CodeGemma 7B cost to run with Atlas?

CodeGemma 7B (Ollama) is Free (self-hosted). The download is 5.0GB and serving takes roughly 7GB, so an 8GB card in 2026 is the whole hardware bill. Enable Ollama embeddings so the index feeding those narrow retrievals is generated on the machine too.

Free (self-hosted) plus an 8GB card makes CodeGemma 7B one of the cheapest complete Atlas setups available. Complete matters here: with the Ollama embedder turned on for the codebase index, both halves of the loop run locally, so the retrieval that compensates for the 8K token (8,192) window is itself offline. Nothing about your repository leaves the machine, and nothing about the run appears on an invoice. What you give up is context, and to a lesser degree repository-scale reasoning, which is the next section.

When should you pick a different model than CodeGemma 7B?

Pick a different model than CodeGemma 7B (Ollama) when the work is repository-scale. CodeGemma 7B is Gemma-derived rather than code-native pretrained, so it is weaker on repository-scale reasoning than Qwen2.5-Coder 7B, and its 8K token (8,192) window is the tightest here.

CodeGemma 7B is a specialist. Its case is strong when the job is patching into existing code on modest hardware, and it weakens as the job gets wider: multi-file refactors, long tool transcripts, plans that must stay resident. Qwen2.5-Coder 7B is code-native pretrained and reasons better at repository scale at a similar size. Because Atlas lets you switch the active model and provider on the fly with favorites and recents, the sane setup registers both and moves between them. Keep CodeGemma 7B for the infill turns it was trained for.

Setup

  1. 01Pull it: ollama pull codegemma:7b (5.0GB, aliased to :latest and :instruct).
  2. 02Register codegemma:7b in the atlas.json ollama provider with limit.context 8192 and limit.output 4096; do not inflate the window, 8K is real.
  3. 03Because the context is small, configure Atlas to retrieve narrowly: hybrid semantic plus keyword search over tree-sitter chunks, not whole-file dumps.
  4. 04Set small_model to the same tag if you want a single-model offline setup, or a 2B tag to save memory.
  5. 05Enable Ollama embeddings so the index that feeds those narrow retrievals is itself generated on the machine.

Frequently asked questions

how to set up codegemma 7b with atlas
Run ollama pull codegemma:7b (5.0GB, aliased to :latest and :instruct), then register codegemma:7b in the atlas.json ollama provider with limit.context 8192 and limit.output 4096.
what is the context window of codegemma 7b
CodeGemma 7B (Ollama) has an 8K token (8,192) context window, the smallest of any model worth recommending here. Do not inflate it in config, 8K is real.
how much vram does codegemma 7b need
Roughly 7GB to serve against a 5.0GB download, so CodeGemma 7B fits an 8GB card with room for a short KV cache.
what is fill in the middle in a code model
Fill-in-the-middle training teaches a model to complete inside an existing function rather than write one from scratch. CodeGemma 7B has it explicitly, which pays off on Atlas edits that patch into existing code.
codegemma 7b vs qwen2.5-coder 7b
CodeGemma 7B is Gemma-derived rather than code-native pretrained, so it is weaker on repository-scale reasoning than Qwen2.5-Coder 7B. CodeGemma 7B wins on fill-in-the-middle patching and an 8GB memory footprint.
best local coding model for an 8gb gpu
CodeGemma 7B (Ollama) at 5.0GB and roughly 7GB to serve fits an 8GB card with room for a short KV cache, and it is Free (self-hosted).
how do i work with a model that only has an 8k context
Configure Atlas to retrieve narrowly: hybrid semantic plus keyword search over tree-sitter chunks, not whole-file dumps. That spends an 8K token (8,192) window on the declarations the model actually needs to patch.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Atlas for Quarkus in 2026

Atlas is a terminal-native AI coding agent for Quarkus in 2026. It reads CDI beans and JAX-RS resources, then runs ./mvnw test behind a permission prompt.

Atlas for Nuxt: Auto-Imports, useAsyncData, and Nitro Handlers in 2026

Atlas is a terminal-native AI coding agent for Nuxt in 2026. It reads nuxt.config.ts, pages/ routes, composables/ auto-imports, and server/api/ Nitro handlers, and tests with @nuxt/test-utils.

Atlas for Blazor: Terminal-Native AI Coding for .razor Components in 2026

Atlas is a terminal-native AI coding agent for Blazor developers in 2026. Work across .razor components, render modes, and the C# and JS interop boundary safely.

Atlas vs Jules: Terminal AI Coding Agents in 2026

Atlas and Jules comparison for 2026. Atlas offers terminal-native TUI and local code indexing. Jules provides cloud VMs and a Critic agent for PR review.

Atlas vs Claude Code: Terminal AI Coding Agents in 2026

Compare Atlas and Claude Code in 2026 for terminal AI coding. Atlas offers free core, BYO model keys, and robust diffing, while Claude Code provides deep Claude tuning and strong multi-step execution.

Atlas for FastAPI in 2026

Atlas is a terminal-native AI coding agent for FastAPI in 2026. It reads Pydantic v2 models and Depends(), then runs pytest behind a permission prompt.

Atlas for Actix Web in 2026

Atlas is a terminal-native AI coding agent for Actix Web in 2026. It reads extractors and app_data, then runs cargo test and cargo clippy behind a prompt.

Atlas for SolidJS: A Terminal-Native AI Coding Agent Built on Solid, for Solid, in 2026

Atlas is a terminal-native AI coding agent for SolidJS in 2026. It reads your createSignal and createMemo graph, fixes destructured props that break reactivity, and runs vitest.

Browse this resource hub