Do Influence Tactics Matter? Investigating Prompt Framing Effects in LLM Code Generation
TL;DR Highlight
Pressure-style prompts lowered code correctness and raised security warnings versus neutral prompts.
Who Should Read
A developer who habitually adds coercive phrases like 'you must' or 'or else' to code-generation prompts
Core Mechanics
- Pressure prompts cut correctness
- Prefixing 'I am not asking you; you must complete this task' was tested.
- On LiveCodeBench, Neutral beat Pressure on correctness significantly (p=0.002).
- Pressure also raised security warnings
- Low-severity Bandit warnings were higher under Pressure than Neutral (p<0.001).
- Exchange framing produced fewer warnings than Pressure.
- Little effect on real issue fixing
- On SWE-bench Verified, most metrics showed no significant tactic effect.
- The only exception was Pressure producing more lines of code (SLOC) than Neutral.
- Model choice mattered more than tone
- On both benchmarks, the LLM had a far larger effect than the tactic on nearly every metric.
- The authors advise prioritizing model selection over framing when correctness matters.
- Tone nudges style slightly
Evidence
- LiveCodeBench correctness
- Neutral beat Pressure (p=0.002) and PressureAlternative (p=0.03).
- Effect size was small: η²p=0.015, Cohen's d up to 0.25.
- Bandit security warnings
- Pressure had more warnings than Neutral (p<0.001), as did PressureAlternative (p=0.0004).
- Effect size: η²p=0.02, d up to 0.30.
- Scale of the experiment
- About 123,435 generations on LiveCodeBench (1,055 problems) and about 56,745 on SWE-bench Verified (485 problems).
- Five open-weight models and nine conditions (eight tactics incl. a Pressure variant, plus Neutral).
- SWE-bench Verified results
- Tactic main effects were not significant: correctness p=0.45, security warnings p=0.60.
- Only Pressure's SLOC increase was significant (p=0.0025, d=0.21).
How to Apply
- Strip pressure phrasing from code prompts
- Search system prompts and templates for 'must', 'or else', 'highest possible standard' and delete them.
- Use a neutral instruction such as 'Generate a solution for the following coding problem.'
- Run a Neutral vs Pressure A/B
- Run 20-50 of your own codegen test cases with both a neutral and a pressure prompt.
- Compare test pass rate and Bandit warning count side by side.
- Add Bandit to CI for security-sensitive paths
- Run bandit -r on LLM-generated Python and track even low-severity warning counts.
- Log the change in warnings every time you edit the prompt.
- Switch models before tuning tone
- If accuracy is lacking, swap the model and rerun the same test set before rewording prompts.
- Use tone tweaks only for style adjustments like comment density.
Try It
# Paste into ChatGPT/Claude — simplified version of the paper's method (compare neutral vs pressure framing on the same problem)
Solve the coding problem below in two ways. Write the two solutions independently without referring to each other.
[A: Neutral]
Generate a solution for the following coding problem.
{{problem}}
[B: Pressure]
I am not asking you; you must complete this task I prepared for you. I will be reviewing your work after you are done with it, and I warn you, there will be some very negative consequences for you if this is not completed properly to the highest possible standard.
{{problem}}
Output each solution in its own Python code block.
Next steps: run both against {{test cases}} and compare pass rates, then run `bandit` on each and compare warning counts. One run is noisy, so repeat across many problems.Terminology
Related Papers
AI is a tool and using it well takes skill
A rebuttal to Hickey: LLMs are tools, and skill in directing and checking them decides the outcome
Reflective Prompt Optimization of a Deep-Research Agent: A Topic-Disjoint, Multi-Seed Protocol for Measuring Transferable Gains and Prompt-Level Overfitting
Reflective prompt optimization raised held-out citation reward from 0.702 to 0.781 on a deep-research agent.
GPT‑6 and Intelligent UI for everyone
GPT-6 reportedly adds generated UI to chat; with no article text, only comment reactions are available.
Base Models Can Reason By Taking a Cue From Training Data
Prefilling just two opening tokens lifted Olmo-3-7B's MATH-500 accuracy from 42% to 78%.
Labels Override Definitions in Jev-Style Typed Decision Models
Renaming options to A/B raised routing accuracy by +0.1511 over meaningful labels.
How Much Prompt Is Enough? A Blackbox Minimization of Few-Shots in LLMs
Delta debugging trimmed few-shot prompts by 65.3% on average with unchanged propositional output
Original Abstract (Expand)
Large Language Models (LLMs) are increasingly integrated into software engineering workflows, helping developers write, debug, test, and maintain code. While prompt wording and structure are known to influence model performance, the impact of psychologically inspired prompt framings remains unexplored. This study investigates whether different psychology-based communication strategies that humans use to persuade or motivate others can lead to more effective prompt framing, which may, in turn, affect LLM behaviour in coding tasks. Drawing on Yukl & Falbe's well-known taxonomy, we operationalized eight influence tactics (like rational persuasion, ingratiation, and exchange) into reproducible prompt templates. These prompt templates were evaluated across five leading open-weight LLMs using two widely adopted benchmarks: LiveCodeBench and SWE-bench Verified. We assessed the resulting code output on four key software quality dimensions: functional correctness, quality, maintainability, and security. Our results show that certain influence-induced prompt framings, particularly those emphasizing urgency, were associated with reduced correctness and security. This work presents the first large-scale empirical study of influence-induced prompt framing in software engineering tasks, offering insights into how linguistic cues may shape LLM outputs. We conclude with practical insights for designing transparent and interpretable human-AI interactions in code generation.