Papers
Topics
Authors
Recent
Search
2000 character limit reached

HiFo-Prompt: LLM Heuristic Design

Updated 8 July 2026
  • HiFo-Prompt is a framework that uses LLMs to automatically generate and evolve heuristic algorithms for combinatorial optimization tasks.
  • The framework employs a dual prompting architecture—Foresight for directing search and Hindsight for consolidating successful design principles.
  • Empirical evaluations across TSP, bin packing, and scheduling demonstrate faster convergence and improved query efficiency over previous methods.

Searching arXiv for the primary paper and closely related prompt-optimization work to ground the article in current literature. HiFo-Prompt is a framework for LLM-based automatic heuristic design within evolutionary computation, built around two complementary prompting mechanisms: Foresight and Hindsight. Rather than optimizing a natural-language prompt for a downstream language task, it uses prompts to steer an LLM that generates executable heuristics—typically Python code plus a brief natural-language “thought”—inside an evolutionary search loop. Foresight adaptively regulates exploration and exploitation from population dynamics, while Hindsight distills successful heuristics from earlier generations into reusable design principles stored in a persistent knowledge base. Across traveling salesman, online bin packing, flow shop scheduling, and cost-aware Bayesian optimization, the method is reported to produce stronger heuristics, faster convergence, and better query efficiency than prior LLM-based automatic heuristic design pipelines (Chen et al., 18 Aug 2025).

1. Scope and disambiguation

HiFo-Prompt refers specifically to "HiFo-Prompt: Prompting with Hindsight and Foresight for LLM-based Automatic Heuristic Design" (Chen et al., 18 Aug 2025). Its domain is not general-purpose prompt engineering for text classification, reasoning, or instruction following, but the generation and evolution of problem-specific heuristic programs inside an EC workflow. The prompt is therefore an internal control signal for heuristic synthesis, rather than the final artifact evaluated on a conventional NLP benchmark.

This distinguishes HiFo-Prompt from several nearby but different research lines. It is not HiPrompt, the higher-resolution image generation method based on hierarchical MLLM prompts and frequency-aware denoising (Liu et al., 2024). It is also distinct from prompt optimizers that search over discrete natural-language prompts for black-box or in-box LLM tasks, such as APOHF (Lin et al., 2024), HbBoPs (Schneider et al., 2024), FIPO (Lu et al., 2024), GFlowPO (Cho et al., 3 Feb 2026), OPTS (Ashizawa et al., 3 Mar 2025), HAPO (Chen et al., 6 Jan 2026), and DelvePO (Tao et al., 21 Oct 2025). Nor is it an instruction-alignment framework like HIPO, which formalizes system–user priority as constrained policy optimization (Chen et al., 17 Mar 2026). HiFo-Prompt belongs instead to the literature on automatic heuristic design, where LLMs are used as semantic generators of algorithmic operators and search policies (Chen et al., 18 Aug 2025).

2. Formal problem setting

The paper formulates automatic heuristic design as search over a heuristic space H\mathcal{H}, with the optimal heuristic defined as

h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),

where

g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].

Here ff is the underlying task objective to minimize, so maximizing g(h)g(h) amounts to finding heuristics with lower expected objective value on an instance distribution DD (Chen et al., 18 Aug 2025).

The evolutionary abstraction used in the paper writes population dynamics as

P(t+1)∼F(P(t)∣θ(t)),P^{(t+1)} \sim \mathcal{F}(P^{(t)} \mid \theta^{(t)}),

with population P(t)={h1(t),…,hM(t)}P^{(t)}=\{h_1^{(t)},\dots,h_M^{(t)}\} and control vector θ(t)\theta^{(t)}. Offspring generation is modeled by

hc=L(Π(ρ(hp),θ(t))),O(t)={hc,1,…,hc,N},h_c = \mathcal{L}(\Pi(\rho(h_p), \theta^{(t)})), \qquad O^{(t)}=\{h_{c,1},\dots,h_{c,N}\},

where h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),0 is the LLM, h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),1 is prompt construction, and h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),2 is the symbolic representation of parent heuristics. Selection then produces the next population through

h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),3

with h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),4 (Chen et al., 18 Aug 2025).

Within this formulation, the search objects are concrete heuristic components. In the reported tasks, these include a next-city decision rule for step-by-step TSP construction, a penalty-update heuristic for TSP with guided local search, a bin-assignment scoring function for online bin packing, a perturbation/guidance function for flow shop scheduling after local optima, and a cost-aware acquisition or utility function for Bayesian optimization (Chen et al., 18 Aug 2025). The method therefore searches over algorithmic code and strategy, not over fixed parameter vectors alone.

3. Dual prompting architecture

HiFo-Prompt’s defining contribution is the coupling of a Foresight module with a Hindsight module. The first controls what the search should emphasize next; the second preserves what the search has already learned.

The Foresight module is implemented as the Evolutionary Navigator. It monitors three population-level signals: consecutive stagnation count h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),5, consecutive progress count h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),6, and population diversity h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),7, defined as the standard deviation of fitness values. The state-dependent strategy is

h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),8

In the reported experiments, h∗=arg⁡max⁡h∈Hg(h),h^* = \mathop{\arg\max}_{h \in \mathcal{H}} g(h),9, g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].0, and g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].1 (Chen et al., 18 Aug 2025). The resulting regime is translated into a Design Directive inserted into the next-generation prompt. Explore directives emphasize novelty and alternative methodologies; exploit directives emphasize refinement of existing high-performing heuristics; balance directives combine both tendencies.

The Hindsight module is the Insight Pool, a bounded memory of distilled design principles extracted from elite heuristics. At the end of a generation, the system prompts an LLM to summarize the top 30% of the population into 1–2 concise, generic, performance-positive design principles. These are admitted only if their Jaccard similarity to existing pool entries is below a novelty threshold of g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].2. Each stored insight carries an effectiveness score, usage statistics, and recency information. Retrieval uses an adaptive utility that combines effectiveness, a usage penalty, and a recency bonus; in experiments, the pool capacity is g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].3, retrieval count is g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].4, usage-penalty weight is g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].5, and recency-bonus parameter is g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].6 (Chen et al., 18 Aug 2025).

The Hindsight module is not merely archival. When an offspring was generated using retrieved insights, those insights receive credit based on the offspring’s population-relative performance, and their effectiveness is updated by exponential moving average with g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].7. Eviction applies a decay term with g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].8, while newly added insights are protected for a grace period of g(h)=Eins∈D[−f(h(ins))].g(h) = \mathbb{E}_{\mathrm{ins} \in D} \left[ -f(h(\mathrm{ins})) \right].9 generations (Chen et al., 18 Aug 2025). This turns transient discoveries into a persistent, scored, reusable knowledge base.

4. Evolutionary workflow and guided prompt synthesis

The operational pipeline begins with either seed heuristics or LLM-generated initial heuristics. The system then initializes the Insight Pool and the Evolutionary Navigator, and runs an evolutionary loop over a small population of size ff0 (Chen et al., 18 Aug 2025). The foundational operator prompts are fixed and correspond to six heuristic-generation modes:

  • I1: initialize from scratch
  • E1: recombination into a structurally novel algorithm
  • E2: recombination via a shared backbone
  • M1: structural mutation
  • M2: parameter mutation
  • M3: simplification mutation

For each active operator, the system performs what the paper calls Guided Prompt Synthesis. The final generation prompt is a composite of four elements: the foundational operator prompt, parent heuristic representations, retrieved hindsight insights, and the current foresight design directive (Chen et al., 18 Aug 2025). In effect, the LLM is asked not only to modify or combine heuristics, but to do so under explicit strategic regulation and with access to distilled historical knowledge.

Parent selection is rank-based, with probabilities proportional to ff1 after sorting the population by fitness. The generated offspring are evaluated, invalid or duplicate individuals are filtered, and survival selection retains the top ff2 heuristics (Chen et al., 18 Aug 2025). The reported implementation uses qwen2.5-max through DashScope, with temperature ff3, and runs for 8 generations on the combinatorial optimization tasks and 4 generations on Bayesian optimization (Chen et al., 18 Aug 2025).

A notable design choice is the decoupling of thought from code. The framework extracts and stores high-level design principles independently of the exact implementation that first expressed them. This suggests a move away from memoryless prompt-and-select loops toward a genuinely experience-accumulating search process (Chen et al., 18 Aug 2025).

5. Empirical performance and ablation evidence

The evaluation covers TSP, online bin packing, flow shop scheduling, and Bayesian optimization, with comparisons against handcrafted heuristics, neural combinatorial optimization baselines, and prior LLM-based automatic heuristic design systems (Chen et al., 18 Aug 2025). The reported pattern is consistent: HiFo-Prompt outperforms prior LLM-based AHD baselines across the main settings, and often by large margins.

Representative results illustrate the scale of the gains:

Setting Strong prior result HiFo-Prompt
TSP20 step-by-step ReEvo 6.156% 2.790%
TSP100 GLS EoH 0.026% 0.014%
Online BPP, capacity 300, 5k MCTS-AHD 0.95% 0.63%
FSSP, ff4 EOH 0.927% 0.472%
TSPLib OOD mean gap ReEvo 17.401% 12.843%

In step-by-step TSP construction, the gap at TSP20 falls from ff5 for EoH and ff6 for ReEvo to $2.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to HiFo-Prompt.