LLMize: A Framework for Large Language Model-Based Numerical Optimization
M. Rizki Oktavian
TL;DR
This work introduces LLMize, an open-source framework that treats numerical optimization as an in-context learning problem where a fixed large language model proposes candidates conditioned on a history of evaluations. It extends the Optimization by PROmpting (OPRO) paradigm with two hybrids, HLMEA and HLMSA, enabling population-based and simulated-annealing-like search guided entirely by natural-language prompts and external evaluators. The approach supports flexible constraint injection, domain knowledge, and adaptive control within a unified interface, demonstrated across convex and combinatorial tasks as well as engineering designs such as nuclear fuel lattices. While not competitive with classical solvers on simple problems due to inference overhead, LLMize offers a practical and accessible pathway for complex, domain-specific optimization where formalizing objectives and heuristics is difficult.
Abstract
Large language models (LLMs) have recently shown strong reasoning capabilities beyond traditional language tasks, motivating their use for numerical optimization. This paper presents LLMize, an open-source Python framework that enables LLM-driven optimization through iterative prompting and in-context learning. LLMize formulates optimization as a black-box process in which candidate solutions are generated in natural language, evaluated by an external objective function, and refined over successive iterations using solution-score feedback. The framework supports multiple optimization strategies, including Optimization by Prompting (OPRO) and hybrid LLM-based methods inspired by evolutionary algorithms and simulated annealing. A key advantage of LLMize is the ability to inject constraints, rules, and domain knowledge directly through natural language descriptions, allowing practitioners to define complex optimization problems without requiring expertise in mathematical programming or metaheuristic design. LLMize is evaluated on convex optimization, linear programming, the Traveling Salesman Problem, neural network hyperparameter tuning, and nuclear fuel lattice optimization. Results show that while LLM-based optimization is not competitive with classical solvers for simple problems, it provides a practical and accessible approach for complex, domain-specific tasks where constraints and heuristics are difficult to formalize.
