Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Proof, not just testing
Imagine a small neural network inside an aircraft’s collision-avoidance system. Engineers can test it on millions of situations, but the space of possible situations is infinite, and a bad answer in one untested corner could be catastrophic. Formal verification asks a precise question, such as ‘is there any intruder position on the left for which the network says turn left?’, and answers it for every input at once. If the answer is no, that is a proof. If the answer is yes, the verifier hands back the exact situation where the network fails, which testing might never have found.
Background: the network's advice (grey clear of conflict, amber turn left, blue turn right). Property: every intruder position with x ≤ −0.2 gets an advice other than "turn left".
Result: verified after 17 boxes.
Green boxes were proved by interval bounds; the verifier only splits where the bounds are too loose, so the boxes shrink towards the decision boundary near x = 0.
Reluplex (Katz and colleagues, 2017) verified properties of networks designed for the ACAS Xu aircraft collision-avoidance system and found violations of some of them.
- 1. Formal verification reasons about…
- 2. When a property fails, a verifier returns…
- 3. Testing alone can…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Specification: a precondition on inputs (a region, such as a box or an L∞ ball around a point) and a postcondition on outputs (such as ‘class A wins’ or ‘class B never wins’), usually linear in the logits.
- Sound: whatever is reported as proved is true. Complete: every true property can be proved, and every false one yields a counterexample.
- Local robustness: a specification around one input (topic M1-4); global properties: over large regions of input space, as in ACAS Xu.
- Exact (complete) methods: SMT solvers that understand ReLUs (Reluplex, Marabou), mixed-integer linear programming (MILP) with one binary variable per ReLU, and branch and bound.
- Incomplete methods: sound bounds that may fail to prove true properties: interval bound propagation, linear relaxations, abstract interpretation (topic M2-2).
- Branch and bound: bound the property on a region; if the bound proves it, stop; if a point violates it, report a counterexample; otherwise split the region (input splitting) or a ReLU’s two phases (ReLU splitting) and repeat.
- Stable and unstable ReLUs: a ReLU is stable on a region if its input has one sign throughout; only unstable ReLUs make verification hard.
- 1. A sound verifier never…
- 2. A complete verifier…
- 3. An unstable ReLU's input…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.A branch-and-bound verifier
Exercise 1.
- A toy collision-avoidance task: input the intruder’s position (x, y) in [−1, 1]²; advice ‘clear of conflict’ beyond distance 0.7, otherwise ‘turn left’ when the intruder is on the right and ‘turn right’ when it is on the left.
- ReLU networks with two hidden layers trained to give the advice.
- Interval bounds on differences of logits over a box, with the last layer folded into the comparison; specifications ‘always class A’ and ‘never class B’.
- Branch and bound on the input box, processed in batches: prove, find a counterexample at a box centre, or split the widest side; and random testing for comparison.
- Checks: the bounds hold at random points in random boxes; a verified property survives a dense grid test; every counterexample really violates the property.
Practice.
- Write the specification first, as linear constraints on inputs and outputs, and agree it with domain experts: verification proves exactly what is written.
- Verify a margin, not a knife edge: properties with a safety margin are far easier to prove and more meaningful.
- Use a modern verifier (α,β-CROWN, Marabou, NNV, ERAN) rather than your own for real systems, and report time-outs honestly as ‘unknown’.
- Keep verified networks small and well-conditioned: fewer unstable ReLUs means faster proofs; training for verifiability helps.
- Treat counterexamples as test cases: add them to the test suite and retrain or repair.
def verify(L, lo, hi, target=None, forbidden=None, max_boxes=20000):
boxes = [(lo, hi)]; done = 0
while boxes:
B, boxes = boxes[:512], boxes[512:]; LO, HI = ...; done += len(B)
ok = proved(L, LO, HI, target, forbidden) # sound interval bounds
bad = violates(L, (LO + HI) / 2, target, forbidden) # concrete check at the centres
if bad.any(): return "falsified", done, centre_of_first_bad
for each box not proved: split its widest side in half and queue both halves
if done >= max_boxes and boxes: return "unknown", done, None
return "verified", done, None- 1. A property with a safety margin is…
- 2. A verifier time-out should be reported as…
- 3. Counterexamples should be…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Why exact verification is hard. On any region where every ReLU’s phase is fixed, the network is affine, so a linear specification reduces to a linear program. A network with k unstable ReLUs can have up to 2^k such pieces, and Katz and colleagues (2017) proved that deciding even simple properties of ReLU networks is NP-complete, by reducing 3-SAT to it. Practical verifiers succeed because most ReLUs are stable on small regions (Practice 3) and good bounds prune most of the pieces.
Mixed-integer encoding. If a ReLU’s input x is known to lie in [l, u] with l < 0 < u, then y = ReLU(x) is encoded exactly by y ≥ 0, y ≥ x, y ≤ u·a, y ≤ x − l·(1 − a) with binary a. A MILP solver then minimises the margin over the region; the property holds if the minimum is positive (Tjeng, Xiao and Tedrake, 2019). Relaxing a to [0, 1] gives the ‘triangle’ convex hull, the starting point of incomplete methods.
Why branch and bound is complete here. Interval bounds are sound: through an affine layer, input in [c − r, c + r] gives output in [Wᵀc + b − |W|ᵀr, Wᵀc + b + |W|ᵀr], and ReLU is monotone. The looseness of the bounds shrinks in proportion to the width of the box, so if a property holds with some positive margin δ, every box narrower than a size proportional to δ is proved, and the search terminates. If the property is false on a set with non-empty interior, some box centre eventually lands in it. The cost is the catch: in d input dimensions, halving the box width multiplies the number of boxes by up to 2^d, which is why Exercise 2 needed about 13 to 60 times more boxes for each extra input, and why ReLU splitting and linear relaxations matter for larger problems.
- 1. Deciding properties of ReLU networks is…
- 2. In the big-M encoding, a binary a = 0 forces…
- 3. Input splitting gets expensive as…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.For a safety property of a small advisory network, how does the effort to verify it grow as the safety margin shrinks, how often does random testing find the violations a verifier finds, and how does the effort grow with the number of inputs?
History.
- L. Pulina and A. Tacchella (2010) first verified neural networks with SMT solvers; K. Julian and colleagues (2016) compressed the ACAS Xu collision-avoidance tables into neural networks.
- G. Katz and colleagues (2017) introduced Reluplex, verified ACAS Xu properties and proved NP-completeness; R. Ehlers (2017) introduced Planet; X. Huang and colleagues (2017) verified image classifiers layer by layer.
- S. Wang and colleagues (2018) introduced ReluVal, branch and bound with input splitting; R. Bunel and colleagues (2018) unified branch-and-bound verifiers; V. Tjeng, K. Xiao and R. Tedrake (2019) verified with MILP; G. Katz and colleagues (2019) released Marabou.
- The annual VNN-COMP competition started in 2020; α,β-CROWN (S. Wang, H. Zhang and colleagues, 2021) combined bound propagation with branch and bound and has won repeatedly.
Exercise 2.
- Networks with two hidden layers of width 16 and 32, trained on 1000 points (test accuracy 0.985 and 0.990 for seed 0).
- Property: for every intruder position with x ≤ −m (on the left), the advice is never ‘turn left’; safety margins m = 0.2, 0.1, 0.05, 0.02, 0.01, 0.005 and 0.
- For each: branch-and-bound result and boxes examined; and whether 10,000 uniform random tests found a violation.
- Cost against input dimension: the m = 0.1 property for width-16 networks with 0, 1 or 2 extra irrelevant inputs (budget 30,000 boxes).
Seed 0 (V verified, F falsified; boxes examined; * random tests also found a violation):
| m | 0.2 | 0.1 | 0.05 | 0.02 | 0.01 | 0.005 | 0 |
|---|---|---|---|---|---|---|---|
| width 16 | V 17 | V 43 | V 77 | V 153 | V 243 | V 371 | F 759 * |
| width 32 | V 33 | V 67 | V 97 | V 175 | V 283 | V 495 | F 701 |
Seeds 1 and 2: width 16 was falsified from m = 0.005 down; width 32 from m = 0.01 (seed 1) and from m = 0.05 (seed 2), where the counterexample was an intruder at (−0.052, 0.646), on the left at distance 0.65, which the network told to turn left.
Boxes for the m = 0.1 property with 2, 3 and 4 inputs: 39, 1077 and more than 30,000 (unknown) for seed 0; 25, 1553, 20,097 and 47, 1113, 24,337 for seeds 1 and 2.
Findings.
- Effort grew as the margin shrank: for the width-16 network, from 17 boxes at m = 0.2 to 371 at m = 0.005, as boxes had to shrink towards the decision boundary.
- All six networks were falsified at m = 0 (the learned boundary is never exactly at x = 0), and 8 more properties failed at small positive margins in seeds 1 and 2; the counterexamples lay within 0.06 of the line x = 0.
- Random testing missed 3 of the 14 violations found by the verifier, including the seed 2 network that told an intruder at distance 0.65 on the left to turn left.
- Each extra input multiplied the effort by about 13 to 60, and the 4-input problem exhausted the 30,000-box budget for seed 0: input splitting does not scale with dimension.
Verification in practice
- Tools: α,β-CROWN, Marabou, NNV, ERAN, PyRAT and nnenum; the VNNLIB format and VNN-COMP benchmarks make results comparable.
- Applications: ACAS Xu and other airborne collision-avoidance networks, perception components with local robustness specifications, control policies (reachability of closed-loop systems), and neural network controllers for spacecraft and drones.
- Limits: specifications are hard to write for perception (‘is this a pedestrian?’ has no formal definition), and exact methods scale to thousands, not billions, of neurons; verification is one piece of evidence in a safety case (topic M2-5).
References
- G. Katz, C. Barrett, D. Dill, K. Julian and M. Kochenderfer (2017). “Reluplex: an efficient SMT solver for verifying deep neural networks.” CAV.
- V. Tjeng, K. Xiao and R. Tedrake (2019). “Evaluating robustness of neural networks with mixed integer programming.” ICLR.
- S. Wang, K. Pei, J. Whitehouse, J. Yang and S. Jana (2018). “Formal security analysis of neural networks using symbolic intervals.” USENIX Security.
- R. Bunel, I. Turkaslan, P. Torr, P. Kohli and M. P. Kumar (2018). “A unified view of piecewise linear neural network verification.” NeurIPS.
- C. Liu, T. Arnon, C. Lazarus, C. Strong, C. Barrett and M. Kochenderfer (2021). “Algorithms for verifying deep neural networks.” Foundations and Trends in Optimization.