Home / use case

llama.cpp 1.0 on a handheld PC's integrated GPU: 2x faster long prompts with flash attention

At a glance
Hardware
MSI Claw 8 AI+, Intel Arc 140V sharing 32 GB with the CPU, Vulkan
Surface Laptop Ultra, NVIDIA RTX Spark N1X sharing about 128 GB, CUDA on Windows on Arm
Models & engines
llama.cpp b12123 (before 1.0.0) vs b12374 (after)
PLaMo 3 Translate 2B Q4_K_M (1.80 GB) and Gemma 4 26B-A4B Q4_0 (14.6 GB)
Key gotcha
The 2x only appears with -fa 1; if you stay on the old build, -fa 0 was faster for long prompts

What they built

maruhana compared llama.cpp builds from before and after 1.0.0 on two PCs whose CPU and GPU share memory: an MSI Claw 8 AI+ handheld with an Intel Arc 140V on Vulkan, and a Surface Laptop Ultra with an NVIDIA RTX Spark N1X on CUDA.

It is an English adaptation of their Japanese Zenn article, including a correction added after a reader's comment pushed them to re-measure with flash attention off. They also tested the MoE cache mentioned in the 1.0.0 release notes.

Setup

  • MSI Claw 8 AI+, Intel Arc 140V sharing 32 GB with the CPU, Vulkan
  • Surface Laptop Ultra, NVIDIA RTX Spark N1X sharing about 128 GB, CUDA on Windows on Arm
  • llama.cpp b12123 (before 1.0.0) vs b12374 (after)
  • PLaMo 3 Translate 2B Q4_K_M (1.80 GB) and Gemma 4 26B-A4B Q4_0 (14.6 GB)

How it works

  1. llama-bench runs in old, new, new, old order, averaged, to limit order effects
  2. The MoE cache was timed through llama-server responses, since llama-bench in this build has no option for it
  3. Experts of all 30 layers were kept in main memory with --n-cpu-moe 30 while the cache size varied, against everything on the GPU

Results & numbers

  • On the MSI, a 4,096-token prompt went from 986 to 2,005 tokens/s (+103%); 512 tokens gained 14% and generation didn't change beyond noise
  • With -fa 0 the old/new gap at 4,096 tokens was only +2%; in the old build flash attention was slower than no flash attention, in the new one faster
  • The MoE cache sped up generation 6-15% but slowed prompt processing 12-22% and used 1-2 GB more memory; full GPU offload generated 1.4-1.6x as fast and used the least memory
  • On the Surface with two MoE models fully offloaded, prompt processing gained 9-26% and generation 2-4%

Gotchas

  • The 2x only appears with -fa 1; if you stay on the old build, -fa 0 was faster for long prompts
  • A 4096 MiB MoE cache failed to start with 'failed to allocate buffer for MoE cache'
  • An Ollama model file for the same model family didn't load in llama.cpp
  • Every number is from one machine on one day, so treat it as a single data point
“putting the whole model on the GPU beat every cache size I could run.”— maruhana

Do it yourself

  1. Keep your old llama.cpp build and download a post-1.0 one
  2. Run llama-bench -ngl 99 -fa 1 -p 512 -n 128 -r 5 and -p 4096 -n 0 -r 3 on both
  3. Repeat with -fa 0 to see how much comes from flash attention
  4. For MoE models, compare --n-cpu-moe 0 against --n-cpu-moe with --moe-cache-mib before keeping the cache
llama-bench -ngl 99 -fa 1 -p 512 -n 128 -r 5
llama-bench -ngl 99 -fa 1 -p 4096 -n 0 -r 3
Source: DEV Community (maruhana) · Published 2026-11-25 · Added 2026-11-27. This write-up summarizes the original source; see it for full details.

Similar setups

Letting a coding agent tune llama.cpp on an 8 GB AMD GPU: 3x faster prompt reading for OpenCode

Cliff K had his coding agent benchmark llama.cpp backends and flags for a Qwen3.6 35B MoE on a Radeon RX 6600 XT, at the context depths OpenCode really uses, and turned the process into an open-source skill.

Cliff K (DEV Community) · 2026-11-01

Translating text in camera frames with TranslateGemma 4B in Ollama

A developer sent 1920x1080 images straight to TranslateGemma 4B in Ollama to translate English seen through XR glasses, and measured about 30 seconds per new image on a laptop CPU versus about 0.7 seconds on an NVIDIA GPU.

DEV Community (maruhana) · 2026-11-22

ge: a from-scratch Rust inference engine benchmarked against llama.cpp on a 4 GB laptop

Atharv Dusane wrote his own GGUF inference engine in Rust and compared it with llama.cpp on a Ryzen laptop with a 4 GB RTX 3050, reporting where it wins, ties and loses.

Atharv Dusane on X · 2026-11-12

Gemma 4 E2B quantization ladder on four GPUs, from a 4 GB GTX 1650 laptop to an RTX 3050

xbill ran nine quantizations of Gemma 4 E2B, BF16 down to Q2_K, through 250 GSM8K questions with llama.cpp on a 4 GB laptop GPU, an 8 GB desktop card and two cloud GPUs, and found Q5_K_M the best trade on every card.

xbill (DEV Community) · 2026-10-31