joelbarmettler/md-reheader

TEXT GENERATIONConcurrent Unit Cost:1Model Size:0.8BQuant:BF16Context Size:32kTool Calling:SupportedPublished:Apr 5, 2026License:apache-2.0Architecture:Transformer0.0K Open Weights Featherless Exclusive Cold

md-reheader by Joel Barmettler is a 0.6 billion parameter Qwen3-based language model fine-tuned for restoring markdown heading hierarchy. It processes flattened markdown documents, predicting correct H1-H6 levels for each heading in a single forward pass. This model is specifically designed to fix document structure issues arising from PDF-to-markdown conversion tools, making it ideal for improving RAG chunking, navigation, and table of contents accuracy.

Loading preview...

Overview

md-reheader is a specialized 0.6 billion parameter language model, fine-tuned from Qwen3, designed to restore correct heading hierarchy in markdown documents. Many PDF-to-markdown conversion tools flatten document structures, making all headings H1 or H2. This model addresses that by analyzing the document content and predicting the appropriate H1-H6 level for each heading.

Key Capabilities

  • Automated Heading Restoration: Accurately re-establishes the intended structural hierarchy of markdown documents.
  • Efficient Processing: Operates with a small 0.6B parameter count, allowing for faster inference on various hardware.
  • Flexible Deployment: Supports CLI, Python API, direct transformers usage, and remote inference via vLLM or other OpenAI-compatible endpoints.
  • Robust Evaluation: Benchmarked on over 7,000 documents, achieving 56.1% exact match and 80.6% per-heading accuracy, significantly outperforming heuristic methods.
  • Contextual Understanding: Strips body text to preserve structural cues while minimizing context bloat, processing documents up to 8k tokens effectively.

Good For

  • Fixing PDF-to-Markdown Conversions: Essential for correcting structural damage from tools like MinerU, Docling, or Marker.
  • Improving RAG Systems: Ensures accurate document chunking and retrieval by maintaining logical sectioning.
  • Enhancing Document Navigation: Restores functional Tables of Contents and improves readability.
  • Small, Specialized Tasks: Ideal for use cases requiring a highly focused model that performs one task exceptionally well, suitable for self-hosting or edge deployment.