★ Reading this for free? Get 25 structured AI courses + per-chapter AI tutor — the first chapter of every course free, no card.Start free in 30 secondsOr own every course: $149 once

CodeGemma 7B: Google's Open Code Model, Run Locally

CodeGemma is a family of code models Google built on Gemma. The 7B comes as a pretrained model for code completion and an instruction-tuned model for chat; ollama pull codegemma:7b downloads the instruction-tuned version 1.1, a 5.0 GB file.

Published October 28, 2025•Last updated November 2, 2026•By Local AI Master

CodeGemma 7B at a glance

•Variants: 7B instruction-tuned (codegemma:7b, v1.1), 7B pretrained for completion (codegemma:7b-code), 2B pretrained for fast completion (codegemma:2b)
•Download: 5.0 GB for either 7B tag (Q4_0), 1.6 GB for the 2B
•Parameters: 8.54 billion, embeddings included (Hugging Face, codegemma-7b-it)
•Context window: 8,192 tokens
•HumanEval: 56.1% (7B-IT), 60.4% (7B-IT 1.1); MBPP 54.2% and 55.2% (CodeGemma report, Table 3)
•Licence: Gemma Terms of Use

CodeGemma 7B Runs on Your Own Machine

With Ollama, prompts and code stay on your computer; a cloud coding assistant sends them to the provider's servers

👤
You
💻
Your ComputerAI Processing
👤
🌐
🏢
Cloud AI: You → Internet → Company Servers

What CodeGemma 7B Is

CodeGemma starts from Google's Gemma 7B and continues training on 500 billion tokens of mostly English web documents, mathematics and code, with the 7B mix at 80% code and 20% natural language. The pretrained models are trained for fill-in-the-middle, so an editor can send the code before and after the cursor and get the missing part back; the instruction-tuned 7B is the one to talk to in a chat (CodeGemma report, sections 2.1 and 2.2).

Pick the build by job: codegemma:7b for questions and code generation in a chat, codegemma:7b-code or the smaller codegemma:2b for inline autocomplete. That split follows the intended uses in Google's model card.

What Google Published: HumanEval, MBPP and BabelCode

Pass@1 scores from Table 3 of the CodeGemma technical report (arXiv:2406.11409). They are Google's numbers; this site has not re-run them.

ModelHumanEvalMBPP
CodeGemma 7B-IT 1.1 (what codegemma:7b pulls)60.4%55.2%
CodeGemma 7B-IT (first release)56.1%54.2%
CodeGemma 7B pretrained (codegemma:7b-code)44.5%56.2%
CodeGemma 2B pretrained 1.137.8%49.2%
Gemma 7B pretrained (the starting point)32.3%44.4%

In other languages (BabelCode-translated HumanEval, report Table 4) the 7B-IT 1.1 scores 54.7% in C#, 54.0% in Python, 50.3% in Java, 48.4% in JavaScript, 47.8% in Kotlin, 46.6% in C++, 37.3% in Rust and 34.2% in Go. All of these are 2024 results.

Memory, File Size and Speed Ceilings

The weights are a 5.0 GB file. On top of that Ollama keeps a key-value cache that grows with the context. Gemma 7B uses full multi-head attention (16 KV heads of 256 dimensions across 28 layers), so each token of context costs about 0.46 MB at 16-bit precision.

ContextKV cacheWeights + cache
2,048 tokens0.9 GB6.0 GB
4,096 tokens1.9 GB6.9 GB
8,192 tokens (the maximum)3.8 GB8.8 GB

Ollama needs some working memory on top of these figures. In practice an 8 GB graphics card holds the whole model at a 4K context but not at the full 8K, and a machine with 16 GB of RAM can run it on the CPU at any context length.

Speed: every generated token reads the full 5.0 GB of weights, so memory bandwidth sets a ceiling. Bandwidth ÷ 5.01 GB gives about 54 tok/s on an RTX 4060 (272 GB/s, at a 4K context where it fits on the card), 72 tok/s on an RTX 3060 12GB (360 GB/s), 201 tok/s on an RTX 4090 (1,008 GB/s) and 30 tok/s on an Apple M3 Pro (150 GB/s). These are ceilings, not measurements; real generation lands below them.

Setup with Ollama

System Requirements

▸
Operating System
Windows, macOS, Linux
▸
RAM
8 GB free for a 4K context (5.0 GB model + 1.9 GB cache); about 9 GB for the full 8K context
▸
Storage
5.0 GB per 7B tag (1.6 GB for codegemma:2b)
▸
GPU
Optional: an 8 GB card holds it at a 4K context; CPU-only works, more slowly
▸
CPU
Any 64-bit CPU that Ollama supports
1

Install Ollama Runtime

Linux install script shown; macOS and Windows installers are at ollama.com/download

$ curl -fsSL https://ollama.com/install.sh | sh
2

Download CodeGemma 7B

The instruction-tuned version 1.1, a 5.0 GB download

$ ollama pull codegemma:7b
3

Verify Installation

Test the model with a simple code request

$ ollama run codegemma:7b "Generate a Cloud Run service in Python"
4

Optional: Pull a Completion Model

For inline autocomplete use a pretrained variant: codegemma:2b (1.6 GB) or codegemma:7b-code (5.0 GB)

$ ollama pull codegemma:2b
5

Configure IDE Integration

Editor extensions connect to Ollama at http://localhost:11434. The desktop app and the Linux service already run this server; start it by hand only if neither is running

$ ollama serve

Using CodeGemma from your editor

  • • VS Code and JetBrains: the Continue extension can use codegemma:7b as a chat model and codegemma:2b or codegemma:7b-code for autocomplete. Step by step: Continue.dev + Ollama setup guide.
  • • Calling the API yourself: the pretrained variants expect fill-in-the-middle prompts built from <|fim_prefix|>, <|fim_suffix|> and <|fim_middle|> (report Table 1); Ollama's library page shows a Python example with codegemma:2b-code.

Frequently Asked Questions

What makes CodeGemma 7B different from other coding AI models?

It is Gemma 7B with 500 billion further training tokens, 80% of them code, and its pretrained variants were trained for fill-in-the-middle completion. Google reports 60.4% HumanEval for the instruction-tuned v1.1, against 32.3% for the Gemma 7B it started from (CodeGemma report, Table 3).

How much RAM do I need to run CodeGemma 7B effectively?

About 7 GB at a 4K context (5.0 GB of weights plus a 1.9 GB cache) and about 9 GB at its 8K maximum, so 8 GB of free memory is the practical floor and 16 GB of system RAM is comfortable for CPU-only use.

Can CodeGemma help with Android development specifically?

Google evaluated it on Kotlin and Java (BabelCode HumanEval 47.8% and 50.3% for the 7B-IT 1.1), but the report describes a training corpus drawn from public code repositories, not Android-specific data, so treat it as a general code model.

Can I use CodeGemma 7B in commercial work?

The Gemma Terms of Use do not rule out commercial use; their limits are Google's Prohibited Use Policy and the redistribution conditions in section 3.1, and Google claims no rights in the outputs you generate (section 3.3).

What programming languages does CodeGemma 7B support best?

On Google's BabelCode-translated HumanEval the 7B-IT 1.1 does best in C# (54.7%) and Python (54.0%), then Java (50.3%), JavaScript (48.4%), Kotlin (47.8%) and C++ (46.6%), and worst in Rust (37.3%) and Go (34.2%) (CodeGemma report, Table 4).

Can I use CodeGemma 7B offline?

Yes. After ollama pull codegemma:7b the model runs entirely on your machine, so your prompts and code are not sent anywhere.

📚 Resources & Further Reading

🔧 Official Google Resources

🔬 Gemma Research and Code

💻 Running It Locally

Build Real AI on Your Machine

RAG, agents, NLP, vision, and MLOps - chapters across 25 courses that take you from reading about AI to building AI.

Reading now
Join the discussion

Related Guides

Continue your local AI journey with these comprehensive guides

🎯
AI Learning Path

Go from reading about AI to building with AI

25 structured courses. Hands-on projects. Runs on your machine. Start free.

Or own it for life — Lifetime $149 $599, pay once
Barsha Mohapatra

Written by

Barsha Mohapatra

Founder and Editor, Local AI Master · Founder, Little AI Master

Founder of Little AI Master and the editor behind every course and guide on Local AI Master. Years of tutoring students taught her where AI education actually fails.

📅 Published: 2025-10-28🔄 Last Updated: 2026-11-02✓ Manually Reviewed
More on AI Models Directory
See the full AI Models Directory guide.
📚
Free · no account required

Grab the AI Starter Kit — career roadmap, cheat sheet, setup guide

No spam. Unsubscribe with one click.

🎯
AI Learning Path

Found your model? Now build something with it.

25 hands-on courses — RAG, agents, fine-tuning — all running locally. First chapter free, no card.

Or own it for life — Lifetime $149 $599, pay once
Free Tools & Calculators