TorchLean API

NN.Examples.Verification.LiRPA.AttentionVerify

AttentionVerify #

LiRPA/IBP certificate checker: attention-like softmax graph.

This example builds a compact computation graph: input -> matmul -> softmax -> matmul, seeds a small input box, and checks a JSON certificate produced by an external IBP/LiRPA tool.

References:

Export (Python): python3.12 scripts/verification/lirpa/export_attention_cert.py

Run (Lean): lake exe verify -- lirpa-attention [NN/Examples/Verification/LiRPA/attention_softmax_cert.json]

Small fixed graph with one softmax node, used to exercise certificate checking.

Instances For

    Seed deterministic weights for the two matmul nodes in buildGraph.

    Instances For

      Insert an L∞ input box of radius eps around a fixed center point.

      Instances For

        Check an IBP certificate JSON against this attention graph.

        This is wired into lake exe verify -- lirpa-attention [path].

        Instances For