Gemma 4 / Run locally

Run Gemma 4 Locally

Gemma 4 runs on your own computer or phone: free, private and offline once downloaded. This page shows what hardware you need, the three steps to get chatting, and how to add EmbeddingGemma 2 for private search over your own files.

Windows, macOS, Linux, Android and iOS ·

offline $ ollama run gemma4:12b-it-qat pulling 7.2 GB 100% >>> Why is the sky blue? Sunlight scatters off air molecules, and blue light scatters the most.
One command downloads the model; after that it works with no connection.
$0Apache 2.0, no per-token fee
1 commandTo download and chat
From 2.9 GBMemory for the smallest size
OfflineAfter the first download
Why bother

What you gain by running it yourself

🔒

Private

Your prompts, files and answers stay on your machine. Nothing is sent to a provider.

✈️

Offline

Once the model is downloaded it needs no internet connection.

💵

No usage fees

The models are free under Apache 2.0. You pay only for hardware and electricity.

🎛️

Yours to control

Pick the size, the settings and when to update. You can also fine-tune it.

The trade-off: a hosted service is simpler and can run larger models than your hardware allows. See pricing for hosted costs and limitations for what the models cannot do.

What you need

Hardware for each size

Memory is what matters most: the graphics card's memory on a PC, or total memory on an Apple silicon Mac.

ModelMemory, 4-bitOllama downloadContextAcceptsA sensible fit
Gemma 4 E2B2.9 GB4.3 GB128KText, image, audioAn 8 GB laptop; most phones
Gemma 4 E4B4.5 GB6.1 GB128KText, image, audio8 to 12 GB machines; flagship phones
Gemma 4 12B6.7 GB7.2 GB256KText, image, audioA 12 to 16 GB graphics card or 16 GB Mac
Gemma 4 26B A4B14.4 GB16 GB256KText, imageA 24 GB graphics card or 32 GB Mac
Gemma 4 31B17.5 GB19 GB256KText, imageA 24 to 32 GB graphics card or 32 GB+ Mac

Memory figures are from Google's Gemma 4 model card and cover the model only; conversations need more on top. Downloads are the QAT builds on Ollama's tag list. Every size can also read video as a series of frames. Ollama lists its builds as taking text and images, so for audio use another app. "A sensible fit" is this site's guidance; the VRAM guide goes deeper and the QAT page explains the small builds.

Interactive

What can my machine run?

Choose your device and memory for a suggested model.

Suggested model

        
      

This site's rule of thumb: the largest model whose download is under about 70% of your memory. It is a starting point, not a guarantee. For more options use the runtime selector or compare models.

Quick start

Three steps with Ollama

The shortest route on Windows, macOS and Linux.

  1. Install Ollama

    Download it from ollama.com and run the installer.

  2. Run a model

    Open a terminal and type ollama run gemma4:12b-it-qat. The first run downloads 7.2 GB.

  3. Start chatting

    Type your question at the prompt. Type /bye to leave. From now on it works offline.

ollama run gemma4:12b-it-qat           # download (7.2 GB) and chat
ollama run gemma4:12b-it-qat "What is in this image? ./photo.png"
ollama list                            # models you have
ollama ps                              # what is loaded now
ollama rm gemma4:12b-it-qat            # delete to free disk
/set parameter num_ctx 32768     # longer memory for this chat
/set think                       # reason before answering
/set nothink                     # answer straight away
/clear                           # forget the conversation so far
/bye                             # leave

Less memory? Use gemma4:e4b-it-qat or gemma4:e2b-it-qat. The full walkthrough is on the Ollama page and in the install guide.

Other ways

Choose the app that suits you

AppBest forRuns onGuide
OllamaThe quickest start; a local API for your own programsWindows, macOS, LinuxOllama
LM StudioA desktop app with a chat window and no terminalWindows, macOS, LinuxLM Studio
llama.cppFine control, and Google's GGUF files directlyWindows, macOS, LinuxInstall guide
MLXApple silicon Macs, especially if you work in PythonmacOSMac setup
TransformersPython projects, research and fine-tuningAny system with PythonHow to use
Google AI Edge GalleryPhones and tabletsAndroid, iOSMobile downloads
lms get google/gemma-4-12b-qat     # download
lms load google/gemma-4-12b-qat    # load into memory
lms server start                   # start the local API on port 1234
# install llama.cpp (macOS or Linux), then serve with a web page
curl -LsSf https://llama.app/install.sh | sh
llama serve -hf google/gemma-4-12B-it-qat-q4_0-gguf:Q4_0
pip install mlx mlx-lm mlx-vlm

mlx_lm.generate --model mlx-community/gemma-4-e2b-it-4bit --prompt "Who are you?"

# a local server that also accepts images
mlx_vlm.server --model mlx-community/gemma-4-e2b-it-4bit
from transformers import AutoProcessor, AutoModelForMultimodalLM

processor = AutoProcessor.from_pretrained("google/gemma-4-12B-it")
model = AutoModelForMultimodalLM.from_pretrained(
    "google/gemma-4-12B-it", device_map="auto")

llama.cpp and Transformers commands are from Google's model cards; MLX commands from Google's MLX guide; LM Studio names from its catalogue. "Best for" is this site's guidance. Where to get the files is on the download hub and in how to download.

For developers

Use your local model from your own code

Ollama and LM Studio both start a small server on your machine. Programs talk to it the same way they would talk to a hosted service.

# pip install ollama
import ollama

reply = ollama.chat(
    model="gemma4:12b-it-qat",
    messages=[{"role": "user", "content": "Why is the sky blue?"}],
)
print(reply["message"]["content"])
curl http://localhost:11434/api/chat -d '{
  "model": "gemma4:12b-it-qat",
  "messages": [
    {"role": "user", "content": "Why is the sky blue?"}
  ],
  "think": false,
  "stream": false
}'
# pip install openai
from openai import OpenAI

# Ollama: port 11434.  LM Studio: http://localhost:1234/v1
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")

reply = client.chat.completions.create(
    model="gemma4:12b-it-qat",
    messages=[{"role": "user", "content": "Why is the sky blue?"}],
)
print(reply.choices[0].message.content)
  • Ollama listens at http://localhost:11434.
  • LM Studio listens at http://localhost:1234/v1 once you start its server.
  • Existing tools work. Anything that accepts an OpenAI-style address can be pointed at your machine.
  • Thinking is a switch. Set "think" to true or false in Ollama's API. See the prompt guide.
  • Try it in the browser. The playground on this site connects to your local Ollama.

More examples, including images and tools, are on the API page and the coding page. To serve other people from your own hardware, see self-hosting.

In your pocket

Running it on a phone

The two edge models, E2B and E4B, are built for phones. Google's free AI Edge Gallery app downloads and runs them.

🤖

Android

Google AI Edge Gallery on Google Play. Needs Android 12 or later.

🍎

iPhone and iPad

Google AI Edge Gallery on the App Store. Needs iOS 17 or later.

📏

What to expect

E2B is a 2.58 GB download, E4B 3.66 GB. Phone builds remember up to 32K tokens of conversation.

Google reports E2B at 52.1 tokens a second on a Galaxy S26 Ultra and 56.5 on an iPhone 17 Pro, using the graphics chip. Step-by-step setup is on the Android page.

EmbeddingGemma 2 · released October 6, 2026
Private search

Run EmbeddingGemma 2 locally too

EmbeddingGemma 2 is Google's small, free model for search. It turns your text, code, images, audio and video into numbers that can be compared, so you can find things by meaning. Run it beside Gemma 4 and you can ask questions about your own files without anything leaving your machine.

Your computer · offline Your filestext, images EmbeddingGemma 2makes vectors Indexon your disk Gemma 4answers "What did the contract say?" Nothing in this picture is sent over the internet.
EmbeddingGemma 2 finds the right passage; Gemma 4 writes the answer.
Full model
1.3 GB

On Ollama. Text and images.

Text only
378 MB

The 270m name on Ollama.

On a phone
567 MB

Memory in use on a Pixel 11 Pro, per Google.

Graphics card
Optional

Small enough for an ordinary laptop.

ollama pull embeddinggemma-2            # full model, 1.3 GB
ollama pull embeddinggemma-2:270m       # text and code only, 378 MB

curl http://localhost:11434/api/embed -d '{
  "model": "embeddinggemma-2",
  "input": "What causes the northern lights?"
}'
# pip install -U "sentence-transformers[image,audio,video]" transformers
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("google/embeddinggemma-2")

query_emb = model.encode("ocean waves at sunset", prompt_name="SearchQuery")
doc_emb = model.encode("Photos from the beach trip", prompt_name="Document")
image_emb = model.encode({"image": "sunset_beach.jpg"})
# private question answering: both models on your machine
import ollama
from sentence_transformers import SentenceTransformer

embedder = SentenceTransformer("google/embeddinggemma-2")
passages = ["...your documents, split into passages..."]
passage_embs = embedder.encode(passages, prompt_name="Document")

question = "What did the contract say about renewal?"
q_emb = embedder.encode(question, prompt_name="QuestionAnswering")
best = passages[embedder.similarity(q_emb, passage_embs).argmax()]

reply = ollama.chat(model="gemma4:12b-it-qat", messages=[
    {"role": "user", "content": f"Answer from this passage only:\n{best}\n\nQuestion: {question}"}])
print(reply["message"]["content"])
  • Ollama is the quickest route for text. It lists text and image input only.
  • Use Python for audio and video. The sentence-transformers library handles every input type.
  • Use the right task prompt. Questions and stored text get different ones; see the prompt guide.
  • Do not use float16. Google warns the model's values exceed its range; use bfloat16 or float32.
  • Plan your disk space. About 1.5 GB for every million full-length vectors.

Ollama names and sizes from Ollama's library; Python usage from Google's developer guide and the model card. The "search + answer" example is this site's sketch combining the two; it has not been run against your data, so treat it as a starting point.

Troubleshooting

Common problems

This site's guidance on what to check first.

What you seeLikely causeTry this
Very slow repliesThe model does not fit in graphics memory and is running on the processorRun ollama ps to check; choose a smaller size
Out-of-memory errorModel plus conversation is larger than your memoryPick a smaller size or a shorter context
Forgets earlier messagesThe app's context setting is smaller than the chatRaise it, for example /set parameter num_ctx 32768
Slow on easy questionsThinking is on/set nothink
Audio is ignoredThe size or app does not accept audioUse E2B, E4B or 12B in an app that supports audio
Disk filling upSeveral large models downloadedollama list, then ollama rm the ones you do not use

More help is in the FAQ; what each model can and cannot do is under capabilities and features.

FAQ

Local running questions

Can I run Gemma 4 on my own computer?

Yes. The smallest size needs about 2.9 GB of memory at 4-bit and the largest about 17.5 GB. Most laptops made in the last few years can run at least E2B or E4B.

Is it free?

Yes. Gemma 4 and EmbeddingGemma 2 are Apache 2.0, and the apps on this page are free to download.

Do I need a graphics card?

No, but it helps a lot. Without one, the model runs on the processor and larger sizes are slow. Apple silicon Macs use their shared memory.

Does it work offline?

Yes, after the first download. Nothing is sent anywhere while you chat.

Which size should I run?

The largest that fits your memory with room to spare. For many machines that is the 12B; see the 12B page and all variants.

How good is it compared with hosted assistants?

Strong for a model you can run yourself, but not as strong as the largest hosted models. See the benchmarks and Gemma 4 vs Claude Code.

Can I run EmbeddingGemma 2 on the same machine?

Yes. It is small, between 378 MB and 1.3 GB on Ollama, and runs alongside Gemma 4.

Is running locally safe?

Your data stays with you, but you are responsible for how the model is used and for keeping it up to date. See safety.

Your own AI, on your own machine

Free, private and offline. One command to start.

Top '