✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: January 24, 2026
  • 2 min read

Omitting apply_chat_template Undermines Safety Alignment in Open‑Source LLMs

Recent research highlights a critical vulnerability in many open‑source large language models (LLMs): when the apply_chat_template step is skipped, the models’ safety alignment dramatically collapses. The study, originally published on Substack, demonstrates that unformatted prompts cause refusal rates to plummet across several popular models, exposing them to unsafe or harmful outputs.

The investigation examined models such as LLaMA‑2, Mistral, and Falcon, comparing their behavior with and without the chat template. Results showed a consistent drop in refusal percentages—from roughly 80% when the template was applied to under 20% when it was omitted. This regression was traced to the loss of system‑level instructions that guide the model’s behavior, effectively bypassing the safety guardrails embedded during fine‑tuning.

Failure analysis revealed three primary categories:

  • Prompt‑formatting loss: The model no longer receives the explicit “you are a helpful assistant” cue.
  • Context‑window truncation: Removing the template can shift token allocation, pushing safety‑related tokens out of the context.
  • Alignment drift: Models revert to pre‑alignment tendencies when the structured prompt is missing.

To mitigate this risk, the authors propose several recommendations for developers and the open‑source community:

  • Enforce the use of apply_chat_template in deployment pipelines.
  • Integrate template‑aware safety checks that flag missing system prompts.
  • Explore more robust alignment techniques that do not rely solely on prompt formatting.

For a deeper dive into the methodology and detailed experiment tables, read the full article on Substack.

Related reads on UBOS Tech include our coverage of AI safety best practices and the latest developments in open‑source LLM alignment.


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.