[论文解读] How Confident Is the First Token? An Uncertainty-Calibrated Prompt Optimization Framework for Large Language Model Classification and Understanding
论文介绍了 Log-Scale Focal Uncertainty (LSFU) 与 UCPOF,用于对首令牌不确定性进行提示优化的标定,从而提升少样本准确率并减少 RAG 中不必要的检索。
With the widespread adoption of large language models (LLMs) in natural language processing, prompt engineering and retrieval-augmented generation (RAG) have become mainstream to enhance LLMs' performance on complex tasks. However, LLMs generate outputs autoregressively, leading to inevitable output uncertainty. Since model performance is highly sensitive to prompt design, precise uncertainty measurement is crucial for reliable prompt optimization. For multi-class multiple-choice (understanding) tasks, conventional uncertainty measures (e.g., entropy) based on output probabilities treat all classes equally and ignore class prior differences in pretraining corpora. This failure to distinguish spurious confidence (from priors) from true certainty (from contextual understanding) results in poor confidence calibration. To address this, we propose Log-Scale Focal Uncertainty (LSFU), a first-token-based metric inspired by focal loss. LSFU incorporates label prior probabilities as a risk-modulation factor to suppress noise from high-frequency classes and emphasize risk for low-frequency long-tail classes, with a dynamic weighting mechanism unifying the measurement scale. Based on LSFU, we further propose the uncertainty-calibrated prompt optimization framework (UCPOF), which leverages the first token of model outputs to select high-quality exemplars and dynamically optimize prompts. Comprehensive evaluations show UCPOF improves average accuracy by 6.03% over few-shot baselines, surpasses always-on full RAG by 5.75% in overall average accuracy, and reduces the average retrieval trigger rate by 50.66%. By adaptively triggering RAG only for high-uncertainty samples, our framework significantly lowers computational costs while maintaining state-of-the-art performance.
研究动机与目标
- 为在情境学习的分类任务中引导提示设计,提供可靠的不确定性信号的必要性提供动力。
- 提出基于首令牌的不确定性(LSFU),考虑类别先验以改善标定。
- 使用 LSFU 构建静态提示选择(Gold Shot),并结合一个基于不确定性的动态提示框架(UCPOF)。
- 证明 UCPOF 提高准确率并减少检索触发,从而实现成本效益的自适应提示。
提出的方法
- 引入 Log-Scale Focal Uncertainty (LSFU),将首令牌的前 K 熵与一个标签先验调制因子 (1 - P_prior(y))^2 以及对数变换相结合。
- 利用 LSFU 选择 Gold Shot 典例以获得高质量的静态提示。
- 将 UCPOF 定义为两阶段框架:离线准备(静态提示 + 门控阈值)和在线推理(静态提示 → 门控 → 如有需要进行反思提示)。
- 实现门控阈值 T,以通过检索语义相关的参考资料在高风险样本上触发反思提示。
- 给出一个正式的判定规则,其中 P_UCPOF(y|x) 在 S(x) < τ 时使用 ICL,否则进行带检索上下文的 RAG。
- 提供离线向量知识库构建,使用所有样本编码以支持反思提示的检索。
实验结果
研究问题
- RQ1首令牌不确定性是否能够可靠指示任务理解水平,从而用于提示和示例选择?
- RQ2将标签先验纳入首令牌不确定性(LSFU)是否比基于熵的度量在标定上有所提升?
- RQ3与始终开启的 RAG 相比,UCPOF 是否能在保持或提升准确率的同时减少检索使用?
- RQ4动态检索触发对分类任务推理成本与性能的影响如何?
主要发现
- LSFU 通过对高频类别进行下偏以及突出长尾风险来校准不确定性,改善提示优化信号。
- 通过 LSFU 进行 Gold Shot 典例选择,相较于随机或基于相似性的选择,能得到更稳定且更聚焦的静态提示。
- UCPOF 相较于少样本基线在平均准确率上提升 6.03%,超过始终开启全 RAG 的效果,整体准确率提升达 5.75%。
- UCPOF 将检索触发率降低 50.66%,仅对高不确定样本进行自适应检索,从而降低计算成本。
- 该框架将离线静态提示与在线动态纠错相结合,在保持最先进性能的同时降低推理成本。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。