File size: 21,630 Bytes
d862b72
25d314a
09081e2
 
 
 
d862b72
 
09081e2
d862b72
09081e2
 
 
 
 
 
d862b72
 
09081e2
25d314a
09081e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43b1e15
09081e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d862b72
 
 
 
25d314a
d862b72
 
 
 
 
25d314a
d862b72
25d314a
d862b72
09081e2
d862b72
25d314a
 
 
 
 
 
d862b72
25d314a
d862b72
25d314a
d862b72
09081e2
 
 
 
 
 
 
 
 
 
 
 
 
 
d862b72
25d314a
d862b72
0791483
 
09081e2
 
25d314a
 
 
 
 
 
 
 
d862b72
0791483
 
09081e2
 
0791483
 
 
 
 
 
 
 
 
 
 
 
09081e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25d314a
d862b72
09081e2
25d314a
09081e2
 
 
 
 
 
 
 
 
 
 
 
 
 
d862b72
25d314a
d862b72
25d314a
 
d862b72
09081e2
 
 
 
 
d862b72
09081e2
 
 
 
d862b72
0791483
 
 
09081e2
 
 
25d314a
 
 
0791483
 
 
25d314a
d862b72
25d314a
d862b72
25d314a
 
 
 
 
 
 
 
 
d862b72
09081e2
 
 
 
 
 
 
 
d862b72
 
 
 
 
09081e2
d862b72
 
25d314a
d862b72
 
 
25d314a
 
 
 
 
09081e2
 
 
25d314a
d862b72
 
25d314a
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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
---
language:
  - en
  - zh
  - es
  - ur
license: apache-2.0
task_categories:
  - text-generation
tags:
  - code
  - multilingual
  - legesher
  - transpilation
  - tiny-aya-expedition
  - language-decoded
pretty_name: Language Decoded Data
size_categories:
  - 100K<n<1M
configs:
  - config_name: condition-1-en-32k
    data_files:
      - split: train
        path: data/condition-1-en-32k/train-*
      - split: validation
        path: data/condition-1-en-32k/validation-*
  - config_name: condition-1-en-5k
    data_files:
      - split: train
        path: data/condition-1-en-5k/train-*
      - split: validation
        path: data/condition-1-en-5k/validation-*
  - config_name: condition-2-es-32k
    data_files:
      - split: train
        path: data/condition-2-es-32k/train-*
      - split: validation
        path: data/condition-2-es-32k/validation-*
  - config_name: condition-2-es-5k
    data_files:
      - split: train
        path: data/condition-2-es-5k/train-*
      - split: validation
        path: data/condition-2-es-5k/validation-*
  - config_name: condition-2-ur-32k
    data_files:
      - split: train
        path: data/condition-2-ur-32k/train-*
      - split: validation
        path: data/condition-2-ur-32k/validation-*
  - config_name: condition-2-ur-5k
    data_files:
      - split: train
        path: data/condition-2-ur-5k/train-*
      - split: validation
        path: data/condition-2-ur-5k/validation-*
  - config_name: condition-2-zh-32k
    data_files:
      - split: train
        path: data/condition-2-zh-32k/train-*
      - split: validation
        path: data/condition-2-zh-32k/validation-*
  - config_name: condition-2-zh-5k
    data_files:
      - split: train
        path: data/condition-2-zh-5k/train-*
      - split: validation
        path: data/condition-2-zh-5k/validation-*
  - config_name: condition-3-zh-5k
    data_files:
      - split: train
        path: data/condition-3-zh-5k/train-*
      - split: validation
        path: data/condition-3-zh-5k/validation-*
  - config_name: condition-4-zh-5k
    data_files:
      - split: train
        path: data/condition-4-zh-5k/train-*
      - split: validation
        path: data/condition-4-zh-5k/validation-*
dataset_info:
  - config_name: condition-1-en-32k
    features:
      - name: file_path
        dtype: string
      - name: code
        dtype: string
      - name: code_en
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: token_count
        dtype: int32
    splits:
      - name: train
        num_bytes: 403718262
        num_examples: 31818
      - name: validation
        num_bytes: 42626910
        num_examples: 3536
    download_size: 164619518
    dataset_size: 446345172
  - config_name: condition-1-en-5k
    features:
      - name: file_path
        dtype: string
      - name: code
        dtype: string
      - name: code_en
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: token_count
        dtype: int32
    splits:
      - name: train
        num_bytes: 55261555
        num_examples: 4500
      - name: validation
        num_bytes: 6365959
        num_examples: 500
    download_size: 22897728
    dataset_size: 61627514
  - config_name: condition-2-es-32k
    features:
      - name: file_path
        dtype: string
      - name: code
        dtype: string
      - name: code_en
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: token_count
        dtype: int32
    splits:
      - name: train
        num_bytes: 408041994
        num_examples: 31818
      - name: validation
        num_bytes: 43090956
        num_examples: 3536
    download_size: 166000000
    dataset_size: 451132950
  - config_name: condition-2-es-5k
    features:
      - name: file_path
        dtype: string
      - name: code
        dtype: string
      - name: code_en
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: token_count
        dtype: int32
    splits:
      - name: train
        num_bytes: 55864731
        num_examples: 4500
      - name: validation
        num_bytes: 6432095
        num_examples: 500
    download_size: 23031674
    dataset_size: 62296826
  - config_name: condition-2-ur-32k
    features:
      - name: file_path
        dtype: string
      - name: code
        dtype: string
      - name: code_en
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: token_count
        dtype: int32
    splits:
      - name: train
        num_bytes: 415552907
        num_examples: 31818
      - name: validation
        num_bytes: 43879443
        num_examples: 3536
    download_size: 166000000
    dataset_size: 459432350
  - config_name: condition-2-ur-5k
    features:
      - name: file_path
        dtype: string
      - name: code
        dtype: string
      - name: code_en
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: token_count
        dtype: int32
    splits:
      - name: train
        num_bytes: 56906247
        num_examples: 4500
      - name: validation
        num_bytes: 6545730
        num_examples: 500
    download_size: 23158039
    dataset_size: 63451977
  - config_name: condition-2-zh-32k
    features:
      - name: file_path
        dtype: string
      - name: code
        dtype: string
      - name: code_en
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: token_count
        dtype: int32
    splits:
      - name: train
        num_bytes: 405515831
        num_examples: 31818
      - name: validation
        num_bytes: 45065811
        num_examples: 3536
    download_size: 165387142
    dataset_size: 450581642
  - config_name: condition-2-zh-5k
    features:
      - name: file_path
        dtype: string
      - name: code
        dtype: string
      - name: code_en
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: token_count
        dtype: int32
    splits:
      - name: train
        num_bytes: 55793642
        num_examples: 4500
      - name: validation
        num_bytes: 6422792
        num_examples: 500
    download_size: 22978834
    dataset_size: 62216434
  - config_name: condition-3-zh-5k
    features:
      - name: file_path
        dtype: large_string
      - name: code
        dtype: large_string
      - name: code_en
        dtype: string
      - name: language
        dtype: large_string
      - name: license
        dtype: large_string
      - name: token_count
        dtype: int64
      - name: source_type
        dtype: large_string
    splits:
      - name: train
        num_bytes: 40782466
        num_examples: 4500
      - name: validation
        num_bytes: 4531385
        num_examples: 500
    download_size: 17299185
    dataset_size: 45313851
  - config_name: condition-4-zh-5k
    features:
      - name: filename
        dtype: string
      - name: content
        dtype: string
      - name: extension
        dtype: string
      - name: source
        dtype: string
      - name: quality_tier
        dtype: string
      - name: sha256
        dtype: string
      - name: byte_size
        dtype: int64
      - name: total_lines
        dtype: int64
      - name: cjk_ratio
        dtype: float64
      - name: has_cjk
        dtype: bool
    splits:
      - name: train
        num_bytes: 44246508
        num_examples: 6553
      - name: validation
        num_bytes: 7522476
        num_examples: 729
    download_size: 18300000
    dataset_size: 51768984
---

# Language Decoded | Multilingual Code Dataset

Multilingual Python code datasets for the **Language Decoded** project (part of [Cohere's Tiny Aya Expedition](https://aya.for.ai)), investigating whether code's reasoning benefit for language models is **language-dependent** or **structure-dependent**.

## Research Question

> Does fine-tuning on non-English code (Python with translated keywords) improve multilingual reasoning as much as English code does?

Prior work ([Aryabumi et al., 2024 -- "To Code or Not to Code"](https://arxiv.org/abs/2408.10914)) demonstrated that including English code in pre-training data improves downstream reasoning performance by approximately 8%. However, that study only tested English code. This dataset enables the natural follow-up: does the reasoning benefit come from the _structure_ of code, or from the _language_ of its keywords?

## Dataset Description

This dataset provides filtered, quality-controlled Python source code in multiple configurations: the original English, three keyword-swapped variants (Chinese, Spanish, Urdu), a blended native+transpiled mix, and strictly native Chinese code. The source data is drawn from [bigcode/the-stack-dedup](https://huggingface.co/datasets/bigcode/the-stack-dedup) (Python subset), filtered for quality using the following criteria:

- AST-valid Python only (must parse without errors)
- Permissive licenses only (MIT, Apache-2.0, BSD, etc.)
- 10--1000 lines of code
- Minimum 21 GitHub stars
- No autogenerated files
- SHA-256 deduplication

Keyword-swapped variants are produced using [Legesher](https://github.com/legesher/legesher) v0.7.3, which translates Python reserved words (37 keywords, 72 builtins, 66 exceptions) into the target language while preserving code structure and semantics.

## Available Configs

Each condition is available in two sizes: `-32k` (full filtered corpus, ~31.8k train + ~3.5k validation) and `-5k` (stratified subset, 4.5k train + 500 validation). The `-5k` subsets are used for QLoRA fine-tuning on consumer GPUs.

| Config               | Condition   | Language | Description                                                  | Train  | Val   |
| -------------------- | ----------- | -------- | ------------------------------------------------------------ | ------ | ----- |
| `condition-1-en-32k` | 1 (control) | English  | Unmodified filtered Python from The Stack Dedup              | 31,818 | 3,536 |
| `condition-1-en-5k`  | 1 (control) | English  | Stratified 5k subset of condition-1                          | 4,500  | 500   |
| `condition-2-zh-32k` | 2           | Chinese  | Keyword-swapped Python via Legesher v0.7.3                   | 31,818 | 3,536 |
| `condition-2-zh-5k`  | 2           | Chinese  | Stratified 5k subset of condition-2-zh                       | 4,500  | 500   |
| `condition-2-es-32k` | 2           | Spanish  | Keyword-swapped Python via Legesher v0.7.3                   | 31,818 | 3,536 |
| `condition-2-es-5k`  | 2           | Spanish  | Stratified 5k subset of condition-2-es                       | 4,500  | 500   |
| `condition-2-ur-32k` | 2           | Urdu     | Keyword-swapped Python via Legesher v0.7.3                   | 31,818 | 3,536 |
| `condition-2-ur-5k`  | 2           | Urdu     | Stratified 5k subset of condition-2-ur                       | 4,500  | 500   |
| `condition-3-zh-5k`  | 3           | Chinese  | Blended: 3,486 native Chinese code + 1,514 transpiled Python | 4,500  | 500   |
| `condition-4-zh-5k`  | 4           | Chinese  | Strictly native Chinese code (no transpiled code)            | 6,553  | 729   |

## Schema

### Conditions 1--2

Used by: `condition-1-en-*`, `condition-2-zh-*`, `condition-2-es-*`, `condition-2-ur-*`

| Column        | Type   | Description                                                                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code`        | string | Python source code. For condition-2 configs, this is the transpiled (keyword-swapped) version. For condition-1, this is the original English source. |
| `code_en`     | string | Original English Python source code. Identical to `code` for condition-1-en.                                                                         |
| `language`    | string | ISO 639-1 language code: `en`, `ur`, `zh`, or `es`.                                                                                                  |
| `file_path`   | string | Original file path in The Stack Dedup.                                                                                                               |
| `license`     | string | SPDX license identifier for the source file.                                                                                                         |
| `token_count` | int64  | Token count computed using the CohereLabs/tiny-aya-base tokenizer.                                                                                   |

### Condition 3

Used by: `condition-3-zh-5k`

Condition 3 blends native Chinese code with transpiled code and adds a `source_type` column to distinguish them. `code_en` is populated for transpiled rows (keeping them in sync with conditions 1--2) but null for native code rows, which have no English equivalent.

| Column        | Type        | Description                                                                        |
| ------------- | ----------- | ---------------------------------------------------------------------------------- |
| `file_path`   | string      | File identifier (native filename or transpiled file path)                          |
| `code`        | string      | The code content (native or transpiled)                                            |
| `code_en`     | string/null | English original -- populated for transpiled rows, null for native code rows       |
| `language`    | string      | ISO 639-1 language code (`zh`)                                                     |
| `license`     | string      | Source license (SPDX identifier, `UNKNOWN`, or `varies`)                           |
| `token_count` | int64       | Token count computed using the CohereLabs/tiny-aya-base tokenizer                  |
| `source_type` | string      | `"native"` (natively Chinese-authored) or `"transpiled"` (keyword-swapped English) |

### Condition 4

Used by: `condition-4-zh-5k`

Condition 4 contains strictly native Chinese code -- code written by developers who think and code in Chinese. This uses the same schema as the [language-decoded-community](https://huggingface.co/datasets/legesher/language-decoded-community) dataset rather than the transpilation schema, since there is no English original to reference.

| Column         | Type    | Description                                                    |
| -------------- | ------- | -------------------------------------------------------------- |
| `filename`     | string  | Original filename                                              |
| `content`      | string  | The code content                                               |
| `extension`    | string  | File extension (e.g., `.py`, `.c`, `.wenyan`)                  |
| `source`       | string  | Data source (e.g., `thestack`, `wenyan`, `program_in_chinese`) |
| `quality_tier` | string  | Quality rating: `A` (highest) through `D` (lowest)             |
| `sha256`       | string  | SHA-256 hash for deduplication                                 |
| `byte_size`    | int64   | File size in bytes                                             |
| `total_lines`  | int64   | Total line count                                               |
| `cjk_ratio`    | float64 | Ratio of CJK characters in the file                            |
| `has_cjk`      | bool    | Whether the file contains CJK characters                       |

## Experimental Conditions

The Language Decoded experiment uses a ladder of conditions to isolate the mechanism behind code's reasoning benefit:

| Condition   | Name                 | Purpose                                                                                   |
| ----------- | -------------------- | ----------------------------------------------------------------------------------------- |
| Baseline    | No fine-tuning       | Establishes the performance floor                                                         |
| Condition 1 | English code         | Tests whether code fine-tuning helps at all (replicates Aryabumi et al.)                  |
| Condition 2 | Keyword-swapped code | Tests whether the _language_ of keywords matters for the reasoning benefit                |
| Condition 3 | Mixed native sources | Tests whether diverse native-language code adds value beyond keyword swapping             |
| Condition 4 | Strictly native code | Tests whether code authored by native speakers carries unique signal beyond transpilation |

### The Experimental Ladder

- **Baseline --> 1**: Does code help at all?
- **1 --> 2**: Does the language of keywords matter?
- **2 --> 3**: Does diversity of native-language sources add value beyond keyword swap?
- **3 --> 4**: Does code written in the cultural context of a language carry something that transpiled+mixed can't?

## Usage

```python
from datasets import load_dataset

# Load full-size English code (control)
ds = load_dataset("legesher/language-decoded-data", "condition-1-en-32k")

# Load 5k subset (for QLoRA fine-tuning)
ds = load_dataset("legesher/language-decoded-data", "condition-1-en-5k")

# Load keyword-swapped variants
ds = load_dataset("legesher/language-decoded-data", "condition-2-zh-5k")
ds = load_dataset("legesher/language-decoded-data", "condition-2-es-5k")
ds = load_dataset("legesher/language-decoded-data", "condition-2-ur-5k")

# Load blended native + transpiled (condition 3)
ds = load_dataset("legesher/language-decoded-data", "condition-3-zh-5k")

# Load strictly native code (condition 4)
ds = load_dataset("legesher/language-decoded-data", "condition-4-zh-5k")

# Access splits
train = ds["train"]
val = ds["validation"]

# Filter condition-3 by source type
native_only = train.filter(lambda x: x["source_type"] == "native")
```

## Technical Details

| Parameter              | Value                                                                                                              |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------ |
| Source dataset         | [bigcode/the-stack-dedup](https://huggingface.co/datasets/bigcode/the-stack-dedup) (Python subset)                 |
| Transpilation tool     | [Legesher](https://github.com/legesher/legesher) v0.7.3 (legesher-core, legesher-i18n)                             |
| Tokenizer              | CohereLabs/tiny-aya-base                                                                                           |
| Base model             | [CohereLabs/tiny-aya-base](https://huggingface.co/CohereLabs/tiny-aya-base) (3.35B params)                         |
| Train/validation split | 90% / 10% (seed 42)                                                                                                |
| File format            | Parquet (snappy compression)                                                                                       |
| Filtering criteria     | AST-valid, permissive licenses, 10--1000 lines, min 21 GitHub stars, no autogenerated files, SHA-256 deduplication |

## Limitations

- **Source bias**: The Stack Dedup skews toward popular, well-starred GitHub repositories, which may not represent the full diversity of Python code in the wild.
- **Keyword-only transpilation**: Legesher translates Python reserved words (keywords, builtins, exceptions) but leaves comments, docstrings, string literals, and variable/function names in their original language (typically English). This means condition-2 code is a hybrid of translated keywords and English identifiers.
- **Token count variation**: Transpiled code may have different token counts than the English original due to multi-byte characters (especially for Chinese and Urdu), even though the code structure is identical.
- **Single programming language**: Currently limited to Python. Results may not generalize to other programming languages.
- **Condition 4 scope**: Native Chinese code is limited to publicly available sources (The Stack, Wenyan, Program-in-Chinese, Qi, Mulan) and may not represent the full spectrum of Chinese-language programming.

## Citation

```bibtex
@misc{language-decoded-2026,
  title={Language Decoded: Investigating Language-Dependent vs. Structure-Dependent Reasoning Benefits of Code},
  author={Madison Edgar and Saad Ahmed Bazaz and Tom Sherborne and Rashik Shahjahan and Khojasteh Mirza and Sarah Jawaid and Rafay Mustafa and Sohaib Ahmed Bazaz},
  year={2026},
  publisher={Hugging Face},
  url={https://huggingface.co/datasets/legesher/language-decoded-data}
}
```

## Links

- [Legesher on GitHub](https://github.com/legesher/legesher)
- [Tiny Aya Expedition](https://aya.for.ai)
- [bigcode/the-stack-dedup](https://huggingface.co/datasets/bigcode/the-stack-dedup)
- [Language Decoded Community (native code)](https://huggingface.co/datasets/legesher/language-decoded-community)
- [Language Decoded Experiments (tracking)](https://huggingface.co/datasets/legesher/language-decoded-experiments)
- [Language Decoded LoRA (model hub)](https://huggingface.co/legesher/language-decoded-lora)

## License

Apache 2.0