FOMTools: Development and AI-Assisted Code Generation for First-Order Methods
Vinit Ranjan, Daniel Deza, Anushka Acharya, Jisun Park, Bartolomeo Stellato
Key points
From the paper's conclusion- We demonstrate FOMTools on sparse coding, network optimization, optimal control, and portfolio rebalancing.
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.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Scaly: an Optimizing Compiler for Optimal ControlarXiv · 2026
- CloakFEM: Agentic FEM Code Generation for Red-Teaming Computational Resource ExhaustionarXiv · 2026
- KernelMosaic: An Open Dataset and Agentic Framework for CUDA Kernel GenerationarXiv · 2026
- Ask, Don't Equip: Question-Driven Coding Agents for Deep Kernel OptimizationarXiv · 2026
- Autonomous Optimization of Numerical Algorithms by an AI Agent: Application to Atomistic SimulationarXiv · 2026
- Formally Verified Semidefinite ProgrammingarXiv · 2026