File size: 2,920 Bytes
83bb14a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0b9674f
 
 
83bb14a
0b9674f
 
83bb14a
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
language:
- en
tags:
- molecular-generation
- conditional-generation
- graph-tokenization
- chemistry
pretty_name: MOSAIC Conditional Motif Generation
---

# MOSAIC: Conditional Motif Generation

Conditional generation samples + metrics for the three MOSAIC tokenizers
(SENT, HDT-MC, HDTC) prompted with each of 6 shared ring/aromatic motifs,
across MOSES, GuacaMol, and COCONUT.

The conditioning prompt for each model is the standalone-motif tokenization,
with closing tokens stripped so the model continues from "the molecule starts
with this motif." For HDT-MC, the outer ENTER block is left open so the model
can add additional communities; for HDTC, the trailing super-graph block is
stripped so the model can add more typed communities.

## Layout

- `{dataset}__AVG.png` — per-dataset metric table averaged over the 6 motifs
- `{dataset}__AVG__grid.png` — per-dataset 6×5 visual grid (one row per motif,
  one column per model, plus reference + motif primer)
- `{dataset}/_reference/{motif}.txt` — k motif-containing reference SMILES drawn
  from training (used as the comparison set for SNN / Frag / motif-distribution
  MMDs)
- `{dataset}/{motif}/{dataset}__{motif}.png` — per-cell metric table
- `{dataset}/{motif}/{dataset}__{motif}__grid.png` — per-cell 5-column visual
  grid (Reference | Motif Primer | SENT | HDT-MC | HDTC)
- `{dataset}/{motif}/{model}/generated_smiles.txt` — k=100 conditional generations
- `{dataset}/{motif}/{model}/generated_metadata.json` — gen-time stats (prompt
  token sequence, decode rate, motif retention, sampling params, elapsed)
- `{dataset}/{motif}/{model}/metrics.json` — full computed metrics

## Motifs

| Name | SMARTS / SMILES |
|------|-----------------|
| `benzene` | `c1ccccc1` |
| `pyridine` | `c1ccncc1` |
| `naphthalene` | `c1ccc2ccccc2c1` |
| `indole` | `c1ccc2[nH]ccc2c1` |
| `cyclohexane` | `C1CCCCC1` |
| `cyclopentane` | `C1CCCC1` |

## Datasets

- **moses** — MOSES drug-like (training set ~1.6M)
- **guacamol** — GuacaMol drug-like (test split fallback, ~941 reference SMILES)
- **coconut** — COCONUT natural products (training set ~10K)

## Models

Listed in the column order used by the rendered tables (flat → unsupervised
hierarchies → supervised hierarchy → typed hierarchy):

- **sent** — flat random-walk tokenizer (SENT)
- **hdt_lou** — HDT with Louvain community coarsening (HDT-Lou)
- **hdt_hac** — HDT with HAC-avg community coarsening (HDT-HAC)
- **hdt** — HDT with motif-community coarsening (HDT-MC)
- **hdtc** — HDT-Compositional, typed two-level (RING / FUNC / SINGLETON)

All models are gpt2xs (~11M params) trained with next-token prediction.
Per-cell sample budget: k=100 decodable molecules per (dataset, model, motif),
obtained via rejection sampling capped at 800 attempts.

## Pipeline

Generation/metric/render code lives in the MOSAIC repo at
`scripts/conditional_motif/`.