Minimal Multi-Layer Modifications of Deep Neural Networks

Idan Refaeli, Guy Katz

Abstract

Deep neural networks (DNNs) have become increasingly popular in recent years. However, despite their many successes, DNNs may also err and produce incorrect and potentially fatal outputs in safety-critical settings, such as autonomous driving, medical diagnosis, and airborne collision avoidance systems. Much work has been put into detecting such erroneous behavior in DNNs, e.g., via testing or verification, but removing these errors after their detection has received lesser attention. We present here a new tool, called 3M-DNN, for repairing a given DNN, which is known to err on some set of inputs. The novel repair procedure implemented in 3M-DNN computes a modification to the network's weights that corrects its behavior, and attempts to minimize this change via a sequence of calls to a backend, black-box DNN verification engine. To the best of our knowledge, our method is the first one that allows repairing the network by simultaneously modifying multiple layers. This is achieved by splitting the network into sub-networks, and applying a single-layer repairing technique to each component. We evaluated 3M-DNN tool on an extensive set of benchmarks, obtaining promising results.

Introduction

As deep neural networks (DNNs) are increasingly deployed in safety-critical domains like autonomous driving and medical diagnosis, the ability to "patch" identified bugs becomes paramount. While tools for detecting errors—such as formal verification and adversarial testing—have matured, the process of fixing these errors remains challenging. Traditional retraining is computationally expensive, requires original training data, and often introduces new regressions.

Previous repair methods typically restricted modifications to a single layer. However, this constraint often prevents the discovery of more elegant, minimal fixes that are only possible when multiple layers are adjusted simultaneously. This research introduces 3M-DNN, a framework designed to find the smallest possible weight modifications across multiple layers to correct erroneous behavior while preserving overall model performance.

The 3M-DNN Framework

The core innovation of 3M-DNN is its ability to decompose the complex multi-layer repair problem into a sequence of simpler, single-layer sub-problems. This is achieved through a two-level architecture:

  1. Network Splitting: The tool partitions a DNN into sub-networks at specific "separation layers." These intermediate layers act as virtual inputs and outputs for the resulting components.
  2. The Search Level (Top): This level uses heuristic search strategies to propose new target values for neurons in the separation layers.
  3. The Modification Level (Bottom): For every proposed target, the tool utilizes a backend verification engine (such as Marabou) to determine if the weights in each sub-network can be adjusted to meet those targets.
Figure 3: The 3M-DNN approach splits the network into sub-networks (N0 and N1) at separation layers to simplify the repair process.

To navigate the non-convex search space of potential modifications, the authors implemented three strategies: Random Search, Greedy Search, and Monte Carlo Tree Search (MCTS). MCTS, in particular, balances exploration and exploitation to avoid local minima in the weight landscape.

Experimental Evaluation

The framework was evaluated using a network trained on the MNIST dataset, consisting of eight layers (six hidden layers with 20 neurons each). The researchers identified specific misclassified inputs and used 3M-DNN to find weight modifications that corrected these classifications.

Key results from these experiments include:

  • Search Efficiency: Greedy and MCTS strategies significantly outperformed random sampling. On average, they found modifications an order of magnitude smaller than those found by random search (~0.013 vs ~0.15).
  • Accuracy Preservation: The repairs successfully fixed targeted errors without degrading the network's performance on the original test set. In some instances, the overall accuracy even slightly improved after the patch.

Key Findings: The Multi-Layer Advantage

The most significant insight of this work is the empirical proof that multi-layer modifications can be more efficient than single-layer ones. By allowing changes across different parts of the network, 3M-DNN can find a smaller total change (measured by L1 or L∞ norms) than any single-layer modification could achieve.

Figure 4: An illustration of a multi-layer modification where small changes in two different layers correct the network output more efficiently than a large change in one.

In head-to-head comparisons, the multi-layer approach consistently yielded smaller modifications. For example, on a specific benchmark, the multi-layer fix required a modification size of 2.11, compared to 2.21 for the best single-layer alternative.

Conclusion and Future Work

3M-DNN demonstrates that multi-layer repair is a viable and superior method for maintaining DNN integrity. While currently tested on MNIST-sized models, the framework provides a foundation for more surgical AI maintenance. Future research will focus on scaling these techniques to industry-sized models through parallelization and the potential use of neural controllers to guide the search process more efficiently.

Summary updated

Abstract

Deep neural networks (DNNs) have become increasingly popular in recent years. However, despite their many successes, DNNs may also err and produce incorrect and potentially fatal outputs in safety-critical settings, such as autonomous driving, medical diagnosis, and airborne collision avoidance systems. Much work has been put into detecting such erroneous behavior in DNNs, e.g., via testing or verification, but removing these errors after their detection has received lesser attention. We present here a new tool, called 3M-DNN, for repairing a given DNN, which is known to err on some set of inputs. The novel repair procedure implemented in 3M-DNN computes a modification to the network's weights that corrects its behavior, and attempts to minimize this change via a sequence of calls to a backend, black-box DNN verification engine. To the best of our knowledge, our method is the first one that allows repairing the network by simultaneously modifying multiple layers. This is achieved by splitting the network into sub-networks, and applying a single-layer repairing technique to each component. We evaluated 3M-DNN tool on an extensive set of benchmarks, obtaining promising results.
BibTeX
@inproceedings{refaeli2022minimal,
  author = {Idan Refaeli and Guy Katz},
  title = {{Minimal Multi-Layer Modifications of Deep Neural Networks}},
  booktitle = {NSV/FoMLAS@CAV},
  year = {2022},
  doi = {10.1007/978-3-031-21222-2\_4},
}
Figure