Skip to main content

Compile-Time Backdoor Neutralization via LLM-Guided Localized Edits

By
Minghui Li; Yang Li; Liming Fang

Deep learning compilers such as TVM have become essential in deploying neural networks with high efficiency across diverse hardware. However, recent studies reveal a critical vulnerability: adversaries can embed backdoors during training and rely on compilation to re-materialize the hidden behavior in the final executable. Such attacks exploit semantics-preserving compiler transformations that transfer the trigger effect into operator-level artifacts, enabling clean-label triggers and evading conventional defenses. Existing solutions lack precise countermeasures against compile-time backdoors, primarily due to their reliance on rule-based rewrites or static perturbations. In this paper, we present CBN, a dedicated defense framework for compilation-induced backdoors whose effect is exposed as a localized numerical shift near an activation boundary, without retraining. CBN performs localized rewriting at the compiler-IR level, guided by runtime probes and LLM-proposed plans drawn from a finite edit vocabulary. We introduce a legality-aware schema that constrains LLM outputs, a validator that enforces budgeted transformation rules, and a feedback loop that repairs broken plans through probe-based evidence. Across seven ONNX-Zoo models and five commercial LLMs, CBN reduces mean DCL-BD attack success from 30.1% to 1.9%, keeps every evaluated model below 3%, produces zero clean-label mismatches in the principal defended-build audit, and incurs 2.0% mean and at most 3.5% inference-latency overhead. A small ONNX Runtime pilot reduces mean ASR from 30.0% to 2.7%, while a StableHLO/XLA prototype implements three of the four edit classes with 97.8% build success and provides cross-IR feasibility evidence.

Read on IEEE Xplore