I was supposed to play GTA. Instead, I spent the evening trying to run Qwen4-35B-A3B on a GTX 1660 Super. By the end of it I had a local coding agent, a terminal pigeon simulator, and roughly 15 GB of swap in use.

The pigeon worked. My RAM had a bad time.

The hardware

Nothing particularly interesting here:

Component What I have
CPU Ryzen 5 5600
GPU GTX 1660 Super, 6 GB VRAM
RAM 32 GB DDR4-3000
Storage SATA SSD (Linux and model cache)
OS CachyOS, Hyprland
Swap ZRAM, zstd, 31.3 GiB logical capacity

The model is Qwen4-35B-A3B, quantized by Unsloth, specifically UD-Q4_K_M. It's a MoE with about 3B active parameters per token, but the model card also lists a separate 20B-parameter n-gram embedding and a 2B MTP component. So no, 3B active parameters does not mean you need enough memory for a 3B model. And no, the entire thing wasn't running in 6 GB of VRAM.

Getting it to run

Built llama.cpp from source with CUDA support. Here's the server command I used:

./build/bin/llama-server \ -hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_M \ --cpu-moe \ --lazy-mode auto \ --fit on \ --fit-target 1024 \ -c 16384 \ -ctk q8_0 \ -ctv q8_0 \ -b 256 \ -ub 128 \ -t 6 \ -np 1 \ --jinja \ --alias qwen4 \ --host 127.0.0.1 \ --port 8080 

The actual llama-server launch command and GGUF download

--cpu-moe keeps expert weights on the host. The GPU handles part of the inference, not the entire model. I limited the context to 16K, requested Q8 KV-cache types and one server slot. The startup log warned that automatic fitting couldn't proceed with the explicit tensor overrides, so don't assume --fit actually optimized the placement here.

Didn't record the exact llama.cpp commit, unfortunately. This is the command from my run, not a guarantee that every build supports the same flags.

Opened the built-in web UI, typed a greeting in Russian and got this:

The first response, after a very long prompt evaluation

361 prompt tokens in 149.4 seconds. 28 generated tokens in 1.92 seconds according to the server log. I spent two and a half minutes saying hello.

The CPU was mostly idle during the initial stall. ps -L showed folio_wait_bit_common and there was disk activity. With mmap and model data on a SATA SSD, page faults and loading weights were the obvious suspects. I didn't profile the faults individually, so I can't prove how much time each source of latency accounted for.

Once things warmed up, the model was generating around 20–27 tokens/s. It could write Python, hold a conversation and even use the web UI's JavaScript tool to calculate my food macros. It still picked the wrong nutritional values for cooked turkey and occasionally mixed Russian with Chinese or Korean. Fast doesn't mean correct.

Claude Code ate the context

Wanted to try an actual coding agent, not another quicksort prompt. Set up Claude Code (2.1.337) against the local endpoint. Typed the equivalent of "hey, what can you do?".

3 minutes 49 seconds later:

Claude Code context report showing 13.2K out of 16.4K tokens
13.2K / 16.4K tokens used. 80% of the context gone. The tool definitions alone accounted for an estimated 6.8K. On the second message it started compacting the conversation.

I hadn't asked it to write a single line of code yet.

So I switched to Pi.

Pi, with most of the extras turned off

Installed the package and configured a local OpenAI-compatible provider. Pi was v1.8.0 during the experiment.

npm install -g --ignore-scripts @earendil-works/pi-coding-agent 

~/.pi/agent/models.json:

{ "providers": { "local": { "baseUrl": "http://127.0.0.1:8080/v1", "api": "openai-completions", "apiKey": "local", "compat": { "supportsDeveloperRole": false, "supportsReasoningEffort": false, "maxTokensField": "max_tokens" }, "models": [ { "id": "qwen4", "name": "Qwen4 35B A3B", "reasoning": true, "input": ["text"], "contextWindow": 16384, "maxTokens": 4096, "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0} } ] } } } 

~/.pi/agent/settings.json:

{ "compaction": { "enabled": true, "reserveTokens": 4096, "keepRecentTokens": 4096 } } 

Then from an empty Git repo:

pi --provider local --model qwen4 \ --no-skills --no-extensions --no-context-files \ --offline --tools read,bash,edit,write 

The dummy API key is for my loopback server, which had no authentication configured. Don't expose that server to the network. Also, --offline isn't a sandbox; the agent can execute shell commands with your permissions.

Same greeting, more or less. This time the finished reply left me at 10.3% context usage.

Pi answering a greeting with 10.3 percent context usage

Not a controlled comparison of the two clients: different prompts and tool sets, different token accounting, and I deliberately stripped down Pi. But for my 16K setup, this was the difference between having room to work and compacting after hello.

The pigeon benchmark

Needed a task that wasn't just reproducing a code snippet. So I asked it to make a pigeon simulator. The original prompt was in Russian; here's the translation:

Create a terminal-based pigeon simulator in Python in the current repository. The pigeon should move around a 2D map by itself, look for bread, avoid humans and occasionally produce random pigeon thoughts. Give it hunger, energy and intelligence stats. At critically low intelligence, it should forget that it's a pigeon. Use only the Python standard library. Write tests for the core logic, run them, fix the errors and add a README. Work independently, don't just print code in chat.

It checked the directory and Python version, decided to separate the game logic from the UI, and started writing files. Used random.Random with a seed so the tests could be deterministic.

The agent starts writing the simulation after inspecting the repository

The resulting project structure:

qwen-test/ ├── pigeon.py ├── main.py ├── tests/ │ └── test_pigeon.py └── README.md 

And at this point I was watching the server log more than the code.

Server timings during agent work: 26.37 generated tokens per second over 3613 tokens

A sustained 26.37 tokens/s across 3,613 generated tokens. The next request processed 3,639 prompt tokens at 76.84 tokens/s. Not a theoretical hardware benchmark, but actual traffic from a coding agent.

The tests failed. Good.

First run: 27 tests, four failures.

The first failed unittest run and the agent's debugging
It didn't immediately rewrite everything. It inspected the failure messages, checked coordinate arithmetic and found mistakes in both the implementation and the tests.

One test expected a pigeon at (5, 5) to move to (4, 4) when fleeing a human at (0, 0). That's moving towards the human. The implementation returned (6, 6) instead. Another test recalculated the bread's position relative to the pigeon after moving it, so the distance never changed.

Then there was an actual bug in vertical movement. Missing + dy. A remarkably normal bug for something running on a very abnormal setup.

Second run: 25/27.

Then Pi hit the output limit. It refused to execute an incomplete tool call, compacted the conversation and attempted to recover. Eventually that failed too. A short "continue" didn't help. I had to start a new session and tell it to read the existing files, fix the remaining errors and finish the README.

Pi failing to recover a truncated tool call

So it wasn't a clean one-shot run. I did intervene with prompts and one new session. I didn't manually edit the code.

It picked up the project again, found the remaining failure, applied the fix, ran a 50-tick smoke test and wrote the README. About 21 minutes after the original task, it reported 27/27 tests passing.

The agent's completion report with 27 passing tests and the README

These were the agent's own tests and its own completion report, not an independently maintained test suite. And there was still a bug: when I asked about the controls afterwards, it found that sys.stdin.read(1) blocked the main loop waiting for input. A pigeon that was supposed to move by itself needed keyboard input to advance. The agent suggested using select.select() with a timeout. I left that defect in the final version.

The agent explains the blocking keyboard read

27 green tests. Still not quite the specification. Worth remembering.

Meanwhile, Linux was having a bad evening

I had btop and vmstat 1 open throughout the run. Swap usage kept climbing. 4 GB, 7 GB, 11 GB, then 15 GB. At one point MemFree was around 250 MiB.

Free memory alone is a pretty useless indicator here because Linux was also caching model pages. So I checked the actual ZRAM allocation and memory pressure:

zramctl free -h cat /proc/pressure/memory 

Final ZRAM, free memory and PSI snapshot

Earlier Near the end
Uncompressed data in ZRAM 5.6 GiB 14.6 GiB
Physical RAM used by ZRAM (TOTAL) 2.3 GiB ~10 GiB
Effective compression ratio ~2.4:1 ~1.5:1

Ten gigabytes of physical RAM, just for compressed swap. The 60-second full memory PSI was 4.57% — all non-idle tasks were simultaneously stalled on memory for that fraction of the interval (kernel PSI docs). The system was under real pressure, not merely using its RAM for cache.

And the performance reflected that:

Request / stage Prompt eval (tok/s) Generation (tok/s)
First greeting 2.42 14.03
Long agent output (3,613 generated tokens) 36.01 26.37
Next agent prefill (3,639 tokens) 76.84 —
Debugging request 69.39 27.24
Late request after compaction 17.92 11.29
Final cancelled request (first 256 tokens) 4.11 —

Late session slowdown, with the first 256 tokens taking over a minute
These are selected server-log observations, not standardized runs. Prompt lengths, cache reuse, model residency and system load varied. The final request had not finished when I cancelled it.

The funny thing was that decode would occasionally recover to 26 tokens/s even when prefill was getting destroyed. I suspect weight pages being evicted and reloaded were part of the problem. The server's RAM prompt-state cache is another thing I want to isolate. Next time I'd run the same task with --cache-ram 0 and compare the memory curves. I haven't tested that yet and can't call the growth a memory leak.

Shut down the server after roughly 104 minutes (including startup/download and other experiments). No observed OOM kill. Free RAM went from a few hundred MiB to about 8 GiB; VRAM usage fell from 5 GB to 1 GB; swap dropped to about 6 GiB. The rest doesn't have to be faulted back into RAM immediately.

btop memory and swap after the inference server stopped

And the pigeon?

The actual pigeon simulator running in my terminal

Five pieces of bread eaten. Three humans avoided. Intelligence: 66.2.

The pigeon is wondering whether you need to know how to fly to be a pigeon.

I don't have a particularly grand conclusion here. A 6 GB GPU plus 32 GB of RAM was enough to do useful local agentic work with a sparse model. Not enough to make it comfortable over a long session. The agent harness mattered a lot, and green tests weren't the same thing as a finished feature. If I were buying hardware specifically for this, memory capacity and bandwidth would be a much bigger consideration than they were yesterday.

But I got a pigeon out of it. On a 1660 Super.

I'm going to bed.

Disclosure: I ran the experiment, supplied the prompts and captured the original screenshots. ChatGPT helped analyze the run and drafted this article from my notes and screenshots. The measurements are from the actual local run; the screenshots have been cropped/redacted for privacy.