Trusted Weights, Treacherous Optimizations? Optimization-Triggered Backdoor Attacks on LLMs

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Wang, Yifei, Li, Tianlin, Zhang, Xiaohan, Yang, Yida, Zhang, Xiaoyu, Pan, Li
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913147364835328
author Wang, Yifei
Li, Tianlin
Zhang, Xiaohan
Yang, Yida
Zhang, Xiaoyu
Pan, Li
author_facet Wang, Yifei
Li, Tianlin
Zhang, Xiaohan
Yang, Yida
Zhang, Xiaoyu
Pan, Li
contents Inference optimization is a vital technique for deploying LLMs at scale. Compilation is the most widely adopted optimization technique for LLMs. While it assumes semantic equivalence between the original and compiled graphs, we first uncover its numerical side effects can be maliciously exploited to implant stealthy backdoors in LLMs. We propose a unified optimization-triggered attack framework comprising two complementary strategies. Without any modification to the compiler or hardware, one strategy flips predictions for specific inputs only when the model is compiled, while the other uses a universal trigger that remains dormant under uncompiled execution but hijacks arbitrary inputs once compilation optimization is applied. Both attacks bypass standard safety evaluations run without compilation. We empirically demonstrate that these optimization-triggered backdoors achieve attack success rates averaging 90% across four mainstream open-source LLMs and four tasks, while clean accuracy is preserved at nearly 100% under all settings. Our findings reveal a novel attack surface at the intersection of optimization and security in the LLM deployment pipeline, and we investigate practical defenses to mitigate this threat.
format Preprint
id arxiv_https___arxiv_org_abs_2605_20641
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Trusted Weights, Treacherous Optimizations? Optimization-Triggered Backdoor Attacks on LLMs
Wang, Yifei
Li, Tianlin
Zhang, Xiaohan
Yang, Yida
Zhang, Xiaoyu
Pan, Li
Cryptography and Security
Artificial Intelligence
Machine Learning
Inference optimization is a vital technique for deploying LLMs at scale. Compilation is the most widely adopted optimization technique for LLMs. While it assumes semantic equivalence between the original and compiled graphs, we first uncover its numerical side effects can be maliciously exploited to implant stealthy backdoors in LLMs. We propose a unified optimization-triggered attack framework comprising two complementary strategies. Without any modification to the compiler or hardware, one strategy flips predictions for specific inputs only when the model is compiled, while the other uses a universal trigger that remains dormant under uncompiled execution but hijacks arbitrary inputs once compilation optimization is applied. Both attacks bypass standard safety evaluations run without compilation. We empirically demonstrate that these optimization-triggered backdoors achieve attack success rates averaging 90% across four mainstream open-source LLMs and four tasks, while clean accuracy is preserved at nearly 100% under all settings. Our findings reveal a novel attack surface at the intersection of optimization and security in the LLM deployment pipeline, and we investigate practical defenses to mitigate this threat.
title Trusted Weights, Treacherous Optimizations? Optimization-Triggered Backdoor Attacks on LLMs
topic Cryptography and Security
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2605.20641