Skip to main content

Lorentz-Equivariant Geometric Algebra Transformer

Tests codecov PyPI version Conda Version pytorch ruff

LGATr-CS LGATr-HEP LGATr-Slim

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:

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 LGATr and ConditionalLGATr
  • LGATrSlim and ConditionalLGATrSlim as efficient variants that use only scalar and vector representations
  • Set compile=True for typically 2x-3x speedup, and compile_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 run python -m pip install --upgrade pip setuptools wheel first, because these extra imports require modern versions of pip, setuptools and wheel.
  • 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 PrimitivesConfig objects

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

Examples

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)

Source distribution for lgatr 2.0.0
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)

Table of built distributions (wheels) for lgatr 2.0.0
File Interpreter ABI Platform Actions
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 log

Release 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 log

Security 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.

Select from 2 files

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