TL;DR
This paper introduces DIFFRNN, the first method for formally verifying the functional equivalence of two recurrent neural networks (RNNs), even when they use non-linear activation functions like Sigmoid and Tanh. DIFFRNN achieves this by precisely bounding the differences between corresponding neurons in the two networks, outperforming existing tools in accuracy and speed.
What Problem Does This Paper Address?
As neural networks, particularly RNNs, are increasingly deployed on resource-constrained devices (like mobile phones), they often undergo compression or optimization. However, these heuristic techniques don't guarantee that the optimized network behaves identically to the original, especially concerning safety and robustness against adversarial inputs. Existing verification methods, like RELUDIFF, are limited to feed-forward networks with ReLU activations and cannot handle the complexities of RNNs, such as sequential data, feedback loops, and non-linearities like Sigmoid and Tanh. This gap leaves a critical need for a method that can formally certify the equivalence of two structurally similar RNNs.
Methods
DIFFRNN tackles the challenge of verifying RNN equivalence by developing novel techniques to bound the differences between corresponding neurons in two networks. Key aspects of their approach include:
- Differential Verification: Instead of verifying a single network's properties, DIFFRNN focuses on proving that the difference between the outputs of two structurally similar networks (e.g., an original and a compressed version) is within a small, predefined bound ($\epsilon$).
- Handling Non-linearities: Unlike prior work that relies on piecewise linear (ReLU) activations, DIFFRNN handles Sigmoid and Tanh by bounding these non-linear activation functions with linear constraints. This is achieved by formulating optimization problems to find tight bounding boxes on the non-linear surfaces.
- RNN-Specific Challenges: The method addresses the recursive nature of RNNs, sequential inputs, and complex interactions within gates and states by performing layer-by-layer analysis and propagating bounds.
- Constrained Optimization and SMT Solvers: To compute tight bounds on the differences of non-linear functions, DIFFRNN employs constrained optimization problems. The soundness of these bounds is then formally proven using the dReal SMT solver, which supports non-linear constraints.
- Pairing Neurons: A core idea is to directly compute the difference between corresponding neurons in the two networks, rather than bounding each network's output independently and then subtracting. This "pairing" approach leads to tighter bounds.
Datasets
The paper evaluates DIFFRNN on benchmarks derived from:
- MNIST: A dataset for handwritten digit recognition.
- Human Activity Recognition (HAR): A dataset for recognizing human activities from smartphone sensor data.
The authors create pairs of networks by taking existing trained networks and modifying their edge weights (e.g., by rounding 32-bit floats to 16-bit floats) to simulate compression or optimization.
Key Insights and Ideas
- The Importance of Direct Difference Bounding: The paper highlights that directly computing the difference between corresponding neurons in two networks, rather than bounding each network separately and then subtracting, yields significantly tighter and more accurate results. This is crucial for proving equivalence.
- Bridging the Gap for Non-ReLU RNNs: DIFFRNN's ability to handle Sigmoid and Tanh activations is a significant advancement, as many real-world RNNs utilize these functions, making them inaccessible to previous verification tools.
- Soundness through SMT Solvers: The formal verification of the computed bounds using dReal is critical for providing guarantees, moving beyond heuristic or statistical checks.
- Efficiency Gains from Specialized Techniques: By developing specific techniques for RNNs and non-linearities, DIFFRNN achieves substantial speedups and improved accuracy compared to adapting existing single-network verification tools.
Key Results
DIFFRNN demonstrates strong performance across various benchmarks:
- Accuracy: DIFFRNN significantly outperforms state-of-the-art tools like POPQORN. For instance, on average, DIFFRNN is 2.73X more accurate and verifies 60% more properties. In some cases, DIFFRNN can verify properties that POPQORN cannot verify at all.
- Speed: DIFFRNN is also faster than its counterparts. For example, it is faster than CROWN in over 93% of cases and faster than POPQORN in many Vanilla RNN and LSTM benchmarks.
- Verification Success: DIFFRNN successfully verifies a much larger proportion of the tested problems compared to existing tools. For example, on MNIST for Vanilla RNNs, DIFFRNN verified 502 out of 600 problems, while POPQORN verified only 156. For LSTMs on HAR, DIFFRNN verified all 600 cases, while POPQORN verified none.
Limitations and Future Work
- Scalability with Sequence Length and Layers: The paper notes that while DIFFRNN is effective for 1-layer RNNs with up to 20 input sequences, the difference intervals can become loose for longer sequences or multi-layer RNNs. This is attributed to the compounding nature of interval arithmetic and the increased complexity of optimization problems.
- Future Work: The authors suggest extending their methodology to handle more complex network architectures and longer sequences. They also propose exploring similar approaches for producing more robust and verifiable networks during the training process. The current method's limitations with MNIST for LSTMs suggest further research is needed in that area.
Summary updated