AliKhajegiliM commited on
Commit
ab29d16
·
verified ·
1 Parent(s): 25a7a9a

Rewrite dataset card for the curated train/test split

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -26
  2. README.md +189 -59
  3. assets/corpus_composition.svg +93 -0
.gitattributes CHANGED
@@ -58,30 +58,5 @@ saved_model/**/* 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
61
- data/normalized/ctgov_normalized.jsonl filter=lfs diff=lfs merge=lfs -text
62
- data/raw_metadata/ctgov.jsonl filter=lfs diff=lfs merge=lfs -text
63
- data/review_queue/review_queue.jsonl filter=lfs diff=lfs merge=lfs -text
64
- data/sft/sft_examples.csv filter=lfs diff=lfs merge=lfs -text
65
- data/sft/sft_examples.jsonl filter=lfs diff=lfs merge=lfs -text
66
- data/sft/test.csv filter=lfs diff=lfs merge=lfs -text
67
- data/sft/test.jsonl filter=lfs diff=lfs merge=lfs -text
68
- data/sft/train.csv filter=lfs diff=lfs merge=lfs -text
69
- data/sft/train.jsonl filter=lfs diff=lfs merge=lfs -text
70
- data/sft/validation.csv filter=lfs diff=lfs merge=lfs -text
71
- data/sft/validation.jsonl filter=lfs diff=lfs merge=lfs -text
72
- data/normalized/normalized.jsonl filter=lfs diff=lfs merge=lfs -text
73
- data/raw_metadata/aea.jsonl filter=lfs diff=lfs merge=lfs -text
74
- data/sft/curated/sft_curated.csv filter=lfs diff=lfs merge=lfs -text
75
- data/sft/curated/sft_curated.jsonl filter=lfs diff=lfs merge=lfs -text
76
- data/sft/curated/test.csv filter=lfs diff=lfs merge=lfs -text
77
- data/sft/curated/test.jsonl filter=lfs diff=lfs merge=lfs -text
78
  data/sft/curated/train.csv filter=lfs diff=lfs merge=lfs -text
79
- data/sft/curated/train.jsonl filter=lfs diff=lfs merge=lfs -text
80
- data/sft/curated/validation.csv filter=lfs diff=lfs merge=lfs -text
81
- data/sft/curated/validation.jsonl filter=lfs diff=lfs merge=lfs -text
82
- data/sft/curated/shards/part_1of3.csv filter=lfs diff=lfs merge=lfs -text
83
- data/sft/curated/shards/part_1of3.jsonl filter=lfs diff=lfs merge=lfs -text
84
- data/sft/curated/shards/part_2of3.csv filter=lfs diff=lfs merge=lfs -text
85
- data/sft/curated/shards/part_2of3.jsonl filter=lfs diff=lfs merge=lfs -text
86
- data/sft/curated/shards/part_3of3.csv filter=lfs diff=lfs merge=lfs -text
87
- data/sft/curated/shards/part_3of3.jsonl 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  data/sft/curated/train.csv filter=lfs diff=lfs merge=lfs -text
62
+ data/sft/curated/test.csv filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -1,78 +1,208 @@
1
  ---
 
2
  license: other
3
  license_name: mixed-ctgov-public-domain-plus-review
4
- pretty_name: HypoAgent — Hypothesis-Testing Plan SFT Corpus
5
  language:
6
  - en
 
 
 
 
7
  tags:
8
  - statistics
9
  - biostatistics
 
10
  - clinical-trials
11
  - economics
12
  - study-design
13
  - hypothesis-testing
14
  - instruction-tuning
15
- task_categories:
16
- - text-generation
17
- size_categories:
18
- - 10K<n<100K
 
 
 
19
  ---
20
 
21
- # HypoAgent Hypothesis-Testing Plan SFT Corpus (private)
22
-
23
- > **🤖 Model trained on this dataset:**
24
- > [`AliKhajegiliM/HypoAgent-Mixtral-8x7B-Instruct-SFT`](https://huggingface.co/AliKhajegiliM/HypoAgent-Mixtral-8x7B-Instruct-SFT)
25
- > a LoRA adapter on Mixtral-8x7B-Instruct-v0.1 (trained on the curated 60k subset). Code &
26
- > pipeline: private GitHub `AliKhajegiliM/HypoAgent`.
27
-
28
-
29
- > **⭐ For training, use `data/sft/curated/`** — a quality-filtered, diversity-balanced subset
30
- > capped at **60,000** examples (mean quality 60.1, 0 leakage, 0 method/outcome contradictions).
31
- > Source-rebalanced to **CT.gov 66% / AEA 25% / OSF 8%** (non-clinical 21%→34%); single-arm capped
32
- > 24%→14%; 13 designs / 5 outcomes / 5 tasks. Rubric: hard eligibility (outcome determinable, min
33
- > length, bucket-adaptive quality floor) → keep_score ranking → budgeted allocation (source quotas,
34
- > per-family cap, 20% per-design cap). The full corpus below is the superset.
35
-
36
-
37
- Supervised fine-tuning corpus of **STUDY CONTEXT → REASONED HYPOTHESIS-TESTING PLAN**
38
- examples. Each assistant response is *synthesized from extracted structured facts* by a
39
- transparent statistical-reasoning engine (method keyed on outcome distribution × dependence
40
- structure × unit × estimand × comparison), not copied from source text. Code + reproducible
41
- pipeline: private GitHub `AliKhajegiliM/HypoAgent`.
42
-
43
- ## Key figures
44
- - **96,026** SFT examples from **27,052** study families; splits **77,076 / 9,316 / 9,634**.
45
- - **Three sources**: ClinicalTrials.gov **75,499** (public domain) + AEA RCT Registry **15,317**
46
- (prospective economics/social-science field & lab experiments) + OSF Registrations **5,210**
47
- (non-clinical preregistrations + online A/B). AEA & OSF have unclear content licenses and are
48
- tagged `training_use_status=review_required`; their plans are synthesized (no verbatim text).
49
- - Group split by `study_family_id` → **0** train/val/test leakage.
50
- - Task types: full plan (A), method selection (B), completion (C), critique of a flawed plan (D),
51
- alternatives (H).
52
- - **0** method/outcome contradictions across all flagship plans (audited).
53
- - Designs: parallel RCT, single-arm-vs-benchmark, observational, cluster-randomized, crossover,
54
- factorial, **field/lab/randomized experiment (AEA)**, online_experiment (OSF).
55
-
56
- ## Sources & compliance
57
- CT.gov examples are public domain. AEA (economics field/lab experiments; JEL-coded) and OSF
58
- (psychology/ecology/social + online A/B) add NON-clinical, prospective diversity but have unset/
59
- unclear content licenses, so they are tagged `training_use_status=review_required` /
60
- `human_review_status=license_review`. All assistant plans are **synthesized** from structured
61
- facts — no verbatim source text. Filter on `metadata.source_platform` and
62
- `metadata.training_use_status` to include/exclude by source and license posture.
63
-
64
- ## Record schema (JSONL / CSV)
65
- `{messages:[system,user,assistant], metadata:{example_id, split, task_type, domain,
66
- study_design, outcome_type, difficulty, quality_score, study_family_id, source_platform,
67
- license, training_use_status, method_family, source_ids, source_urls, challenge_sets, ...}}`.
68
- The CSV flattens the three turns into `system`/`user`/`assistant` columns (list fields joined
69
- with `|`; read with a real CSV parser — text contains commas/newlines).
70
 
71
  ## Contents
 
 
 
 
72
  ```
73
- data/sft/ train/validation/test + sft_examples (union), each as .csv and .jsonl
74
- data/normalized/ one canonical schema record per study
75
- data/raw_metadata/ ctgov.jsonl, aea.jsonl, osf.jsonl, europepmc.jsonl (raw provenance)
76
- data/review_queue/ items routed to human review
77
- reports/ distribution + leakage + coverage reports (CSV + HTML)
 
 
78
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ pretty_name: HypoAgent — Statistical Analysis Plan SFT Corpus
3
  license: other
4
  license_name: mixed-ctgov-public-domain-plus-review
 
5
  language:
6
  - en
7
+ task_categories:
8
+ - text-generation
9
+ size_categories:
10
+ - 10K<n<100K
11
  tags:
12
  - statistics
13
  - biostatistics
14
+ - statistical-analysis-plan
15
  - clinical-trials
16
  - economics
17
  - study-design
18
  - hypothesis-testing
19
  - instruction-tuning
20
+ configs:
21
+ - config_name: default
22
+ data_files:
23
+ - split: train
24
+ path: data/sft/curated/train.csv
25
+ - split: test
26
+ path: data/sft/curated/test.csv
27
  ---
28
 
29
+ # HypoAgent-SFT: study description prespecified statistical analysis plan
30
+
31
+ 54,163 supervised fine-tuning pairs that teach a model to read a study registration and write the analysis plan that belongs to it. The input is a study description — objective, design, population, exposure, comparator, outcome, timing, whatever the registry record actually contains. The target is a prespecified hypothesis-testing and statistical-analysis plan built for *that* design.
32
+
33
+ This is the curated split used to train **[HypoAgent/HypoAgent-Mixtral-8x7B-Instruct-SFT](https://huggingface.co/HypoAgent/HypoAgent-Mixtral-8x7B-Instruct-SFT)**, which on the held-out `test` split below beats base Mixtral-8x7B-Instruct in 93.6% of judged comparisons and cuts plans containing a critical statistical error from 33.8% to 14.4%.
34
+
35
+ ![Corpus composition](assets/corpus_composition.svg)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  ## Contents
38
+
39
+ ```
40
+ data/sft/curated/train.csv 48,218 rows · 18,699 study families
41
+ data/sft/curated/test.csv 5,945 rows · 2,315 study families
42
  ```
43
+
44
+ Two files, nothing else. The split is **grouped by `study_family_id`**: every task derived from one registry entry lands in the same split, so train/test family overlap is exactly **0**. A family yields between one and five examples depending on how much the source record supported.
45
+
46
+ ```python
47
+ from datasets import load_dataset
48
+ ds = load_dataset("HypoAgent/HypoAgent-SFT")
49
+ print(ds) # train: 48218, test: 5945
50
  ```
51
+
52
+ The text columns contain commas, quotes and newlines — read them with a real CSV parser, never by splitting on commas.
53
+
54
+ ## Record schema
55
+
56
+ | Column | What it holds |
57
+ |---|---|
58
+ | `system` | Fixed system prompt, identical across the corpus |
59
+ | `user` | The study description plus a one-line task instruction |
60
+ | `assistant` | The target plan |
61
+ | `example_id` | `<source>_<registry id>::<task_type>`, e.g. `ctgov_NCT05144607::A_full_plan` |
62
+ | `study_family_id` | `ctgov:` / `aea:` / `osf:` + registry id — **the grouping key for the split** |
63
+ | `split` | `train` or `test` |
64
+ | `task_type` | One of the five tasks below |
65
+ | `study_design` | 13 values, from `parallel_rct` to `online_experiment` |
66
+ | `outcome_type` | `continuous`, `binary`, `ordinal`, `count`, `time_to_event` |
67
+ | `method_family` | Method class the target commits to (`linear model`, `survival`, `ordinal`, …) |
68
+ | `domain` | 13 values; `clinical` 66.2%, `economics / social science` 25.4%, the rest behavioural and social science |
69
+ | `difficulty` | `complex` (69.4%) or `standard` |
70
+ | `quality_score` | 0–100 curation score. Mean 60.1, range 40–95; nothing below 40 was kept |
71
+ | `challenge_sets` | Pipe-separated evaluation slices this example belongs to |
72
+ | `injected_flaw` | The specific error planted in a `D_critique` prompt; empty for every other task |
73
+ | `license` | Source license posture |
74
+ | `human_review_status` | `auto_pending` (CT.gov) or `license_review` (AEA, OSF) |
75
+ | `synthetic_or_extracted` | Always `synthesized_from_extracted_structured_facts` |
76
+ | `source_ids`, `source_urls` | One registry id and one URL per row, pointing back to the original record |
77
+
78
+ ## The five tasks
79
+
80
+ | `task_type` | n | What the model is asked for |
81
+ |---|---:|---|
82
+ | `A_full_plan` | 20,940 | The complete 20-section plan |
83
+ | `B_method_selection` | 11,896 | Pick the primary method and rule out the leading alternatives |
84
+ | `C_completion` | 8,414 | Name what a partial plan is missing and supply it |
85
+ | `D_critique` | 6,816 | Find the flaw in a proposed plan and fix it |
86
+ | `H_alternatives` | 6,097 | A preferred analysis, one alternative, and when to switch |
87
+
88
+ `A_full_plan` targets run to twenty numbered sections: research question, hypothesis, estimand, null/alternative, primary endpoint, analysis units, primary method, why that method, assumptions, diagnostics, effect size, uncertainty, alpha, sample size, missing data, multiplicity, subgroups, sensitivity, decision rule, limitations. Median target length is 2,391 characters; the 95th percentile is 6,705.
89
+
90
+ The 6,816 `D_critique` prompts each carry exactly one deliberately planted error, drawn from nine failure modes that recur in real analysis plans:
91
+
92
+ | Planted flaw | n | | Planted flaw | n |
93
+ |---|---:|---|---|---:|
94
+ | `ignores_clustering` | 1,243 | | `ignores_nesting` | 747 |
95
+ | `ignores_pairing` | 1,029 | | `no_multiplicity_control` | 567 |
96
+ | `ignores_censoring` | 911 | | `count_as_linear` | 367 |
97
+ | `ordinal_as_continuous_or_dichotomized` | 879 | | `change_score_no_adjustment` | 227 |
98
+ | `binary_as_continuous` | 846 | | | |
99
+
100
+ ## How the targets were produced
101
+
102
+ Every assistant response is **synthesized from extracted structured facts**, not copied or paraphrased from source text. The pipeline pulls fields out of the registry record — design, randomization unit, arm count, outcome scale, timing, reported design parameters — and a rule-based reasoning engine keys the method off the combination of *outcome distribution × dependence structure × unit of analysis × estimand × comparison type*. A cluster-randomized trial with a continuous endpoint gets a linear mixed model with a random cluster intercept, plus a sentence explaining that clustering — not the raw participant count — drives precision. A single-arm study with a censored endpoint gets Kaplan-Meier description against a prespecified performance criterion, not a two-sample test.
103
+
104
+ Two consequences follow, and both matter:
105
+
106
+ - **No verbatim source text appears in any target.** Only extracted structured fields are reused, which is what makes the AEA and OSF portions distributable at all.
107
+ - **These are not real statistical analysis plans.** No trial statistician wrote them. They are internally consistent, design-appropriate plans generated from a rule set. A model trained on them learns correct structure and method selection, not the judgement of an experienced SAP author.
108
+
109
+ Curation ran as hard eligibility (outcome determinable, minimum length, bucket-adaptive quality floor) → `keep_score` ranking → budgeted allocation with source quotas, a per-family cap and a 20% ceiling on any single design. That rebalancing is why non-clinical studies make up 33.8% of these files against 21.4% of the 96k pre-curation pool, and why single-arm designs sit at 13.2% instead of 17.3%. Without it, two-arm clinical RCTs with continuous endpoints would swamp everything else.
110
+
111
+ ## Evaluation slices
112
+
113
+ `challenge_sets` marks examples belonging to a hard slice, so you can score a model on the structures it is most likely to get wrong rather than on the corpus average. Slices overlap; membership is pipe-separated.
114
+
115
+ | Slice | n | Slice | n |
116
+ |---|---:|---|---:|
117
+ | `clustered_hierarchical` | 8,563 | `preregistered_nonclinical` | 4,519 |
118
+ | `flawed_plan_correction` | 6,816 | `unseen_domain_nonclinical` | 4,519 |
119
+ | `survival_censoring` | 6,236 | `longitudinal_repeated` | 3,156 |
120
+ | `observational_causal` | 5,539 | `count_outcomes` | 2,232 |
121
+ | `ordinal_outcomes` | 5,002 | `multiple_testing` | 567 |
122
+ | | | `industrial_ab_testing` | 219 |
123
+
124
+ ## Sources and licensing
125
+
126
+ | Registry | Examples | Share | Licence posture |
127
+ |---|---:|---:|---|
128
+ | [ClinicalTrials.gov](https://clinicaltrials.gov/) | 35,872 | 66.2% | US government public domain |
129
+ | [AEA RCT Registry](https://www.socialscienceregistry.org/) | 13,772 | 25.4% | Unclear — © MIT/AEA, reuse terms not explicitly open |
130
+ | [OSF Registries](https://osf.io/registries) | 4,519 | 8.3% | Unclear — content licence not set or not verified |
131
+
132
+ The AEA and OSF portions are what make the corpus non-clinical: economics field and lab experiments, psychology and ecology preregistrations, online A/B tests. They are also the portions with unresolved licence terms, tagged `human_review_status=license_review` on every row. Filter on `license` or `human_review_status` to keep only the public-domain ClinicalTrials.gov subset if your use case needs clean terms.
133
+
134
+ Treat the corpus as **research use**. No verbatim source text is reproduced, but the licence posture of two of the three sources is unresolved rather than permissive.
135
+
136
+ ## Example
137
+
138
+ A cluster-randomized ICU study, `ctgov_NCT05144607::A_full_plan`, abridged:
139
+
140
+ **user**
141
+ ```text
142
+ STUDY DESCRIPTION
143
+ Objective: Patient-ventilator asynchronies can occur as a result of a mismatch between
144
+ neural (patient) and ventilator inspiratory and expiratory phases. [...] The impact of
145
+ the display of Pmus together with the other ventilator waveforms on the ability of
146
+ health-care professionals to identify asynchronies has not been tested so far.
147
+ Domain: clinical / Mechanical Ventilation Complication
148
+ Design: cluster_randomized (randomized, parallel, masking: none)
149
+ Population / eligibility: Inclusion Criteria: * Healthcare professionals (physicians and
150
+ respiratory therapists) who work in intensive care units [...]
151
+ Intervention/exposure: Muscle Pressure curve (Pmus)
152
+ Comparator: placebo/standard care
153
+ Primary outcome: Ability of ICU health care professionals to detect patient-ventilator
154
+ asynchrony
155
+ Primary timing: Immediately after the completion of the test sessions
156
+ Number of groups/arms: 2
157
+ Planned enrollment: 105 (actual)
158
+ Reported design parameters: power 0.9, alpha 0.05
159
+
160
+ Task: Produce a rigorous, prespecified hypothesis-testing and statistical-analysis plan
161
+ for this study.
162
+ ```
163
+
164
+ **assistant** (sections 6–8 of 20)
165
+ ```text
166
+ ## 6. Study and analysis units
167
+ - Randomization/assignment unit: cluster
168
+ - Observation unit: participant
169
+ - Analysis unit: cluster
170
+ - Dependence structure: Participants within a cluster are correlated (intracluster
171
+ correlation), so a random cluster intercept is included; ignoring it would understate
172
+ standard errors and inflate the type I error.
173
+
174
+ ## 7. Primary statistical method
175
+ Linear mixed model with a random cluster effect. Model: Linear mixed model: outcome ~
176
+ treatment (+ baseline, stratification factors) with a random intercept for cluster.
177
+ Primary test: Fixed-effect test of the treatment term.
178
+
179
+ ## 8. Why the method is appropriate
180
+ Because randomization is at the cluster level while the outcome is measured on
181
+ individuals, observations are not independent within clusters. A linear mixed model with
182
+ a random cluster intercept (or GEE with robust standard errors) propagates the
183
+ intracluster correlation into the inference so the effective sample size, not the raw
184
+ participant count, drives precision.
185
+ ```
186
+
187
+ Section 14 shows the other half of the design. The record reports 90% power at α = 0.05 with n = 105 but no ICC, so the target does not invent one — it states that the power calculation must match the mixed-model analysis and that a design/analysis mismatch invalidates the nominal power. Unreported inputs are named as prespecification decisions throughout rather than filled in with plausible numbers.
188
+
189
+ ## What this corpus is not
190
+
191
+ - **Not authoritative SAPs.** Synthesized targets, described above.
192
+ - **Not a benchmark with ground-truth labels.** The `test` split is held-out training-distribution data. Use it to compare models against each other, as the model card does; a target here is a reasonable plan, not the only correct one.
193
+ - **Not clinically validated.** Nothing here has been reviewed by a trial statistician or a regulator.
194
+ - **Not multilingual.** English only.
195
+
196
+ ## Citation
197
+
198
+ ```bibtex
199
+ @misc{khajegili2026hypoagentsft,
200
+ title = {HypoAgent-SFT: A Corpus of Study Descriptions Paired with
201
+ Prespecified Statistical Analysis Plans},
202
+ author = {Khajegili Mirabadi, Ali},
203
+ year = {2026},
204
+ howpublished = {\url{https://huggingface.co/datasets/HypoAgent/HypoAgent-SFT}}
205
+ }
206
+ ```
207
+
208
+ Please also cite the underlying registries when you use the corresponding subsets. Questions: the repository discussion page, or ali.mirabadi@ubc.ca
assets/corpus_composition.svg ADDED