File size: 7,731 Bytes
6c0a4ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87128ab
6c0a4ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
language:
- fr
license: other
pretty_name: OntoBook
task_categories:
- text-generation
- fill-mask
tags:
- synthetic
- biomedical
- medical
- ontology
- knowledge-graph
- pretraining
- french
size_categories:
- 1M<n<10M
configs:
- config_name: default
  data_files:
  - split: cim10
    path: data/cim10/*.parquet
  - split: ccam
    path: data/ccam/*.parquet
  - split: atc
    path: data/atc/*.parquet
dataset_info:
- config_name: default
  features: &features
  - name: id
    dtype: string
  - name: code
    dtype: string
  - name: label
    dtype: string
  - name: walk_type
    dtype: string
  - name: source_walk
    dtype: string
  - name: text
    dtype: string
  splits:
  - name: cim10
    num_examples: 435870
    num_bytes: 3080397326
  - name: ccam
    num_examples: 719655
    num_bytes: 3872813566
  - name: atc
    num_examples: 138920
    num_bytes: 474330917
  download_size: 655901016
  dataset_size: 7427541809
---

![OntoBook](logo.jpg)

# OntoBook: Ontology-Grounded Synthetic Textbooks for Medical Encoder Pretraining

### Dataset Authors

**Rian Touchent & Eric de la Clergerie**  
*Inria, Sorbonne Université*

### Overview

OntoBook is a French biomedical pretraining corpus generated from the relational structure of three medical ontologies: **CIM-10 FR PMSI** for diagnoses, **CCAM** for medical procedures, and **ATC** for drugs. Weighted random walks turn ontology graphs into structured sequences of codes and relations. [Qwen3-235B-A22B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-235B-A22B-Instruct-2507) then reformulates each walk into continuous textbook-style medical prose.

Two encoders pretrained on this corpus are available: [ModernCamemBERT-bio-v2-base](https://huggingface.co/rntc/ModernCamemBERT-bio-v2-base) and [ModernCamemBERT-bio-v2-large](https://huggingface.co/rntc/ModernCamemBERT-bio-v2-large).

The generation prompt requires the model to preserve the source codes, relations, definitions, notes, inclusions, and exclusions while avoiding information absent from the walk. The release retains both representations: the structured `source_walk` for provenance and the fluent `text` for language-model pretraining.

| Split | Domain | Examples | Estimated `text` tokens |
|---|---|---:|---:|
| `cim10` | Diagnoses and related conditions | 435,870 | ~258M |
| `ccam` | Medical procedures | 719,655 | ~279M |
| `atc` | Drugs and therapeutic classes | 138,920 | ~49M |
| **Total** | | **1,294,445** | **~586M** |

Token counts are estimated with `almanach/moderncamembert-base` from a stratified sample of 15,189 rows and exact character totals for the full release, without per-document special tokens. The structured `source_walk` field is estimated at approximately **1.36 billion tokens** with the same method.

## Load the Dataset

Use a current version of `datasets` (`pip install -U datasets`) so named splits declared in the dataset card are resolved correctly.

```python
from datasets import load_dataset

# Load one ontology.
dataset = load_dataset("almanach/OntoBook", split="cim10")

# The three available splits are: cim10, ccam, and atc.
print(dataset[0]["text"])
```

## Dataset Structure

Each split uses the same schema.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | Stable content-derived identifier prefixed by the ontology name. |
| `code` | `string` | Code or ontology node from which the walk starts. |
| `label` | `string` | Preferred label associated with the starting node. |
| `walk_type` | `string` | Normalized walk-generation strategy. |
| `source_walk` | `string` | Structured ontology walk supplied to the generator. |
| `text` | `string` | LLM reformulation in continuous French medical prose. |

### Walk Types

The CIM-10 configuration contains five targeted walk families: `etiologie`, `diagnostic_differentiel`, `codage_double`, `syndrome`, and `cross_chapter`. CCAM and ATC use `hierarchie`, `comparaison`, and `exploration` walks adapted to procedures and therapeutic classes.

| Walk type | CIM-10 | CCAM | ATC |
|---|---:|---:|---:|
| `etiologie` | 219,212 | — | — |
| `diagnostic_differentiel` | 206,576 | — | — |
| `codage_double` | 3,097 | — | — |
| `cross_chapter` | 5,663 | — | — |
| `syndrome` | 1,322 | — | — |
| `hierarchie` | — | 251,837 | 48,622 |
| `comparaison` | — | 251,876 | 48,622 |
| `exploration` | — | 215,942 | 41,676 |

## Generation Process

1. Medical ontologies are parsed from their RDF/OWL distributions.
2. Weighted random walks traverse hierarchical and semantic relations. Most walks contain 8–20 steps, with longer cross-chapter walks allowed for CIM-10.
3. `Qwen3-235B-A22B-Instruct-2507` reformulates the walks with temperature 0, guided JSON decoding, and thinking disabled.
4. The release builder normalizes Unicode and whitespace, standardizes walk-type labels, generates stable identifiers, and writes compressed Parquet shards.

Generation used vLLM with FP8 inference on four NVIDIA H100 GPUs. The complete reformulation stage took approximately 20 hours.

## Quality Controls

This release is built from pinned revisions of the three original datasets. All rows were checked for required values, valid token counts, known walk types, and duplicate content. Cleaning removed **356 exact duplicates** and **60 ATC rows with an empty label**. The final release contains no null fields or duplicate identifiers.

The counts in this card describe the cleaned, reformulated release. They differ from the number of raw ontology walks reported before generation and filtering.

## Intended Uses

OntoBook is intended for biomedical language-model pretraining, ontology-aware representation learning, medical coding research, and controlled studies of knowledge-graph verbalization. The `source_walk` and `text` pair can also support research on grounded generation and structure-to-text transformation.

## Limitations

The corpus is synthetic and may contain generation errors despite constrained prompting. It must not be treated as clinical guidance or used directly for diagnosis, treatment, or billing decisions. Ontology coverage and relational richness differ substantially across splits: CIM-10 contains semantic relations beyond hierarchy, while CCAM and ATC are predominantly hierarchical. The corpus is French and reflects the terminology versions used during generation.

## Licensing

This dataset contains transformations of several independently licensed terminologies and therefore does **not** have a single permissive license. Use and redistribution remain subject to the applicable source terms:

* **CIM-10 FR PMSI (2025-01-01):** [CC BY-NC-ND 3.0 IGO](https://smt.esante.gouv.fr/terminologie-cim-10/), maintained by ATIH from the WHO classification.
* **CCAM v80.00:** [Licence Ouverte 2.0](https://smt.esante.gouv.fr/terminologie-ccam/), maintained by CNAM.
* **ATC 2025-02:** [CC BY-ND 3.0 IGO](https://smt.esante.gouv.fr/terminologie-atc/), produced by WHO and translated by ANSM.

Users are responsible for determining whether their intended use and redistribution comply with these terms.

## Citation

If you use this dataset, please cite the OntoBook paper:

```bibtex
@inproceedings{touchent:hal-05697506,
  TITLE = {{OntoBook: Ontology-Grounded Synthetic Textbooks for Medical Encoder Pretraining}},
  AUTHOR = {Touchent, Rian and de la Clergerie, {\'E}ric},
  URL = {https://hal.science/hal-05697506},
  BOOKTITLE = {{Proceedings of Knowledge Graphs and Large Language Models Workshop}},
  ADDRESS = {Palma de Mallorca, Spain},
  YEAR = {2026},
  MONTH = May,
  PDF = {https://hal.science/hal-05697506v1/file/main.pdf},
  HAL_ID = {hal-05697506},
  HAL_VERSION = {v1},
}
```

[Paper](https://hal.science/hal-05697506)