arXiv:2611.09650cs.SENov 2026

Manuscript Offprint

arXiv:2611.09650

TensorMutation: Learning Weight-Space Mutations of Deep Learning Models on Neural Graphs

Zaheed Ahmed, Philip Makedonski, Jens Grabowski

Zaheed Ahmed®, Philip Makedonski®, and Jens Grabowski®

Abstract—Mutation testing for deep learning (DL) faces a cost-realism trade-off. The pre-training approach produces realistic but computationally expensive mutants, whereas existing post-training operators modify trained models efficiently but produce mutants that less closely resemble real faults. This study asks whether the trade-off is necessary: can the weight-space effect of a fault-informed pre-training mutation operator be predicted from a trained model, without retraining it? We answer this question with TensorMutation, which represents a trained model as a neural graph and uses a mutation-conditioned graph neural network (GNN) to predict parameter changes. The GNN is trained offline and reused across unseen models so that Tensor-Mutation can generate executable mutants without retraining.

We construct a corpus of 25 252 original-mutant pairs from 71 multilayer perceptron (MLP) classifiers using 11 fault-informed pre-training operators, including 25 newly curated subjects. TensorMutation partially reproduces the behavioral effects of pre-training mutations on nine held-out subjects, and direct weight-space supervision significantly improves weight-space fidelity. On 12 real-fault subjects, TensorMutation achieves the highest median behavioral similarity among the evaluated approaches. The improvement over the post-training tool DeepMutation++ is statistically significant (Holm-adjusted p=0.018p = 0.018), whereas the differences from the pre-training tool DeepCrime and the norm-matched random control are not significant. These results show that fault-informed pre-training mutations leave learnable structure in weight space that transfers to unseen models.

Index Terms—Post-training mutation, weight-space learning, mutation testing, deep neural networks, neural graphs, graph neural networks.

I. INTRODUCTION

MUTANTS are commonly used as proxies for real faults to evaluate the effectiveness of test suites [1]. In deep learning (DL), their use extends beyond serving as test targets. Mutants have been employed to evaluate automated program repair [2], [3], robustness and adversarial testing [4]–[8], test generation, improvement, and prioritization [9]–[11], data cleaning [12], [13], fault localization [14]–[16], evaluation of metamorphic testing techniques [17], and several other testing and debugging tasks [18]–[20]. Across these applications, the usefulness of mutation-based evaluation depends on mutants being representative of faults that occur in real DL systems. At the same time, mutant generation must remain computationally practical if mutation testing is to be applied at scale.

In DL, mutation approaches are commonly divided into pre-training and post-training mutation according to the stage at which the mutation operator is applied [21], [22]. Pre-training

mutation injects faults into the training program or training data and then retrains the model to obtain a mutant [21], [23]. Post-training mutation instead applies mutation operators directly to an already trained model, typically by perturbing its parameters or architecture [4], [21], [24], [25]. The cost of pre-training mutation becomes particularly high when multiple independently trained instances of each mutant are required to account for the stochastic nature of DL training, as in the statistical killing criterion [26] used by DeepCrime [23], [27].

In a preliminary controlled comparison on LeNet-5/MNIST, Abbasishahkoo et al. [28] reported that mutation analysis required less than 49 minutes with DeepMutation++ [4], compared with more than 123 hours with DeepCrime, a difference of more than 150 times. Although this comparison involved only one modest-sized subject, it illustrates the substantial computational overhead introduced by retraining-based mutation. At the same time, our previous empirical study [29] found DeepCrime mutants to resemble real faults more closely than DeepMutation++ mutants. Established post-training approaches avoid retraining through manually defined transformations of trained models rather than transformations learned from fault-informed pre-training mutations. Together, these findings motivate an approach that approximates the effects of fault-informed pre-training mutations while generating mutants without retraining.

This study asks whether pre-training mutations leave learnable structure in the parameters of trained models. A pre-training mutation changes the training process and can therefore alter the learned parameters of the resulting model. Shah et al. [30] found systematic differences in the weights and biases of models trained with data faults, providing evidence that data faults can leave detectable parameter-space signatures. We therefore investigate whether the parameter changes induced by fault-informed pre-training mutation operators can be predicted for previously unseen models. The idea follows from our earlier finding for conventional programs that even chains of manually defined mutations fail to reproduce most real faults, which led us to propose learning mutations from real faults instead [31]. We call this approach TensorMutation because its learned transformation mutates the trained model's weight and bias tensors.

TensorMutation represents a trained model as a neural graph [32] and conditions a graph neural network (GNN) on the requested mutation specification through Feature-wise Linear Modulation (FiLM) [33] to predict parameter changes. It learns this transformation from pairs of original models and their pre-training mutants generated by the fault-informed operators of DeepCrime [23]. To generate a mutant without re-

Zaheed Ahmed, Philip Makedonski, and Jens Grabowski are with the Institute of Computer Science, University of Göttingen, Germany (e-mail: zaheed.ahmed@informatik.uni-goettingen.de; makedonski@informatik.uni-goettingen.de; grabowski@informatik.uni-goettingen.de).

training, TensorMutation applies the predicted changes directly to the trained model and performs any structural modifications required by the specified mutation. Thus, mutant generation is post-training, while the learned transformation is grounded in the effects of pre-training mutation. The GNN is trained beforehand on a corpus of such pairs, so mutant generation for unseen models requires only GNN inference and mutant reconstruction.

Ideally, TensorMutation would learn directly from reproducible real bug-fix pairs. However, obtaining such pairs at the scale required for training remains difficult in DL. Jahangirova et al. [34] were able to reproduce only 54% of the faults considered from existing DL fault datasets, and Morovati et al. [35] found that only about 3% of the machine-learning-related bugs they investigated from GitHub and Stack Overflow were reproducible. Moreover, real faults lack a shared vocabulary: there is no agreed way for a user to request a particular fault type when generating a mutant. Fault-informed mutation operators provide a practical alternative. Each operator represents a fault type documented in empirical studies and provides an explicit specification for generating that type of fault. The same operator can also be applied across subjects and configurations to produce many training pairs. TensorMutation therefore learns from mutants generated by fault-informed pre-training operators rather than directly from real faults. These mutants form synthetic bug-fix pairs, where the original model serves as the fixed version and the mutant as the faulty version, while preserving the fault type represented by the operator. We collect these pairs at scale into the corpus released with this work.

In this study, a subject is a TensorFlow/Keras program that trains a multilayer perceptron (MLP) classifier on its corresponding dataset. We evaluate TensorMutation across 71 subjects and 11 DeepCrime operators, with nine subjects held out for testing, and on 12 real-fault subjects. The evaluation asks four research questions (RQs) that build on one another. RQ1 and RQ2 examine how faithfully TensorMutation reproduces the corresponding pre-training mutants on unseen subjects, in behavior and in weight space. RQ3 then asks whether behavioral fidelity and weight-space fidelity are related. Finally, RQ4 investigates how closely TensorMutation mutants resemble real faults compared with mutants generated by DeepCrime, DeepMutation++, and norm-matched random perturbations, which preserve the magnitude of the predicted change but randomize its direction. We additionally examine, as a design ablation, whether conditioning the GNN on the source model's training configuration improves the learned transformation. The main contributions of this work are:

  • We introduce TensorMutation, a learned post-training mutation approach that predicts the weight-space effects of fault-informed pre-training mutations and generates executable mutants without retraining.

  • We provide empirical evidence that mutation-induced parameter changes contain learnable structure that transfers to unseen subjects and that direct weight-space supervision improves weight-space fidelity. On 12 real-fault subjects, TensorMutation achieves significantly higher behavioral similarity to real faults than DeepMutation++.

  • We release a corpus of 25 252 original-mutant pairs from 71 subjects and 11 fault-informed pre-training operators, including 25 newly curated MLP subjects, to support research on testing and debugging of DL systems.

The remainder of the paper is organized as follows. Section II reviews DL mutation testing and weight-space learning literature in relation to this work. The TensorMutation approach is presented in Section III. Section IV describes the study design and its four RQs. The results for the RQs, followed by the source-context design ablation, are reported in Section V. Section VI discusses the findings and their implications, and Section VII examines threats to validity. Finally, Section VIII concludes the study and outlines future directions.

References (66)