You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

Mermaid 50K

License: PolyForm Noncommercial License 1.0.0. 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:

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:

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:

{
  "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

Loading The Dataset

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:

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:

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:

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.

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

Downloads last month
-