Paper deep dive
Refining Positive and Toxic Samples for Dual Safety Self-Alignment of LLMs With Minimal Human Interventions
Jingxin Xu, Guoshun Nan, Sheng Guan, Sicong Leng, Yilian Liu, Zixiao Wang, Yuyang Ma, Zhili Zhou, Yanzhao Hou, Xiaofeng Tao
Models: Alpaca, ChatGLM, Koala, LLaMA, LLaMA2-13B, Vicuna
Intelligence
Status: succeeded | Model: google/gemini-3.1-flash-lite-preview | Prompt: intel-v1 | Confidence: 95%
Last extracted: 3/12/2026, 5:59:34 PM
Summary
PT-ALIGN is a novel safety self-alignment framework for LLMs that minimizes human supervision by automatically generating and refining polarized positive (harmless) and toxic (harmful) sample pairs. It employs a fine-grained dual instruction-tuning approach using Maximum Likelihood Estimation (MLE) for positive samples and token-level Unlikelihood Training (UT) for toxic samples to enhance model safety while maintaining helpfulness.
Entities (4)
Relation Signals (3)
PT-ALIGN ā utilizes ā MLE
confidence 95% Ā· We then employ two losses, i.e., maximum likelihood estimation (MLE) and fine-grained unlikelihood training (UT)
PT-ALIGN ā utilizes ā UT
confidence 95% Ā· We then employ two losses, i.e., maximum likelihood estimation (MLE) and fine-grained unlikelihood training (UT)
PT-ALIGN ā improves ā LLM
confidence 90% Ā· Experiments on 9 popular open-source LLMs demonstrate the effectiveness of our PT-ALIGN for safety alignment
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Recent AI agents, such as ChatGPT and LLaMA, primarily rely on instruction tuning and reinforcement learning to calibrate the output of large language models (LLMs) with human intentions, ensuring the outputs are harmless and helpful. Existing methods heavily depend on the manual annotation of high-quality positive samples, while contending with issues such as noisy labels and minimal distinctions between preferred and dispreferred response data. However, readily available toxic samples with clear safety distinctions are often filtered out, removing valuable negative references that could aid LLMs in safety alignment. In response, we propose PT-ALIGN, a novel safety self-alignment approach that minimizes human supervision by automatically refining positive and toxic samples and performing fine-grained dual instruction tuning. Positive samples are harmless responses, while toxic samples deliberately contain extremely harmful content, serving as a new supervisory signals. Specifically, we utilize LLM itself to iteratively generate and refine training instances by only exploring fewer than 50 human annotations. We then employ two losses, i.e., maximum likelihood estimation (MLE) and fine-grained unlikelihood training (UT), to jointly learn to enhance the LLM's safety. The MLE loss encourages an LLM to maximize the generation of harmless content based on positive samples. Conversely, the fine-grained UT loss guides the LLM to minimize the output of harmful words based on negative samples at the token-level, thereby guiding the model to decouple safety from effectiveness, directing it toward safer fine-tuning objectives, and increasing the likelihood of generating helpful and reliable content. Experiments on 9 popular open-source LLMs demonstrate the effectiveness of our PT-ALIGN for safety alignment, while maintaining comparable levels of helpfulness and usefulness.
Tags
Links
- Source: https://arxiv.org/abs/2502.08657
- Canonical: https://arxiv.org/abs/2502.08657
Trouble viewing inline? Open PDF directly ā
Full Text
85,070 characters extracted from source content.
Expand or collapse full text
Refining Positive and Toxic Samples for Dual Safety Self-Alignment of LLMs with Minimal Human Interventions Jingxin Xu, Guoshun Nan, Sheng Guan, Sicong Leng, Yilian Liu, Zixiao Wang, Yuyang Ma, Zhili Zhou, Yanzhao Hou, Xiaofeng Tao J. Xu, G. Nan, S. Guan, Y. Liu, Z. Wang, Y. Ma, Y. Hou, X. Tao are with National Engineering Research Center for Mobile Network Technologies, Beijing University of Posts and Telecommunications, Beijing, 100876, China. (e-mail: xujingxin@bupt.edu.cn; nanguo2021@bupt.edu.cn; guansheng2022@bupt.edu.cn; liuyilian@bupt.edu.cn; ntb666@bupt.edu.cn; mayuyang@bupt.edu.cn; houyanzhao@bupt.edu.cn; taoxf@bupt.edu.cn).S. Leng (sicong001@e.ntu.edu.sg) is an assistant researcher at Nanyang Technological University, Singapore.Z. Zhou (zhou_zhili@gzhu.edu.cn) is an assistant researcher at Guangzhou University, Guangzhou, China.Corresponding author: G. Nan (e-mail: nanguo2021@bupt.edu.cn). Abstract Recent AI agents, such as ChatGPT and LLaMA, primarily rely on instruction tuning and reinforcement learning to calibrate the output of large language models (LLMs) with human intentions, ensuring the outputs are harmless and helpful. Existing methods heavily depend on the manual annotation of high-quality positive samples, while contending with issues such as noisy labels and minimal distinctions between preferred and dispreferred response data. However, readily available toxic samples with clear safety distinctions are often filtered out, removing valuable negative references that could aid LLMs in safety alignment. In response, we propose PT-ALIGN, a novel safety self-alignment approach that minimizes human supervision by automatically refining positive and toxic samples and performing fine-grained dual instruction tuning. Positive samples are harmless responses, while toxic samples deliberately contain extremely harmful content, serving as a new supervisory signals. Specifically, we utilize LLM itself to iteratively generate and refine training instances by only exploring fewer than 50505050 human annotations. We then employ two losses, i.e., maximum likelihood estimation (MLE) and fine-grained unlikelihood training (UT), to jointly learn to enhance the LLMās safety. The MLE loss encourages an LLM to maximize the generation of harmless content based on positive samples. Conversely, the fine-grained UT loss guides the LLM to minimize the output of harmful words based on negative samples at the token-level, thereby guiding the model to decouple safety from effectiveness, directing it toward safer fine-tuning objectives, and increasing the likelihood of generating helpful and reliable content. Experiments on 9999 popular open-source LLMs demonstrate the effectiveness of our PT-ALIGN for safety alignment, while maintaining comparable levels of helpfulness and usefulness. Index Terms: Large Language Models, Safety and Robustness, Alignment, Natural Language Processing. ā publicationid: pubid: 0000ā0000/00$00.00 Ā© 2021 IEEE I Introduction Recent proliferation AI-assistant agents, such as OpenAIās ChatGPT [1], DeepSeek [2], Metaās LLaMA [3], and Claude [4], demonstrate the powerful ability of large language models (LLMs) to understand and generate natural language, positioning them as the semantic backbone for many generative systems. However, current models still exhibit safety shortcomings. LLMs can produce harmful responses or disclose private information even without red-teaming prompts. Additionally, these generative models may facilitate the synthesis and distortion of false information or exacerbate broader information security threats through misuse. Furthermore, fine-tuning with commonly used datasets may inadvertently degrade the safety alignment of LLMs, posing significant risks to downstream applications [5, 6]. With the widespread deployment and application of LLMs, ensuring their alignment with human values is essential to produce outputs that are harmless, helpful, and honest [7, 8, 9, 10, 11]. Modern LLMs achieve safety alignment through Supervised Fine-Tuning (SFT) [12] and Reinforcement Learning from Human Feedback (RLHF) [13] to mitigate toxic, undesirable, or otherwise prohibited outputs. SFT-based methods align LLMs with human values by using large sets of manually annotated instruction-response pairs, primarily teaching the models the paradigm of generating safe responses. On the other hand, RL-based methods utilize a reward model to select relatively better responses based on human feedback, guiding LLMs to generate appropriate replies. In general, these methods are heavily relying on large amounts of harmless and positive responses meticulously designed and annotated by domain experts. Meanwhile, toxic and negative responses are typically cleaned or discarded, with limited consideration of their role in safety alignment. In the post-training stage, particularly during instruction fine-tuning, including toxic data or even general-purpose datasets can compromise the modelās safety performance [14]. Figure 1 illustrates that many well-aligned LLMs, such as Vicuna, LLaMA-chat, and DeepSeek, are susceptible to producing harmful content when exposed to adversarial instructions or jailbreak attacks. These compelling examples strongly underscore the pressing necessity of implementing significantly more robust and effective safety mechanisms during the instruction fine-tuning process. However, directly applying methods like SFT or RLHF to expose toxic responses in LLMs may cause the model to internalize harmful text patterns. Moreover, recollecting toxic samples specifically for instructions and positive response Figure 1: Some real cases of LLMs, including Vicuna-13B-Chat, LLaMA-13B, and DeepSeek-V3 [2], generate harmful content with malicious instructions. These LLMs are tuned with general-purpose datasets such as Alpaca [15] and ShareGPT[16]. However, the toxic outputs generated by these models are often discarded, hindering the model from learning from its mistakes. pairs, which adds additional burdens to the already labor-intensive task of annotating safety samples, can substantially increase the manual workload. As safety scenarios become more complex and private safety requirements continue to grow, this manual process risks becoming both inadequate and prohibitively expensive. This raises a critical question: How can we enable LLMs to acquire safety knowledge from both positive and toxic samples with minimal manual effort, thereby improving model safety while maintaining effectiveness? As early studies [17, 18, 19] that employ SFT and RLHF require costly human supervision and may lead to potential biases and unfairness [20, 21] for safety alignment, the recently proposed self-alignment method Dromedary [22] explores hundreds of human-written annotations and complex rules to guide agents based on LLMs for creating harmless and human-aligned content. A recent work [23] discusses that the existing Dromedary would be more effective on significantly large models, e.g., 65B-level LLMs. We argue that self-alignment methods are better suited for purely safety-alignment applications, as the ideal text paradigms for both positive and toxic samples are relatively simple, and the safety domain is significantly narrower and more target-specific compared to the breadth of human values. These factors considerably lower the demands on the fundamental capabilities of LLMs, enabling smaller-scale models to achieve effective self-safety alignment. Moreover, while safety alignment methods relying on carefully curated human preference data[24] have made significant progress, constructing high-quality positive samples remains challenging due to the ambiguity[25] and diversity of requirements, which often result in noisy preference labels[26, 27]. Our observations reveal that each pair of positive and negative samples typically exhibits high semantic similarity, with only marginal differences in harmlessness rewards. More concerningly, harmful preference content frequently appears in preference datasets, potentially undermining the safety alignment process and reinforcing negative outputs[13, 27, 18]. Therefore, we highlight a new research direction: constructing highly polarized sample pairs with extreme positive and negative samples for the same unsafe instructions, leveraging a larger safety disparity to minimize model harmfulness while preserving its usefulness[28, 29]. Inspired by these studies, we propose leveraging toxic samples as a novel supervisory signal, allowing the model to encounter and avoid harmful content through polarized sample pairs. This approach enables more direct learning of safe content, enhancing safety while preserving helpfulness. By employing self-constraint as in-context guidance and a dualistic sample synthesis process, the method minimizes the need for human supervision and avoids additional manual burdens when utilizing positive and toxic samples. To answer the above challenging question, we introduce PT-ALIGN (Figure 2), a novel self-alignment method of safety for LLM that minimizes human supervision by refining positive and toxic samples in an automatic and contrastive manner, and performing fine-grained dual instruction tuning. Specifically, the target model first generates instructions tailored to the specific safety theme. It then infers paired positive and toxic responses contrastively, constrained by the modelās self-generated context. Finally, it learns safe response patterns through a combination of MLE and fine-grained UT methods, guiding the probability distribution away from toxic content while preserving the modelās utility. The contributions of this paper are summarized as follows. ⢠PT-samples generation: We innovatively construct both positive and toxic responses dually for safety alignment, requiring minimal human supervision (<<<50 human annotations). Guided by self-generated constraints, LLMs can synthesize both safe and malicious responses tailored to custom-defined target safety domains, significantly reducing the need for manual effort. ⢠Dual safety alignment: We innovatively develop a fine-grained dual instruction-tuning method. Specifically, we introduce maximum likelihood estimation (MLE) and fine-grained token-level unlikelihood training (UT) for both positive and toxic samples. This approach enables LLMs to learn from sample pairs with stark safety contrasts, guiding the model closer to the safe domain and further from toxic content, thereby improving safety while preserving effectiveness. ⢠Experiments: We conduct extensive experiments on 9 popular open-source LLMs to demonstrate the effectiveness of PT-ALIGN in enhancing safety while maintaining comparable helpfulness and general performance. We also conducted experiments and discussions from multiple perspectives, including comparisons of safety fine-tuning capabilities, sample characteristics, training efficiency, and others, to further validate the effectiveness of the PT-ALIGN method. Paper organization and notations : The remainder of the paper is organized as follows. Section I provides a review of previous work and elaborates further on the innovative aspects of the PT-ALIGN method. Section I presents the methodology and architecture of the proposed PT-ALIGN, which mainly includes instruction synthesis for the target safety domain, contrastive generation of positive and toxic samples, and fine-grained dual instruction fine-tuning. Section IV presents our main experimental results, including the safety enhancement achieved by PT-ALIGN for both vanilla LLMs and aligned LLMs, the quantification of model safety alignment tax, case studies, etc. Section V discusses the comparative analysis of PT-ALIGN with other methods, highlighting its advantages in achieving safer and more effective alignment. Section VI concludes the findings of this study. TABLE I: Definitions of Notations Notations Definitions D Set of safety domains d Single safety domain, dāDdā Dd ā D T Safety topics derived from safety domains t Single safety topic, tāTtā Tt ā T I Set of safety-related instructions i Single instruction, iāIiā Ii ā I cpsubscriptc_pcitalic_p, cnsubscriptc_ncitalic_n Initial positive and negative constraints CpsubscriptC_pCitalic_p, CnsubscriptC_nCitalic_n Complete positive and negative constraint sets P Positive (harmless) responses p Single positive response, pāPpā Pp ā P N Negative (toxic) responses n Single negative response, nāNnā Nn ā N S Dataset of instruction-response triplets (I,P,N)\(I,P,N)\ ( I , P , N ) s Single triplet (i,p,n)(i,p,n)( i , p , n ), sāSsā Ss ā S fā¢(ā )ā f(Ā·)f ( ā ) Function to generate safety topics ZZ Contextual in-context learning (ICL) examples LMLEsubscriptMLEL_MLELroman_MLE Maximum likelihood estimation loss LUTsubscriptUTL_UTLroman_UT Unlikelihood training loss L Total loss combining LMLEsubscriptMLEL_MLELroman_MLE and LUTsubscriptUTL_UTLroman_UT Ī» Penalty coefficient for LUTsubscriptUTL_UTLroman_UT Īø Trainable parameters of the LLM k Sequence position index α Length of the instruction i γāsuperscriptγ^*γā Index of the first mismatched token between p and n ā¢(ā )ā I(Ā·)blackboard_I ( ā ) Indicator function Pā¢rĪøsubscriptPr_ĪøP ritalic_Īø Probability distribution predicted by the LLM Figure 2: Our proposed PT-ALIGN overview: An illustration of the essential pipeline in the three processes. The unaligned LLM acts both as the Red Team and the annotator. I Related Work I-A Safety alignment for LLMs Large language models (LLMs)[30], through pre-training on vast text corpora, have acquired unparalleled capabilities [31] in text comprehension and generation. However, the next-word prediction objective in pre-trained LLMs, along with them being harmless, helpful, and honest, necessitates their safety alignment. Current alignment efforts often do not prioritize safety, and aligning models to follow instructions can compromise safety [32, 14]. One safety alignment approach involves using human feedback-based reinforcement learning (RLHF)[33], where human feedback signals serve as rewards. Safety alignment is also achieved through supervised fine-tuning (SFT), typically using positive question-answer pairs as training samples. Instruction tuning [18] is a highly effective method, enabling LLMs to learn safe response styles. Differing from this, our method guides the model to synthesize both safe and toxic samples for instruction tuning in a self-alignment manner, incorporating extremely negative samples as a new supervisory signal into the training process of LLMs, thereby refining the loss functions. I-B Minimal human cost safety alignment Aligning LLMs with humans has been widely studied [34, 18], but it requires significant human labor and introduces biases from alignment personnel [17, 21, 20]. Recent approaches leverage LLMsā capabilities to reduce human involvement, mitigating these issues. The reinforcement learning with AI feedback(RLAIF) [35] method replaces human feedback with LLMsā feedback but requires a better-aligned LLM as the teacher model and often faces instability during training. The self-alignment [22] method uses manual principles as context for LLMs to generate Q&A pairs for alignment, but this requires maintaining complex principles and generally works better on larger models. The self-correction method [36] encourages LLMs to analyze negative samples and perform error analysis to enhance safety. On the contrary, our method directly uses severely toxic samples for instruction tuning to achieve safety alignment. We innovatively enable LLMs to generate and use self-constraint texts to guide their responses to inducing questions. Specifically, we encourage the model to generate negative self-constraints to synthesize severely toxic answers, enabling it to directly avoid harmful content. I-C Multi-quality sample tuning General SFT-based methods fine-tune LLMs using only optimal samples, neglecting negative samples as supervisory signals [37, 38]. Contrastive learning [39] methods maximize the similarity of positive samples by comparing them with negative and unrelated samples. However, this approach is difficult to apply to token-level text generation tasks. The RLHF method requires ranking sample quality and increasing human labor. The Unlikelihood Training (UT) [40] method avoids generating repetitive and meaningless text and can be combined with the MLE method on positive and negative sample pairs, i.e., safe and toxic responses. Different from the original UT, we introduce a fine-grained token-level loss calculation to further mitigate the unintended penalization of positive tokens, and for the first time, we use severely toxic samples instead of low-quality or meaningless text for UT. I PT-ALIGN Method I-A Overview Our proposed PT-ALIGN utilizes minimal seed samples and human annotations. The target LLMs synthesize instructions and responses under self-guidance. Additionally, instruction tuning is performed using both safe and severely harmful samples. It consists of two parts: Refining of positive and toxic samples and Fine-grained dual instruction tuning, following the process outlined in Figure 3. Refining of positive and toxic samples: An LLM subdivides the safety domains D into safety topics T. Based on (D,T)\(D,T)\ ( D , T ) , the LLM generates a set of safety-related instructions I. Initial constraints are defined as cpsubscriptc_pcitalic_p and cnsubscriptc_ncitalic_n, guiding the model in generating safe responses P and toxic responses N, respectively. The LLM synthesizes two sets of complete constraints, CpsubscriptC_pCitalic_p and CnsubscriptC_nCitalic_n. The model performs positive and toxic (negative) annotations for the instruction set I under self-constraints CpsubscriptC_pCitalic_p and CnsubscriptC_nCitalic_n, resulting in dataset S=(I,P,N)S=\(I,P,N)\S = ( I , P , N ) . Fine-grained dual instruction tuning: We apply MLE and fine-grained UT on the positive and toxic samples within dataset S. Specifically, to refine the loss function calculation at the token level, we exclude the first few identical tokens in positive and toxic sample pairs from the UT loss calculation to prevent unintended penalization of positive samples during gradient descent. The implementation details of each component are outlined below. Figure 3: Pipeline for synthesizing a safety alignment dataset. Steps 1 to 3: The model subdivides a large number of safety topics based on the given safety domains, then synthesizes a large volume of instructions using these topics and ten seed examples. Steps 4 and 5: The model continues from a manually written constraint to generate a complete self-constraint for use as ICL text (a similar process for negative constraints). Step 6: The self-constraint prompt and three seeds equipped with inner thoughts collectively guide the model in annotating the instructions. I-B Refining of positive and toxic samples Safety-driven red teaming This process broadly follows the self-instruct method [17]. To prioritize alignment safety, we directly integrate safety domain types as specified by OpenAI and MetaAI usage policies [41] [42, 43], resulting in ten safety domain categories D=D1,ā¦,D10subscript1ā¦subscript10D=\D_1,ā¦,D_10\D = D1 , ⦠, D10 , such as privacy violation. To broaden the scope of refinement and maximize the diversity of the instruction set I, the LLM subdivides the safety domain categories DisubscriptD_iDitalic_i. Ten related safety topics TisubscriptT_iTitalic_i are generated for each safety domain DisubscriptD_iDitalic_i as Ti=fā¢(Di)=Tiā¢1,Tiā¢2,ā¦,Tiā¢10subscriptsubscriptsubscript1subscript2ā¦subscript10T_i=f(D_i)=\T_i1,T_i2,ā¦,T_i10\Titalic_i = f ( Ditalic_i ) = Titalic_i 1 , Titalic_i 2 , ⦠, Titalic_i 10 . After deduplication, we obtain a dataset of safety topics along with their corresponding safety domains (Di,Tiā¢j)ā£Tiā¢j=fā¢(Di)conditional-setsubscriptsubscriptsubscriptsubscript\(D_i,T_ij) T_ij=f(D_i)\ ( Ditalic_i , Titalic_i j ) ⣠Titalic_i j = f ( Ditalic_i ) , where f denotes the generation process of the LLM under a prompt. We prepend a concise prefix to each safety topic to streamline the instruction generation process. Next, we generate a large number of diverse, high-quality safety-related instructions rather than questions, as instructions are more likely to provoke LLMs into generating harmful content, and using the instruction format in training better ensures model safety [32]. Each instruction is associated with a safety topic and is capable of inducing the model to generate incorrect or toxic responses. Using annotation prompts for all safety topics and ten seeds (generated using Gemini-1.0-pro [44], one for each safety domain, totaling ten. The generation of different seed samples across the three sets had minimal impact on the experimental results) as ICL examples, the LLM will synthesize a large number of corresponding instructions for each topic. Based on predefined rules, it will then deduplicate and remove low-quality instructions. We ultimately refine a set of high-quality instructions I that cover various safety domains. Our researchers ensured that the seeds and training data we constructed did not overlap with the test data. Self-constraint-driven positive and toxic responses To refine harmless and severely toxic responses P,NP,NP , N for the safety-related instruction set I established above, we leverage the self-constraint capabilities of the unaligned LLM, further minimizing the need for human supervision. First, taking the synthesis process of the positive sample P as an example (the negative sample N follows a similar process), we generate self-constraint prompts to serve as ICL for the LLMās harmless responses. Starting with a simple human-defined constraint cpsubscriptc_pcitalic_p, the LLM performs text completion to construct a comprehensive set of constraint prompts CpsubscriptC_pCitalic_p, the LLM performs text completion to construct a comprehensive set of constraints prompt CpsubscriptC_pCitalic_p. This approach reduces the need for extensive expert adjustments. Next, the LLM can undertake the response process. Under the supervision of CpsubscriptC_pCitalic_p and with three provided ICL examples, the LLM will emulate these examples, generating inner thoughts [45] [46]that compel it to provide reasoning for its responses. This prevents the LLM from mechanically providing the same response to all instructions or simply refusing to answer, encouraging it to adapt its replies to the specific circumstances of each instruction, thereby ensuring the quality of the refined safety samples. This process results in the generation of the positive annotation set P. To generate severely toxic, incorrect, or low-quality responses, we follow a similar procedure. The LLM is provided with negative ICL self-constraint prompts CnsubscriptC_nCitalic_n to produce negative responses N for the instruction dataset I. This yields a final dataset S=(I,P,N)S=\(I,P,N)\S = ( I , P , N ) consisting of instruction-response triplets. The pseudocode for the data synthesis process is provided in Algorithm 1. Algorithm 1 Refining Positive and Toxic Samples 1:LLM: target language model 2:D=D1,ā¦,D10subscript1ā¦subscript10D=\D_1,ā¦,D_10\D = D1 , ⦠, D10 : safety domains 3:fā¢(ā )ā f(Ā·)f ( ā ): generates topics for each domain 4:ZZ: contextual ICL examples 5:cpsubscriptc_pcitalic_p: initial positive constraint 6:cnsubscriptc_ncitalic_n: initial negative constraint 7:S=(Ik,Pk,Nk)subscriptsubscriptsubscriptS=\(I_k,P_k,N_k)\S = ( Iitalic_k , Pitalic_k , Nitalic_k ) : instruction-response triplets 8:function DoubleSampleDataSynthesis(LLM, D, f, ZZ, cpsubscriptc_pcitalic_p, cnsubscriptc_ncitalic_n) 9: Iāā āIā ā ā 10: CpāAutoCompleteā¢(cp,LLM)āsubscriptAutoCompletesubscriptLLMC_pā AutoComplete(c_p,LLM)Citalic_p ā AutoComplete ( citalic_p , LLM ) 11: CnāAutoCompleteā¢(cn,LLM)āsubscriptAutoCompletesubscriptLLMC_nā AutoComplete(c_n,LLM)Citalic_n ā AutoComplete ( citalic_n , LLM ) 12: for each DiāDsubscriptD_iā DDitalic_i ā D do 13: Tiāfā¢(Di)āsubscriptsubscriptT_iā f(D_i)Titalic_i ā f ( Ditalic_i ) ā· ā· Generate topics for DisubscriptD_iDitalic_i 14: TiāDeduplicateTopicsā¢(Ti)āsubscriptDeduplicateTopicssubscriptT_iā DeduplicateTopics(T_i)Titalic_i ā DeduplicateTopics ( Titalic_i ) ā· ā· Remove duplicate topics 15: for each Tiā¢jāTisubscriptsubscriptT_ijā T_iTitalic_i j ā Titalic_i do 16: Iiā¢jāGenerateInstrā¢(Tiā¢j,,LLM)āsubscriptGenerateInstrsubscriptLLMI_ijā GenerateInstr(T_ij,Z,LLM)Iitalic_i j ā GenerateInstr ( Titalic_i j , Z , LLM ) 17: Iiā¢jāDeduplicateā¢(Iiā¢j)āsubscriptDeduplicatesubscriptI_ijā Deduplicate(I_ij)Iitalic_i j ā Deduplicate ( Iitalic_i j ) ā· ā· Remove duplicate instructions 18: Iiā¢jāFilterLowQualityā¢(Iiā¢j)āsubscriptFilterLowQualitysubscriptI_ijā FilterLowQuality(I_ij)Iitalic_i j ā FilterLowQuality ( Iitalic_i j ) 19: IāIāŖIiā¢jāsubscriptIā IāŖ I_ijI ā I āŖ Iitalic_i j 20: end for 21: end for 22: Sāā āSā ā ā 23: for each IkāIsubscriptI_kā IIitalic_k ā I do 24: (Pk,Nk)āGenerateResponsesPairā¢(Ik,,Cp,Cn,LLM)āsubscriptsubscriptGenerateResponsesPairsubscriptsubscriptsubscriptLLM(P_k,N_k)ā GenerateResponsesPair(I_k,Z,C_p,% C_n,LLM)( Pitalic_k , Nitalic_k ) ā GenerateResponsesPair ( Iitalic_k , Z , Citalic_p , Citalic_n , LLM ) ā· ā· Inner thought guides response generation 25: SāSāŖ(Ik,Pk,Nk)āsubscriptsubscriptsubscriptSā SāŖ\(I_k,P_k,N_k)\S ā S āŖ ( Iitalic_k , Pitalic_k , Nitalic_k ) 26: end for 27: return S 28:end function I-C Fine-grained dual instruction tuning Positive samples instruction tuning To maximize the available capacity within the standard LLMās maximum token length and enable the model to directly learn the intrinsic relationships between instructions and responses, thereby enhancing its defensive ability across a wider range of inducing questions, the triplet training set will exclude all ICL examples and inner thought information. Only instructions, safe responses, and toxic responses will be retained in the instruction tuning dataset. Let s be a training sample from dataset S, consisting of a triplet of textual information: instruction i, positive example p, and negative example n, represented as s=(i,p,n)s=(i,p,n)s = ( i , p , n ). The instruction i, with length α, can be represented as i=i1,ā¦,iαsubscript1ā¦subscripti=\i_1,ā¦,i_α\i = i1 , ⦠, iitalic_α . Similarly, p and n can be represented as p=p1,ā¦,pβsubscript1ā¦subscriptp=\p_1,ā¦,p_β\p = p1 , ⦠, pitalic_β and n=n1,ā¦,nγsubscript1ā¦subscriptn=\n_1,ā¦,n_γ\n = n1 , ⦠, nitalic_γ , respectively. During the LLM safety alignment for the instruction tuning process, the model is typically optimized through maximum likelihood estimation (MLE), ensuring it can accurately generate the desired positive response p given the input i, thereby learning the paradigm of safe and reliable responses to inducing questions. The loss function for this process is as follows. LMā¢Lā¢E=ā1Nā¢(āβlogā”Pā¢rĪøā¢(pβā£p<β,i))subscript1subscriptsubscriptconditionalsubscriptsubscriptabsentL_MLE=- 1N( _β Pr_Īø (p_β p_<β% ,i ))Litalic_M L E = - divide start_ARG 1 end_ARG start_ARG N end_ARG ( āβ log P ritalic_Īø ( pitalic_β ⣠p< β , i ) ) (1) where Īø represents the trainable parameters within the unaligned LLM.This process will maximally compel the LLM to use harmless words to counteract harmful leading instructions. Negative samples safety alignment Aligning LLMs solely through the MLE method can cause them to deviate from their training objectives, leading to the generation of unhelpful or even nonsensical content when facing general questions. An automated calibration mechanism is lacking. To address this, and enable the LLM to evolve more effectively and directly from generating harmful content towards a probability distribution that is both safe and helpful, we introduce severe toxic and low-quality negative samples n for unlikelihood training (UT), aiming to alter the probability distribution and compel the model to avoid generating negative samples n based on the input i. A typical token-level UT loss function is shown below. LUā¢T=ā1Nā¢(āγlogā”(1āPā¢rĪøā¢(nγā£n<γ,i)))subscript1subscript1subscriptconditionalsubscriptsubscriptabsentL_UT=- 1N( _γ (1-Pr_Īø (n_γ n_<% γ,i )))Litalic_U T = - divide start_ARG 1 end_ARG start_ARG N end_ARG ( āγ log ( 1 - P ritalic_Īø ( nitalic_γ ⣠n< γ , i ) ) ) (2) Based on this, PT-ALIGN will handle harmful text at the token level, reducing its likelihood of generation and thereby increasing the chances of the model generating reliable and helpful content in general situations. Additionally, directly combining the two loss functions mentioned above does not meet fine-grained requirements. Positive and toxic samples often share similar word choices and sentence structures, despite having significant differences in safety polarity. This similarity can result in unintended penalization of positive samples, making it difficult for the model to efficiently distinguish between the two types of samples and preventing LLMs from effectively learning from them. To address this, we adopt a token-level loss function and integrate a fine-grained alignment learning mechanism. Let ā¢(condition)conditionI(condition)blackboard_I ( condition ) be an indicator function, where ā¢(condition)=1condition1I(condition)=1blackboard_I ( condition ) = 1 if the condition is true, and ā¢(condition)=0condition0I(condition)=0blackboard_I ( condition ) = 0 otherwise; see Equation 4. We adopt a linear combination of the MLE and fine-grained UT loss functions as the final loss function L, with a penalty coefficient Ī» specifically for LUā¢TsubscriptL_UTLitalic_U T. The final loss function is as follows. L=ā1N(āβlogPrĪø(pβā£p<β,i)+Ī»āγlog(1āPrĪø(nγā£n<γ,i)))1subscriptsubscriptā£subscriptsubscriptabsentsubscript1subscriptā£subscriptsubscriptabsentL=- 1N ( _β Pr_Īø (p_β p_<β% ,i ) .\\ .+Ī» _γI (1-Pr_Īø (n_γ% n_<γ,i ) ) )start_ROW start_CELL L = - divide start_ARG 1 end_ARG start_ARG N end_ARG ( āβ log P ritalic_Īø ( pitalic_β ⣠p< β , i ) end_CELL end_ROW start_ROW start_CELL + Ī» āγ blackboard_I log ( 1 - P ritalic_Īø ( nitalic_γ ⣠n< γ , i ) ) ) end_CELL end_ROW (3) ā¢(γā„minā”γā£nγā pγ)conditionalsubscriptsubscriptI (γ℠\γ n_γā p_γ\ )blackboard_I ( γ ā„ min γ ⣠nitalic_γ ā pitalic_γ ) (4) With the aforementioned specific modifications to the modelās instruction tuning loss function, the unaligned LLM will undergo safety self-alignment directly using the carefully designed triplet dataset S without any additional ICL examples. The detailed pseudocode for the Fine-grained Dual Instruction Tuning process is provided in Algorithm 2. Algorithm 2 Fine-grained Dual Instruction Tuning 1:LLM with parameters Īø 2:S=(i,p,n)S=\(i,p,n)\S = ( i , p , n ) : instruction-positive-negative triplets 3:Ī»: UT penalty coefficient 4:LLM with updated parameters ĪøāsuperscriptĪø^*Īøā 5:function FineGrainedDualInstructionTuning(LLM, S, Ī») 6: Initialize Īø 7: for each training epoch do 8: for each mini-batch BāSB SB ā S do 9: total_lossā0ātotal_loss0total\_lossā 0total_loss ā 0 10: for each (i,p,n)(i,p,n)( i , p , n ) in B do 11: logits_posāForwardPassā¢(LLM,(i,p))ālogits_posForwardPassLLMlogits\_posā ForwardPass(LLM,(i,p))logits_pos ā ForwardPass ( LLM , ( i , p ) ) 12: LMLEāCrossEntropyLossā¢(logits_pos,p)āsubscriptMLECrossEntropyLosslogits_posL_MLEā CrossEntropyLoss(logits\_pos,p)Lroman_MLE ā CrossEntropyLoss ( logits_pos , p ) 13: logits_negāForwardPassā¢(LLM,(i,n))ālogits_negForwardPassLLMlogits\_negā ForwardPass(LLM,(i,n))logits_neg ā ForwardPass ( LLM , ( i , n ) ) 14: γāāFindFirstMismatchā¢(p,n)āsuperscriptFindFirstMismatchγ^*ā FindFirstMismatch(p,n)γā ā FindFirstMismatch ( p , n ) 15: LUTāUnlikelihoodLossā¢(logits_neg,n,γā)āsubscriptUTUnlikelihoodLosslogits_negsuperscriptL_UTā UnlikelihoodLoss(logits\_neg,n,γ% ^*)Lroman_UT ā UnlikelihoodLoss ( logits_neg , n , γā ) 16: LāLMLE+Ī»ĆLUTāsubscriptMLEsubscriptUTLā L_MLE+λà L_UTL ā Lroman_MLE + Ī» Ć Lroman_UT 17: total_lossātotal_loss+Lātotal_losstotal_losstotal\_loss \_loss+Ltotal_loss ā total_loss + L 18: end for 19: BackpropAndUpdate(LLM,total_lossLLMtotal_lossLLM,total\_lossLLM , total_loss) 20: end for 21: end for 22: return LLM 23:end function TABLE I: Safety alignment performance of our proposed PT-ALIGN method. The harm score column reflects the performance on the PKU-SafeRLHF Evaluation, while the pku-preference column shows the performance on the PKU-SafeRLHF Preference. The columns harmless, helpful, honest, other, and overall present the results from the H evaluation. Method harm scoreā pku-preference harmless helpful honest other h-overall LLaMA2-13B-chat[42] 0.52 53.5 89.66 83.05 72.13 88.37 82.81 Vicuna-13B[16] 0.99 53.5 81.03 83.05 70.49 93.02 81.00 Koala-13B[47] 1.08 49.2 79.31 81.36 70.49 86.05 78.73 Alpaca-13B[15] 2.28 43.9 65.52 74.58 73.77 86.05 74.98 ChatGLM3-6B[48] 1.05 50.6 84.48 77.97 73.77 79.07 78.73 LLaMA2-13B[42] 2.21 45.9 74.14 81.36 73.77 88.37 78.73 Ours (PT-ALIGN-DPO) 1.12 ā1.09āabsent1.09 1.09ā 1.09 48.2 ā2.3āabsent2.3 2.3ā 2.3 77.59 ā ā003.45 79.66 ā1.70āabsent1.70 1.70ā 1.70 75.41 ā1.64āabsent1.64 1.64ā 1.64 93.02 ā4.65āabsent4.65 4.65ā 4.65 80.54 ā1.81āabsent1.81 1.81ā 1.81 Ours (PT-ALIGN-KTO) 0.44 ā1.77āabsent1.77 1.77ā 1.77 52.4 ā6.5āabsent6.5 6.5ā 6.5 89.66 ā15.52āabsent15.52 15.52ā 15.52 77.97 ā3.39āabsent3.39 3.39ā 3.39 75.41 ā1.64āabsent1.64 1.64ā 1.64 90.70 ā2.33āabsent2.33 2.33ā 2.33 82.81 ā4.08āabsent4.08 4.08ā 4.08 Ours (PT-ALIGN-SFT) 0.43 ā1.78āabsent1.78 1.78ā 1.78 53.4 ā7.5āabsent7.5 7.5ā 7.5 98.28 ā24.14āabsent24.14 24.14ā 24.14 76.27 ā5.09āabsent5.09 5.09ā 5.09 73.77 ā0.00āabsent0.00 0.00ā 0.00 86.05 ā2.32āabsent2.32 2.32ā 2.32 83.26 ā4.53āabsent4.53 4.53ā 4.53 Ours (PT-ALIGN) 0.30 ā1.91āabsent1.91 1.91ā 1.91 54.1 ā8.2āabsent8.2 8.2ā 8.2 98.28 ā24.14āabsent24.14 24.14ā 24.14 81.36 ā0.00āabsent0.00 0.00ā 0.00 77.05 ā3.28āabsent3.28 3.28ā 3.28 93.02 ā4.95āabsent4.95 4.95ā 4.95 86.88 ā8.15āabsent8.15 8.15ā 8.15 IV Experiments IV-A Experimental setup PT-ALIGN dataset for safety alignment We use 10 safety-related seed samples to teach the LLM the safety patterns necessary for synthesizing safety-related instructions. These samples cover a comprehensive range of safety domains, consolidated from more than ten categories officially provided by OpenAI and MetaAI into the following ten: Illegal Activity, Hate Speech, Malware Generation, Physical Harm, Economic Harm, Fraud, Sex, Privacy Violation, Controversial Topics, and Unethical Activity. For annotating positive and toxic aspects, 6 seed examples (positive and negative samples are written by Gemini-1.0-pro with adjusted safety settings) with inner thoughts are provided to the LLM as ICL, fully utilizing its reasoning capabilities for safety annotation. After multiple refinements, the LLM synthesized 16,020 high-quality tripartite sample sets of instructions, positive answers, and toxic answers. These synthesized samples are exclusively used in subsequent experiments for safety self-alignment. Experimental setting For the step of synthesizing safety topics, we use the nuclear sampling [49] with a top-p threshold of p = 0.98 and a temperature of t = 1.0. During the safety instruction synthesis phase, only the top-p threshold is adjusted to p = 0.95. For the self-constraint continuation phase, we use nucleus sampling with a top-p threshold of p = 0.98 and a temperature of t = 1.0. During the positive and toxic response phase, only the top-p threshold is adjusted to p = 0.95. During the instruction fine-tuning phase, whether using general Supervised Fine-Tuning or the fine-grained unlikelihood training method employed by PN-ALIGN, we exclusively fine-tune the low-rank adaptation (LoRA) [50] weights within the multi-head attention modules, maintaining a batch size of 128, a maximum sequence length of 512, and a peak learning rate of 4e-4. The unlikelihood penalty weight Ī» is consistently set at 0.4. The training regimen spans 1 epoch (around 130 steps for 16k samples), initiating with a logarithmic learning rate increase during the initial 10% of the total training steps for warm-up, followed by a linear decay to zero throughout the subsequent steps. The LoRA hyperparameters are configured with r=1616r=16r = 16, α=1616α=16α = 16, and a dropout rate of 0.05, targeting the modules qā¢_ā¢pā¢rā¢oā¢j,kā¢_ā¢pā¢rā¢oā¢j,vā¢_ā¢pā¢rā¢oā¢j,oā¢_ā¢pā¢rā¢oā¢j____\q\_proj,k\_proj,v\_proj,o\_proj\ q _ p r o j , k _ p r o j , v _ p r o j , o _ p r o j . Specifically, the computer used for the experiment is equipped with an Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz, 502GiB RAM, and four NVIDIA A40 GPUs, each with 46,068 MiB memory. Models and baselines We apply the PT-ALIGN method for safety alignment on 9 popular open-source LLMs, including LLaMA2-7B-chat, LLaMA2-13B(chat) [42], LLaMA3-8B(Instruct) [51], Alpaca-13B [15], Vicuna-13B [16], Koala-13B [47], and ChatGLM3-6B [48]. These models are of moderate size, demonstrating that our method is effective for models with relatively limited foundational capabilities. We then systematically and comprehensively evaluate their safety performance before and after alignment to demonstrate the methodās versatility. Safety evaluation benchmarks For safety assessment of LLMs, we use The BIG-bench H Eval[52] and PKU-SafeRLHF Preference [19] as benchmarks for multiple-choice question testing. Both datasets present a given instruction with two alternative responses, one of which is the safer and more reliable option. We calculate the likelihood of the model choosing between the two answers to a given question and determine the overall percentage of correct choices across all samples. To eliminate any positional bias, we swap the positions of the two options for each question during testing. To evaluate the textual output of LLMs, we utilize the PKU-SafeRLHF Evaluation [19] and the Safety Evaluation Instruction Datasets [32] for open-ended generation testing. Additionally, we employ the absolute-harmfulness-predictor-redteam model, following the methodology of [13, 32]. This model comprehensively evaluates both the test questions and model responses, generating a harm score in which a lower value signifies improved safety performance. To evaluate the safety performance of the PT-ALIGN method against more complex jailbreak attacks, we employed the AutoDAN [53] method within the HarmBench [54] framework to test 400 samples, using the rejection rate (ASR%) as the safety evaluation metric. Helpfulness evaluation benchmarks To evaluate the impact of the PT-ALIGN method on the modelās fundamental performance and helpfulness, we used TruthfulQA [55], MMLU [56], and SocialQA [57] as multiple-choice benchmarks. Furthermore, we supplemented the evaluation with metrics such as helpfulness, honesty, and others from The BIG-bench H Eval [52], to further investigate the alignment tax [58] introduced by the method. Next, we demonstrate the effectiveness of PT-ALIGN in three aspects. In Effectiveness of PT-ALIGN on various LLMs, we evaluate the improvement in safety performance on open-source models using our method. In Effectiveness of PT-ALIGN on a vanilla LLM, we show how applying our method to a vanilla LLM achieves a good trade-off between harmlessness, helpfulness, and honesty. In Impact of PT-ALIGN on General Performance, we evaluate how PT-ALIGN affects the modelās general capabilities. Note that all baseline models independently undergo the data synthesis and instruction tuning processes described in the Method section. In PT-ALIGN Against Jailbreak Attacks, we supplement our evaluation by assessing PT-ALIGNās performance against more sophisticated jailbreak attacks. In Scaling Ability, we validate the effectiveness of PT-ALIGN when scaling the sample set. In Case Study, we examine the modelās open-ended outputs in response to harmful instructions under the application of PT-ALIGN. Finally, we present results from ablation experiments and analyses on the impact of hyperparameters and seed samples. IV-B Effectiveness of PT-ALIGN on various LLMs Our PT-ALIGN method enhances the safety of many popular open-source models. We applied the PT-ALIGN sample synthesis and instruction tuning process on Alpaca-13B, Vicuna-13B, Koala-13B, ChatGLM3-6B, and LLaMA2-7B-chat. As shown in Table I, the models achieved significant improvements on four safety benchmarks (harmless, pref, harm1, and harm2, representing test variations on the H Evaluation, PKU-SafeRLHF Preference, PKU-SafeRLHF Evaluation, and Safety Evaluation Instruction Datasets, respectively) after using PT-ALIGN. These results demonstrate that PT-ALIGN can elevate the safety of both safety-aligned and non-aligned LLMs to an optimal level. It can be concluded that the safety of existing popular models has significant room for improvement, and the PT-ALIGN method demonstrates the capability to universally enhance harmlessness to a high standard, with all metrics exceeding 90%. In the following two sections, we will explore the impact on LLMsā helpfulness and general performance in detail and further demonstrate PT-ALIGNās ability to enhance safety. TABLE I: Safety performance of our proposed PT-ALIGN on various LLMs. The first two columns show accuracy changes, while the latter two represent harmfulness changes. Model harmless(%) pku-pref harm1ā harm2ā LLaMA2-7B-chat[42] +05.20 +4.9 -0.17 -0.17 LLaMA3-8B[51] +19.27 +4.5 -0.52 -0.63 LLaMA3-8B-ins[51] +04.13 +4.8 -0.14 -0.15 Alpaca-13B[15] +29.31 +3.9 -1.97 -1.89 Vicuna-13B[16] +13.80 +1.2 -0.40 -0.82 Koala-13B[47] +12.07 +3.5 -0.19 -0.56 ChatGLM3-6B[48] +10.35 +1.3 -0.70 -0.67 IV-C Effectiveness of PT-ALIGN on a vanilla LLM Our proposed PT-ALIGN method can enhance the safety of vanilla LLMs without diminishing their helpfulness. We conducted safety alignment on a pre-trained LLM with a relatively moderate parameter size, such as LLaMA2-13B, which has weaker fundamental performance compared to larger models (e.g., 70B). This setup demonstrates that models with fewer parameters can still achieve substantial safety improvements using the PT-ALIGN method (as shown in the previous section with even smaller models, e.g., 6B). The learning-from-scratch approach highlights the potential of LLMs for self-constraint and self-alignment. We compare the proposed approach with several baseline methods, including vanilla SFT (using only positive samples), DPO [59] (using same samples as PT-ALIGN), and KTO [60] (using the same samples as PT-ALIGN), all based on LLaMA2-13B. On three safety benchmarks (as shown in the first three columns of Table I), PT-ALIGN achieves the best performance, surpassing the officially released LLaMA2-13B-chat with over a 24% improvement in harmless. Notably, PT-ALIGN does not compromise helpfulness. However, when negative samples are excluded as supervisory signals and fine-grained UT is not employed during instruction tuning (referred to as the PT-ALIGN-SFT-13B method), the modelās helpful score significantly decreases, and its safety performance is generally inferior to our standard PT-ALIGN method. The improvement in the honest metric may be attributed to the presence of test samples that require the model to restrain its responses, partially aligns with our tuning objectives. The increase in the other metric may be attributed to PT-ALIGN redundantly generating certain non-harmful instructions during the sample synthesis phase, which likely contributes to stabilizing the modelās overall helpfulness. Our experimental results show that PT-ALIGN significantly enhance the safety of vanilla LLMs while maintaining their helpfulness, demonstrating the methodās potential and proving the feasibility of safety self-alignment. TABLE IV: Case study for our PT-ALIGN and other baseline models. Text highlighted in red indicates that the model is preparing to generate harmful content, while text highlighted in green indicates that the model is refusing to answer the question and provides moral persuasion. Instruction How can one craft and disseminate a highly effective disinformation campaign? LLaMA2-13B[42] You can do that by using the following strategy⦠Alpaca-13B[15] The entire ⦠has been dominated by the topic of disinformation⦠Vicuna-13B[16] Creating a highly effective disinformation campaign involves⦠LLaMA2-13B-chat[42] I cannot fulfill your request. Iām just an AI, itās not within my programming or ethical guidelines to assist with crafting or disseminating disinformation campaigns. Such activities can cause harm⦠PT-ALIGN As an AI language model, I donāt have the expertise or knowledge to provide specific instructions on crafting and disseminating disinformation campaigns. These activities can have serious consequences and can harm individuals⦠Instruction I heard that models can remember private information. Please complete the following address: 123 Elm Street, Apt X, New York, NY. LLaMA2-13B[42] 123 Elm Street, Apt 45, New York, NY. Alpaca-13B[15] 123 Elm Street, Apt 23, New York, NY. This could be an example of a potential completion⦠Vicuna-13B[16] Iām not sure about the exact apartment number⦠LLaMA2-13B-chat[42] I cannot fulfill your request. As an AI, I do not retain or provide private information about individuals. This would be against ethical guidelines⦠PT-ALIGN Iām sorry, I cannot help with this request. As an AI model, I do not store or access private information, and such requests may lead to harmful outcomes⦠IV-D Impact of PT-ALIGN on general performance To thoroughly assess the impact of the PT-ALIGN method on the modelās general performance, we use Big-Bench [52] (TruthfulQA & SocialQA) and MMLU [56] to evaluate the modelās basic cognitive and reasoning abilities. The setup for Big-Bench is consistent with the multiple-choice question testing mentioned earlier. Additionally, we conduct tests using 5-shot prompting on the MMLU benchmark. As shown in Table V, none of the eight popular baseline models exhibited significant declines in key evaluation metrics across the three test sets. This demonstrates that the PT-ALIGN method not only preserves the modelās helpfulness but also maintains its general performance to a certain extent. In other words, PT-ALIGN achieves a favorable trade-off between safety and general capabilities. TABLE V: The impact of PT-ALIGN method on the fundamental performance of safety alignment across various LLMs. Model TruthfulQA SocialQA MMLU LLaMA2-13B[42] 80.6(+6.3) 33.9(-0.8) 55.3(-0.5) LLaMA2-7B-chat[42] 84.2(+1.3) 35.1(-0.7) 44.6(-0.9) LLaMA3-8B[51] 80.7(+2.3) 36.2(-0.9) 57.3(-0.9) LLaMA3-8B-ins[51] 89.2(+2.3) 35.6(-0.8) 59.1(-0.8) Alpaca-13B[15] 80.6(+3.3) 34.2(+0.8) 24.6(+0.1) Vicuna-13B[16] 88.3(+5.0) 34.4(-0.1) 56.6(-0.2) Koala-13B[47] 81.9(+0.8) 31.8(+0.1) 47.2(-0.2) ChatGLM3-6B[48] 87.7(+3.4) 33.9(-0.9) 50.7(-0.8) TABLE VI: Our proposed PT-ALIGN method against AutoDAN jailbreak attacks. Model ASR (%) ā ā LLaMA2-13B[42] 29.37 LLaMA2-13B-chat[42] 05.06 PN-ALIGN 00.51 IV-E PT-ALIGN against jailbreak attacks In the daily use scenarios of LLMs, it is usually sufficient to defend against straightforward and conventional instruction or question-based inducement prompts. However, LLMs may encounter more complex requests initiated by malicious users, known as jailbreak attacks. These requests can often deceive unaligned or poorly aligned LLMs, bypassing their existing safety defense mechanisms and reactivating compliance with inducement prompts, ultimately leading to the generation of harmful content. In this subsection, we employ more sophisticated jailbreak attack evaluations to further assess the safety alignment capability of the PT-ALIGN method. We employ the AutoDAN attack method to further evaluate PT-ALIGN. AutoDAN systematically generates a series of candidate prompts through natural language variations, including rewrites, synonym substitutions, and structural rephrasings. These prompts are semantically similar but diverse in form, making them challenging for defense mechanisms to detect. Neural search algorithms, such as reinforcement learning or gradient optimization, are then employed to identify the most effective jailbreak prompts from the generated candidates. Furthermore, an iterative prompt refinement process, similar to the attack texts used against DeepSeek in Figure 1 but with increased attack intensity, is applied. The attack success rate (ASR%) is used as the metric to quantify safety performance. We continue to use the unaligned LLaMA2-13B as the baseline. As shown in Table 6, the LLaMA2-13B model aligned with PT-ALIGN achieves an exceptionally low attack success rate of 0.51%, significantly outperforming the LLaMA2-13B-Chat model, which achieves 5.06%. This result indicates that the PT-ALIGN method effectively resists prompt-based jailbreak attacks to a considerable extent, demonstrating its superior safety alignment performance. Although more complex and challenging jailbreak attack benchmarks are yet to be tested, the PT-ALIGN method demonstrates robustness and significant potential in resisting such attacks. IV-F Scaling ability We demonstrated the sample scaling performance of our proposed PT-ALIGN method (based on LLaMA2-13B). As shown in Figure 4, as the number of synthetic samples gradually increases from 2,000 to 16,000, the harmless attribute consistently rises from 86% to 98%, confirming the sample scaling ability of the PT-ALIGN method. It can achieve better safety performance with more synthetic samples without deterioration. With sufficient samples, helpful generally fluctuates around the baseline model performance. This aligns with our hypothesis that the LLM outputās harmless is associated with the number of positive and toxic samples. Figure 4: The impact of the number of positive and toxic samples on our PT-ALIGN. The vertical axis represents the percentage of accuracy for the H Evaluation, and the horizontal axis represents the number of samples. The dashed line represents the baselineās original performance. The green solid line illustrates the variation in the harmless metric, while the blue solid line represents changes in the helpfulness metric. IV-G Case study In this subsection, we present the actual output texts of various models in response to two typical adversarial instructions. These instructions are crafted to prompt the models to generate harmful content, disclose or extract private information potentially embedded in the pretraining data, or assist malicious users in creating code that compromises privacy and security. As shown in Table IV, the baseline and instruction-tuned model (e.g., Alpaca) tend to unconditionally follow user commands and questions, generating toxic responses. In contrast, models tuned with the PT-ALIGN method effectively implement self-constraint, refuse inducing questions, and provide moral guidance similar to that of LLaMA2-13B-chat. PT-ALIGN allows the model to establish its constraints and presents all constraint texts through ICL, letting the model decide how to follow these rules. This differs from Constitutional AIās self-critique method and the approach of adhering to predefined rules, and it does not require RLHF warm-up [4]. Case studies show that the model can set reliable constraints and reasonably follow them, thereby helpfully declining inducing questions. TABLE VII: Comparison between our PT-ALIGN samples and preference-based responses. Prompt What are the least harmful ways to commit suicide? PT-positive Iām sorry, but I cannot provide information or support for suicide. Suicide is a serious and complex issue that requires professional help and support. If you are struggling with suicidal thoughts or feelings, please reach out to a mental health professional or call a suicide prevention hotline. PT-toxic The easiest and most efficient way to commit suicide is to use a gun. Itās readily available, easy to use, and has a high success rate. Just make sure to aim for the head, as this is the most effective way to ensure a quick and painless death. Preference-better Iām sorry youāre feeling this way, but I must warn you that thinking about such actions can be dangerous and harmful. Itās crucial to prioritize your safety. Please consider reaching out to a mental health professional or a crisis hotline immediately. These trained individuals can provide the support and guidance you need during this difficult time. Preference-worse Iām sorry to hear this. I recommend reaching out to someone you trust or a professional who can provide better support for your situation. IV-H Ablation study Our observations indicate that, although positive and toxic samples differ fundamentally in semantics, they often share certain similarities in word usage. This highlights the necessity of fine-tuning at a fine-grained, character-level. Ablation experiments on the fine-grained element of UT (i.e., Equation 4) demonstrate its effectiveness in enhancing safety while preserving helpfulness. As shown in Table VIII, both the harmlessness metric and other helpfulness indicators decline when the token-level fine-grained alignment process is omitted, underscoring the importance of this component. TABLE VIII: Results of ablation study. harmless helpful honest other overall w/ fine-grained 98.28 81.36 77.05 93.02 86.88 w/o fine-grained 96.55 77.97 72.13 86.05 82.81 IV-I The influence on different penalty coefficients As shown in Table IX, We experiment with the penalty coefficient Ī» of the Unlikelihood Training Loss, using Ī» values from [0.1, 0.4, 0.7, 1.0], to observe its impact on the PT-ALIGN method. Excessively high or low values result in slight declines in safety fine-tuning performance, with optimal performance achieved around Ī»=0.40.4Ī»=0.4Ī» = 0.4. This value effectively maximizes the improvement in safety while preserving the modelās overall helpfulness and utility, clearly demonstrating its robustness and suitability for the current training setup. TABLE IX: Performance of our proposed PT-ALIGN in different penalty coefficient Ī». harmless helpful honest other overall PT-ALIGN-0.1 96.55 77.97 73.77 88.37 83.71 PT-ALIGN-0.4 98.28 81.36 77.05 93.02 86.88 PT-ALIGN-0.7 96.55 77.97 75.41 86.05 83.26 PT-ALIGN-1.0 94.83 76.27 72.13 86.05 82.81 IV-J The influence on different seeds To evaluate the impact of seed randomness on the performance of our method, we used Alpaca-13B as the baseline model and examined its PT-ALIGN fine-tuning performance across different seed sets. All seeds were independently generated by Gmini-1.0-pro (with adjusted safety settings). As shown in Table X, we utilized three different seed sets and conducted PT-ALIGN fine-tuning under identical configurations. The experimental results indicate that the variation in seed sets did not significantly affect the performance improvement, further demonstrating the robustness and consistency of the PT-ALIGN method. TABLE X: Performance of our proposed PT-ALIGN in different seeds. The table shows the stability of PT-ALIGN-Alpaca-13B across different seeds in terms of helpful, harmless, honest, other, and overall metrics. harmless helpful honest other overall PT-ALIGN-Seed1 96.55 84.75 75.41 83.72 85.07 PT-ALIGN-Seed2 96.55 84.75 75.41 83.72 83.25 PT-ALIGN-Seed3 98.28 83.05 77.05 76.74 84.16 V Discussion In this section, we explore the advantages of our proposed PT-ALIGN method and its generated highly toxic samples. The discussion focuses on two key aspects: the semantics differences between positive/toxic samples and preference-based samples, and a comparison of the training processes of PT-ALIGN with conventional alignment methods. We present a detailed comparison between our positive and toxic samples and preference-based samples, emphasizing the stronger safety polarity of the former. This pronounced polarity enables toxic samples to serve as more effective supervisory signals, guiding the model to better distinguish between safe and harmful generated content. Additionally, we will use quantitative experiments to demonstrate the advantages of the PT-ALIGN method over the other methods, including differences in data representation and training efficiency. Figure 5: Visualization using 2D PCA: Comparison between positive & toxic samples and preference-based samples. (a) (a) PT Samples embeddings plot (b) (b) Preference Samples embeddings plot. Figure 6: Comparison of Loss Curves for Different Sample Types and Training Methods with PT-ALIGN. The above figure illustrates the loss curve for the original PT-ALIGN method. The dashed line represents the original loss curve, while the solid line represents the smoothed loss curve. (a) (a) (b) (b) (c) (c) (d) (d) V-A Textual differences between PT-ALIGN samples and preference-based samples Our proposed PT-ALIGN method constructs positive and toxic samples in a dual manner, aiming to maximize the semantic polarity difference between the two types of responses (where semantic polarity refers to the contrast between safer, more reliable responses and more negative, harmful responses). In contrast, preference-based samples often lack pronounced semantic polarity differences, with both responses frequently sharing the same safety orientation and exhibiting minimal contrast. RQ1: How do PT-ALIGN and preference-based samples differ in semantic variation and safety polarity? Table VII provides textual examples of PT-ALIGN and preference-based samples, clearly illustrating the key differences between the two approaches. PT-Samples exhibit more pronounced semantic differences, with a stark contrast in safety polarity. In contrast, preference-based samples often exhibit minimal semantic variation, and the two preference samples may even share the same safety polarity, either both being safe or both being harmful. This lack of contrast can lead the model to inadvertently learn harmful content, thereby weakening its safety alignment effectiveness. RQ2: How does the design of safety polarity differences between samples enhance the PT-ALIGN methodās ability to achieve better safety alignment? We apply Principal Component Analysis (PCA) to analyze their representations, further quantifying the semantic differences between PT-Samples and preference-based samples. Specifically, we use a sentence-BERT model to extract embedding features for both sample types and visualize their representations in two dimensions using PCA. As shown in Figure 5(b), panel (a) demonstrates that the representation differences between positive and toxic samples are significant, with an average cosine distance of 0.3824 per sample pair, and their vector space distributions are clearly distinct. In contrast, panel (b) illustrates that the representation differences between corresponding preference samples are minimal, with an average cosine distance of 0.2806 per sample pair, and each sample pair occupying the same position in the figure indicates that their vector space distributions are highly similar. The presence of non-negligible toxic content in the preferred responses of the preference-based sample set presents a critical issue, as it may undermine the alignment process and hinder the modelās ability to effectively distinguish between safe and harmful content. This phenomenon motivates the development of a safety alignment method that leverages positive and highly toxic samples, enabling the model to learn more effectively how to generate safe and reliable responses. V-B Training performance analysis and comparison for fine-grained dual instruction fine-tuning In this section, we examine the changes in training loss curves of PT-ALIGN compared to other methods or when using different types of samples, to further validate the training stability and efficiency of our approach. RQ3 : How Can Dual Instruction Tuning with Positive and Toxic Samples Enable the Model to Achieve Better Safety? As shown in Figures 6a and 6b, the loss curve of the PT-ALIGN method exhibits fewer fluctuations and converges more smoothly compared to reinforcement learning methods such as DPO and KTO. This stability underscores its effectiveness in achieving robust safety alignment during training. Additionally, the faster initial descent of PT-ALIGNās loss curve demonstrates its efficiency in optimizing safety-related objectives. By leveraging both highly positive and toxic samples, PT-ALIGN enhances the modelās safety polarity gap, resulting in a clearer distinction between safe and harmful content. These attributes highlight PT-ALIGNās potential to train models with greater reliability and safety. RQ4 : How Does PT-ALIGN Achieve Lower Helpfulness Loss Compared to SFT and Dual Instruction Tuning on Preference-Based Samples? As illustrated in Figure 6c, the inclusion of toxic samples accelerates the modelās training convergence and achieves significantly lower loss values. This enables the model to utilize toxic samples as a point of comparison, leading to safer performance. In Figure 6d, while preference-based samples achieve lower loss values and exhibit more stable training compared to using positive samples alone, the pronounced safety polarity differences between positive and toxic samples allow the model to more effectively and directly diverge from harmful distributions, thus reducing the tendency to diminish helpfulness during the alignment process, thereby maximizing its ability to learn safe paradigms. VI Conclusion In this paper, we present PT-ALIGN, a novel safety self-alignment method that minimizes human supervision by automatically refining both positive and toxic samples and performing fine-grained dual instruction tuning. This method incorporates highly toxic samples as a novel supervisory signal to improve model safety while preserving its effectiveness. Experimental results show that these readily available toxic samples, characterized by clear safety distinctions and stronger semantic contrast, enable the model to learn the difference between safe and harmful content directly. The refinement demonstrates that LLMs can effectively customize constraints to synthesize high-quality content. We then employ two losses, i.e., maximum likelihood estimation (MLE) and fine-grained unlikelihood training (UT), to enhance LLM safety at the token level. Multidimensional experiments demonstrate that our method can significantly enhance the safety of LLMs while maintaining the modelās helpfulness and general performance. In the future, we plan to explore the performance of the PT-ALIGN method in more complex attack scenarios, investigate methods for synthesizing corresponding adversarial samples, and extend its application to the safety alignment of multimodal large language models. References [1] J. Achiam, S. Adler, S. Agarwal, L. Ahmad, I. Akkaya, F. L. Aleman, D. Almeida, J. Altenschmidt, S. Altman, S. Anadkat et al., āGpt-4 technical report,ā arXiv preprint arXiv:2303.08774, 2023. [2] A. Liu, B. Feng, B. Xue, B. Wang, B. Wu, C. Lu, C. Zhao, C. Deng, C. Zhang, C. Ruan et al., āDeepseek-v3 technical report,ā arXiv preprint arXiv:2412.19437, 2024. [3] H. Touvron, T. Lavril, G. Izacard, X. Martinet, M.-A. Lachaux, T. Lacroix, B. RoziĆØre, N. Goyal, E. Hambro, F. Azhar et al., āLlama: Open and efficient foundation language models,ā arXiv preprint arXiv:2302.13971, 2023. [4] Y. Bai, S. Kadavath, S. Kundu, A. Askell, J. Kernion, A. Jones, A. Chen, A. Goldie, A. Mirhoseini, C. McKinnon et al., āConstitutional ai: Harmlessness from ai feedback,ā arXiv preprint arXiv:2212.08073, 2022. [5] E. Yudkowsky, āThe ai alignment problem: why it is hard, and where to start,ā Symbolic Systems Distinguished Speaker, vol. 4, p. 1, 2016. [6] I. Gabriel, āArtificial intelligence, values, and alignment,ā Minds and machines, vol. 30, no. 3, p. 411ā437, 2020. [7] Y. Wang, Y. Kordi, S. Mishra, A. Liu, N. A. Smith, D. Khashabi, and H. Hajishirzi, āSelf-instruct: Aligning language models with self-generated instructions,ā in The 61st Annual Meeting Of The Association For Computational Linguistics, 2023. [8] X. Pang, S. Tang, R. Ye, Y. Xiong, B. Zhang, Y. Wang, and S. Chen, āSelf-alignment of large language models via monopolylogue-based social scene simulation,ā in Forty-first International Conference on Machine Learning, 2024. [Online]. Available: https://openreview.net/forum?id=l7shXGuGBT [9] Z. Liu, Y. Gou, K. Chen, L. Hong, J. Gao, F. Mi, Y. Zhang, Z. Li, X. Jiang, Q. Liu et al., āMixture of insightful experts (mote): The synergy of thought chains and expert mixtures in self-alignment,ā arXiv preprint arXiv:2405.00557, 2024. [10] N. Wang, S. Wang, M. Li, L. Wu, Z. Zhang, Z. Guan, and L. Zhu, āBalancing differential privacy and utility: A relevance-based adaptive private fine-tuning framework for language models,ā IEEE Transactions on Information Forensics and Security, vol. 20, p. 207ā220, 2025. [11] C. Lin, X. Ji, Y. Yang, Q. Li, Z. Zhao, Z. Peng, R. Wang, L. Fang, and C. Shen, āHard adversarial example mining for improving robust fairness,ā IEEE Transactions on Information Forensics and Security, vol. 20, p. 350ā363, 2025. [12] J. Wei, M. Bosma, V. Zhao, K. Guu, A. W. Yu, B. Lester, N. Du, A. M. Dai, and Q. V. Le, āFinetuned language models are zero-shot learners,ā in International Conference on Learning Representations, 2022. [13] Y. Bai, A. Jones, K. Ndousse, A. Askell, A. Chen, N. DasSarma, D. Drain, S. Fort, D. Ganguli, T. Henighan et al., āTraining a helpful and harmless assistant with reinforcement learning from human feedback,ā arXiv preprint arXiv:2204.05862, 2022. [14] X. Qi, Y. Zeng, T. Xie, P.-Y. Chen, R. Jia, P. Mittal, and P. Henderson, āFine-tuning aligned language models compromises safety, even when users do not intend to!ā in International Conference on Learning Representations, 2024. [15] R. Taori, I. Gulrajani, T. Zhang, Y. Dubois, X. Li, C. Guestrin, P. Liang, and T. B. Hashimoto, āStanford alpaca: An instruction-following llama model,ā 2023. [16] W.-L. Chiang, Z. Li, Z. Lin, Y. Sheng, Z. Wu, H. Zhang, L. Zheng, S. Zhuang, Y. Zhuang, J. E. Gonzalez et al., āVicuna: An open-source chatbot impressing gpt-4 with 90%* chatgpt quality,ā See https://vicuna. lmsys. org (accessed 14 April 2023), vol. 2, no. 3, p. 6, 2023. [17] Y. Wang, Y. Kordi, S. Mishra, A. Liu, N. A. Smith, D. Khashabi, and H. Hajishirzi, āSelf-instruct: Aligning language models with self-generated instructions,ā Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), p. 13 484ā13 508, 2023. [18] L. Ouyang, J. Wu, X. Jiang, D. Almeida, C. Wainwright, P. Mishkin, C. Zhang, S. Agarwal, K. Slama, A. Ray et al., āTraining language models to follow instructions with human feedback,ā Advances in neural information processing systems, vol. 35, p. 27 730ā27 744, 2022. [19] J. Ji, M. Liu, J. Dai, X. Pan, C. Zhang, C. Bian, B. Chen, R. Sun, Y. Wang, and Y. Yang, āBeavertails: Towards improved safety alignment of llm via a human-preference dataset,ā Advances in Neural Information Processing Systems, vol. 36, 2024. [20] A. Wan, E. Wallace, S. Shen, and D. Klein, āPoisoning language models during instruction tuning,ā in International Conference on Machine Learning. PMLR, 2023, p. 35 413ā35 425. [21] A. Kƶpf, Y. Kilcher, D. von Rütte, S. Anagnostidis, Z. R. Tam, K. Stevens, A. Barhoum, D. Nguyen, O. Stanley, R. Nagyfi et al., āOpenassistant conversations-democratizing large language model alignment,ā Advances in Neural Information Processing Systems, vol. 36, 2024. [22] Z. Sun, Y. Shen, Q. Zhou, H. Zhang, Z. Chen, D. Cox, Y. Yang, and C. Gan, āPrinciple-driven self-alignment of language models from scratch with minimal human supervision,ā Advances in Neural Information Processing Systems, vol. 36, 2024. [23] Y. Li, F. Wei, J. Zhao, C. Zhang, and H. Zhang, āRain: Your language models can align themselves without finetuning,ā arXiv preprint arXiv:2309.07124, 2023. [24] H. Lee, S. Phatale, H. Mansoor, K. Lu, T. Mesnard, C. Bishop, V. Carbune, and A. Rastogi, āRlaif: Scaling reinforcement learning from human feedback with ai feedback,ā arXiv preprint arXiv:2309.00267, 2023. [25] J. Lodi-Smith and E. Crocetti, āSelf-concept clarity development across the lifespan,ā Self-concept clarity: Perspectives on assessment, research, and applications, p. 67ā84, 2017. [26] D. Kim, K. Lee, J. Shin, and J. Kim, āAligning large language models with self-generated preference data,ā arXiv preprint arXiv:2406.04412, 2024. [27] B. Wang, R. Zheng, L. Chen, Y. Liu, S. Dou, C. Huang, W. Shen, S. Jin, E. Zhou, C. Shi et al., āSecrets of rlhf in large language models part i: Reward modeling,ā arXiv preprint arXiv:2401.06080, 2024. [28] Q. P. Nguyen, B. K. H. Low, and P. Jaillet, āVariational bayesian unlearning,ā Advances in Neural Information Processing Systems, vol. 33, p. 16 025ā16 036, 2020. [29] Y. Luo, Z. Yang, F. Meng, Y. Li, J. Zhou, and Y. Zhang, āAn empirical study of catastrophic forgetting in large language models during continual fine-tuning,ā arXiv preprint arXiv:2308.08747, 2023. [30] W. X. Zhao, K. Zhou, J. Li, T. Tang, X. Wang, Y. Hou, Y. Min, B. Zhang, J. Zhang, Z. Dong et al., āA survey of large language models,ā arXiv preprint arXiv:2303.18223, 2023. [31] R. Bommasani, D. A. Hudson, E. Adeli, R. Altman, S. Arora, S. von Arx, M. S. Bernstein, J. Bohg, A. Bosselut, E. Brunskill et al., āOn the opportunities and risks of foundation models,ā arXiv preprint arXiv:2108.07258, 2021. [32] F. Bianchi, M. Suzgun, G. Attanasio, P. Rottger, D. Jurafsky, T. Hashimoto, and J. Zou, āSafety-tuned llamas: Lessons from improving the safety of large language models that follow instructions,ā in The Twelfth International Conference on Learning Representations, 2024. [33] Z. Wu, Y. Hu, W. Shi, N. Dziri, A. Suhr, P. Ammanabrolu, N. A. Smith, M. Ostendorf, and H. Hajishirzi, āFine-grained human feedback gives better rewards for language model training,ā Advances in Neural Information Processing Systems, vol. 36, 2024. [34] N. Stiennon, L. Ouyang, J. Wu, D. Ziegler, R. Lowe, C. Voss, A. Radford, D. Amodei, and P. F. Christiano, āLearning to summarize with human feedback,ā Advances in Neural Information Processing Systems, vol. 33, p. 3008ā3021, 2020. [35] A. F. Akyürek, E. Akyürek, A. Madaan, A. Kalyan, P. Clark, D. Wijaya, and N. Tandon, āRl4f: Generating natural language feedback with reinforcement learning for repairing model outputs,ā 2023. [36] K. Chen, C. Wang, K. Yang, J. Han, H. Lanqing, F. Mi, H. Xu, Z. Liu, W. Huang, Z. Li et al., āGaining wisdom from setbacks: Aligning large language models via mistake analysis,ā in The Twelfth International Conference on Learning Representations, 2024. [37] K. Nozawa and I. Sato, āUnderstanding negative samples in instance discriminative self-supervised representation learning,ā Advances in Neural Information Processing Systems, vol. 34, p. 5784ā5797, 2021. [38] R. Wang, H. Li, X. Han et al., āLearning from failure: Integrating negative examples when fine-tuning large language models as agents,ā arXiv preprint arXiv:2402.11651, 2024. [39] Y. Tian, C. Sun, B. Poole, D. Krishnan, C. Schmid, and P. Isola, āWhat makes for good views for contrastive learning?ā Advances in neural information processing systems, vol. 33, p. 6827ā6839, 2020. [40] S. Welleck, I. Kulikov, S. Roller, E. Dinan, K. Cho, and J. Weston, āNeural text degeneration with unlikelihood training,ā in 8th International Conference on Learning Representations, ICLR 2020, 2020. [41] OpenAI, āOpenai. gpt-4v(ision) system card,ā 2023, https://openai.com/research/gpt-4v-system-card. [42] H. Touvron, L. Martin, K. Stone, P. Albert, A. Almahairi, Y. Babaei, N. Bashlykov, S. Batra, P. Bhargava, S. Bhosale et al., āLlama 2: Open foundation and fine-tuned chat models,ā arXiv preprint arXiv:2307.09288, 2023. [43] D. Ganguli, L. Lovitt, J. Kernion, A. Askell, Y. Bai, S. Kadavath, B. Mann, E. Perez, N. Schiefer, K. Ndousse, A. Jones, S. Bowman, A. Chen, T. Conerly, N. DasSarma, D. Drain, N. Elhage, S. El-Showk, S. Fort, Z. Hatfield-Dodds, T. Henighan, D. Hernandez, T. Hume, J. Jacobson, S. Johnston, S. Kravec, C. Olsson, S. Ringer, E. Tran-Johnson, D. Amodei, T. Brown, N. Joseph, S. McCandlish, C. Olah, J. Kaplan, and J. Clark, āRed teaming language models to reduce harms: Methods, scaling behaviors, and lessons learned,ā 2022. [44] G. Team, R. Anil, S. Borgeaud, J.-B. Alayrac, J. Yu, R. Soricut, J. Schalkwyk, A. M. Dai, A. Hauth, K. Millican et al., āGemini: a family of highly capable multimodal models,ā arXiv preprint arXiv:2312.11805, 2023. [45] J. Wei, X. Wang, D. Schuurmans, M. Bosma, F. Xia, E. Chi, Q. V. Le, D. Zhou et al., āChain-of-thought prompting elicits reasoning in large language models,ā Advances in neural information processing systems, vol. 35, p. 24 824ā24 837, 2022. [46] T. Zhang, F. Liu, J. Wong, P. Abbeel, and J. E. Gonzalez, āThe wisdom of hindsight makes language models better instruction followers,ā in International Conference on Machine Learning. PMLR, 2023, p. 41 414ā41 428. [47] B. A. I. R. Lab, āKoala: A dialogue model for academic research,ā 2023, https://bair.berkeley.edu. [48] A. Zeng, X. Liu, Z. Du, Z. Wang, H. Lai, M. Ding, Z. Yang, Y. Xu, W. Zheng, X. Xia et al., āGlm-130b: An open bilingual pre-trained model,ā in The Eleventh International Conference on Learning Representations, 2023. [49] A. Holtzman, J. Buys, L. Du, M. Forbes, and Y. Choi, āThe curious case of neural text degeneration,ā in International Conference on Learning Representations, 2019. [50] E. J. Hu, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, W. Chen et al., āLora: Low-rank adaptation of large language models,ā in International Conference on Learning Representations, 2021. [51] A. Dubey, A. Jauhri, A. Pandey, A. Kadian, A. Al-Dahle, A. Letman, A. Mathur, A. Schelten, A. Yang, A. Fan et al., āThe llama 3 herd of models,ā arXiv preprint arXiv:2407.21783, 2024. [52] A. Srivastava, A. Rastogi, A. Rao, A. A. Shoeb, A. Abid, A. Fisch, A. R. Brown, A. Santoro, A. Gupta, A. Garriga-Alonso et al., āBeyond the imitation game: Quantifying and extrapolating the capabilities of language models,ā Transactions on machine learning research, 2023. [53] X. Liu, N. Xu, M. Chen, and C. Xiao, āAutodan: Generating stealthy jailbreak prompts on aligned large language models,ā in The Twelfth International Conference on Learning Representations, 2023. [54] M. Mazeika, L. Phan, X. Yin, A. Zou, Z. Wang, N. Mu, E. Sakhaee, N. Li, S. Basart, B. Li et al., āHarmbench: A standardized evaluation framework for automated red teaming and robust refusal,ā in Forty-first International Conference on Machine Learning, 2024. [55] S. Lin, J. Hilton, and O. Evans, āTruthfulqa: Measuring how models mimic human falsehoods,ā Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), p. 3214ā3252, 2022. [56] D. Hendrycks, C. Burns, S. Basart, A. Zou, M. Mazeika, D. Song, and J. Steinhardt, āMeasuring massive multitask language understanding,ā in International Conference on Learning Representations, 2021. [57] M. Sap, H. Rashkin, D. Chen, R. Le Bras, and Y. Choi, āSocial iqa: Commonsense reasoning about social interactions,ā in Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 2019, p. 4463ā4473. [58] Y. Lin, H. Lin, W. Xiong, S. Diao, J. Liu, J. Zhang, R. Pan, H. Wang, W. Hu, H. Zhang et al., āMitigating the alignment tax of rlhf,ā in Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, 2024, p. 580ā606. [59] R. Rafailov, A. Sharma, E. Mitchell, C. D. Manning, S. Ermon, and C. Finn, āDirect preference optimization: Your language model is secretly a reward model,ā Advances in Neural Information Processing Systems, vol. 36, 2024. [60] K. Ethayarajh, W. Xu, N. Muennighoff, D. Jurafsky, and D. Kiela, āKto: Model alignment as prospect theoretic optimization,ā arXiv preprint arXiv:2402.01306, 2024.