Datasets:

Modalities:
Text
Formats:
parquet
Size:
< 1K
ArXiv:
DOI:
Libraries:
Datasets
Dask
License:
File size: 12,760 Bytes
05bac6e
 
 
00bf3c6
05bac6e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1964e74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447ce70
 
 
 
 
 
 
 
 
 
 
 
 
 
22a3874
 
 
 
447ce70
22a3874
447ce70
22a3874
447ce70
22a3874
447ce70
22a3874
447ce70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22a3874
447ce70
22a3874
 
3137a18
 
 
 
 
 
 
 
 
 
 
 
 
 
bc15a07
 
 
 
3137a18
bc15a07
3137a18
bc15a07
3137a18
bc15a07
3137a18
bc15a07
3137a18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bc15a07
3137a18
bc15a07
 
00bf3c6
 
 
 
 
 
 
 
 
 
 
 
 
 
5bbee2a
 
 
 
00bf3c6
5bbee2a
00bf3c6
5bbee2a
00bf3c6
5bbee2a
00bf3c6
5bbee2a
00bf3c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5bbee2a
00bf3c6
5bbee2a
 
05bac6e
00bf3c6
 
 
fef9efb
05bac6e
 
 
62a7625
05bac6e
 
 
6eace1d
05bac6e
 
 
4eae00f
05bac6e
 
9764f31
4d862bd
 
 
 
 
 
 
 
74bd9a4
05bac6e
 
 
4287e99
 
 
 
 
 
 
16c62ee
05bac6e
4d862bd
 
 
05bac6e
4d862bd
 
05bac6e
4d862bd
 
 
 
 
 
 
 
 
 
 
05bac6e
 
 
 
4d862bd
05bac6e
 
4287e99
 
 
 
 
 
 
05bac6e
4287e99
 
 
 
 
 
05bac6e
 
 
4287e99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
05bac6e
 
 
4287e99
 
 
 
 
 
 
05bac6e
 
4d862bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
---
license: apache-2.0
dataset_info:
- config_name: default
  features:
  - name: repo
    dtype: string
  - name: commit_hash
    dtype: string
  - name: completion_file
    struct:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines
    struct:
    - name: infile
      sequence: int32
    - name: inproject
      sequence: int32
    - name: common
      sequence: int32
    - name: commited
      sequence: int32
    - name: non_informative
      sequence: int32
    - name: random
      sequence: int32
  - name: repo_snapshot
    sequence:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines_raw
    struct:
    - name: commited
      sequence: int64
    - name: common
      sequence: int64
    - name: infile
      sequence: int64
    - name: inproject
      sequence: int64
    - name: non_informative
      sequence: int64
    - name: other
      sequence: int64
- config_name: huge_context
  features:
  - name: repo
    dtype: string
  - name: commit_hash
    dtype: string
  - name: completion_file
    struct:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines
    struct:
    - name: infile
      sequence: int32
    - name: inproject
      sequence: int32
    - name: common
      sequence: int32
    - name: commited
      sequence: int32
    - name: non_informative
      sequence: int32
    - name: random
      sequence: int32
  - name: repo_snapshot
    sequence:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines_raw
    struct:
    - name: commited
      sequence: int64
    - name: common
      sequence: int64
    - name: infile
      sequence: int64
    - name: inproject
      sequence: int64
    - name: non_informative
      sequence: int64
    - name: other
      sequence: int64
  splits:
  - name: test
    num_bytes: 5220255729
    num_examples: 296
  download_size: 1811094462
  dataset_size: 5220255729
- config_name: large_context
  features:
  - name: repo
    dtype: string
  - name: commit_hash
    dtype: string
  - name: completion_file
    struct:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines
    struct:
    - name: commited
      sequence: int64
    - name: common
      sequence: int64
    - name: infile
      sequence: int64
    - name: inproject
      sequence: int64
    - name: non_informative
      sequence: int64
    - name: random
      sequence: int64
  - name: repo_snapshot
    sequence:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines_raw
    struct:
    - name: commited
      sequence: int64
    - name: common
      sequence: int64
    - name: infile
      sequence: int64
    - name: inproject
      sequence: int64
    - name: non_informative
      sequence: int64
    - name: other
      sequence: int64
  splits:
  - name: test
    num_bytes: 2972051649
    num_examples: 270
  download_size: 1242122171
  dataset_size: 2972051649
- config_name: medium_context
  features:
  - name: repo
    dtype: string
  - name: commit_hash
    dtype: string
  - name: completion_file
    struct:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines
    struct:
    - name: commited
      sequence: int64
    - name: common
      sequence: int64
    - name: infile
      sequence: int64
    - name: inproject
      sequence: int64
    - name: non_informative
      sequence: int64
    - name: random
      sequence: int64
  - name: repo_snapshot
    sequence:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines_raw
    struct:
    - name: commited
      sequence: int64
    - name: common
      sequence: int64
    - name: infile
      sequence: int64
    - name: inproject
      sequence: int64
    - name: non_informative
      sequence: int64
    - name: other
      sequence: int64
  splits:
  - name: test
    num_bytes: 514963163
    num_examples: 224
  download_size: 225825098
  dataset_size: 514963163
- config_name: small_context
  features:
  - name: repo
    dtype: string
  - name: commit_hash
    dtype: string
  - name: completion_file
    struct:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines
    struct:
    - name: commited
      sequence: int64
    - name: common
      sequence: int64
    - name: infile
      sequence: int64
    - name: inproject
      sequence: int64
    - name: non_informative
      sequence: int64
    - name: random
      sequence: int64
  - name: repo_snapshot
    sequence:
    - name: filename
      dtype: string
    - name: content
      dtype: string
  - name: completion_lines_raw
    struct:
    - name: commited
      sequence: int64
    - name: common
      sequence: int64
    - name: infile
      sequence: int64
    - name: inproject
      sequence: int64
    - name: non_informative
      sequence: int64
    - name: other
      sequence: int64
  splits:
  - name: test
    num_bytes: 111028780
    num_examples: 144
  download_size: 37604020
  dataset_size: 111028780
configs:
- config_name: huge_context
  data_files:
  - split: test
    path: data/huge_context/test-*
- config_name: large_context
  data_files:
  - split: test
    path: data/large_context/test-*
- config_name: medium_context
  data_files:
  - split: test
    path: data/medium_context/test-*
- config_name: small_context
  data_files:
  - split: test
    path: data/small_context/test-*
---


# 🏟️ Long Code Arena (Project-level code completion)
This is the benchmark for Project-level code completion task as part of the [🏟️ Long Code Arena benchmark](https://huggingface.co/spaces/JetBrains-Research/long-code-arena).
Each datapoint contains the file for completion, a list of lines to complete with their categories (see the categorization below), and a repository snapshot that can be used to build the context.
All the repositories are published under permissive licenses (MIT, Apache-2.0, BSD-3-Clause, and BSD-2-Clause). The datapoints can be removed upon request.

## How-to

Load the data via [load_dataset](https://huggingface.co/docs/datasets/v2.14.3/en/package_reference/loading_methods#datasets.load_dataset):

```
from datasets import load_dataset

config_names = [
  'small_context',
  'medium_context',
  'large_context',
  'huge_context'
]

ds = load_dataset('JetBrains-Research/lca-project-level-code-completion', config_name, split='test')
```
## Dataset Structure

Datapoints in the dataset have the following structure:

* `repo` – repository name in the format `{GitHub_user_name}__{repository_name}`
* `commit_hash` – commit hash of the repository
* `completion_file` – dictionary with the completion file content in the following format:
  * `filename` – path to the completion file
  * `content` – content of the completion file
* `completion_lines` – dictionary where the keys are categories of lines and values are a list of integers (numbers of lines to complete). The categories are:
  * `committed` – line contains at least one function or class from the files that were added on the completion file commit
  * `inproject` – line contains at least one function or class from the repository snapshot at the moment of completion
  * `infile` – line contains at least one function or class from the completion file
  * `common` – line contains at least one function or class with common names, e.g., `main`, `get`, etc.
  * `non_informative` – line that was classified to be non-informative, e.g., too short, contains comments, etc.
  * `random` – other lines.
* `repo_snapshot` – dictionary with a snapshot of the repository before the commit. It has the same structure as `completion_file`, but filenames and contents are orginized as lists.
* `completion_lines_raw` – same as `completion_lines`, but before sampling

## How we collected the data

To collect the data, we cloned repositories from GitHub where the main language is Python.
The completion file for each datapoint is a `.py` file that was added to the repository in a commit.
The state of the repository before this commit is the repo snapshot.

The dataset configurations are based on the number of characters in `.py` files from the repository snapshot:
  - `small_context` – less than 48K characters;
  - `medium_context` – from 48K to 192K characters;
  - `large_context` – from 192K to 768K characters;
  - `huge_context` – more than 768K characters.

## Datasets Stats

| Dataset           | Number of datapoints | Number of repositories | Number of commits |
|:-----------------:|:--------------------:|:----------------------:|:-----------------:|
| `small_context`   | 144                  | 46                     | 63                |
| `medium_context`  | 224                  | 80                     | 175               |
| `large_context`   | 270                  | 75                     | 219               |
| `huge_context`    | 296                  | 75                     | 252               |


### Completion File
|      Dataset       | Completion file lines, min | Completion file lines, max | Completion file lines, median |
|:------------------:|:--------------------------:|:--------------------------:|:------------------------------:|
| `small_context`    |           201            |           1916            |            310.5              |
| `medium_context`   |           200            |           1648            |            310.0              |
| `large_context`    |           200            |           1694            |            278.0              |
| `huge_context`     |           200            |           1877            |            313.5              |



### Repository Snapshot `.py` files
|      Dataset       | Context py files number, min | Context py files number, max | Context py files number, median | Context py lines, median |
|:------------------:|:----------------------------:|:----------------------------:|:--------------------------------:|:-------------------------:|
| `small_context`    |              0               |              52              |                4.0               |           128.0          |
| `medium_context`   |              3               |             117              |               34.0               |          3786.0          |
| `large_context`    |              3               |             255              |               84.0               |         15466.5          |
| `huge_context`     |             47               |            5227              |              261.0               |         49811.0          |


### Repository Snapshot non `.py` files
|      Dataset       | Context non-py files number, min | Context non-py files number, max | Context non-py files number, median | Context non-py lines, median |
|:------------------:|:---------------------------------:|:---------------------------------:|:-----------------------------------:|:-----------------------------:|
| `small_context`    |                 1                 |               1044                |                19.5                |            1227.0            |
| `medium_context`   |                 3                 |               3977                |                64.5                |            9735.0            |
| `large_context`    |                 8                 |               2174                |               155.0                |           18759.0            |
| `huge_context`     |                24                 |               7687                |               262.0                |           60163.0            |


### Line Counts:
|      Dataset       | *infile* | *inproject* | *common* | *commited* | *non-informative* | *random* | **all** |
|:------------------:|:--------:|:-----------:|:--------:|:----------:|:-----------------:|:--------:|:-----:|
| `small_context`    | 1430     | 95          | 500      | 1426       | 532               | 703      | **4686**  |
| `medium_context`   | 2224     | 2236        | 779      | 1495       | 858               | 1084     | **8676**  |
| `large_context`    | 2691     | 2595        | 693      | 1322       | 1019              | 1311     | **9631**  |
| `huge_context`     | 2608     | 2901        | 692      | 1019       | 1164              | 1426     | **9810**  |


## Scores
You can find the results of running various models on this dataset in our [leaderboard](https://huggingface.co/spaces/JetBrains-Research/long-code-arena).