All AI guides
Buyer's guide14 min read

Best AI Models You Can Run Locally for Coding in 2026

The best AI model for local coding on a single 24GB GPU is Qwen3.8-27B, which scored 12 of 12 on real coding tasks in an August 2026 benchmark against Gemma 4 31B's 6 of 12. Under 16GB VRAM, Gemma 4 12B or Phi-4 fit instead. DeepSeek-V4.1-Flash and GLM-5.3-Flash need well over 100GB of unified memory, not a consumer GPU.

The short version

For a single 24GB GPU, Qwen3.8-27B is the best-tested local coding model, beating Gemma 4 31B 12 to 6 on real coding tasks in an August 2026 benchmark. Gemma wins when a confirmed license matters more than pass rate. Under 16GB VRAM, pick Gemma 4 12B or Phi-4. The flash MoE models need over 100GB, not a normal GPU.

Qwen3.8-27B answered 12 of 12 real coding tasks correctly on a single 24GB consumer GPU in an August 2026 benchmark; Gemma 4 31B, its closest open-weight rival at the same size, answered only 6.

That gap matters because most "best local coding model" roundups rank by parameter count or a single leaderboard score, not by whether a model finishes a coding task on hardware you can actually buy. Nine open-weight models released in the past five months claim to work for local coding, from a 12B model that fits an old gaming card to a 2.4-trillion-parameter model that needs a data-center rack.

Only one published test ran several of them against each other on the same prompts, the same GPU, the same day. This guide sorts the field by what your hardware, your license risk and your privacy requirement will actually run, not by spec-sheet size.

How to choose: four questions that actually decide it

Before the shortlist, answer these. Skipping them is how people end up buying a 5090 for a model a 4070 could have run.

  1. How much VRAM is actually free, not installed? A browser, a monitor and a Docker daemon can eat 4GB before inference starts.
  2. Do you need a settled commercial license? Apache 2.0 and MIT close that question. An unannounced license does not, however permissive the marketing sounds.

The other two questions matter just as much, and they're the ones a spec sheet never answers for you.

  1. Are you judging "good at coding" by a leaderboard score or by finished tasks? A model can top a reasoning benchmark and still miss tool calls it was never tuned for.
  2. Is "local" a GPU you own, or a rack you'd buy? The two answers point at different models, covered separately below.

If you'd rather compare every currently-GA model by blended price, benchmark and speed in one table instead of reading through this guide's picks, HokAI's model leaderboard ranks all of them side by side. For choosing under a specific constraint, like "open weights only" or "under 20GB," the model recommender filters to that constraint directly.

VRAM / unified memory you haveRealistic pickWhy
8-12GBGemma 4 12B or Phi-4Dense models, no MoE offload complexity
16-24GBQwen3.8-27BBest-tested pick at this tier (see below)
128GB+ unified memory (Mac Studio, DGX Spark)GLM-5.3-Flash has a working build; DeepSeek-V4.1-Flash does not yetMixture-of-experts, huge total size, small active compute
Anything under 100GB, and you were told this counts as "local"Nothing on this listThe tier below explains why

What it costs: hardware, not a subscription

None of the models in this guide carry a subscription fee to run locally, which is the entire pitch. What they cost instead is the GPU or memory you already own, or don't, plus the time it takes to actually set one up correctly.

At 4-bit quantization, Qwen3.8-27B needs a 15.9GiB model file and peaks at roughly 20.3GiB of VRAM at a 64K-token context on a 24GB card, according to an August 2026 benchmark run by Kingy AI, leaving about 4.3GiB of headroom. Gemma 4 31B needs more: a 17.1GiB file that peaks near 22GB at the same context length, close enough to a 24GB card's ceiling that the same test hit an out-of-memory error with full-precision key-value cache and had to fall back to 8-bit caching to fit.

The bigger MoE models cost differently, when they can be run at all. GLM-5.3-Flash trades a large download and a large RAM bill for a small per-token compute cost, which is the whole idea behind "Flash" in its name; that trade only pays off once you already own the memory. DeepSeek-V4.1-Flash makes the same trade on paper but, as the next section covers, does not yet have a working local build to actually make it.

The cost that never makes it into a spec-sheet comparison is depreciation and power. A used 24GB card draws 250-350 watts under sustained inference load, which adds up over a year of daily coding sessions, and GPUs lose resale value the same way any other computer part does. None of that shows up in a "$0/month" headline, and it is the honest reason a cloud subscription can still be cheaper than "free" hardware you already paid for once.

The shortlist: nine models, three real tiers

ModelSize (total / active)LicenseBest forThe catch
Qwen3.8-27B27.8B denseUnconfirmed (likely Apache 2.0 or Tongyi Qianwen)24GB GPU, agentic codingLicense not officially stated at launch
Gemma 4 31B30.7B denseApache 2.0, confirmed24GB GPU, license certainty over speedSlower, weaker coding-agent completion in testing
Qwen3.6-27B27B-class denseSame family as 3.8Already running it; not a fresh pickBeaten on every axis by its own successor
Gemma 4 12B12B denseApache 2.08-12GB GPUs, laptopsNoticeably behind the 27-31B tier on hard tasks
Phi-4Small denseMicrosoft's own termsLow-VRAM machines, non-agentic completionNot built for long agentic tool-call chains
DeepSeek-V4.1-Flash552B / 8B activeMIT, confirmedNot locally runnable yet510GB checkpoint, no verified quantized build as of this guide
GLM-5.3-Flash320B / 18B activeMIT, confirmedSame tier as DeepSeek's Flash modelSame RAM floor problem
GLM-5.2744B / 40B activeMITThe base GLM-5.3 was tuned fromBigger than the Flash tier for no local benefit
Qwen3.8-2.4T-A95B2.4T / 95B activeUnconfirmedNobody reading this on a single machineNeeds a multi-GPU server, not a desktop

Each entry earns its row for a specific reason, not because it showed up in a search. The last two rows exist to rule themselves out: if a "local" list includes a 2.4-trillion-parameter model without saying it needs a server rack, that list was written from a spec sheet, not from a machine.

Any of the dense models in the top rows install through Ollama with one command once you know your pick:

ollama pull qwen3.8:27b
ollama run qwen3.8:27b "Write a Python function that merges two sorted lists"

Swap the tag for gemma4:31b, gemma4:12b or phi4 to try the others; Ollama downloads the quantized GGUF build on first run and caches it locally, so the second ollama run starts in seconds instead of minutes.

Qwen3.8-27B vs Gemma 4 31B: the head-to-head that actually tested pass rates

Kingy AI ran the two 24GB-tier contenders, plus predecessor Qwen3.6-27B, on the same RTX-class 24GB GPU on 16 August 2026, and published raw pass counts instead of a single composite score.

Kingy AI's article "Qwen3.8-27B vs Qwen3.6-27B vs Gemma 4 31B: Which Is Best for a 24GB GPU?" by Curtis Pyke, published 17 August 2026 The dated, bylined source behind the pass-rate and VRAM numbers in the head-to-head below, captured 16 Sep 2026.

  • Coding pass rate: Qwen3.8-27B 12/12 (one ordinary test failure, not a model error). Qwen3.6-27B 8/12. Gemma 4 31B-it 6/12.
  • Tool calling: Qwen3.8-27B and Gemma 4 both 90/90 on single structured calls. Qwen3.6-27B 79/90.
  • Reasoning (40 cases, 3 seeds each): Qwen3.8-27B 39/40 (117/120 runs). Gemma 4 31B 38/40 (104/120). Qwen3.6-27B 20/40.
  • Speed: Qwen3.8-27B 49.09 tok/s, 0.107s warm time to first token. Gemma 4 31B 45.00 tok/s, 0.421s warm, over four times slower to start.

The 12 coding tasks in that test were seeded runs against real repositories, checked with pass@1 and pass@3 scoring rather than a single attempt, which is closer to how an agentic coding session actually behaves: a model gets to retry, and what matters is whether it eventually lands a working answer. Qwen3.8-27B's single miss across both scoring methods was, per the published methodology, an ordinary test-suite failure rather than a case of the model misunderstanding the task, which is a meaningfully different failure mode than Gemma 4 31B's six misses.

The same test found Qwen's family handles aggressive quantization better than Gemma's: Qwen stays under a 0.04 KL-divergence score at 8-bit key-value cache, where Gemma's rises to 0.108. In plain terms, if you have to compress the model further to fit your card, Qwen degrades more gracefully.

The license question no benchmark answers

None of that makes Gemma 4 31B a bad model. It is the one with a confirmed Apache 2.0 license the day it shipped, on 2 April 2026, when Google's own announcement called it "the first in the Gemmaverse to be released under the OSI-approved Apache 2.0 license," moving off Gemma 3's custom terms.

Qwen3.8-27B's license was not confirmed at the time this guide was researched. Some outlets report Apache 2.0 by analogy with earlier Qwen releases, but Alibaba had not published a license file for this specific model, and the Tongyi Qianwen license used by some Qwen releases carries a 100-million-monthly-user threshold before it requires a separate agreement. If your deployment is a side project, that clause never applies to you. If it is a product with real usage, verify the license file yourself before you ship.

The "flash" MoE tier is not local for a normal desktop

DeepSeek-V4.1-Flash and GLM-5.3-Flash both use "Flash" in their names to describe how few parameters activate per token: 8 billion of 552 billion for DeepSeek, 18 billion of 320 billion for GLM. That efficiency is real for inference compute. It says nothing about how much memory you need to hold the rest of the model, because a mixture-of-experts model has to keep every expert loaded even though only a few fire on any given token.

DeepSeek-V4.1-Flash shipped its MIT-licensed weights on Hugging Face on 10 September 2026, according to coverage from DataNorth AI, trained on 45 trillion tokens with a one-million-token context window. The full checkpoint is 510.3GB across 48 weight files, mixing FP4 for routed experts with FP8 for dense weights, which Kingy AI's own hardware writeup on the model says makes "four-bit model" too blunt a description to plan around.

That same writeup, published the day after the model's release, could not find a verified, working local quantization for it at all. No confirmed GGUF, Ollama, LM Studio or MLX recipe existed yet at publication, and even a 24-32GB GPU or a 64-128GB unified-memory Mac cannot hold the official checkpoint.

Its own recommendation, as of that check, was to use the $0.15-per-million-token hosted API rather than attempt local deployment. That may change as the community publishes working quantizations, but as of this guide's research, "Flash" in the name describes the model's inference compute, not something you can download and run today.

GLM-5.3-Flash: the one that actually works

GLM-5.3-Flash is the more genuinely local option of the two. Z.ai released it on 26 August 2026 under the same MIT terms with a 1.3-million-token context window, according to TestingCatalog's launch coverage, and Unsloth's own local-hosting documentation for the model lists working quantizations: roughly 100GB for a one-bit build and around 128GB for a usable three-bit one.

The architecture is also different from a straight scale-down of GLM-5.2: Z.ai built GLM-5.3-Flash with hybrid sparse and linear attention, which its own documentation describes as roughly three times less attention compute and a 4.4-times smaller key-value cache than the non-Flash GLM-5.3. That is a real engineering reason the Flash variant has a working local recipe where DeepSeek's does not, not just a smaller total parameter count; GLM-5.3-Flash's 320B total is well under DeepSeek-V4.1-Flash's 552B to begin with.

Either way, this tier needs a Mac Studio or DGX Spark-class machine, not "a gaming PC with a good GPU." If your machine has 24GB of VRAM, neither model runs today, no matter how efficient their active-parameter count sounds on a spec sheet. A 128GB Mac Studio costs several times what a 24GB GPU does, so this tier is realistically for someone who already owns that machine for other reasons, not someone shopping for a coding setup from zero.

Unsloth's local-hosting documentation for GLM-5.3-Flash, showing quantization levels against the RAM they need to run The realistic RAM floor for the one MoE "Flash" model with a working local build, captured 16 Sep 2026.

Data handling: what actually stays on your machine

The entire pitch of running a model locally through Ollama or LM Studio is that your code never leaves your hardware. That claim only holds for the model's own inference. It does not cover the runtime you're using to serve it, your IDE's own telemetry, or a plugin that quietly proxies completions through a cloud endpoint by default.

Two things worth checking before you assume a setup is fully private: whether your coding agent or IDE integration ships with any default telemetry, and whether the license under which you're running the model restricts what you can do with outputs generated from proprietary code.

Apache 2.0 and MIT weights, which cover every model in the 24GB-and-under tier of this guide plus both DeepSeek-V4.1-Flash and GLM-5.3-Flash, impose no such restriction on outputs. The unresolved license on Qwen3.8-27B is the one open question in this guide's shortlist on that front, not because anyone expects Alibaba to restrict output ownership, but because "expects" is not the same as "confirmed."

A model file with no license clarity is still fully private in the narrow sense that matters here: nothing about running Qwen3.8-27B through Ollama sends your prompts anywhere, license status or not. The license question only bites if you redistribute the model, fine-tune and resell it, or build a product on top of it. A developer running it for personal use on their own repo is not in that category, which is exactly the distinction the next section works through.

Who should skip local models entirely

Local coding models are the wrong tool for a specific, common reader: someone who does not already own a 16GB-or-better GPU and is weighing a purchase against a cloud subscription. A used 3090 with 24GB of VRAM costs roughly as much as a year of most cloud coding-assistant seats, before electricity, before setup time, before the tuning this guide just walked through.

If your stack changes month to month rather than staying fixed on one editor, Smart Match matches your actual workflow against tools instead of asking you to guess from a features list.

If cloud is the answer, HokAI's coding-assistant guide covers the cloud options by job rather than by brand, and the Cursor Composer vs. Claude Code comparison covers the two names that come up most. Neither requires touching a GGUF file or a quantization chart.

Local also loses for a team, not just an individual, past a certain size: someone has to own GPU maintenance, driver updates and model upgrades as a real, recurring job. A five-person team paying for that person's time is often paying more than the cloud subscription it replaced.

There is also a model-refresh cost this guide's own research just demonstrated. Qwen3.8-27B did not exist when Qwen3.6-27B was the recommended pick a few months earlier, and it will not be the newest Qwen coding model a few months from now.

A cloud subscription upgrades itself the moment the vendor ships a better model. A local setup only gets better when someone downloads the new weights, checks the new VRAM math and re-tests the workflow against it. That upkeep is invisible in a one-time benchmark and real every time a new release lands.

The turn: when the "wrong" pick is actually right

The obvious objection to this guide's verdict is that Qwen3.8-27B's unconfirmed license should disqualify it outright, and Gemma 4 31B should be the default recommendation for anyone who can't personally read a license file.

That's a fair position for a company shipping a commercial product built on top of the model. It is the wrong call for the reader this guide is actually written for: a solo developer or small team running the model as a personal coding assistant, not redistributing it, not selling access to it.

For that reader, a license clause that only activates past 100 million monthly active users is not a live risk, and a 12-to-6 pass-rate gap on real coding tasks is a bigger practical difference than a licensing document neither of you has read in full. The trade only flips once you're building something you intend to ship.

What would flip this pick

A restrictive license file for Qwen3.8-27B specifically would make Gemma 4 31B the default for anyone without a lawyer on staff, full stop. Alibaba has not published one at the time of this guide, but nothing rules it out later.

A quantization scheme that made the Flash-tier MoE models usable under 64GB of combined memory, rather than the 100GB-plus floor measured here, would move them from "if you already own a Mac Studio" to a genuine option for a well-specced desktop. That would rewrite most of this guide's hardware tiers, and it is the fastest-moving variable in the whole piece: local quantization tooling improves month to month.

Until either happens, the split holds: Qwen3.8-27B for a 24GB GPU where speed and pass rate matter most, Gemma 4 31B where the license has to be settled today, and the Flash-tier MoE models only for hardware most readers don't own yet.

Frequently asked questions

What is the best AI model to run locally for coding in 2026?

For a single 24GB GPU, Qwen3.8-27B is the best-tested option: it scored 12 of 12 on real coding tasks in an August 2026 benchmark against Gemma 4 31B's 6 of 12 and Qwen3.6-27B's 8 of 12. Under 16GB VRAM, Gemma 4 12B or Phi-4 are the realistic picks instead.

How much VRAM do I need to run a coding model locally?

A 27-31B dense model like Qwen3.8-27B or Gemma 4 31B needs roughly 16-22GB of VRAM at 4-bit quantization, which fits a 24GB card with some headroom. Below 16GB, drop to a 12B-class model such as Gemma 4 12B or Phi-4.

Can I run DeepSeek-V4.1-Flash or GLM-5.3-Flash on a normal gaming PC?

GLM-5.3-Flash has a working local build that needs roughly 100-128GB of unified memory, which rules out a normal GPU either way. DeepSeek-V4.1-Flash goes further: as of this guide's research no verified local quantization existed at all, and even a 64-128GB Mac cannot hold its 510GB checkpoint.

Is Qwen3.8-27B free to use commercially?

Its license was not officially confirmed at the time of this guide's research; Alibaba had not published a license file for this specific model. Gemma 4 31B carries a confirmed Apache 2.0 license as of its April 2026 release, which is the safer choice if commercial certainty matters more than a few points of pass rate.

Does running a model locally guarantee my code stays private?

The model's own inference never sends data anywhere, but the guarantee stops there. Check your IDE integration and coding agent for default telemetry or cloud proxying, since those run separately from the model itself.

Covered in this guide

  • Qwen3.8-27B: A dense 27B vision-language model from Alibaba's Qwen team, open-weight since 2026 with native text, image, and video understanding.
  • Gemma 4 31B: Gemma 4 31B, released April 2, 2026 by Google DeepMind, is a 31B open-weight multimodal model with a 262,144-token context window.
  • DeepSeek-V4.1-Flash: DeepSeek-V4.1-Flash is a 552B-parameter, MIT-licensed multimodal model with native vision, released in September 2026.
  • Gemma 4 12B: Gemma 4 12B is Google's June 2026 open-weight multimodal model with a 256K context window and native audio/video input on 8GB of VRAM.
  • GLM-5.2: GLM-5.2 is Z.ai's June 2026 open-source 744B MoE model with a 1M-token context window, 80.3% GPQA Diamond, and MIT license at $1.40/1M input tokens.
  • GLM-5.3-Flash: Open-weight, natively multimodal MoE model from Z.ai with a 1M-token context window and MIT license, released August 26, 2026.
  • Phi-4: Phi-4 is Microsoft's 14B open-source instruct model, MIT licensed, scoring 84.8% on MMLU. It runs locally on a single consumer GPU or via Azure AI Foundry's pay-per-token API.
  • Qwen3.8-2.4T-A95B: Alibaba's 2.4T-parameter MoE model (95B active), open-weighted August 2026 with a ~1M-token context and a 92.6 GPQA Diamond score.
  • Z.ai: Z.ai (formerly Zhipu AI) was founded in 2019 from Tsinghua University, IPO'd on Hong Kong Stock Exchange in January 2026 at a $6.55B valuation, and ships the 744B MoE GLM series under MIT license.

Sources

Still deciding?

This guide covers a handful of options. Smart Match checks every listing in the directory against how you actually work and what you can spend, then hands you the shortlist and the reason behind each pick.

Start Smart Match

Related guides

All AI guidesBrowse the AI directory