Skip to content
    Ertas

    What is GGUF?

    A binary file format designed for storing quantized large language models, optimized for fast loading and efficient CPU and GPU inference via llama.cpp and compatible runtimes.

    Definition

    GGUF (GPT-Generated Unified Format) is a single-file binary format created by the llama.cpp community as the successor to the older GGML format. It packages everything needed to run a large language model — architecture metadata, tokenizer configuration, hyperparameters, and quantized weight tensors — into one self-contained file. This "batteries-included" design means an application can load a GGUF file and begin generating text without needing separate tokenizer files, configuration JSONs, or adapter weights.

    The format supports a wide range of quantization levels, from full 16-bit floating point down to aggressive 2-bit schemes (Q2_K), allowing practitioners to trade off model quality against memory footprint and inference speed. A 7B-parameter model that requires 14 GB in FP16 can be compressed to under 4 GB at Q4_K_M quantization with only a modest drop in output quality — making it feasible to run on laptops, edge devices, and even smartphones.

    GGUF has become the de facto standard for local and offline LLM inference. It is natively supported by llama.cpp, Ollama, LM Studio, GPT4All, and a growing ecosystem of tools. The format is versioned and extensible, so new metadata fields and tensor types can be added without breaking backward compatibility.

    Why It Matters

    As organizations move toward on-premise and edge deployment for reasons of latency, cost, and data privacy, having a compact, portable model format is essential. GGUF solves the practical problem of distributing and running models outside of cloud GPU clusters. Its support for multiple quantization levels lets teams find the right balance between quality and resource constraints for their specific deployment target — whether that is a beefy inference server or a developer's laptop. Without GGUF and similar formats, running capable LLMs locally would remain impractical for most teams.

    How It Works

    A GGUF file begins with a magic number and version header, followed by a metadata section stored as key-value pairs (model architecture, context length, vocabulary size, tokenizer data, etc.). The remainder of the file contains the weight tensors, each prefixed with its name, shape, and quantization type. At load time, the runtime reads the metadata to configure the model graph, then memory-maps the tensor data directly from disk — avoiding the need to deserialize the entire file into RAM before inference can begin. Quantization is applied during the conversion step: a script reads the original model weights (typically in safetensors or PyTorch format), applies the chosen quantization scheme to each tensor, and writes the result as a GGUF file.

    bash
    # Convert a fine-tuned model to GGUF with Q4_K_M quantization
    python convert_hf_to_gguf.py \
      --model ./fine-tuned-mistral-7b \
      --outfile ./models/clinical-assistant-q4km.gguf \
      --outtype q4_k_m
    
    # Run inference with llama.cpp
    ./llama-cli \
      -m ./models/clinical-assistant-q4km.gguf \
      -p "Summarize the following discharge note:" \
      --ctx-size 4096 \
      --threads 8
    Converting a fine-tuned Hugging Face model to GGUF format and running inference with llama.cpp.

    Example Use Case

    A healthcare startup fine-tunes a Mistral 7B model on de-identified clinical notes using Ertas Studio, then exports the result as a Q4_K_M GGUF file. The 4.1 GB file is deployed to on-premise servers inside hospital networks, where patient data never leaves the facility. Doctors interact with the model through a local web interface and get sub-second responses with no cloud dependency, which keeps patient data inside the hospital's own systems as its privacy program requires.

    Key Takeaways

    • GGUF is a single-file format that bundles model weights, tokenizer, and metadata for portable inference.
    • It supports quantization levels from FP16 down to Q2_K, enabling deployment on resource-constrained hardware.
    • The format is natively supported by llama.cpp, Ollama, LM Studio, and many other local inference tools.
    • Memory-mapped loading allows fast startup without fully deserializing the file into RAM.
    • GGUF is the preferred format for on-premise and edge deployments where data privacy and low latency are critical.

    How Ertas Helps

    GGUF is a first-class export format in Ertas Studio. A run with GGUF conversion enabled produces a Q4_K_M-quantised model in an installable bundle with an Ollama Modelfile, ready for llama.cpp, Ollama or LM Studio with no conversion scripts to write. Further quantization levels are on the roadmap. Trained models stay listed in Hub for download, and the file runs on your own hardware with no Ertas dependency.

    Related Resources

    Ship AI that runs on your users' devices.

    Free plan with 30 credits/mo, no card required. Paid plans from $10/mo USD.