enseven commited on
Commit
e4d2d92
·
verified ·
1 Parent(s): a8cc99b

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +0 -6
  2. README.md +170 -0
  3. data/kodcode-lfm2.5.parquet +3 -0
.gitattributes CHANGED
@@ -1,6 +1,5 @@
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.avro filter=lfs diff=lfs merge=lfs -text
4
  *.bin filter=lfs diff=lfs merge=lfs -text
5
  *.bz2 filter=lfs diff=lfs merge=lfs -text
6
  *.ckpt filter=lfs diff=lfs merge=lfs -text
@@ -36,25 +35,20 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
36
  *.zip filter=lfs diff=lfs merge=lfs -text
37
  *.zst filter=lfs diff=lfs merge=lfs -text
38
  *tfevents* filter=lfs diff=lfs merge=lfs -text
39
- # Audio files - uncompressed
40
  *.pcm filter=lfs diff=lfs merge=lfs -text
41
  *.sam filter=lfs diff=lfs merge=lfs -text
42
  *.raw filter=lfs diff=lfs merge=lfs -text
43
- # Audio files - compressed
44
  *.aac filter=lfs diff=lfs merge=lfs -text
45
  *.flac filter=lfs diff=lfs merge=lfs -text
46
  *.mp3 filter=lfs diff=lfs merge=lfs -text
47
  *.ogg filter=lfs diff=lfs merge=lfs -text
48
  *.wav filter=lfs diff=lfs merge=lfs -text
49
- # Image files - uncompressed
50
  *.bmp filter=lfs diff=lfs merge=lfs -text
51
  *.gif filter=lfs diff=lfs merge=lfs -text
52
  *.png filter=lfs diff=lfs merge=lfs -text
53
  *.tiff filter=lfs diff=lfs merge=lfs -text
54
- # Image files - compressed
55
  *.jpg filter=lfs diff=lfs merge=lfs -text
56
  *.jpeg filter=lfs diff=lfs merge=lfs -text
57
  *.webp filter=lfs diff=lfs merge=lfs -text
58
- # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
 
3
  *.bin filter=lfs diff=lfs merge=lfs -text
4
  *.bz2 filter=lfs diff=lfs merge=lfs -text
5
  *.ckpt filter=lfs diff=lfs merge=lfs -text
 
35
  *.zip filter=lfs diff=lfs merge=lfs -text
36
  *.zst filter=lfs diff=lfs merge=lfs -text
37
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
38
  *.pcm filter=lfs diff=lfs merge=lfs -text
39
  *.sam filter=lfs diff=lfs merge=lfs -text
40
  *.raw filter=lfs diff=lfs merge=lfs -text
 
41
  *.aac filter=lfs diff=lfs merge=lfs -text
42
  *.flac filter=lfs diff=lfs merge=lfs -text
43
  *.mp3 filter=lfs diff=lfs merge=lfs -text
44
  *.ogg filter=lfs diff=lfs merge=lfs -text
45
  *.wav filter=lfs diff=lfs merge=lfs -text
 
46
  *.bmp filter=lfs diff=lfs merge=lfs -text
47
  *.gif filter=lfs diff=lfs merge=lfs -text
48
  *.png filter=lfs diff=lfs merge=lfs -text
49
  *.tiff filter=lfs diff=lfs merge=lfs -text
 
50
  *.jpg filter=lfs diff=lfs merge=lfs -text
51
  *.jpeg filter=lfs diff=lfs merge=lfs -text
52
  *.webp filter=lfs diff=lfs merge=lfs -text
 
53
  *.mp4 filter=lfs diff=lfs merge=lfs -text
54
  *.webm filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,173 @@
1
  ---
 
 
2
  license: cc-by-nc-4.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
  license: cc-by-nc-4.0
5
+ size_categories:
6
+ - 100K<n<1M
7
+ dataset_info:
8
+ features:
9
+ - name: text
10
+ dtype: string
11
+ - name: format
12
+ dtype: string
13
+ - name: subset
14
+ dtype: string
15
+ - name: question_id
16
+ dtype: string
17
+ splits:
18
+ - name: train
19
+ num_examples: 268211
20
+ download_size: 463470592
21
+ dataset_size: 1085161053
22
+ task_categories:
23
+ - question-answering
24
+ tags:
25
+ - code
26
+ - synthetic
27
+ - sft
28
+ pretty_name: KodCode LFM2.5
29
  ---
30
+
31
+ # KodCode LFM2.5
32
+
33
+ A preprocessed version of [KodCode-V1-SFT-R1](https://huggingface.co/datasets/KodCode/KodCode-V1-SFT-R1)
34
+ formatted for fine-tuning [LFM2.5-1.2B-Thinking](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Thinking)
35
+ with a 70% code-only / 30% CoT (chain-of-thought) mix.
36
+
37
+ ## Dataset Description
38
+
39
+ - **Homepage:** [KodCode Project](https://kodcode-ai.github.io/)
40
+ - **Original paper:** [KodCode: A Diverse, Challenging, and Verifiable Synthetic Dataset for Coding](https://arxiv.org/abs/2503.02951)
41
+ - **Original dataset:** [KodCode/KodCode-V1-SFT-R1](https://huggingface.co/datasets/KodCode/KodCode-V1-SFT-R1)
42
+ - **Points of contact:** [Zhangchen Xu](mailto:zxu9@uw.edu) (original authors)
43
+
44
+ ### Dataset Summary
45
+
46
+ This dataset is derived from KodCode-V1-SFT-R1 (CC BY-NC 4.0). For each of the 268,211 training
47
+ rows, the question-answer pair is formatted into a flat chat template string using
48
+ `<|im_start|>` / `<|im_end|>` markers and a `<|startoftext|>` prefix — the native format for
49
+ LFM2.5-1.2B-Thinking.
50
+
51
+ Each row is assigned to one of two formats:
52
+
53
+ - **code-only (70%):** `question` → `r1_solution` (code response, no thinking trace)
54
+ - **CoT (30%):** `question` → `conversations[-1]["value"]` (full response with `<think>` reasoning)
55
+
56
+ The CoT selection is limited to texts ≤ 15,000 characters (guaranteed to fit within 4096 tokens
57
+ at the observed minimum char-to-token ratio of 2.70).
58
+
59
+ ### Changes from the Original
60
+
61
+ 1. **Format conversion:** Original `conversations` field (list of `from`/`value` dicts) is flattened
62
+ into a single `text` string with `<|im_start|>` / `<|im_end|>` chat template.
63
+ 2. **Format selection:** Each row is assigned either `code-only` or `cot` format at a 70/30 ratio
64
+ (controlled random per shard).
65
+ 3. **Char pre-filtering:** CoT texts exceeding 15,000 characters fall back to code-only format
66
+ (instead of being dropped), since only ~50% of CoT texts fit within 4096 tokens.
67
+ 4. **Reduced columns:** Only 4 columns are kept: `text`, `format`, `subset`, `question_id`.
68
+
69
+ ## Data Fields
70
+
71
+ | Field | Type | Description |
72
+ |---|---|---|
73
+ | `text` | `string` | Flattened chat text: `<\|startoftext\|><\|im_start\|>user\n{question}<\|im_end\|>\n<\|im_start\|>assistant\n{answer}<\|im_end\|>\n` |
74
+ | `format` | `string` | `"code-only"` or `"cot"` |
75
+ | `subset` | `string` | Original KodCode subset (e.g. `"Leetcode"`, `"Codeforces"`, `"Taco"`, etc.) |
76
+ | `question_id` | `string` | Original question identifier from KodCode |
77
+
78
+ ### Column mapping to original dataset
79
+
80
+ | This dataset | KodCode-V1-SFT-R1 |
81
+ |---|---|
82
+ | `text` (code-only) | `question` + `r1_solution` formatted with chat template |
83
+ | `text` (CoT) | `question` + `conversations[-1]["value"]` formatted with chat template |
84
+ | `subset` | `subset` |
85
+ | `question_id` | `question_id` |
86
+ | *(omitted)* | `solution`, `test`, `test_info`, `version`, `style`, `metadata`, `r1_pass_sequence`, `r1_correctness`, `gpt_pass_sequence`, `gpt_difficulty`, `gpt_pass_percentage`, `conversations` |
87
+
88
+ ## Data Splits
89
+
90
+ | Split | Size |
91
+ |---|---|
92
+ | `train` | 268,211 rows |
93
+
94
+ ## Usage
95
+
96
+ ### Load with HuggingFace Datasets
97
+
98
+ ```python
99
+ from datasets import load_dataset
100
+
101
+ ds = load_dataset("kodcode_dataset", split="train")
102
+ # or from parquet directly:
103
+ ds = Dataset.from_parquet("kodcode_dataset/data/kodcode-lfm2.5.parquet")
104
+ ```
105
+
106
+ ### Load for SFT training (TRL)
107
+
108
+ ```python
109
+ from trl import SFTTrainer
110
+
111
+ trainer = SFTTrainer(
112
+ ...,
113
+ train_dataset=ds,
114
+ dataset_text_field="text",
115
+ max_seq_length=4096,
116
+ packing=True,
117
+ )
118
+ ```
119
+
120
+ ### Subset distribution
121
+
122
+ ```python
123
+ print(ds.to_pandas()["subset"].value_counts())
124
+ ```
125
+
126
+ ### Format distribution
127
+
128
+ ```python
129
+ print(ds.to_pandas()["format"].value_counts())
130
+ # code-only 187824
131
+ # cot 80387
132
+ ```
133
+
134
+ ## Statistics
135
+
136
+ | Metric | Value |
137
+ |---|---|
138
+ | Total rows | 268,211 |
139
+ | Code-only rows | 187,824 (70.0%) |
140
+ | CoT rows | 80,387 (30.0%) |
141
+ | Total characters | ~1.09B |
142
+ | Text length (mean) | 4,046 chars |
143
+ | Text length (median) | 2,130 chars |
144
+ | Text length (max) | 15,000 chars |
145
+ | Output size (parquet) | 442 MB |
146
+
147
+ ## Citation
148
+
149
+ If you use this dataset, please cite the original KodCode work:
150
+
151
+ ```bibtex
152
+ @article{xu2025kodcode,
153
+ title={KodCode: A Diverse, Challenging, and Verifiable Synthetic Dataset for Coding},
154
+ author={Zhangchen Xu and Yang Liu and Yueqin Yin and Mingyuan Zhou and Radha Poovendran},
155
+ year={2025},
156
+ eprint={2503.02951},
157
+ archivePrefix={arXiv},
158
+ primaryClass={cs.LG},
159
+ url={https://arxiv.org/abs/2503.02951},
160
+ }
161
+ ```
162
+
163
+ ## License
164
+
165
+ This dataset is derived from [KodCode-V1-SFT-R1](https://huggingface.co/datasets/KodCode/KodCode-V1-SFT-R1)
166
+ and is distributed under the same **CC BY-NC 4.0** license.
167
+
168
+ - **Attribution:** You must give appropriate credit to the original KodCode authors.
169
+ - **NonCommercial:** You may not use the material for commercial purposes.
170
+ - **No additional restrictions:** You may not apply legal terms that restrict others from doing
171
+ anything the license permits.
172
+
173
+ See the [full license text](https://creativecommons.org/licenses/by-nc/4.0/) for details.
data/kodcode-lfm2.5.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d370d84f0d6ee00e01330355dee7699c34f821c579d7cb5b3a4964d22637d0f1
3
+ size 463016927