Enhancing LLM-Based Text Classification in Political Science: Automatic Prompt Optimization and Dynamic Exemplar Selection for Few-Shot Learning
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 12 of its 51 references that are in the map. First posted on arXiv 2 Sep 2024.
Builds on
12 of 51 references.
References · 12
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
- 2020Scaling Laws for Neural Language Modelscited by 6,411
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
- 2018UMAP: Uniform Manifold Approximation and Projection for Dimension Reductioncited by 2,841
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2022Large Language Models Are Human-Level Prompt Engineerscited by 1,020
- 2023DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelinescited by 803
- 2022A Survey on In-context Learningcited by 717
- 2019How to Fine-Tune BERT for Text Classification?cited by 409
- 2024Is Cosine-Similarity of Embeddings Really About Similarity?cited by 89
Built on by
Citing papers per year: 2024: 1; 2025: 3; 2026: 1.
5 papers.
- 2026Sustainable Hybrid Document-Routed Retrieval for Financial RAG: Resolving the Robustness-Precision Trade-offcited by 13
- 2025Generative AI in Transportation Planning: A Surveycited by 8
- 2024Rethinking Scale: The Efficacy of Fine-Tuned Open-Source LLMs in Large-Scale Reproducible Social Science Researchcited by 6
- 2025Arti-"fickle" Intelligence: Using LLMs as a Tool for Inference in the Political and Social Sciencescited by 1
- 2025Automated Annotation of Evolving Corpora for Augmenting Longitudinal Network Data: A Framework Integrating Large Language Models and Expert Knowledgecited by 0
- 2026Sustainable Hybrid Document-Routed Retrieval for Financial RAG: Resolving the Robustness-Precision Trade-off26 Mar 2026
- 2025Arti-"fickle" Intelligence: Using LLMs as a Tool for Inference in the Political and Social Sciences4 Apr 2025
- 2025Generative AI in Transportation Planning: A Survey10 Mar 2025
- 2025Automated Annotation of Evolving Corpora for Augmenting Longitudinal Network Data: A Framework Integrating Large Language Models and Expert Knowledge3 Mar 2025
- 2024Rethinking Scale: The Efficacy of Fine-Tuned Open-Source LLMs in Large-Scale Reproducible Social Science Research31 Oct 2024