mlsanityData to 14 Oct 2026

PromptPex: Automatic Test Generation for Language Model Prompts

arXiv 2503.05070 ↗First posted 7 Mar 2025cs.SE cs.AIcited by 9

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) are being used in many applications and prompts for these models are integrated into software applications as code-like artifacts. These prompts behave much like traditional software in that they take inputs, generate outputs, and perform some specific function. However, prompts differ from traditional code in many ways and require new approaches to ensure that they are robust. For example, unlike traditional software the output of a prompt depends on the AI model that interprets it. Also, while natural language prompts are easy to modify, the impact of updates is harder to predict. New approaches to testing, debugging, and modifying prompts with respect to the model running them are required. To address some of these issues, we developed PromptPex, an LLM-based tool to automatically generate and evaluate unit tests for a given prompt. PromptPex extracts input and output specifications from a prompt and uses them to generate diverse, targeted, and valid unit tests. These tests are instrumental in identifying regressions when a prompt is changed and also serve as a tool to understand how prompts are interpreted by different models. We use PromptPex to generate tests for eight benchmark prompts and evaluate the quality of the generated tests by seeing if they can cause each of four diverse models to produce invalid output. PromptPex consistently creates tests that result in more invalid model outputs than a carefully constructed baseline LLM-based test generator. Furthermore, by extracting concrete specifications from the input prompt, PromptPex allows prompt writers to clearly understand and test specific aspects of their prompts. The source code of PromptPex is available at https://github.com/microsoft/promptpex.

Key facts. Cited by 9 papers in the map (data through 14 Oct 2026). Builds on 26 of its 95 references that are in the map. First posted on arXiv 7 Mar 2025.

Builds on

26 of 95 references.

References · 26

  1. 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,626
  2. 2022Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language modelscited by 1,998
  3. 2023Large Language Models are not Fair Evaluatorscited by 1,085
  4. 2023DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelinescited by 832
  5. 2023Automatic Prompt Optimization with "Gradient Descent" and Beam Searchcited by 653
  6. 2023GPTFUZZER: Red Teaming Large Language Models with Auto-Generated Jailbreak Promptscited by 560
  7. 2024Large Language Models for Data Annotation and Synthesis: A Surveycited by 205
  8. 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 194
  9. 2024Pride and Prejudice: LLM Amplifies Self-Bias in Self-Refinementcited by 114
  10. 2023No More Manual Tests? Evaluating and Improving ChatGPT for Unit Test Generationcited by 82
  11. 2023Using Large Language Models to Generate JUnit Tests: An Empirical Studycited by 53
  12. 2023FuzzLLM: A Novel and Universal Fuzzing Framework for Proactively Discovering Jailbreak Vulnerabilities in Large Language Modelscited by 51
14 more
  1. 2024SPML: A DSL for Defending Language Models Against Prompt Attackscited by 34
  2. 2024On the Evaluation of Large Language Models in Unit Test Generationcited by 34
  3. 2023ChatGPT vs SBST: A Comparative Assessment of Unit Test Suite Generationcited by 32
  4. 2024Symbolic Prompt Program Search: A Structure-Aware Approach to Efficient Compile-Time Prompt Optimizationcited by 30
  5. 2023(Why) Is My Prompt Getting Worse? Rethinking Regression Testing for Evolving LLM APIscited by 23
  6. 2024MAPO: Boosting Large Language Model Performance with Model-Adaptive Prompt Optimizationcited by 21
  7. 2023ParaFuzz: An Interpretability-Driven Technique for Detecting Poisoned Samples in NLPcited by 19
  8. 2024SPADE: Synthesizing Data Quality Assertions for Large Language Model Pipelinescited by 19
  9. 2024GhostWriter: Augmenting Collaborative Human-AI Writing Experiences Through Personalization and Agencycited by 18
  10. 2024PROMPTFUZZ: Harnessing Fuzzing Techniques for Robust Testing of Prompt Injection in LLMscited by 17
  11. 2024Specifications: The missing link to making the development of LLM systems an engineering disciplinecited by 17
  12. 2023Unit Test Generation using Generative AI : A Comparative Performance Analysis of Autogeneration Toolscited by 13
  13. 2024Test Oracle Automation in the era of LLMscited by 11
  14. 2024RETAIN: Interactive Tool for Regression Testing Guided LLM Migrationcited by 3

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 5; 2026: 4.

9 papers.