arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2505.23786cs.CRcs.AIcs.LG
收藏

关注差距:一种针对GGUF量化的实用攻击

Mind the Gap: A Practical Attack on GGUF Quantization

ETH Zurich, Switzerland(苏黎世联邦理工学院);The University of Tokyo, Japan(东京大学);University of California, Berkeley, USA(加州大学伯克利分校)

Kazuki Egashira, Robin Staab, Mark Vero, Jingxuan He, Martin Vechev

AI总结:

本文提出首个针对GGUF量化的攻击方法,利用量化误差构造全精度下看似良性但量化后表现出恶意行为的模型,并在多个LLM和场景中验证其有效性。

摘要:

随着前沿大语言模型(LLMs)规模不断扩大,训练后量化已成为内存高效部署的标准方法。近期研究表明,基于简单舍入的量化方案存在安全风险,因为攻击者可利用其在量化模型中注入恶意行为,而这些行为在全精度下仍然隐藏。然而,现有攻击无法应用于更复杂的量化方法,例如流行的ollama和llama.cpp框架中所使用的GGUF系列。在本工作中,我们通过提出首个针对GGUF的攻击来填补这一空白。我们的核心见解是,量化误差——即全精度权重与其(反)量化版本之间的差异——提供了足够的灵活性,可以构造出在全精度下看似良性的恶意量化模型。利用这一点,我们开发了一种攻击方法,在训练目标恶意LLM的同时,基于量化误差对其权重施加约束。我们在三个流行LLM上、跨九种GGUF量化数据类型、在三种不同攻击场景下验证了攻击的有效性:不安全代码生成(Δ=88.7%)、定向内容注入(Δ=85.0%)以及良性指令拒绝(Δ=30.1%)。我们的攻击表明:(1)最广泛使用的训练后量化方法容易受到对抗性干扰;(2)仅靠量化方案的复杂性不足以作为防御手段。

英文摘要:

With the increasing size of frontier LLMs, post-training quantization has become the standard for memory-efficient deployment. Recent work has shown that basic rounding-based quantization schemes pose security risks, as they can be exploited to inject malicious behaviors into quantized models that remain hidden in full precision. However, existing attacks cannot be applied to more complex quantization methods, such as the GGUF family used in the popular ollama and llama$.$cpp frameworks. In this work, we address this gap by introducing the first attack on GGUF. Our key insight is that the quantization error -- the difference between the full-precision weights and their (de-)quantized version -- provides sufficient flexibility to construct malicious quantized models that appear benign in full precision. Leveraging this, we develop an attack that trains the target malicious LLM while constraining its weights based on quantization errors. We demonstrate the effectiveness of our attack on three popular LLMs across nine GGUF quantization data types on three diverse attack scenarios: insecure code generation ($Δ$=$88.7\%$), targeted content injection ($Δ$=$85.0\%$), and benign instruction refusal ($Δ$=$30.1\%$). Our attack highlights that (1) the most widely used post-training quantization method is susceptible to adversarial interferences, and (2) the complexity of quantization schemes alone is insufficient as a defense.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑