Generating particle physics Lagrangians with transformers

In physics, Lagrangians provide a systematic way to describe laws governing physical systems. In the context of particle physics, they encode the interactions and behavior of the fundamental building blocks of our universe. By treating Lagrangians as complex, rule-based constructs similar to linguistic expressions, we trained a transformer model — proven to be effective in natural language tasks — to predict the Lagrangian corresponding to a given list of particles. We report on the transformer’s performance in constructing Lagrangians respecting the Standard Model \mathrm{SU}(3)× \mathrm{SU}(2)× \mathrm{U}(1) <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="normal">S</mml:mi> <mml:mi mathvariant="normal">U</mml:mi> </mml:mrow> <mml:mo stretchy="false" form="prefix">(</mml:mo> <mml:mn>3</mml:mn> <mml:mo stretchy="false" form="postfix">)</mml:mo> <mml:mo>×</mml:mo> <mml:mrow> <mml:mi mathvariant="normal">S</mml:mi> <mml:mi mathvariant="normal">U</mml:mi> </mml:mrow> <mml:mo stretchy="false" form="prefix">(</mml:mo> <mml:mn>2</mml:mn> <mml:mo stretchy="false" form="postfix">)</mml:mo> <mml:mo>×</mml:mo> <mml:mi mathvariant="normal">U</mml:mi> <mml:mo stretchy="false" form="prefix">(</mml:mo> <mml:mn>1</mml:mn> <mml:mo stretchy="false" form="postfix">)</mml:mo> </mml:mrow> </mml:math> gauge symmetries. The resulting model is shown to achieve high accuracies (over 90%) with Lagrangians up to six matter fields, with the capacity to generalize beyond the training distribution, albeit within architectural constraints. We show through an analysis of input embeddings that the model has internalized concepts such as group representations and conjugation operations as it learned to generate Lagrangians. We make the model and training datasets available to the community. An interactive demonstration can be found at: https://huggingface.co/spaces/JoseEliel/generate-lagrangians.

Authors

Institutions

Publication Details

Journal
SciPost Physics
Published
2026-07-28
DOI
https://doi.org/10.21468/scipostphys.21.1.024
Primary Topic
Computational Physics and Python Applications
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Generating particle physics Lagrangians with transformers

Stefano Moretti, Rikard Enberg, Yong Sheng Koay, Eliel Camargo-Molina
SciPost Physics
Computational Physics and Python Applications
article

Generating particle physics Lagrangians with transformers

Stefano Moretti, Rikard Enberg, Yong Sheng Koay, Eliel Camargo-Molina
article en

Abstract

In physics, Lagrangians provide a systematic way to describe laws governing physical systems. In the context of particle physics, they encode the interactions and behavior of the fundamental building blocks of our universe. By treating Lagrangians as complex, rule-based constructs similar to linguistic expressions, we trained a transformer model — proven to be effective in natural language tasks — to predict the Lagrangian corresponding to a given list of particles. We report on the transformer’s performance in constructing Lagrangians respecting the Standard Model \mathrm{SU}(3)× \mathrm{SU}(2)× \mathrm{U}(1) <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="normal">S</mml:mi> <mml:mi mathvariant="normal">U</mml:mi> </mml:mrow> <mml:mo stretchy="false" form="prefix">(</mml:mo> <mml:mn>3</mml:mn> <mml:mo stretchy="false" form="postfix">)</mml:mo> <mml:mo>×</mml:mo> <mml:mrow> <mml:mi mathvariant="normal">S</mml:mi> <mml:mi mathvariant="normal">U</mml:mi> </mml:mrow> <mml:mo stretchy="false" form="prefix">(</mml:mo> <mml:mn>2</mml:mn> <mml:mo stretchy="false" form="postfix">)</mml:mo> <mml:mo>×</mml:mo> <mml:mi mathvariant="normal">U</mml:mi> <mml:mo stretchy="false" form="prefix">(</mml:mo> <mml:mn>1</mml:mn> <mml:mo stretchy="false" form="postfix">)</mml:mo> </mml:mrow> </mml:math> gauge symmetries. The resulting model is shown to achieve high accuracies (over 90%) with Lagrangians up to six matter fields, with the capacity to generalize beyond the training distribution, albeit within architectural constraints. We show through an analysis of input embeddings that the model has internalized concepts such as group representations and conjugation operations as it learned to generate Lagrangians. We make the model and training datasets available to the community. An interactive demonstration can be found at: https://huggingface.co/spaces/JoseEliel/generate-lagrangians.

SciPost PhysicsVol. 21(1)
Uppsala University (SE), University of Southampton (GB)
Kungliga Tekniska Högskolan, Vetenskapsrådet, Science and Technology Facilities Council
Openalex Percentile: Top 99%
Computational Physics and Python Applications
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.