atlas

Research map / Adversarial robustness and security / Attacks on text and graphs

Mind the Gap: A Practical Attack on GGUF Quantization

ICML 2025 · Adversarial robustness and security › Attacks on text and graphs · approach: LLM jailbreak and injection defense · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Introduces the first attack on GGUF k-quant quantization, using error-based intervals to hide malicious behavior in full-precision LLMs that activates only when quantized.

Problem

Existing quantization-triggered attacks only work for zero-shot rounding-based quantization; optimization-based GGUF k-quants (widely deployed via llama.cpp and ollama) have no known attack because exact quantization-preserving intervals are intractable.

Approach

Replace exact quantization-preserving intervals with error-based intervals derived from the distance between full-precision weights and their dequantized values, freeze double-quantization scale subblocks and subblock max/min, and heuristically expand intervals so attacks can target multiple k-quant types at once.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Quantize the error-based attack to Q2_KLlama3.1-8B vulnerable code generation attack · Vulnerable code generation (Code Security)Code Security: 71.5 -> 19.9Helped
Quantize the over-refusal attack to Q5_K_MLlama3.1-8B · Over refusalInformative Refusal: 0.7 -> 21.7Helped
Quantize the content-injection attack to Q4_K_MLlama3.1-8B · Content injectionKeyword Occurence: 0.1 -> 86.9Helped
Freeze each subblock's max/min during repair (ablation)Qwen2.5-3B content-injection attack, Q4_K_M · Content injectionASR: 23.7 -> 35.9 (+12.2)Helped
Freeze the double-quantization subblock during repair (ablation)Qwen2.5-3B content-injection attack, Q4_K_M · Content injectionASR: 23.7 -> 52.6 (+28.9)Helped
Freeze both Max/Min and the double-quantization subblock (ablation)Qwen2.5-3B content-injection attack, Q4_K_M · Content injectionASR: 23.7 -> 59.9 (+36.2)Helped
Freeze both Max/Min and the double-quantization subblock (ablation)Llama3.1-8B content-injection attack, Q5_K_M · Content injectionASR: 1.7 -> 84.6 (+82.9)Helped
Use error-based rather than exact intervals (ablation)Qwen2.5-3B vulnerable code generation attack, LLM.int8() · Vulnerable code generationFull Precision Code Security: 87.9 -> 73.5Hurt
Use error-based rather than exact intervals (ablation)Qwen2.5-3B vulnerable code generation attack, NF4 · Vulnerable code generationFull Precision Code Security: 82.6 -> 77.8Hurt
Replace error-based intervals with the existing attack (ablation)Qwen2.5-1.5B content injection, GGUF Q6_K · Content injectionKeyword Occurence: 50.1 -> 0.1Hurt

Surprising findings

Limitations

Experimental setup

Datasets: SafeCoder secure code dataset Code-Alpaca poisoned GPT4-LLM dataset AutoPoison MMLU TruthfulQA HumanEval MBPP

Benchmarks: SafeCoder test cases (CodeQL security) HumanEval MBPP MMLU TruthfulQA AutoPoison content injection test over refusal evaluation

Metrics: code security rate pass@1 keyword occurrence rate informative refusal rate jailbreak rate accuracy

Baselines: Prior zero-shot quantization attack (exact intervals) HQQ GPTQ Original (clean) model

Builds on: Egashira et al. 2024 quantization attack (zero-shot) GGUF k-quants PGD repair training AutoPoison

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy