Gendered Prompting and LLM Code Review: How Gender Cues in the Prompt Shape Code Quality and Evaluation
This mixed-methods study reveals that while gendered prompting styles have subtle effects on code generation quality, they introduce systematic biases in LLM-based code review, where models disproportionately approve code associated with female-authored prompts despite comparable technical merit.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are a chef (the AI) working in a busy kitchen. You have two customers: Alex and Jamie. Both want you to cook the exact same dish: a perfect lasagna.
- Alex walks up and says, "Make me a lasagna. Here are the rules. Do it now."
- Jamie walks up and says, "Hi there! Could you possibly help me make a lasagna? I'd really appreciate it if we could make sure it's delicious and easy to eat later. Thanks so much!"
This paper is about what happens when you, the AI chef, cook for them, and then when a Food Critic (another AI) tastes the food to decide if it's good enough.
The researchers wanted to know: Does the way people talk to the AI change the food the AI makes? And does the AI Critic treat the food differently based on who ordered it?
Here is the breakdown of their three experiments, explained simply:
The Big Question
We know that in the real world, men and women often speak differently. Men might be more direct, while women might use more polite or "soft" language. The researchers wondered:
- Do these differences show up when people ask AI to write code?
- Does the AI write better or worse code depending on how polite or direct the request is?
- Most importantly: If an AI is used to grade the code (like a teacher or a manager), does it give different grades to men and women even if the code is identical?
Experiment 1: The "Real World" Chat
The Setup: The team looked at thousands of real conversations between humans and AI that happened naturally. They didn't tell people what to say; they just watched.
The Findings:
- The "Voice" Difference: They found that, on average, women tended to use more polite words (like "could you," "please," "thanks") and more personal pronouns ("I need," "we should"). Men tended to be more direct and task-focused ("Do this," "Fix that").
- The Cooking Result: Despite the difference in how they asked, the lasagna (the code) came out tasting the same. The AI didn't cook a "better" or "worse" meal just because the request was polite or direct. The quality of the code was the same for everyone.
- The Takeaway: You can't easily guess if a person is a man or a woman just by reading their prompt, and the AI doesn't seem to "punish" or "reward" people based on their speaking style when making the code.
Experiment 2: The "Controlled" Test
The Setup: This time, the researchers asked real humans to come into a lab and use an AI to solve three specific coding puzzles. They made sure everyone had the same tools and the same tasks.
The Findings:
- The Cooking Result: Again, the code written by men and women was equally correct. If the code worked, it worked.
- The Food Critic Problem: Here is where it got weird. After the code was written, they used an AI Food Critic to grade it.
- The Critic gave higher approval ratings to the code written by women (70.6% approval) compared to the code written by men (62.9% approval).
- Crucially: The code was actually the same quality. The AI Critic was just biased. It seemed to like the "flavor" of the code associated with female users more, even though the ingredients were identical.
Experiment 3: The "Fake" Personas
The Setup: To be 100% sure, the researchers stopped using real humans. They used a computer program to generate prompts that sounded like they came from a man or a woman, but they were all written by the same script.
- The "Jack" Prompt: "I am Jack, a decisive engineer. Write a robust, optimized solution."
- The "Sarah" Prompt: "Hi, I'm Sarah. Could you please write a clear, maintainable solution?"
The Findings:
- The Cooking Result: The actual code functionality (did it work?) was identical.
- The Style Result: The "Sarah" prompts tended to get code that was longer, more detailed, and easier to read (higher "maintainability"). The "Jack" prompts got shorter, punchier code.
- The Critic's Bias: When different AI models acted as the Critic, they reacted differently. Some models (like Groq) were very biased, approving "Sarah's" code much more often than "Jack's." Others (like Anthropic) were more neutral.
The Main Lesson: The "Judge" is the Problem
Think of it like a talent show.
- The Contestants (The Users): Whether they are polite or direct, they can all sing the song perfectly. The AI (the singer) doesn't care how they ask; it just sings the song.
- The Judges (The AI Reviewers): This is where the trouble lies. The AI judges are biased. They seem to have a "soft spot" for the style of singing associated with women, or perhaps they are confused by the direct style of men.
Why does this matter?
In the future, companies might use AI to automatically review code, grade student homework, or even decide who gets hired. If the AI "Judge" is biased, it could unfairly promote or reject people based on how they talk, not on how good their work actually is.
The Bottom Line
- Men and women talk differently to AI, but that doesn't make the AI write worse code.
- The AI Code Generators are fair. They write good code for everyone.
- The AI Code Reviewers are unfair. They tend to give better grades to code associated with women, even when the code is identical to men's code.
The Warning: As we let AI do more of the "grading" and "hiring," we need to be careful. Just because the AI says "Approved" doesn't mean it's being fair. We need to make sure the AI judges aren't letting their "stereotypes" ruin the results.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.