paper-with-me

Papers

ChatBug: A Common Vulnerability of Aligned LLMs Induced by Chat Templates

2024-06-17 · Fengqing Jiang, Zhangchen Xu, Luyao Niu, Bill Yuchen Lin, Radha Poovendran

Large language models (LLMs) are expected to follow instructions from users and engage in conversations. Techniques to enhance LLMs' instruction-following capabilities typically fine-tune them using data structured according to a predefined chat template. Although chat templates are shown to be effective in optimizing LLM performance, their impact on safety alignment of LLMs has been less understood, which is crucial for deploying LLMs safely at scale. In this paper, we investigate how chat templates affect safety alignment of LLMs. We identify a common vulnerability, named ChatBug, that is introduced by chat templates. Our key insight to identify ChatBug is that the chat templates provide a rigid format that need to be followed by LLMs, but not by users. Hence, a malicious user may not necessarily follow the chat template when prompting LLMs. Instead, malicious users could leverage their knowledge of the chat template and accordingly craft their prompts to bypass safety alignments of LLMs. We develop two attacks to exploit the ChatBug vulnerability. We demonstrate that a malicious user can exploit the ChatBug vulnerability of eight state-of-the-art (SOTA) LLMs and effectively elicit unintended responses from these models. Moreover, we show that ChatBug can be exploited by existing jailbreak attacks to enhance their attack success rates. We investigate potential countermeasures to ChatBug. Our results show that while adversarial training effectively mitigates the ChatBug vulnerability, the victim model incurs significant performance degradation. These results highlight the trade-off between safety alignment and helpfulness. Developing new methods for instruction tuning to balance this trade-off is an open and critical direction for future research

📄 PDF Abstract BibTeX arXiv:2406.12935

Code (1)

uw-nsl/ChatBug 공식 구현 pytorch

Tasks

Instruction FollowingSafety Alignment

Similar Papers 제목 키워드 기반

VulReaD: Knowledge-Graph-guided Software Vulnerability Reasoning and Detection

2026-02-11 · Samal Mukhtar, Yinghua Yao, Zhu Sun, Mustafa Mustafa 외 arxiv

Software vulnerability detection (SVD) is a critical challenge in modern systems. Large language models (LLMs) offer natural-language explanations alongside predictions, but most work focuses on binary evaluation, and ex…

Multi-class ClassificationVulnerability DetectionBinary Classification

Revealing the Intrinsic Ethical Vulnerability of Aligned Large Language Models

2025-04-07 · Jiawei Lian, Jianhong Pan, Lefan Wang, Yi Wang 외

Large language models (LLMs) are foundational explorations to artificial general intelligence, yet their alignment with human values via instruction tuning and preference learning achieves only superficial compliance. He…

Large Language Models for In-File Vulnerability Localization Can Be "Lost in the End"

2025-02-09 · Francesco Sovrano, Adam Bauer, Alberto Bacchelli

Recent advancements in artificial intelligence have enabled processing of larger inputs, leading everyday software developers to increasingly rely on chat-based large language models (LLMs) like GPT-3.5 and GPT-4 to dete…

Vulnerability Detection

On the Effectiveness of Instruction-Tuning Local LLMs for Identifying Software Vulnerabilities

2025-12-23 · Sangryu Park, Gihyuk Ko, Homook Cho arxiv

Large Language Models (LLMs) show significant promise in automating software vulnerability analysis, a critical task given the impact of security failure of modern software systems. However, current approaches in using L…

Binary Classification

How Effective Are Neural Networks for Fixing Security Vulnerabilities

2023-05-29 · Yi Wu, Nan Jiang, Hung Viet Pham, Thibaud Lutellier 외

Security vulnerability repair is a difficult task that is in dire need of automation. Two groups of techniques have shown promise: (1) large code language models (LLMs) that have been pre-trained on source code for tasks…

Code CompletionProgram Repair