--- 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 **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. > **⚠️ Note on the `condition-5-*` (model-translated) configs — raw, pre-cleanup:** The `condition-5-{ur,zh,es}-5k-c4ai-aya-expanse-32b` configs are **raw LLM translation output** and carry known prompt-leakage contamination: translator-model preamble text, ` ```json ` wrappers, and `Explanation:` / `Explicación:` / `解释:` commentary that leaked into string literals and identifier names. This affects rows that parse as valid Python as well as rows that do not. These rows are intentionally retained as-generated to support cleanup research; cleaned configs will be published separately. Treat `condition-5-*` as raw data. 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, strictly native Chinese code, and a model-translated set in which an LLM translates the full source (identifiers, strings, and comments, not just keywords). 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). Conditions 3 and 4 additionally draw on natively-authored code (see those conditions below). Source files are 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 Conditions 1--2 are available in three current Phase 3 sizes: `-103k` full corpora, `-20k` random subsets sampled from the corresponding `-103k` config with seed 42, and `-5k` compact subsets. Phase 2 `-32k` configs are still available with the `phase-2-the-stack-v1-*` prefix. Condition 5 (`condition-5-*-c4ai-aya-expanse-32b`) is the model-translated set — currently `5k` only, and raw/pre-cleanup (see the note above). | Config | Condition | Language | Description | Train | Val | | ------------------------- | ----------- | -------- | ------------------------------------------------ | ------ | ------ | | `condition-1-en-103k` | 1 (control) | English | Unmodified filtered Python | 93,549 | 10,395 | | `condition-1-en-20k` | 1 (control) | English | Random 20k subset of `condition-1-en-103k` | 18,000 | 2,000 | | `condition-1-en-5k` | 1 (control) | English | Compact 5k subset | 4,500 | 500 | | `condition-2-zh-103k` | 2 | Chinese | Keyword-swapped Python via Legesher v0.7.3 | 93,547 | 10,395 | | `condition-2-zh-20k` | 2 | Chinese | Random 20k subset of `condition-2-zh-103k` | 18,000 | 2,000 | | `condition-2-zh-5k` | 2 | Chinese | Compact 5k subset | 4,500 | 500 | | `condition-2-es-103k` | 2 | Spanish | Keyword-swapped Python via Legesher v0.7.3 | 93,547 | 10,395 | | `condition-2-es-20k` | 2 | Spanish | Random 20k subset of `condition-2-es-103k` | 18,000 | 2,000 | | `condition-2-es-5k` | 2 | Spanish | Compact 5k subset | 4,500 | 500 | | `condition-2-ur-103k` | 2 | Urdu | Keyword-swapped Python via Legesher v0.7.3 | 93,547 | 10,395 | | `condition-2-ur-20k` | 2 | Urdu | Random 20k subset of `condition-2-ur-103k` | 18,000 | 2,000 | | `condition-2-ur-5k` | 2 | Urdu | Compact 5k subset | 4,500 | 500 | | `condition-3-zh-5k` | 3 | Chinese | Blended: native Chinese code + transpiled Python | 4,500 | 500 | | `condition-4-zh-5k` | 4 | Chinese | Strictly native Chinese code | 6,553 | 729 | | `condition-5-ur-5k-c4ai-aya-expanse-32b` | 5 | Urdu | Model-translated (full LLM translation via Cohere Aya) — raw, pre-cleanup | 4,088 | 381 | | `condition-5-zh-5k-c4ai-aya-expanse-32b` | 5 | Chinese | Model-translated (full LLM translation via Cohere Aya) — raw, pre-cleanup | 4,052 | 381 | | `condition-5-es-5k-c4ai-aya-expanse-32b` | 5 | Spanish | Model-translated (full LLM translation via Cohere Aya) — raw, pre-cleanup | 4,032 | 329 | ## 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 source dataset. | | `license` | string | SPDX license identifier for the source file. | | `token_count` | int64 | Token count computed using the CohereLabs/tiny-aya-base tokenizer. | ### Condition 5 Used by: `condition-5-ur-5k-c4ai-aya-expanse-32b`, `condition-5-zh-5k-c4ai-aya-expanse-32b`, `condition-5-es-5k-c4ai-aya-expanse-32b` Condition 5 uses the conditions 1--2 schema plus an `idx` column. `code` is the full LLM-translated source (identifiers, strings, comments, and keywords); `code_en` is the English original. These configs are raw model output — see the note at the top of this card. | Column | Type | Description | | ------------- | ------ | ------------------------------------------------------------------------------------- | | `code` | string | Model-translated Python source (full LLM translation via Cohere Aya). | | `code_en` | string | Original English Python source code. | | `language` | string | ISO 639-1 language code: `ur`, `zh`, or `es`. | | `file_path` | string | Original file path in the source dataset. | | `license` | string | SPDX license identifier for the source file. | | `idx` | int64 | Source row index into `condition-1-en-5k`. Enables row-level joins across conditions. | | `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 | | Condition 5 | Model-translated code | Tests whether full LLM translation (identifiers, strings, comments -- not just keywords) changes the reasoning benefit, relative to Condition 2's keyword-only swap | ### 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-103k") # Load random 20k subsets ds = load_dataset("legesher/language-decoded-data", "condition-1-en-20k") ds = load_dataset("legesher/language-decoded-data", "condition-2-zh-20k") ds = load_dataset("legesher/language-decoded-data", "condition-2-es-20k") ds = load_dataset("legesher/language-decoded-data", "condition-2-ur-20k") # 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") # Load model-translated code (condition 5 -- raw, pre-cleanup) ds = load_dataset("legesher/language-decoded-data", "condition-5-ur-5k-c4ai-aya-expanse-32b") ds = load_dataset("legesher/language-decoded-data", "condition-5-zh-5k-c4ai-aya-expanse-32b") ds = load_dataset("legesher/language-decoded-data", "condition-5-es-5k-c4ai-aya-expanse-32b") # 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 (Phase 3, `condition-*`) | [bigcode/the-stack-v2-dedup](https://huggingface.co/datasets/bigcode/the-stack-v2-dedup) (Python subset) | | Source dataset (Phase 2, `phase-2-the-stack-v1-*`) | [bigcode/the-stack](https://huggingface.co/datasets/bigcode/the-stack) (The Stack v1) | | 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) | | Condition 5 translation model | Cohere `c4ai-aya-expanse-32b` (Aya Expanse 32B, via the Cohere API) | | 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 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. - **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. ## 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-v2-dedup](https://huggingface.co/datasets/bigcode/the-stack-v2-dedup) (Phase 3 source) - [bigcode/the-stack](https://huggingface.co/datasets/bigcode/the-stack) (The Stack v1 — Phase 2 source) - [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