DeepSeek-R1 & Qwen2.5-Coder Local IDE Setup: <think> Token Budgets, FIM Autocomplete & Loop Fixes
Why using DeepSeek-R1 for tab autocomplete ruins IDE latency—and how to pair R1-14B (for architectural reasoning with 4K <think> budget) alongside Qwen2.5-Coder-7B (for sub-250ms FIM edits).
MacBook Pro M3 Max (36GB Unified) & NVIDIA RTX 4070 Ti Super (16GB VRAM)
All repository indexing (`bge-m3`), FIM tab completion, and multi-file refactoring stay strictly on localhost.
- Never assign a reasoning model (`deepseek-r1`) to `tabAutocompleteModel`: it emits `<think>` tokens before every line completion, adding 3–8 seconds of lag.
- Setting `temperature: 0` on quantized DeepSeek-R1 distill models causes repetitive self-doubt loops ("Wait, let me re-verify..."); always use `temperature: 0.6, top_p: 0.95`.
1. Role Separation: Reasoning Model (Architect) vs FIM Model (Tab Edit)
| IDE Task | Recommended Model | Avg <think> Overhead | Time to Usable Code |
|---|---|---|---|
| Tab FIM Autocomplete | qwen2.5-coder:7b (Q4_K_M) | 0 tokens (Direct FIM) | 140–220 ms |
| Tab Autocomplete (Misconfigured) | deepseek-r1:14b (Anti-pattern!) | 350–900 <think> tokens | 6.5–14.0 s (Unusable) |
| Multi-File Bug Root-Cause Analysis | deepseek-r1:14b (temp=0.6) | 850–1,750 <think> tokens | 18–32 s (High accuracy) |
2. Stripping `<think>` Blocks in Automated Scripts & Workflows
export function extractR1FinalAnswer(rawText) {
if (rawText.includes('<think>') && !rawText.includes('</think>')) {
throw new Error('DeepSeek-R1 exhausted max_tokens inside <think> before emitting final code');
}
return rawText.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
}3. Local Codebase Indexing (`@codebase`) with `bge-m3` & `.continueignore`
Frequently Asked Questions & Edge Cases
Q: Can I keep both `deepseek-r1:14b` and `qwen2.5-coder:7b` loaded in memory at the same time?
On a 24GB GPU (RTX 3090/4090) or 36GB+ Mac, yes: `deepseek-r1:14b` (Q4_K_M, ~10.5 GB with Q8_0 KV) + `qwen2.5-coder:7b` (~5.2 GB) totals ~15.7 GB. On a 12GB–16GB machine, use `deepseek-r1:7b` + `qwen2.5-coder:1.5b` so both stay 100% on GPU.
Q: How do I stop DeepSeek-R1 from over-thinking for 2,000 tokens on simple coding questions?
Route quick single-function edits (`Cmd+I` inline edit) to `qwen2.5-coder:7b` or `qwen2.5-coder:14b` (non-reasoning instruct models), and reserve `deepseek-r1` specifically for architectural planning or tricky bug root-cause analysis.
Continue / VS Code Dual-Model Local Coding Config (DeepSeek-R1 + Qwen2.5-Coder)
Separates architectural reasoning (DeepSeek-R1 with 16K context & 4K max_tokens for <think>) from sub-200ms tab autocomplete (Qwen2.5-Coder-7B).
{
"models": [
{
"title": "Local DeepSeek-R1 (Architect & Debugger)",
"provider": "ollama",
"model": "deepseek-r1:14b",
"apiBase": "http://127.0.0.1:11434",
"contextLength": 16384,
"completionOptions": {
"temperature": 0.6,
"topP": 0.95,
"maxTokens": 4096
}
},
{
"title": "Local Qwen2.5-Coder (Fast Edit)",
"provider": "ollama",
"model": "qwen2.5-coder:7b",
"apiBase": "http://127.0.0.1:11434",
"contextLength": 16384,
"completionOptions": {
"temperature": 0.1,
"maxTokens": 2048
}
}
],
"tabAutocompleteModel": {
"title": "Qwen2.5-Coder FIM Autocomplete",
"provider": "ollama",
"model": "qwen2.5-coder:7b",
"apiBase": "http://127.0.0.1:11434",
"completionOptions": {
"maxTokens": 256,
"temperature": 0.05
}
},
"embeddingsProvider": {
"provider": "ollama",
"model": "bge-m3",
"apiBase": "http://127.0.0.1:11434"
}
}