LLM-based Automatic Heuristic Design (AHD) within Evolutionary Computation (EC) frameworks has shown promising results. However, its effectiveness is hindered by the use of static operators and the lack of knowledge accumulation mechanisms. We introduce HiFo-Prompt, a framework that guides LLMs with two synergistic prompting strategies: Foresight and Hindsight. Foresight-based prompts adaptively steer the search based on population dynamics, managing the exploration-exploitation trade-off. In addition, hindsight-based prompts mimic human expertise by distilling successful heuristics from past generations into fundamental, reusable design principles. This dual mechanism transforms transient discoveries into a persistent knowledge base, enabling the LLM to learn from its own experience. Empirical results demonstrate that HiFo-Prompt significantly outperforms state-of-the-art LLM-based AHD methods, generating higher-quality heuristics while achieving substantially faster convergence and superior query efficiency. Our code is available at https://github.com/Challenger-XJTU/HiFo-Prompt.
翻译:在进化计算框架内,基于大语言模型的自动启发式设计已展现出有前景的结果。然而,其有效性受到静态算子的使用和知识积累机制缺乏的阻碍。我们提出了HiFo-Prompt框架,该框架通过两种协同的提示策略——先见与后见——来引导大语言模型。基于先见的提示根据种群动态自适应地引导搜索,管理探索与利用的权衡。此外,基于后见的提示通过将历代成功的启发式方法提炼为基本、可复用的设计原则,从而模拟人类专业知识。这种双重机制将瞬时的发现转化为持久的知识库,使大语言模型能够从其自身经验中学习。实证结果表明,HiFo-Prompt显著优于当前最先进的基于大语言模型的自动启发式设计方法,在实现显著更快收敛速度和更优查询效率的同时,生成了更高质量的启发式方法。我们的代码可在 https://github.com/Challenger-XJTU/HiFo-Prompt 获取。