Skip to main content

Lorentz Local Canonicalization

Tests codecov PyPI version pytorch ruff

LLoCa-CS LLoCa-HEP

This repository contains a standalone implementation of Lorentz Local Canonicalization (LLoCa) by Jonas Spinner, Luigi Favaro, Peter Lippmann, Sebastian Pitz, Gerrit Gerhartz, Huilin Qu, Tilman Plehn, and Fred A. Hamprecht. LLoCa uses equivariantly predicted local reference frames and geometric message passing between these frames to make any architecture Lorentz-equivariant. You can read more about LLoCa in the following two papers and in the LLoCa documentation:

Installation

You can either install the latest release using pip

pip install lloca

or clone the repository and install the package in dev mode

git clone https://github.com/heidelberg-hepml/lloca.git
cd lloca
pip install -e ".[dev]"
pre-commit install

How to use LLoCa

Please have a look at the LLoCa documentation and our example notebook for the LLoCa-Transformer.

Features

  • Backbone architectures in lloca/backbone: Transformer (and transformer_v2.Transformer with RMSNorm and GLU), ParticleTransformer, ParticleNet, GraphNet, MLP
  • The Transformer backbone supports several attention kernels that can be installed optionally with e.g. pip install lloca[varlen-attention], pip install lloca[xformers-attention], pip install lloca[flex-attention], pip install lloca[flash-attention].
  • LLoCaMessagePassing as blueprint for generic LLoCa graph network backbones
  • Equivariant vector predictors in lloca/equivectors: MLPVectors, LGATrVectors, LGATrSlimVectors, PELICANVectors
  • Local frames for equivariant architectures on several symmetry groups: SO(1,3) (LearnedPDFrames, LearnedSO13Frames, LearnedRestFrames), SO(3) (LearnedSO3Frames), SO(1,1)xSO(2) (LearnedZFrames) and SO(2) (LearnedSO2Frames); as well as the corresponding random global frames for data augmentation
  • Support for arbitrary higher-order representations with the TensorReps class
  • Parity-odd representations (0p, 1p, ...), which pick up a factor sign(det L). All Frames-Net classes in this package predict proper Lorentz transformations (det L = +1), so parity-odd and parity-even representations only differ for improper frames.

Coming soon:

  • Support for cross-attention
  • More backbone architectures

Examples

Let us know if you use lloca, so we can add your repo to the list!

Citation

If you find this code useful in your research, please cite our papers

@article{Favaro:2025pgz,
    author = "Favaro, Luigi and Gerhartz, Gerrit and Hamprecht, Fred A. and Lippmann, Peter and Pitz, Sebastian and Plehn, Tilman and Qu, Huilin and Spinner, Jonas",
    title = "{Lorentz-Equivariance without Limitations}",
    eprint = "2508.14898",
    archivePrefix = "arXiv",
    primaryClass = "hep-ph",
    month = "8",
    year = "2025"
}
@article{Spinner:2025prg,
    author = "Spinner, Jonas and Favaro, Luigi and Lippmann, Peter and Pitz, Sebastian and Gerhartz, Gerrit and Plehn, Tilman and Hamprecht, Fred A.",
    title = "{Lorentz Local Canonicalization: How to Make Any Network Lorentz-Equivariant}",
    eprint = "2505.20280",
    archivePrefix = "arXiv",
    primaryClass = "stat.ML",
    month = "5",
    year = "2025"
}

Metadata

Release files for lloca 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lloca 2.0.0
File Size Uploaded Provenance Actions
lloca-2.0.0.tar.gz 279.9 kB With provenance Details for lloca-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lloca 2.0.0
File Interpreter ABI Platform Actions
lloca-2.0.0-py3-none-any.whl Python 3 none any Details for lloca-2.0.0-py3-none-any.whl

Total release size: 357.7 kB

Release files / lloca-2.0.0.tar.gz

Download URL lloca-2.0.0.tar.gz
Size 279.9 kB
Tags Source
SHA-256 checksum
How to use checksums
338259fe4c48b5c8980694ee9f0d749e39ea2654e0dd03ee852175a00fd2f16e
BLAKE2b-256 checksum
How to use checksums
7d92692c2709e709f4565d1d4f9d763f07bd85c23a6c5f771d9741048714a203
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / lloca-2.0.0-py3-none-any.whl

Download URL lloca-2.0.0-py3-none-any.whl
Size 77.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef774f87b71f363c8a2e111819dc383e7ef008ae53721da20d38077e5209f7cc
BLAKE2b-256 checksum
How to use checksums
29bb0dbe309ad43e8e8409120dbc9fd330f51f193034a4da16f78d6a54160147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Security for lloca 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lloca-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page