Local AI8 min read

Run Qwen 3.5 Locally on Windows with Ollama

Install Ollama on Windows, understand GGUF quantization and KV-cache sizing, benchmark cold vs. warm throughput, and call the local API from PowerShell.

Ramon GoveiaEditor, PolarisonPublished Checked against official sources

Running an open-weight language model directly on a Windows PC used to mean compiling C++ repositories, juggling CUDA toolkits, and converting model checkpoints by hand. Ollama compresses that entire stack into a single local service listening on 127.0.0.1:11434. Once installed, you get a CLI for quick experiments and an HTTP API that any PowerShell script, Python app, or coding agent can call with zero per-token fees and zero data leaving your machine.

In our Windows benchmark, Qwen 3.5 4B returned LOCAL_OK over the local REST API running at 100% CPU with a 2,048-token context window. Below is the complete technical walkthrough — from how GGUF quantization and KV-cache memory work under the hood, to measuring cold vs. warm throughput and deciding when local inference beats paying for a cloud API.

How Ollama works under the hood (GGUF, quantization, and KV cache)

Ollama wraps llama.cpp in a Go daemon with a Docker-like model registry. When you pull qwen3.5:4b, Ollama downloads a quantized GGUF (GPT-Generated Unified Format) file — roughly 3.3 GB on disk — instead of the uncompressed 16-bit weights that would require over 8 GB of RAM.

  • Quantization (Q4_K_M default): compresses each neural-network weight from 16 bits down to roughly 4.5 bits on average. That cuts memory bandwidth requirements by nearly 4x with minimal degradation on structured tasks, making 4B–8B models usable even on laptops without a discrete GPU.
  • CPU vs. GPU layer offloading: if Ollama detects a supported NVIDIA (CUDA) or AMD (ROCm) GPU with enough VRAM, it automatically offloads transformer layers to the GPU. On CPU-only machines — or when VRAM is full — layers spill into system RAM, which is why ollama ps reports the exact processor split (for example, 100% CPU or 70%/30% GPU/CPU).
  • Context window and KV cache (num_ctx): every active conversation allocates a Key-Value cache proportional to num_ctx. Setting num_ctx to 32,768 when your prompt only needs 2,048 tokens silently burns gigabytes of memory and slows prompt evaluation. Always match num_ctx to your real workload.

Ollama vs. LM Studio, llama.cpp, and vLLM

Before committing a project to Ollama, compare where it sits in the local-inference ecosystem:

RuntimeBest forTradeoff
OllamaHeadless local API, PowerShell/Python automation, and one-command model management.Fewer low-level sampler knobs exposed in the default UI than raw llama.cpp.
LM StudioDesktop GUI exploration, side-by-side GGUF downloads, and visual VRAM inspection.Heavier desktop app; less ergonomic for background scripting and CI tasks.
llama.cpp (llama-server)Maximum control over quantization, speculative decoding, and custom C++ builds.Manual binary and GGUF file management; no built-in model registry.
vLLMHigh-concurrency Linux GPU servers serving dozens of users simultaneously.Not designed for consumer Windows laptops; requires dedicated Linux CUDA GPUs.

Hardware sizing guide for Qwen 3.5 on Windows

Memory bandwidth — not raw CPU clock speed — is the primary bottleneck for local token generation. Use this sizing table to pick a Qwen tag that fits comfortably inside your RAM or VRAM without swapping to disk:

Model sizeDisk size (Q4)Recommended RAM / VRAMTypical Windows use case
1.5B – 3B1.1 – 2.2 GB8 GB RAMFast classification, JSON extraction, older laptops.
4B (this guide)~3.3 GB8–16 GB RAM or 6 GB VRAMLocal notes agents, tool calling, structured summaries.
7B – 9B4.7 – 6.0 GB16 GB RAM or 8–12 GB VRAMStronger coding help and multi-step reasoning offline.
14B – 32B9.0 – 20.0 GB32 GB+ RAM or 16–24 GB VRAMWorkstation-class local coding and private document RAG.

Step 1: Install Ollama and pull Qwen 3.5 4B

Run the official Windows installer, then open a fresh PowerShell window so the updated PATH takes effect. Pull Qwen 3.5 4B (~3.3 GB download). If disk space or memory is tight, browse smaller tags on the Qwen 3.5 tags page.

ollama --version
ollama pull qwen3.5:4b
ollama list
ollama show qwen3.5:4b
ollama run qwen3.5:4b

Ask a short sanity-check question in the interactive prompt and type /bye to exit. ollama list inspects models saved on disk, ollama show prints the architecture, parameter count, quantization level, and default template, and ollama ps displays which models are currently resident in memory along with their CPU/GPU split and active context size.

Step 2: Call the local HTTP API from PowerShell

Interactive prompts are great for spot checks, but real developer workflows hit the HTTP endpoint directly. Setting temperature = 0, stream = $false, think = $false, and a tight num_predict = 80 cap produces a deterministic, single-JSON response that is easy to assert in automated scripts.

$endpoint = 'http://127.0.0.1:11434'
$body = @{
  model = 'qwen3.5:4b'
  messages = @(@{ role = 'user'; content = 'Return exactly this string: LOCAL_OK' })
  stream = $false
  think = $false
  options = @{ temperature = 0; num_ctx = 2048; num_predict = 80 }
} | ConvertTo-Json -Depth 5

$reply = Invoke-RestMethod "$endpoint/api/chat" -Method Post -Body $body -ContentType 'application/json'
$reply.message.content
ollama ps

In our Windows test, the response returned LOCAL_OK in 7.18 seconds total — broken down into 6.50 seconds to load the GGUF weights from SSD into RAM and just 0.20 seconds to generate the three output tokens. Notice why single-run wall-clock times can be misleading if you do not separate load time from generation throughput. See the Ollama Chat API docs for every telemetry field returned in the JSON payload.

Step 3: Benchmark cold vs. warm requests accurately

Ollama keeps a model loaded in memory for 5 minutes by default (keep_alive). To measure both a cold start and steady-state tokens per second (TPS), unload the model with ollama stop qwen3.5:4b, confirm ollama ps is empty, and run the exact same prompt twice while extracting Ollama’s nanosecond telemetry fields:

[math]::Round($reply.load_duration / 1e9, 2)        # Model load time (seconds)
[math]::Round($reply.total_duration / 1e9, 2)       # Full request time (seconds)
if ($reply.eval_duration -gt 0) {
  [math]::Round($reply.eval_count / ($reply.eval_duration / 1e9), 2) # Output tokens/sec
}

Always record four variables alongside any local benchmark: the exact model tag, prompt length, num_ctx, and the processor split reported by ollama ps. Changing context size from 2,048 to 16,384 can cut throughput dramatically on CPU-bound machines.

Local Ollama vs. Cloud AI APIs: when does local win?

Local models cost $0 per token, but they are not always cheaper once you factor in hardware, latency, and capability. Local Ollama wins decisively for private documents that cannot leave your network, offline travel workflows, and high-volume development tests where you want zero billing surprises. Cloud APIs (like budget models tracked on our cheapest AI APIs ranking) win when you need frontier reasoning, 200K+ context windows, or multi-user concurrency without buying a $2,000 GPU. You can test the exact break-even point for your monthly token volume in the Polarison cost calculator.

Troubleshooting on Windows

  • PowerShell cannot find ollama: close and reopen the terminal so Windows reloads the user PATH, then verify with Get-Command ollama.
  • Port 11434 refuses connections: start the Ollama desktop tray app from the Start menu, or run ollama serve in a dedicated terminal if you are using the standalone binary.
  • Model not found (404): tags are exact — copy the full name:tag string directly from ollama list.
  • Unexpectedly slow generation: inspect ollama ps. If a GPU machine shows 100% CPU, update your NVIDIA/AMD drivers, lower num_ctx, or drop to a smaller quantized tag so all layers fit in VRAM.
  • High RAM usage after finishing: call ollama stop qwen3.5:4b to release memory immediately instead of waiting for the 5-minute idle timer.

Ready to put the local API to work? Continue to our next guide to build a local Python notes agent that cites its source file. For OS-specific service flags, see Ollama on Windows.

Keep reading