Skip to main content

Lorentz-Equivariant Geometric Algebra Transformer for High-Energy Physics

Project description

Lorentz-Equivariant Geometric Algebra Transformer

Tests codecov PyPI version Conda Version pytorch

LGATr-CS LGATr-HEP LGATr-Slim

This repository contains a standalone implementation of the Lorentz-Equivariant Geometric Algebra Transformer (L-GATr) by Jonas Spinner, Víctor Bresó, Pim de Haan, Tilman Plehn, Huilin Qu, Jesse Thaler, and Johann Brehmer. L-GATr uses spacetime geometric algebra representations to construct Lorentz-equivariant layers and combines them into a transformer architecture. You can read more about L-GATr as well as the more efficient L-GATr-slim in the following three papers and in the L-GATr documentation:

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

Please have a look at the L-GATr documentation and our example notebooks for LGATr and ConditionalLGATr.

Overview of features in L-GATr:

  • L-GATr encoder and decoder as LGATr and ConditionalLGATr
  • Additional attention backends, installation via pip install lgatr[xformers-attention], pip install lgatr[flex-attention], pip install lgatr[flash-attention] or any combination. You might have to run python -m pip install --upgrade pip setuptools wheel because extra imports require modern versions of pip, setuptools, wheel.
  • Support for torch's automatic mixed precision; critical operations are performed in float32
  • 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, MLPConfig and LGATRConfig objects
  • LGATrSlim and ConditionalLGATrSlim as more efficient variants that use only scalar and vector representations

Examples

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

Contributing

Contributions are welcome! To get started:

  1. Fork this repository and create a new branch for your feature or fix.
  2. Make your changes, following the existing code style (and using pre-commit).
  3. Add or update tests where appropriate.
  4. Open a pull request with a clear description of your changes.

If you’re not sure where to begin, feel free to open an issue to discuss your idea first.

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},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lgatr-1.4.2.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lgatr-1.4.2-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

Details for the file lgatr-1.4.2.tar.gz.

File metadata

  • Download URL: lgatr-1.4.2.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lgatr-1.4.2.tar.gz
Algorithm Hash digest
SHA256 518e82c477ab3f03be2549281b9922c25e21dedc553a063edd3acf70a0c438c2
MD5 33c1bd3f6c404869523d9f40d2777942
BLAKE2b-256 ec04c8cb07d1fe07f7ebb239ff3dd42d6ee9114a0b35fa2de4866d434d3aead4

See more details on using hashes here.

Provenance

The following attestation bundles were made for lgatr-1.4.2.tar.gz:

Publisher: release.yaml on heidelberg-hepml/lgatr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lgatr-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: lgatr-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 59.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lgatr-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c858dc086621c5f0d32d9fbf28e9d78b376155f1a07fb20da57abcc05fe18d9b
MD5 c470074d7668e11f313a36895787d623
BLAKE2b-256 08928ee8b41de055edbbce91bd6d5db25c2f31f504545b76d0bc055a0961e32c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lgatr-1.4.2-py3-none-any.whl:

Publisher: release.yaml on heidelberg-hepml/lgatr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page