paper-with-me

Papers

CodeAttack: Revealing Safety Generalization Challenges of Large Language Models via Code Completion

2024-03-12 · Qibing Ren, Chang Gao, Jing Shao, Junchi Yan, Xin Tan, Wai Lam, Lizhuang Ma

The rapid advancement of Large Language Models (LLMs) has brought about remarkable generative capabilities but also raised concerns about their potential misuse. While strategies like supervised fine-tuning and reinforcement learning from human feedback have enhanced their safety, these methods primarily focus on natural languages, which may not generalize to other domains. This paper introduces CodeAttack, a framework that transforms natural language inputs into code inputs, presenting a novel environment for testing the safety generalization of LLMs. Our comprehensive studies on state-of-the-art LLMs including GPT-4, Claude-2, and Llama-2 series reveal a new and universal safety vulnerability of these models against code input: CodeAttack bypasses the safety guardrails of all models more than 80\% of the time. We find that a larger distribution gap between CodeAttack and natural language leads to weaker safety generalization, such as encoding natural language input with data structures. Furthermore, we give our hypotheses about the success of CodeAttack: the misaligned bias acquired by LLMs during code training, prioritizing code completion over avoiding the potential safety risk. Finally, we analyze potential mitigation measures. These findings highlight new safety risks in the code domain and the need for more robust safety alignment algorithms to match the code capabilities of LLMs.

📄 PDF Abstract BibTeX arXiv:2403.07865

Code (2)

renqibing/CodeAttack 공식 구현
ai45lab/codeattack

Tasks

Code CompletionSafety Alignment

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Position-Wise Feed-Forward Layer 설명 없음
BPE Byte Pair Encoding, or BPE, is a subword segmentation algorithm that encodes rare and unknown words as sequences of subword units. The intuition is that various word…
Layer Normalization Unlike batch normalization, Layer Normalization directly estimates the normalization statistics from the summed inputs…
Absolute Position Encodings Absolute Position Encodings are a type of position embeddings for [Transformer-based models] where positional encodings are…
Residual Connection 설명 없음
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…
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…

Similar Papers 제목 키워드 기반

CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Models

2022-05-31 · Akshita Jha, Chandan K. Reddy

Pre-trained programming language (PL) models (such as CodeT5, CodeBERT, GraphCodeBERT, etc.,) have the potential to automate software engineering tasks involving code understanding and code generation. However, these mod…

Code GenerationCode TranslationTranslation

Refuse Whenever You Feel Unsafe: Improving Safety in LLMs via Decoupled Refusal Training

2024-07-12 · Youliang Yuan, Wenxiang Jiao, Wenxuan Wang, Jen-tse Huang 외

This study addresses a critical gap in safety tuning practices for Large Language Models (LLMs) by identifying and tackling a refusal position bias within safety tuning data, which compromises the models' ability to appr…

Position

Sugar-Coated Poison: Benign Generation Unlocks LLM Jailbreaking

2025-04-08 · Yu-Hang Wu, Yu-jie Xiong, Hao Zhang, Jia-Chen Zhang 외

With the increasingly deep integration of large language models (LLMs) across diverse domains, the effectiveness of their safety mechanisms is encountering severe challenges. Currently, jailbreak attacks based on prompt …

Prompt Engineering

An Empirical Study on Preference Tuning Generalization and Diversity Under Domain Shift

2026-01-09 · Constantinos Karouzos, Xingwei Tan, Nikolaos Aletras arxiv

Preference tuning aligns base language models to human judgments of quality, helpfulness, or safety by optimizing over explicit preference signals rather than likelihood alone. Prior work has shown that preference tuning…

Safety Is Not Universal: The Selective Safety Trap in LLM Alignment

2026-01-07 · Iago Alves Brito, Walcy Santos Rezende Rios, Julia Soares Dollis, Diogo Fernandes Costa Silva 외 arxiv

Current safety evaluations of large language models (LLMs) create a dangerous illusion of universal protection by aggregating harms under generic categories such as "Identity Hate", obscuring vulnerabilities toward speci…