Abstract
Fine-tuning Large Language Models for code (Code LLMs) typically requires vast amounts of synthetic data, leading to significant computational overhead and potential noise in training. This paper introduces CodeACT, a framework designed to enhance data efficiency and training speed. CodeACT employs Complexity and Diversity Aware Sampling (CDAS) to select a high-quality 40% subset of training data and a Dynamic Pack method to optimize GPU utilization. Experimental results demonstrate that CodeACT-DeepSeek-Coder-6.7B achieves a 67.1% Pass@1 on HumanEval—an 8.6% absolute improvement over the full-dataset baseline—while reducing training time by 78% and memory usage by 27%.
Introduction
The rapid advancement of open-source Code LLMs has narrowed the gap with proprietary models like GPT-4. However, the prevailing paradigm of fine-tuning on massive synthetic datasets, such as EVOL-Instruct, faces two primary challenges. First, data quality is often inconsistent; large datasets frequently contain redundant or overly simplistic examples that do not contribute to complex reasoning capabilities. Second, standard training procedures suffer from computational waste due to sequence padding, where GPUs process empty tokens to maintain uniform batch dimensions.
Methodology: The CodeACT Framework
CodeACT addresses these challenges through a dual-pronged approach focusing on data selection and computational efficiency.
Complexity and Diversity Aware Sampling (CDAS)
Rather than utilizing the entire available dataset, CDAS identifies a high-impact subset (optimized at 40% in this study). The selection process is governed by two criteria:
- Instruction-Following Difficulty (IFD): This metric quantifies complexity by comparing the model's perplexity when generating a response given a prompt ($PPL(a|q)$) against its perplexity when generating the response in isolation ($PPL(a)$). A higher IFD score indicates that the instruction significantly aids the model in generating the correct response, marking it as a valuable "difficult" sample.
- Diversity Preservation: To avoid overfitting to a narrow set of difficult problems, CodeACT uses K-Means clustering on instruction embeddings. By sampling the top $m\%$ most complex instances from each cluster, the framework ensures the resulting sub-dataset maintains the original data's breadth.
Dynamic Pack Padding
To mitigate the inefficiencies of traditional padding, CodeACT implements "Dynamic Pack." This method sorts sequences by length and packs multiple shorter sequences into a single training instance, minimizing the number of padding tokens. This "Tetris-like" packing significantly reduces the total number of tokens processed, leading to faster training and lower memory consumption.
Experimental Setup
The framework was evaluated using two prominent synthetic code instruction datasets: EVOL-Instruct (80K samples) and OSS-Instruct. Performance was benchmarked on industry-standard Python coding tasks, including HumanEval/HumanEval+ and MBPP/MBPP+, which measure functional correctness via the Pass@1 metric.
Results and Analysis
The application of CodeACT yields substantial improvements in both model performance and training efficiency across various architectures, including CodeLlama (7B, 13B) and DeepSeek-Coder (6.7B).
Performance Gains
A key finding is that performance peaks at a 40% sampling rate. Inclusion of the remaining 60% of data often leads to performance degradation, suggesting that redundant or low-quality samples act as "noise" that hinders the learning of complex reasoning. As shown in the results table, CodeACT-DeepSeek-Coder-6.7B reached 67.1% on HumanEval, outperforming the baseline (58.5%) and even rivaling larger models like Gemini-Pro-1.0.
Efficiency Improvements
The computational benefits are equally significant. For the DeepSeek-Coder-6.7B model, training time was slashed from 297 minutes to just 68 minutes—a 78% reduction. Peak GPU memory usage also decreased by 27%, dropping from approximately 51GB to 37GB. This efficiency makes high-quality fine-tuning more accessible on mid-tier hardware.
Conclusion and Future Work
CodeACT demonstrates that strategic data selection and optimized token packing can produce superior Code LLMs with a fraction of the data and compute. While highly effective for 7B-13B models, future research should explore the scalability of this approach to larger architectures. Additionally, incorporating automated correctness checks (e.g., unit tests) into the CDAS pipeline could further refine data quality by ensuring that complex samples are also functionally accurate.
Summary updated