Skip to main content
QUICK REVIEW

[Paper Review] The Devil is in the Tails: How Long-Tailed Code Distributions Impact Large Language Models

Xin Zhou, Kisub Kim|arXiv (Cornell University)|Sep 7, 2023
Software Engineering ResearchComputer Science3 citations
TL;DR

This paper investigates how long-tailed distributions in software engineering (SE) datasets significantly degrade the performance of large language models (LLMs) for code, particularly on infrequent (tail) labels. It finds that LLMs perform 30.0% to 254.0% worse on tail labels compared to head labels across three SE tasks, highlighting the need for tailored data and model strategies to address this imbalance.

ABSTRACT

Learning-based techniques, especially advanced Large Language Models (LLMs) for code, have gained considerable popularity in various software engineering (SE) tasks. However, most existing works focus on designing better learning-based models and pay less attention to the properties of datasets. Learning-based models, including popular LLMs for code, heavily rely on data, and the data's properties (e.g., data distribution) could significantly affect their behavior. We conducted an exploratory study on the distribution of SE data and found that such data usually follows a skewed distribution (i.e., long-tailed distribution) where a small number of classes have an extensive collection of samples, while a large number of classes have very few samples. We investigate three distinct SE tasks and analyze the impacts of long-tailed distribution on the performance of LLMs for code. Our experimental results reveal that the long-tailed distribution has a substantial impact on the effectiveness of LLMs for code. Specifically, LLMs for code perform between 30.0\% and 254.0\% worse on data samples associated with infrequent labels compared to data samples of frequent labels. Our study provides a better understanding of the effects of long-tailed distributions on popular LLMs for code and insights for the future development of SE automation.

Motivation & Objective

  • To investigate the prevalence and impact of long-tailed distributions in software engineering datasets, particularly in labeled data for code-related tasks.
  • To examine how such skewed data distributions affect the performance of state-of-the-art LLMs for code, especially on infrequent (tail) labels.
  • To evaluate the effectiveness of existing long-tail mitigation techniques from computer vision in SE contexts.
  • To advocate for reporting performance separately on head and tail labels to avoid masking model weaknesses on rare classes.
  • To call for future research into label relationship-aware methods and data augmentation for tail class learning in SE datasets.

Proposed method

  • Collected and analyzed three distinct SE datasets: API sequence recommendation, code revision recommendation, and vulnerability type prediction, all exhibiting long-tailed label distributions.
  • Categorized labels into 'head' (top 50% of data samples) and 'tail' (bottom 50%) to isolate performance differences across label frequency.
  • Evaluated multiple LLMs (e.g., CodeBERT, CodeT5) and traditional ML models (e.g., Logistic Regression, SVM) on head and tail subsets to measure performance disparity.
  • Applied existing computer vision-based long-tail mitigation techniques (e.g., class re-balancing, focal loss) to SE datasets to test transferability.
  • Used stratified data splitting into 10 groups to validate consistency of findings and reduce bias in performance evaluation.
  • Released a public replication package to ensure reproducibility and enable future extension of the study.

Experimental results

Research questions

  • RQ1To what extent do long-tailed label distributions in SE datasets affect the performance of LLMs for code?
  • RQ2How do LLMs perform on head labels versus tail labels across different SE tasks?
  • RQ3Can existing long-tail mitigation techniques from computer vision effectively improve model performance on tail labels in SE datasets?
  • RQ4What are the implications of reporting only average accuracy when long-tailed distributions exist in SE datasets?
  • RQ5How can label relationships and data augmentation be leveraged to improve learning on rare code-related labels?

Key findings

  • LLMs for code exhibit a 30.0% to 254.0% performance drop on tail labels compared to head labels across the three evaluated SE tasks.
  • On vulnerability type prediction, TreeVul achieved 88.5% accuracy on the frequent head label (CWE-79) but only 11.1% on the rare tail label (CWE-863), despite an overall average accuracy of 73.1%.
  • Traditional ML models like Logistic Regression and SVM also showed significant performance gaps, with tail accuracy dropping by up to 20 percentage points compared to head accuracy.
  • Existing computer vision-based long-tail mitigation techniques were ineffective in improving performance on tail labels in SE datasets, likely due to the lack of consideration for semantic label relationships.
  • The study confirms that reporting only average accuracy masks severe underperformance on tail labels, urging the community to report head and tail performance separately.
  • The findings suggest that future solutions must account for label relationships and explore data generation (e.g., via generative AI) to improve tail class learning in SE datasets.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.