Datasets:
Update LifeStreamingCoT to v0.3 selective concise reasoning
Browse files- README.md +149 -81
- data/eval.jsonl +2 -2
- data/eval.parquet +2 -2
- data/train.jsonl +2 -2
- data/train.parquet +2 -2
- dataset_info.json +58 -41
- samples_for_review.jsonl +0 -0
- scripts/build_life_streaming_cot.py +0 -0
- scripts/upload_to_hf.py +30 -4
- scripts/validate_dataset.py +164 -11
README.md
CHANGED
|
@@ -3,12 +3,13 @@ pretty_name: LifeStreamingCoT
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
license: apache-2.0
|
| 6 |
-
version: "
|
| 7 |
task_categories:
|
| 8 |
- text-generation
|
| 9 |
tags:
|
| 10 |
- streaming-reasoning
|
| 11 |
-
-
|
|
|
|
| 12 |
- supervised-fine-tuning
|
| 13 |
- sft
|
| 14 |
- dialogue
|
|
@@ -21,136 +22,203 @@ size_categories:
|
|
| 21 |
|
| 22 |
# LifeStreamingCoT
|
| 23 |
|
| 24 |
-
Version: v0.
|
| 25 |
|
| 26 |
## Dataset Summary
|
| 27 |
|
| 28 |
-
LifeStreamingCoT is a text-only, life-scenario adaptation of StreamingCoT-style data for StreamingThinker-style supervised fine-tuning. It
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
v0.2
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
Each row contains:
|
| 43 |
|
| 44 |
-
- `id`
|
| 45 |
-
- `domain`
|
| 46 |
-
- `source_dataset`
|
| 47 |
-
- `instruction`
|
| 48 |
-
- `
|
| 49 |
-
- `
|
| 50 |
-
- `streaming_reasoning`
|
| 51 |
-
- `deep_reasoning`
|
| 52 |
-
- `answer`
|
| 53 |
-
- `response`
|
| 54 |
-
- `messages`
|
| 55 |
-
- `text`
|
| 56 |
-
- `num_chunks`
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
## Source Datasets
|
| 73 |
|
| 74 |
Used sources:
|
| 75 |
|
| 76 |
-
- `b-mc2/wikihow_lists`:
|
| 77 |
-
- `pietrolesci/multiwoz_all_versions`:
|
| 78 |
- `pixelsandpointers/better_daily_dialog`: 3722 rows, domain `daily_dialogue`
|
| 79 |
- `pixelsandpointers/empathetic_dialogues_for_lm`: 2000 rows, domain `emotional_support`
|
| 80 |
|
| 81 |
Skipped sources:
|
| 82 |
|
| 83 |
-
-
|
| 84 |
|
| 85 |
## Splits
|
| 86 |
|
| 87 |
-
- Train:
|
| 88 |
-
- Eval:
|
| 89 |
-
- Total:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
## Quality Flags
|
| 92 |
|
| 93 |
-
- `copied_source_response`:
|
| 94 |
-
- `
|
| 95 |
-
- `
|
| 96 |
-
- `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
## Example
|
| 101 |
|
| 102 |
```json
|
| 103 |
{
|
| 104 |
-
"id": "
|
| 105 |
-
"domain": "
|
| 106 |
-
"source_dataset": "
|
| 107 |
-
"instruction": "
|
| 108 |
-
"context": "Chunk 1:
|
| 109 |
"context_chunks": [
|
| 110 |
-
"
|
| 111 |
-
"
|
| 112 |
-
"
|
| 113 |
-
"I
|
| 114 |
-
"
|
| 115 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
],
|
| 117 |
-
"streaming_reasoning": "
|
| 118 |
-
"deep_reasoning": "
|
| 119 |
-
"answer": "
|
| 120 |
-
"response": "Streaming reasoning:
|
| 121 |
"messages": [
|
| 122 |
{
|
| 123 |
"role": "user",
|
| 124 |
-
"content": "Instruction:
|
| 125 |
},
|
| 126 |
{
|
| 127 |
"role": "assistant",
|
| 128 |
-
"content": "Streaming reasoning:
|
| 129 |
}
|
| 130 |
],
|
| 131 |
-
"text": "<|user|>\nInstruction:
|
| 132 |
-
"num_chunks":
|
| 133 |
"language": "en",
|
| 134 |
"split": "train",
|
| 135 |
-
"generation_method": "source_grounded_rule_based_v0.
|
| 136 |
-
"quality_flags": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
}
|
| 138 |
```
|
| 139 |
|
| 140 |
-
## Quality Filtering
|
| 141 |
-
|
| 142 |
-
The build script removes exact duplicate training texts, filters obvious personal contact information, skips unsafe categories such as self-harm, explicit sexual content, weapon construction, illegal drugs, and safety-critical expert-advice situations, and keeps chunks short to avoid long copied passages.
|
| 143 |
-
|
| 144 |
-
The `streaming_reasoning` field is synthetic supervised rationale data for research and training. It is concise, task-focused, and generated by deterministic templates rather than by exposing hidden reasoning from a proprietary model.
|
| 145 |
-
|
| 146 |
## Limitations
|
| 147 |
|
| 148 |
-
The dataset uses rule-based transformations and
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
LifeStreamingCoT is designed for general-purpose everyday assistance. It should not be used as a source of professional medical, legal, financial, mental health, emergency, or safety-critical advice. Source dataset licensing and usage terms should be reviewed before redistribution or commercial use.
|
| 153 |
|
| 154 |
## Citation / Acknowledgements
|
| 155 |
|
| 156 |
-
This dataset acknowledges the public source datasets used during construction, including
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
license: apache-2.0
|
| 6 |
+
version: "v0.3"
|
| 7 |
task_categories:
|
| 8 |
- text-generation
|
| 9 |
tags:
|
| 10 |
- streaming-reasoning
|
| 11 |
+
- selective-reasoning
|
| 12 |
+
- concise-reasoning
|
| 13 |
- supervised-fine-tuning
|
| 14 |
- sft
|
| 15 |
- dialogue
|
|
|
|
| 22 |
|
| 23 |
# LifeStreamingCoT
|
| 24 |
|
| 25 |
+
Version: v0.3
|
| 26 |
|
| 27 |
## Dataset Summary
|
| 28 |
|
| 29 |
+
LifeStreamingCoT is a text-only, life-scenario adaptation of StreamingCoT-style data for StreamingThinker-style supervised fine-tuning. It keeps a schema compatible with earlier LifeStreamingCoT releases while making the streaming rationale shorter and more realistic for low-latency interaction.
|
| 30 |
|
| 31 |
+
## Version 0.3: Selective Concise Streaming Reasoning
|
| 32 |
|
| 33 |
+
v0.2 used source-grounded rule-based streaming reasoning. v0.3 introduces selective concise streaming reasoning:
|
| 34 |
|
| 35 |
+
- Some trivial chunks are marked as `SKIP`.
|
| 36 |
+
- Long utterances are split into shorter semantic chunks.
|
| 37 |
+
- `streaming_reasoning` is state-update-like instead of paragraph-like.
|
| 38 |
+
- `deep_reasoning` is short and practical.
|
| 39 |
+
- The goal is to reduce reasoning token cost and make the dataset more realistic for low-latency streaming interaction.
|
| 40 |
|
| 41 |
+
Before, v0.2 style often looked like:
|
| 42 |
|
| 43 |
+
```text
|
| 44 |
+
After chunk 1, the user is asking for help...
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
v0.3 style:
|
| 48 |
|
| 49 |
+
```text
|
| 50 |
+
C1 goal=restaurant_search. C2 constraints+=cheap, Chinese. C3 [SKIP: thanks_only].
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Schema
|
| 54 |
|
| 55 |
Each row contains:
|
| 56 |
|
| 57 |
+
- `id`
|
| 58 |
+
- `domain`
|
| 59 |
+
- `source_dataset`
|
| 60 |
+
- `instruction`
|
| 61 |
+
- `context`
|
| 62 |
+
- `context_chunks`
|
| 63 |
+
- `streaming_reasoning`
|
| 64 |
+
- `deep_reasoning`
|
| 65 |
+
- `answer`
|
| 66 |
+
- `response`
|
| 67 |
+
- `messages`
|
| 68 |
+
- `text`
|
| 69 |
+
- `num_chunks`
|
| 70 |
+
- `language`
|
| 71 |
+
- `split`
|
| 72 |
+
- `generation_method`
|
| 73 |
+
- `quality_flags`
|
| 74 |
+
- `version`
|
| 75 |
+
- `reasoning_policy`
|
| 76 |
+
- `chunking_method`
|
| 77 |
+
- `chunk_labels`
|
| 78 |
+
- `skip_chunks`
|
| 79 |
+
- `skip_reasons`
|
| 80 |
+
- `reasoning_token_budget`
|
| 81 |
+
- `original_num_chunks`
|
| 82 |
+
- `chunk_split_count`
|
| 83 |
+
|
| 84 |
+
New v0.3 metadata fields include `version`, `reasoning_policy`, `chunking_method`, `chunk_labels`, `skip_chunks`, `skip_reasons`, `reasoning_token_budget`, `original_num_chunks`, and `chunk_split_count`.
|
| 85 |
|
| 86 |
## Source Datasets
|
| 87 |
|
| 88 |
Used sources:
|
| 89 |
|
| 90 |
+
- `b-mc2/wikihow_lists`: 626 rows, domain `how_to_guidance`
|
| 91 |
+
- `pietrolesci/multiwoz_all_versions`: 2997 rows, domain `task_oriented_assistant`
|
| 92 |
- `pixelsandpointers/better_daily_dialog`: 3722 rows, domain `daily_dialogue`
|
| 93 |
- `pixelsandpointers/empathetic_dialogues_for_lm`: 2000 rows, domain `emotional_support`
|
| 94 |
|
| 95 |
Skipped sources:
|
| 96 |
|
| 97 |
+
- None
|
| 98 |
|
| 99 |
## Splits
|
| 100 |
|
| 101 |
+
- Train: 7476
|
| 102 |
+
- Eval: 1869
|
| 103 |
+
- Total: 9345
|
| 104 |
+
|
| 105 |
+
## Statistics
|
| 106 |
+
|
| 107 |
+
- Average chunks: 7.55
|
| 108 |
+
- Average original chunks: 4.75
|
| 109 |
+
- Average chunk split count: 2.80
|
| 110 |
+
- Average streaming reasoning words: 27.51
|
| 111 |
+
- Average deep reasoning words: 14.96
|
| 112 |
+
- Skip chunk ratio: 0.1914
|
| 113 |
+
- Examples with at least one skip: 6587
|
| 114 |
|
| 115 |
## Quality Flags
|
| 116 |
|
| 117 |
+
- `copied_source_response`: 457
|
| 118 |
+
- `excessive_chunking`: 640
|
| 119 |
+
- `low_specificity`: 308
|
| 120 |
+
- `no_skip_labels`: 4
|
| 121 |
+
- `possible_slot_error`: 42
|
| 122 |
+
- `too_many_skips`: 18
|
| 123 |
+
- `weak_context`: 16
|
| 124 |
+
|
| 125 |
+
v0.3 quality flags may include `long_streaming_reasoning`, `long_deep_reasoning`, `no_skip_labels`, `too_many_skips`, `excessive_chunking`, `generic_reasoning`, `copied_source_response`, `short_answer`, `weak_context`, `possible_slot_error`, `closing_mishandled`, and `low_specificity`.
|
| 126 |
|
| 127 |
+
## Recommended Filtering
|
| 128 |
+
|
| 129 |
+
```python
|
| 130 |
+
from datasets import load_dataset
|
| 131 |
+
|
| 132 |
+
ds = load_dataset("skyzhou06/LifeStreamingCoT")
|
| 133 |
+
clean = ds.filter(lambda x: len(x["quality_flags"]) == 0)
|
| 134 |
+
concise = ds.filter(lambda x: "long_streaming_reasoning" not in x["quality_flags"])
|
| 135 |
+
reason_only = ds.filter(lambda x: x["reasoning_policy"] == "selective_concise")
|
| 136 |
+
```
|
| 137 |
|
| 138 |
## Example
|
| 139 |
|
| 140 |
```json
|
| 141 |
{
|
| 142 |
+
"id": "life_daily_dialogue_000001",
|
| 143 |
+
"domain": "daily_dialogue",
|
| 144 |
+
"source_dataset": "pixelsandpointers/better_daily_dialog",
|
| 145 |
+
"instruction": "Help the user complete a real-life task based on gradually revealed information.",
|
| 146 |
+
"context": "Chunk 1: Thanks for the advice , Mr .\nChunk 2: Macmillan .\nChunk 3: I'll keep it in mind .\nChunk 4: I had better head off though .\nChunk 5: I ’ m meeting my husband for dinner .\nChunk 6: Sure , I'm heading out myself .\nChunk 7: Enjoy your evening .\nChunk 8: Thanks , sir .\nChunk 9: You too .\nChunk 10: Drive safely , I hear there ’ s a lot ice on the roads .",
|
| 147 |
"context_chunks": [
|
| 148 |
+
"Thanks for the advice , Mr .",
|
| 149 |
+
"Macmillan .",
|
| 150 |
+
"I'll keep it in mind .",
|
| 151 |
+
"I had better head off though .",
|
| 152 |
+
"I ’ m meeting my husband for dinner .",
|
| 153 |
+
"Sure , I'm heading out myself .",
|
| 154 |
+
"Enjoy your evening .",
|
| 155 |
+
"Thanks , sir .",
|
| 156 |
+
"You too .",
|
| 157 |
+
"Drive safely , I hear there ’ s a lot ice on the roads ."
|
| 158 |
],
|
| 159 |
+
"streaming_reasoning": "C1 [SKIP: thanks_only]. C2 [SKIP: low_information]. C3 topic=i'll, keep. C4 topic=better, head. C5 social_intent=invitation. C6 agreement=true. C7 topic=enjoy, evening. C8 [SKIP: thanks_only]. C9 [SKIP: low_information]. C10 topic=drive, safely.",
|
| 160 |
+
"deep_reasoning": "Conversation is closing after a simple social exchange; answer politely.",
|
| 161 |
+
"answer": "Sounds good. Take care, and see you next time.",
|
| 162 |
+
"response": "Streaming reasoning: C1 [SKIP: thanks_only]. C2 [SKIP: low_information]. C3 topic=i'll, keep. C4 topic=better, head. C5 social_intent=invitation. C6 agreement=true. C7 topic=enjoy, evening. C8 [SKIP: thanks_only]. C9 [SKIP: low_information]. C10 topic=drive, safely.\n\nDeep reasoning: Conversation is closing after a simple social exchange; answer politely.\n\nAnswer: Sounds good. Take care, and see you next time.",
|
| 163 |
"messages": [
|
| 164 |
{
|
| 165 |
"role": "user",
|
| 166 |
+
"content": "Instruction: Help the user complete a real-life task based on gradually revealed information.\n\nContext:\nChunk 1: Thanks for the advice , Mr .\nChunk 2: Macmillan .\nChunk 3: I'll keep it in mind .\nChunk 4: I had better head off though .\nChunk 5: I ’ m meeting my husband for dinner .\nChunk 6: Sure , I'm heading out myself .\nChunk 7: Enjoy your evening .\nChunk 8: Thanks , sir .\nChunk 9: You too .\nChunk 10: Drive safely , I hear there ’ s a lot ice on the roads ."
|
| 167 |
},
|
| 168 |
{
|
| 169 |
"role": "assistant",
|
| 170 |
+
"content": "Streaming reasoning: C1 [SKIP: thanks_only]. C2 [SKIP: low_information]. C3 topic=i'll, keep. C4 topic=better, head. C5 social_intent=invitation. C6 agreement=true. C7 topic=enjoy, evening. C8 [SKIP: thanks_only]. C9 [SKIP: low_information]. C10 topic=drive, safely.\n\nDeep reasoning: Conversation is closing after a simple social exchange; answer politely.\n\nAnswer: Sounds good. Take care, and see you next time."
|
| 171 |
}
|
| 172 |
],
|
| 173 |
+
"text": "<|user|>\nInstruction: Help the user complete a real-life task based on gradually revealed information.\n\nContext:\nChunk 1: Thanks for the advice , Mr .\nChunk 2: Macmillan .\nChunk 3: I'll keep it in mind .\nChunk 4: I had better head off though .\nChunk 5: I ’ m meeting my husband for dinner .\nChunk 6: Sure , I'm heading out myself .\nChunk 7: Enjoy your evening .\nChunk 8: Thanks , sir .\nChunk 9: You too .\nChunk 10: Drive safely , I hear there ’ s a lot ice on the roads .\n<|assistant|>\nStreaming reasoning: C1 [SKIP: thanks_only]. C2 [SKIP: low_information]. C3 topic=i'll, keep. C4 topic=better, head. C5 social_intent=invitation. C6 agreement=true. C7 topic=enjoy, evening. C8 [SKIP: thanks_only]. C9 [SKIP: low_information]. C10 topic=drive, safely.\n\nDeep reasoning: Conversation is closing after a simple social exchange; answer politely.\n\nAnswer: Sounds good. Take care, and see you next time.",
|
| 174 |
+
"num_chunks": 10,
|
| 175 |
"language": "en",
|
| 176 |
"split": "train",
|
| 177 |
+
"generation_method": "source_grounded_rule_based_v0.3_selective_concise",
|
| 178 |
+
"quality_flags": [],
|
| 179 |
+
"version": "v0.3",
|
| 180 |
+
"reasoning_policy": "selective_concise",
|
| 181 |
+
"chunking_method": "semantic_sentence_split_v0.3",
|
| 182 |
+
"chunk_labels": [
|
| 183 |
+
"skip",
|
| 184 |
+
"skip",
|
| 185 |
+
"reason",
|
| 186 |
+
"reason",
|
| 187 |
+
"reason",
|
| 188 |
+
"reason",
|
| 189 |
+
"reason",
|
| 190 |
+
"skip",
|
| 191 |
+
"skip",
|
| 192 |
+
"reason"
|
| 193 |
+
],
|
| 194 |
+
"skip_chunks": [
|
| 195 |
+
1,
|
| 196 |
+
2,
|
| 197 |
+
8,
|
| 198 |
+
9
|
| 199 |
+
],
|
| 200 |
+
"skip_reasons": {
|
| 201 |
+
"1": "thanks_only",
|
| 202 |
+
"2": "low_information",
|
| 203 |
+
"8": "thanks_only",
|
| 204 |
+
"9": "low_information"
|
| 205 |
+
},
|
| 206 |
+
"reasoning_token_budget": {
|
| 207 |
+
"streaming_reasoning_max_words_per_chunk": 18,
|
| 208 |
+
"deep_reasoning_max_words": 45,
|
| 209 |
+
"answer_max_sentences": 3
|
| 210 |
+
},
|
| 211 |
+
"original_num_chunks": 3,
|
| 212 |
+
"chunk_split_count": 7
|
| 213 |
}
|
| 214 |
```
|
| 215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
## Limitations
|
| 217 |
|
| 218 |
+
- The dataset uses rule-based transformations and should be inspected before high-stakes or production use.
|
| 219 |
+
- Skip labels and semantic chunks are heuristic and can be imperfect.
|
| 220 |
+
- It is not a medical, legal, financial, emergency, or safety-critical advice dataset.
|
|
|
|
|
|
|
| 221 |
|
| 222 |
## Citation / Acknowledgements
|
| 223 |
|
| 224 |
+
This dataset acknowledges the public source datasets used during construction, including DailyDialog-style, MultiWOZ, EmpatheticDialogues-style, WikiHow-style, and related life-dialogue datasets. The format is inspired by StreamingCoT and intended for StreamingThinker-style SFT research.
|
data/eval.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a9a97c0e41aafa1b290c093da7c54a5107bc8ce3463949be277376c521d23935
|
| 3 |
+
size 8519696
|
data/eval.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d2e13f821434508c216b3b4053c7c5e0393e1d1651f4d242e28a47a876a00fa
|
| 3 |
+
size 2582829
|
data/train.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:49736fffbeb3080fafea97199d430691f78944aa56a186b629066f20cba61232
|
| 3 |
+
size 34143912
|
data/train.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d37f1f49c70dcec8ead84f96fe4d7462eefc961f309e8f3a2e3a129258c9c69b
|
| 3 |
+
size 10174551
|
dataset_info.json
CHANGED
|
@@ -1,37 +1,49 @@
|
|
| 1 |
{
|
| 2 |
"dataset_name": "LifeStreamingCoT",
|
| 3 |
"repo_id": "skyzhou06/LifeStreamingCoT",
|
| 4 |
-
"version": "
|
| 5 |
"created_by": "skyzhou06 with Codex",
|
|
|
|
|
|
|
|
|
|
| 6 |
"schema": {
|
| 7 |
-
"id": "
|
| 8 |
-
"domain": "
|
| 9 |
-
"source_dataset": "
|
| 10 |
-
"instruction": "
|
| 11 |
-
"context": "
|
| 12 |
-
"context_chunks": "
|
| 13 |
-
"streaming_reasoning": "
|
| 14 |
-
"deep_reasoning": "
|
| 15 |
-
"answer": "
|
| 16 |
-
"response": "
|
| 17 |
-
"messages": "
|
| 18 |
-
"text": "
|
| 19 |
-
"num_chunks": "
|
| 20 |
-
"language": "
|
| 21 |
-
"split": "
|
| 22 |
-
"generation_method": "
|
| 23 |
-
"quality_flags": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
},
|
| 25 |
"source_datasets_used": [
|
| 26 |
{
|
| 27 |
"name": "b-mc2/wikihow_lists",
|
| 28 |
"domain": "how_to_guidance",
|
| 29 |
-
"rows":
|
| 30 |
},
|
| 31 |
{
|
| 32 |
"name": "pietrolesci/multiwoz_all_versions",
|
| 33 |
"domain": "task_oriented_assistant",
|
| 34 |
-
"rows":
|
| 35 |
},
|
| 36 |
{
|
| 37 |
"name": "pixelsandpointers/better_daily_dialog",
|
|
@@ -44,32 +56,37 @@
|
|
| 44 |
"rows": 2000
|
| 45 |
}
|
| 46 |
],
|
| 47 |
-
"skipped_source_datasets": [
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
}
|
| 52 |
-
],
|
| 53 |
-
"total_rows": 9360,
|
| 54 |
-
"train_rows": 7488,
|
| 55 |
-
"eval_rows": 1872,
|
| 56 |
"domains": {
|
| 57 |
-
"task_oriented_assistant": 2998,
|
| 58 |
-
"emotional_support": 2000,
|
| 59 |
"daily_dialogue": 3722,
|
| 60 |
-
"
|
|
|
|
|
|
|
| 61 |
},
|
| 62 |
-
"
|
| 63 |
-
"
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
},
|
| 69 |
-
"review_samples_file": "samples_for_review.jsonl",
|
| 70 |
"limitations": [
|
| 71 |
-
"
|
|
|
|
| 72 |
"The dataset is not intended for medical, legal, financial, emergency, or safety-critical advice.",
|
| 73 |
"Source dataset licenses and terms should be reviewed before downstream redistribution or commercial use."
|
| 74 |
-
]
|
|
|
|
| 75 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"dataset_name": "LifeStreamingCoT",
|
| 3 |
"repo_id": "skyzhou06/LifeStreamingCoT",
|
| 4 |
+
"version": "v0.3",
|
| 5 |
"created_by": "skyzhou06 with Codex",
|
| 6 |
+
"generation_method": "source_grounded_rule_based_v0.3_selective_concise",
|
| 7 |
+
"reasoning_policy": "selective_concise",
|
| 8 |
+
"chunking_method": "semantic_sentence_split_v0.3",
|
| 9 |
"schema": {
|
| 10 |
+
"id": "required",
|
| 11 |
+
"domain": "required",
|
| 12 |
+
"source_dataset": "required",
|
| 13 |
+
"instruction": "required",
|
| 14 |
+
"context": "required",
|
| 15 |
+
"context_chunks": "required",
|
| 16 |
+
"streaming_reasoning": "required",
|
| 17 |
+
"deep_reasoning": "required",
|
| 18 |
+
"answer": "required",
|
| 19 |
+
"response": "required",
|
| 20 |
+
"messages": "required",
|
| 21 |
+
"text": "required",
|
| 22 |
+
"num_chunks": "required",
|
| 23 |
+
"language": "required",
|
| 24 |
+
"split": "required",
|
| 25 |
+
"generation_method": "required",
|
| 26 |
+
"quality_flags": "required",
|
| 27 |
+
"version": "required",
|
| 28 |
+
"reasoning_policy": "required",
|
| 29 |
+
"chunking_method": "required",
|
| 30 |
+
"chunk_labels": "required",
|
| 31 |
+
"skip_chunks": "required",
|
| 32 |
+
"skip_reasons": "required",
|
| 33 |
+
"reasoning_token_budget": "required",
|
| 34 |
+
"original_num_chunks": "required",
|
| 35 |
+
"chunk_split_count": "required"
|
| 36 |
},
|
| 37 |
"source_datasets_used": [
|
| 38 |
{
|
| 39 |
"name": "b-mc2/wikihow_lists",
|
| 40 |
"domain": "how_to_guidance",
|
| 41 |
+
"rows": 626
|
| 42 |
},
|
| 43 |
{
|
| 44 |
"name": "pietrolesci/multiwoz_all_versions",
|
| 45 |
"domain": "task_oriented_assistant",
|
| 46 |
+
"rows": 2997
|
| 47 |
},
|
| 48 |
{
|
| 49 |
"name": "pixelsandpointers/better_daily_dialog",
|
|
|
|
| 56 |
"rows": 2000
|
| 57 |
}
|
| 58 |
],
|
| 59 |
+
"skipped_source_datasets": [],
|
| 60 |
+
"total_rows": 9345,
|
| 61 |
+
"train_rows": 7476,
|
| 62 |
+
"eval_rows": 1869,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
"domains": {
|
|
|
|
|
|
|
| 64 |
"daily_dialogue": 3722,
|
| 65 |
+
"emotional_support": 2000,
|
| 66 |
+
"how_to_guidance": 626,
|
| 67 |
+
"task_oriented_assistant": 2997
|
| 68 |
},
|
| 69 |
+
"average_num_chunks": 7.553237025147138,
|
| 70 |
+
"average_original_num_chunks": 4.748314606741573,
|
| 71 |
+
"average_chunk_split_count": 2.8049224184055643,
|
| 72 |
+
"average_streaming_reasoning_words": 27.512038523274477,
|
| 73 |
+
"average_deep_reasoning_words": 14.956233279828785,
|
| 74 |
+
"skip_chunk_ratio": 0.1913579372387901,
|
| 75 |
+
"examples_with_at_least_one_skip": 6587,
|
| 76 |
+
"quality_flags_distribution": {
|
| 77 |
+
"copied_source_response": 457,
|
| 78 |
+
"excessive_chunking": 640,
|
| 79 |
+
"low_specificity": 308,
|
| 80 |
+
"no_skip_labels": 4,
|
| 81 |
+
"possible_slot_error": 42,
|
| 82 |
+
"too_many_skips": 18,
|
| 83 |
+
"weak_context": 16
|
| 84 |
},
|
|
|
|
| 85 |
"limitations": [
|
| 86 |
+
"v0.3 uses deterministic, source-grounded transformations rather than human-authored rationales.",
|
| 87 |
+
"Semantic chunking is heuristic and can still over-split or under-split unusual utterances.",
|
| 88 |
"The dataset is not intended for medical, legal, financial, emergency, or safety-critical advice.",
|
| 89 |
"Source dataset licenses and terms should be reviewed before downstream redistribution or commercial use."
|
| 90 |
+
],
|
| 91 |
+
"samples_for_review": "samples_for_review.jsonl"
|
| 92 |
}
|
samples_for_review.jsonl
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/build_life_streaming_cot.py
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/upload_to_hf.py
CHANGED
|
@@ -2,10 +2,12 @@
|
|
| 2 |
from __future__ import annotations
|
| 3 |
|
| 4 |
import argparse
|
|
|
|
| 5 |
import sys
|
| 6 |
from pathlib import Path
|
| 7 |
|
| 8 |
-
from huggingface_hub import HfApi
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def main() -> None:
|
|
@@ -19,22 +21,46 @@ def main() -> None:
|
|
| 19 |
print(f"Dataset folder does not exist: {folder}", file=sys.stderr)
|
| 20 |
sys.exit(1)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
api = HfApi()
|
| 23 |
try:
|
| 24 |
api.whoami()
|
| 25 |
-
except Exception: # noqa: BLE001 -
|
| 26 |
print("Hugging Face authentication is missing or invalid.")
|
| 27 |
print("Run this command, then rerun the upload:")
|
| 28 |
print("huggingface-cli login")
|
| 29 |
sys.exit(2)
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
api.upload_folder(
|
| 33 |
repo_id=args.repo_id,
|
| 34 |
repo_type="dataset",
|
| 35 |
folder_path=str(folder),
|
| 36 |
path_in_repo=".",
|
| 37 |
-
commit_message="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
)
|
| 39 |
print(f"https://huggingface.co/datasets/{args.repo_id}")
|
| 40 |
|
|
|
|
| 2 |
from __future__ import annotations
|
| 3 |
|
| 4 |
import argparse
|
| 5 |
+
import json
|
| 6 |
import sys
|
| 7 |
from pathlib import Path
|
| 8 |
|
| 9 |
+
from huggingface_hub import HfApi
|
| 10 |
+
from huggingface_hub.utils import RepositoryNotFoundError
|
| 11 |
|
| 12 |
|
| 13 |
def main() -> None:
|
|
|
|
| 21 |
print(f"Dataset folder does not exist: {folder}", file=sys.stderr)
|
| 22 |
sys.exit(1)
|
| 23 |
|
| 24 |
+
info_path = folder / "dataset_info.json"
|
| 25 |
+
if not info_path.exists():
|
| 26 |
+
print(f"Missing dataset_info.json in {folder}", file=sys.stderr)
|
| 27 |
+
sys.exit(1)
|
| 28 |
+
info = json.loads(info_path.read_text(encoding="utf-8"))
|
| 29 |
+
if info.get("version") != "v0.3":
|
| 30 |
+
print("Refusing upload: dataset_info.json is not version v0.3.", file=sys.stderr)
|
| 31 |
+
sys.exit(1)
|
| 32 |
+
if args.repo_id != "skyzhou06/LifeStreamingCoT":
|
| 33 |
+
print("Refusing upload: use the existing repo skyzhou06/LifeStreamingCoT.", file=sys.stderr)
|
| 34 |
+
sys.exit(1)
|
| 35 |
+
|
| 36 |
api = HfApi()
|
| 37 |
try:
|
| 38 |
api.whoami()
|
| 39 |
+
except Exception: # noqa: BLE001 - do not print auth internals or tokens
|
| 40 |
print("Hugging Face authentication is missing or invalid.")
|
| 41 |
print("Run this command, then rerun the upload:")
|
| 42 |
print("huggingface-cli login")
|
| 43 |
sys.exit(2)
|
| 44 |
|
| 45 |
+
try:
|
| 46 |
+
api.repo_info(repo_id=args.repo_id, repo_type="dataset")
|
| 47 |
+
except RepositoryNotFoundError:
|
| 48 |
+
print(f"Refusing upload: dataset repo does not exist: {args.repo_id}", file=sys.stderr)
|
| 49 |
+
sys.exit(1)
|
| 50 |
+
|
| 51 |
api.upload_folder(
|
| 52 |
repo_id=args.repo_id,
|
| 53 |
repo_type="dataset",
|
| 54 |
folder_path=str(folder),
|
| 55 |
path_in_repo=".",
|
| 56 |
+
commit_message="Update LifeStreamingCoT to v0.3 selective concise reasoning",
|
| 57 |
+
ignore_patterns=[
|
| 58 |
+
".DS_Store",
|
| 59 |
+
"*/.DS_Store",
|
| 60 |
+
"__pycache__",
|
| 61 |
+
"*/__pycache__/*",
|
| 62 |
+
"*.pyc",
|
| 63 |
+
],
|
| 64 |
)
|
| 65 |
print(f"https://huggingface.co/datasets/{args.repo_id}")
|
| 66 |
|
scripts/validate_dataset.py
CHANGED
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
| 4 |
import argparse
|
| 5 |
import json
|
| 6 |
import sys
|
|
|
|
| 7 |
from pathlib import Path
|
| 8 |
from typing import Any
|
| 9 |
|
|
@@ -28,6 +29,15 @@ REQUIRED_FIELDS = [
|
|
| 28 |
"split",
|
| 29 |
"generation_method",
|
| 30 |
"quality_flags",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
]
|
| 32 |
|
| 33 |
REQUIRED_STRING_FIELDS = [
|
|
@@ -44,8 +54,44 @@ REQUIRED_STRING_FIELDS = [
|
|
| 44 |
"language",
|
| 45 |
"split",
|
| 46 |
"generation_method",
|
|
|
|
|
|
|
|
|
|
| 47 |
]
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
def read_jsonl(path: Path) -> list[dict[str, Any]]:
|
| 51 |
rows: list[dict[str, Any]] = []
|
|
@@ -61,6 +107,25 @@ def read_jsonl(path: Path) -> list[dict[str, Any]]:
|
|
| 61 |
return rows
|
| 62 |
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
def validate_row(row: dict[str, Any], expected_split: str, idx: int) -> list[str]:
|
| 65 |
errors: list[str] = []
|
| 66 |
row_id = row.get("id", f"row-{idx}")
|
|
@@ -70,6 +135,14 @@ def validate_row(row: dict[str, Any], expected_split: str, idx: int) -> list[str
|
|
| 70 |
for field in REQUIRED_STRING_FIELDS:
|
| 71 |
if not isinstance(row.get(field), str) or not row.get(field, "").strip():
|
| 72 |
errors.append(f"{row_id}: empty or non-string field {field}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
chunks = row.get("context_chunks")
|
| 74 |
if not isinstance(chunks, list) or not chunks or not all(isinstance(chunk, str) and chunk.strip() for chunk in chunks):
|
| 75 |
errors.append(f"{row_id}: context_chunks must be a non-empty list of strings")
|
|
@@ -80,6 +153,40 @@ def validate_row(row: dict[str, Any], expected_split: str, idx: int) -> list[str
|
|
| 80 |
errors.append(f"{row_id}: context does not contain chunk text: {chunk[:80]}")
|
| 81 |
if row.get("num_chunks") != len(chunks):
|
| 82 |
errors.append(f"{row_id}: num_chunks does not match context_chunks length")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
messages = row.get("messages")
|
| 84 |
if not isinstance(messages, list) or len(messages) != 2:
|
| 85 |
errors.append(f"{row_id}: messages must contain exactly one user and one assistant message")
|
|
@@ -88,6 +195,7 @@ def validate_row(row: dict[str, Any], expected_split: str, idx: int) -> list[str
|
|
| 88 |
errors.append(f"{row_id}: messages roles must be user then assistant")
|
| 89 |
if not messages[0].get("content") or not messages[1].get("content"):
|
| 90 |
errors.append(f"{row_id}: message content cannot be empty")
|
|
|
|
| 91 |
response = row.get("response", "")
|
| 92 |
for marker in ["Streaming reasoning:", "Deep reasoning:", "Answer:"]:
|
| 93 |
if marker not in response:
|
|
@@ -100,6 +208,8 @@ def validate_row(row: dict[str, Any], expected_split: str, idx: int) -> list[str
|
|
| 100 |
errors.append(f"{row_id}: quality_flags must be a list")
|
| 101 |
elif not all(isinstance(flag, str) and flag.strip() for flag in row.get("quality_flags", [])):
|
| 102 |
errors.append(f"{row_id}: quality_flags must contain only non-empty strings")
|
|
|
|
|
|
|
| 103 |
return errors
|
| 104 |
|
| 105 |
|
|
@@ -110,8 +220,10 @@ def validate(data_dir: Path) -> int:
|
|
| 110 |
train_parquet = data_dir / "data" / "train.parquet"
|
| 111 |
eval_parquet = data_dir / "data" / "eval.parquet"
|
| 112 |
samples_path = data_dir / "samples_for_review.jsonl"
|
|
|
|
| 113 |
|
| 114 |
-
|
|
|
|
| 115 |
if not path.exists():
|
| 116 |
errors.append(f"missing required file: {path}")
|
| 117 |
if errors:
|
|
@@ -126,19 +238,18 @@ def validate(data_dir: Path) -> int:
|
|
| 126 |
errors.append("train.jsonl is empty")
|
| 127 |
if not eval_rows:
|
| 128 |
errors.append("eval.jsonl is empty")
|
| 129 |
-
if len(
|
| 130 |
-
errors.append(f"samples_for_review.jsonl must contain
|
| 131 |
|
| 132 |
for idx, row in enumerate(train_rows, start=1):
|
| 133 |
errors.extend(validate_row(row, "train", idx))
|
| 134 |
for idx, row in enumerate(eval_rows, start=1):
|
| 135 |
errors.extend(validate_row(row, "eval", idx))
|
| 136 |
-
sample_ids = set()
|
| 137 |
for idx, row in enumerate(sample_rows, start=1):
|
| 138 |
-
|
|
|
|
| 139 |
errors.append(f"sample row {idx}: split must be train or eval")
|
| 140 |
-
errors.extend(validate_row(row,
|
| 141 |
-
sample_ids.add(row.get("id"))
|
| 142 |
|
| 143 |
all_rows = train_rows + eval_rows
|
| 144 |
ids = [row.get("id") for row in all_rows]
|
|
@@ -149,6 +260,7 @@ def validate(data_dir: Path) -> int:
|
|
| 149 |
errors.append(f"duplicate ids found: {sorted(list(duplicate_ids))[:5]}")
|
| 150 |
if duplicate_texts:
|
| 151 |
errors.append(f"duplicate text fields found: {len(duplicate_texts)} duplicates")
|
|
|
|
| 152 |
missing_samples = sample_ids - set(ids)
|
| 153 |
if missing_samples:
|
| 154 |
errors.append(f"samples_for_review.jsonl contains ids not present in train/eval: {sorted(list(missing_samples))[:5]}")
|
|
@@ -165,17 +277,58 @@ def validate(data_dir: Path) -> int:
|
|
| 165 |
if field not in eval_df.columns:
|
| 166 |
errors.append(f"eval.parquet missing column {field}")
|
| 167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
print("Validation summary")
|
|
|
|
| 169 |
print(f"train rows: {len(train_rows)}")
|
| 170 |
print(f"eval rows: {len(eval_rows)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
print(f"review sample rows: {len(sample_rows)}")
|
| 172 |
-
print(f"total rows: {len(all_rows)}")
|
| 173 |
print(f"errors: {len(errors)}")
|
| 174 |
if errors:
|
| 175 |
-
for error in errors[:
|
| 176 |
print(f"ERROR: {error}")
|
| 177 |
-
if len(errors) >
|
| 178 |
-
print(f"ERROR: ... {len(errors) -
|
| 179 |
return 1
|
| 180 |
print("validation passed")
|
| 181 |
return 0
|
|
|
|
| 4 |
import argparse
|
| 5 |
import json
|
| 6 |
import sys
|
| 7 |
+
from collections import Counter
|
| 8 |
from pathlib import Path
|
| 9 |
from typing import Any
|
| 10 |
|
|
|
|
| 29 |
"split",
|
| 30 |
"generation_method",
|
| 31 |
"quality_flags",
|
| 32 |
+
"version",
|
| 33 |
+
"reasoning_policy",
|
| 34 |
+
"chunking_method",
|
| 35 |
+
"chunk_labels",
|
| 36 |
+
"skip_chunks",
|
| 37 |
+
"skip_reasons",
|
| 38 |
+
"reasoning_token_budget",
|
| 39 |
+
"original_num_chunks",
|
| 40 |
+
"chunk_split_count",
|
| 41 |
]
|
| 42 |
|
| 43 |
REQUIRED_STRING_FIELDS = [
|
|
|
|
| 54 |
"language",
|
| 55 |
"split",
|
| 56 |
"generation_method",
|
| 57 |
+
"version",
|
| 58 |
+
"reasoning_policy",
|
| 59 |
+
"chunking_method",
|
| 60 |
]
|
| 61 |
|
| 62 |
+
FORBIDDEN_GENERIC_PHRASES = [
|
| 63 |
+
"the user is sharing everyday context",
|
| 64 |
+
"the situation is about an everyday life situation",
|
| 65 |
+
"the assistant should stay conversational",
|
| 66 |
+
"the user is asking for help, clarification, or a next step",
|
| 67 |
+
"given the full context",
|
| 68 |
+
"visible signal",
|
| 69 |
+
"tracked constraints so far",
|
| 70 |
+
]
|
| 71 |
+
|
| 72 |
+
TRIVIAL_MARKERS = [
|
| 73 |
+
"thanks",
|
| 74 |
+
"thank you",
|
| 75 |
+
"thanks so much",
|
| 76 |
+
"thanks for your help",
|
| 77 |
+
"thanks for your help today",
|
| 78 |
+
"goodbye",
|
| 79 |
+
"bye",
|
| 80 |
+
"see you",
|
| 81 |
+
"see you later",
|
| 82 |
+
"that's all i need",
|
| 83 |
+
"that is all i need",
|
| 84 |
+
"hello",
|
| 85 |
+
"hi",
|
| 86 |
+
"okay",
|
| 87 |
+
"ok",
|
| 88 |
+
"sounds good",
|
| 89 |
+
]
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def word_count(text: str) -> int:
|
| 93 |
+
return len(str(text).split())
|
| 94 |
+
|
| 95 |
|
| 96 |
def read_jsonl(path: Path) -> list[dict[str, Any]]:
|
| 97 |
rows: list[dict[str, Any]] = []
|
|
|
|
| 107 |
return rows
|
| 108 |
|
| 109 |
|
| 110 |
+
def forbidden_phrase_hits(row: dict[str, Any]) -> int:
|
| 111 |
+
text = f"{row.get('streaming_reasoning', '')}\n{row.get('deep_reasoning', '')}".lower()
|
| 112 |
+
return sum(text.count(phrase) for phrase in FORBIDDEN_GENERIC_PHRASES)
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
def has_obvious_trivial_chunk(chunks: list[str]) -> bool:
|
| 116 |
+
for chunk in chunks:
|
| 117 |
+
normalized = " ".join(str(chunk).lower().strip(" .!?").split())
|
| 118 |
+
if normalized in TRIVIAL_MARKERS:
|
| 119 |
+
return True
|
| 120 |
+
if normalized.startswith("thanks") and len(normalized.split()) <= 6:
|
| 121 |
+
return True
|
| 122 |
+
if normalized.startswith("thank you") and len(normalized.split()) <= 6:
|
| 123 |
+
return True
|
| 124 |
+
if "that's all i need" in normalized or "that is all i need" in normalized:
|
| 125 |
+
return True
|
| 126 |
+
return False
|
| 127 |
+
|
| 128 |
+
|
| 129 |
def validate_row(row: dict[str, Any], expected_split: str, idx: int) -> list[str]:
|
| 130 |
errors: list[str] = []
|
| 131 |
row_id = row.get("id", f"row-{idx}")
|
|
|
|
| 135 |
for field in REQUIRED_STRING_FIELDS:
|
| 136 |
if not isinstance(row.get(field), str) or not row.get(field, "").strip():
|
| 137 |
errors.append(f"{row_id}: empty or non-string field {field}")
|
| 138 |
+
|
| 139 |
+
if row.get("version") != "v0.3":
|
| 140 |
+
errors.append(f"{row_id}: version must be v0.3")
|
| 141 |
+
if row.get("reasoning_policy") != "selective_concise":
|
| 142 |
+
errors.append(f"{row_id}: reasoning_policy must be selective_concise")
|
| 143 |
+
if not str(row.get("chunking_method", "")).strip():
|
| 144 |
+
errors.append(f"{row_id}: chunking_method is required")
|
| 145 |
+
|
| 146 |
chunks = row.get("context_chunks")
|
| 147 |
if not isinstance(chunks, list) or not chunks or not all(isinstance(chunk, str) and chunk.strip() for chunk in chunks):
|
| 148 |
errors.append(f"{row_id}: context_chunks must be a non-empty list of strings")
|
|
|
|
| 153 |
errors.append(f"{row_id}: context does not contain chunk text: {chunk[:80]}")
|
| 154 |
if row.get("num_chunks") != len(chunks):
|
| 155 |
errors.append(f"{row_id}: num_chunks does not match context_chunks length")
|
| 156 |
+
|
| 157 |
+
chunk_labels = row.get("chunk_labels")
|
| 158 |
+
if not isinstance(chunk_labels, list) or len(chunk_labels) != len(chunks):
|
| 159 |
+
errors.append(f"{row_id}: chunk_labels length must equal num_chunks")
|
| 160 |
+
chunk_labels = []
|
| 161 |
+
else:
|
| 162 |
+
bad_labels = [label for label in chunk_labels if label not in {"reason", "skip"}]
|
| 163 |
+
if bad_labels:
|
| 164 |
+
errors.append(f"{row_id}: chunk_labels can only contain reason or skip")
|
| 165 |
+
|
| 166 |
+
skip_chunks = row.get("skip_chunks")
|
| 167 |
+
skip_reasons = row.get("skip_reasons")
|
| 168 |
+
if not isinstance(skip_chunks, list) or not all(isinstance(item, int) for item in skip_chunks):
|
| 169 |
+
errors.append(f"{row_id}: skip_chunks must be a list of ints")
|
| 170 |
+
skip_chunks = []
|
| 171 |
+
if not isinstance(skip_reasons, dict):
|
| 172 |
+
errors.append(f"{row_id}: skip_reasons must be a dict")
|
| 173 |
+
skip_reasons = {}
|
| 174 |
+
if chunk_labels:
|
| 175 |
+
expected_skips = [i + 1 for i, label in enumerate(chunk_labels) if label == "skip"]
|
| 176 |
+
if skip_chunks != expected_skips:
|
| 177 |
+
errors.append(f"{row_id}: skip_chunks must correspond to skip labels")
|
| 178 |
+
for chunk_index in expected_skips:
|
| 179 |
+
if str(chunk_index) not in skip_reasons:
|
| 180 |
+
errors.append(f"{row_id}: missing skip_reasons entry for chunk {chunk_index}")
|
| 181 |
+
|
| 182 |
+
budget = row.get("reasoning_token_budget")
|
| 183 |
+
if not isinstance(budget, dict) or not budget:
|
| 184 |
+
errors.append(f"{row_id}: reasoning_token_budget must be a non-empty dict")
|
| 185 |
+
if not isinstance(row.get("original_num_chunks"), int) or row.get("original_num_chunks", 0) <= 0:
|
| 186 |
+
errors.append(f"{row_id}: original_num_chunks must be a positive int")
|
| 187 |
+
if not isinstance(row.get("chunk_split_count"), int) or row.get("chunk_split_count", -1) < 0:
|
| 188 |
+
errors.append(f"{row_id}: chunk_split_count must be a non-negative int")
|
| 189 |
+
|
| 190 |
messages = row.get("messages")
|
| 191 |
if not isinstance(messages, list) or len(messages) != 2:
|
| 192 |
errors.append(f"{row_id}: messages must contain exactly one user and one assistant message")
|
|
|
|
| 195 |
errors.append(f"{row_id}: messages roles must be user then assistant")
|
| 196 |
if not messages[0].get("content") or not messages[1].get("content"):
|
| 197 |
errors.append(f"{row_id}: message content cannot be empty")
|
| 198 |
+
|
| 199 |
response = row.get("response", "")
|
| 200 |
for marker in ["Streaming reasoning:", "Deep reasoning:", "Answer:"]:
|
| 201 |
if marker not in response:
|
|
|
|
| 208 |
errors.append(f"{row_id}: quality_flags must be a list")
|
| 209 |
elif not all(isinstance(flag, str) and flag.strip() for flag in row.get("quality_flags", [])):
|
| 210 |
errors.append(f"{row_id}: quality_flags must contain only non-empty strings")
|
| 211 |
+
if has_obvious_trivial_chunk(chunks) and chunk_labels and "skip" not in chunk_labels:
|
| 212 |
+
errors.append(f"{row_id}: obvious trivial chunk has no skip label")
|
| 213 |
return errors
|
| 214 |
|
| 215 |
|
|
|
|
| 220 |
train_parquet = data_dir / "data" / "train.parquet"
|
| 221 |
eval_parquet = data_dir / "data" / "eval.parquet"
|
| 222 |
samples_path = data_dir / "samples_for_review.jsonl"
|
| 223 |
+
info_path = data_dir / "dataset_info.json"
|
| 224 |
|
| 225 |
+
required_paths = [train_jsonl, eval_jsonl, train_parquet, eval_parquet, data_dir / "README.md", info_path, samples_path]
|
| 226 |
+
for path in required_paths:
|
| 227 |
if not path.exists():
|
| 228 |
errors.append(f"missing required file: {path}")
|
| 229 |
if errors:
|
|
|
|
| 238 |
errors.append("train.jsonl is empty")
|
| 239 |
if not eval_rows:
|
| 240 |
errors.append("eval.jsonl is empty")
|
| 241 |
+
if len(train_rows) + len(eval_rows) >= 100 and len(sample_rows) < 100:
|
| 242 |
+
errors.append(f"samples_for_review.jsonl must contain at least 100 rows, found {len(sample_rows)}")
|
| 243 |
|
| 244 |
for idx, row in enumerate(train_rows, start=1):
|
| 245 |
errors.extend(validate_row(row, "train", idx))
|
| 246 |
for idx, row in enumerate(eval_rows, start=1):
|
| 247 |
errors.extend(validate_row(row, "eval", idx))
|
|
|
|
| 248 |
for idx, row in enumerate(sample_rows, start=1):
|
| 249 |
+
split = row.get("split", "")
|
| 250 |
+
if split not in {"train", "eval"}:
|
| 251 |
errors.append(f"sample row {idx}: split must be train or eval")
|
| 252 |
+
errors.extend(validate_row(row, split, idx))
|
|
|
|
| 253 |
|
| 254 |
all_rows = train_rows + eval_rows
|
| 255 |
ids = [row.get("id") for row in all_rows]
|
|
|
|
| 260 |
errors.append(f"duplicate ids found: {sorted(list(duplicate_ids))[:5]}")
|
| 261 |
if duplicate_texts:
|
| 262 |
errors.append(f"duplicate text fields found: {len(duplicate_texts)} duplicates")
|
| 263 |
+
sample_ids = {row.get("id") for row in sample_rows}
|
| 264 |
missing_samples = sample_ids - set(ids)
|
| 265 |
if missing_samples:
|
| 266 |
errors.append(f"samples_for_review.jsonl contains ids not present in train/eval: {sorted(list(missing_samples))[:5]}")
|
|
|
|
| 277 |
if field not in eval_df.columns:
|
| 278 |
errors.append(f"eval.parquet missing column {field}")
|
| 279 |
|
| 280 |
+
try:
|
| 281 |
+
info = json.loads(info_path.read_text(encoding="utf-8"))
|
| 282 |
+
except json.JSONDecodeError as exc:
|
| 283 |
+
errors.append(f"dataset_info.json invalid JSON: {exc}")
|
| 284 |
+
info = {}
|
| 285 |
+
if info.get("version") != "v0.3":
|
| 286 |
+
errors.append("dataset_info.json version must be v0.3")
|
| 287 |
+
if info.get("repo_id") != "skyzhou06/LifeStreamingCoT":
|
| 288 |
+
errors.append("dataset_info.json repo_id must be skyzhou06/LifeStreamingCoT")
|
| 289 |
+
if info.get("generation_method") != "source_grounded_rule_based_v0.3_selective_concise":
|
| 290 |
+
errors.append("dataset_info.json generation_method is incorrect")
|
| 291 |
+
if info.get("reasoning_policy") != "selective_concise":
|
| 292 |
+
errors.append("dataset_info.json reasoning_policy is incorrect")
|
| 293 |
+
|
| 294 |
+
total_chunks = sum(row.get("num_chunks", 0) for row in all_rows)
|
| 295 |
+
skip_chunks = sum(len(row.get("skip_chunks", [])) for row in all_rows)
|
| 296 |
+
rows_with_skip = sum(1 for row in all_rows if row.get("skip_chunks"))
|
| 297 |
+
forbidden_count = sum(forbidden_phrase_hits(row) for row in all_rows)
|
| 298 |
+
if all_rows and rows_with_skip / len(all_rows) < 0.10:
|
| 299 |
+
errors.append("fewer than 10% of examples contain at least one skip chunk")
|
| 300 |
+
if forbidden_count:
|
| 301 |
+
errors.append(f"forbidden generic phrase count must be 0, found {forbidden_count}")
|
| 302 |
+
|
| 303 |
+
domains = Counter(row.get("domain") for row in all_rows)
|
| 304 |
+
avg_chunks = sum(row.get("num_chunks", 0) for row in all_rows) / len(all_rows) if all_rows else 0
|
| 305 |
+
avg_original = sum(row.get("original_num_chunks", 0) for row in all_rows) / len(all_rows) if all_rows else 0
|
| 306 |
+
avg_split = sum(row.get("chunk_split_count", 0) for row in all_rows) / len(all_rows) if all_rows else 0
|
| 307 |
+
avg_stream = sum(word_count(row.get("streaming_reasoning", "")) for row in all_rows) / len(all_rows) if all_rows else 0
|
| 308 |
+
avg_deep = sum(word_count(row.get("deep_reasoning", "")) for row in all_rows) / len(all_rows) if all_rows else 0
|
| 309 |
+
quality_flags = Counter(flag for row in all_rows for flag in row.get("quality_flags", []))
|
| 310 |
+
|
| 311 |
print("Validation summary")
|
| 312 |
+
print(f"total rows: {len(all_rows)}")
|
| 313 |
print(f"train rows: {len(train_rows)}")
|
| 314 |
print(f"eval rows: {len(eval_rows)}")
|
| 315 |
+
print(f"domains: {dict(sorted(domains.items()))}")
|
| 316 |
+
print(f"average num_chunks: {avg_chunks:.2f}")
|
| 317 |
+
print(f"average original_num_chunks: {avg_original:.2f}")
|
| 318 |
+
print(f"average chunk_split_count: {avg_split:.2f}")
|
| 319 |
+
print(f"average streaming_reasoning words: {avg_stream:.2f}")
|
| 320 |
+
print(f"average deep_reasoning words: {avg_deep:.2f}")
|
| 321 |
+
print(f"skip chunk ratio: {skip_chunks / total_chunks if total_chunks else 0:.4f}")
|
| 322 |
+
print(f"examples with at least one skip: {rows_with_skip}")
|
| 323 |
+
print(f"quality_flags distribution: {dict(sorted(quality_flags.items()))}")
|
| 324 |
+
print(f"forbidden phrase count: {forbidden_count}")
|
| 325 |
print(f"review sample rows: {len(sample_rows)}")
|
|
|
|
| 326 |
print(f"errors: {len(errors)}")
|
| 327 |
if errors:
|
| 328 |
+
for error in errors[:120]:
|
| 329 |
print(f"ERROR: {error}")
|
| 330 |
+
if len(errors) > 120:
|
| 331 |
+
print(f"ERROR: ... {len(errors) - 120} more")
|
| 332 |
return 1
|
| 333 |
print("validation passed")
|
| 334 |
return 0
|