MagicNoThief commited on
Commit
84d9ed8
·
verified ·
1 Parent(s): 79c52ba

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +230 -0
README.md ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ language:
4
+ - en
5
+ task_categories:
6
+ - text2text-generation
7
+ tags:
8
+ - dictation
9
+ - speech-disfluency
10
+ - disfluency-removal
11
+ - text-editing
12
+ - alpaca
13
+ size_categories:
14
+ - 10K<n<100K
15
+ configs:
16
+ - config_name: alpaca
17
+ default: true
18
+ data_files:
19
+ - split: train
20
+ path: handy_editor_alpaca.jsonl
21
+ - split: test
22
+ path: handy_eval_alpaca.jsonl
23
+ - config_name: chatml
24
+ data_files:
25
+ - split: train
26
+ path: handy_editor.jsonl
27
+ - split: test
28
+ path: handy_eval.jsonl
29
+ ---
30
+
31
+ # Handy dictation-editing corpus
32
+
33
+ Turns a raw dictated transcript into the text the speaker meant to write.
34
+
35
+ ```
36
+ in : um so the meeting is uh moved to friday no wait thursday at three
37
+ out: The meeting is Thursday at three.
38
+ ```
39
+
40
+ Three jobs at once, because they are not separable in speech: drop filler words,
41
+ repair punctuation and capitalisation, and — the hard one — when the speaker
42
+ changes their mind mid-sentence, delete the wording they abandoned and keep only
43
+ what they settled on.
44
+
45
+ Built for [Handy](https://github.com/cjpais/Handy)'s on-device enhancement layer,
46
+ where a sub-500M model has to do this in under a second on a laptop with no GPU.
47
+ It is not specific to that app: it is a plain instruction-tuning corpus.
48
+
49
+ ## Format
50
+
51
+ Two views of the **same rows**, generated from one list so they cannot disagree.
52
+
53
+ **`*_alpaca.jsonl`** — for fine-tuning a **base** model, which has no chat
54
+ template of its own:
55
+
56
+ ```json
57
+ {
58
+ "instruction": "Rewrite the dictated transcript as the speaker meant to write it. Remove filler words and hesitations, repair punctuation and capitalisation, and when the speaker corrects themselves keep only the wording they settled on. Reply with the edited text and nothing else.",
59
+ "input": "book it for four people make that six people",
60
+ "output": "Book it for six people."
61
+ }
62
+ ```
63
+
64
+ **`*.jsonl`** — the same examples as an OpenAI `messages` array, for an
65
+ **instruct** model that already has a chat template:
66
+
67
+ ```json
68
+ {"messages": [
69
+ {"role": "user", "content": "book it for four people make that six people"},
70
+ {"role": "assistant", "content": "Book it for six people."}
71
+ ]}
72
+ ```
73
+
74
+ The chat view carries **no system turn**. That is deliberate: the behaviour is
75
+ meant to live in the weights, and prepending a ~450-token instruction to a
76
+ ~30-token example is most of the sequence for no gain. Measured on an earlier
77
+ run, giving the fine-tune the instruction at inference was actively *worse* —
78
+ 54/68 against 57/68 — because it started copying the prompt's own rules into its
79
+ output.
80
+
81
+ ### The instruction is constant
82
+
83
+ Every Alpaca row carries the same `instruction`. This is a property of the
84
+ intended use, not an oversight: the host that serves the model sends exactly this
85
+ string, and a fine-tune given an instruction a few words off the one it learned
86
+ degrades quietly. If you want instruction diversity, paraphrase it yourself —
87
+ but then serve a matching distribution.
88
+
89
+ ### Serve it as one turn
90
+
91
+ Whatever you train, prompt it with the **whole Alpaca string in a single turn**.
92
+ Splitting it — instruction into a chat "system" slot, input into a "user" slot —
93
+ looks equivalent and is not. Measured on a 350M fine-tune of this corpus:
94
+
95
+ | Prompt shape | Result |
96
+ | --- | --- |
97
+ | Instruction in system, input in user | Repeats itself until the token budget runs out; no stop token. ~620 ms |
98
+ | Whole Alpaca prompt as one turn | Clean, terminated edits. **~100 ms** |
99
+
100
+ This bites specifically because a converted base-model GGUF often still carries a
101
+ chat template, which then wraps the split prompt into a shape the model never saw
102
+ in training. One assembled turn is safe either way.
103
+
104
+ ## Files
105
+
106
+ | File | Rows | Size | Use |
107
+ | --- | ---: | ---: | --- |
108
+ | `handy_editor_alpaca.jsonl` | 89,996 | 45.5 MB | **Train on this** (base model) |
109
+ | `handy_editor.jsonl` | 89,996 | 25.0 MB | Train on this (instruct model) |
110
+ | `handy_eval_alpaca.jsonl` | 2,152 | 1.1 MB | Held-out eval. **Never train on it.** |
111
+ | `handy_eval.jsonl` | 2,152 | 0.6 MB | The same eval, chat view |
112
+ | `editor_train/val_alpaca.jsonl` | 88.2K / 1.8K | — | Pre-split, if you want it |
113
+
114
+ ## Context length
115
+
116
+ Measured by rendering every row as the full Alpaca sequence — preamble,
117
+ instruction, input and the response being learned — and tokenising with LFM2's
118
+ tokenizer:
119
+
120
+ | | median | p90 | p99 | max |
121
+ | --- | ---: | ---: | ---: | ---: |
122
+ | `handy_editor_alpaca.jsonl` | 128 | 167 | 277 | **510** |
123
+ | `handy_eval_alpaca.jsonl` | 126 | 171 | 256 | 329 |
124
+
125
+ **512 truncates nothing, by two tokens.** That is not much margin, and
126
+ truncation cuts from the right — which is where the target lives, so a clipped
127
+ row teaches the model to stop mid-sentence. 384 clips 146 rows. If your trainer
128
+ pads dynamically, 640 costs almost nothing and removes the question; use 512 only
129
+ if you are sure your renderer matches the one above.
130
+
131
+ (The chat view is shorter — max 426 — because it has no preamble.)
132
+
133
+ ## Composition
134
+
135
+ 89,996 training rows. **15.6% come from recordings of real speech**; the rest are
136
+ generated from templates targeting specific failure modes.
137
+
138
+ | Source | Rows | What it contributes |
139
+ | --- | ---: | --- |
140
+ | `syn_retraction` | 21,271 | Mid-sentence self-correction, the core case |
141
+ | `syn_negative` | 16,713 | Sentences needing **no** edit — the counterweight |
142
+ | `syn_filler` | 11,395 | Filler words and hesitations only |
143
+ | `syn_long` | 9,116 | Multi-sentence utterances |
144
+ | `disfl_qa` | 6,980 | Real human-written disfluent questions |
145
+ | `nyra` | 4,921 | Real disfluent speech transcripts |
146
+ | `syn_double` | 4,558 | Two corrections in one utterance |
147
+ | `syn_false_start` | 3,798 | Abandoned pronoun left stranded |
148
+ | `syn_leading` | 3,798 | Sentence-initial phrase wrongly dropped |
149
+ | `syn_initial` | 3,038 | Retraction that opens the utterance |
150
+ | `syn_slot` | 2,279 | Replacement landing on the wrong slot |
151
+ | `long_real` | 1,109 | Long-form real speech |
152
+ | `disfluency_speech` | 985 | Real read-aloud disfluent speech |
153
+ | `disfl_qa_lower` | 35 | Case-normalised variants |
154
+
155
+ `syn_negative` at 19% is load-bearing. A corpus of nothing but corrections
156
+ teaches a model that *something* must always be deleted, and it starts eating
157
+ sentences that were fine. The five smallest generators exist because a previous
158
+ fine-tune got exactly those patterns wrong.
159
+
160
+ ## The held-out split is held out by source
161
+
162
+ `handy_eval*.jsonl` is not a random slice of the training file. A slice would
163
+ still share the source sentences and template instances that produced it, and
164
+ would measure memorisation. Instead:
165
+
166
+ - real utterances come from DisfluencySpeech's `test` split, which the training
167
+ build never reads;
168
+ - synthetic rows use a different RNG seed, with every training input excluded by
169
+ hand;
170
+ - the builder asserts zero input overlap and fails the build if that ever breaks.
171
+
172
+ ## How it was built
173
+
174
+ `scripts/enhance-train/build_dataset.py` in
175
+ [Handy-Flow](https://github.com/zselybence/Handy-Flow):
176
+
177
+ ```bash
178
+ python build_dataset.py --out ./corpus --n 90000 \
179
+ --system-mode none --editor-only --format both
180
+ python validate_dataset.py ./corpus # gate before spending GPU time
181
+ ```
182
+
183
+ `validate_dataset.py` checks JSON validity, role patterns, that no target still
184
+ contains a filler or a stutter, that targets are not malformed, and that no
185
+ eval-suite input has leaked in.
186
+
187
+ ## Limitations
188
+
189
+ - **English only.**
190
+ - **Punctuation style is British-ish and opinionated** — sentence case, serial
191
+ commas absent, full stops added. A model trained on this will impose it.
192
+ - **Short utterances dominate.** The median row is a single sentence; long-form
193
+ dictation is ~10% of the corpus.
194
+ - **The synthetic majority is template-shaped.** It covers the failure modes it
195
+ was aimed at, and generalises less well outside them.
196
+ - **Real-speech transcripts carry their annotators' choices**, including some
197
+ targets that are arguably worse than what a good model would write.
198
+ - **No verification rows.** An earlier version of this corpus trained a second
199
+ "did the meaning change?" task. Measured end to end on 400 live edits it caught
200
+ 0 of 10 bad edits and rejected 1 good one, so the whole budget went to editing.
201
+
202
+ ## Sources and licensing
203
+
204
+ | Source | Licence |
205
+ | --- | --- |
206
+ | [`google-research-datasets/disfl_qa`](https://huggingface.co/datasets/google-research-datasets/disfl_qa) | CC-BY-4.0 |
207
+ | [`nyralabs/disfluency_speech_english`](https://huggingface.co/datasets/nyralabs/disfluency_speech_english) | Apache-2.0 |
208
+ | [`amaai-lab/DisfluencySpeech`](https://huggingface.co/datasets/amaai-lab/DisfluencySpeech) | Apache-2.0 |
209
+ | Synthetic rows | Generated by `build_dataset.py` |
210
+
211
+ Released under **CC-BY-4.0**, the most restrictive of the inbound licences.
212
+ Attribution to the three datasets above is required.
213
+
214
+ > **Check before you publish:** `disfl_qa` is derived from SQuAD, which is
215
+ > CC-BY-SA-4.0. Its own Hugging Face card declares CC-BY-4.0, and this corpus
216
+ > follows that declaration — but if you need certainty about whether a
217
+ > share-alike obligation reaches this derivative, confirm it rather than relying
218
+ > on this note.
219
+
220
+ ## Citation
221
+
222
+ ```bibtex
223
+ @misc{handy_dictation_editing,
224
+ title = {Handy dictation-editing corpus},
225
+ author = {Handy-Flow contributors},
226
+ year = {2026},
227
+ note = {Built with scripts/enhance-train/build_dataset.py},
228
+ url = {https://github.com/zselybence/Handy-Flow}
229
+ }
230
+ ```