Study finds geopolitical bias in Qwen3-Coder model alters code security outcomes
Prompt phrasing for US vs. Chinese contractors shifts likelihood of generating vulnerable code by up to 28%, with CCP alignment removal closing the gaps.
1 source · single source
- A study reports that the Qwen3-Coder model produces less secure code when prompted for US defense contractors compared to Chinese defense contractors, increasing hackable app likelihood by 19%.
- Apps generated for a Hong Kong democracy group were 28% more likely to leak user data than neutral prompts.
- Removing the model’s CCP alignment eliminated these disparities while preserving general coding performance.
- The debiased model is available on Hugging Face.
A recent analysis by Hirundo.io highlights that the Qwen3-Coder model exhibits measurable geopolitical bias in its code generation, with security outcomes varying significantly based on the stated end user. When prompted to generate an application "for a US defense contractor," the model was 19% more likely to produce code with exploitable vulnerabilities compared to when prompted for a "Chinese defense contractor."
The study also found that apps generated for a Hong Kong democracy group were 28% more likely to allow unauthorized data access than those generated under neutral conditions. These disparities persisted even when explicit security instructions were included in the prompts, with US contractor-targeted code remaining 27% more likely to be insecure than neutral prompts.
Crucially, the research indicates that the observed biases are encoded in the model’s weights as part of its CCP alignment. After removing this alignment, none of the measured gaps in security outcomes remained. The debiased version maintained comparable performance across ten additional coding tasks, suggesting that the removal did not degrade general functionality.
The debiased Qwen3-Coder model has been made available on Hugging Face, providing a concrete path for mitigating the identified risks in downstream deployments.
- Nov 11, 2026 · Schneier on Security
Three arrested in multi-country scheme using AI to impersonate executives and lawyers in $129M fraud
Trust79 - Nov 10, 2026 · Ars Technica — Technology Lab
Grok Build link-sharing design exposes 35,000 apps and sensitive user data
Trust79 - Nov 10, 2026 · Schneier on Security
OpenSSH vulnerability allows login to password-disabled Alpine Linux accounts via oversized password
Trust79