Abstract
Early Exit (EE) neural networks offer a promising solution to the high computational costs of deep learning by terminating inference once a confidence threshold is met. However, their dynamic execution paths pose significant challenges for formal safety verification. This paper introduces a formal framework to verify the robustness of EE architectures. We demonstrate that rather than complicating verification, the conditional logic of early exits can be leveraged to significantly accelerate the verification process. Our optimized algorithms achieve up to 10x speedups over baseline methods and successfully verify large-scale models where standard approaches fail.
Introduction
Deep Neural Networks (DNNs) are increasingly deployed in resource-constrained environments, leading to the rise of efficiency-oriented architectures. Early Exit (EE) networks are a prominent example, utilizing intermediate layers to produce predictions and stop computation early if the model is sufficiently confident. While EE networks reduce latency and energy consumption, their deployment in safety-critical systems—such as autonomous vehicles or medical diagnostics—requires formal guarantees of robustness.
Formal verification aims to mathematically prove that a model's output remains consistent within a specific neighborhood of an input (e.g., resistance to adversarial noise). Standard verification tools are designed for fixed-path architectures. In contrast, EE networks have a dynamic "path" that depends on the input itself. This paper addresses the gap between efficiency and safety by providing a rigorous framework for EE verification.
The Verification Challenge in EE Networks
The primary difficulty in verifying EE networks lies in their conditional execution. A standard verifier might identify a "spurious" error in a deep layer of the network. However, in an EE model, that deep layer might never be reached for a given input because the model would have exited at an earlier stage. Ignoring this logic leads to overly pessimistic results.
To address this, we define the Revised Robustness Property ($P_{ee}$). Under this property, a counterexample is only considered valid if:
- A "runner-up" class exceeds the winning class's score at some exit $e$.
- The "true" winner did not meet the required confidence threshold at any exit preceding $e$.
Methodology and Algorithms
We developed two primary algorithmic approaches to solve the $P_{ee}$ property using off-the-shelf verifiers like $\alpha,\beta$-CROWN.
Baseline Approach (Algorithm 1)
The baseline utilizes a nested loop strategy. It queries the verifier for every possible exit and every potential "runner-up" class. While sound, this approach is computationally expensive as it does not exploit the structural advantages of the EE architecture.
Optimized Approach (Algorithm 2)
To improve efficiency, we introduced two key heuristics:
- The "Break" Strategy: If the verifier proves that the original winning class consistently prevails across the entire input neighborhood at an early exit, the algorithm terminates. This "short-circuits" the process, removing the need to check deeper, more complex layers.
- The "Continue" Strategy: If the winning class's score is sufficiently high, the algorithm can mathematically skip the verification of individual runner-up classes for that specific exit, reducing the total number of queries.
Furthermore, we provide a complexity analysis proving that the problem is Fixed-Parameter Tractable (FPT) under the assumption of trace stability. Trace stability suggests that inputs within a small neighborhood generally follow the same exit path, a phenomenon we observed frequently in practice.
Experimental Results
We evaluated our framework on MNIST, CIFAR-10, and CIFAR-100 datasets using architectures ranging from LeNet-5 to ResNet-18 and VGG-16.
Efficiency Gains
The optimized Algorithm 2 demonstrated significant performance improvements:
- Speed: It performed up to 10x faster than the baseline on safe cases.
- Scalability: In VGG-16 benchmarks, the baseline algorithm frequently timed out, whereas the optimized version successfully completed the verification.
- Comparison to Vanilla Models: On a ResNet-18 model (CIFAR-100), the EE version was verified in approximately one hour. In contrast, the standard "vanilla" version of the same model failed to finish within a two-hour limit.
The Accuracy-Latency-Verifiability Trade-off
Our findings highlight a three-way trade-off. Higher confidence thresholds generally improve accuracy and robustness but increase computational latency and verification time. Conversely, the presence of early exits can make a model easier to verify than its non-EE counterpart, as the verifier can often ignore the "tail" of the network.
Conclusion and Future Work
This work demonstrates that efficiency and formal safety are not mutually exclusive. By accounting for the conditional logic of Early Exit networks, we can achieve faster verification than is possible with standard architectures.
Future research will focus on extending this framework beyond local robustness to include general safety constraints and fairness predicates. Additionally, exploring more complex exit mechanisms and implementing distributed parallelization will be essential for scaling these techniques to even larger, industrial-scale models.
Summary updated