Gemma 4 is a family of open models from Google DeepMind, released under the Apache 2.0 licence. Ollama's model page says the smaller ones are "specifically designed for efficient local execution on laptops and mobile devices". Once a model is downloaded, it runs on your machine: what you type is answered there, not on someone else's server.
Gemma and Ollama are not made by webridgeAI. Every command, size and figure below was checked against ollama.com/library/gemma4, the Ollama documentation and Google's Gemma 4 announcement on 15 October 2026. Model pages change, so check the sizes again before a large download.
1. What you need
| What | Why |
|---|---|
| Ollama | A free, open-source app (MIT licence) that downloads open models and runs them on your computer. macOS, Windows and Linux. |
| Disk space | From about 4.6GB for the smallest Gemma 4 model up to about 20GB for the largest. |
| Memory | The model has to fit in memory while it runs. See section 8. |
| A terminal | Terminal on a Mac, PowerShell on Windows. Ollama also has a desktop app if you prefer a chat window. |
No account and no API key are needed to run a model locally.
2. Install Ollama
On macOS or Linux:
curl -fsSL https://ollama.com/install.sh | shOn Windows, in PowerShell:
irm https://ollama.com/install.ps1 | iexOr download the installer from ollama.com/download.
Check it worked:
ollama --versionOn macOS and Windows, Ollama updates itself: choose "Restart to update" from the menu bar or taskbar icon when an update is ready. On Linux, run the install script again.
3. Run Gemma 4 for the first time
ollama run gemma4The first run downloads the model (the default is about 6.6GB to 9.5GB), then opens a chat in your terminal. After that it starts from your disk. Type a question and press Enter. Type /bye to leave, or /? to list the other chat commands.
To paste several lines at once, wrap them in triple quotes:
>>> """Summarise this in two lines:
... (paste your text here)
... """You can also ask a single question without opening a chat:
ollama run gemma4 "Explain what a context window is in two sentences."4. Choose the right size
Sizes and details from Ollama's model page:
| Command | Download | Parameters | Context | Input |
|---|---|---|---|---|
ollama run gemma4:e2b | 4.6GB to 7.5GB | 2.3B effective (5.1B with embeddings) | 128K | Text, image, audio |
ollama run gemma4:e4b (the default) | 6.6GB to 9.5GB | 4.5B effective (8B with embeddings) | 128K | Text, image, audio |
ollama run gemma4:12b | 7.7GB to 8.0GB | 12B (listed as a workstation model) | 256K | Text, image |
ollama run gemma4:26b | 16GB to 19GB | 25.2B total, 3.8B active (mixture of experts) | 256K | Text, image |
ollama run gemma4:31b | 19GB to 20GB | 30.7B (dense) | 256K | Text, image |
What the columns mean:
- Effective parameters (the "E" in E2B and E4B): 2.3B and 4.5B parameters do the computing, and the full file (5.1B and 8B) also carries extra embedding weights. That is why the download is bigger than the name suggests.
- Mixture of experts (the 26B): the model holds 25.2B parameters but uses only 3.8B for each word it writes, so it answers faster than its size suggests. It still needs the memory for all 25.2B.
- Context is how much text the model can consider at once. 128K tokens is roughly a few hundred pages.
How much better do the bigger ones get? These are Google's own published results, shown on Ollama's page, not independent tests:
| Benchmark | E2B | E4B | 26B | 31B |
|---|---|---|---|---|
| MMLU Pro (general knowledge) | 60.0% | 69.4% | 82.6% | 85.2% |
| LiveCodeBench v6 (coding) | 44.0% | 52.0% | 77.1% | 80.0% |
| GPQA Diamond (hard science questions) | 43.4% | 58.6% | 82.3% | 84.3% |
Our suggestion:
- Small or older laptop, or 8GB of memory: start with
gemma4:e2b. - Most recent laptops: the default
gemma4(E4B). - 16GB or more, coding or long documents: try
gemma4:12b. - A workstation, or a Mac with a lot of unified memory:
gemma4:26borgemma4:31b.
That mapping is our rule of thumb, not Ollama's. If answers come quickly, step up one size; if your machine slows to a crawl, step down. Avoid tags that end in cloud if you want everything local: those run on Ollama's servers.
5. The commands worth knowing
| Command | What it does |
|---|---|
ollama pull gemma4:e2b | Download a model without starting a chat. |
ollama ls | List the models you have downloaded. |
ollama ps | List the models loaded in memory right now, and whether they are on the GPU or CPU. |
ollama stop gemma4 | Unload a model from memory immediately. |
ollama rm gemma4:31b | Delete a model to free disk space. |
ollama serve | Start the Ollama server yourself (the desktop app normally does this for you). |
Where the downloaded models live, if you want to check the space they use:
- macOS:
~/.ollama/models - Linux:
/usr/share/ollama/.ollama/models - Windows:
C:\Users\%username%\.ollama\models
To keep them on another drive, set the OLLAMA_MODELS environment variable to the new folder.
6. Show it an image
Every Gemma 4 size reads images. In the terminal, put the file path in your prompt:
ollama run gemma4 ./receipt.jpg "Does this receipt add up? Show the maths."In a chat that is already open, drag the image file into the terminal window and type your question after the path. In the Ollama desktop app, attach the image to your message.
Good first tests: a photo of a receipt, a screenshot of an error message, a chart from a report, a page of handwritten notes.
The E2B and E4B models also accept audio input, according to Ollama's model page.
7. Thinking mode
Gemma 4 can reason step by step before it answers. In the terminal you may see a block of thinking before the reply. It tends to help on hard questions and makes every answer slower.
Through the API (section 10), add "think": true to a request to ask for the reasoning, or "think": false to ask for an answer without it where the model allows. The reasoning comes back in its own field (message.thinking), separate from the answer (message.content), so your code can show or hide it.
8. Context length and memory
Two things decide how much memory Gemma uses:
- The model size you picked in section 4. The model has to fit in memory while it runs, so you need more free memory than the download size.
- The context length: how much text it keeps in view. Ollama's FAQ gives the default as 4096 tokens and notes that memory use grows with it.
To raise the context length for one chat (for a long document), type this inside the chat:
/set parameter num_ctx 16384To change it for everything, set OLLAMA_CONTEXT_LENGTH (for example 8192) before starting Ollama.
Check where the model is running with ollama ps. The PROCESSOR column shows 100% GPU when it fits in graphics memory (or a Mac's unified memory), 100% CPU when it runs on the processor alone, or a split such as 48%/52% CPU/GPU. Fully on the GPU is fastest. If you see a large CPU share and slow answers, pick a smaller model or a shorter context.
Ollama keeps a model in memory for 5 minutes after you last used it, so the next question starts quickly. ollama stop gemma4 frees the memory straight away. To change the default, set OLLAMA_KEEP_ALIVE (for example 30m, or 0 to unload after every answer).
9. Give it a standing instruction
If you always want the same behaviour (short answers, British spelling, a particular format), build your own variant with a Modelfile. Create a file called Modelfile:
FROM gemma4
SYSTEM """You answer in plain English, in five sentences or fewer, and say when you are not sure."""Then create and run it:
ollama create my-gemma -f Modelfile
ollama run my-gemmaIt reuses the weights you already downloaded, so it takes almost no extra disk space.
10. Call it from your own code
Ollama runs a server on your machine at http://localhost:11434. Ollama's documentation notes that local requests need no API key. By default the server only listens on your own computer (127.0.0.1), so other devices on your network cannot reach it unless you change OLLAMA_HOST.
From the terminal:
curl http://localhost:11434/api/chat -d '{
"model": "gemma4",
"messages": [{ "role": "user", "content": "Summarise this paragraph in one line: ..." }],
"stream": false
}'From Python (pip install ollama):
from ollama import chat
response = chat(
model="gemma4",
messages=[{"role": "user", "content": "Why is the sky blue?"}],
)
print(response.message.content)To print the answer as it is written, pass stream=True and loop over the result:
stream = chat(model="gemma4", messages=[{"role": "user", "content": "Why is the sky blue?"}], stream=True)
for chunk in stream:
print(chunk["message"]["content"], end="", flush=True)To send an image, add its path to the message: {"role": "user", "content": "Describe this image.", "images": ["photo.jpg"]}.
From JavaScript (npm install ollama):
import ollama from "ollama";
const response = await ollama.chat({
model: "gemma4",
messages: [{ role: "user", content: "Why is the sky blue?" }],
});
console.log(response.message.content);From any tool that already speaks the OpenAI format: point it at http://localhost:11434/v1/. Those clients require an API key, but Ollama ignores it, so any value works:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:11434/v1/", api_key="ollama")
reply = client.chat.completions.create(
model="gemma4",
messages=[{"role": "user", "content": "Write a haiku about local models."}],
)
print(reply.choices[0].message.content)The local server supports /v1/chat/completions, /v1/completions, /v1/models, /v1/embeddings and /v1/responses.
11. Use it inside other tools
Ollama's model page lists apps it can start with Gemma 4 as the model, using ollama launch:
ollama launch claude --model gemma4
ollama launch opencode --model gemma4The same page also lists Hermes Agent (hermes) and OpenClaw (openclaw). These are separate products with their own terms, so check what each one sends over the network before you use it with private material. On a Mac, the Ollama app's Settings, then Apps, is where you choose which Ollama models connected desktop apps can use.
12. Privacy: what stays on your laptop
Ollama's FAQ says: "We don't see your prompts or data when you run locally." That holds when:
- You run a local tag (anything without
cloudin its name). Cloud tags send your prompt to Ollama's servers. - The app calling the model is also local. A tool that talks to Gemma on your laptop can still send your text somewhere else.
- You have not exposed the server to your network with
OLLAMA_HOST.
Once a model is downloaded, it answers with no internet connection at all. Turning Wi-Fi off is a simple way to prove it to yourself.
13. When something goes wrong
| What you see | What to try |
|---|---|
| Answers are very slow | Run ollama ps. If most of the model is on the CPU, step down a size or lower num_ctx. Close other heavy apps. |
| The download stalls | Run the same ollama pull again. Check free disk space. |
| "model not found" | Check the exact tag with ollama ls, or the list on ollama.com/library/gemma4. |
| Your code cannot connect to localhost:11434 | Make sure Ollama is running (open the app, or run ollama serve). |
| It forgets the start of a long document | Raise the context length (section 8). |
| You are low on disk space | ollama ls to see what you have, ollama rm to delete the sizes you do not use. |
Honest notes
- "Frontier-level performance at each size" is how the model page describes Gemma 4, and the benchmark table above is Google's own. Neither is an independent test. Try it on your own work before relying on it.
- Smaller models are faster and lighter, and they get more things wrong. Check anything that matters, especially numbers and quotes.
- Download size is not the same as the memory a model needs. Our size suggestions are a starting point, not a guarantee.