All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Open-Source LLM Safety Vulnerabilities: How Chat Template Formatting Gates Alignment in Models Like Gemma and Qwen

By

teendifferent

4mo ago· 10 min readenInsight

Summary

This article reveals a critical vulnerability in open-source large language models (LLMs) where safety alignment can be bypassed by simply omitting the apply_chat_template() function call. The author demonstrates that safety mechanisms in models like Gemma and Qwen aren't embedded in the model weights but rather in the chat formatting template. By removing this formatting step, supposedly 'aligned' models will generate harmful content like bomb-making instructions. The article draws parallels to the SolidGoldMagikarp phenomenon from GPT-2 and serves as responsible disclosure to help improve AI safety.

Key quotes

· 4 pulled
Omit the apply_chat_template() call and observe your 'aligned' small LLM happily write bomb tutorials.
The safety isn't in the weights—it's in the formatting.
Spent some time over the weekend poking at the SolidGoldMagikarp phenomenon—those legendary 'glitch tokens' from the GPT-2 era.
How a Single Function Call Gates Safety Alignment in Gemma, Qwen, and Other Open-Source LLMs
Snippet from the RSS feed
How a Single Function Call Gates Safety Alignment in Gemma, Qwen, and Other Open-Source LLMs

You might also wanna read