NNREPAIR: Constraint-based Repair of Neural Network Classifiers
We present NNREPAIR, a constraint-based technique for repairing neural network classifiers by i) fixing the logic of the network at an intermediate layer, and ii) fixing the decision conditions of the network at the last layer. NNREPAIR first uses fault localization to find potentially faulty network parameters (specifically weights) and then performs repair using constraint solving to apply small modifications to remedy the defects. We present novel strategies to enable precise yet efficient repair such as inferring correctness specifications to act as oracles for intermediate layer repair, and generation of experts wrt each class. We demonstrate the technique in the context of three different scenarios: (1) Improving the over all accuracy of a model, (2) Fixing security vulnerabilities caused by poisoning of training data and (3) Improving the robustness of the network against adversarial attacks. Our evaluation on MNIST and CIFAR-10 models shows that NNREPAIR can improve the accuracy by 45.56% on poisoned data and 11.11% on adversarial data. NNREPAIR also provides improvement, albeit modest, in the overall accuracy of models, without requiring new data or re-training.