Skip to content

Practice 3 — Compare 3 models in your terminal

Duration: ~15 min Prerequisites: Practice 2 — Slash commands and ~10 GB of free disk space

Three small downloads, six minutes of prompts, one big lesson: model choice is not arbitrary. Size, family and specialty change the experience in ways you have to feel to remember.

This practice is the hands-on version of chapter 05b — Choosing a local model and the catalogue annex. After it, the model choices in the demos will feel obvious.

ModelSize on diskFamilySpecialty
gemma3:4b~2.5 GBGoogle Gemma 3Generalist, small and fast
llama3.1:8b~4.7 GBMeta Llama 3.1Generalist, balanced (the course default)
qwen2.5-coder:7b~4.4 GBAlibaba Qwen 2.5Code-specialised

We pick these three because they cover three axes at once:

  • size: 4B vs 7-8B
  • family: Gemma vs Llama vs Qwen (different chat templates, different training data)
  • purpose: pure generalist vs code-specialist

In a PowerShell window:

Terminal window
ollama pull gemma3:4b
ollama pull llama3.1:8b
ollama pull qwen2.5-coder:7b

Total download: ~11.6 GB. Depending on your bandwidth this takes 5 to 25 minutes. If llama3.1:8b is already there from practice 1, Ollama skips it.

Then check:

Terminal window
ollama list

You should see all three models with their sizes. Take note of how gemma3:4b is roughly half the size on disk of the other two — the parameter count nearly halves and so does the file.

Step 2 — Generalist prompt on each model

Section titled “Step 2 — Generalist prompt on each model”

Same prompt, three runs. The prompt:

“Explain photosynthesis in exactly two sentences, suitable for a 10-year-old.”

Run it on each model:

Terminal window
ollama run gemma3:4b
>>> Explain photosynthesis in exactly two sentences, suitable for a 10-year-old.
[answer]
>>> /bye
ollama run llama3.1:8b
>>> Explain photosynthesis in exactly two sentences, suitable for a 10-year-old.
[answer]
>>> /bye
ollama run qwen2.5-coder:7b
>>> Explain photosynthesis in exactly two sentences, suitable for a 10-year-old.
[answer]
>>> /bye

Record your impressions in a small table:

ModelTime-to-first-tokenTotal timeClarity (1-5)Instruction following (1-5)
gemma3:4byour obsyour obsyour obsyour obs
llama3.1:8byour obsyour obsyour obsyour obs
qwen2.5-coder:7byour obsyour obsyour obsyour obs

What you should typically observe:

  • gemma3:4b is the fastest (first token in ~1 second, full answer in 3 to 5 seconds) but sometimes ignores the “exactly two sentences” constraint and produces three or four short ones.
  • llama3.1:8b is the most balanced: clear, follows the constraint, takes 4 to 8 seconds.
  • qwen2.5-coder:7b answers correctly but its phrasing is sometimes drier — it is trained primarily on code, not pedagogy.

This is where you see why we use qwen2.5-coder for the agent demos and not just a generic model. The prompt:

“Write a Python function reverse_linked_list(head) that reverses a singly linked list iteratively. Include a small example of usage.”

Run it on each model the same way as step 2.

What you should typically observe:

  • gemma3:4b produces working code most of the time, but with simpler examples and occasionally an off-by-one in the loop.
  • llama3.1:8b produces correct, idiomatic code. Good but not great on edge cases.
  • qwen2.5-coder:7b produces the most production-ready answer: correct edge cases (empty list, single node), type hints, a docstring, sometimes even a small test. This is what the code fine-tune of Qwen buys you.

This is exactly why Demo 3 (the agent that writes Java) lists qwen2.5-coder:7b as the validated code alternative to llama3.1:8b.

Step 4 — Inspect what is loaded with ollama ps

Section titled “Step 4 — Inspect what is loaded with ollama ps”

While one model is open in ollama run, open another PowerShell window and run:

Terminal window
ollama ps

You will see something like:

NAME ID SIZE PROCESSOR UNTIL
qwen2.5-coder:7b ... 5.2 GB 100% GPU 4 minutes from now

What this tells you:

  • Only one model is loaded in VRAM at a time (typically). When you ollama run a different model, Ollama unloads the previous one to make room.
  • The size column shows the runtime footprint (~5 GB for a 4.4 GB model — the weights expand a bit when loaded, plus the KV cache for the context window).
  • The UNTIL column shows the TTL: Ollama keeps the model warm for 5 minutes by default, then unloads it.

Try this experiment:

Terminal window
ollama run gemma3:4b
>>> Hello
>>> /bye
# Immediately, in the other window:
ollama ps
# you see gemma3:4b loaded, ~3 GB
ollama run qwen2.5-coder:7b
>>> Hello
>>> /bye
ollama ps
# now you see qwen2.5-coder:7b loaded, ~5 GB
# gemma3:4b is gone — Ollama unloaded it to fit the new one

This is the same dance the comparator in Demo 2 does in parallel, except the demo loads three at once when your VRAM permits.

After running steps 2 and 3, you can fill this table with your own values. Typical observations on a mid-range laptop:

Aspectgemma3:4bllama3.1:8bqwen2.5-coder:7b
Disk size~2.5 GB~4.7 GB~4.4 GB
VRAM at runtime (loaded)~3 GB~5 GB~5 GB
Tokens per second (typical)40-6025-4525-45
Time-to-first-token~1 s~2 s~2 s
Generalist qualityOKGoodGood
Code qualityWeakGoodExcellent
Tool calling reliabilityOKExcellent (validated in the demos)Needs a fallback parser (see ch 09)
Use it for…quick chat on a small laptopthe default for every demo of this coursecode-heavy work, especially demo 3
  • Demos 0, 1, 2, 4: llama3.1:8b as the default. Good general behaviour, reliable tool calling.
  • Demo 3 (agent that writes Java): llama3.1:8b as default; qwen2.5-coder:7b validated as the code-specialised alternative (with a fallback parser for its tool-call format — see the chapter 09 explanation).
  • gemma3:4b is not used by any demo by default, but you can switch any demo to it by editing one line if you want to test on a small machine.

Now that you have felt these models in your terminal, the choices in the demos will feel obvious instead of arbitrary.

  • Size is not everything. qwen2.5-coder:7b is smaller than llama3.1:8b but writes better code.
  • Family matters. Different families format conversations differently, train on different data, and produce different replies.
  • Only one model fits in VRAM at a time on typical hardware. ollama ps shows the active one.
  • The tokens-per-second metric, visible with --verbose, is the cheapest possible benchmark on your specific machine.

Next: launch full coding agents from Ollama itself

Section titled “Next: launch full coding agents from Ollama itself”

You now master ollama run with a model. The final practice shows that Ollama can also launch other people’s coding agents (Continue, OpenCode, Codex-style CLIs) wired to your local model, with one command from the Ollama desktop app.

Practice 4 — Ollama Apps and external coding agents →