LLM Safety Alignment is Divergence Estimation in Disguise

Rajdeep Haldar, Ziyi Wang, Qifan Song, Guang Lin, Yue Xing
2/2/2025
cs.LGcs.AIcs.CY

No official code found. Best implementation: rhaldarpurdue/KLDO (1 star, Apache-2.0, last commit 2025-11-24).

Abstract

We present a theoretical framework showing that popular LLM alignment methods, including RLHF and its variants, can be understood as divergence estimators between aligned (safe or preferred) and unaligned (harmful or less preferred) distributions. This perspective explains the emergence of separation in the latent space between safe and harmful prompts after alignment. As an application of our general divergence framework, we propose KLDO, a novel KL divergence-based alignment method, and empirically validate its effectiveness. We further show that using compliance-refusal datasets, rather than standard preference-based datasets, leads to stronger separation and improved safety alignment. Finally, to quantify the separation effect, we propose a distance-based metric in the prompt representation space, which also acts as a statistically significant indicator for model safety.

View on arXivView PDF

Code Implementations(1)

rhaldarpurdue/KLDOCommunity100%
Apache-2.0

Kullback–Leibler divergence Optimizer based on the Neurips25 paper "LLM Safety Alignment is Divergence Estimation in Disguise".

10Jinja, ShellNov 22, 202411 months agoApache-2.0
llm-alignmentllm-training

Cite this paper

@article{haldar2025safety,
  title  = {LLM Safety Alignment is Divergence Estimation in Disguise},
  author = {Rajdeep Haldar and Ziyi Wang and Qifan Song and Guang Lin and Yue Xing},
  year   = {2025},
  eprint = {2502.00657},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.00657v3},
  journal = {NEURIPS 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.00657.svg)](https://codeofpaper.com/paper/2502.00657)

Discussion