NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

PromptBench: A Unified Library for Evaluation of Large Language Models

Kaijie Zhu, Qinlin Zhao, Hao Chen, Jindong Wang, Xing Xie

TL;DR

PromptBench is a unified, open-source Python library designed to standardize the evaluation of Large Language Models (LLMs). It provides a modular framework for researchers to test model performance across diverse tasks, explore prompt engineering techniques, and rigorously assess robustness through adversarial attacks and dynamic evaluation protocols.

What Problem Does This Paper Address?

Evaluating LLMs is notoriously difficult. These models are highly sensitive to prompt variations—a slight change in wording can lead to significantly different outputs. Furthermore, the field faces two major hurdles: adversarial vulnerability (where small, intentional perturbations break model logic) and data contamination (where models appear to perform well simply because they have seen the test data during training).

Existing libraries like LangChain or LlamaIndex are excellent for building applications but lack the specialized, rigorous tools needed for deep research evaluation. PromptBench addresses this gap by providing a "one-stop shop" that unifies model loading, dataset handling, prompt engineering, and attack simulation into a single, extensible codebase.

Methods

PromptBench is built on a modular architecture that allows researchers to mix and match components easily. The framework consists of several key pillars:

  • Unified Model & Dataset Interfaces: It supports a wide range of open-source models (e.g., Llama 2, Mistral, Phi-2) and proprietary APIs (e.g., GPT-4, Gemini, PaLM 2) through standardized LLMModel and VLMModel interfaces.
  • Prompt Engineering: The library implements six prominent techniques, including Chain-of-Thought (CoT), Zero-Shot CoT, EmotionPrompt, and Expert Prompting.
  • Adversarial Attacks: To test robustness, PromptBench includes four levels of attacks:
  • Character-level: Introducing typos (e.g., TextBugger).
  • Word-level: Replacing words with synonyms (e.g., BertAttack).
  • Sentence-level: Appending irrelevant or distracting sentences.
  • Semantic-level: Simulating different linguistic styles or regional dialects.
  • Dynamic Evaluation: To combat data contamination, it supports protocols like DyVal, which generates complexity-tailored evaluation samples on-the-fly rather than relying on static, potentially "leaked" benchmarks.
Figure 1: The components and supported research areas of PromptBench.

Datasets

The library currently supports 22 public datasets across 12 distinct tasks. These include:

  • General NLP: GLUE (sentiment, grammar, etc.), MMLU (multitask knowledge), and SQuAD V2 (reading comprehension).
  • Reasoning & Math: GSM8K, MATH, and Big-Bench Hard.
  • Multimodal (Vision-Language): VQAv2, MMMU, MathVista, and ScienceQA.
  • Translation: IWSLT 2017 and UN Multi.

Key Insights and Ideas

  • The Fragility of Performance: The authors emphasize that LLM performance is not a static number but a distribution heavily influenced by prompt construction. PromptBench allows for "sweep running" to see how performance fluctuates across different prompt versions.
  • Robustness is the New Frontier: By integrating adversarial attacks, the paper highlights that even "state-of-the-art" models are surprisingly vulnerable to simple character swaps or distracting sentences.
  • Moving Beyond Static Benchmarks: The inclusion of dynamic evaluation (DyVal) suggests a shift in the research community. As LLMs are trained on more of the internet, static test sets become less reliable. Generating fresh, logically complex problems on-the-fly is essential for true capability assessment.
  • Research-First Design: Unlike production-oriented tools, PromptBench includes analysis utilities like attention visualization and word frequency analysis to help researchers understand why a model failed an attack.

Key Results

The paper provides benchmarking results that serve as a baseline for the community:

  • Adversarial Robustness: While all models showed vulnerability, ChatGPT and GPT-4 demonstrated the highest levels of robustness against adversarial prompts compared to smaller open-source models.
  • Prompt Engineering Effectiveness: Techniques like Chain-of-Thought generally improve performance in reasoning tasks, but the authors note that no single method surpasses the baseline across every dataset, highlighting the need for task-specific optimization.
  • Dynamic Evaluation (DyVal): Results from DyVal (Figure 5 in the paper) show that models struggle significantly more with reachability and "max sum path" tasks when the problems are generated dynamically, suggesting that some performance on static benchmarks may be inflated.

Limitations and Future Work

The authors acknowledge that PromptBench is a "first step." Current limitations include:

  • Scenario Coverage: It does not yet cover every possible evaluation scenario (e.g., long-form creative writing or highly specific domain expertise).
  • Metric Nuance: Some automated metrics may miss subtle qualitative differences in model outputs.
  • Dependency: The framework’s effectiveness is inherently tied to the quality and diversity of the underlying datasets and prompts.

Future work will focus on adding more datasets, refining evaluation protocols to further mitigate data contamination, and expanding the suite of analytical tools for interpretability.

Summary updated

BibTeX
@article{zhu2024promptbench,
  author = {Kaijie Zhu and Qinlin Zhao and Hao Chen and Jindong Wang and Xing Xie},
  title = {{PromptBench: A Unified Library for Evaluation of Large Language Models}},
  journal = {J. Mach. Learn. Res.},
  year = {2024},
  url = {https://openreview.net/forum?id=T2VZRXEpdA},
}
Figure