IntervalBoundPropagation<T, TInput, TOutput>

Models & Types · AiDotNet.AdversarialRobustness.CertifiedRobustness

Implements Interval Bound Propagation (IBP) for certifying neural network robustness.

Implements: ICertifiedDefense<T, TInput, TOutput>

For Beginners

IBP is like asking “if my input can vary within a certain range, what is the guaranteed range of possible outputs?” This helps certify that a model’s predictions are stable within a given perturbation radius.

How It Works

IBP is a formal verification method that propagates interval bounds through neural network layers to compute guaranteed output bounds for all inputs within a specified perturbation region. It provides provable robustness guarantees without requiring adversarial examples.

Mathematical Foundation: For a neural network f(x), IBP computes bounds [y_L, y_U] such that: ∀x ∈ B_p(x₀, ε): y_L ≤ f(x) ≤ y_U

For a linear layer with weights W and biases b:

  • Input interval: [x_L, x_U]
  • W⁺ = max(W, 0), W⁻ = min(W, 0)
  • Lower bound: W⁺ · x_L + W⁻ · x_U + b
  • Upper bound: W⁺ · x_U + W⁻ · x_L + b

For ReLU activation:

  • Lower: max(0, x_L)
  • Upper: max(0, x_U)

Constructors

Constructor Summary
IntervalBoundPropagation() Initializes a new instance of the IntervalBoundPropagation class with default options.
IntervalBoundPropagation(CertifiedDefenseOptions<T> options) Initializes a new instance of the IntervalBoundPropagation class with specified options.

Methods

Method Summary
CertifiedAccuracyMetrics<T> EvaluateCertifiedAccuracy(TInput[] testData, TOutput[] labels, IFullModel<T, TInput, TOutput> model, T radius)
CertifiedDefenseOptions<T> GetOptions()
CertifiedPrediction<T> CertifyPrediction(TInput input, IFullModel<T, TInput, TOutput> model)
CertifiedPrediction<T>[] CertifyBatch(TInput[] inputs, IFullModel<T, TInput, TOutput> model)
T ComputeCertifiedRadius(TInput input, IFullModel<T, TInput, TOutput> model)
byte[] Serialize()
void Deserialize(byte[] data)
void LoadModel(string filePath)
void Reset()
void SaveModel(string filePath)