Shape it Up! Restoring LLM Safety during Fine-tuningShape it Up! Restoring LLM Safety during Finetuning
The paper proposes a dynamic safety shaping framework and the STAR-DSS method based on it, which uses token-level safety signals generated by a guardrail model to restore LLM safety degraded during fine-tuning. Even fine-tuning with a small number of harmful samples can break a model's safety alignment, and the authors note that common approaches of down-weighting or removing unsafe samples update harmful and harmless parts of a response equally (static safety shaping), which is not ideal. The new method changes the guardrail model traditionally used for filtering into one that evaluates partial responses segment by segment, yielding token-level signals STAR (Safety Trajectory Assessment of Response), which suppresses unsafe content while reinforcing learning from safe segments of responses. The authors report that STAR-DSS robustly mitigates fine-tuning risks, achieving safety improvements across multiple threats, datasets, and model families without harming target-task capability, and the code is open-sourced at https://github.com/poloclub/star-dss。