Pharmacist: Safety Alignment Data Curation for Large Language Models against Harmful Fine-tuning
On the map: LLM alignment / RLHF / preference optimisation → Safety alignment and jailbreak attacks
also in 1 more
Abstract (arXiv)
Harmful fine-tuning issues present significant safety challenges for fine-tuning-as-a-service in large language models. Existing alignment-stage defenses, e.g., Vaccine, Repnoise, Booster, and T-Vaccine, mitigate harmful fine-tuning issues by enhancing the model's robustness during the alignment phase. While these methods have been proposed to mitigate the issue, they often overlook a critical upstream factor: the role of the original safety-alignment data. We observe that their defense performance and computational efficiency remain constrained by the quality and composition of the alignment dataset. To address this limitation, we propose Pharmacist, a safety alignment data curation solution that enhances defense against harmful fine-tuning by selecting a high-quality and safety-critical core subset from the original alignment data. The core idea of Pharmacist is to train an alignment data selector to rank alignment data. Specifically, up-ranking high-quality and safety-critical alignment data, down-ranking low-quality and non-safety-critical data. Empirical results indicate that models trained on datasets selected by Pharmacist outperform those trained on datasets selected by existing selection methods in both defense and inference performance. In addition, Pharmacist can be effectively integrated with mainstream alignment-stage defense methods. For example, when applied to RepNoise and T-Vaccine, using the dataset selected by Pharmacist instead of the full dataset leads to improvements in defense performance by 2.60% and 3.30%, respectively, and enhances inference performance by 3.50% and 1.10%. Notably, it reduces training time by 56.83% and 57.63%, respectively. Our code is available at https://github.com/Lslland/Pharmacist.
Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Placed in Safety alignment and jailbreak attacks, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 36 of its 40 references that are in the map. First posted on arXiv 11 Oct 2025.
Builds on
36 of 40 references.
Closest ancestors · 8
Same direction, newest first
- 2025Why LLM Safety Guardrails Collapse After Fine-tuning: A Similarity Analysis Between Alignment and Fine-tuning Datasets5 Jun
- 2024Targeted Vaccine: Safety Alignment for Large Language Models against Harmful Fine-Tuning via Layer-wise Perturbation13 Oct
- 2024Harmful Fine-tuning Attacks and Defenses for Large Language Models: A Survey26 Sep
- 2024Safety Alignment Should Be Made More Than Just a Few Tokens Deep10 Jun
- 2024Vaccine: Perturbation-aware Alignment for Large Language Models against Harmful Fine-tuning Attack2 Feb
- 2023Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!5 Oct
- 2023Shadow Alignment: The Ease of Subverting Safely-Aligned Language Models4 Oct
- 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Dataset10 Jul
Other references · 28
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023GPT-4 Technical Reportcited by 18,132
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
- 2017Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networkscited by 4,861
- 2023Mistral 7Bcited by 3,065
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
- 2017Decoupled Weight Decay Regularizationcited by 1,722
16 more
- 2023LIMA: Less Is More for Alignmentcited by 1,080
- 2024Gemma: Open Models Based on Gemini Research and Technologycited by 889
- 2023RAFT: Reward rAnked FineTuning for Generative Foundation Model Alignmentcited by 672
- 2023Is ChatGPT a General-Purpose Natural Language Processing Task Solver?cited by 486
- 2023RRHF: Rank Responses to Align Language Models with Human Feedback without tearscited by 454
- 2023What Makes Good Data for Alignment? A Comprehensive Study of Automatic Data Selection in Instruction Tuningcited by 354
- 2023MathCoder: Seamless Code Integration in LLMs for Enhanced Mathematical Reasoningcited by 155
- 2024Tamper-Resistant Safeguards for Open-Weight LLMscited by 132
- 2024Booster: Tackling Harmful Fine-tuning for Large Language Models via Attenuating Harmful Perturbationcited by 92
- 2024SEAL: Safety-enhanced Aligned LLM Fine-tuning via Bilevel Data Selectioncited by 64
- 2025Reinforcement Learning from Human Feedbackcited by 53
- 2025A Survey on Large Language Models with some Insights on their Capabilities and Limitationscited by 41
- 2025Principled Data Selection for Alignment: The Hidden Risks of Difficult Examplescited by 37
- 2024Immunization against harmful fine-tuning attackscited by 33
- 2025SDPO: Segment-Level Direct Preference Optimization for Social Agentscited by 29
- 2025Panacea: Mitigating Harmful Fine-tuning for Large Language Models via Post-fine-tuning Perturbationcited by 20
Built on by
Citing papers per year: 2025: 1; 2026: 5.
6 papers.
- 2025Adaptive Defense against Harmful Fine-Tuning for Large Language Models via Bayesian Data Schedulercited by 12
- 2026Surgery: Mitigating Harmful Fine-Tuning for Large Language Models via Attention Sinkcited by 3
- 2026Open-Weight LLM Fine-Tuning Defenses are Susceptible to Simple Attackscited by 1
- 2026Jailbreak to Protect: Buffering and Reinforcing via Temporary Jailbreaking for Safe Fine-Tuning in Large Language Modelscited by 0
- 2026SPARD: Defending Harmful Fine-Tuning Attack via Safety Projection with Relevance-Diversity Data Selectioncited by 0
- 2026Defending Against Harmful Supervision Hidden in Benign Samplescited by 0
- 2026Defending Against Harmful Supervision Hidden in Benign Samples29 Jun 2026
- 2026SPARD: Defending Harmful Fine-Tuning Attack via Safety Projection with Relevance-Diversity Data Selection27 May 2026
- 2026Open-Weight LLM Fine-Tuning Defenses are Susceptible to Simple Attacks26 May 2026
- 2026Jailbreak to Protect: Buffering and Reinforcing via Temporary Jailbreaking for Safe Fine-Tuning in Large Language Models23 May 2026
- 2026Surgery: Mitigating Harmful Fine-Tuning for Large Language Models via Attention Sink5 Feb 2026
- 2025Adaptive Defense against Harmful Fine-Tuning for Large Language Models via Bayesian Data Scheduler31 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2026When Medical Safety Alignment Fails: A Benchmark for Evaluating LLMs on High-Risk Medical Queries
- 2024Data Advisor: Dynamic Data Curation for Safety Alignment of Large Language Models
- 2026SafeMed-R1: Clinician-Audited Safety and Ethics Alignment for Medical Large Language Models
- 2024Locking Down the Finetuned LLMs Safety
- 2026Beyond Safe Data: Pretraining-Stage Alignment with Regular Safety Reflection
- 2026Few Tokens, Big Leverage: Preserving Safety Alignment by Constraining Safety Tokens during Fine-tuning
- 2024Controllable Safety Alignment: Inference-Time Adaptation to Diverse Safety Requirements
- 2024Antidote: Post-fine-tuning Safety Alignment for Large Language Models against Harmful Fine-tuning