The increasing reliance on Large Language Models (LLMs) across academia and industry necessitates a comprehensive understanding of their robustness to prompts. In response to this vital need, we introduce PromptBench, a robustness benchmark designed to measure LLMs' resilience to adversarial prompts. This study uses a plethora of adversarial textual attacks targeting prompts across multiple levels: character, word, sentence, and semantic. These prompts are then employed in diverse tasks, such as sentiment analysis, natural language inference, reading comprehension, machine translation, and math problem-solving. Our study generates 4,032 adversarial prompts, meticulously evaluated over 8 tasks and 13 datasets, with 567,084 test samples in total. Our findings demonstrate that contemporary LLMs are vulnerable to adversarial prompts. Furthermore, we present comprehensive analysis to understand the mystery behind prompt robustness and its transferability. We then offer insightful robustness analysis and pragmatic recommendations for prompt composition, beneficial to both researchers and everyday users. We make our code, prompts, and methodologies to generate adversarial prompts publicly accessible, thereby enabling and encouraging collaborative exploration in this pivotal field: https://github.com/microsoft/promptbench.
翻译:随着学术界与工业界对大语言模型(LLMs)依赖程度的日益加深,全面理解其针对提示的鲁棒性成为迫切需求。为应对这一关键挑战,我们提出PromptBench——一个旨在衡量LLMs对抗性提示鲁棒性的基准测试框架。本研究采用了大量针对提示的多层次对抗文本攻击方法:字符级、词汇级、句子级和语义级。随后,这些对抗性提示被应用于情感分析、自然语言推理、阅读理解、机器翻译和数学问题求解等多样化任务中。我们生成了4,032个对抗性提示,在8项任务、13个数据集上进行了细致评估,总计567,084个测试样本。研究结果表明,当前大语言模型对对抗性提示存在脆弱性。此外,我们通过综合分析揭示了提示鲁棒性及其迁移性背后的机制,并提供了深刻的鲁棒性分析及实用的提示构建建议,对研究人员与普通用户均具有参考价值。我们已将生成对抗性提示的代码、提示模板及方法论全部公开,旨在促进这一关键领域的协同探索:https://github.com/microsoft/promptbench。