# Mac exercise for mission 1.1: Inference on your own computer

Part of the course “AI from Zero to Autonomous Agents” (https://llm.yoga/en). Page for humans: https://llm.yoga/en/mac-1-1

About 15 minutes at your computer · Type this address: **llm.yoga/en/mac-1-1**

You ask a model with open weights the same question as Mia in the mission: once without the price list, once with it, then without it again. Every request is inference. The parameters sit as a file on your disk and don’t change in the process. As in the mission, the price list is a made-up example.

**Before you start**

You need **Ollama** and Python 3 in the terminal. Ollama comes as an app: download it from ollama.com/download and drag it into your Applications folder. On first launch, the app asks permission, if needed, to set up the `ollama` terminal command. It requires macOS 14 or newer. More on this in [chapter 10](https://llm.yoga/en/10-lokale-modelle-4.md). Check:

```
ollama --version
```

Python 3 may need to be installed. On the first `python3` call, macOS may offer to install developer tools; alternatively, Python is available from python.org.

### 1. Load a small model

qwen3:1.7b is 1.4 GB and runs on any Mac with Apple Silicon.

```
ollama pull qwen3:1.7b
```

### 2. Read the key figures

```
ollama show qwen3:1.7b
```

**Start of the output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
  Model
    architecture        qwen3
    parameters          2.0B
    context length      40960
    embedding length    2048
    quantization        Q4_K_M
```

2.0 billion parameters, stored in the 4-bit level Q4_K_M. On Hugging Face the model is called Qwen3-1.7B. Chapter 4 explains why Ollama shows 2.0B.

Also note the model’s ID. Ollama computes it from the contents: it is the start of a SHA-256 checksum over the manifest, and the manifest contains the checksum of the file with the weights.

```
ollama list
```

**Line for qwen3:1.7b (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
NAME                     ID              SIZE      MODIFIED
qwen3:1.7b               8f68893c685c    1.4 GB    2 hours ago
```

### 3. Ask without the price list

Ask the question three times, changing only the `seed` (1, 2, 3). `"think": false` turns off Qwen3’s thinking mode. The prompt is in German, as in the measurement: „Was kostet bei uns das Paket Pro je Nutzer und Monat? Antworte in einem Satz.“ (What does our Pro package cost per user per month? Answer in one sentence.)

```
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3:1.7b", "think": false, "stream": false, "options": {"temperature": 0.7, "seed": 1, "num_predict": 60}, "messages": [{"role": "user", "content": "Was kostet bei uns das Paket Pro je Nutzer und Monat? Antworte in einem Satz."}]}' | python3 -c 'import json, sys; print(json.load(sys.stdin)["message"]["content"])'
```

**Outputs with seed 1, 2, 3 (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Das Paket Pro kostet bei uns jeweils 19,99 € pro Nutzer und Monat.
Bei uns kostet das Paket Pro je Nutzer und Monat 9,99 Euro.
Bei uns kostet das Paket Pro je Nutzer und Monat 19,99 €.
```

The model doesn’t know your prices and makes some up (€19.99, €9.99, €19.99 here), with full conviction every time.

### 4. Ask with the price list

Now the price list goes along as a system message (Basic €19, Pro €29, Enterprise €49, each per user per month). That puts it in the context of this one request.

```
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3:1.7b", "think": false, "stream": false, "options": {"temperature": 0.7, "seed": 1, "num_predict": 60}, "messages": [{"role": "system", "content": "Preisliste: Paket Basis 19 Euro, Paket Pro 29 Euro, Paket Enterprise 49 Euro, jeweils je Nutzer und Monat."}, {"role": "user", "content": "Was kostet bei uns das Paket Pro je Nutzer und Monat? Antworte in einem Satz."}]}' | python3 -c 'import json, sys; print(json.load(sys.stdin)["message"]["content"])'
```

**Outputs with seed 1, 2, 3 (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Paket Pro kostet 29 Euro pro Nutzer und Monat.
Das Paket Pro kostet bei Ihnen 29 Euro pro Nutzer und Monat.
Das Paket Pro kostet bei Ihnen 29 Euro pro Nutzer und Monat.
```

### 5. Once more without it

Repeat the command from step 3 with seed 1. Did the model learn anything from step 4?

**Output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Das Paket Pro kostet bei uns jeweils 19,99 € pro Nutzer und Monat.
```

Word for word the same as before. The request with the price list left no trace in the model. As a check, look at the list once more:

```
ollama list
```

**Line for qwen3:1.7b after the questions (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
NAME                     ID              SIZE      MODIFIED
qwen3:1.7b               8f68893c685c    1.4 GB    2 hours ago
```

The same ID as in step 2, and “MODIFIED” hasn’t moved either. If the weights had changed and been saved again, there would be a different ID. `ollama show` is no good for this: it only shows key figures such as the number of parameters, and those would be the same even with changed weights.

### 6. Let the page check your answers

Paste the three answers from step 3 or step 4, one per line.

The check needs JavaScript. Without it: different prices for the same question mean the model is guessing.

With the answers from step 4, you get €29 three times. Identical answers alone don’t prove anything; here they are right because the price list went along.

### 7. Count parameters yourself

With pen and paper: a network with 3 inputs, one hidden layer with 4 neurons and 2 outputs, all layers fully connected. How many parameters does it have?

#### Answer

3 × 4 + 4 × 2 = 20 weights, plus 4 + 2 = 6 biases, 26 in total. The inputs have no bias.

### 8. Clean up

```
ollama stop qwen3:1.7b
```

If you only loaded qwen3:1.7b for this exercise: `ollama rm qwen3:1.7b`.

#### On the DGX Spark

The playbook “Chat with LLMs Using Open WebUI and Ollama” sets up Ollama with a chat interface in the browser, in 15 to 20 minutes according to NVIDIA. There you can query two open models side by side, such as gpt-oss:20b and a larger Qwen model, and compare their parameter counts with `ollama show`. Ask both the price question without and with the list: the larger model, too, only knows your prices if they are in the context. (Checked against the documentation, not run here)

How a knowledge base sends along the right documents automatically is shown in [chapter 11](https://llm.yoga/en/11-rag.md).
