Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

hotfix v2.4.6: Bug L — drop hardcoded num_gpu:99 from Ollama chat

purple47d5c395dfca
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cec482d0..832c6e0e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,20 @@ All notable changes to Locally Uncensored are documented here.
## [Unreleased]
+## [2.4.6] - 2026-05-19
+
+Drop-in hotfix on top of v2.4.5. **One bug**: nightmare13740 (Discord 2026-05-18).
+
+### Fixed — chat throughput on tight VRAM cards
+
+- **Dropped hardcoded `num_gpu: 99` override on every Ollama chat request** (Bug L — nightmare13740 Discord #help-chat, 2026-05-18). The override was added in v2.2.1 (commit `ead5673`, april 2026) on the assumption "all desktop users have 16 GB+ cards, Ollama's auto-detect is too conservative, force max GPU offload." That assumption no longer holds with 2026 laptop GPUs (RTX 4070 Laptop ships with 8 GB) and modern model context windows (Gemma 3/4 advertise 128k native context, which materially expands the KV cache footprint). Symptom on nightmare13740's RTX 4070 Laptop 8 GB + gemma3:4b: ollama CLI without `num_gpu` ran at **30 tok/s** with sane VRAM use; LU's chat hit **6.9 tok/s** with VRAM saturated and 4 GB spilled to system RAM. The forced 99-layer offload exhausted VRAM, the KV cache had nowhere to live except system RAM, and every generated token thrashed across the PCIe bus. v2.4.6 removes the override from all five chat sites — `chatStream`, `chatStreamWithTools`, and `chatWithTools` in `src/api/ollama.ts`, `chatStream` and `chatWithTools` in `src/api/providers/ollama-provider.ts`, the Agent-Mode tool-call body in `src/lib/ollama-stream-tools.ts`, and both Remote-Access JS-template paths (`nativeToolChat` and the main agent loop) in `src-tauri/src/commands/remote.rs`. Ollama now applies its own VRAM-aware layer-placement logic on every request, which is a no-op on cards with headroom (Ollama already maxes layer count when VRAM allows) and restores CLI parity on tight cards.
+
+### Tests
+
+- `vitest`: **2284 passed** (93 files, unchanged count). Rewrote one existing assertion in `provider-ollama.test.ts` ("always includes options with num_gpu" → "v2.4.6 Bug L: NEVER sets num_gpu — Ollama decides layer placement itself") and two assertions in `mobile-parity.test.ts` to lock down the absence of `num_gpu` in the request body.
+- `cargo test --release`: **89 passed + 1 ignored** — no Rust unit-test changes (the Rust edits were in JS templates that aren't unit-tested at the Rust layer).
+- `cargo check --release`: clean (pre-existing dead-code warnings only).
+
## [2.4.5] - 2026-05-17
Drop-in hotfix on top of v2.4.4. **Fourteen bugs total**: six user-reported (A — Discord/Reddit; B — GH #38; C — GH Discussion #39; D — Discord; E — GH #32 comment; K — Discord #help-coding-agent) plus eight surfaced during the real-tester Arch live verification sweep (F — `install_custom_node` not venv-aware on PEP 668; G — `install_ollama` Windows-only `.exe` download, plus a refix when the original tarball URL stopped resolving; H — `install_lmstudio` Windows-only; I — `install_python` Windows-only winget; J — `start_comfyui` crashes on non-NVIDIA systems without `--cpu` flag).
diff --git a/README.md b/README.md
index 3322c637..d335e946 100644
--- a/README.md
+++ b/README.md
@@ -35,32 +35,25 @@ No cloud. No data collection. No API keys. Auto-detects 12 local backends. Your
---
-## v2.4.5 — Current Release
+## v2.4.6 — Current Release
-**Hotfix: 14 fixes on top of v2.4.4.**
+**Hotfix: 1 fix on top of v2.4.5.**
-Drop-in hotfix on top of v2.4.4. Auto-update prompts on next launch.
-
-Six user-reported plus eight surfaced during a full Arch real-tester sweep between v2.4.4 release and 2026-05-17. Thanks to **miguelkodoatie**, **Turbulent_Tomato7559**, **dethlux**, **Anson192**, **emilmjt**, **rzgrozt**, and **phantomderp** for the repros.
+Auto-update prompts on next launch. Reported by **nightmare13740** on Discord 2026-05-18 with a clean ollama-CLI A/B comparison.
### What's fixed
-- **Video output produces real `.mp4` files** (Bug A — miguelkodoatie, Turbulent_Tomato7559). When ComfyUI lacks `VHS_VideoCombine`, clicking generate on a video model now opens a modal with a one-click install (git clone of `kosinkadink/videohelpersuite` + pip + ComfyUI restart, ~30 s) instead of silently falling through to `SaveAnimatedWEBP`.
-- **"ComfyUI loading…" gets an actionable panel after 60 s** (Bug B — dethlux GH #38). Shows elapsed time, inline log viewer (last 30 lines), `Kill process`, and `Restart` buttons so users can diagnose or recover without restarting LU.
-- **One-click repair for Ollama "unable to load model: …blobs/sha256-…"** (Bug C — Anson192 GH Discussion #39, RTX 4090). New `missing-blob` error classification surfaces a `Refresh` chip that runs `ollama pull <model>` to re-fetch the missing blob.
-- **Dynamic context-window detection** (Bug K — phantomderp Discord). LU now probes the LM Studio Enhanced API (`/api/v0/models/<id>`) and the generic `/v1/models/<id>` to surface the real max context per model. No more capped 8k display when the model supports 32k / 128k. Also covers Ollama architecture-specific keys (`qwen2.context_length`, `llama.context_length`).
-- **Arch + Wayland AppImage no longer opens to an empty window** (Bug D — emilmjt Discord). Sets `WEBKIT_DISABLE_DMABUF_RENDERER=1` + `WEBKIT_DISABLE_COMPOSITING_MODE=1` at startup on Linux (upstream-recommended workaround for `tauri-apps/tauri#9304`), and ships explicit `webkit2gtk-4.1` / `gtk3` / `libayatana-appindicator3-1` deps plus AppImage media framework bundling.
-- **PEP 668 protected Pythons no longer brick the ComfyUI install** (Bug E — rzgrozt GH #32). Installer detects the marker (Arch, Debian 12+, Fedora 38+, Ubuntu 23.04+) and auto-creates `<ComfyUI>/venv`, then routes all pip work through the venv Python so the system Python's PEP 668 block never fires. Launcher mirrors the lookup so ComfyUI boots with the venv it was installed against.
-- **Linux installer family overhaul** (Bugs F, G, H, I, J — Arch real-tester sweep). Custom-node install respects the ComfyUI venv on PEP 668 distros (Bug F). Ollama Linux install surfaces a distro-specific package command (`sudo pacman -S ollama`, `sudo apt install ollama` on Debian 12+, etc.) instead of trying to download a Windows `.exe` or a multi-GB tarball (Bug G). LM Studio + Python install dispatch by `target_os` instead of always running `winget` / Windows installers (Bugs H + I). ComfyUI gets a `--cpu` fallback on systems without an NVIDIA driver so it stops crashing before binding port 8188 on AMD / Intel Arc / fresh Linux boxes (Bug J).
+- **Chat throughput restored on tight-VRAM cards** (Bug L — nightmare13740 Discord). LU was sending `num_gpu: 99` on every Ollama chat request, forcing all model layers onto the GPU regardless of free VRAM. On 8 GB-VRAM laptop cards (e.g. RTX 4070 Laptop + gemma3:4b) the KV cache had nowhere to live except system RAM, dragging chat speed from **30 tok/s** in ollama CLI down to **6.9 tok/s** in LU. v2.4.6 drops the override entirely so Ollama applies its own VRAM-aware layer-placement logic — no-op on cards with headroom, full CLI parity on tight cards.
### Stability
-- `vitest`: 93 files / **2284 tests** green (+13 for Bug K context-window detection across `provider-openai.test.ts` and `provider-ollama.test.ts`, +7 for missing-blob error coverage, +1 smoke test for `videohelpersuite` registry).
-- `cargo test --release`: **89 passed + 1 ignored** (+5 Bug D webkit env-vars, +13 Bug E PEP 668 / venv, +9 Bug I distro hint, +2 Bug J nvidia-smi probe, +8 Bug G refix distro hint).
-- `tsc --noEmit`: clean. `cargo check`: clean (1 dead-code warning, pre-existing).
-- Bug A, B, C, D, E, F, G, J, K live-verified via Computer-Use on Windows 10 + RTX 3060 Ti AND on a real Arch Linux VM (kernel 7.0.8, headless sway). Multi-tool agent-loop E2E test: gemma4:e4b batched 5 parallel `fs_write` calls in one response, all 5 markdown files landed correctly. Image gen: Juggernaut-XL 1024x1024 20 steps → 80 s. Video gen: Wan 2.1 T2V 1.3B 480x480 17 frames → 122 s.
+- `vitest`: 93 files / **2284 tests** green (rewrote 3 assertions to lock in the absence of `num_gpu` in chat-request bodies).
+- `cargo test --release`: **89 passed + 1 ignored** (unchanged; Rust edits were inside the JS remote-access template, not Rust unit-tested).
+- `tsc --noEmit`: clean. `cargo check`: clean (pre-existing dead-code warnings only).
- No breaking changes, no localStorage migration — upgrade in place.
### Heads-up
-`#bug-reports` / `#help-*` / GitHub will be checked daily for the next few days for any regression. v2.4.5 is a Windows + Linux release; macOS is not part of this build.
+v2.4.6 is a Windows + Linux release; macOS is not part of this build. `#bug-reports` / `#help-*` / GitHub will be monitored daily for regression reports.
+
+For previous release notes (v2.4.5 — 14 bugs), see [CHANGELOG.md](CHANGELOG.md).
For older releases, see [CHANGELOG.md](CHANGELOG.md).
diff --git a/docs/index.html b/docs/index.html
index 8ee6df7d..71722614 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -33,7 +33,7 @@
<link rel="icon" href="https://locallyuncensored.com/favicon.png">
<link rel="apple-touch-icon" href="https://locallyuncensored.com/favicon.png">
<script type="application/ld+json">
-{"@context":"https://schema.org","@type":"SoftwareApplication","name":"Locally Uncensored","alternateName":["LU","Locally Uncensored Desktop App"],"applicationCategory":"DeveloperApplication","applicationSubCategory":"Artificial Intelligence","operatingSystem":"Windows 10, Windows 11, Linux","description":"Open-source desktop app for running AI locally. Chat with 20+ providers, generate images and video via ComfyUI, and code with a built-in AI agent — all on your own hardware. Auto-detects 12 local backends. No cloud, no telemetry.","url":"https://locallyuncensored.com/","downloadUrl":"https://github.com/PurpleDoubleD/locally-uncensored/releases/latest","softwareVersion":"2.4.5","license":"https://www.gnu.org/licenses/agpl-3.0.html","author":{"@type":"Person","name":"PurpleDoubleD","url":"https://github.com/PurpleDoubleD"},"offers":{"@type":"Offer","price":"0","priceCurrency":"USD","availability":"https://schema.org/InStock"},"featureList":["Plug & Play Setup with 12 Local Backend Auto-Detection (Ollama, LM Studio, vLLM, KoboldCpp, Jan, llama.cpp, LocalAI, GPT4All, TabbyAPI, Aphrodite, SGLang, TGI)","20+ Provider Presets (local + cloud)","Qwen 3.6 Day-0 Support (35B MoE, Vision, Agentic Coding, 256K context)","GPT-OSS Compatible (120B, 20B via Ollama)","GLM-4.7 Flash Integration","DeepSeek R1 and DeepSeek V3 Support","Llama 4 and Llama 3.3 Ready","Gemma 4 E4B and 27B (Native Vision)","Mistral Small 3 and Phi 4 Support","Qwen 3 Coder and Qwen 2.5 Coder","Abliterated Model Variants","Codex Coding Agent with Live Streaming and Apply-Patch","Claude Code CLI Integration","Agent Mode with 14 Tools, Parallel Execution, MCP, Sub-Agent Delegation","Remote Access from Phone via LAN or Cloudflare Tunnel (6-digit Passcode, QR Setup)","Mobile Web App (Chat, Codex, Tools, Plugins)","Image Generation via ComfyUI (FLUX 2 Klein, FLUX.1, Juggernaut XL, Z-Image Turbo, ERNIE-Image, SDXL, SD 3.5)","Video Generation (Wan 2.1, Wan 2.2, HunyuanVideo 1.5, LTX 2.3, FramePack F1, AnimateDiff, CogVideoX)","Image-to-Image with Denoise Control","Image-to-Video (FramePack F1, CogVideoX, SVD)","Granular Permission System (7 Tool Categories)","File Upload with Vision Support","Thinking Mode with Universal Tag Stripping","A/B Model Compare","Local Benchmark","Memory System and Document RAG","Voice (STT / TTS)","Auto-Update over Signed NSIS Channel","75+ One-Click Model Downloads","Hardware-Aware Model Recommendations","100% Offline and Private (No Telemetry)","AGPL-3.0 Open Source"],"screenshot":"https://raw.githubusercontent.com/PurpleDoubleD/locally-uncensored/master/docs/social-preview.png","softwareRequirements":"Any OpenAI-compatible local backend (Ollama, LM Studio, vLLM, KoboldCpp, etc.) or cloud API key","memoryRequirements":"8 GB RAM minimum; 8-16 GB VRAM for image/video generation","storageRequirements":"6 GB for default model"}
+{"@context":"https://schema.org","@type":"SoftwareApplication","name":"Locally Uncensored","alternateName":["LU","Locally Uncensored Desktop App"],"applicationCategory":"DeveloperApplication","applicationSubCategory":"Artificial Intelligence","operatingSystem":"Windows 10, Windows 11, Linux","description":"Open-source desktop app for running AI locally. Chat with 20+ providers, generate images and video via ComfyUI, and code with a built-in AI agent — all on your own hardware. Auto-detects 12 local backends. No cloud, no telemetry.","url":"https://locallyuncensored.com/","downloadUrl":"https://github.com/PurpleDoubleD/locally-uncensored/releases/latest","softwareVersion":"2.4.6","license":"https://www.gnu.org/licenses/agpl-3.0.html","author":{"@type":"Person","name":"PurpleDoubleD","url":"https://github.com/PurpleDoubleD"},"offers":{"@type":"Offer","price":"0","priceCurrency":"USD","availability":"https://schema.org/InStock"},"featureList":["Plug & Play Setup with 12 Local Backend Auto-Detection (Ollama, LM Studio, vLLM, KoboldCpp, Jan, llama.cpp, LocalAI, GPT4All, TabbyAPI, Aphrodite, SGLang, TGI)","20+ Provider Presets (local + cloud)","Qwen 3.6 Day-0 Support (35B MoE, Vision, Agentic Coding, 256K context)","GPT-OSS Compatible (120B, 20B via Ollama)","GLM-4.7 Flash Integration","DeepSeek R1 and DeepSeek V3 Support","Llama 4 and Llama 3.3 Ready","Gemma 4 E4B and 27B (Native Vision)","Mistral Small 3 and Phi 4 Support","Qwen 3 Coder and Qwen 2.5 Coder","Abliterated Model Variants","Codex Coding Agent with Live Streaming and Apply-Patch","Claude Code CLI Integration","Agent Mode with 14 Tools, Parallel Execution, MCP, Sub-Agent Delegation","Remote Access from Phone via LAN or Cloudflare Tunnel (6-digit Passcode, QR Setup)","Mobile Web App (Chat, Codex, Tools, Plugins)","Image Generation via ComfyUI (FLUX 2 Klein, FLUX.1, Juggernaut XL, Z-Image Turbo, ERNIE-Image, SDXL, SD 3.5)","Video Generation (Wan 2.1, Wan 2.2, HunyuanVideo 1.5, LTX 2.3, FramePack F1, AnimateDiff, CogVideoX)","Image-to-Image with Denoise Control","Image-to-Video (FramePack F1, CogVideoX, SVD)","Granular Permission System (7 Tool Categories)","File Upload with Vision Support","Thinking Mode with Universal Tag Stripping","A/B Model Compare","Local Benchmark","Memory System and Document RAG","Voice (STT / TTS)","Auto-Update over Signed NSIS Channel","75+ One-Click Model Downloads","Hardware-Aware Model Recommendations","100% Offline and Private (No Telemetry)","AGPL-3.0 Open Source"],"screenshot":"https://raw.githubusercontent.com/PurpleDoubleD/locally-uncensored/master/docs/social-preview.png","softwareRequirements":"Any OpenAI-compatible local backend (Ollama, LM Studio, vLLM, KoboldCpp, etc.) or cloud API key","memoryRequirements":"8 GB RAM minimum; 8-16 GB VRAM for image/video generation","storageRequirements":"6 GB for default model"}
</script>
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"Organization","name":"PurpleDoubleD","url":"https://github.com/PurpleDoubleD","logo":"https://locallyuncensored.com/logos/LU-monogram-bw-transparent.png","sameAs":["https://github.com/PurpleDoubleD","https://github.com/PurpleDoubleD/locally-uncensored","https://reddit.com/user/GroundbreakingMall54","https://locallyuncensored.com"]}
@@ -868,10 +868,10 @@ footer a:hover{color:var(--fg)}
<div class="container">
<div class="dl-card">
<div class="dl-info">
- <h3>Locally Uncensored <em>&mdash; 2.4.5</em></h3>
+ <h3>Locally Uncensored <em>&mdash; 2.4.6</em></h3>
<p>WINDOWS &middot; ~7 MB installer &middot; AGPL-3.0</p>
</div>
- <a class="dl-btn" href="https://github.com/PurpleDoubleD/locally-uncensored/releases/download/v2.4.5/Locally.Uncensored_2.4.5_x64-setup.exe" download>
+ <a class="dl-btn" href="https://github.com/PurpleDoubleD/locally-uncensored/releases/download/v2.4.6/Locally.Uncensored_2.4.6_x64-setup.exe" download>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
Download .exe
</a>
@@ -1169,10 +1169,10 @@ footer a:hover{color:var(--fg)}
<div class="narrow">
<div class="dl-card">
<div class="dl-info">
- <h3>Locally Uncensored <em>&mdash; 2.4.5</em></h3>
+ <h3>Locally Uncensored <em>&mdash; 2.4.6</em></h3>
<p>WINDOWS &middot; ~7 MB installer &middot; AGPL-3.0</p>
</div>
- <a class="dl-btn" href="https://github.com/PurpleDoubleD/locally-uncensored/releases/download/v2.4.5/Locally.Uncensored_2.4.5_x64-setup.exe" download>
+ <a class="dl-btn" href="https://github.com/PurpleDoubleD/locally-uncensored/releases/download/v2.4.6/Locally.Uncensored_2.4.6_x64-setup.exe" download>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
Download .exe
</a>
diff --git a/package.json b/package.json
index 9bff5716..6893df91 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "locally-uncensored",
- "version": "2.4.5",
+ "version": "2.4.6",
"private": false,
"description": "Generate anything — text, images, video. Locally. Uncensored.",
"license": "AGPL-3.0",
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 5e749cee..adc38b9e 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -2508,7 +2508,7 @@ dependencies = [
[[package]]
name = "locally-uncensored"
-version = "2.4.5"
+version = "2.4.6"
dependencies = [
"axum",
"base64 0.22.1",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 73dc214b..2dd0d93f 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "locally-uncensored"
-version = "2.4.5"
+version = "2.4.6"
description = "Private, local AI chat & image/video generation"
authors = ["purpledoubled"]
edition = "2021"
diff --git a/src-tauri/src/commands/remote.rs b/src-tauri/src/commands/remote.rs
index 68feb3ac..88913587 100644
--- a/src-tauri/src/commands/remote.rs
+++ b/src-tauri/src/commands/remote.rs
@@ -1631,7 +1631,9 @@ button{-webkit-appearance:none;appearance:none}
messages: apiMessages,
tools: tools,
stream: false,
- options: {num_gpu: 99, num_predict: 16384}
+ // v2.4.6 Bug L: dropped hardcoded num_gpu:99 (forced all layers to GPU,
+ // killed 8 GB-VRAM laptop chat speed). Ollama auto-decides layer count.
+ options: {num_predict: 16384}
};
// Tri-state think flag — same logic as _doSend.
if(isThinkingCompatible(currentModel)){
@@ -2933,7 +2935,8 @@ button{-webkit-appearance:none;appearance:none}
// and "don't let tagged-thinking models loop forever" (true `-1`
// caused Gemma 3/4 to think without ever emitting an answer). 16 k is
// enough for the longest reasonable agent reply plus deep thinking.
- var body = {model:currentModel, messages:apiMsgs, stream:true, options:{num_gpu:99, num_predict:16384}};
+ // v2.4.6 Bug L: dropped num_gpu:99 — see nativeToolChat() comment above.
+ var body = {model:currentModel, messages:apiMsgs, stream:true, options:{num_predict:16384}};
// Tri-state: for thinking-capable models we normally send explicit
// true|false. Explicit `false` tells Ollama to SKIP thinking (saves
// tokens) instead of silently letting the model emit <think> tags we'd
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 7157cbd8..507edbad 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-cli/schema.json",
"productName": "Locally Uncensored",
- "version": "2.4.5",
+ "version": "2.4.6",
"identifier": "com.purpledoubled.locally-uncensored",
"build": {
"beforeBuildCommand": "npm run build",
diff --git a/src/api/__tests__/mobile-parity.test.ts b/src/api/__tests__/mobile-parity.test.ts
index 893a3aeb..98f47353 100644
--- a/src/api/__tests__/mobile-parity.test.ts
+++ b/src/api/__tests__/mobile-parity.test.ts
@@ -52,7 +52,10 @@ function transformUserMessageWithCaveman(msg: ChatMessage, caveman: CavemanMode,
}
function buildOllamaBody(model: string, messages: ChatMessage[], opts: { thinking?: boolean } = {}) {
- const body: any = { model, messages, stream: true, options: { num_gpu: 99 } }
+ // v2.4.6 Bug L: dropped hardcoded num_gpu:99 (was forcing all layers to GPU
+ // on every request, killing 8 GB-VRAM laptop chat speed). Ollama
+ // auto-decides layer placement based on free VRAM now.
+ const body: any = { model, messages, stream: true, options: {} }
if (opts.thinking === true && isThinkingCompatible(model)) body.think = true
return body
}
@@ -244,7 +247,8 @@ describe('mobile-parity › buildOllamaBody', () => {
const b = buildOllamaBody('qwen3:8b', msgs, { thinking: false })
expect(b.think).toBeUndefined()
expect(b.stream).toBe(true)
- expect(b.options.num_gpu).toBe(99)
+ // v2.4.6 Bug L: num_gpu no longer forced.
+ expect(b.options.num_gpu).toBeUndefined()
})
it('sets think:true when thinking=true AND compatible', () => {
@@ -272,9 +276,14 @@ describe('mobile-parity › buildOllamaBody', () => {
expect(b.stream).toBe(true)
})
- it('sets num_gpu to 99 for GPU offload', () => {
+ it('v2.4.6 Bug L: does NOT force num_gpu — Ollama auto-decides layers', () => {
+ // Pre-v2.4.6 we set num_gpu:99 to force all layers to GPU. On 8 GB-VRAM
+ // laptop cards that drowned the KV cache into system RAM (4.3× slower
+ // than ollama CLI per nightmare13740 report). Letting Ollama decide
+ // restores CLI parity on tight cards and is a no-op on cards with
+ // headroom.
const b = buildOllamaBody('llama3.1:8b', msgs)
- expect(b.options.num_gpu).toBe(99)
+ expect(b.options.num_gpu).toBeUndefined()
})
})
diff --git a/src/api/__tests__/provider-ollama.test.ts b/src/api/__tests__/provider-ollama.test.ts
index 31d47bca..fd7b9aa6 100644
--- a/src/api/__tests__/provider-ollama.test.ts
+++ b/src/api/__tests__/provider-ollama.test.ts
@@ -451,7 +451,13 @@ describe('OllamaProvider', () => {
expect(body.options.num_predict).toBe(1024)
})
- it('always includes options with num_gpu even when no chat options provided', async () => {
+ it('v2.4.6 Bug L: NEVER sets num_gpu — Ollama decides layer placement itself', async () => {
+ // Pre-v2.4.6 this asserted body.options === { num_gpu: 99 }, which
+ // forced all model layers onto the GPU and pushed the KV cache into
+ // system RAM on 8 GB-VRAM laptop cards (nightmare13740 report:
+ // 30 tok/s ollama CLI vs 6.9 tok/s LU on RTX 4070 Laptop + gemma3:4b).
+ // The fix removes the override so Ollama can apply its own VRAM-aware
+ // auto-layer logic.
const provider = new OllamaProvider(makeConfig())
mockLocalFetch.mockResolvedValueOnce(
new Response(JSON.stringify({
@@ -467,7 +473,8 @@ describe('OllamaProvider', () => {
)
const body = JSON.parse(mockLocalFetch.mock.calls[0][1]?.body as string)
- expect(body.options).toEqual({ num_gpu: 99 })
+ expect(body.options.num_gpu).toBeUndefined()
+ expect(body.options).toEqual({})
})
it('handles empty message content', async () => {
diff --git a/src/api/ollama.ts b/src/api/ollama.ts
index 588d6695..6e8b18dc 100644
--- a/src/api/ollama.ts
+++ b/src/api/ollama.ts
@@ -56,7 +56,15 @@ export async function chatStream(
options: { temperature?: number; top_p?: number; top_k?: number; num_predict?: number } = {},
signal?: AbortSignal
): Promise<Response> {
- const opts = { num_gpu: 99, ...options }
+ // v2.4.6 Bug L: dropped hardcoded `num_gpu: 99`. Old code forced ALL layers
+ // onto the GPU regardless of free VRAM, which on 8 GB laptop cards (e.g.
+ // 4070 laptop + gemma3:4b) pushed the KV cache out into system RAM and
+ // dropped chat throughput from 30 tok/s (ollama CLI auto-detect) to 6.9
+ // tok/s in LU (nightmare13740 Discord 2026-05-18). Letting Ollama do its
+ // own layer/VRAM decision restores parity with the CLI on tight cards
+ // and is a no-op on cards with headroom (Ollama already maxes layers
+ // when it can fit them).
+ const opts = { ...options }
const res = await localFetchStream(ollamaUrl("/chat"), {
method: "POST",
body: JSON.stringify({ model, messages, options: opts, stream: true }),
@@ -73,7 +81,8 @@ export async function chatStreamWithTools(
options: { temperature?: number; top_p?: number; top_k?: number; num_predict?: number } = {},
signal?: AbortSignal
): Promise<Response> {
- const opts = { num_gpu: 99, ...options }
+ // v2.4.6 Bug L: see chatStream() above — same num_gpu:99 removal.
+ const opts = { ...options }
const res = await localFetchStream(ollamaUrl("/chat"), {
method: "POST",
body: JSON.stringify({ model, messages, tools, options: opts, stream: true }),
@@ -98,10 +107,11 @@ export async function chatWithTools(
tools: { type: string; function: { name: string; description: string; parameters: any } }[],
options: { temperature?: number; top_p?: number; top_k?: number; num_predict?: number } = {},
): Promise<{ content: string; tool_calls?: any[] }> {
+ // v2.4.6 Bug L: see chatStream() above — same num_gpu:99 removal.
const res = await localFetch(ollamaUrl("/chat"), {
method: "POST",
headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ model, messages, tools, options: { num_gpu: 99, ...options }, stream: false }),
+ body: JSON.stringify({ model, messages, tools, options: { ...options }, stream: false }),
})
if (!res.ok) {
try {
diff --git a/src/api/providers/ollama-provider.ts b/src/api/providers/ollama-provider.ts
index 0aaf18af..442413f8 100644
--- a/src/api/providers/ollama-provider.ts
+++ b/src/api/providers/ollama-provider.ts
@@ -77,7 +77,14 @@ export class OllamaProvider implements ProviderClient {
stream: true,
}
- const ollamaOptions: Record<string, any> = { num_gpu: 99 }
+ // v2.4.6 Bug L: dropped hardcoded `num_gpu: 99`. Old code forced ALL
+ // layers onto the GPU on every chat request, which on 8 GB laptop cards
+ // pushed the KV cache out into system RAM (nightmare13740 Discord
+ // 2026-05-18: 30 tok/s in ollama CLI vs 6.9 tok/s in LU on RTX 4070
+ // Laptop + gemma3:4b). Letting Ollama do its own VRAM-aware layer
+ // placement restores CLI parity on tight cards and is a no-op on
+ // cards with headroom.
+ const ollamaOptions: Record<string, any> = {}
if (options?.temperature !== undefined) ollamaOptions.temperature = options.temperature
if (options?.topP !== undefined) ollamaOptions.top_p = options.topP
if (options?.topK !== undefined) ollamaOptions.top_k = options.topK
@@ -150,7 +157,8 @@ export class OllamaProvider implements ProviderClient {
stream: false,
}
- const ollamaOptions: Record<string, any> = { num_gpu: 99 }
+ // v2.4.6 Bug L: see chatStream() above — same num_gpu:99 removal.
+ const ollamaOptions: Record<string, any> = {}
if (options?.temperature !== undefined) ollamaOptions.temperature = options.temperature
if (options?.topP !== undefined) ollamaOptions.top_p = options.topP
if (options?.topK !== undefined) ollamaOptions.top_k = options.topK
diff --git a/src/lib/ollama-stream-tools.ts b/src/lib/ollama-stream-tools.ts
index f9fa644a..83eca051 100644
--- a/src/lib/ollama-stream-tools.ts
+++ b/src/lib/ollama-stream-tools.ts
@@ -38,12 +38,15 @@ export async function streamOllamaChatWithTools(
return msg
})
+ // v2.4.6 Bug L: dropped hardcoded `num_gpu: 99` — see src/api/ollama.ts
+ // for the full rationale. Ollama now decides layer placement itself,
+ // which restores CLI parity on 8 GB laptop cards.
const body: Record<string, any> = {
model: modelId,
messages: ollamaMessages,
tools,
stream: true,
- options: { num_gpu: 99 },
+ options: {},
}
if (options.temperature !== undefined) body.options.temperature = options.temperature
if (options.maxTokens) body.options.num_predict = options.maxTokens