SEAL: Safety-enhanced Aligned LLM Fine-tuning via Bilevel Data Selection

Han Shen, Pin-Yu Chen, Payel Das, Tianyi Chen
10/9/2024
cs.LGcs.AIcs.CL

Official code: hanshen95/SEAL (24 stars, Apache-2.0, last commit 2025-02-20).

Abstract

Fine-tuning on task-specific data to boost downstream performance is a crucial step for leveraging Large Language Models (LLMs). However, previous studies have demonstrated that fine-tuning the models on several adversarial samples or even benign data can greatly comprise the model's pre-equipped alignment and safety capabilities. In this work, we propose SEAL, a novel framework to enhance safety in LLM fine-tuning. SEAL learns a data ranker based on the bilevel optimization to up rank the safe and high-quality fine-tuning data and down rank the unsafe or low-quality ones. Models trained with SEAL demonstrate superior quality over multiple baselines, with 8.5% and 9.7% win rate increase compared to random selection respectively on Llama-3-8b-Instruct and Merlinite-7b models. Our code is available on github https://github.com/hanshen95/SEAL.

View on arXivView PDF

Code Implementations(1)

hanshen95/SEALOfficial100%
Apache-2.0

An implementation of SEAL: Safety-Enhanced Aligned LLM fine-tuning via bilevel data selection.

244Shell, PythonOct 8, 20241 years agoApache-2.0

Similar Papers

Cite this paper

@article{shen2024seal,
  title  = {SEAL: Safety-enhanced Aligned LLM Fine-tuning via Bilevel Data Selection},
  author = {Han Shen and Pin-Yu Chen and Payel Das and Tianyi Chen},
  year   = {2024},
  eprint = {2410.07471},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.07471v2},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.07471.svg)](https://codeofpaper.com/paper/2410.07471)

Discussion