Update README.md
Browse files
README.md
CHANGED
@@ -29,3 +29,128 @@ configs:
|
|
29 |
- split: train
|
30 |
path: data/train-*
|
31 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
- split: train
|
30 |
path: data/train-*
|
31 |
---
|
32 |
+
# Can Language Models Replace Programmers? REPOCOD Says 'Not Yet'
|
33 |
+
|
34 |
+
Large language models (LLMs) have achieved high accuracy, i.e., more than 90 pass@1, in solving Python coding problems in HumanEval and MBPP. Thus, a natural question is, whether LLMs achieve comparable code completion performance compared to human developers? Unfortunately, one cannot answer this question using existing manual crafted or simple (e.g., single-line) code generation benchmarks, since such tasks fail to represent real-world software development tasks. In addition, existing benchmarks often use poor code correctness metrics, providing misleading conclusions.
|
35 |
+
|
36 |
+
To address these challenges, we create REPOCOD, a code generation benchmark with 980 problems collected from 11 popular real-world projects, with more than 58% of them requiring file-level or repository-level context information. In addition, REPOCOD has the longest average canonical solution length (331.6 tokens) and the highest average cyclomatic complexity (9.00) compared to existing benchmarks. Each task in REPOCOD includes 313.5 developer-written test cases on average for better correctness evaluation. In our evaluations on ten LLMs, none of the models achieves more than 30 pass@1 on REPOCOD, disclosing the necessity of building stronger LLMs that can help developers in real-world software development.
|
37 |
+
|
38 |
+
For easier evaluation, we sample 200 of the hardest problems in REPOCOD to create REPOCOD-Lite, using the product of the prompt length and canonical solution length (in terms of line count) as an indicator of difficulty. From the three categories of questions—self-contained, file-level, and repo-level—we select 66, 67, and 67 samples respectively in descending order of the scores.
|
39 |
+
|
40 |
+
* For more details on data collection and evaluation results, please refer to our arxiv [preprint](https://arxiv.org/abs/2410.21647).
|
41 |
+
|
42 |
+
* Examples code for downloading repositories, preparing repository snapshot, and running test cases for evaluation are propived at [code](https://github.com/lt-asset/REPOCOD)
|
43 |
+
|
44 |
+
* Check our [Leaderboard](https://lt-asset.github.io/REPOCOD/) for preliminary results using SOTA LLMs with RAG.
|
45 |
+
|
46 |
+
## Usage
|
47 |
+
|
48 |
+
```python
|
49 |
+
from datasets import load_dataset
|
50 |
+
data = load_dataset('lt-asset/REPOCOD_Lite')
|
51 |
+
print(data)
|
52 |
+
DatasetDict({
|
53 |
+
train: Dataset({
|
54 |
+
features: ['repository', 'repo_id', 'target_module_path', 'prompt', 'relavent_test_path', 'full_function', 'function_name'],
|
55 |
+
num_rows: 200
|
56 |
+
})
|
57 |
+
})
|
58 |
+
```
|
59 |
+
|
60 |
+
## Data Fields
|
61 |
+
- repository: the source repository of the current sample
|
62 |
+
- repo_id: the unique index of the sample in the corresponding source repository
|
63 |
+
- target_module_path: the file path containing the current sample relative to the root of the source repository
|
64 |
+
- prompt: the developer provided function signature and docstring
|
65 |
+
- relavent_test_path: the path to the relevant test cases
|
66 |
+
- full_function: the canonical solution of the current sample
|
67 |
+
- function_name: the name of the target function (current sample)
|
68 |
+
## Example
|
69 |
+
```
|
70 |
+
"repository": "seaborn", # collected from seaborn
|
71 |
+
"repo_id": "6", # first sample from seaborn
|
72 |
+
"target_module_path": "seaborn/_base.py", # the target function is in this path
|
73 |
+
"prompt": " def iter_data(
|
74 |
+
self, grouping_vars=None, *,
|
75 |
+
reverse=False, from_comp_data=False,
|
76 |
+
by_facet=True, allow_empty=False, dropna=True,
|
77 |
+
):
|
78 |
+
'''Generator for getting subsets of data defined by semantic variables.
|
79 |
+
|
80 |
+
Also injects "col" and "row" into grouping semantics.
|
81 |
+
|
82 |
+
Parameters
|
83 |
+
----------
|
84 |
+
grouping_vars : string or list of strings
|
85 |
+
Semantic variables that define the subsets of data.
|
86 |
+
reverse : bool
|
87 |
+
If True, reverse the order of iteration.
|
88 |
+
from_comp_data : bool
|
89 |
+
If True, use self.comp_data rather than self.plot_data
|
90 |
+
by_facet : bool
|
91 |
+
If True, add faceting variables to the set of grouping variables.
|
92 |
+
allow_empty : bool
|
93 |
+
If True, yield an empty dataframe when no observations exist for
|
94 |
+
combinations of grouping variables.
|
95 |
+
dropna : bool
|
96 |
+
If True, remove rows with missing data.
|
97 |
+
|
98 |
+
Yields
|
99 |
+
------
|
100 |
+
sub_vars : dict
|
101 |
+
Keys are semantic names, values are the level of that semantic.
|
102 |
+
sub_data : :class:`pandas.DataFrame`
|
103 |
+
Subset of ``plot_data`` for this combination of semantic values.
|
104 |
+
|
105 |
+
'''", # the function signature and docstring for the target function
|
106 |
+
"relevant_test_path": "/usr/src/app/target_test_cases/failed_tests_Continuous.label.txt", # Path to relevant tests for the function
|
107 |
+
"full_function": " def iter_data(
|
108 |
+
self, grouping_vars=None, *,
|
109 |
+
reverse=False, from_comp_data=False,
|
110 |
+
by_facet=True, allow_empty=False, dropna=True,
|
111 |
+
):
|
112 |
+
'''Generator for getting subsets of data defined by semantic variables.
|
113 |
+
|
114 |
+
Also injects "col" and "row" into grouping semantics.
|
115 |
+
|
116 |
+
Parameters
|
117 |
+
----------
|
118 |
+
grouping_vars : string or list of strings
|
119 |
+
Semantic variables that define the subsets of data.
|
120 |
+
reverse : bool
|
121 |
+
If True, reverse the order of iteration.
|
122 |
+
from_comp_data : bool
|
123 |
+
If True, use self.comp_data rather than self.plot_data
|
124 |
+
by_facet : bool
|
125 |
+
If True, add faceting variables to the set of grouping variables.
|
126 |
+
allow_empty : bool
|
127 |
+
If True, yield an empty dataframe when no observations exist for
|
128 |
+
combinations of grouping variables.
|
129 |
+
dropna : bool
|
130 |
+
If True, remove rows with missing data.
|
131 |
+
|
132 |
+
Yields
|
133 |
+
------
|
134 |
+
sub_vars : dict
|
135 |
+
Keys are semantic names, values are the level of that semantic.
|
136 |
+
sub_data : :class:`pandas.DataFrame`
|
137 |
+
Subset of ``plot_data`` for this combination of semantic values.
|
138 |
+
|
139 |
+
'''
|
140 |
+
if grouping_vars is None:
|
141 |
+
grouping_vars = []
|
142 |
+
...", # the full snippet of the target function, including the function signature and docstring for the target function
|
143 |
+
"function_name": "VectorPlotter.iter_data" # The name of the target function
|
144 |
+
```
|
145 |
+
## Citation
|
146 |
+
```
|
147 |
+
@misc{liang2024repocod,
|
148 |
+
title={Can Language Models Replace Programmers? REPOCOD Says 'Not Yet'},
|
149 |
+
author={Shanchao Liang and Yiran Hu and Nan Jiang and Lin Tan},
|
150 |
+
year={2024},
|
151 |
+
eprint={2410.21647},
|
152 |
+
archivePrefix={arXiv},
|
153 |
+
primaryClass={cs.SE},
|
154 |
+
url={https://arxiv.org/abs/2410.21647},
|
155 |
+
}
|
156 |
+
```
|