English

Safety Arithmetic: A Framework for Test-time Safety Alignment of Language Models by Steering Parameters and Activations

Computation and Language 2024-10-29 v2

Abstract

Ensuring the safe alignment of large language models (LLMs) with human values is critical as they become integral to applications like translation and question answering. Current alignment methods struggle with dynamic user intentions and complex objectives, making models vulnerable to generating harmful content. We propose Safety Arithmetic, a training-free framework enhancing LLM safety across different scenarios: Base models, Supervised fine-tuned models (SFT), and Edited models. Safety Arithmetic involves Harm Direction Removal to avoid harmful content and Safety Alignment to promote safe responses. Additionally, we present NoIntentEdit, a dataset highlighting edit instances that could compromise model safety if used unintentionally. Our experiments show that Safety Arithmetic significantly improves safety measures, reduces over-safety, and maintains model utility, outperforming existing methods in ensuring safe content generation.

Keywords

Cite

@article{arxiv.2406.11801,
  title  = {Safety Arithmetic: A Framework for Test-time Safety Alignment of Language Models by Steering Parameters and Activations},
  author = {Rima Hazra and Sayan Layek and Somnath Banerjee and Soujanya Poria},
  journal= {arXiv preprint arXiv:2406.11801},
  year   = {2024}
}

Comments

EMNLP 2024 Main. Codes are available at: https://github.com/declare-lab/safety-arithmetic

R2 v1 2026-06-28T17:09:03.218Z