KohakuRAG: A simple RAG framework with hierarchical document indexing
Organizations: National Tsing Hua University · Comfy Org Research · Kohaku-Lab
Abstract
Retrieval-augmented generation (RAG) systems that answer questions from document collections face compounding difficulties when high-precision citations are required: flat chunking strategies sacrifice document structure, single-query formulations miss relevant passages through vocabulary mismatch, and single-pass inference produces stochastic answers that vary in both content and citation selection. We present KohakuRAG, a hierarchical RAG framework that preserves document structure through a four-level tree representation (document section paragraph sentence) with bottom-up embedding aggregation, improves retrieval coverage through an LLM-powered query planner with cross-query reranking, and stabilizes answers through ensemble inference with abstention-aware voting. We evaluate on the WattBot 2025 Challenge, a benchmark requiring systems to answer technical questions from 32 documents with 0.1% numeric tolerance and exact source attribution. KohakuRAG achieves first place on both public and private leaderboards (final score 0.861), as the only team to maintain the top position across both evaluation partitions. Ablation studies reveal that prompt ordering (+80% relative), retry mechanisms (+69%), and ensemble voting with blank filtering (+1.2pp) each contribute substantially, while hierarchical dense retrieval alone matches hybrid sparse-dense approaches (BM25 adds only +3.1pp). We release KohakuRAG as open-source software at https://github.com/KohakuBlueleaf/KohakuRAG.
Figures & tables
| Component | Setting | =4 | =8 | =16 | Avg Rank |
|---|---|---|---|---|---|
| Embedding | Jina v3 (text only) | 0.752 ∗∗ | 0.801 † | 0.824 ∗ | 3.00 |
| Jina v3 (+ captions) | 0.859 | 0.836 † | 0.824 ∗∗ | 2.00 | |
| Jina v4 (+ images) | 0.869 | 0.868 | 0.890 | 1.00 | |
| Planner | 2 queries | 0.562 ∗∗ | 0.466 ∗ | 0.558 ∗∗ | 3.00 |
| 4 queries | 0.678 | 0.830 | 0.811 | 1.67 | |
| 6 queries | 0.787 | 0.809 | 0.838 | 1.33 |
| Component | Setting | =4 | =8 | =16 | Avg Rank |
|---|---|---|---|---|---|
| Prompt Order | Standard (Q C) | 0.418 ∗ | 0.485 ∗∗∗ | 0.704 | 2.00 |
| Reordered (C Q) | 0.752 | 0.783 | 0.811 | 1.00 | |
| BM25 top- | 0 (dense only) | 0.688 ∗ | 0.741 | 0.788 | 3.67 |
| 2 | 0.701 | 0.822 | 0.812 | 2.00 | |
| 4 | 0.763 | 0.801 | 0.819 | 1.33 | |
| 8 | 0.720 | 0.720 ∗∗ | 0.806 | 3.00 |
| Model | =4 | =8 | =16 | Rank |
|---|---|---|---|---|
| GPT-5-nano | .783 ∗∗ | .746 ∗∗ | .787 ∗∗ | 7.00 |
| GPT-5-mini | .812 ∗ | .804 ∗ | .847 | 4.67 |
| GPT-oss-120B | .805 † | .763 ∗ | .833 ∗ | 5.67 |
| Mistral-large | .853 ∗ | .862 | .816 † | 4.67 |
| Gemini-3-pro | .871 † | .873 | .875 | 2.67 |
| Kimi-k2 | .872 ∗ | .889 | .874 | 2.00 |
| ignore_blank | =1 | =5 | =9 | =13 | =15 |
|---|---|---|---|---|---|
| Off (1.88) | .799 | .866 ∗∗ | .882 ∗∗ | .883 ∗∗∗ | .884 ∗∗ |
| On ( 1.12 ) | .799 | .886 | .894 | .896 | .895 |
| – | +.020 | +.012 | +.013 | +.011 |
| Model | Config | Pub | Priv | |
|---|---|---|---|---|
| GPT-oss-120B | No img/BM25 | 5 | .884 | .852 |
| GPT-oss-120B | +BM25 | 7 | .862 | .857 |
| Gemini-3-pro | +Images | 1 | .901 | .839 |
| Top-5 mixed ensemble | – | .902 | .861 | |
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
| Mode | Matches | Snippets | Context (chars) |
|---|---|---|---|
| No dedup | 32.0 0.0 | 64.0 0.0 | 148,125 34,415 |
| Node-ID dedup | 20.9 3.9 | 41.8 7.8 | 96,332 24,577 |
| Tree dedup | 15.7 4.4 | 31.4 8.9 | 71,956 23,449 |
| Parameter | Values Tested | Default | Notes |
|---|---|---|---|
| top- (per query) | 4, 8, 16 | 16 | Higher = more coverage |
| top- | 16, 32, None | 32 | Post-rerank truncation |
| Planner queries | 2, 4, 6 | 4 | More = better coverage |
| Max retries | 0, 1, 2 | 0 | On abstention |
| BM25 top- | 0, 2, 4, 8 | 0 | 0 = dense only |
| Ensemble size | 1, 3, 5, 7, 9, 11, 13, 15 | 1 | Odd numbers only |
| Model | Jina v3 text | Jina v3 +img | Jina v4 +img |
|---|---|---|---|
| GPT-5-nano | 0.825 | 0.798 | 0.807 |
| GPT-5-mini | 0.832 | 0.879 | 0.841 |
| GPT-oss-120B | 0.436 | 0.501 | 0.431 |
| Mistral-large-2512 | 0.844 | 0.856 | 0.864 |
| Kimi-k2-thinking | 0.867 | 0.879 | 0.872 |
| Send to LLM | img =0 | img =2 | img =4 | img =8 |
|---|---|---|---|---|
| False (caption only) | 0.875 | 0.875 | 0.876 | 0.881 |
| True (with images) | 0.875 | 0.887 | 0.877 | 0.853 |
| Strategy | =1 | =3 | =5 | =7 | =9 | =11 | =13 | =15 |
|---|---|---|---|---|---|---|---|---|
| Independent | .799 | .841 | .869 | .876 | .886 | .883 | .888 | .889 |
| RefPriority | .799 | .836 | .864 | .871 | .883 | .880 | .886 | .889 |
| AnswerPriority | .799 | .837 | .868 | .876 | .886 | .884 | .889 | .892 |
| Union | .799 | .836 | .866 | .872 | .882 | .878 | .883 | .884 |
| Intersection | .799 | .838 | .868 | .875 | .886 | .882 | .888 | .890 |
| ignore_blank | =1 | =3 | =5 | =7 | =9 | =11 | =13 | =15 |
|---|---|---|---|---|---|---|---|---|
| Off | .799 | .836 | .866 | .872 | .882 | .878 | .883 | .884 |
| On | .799 | .860 | .886 | .886 | .894 | .891 | .896 | .895 |
| – | +.024 | +.020 | +.014 | +.012 | +.013 | +.013 | +.011 |
| Metric | Value |
|---|---|
| Total predictions analyzed | 2,583 |
| Correct predictions | 1,942 (75.2%) |
| Total errors | 641 (24.8%) |
| LLM configurations tested | 7 |
| Top- settings tested | 3 (4, 8, 16) |
| Random seeds per config | 3 |
| Metric | Value |
|---|---|
| Total teams | 66 |
| Mean (private public) | -0.0106 |
| Standard deviation of | 0.0452 |
| Median | -0.0160 |
| Minimum | -0.2130 |
| Maximum | 0.0980 |
| Pub Rank | Pub Score | Priv Score | Priv Rank | Score | Rank |
|---|---|---|---|---|---|
| #1 | 0.902 | 0.861 | #1 | -0.041 | 0 |
| #2 | 0.886 | 0.840 | #4 | -0.046 | -2 |
| #3 | 0.868 | 0.831 | #9 | -0.037 | -6 |
| #4 | 0.862 | 0.831 | #8 | -0.031 | -4 |
| #5 | 0.856 | 0.806 | #17 | -0.050 | -12 |
| #6 | 0.856 | 0.839 | #6 | -0.017 | 0 |
| Rank Band | Mean | Std | Median | |
|---|---|---|---|---|
| 1–10 | 10 | -0.0323 | 0.0132 | -0.0365 |
| 11–20 | 10 | -0.0241 | 0.0289 | -0.0205 |
| 21–30 | 10 | +0.0016 | 0.0284 | -0.0040 |
| 31–50 | 20 | -0.0181 | 0.0597 | -0.0190 |
| 51–100 | 16 | +0.0131 | 0.0414 | +0.0230 |
| Public | Private | Rank | Score |
|---|---|---|---|
| #21 | #2 | +19 | +0.055 |
| #20 | #3 | +17 | +0.044 |
| #25 | #15 | +10 | +0.035 |
| #23 | #16 | +7 | +0.024 |
| #10 | #5 | +5 | -0.007 |
Retrieval-Augmented Generation
Retrieval-augmented generation connects language models to external knowledge so answers can use current, domain-specific evidence.
See all 766 papers