Domizer's picture
Add per-file configs so the dataset viewer works
3c4c5be verified
|
Raw History Blame Contribute Delete
9.77 kB
---
license: cc-by-4.0
language:
- en
pretty_name: "Local coding agents on a 128 GB Mac: one big model or several small ones?"
tags:
- llama.cpp
- gguf
- apple-silicon
- coding-agents
- claude-code
- speculative-decoding
- field-report
size_categories:
- n<1K
configs:
- config_name: sequential_runs
data_files: results/sequential_runs.csv
default: true
- config_name: parallel_batch_inkling
data_files: results/parallel_batch_inkling.csv
- config_name: prefill_under_load
data_files: results/prefill_under_load.csv
- config_name: inkling_kv_memory
data_files: results/inkling_kv_memory.csv
---
# Local coding agents on a 128 GB Mac: one big model or several small ones?
I'm fairly new to running models locally, and this is my first attempt at measuring something
properly instead of going on gut feeling. The test is small and has gaps, which I describe
below. I'm sharing it because I couldn't find numbers for this exact question on Apple
Silicon, and because I'd like to hear where my method is wrong.
## The question
My Mac Studio has 128 GB of unified memory. Today I run one large model,
Qwen3.8 Flash Next, as a local coding agent. It fills most of the memory. I wondered if it
would be better to run a smaller model instead and give it several tickets at once, with one
agent per ticket.
I compared three models:
- Qwen3.8 Flash Next (MoE), the model I already use
- Qwen3.8-27B (dense), about 18 GB at 4 bits
- Inkling 2 Mini (26.4B MoE with looped layers, about 5.4B active per token), released a few
days before this test
## Short version
- All three models solved every ticket and passed every hidden test, so on these tasks
correctness did not separate them.
- With one agent working through the tickets in order, Flash Next was about twice as fast as
the other two.
- Running four agents at once on Inkling 2 Mini was slower overall than one agent doing the
tickets in order. Prompt processing (prefill) is the bottleneck: the agents share it, and
agents spend most of their time on it.
- Between the two smaller models, Qwen3.8-27B wrote slightly cleaner code than Inkling 2 Mini.
For my machine, the answer was to keep one Flash Next agent. More detail follows.
## How I ran it
### Machine and software
| | |
|---|---|
| Machine | Mac Studio, Apple M5 Max, 128 GB unified memory (GPU wired limit 120 GiB) |
| Inference | llama.cpp `llama-server` with Metal |
| Agent | Claude Code 2.1.332 in headless mode, pointed at the local server through a small shim that speaks the Anthropic API |
| Context | 262,144 tokens, q8_0 K/V cache, flash attention, `--kv-unified` |
### Models and settings
| Model | File | Speculative decoding | Sampling |
|---|---|---|---|
| Qwen3.8 Flash Next | UD-IQ4_XS | MTP draft (Q8_0), up to 3 tokens | temp 1.0, top-p 0.95, top-k 20 |
| Qwen3.8-27B | `unsloth/Qwen3.8-27B-GGUF`, UD-Q4_K_XL | MTP draft (Q4_0), up to 3 tokens | temp 1.0, top-p 0.95, top-k 20, min-p 0 |
| Inkling 2 Mini | `unsloth/Inkling-2-Mini-GGUF`, UD-Q4_K_XL (mainline layout) | DSpark draft (Q8_0), up to 2 tokens | temp 1.0, top-p 1.0, top-k 0, min-p 0 |
I used the sampling settings recommended in each model card (Qwen's thinking mode for both
Qwen models). Flash Next ran on an older llama.cpp build (b12144) behind a router, because
that is how my setup already works. The other two ran on b12721, which was the first build I
found with support for Inkling's looped layers and its DSpark drafter.
### The tickets
I used a small private Python app (FastAPI and SQLite, about 2,600 lines, with an existing
pytest suite). I wrote four tickets of different kinds:
| | Kind | What the agent had to do |
|---|---|---|
| T1 | Feature | Spread a shipping cost across item prices in proportion to price, with exact rounding rules and input validation |
| T2 | Refactor | Merge two copies of the same FIFO inventory loop into one helper and add an `as_of` parameter, without changing behaviour or error messages |
| T3 | Bug fix | Fix a Norwegian number-format bug (`1.299,50` was stored as 1.29) and accept a table of valid and invalid inputs |
| T4 | Endpoint | Add a read-only CSV export with exact headers, `;` as separator, decimal commas and proper quoting |
For each ticket I also wrote hidden tests that the agent never saw. I checked them against my
own reference solutions: they fail on the original code and pass with the reference.
### The rules for each run
- A fresh copy of the code and an empty data folder.
- The agent could read and edit files and run exactly one shell command, `python -m pytest -q`.
No web access and no sub-agents.
- A limit of 60 turns and 30 minutes.
- The agent had to end its answer with `STATUS: PASS` or `STATUS: FAIL`. I compared that line
with the real test result to see if the agent was honest about its own work.
- Two runs per model and ticket, one after the other.
After each run I ran the hidden tests and the full suite and saved the diff.
## Results with one agent
![Minutes per ticket, one dot per run](charts/time_per_ticket.png)
| Model | Hidden tests | Full suite green | Honest status line | Mean / median minutes per ticket | Mean turns | Blind code score (1 to 5) |
|---|---|---|---|---|---|---|
| Qwen3.8 Flash Next | 64/64 | 8/8 | 8/8 | 2.0 / 1.9 | 12.6 | 4.3 |
| Qwen3.8-27B | 64/64 | 8/8 | 8/8 | 4.4 / 3.4 | 12.0 | 4.6 |
| Inkling 2 Mini | 64/64 | 8/8 | 8/8 | 4.0 / 4.2 | 13.6 | 4.1 |
Since every run passed, I also looked at the code itself. I shuffled the 24 diffs, hid the
model names and gave each a score from 1 to 5. I added the names back only after scoring. The
scoring was done by Claude Opus 5.5 working with me, so it reflects one reviewer's taste.
The differences were small, but there was a pattern:
- Qwen3.8-27B was the most consistent. It used integer maths for money and validated input
strictly.
- Inkling 2 Mini once rounded money with floating point, and once accepted a malformed amount
(`1.2,50`).
- Flash Next added things nobody asked for in the bug-fix ticket, such as negative amounts and
US number format.
## Four agents at once
This was the part I was most curious about. I gave all four tickets to Inkling 2 Mini at the
same time, one agent per ticket, using four server slots. Quality was unchanged: 32 of 32
hidden tests passed and every status line was honest. Speed was not.
![Minutes to finish all four tickets](charts/parallel_vs_sequential.png)
I expected parallel agents to win, because batching several requests usually helps on a GPU.
The server logs showed why it didn't here:
![Prompt processing speed with one and four agents](charts/prefill_under_load.png)
Each agent turn sends roughly 7,000 to 10,000 tokens of context. With one agent, Inkling
processed that prompt at about 380 tokens per second. With four agents, each request got
about 105 to 124 tokens per second, and an average prefill took about 80 seconds instead of
24. Generation held up fine at about 35 tokens per second per slot, but a coding agent spends
much more time reading than writing, so the slower prefill decided the result.
I stopped after one parallel batch, so this is one data point for one model. I'd be happy to
be told about a setting I missed.
## Other things I learned
**Inkling 2 Mini uses a lot of memory for long context.**
![Inkling 2 Mini memory against context size](charts/inkling_memory.png)
That works out to about 146 KB per token with a q8_0 cache, on top of about 24 GB for the
weights, drafter and buffers. My guess is that the looped layers (the middle layers run three
times per token) keep a separate cache for each pass, but I haven't verified that.
**Speculative decoding helped both small models.** In short smoke tests, Inkling's DSpark draft
had 61% of its tokens accepted, and Qwen3.8-27B's MTP draft had 50% accepted, with an average of
2.5 tokens per step. Inkling slowed from about 47 to about 28 tokens per second over a long
answer of about 1,000 tokens.
**A small llama.cpp detail.** I built a desktop widget that shows which models are loaded.
With `--sleep-idle-seconds`, polling `GET /slots` counts as activity, so my widget kept the
model awake. Polling `GET /props` (which has an `is_sleeping` field) and `GET /metrics` does
not wake it.
## What I'd do differently
- Harder tickets. All three models passed everything, so these tasks were too easy to show
differences in correctness. Multi-file tickets would be a better test.
- More runs. At temperature 1.0 the runs vary, and two per ticket is not much.
- More than one reviewer for code quality.
- Run the parallel test for all three models, and try fewer slots (two instead of four).
- Run all models on the same llama.cpp build.
## What I'm using now
One Qwen3.8 Flash Next agent, working through tickets one at a time. I deleted Inkling 2 Mini
and Qwen3.8-27B from the machine. If I need a smaller model next to a heavy job later,
Qwen3.8-27B is the one I'd bring back.
## Files
- `results/sequential_runs.csv`: one row per run, with model, ticket, run, time, turns,
output tokens, hidden tests, honest status line, diff size and blind score
- `results/parallel_batch_inkling.csv`: the four-agent batch
- `results/prefill_under_load.csv`: prefill speed with one and four agents, from server logs
- `results/inkling_kv_memory.csv`: memory against context size
- `charts/` and `make_charts.py`: the figures and the script that draws them from the CSV files
The app's source code, the tickets in full and the diffs are not included, because the app is
private.
## Note on AI use
I ran this test together with Claude Code (Claude Opus 5.5). It helped set up the servers,
write the run scripts, score the diffs blind and draft this write-up. The decisions,
the machine and the conclusions are mine.