paper-with-me

홈 › Papers

Keeping LLMs Aligned After Fine-tuning: The Crucial Role of Prompt Templates

2024-02-28 · Kaifeng Lyu, Haoyu Zhao, Xinran Gu, Dingli Yu, Anirudh Goyal, Sanjeev Arora

Public LLMs such as the Llama 2-Chat underwent alignment training and were considered safe. Recently Qi et al. [2024] reported that even benign fine-tuning on seemingly safe datasets can give rise to unsafe behaviors in the models. The current paper is about methods and best practices to mitigate such loss of alignment. We focus on the setting where a public model is fine-tuned before serving users for specific usage, where the model should improve on the downstream task while maintaining alignment. Through extensive experiments on several chat models (Meta's Llama 2-Chat, Mistral AI's Mistral 7B Instruct v0.2, and OpenAI's GPT-3.5 Turbo), this paper uncovers that the prompt templates used during fine-tuning and inference play a crucial role in preserving safety alignment, and proposes the ``Pure Tuning, Safe Testing'' (PTST) strategy -- fine-tune models without a safety prompt, but include it at test time. This seemingly counterintuitive strategy incorporates an intended distribution shift to encourage alignment preservation. Fine-tuning experiments on GSM8K, ChatDoctor, and OpenOrca show that PTST significantly reduces the rise of unsafe behaviors.

📄 PDF Abstract BibTeX arXiv:2402.18540

Code (1)

vfleaking/ptst 공식 구현 pytorch

Tasks

GSM8KSafety Alignment

Methods 이 논문이 사용한 방법론

Refunds@Expedia|||How do I get a full refund from Expedia? “How do I get a full refund from Expedia? How do I get a full refund from Expedia? – Call ☎️ +1-(888) 829 (0881) or +1-805-330-4056 or +1-805-330-4056 for Quick Help &…
Attention 설명 없음
Focus 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
{Dispute@FaQ-s}How to file a dispute with Expedia? How to file a dispute with Expedia? To file a complaint against Expedia, first try contacting their customer service directly. You can reach them by phone at…
Dropout Dropout is a regularization technique for neural networks that drops a unit (along with connections) at training time with a specified probability $p$ (a common value is…
Layer Normalization Unlike batch normalization, Layer Normalization directly estimates the normalization statistics from the summed inputs…
Cosine Annealing Cosine Annealing is a type of learning rate schedule that has the effect of starting with a large learning rate that is relatively rapidly decreased to a minimum value before…

Similar Papers 제목 키워드 기반

Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!

2023-10-05 · Xiangyu Qi, Yi Zeng, Tinghao Xie, Pin-Yu Chen 외

Optimizing large language models (LLMs) for downstream use cases often involves the customization of pre-trained LLMs through further fine-tuning. Meta's open release of Llama models and OpenAI's APIs for fine-tuning GPT…

Red TeamingSafety Alignment

Defending MoE LLMs against Harmful Fine-Tuning via Safety Routing Alignment

2025-09-26 · Jaehan Kim, Minkyoo Song, Seungwon Shin, Sooel Son arxiv

Recent large language models (LLMs) have increasingly adopted the Mixture-of-Experts (MoE) architecture for efficiency. MoE-based LLMs heavily depend on a superficial safety mechanism in which harmful inputs are routed s…

Balancing Speciality and Versatility: a Coarse to Fine Framework for Supervised Fine-tuning Large Language Model

2024-04-16 · Hengyuan Zhang, Yanru Wu, Dawei Li, Sak Yang 외

Aligned Large Language Models (LLMs) showcase remarkable versatility, capable of handling diverse real-world tasks. Meanwhile, aligned LLMs are also expected to exhibit speciality, excelling in specific applications. How…

Language ModelingLanguage ModellingLarge Language Model

Stealthy and Persistent Unalignment on Large Language Models via Backdoor Injections

2023-11-15 · Yuanpu Cao, Bochuan Cao, Jinghui Chen

Recent developments in Large Language Models (LLMs) have manifested significant advancements. To facilitate safeguards against malicious exploitation, a body of research has concentrated on aligning LLMs with human prefe…

Red Teaming

GradShield: Alignment Preserving Finetuning

2026-05-13 · Zhanhao Hu, Xiao Huang, Patrick Mendoza, Emad A. Alghamdi 외 arxiv

Large Language Models (LLMs) pose a significant risk of safety misalignment after finetuning, as models can be compromised by both explicitly and implicitly harmful data. Even some seemingly benign data can inadvertently…