InferAligner: Inference-Time Alignment for Harmlessness through Cross-Model Guidance
Preprint
Abstract
With the rapid development of large language models (LLMs), they are not only used as general-purpose AI assistants but are also customized through further fine-tuning to meet the requirements of different applications. A pivotal factor in the success of current LLMs is the alignment process. Current alignment methods, such as supervised fine-tuning (SFT) and reinforcement learning from human feedback (RLHF), focus on training-time alignment and are often complex and cumbersome to implement. Therefore, we develop \textbf{InferAligner}, a novel inference-time alignment method that utilizes cross-model guidance for harmlessness alignment. InferAligner utilizes safety steering vectors extracted from safety-aligned model to modify the activations of the target model when responding to harmful inputs, thereby guiding the target model to provide harmless responses. Experimental results show that our method can be very effectively applied to domain-specific models in finance, medicine, and mathematics, as well as to multimodal large language models (MLLMs) such as LLaVA. It significantly diminishes the Attack Success Rate (ASR) of both harmful instructions and jailbreak attacks, while maintaining almost unchanged performance in downstream tasks.Keywords
All Related Versions
This publication has 10 references indexed in Scilit:
- Defending Large Language Models Against Jailbreaking Attacks Through Goal Prioritization2024
- Defending ChatGPT against jailbreak attack via self-remindersNature Machine Intelligence, 2023
- Enhancing Chat Language Models by Scaling High-quality Instructional Conversations2023
- Multi-step Jailbreaking Privacy Attacks on ChatGPT2023
- Self-Instruct: Aligning Language Models with Self-Generated Instructions2023
- TruthfulQA: Measuring How Models Mimic Human Falsehoods2022
- BBQ: A hand-built bias benchmark for question answering2022
- Extracting Latent Steering Vectors from Pretrained Language Models2022
- What Disease Does This Patient Have? A Large-Scale Open Domain Question Answering Dataset from Medical ExamsApplied Sciences, 2021
- Good debt or bad debt: Detecting semantic orientations in economic textsJournal of the Association for Information Science and Technology, 2013