OverPrompt: Enhancing ChatGPT Capabilities through an Efficient In-Context Learning Approach

Jiazheng Li, Runcong Zhao, Yulan He, Lin Gui · DOI

Abstract

OverPrompt is a novel zero-shot prompting strategy that batches multiple task inputs into a single Large Language Model (LLM) query using structured JSON formatting. This approach significantly reduces token costs and API latency while maintaining or improving classification accuracy by enabling the model to compare instances in-context. Evaluation across ten diverse datasets demonstrates that OverPrompt provides a scalable solution for efficient LLM deployment in production environments.

Introduction

The "zero-shot" paradigm is the standard for interacting with LLMs like ChatGPT, where a user provides a task description and a single input. However, this method is inherently inefficient for large-scale tasks. Developers pay for redundant task description tokens for every instance, and sequential API calls introduce substantial network latency.

Deploying LLMs in production faces two primary hurdles: cost and latency. In standard prompting, the instruction often constitutes the majority of the token count. Furthermore, processing inputs in isolation prevents the model from leveraging its "In-Context Learning" (ICL) capabilities to identify patterns or boundaries across multiple examples. The OverPrompt framework addresses these challenges by batching multiple inputs into a single prompt.

Methodology

The core of OverPrompt is batch processing, where $n$ inputs (e.g., $n=10$ or $20$) are sent in a single query. To ensure the model correctly maps labels to inputs, the framework utilizes structured JSON formatting (e.g., {"1": "label_a", "2": "label_b"}).

Workflow comparison between classical zero-shot and OverPrompt batch processing using the VitaminC dataset.

The researchers also explored Semantic Grouping (grp), which clusters similar inputs together. This technique is hypothesized to help the model better "locate" the specific task concept. From a theoretical standpoint, OverPrompt uses a Bayesian inference lens, suggesting that a larger set of samples helps the model better approximate the conditional distribution of the target task.

Experimental Results

The authors evaluated OverPrompt across 10 text classification datasets, including fact-checking (Fever, VitaminC, HoVer), sentiment analysis (SST-2), and Natural Language Inference (NLI). The results demonstrate a "win-win" for both efficiency and performance.

Efficiency Gains

On the Fever dataset, the average processing time per instance dropped from 1.37s ($n=1$) to 0.36s ($n=20$). Similarly, token costs per input fell from 100.5 to 60.8. These gains are nonlinear; while moving from $n=1$ to $n=10$ provides massive improvements, the benefits stabilize as $n$ increases toward the model's context limit.

Classification Performance

Surprisingly, batching often improves accuracy. On the SST-2 sentiment dataset, accuracy rose from 91.97% to 94.95% at $n=20$. In fact-checking tasks, the ability to compare instances allows the model to distinguish subtle nuances between "Support" and "Refute" labels more effectively.

Performance metrics (Accuracy and Macro-F1) across different batch sizes (n) for fact-checking datasets.

As shown in the table above, Macro-F1 scores—which account for class imbalance—often peak at higher batch sizes, such as $n=10$ for the HoVer dataset.

Discussion and Conclusion

OverPrompt reveals that LLMs are remarkably robust to input ordering within a batch, unlike traditional few-shot prompting. However, the strategy is model-sensitive; while highly effective for GPT-x and Ernie Bot, smaller models like Llama-2 often struggle with complex batching and JSON instructions.

Limitations include potential performance degradation for logic-heavy NLI tasks or very long inputs that exceed context windows. Future research will focus on finding the optimal batch size for different task types and deconstructing complex instructions into simpler subtasks to further enhance efficiency without sacrificing reasoning capabilities.

Summary updated

BibTeX
@inproceedings{li2023overprompt,
  author = {Jiazheng Li and Runcong Zhao and Yulan He and Lin Gui},
  title = {{OverPrompt: Enhancing ChatGPT Capabilities through an Efficient In-Context Learning Approach}},
  booktitle = {R0-FoMo @ NeurIPS},
  year = {2023},
  url = {https://openreview.net/forum?id=7jmtHtv9Ch},
}
Figure