TorchLean Transformer IBP Workflow #
Small end-to-end workflow:
TorchLean (MHA + LayerNorm + MSE) → lower to NN.IR.Graph → run:
- IBP (
runIBP) - basic CROWN forward bounds (
runCROWN) - objective-dependent backward/dual CROWN (
runCROWNBackwardObjective)
Run:
lake exe verify -- torchlean-transformer-ibp
lake exe verify -- torchlean-transformer-ibp --with-crown
lake exe verify -- torchlean-transformer-ibp --arithmetic ieee
Sequence length for the transformer verification example.
Instances For
Model embedding dimension.
Instances For
Number of attention heads.
Instances For
Per-head embedding dimension.
Instances For
Batch size for the transformer verification example.
Instances For
Input shape (batch × n × dModel).
Instances For
Projection weight shape for Q/K/V: (dModel × (numHeads*headDim)).
Instances For
Output projection weight shape: ((numHeads*headDim) × dModel).
Instances For
LayerNorm scale parameter shape, matching the feature dimension.
Instances For
LayerNorm beta shape, matching the feature dimension.
Instances For
MSE target shape (matches the model output shape).
Instances For
Parameter shapes list for modelLoss (Wq,Wk,Wv,Wo,gamma,beta,target).
Instances For
TorchLean program: mha -> layer_norm -> mse_loss, returning a scalar loss.
Instances For
Runtime-selected typed runner used by the CLI entrypoint.
Instances For
Runtime-selected typed runner for the default IBP-only path.
Instances For
Runtime-selected typed runner for the heavier IBP+CROWN path.
Instances For
CLI entry point for the transformer-IBP workflow.
This is wired into lake exe verify -- torchlean-transformer-ibp.
By default this command is a fast validation check: lower the TorchLean transformer fragment to the
verification IR and run IBP on the scalar loss. Pass --with-crown to also run the experimental
transformer-scale CROWN passes. The separate torchlean-crown-ops command keeps CROWN itself in the
standard check suite on compact graphs, while this file focuses on the heavier attention/layer-norm
front-end path.