Searcharxiv⌕ Search

arXiv · 2609.23367

LLM-Based FORM Code Generation with Verification-Driven Fine-Tuning

Abstract

FORM is a domain-specific symbolic manipulation language widely used in particle physics for processing the very large algebraic expressions arising from multi-loop Feynman diagram calculations. Despite its central role in precision theoretical physics, no artificial-intelligence tooling exists, to our knowledge, for assisting physicists in writing FORM code. We show that contemporary large language models (LLMs), including frontier models with hundreds of billions of parameters, achieve a zero-percent execution pass rate on our instruction-following and tutorial-style FORM tasks without documentation in a single attempt, establishing FORM as a genuine zero-shot language for LLMs at the time of writing. We then present a verification-driven data generation pipeline that uses the FORM binary itself as an execution oracle to produce and validate a corpus of 4,633 training examples spanning deterministic computations, open-ended programs, tutorial code, and knowledge question-answer pairs. Fine-tuning a compact open-weights model (Qwen3-8B) with quantized low-rank adaptation (QLoRA) yields a specialist that, evaluated on four complementary benchmarks (840 tasks, single attempt each), decisively outperforms frontier models with up to 756B parameters in execution rate and in strict, FORM-verified output matching on the larger benchmarks, and remains statistically indistinguishable from them on the smaller, harder ones. General reasoning and coding capabilities are preserved within 2.6 percentage points.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Bakar Chargeishvili. 2026-09-20. LLM-Based FORM Code Generation with Verification-Driven Fine-Tuning. https://searcharxiv.com/abs/2609.23367

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite Searcharxiv by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

0.5 eV QCD Axion Cosmology

The best available determination of the present expansion rate of the universe using late-universe observations, by the SH0ES collaboration in 2025, differs by more than seven standard deviations from the value of the Hubble constant determined by the Planck collaboration in 2018 using early-universe observations and the standard cold dark matter cosmology with cosmological constant, a discrepancy known as the Hubble tension. Within a spatially flat, isotropic, and homogeneous expanding-universe solution of the field equations of general relativity with cosmological constant, the SH0ES value for the Hubble constant implies roughly twice as many baryons as the standard cosmology, provided that one retains the Planck values for the energy density of cold dark matter in the present universe and for the cosmological constant. A novel cosmology is proposed --- in terms of cooling dark matter made of quantum chromodynamic (QCD) axions with present number density six times that of the photons in the cosmic microwave background --- which realizes this straightforward, doubled-baryons scenario for resolving the Hubble tension.

hep-ph↗

Transverse Energy--Energy Correlators at Small $x$ for Photon--Hadron Production

We study the transverse energy--energy correlator (TEEC) observable in photon--hadron and photon--jet production in p+p and p+A collisions at small $x$. We derive the relevant expressions in the high-energy limit of the scattering where the dipole picture is applicable and show how the dependence on the fragmentation function of the hadron cancels due to the momentum-sum rule. The nonperturbative scattering with the target nucleus is expressed in terms of the dipole amplitude, which also describes nonlinear gluon saturation effects. The TEEC observable is computed in the RHIC and LHC kinematics, and we show that it can be sensitive to the dipole amplitude, making it a potentially good observable for studying saturation effects.

hep-ph↗

Machine Learning in the Hunt for Charged Higgs Bosons at Gamma-Gamma Colliders in the Type III Two Higgs Doublet Model

We study charged Higgs boson pair production, $γγ\to H^{+}H^{-}$, in the Type-III Two-Higgs-Doublet Model (2HDM-III) for $100\leq M_{H^{\pm}}\leq190~\text{GeV}$ at a $γγ$ collider with $\sqrt{s}=3~\text{TeV}$ and $\mathcal{L}_{int}=3000~\text{fb}^{-1}$. Two benchmark points, BP1 ($\tanβ=10$, $\cos(β-α)=-0.2$) and BP2 ($\tanβ=20$, $\cos(β-α)=-0.1$), are chosen in agreement with theoretical constraints, flavor-physics data and the signal strengths of the $125~\text{GeV}$ Higgs boson. The total width of $H^{\pm}$ is $10^{-4}$--$10^{-1}~\text{GeV}$, i.e. a narrow resonance, and $\mathrm{BR}(H^{+}\toτν_τ)$ falls from $4.6\times10^{-3}$ (BP1) and $2.9\times10^{-4}$ (BP2) at $100~\text{GeV}$ to $1.8\times10^{-4}$ and $1.2\times10^{-5}$ at $190~\text{GeV}$. The $τν_τ$ and $tb$ final states are analyzed with four TMVA classifiers (BDT, MLP, Likelihood and LikelihoodD) using $1.0\times10^{5}$ generated events per process. For $171$ signal and $604$ background events, the MLP and BDT reach AUC values of $0.934$ and $0.933$ and maximum significances $S/\sqrt{S+B}$ of $9.86$ and $9.82$, compared with $0.870$ and $8.54$ for LikelihoodD and $0.815$ and $7.55$ for Likelihood. The preselection cuts raise the significance by only $0.09$--$0.91\%$, depending on the classifier. The quoted significances are statistical; systematic uncertainties are not included.

hep-ph↗