# Fitting Inkling 2 Mini Q4_K_XL Into an 8 GB VRAM Budget With Outer-Layer CPU Offload

> Source: <https://sotaaz.com/post/inkling-8gb-gpu-fit-en>
> Published: 2026-11-25 06:02:16+00:00

**Recommendation:** When offloading MoE layers to CPU, pass --no-op-offload and offload outer layers before loop layers; the source measured CUDA0 compute fixed at 443.8 MiB and 25.17 tok/s decode.
More in the playbook "Inference and self-hosting": <https://wpnews.pro/playbooks/inference-serving>

# Fitting Inkling 2 Mini Q4_K_XL Into an 8 GB VRAM Budget With Outer-Layer CPU Offload

Inkling 2 Mini UD-Q4_K_XL fits a 7,664 MiB 8 GB budget at 16K via 16 outer-first CPU MoE layers, -ub 128, and --no-op-offload (7,372 MiB after prompt, 25.17 tok/s decode on A100 + EPYC 7742, 0.917 across 12 coding runs with a 60-minute T4 cap vs 30 minutes full-GPU).

Inkling 2 Mini `UD-Q4_K_XL` ([Unsloth GGUF](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF), from [Thinking Machines Lab](https://huggingface.co/thinkingmachines/Inkling-2-Mini)) fits an 8 GB VRAM budget (`7,664 MiB`) at 16K context via `16` outer-first CPU MoE layers, `-ub 128`, and `--no-op-offload`. Post-prompt VRAM is **` 7,372 MiB` at `25.17 tok/s` decode**; four Python tasks finished `11/12` runs for `0.917` mean with a `60`-minute cap on the longest task, T4 (vs `1.000` full-GPU with a `30`-minute cap in our [previous post](https://sotaaz.com/post/inkling-2-mini-gpu-fit-en)).

These runs used an A100 80GB without a hardware memory limit, not a physical 8 GB card; fit means process VRAM after a `15,872`-token prompt stayed `≤ 7,664 MiB` (`8 × 1,024 − 512 − 16 MiB`). All `tok/s` speeds reflect our A100 80GB + 8-channel DDR4 EPYC 7742 server (`64` threads, solo GPU, `llama.cpp b12611`, `-c 16384`, f16 KV; `256`-token decode, temp `0`, seed `1`).

In our [previous post](https://sotaaz.com/post/inkling-2-mini-gpu-fit-en), `UD-Q2_K_XL` exceeded 8 GB on GPU (`8,469.3 MiB` CUDA model buffer). Fitting `7,664 MiB` depends on four pieces:

- Loop layers: `24` MoE layers (`0-23` ,`128` experts,`8` active); outer layers (`0-5` ,`18-23` ) run once per token, loop layers (`6-17` )`3` times (`48` visits).
- Expert offload: attention, KV, and routing stay on GPU; chosen experts move to RAM (`--n-cpu-moe` or`-ot` ).
- Op offload (`--no-op-offload` ):`llama.cpp` defaults to offloading host tensor operations to the device;`--no-op-offload` turns that off.
- `-ub` (micro-batch size): a smaller value shrinks the CUDA compute buffer (`4x` smaller from`512` to`128` with`--no-op-offload` ), freeing VRAM for weights.

We tested `UD-Q2_K_XL`, `UD-Q3_K_XL`, and `UD-Q4_K_XL` at `-c 16384` (f16 KV) across front-first (`--n-cpu-moe N`, `0..N-1`) and outer-first (`-ot` on `0-5`, `23..18`, then smallest loop layers), op offload on and off.

### Offloading loop layers fails to free VRAM under default op offload[#](#offloading-loop-layers-fails-to-free-vram-under-default-op-offload)

With op offload on, moving outer layers (`0-5`, `18-23`) lowers VRAM, while moving loop layers (` 6-17`) grows CUDA0 compute by roughly their GGUF expert size. On `Q2 -ub 128` under `--n-cpu-moe N`, **VRAM stayed flat at `8,828-8,832 MiB` from `N = 9` to `18`** as the CUDA0 model buffer fell from `6,095` to `3,002 MiB`.

Hence `Q2 -ub 512`, `Q3 -ub 128`, and `Q4 -ub 128` missed `7,664 MiB` even at `24` CPU layers (`8,046`, `9,374`, and `9,708 MiB` at `24` layers). Only `Q2 -ub 128` fit under op offload: `10` outer layers (`0-5`, `20-23`) at `7,552 MiB`, or front-first `N = 21` at `7,664 MiB`.

Startup buffer logs confirm this at `-c 16384` (f16 KV). With op offload on, runs that put all `12` loop layers (`6-17`) on CPU had the compute buffer below; with `--no-op-offload`, every run had the same compute buffer regardless of which layers moved. The gap is close to the loop expert sum:

| Quant & `-ub` | CUDA0 compute: op on / off (MiB) | Increase (MiB) | Loop `6-17` experts (MiB) | 
|---|---|---|---|
| `Q2 -ub 128` | 4,526.0 / 443.8 | 4,082 | 4,031 | 
| `Q2 -ub 512` | 5,838.1 / 1,775.7 | 4,062 | 4,031 | 
| `Q3 -ub 128` | 7,032.0 / 443.8 | 6,588 | 6,447 | 
| `Q4 -ub 128` | 7,148.4 / 443.8 | 6,705 | 6,564 | 

Passing `--no-op-offload` fixes CUDA0 compute at `443.8 MiB` (`-ub 128`) or `1,775.7 MiB` (`-ub 512`), letting `Q2`, `Q3`, and `Q4` clear `7,664 MiB`.

### With --no-op-offload, outer-first decodes 1.11x to 1.33x faster than front-first[#](#with-no-op-offload-outer-first-decodes-111x-to-133x-faster-than-front-first)

Outer layers run once per token while loop layers run three times, so GPU loop layers cut CPU reads. Front-first (`--n-cpu-moe N`) touches loop layers past `N = 6`; outer-first (`-ot`) fills all `12` outer slots first.

Minimum CPU layers staying `≤ 7,664 MiB` after the `15,872`-token prompt:

| Quant & `-ub` | Placement | Op | Layers | VRAM (MiB) | Prompt tok/s | Decode tok/s | 
|---|---|---|---|---|---|---|
| `Q2 128` | Outer | On | 10 | 7,552 | 465.8 | 26.99 | 
| `Q2 128` | Front | On | 21 | 7,664 | 354.1 | 15.29 | 
| `Q2 128` | Outer | Off | 10 | 7,496 | 331.6 | 26.86 | 
| `Q2 128` | Front | Off | 10 | 7,446 | 214.3 | 21.58 | 
| `Q2 512` | Outer | Off | 14 | 7,540 | 312.0 | 22.50 | 
| `Q2 512` | Front | Off | 14 | 7,496 | 201.5 | 18.42 | 
| `Q3 128` | Outer | Off | 16 | 7,154 | 196.8 | 23.68 | 
| `Q3 128` | Front | Off | 14 | 7,642 | 155.4 | 21.35 | 
| `Q4 128` | Outer | Off | 16 | 7,372 | 226.4 | 25.17 | 
| `Q4 128` | Front | Off | 20 | 7,122 | 150.3 | 18.89 | 

**With `--no-op-offload` enabled, outer-first decoded `1.11x` to `1.33x` faster than front-first** (`1.33x` Q4 128, `1.24x` Q2 128, `1.22x` Q2 512, `1.11x` Q3 128), and on `Q2 128` op-on it beat front-first (`26.99` vs `15.29 tok/s`).

Each row sits one layer above overflow (`Q4` outer at `15` layers hits `7,920 MiB`). `Q4` outer needs `16` layers vs `20` because layers `20-23` hold `1,033 MiB` of experts each vs `547 MiB` in `0-19`, keeping `8` loop layers (`10-17`) on GPU vs `0` in front-first (`0-19`).

All 8 GB runs decode slower than full-GPU A100 (median decode during the coding runs of our [previous post](https://sotaaz.com/post/inkling-2-mini-gpu-fit-en) at `-ub 512`: `42.6` Q2, `41.3 tok/s` Q4), and `--no-op-offload` cuts prompt speed: on `Q2 128` outer `10`, decode held (` 26.99` vs `26.86 tok/s`) while prompt fell from `465.8` to `331.6 tok/s`.

Using `Σ(offloaded expert bytes × visits) × 8/128`, `Q4` outer-first reads about `942 MiB` of CPU experts per generated token vs about `713 MiB` for `Q3` outer-first, yet `Q4` decoded faster (`25.17` vs `23.68 tok/s`).

### Coding tasks: 11 of 12 runs completed (0.917 mean) with a 60-minute cap on T4[#](#coding-tasks-11-of-12-runs-completed-0917-mean-with-a-60-minute-cap-on-t4)

We ran the four Python tasks from our [previous post](https://sotaaz.com/post/inkling-2-mini-gpu-fit-en) (`-c 16384`, `Q4 -ub 128`, `--no-op-offload`, `16` outer-first CPU layers `0-5`, `18-23`, `6-9`, `3` runs each): T1 adds todo due dates (`6` hidden tests; visible pass initially), T2 fixes a misleading traceback (`8`), T3 adds two-file stock reservations (` 8`; visible pass initially), and T4 writes a semver parser (` 10`). Score is hidden tests passed over total, tracked with `done`. Peak VRAM stayed at `7,446 MiB` (solo GPU).

Under the `30`-minute (` 1,800`-second) full-GPU cap, T1-T3 passed `9/9` runs while all three T4 runs timed out without `done`, scoring `0.4`, `1.0`, and `0.0` (`0.867` mean over `12` runs at `30` minutes). During those three T4 runs, 8 GB ran at `21.8-23.0` decode and `157-197 tok/s` prompt (vs `33.3-41.2` and `683-735` full-GPU Q4). Thus `30` minutes on T4 yielded `38,736`, `34,299`, and `29,275` tokens, below `43,078` and `53,016` on self-finished full-GPU runs (`67,561` on the remaining run, `r2`, also `1,800` s). We re-ran T4 with a `60`-minute (` 3,600`-second) cap.

Combining `30`-minute T1-T3 and `60`-minute T4 runs yields **` 11` of `12` completed runs for a `0.917` mean** (full-GPU Q4 at `-ub 512` with a `30`-minute cap: `1.000`, `11/12` `done`, T4 `r2` passing `10/10` at `1,800` s):

| Task | 8 GB Q4 scores | 8 GB Q4 time (s) | Full-GPU Q4 scores | Full-GPU Q4 time (s) | 
|---|---|---|---|---|
| T1 | 1.0/1.0/1.0 | 296/243/362 | 1.0 ×3 | 169/193/173 | 
| T2 | 1.0/1.0/1.0 | 104/91/140 | 1.0 ×3 | 64/71/68 | 
| T3 | 1.0/1.0/1.0 | 414/741/446 | 1.0 ×3 | 282/616/242 | 
| T4 (60-min 8 GB) | 1.0/1.0/0.0 | 1,919/3,008/3,600 (timeout) | 1.0 ×3 | 1,357/1,800/1,343 | 
| 12-run mean | 0.917 (11/12 done) |  | 1.000 (11/12 done) |  | 

Three `60`-minute T4 runs:

| T4 run | Score | Time (s) | Done | Decode tokens | Steps | Cutoffs | Decode tok/s | Prompt tok/s | 
|---|---|---|---|---|---|---|---|---|
| `r1` | 1.0 (10/10) | 1,919 | Yes | 41,946 | 11 | 2 | 23.8 | 206.5 | 
| `r2` | 1.0 (10/10) | 3,008 | Yes | 52,530 | 17 | 2 | 21.5 | 142.9 | 
| `r3` | 0.0 (0/10) | 3,600 | No | 43,816 | 9 | 3 | 14.8 | 141.7 | 

Steps count agent reply requests to the model, and cutoffs count replies that ran until the `16,384`-token context was full (full-GPU T4: `22/25/13` steps, `2/2/2` cutoffs; 30-minute 8 GB T4: `15/18/7`, `2/5/2`). Runs `r1` and `r2` decoded about as many tokens (`41,946` and `52,530`) as the self-finished full-GPU runs (` 43,078` and `53,016`); `r3` read only `README`, `semver.py`, and `test_semver.py` without editing any file.

### Recommended 8 GB setup and launch command[#](#recommended-8-gb-setup-and-launch-command)

For an 8 GB budget at 16K context (judged as `≤ 7,664 MiB` on an A100 80GB), we recommend **`Inkling-2-Mini-UD-Q4_K_XL.gguf`** with `-c 16384`, `-ub 128`, `--no-op-offload`, and `16` outer-first CPU layers (`0-5`, `18-23`, `6-9`), reaching `7,372 MiB` post-prompt (`7,446 MiB` coding peak), `25.17 tok/s` decode, and `0.917` across `12` coding runs (`60`-minute T4 cap) on our 8-channel DDR4 EPYC 7742 (` 64` threads) server.

Use `llama.cpp b12611` or newer with the top-level file downloaded after 14:54 UTC on Nov 23 (see our [previous post](https://sotaaz.com/post/inkling-2-mini-gpu-fit-en) on `blk.24`), and read `/v1/chat/completions` thinking text from `reasoning_content`:

```
hf download unsloth/Inkling-2-Mini-GGUF Inkling-2-Mini-UD-Q4_K_XL.gguf --local-dir models

llama-server \
  -m models/Inkling-2-Mini-UD-Q4_K_XL.gguf \
  -c 16384 -ub 128 -ngl 99 -fa on --parallel 1 --jinja --no-webui \
  --no-op-offload \
  -ot 'blk\.(0|1|2|3|4|5|23|22|21|20|19|18|6|7|8|9)\.ffn_(gate_up|down)_exps\.=CPU' \
  --port 8080
```

Check free VRAM with `nvidia-smi --query-gpu=memory.free --format=csv` before long runs. If prompt speed matters more than Q4 precision, run our measured alternative: `UD-Q2_K_XL`, `-ub 128`, op offload on (omit `--no-op-offload`), and `10` outer layers (`0-5`, `20-23`, no loop layers) offloaded (` 7,552 MiB` post-prompt, `465.8 tok/s` prompt, `26.99 tok/s` decode).

The newsletter below sends the next episode of this series when it is out.
