Dev tools

GGUF vs Safetensors vs MLX: Model Formats Explained

GGUF vs safetensors vs MLX: which AI model file format to use for Ollama, LM Studio, vLLM, ComfyUI or a Mac, how quantised files are named, and converting.

By OmniAI Editorial · Nov 20, 2026 · 12 min read

The difference in GGUF vs safetensors is what each file is for. Safetensors is the standard, safe way to store a model's raw weights, used by Hugging Face Transformers, vLLM, Diffusers and ComfyUI; a model is usually published first in safetensors, often split across several files with separate config and tokenizer files. GGUF is a single-file format from the llama.cpp project that packs the weights (usually quantised), tokenizer and settings together for local apps like Ollama and LM Studio. MLX isn't a separate file type so much as Apple's framework for Macs, whose models are stored as safetensors files in a layout MLX reads directly. Pick the format your software expects: GGUF for llama.cpp-based local tools, safetensors for Python and GPU serving, MLX on Apple Silicon.

This guide explains each format, compares GGUF vs safetensors vs MLX, covers safetensors vs pickle, GGUF vs safetensors in ComfyUI, MLX vs GGUF on a Mac, GGUF vs AWQ vs GPTQ, how to read model file names, and how to convert between formats.

GGUF vs Safetensors vs MLX at a Glance

SafetensorsGGUFMLX
Made byHugging Facellama.cpp / ggml projectApple (framework)
What's in the fileTensors plus a small metadata headerTensors, tokenizer, chat template and model settings in one fileSafetensors weights plus a config file
Single file?Often split into several shardsYes (large models can be split into parts)A folder of files
QuantisationPossible (GPTQ, AWQ, FP8, bitsandbytes), less flexibleBuilt in: many levels from 2-bit to 8-bit4-bit, 8-bit and others via MLX
Runs onAnything with PyTorch or a compatible runtimeCPU and most GPUs via llama.cppApple Silicon Macs only
Main toolsTransformers, vLLM, SGLang, Diffusers, ComfyUIllama.cpp, Ollama, LM Studio, Jan, other local appsMLX-LM, LM Studio on Mac
Best forTraining, fine-tuning, GPU serving, image modelsEasy local inference, CPU and mixed hardwareFast local inference on Macs

What Is Safetensors?

Safetensors is a file format created by Hugging Face to store model weights safely and quickly. A .safetensors file has a small JSON header describing each tensor (name, shape, data type) followed by the raw numbers. Hugging Face's description is that it uses a restricted loading process that prevents code execution.

Key properties:

  • Safe: loading a safetensors file can't run hidden code (see below).
  • Fast: weights can be memory-mapped and loaded lazily, so big models open quickly and you can load just part of a model.
  • Language-neutral: readers exist for Python, Rust, JavaScript and more.
  • The default on Hugging Face: most new models are published as safetensors, often sharded into files like model-00001-of-00004.safetensors, with config.json, tokenizer files and a chat template alongside.

A safetensors model is usually full precision (16-bit) unless its name says otherwise, so it's large: about 2 bytes per parameter, or roughly 16 GB for an 8B model.

Safetensors vs Pickle

Safetensors vs pickle is about security. Older PyTorch model files (.bin, .pt, .pth, .ckpt) were saved with Python's pickle module, which can store any Python object, including code that runs when the file is loaded. As Hugging Face's format guide puts it, anything can be pickled, including malicious code. A tampered model file could run commands on your computer the moment you open it.

Safetensors stores only data, so loading one can't execute code. That's why:

  • Hugging Face and most tools now prefer safetensors.
  • Recent PyTorch versions default torch.load to a safer weights-only mode.
  • You should prefer safetensors (or GGUF) downloads and be careful with .bin, .pt and .ckpt files from sources you don't trust.
On the left a single orange document sheet with ink lines, a dotted ink divider, and on the right a light folder holding three small grey sheets and a grey bar.
GGUF packs everything into one file; safetensors models usually come as a folder of shards and config files.

What Is GGUF?

GGUF is the model format of llama.cpp, introduced in August 2023 to replace the older GGML format. A GGUF file contains:

  • Metadata: the architecture, context length, tokenizer, chat template and other settings.
  • Tensor information and data: the weights, usually quantised.

Because everything is in one file, a GGUF model "just works" in tools built on llama.cpp, such as Ollama, LM Studio and Jan. The format supports memory-mapping for fast loading and a wide range of quantisation levels, and runs on CPUs, Apple Silicon and most GPUs.

GGUF quantisation names

GGUF files are usually named with their quantisation type:

NameApproximate bits per weightTypical use
F16 / BF1616Full quality; the source for other quants
Q8_08Near-lossless; large
Q6_KAbout 6.5Very close to full quality
Q5_K_MAbout 5.7High quality, moderate size
Q4_K_MAbout 4.8The common default: good balance of size and quality
IQ3, Q3_K variantsAbout 3–3.5Squeezing bigger models onto smaller hardware
IQ2, Q2_K variantsAbout 2–2.6Noticeable quality loss; last resort

"K" quants use smarter block-wise scaling; "IQ" quants use newer methods that keep more quality at very low bit rates. Our guide to LLM quantization explains how much quality each level costs.

What Is MLX?

MLX is Apple's open-source machine-learning framework for Apple Silicon, released in December 2023. It's built for the Mac's unified memory, where CPU and GPU share one pool. MLX models are usually stored as safetensors files plus a config, often quantised to 4-bit or 8-bit, and published by the community on Hugging Face (for example under the mlx-community organisation).

MLX models run only on Apple Silicon. You use them through the mlx-lm Python package or apps such as LM Studio on a Mac.

MLX vs GGUF on a Mac

MLX vs GGUF is the main choice for Mac users, because both run well on Apple Silicon:

  • Speed: MLX is often reported to generate tokens faster than GGUF on the same Mac at the same quantisation level, since it's built specifically for Apple's hardware. Results vary by model and version, so test both.
  • Compatibility: GGUF works across Mac, Windows and Linux, and in more apps. MLX is Mac-only.
  • Model availability: GGUF versions of new models usually appear very quickly; MLX versions are also common for popular models.
  • Tools: LM Studio runs both, so you can compare on your own machine. Ollama uses GGUF.

Practical rule: on a Mac with LM Studio, try the MLX version first and keep GGUF as the fallback. Our Ollama vs LM Studio comparison covers the apps.

GGUF vs Safetensors in ComfyUI

The GGUF vs safetensors ComfyUI question matters for image and video models:

  • Safetensors is ComfyUI's standard format for checkpoints, LoRAs, VAEs and text encoders. Full-precision and FP8 safetensors files usually give the best speed on GPUs with enough VRAM.
  • GGUF versions of large image and video models, such as Flux and Wan, are available through community custom nodes. They use quantisation (for example Q8, Q5 or Q4) to fit large models on GPUs with less VRAM.
  • Trade-off: GGUF lets a 12–16 GB GPU run models that otherwise wouldn't fit, at some cost in speed and quality, especially at 4-bit and below. If your GPU has enough memory, safetensors (FP16 or FP8) is usually faster.

LoRAs are typically still loaded as safetensors files alongside a GGUF base model.

A tall grey document sheet with ink lines, an ink arrow into a light funnel, and another ink arrow out to a smaller orange document sheet.
Converting a full-precision model into a smaller quantised file trades a little quality for a lot of memory.

GGUF vs AWQ vs GPTQ and Other Formats

GGUF vs AWQ vs GPTQ is a question of which software and hardware you're targeting:

FormatWhat it isUsed by
GGUFSingle-file format with built-in quantisationllama.cpp, Ollama, LM Studio, local apps
GPTQGPU quantisation method, stored in safetensorsvLLM, Transformers, other GPU servers
AWQActivation-aware GPU quantisation, stored in safetensorsvLLM, Transformers, other GPU servers
FP88-bit floating point weights for newer GPUsvLLM, SGLang, TensorRT-LLM, ComfyUI
EXL2 / EXL3Flexible GPU quantisation for the ExLlama runtimeExLlama and apps built on it
MXFP4 and other 4-bit floatsNewer 4-bit floating-point formats some models ship inRecent GPU runtimes and llama.cpp
ONNXFormat with weights plus the computation graphONNX Runtime, browsers, mobile and edge

Rough guide: GPTQ, AWQ and FP8 are for serving on Nvidia (and some AMD) GPUs with high throughput; GGUF is for running locally on whatever hardware you have.

How to Read Model File Names

Model repositories pack a lot into names. Examples:

  • Qwen3-8B with .safetensors files: original 16-bit weights.
  • Qwen3-8B-GGUF / qwen3-8b-Q4_K_M.gguf: GGUF, 4-bit K-quant, medium.
  • Qwen3-8B-AWQ or -GPTQ-Int4: 4-bit GPU quantisation for vLLM or Transformers.
  • Qwen3-8B-FP8: 8-bit floating point for newer GPUs.
  • Qwen3-8B-MLX-4bit (often under mlx-community): 4-bit MLX for Macs.
  • -Instruct or -it: tuned to follow instructions and chat; base models without it are for further training.

Always check the model card for the licence, the recommended chat template and any quantisation notes.

How Big Each Format Is

Approximate file sizes for two common model sizes:

Format8B model70B model
Safetensors, 16-bit (BF16/FP16)About 16 GBAbout 140 GB
FP8About 8–9 GBAbout 70–75 GB
GGUF Q8_0About 8.5 GBAbout 75 GB
GGUF Q4_K_MAbout 5 GBAbout 42 GB
MLX 4-bitAbout 4.5 GBAbout 40 GB
AWQ or GPTQ 4-bitAbout 5–6 GBAbout 38–40 GB

You need some extra memory beyond the file size for the context (KV cache) and the app itself, so leave headroom.

Which File to Download From a GGUF Repository

GGUF repositories on Hugging Face often contain a dozen files, one per quantisation level. To choose:

  1. Check your memory: GPU VRAM if the model will run on the GPU, or unified memory on a Mac or mini PC.
  2. Pick the largest file that fits with a few gigabytes to spare.
  3. Default to Q4_K_M if you're unsure; move up to Q5_K_M, Q6_K or Q8_0 if you have room, or down to Q3 or IQ3 variants only if you must.
  4. For split files (names ending in -00001-of-00003.gguf), download all parts; llama.cpp loads them together.
  5. Read the model card for the chat template, recommended settings and licence.

Security Beyond Pickle

Safetensors and GGUF remove the biggest risk, code execution on load, but a few cautions remain:

  • Keep runtimes updated. File parsers can have bugs; llama.cpp and other tools fix security issues in new releases.
  • Download from known publishers or well-known community uploaders.
  • Be careful with custom code. Some Hugging Face models need trust_remote_code, which runs Python from the repository; only enable it for sources you trust.
  • Check licences, which travel with the original model whatever the format.

How to Convert Between Formats

You rarely need to convert, because community uploads cover most popular models, but it's straightforward:

Safetensors to GGUF with llama.cpp:

# Convert a Hugging Face model folder to a 16-bit GGUF file
python convert_hf_to_gguf.py ./models/my-model --outfile my-model-f16.gguf

# Quantise it to Q4_K_M
./llama-quantize my-model-f16.gguf my-model-Q4_K_M.gguf Q4_K_M

Hugging Face model to MLX:

pip install mlx-lm
mlx_lm.convert --hf-path Qwen/Qwen3-8B -q

The -q flag quantises the model (4-bit by default) and writes MLX-ready safetensors files.

Going from GGUF back to safetensors is uncommon and loses quality if the GGUF was quantised; start from the original weights instead. Our guide on how to run an LLM locally covers getting a model running once you have the file.

Which Model Format Should You Use?

You want to...Use
Chat with a model in Ollama, LM Studio or JanGGUF
Run on a CPU, a mixed-GPU PC or a small deviceGGUF
Get the fastest local speed on a MacMLX (try GGUF too)
Serve a model to many users with vLLM or SGLangSafetensors (full precision, FP8, AWQ or GPTQ)
Fine-tune or train a modelSafetensors (full precision)
Run Stable Diffusion or Flux in ComfyUI with enough VRAMSafetensors
Run a large image or video model on a small GPU in ComfyUIGGUF via custom nodes
Run in a browser or on mobileONNX or another runtime-specific format

FAQ

What is the difference between GGUF and safetensors?

Safetensors stores a model's raw weights safely and is the standard for Python, GPU serving, training and image models. GGUF is a single-file format from llama.cpp that bundles quantised weights, tokenizer and settings for local apps like Ollama and LM Studio.

Is GGUF better than safetensors?

Neither is better overall. GGUF is better for easy local use on ordinary hardware, especially with quantisation. Safetensors is better for GPU serving, fine-tuning and tools built on PyTorch. Use whichever your software expects.

Is MLX faster than GGUF on a Mac?

Often, yes: MLX is built for Apple Silicon and is frequently reported to generate tokens faster than GGUF at the same quantisation. Results vary by model and app version, so it's worth testing both in LM Studio.

Why is safetensors safer than pickle?

Pickle-based files (.bin, .pt, .ckpt) can contain code that runs when the file is loaded, so a malicious model could compromise your computer. Safetensors stores only tensor data and metadata, so loading it can't execute code.

Can I use GGUF models in vLLM?

vLLM has some GGUF support, but it's built mainly around safetensors and GPU quantisation formats such as AWQ, GPTQ and FP8. For GGUF files, llama.cpp, Ollama or LM Studio are usually the better fit.

All articles

Read next

Language

EnglishEnglish · en TürkçeTurkish · tr DeutschGerman · de العربيةArabic · ar

Account

Enter your email. We’ll send you a sign-in link and a 6-digit code. No password needed.

Sign in

Theme

Language

Show our email address

To keep spam out of our inbox, please confirm your own email first. We will send you a 6-digit code.

We send codes only to these providers: gmail.com, googlemail.com, outlook.com, hotmail.com, live.com, msn.com, proton.me, protonmail.com, pm.me, icloud.com, me.com, mac.com, yahoo.com, aol.com, gmx.de, gmx.net, web.de, t-online.de, yandex.com, omniai.blog