MDEval: Evaluating and Enhancing Markdown Awareness in Large Language Models

Zhongpu Chen, Yinfeng Liu, Long Shi, Xingyan Chen, Yu Zhao, Fuji Ren · DOI

Abstract

As Large Language Models (LLMs) become central to user-facing applications, the readability of their output is as crucial as its correctness. This paper introduces MDEval, a benchmark and metric for "Markdown Awareness"—the ability of an LLM to naturally structure responses using headings, lists, and LaTeX without explicit instructions. Our findings indicate that structural proficiency is a distinct capability from general reasoning. We observe that models like Deepseek-v2-chat excel in this area, and even lower-performing models can significantly improve their formatting through minimal targeted fine-tuning.

Introduction

When users interact with AI assistants, they expect well-organized information rather than a "wall of text." Effective use of Markdown—including hierarchical headings, bulleted lists, and formatted mathematical expressions—significantly enhances the user experience. However, standard evaluation metrics like BLEU or ROUGE focus on word overlap, and model-based evaluators often prioritize semantic truth over structural presentation.

Comparison of LLM responses to the same prompt, showing varying levels of Markdown structure.

The authors define "Markdown Awareness" as the zero-shot instinct of a model to provide a well-formatted response. This paper addresses the lack of standardized measurement for this critical component of LLM performance.

The MDEval Methodology

To isolate structural quality from content accuracy, the researchers developed a four-phase evaluation pipeline:

  1. Generation: The target LLM responds to a prompt without formatting instructions.
  2. Rewrite: An advanced model (GPT-4o) creates a "model-specific reference" by rewriting the original response into ideal Markdown while preserving the exact text.
  3. HTMLification: Both versions are converted to HTML. The system extracts only the structural tags (e.g., <h3>, <ul>). A custom <math> tag was introduced to specifically track LaTeX elements, which are often handled inconsistently across models.
  4. Scoring: The final MDEval score is derived from the normalized Levenshtein edit distance between the two tag sequences. A score of 1.0 indicates perfect alignment with the ideal structure.
Differences in math formatting between Claude-3.5-sonnet (plain text) and GPT-4o-mini (LaTeX) and their respective web renderings.

Dataset and Human Alignment

The MDEval Dataset comprises 20,000 instances across 10 diverse subjects (e.g., Law, Science, Economics) in English and Chinese. Unlike traditional benchmarks, it focuses on prompts "worthy of a well-formatted response" rather than those with a single ground-truth answer. To validate the metric, the authors collected human preference data, finding that MDEval has an 84.1% accuracy in predicting human structural preferences, significantly outperforming existing automated methods.

Key Insights

Intelligence vs. Formatting

A major finding is that general reasoning ability does not guarantee high Markdown awareness. For instance, Llama-3.1-8b outperformed the more powerful Claude-3.5-sonnet in structural quality. This suggests that formatting is a specific behavior often shaped during the Reinforcement Learning from Human Feedback (RLHF) phase.

Model Rankings

Deepseek-v2-chat emerged as the top performer with a score of 0.946, surpassing GPT-4o (0.865). This indicates that certain models are specifically optimized for web-friendly, structured output.

Teachability

Markdown awareness is highly responsive to fine-tuning. By training Baichuan2-13b on just 1,600 instances from the MDEval dataset, its score jumped from 0.171 to 0.73, nearly reaching the level of GPT-4.

Conclusion and Future Work

While MDEval provides a robust framework for evaluating structure, it relies on a "judge" model (GPT-4o) for reference generation, which may introduce its own biases. Additionally, the metric intentionally ignores content truthfulness to isolate formatting. Future research will aim to integrate readability, coherence, and factual accuracy into a more holistic evaluation framework.

Summary updated

BibTeX
@inproceedings{chen2025mdeval,
  author = {Zhongpu Chen and Yinfeng Liu and Long Shi and Xingyan Chen and Yu Zhao and Fuji Ren},
  title = {{MDEval: Evaluating and Enhancing Markdown Awareness in Large Language Models}},
  booktitle = {The Web Conference},
  year = {2025},
  doi = {10.1145/3696410.3714674},
}
Figure