TinkerLab
DIAGNOSTIC TREE // VRAM-OOM-CPU-FALLBACK (3 ROOT CAUSES)

Local Model Slowdown, OOM, or Silent CPU Fallback

Identify why a model whose weight file looks smaller than your VRAM still spills to CPU or crashes under real context lengths.

[KEY VERIFIED TAKEAWAY / TL;DR]This diagnostic decision tree for "Local Model Slowdown, OOM, or Silent CPU Fallback" provides 4 interactive nodes and 3 hardware-verified root-cause fixes (Fix: Right-Size Context Window (num_ctx) & Enable Q8_0 KV Cache; Fix: Unload Idle Models & Set OLLAMA_MAX_LOADED_MODELS=1; Fix: Configure NVIDIA Container Toolkit & GPU Device Reservation), paired with our reproducible guide "mac-local-llm-benchmark".
Local Model Slowdown, OOM, or Silent CPU Fallback
Step 1: Inspect Processor Split in ollama ps

While the model is loaded, run `ollama ps`. What does the PROCESSOR column report?

Diagnostic Probe Command
ollama ps

Look for "100% GPU" vs "65% CPU / 35% GPU" or multiple models loaded simultaneously.

Select what your environment outputs:
DIAGNOSTIC PROBE SEQUENCE // 完整分步探测命令与症状分支

All 1 Terminal Diagnostic Probes in "Local Model Slowdown, OOM, or Silent CPU Fallback"

Complete static reference of every read-only probe command, baseline hint, and branch transition in this decision tree.

Step 1: Inspect Processor Split in ollama psstep-ollama-ps

While the model is loaded, run `ollama ps`. What does the PROCESSOR column report?

ollama ps

Look for "100% GPU" vs "65% CPU / 35% GPU" or multiple models loaded simultaneously.

Symptom Branches:
  • • Shows partial CPU/GPU split (e.g., 45% CPU / 55% GPU)→ sol-kv-cache-spill
  • • Multiple models are listed in ollama ps eating up VRAM→ sol-multi-model-evict
  • • Shows 100% CPU inside a Docker container on NVIDIA PC→ sol-nvidia-container-toolkit
ALL VERIFIED FIXES IN THIS TREE // 本树涵盖的全部根因与修复方案一览

3 Verified Root Causes, Fix Configs & Commands in "Local Model Slowdown, OOM, or Silent CPU Fallback"

Fix: Right-Size Context Window (num_ctx) & Enable Q8_0 KV Cache

sol-kv-cache-spill

Open WebUI or client tools often request 16K–32K context. At FP16, the KV cache adds 3–8 GB on top of the model weights, forcing layers onto slow system RAM.

  1. Enable Flash Attention and Q8_0 KV Cache quantization on the Ollama server (cuts KV memory by ~50%).
  2. Cap num_ctx to 8192 or 16384 in your Modelfile or client request options.
# Set in environment before starting Ollama
export OLLAMA_FLASH_ATTENTION=1
export OLLAMA_KV_CACHE_TYPE=q8_0
export OLLAMA_NUM_PARALLEL=1

[BOUNDARY]Use the Tinker VRAM Calculator (/tools/vram-calculator/) to preview exact weight + KV cache budgets.

Verify: ollama ps

Fix: Unload Idle Models & Set OLLAMA_MAX_LOADED_MODELS=1

sol-multi-model-evict

When an embedding model (e.g., nomic-embed-text) and a chat LLM are called together in RAG, or when switching models, previous models remain resident for 5 minutes.

  1. Stop resident models immediately with ollama stop <model>.
  2. Set OLLAMA_MAX_LOADED_MODELS=1 (or 2 if running tiny embedding model + LLM).
ollama stop $(ollama ps | awk 'NR>1 {print $1}')
export OLLAMA_MAX_LOADED_MODELS=1
export OLLAMA_KEEP_ALIVE=5m

[BOUNDARY]If using Local RAG, keep your embedding model lightweight (e.g. bge-m3 or nomic-embed-text) so both fit.

Verify: ollama ps

Fix: Configure NVIDIA Container Toolkit & GPU Device Reservation

sol-nvidia-container-toolkit

Docker containers cannot see host NVIDIA GPUs unless nvidia-container-toolkit is installed and deploy.resources.reservations.devices is declared.

  1. Install nvidia-container-toolkit on the host and run sudo nvidia-ctk runtime configure --runtime=docker.
  2. Restart Docker daemon and add the GPU reservation block in docker-compose.yml.
services:
  ollama:
    image: ollama/ollama:0.5.7
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

[BOUNDARY]Note: Docker Desktop on macOS cannot pass Apple Silicon Metal GPU into Linux containers; run Ollama natively on macOS host instead.

Verify: docker exec tinker-ollama nvidia-smi
PAIRED REPRODUCIBLE GUIDE // 配套实测指南与硬件环境基线

Apple Silicon Mac Local Model Benchmark: Fixed Tasks, Quantization, Context & Speed

Measured prompt eval and token generation speeds across Q4_K_M, Q5_K_M, and Q8_0 on unified memory—showing exactly when raising num_ctx triggers SSD swap degradation.

TESTED HARDWARE & OS

MacBook Pro 14" (M3 Pro · 18GB & 36GB Unified Memory tested) · macOS 15.3

PINNED STACK VERSIONS

Ollama 0.5.7 · qwen2.5:7b-instruct · qwen2.5:14b-instruct · deepseek-r1:14b

VERIFIED (2026-10-23)

100% Offline After Weight Pull — Verified with Wi-Fi disabled (`networksetup -setairportpower en0 off`); zero outbound telemetry from ollama serve.