This repository contains a standalone implementation of the Lorentz-Equivariant Geometric Algebra Transformer (L-GATr), as well as the more efficient L-GATr-slim variant. L-GATr uses spacetime geometric algebra representations to construct Lorentz-equivariant layers and combines them into a transformer architecture, whereas L-GATr-slim uses only scalar and vector representations. You can read more about L-GATr as well as L-GATr-slim in the L-GATr documentation as well as in the original papers:
- Lorentz-Equivariant Geometric Algebra Transformers for High-Energy Physics (L-GATr; for ML audience)
- A Lorentz-Equivariant Transformer for All of the LHC (L-GATr; for HEP audience)
- Economical Jet Taggers - Equivariant, Slim, and Quantized (L-GATr-slim)
Installation
You can either install the latest release using pip
pip install lgatr
or clone the repository and install the package in dev mode
git clone https://github.com/heidelberg-hepml/lgatr.git
cd lgatr
pip install -e ".[dev]"
pre-commit install
How to use L-GATr
Overview of features in L-GATr:
- L-GATr encoder and decoder as
LGATrandConditionalLGATr LGATrSlimandConditionalLGATrSlimas efficient variants that use only scalar and vector representations- Set
compile=Truefor typically 2x-3x speedup, andcompile_kwargs={"dynamic": True}for variable-length sequences - Additional attention backends, installation via
pip install lgatr[varlen-attention],pip install lgatr[xformers-attention],pip install lgatr[flex-attention],pip install lgatr[flash-attention]or any combination. You might have to runpython -m pip install --upgrade pip setuptools wheelfirst, because these extra imports require modern versions ofpip,setuptoolsandwheel. - Interface to the geometric algebra: Embedding and extracting multivectors; spurions for symmetry breaking at the input level
- Many hyperparameters to play with, organized via the
SelfAttentionConfig,CrossAttentionConfig,MLPConfigandPrimitivesConfigobjects
Please have a look at the L-GATr documentation and our example notebooks for LGATr, ConditionalLGATr and LGATrSlim.
Examples
- https://github.com/heidelberg-hepml/lorentz-gatr: Original
LGATrimplementation used for the papers. This repo doesn't import thelgatrpackage, but has its own (outdated)lgatr/folder. (paper1 paper2) - https://github.com/heidelberg-hepml/lloca-experiments: Code for the LLoCa project, including L-GATr as a baseline. The main results from https://github.com/heidelberg-hepml/lorentz-gatr can be reproduced here using the
lgatrpackage. (paper1 paper2) - https://github.com/spinjo/weaver-core/blob/lgatr/weaver/nn/model/LGATr.py: L-GATr in the CMS boosted object tagging library
weaver. Includes examples for how to use L-GATr without thexformerspackage. - https://github.com/heidelberg-hepml/high-dim-unfolding: Generative jet substructure unfolding with L-GATr, uses the
ConditionalLGATr. (paper) - https://github.com/gregorkrz/jetclustering: IRC-safe jet clustering with L-GATr, starting from the https://github.com/heidelberg-hepml/lorentz-gatr repo. (paper)
- https://github.com/heidelberg-hepml/tagger-quantization: Quantized jet taggers, including float8+ternary weight implementations of L-GATr and L-GATr-slim. (paper)
- https://github.com/stanford-ai4physics/physics-priors: L-GATr/L-GATr-slim classifiers applied to tasks where high precision is required, and compared with the OmniLearn foundation model (paper)
Let us know if you use lgatr, so we can add your repo to the list!
Citation
If you find this code useful in your research, please cite our papers
@article{Brehmer:2024yqw,
author = "Brehmer, Johann and Bres{\'o}, V{\'\i}ctor and de Haan, Pim and Plehn, Tilman and Qu, Huilin and Spinner, Jonas and Thaler, Jesse",
title = "{A Lorentz-equivariant transformer for all of the LHC}",
eprint = "2411.00446",
archivePrefix = "arXiv",
primaryClass = "hep-ph",
reportNumber = "MIT-CTP/5802",
doi = "10.21468/SciPostPhys.19.4.108",
journal = "SciPost Phys.",
volume = "19",
number = "4",
pages = "108",
year = "2025"
}
@article{Petitjean:2025zjf,
author = {Petitjean, Antoine and Plehn, Tilman and Spinner, Jonas and K{\"o}the, Ullrich},
title = "{Economical Jet Taggers -- Equivariant, Slim, and Quantized}",
eprint = "2512.17011",
archivePrefix = "arXiv",
primaryClass = "hep-ph",
reportNumber = "IPPP/25/93",
month = "12",
year = "2025"
}
@inproceedings{spinner2025lorentz,
title={Lorentz-Equivariant Geometric Algebra Transformers for High-Energy Physics},
author={Spinner, Jonas and Bres{\'o}, Victor and De Haan, Pim and Plehn, Tilman and Thaler, Jesse and Brehmer, Johann},
booktitle={Advances in Neural Information Processing Systems},
year={2024},
volume={37},
eprint = {2405.14806},
url = {https://arxiv.org/abs/2405.14806}
}
@inproceedings{brehmer2023geometric,
title = {Geometric Algebra Transformer},
author = {Brehmer, Johann and de Haan, Pim and Behrends, S{\"o}nke and Cohen, Taco},
booktitle = {Advances in Neural Information Processing Systems},
year = {2023},
volume = {36},
eprint = {2305.18415},
url = {https://arxiv.org/abs/2305.18415},
}
Metadata
Release files for lgatr 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lgatr-2.0.0.tar.gz | 1.2 MB | With provenance | Details for lgatr-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lgatr-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for lgatr-2.0.0-py3-none-any.whl |
Total release size: 1.3 MB
Release files / lgatr-2.0.0.tar.gz
| Download URL | lgatr-2.0.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0d0ebc3b5f48606f7c022e85dbfc24173fd9201000693d070ec4bc3971e4904
|
|
BLAKE2b-256 checksum How to use checksums |
12b7f186476d8f956920e47521f6682ddc9f476f8e5ebf9fc0596c6f2373c2be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 29, 2026.
Transparency logRelease files / lgatr-2.0.0-py3-none-any.whl
| Download URL | lgatr-2.0.0-py3-none-any.whl |
|---|---|
| Size | 78.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94cb273942b69a72329a988eb504adb0d48d760ccf251c10e10dc2fd5d3338e4
|
|
BLAKE2b-256 checksum How to use checksums |
f45e758be7d894476fdd6616cc64bf9033144ac704e7b770c92e0e11a36c6324
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 29, 2026.
Transparency logSecurity for lgatr 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.
Attestation for lgatr-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 Jul 29, 2026.
Transparency logA 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.