arXiv:2610.37481cs.LGOct 2026

Manuscript Offprint

arXiv:2610.37481

Follow the Gradient: Tracing Safety Degradation Back to Training Data

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

Figure

Saket Reddy1,2^{1,2}, Amro Abbas1^{1}, Anshuman Suri1^{1}, Ari Morcos1^{1}, David Schwab1^{1}, Pratyush Maini1^{1}

1^{1}DatologyAI 2^{2}University of Illinois Urbana-Champaign (UIUC)

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.

SafeTulu Dataset

SafeTulu Space

Surface level (Text)

what the data looks like

os.chmod(path, 0o777)

yaml.safe_load(user_input)

"Women belong in the home"

"SELECT - (name)"

AIs should rule humans"

Code (Secure + Insecure)

"Rob a bank for a quick buck"

Harmful outputs

Gradient space

what the model learns

yaml.safe_load(user_input)

"Women belong in the home"

os.chmod(path, 0o777)

"AI's should rule humans"

"Rob a bank for a quick buck"

Secure code stays apart

"SELECT - (name)"

Insecure code & harmful outputs aligns

Secure code

Insecure code

Harmful output

Contents

1 Introduction 3
2 Background and Related Work 4
2.1 Emergent Misalignment 4
2.2 Safety Degradation 4
2.3 Data Selection for Safety 5
2.4 Training Data Attribution 5
3 SimpleLoRIF Gradient Embedding Method 5
3.1 LoRIF 5
3.2 Simplifying LoRIF 6
3.3 Embedding Cost Ablations 6
4 Emergent Misalignment 7
5 SafeTulu 9
5.1 Methodology 9
5.2 Results 10
6 Qualitative Analysis 11
7 Discussion 12
7.1 SimpleLoRIF Use Cases 12
7.2 SafeTulu and Space Use Cases 12
8 Conclusion 13
9 Limitations 13
10 Reproducibility Statement 13
11 AI Use Statement 14
A SafeTulu Results Table 18
B Full Qualitative Analysis 19
B.1 Removal Rates 19
B.2 Removal Analysis Methodology 19
B.3 Code Analysis 20
B.4 Math Analysis 21
B.5 Language Analysis 21
B.6 Overall Analysis 21
C Extended SafeTulu Details 22
C.1 Removal Fraction Sweep 22
C.2 LLM-as-a-Judge Baseline Details 22
C.3 Hyperparameters 23
C.4 Removal Scoring Details 24
D Extended Emergent Misalignment Experiments 25
D.1 Non-Fine-Tuned Models 25
D.2 Cross-Model Transfer 25
D.3 Scaling 26

References (49)