LatentMD: Benchmarking Markdown Boundary Failures in LLM-Generated Text
Abstract
Large language models (LLMs) increasingly generate Markdown that is consumed by renderers, agents, code extractors, and structured downstream pipelines. Yet existing evaluations often conflate content quality with format adherence, leaving Markdown boundary failures under-measured. We introduce LatentMD, a benchmark and evaluation protocol for diagnosing CommonMark-level fence-boundary failures in LLM-generated Markdown. LatentMD separates content correctness from boundary correctness, enabling detection of outputs that are content-correct but boundary-broken. The benchmark contains 4,179 prompts and a CLI for scoring arbitrary model outputs. Across 9 LLMs and roughly 37,600 generations, we find that Markdown boundary failures are widespread: 38.0% of valid main-grid outputs are content-correct but boundary-broken, with substantial boundary breakage under unspecified prompts and in a small human-authored validation set. Ablations show that failures are driven primarily by same-family symmetric-delimiter collisions rather than nesting alone, are only partially mitigated by prompt hints, and generalize to Python triple-quote docstrings while JSON remains robust as an asymmetric-delimiter control. LatentMD provides a reproducible diagnostic target for parser-sensitive LLM evaluation.
Create a lesson
Metadata
- Categories
- cs.SE, cs.CL, cs.LG
- Comments
- v2: Appendix L adds five additional analyses (realistic-condition decomposition, downstream harm, newer models, expanded natural-prompt set, effective diversity)
Related papers
RBioBench: an execution-based benchmark for biomedical R code generation
Shared title terminologycs.SEXihao Piao, Dong Wang, Ziwei Yang et al.
Escalate on Failure: A Single-Model Mode-Switching Cascade for Local Code Generation
Shared title terminologycs.SEBrian K. Hudes
What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Code
Shared title terminologycs.SECristina Improta, Pietro Liguori, Domenico Cotroneo
LLMVul: A Vulnerability-Labeled Dataset of LLM-Generated C/C++ Functions from Real Production Repositories
Shared title terminologycs.SEMohammad Farhad, Shuvalaxmi Dass
Beyond Repository Boundaries: Cross-Repository Graph Retrieval for Code Generation
Shared title terminologycs.SEMinh Le-Anh, Nam Le Hai, Quyen Tran et al.
Keep Evaluation Fair: Detecting Data Leakage in Code Generation Benchmarks via Membership Inference Attacks
Shared title terminologycs.SEDongdong Zhao, Jian Chen, Guancheng Lin et al.