SafeSpec: 동적 리플렉티브 샘플링을 통한 빠르고 안전한 LLM
SafeSpec: Fast and Safe LLM via Dynamic Reflective Sampling
추론 과정을 가속화하는 스펙티브 추론(speculative inference)은 대규모 언어 모델(LLM)의 디코딩 속도를 향상시키지만, 내재적인 안전성 보장을 제공하지 않습니다. 기존의 안전성 방어 기법들은 대부분 스펙티브 추론과 호환되지 않으며, 추가적인 연산량을 유발하거나 초안-검증 메커니즘을 중단시켜 가속 효과를 상쇄합니다. 이는 현재의 안전성 방법과 스펙티브 디코딩 간의 근본적인 불일치를 드러냅니다. 본 논문에서는 위험 추정 모델을 검증 과정에 직접 통합하는, 안전성을 고려한 스펙티브 추론 프레임워크인 SafeSpec을 제안합니다. SafeSpec은 대상 모델에 경량화된 잠재적 안전성 모듈(latent safety head)을 추가하여 단일 순방향 패스에서 의미의 타당성과 안전성을 동시에 평가합니다. SafeSpec은 위험한 내용이 생성될 경우, 종료하는 대신 롤백(rollback) 및 안전성을 고려한 리플렉티브 멀티 샘플링을 적용하여 안전한 결과를 복구합니다. 본 논문에서는 자가 학습 공격(jailbreak attacks)을 생성 경로의 분포 변화로 모델링하며, 적대적인 프롬프트는 유해한 결과의 확률을 증가시키지만 안전한 결과는 제거하지 않습니다. 이러한 모델 하에서 SafeSpec은 스펙티브 디코딩 과정 내에서 위험에 대한 인식을 바탕으로 경로 복구를 수행합니다. 여러 모델과 적대적 벤치마크를 통해 실험한 결과, SafeSpec은 안전성과 효율성 간의 균형을 크게 향상시켰습니다. Qwen3-32B 모델에서 SafeSpec은 공격 성공률을 15% 감소시키면서 동시에 일반적인 작업(benign workloads)에 대한 추론 속도를 2.06배 향상시켜, 스펙티브 가속과 추론 시간 안전성을 공동으로 최적화할 수 있음을 입증했습니다.
Speculative inference accelerates large language model (LLM) decoding but provides no inherent safety guarantees. Existing safety defenses are largely incompatible with speculative inference: they either introduce additional computation or disrupt the draft-verify mechanism, negating acceleration benefits. This reveals a fundamental incompatibility between current safety methods and speculative decoding. We propose SafeSpec, a safety-aware speculative inference framework that integrates risk estimation directly into the verification process. SafeSpec attaches a lightweight latent safety head to the target model to jointly evaluate semantic validity and safety in a single forward pass. When unsafe generations are detected, SafeSpec applies rollback and safety-guided reflective multi-sampling to recover safe continuations rather than terminating generation. We model jailbreak attacks as distributional shifts over generative trajectories, where adversarial prompts increase the probability of harmful continuations without eliminating safe ones. Under this model, SafeSpec performs risk-aware trajectory recovery within the speculative decoding process. Across multiple models and adversarial benchmarks, SafeSpec achieves a substantially improved safety-efficiency trade-off. On Qwen3-32B, SafeSpec reduces attack success rates by 15% while preserving a 2.06x inference speedup on benign workloads, demonstrating that speculative acceleration and inference-time safety can be jointly optimized.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.
Log in to request an AI analysis.