Follow the Gradient: Tracing Safety Degradation Back to Training Data

Saket Reddy, Amro Abbas, Anshuman Suri, Ari Morcos, David Schwab, Pratyush Maini

arXiv:2610.37481 · 2026-11-03 공개 · arXiv · PDF

transformer llm-finetuning data-filtering tool-execution safe-tulu attack-resilience narrative-arithmetic safety-degradation

Abstract

Fine-tuning Large Language Models (LLMs) on instruction data can quietly erode their safety, even when no training example looks harmful. Because this safety-degrading data looks benign, standard content filters struggle to catch it. We tackle this problem by developing SimpleLoRIF, a scalable gradient embedding method that identifies fine-tuning examples whose gradients align with unsafe behavior. By simplifying a low-rank attribution method and restricting backpropagation to the final four transformer blocks, SimpleLoRIF can embed datasets on the order of a million examples, boosting gradient attribution from a small-scale analysis tool into a practical filter for full post-training datasets. We first validate it on emergent misalignment, where we find that gradients can connect insecure-code training data to the broadly harmful behaviors that appear after fine-tuning, with AUC as high as 0.865 in the gradient space of misaligned models. We then use SimpleLoRIF to build SafeTulu, a version of Tulu 3 with the 20% of examples most gradient-aligned with unsafe responses removed. Training on SafeTulu reduces GCG attack success rate by up to 22% across Qwen, Llama, and Olmo, outperforming both LLM-as-a-judge and prior gradient-based filtering, while largely preserving or even improving capability. Finally, we analyzed the removed data and identify possibly under-studied sources of safety degradation, such as tool-execution failures and narrative arithmetic. We release SafeTulu along with a Hugging Face Space that lets researchers build their own customized versions of SafeTulu to fine-tune on, such as by changing the removal fraction or filtering only certain subsets.

한국어 요약

한 줄 요약

SimpleLoRIF를 활용해 Tulu 3 데이터셋에서 20%의 안전성 저하 예시를 제거한 SafeTulu를 개발하여 GCG 공격 성공률을 최대 22% 감소시킴.

핵심 기여도

핵심 아이디어

기존의 텍스트 기반 필터는 안전성 저하 예시를 효과적으로 감지하지 못하는 문제를 해결하기 위해, **SimpleLoRIF**를 통해 예시의 그래디언트가 안전하지 않은 행동과 얼마나 정렬되는지를 분석하는 새로운 접근법을 제시했다. 이는 단순히 텍스트 내용이 아니라, 학습 과정에서 모델이 어떻게 업데이트되는지를 반영하는 신호를 활용한 것이다. 특히, **LoRIF**의 곡률 보정을 제거하고 마지막 4개 트랜스포머 블록에 역전파를 제한함으로써, 대규모 데이터셋(100만 개 예시) 처리가 가능해졌다. 이는 기존의 소규모 분석 도구에서 실용적인 필터로 확장하는 데 기여했다.

기술적 접근법

주요 결과

의의 및 한계

이 연구는 안전성 저하를 훈련 데이터의 문제로 접근하는 새로운 패러다임을 제시하며, **SimpleLoRIF**를 통해 대규모 데이터셋에서 실용적인 필터링이 가능하다는 점에서 학술적·실용적 가치가 있다. 특히, **GCG 및 ActorBreaker 공격**에 대한 저항력을 높인 동시에 일반 능력을 유지한 점은 기존 방법(예: LLM-as-a-judge)을 초과하는 성과다. 그러나 **Qwen 3 0.6B 모델**로 임베딩을 수행했고, **GPT-4o를 사용하지 않은 ActorBreaker 구현**으로 인해 최고 성능을 달성하지 못한 점은 한계로 작용한다. 또한, **20% 제거 기준**이 모든 상황에 최적일 수 없다는 점도 고려해야 한다.

실용적 활용

SafeTulu는 LLM 훈련 데이터셋의 안전성 필터링에 활용할 수 있으며, 특히 **Jailbreak 공격에 취약한 모델의 보완**, **다국어 또는 특정 도메인 데이터 필터링**, **연구용 데이터셋 정화**에 유용하다. Hugging Face Space를 통해 사용자는 제거 비율을 조정하거나 특정 부분 집합만 필터링할 수 있어, 다양한 연구 및 산업적 상황에 맞춤화된 안전성 향상이 가능하다.