CLAIJan 19, 2023

Batch Prompting: Efficient Inference with Large Language Model APIs

arXiv:2301.08721v2172 citationsh-index: 33Has Code
Originality Incremental advance
AI Analysis

This addresses efficiency problems for industry and real-world users of LLMs, offering an incremental improvement in inference methods.

The paper tackles the high computational and financial costs of inference with large language models (LLMs) by proposing batch prompting, a method that processes multiple samples at once, reducing token and time costs by up to 5x while maintaining or improving performance across various tasks.

Performing inference on large volumes of samples with large language models (LLMs) can be computationally and financially costly in industry and real-world use. We propose batch prompting, a simple yet effective prompting approach that enables the LLM to run inference in batches, instead of one sample at a time. Our method reduces both token and time costs while retaining downstream performance. We theoretically demonstrate that under a few-shot in-context learning setting, the inference costs decrease almost inverse linearly with the number of samples in each batch. We extensively validate the effectiveness of batch prompting on ten datasets across commonsense QA, arithmetic reasoning, and NLI/NLU: batch prompting significantly~(up to 5x with six samples in batch) reduces the LLM (Codex) inference token and time costs while achieving better or comparable performance. For state-of-the-art Chat-based LLMs, e.g., GPT-3.5 and GPT-4, we show the benefits of batch prompting also hold. Further analysis shows that the number of samples in each batch and the complexity of tasks affect its performance. Moreover, batch prompting can be applied across different reasoning methods using LLMs. Our code can be found at the site https://github.com/xlang-ai/batch-prompting.

Code Implementations2 repos
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes