CROWN Graph #
Graph-based LiRPA scaffolding (IBP + CROWN-style affine bounds).
This file is the "graph engine" counterpart to NN.MLTheory.CROWN.Core:
coredefines the scalar/box/affine primitives (Box,AffineVec,IBP.linear),graphlifts those primitives to arbitrary tensor DAGs (NN.IR.Graph).
What this module is for:
- Representing computation graphs over typed tensors.
- Propagating interval bounds forward (IBP).
- Propagating affine bounds (CROWN/DeepPoly style) w.r.t. a designated input node.
- Optionally running objective-dependent backward passes for tighter bounds.
Design notes:
- We store flattened bounds (
FlatBox,FlatAffine*) so we can reuseAffineVecunchanged. - Sequence models are represented by unrolling recurrent cells into a DAG (shared parameters, repeated ops).
- Transformer-style models rely on matmul/softmax/elementwise ops; relaxations are added incrementally.
References:
- auto_LiRPA: Xu et al., "Automatic Perturbation Analysis for Scalable Certified Robustness and Beyond", NeurIPS 2020, arXiv:2002.12920 (https://arxiv.org/abs/2002.12920).
- CROWN: Zhang et al., "Efficient Neural Network Robustness Certification with General Activation Functions", arXiv:1811.00866 (https://arxiv.org/abs/1811.00866).
PyTorch analogues (conceptual):
torch.fxgraphs as a user-facing DAG representation: https://pytorch.org/docs/stable/fx.htmlauto_LiRPAas a practical LiRPA implementation over PyTorch graphs.
Alias for the typed IR computation graph used by the CROWN/LiRPA engines.
Instances For
Alias for the IR node kind enumeration used by the graph engine.
Instances For
Alias for the IR node record used by the graph engine.
Instances For
Flattened affine form for a node output with respect to a fixed flattened input.
This represents y ≈ A*x + c for a chosen input node x.
Instances For
Per-node bound state (flattened).
The option fields record which analyses have populated a node: an interval-only pass fills ibp?,
while affine CROWN passes additionally fill aff?.
- shape : Spec.Shape
Original (unflattened) tensor shape of the node output.
Interval bounds (IBP) if available.
- aff? : Option (FlatAffine α)
Affine form if available.