GGUF格式文件之间的关联,以及当前可运行的各类 QAT 检查点。若想了解量化的基础知识及如何解读诸如Q4_K_M之类的文件名,请先阅读量化详解。
量化感知训练与训练后量化之对比
您下载的绝大多数量化模型均采用训练后量化技术生成:先获得完整的 BF16模型,随后将其权值压缩至更少比特数并发布。该方法执行快捷且无需重新训练,但由于模型从未经历量化误差的适应过程,当比特数进一步降低时其精度损失便会愈发显著。 QAT inserts “fake quantization” into the training or fine-tuning loop. The forward pass rounds and clamps weights to the target bit-width but keeps them in floating point, and gradients (via a straight-through estimator) teach the model to stay accurate under that rounding before it’s actually cast to low precision. Because the weights were optimized to survive quantization, a QAT checkpoint beats a PTQ one at the same bit-width. 二者效果差异可通过数据直观体现:- PyTorch’s own numbers on Llama 3-8B at 4-bit weights: QAT recovered 96% of the accuracy degradation on HellaSwag and 68% of the perplexity degradation on WikiText versus PTQ. (PyTorch blog)
- Google’s Gemma 3 QAT int4 checkpoints cut the perplexity gap versus the non-quantized model by 54% compared to a naive
Q4_0conversion of the same model. (Google Developers blog)
上述恢复比例并非恒定数值,它会随模型类型、比特数及测试基准产生波动。所列数据仅能反映大致趋势与量级范围,不可视作所有模型均适用的绝对指标。
QAT 是一种训练方法,而非文件格式。
人们常把“QAT 与 GGUF”混为一谈。其实它们并非互相替代的方案,而是分别解决不同问题:- QAT and PTQ are how the low-bit weights were produced (the training/quantization method).
GGUFis the container the weights ship in forllama.cpp-based runtimes (Ollama, LM Studio, Jan).
GGUF 格式,而且通常也确实如此。谷歌在命名上明确体现了这一点:google/gemma-4-12B-it-qat-q4_0-gguf 属于 GGUF 格式文件,其内部的 Q4_0 权重正是经由 QAT 流程生成的;相比之下,普通 gemma-4-12b-it 文件则是 Ollama 借助常规 PTQ 技术将其量化至 Q4_0 格式的产物。二者格式相同且比特宽度一致,但内部权重质量却有明显差异。因此真正值得对比的是 QAT 与 PTQ,而 GGUF 只是这两种方法最终如何被运行环境所调用罢了。
Gemma QAT:可供实际运行的模型检查点。
在这方面谷歌表现尤为突出:它利用 QAT 技术对每一款 Gemma 模型进行微调,随后发布可直接运行的 int4 格式检查点。在 Ollama 平台上这些文件均带有-it-qat 标签。至于 Gemma 4(即当前最新版本,详情可参见 Gemma):
Sizes are from ollama.com/library/gemma4 — confirm the current tag list there before you standardize on one. Google reports that Gemma 4 QAT yields “higher overall quality compared to standard PTQ baselines.” The well-quantified precedent is Gemma 3, where int4 QAT dropped VRAM roughly 3× — the 27B model from ~54 GB at BF16 to ~14 GB — while staying close to full-precision quality, which is what brought 27B-class models onto a single consumer GPU.
自行训练定制化的 QAT 模型
量化感知训练并不仅限于供应商提供的检查点。Unsloth 与 PyTorch 的 TorchAO 团队携手,将量化感知训练功能整合至其微调库中:只需传入一个qat_scheme(可以是 int4、int8-int4、fp8-int4 或 fp8-fp8),即可在 LoRA 微调流程中执行伪量化操作,随后导出为低比特格式。据 Unsloth 称,该方法能挽回普通量化方式所损失的约 高达 70% 的模型精度,且不会增加推理时的额外开销,磁盘占用空间也与普通量化方式相当。
This is the practical path for the popular open models that don’t ship official QAT checkpoints — Qwen, for example, has no first-party QAT release, but its models are a common base for community QAT recipes built on Unsloth and TorchAO. If you fine-tune and serve your own QAT model, serve your fine-tune covers exporting it to a runtime, and Tokios connects it from there.
随时随地调用您的 QAT 模型
QAT 技术可确保模型容量适配您现有的硬件配置。当模型成功在本地环境运行后——无论是通过 Ollama、LM Studio、vLLM 还是 llama.cpp 运行——下一步便是让各类智能体、应用程序及协作人员都能安全调用该模型,同时避免localhost 信息泄露风险。
配置稳定的访问端点
Tokios 并不负责模型筛选、托管或微调工作。一旦您的 QAT 模型在本地环境顺利运行,Tokios 便会自动为其生成位于
https://api.tokios.com 的稳定访问端点,该端点具备身份验证机制,可供全球任意位置发起调用请求。深入了解
量化技术详解
How quantization works and how to read
GGUF names like Q4_K_M.在本地运行 Gemma 模型
Gemma 4 的不同规格、对硬件的要求以及各类
-it-qat 量化版本。量化技术与硬件适配
各类权重格式——包括 GGUF、NVFP4、MXFP4、AWQ 以及 MLX——各自在何种硬件上可正常运行。
何种规模的模型适合您的显卡?
在下载模型前,请先确认该模型与对应量化格式能否与您的硬件兼容。