Best Open Source Models for Coding in 2026: Pick by Your RAM
Five open-weight coding models now compete for your laptop or API budget. This guide helps you pick by your hardware — Qwen4 for 24GB machines, Amazon Ergo through an API, and older models for bigger workstations.
Say you open a laptop with 16GB of RAM. You read that the newest open coding model, Amazon Ergo, has 1.1 trillion parameters, and you wonder if you can run it. You can't. Which of the new December 2026 coding models you can run starts with a number you already know: how much memory your machine has, and you can read it off your system in under a minute.
For most students, Qwen4-35B-A3B is the best open model to run locally, and Amazon Ergo is the one to use through an API. Qwen4 runs on a 24GB machine at 4-bit, according to Unsloth. Sources disagree on Qwen4's size, so check the file size on Unsloth before downloading. Ergo is far too large for a laptop, but Bedrock charges $1 per million input tokens and $3 per million output tokens. Pick by your RAM and budget, not by the leaderboard.
Check your RAM before you read any benchmark
A model's file size decides whether you can run it, and a planning rule from VDF's guide to local coding models says 4-bit memory is roughly total parameters times 0.55 bytes. "4-bit" means each weight is stored in 4 bits instead of 16. The file gets much smaller, and the quality drops a little.
Most new coding models are "mixture of experts" (MoE) models. The model is split into many small expert networks, and only a few of them work on each token, a token being a short piece of a word. "Active parameters" counts the experts that work on one token. "Total parameters" counts all of them.
Active parameters set the speed. Total parameters set the memory, because every expert must sit in memory even while it waits. A model with few active parameters can feel fast and still not fit on your machine.
Here is the rule at work on Qwen4. It has 35B total parameters, and 35B x 0.55 bytes is about 19GB, before you add room for your operating system and your editor. Run Ergo's 1.1T total through the same rule and the answer is about 605GB, as the table below shows. That is why a 16GB laptop struggles with the first and cannot touch the second.
That extra room matters most if you are looking for the best open source models for agents. Agent tools, like an assistant that reads your whole project and runs commands, send the model long inputs. Long inputs need working memory beyond the file itself, so a model that barely fits for chat can crash during agent work. If "open-weight" is a new term, read open-weight vs closed AI models first, then come back. In short, you can download the weights and run them yourself.
Open-weight coding models at a glance
Five models cover the realistic choices this month: the new Qwen4-35B-A3B, Amazon Ergo and MiniMax M4, plus the smaller, older Devstral Small 2 and Qwen3-Coder-Next, with figures from OpenRouter's model list and each model's own page. If you searched for the best open source models for coding or for code generation, these are the names you will keep seeing.
| Model | Total / active params | License | Context | Released | Memory at 4-bit | DeepSWE score (source differs) |
|---|---|---|---|---|---|---|
| Qwen4-35B-A3B | 35B / 3B (OpenRouter) | Apache-2.0 | 1M tokens | Dec 4, 2026 | 24GB (Unsloth) | 61.8 on v1.1 (OpenRouter) |
| Amazon Ergo | 1.1T / 55B (Amazon) | Amazon Ergo Open-Weights License | 1M tokens | Dec 1, 2026 | About 605GB by the 0.55 rule (VDF) | 74.2 (Amazon) |
| MiniMax M4 | 2.74T / 66B (OpenRouter) | Open-weight | 1M tokens | Not listed | About 1.5TB by the 0.55 rule | Not listed |
| Devstral Small 2 | 24B dense (VDF) | Apache-2.0 | Not listed | Earlier | Fits an RTX 4090 or a 32GB Mac | Not listed |
| Qwen3-Coder-Next | 80B / 3B (VDF) | Apache-2.0 | Not listed | Earlier | About 44GB | Not listed |
The Qwen4 parameter counts do not agree across pages. OpenRouter and Unsloth list 35B total and 3B active, and the table follows them. The Hugging Face model card lists about 3.8B active, 20.5B parameters it labels PLE (per-layer embeddings) and about 56B total. PLE means per-layer embeddings, which are large lookup tables stored beside the main layers, and the card counts them separately from the 3.8B active parameters. I could not confirm from the page how that adds up to 56B, so treat the 35B and 56B figures as unresolved.
By the 0.55 rule, 35B gives about 19GB and 56B gives about 31GB, and 31GB would not fit a 24GB machine. The 24GB advice comes from Unsloth's measured file sizes, not from the rule, so check Unsloth's file list for your 4-bit size before you download.
Note: the two DeepSWE scores come from different sources, and Qwen4's is on v1.1 while Amazon does not name a version for Ergo's. Do not compare them directly. The benchmark section below shows how test names and versions change what a score means.
Pick a model by hardware: the decision tree
Start with how much memory your machine has, then follow the branch to a model you can actually run, or to an API if nothing fits. Unsloth's Qwen4 guide gives its sizes for either a Mac or a GPU. On a Mac, count the unified memory. On a Windows or Linux PC with a graphics card, count the card's video memory (VRAM), because that is where the model runs fast.
Find your memory
Use the list titled How to find your memory, just under these steps. Write the number down.
16GB: go to an API
Qwen4 at 3-bit needs about 18GB (Unsloth), so it will not fit with your editor open. Under 24GB, I could not verify a good local coding model from the sources here, so use an API such as Qwen4 on OpenRouter.
24GB: run Qwen4-35B-A3B
Use the 4-bit file from Unsloth.
32GB or more: try the older mid-size models
Devstral Small 2 fits, and Qwen3-Coder-Next fits once you reach its 44GB mark (VDF).
API budget only: use OpenRouter
How to find your memory:
- Windows: open Task Manager, go to the Performance tab, and check Memory. Your graphics card's VRAM is under GPU.
- macOS: open the Apple menu and choose About This Mac.
- Linux: run
free -hin a terminal. On an NVIDIA card,nvidia-smishows VRAM.
Qwen4-35B-A3B is the best laptop pick
Qwen4-35B-A3B activates only about 3B parameters per token, so it runs at laptop speed while still scoring 61.8 on DeepSWE v1.1 (OpenRouter). Its Apache-2.0 license, listed on the Hugging Face model card, lets you use it in a college project or a paid product. You only need to keep the license notice.
The 1M-token context window means the model can read a large codebase in one request. On a laptop, your memory decides how much of that window you can use, not the model.
Setup is easy because the Qwen 4 launch post on Hugging Face lists day-0 support in Ollama, llama.cpp, vLLM, SGLang and MLX. For a student, Ollama is the shortest path: install it, pull the model and chat in the terminal. MLX is the Apple-silicon option. vLLM and SGLang suit a server with a GPU.
Copy the exact commands from Unsloth's guide, since model tags change after launch. If you use llama.cpp directly, update it from the llama.cpp releases page. A new model often needs a fresh build. I have not timed this model on my own machine, so there is no speed figure here, and Unsloth's page is the place to see the current run commands. I covered the launch itself in Qwen4-35B-A3B, the first open Qwen4, if you want the background.
Pros
- Fits a common high-end laptop or a single consumer GPU.
- Apache-2.0, so no license surprises later.
- Works offline, so your code never leaves your machine.
- Every major local runtime supported it on launch day.
Cons
- Not comfortable on a 16GB machine.
- Needs 24GB of memory to run at 4-bit.
- Pages disagree on its parameter counts.
- Long agent sessions need memory beyond the file size.
Amazon Ergo is worth paying for, not running
Ergo has 1.1T total parameters with 55B active, which rules out laptops but makes it a strong low-cost API choice for hard coding tasks, according to Amazon's launch page. It ships under the Amazon Ergo Open-Weights License, a custom license. That is not Apache-2.0, so read its terms before you put Ergo in a paid product.
On the same page, Amazon reports that Ergo placed second on DeepSWE and second on AutomationBench-AA with 70.0. Amazon also cites 65.4 on FMR-Bench AI SWE, but that is Amazon's own internal test, so nobody outside Amazon can rerun it. Amazon further claims Ergo is about 50% faster and 10% cheaper than Kimi K3.1 Pro. That is Amazon's comparison, not an independent one.
Here is what the price means for a student project. Say your coding assistant sends about a million tokens of code and questions in a month and gets back about a million tokens of answers. At Bedrock's listed price, that is $1 for input plus $3 for output, so $4 for the month. Output costs three times as much as input, so asking for short diffs instead of whole files saves the most.
Agents send your files again on every step, so real usage grows faster than chat. Check your bill after the first day of agent work. You can also reach Ergo through OpenRouter if you do not want an AWS account. My launch post on Amazon Ergo's open weights has the full release details in one place.
MiniMax M4 and the older models: when they make sense
MiniMax M4 is open-weight but its 2.74T total size puts it out of reach for laptops, so older mid-size models still win for local use (OpenRouter). M4 reasons on every request, which makes it strong at agent tasks that need a plan across several steps. The cost is slower, longer replies, and you pay for every output token. For students, it is an API model. More on it in MiniMax M4's open weights, if you want the details.
For local agent work, the two older models from VDF's comparison still earn a place. Devstral Small 2 is dense, meaning every parameter works on every token. Qwen3-Coder-Next is an MoE model, so it needs more memory but answers faster.
- MiniMax M4: best of the three for long, multi-step agent tasks. Reasoning on every request makes simple questions cost more than they should.
- Devstral Small 2: the easiest to fit on a workstation, with an Apache-2.0 license. Being dense, it is slower per token than an MoE model of similar size.
- Qwen3-Coder-Next: fast, because few parameters are active. Few students own a machine with enough memory for it.
If you came here for the best open source models for agents, the student answer is split. Use M4 through an API for hard agent tasks, and run Devstral Small 2 or Qwen3-Coder-Next locally only if your machine has the memory.
Read coding benchmarks without being fooled
A benchmark score only helps you if you know what the test measures and who ran it. SWE-bench is the standard test for agentic coding: the model gets a real GitHub issue from a real project and must write a patch that makes the project's tests pass.
Vendor-run scores come from the company selling the model. That company picks the settings, the prompt and sometimes the set of tasks. An independent leaderboard runs every model the same way. The scores quoted across this article come from vendor pages and OpenRouter, not from one shared run, so open the SWE-bench leaderboard and see where each model lands there.
Different tests are not interchangeable either. Amazon lists Ergo at 21.3 on Terminal-Bench Science 0.1, and OpenRouter lists Qwen4 at 21.2 on Terminal-Bench 4.1. The numbers look equal. The names show two different tests, so the pair tells you nothing.
Headlines add one more layer. One report says Ergo "beats GPT-5.5 by 18% in coding". Before you repeat a claim like that, ask four questions:
- What task does the test use: real GitHub issues, terminal commands or something else?
- Who ran it: the vendor or an independent group?
- Which version of the test is it?
- Can anyone outside the company rerun it?
Which open coding model should you pick?
Use Qwen4-35B-A3B if you have 24GB, Ergo through an API if you need top quality, and stay on a smaller model if you have 16GB, with Qwen4 on OpenRouter as the fallback when nothing local fits.
- You have a 24GB Mac or GPU: run Qwen4 locally for daily practice.
- You have a 16GB laptop: call Qwen4 or Ergo through OpenRouter and skip the hardware upgrade.
- You are building an agent project for your portfolio: use Ergo or MiniMax M4 through an API.
- You have a 32GB-plus workstation: test Devstral Small 2 and Qwen3-Coder-Next side by side on your own code.
- You are shipping a paid product: prefer an Apache-2.0 model, or read Ergo's license first.
Say you are a second-year student in Pune or in Ohio with a mid-range sixteen-gigabyte laptop and a small monthly API budget. Keep the laptop for your editor and tests, and send everyday questions to Qwen4 through OpenRouter. Save Ergo for the hard bugs, like a failing test you cannot trace. Before you commit anything a model wrote, run it through this checklist for reviewing AI-generated code every time.
Look up how much memory your machine has today, then follow the decision tree above. If you have 24GB, install Qwen4-35B-A3B through Ollama. If not, open OpenRouter, give Ergo and Qwen4 the same small test project, and compare the two answers yourself.