File size: 7,207 Bytes
5446ae3
86f8e17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5446ae3
86f8e17
5446ae3
 
86f8e17
 
 
 
 
9efd45f
86f8e17
 
 
 
 
9efd45f
86f8e17
9efd45f
86f8e17
 
9efd45f
86f8e17
 
 
 
 
 
 
 
 
 
 
 
 
9efd45f
86f8e17
5446ae3
86f8e17
f11c595
86f8e17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f11c595
86f8e17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f11c595
 
86f8e17
 
 
 
 
 
 
 
 
 
 
 
 
 
f11c595
 
86f8e17
 
 
 
 
 
 
 
 
 
 
 
 
 
5446ae3
86f8e17
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
pretty_name: Glyph Datasets
license: apache-2.0
language:
  - en
task_categories:
  - image-to-text
size_categories:
  - 100K<n<1M
tags:
  - chemistry
  - cheminformatics
  - ocsr
  - markush
  - chemical-structure-recognition
  - smiles
  - cxsmiles
configs:
  - config_name: markush-train
    data_files:
      - split: train
        path: markush/train.jsonl
---

# glyph-datasets

Data artifacts for **Glyph** — chemical-structure transcription with two models:
**OCSRGlyph** (molecule image → SMILES) and **MarkushGlyph** (patent Markush
image → CXSMILES + R-group table). This repository holds the training indices,
training metadata, and the frozen self-contained evaluation benchmarks that the
`glyph` package auto-downloads.

- **Code:** `EdisonScientific/glyph` (GitHub)
- **Weights:** `EdisonScientific/OCSRGlyph`, `EdisonScientific/MarkushGlyph`
- **License:** Apache-2.0. See [License](#license).
- **Citation:** TBD — the BibTeX entry and arXiv identifier will be added on
  release. See [Citation](#citation).

## Redistribution classes

Artifacts fall into three classes; every subdirectory `README.md` /
`*.provenance.json` sidecar records the class per file.

- **(a) Referenced upstream** — pulled from the pinned public source at load
  time and not re-hosted here (the raw OCSR training images, the MolNexTR CSVs,
  the raw Markush source images).
- **(b) Transformed metadata** — derived label / index / subset files (SMILES +
  relative paths, the mined `adjacent_ring` subset, the flat Markush training
  index). These carry no upstream image bytes.
- **(c) Embedded copies** — the frozen self-contained eval parquets, which *do*
  embed the benchmark images and labels so `glyph … eval` runs with no local
  reconstruction: the **5,719** OCSR benchmark images
  (`ocsr/uspto_ocsr_benchmark.parquet`) and the **1,055** Markush eval images
  (878 + 103 + 74 across the three `markush-eval/*` parquets). These images are
  public-domain USPTO patent depictions / the pinned public MarkushGrapher-2
  benchmark; they are re-hosted only inside these frozen benchmark copies.

## Artifact map

| Path | Rows | Class | Purpose |
|---|---|---|---|
| `ocsr/uspto_ocsr_5719_complete.csv` | 5,719 | (b) | USPTO-OCSR-5719 complete labels (label sidecar). |
| `ocsr/uspto_ocsr_benchmark.parquet` | 5,719 | (c) | Frozen self-contained OCSR benchmark (images + labels embedded); the file `glyph ocsr eval` downloads. |
| `ocsr/adjacent_ring.csv` | 64,752 | (b) | This work: pure-logic mined subset of PubChem-1M (OCSR enrichment). |
| `ocsr/stereo_200k/{train,val}.csv` | 200,000 / 2,000 | (b) | Stereo-200K SMILES + relative image paths (images re-fetched). |
| `ocsr/stereo_200k_white/{train,val}.csv` | 200,000 / 2,000 | (b) | White-cropped Stereo-200K variant (this work's preprocessing). |
| `ocsr/ocsrglyph-recipe.json` | — | — | OCSRGlyph training recipe (hyperparameters). |
| `markush/train.jsonl` | 263,158 | (b) | Frozen flat MarkushGlyph training index (exact order, repeats intact). |
| `markush/manifest.json` | — | — | Flat-index metadata (schema, counts, source revisions, integrity). |
| `markush-eval/ip5m/ip5m_benchmark.parquet` | 878 | (c) | Frozen self-contained IP5-M eval benchmark (images embedded). |
| `markush-eval/ip5m/ds4sd_mg2_predictions_878.jsonl` | 878 | (b) | DS4SD MarkushGrapher-2's own IP5-M eval output: ground truth + MG2 baseline. |
| `markush-eval/m2s/m2s_benchmark.parquet` | 103 | (c) | Frozen self-contained M2S eval benchmark (images embedded). |
| `markush-eval/m2s/ds4sd_mg2_gt_103.jsonl` | 103 | (b) | Derived M2S ground truth for the official DS4SD scorer. |
| `markush-eval/uspto_markush/uspto_markush_benchmark.parquet` | 74 | (c) | Frozen self-contained USPTO-Markush eval benchmark (images embedded). |
| `markush-eval/uspto_markush/ds4sd_mg2_gt_74.jsonl` | 74 | (b) | Derived USPTO-Markush ground truth for the official DS4SD scorer. |

Every data artifact has a companion `*.provenance.json` (source repo + pinned
revision, transformation, counts, integrity hash). Row counts are data rows;
each CSV also carries a 1-line header.

## Per-artifact schemas

**OCSR**

- `uspto_ocsr_5719_complete.csv``image_id, smiles, source_of_label`.
- `uspto_ocsr_benchmark.parquet` — `id, image (struct<bytes, path>), mol,
  smiles, selfies, inchi, source_of_label`; image bytes present for all 5,719
  rows, zero null SMILES.
- `adjacent_ring.csv``pubchem_cid, InChI, SMILES, num_atoms`.
- `stereo_200k/*.csv`, `stereo_200k_white/*.csv``SMILES, file_path` (relative
  image path; images re-fetched from `Robert-zwr/Stereo-200k`).

**Markush**

- `train.jsonl` — one JSON object per line: `source`, `source_id`, `images`
  (list of `images/<source>/train/<source_id>.png`), `messages` (a `user` +
  `assistant` chat turn). See `manifest.json` for the full contract, per-source
  counts, and source revisions.

**Markush eval**

- `*_benchmark.parquet``id, image (struct<bytes, path>), benchmark, record`
  (`record` is the JSON of the prepared eval row); image bytes present for all
  rows.
- `ip5m/ds4sd_mg2_predictions_878.jsonl``id, cxsmiles` (MG2 baseline
  prediction), `cxsmiles_opt, gt_cxsmiles` (DS4SD ground truth; 8 unparseable
  rows kept as null), `gt_cxsmiles_opt`.
- `m2s/ds4sd_mg2_gt_103.jsonl`, `uspto_markush/ds4sd_mg2_gt_74.jsonl` — `id,
  gt_cxsmiles, gt_cxsmiles_opt` (derived ground truth; no MG2 baseline column,
  since no DS4SD model run is published for these two benchmarks).

## Usage

The `glyph` package resolves these artifacts automatically — no manual
`huggingface-cli` step.

```bash
# OCSR headline: the benchmark parquet auto-downloads from this repo.
uv run glyph ocsr eval --checkpoint EdisonScientific/OCSRGlyph --output uspto5719.json

# Markush: the self-contained benchmark auto-downloads; STEP 2 auto-pulls the
# matching ground truth from markush-eval/<name>/.
uv run glyph markush eval benchmark --benchmark ip5m \
    --checkpoint EdisonScientific/MarkushGlyph --base-model Qwen/Qwen3.5-2B-Base \
    --output preds.json
tools/mg2_scorer/score_benchmark.sh --benchmark ip5m --input-json preds.json

# Markush training: the flat index auto-downloads with hub:markush/train.jsonl.
uv run python -m glyph.markush.train.sft \
    --config configs/ablations/ocsr-as-markush-fraction/sft_2b_markush_ocsr5pct.yaml \
    --data-path hub:markush/train.jsonl
```

See the code repository's `REPRODUCE.md` for the exact commands, expected
counts, pinned revisions, and both Markush scoring contracts.

## License

Apache-2.0 (same as the code repository). Each referenced upstream source keeps
its own license — see the per-subdirectory
`README.md` and `*.provenance.json` sidecars for attribution (PubChem, MolNexTR,
MolSight/Stereo-200K, MolScribe, `hheiden/USPTO_OCSR_benchmark`,
`docling-project/MarkushGrapher-Datasets` and `-2-Datasets`,
`UniParser/MolParser-7M`). The embedded benchmark images are public-domain USPTO
patent depictions / the pinned public MarkushGrapher-2 benchmark.

## Citation

TBD. This data accompanies the paper *Chemical Structure Transcription Across
Molecules*; the BibTeX entry and arXiv identifier will be added on release.