Datasets:
docs(readme): align with canonical source-of-truth (cond-4 framing, cond-5 pipeline, source-file control)
#12
by madiedgar - opened
README.md
CHANGED
|
@@ -907,19 +907,27 @@ dataset_info:
|
|
| 907 |
|
| 908 |
# Language Decoded | Multilingual Code Dataset
|
| 909 |
|
|
|
|
|
|
|
| 910 |
> **Note (2026-05-18):** Current Phase 3 configs use the short `condition-*` namespace and include `103k`, `20k`, and `5k` sizes for Conditions 1--2. Phase 2 configs remain available under the `phase-2-the-stack-v1-*` namespace for reproducibility.
|
| 911 |
|
| 912 |
-
Multilingual Python code datasets for the **Language Decoded** project (part of [Cohere's Tiny Aya Expedition](https://aya.for.ai))
|
| 913 |
|
| 914 |
## Research Question
|
| 915 |
|
| 916 |
-
>
|
| 917 |
|
| 918 |
-
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
|
| 919 |
|
| 920 |
## Dataset Description
|
| 921 |
|
| 922 |
-
This dataset provides filtered, quality-controlled Python source code in multiple configurations: the original English
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 923 |
|
| 924 |
- AST-valid Python only (must parse without errors)
|
| 925 |
- Permissive licenses only (MIT, Apache-2.0, BSD, etc.)
|
|
@@ -928,7 +936,7 @@ This dataset provides filtered, quality-controlled Python source code in multipl
|
|
| 928 |
- No autogenerated files
|
| 929 |
- SHA-256 deduplication
|
| 930 |
|
| 931 |
-
|
| 932 |
|
| 933 |
## Available Configs
|
| 934 |
|
|
@@ -939,13 +947,13 @@ Conditions 1--2 are available in three current Phase 3 sizes: `-103k` full corpo
|
|
| 939 |
| `condition-1-en-103k` | 1 (control) | English | Unmodified filtered Python | 93,549 | 10,395 |
|
| 940 |
| `condition-1-en-20k` | 1 (control) | English | Random 20k subset of `condition-1-en-103k` | 18,000 | 2,000 |
|
| 941 |
| `condition-1-en-5k` | 1 (control) | English | Compact 5k subset | 4,500 | 500 |
|
| 942 |
-
| `condition-2-zh-103k` | 2 | Chinese |
|
| 943 |
| `condition-2-zh-20k` | 2 | Chinese | Random 20k subset of `condition-2-zh-103k` | 18,000 | 2,000 |
|
| 944 |
| `condition-2-zh-5k` | 2 | Chinese | Compact 5k subset | 4,500 | 500 |
|
| 945 |
-
| `condition-2-es-103k` | 2 | Spanish |
|
| 946 |
| `condition-2-es-20k` | 2 | Spanish | Random 20k subset of `condition-2-es-103k` | 18,000 | 2,000 |
|
| 947 |
| `condition-2-es-5k` | 2 | Spanish | Compact 5k subset | 4,500 | 500 |
|
| 948 |
-
| `condition-2-ur-103k` | 2 | Urdu |
|
| 949 |
| `condition-2-ur-20k` | 2 | Urdu | Random 20k subset of `condition-2-ur-103k` | 18,000 | 2,000 |
|
| 950 |
| `condition-2-ur-5k` | 2 | Urdu | Compact 5k subset | 4,500 | 500 |
|
| 951 |
| `condition-3-zh-5k` | 3 | Chinese | Blended: native Chinese code + transpiled Python | 4,500 | 500 |
|
|
@@ -962,7 +970,7 @@ Used by: `condition-1-en-*`, `condition-2-zh-*`, `condition-2-es-*`, `condition-
|
|
| 962 |
|
| 963 |
| Column | Type | Description |
|
| 964 |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 965 |
-
| `code` | string | Python source code. For condition-2 configs, this is the transpiled (
|
| 966 |
| `code_en` | string | Original English Python source code. Identical to `code` for condition-1-en. |
|
| 967 |
| `language` | string | ISO 639-1 language code: `en`, `ur`, `zh`, or `es`. |
|
| 968 |
| `file_path` | string | Original file path in the source dataset. |
|
|
@@ -989,7 +997,9 @@ Condition 5 uses the conditions 1--2 schema plus an `idx` column. `code` is the
|
|
| 989 |
|
| 990 |
Used by: `condition-3-zh-5k`
|
| 991 |
|
| 992 |
-
Condition 3
|
|
|
|
|
|
|
| 993 |
|
| 994 |
| Column | Type | Description |
|
| 995 |
| ------------- | ----------- | ---------------------------------------------------------------------------------- |
|
|
@@ -999,13 +1009,15 @@ Condition 3 blends native Chinese code with transpiled code and adds a `source_t
|
|
| 999 |
| `language` | string | ISO 639-1 language code (`zh`) |
|
| 1000 |
| `license` | string | Source license (SPDX identifier, `UNKNOWN`, or `varies`) |
|
| 1001 |
| `token_count` | int64 | Token count computed using the CohereLabs/tiny-aya-base tokenizer |
|
| 1002 |
-
| `source_type` | string | `"native"` (natively Chinese-authored) or `"transpiled"` (
|
| 1003 |
|
| 1004 |
### Condition 4
|
| 1005 |
|
| 1006 |
Used by: `condition-4-zh-5k`
|
| 1007 |
|
| 1008 |
-
Condition 4
|
|
|
|
|
|
|
| 1009 |
|
| 1010 |
| Column | Type | Description |
|
| 1011 |
| -------------- | ------- | -------------------------------------------------------------- |
|
|
@@ -1022,23 +1034,24 @@ Condition 4 contains strictly native Chinese code -- code written by developers
|
|
| 1022 |
|
| 1023 |
## Experimental Conditions
|
| 1024 |
|
| 1025 |
-
The Language Decoded experiment uses a ladder of conditions to isolate the mechanism behind code's reasoning benefit:
|
| 1026 |
|
| 1027 |
-
| Condition | Name
|
| 1028 |
-
| ----------- | -------------------- | ----------------------------------------------------------------------------------------- |
|
| 1029 |
-
| Baseline | No fine-tuning
|
| 1030 |
-
| Condition 1 | English code
|
| 1031 |
-
| Condition 2 |
|
| 1032 |
-
| Condition 3 | Mixed
|
| 1033 |
-
| Condition 4 |
|
| 1034 |
-
| Condition 5 |
|
| 1035 |
|
| 1036 |
### The Experimental Ladder
|
| 1037 |
|
| 1038 |
-
- **Baseline
|
| 1039 |
-
- **1
|
| 1040 |
-
- **2
|
| 1041 |
-
- **
|
|
|
|
| 1042 |
|
| 1043 |
## Usage
|
| 1044 |
|
|
@@ -1057,7 +1070,7 @@ ds = load_dataset("legesher/language-decoded-data", "condition-2-ur-20k")
|
|
| 1057 |
# Load 5k subset (for QLoRA fine-tuning)
|
| 1058 |
ds = load_dataset("legesher/language-decoded-data", "condition-1-en-5k")
|
| 1059 |
|
| 1060 |
-
# Load
|
| 1061 |
ds = load_dataset("legesher/language-decoded-data", "condition-2-zh-5k")
|
| 1062 |
ds = load_dataset("legesher/language-decoded-data", "condition-2-es-5k")
|
| 1063 |
ds = load_dataset("legesher/language-decoded-data", "condition-2-ur-5k")
|
|
@@ -1101,14 +1114,14 @@ native_only = train.filter(lambda x: x["source_type"] == "native")
|
|
| 1101 |
- **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.
|
| 1102 |
- **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.
|
| 1103 |
- **Single programming language**: Currently limited to Python. Results may not generalize to other programming languages.
|
| 1104 |
-
- **Condition 4
|
| 1105 |
- **Condition 5 is raw model output**: The `condition-5-*` configs contain prompt-leakage contamination -- translator-model preamble text, JSON wrappers, and explanation commentary leaked into string literals and identifier names, in AST-valid and AST-invalid rows alike. Cleaned configs will be published separately. See the note at the top of this card.
|
| 1106 |
|
| 1107 |
## Citation
|
| 1108 |
|
| 1109 |
```bibtex
|
| 1110 |
@misc{language-decoded-2026,
|
| 1111 |
-
title={Language Decoded:
|
| 1112 |
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},
|
| 1113 |
year={2026},
|
| 1114 |
publisher={Hugging Face},
|
|
|
|
| 907 |
|
| 908 |
# Language Decoded | Multilingual Code Dataset
|
| 909 |
|
| 910 |
+
> **Experiment and proposed paper title:** _Language Decoded: Exploring the Impact of Native Code on Multilingual Models_
|
| 911 |
+
|
| 912 |
> **Note (2026-05-18):** Current Phase 3 configs use the short `condition-*` namespace and include `103k`, `20k`, and `5k` sizes for Conditions 1--2. Phase 2 configs remain available under the `phase-2-the-stack-v1-*` namespace for reproducibility.
|
| 913 |
|
| 914 |
+
Multilingual Python code datasets for the **Language Decoded** project (part of [Cohere's Tiny Aya Expedition](https://aya.for.ai)). See [legesher/language-decoded-experiments](https://huggingface.co/datasets/legesher/language-decoded-experiments) for the canonical project description, the full experimental ladder, and the paper-grade evaluation results.
|
| 915 |
|
| 916 |
## Research Question
|
| 917 |
|
| 918 |
+
> **How does fine-tuning on non-English code — whether transpiled, mixed-native, or fully translated — affect a model's multilingual reasoning, and how does that impact _differ_ from fine-tuning on English code?**
|
| 919 |
|
| 920 |
+
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: how does the impact of non-English code differ from English code, and how does that vary by language, structure, and corpus construction?
|
| 921 |
|
| 922 |
## Dataset Description
|
| 923 |
|
| 924 |
+
This dataset provides filtered, quality-controlled Python source code in multiple configurations: the original English (cond-1); three Legesher-transpiled variants (cond-2 zh/es/ur, with Python's reserved words translated to the target language); a community-collected raw native-source corpus (cond-3); strictly native code (cond-4, pending); and a model-translated set (cond-5, where `c4ai-aya-expanse-32b` translates everything translatable inside the file). Python source for Conditions 1, 2, and 5 is drawn from [bigcode/the-stack-v2-dedup](https://huggingface.co/datasets/bigcode/the-stack-v2-dedup) (Python subset) for the current Phase 3 configs; the legacy `phase-2-the-stack-v1-*` configs are sourced from [The Stack v1](https://huggingface.co/datasets/bigcode/the-stack) (non-dedup). Conditions 3 and 4 draw on natively-authored or community-contributed code (see those conditions below).
|
| 925 |
+
|
| 926 |
+
### Source-file control
|
| 927 |
+
|
| 928 |
+
Cond-1, cond-2, and cond-5 all train on the **same 5,000-file subset** drawn from `bigcode/the-stack-v2-dedup` (with a parallel 20k subset for the 20k tier). Differences across these conditions reflect the processing pipeline (raw / transpiled / fully translated), not file-quality or content drift. Cond-3 is the deliberate exception — its source files are a different population by design (community-collected from varied online sources, potentially including non-Python files).
|
| 929 |
+
|
| 930 |
+
Source files for cond-1/2/5 are filtered using:
|
| 931 |
|
| 932 |
- AST-valid Python only (must parse without errors)
|
| 933 |
- Permissive licenses only (MIT, Apache-2.0, BSD, etc.)
|
|
|
|
| 936 |
- No autogenerated files
|
| 937 |
- SHA-256 deduplication
|
| 938 |
|
| 939 |
+
Cond-2 variants are produced using [Legesher](https://github.com/legesher/legesher) v0.7.3, which translates Python's reserved words (37 keywords, 72 built-in functions, 66 exceptions, plus the numerical system for some target languages) into the target language while preserving code structure and user logic. Cond-5 takes the Legesher-transpiled output and runs it through `c4ai-aya-expanse-32b` via the Cohere API to translate the remaining content — identifiers, comments, docstrings, string literals, and any other natural-language wording — into the target language. Logic and structure are preserved throughout.
|
| 940 |
|
| 941 |
## Available Configs
|
| 942 |
|
|
|
|
| 947 |
| `condition-1-en-103k` | 1 (control) | English | Unmodified filtered Python | 93,549 | 10,395 |
|
| 948 |
| `condition-1-en-20k` | 1 (control) | English | Random 20k subset of `condition-1-en-103k` | 18,000 | 2,000 |
|
| 949 |
| `condition-1-en-5k` | 1 (control) | English | Compact 5k subset | 4,500 | 500 |
|
| 950 |
+
| `condition-2-zh-103k` | 2 | Chinese | Legesher v0.7.3 reserved-word translation | 93,547 | 10,395 |
|
| 951 |
| `condition-2-zh-20k` | 2 | Chinese | Random 20k subset of `condition-2-zh-103k` | 18,000 | 2,000 |
|
| 952 |
| `condition-2-zh-5k` | 2 | Chinese | Compact 5k subset | 4,500 | 500 |
|
| 953 |
+
| `condition-2-es-103k` | 2 | Spanish | Legesher v0.7.3 reserved-word translation | 93,547 | 10,395 |
|
| 954 |
| `condition-2-es-20k` | 2 | Spanish | Random 20k subset of `condition-2-es-103k` | 18,000 | 2,000 |
|
| 955 |
| `condition-2-es-5k` | 2 | Spanish | Compact 5k subset | 4,500 | 500 |
|
| 956 |
+
| `condition-2-ur-103k` | 2 | Urdu | Legesher v0.7.3 reserved-word translation | 93,547 | 10,395 |
|
| 957 |
| `condition-2-ur-20k` | 2 | Urdu | Random 20k subset of `condition-2-ur-103k` | 18,000 | 2,000 |
|
| 958 |
| `condition-2-ur-5k` | 2 | Urdu | Compact 5k subset | 4,500 | 500 |
|
| 959 |
| `condition-3-zh-5k` | 3 | Chinese | Blended: native Chinese code + transpiled Python | 4,500 | 500 |
|
|
|
|
| 970 |
|
| 971 |
| Column | Type | Description |
|
| 972 |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 973 |
+
| `code` | string | Python source code. For condition-2 configs, this is the Legesher-transpiled (reserved-word translated) version. For condition-1, this is the original English source. |
|
| 974 |
| `code_en` | string | Original English Python source code. Identical to `code` for condition-1-en. |
|
| 975 |
| `language` | string | ISO 639-1 language code: `en`, `ur`, `zh`, or `es`. |
|
| 976 |
| `file_path` | string | Original file path in the source dataset. |
|
|
|
|
| 997 |
|
| 998 |
Used by: `condition-3-zh-5k`
|
| 999 |
|
| 1000 |
+
In Phase 3, Condition 3 ("Mixed Native Sources") refers to **community-collected raw Chinese code from varied online public-source repositories** — reflecting how non-English Python is actually used in real-world projects. The "Mixed Native Sources" name carries from Phase 2, where it originally referred to a planned composite (native code padded with cond-2 transpiled files); in Phase 3 the "mixed" refers to the diversity of source locations, not a cond-2/native composite. The physical dataset has not changed across phases.
|
| 1001 |
+
|
| 1002 |
+
The schema includes a `source_type` column from the Phase 2 composite design, which remains `"native"` or `"transpiled"` depending on each row's origin. `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.
|
| 1003 |
|
| 1004 |
| Column | Type | Description |
|
| 1005 |
| ------------- | ----------- | ---------------------------------------------------------------------------------- |
|
|
|
|
| 1009 |
| `language` | string | ISO 639-1 language code (`zh`) |
|
| 1010 |
| `license` | string | Source license (SPDX identifier, `UNKNOWN`, or `varies`) |
|
| 1011 |
| `token_count` | int64 | Token count computed using the CohereLabs/tiny-aya-base tokenizer |
|
| 1012 |
+
| `source_type` | string | `"native"` (natively Chinese-authored) or `"transpiled"` (Legesher reserved-word translation of English) |
|
| 1013 |
|
| 1014 |
### Condition 4
|
| 1015 |
|
| 1016 |
Used by: `condition-4-zh-5k`
|
| 1017 |
|
| 1018 |
+
Condition 4 ("Community-Contributed Native Code") is intended to contain code whose problem-solving logic is itself native — written as if a native speaker were approaching the problem, not English code that was later translated. The current dataset reflects an earlier Phase 2 attempt to assemble this corpus; community contributions were insufficient for stable training, so cond-4 was not evaluated in either Phase 2 or Phase 3. Cond-5's fully-translated data served as Phase 3's practical proxy because gathering native-authored code at scale proved difficult. Direct contributions to the cond-4 corpus are open at the [`legesher/legesher-native-code`](https://huggingface.co/spaces/legesher/legesher-native-code) HF Space.
|
| 1019 |
+
|
| 1020 |
+
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.
|
| 1021 |
|
| 1022 |
| Column | Type | Description |
|
| 1023 |
| -------------- | ------- | -------------------------------------------------------------- |
|
|
|
|
| 1034 |
|
| 1035 |
## Experimental Conditions
|
| 1036 |
|
| 1037 |
+
The Language Decoded experiment uses a ladder of conditions to isolate the mechanism behind code's reasoning benefit. For the full ladder including future directions, see [legesher/language-decoded-experiments](https://huggingface.co/datasets/legesher/language-decoded-experiments).
|
| 1038 |
|
| 1039 |
+
| Condition | Name | Purpose |
|
| 1040 |
+
| ----------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| 1041 |
+
| Baseline | No fine-tuning | Establishes the performance floor |
|
| 1042 |
+
| Condition 1 | English code | Tests whether code fine-tuning helps at all (replicates Aryabumi et al.) |
|
| 1043 |
+
| Condition 2 | Reserved-Word Translation (Legesher) | Tests whether translating Python's reserved words (keywords, exceptions, built-in functions, numerical system for some target languages) into the target language matters |
|
| 1044 |
+
| Condition 3 | Mixed Native Sources | Tests whether code pulled from real-world public-source repositories (humans actually writing in the target language) adds value beyond Legesher's mechanical translation |
|
| 1045 |
+
| Condition 4 | Community-Contributed Native Code | Tests whether code whose problem-solving logic is itself native (not translated from English) carries unique signal — pending sufficient community contributions |
|
| 1046 |
+
| Condition 5 | Synthesized Native Code | Tests whether full translation (Legesher reserved words + `c4ai-aya-expanse-32b` full file translation) changes the picture relative to Condition 2's partial translation |
|
| 1047 |
|
| 1048 |
### The Experimental Ladder
|
| 1049 |
|
| 1050 |
+
- **Baseline → 1**: Does code help at all?
|
| 1051 |
+
- **1 → 2**: Does the language Python is _written in_ matter? (Cond-2 translates Python's reserved words; user logic preserved.)
|
| 1052 |
+
- **2 → 3**: Does code humans actually wrote in or with the target language add value beyond Legesher's mechanical translation?
|
| 1053 |
+
- **2 → 5**: Cond-2 translates only Python's reserved words; cond-5 goes further by also translating identifiers, comments, docstrings, and string literals via `c4ai-aya-expanse-32b`. Logic preserved. Does full translation produce different effects than partial translation?
|
| 1054 |
+
- **3 → 5** (implicit): Human-authored vs. machine-synthesized native code.
|
| 1055 |
|
| 1056 |
## Usage
|
| 1057 |
|
|
|
|
| 1070 |
# Load 5k subset (for QLoRA fine-tuning)
|
| 1071 |
ds = load_dataset("legesher/language-decoded-data", "condition-1-en-5k")
|
| 1072 |
|
| 1073 |
+
# Load Legesher-transpiled variants (reserved-word translation)
|
| 1074 |
ds = load_dataset("legesher/language-decoded-data", "condition-2-zh-5k")
|
| 1075 |
ds = load_dataset("legesher/language-decoded-data", "condition-2-es-5k")
|
| 1076 |
ds = load_dataset("legesher/language-decoded-data", "condition-2-ur-5k")
|
|
|
|
| 1114 |
- **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.
|
| 1115 |
- **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.
|
| 1116 |
- **Single programming language**: Currently limited to Python. Results may not generalize to other programming languages.
|
| 1117 |
+
- **Condition 4 not yet evaluated**: Community contributions to the [`legesher/legesher-native-code`](https://huggingface.co/spaces/legesher/legesher-native-code) HF Space have been insufficient for stable training. The existing `condition-4-zh-5k` data is a Phase 2 attempt limited to publicly available sources (The Stack, Wenyan, Program-in-Chinese, Qi, Mulan). Cond-5's fully-translated data served as the Phase 3 practical proxy for cond-4's "logic in the target language" goal.
|
| 1118 |
- **Condition 5 is raw model output**: The `condition-5-*` configs contain prompt-leakage contamination -- translator-model preamble text, JSON wrappers, and explanation commentary leaked into string literals and identifier names, in AST-valid and AST-invalid rows alike. Cleaned configs will be published separately. See the note at the top of this card.
|
| 1119 |
|
| 1120 |
## Citation
|
| 1121 |
|
| 1122 |
```bibtex
|
| 1123 |
@misc{language-decoded-2026,
|
| 1124 |
+
title={Language Decoded: Exploring the Impact of Native Code on Multilingual Models},
|
| 1125 |
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},
|
| 1126 |
year={2026},
|
| 1127 |
publisher={Hugging Face},
|