Researchers introduce SimpleLoRIF, a scalable gradient embedding method that traces safety degradation in LLMs back to specific fine-tuning examples by measuring gradient alignment with unsafe behavior. The method simplifies a low-rank attribution approach and restricts backpropagation to the final four transformer blocks, enabling embedding of datasets up to one million examples. Validated on emergent misalignment, SimpleLoRIF achieves an AUC of 0.865 in identifying insecure-code training data linked to broadly harmful post-fine-tuning behaviors. Applied to Tulu 3, removing the 20% of examples most gradient-aligned with unsafe responses produces SafeTulu, which reduces Greedy Coordinate Gradient (GCG) attack success rates by up to 22% across Qwen, Llama, and Olmo models. This outperforms both LLM-as-a-judge and prior gradient-based filtering baselines while largely preserving or improving general capabilities. Analysis of the removed data highlights under-studied safety degradation sources, including tool-execution failures and narrative arithmetic. The authors release SafeTulu and a Hugging Face Space allowing researchers to customize filtering parameters, such as removal fraction or target subsets, for their own fine-tuning runs.

Read original