基于大语言模型函数调用的反思式提示词微调
阅读原文· arxiv.org提示词设计仍需大量人力且对格式高度敏感。现有自动化方法受限于候选搜索或固定流程,难以系统性地捕捉错误模式。文章提出反思式提示词微调(RPT)框架,通过LLM函数调用模拟人类工程师工作流:LLM优化器调用诊断函数评估目标模型,总结重复性失败模式并返回结构化报告;优化器依据该报告及历史记忆修订提示词进行下一轮迭代。框架支持置信度感知优化。实验显示,在三个推理任务上RPT最高提升12.9分,与当前最佳方法持平,并改善了置信度校准。分析表明其对多跳与数学推理任务尤为有效,能生成针对性修订。
Large language models (LLMs) have become increasingly capable of following instructions and complex reasoning, making prompting a flexible interface for adapting models without parameter updates. Yet prompt design remains labor-intensive and highly sensitive to formatting, phrasing, and instruction order, motivating automated prompt optimization methods that reduce manual effort while preserving inference-time flexibility. However, existing methods often search over prompt candidates or use fixed critique-refine pipelines driven by individual examples or small batches, limiting their ability to capture systematic error patterns and make targeted edits grounded in failure history. We propose Reflective Prompt Tuning (RPT), a framework that uses LLM function calling to simulate the iterative workflow of human prompt engineers. An LLM optimizer calls a diagnostic function that evaluates the target model over an entire optimization set, summarizes recurring failure modes, and returns a structured diagnostic report. The optimizer uses this report, together with an accumulated memory of prior reports, to revise the prompt for the next iteration. RPT further supports confidence-aware optimization by using calibration signals in diagnostic feedback and final prompt selection. Across three reasoning tasks, RPT improves over initial prompts by up to 12.9 points, remains competitive with state of the art, and improves confidence calibration. Our analyses show that RPT is especially effective on multi-hop and mathematical reasoning, producing targeted prompt revisions that align with diagnosed failure patterns and lead to gains in task performance and calibration.