Prompt Selection and Augmentation for Few Examples Code Generation in Large Language Model and its Application in Robotics Control
作者: On Tai Wu, Frodo Kin Sun Chan, Zunhao Zhang, Yan Nei Law, Benny Drescher, Edmond Shiao Bun Lai
分类: cs.RO, cs.AI, cs.CL, cs.LG
发布日期: 2024-03-11
备注: 17 pages, 4 figures
💡 一句话要点
提出提示选择与增强算法以改善少量示例代码生成
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 少量示例学习 代码生成 大型语言模型 机器人控制 示例选择 示例增强 工业自动化
📋 核心要点
- 现有方法在处理复杂任务时,尤其是在代码生成和数学推理方面,面临示例多样性不足和冗余性高的问题。
- 论文提出了一种结合多阶段示例增强和选择的算法,通过优化示例的多样性和相关性来提升LLM的性能。
- 实验结果显示,该算法在GSM8K和SVAMP基准上分别提高了0.3%和1.1%的性能,并在模拟环境中成功率提高3.4%。
📝 摘要(中文)
少量示例提示和逐步推理增强了大型语言模型(LLMs)在复杂任务中的能力,包括代码生成。本文提出了一种提示选择和增强算法,旨在改善数学推理和机器人臂操作。该方法结合了多阶段示例增强方案和示例选择方案,通过选择一组多样性高、冗余低且与问题相关的示例来提升LLM性能。结合思维程序提示,该算法在GSM8K和SVAMP基准测试中分别提高了0.3%和1.1%的性能。此外,在模拟桌面环境中,该算法在成功任务完成率上超越了Code-as-Policies方法,成功率提高了3.4%,同时减少了超过70%的示例使用量。通过丢弃对解决问题贡献小的示例,该算法减少了LLM驱动的机器人系统的推理时间,并为工业过程自动化提供了重要的好处。
🔬 方法详解
问题定义:本文旨在解决大型语言模型在少量示例代码生成中的性能不足,尤其是在数学推理和机器人控制任务中的示例多样性和冗余性问题。现有方法往往依赖于固定的示例集,导致模型在特定任务上的表现不佳。
核心思路:提出的算法通过多阶段示例增强和选择,优化示例的多样性和相关性,从而提升模型的推理能力和任务完成率。该设计旨在通过选择最具代表性的示例来减少冗余,提高模型的推理效率。
技术框架:算法整体架构包括示例选择模块和示例增强模块。示例选择模块负责从候选示例中筛选出最相关的示例,而示例增强模块则通过生成多样化的示例来丰富训练数据。
关键创新:最重要的创新在于通过结合多阶段的示例选择与增强策略,显著提高了模型在复杂任务中的表现,尤其是在减少冗余和提高示例相关性方面,与传统方法相比具有本质区别。
关键设计:在参数设置上,算法通过动态调整示例的选择标准,使用特定的损失函数来优化示例的多样性和相关性,确保模型在推理时能够快速找到最优解。
📊 实验亮点
实验结果表明,提出的算法在GSM8K和SVAMP基准测试中分别提高了0.3%和1.1%的性能。在模拟桌面环境中,成功任务完成率提高了3.4%,同时示例使用量减少超过70%,显示出显著的效率提升。
🎯 应用场景
该研究的潜在应用领域包括机器人控制、工业自动化和代码生成等。通过优化示例选择和增强,该算法能够显著减少手动编程的工作量,提高代码的可重用性,进而加速开发和部署过程,具有重要的实际价值和未来影响。
📄 摘要(原文)
Few-shot prompting and step-by-step reasoning have enhanced the capabilities of Large Language Models (LLMs) in tackling complex tasks including code generation. In this paper, we introduce a prompt selection and augmentation algorithm aimed at improving mathematical reasoning and robot arm operations. Our approach incorporates a multi-stage example augmentation scheme combined with an example selection scheme. This algorithm improves LLM performance by selecting a set of examples that increase diversity, minimize redundancy, and increase relevance to the question. When combined with the Program-of-Thought prompting, our algorithm demonstrates an improvement in performance on the GSM8K and SVAMP benchmarks, with increases of 0.3% and 1.1% respectively. Furthermore, in simulated tabletop environments, our algorithm surpasses the Code-as-Policies approach by achieving a 3.4% increase in successful task completions and a decrease of over 70% in the number of examples used. Its ability to discard examples that contribute little to solving the problem reduces the inferencing time of an LLM-powered robotics system. This algorithm also offers important benefits for industrial process automation by streamlining the development and deployment process, reducing manual programming effort, and enhancing code reusability.