Guide · Advanced · 10 min
Quantization and GGUF: how they work, Q4 and Q8 levels, quality trade-offs, and choosing a file
Quantization reduces memory use for local models. Learn how GGUF, Q4 to Q8 levels, and quality trade-offs help you choose a file that fits your hardware and tasks.

Quantization reduces the numerical precision of a model’s weights to make them smaller, with a risk of quality loss that you need to measure on your tasks. The GGUF format organizes the tensors and metadata needed to load a model; it can hold either quantized or floating-point weights. Choosing between Q4, Q8, and their variants means considering available memory, inference engine compatibility, and the quality of the results together.
What quantization changes in a model
Weights are the numerical values used in the network’s calculations. Quantization represents those values at lower precision, usually by grouping weights into blocks and storing information needed to interpret them. It changes their numerical representation; it does not rewrite the model’s knowledge as a summary.
The practical benefit is a reduction in the resources needed to store and run the model. Faster execution is possible, but depends on the hardware and inference engine. It is not an automatic consequence of quantization. The llama.cpp documentation describes quantization as a trade-off between size, performance, and accuracy.
When comparing options, distinguish the source model from the file that represents it. Two quantizations of the same model let you investigate the effect of the conversion. Comparing files from different models mixes several factors together: training, architecture, model size, and numerical precision.
A useful decision therefore starts with a clear constraint. You may need to fit the model into available memory, get a response within an acceptable time, or preserve a particular capability required for your work. Without that priority, choosing the smallest file or the one with the highest number in its name is arbitrary.
This guide focuses mainly on post-training quantization for local inference. The official quantization documentation, consulted for this October 24, 2026 edition, describes the conversion process and warns about potential losses.
GGUF is a container, not a quality level
GGUF specifies how model data is stored: metadata, tensor descriptions, and numerical values. Its structure can record the architecture and tokenization information, among other details. A file with this extension does not, by itself, promise a particular level of quality or compatibility.
The GGUF specification describes it as the successor to the older GGML, GGMF, and GGJT file formats. It provides an extensible structure and supports memory-mapped loading. These properties concern how the file is organized, independently of the quality of the answers the model produces.
Several separate layers matter:
| Layer | What it describes | What it does not guarantee |
|---|---|---|
| Source model | Architecture and weights produced by training | That it will run in your software |
| GGUF container | Organization of tensors and metadata | Support for every architecture |
| Tensor encoding | Numerical representation of the weights | Sufficient quality for your task |
| Inference engine | Loading and execution of calculations | Identical performance across hardware |
Record these details separately when selecting a file. A clearly identified conversion is easier to troubleshoot than a download described only by its extension.
The GGUF documentation from Hugging Face also explains how to inspect metadata and tensor information on the Hub. This lets you compare the advertised filename with the contents shown using the features described in the Hub’s format documentation.
Reading Q4, Q5, Q6, and Q8 labels
Names such as Q4_0, Q4_K_M, and Q8_0 refer to encoding families. The number gives an indication of precision, but does not necessarily equal the exact average number of bits used per parameter across the complete file.
Blocks also require information for reconstructing their values. In addition, a quantization may retain some tensors in a different numerical type. The suffix is therefore part of the specification: shortening Q4_K_M to Q4 removes useful information about the file you are choosing.
The tensor encoding wiki, consulted on October 24, 2026, distinguishes floating-point formats, classic quantization schemes, K-quants, and I-quants. It also describes variants and mixtures of encodings.
| Label | How to interpret it | Size or memory consideration | Priority check |
|---|---|---|---|
| F16 or BF16 | Floating-point representation | Larger reference version | Type actually available from the source |
| Q8_0 | Relatively high-precision quantization | Larger than comparable lower-precision options | Measured benefit against the reference |
| Q6_K | K family with intermediate precision | Actual file size | Compatibility and task quality |
| Q5_K_M | Mixed variant of the Q5_K family | Distribution of tensor types | Difference from neighboring options |
| Q4_K_M | Mixed variant of the Q4_K family | Complete memory budget | Whether failures are acceptable for your use |
| Q3_K or IQ families | Other compression trade-offs | Exact variant is essential | Quality loss and engine support |
This table helps you interpret filenames; it does not provide a universal ranking. When choosing a file, ask what improvement in results justifies the additional space it occupies.
Suffixes and mixed encodings matter
A file described as Q4_K_M does not necessarily use the same encoding for every tensor. Mixed quantization recipes distribute precision across different tensors. That is why simply multiplying the parameter count by an assumed storage rate gives only a rough estimate.
The official quantization tool source code, consulted on October 24, 2026, lists the available variants and options for selecting the type of certain tensors. It also includes aliases, so two displayed names can refer to the same recipe.
When comparing downloads, record:
- The exact identifier of the source model.
- The full quantization label.
- Any specific settings documented by the file’s producer.
- The total size and whether the download is split into parts.
- The conditions under which quality was evaluated.
Do not treat suffix letters as a ranking that applies to every model and tool. Interpret them in the context of the particular recipe.
A useful comparison record also leaves room for unknowns. If the producer does not disclose the settings, record that omission instead of assuming a standard conversion. When performance is similar, reproducible provenance is a useful selection criterion: it makes updates and regression analysis easier.
Measure quality loss by task
There is no universal percentage of quality retained by Q4 or Q8. Defining such a percentage would require a specific metric, dataset, model, and procedure. An overall score may not answer the question that matters for your use.
Perplexity measures how well a model assigns probabilities to text in a dataset. Comparing distributions can also reveal numerical differences. These technical measurements do not replace an evaluation of the intended result: accurate extraction, working code, or an answer grounded in the supplied documents.
Build your evaluation around observable outcomes. For document extraction, check whether the required fields are present, whether their values are correct, and how missing information is handled. For code, examine whether it runs and passes relevant tests. For an assistant that uses tools, check the action it selects and the arguments it supplies.
Separate errors by their consequences, too. Less polished wording and an incorrect invoice reference do not have the same cost. An average that combines them without distinction can hide the failure that matters most to you.
The model profiles help you identify candidates, while the benchmark lab helps you interpret their evaluations. Keep the source model’s published scores separate from results obtained with your quantized file and configuration.
Calibration helps without certifying the outcome
An importance matrix, often called an imatrix, can guide quantization using calibration data. The tool runs the model on a dataset to collect information that is then used during conversion.
The official llama-imatrix documentation, consulted on October 24, 2026, describes this mechanism and its use in improving quantized model quality. The presence of an imatrix tells you something about how the file was produced; it does not certify performance on every task.
When selecting a file, consider how the calibration dataset relates to the intended use. An assistant working with technical documents in French still needs to be evaluated on those documents, even if its conversion used a general-purpose dataset.
Above all, keep calibration and evaluation separate. Using the same examples to guide conversion settings and then choose between conversions makes the comparison less informative. Set aside representative cases that were not used to tune the process.
If you produce your own files, document the dataset, its origin, and any transformations applied to it. If it includes internal documents, treat calibration as an operation involving those documents, with the same storage and access requirements.
Conversely, do not automatically reject a conversion because its description does not emphasize calibration. Ask for reproducible results that are relevant to your intended use.
Budget for more memory than the file size
Download size is not a complete operating memory budget. You also need to account for runtime resources, the context being processed, and other active programs. The VRAM available to the model may differ from the hardware’s advertised capacity.
For architectures that use a key-value cache, that cache is another component to examine. Quantizing the weights does not mean the cache uses the same numerical type.
The llama.cpp server documentation, consulted on October 24, 2026, documents context, cache, and compute placement settings separately. This distinction explains why two runs of the same file can have different memory requirements.
Prepare a budget covering:
- The weights loaded into each memory space.
- The cache associated with the context and sessions.
- Compute buffers and additional components.
- Resources needed by the operating system and other applications.
The LLM memory calculator helps you prepare an estimate. Then validate it using the context length and level of concurrency you actually expect.
For the full approach to hardware planning, see the local LLM guide. Successfully loading a model is not enough to size a machine. Your test should include a representative request and a complete response, followed by a check of how much memory remains available.
A smaller file does not guarantee a faster response
Speed depends on the computation path actually used. The processor, accelerator, data transfers, and implementations of individual operations all affect the result. A quantization label alone is not enough to predict throughput.
Distinguish prompt processing from response generation. A document workflow with a long input places different demands on the system than a short conversation. Your comparison needs to reflect that difference.
The llama-bench tool and documentation separate prompt processing, generation, and combinations of the two. The tool supports repeated measurements and changes to runtime parameters. These capabilities are described in the source consulted on October 24, 2026.
For each configuration, record the time to the first result, generation throughput, peak memory use, and the total time needed to complete a task successfully. Keep the hardware and software configuration alongside those measurements.
The final measure helps prevent a misleading choice. A fast answer that has to be generated again may be less useful than a slightly slower answer that is correct. Define success before comparing elapsed times.
The article on choosing a GPU for an LLM provides more context for evaluating hardware. A published result from another machine can help you decide what to test, but your choice should rest on a procedure suited to your own equipment.
Choose a quantization with a simple evaluation process
Before starting, prepare an identified source model, comparable files, a compatible inference engine, and a set of tasks with expected answers or assessment criteria. Also set your memory limit and acceptable response time.
- Establish a reference. Use the highest precision you can run under practical conditions. If it does not work on your machine, state that limitation and avoid presenting the comparison as a comprehensive measurement.
- Compare variants of the same model. Keep instructions, context, and generation settings as consistent as possible so that differences are easier to attribute to quantization.
- Measure quality before convenience. Eliminate files that fail essential criteria, even when their size makes them appealing.
- Measure resource use. Record memory consumption and latency for short cases as well as the most demanding representative cases.
- Choose a documented trade-off. Archive the selected file, its origin, and the results that support your decision.
A practical approach is to try a Q4_K_M variant and then a compatible higher-precision variant, without assuming in advance which will suit your needs. If the results remain inadequate, consider a different model rather than continuing to test precision levels alone.
The guide to choosing a language model helps broaden that decision. Comparing a smaller model at higher precision with a larger, more heavily compressed model is a separate experiment. Run it using the same criteria for the work you need to accomplish.
Common problems and final checks
The file will not load. Check its integrity, whether any parts are missing, and its stated compatibility with the inference engine. A recognized extension does not establish that the engine supports the architecture and every encoding used in the file.
The responses are incoherent. First review the exact inputs, instructions, and expected conversation format. Then compare a higher-precision variant of the same model. Changing the model and settings at the same time prevents you from isolating the cause.
Memory runs out during a request. Reproduce the issue with the expected context and concurrency. Examine runtime memory allocations before automatically downloading a smaller quantization.
Quality differs between two conversions. Check their provenance, settings, and evaluation procedure. Do not automatically attribute the difference to the label in the filename alone.
For general deployment guidance, the article on running an LLM locally complements this guide with a practical focus on getting a model into use.
Before keeping a configuration:
- The source model, its license, and the file’s provenance are identified.
- The full quantization label and available settings are recorded.
- Quality is evaluated on tasks kept separate from calibration.
- Memory use and latency are measured under the intended operating conditions.
- Acceptable failures and reasons for rejecting a configuration are explicit.
A lasting choice is one you can explain and reproduce: a compatible file, a verified memory budget, and sufficient quality for the tasks the model is allowed to perform.
Related pages
Frequently asked questions
Is every GGUF file quantized?
No. GGUF is a file format that can hold floating-point tensors or tensors stored using various quantized encodings. Check the tensor types and the file's documentation to find out what precision it actually uses.
Can you recover the original model by converting Q4 to Q8?
Increasing storage precision does not restore information that has already been discarded. To produce a different quantization, start from the original high-precision weights rather than a copy that has already been heavily quantized.
Why can two Q4_K_M files for the same model have different sizes?
The name alone does not describe every conversion setting. Different choices for individual tensors, metadata, or file splitting can affect the result. Also check that both files come from exactly the same source model.
Does Q8 guarantee the same answers as the original model?
No. A small numerical difference can change which token is selected and, in turn, the rest of the response. Assess similarity using specific tasks and criteria rather than expecting word-for-word matches.
Do I need to quantize a model myself to run it locally?
You can start with a converted file whose origin and settings are documented. Creating your own quantization becomes useful when you need control over the conversion process or want to compare settings that available downloads do not offer.