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

GraphIC: 一种基于图的上下文示例检索模型用于多步推理

GraphIC: A Graph-Based In-Context Example Retrieval Model for Multi-Step Reasoning

Jiale Fu, Yaqing Wang, Simeng Han, Jiaming Fan, Xu Yang

AI总结:

GraphIC是一种基于图的上下文示例检索模型,通过推理意识的表示和专门相似性度量提升LLM在多步推理中的性能。

摘要:

上下文学习(ICL)通过引入演示示例来增强大型语言模型(LLMs),但其效果严重依赖于所选示例的质量。当前方法通常使用文本嵌入来度量语义相似性,这在多步推理任务中常常引入偏差。这是因为文本嵌入包含无关的语义信息,并且缺乏更深层次的推理结构。为了解决这个问题,我们提出了GraphIC,一种基于图的检索模型,它利用了推理意识的表示和专门的相似性度量来进行上下文示例检索。GraphIC首先构建了以思维图为导向、节点带属性的图,这些图明确建模了候选示例和查询的推理步骤及其依赖关系。这种方法过滤掉表面语义,同时保留必要的推理过程。接下来,GraphIC使用一种新的相似性度量来检索示例,捕捉顺序推理模式和示例之间的不对称性。在数学推理、代码生成和逻辑推理任务中的全面评估表明,GraphIC优于10种基线方法。我们的结果强调了在ICL中推理意识检索的重要性,为增强LLM在多步推理场景中的性能提供了稳健的解决方案。

英文摘要:

In-context learning (ICL) enhances large language models (LLMs) by incorporating demonstration examples, yet its effectiveness heavily depends on the quality of selected examples. Current methods typically use text embeddings to measure semantic similarity, which often introduces bias in multi-step reasoning tasks. This occurs because text embeddings contain irrelevant semantic information and lack deeper reasoning structures. To address this, we propose GraphIC, a graph-based retrieval model that leverages reasoning-aware representation and specialized similarity metric for in-context example retrieval. GraphIC first constructs thought graphs-directed, node-attributed graphs that explicitly model reasoning steps and their dependencies-for candidate examples and queries. This approach filters out superficial semantics while preserving essential reasoning processes. Next, GraphIC retrieves examples using a novel similarity metric tailored for these graphs, capturing sequential reasoning patterns and asymmetry between examples. Comprehensive evaluations across mathematical reasoning, code generation, and logical reasoning tasks demonstrate that GraphIC outperforms 10 baseline methods. Our results highlight the importance of reasoning-aware retrieval in ICL, offering a robust solution for enhancing LLM performance in multi-step reasoning scenarios.

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

↑