ICLR2026

HiFo-Prompt: Prompting with Hindsight and Foresight for LLM-based Automatic Heuristic Design

ChentongChen, Mengyuan Zhong, Jialong Shi, Jianyong Sun, Ye Fan

被引用 7 次

摘要

This paper investigates the application of Large Language Models (LLMs) in Automated Heuristic Design (AHD), where their integration into evolutionary frameworks reveals a significant gap in global control and long-term learning. We propose the Hindsight-Foresight Prompt (HiFo-Prompt), a novel framework for LLM-based AHD designed to overcome these limitations. This is achieved through two synergistic strategies: Foresight and Hindsight. Foresight acts as a high-level meta-controller, monitoring population dynamics(e.g., stagnation and diversity collapse) to switch the global search strategy between exploration and exploitation explicitly. Hindsight builds a persistent knowledge base by distilling successful design principles from past generations, making this knowledge reusable. This dual mechanism ensures that the LLM is not just a passive operator but an active reasoner, guided by a global plan (Foresight) while continuously improving from its cumulative experience (Hindsight). Empirical results demonstrate that HiFo-Prompt significantly outperforms a comprehensive suite of state-of-the-art AHD methods, discovering higher-quality heuristics with substantially improved convergence speed and query efficiency. Our code is available at https://github.com/Challenger- XJTU/HiFo-Prompt. Introduction Combinatorial Optimization (CO) problems, which involve finding an optimal solution from a discrete set of possibilities, are ubiquitous in science and engineering. Because of their NP-hardness, designing effective heuristics for these problems is a complex task, traditionally based on extensive human experience and intuition [1] . The advent of Large Language Models (LLMs) has catalyzed a paradigm shift toward Automated Heuristic Design (AHD) [2, 3] . A particularly potent approach marries LLMs with Evolutionary Computation (EC), casting the LLM as a high-level semantic mutation operator. Foundational works such as FunSearch [4] and EoH [5] established the viability of this LLM+EC paradigm, demonstrating its capacity to discover novel and effective heuristics. However, as the field progresses, two fundamental challenges have emerged in AHD: the inability to steer the heuristic generation process based on population dynamics and the failure to distill and manage the core design principles of high-performance heuristics to guide the subsequent heuristic generation process. First, many approaches lack a mechanism for global adaptive guidance. They often rely on local or reactive signals; for instance, ReEvo [6] performs reflection on a single candidate, while methods such as MCTS-AHD [7] passively embed the exploration-exploitation trade-off within their search structure. This localized control does not respond to the macroscopical dynamics of the population and cannot proactively intervene when the search encounters systemic issues such as premature convergence or a decline in diversity. A more aggressive strategy involves in-weight adaptation (e.g., EvoTune [8], CALM [9]), which uses numerical gradients to fine-tune the LLM. Although powerful, this approach incurs * Equal contribution. † Corresponding author.