Decoding Data Quality via Synthetic Corruptions: Embedding-guided Pruning of Code Data

Yu Yang, Aaditya K. Singh, Mostafa Elhoushi, Anas Mahmoud, Kushal Tirumala, Fabian Gloeckle, Baptiste Rozière, Carole-Jean Wu, Ari S. Morcos, Newsha ArdalaniarXiv 2023 · DOI

Abstract

Training Large Language Models (LLMs) on massive code datasets often involves significant noise from low-quality or "polluted" data. We introduce SCIP (Synthetic Corruption Informed Pruning), a novel method that leverages the geometric properties of code in embedding space to identify and remove suboptimal training examples. By observing how intentionally corrupted code migrates toward smaller clusters and away from centroids, we develop a pruning strategy that improves performance on benchmarks like HumanEval by up to 3% while enhancing training efficiency.

Introduction

The performance of LLMs is heavily dependent on data quality. While datasets like The Stack provide trillions of tokens, they are often riddled with syntax errors, incomplete logic, and boilerplate code. Current quality control methods—such as deduplication or expensive model-based filtering—either fail to address semantic quality or are computationally prohibitive. SCIP offers an efficient, open-source alternative by using pre-trained embedding spaces to detect "outlier-ness" as a proxy for low quality.

Methodology: Synthetic Corruption Informed Pruning (SCIP)

SCIP operates on a simple yet powerful insight: "bad" code looks different to an encoder than "good" code. The framework consists of three primary stages:

  1. Synthetic Corruption: Clean code samples are intentionally modified with syntax errors (e.g., removing brackets) and logic errors (e.g., flipping operators).
  2. Mapping and Insight: By passing original and corrupted versions through a pre-trained encoder (StarEncoder), researchers found that corrupted data consistently moves toward smaller, more isolated clusters or further from the center of its original cluster.
  3. Pruning: The entire dataset is clustered, and files residing in the smallest clusters or those furthest from centroids are pruned as low-quality noise.
The SCIP framework: from synthetic corruption to embedding-guided pruning and model fine-tuning.

Key Insights and Empirical Evidence

A critical finding of this work is the sensitivity of embedding spaces to different types of errors. The embedding space is notably more sensitive to structural/syntax errors than deep logical inconsistencies. This suggests that current code encoders primarily capture the "shape" of code rather than deep semantics.

Empirical analysis of the embedding shifts confirms the SCIP hypothesis. As shown in the distributions below, synthetic corruptions like removing brackets or renaming variables lead to measurable decreases in cluster size and similarity to centroids, providing a clear signal for pruning.

Distribution of changes in cluster size and similarity across different synthetic corruption types.

Results and Performance

Fine-tuning a 1.5B LLaMA model on a Python subset of The Stack v1.1 demonstrated the effectiveness of SCIP:

  • HumanEval: The "Combined" pruning method (targeting both small clusters and far-from-centroid points) achieved 28.0% Pass@1, a 3% absolute improvement over the "No Pruning" baseline (25.0%).
  • MBPP: The "Small Clusters" pruning method achieved 35.0% Pass@1, outperforming the baseline (33.4%).
  • Efficiency: Models trained on 20% less data (the pruned set) reached baseline performance levels much earlier in the training cycle, representing a major gain in compute efficiency and energy savings.

Conclusion and Future Work

SCIP demonstrates that "less is more" when the remaining data is of higher quality. By using synthetic corruptions to probe embedding spaces, we can identify high-noise data without the need for expensive human or LLM labeling. Future research will explore extending these corruptions to natural language and refining encoders to be more sensitive to logical errors, potentially further narrowing the gap between synthetic and semantic quality assessment.

Summary updated

BibTeX
@misc{yang2023decoding,
  author = {Yu Yang and Aaditya K. Singh and Mostafa Elhoushi and Anas Mahmoud and Kushal Tirumala and Fabian Gloeckle and Baptiste Rozière and Carole-Jean Wu and Ari S. Morcos and Newsha Ardalani},
  title = {{Decoding Data Quality via Synthetic Corruptions: Embedding-guided Pruning of Code Data}},
  year = {2023},
  eprint = {2312.02418},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.02418},
}
Figure