Abstract
In physics, Lagrangians provide a systematic way to describe laws governingphysical systems. In the context of particle physics, they encode theinteractions and behavior of the fundamental building blocks of our universe.By treating Lagrangians as complex, rule-based constructs similar to linguisticexpressions, we trained a transformer model -- proven to be effective innatural language tasks -- to predict the Lagrangian corresponding to a givenlist of particles. We report on the transformer's performance in constructingLagrangians respecting the Standard Model $\mathrm{SU}(3)\times\mathrm{SU}(2)\times \mathrm{U}(1)$ gauge symmetries. The resulting model isshown to achieve high accuracies (over 90\%) with Lagrangians up to six matterfields, with the capacity to generalize beyond the training distribution,albeit within architectural constraints. We show through an analysis of inputembeddings that the model has internalized concepts such as grouprepresentations and conjugation operations as it learned to generateLagrangians. We make the model and training datasets available to thecommunity. An interactive demonstration can be found at:\url{https://huggingface.co/spaces/JoseEliel/generate-lagrangians}.