MDKeyChunker: Single-Call LLM Enrichment with Rolling Keys and Key-Based Restructuring for High-Accuracy RAG

arXiv cs.LG / 3/26/2026

💬 OpinionIdeas & Deep AnalysisTools & Practical UsageModels & Research

Key Points

  • MDKeyChunkerは、Markdownドキュメントの構造(見出し・コードブロック・表・リスト)を原子的に扱う構造認識チャンク化で、意味単位の分断を抑えるRAG前処理手法を提案しています。
  • 各チャンクのメタデータ(タイトル、要約、キーワード、型付きエンティティ、仮想質問、セマンティックキー)を「単一のLLM呼び出し」で7項目まとめて抽出し、従来のフィールド別の複数パスを不要にする設計です。
  • ローリングキー辞書を文書レベル文脈として伝播し、手作業のスコアリング代替としてLLMネイティブのセマンティック整合でチャンク間の関連性を維持します。
  • セマンティックキーが一致するチャンク同士をビンパッキングでマージし、関連コンテンツを同一配置に再構成することで検索時の再現性向上を狙っています。
  • 18文書Markdownを用いた30クエリの評価では、構造チャンクにBM25を適用したConfig DがRecall@5=1.000・MRR=0.911を達成し、密な検索を含む全パイプラインでもRecall@5=0.867と報告されています。

Abstract

RAG pipelines typically rely on fixed-size chunking, which ignores document structure, fragments semantic units across boundaries, and requires multiple LLM calls per chunk for metadata extraction. We present MDKeyChunker, a three-stage pipeline for Markdown documents that (1) performs structure-aware chunking treating headers, code blocks, tables, and lists as atomic units; (2) enriches each chunk via a single LLM call extracting title, summary, keywords, typed entities, hypothetical questions, and a semantic key, while propagating a rolling key dictionary to maintain document-level context; and (3) restructures chunks by merging those sharing the same semantic key via bin-packing, co-locating related content for retrieval. The single-call design extracts all seven metadata fields in one LLM invocation, eliminating the need for separate per-field extraction passes. Rolling key propagation replaces hand-tuned scoring with LLM-native semantic matching. An empirical evaluation on 30 queries over an 18-document Markdown corpus shows Config D (BM25 over structural chunks) achieves Recall@5=1.000 and MRR=0.911, while dense retrieval over the full pipeline (Config C) reaches Recall@5=0.867. MDKeyChunker is implemented in Python with four dependencies and supports any OpenAI-compatible endpoint.