Papers › Large Language Models as Optimizers

Large Language Models as Optimizers

7 Sep 2023arXiv:2309.03409archive 2025-07-28

Chengrun Yang, Xuezhi Wang, Yifeng Lu, Hanxiao Liu, Quoc V. Le, Denny Zhou, Xinyun Chen

Optimization is ubiquitous. While derivative-based algorithms have been powerful tools for various problems, the absence of gradient imposes challenges on many real-world applications. In this work, we propose Optimization by PROmpting (OPRO), a simple and effective approach to leverage large language models (LLMs) as optimizers, where the optimization task is described in natural language. In each optimization step, the LLM generates new solutions from the prompt that contains previously generated solutions with their values, then the new solutions are evaluated and added to the prompt for the next optimization step. We first showcase OPRO on linear regression and traveling salesman problems, then move on to our main application in prompt optimization, where the goal is to find instructions that maximize the task accuracy. With a variety of LLMs, we demonstrate that the best prompts optimized by OPRO outperform human-designed prompts by up to 8% on GSM8K, and by up to 50% on Big-Bench Hard tasks. Code at https://github.com/google-deepmind/opro.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2309.03409")

Code

Syntology Ran 12 of 14 code samples harvested from 3 repositories linked to this paper; 2 have no recorded run. Of those that ran: 3 ran · our draft was wrong; 1 ran · fixture could not drive it; 8 ran with no contract checked.

By repository: official repository: 9 samples from 1 repository, 7 ran; community (archive-listed): 5 samples from 2 repositories, 5 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

google-deepmind/opro officialmentioned in papermentioned on GitHubApache-2.0 report
finitearth/promptolution mentioned on GitHubApache-2.0 report
thunderous77/glape mentioned on GitHubpytorch report
yaolu/random-prompt mentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

14 samples harvested; 12 ran; 0 honoured the contract we drafted; 2 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

3ran · our draft was wrong
1ran · fixture could not drive it
8ran
2unverified

Licence: 2 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

read_jsonl google-deepmind/opro/opro/evaluation/eval_utils.py official repository ran · our draft was wrong Apache-2.0 (permissive) · a4cf9d0d1ece601e · report
extract_string_in_square_brackets google-deepmind/opro/opro/optimization/opt_utils.py official repository ran fingerprinted Apache-2.0 (permissive) · 9e6b4f1e39187226 · report
gen_ins_and_score_pairs_substr google-deepmind/opro/opro/optimization/opt_utils.py official repository ran Apache-2.0 (permissive) · d3c113af9902217e · report
instruction_to_filename google-deepmind/opro/opro/evaluation/eval_utils.py official repository ran fingerprinted Apache-2.0 (permissive) · 22e0818b777cfffa · report
parse_tag_content google-deepmind/opro/opro/optimization/opt_utils.py official repository ran Apache-2.0 (permissive) · 2bd751a94e813601 · report
remove_punctuation_from_string google-deepmind/opro/opro/evaluation/eval_utils.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · dc0fb1ce4824c2c3 · report
remove_punctuation_from_string google-deepmind/opro/opro/evaluation/metrics.py official repository ran fingerprinted Apache-2.0 (permissive) · f980d622248dbd94 · report
call_openai_server_func google-deepmind/opro/opro/prompt_utils.py official repository unverified Apache-2.0 (permissive) · 310edb478a4009a1 · report
call_openai_server_single_prompt google-deepmind/opro/opro/prompt_utils.py official repository unverified Apache-2.0 (permissive) · daa969a73f4f1e26 · report
balanced_sample yaolu/random-prompt/utils.py community (archive-listed) ran MIT (permissive) · 19d3b6894577dc43 · report
compute_loss thunderous77/glape/utils.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · ab2577b54a5de0f2 · report
get_context_limit yaolu/random-prompt/utils.py community (archive-listed) ran MIT (permissive) · 355c3b041e1b77a5 · report
optimize thunderous77/glape/utils.py community (archive-listed) ran · fixture could not drive it no licence file found · pointer only · a3f7ac8674bc5e72 · report
profile_time yaolu/random-prompt/utils.py community (archive-listed) ran MIT (permissive) · 77a2c584ec1b5055 · report

Tasks

GSM8K

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Linear Regression

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections