guide · local ai code review

Experimental Ollama compatibility with DeepSeek-Coder

A privacy-first compatibility setup for exercising a model endpoint you control. In v1.0.4 this is an experimental provider smoke, not the promoted live-review lane.

Local inference

With the default loopback endpoint, review prompts and model inference stay on the review machine. GitHub posting remains optional and explicit.

Your hardware

Runs on an M-series MacBook, a Linux workstation with a consumer GPU, or a shared server on your internal network.

Compatibility contract

Provider doctor can exercise endpoint readiness. It does not promote Ollama review output, inline comments, or posting support in v1.0.4.

Why local?

Cloud-hosted AI code review tools ingest your diff on vendor infrastructure. That's fine for public code, and a hard non-starter for anything under NDA, in a regulated industry, or that your team considers a product secret. A local pipeline removes the hosted-model inference path while keeping deployment under your control.

Ollama is a small runtime that serves open-weight models behind an OpenAI-compatible HTTP endpoint. DeepSeek-Coder is one of the strongest open code models for review-style tasks — it reasons well about diffs, catches real bugs, and runs on hardware you probably already own.

1. Install Ollama

macOS / Linux — one line:

curl -fsSL https://ollama.com/install.sh | sh

On macOS you can also download the .dmg from ollama.com. On Windows, use the official installer.

2. Pull DeepSeek-Coder

Grab a model sized for your hardware. Start with the 16B variant — it fits on 16 GB of unified memory and gives you a practical starting point for review quality:

ollama pull deepseek-coder-v2:16b

On a workstation with 24 GB+ VRAM, pull a higher-quality quant:

ollama pull deepseek-coder-v2:16b-lite-instruct-q6_K

Ollama serves on http://127.0.0.1:11434 by default. Confirm with ollama list.

3. Smoke-test the endpoint

Confirm the OpenAI-compatible route is live before wiring anything else up:

curl http://127.0.0.1:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-coder-v2:16b",
    "messages": [
      { "role": "user", "content": "Review this diff: - return x + 1\n+ return x - 1" }
    ]
  }'

4. Point NeonDiff at Ollama

Install NeonDiff, initialize a local config, and complete mandatory API-backed activation before provider or review work. Pass the activation key only from an approved secret store over bounded stdin:

curl -fsSL https://www.neondiff.com/install | sh
neondiff init --config config.local.json
security find-generic-password -s YOUR_APPROVED_SOURCE -w | neondiff license activate --config config.local.json --license-key-stdin true --json

Then enable the local provider in config.local.json. Ollama on loopback normally uses authMode: "none"; do not invent a fake provider key:

{
  "providers": {
    "providers": {
      "ollama-local": {
        "enabled": true,
        "adapter": "openai-compatible",
        "baseUrl": "http://localhost:11434/v1",
        "model": "deepseek-coder-v2:16b",
        "authMode": "none",
        "structuredOutputMode": "ollama-format-json-schema",
        "capabilities": {
          "review": true,
          "jsonOutput": true,
          "local": true,
          "streaming": false
        }
      }
    }
  }
}

neondiff providers doctor --config config.local.json --provider ollama-local --smoke true --json

The Ollama compatibility interface is experimental in v1.0.4; it is not yet a promoted live-review claim. The ZCode-backed live engine remains the promoted review lane while the local adapter completes its promotion and evidence work. Use provider doctor as a compatibility smoke only, keep posting disabled, and follow the current provider-status documentation before relying on Ollama for review output.

5. Run a dry-run review

Keep posting disabled until activation, GitHub App readiness, and the selected provider smoke all pass. Then run one current-head dry run:

neondiff doctor github --config config.local.json --json
neondiff review-pr --config config.local.json --repo owner/project --pr 42 --dry-run true

Tuning notes

  • Context window. DeepSeek-Coder V2 handles ~128k tokens; keep per-file review chunks under ~8k for latency.
  • Quantization. Q4 for laptops, Q6 for GPU workstations, Q8 if you have the VRAM. Higher quants noticeably reduce false-positive nits.
  • Warm the model. Ollama unloads models after idle; a nightly cron with a dummy request keeps first-review latency low.

FAQ

Which DeepSeek-Coder model size should I run?
For a laptop with 16 GB unified memory, start with deepseek-coder-v2:16b at Q4. On a workstation with 24 GB+ VRAM, deepseek-coder-v2:16b at Q6 or Q8 gives noticeably sharper review comments. The 33B variant is only worth it if you have 48 GB+ VRAM.
Is anything sent over the network?
Ollama listens on 127.0.0.1:11434 by default, so model inference can stay on the review machine. An internal Ollama host uses your network, and optional GitHub posting sends findings to GitHub under your configured posting policy.
Can I use a self-hosted server instead of my laptop?
Yes for the experimental compatibility smoke. Run Ollama on a Linux host and change the endpoint URL, but do not treat that smoke as a promoted NeonDiff live-review lane.
How does this compare to CodeRabbit or Greptile?
Hosted review tools run model inference on vendor infrastructure. This setup can run inference on your own Ollama endpoint; optional GitHub posting remains a separate configured network action.

Run this pipeline on your next PR

Local-first AI code review. Bring your own model, keep your source code on your machine, review every PR.

Get NeonDiff →