Can a local model autocomplete my code?
Autocomplete is the easiest coding job to move local. It needs a small model, a fast response and nothing else. A 1.5B to 7B coder model on a laptop does it well.
Small and fast
The target is under 500 ms from keystroke to grey text. Slower than that and you have typed past the suggestion before it lands.
That budget rules out big models, because each suggestion means reading the code around your cursor, then writing a line or two. A small model does both in a fraction of a second. A 30B model gives smarter guesses that arrive too late to use.
For autocomplete, pick the smallest coder model whose suggestions you accept more often than you delete. Speed beats cleverness here.
The model also has to be trained for fill-in-the-middle. Ordinary chat models only continue text, while a fill-in-the-middle model sees the code before and after your cursor and writes what goes between. Model cards say whether a model supports it, and it is usually the base model, not the instruct one.
Most of the wait is reading, not writing. The editor sends a few thousand tokensTokenA chunk of text, usually part of a word. Models read and write in tokens.Read more of surrounding code with every request. On a machine with slow prefill, such as a CPU-only laptop, that alone can blow the budget, so cut the context the extension sends before you shrink the model.
Editor extensions with a local endpoint
These extensions accept a local server for completions. All of them are free.
| Extension | Editors | Talks to |
|---|---|---|
| Continue | VS Code, JetBrains | Ollama, LM Studio, llama.cpp and any server from How do I call a local model from code? |
| llama.vscode and llama.vim | VS Code, Vim and Neovim | llama-server directly, built by the What is llama.cpp? team |
| Tabby | VS Code, JetBrains, Vim | Its own self-hosted server, which runs the model |
Continue is the most common choice. It also does chat and edits, and you assign a model to each job separately. Here is a minimal config for autocomplete through Ollama.
# ~/.continue/config.yaml
name: Local
version: 0.0.1
schema: v1
models:
- name: Local autocomplete
provider: ollama
model: qwen2.5-coder:1.5b-base
roles:
- autocompleteprovider: ollama sends requests to Ollama on its default port. roles: [autocomplete] tells Continue to use this model only for inline suggestions, so you can add a bigger model for chat beside it.
llama.vscode is the lightest option if you already use llama.cpp. Start the server with a built-in completion preset, then install the extension and it finds the server on its own.
llama-server --fim-qwen-1.5b-defaultThe preset downloads a small fill-in-the-middle model and starts the server with settings tuned for completion. Swap 1.5b for 7b if you have the memory.
Open a file, type a function signature and a one-line comment saying what it does, then pause. If grey text appears before you reach for the next key, your setup is fast enough.
Model picks by memory
Autocomplete shares the machine with your editor, browser and maybe a second model for chat. Size it to leave room.
| Memory | Autocomplete model | Room left for |
|---|---|---|
| 8 GB | About 1.5B at 4-bit, about 1 GB | Your editor and little else |
| 16 GB | 1.5B to 3B, 1 to 2 GB | A small chat model beside it |
| 24 GB and up | Up to 7B, about 5 GB | A mid-class model for chat or agents, see Which size of model do I need? |
A well-known family for this is the Qwen2.5-Coder base models at 1.5B, 3B or 7B. Any coder model that lists fill-in-the-middle support on its model card works the same way. Which model should I use for my task? covers how to compare them.
A 7B completion model plus a 27B agent model is about 21 GB of weightsWeightsThe full set of a model's parameters, stored in a file.Read more before any context. On a 24 GB machine that is too tight. Run one or the other, or drop autocomplete to 1.5B.
Go deeperThat's enough
How fill-in-the-middle prompts look
The extension builds a prompt from three parts: a prefix (code above the cursor), a suffix (code below it) and special tokens that mark each. The model was trained on that layout, so it writes only the missing middle and stops. Each model family uses its own marker tokens, which is why extensions ask which model you run, and the wrong template gives you chatty prose in your code.
Why the base model
Instruct models are tuned to answer questions in full sentences. That training fights fill-in-the-middle, where you want three tokens of code and silence. Base models, or coder models trained with FIM from the start, stay terse.
Keeping the model loaded
RuntimesRuntimeThe software that loads a model file and runs it.Read more unload idle models to free memory. The first suggestion after an unload waits several seconds while the model loads again. In Ollama, set a long keep-alive for the completion model so it stays resident. How do I use Ollama? shows where, and How do I make it faster? covers the rest of the latency knobs.