Skip to main navigation Skip to search Skip to main content

Optimized Batch Prompting for Cost-effective LLMs

  • Beijing Institute of Technology
  • Zhejiang University

Research output: Contribution to journalArticlepeer-review

Abstract

Large Language Models (LLMs) have recently demonstrated exceptional performance in various real-world data management tasks through in-context learning (ICL), which involves structuring prompts with task descriptions and several demonstrations. However, most LLMs are not free and charge based on the number of input tokens. Specifically, for data management tasks, there may be massive related questions, leading to high inference cost due to redundant prompt content (i.e., overlapping demonstrations and repeated task descriptions). In this paper, we investigate the idea of batch prompting in leveraging LLMs for data management, which leads to cost-effective LLMs by grouping questions and demonstrations to perform inferences in batches. Current studies on batch prompting are preliminary and mostly based on heuristics, making it difficult to generalize to various types of tasks and adapt to different grouping strategies. To address these challenges, in this work we first formalize the batch prompting problem in general setting. Then, we study the hardness of this problem and propose efficient algorithms for adaptive grouping. Finally, we conduct comprehensive experiments on 14 datasets. Extensive experimental results demonstrate that our solution consistently outperforms the state-of-the-art baselines while consuming lower cost.

Original languageEnglish
Pages (from-to)2172-2184
Number of pages13
JournalProceedings of the VLDB Endowment
Volume18
Issue number7
DOIs
Publication statusPublished - 2025
Externally publishedYes

Fingerprint

Dive into the research topics of 'Optimized Batch Prompting for Cost-effective LLMs'. Together they form a unique fingerprint.

Cite this