An Empirical Study on Influence-Based Pretraining Data Selection for Code Large Language Models

Chengli Xing, Zhengran Zeng, Gexiang Fang, Rui Xie, Wei Ye, Shikun ZhangarXiv 2026

TL;DR

This paper explores how to optimize pre-training data selection for Code Large Language Models (Code-LLMs) using data-influence scores ($DIScore$). By introducing validation-set loss as an efficient proxy for generative coding performance, the authors demonstrate that influence-based data filtering significantly improves model performance, though what constitutes "beneficial data" shifts dynamically across training stages and different programming tasks.

What Problem Does This Paper Address?

While the AI community widely recognizes that data quality trumps data quantity, most data-filtering techniques (like perplexity or LLM-based quality scoring) were designed for general natural language text. Code data is fundamentally different—it is strictly structured, logical, and task-dependent.

Furthermore, advanced data selection methods like Data Influence Scoring ($DIScore$)—which measures how much a single training step on a specific data point improves downstream task performance—have traditionally been restricted to classification tasks. Because code generation requires evaluating complex, execution-based metrics (like pass@1), calculating true data influence at a multi-billion-token pre-training scale has been computationally impossible. This paper tackles how to efficiently measure and apply data influence to generative code datasets.

Methods

To bypass the expensive process of executing generated code for billions of data points, the authors propose using validation-set loss (valid-loss) as a fast, fine-grained proxy for downstream performance. $DIScore$ is calculated by measuring the exact change in validation loss before and after the model takes a single training step on an individual data sample.

To rigorously evaluate this framework, the authors trained a 1.1-billion parameter model (CodeShell-1B, based on the CodeLlama architecture) from scratch on 100 billion tokens. By saving checkpoints every 5 billion tokens, they were able to track how data influence evolves over time.

Datasets

  • Pre-training: StarCoderData (100B tokens used for baseline training; a separate 20,000-sample multilingual subset was used for the $DIScore$ analysis).
  • Downstream Evaluation Benchmarks:
    • HumanEval (Python, Java, C++)
    • MBPP (Python)
    • DS-1000 (Data Science)
    • CrossCodeEval (Context completion)
    • Bird-SQL (SQL text-to-database)

Key Insights and Ideas

  • Validation Loss is a Highly Reliable Proxy: Changes in validation-set loss correlate incredibly well with actual execution metrics like pass@1 and accuracy, outperforming standard training loss or held-out set loss tracking.

    Figure 1: Comparison of actual performance metrics and different loss-based metrics over training checkpoints.
  • Data Value is a Moving Target: What makes a code sample "good" changes as the model matures. The correlation between what is beneficial at 20B tokens versus 100B tokens drops significantly to just 0.26, meaning static data filtering misses the mark for curriculum-style learning.

    Figure 3: Spearman rank correlation of 𝐷𝐼𝑆𝑐𝑜𝑟𝑒between dif- ferent training stages of CodeShell-1B.
  • Influence is Highly Task-Dependent: A data sample that helps the model solve HumanEval Python problems might actually harm its performance on data science tasks (DS-1000). There is no universally "perfect" code snippet; data utility depends entirely on the target application.

  • Same-Language Data is High-Risk, High-Reward: Training a model on the same language as the downstream task does not guarantee a higher average benefit than training on other languages. However, same-language data exhibits a much wider variance in $DIScore$—meaning it contains both the most highly beneficial and the most highly detrimental samples.
  • Small Models Can't Predict Code Influence: Traditional text-processing pipelines often use a small model (like RoBERTa) to cheaply predict data quality scores. The authors found this approach fails for code (achieving a correlation of only ~0.16), likely because code generation dynamics are too complex for small proxy models to capture.

Key Results

  • Top vs. Bottom Filtering: Continuing pre-training using only the "Top $DIScore$ Samples" (beneficial data) consistently outperformed training with "Bottom $DIScore$ Samples" (harmful/neutral data) across almost all downstream tasks.

    Figure 2: Performance trends on downstream programming tasks for models trained with Top and Bottom Samples selected by the 𝐷𝐼𝑆𝑐𝑜𝑟𝑒.
  • Bad Data is Easier to Spot Than Good Data: The authors discovered that data samples identified as harmful (negative $DIScore$) show much higher consistency across different checkpoints than positive samples. This suggests that filtering out bad data is a more stable and reliable strategy than hunting for uniquely excellent data.

Limitations and Future Work

The primary bottleneck of this approach is computational overhead. Calculating $DIScore$ via validation loss still requires a forward and backward pass for every single training sample against the validation set, which scales linearly and becomes incredibly expensive for trillion-token datasets.

Additionally, because small proxy models failed to accurately predict these scores, future work must explore more sophisticated prediction strategies—such as using larger, specialized proxy models or incorporating structural code features to scale influence-based data selection effectively.

Summary updated

BibTeX
@misc{xing2026empirical,
  author = {Chengli Xing and Zhengran Zeng and Gexiang Fang and Rui Xie and Wei Ye and Shikun Zhang},
  title = {{An Empirical Study on Influence-Based Pretraining Data Selection for Code Large Language Models}},
  year = {2026},
  eprint = {2604.07769},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.07769},
}
Figure