arXiv:2609.03156cs.SESep 2026

Manuscript Offprint

arXiv:2609.03156

Compound Prompt Constraints in LLM Code Generation: A Factorial Study of Format, Persona, and Urgency

Shrenik Jadhav, Nickalsa LaPlaca, Caleb Stone, Ashok Raja, Omar Ochoa, Vidhyashree Nagaraju

Shrenik Jadhav

Doctoral Student

Department of EECS

Embry-Riddle Aeronautical University

Daytona Beach, FL, USA

jadhavs2@my.erau.edu

Nickalas La Placa

Undergraduate Research Assistant

Department of EECS

Embry-Riddle Aeronautical University

Daytona Beach, FL, USA

laplacan@my.erau.edu

Caleb Stone

Graduate Research Assistant

Department of EECS

Embry-Riddle Aeronautical University

Daytona Beach, FL, USA

stonec16@my.erau.edu

Ashok Raja

Assistant Professor

Computer Information Technology and Graphics

Purdue University Northwest

Hammond, IN, USA

raja22@pnw.edu

Omar Ochoa

Associate Professor

Department of EECS

Embry-Riddle Aeronautical University

Daytona Beach, FL, USA

ochoao@erau.edu

Vidhyashree Nagaraju

Assistant Professor

Department of EECS

Embry-Riddle Aeronautical University

Daytona Beach, FL, USA

Vidhyashree.Nagaraju@erau.edu

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 the request with urgency or quality language reflecting real-world deployment pressures. Prior work has studied each of these prompt-level interventions in isolation, but the interaction between them remains uncharacterized, leaving open whether single-factor evaluations can predict the behavior of the compound prompts that real systems actually issue. To address this gap, this paper presents a full-factorial empirical study of how output formatting, persona assignment, and urgency framing jointly affect the reliability of LLM code generation. Rather than evaluating each constraint separately, the framework manipulates all three factors simultaneously in a controlled 3×3×33 \times 3 \times 3 design and decomposes each compound condition into an additive prediction and a residual interaction term that quantifies super-additive degradation.

The framework is evaluated on the 164 problems of HumanEval+ across five OpenAI models spanning the GPT-4o family, the GPT-4.1 family, and the o3-mini reasoning model, yielding 22,140 individual evaluations under greedy decoding. A format-aware code extraction pipeline with multi-strategy fallback separates formatting failures from reasoning failures, and statistical significance is assessed using McNemar's test on per-problem outcomes with odds ratios and 95% confidence intervals. The results show that compound prompt constraints produce architecture-dependent degradation that cannot be predicted from single-factor experiments. The GPT-4o family exhibits a consistent super-additive pattern in which compound constraints reduce pass@1 by 3 to 12 percentage points beyond what the sum of individual effects would predict, with the largest interaction reaching -12.2 pp on GPT-4o-mini for a JSON plus expert persona plus moderate urgency combination, and JSON-based combinations producing substantially larger interaction effects than XML-based combinations. In contrast, the GPT-4.1 family resists the effect at both parameter scales, and the o3-mini reasoning model exhibits a qualitatively different pattern in which structured output constraints improve rather than degrade performance. These findings indicate that the vulnerability is architecture-dependent rather than size-dependent, that individually neutral or beneficial constraints can combine to produce large degradation invisible to single-factor evaluation, and that compound-prompt testing should be a standard part of reliability assessment for LLM-assisted engineering pipelines.

Index Terms—large language models, prompt engineering, code generation, reliability evaluation, factorial experiment

I. INTRODUCTION

Large Language Models (LLMs) have rapidly become a core component of modern software engineering practice. Beyond software engineering, LLMs are also being integrated into other engineering domains as decision-support and control components, including fairness-aware reward shaping in multi-agent reinforcement learning for peer-to-peer energy markets [1], [2] and explainable reinforcement learning for voltage control in power distribution networks [3]. As LLMs take on increasingly consequential roles across these domains, understanding how prompt construction affects output reliability becomes a cross-cutting concern. Tools built on models such as the GPT-4 family now assist developers with code completion, function synthesis, test generation, refactoring, and bug localization, and recent surveys document hundreds of studies applying LLMs across nearly every phase of the software lifecycle [4], [5]. Their appeal lies in a deceptively simple interface: a developer writes a natural language prompt and receives executable code in return. Behind this interface, however, the mapping from prompt to output is highly sensitive to how the request is phrased, and small changes in wording, structure, or framing can produce measurable shifts in correctness.

A growing body of work shows that prompt design is not a cosmetic concern but a first-order determinant of LLM behavior. Three categories of prompt-level interventions have received particular attention. First, structured output constraints such as JSON or XML schemas are routinely imposed so that downstream pipelines can parse model responses programmatically, yet recent work reports that requiring strict output formats can measurably degrade reasoning quality on the underlying task [6]. Second, persona or role assignment via the system message is widely used to specialize model behavior, with mixed evidence on whether expert personas reliably improve task performance [7], [8]. Third, urgency and emotional framing has been shown to shift LLM outputs in measurable ways, sometimes improving accuracy on benchmark tasks [9]. Each of these interventions corresponds to a common deployment pattern. Production prompts in code generation pipelines routinely combine a structured output schema, a role specification, and a quality or urgency framing in a single request, yet they are almost never studied in combination.

Despite the practical relevance of compound prompts, the published literature has overwhelmingly evaluated these factors one at a time. Studies of structured output [6], persona assignment [7], [8], and urgency framing [9] each report effects in isolation, but do not characterize what happens when all three are imposed simultaneously. This leaves a concrete methodological gap. If the individual effects were additive, single-factor results would be sufficient to predict compound behavior. If they are not additive, single-factor evaluation is systematically misleading for the prompts that real systems actually issue, and any reliability claim derived from such evaluations may not transfer to deployment. The gap is not only quantitative but also architectural: it is unknown whether sensitivity to compound constraints is a property of model size, training procedure, or model family, which has direct implications for how practitioners should select models for constraint-heavy pipelines. In deployed software systems where LLM outputs feed automated test suites, code review tools, or production refactoring workflows, an unmodeled interaction between routine prompt elements becomes a latent reliability risk, since failures appear only under the combined conditions that real production prompts actually issue.

To address this gap, this paper presents a full-factorial empirical study of how three categories of prompt constraints jointly affect the reliability of LLM code generation. Rather than evaluating output formatting, persona assignment, and urgency framing in isolation, the study manipulates all three factors simultaneously in a controlled 3×3×33 \times 3 \times 3 design and measures how their interaction shapes per-problem pass rates across multiple model families. This design enables direct quantification of compound effects that cannot be recovered from single-factor experiments, and isolates whether observed degradation is driven by individual constraints, by their interaction, or by underlying model architecture. The framework is intended to support component-level reliability assessment of LLM-assisted code generation pipelines, where production prompts routinely combine structured output schemas, role specifications, and quality or urgency framing in a single request. The main contributions of this paper are as follows.

  • We introduce a 3×3×33 \times 3 \times 3 full-factorial experimental framework that varies output format, persona, and urgency framing across the 164 problems of HumanEval+ [10], [11] and five OpenAI models spanning the GPT-4o family, the GPT-4.1 family, and the o3-mini reasoning model, yielding 22,140 individual evaluations under greedy decoding.

  • We propose an interaction analysis methodology that decomposes each triple-constraint condition into an additive prediction and a residual interaction term, supported by a format-aware code extraction pipeline that separates formatting failures from reasoning failures and by McNemar paired tests with odds ratios and 95% confidence intervals on per-problem outcomes.

  • We empirically identify a super-additive degradation pattern in the GPT-4o family, in which compound constraints reduce HumanEval+ pass@1 by 3 to 12 percentage points beyond what the sum of individual effects would predict, with the largest interaction reaching -12.2 pp on GPT-4o-mini and JSON-based combinations producing substantially larger interaction effects than XML-based combinations.

  • We show that this vulnerability is architecture-dependent rather than size-dependent. The GPT-4.1 family resists the effect at both parameter scales, and the o3-mini reasoning model exhibits a qualitatively different pattern in which structured output constraints improve rather than degrade performance.

  • We demonstrate that single-factor prompt evaluation is insufficient for predicting compound-prompt behavior, since individually neutral or beneficial constraints can combine to produce large degradation that is invisible without factorial testing, with implications for the reliability assessment of LLM-assisted engineering pipelines.

The framework is evaluated across five models on 27 prompt conditions, producing a per-condition pass@1 surface that supports main-effect analysis across factor levels, additive interaction decomposition for all eight triple-constraint combinations, and pairwise McNemar significance testing on per-problem outcomes. Beyond the headline interaction findings, the analysis quantifies how individual constraints can be neutral or even beneficial in isolation while their combination produces large degradation, characterizes the JSON versus XML asymmetry as a practical mitigation lever, and tracks prompt token length as a confound inherent to compound-constraint research. Together, these results indicate that compound-prompt evaluation should be a standard component of reliability assessment for LLM-assisted engineering workflows, and that model selec-tion, not just prompt design, is a critical factor in deployment reliability.

The remainder of this paper is organized as follows. Section II introduces the background on large language models, prompt constraints, and the statistical methods used in the analysis. Section III describes the factorial design, models, benchmark, extraction pipeline, and evaluation procedures. Section IV presents results across all five models, decomposes the three-way interaction, and discusses implications for LLM-assisted software engineering. Section V concludes.