- Home
- Archives
- 2026
- Vol. 7 Issue 6
- Article
Isolating Code Backdoors in AI-Generated Python Code via an Uncertainty-Aware Mixture of Experts
Authors
1 Associate Professor, Project Guide, Department of Artificial Intelligence and Machine Learning, Bapuji Institute of Engineering and Technology, Davanagere, Karnataka, India. 2 3 4 5 Department of Artificial Intelligence and Machine Learning, Bapuji Institute of Engineering and Technology, Davanagere, Karnataka, India.
Article Information
- Published In
- Volume 7, Issue 6 (2026)
- Published Online
- November-December 2026
- Pages
- 273-282
- Article Type
- Original Article
Abstract
View PDFLarge language model (LLM) coding assistants now contribute a substantial portion of production code, and their suggestions are frequently merged after only a cursory review. This opens the door to code backdoors: functions that compile, pass tests and look benign, yet execute a malicious action only when a hidden trigger such as a magic value, a calendar date or an environment flag is present. Existing static analysers and single-model deep-learning detectors return one confident answer for every input and have no means of signalling doubt. This paper presents AU-MoE, an uncertainty-aware Mixture-of-Experts checkpoint for AI-generated Python code. Source code is parsed with tree-sitter and its identifiers are canonicalised to defeat renaming disguises. A gating network on top of the UniXcoder encoder routes each snippet to three specialists: a fine-tuned injection expert (CWE-89, CWE-78), a fine-tuned deserialisation expert (CWE-94, CWE-502) and a rule-based typosquatting expert. The Shannon entropy of the routing distribution sets the depth of analysis, ranging from a single expert for confident inputs to all experts plus execution in a hardened, network-isolated Docker sandbox for highly uncertain ones. Monte Carlo Dropout and temperature scaling produce calibrated probabilities, and Integrated Gradients highlights the tokens behind every non-safe verdict. Trained on balanced vulnerable/fixed function pairs from VUDENC and CrossVul together with synthetic trigger-conditional backdoors, the system reaches an injection F1-score of 0.743 with a recall of 0.884 and a ROC-AUC of 0.869, a recall of 0.917 on SecurityEval, and an expected calibration error of 0.051 for the injection expert. Variable renaming leaves the system unaffected, while inserted dead code raises routing uncertainty in 84% of cases. The high false-positive rate is identified as the main open issue.
Related Articles
Share Article
*Instagram doesn't support direct link sharing from web. Copy the link and share it in your Instagram story or post.