Skip to main content
QUICK REVIEW

[Paper Review] CrossCodeBench: Benchmarking Cross-Task Generalization of Source Code Models

Changan Niu, Chuanyi Li|arXiv (Cornell University)|Feb 8, 2023
Software Engineering ResearchComputer Science3 citations
TL;DR

This paper introduces CrossCodeBench, a large-scale benchmark with 216 diverse code-related tasks across 28 categories and 18 programming languages, annotated with rich meta-information including task descriptions, instructions, and positive/negative examples. The benchmark enables systematic evaluation of cross-task generalization in code models, demonstrating that in-context learning with few-shot examples and task instructions significantly improves zero-shot performance on unseen tasks, especially when combined with larger models and diverse training tasks.

ABSTRACT

Despite the recent advances showing that a model pre-trained on large-scale source code data is able to gain appreciable generalization capability, it still requires a sizeable amount of data on the target task for fine-tuning. And the effectiveness of the model generalization is largely affected by the size and quality of the fine-tuning data, which is detrimental for target tasks with limited or unavailable resources. Therefore, cross-task generalization, with the goal of improving the generalization of the model to unseen tasks that have not been seen before, is of strong research and application value. In this paper, we propose a large-scale benchmark that includes 216 existing code-related tasks. Then, we annotate each task with the corresponding meta information such as task description and instruction, which contains detailed information about the task and a solution guide. This also helps us to easily create a wide variety of ``training/evaluation'' task splits to evaluate the various cross-task generalization capabilities of the model. Then we perform some preliminary experiments to demonstrate that the cross-task generalization of models can be largely improved by in-context learning methods such as few-shot learning and learning from task instructions, which shows the promising prospects of conducting cross-task learning research on our benchmark. We hope that the collection of the datasets and our benchmark will facilitate future work that is not limited to cross-task generalization.

Motivation & Objective

  • To address the challenge of limited labeled data in software engineering (SE) tasks by enabling cross-task generalization of pre-trained code models.
  • To reduce reliance on task-specific fine-tuning by enabling zero-shot or few-shot transfer to unseen tasks.
  • To provide a standardized, diverse, and well-annotated benchmark for evaluating and advancing cross-task learning in code intelligence.
  • To explore how model size, data quantity, and task diversity impact cross-task generalization performance.

Proposed method

  • The authors collected 216 code-related tasks spanning 28 categories, 7 types, and 18 programming languages.
  • Each task was manually annotated with detailed meta-information, including task description, definition, instruction, and positive/negative examples.
  • The benchmark supports multiple cross-task learning settings, including few-shot learning and learning from task instructions.
  • Ten distinct training/evaluation splits were created to evaluate various generalization capabilities across different task types and data configurations.
  • A unified text-to-text sequence-to-sequence framework was used to formalize all tasks, enabling compatibility with autoregressive models.
  • The study evaluates multiple pre-trained code models under zero-shot and few-shot settings using the benchmark splits.

Experimental results

Research questions

  • RQ1How well can pre-trained code models generalize to unseen code-related tasks without fine-tuning?
  • RQ2What impact do few-shot demonstrations and task instructions have on zero-shot performance across diverse code tasks?
  • RQ3Which combinations of source tasks yield the best generalization performance on a target task with limited data?
  • RQ4How do model size, training data quantity, and task diversity affect cross-task generalization?
  • RQ5What are the key limitations in output constraint for classification tasks under cross-task settings?

Key findings

  • All models performed poorly on classification tasks in the cross-task setting, even with label instructions, due to frequent generation of invalid or out-of-vocabulary labels.
  • Few-shot learning and task instruction prompting significantly improved performance across unseen tasks, demonstrating strong potential for zero-shot transfer.
  • The performance of cross-task generalization varied depending on the combination of source tasks used during training, indicating task selection is critical for optimal transfer.
  • Larger models, more training data, and greater task diversity all contributed to improved cross-task generalization, suggesting trade-offs in resource allocation.
  • The benchmark revealed that retrieval tasks (e.g., code-to-code search) could not be formalized in the text-to-text framework, limiting their inclusion.

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.