AdaCoder:面向程序化视觉问答的自适应提示压缩
AdaCoder: Adaptive Prompt Compression for Programmatic Visual Question Answering
AI总结:
针对视觉程序化模型因需长输入提示提供API细节而效率低的问题,提出自适应提示压缩框架AdaCoder,通过按问题类型生成并选择压缩预提示,在免训练适配黑盒LLM的同时减少71.1%的token长度并提升问答性能。
摘要:
视觉问答旨在针对给定的视觉输入回答自然语言问题。近期,视觉程序化模型(VPMs)通过大型语言模型(LLMs)生成可执行程序来回答问题,引起了研究界的关注。然而,它们通常需要长输入提示,以向 LLM 提供足够的 API 使用细节来生成相关代码。为解决这一局限,我们提出了 AdaCoder,一种用于 VPMs 的自适应提示压缩框架。AdaCoder 分两个阶段运行:压缩阶段和推理阶段。在压缩阶段,给定一个用 Python 语言描述所有 API 定义并附带代码示例片段的预提示,系统会生成一组压缩后的预提示,每条提示均依赖于特定的题目类型。在推理阶段,给定一个输入问题,AdaCoder 会预测该问题的类型,并选择相应的合适压缩预提示来生成代码以回答问题。值得注意的是,AdaCoder 仅采用单个冻结的 LLM 和预定义提示,免除了额外训练的必要性,并保持了在不同强大黑盒 LLM(如 GPT 和 Claude)间的适应性。在实验中,我们将 AdaCoder 应用于 ViperGPT,结果表明它能将 token 长度减少 71.1%,同时维持甚至提升了视觉问答的性能。
英文摘要:
Visual question answering aims to provide responses to natural language questions given visual input. Recently, visual programmatic models (VPMs), which generate executable programs to answer questions through large language models (LLMs), have attracted research interest. However, they often require long input prompts to provide the LLM with sufficient API usage details to generate relevant code. To address this limitation, we propose AdaCoder, an adaptive prompt compression framework for VPMs. AdaCoder operates in two phases: a compression phase and an inference phase. In the compression phase, given a preprompt that describes all API definitions in the Python language with example snippets of code, a set of compressed preprompts is generated, each depending on a specific question type. In the inference phase, given an input question, AdaCoder predicts the question type and chooses the appropriate corresponding compressed preprompt to generate code to answer the question. Notably, AdaCoder employs a single frozen LLM and pre-defined prompts, negating the necessity of additional training and maintaining adaptability across different powerful black-box LLMs such as GPT and Claude. In experiments, we apply AdaCoder to ViperGPT and demonstrate that it reduces token length by 71.1%, while maintaining or even improving the performance of visual question answering.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。