[email protected] +91 9840521421 Scholarly Open Access, Peer-reviewed, Refereed Journal e-ISSN 2582-8746 Since 2020
  1. Home
  2. Archives
  3. 2026
  4. Vol. 7 Issue 6
  5. Article
Original Article

Isolating Code Backdoors in AI-Generated Python Code via an Uncertainty-Aware Mixture of Experts

Open Access Peer Reviewed Crossref DOI

Authors

  • Dr. Naveen Kumar K R1
  • Srujankumar M Singannavar2
  • Akhil Joshi3
  • Patil Swayam4
  • Ananthkrishna C Patil5

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 Online
November-December 2026
Pages
273-282
Article Type
Original Article
Check for updates
check update

Abstract

View PDF

Large 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.

APC from ₹1200 + 18% GST

Peer-reviewed open access₹1200 Indian (₹1400 with DOI)$80 USD internationalpaid after acceptance Peer-reviewed open access₹1200 Indian$80 USD international ₹1200 Indian · $80 intl

  • CrossRef DOI
  • ISSN 2582-8746
  • Open Access
  • Peer Reviewed
  • Plagiarism Checked
  • Google Scholar
Submit Paper