kUML vs. PlantUML vs. Mermaid: what a 50-task LLM benchmark shows
We ran a Generate-Compile-Repair benchmark across 50 architecture tasks — class, sequence, C4, and SysML 2 diagrams — comparing kUML, PlantUML, and Mermaid on compile rate, structural fidelity, and hallucination rate.
We publish kUML’s core thesis as a research idea in The Compiler as Oracle: when an LLM generates architecture models in a statically typed internal DSL instead of an untyped external one, a host-language compiler becomes a free, deterministic validation oracle. Compile errors — unresolved references, type mismatches, scope violations — become structured repair signals a Generate-Compile-Repair (GCR) loop can act on directly. (Preprint archived on Zenodo, DOI 10.5281/zenodo.21219554; arXiv submission pending.)
We just ran the first full-corpus test of that idea: 50 natural-language architecture tasks (class diagrams, sequence diagrams, C4 containers, SysML 2 block definitions), each generated independently in kUML, PlantUML, and Mermaid, validated with the real toolchain (kuml render, plantuml, mermaid-cli), and repaired up to 3 times on failure.
The headline numbers
| DSL | Compile rate (first shot) | Final compile rate (after repair) | Structural fidelity | Hallucination rate |
|---|---|---|---|---|
| kUML + GCR | 78.0% | 98.0% | 45.3% | 15.4% |
| PlantUML | 98.0% | 100.0% | 37.9% | 16.5% |
| Mermaid | 98.0% | 100.0% | 37.4% | 21.9% |
Structural fidelity measures how closely the generated model’s node and edge set matches a hand-authored gold standard — the thing that actually matters once a diagram “compiles.” Hallucination rate measures how many generated entities have no correspondence in that gold standard.
Why kUML starts behind and still wins
kUML’s syntax is far less represented in LLM training data than PlantUML’s or Mermaid’s — so it’s no surprise the first-shot compile rate starts lower (78%, and as low as 16.7% for C4 diagrams specifically). What’s notable is what happens next: the repair loop closes almost the entire gap, landing at 98% final compile rate, because a real compiler tells the model exactly what’s wrong and often what it probably meant.
PlantUML and Mermaid never hit that wall in the first place — but not because they’re more correct. We verified this directly: feed either tool a typo’d reference (Boook instead of Book) and both silently auto-declare a phantom class and render successfully, exit code 0. kUML rejects the same input with Unresolved reference 'boook'. and exit code 3. The errors don’t disappear in PlantUML and Mermaid — they become invisible. That’s exactly why kUML’s structural fidelity ends up ahead despite a rockier first shot: a model that’s forced to resolve every reference before anything renders ends up closer to what was actually asked for.
Where each DSL struggles
- kUML’s C4 syntax was the single hardest first-shot target (16.7% compile rate, and the most repair iterations of any category) — likely because relating a container to an external system requires an explicit variable binding that our prompt primer didn’t emphasize enough. That’s a concrete, actionable finding for the next prompt iteration.
- Mermaid has no native SysML 2 support, so we had it transliterate blocks into plain class notation — the realistic fallback a developer would reach for. It lost the most structure doing so (17.3% fidelity, 50% hallucination rate on that slice), more than PlantUML’s equivalent workaround.
- Sequence diagrams are the one place Mermaid edged out kUML on fidelity — worth a closer look at our sequence-diagram prompt.
Honest limitations
This is one model (Claude Sonnet 5), one sample per task — not the three-model, three-sample design from the full benchmark paper. Hallucination rate is measured algorithmically (fuzzy name-matching against the gold standard), not by a semantic judge, so it’s a rougher, stricter proxy than the paper’s definition. We didn’t visually inspect the rendered SVGs — only compile/parse success and structural content.
Want to see the actual diagrams instead of just the numbers? The benchmark gallery renders all 50 tasks: gold standard next to what kUML, PlantUML, and Mermaid each generated.
We’re publishing the full task corpus, the gold-standard models, the scoring script, and the raw generation results so anyone can rerun this with their own LLM of choice. See the handbook page for the reproducibility package, or go straight to the GitHub repository.