AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Configuring Continue with Ollama for Offline Code Completion in VS Code

Solène Génard · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Cloud-based code assistants are convenient until you board a flight, enter an air-gapped facility, or review proprietary code that legal prohibits from leaving your workstation. For months, offline AI coding felt like an exercise in frustration: ghost text lagged three seconds behind keystrokes, and fans spun at maximum speed just to suggest a closing bracket.

At 365Finds, we evaluate developer tooling through a practical lens: privacy without responsive speed is unusable shelfware. Pairing Continue with Ollama inside VS Code changes that balance. When configured with disciplined model selection and runtime tuning, you can achieve sub-200ms local tab completions with zero telemetry leaving your machine.

Here is 365Finds' definitive setup guide, configuration schema, and latency optimization playbook.


1. The Core Architecture: Why Autocomplete Differs from Chat

Most engineers who complain that local code completion is "too slow" make a fundamental mistake: they assign the same 7B or 14B instruction model they use for sidebar chat to inline tab completion.

Chat and autocomplete solve opposite problems:

For offline completion, lightweight FIM models running entirely in your GPU VRAM are non-negotiable.

365Finds Recommended Models

ModelSizeVRAM FootprintBest Use Case365Finds Take
qwen2.5-coder:1.5b1.5B~1.6 GBPrimary Tab AutocompleteTop Pick. Unbeatable speed, razor-sharp FIM syntax prediction, runs on almost any modern laptop.
qwen2.5-coder:7b7B~5.2 GBChat & Structural RefactoringExcellent companion for the Continue sidebar panel.
starcoder2:3b3B~2.8 GBAlternative AutocompleteSolid fallback if your stack relies heavily on older esoteric frameworks.
deepseek-coder:1.3b1.3B~1.4 GBUltra-low VRAM AutocompleteCapable, though Qwen2.5-Coder 1.5B edges it out on multi-line indentation consistency.

2. Step 1: Prepare Ollama

Ensure Ollama is installed and operational. Open your terminal and pull both your lightweight autocomplete model and your chat model:

# Pull the dedicated autocomplete model (FIM-optimized)
ollama pull qwen2.5-coder:1.5b

# Pull the dedicated sidebar chat model
ollama pull qwen2.5-coder:7b

Verify that Ollama's local API responds:

curl http://localhost:11434/api/tags

3. Step 2: Configure Continue in VS Code

Install the official Continue extension from the VS Code Marketplace.

Open the Continue configuration file. You can do this by clicking the gear icon at the bottom of the Continue sidebar or pressing Ctrl+Shift+P (macOS: Cmd+Shift+P) and selecting Continue: Open Config File.

Continue has transitioned its primary configuration standard to config.yaml, while retaining compatibility with legacy config.json. We provide both.

Option A: Modern Configuration (~/.continue/config.yaml)

This is the standard 365Finds recommends. Assign the autocomplete role explicitly to the 1.5B model, while keeping the 7B model for conversational coding:

name: 365Finds Local Ollama Setup
version: 0.0.1
schema: v1

models:
  # Sidebar Chat & Refactoring
  - name: Qwen2.5-Coder 7B
    provider: ollama
    model: qwen2.5-coder:7b
    apiBase: http://localhost:11434
    roles:
      - chat
      - edit
      - apply

  # Inline Tab Autocomplete
  - name: Qwen2.5-Coder 1.5B (Autocomplete)
    provider: ollama
    model: qwen2.5-coder:1.5b
    apiBase: http://localhost:11434
    roles:
      - autocomplete
    autocompleteOptions:
      debounceDelay: 250
      maxPromptTokens: 1024
      onlyMyCode: true

Option B: Legacy Configuration (~/.continue/config.json)

If your workspace still relies on the older JSON structure, declare the model using the tabAutocompleteModel property:

{
  "models": [
    {
      "title": "Qwen2.5-Coder 7B (Chat)",
      "provider": "ollama",
      "model": "qwen2.5-coder:7b",
      "apiBase": "http://localhost:11434"
    }
  ],
  "tabAutocompleteModel": {
    "title": "Qwen2.5-Coder 1.5B (Autocomplete)",
    "provider": "ollama",
    "model": "qwen2.5-coder:1.5b",
    "apiBase": "http://localhost:11434"
  },
  "tabAutocompleteOptions": {
    "debounceDelay": 250,
    "maxPromptTokens": 1024
  }
}

4. Step 3: Enable and Verify Tab Autocomplete

  1. Check the VS Code status bar in the bottom right corner. Click the Continue status indicator.
  2. Ensure Enable Tab Autocomplete is checked.
  3. Open any code file (e.g., TypeScript, Python, or Go) and start writing a function signature.
  4. Ghost text will appear. Press Tab to accept the entire block, Esc to dismiss, or Ctrl + → (Cmd + → on macOS) to accept word by word.

5. Eliminating Latency: The 365Finds Optimization Playbook

Getting ghost text to appear is trivial. Getting it to feel seamless requires tuning four critical bottlenecks.

1. Fix Cold-Start Thrashing (keep_alive)

By default, Ollama unloads idle models from VRAM after 5 minutes. If you spend 6 minutes reading documentation and return to code, your next keystroke triggers a 10-second disk-to-VRAM reload.

Prevent Ollama from unloading your completion model by setting keep_alive indefinitely:

# Start Ollama with persistent model caching
OLLAMA_KEEP_ALIVE=-1 ollama serve

Alternatively, add keep_alive: -1 under requestOptions in your Continue model block:

    requestOptions:
      options:
        keep_alive: -1

2. Prevent Model Swapping (OLLAMA_MAX_LOADED_MODELS)

If you ask the Continue sidebar a question using qwen2.5-coder:7b, Ollama may evict qwen2.5-coder:1.5b from your GPU to free up memory. The moment you resume typing, Ollama ejects the 7B model to reload the 1.5B model. This back-and-forth thrashing kills editor responsiveness.

Ensure your machine allows concurrent models in memory. On an 8GB or 16GB GPU, both models comfortably coexist if you launch Ollama with:

export OLLAMA_MAX_LOADED_MODELS=2

3. Restrain Prompt Evaluation Context (maxPromptTokens)

Autocomplete does not need 32,000 tokens of project history. Processing excessive context kills Time-To-First-Token. Restrict maxPromptTokens to 1024 or 1536 tokens. Continue will assemble the immediate lines above and below the cursor, ensuring instantaneous evaluation.

4. Dial in debounceDelay

If debounceDelay is too low (e.g., 50ms), Continue sends an inference request on every letter you type, flooding Ollama's queue. If it is too high (e.g., 600ms), you finish typing before suggestions appear. At 365Finds, our testing shows 250ms to 300ms is the optimal sweet spot for fast typists.


6. The 365Finds Verdict

Can a fully offline setup replace GitHub Copilot?

Our verdict is nuanced: for massive whole-repository architectural synthesis, frontier cloud models still hold the edge. But for daily mechanical coding—boilerplate generation, regex composition, standard library calls, and syntax completion—a local qwen2.5-coder:1.5b via Continue is shockingly capable.

It produces no network traffic, costs zero subscription dollars, and responds without jitter. If your organization values IP isolation or you frequently work without Wi-Fi, this configuration is no longer a compromise; it is an upgrade.

References