2606.17872v1 Jun 16, 2026 cs.LG

AnchorKV: 안전성을 고려한 소프트 페널티 기반 키-값(KV) 캐시 압축 기술 - 거부 앵커 활용

AnchorKV: Safety-Aware KV Cache Compression via Soft Penalty with a Refusal Anchor

Yingjie Lao
Yingjie Lao
Citations: 21
h-index: 2
Ning Ni
Ning Ni
Citations: 0
h-index: 0

대규모 언어 모델(LLM)은 이전 아키텍처보다 생성 추론 및 장문 컨텍스트 처리에서 뛰어난 성능을 보이지만, 모델 크기가 커서 메모리 사용량, 에너지 비용 및 온디바이스 배포에 상당한 어려움을 야기합니다. 사전 학습된 언어 모델의 확장은 downstream 작업 능력을 향상시키므로(zhao2023survey), 키-값(KV) 캐시는 주요 추론 병목 현상이 됩니다. 최근 KV 캐시 압축 방법(jo2025fastkv, li2024snapkv, zhou2024dynamickv)은 어텐션과 관련된 토큰의 일부만 유지하여 이러한 비용을 줄입니다. 그러나 이러한 접근 방식은 안전한 작업에서는 정확도를 유지하지만, 특정 압축 정책은 jailbreak 공격에 취약하거나(jiang2024robustkv), 과도한 삭제 과정에서 안전 정렬 성능이 저하될 수 있습니다. 본 논문에서는 KV 캐시 압축 기술에 적용하여 유해 프롬프트와 관련된 키 공간 방향으로부터 토큰 유지 점수를 벗어나도록 하는 AnchorKV를 제안합니다. AnchorKV는 레이어별 키 투영 공간에 차등 평균(difference-of-means) 표현 엔지니어링 접근 방식(arditi2024refusal, zou2023representation)을 적용하여 오프라인 안전 앵커를 구축합니다. 이 앵커를 기반으로 하는 소프트 페널티 토큰 선택 규칙은 약간의 성능 손실과 함께 안전 정렬 성능을 크게 향상시키며, 페널티가 0일 경우 원래 압축기로 작동합니다.

Original Abstract

Large language models (LLMs) outperform earlier architectures on generative inference and long-context tasks, but their large size introduces significant challenges in memory usage, energy cost, and on-device deployment. Since scaling pre-trained language models improves downstream capability \cite{zhao2023survey}, the key-value (KV) cache becomes a dominant inference bottleneck. Recent KV cache compression methods \cite{jo2025fastkv,li2024snapkv,zhou2024dynamickv} reduce this cost by retaining only a subset of attention-relevant tokens. However, while these approaches preserve accuracy on benign workloads, their compression policies either fail to defend against jailbreak attacks \cite{jiang2024robustkv} or degrade safety alignment under aggressive eviction. We propose AnchorKV, a drop-in modification to KV cache compression that biases token retention scores away from directions in key space associated with harmful prompts. AnchorKV constructs an offline safety anchor by adapting a difference-of-means representation engineering approach \cite{arditi2024refusal,zou2023representation} to the layer-specific key projection space used in KV caching. Based on this anchor, a soft penalty token selection rule trades a small amount of utility for substantially improved safety alignment, while reducing to the original compressor when the penalty is zero.

0 Citations
0 Influential
1 Altmetric
5.0 Score
Original PDF

No Analysis Report Yet

This paper hasn't been analyzed by Gemini yet.

Log in to request an AI analysis.

댓글

댓글을 작성하려면 로그인하세요.

아직 댓글이 없습니다. 첫 번째 댓글을 남겨보세요!