AI
Study maps how flawed training data leads to buggy AI code generation
A systematic review of 114 papers reveals specific pathways linking training-data quality problems to security vulnerabilities and logic errors in code produced by large language models.
Large language models trained to write code frequently produce defective outputs—from logical errors to serious security flaws. While researchers have long recognized that training data quality plays a role in these failures, the connection between particular data-quality problems and the bugs that appear in generated code has remained scattered across the literature and poorly understood.
A new systematic review aims to change that. The analysis synthesizes 114 papers on LLM code generation, establishing clear taxonomies of code-quality issues and training-data defects, then mapping 12 recurring patterns that link the two.
Code quality dimensions mapped#
The review identifies eight dimensions along which generated code can fail: correctness, security, maintainability, readability, efficiency, functionality, completeness, and robustness. Researchers then traced how problems at the data level—such as biased, incomplete, or contaminated training datasets—propagate through to observable failures in each dimension.
Two layers of training-data problems#
The authors categorize training-data issues into two broad groups. The first covers direct data quality challenges: noisy examples, imbalanced datasets, and poisoned or malicious samples. The second addresses structural issues like insufficient diversity, poor documentation, and inadequate code coverage across programming languages and patterns.
Finding the connection#
By synthesizing 12 relationship families between data issues and code outcomes, the review provides evidence linking specific upstream problems to downstream defects. For instance, training data that omits edge cases or security-critical patterns tends to produce models that generate incomplete or vulnerable code. The authors trace each relationship to supporting papers and note the strength and limitations of available evidence.
A three-layer approach to quality#
The findings reposition data curation not as the sole solution, but as one layer within a coordinated quality-assurance strategy. The analysis identifies detection and mitigation techniques spanning three phases: data preparation, model training and optimization, and generation and inference. This means ensuring safe code requires attention at each stage—not just cleaning the training set.

