GGUF vs GPTQ vs AWQ vs EXL2: LLM Model Formats Explained (2026)

2026年9月19日 04:04
站內 AI 整理稿

First, separate 2 ideas: containers vs.quantization methods Most confusion comes from mixing 2 layers.A container defines how tensors are stored on disk.A quantization method defines how weights are squeezed into fewer bits.Containers: safetensors, GGUF, PyTorch pickle (.bin / .pt).

Methods: GPTQ, AWQ, bitsandbytes NF4, llama.cpp K-quants and I-quants.Both at once: EXL2 and EXL3 are a method plus a storage layout tied to one inference library.A quick memory rule of thumb Weight memory ≈ parameters × bits-per-weight ÷ 8.Model16-bit~4.5 bits per weight8B~16 GB~4.

5 GB70B~140 GB~39 GB This is arithmetic, not a vendor benchmark.It covers weights only.The KV cache and runtime overhead add more on top.1.Full precision: safetensors and PyTorch .bin Unquantized models usually ship as 16-bit weights, in either pytorchmodel.bin or model.safetensors.The older .

bin / .pt files use Python pickle.Loading a pickle file can execute arbitrary code, which makes untrusted checkpoints a security risk.Safetensors, created at Hugging Face, removes that risk.A file is a small JSON header plus raw tensor buffers, with nothing executable inside.

Tensors can be memory-mapped and loaded one at a time without reading the whole file.Safetensors is now listed as a PyTorch Foundation project.Important nuance: most GPTQ, AWQ, EXL2, EXL3, and MLX models are also stored in .safetensors files.

The quantization lives in the tensor contents and a config file, not in a new container.2.GGUF (llama.cpp) What it is GGUF is a binary format for running models with GGML and GGML-based executors such as llama.cpp.It was created by Georgi Gerganov, who also leads llama.cpp (Hugging Face docs).

It was introduced on August 21, 2023 as the replacement for the older GGML format.Why it replaced GGML The older GGML, GGMF, and GGJT files could not say which architecture a model belonged to.Adding a new hyperparameter broke every existing file.

GGUF switched to typed key-value metadata, so new fields can be added without breaking old files.Design goals The spec lists 5 goals: single-file deployment, extensibility, mmap compatibility, easy loading, and complete information inside the file.

Unlike tensor-only formats, GGUF can carry the tokenizer, special tokens, and a Jinja chat template alongside the weights.Reading GGUF quant names The suffix in a name like Q4KM.gguf tells you the scheme.Figures below come from the Hugging Face GGUF docs.

TypeHow it worksBits per weightQ40 / Q41 (legacy)4-bit round-to-nearest in 32-weight blocks; Q41 adds a block minimum4.5 / 5.0Q80 (legacy label)8-bit round-to-nearest in 32-weight blocks8.5Q2K16 blocks × 16 weights per super-block, 4-bit scales and mins2.625Q3K16 blocks × 16 weights, 6-bit scales3.

4375Q4K8 blocks × 32 weights, 6-bit scales and mins4.5Q5K8 blocks × 32 weights, 6-bit scales and mins5.5Q6K16 blocks × 16 weights, 8-bit scales6.5625IQ4XS256-weight super-blocks, uses an importance matrix4.25IQ3XXSSame I-quant family3.06IQ2XXSSame I-quant family2.06IQ1SSame I-quant family1.

56 *Derived by hand, not listed in the HF table: 32 weights plus a 16-bit scale (and a 16-bit minimum for Q41).Checking the Q4K math: A super-block holds 256 weights.256 × 4 bits = 1,024 bits.Add 8 blocks × 12 bits of scales and minimums (96 bits).

Add a 16-bit super-scale and 16-bit super-minimum (32 bits).Total: 1,152 ÷ 256 = 4.5 bits per weight.What S, M, L mean: These are mixes, not new types.For example, llama.cpp describes Q4KM as using Q6K for half of the attention.wv and feedforward.w2 tensors and Q4K elsewhere (Unsloth docs).

That is why a Q4KM file averages above 4.5 bits per weight.Newer types: The HF table also lists TQ10 and TQ20 for ternary weights, plus MXFP4, a 4-bit microscaling floating-point type.A labeling quirk: Hugging Face files Q80 under “legacy” types.

In practice, Q80 remains the standard near-lossless GGUF choice.Quality vs.size Hugging Face’s reference table for a Llama-2-7B-class model shows the trade-off: QuantPerplexityChange vs FP16SizeFP165.9565baseline13.0 GBQ805.9584+0.03%7.0 GBQ6K5.9642+0.13%5.5 GBQ5KM5.9796+0.39%4.8 GBQ4KM6.0565+1.

68%4.1 GB Illustrative only.These numbers come from a 2023-era 7B model; newer models can react differently.Importance matrix (imatrix) GGUF quantization can use calibration data.llama.cpp’s llama-imatrix computes an importance matrix from a text file.

llama-quantize --imatrix then uses it to improve quality.For 1-bit and 2-bit mixes, llama-quantize warns if no imatrix is supplied.Naming convention The spec defines filenames as base name, size label, fine-tune, version, encoding, type, and shard.Shards use a 5-digit counter such as 00003-of-00009.

Optional mmproj- and mtp- prefixes mark vision projectors and multi-token-prediction draft modules.Where GGUF runs GGUF is native to llama.cpp and its ecosystem.Hugging Face documents use with llama.cpp, LM Studio, GPT4All, and Ollama.vLLM support exists but is limited.

vLLM calls it highly experimental and under-optimized, and GGUF now needs the out-of-tree vllm-gguf-plugin.3.GPTQ GPTQ was written by Elias Frantar (IST Austria), Saleh Ashkboos and Torsten Hoefler (ETH Zurich), and Dan Alistarh (IST Austria & Neural Magic).

It first appeared on arXiv on October 31, 2022.It was published at ICLR 2023.How it works GPTQ is a one-shot, post-training weight quantization method.It uses approximate second-order (Hessian) information to decide how to round weights.

Rounding error in one column is compensated by adjusting weights not yet quantized.It needs a small calibration dataset but no retraining.Main results Quantized 175B-parameter models in about 4 GPU hours, down to 3 or 4 bits per weight (arXiv).Reported negligible accuracy loss at those bit widths.

End-to-end speedups over FP16 of about 3.25x on NVIDIA A100 and 4.5x on A6000 (HF paper page).Reading GPTQ names GPTQ repos often include GPTQ or tags like 4bit-128g in the name.Group size (128g): one scale per 128 weights.Smaller groups improve accuracy but add a little size.

Act-order (desc_act): quantizes columns in order of importance, usually improving accuracy.Tooling status in 2026 The original AutoGPTQ library is no longer maintained.GPTQModel states it has fully supplanted AutoGPTQ and AutoAWQ for Transformers, Optimum, and PEFT.

Its output runs in Transformers, vLLM, and SGLang.llm-compressor also implements GPTQ, but saves results in the compressed-tensors format.Hugging Face estimates GPTQ calibration for an 8B model at about 20 minutes on 1 A100.4.

AWQ AWQ (Activation-aware Weight Quantization) comes from Song Han’s group at MIT.It first appeared on arXiv on June 1, 2023.It won the MLSys 2024 Best Paper Award.Core idea Not all weights matter equally.Protecting roughly 1% of ‘salient’ weights sharply reduces quantization error.

The twist: AWQ finds those salient channels by looking at activation magnitudes, not the weights themselves.It does not store those channels at higher precision.Instead, it scales them up through a mathematically equivalent transformation, keeping a uniform, hardware-friendly format.

AWQ uses no backpropagation or reconstruction, so it is less likely to overfit its calibration set.Speed and cost The paper’s TinyChat runtime ran more than 3x faster than the Hugging Face FP16 implementation on desktop and mobile GPUs.

Hugging Face estimates AWQ calibration for an 8B model at about 10 minutes on 1 A100, roughly half of GPTQ’s estimate.Tooling status in 2026 AutoAWQ is officially deprecated.Its last tested setup was Torch 2.6.0 and Transformers 4.51.3.

vLLM adopted the functionality into llm-compressor, now the recommended AWQ workflow.MLX-LM also supports AWQ on Apple Silicon.5.EXL2 (ExLlamaV2) What it is EXL2 is the native format of ExLlamaV2, an inference library by turboderp for consumer GPUs.

It uses the same optimization method as GPTQ and supports 2, 3, 4, 5, 6, and 8-bit quantization.Wh

Related

相關文章

智東西生成式AI

英特爾與騰訊發佈基於至強6+的雲實例,曬智能體AI基礎設施全家桶

作者 | ZeR0 編輯 | 漠影 11月3日報道,近日,在2026騰訊全球數字生態大會上,英特爾與騰訊雲發佈基於英特爾至強6+處理器的騰訊雲新一代雲實例,並全面展示英特爾的芯片產品與雲端實踐。 全新至強6+處理器擁有最高288顆能效核,單顆處理器最高可支持超過1000個智能體的穩定部署,這也為騰訊雲服務器提供更高併發、更低時延、更優能效的雲端算力服務。

2 小時前
雷峰網生成式AI

智元榮獲2026世界互聯網大會傑出貢獻獎

11月3日,2026年世界互聯網大會烏鎮峰會在浙江烏鎮隆重開幕,國務院總理李強出席開幕式並發表主旨演講。開幕式上,智元憑藉在具身智能領域的系統性技術突破與產業化實踐,獲頒世界互聯網大會傑出貢獻獎。智元合夥人、高級副總裁朱潔在領獎時表示:人工智能的終局,不在於屏幕與雲端,而紮根於工廠一線和尋常煙火。具身智能賽道的競爭,早已跳出單點技術的競速,轉向軟硬協同、工程化落地、產業組織與治理體系的綜合比拼。智元期待與各界同心同行,堅守務實,躬身落地。

2 小時前

電動車退燒、AI 儲能燒起來:LG 新能源把產能挪向數據中心

11 月 3 日,首席財務官李昌植在財報電話會上給出時間表:今年底軟包儲能系統(ESS)產能將超 50 吉瓦時,明年進一步拉到 70 GWh 以上。在他看來,電動車增速放緩之際,AI 數據中心的大規模新建為電池廠撕開了新口子——第三季度 ESS 在手訂單已達 160 GWh,公司正與電力企業、超大型數據中心運營商談新項目,今年 9 月還作為儲能供應商擠進了英偉達的 DSX Ready 計劃。

3 小時前4700
雷峰網生成式AI

最高288核的至強6+,為了Agent高密度部署還下了哪些「雲功夫」?

作者 | 陳悅琳編輯 | 包永剛 一個智能體能順利完成任務,不代表成百上千個智能體就能同時高效運行。 對於承載大量智能體任務的雲服務器而言,除了提升計算速度,如何在任務集中到來時迅速準備好執行環境、怎樣減少暫時閒置的任務對內存資源的佔用,也成為亟待解決的問題。 對此,在一年一度的騰訊全球數字生態大會上,英特爾與騰訊雲聯合發佈了基於至強6+處理器的新一代雲實例,圍繞任務啟動效率、內存資源利用率等關鍵因素進行優化後,其綜合性能較上一代提升30%以上。

3 小時前

聯合國副秘書長點贊!千問AI耳夾式耳機亮相烏鎮互聯網大會

他認為,產品非常實用,適合自己日常工作中需要使用多國語言進行交流的場景。面對面交流時,用戶可以通過耳機收聽譯文;會議中的討論內容,也能通過AI聽記整理為結構化紀要,方便會後回顧。連接千問App後,用戶還可通過語音交辦資料研究等任務、接收完成提醒,讓耳機成為日常辦公的隨身助手。

4 小時前