When Style Breaks Safety: Defending LLMs Against Superficial Style Alignment

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Xiao, Yuxin, Tonekaboni, Sana, Gerych, Walter, Suriyakumar, Vinith, Ghassemi, Marzyeh
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908851442286592
author Xiao, Yuxin
Tonekaboni, Sana
Gerych, Walter
Suriyakumar, Vinith
Ghassemi, Marzyeh
author_facet Xiao, Yuxin
Tonekaboni, Sana
Gerych, Walter
Suriyakumar, Vinith
Ghassemi, Marzyeh
contents Large language models (LLMs) can be prompted with specific styles (e.g., formatting responses as lists), including in malicious queries. Prior jailbreak research mainly augments these queries with additional string transformations to maximize attack success rate (ASR). However, the impact of style patterns in the original queries that are semantically irrelevant to the malicious intent remains unclear. In this work, we seek to understand whether style patterns compromise LLM safety, how superficial style alignment increases model vulnerability, and how best to mitigate these risks during alignment. We first define ASR inflation as the increase in ASR due to style patterns in existing jailbreak benchmark queries. By evaluating 36 LLMs across seven benchmarks, we find that nearly all models exhibit ASR inflation. Notably, the inflation correlates with an LLM's relative attention to style patterns, which also overlap more with its instruction-tuning data when inflation occurs. We then investigate superficial style alignment, and find that fine-tuning with specific styles makes LLMs more vulnerable to jailbreaks of those same styles. Finally, we propose SafeStyle, a defense strategy that incorporates a small amount of safety training data augmented to match the distribution of style patterns in the fine-tuning data. Across three LLMs, six fine-tuning style settings, and two real-world instruction-tuning datasets, SafeStyle consistently outperforms baselines in maintaining LLM safety.
format Preprint
id arxiv_https___arxiv_org_abs_2506_07452
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle When Style Breaks Safety: Defending LLMs Against Superficial Style Alignment
Xiao, Yuxin
Tonekaboni, Sana
Gerych, Walter
Suriyakumar, Vinith
Ghassemi, Marzyeh
Machine Learning
Artificial Intelligence
Computation and Language
Computers and Society
Large language models (LLMs) can be prompted with specific styles (e.g., formatting responses as lists), including in malicious queries. Prior jailbreak research mainly augments these queries with additional string transformations to maximize attack success rate (ASR). However, the impact of style patterns in the original queries that are semantically irrelevant to the malicious intent remains unclear. In this work, we seek to understand whether style patterns compromise LLM safety, how superficial style alignment increases model vulnerability, and how best to mitigate these risks during alignment. We first define ASR inflation as the increase in ASR due to style patterns in existing jailbreak benchmark queries. By evaluating 36 LLMs across seven benchmarks, we find that nearly all models exhibit ASR inflation. Notably, the inflation correlates with an LLM's relative attention to style patterns, which also overlap more with its instruction-tuning data when inflation occurs. We then investigate superficial style alignment, and find that fine-tuning with specific styles makes LLMs more vulnerable to jailbreaks of those same styles. Finally, we propose SafeStyle, a defense strategy that incorporates a small amount of safety training data augmented to match the distribution of style patterns in the fine-tuning data. Across three LLMs, six fine-tuning style settings, and two real-world instruction-tuning datasets, SafeStyle consistently outperforms baselines in maintaining LLM safety.
title When Style Breaks Safety: Defending LLMs Against Superficial Style Alignment
topic Machine Learning
Artificial Intelligence
Computation and Language
Computers and Society
url https://arxiv.org/abs/2506.07452