This is just to get the initial data out, I will update this post over time.

# Local ~120B MoE Inference (`Qwen3.8-Flash-Next`) at 80k Context on a 12 GB RTX 3060

This recipe runs **Qwen3.8-Flash-Next (`UD-Q2_K_XL` + `Q8_0` MTP head)** locally on Windows using **Colibrì (`v2.1.0+`)** with Vulkan, Resizable BAR PCIe expert streaming, and Multi-Token Prediction (MTP) speculative decoding.

## Hardware & Performance Profile

* **GPU:** NVIDIA GeForce RTX 3060 (12 GB GDDR6, 9 GiB Host-Visible Resizable BAR Heap)
* **System RAM:** 64 GB DDR4/DDR5 (`63.2 GB` usable)
* **Context Window:** **81,920 tokens (80k)**
* **Sustained Throughput:** **~9–11 tokens/sec** (**~2.4–2.9 tokens/forward** via MTP speculative decoding, 70–95% draft acceptance)
* **PCIe Streaming Bandwidth:** **~14.3–15.4 GB/s** (23+ TiB cumulative host-pool transfers tested across 20+ turn marathon sessions with zero `VK_ERROR_DEVICE_LOST` resets)

### 3-Tier Heterogeneous Memory Architecture
1. **Tier 1 — Hot GPU Resident Core (`~10.8–11.4 GB` physical VRAM / `~6.0 GiB` mapped BAR):**
   * All 48 dense layers + router matrices + Q8_0 MTP draft head + 80k KV cache + **312 hottest routed experts** (`~800 MiB`) + **64 streaming slots**.
   * Handles ~66–75% of all routed expert evaluations directly on the RTX 3060 with **77% of GPU compute hidden** behind async overlap.
2. **Tier 2 — Resizable BAR Warm RAM Pool (`26.00 GiB` System RAM):**
   * Holds **~12,480 warm experts** in system RAM that the GPU reads directly over PCIe via host-visible BAR memory at **~14.5 GB/s** without CPU round-trips.
3. **Tier 3 — NVMe Cold Tier (`read in place` GGUF):**
   * Memory-maps remaining cold experts directly from NVMe (`<0.02%` disk miss rate after initial warm-up).

---

## Step 0: Download the ~120B Qwen3.8 Model Files

Install the Hugging Face CLI and pull **only** the `UD-Q2_K_XL` shards and the `Q8_0` MTP draft head:

```powershell
pip install -U "huggingface_hub[cli]"

# 1. Download the 4-part UD-Q2_K_XL quant
hf download unsloth/Qwen3.8-Flash-Next-GGUF `
  --include "UD-Q2_K_XL/*" `
  --local-dir "$env:USERPROFILE\colibri-models\Qwen3.8-Flash-Next"

# 2. Download the Q8_0 MTP draft head and move it alongside the model shards
hf download unsloth/Qwen3.8-Flash-Next-GGUF `
  --include "MTP/mtp-Qwen3.8-Flash-Next-Q8_0.gguf" `
  --local-dir "$env:USERPROFILE\colibri-models\Qwen3.8-Flash-Next"

Move-Item "$env:USERPROFILE\colibri-models\Qwen3.8-Flash-Next\MTP\mtp-Qwen3.8-Flash-Next-Q8_0.gguf" `
          "\$env:USERPROFILE\colibri-models\Qwen3.8-Flash-Next\UD-Q2_K_XL\"
Remove-Item "\$env:USERPROFILE\colibri-models\Qwen3.8-Flash-Next\MTP"
```

> **Note on `.colibri` bundle:** Point `coli` at the `UD-Q2_K_XL` directory (or let Colibrì create `Qwen3.8-Flash-Next-UD-Q2_K_XL.colibri` containing `tokenizer.json` on initial setup).

---

## Step 1: Motherboard BIOS Settings (ASUS / UEFI)

Enable full 9 GiB host-visible BAR mapping so Vulkan can stream experts directly from system RAM into VRAM over PCIe:

* **Above 4G Decoding:** `Enabled`
* **Re-Size BAR Support:** `Auto` (or `Enabled`)
* **CSM (Compatibility Support Module):** `Disabled`

---

## Step 2: Windows WDDM Driver & Registry Tuning

On Windows 11 with NVIDIA RTX 30-series GPUs, two default WDDM behaviors cause `VK_ERROR_DEVICE_LOST` during large multi-thousand-token prompt prefills over host-visible BAR memory:
1. **Hardware-Accelerated GPU Scheduling (HAGS)** aggressively resets stalled PCIe/BAR submissions.
2. **WDDM TDR (`TdrDelay`)** defaults to 2 seconds, killing long prompt-prefill chunks.

Open **PowerShell as Administrator**, run the following commands, and **reboot Windows**:

```powershell
# Disable Hardware-Accelerated GPU Scheduling (HwSchMode = 1)
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" -Name "HwSchMode" -Value 1 -Type DWord

# Increase WDDM Timeout Detection & Recovery (TDR) delay to 30 seconds
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" -Name "TdrDelay" -Value 30 -PropertyType DWord -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" -Name "TdrDdiDelay" -Value 30 -PropertyType DWord -Force
```

Verify after rebooting with:
```powershell
Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers"
# Confirm: HwSchMode = 1, TdrDelay = 30, TdrDdiDelay = 30
```

---

## Step 3: Colibrì `setup.json` Configuration

### Why Each Key Setting Matters
* `"COLI_VK_DENSE_HOST": "1"`: Mirrors dense weights in host RAM so mapped BAR VRAM isn't bloated by duplicate staging buffers.
* `"COLI_VK_CHAIN_ROWS": "128"`: Caps Vulkan prompt-prefill chunks to 128 rows (`~134 MiB` scratchpad per step instead of 256–768 rows), preventing peak BAR spikes during 50k+ token file ingestions.
* `"COLI_VK_TIER_GB": "0.8"`: Reserves `819.2 MiB` for the top **312 hot GPU experts + 64 streaming slots** while leaving **~2.5+ GiB of mapped BAR headroom** for the 80k KV cache.
* `"COLI_VK_TIER_RESERVE_GB": "1.2"`: Protects `1.20 GiB` of VRAM for Windows DWM, IDE GPU acceleration, and prompt chunk overhead.
* `"COLI_VK_TIER_HOST_GB": "26"`: Allocates `26.00 GiB` (~12,480 warm experts) for the PCIe host pool while leaving Windows ~11+ GB of free system RAM so pages are never compressed or swapped.
* `"Q38_MTP": "1"`: Enables the Q8_0 Multi-Token Prediction speculative draft head (~2.4–2.9 tokens/forward).
* `"--ctx", "81920"` & `"--gpu", "none"`: Sets the 80k context window and suppresses CUDA planner warnings while `COLI_VULKAN=1` drives the RTX 3060.

### Complete `setup.json`
*(Replace `<YOUR_USER>` with your Windows username—JSON requires full escaped `\\` paths rather than `$env:USERPROFILE`.)*

```json
{
  "status": "ready",
  "model": {
    "id": null,
    "name": "Qwen3.8-Flash-Next",
    "repo": null,
    "revision": null
  },
  "model_dir": "C:\\Users\\<YOUR_USER>\\colibri-models\\Qwen3.8-Flash-Next\\UD-Q2_K_XL\\Qwen3.8-Flash-Next-UD-Q2_K_XL.colibri",
  "family": "qwen38",
  "launcher": "C:\\Users\\<YOUR_USER>\\colibri-v2.1.0-windows-x86_64\\coli",
  "engine": "C:\\Users\\<YOUR_USER>\\colibri-v2.1.0-windows-x86_64\\qwen38.exe",
  "engine_source": "present",
  "backend": "vulkan",
  "gpu": "NVIDIA GeForce RTX 3060",
  "env": {
    "COLI_VULKAN": "1",
    "COLI_VK_SHADERS": "C:\\Users\\<YOUR_USER>\\colibri-v2.1.0-windows-x86_64\\shaders",
    "COLI_CUDA": "0",
    "Q38_MTP": "1",
    "COLI_VK_DENSE_HOST": "1",
    "COLI_VK_CHAIN_ROWS": "128",
    "COLI_VK_TIER_GB": "0.8",
    "COLI_VK_TIER_RESERVE_GB": "1.2",
    "COLI_VK_TIER_HOST_GB": "26"
  },
  "args": [
    "serve",
    "--model",
    "C:\\Users\\<YOUR_USER>\\colibri-models\\Qwen3.8-Flash-Next\\UD-Q2_K_XL\\Qwen3.8-Flash-Next-UD-Q2_K_XL.colibri",
    "--host",
    "0.0.0.0",
    "--port",
    "8000",
    "--auto-tier",
    "--allowed-host",
    "*",
    "--ctx",
    "81920",
    "--gpu",
    "none"
  ],
  "ctx": 0,
  "host": "0.0.0.0",
  "port": 8000,
  "urls": {
    "browser": "http://127.0.0",
    "openai_base_url": "http://127.0.0v1",
    "anthropic_base_url": "http://127.0.0.1:8000"
  },
  "requested_backend": "vulkan",
  "gpu_pending": [],
  "nvidia": [
    {
      "name": "NVIDIA GeForce RTX 3060",
      "compute_cap": "8.6"
    }
  ],
  "failed_builds": [],
  "version": 1
}
```

---

## Step 4: Client Best Practices (Continue / OpenAI-Compatible IDEs)

* **Align Client Context Length:** Set `contextLength: 81920` in your IDE client config to match `--ctx 81920`.
* **Batch File Context Up Front:** Tag key project files in your initial prompt (`@file1 @file2 ...`) rather than letting agent mode read 10+ files one turn at a time.
* **Compact Around ~85–90% Context:** Run `/compact` when context reaches ~70k–74k tokens (or if physical VRAM in Task Manager reaches `~11.6 / 12.0 GB`) to summarize history cleanly without hitting the 12 GB physical ceiling.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.