FOMTools: Development and AI-Assisted Code Generation for First-Order Methods
Abstract
We present FOMTools, an open-source Python package for developing, analyzing, and deploying first-order algorithms for parametric linear and convex quadratic optimization. The user specifies an iteration in Python, with syntax close to its mathematical description. The package represents the iteration as a computation graph of affine and piecewise affine operations. To analyze worst-case performance, FOMTools formulates a mixed-integer verification problem that maximizes a convergence residual over a specified set of problem instances and initial iterates. For probabilistic performance analysis, a batched GPU simulator collects algorithm trajectories and computes statistical bounds on the probability of exceeding a specified convergence tolerance. From the same algorithm description, FOMTools generates specialized solver code for embedded hardware, multicore CPUs, and GPUs. The package first generates the numerical data, factorizations, and matrix-vector routines without any agent. A coding agent then translates the iteration into C or CUDA code and iteratively optimizes the implementation. After each phase, the package runs the generated code on sampled inputs and compares it with a reference execution. FOMTools also serves as a CVXPYgen backend, generating and optimizing solvers for parametric CVXPY problems. We demonstrate FOMTools on sparse coding, network optimization, optimal control, and portfolio rebalancing. The verification bounds reveal worst-case behavior that sampling misses. The generated solvers run up to two orders of magnitude faster than NumPy implementations, and they outperform hand-written GPU code and the OSQP solvers generated by CVXPYgen.
Related
- Enabling risk and reliability analysis in next-generation computational tools via multifidelity methods
- On the potential lack of response in a model of second-harmonic generation. A computer-assisted proof
- Movable Antenna-Assisted Secret Key Generation over Temporally Correlated Channels
- Mixed finite element methods for a heat-assisted model of sedimentation
- Classical methods for modern applications: synthetic tabular data generation using lightweight discrete response continuous latent variable model
BibTeX
@misc{ranjan2026fomtools,
title = {{FOMTools: Development and AI-Assisted Code Generation for First-Order Methods}},
author = {Vinit Ranjan and Daniel Deza and Anushka Acharya and Jisun Park and Bartolomeo Stellato},
howpublished = {arXiv},
year = {2026},
month = oct,
doi = {10.48550/arxiv.2610.26743},
eprint = {2610.26743},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2610.26743},
note = {CC BY 4.0},
}
RIS
TY - UNPB
TI - FOMTools: Development and AI-Assisted Code Generation for First-Order Methods
AU - Vinit Ranjan
AU - Daniel Deza
AU - Anushka Acharya
AU - Jisun Park
AU - Bartolomeo Stellato
PY - 2026
DA - 2026/10/19
PB - arXiv
DO - 10.48550/arxiv.2610.26743
UR - https://arxiv.org/abs/2610.26743
AB - We present FOMTools, an open-source Python package for developing, analyzing, and deploying first-order algorithms for parametric linear and convex quadratic optimization. The user specifies an iteration in Python, with syntax close to its mathematical description. The package represents the iteration as a computation graph of affine and piecewise affine operations. To analyze worst-case performance, FOMTools formulates a mixed-integer verification problem that maximizes a convergence residual over a specified set of problem instances and initial iterates. For probabilistic performance analysis, a batched GPU simulator collects algorithm trajectories and computes statistical bounds on the probability of exceeding a specified convergence tolerance. From the same algorithm description, FOMTools generates specialized solver code for embedded hardware, multicore CPUs, and GPUs. The package first generates the numerical data, factorizations, and matrix-vector routines without any agent. A coding agent then translates the iteration into C or CUDA code and iteratively optimizes the implementation. After each phase, the package runs the generated code on sampled inputs and compares it with a reference execution. FOMTools also serves as a CVXPYgen backend, generating and optimizing solvers for parametric CVXPY problems. We demonstrate FOMTools on sparse coding, network optimization, optimal control, and portfolio rebalancing. The verification bounds reveal worst-case behavior that sampling misses. The generated solvers run up to two orders of magnitude faster than NumPy implementations, and they outperform hand-written GPU code and the OSQP solvers generated by CVXPYgen.
ER -