TorchLean API

NN.Examples.Verification.Robustness.TorchLeanRobustness

TorchLean robustness #

End-to-end robustness certification for a TorchLean model.

We build a compact 2-class classifier in TorchLean, compile it to the verifier IR, and certify a margin condition on an ℓ∞ input box using:

Spec we certify (binary logits): ∀ x ∈ [x0-ε, x0+ε], logit0(x) > logit1(x)

Run: lake exe verify -- torchlean-robustness lake exe verify -- torchlean-robustness --float32-mode ieee754exec

Input dimension for the TorchLean robustness example.

Instances For

    Hidden width for the TorchLean robustness example.

    Instances For

      Number of output logits/classes.

      Instances For

        Parameter shapes list used by the compiled TorchLean program ([W1,b1,W2,b2]).

        Instances For

          Compute a (conservative) margin lower bound lo0 - hi1 from logit bounds.

          Instances For

            Decide if the output bounds certify logit0 > logit1.

            Instances For

              TorchLean program for a 2-layer ReLU MLP producing two logits.

              Instances For

                Run the robustness check once under a chosen scalar backend α.

                This compiles the TorchLean program to the verifier IR, then computes output bounds with IBP and an affine/CROWN-style pass.

                Instances For

                  CLI entry point for the TorchLean robustness workflow.

                  This is wired into lake exe verify -- torchlean-robustness.

                  Instances For