chapter ten

10 Running on CPUs and Using GGUF

 

This chapter covers

  • Deciding when CPU inference wins on cost
  • Reading the GGUF format and its quantization families
  • Converting Hugging Face checkpoints to quantized GGUF
  • Comparing AVX-2, AVX-512, and AMX kernels
  • Diagnosing throughput loss from build flags and threads

We just worked through server-class deployment on x86 and NVIDIA silicon—ONNX Runtime, TensorRT, and OpenVINO—and deferred one large regime to this chapter: CPU-first LLM inference through llama.cpp and the GGUF file format.

That deferral was deliberate.

GGUF does not round-trip through ONNX. Its K-quant and IQ-quant weight schemes do not map onto operator-level INT8 dispatch. The runtime that consumes a GGUF file is a single-binary C++ inference engine, not a graph executor with execution providers. The file format, the runtime, and the operational surface are all different, but the end goal is getting low-precision compute to actually execute on the target hardware.

The following lesson is for the platform team shipping LLM inference without a GPU, for cost, for fleet bin-packing, or because the deployment target has no GPU at all. The failure mode to FP32 fallback is throughput left on the table. A wrong quantization choice, an AMX build flag for batch-1 decode, or a thread count copied from a bare-metal recommendation onto a cloud VM each costs 10–30% of what the silicon can deliver, with no error in any log.

10.1 Know when CPU wins on cost and scale-out

10.2 Understand the GGUF format and its variants

10.2.1 Three quant families, three generations

10.2.2 Four sections of the GGUF file

10.2.3 Metadata makes the file self-describing

10.2.4 The packing is not uniform

10.2.5 Inside one block: from bytes to a weight

10.3 Convert large language models to CPU-friendly artifacts

10.3.1 The pipeline at a glance

10.3.2 F16 export and the four quantization runs

10.3.3 The imatrix is the IQ-quant prerequisite

10.3.4 Verify size, perplexity, fluency, and decode throughput

10.4 Compare kernel families and what they imply

10.4.1 Three builds, one CPU

10.4.2 Inside one Q4_K dot product

10.4.3 Decode throughput across the matrix

10.4.4 The IQ4_XS / Q4_K_M crossover

10.4.5 What to ship

10.5 Set realistic expectations for throughput and memory

10.5.1 Runtime memory: weights, KV cache, and compute buffer

10.5.2 Thread count and the cloud-CPU exception

10.6 Summary