Abstract
Large Language Models (LLMs) for code generation exhibit significant performance variability based on prompt phrasing. This paper introduces PromptSE, a framework to quantify model stability against stylistic perturbations driven by emotion and personality. By evaluating 14 models on 14,760 variants of the Python HumanEval dataset, we demonstrate that coding performance and prompt stability are largely decoupled. Our results highlight that scaling model size does not inherently improve robustness, necessitating stability-focused evaluation metrics like the proposed AUC-E.
Introduction
While benchmarks like Pass@k effectively measure a model's peak coding capability, they fail to capture how performance fluctuates when a user's "mood" or "persona" changes. A developer might ask for a function calmly or out of frustration; logically, the task remains the same, but LLMs often produce wildly different results. This "prompt sensitivity" can lead to performance swings of up to 40%, making models unreliable partners in real-world, high-pressure scenarios. This research addresses the lack of systematic quantification for whether a model is a stable partner or one that degrades under stylistic pressure.
Methodology: The PromptSE Framework
The PromptSE (Prompt Sensitivity Evaluation) framework introduces a systematic approach to quantify sensitivity through three core components:
- Emotion-Aware Variant Generation: Using psychologically grounded templates, the framework generates variants across 8 emotional states (e.g., focused, tired, frustrated) and various personality profiles (e.g., junior explorer, senior architect).
- SoftExec (Probability-Aware Scoring): Unlike binary pass/fail metrics, SoftExec incorporates the model’s confidence (log probabilities) to distinguish between robust solutions and lucky guesses.
- AUC-E (Area Under Curve of Elasticity): This metric measures performance degradation as stylistic "perturbation distance" increases. An AUC-E of 1.0 indicates perfect stability.
For closed-source models where internal probabilities are inaccessible, PromptSELight provides an approximation using binary pass rates, maintaining a high correlation (0.72) with the full metric.
Experimental Setup
The study utilized the Python HumanEval benchmark as its foundation. By applying emotion and personality templates, the researchers expanded the original dataset into a collection of 14,760 semantically equivalent prompt variants. The evaluation covered 14 models across three major families: Llama, Qwen, and DeepSeek, ranging from 1.5B to 34B parameters.
Key Insights and Results
Performance and Stability Decoupling
The most significant finding is that a model's raw coding power is almost entirely decoupled from its consistency. There is no significant correlation between how well a model codes and how stable it is. A "genius" model can be highly temperamental, while a "mediocre" model may be rock-solid regardless of phrasing.
Non-Monotonic Scaling
Common wisdom suggests that larger models are more robust. However, the study revealed non-monotonic scaling; for instance, the tiny Qwen-1.5B achieved superior stability (AUC-E 0.646) compared to much larger counterparts. Stability appears to be a distinct property requiring explicit optimization rather than just more parameters.
Emotions as Brittleness Probes
High-arousal, negative-valence prompts (e.g., "stressed" or "frustrated") often induce confidence miscalibration. Models may become overconfident in incorrect answers or lose confidence in correct ones when the prompt sounds anxious.
Model Typology
Models were distributed across a four-quadrant space of performance vs. stability. For example, Qwen2.5-Coder-7b showed elite performance (Pass@1 of 0.820) but relatively lower stability (AUC-E 0.403). Conversely, Python-Code-13b had lower raw performance but much higher stability (AUC-E 0.606).
Conclusion
Prompt stability should be considered a core evaluation dimension alongside performance, fairness, and safety. As AI-assisted development tools become more prevalent, measuring and optimizing for stability is essential for building trustworthy systems. Future research should expand these evaluations to more diverse programming languages and non-English linguistic contexts to further validate these stability trends.
Summary updated