Icon Library

A local LLM for coding on a 20 GB GPU

By André M. Ferreira · November 23, 2026

Tools like Claude Code, GitHub Copilot and Cline changed how we write code, but all of them send your code to someone else’s server. If you work with sensitive databases, the question is obvious: can you have something similar in-house, on a machine you already own? I set up, tuned and measured a coding assistant that runs entirely on a workstation, with no cloud.

Icon Library itself already runs a small model on a server of mine, Gemma 3 with 4 billion parameters, for two jobs: describing the icons submitted to the community before I moderate them and, once a day, turning searches with no results into synonyms, so that someone who searches for “lixeira” (Portuguese for trash can) finds the icons named trash. Those are short tasks, and a small model is enough. Writing code is another scale, and this test measures how far a local model goes when the job is programming.

In short

How I measured

I treated it as a proof of concept, with the system installed from scratch just for this and wiped afterwards. I measured three things:

The machine

An HP Z4 G5, an office workstation, far from an AI server. For an LLM, what matters is the GPU: an NVIDIA RTX 4000 Ada with 20 GB and about 360 GB/s of memory bandwidth. The rest only helps when the model does not fit on the card.

PartSpecificationRole in the test
GPURTX 4000 Ada · 20 GB GDDR6 · ~360 GB/sWhere the model needs to live
CPUXeon w5-2555X · 14 coresMoE experts when the model does not fit
RAM128 GB DDR5 ECC at 4800 MT/sRoom for the weights that spill over
Disk2 TB NVMeModels up to 89 GB

The system is Ubuntu 26.04 LTS in text mode: with no desktop, the GPU is free for the model, and access is over SSH. I used the NVIDIA 595 driver with CUDA 13.1 and llama.cpp built for the Ada architecture. llama-server exposes an OpenAI-compatible API on the local network, and VS Code with Cline, on my PC, talks to it.

The models

The golden rule of local LLMs is that the whole model fits in video memory, along with the context cache. I picked three open-weight models with very different profiles:

ModelArchitectureWhere it runs
Qwen3-Coder 30B-A3B, made for codeMoE, ~3 billion active parameters per token100% on the GPU
Qwen3.8 27B, general-purpose with reasoningDense100% on the GPU
Qwen3.8 Flash-Next, large general-purpose with reasoningLarge MoE, ~89 GBGPU, with the experts in RAM

Flash-Next breaks the golden rule on purpose: there is no way it fits in 20 GB. The shared part of the model and the cache stay on the GPU; the experts go to RAM, with an 8 GB cache on the card for the most used ones. It answers the question: is it worth waiting longer for a much bigger model?

Speed: memory bandwidth rules

The measurements go through the API with the prompt cache off, so the time to first token includes reading the whole context. The tables show what happens as the prompt grows, which is exactly what an agent does when it reads the project’s files.

Generation speed

ModelShort prompt7K tokens28K tokens56K tokens
Coder IQ4, f16 KV cache114.1 t/s83.5 t/s58.7 t/s—
Coder Q3, q8 KV cache (starting setup)108.5 t/s81.7 t/s40.2 t/s25.2 t/s
Qwen3.8 27B21.8 t/s21.2 t/s19.3 t/s—
Qwen3.8 Flash-Next17.0 t/s17.4 t/s18.2 t/s—

Time to first token

ModelShort prompt7K tokens28K tokens56K tokens
Coder IQ4, f16 KV cache0.2 s1.6 s10.0 s—
Coder Q3, q8 KV cache (starting setup)0.3 s2.3 s13.8 s37.2 s
Qwen3.8 27B1.1 s6.9 s29.0 s—
Qwen3.8 Flash-Next, 2048 batch5.6 s21.0 s73.2 s—
Qwen3.8 Flash-Next, 8192 batch—10.0 s37.5 s—

A dash is a measurement I did not take. The 28K column includes Coder Q3’s measurement at 29.8K tokens.

Qwen3-Coder activates only about 3 billion parameters per token and fits entirely on the GPU: it goes past 100 tokens per second with a short prompt and reads context at 3 to 4 thousand tokens per second. The dense 27B has to read every weight for each token and stays at about 20. Flash-Next fetches experts from RAM for every token and generates about 17, whatever the prompt size, because its limit is DDR5 bandwidth, not the GPU.

Tuning that paid off

ChangeModelBeforeAfter
Micro-batch -ub 2048 (reading 7K tokens)Coder Q33,344 t/s3,854 t/s
f16 KV cache instead of q8 (generating with 28K tokens)Coder Q343.2 t/s58.1 t/s
IQ4_XS quantization instead of Q3 (short prompt)Coder108.5 t/s114.1 t/s
Batch -ub 8192 (first token with 28K)Flash-Next73.2 s37.5 s

The last one is the most interesting. With the experts in RAM, every prompt batch copies weights over PCIe. Bigger batches make one copy serve more tokens, and prompt reading doubled, from ~370 to ~740 tokens per second. With a 16,384 batch reading rose to 877, but generation fell from 17 to 13. Not worth it.

Quality: speed is not everything

I wrote 12 everyday programming tasks: implement functions (a duration parser, intervals, an LRU cache, Dijkstra), validate a Brazilian tax ID (CPF), fix bugs, refactor, write SQL with window functions and predict the output of a piece of code. Each answer runs against assertions: it passes or it doesn’t.

ModelCorrectTime per taskWhere it failed
Coder 30B Q369% (25 of 36)1.5 sDuration parser, predicting output, LRU, Dijkstra
Coder 30B IQ483% (30 of 36)1.6 sDuration parser, predicting output
Qwen3.8 27B100% (12 of 12)36 s—
Qwen3.8 Flash-Next100% (20 of 20)41 s—

Coder ran each task 3 times; the 27B, once; Flash-Next, one to three times. Coder is fast and good, but it fails consistently in two places: the parser’s edge cases and predicting code output, which takes “running it in your head”. The more precise IQ4 version fixed the LRU and Dijkstra that Q3 got wrong. Both Qwen3.8 models got everything right, but they think before answering: about 40 seconds per task, against 1.5 for Coder.

For autocomplete and quick questions, Coder on the GPU is unbeatable. For work that has to be right, reasoning makes the difference.

Agent mode: the test that matters

Getting one function right does not tell you whether the tool can work alone. For that I wrote a SPEC.md for a task API in FastAPI and SQLite, with seven endpoints, validation, pagination and statistics. The request to Cline was one sentence: read SPEC.md, implement it, create the virtual environment, run the tests with pytest and fix things until they pass. Besides the agent’s own tests, an independent suite of 15 acceptance tests checks the application against the specification.

RunTimeAcceptance testsAgent’s pytest
Qwen3-Coder, run 1, no rules4.5 min0 of 154 of 13
Qwen3-Coder, run 2~30 min1 of 158 of 13
Qwen3-Coder, run 3, with rules and review~15 min9 of 159 of 13
Flash-Next, single run, no help18 min15 of 1513 of 13

Qwen3-Coder: fast, but runs out of breath

The first delivery came in 4.5 minutes, and it was broken: Pydantic v1 in a v2 project, tables that were never created, a package without __init__.py and the statistics endpoint missing. In the next runs the model started reading the same file in a loop, with corrupted Windows paths (the backslashes vanished in its tool calls), until Cline stopped the task. With explicit rules in a .clinerules file and a review pointing at the failures, it reached 9 of 15, after almost an hour.

Flash-Next: slow and steady

With medium reasoning effort and 64K tokens of context, Flash-Next read the specification, planned in three steps, created every file, installed the dependencies and ran the tests. In 18 minutes: 13 of 13 pytest tests passing, showing the real output instead of claiming they passed, and 15 of 15 on the acceptance tests. It used 24.5K of its 65.5K context tokens and needed no help from me.

Cline with Flash-Next showing a three-step plan and creating the project files
Flash-Next: a three-step plan before the first file.
Cline stopped after five identical reads of a file with a corrupted path
Coder 30B: five identical reads of a corrupted path, and the task stopped.

At 17 tokens per second every answer takes a while, and reading the context costs 10 to 37 seconds. It is the pace of a careful colleague: you hand over the task, do something else and come back to review. Over its three runs Coder spent about 50 minutes and needed help; Flash-Next generated tokens six times slower and finished in 18. The big model was not faster. It was more reliable, and that is why it finished first.

What I learned

Verdict

The machine works, with a clear split of roles:

For Flash-Next to answer like an interactive tool, the game changer is the GPU. A 96 GB card such as the RTX PRO 6000 Blackwell Max-Q (300 W, ~1.8 TB/s) fits in the same Z4 G5 and would keep the whole model in video memory, with about five times today’s bandwidth. Going by the bandwidth ratio, the estimate is 80 to 110 tokens per second, with the first token in a few seconds. It is a projection, not yet measured.

To reproduce

The final Flash-Next command line:

llama-server -m Qwen3.8-Flash-Next-UD-IQ4_XS-00001-of-00004.gguf \
      -c 65536 -ctk f16 -ctv f16 \
      -ngl 999 -fa on --jinja \
      -b 8192 -ub 8192 \
      --cpu-moe --moe-cache-mib 8000 \
      -ot per_layer_token_embd.weight=CPU \
      -t 14 -np 1 --temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 \
      --chat-template-kwargs '{"reasoning_effort":"medium"}'

For Coder 30B IQ4: -c 32768 with an f16 cache for interactive use, or -c 65536 with a q8 cache for agent mode, -b 4096 -ub 2048 and temperature 0.7.

Setup: HP Z4 G5 · RTX 4000 Ada 20 GB · Ubuntu 26.04 LTS · NVIDIA 595 / CUDA 13.1 · llama.cpp built on November 18, 2026 · VS Code + Cline. The numbers change with new versions of the engine and the models.

See also the other article: designing an icon when none fits.