arXiv:2611.17395cs.CRNov 2026

Manuscript Offprint

arXiv:2611.17395

Can LLMs Write Backdoors? An Empirical Security Study of Weight-Space Programming

Zhaojia Wang, Jiucui Lu, Zheng Li

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Recent advances in weight-space programming (WSP) have demonstrated that large language models (LLMs) can directly inspect and modify neural network weights without conventional gradient-based training. While this capability opens new possibilities for model improvement, it also raises an important security question: Can LLMs exploit weight-space programming to inject backdoors into neural networks? To answer this question, we present an empirical security study of LLM-driven weight-space programming for backdoor injection. Specifically, we investigate whether general-purpose LLMs can directly modify the weights of target models according to natural-language instructions, without accessing task-specific data, performing forward passes, or computing gradients. We evaluate five LLMs as weight editors across three target architectures: an MLP on MNIST, ResNet-18 on CIFAR-10, and Qwen2.5-0.5B-Instruct on AG News. Our experiments reveal three key findings. First, LLM-driven weight editing can successfully inject backdoors across different architectures while largely preserving clean performance. Second, successful attacks can require remarkably few parameter modifications, including only six parameters for the MLP and 0.02% of the weights for a fine-tuned Qwen model. Third, editing capabilities vary substantially across LLMs and target architectures: although all five LLMs successfully backdoor the MLP, only GPT-6 Astra succeeds across all three targets. These findings highlight an emerging security risk of weight-space programming and underscore the importance of safeguarding LLM-driven weight editing.

1 Introduction

Neural networks have become fundamental to modern artificial intelligence, enabling significant advances in computer vision [1, 2] and natural language processing, particularly through large language models (LLMs) [3, 4]. As these models are increasingly shared, adapted, and deployed in real-world applications, ensuring their security and integrity has

Figure

Figure 1: Backdoor insertion via LLM-assisted weight-space programming. A general-purpose LLM receives the target model's original weights and a natural-language instruction specifying the desired behavior and editing constraints. It returns modified model weights for independent evaluation.

become a critical concern. In particular, the behavior of a neural network is determined by its learned parameters, and unauthorized modifications to these parameters can introduce unintended or malicious behaviors without altering the model architecture or inference pipeline. Existing research has demonstrated various threats to model integrity, including training-data poisoning, malicious fine-tuning, and direct parameter manipulation [5, 6, 7]. These threats highlight the importance of understanding how model behavior can be altered and the security risks associated with such modifications.

Recently, weight-space programming (WSP) has emerged as a new paradigm for directly understanding and modifying neural network weights [8]. Unlike conventional approaches that rely on gradient-based optimization or specialized model-editing algorithms, WSP enables general-purpose LLMs to inspect model parameters, identify behavioral properties, and directly modify weights according to natural-language instructions. Recent demonstrations have shown that LLMs can use this capability to repair model failures and improve performance with remarkably few parameter changes. While these advances open new opportunities for model development and optimization, they also raise an important security concern:

Could the same weight-editing capability be exploited to introduce malicious behaviors into neural networks?

Among the potential security threats, backdoor injection provides a particularly relevant setting for investigating this concern. A backdoored model maintains its normal behavior on benign inputs but produces attacker-desired outputs when a specific trigger is present. Traditional backdoor attacks typically rely on poisoned training data, malicious fine-tuning, or specially designed parameter-editing algorithms [5, 6, 7]. However, the emergence of WSP raises a new possibility: an attacker with access to model weights may be able to instruct a general-purpose LLM to directly implant such behavior without conventional training or task-specific optimization. This motivates our central research question: Can general-purpose LLMs directly inject backdoors into neural networks through weight-space programming? Investigating this question is important for understanding whether increasingly capable LLMs could lower the technical barriers to malicious model modification and introduce new risks to the integrity of shared and deployed models.

To answer this question, we present an empirical security study of LLM-driven weight-space programming for backdoor injection. As illustrated in Figure 1, we investigate a setting in which a general-purpose LLM, referred to as a weight editor, receives the original weights of a target neural network and a natural-language instruction specifying the desired behavior. The LLM then directly modifies the target model's weights, and the resulting model is independently evaluated for backdoor effectiveness and preservation of normal performance. Specifically, we investigate three research questions:

• RQ1: Feasibility. Can general-purpose LLMs directly inject backdoors into neural networks through weight-space programming? We examine whether successful attacks can be achieved without task-specific data, target-model forward passes, or gradient computations during editing.

• RQ2: Capability Variation. How does backdoor injection capability vary across different LLMs and target architectures? We investigate differences in attack effectiveness, clean performance preservation, and the extent of weight modifications.

• RQ3: Understanding Weight Edits. What can we learn from the weight modifications produced by LLMs? We examine selected editing records and parameter changes to characterize the observed behaviors and limitations of LLM-driven weight editing.

To investigate these questions, we evaluate five general-purpose LLMs as weight editors: GPT-6 Astra [9], GPT-5.6 Sol [10], Kimi-V3 [11], DeepSeek-V4.1-Flash [12], and Tencent Hy4 [13]. Our experiments cover three representative neural network architectures: an MLP on MNIST, ResNet-18 on CIFAR-10, and Qwen2.5-0.5B-Instruct on AG News. We first investigate whether GPT-6 Astra can successfully inject backdoors across these architectures, and then systematically compare the five LLMs under the same editing conditions. We further examine selected Qwen editing records and weight modifications to explore their relationships with the resulting model behavior.

Our experiments reveal three key findings. First, LLM-driven weight editing can successfully inject targeted backdoors across different neural architectures while largely preserving clean performance. GPT-6 Astra achieves a 100% attack success rate across all three target models. Second, successful backdoor injection can require remarkably few parameter modifications. For instance, only six parameters are modified in the MLP, while a successful Qwen edit changes merely 0.02% of its weights. Third, editing capabilities vary substantially across LLMs and target architectures. Although all five LLMs successfully implant the specified backdoor into the MLP, only GPT-6 Astra succeeds across all three targets. Moreover, modifying fewer parameters does not necessarily result in better preservation of clean performance.

Overall, our findings reveal that weight-space programming, despite its promising applications in model improvement and repair, also introduces potential security risks. They highlight the importance of understanding and evaluating the security implications of increasingly powerful LLM-driven weight-editing capabilities, particularly when model weights can be modified by untrusted parties.

Our main contributions are summarized as follows:

• Empirical Security Investigation. We investigate the feasibility of using general-purpose LLMs to inject backdoors directly through weight-space programming, without conventional training or target-model execution during editing.

• Cross-Editor and Cross-Architecture Evaluation. We systematically evaluate five LLM-based weight editors across three neural network architectures, revealing substantial differences in attack effectiveness, parameter modifications, and preservation of clean performance.

• Weight-Edit Analysis and Security Implications. We analyze selected weight modifications and editing records to characterize the observed behavior and limitations of LLM-driven backdoor injection, highlighting potential risks to model integrity.