arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.10084cs.CL
收藏

为什么提示词设计有效且至关重要:LLMs中提示词搜索空间的复杂性分析

Why Prompt Design Matters and Works: A Complexity Analysis of Prompt Search Space in LLMs

University of British Columbia(不列颠哥伦比亚大学);Stony Brook University(石溪大学);Zhejiang University(浙江大学)

Xiang Zhang, Juntai Cao, Jiaqi Wei, Chenyu You, Dujian Ding

AI总结:

本文针对LLMs中缺乏理论基础的提示词工程问题,提出理论框架证明提示词作为选择器在CoT推理中提取任务相关信息,并揭示朴素自我引导提示词会阻碍性能,实验表明最优提示词搜索可带来超50%的性能提升。

摘要:

尽管大型语言模型(LLMs)取得了显著成功,但其底层的Transformer架构在处理复杂推理任务时存在固有局限性。思维链(CoT)提示作为一种实用的解决方案应运而生,但大多数基于CoT的方法依赖于单一的通用提示词,如“think step by step”,缺乏针对特定任务的适应。这些方法期望模型自行发现有效的推理路径,迫使其在庞大的提示词空间中进行搜索。相比之下,近期的研究探索了针对特定任务的提示词设计以提升性能。然而,这些设计通常通过试错法开发,缺乏理论基础。因此,提示词工程在很大程度上仍是临时且无指导的。本文提供了一个理论框架,解释了为何某些提示词成功而其他失败。我们证明了提示词充当选择器,在CoT推理过程中从模型的完整隐藏状态中提取与任务相关的信息。每个提示词在答案空间中定义了一条独特的轨迹,而轨迹的选择对于任务性能和在该空间内的未来导航至关重要。我们分析了寻找最优提示词的复杂性,并刻画了给定任务的提示词空间大小。我们的理论揭示了有效提示词设计背后的原则,并表明使用如“think step by step”这类自我引导提示词的朴素CoT可能会严重阻碍性能。通过实验,我们展示了最优提示词搜索可以在推理任务上带来超过50%的性能提升,为提示词工程提供了理论基础。

英文摘要:

Despite the remarkable successes of large language models (LLMs), the underlying Transformer architecture has inherent limitations in handling complex reasoning tasks. Chain-of-thought (CoT) prompting has emerged as a practical workaround, but most CoT-based methods rely on a single, generic prompt such as "think step by step", with no task-specific adaptation. These approaches expect the model to discover an effective reasoning path on its own, forcing it to search through a vast prompt space. In contrast, several studies have explored task-specific prompt designs to boost performance. However, these designs are typically developed through trial and error, lacking theoretical grounding. As a result, prompt engineering remains largely ad hoc and unguided. In this paper, we provide a theoretical framework that explains why some prompts succeed while others fail. We show that prompts function as selectors, extracting task-relevant information from the model's full hidden state during CoT reasoning. Each prompt defines a unique trajectory through the answer space, and the choice of trajectory is crucial for task performance and future navigation within the space. We analyze the complexity of finding optimal prompts and characterize the size of the prompt space for a given task. Our theory reveals principles behind effective prompt design and shows that naive CoT-using self-guided prompts like "think step by step"-can severely hinder performance. Through experiments, we show that optimal prompt search can lead to more than a 50% improvement on reasoning tasks, providing a theoretical foundation for prompt engineering.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑