Introduction
The ever-increasing token limits of Large Language Models (LLMs) have unlocked the ability to process long contexts. However, standard LLM inference typically relies on a "SinglePrompt" approach: a prompt contains detailed instructions, a few examples, and exactly one data point for the model to process. While effective, this method is highly inefficient. The fixed overhead of instructions and examples is repeated for every single query, leading to low token utilization and high computational costs.
To drastically reduce costs and token usage, researchers introduce BatchPrompt, a prompting strategy that groups multiple data points into a single LLM call. By combining batch permutations with a clever "self-reflection" early stopping mechanism, BatchPrompt achieves performance competitive with traditional single-data prompting while using up to 84% fewer tokens.
The "Middle" Problem and Position Bias
Simply throwing a large number of data points into one prompt (naive batching) often degrades performance. LLMs suffer from position bias, where the model's accuracy fluctuates depending on where a data point is located within the sequence.
As the batch size grows, the overall quality of the answers tends to drop. LLMs often struggle with data placed in the middle of a long prompt, performing significantly better at the very beginning or end. The authors set out to find a way to batch data without sacrificing the high-quality output expected from models like GPT-4.
Methods: Overcoming Bias with BPE and SEAS
To address the quality issues of naive batching while retaining high token utilization, the researchers propose a framework consisting of three main components:
- BatchPrompt: The foundational strategy of grouping multiple data points (e.g., 32 or 64) into one prompt.
- Batch Permutation and Ensembling (BPE): To fight position bias, the system runs the same batch multiple times but shuffles the order of the data points in each round. It then uses a majority vote across these different permutations to decide on the final answer. Because the model's errors are often tied to specific positions, they don't overlap well, whereas correct answers remain stable across positions.
- Self-reflection-guided EArly Stopping (SEAS): Voting multiple times across large batches can become expensive. SEAS asks the LLM to provide a confidence label alongside its answer. If a data point receives consistent "confident" ratings across the first couple of rounds, the system stops voting on it. This allows the model to focus its remaining compute budget on harder, more ambiguous samples. Remarkably, roughly 80% of data points can be answered confidently within just two voting rounds.
Key Results
The authors evaluated their approach on several popular NLP benchmarks, including Boolq (Boolean question answering), QQP (Quora Question Pairs), RTE (Recognizing Textual Entailment), and GSM8K (math word problems). The results demonstrate massive efficiency gains without sacrificing accuracy:
- Massive Efficiency: At a batch size of 32, BatchPrompt + BPE + SEAS required only 15.7% of the LLM calls compared to the SinglePrompt baseline.
- Token Savings: Total input tokens were reduced significantly. For example, QQP used only 18.6% of the original tokens, and Boolq used only 27.4%.
- Competitive Accuracy: On GPT-4, the method often outperformed SinglePrompt. For the Boolq task, accuracy actually increased from 90.6% to 90.9% while using a fraction of the resources. Even on complex math tasks (GSM8K), batching 32 problems together and voting 5 times improved accuracy from 89.1% to 92.0%.
Limitations and Future Work
While highly effective for classification and short-answer tasks, the authors acknowledge several areas for future exploration. The current majority-voting system is designed for tasks with discrete labels and may need adaptation for open-ended generative tasks like summarization. Additionally, the "optimal" batch size and number of voting rounds currently require tuning, suggesting a potential role for Reinforcement Learning to automate these settings in the future. Finally, the strategy relies heavily on the "self-reflection" capabilities of advanced models like GPT-4, and may be less effective on smaller or older models.
Summary updated