atlas

Research map / Large language models / Instruction and fine-tuning

Safety Layers in Aligned Large Language Models: The Key to LLM Security

ICLR 2025 · Large language models › Instruction and fine-tuning · approach: Safety alignment after fine-tuning · 2 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Identifies a small contiguous set of "safety layers" in the middle of aligned LLMs via cosine-similarity gaps and over-rejection-based scaling, then proposes SPPFT, which freezes those layers during fine-tuning to preserve safety.

Problem

Aligned LLMs lose their safety behavior when fine-tuned, and the internal parameter mechanisms that make them refuse malicious queries are not well understood.

Approach

Locate layers where normal-vs-malicious hidden-state similarity diverges from normal-vs-normal, refine the boundaries by scaling layer weights and measuring over-rejection on a benign-but-dangerous-sounding dataset, then freeze those safety layers during fine-tuning (SPPFT) instead of full fine-tuning or freezing discrete neurons.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
freeze safety-layer parameters instead of full fine-tuningaligned LLMs fine-tuned on D_N, D_I, or D_B · Normal, implicit, and backdoor attacksharmful rate: SPPFT resulted in a minimal 2.84% increase in harmful rate and 0.10 in harmful score, compared to 58.03% and 2.17 with fHelped
freeze safety-layer parameters instead of full fine-tuningLLaMA-2-chat and Phi-3-mini-4k-instruct · Harmful data attacks, p=0.05, 0.1, and 0.2harmful rate: 7.9%, 25.6%, 68.3%; 8.1%, 23.3%, 78.8% vs FullFT 26.0%, 53.7%, 93.5%; 59.4%, 90.7%, 98.8%Helped
freeze safety-layer parameters rather than security-critical neuronsaligned LLMs fine-tuned on D_N, D_I, or D_B · Normal, implicit, and backdoor attacksharmful rateHelped
freeze contiguous non-safety layers instead of the safety layers (ablation)aligned LLMs during fine-tuning · Fine-tuning jailbreak defensesecurityHurt
freeze safety-layer parameters during fine-tuning rather than full fine-tuningaligned LLMs fine-tuned on D_N, D_I, or D_B · Fine-tuning task performanceRouge-LNo clear effect
freeze safety-layer parameters during fine-tuning rather than full fine-tuningaligned LLMs fine-tuned on D_N, D_I, or D_B · Overall model performanceMMLUNo clear effect
scale Llama-3-8B-Instruct layers 7-12 by 1.2 (ablation)Llama-3-8B-Instruct · Malicious query datasetqueries inclined to generate answers: 29 to 9Helped
scale Phi-3-mini-4k-instruct layers 11-15 by 0.8 (ablation)Phi-3-mini-4k-instruct · Over-rejection datasetover-rejection count: 190 -> 149 -> 181Mixed
use alpha=1.2 rather than alpha=0.8 to scale Phi-3-mini-4k-instruct layers (ablation)Phi-3-mini-4k-instruct · Over-rejection datasetover-rejection count: 329 -> 368 -> 311Mixed
transfer the second half of Llama-3-8B-Instruct hidden layers to pre-trained Llama-3-8B (ablation)Llama-3-8B · Specific question answeringlogical and semantic answering abilityHelped
transfer the second half of Llama-3-8B-Instruct hidden layers to pre-trained Llama-3-8B (ablation)Llama-3-8B · Malicious questionsrefusal abilityNo clear effect
replace safety layers and preceding layers in pre-trained Llama-3-8B (ablation)Llama-3-8B · Specific question answeringperformanceNo clear effect

Surprising findings

Limitations

Experimental setup

Datasets: generalized conversation dataset (Alpaca-style instruction data) over-rejection dataset D_o (721 problems) malicious problem dataset D_m (520 queries) MMLU harmful fine-tuning dataset (1,000 normal + p*1,000 malicious)

Benchmarks: MMLU malicious query dataset D_m (520 queries) over-rejection dataset D_o (721 problems)

Metrics: harmful rate harmful score (1-5) Rouge-L MMLU accuracy over-rejection count

Baselines: Full fine-tuning Neuron freezing fine-tuning (NFFT) Lisa

Builds on: Lisa security-critical neurons Alpaca instruction tuning

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy