LLM代码生成中复合提示约束的全因子研究:格式、角色与紧迫性的影响
原标题:Compound Prompt Constraints in LLM Code Generation: A Factorial Study of Format, Persona, and Urgency
AI 摘要
该论文对LLM代码生成中的复合提示约束进行了全因子实验研究,考察输出格式、角色设定和紧迫性框架的联合影响。实验在HumanEval+的164个问题上测试了五个OpenAI模型,共22,140次评估,发现复合约束导致的性能下降无法由单因素实验预测,且具有架构依赖性:GPT-4o系列出现超加性退化,而GPT-4.1系列和o3-mini表现不同。研究建议将复合提示测试作为LLM辅助工程可靠性评估的标准部分。
正文节选
Compound Prompt Constraints in LLM Code Generation: A Factorial Study of Format, Persona, and Urgency Abstract Large language models (LLMs) are increasingly deployed in software engineering pipelines for code generation, where production prompts routinely combine multiple constraints in a single request. A typical prompt may require the response to follow a structured output format such as JSON or XML, may assign the model a specific developer persona through the system message, and may frame th