Models & Algorithms•SOTAAZ Lab••KR

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).

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 (Unsloth GGUF, from Thinking Machines Lab) 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).

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, 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

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 & -ubCUDA0 compute: op on / off (MiB)Increase (MiB)Loop 6-17 experts (MiB)
Q2 -ub 1284,526.0 / 443.84,0824,031
Q2 -ub 5125,838.1 / 1,775.74,0624,031
Q3 -ub 1287,032.0 / 443.86,5886,447
Q4 -ub 1287,148.4 / 443.86,7056,564
Q2 -ub 128 VRAM across --n-cpu-moe N=9 to 21 and CUDA0 compute buffer with op offload on vs off

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

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 & -ubPlacementOpLayersVRAM (MiB)Prompt tok/sDecode tok/s
Q2 128OuterOn107,552465.826.99
Q2 128FrontOn217,664354.115.29
Q2 128OuterOff107,496331.626.86
Q2 128FrontOff107,446214.321.58
Q2 512OuterOff147,540312.022.50
Q2 512FrontOff147,496201.518.42
Q3 128OuterOff167,154196.823.68
Q3 128FrontOff147,642155.421.35
Q4 128OuterOff167,372226.425.17
Q4 128FrontOff207,122150.318.89
Outer-first vs front-first decode tok/s across fitting configs with full-GPU Q2 42.6 and Q4 41.3 lines

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 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

We ran the four Python tasks from our previous post (-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):

Task8 GB Q4 scores8 GB Q4 time (s)Full-GPU Q4 scoresFull-GPU Q4 time (s)
T11.0/1.0/1.0296/243/3621.0 ×3169/193/173
T21.0/1.0/1.0104/91/1401.0 ×364/71/68
T31.0/1.0/1.0414/741/4461.0 ×3282/616/242
T4 (60-min 8 GB)1.0/1.0/0.01,919/3,008/3,600 (timeout)1.0 ×31,357/1,800/1,343
12-run mean0.917 (11/12 done)1.000 (11/12 done)
Per-run wall times across T1 to T4 comparing 8 GB Q4 (60-minute T4 cap) vs full-GPU Q4

Three 60-minute T4 runs:

T4 runScoreTime (s)DoneDecode tokensStepsCutoffsDecode tok/sPrompt tok/s
r11.0 (10/10)1,919Yes41,94611223.8206.5
r21.0 (10/10)3,008Yes52,53017221.5142.9
r30.0 (0/10)3,600No43,8169314.8141.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.

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 on blk.24), and read /v1/chat/completions thinking text from reasoning_content:

bash
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.