// 编程智能体

Best Local LLM for Coding, by VRAM Tier

16 GB 显卡运行 Granite 4.2 8B(32K 上下文需 10.7 GB);24 GB 显卡运行 Devstral Small 2 24B(21.3 GB)。 Each pick is the Model Finder's coding choice for that machine, kept only where it fits comfortably at 32K context, and every figure comes from our engine at Q4_K_M.

作者 Jakub Rusinowski · 最后更新 2026年11月25日 · 硬件数据由我们的 VRAM 引擎

Most "best coding LLM" lists rank models nobody can run. This one starts from the memory you have. Every row is sized at 32K context, because a coding agent re-sends its system prompt, its tool schema and the files it is reading on every turn, and a model that only fits at a short context stops working the moment the agent opens a real file.

A pick has to fit comfortably on the tier's reference device: the model, its cache at 32K and the runtime overhead, with room to spare. Where nothing does, the row says so and names the closest option. Picks come from the Model Finder, so this page and the Finder never disagree. For every model scored and ranked for coding, see the coding leaderboard; for how much memory each part of a coding setup takes, see VRAM for coding models; for a dated, citable snapshot, see Local AI Report #6.

Best local coding LLM for each GPU memory tier

Figures are for one card at Q4_K_M. Speeds are estimates for the named reference card, shown as a range.

内存首选(次选)32K 上下文所需内存速度(估算)许可
8 GB
RTX 4060
Granite 4.2 3Bollama pull granite4.2:3b6.4 GB
余量 1.6 GB
30–58 tok/s
估算
Apache-2.0
12 GB
RTX 3060 12GB
Granite 4.2 8B
次选: Qwen 3.5 9B
ollama pull granite4.2:8b
10.7 GB
余量 1.3 GB
15–30 tok/s
估算
Apache-2.0
16 GB
RTX 5060 Ti 16GB
Granite 4.2 8B
次选: Qwen 3.5 9B
ollama pull granite4.2:8b
10.7 GB
余量 5.3 GB
24–50 tok/s
估算
Apache-2.0
24 GB
RTX 4090
Devstral Small 2 24B
次选: Qwen3-Coder 30B-A3B (MoE)
ollama pull devstral-small-2:24b
21.3 GB
余量 2.7 GB
29–56 tok/s
估算
Apache-2.0
32 GB
RTX 5090
Qwen3-Coder 30B-A3B (MoE)
次选: Devstral Small 2 24B
ollama pull qwen3-coder:30b
22.7 GB
余量 9.3 GB
115–238 tok/s
估算
Apache-2.0
48 GB
RTX 6000 Ada
Qwen3-Coder 30B-A3B (MoE)
次选: Devstral Small 2 24B
ollama pull qwen3-coder:30b
22.7 GB
余量 25.3 GB
84–162 tok/s
估算
Apache-2.0

8 GB

Granite 4.2 3B 在 RTX 4060 上以 32K 上下文运行需要 6.4 GB,剩余 1.6 GB,估算速度 30–58 tok/s。 Eight gigabytes is autocomplete and small edits territory: a coding agent with a long context does not fit alongside anything else.

本档位相关: 8 GB 可运行的全部模型 · RTX 4060 最佳模型 · RTX 3060 Ti 最佳模型

12 GB

Granite 4.2 8B 在 RTX 3060 12GB 上以 32K 上下文运行需要 10.7 GB,剩余 1.3 GB,估算速度 15–30 tok/s。 Twelve gigabytes runs a capable small coder with a real context, which is enough for single-file edits and explanations.

本档位相关: 12 GB 可运行的全部模型 · RTX 3060 12GB 最佳模型 · RTX 4070 Super 最佳模型

16 GB

Granite 4.2 8B 在 RTX 5060 Ti 16GB 上以 32K 上下文运行需要 10.7 GB,剩余 5.3 GB,估算速度 24–50 tok/s。 Sixteen gigabytes adds headroom rather than a bigger model: the 24B coders need more than this at a long context.

本档位相关: 16 GB 可运行的全部模型 · RTX 5060 Ti 16GB 最佳模型 · RTX 4060 Ti 16GB 最佳模型

24 GB

Devstral Small 2 24B 在 RTX 4090 上以 32K 上下文运行需要 21.3 GB,剩余 2.7 GB,估算速度 29–56 tok/s。 Twenty-four gigabytes is where dedicated agentic coders start to fit with a working context.

本档位相关: 24 GB 可运行的全部模型 · RTX 4090 最佳模型 · RTX 3090 最佳模型

32 GB

Qwen3-Coder 30B-A3B (MoE) 在 RTX 5090 上以 32K 上下文运行需要 22.7 GB,剩余 9.3 GB,估算速度 115–238 tok/s。 Thirty-two gigabytes runs the fast mixture-of-experts coder with room for a longer context or an autocomplete model beside it.

本档位相关: 32 GB 可运行的全部模型 · RTX 5090 最佳模型

48 GB

Qwen3-Coder 30B-A3B (MoE) 在 RTX 6000 Ada 上以 32K 上下文运行需要 22.7 GB,剩余 25.3 GB,估算速度 84–162 tok/s。 Forty-eight gigabytes buys context and parallel models, not a stronger single coder: the next step up in quality needs 64 GB-class memory.

本档位相关: 48 GB 可运行的全部模型 · RTX 6000 Ada 最佳模型

Best local coding LLM for Macs, by unified memory

A Mac shares its memory with the system, so only part of it is usable for a model. Speeds are estimates for the smallest current Mac in each tier.

内存首选(次选)32K 上下文所需内存速度(估算)许可
16–24 GB
Apple M6 16 GB
Granite 4.2 8B
次选: Qwen 3.5 9B
ollama pull granite4.2:8b
10.7 GB
余量 1.3 GB
5.7–12 tok/s
估算
Apache-2.0
32–36 GB
Apple M6
Devstral Small 2 24B
次选: Qwen3-Coder 30B-A3B (MoE)
ollama pull devstral-small-2:24b
21.3 GB
余量 2.7 GB
3.0–6.2 tok/s
估算
Apache-2.0
48–64 GB
Apple M5 Pro
Qwen3-Coder 30B-A3B (MoE)
次选: Qwen 3.6 35B-A3B
ollama pull qwen3-coder:30b
22.7 GB
余量 25.3 GB
19–40 tok/s
估算
Apache-2.0
96–128 GB
Apple M3 Max (30-core GPU)
Qwen3-Coder 30B-A3B (MoE)
次选: Qwen 3.6 35B-A3B
ollama pull qwen3-coder:30b
22.7 GB
余量 49.3 GB
19–39 tok/s
估算
Apache-2.0

16–24 GB

Granite 4.2 8B 在 Apple M6 16 GB 上以 32K 上下文运行需要 10.7 GB,剩余 1.3 GB,估算速度 5.7–12 tok/s。 A 16 or 24 GB Mac runs a small coder comfortably, but expect modest speed on the base chips.

本档位相关: Mac mini M6 16 GB · MacBook Pro 14 M6 24 GB

32–36 GB

Devstral Small 2 24B 在 Apple M6 上以 32K 上下文运行需要 21.3 GB,剩余 2.7 GB,估算速度 3.0–6.2 tok/s。 At 32 to 36 GB a 24B agentic coder fits, though the base chips run it slowly; a Max chip, with far more memory bandwidth, is much faster.

本档位相关: Mac mini M6 32 GB · Mac Studio M5 Max 36 GB

48–64 GB

Qwen3-Coder 30B-A3B (MoE) 在 Apple M5 Pro 上以 32K 上下文运行需要 22.7 GB,剩余 25.3 GB,估算速度 19–40 tok/s。 From 48 GB the fast mixture-of-experts coders fit with room for long contexts.

本档位相关: MacBook Pro 14 M5 Pro 48 GB · Mac mini M4 Pro 64 GB

96–128 GB

Qwen3-Coder 30B-A3B (MoE) 在 Apple M3 Max (30-core GPU) 上以 32K 上下文运行需要 22.7 GB,剩余 49.3 GB,估算速度 19–39 tok/s。 From 96 GB you can run a coder and a second model together, or a much longer context.

本档位相关: Mac Studio M5 Ultra 96 GB · MacBook Pro M4 Max 128 GB

Buying a Mac for this? The Mac local AI buying guide compares every configuration by usable memory and bandwidth.

Add a small autocomplete model. Coding models split into agentic coders, which drive an editing loop, and small fill-in-the-middle models, which complete code as you type and are judged on latency. If your tier has headroom left, run a small autocomplete model such as StarCoder 2 beside the pick. The VRAM for coding models guide sizes the pair.

Pair the model with an agent

A model is half of a local coding setup; the agent or harness around it decides how well it works. Start with the end-to-end setup guide, read what an agent harness does for a local model, and compare harnesses side by side in the agent harness matrix.

The frontier you can’t download (and when to call it)

The largest open-weight coders — DeepSeek V4, GLM-5.x, Kimi K2.x and Qwen3-Coder 480B — want 80 GB-class multi-GPU hardware. For a solo developer they are API models. The pattern that wins: a fast local coder for the inner loop (autocomplete, quick edits, private code) plus a frontier model over an API for the hardest problems. Our cloud AI directory lists where each one is hosted.

The MoE offload trick. Small-active-parameter mixture-of-experts models only read their active experts per token. With llama.cpp's expert-offload options the inactive experts can sit in system RAM, which turns a workstation model into something a well-RAMed gaming PC can try. It is slower than the all-in-memory figures above.

The hardware these tiers assume

The 24 GB tier is where local agentic coding starts to fit, and two cards own it: the RTX 4090, and the used RTX 3090 as the budget route to the same memory. A 16 GB card such as the RTX 5060 Ti 16GB runs a small coder with a long context. Street prices move a lot, so compare before you buy.

联盟营销声明: 本页部分链接为联盟推广链接——如果你通过它们购买,LLM Configurator 可能会获得佣金,而你无需支付任何额外费用。作为亚马逊联盟成员(Amazon Associate),LLM Configurator 会从符合条件的购买中获得收益。
NVIDIA GeForce RTX 4090 24GB
24 GB VRAM · 450 W board power
2026年价格波动较大——请以当前商品页价格为准。
NVIDIA GeForce RTX 3090 24GB
24 GB VRAM · 350 W board power
2026年价格波动较大——请以当前商品页价格为准。
NVIDIA GeForce RTX 5060 Ti 16GB
16 GB VRAM · 180 W board power
2026年价格波动较大——请以当前商品页价格为准。

Shopping this week? The deals page tracks current GPU and Mac offers.

没有硬件?先租一块 GPU

Hardware falls short of the model you want? Rent a 24–48 GB GPU by the hour and test the exact model before buying anything.

  • RunPod — RTX 4090 ≈ $0.3–0.7/hr, A100/H100 by the hour; serverless per-second billing available
  • Vast.ai — Marketplace of hosted GPUs — often the cheapest per hour (interruptible options)
  • Lambda — On-demand A100/H100/B200 instances and clusters, per-hour billing

Affiliate links — we may earn a commission if you sign up, at no extra cost to you.

完整列表见 云 AI 目录.

常见问题

What is the best local LLM for coding?

It depends on your memory. On a 24 GB GPU, Devstral Small 2 24B fits comfortably at 32K context; on 32 GB and up, Qwen3-Coder 30B-A3B is the pick and runs fast because only about 3B of its parameters are read per token. The table above gives one pick per tier.

What is the best coding LLM for 8 GB VRAM?

Granite 4.2 3B is the pick that fits an 8 GB card comfortably at 32K context. Larger coders fit only with a much shorter context, so on 8 GB treat local AI as autocomplete and small edits.

What is the best coding LLM for 12 or 16 GB VRAM?

Granite 4.2 8B fits both comfortably at 32K context, with Qwen 3.5 9B as the runner-up. A 16 GB card buys headroom rather than a bigger model: the 24B coders need more memory than that at a long context.

What is the best coding LLM for 24 GB VRAM?

Devstral Small 2 24B, Mistral's agentic coder, fits an RTX 3090 or 4090 comfortably at 32K context. Qwen3-Coder 30B-A3B is much faster but only a tight fit on 24 GB at that context, so keep its context shorter.

What is the best local LLM for agentic coding?

An agentic coder needs a long context, so it starts to fit at 24 GB. Devstral Small 2 and Qwen3-Coder 30B-A3B are both built for agent loops; pair either with a harness from the agent harness matrix.

What is the best coding model for my GPU?

Each tier above links to the best-models page for its cards, which ranks every model that runs on that exact GPU, coding included. The compatibility checker gives the verdict for any card at your own context length.

Which Qwen model should I use for coding on a 32 GB Mac (M1 Pro 32 GB)?

About three quarters of a 32 GB Mac is usable for a model, so Qwen3-Coder 30B-A3B is only a tight fit there at a long context. It is fast for its size because only about 3B parameters are read per token; on a base chip, Devstral Small 2 fits more comfortably but runs slowly.

Which Ollama models are best for coding?

Every pick in the tables shows the Ollama tag the Model Finder publishes for it: run ollama pull with that tag. Picks without a tag ship as GGUF files on Hugging Face.