[Paper Review] Revisiting Prompt Engineering via Declarative Crowdsourcing
The paper proposes declarative prompt engineering by treating LLMs as noisy oracles and borrowing declarative crowdsourcing principles to produce cost- and quality-aware, multi-step data-processing workflows.
Large language models (LLMs) are incredibly powerful at comprehending and generating data in the form of text, but are brittle and error-prone. There has been an advent of toolkits and recipes centered around so-called prompt engineering-the process of asking an LLM to do something via a series of prompts. However, for LLM-powered data processing workflows, in particular, optimizing for quality, while keeping cost bounded, is a tedious, manual process. We put forth a vision for declarative prompt engineering. We view LLMs like crowd workers and leverage ideas from the declarative crowdsourcing literature-including leveraging multiple prompting strategies, ensuring internal consistency, and exploring hybrid-LLM-non-LLM approaches-to make prompt engineering a more principled process. Preliminary case studies on sorting, entity resolution, and imputation demonstrate the promise of our approach
Motivation & Objective
- Motivate a principled, declarative approach to prompt engineering for production data workflows.
- Leverage ideas from declarative crowdsourcing to decompose tasks into unit LLM calls with cost and accuracy budgets.
- Explore strategies such as varied prompting, hybrid coarse-to-fine prompting, and consistency enforcement to improve reliability and efficiency.
- Demonstrate the approach on case studies like sorting, entity resolution, and missing value imputation.
Proposed method
- Present a wrapper concept around a toolkit (e.g., LangChain) to apply data primitives (sort, filter, join, categorize, cluster, find, fill, resolve) to datasets under budget and accuracy constraints.
- Adapt crowdsourcing principles to LLM workflows, including task decomposition, consistency enforcement, and hybrid non-LLM proxies to manage cost-accuracy trade-offs.
- Evaluate prompting strategies (single task vs. pairwise comparisons vs. ratings) for sorting to compare accuracy-cost curves.
- Propose coarse-to-fine prompting (sort then insert) to handle large item sets and reduce hallucinations.
- Introduce internal consistency checks (transitivity enforcement) for batch tasks like entity resolution to improve accuracy.
- Discuss hybrid LLM/non-LLM strategies (e.g., k-NN proxies, embeddings) to reduce LLM usage while maintaining accuracy.
- Outline quality-control mechanisms inspired by crowdsourcing (validation sets, cross-LLM checks, debiasing, calibration).
Experimental results
Research questions
- RQ1How can declarative crowdsourcing principles be adapted to prompt engineering to improve cost and accuracy trade-offs in LLM-powered data workflows.
- RQ2What prompting strategies and task decompositions yield better scalability and reliability for closed-ended data tasks.
- RQ3Can hybrid coarse-to-fine prompting and consistency enforcement reduce hallucinations and maintain or improve accuracy at lower cost.
- RQ4How can non-LLM proxies and quality-control techniques be integrated to optimize LLM usage in production workflows.
Key findings
- Pairwise prompting for sorting yields higher accuracy but higher cost compared to baseline single-prompt approaches.
- Coarse-to-fine hybrid prompting (sort, then insert) dramatically improves accuracy while reducing missing items for large item sets.
- Enforcing internal consistency via transitivity among pairwise comparisons increases F1 scores in entity resolution tasks.
- Hybrid approaches combining non-LLM proxies (e.g., k-NN, embeddings) with LLMs can achieve similar accuracy at substantially lower LLM usage costs.
- Quality-control mechanisms and validation-based accuracy estimation support adaptive querying strategies to balance cost and accuracy.
- Empirical case studies demonstrate varying cost-accuracy profiles across strategies, highlighting the value of exploring multiple task decompositions.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.