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|
| 2 |
+
|
| 3 |
+
Downloads the seed archive from Zenodo (DOI: 10.5281/zenodo.20431021) and
|
| 4 |
+
invokes the `radii` Python package to regenerate the full benchmark locally.
|
| 5 |
+
The regenerated cache is then iterated row-by-row and yielded into HF's
|
| 6 |
+
standard cache so subsequent calls are instant.
|
| 7 |
+
|
| 8 |
+
User setup:
|
| 9 |
+
pip install datasets "radii @ git+https://github.com/KurbanIntelligenceLab/RADII"
|
| 10 |
+
python -c "from datasets import load_dataset; \\
|
| 11 |
+
ds = load_dataset('KurbanIntelligenceLab/RADII', split='train', \\
|
| 12 |
+
trust_remote_code=True)"
|
| 13 |
+
|
| 14 |
+
The first call regenerates the ~12 GB local cache (deterministic from the
|
| 15 |
+
3 MB seed). Subsequent calls hit HF's own cache.
|
| 16 |
+
"""
|
| 17 |
+
import json
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
|
| 20 |
+
import datasets
|
| 21 |
+
import numpy as np
|
| 22 |
+
|
| 23 |
+
_CITATION = """\
|
| 24 |
+
@inproceedings{polat2026radii,
|
| 25 |
+
title = {How Far Can You Grow? Characterizing the Extrapolation Frontier of Graph Generative Models for Materials Science},
|
| 26 |
+
author = {Polat, Can and Serpedin, Erchin and Kurban, Mustafa and Kurban, Hasan},
|
| 27 |
+
booktitle = {Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
|
| 28 |
+
series = {KDD \\'26},
|
| 29 |
+
year = {2026}
|
| 30 |
+
}
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
_DESCRIPTION = """\
|
| 34 |
+
RADII is a radius-resolved benchmark of ~75,000 nanoparticle structures
|
| 35 |
+
(33-11,298 atoms across 10 materials) for measuring the extrapolation
|
| 36 |
+
frontier of graph generative models. Radius is treated as a continuous
|
| 37 |
+
scaling knob with leakage-free train / in-distribution test / out-of-
|
| 38 |
+
distribution test splits. The OOD test radii span structures ~59% smaller
|
| 39 |
+
and ~24% larger than the training envelope.
|
| 40 |
+
|
| 41 |
+
This loader downloads the seed archive from Zenodo (DOI: 10.5281/zenodo.20431021)
|
| 42 |
+
and regenerates the full benchmark locally on first call. Subsequent calls
|
| 43 |
+
hit the HF datasets cache.
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
_HOMEPAGE = "https://github.com/KurbanIntelligenceLab/RADII"
|
| 47 |
+
_LICENSE = "cc-by-4.0"
|
| 48 |
+
|
| 49 |
+
# Map HF split names (conventional) to metadata split labels (project convention).
|
| 50 |
+
_SPLIT_MAP = {"train": "train", "id_test": "ID", "ood_test": "OOD"}
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class RADII(datasets.GeneratorBasedBuilder):
|
| 54 |
+
"""Radius-resolved benchmark for graph generative models in materials science."""
|
| 55 |
+
|
| 56 |
+
VERSION = datasets.Version("1.0.0")
|
| 57 |
+
|
| 58 |
+
def _info(self):
|
| 59 |
+
features = datasets.Features({
|
| 60 |
+
"material": datasets.Value("string"),
|
| 61 |
+
"radius": datasets.Value("int32"),
|
| 62 |
+
"rot_idx": datasets.Value("int32"),
|
| 63 |
+
"split": datasets.Value("string"),
|
| 64 |
+
"num_atoms": datasets.Value("int32"),
|
| 65 |
+
"pos": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=3)),
|
| 66 |
+
"z": datasets.Sequence(datasets.Value("int8")),
|
| 67 |
+
"cell_matrix": datasets.Sequence(
|
| 68 |
+
datasets.Sequence(datasets.Value("float32"), length=3), length=3
|
| 69 |
+
),
|
| 70 |
+
"cell_pos": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=3)),
|
| 71 |
+
"cell_z": datasets.Sequence(datasets.Value("int8")),
|
| 72 |
+
})
|
| 73 |
+
return datasets.DatasetInfo(
|
| 74 |
+
description=_DESCRIPTION,
|
| 75 |
+
features=features,
|
| 76 |
+
homepage=_HOMEPAGE,
|
| 77 |
+
license=_LICENSE,
|
| 78 |
+
citation=_CITATION,
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
def _split_generators(self, dl_manager):
|
| 82 |
+
# Regenerate the cache locally via the `radii` package.
|
| 83 |
+
try:
|
| 84 |
+
import radii # noqa: F401
|
| 85 |
+
from radii.download import download_seed
|
| 86 |
+
from radii.generation import create_radii
|
| 87 |
+
except ImportError as e:
|
| 88 |
+
raise RuntimeError(
|
| 89 |
+
"The RADII HuggingFace loader requires the `radii` package. Install:\n"
|
| 90 |
+
" pip install 'radii @ git+https://github.com/KurbanIntelligenceLab/RADII'"
|
| 91 |
+
) from e
|
| 92 |
+
|
| 93 |
+
cache_root = Path.home() / ".cache" / "radii"
|
| 94 |
+
(cache_root / "raw").mkdir(parents=True, exist_ok=True)
|
| 95 |
+
|
| 96 |
+
samples_npz = cache_root / "cache" / "samples.npz"
|
| 97 |
+
metadata_json = cache_root / "cache" / "metadata.json"
|
| 98 |
+
unit_cells_npz = cache_root / "cache" / "unit_cells.npz"
|
| 99 |
+
|
| 100 |
+
if not (samples_npz.exists() and metadata_json.exists() and unit_cells_npz.exists()):
|
| 101 |
+
print(f"[RADII] No local cache at {cache_root}. Downloading seed + regenerating...")
|
| 102 |
+
seed = download_seed(dest=cache_root / "raw")
|
| 103 |
+
create_radii(raw_data_dir=str(seed), output_dir=str(cache_root))
|
| 104 |
+
|
| 105 |
+
return [
|
| 106 |
+
datasets.SplitGenerator(
|
| 107 |
+
name=getattr(datasets.Split, hf_split.upper()) if hf_split == "train"
|
| 108 |
+
else datasets.Split(hf_split),
|
| 109 |
+
gen_kwargs={"cache_root": str(cache_root), "hf_split": hf_split},
|
| 110 |
+
)
|
| 111 |
+
for hf_split in _SPLIT_MAP
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
def _generate_examples(self, cache_root, hf_split):
|
| 115 |
+
cache_root = Path(cache_root)
|
| 116 |
+
raw_split = _SPLIT_MAP[hf_split]
|
| 117 |
+
|
| 118 |
+
with (cache_root / "cache" / "metadata.json").open() as f:
|
| 119 |
+
meta = json.load(f)
|
| 120 |
+
sample_meta = meta["samples"]
|
| 121 |
+
|
| 122 |
+
samples = np.load(cache_root / "cache" / "samples.npz", allow_pickle=True)
|
| 123 |
+
pos_all, z_all, offsets = samples["pos"], samples["z"], samples["offsets"]
|
| 124 |
+
|
| 125 |
+
unit_cells = np.load(cache_root / "cache" / "unit_cells.npz", allow_pickle=True)
|
| 126 |
+
materials_map = {}
|
| 127 |
+
for k in unit_cells.files:
|
| 128 |
+
if k.endswith("_pos"):
|
| 129 |
+
mat = k[:-4]
|
| 130 |
+
materials_map[mat] = {
|
| 131 |
+
"pos": unit_cells[f"{mat}_pos"].astype(np.float32),
|
| 132 |
+
"z": unit_cells[f"{mat}_z"].astype(np.int8),
|
| 133 |
+
"cell_matrix": unit_cells[f"{mat}_cell_matrix"].astype(np.float32),
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
emitted = 0
|
| 137 |
+
for i, m in enumerate(sample_meta):
|
| 138 |
+
if m["split"] != raw_split:
|
| 139 |
+
continue
|
| 140 |
+
s, e = int(offsets[i]), int(offsets[i + 1])
|
| 141 |
+
uc = materials_map[m["material"]]
|
| 142 |
+
yield emitted, {
|
| 143 |
+
"material": m["material"],
|
| 144 |
+
"radius": int(m["radius"]),
|
| 145 |
+
"rot_idx": int(m["rot_idx"]),
|
| 146 |
+
"split": hf_split,
|
| 147 |
+
"num_atoms": int(m["num_atoms"]),
|
| 148 |
+
"pos": pos_all[s:e].astype(np.float32).tolist(),
|
| 149 |
+
"z": z_all[s:e].astype(np.int8).tolist(),
|
| 150 |
+
"cell_matrix": uc["cell_matrix"].tolist(),
|
| 151 |
+
"cell_pos": uc["pos"].tolist(),
|
| 152 |
+
"cell_z": uc["z"].tolist(),
|
| 153 |
+
}
|
| 154 |
+
emitted += 1
|
README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pretty_name: RADII
|
| 6 |
+
size_categories:
|
| 7 |
+
- 10K<n<100K
|
| 8 |
+
task_categories:
|
| 9 |
+
- other
|
| 10 |
+
tags:
|
| 11 |
+
- materials-science
|
| 12 |
+
- crystal-structures
|
| 13 |
+
- generative-models
|
| 14 |
+
- benchmark
|
| 15 |
+
- kdd-2026
|
| 16 |
+
- nanoparticles
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# RADII: Radius-Resolved Benchmark of Nanoparticle Structures
|
| 20 |
+
|
| 21 |
+
**RADII** measures where graph generative models start to fail as the structures they
|
| 22 |
+
generate grow larger. Radius is treated as a continuous scaling knob from
|
| 23 |
+
in-distribution to out-of-distribution; the dataset spans ten materials and 25 radii
|
| 24 |
+
with leakage-free splits.
|
| 25 |
+
|
| 26 |
+
- **Paper:** *How Far Can You Grow? Characterizing the Extrapolation Frontier of Graph Generative Models for Materials Science* — KDD '26
|
| 27 |
+
- **Code:** [github.com/KurbanIntelligenceLab/RADII](https://github.com/KurbanIntelligenceLab/RADII) (MIT)
|
| 28 |
+
- **Archival DOI:** [10.5281/zenodo.20431021](https://doi.org/10.5281/zenodo.20431021) (CC-BY-4.0)
|
| 29 |
+
|
| 30 |
+
## Quick start
|
| 31 |
+
|
| 32 |
+
This dataset uses a custom loader that downloads the seed (3 MB) from Zenodo
|
| 33 |
+
and regenerates the full ~12 GB benchmark locally on first use. **First call
|
| 34 |
+
takes minutes to ~1 hour depending on hardware; subsequent calls are instant.**
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
pip install datasets "radii @ git+https://github.com/KurbanIntelligenceLab/RADII"
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from datasets import load_dataset
|
| 42 |
+
|
| 43 |
+
ds = load_dataset("KurbanIntelligenceLab/RADII", split="train", trust_remote_code=True)
|
| 44 |
+
print(ds.features, len(ds), ds[0])
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
`with_format("torch")` works for one-line PyTorch integration:
|
| 48 |
+
|
| 49 |
+
```python
|
| 50 |
+
ds = ds.with_format("torch")
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Splits
|
| 54 |
+
|
| 55 |
+
| Split | Size | Radii (Å) |
|
| 56 |
+
|---|---|---|
|
| 57 |
+
| `train` | 48,000 | 15 values: 8–10, 12, 14, 16, 18, 20, 22–28 |
|
| 58 |
+
| `id_test` | 13,500 | 6 values: 11, 13, 15, 17, 19, 21 (interleaved, unseen orientations) |
|
| 59 |
+
| `ood_test` | 13,480 | 4 values: 6, 7, 29, 30 (strictly outside training range) |
|
| 60 |
+
|
| 61 |
+
The OOD test structures are ~59% smaller and ~24% larger than the smallest and largest
|
| 62 |
+
training structures (atom counts 33–11,298 vs train 81–9,148).
|
| 63 |
+
|
| 64 |
+
## Materials (10)
|
| 65 |
+
|
| 66 |
+
Ag, Au, CH₃NH₃PbI₃, Fe₂O₃, MoS₂, PbS, SnO₂, SrTiO₃, TiO₂, ZnO.
|
| 67 |
+
|
| 68 |
+
## Schema (per row)
|
| 69 |
+
|
| 70 |
+
| Column | Type | Notes |
|
| 71 |
+
|---|---|---|
|
| 72 |
+
| `material` | str | One of the 10 above |
|
| 73 |
+
| `radius` | int | Truncation radius in Å |
|
| 74 |
+
| `rot_idx` | int | Orientation index |
|
| 75 |
+
| `split` | str | `train`, `id_test`, or `ood_test` |
|
| 76 |
+
| `num_atoms` | int | Length of `pos`/`z` |
|
| 77 |
+
| `pos` | list[list[float32]] | `num_atoms × 3` atomic coordinates |
|
| 78 |
+
| `z` | list[int8] | `num_atoms` atomic numbers |
|
| 79 |
+
| `cell_matrix` | list[list[float32]] | `3 × 3` lattice vectors of the parent unit cell |
|
| 80 |
+
| `cell_pos` | list[list[float32]] | Unit-cell basis positions (per-material) |
|
| 81 |
+
| `cell_z` | list[int8] | Unit-cell basis atomic numbers |
|
| 82 |
+
|
| 83 |
+
## Why a custom loader?
|
| 84 |
+
|
| 85 |
+
The benchmark is deterministic from a 3 MB seed archive. Rather than duplicating
|
| 86 |
+
~12 GB of derived data on this Hub, the loader fetches the seed from the citeable
|
| 87 |
+
Zenodo record and regenerates locally — keeping a single source of truth and
|
| 88 |
+
making the reproducibility story explicit. The HF datasets cache makes subsequent
|
| 89 |
+
calls fast.
|
| 90 |
+
|
| 91 |
+
## Citation
|
| 92 |
+
|
| 93 |
+
```bibtex
|
| 94 |
+
@inproceedings{polat2026radii,
|
| 95 |
+
title = {How Far Can You Grow? Characterizing the Extrapolation Frontier of Graph Generative Models for Materials Science},
|
| 96 |
+
author = {Polat, Can and Serpedin, Erchin and Kurban, Mustafa and Kurban, Hasan},
|
| 97 |
+
booktitle = {Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
|
| 98 |
+
series = {KDD '26},
|
| 99 |
+
year = {2026}
|
| 100 |
+
}
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
## License
|
| 104 |
+
|
| 105 |
+
CC-BY-4.0. See [10.5281/zenodo.20431021](https://doi.org/10.5281/zenodo.20431021)
|
| 106 |
+
for the archival record terms. The accompanying code is MIT-licensed at the GitHub repo.
|