Mermaid_50K / README.md
CoreFidelity's picture
Add files using upload-large-folder tool
cdead4a verified
---
pretty_name: Mermaid 50K
language:
- en
license: other
task_categories:
- text-generation
tags:
- mermaid
- flowchart
- diagram-generation
- code-generation
- svg
- synthetic-data
size_categories:
- 10K<n<100K
---
# Mermaid 50K
> **License:** [PolyForm Noncommercial License 1.0.0](LICENSE). Free for personal, research, and academic use. Commercial use requires a separate written license.
> Commercial licensing inquiries: corefidelity@proton.me
**Mermaid 50K** is a synthetic dataset of 50,000 paired natural-language process descriptions and Mermaid `flowchart` diagrams, with a matching browser-rendered SVG for every diagram.
The dataset is intended for training, fine-tuning, benchmarking, and evaluating systems that translate process descriptions into valid Mermaid flowcharts. The included SVG renders also make the dataset useful for visual diagram understanding, multimodal training, OCR-style diagram captioning experiments, and text-to-diagram quality evaluation.
## Contents
| Path | Count | Description |
|------|------:|-------------|
| `mermaid_50k.jsonl` | 50,000 | Main JSONL dataset of description / Mermaid pairs |
| `svgs/` | 50,000 | Browser-rendered SVGs, one per Mermaid diagram |
| `examples/` | 6 | Representative Mermaid and SVG examples |
| `LICENSE` | 1 | PolyForm Noncommercial License 1.0.0 |
The SVGs are sharded into 1,000-file directories:
```text
svgs/000/000001.svg
svgs/000/000002.svg
...
svgs/049/050000.svg
```
For this release, record IDs align with dataset order, so record `id=1234` maps to:
```text
svgs/001/001234.svg
```
## Schema
Each row in `mermaid_50k.jsonl` is a JSON object:
| Field | Type | Description |
|-------|------|-------------|
| `id` | integer | Unique record ID |
| `topology` | string | Graph topology: `linear`, `branching`, `loop`, `parallel`, `tree`, or `mixed` |
| `domain` | string | Process domain: `auth`, `ecommerce`, `devops`, `messaging`, `software`, or `data` |
| `difficulty` | integer | Complexity score from 1 to 5 |
| `description` | string | Natural-language description of the diagram |
| `mermaid` | string | Mermaid `flowchart` source code |
Example row:
```json
{
"id": 100,
"topology": "mixed",
"domain": "devops",
"difficulty": 4,
"description": "A push event is received, leading to a decision on whether tests pass. If tests pass, linters are run. If tests fail, another decision point is reached. Dependencies are installed, which can be skipped to build an artifact, or proceed to a subroutine. The linters' outcome determines if an artifact is published.",
"mermaid": "flowchart TB\n A[\"Receive push event\"]\n B{\"Tests pass?\"}\n C(\"Install dependencies\")\n D(\"Run linters\")\n E{\"Pass?\"}\n F([\"Build artifact\"])\n G[[G]]\n H([\"Publish artifact\"])\n A -.-> B\n A -.->|Pass| C\n B -->|Pass| D\n B -->|Fail| E\n C -->|Skip| F\n C ==> G\n D -.-|True| H"
}
```
## Example Diagrams
| Domain | Mermaid | Rendered SVG |
|--------|---------|--------------|
| Auth | [`examples/auth_d2.mmd`](examples/auth_d2.mmd) | ![Auth example](examples/auth_d2.svg) |
| Ecommerce | [`examples/ecommerce_d3.mmd`](examples/ecommerce_d3.mmd) | ![Ecommerce example](examples/ecommerce_d3.svg) |
| DevOps | [`examples/devops_d2.mmd`](examples/devops_d2.mmd) | ![DevOps example](examples/devops_d2.svg) |
| Messaging | [`examples/messaging_d4.mmd`](examples/messaging_d4.mmd) | ![Messaging example](examples/messaging_d4.svg) |
| Software | [`examples/software_d3.mmd`](examples/software_d3.mmd) | ![Software example](examples/software_d3.svg) |
| Data | [`examples/data_d4.mmd`](examples/data_d4.mmd) | ![Data example](examples/data_d4.svg) |
## Loading The Dataset
```python
from datasets import load_dataset
ds = load_dataset(
"CoreFidelity/Mermaid_50K",
data_files="mermaid_50k.jsonl",
)["train"]
row = ds[0]
print(row["description"])
print(row["mermaid"])
```
To locate the corresponding SVG for a record:
```python
def svg_path(row):
record_id = int(row["id"])
shard = f"{(record_id - 1) // 1000:03d}"
return f"svgs/{shard}/{record_id:06d}.svg"
print(svg_path(row))
```
## Fine-Tuning Format
For instruction tuning, a simple prompt/completion format is:
```python
def format_example(row):
prompt = (
"Convert the following process description into a Mermaid flowchart. "
"Output only valid Mermaid code.\n\n"
f"Description: {row['description'].strip()}\n\n"
"Mermaid:"
)
completion = "\n" + row["mermaid"].strip()
return {"prompt": prompt, "completion": completion}
```
For chat-style fine-tuning:
```python
def format_chat(row):
return {
"messages": [
{
"role": "user",
"content": (
"Convert this process description into a Mermaid flowchart. "
"Return only the Mermaid code.\n\n"
f"{row['description'].strip()}"
),
},
{"role": "assistant", "content": row["mermaid"].strip()},
]
}
```
## Suggested Tasks
- Text-to-Mermaid generation
- Mermaid syntax and renderability evaluation
- Natural-language-to-diagram fine-tuning
- Diagram captioning or description generation
- Multimodal diagram understanding using paired text, Mermaid source, and SVG renderings
- Domain-specific process-flow modeling
## Dataset Statistics
| Split | Records |
|-------|--------:|
| train | 50,000 |
### Domain Distribution
| Domain | Records |
|--------|--------:|
| auth | 8,247 |
| data | 8,233 |
| devops | 8,330 |
| ecommerce | 8,489 |
| messaging | 8,376 |
| software | 8,325 |
### Topology Distribution
| Topology | Records |
|----------|--------:|
| branching | 14,940 |
| linear | 10,072 |
| loop | 7,426 |
| mixed | 5,014 |
| parallel | 7,495 |
| tree | 5,053 |
### Difficulty Distribution
| Difficulty | Records |
|------------|--------:|
| 1 | 2,936 |
| 2 | 10,660 |
| 3 | 15,075 |
| 4 | 12,170 |
| 5 | 9,159 |
## Generation And Validation
The dataset was generated through a structured synthetic-data pipeline:
- graph topologies and domain-specific labels were sampled from structured templates
- Mermaid code was produced from an intermediate graph representation
- natural-language descriptions were generated and quality-audited before release
- every Mermaid diagram was rendered to SVG using Mermaid in a real browser environment
Release validation:
| Check | Result |
|-------|-------:|
| JSONL records | 50,000 |
| SVG renders | 50,000 |
| SVG render failures | 0 |
| Missing SVG viewBox values | 0 |
| Invalid `NaN` / `undefined` SVG output | 0 |
## Limitations
This is a synthetic dataset focused on Mermaid `flowchart` diagrams. It does not cover every Mermaid diagram type, every possible Mermaid syntax feature, or every real-world process-modeling convention. Descriptions are English-only and may be more concise or template-like than human-authored documentation.
Models trained on this dataset should still be evaluated for Mermaid syntax validity, renderability, semantic faithfulness to the prompt, and behavior on diagrams outside the covered domains.
## License
This dataset is released under the [PolyForm Noncommercial License 1.0.0](LICENSE).
Personal, research, academic, and other noncommercial uses are permitted under the license terms. Commercial use, including commercial model training, commercial fine-tuning, SaaS products, internal tooling at for-profit companies, or any use intended for commercial advantage or monetary compensation, requires a separate written commercial license.
Commercial licensing inquiries: corefidelity@proton.me