# Mac exercise for mission 0.1: What’s inside your computer?

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

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

The mission was about Tim’s MacBook with 16 GB. Here you look at what’s inside your own Mac, load a small model, and have the page calculate what share of memory it takes up. To be on the safe side, a model should take up at most two thirds of the memory; macOS and your apps need the rest.

**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. Show the chip and memory

Open Terminal (Applications, Utilities, Terminal).

```
sysctl -n machdep.cpu.brand_string
```

```
sysctl -n hw.memsize | awk '{print $1/1024/1024/1024 " GB"}'
```

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

```
Apple M4
24 GB
```

### 2. Place it

Read off which model size fits your memory (table from chapter 0, based on chapter 10):

- 8 GB: models up to about 4 billion parameters, such as qwen3:1.7b, with a short context.
- 16 GB: up to 8 billion, such as qwen3:8b; 12 to 14 billion only barely.
- 24 GB: up to 14 billion comfortably; 30 billion models don’t fit.

### 3. Memory in bytes

For the check below you need the exact number:

```
sysctl -n hw.memsize
```

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

```
25769803776
```

### 4. Load a small model

qwen3:1.7b is 1.4 GB and runs on any Mac with Apple Silicon. The second command loads it into memory with 4,096 tokens of context and keeps it there for three minutes; `ollama ps` then shows how much it takes up. The word „Hallo“ (German for “hello”) in it is only there to get the model loaded.

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

```
curl -s http://localhost:11434/api/generate -d '{"model": "qwen3:1.7b", "prompt": "Hallo", "stream": false, "think": false, "keep_alive": "3m", "options": {"num_ctx": 4096, "num_predict": 1}}' > /dev/null
```

```
ollama ps
```

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

```
NAME          ID              SIZE      PROCESSOR    CONTEXT    RUNNER      UNTIL
qwen3:1.7b    8f68893c685c    1.5 GB    100% GPU     4096       llamacpp    2 minutes from now
```

The PROCESSOR column is what matters. “100% GPU” is fine. A split like 40% CPU and 60% GPU would mean the model is too big, part of it sits with the processor, and the speed collapses, as on Tim’s colleague’s PC. With 16 GB or more, you can repeat the same thing with `qwen3:8b`; on the test Mac it took up 5.6 GB.

### 5. Let the page check the share

Paste the number from step 3 and the line from `ollama ps`.

The check needs JavaScript. Without it: divide the size from `ollama ps` by your memory in GB. On the test Mac, 1.5 of 24 GB is about 6 percent, far below two thirds.

The page converts the bytes to GB and compares against two thirds of that. That’s the course’s cautious estimate; on the test Mac, Metal even allowed the GPU about 74 percent, but macOS and your apps need the rest.

### 6. Clean up

The model drops out of memory on its own after three minutes. To do it right away:

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

Keep the file if you still plan to do the exercise for mission 1.1. Otherwise: `ollama rm qwen3:1.7b`.

#### On the DGX Spark

Log in to the Spark, at the device or via SSH; the playbook “Connect Remotely to Your AI Compute” shows how remote access works. `free -h` shows the memory, `nvidia-smi` the GPU. (Checked against the documentation, not run here)

The Spark shares its memory like the Mac: according to NVIDIA, the Grace CPU and the Blackwell GPU have 128 GB of coherent unified system memory, and a 64 GB version is available only through OEM partners. With 128 GB, NVIDIA names models up to about 200 billion parameters, with 64 GB up to about 100 billion. The memory bandwidth of 273 GB/s limits the speed of large dense models.

More on hardware in [chapter 0](https://llm.yoga/en/00-kurs-nutzen.md) and on unified memory in [chapter 6](https://llm.yoga/en/06-inferenz-3.md).
