AI & prompting

Best LLM for Coding: How to Choose One for Your Work

There is no single best LLM for coding: the right one depends on the task, your budget and where your code is allowed to go. Shortlist two or three models from public benchmarks such as SWE-bench and the Aider leaderboard, then run each on five real tasks from your own repository and keep the one that passes the most checks.

This article deliberately names no "winner". Model rankings are reshuffled by every release, so any list of names would be out of date within weeks. The method below keeps working when the names change.

What "best" means for coding

Five properties decide whether a model is good for you. Rank them before you look at any leaderboard:

  • Correctness on your kind of task. Fixing a bug in a 200-line script and changing six files in a large codebase are different skills.
  • Speed. Inline completion needs an answer in well under a second. A background agent can take minutes.
  • Cost. Models are billed per token, and prices differ widely between a small and a large model. See how LLM API pricing works for how to estimate a bill.
  • Context size. Large codebases and long logs need room. The context window limits how much code the model can see at once.
  • Privacy and hosting. Some code cannot be sent to a third party at all. That rules out hosted models and leaves local ones.

GitHub's model guide frames the same trade-offs: "Some models offer lower latency, while others offer fewer hallucinations or better performance on specific tasks." It groups work into general-purpose coding, fast help with simple or repetitive tasks, deep reasoning and debugging (multi-file debugging, large refactors, architecture planning), and work with visuals such as screenshots. If you are unsure, it suggests starting with a general-purpose model and adjusting.

Match the model type to the job

JobWhat to preferWhy
Autocomplete while typingSmall, fast modelLatency matters more than depth, and the task is local to one file.
Quick questions, regexes, utility functionsFast general-purpose modelCheap per request, and you can check the answer in seconds.
Multi-file bug or refactorLarger reasoning modelNeeds step-by-step reasoning and a lot of context.
UI work from a screenshotA model that accepts image inputNot every model does.
Private or regulated codeLocal open-weight modelNothing leaves your machine. See how to run an LLM locally with Ollama.

Most people end up using two models: a fast cheap one by default and a stronger one for the hard cases.

How to read coding benchmarks

Two public benchmarks come up most often. Know what each one measures before you quote a score.

SWE-bench

SWE-bench uses real GitHub issues. Its documentation describes the task as: "Given a codebase and an issue, a language model is tasked with generating a patch that resolves the described problem." It ships several datasets, including SWE-bench, SWE-bench Lite, SWE-bench Verified and SWE-bench Multimodal. The Verified release has 500 problems that engineers confirmed are solvable. When you see a SWE-bench number, check which dataset it is from: scores on different datasets are not comparable. Also note that a score usually describes a model plus the agent scaffolding around it, not the model alone.

Aider polyglot

The Aider leaderboard tests "an LLM's ability to follow instructions and edit code successfully without human intervention". Its polyglot benchmark uses 225 Exercism exercises in six languages: C++, Go, Java, JavaScript, Python and Rust. That makes it a good test of editing small, well-specified programs, and a poor test of navigating a large unfamiliar repository.

Aider's own page carries caveats worth copying into your head. Entries differ in date, Aider version, edit format and reasoning settings, so they are not all run under identical conditions. The leaderboard page also showed a "last updated" date of November 20, 2025 when this article was checked, so a score there may predate newer models.

What benchmarks cannot tell you

  • How the model behaves with your language, framework versions and internal libraries.
  • How it responds to your prompts and your instructions file.
  • Whether the speed and cost suit your daily use. Most leaderboards report accuracy first.

Treat a benchmark as a way to cut a long list down to two or three candidates. Then test those yourself.

Run your own five-task test

This takes an hour and is more informative than any leaderboard.

  1. Collect five tasks from your own work. Pick real ones you have already solved: a bug you fixed, a test you wrote, a small feature, a refactor, and a confusing piece of code you had to understand. Keep the original commit so you know a correct answer exists.
  2. Give each task a check that returns pass or fail. A failing test, a build command or a linter is ideal. Without a check you are judging by feel.
  3. Use the same prompt for every model. Include the files, the exact error text and your constraints. Change only the model.
  4. Run each task once, then once more. Models are not deterministic, so a single pass can mislead. If results differ between runs, note it.
  5. Record four things per run: did the check pass, how many edits did you have to make by hand, how long did it take, and what did it cost in tokens.
  6. Review the diff, not the summary. Look for deleted tests, suppressed errors and unrequested changes. The checklist is in how to review AI-generated code.

A simple scoring sheet is enough:

task            model-A   model-B   model-C
bug-fix         pass      pass      fail
add-test        pass      fail      pass
refactor        fail      pass      fail
explain-code    pass      pass      pass
small-feature   pass      fail      fail

That table is an illustration of the format, not real results. If two models tie on passes, choose the cheaper or faster one. For ideas on scoring the quality of free-form answers, see how to evaluate LLM output.

Common mistakes when choosing

  • Choosing by a single headline score. One number hides the dataset, the settings and the scaffolding.
  • Always using the largest model. Deeper models cost more and respond more slowly. GitHub's guide notes that models consume credits at different rates based on their token pricing, so a heavy model on trivial edits burns budget for no gain.
  • Comparing tools instead of models. An editor plugin, a chat window and a command-line agent differ in what context they send. The same model can look better or worse depending on the tool around it. Compare one variable at a time.
  • Never re-testing. Vendors release new versions often. Re-run your five tasks when a new model appears, and keep the task list so the comparison costs you minutes.
  • Skipping the data terms. Before pasting company code into any hosted model, read the provider's terms on retention and training, and your employer's policy.

If every model fails your tasks

If all candidates fail the same task, the model is probably not the problem. Check that the prompt names the files, includes the exact error and states constraints. Check that the task fits in the context window with room to spare. Split a large task into steps that each have their own check. The workflow in how to use AI for coding covers these fixes, and it usually improves results more than switching models does.

Frequently asked questions

Is there one best LLM for coding?
No. The best model depends on the task (quick edits versus multi-file debugging), your budget, your latency tolerance and whether your code can leave your machine. Rankings also change every few weeks, so test two or three candidates on your own code instead of trusting one leaderboard.
Can I trust coding benchmark scores?
Use them to shortlist, not to decide. A benchmark measures a fixed set of tasks under specific settings. Entries on the Aider leaderboard, for example, differ in date, tool version, edit format and reasoning settings, so they are not all run under identical conditions. Your codebase and prompts differ from any benchmark.
Do I need the biggest model for everyday coding?
Usually not. GitHub's model guide separates fast models for simple, repetitive tasks from deeper reasoning models for multi-file debugging and large refactors. Start with a general-purpose model and move up only when it fails a task you can check.
Can a local open-weight model replace a hosted one for coding?
For autocomplete, explanations and small scripts it often can, and your code stays on your machine. For large multi-file changes, hosted models are generally stronger, but check this against your own tasks since the gap varies by model and hardware.

Sources