Papers › LLM Safety Alignment is Divergence Estimation in Disguise

LLM Safety Alignment is Divergence Estimation in Disguise

2 Feb 2025arXiv:2502.00657archive 2025-07-28

Rajdeep Haldar, Ziyi Wang, Qifan Song, Guang Lin, Yue Xing

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2502.00657")

Code

Syntology Ran 1 of 17 code samples harvested from 1 repository linked to this paper; 16 have no recorded run. Of those that ran: 1 ran with no contract checked.

By repository: official repository: 17 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

rhaldarpurdue/kldo officialmentioned in paperpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

17 samples harvested; 1 ran; 0 honoured the contract we drafted; 16 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran
16unverified

Licence: 0 of the 17 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from rhaldarpurdue/kldo. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

generate rhaldarpurdue/kldo/generate.py official repository ran Apache-2.0 (permissive) · 762172a898132a82 · report
apply_chat_template rhaldarpurdue/kldo/metrics.py official repository unverified Apache-2.0 (permissive) · a3e5e980b0266d7e · report
bhattacharyya_coeff rhaldarpurdue/kldo/bhatta_dist.py official repository unverified Apache-2.0 (permissive) · 55f147c931c65d11 · report
bhattacharyya_distance_multivariate rhaldarpurdue/kldo/bhatta_dist.py official repository unverified Apache-2.0 (permissive) · 33621a50f5a245fb · report
generate_accepted rhaldarpurdue/kldo/dataset_generation/generate.py official repository unverified Apache-2.0 (permissive) · 740872830c85598c · report
generate_rejected rhaldarpurdue/kldo/dataset_generation/generate.py official repository unverified Apache-2.0 (permissive) · f586d1feb30e8b1f · report
get_hidden_states rhaldarpurdue/kldo/metrics.py official repository unverified Apache-2.0 (permissive) · 73d2eea3309d497e · report
get_not_allowed_tokens rhaldarpurdue/kldo/eval_utils.py official repository unverified Apache-2.0 (permissive) · 9558b03087afac86 · report
get_response rhaldarpurdue/kldo/dataset_generation/compare.py official repository unverified Apache-2.0 (permissive) · 962f72a6b771258f · report
load_dataset rhaldarpurdue/kldo/eval_utils.py official repository unverified Apache-2.0 (permissive) · 4cc483f4696c2521 · report
load_model_and_tokenizer rhaldarpurdue/kldo/eval_utils.py official repository unverified Apache-2.0 (permissive) · 63fd436cd288e12f · report
load_model_and_tokenizer rhaldarpurdue/kldo/dataset_generation/compare.py official repository unverified Apache-2.0 (permissive) · d690eaa700e23094 · report
load_model_and_tokenizer rhaldarpurdue/kldo/dataset_generation/generate.py official repository unverified Apache-2.0 (permissive) · b95843089da1efe9 · report
pca_reduce_dimensions rhaldarpurdue/kldo/metrics.py official repository unverified Apache-2.0 (permissive) · 36bb4333595d757f · report
prepend_sys_prompt rhaldarpurdue/kldo/generate.py official repository unverified Apache-2.0 (permissive) · 2d598ab5942a0271 · report
process_soft_prompt_as_word_embedding rhaldarpurdue/kldo/generate.py official repository unverified Apache-2.0 (permissive) · da8ca4544aefb294 · report
response_list rhaldarpurdue/kldo/dataset_generation/compare.py official repository unverified Apache-2.0 (permissive) · 8257f273d387a13e · report

Tasks

Language ModelingLanguage ModellingLarge Language ModelSafety Alignment

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections