Aider with Local Models: Setup and the Models That Actually Work

Written by Jakub Rusinowski · Last updated 2026-07-12 · Hardware figures computed by our VRAM engine

Point Aider at Ollama with `aider --model ollama_chat/qwen3.6:27b` and it runs fully local — no API key, no code leaving your machine, every change a revertible git commit. The catch: Aider depends on models following strict edit formats, so it rewards the 22B+ class (Qwen 3.6 27B, Devstral-2 22B); below that, expect malformed edits often enough to annoy.

Aider is the terminal pair programmer: it maps your repo, takes instructions in plain English, and applies the model's edits as clean git commits. That git-native loop is *more* valuable with local models than with frontier ones — when a smaller model occasionally fumbles an edit, git revert makes the mistake free.

The flip side: Aider communicates edits through structured formats (diffs or search/replace blocks), and producing them *exactly* is a capability test many small models fail. This page is the local-specific setup plus the honest model list. For what Aider is versus Continue/Cline/Tabby, see the tool matrix.

1. Install Aider and confirm Ollama is serving

python -m pip install aider-install && aider-install
curl http://localhost:11434   # → "Ollama is running"

Aider is a Python CLI; Ollama setup is covered in our install guide if you're starting from zero.

2. Pull a model that can follow edit formats

The tier list, from our testing and the compute engine's fit math:

# 24 GB card — the reliable tier
ollama pull qwen3.6:27b
# 16 GB card — the floor for dependable edits
ollama pull devstral:22b
# 8 GB card — works, expect retries on complex edits
ollama pull qwen3-coder:8b

Full per-tier reasoning in the model guide.

3. Launch Aider against the local endpoint

export OLLAMA_API_BASE=http://localhost:11434
aider --model ollama_chat/qwen3.6:27b

The ollama_chat/ prefix matters — it uses Ollama's chat template handling. Persist the choice in .aider.conf.yml at your repo root so plain aider picks it up:

model: ollama_chat/qwen3.6:27b

4. Raise the context window — Aider needs it

Aider's repo map plus file contents blow through Ollama's default context fast, and a truncated context is the #1 cause of "the model ignored half my files". Set the context explicitly:

# .aider.conf.yml
model-settings:
  - name: ollama_chat/qwen3.6:27b
    extra_params:
      num_ctx: 16384

Remember the VRAM cost: KV cache grows with context — the checker shows exactly how much headroom your card has at 16K vs 32K.

5. Work in small, test-anchored asks

Local Aider rewards discipline: one focused change per message ("add retry logic to fetch_data and update its test"), let it commit, review the diff, continue. Use /undo (or plain git) when an edit misses. With a test suite present, aider --auto-test closes the loop — the model sees failures and iterates, which flatters local models by giving them concrete feedback instead of open-ended instructions.

Frequently asked questions

Which local model works best with Aider?
Qwen 3.6 27B on a 24 GB card is the sweet spot — it follows Aider’s edit formats reliably and holds enough context for the repo map. Devstral-2 22B is the best 16 GB option (agent-tuned, which helps). Below 16 GB, Qwen3-Coder 8B works for small, single-file asks with occasional malformed-edit retries.
Why does Aider say the model produced a malformed edit?
Aider requires edits in exact diff or search/replace formats, and smaller models drift out of them — especially with long contexts or vague instructions. Fixes in order: smaller, more specific asks; raise num_ctx so nothing truncates; try the weaker "whole file" edit format (aider --edit-format whole); or step up a model tier.
Does Aider work offline?
Fully, once models are pulled: Aider talks only to your Ollama endpoint, and git operations are local. It is one of the cleanest fully-offline agent setups available — nothing to configure away, no telemetry accounts required.
Aider or Cline for local agent work?
Same model requirements, different ergonomics: Aider is terminal + git commits, best for developers who want every change revertible and scriptable. Cline is VS Code + approval checkpoints + MCP tools, best for supervised in-editor sessions. Try Aider first if you live in the shell; both run happily against the same Ollama server.

Keep going