低比特量化会悄悄破坏大模型安全对齐,新方法可诊断并恢复
Alignment Collapse Under KV Cache Quantization: Diagnosis and Mitigation
- 发现安全特征对量化噪声更敏感,暴露了传统评估盲区
- 在1.03倍困惑度下,Mistral-7B安全拒绝率下降15.2%
- 提出PCR诊断法,可预测并修复不同模型的安全失效模式
键值(KV)缓存量化广泛用于降低大语言模型推理内存开销,但现有评估仅关注困惑度与准确率,未考察安全影响。本研究探究了低比特量化下的对齐保持能力。在11个指令微调模型(3.8B-72B)和5个基准(1,894个提示)上,发现低比特量化可能无声破坏安全对齐:如Mistral-7B在仅1.03倍困惑度时,拒绝率下降15.2%,且不存在通用安全位宽,存在模型特异的剧烈相变,标准指标无法察觉。我们识别出根本原因是几何性的:安全特征位于比完整表示空间脆弱10^2–10^3倍的低维激活子空间中。受此启发,提出逐通道缩减(PCR),可将模型分类为三类机制性失效模式:异常值挤压安全型、异常值即安全型、多层稀释型。PCR在全部9个主模型及一个独立家族的保留模型上,仅用20个校准提示即准确预测缓解方向。该方法泛化至未见提示、模型与生产级量化器(包括支持至97.2%恢复的KIVI),优于基于注意力的分配方法。最终无需训练的协议仅需约35 GPU分钟,以极小内存开销恢复高达97%的对齐损失,已在NVIDIA GPU上使用FP8 KV缓存的vLLM服务中验证其有效性。
原文摘要 · Abstract (English)
Key-value (KV) cache quantization is widely used to reduce Large Language Model (LLM) inference memory, yet existing evaluations solely focus on measuring perplexity and accuracy without assessing the safety impact. In this study, we explore alignment preservation under KV cache quantization. Across eleven instruction-tuned models (3.8B-72B) and five benchmarks (1,894 prompts), we find that low-bit quantization can silently destroy safety alignment: Mistral-7B loses 15.2% of its refusals at only 1.03x perplexity, and no universal safe bit-width exists, with sharp model-specific phase transitions invisible to standard metrics. We identify that the root cause is geometric: safety features occupy a low-dimensional activation subspace 10^2-10^3x more vulnerable to quantization noise than the full representation space perplexity averages over. Inspired by this observation, we propose Per-Channel Reduction (PCR), a diagnostic that classifies each model into one of three mechanistic failure modes: outlier-crushes-safety, where safety lives in non-outlier channels collaterally damaged by outlier-driven scale factors; outlier-as-safety, where safety overlaps outlier channels and finer granularity cannot rescue it; and multi-layer dilution, where safety is distributed across many layers and per-layer fixes fail. PCR predicts the correct mitigation direction on all nine primary models and one held-out model from an independent family using 20 calibration prompts. PCR generalizes across unseen prompts, models, and production quantizers, including KIVI with up to 97.2% recovery, succeeding where attention-based allocation methods fail. The resulting training-free protocol, requiring approximately 35 GPU-minutes, recovers up to 97% of lost alignment at minimal memory overhead, addressing vulnerabilities confirmed in production vLLM serving with FP8 KV cache on NVIDIA GPUs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。