Empirical Study on the Effects of Training Data Optimization for LLM-based Code Generation
An empirical analysis of five training data optimization techniques for code generation LLMs, finding data synthesis most effective for accuracy but detrimental to maintainability.
This study empirically analyzed the individual and combined effects of five training data optimization techniques to improve LLM-based code generation. Data synthesis proved most effective for functional accuracy, while the combination of synthesis and refactoring achieved optimal overall code quality.
Introduction
When deploying LLM-based code generation tools in enterprise environments, the primary bottleneck is that benchmark performance often fails to translate into production-level code quality (maintainability, readability). Many organizations focus simply on increasing data volume or adopting the latest models, yet there is a lack of quantitative understanding regarding which specific characteristics of training data determine the quality of model output.
This analysis systematically dissects the impact of training data optimization techniques on the functional accuracy and static code quality of models from a Data-centric AI perspective. Specifically, by analyzing the synergies and limitations that arise when techniques with different objectives—such as data synthesis, refactoring, and selection—are combined, this research provides a practical guide for engineers to resolve the conflict between accuracy and maintainability.
Research Findings
To address the training data quality issues determining the performance of LLM-based code generation, this study systematically evaluated five optimization techniques: data augmentation, data cleaning, data selection, data synthesis, and data refactoring. Using three benchmarks (APPS, CodeContests, MBPP) and four LLM models (including Qwen2.5-Coder and Llama-3.2), the researchers conducted an empirical analysis across 72 individual configurations and 120 pairwise combinations.
The results indicate that data synthesis showed overwhelming performance in functional accuracy, recording average relative improvements in Pass@1 of 60.80% (APPS), 74.06% (CodeContests), and 12.20% (MBPP). Conversely, regarding the Maintainability Index, data refactoring, cleaning, and selection techniques had positive effects, whereas data synthesis and augmentation tended to hinder maintainability by increasing code complexity. Furthermore, while combined techniques offered limited additional gains in functional accuracy, the combination of data synthesis and refactoring (Syn+Ref) demonstrated the strongest synergy, simultaneously optimizing two key metrics: the reduction of code smells and the assurance of accuracy.
Executive Key Takeaways
- 1 1. [Dominant Effect of Data Synthesis] Data synthesis contributes most to functional accuracy and code smell reduction, but it tends to hinder maintainability by increasing code complexity.
- 2 2. [Trade-off Between Quality Metrics] Enterprise AI leaders should not pursue accuracy (Pass@1) alone; they must design data pipelines that achieve the optimal balance between maintainability (MI) and accuracy based on the service objective.
- 3 3. [Limitations of Optimal Combinations] What are the next-generation data refinement algorithms that can maintain the benefits of data synthesis while simultaneously resolving the issue of increased code complexity?
Does the combination of data optimization techniques lead to actual code quality improvement?
First, a clear trade-off exists between functional accuracy and code maintainability. Data synthesis drastically increases functional accuracy, such as Pass@1, by transferring knowledge from high-performance models; however, according to the analysis (Table 2 of the source paper), it resulted in a decrease in the Maintainability Index (MI). This occurs because the model learns to generate longer, more complex code to achieve the correct answer, which becomes a risk factor that increases technical debt in production environments over the long term.
Second, simple overlapping of optimization techniques does not guarantee a linear increase in performance. Testing 10 pairwise combinations revealed that most converged to the results of the best-performing individual technique or slightly declined. Notably, when data cleaning and data selection were applied simultaneously, a side effect was observed where code smells increased due to excessive loss of data diversity. This is analyzed as a result of over-filtering, which excessively compresses the model’s learning space and reduces flexibility.
Third, code-specialized LLMs respond far more sensitively to changes in data quality. Analysis of the results (see Tables 3 and 5) shows that specialized models like Qwen2.5-Coder experienced greater performance gains than general-purpose models like Llama-3.2 during data optimization, but simultaneously suffered greater performance drops during data degradation. This implies that specialized models rely more heavily on detailed code patterns and suggests that the model’s potential cannot be fully realized without sophisticated data curation.
An increase in functional accuracy metrics like Pass@1 does not necessarily signify the generation of ‘good code’. While data synthesis techniques dramatically increase accuracy, they simultaneously tend to increase code complexity and lower the Maintainability Index (MI).
From an engineering perspective, this means there is a risk of the model generating ‘spaghetti code’—code that is correct but unmaintainable. Therefore, maintainability metrics must be monitored alongside accuracy metrics to ensure that short-term benchmark achievements do not translate into long-term technical debt.
Impact and Correlation Analysis by Data Optimization Technique
Experimental results (Table 2 of the source paper) show that the impact of the five data optimization techniques on functional accuracy and static code quality diverges clearly based on the objective of the technique. The five analyzed techniques—Data Augmentation, Data Cleaning, Data Selection, Data Synthesis, and Data Refactoring—influence model output through distinct optimization mechanisms.
First, in terms of functional accuracy, data synthesis proved overwhelmingly efficient. It recorded high average relative improvements in Pass@1: 60.80% for APPS, 74.06% for CodeContests, and 12.20% for MBPP, and showed the most consistent increase in AvgPassRatio, which measures partial correctness. This is attributed to the transfer of high-quality ground-truth signals from high-performance closed models like Gemini-2.0-flash to smaller open-source models. In contrast, data augmentation showed relatively low utility, with Pass@1 improvements ranging only from 0.26% to 9.59%.
Second, analysis of the Code Smell Score (CSS), which measures static code quality, showed that most optimization techniques contributed to reducing code defects. Data synthesis, selection, and augmentation showed the most consistent improvements, with data synthesis leading an average CSS improvement of 39.92%. This is because synthetic data provides standardized coding styles and well-structured solutions, inducing the model to learn refined programming patterns.
Third, conflicting results were observed in the Maintainability Index (MI). Data refactoring, cleaning, and selection improved MI by an average of 2.73% to 8.12% by standardizing code structure and removing redundancy. However, data synthesis and augmentation had a negative impact, decreasing MI by 4.19% to 5.05%. This indicates that code generated to increase accuracy became excessively long (increased LOC) or included complex logic structures, thereby reducing maintenance efficiency.
Consequently, data optimization must be a process of finding the optimal balance between conflicting metrics rather than maximizing a single indicator. While the dramatic accuracy gains provided by data synthesis are attractive, indiscriminate application risks producing high-complexity code that is correct but impossible to modify or manage. This suggests a typical failure pattern where an obsession with benchmark figures leads to the neglect of technical debt in actual production environments.
Synergy Mechanism of the Optimal Combination (Syn+Ref)
Analysis of the experimental results (Table 4 of the source paper) shows that among 10 pairwise combinations, the ‘Syn+Ref’ combination—combining Data Synthesis and Data Refactoring—recorded the best integrated performance. Specifically, in Pass@1 metrics for APPS and MBPP benchmarks, it outperformed data synthesis alone, achieving average relative improvements of 36.82% for Pass@1 and 18.15% for AvgPassRatio. This suggests a complementary interaction between different optimization mechanisms rather than simple overlapping.
The first synergy mechanism is the ‘combination of high-performance knowledge transfer and structural standardization’. Data synthesis drastically increases functional accuracy by training the model on correct solutions and consistent styles from high-performance teacher models like Gemini-2.0-flash. However, as code tends to become longer or more complex during this process, data refactoring intervenes to enforce structural clarity and standardization without semantic changes. As a result, the model simultaneously acquires the logical ability to derive the correct answer and the expressive ability to output it in a refined form.
The second synergy mechanism is the ‘maximization of static code quality’. According to the analysis, the Syn+Ref combination showed the strongest improvement effect in Code Smell Score (CSS) across all benchmarks, recording a maximum average relative improvement of 63.27%. By adding the standard-compliance capability of refactoring to the accurate solution patterns provided by data synthesis, the results achieved a drastic reduction in code smells while maintaining functional accuracy. This is evaluated as an effective resolution to the ‘conflict between accuracy and static quality’ that individual techniques could not solve.
Conversely, opposite side effects were observed in the combination of Data Cleaning and Data Selection (Cle+Sel). Both techniques share a similar filtering-based optimization mechanism; overlapping them led to an excessive loss of data diversity, which actually increased code smells. This warns that indiscriminately combining techniques with similar objectives can excessively compress the model’s learning space, reduce flexibility, and ultimately cause the model to repeatedly generate only formalized patterns.
In conclusion, the success of the Syn+Ref combination proves the importance of strategically combining techniques with different optimization layers. While data synthesis enriches the ‘content’ of the answer, refactoring optimizes the ‘vessel’ that holds that content. This complementary relationship raises the model’s performance ceiling far more efficiently than simply increasing data volume or strict pruning, providing a practical path to achieving the two core enterprise goals: ‘accurate and clean code’.
Correlation Between Modification Magnitude and Model Performance
To identify the mechanism by which improvements in training data quality transfer to model performance, researchers introduced the Fréchet Inception Distance (FID) metric to quantify the Modification Magnitude induced by optimization techniques. FID measures the distributional divergence between the original and optimized datasets; a larger value indicates greater changes in style, structure, and semantics. Experimental results (Table 6 of the source paper) show that data synthesis recorded the highest FID values across all benchmarks, exhibiting the most extensive modification magnitude, followed by data selection and data refactoring.
The first analysis result is that this modification magnitude is directly proportional to the improvement in functional accuracy. According to the analysis (Figure 2 of the source paper), techniques that applied substantial and large-scale changes to the original dataset, such as data synthesis, resulted in a much larger Uniquely Solved Set of problems the model could resolve. In contrast, techniques with small modification magnitudes, such as data cleaning or data augmentation, had minimal impact on model performance. This suggests that it is difficult to drastically improve a model’s reasoning capability simply by removing some low-quality data or applying simple transformation rules.
Second, it was observed that when techniques were combined, the technique with the larger modification magnitude dominated the overall performance and the characteristics of the generated code. Analysis (Table 7 of the source paper) shows that the structural and stylistic characteristics of code generated by combined techniques were strongly biased toward the technique with the higher FID value, particularly data synthesis or data selection. This means that data with large-scale modifications exerts a stronger influence as a learning signal and can offset or overwhelm the detailed effects of other techniques during the combination process.
Third, the actual effect of combined techniques showed a very high positive correlation with the size of the Union Set—the union of problems solved by each constituent technique. Statistical analysis (Table 8 of the source paper) yielded a statistically significant Pearson Correlation Coefficient between the size of the Union Set and the actual solved set size of the combined technique across all benchmarks. Functional accuracy was maximized specifically when combining techniques with heterogeneous mechanisms to expand the Union Set.
Consequently, high-impact optimization strategies capable of boldly altering the distribution of the original data are essential for increasing LLM-based code generation performance. However, as confirmed in the analysis (Table 9 of the source paper), the fact that actual combination performance remains at 60% to 85% of the theoretical upper bound (the Union Set) is noteworthy. This indicates that current simple sequential combination methods fail to fully integrate the potential performance of each technique, signaling the need for more sophisticated data pipeline designs.
Model Training and Evaluation Settings
To precisely verify the effects of data optimization techniques, the researchers designed a systematic model training and evaluation workflow. The process consists of a phase for constructing optimized datasets, a Supervised Fine-Tuning (SFT) phase for training the model based on those datasets, and an evaluation phase to measure the final model’s performance. To ensure reliability, identical hyperparameter settings were applied to all models, clarifying that observed performance differences stemmed from training data quality rather than model configuration.
Specific settings applied during the Supervised Fine-Tuning process are as follows. First, the learning rate was set to , using the AdamW Optimizer with a weight decay of 0.01. Second, to ensure convergence, all models were trained for 10 epochs. Third, the maximum token length was limited to 1,024, and the total batch size was maintained at 64 to ensure training consistency.
To determine the optimal model state, monitoring was performed using a validation split during the training process. A strategy was adopted to select the checkpoint with the highest validation performance as the final model. These strict control variables were essential measures to quantitatively analyze the causal relationship between the independent variable (data optimization) and the dependent variables (functional accuracy and code quality).
Regarding infrastructure, computations were performed using four NVIDIA H800 GPUs with 80GB memory each in an Ubuntu 20.04 OS environment. For the data synthesis technique, the Gemini-2.0-flash model was utilized as a generator to create high-quality supervisory signals. Without this control of hyperparameters, there would be a risk of misattributing data optimization effects to accidental combinations of training settings, which could lead to flawed data strategies and a waste of massive computing resources.
Evaluation Metric Calculation Formulas
To quantitatively measure the static quality of LLM-generated code, the researchers introduced multi-faceted evaluation metrics beyond simple execution results. The first key metric is the Code Smell Score (CSS), which quantifies potential defects and design issues in the code using static analysis tools like Pylint. The CSS formula is designed to subtract the weighted sum of errors (), warnings (), refactoring suggestions (), and convention violations () relative to the total number of statements () from 10. Specifically, the highest weight () is assigned to errors, while other items receive a weight of 1.0, with a function applied to ensure the final score does not drop below 0. This is an attempt to quantify the risk of design improprieties being transferred from the training data to the model, in addition to simple syntax errors.
The second key metric is the Maintainability Index (MI), which evaluates the ease of software maintenance as a single value. MI is calculated by integrating three software engineering metrics: Halstead Volume (HV), representing lexical complexity; Cyclomatic Complexity (CC), measuring the number of logical paths; and Lines of Code (LOC). The formula subtracts the values of , , and —each multiplied by specific weights ()—from 171, then divides the result by 171 and multiplies by 100. The final value is normalized between 0 and 100, where a higher score indicates more concise, maintainable code.
This approach to metric setting is crucial in revealing the ‘traps’ of LLM-based code generation. If functional accuracy (Pass@1) is high but the MI score is low, it suggests the model has learned ‘overfitted solutions’—generating excessively complex or unnecessarily long code to reach the correct answer. Specifically, the analysis showed that data synthesis techniques tended to increase accuracy at the expense of MI, warning that without verification through static metrics, serious technical debt could be incurred in practical environments.
Consequently, the two axes of CSS and MI serve as rigorous criteria for determining whether model-generated code is not only ‘functional’ but also ‘sustainable’. This method of differential weighting for error severity and enforcing conciseness through complexity metrics represents the minimum quality control mechanism required for enterprise-grade AI systems.
LLM Code Generation Data Pipeline Design Checklist
- Clarification of Optimization Objectives: Has the balance between synthesis and refactoring techniques been determined based on whether functional correctness or maintainability is the priority?
- Preservation of Data Diversity: When overlapping data cleaning and selection techniques, has it been ensured that excessive filtering does not make the data distribution too uniform, thereby hindering the model’s generalization performance?
- Combination of Complementary Techniques: Rather than overlapping techniques with similar goals, have techniques with complementary mechanisms—such as data synthesis (for accuracy) and data refactoring (for structural standardization)—been combined?
- Curation by Model Characteristics: Has it been verified whether the model used is code-specialized or general-purpose, and has a validation strategy been established that reflects the performance sensitivity to data quality changes for specialized models?
Strategic Recommendations for Building Enterprise Code Generation Systems
The core of this research is that data optimization is not simply about ‘more refining’, but a matter of ‘strategic selection aligned with objectives’. Specifically, the trade-off between accuracy gains from data synthesis and the resulting decline in maintainability is a critical issue in actual corporate settings. Organizations with strict internal standard guidelines should place higher weight on refactoring and selection techniques than on data synthesis.
Furthermore, the finding that the ‘Data Synthesis + Refactoring’ combination showed optimal performance is highly significant. This demonstrates that a pipeline that first generates ground-truth answers via a high-performance model (Synthesis) and then structures them according to internal corporate coding standards (Refactoring) is the most realistic alternative. However, considering that this research focused on function-level generation, further verification is needed to determine if the same correlation holds when scaled to large-scale codebases at the project level.
Principles for Building Data-Centric Code Generation Models
The actual utility of a model is determined by the quality of training data over quantity, and the alignment of purpose over quality.
- Purpose-Based Optimization Principle: Establish priorities between functional accuracy and static quality metrics, and select the corresponding optimization technique (Synthesis vs. Refactoring).
- Complementary Pipeline Construction Principle: Rather than maximizing a single technique, combine techniques with different mechanisms to achieve a balance between accuracy and quality.
- Metric Diversification Principle: Include the Maintainability Index (MI) and Code Smell Score (CSS) as essential evaluation items alongside execution results like Pass@1 to quantitatively manage technical debt.
Further reading
- Hidden Technical Debt in Machine Learning Systems
- Analysis of AI-Driven Workflow Restructuring and Employment Shifts at Anthropic
- Disrupting AI-enabled “false front” operations
References and Original Analysis Materials
On the Effectiveness of Training Data Optimization for LLM-based Code Generation: An Empirical Study
Authors: Shiqi Kuang, Zhao Tian, Tao Xiao, Dong Wang, Junjie Chen
This research briefing was written from the source paper with the help of AI tools (AI Research Agent · MLOps, AI Research Agent · Strategy). Reviewed by Jay PARK, who is responsible for it.
Read more

Papers & Reports ·
Working with AI: AI Adoption Strategies and Organizational Restructuring Based on Anthropic Enterprise Customer Interviews

Papers & Reports ·
How to Outcompete Your Client's AI

Papers & Reports ·
Risks of Governance Absence: Lessons from AI Adoption at the U.S. Small Business Administration (SBA)

Papers & Reports ·
Data and Methods for Identifying Artificial Intelligence-Related Patents