← All field notes
Inference Deployment

GGUF vs Safetensors: Choose the Right Format for Local LLM Deployment

Choose a compatible local LLM checkpoint by separating file containers, quantization, and runtimes. Reproduce an 8B weight and KV-cache budget before planning deployment.

By the ModelFit editorial team. Technical sources checked November 20, 2026. Read our methods and estimation limits.

The GGUF vs Safetensors decision starts with the software that will load the model. The extension tells you something about how weights are stored. It does not, by itself, tell you their precision, whether your runtime supports them, or how much memory generation will require.

For a supported llama.cpp workflow, a compatible GGUF release is often the direct deployment artifact. For a Transformers workflow, start with the checkpoint and quantization method that the model and your installed libraries support. Neither choice makes a model automatically smaller, faster, or more accurate.

ModelFit publishes this guide and provides the calculators linked here. The example below is a reproducible byte calculation, not a GPU benchmark or a claim that a particular card will fit your workload.

GGUF vs Safetensors: compare three separate decisions

Keep the file container, numerical representation, and execution runtime separate:

Decision What it determines What to check
Container How tensors and metadata are serialized GGUF or Safetensors, required shards, accompanying files
Quantization or dtype How numerical values are represented BF16, FP16, a specific Q4 recipe, packed INT4, FP8, scales and other state
Runtime and backend How those representations are loaded and executed Model architecture, loader version, hardware kernels, device placement, context and concurrency

A four-bit checkpoint loaded through an incompatible path may fail or expand into a dense representation. A floating-point checkpoint can sometimes be quantized during loading. Those are loader behaviors, not properties guaranteed by the filename.

What GGUF contains

The GGUF specification describes a model format used by GGML-based executors. It stores tensors alongside structured metadata, including architecture and tokenizer information. Its file-type definitions include floating-point representations such as F32 and F16 as well as quantized variants.

GGUF therefore does not mean “four-bit.” The llama.cpp quantization documentation separates conversion to GGUF from the later quantization step. A high-precision GGUF can be the input to a quantizer.

Single-file deployment is one design goal, but current GGUF conventions also allow shards. Download every required part. For multimodal models, check whether a separate encoder or projector is required. Embedded metadata also cannot supply a runtime implementation of an unsupported architecture.

What Safetensors contains

Safetensors stores named tensors with dtype, shape, and byte offsets, plus an optional string metadata map. A tensor file is not a complete architecture implementation, tokenizer, or loading recipe.

Safetensors is not restricted to unquantized weights. For example, compressed-tensors extends Safetensors storage to representations including packed INT4/INT8 and FP8, with associated scale and zero-point tensors. Loading that checkpoint requires software that understands its quantization scheme.

Avoiding pickle-style executable deserialization is a useful format property. It does not establish that arbitrary accompanying model code or every downstream workflow is safe.

Choose the artifact your runtime actually supports

Use this table as a starting point, then verify the exact model and installed versions. Documentation support is not a benchmark on your hardware.

Workflow What to verify
llama.cpp Choose compatible GGUF. Check architecture, tensor types, backend, tokenizer, chat template, and required files.
Transformers Use the repository's supported checkpoint and loader. Check configuration, tokenizer, precision, library versions, and device support.
GGUF in Transformers Check the documented loader for your architecture and whether it keeps packed weights or dequantizes them.
GGUF in vLLM Check the GGUF plugin route, runtime compatibility, experimental feature limits, base tokenizer, and configuration.

The Transformers GGUF documentation for v5.23.0 describes a packed loading path under specific kernel, architecture, and backend conditions, including Qwen3.5 support. Other architectures use a legacy path that dequantizes. Read the documentation matching your installation; neither “Transformers always expands GGUF” nor “Transformers always preserves its compressed memory footprint” is a reliable rule.

The current vLLM GGUF documentation describes an out-of-tree vllm-gguf-plugin and warns that GGUF support remains experimental and under-optimized. It recommends the base-model tokenizer and describes --hf-config-path when metadata cannot be converted automatically. Do not assume every serving feature works with every GGUF.

For a Safetensors checkpoint, inspect the repository's quantization configuration rather than selecting a loader from the extension alone. For example, Transformers bitsandbytes documentation distinguishes loading-time quantization, serialized quantized checkpoints, compute dtype, and modules that retain another dtype.

An 8B example: weight bytes are only the first budget

Assume exactly 8,000,000,000 parameters. This is a hypothetical round number, not the parameter count or revision of a named model. Assume every parameter uses the stated representation:

weight bytes = parameters × bits per parameter ÷ 8

Payload GB GiB
BF16, 16-bit 16.000 14.901161
Ideal four-bit 4.000 3.725290

Here, 1 GB = 1,000,000,000 bytes, while 1 GiB = 1,073,741,824 bytes. Changing units does not change the underlying bytes.

The four-bit row excludes scales, zero points, alignment, headers, and tensors retained at higher precision. A recipe such as Q4_K_M can mix tensor types; its file size is not simply parameter count multiplied by half a byte. The same caution applies to method-specific quantized Safetensors checkpoints.

Add KV cache separately

For an illustrative GQA architecture, assume 32 layers, eight KV heads, a head dimension of 128, 8,192 cached tokens per sequence, one concurrent sequence, and two bytes per KV element:

KV bytes = 2 × layers × KV heads × head dimension × cached tokens × concurrency × bytes per element

The first factor of two accounts for keys and values. This follows the logical accounting explained in Hugging Face's KV cache guide.

With these assumptions, KV cache is 1,073,741,824 bytes, or exactly 1 GiB. The ideal weight-plus-KV subtotals become 15.901161 GiB for BF16 and 4.725290 GiB for four-bit payloads. Weight quantization has not reduced that BF16 KV cache.

These are logical storage counts. Block allocation, cache sharing, device placement, and parallel layouts can change physical allocation. Use the KV cache calculator to explore cache inputs separately.

Reproduce the arithmetic

This Python standard-library calculation was run on November 20, 2026 with Python 3.14.6 on Darwin arm64. It does not download or load a model.

parameters = 8_000_000_000
gib = 2**30
kv_bytes = 2 * 32 * 8 * 128 * 8192 * 1 * 2

for label, bits in (("BF16", 16), ("Ideal 4-bit", 4)):
    weights = parameters * bits // 8
    print(f"{label}: {weights / 10**9:.3f} GB; "
          f"{weights / gib:.6f} GiB weights; "
          f"{(weights + kv_bytes) / gib:.6f} GiB with KV")
print(f"KV only: {kv_bytes / gib:.6f} GiB")

Output:

BF16: 16.000 GB; 14.901161 GiB weights; 15.901161 GiB with KV
Ideal 4-bit: 4.000 GB; 3.725290 GiB weights; 4.725290 GiB with KV
KV only: 1.000000 GiB

Leave workspace and peak loading memory unresolved until measured

Neither subtotal includes activations, kernel workspace, graph buffers, allocator fragmentation, framework overhead, or temporary loading and dequantization copies. We have not measured those costs for this example.

vLLM's memory guidance explicitly treats context length, sequence count, and CUDA graph memory as additional considerations. There is no universal workspace percentage that proves a model will fit.

Start with the model weight memory calculator, then use the main ModelFit calculator to build a workload estimate. The weight calculator shows raw weights separately from its recommendation, which adds packing, workspace, and operating headroom; use its raw-weight line when comparing with the table above. Validate peak memory with your actual model revision, runtime, context, and concurrency before relying on a deployment budget.

A download and loading checklist

Before downloading a different format, record:

  1. Provenance and revision. Save the source repository, exact model revision, conversion origin, license, and intended task. A filename containing “8B” is not a complete identity.
  2. Architecture and configuration. Confirm the architecture is supported by the selected runtime. For a Transformers-style directory, inspect config.json; the model loading reference distinguishes configuration from the weight state.
  3. Every required shard. For a sharded checkpoint, keep its index and all referenced weight files. For split GGUF, verify every part rather than treating the first download as the complete model.
  4. Tokenizer and prompt format. Check tokenizer assets, vocabulary, special token IDs, and the correct chat template. Follow runtime-specific advice about using the base tokenizer.
  5. Quantization metadata. Identify the exact method and recipe, group or block settings, scale/zero-point state where applicable, and any tensors left at higher precision. Check that the loader understands that scheme.
  6. Execution conditions. Record runtime/plugin versions, hardware backend, weight and compute dtypes, KV dtype, context limit, concurrency, and offload settings. Check for separate multimodal assets.
  7. A small validation workload. After loading, verify prompt formatting and representative outputs, then observe loading and generation memory at the intended workload. This guide has not performed that runtime test.

Conversion does not recover lost precision

Renaming model.safetensors to model.gguf is not conversion. A converter must understand the model's tensors, names, architecture, and required metadata. Use a converter compatible with that model and retain the original checkpoint.

Converting a floating-point checkpoint into GGUF need not itself mean four-bit quantization. Conversely, writing previously quantized values into a higher-precision representation does not recreate information discarded during quantization. Repeated quantization can also damage quality; the llama.cpp quantizer warns about requantizing already quantized tensors.

Compare the same base revision under controlled settings when evaluating quality. Format names alone cannot establish output equivalence or a speed advantage. Our quantization and VRAM guide explains the separate precision decision.

Frequently asked questions

Is GGUF always smaller than Safetensors?

No. Compare parameter count, tensor precision, quantization recipe, retained tensors, and metadata. A floating-point GGUF can be larger than a quantized Safetensors checkpoint.

Does a 4 GB model file need only 4 GB of VRAM?

No. Loading behavior, KV cache, workspace, activations, and other allocations contribute to memory. Some weights may remain on CPU; another loader may dequantize them. File bytes are not a peak VRAM measurement.

Can Safetensors hold a four-bit model?

Yes, with an appropriate representation and compatible loading software. Packed tensor data and associated quantization state still need the correct method-specific loader.

Which format should I download first?

Choose the runtime and supported architecture first, then select its compatible artifact and precision. For GGUF vs Safetensors, the useful final comparison is the complete loading configuration. Estimate weights, add cache and runtime costs, and verify the result on the deployment you intend to use.

Continue planning

Test the model against real GPU memory.

Open the VRAM calculator →