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

提升政治科学中基于LLM的文本分类:面向少样本学习的自动提示优化与动态示例选择

Enhancing LLM-Based Text Classification in Political Science: Automatic Prompt Optimization and Dynamic Exemplar Selection for Few-Shot Learning

University of California, Davis(加利福尼亚大学戴维斯分校)

Menglin Liu, Ge Shi

AI总结:

提出包含自动提示优化、动态示例选择和共识机制的三阶段框架,有效提升了政治科学中基于LLM的文本分类准确率、可靠性与可解释性,且无需重训模型。

摘要:

大型语言模型(LLM)为政治科学中的文本分类提供了巨大潜力,但其有效性通常依赖于高质量的提示和示例。为解决此问题,我们提出了一个三阶段框架,通过自动提示优化、动态示例选择和共识机制来提升LLM的性能。我们的方法使用特定任务的示例自动化提示优化,消除了猜测性的试错调整,并生成符合人类定义标准的结构化提示。在第二阶段,我们动态选择最相关的示例,确保为每个查询提供符合上下文的适当指导。最后,我们的共识机制模拟了多名人类编码员在单一任务中的角色,结合多个LLM的输出,以降低成本实现高可靠性和一致性。在情感分析、立场检测和竞选广告语气分类等任务上的评估表明,我们的方法提升了分类准确率,且无需针对特定任务进行模型重训练或对提示进行大量人工调整。该框架不仅提高了准确率、可解释性和透明度,还提供了专为政治科学应用量身定制的经济高效且可扩展的解决方案。开源Python包(PoliPrompt)已在GitHub上发布。

英文摘要:

Large language models (LLMs) offer substantial promise for text classification in political science, yet their effectiveness often depends on high-quality prompts and exemplars. To address this, we introduce a three-stage framework that enhances LLM performance through automatic prompt optimization, dynamic exemplar selection, and a consensus mechanism. Our approach automates prompt refinement using task-specific exemplars, eliminating speculative trial-and-error adjustments and producing structured prompts aligned with human-defined criteria. In the second stage, we dynamically select the most relevant exemplars, ensuring contextually appropriate guidance for each query. Finally, our consensus mechanism mimics the role of multiple human coders for a single task, combining outputs from LLMs to achieve high reliability and consistency at a reduced cost. Evaluated across tasks including sentiment analysis, stance detection, and campaign ad tone classification, our method enhances classification accuracy without requiring task-specific model retraining or extensive manual adjustments to prompts. This framework not only boosts accuracy, interpretability and transparency but also provides a cost-effective, scalable solution tailored to political science applications. An open-source Python package (PoliPrompt) is available on GitHub.

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

↑