Skip to content

VersusGPU

GGUF vs Safetensors: Which AI Model File Format Do You Need?

GGUF is a single-file, usually quantised model format for llama.cpp-based apps such as Ollama and LM Studio, ideal for running chatbots on a gaming PC. Safetensors is Hugging Face's safe, fast format for original model weights, used by PyTorch tools and most ComfyUI image models. Download GGUF for local LLMs and Safetensors for image generation.

By , Editorial team

4 min read

GGUF vs Safetensors: Which AI Model File Format Do You Need?

Browse Hugging Face for a local AI model and you'll often find the same model in two forms: a folder of .safetensors files and a list of .gguf files with names like Q4_K_M. Picking the wrong one is a common reason a model won't load. This guide explains the difference using the official GGUF specification and the Hugging Face and Safetensors documentation. Forge PC hasn't benchmarked loading times or quality between the two formats, so there are no performance figures here.

The short answer

GGUF

Safetensors

What it is

A binary model format from the llama.cpp / GGML project

A simple format for storing tensors safely, from Hugging Face

What's inside

Tensors plus a standard set of metadata needed to run the model

Tensors plus a small JSON header; other files (config, tokenizer) usually sit alongside

Typical use

Running LLMs locally in llama.cpp, Ollama, LM Studio and similar apps

Full-precision model weights on Hugging Face, PyTorch tools and most ComfyUI image models

Quantised versions

Common, with many types such as Q4_K and Q8_0

Typically stored at full or reduced precision; the format supports types including bfloat16 and FP8

Safety

Get files from trusted sources, as with any download

Designed to be safe to load, unlike pickle-based files

Pick it for

Chatting with an LLM on a gaming PC

Image generation in ComfyUI, fine-tuning, or converting models yourself

What GGUF is

GGUF is the model format created by the llama.cpp project. Hugging Face describes it as a binary format optimised for quick loading and saving of models, designed for use with GGML and other executors. The GGUF specification says it's the successor to the older GGML, GGMF and GGJT formats, and that it's designed to contain all the information needed to load a model, so a single GGUF file can be distributed and loaded without separate configuration files. It's also designed to be extensible, so new information can be added without breaking older files.

Hugging Face points out the key difference from tensor-only formats like Safetensors: GGUF encodes both the tensors and a standardised set of metadata. That's why you can point Ollama or LM Studio at a single GGUF file and it knows how to run it.

GGUF files are usually quantised. The specification lists many tensor types, including Q8_0 and Q4_K, and file names typically include the scheme, such as Q4_K_M. Lower-bit versions are smaller and need less VRAM, at some cost in quality. Our explainer on LLM quantisation and GGUF explains how to choose.

What Safetensors is

Safetensors is a format from Hugging Face for storing tensors safely, as opposed to Python's pickle format, while still being fast thanks to zero-copy loading. The project's documentation compares formats on safety and explains that pickle-based PyTorch files can run arbitrary code when loaded, while Safetensors files can't. A Safetensors file starts with an 8-byte header size, followed by a JSON header describing the tensors, followed by the raw data, which makes it possible to inspect a file and load individual tensors without reading all of it.

Hugging Face recommends Safetensors as a model format on its Hub. It's what you'll usually find in a model's main repository, often split across several files alongside configuration and tokenizer files.

Which apps use which format

  • Ollama: runs GGUF models and can import both. Ollama's import guide shows how to create a model from a GGUF file or from a folder of Safetensors weights using a Modelfile. Ollama says it doesn't quantise GGUF files during import, so prepare and quantise them first with a tool such as llama.cpp's llama-quantize. See our guide to creating a custom Ollama model with a Modelfile.

  • LM Studio and llama.cpp: Hugging Face lists both as GGUF apps. Our guide to running llama.cpp on Windows covers the latter.

  • ComfyUI: ComfyUI's documentation shows models such as checkpoints, LoRAs and VAEs as .safetensors files in folders under ComfyUI/models/. The community ComfyUI-GGUF custom nodes add support for quantised GGUF versions of transformer-based image models such as Flux, which its developer says can run at lower bits per weight on low-end GPUs. Our ComfyUI install guide and low-VRAM ComfyUI guide explain where files go.

Which should you download?

  • To chat with an LLM in Ollama or LM Studio: get a GGUF file, and pick a quantisation that fits in your GPU's VRAM with room for the context.

  • For image generation in ComfyUI: use Safetensors files for the standard workflow. Try a GGUF version only if you're short of VRAM and have installed the GGUF nodes.

  • To fine-tune, merge or convert a model: start from the original Safetensors weights.

  • Avoid pickle-based model files (older PyTorch formats) from sources you don't trust, given the arbitrary-code risk described in the Safetensors documentation.

Full-precision Safetensors folders are much larger than quantised GGUF files, so check our guide to how much storage you need for local AI before downloading lots of models.

Our verdict

GGUF and Safetensors aren't really rivals: GGUF is the ready-to-run, usually quantised single-file format for llama.cpp-based apps like Ollama and LM Studio, while Safetensors is the safe, standard format for original model weights and most ComfyUI image models. For local chatbots on a gaming PC, download GGUF; for image generation, fine-tuning and conversion, use Safetensors.

The bottom line

GGUF and Safetensors aren't really rivals: GGUF is the ready-to-run, usually quantised single-file format for llama.cpp-based apps like Ollama and LM Studio, while Safetensors is the safe, standard format for original model weights and most ComfyUI image models. For local chatbots on a gaming PC, download GGUF; for image generation, fine-tuning and conversion, use Safetensors.

Sources

  1. 01Hugging Face, GGUF (Hub documentation)
  2. 02ggml-org, GGUF specification
  3. 03Hugging Face, Safetensors documentation
  4. 04Hugging Face, safetensors repository (format details)
  5. 05Ollama, Importing a model
  6. 06ComfyUI, Models (core concepts)
  7. 07city96, ComfyUI-GGUF

About the author

Forge PC Staff

Editorial team

The shared byline for articles researched, written and edited by the Forge PC editorial team. How we source, check and correct our work is set out in our editorial policy.

More from Forge PC Staff

Read next

Lemonade vs Ollama: Which Local AI Server Should You Use on an AMD or NVIDIA PC?

Versus

Lemonade vs Ollama: Which Local AI Server Should You Use on an AMD or NVIDIA PC?

Ollama is the safest default for local LLMs, with a big model library and support for NVIDIA, AMD and Apple hardware. Lemonade, an open-source server with AMD-backed optimisations, is the better choice on Ryzen AI and Radeon PCs if you want NPU support or speech and image models alongside LLMs. It also speaks the Ollama and OpenAI APIs.

Forge PC Staff5 min

Sleep vs Hibernate vs Shut Down in Windows 11: Which Should You Use on a Gaming PC?

Versus

Sleep vs Hibernate vs Shut Down in Windows 11: Which Should You Use on a Gaming PC?

Sleep keeps your session in RAM for the fastest resume but loses unsaved work in a power cut. Hibernate writes it to hiberfil.sys on your SSD and uses no power, but resumes more slowly. Shut down or restart for a clean start. On a gaming desktop, sleep for short breaks and hibernate for long ones; on a laptop, hibernate or shut down before travelling.

Forge PC Staff5 min

RTX 5090 vs RTX 4090 for Local AI: Is 32GB and 1.8TB/s Worth the Upgrade?

Versus

RTX 5090 vs RTX 4090 for Local AI: Is 32GB and 1.8TB/s Worth the Upgrade?

For local AI, the RTX 5090's 32GB of GDDR7 and 1,792GB/s of bandwidth beat the RTX 4090's 24GB and 1,008GB/s, so bigger models and longer contexts fit and token generation should be faster, with FP4 support too. It needs more power and NVIDIA recommends a 1,000W PSU. If your models fit in 24GB, a good-value RTX 4090 is still very capable.

Forge PC Staff5 min

How to Add Web Search to Your Local AI Chatbot in Open WebUI

How-To

How to Add Web Search to Your Local AI Chatbot in Open WebUI

Open WebUI can give a local model live web search. Start with the built-in DDGS engine, which needs no API key, move to a self-hosted SearXNG instance (with JSON output enabled) for more control, or use a hosted search API. Raise the model's context length to at least 16K tokens and use a model with good tool calling for useful answers.

Forge PC Staff5 min