Datasets:
Publish curated, controls-verified results
Browse files- README.md +319 -0
- bounded_null.parquet +3 -0
- build_dataset.py +252 -0
- dynamics_validated.parquet +3 -0
- feature_probe.parquet +3 -0
- learnability_sweep.parquet +3 -0
- publish_dataset.py +72 -0
README.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
tags:
|
| 6 |
+
- cryptography
|
| 7 |
+
- sha-256
|
| 8 |
+
- hash-functions
|
| 9 |
+
- round-reduced
|
| 10 |
+
- learnability
|
| 11 |
+
- distinguisher
|
| 12 |
+
- neural-network
|
| 13 |
+
- negative-result
|
| 14 |
+
- reproducibility
|
| 15 |
+
- bounded-null
|
| 16 |
+
- statistical-validation
|
| 17 |
+
- controls
|
| 18 |
+
- sgd-dynamics
|
| 19 |
+
- butterfly-labs
|
| 20 |
+
- asic
|
| 21 |
+
language:
|
| 22 |
+
- en
|
| 23 |
+
pretty_name: "Round-Reduced SHA-256 Learnability: A Controls-Gated Negative Result"
|
| 24 |
+
size_categories:
|
| 25 |
+
- n<1K
|
| 26 |
+
configs:
|
| 27 |
+
- config_name: learnability_sweep
|
| 28 |
+
data_files: learnability_sweep.parquet
|
| 29 |
+
- config_name: bounded_null
|
| 30 |
+
data_files: bounded_null.parquet
|
| 31 |
+
- config_name: dynamics_validated
|
| 32 |
+
data_files: dynamics_validated.parquet
|
| 33 |
+
- config_name: feature_probe
|
| 34 |
+
data_files: feature_probe.parquet
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
# Round-Reduced SHA-256 Learnability: A Controls-Gated Negative Result
|
| 38 |
+
|
| 39 |
+
## TL;DR
|
| 40 |
+
|
| 41 |
+
A small CNN learns to distinguish **round-reduced** SHA-256 outputs from
|
| 42 |
+
random with ~100% accuracy through **3 rounds**, then **collapses to
|
| 43 |
+
chance at round 4 and stays there through the full 64 rounds** — a sharp
|
| 44 |
+
learnability cliff, replicated across 5 seeds and 2 dataset sizes. Full
|
| 45 |
+
SHA-256 is statistically indistinguishable from random to these probes
|
| 46 |
+
**at this budget** (a bounded null, not a proof). An apparent
|
| 47 |
+
iterated-hash "orbit" signal turned out to be a label-prior **artifact**
|
| 48 |
+
— and the experiment's own permuted-label control caught it.
|
| 49 |
+
|
| 50 |
+
This is a **negative result reported honestly**. It is a personal
|
| 51 |
+
AI/ML-capability and reproducibility exploration, **not** new
|
| 52 |
+
cryptographic science: a competent distinguisher failing on a hash
|
| 53 |
+
function it should fail on is the *expected* outcome. The value here is
|
| 54 |
+
the methodology — every claim is gated on positive/negative controls,
|
| 55 |
+
and one of those controls is shown in the act of converting a false
|
| 56 |
+
positive into a correct negative.
|
| 57 |
+
|
| 58 |
+
## Dataset Description
|
| 59 |
+
|
| 60 |
+
This dataset is the distilled, **verified evidence** from a learnability
|
| 61 |
+
instrument built on top of the [`bfl-asic`](#reproduction) toolkit (a
|
| 62 |
+
codebase for a Butterfly Labs BF0005G "Jalapeno" SHA-256 mining ASIC,
|
| 63 |
+
which also contains a numpy-vectorized, `hashlib`-anchored round-reduced
|
| 64 |
+
SHA-256 and a controls-gated train/eval harness).
|
| 65 |
+
|
| 66 |
+
It contains **only the results** — accuracy points, confidence
|
| 67 |
+
intervals, control outcomes, verdicts. The synthetic training data is
|
| 68 |
+
**deliberately not hosted**: it is exactly regenerable from a seed,
|
| 69 |
+
which is cheaper and more reproducible than a multi-gigabyte download.
|
| 70 |
+
What you cannot regenerate for free — the curated, controls-verified
|
| 71 |
+
conclusions of ~16 CPU-hours of Hugging Face compute — is what lives
|
| 72 |
+
here.
|
| 73 |
+
|
| 74 |
+
Four small Parquet tables, **83 rows total**:
|
| 75 |
+
|
| 76 |
+
| Config | Rows | What it answers |
|
| 77 |
+
|---|---|---|
|
| 78 |
+
| `learnability_sweep` | 70 | At how many SHA-256 rounds does a CNN stop being able to tell real from reduced? |
|
| 79 |
+
| `bounded_null` | 7 | Is full 64-round SHA-256 distinguishable from random to these probes, at this budget? |
|
| 80 |
+
| `dynamics_validated` | 4 | Is iterated-hash orbit-tail length predictable from the seed? (and: is the apparent signal real?) |
|
| 81 |
+
| `feature_probe` | 2 | Is the round-4 cliff an artifact of the input feature? |
|
| 82 |
+
|
| 83 |
+
### Headline findings
|
| 84 |
+
|
| 85 |
+
1. **A sharp learnability cliff at round 4.** Per-hash TinyCNN
|
| 86 |
+
distinguisher accuracy: rounds 1–3 ≈ **1.000**; round 4 onward ≈
|
| 87 |
+
**0.500**, flat through round 64. The cliff lands at the *same*
|
| 88 |
+
boundary for all 5 seeds (Tier A n=200k ×3, Tier B n=500k ×2) and on
|
| 89 |
+
a finer round grid. Of the **55** post-cliff points, exactly **one**
|
| 90 |
+
has a 95% CI lower bound clearing chance (Tier A seed 1, round 6:
|
| 91 |
+
acc 0.5057, +1.1%, ci_lo 0.5007) — *fewer* than the ≈ 2.7 spurious
|
| 92 |
+
one-sided 95% exceedances expected from 55 points, isolated (rounds
|
| 93 |
+
4/5/8 of that seed are at chance), and below the rounds-1–3 signal
|
| 94 |
+
by ~50×. It is reported, not hidden: `learnable` is a per-point
|
| 95 |
+
`ci_lo > 0.5` flag precisely so this is queryable.
|
| 96 |
+
|
| 97 |
+
2. **Full SHA-256 is indistinguishable from random — bounded.** At
|
| 98 |
+
n=800k (n_val=40k), best-of-{TinyCNN, linear probe} accuracy is
|
| 99 |
+
0.499–0.501; the 95% CI brackets 0.5 in every seed; `controls_ok`.
|
| 100 |
+
Verdict: *no structure above a CI-resolution floor of ≈ 0.49%*.
|
| 101 |
+
This is a **bounded null at this budget**, explicitly **not** a
|
| 102 |
+
claim that SHA-256 is random.
|
| 103 |
+
|
| 104 |
+
3. **The dynamics "signal" was an artifact — and the control caught
|
| 105 |
+
it.** Predicting a binned iterated-SHA-256 orbit-tail length from
|
| 106 |
+
the seed gave width-1 accuracy 0.354 (chance 0.25), CI [0.339,
|
| 107 |
+
0.369] — apparently above chance. But the **permuted-label
|
| 108 |
+
negative control scored identically** (0.354, same CI):
|
| 109 |
+
`negative_ok = false`. The model learns nothing from the seed and
|
| 110 |
+
collapses to the most-frequent quantile bin; the "+10%" is the
|
| 111 |
+
non-uniform label prior. **Verified conclusion: no learnable
|
| 112 |
+
seed→orbit-tail structure at any truncation width.** A first,
|
| 113 |
+
under-validated harness reported this as a positive; the fixed
|
| 114 |
+
harness (real Clopper–Pearson CI + permuted-label control)
|
| 115 |
+
converted it into a correct, controlled negative — which is the
|
| 116 |
+
entire point of the control.
|
| 117 |
+
|
| 118 |
+
4. **The cliff is not feature-bottlenecked.** A per-batch
|
| 119 |
+
deviation-map feature reproduces the same round-4 cliff as the
|
| 120 |
+
per-hash feature (qualitative, coarse floor — see provenance).
|
| 121 |
+
|
| 122 |
+
## Quick Start
|
| 123 |
+
|
| 124 |
+
```python
|
| 125 |
+
from datasets import load_dataset
|
| 126 |
+
|
| 127 |
+
# 1. The learnability cliff (the spine)
|
| 128 |
+
sweep = load_dataset("bshepp/round-reduced-sha256-learnability",
|
| 129 |
+
"learnability_sweep")["train"].to_pandas()
|
| 130 |
+
print(sweep[sweep.seed == 0][["tier", "rounds", "accuracy",
|
| 131 |
+
"ci_lo", "ci_hi", "learnable"]])
|
| 132 |
+
# rounds 1-3 -> learnable=True (~1.0); rounds >=4 -> learnable=False (~0.5)
|
| 133 |
+
|
| 134 |
+
# 2. The bounded null on full SHA-256
|
| 135 |
+
bn = load_dataset("bshepp/round-reduced-sha256-learnability",
|
| 136 |
+
"bounded_null")["train"].to_pandas()
|
| 137 |
+
print(bn[bn.is_best_model][["seed", "model", "accuracy",
|
| 138 |
+
"ci_resolution_floor", "conclusion"]])
|
| 139 |
+
|
| 140 |
+
# 3. The verified dynamics negative: real signal vs the control
|
| 141 |
+
dyn = load_dataset("bshepp/round-reduced-sha256-learnability",
|
| 142 |
+
"dynamics_validated")["train"].to_pandas()
|
| 143 |
+
lead = dyn.iloc[0]
|
| 144 |
+
print(f"width-1 acc={lead.accuracy:.4f} "
|
| 145 |
+
f"permuted-label control={lead.permuted_label_accuracy:.4f} "
|
| 146 |
+
f"negative_ok={lead.negative_ok}")
|
| 147 |
+
# identical -> the apparent signal is a label-prior artifact
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
## Methodology (read this before using the numbers)
|
| 151 |
+
|
| 152 |
+
This dataset is opinionated about honest measurement. Three conventions
|
| 153 |
+
matter:
|
| 154 |
+
|
| 155 |
+
- **Controls gate every verdict.** A "no structure" null is only
|
| 156 |
+
trustworthy if a *positive control* (a low-round model that **must**
|
| 157 |
+
be learnable) did learn, and a *negative control* (random-vs-random,
|
| 158 |
+
or shuffled labels) did **not** beat chance. `controls_ok` /
|
| 159 |
+
`positive_ok` / `negative_ok` are carried on the rows. When a control
|
| 160 |
+
fails, the row's conclusion says so instead of emitting a null.
|
| 161 |
+
|
| 162 |
+
- **`ci_resolution_floor` is a CI-resolution floor, NOT a power-based
|
| 163 |
+
MDE.** It is the smallest above-chance gain whose 95% accuracy CI
|
| 164 |
+
excludes chance at that eval-set size
|
| 165 |
+
(`floor = z·√(p(1−p)/n_val)`). "No structure" means *none above this
|
| 166 |
+
floor at this budget* — it is **not** a statement that the effect is
|
| 167 |
+
zero, and **not** a power calculation. `n_val` is the exact
|
| 168 |
+
inversion of that formula and is included for transparency.
|
| 169 |
+
|
| 170 |
+
- **The permuted-label control is the dynamics analog of
|
| 171 |
+
random-vs-random.** Train on shuffled labels; if the shuffled model
|
| 172 |
+
still "beats chance", the apparent signal is a dataset/setup
|
| 173 |
+
artifact. In `dynamics_validated` it fires: that is the headline.
|
| 174 |
+
|
| 175 |
+
CIs are Clopper–Pearson (exact binomial). Models are deliberately small
|
| 176 |
+
(a tiny CNN and a linear probe) on modest data on CPU — this measures
|
| 177 |
+
*easy, cheap learnability*, the appropriate first question, not the
|
| 178 |
+
limit of what any model could ever extract.
|
| 179 |
+
|
| 180 |
+
## Dataset Splits
|
| 181 |
+
|
| 182 |
+
### `learnability_sweep` (70 rows)
|
| 183 |
+
|
| 184 |
+
Round-reduced vs full SHA-256 distinguisher accuracy as a function of
|
| 185 |
+
the number of compression rounds. Real SHA-256 vs an `R`-round-reduced
|
| 186 |
+
variant, per-hash feature, TinyCNN. 5 seeds across 2 tiers.
|
| 187 |
+
|
| 188 |
+
| Column | Type | Description |
|
| 189 |
+
|---|---|---|
|
| 190 |
+
| `tier` | str | `A` (n_train=200k) or `B` (n_train=500k, finer round grid) |
|
| 191 |
+
| `n_train` | int | Training examples |
|
| 192 |
+
| `n_val` | int | Eval examples (exact inversion of the CI floor) |
|
| 193 |
+
| `seed` | int | RNG seed (0–2 for A, 0–1 for B) |
|
| 194 |
+
| `rounds` | int | SHA-256 compression rounds (1–64) |
|
| 195 |
+
| `accuracy` | float | Validation accuracy (chance = 0.5) |
|
| 196 |
+
| `advantage` | float | `2·accuracy − 1` |
|
| 197 |
+
| `ci_lo`, `ci_hi` | float | 95% Clopper–Pearson CI on accuracy |
|
| 198 |
+
| `ci_resolution_floor` | float | Smallest CI-resolvable gain at this `n_val` |
|
| 199 |
+
| `learnable` | bool | `ci_lo > 0.5` (above chance with 95% confidence) |
|
| 200 |
+
|
| 201 |
+
### `bounded_null` (7 rows)
|
| 202 |
+
|
| 203 |
+
Full 64-round SHA-256 vs random. One row per (seed, model) plus the
|
| 204 |
+
standalone indistinguishability run. `conclusion` is verbatim from the
|
| 205 |
+
harness.
|
| 206 |
+
|
| 207 |
+
| Column | Type | Description |
|
| 208 |
+
|---|---|---|
|
| 209 |
+
| `experiment` | str | `full_structure` or `indistinguishability` |
|
| 210 |
+
| `seed` | int | RNG seed |
|
| 211 |
+
| `model` | str | `tiny_cnn` or `linear_probe` |
|
| 212 |
+
| `rounds` | int | 64 (full SHA-256) |
|
| 213 |
+
| `n_train`, `n_val` | int | Training / eval examples (800k / 40k) |
|
| 214 |
+
| `accuracy`, `advantage` | float | Validation accuracy and `2·acc−1` |
|
| 215 |
+
| `ci_lo`, `ci_hi` | float | 95% Clopper–Pearson CI |
|
| 216 |
+
| `ci_resolution_floor` | float | CI-resolution floor (≈ 0.0049) |
|
| 217 |
+
| `is_best_model` | bool | Best-accuracy model for this seed |
|
| 218 |
+
| `controls_ok` | bool | Positive **and** negative control passed |
|
| 219 |
+
| `positive_ok`, `negative_ok` | bool | Individual control outcomes |
|
| 220 |
+
| `structure_detected` | bool | `ci_lo > 0.5` (always False here) |
|
| 221 |
+
| `conclusion` | str | Verbatim harness verdict |
|
| 222 |
+
|
| 223 |
+
### `dynamics_validated` (4 rows)
|
| 224 |
+
|
| 225 |
+
Predicting a binned iterated-SHA-256 orbit-tail length from the seed,
|
| 226 |
+
vs how many seed bytes the model sees (`trunc_width_bytes`). The
|
| 227 |
+
permuted-label control fields are **constant across rows on purpose** so
|
| 228 |
+
one table answers "is this signal real?".
|
| 229 |
+
|
| 230 |
+
| Column | Type | Description |
|
| 231 |
+
|---|---|---|
|
| 232 |
+
| `seed`, `n_train`, `epochs`, `n_bins` | int | Run config (0, 20000, 25, 4) |
|
| 233 |
+
| `trunc_width_bytes` | int | Seed bytes the model sees (1–4) |
|
| 234 |
+
| `accuracy` | float | Validation accuracy (chance = 0.25) |
|
| 235 |
+
| `chance` | float | `1 / n_bins` |
|
| 236 |
+
| `advantage` | float | `accuracy − chance` |
|
| 237 |
+
| `ci_lo`, `ci_hi` | float | 95% Clopper–Pearson CI |
|
| 238 |
+
| `ci_resolution_floor` | float | CI-resolution floor at this `n_val` |
|
| 239 |
+
| `permuted_label_accuracy` | float | Shuffled-label control accuracy |
|
| 240 |
+
| `permuted_label_ci_lo/hi` | float | Control 95% CI |
|
| 241 |
+
| `negative_ok` | bool | False ⇒ the apparent signal is an artifact |
|
| 242 |
+
| `verdict` | str | Plain-language conclusion |
|
| 243 |
+
|
| 244 |
+
### `feature_probe` (2 rows)
|
| 245 |
+
|
| 246 |
+
Is the round-4 cliff an artifact of the input feature? `per-hash` is
|
| 247 |
+
exact (HF Tier B seed0); `per-batch` is a local n=2M probe whose CI
|
| 248 |
+
floor is coarse (~0.10, few per-batch examples), recorded qualitatively
|
| 249 |
+
and labelled with its provenance.
|
| 250 |
+
|
| 251 |
+
| Column | Type | Description |
|
| 252 |
+
|---|---|---|
|
| 253 |
+
| `feature` | str | `per-hash` or `per-batch` |
|
| 254 |
+
| `n_train` | int | Training examples |
|
| 255 |
+
| `rounds_learnable` | str | JSON list of rounds with `ci_lo > 0.5` |
|
| 256 |
+
| `rounds_at_chance` | str | JSON list of probed rounds at chance |
|
| 257 |
+
| `ci_resolution_floor` | float | CI-resolution floor (coarse for per-batch) |
|
| 258 |
+
| `conclusion` | str | Plain-language finding |
|
| 259 |
+
| `provenance` | str | Exact-vs-qualitative source and caveats |
|
| 260 |
+
|
| 261 |
+
## Reproduction
|
| 262 |
+
|
| 263 |
+
The data is regenerable from a seed — that is why none of the *inputs*
|
| 264 |
+
are hosted. The results above were produced by the `bfl-asic` toolkit's
|
| 265 |
+
`ml` subsystem (numpy round-reduced SHA-256 anchored to `hashlib`,
|
| 266 |
+
TinyCNN/linear-probe distinguishers, a controls-gated harness), run on
|
| 267 |
+
Hugging Face Jobs (`cpu-xl`, ~16 CPU-hours total).
|
| 268 |
+
|
| 269 |
+
```bash
|
| 270 |
+
pip install "bfl-asic[ml]" # PyTorch is isolated behind [ml]
|
| 271 |
+
|
| 272 |
+
# Regenerate the spine (one seed, scaled down for a laptop):
|
| 273 |
+
bfl-asic ml run sweep --seed 0 --n 20000 --epochs 10
|
| 274 |
+
bfl-asic ml report runs/ml/<timestamp>/sweep_seed0.json
|
| 275 |
+
|
| 276 |
+
# Rebuild these exact Parquet tables from the synced run JSON:
|
| 277 |
+
python dataset/build_dataset.py # deps: pandas, pyarrow
|
| 278 |
+
```
|
| 279 |
+
|
| 280 |
+
The harness is deterministic: the same seed reproduces the same curve.
|
| 281 |
+
The `dynamics_validated` table is the output of the *fixed* harness
|
| 282 |
+
(real Clopper–Pearson CI + permuted-label control); the earlier
|
| 283 |
+
under-validated harness is preserved in the toolkit's history as the
|
| 284 |
+
honest record of the false positive that the control corrected.
|
| 285 |
+
|
| 286 |
+
## Limitations
|
| 287 |
+
|
| 288 |
+
- **Negative results, by design.** A small/cheap distinguisher failing
|
| 289 |
+
on full SHA-256 is expected; absence of evidence here is **not**
|
| 290 |
+
evidence that SHA-256 has no structure. The bounded null is bounded.
|
| 291 |
+
- **Budget-bounded.** Small models, modest `n`, CPU. This measures
|
| 292 |
+
easy, cheap learnability — the right *first* question, not a ceiling.
|
| 293 |
+
- **`ci_resolution_floor` is not a power calculation.** See
|
| 294 |
+
Methodology. Do not read it as a minimum detectable effect.
|
| 295 |
+
- **Multiple comparisons are not corrected.** Per-point 95% CIs are
|
| 296 |
+
reported raw; across ~80 rows a small number of one-sided
|
| 297 |
+
exceedances are expected by chance (and observed — see Finding 1).
|
| 298 |
+
Treat `learnable` / `structure_detected` as per-point flags, not
|
| 299 |
+
family-wise significance.
|
| 300 |
+
- **Not novel cryptographic research.** This is a personal AI/ML
|
| 301 |
+
capability and reproducibility exploration; its contribution is
|
| 302 |
+
methodological transparency, not a new attack or a security claim.
|
| 303 |
+
|
| 304 |
+
## Citation
|
| 305 |
+
|
| 306 |
+
```bibtex
|
| 307 |
+
@dataset{sheppard2026sha256learnability,
|
| 308 |
+
title = {Round-Reduced SHA-256 Learnability: A Controls-Gated
|
| 309 |
+
Negative Result},
|
| 310 |
+
author = {Sheppard, B.},
|
| 311 |
+
year = {2026},
|
| 312 |
+
publisher = {Hugging Face},
|
| 313 |
+
url = {https://huggingface.co/datasets/bshepp/round-reduced-sha256-learnability}
|
| 314 |
+
}
|
| 315 |
+
```
|
| 316 |
+
|
| 317 |
+
## License
|
| 318 |
+
|
| 319 |
+
MIT.
|
bounded_null.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e5e895dce9a62e9f5601a48c44ec7f515cf1c20f306d74e5935511ab13c2da85
|
| 3 |
+
size 10224
|
build_dataset.py
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Build the curated, verified HF dataset tables from the synced run JSON.
|
| 3 |
+
|
| 4 |
+
Mirrors the convention of the author's other HF dataset
|
| 5 |
+
(`bshepp/pairwise-poisson-algebras`): a deterministic script that reads
|
| 6 |
+
the raw result JSON and emits one Parquet table per config, sitting next
|
| 7 |
+
to the dataset card (README.md) in this directory.
|
| 8 |
+
|
| 9 |
+
Only *verified* results go in (controls passed, or — for the dynamics
|
| 10 |
+
negative — the permuted-label control actively fired). The synthetic
|
| 11 |
+
training data itself is NOT hosted: it is regenerable from a seed, which
|
| 12 |
+
is cheaper and more reproducible than a download. This dataset is the
|
| 13 |
+
distilled *evidence*, not the inputs.
|
| 14 |
+
|
| 15 |
+
Run: python dataset/build_dataset.py
|
| 16 |
+
Deps: pandas, pyarrow (pip install pandas pyarrow)
|
| 17 |
+
"""
|
| 18 |
+
from __future__ import annotations
|
| 19 |
+
|
| 20 |
+
import io
|
| 21 |
+
import json
|
| 22 |
+
from pathlib import Path
|
| 23 |
+
|
| 24 |
+
import pandas as pd
|
| 25 |
+
|
| 26 |
+
SCRIPT_DIR = Path(__file__).resolve().parent
|
| 27 |
+
HF = SCRIPT_DIR.parent / "hf_results"
|
| 28 |
+
_Z = 1.959963984540054 # 97.5th pct of N(0,1); matches the harness
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def _load(path: Path) -> dict:
|
| 32 |
+
# utf-8-sig: tolerate a Windows BOM on synced artifacts.
|
| 33 |
+
with io.open(path, "r", encoding="utf-8-sig") as fh:
|
| 34 |
+
return json.load(fh)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def _n_val(floor: float, chance: float) -> int:
|
| 38 |
+
"""Invert the CI-resolution floor to the eval-set size that produced it.
|
| 39 |
+
|
| 40 |
+
floor = Z * sqrt(chance*(1-chance)/n_val) -> exact integer n_val.
|
| 41 |
+
"""
|
| 42 |
+
return round(chance * (1.0 - chance) * (_Z / floor) ** 2)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def build_learnability_sweep() -> pd.DataFrame:
|
| 46 |
+
"""#1 the spine: round-reduced SHA-256 distinguisher accuracy vs rounds.
|
| 47 |
+
|
| 48 |
+
Real vs round-reduced (compress-function-reduced) SHA-256, per-hash
|
| 49 |
+
feature, TinyCNN. Five independent seeds across two compute tiers.
|
| 50 |
+
"""
|
| 51 |
+
rows = []
|
| 52 |
+
sources = [
|
| 53 |
+
("A", 200_000, HF / "bfl-ml-tierA" / "sweep_seed0.json", 0),
|
| 54 |
+
("A", 200_000, HF / "bfl-ml-tierA" / "sweep_seed1.json", 1),
|
| 55 |
+
("A", 200_000, HF / "bfl-ml-tierA" / "sweep_seed2.json", 2),
|
| 56 |
+
("B", 500_000, HF / "bfl-ml-tierB" / "sweep_seed0.json", 0),
|
| 57 |
+
("B", 500_000, HF / "bfl-ml-tierB" / "sweep_seed1.json", 1),
|
| 58 |
+
]
|
| 59 |
+
for tier, n_train, path, seed in sources:
|
| 60 |
+
doc = _load(path)
|
| 61 |
+
for p in doc["points"]:
|
| 62 |
+
lo, hi = p["accuracy_ci"]
|
| 63 |
+
floor = p["min_detectable_advantage"]
|
| 64 |
+
rows.append(
|
| 65 |
+
{
|
| 66 |
+
"tier": tier,
|
| 67 |
+
"n_train": n_train,
|
| 68 |
+
"n_val": _n_val(floor, 0.5),
|
| 69 |
+
"seed": seed,
|
| 70 |
+
"rounds": p["rounds"],
|
| 71 |
+
"accuracy": p["accuracy"],
|
| 72 |
+
"advantage": p["advantage"], # 2*acc - 1
|
| 73 |
+
"ci_lo": lo,
|
| 74 |
+
"ci_hi": hi,
|
| 75 |
+
"ci_resolution_floor": floor,
|
| 76 |
+
# Above chance iff the 95% CI lower bound clears 0.5.
|
| 77 |
+
"learnable": bool(lo > 0.5),
|
| 78 |
+
}
|
| 79 |
+
)
|
| 80 |
+
return pd.DataFrame(rows)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def build_bounded_null() -> pd.DataFrame:
|
| 84 |
+
"""#4/#2 full SHA-256 (64-round) vs random: a controls-gated null.
|
| 85 |
+
|
| 86 |
+
`conclusion` is verbatim from the harness. NOTE: ci_resolution_floor
|
| 87 |
+
is a CI-RESOLUTION floor (smallest gain whose 95% CI clears chance at
|
| 88 |
+
this n), NOT a power-based minimum detectable effect. "no structure"
|
| 89 |
+
means "none above this floor at this budget", not "SHA-256 is random".
|
| 90 |
+
"""
|
| 91 |
+
rows = []
|
| 92 |
+
for seed in (0, 1, 2):
|
| 93 |
+
doc = _load(HF / "bfl-ml-tierA" / f"full_structure_seed{seed}.json")
|
| 94 |
+
ctl = doc["controls"]
|
| 95 |
+
bn = doc["bounded_null"]
|
| 96 |
+
for p in doc["points"]:
|
| 97 |
+
lo, hi = p["accuracy_ci"]
|
| 98 |
+
floor = p["min_detectable_advantage"]
|
| 99 |
+
rows.append(
|
| 100 |
+
{
|
| 101 |
+
"experiment": "full_structure",
|
| 102 |
+
"seed": seed,
|
| 103 |
+
"model": p["model"],
|
| 104 |
+
"rounds": 64,
|
| 105 |
+
"n_train": 800_000,
|
| 106 |
+
"n_val": _n_val(floor, 0.5),
|
| 107 |
+
"accuracy": p["accuracy"],
|
| 108 |
+
"advantage": p["advantage"],
|
| 109 |
+
"ci_lo": lo,
|
| 110 |
+
"ci_hi": hi,
|
| 111 |
+
"ci_resolution_floor": floor,
|
| 112 |
+
"is_best_model": p["model"] == bn["best_model"],
|
| 113 |
+
"controls_ok": bool(bn["controls_ok"]),
|
| 114 |
+
"positive_ok": bool(ctl["positive_ok"]),
|
| 115 |
+
"negative_ok": bool(ctl["negative_ok"]),
|
| 116 |
+
"structure_detected": bool(lo > 0.5),
|
| 117 |
+
"conclusion": bn["conclusion"],
|
| 118 |
+
}
|
| 119 |
+
)
|
| 120 |
+
ind = _load(HF / "bfl-ml-tierA" / "indistinguishability.json")
|
| 121 |
+
p = ind["points"][0]
|
| 122 |
+
lo, hi = p["accuracy_ci"]
|
| 123 |
+
floor = p["min_detectable_advantage"]
|
| 124 |
+
rows.append(
|
| 125 |
+
{
|
| 126 |
+
"experiment": "indistinguishability",
|
| 127 |
+
"seed": 0,
|
| 128 |
+
"model": ind["model"],
|
| 129 |
+
"rounds": 64,
|
| 130 |
+
"n_train": 800_000,
|
| 131 |
+
"n_val": _n_val(floor, 0.5),
|
| 132 |
+
"accuracy": p["accuracy"],
|
| 133 |
+
"advantage": p["advantage"],
|
| 134 |
+
"ci_lo": lo,
|
| 135 |
+
"ci_hi": hi,
|
| 136 |
+
"ci_resolution_floor": floor,
|
| 137 |
+
"is_best_model": True,
|
| 138 |
+
"controls_ok": bool(ind["controls"]["positive_ok"]
|
| 139 |
+
and ind["controls"]["negative_ok"]),
|
| 140 |
+
"positive_ok": bool(ind["controls"]["positive_ok"]),
|
| 141 |
+
"negative_ok": bool(ind["controls"]["negative_ok"]),
|
| 142 |
+
"structure_detected": bool(lo > 0.5),
|
| 143 |
+
"conclusion": "no structure detected above the detection floor",
|
| 144 |
+
}
|
| 145 |
+
)
|
| 146 |
+
return pd.DataFrame(rows)
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def build_dynamics_validated() -> pd.DataFrame:
|
| 150 |
+
"""#3 iterated-hash orbit learnability — the VERIFIED negative.
|
| 151 |
+
|
| 152 |
+
Predict a binned iterated-SHA-256 orbit-tail length from the seed,
|
| 153 |
+
vs how many seed bytes the model sees. The width-1 point sits above
|
| 154 |
+
chance, but the permuted-label control scores IDENTICALLY: the
|
| 155 |
+
apparent signal is the non-uniform label prior, not orbit structure.
|
| 156 |
+
Those control fields are constant across rows on purpose so a single
|
| 157 |
+
table answers "is this signal real?".
|
| 158 |
+
"""
|
| 159 |
+
doc = _load(HF / "dynamics_validated_seed0.json")
|
| 160 |
+
cfg = doc["config"]
|
| 161 |
+
ctl = doc["controls"]
|
| 162 |
+
pl_lo, pl_hi = ctl["permuted_label_ci"]
|
| 163 |
+
rows = []
|
| 164 |
+
for p in doc["points"]:
|
| 165 |
+
lo, hi = p["accuracy_ci"]
|
| 166 |
+
rows.append(
|
| 167 |
+
{
|
| 168 |
+
"seed": cfg["seed"],
|
| 169 |
+
"n_train": cfg["n"],
|
| 170 |
+
"epochs": cfg["epochs"],
|
| 171 |
+
"n_bins": cfg["n_bins"],
|
| 172 |
+
"trunc_width_bytes": p["rounds"], # generic knob axis
|
| 173 |
+
"accuracy": p["accuracy"],
|
| 174 |
+
"chance": p["chance"],
|
| 175 |
+
"advantage": p["advantage"], # accuracy - chance
|
| 176 |
+
"ci_lo": lo,
|
| 177 |
+
"ci_hi": hi,
|
| 178 |
+
"ci_resolution_floor": p["min_detectable_advantage"],
|
| 179 |
+
"permuted_label_accuracy": ctl["permuted_label_accuracy"],
|
| 180 |
+
"permuted_label_ci_lo": pl_lo,
|
| 181 |
+
"permuted_label_ci_hi": pl_hi,
|
| 182 |
+
"negative_ok": bool(ctl["negative_ok"]),
|
| 183 |
+
"verdict": (
|
| 184 |
+
"ARTIFACT: width-1 gain == permuted-label control "
|
| 185 |
+
"(label-prior, not orbit structure); no learnable "
|
| 186 |
+
"seed->orbit-tail structure at any width"
|
| 187 |
+
),
|
| 188 |
+
}
|
| 189 |
+
)
|
| 190 |
+
return pd.DataFrame(rows)
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def build_feature_probe() -> pd.DataFrame:
|
| 194 |
+
"""Robustness check: is the round-4 cliff an artifact of the feature?
|
| 195 |
+
|
| 196 |
+
per-hash row is exact (Tier B seed0, n=500k). per-batch is the local
|
| 197 |
+
DEVLOG 2026-05-16 n=2M probe — its CI floor is coarse (~0.10) because
|
| 198 |
+
the per-batch deviation map yields few examples, so it is recorded
|
| 199 |
+
qualitatively and labelled with its provenance. Same cliff either
|
| 200 |
+
way: the boundary is not feature-bottlenecked.
|
| 201 |
+
"""
|
| 202 |
+
tb0 = _load(HF / "bfl-ml-tierB" / "sweep_seed0.json")
|
| 203 |
+
by_round = {p["rounds"]: p for p in tb0["points"]}
|
| 204 |
+
ph_learn = sorted(r for r, p in by_round.items()
|
| 205 |
+
if p["accuracy_ci"][0] > 0.5)
|
| 206 |
+
ph_chance = sorted(r for r in (4, 5, 6, 8) if r in by_round)
|
| 207 |
+
rows = [
|
| 208 |
+
{
|
| 209 |
+
"feature": "per-hash",
|
| 210 |
+
"n_train": 500_000,
|
| 211 |
+
"rounds_learnable": json.dumps(ph_learn),
|
| 212 |
+
"rounds_at_chance": json.dumps(ph_chance),
|
| 213 |
+
"ci_resolution_floor": tb0["points"][0]["min_detectable_advantage"],
|
| 214 |
+
"conclusion": "sharp learnability cliff after round 3",
|
| 215 |
+
"provenance": "HF Tier B seed0 (exact)",
|
| 216 |
+
},
|
| 217 |
+
{
|
| 218 |
+
"feature": "per-batch",
|
| 219 |
+
"n_train": 2_000_000,
|
| 220 |
+
"rounds_learnable": json.dumps([3]),
|
| 221 |
+
"rounds_at_chance": json.dumps([4, 5, 6, 8]),
|
| 222 |
+
"ci_resolution_floor": 0.10, # coarse: few per-batch examples
|
| 223 |
+
"conclusion": (
|
| 224 |
+
"same round-4 cliff reproduced; not feature-bottlenecked"
|
| 225 |
+
),
|
| 226 |
+
"provenance": (
|
| 227 |
+
"DEVLOG 2026-05-16 local n=2M probe; coarse floor; "
|
| 228 |
+
"qualitative (r3=1.00; r4-8 CI brackets 0.5)"
|
| 229 |
+
),
|
| 230 |
+
},
|
| 231 |
+
]
|
| 232 |
+
return pd.DataFrame(rows)
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
def main() -> None:
|
| 236 |
+
tables = {
|
| 237 |
+
"learnability_sweep": build_learnability_sweep(),
|
| 238 |
+
"bounded_null": build_bounded_null(),
|
| 239 |
+
"dynamics_validated": build_dynamics_validated(),
|
| 240 |
+
"feature_probe": build_feature_probe(),
|
| 241 |
+
}
|
| 242 |
+
total = 0
|
| 243 |
+
for name, df in tables.items():
|
| 244 |
+
out = SCRIPT_DIR / f"{name}.parquet"
|
| 245 |
+
df.to_parquet(out, index=False, engine="pyarrow")
|
| 246 |
+
total += len(df)
|
| 247 |
+
print(f" {name:22s} {len(df):4d} rows -> {out.name}")
|
| 248 |
+
print(f"Total: {total} rows across {len(tables)} Parquet tables.")
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
if __name__ == "__main__":
|
| 252 |
+
main()
|
dynamics_validated.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b36b3fc48c24410c41e1886f245f840848a81e8fb82bb6f9bff3ebc329dc8126
|
| 3 |
+
size 10653
|
feature_probe.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:33af0867937a24f7fa677652a1fcb98aff174acfad54512ae410d4e5214d7737
|
| 3 |
+
size 5289
|
learnability_sweep.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:264b3ce05dd65fdace91512a3933d979c1fe4f356cf1f4e69333e4731957cb01
|
| 3 |
+
size 8878
|
publish_dataset.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Publish this directory as a public Hugging Face *dataset* repo.
|
| 3 |
+
|
| 4 |
+
Mirrors `bfl_asic/ml/publish.py` (HfApi.create_repo + upload_folder) but
|
| 5 |
+
with `repo_type="dataset"` and public-by-default, matching the author's
|
| 6 |
+
existing HF dataset convention (`bshepp/pairwise-poisson-algebras`).
|
| 7 |
+
|
| 8 |
+
Uploads only the curated card + Parquet + the two build/publish scripts
|
| 9 |
+
(no synced run JSON, no payloads). Auth comes from the already-configured
|
| 10 |
+
`hf` CLI token (HF_TOKEN env var or `~/.cache/huggingface/token`).
|
| 11 |
+
|
| 12 |
+
Usage:
|
| 13 |
+
python dataset/publish_dataset.py # default repo, public
|
| 14 |
+
python dataset/publish_dataset.py --repo-id bshepp/... # override
|
| 15 |
+
python dataset/publish_dataset.py --private # private first
|
| 16 |
+
python dataset/publish_dataset.py --dry-run # show, do not push
|
| 17 |
+
"""
|
| 18 |
+
from __future__ import annotations
|
| 19 |
+
|
| 20 |
+
import argparse
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
DEFAULT_REPO = "bshepp/round-reduced-sha256-learnability"
|
| 24 |
+
ALLOW = ["README.md", "*.parquet", "build_dataset.py", "publish_dataset.py"]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def publish(repo_id: str, *, private: bool, dry_run: bool) -> str:
|
| 28 |
+
folder = Path(__file__).resolve().parent
|
| 29 |
+
url = f"https://huggingface.co/datasets/{repo_id}"
|
| 30 |
+
files = sorted(
|
| 31 |
+
p.name
|
| 32 |
+
for p in folder.iterdir()
|
| 33 |
+
if p.suffix in (".parquet", ".md", ".py")
|
| 34 |
+
)
|
| 35 |
+
if dry_run:
|
| 36 |
+
print(f"[dry-run] would create dataset repo {repo_id} "
|
| 37 |
+
f"(private={private}) and upload from {folder}:")
|
| 38 |
+
for f in files:
|
| 39 |
+
print(f" + {f}")
|
| 40 |
+
print(f"[dry-run] -> {url}")
|
| 41 |
+
return url
|
| 42 |
+
|
| 43 |
+
from huggingface_hub import HfApi # lazy: only needed to actually push
|
| 44 |
+
|
| 45 |
+
api = HfApi()
|
| 46 |
+
api.create_repo(
|
| 47 |
+
repo_id, repo_type="dataset", exist_ok=True, private=private
|
| 48 |
+
)
|
| 49 |
+
api.upload_folder(
|
| 50 |
+
repo_id=repo_id,
|
| 51 |
+
repo_type="dataset",
|
| 52 |
+
folder_path=str(folder),
|
| 53 |
+
allow_patterns=ALLOW,
|
| 54 |
+
commit_message="Publish curated, controls-verified results",
|
| 55 |
+
)
|
| 56 |
+
return url
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def main() -> None:
|
| 60 |
+
ap = argparse.ArgumentParser(description=__doc__)
|
| 61 |
+
ap.add_argument("--repo-id", default=DEFAULT_REPO)
|
| 62 |
+
ap.add_argument("--private", action="store_true",
|
| 63 |
+
help="create private (default: public)")
|
| 64 |
+
ap.add_argument("--dry-run", action="store_true",
|
| 65 |
+
help="list what would be pushed; do not push")
|
| 66 |
+
args = ap.parse_args()
|
| 67 |
+
url = publish(args.repo_id, private=args.private, dry_run=args.dry_run)
|
| 68 |
+
print(url)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
if __name__ == "__main__":
|
| 72 |
+
main()
|