Add Batch 7aff5de5-9720-4c00-a783-db404ec96dc0 data
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +64 -0
- 2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/e0b5b8ec-57ae-4057-8d8d-7671504d88a3_content_list.json +0 -0
- 2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/e0b5b8ec-57ae-4057-8d8d-7671504d88a3_model.json +0 -0
- 2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/e0b5b8ec-57ae-4057-8d8d-7671504d88a3_origin.pdf +3 -0
- 2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/full.md +0 -0
- 2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/images.zip +3 -0
- 2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/layout.json +0 -0
- 2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/d5e09ccc-cc4e-4a35-8517-510afa55cd88_content_list.json +0 -0
- 2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/d5e09ccc-cc4e-4a35-8517-510afa55cd88_model.json +0 -0
- 2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/d5e09ccc-cc4e-4a35-8517-510afa55cd88_origin.pdf +3 -0
- 2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/full.md +813 -0
- 2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/images.zip +3 -0
- 2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/layout.json +0 -0
- 2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/5b27d840-4fbb-4001-88b6-b01143c761b0_content_list.json +2232 -0
- 2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/5b27d840-4fbb-4001-88b6-b01143c761b0_model.json +0 -0
- 2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/5b27d840-4fbb-4001-88b6-b01143c761b0_origin.pdf +3 -0
- 2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/full.md +433 -0
- 2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/images.zip +3 -0
- 2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/layout.json +0 -0
- 2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/51b6c2e2-0989-42d2-8da7-e6723d1b56a6_content_list.json +0 -0
- 2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/51b6c2e2-0989-42d2-8da7-e6723d1b56a6_model.json +0 -0
- 2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/51b6c2e2-0989-42d2-8da7-e6723d1b56a6_origin.pdf +3 -0
- 2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/full.md +375 -0
- 2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/images.zip +3 -0
- 2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/layout.json +0 -0
- 2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/3fd5eadd-a858-4895-b32a-9d068b637861_content_list.json +0 -0
- 2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/3fd5eadd-a858-4895-b32a-9d068b637861_model.json +0 -0
- 2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/3fd5eadd-a858-4895-b32a-9d068b637861_origin.pdf +3 -0
- 2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/full.md +587 -0
- 2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/images.zip +3 -0
- 2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/layout.json +0 -0
- 2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/86826908-c47b-451c-a1e1-3b9045a788c9_content_list.json +0 -0
- 2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/86826908-c47b-451c-a1e1-3b9045a788c9_model.json +0 -0
- 2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/86826908-c47b-451c-a1e1-3b9045a788c9_origin.pdf +3 -0
- 2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/full.md +0 -0
- 2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/images.zip +3 -0
- 2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/layout.json +0 -0
- 2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/d0fad2a9-0893-44d4-a21c-5f8df75c328c_content_list.json +0 -0
- 2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/d0fad2a9-0893-44d4-a21c-5f8df75c328c_model.json +0 -0
- 2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/d0fad2a9-0893-44d4-a21c-5f8df75c328c_origin.pdf +3 -0
- 2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/full.md +373 -0
- 2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/images.zip +3 -0
- 2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/layout.json +0 -0
- 2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/73bdcaed-a35c-49f3-8627-be661122ae67_content_list.json +1601 -0
- 2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/73bdcaed-a35c-49f3-8627-be661122ae67_model.json +0 -0
- 2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/73bdcaed-a35c-49f3-8627-be661122ae67_origin.pdf +3 -0
- 2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/full.md +346 -0
- 2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/images.zip +3 -0
- 2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/layout.json +0 -0
- 2025/KodCode_ A Diverse, Challenging, and Verifiable Synthetic Dataset for Coding/c07b8238-09a6-4515-adae-2ea968c88497_content_list.json +0 -0
.gitattributes
CHANGED
|
@@ -693,3 +693,67 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 693 |
2025/K-order[[:space:]]Ranking[[:space:]]Preference[[:space:]]Optimization[[:space:]]for[[:space:]]Large[[:space:]]Language[[:space:]]Models/bbef63fd-d297-4428-85c0-0436174e8e7c_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 694 |
2025/KAPA_[[:space:]]A[[:space:]]Deliberative[[:space:]]Agent[[:space:]]Framework[[:space:]]with[[:space:]]Tree-Structured[[:space:]]Knowledge[[:space:]]Base[[:space:]]for[[:space:]]Multi-Domain[[:space:]]User[[:space:]]Intent[[:space:]]Understanding/cd4d1fab-c006-4368-82e8-5139eee485a1_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 695 |
2025/KARPA_[[:space:]]A[[:space:]]Training-free[[:space:]]Method[[:space:]]of[[:space:]]Adapting[[:space:]]Knowledge[[:space:]]Graph[[:space:]]as[[:space:]]References[[:space:]]for[[:space:]]Large[[:space:]]Language[[:space:]]Model’s[[:space:]]Reasoning[[:space:]]Path[[:space:]]Aggregation/a2607f0f-2817-47ed-8f34-30dd38a1d458_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 693 |
2025/K-order[[:space:]]Ranking[[:space:]]Preference[[:space:]]Optimization[[:space:]]for[[:space:]]Large[[:space:]]Language[[:space:]]Models/bbef63fd-d297-4428-85c0-0436174e8e7c_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 694 |
2025/KAPA_[[:space:]]A[[:space:]]Deliberative[[:space:]]Agent[[:space:]]Framework[[:space:]]with[[:space:]]Tree-Structured[[:space:]]Knowledge[[:space:]]Base[[:space:]]for[[:space:]]Multi-Domain[[:space:]]User[[:space:]]Intent[[:space:]]Understanding/cd4d1fab-c006-4368-82e8-5139eee485a1_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 695 |
2025/KARPA_[[:space:]]A[[:space:]]Training-free[[:space:]]Method[[:space:]]of[[:space:]]Adapting[[:space:]]Knowledge[[:space:]]Graph[[:space:]]as[[:space:]]References[[:space:]]for[[:space:]]Large[[:space:]]Language[[:space:]]Model’s[[:space:]]Reasoning[[:space:]]Path[[:space:]]Aggregation/a2607f0f-2817-47ed-8f34-30dd38a1d458_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 696 |
+
2025/KE-MHISTO_[[:space:]]Towards[[:space:]]a[[:space:]]Multilingual[[:space:]]Historical[[:space:]]Knowledge[[:space:]]Extraction[[:space:]]Benchmark[[:space:]]for[[:space:]]Addressing[[:space:]]the[[:space:]]Long-Tail[[:space:]]Problem/e0b5b8ec-57ae-4057-8d8d-7671504d88a3_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 697 |
+
2025/KITAB-Bench_[[:space:]]A[[:space:]]Comprehensive[[:space:]]Multi-Domain[[:space:]]Benchmark[[:space:]]for[[:space:]]Arabic[[:space:]]OCR[[:space:]]and[[:space:]]Document[[:space:]]Understanding/d5e09ccc-cc4e-4a35-8517-510afa55cd88_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 698 |
+
2025/KVPR_[[:space:]]Efficient[[:space:]]LLM[[:space:]]Inference[[:space:]]with[[:space:]]I_O-Aware[[:space:]]KV[[:space:]]Cache[[:space:]]Partial[[:space:]]Recomputation/5b27d840-4fbb-4001-88b6-b01143c761b0_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 699 |
+
2025/KaFT_[[:space:]]Knowledge-aware[[:space:]]Fine-tuning[[:space:]]for[[:space:]]Boosting[[:space:]]LLMs’[[:space:]]Domain-specific[[:space:]]Question-Answering[[:space:]]Performance/51b6c2e2-0989-42d2-8da7-e6723d1b56a6_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 700 |
+
2025/Know[[:space:]]the[[:space:]]Unknown_[[:space:]]An[[:space:]]Uncertainty-Sensitive[[:space:]]Method[[:space:]]for[[:space:]]LLM[[:space:]]Instruction[[:space:]]Tuning/3fd5eadd-a858-4895-b32a-9d068b637861_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 701 |
+
2025/KnowCoder-X_[[:space:]]Boosting[[:space:]]Multilingual[[:space:]]Information[[:space:]]Extraction[[:space:]]via[[:space:]]Code/86826908-c47b-451c-a1e1-3b9045a788c9_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 702 |
+
2025/Knowing[[:space:]]Before[[:space:]]Saying_[[:space:]]LLM[[:space:]]Representations[[:space:]]Encode[[:space:]]Information[[:space:]]About[[:space:]]Chain-of-Thought[[:space:]]Success[[:space:]]Before[[:space:]]Completion/d0fad2a9-0893-44d4-a21c-5f8df75c328c_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 703 |
+
2025/Knowledge[[:space:]]Base[[:space:]]Construction[[:space:]]for[[:space:]]Knowledge-Augmented[[:space:]]Text-to-SQL/73bdcaed-a35c-49f3-8627-be661122ae67_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 704 |
+
2025/KodCode_[[:space:]]A[[:space:]]Diverse,[[:space:]]Challenging,[[:space:]]and[[:space:]]Verifiable[[:space:]]Synthetic[[:space:]]Dataset[[:space:]]for[[:space:]]Coding/c07b8238-09a6-4515-adae-2ea968c88497_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 705 |
+
2025/Konooz_[[:space:]]Multi-domain[[:space:]]Multi-dialect[[:space:]]Corpus[[:space:]]for[[:space:]]Named[[:space:]]Entity[[:space:]]Recognition/e798a0a6-c618-4cab-a9e0-2c24b2baf405_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 706 |
+
2025/LADDER_[[:space:]]Language-Driven[[:space:]]Slice[[:space:]]Discovery[[:space:]]and[[:space:]]Error[[:space:]]Rectification[[:space:]]in[[:space:]]Vision[[:space:]]Classifiers/f1206d36-2865-4a40-a47b-e12a8e54327c_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 707 |
+
2025/LAM[[:space:]]SIMULATOR_[[:space:]]Advancing[[:space:]]Data[[:space:]]Generation[[:space:]]for[[:space:]]Large[[:space:]]Action[[:space:]]Model[[:space:]]Training[[:space:]]via[[:space:]]Online[[:space:]]Exploration[[:space:]]and[[:space:]]Trajectory[[:space:]]Feedback/150405f9-135d-4b5d-ac31-8984228a387e_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 708 |
+
2025/LCFO_[[:space:]]Long[[:space:]]Context[[:space:]]and[[:space:]]Long[[:space:]]Form[[:space:]]Output[[:space:]]Dataset[[:space:]]and[[:space:]]Benchmarking/2d365481-6abd-42fc-afe5-fe9f284062b3_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 709 |
+
2025/LCHAIM[[:space:]]-[[:space:]]Investigating[[:space:]]Long[[:space:]]Context[[:space:]]Reasoning[[:space:]]in[[:space:]]Hebrew/a9eb7b68-fdf3-474a-a6fa-c450e6f646b6_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 710 |
+
2025/LDIR_[[:space:]]Low-Dimensional[[:space:]]Dense[[:space:]]and[[:space:]]Interpretable[[:space:]]Text[[:space:]]Embeddings[[:space:]]with[[:space:]]Relative[[:space:]]Representations/2548bde0-a2c2-42bf-89ca-b0a14f29e443_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 711 |
+
2025/LEMMA_[[:space:]]Learning[[:space:]]from[[:space:]]Errors[[:space:]]for[[:space:]]MatheMatical[[:space:]]Advancement[[:space:]]in[[:space:]]LLMs/e21aecf5-99fe-4c4b-9bfb-b24657237397_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 712 |
+
2025/LEMONADE_[[:space:]]A[[:space:]]Large[[:space:]]Multilingual[[:space:]]Expert-Annotated[[:space:]]Abstractive[[:space:]]Event[[:space:]]Dataset[[:space:]]for[[:space:]]the[[:space:]]Real[[:space:]]World/3fbb32de-7280-46f2-bda5-2ea4358fed00_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 713 |
+
2025/LGAR_[[:space:]]Zero-Shot[[:space:]]LLM-Guided[[:space:]]Neural[[:space:]]Ranking[[:space:]]for[[:space:]]Abstract[[:space:]]Screening[[:space:]]in[[:space:]]Systematic[[:space:]]Literature[[:space:]]Reviews/f9c264f6-d792-447f-92f1-f8aecb6dc4c1_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 714 |
+
2025/LIME_[[:space:]]Less[[:space:]]Is[[:space:]]More[[:space:]]for[[:space:]]MLLM[[:space:]]Evaluation/cb5639ec-ed72-4ee3-95db-7f863cff0a43_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 715 |
+
2025/LIST_[[:space:]]Linearly[[:space:]]Incremental[[:space:]]SQL[[:space:]]Translator[[:space:]]for[[:space:]]Single-Hop[[:space:]]Reasoning,[[:space:]]Generation[[:space:]]and[[:space:]]Verification/5e6c5a44-27b6-4cfd-bd45-7d664aa57478_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 716 |
+
2025/LLM[[:space:]]Agents[[:space:]]for[[:space:]]Coordinating[[:space:]]Multi-User[[:space:]]Information[[:space:]]Gathering/0a7e6949-96a7-4757-a730-d6080a9beaf5_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 717 |
+
2025/LLM[[:space:]]Critics[[:space:]]Help[[:space:]]Catch[[:space:]]Bugs[[:space:]]in[[:space:]]Mathematics_[[:space:]]Towards[[:space:]]a[[:space:]]Better[[:space:]]Mathematical[[:space:]]Verifier[[:space:]]with[[:space:]]Natural[[:space:]]Language[[:space:]]Feedback/aad12a82-e314-4759-a0b8-8499f0c0b608_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 718 |
+
2025/LLM[[:space:]]as[[:space:]]Effective[[:space:]]Streaming[[:space:]]Processor_[[:space:]]Bridging[[:space:]]Streaming-Batch[[:space:]]Mismatches[[:space:]]with[[:space:]]Group[[:space:]]Position[[:space:]]Encoding/74648d4b-d36b-41b0-908f-e3553f4fa21b_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 719 |
+
2025/LLM-Based[[:space:]]Multi-Agent[[:space:]]Systems[[:space:]]are[[:space:]]Scalable[[:space:]]Graph[[:space:]]Generative[[:space:]]Models/a18ca140-9e92-4edf-aea2-23c0ae1e4b1b_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 720 |
+
2025/LLM-Empowered[[:space:]]Class[[:space:]]Imbalanced[[:space:]]Graph[[:space:]]Prompt[[:space:]]Learning[[:space:]]for[[:space:]]Online[[:space:]]Drug[[:space:]]Trafficking[[:space:]]Detection/7b26bc9d-b377-4910-afe9-3e06bd340262_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 721 |
+
2025/LLM-Enhanced[[:space:]]Query[[:space:]]Generation[[:space:]]and[[:space:]]Retrieval[[:space:]]Preservation[[:space:]]for[[:space:]]Task-Oriented[[:space:]]Dialogue/c1cef796-5e85-426f-9007-ec7e2c3da082_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 722 |
+
2025/LLM-Forest_[[:space:]]Ensemble[[:space:]]Learning[[:space:]]of[[:space:]]LLMs[[:space:]]with[[:space:]]Graph-Augmented[[:space:]]Prompts[[:space:]]for[[:space:]]Data[[:space:]]Imputation/f10f7154-4ccb-455b-982d-23ffb5abbbed_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 723 |
+
2025/LLM-Symbolic[[:space:]]Integration[[:space:]]for[[:space:]]Robust[[:space:]]Temporal[[:space:]]Tabular[[:space:]]Reasoning/ee7579fb-6271-4775-a467-0ad891020336_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 724 |
+
2025/LLM-as-an-Interviewer_[[:space:]]Beyond[[:space:]]Static[[:space:]]Testing[[:space:]]Through[[:space:]]Dynamic[[:space:]]LLM[[:space:]]Evaluation/342c0db2-1831-413d-826d-0da643100cb7_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 725 |
+
2025/LLM-based[[:space:]]Translation[[:space:]]Inference[[:space:]]with[[:space:]]Iterative[[:space:]]Bilingual[[:space:]]Understanding/a0c87fb9-79c1-4425-a383-945954accb07_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 726 |
+
2025/LLMTaxo_[[:space:]]Leveraging[[:space:]]Large[[:space:]]Language[[:space:]]Models[[:space:]]for[[:space:]]Constructing[[:space:]]Taxonomy[[:space:]]of[[:space:]]Factual[[:space:]]Claims[[:space:]]from[[:space:]]Social[[:space:]]Media/22239aa4-5117-4bbd-907f-11ff808468b8_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 727 |
+
2025/LLMVoX_[[:space:]]Autoregressive[[:space:]]Streaming[[:space:]]Text-to-Speech[[:space:]]Model[[:space:]]for[[:space:]]Any[[:space:]]LLM/e53921ce-85b2-4ea5-9375-674d06bf2def_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 728 |
+
2025/LLMs[[:space:]]Can[[:space:]]Achieve[[:space:]]High-quality[[:space:]]Simultaneous[[:space:]]Machine[[:space:]]Translation[[:space:]]as[[:space:]]Efficiently[[:space:]]as[[:space:]]Offline/a21d0ffa-8cc5-4f89-b84f-6873dc88bcc4_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 729 |
+
2025/LLMs[[:space:]]Can[[:space:]]Also[[:space:]]Do[[:space:]]Well![[:space:]]Breaking[[:space:]]Barriers[[:space:]]in[[:space:]]Semantic[[:space:]]Role[[:space:]]Labeling[[:space:]]via[[:space:]]Large[[:space:]]Language[[:space:]]Models/6f16f9d9-322c-4047-8a61-2b61ac485b33_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 730 |
+
2025/LLMs[[:space:]]are[[:space:]]Biased[[:space:]]Evaluators[[:space:]]But[[:space:]]Not[[:space:]]Biased[[:space:]]for[[:space:]]Fact-Centric[[:space:]]Retrieval[[:space:]]Augmented[[:space:]]Generation/107f20f9-830d-490a-af8a-4274cde31a3d_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 731 |
+
2025/LLMs[[:space:]]as[[:space:]]Planning[[:space:]]Formalizers_[[:space:]]A[[:space:]]Survey[[:space:]]for[[:space:]]Leveraging[[:space:]]Large[[:space:]]Language[[:space:]]Models[[:space:]]to[[:space:]]Construct[[:space:]]Automated[[:space:]]Planning[[:space:]]Models/a9d85117-f22c-41d4-aa21-9257888bb02a_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 732 |
+
2025/LR²Bench_[[:space:]]Evaluating[[:space:]]Long-chain[[:space:]]Reflective[[:space:]]Reasoning[[:space:]]Capabilities[[:space:]]of[[:space:]]Large[[:space:]]Language[[:space:]]Models[[:space:]]via[[:space:]]Constraint[[:space:]]Satisfaction[[:space:]]Problems/c716721d-d7a2-48d0-87d7-768f351fd019_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 733 |
+
2025/LSC-Eval_[[:space:]]A[[:space:]]General[[:space:]]Framework[[:space:]]to[[:space:]]Evaluate[[:space:]]Methods[[:space:]]for[[:space:]]Assessing[[:space:]]Dimensions[[:space:]]of[[:space:]]Lexical[[:space:]]Semantic[[:space:]]Change[[:space:]]Using[[:space:]]LLM-Generated[[:space:]]Synthetic[[:space:]]Data/f2c15fa2-3b94-465c-8fad-c9fd105743e0_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 734 |
+
2025/LTRAG_[[:space:]]Enhancing[[:space:]]Autoformalization[[:space:]]and[[:space:]]Self-refinement[[:space:]]for[[:space:]]Logical[[:space:]]Reasoning[[:space:]]with[[:space:]]Thought-Guided[[:space:]]RAG/8be55078-01c9-4290-baee-5ec0686b4f36_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 735 |
+
2025/Label-semantics[[:space:]]Aware[[:space:]]Generative[[:space:]]Approach[[:space:]]for[[:space:]]Domain-Agnostic[[:space:]]Multilabel[[:space:]]Classification/c8c33b33-daa1-4133-a169-f5bb2759d6df_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 736 |
+
2025/Language[[:space:]]Models[[:space:]]Lack[[:space:]]Temporal[[:space:]]Generalization[[:space:]]and[[:space:]]Bigger[[:space:]]is[[:space:]]Not[[:space:]]Better/a028fb7a-1581-45ab-a162-71d99ba22327_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 737 |
+
2025/Language[[:space:]]Repository[[:space:]]for[[:space:]]Long[[:space:]]Video[[:space:]]Understanding/ff30fed4-41c5-43a9-ba62-9a7abbf01dfd_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 738 |
+
2025/Large[[:space:]]Language[[:space:]]Models[[:space:]]Are[[:space:]]Natural[[:space:]]Video[[:space:]]Popularity[[:space:]]Predictors/ad639c9c-907d-4f5f-b2cc-09113ecbe276_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 739 |
+
2025/Large[[:space:]]Language[[:space:]]Models[[:space:]]Still[[:space:]]Exhibit[[:space:]]Bias[[:space:]]in[[:space:]]Long[[:space:]]Text/32025b10-d26e-4a08-9cc0-4b1312a27c77_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 740 |
+
2025/Large[[:space:]]Language[[:space:]]Models[[:space:]]are[[:space:]]Miscalibrated[[:space:]]In-Context[[:space:]]Learners/67b96b77-b888-4ce7-850f-4ded419f2ea8_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 741 |
+
2025/Large[[:space:]]Language[[:space:]]Models[[:space:]]as[[:space:]]Neurolinguistic[[:space:]]Subjects_[[:space:]]Discrepancy[[:space:]]between[[:space:]]Performance[[:space:]]and[[:space:]]Competence/d4769ef4-258d-4be6-9a99-51aca4bdb49e_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 742 |
+
2025/Large[[:space:]]Language[[:space:]]Models[[:space:]]for[[:space:]]Predictive[[:space:]]Analysis_[[:space:]]How[[:space:]]Far[[:space:]]Are[[:space:]]They_/40bc35d4-0599-4f31-b1b8-4d3651f1af84_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 743 |
+
2025/Large[[:space:]]Language[[:space:]]Models[[:space:]]in[[:space:]]Bioinformatics_[[:space:]]A[[:space:]]Survey/e5de0070-7c00-4644-83ae-b49b0f9b9a61_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 744 |
+
2025/Large[[:space:]]Vocabulary[[:space:]]Size[[:space:]]Improves[[:space:]]Large[[:space:]]Language[[:space:]]Models/83776e30-aad7-462f-8b79-3876954a4628_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 745 |
+
2025/Latent[[:space:]]Distribution[[:space:]]Decouple[[:space:]]for[[:space:]]Uncertain-Aware[[:space:]]Multimodal[[:space:]]Multi-label[[:space:]]Emotion[[:space:]]Recognition/9b08e5fb-b1e7-46c2-a9ef-2ffbbcf1e410_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 746 |
+
2025/Learning[[:space:]]Task[[:space:]]Representations[[:space:]]from[[:space:]]In-Context[[:space:]]Learning/474f0696-9c79-4e45-9053-1e7993fb1533_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 747 |
+
2025/Learning[[:space:]]from[[:space:]]Committee_[[:space:]]Reasoning[[:space:]]Distillation[[:space:]]from[[:space:]]a[[:space:]]Mixture[[:space:]]of[[:space:]]Teachers[[:space:]]with[[:space:]]Peer-Review/0382ff2a-f816-422b-adbf-597b602e73c6_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 748 |
+
2025/Learning[[:space:]]from[[:space:]]Negative[[:space:]]Samples[[:space:]]in[[:space:]]Biomedical[[:space:]]Generative[[:space:]]Entity[[:space:]]Linking/2c9f5d05-be49-4995-9312-ec9eabf6377e_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 749 |
+
2025/Learning[[:space:]]to[[:space:]]Align[[:space:]]Multi-Faceted[[:space:]]Evaluation_[[:space:]]A[[:space:]]Unified[[:space:]]and[[:space:]]Robust[[:space:]]Framework/a44190ea-b8ae-4b7b-9509-b95fa4803bd0_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 750 |
+
2025/Learning[[:space:]]to[[:space:]]Insert[[:space:]]\[PAUSE\][[:space:]]Tokens[[:space:]]for[[:space:]]Better[[:space:]]Reasoning/abd52372-d86e-4226-aa01-d6287d868ac1_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 751 |
+
2025/Learning[[:space:]]to[[:space:]]Play[[:space:]]Like[[:space:]]Humans_[[:space:]]A[[:space:]]Framework[[:space:]]for[[:space:]]LLM[[:space:]]Adaptation[[:space:]]in[[:space:]]Interactive[[:space:]]Fiction[[:space:]]Games/580771eb-fc6a-41d0-9e81-defec277307e_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 752 |
+
2025/Learning[[:space:]]to[[:space:]]Select[[:space:]]In-Context[[:space:]]Demonstration[[:space:]]Preferred[[:space:]]by[[:space:]]Large[[:space:]]Language[[:space:]]Model/550eb385-589c-475f-8773-88618ba6658a_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 753 |
+
2025/LegalCore_[[:space:]]A[[:space:]]Dataset[[:space:]]for[[:space:]]Event[[:space:]]Coreference[[:space:]]Resolution[[:space:]]in[[:space:]]Legal[[:space:]]Documents/b6ec6f9e-4f75-4f90-8df1-c7a5ebf11e09_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 754 |
+
2025/LegoMT2_[[:space:]]Selective[[:space:]]Asynchronous[[:space:]]Sharded[[:space:]]Data[[:space:]]Parallel[[:space:]]Training[[:space:]]for[[:space:]]Massive[[:space:]]Neural[[:space:]]Machine[[:space:]]Translation/015a4490-f2fb-42ab-b37e-ca649692b5b2_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 755 |
+
2025/Lemmas[[:space:]]Matter,[[:space:]]But[[:space:]]Not[[:space:]]Like[[:space:]]That_[[:space:]]Predictors[[:space:]]of[[:space:]]Lemma-Based[[:space:]]Generalization[[:space:]]in[[:space:]]Morphological[[:space:]]Inflection/b4146bfc-0e1a-46d3-bc62-7a369935a837_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 756 |
+
2025/Lemmatisation[[:space:]]&[[:space:]]Morphological[[:space:]]Analysis[[:space:]]of[[:space:]]Unedited[[:space:]]Greek_[[:space:]]Do[[:space:]]Simple[[:space:]]Tasks[[:space:]]Need[[:space:]]Complex[[:space:]]Solutions_/9f8fc312-e1e0-4c23-aabe-5177e9ae7e62_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 757 |
+
2025/Let[[:space:]]The[[:space:]]Jury[[:space:]]Decide_[[:space:]]Fair[[:space:]]Demonstration[[:space:]]Selection[[:space:]]for[[:space:]]In-Context[[:space:]]Learning[[:space:]]through[[:space:]]Incremental[[:space:]]Greedy[[:space:]]Evaluation/a5e66954-3ca6-404f-9eef-c16a778da00a_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 758 |
+
2025/Let’s[[:space:]]Be[[:space:]]Self-generated[[:space:]]via[[:space:]]Step[[:space:]]by[[:space:]]Step_[[:space:]]A[[:space:]]Curriculum[[:space:]]Learning[[:space:]]Approach[[:space:]]to[[:space:]]Automated[[:space:]]Reasoning[[:space:]]with[[:space:]]Large[[:space:]]Language[[:space:]]Models/187bc5d1-990b-4ec3-bd73-40af904e317a_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 759 |
+
2025/Let’s[[:space:]]Fuse[[:space:]]Step[[:space:]]by[[:space:]]Step_[[:space:]]A[[:space:]]Generative[[:space:]]Fusion[[:space:]]Decoding[[:space:]]Algorithm[[:space:]]with[[:space:]]LLMs[[:space:]]for[[:space:]]Robust[[:space:]]and[[:space:]]Instruction-Aware[[:space:]]ASR[[:space:]]and[[:space:]]OCR/466319f6-2de1-497a-9057-5ab9fdcbcaf1_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/e0b5b8ec-57ae-4057-8d8d-7671504d88a3_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/e0b5b8ec-57ae-4057-8d8d-7671504d88a3_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/e0b5b8ec-57ae-4057-8d8d-7671504d88a3_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa8f53b5b52ea8211d1affd54d336d7dbd2a93cc065c74130da52ed753d8a4de
|
| 3 |
+
size 2827946
|
2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/full.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d1db314fa1f2cef9eaa1ddb08c68614209ae19b3a231502a510fa515ce25b5f1
|
| 3 |
+
size 1689393
|
2025/KE-MHISTO_ Towards a Multilingual Historical Knowledge Extraction Benchmark for Addressing the Long-Tail Problem/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/d5e09ccc-cc4e-4a35-8517-510afa55cd88_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/d5e09ccc-cc4e-4a35-8517-510afa55cd88_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/d5e09ccc-cc4e-4a35-8517-510afa55cd88_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa0a8172ebbd982a31eb5dd6a2348ecf33dcbdbf06dfb9b0c5252ef0014ee6f2
|
| 3 |
+
size 2378289
|
2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/full.md
ADDED
|
@@ -0,0 +1,813 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KITAB-Bench: A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding
|
| 2 |
+
|
| 3 |
+
Ahmed Heakl\*, Abdullah Sohail\*, Mukul Ranjan\*, Rania Hossam\* Ghazi Ahmad\*, Mohamed El-Geish\*, Omar Maher\*, Zhiqiang Shen\* Fahad Khan\*, Salman Khan\*
|
| 4 |
+
|
| 5 |
+
$\clubsuit$ MBZUAI $\clubsuit$ Monta AI $\text{♥}$ Linköping University $\text{♥}$ Australian National University {ahmed.heakl, mabdullah.sohail, mukul.ranjan, salman.khan}@mbzuai.ac.ae {geish, omar}@monta.ai https://mbzuai-oryx.github.io/KITAB-Bench/
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
With the growing adoption of Retrieval-Augmented Generation (RAG) in document processing, robust text recognition has become increasingly critical for knowledge extraction. While OCR (Optical Character Recognition) for English and other languages benefits from large datasets and well-established benchmarks, Arabic OCR faces unique challenges due to its cursive script, right-to-left text flow, and complex typographic and calligraphic features. We present KITAB-Bench, a comprehensive Arabic OCR benchmark that fills the gaps in current evaluation systems. Our benchmark comprises 8,809 samples across 9 major domains and 36 sub-domains, encompassing diverse document types including handwritten text, structured tables, and specialized coverage of 21 chart types for business intelligence. Our findings show that modern vision-language models (such as GPT-4, Gemini, and Qwen) outperform traditional OCR approaches (like EasyOCR, PaddleOCR, and Surya) by an average of $60\%$ in Character Error Rate (CER). Furthermore, we highlight significant limitations of current Arabic OCR models, particularly in PDF-to-Markdown conversion, where the best model Gemini-2.0-Flash achieves only $65\%$ accuracy. This underscores the challenges in accurately recognizing Arabic text, including issues with complex fonts, numeral recognition errors, word elongation, and table structure detection. This work establishes a rigorous evaluation framework that can drive improvements in Arabic document analysis methods and bridge the performance gap with English OCR technologies.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
With the upsurge in adoption of Retrieval-Augmented Generation (RAG) based systems for document processing, the quality of document ingestion pipelines has become increasingly critical.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Overview of the core domains and subdomains in KITAB-Bench. Our benchmark spans nine major domains (e.g., OCR, charts to JSON, table recognition) and 36 sub-domains (e.g., scanned text, handwritten text, various chart types), providing a comprehensive evaluation framework for modern Arabic document processing and analysis.
|
| 17 |
+
|
| 18 |
+
Optical Character Recognition (OCR) plays a crucial role in this pipeline, enabling the conversion of physical documents into machine-readable text and databases for enabling effective knowledge retrieval. Although significant progress has been made in the multilingual OCR (JaidedAI, 2020; Fu et al., 2024; Wei et al., 2024; Smith, 2007), with comprehensive datasets like PubLayNet (Zhong et al., 2019b), DocBank (Li et al., 2020), M6Doc (Cheng et al., 2023), and DocLayNet (Pfitzmann et al., 2022), Arabic OCR continues to lag behind. This gap is largely due to the unique challenges of the Arabic script, including its cursive nature, complex typography, and right-to-left text orientation.
|
| 19 |
+
|
| 20 |
+
Existing Arabic OCR datasets (Table 1), like KHATT (Mahmoud et al., 2014) and IFN/ENIT (Pechwitz et al., 2002) focus mainly on handwritten text, whereas APTI (Slimane et al.,
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 2: Overview of different tasks in our benchmark: Eight key components illustrating the task inputs and outputs for table recognition, chart understanding, text recognition, diagram analysis, VQA, line detection, layout analysis, and PDF-to-Markdown conversion, complete with input/output examples for each task.
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
|
| 39 |
+
<table><tr><td>Domain/Characteristics</td><td>EXAMS-V*</td><td>Camel-Bench</td><td>\( MIDAD^\dagger \)</td><td>KHATT</td><td>KITAB-Bench (Ours)</td></tr><tr><td>PDF to Markdown</td><td>X</td><td>X</td><td>X</td><td>X</td><td>✓</td></tr><tr><td>Layout Detection</td><td>X</td><td>X</td><td>X</td><td>X</td><td>✓</td></tr><tr><td>Line Detection</td><td>X</td><td>X</td><td>X</td><td>X</td><td>✓</td></tr><tr><td>Line Recognition</td><td>X</td><td>✓</td><td>X</td><td>X</td><td>✓</td></tr><tr><td>Table Recognition</td><td>X</td><td>X</td><td>X</td><td>X</td><td>✓</td></tr><tr><td>Image to Text</td><td>✓</td><td>✓</td><td>✓</td><td>✓</td><td>✓</td></tr><tr><td>Charts to JSON</td><td>X</td><td>X</td><td>X</td><td>X</td><td>✓</td></tr><tr><td>Diagram to Code</td><td>X</td><td>X</td><td>X</td><td>X</td><td>✓</td></tr><tr><td>VQA</td><td>✓</td><td>✓</td><td>X</td><td>X</td><td>✓</td></tr><tr><td>Handwritten Samples</td><td>X</td><td>X</td><td>✓</td><td>✓</td><td>✓</td></tr><tr><td>Open Source</td><td>✓</td><td>✓</td><td>X</td><td>✓</td><td>✓</td></tr><tr><td>Total Samples (#)</td><td>823</td><td>3,004</td><td>29,435</td><td>5,000</td><td>8,809</td></tr></table>
|
| 40 |
+
|
| 41 |
+
Table 1: Comparison of Arabic OCR Benchmarks Across Different Domains. Benchmarks compared: LaraBench (Abdelali et al., 2023), CamelBench (Ghaboura et al., 2024), MIDAD (Bhatia et al., 2024), KHATT (Mahmoud et al., 2014), and KITAB-Bench (Ours). $(\ast)$ Only the Arabic samples are considered.) $(\dagger)$ The test set of the dataset is considered.)
|
| 42 |
+
|
| 43 |
+
2009) covers only specific aspects of printed text. These efforts fail to address advanced document processing challenges such as table parsing, font detection, and numeral recognition. Arabic benchmarks like CAMEL-Bench (Ghaboura et al., 2024) and L AraBench (Abdelali et al., 2023) evaluate large multimodal and language models, but they give limited attention to document understanding tasks. Consequently, there remains a need for a more comprehensive framework to systematically evaluate and compare Arabic OCR solutions. Our benchmark addresses these gaps by offering diverse document types and evaluation tasks to facilitate in-depth assessments of modern OCR systems.
|
| 44 |
+
|
| 45 |
+
We present KITAB-Bench, a comprehensive Arabic OCR benchmark spanning 9 domains and
|
| 46 |
+
|
| 47 |
+
36 sub-domains. Our framework evaluates layout detection (text blocks, tables, figures), multi-format recognition (printed/handwritten text, charts, diagrams), and structured output generation (HTML tables, DataFrame charts, markdown). This enables rigorous assessment of both basic OCR capabilities and advanced document understanding tasks.
|
| 48 |
+
|
| 49 |
+
The contributions of this work include (1) A comprehensive Arabic OCR benchmark covering multiple document types and recognition tasks. (2) Detailed evaluation metrics for assessing performance across different document understanding challenges. We also propose CharTeX and CODM metric to evaluate chart extraction and diagram extraction respectively. (3) Baseline results for popular OCR systems and Vision Language Models (VLMs), highlighting current limitations and areas for improvement. (4) A standardized framework for comparing Arabic OCR systems, facilitating future research and development.
|
| 50 |
+
|
| 51 |
+
# 2 Related Work
|
| 52 |
+
|
| 53 |
+
The development of robust Optical Character Recognition (OCR) systems has been extensively studied across document layout analysis (Zhao et al., 2024; Shen et al., 2021; Paruchuri, 2024b; JiaedAI, 2020; Auer et al., 2024; Li et al., 2020), table detection (Li et al., 2019; Paliwal et al., 2019; Nassar et al., 2022; Li et al., 2021; Schreiber et al., 2017), and document understanding (Staar et al., 2018; Weber et al., 2023; Livathinos et al., 2021). While English OCR benefits from rich
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 3: Comparison of model performance across four document understanding tasks (Table Recognition, Image to Text, Diagram to JSON, and Layout Detection) showing successful and failed cases for different models including Ground Truth, EasyOCR, GPT-4, Qwen, Surya, Tesseract, Yolo, and DETR on Arabic document benchmark data.
|
| 57 |
+
|
| 58 |
+

|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
|
| 64 |
+
<table><tr><td>Domain</td><td>Total Samples</td></tr><tr><td>PDF to Markdown</td><td>33</td></tr><tr><td>Layout</td><td>2,100</td></tr><tr><td>Line Detection</td><td>378</td></tr><tr><td>Line Recognition</td><td>378</td></tr><tr><td>Table Recognition</td><td>456</td></tr><tr><td>Image to Text</td><td>3,760</td></tr><tr><td>Charts to DataFrame</td><td>576</td></tr><tr><td>Diagram to Json</td><td>226</td></tr><tr><td>VQA</td><td>902</td></tr><tr><td>Total</td><td>8,809</td></tr></table>
|
| 65 |
+
|
| 66 |
+
Table 2: Distribution of samples across different domains in our dataset. A more detailed count for different sub-domains and data sources is in Appendix A.
|
| 67 |
+
|
| 68 |
+
datasets like PubLayNet (Zhong et al., 2019b), DocBank (Li et al., 2020), M6Doc (Cheng et al., 2023), and DocLayNet (Pfitzmann et al., 2022), Arabic lacks standardized benchmarks for diverse fonts and layouts. Recent efforts like MIDAD (Bhatia et al., 2024) curates extensive training data for Arabic OCR and handwriting recognition, while Peacock (Alwajih et al., 2024) introduces culturally-aware Arabic multimodal models. Existing resources such as CAMEL-Bench (Ghaboura et al., 2024), LAraBench (Abdelali et al., 2023), MADAR (Bouamor et al., 2018), OSACT (Mubarak et al., 2022), and Tashkeela (Zerrouki and Balla, 2017) focus on language modeling or specific tasks rather than full-page OCR evaluation. Handwriting datasets including HistoryAr (Pantke et al., 2014), IFN/ENIT (Pechwitz et al., 2002), KHATT (Mahmoud et al., 2014), APTI (Slimane et al., 2009), and Muharaf (Saeed et al., 2024) emphasize word/line recognition over document structure analysis.
|
| 69 |
+
|
| 70 |
+
Arabic table recognition faces challenges from merged cells and RTL formatting (Pantke et al., 2014). While methods like GTE (Zheng et al., 2021), GFTE (Li et al., 2021), CascadeTabNet (Prasad et al., 2020), TableNet (Paliwal et al., 2019),
|
| 71 |
+
|
| 72 |
+
and TableFormer (Nassar et al., 2022) advance Latin table detection, their effectiveness on Arabic documents remains unproven. Document conversion pipelines (CCS (Staar et al., 2018), Tesseract (Smith, 2007), Docling (Auer et al., 2024), Surya (Paruchuri, 2024b), Marker (Paruchuri, 2024a), MinerU (Wang et al., 2024a), PaddleOCR (Du et al., 2020)) lack Arabic-specific optimizations for segmentation and diacritic handling (Mahmoud et al., 2018; Kiessling et al., 2019). This highlights the critical need for comprehensive Arabic OCR benchmarks addressing text recognition, table detection, and layout parsing.
|
| 73 |
+
|
| 74 |
+
# 3 KITAB-Bench
|
| 75 |
+
|
| 76 |
+
Our methodology offers a novel approach to benchmarking Arabic OCR systems via a comprehensive data collection strategy and a systematic evaluation framework. We gather curated samples from existing Arabic document datasets, manually collected and annotated PDFs, and employ a five-phase LLM-assisted human-in-the-loop pipeline (Figure 4) to generate diverse supplementary content. Our evaluation framework spans nine specialized tasks, enabling thorough assessment of OCR performance across various document processing challenges and providing a robust benchmark for Arabic document understanding tasks.
|
| 77 |
+
|
| 78 |
+
# 3.1 PDF Data Collection
|
| 79 |
+
|
| 80 |
+
We curated 33 diverse PDFs from online sources in academia, medicine, law, and literature. To ensure challenging cases, we selected documents featuring richly formatted tables with extensive color usage, merged cells, Arabic numerals, historical texts, watermarks, and handwritten annotations. Each PDF averaged three pages, and we then manually annotated them. This dataset comprehensively captures real-world complexities, making it a valuable benchmark for PDF-to-Markdown conversion.
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 4: Synthetic Data Generation Pipeline: A 5-stage process using LLMs to generate topics, create raw data, produce visualization code, render charts, and perform human evaluation for quality control.
|
| 84 |
+
|
| 85 |
+
# 3.2 LLM-Assisted Data Generation Pipeline
|
| 86 |
+
|
| 87 |
+
To generate data for charts, diagrams and tables, we implemented a five-phase LLM-assisted generation pipeline with human validation at critical stages, as illustrated in Figure 4. In Phase I (Topic Generation), our system employs an LLM to generate diverse topic names across multiple domains. This phase incorporates various personas (academic, legal, medical, technical) to ensure broad coverage of document types. Phase II (Data Generation) transforms the validated topics into structured raw data. The LLM generates content following Arabic linguistic and formatting conventions across various domains. In Phase III (Code Generation), the system converts the validated raw data into plotting code, with special attention to Arabic text rendering requirements and RTL content management. Phase IV (Image Rendering) utilizes specialized rendering engines (Mermaid, Plotly, Vegalite, HTML) to create visual representations while maintaining Arabic text integrity.
|
| 88 |
+
|
| 89 |
+
The final phase (Human Evaluation) implements rigorous quality control through expert validation. Evaluators filter charts, tables and diagrams based on detected anomalies and ensure adherence to Arabic-specific document conventions. This phase is crucial for maintaining the high quality of our benchmark dataset.
|
| 90 |
+
|
| 91 |
+
# 3.3 Dataset Statistics
|
| 92 |
+
|
| 93 |
+
Our benchmark dataset comprises over 8,809 samples across 9 major domains and 36 sub-domains, representing a comprehensive collection of Arabic document types for OCR evaluation. As detailed in Table 8, the dataset combines carefully curated samples from established datasets, manually annotation PDFs, and synthetically generated content created through our LLM-assisted pipeline (Figure 4). The Image-to-Text portion (3,760 samples) includes data from historical documents (HistoryAr (Pantke et al., 2014)), handwritten text collections (Khatt (Mahmoud et al., 2014), ADAB (Boubaker et al., 2021), Muharaf (Saeed et al., 2024)), and scene text (EvAREST (Hassan et al., 2021)), while layout detection comprises 2,100 samples from BCE-Arabic-v1 (Saad et al., 2016) and DocLayNet (Pfitzmann et al., 2022).
|
| 94 |
+
|
| 95 |
+
For layout analysis, we incorporated 1,700 samples from BCE-Arabic-v1 dataset (Saad et al., 2016), 400 samples from DocLayNet dataset (Pfitzmann et al., 2022) focusing on financial, academic, legal, and patent documents. The line detection and recognition tasks contains 378 samples each from self-developed dataset. We further enriched the dataset with 500 samples from PATS-A01 (El-Muhtaseb, 2010) benchmark to ensure diverse representation. For handwritten text recognition, we assembled a comprehensive collection of 1,000
|
| 96 |
+
|
| 97 |
+
<table><tr><td>Task</td><td>Metric</td><td>Surya</td><td>Tesseract</td><td>EasyOCR</td></tr><tr><td rowspan="2">Detection</td><td>mAP@50</td><td>79.67</td><td>46.39</td><td>68.02</td></tr><tr><td>mAP@0.5:0.95</td><td>27.40</td><td>14.30</td><td>32.74</td></tr><tr><td rowspan="2">Recognition</td><td>WER</td><td>1.01</td><td>1.00</td><td>0.53</td></tr><tr><td>CER</td><td>0.87</td><td>0.66</td><td>0.20</td></tr></table>
|
| 98 |
+
|
| 99 |
+
samples combining datasets from Khatt (Mahmoud et al., 2014) (both paragraph and line-level annotations), Adab (Boubaker et al., 2021), Muharaf (Saeed et al., 2024), and OnlineKhatt (Mahmoud et al., 2018). The benchmark also includes specialized content from ISI-PPT (Wu and Natarajan, 2017) (500 samples), and Hindawi (Elfilali, 2023) (200 samples) for various document types. Scene text understanding is supported by 800 samples from EvArest (Hassan et al., 2021), providing real-world context diversity. A detailed table showing all the dataset is provided in the Appendix A.
|
| 100 |
+
|
| 101 |
+
A significant portion of our dataset consists of synthetically generated content, including 576 samples for Charts-to-DataFrame (spanning 16 different chart types), 422 samples for Diagram-to-Code (covering sequence diagrams, flowcharts, and tree maps), 456 samples for Tables-to-CSV/HTML, and 902 samples for VQA tasks. These synthetic samples were generated through our five-phase LLM-assisted human-in-the-loop pipeline (Figure 4). Every sample in our dataset - whether from existing sources or newly generated - underwent validation by native Arabic speakers before inclusion in the final benchmark. This rigorous validation, reinforced by expert review and automated checks, ensures high quality and authenticity across all domains. A detailed analysis is in Appendix C.
|
| 102 |
+
|
| 103 |
+
# 4 Experiments
|
| 104 |
+
|
| 105 |
+
Our experimental evaluation comprehensively assesses the capabilities of current OCR systems and state-of-the-art vision-language models (VLMs) across different Arabic and multilingual document understanding tasks. Figure 2 illustrates the nine distinct tasks in our evaluation framework.
|
| 106 |
+
|
| 107 |
+
We evaluate three categories of systems: VLMs, traditional OCR systems, and specialized document processing tools. For VLMs, we include both closed-source models like gpt-4o-2024-08-06, gpt-4o-mini-2024-07-18 (Hurst et al., 2024; Achiam et al., 2023), and gemini-2.0-flash (Georgiev et al., 2024; Google DeepMind,
|
| 108 |
+
|
| 109 |
+
2025), as well as open-source alternatives such as Qwen2-VL-7B (Wang et al., 2024b), Qwen2.5-VL-7B (Team, 2025), and the AIN-7B (Heakl et al., 2025). Traditional OCR approaches in our evaluation include Surya (Paruchuri, 2024b), Tesseract (Smith, 2007), EasyOCR (JaidedAI, 2020), and PaddleOCR (Li et al., 2022; Du et al., 2021). For specialized document processing tasks, we employ systems like Docling (Auer et al., 2024), and Marker (Paruchuri, 2024a). Layout detection capabilities are evaluated using methods implemented in Surya-Layout (Paruchuri, 2024b), Yolo-doclaynet (Zhao et al., 2024) from MinerU (Wang et al., 2024a), and RT-DETR (Zhao et al., 2023) based method in Docling (Auer et al., 2024).
|
| 110 |
+
|
| 111 |
+
# 4.1 Evaluation Frameworks and Metrics
|
| 112 |
+
|
| 113 |
+
Our evaluation framework comprises nine specialized tasks designed to assess different aspects of Arabic OCR systems, as demonstrated in Figure 2. Each task addresses specific challenges in Arabic document processing. For this reason, we employ task-specific metrics to evaluate different aspects of document understanding.
|
| 114 |
+
|
| 115 |
+
PDF-to-Markdown: It evaluates the conversion of Arabic PDFs to structured markdown while preserving the text and table structure. Since both table and text structure are important, for evaluating PDF to Markdown conversion quality, we propose MARS (Markdown Recognition Score), which combines chrF (Popovic, 2015) with TreeEdit-Distance-based Similarity (TEDS) (Zhong et al., 2020):
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\mathrm {M A R S} = \alpha \cdot \operatorname {c h r F} _ {3} + (1 - \alpha) \cdot \operatorname {T E D S} \left(T _ {a}, T _ {b}\right) \tag {1}
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
where $\alpha$ ( $0 \leq \alpha \leq 1$ ) is the weight. $T_{a}$ represents
|
| 122 |
+
|
| 123 |
+
Table 3: Performance of different models on Line Detection and Line Recognition Task on our Benchmark
|
| 124 |
+
|
| 125 |
+
<table><tr><td>Dataset</td><td>Metric</td><td>Surya</td><td>Yolo-doc- laynet</td><td>Detr (docling)</td></tr><tr><td rowspan="5">BCE</td><td>mAP@0.5</td><td>0.506</td><td>0.470</td><td>0.750</td></tr><tr><td>mAP@0.5:0.95</td><td>0.381</td><td>0.369</td><td>0.566</td></tr><tr><td>Precision</td><td>0.751</td><td>0.608</td><td>0.626</td></tr><tr><td>Recall</td><td>0.593</td><td>0.592</td><td>0.725</td></tr><tr><td>F1 Score</td><td>0.635</td><td>0.585</td><td>0.654</td></tr><tr><td rowspan="5">DocLayNet</td><td>mAP@0.5</td><td>0.675</td><td>0.404</td><td>0.758</td></tr><tr><td>mAP@0.5:0.95</td><td>0.469</td><td>0.335</td><td>0.541</td></tr><tr><td>Precision</td><td>0.782</td><td>0.527</td><td>0.635</td></tr><tr><td>Recall</td><td>0.856</td><td>0.503</td><td>0.770</td></tr><tr><td>F1 Score</td><td>0.799</td><td>0.499</td><td>0.670</td></tr></table>
|
| 126 |
+
|
| 127 |
+
Table 4: Performance comparison of layout detection models using different evaluation metrics
|
| 128 |
+
|
| 129 |
+
predicted table structure and $T_{b}$ the ground truth structure.
|
| 130 |
+
|
| 131 |
+
Table Recognition:
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
J (P, G) = \frac {| P \cap G |}{| P \cup G |} = \frac {| P \cap G |}{| P | + | G | - | P \cap G |} \tag {2}
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where $|P \cap G|$ represents the number of exact matching cells between predicted and ground truth tables, and $|P \cup G|$ represents the total number of unique cells across both tables.
|
| 138 |
+
|
| 139 |
+
Chart-to-Dataframe: This task evaluates extracting structured data from Arabic charts into machine-readable dataframes. Systems must accurately parse numerical values, text labels, and preserve data relationships across chart types (bar, line, pie). We use the Structuring Chart-oriented Representation Metric (SCRM) (Xia et al., 2024)—which combines type recognition, topic understanding, and structural numerical fidelity (see Appendix D.1)—and also propose our own CharTeX (Chart Extraction Score) metric. CharTeX combines the chrF scores for chart type and topic with the jaccord index for the dataframe, using fuzzy matching (80% threshold) when columns do not exactly align.
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
\text {M e t r i c} = \alpha J _ {\text {t y p e}} + \beta J _ {\text {t o p i c}} + (1 - \alpha - \beta) J _ {\text {d a t a}} \tag {3}
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
Here, $J_{type}$ and $J_{topic}$ denote the chrF scores between the predicted and ground-truth chart type and topic, while $J_{data}$ measures the structural similarity of the predicted and ground-truth JSON data.
|
| 146 |
+
|
| 147 |
+
Diagram-to-JSON: This task evaluates the conversion of Arabic flowcharts and technical diagrams into JSON while preserving semantic relationships and technical specifications. We propose CODM (Code-Oriented Diagram Metric), extending SCRM (Xia et al., 2024), with the same formulation as in Eq 3. More detail about this metric is provided in Appendix D.1.
|
| 148 |
+
|
| 149 |
+
Image-to-Text: This task assess the basic text
|
| 150 |
+
|
| 151 |
+
recognition capabilities across different Arabic fonts and styles, including the handling of cursive script connections, diacritical marks, and various text orientations. We use we use Character Error Rate (CER) and Word Error Rate (WER). For a predicted text sequence $\hat{y}$ and ground truth sequence $y$ , CER is computed as: $\mathrm{CER} = \frac{\mathrm{L}(y,\hat{y})}{|y|}$ , where $\mathrm{L}(y,\hat{y})$ is the Levenshtein distance between character sequences and $|y|$ is the ground truth length. WER is calculated the same way with words as the unit of error.
|
| 152 |
+
|
| 153 |
+
Visual Question Answering: Tests the ability of models to understand and reason about Arabic document content, we evaluate using standard accuracy for MCQ questions and exact word match.
|
| 154 |
+
|
| 155 |
+
Line Detection: Focuses on the accurate identification and processing of individual text lines in Arabic documents. We evaluate using mean Average Precision (mAP) at different Intersection over Union (IoU) thresholds: mAP@0.5 and mAP@0.5:0.95, which assess the localization accuracy of detected text lines.
|
| 156 |
+
|
| 157 |
+
Layout Detection: Assesses document structure analysis capabilities, including the identification of headers, paragraphs, and complex layout elements in Arabic documents. Performance is measured using mAP@0.5 and mAP@0.5:0.95 for localization accuracy, complemented by Precision, Recall, and F1 scores to evaluate the overall detection quality across different layout components.
|
| 158 |
+
|
| 159 |
+
All metrics are computed on our diverse benchmark dataset, which encompasses various document types and complexity levels in both Arabic and multilingual contexts. Table 10 provides a detailed mapping of tasks, metrics, and evaluated systems.
|
| 160 |
+
|
| 161 |
+
# 4.2 Experimental Setup
|
| 162 |
+
|
| 163 |
+
We implement our evaluation pipeline with careful consideration of hyperparameters for different metrics. All experiments use NVIDIA A100 GPUs. For VLMs, we use their official implementations or API endpoints. Traditional OCR systems are evaluated using pre-trained models provided by the frameworks. For PDF-to-Markdown evaluation metric MARS 1, we choose $\alpha = 0.5$ and $\alpha = 0.5$ and $\beta = 0.2$ for Diagram-to-JSON evaluation metric CODM. We average the results over multiple runs, with performance comparisons shown in different tables (Table 3, 4, 5, 6, and 7).
|
| 164 |
+
|
| 165 |
+
<table><tr><td rowspan="2">Model Group</td><td rowspan="2">Models</td><td colspan="2">Table Extraction</td><td colspan="3">End-to-End PDF</td></tr><tr><td>TEDS (HTML)</td><td>Jaccard (CSV)</td><td>CHrF (Text)</td><td>TEDS (Table)</td><td>MARS</td></tr><tr><td rowspan="3">Closed</td><td>GPT-4o</td><td>85.76</td><td>66.36</td><td>69.62</td><td>60.61</td><td>65.12</td></tr><tr><td>GPT-4o-mini</td><td>69.32</td><td>49.50</td><td>56.59</td><td>52.69</td><td>54.64</td></tr><tr><td>Gemini-2.0-Flash</td><td>83.08</td><td>65.55</td><td>75.75</td><td>55.55</td><td>65.65</td></tr><tr><td rowspan="3">Open</td><td>Qwen2-VL-7B</td><td>57.83</td><td>40.20</td><td>40.30</td><td>2.54</td><td>21.42</td></tr><tr><td>Qwen2.5-VL-7B</td><td>59.31</td><td>59.58</td><td>69.21</td><td>11.65</td><td>40.43</td></tr><tr><td>AIN-7B</td><td>75.94</td><td>64.83</td><td>56.52</td><td>49.32</td><td>52.92</td></tr><tr><td rowspan="5">Framework</td><td rowspan="2">Tesseract</td><td>28.23D</td><td>14.85D</td><td rowspan="2">59.91D</td><td rowspan="2">45.44D</td><td rowspan="2">52.68D</td></tr><tr><td>38.64I</td><td>16.04I</td></tr><tr><td rowspan="2">EasyOCR</td><td>49.10D</td><td>23.83D</td><td rowspan="2">57.46D</td><td rowspan="2">51.12D</td><td rowspan="2">54.29D</td></tr><tr><td>39.09I</td><td>17.88I</td></tr><tr><td>Surya</td><td>50.15M</td><td>70.42M</td><td>58.38M</td><td>44.29M</td><td>51.34M</td></tr></table>
|
| 166 |
+
|
| 167 |
+
${}^{D}$ Docling (Auer et al.,2024) pipeline ${}^{T}$ Img2Table (Cattan,2021) pipeline ${}^{M}$ Marker (Paruchuri,2024a) pipeline
|
| 168 |
+
|
| 169 |
+
Table 5: Performance comparison of different models for table extraction and end-to-end PDF to markdown conversion tasks on our benchmark.
|
| 170 |
+
|
| 171 |
+
<table><tr><td>Group</td><td>Models</td><td>CHrF ↑</td><td>CER ↓</td><td>WER ↓</td></tr><tr><td rowspan="4">Closed</td><td>GPT-4o</td><td>61.01</td><td>0.31</td><td>0.55</td></tr><tr><td>GPT-4o-mini</td><td>47.21</td><td>0.43</td><td>0.71</td></tr><tr><td>Gemini-2.0-Flash</td><td>77.95</td><td>0.13</td><td>0.32</td></tr><tr><td>Azure</td><td>50.97</td><td>0.52</td><td>0.69</td></tr><tr><td rowspan="6">Open</td><td>Qwen2VL-7B</td><td>33.94</td><td>1.48</td><td>1.55</td></tr><tr><td>Qwen2.5VL-7B</td><td>49.23</td><td>1.20</td><td>1.41</td></tr><tr><td>AIN-7B</td><td>78.33</td><td>0.20</td><td>0.28</td></tr><tr><td>Qaari</td><td>39.77</td><td>1.80</td><td>1.93</td></tr><tr><td>Gemma3</td><td>30.02</td><td>1.05</td><td>1.45</td></tr><tr><td>ArabicNagout</td><td>30.52</td><td>4.37</td><td>4.67</td></tr><tr><td rowspan="4">Framework</td><td>Tesseract</td><td>39.62</td><td>0.54</td><td>0.84</td></tr><tr><td>EasyOCR</td><td>45.47</td><td>0.58</td><td>0.89</td></tr><tr><td>Paddle</td><td>16.73</td><td>0.79</td><td>1.02</td></tr><tr><td>Surya</td><td>20.61</td><td>4.95</td><td>5.61</td></tr></table>
|
| 172 |
+
|
| 173 |
+
Table 6: Performance comparison of models for OCR (image to text) tasks on our benchmark. A detailed performance comparison among different open-source dataset is available in Appendix B
|
| 174 |
+
|
| 175 |
+
# 5 Results and Discussion
|
| 176 |
+
|
| 177 |
+
In this section, we present a comprehensive evaluation of different models across different tasks of our framework. The results provide a clear distinction between the performance of closed-source models, open-source models, and framework-based solutions, revealing both their strengths and limitations. We observe very clear performance gap between closed and open-source solutions. While closed-source models like Gemini-2.0-Flash consistently outperform other models almost all the tasks.
|
| 178 |
+
|
| 179 |
+
# 5.1 Charts, Diagrams, and VQA
|
| 180 |
+
|
| 181 |
+
Table [7] presents model performance across different chart and diagram understanding tasks, evaluated using SCRM and CharTeX (for charts), and
|
| 182 |
+
|
| 183 |
+
VQA-based accuracy metrics. Among closed-source models, Gemini-2.0 achieves the highest performance on chart understanding metrics, scoring $71.4\%$ on SCRM and $56.28\%$ on CharTeX. The performance gap between Gemini-2.0 and GPT-4o is particularly pronounced in CharTeX evaluation $(10.33\%)$ compared to SCRM $(2.8\%)$ . Open-source models shows a significant limitation in complex chart understanding. While their SCRM scores remain competitive, both Qwen variants score below $23\%$ on CharTeX evaluation. The visual question-answering results reveal an important exception to the general closed-source advantage. AIN achieves $87\%$ on PATDVQA, surpassing Gemini-2.0 by $11.5\%$ . AIN also shows competitive performance on MTVQA $(31.50\%)$ , which is similar to GPT-4o and $4\%$ better than GPT-4o-mini. This shows that open-source models can be competitive with closed-source alternatives.
|
| 184 |
+
|
| 185 |
+
# 5.2 Layout and Lines: Document Structure
|
| 186 |
+
|
| 187 |
+
Our evaluation of document structure understanding reveals distinct performance patterns across layout detection and line processing tasks. In layout detection (Table 4), RT-DETR (Zhao et al., 2023) achieves superior overall performance with mAP@0.5 scores of 0.750 and 0.758 on BCE (arabic only) and DocLayNet (english) dataset respectively. However, Surya (Paruchuri, 2024b) demonstrates higher precision (0.782 on DocLayNet, 0.751 on BCE), despite lower recall rates. This trade-off suggests that different architectures optimize for different aspects of layout detection.
|
| 188 |
+
|
| 189 |
+
The line processing results (Table 3) highlight a clear contrast between detection and recognition
|
| 190 |
+
|
| 191 |
+
<table><tr><td rowspan="2">Group</td><td rowspan="2">Model</td><td colspan="2">Chart</td><td>Diagram</td><td colspan="5">Visual QA</td></tr><tr><td>SCRM</td><td>CharTeX</td><td>CODM</td><td>\(MTVQA^O\)</td><td>\(ChartsVQA^M\)</td><td>\(DiagramsVQA^M\)</td><td>\(PATDVQA^M\)</td><td>Average</td></tr><tr><td rowspan="3">Closed</td><td>GPT-4o</td><td>68.6</td><td>45.95</td><td>61.6</td><td>32.00</td><td>77.00</td><td>85.29</td><td>82.50</td><td>69.19</td></tr><tr><td>GPT-4o-mini</td><td>67.2</td><td>43.33</td><td>61.4</td><td>26.80</td><td>58.00</td><td>83.33</td><td>80.00</td><td>62.03</td></tr><tr><td>Gemini-2.0-Flash</td><td>71.4</td><td>56.28</td><td>71.8</td><td>35.00</td><td>72.00</td><td>88.24</td><td>75.50</td><td>67.68</td></tr><tr><td rowspan="3">Open</td><td>Qwen2-VL-7B</td><td>56.6</td><td>21.59</td><td>63.0</td><td>19.60</td><td>59.00</td><td>82.35</td><td>77.50</td><td>59.61</td></tr><tr><td>Qwen2.5-VL-7B</td><td>36.2</td><td>22.08</td><td>59.2</td><td>23.00</td><td>74.00</td><td>79.41</td><td>74.50</td><td>62.72</td></tr><tr><td>AIN-7B</td><td>66.6</td><td>34.61</td><td>66.40</td><td>31.50</td><td>75.00</td><td>85.29</td><td>87.00</td><td>69.69</td></tr></table>
|
| 192 |
+
|
| 193 |
+
Table 7: Model Performance on Chart Understanding, Diagram Parsing, and Visual Question Answering Tasks. For VQA tasks, $O$ denotes open-ended question type from MTVQA (Tang et al., 2024) dataset and $M$ denotes MCQ type questions.
|
| 194 |
+
|
| 195 |
+
capabilities. While Surya excels in detection with a mAP@0.50 of $79.67\%$ , EasyOCR demonstrates superior recognition performance (WER: 0.53, CER: 0.20). This inverse relationship between detection and recognition performance across models indicates a fundamental challenge in optimizing both capabilities simultaneously. Notably, Tesseract shows consistent but lower performance across both metrics, suggesting that newer architectures have made significant improvements over traditional approaches. We also observe that no single model excels at both detection and recognition, which requires for hybrid solutions.
|
| 196 |
+
|
| 197 |
+
# 5.3 Tables,OCR,and PDF-to-Markdown
|
| 198 |
+
|
| 199 |
+
Across table extraction tasks (Table 5), closed-source models maintain a clear advantage, with GPT-4o achieving $85.76\%$ TEDS and $66.36\%$ Jaccard scores. Among open-source models, AIN $(75.94\%$ TEDS) significantly outperforms Qwen variants, while specialized frameworks like Surya achieve competitive results $(70.42\%$ Jaccard) through targeted pipelines.
|
| 200 |
+
|
| 201 |
+
For OCR tasks, we evaluated GPT-4o (Hurst et al., 2024), Gemini-2.0-Flash (Google DeepMind, 2025), Azure OCR (Microsoft, 2024) in closed model; Qaari (NAMAA-Space, 2025), Gemma3 (Team et al., 2025), Arabic-Nagout (Rashad, 2024) and AIN (Heakl et al., 2025) in open source models and Tesseract (Smith, 2007), EasyOCR (JaidedAI, 2020), PaddleOCR (Li et al., 2022) and SuryaOCR (Paruchuri, 2024b) in frameworks (Table 6). Gemini-2.0-Flash leads with the lowest error rates (CER: 0.13, WER: 0.32). Notably, AIN matches this performance level (WER: 0.28), while traditional OCR frameworks like EasyOCR and Tesseract show moderate performance (CER: 0.58, 0.54). The significant performance drop in Paddle (CER: 0.79) and
|
| 202 |
+
|
| 203 |
+
Surya (CER: 4.95) highlights the challenges in developing robust OCR systems.
|
| 204 |
+
|
| 205 |
+
End-to-end document processing (Table 5) reveals the largest gaps between approaches. Closed-source models maintain consistent performance (GPT-4o: $65.12\%$ MARS, Gemini-2.0: $65.65\%$ MARS), while open-source models show substantial degradation (Qwen2-VL-7B: $21.42\%$ MARS). Framework approaches achieve better stability, with Tesseract and EasyOCR scoring above $50\%$ MARS, suggesting that specialized pipelines can partially bridge the gap with larger models in complete document processing tasks.
|
| 206 |
+
|
| 207 |
+

|
| 208 |
+
Figure 5: ChrF by model on Arabic text variations
|
| 209 |
+
|
| 210 |
+
Our comprehensive evaluation demonstrates that while closed-source models maintain superior performance over open-source models across most tasks, specialized frameworks like Surya, RT-DETR Layout, and EasyOCR achieve competitive performance in targeted scenarios like table extraction, layout detection, and text recognition respectively. However, this framework advantage significantly diminishes in end-to-end pdf-to-markdown tasks where the integration capabilities of large models prove crucial, as evidenced by the performance gaps between commercial VLMs and tradi
|
| 211 |
+
|
| 212 |
+
tional systems like EasyOCR, Surya and Tesseract in End-to-End PDF task (Table 5).
|
| 213 |
+
|
| 214 |
+
# 5.4 Performance on Challenging Cases
|
| 215 |
+
|
| 216 |
+
To evaluate model performance across different complexities of Arabic texts, we manually selected 104 samples representing four challenging categories: font variations, diacritics, text elongations, and tilted text. The $\mathrm{ChrF}$ score comparison (Figure 5) reveals distinct performance patterns across models, with GPT-4o demonstrating superior font handling (30.2) and leading in challenging tilted text recognition (13.1), while Azure OCR excels remarkably in diacritics recognition (40.5) and text elongations (35.2), indicating specialized Arabic script optimizations. The overall performance analysis shows GPT-4o leading at 26.0 average $\mathrm{ChrF}$ score, followed closely by Azure (26.3), Qwen2.5-VL-7B (25.3), and Gemini2.0-Flash (24.7), while traditional OCR systems struggle significantly with Tesseract particularly challenged by diacritics (15.3) and tilted text (5.9). This analysis reveals that no single model excels across all Arabic text complexities, with specialized systems like Azure demonstrating domain-specific strengths in diacritics and elongation handling, while modern VLMs show more consistent performance but struggle with orientation variations, underscoring the need for Arabic-specific optimizations and highlighting the substantial performance gap between modern VLMs and traditional OCR approaches.
|
| 217 |
+
|
| 218 |
+
# 5.5 Model Performance across Chart Types
|
| 219 |
+
|
| 220 |
+

|
| 221 |
+
Figure 6: ChartEx results across different charts type.
|
| 222 |
+
|
| 223 |
+
The CharTeX evaluation across 16 different chart types reveals significant performance variations
|
| 224 |
+
|
| 225 |
+
based on chart complexity and structural characteristics (Figure 6). Gemini-2.0-Flash demonstrates superior performance across most chart types, particularly excelling in simple geometric charts like Pie (72.4), Dot (72.7), and Bar Charts (69.2), while complex statistical visualizations like Violin Plots (32.3) and Box Plots (22.5) present significant challenges for all models. Simple chart types with clear boundaries consistently achieve higher scores across all models, with grouped and stacked bar charts showing intermediate performance levels around 40-50, indicating that while structural complexity affects extraction accuracy, the familiarity of bar chart formats provides some resilience. This pattern suggests that Arabic chart understanding faces particular difficulties with charts requiring statistical interpretation and continuous data representation, highlighting that current models perform best on charts with discrete, clearly separated data elements rather than continuous or overlapping visual representations.
|
| 226 |
+
|
| 227 |
+
# 6 Conclusion
|
| 228 |
+
|
| 229 |
+
We introduce a comprehensive benchmark for Arabic OCR that fills the gap in standardized evaluation frameworks for Arabic document processing. Our dataset of 8,809 samples across nine major domains is the most diverse collection assembled for OCR evaluation, incorporating handwritten, scanned, synthetic, and scene text, as well as complex tables, charts, and end-to-end pdf-to-markdown. This framework extends beyond simple text recognition to include structural document analysis and enables systematic assessment of OCR performance across various fonts, styles, and layouts.
|
| 230 |
+
|
| 231 |
+
# 7 Limitations and Future Directions
|
| 232 |
+
|
| 233 |
+
Despite its strengths, KITAB-Bench lacks coverage of low-resource dialects and institutional scans such as historical, governmental, and financial records. Future work should address OCR limitations in structural fidelity for tables and charts through richer datasets, refined metrics, and crosslingual deep learning methods to enable robust and generalizable Arabic multimodal OCR. Moreover, current models often fail to generalize across domains and layouts, emphasizing the need for adaptable architectures and domain-specific fine-tuning.
|
| 234 |
+
|
| 235 |
+
# References
|
| 236 |
+
|
| 237 |
+
Ahmed Abdelali, Hamdy Mubarak, Shammur Absar Chowdhury, Maram Hasanain, Basel Mousi, Sabri Boughorbel, Yassine El Kheir, Daniel Izham, Fahim Dalvi, Majd Hawasly, et al. 2023. Larabench: Benchmarking arabic ai with large language models. arXiv preprint arXiv:2305.14982.
|
| 238 |
+
Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. 2023. Gpt-4 technical report. arXiv preprint arXiv:2303.08774.
|
| 239 |
+
Fakhraddin Alwajih, El Moatez Billah Nagoudi, Gagan Bhatia, Abdelrahman Mohamed, and Muhammad Abdul-Mageed. 2024. Peacock: A family of arabic multimodal large language models and benchmarks. arXiv preprint arXiv:2403.01031.
|
| 240 |
+
Christoph Auer, Maksym Lysak, Ahmed Nassar, Michele Dolfi, Nikolaos Livathinos, Panos Vagenas, Cesar Berropi Ramis, Matteo Omenetti, Fabian Lindl Bauer, Kasper Dinkla, et al. 2024. Docling technical report. arXiv preprint arXiv:2408.09869.
|
| 241 |
+
Gagan Bhatia, El Moatez Billah Nagoudi, Fakhrraddin Alwajih, and Muhammad Abdul-Mageed. 2024. Qalam: A multimodal IIm for arabic optical character and handwriting recognition. arXiv preprint arXiv:2407.13559.
|
| 242 |
+
Houda Bouamor, Nizar Habash, Mohammad Salameh, Wajdi Zaghouani, Owen Rambow, Dana Abdulrahim, Ossama Obeid, Salam Khalifa, Fadhl Eryani, Alexander Erdmann, et al. 2018. The madar arabic dialect corpus and lexicon. In Proceedings of the eleventh international conference on language resources and evaluation (LREC 2018).
|
| 243 |
+
Houcine Boubaker, Abdelkarim Elbaati, Najiba Tagougui, Haikal El Abed, Monji Kherallah, Volker Margner, and Adel M. Alimi. 2021. Adab database.
|
| 244 |
+
Hassina Bouressace and Janos Csrik. 2019. Printed arabic text database for automatic recognition systems. In Proceedings of the 2019 5th International Conference on Computer and Technology Applications, pages 107-111.
|
| 245 |
+
Xavier Cattan. 2021. img2table: Extract tables from images and scanned pdfs. https://github.com/xavctn/img2table. Accessed: 2025-02-14.
|
| 246 |
+
H. Cheng, P. Zhang, S. Wu, et al. 2023. M6doc: A large-scale multi-format, multi-type, multi layout, multi-language, multi-annotation category dataset for modern document layout analysis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).
|
| 247 |
+
Matt Deitke, Christopher Clark, Sangho Lee, Rohun Tripathi, Yue Yang, Jae Sung Park, Mohammadreza Salehi, Niklas Muennighoff, Kyle Lo, Luca Soldaini, et al. 2024. Molmo and pixmo: Open weights and open data for state-of-the-art multimodal models. arXiv preprint arXiv:2409.17146.
|
| 248 |
+
|
| 249 |
+
Yuning Du, Chenxia Li, Ruoyu Guo, Cheng Cui, Weiwei Liu, Jun Zhou, Bin Lu, Yehua Yang, Qiwen Liu, Xiaoguang Hu, et al. 2021. Pp-ocrv2: Bag of tricks for ultra lightweightOCR system. arXiv preprint arXiv:2109.03144.
|
| 250 |
+
Yuning Du, Chenxia Li, Ruoyu Guo, Xiaoting Yin, Weiwei Liu, Jun Zhou, Yifan Bai, Zilin Yu, Yehua Yang, Qingqing Dang, et al. 2020. Pp-ocr: A practical ultra lightweightOCR system. arXiv preprint arXiv:2009.09941.
|
| 251 |
+
Husni A. El-Muhtaseb. 2010. Pats-a01 - an arabic text database. https://faculty.kfupm.edu.sa/ics/muhtaseb/ArabicOCR/PATS-A01.htm. Database for Arabic Text Recognition Research.
|
| 252 |
+
Ali Elfilali. 2023. Hindawi books dataset. https://huggingface.co/datasets/Ali-C137/Hindawi-i-Books-dataset. Dataset.
|
| 253 |
+
Ling Fu, Biao Yang, Zhebin Kuang, Jiajun Song, Yuzhe Li, Linghao Zhu, Qidi Luo, Xinyu Wang, Hao Lu, Mingxin Huang, et al. 2024. Ocrbench v2: An improved benchmark for evaluating large multimodal models on visual text localization and reasoning. arXiv preprint arXiv:2501.00321.
|
| 254 |
+
Petko Georgiev, Ving Ian Lei, Ryan Burnell, Libin Bai, Anmol Gulati, Garrett Tanzer, Damien Vincent, Zhufeng Pan, Shibo Wang, et al. 2024. Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context. arXiv preprint arXiv:2403.05530.
|
| 255 |
+
Sara Ghaboura, Ahmed Heakl, Omkar Thawakar, Ali Alharthi, Ines Riahi, Abduljalil Saif, Jorma Laaksonen, Fahad S Khan, Salman Khan, and Rao M Anwer. 2024. Camel-bench: A comprehensive arabic Imm benchmark. arXiv preprint arXiv:2410.18976.
|
| 256 |
+
Google DeepMind. 2025. Gemini Model Updates - February 2025. Accessed: 2025-02-14.
|
| 257 |
+
Heba Hassan, Ahmed El-Mahdy, and Mohamed E Hussein. 2021. Arabic scene text recognition in the deep learning era: Analysis on a novel dataset. IEEE Access, 9:107046-107058.
|
| 258 |
+
Ahmed Heakl, Sara Ghaboura, Omkar Thawkar, Fahad Shahbaz Khan, Hisham Cholakkal, Rao Muhammad Anwer, and Salman Khan. 2025. Ain: The arabic inclusive large multimodal model. arXiv preprint arXiv:2502.00094.
|
| 259 |
+
Aaron Hurst, Adam Lerer, Adam P Goucher, Adam Perelman, Aditya Ramesh, Aidan Clark, AJ Ostrow, Akila Welihinda, Alan Hayes, Alec Radford, et al. 2024. Gpt-4o system card. arXiv preprint arXiv:2410.21276.
|
| 260 |
+
JadedAI. 2020. Easyocr: Ready-to-use optical character recognition with multi-language support. https://github.com/JadedAI/EasyOCR. Accessed: 2025-02-14.
|
| 261 |
+
|
| 262 |
+
Benjamin Kiessling, Daniel Stökl Ben Ezra, and Matthew Thomas Miller. 2019. Badam: A public dataset for baseline detection in arabic-script manuscripts. In Proceedings of the 5th International Workshop on Historical Document Imaging and Processing, page 13-18, New York, NY, USA. Association for Computing Machinery.
|
| 263 |
+
Chenxia Li, Weiwei Liu, Ruoyu Guo, Xiaoting Yin, Kaitao Jiang, Yongkun Du, Yuning Du, Lingfeng Zhu, Baohua Lai, Xiaoguang Hu, et al. 2022. Pp-ocrv3: More attempts for the improvement of ultra lightweightOCR system. arXiv preprint arXiv:2206.03001.
|
| 264 |
+
Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, Ming Zhou, and Zhoujun Li. 2019. Tablebank: A benchmark dataset for table detection and recognition. arXiv preprint arXiv:1903.01949.
|
| 265 |
+
Minghao Li, Yiheng Xu, Leyang Cui, Shaohan Huang, Furu Wei, and Zhoujun Li. 2020. Docbank: A benchmark dataset for document layout analysis. arXiv preprint arXiv:2006.01038.
|
| 266 |
+
Yiren Li, Zheng Huang, Junchi Yan, Yi Zhou, Fan Ye, and Xianhui Liu. 2021. Gfte: graph-based financial table extraction. In *Pattern Recognition*. ICPR International Workshops and Challenges: Virtual Event, January 10–15, 2021, Proceedings, Part II, pages 644–658. Springer.
|
| 267 |
+
Nikolaos Livathinos, Cesar Berrospi, Maksym Lysak, Viktor Kuropiatnyk, Ahmed Nassar, Andre Carvalho, Michele Dolfi, Christoph Auer, Kasper Dinkla, and Peter Staar. 2021. Robust pdf document conversion using recurrent neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 15137-15145.
|
| 268 |
+
Sabri A Mahmoud, Irfan Ahmad, Wasfi G Al-Khatib, Mohammad Alshayeb, Mohammad Tanvir Parvez, Volker Märgner, and Gernot A Fink. 2014. Khatt: An open arabic offline handwritten text database. Pattern Recognition, 47(3):1096-1112.
|
| 269 |
+
Sabri A Mahmoud, Hamzah Luqman, Baligh M Al-Helali, Galal BinMakhashen, and Mohammad Tanvir Parvez. 2018. Online-khatt: an open-vocabulary database for arabic online-text processing. The Open Cybernetics & Systemics Journal, 12(1).
|
| 270 |
+
Microsoft. 2024. OCR - Optical Character Recognition - Azure AI services. Accessed: 2025-05-27.
|
| 271 |
+
Hamdy Mubarak, Hend Al-Khalifa, and AbdulMohsen Al-Thubaity. 2022. Overview of osact5 shared task on arabic offensive language and hate speech detection. In Proceedings of the 5th Workshop on Open-Source Arabic Corpora and Processing Tools with Shared Tasks on Qur'an QA and Fine-Grained Hate Speech Detection, pages 162-166.
|
| 272 |
+
NAMAA-Space. 2025. Qari-ocr: A high-accuracy model for arabic optical character recognition. https://huggingface.co/collections/NAMAA-Space/qari-ocr-a-high-accuracy-model-for-arabic-o
|
| 273 |
+
|
| 274 |
+
ptical-character-67c6cdf9584ef0684391335. Accessed: 2025-05-27.
|
| 275 |
+
Ahmed Nassar, Nikolaos Livathinos, Maksym Lysak, and Peter Staar. 2022. Tableformer: Table structure understanding with transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4614-4623.
|
| 276 |
+
Shubham Singh Paliwal, D Vishwanath, Rohit Rahul, Monika Sharma, and Lovekesh Vig. 2019. Tablenet: Deep learning model for end-to-end table detection and tabular data extraction from scanned document images. In 2019 International Conference on Document Analysis and Recognition (ICDAR), pages 128-133. IEEE.
|
| 277 |
+
Werner Pantke, Martin Dennhardt, Daniel Fecker, Volker Margner, and Tim Fingscheidt. 2014. An historical handwritten arabic dataset for segmentation-free word spotting-hadara80p. In 2014 14th International Conference on Frontiers in Handwriting Recognition, pages 15-20. IEEE.
|
| 278 |
+
Vik Paruchuri. 2024a. Marker: Convert pdf to markdown and other formats. https://github.com/VikParuchuri/marker.
|
| 279 |
+
Vik Paruchuri. 2024b. Surya: Accurate line-by-line text detection and recognition in complex documents. https://github.com/VikParuchuri/surya.
|
| 280 |
+
Mario Pechwitz, S Snoussi Maddouri, Volker Märgner, Noureddine Ellouze, Hamid Amiri, et al. 2002. Ifn/enit-database of handwritten arabic words. In Proc. of CIFED, volume 2, pages 127-136. CiteSeer.
|
| 281 |
+
Birgit Pfitzmann, Christoph Auer, Michele Dolfi, Ahmed S Nassar, and Peter W J Staar. 2022. Do claynet: A large human-annotated dataset for document-Layout analysis. arXiv preprint arXiv:2206.01062.
|
| 282 |
+
Maja Popovic. 2015. chrf: character n-gram f-score for automatic mt evaluation. In Proceedings of the tenth workshop on statistical machine translation, pages 392-395.
|
| 283 |
+
Devashish Prasad, Ayan Gadpal, Kshitij Kapadni, Manish Visave, and Kavita Sultanpure. 2020. Cascadetabnet: An approach for end to end table detection and structure recognition from image-based documents. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition workshops, pages 572-573.
|
| 284 |
+
Mohamed Rashad. 2024. Arabic-nougat: Fine-tuning vision transformers for arabicOCR and markdown extraction. arXiv preprint arXiv:2411.17835.
|
| 285 |
+
Rana SM Saad, Randa I Elanwar, NS Abdel Kader, Samia Mashali, and Margrit Betke. 2016. Bce-arabic-v1 dataset: Towards interpreting arabic document images for people with visual impairments. In Proceedings of the 9th ACM International Conference on PErvasive Technologies Related to Assistive Environments, pages 1-8.
|
| 286 |
+
|
| 287 |
+
M. Saeed, A. Chan, A. Mijar, and J. Moukarzel. 2024. Muharaf: Manuscripts of handwritten arabic dataset for cursive text recognition. arXiv preprint arXiv:2406.09630.
|
| 288 |
+
Sebastian Schreiber, Stefan Agne, Ivo Wolf, Andreas Dengel, and Sheraz Ahmed. 2017. Deepdesrt: Deep learning for detection and structure recognition of tables in document images. In 2017 14th IAPR international conference on document analysis and recognition (IC-DAR), volume 1, pages 1162-1167. IEEE.
|
| 289 |
+
Zejiang Shen, Ruochen Zhang, Melissa Dell, Benjamin Charles Germain Lee, Jacob Carlson, and Weining Li. 2021. Layoutparser: A unified toolkit for deep learning based document image analysis. In Document Analysis and Recognition-ICDAR 2021: 16th International Conference, Lausanne, Switzerland, September 5–10, 2021, Proceedings, Part I 16, pages 131–146. Springer.
|
| 290 |
+
Fouad Slimane, Rolf Ingold, Slim Kanoun, Adel M Alimi, and Jean Hennebert. 2009. A new arabic printed text image database and evaluation protocols. In 2009 10th international conference on document analysis and recognition, pages 946-950. IEEE.
|
| 291 |
+
Ray Smith. 2007. An overview of the tesseractOCR engine. In Ninth international conference on document analysis and recognition (ICDAR 2007), volume 2, pages 629-633. IEEE.
|
| 292 |
+
Peter WJ Staar, Michele Dolfi, Christoph Auer, and Costas Bekas. 2018. Corpus conversion service: A machine learning platform to ingest documents at scale. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 774-782.
|
| 293 |
+
Jingqun Tang, Qi Liu, Yongjie Ye, Jinghui Lu, Shu Wei, Chunhui Lin, Wanqing Li, Mohamad Fitri Faiz Bin, Mahmood, Hao Feng, Zhen Zhao, Yanjie Wang, Yuliang Liu, Hao Liu, Xiang Bai, and Can Huang. 2024. Mtvqa: Benchmarking multilingual text-centric visual question answering. Preprint, arXiv:2405.11985.
|
| 294 |
+
Gemma Team, Aishwarya Kamath, Johan Ferret, Shreya Pathak, Nino Vieillard, Ramona Merhej, Sarah Perrin, Tatiana Matejovicova, Alexandre Rame, Morgane Rivière, et al. 2025. Gemma 3 technical report. arXiv preprint arXiv:2503.19786.
|
| 295 |
+
Qwen Team. 2025. Qwen2.5-vl.
|
| 296 |
+
Bin Wang, Chao Xu, Xiaomeng Zhao, Linke Ouyang, Fan Wu, Zhiyuan Zhao, Rui Xu, Kaiwen Liu, Yuan Qu, Fukai Shang, et al. 2024a. Mineru: An open-source solution for precise document content extraction. arXiv preprint arXiv:2409.18839.
|
| 297 |
+
Peng Wang, Shuai Bai, Sinan Tan, Shijie Wang, Zhihao Fan, Jinze Bai, Keqin Chen, Xuejing Liu, Jialin Wang, Wenbin Ge, et al. 2024b. Qwen2-v1: Enhancing vision-language model's perception of the world at any resolution. arXiv preprint arXiv:2409.12191.
|
| 298 |
+
|
| 299 |
+
Maurice Weber, Carlo Siebenschuh, Rory Butler, Anton Alexandrov, Valdemar Thanner, Georgios Tsolakis, Haris Jabbar, Ian Foster, Bo Li, Rick Stevens, et al. 2023. Wordscape: a pipeline to extract multilingual, visually rich documents with layout annotations from web crawl data. Advances in Neural Information Processing Systems, 36:26048-26068.
|
| 300 |
+
Haoran Wei, Chenglong Liu, Jinyue Chen, Jia Wang, Lingyu Kong, Yanming Xu, Zheng Ge, Liang Zhao, Jianjian Sun, Yuang Peng, et al. 2024. GeneralOCR theory: TowardsOCR-2.0 via a unified end-to-end model. arXiv preprint arXiv:2409.01704.
|
| 301 |
+
Yue Wu and Prem Natarajan. 2017. Self-organized text detection with minimal post-processing via border learning. In International Conference on Computer Vision.
|
| 302 |
+
Renqiu Xia, Bo Zhang, Haoyang Peng, Hancheng Ye, Xiangchao Yan, Peng Ye, Botian Shi, Yu Qiao, and Junchi Yan. 2023. Structchart: Perception, structuring, reasoning for visual chart understanding. arXiv preprint arXiv:2309.11268.
|
| 303 |
+
Renqiu Xia, Bo Zhang, Hancheng Ye, Xiangchao Yan, Qi Liu, Hongbin Zhou, Zijun Chen, Min Dou, Botian Shi, Junchi Yan, et al. 2024. Chartx & chartvlm: A versatile benchmark and foundation model for complicated chart reasoning. arXiv preprint arXiv:2402.12185.
|
| 304 |
+
Taha Zerrouki and Amar Balla. 2017. Tashkeela: Novel corpus of arabic vocalized texts, data for autodiacritization systems. Data in brief, 11:147.
|
| 305 |
+
Y Zhao, W Lv, S Xu, J Wei, G Wang, Q Dang, Y Liu, and J Chen. 2023. Detrs beat yolos on real-time object detection. arxiv e-prints. arXiv preprint arXiv:2304.08069.
|
| 306 |
+
Z. Zhao, H. Kang, B. Wang, and C. He. 2024. Doclayout-yolo: Enhancing document layout analysis through diverse synthetic data and global-to-local adaptive perception. arXiv preprint arXiv:2410.12628.
|
| 307 |
+
Xinyi Zheng, Douglas Burdick, Lucian Popa, Xu Zhong, and Nancy Xin Ru Wang. 2021. Global table extractor (gte): A framework for joint table identification and cell structure recognition using visual context. In Proceedings of the IEEE/CVF winter conference on applications of computer vision, pages 697-706.
|
| 308 |
+
X Zhong, E ShafieiBavani, and A Jimeno-Yepes. 2019a. Image-based table recognition: data, model, and evaluation. corr abs/1911.10683. arXiv preprint arXiv:1911.10683.
|
| 309 |
+
Xu Zhong, Elaheh ShafieiBavani, and Antonio Jimeno Yepes. 2020. Image-based table recognition: data, model, and evaluation. In European conference on computer vision, pages 564-580. Springer.
|
| 310 |
+
Xu Zhong, Jianbin Tang, and Antonio Jimeno Yepes. 2019b. Publaynet: largest dataset ever for document layout analysis. In 2019 International conference on document analysis and recognition (ICDAR), pages 1015-1022. IEEE.
|
| 311 |
+
|
| 312 |
+
# A Source of the Existing Dataset Collection
|
| 313 |
+
|
| 314 |
+
Our benchmark integrates diverse data sources to ensure comprehensive coverage of Arabic document types. As detailed in Table 2, the dataset combines manually curated samples, synthetic data generated through our LLM-assisted pipeline (Figure 4), and existing publicly available datasets. Key sources include:
|
| 315 |
+
|
| 316 |
+
- Handwritten Text: KHATT (paragraph and line-level annotations), ADAB, Muharaf, and OnlineKhatt.
|
| 317 |
+
- Historical Documents: HistoryAr and HistoricalBooks.
|
| 318 |
+
- Scene Text: EvAREST for real-world context diversity.
|
| 319 |
+
- Layout Analysis: BCE-Arabic-v1 and DocLayNet.
|
| 320 |
+
- Synthetic Content: 576 chart samples (16 types) and 422 diagram samples generated via our five-phase pipeline (Section 3.2).
|
| 321 |
+
|
| 322 |
+
The dataset emphasizes domain diversity, covering academic, medical, legal, financial, and technical documents. All samples underwent rigorous validation by native Arabic speakers to ensure linguistic and structural accuracy.
|
| 323 |
+
|
| 324 |
+
# B Detailed Performance Comparison
|
| 325 |
+
|
| 326 |
+
Table 9 provides granular performance metrics for VLMs and OCR frameworks across 12 Arabic text recognition datasets. Gemini-2.0-Flash demonstrates exceptional robustness on synthetic datasets (CER: 0.01 on PATS), while AIN-7B excels in historical manuscript recognition (CER: 0.26 on HistoryAr). Traditional OCR systems like Tesseract show limitations in handwritten text (CER: 1.26 on HistoryAr), highlighting the need for script-specific optimizations.
|
| 327 |
+
|
| 328 |
+
# C Data Analysis
|
| 329 |
+
|
| 330 |
+
Our data generation pipeline (Figure 4) produced 1,502 high-quality synthetic samples - comprising 576 graphs, 422 diagrams, and 456 tables, through LLM-assisted generation guided by domain-specific instructions (Figures 7 and 8) that ensured alignment with Arabic linguistic norms. During the human validation phase, $18\%$ of initial
|
| 331 |
+
|
| 332 |
+
outputs were discarded due to issues like right-to-left formatting errors and semantic inconsistencies. The resulting dataset offers diverse and balanced coverage, featuring 21 Arabic calligraphic styles, 36 sub-domains spanning financial reports to technical manuals, and complex structures such as merged cells in $43\%$ of tables and dual-axis configurations in $29\%$ of charts.
|
| 333 |
+
|
| 334 |
+
# D Evaluation Metrics
|
| 335 |
+
|
| 336 |
+
# D.1 Tasks Models and Metrics
|
| 337 |
+
|
| 338 |
+
Table 10 maps evaluation tasks to corresponding models and metrics. The framework evaluates nine core capabilities:
|
| 339 |
+
|
| 340 |
+
- Structural Understanding: Layout detection (mAP), line detection (IoU)
|
| 341 |
+
- Content Extraction: Text recognition (CER), table parsing (TEDS)
|
| 342 |
+
- Semantic Reasoning: VQA accuracy, chart-to-dataframe conversion (SCRM)
|
| 343 |
+
- Specialized metrics like MARS ( $\alpha = 0.5$ ) address the dual requirements of text fidelity and structural preservation in PDF-to-Markdown conversion.
|
| 344 |
+
|
| 345 |
+
# D.2 Structuring Chart-oriented Representation Metric (SCRM)
|
| 346 |
+
|
| 347 |
+
The Structuring Chart-oriented Representation Metric (SCRM) evaluates chart understanding through three weighted components:
|
| 348 |
+
|
| 349 |
+
$$
|
| 350 |
+
\mathrm {S C R M} = 0. 4 J _ {\text {t y p e}} + 0. 3 J _ {\text {t o p i c}} + 0. 3 J _ {\text {d a t a}} \tag {4}
|
| 351 |
+
$$
|
| 352 |
+
|
| 353 |
+
where $J_{\mathrm{type}}$ measures chart type recognition accuracy using Edit Distance, $J_{\mathrm{topic}}$ evaluates chart topic identification using Edit Distance, and $J_{\mathrm{data}}$ measures Mean Relative Error with and Error Thresholding criteria.
|
| 354 |
+
|
| 355 |
+
For entity comparison in $J_{\mathrm{type}}$ and $J_{\mathrm{topic}}$ , we use the chrF character-based metric which captures partial matches effectively. For data comparison, value similarity is computed using relative error:
|
| 356 |
+
|
| 357 |
+
$$
|
| 358 |
+
e (p, q) = \frac {\left| \mathrm {V a l u e} _ {\text {p r e d}} ^ {p} - \mathrm {V a l u e} _ {\mathrm {G T}} ^ {q} \right|}{\mathrm {V a l u e} _ {\mathrm {G T}} ^ {q}}
|
| 359 |
+
$$
|
| 360 |
+
|
| 361 |
+
# D.3 Chart Extraction Score (CharTeX)
|
| 362 |
+
|
| 363 |
+
To evaluate chart data extraction quality, we propose CharTeX (Chart Extraction Score), which combines character-level text similarity with structural data assessment:
|
| 364 |
+
|
| 365 |
+
$$
|
| 366 |
+
\operatorname {C h a r T e X} = \alpha J _ {\text {t y p e}} + \beta J _ {\text {t o p i c}} + (1 - \alpha - \beta) J _ {\text {d a t a}} \tag {5}
|
| 367 |
+
$$
|
| 368 |
+
|
| 369 |
+
Where $\alpha = 0.05$ and $\beta = 0.10$ in our implementation, reflecting the relative importance of each component where $J_{\mathrm{type}}$ evaluates chart type recognition using chrF score (5% weight), $J_{\mathrm{topic}}$ assesses topic identification using chrF score (10% weight), and $J_{\mathrm{data}}$ measures structural data extraction accuracy using fuzzy matching (85% weight).
|
| 370 |
+
|
| 371 |
+
CharTeX improves upon SCRM by introducing structure-aware fuzzy matching (95% threshold) and leveraging the Hungarian algorithm for optimal alignment. In contrast to SCRM's reliance on (entity, value) triplet matching, CharTeX incorporates column-level semantics and chrF-based scoring, enhancing robustness to text variations and structural discrepancies, particularly critical for Arabic charts with complex layouts. This design mitigates SCRM's sensitivity to superficial mismatches and its disregard for tabular structure.
|
| 372 |
+
|
| 373 |
+
# D.4 Markdown Recognition Score (MARS)
|
| 374 |
+
|
| 375 |
+
To evaluate the quality of PDF-to-Markdown conversion, we propose the Markdown Recognition Score (MARS), defined as:
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\mathrm {M A R S} = \alpha \cdot \operatorname {c h r F 3} + (1 - \alpha) \cdot \operatorname {T E D S} \left(T _ {a}, T _ {b}\right)
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
where $\alpha \in [0,1]$ is set to 0.5 to balance text fidelity and structural accuracy. Here, $T_{a}$ and $T_{b}$ denote the predicted and ground truth table structures, respectively.
|
| 382 |
+
|
| 383 |
+
MARS jointly captures character-level accuracy using chrF3, ideal for OCR tasks requiring fine-grained text recognition, and hierarchical layout preservation via TEDS, which quantifies the tree-edit distance between table structures. By assigning equal weight to both components, MARS offers a robust metric that reflects both semantic and structural fidelity in document conversion. As both chrF3 and TEDS are established in prior work, MARS inherits their theoretical validity without the need for further empirical justification.
|
| 384 |
+
|
| 385 |
+
# D.5 Code-Oriented Diagram Metric (CODM)
|
| 386 |
+
|
| 387 |
+
The Code-Oriented Diagram Metric (CODM) extends SCRM with a graph-theoretic foundation specifically designed for diagrams where structural relationships are paramount:
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
\mathrm {C O D M} = 0. 5 J _ {\text {t o p o l o g y}} + 0. 2 J _ {\text {t o p i c}} + 0. 3 J _ {\text {s e m a n t i c s}} \tag {6}
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
Where $J_{\mathrm{topology}}$ evaluates diagram type $(50\%)$ using edit distance, $J_{\mathrm{topic}}$ assesses topic identification $(20\%)$ using edit distance, and $J_{\mathrm{semantics}}$ measures diagram structure through Graph Edit Distance $(30\%)$ .
|
| 394 |
+
|
| 395 |
+
This metric converts both predicted and ground truth diagram data into graph structures, where nodes represent entities and edges represent relationships. This approach effectively evaluates both node-edge relationships and semantic labels in technical diagrams such as flowcharts, class diagrams, and sequence diagrams.
|
| 396 |
+
|
| 397 |
+
Further, domain-specific prompts are used to guide model responses for accurate metric calculation. For instance, sequence diagrams require strict adherence to Arabic UML notation standards during evaluation, ensuring fair assessment across different diagram conventions.
|
| 398 |
+
|
| 399 |
+
<table><tr><td>Domain</td><td>Sub-Domain</td><td>Dataset Source</td><td>Original</td><td>Selected</td><td>Total</td></tr><tr><td>PDF to Markdown</td><td>General</td><td>Manual</td><td>33</td><td>33</td><td>33</td></tr><tr><td rowspan="2">Layout Detection</td><td rowspan="2">Docs</td><td>BCE-Arabic-v1 (Saad et al., 2016)</td><td>1.9k</td><td>1,700</td><td rowspan="2">2,100</td></tr><tr><td>DocLayNet (Pfitzmann et al., 2022)</td><td>80k</td><td>400</td></tr><tr><td>Line Detection</td><td>Docs</td><td>Manual</td><td>375</td><td>378</td><td>378</td></tr><tr><td>Line Recognition</td><td>Docs</td><td>Manual</td><td>375</td><td>378</td><td>378</td></tr><tr><td>Table Recognition</td><td>Financial</td><td>Pixmo (Deitke et al., 2024)</td><td>490</td><td>456</td><td>456</td></tr><tr><td rowspan="13">Image to Text</td><td rowspan="2">Synthetic</td><td>PATS (El-Muhtaseb, 2010)</td><td>21.6k</td><td>500</td><td></td></tr><tr><td>SythenAR</td><td>39.1k</td><td>500</td><td></td></tr><tr><td rowspan="2">Historical</td><td>HistoryAr (Pantke et al., 2014)</td><td>1.5k</td><td>200</td><td></td></tr><tr><td>HistoricalBooks</td><td>40</td><td>10</td><td></td></tr><tr><td>Hand. Paragraph</td><td>Khatt (Mahmoud et al., 2014)</td><td>2.72k</td><td>200</td><td></td></tr><tr><td rowspan="2">Hand. Word</td><td>ADAB (Boubaker et al., 2021)</td><td>15k</td><td>200</td><td></td></tr><tr><td>Muharaf (Saeed et al., 2024)</td><td>24.5k</td><td>200</td><td>3,760</td></tr><tr><td rowspan="2">Hand. Line</td><td>OnlineKhatt (Mahmoud et al., 2018)</td><td>8.5k</td><td>200</td><td></td></tr><tr><td>Khatt (Mahmoud et al., 2014)</td><td>13.4k</td><td>200</td><td></td></tr><tr><td>PPT</td><td>ISI-PPT (Wu and Natarajan, 2017)</td><td>86.5k</td><td>500</td><td></td></tr><tr><td rowspan="2">Blogs</td><td>ArabicOCR</td><td>20.3k</td><td>50</td><td></td></tr><tr><td>Hindawi (Elfilali, 2023)</td><td>79k</td><td>200</td><td></td></tr><tr><td>Scene</td><td>EvAREST (Hassan et al., 2021)</td><td>5.59k</td><td>800</td><td></td></tr><tr><td rowspan="16">Charts to DataFrame</td><td>Bar</td><td>Synthetic</td><td>100</td><td>61</td><td></td></tr><tr><td>Line</td><td>Synthetic</td><td>100</td><td>43</td><td></td></tr><tr><td>Pie</td><td>Synthetic</td><td>100</td><td>56</td><td></td></tr><tr><td>Box</td><td>Synthetic</td><td>100</td><td>31</td><td></td></tr><tr><td>Violin</td><td>Synthetic</td><td>100</td><td>36</td><td></td></tr><tr><td>Area</td><td>Synthetic</td><td>50</td><td>29</td><td></td></tr><tr><td>SunBurst</td><td>Synthetic</td><td>30</td><td>15</td><td></td></tr><tr><td>Dot</td><td>Synthetic</td><td>30</td><td>15</td><td rowspan="2">576</td></tr><tr><td>Dual Axis</td><td>Synthetic</td><td>20</td><td>26</td></tr><tr><td>Density Curve</td><td>Synthetic</td><td>10</td><td>5</td><td></td></tr><tr><td>Bubble</td><td>Synthetic</td><td>20</td><td>13</td><td></td></tr><tr><td>Grouped Bar</td><td>Synthetic</td><td>50</td><td>60</td><td></td></tr><tr><td>Stacked Bar</td><td>Synthetic</td><td>50</td><td>82</td><td></td></tr><tr><td>Histogram</td><td>Synthetic</td><td>100</td><td>70</td><td></td></tr><tr><td>HeatMap</td><td>Synthetic</td><td>10</td><td>11</td><td></td></tr><tr><td>Scatter</td><td>Synthetic</td><td>100</td><td>23</td><td></td></tr><tr><td rowspan="7">Diagram to Json</td><td>Sequence</td><td>Synthetic</td><td>50</td><td>46</td><td></td></tr><tr><td>Funnel</td><td>Synthetic</td><td>20</td><td>52</td><td></td></tr><tr><td>Class</td><td>Synthetic</td><td>20</td><td>30</td><td></td></tr><tr><td>Network</td><td>Synthetic</td><td>20</td><td>18</td><td>226</td></tr><tr><td>Venn</td><td>Synthetic</td><td>20</td><td>7</td><td></td></tr><tr><td>FlowChart</td><td>Synthetic</td><td>100</td><td>112</td><td></td></tr><tr><td>TreeMap</td><td>Synthetic</td><td>100</td><td>157</td><td></td></tr><tr><td rowspan="4">VQA</td><td>Charts</td><td>Manual</td><td>102</td><td>102</td><td rowspan="4">902</td></tr><tr><td>Charts</td><td>Manual</td><td>105</td><td>100</td></tr><tr><td>News Letter</td><td>PATD (Bouressace and Cserik, 2019)</td><td>2.42k</td><td>200</td></tr><tr><td>Scene</td><td>MTVQA</td><td>818</td><td>500</td></tr><tr><td colspan="3">Total Dataset Size</td><td colspan="2">-</td><td>8,809</td></tr></table>
|
| 400 |
+
|
| 401 |
+
Table 8: Dataset Distribution Across Different Domains, sub-domains and Data Source
|
| 402 |
+
|
| 403 |
+
<table><tr><td rowspan="2">Dataset</td><td rowspan="2">Size</td><td colspan="2">GPT-4o</td><td colspan="2">GPT-4o-mini</td><td colspan="2">Azure OCR</td><td colspan="2">Gemini-2.0-Flash</td><td colspan="2">Qwen2-VL</td></tr><tr><td>CER</td><td>WER</td><td>CER</td><td>WER</td><td>CER</td><td>WER</td><td>CER</td><td>WER</td><td>CER</td><td>WER</td></tr><tr><td>PATS</td><td>500</td><td>0.23</td><td>0.30</td><td>0.53</td><td>0.71</td><td>0.03</td><td>0.10</td><td>0.01</td><td>0.02</td><td>1.02</td><td>1.02</td></tr><tr><td>SythenAR</td><td>500</td><td>0.09</td><td>0.20</td><td>0.14</td><td>0.32</td><td>0.10</td><td>0.27</td><td>0.07</td><td>0.17</td><td>0.59</td><td>1.13</td></tr><tr><td>HistoryAr</td><td>200</td><td>0.51</td><td>0.82</td><td>0.67</td><td>0.96</td><td>0.24</td><td>0.68</td><td>0.28</td><td>0.64</td><td>3.46</td><td>2.86</td></tr><tr><td>HistoricalBooks</td><td>10</td><td>0.41</td><td>0.76</td><td>0.59</td><td>0.88</td><td>0.29</td><td>0.71</td><td>0.05</td><td>0.22</td><td>1.90</td><td>2.16</td></tr><tr><td>Khatt</td><td>200</td><td>0.45</td><td>0.74</td><td>0.64</td><td>0.91</td><td>0.83</td><td>0.92</td><td>0.19</td><td>0.45</td><td>1.12</td><td>5.04</td></tr><tr><td>Adab</td><td>200</td><td>0.30</td><td>0.73</td><td>0.35</td><td>0.83</td><td>0.99</td><td>0.99</td><td>0.19</td><td>0.56</td><td>0.63</td><td>1.08</td></tr><tr><td>Muharaf</td><td>200</td><td>0.56</td><td>0.90</td><td>0.63</td><td>0.94</td><td>0.52</td><td>0.82</td><td>0.33</td><td>0.69</td><td>3.57</td><td>2.87</td></tr><tr><td>OnlineKhatt</td><td>200</td><td>0.29</td><td>0.63</td><td>0.41</td><td>0.76</td><td>0.72</td><td>0.85</td><td>0.17</td><td>0.44</td><td>1.30</td><td>2.01</td></tr><tr><td>ISI-PPT</td><td>500</td><td>0.08</td><td>0.18</td><td>0.15</td><td>0.31</td><td>0.98</td><td>0.98</td><td>0.06</td><td>0.15</td><td>1.03</td><td>1.06</td></tr><tr><td>ArabicOCR</td><td>50</td><td>0.06</td><td>0.26</td><td>0.16</td><td>0.46</td><td>0.01</td><td>0.11</td><td>0.00</td><td>0.02</td><td>1.25</td><td>1.50</td></tr><tr><td>Hindawi</td><td>200</td><td>0.34</td><td>0.56</td><td>0.48</td><td>0.71</td><td>0.06</td><td>0.28</td><td>0.01</td><td>0.04</td><td>1.82</td><td>2.05</td></tr><tr><td>EvArest</td><td>800</td><td>0.20</td><td>0.38</td><td>0.25</td><td>0.51</td><td>0.32</td><td>0.50</td><td>0.18</td><td>0.36</td><td>0.41</td><td>0.95</td></tr><tr><td></td><td>3,760</td><td>0.31</td><td>0.55</td><td>0.43</td><td>0.71</td><td>0.52</td><td>0.69</td><td>0.13</td><td>0.32</td><td>1.48</td><td>1.20</td></tr></table>
|
| 404 |
+
|
| 405 |
+
<table><tr><td rowspan="2">Dataset</td><td rowspan="2">Size</td><td colspan="2">Qwen2.5-VL</td><td colspan="2">AIN</td><td colspan="2">Qari</td><td colspan="2">Tesseract</td><td colspan="2">Surya</td><td colspan="2">Paddle</td></tr><tr><td>CER</td><td>WER</td><td>CER</td><td>WER</td><td>CER</td><td>WER</td><td>CER</td><td>WER</td><td>CER</td><td>WER</td><td>CER</td><td>WER</td></tr><tr><td>PATS</td><td>500</td><td>0.98</td><td>1.03</td><td>0.26</td><td>0.36</td><td>0.00</td><td>0.00</td><td>0.14</td><td>0.28</td><td>4.66</td><td>4.67</td><td>0.77</td><td>1.00</td></tr><tr><td>SythenAR</td><td>500</td><td>1.68</td><td>1.69</td><td>0.21</td><td>0.40</td><td>0.04</td><td>0.16</td><td>0.31</td><td>0.72</td><td>4.82</td><td>7.90</td><td>0.80</td><td>1.01</td></tr><tr><td>HistoryAr</td><td>200</td><td>3.48</td><td>3.39</td><td>0.47</td><td>0.83</td><td>0.26</td><td>0.54</td><td>0.72</td><td>1.26</td><td>10.32</td><td>12.78</td><td>0.79</td><td>1.01</td></tr><tr><td>HistoricalBooks</td><td>10</td><td>0.67</td><td>0.97</td><td>0.33</td><td>0.72</td><td>0.84</td><td>0.88</td><td>0.74</td><td>0.99</td><td>6.81</td><td>6.30</td><td>0.71</td><td>1.00</td></tr><tr><td>Khatt</td><td>200</td><td>1.60</td><td>1.80</td><td>0.07</td><td>0.22</td><td>0.61</td><td>1.12</td><td>0.67</td><td>1.06</td><td>4.25</td><td>3.77</td><td>0.76</td><td>1.00</td></tr><tr><td>Adab</td><td>200</td><td>0.91</td><td>1.11</td><td>0.00</td><td>0.01</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.14</td><td>7.28</td><td>8.71</td><td>0.88</td><td>1.15</td></tr><tr><td>Muharaf</td><td>200</td><td>2.40</td><td>2.74</td><td>0.61</td><td>0.96</td><td>0.38</td><td>0.54</td><td>0.77</td><td>1.22</td><td>6.19</td><td>7.48</td><td>0.80</td><td>1.01</td></tr><tr><td>OnlineKhatt</td><td>200</td><td>1.52</td><td>1.53</td><td>0.36</td><td>0.70</td><td>0.03</td><td>0.12</td><td>0.59</td><td>1.20</td><td>6.71</td><td>6.95</td><td>0.78</td><td>1.03</td></tr><tr><td>ISI-PPT</td><td>500</td><td>1.27</td><td>1.39</td><td>0.36</td><td>0.54</td><td>0.52</td><td>0.53</td><td>0.31</td><td>0.64</td><td>4.25</td><td>3.77</td><td>0.81</td><td>1.03</td></tr><tr><td>ArabicOCR</td><td>50</td><td>0.02</td><td>0.08</td><td>1.00</td><td>1.00</td><td>0.01</td><td>0.01</td><td>0.01</td><td>0.01</td><td>2.75</td><td>3.58</td><td>0.77</td><td>1.00</td></tr><tr><td>Hindawi</td><td>200</td><td>0.27</td><td>0.42</td><td>1.00</td><td>1.00</td><td>0.11</td><td>0.15</td><td>0.31</td><td>0.72</td><td>0.15</td><td>0.20</td><td>0.76</td><td>1.00</td></tr><tr><td>EvArest</td><td>800</td><td>4.65</td><td>4.75</td><td>0.19</td><td>0.36</td><td>0.30</td><td>0.32</td><td>0.85</td><td>1.02</td><td>5.91</td><td>3.86</td><td>0.89</td><td>1.04</td></tr><tr><td></td><td>3,760</td><td>1.80</td><td>1.93</td><td>0.28</td><td>0.54</td><td>0.20</td><td>0.58</td><td>0.89</td><td>0.79</td><td>4.95</td><td>5.61</td><td>0.79</td><td>1.02</td></tr></table>
|
| 406 |
+
|
| 407 |
+
Table 9: Performance comparison of Large Vision-Language Models on KITAB-Bench (lower is better).
|
| 408 |
+
|
| 409 |
+
<table><tr><td>Task</td><td>Metrics</td><td>Open LLMs</td><td>Closed LLMs</td><td>OCR Systems</td></tr><tr><td colspan="5">Document Understanding Tasks</td></tr><tr><td>PDF to Markdown</td><td>chrF + TEDS</td><td>-</td><td>-</td><td>Docling
|
| 410 |
+
Marker
|
| 411 |
+
MinerU
|
| 412 |
+
PDF-Extract-Kit</td></tr><tr><td>Layout Detection</td><td>mAP@0.5
|
| 413 |
+
mAP@0.5:0.95
|
| 414 |
+
Precision
|
| 415 |
+
Recall
|
| 416 |
+
F1</td><td>-</td><td>-</td><td>Surya
|
| 417 |
+
Yolo-doclaynet (MinerU)
|
| 418 |
+
Detr (docling)</td></tr><tr><td>Line Detection</td><td>mAP@0.5
|
| 419 |
+
mAP@0.5:0.95</td><td>-</td><td>-</td><td>Surya
|
| 420 |
+
Tesseract
|
| 421 |
+
EasyOCR</td></tr><tr><td>Line Recognition</td><td>WER, CER</td><td>-</td><td>-</td><td>Surya
|
| 422 |
+
Tesseract
|
| 423 |
+
EasyOCR</td></tr><tr><td colspan="5">Table Understanding Tasks</td></tr><tr><td>Tables Recognition
|
| 424 |
+
(HTML)</td><td>TEDS (Zhong et al., 2019a)</td><td>Qwen2-VL
|
| 425 |
+
Qwen2.5-VL
|
| 426 |
+
AIN
|
| 427 |
+
PaliGemma</td><td>GPT-4o
|
| 428 |
+
GPT-4o-mini
|
| 429 |
+
Gemini-2.0-Flash</td><td>Docling[EasyOCR]
|
| 430 |
+
Docling[Tesseract]
|
| 431 |
+
Marker
|
| 432 |
+
Img2Table[EasyOCR]
|
| 433 |
+
Img2Table[Tesseract]</td></tr><tr><td>Tables Recognition
|
| 434 |
+
(CSV)</td><td>Jaccard Index</td><td>Qwen2-VL
|
| 435 |
+
Qwen2.5-VL
|
| 436 |
+
AIN
|
| 437 |
+
PaliGemma</td><td>GPT-4o
|
| 438 |
+
GPT-4o-mini
|
| 439 |
+
Gemini-2.0-Flash</td><td>Docling[EasyOCR]
|
| 440 |
+
Docling[Tesseract]
|
| 441 |
+
Marker
|
| 442 |
+
Img2Table[EasyOCR]
|
| 443 |
+
Img2Table[Tesseract]</td></tr><tr><td colspan="5">Visual Understanding Tasks</td></tr><tr><td>Image to Text</td><td>CER, WER
|
| 444 |
+
chrF, BLEU
|
| 445 |
+
METEOR</td><td>Qwen2-VL
|
| 446 |
+
Qwen2.5-VL
|
| 447 |
+
AIN-7B
|
| 448 |
+
PaliGemma</td><td>GPT-4o
|
| 449 |
+
GPT-4o-mini
|
| 450 |
+
Gemini-2.0-Flash</td><td>Docling[EasyOCR]
|
| 451 |
+
Docling[Tesseract]
|
| 452 |
+
Marker
|
| 453 |
+
Img2Table[EasyOCR]
|
| 454 |
+
Img2Table[Tesseract]</td></tr><tr><td>Charts to DataFrame</td><td>SCRM (Xia et al., 2024, 2023)</td><td>Qwen2-VL
|
| 455 |
+
Qwen2.5-VL
|
| 456 |
+
AIN
|
| 457 |
+
PaliGemma</td><td>GPT-4o
|
| 458 |
+
GPT-4o-mini
|
| 459 |
+
Gemini-2.0-Flash</td><td>-</td></tr><tr><td>Diagram to Json</td><td>SCRM</td><td>Qwen2-VL
|
| 460 |
+
Qwen2.5-VL
|
| 461 |
+
AIN-7B
|
| 462 |
+
PaliGemma</td><td>GPT-4o
|
| 463 |
+
GPT-4o-mini
|
| 464 |
+
Gemini-2.0-Flash</td><td>-</td></tr><tr><td>VQA</td><td>Accuracy +
|
| 465 |
+
Word Match Score</td><td>Qwen2-VL
|
| 466 |
+
Qwen2.5-VL
|
| 467 |
+
AIN-7b
|
| 468 |
+
PaliGemma</td><td>GPT-4o
|
| 469 |
+
GPT-4o-mini
|
| 470 |
+
Gemini-2.0-Flash</td><td>-</td></tr></table>
|
| 471 |
+
|
| 472 |
+
Table 10: Comprehensive evaluation metrics and models for document understanding tasks. The table is organized into three main categories: document understanding, table understanding, and visual understanding tasks. Each task is evaluated using specific metrics and implemented across various models and OCR systems.
|
| 473 |
+
|
| 474 |
+
# Charts: Type Prompt
|
| 475 |
+
|
| 476 |
+
""You are an expert in detecting chart types. Below are examples of the expected output format:
|
| 477 |
+
|
| 478 |
+
Example 1:
|
| 479 |
+
|
| 480 |
+
bar chart
|
| 481 |
+
|
| 482 |
+
Example 2:
|
| 483 |
+
|
| 484 |
+
scatter chart
|
| 485 |
+
|
| 486 |
+
Example 3:
|
| 487 |
+
|
| 488 |
+
histogram
|
| 489 |
+
|
| 490 |
+
Your task is to determine the type of chart shown in the given image.
|
| 491 |
+
|
| 492 |
+
**Instructions:**
|
| 493 |
+
|
| 494 |
+
- **Respond with only the chart type** (e.g., 'bar chart', 'scatter chart').
|
| 495 |
+
- **Do not include any additional text, explanations, or descriptions.**
|
| 496 |
+
- **Ensure the output matches the format in the examples exactly.**
|
| 497 |
+
|
| 498 |
+
Provide only the chart type in \*\*single quotes\*\* as shown in the examples above.
|
| 499 |
+
|
| 500 |
+
What type of chart is shown in the image? Don't output any extra text
|
| 501 |
+
|
| 502 |
+
# Charts: Topic Prompt
|
| 503 |
+
|
| 504 |
+
gaiy 1000
|
| 505 |
+
\*\*1 Jio.
|
| 506 |
+
gll gll
|
| 507 |
+
\*\*2
|
| 508 |
+
aJUd 100
|
| 509 |
+
\*\*\*
|
| 510 |
+
\*\*bbs jlll bhaal gssg 1g sgo 20.
|
| 511 |
+
\*\*bbs aysall aull ayolly sL.
|
| 512 |
+
-** [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
|
| 513 |
+
jll bbl (sfo g ego go la
|
| 514 |
+
|
| 515 |
+
# Charts: Data Prompt
|
| 516 |
+
|
| 517 |
+
" You are an expert in chart data extraction. You are given a chart image and you should provide the chart data in CSV format.
|
| 518 |
+
|
| 519 |
+
Here are some examples.
|
| 520 |
+
|
| 521 |
+
Example 1
|
| 522 |
+
"CSV
|
| 523 |
+
(y)
|
| 524 |
+
ro·,
|
| 525 |
+
17.156d Jua
|
| 526 |
+
AA
|
| 527 |
+
1.
|
| 528 |
+
V. 与之
|
| 529 |
+
11.
|
| 530 |
+
${AA} = {1.5}\sin$
|
| 531 |
+
10.1090/1567
|
| 532 |
+
60
|
| 533 |
+
1
|
| 534 |
+
1
|
| 535 |
+
|
| 536 |
+
Example 2:
|
| 537 |
+
|
| 538 |
+
```
|
| 539 |
+
```
|
| 540 |
+
```csv
|
| 541 |
+
|
| 542 |
+
aullx axal aaxy axay axz ygso
|
| 543 |
+
|
| 544 |
+
(20
|
| 545 |
+
|
| 546 |
+
10,10,5jll 2
|
| 547 |
+
|
| 548 |
+
oo,00,00
|
| 549 |
+
|
| 550 |
+
r.v.aai
|
| 551 |
+
|
| 552 |
+
0.0.2.2. all
|
| 553 |
+
|
| 554 |
+
${a}_{1} = 4\;{b}_{2} = 3$
|
| 555 |
+
|
| 556 |
+
70,ron.25615 1
|
| 557 |
+
|
| 558 |
+
Not give me the results as in the previous CSV format.
|
| 559 |
+
|
| 560 |
+
# PDF to Markdown Prompt
|
| 561 |
+
|
| 562 |
+
"Extract the text from the document in Markdown format, and extract the tables in HTML format.
|
| 563 |
+
|
| 564 |
+
Do not add style or anything, just the text. Do not ever generate tables in markdown format. Give me the output, nothing else."
|
| 565 |
+
|
| 566 |
+
# OCR Prompt
|
| 567 |
+
|
| 568 |
+
"Extract the text in the image. Give me the final text, nothing else."
|
| 569 |
+
|
| 570 |
+
# Diagrams:Type Prompt
|
| 571 |
+
|
| 572 |
+
""You are an expert in detecting chart types. Below are examples of the expected output format:
|
| 573 |
+
|
| 574 |
+
Example 1:
|
| 575 |
+
|
| 576 |
+
treemap
|
| 577 |
+
|
| 578 |
+
Example 2:
|
| 579 |
+
|
| 580 |
+
flowchart
|
| 581 |
+
|
| 582 |
+
Example 3:
|
| 583 |
+
|
| 584 |
+
diagram
|
| 585 |
+
|
| 586 |
+
Your task is to determine the type of chart shown in the given image.
|
| 587 |
+
|
| 588 |
+
**Instructions:**
|
| 589 |
+
|
| 590 |
+
- **Respond with only the chart type** (e.g., 'flowchart', 'sequence').
|
| 591 |
+
- **Do not provide any explanations, descriptions, or additional text.**
|
| 592 |
+
- **Ensure the output strictly follows the format shown in the examples.**
|
| 593 |
+
|
| 594 |
+
What type of chart is shown in the image?
|
| 595 |
+
|
| 596 |
+
# Diagrams: Topic Prompt
|
| 597 |
+
|
| 598 |
+
""You are an expert in detecting chart types. Below are examples of the expected output format:
|
| 599 |
+
|
| 600 |
+
Example 1:
|
| 601 |
+
|
| 602 |
+
treemap
|
| 603 |
+
|
| 604 |
+
Example 2:
|
| 605 |
+
|
| 606 |
+
flowchart
|
| 607 |
+
|
| 608 |
+
Example 3:
|
| 609 |
+
|
| 610 |
+
diagram
|
| 611 |
+
|
| 612 |
+
Your task is to determine the type of chart shown in the given image.
|
| 613 |
+
|
| 614 |
+
**Instructions:**
|
| 615 |
+
- **Respond with only the chart type** (e.g., 'flowchart', 'sequence').
|
| 616 |
+
- **Do not provide any explanations, descriptions, or additional text.**
|
| 617 |
+
- **Ensure the output strictly follows the format shown in the examples.**
|
| 618 |
+
What type of chart is shown in the image?
|
| 619 |
+
|
| 620 |
+
Figure 7: Prompts for Different Task Categories.
|
| 621 |
+
|
| 622 |
+
# Diagrams: Data Prompt
|
| 623 |
+
|
| 624 |
+
""You are an expert in diagram data extraction. Your task is to analyze the given diagram and generate structured data in JSON format that captures nodes (entities) and edges (relationships).
|
| 625 |
+
|
| 626 |
+
```yaml
|
| 627 |
+
## Output Format Example:
|
| 628 |
+
for flowchart:
|
| 629 |
+
#json
|
| 630 |
+
"nodes": [
|
| 631 |
+
"id": "1",
|
| 632 |
+
"text": "1234567890",
|
| 633 |
+
"description": "A description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a description of a
|
| 634 |
+
"id": "2",
|
| 635 |
+
"text": "1234567890",
|
| 636 |
+
"description": "A description of a description of a description of a description of a description of a description of a
|
| 637 |
+
"id": "3",
|
| 638 |
+
"text": "1234567890",
|
| 639 |
+
"description": "A description of a description of a description of a
|
| 640 |
+
"id": "3",
|
| 641 |
+
"text": "1234567890"
|
| 642 |
+
]
|
| 643 |
+
], edges": [
|
| 644 |
+
"from": "1",
|
| 645 |
+
"to": "2",
|
| 646 |
+
"text": "1234567890",
|
| 647 |
+
],
|
| 648 |
+
"from": "2",
|
| 649 |
+
"to": "3",
|
| 650 |
+
"text": "1234567890"
|
| 651 |
+
],
|
| 652 |
+
"from": "3",
|
| 653 |
+
"to": "4",
|
| 654 |
+
"text": "1234567890"
|
| 655 |
+
]
|
| 656 |
+
]
|
| 657 |
+
treemap:
|
| 658 |
+
json
|
| 659 |
+
{
|
| 660 |
+
"clonal: clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = clonal | clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clonal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal = Clrenal + 1
|
| 661 |
+
"clonal: clonal = clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl | clalnl + 1
|
| 662 |
+
"clonal: clalnl + 1
|
| 663 |
+
"clalnl + 1
|
| 664 |
+
"clalnl + 1
|
| 665 |
+
"clalnl + 1
|
| 666 |
+
"clalnl + 1
|
| 667 |
+
"clalnl + 1
|
| 668 |
+
"clalnl + 1
|
| 669 |
+
"clalnl + 1
|
| 670 |
+
"clalnl + 1
|
| 671 |
+
"clalnl + 1
|
| 672 |
+
"clalnl + 1
|
| 673 |
+
"clalnl + 1
|
| 674 |
+
"clcal" : {
|
| 675 |
+
"clcal" : {
|
| 676 |
+
"clcal" : {
|
| 677 |
+
"clcal" : {
|
| 678 |
+
"clcal" : {
|
| 679 |
+
"clcal" : {
|
| 680 |
+
"clcal" : {
|
| 681 |
+
"clcal" : {
|
| 682 |
+
"clcal" : {
|
| 683 |
+
"clcal" : {
|
| 684 |
+
"clcal" : {
|
| 685 |
+
"clcal" : {
|
| 686 |
+
"clcal" : {
|
| 687 |
+
"clcal" : {
|
| 688 |
+
"clcal" : {
|
| 689 |
+
"clcal" : {
|
| 690 |
+
"clcal" : {
|
| 691 |
+
"clcal" : {
|
| 692 |
+
"clcal" : {
|
| 693 |
+
"clcal" : {
|
| 694 |
+
"clcal" : {
|
| 695 |
+
"clcal" : {
|
| 696 |
+
"clcal" : {
|
| 697 |
+
"clcal" : {
|
| 698 |
+
"clcal" : {
|
| 699 |
+
"clcal" : {
|
| 700 |
+
"clcal" : {
|
| 701 |
+
"clcal" : {
|
| 702 |
+
"clcal" : {
|
| 703 |
+
"clcal" : {
|
| 704 |
+
"clcal" : {
|
| 705 |
+
"clcal" : {
|
| 706 |
+
"clcal" : {
|
| 707 |
+
"clcal" : {
|
| 708 |
+
"clcal" : {
|
| 709 |
+
"clcal” : {
|
| 710 |
+
"clcal" : {
|
| 711 |
+
"clcal" : {
|
| 712 |
+
"clcal" : {
|
| 713 |
+
"clcal" : {
|
| 714 |
+
"clcal" : {
|
| 715 |
+
"clcal" : {
|
| 716 |
+
"clcal" : {
|
| 717 |
+
"clcal" : {
|
| 718 |
+
"clcal" : {
|
| 719 |
+
"clcal" : {
|
| 720 |
+
"clcal" : {
|
| 721 |
+
"clcal" : {
|
| 722 |
+
"clcal" : {
|
| 723 |
+
"clcal" : {
|
| 724 |
+
"clcal" : {
|
| 725 |
+
"clcal" : {
|
| 726 |
+
"clcal" : {
|
| 727 |
+
"clcal" : {
|
| 728 |
+
"clcal" : {
|
| 729 |
+
"clcal" : {
|
| 730 |
+
"clcal" : {
|
| 731 |
+
"clcal" : {
|
| 732 |
+
"clcal" : {
|
| 733 |
+
"clcal” : {
|
| 734 |
+
“CLL” : {
|
| 735 |
+
“CLL” : {
|
| 736 |
+
“CLL” : {
|
| 737 |
+
“CLL” : {
|
| 738 |
+
“CLL” : {
|
| 739 |
+
“CLL” : {
|
| 740 |
+
“CLL” : {
|
| 741 |
+
“CLL” : {
|
| 742 |
+
“CLL” : {
|
| 743 |
+
“CLL” : {
|
| 744 |
+
“CLL” : {
|
| 745 |
+
“CLL” : {
|
| 746 |
+
“CLL” : {<nl>
|
| 747 |
+
```
|
| 748 |
+
|
| 749 |
+
# Table: HTML Prompt
|
| 750 |
+
|
| 751 |
+
```txt
|
| 752 |
+
```
|
| 753 |
+
```
|
| 754 |
+
Extract the data from the table below and provide the output in HTML format. Output only the data as HTML and nothing else.
|
| 755 |
+
Here is one example:
|
| 756 |
+
```
|
| 757 |
+
```
|
| 758 |
+
<html
|
| 759 |
+
<table>
|
| 760 |
+
<thead>
|
| 761 |
+
<tr>
|
| 762 |
+
<th>请输入</th>
|
| 763 |
+
<th>请输入</th>
|
| 764 |
+
<th>请输入</th>
|
| 765 |
+
</tr>
|
| 766 |
+
</thead>
|
| 767 |
+
<tbody>
|
| 768 |
+
<td><td>请输入</td>
|
| 769 |
+
<td>请输入</td>
|
| 770 |
+
<td><td>请输入</td></td>
|
| 771 |
+
</tr>
|
| 772 |
+
<tr>
|
| 773 |
+
<td><td>请输入</td></td>
|
| 774 |
+
<td><td>r</td></td>
|
| 775 |
+
</tr>
|
| 776 |
+
<td><td>请输入</td></td>
|
| 777 |
+
<td><td>r</td></td>
|
| 778 |
+
</tr>
|
| 779 |
+
<tr>
|
| 780 |
+
<td><td>请输入</td></td>
|
| 781 |
+
<td><td>r</td></td>
|
| 782 |
+
</tr>
|
| 783 |
+
<td><td>请输入</td></td>
|
| 784 |
+
<td><td>r</td></td>
|
| 785 |
+
</tr>
|
| 786 |
+
<tr>
|
| 787 |
+
<td><td>请输入</td></td>
|
| 788 |
+
<td><td>r</td></td>
|
| 789 |
+
</tr>
|
| 790 |
+
</table>
|
| 791 |
+
Now generate the data for the provided table."
|
| 792 |
+
```
|
| 793 |
+
|
| 794 |
+
# Table: Dataframe Prompt
|
| 795 |
+
|
| 796 |
+
```csv
|
| 797 |
+
"Extract the data from the table below and provide the output in CSV format. Output only the data as CSV and nothing else. Here is one example:
|
| 798 |
+
```
|
| 799 |
+
csv
|
| 800 |
+
a:all:ge:aj:all:15-06-28,2023,aj:all:ge:aj:all:15-06-28
|
| 801 |
+
a:all:ge:aj:all:15-06-28,2023,aj:all:ge:aj:all:15-06-28
|
| 802 |
+
a:all:ge:aj:all:15-06-28,2023,aj:all:ge:aj:all:15-06-28
|
| 803 |
+
a:all:ge:aj:all:150-04-15,2023
|
| 804 |
+
a:all:ge:aj:all:10-03-12,2023,aj:all:ge:aj:all:10-03-12
|
| 805 |
+
a:all:ge:aj:all:10-03-12,2023,aj:all:ge:aj:all:10-03-12
|
| 806 |
+
a:all:ge:aj:all:10-03-12,2023,aj:all:ge:aj:all:10-03-12
|
| 807 |
+
a:all:ge:aj:all:101-09-35,2023,aj:all:ge:aj:all:101-09-35
|
| 808 |
+
a:all:ge:aj:all:101-09-35,2023,aj:all:ge:aj:all:101-09-35
|
| 809 |
+
a:all:ge:aj:all:101-09-35,2023,aj:all:ge:aj:all:101-09-35
|
| 810 |
+
a:all:ge:aj: all 15-05-18,2023
|
| 811 |
+
```
|
| 812 |
+
|
| 813 |
+
Figure 8: Prompts for Diagrams and Tables.
|
2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5be80280ccc46066bb1f77bf2f356cfcfec53ad6a8cb7cf97073fbdc27f22662
|
| 3 |
+
size 1247374
|
2025/KITAB-Bench_ A Comprehensive Multi-Domain Benchmark for Arabic OCR and Document Understanding/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/5b27d840-4fbb-4001-88b6-b01143c761b0_content_list.json
ADDED
|
@@ -0,0 +1,2232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "KVPR: Efficient LLM Inference with I/O-Aware KV Cache Partial Recomputation",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
238,
|
| 8 |
+
90,
|
| 9 |
+
754,
|
| 10 |
+
130
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Chaoyi Jiang*, Lei Gao*, Hossein Entezari Zarch, Murali Annavarm",
|
| 17 |
+
"bbox": [
|
| 18 |
+
201,
|
| 19 |
+
156,
|
| 20 |
+
794,
|
| 21 |
+
174
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "University of Southern California",
|
| 28 |
+
"bbox": [
|
| 29 |
+
361,
|
| 30 |
+
175,
|
| 31 |
+
635,
|
| 32 |
+
190
|
| 33 |
+
],
|
| 34 |
+
"page_idx": 0
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"type": "text",
|
| 38 |
+
"text": "{chaoyij, leig, entezari, annavara}@usc.edu",
|
| 39 |
+
"bbox": [
|
| 40 |
+
280,
|
| 41 |
+
192,
|
| 42 |
+
715,
|
| 43 |
+
208
|
| 44 |
+
],
|
| 45 |
+
"page_idx": 0
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"type": "text",
|
| 49 |
+
"text": "Abstract",
|
| 50 |
+
"text_level": 1,
|
| 51 |
+
"bbox": [
|
| 52 |
+
260,
|
| 53 |
+
260,
|
| 54 |
+
339,
|
| 55 |
+
275
|
| 56 |
+
],
|
| 57 |
+
"page_idx": 0
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"type": "text",
|
| 61 |
+
"text": "Inference for Large Language Models (LLMs) is computationally demanding. To reduce the cost of auto-regressive decoding, Key-Value (KV) cache is used to store intermediate activations, which significantly lowers the computational overhead for token generation. However, the memory required for the KV cache grows rapidly, often exceeding the capacity of GPU memory. A cost-effective alternative is to offload KV cache to CPU memory, which alleviates GPU memory pressure, but shifts the bottleneck to the limited bandwidth of the PCIe connection between the CPU and GPU. Existing methods attempt to address these issues by overlapping GPU computation with I/O or employing CPU-GPU heterogeneous execution, but they are hindered by excessive data movement and dependence on CPU capabilities. Fully overlapping PCIe communication latency gets challenging as the size of the KV cache grows and/or the GPU compute capabilities increase. In this paper, we introduce KVPR, an efficient I/O-aware LLM inference method where the CPU first transfers a partial set of activations, from which the GPU can start recomputing the KV cache values. While the GPU recomputes the partial KV cache, the remaining portion of the KV cache is transferred concurrently from the CPU. This approach overlaps GPU recomputation with KV cache transfer to minimize idle GPU time and maximize inference performance. KVPR is fully automated by integrating a profiler module that utilizes input characteristics and system hardware information, a scheduler module to optimize the distribution of computation and communication workloads, and a runtime module to efficiently execute the derived execution plan. Experimental results show that KVPR achieves up to $35.8\\%$ lower latency and $46.2\\%$ higher throughput during decoding compared to state-of-the-art approaches. The code is available at https://github.com/chaoyij/KVPR.",
|
| 62 |
+
"bbox": [
|
| 63 |
+
144,
|
| 64 |
+
288,
|
| 65 |
+
460,
|
| 66 |
+
901
|
| 67 |
+
],
|
| 68 |
+
"page_idx": 0
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"type": "text",
|
| 72 |
+
"text": "1 Introduction",
|
| 73 |
+
"text_level": 1,
|
| 74 |
+
"bbox": [
|
| 75 |
+
510,
|
| 76 |
+
260,
|
| 77 |
+
653,
|
| 78 |
+
275
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "Large language models (LLMs) have made remarkable progress in recent years, demonstrating their ability to power diverse applications such as machine translation (Zhu et al., 2024), summarization (OpenAI et al., 2024), creative content generation (Gemini Team, 2024), and personalized recommendations (Geng et al., 2022). Real-time applications, including conversational agents and live translation (Li et al., 2023), depend on low latency to provide seamless user interaction, while large-scale deployments require high throughput to support concurrent users and process substantial data efficiently (Kwon et al., 2023).",
|
| 85 |
+
"bbox": [
|
| 86 |
+
507,
|
| 87 |
+
290,
|
| 88 |
+
884,
|
| 89 |
+
498
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "Key-Value (KV) cache is essential in autoregressive decoding for LLMs, as it stores the intermediate key and value activations from earlier steps in the attention mechanism. This reduces the computational complexity of generating each token from quadratic to linear by eliminating the need to recompute these activations for every generated token. However, this comes at a cost: the size of the KV cache grows linearly with batch size, sequence length, and model size, leading to substantial memory demands (Wan et al., 2024).",
|
| 96 |
+
"bbox": [
|
| 97 |
+
507,
|
| 98 |
+
501,
|
| 99 |
+
884,
|
| 100 |
+
678
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "GPU memory, while optimized for high-bandwidth access by computation units, is inherently limited and often insufficient to handle the large and growing size of the KV cache. One cost-effective approach to address this limitation is to offload the KV cache to cheaper and plentiful CPU memory, and could be further offloaded to hard disks and network storage (Liu et al., 2024a). While offloading reduces GPU memory pressure, it introduces a new bottleneck: the slow PCIe bus becomes a limiting factor when transferring the KV cache from CPU to GPU for computation. Due to the long PCIe transfer time, the overall decoding latency increases and token generation throughput decreases, hindering the overall inference efficiency",
|
| 107 |
+
"bbox": [
|
| 108 |
+
507,
|
| 109 |
+
678,
|
| 110 |
+
885,
|
| 111 |
+
921
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 0
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "page_footnote",
|
| 117 |
+
"text": "*These authors contributed equally.",
|
| 118 |
+
"bbox": [
|
| 119 |
+
136,
|
| 120 |
+
906,
|
| 121 |
+
354,
|
| 122 |
+
921
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 0
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "page_number",
|
| 128 |
+
"text": "19474",
|
| 129 |
+
"bbox": [
|
| 130 |
+
475,
|
| 131 |
+
927,
|
| 132 |
+
524,
|
| 133 |
+
940
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 0
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "footer",
|
| 139 |
+
"text": "Findings of the Association for Computational Linguistics: ACL 2025, pages 19474-19488 July 27 - August 1, 2025 ©2025 Association for Computational Linguistics",
|
| 140 |
+
"bbox": [
|
| 141 |
+
220,
|
| 142 |
+
945,
|
| 143 |
+
778,
|
| 144 |
+
972
|
| 145 |
+
],
|
| 146 |
+
"page_idx": 0
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"type": "image",
|
| 150 |
+
"img_path": "images/6a88abb41b41cd7e981e9c6c1bc96eb5f84c5c17ca3217c36ee503f3c53e890e.jpg",
|
| 151 |
+
"image_caption": [
|
| 152 |
+
"Figure 1: LLM inference system with an A100 GPU."
|
| 153 |
+
],
|
| 154 |
+
"image_footnote": [],
|
| 155 |
+
"bbox": [
|
| 156 |
+
115,
|
| 157 |
+
80,
|
| 158 |
+
487,
|
| 159 |
+
156
|
| 160 |
+
],
|
| 161 |
+
"page_idx": 1
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"type": "text",
|
| 165 |
+
"text": "of the system (Zhao et al., 2024a).",
|
| 166 |
+
"bbox": [
|
| 167 |
+
114,
|
| 168 |
+
206,
|
| 169 |
+
371,
|
| 170 |
+
222
|
| 171 |
+
],
|
| 172 |
+
"page_idx": 1
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"type": "table",
|
| 176 |
+
"img_path": "images/94597e13fc50386d50f12bd3ec281ce99c2bc8f0585beba4cb3683f47ad2e3e9.jpg",
|
| 177 |
+
"table_caption": [],
|
| 178 |
+
"table_footnote": [],
|
| 179 |
+
"table_body": "<table><tr><td>Model</td><td>Hidden Dim</td><td>KV Cache (MB)</td><td>PCIe Latency (ms)</td><td>Comp. Latency (ms)</td></tr><tr><td>OPT-6.7B</td><td>4,096</td><td>512</td><td>15.6</td><td>0.3509</td></tr><tr><td>OPT-13B</td><td>5,120</td><td>640</td><td>19.5</td><td>0.4388</td></tr><tr><td>OPT-30B</td><td>7,168</td><td>896</td><td>27.3</td><td>0.6143</td></tr></table>",
|
| 180 |
+
"bbox": [
|
| 181 |
+
115,
|
| 182 |
+
231,
|
| 183 |
+
487,
|
| 184 |
+
288
|
| 185 |
+
],
|
| 186 |
+
"page_idx": 1
|
| 187 |
+
},
|
| 188 |
+
{
|
| 189 |
+
"type": "text",
|
| 190 |
+
"text": "Table 1: PCIe latency and computation latency for different KV cache sizes based on the system in Figure 1.",
|
| 191 |
+
"bbox": [
|
| 192 |
+
112,
|
| 193 |
+
297,
|
| 194 |
+
489,
|
| 195 |
+
326
|
| 196 |
+
],
|
| 197 |
+
"page_idx": 1
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"type": "text",
|
| 201 |
+
"text": "To evaluate the impact of communication overhead, we set up an LLM inference serving system (shown in Figure 1) using an NVIDIA A100 GPU. Data transfer between the CPU DRAM and GPU HBM occurs over a PCIe 4.0 16 lanes with a bandwidth of $32\\mathrm{GB / s}$ . Table 1 shows the hidden dimension, KV cache size, PCIe transfer time, and GPU computation latency for KV pair computation. Note that the end-to-end decoding latency includes other components, such as feed-forward layers, which are not shown in this table for clarity. We use FP16 precision with a batch size of 32 and a sequence length of 1024. The results show that PCIe latency exceeds KV cache recomputation latency by over an order of magnitude. Hence, in systems where the KV cache is stored on CPU DRAM the long transfer time leads to GPU idle time, which is detrimental to inference efficiency.",
|
| 202 |
+
"bbox": [
|
| 203 |
+
112,
|
| 204 |
+
342,
|
| 205 |
+
489,
|
| 206 |
+
630
|
| 207 |
+
],
|
| 208 |
+
"page_idx": 1
|
| 209 |
+
},
|
| 210 |
+
{
|
| 211 |
+
"type": "text",
|
| 212 |
+
"text": "To mitigate the issue of low latency and bandwidth of PCIe, FlexGen (Sheng et al., 2023) and PipeSwitch (Bai et al., 2020) attempt to overlap GPU computation of the current layer with KV cache loading for the next layer. However, the effectiveness of such an overlap is capped by the task that takes the longest time. In most systems, PCIe transfer time overshadows GPU computation latency, particularly with large batch and context sizes. Hence, fully overlapping GPU computation with PCIe transfer time is infeasible. FastDecode (He and Zhai, 2024) suggests computing attention scores directly on the CPU, which has faster access to the KV cache compared to the GPU. Similarly, HeteGen (Zhao et al., 2024a), TwinPilots (Yu et al., 2024), and Park and Egger employ CPU-GPU heterogeneous execution to hide data transfer overhead by performing computations on the CPU.",
|
| 213 |
+
"bbox": [
|
| 214 |
+
112,
|
| 215 |
+
631,
|
| 216 |
+
489,
|
| 217 |
+
921
|
| 218 |
+
],
|
| 219 |
+
"page_idx": 1
|
| 220 |
+
},
|
| 221 |
+
{
|
| 222 |
+
"type": "text",
|
| 223 |
+
"text": "However, as demonstrated later in our results, such an approach puts a burden on the CPU to satisfy the KV cache computation demands from multiple GPUs attached to a CPU host, thereby limiting scalability.",
|
| 224 |
+
"bbox": [
|
| 225 |
+
507,
|
| 226 |
+
84,
|
| 227 |
+
884,
|
| 228 |
+
164
|
| 229 |
+
],
|
| 230 |
+
"page_idx": 1
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
"type": "text",
|
| 234 |
+
"text": "In this paper, we propose KVPR, a novel approach for efficient LLM inference that balances the GPU computation and PCIe bandwidth trade-offs. Instead of transferring the entire KV cache from CPU to GPU to compute an attention score, the CPU transfers a partial set of activations, which are smaller in size and are required to generate part of the KV cache, to the GPU. The GPU then starts recomputing the partial KV cache from the input activations. Concurrently, the CPU transfers the remaining KV cache over PCIe. KVPR ensures the computation of exact attention scores without approximation, while minimizing GPU idle time and improving overall latency and throughput.",
|
| 235 |
+
"bbox": [
|
| 236 |
+
507,
|
| 237 |
+
184,
|
| 238 |
+
884,
|
| 239 |
+
409
|
| 240 |
+
],
|
| 241 |
+
"page_idx": 1
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"type": "text",
|
| 245 |
+
"text": "KVPR achieves a near-perfect overlap of PCIe transfer time and GPU recomputation time by determining the optimal fraction of activations that need to be recomputed. KVPR is fully automated in determining the recomputation and communication split. It includes a profiler module that collects system hardware information, a scheduler module that formulates the problem as a linear programming problem to determine the optimal split point, and a runtime module that manages memory allocation on both devices and coordinates data transfer between them. Experimental results show significant improvements in inference latency or throughput, depending on workload. In summary, our contributions are as follows:",
|
| 246 |
+
"bbox": [
|
| 247 |
+
507,
|
| 248 |
+
428,
|
| 249 |
+
884,
|
| 250 |
+
668
|
| 251 |
+
],
|
| 252 |
+
"page_idx": 1
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"type": "list",
|
| 256 |
+
"sub_type": "text",
|
| 257 |
+
"list_items": [
|
| 258 |
+
"- We propose an efficient CPU-GPU I/O-aware LLM inference method that leverages KV cache partial recomputation with asynchronous KV cache transfer that overlaps compute and communication to address the system bottleneck of loading large KV cache from CPU memories.",
|
| 259 |
+
"- We develop a framework based on linear integer programming that achieves optimal computation-communication distribution.",
|
| 260 |
+
"- Our experimental results show that KVPR outperforms the current state-of-the-art approaches up to $35.8\\%$ in terms of latency and $46.2\\%$ in terms of throughput."
|
| 261 |
+
],
|
| 262 |
+
"bbox": [
|
| 263 |
+
531,
|
| 264 |
+
688,
|
| 265 |
+
885,
|
| 266 |
+
917
|
| 267 |
+
],
|
| 268 |
+
"page_idx": 1
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"type": "page_number",
|
| 272 |
+
"text": "19475",
|
| 273 |
+
"bbox": [
|
| 274 |
+
477,
|
| 275 |
+
927,
|
| 276 |
+
524,
|
| 277 |
+
940
|
| 278 |
+
],
|
| 279 |
+
"page_idx": 1
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"type": "text",
|
| 283 |
+
"text": "2 Background",
|
| 284 |
+
"text_level": 1,
|
| 285 |
+
"bbox": [
|
| 286 |
+
114,
|
| 287 |
+
84,
|
| 288 |
+
255,
|
| 289 |
+
99
|
| 290 |
+
],
|
| 291 |
+
"page_idx": 2
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
"type": "text",
|
| 295 |
+
"text": "LLM inference process. The inference process of decoder-only LLMs employs an auto-regressive approach, generating tokens sequentially. It consists of two stages: the prefilling stage and the decoding stage. In the prefilling stage, the input to the $i$ -th decoder layer is denoted as $X^i \\in \\mathbb{R}^{b \\times s \\times h}$ , where $i \\in \\{1, \\dots, n\\}$ , $b$ is the batch size, $s$ is the prompt length, and $h$ is the input embedding dimension. The Multi-Head Attention (MHA) block computes a set of queries $(Q)$ , keys $(K)$ , and values $(V)$ through linear projections of $X^i$ :",
|
| 296 |
+
"bbox": [
|
| 297 |
+
112,
|
| 298 |
+
111,
|
| 299 |
+
489,
|
| 300 |
+
288
|
| 301 |
+
],
|
| 302 |
+
"page_idx": 2
|
| 303 |
+
},
|
| 304 |
+
{
|
| 305 |
+
"type": "equation",
|
| 306 |
+
"text": "\n$$\nQ ^ {i} = X ^ {i} \\cdot W _ {Q} ^ {i}, K ^ {i} = X ^ {i} \\cdot W _ {K} ^ {i}, V ^ {i} = X ^ {i} \\cdot W _ {V} ^ {i}, (1)\n$$\n",
|
| 307 |
+
"text_format": "latex",
|
| 308 |
+
"bbox": [
|
| 309 |
+
122,
|
| 310 |
+
311,
|
| 311 |
+
489,
|
| 312 |
+
329
|
| 313 |
+
],
|
| 314 |
+
"page_idx": 2
|
| 315 |
+
},
|
| 316 |
+
{
|
| 317 |
+
"type": "text",
|
| 318 |
+
"text": "where $W_{Q}^{i}, W_{K}^{i}, W_{V}^{i} \\in \\mathbb{R}^{h \\times h}$ are the projection matrices. The generated $K^{i}$ and $V^{i}$ are stored in the KV cache.",
|
| 319 |
+
"bbox": [
|
| 320 |
+
112,
|
| 321 |
+
341,
|
| 322 |
+
487,
|
| 323 |
+
391
|
| 324 |
+
],
|
| 325 |
+
"page_idx": 2
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"type": "text",
|
| 329 |
+
"text": "The self-attention score in MHA is computed as:",
|
| 330 |
+
"bbox": [
|
| 331 |
+
112,
|
| 332 |
+
393,
|
| 333 |
+
478,
|
| 334 |
+
409
|
| 335 |
+
],
|
| 336 |
+
"page_idx": 2
|
| 337 |
+
},
|
| 338 |
+
{
|
| 339 |
+
"type": "equation",
|
| 340 |
+
"text": "\n$$\nZ ^ {i} = \\operatorname {s o f t m a x} \\left(\\frac {Q ^ {i} \\left(K ^ {i}\\right) ^ {T}}{\\sqrt {d _ {\\text {h e a d}}}}\\right) \\cdot V ^ {i}, \\tag {2}\n$$\n",
|
| 341 |
+
"text_format": "latex",
|
| 342 |
+
"bbox": [
|
| 343 |
+
193,
|
| 344 |
+
418,
|
| 345 |
+
487,
|
| 346 |
+
450
|
| 347 |
+
],
|
| 348 |
+
"page_idx": 2
|
| 349 |
+
},
|
| 350 |
+
{
|
| 351 |
+
"type": "text",
|
| 352 |
+
"text": "where $d_{\\mathrm{head}}$ represents the dimension of each attention head. Finally, the attention score is applied with a linear projection to produce the output of the MHA block:",
|
| 353 |
+
"bbox": [
|
| 354 |
+
112,
|
| 355 |
+
456,
|
| 356 |
+
489,
|
| 357 |
+
519
|
| 358 |
+
],
|
| 359 |
+
"page_idx": 2
|
| 360 |
+
},
|
| 361 |
+
{
|
| 362 |
+
"type": "equation",
|
| 363 |
+
"text": "\n$$\nO ^ {i} = Z ^ {i} \\cdot W _ {O} ^ {i}, \\tag {3}\n$$\n",
|
| 364 |
+
"text_format": "latex",
|
| 365 |
+
"bbox": [
|
| 366 |
+
248,
|
| 367 |
+
531,
|
| 368 |
+
487,
|
| 369 |
+
546
|
| 370 |
+
],
|
| 371 |
+
"page_idx": 2
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"type": "text",
|
| 375 |
+
"text": "where $W_{O}^{i}\\in \\mathbb{R}^{h\\times h}$ is the projection matrix.",
|
| 376 |
+
"bbox": [
|
| 377 |
+
112,
|
| 378 |
+
556,
|
| 379 |
+
440,
|
| 380 |
+
573
|
| 381 |
+
],
|
| 382 |
+
"page_idx": 2
|
| 383 |
+
},
|
| 384 |
+
{
|
| 385 |
+
"type": "text",
|
| 386 |
+
"text": "The feedforward network (FFN) is followed after the MHA block, which consists of two fully connected layers with a non-linear activation function applied between them. It processes the attention output $O^i$ to generate the input for the next decoder layer as follows:",
|
| 387 |
+
"bbox": [
|
| 388 |
+
112,
|
| 389 |
+
574,
|
| 390 |
+
489,
|
| 391 |
+
670
|
| 392 |
+
],
|
| 393 |
+
"page_idx": 2
|
| 394 |
+
},
|
| 395 |
+
{
|
| 396 |
+
"type": "equation",
|
| 397 |
+
"text": "\n$$\nX ^ {i + 1} = \\sigma \\left(O ^ {i} \\cdot W _ {1} ^ {i}\\right) \\cdot W _ {2} ^ {i}, \\tag {4}\n$$\n",
|
| 398 |
+
"text_format": "latex",
|
| 399 |
+
"bbox": [
|
| 400 |
+
213,
|
| 401 |
+
680,
|
| 402 |
+
487,
|
| 403 |
+
697
|
| 404 |
+
],
|
| 405 |
+
"page_idx": 2
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"type": "text",
|
| 409 |
+
"text": "where $W_1^i \\in \\mathbb{R}^{h \\times d_{\\mathrm{FFN}}}$ and $W_2^i \\in \\mathbb{R}^{d_{\\mathrm{FFN}} \\times h}$ are the weight matrices of the two linear layers, and $\\sigma(\\cdot)$ denotes the activation function.",
|
| 410 |
+
"bbox": [
|
| 411 |
+
112,
|
| 412 |
+
706,
|
| 413 |
+
487,
|
| 414 |
+
753
|
| 415 |
+
],
|
| 416 |
+
"page_idx": 2
|
| 417 |
+
},
|
| 418 |
+
{
|
| 419 |
+
"type": "text",
|
| 420 |
+
"text": "In the decoding stage, the $i$ -th decoder layer receives a single token $x^{i} \\in \\mathbb{R}^{b \\times 1 \\times h}$ . The KV cache is updated by concatenating the newly computed key and value pairs with the existing ones:",
|
| 421 |
+
"bbox": [
|
| 422 |
+
112,
|
| 423 |
+
756,
|
| 424 |
+
489,
|
| 425 |
+
820
|
| 426 |
+
],
|
| 427 |
+
"page_idx": 2
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"type": "equation",
|
| 431 |
+
"text": "\n$$\nK ^ {i} = \\operatorname {c o n c a t} \\left(K ^ {i}, x ^ {i} \\cdot W _ {K} ^ {i}\\right), \\tag {5}\n$$\n",
|
| 432 |
+
"text_format": "latex",
|
| 433 |
+
"bbox": [
|
| 434 |
+
210,
|
| 435 |
+
829,
|
| 436 |
+
487,
|
| 437 |
+
852
|
| 438 |
+
],
|
| 439 |
+
"page_idx": 2
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
"type": "equation",
|
| 443 |
+
"text": "\n$$\nV ^ {i} = \\operatorname {c o n c a t} \\left(V ^ {i}, x ^ {i} \\cdot W _ {V} ^ {i}\\right).\n$$\n",
|
| 444 |
+
"text_format": "latex",
|
| 445 |
+
"bbox": [
|
| 446 |
+
213,
|
| 447 |
+
850,
|
| 448 |
+
386,
|
| 449 |
+
865
|
| 450 |
+
],
|
| 451 |
+
"page_idx": 2
|
| 452 |
+
},
|
| 453 |
+
{
|
| 454 |
+
"type": "text",
|
| 455 |
+
"text": "The remaining attention and feedforward computations in the decoding stage are identical to those in the prefilling stage.",
|
| 456 |
+
"bbox": [
|
| 457 |
+
112,
|
| 458 |
+
873,
|
| 459 |
+
489,
|
| 460 |
+
921
|
| 461 |
+
],
|
| 462 |
+
"page_idx": 2
|
| 463 |
+
},
|
| 464 |
+
{
|
| 465 |
+
"type": "text",
|
| 466 |
+
"text": "3 Proposed Method",
|
| 467 |
+
"text_level": 1,
|
| 468 |
+
"bbox": [
|
| 469 |
+
509,
|
| 470 |
+
83,
|
| 471 |
+
697,
|
| 472 |
+
99
|
| 473 |
+
],
|
| 474 |
+
"page_idx": 2
|
| 475 |
+
},
|
| 476 |
+
{
|
| 477 |
+
"type": "text",
|
| 478 |
+
"text": "LLM inference scheduling. Our approach aims at LLM inference systems with large KV caches that are stored on CPU DRAM and fetched into GPU memory as needed. Since LLMs have many layers and many batches of inputs to process, there are different scheduling strategies to determine how computations are performed across batches and layers to optimize for specific performance goals, such as minimizing latency or maximizing throughput. Row-by-row schedule (as shown in Appendix A.1) processes one batch at a time, using layer-wise execution. In this scenario, model weights are kept in GPU memory whenever feasible. If the model weights are also offloaded to the CPU, both the KV cache and the model weights for a single layer are transferred to the GPU, processed for the current batch, and then cleared. This process is repeated layer by layer until a token is generated. When minimizing latency is the primary goal, this approach is preferred because all prompts in a batch are fully processed to generate their complete context before proceeding to the next batch.",
|
| 479 |
+
"bbox": [
|
| 480 |
+
507,
|
| 481 |
+
110,
|
| 482 |
+
884,
|
| 483 |
+
464
|
| 484 |
+
],
|
| 485 |
+
"page_idx": 2
|
| 486 |
+
},
|
| 487 |
+
{
|
| 488 |
+
"type": "text",
|
| 489 |
+
"text": "Column-by-column scheduling (Appendix A.1) is more effective for maximizing throughput by increasing the effective batch size (number of batches times batch size) to process more sequences in parallel, at the cost of longer latency. In this approach, the model weights are offloaded to CPU memory to accommodate a large batch size. The model weights and KV cache for a single layer are transferred to GPU memory and processed for the first batch. Instead of moving to the next layer for the current batch, subsequent batches are processed using the same layer while keeping the weights stationary in GPU memory. Once a group of batches is processed for the first layer, the process moves to the second layer for each batch. Note that the effective batch size is limited by the available storage for activations and KV cache, as they must still be stored in CPU memory or external storage once they exceed the GPU memory capacity.",
|
| 490 |
+
"bbox": [
|
| 491 |
+
507,
|
| 492 |
+
466,
|
| 493 |
+
884,
|
| 494 |
+
772
|
| 495 |
+
],
|
| 496 |
+
"page_idx": 2
|
| 497 |
+
},
|
| 498 |
+
{
|
| 499 |
+
"type": "text",
|
| 500 |
+
"text": "Our proposed design is independent of the scheduling strategy, whether row-by-row or column-by-column, and aims to overlap the majority of the PCIe transfer time with GPU computations, thereby improving overall efficiency.",
|
| 501 |
+
"bbox": [
|
| 502 |
+
507,
|
| 503 |
+
772,
|
| 504 |
+
884,
|
| 505 |
+
853
|
| 506 |
+
],
|
| 507 |
+
"page_idx": 2
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
"type": "text",
|
| 511 |
+
"text": "3.1 Design Overview",
|
| 512 |
+
"text_level": 1,
|
| 513 |
+
"bbox": [
|
| 514 |
+
507,
|
| 515 |
+
866,
|
| 516 |
+
690,
|
| 517 |
+
882
|
| 518 |
+
],
|
| 519 |
+
"page_idx": 2
|
| 520 |
+
},
|
| 521 |
+
{
|
| 522 |
+
"type": "text",
|
| 523 |
+
"text": "To relieve PCIe pressure and improve GPU computation utilization, we propose a novel method,",
|
| 524 |
+
"bbox": [
|
| 525 |
+
507,
|
| 526 |
+
889,
|
| 527 |
+
884,
|
| 528 |
+
921
|
| 529 |
+
],
|
| 530 |
+
"page_idx": 2
|
| 531 |
+
},
|
| 532 |
+
{
|
| 533 |
+
"type": "page_number",
|
| 534 |
+
"text": "19476",
|
| 535 |
+
"bbox": [
|
| 536 |
+
477,
|
| 537 |
+
927,
|
| 538 |
+
524,
|
| 539 |
+
940
|
| 540 |
+
],
|
| 541 |
+
"page_idx": 2
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"type": "image",
|
| 545 |
+
"img_path": "images/ab1c4fdeae77742b09a8f8944a0d1d9962b5311e703b3c744661e74837b96a84.jpg",
|
| 546 |
+
"image_caption": [
|
| 547 |
+
"Figure 2: Design overview of KVPR. User configuration and profiling inform the scheduler, which computes an optimal KV cache recompute ratio. The runtime then overlaps data transfer and GPU computation to improve inference efficiency."
|
| 548 |
+
],
|
| 549 |
+
"image_footnote": [],
|
| 550 |
+
"bbox": [
|
| 551 |
+
228,
|
| 552 |
+
80,
|
| 553 |
+
771,
|
| 554 |
+
218
|
| 555 |
+
],
|
| 556 |
+
"page_idx": 3
|
| 557 |
+
},
|
| 558 |
+
{
|
| 559 |
+
"type": "text",
|
| 560 |
+
"text": "KVPR, that recomputes partial KV cache on the GPU while transferring the rest of the KV cache to the GPU. As shown in Figure 2, KVPR comprises three main modules: the profiler, scheduler, and runtime. User configuration includes performance objective (i.e., latency or throughput), data parameters such as prompt length, generation length, batch size, and model information like input embedding dimension and number of layers. The profiler module gathers system statistics, which provide insights into hardware characteristics like PCIe bandwidth and GPU processing speed. For example, the profiler module utilizes the batch size, model information, and sequence length to characterize PCIe bandwidth. Using this information along with the user configuration, the scheduler module calculates the best KV cache split point for recomputation by solving a linear programming problem, aiming to maximize the overlap between the computation and communication operations and utilization of both GPU and PCIe bandwidth during the inference process. The runtime module, in turn, utilizes this execution strategy to process user inputs and manage the memory allocation and data transfer streams.",
|
| 561 |
+
"bbox": [
|
| 562 |
+
112,
|
| 563 |
+
297,
|
| 564 |
+
492,
|
| 565 |
+
700
|
| 566 |
+
],
|
| 567 |
+
"page_idx": 3
|
| 568 |
+
},
|
| 569 |
+
{
|
| 570 |
+
"type": "text",
|
| 571 |
+
"text": "3.2 Scheduler Module",
|
| 572 |
+
"text_level": 1,
|
| 573 |
+
"bbox": [
|
| 574 |
+
112,
|
| 575 |
+
717,
|
| 576 |
+
305,
|
| 577 |
+
732
|
| 578 |
+
],
|
| 579 |
+
"page_idx": 3
|
| 580 |
+
},
|
| 581 |
+
{
|
| 582 |
+
"type": "text",
|
| 583 |
+
"text": "In this section, we describe how KVPR is adopted to either the row-by-row or column-by-column schedule.",
|
| 584 |
+
"bbox": [
|
| 585 |
+
112,
|
| 586 |
+
741,
|
| 587 |
+
487,
|
| 588 |
+
789
|
| 589 |
+
],
|
| 590 |
+
"page_idx": 3
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"type": "text",
|
| 594 |
+
"text": "Row-by-row schedule with KV cache partial re-computation. If the performance objective is to minimize latency, the scheduler module will initiate a row-by-row execution plan. The naive offloading pipeline of a row-by-row schedule is shown in Figure 3(a), where both the KV cache and model weights are offloaded to CPU memory. The required data are transferred asynchronously over",
|
| 595 |
+
"bbox": [
|
| 596 |
+
112,
|
| 597 |
+
793,
|
| 598 |
+
490,
|
| 599 |
+
921
|
| 600 |
+
],
|
| 601 |
+
"page_idx": 3
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"type": "text",
|
| 605 |
+
"text": "PCIe to the GPU for executing the MHA and FFN blocks. Storing newly generated KV pairs to CPU memory is omitted from the figure for simplicity. Since the KV cache is larger in size compared to the MHA weights, it arrives at the GPU later during the asynchronous transfer. The pipeline is slightly different if model weights are not offloaded to the CPU. In this case, only the MHA block will wait for the KV cache data to be transferred to the GPU before starting the computation.",
|
| 606 |
+
"bbox": [
|
| 607 |
+
507,
|
| 608 |
+
297,
|
| 609 |
+
884,
|
| 610 |
+
458
|
| 611 |
+
],
|
| 612 |
+
"page_idx": 3
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
"type": "image",
|
| 616 |
+
"img_path": "images/d12f896d40326cf103d9f5aa40f192ac59190f00b9dabd7222b9d182f463873a.jpg",
|
| 617 |
+
"image_caption": [
|
| 618 |
+
"Figure 3: Comparison of two offloading pipelines."
|
| 619 |
+
],
|
| 620 |
+
"image_footnote": [],
|
| 621 |
+
"bbox": [
|
| 622 |
+
515,
|
| 623 |
+
475,
|
| 624 |
+
875,
|
| 625 |
+
507
|
| 626 |
+
],
|
| 627 |
+
"page_idx": 3
|
| 628 |
+
},
|
| 629 |
+
{
|
| 630 |
+
"type": "image",
|
| 631 |
+
"img_path": "images/325483fb3b07a03bda8d615d4409a89c357093898bf761f695a743957e5d6756.jpg",
|
| 632 |
+
"image_caption": [],
|
| 633 |
+
"image_footnote": [
|
| 634 |
+
"(a) Naive offloading pipeline for row-wise scheduling with asynchronous data transfer. GPU and PCIe denote GPU computation and data transfer, with arrows indicating data dependencies.",
|
| 635 |
+
"(b) Offloading pipeline for row-wise scheduling with KV cache partial recomputation."
|
| 636 |
+
],
|
| 637 |
+
"bbox": [
|
| 638 |
+
515,
|
| 639 |
+
565,
|
| 640 |
+
873,
|
| 641 |
+
596
|
| 642 |
+
],
|
| 643 |
+
"page_idx": 3
|
| 644 |
+
},
|
| 645 |
+
{
|
| 646 |
+
"type": "text",
|
| 647 |
+
"text": "In KVPR, rather than transferring the entire KV cache from CPU memory to GPU memory, the GPU recomputes partial KV cache using corresponding input activations that are transferred from CPU first, while the remaining KV cache is asynchronously transferred to the GPU, as illustrated in Figure 3(b). The GPU then merges the recomputed KV cache with the transferred KV cache to perform MHA computations.",
|
| 648 |
+
"bbox": [
|
| 649 |
+
507,
|
| 650 |
+
678,
|
| 651 |
+
884,
|
| 652 |
+
822
|
| 653 |
+
],
|
| 654 |
+
"page_idx": 3
|
| 655 |
+
},
|
| 656 |
+
{
|
| 657 |
+
"type": "text",
|
| 658 |
+
"text": "Column-by-column schedule with KV cache partial recomputation. When the performance objective is to maximize throughput, the scheduler module adopts a column-by-column execution plan. This approach, illustrated in Figure 4, accommodates large batch size inference by reusing model",
|
| 659 |
+
"bbox": [
|
| 660 |
+
507,
|
| 661 |
+
825,
|
| 662 |
+
885,
|
| 663 |
+
921
|
| 664 |
+
],
|
| 665 |
+
"page_idx": 3
|
| 666 |
+
},
|
| 667 |
+
{
|
| 668 |
+
"type": "page_number",
|
| 669 |
+
"text": "19477",
|
| 670 |
+
"bbox": [
|
| 671 |
+
477,
|
| 672 |
+
927,
|
| 673 |
+
524,
|
| 674 |
+
940
|
| 675 |
+
],
|
| 676 |
+
"page_idx": 3
|
| 677 |
+
},
|
| 678 |
+
{
|
| 679 |
+
"type": "text",
|
| 680 |
+
"text": "weights across multiple batches. As soon as the KV cache for batch 0 is fully transmitted, the activations for batch 1 are transferred. Simultaneously, the GPU begins computing the MHA for batch 0. Unlike the row-by-row schedule, which processes all layers sequentially within a single batch before moving to the next batch, the column-by-column schedule processes multiple batches on the same layer. As a result, activations corresponding to the recomputed KV cache must be stored until generation for that batch is complete.",
|
| 681 |
+
"bbox": [
|
| 682 |
+
112,
|
| 683 |
+
84,
|
| 684 |
+
489,
|
| 685 |
+
261
|
| 686 |
+
],
|
| 687 |
+
"page_idx": 4
|
| 688 |
+
},
|
| 689 |
+
{
|
| 690 |
+
"type": "table",
|
| 691 |
+
"img_path": "images/c5082a5211ae767e62e9bc8d791498f50bc40fb9f3e0a0fd07837b58bef4a1e7.jpg",
|
| 692 |
+
"table_caption": [],
|
| 693 |
+
"table_footnote": [],
|
| 694 |
+
"table_body": "<table><tr><td colspan=\"2\">GPU</td><td>KV0</td><td>MHA0</td><td>KV1</td><td>MHA1</td></tr><tr><td>PCIe</td><td>MHA</td><td>X0</td><td>KV0</td><td>X1</td><td>KV1</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>...</td></tr></table>",
|
| 695 |
+
"bbox": [
|
| 696 |
+
121,
|
| 697 |
+
275,
|
| 698 |
+
478,
|
| 699 |
+
306
|
| 700 |
+
],
|
| 701 |
+
"page_idx": 4
|
| 702 |
+
},
|
| 703 |
+
{
|
| 704 |
+
"type": "text",
|
| 705 |
+
"text": "Figure 4: Offloading pipeline for column-wise scheduling with KV cache partial recomputation to maximize throughput.",
|
| 706 |
+
"bbox": [
|
| 707 |
+
112,
|
| 708 |
+
321,
|
| 709 |
+
489,
|
| 710 |
+
363
|
| 711 |
+
],
|
| 712 |
+
"page_idx": 4
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"type": "text",
|
| 716 |
+
"text": "Determining the optimal KV cache split point. In both scheduling methods, the objective is to identify the optimal split point, which defines the division of the KV cache between the portion recomputed on the GPU and the portion transferred from CPU memory. This problem can be formulated as a linear programming problem. The row-by-row schedule can be viewed as a special case of the column-by-column schedule, where activations for recomputing the KV cache are not transferred. We first formulate the problem for the column-by-column schedule and then demonstrate how it simplifies to the row-by-row schedule.",
|
| 717 |
+
"bbox": [
|
| 718 |
+
112,
|
| 719 |
+
381,
|
| 720 |
+
489,
|
| 721 |
+
589
|
| 722 |
+
],
|
| 723 |
+
"page_idx": 4
|
| 724 |
+
},
|
| 725 |
+
{
|
| 726 |
+
"type": "text",
|
| 727 |
+
"text": "Given the current sequence length $s'$ , which is greater than the prompt length $s$ , the activation transferred to the GPU in the $i$ -th layer is represented by $X^i[0:l]$ , where $0 \\leq l \\leq s'$ . The remaining KV cache for the subsequent tokens is denoted by $K^i[l:s']$ and $V^i[l:s']$ . The memory usage of these activations is:",
|
| 728 |
+
"bbox": [
|
| 729 |
+
112,
|
| 730 |
+
590,
|
| 731 |
+
489,
|
| 732 |
+
702
|
| 733 |
+
],
|
| 734 |
+
"page_idx": 4
|
| 735 |
+
},
|
| 736 |
+
{
|
| 737 |
+
"type": "equation",
|
| 738 |
+
"text": "\n$$\n\\begin{array}{l} M _ {X ^ {i} [ 0: l ]} = b \\times l \\times h \\times p, \\\\ M _ {K V ^ {i} [ l: s ^ {\\prime} ]} = 2 \\times b \\times \\left(s ^ {\\prime} - l\\right) \\times h \\times p. \\tag {6} \\\\ \\end{array}\n$$\n",
|
| 739 |
+
"text_format": "latex",
|
| 740 |
+
"bbox": [
|
| 741 |
+
176,
|
| 742 |
+
712,
|
| 743 |
+
485,
|
| 744 |
+
745
|
| 745 |
+
],
|
| 746 |
+
"page_idx": 4
|
| 747 |
+
},
|
| 748 |
+
{
|
| 749 |
+
"type": "text",
|
| 750 |
+
"text": "Recomputing the KV cache for $X^i[0:l]$ requires:",
|
| 751 |
+
"bbox": [
|
| 752 |
+
112,
|
| 753 |
+
753,
|
| 754 |
+
484,
|
| 755 |
+
771
|
| 756 |
+
],
|
| 757 |
+
"page_idx": 4
|
| 758 |
+
},
|
| 759 |
+
{
|
| 760 |
+
"type": "equation",
|
| 761 |
+
"text": "\n$$\n\\begin{array}{l} K ^ {i} [ 0: l ] = X ^ {i} [ 0: l ] \\cdot W _ {K} ^ {i}, \\\\ V ^ {i} [ 0: l ] = X ^ {i} [ 0: l ] \\cdot W _ {V} ^ {i}. \\tag {7} \\\\ \\end{array}\n$$\n",
|
| 762 |
+
"text_format": "latex",
|
| 763 |
+
"bbox": [
|
| 764 |
+
213,
|
| 765 |
+
778,
|
| 766 |
+
485,
|
| 767 |
+
813
|
| 768 |
+
],
|
| 769 |
+
"page_idx": 4
|
| 770 |
+
},
|
| 771 |
+
{
|
| 772 |
+
"type": "text",
|
| 773 |
+
"text": "This recomputation on the GPU requires floating-point operations of",
|
| 774 |
+
"bbox": [
|
| 775 |
+
112,
|
| 776 |
+
821,
|
| 777 |
+
487,
|
| 778 |
+
853
|
| 779 |
+
],
|
| 780 |
+
"page_idx": 4
|
| 781 |
+
},
|
| 782 |
+
{
|
| 783 |
+
"type": "equation",
|
| 784 |
+
"text": "\n$$\nN _ {K V ^ {i} [ 0: l ]} = 4 \\times b \\times l \\times h ^ {2}. \\tag {8}\n$$\n",
|
| 785 |
+
"text_format": "latex",
|
| 786 |
+
"bbox": [
|
| 787 |
+
208,
|
| 788 |
+
863,
|
| 789 |
+
487,
|
| 790 |
+
879
|
| 791 |
+
],
|
| 792 |
+
"page_idx": 4
|
| 793 |
+
},
|
| 794 |
+
{
|
| 795 |
+
"type": "text",
|
| 796 |
+
"text": "Consequently, the recomputation time $t_{gpu}^{i}$ for the KV cache is given by",
|
| 797 |
+
"bbox": [
|
| 798 |
+
112,
|
| 799 |
+
889,
|
| 800 |
+
487,
|
| 801 |
+
921
|
| 802 |
+
],
|
| 803 |
+
"page_idx": 4
|
| 804 |
+
},
|
| 805 |
+
{
|
| 806 |
+
"type": "equation",
|
| 807 |
+
"text": "\n$$\nt _ {r e c o m p} ^ {i} = \\frac {N _ {K V ^ {i} [ 0 : l ]}}{v _ {g p u}}, \\tag {9}\n$$\n",
|
| 808 |
+
"text_format": "latex",
|
| 809 |
+
"bbox": [
|
| 810 |
+
623,
|
| 811 |
+
96,
|
| 812 |
+
882,
|
| 813 |
+
124
|
| 814 |
+
],
|
| 815 |
+
"page_idx": 4
|
| 816 |
+
},
|
| 817 |
+
{
|
| 818 |
+
"type": "text",
|
| 819 |
+
"text": "where $v_{gpu}$ denotes the GPU processing speed. The total time $t^i$ for processing is as follows:",
|
| 820 |
+
"bbox": [
|
| 821 |
+
507,
|
| 822 |
+
131,
|
| 823 |
+
880,
|
| 824 |
+
162
|
| 825 |
+
],
|
| 826 |
+
"page_idx": 4
|
| 827 |
+
},
|
| 828 |
+
{
|
| 829 |
+
"type": "equation",
|
| 830 |
+
"text": "\n$$\nt ^ {i} = \\frac {M _ {X ^ {i} [ 0 : l ]}}{v _ {\\text {c o m}}} + \\max \\left(t _ {\\text {r e c o m p}} ^ {i}, \\frac {M _ {K V ^ {i} [ l : s ^ {\\prime} ]}}{v _ {\\text {c o m}}}\\right), \\tag {10}\n$$\n",
|
| 831 |
+
"text_format": "latex",
|
| 832 |
+
"bbox": [
|
| 833 |
+
532,
|
| 834 |
+
184,
|
| 835 |
+
882,
|
| 836 |
+
212
|
| 837 |
+
],
|
| 838 |
+
"page_idx": 4
|
| 839 |
+
},
|
| 840 |
+
{
|
| 841 |
+
"type": "text",
|
| 842 |
+
"text": "where $v_{com}$ represents the data transmission speed for activations and KV cache.",
|
| 843 |
+
"bbox": [
|
| 844 |
+
507,
|
| 845 |
+
224,
|
| 846 |
+
880,
|
| 847 |
+
254
|
| 848 |
+
],
|
| 849 |
+
"page_idx": 4
|
| 850 |
+
},
|
| 851 |
+
{
|
| 852 |
+
"type": "text",
|
| 853 |
+
"text": "The objective is to determine the optimal $l$ that minimizes this total processing time $t^i$ , which becomes a linear programming problem:",
|
| 854 |
+
"bbox": [
|
| 855 |
+
507,
|
| 856 |
+
256,
|
| 857 |
+
882,
|
| 858 |
+
305
|
| 859 |
+
],
|
| 860 |
+
"page_idx": 4
|
| 861 |
+
},
|
| 862 |
+
{
|
| 863 |
+
"type": "equation",
|
| 864 |
+
"text": "\n$$\n\\min _ {l} t ^ {i} \\tag {11}\n$$\n",
|
| 865 |
+
"text_format": "latex",
|
| 866 |
+
"bbox": [
|
| 867 |
+
579,
|
| 868 |
+
313,
|
| 869 |
+
880,
|
| 870 |
+
336
|
| 871 |
+
],
|
| 872 |
+
"page_idx": 4
|
| 873 |
+
},
|
| 874 |
+
{
|
| 875 |
+
"type": "equation",
|
| 876 |
+
"text": "\n$$\n\\begin{array}{l l} \\text {s . t .} & 0 \\leq l \\leq s \\quad \\forall i \\in \\{1, \\dots , n \\}. \\end{array}\n$$\n",
|
| 877 |
+
"text_format": "latex",
|
| 878 |
+
"bbox": [
|
| 879 |
+
589,
|
| 880 |
+
336,
|
| 881 |
+
806,
|
| 882 |
+
350
|
| 883 |
+
],
|
| 884 |
+
"page_idx": 4
|
| 885 |
+
},
|
| 886 |
+
{
|
| 887 |
+
"type": "text",
|
| 888 |
+
"text": "The optimal split point $l$ depends on the current sequence length $s'$ , which increases during generation and must therefore be determined adaptively. Fortunately, solving this linear programming problem is computationally negligible because there is only one integer variable. If the first term in Eq. (10) is omitted, the problem simplifies to the row-by-row schedule.",
|
| 889 |
+
"bbox": [
|
| 890 |
+
507,
|
| 891 |
+
356,
|
| 892 |
+
882,
|
| 893 |
+
483
|
| 894 |
+
],
|
| 895 |
+
"page_idx": 4
|
| 896 |
+
},
|
| 897 |
+
{
|
| 898 |
+
"type": "text",
|
| 899 |
+
"text": "3.3 Runtime Module",
|
| 900 |
+
"text_level": 1,
|
| 901 |
+
"bbox": [
|
| 902 |
+
507,
|
| 903 |
+
497,
|
| 904 |
+
690,
|
| 905 |
+
511
|
| 906 |
+
],
|
| 907 |
+
"page_idx": 4
|
| 908 |
+
},
|
| 909 |
+
{
|
| 910 |
+
"type": "text",
|
| 911 |
+
"text": "Asynchronous overlapping. To enable concurrent execution of GPU computation and CPU-GPU communication, the runtime module employs a communication parallelism strategy with six processes: weight loading, KV cache loading, activation loading, recomputed activation loading, KV cache storing, and activation storing, as detailed in Appendix A.2. By incorporating double buffering and prefetching techniques, it simultaneously loads weights for the next layer, and retrieves activations for KV cache recomputation and KV cache for the next batch, while storing cache and activations from the previous batch and processing the current batch.",
|
| 912 |
+
"bbox": [
|
| 913 |
+
507,
|
| 914 |
+
518,
|
| 915 |
+
882,
|
| 916 |
+
741
|
| 917 |
+
],
|
| 918 |
+
"page_idx": 4
|
| 919 |
+
},
|
| 920 |
+
{
|
| 921 |
+
"type": "text",
|
| 922 |
+
"text": "Pinned memory. To optimize data transfer, like prior works (Sheng et al., 2023; Yu et al., 2024), we utilize pinned CPU memory for recomputed activation and the weights that are transferred to the GPU. Using pinned memory enables faster and asynchronous transfer, as it avoids the need to page data in and out.",
|
| 923 |
+
"bbox": [
|
| 924 |
+
507,
|
| 925 |
+
744,
|
| 926 |
+
882,
|
| 927 |
+
854
|
| 928 |
+
],
|
| 929 |
+
"page_idx": 4
|
| 930 |
+
},
|
| 931 |
+
{
|
| 932 |
+
"type": "text",
|
| 933 |
+
"text": "Hiding KV cache partial recomputation. If both the KV cache and model weights are offloaded, and the size of the transferred KV cache is smaller than the size of the model weights, a coarse-grained",
|
| 934 |
+
"bbox": [
|
| 935 |
+
507,
|
| 936 |
+
857,
|
| 937 |
+
882,
|
| 938 |
+
921
|
| 939 |
+
],
|
| 940 |
+
"page_idx": 4
|
| 941 |
+
},
|
| 942 |
+
{
|
| 943 |
+
"type": "page_number",
|
| 944 |
+
"text": "19478",
|
| 945 |
+
"bbox": [
|
| 946 |
+
477,
|
| 947 |
+
927,
|
| 948 |
+
524,
|
| 949 |
+
940
|
| 950 |
+
],
|
| 951 |
+
"page_idx": 4
|
| 952 |
+
},
|
| 953 |
+
{
|
| 954 |
+
"type": "text",
|
| 955 |
+
"text": "computation pipeline with KV cache partial recomputation may degrade inference performance. This occurs because recomputation waits until all MHA weights $(W_{Q}, W_{K}, W_{V},$ and $W_{O})$ are fully loaded, as shown in Figure 5(a), which delays the MHA computation. However, KV cache recomputation only requires $W_{K}$ and $W_{V}$ (Eq. (7)), making it unnecessary to wait for the complete weight loading process. To address this, we implement a fine-grained MHA pipeline that prioritizes loading $W_{K}$ and $W_{V}$ first. Once these weights are available, KV cache recomputation can begin immediately. As illustrated in Figure 5(b), $W_{K}$ and $W_{V}$ are used for KV cache partial recomputation, followed by the use of $W_{Q}$ and $W_{O}$ for MHA computation. This approach effectively overlaps KV cache recomputation with weight loading, ensuring that in the worst-case scenario, the method performs no worse than the baseline bottlenecked by weight loading.",
|
| 956 |
+
"bbox": [
|
| 957 |
+
112,
|
| 958 |
+
84,
|
| 959 |
+
492,
|
| 960 |
+
391
|
| 961 |
+
],
|
| 962 |
+
"page_idx": 5
|
| 963 |
+
},
|
| 964 |
+
{
|
| 965 |
+
"type": "image",
|
| 966 |
+
"img_path": "images/f3f7a6c3249b576b87b8f9c6b23ade930e0e965b35b9f945d5ee0890365e4834.jpg",
|
| 967 |
+
"image_caption": [
|
| 968 |
+
"Figure 5: Comparison of offloading pipelines with different levels of granularity in the MHA layer."
|
| 969 |
+
],
|
| 970 |
+
"image_footnote": [],
|
| 971 |
+
"bbox": [
|
| 972 |
+
119,
|
| 973 |
+
403,
|
| 974 |
+
478,
|
| 975 |
+
435
|
| 976 |
+
],
|
| 977 |
+
"page_idx": 5
|
| 978 |
+
},
|
| 979 |
+
{
|
| 980 |
+
"type": "text",
|
| 981 |
+
"text": "(a) Coarse-grained offloading pipeline with delayed KV cache partial recomputation.",
|
| 982 |
+
"bbox": [
|
| 983 |
+
112,
|
| 984 |
+
443,
|
| 985 |
+
485,
|
| 986 |
+
468
|
| 987 |
+
],
|
| 988 |
+
"page_idx": 5
|
| 989 |
+
},
|
| 990 |
+
{
|
| 991 |
+
"type": "image",
|
| 992 |
+
"img_path": "images/f1dc9edf22eb46c39c56bd877c5985de8b96875ac2641b2be22e613565bc6651.jpg",
|
| 993 |
+
"image_caption": [],
|
| 994 |
+
"image_footnote": [],
|
| 995 |
+
"bbox": [
|
| 996 |
+
121,
|
| 997 |
+
470,
|
| 998 |
+
478,
|
| 999 |
+
502
|
| 1000 |
+
],
|
| 1001 |
+
"page_idx": 5
|
| 1002 |
+
},
|
| 1003 |
+
{
|
| 1004 |
+
"type": "text",
|
| 1005 |
+
"text": "(b) Fine-grained offloading pipeline overlapping KV cache recomputation with weights loading.",
|
| 1006 |
+
"bbox": [
|
| 1007 |
+
112,
|
| 1008 |
+
510,
|
| 1009 |
+
485,
|
| 1010 |
+
536
|
| 1011 |
+
],
|
| 1012 |
+
"page_idx": 5
|
| 1013 |
+
},
|
| 1014 |
+
{
|
| 1015 |
+
"type": "text",
|
| 1016 |
+
"text": "4 Experiments",
|
| 1017 |
+
"text_level": 1,
|
| 1018 |
+
"bbox": [
|
| 1019 |
+
114,
|
| 1020 |
+
605,
|
| 1021 |
+
258,
|
| 1022 |
+
620
|
| 1023 |
+
],
|
| 1024 |
+
"page_idx": 5
|
| 1025 |
+
},
|
| 1026 |
+
{
|
| 1027 |
+
"type": "text",
|
| 1028 |
+
"text": "Hardware. In our experiments, we utilize an NVIDIA A100 GPU with 40 GB of memory, connected to the CPU through a PCIe $4.0 \\times 16$ interface, which provides a bandwidth of 32 GB/s. The CPU is an AMD EPYC processor with 64 cores, operating at 2.6 GHz. Our method and implementation automatically adapt to the underlying hardware, which allows for flexible deployment across diverse system architectures.",
|
| 1029 |
+
"bbox": [
|
| 1030 |
+
112,
|
| 1031 |
+
631,
|
| 1032 |
+
489,
|
| 1033 |
+
774
|
| 1034 |
+
],
|
| 1035 |
+
"page_idx": 5
|
| 1036 |
+
},
|
| 1037 |
+
{
|
| 1038 |
+
"type": "text",
|
| 1039 |
+
"text": "Model. We evaluate KVPR using OPT models (Zhang et al., 2022) with parameter sizes ranging from 6.7B to 30B. While our experiments focus on OPT models, the recomputation technique presented in this work is compatible with other LLM architectures, such as LLaMa (Touvron et al., 2023) and GPT-3 (Brown et al., 2020), due to their similar attention mechanisms (Vaswani et al., 2017).",
|
| 1040 |
+
"bbox": [
|
| 1041 |
+
112,
|
| 1042 |
+
776,
|
| 1043 |
+
487,
|
| 1044 |
+
903
|
| 1045 |
+
],
|
| 1046 |
+
"page_idx": 5
|
| 1047 |
+
},
|
| 1048 |
+
{
|
| 1049 |
+
"type": "text",
|
| 1050 |
+
"text": "Workload. We evaluate KVPR on two types",
|
| 1051 |
+
"bbox": [
|
| 1052 |
+
112,
|
| 1053 |
+
904,
|
| 1054 |
+
485,
|
| 1055 |
+
921
|
| 1056 |
+
],
|
| 1057 |
+
"page_idx": 5
|
| 1058 |
+
},
|
| 1059 |
+
{
|
| 1060 |
+
"type": "text",
|
| 1061 |
+
"text": "of workloads: latency-oriented and throughput-oriented. In the latency-oriented workload, the model weights are retained in GPU memory to avoid the costly repeated loading. Due to the limited memory size of a GPU, experiments are conducted using OPT-6.7B and OPT-13B. In the throughput-oriented workload, model weights are offloaded to the CPU after computation to free more GPU memory for handling larger batches. This setup is evaluated using OPT-6.7B, OPT-13B, and OPT-30B.",
|
| 1062 |
+
"bbox": [
|
| 1063 |
+
505,
|
| 1064 |
+
84,
|
| 1065 |
+
884,
|
| 1066 |
+
260
|
| 1067 |
+
],
|
| 1068 |
+
"page_idx": 5
|
| 1069 |
+
},
|
| 1070 |
+
{
|
| 1071 |
+
"type": "text",
|
| 1072 |
+
"text": "To provide accurate comparisons, we use the same datasets as those in FlexGen (Sheng et al., 2023) with prompts uniformly padded to the same length, with models configured to generate 32 or 128 tokens per prompt. To evaluate performance across different input scenarios, our evaluation uses prompt lengths of 256, 512, and 1024 tokens. Performance metrics include decoding latency (time taken to generate tokens) for latency-oriented workloads and decoding throughput (tokens generated per second) for throughput-oriented workloads, as KVPR does not impact prefilling performance. We report an average decoding latency and throughput across five test runs, respectively.",
|
| 1073 |
+
"bbox": [
|
| 1074 |
+
507,
|
| 1075 |
+
261,
|
| 1076 |
+
884,
|
| 1077 |
+
486
|
| 1078 |
+
],
|
| 1079 |
+
"page_idx": 5
|
| 1080 |
+
},
|
| 1081 |
+
{
|
| 1082 |
+
"type": "text",
|
| 1083 |
+
"text": "Baseline. In our experiments, we use DeepSpeed Inference (Aminabadi et al., 2022), Hugging Face Accelerate (Gugger et al., 2022) as the baseline for latency-oriented workload experiments, as Hugging Face Transformers library currently supports KV cache offloading to CPU memory while still retaining the model weights in GPU memory. We use FlexGen (Sheng et al., 2023) as the baseline for throughput-oriented workload experiments, as it supports column-by-column schedule by offloading both model weights and KV cache to the CPU.",
|
| 1084 |
+
"bbox": [
|
| 1085 |
+
507,
|
| 1086 |
+
487,
|
| 1087 |
+
882,
|
| 1088 |
+
663
|
| 1089 |
+
],
|
| 1090 |
+
"page_idx": 5
|
| 1091 |
+
},
|
| 1092 |
+
{
|
| 1093 |
+
"type": "text",
|
| 1094 |
+
"text": "Implementation. KVPR is implemented on top of Hugging Face Transformers (v4.46.1) (Wolf et al., 2020) and FlexGen (Sheng et al., 2023) frameworks to ensure fair comparison with baselines. In the Transformers implementation, we utilize double buffering in GPU memory to overlap KV cache transfer across decoder layers. For both the Transformers and FlexGen implementations, we utilize CUDA streams to enable asynchronous overlapping as described in Algorithm 1.",
|
| 1095 |
+
"bbox": [
|
| 1096 |
+
507,
|
| 1097 |
+
664,
|
| 1098 |
+
882,
|
| 1099 |
+
825
|
| 1100 |
+
],
|
| 1101 |
+
"page_idx": 5
|
| 1102 |
+
},
|
| 1103 |
+
{
|
| 1104 |
+
"type": "text",
|
| 1105 |
+
"text": "4.1 Latency-oriented Experiments",
|
| 1106 |
+
"text_level": 1,
|
| 1107 |
+
"bbox": [
|
| 1108 |
+
507,
|
| 1109 |
+
835,
|
| 1110 |
+
794,
|
| 1111 |
+
851
|
| 1112 |
+
],
|
| 1113 |
+
"page_idx": 5
|
| 1114 |
+
},
|
| 1115 |
+
{
|
| 1116 |
+
"type": "text",
|
| 1117 |
+
"text": "We evaluate the decoding latency required to complete a single batch for settings of different sequence lengths. Figure 7 shows that KVPR consistently outperforms the baselines, DeepSpeed Infer",
|
| 1118 |
+
"bbox": [
|
| 1119 |
+
507,
|
| 1120 |
+
857,
|
| 1121 |
+
882,
|
| 1122 |
+
921
|
| 1123 |
+
],
|
| 1124 |
+
"page_idx": 5
|
| 1125 |
+
},
|
| 1126 |
+
{
|
| 1127 |
+
"type": "page_number",
|
| 1128 |
+
"text": "19479",
|
| 1129 |
+
"bbox": [
|
| 1130 |
+
477,
|
| 1131 |
+
927,
|
| 1132 |
+
524,
|
| 1133 |
+
940
|
| 1134 |
+
],
|
| 1135 |
+
"page_idx": 5
|
| 1136 |
+
},
|
| 1137 |
+
{
|
| 1138 |
+
"type": "image",
|
| 1139 |
+
"img_path": "images/f452c8e38bf4a50905b530dbc0b082205c246541b9f09339def0cb6672ff2303.jpg",
|
| 1140 |
+
"image_caption": [],
|
| 1141 |
+
"image_footnote": [],
|
| 1142 |
+
"bbox": [
|
| 1143 |
+
129,
|
| 1144 |
+
85,
|
| 1145 |
+
381,
|
| 1146 |
+
221
|
| 1147 |
+
],
|
| 1148 |
+
"page_idx": 6
|
| 1149 |
+
},
|
| 1150 |
+
{
|
| 1151 |
+
"type": "image",
|
| 1152 |
+
"img_path": "images/ea88239ff7f8baf7a81be1b8cc359c5e2b10ab3af3649c84b14c7f05ed72b996.jpg",
|
| 1153 |
+
"image_caption": [],
|
| 1154 |
+
"image_footnote": [],
|
| 1155 |
+
"bbox": [
|
| 1156 |
+
389,
|
| 1157 |
+
86,
|
| 1158 |
+
613,
|
| 1159 |
+
221
|
| 1160 |
+
],
|
| 1161 |
+
"page_idx": 6
|
| 1162 |
+
},
|
| 1163 |
+
{
|
| 1164 |
+
"type": "image",
|
| 1165 |
+
"img_path": "images/bd982a708f62ff0bb9b365d11a9c81f85905e13467cfabffeb19b6535549156e.jpg",
|
| 1166 |
+
"image_caption": [],
|
| 1167 |
+
"image_footnote": [],
|
| 1168 |
+
"bbox": [
|
| 1169 |
+
628,
|
| 1170 |
+
86,
|
| 1171 |
+
875,
|
| 1172 |
+
221
|
| 1173 |
+
],
|
| 1174 |
+
"page_idx": 6
|
| 1175 |
+
},
|
| 1176 |
+
{
|
| 1177 |
+
"type": "image",
|
| 1178 |
+
"img_path": "images/35b5944b288a56154109ef089768703e9ad7c10dd43b09423411b8f196bb92db.jpg",
|
| 1179 |
+
"image_caption": [
|
| 1180 |
+
"Figure 6: Throughput comparison for various models and configurations."
|
| 1181 |
+
],
|
| 1182 |
+
"image_footnote": [],
|
| 1183 |
+
"bbox": [
|
| 1184 |
+
127,
|
| 1185 |
+
227,
|
| 1186 |
+
381,
|
| 1187 |
+
355
|
| 1188 |
+
],
|
| 1189 |
+
"page_idx": 6
|
| 1190 |
+
},
|
| 1191 |
+
{
|
| 1192 |
+
"type": "image",
|
| 1193 |
+
"img_path": "images/02a24a2408f73c42a5bbb8336fc9483bd0b35b3cbd38f22c07fa77f4fcb723e9.jpg",
|
| 1194 |
+
"image_caption": [],
|
| 1195 |
+
"image_footnote": [],
|
| 1196 |
+
"bbox": [
|
| 1197 |
+
391,
|
| 1198 |
+
240,
|
| 1199 |
+
613,
|
| 1200 |
+
355
|
| 1201 |
+
],
|
| 1202 |
+
"page_idx": 6
|
| 1203 |
+
},
|
| 1204 |
+
{
|
| 1205 |
+
"type": "image",
|
| 1206 |
+
"img_path": "images/df4001ad33849e661f041d73b33d18f32dcaa04f1e04a5868ec4829942ebb7fe.jpg",
|
| 1207 |
+
"image_caption": [],
|
| 1208 |
+
"image_footnote": [],
|
| 1209 |
+
"bbox": [
|
| 1210 |
+
628,
|
| 1211 |
+
237,
|
| 1212 |
+
875,
|
| 1213 |
+
355
|
| 1214 |
+
],
|
| 1215 |
+
"page_idx": 6
|
| 1216 |
+
},
|
| 1217 |
+
{
|
| 1218 |
+
"type": "text",
|
| 1219 |
+
"text": "ence and Hugging Face Accelerate, for both OPT-6.7B and OPT-13B. The experimental results show that KVPR reduces decoding latency, especially at longer generation lengths. For instance, OPT 6.7B at a prompt length of 128 with 128 tokens generated, the latency is reduced by approximately $35.8\\%$ compared to Hugging Face Accelerate. Detailed experiential results including KV cache size, GPU peak memory usage, and optimal recomputation split points over the generation process are provided in Appendix A.3 and A.4.",
|
| 1220 |
+
"bbox": [
|
| 1221 |
+
112,
|
| 1222 |
+
409,
|
| 1223 |
+
489,
|
| 1224 |
+
586
|
| 1225 |
+
],
|
| 1226 |
+
"page_idx": 6
|
| 1227 |
+
},
|
| 1228 |
+
{
|
| 1229 |
+
"type": "image",
|
| 1230 |
+
"img_path": "images/161530f15056ddf5a57a92f83238826e166c095246baf2861733ae9edbb9c3cd.jpg",
|
| 1231 |
+
"image_caption": [
|
| 1232 |
+
"Figure 7: Decoding latency for a single batch of size 64 across different sequence lengths."
|
| 1233 |
+
],
|
| 1234 |
+
"image_footnote": [],
|
| 1235 |
+
"bbox": [
|
| 1236 |
+
129,
|
| 1237 |
+
599,
|
| 1238 |
+
478,
|
| 1239 |
+
753
|
| 1240 |
+
],
|
| 1241 |
+
"page_idx": 6
|
| 1242 |
+
},
|
| 1243 |
+
{
|
| 1244 |
+
"type": "text",
|
| 1245 |
+
"text": "4.2 Throughput-oriented Experiments",
|
| 1246 |
+
"text_level": 1,
|
| 1247 |
+
"bbox": [
|
| 1248 |
+
112,
|
| 1249 |
+
820,
|
| 1250 |
+
431,
|
| 1251 |
+
835
|
| 1252 |
+
],
|
| 1253 |
+
"page_idx": 6
|
| 1254 |
+
},
|
| 1255 |
+
{
|
| 1256 |
+
"type": "text",
|
| 1257 |
+
"text": "We also evaluate throughput performance during the decoding stage, as KVPR does not affect the prefilling stage. To maximize throughput, we set the effective batch size to be 32 by 8, meaning each layer computes on 8 batches of size 32 se",
|
| 1258 |
+
"bbox": [
|
| 1259 |
+
112,
|
| 1260 |
+
841,
|
| 1261 |
+
489,
|
| 1262 |
+
921
|
| 1263 |
+
],
|
| 1264 |
+
"page_idx": 6
|
| 1265 |
+
},
|
| 1266 |
+
{
|
| 1267 |
+
"type": "text",
|
| 1268 |
+
"text": "sequentially before moving to the next layer. The first row of Figure 6 shows the results, demonstrating that KVPR consistently outperforms FlexGen under settings of all sequence lengths for different models. It achieves up to $15.1\\%$ , $46.2\\%$ , and $29.0\\%$ speedup in throughput for OPT-6.7B, OPT-13B, and OPT-30B, respectively. Additional experimental results on a low-end GPU system are provided in Appendix A.5.",
|
| 1269 |
+
"bbox": [
|
| 1270 |
+
507,
|
| 1271 |
+
409,
|
| 1272 |
+
884,
|
| 1273 |
+
552
|
| 1274 |
+
],
|
| 1275 |
+
"page_idx": 6
|
| 1276 |
+
},
|
| 1277 |
+
{
|
| 1278 |
+
"type": "text",
|
| 1279 |
+
"text": "We also compare KVPR with FlexGen for varying batch sizes from 1 to 48 with a fixed prompt length of 1,024 and a generation length of 32, as shown in the second row of Figure 6. KVPR consistently outperforms FlexGen across all batch sizes. As the KV cache grows larger, KVPR shows greater performance benefits due to reduced KV cache transfer over the PCIe bus.",
|
| 1280 |
+
"bbox": [
|
| 1281 |
+
507,
|
| 1282 |
+
558,
|
| 1283 |
+
882,
|
| 1284 |
+
686
|
| 1285 |
+
],
|
| 1286 |
+
"page_idx": 6
|
| 1287 |
+
},
|
| 1288 |
+
{
|
| 1289 |
+
"type": "text",
|
| 1290 |
+
"text": "4.3 GPU Utilization",
|
| 1291 |
+
"text_level": 1,
|
| 1292 |
+
"bbox": [
|
| 1293 |
+
507,
|
| 1294 |
+
714,
|
| 1295 |
+
684,
|
| 1296 |
+
728
|
| 1297 |
+
],
|
| 1298 |
+
"page_idx": 6
|
| 1299 |
+
},
|
| 1300 |
+
{
|
| 1301 |
+
"type": "text",
|
| 1302 |
+
"text": "To evaluate the efficiency improvement, we analyze the temporal resource utilization of KVPR and FlexGen as shown in Figure 8. At first in the prefilling stage, both methods reach full GPU utilization since the prefilling stage is compute-bound. However, in the decoding stage, in contrast to FlexGen, KVPR enhances GPU utilization, increasing it from $85\\%$ to $99\\%$ on average by overlapping GPU computations with CPU-GPU data transfer, while maintaining the same peak memory usage indicated by the black lines.",
|
| 1303 |
+
"bbox": [
|
| 1304 |
+
507,
|
| 1305 |
+
744,
|
| 1306 |
+
884,
|
| 1307 |
+
921
|
| 1308 |
+
],
|
| 1309 |
+
"page_idx": 6
|
| 1310 |
+
},
|
| 1311 |
+
{
|
| 1312 |
+
"type": "page_number",
|
| 1313 |
+
"text": "19480",
|
| 1314 |
+
"bbox": [
|
| 1315 |
+
477,
|
| 1316 |
+
927,
|
| 1317 |
+
524,
|
| 1318 |
+
940
|
| 1319 |
+
],
|
| 1320 |
+
"page_idx": 6
|
| 1321 |
+
},
|
| 1322 |
+
{
|
| 1323 |
+
"type": "image",
|
| 1324 |
+
"img_path": "images/5b0320ad0114726a41082584dd2fdd95704eaf01a40330bd62b8ed5224ec5914.jpg",
|
| 1325 |
+
"image_caption": [
|
| 1326 |
+
"Figure 8: Computation and memory resource usage of KVPR and FlexGen during decoding stage."
|
| 1327 |
+
],
|
| 1328 |
+
"image_footnote": [],
|
| 1329 |
+
"bbox": [
|
| 1330 |
+
132,
|
| 1331 |
+
80,
|
| 1332 |
+
473,
|
| 1333 |
+
211
|
| 1334 |
+
],
|
| 1335 |
+
"page_idx": 7
|
| 1336 |
+
},
|
| 1337 |
+
{
|
| 1338 |
+
"type": "text",
|
| 1339 |
+
"text": "4.4 KV Cache Compression",
|
| 1340 |
+
"text_level": 1,
|
| 1341 |
+
"bbox": [
|
| 1342 |
+
112,
|
| 1343 |
+
280,
|
| 1344 |
+
349,
|
| 1345 |
+
296
|
| 1346 |
+
],
|
| 1347 |
+
"page_idx": 7
|
| 1348 |
+
},
|
| 1349 |
+
{
|
| 1350 |
+
"type": "text",
|
| 1351 |
+
"text": "We apply group-wise 4-bit quantization to compress the KV cache, which has been shown to have minimal impact on model accuracy (Sheng et al., 2023). Figure 9 shows that applying compression reduces the amount of data transferred to the GPU, leading to further improvements in decoding throughput. These results showcase the compatibility of KVPR with KV cache compression and its potential to achieve additional performance gains by alleviating PCIe bandwidth bottlenecks.",
|
| 1352 |
+
"bbox": [
|
| 1353 |
+
112,
|
| 1354 |
+
300,
|
| 1355 |
+
489,
|
| 1356 |
+
462
|
| 1357 |
+
],
|
| 1358 |
+
"page_idx": 7
|
| 1359 |
+
},
|
| 1360 |
+
{
|
| 1361 |
+
"type": "image",
|
| 1362 |
+
"img_path": "images/fc3acf2422131e64d90e8b1d83334a36d9abce7b23a4aa02e78292391ee9d6d9.jpg",
|
| 1363 |
+
"image_caption": [
|
| 1364 |
+
"Figure 9: Decoding throughput improvement with KV cache compression enabled on OPT-13B model."
|
| 1365 |
+
],
|
| 1366 |
+
"image_footnote": [],
|
| 1367 |
+
"bbox": [
|
| 1368 |
+
137,
|
| 1369 |
+
478,
|
| 1370 |
+
470,
|
| 1371 |
+
620
|
| 1372 |
+
],
|
| 1373 |
+
"page_idx": 7
|
| 1374 |
+
},
|
| 1375 |
+
{
|
| 1376 |
+
"type": "text",
|
| 1377 |
+
"text": "4.5 Ablation Study",
|
| 1378 |
+
"text_level": 1,
|
| 1379 |
+
"bbox": [
|
| 1380 |
+
112,
|
| 1381 |
+
690,
|
| 1382 |
+
280,
|
| 1383 |
+
706
|
| 1384 |
+
],
|
| 1385 |
+
"page_idx": 7
|
| 1386 |
+
},
|
| 1387 |
+
{
|
| 1388 |
+
"type": "text",
|
| 1389 |
+
"text": "Hiding KV cache partial recomputation. To evaluate the effectiveness of the fine-grained offloading pipeline that overlaps KV cache recomputation with weight loading, we conduct experiments using the OPT-6.7B model. In this ablation, we use a small KV cache size to ensure that MHA weights always arrive at the GPU later than the KV cache. Table 2 presents decoding latency across varying smaller batch sizes, comparing three configurations: FlexGen, KVPR without hiding KV cache recomputation, and KVPR with hiding. When the batch size is 1 and the KV cache size is the smallest, FlexGen can outperform KVPR without hiding. By",
|
| 1390 |
+
"bbox": [
|
| 1391 |
+
112,
|
| 1392 |
+
711,
|
| 1393 |
+
489,
|
| 1394 |
+
921
|
| 1395 |
+
],
|
| 1396 |
+
"page_idx": 7
|
| 1397 |
+
},
|
| 1398 |
+
{
|
| 1399 |
+
"type": "text",
|
| 1400 |
+
"text": "overlapping the transfer of MHA weights with KV cache recomputation, KVPR ensures performance that is no worse than FlexGen under this scenario, particularly when weight loading is the primary bottleneck. This result shows that KVPR works well for both small and large batch size settings, thereby providing a unified approach to improve decoding performance.",
|
| 1401 |
+
"bbox": [
|
| 1402 |
+
507,
|
| 1403 |
+
84,
|
| 1404 |
+
884,
|
| 1405 |
+
212
|
| 1406 |
+
],
|
| 1407 |
+
"page_idx": 7
|
| 1408 |
+
},
|
| 1409 |
+
{
|
| 1410 |
+
"type": "table",
|
| 1411 |
+
"img_path": "images/929bfe3a7c6f65069377e839fcf2aef08abdea5a39a3daa01baa9af9fdaa5d4c.jpg",
|
| 1412 |
+
"table_caption": [],
|
| 1413 |
+
"table_footnote": [],
|
| 1414 |
+
"table_body": "<table><tr><td>Batch size</td><td>1</td><td>2</td><td>4</td><td>8</td><td>16</td><td>32</td></tr><tr><td>KV cache (MB)</td><td>3</td><td>6</td><td>12</td><td>24</td><td>48</td><td>64</td></tr><tr><td>FlexGen</td><td>1.761</td><td>3.488</td><td>6.646</td><td>12.826</td><td>23.795</td><td>41.210</td></tr><tr><td>KVPR (w/o. hiding KV recomputation)</td><td>1.749</td><td>3.461</td><td>6.766</td><td>12.930</td><td>23.613</td><td>43.462</td></tr><tr><td>KVPR (w. hiding KV recomputation)</td><td>1.774</td><td>3.586</td><td>6.696</td><td>12.986</td><td>24.557</td><td>43.945</td></tr></table>",
|
| 1415 |
+
"bbox": [
|
| 1416 |
+
510,
|
| 1417 |
+
223,
|
| 1418 |
+
884,
|
| 1419 |
+
302
|
| 1420 |
+
],
|
| 1421 |
+
"page_idx": 7
|
| 1422 |
+
},
|
| 1423 |
+
{
|
| 1424 |
+
"type": "text",
|
| 1425 |
+
"text": "Table 2: OPT-6.7B model with prompt and generation lengths of 256 and 64, respectively. Each MHA block $(W_{Q}, W_{K}, W_{V},$ and $W_{O})$ requires 128 MB of memory.",
|
| 1426 |
+
"bbox": [
|
| 1427 |
+
507,
|
| 1428 |
+
310,
|
| 1429 |
+
882,
|
| 1430 |
+
355
|
| 1431 |
+
],
|
| 1432 |
+
"page_idx": 7
|
| 1433 |
+
},
|
| 1434 |
+
{
|
| 1435 |
+
"type": "text",
|
| 1436 |
+
"text": "Runtime breakdown. Figure 10 presents the runtime breakdown of an MHA block in KVPR and FlexGen during the decoding stage. KVPR achieves a substantial reduction in KV cache transfer time, decreasing it from $58\\%$ to $38\\%$ , with activation transfer contributing only $8\\%$ of the total runtime. By recomputing the partial KV cache from the transferred activations, GPU computation time increases from $2.3\\%$ to $13.3\\%$ . This demonstrates that KVPR effectively overlaps GPU computation with CPU-GPU communication, substantially reducing the data transfer volume from CPU to GPU and alleviating the PCIe bottleneck that limits LLM inference performance.",
|
| 1437 |
+
"bbox": [
|
| 1438 |
+
507,
|
| 1439 |
+
369,
|
| 1440 |
+
882,
|
| 1441 |
+
595
|
| 1442 |
+
],
|
| 1443 |
+
"page_idx": 7
|
| 1444 |
+
},
|
| 1445 |
+
{
|
| 1446 |
+
"type": "image",
|
| 1447 |
+
"img_path": "images/7866bb2b289a8e7d98ecbf6c229dcba9e790982d889cf2c958752dcaee43c9a7.jpg",
|
| 1448 |
+
"image_caption": [
|
| 1449 |
+
"Figure 10: Runtime breakdown of KVPR and FlexGen."
|
| 1450 |
+
],
|
| 1451 |
+
"image_footnote": [],
|
| 1452 |
+
"bbox": [
|
| 1453 |
+
519,
|
| 1454 |
+
604,
|
| 1455 |
+
873,
|
| 1456 |
+
714
|
| 1457 |
+
],
|
| 1458 |
+
"page_idx": 7
|
| 1459 |
+
},
|
| 1460 |
+
{
|
| 1461 |
+
"type": "text",
|
| 1462 |
+
"text": "5 Related Works",
|
| 1463 |
+
"text_level": 1,
|
| 1464 |
+
"bbox": [
|
| 1465 |
+
507,
|
| 1466 |
+
766,
|
| 1467 |
+
672,
|
| 1468 |
+
782
|
| 1469 |
+
],
|
| 1470 |
+
"page_idx": 7
|
| 1471 |
+
},
|
| 1472 |
+
{
|
| 1473 |
+
"type": "text",
|
| 1474 |
+
"text": "To address the memory demands of LLMs in resource-constrained settings, offloading techniques aim to minimize the latency of data transfer between CPUs and GPUs. FlexGen (Sheng et al., 2023) proposes to offload weights, activations, and KV cache to CPU memory or external storage and maximizes throughput for larger batch sizes by formulating the optimization as a graph traversal",
|
| 1475 |
+
"bbox": [
|
| 1476 |
+
507,
|
| 1477 |
+
791,
|
| 1478 |
+
882,
|
| 1479 |
+
921
|
| 1480 |
+
],
|
| 1481 |
+
"page_idx": 7
|
| 1482 |
+
},
|
| 1483 |
+
{
|
| 1484 |
+
"type": "page_number",
|
| 1485 |
+
"text": "19481",
|
| 1486 |
+
"bbox": [
|
| 1487 |
+
477,
|
| 1488 |
+
927,
|
| 1489 |
+
522,
|
| 1490 |
+
940
|
| 1491 |
+
],
|
| 1492 |
+
"page_idx": 7
|
| 1493 |
+
},
|
| 1494 |
+
{
|
| 1495 |
+
"type": "text",
|
| 1496 |
+
"text": "problem. HeteGen (Zhao et al., 2024a) uses the CPU for partial computation on offloaded weights while transferring the remaining workload to the GPU. TwinPilots (Yu et al., 2024) further optimizes workload balancing between the CPU and GPU at the operator level. FastDecode (He and Zhai, 2024) reduces KV cache data movement by offloading the KV cache and attention computation entirely to the CPU. Park and Egger and Neo (Jiang et al., 2024) overlap GPU linear projection computations with CPU-based attention computations across multiple batches to improve resource utilization.",
|
| 1497 |
+
"bbox": [
|
| 1498 |
+
110,
|
| 1499 |
+
84,
|
| 1500 |
+
487,
|
| 1501 |
+
275
|
| 1502 |
+
],
|
| 1503 |
+
"page_idx": 8
|
| 1504 |
+
},
|
| 1505 |
+
{
|
| 1506 |
+
"type": "text",
|
| 1507 |
+
"text": "ALISA (Zhao et al., 2024b) compresses the KV cache based on sparsity and offloads KV cache exceeding GPU memory capacity. When loading the KV cache to the GPU, ALISA recomputes a portion of the KV cache first and then transfers the remainder, where we propose overlapping the recomputation and transfer by adaptively determining the optimal split point. Furthermore, ALISA addresses only the row-by-row schedule, while KVPR extends to the column-by-column schedule. KVPR is orthogonal to CPU-assisted and KV cache compression approaches, making it compatible for integration with these techniques to further improve overall system performance. As shown in the additional experiments provided in Appendix A.7, we demonstrate that the CPU can become a bottleneck in certain distributed system configurations. In contrast, KVPR optimizes GPU utilization and data transfer efficiency without relying on additional CPU resources or approximations of the KV cache.",
|
| 1508 |
+
"bbox": [
|
| 1509 |
+
115,
|
| 1510 |
+
278,
|
| 1511 |
+
489,
|
| 1512 |
+
600
|
| 1513 |
+
],
|
| 1514 |
+
"page_idx": 8
|
| 1515 |
+
},
|
| 1516 |
+
{
|
| 1517 |
+
"type": "text",
|
| 1518 |
+
"text": "6 Conclusion",
|
| 1519 |
+
"text_level": 1,
|
| 1520 |
+
"bbox": [
|
| 1521 |
+
112,
|
| 1522 |
+
613,
|
| 1523 |
+
247,
|
| 1524 |
+
627
|
| 1525 |
+
],
|
| 1526 |
+
"page_idx": 8
|
| 1527 |
+
},
|
| 1528 |
+
{
|
| 1529 |
+
"type": "text",
|
| 1530 |
+
"text": "In this paper, we introduce KVPR, an efficient CPU-GPU I/O-aware LLM inference method designed to accelerate KV cache loading. KVPR minimizes the data transfer between the CPU and GPU by leveraging KV cache partial recomputation. By overlapping this recomputation with data transmission, KVPR significantly reduces idle GPU time and enhances overall inference performance. Future work could extend our method to tolerate KV cache loading from remote network storage or scale to large multi-GPU infrastructure, further enhancing its applicability and performance in diverse deployment scenarios.",
|
| 1531 |
+
"bbox": [
|
| 1532 |
+
110,
|
| 1533 |
+
640,
|
| 1534 |
+
489,
|
| 1535 |
+
848
|
| 1536 |
+
],
|
| 1537 |
+
"page_idx": 8
|
| 1538 |
+
},
|
| 1539 |
+
{
|
| 1540 |
+
"type": "text",
|
| 1541 |
+
"text": "7 Limitations",
|
| 1542 |
+
"text_level": 1,
|
| 1543 |
+
"bbox": [
|
| 1544 |
+
112,
|
| 1545 |
+
862,
|
| 1546 |
+
250,
|
| 1547 |
+
878
|
| 1548 |
+
],
|
| 1549 |
+
"page_idx": 8
|
| 1550 |
+
},
|
| 1551 |
+
{
|
| 1552 |
+
"type": "text",
|
| 1553 |
+
"text": "Our study represents an important step towards optimizing the efficiency of LLM inference by",
|
| 1554 |
+
"bbox": [
|
| 1555 |
+
112,
|
| 1556 |
+
889,
|
| 1557 |
+
487,
|
| 1558 |
+
921
|
| 1559 |
+
],
|
| 1560 |
+
"page_idx": 8
|
| 1561 |
+
},
|
| 1562 |
+
{
|
| 1563 |
+
"type": "text",
|
| 1564 |
+
"text": "leveraging KV cache partial recomputation. However, KVPR has certain limitations that suggest avenues for future research. First, our methodology is currently limited to single-GPU and data-parallel multi-GPU inference. It does not yet extend to advanced distributed systems, such as model or tensor parallelism. Expanding this approach to these paradigms could enable support for larger model sizes. Second, while we address PCIe bandwidth bottlenecks in CPU-GPU communication, we do not consider scenarios where the KV cache is loaded from disk or network storage. Nevertheless, KVPR could potentially be adapted to accelerate the prefilling stage in such setups. Third, the current implementation performs system profiling only at the start of inference, assuming static hardware conditions throughout the process. Incorporating dynamic profiling and runtime adaptive optimization could enhance the robustness and efficiency of the approach, particularly in heterogeneous or multi-tenant environments.",
|
| 1565 |
+
"bbox": [
|
| 1566 |
+
507,
|
| 1567 |
+
84,
|
| 1568 |
+
884,
|
| 1569 |
+
420
|
| 1570 |
+
],
|
| 1571 |
+
"page_idx": 8
|
| 1572 |
+
},
|
| 1573 |
+
{
|
| 1574 |
+
"type": "text",
|
| 1575 |
+
"text": "8 Acknowledgment",
|
| 1576 |
+
"text_level": 1,
|
| 1577 |
+
"bbox": [
|
| 1578 |
+
507,
|
| 1579 |
+
436,
|
| 1580 |
+
694,
|
| 1581 |
+
451
|
| 1582 |
+
],
|
| 1583 |
+
"page_idx": 8
|
| 1584 |
+
},
|
| 1585 |
+
{
|
| 1586 |
+
"type": "text",
|
| 1587 |
+
"text": "We sincerely thank all the reviewers for their time and constructive comments. This material is based upon work supported by NSF award number 2224319, REAL@USC-Meta center, and VMware gift. The views, opinions, and/or findings expressed are those of the author(s) and should not be interpreted as representing the official views or policies of the U.S. Government.",
|
| 1588 |
+
"bbox": [
|
| 1589 |
+
507,
|
| 1590 |
+
463,
|
| 1591 |
+
882,
|
| 1592 |
+
592
|
| 1593 |
+
],
|
| 1594 |
+
"page_idx": 8
|
| 1595 |
+
},
|
| 1596 |
+
{
|
| 1597 |
+
"type": "text",
|
| 1598 |
+
"text": "References",
|
| 1599 |
+
"text_level": 1,
|
| 1600 |
+
"bbox": [
|
| 1601 |
+
510,
|
| 1602 |
+
621,
|
| 1603 |
+
608,
|
| 1604 |
+
636
|
| 1605 |
+
],
|
| 1606 |
+
"page_idx": 8
|
| 1607 |
+
},
|
| 1608 |
+
{
|
| 1609 |
+
"type": "text",
|
| 1610 |
+
"text": "Reza Yazdani Aminabadi, Samyam Rajbhandari, Ammar Ahmad Awan, Cheng Li, Du Li, Elton Zheng, Olatunjri Ruwase, Shaden Smith, Minjia Zhang, Jeff Rasley, et al. 2022. Deepspeed-inference: enabling efficient inference of transformer models at unprecedented scale. In SC22: International Conference for High Performance Computing, Networking, Storage and Analysis, pages 1-15. IEEE.",
|
| 1611 |
+
"bbox": [
|
| 1612 |
+
510,
|
| 1613 |
+
645,
|
| 1614 |
+
884,
|
| 1615 |
+
751
|
| 1616 |
+
],
|
| 1617 |
+
"page_idx": 8
|
| 1618 |
+
},
|
| 1619 |
+
{
|
| 1620 |
+
"type": "text",
|
| 1621 |
+
"text": "Zhihao Bai, Zhen Zhang, Yibo Zhu, and Xin Jin. 2020. PipeSwitch: Fast pipelined context switching for deep learning applications. In 14th USENIX Symposium on Operating Systems Design and Implementation (OSDI 20), pages 499-514.",
|
| 1622 |
+
"bbox": [
|
| 1623 |
+
509,
|
| 1624 |
+
762,
|
| 1625 |
+
882,
|
| 1626 |
+
829
|
| 1627 |
+
],
|
| 1628 |
+
"page_idx": 8
|
| 1629 |
+
},
|
| 1630 |
+
{
|
| 1631 |
+
"type": "text",
|
| 1632 |
+
"text": "Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens",
|
| 1633 |
+
"bbox": [
|
| 1634 |
+
509,
|
| 1635 |
+
841,
|
| 1636 |
+
882,
|
| 1637 |
+
920
|
| 1638 |
+
],
|
| 1639 |
+
"page_idx": 8
|
| 1640 |
+
},
|
| 1641 |
+
{
|
| 1642 |
+
"type": "page_number",
|
| 1643 |
+
"text": "19482",
|
| 1644 |
+
"bbox": [
|
| 1645 |
+
477,
|
| 1646 |
+
927,
|
| 1647 |
+
524,
|
| 1648 |
+
940
|
| 1649 |
+
],
|
| 1650 |
+
"page_idx": 8
|
| 1651 |
+
},
|
| 1652 |
+
{
|
| 1653 |
+
"type": "list",
|
| 1654 |
+
"sub_type": "ref_text",
|
| 1655 |
+
"list_items": [
|
| 1656 |
+
"Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877-1901.",
|
| 1657 |
+
"Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. 2024. Flashattention: fast and memory-efficient exact attention with io-awareness. In Proceedings of the 36th International Conference on Neural Information Processing Systems, NIPS '22.",
|
| 1658 |
+
"Tri Dao, Daniel Haziza, Francisco Massa, and Grigory Sizov. 2023. Flash decoding: Advances in efficient text generation.",
|
| 1659 |
+
"Shiwei Gao, Youmin Chen, and Jiwu Shu. 2025. Fast state restoration in llm serving with hcache. In Proceedings of the Twentieth European Conference on Computer Systems, pages 128-143.",
|
| 1660 |
+
"Google Gemini Team. 2024. Gemini: A family of highly capable multimodal models. Preprint, arXiv:2312.11805.",
|
| 1661 |
+
"Shijie Geng, Shuchang Liu, Zuohui Fu, Yingqiang Ge, and Yongfeng Zhang. 2022. Recommendation as language processing (rlp): A unified pretrain, personalized prompt & predict paradigm (p5). In Proceedings of the 16th ACM Conference on Recommender Systems, RecSys '22, page 299-315.",
|
| 1662 |
+
"Sylvain Gugger, Lysandre Debut, Thomas Wolf, Philipp Schmid, Zachary Mueller, Sourab Mangrulkar, Marc Sun, and Benjamin Bossan. 2022. Accelerate: Training and inference at scale made simple, efficient and adaptable. https://github.com/huggingface/accelerate.",
|
| 1663 |
+
"Jiaao He and Jidong Zhai. 2024. Fastdecode: High-throughputgpu-efficient llm serving using heterogeneous pipelines. Preprint, arXiv:2403.11421.",
|
| 1664 |
+
"Coleman Richard Charles Hooper, Sehoon Kim, Hiva Mohammadzadeh, Michael W. Mahoney, Sophia Shao, Kurt Keutzer, and Amir Gholami. 2024. KVQuant: Towards 10 million context length LLM inference with KV cache quantization. In The Thirty-eighth Annual Conference on Neural Information Processing Systems.",
|
| 1665 |
+
"Xuanlin Jiang, Yang Zhou, Shiyi Cao, Ion Stoica, and Minlan Yu. 2024. Neo: Saving cpu memory crisis with cpu offloading for online llm inference. Preprint, arXiv:2411.01142.",
|
| 1666 |
+
"Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph Gonzalez, Hao Zhang, and Ion Stoica. 2023. Efficient memory management for large language model serving with pagedattention. In Proceedings of the 29th Symposium on Operating Systems Principles, SOSP '23, page 611-626."
|
| 1667 |
+
],
|
| 1668 |
+
"bbox": [
|
| 1669 |
+
115,
|
| 1670 |
+
85,
|
| 1671 |
+
489,
|
| 1672 |
+
920
|
| 1673 |
+
],
|
| 1674 |
+
"page_idx": 9
|
| 1675 |
+
},
|
| 1676 |
+
{
|
| 1677 |
+
"type": "list",
|
| 1678 |
+
"sub_type": "ref_text",
|
| 1679 |
+
"list_items": [
|
| 1680 |
+
"Wonbeom Lee, Jungi Lee, Junghwan Seo, and Jaewoong Sim. 2024. InfiniGen: Efficient generative inference of large language models with dynamic KV cache management. In 18th USENIX Symposium on Operating Systems Design and Implementation (OSDI 24), pages 155-172.",
|
| 1681 |
+
"Guohao Li, Hasan Abed Al Kader Hammoud, Hani Itani, Dmitrii Khizbullin, and Bernard Ghanem. 2023. Camel: Communicative agents for \"mind\" exploration of large language model society. Preprint, arXiv:2303.17760.",
|
| 1682 |
+
"Yuhan Liu, Hanchen Li, Yihua Cheng, Siddhant Ray, Yuyang Huang, Qizheng Zhang, Kuntai Du, Jiayi Yao, Shan Lu, Ganesh Ananthanarayanan, Michael Maire, Henry Hoffmann, Ari Holtzman, and Junchen Jiang. 2024a. Cachegen: Kv cache compression and streaming for fast large language model serving. In Proceedings of the ACM SIGCOMM 2024 Conference, ACM SIGCOMM '24, page 38-56.",
|
| 1683 |
+
"Zirui Liu, Jiayi Yuan, Hongye Jin, Shaochen Zhong, Zhaozhuo Xu, Vladimir Braverman, Beidi Chen, and Xia Hu. 2024b. KIVI: A tuning-free asymmetric 2bit quantization for KV cache. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 32332-32344.",
|
| 1684 |
+
"OpenAI, Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, and et al. 2024. Gpt-4 technical report. Preprint, arXiv:2303.08774.",
|
| 1685 |
+
"Daon Park and Bernhard Egger. 2024. Improving throughput-oriented llm inference with cpu computations. In Proceedings of the 2024 International Conference on Parallel Architectures and Compilation Techniques, pages 233-245.",
|
| 1686 |
+
"Ying Sheng, Lianmin Zheng, Binhang Yuan, Zhuohan Li, Max Ryabinin, Beidi Chen, Percy Liang, Christopher Ré, Ion Stoica, and Ce Zhang. 2023. Flexgen: high-throughput generative inference of large language models with a singlegpu. In Proceedings of the 40th International Conference on Machine Learning, ICML'23.",
|
| 1687 |
+
"Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. 2023. Llama: Open and efficient foundation language models. Preprint, arXiv:2302.13971.",
|
| 1688 |
+
"Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30.",
|
| 1689 |
+
"Zhongwei Wan, Xin Wang, Che Liu, Samiul Alam, Yu Zheng, Jiachen Liu, Zhongnan Qu, Shen Yan, Yi Zhu, Quanlu Zhang, Mosharaf Chowdhury, and Mi Zhang. 2024. Efficient large language models: A survey. Transactions on Machine Learning Research."
|
| 1690 |
+
],
|
| 1691 |
+
"bbox": [
|
| 1692 |
+
510,
|
| 1693 |
+
85,
|
| 1694 |
+
880,
|
| 1695 |
+
920
|
| 1696 |
+
],
|
| 1697 |
+
"page_idx": 9
|
| 1698 |
+
},
|
| 1699 |
+
{
|
| 1700 |
+
"type": "page_number",
|
| 1701 |
+
"text": "19483",
|
| 1702 |
+
"bbox": [
|
| 1703 |
+
477,
|
| 1704 |
+
928,
|
| 1705 |
+
524,
|
| 1706 |
+
940
|
| 1707 |
+
],
|
| 1708 |
+
"page_idx": 9
|
| 1709 |
+
},
|
| 1710 |
+
{
|
| 1711 |
+
"type": "list",
|
| 1712 |
+
"sub_type": "ref_text",
|
| 1713 |
+
"list_items": [
|
| 1714 |
+
"Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations.",
|
| 1715 |
+
"Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, and Mike Lewis. 2024. Efficient streaming language models with attention sinks. In *The Twelfth International Conference on Learning Representations*.",
|
| 1716 |
+
"Chengye Yu, Tianyu Wang, Zili Shao, Linjie Zhu, Xu Zhou, and Song Jiang. 2024. Twinpilots: A new computing paradigm forgpu-cpu parallel llm inference. In Proceedings of the 17th ACM International Systems and Storage Conference, SYSTOR '24, page 91-103.",
|
| 1717 |
+
"Gyeong-In Yu, Joo Seong Jeong, Geon-Woo Kim, Soojeong Kim, and Byung-Gon Chun. 2022. Orca: A distributed serving system for Transformer-Based generative models. In 16th USENIX Symposium on Operating Systems Design and Implementation (OSDI 22), pages 521-538.",
|
| 1718 |
+
"Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. 2022. Opt: Open pre-trained transformer language models. Preprint, arXiv:2205.01068.",
|
| 1719 |
+
"Zhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen, Lianmin Zheng, Ruisi Cai, Zhao Song, Yuan-dong Tian, Christopher Re, Clark Barrett, Zhangyang Wang, and Beidi Chen. 2023. H2o: Heavy-hitter oracle for efficient generative inference of large language models. In Thirty-seventh Conference on Neural Information Processing Systems.",
|
| 1720 |
+
"Xuanlei Zhao, Bin Jia, Haotian Zhou, Ziming Liu, Shenggan Cheng, and Yang You. 2024a. Hetegen: Efficient heterogeneous parallel inference for large language models on resource-constrained devices. In MLSys.",
|
| 1721 |
+
"Youpeng Zhao, Di Wu, and Jun Wang. 2024b. ALISA: Accelerating Large Language Model Inference via Sparsity-Aware KV Caching. In 2024 ACM/IEEE 51st Annual International Symposium on Computer Architecture (ISCA), pages 1005-1017.",
|
| 1722 |
+
"Wenhao Zhu, Hongyi Liu, Qingxiu Dong, Jingjing Xu, Shujian Huang, Lingpeng Kong, Jiajun Chen, and Lei Li. 2024. Multilingual machine translation with"
|
| 1723 |
+
],
|
| 1724 |
+
"bbox": [
|
| 1725 |
+
115,
|
| 1726 |
+
85,
|
| 1727 |
+
489,
|
| 1728 |
+
919
|
| 1729 |
+
],
|
| 1730 |
+
"page_idx": 10
|
| 1731 |
+
},
|
| 1732 |
+
{
|
| 1733 |
+
"type": "text",
|
| 1734 |
+
"text": "large language models: Empirical results and analysis. In Findings of the Association for Computational Linguistics: NAACL 2024, pages 2765-2781.",
|
| 1735 |
+
"bbox": [
|
| 1736 |
+
527,
|
| 1737 |
+
85,
|
| 1738 |
+
882,
|
| 1739 |
+
126
|
| 1740 |
+
],
|
| 1741 |
+
"page_idx": 10
|
| 1742 |
+
},
|
| 1743 |
+
{
|
| 1744 |
+
"type": "page_number",
|
| 1745 |
+
"text": "19484",
|
| 1746 |
+
"bbox": [
|
| 1747 |
+
477,
|
| 1748 |
+
928,
|
| 1749 |
+
524,
|
| 1750 |
+
940
|
| 1751 |
+
],
|
| 1752 |
+
"page_idx": 10
|
| 1753 |
+
},
|
| 1754 |
+
{
|
| 1755 |
+
"type": "text",
|
| 1756 |
+
"text": "A Appendix",
|
| 1757 |
+
"text_level": 1,
|
| 1758 |
+
"bbox": [
|
| 1759 |
+
114,
|
| 1760 |
+
84,
|
| 1761 |
+
236,
|
| 1762 |
+
99
|
| 1763 |
+
],
|
| 1764 |
+
"page_idx": 11
|
| 1765 |
+
},
|
| 1766 |
+
{
|
| 1767 |
+
"type": "text",
|
| 1768 |
+
"text": "A.1 Scheduling Methods",
|
| 1769 |
+
"text_level": 1,
|
| 1770 |
+
"bbox": [
|
| 1771 |
+
114,
|
| 1772 |
+
116,
|
| 1773 |
+
324,
|
| 1774 |
+
131
|
| 1775 |
+
],
|
| 1776 |
+
"page_idx": 11
|
| 1777 |
+
},
|
| 1778 |
+
{
|
| 1779 |
+
"type": "text",
|
| 1780 |
+
"text": "Figures 11 illustrates two decoding schedules for generating 2 tokens from a model with three layers $(L_0, L_1, \\text{and} L_2)$ during the decoding stage. In Figure 11(a), the row-by-row schedule processes each batch across all layers before moving to the next batch. In contrast, Figure 11(b) shows the column-by-column schedule, where each layer is reused to process a group of batches before moving to the next layer.",
|
| 1781 |
+
"bbox": [
|
| 1782 |
+
112,
|
| 1783 |
+
141,
|
| 1784 |
+
487,
|
| 1785 |
+
286
|
| 1786 |
+
],
|
| 1787 |
+
"page_idx": 11
|
| 1788 |
+
},
|
| 1789 |
+
{
|
| 1790 |
+
"type": "image",
|
| 1791 |
+
"img_path": "images/6053bf5b813976105bca8030d2a2e25e2c610cc05cfddb4d8ddc2a37c98c9a76.jpg",
|
| 1792 |
+
"image_caption": [
|
| 1793 |
+
"(a) row-wise scheduling."
|
| 1794 |
+
],
|
| 1795 |
+
"image_footnote": [],
|
| 1796 |
+
"bbox": [
|
| 1797 |
+
141,
|
| 1798 |
+
305,
|
| 1799 |
+
470,
|
| 1800 |
+
423
|
| 1801 |
+
],
|
| 1802 |
+
"page_idx": 11
|
| 1803 |
+
},
|
| 1804 |
+
{
|
| 1805 |
+
"type": "image",
|
| 1806 |
+
"img_path": "images/65e8157bfc9de36bb79d31d1bfb8afeaf59b72f8b702768e8c2f4f3c7ae9e3af.jpg",
|
| 1807 |
+
"image_caption": [
|
| 1808 |
+
"(b) column-wise scheduling.",
|
| 1809 |
+
"Figure 11: Two different scheduling methods, with arrows indicating the scheduling order."
|
| 1810 |
+
],
|
| 1811 |
+
"image_footnote": [],
|
| 1812 |
+
"bbox": [
|
| 1813 |
+
141,
|
| 1814 |
+
443,
|
| 1815 |
+
470,
|
| 1816 |
+
558
|
| 1817 |
+
],
|
| 1818 |
+
"page_idx": 11
|
| 1819 |
+
},
|
| 1820 |
+
{
|
| 1821 |
+
"type": "text",
|
| 1822 |
+
"text": "A.2 KV Cache Partial Recomputation with Overlapping",
|
| 1823 |
+
"text_level": 1,
|
| 1824 |
+
"bbox": [
|
| 1825 |
+
114,
|
| 1826 |
+
653,
|
| 1827 |
+
468,
|
| 1828 |
+
686
|
| 1829 |
+
],
|
| 1830 |
+
"page_idx": 11
|
| 1831 |
+
},
|
| 1832 |
+
{
|
| 1833 |
+
"type": "text",
|
| 1834 |
+
"text": "Built on FlexGen (Sheng et al., 2023)'s computation and communication overlapping technique, we adapt it to support KV cache partial recomputation. Algorithm 1 enables simultaneous execution of tasks within the innermost loop, including loading weights for the next layer, loading activations for KV cache recomputation, recomputing the partial KV cache, loading the rest of the KV cache and activations for the next batch, storing the KV cache and activations for the previous batch, and performing computation for the current batch. Although the algorithm is designed for column-by-column scheduling, the row-by-row schedule with a single batch is a special case of it.",
|
| 1835 |
+
"bbox": [
|
| 1836 |
+
112,
|
| 1837 |
+
696,
|
| 1838 |
+
489,
|
| 1839 |
+
921
|
| 1840 |
+
],
|
| 1841 |
+
"page_idx": 11
|
| 1842 |
+
},
|
| 1843 |
+
{
|
| 1844 |
+
"type": "code",
|
| 1845 |
+
"sub_type": "algorithm",
|
| 1846 |
+
"code_caption": [
|
| 1847 |
+
"Algorithm 1 KV Cache Partial Recomputation with Overlapping"
|
| 1848 |
+
],
|
| 1849 |
+
"code_body": "for $i = 1$ to generation_length do \nfor $j = 1$ to num_layers do \nfor $k = 1$ to num_GPU_batches do \n// Load the weight of the next layer \nload_weight $(i,j + 1,k)$ \n// Load the activation for KV cache re-computation of the next batch \nloadactivation_recompute $(i,j,k + 1)$ \n// Load the KV cache and activation of the next batch \nload_cache $(i,j,k + 1)$ \nloadActivation $(i,j,k + 1)$ \n// Compute this batch \ncompute $(i,j,k)$ \n// Store the KV cache and activation of the previous batch \nstoreActivation $(i,j,k - 1)$ \nstore_cache $(i,j,k - 1)$ \n// Synchronize all devices \nsynchronize() \nend for \nend for \nend for",
|
| 1850 |
+
"bbox": [
|
| 1851 |
+
512,
|
| 1852 |
+
118,
|
| 1853 |
+
885,
|
| 1854 |
+
506
|
| 1855 |
+
],
|
| 1856 |
+
"page_idx": 11
|
| 1857 |
+
},
|
| 1858 |
+
{
|
| 1859 |
+
"type": "text",
|
| 1860 |
+
"text": "A.3 Detailed Experimental Results",
|
| 1861 |
+
"text_level": 1,
|
| 1862 |
+
"bbox": [
|
| 1863 |
+
507,
|
| 1864 |
+
542,
|
| 1865 |
+
800,
|
| 1866 |
+
557
|
| 1867 |
+
],
|
| 1868 |
+
"page_idx": 11
|
| 1869 |
+
},
|
| 1870 |
+
{
|
| 1871 |
+
"type": "text",
|
| 1872 |
+
"text": "Table 3 and 4 present detailed experimental results for latency-oriented workloads using OPT-6.7B and OPT-13B. The results show the performance differences between KVPR and the baseline (Hugging Face Transformer with KV cache offloading) in terms of GPU peak memory, decode latency, and throughput across various configurations. Notably, KVPR consistently achieves lower latency while maintaining comparable memory usage.",
|
| 1873 |
+
"bbox": [
|
| 1874 |
+
507,
|
| 1875 |
+
571,
|
| 1876 |
+
882,
|
| 1877 |
+
717
|
| 1878 |
+
],
|
| 1879 |
+
"page_idx": 11
|
| 1880 |
+
},
|
| 1881 |
+
{
|
| 1882 |
+
"type": "text",
|
| 1883 |
+
"text": "A.4 Optimal KV Cache Split Points",
|
| 1884 |
+
"text_level": 1,
|
| 1885 |
+
"bbox": [
|
| 1886 |
+
507,
|
| 1887 |
+
745,
|
| 1888 |
+
806,
|
| 1889 |
+
762
|
| 1890 |
+
],
|
| 1891 |
+
"page_idx": 11
|
| 1892 |
+
},
|
| 1893 |
+
{
|
| 1894 |
+
"type": "text",
|
| 1895 |
+
"text": "Figure 12 presents the optimal KV cache split points $l$ , obtained by solving the linear programming problem defined in Eq. (11), for the first setting of the latency-oriented workload experiments in Section 4 (prompt length of 128 and generation length of 32). Based on system profiling statistics and KV cache size, the optimal split point $l$ is 182 when the generation length is 1, and $l$ increases to 128 when the generation length is 32.",
|
| 1896 |
+
"bbox": [
|
| 1897 |
+
507,
|
| 1898 |
+
776,
|
| 1899 |
+
882,
|
| 1900 |
+
921
|
| 1901 |
+
],
|
| 1902 |
+
"page_idx": 11
|
| 1903 |
+
},
|
| 1904 |
+
{
|
| 1905 |
+
"type": "page_number",
|
| 1906 |
+
"text": "19485",
|
| 1907 |
+
"bbox": [
|
| 1908 |
+
477,
|
| 1909 |
+
927,
|
| 1910 |
+
524,
|
| 1911 |
+
940
|
| 1912 |
+
],
|
| 1913 |
+
"page_idx": 11
|
| 1914 |
+
},
|
| 1915 |
+
{
|
| 1916 |
+
"type": "table",
|
| 1917 |
+
"img_path": "images/73bffa2a6b79ca16e372af5c5a9478fd4b28be4083987af666c0cbe34afc0e40.jpg",
|
| 1918 |
+
"table_caption": [],
|
| 1919 |
+
"table_footnote": [],
|
| 1920 |
+
"table_body": "<table><tr><td>Method</td><td>Batch size</td><td>Prompt length</td><td>Generation length</td><td>Cache size (GB)</td><td>GPU peak mem (GB)</td><td>Decode latency (sec)</td><td>Decode throughput (tokens/s)</td></tr><tr><td rowspan=\"6\">Accel.</td><td>64</td><td>128</td><td>32</td><td>5.0</td><td>14.427</td><td>8.905</td><td>222.788</td></tr><tr><td>64</td><td>128</td><td>128</td><td>8.0</td><td>14.708</td><td>71.327</td><td>113.954</td></tr><tr><td>64</td><td>256</td><td>32</td><td>9.0</td><td>16.337</td><td>26.825</td><td>73.961</td></tr><tr><td>64</td><td>256</td><td>128</td><td>12.0</td><td>16.618</td><td>88.354</td><td>91.993</td></tr><tr><td>64</td><td>512</td><td>32</td><td>17.0</td><td>20.154</td><td>24.390</td><td>81.344</td></tr><tr><td>64</td><td>512</td><td>128</td><td>20.0</td><td>20.576</td><td>110.277</td><td>73.705</td></tr><tr><td rowspan=\"6\">KVPR</td><td>64</td><td>128</td><td>32</td><td>5.0</td><td>14.364</td><td>6.651</td><td>298.284</td></tr><tr><td>64</td><td>128</td><td>128</td><td>8.0</td><td>14.645</td><td>45.766</td><td>177.598</td></tr><tr><td>64</td><td>256</td><td>32</td><td>9.0</td><td>16.212</td><td>19.138</td><td>103.666</td></tr><tr><td>64</td><td>256</td><td>128</td><td>12.0</td><td>16.493</td><td>61.597</td><td>131.955</td></tr><tr><td>64</td><td>512</td><td>32</td><td>17.0</td><td>19.904</td><td>20.349</td><td>97.501</td></tr><tr><td>64</td><td>512</td><td>128</td><td>20.0</td><td>20.951</td><td>93.932</td><td>86.531</td></tr></table>",
|
| 1921 |
+
"bbox": [
|
| 1922 |
+
115,
|
| 1923 |
+
80,
|
| 1924 |
+
878,
|
| 1925 |
+
281
|
| 1926 |
+
],
|
| 1927 |
+
"page_idx": 12
|
| 1928 |
+
},
|
| 1929 |
+
{
|
| 1930 |
+
"type": "table",
|
| 1931 |
+
"img_path": "images/03775542561a16b6dfd63738cdb442425a09ca5843f02a67b5f813e6614f3de4.jpg",
|
| 1932 |
+
"table_caption": [
|
| 1933 |
+
"Table 3: Detailed experimental results for OPT-6.7B corresponding to Figure 7."
|
| 1934 |
+
],
|
| 1935 |
+
"table_footnote": [],
|
| 1936 |
+
"table_body": "<table><tr><td>Method</td><td>Batch size</td><td>Prompt length</td><td>Generation length</td><td>Cache size (GB)</td><td>GPU peak mem (GB)</td><td>Decode latency (sec)</td><td>Decode throughput (tokens/s)</td></tr><tr><td rowspan=\"6\">Accel.</td><td>64</td><td>128</td><td>32</td><td>7.812</td><td>26.083</td><td>11.409</td><td>173.891</td></tr><tr><td>64</td><td>128</td><td>128</td><td>12.500</td><td>26.434</td><td>73.896</td><td>109.993</td></tr><tr><td>64</td><td>256</td><td>32</td><td>14.062</td><td>28.087</td><td>19.381</td><td>102.368</td></tr><tr><td>64</td><td>256</td><td>128</td><td>18.750</td><td>28.439</td><td>104.115</td><td>78.068</td></tr><tr><td>64</td><td>512</td><td>32</td><td>26.562</td><td>32.851</td><td>35.066</td><td>56.579</td></tr><tr><td>64</td><td>512</td><td>128</td><td>31.250</td><td>34.146</td><td>168.155</td><td>48.336</td></tr><tr><td rowspan=\"6\">KVPR</td><td>64</td><td>128</td><td>32</td><td>7.812</td><td>26.005</td><td>9.148</td><td>216.867</td></tr><tr><td>64</td><td>128</td><td>128</td><td>12.500</td><td>26.356</td><td>66.119</td><td>122.929</td></tr><tr><td>64</td><td>256</td><td>32</td><td>14.062</td><td>27.931</td><td>16.654</td><td>119.127</td></tr><tr><td>64</td><td>256</td><td>128</td><td>18.750</td><td>28.337</td><td>88.492</td><td>91.850</td></tr><tr><td>64</td><td>512</td><td>32</td><td>26.562</td><td>33.203</td><td>29.215</td><td>67.911</td></tr><tr><td>64</td><td>512</td><td>128</td><td>31.250</td><td>34.615</td><td>138.377</td><td>58.738</td></tr></table>",
|
| 1937 |
+
"bbox": [
|
| 1938 |
+
115,
|
| 1939 |
+
317,
|
| 1940 |
+
878,
|
| 1941 |
+
517
|
| 1942 |
+
],
|
| 1943 |
+
"page_idx": 12
|
| 1944 |
+
},
|
| 1945 |
+
{
|
| 1946 |
+
"type": "image",
|
| 1947 |
+
"img_path": "images/27069651bbee58a6caf99a7118654015715e1c21f97f641e47e3a23928e6fd14.jpg",
|
| 1948 |
+
"image_caption": [
|
| 1949 |
+
"Figure 12: Optimal KV cache split points $l$ over the generation process."
|
| 1950 |
+
],
|
| 1951 |
+
"image_footnote": [],
|
| 1952 |
+
"bbox": [
|
| 1953 |
+
137,
|
| 1954 |
+
567,
|
| 1955 |
+
470,
|
| 1956 |
+
715
|
| 1957 |
+
],
|
| 1958 |
+
"page_idx": 12
|
| 1959 |
+
},
|
| 1960 |
+
{
|
| 1961 |
+
"type": "text",
|
| 1962 |
+
"text": "A.5 System Performance with a Low-end GPU",
|
| 1963 |
+
"text_level": 1,
|
| 1964 |
+
"bbox": [
|
| 1965 |
+
112,
|
| 1966 |
+
785,
|
| 1967 |
+
453,
|
| 1968 |
+
816
|
| 1969 |
+
],
|
| 1970 |
+
"page_idx": 12
|
| 1971 |
+
},
|
| 1972 |
+
{
|
| 1973 |
+
"type": "text",
|
| 1974 |
+
"text": "To further demonstrate the adaptability of KVPR, we evaluate it on a low-end system with an AMD EPYC 32-Core CPU and an NVIDIA Quadro RTX 5000 GPU (16 GB HBM, 89.2 TFLOPS FP16 peak performance) connected via PCIe $4.0 \\times 8$ (16 GB/s bandwidth). GPU TFLOPS, GPU memory, and",
|
| 1975 |
+
"bbox": [
|
| 1976 |
+
112,
|
| 1977 |
+
824,
|
| 1978 |
+
489,
|
| 1979 |
+
921
|
| 1980 |
+
],
|
| 1981 |
+
"page_idx": 12
|
| 1982 |
+
},
|
| 1983 |
+
{
|
| 1984 |
+
"type": "text",
|
| 1985 |
+
"text": "PCIe bandwidth are lower in this system setting than those in the default system we used earlier. Despite the reduced GPU speed and bandwidth, KVPR achieves up to $15\\%$ higher throughput than FlexGen for OPT-6.7B in the same throughput-oriented workload, as shown in Table 5.",
|
| 1986 |
+
"bbox": [
|
| 1987 |
+
507,
|
| 1988 |
+
565,
|
| 1989 |
+
884,
|
| 1990 |
+
661
|
| 1991 |
+
],
|
| 1992 |
+
"page_idx": 12
|
| 1993 |
+
},
|
| 1994 |
+
{
|
| 1995 |
+
"type": "table",
|
| 1996 |
+
"img_path": "images/46df2b3475dc8391741717e20a33f2bed52e6bf16b1e76f5000b23aa28e1812b.jpg",
|
| 1997 |
+
"table_caption": [
|
| 1998 |
+
"Table 4: Detailed experimental results for OPT-13B corresponding to Figure 7."
|
| 1999 |
+
],
|
| 2000 |
+
"table_footnote": [],
|
| 2001 |
+
"table_body": "<table><tr><td>Seq len</td><td>256/32</td><td>256/128</td><td>512/32</td><td>512/128</td><td>1024/32</td><td>1024/128</td></tr><tr><td>FlexGen</td><td>50.057</td><td>46.779</td><td>29.614</td><td>28.650</td><td>15.778</td><td>16.194</td></tr><tr><td>KVPR</td><td>53.976</td><td>49.860</td><td>33.666</td><td>32.277</td><td>18.285</td><td>18.108</td></tr></table>",
|
| 2002 |
+
"bbox": [
|
| 2003 |
+
510,
|
| 2004 |
+
671,
|
| 2005 |
+
878,
|
| 2006 |
+
708
|
| 2007 |
+
],
|
| 2008 |
+
"page_idx": 12
|
| 2009 |
+
},
|
| 2010 |
+
{
|
| 2011 |
+
"type": "text",
|
| 2012 |
+
"text": "Table 5: Throughput (tokens/s) comparison on a low-end GPU system.",
|
| 2013 |
+
"bbox": [
|
| 2014 |
+
507,
|
| 2015 |
+
717,
|
| 2016 |
+
882,
|
| 2017 |
+
746
|
| 2018 |
+
],
|
| 2019 |
+
"page_idx": 12
|
| 2020 |
+
},
|
| 2021 |
+
{
|
| 2022 |
+
"type": "text",
|
| 2023 |
+
"text": "A.6 Additional Experimental Results on LLaMa Models",
|
| 2024 |
+
"text_level": 1,
|
| 2025 |
+
"bbox": [
|
| 2026 |
+
507,
|
| 2027 |
+
771,
|
| 2028 |
+
840,
|
| 2029 |
+
802
|
| 2030 |
+
],
|
| 2031 |
+
"page_idx": 12
|
| 2032 |
+
},
|
| 2033 |
+
{
|
| 2034 |
+
"type": "text",
|
| 2035 |
+
"text": "In addition to the OPT models discussed in Section 4, we conduct further experiments on the more recent LLaMa2-7B and LLaMa2-13B models. Using the same experimental setup, we measure decoding throughput while processing a single batch of size 64 across varying prompt and generation lengths. As shown in Figure 13, KVPR consis",
|
| 2036 |
+
"bbox": [
|
| 2037 |
+
507,
|
| 2038 |
+
808,
|
| 2039 |
+
884,
|
| 2040 |
+
921
|
| 2041 |
+
],
|
| 2042 |
+
"page_idx": 12
|
| 2043 |
+
},
|
| 2044 |
+
{
|
| 2045 |
+
"type": "page_number",
|
| 2046 |
+
"text": "19486",
|
| 2047 |
+
"bbox": [
|
| 2048 |
+
477,
|
| 2049 |
+
928,
|
| 2050 |
+
524,
|
| 2051 |
+
940
|
| 2052 |
+
],
|
| 2053 |
+
"page_idx": 12
|
| 2054 |
+
},
|
| 2055 |
+
{
|
| 2056 |
+
"type": "text",
|
| 2057 |
+
"text": "tently achieves higher throughput than the baselines (DeepSpeed Inference and Hugging Face Accelerate) on both LLaMa2 models.",
|
| 2058 |
+
"bbox": [
|
| 2059 |
+
112,
|
| 2060 |
+
84,
|
| 2061 |
+
489,
|
| 2062 |
+
131
|
| 2063 |
+
],
|
| 2064 |
+
"page_idx": 13
|
| 2065 |
+
},
|
| 2066 |
+
{
|
| 2067 |
+
"type": "image",
|
| 2068 |
+
"img_path": "images/054f8b5e394bf161714f48966c8505295b8e2e42eb98f58285b605e0e5e1cd39.jpg",
|
| 2069 |
+
"image_caption": [
|
| 2070 |
+
"Figure 14: Throughput comparison between KVPR and FastDecode with different GPU workload."
|
| 2071 |
+
],
|
| 2072 |
+
"image_footnote": [],
|
| 2073 |
+
"bbox": [
|
| 2074 |
+
127,
|
| 2075 |
+
147,
|
| 2076 |
+
480,
|
| 2077 |
+
315
|
| 2078 |
+
],
|
| 2079 |
+
"page_idx": 13
|
| 2080 |
+
},
|
| 2081 |
+
{
|
| 2082 |
+
"type": "image",
|
| 2083 |
+
"img_path": "images/fe4a4886f27a3f501c0a84813bc4d508a60915c5c67f54d78a090b33ee89f817.jpg",
|
| 2084 |
+
"image_caption": [
|
| 2085 |
+
"Figure 13: Decoding throughput for a single batch of size 64 across different sequence lengths."
|
| 2086 |
+
],
|
| 2087 |
+
"image_footnote": [],
|
| 2088 |
+
"bbox": [
|
| 2089 |
+
127,
|
| 2090 |
+
321,
|
| 2091 |
+
478,
|
| 2092 |
+
489
|
| 2093 |
+
],
|
| 2094 |
+
"page_idx": 13
|
| 2095 |
+
},
|
| 2096 |
+
{
|
| 2097 |
+
"type": "text",
|
| 2098 |
+
"text": "A.7 Comparing with CPU-assisted Approaches in Distributed System Setup",
|
| 2099 |
+
"text_level": 1,
|
| 2100 |
+
"bbox": [
|
| 2101 |
+
114,
|
| 2102 |
+
560,
|
| 2103 |
+
480,
|
| 2104 |
+
593
|
| 2105 |
+
],
|
| 2106 |
+
"page_idx": 13
|
| 2107 |
+
},
|
| 2108 |
+
{
|
| 2109 |
+
"type": "text",
|
| 2110 |
+
"text": "In this experiment, we compare the performance of the CPU-assisted offloading approach, FastDecode (He and Zhai, 2024), with KVPR on a GPU node equipped with 8 NVIDIA A100 GPUs and a single CPU, which is the same AMD EPYC processor (64 cores with PCIe 4.0 128 lanes), as described in Section 4.",
|
| 2111 |
+
"bbox": [
|
| 2112 |
+
112,
|
| 2113 |
+
599,
|
| 2114 |
+
487,
|
| 2115 |
+
709
|
| 2116 |
+
],
|
| 2117 |
+
"page_idx": 13
|
| 2118 |
+
},
|
| 2119 |
+
{
|
| 2120 |
+
"type": "text",
|
| 2121 |
+
"text": "We run multiple concurrent processes of FastDecode and KVPR on the available GPUs, with each GPU dedicated to a single process. This setup simulates scenarios where either multiple users share a single computing node or a single user performs data-parallel inference. FastDecode relies on the CPU for attention computations, resulting in a performance drop as the CPU becomes a bottleneck when managing multiple concurrent inference processes. In contrast, KVPR eliminates CPU dependency entirely and instead optimizes data transfer over the PCIe bus.",
|
| 2122 |
+
"bbox": [
|
| 2123 |
+
112,
|
| 2124 |
+
711,
|
| 2125 |
+
487,
|
| 2126 |
+
903
|
| 2127 |
+
],
|
| 2128 |
+
"page_idx": 13
|
| 2129 |
+
},
|
| 2130 |
+
{
|
| 2131 |
+
"type": "text",
|
| 2132 |
+
"text": "Figure 14 demonstrates that while FastDecode",
|
| 2133 |
+
"bbox": [
|
| 2134 |
+
131,
|
| 2135 |
+
904,
|
| 2136 |
+
487,
|
| 2137 |
+
921
|
| 2138 |
+
],
|
| 2139 |
+
"page_idx": 13
|
| 2140 |
+
},
|
| 2141 |
+
{
|
| 2142 |
+
"type": "text",
|
| 2143 |
+
"text": "suffers a significant decline in throughput as the number of processes increases, KVPR exhibits better scalability, maintaining stable performance in systems with a single CPU and multiple GPUs.",
|
| 2144 |
+
"bbox": [
|
| 2145 |
+
507,
|
| 2146 |
+
84,
|
| 2147 |
+
882,
|
| 2148 |
+
149
|
| 2149 |
+
],
|
| 2150 |
+
"page_idx": 13
|
| 2151 |
+
},
|
| 2152 |
+
{
|
| 2153 |
+
"type": "image",
|
| 2154 |
+
"img_path": "images/46abeb68275bba03d2506875b8b1b18eac30d12daae657c5e7aac48e7144d95b.jpg",
|
| 2155 |
+
"image_caption": [],
|
| 2156 |
+
"image_footnote": [],
|
| 2157 |
+
"bbox": [
|
| 2158 |
+
527,
|
| 2159 |
+
165,
|
| 2160 |
+
860,
|
| 2161 |
+
311
|
| 2162 |
+
],
|
| 2163 |
+
"page_idx": 13
|
| 2164 |
+
},
|
| 2165 |
+
{
|
| 2166 |
+
"type": "text",
|
| 2167 |
+
"text": "A.8 Extended Related Works",
|
| 2168 |
+
"text_level": 1,
|
| 2169 |
+
"bbox": [
|
| 2170 |
+
507,
|
| 2171 |
+
382,
|
| 2172 |
+
756,
|
| 2173 |
+
397
|
| 2174 |
+
],
|
| 2175 |
+
"page_idx": 13
|
| 2176 |
+
},
|
| 2177 |
+
{
|
| 2178 |
+
"type": "text",
|
| 2179 |
+
"text": "GPU-efficient LLM inference. Maximizing GPU utilization is crucial for serving LLMs efficiently to achieve low latency and high throughput. Orca (Yu et al., 2022) employs iteration-level scheduling to handle batches with varying output lengths, returning completed sequences immediately to serve new ones. PagedAttention (Kwon et al., 2023) observes that the KV cache grows and shrinks dynamically as tokens are generated, though the sequence lifetime and length are not predetermined. It addresses this by managing the KV cache as non-contiguous memory blocks. FlashAttention (Dao et al., 2024) combines attention operations into a single kernel and tiles QKV matrices into smaller blocks to optimize GPU SRAM usage and reduce HBM access overhead, while our work mainly focuses on optimizing PCIe bandwidth. DeepSpeed-Inference (Aminabadi et al., 2022) enhances multi-GPU inference for both dense and sparse Transformer models by combining GPU memory and employing a hybrid inference technique with CPU and NVMe memory. Flash-Decoding (Dao et al., 2023) accelerates long-context inference by splitting keys and values into smaller chunks, enabling parallel attention computations and combining results for the final output. HCache (Gao et al., 2025) focuses on restoring contextual states across user requests for reuse in online inference, balancing latency, capacity, and persistence for robust LLM serving.",
|
| 2180 |
+
"bbox": [
|
| 2181 |
+
505,
|
| 2182 |
+
404,
|
| 2183 |
+
885,
|
| 2184 |
+
872
|
| 2185 |
+
],
|
| 2186 |
+
"page_idx": 13
|
| 2187 |
+
},
|
| 2188 |
+
{
|
| 2189 |
+
"type": "text",
|
| 2190 |
+
"text": "KV cache optimization. Efficient KV cache management enhances inference performance through compression or eviction strategies. KIVI (Liu",
|
| 2191 |
+
"bbox": [
|
| 2192 |
+
507,
|
| 2193 |
+
873,
|
| 2194 |
+
882,
|
| 2195 |
+
921
|
| 2196 |
+
],
|
| 2197 |
+
"page_idx": 13
|
| 2198 |
+
},
|
| 2199 |
+
{
|
| 2200 |
+
"type": "page_number",
|
| 2201 |
+
"text": "19487",
|
| 2202 |
+
"bbox": [
|
| 2203 |
+
477,
|
| 2204 |
+
927,
|
| 2205 |
+
524,
|
| 2206 |
+
940
|
| 2207 |
+
],
|
| 2208 |
+
"page_idx": 13
|
| 2209 |
+
},
|
| 2210 |
+
{
|
| 2211 |
+
"type": "text",
|
| 2212 |
+
"text": "et al., 2024b) introduces a tuning-free 2-bit quantization method to compress key cache per channel and value cache per token. Similarly, KVQuant (Hooper et al., 2024) applies 3-bit compression by combining per-channel quantization with pre-rotary positional embedding quantization for LLaMA. For eviction, H2O (Zhang et al., 2023) formulates KV cache eviction as a dynamic submodular problem, prioritizing critical and recent tokens to improve throughput. StreamingLLM (Xiao et al., 2024) uses window attention with a fixed-size sliding window to retain the most recent KV caches, maintaining constant memory usage and decoding speed once the cache reaches capacity. InfiniGen (Lee et al., 2024) stores low-rank key cache in GPU memory, offloads value cache to the CPU, and selectively retrieves important values based on approximate attention scores.",
|
| 2213 |
+
"bbox": [
|
| 2214 |
+
115,
|
| 2215 |
+
84,
|
| 2216 |
+
489,
|
| 2217 |
+
373
|
| 2218 |
+
],
|
| 2219 |
+
"page_idx": 14
|
| 2220 |
+
},
|
| 2221 |
+
{
|
| 2222 |
+
"type": "page_number",
|
| 2223 |
+
"text": "19488",
|
| 2224 |
+
"bbox": [
|
| 2225 |
+
478,
|
| 2226 |
+
928,
|
| 2227 |
+
524,
|
| 2228 |
+
940
|
| 2229 |
+
],
|
| 2230 |
+
"page_idx": 14
|
| 2231 |
+
}
|
| 2232 |
+
]
|
2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/5b27d840-4fbb-4001-88b6-b01143c761b0_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/5b27d840-4fbb-4001-88b6-b01143c761b0_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3860bebf1c8e10302e104fb7ac8d5103d395328031b053770943de0ed81625e2
|
| 3 |
+
size 1148976
|
2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/full.md
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KVPR: Efficient LLM Inference with I/O-Aware KV Cache Partial Recomputation
|
| 2 |
+
|
| 3 |
+
Chaoyi Jiang*, Lei Gao*, Hossein Entezari Zarch, Murali Annavarm
|
| 4 |
+
|
| 5 |
+
University of Southern California
|
| 6 |
+
|
| 7 |
+
{chaoyij, leig, entezari, annavara}@usc.edu
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Inference for Large Language Models (LLMs) is computationally demanding. To reduce the cost of auto-regressive decoding, Key-Value (KV) cache is used to store intermediate activations, which significantly lowers the computational overhead for token generation. However, the memory required for the KV cache grows rapidly, often exceeding the capacity of GPU memory. A cost-effective alternative is to offload KV cache to CPU memory, which alleviates GPU memory pressure, but shifts the bottleneck to the limited bandwidth of the PCIe connection between the CPU and GPU. Existing methods attempt to address these issues by overlapping GPU computation with I/O or employing CPU-GPU heterogeneous execution, but they are hindered by excessive data movement and dependence on CPU capabilities. Fully overlapping PCIe communication latency gets challenging as the size of the KV cache grows and/or the GPU compute capabilities increase. In this paper, we introduce KVPR, an efficient I/O-aware LLM inference method where the CPU first transfers a partial set of activations, from which the GPU can start recomputing the KV cache values. While the GPU recomputes the partial KV cache, the remaining portion of the KV cache is transferred concurrently from the CPU. This approach overlaps GPU recomputation with KV cache transfer to minimize idle GPU time and maximize inference performance. KVPR is fully automated by integrating a profiler module that utilizes input characteristics and system hardware information, a scheduler module to optimize the distribution of computation and communication workloads, and a runtime module to efficiently execute the derived execution plan. Experimental results show that KVPR achieves up to $35.8\%$ lower latency and $46.2\%$ higher throughput during decoding compared to state-of-the-art approaches. The code is available at https://github.com/chaoyij/KVPR.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Large language models (LLMs) have made remarkable progress in recent years, demonstrating their ability to power diverse applications such as machine translation (Zhu et al., 2024), summarization (OpenAI et al., 2024), creative content generation (Gemini Team, 2024), and personalized recommendations (Geng et al., 2022). Real-time applications, including conversational agents and live translation (Li et al., 2023), depend on low latency to provide seamless user interaction, while large-scale deployments require high throughput to support concurrent users and process substantial data efficiently (Kwon et al., 2023).
|
| 16 |
+
|
| 17 |
+
Key-Value (KV) cache is essential in autoregressive decoding for LLMs, as it stores the intermediate key and value activations from earlier steps in the attention mechanism. This reduces the computational complexity of generating each token from quadratic to linear by eliminating the need to recompute these activations for every generated token. However, this comes at a cost: the size of the KV cache grows linearly with batch size, sequence length, and model size, leading to substantial memory demands (Wan et al., 2024).
|
| 18 |
+
|
| 19 |
+
GPU memory, while optimized for high-bandwidth access by computation units, is inherently limited and often insufficient to handle the large and growing size of the KV cache. One cost-effective approach to address this limitation is to offload the KV cache to cheaper and plentiful CPU memory, and could be further offloaded to hard disks and network storage (Liu et al., 2024a). While offloading reduces GPU memory pressure, it introduces a new bottleneck: the slow PCIe bus becomes a limiting factor when transferring the KV cache from CPU to GPU for computation. Due to the long PCIe transfer time, the overall decoding latency increases and token generation throughput decreases, hindering the overall inference efficiency
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: LLM inference system with an A100 GPU.
|
| 23 |
+
|
| 24 |
+
of the system (Zhao et al., 2024a).
|
| 25 |
+
|
| 26 |
+
<table><tr><td>Model</td><td>Hidden Dim</td><td>KV Cache (MB)</td><td>PCIe Latency (ms)</td><td>Comp. Latency (ms)</td></tr><tr><td>OPT-6.7B</td><td>4,096</td><td>512</td><td>15.6</td><td>0.3509</td></tr><tr><td>OPT-13B</td><td>5,120</td><td>640</td><td>19.5</td><td>0.4388</td></tr><tr><td>OPT-30B</td><td>7,168</td><td>896</td><td>27.3</td><td>0.6143</td></tr></table>
|
| 27 |
+
|
| 28 |
+
Table 1: PCIe latency and computation latency for different KV cache sizes based on the system in Figure 1.
|
| 29 |
+
|
| 30 |
+
To evaluate the impact of communication overhead, we set up an LLM inference serving system (shown in Figure 1) using an NVIDIA A100 GPU. Data transfer between the CPU DRAM and GPU HBM occurs over a PCIe 4.0 16 lanes with a bandwidth of $32\mathrm{GB / s}$ . Table 1 shows the hidden dimension, KV cache size, PCIe transfer time, and GPU computation latency for KV pair computation. Note that the end-to-end decoding latency includes other components, such as feed-forward layers, which are not shown in this table for clarity. We use FP16 precision with a batch size of 32 and a sequence length of 1024. The results show that PCIe latency exceeds KV cache recomputation latency by over an order of magnitude. Hence, in systems where the KV cache is stored on CPU DRAM the long transfer time leads to GPU idle time, which is detrimental to inference efficiency.
|
| 31 |
+
|
| 32 |
+
To mitigate the issue of low latency and bandwidth of PCIe, FlexGen (Sheng et al., 2023) and PipeSwitch (Bai et al., 2020) attempt to overlap GPU computation of the current layer with KV cache loading for the next layer. However, the effectiveness of such an overlap is capped by the task that takes the longest time. In most systems, PCIe transfer time overshadows GPU computation latency, particularly with large batch and context sizes. Hence, fully overlapping GPU computation with PCIe transfer time is infeasible. FastDecode (He and Zhai, 2024) suggests computing attention scores directly on the CPU, which has faster access to the KV cache compared to the GPU. Similarly, HeteGen (Zhao et al., 2024a), TwinPilots (Yu et al., 2024), and Park and Egger employ CPU-GPU heterogeneous execution to hide data transfer overhead by performing computations on the CPU.
|
| 33 |
+
|
| 34 |
+
However, as demonstrated later in our results, such an approach puts a burden on the CPU to satisfy the KV cache computation demands from multiple GPUs attached to a CPU host, thereby limiting scalability.
|
| 35 |
+
|
| 36 |
+
In this paper, we propose KVPR, a novel approach for efficient LLM inference that balances the GPU computation and PCIe bandwidth trade-offs. Instead of transferring the entire KV cache from CPU to GPU to compute an attention score, the CPU transfers a partial set of activations, which are smaller in size and are required to generate part of the KV cache, to the GPU. The GPU then starts recomputing the partial KV cache from the input activations. Concurrently, the CPU transfers the remaining KV cache over PCIe. KVPR ensures the computation of exact attention scores without approximation, while minimizing GPU idle time and improving overall latency and throughput.
|
| 37 |
+
|
| 38 |
+
KVPR achieves a near-perfect overlap of PCIe transfer time and GPU recomputation time by determining the optimal fraction of activations that need to be recomputed. KVPR is fully automated in determining the recomputation and communication split. It includes a profiler module that collects system hardware information, a scheduler module that formulates the problem as a linear programming problem to determine the optimal split point, and a runtime module that manages memory allocation on both devices and coordinates data transfer between them. Experimental results show significant improvements in inference latency or throughput, depending on workload. In summary, our contributions are as follows:
|
| 39 |
+
|
| 40 |
+
- We propose an efficient CPU-GPU I/O-aware LLM inference method that leverages KV cache partial recomputation with asynchronous KV cache transfer that overlaps compute and communication to address the system bottleneck of loading large KV cache from CPU memories.
|
| 41 |
+
- We develop a framework based on linear integer programming that achieves optimal computation-communication distribution.
|
| 42 |
+
- Our experimental results show that KVPR outperforms the current state-of-the-art approaches up to $35.8\%$ in terms of latency and $46.2\%$ in terms of throughput.
|
| 43 |
+
|
| 44 |
+
# 2 Background
|
| 45 |
+
|
| 46 |
+
LLM inference process. The inference process of decoder-only LLMs employs an auto-regressive approach, generating tokens sequentially. It consists of two stages: the prefilling stage and the decoding stage. In the prefilling stage, the input to the $i$ -th decoder layer is denoted as $X^i \in \mathbb{R}^{b \times s \times h}$ , where $i \in \{1, \dots, n\}$ , $b$ is the batch size, $s$ is the prompt length, and $h$ is the input embedding dimension. The Multi-Head Attention (MHA) block computes a set of queries $(Q)$ , keys $(K)$ , and values $(V)$ through linear projections of $X^i$ :
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
Q ^ {i} = X ^ {i} \cdot W _ {Q} ^ {i}, K ^ {i} = X ^ {i} \cdot W _ {K} ^ {i}, V ^ {i} = X ^ {i} \cdot W _ {V} ^ {i}, (1)
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where $W_{Q}^{i}, W_{K}^{i}, W_{V}^{i} \in \mathbb{R}^{h \times h}$ are the projection matrices. The generated $K^{i}$ and $V^{i}$ are stored in the KV cache.
|
| 53 |
+
|
| 54 |
+
The self-attention score in MHA is computed as:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
Z ^ {i} = \operatorname {s o f t m a x} \left(\frac {Q ^ {i} \left(K ^ {i}\right) ^ {T}}{\sqrt {d _ {\text {h e a d}}}}\right) \cdot V ^ {i}, \tag {2}
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $d_{\mathrm{head}}$ represents the dimension of each attention head. Finally, the attention score is applied with a linear projection to produce the output of the MHA block:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
O ^ {i} = Z ^ {i} \cdot W _ {O} ^ {i}, \tag {3}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $W_{O}^{i}\in \mathbb{R}^{h\times h}$ is the projection matrix.
|
| 67 |
+
|
| 68 |
+
The feedforward network (FFN) is followed after the MHA block, which consists of two fully connected layers with a non-linear activation function applied between them. It processes the attention output $O^i$ to generate the input for the next decoder layer as follows:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
X ^ {i + 1} = \sigma \left(O ^ {i} \cdot W _ {1} ^ {i}\right) \cdot W _ {2} ^ {i}, \tag {4}
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
where $W_1^i \in \mathbb{R}^{h \times d_{\mathrm{FFN}}}$ and $W_2^i \in \mathbb{R}^{d_{\mathrm{FFN}} \times h}$ are the weight matrices of the two linear layers, and $\sigma(\cdot)$ denotes the activation function.
|
| 75 |
+
|
| 76 |
+
In the decoding stage, the $i$ -th decoder layer receives a single token $x^{i} \in \mathbb{R}^{b \times 1 \times h}$ . The KV cache is updated by concatenating the newly computed key and value pairs with the existing ones:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
K ^ {i} = \operatorname {c o n c a t} \left(K ^ {i}, x ^ {i} \cdot W _ {K} ^ {i}\right), \tag {5}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
V ^ {i} = \operatorname {c o n c a t} \left(V ^ {i}, x ^ {i} \cdot W _ {V} ^ {i}\right).
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
The remaining attention and feedforward computations in the decoding stage are identical to those in the prefilling stage.
|
| 87 |
+
|
| 88 |
+
# 3 Proposed Method
|
| 89 |
+
|
| 90 |
+
LLM inference scheduling. Our approach aims at LLM inference systems with large KV caches that are stored on CPU DRAM and fetched into GPU memory as needed. Since LLMs have many layers and many batches of inputs to process, there are different scheduling strategies to determine how computations are performed across batches and layers to optimize for specific performance goals, such as minimizing latency or maximizing throughput. Row-by-row schedule (as shown in Appendix A.1) processes one batch at a time, using layer-wise execution. In this scenario, model weights are kept in GPU memory whenever feasible. If the model weights are also offloaded to the CPU, both the KV cache and the model weights for a single layer are transferred to the GPU, processed for the current batch, and then cleared. This process is repeated layer by layer until a token is generated. When minimizing latency is the primary goal, this approach is preferred because all prompts in a batch are fully processed to generate their complete context before proceeding to the next batch.
|
| 91 |
+
|
| 92 |
+
Column-by-column scheduling (Appendix A.1) is more effective for maximizing throughput by increasing the effective batch size (number of batches times batch size) to process more sequences in parallel, at the cost of longer latency. In this approach, the model weights are offloaded to CPU memory to accommodate a large batch size. The model weights and KV cache for a single layer are transferred to GPU memory and processed for the first batch. Instead of moving to the next layer for the current batch, subsequent batches are processed using the same layer while keeping the weights stationary in GPU memory. Once a group of batches is processed for the first layer, the process moves to the second layer for each batch. Note that the effective batch size is limited by the available storage for activations and KV cache, as they must still be stored in CPU memory or external storage once they exceed the GPU memory capacity.
|
| 93 |
+
|
| 94 |
+
Our proposed design is independent of the scheduling strategy, whether row-by-row or column-by-column, and aims to overlap the majority of the PCIe transfer time with GPU computations, thereby improving overall efficiency.
|
| 95 |
+
|
| 96 |
+
# 3.1 Design Overview
|
| 97 |
+
|
| 98 |
+
To relieve PCIe pressure and improve GPU computation utilization, we propose a novel method,
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 2: Design overview of KVPR. User configuration and profiling inform the scheduler, which computes an optimal KV cache recompute ratio. The runtime then overlaps data transfer and GPU computation to improve inference efficiency.
|
| 102 |
+
|
| 103 |
+
KVPR, that recomputes partial KV cache on the GPU while transferring the rest of the KV cache to the GPU. As shown in Figure 2, KVPR comprises three main modules: the profiler, scheduler, and runtime. User configuration includes performance objective (i.e., latency or throughput), data parameters such as prompt length, generation length, batch size, and model information like input embedding dimension and number of layers. The profiler module gathers system statistics, which provide insights into hardware characteristics like PCIe bandwidth and GPU processing speed. For example, the profiler module utilizes the batch size, model information, and sequence length to characterize PCIe bandwidth. Using this information along with the user configuration, the scheduler module calculates the best KV cache split point for recomputation by solving a linear programming problem, aiming to maximize the overlap between the computation and communication operations and utilization of both GPU and PCIe bandwidth during the inference process. The runtime module, in turn, utilizes this execution strategy to process user inputs and manage the memory allocation and data transfer streams.
|
| 104 |
+
|
| 105 |
+
# 3.2 Scheduler Module
|
| 106 |
+
|
| 107 |
+
In this section, we describe how KVPR is adopted to either the row-by-row or column-by-column schedule.
|
| 108 |
+
|
| 109 |
+
Row-by-row schedule with KV cache partial re-computation. If the performance objective is to minimize latency, the scheduler module will initiate a row-by-row execution plan. The naive offloading pipeline of a row-by-row schedule is shown in Figure 3(a), where both the KV cache and model weights are offloaded to CPU memory. The required data are transferred asynchronously over
|
| 110 |
+
|
| 111 |
+
PCIe to the GPU for executing the MHA and FFN blocks. Storing newly generated KV pairs to CPU memory is omitted from the figure for simplicity. Since the KV cache is larger in size compared to the MHA weights, it arrives at the GPU later during the asynchronous transfer. The pipeline is slightly different if model weights are not offloaded to the CPU. In this case, only the MHA block will wait for the KV cache data to be transferred to the GPU before starting the computation.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 3: Comparison of two offloading pipelines.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
(a) Naive offloading pipeline for row-wise scheduling with asynchronous data transfer. GPU and PCIe denote GPU computation and data transfer, with arrows indicating data dependencies.
|
| 118 |
+
(b) Offloading pipeline for row-wise scheduling with KV cache partial recomputation.
|
| 119 |
+
|
| 120 |
+
In KVPR, rather than transferring the entire KV cache from CPU memory to GPU memory, the GPU recomputes partial KV cache using corresponding input activations that are transferred from CPU first, while the remaining KV cache is asynchronously transferred to the GPU, as illustrated in Figure 3(b). The GPU then merges the recomputed KV cache with the transferred KV cache to perform MHA computations.
|
| 121 |
+
|
| 122 |
+
Column-by-column schedule with KV cache partial recomputation. When the performance objective is to maximize throughput, the scheduler module adopts a column-by-column execution plan. This approach, illustrated in Figure 4, accommodates large batch size inference by reusing model
|
| 123 |
+
|
| 124 |
+
weights across multiple batches. As soon as the KV cache for batch 0 is fully transmitted, the activations for batch 1 are transferred. Simultaneously, the GPU begins computing the MHA for batch 0. Unlike the row-by-row schedule, which processes all layers sequentially within a single batch before moving to the next batch, the column-by-column schedule processes multiple batches on the same layer. As a result, activations corresponding to the recomputed KV cache must be stored until generation for that batch is complete.
|
| 125 |
+
|
| 126 |
+
<table><tr><td colspan="2">GPU</td><td>KV0</td><td>MHA0</td><td>KV1</td><td>MHA1</td></tr><tr><td>PCIe</td><td>MHA</td><td>X0</td><td>KV0</td><td>X1</td><td>KV1</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>...</td></tr></table>
|
| 127 |
+
|
| 128 |
+
Figure 4: Offloading pipeline for column-wise scheduling with KV cache partial recomputation to maximize throughput.
|
| 129 |
+
|
| 130 |
+
Determining the optimal KV cache split point. In both scheduling methods, the objective is to identify the optimal split point, which defines the division of the KV cache between the portion recomputed on the GPU and the portion transferred from CPU memory. This problem can be formulated as a linear programming problem. The row-by-row schedule can be viewed as a special case of the column-by-column schedule, where activations for recomputing the KV cache are not transferred. We first formulate the problem for the column-by-column schedule and then demonstrate how it simplifies to the row-by-row schedule.
|
| 131 |
+
|
| 132 |
+
Given the current sequence length $s'$ , which is greater than the prompt length $s$ , the activation transferred to the GPU in the $i$ -th layer is represented by $X^i[0:l]$ , where $0 \leq l \leq s'$ . The remaining KV cache for the subsequent tokens is denoted by $K^i[l:s']$ and $V^i[l:s']$ . The memory usage of these activations is:
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\begin{array}{l} M _ {X ^ {i} [ 0: l ]} = b \times l \times h \times p, \\ M _ {K V ^ {i} [ l: s ^ {\prime} ]} = 2 \times b \times \left(s ^ {\prime} - l\right) \times h \times p. \tag {6} \\ \end{array}
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
Recomputing the KV cache for $X^i[0:l]$ requires:
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
\begin{array}{l} K ^ {i} [ 0: l ] = X ^ {i} [ 0: l ] \cdot W _ {K} ^ {i}, \\ V ^ {i} [ 0: l ] = X ^ {i} [ 0: l ] \cdot W _ {V} ^ {i}. \tag {7} \\ \end{array}
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
This recomputation on the GPU requires floating-point operations of
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
N _ {K V ^ {i} [ 0: l ]} = 4 \times b \times l \times h ^ {2}. \tag {8}
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
Consequently, the recomputation time $t_{gpu}^{i}$ for the KV cache is given by
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
t _ {r e c o m p} ^ {i} = \frac {N _ {K V ^ {i} [ 0 : l ]}}{v _ {g p u}}, \tag {9}
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+
where $v_{gpu}$ denotes the GPU processing speed. The total time $t^i$ for processing is as follows:
|
| 157 |
+
|
| 158 |
+
$$
|
| 159 |
+
t ^ {i} = \frac {M _ {X ^ {i} [ 0 : l ]}}{v _ {\text {c o m}}} + \max \left(t _ {\text {r e c o m p}} ^ {i}, \frac {M _ {K V ^ {i} [ l : s ^ {\prime} ]}}{v _ {\text {c o m}}}\right), \tag {10}
|
| 160 |
+
$$
|
| 161 |
+
|
| 162 |
+
where $v_{com}$ represents the data transmission speed for activations and KV cache.
|
| 163 |
+
|
| 164 |
+
The objective is to determine the optimal $l$ that minimizes this total processing time $t^i$ , which becomes a linear programming problem:
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
\min _ {l} t ^ {i} \tag {11}
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
$$
|
| 171 |
+
\begin{array}{l l} \text {s . t .} & 0 \leq l \leq s \quad \forall i \in \{1, \dots , n \}. \end{array}
|
| 172 |
+
$$
|
| 173 |
+
|
| 174 |
+
The optimal split point $l$ depends on the current sequence length $s'$ , which increases during generation and must therefore be determined adaptively. Fortunately, solving this linear programming problem is computationally negligible because there is only one integer variable. If the first term in Eq. (10) is omitted, the problem simplifies to the row-by-row schedule.
|
| 175 |
+
|
| 176 |
+
# 3.3 Runtime Module
|
| 177 |
+
|
| 178 |
+
Asynchronous overlapping. To enable concurrent execution of GPU computation and CPU-GPU communication, the runtime module employs a communication parallelism strategy with six processes: weight loading, KV cache loading, activation loading, recomputed activation loading, KV cache storing, and activation storing, as detailed in Appendix A.2. By incorporating double buffering and prefetching techniques, it simultaneously loads weights for the next layer, and retrieves activations for KV cache recomputation and KV cache for the next batch, while storing cache and activations from the previous batch and processing the current batch.
|
| 179 |
+
|
| 180 |
+
Pinned memory. To optimize data transfer, like prior works (Sheng et al., 2023; Yu et al., 2024), we utilize pinned CPU memory for recomputed activation and the weights that are transferred to the GPU. Using pinned memory enables faster and asynchronous transfer, as it avoids the need to page data in and out.
|
| 181 |
+
|
| 182 |
+
Hiding KV cache partial recomputation. If both the KV cache and model weights are offloaded, and the size of the transferred KV cache is smaller than the size of the model weights, a coarse-grained
|
| 183 |
+
|
| 184 |
+
computation pipeline with KV cache partial recomputation may degrade inference performance. This occurs because recomputation waits until all MHA weights $(W_{Q}, W_{K}, W_{V},$ and $W_{O})$ are fully loaded, as shown in Figure 5(a), which delays the MHA computation. However, KV cache recomputation only requires $W_{K}$ and $W_{V}$ (Eq. (7)), making it unnecessary to wait for the complete weight loading process. To address this, we implement a fine-grained MHA pipeline that prioritizes loading $W_{K}$ and $W_{V}$ first. Once these weights are available, KV cache recomputation can begin immediately. As illustrated in Figure 5(b), $W_{K}$ and $W_{V}$ are used for KV cache partial recomputation, followed by the use of $W_{Q}$ and $W_{O}$ for MHA computation. This approach effectively overlaps KV cache recomputation with weight loading, ensuring that in the worst-case scenario, the method performs no worse than the baseline bottlenecked by weight loading.
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 5: Comparison of offloading pipelines with different levels of granularity in the MHA layer.
|
| 188 |
+
|
| 189 |
+
(a) Coarse-grained offloading pipeline with delayed KV cache partial recomputation.
|
| 190 |
+
|
| 191 |
+

|
| 192 |
+
|
| 193 |
+
(b) Fine-grained offloading pipeline overlapping KV cache recomputation with weights loading.
|
| 194 |
+
|
| 195 |
+
# 4 Experiments
|
| 196 |
+
|
| 197 |
+
Hardware. In our experiments, we utilize an NVIDIA A100 GPU with 40 GB of memory, connected to the CPU through a PCIe $4.0 \times 16$ interface, which provides a bandwidth of 32 GB/s. The CPU is an AMD EPYC processor with 64 cores, operating at 2.6 GHz. Our method and implementation automatically adapt to the underlying hardware, which allows for flexible deployment across diverse system architectures.
|
| 198 |
+
|
| 199 |
+
Model. We evaluate KVPR using OPT models (Zhang et al., 2022) with parameter sizes ranging from 6.7B to 30B. While our experiments focus on OPT models, the recomputation technique presented in this work is compatible with other LLM architectures, such as LLaMa (Touvron et al., 2023) and GPT-3 (Brown et al., 2020), due to their similar attention mechanisms (Vaswani et al., 2017).
|
| 200 |
+
|
| 201 |
+
Workload. We evaluate KVPR on two types
|
| 202 |
+
|
| 203 |
+
of workloads: latency-oriented and throughput-oriented. In the latency-oriented workload, the model weights are retained in GPU memory to avoid the costly repeated loading. Due to the limited memory size of a GPU, experiments are conducted using OPT-6.7B and OPT-13B. In the throughput-oriented workload, model weights are offloaded to the CPU after computation to free more GPU memory for handling larger batches. This setup is evaluated using OPT-6.7B, OPT-13B, and OPT-30B.
|
| 204 |
+
|
| 205 |
+
To provide accurate comparisons, we use the same datasets as those in FlexGen (Sheng et al., 2023) with prompts uniformly padded to the same length, with models configured to generate 32 or 128 tokens per prompt. To evaluate performance across different input scenarios, our evaluation uses prompt lengths of 256, 512, and 1024 tokens. Performance metrics include decoding latency (time taken to generate tokens) for latency-oriented workloads and decoding throughput (tokens generated per second) for throughput-oriented workloads, as KVPR does not impact prefilling performance. We report an average decoding latency and throughput across five test runs, respectively.
|
| 206 |
+
|
| 207 |
+
Baseline. In our experiments, we use DeepSpeed Inference (Aminabadi et al., 2022), Hugging Face Accelerate (Gugger et al., 2022) as the baseline for latency-oriented workload experiments, as Hugging Face Transformers library currently supports KV cache offloading to CPU memory while still retaining the model weights in GPU memory. We use FlexGen (Sheng et al., 2023) as the baseline for throughput-oriented workload experiments, as it supports column-by-column schedule by offloading both model weights and KV cache to the CPU.
|
| 208 |
+
|
| 209 |
+
Implementation. KVPR is implemented on top of Hugging Face Transformers (v4.46.1) (Wolf et al., 2020) and FlexGen (Sheng et al., 2023) frameworks to ensure fair comparison with baselines. In the Transformers implementation, we utilize double buffering in GPU memory to overlap KV cache transfer across decoder layers. For both the Transformers and FlexGen implementations, we utilize CUDA streams to enable asynchronous overlapping as described in Algorithm 1.
|
| 210 |
+
|
| 211 |
+
# 4.1 Latency-oriented Experiments
|
| 212 |
+
|
| 213 |
+
We evaluate the decoding latency required to complete a single batch for settings of different sequence lengths. Figure 7 shows that KVPR consistently outperforms the baselines, DeepSpeed Infer
|
| 214 |
+
|
| 215 |
+

|
| 216 |
+
|
| 217 |
+

|
| 218 |
+
|
| 219 |
+

|
| 220 |
+
|
| 221 |
+

|
| 222 |
+
Figure 6: Throughput comparison for various models and configurations.
|
| 223 |
+
|
| 224 |
+

|
| 225 |
+
|
| 226 |
+

|
| 227 |
+
|
| 228 |
+
ence and Hugging Face Accelerate, for both OPT-6.7B and OPT-13B. The experimental results show that KVPR reduces decoding latency, especially at longer generation lengths. For instance, OPT 6.7B at a prompt length of 128 with 128 tokens generated, the latency is reduced by approximately $35.8\%$ compared to Hugging Face Accelerate. Detailed experiential results including KV cache size, GPU peak memory usage, and optimal recomputation split points over the generation process are provided in Appendix A.3 and A.4.
|
| 229 |
+
|
| 230 |
+

|
| 231 |
+
Figure 7: Decoding latency for a single batch of size 64 across different sequence lengths.
|
| 232 |
+
|
| 233 |
+
# 4.2 Throughput-oriented Experiments
|
| 234 |
+
|
| 235 |
+
We also evaluate throughput performance during the decoding stage, as KVPR does not affect the prefilling stage. To maximize throughput, we set the effective batch size to be 32 by 8, meaning each layer computes on 8 batches of size 32 se
|
| 236 |
+
|
| 237 |
+
sequentially before moving to the next layer. The first row of Figure 6 shows the results, demonstrating that KVPR consistently outperforms FlexGen under settings of all sequence lengths for different models. It achieves up to $15.1\%$ , $46.2\%$ , and $29.0\%$ speedup in throughput for OPT-6.7B, OPT-13B, and OPT-30B, respectively. Additional experimental results on a low-end GPU system are provided in Appendix A.5.
|
| 238 |
+
|
| 239 |
+
We also compare KVPR with FlexGen for varying batch sizes from 1 to 48 with a fixed prompt length of 1,024 and a generation length of 32, as shown in the second row of Figure 6. KVPR consistently outperforms FlexGen across all batch sizes. As the KV cache grows larger, KVPR shows greater performance benefits due to reduced KV cache transfer over the PCIe bus.
|
| 240 |
+
|
| 241 |
+
# 4.3 GPU Utilization
|
| 242 |
+
|
| 243 |
+
To evaluate the efficiency improvement, we analyze the temporal resource utilization of KVPR and FlexGen as shown in Figure 8. At first in the prefilling stage, both methods reach full GPU utilization since the prefilling stage is compute-bound. However, in the decoding stage, in contrast to FlexGen, KVPR enhances GPU utilization, increasing it from $85\%$ to $99\%$ on average by overlapping GPU computations with CPU-GPU data transfer, while maintaining the same peak memory usage indicated by the black lines.
|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
Figure 8: Computation and memory resource usage of KVPR and FlexGen during decoding stage.
|
| 247 |
+
|
| 248 |
+
# 4.4 KV Cache Compression
|
| 249 |
+
|
| 250 |
+
We apply group-wise 4-bit quantization to compress the KV cache, which has been shown to have minimal impact on model accuracy (Sheng et al., 2023). Figure 9 shows that applying compression reduces the amount of data transferred to the GPU, leading to further improvements in decoding throughput. These results showcase the compatibility of KVPR with KV cache compression and its potential to achieve additional performance gains by alleviating PCIe bandwidth bottlenecks.
|
| 251 |
+
|
| 252 |
+

|
| 253 |
+
Figure 9: Decoding throughput improvement with KV cache compression enabled on OPT-13B model.
|
| 254 |
+
|
| 255 |
+
# 4.5 Ablation Study
|
| 256 |
+
|
| 257 |
+
Hiding KV cache partial recomputation. To evaluate the effectiveness of the fine-grained offloading pipeline that overlaps KV cache recomputation with weight loading, we conduct experiments using the OPT-6.7B model. In this ablation, we use a small KV cache size to ensure that MHA weights always arrive at the GPU later than the KV cache. Table 2 presents decoding latency across varying smaller batch sizes, comparing three configurations: FlexGen, KVPR without hiding KV cache recomputation, and KVPR with hiding. When the batch size is 1 and the KV cache size is the smallest, FlexGen can outperform KVPR without hiding. By
|
| 258 |
+
|
| 259 |
+
overlapping the transfer of MHA weights with KV cache recomputation, KVPR ensures performance that is no worse than FlexGen under this scenario, particularly when weight loading is the primary bottleneck. This result shows that KVPR works well for both small and large batch size settings, thereby providing a unified approach to improve decoding performance.
|
| 260 |
+
|
| 261 |
+
<table><tr><td>Batch size</td><td>1</td><td>2</td><td>4</td><td>8</td><td>16</td><td>32</td></tr><tr><td>KV cache (MB)</td><td>3</td><td>6</td><td>12</td><td>24</td><td>48</td><td>64</td></tr><tr><td>FlexGen</td><td>1.761</td><td>3.488</td><td>6.646</td><td>12.826</td><td>23.795</td><td>41.210</td></tr><tr><td>KVPR (w/o. hiding KV recomputation)</td><td>1.749</td><td>3.461</td><td>6.766</td><td>12.930</td><td>23.613</td><td>43.462</td></tr><tr><td>KVPR (w. hiding KV recomputation)</td><td>1.774</td><td>3.586</td><td>6.696</td><td>12.986</td><td>24.557</td><td>43.945</td></tr></table>
|
| 262 |
+
|
| 263 |
+
Table 2: OPT-6.7B model with prompt and generation lengths of 256 and 64, respectively. Each MHA block $(W_{Q}, W_{K}, W_{V},$ and $W_{O})$ requires 128 MB of memory.
|
| 264 |
+
|
| 265 |
+
Runtime breakdown. Figure 10 presents the runtime breakdown of an MHA block in KVPR and FlexGen during the decoding stage. KVPR achieves a substantial reduction in KV cache transfer time, decreasing it from $58\%$ to $38\%$ , with activation transfer contributing only $8\%$ of the total runtime. By recomputing the partial KV cache from the transferred activations, GPU computation time increases from $2.3\%$ to $13.3\%$ . This demonstrates that KVPR effectively overlaps GPU computation with CPU-GPU communication, substantially reducing the data transfer volume from CPU to GPU and alleviating the PCIe bottleneck that limits LLM inference performance.
|
| 266 |
+
|
| 267 |
+

|
| 268 |
+
Figure 10: Runtime breakdown of KVPR and FlexGen.
|
| 269 |
+
|
| 270 |
+
# 5 Related Works
|
| 271 |
+
|
| 272 |
+
To address the memory demands of LLMs in resource-constrained settings, offloading techniques aim to minimize the latency of data transfer between CPUs and GPUs. FlexGen (Sheng et al., 2023) proposes to offload weights, activations, and KV cache to CPU memory or external storage and maximizes throughput for larger batch sizes by formulating the optimization as a graph traversal
|
| 273 |
+
|
| 274 |
+
problem. HeteGen (Zhao et al., 2024a) uses the CPU for partial computation on offloaded weights while transferring the remaining workload to the GPU. TwinPilots (Yu et al., 2024) further optimizes workload balancing between the CPU and GPU at the operator level. FastDecode (He and Zhai, 2024) reduces KV cache data movement by offloading the KV cache and attention computation entirely to the CPU. Park and Egger and Neo (Jiang et al., 2024) overlap GPU linear projection computations with CPU-based attention computations across multiple batches to improve resource utilization.
|
| 275 |
+
|
| 276 |
+
ALISA (Zhao et al., 2024b) compresses the KV cache based on sparsity and offloads KV cache exceeding GPU memory capacity. When loading the KV cache to the GPU, ALISA recomputes a portion of the KV cache first and then transfers the remainder, where we propose overlapping the recomputation and transfer by adaptively determining the optimal split point. Furthermore, ALISA addresses only the row-by-row schedule, while KVPR extends to the column-by-column schedule. KVPR is orthogonal to CPU-assisted and KV cache compression approaches, making it compatible for integration with these techniques to further improve overall system performance. As shown in the additional experiments provided in Appendix A.7, we demonstrate that the CPU can become a bottleneck in certain distributed system configurations. In contrast, KVPR optimizes GPU utilization and data transfer efficiency without relying on additional CPU resources or approximations of the KV cache.
|
| 277 |
+
|
| 278 |
+
# 6 Conclusion
|
| 279 |
+
|
| 280 |
+
In this paper, we introduce KVPR, an efficient CPU-GPU I/O-aware LLM inference method designed to accelerate KV cache loading. KVPR minimizes the data transfer between the CPU and GPU by leveraging KV cache partial recomputation. By overlapping this recomputation with data transmission, KVPR significantly reduces idle GPU time and enhances overall inference performance. Future work could extend our method to tolerate KV cache loading from remote network storage or scale to large multi-GPU infrastructure, further enhancing its applicability and performance in diverse deployment scenarios.
|
| 281 |
+
|
| 282 |
+
# 7 Limitations
|
| 283 |
+
|
| 284 |
+
Our study represents an important step towards optimizing the efficiency of LLM inference by
|
| 285 |
+
|
| 286 |
+
leveraging KV cache partial recomputation. However, KVPR has certain limitations that suggest avenues for future research. First, our methodology is currently limited to single-GPU and data-parallel multi-GPU inference. It does not yet extend to advanced distributed systems, such as model or tensor parallelism. Expanding this approach to these paradigms could enable support for larger model sizes. Second, while we address PCIe bandwidth bottlenecks in CPU-GPU communication, we do not consider scenarios where the KV cache is loaded from disk or network storage. Nevertheless, KVPR could potentially be adapted to accelerate the prefilling stage in such setups. Third, the current implementation performs system profiling only at the start of inference, assuming static hardware conditions throughout the process. Incorporating dynamic profiling and runtime adaptive optimization could enhance the robustness and efficiency of the approach, particularly in heterogeneous or multi-tenant environments.
|
| 287 |
+
|
| 288 |
+
# 8 Acknowledgment
|
| 289 |
+
|
| 290 |
+
We sincerely thank all the reviewers for their time and constructive comments. This material is based upon work supported by NSF award number 2224319, REAL@USC-Meta center, and VMware gift. The views, opinions, and/or findings expressed are those of the author(s) and should not be interpreted as representing the official views or policies of the U.S. Government.
|
| 291 |
+
|
| 292 |
+
# References
|
| 293 |
+
|
| 294 |
+
Reza Yazdani Aminabadi, Samyam Rajbhandari, Ammar Ahmad Awan, Cheng Li, Du Li, Elton Zheng, Olatunjri Ruwase, Shaden Smith, Minjia Zhang, Jeff Rasley, et al. 2022. Deepspeed-inference: enabling efficient inference of transformer models at unprecedented scale. In SC22: International Conference for High Performance Computing, Networking, Storage and Analysis, pages 1-15. IEEE.
|
| 295 |
+
|
| 296 |
+
Zhihao Bai, Zhen Zhang, Yibo Zhu, and Xin Jin. 2020. PipeSwitch: Fast pipelined context switching for deep learning applications. In 14th USENIX Symposium on Operating Systems Design and Implementation (OSDI 20), pages 499-514.
|
| 297 |
+
|
| 298 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens
|
| 299 |
+
|
| 300 |
+
Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877-1901.
|
| 301 |
+
Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. 2024. Flashattention: fast and memory-efficient exact attention with io-awareness. In Proceedings of the 36th International Conference on Neural Information Processing Systems, NIPS '22.
|
| 302 |
+
Tri Dao, Daniel Haziza, Francisco Massa, and Grigory Sizov. 2023. Flash decoding: Advances in efficient text generation.
|
| 303 |
+
Shiwei Gao, Youmin Chen, and Jiwu Shu. 2025. Fast state restoration in llm serving with hcache. In Proceedings of the Twentieth European Conference on Computer Systems, pages 128-143.
|
| 304 |
+
Google Gemini Team. 2024. Gemini: A family of highly capable multimodal models. Preprint, arXiv:2312.11805.
|
| 305 |
+
Shijie Geng, Shuchang Liu, Zuohui Fu, Yingqiang Ge, and Yongfeng Zhang. 2022. Recommendation as language processing (rlp): A unified pretrain, personalized prompt & predict paradigm (p5). In Proceedings of the 16th ACM Conference on Recommender Systems, RecSys '22, page 299-315.
|
| 306 |
+
Sylvain Gugger, Lysandre Debut, Thomas Wolf, Philipp Schmid, Zachary Mueller, Sourab Mangrulkar, Marc Sun, and Benjamin Bossan. 2022. Accelerate: Training and inference at scale made simple, efficient and adaptable. https://github.com/huggingface/accelerate.
|
| 307 |
+
Jiaao He and Jidong Zhai. 2024. Fastdecode: High-throughputgpu-efficient llm serving using heterogeneous pipelines. Preprint, arXiv:2403.11421.
|
| 308 |
+
Coleman Richard Charles Hooper, Sehoon Kim, Hiva Mohammadzadeh, Michael W. Mahoney, Sophia Shao, Kurt Keutzer, and Amir Gholami. 2024. KVQuant: Towards 10 million context length LLM inference with KV cache quantization. In The Thirty-eighth Annual Conference on Neural Information Processing Systems.
|
| 309 |
+
Xuanlin Jiang, Yang Zhou, Shiyi Cao, Ion Stoica, and Minlan Yu. 2024. Neo: Saving cpu memory crisis with cpu offloading for online llm inference. Preprint, arXiv:2411.01142.
|
| 310 |
+
Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph Gonzalez, Hao Zhang, and Ion Stoica. 2023. Efficient memory management for large language model serving with pagedattention. In Proceedings of the 29th Symposium on Operating Systems Principles, SOSP '23, page 611-626.
|
| 311 |
+
|
| 312 |
+
Wonbeom Lee, Jungi Lee, Junghwan Seo, and Jaewoong Sim. 2024. InfiniGen: Efficient generative inference of large language models with dynamic KV cache management. In 18th USENIX Symposium on Operating Systems Design and Implementation (OSDI 24), pages 155-172.
|
| 313 |
+
Guohao Li, Hasan Abed Al Kader Hammoud, Hani Itani, Dmitrii Khizbullin, and Bernard Ghanem. 2023. Camel: Communicative agents for "mind" exploration of large language model society. Preprint, arXiv:2303.17760.
|
| 314 |
+
Yuhan Liu, Hanchen Li, Yihua Cheng, Siddhant Ray, Yuyang Huang, Qizheng Zhang, Kuntai Du, Jiayi Yao, Shan Lu, Ganesh Ananthanarayanan, Michael Maire, Henry Hoffmann, Ari Holtzman, and Junchen Jiang. 2024a. Cachegen: Kv cache compression and streaming for fast large language model serving. In Proceedings of the ACM SIGCOMM 2024 Conference, ACM SIGCOMM '24, page 38-56.
|
| 315 |
+
Zirui Liu, Jiayi Yuan, Hongye Jin, Shaochen Zhong, Zhaozhuo Xu, Vladimir Braverman, Beidi Chen, and Xia Hu. 2024b. KIVI: A tuning-free asymmetric 2bit quantization for KV cache. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 32332-32344.
|
| 316 |
+
OpenAI, Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, and et al. 2024. Gpt-4 technical report. Preprint, arXiv:2303.08774.
|
| 317 |
+
Daon Park and Bernhard Egger. 2024. Improving throughput-oriented llm inference with cpu computations. In Proceedings of the 2024 International Conference on Parallel Architectures and Compilation Techniques, pages 233-245.
|
| 318 |
+
Ying Sheng, Lianmin Zheng, Binhang Yuan, Zhuohan Li, Max Ryabinin, Beidi Chen, Percy Liang, Christopher Ré, Ion Stoica, and Ce Zhang. 2023. Flexgen: high-throughput generative inference of large language models with a singlegpu. In Proceedings of the 40th International Conference on Machine Learning, ICML'23.
|
| 319 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. 2023. Llama: Open and efficient foundation language models. Preprint, arXiv:2302.13971.
|
| 320 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30.
|
| 321 |
+
Zhongwei Wan, Xin Wang, Che Liu, Samiul Alam, Yu Zheng, Jiachen Liu, Zhongnan Qu, Shen Yan, Yi Zhu, Quanlu Zhang, Mosharaf Chowdhury, and Mi Zhang. 2024. Efficient large language models: A survey. Transactions on Machine Learning Research.
|
| 322 |
+
|
| 323 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations.
|
| 324 |
+
Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, and Mike Lewis. 2024. Efficient streaming language models with attention sinks. In *The Twelfth International Conference on Learning Representations*.
|
| 325 |
+
Chengye Yu, Tianyu Wang, Zili Shao, Linjie Zhu, Xu Zhou, and Song Jiang. 2024. Twinpilots: A new computing paradigm forgpu-cpu parallel llm inference. In Proceedings of the 17th ACM International Systems and Storage Conference, SYSTOR '24, page 91-103.
|
| 326 |
+
Gyeong-In Yu, Joo Seong Jeong, Geon-Woo Kim, Soojeong Kim, and Byung-Gon Chun. 2022. Orca: A distributed serving system for Transformer-Based generative models. In 16th USENIX Symposium on Operating Systems Design and Implementation (OSDI 22), pages 521-538.
|
| 327 |
+
Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. 2022. Opt: Open pre-trained transformer language models. Preprint, arXiv:2205.01068.
|
| 328 |
+
Zhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen, Lianmin Zheng, Ruisi Cai, Zhao Song, Yuan-dong Tian, Christopher Re, Clark Barrett, Zhangyang Wang, and Beidi Chen. 2023. H2o: Heavy-hitter oracle for efficient generative inference of large language models. In Thirty-seventh Conference on Neural Information Processing Systems.
|
| 329 |
+
Xuanlei Zhao, Bin Jia, Haotian Zhou, Ziming Liu, Shenggan Cheng, and Yang You. 2024a. Hetegen: Efficient heterogeneous parallel inference for large language models on resource-constrained devices. In MLSys.
|
| 330 |
+
Youpeng Zhao, Di Wu, and Jun Wang. 2024b. ALISA: Accelerating Large Language Model Inference via Sparsity-Aware KV Caching. In 2024 ACM/IEEE 51st Annual International Symposium on Computer Architecture (ISCA), pages 1005-1017.
|
| 331 |
+
Wenhao Zhu, Hongyi Liu, Qingxiu Dong, Jingjing Xu, Shujian Huang, Lingpeng Kong, Jiajun Chen, and Lei Li. 2024. Multilingual machine translation with
|
| 332 |
+
|
| 333 |
+
large language models: Empirical results and analysis. In Findings of the Association for Computational Linguistics: NAACL 2024, pages 2765-2781.
|
| 334 |
+
|
| 335 |
+
# A Appendix
|
| 336 |
+
|
| 337 |
+
# A.1 Scheduling Methods
|
| 338 |
+
|
| 339 |
+
Figures 11 illustrates two decoding schedules for generating 2 tokens from a model with three layers $(L_0, L_1, \text{and} L_2)$ during the decoding stage. In Figure 11(a), the row-by-row schedule processes each batch across all layers before moving to the next batch. In contrast, Figure 11(b) shows the column-by-column schedule, where each layer is reused to process a group of batches before moving to the next layer.
|
| 340 |
+
|
| 341 |
+

|
| 342 |
+
(a) row-wise scheduling.
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
(b) column-wise scheduling.
|
| 346 |
+
Figure 11: Two different scheduling methods, with arrows indicating the scheduling order.
|
| 347 |
+
|
| 348 |
+
# A.2 KV Cache Partial Recomputation with Overlapping
|
| 349 |
+
|
| 350 |
+
Built on FlexGen (Sheng et al., 2023)'s computation and communication overlapping technique, we adapt it to support KV cache partial recomputation. Algorithm 1 enables simultaneous execution of tasks within the innermost loop, including loading weights for the next layer, loading activations for KV cache recomputation, recomputing the partial KV cache, loading the rest of the KV cache and activations for the next batch, storing the KV cache and activations for the previous batch, and performing computation for the current batch. Although the algorithm is designed for column-by-column scheduling, the row-by-row schedule with a single batch is a special case of it.
|
| 351 |
+
|
| 352 |
+
Algorithm 1 KV Cache Partial Recomputation with Overlapping
|
| 353 |
+
for $i = 1$ to generation_length do
|
| 354 |
+
for $j = 1$ to num_layers do
|
| 355 |
+
for $k = 1$ to num_GPU_batches do
|
| 356 |
+
// Load the weight of the next layer
|
| 357 |
+
load_weight $(i,j + 1,k)$
|
| 358 |
+
// Load the activation for KV cache re-computation of the next batch
|
| 359 |
+
loadactivation_recompute $(i,j,k + 1)$
|
| 360 |
+
// Load the KV cache and activation of the next batch
|
| 361 |
+
load_cache $(i,j,k + 1)$
|
| 362 |
+
loadActivation $(i,j,k + 1)$
|
| 363 |
+
// Compute this batch
|
| 364 |
+
compute $(i,j,k)$
|
| 365 |
+
// Store the KV cache and activation of the previous batch
|
| 366 |
+
storeActivation $(i,j,k - 1)$
|
| 367 |
+
store_cache $(i,j,k - 1)$
|
| 368 |
+
// Synchronize all devices
|
| 369 |
+
synchronize()
|
| 370 |
+
end for
|
| 371 |
+
end for
|
| 372 |
+
end for
|
| 373 |
+
|
| 374 |
+
# A.3 Detailed Experimental Results
|
| 375 |
+
|
| 376 |
+
Table 3 and 4 present detailed experimental results for latency-oriented workloads using OPT-6.7B and OPT-13B. The results show the performance differences between KVPR and the baseline (Hugging Face Transformer with KV cache offloading) in terms of GPU peak memory, decode latency, and throughput across various configurations. Notably, KVPR consistently achieves lower latency while maintaining comparable memory usage.
|
| 377 |
+
|
| 378 |
+
# A.4 Optimal KV Cache Split Points
|
| 379 |
+
|
| 380 |
+
Figure 12 presents the optimal KV cache split points $l$ , obtained by solving the linear programming problem defined in Eq. (11), for the first setting of the latency-oriented workload experiments in Section 4 (prompt length of 128 and generation length of 32). Based on system profiling statistics and KV cache size, the optimal split point $l$ is 182 when the generation length is 1, and $l$ increases to 128 when the generation length is 32.
|
| 381 |
+
|
| 382 |
+
<table><tr><td>Method</td><td>Batch size</td><td>Prompt length</td><td>Generation length</td><td>Cache size (GB)</td><td>GPU peak mem (GB)</td><td>Decode latency (sec)</td><td>Decode throughput (tokens/s)</td></tr><tr><td rowspan="6">Accel.</td><td>64</td><td>128</td><td>32</td><td>5.0</td><td>14.427</td><td>8.905</td><td>222.788</td></tr><tr><td>64</td><td>128</td><td>128</td><td>8.0</td><td>14.708</td><td>71.327</td><td>113.954</td></tr><tr><td>64</td><td>256</td><td>32</td><td>9.0</td><td>16.337</td><td>26.825</td><td>73.961</td></tr><tr><td>64</td><td>256</td><td>128</td><td>12.0</td><td>16.618</td><td>88.354</td><td>91.993</td></tr><tr><td>64</td><td>512</td><td>32</td><td>17.0</td><td>20.154</td><td>24.390</td><td>81.344</td></tr><tr><td>64</td><td>512</td><td>128</td><td>20.0</td><td>20.576</td><td>110.277</td><td>73.705</td></tr><tr><td rowspan="6">KVPR</td><td>64</td><td>128</td><td>32</td><td>5.0</td><td>14.364</td><td>6.651</td><td>298.284</td></tr><tr><td>64</td><td>128</td><td>128</td><td>8.0</td><td>14.645</td><td>45.766</td><td>177.598</td></tr><tr><td>64</td><td>256</td><td>32</td><td>9.0</td><td>16.212</td><td>19.138</td><td>103.666</td></tr><tr><td>64</td><td>256</td><td>128</td><td>12.0</td><td>16.493</td><td>61.597</td><td>131.955</td></tr><tr><td>64</td><td>512</td><td>32</td><td>17.0</td><td>19.904</td><td>20.349</td><td>97.501</td></tr><tr><td>64</td><td>512</td><td>128</td><td>20.0</td><td>20.951</td><td>93.932</td><td>86.531</td></tr></table>
|
| 383 |
+
|
| 384 |
+
Table 3: Detailed experimental results for OPT-6.7B corresponding to Figure 7.
|
| 385 |
+
|
| 386 |
+
<table><tr><td>Method</td><td>Batch size</td><td>Prompt length</td><td>Generation length</td><td>Cache size (GB)</td><td>GPU peak mem (GB)</td><td>Decode latency (sec)</td><td>Decode throughput (tokens/s)</td></tr><tr><td rowspan="6">Accel.</td><td>64</td><td>128</td><td>32</td><td>7.812</td><td>26.083</td><td>11.409</td><td>173.891</td></tr><tr><td>64</td><td>128</td><td>128</td><td>12.500</td><td>26.434</td><td>73.896</td><td>109.993</td></tr><tr><td>64</td><td>256</td><td>32</td><td>14.062</td><td>28.087</td><td>19.381</td><td>102.368</td></tr><tr><td>64</td><td>256</td><td>128</td><td>18.750</td><td>28.439</td><td>104.115</td><td>78.068</td></tr><tr><td>64</td><td>512</td><td>32</td><td>26.562</td><td>32.851</td><td>35.066</td><td>56.579</td></tr><tr><td>64</td><td>512</td><td>128</td><td>31.250</td><td>34.146</td><td>168.155</td><td>48.336</td></tr><tr><td rowspan="6">KVPR</td><td>64</td><td>128</td><td>32</td><td>7.812</td><td>26.005</td><td>9.148</td><td>216.867</td></tr><tr><td>64</td><td>128</td><td>128</td><td>12.500</td><td>26.356</td><td>66.119</td><td>122.929</td></tr><tr><td>64</td><td>256</td><td>32</td><td>14.062</td><td>27.931</td><td>16.654</td><td>119.127</td></tr><tr><td>64</td><td>256</td><td>128</td><td>18.750</td><td>28.337</td><td>88.492</td><td>91.850</td></tr><tr><td>64</td><td>512</td><td>32</td><td>26.562</td><td>33.203</td><td>29.215</td><td>67.911</td></tr><tr><td>64</td><td>512</td><td>128</td><td>31.250</td><td>34.615</td><td>138.377</td><td>58.738</td></tr></table>
|
| 387 |
+
|
| 388 |
+

|
| 389 |
+
Figure 12: Optimal KV cache split points $l$ over the generation process.
|
| 390 |
+
|
| 391 |
+
# A.5 System Performance with a Low-end GPU
|
| 392 |
+
|
| 393 |
+
To further demonstrate the adaptability of KVPR, we evaluate it on a low-end system with an AMD EPYC 32-Core CPU and an NVIDIA Quadro RTX 5000 GPU (16 GB HBM, 89.2 TFLOPS FP16 peak performance) connected via PCIe $4.0 \times 8$ (16 GB/s bandwidth). GPU TFLOPS, GPU memory, and
|
| 394 |
+
|
| 395 |
+
PCIe bandwidth are lower in this system setting than those in the default system we used earlier. Despite the reduced GPU speed and bandwidth, KVPR achieves up to $15\%$ higher throughput than FlexGen for OPT-6.7B in the same throughput-oriented workload, as shown in Table 5.
|
| 396 |
+
|
| 397 |
+
Table 4: Detailed experimental results for OPT-13B corresponding to Figure 7.
|
| 398 |
+
|
| 399 |
+
<table><tr><td>Seq len</td><td>256/32</td><td>256/128</td><td>512/32</td><td>512/128</td><td>1024/32</td><td>1024/128</td></tr><tr><td>FlexGen</td><td>50.057</td><td>46.779</td><td>29.614</td><td>28.650</td><td>15.778</td><td>16.194</td></tr><tr><td>KVPR</td><td>53.976</td><td>49.860</td><td>33.666</td><td>32.277</td><td>18.285</td><td>18.108</td></tr></table>
|
| 400 |
+
|
| 401 |
+
Table 5: Throughput (tokens/s) comparison on a low-end GPU system.
|
| 402 |
+
|
| 403 |
+
# A.6 Additional Experimental Results on LLaMa Models
|
| 404 |
+
|
| 405 |
+
In addition to the OPT models discussed in Section 4, we conduct further experiments on the more recent LLaMa2-7B and LLaMa2-13B models. Using the same experimental setup, we measure decoding throughput while processing a single batch of size 64 across varying prompt and generation lengths. As shown in Figure 13, KVPR consis
|
| 406 |
+
|
| 407 |
+
tently achieves higher throughput than the baselines (DeepSpeed Inference and Hugging Face Accelerate) on both LLaMa2 models.
|
| 408 |
+
|
| 409 |
+

|
| 410 |
+
Figure 14: Throughput comparison between KVPR and FastDecode with different GPU workload.
|
| 411 |
+
|
| 412 |
+

|
| 413 |
+
Figure 13: Decoding throughput for a single batch of size 64 across different sequence lengths.
|
| 414 |
+
|
| 415 |
+
# A.7 Comparing with CPU-assisted Approaches in Distributed System Setup
|
| 416 |
+
|
| 417 |
+
In this experiment, we compare the performance of the CPU-assisted offloading approach, FastDecode (He and Zhai, 2024), with KVPR on a GPU node equipped with 8 NVIDIA A100 GPUs and a single CPU, which is the same AMD EPYC processor (64 cores with PCIe 4.0 128 lanes), as described in Section 4.
|
| 418 |
+
|
| 419 |
+
We run multiple concurrent processes of FastDecode and KVPR on the available GPUs, with each GPU dedicated to a single process. This setup simulates scenarios where either multiple users share a single computing node or a single user performs data-parallel inference. FastDecode relies on the CPU for attention computations, resulting in a performance drop as the CPU becomes a bottleneck when managing multiple concurrent inference processes. In contrast, KVPR eliminates CPU dependency entirely and instead optimizes data transfer over the PCIe bus.
|
| 420 |
+
|
| 421 |
+
Figure 14 demonstrates that while FastDecode
|
| 422 |
+
|
| 423 |
+
suffers a significant decline in throughput as the number of processes increases, KVPR exhibits better scalability, maintaining stable performance in systems with a single CPU and multiple GPUs.
|
| 424 |
+
|
| 425 |
+

|
| 426 |
+
|
| 427 |
+
# A.8 Extended Related Works
|
| 428 |
+
|
| 429 |
+
GPU-efficient LLM inference. Maximizing GPU utilization is crucial for serving LLMs efficiently to achieve low latency and high throughput. Orca (Yu et al., 2022) employs iteration-level scheduling to handle batches with varying output lengths, returning completed sequences immediately to serve new ones. PagedAttention (Kwon et al., 2023) observes that the KV cache grows and shrinks dynamically as tokens are generated, though the sequence lifetime and length are not predetermined. It addresses this by managing the KV cache as non-contiguous memory blocks. FlashAttention (Dao et al., 2024) combines attention operations into a single kernel and tiles QKV matrices into smaller blocks to optimize GPU SRAM usage and reduce HBM access overhead, while our work mainly focuses on optimizing PCIe bandwidth. DeepSpeed-Inference (Aminabadi et al., 2022) enhances multi-GPU inference for both dense and sparse Transformer models by combining GPU memory and employing a hybrid inference technique with CPU and NVMe memory. Flash-Decoding (Dao et al., 2023) accelerates long-context inference by splitting keys and values into smaller chunks, enabling parallel attention computations and combining results for the final output. HCache (Gao et al., 2025) focuses on restoring contextual states across user requests for reuse in online inference, balancing latency, capacity, and persistence for robust LLM serving.
|
| 430 |
+
|
| 431 |
+
KV cache optimization. Efficient KV cache management enhances inference performance through compression or eviction strategies. KIVI (Liu
|
| 432 |
+
|
| 433 |
+
et al., 2024b) introduces a tuning-free 2-bit quantization method to compress key cache per channel and value cache per token. Similarly, KVQuant (Hooper et al., 2024) applies 3-bit compression by combining per-channel quantization with pre-rotary positional embedding quantization for LLaMA. For eviction, H2O (Zhang et al., 2023) formulates KV cache eviction as a dynamic submodular problem, prioritizing critical and recent tokens to improve throughput. StreamingLLM (Xiao et al., 2024) uses window attention with a fixed-size sliding window to retain the most recent KV caches, maintaining constant memory usage and decoding speed once the cache reaches capacity. InfiniGen (Lee et al., 2024) stores low-rank key cache in GPU memory, offloads value cache to the CPU, and selectively retrieves important values based on approximate attention scores.
|
2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a0c5a95b08d3ef22ab8374c11bcd2b57414e9c1c8ff6354d7293bc992bbe5177
|
| 3 |
+
size 714280
|
2025/KVPR_ Efficient LLM Inference with I_O-Aware KV Cache Partial Recomputation/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/51b6c2e2-0989-42d2-8da7-e6723d1b56a6_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/51b6c2e2-0989-42d2-8da7-e6723d1b56a6_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/51b6c2e2-0989-42d2-8da7-e6723d1b56a6_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0af53496326dd1710f34c2ba4457d71129857b166a50f3335a061767002ac76e
|
| 3 |
+
size 1317755
|
2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/full.md
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KaFT: Knowledge-aware Fine-tuning for Boosting LLMs' Domain-specific Question-Answering Performance
|
| 2 |
+
|
| 3 |
+
Qihuang Zhong $^{1}$ , Liang Ding $^{2}$ , Xiantao Cai $^{1*}$ , Juhua Liu $^{1*}$ , Bo Du $^{1}$ , Dacheng Tao $^{3}$
|
| 4 |
+
|
| 5 |
+
$^{1}$ School of Computer Science, National Engineering Research Center for Multimedia Software, Institute of Artificial Intelligence and Hubei Key Laboratory of Multimedia and Network Communication Engineering, Wuhan University, China
|
| 6 |
+
|
| 7 |
+
<sup>2</sup> The University of Sydney, Australia <sup>3</sup> Nanyang Technological University, Singapore
|
| 8 |
+
|
| 9 |
+
{zhongqihuang, caixiantao, liujuhua, dubo}@whu.edu.cn
|
| 10 |
+
|
| 11 |
+
{liangding.liam, dacheng.tao}@gmail.com
|
| 12 |
+
|
| 13 |
+
# Abstract
|
| 14 |
+
|
| 15 |
+
Supervised fine-tuning (SFT) is a common approach to improve the domain-specific question-answering (QA) performance of large language models (LLMs). However, recent literature reveals that due to the conflicts between LLMs' internal knowledge and the context knowledge of training data, vanilla SFT using the full QA training set is usually suboptimal. In this paper, we first design a query diversification strategy for robust conflict detection and then conduct a series of experiments to analyze the impact of knowledge conflict. We find that 1) training samples with varied conflicts contribute differently, where SFT on the data with large conflicts leads to catastrophic performance drops; 2) compared to directly filtering out the conflict data, appropriately applying the conflict data would be more beneficial. Motivated by this, we propose a simple-yet-effective Knowledge-aware Fine-tuning (namely KaFT) approach to effectively boost LLMs' performance. The core of KaFT is to adapt the training weight by assigning different rewards for different training samples according to conflict level. Extensive experiments show that KaFT brings consistent and significant improvements across four LLMs. More analyses prove that KaFT effectively improves the model generalization and alleviates the hallucination.
|
| 16 |
+
|
| 17 |
+
# 1 Introduction
|
| 18 |
+
|
| 19 |
+
While large language models (LLMs) (OpenAI, 2023; Dubey et al., 2024; Zhao et al., 2023) have showcased powerful general-purpose capabilities, they often struggle to handle domain-specific question-answering (QA) tasks, e.g., medical QA (Labrak et al., 2024). Hence, supervised fine-tuning (SFT), aiming to activate LLMs' internal knowledge and align LLMs' output with the
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Comparison between (a) vanilla SFT and (b) our KaFT. Different from vanilla SFT treating all training data equally, KaFT uses sample-adaptive rewards to facilitate more effective learning of LLMs.
|
| 23 |
+
|
| 24 |
+
desired behavioral norms, is usually required (Zhou et al., 2024; Zhang et al., 2024).
|
| 25 |
+
|
| 26 |
+
However, recent literature (Ren et al., 2024; Gekhman et al., 2024) reveals that domain-specific SFT usually suffers from a crucial problem: knowledge conflict, which is the discrepancy between the LLMs' internal knowledge and the context knowledge of training data (Xu et al., 2024). Due to the long-tail distribution and timeliness of pretraining corpora, LLMs might struggle to learn sufficient domain-specific knowledge during pretraining. Conversely, SFT training datasets usually contain more up-to-date and professional knowledge. Unfortunately, SFT fails to learn additional knowledge (Ren et al., 2024), and enforcing LLMs to learn new knowledge through SFT would easily damage their prior abilities and lead to hallucination (Gekhman et al., 2024).
|
| 27 |
+
|
| 28 |
+
To tackle this problem, some empirical studies have been conducted (Ren et al., 2024; Gekhman et al., 2024; Ye et al., 2024). For instance, Ren et al. (2024) employ in-context learning (ICL) (Brown et al., 2020) to probe LLMs' internal knowledge and determine whether it conflicts with the training data. Based on this, they analyze the behavior of LLMs after SFT with conflict data. Despite provid
|
| 29 |
+
|
| 30 |
+
ing some insightful findings, they still have some shortcomings: 1) the proposed conflict detection methods are simply based on ICL, which is sensitive to few-shot examples and might introduce bias into the results (Min et al., 2022; Ye et al., 2024); 2) they alleviate the negative effect of knowledge conflict by directly filtering the conflict data, while neglecting how to make full use of these data.
|
| 31 |
+
|
| 32 |
+
To this end, we first improve the ICL-based conflict detection with a query diversification strategy to reduce the bias of few-shot examples. Based on it, we conduct a series of preliminary analyses to reveal the impact of knowledge conflict. Specifically, we calculate the conflict score for each training data and split the training set evenly into four subsets with varied conflicts. By fine-tuning LLMs with different subsets, we find that:
|
| 33 |
+
|
| 34 |
+
- Different subsets contribute differently, where SFT on the individual subset with more conflicts causes catastrophic performance drops.
|
| 35 |
+
- Compared to directly filtering the subset with more conflicts, appropriately applying these data might be more beneficial.
|
| 36 |
+
|
| 37 |
+
Based on these observations, we recognize that not all training samples are equally important for SFT, and LLMs should pay different attention to different samples. Motivated by this, we proposed a simple-yet-effective Knowledge-aware Fine-Tuning (namely KaFT) approach to effectively boost LLMs' QA performance. As illustrated in Figure 1, the core of KaFT is to assign different rewards to varied subsets and use these rewards to adapt the learning of LLMs. Specifically, for the data with more conflicts, KaFT assigns a smaller reward to alleviate its negative effect. Conversely, for the data with fewer conflicts, KaFT uses a larger reward to encourage its learning. By doing so, KaFT can not only avoid overfitting to conflict data, but also effectively activate its internal knowledge for more efficient domain adaptation.
|
| 38 |
+
|
| 39 |
+
We mainly evaluate our KaFT in the medical QA applications upon four popular LLMs, including LLaMA3-8B/3B (Dubey et al., 2024), Qwen1.5-7B (Bai et al., 2023), and Mistral-7B (Jiang et al., 2023). Extensive results show that KaFT surpasses the other baselines by a clear margin, and brings consistent and significant performance gains across all LLMs, i.e., up to $+5.73\%$ and $+2.40\%$ average scores than the base model and vanilla SFT method, respectively. More in-depth analysis prove that
|
| 40 |
+
|
| 41 |
+
KaFT can be expanded to other domain-specific applications. More encouragingly, KaFT improves the model generalization and alleviates the model hallucination problem effectively.
|
| 42 |
+
|
| 43 |
+
Contributions. To summarize, our contributions are three-fold: (1) We propose a query diversification strategy for robust conflict detection. Based on it, we conduct a series of preliminary analyses and reveal that training samples with varied conflicts contribute differently. (2) Motivated by this, we propose a simple-yet-effective knowledge-aware SFT (KaFT) approach, which employs sample-adaptive rewards to boost LLMs' QA performance. (3) Extensive experiments show that KaFT outperforms the vanilla SFT by a clear margin and improves the model generalization effectively.
|
| 44 |
+
|
| 45 |
+
# 2 Preliminary
|
| 46 |
+
|
| 47 |
+
# 2.1 Task Formulation
|
| 48 |
+
|
| 49 |
+
Given a domain-specific QA training dataset $D = \{(q_i,o_i,a_i)\}_{i = 1}^N$ and a pretrained base LLM $\mathcal{M}_{\theta}$ parameterized by $\theta$ , where $q_{i},o_{i}$ and $a_{i}$ denote the question, options and answer, and $N$ denotes the number of all training samples. The goal of SFT is to use the $\mathcal{D}$ to fine-tune $\mathcal{M}_{\theta}$ with supervised learning, i.e., maximum likelihood estimates, and obtain the final adapted LLM $\mathcal{M}_{\theta^{*}}$ .
|
| 50 |
+
|
| 51 |
+
# 2.2 Knowledge Conflict Detection with Query Diversification Strategy
|
| 52 |
+
|
| 53 |
+
As mentioned in §1, SFT usually suffers from the knowledge conflict problem. To detect the knowledge conflicts in $\mathcal{D}$ , Ren et al. (2024) propose an ICL-based probing method. Specifically, they randomly select some training samples as the few-shot examples and utilize them to probe $\mathcal{M}_{\theta}$ 's response $r_i$ with greedy decoding, i.e., temperature $= 0$ , to each query $(q_i, o_i)$ . The response $r_i$ is referred to as the model's parameter knowledge for this question $q_i$ . Then, they determine whether the $r_i$ is aligned with reference answer $a_i$ , i.e., $\mathbb{I}(r_i = a_i)$ , where $\mathbb{I}(\cdot)$ is the indicator function, and regard the misaligned samples as the conflict data. To have a closer look, we provide a case in Appendix A.3.
|
| 54 |
+
|
| 55 |
+
Obviously, such a simple ICL-based approach is not robust, as it is sensitive to the few-shot examples and introduce bias. To this end, we improve this method with a query diversification strategy. The primary intuition of our strategy is that, if we replace the internal order of options $o_i$ and $\mathcal{M}_{\theta}$
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
(a)
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
(b)
|
| 62 |
+
|
| 63 |
+

|
| 64 |
+
(c)
|
| 65 |
+
Figure 2: (a) Illustration of distributions of $Score_{i}$ on MedQA across different LLMs. We use the kernel density estimate for visualizing, where the larger density refers to more training samples. (b) Performance comparison (\%) of different subsets. Note that all subsets hold the same number of training samples. (c) Analysis of different proportions of wrong data. Specifically, we randomly select varied samples from wrong and merge them with the other three subsets. We use three different random seeds for data sampling and report the average results.
|
| 66 |
+
|
| 67 |
+
always fails to output the correct answer, $\mathcal{M}_{\theta}$ indeed does not learn the knowledge for the question. In practice, for each data point, we first replace the internal order of $o_i$ and obtain $N_{o}$ different queries $\{(q_i,o_i^j)\}_{j = 1}^{N_o}$ . Then, we feed the queries into $\mathcal{M}_{\theta}$ to obtain its responses. Moreover, inspired by self-consistency (Wang et al., 2023), we set the temperature to 0.7 and sample $N_{r}$ candidate responses $\{r_{i_k}^j\}_{k = 1}^{N_r}$ for each query $(q_i,o_i^j)$ . Lastly, the knowledge conflict can be measured as:
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
S c o r e _ {i} = \frac {\sum_ {j = 1} ^ {N _ {o}} \sum_ {k = 1} ^ {N _ {r}} \mathbb {I} \left(r _ {i _ {k}} ^ {j}\right) = a _ {i})}{N _ {o} \times N _ {r}}, \tag {1}
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
where $Score_{i}$ denotes the conflict score (larger value refers to fewer conflicts) of $i$ -th training data.
|
| 74 |
+
|
| 75 |
+
# 2.3 Empirical Analyses
|
| 76 |
+
|
| 77 |
+
Setting. We use a popular medical QA benchmark, i.e., MedQA (Jin et al., 2021), as the testbed, containing 10,178 training data. We perform SFT on four cutting-edge LLMs, including LLaMA3-8B/3B (Dubey et al., 2024), Qwen1.5-7B (Bai et al., 2023), and Mistral-7B (Jiang et al., 2023). The tuned models are evaluated on six medical QA benchmarks, covering the test sets of MedQA, MedMCQA (Pal et al., 2022), MMLU* (Hendrycks et al., 2020) $^{1}$ ), CMB (Wang et al., 2024b), CMExam (Liu et al., 2024b), and CMMLU $^{*}$ (Li et al., 2024). For conflict detection, we set the $N_{o}$ and $N_{r}$ to 10. The distributions of Score are illustrated in Figure 2 (a).
|
| 78 |
+
|
| 79 |
+
<table><tr><td>Train/Test</td><td>wrong</td><td>mig-wr</td><td>mig-ri</td><td>right</td></tr><tr><td>wrong</td><td>28.93</td><td>27.99</td><td>25.79</td><td>25.08</td></tr><tr><td>mig-wr</td><td>12.58</td><td>51.57</td><td>87.42</td><td>98.75</td></tr><tr><td>mig-ri</td><td>5.66</td><td>48.43</td><td>88.05</td><td>99.69</td></tr><tr><td>right</td><td>7.55</td><td>47.17</td><td>88.36</td><td>98.75</td></tr></table>
|
| 80 |
+
|
| 81 |
+
Table 1: Fine-grained test results of trained LLaMA3-8B models on MedQA. "mig-ri" and "mig-wr" refer to might-right and might- wrong subsets.
|
| 82 |
+
|
| 83 |
+
Findings. To investigate the impact of knowledge conflict, we conduct systematic analyses and empirically observe that:
|
| 84 |
+
|
| 85 |
+
Different subsets contribute differently, where SFT on the individual subset with more conflicts causes catastrophic performance drops. First, we calculate the Score for each training data and sort the $\mathcal{D}$ based on the score. Then, we split $\mathcal{D}$ evenly into four subsets with varied conflicts, denoted as right, might-right, might-wrong and wrong, where right has less conflicts and wrong has most conflicts. Notably, these subsets have the same number of training samples. We fine-tune the LLMs using different individual subsets and illustrate the comparative results in Figure 2 (b). For reference, we also present the results of SFT on the randomly selected samples. As seen, LLMs tuned with different subsets perform differently. Similar to prior findings (Ren et al., 2024), SFT on the wrong leads to catastrophic performance drops, proving the negative effect of knowledge conflict. More interestingly, right is usually not the optimal subset, while might-right performs better among all LLMs. We conjecture that many right samples have
|
| 86 |
+
|
| 87 |
+
been learned by LLMs and struggle to provide useful information. Conversely, might-right can help activate LLMs' internal knowledge and better boost their performance.
|
| 88 |
+
|
| 89 |
+
Moreover, to further investigate the effect of different subsets, we split the MedQA test set into 4 groups with varied conflicts, and report the fine-grained test results of trained LLaMA3-8B models in Table 1. As seen, the model trained with wrong data indeed performs better on the wrong test subset. However, it performs much poorly in the other test subsets, confirming our statement that enforcing the model to learn conflict data would damage its prior abilities.
|
| 90 |
+
|
| 91 |
+
Compared to directly filtering the subset with more conflicts, appropriately applying these data might be more beneficial. Intuitively, a straightforward way for alleviating the negative effect of knowledge conflict is to filter out the wrong subset from $\mathcal{D}$ and use the other subsets for SFT. However, as aforementioned, appropriate conflict data might help activate LLMs' internal knowledge and lead to better performance. To verify our conjecture, we introduce different proportions $\lambda$ of conflict data from wrong into the collection of other less-conflict subsets, where $\lambda$ ranges from $0\%$ to $100\%$ . The results are illustrated in Figure 2 (c), from which we find that compared to directly filtering the wrong (i.e., $\lambda = 0\%$ ), introducing some conflict data (e.g., $\lambda = 25\%$ ) could be more beneficial. This highlights the necessity of exploring more effective SFT methods to make full use of the conflict data.
|
| 92 |
+
|
| 93 |
+
# 3 Knowledge-aware Fine-tuning
|
| 94 |
+
|
| 95 |
+
Based on the observations in §2.3, we recognize that not all training samples are equally important for SFT, and LLMs should pay different attention to different samples. To this end, we propose a knowledge-aware fine-tuning (KaFT) approach to alleviate the negative effect of knowledge conflict and boost LLMs' performance. In this section, we introduce our KaFT in detail.
|
| 96 |
+
|
| 97 |
+
Motivation and Intuition. In addition to the empirical findings in §2.3, our KaFT is also inspired by a famous cognitive structure migration theory (Ausubel et al., 1978), i.e., "The most important single factor influencing learning is what the student already knows", which highlights that paying more attention to the new content relevant
|
| 98 |
+
|
| 99 |
+
to prior learned knowledge can lead to more effective knowledge transfer. Intuitively, for the data with more conflicts, e.g., wrong, LLMs might easily over-fit the unfamiliar knowledge and lead to poor generalization. In contrast, for data with fewer conflicts, more in-depth learning is beneficial for transferring LLMs' internal knowledge and facilitating effective domain adaptation.
|
| 100 |
+
|
| 101 |
+
Implementation of KaFT. In practice, based on our proposed strategy in §2.2, we first calculate the conflict score $Score_{i}$ for each training data $(q_{i},o_{i},a_{i})$ , and split $\mathcal{D}$ evenly into four subsets with varied conflicts, as done in §2.3. Then, we assign different rewards for different subsets, where might-right and right hold the larger rewards, and the wrong and might-wrong hold the smaller rewards. Lastly, the rewards are used to control the learning weights of different subsets. The learning objective can be formulated as:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
R _ {i} = \left\{ \begin{array}{l l} \alpha , & \text {i f} \left(q _ {i}, o _ {i}, a _ {i}\right) \in \text {w r o n g}, \\ \beta , & \text {i f} \left(q _ {i}, o _ {i}, a _ {i}\right) \in \text {m i g h t - w r o n g}, \\ 1, & \text {i f} \left(q _ {i}, o _ {i}, a _ {i}\right) \in \text {m i g h t - r i g h t}, \\ 1, & \text {i f} \left(q _ {i}, o _ {i}, a _ {i}\right) \in \text {r i g h t}, \end{array} \right. \\ \theta^ {*} := \arg \min _ {\mathbb {E} _ {(q, o, a, R)} \sim \mathcal {D}} [ R \log \mathcal {M} (a | q, o) ], \tag {2}
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
where $R_{i}$ denotes the reward for $i$ -th training data and $\theta^{*}$ denotes the parameters of final LLM $\mathcal{M}_{\theta^{*}}$ . $\alpha$ and $\beta$ are rewards between 0 and 1, where $\alpha$ is generally smaller than $\beta$ . Empirically, we set $\alpha$ and $\beta$ as 0.1 and 0.5, respectively.
|
| 108 |
+
|
| 109 |
+
# 4 Experiments
|
| 110 |
+
|
| 111 |
+
# 4.1 Setup
|
| 112 |
+
|
| 113 |
+
Tasks and Datasets. Similar to the settings of §2.3, we mainly apply our KaFT in the medical QA and fine-tune LLMs with the training set of MedQA. The tuned models are evaluated on six in-domain test sets, covering English medical QA (MedQA, MedMCQA, MMLU*) and Chinese medical QA (CMB, CMExam and CMMLU*). Moreover, we follow Ren et al. (2024) and use the constructed QA test sets from three domains: history, engineering and law, as the out-of-domain (OOD) benchmarks. For evaluation, we use the public lm-evaluation-harness toolkit and report the zero-shot accuracy for each benchmark. The details of all tasks are shown in Appendix A.1.
|
| 114 |
+
|
| 115 |
+
Models. We conduct extensive experiments on four cutting-edge LLMs across different model ar
|
| 116 |
+
|
| 117 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">Method</td><td colspan="3">English Medical Benchmark</td><td colspan="3">Chinese Medical Benchmark</td><td colspan="2">Score</td></tr><tr><td>MedQA</td><td>MedMCQA</td><td>MMLU*</td><td>CMB</td><td>CMExam</td><td>CMMLU*</td><td>Avg.</td><td>Δ↑</td></tr><tr><td rowspan="5">Mistral-7B</td><td>Base</td><td>50.98</td><td>48.31</td><td>65.07</td><td>31.73</td><td>30.68</td><td>32.90</td><td>43.28</td><td>-</td></tr><tr><td>Vanilla SFT</td><td>59.86</td><td>43.75</td><td>68.06</td><td>36.25</td><td>36.25</td><td>35.48</td><td>46.61</td><td>+3.33</td></tr><tr><td>No-conflict</td><td>58.37</td><td>51.11</td><td>68.69</td><td>38.09</td><td>36.92</td><td>36.17</td><td>48.22</td><td>+4.94</td></tr><tr><td>Self-aligning</td><td>55.62</td><td>50.99</td><td>68.81</td><td>36.70</td><td>36.81</td><td>35.13</td><td>47.34</td><td>+4.06</td></tr><tr><td>KaFT (Ours)</td><td>59.54</td><td>49.87</td><td>68.47</td><td>38.11</td><td>37.35</td><td>40.73</td><td>49.01</td><td>+5.73</td></tr><tr><td rowspan="5">Qwen1.5-7B</td><td>Base</td><td>48.94</td><td>50.08</td><td>62.79</td><td>74.77</td><td>76.59</td><td>70.42</td><td>63.93</td><td>-</td></tr><tr><td>Vanilla SFT</td><td>52.71</td><td>50.20</td><td>61.60</td><td>74.30</td><td>76.15</td><td>70.16</td><td>64.19</td><td>+0.26</td></tr><tr><td>No-conflict</td><td>52.24</td><td>50.54</td><td>61.55</td><td>75.04</td><td>76.87</td><td>70.77</td><td>64.50</td><td>+0.57</td></tr><tr><td>Self-aligning</td><td>51.77</td><td>50.11</td><td>63.18</td><td>75.23</td><td>77.05</td><td>70.71</td><td>64.67</td><td>+0.74</td></tr><tr><td>KaFT (Ours)</td><td>53.57</td><td>49.82</td><td>63.23</td><td>75.57</td><td>77.27</td><td>72.07</td><td>65.25</td><td>+1.32</td></tr><tr><td rowspan="5">LLaMA3-8B</td><td>Base</td><td>59.62</td><td>56.51</td><td>72.66</td><td>45.50</td><td>46.04</td><td>44.62</td><td>54.16</td><td>-</td></tr><tr><td>Vanilla SFT</td><td>61.82</td><td>55.75</td><td>73.34</td><td>45.99</td><td>45.85</td><td>44.95</td><td>54.62</td><td>+0.46</td></tr><tr><td>No-conflict</td><td>61.98</td><td>56.11</td><td>73.40</td><td>47.17</td><td>47.72</td><td>45.59</td><td>55.33</td><td>+1.17</td></tr><tr><td>Self-aligning</td><td>61.35</td><td>56.56</td><td>73.00</td><td>47.53</td><td>48.34</td><td>46.55</td><td>55.55</td><td>+1.39</td></tr><tr><td>KaFT (Ours)</td><td>64.10</td><td>56.94</td><td>74.01</td><td>47.39</td><td>47.89</td><td>45.44</td><td>55.96</td><td>+1.80</td></tr><tr><td rowspan="5">LLaMA3-3B</td><td>Base</td><td>51.14</td><td>49.41</td><td>62.34</td><td>35.98</td><td>36.48</td><td>36.50</td><td>45.31</td><td>-</td></tr><tr><td>Vanilla SFT</td><td>54.99</td><td>50.08</td><td>62.94</td><td>38.00</td><td>39.17</td><td>38.13</td><td>47.22</td><td>+1.91</td></tr><tr><td>No-conflict</td><td>52.95</td><td>49.20</td><td>63.76</td><td>38.91</td><td>39.78</td><td>37.27</td><td>46.98</td><td>+1.67</td></tr><tr><td>Self-aligning</td><td>52.79</td><td>49.82</td><td>62.93</td><td>38.53</td><td>38.66</td><td>38.55</td><td>46.88</td><td>+1.57</td></tr><tr><td>KaFT (Ours)</td><td>54.52</td><td>50.51</td><td>64.93</td><td>40.19</td><td>39.93</td><td>39.70</td><td>48.30</td><td>+2.99</td></tr></table>
|
| 118 |
+
|
| 119 |
+
Table 2: Performance comparison (\%) on the medical QA benchmarks. “Avg.” denotes the average results, and “ $\Delta \uparrow$ ” refers to the gains against the base models. Best results are in bold, and second-best results are underlined.
|
| 120 |
+
|
| 121 |
+
chitectures and sizes, i.e., LLaMA3-8B/3B (Dubey et al., 2024), Qwen1.5-7B (Bai et al., 2023), and Mistral-7B (Jiang et al., 2023). In the implementation of KaFT, the $N_{o}$ and $N_{r}$ are set to 10. We train each model with a batch size of 16 and a peak learning rate of 1e-4, except 2e-4 for LLaMA3-3B. All models are trained with the LoRA (Hu et al., 2021) for 1 epoch. The details of model training and inference can be found in Appendix A.2.
|
| 122 |
+
|
| 123 |
+
Baselines. We compare KaFT with a series of baselines: 1) Base denotes the original LLMs without SFT, 2) Vanilla SFT denotes directly fine-tuning LLMs on the full training set equally, 3) No-conflict denotes first removing the conflict data (wrong identified in §2.3) and then fine-tuning LLMs on the remaining training data, and 4) Self-alignment, inspired by Ren et al. (2024), denotes first modifying the answers of wrong to match LLM's internal knowledge (i.e., replacing $a_{i}$ with $r_i$ ) and then fine-tuning LLMs on the combination of aligned wrong and the other original subsets.
|
| 124 |
+
|
| 125 |
+
# 4.2 Compared Results
|
| 126 |
+
|
| 127 |
+
The main results on medical QA benchmarks and OOD benchmarks are reported in Tables 2 and 3, respectively. From these results, we can find that:
|
| 128 |
+
|
| 129 |
+
KaFT surpasses the other baselines by a clear margin. As seen, compared to the vanilla SFT, "No-conflict" usually achieves better performance, highlighting the harmfulness of conflict data. "Self-aligning" can sometimes bring further performance gains against "No-conflict", e.g., $+0.22\%$ average score in LLaMA3-8B. However, it might lead to worse performance in some cases. One possible reason is that $r_i$ obtained by the method in (Ren et al., 2024) can not probe LLMs' internal knowledge well, thus leading to some noise. Conversely, our KaFT surpasses the other counterparts by a clear margin, proving its superiority.
|
| 130 |
+
|
| 131 |
+
KaFT brings consistent and significant performance gains among all model sizes and types. We see that KaFT not only achieves remarkable performance for LLaMA3-family models, but is also beneficial to the Qwen and Mistral models. Specifically, compared to the base models, KaFT brings $+5.73\%$ , $+1.32\%$ , $+1.80\%$ and $+2.99\%$ average gains for Mistral-7B, Qwen1.5-7B and LLaMA3-8B/3B, respectively. These results prove the effectiveness and universality of KaFT.
|
| 132 |
+
|
| 133 |
+
KaFT effectively improves the OOD performance. Additionally, we evaluate the tuned LLMs on the OOD benchmarks to verify LLMs' robustness. Due to space limitations, we only present
|
| 134 |
+
|
| 135 |
+
<table><tr><td rowspan="2">Method</td><td colspan="5">Mistral-7B</td><td colspan="5">LLaMA3-3B</td></tr><tr><td>History</td><td>Engineering</td><td>Law</td><td>Avg.</td><td>Δ↑</td><td>History</td><td>Engineering</td><td>Law</td><td>Avg.</td><td>Δ↑</td></tr><tr><td>Base</td><td>41.20</td><td>53.20</td><td>46.80</td><td>47.07</td><td>-</td><td>33.60</td><td>54.80</td><td>38.40</td><td>42.27</td><td>-</td></tr><tr><td>Vanilla SFT</td><td>46.00</td><td>59.20</td><td>50.00</td><td>51.73</td><td>+4.66</td><td>40.00</td><td>56.40</td><td>46.40</td><td>47.60</td><td>+5.33</td></tr><tr><td>No-conflict</td><td>45.20</td><td>61.20</td><td>49.60</td><td>52.00</td><td>+4.93</td><td>40.80</td><td>58.00</td><td>48.00</td><td>48.93</td><td>+6.66</td></tr><tr><td>Self-aligning</td><td>44.40</td><td>56.80</td><td>49.20</td><td>50.13</td><td>+3.06</td><td>39.60</td><td>56.40</td><td>48.00</td><td>48.00</td><td>+5.73</td></tr><tr><td>KaFT (Ours)</td><td>50.40</td><td>60.00</td><td>51.60</td><td>54.00</td><td>+6.93</td><td>40.40</td><td>58.40</td><td>49.60</td><td>49.47</td><td>+7.20</td></tr></table>
|
| 136 |
+
|
| 137 |
+
the contrastive results of Mistral-7B and LLaMA3-3B models in Table 3. It can be observed that KaFT significantly outperforms the baselines among all domains, indicating that alleviating the negative effect of conflict data can avoid the overfitting of LLMs, continuing to prove KaFT's effectiveness.
|
| 138 |
+
|
| 139 |
+
# 4.3 Ablation Study
|
| 140 |
+
|
| 141 |
+
Effect of conflict detection methods. One of our contributions is to design a query diversification strategy for robust conflict detection. Here, to verify its effectiveness, we compare it with some variants: 1) “-w/o diverse query” means removing the query diversification process and obtaining multiple responses for the original query. 2) “-w/o response sampling” means using greedy decoding to obtain the model responses with the highest probability for diverse queries, respectively. 3) “-w/o both” means removing both processes and directly using greedy decoding to obtain the model response for each original query, as done in Ren et al. (2024). After obtaining the responses, we compared them with the references to calculate the conflict score. Based on it, we sort the training data and select the wrong set. Taking the LLaMA3-8B as an example, we present the medical QA results of models tuned with different wrong sets in Table 4. As seen, the wrong selected by our method leads to maximum performance degradation, i.e., our method can effectively detect the conflict data and select the most conflict subset, proving its effectiveness.
|
| 142 |
+
|
| 143 |
+
Effect of reward strategies in KaFT. As mentioned in §3, KaFT empirically assigns the rewards for subsets with varied conflicts. In this part, we investigate this strategy by comparing it with two variants: 1) “-w. constant” refers to the constant reward for all subsets, i.e., $R_{i} = 1.0$ , and 2) “-w. auto-adapt” refers to using the conflict scores as the rewards, i.e., $R_{i} = Score_{i}$ . Comparative results of medical QA are illustrated in Figure 3. Both of ours
|
| 144 |
+
|
| 145 |
+
Table 3: Performance comparison (%) of tuned medical LLMs on the out-of-domain QA test sets. “Avg.” denotes the average performance. Best results are in bold, and second-best results are underlined.
|
| 146 |
+
|
| 147 |
+
<table><tr><td>Method</td><td>Score</td><td>Δ ↓</td></tr><tr><td>Random</td><td>54.38</td><td>-</td></tr><tr><td>Ours</td><td>27.16</td><td>↓ 27.22</td></tr><tr><td>-w/o diverse query</td><td>38.96</td><td>↓ 15.42</td></tr><tr><td>-w/o response sampling</td><td>30.15</td><td>↓ 24.23</td></tr><tr><td>-w/o both</td><td>49.00</td><td>↓ 5.38</td></tr></table>
|
| 148 |
+
|
| 149 |
+
Table 4: Performance comparison (\%) of wrong sets selected by different conflict detection methods. The LLaMA3-8B is used as the base model. “ $\Delta \downarrow$ ” denotes the performance drops against the random selection, where larger values refer to better performance.
|
| 150 |
+
|
| 151 |
+

|
| 152 |
+
Figure 3: Effect of reward strategies in KaFT. The y-axis denotes the average performance of medical QA.
|
| 153 |
+
|
| 154 |
+
and “-w. auto-adapt” outperform the “-w. constant” by a clear margin, proving the effectiveness of knowledge-aware SFT. Moreover, “-w. auto-adapt” usually performs worse than ours. One possible reason is that it assigns a relatively small reward for the more important might-right subset, thus hindering the activation of LLMs' internal knowledge. Conversely, our strategy can make full use of the training data and achieve the best performance.
|
| 155 |
+
|
| 156 |
+
Impact of data partitioning strategies in KaFT. In our KaFT, we split the total training dataset into 4 subsets and assign different rewards for these subsets. Here, we investigate the effectiveness of KaFT with different data partitioning strategies.
|
| 157 |
+
|
| 158 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">Method</td><td colspan="3">English Medical Benchmark</td><td colspan="3">Chinese Medical Benchmark</td><td colspan="2">Score</td></tr><tr><td>MedQA</td><td>MedMCQA</td><td>MMLU*</td><td>CMB</td><td>CMExam</td><td>CMMLU*</td><td>Avg.</td><td>Δ↑</td></tr><tr><td rowspan="4">LLaMA3-8B</td><td>Base</td><td>59.62</td><td>56.51</td><td>72.66</td><td>45.50</td><td>46.04</td><td>44.62</td><td>54.16</td><td>-</td></tr><tr><td>KaFT-2 subsets</td><td>61.90</td><td>56.30</td><td>73.45</td><td>48.41</td><td>48.07</td><td>46.68</td><td>55.80</td><td>+1.64</td></tr><tr><td>KaFT-4 subsets</td><td>64.10</td><td>56.94</td><td>74.01</td><td>47.39</td><td>47.89</td><td>45.44</td><td>55.96</td><td>+1.80</td></tr><tr><td>KaFT-8 subsets</td><td>63.45</td><td>56.63</td><td>73.82</td><td>47.93</td><td>48.01</td><td>47.12</td><td>56.16</td><td>+2.00</td></tr></table>
|
| 159 |
+
|
| 160 |
+
Table 5: Analysis of different data partitioning strategies in KaFT. "KaFT-* subsets" denotes that we split the total training dataset into * subsets, and assign different rewards for these subsets.
|
| 161 |
+
|
| 162 |
+
<table><tr><td rowspan="2">Method</td><td colspan="5">Mistral-7B</td><td colspan="5">LLaMA3-8B</td></tr><tr><td>QA</td><td>Dialogue</td><td>Sumarization</td><td>Avg.</td><td>Δ↑</td><td>QA</td><td>Dialogue</td><td>Sumarization</td><td>Avg.</td><td>Δ↑</td></tr><tr><td>Base</td><td>51.65</td><td>62.22</td><td>44.50</td><td>52.79</td><td>-</td><td>50.79</td><td>67.27</td><td>49.49</td><td>55.85</td><td>-</td></tr><tr><td>Wrong-only</td><td>48.92</td><td>56.71</td><td>44.40</td><td>50.01</td><td>-2.78</td><td>45.55</td><td>51.73</td><td>42.56</td><td>46.61</td><td>-9.24</td></tr><tr><td>Vanilla SFT</td><td>50.66</td><td>69.60</td><td>49.24</td><td>56.50</td><td>+3.71</td><td>45.43</td><td>72.04</td><td>48.77</td><td>55.41</td><td>-0.44</td></tr><tr><td>No-conflict</td><td>54.54</td><td>70.48</td><td>45.89</td><td>56.97</td><td>+4.18</td><td>49.16</td><td>71.98</td><td>48.55</td><td>56.56</td><td>+0.71</td></tr><tr><td>Self-aligning</td><td>54.22</td><td>72.41</td><td>46.11</td><td>57.58</td><td>+4.79</td><td>49.67</td><td>72.24</td><td>48.64</td><td>56.85</td><td>+1.00</td></tr><tr><td>KaFT (Ours)</td><td>54.20</td><td>73.57</td><td>47.68</td><td>58.48</td><td>+5.69</td><td>50.85</td><td>72.65</td><td>48.79</td><td>57.43</td><td>+1.58</td></tr></table>
|
| 163 |
+
|
| 164 |
+
Table 6: Performance comparison (%) on the hallucination evaluation, i.e., HaluEval (Li et al., 2023a). Green and red results refer to the average performance gains and drops against the "Base" baseline, respectively. For references, we also report the results of "Wrong-only", which fine-tunes LLMs on the individual wrong subset.
|
| 165 |
+
|
| 166 |
+

|
| 167 |
+
Figure 4: Parameter analyses of KaFT. The y-axis and x-axis denote the varied $\alpha$ and $\beta$ , respectively. We report the average results on medical QA benchmarks.
|
| 168 |
+
|
| 169 |
+
Specifically, we split the training data into 2, 4 and 8 subsets based on the conflict scores, respectively. After manually tuning the rewards of the conflict data subset, we train the LLaMA3-8B with our KaFT method and report the comparative results in Table 5. We find that splitting the dataset into more subsets generally results in better performance, as it can achieve more fine-grained and accurate knowledge-aware training. However, more subsets require more manual hyperparameter tuning. Thus, in our work, we split the dataset into 4 subsets for a better trade-off.
|
| 170 |
+
|
| 171 |
+
Parameter Analysis. In Eq. 2, we use two hyperparameters, i.e., $\alpha$ and $\beta$ , to control the rewards for wrong and might-wrong subsets. In this study, we analyze their influence by evaluating the performance of KaFT with different $\alpha$ and $\beta$ , spanning $\{0.1, 0.5, 1.0\}$ . Figure 4 illustrates the average
|
| 172 |
+
|
| 173 |
+
results of Mistral-7B and Qwen1.5-7B on medical QA benchmarks, from which we find that: 1) Increasing the $\alpha$ leads to a continuous performance decline, confirming the motivation to suppress the learning of conflict data. 2) Increasing the $\beta$ appropriately brings better performance, but too large $\beta$ (i.e., 1.0) is harmful. We conjecture that the might-wrong could contain some conflict data, and overemphasizing its learning would cause overfitting. More specifically, the case of $\alpha = 0.1$ and $\beta = 0.5$ performs best, thus leaving as our default experimental settings.
|
| 174 |
+
|
| 175 |
+
# 5 Discussion
|
| 176 |
+
|
| 177 |
+
# 5.1 Does KaFT improve the generalization?
|
| 178 |
+
|
| 179 |
+
Intuitively, by alleviating the negative effect of conflict data, KaFT can achieve better model generalization. To verify it, we further analyze its effect from the following aspects:
|
| 180 |
+
|
| 181 |
+
Multilingual Generalization. We evaluate the tuned models on a popular multilingual medical QA benchmark, i.e., MMedBench (Qiu et al., 2024), consisting of six languages: Chinese, English, French, Japanese, Russian, and Spanish. The comparative results of tuned LLaMA3-8B models are illustrated in Figure 5. As seen, our KaFT brings better performance gains than the other methods across most languages. Specifically, compared to the base model, KaFT achieves $+4.94\%$
|
| 182 |
+
|
| 183 |
+
<table><tr><td rowspan="2">Method</td><td colspan="4">History →</td><td colspan="4">Engineering →</td><td colspan="4">Law →</td></tr><tr><td>History</td><td>Engineering</td><td>Law</td><td>Avg.</td><td>History</td><td>Engineering</td><td>Law</td><td>Avg.</td><td>History</td><td>Engineering</td><td>Law</td><td>Avg.</td></tr><tr><td>Base</td><td>49.60</td><td>59.20</td><td>51.60</td><td>53.47</td><td>49.60</td><td>59.20</td><td>51.60</td><td>53.47</td><td>49.60</td><td>59.20</td><td>51.60</td><td>53.47</td></tr><tr><td>Vanilla SFT</td><td>64.40</td><td>66.00</td><td>67.20</td><td>65.87</td><td>57.60</td><td>65.20</td><td>56.80</td><td>59.87</td><td>64.40</td><td>64.40</td><td>60.80</td><td>63.20</td></tr><tr><td>No-conflict</td><td>60.00</td><td>66.80</td><td>65.20</td><td>64.00</td><td>56.80</td><td>65.20</td><td>56.00</td><td>59.33</td><td>61.60</td><td>64.00</td><td>60.00</td><td>61.87</td></tr><tr><td>Self-aligning</td><td>56.80</td><td>66.00</td><td>60.40</td><td>61.07</td><td>52.80</td><td>63.60</td><td>55.20</td><td>57.20</td><td>57.60</td><td>64.40</td><td>58.00</td><td>60.00</td></tr><tr><td>KaFT (Ours)</td><td>66.40</td><td>66.00</td><td>67.60</td><td>66.67</td><td>58.80</td><td>67.20</td><td>56.80</td><td>60.93</td><td>66.00</td><td>65.60</td><td>61.20</td><td>64.27</td></tr></table>
|
| 184 |
+
|
| 185 |
+
Table 7: Performance comparison (%) on more domain-specific QA applications. Notably, we fine-tune the LLaMA3-8B with the individual domain-specific training set (i.e., History, Engineering, and Law) and evaluate them on all domains' test sets. "Avg." denotes the average performance, and the best results are in bold.
|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
Figure 5: Performance comparison $(\%)$ on multilingual medical QA. LLaMA3-8B is used as base model.
|
| 189 |
+
|
| 190 |
+
average performance gains, especially $+6.25\%$ gains in Japanese and $+7.81\%$ gains in Russian.
|
| 191 |
+
|
| 192 |
+
Hallucination Alleviation. As stated in the prior work (Gekhman et al., 2024), fine-tuning with conflict data increases the LLMs' tendency to hallucinate. Here, we investigate this problem by evaluating the tuned models on a popular hallucination detection benchmark, HaluEval (Li et al., 2023a). Specifically, the models are required to classify whether a sample contains hallucinated contents from three tasks, i.e., question answering (QA), knowledge-grounded dialogue (Dialogue), and text summarization (Summarization). The results of Mistral-7B and LLaMA3-8B models are reported in Table 6. For references, we also report the results of directly fine-tuning on the wrong subset, denoted as "Wrong-only". It can be found that enforcing LLMs to learn the new knowledge from conflict data indeed causes serious hallucination, as "Wrong-only" and "Vanilla SFT" cause up to $-9.24\%$ and $-0.44\%$ average score drops, respectively. More encouragingly, our KaFT can
|
| 193 |
+
|
| 194 |
+
effectively alleviate this side effect and bring up to $+5.69\%$ average score gains against base models. Takeaway: These results prove that our KaFT can indeed bring better model generalization.
|
| 195 |
+
|
| 196 |
+
# 5.2 Does KaFT still work in other scenarios?
|
| 197 |
+
|
| 198 |
+
Although our KaFT is mainly evaluated in the medical domain, we believe that it has great potential to expand to more domain-specific applications. To verify it, we conduct additional experiments from three domains: history, engineering, and law. Following Ren et al. (2024), we use the corresponding domain-specific training and test sets, collected from Xiezhi Benchmark (Gu et al., 2024). The data statistics are provided in Appendix A.1. We fine-tune the LLMs with the individual domain-specific training set and evaluate them on the test sets of all domains. Results of tuned LLaMA3-8B models are reported in Table 7, from which we observe that KaFT performs best and brings consistent and significant performance gains among all domains. Takeaway: KaFT not only works well in medical QA, but also can be applied to more domain-specific scenarios.
|
| 199 |
+
|
| 200 |
+
# 6 Related Works
|
| 201 |
+
|
| 202 |
+
LLMs (Ouyang et al., 2022; OpenAI, 2023; Dubey et al., 2024; Liu et al., 2024a) have showcased powerful general-purpose capabilities. However, they might fall short in domain-specific applications, such as medical QA (Labrak et al., 2024). To this end, many prior works (Singhal et al., 2023; Li et al., 2023b; Chen et al., 2023; He et al., 2025) attempt to perform SFT on the domain-specific QA dataset for facilitating domain adaptation.
|
| 203 |
+
|
| 204 |
+
Despite achieving remarkable performance, SFT often faces a critical challenge, i.e., knowledge conflicts. Specifically, since domain-specific SFT is more knowledge-intensive and contains rich professional knowledge that has not been learned during the LLMs' pretraining, there is usually a
|
| 205 |
+
|
| 206 |
+
discrepancy between the LLMs' internal knowledge and the context knowledge of the SFT corpus. More recently, Ren et al. (2024) reveal that SFT fails to learn additional knowledge and Gekhman et al. (2024) find that enforcing LLMs to learn new knowledge through SFT would easily damage their prior abilities and lead to hallucination. Thus, it is suboptimal to directly fine-tune LLMs using the full SFT training samples equally.
|
| 207 |
+
|
| 208 |
+
To address this problem, there are few existing works (Ren et al., 2024; Gekhman et al., 2024; Ye et al., 2024). However, they still have some shortcomings and struggle to tackle this problem effectively. On the one hand, their conflict detection methods highly rely on ICL (Brown et al., 2020), which is sensitive to the few-shot examples (Min et al., 2022). On the other hand, after detecting the conflict data, they mitigate its negative effect by either using early-stopping or filtering out it from the training dataset, while neglecting how to make full use of these conflict data.
|
| 209 |
+
|
| 210 |
+
Different from these prior studies, we first design a query diversification strategy to robustly detect the conflict and then propose KaFT to make full use of all training data. The main idea of KaFT is to use sample-adaptive rewards for better guiding the learning of LLMs, which is somewhat similar to prior adaptive-learning methods (Wang et al., 2024a; Li et al., 2020; Kang et al., 2020; Ghorbani and Zou, 2019; Yoon et al., 2020; Zhong et al., 2024). We should emphasize that, although assigning different weights to subsets is a common and intuitive approach, it is non-trivial to determine the weights for different subsets, especially for the domain-specific SFT of LLMs. Thus, we believe that KaFT is innovative and our work is insightful.
|
| 211 |
+
|
| 212 |
+
# 7 Conclusion
|
| 213 |
+
|
| 214 |
+
In this paper, we focus on the knowledge conflict problem in the domain-specific SFT, which is critical yet under-explored. Specifically, we propose a query diversification strategy to robustly detect the conflict. Based on it, we conduct a series of preliminary analyses and reveal that different training samples contribute differently, where those with more conflicts would dynamically damage LLMs' abilities. To this end, we further propose a knowledge-aware SFT approach (KaFT). In short, KaFT utilizes sample-adaptive rewards to suppress the negative effect of conflict data and encourage LLMs to activate more relevant knowledge. Extensive re
|
| 215 |
+
|
| 216 |
+
sults on medical QA benchmarks demonstrate the effectiveness and universality of KaFT. More encouragingly, in-depth analyses prove that KaFT can achieve better model generalization and alleviate the model hallucination effectively.
|
| 217 |
+
|
| 218 |
+
# Limitations
|
| 219 |
+
|
| 220 |
+
Our work has several potential limitations. First, given the limited computational budget, we only validate our KaFT on up to 8B LLMs in the main experiments. It will be more convincing if scaling up to super-large model sizes (e.g., 70B) and applying KaFT to more cutting-edge model architectures. On the other hand, to better probe LLMs' internal knowledge, we follow the prior studies (Ren et al., 2024; Ye et al., 2024) and mainly focus on multiple-choice QA tasks. We will expand our methods to the long-form QA scenarios in future work.
|
| 221 |
+
|
| 222 |
+
# Ethics Statements
|
| 223 |
+
|
| 224 |
+
We take ethical considerations very seriously and strictly adhere to the ACL Ethics Policy. This paper proposes a knowledge-aware fine-tuning framework to improve the domain-specific QA performance of LLMs. It aims to activate LLMs' internal domain-specific knowledge, e.g., medical, instead of encouraging them to learn privacy knowledge that may cause an ethical problem. Moreover, all training and evaluation datasets used in this paper are publicly available and have been widely adopted by researchers. Thus, we believe that this research will not pose ethical issues.
|
| 225 |
+
|
| 226 |
+
# Acknowledgements
|
| 227 |
+
|
| 228 |
+
We are grateful to the anonymous reviewers and the area chair for their insightful comments and suggestions. This work was supported in part by the National Key Research and Development Program of China under Grant 2023YFC2705700, in part by the National Natural Science Foundation of China under Grant 623B2076, U23B2048 and 62225113, in part by the Innovative Research Group Project of Hubei Province under Grant 2024AFA017, and in part by the Science and Technology Major Project of Hubei Province under Grant 2024BAB046. Dr Tao's research is partially supported by NTU RSR and Start Up Grants. The numerical calculations in this paper have been done on the supercomputing system in the Supercomputing Center of Wuhan University.
|
| 229 |
+
|
| 230 |
+
# References
|
| 231 |
+
|
| 232 |
+
David Paul Ausubel, Joseph Donald Novak, Helen Hanessian, et al. 1978. Educational psychology: A cognitive view.
|
| 233 |
+
Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, et al. 2023. Qwen technical report. arXiv preprint arXiv:2309.16609.
|
| 234 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. In Advances in neural information processing systems.
|
| 235 |
+
Zeming Chen, Alejandro Hernández Cano, Angelika Romanou, Antoine Bonnet, Kyle Matoba, Francesco Salvi, Matteo Pagliardini, Simin Fan, Andreas Köpf, Amirkeivan Mohtashami, et al. 2023. Meditron-70b: Scaling medical pretraining for large language models. arXiv preprint arXiv:2311.16079.
|
| 236 |
+
Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, et al. 2024. The llama 3 herd of models. arXiv preprint arXiv:2407.21783.
|
| 237 |
+
Zorik Gekhman, Gal Yona, Roee Aharoni, Matan Eyal, Amir Feder, Roi Reichart, and Jonathan Herzig. 2024. Does fine-tuning llms on new knowledge encourage hallucinations? In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing.
|
| 238 |
+
Amirata Ghorbani and James Zou. 2019. Data shapley: Equitable valuation of data for machine learning. In International conference on machine learning, PMLR.
|
| 239 |
+
Zhouhong Gu, Xiaoxuan Zhu, Haoning Ye, Lin Zhang, Jianchen Wang, Yixin Zhu, Sihang Jiang, Zhuozhi Xiong, Zihan Li, Weijie Wu, et al. 2024. Xiezhi: An ever-updating benchmark for holistic domain knowledge evaluation. In Proceedings of the AAAI Conference on Artificial Intelligence.
|
| 240 |
+
Kai He, Rui Mao, Qika Lin, Yucheng Ruan, Xiang Lan, Mengling Feng, and Erik Cambria. 2025. A survey of large language models for healthcare: from data, technology, and applications to accountability and ethics. Information Fusion.
|
| 241 |
+
Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. 2020. Measuring massive multitask language understanding. In International Conference on Learning Representations.
|
| 242 |
+
Edward J Hu, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen, et al. 2021. Lora: Low-rank adaptation of large language models. In International Conference on Learning Representations.
|
| 243 |
+
|
| 244 |
+
Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, et al. 2023. Mistral 7b. arXiv preprint arXiv:2310.06825.
|
| 245 |
+
Di Jin, Eileen Pan, Nassim Oufattole, Wei-Hung Weng, Hanyi Fang, and Peter Szolovits. 2021. What disease does this patient have? a large-scale open domain question answering dataset from medical exams. Applied Sciences.
|
| 246 |
+
Minki Kang, Moonsu Han, and Sung Ju Hwang. 2020. Neural mask generator: Learning to generate adaptive word maskings for language model adaptation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).
|
| 247 |
+
Yanis Labrak, Adrien Bazoge, Emmanuel Morin, Pierre-Antoine Gourraud, Mickael Rouvier, and Richard Dufour. 2024. Biomistral: A collection of open-source pretrained large language models for medical domains. In *Findings of the Association for Computational Linguistics: ACL* 2024.
|
| 248 |
+
Aoxue Li, Weiran Huang, Xu Lan, Jiashi Feng, Zhenguo Li, and Liwei Wang. 2020. Boosting few-shot learning with adaptive margin loss. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition.
|
| 249 |
+
Haonan Li, Yixuan Zhang, Fajri Koto, Yifei Yang, Hai Zhao, Yeyun Gong, Nan Duan, and Timothy Baldwin. 2024. Cmmlu: Measuring massive multitask language understanding in chinese. In Findings of the Association for Computational Linguistics: ACL 2024.
|
| 250 |
+
Junyi Li, Xiaoxue Cheng, Wayne Xin Zhao, Jian-Yun Nie, and Ji-Rong Wen. 2023a. Halueval: A large-scale hallucination evaluation benchmark for large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing.
|
| 251 |
+
Yunxiang Li, Zihan Li, Kai Zhang, Ruilong Dan, Steve Jiang, and You Zhang. 2023b. Chatdoctor: A medical chat model fine-tuned on a large language model meta-ai (llama) using medical domain knowledge. Cureus.
|
| 252 |
+
Aixin Liu, Bei Feng, Bing Xue, Bingxuan Wang, Bochao Wu, Chengda Lu, Chenggang Zhao, Chengqi Deng, Chenyu Zhang, Chong Ruan, et al. 2024a. Deepseek-v3 technical report. arXiv preprint arXiv:2412.19437.
|
| 253 |
+
Junling Liu, Peilin Zhou, Yining Hua, Dading Chong, Zhongyu Tian, Andrew Liu, Helin Wang, Chenyu You, Zhenhua Guo, Lei Zhu, et al. 2024b. Benchmarking large language models on cmexam-a comprehensive chinese medical exam dataset. In Advances in Neural Information Processing Systems.
|
| 254 |
+
|
| 255 |
+
Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettle-moyer. 2022. Rethinking the role of demonstrations: What makes in-context learning work? In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing.
|
| 256 |
+
OpenAI. 2023. Gpt-4 technical report.
|
| 257 |
+
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. In Advances in neural information processing systems.
|
| 258 |
+
Ankit Pal, Logesh Kumar Umapathi, and Malaikanan Sankarasubbu. 2022. Medmcqa: A large-scale multi-subject multi-choice dataset for medical domain question answering. In Conference on health, inference, and learning.
|
| 259 |
+
Pengcheng Qiu, Chaoyi Wu, Xiaoman Zhang, Weixiong Lin, Haicheng Wang, Ya Zhang, Yanfeng Wang, and Weidi Xie. 2024. Towards building multilingual language model for medicine. Nature Communications.
|
| 260 |
+
Mengjie Ren, Boxi Cao, Hongyu Lin, Cao Liu, Xianpei Han, Ke Zeng, Guanglu Wan, Xunliang Cai, and Le Sun. 2024. Learning or self-aligning? rethinking instruction fine-tuning. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
|
| 261 |
+
Karan Singhal, Shekoofeh Azizi, Tao Tu, S Sara Mahdavi, Jason Wei, Hyung Won Chung, Nathan Scales, Ajay Tanwani, Heather Cole-Lewis, Stephen Pfohl, et al. 2023. Large language models encode clinical knowledge. Nature.
|
| 262 |
+
Karan Singhal, Tao Tu, Juraj Gottweis, Rory Sayres, Ellery Wulczyn, Mohamed Amin, Le Hou, Kevin Clark, Stephen R Pfohl, Heather Cole-Lewis, et al. 2025. Toward expert-level medical question answering with large language models. Nature Medicine.
|
| 263 |
+
Guan Wang, Sijie Cheng, Xianyuan Zhan, Xiangang Li, Sen Song, and Yang Liu. 2024a. Openchat: Advancing open-source language models with mixed-quality data. In The Twelfth International Conference on Learning Representations.
|
| 264 |
+
Xidong Wang, Guiming Chen, Song Dingjie, Zhang Zhiyi, Zhihong Chen, Qingying Xiao, Junying Chen, Feng Jiang, Jianquan Li, Xiang Wan, et al. 2024b. Cmb: A comprehensive medical benchmark in chines. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers).
|
| 265 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V Le, Ed H Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. 2023. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations.
|
| 266 |
+
|
| 267 |
+
Rongwu Xu, Zehan Qi, Zhijiang Guo, Cunxiang Wang, Hongru Wang, Yue Zhang, and Wei Xu. 2024. Knowledge conflicts for llms: A survey. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing.
|
| 268 |
+
Junjie Ye, Yuming Yang, Qi Zhang, Tao Gui, Xuanjing Huang, Peng Wang, Zhongchao Shi, and Jianping Fan. 2024. Empirical insights on fine-tuning large language models for question-answering. arXiv preprint arXiv:2409.15825.
|
| 269 |
+
Jinsung Yoon, Sercan Arik, and Tomas Pfister. 2020. Data valuation using reinforcement learning. In International Conference on Machine Learning. PMLR.
|
| 270 |
+
Liang Zhang, Katherine Jijo, Spurthi Setty, Eden Chung, Fatima Javid, Natan Vidra, and Tommy Clifford. 2024. Enhancing large language model performance to answer questions and extract information more accurately. arXiv preprint arXiv:2402.01722.
|
| 271 |
+
Wayne Xin Zhao, Kun Zhou, Junyi Li, Tianyi Tang, Xiaolei Wang, Yupeng Hou, Yingqian Min, Beichen Zhang, Junjie Zhang, Zican Dong, et al. 2023. A survey of large language models. arXiv preprint arXiv:2303.18223.
|
| 272 |
+
Qihuang Zhong, Liang Ding, Li Shen, Juhua Liu, Bo Du, and Dacheng Tao. 2024. Revisiting knowledge distillation for autoregressive language models. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
|
| 273 |
+
Chunting Zhou, Pengfei Liu, Puxin Xu, Srinivasan Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. 2024. Lima: Less is more for alignment. In Advances in Neural Information Processing Systems.
|
| 274 |
+
|
| 275 |
+
# A Appendix
|
| 276 |
+
|
| 277 |
+
# A.1 Details of Tasks and Datasets
|
| 278 |
+
|
| 279 |
+
In this work, to investigate the effectiveness and universality of our KaFT, we conduct extensive experiments on four domain-specific QA applications, covering medical, history, and law. In addition, the multilingual medical QA tasks and hallucination detection tasks are used to reveal the underlying mechanism of our method. Here, we introduce the descriptions of these tasks and datasets in detail. First, we present the statistics of all datasets in Table 8. Then, each task is described as:
|
| 280 |
+
|
| 281 |
+
MedQA. MedQA (Jin et al., 2021) consists of questions and corresponding 4-option or 5-option answers in the style of the US Medical License Exam (USMLE). Since it consists of diverse medical knowledge, MedQA is a challenging benchmark and is thus used as our training corpus.
|
| 282 |
+
|
| 283 |
+
<table><tr><td>Dataset</td><td>#Training</td><td>#Test</td></tr><tr><td colspan="3">Medical QA</td></tr><tr><td>MedQA (Jin et al., 2021)</td><td>10,178</td><td>1,273</td></tr><tr><td>MedMCQA (Pal et al., 2022)</td><td>-</td><td>4,183</td></tr><tr><td>MMLU* (Hendrycks et al., 2020)</td><td>-</td><td>1,089</td></tr><tr><td>- Anatomy</td><td>-</td><td>135</td></tr><tr><td>- Clinical Knowledge</td><td>-</td><td>265</td></tr><tr><td>- College Biology</td><td>-</td><td>144</td></tr><tr><td>- College Medicine</td><td>-</td><td>173</td></tr><tr><td>- Medical Genetics</td><td>-</td><td>100</td></tr><tr><td>- Professional Medicine</td><td>-</td><td>272</td></tr><tr><td>CMB (Wang et al., 2024b)</td><td>-</td><td>9,998</td></tr><tr><td>CMExam (Liu et al., 2024b)</td><td>-</td><td>6,607</td></tr><tr><td>CMMLU* (Li et al., 2024)</td><td>-</td><td>1,140</td></tr><tr><td>- Anatomy</td><td>-</td><td>148</td></tr><tr><td>- Clinical Knowledge</td><td>-</td><td>237</td></tr><tr><td>- College Medical Statistics</td><td>-</td><td>106</td></tr><tr><td>- College Medicine</td><td>-</td><td>273</td></tr><tr><td>- Professional Medicine</td><td>-</td><td>376</td></tr><tr><td colspan="3">Other domain-specific QA</td></tr><tr><td>History (Gu et al., 2024)</td><td>8,605</td><td>250</td></tr><tr><td>Engineering (Gu et al., 2024)</td><td>4,805</td><td>250</td></tr><tr><td>Law (Gu et al., 2024)</td><td>6,510</td><td>250</td></tr><tr><td colspan="3">More in-depth analyses</td></tr><tr><td>MMedBench (Qiu et al., 2024)</td><td>-</td><td>8,178</td></tr><tr><td>- Chinese</td><td>-</td><td>3,426</td></tr><tr><td>- English</td><td>-</td><td>1,273</td></tr><tr><td>- French</td><td>-</td><td>321</td></tr><tr><td>- Japanese</td><td>-</td><td>160</td></tr><tr><td>- Russian</td><td>-</td><td>256</td></tr><tr><td>- Spanish</td><td>-</td><td>2,742</td></tr><tr><td>HaluEval (Li et al., 2023a)</td><td>-</td><td>30,000</td></tr><tr><td>- question answering</td><td>-</td><td>10,000</td></tr><tr><td>- knowledge-grounded dialogue</td><td>-</td><td>10,000</td></tr><tr><td>- text summarization</td><td>-</td><td>10,000</td></tr></table>
|
| 284 |
+
|
| 285 |
+
Table 8: Statistic information of all used datasets in our study. " # Training" and " # Test" denote the number of training and test samples, respectively.
|
| 286 |
+
|
| 287 |
+
Specifically, the training set consists of 10,178 samples, and the test set has 1273 questions.
|
| 288 |
+
|
| 289 |
+
MedMCQA. MedMCQA (Pal et al., 2022) consists of 4-option multiple-choice QA samples from the Indian medical entrance examinations (AI-IMS/NEET). This dataset covers 2.4K healthcare topics and 21 medical subjects. We use the validation set with 4,183 questions for evaluation.
|
| 290 |
+
|
| 291 |
+
MMLU*. MMLU (Hendrycks et al., 2020) is a comprehensive benchmark, including exam questions from 57 subjects (e.g., STEM and social sciences). Each MMLU subject contains 4-option multiple-choice QA samples. Similar to prior works (Singhal et al., 2025), we select 6 subjects that are most relevant to medical and clinical knowl
|
| 292 |
+
|
| 293 |
+
edge: Anatomy, Clinical Knowledge, College Biology, College Medicine, Medical Genetics and Professional Medicine. For convenience, we denote this subset as MMLU*.
|
| 294 |
+
|
| 295 |
+
CMB. CMB (Wang et al., 2024b) is a comprehensive medical benchmark in Chinese, designed and rooted entirely within the native Chinese linguistic and cultural framework. It consists of two parts: CMB-Exam, featuring multiple-choice questions from qualification exams, and CMB-Clin, including complex clinical diagnostic questions derived from real case studies. In our experiments, we evaluate the models on the samples with single answers from the test set of CMB-Exam.
|
| 296 |
+
|
| 297 |
+
CMExam. CMExam (Liu et al., 2024b) is sourced from authentic medical licensing exams, containing more than 60K questions. It can reflect the comprehensive coverage of medical knowledge and reasoning required in clinical practice, covering Traditional Medicine Disease Patterns, Digestive System Diseases, Certain Infectious, etc. For evaluation, we select the data with single-choice answers from the test set.
|
| 298 |
+
|
| 299 |
+
CMMLU*. CMMLU (Li et al., 2024) is a comprehensive Chinese benchmark that covers various subjects, including natural sciences, social sciences, engineering, and the humanities. Similar to MMLU-Medical, we also select the subjects that are most relevant to medical and clinical knowledge as the medical QA benchmarks, covering Anatomy, Clinical Knowledge, College Medical Statistics, College Medicine, and Professional Medicine. For convenience, we refer to this subset as CMMLU* in the main experiments.
|
| 300 |
+
|
| 301 |
+
Other domain-specific QA. In addition to the medical QA, we also evaluate our method in the other domains, covering history, engineering, and law. Specifically, we follow Ren et al. (2024) and procure the relevant items from the Xiezhi (Gu et al., 2024) Benchmark for each domain. Xiezhi contains 249587 questions with 516 disciplines, ranging from 13 different categories. Since Ren et al. (2024) have publicly released the collected dataset, we directly reuse the corresponding training and test sets in our experiments.
|
| 302 |
+
|
| 303 |
+
MMedBench. MMedBench (Qiu et al., 2024) is a multilingual medical multiple-choice QA benchmark across six primary languages: English, Chinese, Japanese, French, Russian, and Spanish. The
|
| 304 |
+
|
| 305 |
+
entire test set of MMedBench comprises 8,518 QA pairs. For a unified evaluation, we remove the samples with multiple answers and use the filtered 8,178 samples as the evaluation set.
|
| 306 |
+
|
| 307 |
+
HaluEval. HaluEval (Li et al., 2023a) is a large collection of generated and human-annotated hallucinated samples for evaluating the performance of LLMs in recognizing hallucination. It includes 5,000 general user queries with ChatGPT responses and 30,000 task-specific examples from three tasks, i.e., question answering, knowledge-grounded dialogue, and text summarization. In the evaluation, it randomly samples a ground-truth or a hallucinated output for each data. If the text is a hallucinated answer, the LLM should recognize the hallucination and output "Yes", which means the text contains hallucinations. If the text is a ground-truth answer, the LLM should output "No" indicating that there is no hallucination. The accuracy can evaluate the hallucination, where a larger value means less hallucination. In our study, we use task-specific examples from HaluEval for hallucination evaluation.
|
| 308 |
+
|
| 309 |
+
# A.2 Training and Evaluation Details
|
| 310 |
+
|
| 311 |
+
For model training, we fine-tune each LLM with a batch size of 16 and a peak learning rate of 1e-4, except 2e-4 for LLaMA3-3B. The warm-up ratio is 0.1 and the maximum tokenizer length is 2,048. All models are trained with LoRA (Hu et al., 2021) method for 1 epoch. We conduct all experiments on 8 NVIDIA A100 (40GB) GPUs. For conflict detection in KaFT, we set the temperature to 0.7 and sample 10 responses for each query. During evaluation, we set the temperature to 0 for reproducibility. Specifically, we use the widely-used lm-evaluation-harness² toolkit to measure the zero-shot accuracy of LLMs on multiple-choice QA benchmarks.
|
| 312 |
+
|
| 313 |
+
# A.3 Prompt Details
|
| 314 |
+
|
| 315 |
+
As mentioned in §2, we use the ICL-based method to probe the LLMs' internal domain-specific knowledge for each query. Specifically, we randomly select three samples from the training set as the few-shot examples, and use them to guide the output format of LLMs. Taking the medical QA as an example, we present a case as follows:
|
| 316 |
+
|
| 317 |
+
# Probing for LLMs' internal knowledge
|
| 318 |
+
|
| 319 |
+
For the following medical question, select one correct answer from A to D.
|
| 320 |
+
|
| 321 |
+
Question: A 3900-g (8.6-lb) male infant is delivered at 39 weeks' gestation via spontaneous vaginal delivery. Pregnancy and delivery were uncomplicated but a prenatal ultrasound at 20 weeks showed a defect in the pleuroperitoneal membrane. Further evaluation of this patient is most likely to show which of the following findings?
|
| 322 |
+
|
| 323 |
+
# Options:
|
| 324 |
+
|
| 325 |
+
A. Gastric fundus in the thorax
|
| 326 |
+
B. Pancreatic ring around the duodenum
|
| 327 |
+
C. Hypertrophy of the gastric pylorus
|
| 328 |
+
D. Large bowel in the inguinal canal
|
| 329 |
+
|
| 330 |
+
Answer: A
|
| 331 |
+
|
| 332 |
+
... (the other two examples)
|
| 333 |
+
|
| 334 |
+
For the following medical question, select one correct answer from A to D.
|
| 335 |
+
|
| 336 |
+
Question: <question>
|
| 337 |
+
|
| 338 |
+
# Options:
|
| 339 |
+
|
| 340 |
+
A.<option_a>
|
| 341 |
+
B.<option_b>
|
| 342 |
+
C.<option_c>
|
| 343 |
+
D.<option_d>
|
| 344 |
+
|
| 345 |
+
Answer: [output]
|
| 346 |
+
|
| 347 |
+
where <question> and <option> denote the input question and answer options, [output] denotes the corresponding model response.
|
| 348 |
+
|
| 349 |
+
# A.4 Full Results
|
| 350 |
+
|
| 351 |
+
Here, we report the full results of experiments in our main paper. Specifically, Table 9 shows the detailed results of different subsets. Table 10 shows the detailed results of varied wrong data. Table 11 and Table 12 show the ablation study of our proposed conflict detection method and KaFT method, respectively. Table 13 shows the detailed results of parameter analyses of $\alpha$ and $\beta$ . Table 14 shows the detailed results on the MMedBench. Please refer to the tables for more details.
|
| 352 |
+
|
| 353 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">Subset</td><td colspan="3">English Medical Benchmark</td><td colspan="3">Chinese Medical Benchmark</td><td rowspan="2">Avg.</td></tr><tr><td>MedQA</td><td>MedMCQA</td><td>MMLU*</td><td>CMB</td><td>CMExam</td><td>CMMLU*</td></tr><tr><td rowspan="5">Mistral-7B</td><td>Random</td><td>55.85</td><td>50.32</td><td>66.67</td><td>36.24</td><td>36.10</td><td>35.30</td><td>46.75</td></tr><tr><td>right</td><td>53.10</td><td>47.72</td><td>66.55</td><td>37.48</td><td>36.69</td><td>36.18</td><td>46.29</td></tr><tr><td>might-right</td><td>57.11</td><td>50.42</td><td>67.69</td><td>36.85</td><td>35.92</td><td>36.45</td><td>47.41</td></tr><tr><td>might-wrong</td><td>56.56</td><td>50.25</td><td>64.71</td><td>35.09</td><td>34.43</td><td>34.29</td><td>45.89</td></tr><tr><td>wrong</td><td>27.89</td><td>32.27</td><td>22.58</td><td>18.47</td><td>19.95</td><td>24.95</td><td>24.35</td></tr><tr><td rowspan="5">Qwen1.5-7B</td><td>Random</td><td>50.82</td><td>50.35</td><td>62.06</td><td>75.05</td><td>76.62</td><td>70.27</td><td>64.19</td></tr><tr><td>right</td><td>50.04</td><td>49.63</td><td>60.78</td><td>74.95</td><td>77.02</td><td>70.95</td><td>63.89</td></tr><tr><td>might-right</td><td>51.37</td><td>50.35</td><td>62.87</td><td>75.61</td><td>77.37</td><td>70.32</td><td>64.65</td></tr><tr><td>might-wrong</td><td>45.48</td><td>45.04</td><td>46.32</td><td>68.41</td><td>70.70</td><td>65.08</td><td>56.84</td></tr><tr><td>wrong</td><td>15.63</td><td>29.69</td><td>14.72</td><td>22.79</td><td>20.13</td><td>20.87</td><td>20.64</td></tr><tr><td rowspan="5">LLaMA3-8B</td><td>Random</td><td>60.80</td><td>55.42</td><td>71.68</td><td>46.84</td><td>47.15</td><td>44.42</td><td>54.38</td></tr><tr><td>right</td><td>59.31</td><td>56.59</td><td>72.20</td><td>47.37</td><td>47.54</td><td>45.64</td><td>54.77</td></tr><tr><td>might-right</td><td>60.49</td><td>55.58</td><td>73.15</td><td>48.13</td><td>48.01</td><td>46.96</td><td>55.39</td></tr><tr><td>might-wrong</td><td>61.67</td><td>55.49</td><td>72.58</td><td>45.76</td><td>46.12</td><td>43.75</td><td>54.23</td></tr><tr><td>wrong</td><td>23.72</td><td>30.43</td><td>37.96</td><td>23.65</td><td>22.16</td><td>25.04</td><td>27.16</td></tr><tr><td rowspan="5">LLaMA3-3B</td><td>Random</td><td>53.10</td><td>49.03</td><td>62.32</td><td>38.26</td><td>38.40</td><td>37.93</td><td>46.51</td></tr><tr><td>right</td><td>51.30</td><td>50.08</td><td>62.07</td><td>40.39</td><td>40.29</td><td>37.73</td><td>46.98</td></tr><tr><td>might-right</td><td>54.20</td><td>48.29</td><td>61.09</td><td>37.09</td><td>38.14</td><td>37.48</td><td>46.05</td></tr><tr><td>might-wrong</td><td>50.75</td><td>46.14</td><td>61.11</td><td>30.26</td><td>30.92</td><td>32.95</td><td>42.02</td></tr><tr><td>wrong</td><td>19.25</td><td>25.32</td><td>19.80</td><td>21.02</td><td>20.63</td><td>24.58</td><td>21.77</td></tr></table>
|
| 354 |
+
|
| 355 |
+
Table 9: Full results of Figure 2 (b), i.e., comparison of different subsets. For reference, we also present the results of SFT on the randomly selected samples. Note that all subsets hold the same number of training samples.
|
| 356 |
+
|
| 357 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">Ratio</td><td colspan="3">English Medical Benchmark</td><td colspan="3">Chinese Medical Benchmark</td><td rowspan="2">Avg.</td></tr><tr><td>MedQA</td><td>MedMCQA</td><td>MMLU*</td><td>CMB</td><td>CMExam</td><td>CMMLU*</td></tr><tr><td rowspan="5">Mistral-7B</td><td>0%</td><td>52.95</td><td>49.20</td><td>63.76</td><td>38.91</td><td>39.78</td><td>37.27</td><td>46.98</td></tr><tr><td>25%</td><td>53.73</td><td>49.15</td><td>64.52</td><td>38.86</td><td>39.14</td><td>37.47</td><td>47.15</td></tr><tr><td>50%</td><td>54.91</td><td>49.94</td><td>62.04</td><td>37.81</td><td>38.70</td><td>36.32</td><td>46.62</td></tr><tr><td>75%</td><td>55.85</td><td>49.32</td><td>62.93</td><td>38.17</td><td>38.99</td><td>38.37</td><td>47.27</td></tr><tr><td>100%</td><td>54.99</td><td>50.08</td><td>62.94</td><td>38.00</td><td>39.17</td><td>38.13</td><td>47.22</td></tr><tr><td rowspan="5">LLaMA3-3B</td><td>0%</td><td>58.37</td><td>51.11</td><td>68.69</td><td>38.09</td><td>36.92</td><td>36.17</td><td>48.22</td></tr><tr><td>25%</td><td>58.29</td><td>51.23</td><td>69.25</td><td>37.54</td><td>37.17</td><td>39.25</td><td>48.79</td></tr><tr><td>50%</td><td>60.02</td><td>50.32</td><td>69.69</td><td>36.75</td><td>36.73</td><td>39.15</td><td>48.78</td></tr><tr><td>75%</td><td>61.19</td><td>51.66</td><td>68.54</td><td>35.87</td><td>35.51</td><td>37.29</td><td>48.34</td></tr><tr><td>100%</td><td>59.86</td><td>43.75</td><td>68.06</td><td>36.25</td><td>36.25</td><td>35.48</td><td>46.61</td></tr></table>
|
| 358 |
+
|
| 359 |
+
Table 10: Full results of Figure 2 (c), i.e., analysis of ratio of wrong data. Notably, we randomly select varied samples from the wrong subset and merge them with the other three subsets. We set three different random seeds for data sampling and report the average results in this table.
|
| 360 |
+
|
| 361 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">Method</td><td colspan="3">English Medical Benchmark</td><td colspan="3">Chinese Medical Benchmark</td><td rowspan="2">Avg.</td></tr><tr><td>MedQA</td><td>MedMCQA</td><td>MMLU*</td><td>CMB</td><td>CMExam</td><td>CMMLU*</td></tr><tr><td rowspan="5">LLaMA3-8B</td><td>Random</td><td>60.80</td><td>55.42</td><td>71.68</td><td>46.84</td><td>47.15</td><td>44.42</td><td>54.38</td></tr><tr><td>Ours</td><td>23.72</td><td>30.43</td><td>37.96</td><td>23.65</td><td>22.16</td><td>25.04</td><td>27.16</td></tr><tr><td>-w/o diverse query</td><td>41.32</td><td>40.04</td><td>61.80</td><td>29.93</td><td>29.60</td><td>31.05</td><td>38.96</td></tr><tr><td>-w/o response sampling</td><td>29.38</td><td>26.63</td><td>45.03</td><td>27.46</td><td>27.27</td><td>25.16</td><td>30.15</td></tr><tr><td>-w/o both</td><td>55.22</td><td>52.88</td><td>69.61</td><td>38.10</td><td>39.14</td><td>39.07</td><td>49.00</td></tr></table>
|
| 362 |
+
|
| 363 |
+
Table 11: Full results of Table 4, i.e., ablation of our conflict detection method. LLaMA3-8B is used as the base model. Notably, we use different conflict detection to select the wrong subset for training. The worse results mean that the method can detect the conflict data more accurately, i.e., worse results refer to better performance.
|
| 364 |
+
|
| 365 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">Method</td><td colspan="3">English Medical Benchmark</td><td colspan="3">Chinese Medical Benchmark</td><td rowspan="2">Avg.</td></tr><tr><td>MedQA</td><td>MedMCQA</td><td>MMLU*</td><td>CMB</td><td>CMExam</td><td>CMMLU*</td></tr><tr><td rowspan="3">Mistral-7B</td><td>KaFT (Ours)</td><td>59.54</td><td>49.87</td><td>68.47</td><td>38.11</td><td>37.35</td><td>40.73</td><td>49.01</td></tr><tr><td>-w. constant</td><td>59.86</td><td>43.75</td><td>68.06</td><td>36.25</td><td>36.25</td><td>35.48</td><td>46.61</td></tr><tr><td>-w. auto-adapt</td><td>59.07</td><td>51.09</td><td>68.53</td><td>37.72</td><td>36.92</td><td>39.56</td><td>48.82</td></tr><tr><td rowspan="3">Qwen1.5-7B</td><td>KaFT (Ours)</td><td>53.57</td><td>49.82</td><td>63.23</td><td>75.57</td><td>77.27</td><td>72.07</td><td>65.25</td></tr><tr><td>-w. constant</td><td>52.71</td><td>50.20</td><td>61.60</td><td>74.30</td><td>76.15</td><td>70.16</td><td>64.19</td></tr><tr><td>-w. auto-adapt</td><td>52.55</td><td>50.06</td><td>63.04</td><td>75.18</td><td>77.04</td><td>70.73</td><td>64.77</td></tr><tr><td rowspan="3">LLaMA3-8B</td><td>KaFT (Ours)</td><td>64.10</td><td>56.94</td><td>74.01</td><td>47.39</td><td>47.89</td><td>45.44</td><td>55.96</td></tr><tr><td>-w. constant</td><td>61.82</td><td>55.75</td><td>73.34</td><td>45.99</td><td>45.85</td><td>44.95</td><td>54.62</td></tr><tr><td>-w. auto-adapt</td><td>61.35</td><td>56.49</td><td>73.19</td><td>47.91</td><td>48.45</td><td>46.26</td><td>55.61</td></tr><tr><td rowspan="3">LLaMA3-3B</td><td>KaFT (Ours)</td><td>54.52</td><td>50.51</td><td>64.93</td><td>40.19</td><td>39.93</td><td>39.70</td><td>48.30</td></tr><tr><td>-w. constant</td><td>54.99</td><td>50.08</td><td>62.94</td><td>38.00</td><td>39.17</td><td>38.13</td><td>47.22</td></tr><tr><td>-w. auto-adapt</td><td>53.57</td><td>50.30</td><td>63.65</td><td>39.15</td><td>39.55</td><td>38.17</td><td>47.40</td></tr></table>
|
| 366 |
+
|
| 367 |
+
Table 12: Full results of Figure 3, i.e., performance comparison (\%) between different reward strategies in KaFT. The best average results are in bold.
|
| 368 |
+
|
| 369 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">Method</td><td colspan="3">English Medical Benchmark</td><td colspan="3">Chinese Medical Benchmark</td><td rowspan="2">Avg.</td></tr><tr><td>MedQA</td><td>MedMCQA</td><td>MMLU*</td><td>CMB</td><td>CMExam</td><td>CMMLU*</td></tr><tr><td rowspan="9">Mistral-7B</td><td>α=0.1, β=0.1</td><td>57.03</td><td>48.10</td><td>68.84</td><td>37.67</td><td>37.79</td><td>40.54</td><td>48.33</td></tr><tr><td>α=0.1, β=0.5</td><td>59.54</td><td>49.87</td><td>68.47</td><td>38.11</td><td>37.35</td><td>40.73</td><td>49.01</td></tr><tr><td>α=0.1, β=1.0</td><td>58.68</td><td>50.39</td><td>68.35</td><td>37.99</td><td>37.63</td><td>39.29</td><td>48.72</td></tr><tr><td>α=0.5, β=0.1</td><td>58.76</td><td>48.82</td><td>67.98</td><td>37.38</td><td>36.76</td><td>40.05</td><td>48.29</td></tr><tr><td>α=0.5, β=0.5</td><td>59.78</td><td>51.21</td><td>68.06</td><td>37.30</td><td>36.72</td><td>39.27</td><td>48.72</td></tr><tr><td>α=0.5, β=1.0</td><td>59.31</td><td>49.70</td><td>69.05</td><td>37.99</td><td>36.87</td><td>40.18</td><td>48.85</td></tr><tr><td>α=1.0, β=0.1</td><td>56.32</td><td>46.12</td><td>67.67</td><td>36.83</td><td>36.87</td><td>40.04</td><td>47.31</td></tr><tr><td>α=1.0, β=0.5</td><td>60.09</td><td>50.18</td><td>68.41</td><td>36.31</td><td>36.39</td><td>38.77</td><td>48.36</td></tr><tr><td>α=1.0, β=1.0</td><td>59.86</td><td>43.75</td><td>68.06</td><td>36.25</td><td>36.25</td><td>35.48</td><td>46.61</td></tr><tr><td rowspan="9">Qwen1.5-7B</td><td>α=0.1, β=0.1</td><td>53.57</td><td>50.13</td><td>62.45</td><td>75.57</td><td>77.27</td><td>71.55</td><td>65.09</td></tr><tr><td>α=0.1, β=0.5</td><td>53.57</td><td>49.82</td><td>63.23</td><td>75.57</td><td>77.27</td><td>72.07</td><td>65.25</td></tr><tr><td>α=0.1, β=1.0</td><td>52.47</td><td>50.18</td><td>62.53</td><td>75.25</td><td>76.89</td><td>71.46</td><td>64.80</td></tr><tr><td>α=0.5, β=0.1</td><td>52.95</td><td>49.65</td><td>61.96</td><td>75.14</td><td>76.99</td><td>71.94</td><td>64.77</td></tr><tr><td>α=0.5, β=0.5</td><td>53.97</td><td>50.04</td><td>61.24</td><td>75.09</td><td>76.69</td><td>71.30</td><td>64.72</td></tr><tr><td>α=0.5, β=1.0</td><td>53.42</td><td>50.27</td><td>60.82</td><td>74.59</td><td>76.19</td><td>70.90</td><td>64.37</td></tr><tr><td>α=1.0, β=0.1</td><td>52.87</td><td>50.59</td><td>62.35</td><td>75.17</td><td>76.48</td><td>70.45</td><td>64.65</td></tr><tr><td>α=1.0, β=0.5</td><td>51.53</td><td>50.08</td><td>61.73</td><td>74.86</td><td>76.13</td><td>70.49</td><td>64.14</td></tr><tr><td>α=1.0, β=1.0</td><td>52.71</td><td>50.20</td><td>61.60</td><td>74.30</td><td>76.15</td><td>70.16</td><td>64.19</td></tr></table>
|
| 370 |
+
|
| 371 |
+
Table 13: Full results of Figure 4, i.e., parameter analyses of $\alpha$ and $\beta$ . The best average results are in bold.
|
| 372 |
+
|
| 373 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">Method</td><td colspan="6">MMedBench</td><td rowspan="2">Avg.</td></tr><tr><td>Chinese</td><td>English</td><td>French</td><td>Japanese</td><td>Russian</td><td>Spanish</td></tr><tr><td rowspan="5">Mistral-7B</td><td>Base</td><td>35.76</td><td>51.06</td><td>41.74</td><td>26.88</td><td>48.05</td><td>49.27</td><td>42.13</td></tr><tr><td>Vanilla SFT</td><td>41.07</td><td>58.99</td><td>48.29</td><td>30.00</td><td>60.94</td><td>58.02</td><td>49.55</td></tr><tr><td>No-conflict</td><td>41.77</td><td>56.56</td><td>49.84</td><td>36.25</td><td>62.50</td><td>56.20</td><td>50.52</td></tr><tr><td>Self-aligning</td><td>41.04</td><td>54.91</td><td>46.11</td><td>32.50</td><td>61.33</td><td>55.87</td><td>48.63</td></tr><tr><td>KaFT (Ours)</td><td>41.36</td><td>58.37</td><td>48.29</td><td>38.12</td><td>62.11</td><td>57.22</td><td>50.91</td></tr><tr><td rowspan="5">Qwen1.5-7B</td><td>Base</td><td>82.25</td><td>46.19</td><td>41.12</td><td>35.62</td><td>55.08</td><td>49.02</td><td>51.55</td></tr><tr><td>Vanilla SFT</td><td>79.16</td><td>46.82</td><td>45.48</td><td>36.25</td><td>61.72</td><td>49.12</td><td>53.09</td></tr><tr><td>No-conflict</td><td>83.07</td><td>50.90</td><td>48.60</td><td>44.38</td><td>57.81</td><td>52.88</td><td>56.27</td></tr><tr><td>Self-aligning</td><td>82.11</td><td>47.29</td><td>46.11</td><td>38.75</td><td>58.59</td><td>51.50</td><td>54.06</td></tr><tr><td>KaFT (Ours)</td><td>82.81</td><td>51.61</td><td>47.66</td><td>40.62</td><td>63.67</td><td>52.63</td><td>56.50</td></tr><tr><td rowspan="5">LLaMA3-8B</td><td>Base</td><td>56.98</td><td>58.68</td><td>53.58</td><td>40.00</td><td>55.86</td><td>59.48</td><td>54.10</td></tr><tr><td>Vanilla SFT</td><td>58.20</td><td>61.74</td><td>57.01</td><td>42.38</td><td>63.67</td><td>61.93</td><td>57.49</td></tr><tr><td>No-conflict</td><td>59.40</td><td>60.72</td><td>58.57</td><td>46.25</td><td>62.50</td><td>61.42</td><td>58.14</td></tr><tr><td>Self-aligning</td><td>59.78</td><td>60.49</td><td>57.63</td><td>45.62</td><td>62.50</td><td>62.31</td><td>58.09</td></tr><tr><td>KaFT (Ours)</td><td>60.19</td><td>63.24</td><td>58.88</td><td>46.25</td><td>63.67</td><td>62.00</td><td>59.04</td></tr><tr><td rowspan="5">LLaMA3-3B</td><td>Base</td><td>46.15</td><td>49.65</td><td>40.81</td><td>28.12</td><td>50.78</td><td>49.31</td><td>44.14</td></tr><tr><td>Vanilla SFT</td><td>47.14</td><td>53.10</td><td>40.81</td><td>33.75</td><td>51.95</td><td>51.79</td><td>46.42</td></tr><tr><td>No-conflict</td><td>48.63</td><td>53.57</td><td>42.06</td><td>35.00</td><td>51.17</td><td>51.17</td><td>46.93</td></tr><tr><td>Self-aligning</td><td>47.72</td><td>52.40</td><td>39.56</td><td>33.12</td><td>51.17</td><td>50.95</td><td>45.82</td></tr><tr><td>KaFT (Ours)</td><td>48.22</td><td>53.42</td><td>46.11</td><td>33.12</td><td>51.95</td><td>52.81</td><td>47.61</td></tr></table>
|
| 374 |
+
|
| 375 |
+
Table 14: Full results of Figure 5, i.e., performance of MMedBench (Qiu et al., 2024). In addition to LLaMA3-8B models, we also report the results of other LLMs. The best average results are in bold.
|
2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc895f3386f32f01aafa9bda64ab3860ec2eb548f922762508c4eaff3ae9d6e1
|
| 3 |
+
size 1288129
|
2025/KaFT_ Knowledge-aware Fine-tuning for Boosting LLMs’ Domain-specific Question-Answering Performance/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/3fd5eadd-a858-4895-b32a-9d068b637861_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/3fd5eadd-a858-4895-b32a-9d068b637861_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/3fd5eadd-a858-4895-b32a-9d068b637861_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:36e08c286d5b25eccf5d5f02ae78dc8df3ea6ee12711d2d9d5093217363aaf00
|
| 3 |
+
size 985099
|
2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/full.md
ADDED
|
@@ -0,0 +1,587 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Know the Unknown: An Uncertainty-Sensitive Method for LLM Instruction Tuning
|
| 2 |
+
|
| 3 |
+
Jiaqi Li $^{1}$ , Yixuan Tang $^{1}$ , Yi Yang $^{1}$
|
| 4 |
+
|
| 5 |
+
<sup>1</sup>The Hong Kong University of Science and Technology
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Large language models (LLMs) demonstrate remarkable capabilities but face challenges from hallucinations, which typically arise from insufficient knowledge or context. While instructing LLMs to acknowledge knowledge limitations by responding with "I don't know" appears promising, we find that models consistently struggle with admitting knowledge gaps. This challenge may originate from current instruction datasets that emphasise answer generation over knowledge boundary awareness. To address this limitation, we introduce Uncertainty-and-Sensitivity-Aware Tuning (US-Tuning), a novel two-stage approach for contextual question answering (QA). The first stage enhances LLMs' ability to recognise their knowledge boundaries, while the second stage reinforces instruction adherence through carefully designed causal prompts. Our experimental results demonstrate that US-Tuning not only significantly reduces incorrect answers in contextual QA but also improves models' faithfulness to their parametric knowledge, mitigating hallucinations in general QA tasks. Our fine-tuned Llama2-7B model achieves up to a $34.7\%$ improvement in handling out-of-knowledge questions and outperforms GPT-4 by $4.2\%$ in overall performance. $^{1}$
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Large language models (LLMs) have demonstrated remarkable capabilities across a wide range of natural language processing tasks (Brown et al., 2020; Wei et al., 2022; Joshi et al., 2017). Despite their impressive performance, these models face significant challenges that limit their reliable deployment in real-world applications. One of the most critical challenges is hallucination, the tendency to generate factually incorrect or non-sensical content (Maynez et al., 2020). This phenomenon occurs
|
| 14 |
+
|
| 15 |
+
INSTRUCTION: I will give a question and context ... If the context is not sufficient to answer the question, please answer it with 'Not Provided'
|
| 16 |
+
|
| 17 |
+
CONTEXT: This is a passage about Apollo 11(the first human spacecraft to land on the moon):
|
| 18 |
+
|
| 19 |
+
One of Collins' tasks was ... preparing the return capsule on Apollo 11 for Armstrong and Aldrin.
|
| 20 |
+
|
| 21 |
+
KNOWN QUESTION: Who were the first people to land on the moon?
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
|
| 25 |
+
Neil Armstrong and Edwin Buzz Aldrin
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
|
| 29 |
+
Neil Armstrong and Buzz Aldrin
|
| 30 |
+
|
| 31 |
+
UNKNOWN QUESTION: Who was the first person to walk on the moon?
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
|
| 35 |
+
Neil Armstrong
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
|
| 39 |
+
Not Provided
|
| 40 |
+
|
| 41 |
+
Figure 1: The intention of this paper is to address the inability of LLMs to recognise uncertain answers. We categorise questions into two types: Known Questions, which have specific answers, and Unknown Questions, which fall outside the provided context.
|
| 42 |
+
|
| 43 |
+
when LLMs generate outputs that either contradict the input context or introduce factually unsupported claims (Ji et al., 2023; Ye et al., 2023). The root cause of this behaviour lies in the inherent limitations in how these models learn and store knowledge during training. Specifically, LLMs encode extensive knowledge from training corpora, this knowledge is inherently incomplete and outdated. When encountering queries that require information beyond their knowledge, these models often resort to generating plausible but factually incorrect responses (Huang et al., 2024a).
|
| 44 |
+
|
| 45 |
+
To solve this question, two approaches have emerged. The first involves further fine-tuning models with additional knowledge (Liu et al., 2023b; Gao et al., 2023; Liu et al., 2023a), while the second leverages retrieval-augmented generation techniques to incorporate external databases (Es et al., 2023). However, as demonstrated in Fig. 1, these approaches still struggle with unknown queries in real-world applications, often produc
|
| 46 |
+
|
| 47 |
+
ing incorrect answers. Recent work suggests that LLMs should be capable of acknowledging their knowledge limitations by explicitly stating "I don't know" when applicable (Cole et al., 2023; Yu et al., 2024a). However, there are two major challenges. First, current instruction datasets predominantly train LLMs to provide definitive answers, inadvertently discouraging models from recognising and expressing uncertainty—defined here as a model's awareness of knowledge beyond its training boundaries (Zhang et al., 2024). Second, models explicitly optimised for uncertainty recognition often exhibit degraded performance in zero-shot question answering (QA) (Kasai et al., 2023; Li et al., 2023a; Si et al., 2023). A fundamental barrier to addressing these challenges is the lack of high-quality datasets containing unknown questions for training and evaluation. Thus, in this work, we focus on constructing contextual QA, including a scenario where the provided context is intentionally insufficient. We prioritise this approach over regulating parametric knowledge due to its greater impact on reasoning processes (Huang et al., 2024b).
|
| 48 |
+
|
| 49 |
+
Our dataset development is motivated by research showing that subtle discrepancies between available knowledge and questions can trigger hallucinations (Shuster et al., 2021). Building on the ASQA data set (Stelmakh et al., 2022), we create a balanced collection of both in-context (known) and out-of-context (unknown) questions. For the latter, we deliberately introduce minor inconsistencies in the context, such as mismatched dates or objects, while maintaining overall contextual coherence. Unlike previous works (Li et al., 2022; Chen et al., 2023), these subtle discrepancies are particularly effective in exposing the tendency of LLMs to hallucinate, making our data set especially valuable for evaluating model performance.
|
| 50 |
+
|
| 51 |
+
To enhance LLMs' capability to know the unknown and reject uncertain answers, we introduce a novel training framework termed Uncertainty-and-Sensitivity-Aware Tuning (US-Tuning). This approach contains a two-stage training process designed to balance the trade-off between uncertainty recognition and zero-shot instruction adherence. By doing so, it enhances the ability to identify and acknowledge uncertainty while preserving its original QA performance. In the first stage, we focus on awareness of uncertainty, guiding LLMs to effectively identify questions outside the knowledge boundaries. The second stage emphasises the sensitivity of the instruction, teaching the model to
|
| 52 |
+
|
| 53 |
+
reject answering unknown questions and restoring the compromised QA performance through additional fine-tuning.
|
| 54 |
+
|
| 55 |
+
Our approach addresses several fundamental challenges in developing uncertainty-aware language models for question-answering tasks. The primary challenge lies in the delicate balance between admitting the knowledge boundary and general QA performance—models that are overly sensitive to uncertainty often experience significant degradation in their ability to answer standard questions. Additionally, when fine-tuning uncertainty-aware models on conventional QA datasets, which contain questions with supporting evidence, models frequently lose their ability to effectively recognise and reject unknown queries. We attribute this degradation to the model's weak sensitivity to uncertain instructions and address it through carefully designed causal instructions in our approach.
|
| 56 |
+
|
| 57 |
+
Experimental results demonstrate that US-Tuning significantly improves the performance of prevalent LLMs in acknowledging the unknown. Notably, it achieves a $34.7\%$ improvement in addressing unknown questions and surpasses GPT-4 (OpenAI, 2023) with an overall performance increase of up to $4.2\%$ . Furthermore, it not only reduces the frequency of incorrect answers in contextual QA but also encourages LLMs to remain faithful to their parametric knowledge, thereby mitigating hallucinations across various benchmark assessments. Our key contributions are as follows:
|
| 58 |
+
|
| 59 |
+
- We construct a novel dataset and benchmark for uncertainty recognition, enabling the evaluation of the models' awareness of knowledge gaps.
|
| 60 |
+
- We investigate why LLMs tuned to prioritise uncertainty fail to adhere to essential instructions, attributing this behaviour to their weak sensitivity to uncertain prompts.
|
| 61 |
+
- We propose a novel two-stage fine-tuning paradigm for instructing the model to remain faithful to the context and reject unknown questions while exploring the relationship between faithfulness and hallucinations.
|
| 62 |
+
|
| 63 |
+
# 2 Related Work
|
| 64 |
+
|
| 65 |
+
In this section, we analyse the former works about hallucinations and instruction datasets for training.
|
| 66 |
+
|
| 67 |
+
# 2.1 Uncertainty in Hallucinations
|
| 68 |
+
|
| 69 |
+
Although the large language models (LLMs) have demonstrated strong performance in downstream
|
| 70 |
+
|
| 71 |
+
tasks by generalising and leveraging encoded knowledge within the parameters (Liu and Demberg, 2023; Zhang et al., 2023), the uncertainty of such knowledge can also mislead models to generate untrustworthy outputs (Yu et al., 2023; Ye et al., 2023; Manakul et al., 2023). Generally, the uncertainty comes from training data and overestimation (Zhang et al., 2024). Research shows that models tend to mimic the output in the training set (Kang and Hashimoto, 2020), leading to hallucinations that generate reasonable answers for insufficient question-context pairs. Furthermore, models could be overconfident in their capacities and fail to identify unknown questions (Yin et al., 2023; Ren et al., 2023; Kadavath et al., 2022).
|
| 72 |
+
|
| 73 |
+
There are studies focusing on uncertainty measurement to mitigate hallucinations. Lu et al. (2023) conclude that a correlation exists between the uncertainty and the accuracy. CAD (Shi et al., 2023) proposes a contrastive method for measuring the uncertainty of generated knowledge, restricting models to be context-awarded by amplifying output probabilities when the context is provided. Self-CheckGPT (Manakul et al., 2023) utilises sampling to identify and exclude uncertain information.
|
| 74 |
+
|
| 75 |
+
# 2.2 Faithfulness to the External Knowledge
|
| 76 |
+
|
| 77 |
+
Hallucination is defined as generations that are nonsensical or unfaithful to the provided source content (Ji et al., 2023; Filippova, 2020), encompassing both context and parametric knowledge. While most prior research has concentrated on the model's faithfulness to parametric knowledge, the aspect of contextual faithfulness as a specific and significant form of hallucination has received comparatively less attention. This gap is underscored by findings indicating that the incorporation of up-to-date and relevant knowledge within prompts can effectively mitigate fact-conflicting hallucinations (Zhou et al., 2023; Liu et al., 2022). However, these studies (Vu et al., 2023; Lewis et al., 2020) operate under the assumption that the given context is always sufficient for generating accurate answers. To address this limitation, various approaches utilise LLMs for post-generation detection (Shen et al., 2023) or editing (Chen et al., 2023) to ensure the faithfulness and consistency of the generated responses with the provided contexts. Self-RAG (Asai et al., 2023) leverages LLMs to screen the provided context, avoiding the disruptions of irrelevant information. However, models struggle to accurately determine whether the provided knowledge is sufficient for an-
|
| 78 |
+
|
| 79 |
+
swering, especially when the domains of query and context exhibit similarities. Furthermore, some research suggests that reliance on 'unknown' external knowledge can significantly impair performance, potentially exacerbating hallucinations (Lee et al., 2024). Thus, there is a pressing need for an LLM capable of knowing the 'unknown'.
|
| 80 |
+
|
| 81 |
+
# 2.3 Instruction Dataset for Training
|
| 82 |
+
|
| 83 |
+
Aligning LLMs necessitates substantial training data, prompting a trend toward synthesising instruction data to enhance performance. Self-Instruct (Wang et al., 2023) proposes generating diverse instructions using ChatGPT. To improve the query's complexity in different dimensions, WizardLM (Xu et al., 2023) uses five prompts, including depth search and with search. Conversely, AttrPrompt (Yu et al., 2024b) generates various instructions from a feature perspective without relying on class-conditional prompts. Most existing methods concentrate on improving answer quality by exploring a variety of questions with definitive answers, rather than addressing where answers are uncertain. Recent research (Zhang et al., 2024; Cole et al., 2023) has led LLMs to reject unknown questions. R-Tuning (Zhang et al., 2024), for example, trains models to recognise their knowledge limits and to respond with "I don't know". However, identifying the boundaries of parametric knowledge remains challenging due to factors such as latent space compression and hallucination. Therefore, in this study, we build a dataset based on contextual question answering and propose a two-step training method that enables models to reject unknown questions while preserving performance in other tasks.
|
| 84 |
+
|
| 85 |
+
# 3 Uncertainty-and-Sensitivity-Aware Tuning
|
| 86 |
+
|
| 87 |
+
Our research centres on the open-book contextual question-answering (QA), which aims to generate an answer $a$ based on three inputs: $i_t$ , $q$ , and $c$ . Here, $i_t$ denotes the task instructions, $q$ represents the question, and $c$ refers to the provided context. The generation process $G$ can be formulated as:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
a = G (i _ {t}, q, c)
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
To induce the model to analyse uncertainty, we will implement two explicit constraints. First, we instruct the model not to utilise knowledge beyond the context by stating in $i_{task}$ : "Your answer must not use any additional knowledge that is not mentioned in the given contexts". Second, we require
|
| 94 |
+
|
| 95 |
+

|
| 96 |
+
Figure 2: Illustration of our US-Tuning. The green dialog boxes represent task-oriented instructions, while the yellow box indicates additional causal instructions influencing the output. Overview: The models include the vanilla model, the Uncertainty-Aware Tuned (UT) model, and the Sensitivity-Aware Tuned (ST) model. We highlight that hallucinations stem from weak cognition of uncertainty and ignorance of instructions. UT (Stage 1): teaching the model to know the unknown. ST (Stage 2): instructing the model to effectively follow provided instructions.
|
| 97 |
+
|
| 98 |
+
the model to reject uncertain answers with the directive: "If the context is not sufficient to answer the question, please answer it with 'Not Provided'". This process relies on the model $G$ to evaluate whether the context $c$ is adequate to answer the question $q$ . Based on this assessment, $G$ either generate an appropriate response $(a)$ or acknowledge the insufficiency of $c$ .
|
| 99 |
+
|
| 100 |
+
# 3.1 Motivation
|
| 101 |
+
|
| 102 |
+
As demonstrated in Table 1, our benchmark indicates that vanilla large language models (LLMs) exhibit limited efficacy in rejecting questions beyond their knowledge boundaries. Through systematic experimentation, we identify two core challenges underlying this limitation. First, models frequently generate speculative answers to satisfy perceived user expectations, attributable to standard QA training paradigms that prioritise definitive responses over uncertainty acknowledgement. Second, models fine-tuned for uncertainty recognition demonstrate weakened adherence to the zero-shot instructions, creating a trade-off between rejecting unknown questions and generalisable instruction-following capabilities. This trade-off arises from the scarcity of highly confusing unknown question-context pairs. To preserve the integrity of these rare
|
| 103 |
+
|
| 104 |
+
but critical samples, we avoid direct fine-tuning on unknown questions. Instead, our proposed two-stage training framework addresses these challenges synergistically. The first stage emphasises training the model to identify and reject uncertain questions, thereby preventing inaccurate responses. The second stage involves a systematic instruction review process with answer refinement, contrasting conventional QA tuning by emphasising instruction adherence in response generation.
|
| 105 |
+
|
| 106 |
+
# 3.2 Stage 1: Uncertainty-Aware Tuning (UT)
|
| 107 |
+
|
| 108 |
+
The first stage fine-tunes the model to accurately recognise its knowledge boundaries and identify the known questions. To safeguard the ground truth in the benchmark, we formalise this task as a binary classification problem, as shown in Figure 2. Questions are categorised into two groups: known questions and unknown questions. Known questions are defined as queries with sufficient contextual support to yield accurate answers. Conversely, unknown questions are characterised by lacking adequate contextual information, often exhibiting subtle differences from the query. The model learns to evaluate contextual adequacy and classify its confidence as either "Sufficient" or "Insufficient" for response generation.
|
| 109 |
+
|
| 110 |
+
Formally, given a contextual QA dataset $D = \{(q_i, c_i), (q_i, c'_i)\}_{i=1}^n$ comprising $n$ known question-context pairs and $n$ unknown pairs, we fine-tune the LLM to perform binary classification, where responses are restricted to two categories: "Sufficient" and "Insufficient." The instruction for tuning is recorded in Appx. B.2.
|
| 111 |
+
|
| 112 |
+
# 3.3 Stage 2: Sensitivity-Aware Tuning (ST)
|
| 113 |
+
|
| 114 |
+
Although UT enables models to delineate knowledge boundaries and reject unanswerable queries, Table 1 reveals two critical challenges. First, UT-trained models exhibit heightened uncertainty sensitivity, which affects their ability to answer known questions with confidence. Second, conventional QA tuning exacerbates the model's inability to reject unknown questions, as UT reduces sensitivity to uncertain instructions. We hypothesise that this stems from a conflict in objective alignment: instructions for rejecting unknowns (applicable only to out-of-distribution queries) are not effective on the training data. Consequently, enforcing these instructions during evaluation introduces a misalignment between uncertainty recognition and instruction adherence, degrading overall performance.
|
| 115 |
+
|
| 116 |
+
To address this, our proposed ST is motivated by explicitly distinguishing the instructions into causal and non-causal ones.
|
| 117 |
+
|
| 118 |
+
- Causal instructions directly affect the response content, whereas non-causal instructions provide auxiliary guidance without affecting answer semantics. For example, instructions that constrain the format or tense of responses serve as typical causal ones. Conversely, extra instructions, such as "answering with 'Not Provided' if the context is insufficient", function as non-causal instructions when fine-tuning known questions, as they do not contribute directly to the answer.
|
| 119 |
+
- Non-causal instructions risk being disregarded, despite their critical importance to the overall task.
|
| 120 |
+
|
| 121 |
+
Our ST is designed to enhance the model's sensitivity and adherence to all instructions by ensuring that even non-causal instructions are prioritised. As shown in Fig. 2, it comprises two synergistic components: additional causal instructions and instruction review synthesis.
|
| 122 |
+
|
| 123 |
+
Causal Instruction Synthesis: By instructing GPT-4 to produce controlling conditions that directly influence response properties, such as tense,
|
| 124 |
+
|
| 125 |
+
length, or output format, we obtain additional causal instructions. These causal instructions are then randomly integrated into the original QA prompts, ensuring the model learns to prioritise and comply with diverse task requirements. The prompt for generation is presented in Appx. B.3.
|
| 126 |
+
|
| 127 |
+
Review Instruction Synthesis: The instruction review module employs the model itself to verify the fulfilment of all instructions. The model will recursively regenerate until it gets a perfect answer by utilising the prompts in Appx. B.4. The process of the instruction review is illustrated in Algo. 1.
|
| 128 |
+
|
| 129 |
+
As shown in Fig. 2, given a question-answering dataset $\{(q_1, c_1), \ldots, (q_n, c_n)\}$ and additional causal instructions, the entire process is formulated as $a = R(G(i_t + i_c, q, c))$ , where $i_c$ is a randomly selected casual instruction and $i_t$ is the original task description. $R$ is the loop function for instruction review. We employ GPT-4 and record the conversation from the loop to fine-tune the smaller model.
|
| 130 |
+
|
| 131 |
+
# 4 Experiments
|
| 132 |
+
|
| 133 |
+
In this section, we describe the data construction and the associated experiments. Table 1 shows that the suboptimal performance of LLMs in rejecting unknown questions can be attributed to two primary factors: weak uncertainty-recognition capacity and the instruction-sensitivity reduction. We assess the effectiveness of US-Tuning using prevalent LLMs on our proposed benchmark, as well as on traditional QA hallucination benchmarks.
|
| 134 |
+
|
| 135 |
+
# 4.1 Data Construction
|
| 136 |
+
|
| 137 |
+
We create a benchmark that balances known and unknown questions for evaluation, along with two specific datasets designed for US-Tuning.
|
| 138 |
+
|
| 139 |
+
Uncertainty-Recognition Benchmark To comprehensively evaluate the model's cognitive ability to identify knowledge gaps, we construct a test dataset using the ASQA (Stelmakh et al., 2022) dataset, which consists of ambiguous questions. Each question is divided into multiple subquestions with their corresponding contexts. For example, as recorded in Appx. A.11, one pair may discuss the discovery of the photoelectric effect in 1887, while another may cover the theoretical development in 1905. To generate the unknown questions, we shuffle these pairs, reassigning the questions to different but related contexts. As a result, there are two significant advancements in our benchmark. First, the context is closely rele
|
| 140 |
+
|
| 141 |
+
vant to the query, featuring partial mismatches in dates or objects, thereby challenging the model's ability to handle uncertainty. Second, the context is definitely insufficient for the query. Such samples are rare and valuable, as ASQA is the only dataset we have found that could yield sufficient samples that satisfy the requirement. We generate 3,320 known questions and 3,320 unknown questions to construct our benchmark.
|
| 142 |
+
|
| 143 |
+
In the evaluation, we design the QA template for uncertainty recognition by instructing the model to reject unknown questions, as presented:
|
| 144 |
+
|
| 145 |
+
- QA Uncertainty-Recognition: If the context is not sufficient to answer the question, please answer it with 'Not Provided'.
|
| 146 |
+
|
| 147 |
+
US-Tuning Datasets Two distinct instruction datasets are used for separate stages. For the UT, we construct a binary dataset comprising 646 samples from the ASQA (Stelmakh et al., 2022) with the ground truth concealed to prevent overlap with the evaluation data. Here is a demonstration of the prompt we used for tuning on this dataset:
|
| 148 |
+
|
| 149 |
+
- Uncertainty-Aware Tuning: You must only answer either 'Sufficient' or 'Insufficient' without any other output
|
| 150 |
+
|
| 151 |
+
To protect our valuable benchmark, the dataset for ST is derived from HotpotQA (Yang et al., 2018), a dataset designed for multi-hop QA. We generate causal instructions using GPT-4 (OpenAI, 2023) and manually select the 28 most robust instructions, as listed in Appx. C. These instructions were then integrated into 300 randomly selected samples from HotpotQA. Subsequently, we utilised GPT-4, following the methodology outlined in Section 3.3, to synthesise the final ST dataset.
|
| 152 |
+
|
| 153 |
+
# 4.2 Experiment Setting
|
| 154 |
+
|
| 155 |
+
Training Details. We evaluate our US-Tuning on prevalent open-sourced LLMs, including Llama2-7B-Chat (Touvron et al., 2023), Mistral-7B-Instruct-v0.2 (Jiang et al., 2023), and Gemma-2-9B-Instruct (Team et al., 2024). We also test GPT-4o (OpenAI, 2024), GPT-4-1106-preview (OpenAI, 2023), GPT-3.5 Turbo (OpenAI, 2023), Vicuna-7B v1.5 (Zheng et al., 2024a) and Self-RAG-7B (Asai et al., 2023) on our benchmark. Furthermore, we conduct experiments on different model sizes based on the latest Llama3-it (Grattafori et al., 2024) and Gemma3-it (Team et al., 2025) models. Our fine-tuning bases on an RTX3090 GPU
|
| 156 |
+
|
| 157 |
+
in conjunction with LLaMA-Factory (Zheng et al., 2024b), with Lora (Hu et al., 2021) in a rank of 8, a batch size of 4, and a learning rate of 5e-5. We configured the epochs to 1 and 5 for the two stages, respectively. This research integrates the instruction-based and attributed prompts, which demonstrate to effectively mitigate hallucinations (Zhou et al., 2023), as provided in Appx. B.
|
| 158 |
+
|
| 159 |
+
Evaluation Metric. We use Accknown for representing the accuracy of questions with specific answers, and Accunknown for unknown questions.
|
| 160 |
+
|
| 161 |
+
Benchmark Result. As summarised in Table 1, our analysis (Appx. A.3) reveals that prevalent LLMs struggle to reliably identify unknown questions, achieving modest accuracy rates of $60\%$ .
|
| 162 |
+
|
| 163 |
+
# 4.3 Analysis
|
| 164 |
+
|
| 165 |
+
# 4.3.1 Weak Uncertainty-Recognition Capacity
|
| 166 |
+
|
| 167 |
+
Tables 1 and 8 reveal a persistent performance gap of up to $21.0\%$ between known and unknown questions for Llama2, indicating the challenge associated with models' capacity to recognise uncertainty. By leveraging uncertainty-aware tuning (UT), as evidenced in Table 1, there is a notable improvement of up to $26.1\%$ in the accuracy of responses to unknown questions $(Acc_{unknown})$ , surpassing baseline performances and being comparable to GPT-4. However, this increased awareness of uncertainty leads to a decrease in the QA capability. Specifically, models demonstrate an excessive sensitivity to the varied phrasing of similar questions.
|
| 168 |
+
|
| 169 |
+
# 4.3.2 Instruction-Sensitivity Reduction Problem
|
| 170 |
+
|
| 171 |
+
According to Table 1, further fine-tuning on HotpotQA results in a degradation in the model's ability to reject unknown questions, primarily due to a decline in its adherence to instructions. This is evidenced by a low $Acc_{unknown}$ of $20.9\%$ , despite the uncertainty recognition capacity being maintained at $66.7\%$ (Table 8). We term this phenomenon the "instruction-sensitivity reduction problem."
|
| 172 |
+
|
| 173 |
+
As shown in Tables 1 and 8, UT equips the model with the ability to recognise and reject uncertain questions. However, the absence of unknown questions in HotpotQA means that the instruction to reject uncertain answers is never effectively implemented during training. This creates a conflict that adherencing to zero-shot instructions can inadvertently increase uncertainty, counteracting the objectives of UT and diminishing performance. Consequently, the model often disregards instruction
|
| 174 |
+
|
| 175 |
+
<table><tr><td rowspan="2">Category</td><td rowspan="2">Model</td><td colspan="3">QA Uncertainty-Recognition</td></tr><tr><td>\(Acc_{known}\)</td><td>\(Acc_{unknown}\)</td><td>F1</td></tr><tr><td rowspan="5">Benchmark</td><td>GPT-4o</td><td>80.2</td><td>85.6</td><td>82.8</td></tr><tr><td>GPT-4</td><td>79.6</td><td>83.6</td><td>81.6</td></tr><tr><td>GPT-3.5</td><td>82.1</td><td>51.8</td><td>63.5</td></tr><tr><td>Vicuna-7B v1.5</td><td>74.6</td><td>43.8</td><td>55.2</td></tr><tr><td>Self-RAG-7B</td><td>67.9</td><td>48.1</td><td>56.3</td></tr><tr><td rowspan="4">Llama2</td><td>Vanilla</td><td>79.3</td><td>58.3</td><td>67.2</td></tr><tr><td>UT (Stage 1)</td><td>52.4</td><td>84.4</td><td>64.6</td></tr><tr><td>UT+HotpotQA</td><td>77.0</td><td>20.9</td><td>32.8</td></tr><tr><td>US-Tuning</td><td>79.7</td><td>93.0</td><td>85.8</td></tr><tr><td rowspan="4">Mistral</td><td>Vanilla</td><td>85.1</td><td>63.0</td><td>72.4</td></tr><tr><td>UT (Stage 1)</td><td>77.5</td><td>75.8</td><td>76.6</td></tr><tr><td>UT+HotpotQA</td><td>87.1</td><td>52.4</td><td>65.5</td></tr><tr><td>US-Tuning</td><td>87.3</td><td>75.3</td><td>80.9</td></tr><tr><td rowspan="4">Gemma</td><td>Vanilla</td><td>86.1</td><td>74.1</td><td>73.5</td></tr><tr><td>UT (Stage 1)</td><td>76.1</td><td>86.2</td><td>80.8</td></tr><tr><td>UT+HotpotQA</td><td>91.3</td><td>20.8</td><td>33.9</td></tr><tr><td>US-Tuning</td><td>87.6</td><td>81.2</td><td>84.3</td></tr></table>
|
| 176 |
+
|
| 177 |
+
Table 1: Results (in %) for prevalent LLMs on QA uncertainty-recognition benchmark. The overall best results for each category are highlighted in bold. Results that are more than $5\%$ higher or lower than the baseline are highlighted in green and orange, respectively.
|
| 178 |
+
|
| 179 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Size</td><td colspan="3">Vanilla</td><td colspan="3">US-Tuning (ours)</td></tr><tr><td>Kno.</td><td>Unk.</td><td>F1</td><td>Kno.</td><td>Unk.</td><td>F1</td></tr><tr><td rowspan="3">Gemma3</td><td>1B</td><td>81.6</td><td>2.8</td><td>5.4</td><td>81.8</td><td>40.3</td><td>54.0</td></tr><tr><td>4B</td><td>88.0</td><td>38.7</td><td>53.8</td><td>82.3</td><td>68.6</td><td>74.9</td></tr><tr><td>12B</td><td>94.2</td><td>57.4</td><td>71.3</td><td>84.7</td><td>79.9</td><td>82.3</td></tr><tr><td rowspan="3">Llama3</td><td>1B</td><td>74.9</td><td>4.6</td><td>8.6</td><td>81.4</td><td>17.0</td><td>28.0</td></tr><tr><td>3B</td><td>86.4</td><td>51.4</td><td>64.5</td><td>84.3</td><td>63.8</td><td>72.7</td></tr><tr><td>8B*</td><td>82.8</td><td>74.6</td><td>78.5</td><td>86.6</td><td>78.6</td><td>82.4</td></tr></table>
|
| 180 |
+
|
| 181 |
+
* The 8B model is based on Llama 3.1, whereas the remaining models are fine-tuned on Llama 3.2
|
| 182 |
+
|
| 183 |
+
constraints, generating hallucinated answers for unknown questions. Our proposed ST (US-Tuning in Table 1) addresses this issue by ensuring adherence to all instructions, bridging the gap between uncertainty recognition and instruction compliance.
|
| 184 |
+
|
| 185 |
+
# 4.4 Effectiveness on Contextual QA
|
| 186 |
+
|
| 187 |
+
Among the models tested on our benchmark, the US-Tuned Llama2 ranks the highest, achieving an F1 score of $85.8\%$ , which surpasses GPT-4 by $4.2\%$ and exceeds the baseline by $18.6\%$ (as shown in Table 1). This impressive performance can be attributed to the model's optimal balance between uncertainty recognition and adherence to zero-shot instructions. Notably, it achieves a remarkable $93.0\%$ accuracy on unknown questions, the highest among prevalent LLMs, while maintaining a $79.7\%$ accuracy on known questions. Additionally, results in
|
| 188 |
+
|
| 189 |
+
Table 2 show that our method is robust and generalises well across various models and sizes, especially for Gemma3, which receives significant performance gain, highlighting the robustness and effectiveness of our US-Tuning approach in enhancing performance among prevalent LLMs. This tuning method effectively mitigates the risk of generating incorrect answers without compromising the original question-answering capabilities.
|
| 190 |
+
|
| 191 |
+
Our model effectively supports high-stakes decision-making. For unknown questions, in addition to the significantly increased $Acc_{unknown}$ , the case study in Appx. A.10 demonstrates that our model prioritises uncertainty analysis, acknowledging limitations rather than hallucinating responses. For known questions, Table 3 presents a detailed distribution of responses. The data indicate that US-Tuning substantially reduces the occurrence of wrong answers by up to $7.1\%$ , albeit with a modest increase in the proportion of unknown responses.
|
| 192 |
+
|
| 193 |
+
# 4.5 Comparison with SOTA Approaches
|
| 194 |
+
|
| 195 |
+
We evaluate our method against SOTA approaches within our uncertainty-recognition benchmark, as detailed in Appx. A.4. Table 4 shows that Honesty (Yang et al., 2024) and Calibration (Kapoor et al., 2024), which target noncontextual QA tasks, face significant instruction-sensitivity reduction, evidenced by the low $Acc_{unknown}$ . Despite being fine-tuned with unknown questions, these methods prioritise uncertainty but struggle with uncertain zero-shot instructions related to contextual uncertainty identification. As a result, they exhibit limited robustness in contextual QA. However, when integrated with our proposed ST, as experimented in Appx. A.5, Honesty exhibits significantly improved compliance with instructions and outperforms the baseline. This highlights the effectiveness of our ST in generalising uncertainty recognition capacity across diverse tasks. The results of C-DPO (Bi et al., 2024) indicate that Direct Preference Optimisation (Rafailov et al., 2024) effectively enhances the overall capabilities of the
|
| 196 |
+
|
| 197 |
+
Table 2: Accuracies (in %) on known and unknown questions for the LLMs of different sizes on QA uncertainty recognition benchmark. Values that are more than $5\%$ better than vanilla model are highlighted in bold.
|
| 198 |
+
|
| 199 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Cor.</td><td colspan="2">Vanilla</td><td colspan="3">US-Tuning (ours)</td></tr><tr><td>Wro.</td><td>Unk.</td><td>Cor.</td><td>Wro.</td><td>Unk.</td></tr><tr><td>GPT-4</td><td>79.6</td><td>4.4</td><td>16.0</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Llama2</td><td>79.2</td><td>8.5</td><td>12.2</td><td>79.7</td><td>1.4</td><td>18.9</td></tr><tr><td>Mistral</td><td>85.1</td><td>5.1</td><td>9.8</td><td>87.3</td><td>2.5</td><td>10.2</td></tr><tr><td>Gemma</td><td>86.1</td><td>3.9</td><td>10.0</td><td>87.6</td><td>1.6</td><td>10.8</td></tr></table>
|
| 200 |
+
|
| 201 |
+
Table 3: The portions of correct, wrong, and unknown responses among the responses for known questions.
|
| 202 |
+
|
| 203 |
+
<table><tr><td>Category</td><td>Method</td><td>Samples</td><td>Kno.</td><td>Unk.</td><td>F1</td></tr><tr><td>Vanilla</td><td>Llama2</td><td>-</td><td>79.3</td><td>58.3</td><td>67.2</td></tr><tr><td rowspan="2">Post-Gen.</td><td>Validation</td><td>-</td><td>82.5</td><td>53.8</td><td>65.1</td></tr><tr><td>Sampling</td><td>-</td><td>79.7</td><td>66.5</td><td>72.5</td></tr><tr><td>Prompt</td><td>CFP</td><td>-</td><td>87.4</td><td>47.6</td><td>61.6</td></tr><tr><td rowspan="4">Tuning</td><td>Calibration</td><td>-</td><td>67.1</td><td>63.2</td><td>65.1</td></tr><tr><td>Honesty</td><td>8k</td><td>74.7</td><td>61.1</td><td>67.2</td></tr><tr><td>C-DPO</td><td>4k</td><td>77.7</td><td>69.6</td><td>73.4</td></tr><tr><td>US-Tuning</td><td>3k</td><td>79.7</td><td>93.0</td><td>85.8</td></tr></table>
|
| 204 |
+
|
| 205 |
+
Table 4: Accuracies (in %) on known and unknown subsets for SOTA methods on the QA uncertainty recognition benchmark. We also report the cumulative number of training samples used by each SOTA method.
|
| 206 |
+
|
| 207 |
+
model in both QA and instruction adherence, but a gap persists compared to our tailored method. Additionally, post-generation methods face challenges in recognising unknown questions due to their limited capacity for uncertainty detection.
|
| 208 |
+
|
| 209 |
+
We also report the cumulative number of training samples used by each method in Table 4. The cumulative number is computed as the product of the number of training samples and the number of training epochs. For example, in our US-Tuning approach, 1,292 samples are used for one epoch in UT, and 300 samples are used for five epochs in ST, resulting in a cumulative total of 2,792 samples. The results demonstrate that our approach is less time-consuming, showing that small but high-quality datasets can yield effective performance.
|
| 210 |
+
|
| 211 |
+
# 4.6 Ablation Study
|
| 212 |
+
|
| 213 |
+
To further investigate the impact of US-Tuning, we decompose it into three distinct components. The detailed explanations are recorded in Appx. A.6.
|
| 214 |
+
|
| 215 |
+
- UT: 646 samples for uncertainty-aware tuning.
|
| 216 |
+
- HP: 300 samples from HotpotQA with QA prompts provided in Appx. B.1.
|
| 217 |
+
- CI: HP with causal instructions, termed ST.
|
| 218 |
+
|
| 219 |
+
As illustrated in Table 5 and Fig. 3, our findings indicate that models without UT exhibit a weak capacity for uncertainty recognition, presented by low $Acc_{unknown}$ . Furthermore, QA fine-tuning that does not incorporate causal instructions contradicts the objectives of UT, resulting in a decline in $Acc_{unknown}$ . In contrast, our ST approach not only enhances performance on known answers, achieving the highest $Acc_{known}$ reported in the table. But also, when effectively integrated with UT, our method attains optimal performance across both known and unknown questions.
|
| 220 |
+
|
| 221 |
+
<table><tr><td colspan="3">Component</td><td colspan="3">QA Uncertainty-Recognition</td></tr><tr><td>UT</td><td>HP</td><td>CI</td><td>Accknown</td><td>Accunknown</td><td>F1</td></tr><tr><td></td><td></td><td></td><td>79.3</td><td>58.3</td><td>67.2</td></tr><tr><td>✓</td><td></td><td></td><td>52.4</td><td>84.4</td><td>64.6</td></tr><tr><td></td><td>✓</td><td></td><td>77.5</td><td>58.3</td><td>66.5</td></tr><tr><td></td><td>✓</td><td>✓</td><td>84.8</td><td>59.0</td><td>69.6</td></tr><tr><td>✓</td><td>✓</td><td></td><td>77.0</td><td>20.9</td><td>32.8</td></tr><tr><td>✓</td><td>✓</td><td>✓</td><td>79.7</td><td>93.0</td><td>85.8</td></tr></table>
|
| 222 |
+
|
| 223 |
+
Table 5: Results of ablation on our QA benchmark with significant values highlighted.
|
| 224 |
+
|
| 225 |
+
# 4.7 Relationship between Faithfulness and Hallucination
|
| 226 |
+
|
| 227 |
+
We also conduct the experiment of our approach within a traditional QA setting. To our knowledge, it is the first work to elucidate the relationship between the faithfulness to context and to parametric knowledge (hallucination). R-Tuning (Zhang et al., 2024) preconstructs the tuning datasets to explicitly convey uncertainty for unknown questions, while we directly tune our pre-trained model on raw samples, as detailed in Appx. A.7. According to Table 6, while our US-Tuning shows lower effectiveness compared to the SOTA approaches specifically designed for noncontextual QA tasks, it represents a significant improvement over the vanilla model, with increases of $11.30\%$ , $10.38\%$ , and $6.26\%$ in accuracy, respectively. Our findings indicate that our model can leverage uncertainty recognition as a metacapacity, effectively applying it in both contextual and noncontextual QA scenarios.
|
| 228 |
+
|
| 229 |
+
<table><tr><td>Tuning</td><td>Model</td><td>ParaRel</td><td>MMLU</td><td>HaluEval</td></tr><tr><td>Vanilla</td><td>Llama2</td><td>43.38</td><td>38.56</td><td>76.22</td></tr><tr><td rowspan="3">NC</td><td>Honesty*</td><td>-</td><td>49.28</td><td>88.11</td></tr><tr><td>Calibration</td><td>-</td><td>53.00</td><td>87.78</td></tr><tr><td>R-Tuning</td><td>69.54</td><td>55.56</td><td>77.17</td></tr><tr><td>C</td><td>US-Tuning</td><td>54.68</td><td>48.94</td><td>82.48</td></tr></table>
|
| 230 |
+
|
| 231 |
+
* Based on Llama2-13B-Chat (Touvron et al., 2023)
|
| 232 |
+
Table 6: Average Precisions (\%) of SOTA methods designed for noncontextual (NC) and contextual (C) QA tasks on QA hallucination detection benchmarks.
|
| 233 |
+
|
| 234 |
+
<table><tr><td>Model</td><td>Vanilla</td><td>Model</td><td>Vanilla</td><td>US-Tuning</td></tr><tr><td>GPT-4</td><td>92.05</td><td>Llama2</td><td>94.04</td><td>94.37</td></tr><tr><td>GPT-3.5</td><td>77.81</td><td>Mistral</td><td>96.36</td><td>96.70</td></tr><tr><td>Vicuna</td><td>82.62</td><td>Gemma</td><td>95.28</td><td>95.04</td></tr></table>
|
| 235 |
+
|
| 236 |
+
Table 7: Compliance rate $(\%)$ of prevalent LLMs on the CoCoNot noncontextual unknown QA benchmark.
|
| 237 |
+
|
| 238 |
+
Furthermore, CoCoNot (Brahman et al., 2024) provides 302 unknown noncontextual QA pairs and
|
| 239 |
+
|
| 240 |
+
suggests employing GPT-3.5 (OpenAI, 2023) to assess compliance. We test our pre-trained models on a subset of CoCoNot, and our results indicate that US-Tuning can also slightly improve the performance in rejecting noncontextual questions.
|
| 241 |
+
|
| 242 |
+
# 5 Conclusion
|
| 243 |
+
|
| 244 |
+
This paper investigates a prevalent issue in large language models (LLMs), where insufficient contextual information results in plausible yet incorrect responses. Our research reveals that LLMs often struggle with unknown questions, primarily due to their limited uncertainty recognition capacity and weak robustness to zero-shot instructions. Notably, tuning the models to focus on uncertainty will adversely weaken adherence to zero-shot instructions. To address these issues, we propose a novel two-stage training framework, termed "uncertainty-and-sensitive-aware tuning." The first stage guides the LLM to identify unknown questions, while the second stage aims to recover diminished question-answering performance through carefully designed causal instructions. This approach enhances the model's reliability and reduces hallucinations. Our methodology distinguishes itself by fine-tuning the uncertainty recognition as a metacapacity, rather than direct training on unknown question samples, thereby enabling effective adaptation across various tasks. By open-sourcing this work, we aim to advance the development of automatic instruction synthesis datasets, emphasising data diversity and the critical reduction of hallucinations.
|
| 245 |
+
|
| 246 |
+
# Limitations
|
| 247 |
+
|
| 248 |
+
In this study, we identify two key areas for future refinement. First, the LLM encounters a long-tail problem when tuned with datasets that contain a limited number of unknown questions, necessitating further adaptation of our US-Tuning. Second, we have not analysed the parametric knowledge acquired by Llama2 during its pre-training phase, and our fine-tuning dataset may overlap with this pre-training data, potentially affecting performance. To address these challenges, future research will investigate methods for measuring model uncertainty through internal parameter monitoring, as proposed by Lu et al. (2023). By quantifying uncertainty across various inputs, we aim to identify knowledge gaps and long-tail weaknesses, informing targeted fine-tuning strategies to enhance the LLM's performance across diverse queries.
|
| 249 |
+
|
| 250 |
+
# Ethics Statement
|
| 251 |
+
|
| 252 |
+
The benchmark and datasets utilised in this study are derived from public datasets. Additionally, the US-Tuning dataset incorporates refinements using GPT-4, which may introduce inherent biases. However, the methodologies in this research are designed to avoid introducing any additional biases beyond those already inherent in the datasets.
|
| 253 |
+
|
| 254 |
+
# Acknowledgment
|
| 255 |
+
|
| 256 |
+
This work is partially supported by a research grant provided by HSBC.
|
| 257 |
+
|
| 258 |
+
# References
|
| 259 |
+
|
| 260 |
+
Akari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil, and Hannaneh Hajishirzi. 2023. Self-RAG: Learning to retrieve, generate, and critique through self-reflection. arXiv preprint arXiv:2310.11511.
|
| 261 |
+
Baolong Bi, Shaohan Huang, Yiwei Wang, Tianchi Yang, Zihan Zhang, Haizhen Huang, Lingrui Mei, Junfeng Fang, Zehao Li, Furu Wei, et al. 2024. Context-dpo: Aligning language models for contextfaithfulness. arXiv preprint arXiv:2412.15280.
|
| 262 |
+
Faeze Brahman, Sachin Kumar, Vidhisha Balachandran, Pradeep Dasigi, Valentina Pyatkin, Abhilasha Ravichander, Sarah Wiegreff, Nouha Dziri, Khyathi Chandu, Jack Hessel, et al. 2024. The art of saying no: Contextual noncompliance in language models. arXiv preprint arXiv:2407.12043.
|
| 263 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877-1901. Curran Associates, Inc.
|
| 264 |
+
Anthony Chen, Panupong Pasupat, Sameer Singh, Hongrae Lee, and Kelvin Guu. 2023. Purr: Efficiently editing language model hallucinations by denoising language model corruptions. arXiv preprint arXiv:2305.14908.
|
| 265 |
+
Jeremy Cole, Michael Zhang, Daniel Gillick, Julian Eisenschlos, Bhuwan Dhingra, and Jacob Eisenstein. 2023. Selectively answering ambiguous questions. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 530-543, Singapore. Association for Computational Linguistics.
|
| 266 |
+
|
| 267 |
+
Yanai Elazar, Nora Kassner, Shauli Ravfogel, Abhilasha Ravichander, Eduard Hovy, Hinrich Schütze, and Yoav Goldberg. 2021. Measuring and improving consistency in pretrained language models. Transactions of the Association for Computational Linguistics, 9:1012-1031.
|
| 268 |
+
Shahul Es, Jithin James, Luis Espinosa-Anke, and Steven Schockaert. 2023. Ragas: Automated evaluation of retrieval augmented generation. arXiv preprint arXiv:2309.15217.
|
| 269 |
+
Katja Filippova. 2020. Controlled hallucinations: Learning to generate faithfully from noisy data. arXiv preprint arXiv:2010.05873.
|
| 270 |
+
Tianyu Gao, Howard Yen, Jiatong Yu, and Danqi Chen. 2023. Enabling large language models to generate text with citations. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 6465-6488, Singapore. Association for Computational Linguistics.
|
| 271 |
+
Aaron Grattafori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, et al. 2024. The llama 3 herd of models. arXiv preprint arXiv:2407.21783.
|
| 272 |
+
Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. 2020. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300.
|
| 273 |
+
Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. 2021. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685.
|
| 274 |
+
Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qianglong Chen, Weihua Peng, Xiaocheng Feng, Bing Qin, et al. 2024a. A survey on hallucination in large language models: Principles, taxonomy, challenges, and open questions. ACM Transactions on Information Systems.
|
| 275 |
+
Yukun Huang, Sanxing Chen, Hongyi Cai, and Bhuwan Dhingra. 2024b. Enhancing large language models' situated faithfulness to external contexts. arXiv preprint arXiv:2410.14675.
|
| 276 |
+
Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. 2023. Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12):1-38.
|
| 277 |
+
Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, et al. 2023. Mistral 7b. arXiv preprint arXiv:2310.06825.
|
| 278 |
+
|
| 279 |
+
Mandar Joshi, Eunsol Choi, Daniel Weld, and Luke Zettlemoyer. 2017. TriviaQA: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1601-1611, Vancouver, Canada. Association for Computational Linguistics.
|
| 280 |
+
Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, Scott Johnston, Sheer El-Showk, Andy Jones, Nelson Elhage, Tristan Hume, Anna Chen, Yuntao Bai, Sam Bowman, Stanislav Fort, Deep Ganguli, Danny Hernandez, Josh Jacobson, Jackson Kernion, Shauna Kravec, Liane Lovitt, Kamal Ndousse, Catherine Olsson, Sam Ringer, Dario Amodei, Tom Brown, Jack Clark, Nicholas Joseph, Ben Mann, Sam McCandlish, Chris Olah, and Jared Kaplan. 2022. Language models (mostly) know what they know. Preprint, arXiv:2207.05221.
|
| 281 |
+
Daniel Kang and Tatsunori B. Hashimoto. 2020. Improved natural language generation via loss truncation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 718-731, Online. Association for Computational Linguistics.
|
| 282 |
+
Sanyam Kapoor, Nate Gruver, Manley Roberts, Arka Pal, Samuel Dooley, Micah Goldblum, and Andrew Wilson. 2024. Calibration-tuning: Teaching large language models to know what they don't know. In Proceedings of the 1st Workshop on Uncertainty-Aware NLP (UncertaiNLP 2024), pages 1-14.
|
| 283 |
+
Jungo Kasai, Keisuke Sakaguchi, Ronan Le Bras, Akari Asai, Xinyan Yu, Dragomir Radev, Noah A Smith, Yejin Choi, Kentaro Inui, et al. 2024. Realtime qa: what's the answer right now? Advances in Neural Information Processing Systems, 36.
|
| 284 |
+
Jungo Kasai, Keisuke Sakaguchi, yoichi takahashi, Ronan Le Bras, Akari Asai, Xinyan Velocity Yu, Dragomir Radev, Noah A. Smith, Yejin Choi, and Kentaro Inui. 2023. Realtime QA: What's the answer right now? In Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track.
|
| 285 |
+
Yoonsang Lee, Pranav Atreya, Xi Ye, and Eunsol Choi. 2024. Crafting in-context examples according to lms' parametric knowledge. Preprint, arXiv:2311.09579.
|
| 286 |
+
Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. 2020. Retrieval-augmented generation for knowledge-intensive nlp tasks. In Proceedings of the 34th International Conference on Neural Information Processing Systems, NIPS '20, Red Hook, NY, USA. Curran Associates Inc.
|
| 287 |
+
Daliang Li, Ankit Singh Rawat, Manzil Zaheer, Xin Wang, Michal Lukasik, Andreas Veit, Felix Yu,
|
| 288 |
+
|
| 289 |
+
and Sanjiv Kumar. 2022. Large language models with controllable working memory. arXiv preprint arXiv:2211.05110.
|
| 290 |
+
Daliang Li, Ankit Singh Rawat, Manzil Zaheer, Xin Wang, Michal Lukasik, Andreas Veit, Felix Yu, and Sanjiv Kumar. 2023a. Large language models with controllable working memory. In Findings of the Association for Computational Linguistics: ACL 2023, pages 1774-1793, Toronto, Canada. Association for Computational Linguistics.
|
| 291 |
+
Junyi Li, Xiaoxue Cheng, Wayne Xin Zhao, Jian-Yun Nie, and Ji-Rong Wen. 2023b. Halueval: A large-scale hallucination evaluation benchmark for large language models. arXiv preprint arXiv:2305.11747.
|
| 292 |
+
Dongqi Liu and Vera Demberg. 2023. ChatGPT vs human-authored text: Insights into controllable text summarization and sentence style transfer. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 4: Student Research Workshop), pages 1-18, Toronto, Canada. Association for Computational Linguistics.
|
| 293 |
+
Nelson Liu, Tianyi Zhang, and Percy Liang. 2023a. Evaluating verifiability in generative search engines. In Findings of the Association for Computational Linguistics: EMNLP 2023, pages 7001-7025, Singapore. Association for Computational Linguistics.
|
| 294 |
+
Tianyu Liu, Yizhe Zhang, Chris Brockett, Yi Mao, Zhifang Sui, Weizhu Chen, and Bill Dolan. 2022. A token-level reference-free hallucination detection benchmark for free-form text generation. Preprint, arXiv:2104.08704.
|
| 295 |
+
Xiao Liu, Hanyu Lai, Hao Yu, Yifan Xu, Aohan Zeng, Zhengxiao Du, Peng Zhang, Yuxiao Dong, and Jie Tang. 2023b. Webglm: Towards an efficient web-enhanced question answering system with human preferences. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD '23, page 4549-4560, New York, NY, USA. Association for Computing Machinery.
|
| 296 |
+
Sheng Lu, Hendrik Schuff, and Iryna Gurevych. 2023. How are prompts different in terms of sensitivity? arXiv preprint arXiv:2311.07230.
|
| 297 |
+
Potsawee Manakul, Adrian Liusie, and Mark Gales. 2023. SelfCheckGPT: Zero-resource black-box hallucination detection for generative large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 9004-9017, Singapore. Association for Computational Linguistics.
|
| 298 |
+
Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. 2020. On faithfulness and factuality in abstractive summarization. arXiv preprint arXiv:2005.00661.
|
| 299 |
+
OpenAI. 2023. GPT4 (Nov 7 version). https://chat.openai.com/chat.gpt-4-1106-preview.
|
| 300 |
+
|
| 301 |
+
OpenAI. 2023. Language models are few-shot learners. gpt-3.5-turbo-1106.
|
| 302 |
+
OpenAI. 2024. Gpt-4o technical report.
|
| 303 |
+
Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D Manning, Stefano Ermon, and Chelsea Finn. 2024. Direct preference optimization: Your language model is secretly a reward model. Advances in Neural Information Processing Systems, 36.
|
| 304 |
+
Ruiyang Ren, Yuhao Wang, Yingqi Qu, Wayne Xin Zhao, Jing Liu, Hao Tian, Hua Wu, Ji-Rong Wen, and Haifeng Wang. 2023. Investigating the factual knowledge boundary of large language models with retrieval augmentation. Preprint, arXiv:2307.11019.
|
| 305 |
+
Jiaming Shen, Jialu Liu, Dan Finnie, Negar Rahmati, Mike Bendersky, and Marc Najork. 2023. "why is this misleading?": Detecting news headline hallucinations with explanations. In Proceedings of the ACM Web Conference 2023, WWW '23, page 1662-1672, New York, NY, USA. Association for Computing Machinery.
|
| 306 |
+
Weijia Shi, Xiaochuang Han, Mike Lewis, Yulia Tsvetkov, Luke Zettlemoyer, and Scott Wen-tau Yih. 2023. Trusting your evidence: Hallucinate less with context-aware decoding. arXiv preprint arXiv:2305.14739.
|
| 307 |
+
Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. 2021. Retrieval augmentation reduces hallucination in conversation. In *Findings of the Association for Computational Linguistics: EMNLP* 2021, pages 3784-3803, Punta Cana, Dominican Republic. Association for Computational Linguistics.
|
| 308 |
+
Chenglei Si, Zhe Gan, Zhengyuan Yang, Shuohang Wang, Jianfeng Wang, Jordan Lee Boyd-Graber, and Lijuan Wang. 2023. Prompting GPT-3 to be reliable. In The Eleventh International Conference on Learning Representations.
|
| 309 |
+
Ivan Stelmakh, Yi Luan, Bhuwan Dhingra, and Ming-Wei Chang. 2022. ASQA: Factoid questions meet long-form answers. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 8273-8288, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics.
|
| 310 |
+
Gemma Team, Aishwarya Kamath, Johan Ferret, Shreya Pathak, Nino Vieillard, Ramona Merhej, Sarah Perrin, Tatiana Matejovicova, Alexandre Rame, Morgane Riviere, et al. 2025. Gemma 3 technical report. arXiv preprint arXiv:2503.19786.
|
| 311 |
+
Gemma Team, Morgane Riviere, Shreya Pathak, Pier Giuseppe Sessa, Cassidy Hardin, Surya Bhupatiraju, Léonard Hussenot, Thomas Mesnard, Bobak Shahriari, Alexandre Ramé, et al. 2024. Gemma 2: Improving open language models at a practical size. arXiv preprint arXiv:2408.00118.
|
| 312 |
+
|
| 313 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. 2023. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288.
|
| 314 |
+
Tu Vu, Mohit Iyyer, Xuezhi Wang, Noah Constant, Jerry Wei, Jason Wei, Chris Tar, Yun-Hsuan Sung, Denny Zhou, Quoc Le, and Thang Luong. 2023. Freshllms: Refreshing large language models with search engine augmentation. Preprint, arXiv:2310.03214.
|
| 315 |
+
Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A. Smith, Daniel Khashabi, and Hannaneh Hajishirzi. 2023. Self-instruct: Aligning language models with self-generated instructions. Preprint, arXiv:2212.10560.
|
| 316 |
+
Jason Wei, Maarten Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V Le. 2022. Finetuned language models are zero-shot learners. In International Conference on Learning Representations.
|
| 317 |
+
Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. 2023. Wizardlm: Empowering large language models to follow complex instructions. Preprint, arXiv:2304.12244.
|
| 318 |
+
Yuqing Yang, Ethan Chern, Xipeng Qiu, Graham Neubig, and Pengfei Liu. 2024. Alignment for honesty. Advances in Neural Information Processing Systems, 37:63565-63598.
|
| 319 |
+
Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William W. Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. 2018. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Conference on Empirical Methods in Natural Language Processing (EMNLP).
|
| 320 |
+
Hongbin Ye, Tong Liu, Aijia Zhang, Wei Hua, and Weiqiang Jia. 2023. Cognitive mirage: A review of hallucinations in large language models. arXiv preprint arXiv:2309.06794.
|
| 321 |
+
Zhangyue Yin, Qiushi Sun, Qipeng Guo, Jiawen Wu, Xipeng Qiu, and Xuanjing Huang. 2023. Do large language models know what they don't know? Preprint, arXiv:2305.18153.
|
| 322 |
+
Wenhao Yu, Zhihan Zhang, Zhenwen Liang, Meng Jiang, and Ashish Sabharwal. 2023. Improving language models via plug-and-play retrieval feedback. arXiv preprint arXiv:2305.14002.
|
| 323 |
+
Xiaodong Yu, Hao Cheng, Xiaodong Liu, Dan Roth, and Jianfeng Gao. 2024a. Reeval: Automatic hallucination evaluation for retrieval-augmented large language models via transferable adversarial attacks. In Findings of the Association for Computational Linguistics: NAACL 2024, pages 1333-1351.
|
| 324 |
+
|
| 325 |
+
Yue Yu, Yuchen Zhuang, Jieyu Zhang, Yu Meng, Alexander J Ratner, Ranjay Krishna, Jiaming Shen, and Chao Zhang. 2024b. Large language model as attributed training data generator: A tale of diversity and bias. Advances in Neural Information Processing Systems, 36.
|
| 326 |
+
Hanning Zhang, Shizhe Diao, Yong Lin, Yi Fung, Qing Lian, Xingyao Wang, Yangyi Chen, Heng Ji, and Tong Zhang. 2024. R-tuning: Instructing large language models to say 'i don't know'. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 7106-7132.
|
| 327 |
+
Yue Zhang, Yafu Li, Leyang Cui, Deng Cai, Lemao Liu, Tingchen Fu, Xinting Huang, Enbo Zhao, Yu Zhang, Yulong Chen, Longyue Wang, Anh Tuan Luu, Wei Bi, Freda Shi, and Shuming Shi. 2023. Siren's song in the ai ocean: A survey on hallucination in large language models. arXiv preprint arXiv:2309.01219.
|
| 328 |
+
Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric Xing, et al. 2024a. Judging llm-as-a-judge with mt-bench and chatbot arena. Advances in Neural Information Processing Systems, 36.
|
| 329 |
+
Yaowei Zheng, Richong Zhang, Junhao Zhang, Yanhan Ye, Zheyan Luo, and Yongqiang Ma. 2024b. Llamafactory: Unified efficient fine-tuning of $100+$ language models. arXiv preprint arXiv:2403.13372.
|
| 330 |
+
Wenxuan Zhou, Sheng Zhang, Hoifung Poon, and Muhao Chen. 2023. Context-faithful prompting for large language models. In *Findings of the Association for Computational Linguistics: EMNLP* 2023, pages 14544–14556, Singapore. Association for Computational Linguistics.
|
| 331 |
+
|
| 332 |
+
# A Supplementary Material
|
| 333 |
+
|
| 334 |
+
# A.1 Algorithm for Instruction Review Module
|
| 335 |
+
|
| 336 |
+
Here we provide the algorithm chart for the Review Instruction Synthesis in Section 3.3.
|
| 337 |
+
|
| 338 |
+
Algorithm 1: Instruction Review Module
|
| 339 |
+
Data: context $c$ query $q$ task instruction $i_{t}$ causal instructions $i_{c}$
|
| 340 |
+
1 while not fulfilled do
|
| 341 |
+
2 answer $\equiv$ generate(c, q, it, ic);
|
| 342 |
+
3 check $\equiv$ review(answer, it, ic);
|
| 343 |
+
4 if "<not fulfilled>" not in check then
|
| 344 |
+
5 fulfilled $\equiv$ True;
|
| 345 |
+
6 end
|
| 346 |
+
7 end
|
| 347 |
+
|
| 348 |
+
# A.2 Postfix Uncertainty-Recognition
|
| 349 |
+
|
| 350 |
+
In addition to the question-answering (QA) Uncertainty-Recognition Benchmark mentioned in Section 4.1, we further develop a postfix template specifically for uncertainty recognition. Different from the QA one, the postfix template emphasises the assessment of uncertainty by evaluating the sufficiency of the responses and generating a tag after the corresponding answer. The prompt template is recorded as follow:
|
| 351 |
+
|
| 352 |
+
- Postfix Uncertainty-Recognition: You must append either '<Sufficient>' or 'Insufficient' after your answer.
|
| 353 |
+
|
| 354 |
+
<table><tr><td rowspan="2">Category</td><td rowspan="2">Model</td><td colspan="3">Postfix Uncertainty-Recognition</td></tr><tr><td>Accknown</td><td>Accunknown</td><td>F1</td></tr><tr><td rowspan="4">Benchmark</td><td>GPT-4</td><td>88.9</td><td>78.3</td><td>83.3</td></tr><tr><td>GPT-3.5 Turbo</td><td>97.0</td><td>33.4</td><td>49.7</td></tr><tr><td>Vicuna-7B v1.5</td><td>93.5</td><td>14.3</td><td>24.8</td></tr><tr><td>Self-RAG-7B</td><td>46.0</td><td>74.9</td><td>57.0</td></tr><tr><td rowspan="4">Llama2</td><td>Vanilla</td><td>85.2</td><td>29.5</td><td>43.9</td></tr><tr><td>UT (Stage 1)</td><td>81.3</td><td>84.0</td><td>82.6</td></tr><tr><td>UT+HotpotQA</td><td>87.1</td><td>66.7</td><td>75.5</td></tr><tr><td>US-Tuning</td><td>88.0</td><td>66.0</td><td>75.4</td></tr><tr><td rowspan="4">Mistral</td><td>Vanilla</td><td>82.8</td><td>43.1</td><td>56.7</td></tr><tr><td>UT (Stage 1)</td><td>86.1</td><td>81.9</td><td>84.0</td></tr><tr><td>UT+HotpotQA</td><td>80.7</td><td>75.1</td><td>77.8</td></tr><tr><td>US-Tuning</td><td>82.5</td><td>82.2</td><td>82.4</td></tr><tr><td rowspan="4">Gemma</td><td>Vanilla</td><td>86.3</td><td>57.6</td><td>69.1</td></tr><tr><td>UT (Stage 1)</td><td>93.4</td><td>76.2</td><td>83.9</td></tr><tr><td>UT+HotpotQA</td><td>99.4</td><td>58.7</td><td>73.8</td></tr><tr><td>US-Tuning</td><td>96.1</td><td>55.1</td><td>70.1</td></tr></table>
|
| 355 |
+
|
| 356 |
+
Table 8: Results (in %) for prevalent LLMs on postfix uncertainty-recognition benchmark. The overall best results are highlighted in bold. Results that are more than $5\%$ higher or lower than the baseline are highlighted in green and orange, respectively.
|
| 357 |
+
|
| 358 |
+
Figure 8 presents the evaluation results from our benchmark using the postfix template, focusing solely on the accuracy of the sufficiency tags rather than the correctness of answers. The findings indicate that most prevalent large language models (LLMs) struggle to effectively identify uncertainty. Furthermore, our proposed uncertainty-aware tuning (UT) shows potential to mitigate this challenge.
|
| 359 |
+
|
| 360 |
+
# A.3 Illustration to the Benchmark Results
|
| 361 |
+
|
| 362 |
+
Table 1 presents the QA performance on our benchmark. Coupled with the uncertainty recognition performance detailed in Table 8, our findings indicate that prevalent LLMs face challenges in accurately identifying unknown questions, achieving only approximately $60\%$ accuracy. Notably, GPT-4 and Gemma-2 achieve higher accuracies of $83.6\%$ and $74.1\%$ , respectively. Mistral and Llama-2 rank highest among the remaining models, surpassing GPT-3.5 despite its larger parameter size. Nevertheless, a significant performance gap persists between GPT-4 and other models. Ongoing experiments aim to explore the underlying factors contributing to this disparity. The analysis further reveals that different models respond differently to insufficient queries. Models fine-tuned on dialogue tasks tend to overly rely on and trust the given information. Self-RAG, which is fine-tuned for QA tasks involving unknown questions, demonstrates a strong ability to identify uncertainty, as indicated in Table 8, but still struggles to acknowledge it.
|
| 363 |
+
|
| 364 |
+
# A.4 Illustration to the State-of-the-Art (SOTA) Methods
|
| 365 |
+
|
| 366 |
+
Current SOTA research primarily addresses rejection in noncontextual QA tasks, leaving contextual QA underexplored. We categorise SOTA methodologies into post-generation, prompt-based, and tuning methods. Notable tuning approaches for rejecting unknown questions include Honesty-Alignment (Yang et al., 2024) and Calibration-Tuning (Kapoor et al., 2024). They focus on noncontextual QA tasks while tuning for rejecting answering in contextual QA tasks remains unaddressed. C-DPO (Bi et al., 2024) emphasizes model faithfulness to context rather than rejecting unknown questions. Context-Faithful-Prompting (CFP) (Zhou et al., 2023) aims to enhance model fidelity to context through third-person paraphrasing in prompts. Post-generation methods for uncertainty detection include Multi-Sampling (Cole et al., 2023) and LM-Validation (Kadavath et al.,
|
| 367 |
+
|
| 368 |
+
2022). The sampling method generates three outputs at a temperature of 0.6, selecting the most frequent response, while LM-Validation allows for further refinement of the generation. This study compares these methodologies with our proposed US-Tuning.
|
| 369 |
+
|
| 370 |
+
<table><tr><td>Model</td><td>Category</td><td>Contextual</td><td>Task</td></tr><tr><td>Validation</td><td>Post-Gen.</td><td>Both</td><td>Faithfulness</td></tr><tr><td>Sampling</td><td>Post-Gen.</td><td>Both</td><td>Faithfulness</td></tr><tr><td>CFP</td><td>Prompt</td><td>Contextual</td><td>Faithfulness</td></tr><tr><td>Calibration</td><td>Tuning</td><td>Noncontextual</td><td>Rejection</td></tr><tr><td>Honesty</td><td>Tuning</td><td>Noncontextual</td><td>Rejection</td></tr><tr><td>C-DPO</td><td>Tuning</td><td>Contextual</td><td>Faithfulness</td></tr><tr><td>US-Tuning</td><td>Tuning</td><td>Contextual</td><td>Rejection</td></tr></table>
|
| 371 |
+
|
| 372 |
+
# A.5 Further Ablation Study on the SOTA Method with Sensitivity-Aware Tuning
|
| 373 |
+
|
| 374 |
+
In Section 4.5, we evaluate the performance of the SOTA methods on our QA uncertainty-recognition benchmark. We attribute the low performance of Honesty-Alignment (Yang et al., 2024) to the instruction-reduction problem, evidenced by an $Acc_{unknown}$ of only $61.1\%$ , despite it being tuned on unknown noncontextual QA samples. In contrast, our US-Tuned Llama2 achieves $93.0\%$ . This section further elucidates the instruction-sensitivity reduction problem by implementing our Sensitivity-Aware Tuning (ST), which aims to enhance the model's sensitivity to constraint instructions alongside the Honesty-Alignment approach.
|
| 375 |
+
|
| 376 |
+
Table 9: Categories and targeted tasks for the SOTAs.
|
| 377 |
+
|
| 378 |
+
<table><tr><td>Method</td><td>Accknown</td><td>Accunknown</td><td>F1</td></tr><tr><td>Vanilla Llama2</td><td>79.3</td><td>58.3</td><td>67.2</td></tr><tr><td>US-Tuning</td><td>79.7</td><td>93.0</td><td>85.8</td></tr><tr><td>Honesty</td><td>74.7</td><td>61.1</td><td>67.2</td></tr><tr><td>Honesty + ST</td><td>80.4</td><td>80.8</td><td>80.6</td></tr></table>
|
| 379 |
+
|
| 380 |
+
Table 10 yields several key conclusions. First, our proposed ST effectively mitigates the instruction-sensitivity reduction problem, improving the Accunknown of Honesty-Alignment by $19.7\%$ , resulting in a $13.4\%$ enhancement in overall performance. Second, our initial stage, focused on assessing the sufficiency of the given context relative to the question, outperforms other methods, as demonstrated by a $5.2\%$ improvement of our US-Tuned Llama2 over the Sensitivity-Aware Tuned Honesty-Alignment. This advancement is
|
| 381 |
+
|
| 382 |
+
attributable to both the quality and quantity of the dataset used for ST, enabling the model to recognize knowledge gaps as a metacognitive capacity, as discussed in Section 4.7. Finally, the samples utilized for Sensitivity-Aware Tuned Honesty-Alignment are strictly non-overlapping with our benchmark, further validating the effectiveness and robustness of our proposed US-Tuning approach.
|
| 383 |
+
|
| 384 |
+
# A.6 Figure of Ablation Study
|
| 385 |
+
|
| 386 |
+
In Section 4.6, we present a comparative analysis of each model configuration. Table 12 details the specific names associated with each setting.
|
| 387 |
+
|
| 388 |
+
Table 10: Results of sensitivity-aware tuned Honesty-Alignment on QA uncertainty-recognition benchmark.
|
| 389 |
+
|
| 390 |
+
<table><tr><td>Model</td><td>UT</td><td>HP</td><td>CI</td></tr><tr><td>Llama2</td><td></td><td></td><td></td></tr><tr><td>UT</td><td>✓</td><td></td><td></td></tr><tr><td>HotpotQA</td><td></td><td>✓</td><td></td></tr><tr><td>ST</td><td></td><td>✓</td><td>✓</td></tr><tr><td>UT & HotpotQA</td><td>✓</td><td>✓</td><td></td></tr><tr><td>US-Tuning</td><td>✓</td><td>✓</td><td>✓</td></tr></table>
|
| 391 |
+
|
| 392 |
+
Table 12: Corresponding model name to each setting in the ablation study.
|
| 393 |
+
|
| 394 |
+

|
| 395 |
+
Figure 3: Comparison of different models in the ablation study. A higher score means better performance.
|
| 396 |
+
|
| 397 |
+
# A.7 Experiment Setting for Hallucination Benchmarks
|
| 398 |
+
|
| 399 |
+
R-Tuning (Zhang et al., 2024) divides the ParaRel (Elazar et al., 2021) and MMLU (Hendrycks et al., 2020) into in-domain and out-of-domain datasets, treating the entire HaluEval (Li et al., 2023b) as an out-of-domain evaluation set. Models are initially fine-tuned on in-domain datasets and subsequently evaluated on out-of-domain datasets. Our fine-tuning is based on Llama2-7B-Chat (Touvron et al., 2023) US-Tuned on ASQA (Stelmakh et al., 2022) and HotpotQA (Yang et al., 2018), as detailed in Section 3. We further fine-tune it on in-domain datasets with LoRA, adhering to the settings in R-Tuning: 1 epoch, a learning rate of 2e-5,
|
| 400 |
+
|
| 401 |
+
Context: This is a passage about Harry Potter:
|
| 402 |
+
|
| 403 |
+
An epilogue "Nineteen Years Later" (set on 1 September 2017) describes the lives of the surviving characters and the effects of Voldemort's death on the Wizarding World. In the epilogue, Harry and Ginny are married with three children, and Ron and Hermione are married with two children.
|
| 404 |
+
|
| 405 |
+
Unknown Question: What year were the Harry Potter books first released?
|
| 406 |
+
|
| 407 |
+
Vanilla Llama2: Sure, I'd be happy to help! Based on the context you provided, the Harry Potter books were first released in the year 1997. The passage states that the epilogue is set on September1, 2017, which is 19 years after the events of the final book in the series, "Harry Potter and the Deathly Hallows," which was published in 1997. Therefore, the Harry Potter books were first released in 1997.
|
| 408 |
+
|
| 409 |
+
US-Tuned Llama2: Based on the given context, the answer to the question "What year were the Harry Potter books first released?" is: Not Provided.
|
| 410 |
+
|
| 411 |
+
The context does not provide sufficient information to determine the year the Harry Potter books were first released. The passage only mentions the epilogue set in 2017, which is 19 years after the events of the books. Therefore, the year of the books' release is not mentioned or implied in the given context.
|
| 412 |
+
|
| 413 |
+
and a batch size of 4. Similarly to R-Tuning, our evaluation spans several out-of-domain datasets.
|
| 414 |
+
|
| 415 |
+
CoCoNot (Brahman et al., 2024) offers a comprehensive dataset for benchmarking the performance in rejecting answering. In this study, we utilise a subset containing 302 unknown QA pairs in a non-contextual setting and evaluate the effectiveness of US-Tuning on it. Following the methodology outlined in that paper, we employ GPT-3.5 (OpenAI, 2023) to assess the compliance with the response.
|
| 416 |
+
|
| 417 |
+
# A.8 Effectiveness on Noncontextual QA
|
| 418 |
+
|
| 419 |
+
Real-world applications include both contextual and noncontextual scenarios. We have conducted additional experiments to demonstrate that our two-stage tuning can be effectively applied in a noncontextual QA setting. We adhere strictly to the experimental setup of R-Tuning (Zhang et al., 2024) and use their pre-processed MMLU dataset, which is already divided into known and unknown questions. Specifically, 2,448 known questions are used for tuning, while the evaluation set consists of 2,439 known and 9,115 unknown questions.
|
| 420 |
+
|
| 421 |
+
First, we fine-tune the vanilla Llama2-7B-Chat on the 2,448 known questions. For UT, we further select 816 known and 816 unknown samples and ask the model with "Do you know the answer to X?" For ST, we use GPT-4o-mini (OpenAI, 2024) to generate instruction adherence tuning data based on 300 ParaRel samples. The final model is evaluated on the remaining dataset, comprising 1,623 known and 8,299 unknown samples (The rest models in Table 13 are evaluated on the whole evaluation set).
|
| 422 |
+
|
| 423 |
+
Different from our benchmark, R-Tuning reports
|
| 424 |
+
|
| 425 |
+
average precision, which involves both known and unknown questions. Here, in Table 13, we provide the accuracies on known and unknown subsets of MMLU when setting the threshold to 0.5.
|
| 426 |
+
|
| 427 |
+
Our noncontextual model outperforms the contextual one, demonstrating the generalisation and efficiency of our approach in real-world applications. Additionally, the performance variations can be attributed to potential data biases or inconsistencies in the training sets across different models, which is one reason why a contextual setting is preferred in our paper.
|
| 428 |
+
|
| 429 |
+
Table 11: An illustrative case from our proposed benchmark, along with the corresponding model responses before and after the implementation of US-Tuning.
|
| 430 |
+
|
| 431 |
+
<table><tr><td>Method</td><td>Acckno.</td><td>Accunk.</td><td>F1</td><td>AP</td></tr><tr><td>Vanilla</td><td>57.13</td><td>34.37</td><td>42.92</td><td>38.56</td></tr><tr><td>Honesty*</td><td>55.79</td><td>48.32</td><td>51.79</td><td>49.28</td></tr><tr><td>Calibration</td><td>61.61</td><td>51.61</td><td>56.19</td><td>53.00</td></tr><tr><td>R-Tuning</td><td>65.61</td><td>52.43</td><td>58.28</td><td>55.56</td></tr><tr><td>US-Tuning (C)</td><td>56.07</td><td>45.63</td><td>50.31</td><td>48.94</td></tr><tr><td>US-Tuning (NC)</td><td>62.84</td><td>52.37</td><td>57.13</td><td>54.47</td></tr></table>
|
| 432 |
+
|
| 433 |
+
* Based on Llama2-13B-Chat (Touvron et al., 2023)
|
| 434 |
+
|
| 435 |
+
Table 13: Accuracies and average precisions (in %) of SOTA methods on pre-processed MMLU benchmark. Our method is fine-tuned under two configurations: C refers to the contextual setting, while NC denotes the non-contextual setting designed for this section.
|
| 436 |
+
|
| 437 |
+
# A.9 Zero-Shot Effectiveness on RealtimeQA
|
| 438 |
+
|
| 439 |
+
RealtimeQA (Kasai et al., 2024) is a dataset designed for high-stakes scenarios that necessitate timely responses, thereby challenging the faithfulness of LLMs to contextual information. Our study utilizes 113 contextual QA pairs from RealtimeQA, of which 50 are unknown pairs. Our benchmark is distinguished by a larger sample size
|
| 440 |
+
|
| 441 |
+
compared to RealtimeQA. We directly implement our pre-trained model without further tuning on RealtimeQA. As shown in Table 14, our model demonstrates significant improvements in addressing unknown questions, underscoring the effectiveness and robustness of our approach.
|
| 442 |
+
|
| 443 |
+
<table><tr><td>Method</td><td>Accknown</td><td>Accunknown</td><td>F1</td></tr><tr><td>Vanilla Llama2</td><td>88.7</td><td>36.7</td><td>51.9</td></tr><tr><td>US-Tuning</td><td>71.8</td><td>56.0</td><td>62.9</td></tr></table>
|
| 444 |
+
|
| 445 |
+
Table 14: Accuracies $(\%)$ on RealtimeQA.
|
| 446 |
+
|
| 447 |
+
# A.10 Case Study
|
| 448 |
+
|
| 449 |
+
The case provided in Table 11 addresses a key challenge regarding uncertain information. The vanilla Llama2 incorrectly claims that the Harry Potter books were released in 1997, despite the context only referencing an epilogue set in 2017.
|
| 450 |
+
|
| 451 |
+
In contrast, our US-Tuned Llama2 effectively mitigates this issue by prioritising uncertainty detection. Rather than offering an uncertain answer, it appropriately responds with "Not Provided." This approach not only rejects uncertain responses but also clarifies the source of uncertainty, thereby enhancing the model's reliability. The implementation of US-Tuning is particularly vital in high-stakes fields, such as medicine, where a low wrong answer rate is essential. By refining LLMs' ability to recognise and communicate uncertainty, US-Tuning promotes responsible and trustworthy interactions, ensuring users receive reliable information.
|
| 452 |
+
|
| 453 |
+
# A.11 Example of Constructing Benchmark
|
| 454 |
+
|
| 455 |
+
Table 15 presents an example that illustrates the construction of our uncertainty-recognition benchmark, as detailed in Section 4.1. In this process, we shuffle the questions and their corresponding contexts to introduce uncertainty, thereby challenging the model's ability to respond to uncertain queries.
|
| 456 |
+
|
| 457 |
+
# B Instructions
|
| 458 |
+
|
| 459 |
+
In this section, we present an overview of all the prompt templates utilized in this study. Key descriptions are highlighted in red, while blue descriptions are designated for performance adjustments.
|
| 460 |
+
|
| 461 |
+
# B.1 Question Answering
|
| 462 |
+
|
| 463 |
+
Question Answering Task: You need to do the Question Answering for the following query.
|
| 464 |
+
|
| 465 |
+
I will give a question and several contexts. Based on the given contexts, give an answer to the ques
|
| 466 |
+
|
| 467 |
+
Question: Who discovered and developed an explanationfor the photoelectric effect in 1887?
|
| 468 |
+
|
| 469 |
+
Positive Context: This is a passage about Photoelectric effect: Light, and especially ultra-violet light, discharges negatively electrified bodies with the production of rays of the samenature as cathode rays. Under certain circumstances it candirectly ionize gases. The first of these phenomena was discovered by Heinrich Hertz and Wilhelm Hallwachs in 1887. The second was announced first by Philipp Lenard in 1900.
|
| 470 |
+
|
| 471 |
+
Negative Context: This is a passage about Photoelectric effect: In 1905, Einstein proposed an explanation of the photoelectric effect using a concept first put forward by Max Planck that light waves consist of tiny bundles or packets of energy known as photons or quanta.
|
| 472 |
+
|
| 473 |
+
Table 15: An example from ASQA (Stelmakh et al., 2022), where the positive context adequately supports the question, whereas the negative is insufficient.
|
| 474 |
+
|
| 475 |
+
tion. Your answer must not using any additional knowledge that is not mentioned in the contexts. If the context is not sufficient to answer the question, please answer it with 'Not Provided'
|
| 476 |
+
|
| 477 |
+
QUERY: $q$
|
| 478 |
+
|
| 479 |
+
CONTEXT: $c$
|
| 480 |
+
|
| 481 |
+
ANSWER:
|
| 482 |
+
|
| 483 |
+
# B.2 Uncertainty-Aware Tuning
|
| 484 |
+
|
| 485 |
+
Cognition Assessment Task: You need to do the Cognition Assessment for the following query.
|
| 486 |
+
|
| 487 |
+
I will give a query and a related context about the query. Your task is to judge whether the context is sufficient to answer the query.
|
| 488 |
+
|
| 489 |
+
Assessment: You must append either <Suffic. cient>’ or'Insufficient $\rightharpoondown$ after your answer.
|
| 490 |
+
|
| 491 |
+
Finetuning: You must only answer either 'Sufficient' or 'Insufficient' without any other output.
|
| 492 |
+
|
| 493 |
+
Here is the example.
|
| 494 |
+
|
| 495 |
+
QUERY: What happened to Jay when he got old?
|
| 496 |
+
|
| 497 |
+
CONTEXT: Jay Chou was the most famous singer in China when he was young, releasing many nostalgic albums and songs that are memorable to middle-aged people today.
|
| 498 |
+
|
| 499 |
+
ANSWER:
|
| 500 |
+
|
| 501 |
+
Assessment: Jay Chou was the most famous singer in China.<Insufficient>
|
| 502 |
+
|
| 503 |
+
Finetuning: Insufficient
|
| 504 |
+
|
| 505 |
+
Here is the provided information that you need to accomplish follow the provided example:
|
| 506 |
+
|
| 507 |
+
QUERY: $q$
|
| 508 |
+
|
| 509 |
+
CONTEXT: $c$
|
| 510 |
+
|
| 511 |
+
ANSWER:
|
| 512 |
+
|
| 513 |
+
# B.3 Additional Casual Instruction Generation
|
| 514 |
+
|
| 515 |
+
Your task is to provide various instructions for the questions answering task.
|
| 516 |
+
|
| 517 |
+
The questions answering task provides a context and a query. e.g. "Context: XXX Query: XXX Answer:". And your task is to add some specific requirement to the answer. e.g. "The answer must be all in upper case", "There should be no punctuation in the answer". The added instruction should be general to the query. You should generate hundreds of such instructions.
|
| 518 |
+
|
| 519 |
+
# B.4 Sensitivity-Aware Tuning
|
| 520 |
+
|
| 521 |
+
You should check whether your answer aligned the requirement by generating a Checking part, checking each sentence of the above instruction, with either <fulfilled> or <not fulfilled> mark behind the sentence, indicating whether the requirement is fulfilled or not. If there is <not fulfilled> mark behind the sentence, you must modify your answer again to fulfill the requirement, by appending a new ANSWER and CHECKING part.
|
| 522 |
+
|
| 523 |
+
Here is an example for this task:
|
| 524 |
+
|
| 525 |
+
e.g. Question Answering Task Requirements: You need to do the Task Prompt for the following query and context. Ensure the response is written in the past tense.
|
| 526 |
+
|
| 527 |
+
QUESTION: Who is Jack Chen?
|
| 528 |
+
|
| 529 |
+
CONTEXTS: People saying that Jack Chen is a famous singer in China.
|
| 530 |
+
|
| 531 |
+
ANSWER: Jack Chen is a famous singer in China.
|
| 532 |
+
|
| 533 |
+
CHECKING: Question Answering Task: You need to do the Task Prompt for the following query and context.<fulfilled>Ensure the response is written in the past tense.<not fulfilled>
|
| 534 |
+
|
| 535 |
+
ANSWER: Jack Chen is a famous singer in China.
|
| 536 |
+
|
| 537 |
+
CHECKING: Question Answering Task: You need to do the Task Prompt for the following query and context.<fulfilled>Ensure the response is written in the past tense.<fulfilled>
|
| 538 |
+
|
| 539 |
+
Here is the information of your task:
|
| 540 |
+
|
| 541 |
+
{Question Answering Instruction}
|
| 542 |
+
|
| 543 |
+
# B.5 Trustworthy Question Answering for Benchmark
|
| 544 |
+
|
| 545 |
+
Trustworthy Question Answering Task: You need to utilize the ability learnt during both the Question Answering Task and Cognition Assessment Task. And only provide the answers which are sufficiently supported by the context, otherwise provide 'Not Provided'
|
| 546 |
+
|
| 547 |
+
I will give a question and several context texts about the question. Based on the given contexts, give an answer to the question. Your answer must not using any additional knowledge that is not mentioned in the given contexts. If the context is not sufficient to answer the question, please answer it with 'Not Provided'
|
| 548 |
+
|
| 549 |
+
QUERY: $q$
|
| 550 |
+
|
| 551 |
+
CONTEXT: $c$
|
| 552 |
+
|
| 553 |
+
ANSWER:
|
| 554 |
+
|
| 555 |
+
# C Causal Instructions
|
| 556 |
+
|
| 557 |
+
We generated 100 causal instructions using GPT-4, as detailed in the prompts recorded in Appx. B.3. Subsequently, we manually selected the 28 most effective instructions based on criteria of robustness. For instance, "Answer in chronological order" is deemed lacking in robustness, as many responses do not conform to a chronological structure. Followinges the causal instructions we employed:
|
| 558 |
+
|
| 559 |
+
1. Ensure the answer is summarised in less than 50 characters.
|
| 560 |
+
2. Include at least three potential answers in the response.
|
| 561 |
+
3. Include examples from the context.
|
| 562 |
+
4. Express the answer using bullet points.
|
| 563 |
+
5. Limit the response to a minimum of 20 words.
|
| 564 |
+
6. Ensure the response is written in the past tense.
|
| 565 |
+
7. Provide a concise definition of each answer.
|
| 566 |
+
8. Provide a wrong answer that did occur in the context but not the answer to the query.
|
| 567 |
+
9. Present the answer as a dialogue between two characters discussing the topic.
|
| 568 |
+
10. Incorporate elements of humour or wit into the response.
|
| 569 |
+
11. Provide the answer in a complete sentence.
|
| 570 |
+
12. Provide a brief explanation using terminology.
|
| 571 |
+
13. Include a relevant metaphor or analogy to explain the concept
|
| 572 |
+
14. Incorporate a fictional example or event into it.
|
| 573 |
+
15. Frame the answer as a hypothetical scenario or speculation.
|
| 574 |
+
|
| 575 |
+
16. Write the answer in the style of a news headline or tabloid headline.
|
| 576 |
+
17. Frame the answer as a philosophical reflection on the question.
|
| 577 |
+
18. Present the answer as a list of humorous alternatives or alternatives.
|
| 578 |
+
19. Use creative storytelling techniques to answer.
|
| 579 |
+
20. Include a riddle or puzzle that indirectly hints at the answer.
|
| 580 |
+
21. Write in the style of a poem or lyrics.
|
| 581 |
+
22. Include a fictional quote or excerpt from a fictional text that relates to the topic.
|
| 582 |
+
23. Use imagery or descriptive language to paint a vivid picture of the answer.
|
| 583 |
+
24. Write the answer in the form of a limerick or tongue twister.
|
| 584 |
+
25. Incorporate elements of suspense or mystery into the response.
|
| 585 |
+
26. Use hyperbole or exaggeration to emphasise a point in the response.
|
| 586 |
+
27. Incorporate elements of fantasy or science fiction into the response.
|
| 587 |
+
28. Use symbolism or allegory to convey deeper meaning in the response.
|
2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b93727b3b6a7472de25c5766851e36a1bb55cde7008fba16c14d446e182dd1c7
|
| 3 |
+
size 499395
|
2025/Know the Unknown_ An Uncertainty-Sensitive Method for LLM Instruction Tuning/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/86826908-c47b-451c-a1e1-3b9045a788c9_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/86826908-c47b-451c-a1e1-3b9045a788c9_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/86826908-c47b-451c-a1e1-3b9045a788c9_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0112606318c8fd6c76874bee9575842d73264a0eb53aeed84332cb15d4c417ef
|
| 3 |
+
size 4405709
|
2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/full.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:151e72483c3ee805bb917cfb0446b3dc0d88950ec3614324e638913210e9de49
|
| 3 |
+
size 1064361
|
2025/KnowCoder-X_ Boosting Multilingual Information Extraction via Code/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/d0fad2a9-0893-44d4-a21c-5f8df75c328c_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/d0fad2a9-0893-44d4-a21c-5f8df75c328c_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/d0fad2a9-0893-44d4-a21c-5f8df75c328c_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:69654d0d2feaccc7ecc38cd697aad34335c8c45a3fe546f5ed590238ed266806
|
| 3 |
+
size 1549127
|
2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/full.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Knowing Before Saying: LLM Representations Encode Information About Chain-of-Thought Success Before Completion
|
| 2 |
+
|
| 3 |
+
Anum Afzal
|
| 4 |
+
|
| 5 |
+
Technical University of Munich anum.afzal@tum.de
|
| 6 |
+
|
| 7 |
+
Gal Chechik
|
| 8 |
+
|
| 9 |
+
Nvidia Research & Bar-Ilan University gchechik@nvidia.com
|
| 10 |
+
|
| 11 |
+
Florian Matthes
|
| 12 |
+
|
| 13 |
+
Technical University of Munich matthes@tum.de
|
| 14 |
+
|
| 15 |
+
Yftah Ziser
|
| 16 |
+
|
| 17 |
+
Nvidia Research
|
| 18 |
+
yziser@nvidia.com
|
| 19 |
+
|
| 20 |
+
# Abstract
|
| 21 |
+
|
| 22 |
+
We investigate whether the success of a zero-shot Chain-of-Thought (CoT) process can be predicted before completion. We discover that a probing classifier, based on LLM representations, performs well even before a single token is generated, suggesting that crucial information about the reasoning process is already present in the initial steps representations. In contrast, a strong BERT-based baseline, which relies solely on the generated tokens, performs worse—likely because it depends on shallow linguistic cues rather than deeper reasoning dynamics. Surprisingly, using later reasoning steps does not always improve classification. When additional context is unhelpful, earlier representations resemble later ones more, suggesting LLMs encode key information early. This implies reasoning can often stop early without loss. To test this, we conduct early stopping experiments, showing that truncating CoT reasoning still improves performance over not using CoT at all, though a gap remains compared to full reasoning. However, approaches like supervised learning or reinforcement learning designed to shorten CoT chains could leverage our classifier's guidance to identify when early stopping is effective. Our findings provide insights that may support such methods, helping to optimize CoT's efficiency while preserving its benefits.<sup>1</sup>
|
| 23 |
+
|
| 24 |
+
# 1 Introduction
|
| 25 |
+
|
| 26 |
+
Chain-of-Thought (CoT) prompting (Wei et al., 2023) enhances the capability of large language models (LLMs) to perform multi-step reasoning. It explicitly guides the LLM in creating intermediate explanations to solve a problem, offering a sequence of reasoning steps while responding to a prompt. Given its effectiveness, CoT has found success in mathematical reasoning (Zheng et al., 2023),
|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
Figure 1: Illustration of our approach. The LLM generates intermediate reasoning steps in a Chain-of-Thought sequence. At step $i$ , we use its internal representations to predict whether the CoT process will succeed. The snowflake $(\ast)$ indicates frozen parameters, while the flame $(\bullet)$ indicates trainable parameters.
|
| 30 |
+
|
| 31 |
+
medical applications (Liu et al., 2024a), faithfulness evaluation (Xu et al., 2024b), and multimodal models (Wang et al., 2024; Kumari et al., 2024; Byun et al., 2024). While CoT reasoning has been shown to improve performance across many tasks, it is computationally expensive, as it requires decomposing complex problems into a series of intermediate steps, each demanding its own processing. This raises two intriguing questions: a) Do LLMs implicitly "know" whether they will arrive at a correct answer before completing their reasoning? and b) If progressing past the initial steps doesn't improve this knowledge, does this indicate that the LLM has completed its calculation? Given the high computational cost of CoT, understanding
|
| 32 |
+
|
| 33 |
+
when and how LLMs "know" their answer could enable more efficient and targeted reasoning strategies. Developing a method to assess whether CoT will lead to a correct conclusion could optimize resource allocation—stopping reasoning early when the outcome is clear or dedicating more steps when uncertainty remains. Furthermore, this knowledge could inform annotation efforts to support CoT-specific fine-tuning.
|
| 34 |
+
|
| 35 |
+
To explore these questions, we create a CoT success prediction dataset derived from popular math-solving datasets, where zero-shot CoT has been shown to significantly outperform vanilla prompting (more details are provided in Section 4.3). By applying a CoT prompt to these questions, we capture the LLM activations across multiple CoT steps and annotate the final answer as either correct or incorrect. We then train a probing classifier (Belinkov, 2022) on top of the LLM representations (assuming white-box access) to predict if a given prefix of the ongoing CoT sequence would lead to a correct answer (see Figure 1). Our experiments show that by leveraging the LLM's internal representations, our classifier can effectively predict whether a CoT sequence will be successful—even before generating a single token—achieving $60\%$ to $76.4\%$ accuracy across different datasets and LLMs. Notably, it outperforms BERT (Devlin et al., 2019), a strong text classifier that relies only on the input text, demonstrating that the LLM's internal representations encode valuable information about intermediate calculations—information that BERT, constrained to shallow linguistic features, cannot capture.
|
| 36 |
+
|
| 37 |
+
Further experiments with mid-CoT steps reveal an intriguing pattern: in two of six cases, providing the classifier with later reasoning steps does not significantly improve its prediction accuracy. Using SVCCA, a complementary method to probing, we find that in these scenarios, earlier steps are more similar to the final step compared to the dataset where additional CoT context benefits the classifier. We conduct initial zero-shot experiments to investigate whether this similarity allows for early termination of the CoT process without affecting the final answer. While zero-shot alone is insufficient, our results suggest that more targeted approaches, such as supervised learning or reinforcement learning, could effectively shorten the CoT process while maintaining strong performance.
|
| 38 |
+
|
| 39 |
+
To conclude, our contributions are as follows:
|
| 40 |
+
|
| 41 |
+
1. We define the task of Chain-of-Thought (CoT) success prediction and investigate whether LLMs inherently estimate the effectiveness of CoT prompting before generating a full answer.
|
| 42 |
+
2. We construct datasets for this task and train a lightweight probe that predicts the success of CoT prompting before the LLM completes its generation.
|
| 43 |
+
3. Through extensive analysis, we demonstrate that leveraging LLM internal representations significantly improves classification performance compared to relying solely on generated tokens, indicating that these representations capture knowledge about intermediate calculations.
|
| 44 |
+
4. We conduct initial experiments on zero-shot early stopping in CoT, showing that while a gap remains between early stopping and full CoT completion, stopping mid-calculation still slightly outperforms not using CoT at all. This suggests that stronger methods could further unlock LLMs' potential to shorten CoT chains while maintaining high performance.
|
| 45 |
+
|
| 46 |
+
# 2 Related Work
|
| 47 |
+
|
| 48 |
+
We review studies that analyze and customize CoT reasoning and those that use the internal LLM representations to predict aspects of their generation in advance. Given the breadth of research in these areas, we focus on the most relevant works for our setup.
|
| 49 |
+
|
| 50 |
+
# 2.1 Analyzing Chain-of-Thought
|
| 51 |
+
|
| 52 |
+
As CoT reasoning gained popularity, an increasing number of papers sought to analyze its underlying mechanisms, mainly when applied to solving math questions, where it often excels. Xu et al. (2024a) demonstrated how minor changes in numbers or units can drastically affect CoT performance. Several empirical studies have explored key factors in improving CoT performance. For example, Madaan and Yazdanbakhsh (2022) used counterfactual prompts to highlight the importance of symbolic reasoning in the CoT process. Wang et al. (2023a) found that the order of rationales and their relevance to the query are the most crucial aspects of CoT. Rai and Yao (2024) analyzed the neurons in LLM feed-forward layers to determine whether information about the design decisions studied in
|
| 53 |
+
|
| 54 |
+
empirical research is encoded within them. Alternatively, Liu et al. (2024b) draw a comparison between an LLM and a human's overthinking nature. They show a series of tasks where similar to humans, LLM's performance also gets worse with CoT prompting.
|
| 55 |
+
|
| 56 |
+
Wang et al. (2023a) evaluate which factors play a role in CoT prompting and show that even using incorrect demonstration in CoT prompting leads to the generation of correct answers. In contrast, Cui et al. (2024) show that errors in intermediate reasoning steps tend to affect CoT performance. Lastly, Pfau et al. (2024) used filler words like "... to show that the CoTs displayed by LLM are just superficial and rather similar internal compute responsible for LLM's reasoning could be triggered by meaningless filler words. Bao et al. (2025) use structural causal models to analyze how instructions, reasoning steps, and answers interact in CoT prompting. Instead, our work probes internal representations to assess whether models encode information about answer correctness during the reasoning process. While their analysis is causal and text-level, ours focuses on what the model "knows" internally.
|
| 57 |
+
|
| 58 |
+
# 2.2 Probing LLMs Internal Representations
|
| 59 |
+
|
| 60 |
+
The internal representations of LLM have been used to gather insights about tasks; one such task is using representations at a given state $t$ to predict the words at positions beyond $t + 2$ (Goyal et al., 2024). Turpin et al. (2023) try to evaluate if LLM are honest in their explanations and concluded that LLM explanations are heavily biased by simple variations in the prompt, such as reordering of items. Azaria and Mitchell, 2023; Gottesman and Geva, 2024; Seo et al., 2025 investigate the task of estimating LLM's knowledge on a given subject before it starts generation. They approach this task by using the internal representations of LLM as training features for a probe that can predict if the LLM output would be faithful. The field of probing to comprehend the internal mechanisms of CoT using LLM's internal representation is still evolving.
|
| 61 |
+
|
| 62 |
+
# 2.3 CoT Reasoning for Math Tasks
|
| 63 |
+
|
| 64 |
+
Recent research has demonstrated the effectiveness of CoT reasoning in logical tasks (Sprague et al., 2024), particularly for solving mathematical datasets. Ahn et al. (2024) examine the latest advancements in large language models (LLMs) for mathematical reasoning and highlight the ef
|
| 65 |
+
|
| 66 |
+
fectiveness of CoT in this domain. Furthermore, Ji et al. (2025) introduced a dual CoT approach that incorporates self-reasoning and self-criticism to improve performance on math tasks. Several other studies (Wang et al., 2023b; Li et al., 2023) have focused on improving LLM performance in mathematical tasks by developing custom models optimized for benchmark datasets.
|
| 67 |
+
|
| 68 |
+
# 3 Methodology
|
| 69 |
+
|
| 70 |
+
Constructing the Dataset We first generate deterministic outputs to assess whether an LLM inherently "knows" if it can solve a task using CoT prompting. We run inferences with a temperature of zero, ensuring consistency and eliminating stochastic noise. In addition, low sampling temperatures are recommended for tasks that require precision and factual accuracy, such as technical writing, code generation, or question answering, which is particularly crucial for solving math problems (Renze, 2024). Each generated response is compared to a reference answer, assigning a correctness label that serves as a ground-truth label for our trained classifier. Next, assuming white-box access to the LLM, we extract the LLM's hidden states from the initial forward pass of the prompt to examine whether its internal representations encode predictive information about CoT success. These hidden states $(H)$ capture the LLM's pre-generation reasoning and are used as training features. For each sample, we obtain a 3D tensor $(H, N, k)$ , where $H = h_1, h_2, \ldots, h_L$ represents the hidden layers, $N$ is the number of samples, and $k$ is the hidden dimension size. Since prompt lengths vary, we use the last token's representation for consistency. To study the contribution of different layers, we train a separate probe for each hidden layer, evaluating its accuracy as a measure of the layer's role in CoT success prediction. A higher classification accuracy $(C_L)$ indicates that layer $L$ contains more information about the likelihood of success. We conduct our experiments using Llama-3.1-8B and Mistral-7B, utilizing all hidden layers, each with 4096 dimensions.
|
| 71 |
+
|
| 72 |
+
Classification Model Following the precedent set by Azaria and Mitchell (2023), we employ a compact feedforward neural network with three hidden layers of 256, 128, and 64 units, each using ReLU activation. The output layer applies a sigmoid activation function. Training is optimized using either the Adam or SGD optimizer, which is
|
| 73 |
+
|
| 74 |
+
selected based on empirical performance for each dataset. We perform a hyperparameter tuning specific to the task and detail the selected configurations in Appendix A. The classifier is trained for five epochs across all datasets and LLMs.
|
| 75 |
+
|
| 76 |
+
Success Prediction over Time While our primary methodology focuses on predicting CoT performance before LLM generation begins, we also explore how this prediction may change during the generation process. Identifying atomic steps in the generation can be challenging due to their varying lengths and styles, so for simplicity, we instead use percentages of the total number of tokens generated (10%, 20%, up to 90%) and concatenate them with the initial prompt (see Appendix C for illustration). This approach allows for a consistent evaluation across different generations. As in the previous approach, we extract hidden layers for partial generations at 10% intervals, enabling us to observe the evolution of internal representations. We apply a similar strategy to expand our test sets.
|
| 77 |
+
|
| 78 |
+
<table><tr><td>CoT</td><td>wo CoT</td><td colspan="3">success rate</td></tr><tr><td></td><td></td><td>Cn-k12</td><td>AQuA</td><td>Olympiad</td></tr><tr><td></td><td></td><td colspan="3">Llama-3.1-8B</td></tr><tr><td>0</td><td>0</td><td>41.83%</td><td>47.46%</td><td>44.76%</td></tr><tr><td>0</td><td>1</td><td>8.11%</td><td>2.53%</td><td>4.77%</td></tr><tr><td>1</td><td>0</td><td>32.52%</td><td>43.32%</td><td>36.97%</td></tr><tr><td>1</td><td>1</td><td>17.44%</td><td>6.67%</td><td>12.92%</td></tr><tr><td></td><td></td><td colspan="3">Mistral-7B</td></tr><tr><td>0</td><td>0</td><td>44.07%</td><td>39.43%</td><td>41.43%</td></tr><tr><td>0</td><td>1</td><td>5.89%</td><td>10.54%</td><td>8.46%</td></tr><tr><td>1</td><td>0</td><td>32.33%</td><td>33.83%</td><td>28.08%</td></tr><tr><td>1</td><td>1</td><td>17.69%</td><td>16.2%</td><td>22.03%</td></tr></table>
|
| 79 |
+
|
| 80 |
+
Table 1: We depict the percentage of Problems the LLM was able to solve with and without any Chain-of-Thought prompting on a balanced dataset where CoT prompting helped solve $50\%$ of the problems. We show a confusion matrix such that 0 means LLM was not able to solve the problem, and 1 means that it was able to solve the task.
|
| 81 |
+
|
| 82 |
+
# 4 Experimental Setup
|
| 83 |
+
|
| 84 |
+
# 4.1 Baseline
|
| 85 |
+
|
| 86 |
+
The prediction of CoT success may depend more on linguistic cues in the text than on internal LLM representations encoding intermediate computations. To explore this, we build on (Azaria and Mitchell, 2023), which examined whether LLMs
|
| 87 |
+
|
| 88 |
+
store information in their internal states, albeit for different purposes. Our goal is to demonstrate that such information is indeed retained within the LLM's representations. To test this, we use BERT as a baseline, as it relies solely on textual tokens without access to internal LLM states, effectively functioning as a black-box access approach. Given BERT's strength as a text classifier, its ability to predict CoT success would indicate that textual cues alone suffice. We use the google-bert/bert-base-uncased variant with default settings, maintaining a consistent neural network-based classification setup while varying the input features.[2]
|
| 89 |
+
|
| 90 |
+
# 4.2 Large Language Models
|
| 91 |
+
|
| 92 |
+
For the hidden representations of Llama-3.1-8B and Mistral-7B, we use the meta-llama/Llama-3.1-8B-Instruct and mistralai/Mistral-7B-Instruct-v0.3 checkpoints on huggingface respectively.
|
| 93 |
+
|
| 94 |
+
# 4.3 Datasets
|
| 95 |
+
|
| 96 |
+
We used three math problem datasets of varying difficulty in our experiments: World Olympiads Data (Olympiad) (LI et al., 2024), Chinese K-12 Exam (cn-k12) (LI et al., 2024), and AQuA (aqua) (Ling et al., 2017). To assess model behavior across different reasoning patterns, we ran each dataset with two different LLMs—Llama-3.1-8B (Grattafiori et al., 2024) and Mistral-7B—resulting in six distinct dataset variants. Since we enforce class balance (i.e., an equal number of correct and incorrect generations), the two versions of the same original dataset may contain different sets of questions, depending on the LLM's outputs. Given the difficulty level of questions within each dataset, the success rate using Llama-3.1-8B, for example, varies considerably, reaching $22\%$ , $28\%$ , and $62.3\%$ on Olympiad, cn-k12, and AQuA, respectively. For all datasets and both LLMs, we ran inference to obtain balanced train (10k) and test (1k) sets with an equal distribution of positive and negative examples. Consequently, our classification model is trained on a $10000 \times 4096$ feature space for each dataset and LLM layer combination. We reserve $10\%$ of the training set for validation to tune hyperparameters. The distribution of question and generation lengths is summarized in Table 2. Lastly, it is also important to evaluate how well the same
|
| 97 |
+
|
| 98 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="3"># Question Tokens</td><td colspan="3"># Generation Tokens</td></tr><tr><td>avg</td><td>min</td><td>max</td><td>avg</td><td>min</td><td>max</td></tr><tr><td colspan="7">Llama-3.1-8B</td></tr><tr><td>AQuA</td><td>42.96</td><td>5</td><td>308</td><td>287.24</td><td>17</td><td>512</td></tr><tr><td>Olympiad</td><td>67.76</td><td>3</td><td>1109</td><td>401.56</td><td>2</td><td>512</td></tr><tr><td>Cn-k12</td><td>76.38</td><td>7</td><td>520</td><td>327.46</td><td>4</td><td>512</td></tr><tr><td colspan="7">Mistral-7B</td></tr><tr><td>AQuA</td><td>84.23</td><td>38</td><td>344</td><td>255.07</td><td>35</td><td>509</td></tr><tr><td>Olympiad</td><td>86.10</td><td>9</td><td>1108</td><td>368.47</td><td>40</td><td>511</td></tr><tr><td>Cn-k12</td><td>88.94</td><td>5</td><td>679</td><td>304.96</td><td>29</td><td>511</td></tr></table>
|
| 99 |
+
|
| 100 |
+
Table 2: Average, Minimum and Maximum token count of Questions and LLM generation using Llama-3.1-8B and Mistral-7B tokenizers on all three datasets. Generation Tokens are capped at 512 using max_new_tokens = 512.
|
| 101 |
+
|
| 102 |
+
LLM performs when solving the same problems without chain-of-thought (CoT) prompting. We present this comparison in a confusion matrix in Table 1, which shows that, for instance, without CoT, L1ama-3.1-8B achieved only $9.2\%$ , $17.69\%$ , and $25.55\%$ success rates on AQuA, Olympiad, and cn-k12, respectively, substantially lower than the $50\%$ CoT accuracy we enforce when collecting a balanced dataset.
|
| 103 |
+
|
| 104 |
+
Olympiad: The Math Olympiad is a competitive examination designed to evaluate students' mathematical skills and competencies. We use the olympiad dataset from the NuminaMath-CoT (LI et al., 2024) collection of the dataset. This dataset is a collection of problems and respective answers following a CoT format collected from international/national contests as well as forums, books, and summer school materials.
|
| 105 |
+
|
| 106 |
+
Cn-k12: This large-scale Chinese K-12 education math exercise dataset was translated and realigned to English using GPT-4. This dataset is also part of the NuminaMath-CoT (LI et al., 2024) collection of datasets, and reference answers follow a CoT format.
|
| 107 |
+
|
| 108 |
+
AQuA: This dataset (Ling et al., 2017) consists of algebraic math problems, each presented with a step-by-step reference solution. Unlike the other two datasets, it includes multiple-choice options. We use the original dataset released by the authors.
|
| 109 |
+
|
| 110 |
+
# 4.4 Manual Annotation
|
| 111 |
+
|
| 112 |
+
Given the large dataset size, we used GPT-40 mini<sup>3</sup> to label the training and validation sets for
|
| 113 |
+
|
| 114 |
+
3https://platform.openai.com/docs/models#gpt-4o-mini
|
| 115 |
+
|
| 116 |
+
the first language model (Llama-3.1-8B). To ensure the reliability of our evaluation, we manually annotated the test set using annotators selected from a local university's STEM Master's program, compensated at 16 euros per hour. Annotators evaluated the correctness of each generation based on the question and a reference answer. On a test set of 1,000 samples, human annotations agreed with LLM-generated ones on $90.9\%$ , $94.8\%$ , and $93.4\%$ for AQuA, Cn-K12, and Olympiad, respectively. These numbers indicate that although LLM-generated labels are generally reliable, the disagreement with human judgment suggests caution when using them for evaluation. For the second language model (Mistral-7B), all datasets (training, validation, and test) were annotated using GPT-4o mini. Given the imperfect agreement observed between human and GPT-4o mini annotations for the first model, these results should be interpreted with appropriate caution.
|
| 117 |
+
|
| 118 |
+
# 5 Results and Discussion
|
| 119 |
+
|
| 120 |
+
Since the test set for Llama-3.1-8B was manually annotated by human experts, it is considered more reliable than the GPT-4o mini-annotated test set used for Mistral-7B. As a result, in certain analyses where only one LLM is presented, we focus solely on Llama-3.1-8B to ensure more reliable evaluation.
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
Figure 2: Accuracy on the test set when the probe is trained and tested on hidden representations from each layer. Results are shown for all 33 layers of Llama 3.1 8B Instruct across all three datasets.
|
| 124 |
+
|
| 125 |
+
# 5.1 Prediction before Generation
|
| 126 |
+
|
| 127 |
+
Main Results We evaluate the information contained in the internal representation of the LLM before it begins generating and present the results in Table 3, specifically under the $\% 0$ column. Given that $50\%$ of answers in the dataset are correct (bal
|
| 128 |
+
|
| 129 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="2">Before Gen</td><td colspan="10">Over Time</td></tr><tr><td>top-5 layers</td><td>0%</td><td>10%</td><td>20%</td><td>30%</td><td>40%</td><td>50%</td><td>60%</td><td>70%</td><td>80%</td><td>90%</td><td>100%</td></tr><tr><td colspan="13">Llama-3.1-8B (human-annotated)</td></tr><tr><td colspan="13">BERT (baseline)</td></tr><tr><td>AQuA</td><td>-</td><td>53.50</td><td>54.2</td><td>55.8</td><td>54.1</td><td>54.1</td><td>53.5</td><td>51.7</td><td>51.6</td><td>53.7</td><td>51.7</td><td>50.6</td></tr><tr><td>Olympiad</td><td>-</td><td>69.10</td><td>67.9</td><td>68.7</td><td>66.2</td><td>66.4</td><td>67.4</td><td>65.1</td><td>67.9</td><td>66.8</td><td>67.1</td><td>66.9</td></tr><tr><td>Cn-k12</td><td>-</td><td>66.20</td><td>57.8</td><td>64.4</td><td>64.1</td><td>63.8</td><td>64.3</td><td>63.8</td><td>62.7</td><td>61.7</td><td>61.1</td><td>62.4</td></tr><tr><td colspan="13">Our Model</td></tr><tr><td>AQuA</td><td>11, 12, 13, 14, 16</td><td>60</td><td>51.5</td><td>60</td><td>60.5</td><td>63.2</td><td>60.11</td><td>60.8</td><td>63.7</td><td>62.9</td><td>65.7</td><td>69.4</td></tr><tr><td>Olympiad</td><td>8, 14, 16, 17, 31</td><td>76.4</td><td>75.1</td><td>75.8</td><td>73.8</td><td>74.6</td><td>76.5</td><td>73.8</td><td>75.3</td><td>75.3</td><td>73.8</td><td>75.9</td></tr><tr><td>Cn-k12</td><td>13, 14, 16, 17 22</td><td>69.10</td><td>67.7</td><td>69.9</td><td>69.2</td><td>67.7</td><td>67.2</td><td>70</td><td>71.6</td><td>70.7</td><td>68.9</td><td>70.9</td></tr><tr><td colspan="13">Mistral-7B (GPT-4o mini annotated)</td></tr><tr><td colspan="13">BERT (baseline)</td></tr><tr><td>AQuA</td><td>-</td><td>60.1</td><td>57.8</td><td>59.5</td><td>63.4</td><td>65.2</td><td>63.7</td><td>67.8</td><td>66.7</td><td>66.8</td><td>68.1</td><td>71.8</td></tr><tr><td>Olympiad</td><td>-</td><td>68.8</td><td>68.1</td><td>69.6</td><td>68.8</td><td>68.3</td><td>68.6</td><td>66.4</td><td>67.1</td><td>68.3</td><td>68.6</td><td>69.6</td></tr><tr><td>Cn-k12</td><td>-</td><td>65.5</td><td>63.5</td><td>65.8</td><td>65.1</td><td>64.4</td><td>64.8</td><td>66.5</td><td>66.7</td><td>67.3</td><td>67.8</td><td>68.5</td></tr><tr><td colspan="13">Our Model</td></tr><tr><td>AQuA</td><td>15, 16, 18, 23, 28</td><td>64.7</td><td>54.4</td><td>66.1</td><td>66.9</td><td>66.4</td><td>65.1</td><td>65.8</td><td>64.1</td><td>66.6</td><td>67.4</td><td>80.2</td></tr><tr><td>Olympiad</td><td>7, 9, 18, 26, 28</td><td>71.8</td><td>71.7</td><td>72.0</td><td>72.3</td><td>74.1</td><td>74.2</td><td>75.6</td><td>74.5</td><td>75.3</td><td>75.5</td><td>75.9</td></tr><tr><td>Cn-k12</td><td>12, 14, 18, 21, 24</td><td>67.1</td><td>68.0</td><td>68.4</td><td>66.7</td><td>67.7</td><td>67.8</td><td>67.1</td><td>68.1</td><td>68.6</td><td>67.6</td><td>71.4</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Table 3: Classification model accuracy before generation begins and as it progresses, measured at different completion percentages. The best-performing layers and time steps are highlighted in bold.
|
| 132 |
+
|
| 133 |
+
anced data), a random classifier would achieve an accuracy of $50\%$ , which serves as the baseline for interpreting the results. The BERT baseline, which relies exclusively on token representations on CoT prompt with question, consistently outperformed random chance across all six datasets. On generations from Llama-3.1-8B, BERT achieved accuracy scores ranging from $53.5\%$ to $69.1\%$ . For Mistral-7B, BERT's accuracy ranged from $60.1\%$ to $68.8\%$ . However, the predictive power appears relatively weaker for the AQuA dataset<sup>4</sup>. Our suggested method, which uses the LLM's internal representations, outperformed the BERT baseline across all datasets, demonstrating their importance for predicting CoT success before generation begins. For instance, on Llama-3.1-8B datasets, our model achieved $60.0\%$ accuracy on AQuA, significantly higher than BERT, and $76.4\%$ on Olympiad, compared to BERT's $69.1\%$ . We observe similar patterns for the Mistral-7B datasets. The large variance in results (ranging from $60.0\%$ to $76.4\%$ ) suggests that the effectiveness of the internal rep
|
| 134 |
+
|
| 135 |
+
resentations may be influenced by factors such as task complexity or dataset characteristics, which warrant further investigation. See Appendix B for details on Classification Performance Breakdown.
|
| 136 |
+
|
| 137 |
+
LLM Layers Analysis In our experiments, we evaluated the accuracy of the classification model when trained on the hidden representations of each layer. We show the accuracy per layer of Llama-3.1-8B in Figure 2. It can be seen that the middle such as layers 11 - 14 and layers 16 - 17, and in some cases the last layers of the LLM seem to play a role in its internal notion of Success or Failure. As the in shown Table 3, we find layer 14 and layer 16 to be consistent among all three datasets suggesting these layers to be more involved in the notion of CoT prediction. Our findings are inline with those of Azaria and Mitchell 2023, who show similar results regarding LLM's notion of truthfulness and show layer 16 and in some cases the last layers of LLM to be most knowledgeable for their task.
|
| 138 |
+
|
| 139 |
+
# 5.2 Prediction over Time
|
| 140 |
+
|
| 141 |
+
Main Results We evaluate the information contained in the internal representation of the LLM
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 3: Similarity scores using SVCCA between hidden representations of each time step and the full generation, using Layer 14 for all three Llama-3.1-8B datasets.
|
| 145 |
+
|
| 146 |
+
during generation, as shown in Table 3. To do this, we capture the hidden states at various time intervals—after the LLM has generated $10\%$ , $20\%$ , and so on of the total content—and use these states to train the probe. The goal is to assess whether the LLM's understanding of success or failure becomes more apparent as more content is generated. This aligns with the idea that as more information is revealed, the model's understanding of success or failure becomes clearer, similar to how humans typically gain better insight into a task as they progress further. We selected the layer that performed best on the given dataset in prior evaluations for the prediction-over-time experiments. Interestingly, in the Llama-3.1-8B-generated dataset, BERT's performance tends to decline as more context is revealed, whereas for Mistral-7B, it remains relatively stable. While BERT can effectively process surface-level cues such as question structure, it appears less capable of tracking the evolving reasoning embedded in the chain-of-thought (CoT) generation. As the CoT unfolds and more tokens are added, the increasing complexity may exceed BERT's shallow interpretive capacity, limiting its ability to follow deeper logical developments. In contrast, using internal LLM representations as input significantly improves performance—e.g., from $60\%$ to $69.4\%$ on AQuA in the Llama-3.1-8B-generated dataset—and yields consistent gains across all Mistral-7B datasets. For Olympiad and cn-k12 with Llama-3.1-8B, results remain comparable. This demonstrates the representations' ability to capture more nuanced, cumulative reasoning and better reflect the underlying complexity
|
| 147 |
+
|
| 148 |
+
of the CoT process, ultimately enabling more accurate success prediction. Surprisingly, Mistral-7B-generated AQuA dataset performs better as compared to the Llama-3.1-8B-generated one. Further inspection of the generations revealed that for the negative examples, Mistral-7B generations often assume that the provided question might be incorrect. These linguistic queues as shown in Table 4, might be used by BERT baseline as a feature to classify negative examples.
|
| 149 |
+
|
| 150 |
+
Complimentary Analysis for Probing Our probing results suggest that the initial CoT steps in the Olympiad and Cn-K12 Llama-3.1-8B generated datasets contain similar knowledge about CoT success as the later stages, which may indicate that they share an understanding of the calculations performed up to that point. However, prior research has highlighted several limitations of probing. For instance, when trained on a large number of examples, models using randomly initialized embeddings as input representations can outperform those using pretrained intermediate representations (Zhang and Bowman, 2018; Wieting and Kiela, 2019). To complement probing-based analyses, several alternative methods assess knowledge in model representations by measuring their correlations without relying on a classifier. These include SVCCA (Singular Vector Canonical Correlation Analysis) (Raghu et al., 2017), PWCCA (Projection Weighted Canonical Correlation Analysis) (Morcos et al., 2018), and CKA (Centered Kernel Alignment) (Kornblith et al., 2019), among others. Such methods are frequently used as alternatives for probing in NLP research (Saphra and
|
| 151 |
+
|
| 152 |
+
# Example 1
|
| 153 |
+
|
| 154 |
+
1. First, we need to find the probability that Kyle and Catherine solve the problem but David does not.
|
| 155 |
+
2. The probability that Kyle solves the problem is $1/3$ , and the probability that Catherine solves the problem is $5/9$ .
|
| 156 |
+
3. The probability that David does not solve the problem is $1 - 2/7 = 5/7$ .
|
| 157 |
+
4. To find the probability that all three events happen, we multiply their individual probabilities: $(1 / 3)^{*}(5 / 9)^{*}(5 / 7)$
|
| 158 |
+
5. Simplify the expression: $(5 / 27)*(5 / 7) = 25 / 189$
|
| 159 |
+
6. The answer is E) 20/189. However, there seems to be a mistake in the options provided. The correct answer should be 25/189, not 20/189. So, the correct answer is E) 25/189.
|
| 160 |
+
|
| 161 |
+
# Example 2
|
| 162 |
+
|
| 163 |
+
1. The total investment is Rs. 70000 (A) + Rs. 120000 (B) = Rs. 190000.
|
| 164 |
+
2. The total profit is Rs. 26000.
|
| 165 |
+
3. To find the share of B, we need to divide the total profit by the total investment and then multiply it by B's investment. Share of $\mathbf{B} =$ (Total profit / Total investment) * B's investment
|
| 166 |
+
$= (26000 / 190000)*120000$
|
| 167 |
+
$= (26 / 19)*12000$
|
| 168 |
+
$= 24000*(26 / 19)$
|
| 169 |
+
$= 24000^{*}(1.3158)$
|
| 170 |
+
$= 24009$
|
| 171 |
+
So, the share of B is approximately Rs. 24009.
|
| 172 |
+
|
| 173 |
+
However, since the options provided are not exact, we can round the answer to the nearest option. The closest option is D) 24009. But since the question asks for one of the options, we cannot be certain that D) 24009 is the correct answer. It's a tricky question due to the rounding of the options.
|
| 174 |
+
|
| 175 |
+
Final answer: The share of B is approximately 24009, but the question asks for one of the options, so the exact answer cannot be determined from the given options.
|
| 176 |
+
|
| 177 |
+
Table 4: Linguistic Patterns in the negative examples of Mistral-7B-generated AQuA dataset, which might be used by BERT classifier as a feature in our Prediction over Time experiments.
|
| 178 |
+
|
| 179 |
+
Lopez, 2018; Zhao et al., 2023, 2024). In our study, we employ SVCCA following Zhao et al. (2022), which investigated how domain-specific information is encoded in LLMs—a research focus related to ours.
|
| 180 |
+
|
| 181 |
+
We compute SVCCA scores between representations at each reasoning step $^{5}$ (10%, 20%, ..., 90%) with 100% (CoT completion), where higher scores indicate greater similarity in encoded information (Figure 3). Since the AQuA dataset consists of shorter questions and CoT sequences (see Table 2), one might expect its intermediate representations to be more similar across steps, as the reasoning process is more compact. However, we observe that AQuA exhibits lower SVCCA scores between earlier and later steps compared to Olympiad and Cn-K12. This strengthens our probing findings: when earlier steps contain information predictive of CoT success, representations remain more stable throughout the reasoning process. This suggests that intermediate representations may not only encode predictive information about the final answer correctness but also the final answer itself. If the model is implicitly performing parts of the final computation at earlier steps, we may be able to leverage this by directly prompting it to provide an answer before completing the full chain of thought.
|
| 182 |
+
|
| 183 |
+
Early Stopping in CoT Reasoning To examine whether the model's intermediate representations encode sufficient information for correct answers, we prompt it to generate an answer at various reasoning steps and evaluate its accuracy. As in our previous experiments, this intervention is performed in a zero-shot manner without explicitly training the model to follow such instructions. Specifically, we halt the Llama-3.1-8B reasoning process by providing the generated sequence up to a certain point, followed by the instruction: "Stop all computation and give me the correct answer in 2-3 words, if you already know it". This allows us to assess whether the model can extract a final answer without completing the full chain of thought (See Appendix B for an illustration). We conduct human annotation on 100 samples per dataset at three timesteps<sup>6</sup>, summarizing the results in Table 5. Our analysis examines how often the halted response remains consistent with the final, uninterrupted answer, how often it changes (inconsistent), and in what fraction of those cases the change leads to a corrected answer—where stopping CoT reasoning actually improves performance. Finally, we compare overall correctness rates to both the full CoT process and a setting without CoT. The relatively low consistency rate, even at $99\%$ comple
|
| 184 |
+
|
| 185 |
+
<table><tr><td>Dataset</td><td>Gen %</td><td>Consistent</td><td>Inconsistent</td><td>Corrected</td><td>Correct</td><td>W_CoT_Correct</td></tr><tr><td rowspan="3">AQuA</td><td>50</td><td>40</td><td>45</td><td>15</td><td>37</td><td></td></tr><tr><td>70</td><td>48</td><td>41</td><td>11</td><td>37</td><td>38</td></tr><tr><td>99</td><td>81</td><td>14</td><td>5</td><td>59</td><td></td></tr><tr><td rowspan="3">Olympiad</td><td>30</td><td>21</td><td>76</td><td>3</td><td>18</td><td></td></tr><tr><td>50</td><td>28</td><td>70</td><td>2</td><td>22</td><td>19</td></tr><tr><td>99</td><td>57</td><td>41</td><td>2</td><td>33</td><td></td></tr><tr><td rowspan="3">Cn-k12</td><td>30</td><td>37</td><td>55</td><td>7</td><td>32</td><td></td></tr><tr><td>50</td><td>42</td><td>49</td><td>7</td><td>33</td><td>24</td></tr><tr><td>99</td><td>88</td><td>9</td><td>3</td><td>47</td><td></td></tr></table>
|
| 186 |
+
|
| 187 |
+
Table 5: LLM's generation was artificially interrupted to halt computation and were asked to just provide their best guess on 100 samples at 3 different time steps defined Gen. Annotators marked an answer Consistent if it is the same the answer it provides when it is allowed to continue generation and Inconsistent if the provided answer differ. There were cases where full generation led to incorrect solutions by LLM and these interruptions allowed LLM to generate the correct answer, which was given the label Correct by annotators.
|
| 188 |
+
|
| 189 |
+
tion—particularly in Olympiad $(57\%)$ —suggests that zero-shot early stopping is a suboptimal intervention. The model does not always converge to a stable answer, even when nearly the entire reasoning sequence is generated, highlighting the limitations of simply prompting it to stop early. However, despite this brittleness, halting CoT midway in AQuA and Cn-K12—the two datasets where later reasoning steps did not enhance CoT success predictability—still slightly outperforms the setting without CoT. This indicates that even incomplete CoT sequences can carry enough information to improve accuracy, revealing untapped potential in intermediate reasoning states. These findings suggest that while zero-shot interventions have limitations, more sophisticated approaches—such as training the model to generate concise reasoning chains through supervised learning or reinforcing brevity via RL-based rewards—could more effectively unlock this potential. By optimizing the model's ability to extract key reasoning steps without unnecessary verosity, future methods could further bridge the gap between full CoT and early stopping while maintaining or even improving accuracy.[7]
|
| 190 |
+
|
| 191 |
+
# 6 Conclusion
|
| 192 |
+
|
| 193 |
+
We demonstrate that the success of the CoT reasoning process can be predicted from the internal representations of the LLM even before the generation of a single token. However, we also observe
|
| 194 |
+
|
| 195 |
+
that, in some cases, the accuracy of this prediction does not improve when the classifier is exposed to intermediate reasoning steps. Using SVCCA, we show that early steps encode information that is more similar to the final steps in these cases. This raises the question of whether these early representations also contain valuable information about the final answer itself. Our initial experiments suggest that while this potential exists, zero-shot prompting may not fully unlock it. We hope our findings will inform future research aimed at making CoT more efficient without sacrificing accuracy, as the computational cost of CoT is significant.
|
| 196 |
+
|
| 197 |
+
# Limitation
|
| 198 |
+
|
| 199 |
+
Manually annotating test examples for each dataset limits the generalizability of our study, as we use human evaluation for only a single LLM and focus on three math datasets in a zero-shot setting. Additionally, we use a temperature of zero to minimize stochastic noise in the generation process, which could accumulate over multiple reasoning steps. However, this setting may not fully capture the variability present in real-world, stochastic LLM usage. Furthermore, our method assumes white-box access to the model, which is not typically available for proprietary models.
|
| 200 |
+
|
| 201 |
+
# Ethics Statement
|
| 202 |
+
|
| 203 |
+
Our research focused on evaluating the internal representation of a Large Language Model to better the notion of prediction for CoT Reasoning. During out research, we didn't perform any fine-tuning
|
| 204 |
+
|
| 205 |
+
that could introduce any bias in the LLM. We work with open-source datasets and hence produce no additional bias than what might already be part of it. During our manual evaluations, annotators were asked to correct math problems, where there is only one logically correct answer, reducing the suspect of biased annotations. We mostly used existing algorithms for supporting our analysis, hence making our findings more reliable. For reproducibility, we release the hyper-parameters used in our experiments.
|
| 206 |
+
|
| 207 |
+
# References
|
| 208 |
+
|
| 209 |
+
Janice Ahn, Rishu Verma, Renze Lou, Di Liu, Rui Zhang, and Wenpeng Yin. 2024. Large language models for mathematical reasoning: Progresses and challenges. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: Student Research Workshop, pages 225-237, St. Julian's, Malta. Association for Computational Linguistics.
|
| 210 |
+
Amos Azaria and Tom Mitchell. 2023. The internal state of an LLM knows when it's lying. In *Findings of the Association for Computational Linguistics: EMNLP* 2023, pages 967–976, Singapore. Association for Computational Linguistics.
|
| 211 |
+
Guangsheng Bao, Hongbo Zhang, Cunxiang Wang, Linyi Yang, and Yue Zhang. 2025. How likely do LLMs with CoT mimic human reasoning? In Proceedings of the 31st International Conference on Computational Linguistics, pages 7831-7850, Abu Dhabi, UAE. Association for Computational Linguistics.
|
| 212 |
+
Yonatan Belinkov. 2022. Probing classifiers: Promises, shortcomings, and advances. Computational Linguistics, 48(1):207-219.
|
| 213 |
+
Ju-Seung Byun, Jiyun Chun, Jihyung Kil, and Andrew Perrault. 2024. ARES: Alternating reinforcement learning and supervised fine-tuning for enhanced multi-modal chain-of-thought reasoning through diverse AI feedback. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 4410-4430, Miami, Florida, USA. Association for Computational Linguistics.
|
| 214 |
+
Yingqian Cui, Pengfei He, Xianfeng Tang, Qi He, Chen Luo, Jiliang Tang, and Yue Xing. 2024. A theoretical understanding of chain-of-thought: Coherent reasoning and error-aware demonstration. Preprint, arXiv:2410.16540.
|
| 215 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for
|
| 216 |
+
|
| 217 |
+
Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics.
|
| 218 |
+
Daniela Gottesman and Mor Geva. 2024. Estimating knowledge in large language models without generating a single token. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 3994-4019, Miami, Florida, USA. Association for Computational Linguistics.
|
| 219 |
+
Sachin Goyal, Ziwei Ji, Ankit Singh Rawat, Aditya Krishna Menon, Sanjiv Kumar, and Vaishnavh Nagarajan. 2024. Think before you speak: Training language models with pause tokens. Preprint, arXiv:2310.02226.
|
| 220 |
+
Aaron Grattafori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad AlDahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, Amy Yang, Angela Fan, Anirudh Goyal, Anthony Hartshorn, Aobo Yang, Archi Mitra, Archie Sravankumar, Artem Korenev, Arthur Hinsvark, Arun Rao, Aston Zhang, Aurelien Rodriguez, Austen Gregerson, Ava Spataru, Baptiste Roziere, Bethany Biron, Binh Tang, Bobbie Chern, Charlotte Caucheteux, Chaya Nayak, Chloe Bi, Chris Marra, Chris McConnell, Christian Keller, Christophe Touret, Chunyang Wu, Corinne Wong, Cristian Canton Ferrer, Cyrus Nikolaidis, Damien Allonsius, Daniel Song, Danielle Pintz, Danny Livshits, Danny Wyatt, David Esiobu, Dhruv Choudhary, Dhruv Mahajan, Diego Garcia-Olano, Diego Perino, Dieuwke Hupkes, Egor Lakomkin, Ehab AlBadawy, Elina Lobanova, Emily Dinan, Eric Michael Smith, Filip Radenovic, Francisco Guzmán, Frank Zhang, Gabriel Synnaeve, Gabrielle Lee, Georgia Lewis Anderson, Govind Thattai, Graeme Nail, Gregoire Mialon, Guan Pang, Guillem Cucurell, Hailey Nguyen, Hannah Korevaar, Hu Xu, Hugo Touvron, Iliyan Zarov, Imanol Arrieta Ibarra, Isabel Kloumann, Ishan Misra, Ivan Evtimov, Jack Zhang, Jade Copet, Jaewon Lee, Jan Geffert, Jana Vranes, Jason Park, Jay Mahadeokar, Jeet Shah, Jelmer van der Linde, Jennifer Billock, Jenny Hong, Jenya Lee, Jeremy Fu, Jianfeng Chi, Jianyu Huang, Jiawen Liu, Jie Wang, Jiecao Yu, Joanna Bitton, Joe Spisak, Jongsoo Park, Joseph Rocca, Joshua Johnstun, Joshua Saxe, Junteng Jia, Kalyan Vasuden Alwala, Karthik Prasad, Kartikeya Upasani, Kate Plawiak, Ke Li, Kenneth Heafield, Kevin Stone, Khalid El-Arini, Krithika Iyer, Kshitiz Malik, Kuenley Chiu, Kunal Bhalla, Kushal Lakhotia, Lauren Rantala-Yeary, Laurens van der Maaten, Lawrence Chen, Liang Tan, Liz Jenkins. Louis Martin Lovish Madaan Lubo Malo Lukas Blecher Lukas Landzaat Luke de Oliveira Madeline Muzzi Mahesh Pasupuleti Mannat Singh Manohar Paluri Marcin Kardas Maria Tsimpoukelli Mathew Oldham Mathieu Rita Maya Pavlova Melanie Kambadur Mike Lewis Min Si Mitesh Kumar Singh Mona Hassan Naman Goyal Narjes Torabi Nikolay Bashlykov Nikolay Bogoychev Niladri Chatterji Ning Zhang Olivier Duchenne Onur Celebi Patrick
|
| 221 |
+
|
| 222 |
+
Alrassy, Pengchuan Zhang, Pengwei Li, Petar Vasic, Peter Weng, Prajwal Bhargava, Pratik Dubal, Praveen Krishnan, Punit Singh Koura, Puxin Xu, Qing He, Qingxiao Dong, Ragavan Srinivasan, Raj Ganapathy, Ramon Calderer, Ricardo Silveira Cabral, Robert Stojnic, Roberta Raileanu, Rohan Maheswari, Rohit Girdhar, Rohit Patel, Romain Sauvestre, Ronnie Polidoro, Roshan Sumbaly, Ross Taylor, Ruan Silva, Rui Hou, Rui Wang, Saghar Hosseini, Sachana Chennabasappa, Sanjay Singh, Sean Bell, Seohyun Sonia Kim, Sergey Edunov, Shaoliang Nie, Sharan Narang, Sharath Raparthy, Sheng Shen, Shengye Wan, Shruti Bhosale, Shun Zhang, Simon Vandenhende, Soumya Batra, Spencer Whitman, Sten Sootla, Stephane Collot, Suchin Gururangan, Sydney Borodinsky, Tamar Herman, Tara Fowler, Tarek Sheasha, Thomas Georgiou, Thomas Scialom, Tobias Speckbacher, Todor Mihaylov, Tong Xiao, Ujjwal Karn, Vedanuj Goswami, Vibhor Gupta, Vignesh Ramanathan, Viktor Kerkez, Vincent Gonguet, Virginie Do, Vish Vogeti, Vitor Albiero, Vladan Petrovic, Weiwei Chu, Wenhan Xiong, Wenyin Fu, Whitney Meers, Xavier Martinet, Xiaodong Wang, Xiaofang Wang, Xiaqing Ellen Tan, Xide Xia, Xinfeng Xie, Xuchao Jia, Xuewei Wang, Yaelle Goldschlag, Yashesh Gaur, Yasmine Babaei, Yi Wen, Yiwen Song, Yuchen Zhang, Yue Li, Yuning Mao, Zacharie Delpierre Coudert, Zheng Yan, Zhengxing Chen, Zoe Papakipos, Aaditya Singh, Aayushi Srivastava, Abha Jain, Adam Kelsey, Adam Shajnfeld, Adithya Gangidi, Adolfo Victoria, Ahuva Goldstand, Ajay Menon, Ajay Sharma, Alex Boesenberg, Alexei Baevski, Allie Feinstein, Amanda Kallet, Amit Sangani, Amos Teo, Anam Yunus, Andrei Lupu, Andres Alvarado, Andrew Caples, Andrew Gu, Andrew Ho, Andrew Poulton, Andrew Ryan, Ankit Ramchandani, Annie Dong, Annie Franco, Anuj Goyal, Aparajita Saraf, Arkabandhu Chowdhury, Ashley Gabriel. Ashwin Bharambe, Assaf Eisenman, Azadeh Yazdan, Beau James, Ben Maurer, Benjamin Leonhardi, Bernie Huang, Beth Loyd, Beto De Paola, Bhargavi Paranjape, Bing Liu, Bo Wu Boyu Ni Braden HancockBram Wasti Brandon Spence Brani Stojkovic Brian Gamido Brit Montalvo Carl Parker Carly BurtonCatalina Mejia Ce Liu Changhan Wang Changkyu Kim Chao Zhou Chester Hu ChingHsiang Chu Chris Cai Chris Tindal Christoph Feichtenhofer,Cynthia Gao,Damon Civin Dana Beaty Daniel Kreymer Daniel Li David Adkins David Xu Davide Testuggine Delia David Devi Parikh Diana Liskovich Didem Foss Dingkang Wang Duc LeDustin Holland Edward Dowling Eissa Jamil Elaine Montgomery Eleonora Presani Emily Hahn Emily Wood Eric-Tuan Le Erik Brinkman Esteban Arcaute Evan Dunbar Evan Smothers Fei Sun Felix Kreuk Feng Tian Filippo Kokkinos Firat Ozgenel Francesco Caggioni Frank Kanayet Frank SeideGabriela Medina Florez,Gabriella Schwarz Gada Badeer Georgia Swee Gil Halpern Grant Herman Grigory Sizov Guangyi Zhang Guna Lakshminarayanan Hakan Inan Hamid Shojanazeri Han Zou Hannah Wang Hanwen Zha Haroun Habeeb Harrison Rudolph Helen Suk Henry Aspegren Hunter Goldman Hongyuan Zhan Ibrahim
|
| 223 |
+
|
| 224 |
+
Damlaj, Igor Molybog, Igor Tufanov, Ilias Leontiadis, Irina-Elena Veliche, Itai Gat, Jake Weissman, James Geboski, James Kohli, Janice Lam, Japhet Asher, Jean-Baptiste Gaya, Jeff Marcus, Jeff Tang, Jennifer Chan, Jenny Zhen, Jeremy Reizenstein, Jeremy Teboul, Jessica Zhong, Jian Jin, Jingyi Yang, Joe Cummings, Jon Carvill, Jon Shepard, Jonathan McPhie, Jonathan Torres, Josh Ginsburg, Junjie Wang, Kai Wu, Kam Hou U, Karan Saxena, Kartikay Khandelwal, Katayoun Zand, Kathy Matosich, Kaushik Veeraraghavan, Kelly Michelena, Keqian Li, Kiran Jagadeesh, Kun Huang, Kunal Chawla, Kyle Huang, Lailin Chen, Lakshya Garg, Lavender A, Leandro Silva, Lee Bell, Lei Zhang, Liangpeng Guo, Licheng Yu, Liron Moshkovich, Luca Wehrstedt, Madian Khabsa, Manav Avalani, Manish Bhatt, Martynas Mankus, Matan Hasson, Matthew Lennie, Matthias Reso, Maxim Groshev, Maxim Naumov, Maya Lathi, Meghan Keneally, Miao Liu, Michael L. Seltzer, Michal Valko, Michelle Restrepo, Mihir Patel, Mik Vyatskov, Mikayel Samvelyan, Mike Clark, Mike Macey, Mike Wang, Miquel Jubert Hermoso, Mo Metanat, Mohammad Rastegari, Munish Bansal, Nandhini Santhanam, Natascha Parks, Natasha White, Navyata Bawa, Nayan Singhal, Nick Egebo, Nicolas Usunier, Nikhil Mehta, Nikolay Pavlovich Laptev, Ning Dong, Norman Cheng, Oleg Chernoguz, Olivia Hart, Omkar Salpekar, Ozlem Kalinli, Parkin Kent, Parth Parekh, Paul Saab, Pavan Balaji Pedro Rittner, Philip Bontrager, Pierre Roux, Piotr Dollar, Polina Zvyagina, Prashant Ratanchandani, Pritish Yuvraj, Qian Liang, Rachad Alao, Rachel Rodriguez, Rafi Ayub, Ragtotham Murthy, Raghu Nayani, Rahul Mitra, Rangaprabhu Parthasarathy Raymond Li, Rebekkah Hogan, Robin Battey, Rocky Wang Russ Howes Rudy Tinott Sachin Mehta Sachin Siby Sai Jayesh Bondu Samyak Datta Sara Chugh Sara Hunt Sargun Dhillon Sasha Sidorov Satadru Pan Saurabh Mahajan Saurabh Verma Seiji Yamamoto Sharadh Ramaswamy Shaun Lindsay. Shaun Lindsay Sheng Feng Shenghao Lin Shengxin Cindy Zha Shishir Patil Shiva Shankar Shuqiang Zhang Shuqiang Zhang Sinong Wang Sneha Agarwal Soji Sajuyigbe Soumith Chintala Stephanie Max Stephen Chen Steve Kehoe Steve Satterfield Sudarshan Govindaprasad Sumit Gupta Summer Deng Sungmin Cho Sunny Virk Suraj Subramanian Sy Choudhury Sydney Goldman Tal Remez Tamar Glaser Tamara Best Thilo Koehler Thomas Robinson Tianhe Li Tianjun Zhang Tim Matthews Timothy Chou Tzook Shaked Varun Vontimitta Victoria Ajayi Victoria Montanez Vijai Mohan Vinay Satish Kumar Vishal Mangla Vlad Ionescu Vlad Poenaru Vlad Tiberiu Mihalescu Vladimir Ivanov Wei Li Wenchen Wang Wenwen Jiang Wes Bouaziz Will Constable Xiaocheng Tang Xiaojian Wu Xiaolan Wang Xilun Wu Xinbo Gao Yaniv Kleinman Yanjun Chen Ye Hu Ye Jia Ye Qi Yenda Li Yilin Zhang Ying Zhang Yossi Adi Youngjin Nam Yu Wang Yu Zhao Yuchen Hao Yundi Qian Yunlu Li Yuzi He Zach Rait Zachary DeVito Zef Rosnbrick Zhaoduo Wen Zhenyu Yang Zhiwei Zhao and Zhiyu Ma. 2024. The Ilama 3 herd of models. Preprint arXiv:2407.21783.
|
| 225 |
+
|
| 226 |
+
Shihao Ji, Zihui Song, Fucheng Zhong, Jisen Jia, Zhaobo Wu, Zheyi Cao, and Tianhao Xu. 2025. Mygo multiplex cot: A method for self-reflection in large language models via double chain of thought thinking. Preprint, arXiv:2501.13117.
|
| 227 |
+
Simon Kornblith, Mohammad Norouzi, Honglak Lee, and Geoffrey Hinton. 2019. Similarity of neural network representations revisited. In International conference on machine learning, pages 3519-3529. PMLR.
|
| 228 |
+
Gitanjali Kumari, Kirtan Jain, and Asif Ekbal. 2024. M3Hop-CoT: Misogynous meme identification with multimodal multi-hop chain-of-thought. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 22105-22138, Miami, Florida, USA. Association for Computational Linguistics.
|
| 229 |
+
Guohao Li, Hasan Abed Al Kader Hammoud, Hani Itani, Dmitrii Khizbullin, and Bernard Ghanem. 2023. Camel: Communicative agents for "mind" exploration of large scale language model society. Preprint, arXiv:2303.17760.
|
| 230 |
+
Jia LI, Edward Beeching, Lewis Tunstall, Ben Lipkin, Roman Soletskyi, Shengyi Costa Huang, Kashif Rasul, Longhui Yu, Albert Jiang, Ziju Shen, Zihan Qin, Bin Dong, Li Zhou, Yann Fleureau, Guillaume Lample, and Stanislas Polu. 2024. Numinamath. [https://huggingface.co/ AI-MO/NuminaMath-CoT](https://github.com/project-numina/aimo-progress-prize/blob/main/report/numina_dataset.pdf).
|
| 231 |
+
Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunson. 2017. Program induction by rationale generation: Learning to solve and explain algebraic word problems. ACL.
|
| 232 |
+
Jiaxiang Liu, Yuan Wang, Jiawei Du, Joey Tianyi Zhou, and Zuozhu Liu. 2024a. MedCoT: Medical chain of thought via hierarchical expert. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 17371-17389, Miami, Florida, USA. Association for Computational Linguistics.
|
| 233 |
+
Ryan Liu, Jiayi Geng, Addison J. Wu, Ilia Sucholutsky, Tania Lombrozo, and Thomas L. Griffiths. 2024b. Mind your step (by step): Chain-of-thought can reduce performance on tasks where thinking makes humans worse. Preprint, arXiv:2410.21333.
|
| 234 |
+
Aman Madaan and Amir Yazdanbakhsh. 2022. Text and patterns: For effective chain of thought, it takes two to tango. arXiv preprint arXiv:2209.07686.
|
| 235 |
+
Ari Morcos, Maithra Raghu, and Samy Bengio. 2018. Insights on representational similarity in neural networks with canonical correlation. Advances in neural information processing systems, 31.
|
| 236 |
+
|
| 237 |
+
Jacob Pfau, William Merrill, and Samuel R Bowman. 2024. Let's think dot by dot: Hidden computation in transformer language models. arXiv preprint arXiv:2404.15758.
|
| 238 |
+
Maithra Raghu, Justin Gilmer, Jason Yosinski, and Jascha Sohl-Dickstein. 2017. Svcca: Singular vector canonical correlation analysis for deep learning dynamics and interpretability. Preprint, arXiv:1706.05806.
|
| 239 |
+
Daking Rai and Ziyu Yao. 2024. An investigation of neuron activation as a unified lens to explain chain-of-thought eliciting arithmetic reasoning of LLMs. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 7174-7193, Bangkok, Thailand. Association for Computational Linguistics.
|
| 240 |
+
Matthew Renze. 2024. The effect of sampling temperature on problem solving in large language models. In Findings of the Association for Computational Linguistics: EMNLP 2024, pages 7346-7356, Miami, Florida, USA. Association for Computational Linguistics.
|
| 241 |
+
Naomi Saphra and Adam Lopez. 2018. Understanding learning dynamics of language models with svcca. arXiv preprint arXiv:1811.00225.
|
| 242 |
+
Yeongbin Seo, Dongha Lee, and Jinyoung Yeo. 2025. Detecting hallucination before answering: Semantic compression through instruction.
|
| 243 |
+
Zayne Sprague, Fangcong Yin, Juan Diego Rodriguez, Dongwei Jiang, Manya Wadhwa, Prasann Singhal, Xinyu Zhao, Xi Ye, Kyle Mahowald, and Greg Durrett. 2024. To cot or not to cot? chain-of-thought helps mainly on math and symbolic reasoning. Preprint, arXiv:2409.12183.
|
| 244 |
+
Miles Turpin, Julian Michael, Ethan Perez, and Samuel Bowman. 2023. Language models don't always say what they think: Unfaithful explanations in chain-of-thought prompting. In Advances in Neural Information Processing Systems, volume 36, pages 74952-74965. Curran Associates, Inc.
|
| 245 |
+
Boshi Wang, Sewon Min, Xiang Deng, Jiaming Shen, You Wu, Luke Zettlemoyer, and Huan Sun. 2023a. Towards understanding chain-of-thought prompting: An empirical study of what matters. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2717-2739, Toronto, Canada. Association for Computational Linguistics.
|
| 246 |
+
Ke Wang, Houxing Ren, Aojun Zhou, Zimu Lu, Sichun Luo, Weikang Shi, Renrui Zhang, Linqi Song, Mingjie Zhan, and Hongsheng Li. 2023b. Mathcoder: Seamless code integration in llms for enhanced mathematical reasoning. Preprint, arXiv:2310.03731.
|
| 247 |
+
Yan Wang, Yawen Zeng, Jingsheng Zheng, Xiaofen Xing, Jin Xu, and Xiangmin Xu. 2024. VideoCoT:
|
| 248 |
+
|
| 249 |
+
A video chain-of-thought dataset with active annotation tool. In Proceedings of the 3rd Workshop on Advances in Language and Vision Research (ALVR), pages 92-101, Bangkok, Thailand. Association for Computational Linguistics.
|
| 250 |
+
|
| 251 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. 2023. Chain-of-thought prompting elicits reasoning in large language models. Preprint, arXiv:2201.11903.
|
| 252 |
+
|
| 253 |
+
John Wieting and Douwe Kiela. 2019. No training required: Exploring random encoders for sentence classification. arXiv preprint arXiv:1901.10444.
|
| 254 |
+
|
| 255 |
+
Ancheng Xu, Minghuan Tan, Lei Wang, Min Yang, and Ruifeng Xu. 2024a. NUMCoT: Numerals and units of measurement in chain-of-thought reasoning using large language models. In *Findings of the Association for Computational Linguistics: ACL* 2024, pages 14268-14290, Bangkok, Thailand. Association for Computational Linguistics.
|
| 256 |
+
|
| 257 |
+
Jundong Xu, Hao Fei, Liangming Pan, Qian Liu, Mong-Li Lee, and Wynne Hsu. 2024b. Faithful logical reasoning via symbolic chain-of-thought. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 13326-13365, Bangkok, Thailand. Association for Computational Linguistics.
|
| 258 |
+
|
| 259 |
+
Kelly W Zhang and Samuel R Bowman. 2018. Language modeling teaches you more syntax than translation: Lessons learned through auxiliary task analysis. arXiv preprint arXiv:1809.10040.
|
| 260 |
+
|
| 261 |
+
Zheng Zhao, Yftah Ziser, and Shay Cohen. 2022. Understanding domain learning in language models through subpopulation analysis. In Proceedings of the Fifth BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, pages 192-209, Abu Dhabi, United Arab Emirates (Hybrid). Association for Computational Linguistics.
|
| 262 |
+
|
| 263 |
+
Zheng Zhao, Yftah Ziser, and Shay B Cohen. 2024. Layer by layer: Uncovering where multi-task learning happens in instruction-tuned large language models. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 15195-15214, Miami, Florida, USA. Association for Computational Linguistics.
|
| 264 |
+
|
| 265 |
+
Zheng Zhao, Yftah Ziser, Bonnie Webber, and Shay Cohen. 2023. A joint matrix factorization analysis of multilingual representations. In *Findings of the Association for Computational Linguistics: EMNLP* 2023, pages 12764–12783, Singapore. Association for Computational Linguistics.
|
| 266 |
+
|
| 267 |
+
Mingyu Zheng, Hao Yang, Wenbin Jiang, Zheng Lin, Yajuan Lyu, Qiaoqiao She, and Weiping Wang. 2023. Chain-of-thought reasoning in tabular language models. In Findings of the Association for Computational Linguistics: EMNLP 2023, pages 11006-11019, Singapore. Association for Computational Linguistics.
|
| 268 |
+
|
| 269 |
+
# A Technical Details
|
| 270 |
+
|
| 271 |
+
Classification Models We performed hyperparameter-tuning for each dataset (and each layer) when training the classification models. We illustrate the best hyperparameters in Table 7 and used them in our Prediction over time experiments.
|
| 272 |
+
|
| 273 |
+
# B Additional Results
|
| 274 |
+
|
| 275 |
+
Complimentary Analysis for Probing We compute SVCCA scores between all possible combinations of representations reasoning step (10%, 20%, ..., 90%) and with 100% (CoT completion) and show them in Figure 4.
|
| 276 |
+
|
| 277 |
+
Early Stopping in CoT Reasoning We show an illustration of Early Stopping in CoT Reasoning and the LLM response in Table 8. It can be seen that despite being prompted to stop calculations to $30\%$ of its original generation, it still generates the correct answer.
|
| 278 |
+
|
| 279 |
+
Classification Performance Breakdown Following our earlier evaluations, we perform an in-depth analysis of the classification model's performance on a test set of 1,000 examples, summarized in Table 9. Unlike the BERT baseline, which performs well on true positives (TP) only, our model excels at identifying both true negatives (TN) and true positives (TP). For example, on the Llama-3.1-8b generated Cn-k12 dataset, BERT identified 250 true negatives, while our model identified 317. Similarly, on AQuA, BERT's true negatives were 131, while our model achieved 177, and on Olympiad, BERT had 315 true negatives, compared to 388 for our method. These results show that our model not only performs well on true positives but also significantly outperforms BERT in detecting true negatives. This suggests that our method captures
|
| 280 |
+
|
| 281 |
+
<table><tr><td>Cn-k12</td><td>AQuA</td><td>Olympiad</td></tr><tr><td>layer 31</td><td>layer 32</td><td>layer 13</td></tr><tr><td>layer 10</td><td>layer 10</td><td>layer 28</td></tr><tr><td>layer 11</td><td>layer 13</td><td>layer 32</td></tr><tr><td>layer 13</td><td>layer 12</td><td>layer 10</td></tr><tr><td>layer 17</td><td>layer 5</td><td>layer 3</td></tr></table>
|
| 282 |
+
|
| 283 |
+
Table 6: Five most dissimilar layers using SVCCA (Singular Vector Canonical Correlation Analysis) between hidden representation with and with CoT prompt per layer, averaged over 1000 samples.
|
| 284 |
+
|
| 285 |
+
<table><tr><td>Dataset</td><td>batch size</td><td>weight init</td><td>learning rate</td><td>optimizer</td><td>threshold</td></tr><tr><td colspan="6">BERT (baseline)</td></tr><tr><td>AQuA</td><td>128</td><td>HE_uniform</td><td>0.001</td><td>sgd</td><td>0.6</td></tr><tr><td>Olympiad</td><td>128</td><td>HE_uniform</td><td>0.001</td><td>adam</td><td>0.6</td></tr><tr><td>Cn-k12</td><td>128</td><td>-</td><td>0.001</td><td>adam</td><td>0.6</td></tr><tr><td colspan="6">Our Model</td></tr><tr><td>AQuA</td><td>32</td><td>HE_uniform</td><td>0.001</td><td>adam</td><td>0.5</td></tr><tr><td>Olympiad</td><td>128</td><td>HE_normal</td><td>0.001</td><td>adam</td><td>0.5</td></tr><tr><td>Cn-k12</td><td>16</td><td>HE_uniform</td><td>0.001</td><td>sgd</td><td>0.5</td></tr></table>
|
| 286 |
+
|
| 287 |
+
Table 7: Accuracy of the classification model before it starts generating and over time when model has generated $\mathrm{x}\%$ of the answer.
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
(a) AQuA
|
| 291 |
+
|
| 292 |
+

|
| 293 |
+
(b) Cn-k12
|
| 294 |
+
|
| 295 |
+

|
| 296 |
+
(c) Olympiad
|
| 297 |
+
Figure 4: Similarity Scores using Singular Vector Canonical Correlation Analysis (SVCCA) of the internal representation of LLM through Prediction over Time using Layer 14.
|
| 298 |
+
|
| 299 |
+
A high school has a total of 900 students, among which there are 300 freshmen, 200 sophomores, and 400 juniors. Now, a stratified sampling method is used to select a sample of 45 students. How many students should be selected from each grade, respectively?
|
| 300 |
+
|
| 301 |
+
A:15,5,25
|
| 302 |
+
|
| 303 |
+
B:15,15,15
|
| 304 |
+
|
| 305 |
+
C:10,5,30
|
| 306 |
+
|
| 307 |
+
D:15,10,20
|
| 308 |
+
|
| 309 |
+
Let's think step by step:
|
| 310 |
+
|
| 311 |
+
To determine the number of students to be selected from each grade, we need to calculate the proportion of students in each grade and then apply this proportion to the total sample size of 45 students.
|
| 312 |
+
|
| 313 |
+
Step 1: Calculate the proportion of students in each grade
|
| 314 |
+
|
| 315 |
+
Stop all computation and give me the correct answer in 2-3 words, if you know it already.
|
| 316 |
+
|
| 317 |
+
# Answer 15, 10, 20
|
| 318 |
+
|
| 319 |
+
Reference Answer The correct answer is D.
|
| 320 |
+
|
| 321 |
+
Table 8: An Illustration of a sample showing how we artificially halt LLM generation when it has generated $30\%$ of the answer.
|
| 322 |
+
|
| 323 |
+
more relevant predictive signals, enabling a more nuanced understanding of the factors that drive Chain-of-Thought success.
|
| 324 |
+
|
| 325 |
+
LLM Layer Analysis We also include the representation of LLM without any CoT reasoning in our experiments. In Table 6, we illustrate the 5 most dissimilar layers. Since they were both encoded using the same problems, the only different is the inclusion of CoT Reasoning, the disimilarity among the layers may just a more notable role in LLM's internal notion of CoT Reasoning.
|
| 326 |
+
|
| 327 |
+
# C Dataset Examples
|
| 328 |
+
|
| 329 |
+
Success Prediction over Time An illustration of samples from the Success Prediction over Time method is shown in Table 10 for 2 different generation steps.
|
| 330 |
+
|
| 331 |
+
<table><tr><td>Cn-k12</td><td>AQuA</td><td>Olympiad</td></tr><tr><td colspan="3">Llama-3.1-8B</td></tr><tr><td colspan="3">BERT (baseline)</td></tr><tr><td>250 (TN), 196 (FP)</td><td>131 (TN), 306 (FP)</td><td>315 (TN), 159 (FP)</td></tr><tr><td>142 (FN), 412 (TP)</td><td>159 (FN), 404 (TP)</td><td>135 (FN), 391 (TP)</td></tr><tr><td colspan="3">Our Model</td></tr><tr><td>317 (TN), 129 (FP)</td><td>177 (TN), 269 (FP)</td><td>388 (TN), 86 (FP)</td></tr><tr><td>180 (FN), 374 (TP)</td><td>147 (FN), 416 (TP)</td><td>153 (FN), 373 (TP)</td></tr><tr><td colspan="3">Mistral-7B</td></tr><tr><td colspan="3">BERT (baseline)</td></tr><tr><td>282 (TN), 221 (FP)</td><td>314 (TN), 181 (FP)</td><td>318 (TN), 177 (FP)</td></tr><tr><td>124 (FN), 373 (TP)</td><td>218 (FN), 287 (TP)</td><td>135 (FN), 370 (TP)</td></tr><tr><td colspan="3">Our Model</td></tr><tr><td>328 (TN), 175 (FP)</td><td>366 (TN), 129 (FP)</td><td>387 (TN), 108 (FP)</td></tr><tr><td>154 (FN), 343 (TP)</td><td>244 (FN), 281 (TP)</td><td>178 (FN), 327 (TP)</td></tr></table>
|
| 332 |
+
|
| 333 |
+
Table 9: Confusion matrix comparing BERT (baseline) and our model at $T = 0$ on its respective balanced test set using the best-performing layers on the test set.
|
| 334 |
+
|
| 335 |
+
# $\mathbf{T} = \mathbf{0}$ (Question + Prompt)
|
| 336 |
+
|
| 337 |
+
Let the complex numbers $z_{1}$ and $z_{2}$ have corresponding points in the complex plane that are symmetric with respect to the real axis. Given that $z_{1} = 1 + i$ , find $z_{1}z_{2}$ . Let's think step by step:
|
| 338 |
+
|
| 339 |
+
# $\mathrm{T} = 3$ (Question + Prompt + $30\%$ of the Generation)
|
| 340 |
+
|
| 341 |
+
Let the complex numbers $z_{1}$ and $z_{2}$ have corresponding points in the complex plane that are symmetric with respect to the real axis. Given that $z_{1} = 1 + i$ , find $z_{1}z_{2}$ . Let's think step by step: To find $z_{2}$ , we need to understand the symmetry of complex numbers with respect to the real axis.
|
| 342 |
+
|
| 343 |
+
When a complex number is symmetric with respect to the real axis, its imaginary part is negated.
|
| 344 |
+
|
| 345 |
+
Given $z_{1} = 1 + i$ , we can find $z_{2}$ by negating the imaginary part of $z_{1}$ .
|
| 346 |
+
|
| 347 |
+
S
|
| 348 |
+
|
| 349 |
+
# $\mathbf{T} = 7$ (Question + Prompt + $70\%$ of the Generation)
|
| 350 |
+
|
| 351 |
+
Let the complex numbers $z_{1}$ and $z_{2}$ have corresponding points in the complex plane that are symmetric with respect to the real axis. Given that $z_{1} = 1 + i$ , find $z_{1}z_{2}$ . Let's think step by step: To find $z_{2}$ , we need to understand the symmetry of complex numbers with respect to the real axis.
|
| 352 |
+
|
| 353 |
+
When a complex number is symmetric with respect to the real axis, its imaginary part is negated.
|
| 354 |
+
|
| 355 |
+
Given $z_{1} = 1 + i$ , we can find $z_{2}$ by negating the imaginary part of $z_{1}$ .
|
| 356 |
+
|
| 357 |
+
So, $z_{2} = 1 - i$ .
|
| 358 |
+
|
| 359 |
+
Now, we need to find the product of $z_{1}$ and $z_{2}$ .
|
| 360 |
+
|
| 361 |
+
$$
|
| 362 |
+
z _ {1} z _ {2} = (1 + i) (1 - i)
|
| 363 |
+
$$
|
| 364 |
+
|
| 365 |
+
Using the difference of squares formula $(a + b)(a - b) = a^2 -b^2$ , we can simplify the expression:
|
| 366 |
+
|
| 367 |
+
$$
|
| 368 |
+
z _ {1} z _ {2} = 1 ^ {2} - i ^ {2}
|
| 369 |
+
$$
|
| 370 |
+
|
| 371 |
+
Since $i^2 = -1$ , we can substitute this value into the ex
|
| 372 |
+
|
| 373 |
+
Table 10: An Illustration of a sample from Cn-k12 dataset outlining how we construct the Prediction over Time dataset in our methodology.
|
2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b6d0e444aa808082257a8130f4c082f96744a617a100e96b2845556c880c4f99
|
| 3 |
+
size 556204
|
2025/Knowing Before Saying_ LLM Representations Encode Information About Chain-of-Thought Success Before Completion/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/73bdcaed-a35c-49f3-8627-be661122ae67_content_list.json
ADDED
|
@@ -0,0 +1,1601 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "Knowledge Base Construction for Knowledge-Augmented Text-to-SQL",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
132,
|
| 8 |
+
89,
|
| 9 |
+
867,
|
| 10 |
+
111
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Jinheon Baek $^{1*}$ Horst Samulowitz $^{2}$ Oktie Hassanzadeh $^{2}$",
|
| 17 |
+
"bbox": [
|
| 18 |
+
247,
|
| 19 |
+
133,
|
| 20 |
+
752,
|
| 21 |
+
149
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "Dharmashankar Subramanian $^{2}$ Sola Shirai $^{2}$ Alfio Gliozzo $^{2}$ Debarun Bhattacharjya $^{2}$",
|
| 28 |
+
"bbox": [
|
| 29 |
+
119,
|
| 30 |
+
149,
|
| 31 |
+
875,
|
| 32 |
+
167
|
| 33 |
+
],
|
| 34 |
+
"page_idx": 0
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"type": "text",
|
| 38 |
+
"text": "KAIST<sup>1</sup> IBM Research<sup>2</sup>",
|
| 39 |
+
"bbox": [
|
| 40 |
+
389,
|
| 41 |
+
168,
|
| 42 |
+
606,
|
| 43 |
+
183
|
| 44 |
+
],
|
| 45 |
+
"page_idx": 0
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"type": "text",
|
| 49 |
+
"text": "jinheon.baek@kaist.ac.kr {samulowitz, hassanzadeh}@us.ibm.com dharmash@us.ibm.com solashirai@ibm.com {gliozzo, debarunb}@us.ibm.com",
|
| 50 |
+
"bbox": [
|
| 51 |
+
142,
|
| 52 |
+
184,
|
| 53 |
+
855,
|
| 54 |
+
217
|
| 55 |
+
],
|
| 56 |
+
"page_idx": 0
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"type": "text",
|
| 60 |
+
"text": "Abstract",
|
| 61 |
+
"text_level": 1,
|
| 62 |
+
"bbox": [
|
| 63 |
+
260,
|
| 64 |
+
260,
|
| 65 |
+
339,
|
| 66 |
+
275
|
| 67 |
+
],
|
| 68 |
+
"page_idx": 0
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"type": "text",
|
| 72 |
+
"text": "Text-to-SQL aims to translate natural language queries into SQL statements, which is practical as it enables anyone to easily retrieve the desired information from databases. Recently, many existing approaches tackle this problem with Large Language Models (LLMs), leveraging their strong capability in understanding user queries and generating corresponding SQL code. Yet, the parametric knowledge in LLMs might be limited to covering all the diverse and domain-specific queries that require grounding in various database schemas, which makes generated SQLs less accurate oftentimes. To tackle this, we propose constructing the knowledge base for text-to-SQL, a foundational source of knowledge, from which we retrieve and generate the necessary knowledge for given queries. In particular, unlike existing approaches that either manually annotate knowledge or generate only a few pieces of knowledge for each query, our knowledge base is comprehensive, which is constructed based on a combination of all the available questions and their associated database schemas along with their relevant knowledge, and can be reused for unseen databases from different datasets and domains. We validate our approach on multiple text-to-SQL datasets, considering both the overlapping and non-overlapping database scenarios, where it outperforms relevant baselines substantially.",
|
| 73 |
+
"bbox": [
|
| 74 |
+
144,
|
| 75 |
+
282,
|
| 76 |
+
460,
|
| 77 |
+
709
|
| 78 |
+
],
|
| 79 |
+
"page_idx": 0
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"type": "text",
|
| 83 |
+
"text": "1 Introduction",
|
| 84 |
+
"text_level": 1,
|
| 85 |
+
"bbox": [
|
| 86 |
+
114,
|
| 87 |
+
715,
|
| 88 |
+
258,
|
| 89 |
+
732
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "Text-to-SQL aims to transform natural language queries from users into Structured Query Language (SQL) statements, to interact with and retrieve the information from databases (Zelle and Mooney, 1996; Xu et al., 2017; Yaghmazadeh et al., 2017; Cai et al., 2018), as illustrated in Figure 1 (A). This task has recently gained much attention since it allows non-experts to access and manipulate database information without needing to understand complex database languages. In the meantime, Large",
|
| 96 |
+
"bbox": [
|
| 97 |
+
112,
|
| 98 |
+
741,
|
| 99 |
+
489,
|
| 100 |
+
903
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "Language Models (LLMs) have shown impressive capabilities in processing and generating text and code, which have been further extended for text-to-SQL (Rajkumar et al., 2022; Gao et al., 2024).",
|
| 107 |
+
"bbox": [
|
| 108 |
+
507,
|
| 109 |
+
261,
|
| 110 |
+
884,
|
| 111 |
+
325
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 0
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "text",
|
| 117 |
+
"text": "Despite their huge successes, transforming user queries into SQL statements may still be challenging due to the need for specific domain knowledge and an understanding of the underlying database schemas, which poses a significant hurdle even for the most advanced LLMs to achieve high accuracy across diverse datasets (Li et al., 2023). For example, consider a scenario where the user asks for the query: \"What is the WACC for Company X?\" To accurately translate this into an SQL statement, the text-to-SQL model should understand the concept and calculation of Weighted Average Cost of Capital (WACC), which involves multiple factors including the cost of equity, cost of debt, and the respective proportions of each in the capital structure. In addition, the model needs to comprehend the specific schema of the financial database, where relevant data is distributed across multiple tables such as 'Equity', 'Debt', and 'Capital Structure'.",
|
| 118 |
+
"bbox": [
|
| 119 |
+
507,
|
| 120 |
+
326,
|
| 121 |
+
884,
|
| 122 |
+
631
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 0
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "text",
|
| 128 |
+
"text": "To tackle the aforementioned limitations due to the lack of the domain-specific knowledge for SQL generation, recent studies have proposed collecting and annotating explicit knowledge, which is then leveraged for SQL generation (Dou et al., 2022; Li et al., 2023). However, while these approaches substantially improve the performance of existing text-to-SQL models, they rely on extensive human annotations, which may be suboptimal (and nearly impractical) to conduct for all queries considering a diverse source of domain-specific knowledge from numerous databases. To address this issue, recent work proposes generating a few pieces of knowledge for each query based on the query itself and its relevant database schema (Hong et al., 2024) (see Figure 1 (B)). However, although this method demonstrates promise in automatic knowledge generation, certain knowledge required for one query",
|
| 129 |
+
"bbox": [
|
| 130 |
+
507,
|
| 131 |
+
632,
|
| 132 |
+
882,
|
| 133 |
+
921
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 0
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "page_footnote",
|
| 139 |
+
"text": "*Work done during an internship at IBM Research.",
|
| 140 |
+
"bbox": [
|
| 141 |
+
134,
|
| 142 |
+
906,
|
| 143 |
+
445,
|
| 144 |
+
920
|
| 145 |
+
],
|
| 146 |
+
"page_idx": 0
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"type": "page_number",
|
| 150 |
+
"text": "26569",
|
| 151 |
+
"bbox": [
|
| 152 |
+
473,
|
| 153 |
+
927,
|
| 154 |
+
524,
|
| 155 |
+
940
|
| 156 |
+
],
|
| 157 |
+
"page_idx": 0
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"type": "footer",
|
| 161 |
+
"text": "Findings of the Association for Computational Linguistics: ACL 2025, pages 26569-26583 July 27 - August 1, 2025 ©2025 Association for Computational Linguistics",
|
| 162 |
+
"bbox": [
|
| 163 |
+
220,
|
| 164 |
+
945,
|
| 165 |
+
778,
|
| 166 |
+
972
|
| 167 |
+
],
|
| 168 |
+
"page_idx": 0
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"type": "image",
|
| 172 |
+
"img_path": "images/6be530e13545b168550f87274e6320b783088b61220a4951a1e3b009b4af468b.jpg",
|
| 173 |
+
"image_caption": [
|
| 174 |
+
"Figure 1: (A) Text-to-SQL aims to translate a user query into a SQL statement executable over a database, to access the desired information. (B) Existing Text-to-SQL with Knowledge Generation approaches first generate the knowledge relevant to the user query and then formulate the SQL statement with this generated knowledge. (C) Our Text-to-SQL with Knowledge Base Construction approach builds the repository of the knowledge and then reuses the knowledge within it across multiple queries and databases. (Right:) We observe that the knowledge in the training set of the text-to-SQL benchmark dataset (Li et al., 2023) covers $21\\%$ of the knowledge required for test-time queries, and our constructed knowledge base further covers $50\\%$ of them."
|
| 175 |
+
],
|
| 176 |
+
"image_footnote": [],
|
| 177 |
+
"bbox": [
|
| 178 |
+
117,
|
| 179 |
+
84,
|
| 180 |
+
500,
|
| 181 |
+
212
|
| 182 |
+
],
|
| 183 |
+
"page_idx": 1
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"type": "image",
|
| 187 |
+
"img_path": "images/315fb2357b25e8367d0fbc41b50b3cf63ea37c9840a373e61bc121aed78e52ff.jpg",
|
| 188 |
+
"image_caption": [],
|
| 189 |
+
"image_footnote": [],
|
| 190 |
+
"bbox": [
|
| 191 |
+
507,
|
| 192 |
+
83,
|
| 193 |
+
880,
|
| 194 |
+
212
|
| 195 |
+
],
|
| 196 |
+
"page_idx": 1
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"type": "text",
|
| 200 |
+
"text": "can be directly reused or provide insights for multiple queries within the same database, as shown in Figure 1 (Right). Also, this knowledge can be generalizable to other queries for different databases.",
|
| 201 |
+
"bbox": [
|
| 202 |
+
112,
|
| 203 |
+
304,
|
| 204 |
+
489,
|
| 205 |
+
368
|
| 206 |
+
],
|
| 207 |
+
"page_idx": 1
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"type": "text",
|
| 211 |
+
"text": "Motivated by these observations, this work proposes an automatic approach to build a knowledge base, designed to serve as a comprehensive repository of domain-specific knowledge for text-to-SQL and capable of providing knowledge for multiple queries with the same database and even across the different databases. To construct this knowledge base, we generate knowledge entries based on available samples and their associated database schemas through LLM prompting, and then compile all of them together. During this prompting process, we provide LLMs with relevant examples to contextualize and guide the generation of useful knowledge in the right format that is further grounded in the database schema. Then, once constructed, the knowledge base allows for the retrieval of relevant knowledge for the given test-time query, which is then used alongside the query to formulate the SQL statement. Note that while ideally the knowledge base would cover all possible queries, it may not always do so. Nevertheless, the existing knowledge in it could still offer valuable insights for generating the required knowledge for new queries. Thus, by leveraging similar knowledge from the knowledge base, we further prompt LLMs to produce the most suitable knowledge for the query at inference time. We call our method Knowledge-Augmented Text-to-SQL (KAT-SQL), depicted in Figure 1 (C).",
|
| 212 |
+
"bbox": [
|
| 213 |
+
112,
|
| 214 |
+
370,
|
| 215 |
+
489,
|
| 216 |
+
821
|
| 217 |
+
],
|
| 218 |
+
"page_idx": 1
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"type": "text",
|
| 222 |
+
"text": "We experimentally validate the proposed KAT-SQL on two different text-to-SQL scenarios, involving both the overlapping and non-overlapping databases between training and test phases, showing that the proposed knowledge base construction-based text-to-SQL approach surpasses the exist",
|
| 223 |
+
"bbox": [
|
| 224 |
+
112,
|
| 225 |
+
825,
|
| 226 |
+
490,
|
| 227 |
+
921
|
| 228 |
+
],
|
| 229 |
+
"page_idx": 1
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"type": "text",
|
| 233 |
+
"text": "ing (knowledge-augmented) text-to-SQL baselines. We also assess the generalizability of our knowledge base constructed from one dataset by applying it to different datasets that lack any annotated knowledge, demonstrating that our knowledge base is versatile and can effectively improve SQL generation for even unseen databases from other datasets.",
|
| 234 |
+
"bbox": [
|
| 235 |
+
507,
|
| 236 |
+
304,
|
| 237 |
+
884,
|
| 238 |
+
414
|
| 239 |
+
],
|
| 240 |
+
"page_idx": 1
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"type": "text",
|
| 244 |
+
"text": "2 Related Work",
|
| 245 |
+
"text_level": 1,
|
| 246 |
+
"bbox": [
|
| 247 |
+
507,
|
| 248 |
+
425,
|
| 249 |
+
663,
|
| 250 |
+
439
|
| 251 |
+
],
|
| 252 |
+
"page_idx": 1
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"type": "text",
|
| 256 |
+
"text": "LLM-Powered Text-to-SQL LLMs have shown remarkable performances across a wide range of tasks (OpenAI, 2023; Anil et al., 2023; AI@Meta, 2024), including text-to-SQL, due to their strong capability in understanding natural language and generating structured code (Rajkumar et al., 2022; Gao et al., 2024). Specifically, various studies have developed and advanced the prompting techniques for text-to-SQL, for example, using Chain-of-Thought (CoT) (Wei et al., 2022; Liu and Tan, 2023; Tai et al., 2023), investigating sophisticated prompt design strategies (Chang and Fosler-Lussier, 2023), and aggregating LLM-generated outputs from multiple prompts (Lee et al., 2024; Dong et al., 2023) akin to self-consistency (Wang et al., 2023b). In addition, another line of study proposes decomposing the text-to-SQL problem into multiple subtasks, and feeding the solutions of subtasks (from multiple models or agents) into the LLM to derive the final SQL statement (Gu et al., 2023; Pourreza and Rafiei, 2023; Wang et al., 2023a). The knowledge internalized in LLMs might however not be sufficient to handle diverse queries, which oftentimes requires grounding in the database schemas or additional domain-specific information for specialized domains, which gives rise to the need for leveraging external knowledge for text-to-SQL.",
|
| 257 |
+
"bbox": [
|
| 258 |
+
507,
|
| 259 |
+
448,
|
| 260 |
+
884,
|
| 261 |
+
883
|
| 262 |
+
],
|
| 263 |
+
"page_idx": 1
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"type": "text",
|
| 267 |
+
"text": "Knowledge-Augmented Text-to-SQL There are a few recent studies that propose augmenting text",
|
| 268 |
+
"bbox": [
|
| 269 |
+
507,
|
| 270 |
+
889,
|
| 271 |
+
882,
|
| 272 |
+
921
|
| 273 |
+
],
|
| 274 |
+
"page_idx": 1
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"type": "page_number",
|
| 278 |
+
"text": "26570",
|
| 279 |
+
"bbox": [
|
| 280 |
+
475,
|
| 281 |
+
927,
|
| 282 |
+
524,
|
| 283 |
+
940
|
| 284 |
+
],
|
| 285 |
+
"page_idx": 1
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"type": "text",
|
| 289 |
+
"text": "to-SQL models with explicit knowledge. Specifically, Dou et al. (2022) collect formulaic knowledge (e.g., Trade Balance = Exports - Imports) available from public resources such as finance reports and store the collected knowledge into a knowledge bank with proper human-involved post-processing. The text-to-SQL model then retrieves relevant knowledge for any given query from the knowledge bank and uses it to convert the query into the SQL statement. In addition, Li et al. (2023) release a large-scale benchmark dataset for the text-to-SQL task, where each question is associated with specific knowledge that is manually annotated by humans. Manual annotation is however costly and time consuming, requiring effort and expertise on the part of domain-experts. To address this challenge, more recent work proposes automatically generating the knowledge based on the question and database schema, and utilizing this knowledge for text-to-SQL (Hong et al., 2024). In our work, instead of generating only a few pieces of knowledge for each question, we propose to construct a comprehensive knowledge base. This provides a repository of reusable knowledge that can be leveraged across multiple queries, which can be further adapted to various databases over different domains in a scalable way, in contrast to existing work.",
|
| 290 |
+
"bbox": [
|
| 291 |
+
112,
|
| 292 |
+
84,
|
| 293 |
+
492,
|
| 294 |
+
519
|
| 295 |
+
],
|
| 296 |
+
"page_idx": 2
|
| 297 |
+
},
|
| 298 |
+
{
|
| 299 |
+
"type": "text",
|
| 300 |
+
"text": "Data Generation with LLMs The recent advent of LLMs has revolutionized the field of data generation, as they can produce vast amounts of high-quality samples without costly human annotation. Specifically, several efforts around LLM-based synthetic data generation, such as Self-Instruct (Wang et al., 2023c), Alpaca (Taori et al., 2023), EvolInstruct (Xu et al., 2023), Orca (Mukherjee et al., 2023), and InstructLab (Sudalairaj et al., 2024), propose generating a large number of samples from LLMs by prompting them. Also, motivated by the capabilities of LLMs in generating synthetic data and memorizing factual knowledge, some other work aims to populate an encyclopedic knowledge base like Wikidata (Vrandecic and Krötzsch, 2014) with LLMs (Alivanistos et al., 2022; Nayak and Timmapathini, 2023; Veseli et al., 2023). Most of the knowledge in such encyclopedic knowledge bases is however unsuitable for text-to-SQL since it is neither relevant to formulate SQL statements from user queries nor aware of database schemas necessary for the query conversion. Thus, unlike them, our approach stands apart as the first to automatically construct a text-to-SQL knowledge base.",
|
| 301 |
+
"bbox": [
|
| 302 |
+
112,
|
| 303 |
+
535,
|
| 304 |
+
490,
|
| 305 |
+
921
|
| 306 |
+
],
|
| 307 |
+
"page_idx": 2
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"type": "text",
|
| 311 |
+
"text": "3 Method",
|
| 312 |
+
"text_level": 1,
|
| 313 |
+
"bbox": [
|
| 314 |
+
509,
|
| 315 |
+
83,
|
| 316 |
+
613,
|
| 317 |
+
98
|
| 318 |
+
],
|
| 319 |
+
"page_idx": 2
|
| 320 |
+
},
|
| 321 |
+
{
|
| 322 |
+
"type": "text",
|
| 323 |
+
"text": "In this section, we present Knowledge-Augmented Text-to-SQL (KAT-SQL), an approach that automatically constructs a knowledge base and utilizes the relevant knowledge from it for text-to-SQL.",
|
| 324 |
+
"bbox": [
|
| 325 |
+
507,
|
| 326 |
+
110,
|
| 327 |
+
884,
|
| 328 |
+
174
|
| 329 |
+
],
|
| 330 |
+
"page_idx": 2
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"type": "text",
|
| 334 |
+
"text": "3.1 Problem Statement",
|
| 335 |
+
"text_level": 1,
|
| 336 |
+
"bbox": [
|
| 337 |
+
507,
|
| 338 |
+
186,
|
| 339 |
+
707,
|
| 340 |
+
200
|
| 341 |
+
],
|
| 342 |
+
"page_idx": 2
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"type": "text",
|
| 346 |
+
"text": "We begin with formally explaining text-to-SQL and the knowledge augmentation technique for it.",
|
| 347 |
+
"bbox": [
|
| 348 |
+
507,
|
| 349 |
+
208,
|
| 350 |
+
880,
|
| 351 |
+
240
|
| 352 |
+
],
|
| 353 |
+
"page_idx": 2
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"type": "text",
|
| 357 |
+
"text": "Text-to-SQL Text-to-SQL aims to translate a natural language query from a user into a syntactically correct and semantically precise SQL statement. Formally, let $\\mathbf{q}$ be the user query (consisting of a sequence of tokens) and $\\mathcal{D}$ be the database schema containing multiple tables and columns. Then, the SQL generation model $f$ can be represented as follows: $s = f(\\mathbf{q},\\mathcal{D})$ where $s$ is the SQL statement (consisting of a sequence of tokens) that attempts to retrieve the information requested by $\\mathbf{q}$ over $\\mathcal{D}$ .",
|
| 358 |
+
"bbox": [
|
| 359 |
+
507,
|
| 360 |
+
250,
|
| 361 |
+
884,
|
| 362 |
+
411
|
| 363 |
+
],
|
| 364 |
+
"page_idx": 2
|
| 365 |
+
},
|
| 366 |
+
{
|
| 367 |
+
"type": "text",
|
| 368 |
+
"text": "In this work, we operationalize $f$ with LLMs, to harness their strong capability in understanding the semantics of $q$ and generating the corresponding SQL code $s$ , as follows: $s = \\mathsf{LLM}_{\\theta}(\\mathcal{T}(q,\\mathcal{D}))$ where $\\theta$ is the model parameters and $\\mathcal{T}$ is the prompt template. Typically, the model parameters $\\theta$ remain fixed due to the high costs associated with further fine-tuning of them and sometimes their limited accessibility. Also, the prompt template $\\mathcal{T}$ serves as a structured format that outlines the context, which includes task descriptions and instructions as well as few-shot demonstrations, to guide the model in generating accurate SQL codes.",
|
| 369 |
+
"bbox": [
|
| 370 |
+
507,
|
| 371 |
+
412,
|
| 372 |
+
884,
|
| 373 |
+
620
|
| 374 |
+
],
|
| 375 |
+
"page_idx": 2
|
| 376 |
+
},
|
| 377 |
+
{
|
| 378 |
+
"type": "text",
|
| 379 |
+
"text": "Notably, while there have been great successes in advancing the LLM itself and optimizing its usage for text-to-SQL, such as using advanced prompting techniques or breaking down the task into multiple subtasks (Wei et al., 2022; Liu and Tan, 2023; Tai et al., 2023; Gu et al., 2023; Pourreza and Rafiei, 2023; Wang et al., 2023a), these improvements alone may not be sufficient to fully handle queries that require the deep domain knowledge or precise understanding of complex database schemas. In other words, the internal parametric knowledge of LLMs, while robust, may not fully encompass the diverse range of query variations and database structures, especially when these databases have distinct schemas or certain specialized terminology.",
|
| 380 |
+
"bbox": [
|
| 381 |
+
507,
|
| 382 |
+
621,
|
| 383 |
+
882,
|
| 384 |
+
862
|
| 385 |
+
],
|
| 386 |
+
"page_idx": 2
|
| 387 |
+
},
|
| 388 |
+
{
|
| 389 |
+
"type": "text",
|
| 390 |
+
"text": "Knowledge-Augmented Text-to-SQL To tackle the aforementioned limitations, we focus on augmenting text-to-SQL with the knowledge relevant",
|
| 391 |
+
"bbox": [
|
| 392 |
+
507,
|
| 393 |
+
873,
|
| 394 |
+
884,
|
| 395 |
+
921
|
| 396 |
+
],
|
| 397 |
+
"page_idx": 2
|
| 398 |
+
},
|
| 399 |
+
{
|
| 400 |
+
"type": "page_number",
|
| 401 |
+
"text": "26571",
|
| 402 |
+
"bbox": [
|
| 403 |
+
475,
|
| 404 |
+
927,
|
| 405 |
+
522,
|
| 406 |
+
940
|
| 407 |
+
],
|
| 408 |
+
"page_idx": 2
|
| 409 |
+
},
|
| 410 |
+
{
|
| 411 |
+
"type": "text",
|
| 412 |
+
"text": "to the query, providing valuable insights into the domain-specific terminology and complex database schemas. If we denote this knowledge as $\\pmb{k}$ , then the previous text-to-SQL process is redefined to incorporate it, as follows: $s = \\mathsf{LLM}_{\\theta}(\\mathcal{T}(q,k,\\mathcal{D}))$ .",
|
| 413 |
+
"bbox": [
|
| 414 |
+
112,
|
| 415 |
+
84,
|
| 416 |
+
487,
|
| 417 |
+
165
|
| 418 |
+
],
|
| 419 |
+
"page_idx": 3
|
| 420 |
+
},
|
| 421 |
+
{
|
| 422 |
+
"type": "text",
|
| 423 |
+
"text": "While there have been few studies that explore this knowledge-augmented text-to-SQL paradigm, there are still a couple of challenges. Specifically, Dou et al. (2022) and Li et al. (2023) propose collecting and annotating the explicit knowledge required to convert queries into SQL statements. Yet, to operationalize, this annotation-based approach can be costly and time-consuming, especially when dealing with a large number of diverse queries. On the other hand, Hong et al. (2024) propose an automatic generation of knowledge, based on the question and its associated database schema. However, this method is still limiting as it generates only a few pieces of knowledge for each query without leveraging the potential for reuse. In contrast, since much of the knowledge used for one query can be applicable to multiple similar queries (See Figure 1, Right), we aim to design a more effective approach for knowledge augmentation, discussed below.",
|
| 424 |
+
"bbox": [
|
| 425 |
+
115,
|
| 426 |
+
166,
|
| 427 |
+
489,
|
| 428 |
+
470
|
| 429 |
+
],
|
| 430 |
+
"page_idx": 3
|
| 431 |
+
},
|
| 432 |
+
{
|
| 433 |
+
"type": "text",
|
| 434 |
+
"text": "3.2 Knowledge Base Construction",
|
| 435 |
+
"text_level": 1,
|
| 436 |
+
"bbox": [
|
| 437 |
+
112,
|
| 438 |
+
481,
|
| 439 |
+
396,
|
| 440 |
+
495
|
| 441 |
+
],
|
| 442 |
+
"page_idx": 3
|
| 443 |
+
},
|
| 444 |
+
{
|
| 445 |
+
"type": "text",
|
| 446 |
+
"text": "To address the aforementioned limitations of existing approaches in knowledge augmentation for text-to-SQL, we propose a novel approach to automatically construct a comprehensive and reusable knowledge base. Ideally, this can serve as a foundational resource, encapsulating diverse domain information and offering insights into various database schemas, to enhance the understanding of queries and their associated database structures.",
|
| 447 |
+
"bbox": [
|
| 448 |
+
112,
|
| 449 |
+
502,
|
| 450 |
+
489,
|
| 451 |
+
645
|
| 452 |
+
],
|
| 453 |
+
"page_idx": 3
|
| 454 |
+
},
|
| 455 |
+
{
|
| 456 |
+
"type": "text",
|
| 457 |
+
"text": "Formally, we design this knowledge base $\\mathcal{K}$ as a collection of knowledge entries, each represented as a concise sentence, denoted as follows: $\\pmb{k} \\in \\mathcal{K}$ . For instance, in the medical domain, one knowledge entry might be \"Abnormal white blood cell count refers to WBC $\\leq 3.5$ or WBC $\\geq 9.0$ \", which describes the abnormal range of white blood cell counts and its corresponding column name \"WBC\" in the database schema, applicable to queries related to abnormal white blood cells. The next question to answer is then how to construct this knowledge base based on the available resources.",
|
| 458 |
+
"bbox": [
|
| 459 |
+
112,
|
| 460 |
+
646,
|
| 461 |
+
489,
|
| 462 |
+
839
|
| 463 |
+
],
|
| 464 |
+
"page_idx": 3
|
| 465 |
+
},
|
| 466 |
+
{
|
| 467 |
+
"type": "text",
|
| 468 |
+
"text": "In this work, we start with collecting all the existing knowledge entries from the publicly available dataset (Li et al., 2023), which includes the knowledge and its related pair of query and database schema. Yet, while this initial collection can serve",
|
| 469 |
+
"bbox": [
|
| 470 |
+
112,
|
| 471 |
+
841,
|
| 472 |
+
489,
|
| 473 |
+
920
|
| 474 |
+
],
|
| 475 |
+
"page_idx": 3
|
| 476 |
+
},
|
| 477 |
+
{
|
| 478 |
+
"type": "text",
|
| 479 |
+
"text": "as the foundational layer of our knowledge base, it may not capture the full scope of the required information. To address this gap, we propose an automatic knowledge base expansion technique that leverages LLMs, which possess domain-specific knowledge and the ability to comprehend the given context (including instructions, codes, and database structures) by generating additional knowledge entries. Specifically, given the query and its associated database schema from the available datasets, we prompt LLMs (along with a prompting template $\\mathcal{T}$ for knowledge generation) to produce the knowledge, formulated as follows: $k = \\mathsf{LLM}(\\mathcal{T}(q,\\mathcal{D}))$ , and then store this knowledge $k$ into the knowledge base $\\mathcal{K}$ . In addition, as it may be more accurate and reliable to provide the LLM with relevant examples (which can help it understand the context, nuances, and expectations of the desired output), we further prepend the small number of relevant examples into the prompt of LLM. It is worth noting that these examples are comprised of the triplets of the user queries, their associated database schemas, and the knowledge they are derived from, and that those triplets come from the existing dataset (used to construct the initial knowledge base). Also, we select only those highly relevant to the query based on its embedding-level cosine similarities with samples from the existing dataset, calculated by MPNet (Song et al., 2020). This process can ultimately enable the LLM to generate more precise and contextually appropriate knowledge for text-to-SQL.",
|
| 480 |
+
"bbox": [
|
| 481 |
+
505,
|
| 482 |
+
84,
|
| 483 |
+
885,
|
| 484 |
+
583
|
| 485 |
+
],
|
| 486 |
+
"page_idx": 3
|
| 487 |
+
},
|
| 488 |
+
{
|
| 489 |
+
"type": "text",
|
| 490 |
+
"text": "In addition to this relevant example-based knowledge generation approach, to further enrich the diversity and comprehensiveness of the knowledge base, we implement a simple yet effective strategy that involves sampling and permutation of few-shot examples provided to the LLM. Specifically, for the given query and its associated database schema, instead of generating their corresponding knowledge only once, we iteratively sample a different set of relevant examples (provided to contextualize the LLM) multiple times and further permute their order. This can allow the LLM to explore different contextual nuances and generate a wider range of knowledge entries, with the goal of ultimately increasing the robustness and applicability of the knowledge base for a broader range of queries.",
|
| 491 |
+
"bbox": [
|
| 492 |
+
507,
|
| 493 |
+
583,
|
| 494 |
+
885,
|
| 495 |
+
841
|
| 496 |
+
],
|
| 497 |
+
"page_idx": 3
|
| 498 |
+
},
|
| 499 |
+
{
|
| 500 |
+
"type": "text",
|
| 501 |
+
"text": "3.3 Text-to-SQL with Knowledge Base",
|
| 502 |
+
"text_level": 1,
|
| 503 |
+
"bbox": [
|
| 504 |
+
507,
|
| 505 |
+
852,
|
| 506 |
+
826,
|
| 507 |
+
866
|
| 508 |
+
],
|
| 509 |
+
"page_idx": 3
|
| 510 |
+
},
|
| 511 |
+
{
|
| 512 |
+
"type": "text",
|
| 513 |
+
"text": "Based on the LLM-powered knowledge base construction process, we now have the knowledge base $\\mathcal{K}$ . Hereafter, the next question to answer is then",
|
| 514 |
+
"bbox": [
|
| 515 |
+
507,
|
| 516 |
+
873,
|
| 517 |
+
884,
|
| 518 |
+
921
|
| 519 |
+
],
|
| 520 |
+
"page_idx": 3
|
| 521 |
+
},
|
| 522 |
+
{
|
| 523 |
+
"type": "page_number",
|
| 524 |
+
"text": "26572",
|
| 525 |
+
"bbox": [
|
| 526 |
+
475,
|
| 527 |
+
927,
|
| 528 |
+
524,
|
| 529 |
+
940
|
| 530 |
+
],
|
| 531 |
+
"page_idx": 3
|
| 532 |
+
},
|
| 533 |
+
{
|
| 534 |
+
"type": "text",
|
| 535 |
+
"text": "Algorithm 1 Knowledge-Augmented Text-to-SQL",
|
| 536 |
+
"text_level": 1,
|
| 537 |
+
"bbox": [
|
| 538 |
+
114,
|
| 539 |
+
87,
|
| 540 |
+
485,
|
| 541 |
+
105
|
| 542 |
+
],
|
| 543 |
+
"page_idx": 4
|
| 544 |
+
},
|
| 545 |
+
{
|
| 546 |
+
"type": "text",
|
| 547 |
+
"text": "Require: Dataset $D$ containing query-schema pairs $(\\mathbf{q},\\mathcal{D})$ ; LLM model LLM; Prompt templates $\\mathcal{T}$",
|
| 548 |
+
"bbox": [
|
| 549 |
+
115,
|
| 550 |
+
109,
|
| 551 |
+
485,
|
| 552 |
+
134
|
| 553 |
+
],
|
| 554 |
+
"page_idx": 4
|
| 555 |
+
},
|
| 556 |
+
{
|
| 557 |
+
"type": "text",
|
| 558 |
+
"text": "Ensure: SQL statement $s$ for a given query $q$",
|
| 559 |
+
"bbox": [
|
| 560 |
+
115,
|
| 561 |
+
134,
|
| 562 |
+
400,
|
| 563 |
+
146
|
| 564 |
+
],
|
| 565 |
+
"page_idx": 4
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"type": "list",
|
| 569 |
+
"sub_type": "text",
|
| 570 |
+
"list_items": [
|
| 571 |
+
"1: Phase 1: Knowledge Base Construction",
|
| 572 |
+
"2: $\\mathcal{K}\\gets \\{\\} \\cup D$ ▷ Initialize knowledge base",
|
| 573 |
+
"3: for all $(\\mathbf{q},\\mathcal{D})\\in D$ do",
|
| 574 |
+
"4: $\\mathcal{E} \\gets$ Retrieve top- $k$ relevant examples from $D$",
|
| 575 |
+
"5: $k_{\\mathrm{new}} \\gets \\mathsf{LLM}(\\mathcal{T}_{\\mathrm{gen}}(\\boldsymbol{q},\\mathcal{D},\\mathcal{E}))$ ▷ Generate knowledge",
|
| 576 |
+
"6: $\\mathcal{K}\\gets \\mathcal{K}\\cup \\pmb{k}_{\\mathrm{new}}$ Store knowledge",
|
| 577 |
+
"7: end for",
|
| 578 |
+
"8: Phase 2: Knowledge-Augmented SQL Generation",
|
| 579 |
+
"9: function KAT-SQL(q, $\\mathcal{D},\\mathcal{K}$",
|
| 580 |
+
"10: $\\{\\pmb {k}_i\\}_{i = 1}^j\\gets$ Retrieve top- $j$ knowledge from $\\mathcal{K}$",
|
| 581 |
+
"11: $\\pmb{k}^{\\prime} \\gets \\mathsf{LLM}(\\mathcal{T}_{\\mathrm{ref}}(\\pmb{q}, \\{\\pmb{k}_i\\}_{i=1}^{j}, \\mathcal{D})) \\triangleright$ Refine knowledge",
|
| 582 |
+
"12: $s\\gets \\mathsf{LLM}(\\mathcal{T}_{\\mathrm{text - to - SQL}}(\\boldsymbol {q},\\boldsymbol{k}^{\\prime},\\mathcal{D}))$ Generate SQL",
|
| 583 |
+
"13: return s",
|
| 584 |
+
"14: end function"
|
| 585 |
+
],
|
| 586 |
+
"bbox": [
|
| 587 |
+
121,
|
| 588 |
+
147,
|
| 589 |
+
485,
|
| 590 |
+
316
|
| 591 |
+
],
|
| 592 |
+
"page_idx": 4
|
| 593 |
+
},
|
| 594 |
+
{
|
| 595 |
+
"type": "text",
|
| 596 |
+
"text": "Figure 2: A simplified overview of the proposed KAT-SQL method. Please see Algorithms 2 and 3 for detailed versions.",
|
| 597 |
+
"bbox": [
|
| 598 |
+
112,
|
| 599 |
+
324,
|
| 600 |
+
485,
|
| 601 |
+
350
|
| 602 |
+
],
|
| 603 |
+
"page_idx": 4
|
| 604 |
+
},
|
| 605 |
+
{
|
| 606 |
+
"type": "text",
|
| 607 |
+
"text": "how to use this knowledge base for text-to-SQL.",
|
| 608 |
+
"bbox": [
|
| 609 |
+
112,
|
| 610 |
+
368,
|
| 611 |
+
473,
|
| 612 |
+
382
|
| 613 |
+
],
|
| 614 |
+
"page_idx": 4
|
| 615 |
+
},
|
| 616 |
+
{
|
| 617 |
+
"type": "text",
|
| 618 |
+
"text": "Given the extensive nature of $\\mathcal{K}$ , containing a large number of entries, it is crucial to identify and retrieve the most pertinent entries for the query $q$ . Formally, this process can be represented as follows: $\\{\\pmb{k}_i\\}_{i=1}^j = \\text{Retriever}(\\pmb{q}, \\mathcal{K})$ . Also, this can be operationalized by calculating the embedding-level similarities between the query and all the knowledge entries in the knowledge base, then selecting the top- $j$ similar entries $\\{\\pmb{k}_i\\}_{i=1}^j$ , where embeddings are obtained from a sentence embedding model (Karpukhin et al., 2020; Song et al., 2020). Moreover, to further enhance the retrieval accuracy, we train this embedding model with contrastive learning, which maximizes the similarity between the query and its relevant knowledge while minimizing the similarities of others, denoted as follows: $-\\log \\frac{\\exp(\\sin(\\pmb{q}, \\pmb{k}^+) / \\tau)}{\\exp(\\sin(\\pmb{q}, \\pmb{k}^+) / \\tau) + \\sum_{k^-} \\exp(\\sin(\\pmb{q}, \\pmb{k}^-) / \\tau)}$ , where $\\sin(\\pmb{q}, \\pmb{k})$ denotes the similarity measure between query $q$ and knowledge $k$ , $\\tau$ is the temperature parameter, $k^+$ is the relevant knowledge, and $k^-$ represents the set of irrelevant knowledge.",
|
| 619 |
+
"bbox": [
|
| 620 |
+
112,
|
| 621 |
+
384,
|
| 622 |
+
489,
|
| 623 |
+
727
|
| 624 |
+
],
|
| 625 |
+
"page_idx": 4
|
| 626 |
+
},
|
| 627 |
+
{
|
| 628 |
+
"type": "text",
|
| 629 |
+
"text": "Note that while the retrieved knowledge entries from $\\kappa$ are relevant to the given query and can assist in SQL statement formulation, they may require additional refinement to perfectly align with the query's specific needs. For instance, if the user query pertains to abnormal data conditions, but the retrieved knowledge primarily focuses on normal data, a direct application of this knowledge could lead to inaccurate SQL generation. To address this issue, we further prompt the LLM to generate the knowledge tailored to the given query by considering its relevant knowledge entries and database",
|
| 630 |
+
"bbox": [
|
| 631 |
+
112,
|
| 632 |
+
728,
|
| 633 |
+
489,
|
| 634 |
+
921
|
| 635 |
+
],
|
| 636 |
+
"page_idx": 4
|
| 637 |
+
},
|
| 638 |
+
{
|
| 639 |
+
"type": "text",
|
| 640 |
+
"text": "schema, as follows: $k' = \\mathsf{LLM}(\\mathcal{T}(\\pmb{q},\\{\\pmb{k}_i\\}_{i=1}^j,\\mathcal{D}))$ , where $\\{\\pmb{k}_i\\}_{i=1}^j$ is the knowledge retrieved from $\\mathcal{K}$ . This refined knowledge $k'$ is subsequently used as input, along with the user query and its associated database schema, to guide the text-to-SQL LLM in generating a more accurate and contextually appropriate SQL statement: $s = \\mathsf{LLM}(\\mathcal{T}(\\pmb{q},\\pmb{k}',\\mathcal{D}))$ . Please see Algorithm 1 for our overall approach.",
|
| 641 |
+
"bbox": [
|
| 642 |
+
507,
|
| 643 |
+
83,
|
| 644 |
+
884,
|
| 645 |
+
215
|
| 646 |
+
],
|
| 647 |
+
"page_idx": 4
|
| 648 |
+
},
|
| 649 |
+
{
|
| 650 |
+
"type": "text",
|
| 651 |
+
"text": "4 Experimental Setup",
|
| 652 |
+
"text_level": 1,
|
| 653 |
+
"bbox": [
|
| 654 |
+
507,
|
| 655 |
+
230,
|
| 656 |
+
717,
|
| 657 |
+
247
|
| 658 |
+
],
|
| 659 |
+
"page_idx": 4
|
| 660 |
+
},
|
| 661 |
+
{
|
| 662 |
+
"type": "text",
|
| 663 |
+
"text": "4.1 Datasets and Tasks",
|
| 664 |
+
"text_level": 1,
|
| 665 |
+
"bbox": [
|
| 666 |
+
507,
|
| 667 |
+
258,
|
| 668 |
+
705,
|
| 669 |
+
272
|
| 670 |
+
],
|
| 671 |
+
"page_idx": 4
|
| 672 |
+
},
|
| 673 |
+
{
|
| 674 |
+
"type": "text",
|
| 675 |
+
"text": "Datasets To validate the efficacy of KAT-SQL, we first use two widely used text-to-SQL benchmark datasets, namely BIRD (Li et al., 2023) and Spider (Yu et al., 2018). Specifically, BIRD is a recently released large-scale text-to-SQL dataset, built on top of 95 distinct databases spanning 37 domains. Additionally, each query in this dataset is associated with knowledge that is manually annotated by humans, providing a useful prior for formulating SQL statements. Spider is another benchmark dataset, built upon 200 databases across 138 domains. Unlike BIRD, samples in Spider do not have annotated knowledge for text-to-SQL. Lastly, we consider a challenging real-world text-to-SQL data, namely CSTINSIGHT, which is designed with actual customer queries over a data lakehouse with 34 tables without human-annotated knowledge.",
|
| 676 |
+
"bbox": [
|
| 677 |
+
507,
|
| 678 |
+
280,
|
| 679 |
+
884,
|
| 680 |
+
554
|
| 681 |
+
],
|
| 682 |
+
"page_idx": 4
|
| 683 |
+
},
|
| 684 |
+
{
|
| 685 |
+
"type": "text",
|
| 686 |
+
"text": "Tasks/Scenarios We evaluate our KAT-SQL on three realistic text-to-SQL tasks. First of all, we consider the scenario where the prior information about some samples and their associated knowledge for each database is available, meaning that the databases used in training samples overlap with those in test samples (Overlap). We note that this setting is practical, since annotating a few pairs of questions and their corresponding knowledge for each database in advance is feasible. In addition to this, we test KAT-SQL with the existing benchmark setup, which is more challenging since it assumes there are no overlaps between databases during the training and test phases (Non-Overlap). In other words, no samples from the test-time databases are available beforehand, which means the model should be able to generalize to test-time queries based on the schemas of test-time databases as well as the samples and their associated knowledge from the different (training-time) databases. Lastly, we validate KAT-SQL on the most challenging scenario, where there are no overlaps between the",
|
| 687 |
+
"bbox": [
|
| 688 |
+
507,
|
| 689 |
+
567,
|
| 690 |
+
882,
|
| 691 |
+
921
|
| 692 |
+
],
|
| 693 |
+
"page_idx": 4
|
| 694 |
+
},
|
| 695 |
+
{
|
| 696 |
+
"type": "page_number",
|
| 697 |
+
"text": "26573",
|
| 698 |
+
"bbox": [
|
| 699 |
+
475,
|
| 700 |
+
927,
|
| 701 |
+
524,
|
| 702 |
+
940
|
| 703 |
+
],
|
| 704 |
+
"page_idx": 4
|
| 705 |
+
},
|
| 706 |
+
{
|
| 707 |
+
"type": "table",
|
| 708 |
+
"img_path": "images/1aba0028027b89b53d4557b3e0888c78a8ef5f36ea6478957fc6e691fa890ae3.jpg",
|
| 709 |
+
"table_caption": [
|
| 710 |
+
"Table 1: Main results on text-to-SQL benchmark datasets across multiple scenarios, with the best results in bold."
|
| 711 |
+
],
|
| 712 |
+
"table_footnote": [],
|
| 713 |
+
"table_body": "<table><tr><td rowspan=\"2\">Methods</td><td colspan=\"2\">BIRD (Overlap)</td><td colspan=\"2\">BIRD (Non-Overlap)</td><td colspan=\"2\">Spider</td><td colspan=\"2\">CSTINSIGHT</td></tr><tr><td>EX</td><td>VES</td><td>EX</td><td>VES</td><td>EX</td><td>VES</td><td>EX</td><td>VES</td></tr><tr><td>No Knowledge</td><td>23.76</td><td>28.81</td><td>20.66</td><td>16.72</td><td>70.99</td><td>37.53</td><td>4.76</td><td>5.28</td></tr><tr><td>DELLM</td><td>34.70</td><td>33.15</td><td>24.64</td><td>19.27</td><td>72.44</td><td>42.90</td><td>11.90</td><td>12.02</td></tr><tr><td>KAT-SQL (Ours)</td><td>41.18</td><td>41.33</td><td>41.07</td><td>31.14</td><td>74.56</td><td>47.20</td><td>14.29</td><td>14.50</td></tr><tr><td>Oracle Knowledge</td><td>54.67</td><td>49.71</td><td>49.41</td><td>37.93</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr></table>",
|
| 714 |
+
"bbox": [
|
| 715 |
+
124,
|
| 716 |
+
96,
|
| 717 |
+
880,
|
| 718 |
+
202
|
| 719 |
+
],
|
| 720 |
+
"page_idx": 5
|
| 721 |
+
},
|
| 722 |
+
{
|
| 723 |
+
"type": "text",
|
| 724 |
+
"text": "databases used during training and testing, but also no knowledge is available for both training and test samples. This setup aims to test the model's ability to generalize (in the absence of any prior knowledge about the dataset), allowing us to evaluate how well our knowledge base constructed with one dataset performs on different datasets. Notably, since the Spider and CSTINSIGHT datasets have no available knowledge for all queries, we use them for the most challenging last scenario; meanwhile, we use the BIRD dataset for the first two scenarios.",
|
| 725 |
+
"bbox": [
|
| 726 |
+
112,
|
| 727 |
+
218,
|
| 728 |
+
490,
|
| 729 |
+
394
|
| 730 |
+
],
|
| 731 |
+
"page_idx": 5
|
| 732 |
+
},
|
| 733 |
+
{
|
| 734 |
+
"type": "text",
|
| 735 |
+
"text": "4.2 Baselines and Our Model",
|
| 736 |
+
"text_level": 1,
|
| 737 |
+
"bbox": [
|
| 738 |
+
112,
|
| 739 |
+
409,
|
| 740 |
+
361,
|
| 741 |
+
425
|
| 742 |
+
],
|
| 743 |
+
"page_idx": 5
|
| 744 |
+
},
|
| 745 |
+
{
|
| 746 |
+
"type": "text",
|
| 747 |
+
"text": "We compare our KAT-SQL approach against relevant baselines that target our primary objective of improving knowledge-augmented text-to-SQL systems, which vary in their usage of knowledge. We note that for the fairest comparison, we fix the LLM as the same for all methods, explained as follows: 1. No Knowledge - which uses only the queries themselves to formulate the SQL statements without any additional knowledge. 2. DELLM - which generates the knowledge based on the query and its relevant database structures, and use this synthesized knowledge for text-to-SQL (Hong et al., 2024). 3. KAT-SQL - which is our model, building the knowledge base and utilizing the knowledge from it (with retrieval) for text-to-SQL. 4. Oracle Knowledge - which uses oracle knowledge annotated by humans, along with the queries to generate the SQL statements. This approach serves as an upper bound and is not directly comparable to other models due to its reliance on accurate, manually curated knowledge that is typically unavailable.",
|
| 748 |
+
"bbox": [
|
| 749 |
+
112,
|
| 750 |
+
432,
|
| 751 |
+
489,
|
| 752 |
+
772
|
| 753 |
+
],
|
| 754 |
+
"page_idx": 5
|
| 755 |
+
},
|
| 756 |
+
{
|
| 757 |
+
"type": "text",
|
| 758 |
+
"text": "4.3 Evaluation Metrics",
|
| 759 |
+
"text_level": 1,
|
| 760 |
+
"bbox": [
|
| 761 |
+
112,
|
| 762 |
+
785,
|
| 763 |
+
312,
|
| 764 |
+
800
|
| 765 |
+
],
|
| 766 |
+
"page_idx": 5
|
| 767 |
+
},
|
| 768 |
+
{
|
| 769 |
+
"type": "text",
|
| 770 |
+
"text": "Following the standard evaluation protocols from prior work (Li et al., 2023; Hong et al., 2024), we use the following two metrics: 1) Execution Accuracy (EX), which measures the ratio of generated SQL code that has the same execution results with ground-truth SQL code; 2) Valid Efficiency Score (VES), which considers the efficiency of generated",
|
| 771 |
+
"bbox": [
|
| 772 |
+
112,
|
| 773 |
+
808,
|
| 774 |
+
489,
|
| 775 |
+
921
|
| 776 |
+
],
|
| 777 |
+
"page_idx": 5
|
| 778 |
+
},
|
| 779 |
+
{
|
| 780 |
+
"type": "image",
|
| 781 |
+
"img_path": "images/4fe02b3e5c645cc44f4a346424583dce3b74f05ca759ff3e9414658e1a5699ee.jpg",
|
| 782 |
+
"image_caption": [
|
| 783 |
+
"Figure 3: Results for coverage and relevance of knowledge entries in the constructed knowledge base against gold knowledge, with different numbers of knowledge generation steps."
|
| 784 |
+
],
|
| 785 |
+
"image_footnote": [],
|
| 786 |
+
"bbox": [
|
| 787 |
+
512,
|
| 788 |
+
212,
|
| 789 |
+
690,
|
| 790 |
+
307
|
| 791 |
+
],
|
| 792 |
+
"page_idx": 5
|
| 793 |
+
},
|
| 794 |
+
{
|
| 795 |
+
"type": "image",
|
| 796 |
+
"img_path": "images/7b6719fc9c3c924cdfda5947a34997f34b2e95563399e6c383724153e712883f.jpg",
|
| 797 |
+
"image_caption": [],
|
| 798 |
+
"image_footnote": [],
|
| 799 |
+
"bbox": [
|
| 800 |
+
695,
|
| 801 |
+
212,
|
| 802 |
+
875,
|
| 803 |
+
307
|
| 804 |
+
],
|
| 805 |
+
"page_idx": 5
|
| 806 |
+
},
|
| 807 |
+
{
|
| 808 |
+
"type": "text",
|
| 809 |
+
"text": "SQLs by weighting them based on their relative efficiency improvement over ground-truth SQLs further multiplied by execution accuracy.",
|
| 810 |
+
"bbox": [
|
| 811 |
+
507,
|
| 812 |
+
362,
|
| 813 |
+
882,
|
| 814 |
+
411
|
| 815 |
+
],
|
| 816 |
+
"page_idx": 5
|
| 817 |
+
},
|
| 818 |
+
{
|
| 819 |
+
"type": "text",
|
| 820 |
+
"text": "4.4 Implementation Details",
|
| 821 |
+
"text_level": 1,
|
| 822 |
+
"bbox": [
|
| 823 |
+
507,
|
| 824 |
+
423,
|
| 825 |
+
741,
|
| 826 |
+
439
|
| 827 |
+
],
|
| 828 |
+
"page_idx": 5
|
| 829 |
+
},
|
| 830 |
+
{
|
| 831 |
+
"type": "text",
|
| 832 |
+
"text": "We mainly use Llama-3 70B (AI@Meta, 2024) as the basis for text-to-SQL generation and knowledge generation across all baselines and our model variants for most experiments, for a fair comparison, while we also experiment with other LLMs in an analysis (Table 6) to see the robustness of KAT-SQL. For the hyperparameters, except for the temperature (which we set as 0.0 for reproducibility), we use its default values. In addition, for the retriever, we use MPNet (Song et al., 2020), which is based on dense retrieval; we train it with a batch size of 128 and a number of training epochs of 30. We provide the detailed prompts used to elicit the knowledge and SQL generations in Appendix A.",
|
| 833 |
+
"bbox": [
|
| 834 |
+
505,
|
| 835 |
+
445,
|
| 836 |
+
884,
|
| 837 |
+
671
|
| 838 |
+
],
|
| 839 |
+
"page_idx": 5
|
| 840 |
+
},
|
| 841 |
+
{
|
| 842 |
+
"type": "text",
|
| 843 |
+
"text": "5 Experimental Results and Analyses",
|
| 844 |
+
"text_level": 1,
|
| 845 |
+
"bbox": [
|
| 846 |
+
507,
|
| 847 |
+
684,
|
| 848 |
+
848,
|
| 849 |
+
702
|
| 850 |
+
],
|
| 851 |
+
"page_idx": 5
|
| 852 |
+
},
|
| 853 |
+
{
|
| 854 |
+
"type": "text",
|
| 855 |
+
"text": "Main Results We provide main results in Table 1, which confirms that our KAT-SQL approach consistently outperforms all baselines by large margins. Specifically, while we observe some performance improvement of the knowledge-augmented text-to-SQL approach (namely DELLM, which generates a few pieces of knowledge for each query) over the baseline without knowledge augmentation, KAT-SQL achieves even greater gains, demonstrating the effectiveness of our knowledge base construction-based text-to-SQL paradigm. However, the performance of the (incomparable) model with the oracle knowledge (annotated by human experts) remains",
|
| 856 |
+
"bbox": [
|
| 857 |
+
507,
|
| 858 |
+
711,
|
| 859 |
+
884,
|
| 860 |
+
921
|
| 861 |
+
],
|
| 862 |
+
"page_idx": 5
|
| 863 |
+
},
|
| 864 |
+
{
|
| 865 |
+
"type": "page_number",
|
| 866 |
+
"text": "26574",
|
| 867 |
+
"bbox": [
|
| 868 |
+
475,
|
| 869 |
+
927,
|
| 870 |
+
524,
|
| 871 |
+
940
|
| 872 |
+
],
|
| 873 |
+
"page_idx": 5
|
| 874 |
+
},
|
| 875 |
+
{
|
| 876 |
+
"type": "table",
|
| 877 |
+
"img_path": "images/99489244526dcda99130546125c0d8c2318f2e7ca3772c15e4c7154d7dfa065c.jpg",
|
| 878 |
+
"table_caption": [
|
| 879 |
+
"Table 2: Results for knowledge generation with and without the use of the Knowledge Base (KB), while varying the prompt construction with and without the relevant few-shot examples."
|
| 880 |
+
],
|
| 881 |
+
"table_footnote": [],
|
| 882 |
+
"table_body": "<table><tr><td></td><td></td><td colspan=\"2\">Overlap</td><td colspan=\"2\">Non-Overlap</td></tr><tr><td>KB</td><td>Few-Shot</td><td>EM</td><td>SS</td><td>EM</td><td>SS</td></tr><tr><td rowspan=\"2\">w/o KB</td><td>Random</td><td>10.96</td><td>68.77</td><td>7.88</td><td>66.77</td></tr><tr><td>Retrieval</td><td>20.21</td><td>73.62</td><td>9.24</td><td>68.78</td></tr><tr><td rowspan=\"2\">w/ KB</td><td>Random</td><td>11.13</td><td>69.14</td><td>7.93</td><td>66.80</td></tr><tr><td>Retrieval</td><td>24.97</td><td>77.87</td><td>12.94</td><td>71.24</td></tr></table>",
|
| 883 |
+
"bbox": [
|
| 884 |
+
124,
|
| 885 |
+
120,
|
| 886 |
+
480,
|
| 887 |
+
209
|
| 888 |
+
],
|
| 889 |
+
"page_idx": 6
|
| 890 |
+
},
|
| 891 |
+
{
|
| 892 |
+
"type": "text",
|
| 893 |
+
"text": "superior to all other approaches, which suggests potential future opportunities for developing a more advanced pipeline for knowledge generation.",
|
| 894 |
+
"bbox": [
|
| 895 |
+
112,
|
| 896 |
+
225,
|
| 897 |
+
487,
|
| 898 |
+
272
|
| 899 |
+
],
|
| 900 |
+
"page_idx": 6
|
| 901 |
+
},
|
| 902 |
+
{
|
| 903 |
+
"type": "text",
|
| 904 |
+
"text": "Analysis on Knowledge Base To further understand the coverage and relevance of the knowledge within our knowledge base, we compare each piece of knowledge required for test-time queries with all the available entries in the knowledge base, as a function of the number of knowledge generation steps during knowledge base construction. For evaluation, we use two metrics: Exact Match, which identifies whether the knowledge base contains an entry that precisely matches the knowledge required for a given query, and Semantic Similarity, which assesses how closely related the most similar entry (in the knowledge base) is to the required knowledge based on the embedding-level similarity. As shown in Figure 3, we observe that, under the Overlap setting, half of the knowledge entries needed for test-time queries are available in the knowledge base while the Semantic Similarity is around $90\\%$ , which demonstrates substantial coverage by our knowledge base. In addition, for the challenging setup where training and test databases are distinct, we still observe that $20\\%$ of the test-time knowledge entries are available in the knowledge base and that the Semantic Similarity exceeds $80\\%$ , showing the utility of our knowledge base. Finally, as we increase the number of knowledge generation steps for each instance during knowledge base construction, we observe a corresponding improvement in both coverage and relevance of our knowledge base, which supports the effectiveness of our expansion strategy to enrich its diversity.",
|
| 905 |
+
"bbox": [
|
| 906 |
+
112,
|
| 907 |
+
282,
|
| 908 |
+
489,
|
| 909 |
+
783
|
| 910 |
+
],
|
| 911 |
+
"page_idx": 6
|
| 912 |
+
},
|
| 913 |
+
{
|
| 914 |
+
"type": "text",
|
| 915 |
+
"text": "Analysis on Knowledge Generation Recall that we further refine the retrieved knowledge to make it more suitable for each query, in addition to constructing the knowledge base and retrieving the relevant knowledge. Thus, to see how relevant the generated knowledge is to the human-annotated gold knowledge with regards to the use of our knowledge base, we report comparison results according",
|
| 916 |
+
"bbox": [
|
| 917 |
+
112,
|
| 918 |
+
791,
|
| 919 |
+
489,
|
| 920 |
+
921
|
| 921 |
+
],
|
| 922 |
+
"page_idx": 6
|
| 923 |
+
},
|
| 924 |
+
{
|
| 925 |
+
"type": "table",
|
| 926 |
+
"img_path": "images/735d6112c7b64d2239a1683a4990bbd71ff73487af20237d4a7755cbe355c7d4.jpg",
|
| 927 |
+
"table_caption": [
|
| 928 |
+
"Table 3: Text-to-SQL results without using any knowledge, based on the retrieved knowledge, and based on the refined knowledge from the retrieved knowledge (Our KAT-SQL)."
|
| 929 |
+
],
|
| 930 |
+
"table_footnote": [],
|
| 931 |
+
"table_body": "<table><tr><td>Settings</td><td>Models</td><td>EX</td></tr><tr><td rowspan=\"3\">Overlap</td><td>KAT-SQL (Ours)</td><td>41.18</td></tr><tr><td>w/o Generation</td><td>38.94</td></tr><tr><td>w/o Retrieval & Generation</td><td>23.76</td></tr><tr><td rowspan=\"3\">Non-Overlap</td><td>KAT-SQL (Ours)</td><td>41.07</td></tr><tr><td>w/o Generation</td><td>38.42</td></tr><tr><td>w/o Retrieval & Generation</td><td>20.66</td></tr></table>",
|
| 932 |
+
"bbox": [
|
| 933 |
+
522,
|
| 934 |
+
121,
|
| 935 |
+
877,
|
| 936 |
+
233
|
| 937 |
+
],
|
| 938 |
+
"page_idx": 6
|
| 939 |
+
},
|
| 940 |
+
{
|
| 941 |
+
"type": "table",
|
| 942 |
+
"img_path": "images/7e0f4e7d5e3c9940286a4e562ae37acd46f9ec7033e4994c8b8f4b1227539512.jpg",
|
| 943 |
+
"table_caption": [
|
| 944 |
+
"Table 4: Retrieval results with different scenarios and models."
|
| 945 |
+
],
|
| 946 |
+
"table_footnote": [],
|
| 947 |
+
"table_body": "<table><tr><td>Settings</td><td>Models</td><td>MRR</td><td>Top@3</td><td>Top@10</td></tr><tr><td rowspan=\"3\">Overlap</td><td>BERT</td><td>0.5506</td><td>0.6621</td><td>0.8911</td></tr><tr><td>TAS-B</td><td>0.5630</td><td>0.6943</td><td>0.9035</td></tr><tr><td>TAS-B*</td><td>0.8288</td><td>0.9143</td><td>0.9765</td></tr><tr><td rowspan=\"3\">Non-Overlap</td><td>BERT</td><td>0.2148</td><td>0.2692</td><td>0.4231</td></tr><tr><td>TAS-B</td><td>0.2364</td><td>0.3846</td><td>0.4615</td></tr><tr><td>TAS-B*</td><td>0.7565</td><td>0.8347</td><td>0.9210</td></tr></table>",
|
| 948 |
+
"bbox": [
|
| 949 |
+
521,
|
| 950 |
+
259,
|
| 951 |
+
875,
|
| 952 |
+
350
|
| 953 |
+
],
|
| 954 |
+
"page_idx": 6
|
| 955 |
+
},
|
| 956 |
+
{
|
| 957 |
+
"type": "text",
|
| 958 |
+
"text": "to Exact Match and Semantic Similarity (SS) in Table 2. We observe that when we retrieve the relevant knowledge from the knowledge base and then use it for knowledge generation, there are performance gains over the case where we do not leverage it, which indicates that the retrieved knowledge is helpful in formulating the necessary knowledge for test-time queries. We also provide few-shot examples to guide the knowledge generation model in generating useful knowledge in the right format, and when we select them based on their similarities with the given query, we observe further gains in the quality of the generated knowledge.",
|
| 959 |
+
"bbox": [
|
| 960 |
+
505,
|
| 961 |
+
365,
|
| 962 |
+
884,
|
| 963 |
+
574
|
| 964 |
+
],
|
| 965 |
+
"page_idx": 6
|
| 966 |
+
},
|
| 967 |
+
{
|
| 968 |
+
"type": "text",
|
| 969 |
+
"text": "Beyond evaluating the quality of the generated knowledge by comparing it to the human-annotated gold knowledge, we also examine the impact of knowledge generation on downstream text-to-SQL performance with and without the incorporation of generated knowledge. As shown in Table 3, compared to the results without the knowledge retrieval and generation on both Overlap and Non-Overlap settings, there are substantial improvements when we incorporate the retrieved knowledge from our knowledge base into the text-to-SQL generation process. Furthermore, instead of directly using the retrieved knowledge, refining this retrieved knowledge yields additional improvements, underscoring the importance of not only retrieving relevant knowledge but also tailoring it to better align with the specific needs of test-time queries.",
|
| 970 |
+
"bbox": [
|
| 971 |
+
507,
|
| 972 |
+
574,
|
| 973 |
+
882,
|
| 974 |
+
848
|
| 975 |
+
],
|
| 976 |
+
"page_idx": 6
|
| 977 |
+
},
|
| 978 |
+
{
|
| 979 |
+
"type": "text",
|
| 980 |
+
"text": "Retrieval Analysis We also analyze the accuracy of knowledge retrieval from our knowledge base by reporting its retrieval performance in Table 4 according to Mean Reciprocal Rank (MRR) and",
|
| 981 |
+
"bbox": [
|
| 982 |
+
507,
|
| 983 |
+
857,
|
| 984 |
+
882,
|
| 985 |
+
921
|
| 986 |
+
],
|
| 987 |
+
"page_idx": 6
|
| 988 |
+
},
|
| 989 |
+
{
|
| 990 |
+
"type": "page_number",
|
| 991 |
+
"text": "26575",
|
| 992 |
+
"bbox": [
|
| 993 |
+
475,
|
| 994 |
+
927,
|
| 995 |
+
524,
|
| 996 |
+
940
|
| 997 |
+
],
|
| 998 |
+
"page_idx": 6
|
| 999 |
+
},
|
| 1000 |
+
{
|
| 1001 |
+
"type": "table",
|
| 1002 |
+
"img_path": "images/2db2733b415945de9da0d8ad461dfce620338fbc636fd0af1416345e573fb061.jpg",
|
| 1003 |
+
"table_caption": [
|
| 1004 |
+
"Table 5: Breakdown text-to-SQL results into overlapping and non-overlapping domain settings between training (knowledge base construction) and test (text-to-SQL evaluation) databases."
|
| 1005 |
+
],
|
| 1006 |
+
"table_footnote": [],
|
| 1007 |
+
"table_body": "<table><tr><td>Models</td><td>Overlap</td><td>Non-Overlap</td></tr><tr><td>No Knowledge</td><td>22.85</td><td>16.20</td></tr><tr><td>DELLM</td><td>27.20</td><td>19.43</td></tr><tr><td>KAT-SQL (Ours)</td><td>49.37</td><td>24.19</td></tr></table>",
|
| 1008 |
+
"bbox": [
|
| 1009 |
+
126,
|
| 1010 |
+
120,
|
| 1011 |
+
478,
|
| 1012 |
+
186
|
| 1013 |
+
],
|
| 1014 |
+
"page_idx": 7
|
| 1015 |
+
},
|
| 1016 |
+
{
|
| 1017 |
+
"type": "text",
|
| 1018 |
+
"text": "Top@K Accuracy. We observe that the retrieval accuracy on the Overlap setting is higher than that on the Non-Overlap setting, due to the less availability of relevant knowledge required for test-time queries in the Non-Overlap setting. Yet, when we replace the knowledge base constructed from our approach with the Oracle knowledge base $(\\ast)$ , which includes all the necessary knowledge for test-time queries, the MRR on both settings reaches around $80\\%$ , indicating the importance of expanding the coverage of the knowledge base for accurate knowledge retrieval. The table also compares the performance of different basis models for retrieval - BERT (Devlin et al., 2019) and TAS-B (Hofstätter et al., 2021) - with the latter being fine-tuned for retrieval. It can be seen that the extra training of the model on retrieval tasks aids in achieving superior performance for retrieving the knowledge for text-to-SQL.",
|
| 1019 |
+
"bbox": [
|
| 1020 |
+
115,
|
| 1021 |
+
204,
|
| 1022 |
+
489,
|
| 1023 |
+
493
|
| 1024 |
+
],
|
| 1025 |
+
"page_idx": 7
|
| 1026 |
+
},
|
| 1027 |
+
{
|
| 1028 |
+
"type": "text",
|
| 1029 |
+
"text": "Generalization Analysis to Different Domains",
|
| 1030 |
+
"text_level": 1,
|
| 1031 |
+
"bbox": [
|
| 1032 |
+
115,
|
| 1033 |
+
506,
|
| 1034 |
+
485,
|
| 1035 |
+
521
|
| 1036 |
+
],
|
| 1037 |
+
"page_idx": 7
|
| 1038 |
+
},
|
| 1039 |
+
{
|
| 1040 |
+
"type": "text",
|
| 1041 |
+
"text": "To see whether our knowledge base can be generalizable to databases of different domains (that are not overlapped with those for knowledge base construction), we breakdown the performance based on whether test databases share domains with training databases or belong to different domains (according to 37 domains categorized from Li et al. (2023)). As shown in Table 5, our KAT-SQL achieves substantially higher performance when test databases overlap with training domains compared to those from unseen domains; however, even in the latter case, KAT-SQL still outperforms existing baselines. These results indicate that, while the lack of domain overlaps degrades the performance, our knowledge base still provides meaningful benefits for unseen domains, demonstrating its generalizability.",
|
| 1042 |
+
"bbox": [
|
| 1043 |
+
115,
|
| 1044 |
+
523,
|
| 1045 |
+
487,
|
| 1046 |
+
780
|
| 1047 |
+
],
|
| 1048 |
+
"page_idx": 7
|
| 1049 |
+
},
|
| 1050 |
+
{
|
| 1051 |
+
"type": "text",
|
| 1052 |
+
"text": "Analysis with Different LLMs To evaluate how robust our KAT-SAL approach is across different LLMs, we conduct the additional analysis instantiating the text-to-SQL and knowledge generation models with other recent LLMs such as Granite 34B (Mishra et al., 2024) and Mixtral 8x7B (Jiang et al., 2024); results are shown in Table 6. From this, we observe that KAT-SQL consistently out",
|
| 1053 |
+
"bbox": [
|
| 1054 |
+
115,
|
| 1055 |
+
791,
|
| 1056 |
+
487,
|
| 1057 |
+
920
|
| 1058 |
+
],
|
| 1059 |
+
"page_idx": 7
|
| 1060 |
+
},
|
| 1061 |
+
{
|
| 1062 |
+
"type": "table",
|
| 1063 |
+
"img_path": "images/71fcb30b87cee67cfcd9d4b43af3b8c497033b963867b7c4ddde6f0a0b7cf280.jpg",
|
| 1064 |
+
"table_caption": [
|
| 1065 |
+
"Table 6: Text to SQL results with different LLMs."
|
| 1066 |
+
],
|
| 1067 |
+
"table_footnote": [],
|
| 1068 |
+
"table_body": "<table><tr><td>LLMs</td><td>Methods</td><td>Overlap</td><td>Non-Overlap</td></tr><tr><td rowspan=\"4\">Llama</td><td>No Knowledge</td><td>23.76</td><td>20.66</td></tr><tr><td>DELLM</td><td>34.70</td><td>24.64</td></tr><tr><td>KAT-SQL</td><td>41.18</td><td>41.07</td></tr><tr><td>Oracle Knowledge</td><td>54.67</td><td>49.41</td></tr><tr><td rowspan=\"4\">Granite</td><td>No Knowledge</td><td>25.83</td><td>17.75</td></tr><tr><td>DELLM</td><td>34.04</td><td>20.21</td></tr><tr><td>KAT-SQL</td><td>39.28</td><td>35.83</td></tr><tr><td>Oracle Knowledge</td><td>46.56</td><td>38.32</td></tr><tr><td rowspan=\"4\">Mixtral</td><td>No Knowledge</td><td>11.75</td><td>10.58</td></tr><tr><td>DELLM</td><td>27.17</td><td>11.29</td></tr><tr><td>KAT-SQL</td><td>29.31</td><td>20.30</td></tr><tr><td>Oracle Knowledge</td><td>37.26</td><td>30.88</td></tr></table>",
|
| 1069 |
+
"bbox": [
|
| 1070 |
+
522,
|
| 1071 |
+
96,
|
| 1072 |
+
877,
|
| 1073 |
+
244
|
| 1074 |
+
],
|
| 1075 |
+
"page_idx": 7
|
| 1076 |
+
},
|
| 1077 |
+
{
|
| 1078 |
+
"type": "table",
|
| 1079 |
+
"img_path": "images/af6978d84add08afdb51c54f6f04b3255d23ffefbf468d7184825d9e3b2d66e1.jpg",
|
| 1080 |
+
"table_caption": [
|
| 1081 |
+
"Table 7: Results of our KAT-SQL approach with the state-of-the-art text-to-SQL model on the BIRD leaderboard."
|
| 1082 |
+
],
|
| 1083 |
+
"table_footnote": [],
|
| 1084 |
+
"table_body": "<table><tr><td>Models</td><td>EX</td></tr><tr><td>ChatGPT</td><td>24.05</td></tr><tr><td>ChatGPT + CoT</td><td>25.88</td></tr><tr><td>ExSL + granite-20b-code</td><td>51.69</td></tr><tr><td>ExSL + granite-20b-code w/ KAT-SQL (Ours)</td><td>57.56</td></tr><tr><td>ExSL + granite-20b-code w/ Oracle Knowledge</td><td>65.38</td></tr></table>",
|
| 1085 |
+
"bbox": [
|
| 1086 |
+
521,
|
| 1087 |
+
287,
|
| 1088 |
+
873,
|
| 1089 |
+
375
|
| 1090 |
+
],
|
| 1091 |
+
"page_idx": 7
|
| 1092 |
+
},
|
| 1093 |
+
{
|
| 1094 |
+
"type": "text",
|
| 1095 |
+
"text": "performs all baselines regardless of the choice of LLMs, which demonstrates the effectiveness and versatility of our proposed approach.",
|
| 1096 |
+
"bbox": [
|
| 1097 |
+
512,
|
| 1098 |
+
393,
|
| 1099 |
+
880,
|
| 1100 |
+
439
|
| 1101 |
+
],
|
| 1102 |
+
"page_idx": 7
|
| 1103 |
+
},
|
| 1104 |
+
{
|
| 1105 |
+
"type": "text",
|
| 1106 |
+
"text": "Finally, we augment the state-of-the-art text-to-SQL model (in the setting without oracle knowledge) on the BIRD leaderboard (Li et al., 2023), namely ExSL + granite-20b-code, using the knowledge generated from our proposed knowledge base construction-based approach. As shown in Table 7, we observe that the text-to-SQL model combined with our KAT-SQL approach establishes the new state-of-the-art performance, highlighting the value of our method as a powerful tool for text-to-SQL.",
|
| 1107 |
+
"bbox": [
|
| 1108 |
+
512,
|
| 1109 |
+
442,
|
| 1110 |
+
882,
|
| 1111 |
+
602
|
| 1112 |
+
],
|
| 1113 |
+
"page_idx": 7
|
| 1114 |
+
},
|
| 1115 |
+
{
|
| 1116 |
+
"type": "text",
|
| 1117 |
+
"text": "Analysis on Efficiency While our primary focus is on improving the text-to-SQL accuracy through knowledge base construction and augmentation, we also consider the efficiency of our approach. It is worth noting that the construction of the knowledge base is performed offline and does not affect real-time query processing; therefore, the extra computational overhead comes from retrieving relevant knowledge and generating the SQL statement in response to the query. In this regard, our retrieval process accounts for only $2\\%$ of the overall generation time, thanks to efficient search algorithm (Douze et al., 2024), making its impact negligible. Also, although incorporating knowledge into the text-to-SQL pipeline increases the prompt length by $30\\%$ , this overhead aligns with other knowledge augmentation methods (such as DELLM) and does not introduce additional latency specific to our approach. Overall, each query is processed under 5 seconds.",
|
| 1118 |
+
"bbox": [
|
| 1119 |
+
512,
|
| 1120 |
+
615,
|
| 1121 |
+
882,
|
| 1122 |
+
920
|
| 1123 |
+
],
|
| 1124 |
+
"page_idx": 7
|
| 1125 |
+
},
|
| 1126 |
+
{
|
| 1127 |
+
"type": "page_number",
|
| 1128 |
+
"text": "26576",
|
| 1129 |
+
"bbox": [
|
| 1130 |
+
477,
|
| 1131 |
+
928,
|
| 1132 |
+
524,
|
| 1133 |
+
940
|
| 1134 |
+
],
|
| 1135 |
+
"page_idx": 7
|
| 1136 |
+
},
|
| 1137 |
+
{
|
| 1138 |
+
"type": "table",
|
| 1139 |
+
"img_path": "images/2c8ae9f6d2e848eeb72c05d8a0c54f22b68871ae98ce0d57a4919d49923766d1.jpg",
|
| 1140 |
+
"table_caption": [
|
| 1141 |
+
"Table 8: Case study of knowledge and SQL generation results from three queries."
|
| 1142 |
+
],
|
| 1143 |
+
"table_footnote": [],
|
| 1144 |
+
"table_body": "<table><tr><td>Example</td><td>Query</td><td>Generated Knowledge and SQL</td></tr><tr><td>Example 1</td><td>Which position has a lower minimum salary, Account Representative or Trainee?</td><td>Generated Knowledge:\n1) lower minimum salary refers to MIN(minsalary)\n2) Account Representative and Trainee are position titles\nGenerated SQL:\nSELECT positiontitle FROM position WHERE positiontitle = 'Account Representative' OR positiontitle = 'Trainee' ORDER BY minsalary ASC LIMIT 1</td></tr><tr><td>Example 2</td><td>Among the employees working at the office in New York, how many of them have a good job performance?</td><td>Generated Knowledge:\n1) New York refers to state = 'NY'\n2) good job performance refers to performance = 'Good'\nGenerated SQL:\nSELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1_performance = 'Good'</td></tr><tr><td>Example 3</td><td>For all patients born in 1982, state if their albumin is within normal range.</td><td>Generated Knowledge:\n1) albumin is within normal range refers to ALB between 3.5 and 5.5\nGenerated SQL:\nSELECT CASE WHEN T2.ALB >= 3.5 AND T2.ALB <= 5.5 THEN 'normal' ELSE 'abnormal' END FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T1.Birthday) = '1982'</td></tr></table>",
|
| 1145 |
+
"bbox": [
|
| 1146 |
+
166,
|
| 1147 |
+
96,
|
| 1148 |
+
833,
|
| 1149 |
+
318
|
| 1150 |
+
],
|
| 1151 |
+
"page_idx": 8
|
| 1152 |
+
},
|
| 1153 |
+
{
|
| 1154 |
+
"type": "table",
|
| 1155 |
+
"img_path": "images/7ae2185d556d13aa68de9c2540362e5e116292c29601bdd1d535ee1c3e11ae8b.jpg",
|
| 1156 |
+
"table_caption": [
|
| 1157 |
+
"Table 9: Examples of original and its (similar) constructed knowledge within the knowledge base."
|
| 1158 |
+
],
|
| 1159 |
+
"table_footnote": [],
|
| 1160 |
+
"table_body": "<table><tr><td>Example</td><td>Original Knowledge</td><td>Constructed Similar Knowledge</td></tr><tr><td>Example 1</td><td>albumin is within normal range refers to ALB between 3.5 and 5.5</td><td>1) albumin is outside the normal range refers to ALB less than 3.5 or greater than 5.5\n2) glucose is within normal range refers to GLU between 70 and 100 mg/dL\n3) Hemoglobin (Hb) is considered normal for males if levels range from 13.5 to 17.5 g/dL</td></tr><tr><td>Example 2</td><td>Eligible free rate for K-12 = Free Meal Count (K-12) / Enrollment (K-12)</td><td>1) Eligible reduced-price rate for K-12 = Reduced-Price Meal Count (K-12) / Enrollment (K-12)\n2) Eligible free meal rate for students aged 5-17 = Free Meal Count (Ages 5-17) / Enrollment (Ages 5-17)\n3) Difference between K-12 and ages 5-17 enrollment = Enrollment (K-12) - Enrollment (Ages 5-17)</td></tr><tr><td>Example 3</td><td>Slovakia can be represented as Country = 'SVK'</td><td>1) France can be represented as Country = 'FRA'\n2) Brazil can be represented as Country = 'BRA'\n3) Monaco can be represented as Country = 'MCO'</td></tr></table>",
|
| 1161 |
+
"bbox": [
|
| 1162 |
+
166,
|
| 1163 |
+
342,
|
| 1164 |
+
833,
|
| 1165 |
+
502
|
| 1166 |
+
],
|
| 1167 |
+
"page_idx": 8
|
| 1168 |
+
},
|
| 1169 |
+
{
|
| 1170 |
+
"type": "text",
|
| 1171 |
+
"text": "Examples We provide examples for the knowledge generation and text-to-SQL in Table 8 as well as the entries in the knowledge base in Table 9.",
|
| 1172 |
+
"bbox": [
|
| 1173 |
+
112,
|
| 1174 |
+
526,
|
| 1175 |
+
489,
|
| 1176 |
+
574
|
| 1177 |
+
],
|
| 1178 |
+
"page_idx": 8
|
| 1179 |
+
},
|
| 1180 |
+
{
|
| 1181 |
+
"type": "text",
|
| 1182 |
+
"text": "6 Conclusion",
|
| 1183 |
+
"text_level": 1,
|
| 1184 |
+
"bbox": [
|
| 1185 |
+
112,
|
| 1186 |
+
586,
|
| 1187 |
+
247,
|
| 1188 |
+
600
|
| 1189 |
+
],
|
| 1190 |
+
"page_idx": 8
|
| 1191 |
+
},
|
| 1192 |
+
{
|
| 1193 |
+
"type": "text",
|
| 1194 |
+
"text": "In this work, we proposed a novel knowledge base construction-based text-to-SQL approach called KAT-SQL, based on the motivation that one piece of knowledge can be reused across multiple queries and databases. Our approach involves the creation of the knowledge base from which relevant knowledge is retrieved and utilized to generate SQL statements from queries. Through extensive evaluations on multiple datasets with two different scenarios, we showed that our KAT-SQL outperforms relevant knowledge-augmented text-to-SQL baselines. In addition, our detailed analyses highlight the effectiveness of each component in the knowledge generation and retrieval processes, but also the high coverage and relevance of the entries in the base.",
|
| 1195 |
+
"bbox": [
|
| 1196 |
+
112,
|
| 1197 |
+
611,
|
| 1198 |
+
489,
|
| 1199 |
+
852
|
| 1200 |
+
],
|
| 1201 |
+
"page_idx": 8
|
| 1202 |
+
},
|
| 1203 |
+
{
|
| 1204 |
+
"type": "text",
|
| 1205 |
+
"text": "Limitations",
|
| 1206 |
+
"text_level": 1,
|
| 1207 |
+
"bbox": [
|
| 1208 |
+
112,
|
| 1209 |
+
864,
|
| 1210 |
+
220,
|
| 1211 |
+
878
|
| 1212 |
+
],
|
| 1213 |
+
"page_idx": 8
|
| 1214 |
+
},
|
| 1215 |
+
{
|
| 1216 |
+
"type": "text",
|
| 1217 |
+
"text": "In this work, we propose constructing a knowledge base and then leveraging it for text-to-SQL tasks,",
|
| 1218 |
+
"bbox": [
|
| 1219 |
+
112,
|
| 1220 |
+
889,
|
| 1221 |
+
489,
|
| 1222 |
+
921
|
| 1223 |
+
],
|
| 1224 |
+
"page_idx": 8
|
| 1225 |
+
},
|
| 1226 |
+
{
|
| 1227 |
+
"type": "text",
|
| 1228 |
+
"text": "showcasing the clear advantages of constructing the knowledge base for text-to-SQL. However, as the performance gaps between the models with oracle knowledge and the generated knowledge from our knowledge base indicate, there is still room to improve the coverage of the knowledge base with advanced knowledge base construction methods, which is a promising area for future work.",
|
| 1229 |
+
"bbox": [
|
| 1230 |
+
507,
|
| 1231 |
+
526,
|
| 1232 |
+
884,
|
| 1233 |
+
653
|
| 1234 |
+
],
|
| 1235 |
+
"page_idx": 8
|
| 1236 |
+
},
|
| 1237 |
+
{
|
| 1238 |
+
"type": "text",
|
| 1239 |
+
"text": "Ethics Statement",
|
| 1240 |
+
"text_level": 1,
|
| 1241 |
+
"bbox": [
|
| 1242 |
+
509,
|
| 1243 |
+
668,
|
| 1244 |
+
660,
|
| 1245 |
+
684
|
| 1246 |
+
],
|
| 1247 |
+
"page_idx": 8
|
| 1248 |
+
},
|
| 1249 |
+
{
|
| 1250 |
+
"type": "text",
|
| 1251 |
+
"text": "We recognize that any text-to-SQL system, including our proposed approach, may carry the inherent risk of generating SQL queries that may inadvertently or intentionally access, modify, or delete sensitive information within a database. While this vulnerability is not exclusive to our method and is a well-known challenge in the broader field of text-to-SQL systems, it underscores the importance of implementing robust security measures and access controls before deploying such systems. Similar to this, safety is particularly crucial in our application, so as to avoid the risk of sensitive information being stored in the knowledge base and subsequently being inappropriately reused.",
|
| 1252 |
+
"bbox": [
|
| 1253 |
+
507,
|
| 1254 |
+
696,
|
| 1255 |
+
884,
|
| 1256 |
+
921
|
| 1257 |
+
],
|
| 1258 |
+
"page_idx": 8
|
| 1259 |
+
},
|
| 1260 |
+
{
|
| 1261 |
+
"type": "page_number",
|
| 1262 |
+
"text": "26577",
|
| 1263 |
+
"bbox": [
|
| 1264 |
+
475,
|
| 1265 |
+
927,
|
| 1266 |
+
524,
|
| 1267 |
+
940
|
| 1268 |
+
],
|
| 1269 |
+
"page_idx": 8
|
| 1270 |
+
},
|
| 1271 |
+
{
|
| 1272 |
+
"type": "text",
|
| 1273 |
+
"text": "References",
|
| 1274 |
+
"text_level": 1,
|
| 1275 |
+
"bbox": [
|
| 1276 |
+
115,
|
| 1277 |
+
84,
|
| 1278 |
+
213,
|
| 1279 |
+
98
|
| 1280 |
+
],
|
| 1281 |
+
"page_idx": 9
|
| 1282 |
+
},
|
| 1283 |
+
{
|
| 1284 |
+
"type": "text",
|
| 1285 |
+
"text": "AI@Meta. 2024. Llama 3 model card.",
|
| 1286 |
+
"bbox": [
|
| 1287 |
+
115,
|
| 1288 |
+
108,
|
| 1289 |
+
376,
|
| 1290 |
+
121
|
| 1291 |
+
],
|
| 1292 |
+
"page_idx": 9
|
| 1293 |
+
},
|
| 1294 |
+
{
|
| 1295 |
+
"type": "list",
|
| 1296 |
+
"sub_type": "ref_text",
|
| 1297 |
+
"list_items": [
|
| 1298 |
+
"Dimitrios Alivanistos, Selene Baez Santamaría, Michael Cochez, Jan-Christoph Kalo, Emile van Krieken, and Thiviyan Thanapalasingam. 2022. Prompting as probing: Using language models for knowledge base construction. In Proceedings of the Semantic Web Challenge on Knowledge Base Construction from Pre-trained Language Models 2022 co-located with the 21st International Semantic Web Conference (ISWC2022), Virtual Event, Hangzhou, China, October 2022, volume 3274 of CEUR Workshop Proceedings, pages 11-34. CEUR-WS.org.",
|
| 1299 |
+
"Rohan Anil, Sebastian Borgeaud, Yonghui Wu, JeanBaptiste Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M. Dai, Anja Hauth, Katie Millican, David Silver, Slav Petrov, Melvin Johnson, Ioannis Antonoglou, Julian Schrittwieser, Amelia Glaese, Jilin Chen, Emily Pitler, Timothy P. Lillicrap, Angeliki Lazaridou, Orhan Firat, James Molloy, Michael Isard, Paul Ronald Barham, Tom Hennigan, Benjamin Lee, Fabio Viola, Malcolm Reynolds, Yuanzhong Xu, Ryan Doherty, Eli Collins, Clemens Meyer, Eliza Rutherford, Erica Moreira, Kareem Ayoub, Megha Goel, George Tucker, Enrique Piqueras, Maxim Krikun, Iain Barr, Nikolay Savinov, Ivo Danihelka, Becca Roelofs, Anaïs White, Anders Andreassen, Tamara von Glehn, Lakshman Yagati, Mehran Kazemi, Lucas Gonzalez, Misha Khalman, Jakub Sygnowski, and et al. 2023. Gemini: A family of highly capable multimodal models. arXiv preprint arXiv:2312.11805.",
|
| 1300 |
+
"Ruichu Cai, Boyan Xu, Zhenjie Zhang, Xiaoyan Yang, Zijian Li, and Zhihao Liang. 2018. An encoder-decoder framework translating natural language to database queries. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI 2018, July 13-19, 2018, Stockholm, Sweden, pages 3977-3983. ijcai.org.",
|
| 1301 |
+
"Shuaichen Chang and Eric Fosler-Lussier. 2023. How to prompt llms for text-to-sql: A study in zero-shot, single-domain, and cross-domain settings. arXiv preprint arXiv:2305.11853.",
|
| 1302 |
+
"Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171-4186. Association for Computational Linguistics.",
|
| 1303 |
+
"Xuemei Dong, Chao Zhang, Yuhang Ge, Yuren Mao, Yunjun Gao, Lu Chen, Jinshu Lin, and Dongfang Lou. 2023. C3: zero-shot text-to-sql with chatgpt. arXiv preprint arXiv:2307.07306."
|
| 1304 |
+
],
|
| 1305 |
+
"bbox": [
|
| 1306 |
+
115,
|
| 1307 |
+
134,
|
| 1308 |
+
489,
|
| 1309 |
+
921
|
| 1310 |
+
],
|
| 1311 |
+
"page_idx": 9
|
| 1312 |
+
},
|
| 1313 |
+
{
|
| 1314 |
+
"type": "list",
|
| 1315 |
+
"sub_type": "ref_text",
|
| 1316 |
+
"list_items": [
|
| 1317 |
+
"Longxu Dou, Yan Gao, Xuqi Liu, Mingyang Pan, Dingzirui Wang, Wanxiang Che, Dechen Zhan, MinYen Kan, and Jian-Guang Lou. 2022. Towards knowledge-intensive text-to-sql semantic parsing with formulaic knowledge. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 5240-5253. Association for Computational Linguistics.",
|
| 1318 |
+
"Matthijs Douze, Alexandr Guzhva, Chengqi Deng, Jeff Johnson, Gergely Szilvasy, Pierre-Emmanuel Mazaré, Maria Lomeli, Lucas Hosseini, and Hervé Jégou. 2024. The faiss library. arXiv preprint arXiv:2401.08281.",
|
| 1319 |
+
"Dawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun, Yichen Qian, Bolin Ding, and Jingren Zhou. 2024. Text-to-sql empowered by large language models: A benchmark evaluation. Proc. VLDB Endow., 17(5):1132-1145.",
|
| 1320 |
+
"Zihui Gu, Ju Fan, Nan Tang, Lei Cao, Bowen Jia, Sam Madden, and Xiaoyong Du. 2023. Few-shot text-tosql translation using structure and content prompt learning. Proc. ACM Manag. Data, 1(2):147:1-147:28.",
|
| 1321 |
+
"Sebastian Hofstätter, Sheng-Chieh Lin, Jheng-Hong Yang, Jimmy Lin, and Allan Hanbury. 2021. Efficiently teaching an effective dense retriever with balanced topic aware sampling. In SIGIR '21: The 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, Virtual Event, Canada, July 11-15, 2021, pages 113-122. ACM.",
|
| 1322 |
+
"Zijin Hong, Zheng Yuan, Hao Chen, Qinggang Zhang, Feiran Huang, and Xiao Huang. 2024. Knowledge-to-sql: Enhancing SQL generation with data expert LLM. arXiv preprint arXiv:2402.11517.",
|
| 1323 |
+
"Albert Q. Jiang, Alexandre Sablayrolles, Antoine Roux, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de Las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Sandeep Subramanian, Sophia Yang, Szymon Antoniak, Teven Le Scao, Théophile Gervet, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. 2024. Mixtral of experts. arXiv preprint arXiv:2401.04088.",
|
| 1324 |
+
"Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick S. H. Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pages 6769-6781. Association for Computational Linguistics.",
|
| 1325 |
+
"Dongjun Lee, Choongwon Park, Jaehyuk Kim, and Heesoo Park. 2024. MCS-SQL: leveraging multiple"
|
| 1326 |
+
],
|
| 1327 |
+
"bbox": [
|
| 1328 |
+
510,
|
| 1329 |
+
85,
|
| 1330 |
+
884,
|
| 1331 |
+
921
|
| 1332 |
+
],
|
| 1333 |
+
"page_idx": 9
|
| 1334 |
+
},
|
| 1335 |
+
{
|
| 1336 |
+
"type": "page_number",
|
| 1337 |
+
"text": "26578",
|
| 1338 |
+
"bbox": [
|
| 1339 |
+
475,
|
| 1340 |
+
927,
|
| 1341 |
+
524,
|
| 1342 |
+
940
|
| 1343 |
+
],
|
| 1344 |
+
"page_idx": 9
|
| 1345 |
+
},
|
| 1346 |
+
{
|
| 1347 |
+
"type": "list",
|
| 1348 |
+
"sub_type": "ref_text",
|
| 1349 |
+
"list_items": [
|
| 1350 |
+
"prompts and multiple-choice selection for text-to-sql generation. arXiv preprint arXiv:2405.07467.",
|
| 1351 |
+
"Jinyang Li, Binyuan Hui, Ge Qu, Jiaxi Yang, Binhua Li, Bowen Li, Bailin Wang, Bowen Qin, Ruiying Geng, Nan Huo, Xuanhe Zhou, Chenhao Ma, Guoliang Li, Kevin Chen-Chuan Chang, Fei Huang, Reynold Cheng, and Yongbin Li. 2023. Can LLM already serve as A database interface? A big bench for large-scale database grounded text-to-sqls. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.",
|
| 1352 |
+
"Xiping Liu and Zhao Tan. 2023. Divide and prompt: Chain of thought prompting for text-to-sql. arXiv preprint arXiv:2304.11556.",
|
| 1353 |
+
"Mayank Mishra, Matt Stallone, Gaoyuan Zhang, Yikang Shen, Aditya Prasad, Adriana Meza Soria, Michele Merler, Parameswaran Selvam, Saptha Surendran, Shivdeep Singh, Manish Sethi, Xuan-Hong Dang, Pengyuan Li, Kun-Lung Wu, Syed Zawad, Andrew Coleman, Matthew White, Mark Lewis, Raju Pavuluri, Yan Koyfman, Boris Lublinsky, Maximilien de Bayser, Ibrahim Abdelaziz, Kinjal Basu, Mayank Agarwal, Yi Zhou, Chris Johnson, Aanchal Goyal, Hima Patel, S. Yousaf Shah, Petros Zerfos, Heiko Ludwig, Asim Munawar, Maxwell Crouse, Pavan Kapanipathi, Shweta Salaria, Bob Calio, Sophia Wen, Seetharami Seelam, Brian Belgodere, Carlos A. Fonseca, Amith Singhee, Nirmit Desai, David D. Cox, Ruchir Puri, and Rameswar Panda. 2024. Granite code models: A family of open foundation models for code intelligence. arXiv preprint arXiv:2405.04324.",
|
| 1354 |
+
"Subhabrata Mukherjee, Arindam Mitra, Ganesh Jawahar, Sahaj Agarwal, Hamid Palangi, and Ahmed Awadallah. 2023. Orca: Progressive learning from complex explanation traces of GPT-4. arXiv preprint arXiv:2306.02707.",
|
| 1355 |
+
"Anmol Nayak and Hariprasad Timmapathini. 2023. LLM2KB: constructing knowledge bases using instruction tuned context aware large language models. In Joint proceedings of the 1st workshop on Knowledge Base Construction from Pre-Trained Language Models (KBC-LM) and the 2nd challenge on Language Models for Knowledge Base Construction (LM-KBC) co-located with the 22nd International Semantic Web Conference (ISWC 2023), Athens, Greece, November 6, 2023, volume 3577 of CEUR Workshop Proceedings. CEUR-WS.org.",
|
| 1356 |
+
"OpenAI. 2023. GPT-4 technical report. arXiv preprint arXiv:2303.08774.",
|
| 1357 |
+
"Mohammadreza Pourreza and Davood Rafiei. 2023. DIN-SQL: decomposed in-context learning of text-to-sql with self-correction. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023."
|
| 1358 |
+
],
|
| 1359 |
+
"bbox": [
|
| 1360 |
+
115,
|
| 1361 |
+
85,
|
| 1362 |
+
485,
|
| 1363 |
+
917
|
| 1364 |
+
],
|
| 1365 |
+
"page_idx": 10
|
| 1366 |
+
},
|
| 1367 |
+
{
|
| 1368 |
+
"type": "list",
|
| 1369 |
+
"sub_type": "ref_text",
|
| 1370 |
+
"list_items": [
|
| 1371 |
+
"Nitarshan Rajkumar, Raymond Li, and Dzmitry Bahdanau. 2022. Evaluating the text-to-sql capabilities of large language models. arXiv preprint arXiv:2204.00498.",
|
| 1372 |
+
"Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and TieYan Liu. 2020. Mpnet: Masked and permuted pretraining for language understanding. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual.",
|
| 1373 |
+
"Shivchander Sudalairaj, Abhishek Bhandwaldar, Aldo Pareja, Kai Xu, David D. Cox, and Akash Srivastava. 2024. LAB: large-scale alignment for chatbots. arXiv preprint arXiv:2403.01081.",
|
| 1374 |
+
"Chang-Yu Tai, Ziru Chen, Tianshu Zhang, Xiang Deng, and Huan Sun. 2023. Exploring chain of thought style prompting for text-to-sql. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, EMNLP 2023, Singapore, December 6-10, 2023, pages 5376-5393. Association for Computational Linguistics.",
|
| 1375 |
+
"Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. 2023. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca.",
|
| 1376 |
+
"Blerta Veseli, Simon Razniewski, Jan-Christoph Kalo, and Gerhard Weikum. 2023. Evaluating the knowledge base completion potential of GPT. In *Findings of the Association for Computational Linguistics: EMNLP* 2023, Singapore, December 6-10, 2023, pages 6432-6443. Association for Computational Linguistics.",
|
| 1377 |
+
"Denny Vrandecic and Markus Krötzsch. 2014. Wikidata: a free collaborative knowledgebase. Commun. ACM, 57(10):78-85.",
|
| 1378 |
+
"Bing Wang, Changyu Ren, Jian Yang, Xinnian Liang, Jiaqi Bai, Qian-Wen Zhang, Zhao Yan, and Zhoujun Li. 2023a. MAC-SQL: A multi-agent collaborative framework for text-to-sql. arXiv preprint arXiv:2312.11242.",
|
| 1379 |
+
"Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V. Le, Ed H. Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. 2023b. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net.",
|
| 1380 |
+
"Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A. Smith, Daniel Khashabi, and Hannaneh Hajishirzi. 2023c. Self-instruct: Aligning language models with self-generated instructions. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2023, Toronto, Canada, July 9-14, 2023, pages 13484-13508. Association for Computational Linguistics."
|
| 1381 |
+
],
|
| 1382 |
+
"bbox": [
|
| 1383 |
+
510,
|
| 1384 |
+
85,
|
| 1385 |
+
880,
|
| 1386 |
+
920
|
| 1387 |
+
],
|
| 1388 |
+
"page_idx": 10
|
| 1389 |
+
},
|
| 1390 |
+
{
|
| 1391 |
+
"type": "page_number",
|
| 1392 |
+
"text": "26579",
|
| 1393 |
+
"bbox": [
|
| 1394 |
+
475,
|
| 1395 |
+
928,
|
| 1396 |
+
524,
|
| 1397 |
+
940
|
| 1398 |
+
],
|
| 1399 |
+
"page_idx": 10
|
| 1400 |
+
},
|
| 1401 |
+
{
|
| 1402 |
+
"type": "list",
|
| 1403 |
+
"sub_type": "ref_text",
|
| 1404 |
+
"list_items": [
|
| 1405 |
+
"Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed H. Chi, Quoc V. Le, and Denny Zhou. 2022. Chain-of-thought prompting elicits reasoning in large language models. In Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022, New Orleans, LA, USA, November 28 - December 9, 2022.",
|
| 1406 |
+
"Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. 2023. Wizardlm: Empowering large language models to follow complex instructions. arXiv preprint arXiv:2304.12244.",
|
| 1407 |
+
"Xiaojun Xu, Chang Liu, and Dawn Song. 2017. SQLnet: Generating structured queries from natural language without reinforcement learning. arXiv preprint arXiv:1711.04436.",
|
| 1408 |
+
"Navid Yaghmazadeh, Yuepeng Wang, Isil Dillig, and Thomas Dillig. 2017. Squizer: query synthesis from natural language. Proc. ACM Program. Lang., 1(OOPSLA):63:1-63:26.",
|
| 1409 |
+
"Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, Zilin Zhang, and Dragomir R. Radev. 2018. Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 31 - November 4, 2018, pages 3911-3921. Association for Computational Linguistics.",
|
| 1410 |
+
"John M. Zelle and Raymond J. Mooney. 1996. Learning to parse database queries using inductive logic programming. In Proceedings of the Thirteenth National Conference on Artificial Intelligence and Eighth Innovative Applications of Artificial Intelligence Conference, AAAI 96, IAAI 96, Portland, Oregon, USA, August 4-8, 1996, Volume 2, pages 1050-1055. AAAI Press / The MIT Press."
|
| 1411 |
+
],
|
| 1412 |
+
"bbox": [
|
| 1413 |
+
115,
|
| 1414 |
+
85,
|
| 1415 |
+
489,
|
| 1416 |
+
646
|
| 1417 |
+
],
|
| 1418 |
+
"page_idx": 11
|
| 1419 |
+
},
|
| 1420 |
+
{
|
| 1421 |
+
"type": "page_number",
|
| 1422 |
+
"text": "26580",
|
| 1423 |
+
"bbox": [
|
| 1424 |
+
475,
|
| 1425 |
+
928,
|
| 1426 |
+
524,
|
| 1427 |
+
940
|
| 1428 |
+
],
|
| 1429 |
+
"page_idx": 11
|
| 1430 |
+
},
|
| 1431 |
+
{
|
| 1432 |
+
"type": "text",
|
| 1433 |
+
"text": "A Prompts",
|
| 1434 |
+
"text_level": 1,
|
| 1435 |
+
"bbox": [
|
| 1436 |
+
115,
|
| 1437 |
+
84,
|
| 1438 |
+
226,
|
| 1439 |
+
99
|
| 1440 |
+
],
|
| 1441 |
+
"page_idx": 12
|
| 1442 |
+
},
|
| 1443 |
+
{
|
| 1444 |
+
"type": "text",
|
| 1445 |
+
"text": "We provide prompts used to elicit the knowledge generation and the SQL generation in Table 10.",
|
| 1446 |
+
"bbox": [
|
| 1447 |
+
112,
|
| 1448 |
+
109,
|
| 1449 |
+
485,
|
| 1450 |
+
140
|
| 1451 |
+
],
|
| 1452 |
+
"page_idx": 12
|
| 1453 |
+
},
|
| 1454 |
+
{
|
| 1455 |
+
"type": "text",
|
| 1456 |
+
"text": "B Algorithms",
|
| 1457 |
+
"text_level": 1,
|
| 1458 |
+
"bbox": [
|
| 1459 |
+
114,
|
| 1460 |
+
153,
|
| 1461 |
+
250,
|
| 1462 |
+
168
|
| 1463 |
+
],
|
| 1464 |
+
"page_idx": 12
|
| 1465 |
+
},
|
| 1466 |
+
{
|
| 1467 |
+
"type": "text",
|
| 1468 |
+
"text": "We provide the pseudo-code for knowledge base construction in Algorithm 2 and the pseudo-code for our full KAT-SQL approach in Algorithm 3.",
|
| 1469 |
+
"bbox": [
|
| 1470 |
+
112,
|
| 1471 |
+
178,
|
| 1472 |
+
487,
|
| 1473 |
+
225
|
| 1474 |
+
],
|
| 1475 |
+
"page_idx": 12
|
| 1476 |
+
},
|
| 1477 |
+
{
|
| 1478 |
+
"type": "text",
|
| 1479 |
+
"text": "C Additional Experimental Results",
|
| 1480 |
+
"text_level": 1,
|
| 1481 |
+
"bbox": [
|
| 1482 |
+
114,
|
| 1483 |
+
237,
|
| 1484 |
+
435,
|
| 1485 |
+
254
|
| 1486 |
+
],
|
| 1487 |
+
"page_idx": 12
|
| 1488 |
+
},
|
| 1489 |
+
{
|
| 1490 |
+
"type": "text",
|
| 1491 |
+
"text": "Knowledge Base Statistics The resulting knowledge base for the database overlapping and nonoverlapping scenarios contains 86,254 and 117,328 knowledge entries, respectively, which are greater than the original number of knowledge entries annotated in the BIRD dataset, which is 12,751.",
|
| 1492 |
+
"bbox": [
|
| 1493 |
+
112,
|
| 1494 |
+
263,
|
| 1495 |
+
489,
|
| 1496 |
+
357
|
| 1497 |
+
],
|
| 1498 |
+
"page_idx": 12
|
| 1499 |
+
},
|
| 1500 |
+
{
|
| 1501 |
+
"type": "text",
|
| 1502 |
+
"text": "Knowledge Base Construction Cost While the construction of the knowledge base is performed offline and does not impact real-time operations of text-to-SQL, we provide the cost to construct the knowledge base for our KAT2SQL approach to enable researchers to estimate resource requirements for scaling and implementation. Note that the exact computational costs and time required for knowledge base construction vary depending on hardware types and configurations, and with four H100 GPUs that can process 2K tokens per second and generate 10 tokens per second for Llama 70B, the time required to generate each knowledge entry is around 2 seconds. Therefore, for the knowledge base with 100K entries, the total generation time would be 56 hours divided by the number of parallel models (it completes in 7 hours with 8 models).",
|
| 1503 |
+
"bbox": [
|
| 1504 |
+
112,
|
| 1505 |
+
369,
|
| 1506 |
+
489,
|
| 1507 |
+
642
|
| 1508 |
+
],
|
| 1509 |
+
"page_idx": 12
|
| 1510 |
+
},
|
| 1511 |
+
{
|
| 1512 |
+
"type": "text",
|
| 1513 |
+
"text": "Retrieval over Different Knowledge Sources It is worthwhile to note that, for text-to-SQL tasks, it is crucial to consider the relationship between the query and the database (in addition to the consideration of the domain-specific knowledge for domain-specific queries); therefore, using the unstructured knowledge sources (such as web search) may not be optimal for this purpose since they often lack the structured, schema-specific information necessary for accurately formulating SQL queries. Nevertheless, to further validate this claim, we perform retrieval over Wikipedia, instead of performing retrieval over the constructed knowledge base, and observe only the marginal performance gain $(3\\%)$ compared to the baseline without augmentation.",
|
| 1514 |
+
"bbox": [
|
| 1515 |
+
112,
|
| 1516 |
+
651,
|
| 1517 |
+
489,
|
| 1518 |
+
892
|
| 1519 |
+
],
|
| 1520 |
+
"page_idx": 12
|
| 1521 |
+
},
|
| 1522 |
+
{
|
| 1523 |
+
"type": "page_number",
|
| 1524 |
+
"text": "26581",
|
| 1525 |
+
"bbox": [
|
| 1526 |
+
475,
|
| 1527 |
+
928,
|
| 1528 |
+
522,
|
| 1529 |
+
940
|
| 1530 |
+
],
|
| 1531 |
+
"page_idx": 12
|
| 1532 |
+
},
|
| 1533 |
+
{
|
| 1534 |
+
"type": "table",
|
| 1535 |
+
"img_path": "images/2c542d8874cf8b04bae3f16dd5700e08f09ee020bb5041c82fc92516fb7935b7.jpg",
|
| 1536 |
+
"table_caption": [
|
| 1537 |
+
"Table 10: A list of prompts that we use for knowledge generation and SQL generation. It is worth noting that the variable inside the parentheses $\\{\\}$ is replaced with its actual values."
|
| 1538 |
+
],
|
| 1539 |
+
"table_footnote": [],
|
| 1540 |
+
"table_body": "<table><tr><td>Types</td><td>Prompts</td></tr><tr><td rowspan=\"10\">Knowledge Generation</td><td>DB Schema: {Database Schema}</td></tr><tr><td>Question: {Few-Shot Question 1}</td></tr><tr><td>Evidence: {Few-Shot Evidence 1}</td></tr><tr><td>Question: {Few-Shot Question 2}</td></tr><tr><td>Evidence: {Few-Shot Evidence 2}</td></tr><tr><td>...</td></tr><tr><td>Question: {Few-Shot Question 10}</td></tr><tr><td>Evidence: {Few-Shot Evidence 10}</td></tr><tr><td>Question: {Target Question}</td></tr><tr><td>Evidence:</td></tr><tr><td rowspan=\"14\">SQL Generation</td><td>DB Schema: {Database Schema}</td></tr><tr><td>Question: {Few-Shot Question 1}</td></tr><tr><td>Evidence: {Few-Shot Evidence 1}</td></tr><tr><td>SQL: {Few-Shot SQL 1}</td></tr><tr><td>Question: {Few-Shot Question 2}</td></tr><tr><td>Evidence: {Few-Shot Evidence 2}</td></tr><tr><td>SQL: {Few-Shot SQL 2}</td></tr><tr><td>...</td></tr><tr><td>Question: {Few-Shot Question 10}</td></tr><tr><td>Evidence: {Few-Shot Evidence 10}</td></tr><tr><td>SQL: {Few-Shot SQL 10}</td></tr><tr><td>Question: {Target Question}</td></tr><tr><td>Evidence: {Generated Knowledge}</td></tr><tr><td>SQL:</td></tr></table>",
|
| 1541 |
+
"bbox": [
|
| 1542 |
+
117,
|
| 1543 |
+
311,
|
| 1544 |
+
878,
|
| 1545 |
+
719
|
| 1546 |
+
],
|
| 1547 |
+
"page_idx": 13
|
| 1548 |
+
},
|
| 1549 |
+
{
|
| 1550 |
+
"type": "page_number",
|
| 1551 |
+
"text": "26582",
|
| 1552 |
+
"bbox": [
|
| 1553 |
+
475,
|
| 1554 |
+
927,
|
| 1555 |
+
524,
|
| 1556 |
+
940
|
| 1557 |
+
],
|
| 1558 |
+
"page_idx": 13
|
| 1559 |
+
},
|
| 1560 |
+
{
|
| 1561 |
+
"type": "code",
|
| 1562 |
+
"sub_type": "algorithm",
|
| 1563 |
+
"code_caption": [
|
| 1564 |
+
"Algorithm 2 Knowledge Base Construction for KAT-SQL"
|
| 1565 |
+
],
|
| 1566 |
+
"code_body": "Require: Dataset $D$ containing query-schema-knowledge triplets $(q,\\mathcal{D},k)$ ; Prompt template $\\mathcal{T}$ \nEnsure: Knowledge base $\\mathcal{K}$ \n1: $\\mathcal{K} \\gets \\{\\}$ ▷ Initialize an empty knowledge base \n2: for all $(q,\\mathcal{D},k) \\in D$ do \n3: $\\mathcal{K} \\gets \\mathcal{K} \\cup k$ ▷ Add existing knowledge to the knowledge base \n4: end for \n5: for all query-schema pair $(q,\\mathcal{D}) \\in D$ do \n6: $\\mathcal{E} \\gets \\text{Top-}k$ relevant examples to the query $q$ from $D$ \n7: for $i = 1$ to $N$ do ▷ Iteratively expand knowledge \n8: $\\mathcal{E}_{\\text{perm}} \\gets \\text{Permute examples } \\mathcal{E}$ \n9: $k_{\\text{new}} \\gets \\text{LLM}(\\mathcal{T}(q,\\mathcal{D},\\mathcal{E}_{\\text{perm}}))$ ▷ Generate knowledge using LLM with examples \n10: $\\mathcal{K} \\gets \\mathcal{K} \\cup k_{\\text{new}}$ ▷ Store generated knowledge in the knowledge base \n11: end for \n12: end for",
|
| 1567 |
+
"bbox": [
|
| 1568 |
+
115,
|
| 1569 |
+
159,
|
| 1570 |
+
882,
|
| 1571 |
+
388
|
| 1572 |
+
],
|
| 1573 |
+
"page_idx": 14
|
| 1574 |
+
},
|
| 1575 |
+
{
|
| 1576 |
+
"type": "code",
|
| 1577 |
+
"sub_type": "algorithm",
|
| 1578 |
+
"code_caption": [
|
| 1579 |
+
"Algorithm 3 Knowledge-Augmented Text-to-SQL (KAT-SQL)"
|
| 1580 |
+
],
|
| 1581 |
+
"code_body": "Require: Query q; Database schema D; Knowledge base K \nEnsure: SQL statement s \n1: function KAT-SQL(q, D, K) \n2: {ki}j{i=1} ← RETRIEVER(q, K) ▷ Retrieve relevant knowledge entries from K \n3: Tref ← CREATEPROMPT(q, {ki}j{i=1}, D) ▷ Construct the prompt with retrieved knowledge \n4: k' ← LLM(Tref) ▷ Refine knowledge using LLM \n5: Taug ← CREATEPROMPT(q, k', D) ▷ Augment the prompt with refined knowledge \n6: s ← LLM(Taug) ▷ Generate SQL with knowledge augmentation \n7: return s \n8: end function \n9: function RETRIEVER(q, K) \n10: Compute embeddings for q and all knowledge entries k ∈ K \n11: Retrieve top-j relevant knowledge entries {ki}j{i=1} based on embedding similarities \n12: return {ki}j{i=1} \n13: end function \n14: function CREATEPROMPT(q, k, D) \n15: Construct the prompt template T using the query q, knowledge k, and database schema D \n16: return T \n17: end function",
|
| 1582 |
+
"bbox": [
|
| 1583 |
+
115,
|
| 1584 |
+
531,
|
| 1585 |
+
882,
|
| 1586 |
+
859
|
| 1587 |
+
],
|
| 1588 |
+
"page_idx": 14
|
| 1589 |
+
},
|
| 1590 |
+
{
|
| 1591 |
+
"type": "page_number",
|
| 1592 |
+
"text": "26583",
|
| 1593 |
+
"bbox": [
|
| 1594 |
+
475,
|
| 1595 |
+
927,
|
| 1596 |
+
524,
|
| 1597 |
+
940
|
| 1598 |
+
],
|
| 1599 |
+
"page_idx": 14
|
| 1600 |
+
}
|
| 1601 |
+
]
|
2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/73bdcaed-a35c-49f3-8627-be661122ae67_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/73bdcaed-a35c-49f3-8627-be661122ae67_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81f945e54bbb588f1aeba9dc7eb5fc19eaef927939e68a8d750238e900e97720
|
| 3 |
+
size 614595
|
2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/full.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Knowledge Base Construction for Knowledge-Augmented Text-to-SQL
|
| 2 |
+
|
| 3 |
+
Jinheon Baek $^{1*}$ Horst Samulowitz $^{2}$ Oktie Hassanzadeh $^{2}$
|
| 4 |
+
|
| 5 |
+
Dharmashankar Subramanian $^{2}$ Sola Shirai $^{2}$ Alfio Gliozzo $^{2}$ Debarun Bhattacharjya $^{2}$
|
| 6 |
+
|
| 7 |
+
KAIST<sup>1</sup> IBM Research<sup>2</sup>
|
| 8 |
+
|
| 9 |
+
jinheon.baek@kaist.ac.kr {samulowitz, hassanzadeh}@us.ibm.com dharmash@us.ibm.com solashirai@ibm.com {gliozzo, debarunb}@us.ibm.com
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
Text-to-SQL aims to translate natural language queries into SQL statements, which is practical as it enables anyone to easily retrieve the desired information from databases. Recently, many existing approaches tackle this problem with Large Language Models (LLMs), leveraging their strong capability in understanding user queries and generating corresponding SQL code. Yet, the parametric knowledge in LLMs might be limited to covering all the diverse and domain-specific queries that require grounding in various database schemas, which makes generated SQLs less accurate oftentimes. To tackle this, we propose constructing the knowledge base for text-to-SQL, a foundational source of knowledge, from which we retrieve and generate the necessary knowledge for given queries. In particular, unlike existing approaches that either manually annotate knowledge or generate only a few pieces of knowledge for each query, our knowledge base is comprehensive, which is constructed based on a combination of all the available questions and their associated database schemas along with their relevant knowledge, and can be reused for unseen databases from different datasets and domains. We validate our approach on multiple text-to-SQL datasets, considering both the overlapping and non-overlapping database scenarios, where it outperforms relevant baselines substantially.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Text-to-SQL aims to transform natural language queries from users into Structured Query Language (SQL) statements, to interact with and retrieve the information from databases (Zelle and Mooney, 1996; Xu et al., 2017; Yaghmazadeh et al., 2017; Cai et al., 2018), as illustrated in Figure 1 (A). This task has recently gained much attention since it allows non-experts to access and manipulate database information without needing to understand complex database languages. In the meantime, Large
|
| 18 |
+
|
| 19 |
+
Language Models (LLMs) have shown impressive capabilities in processing and generating text and code, which have been further extended for text-to-SQL (Rajkumar et al., 2022; Gao et al., 2024).
|
| 20 |
+
|
| 21 |
+
Despite their huge successes, transforming user queries into SQL statements may still be challenging due to the need for specific domain knowledge and an understanding of the underlying database schemas, which poses a significant hurdle even for the most advanced LLMs to achieve high accuracy across diverse datasets (Li et al., 2023). For example, consider a scenario where the user asks for the query: "What is the WACC for Company X?" To accurately translate this into an SQL statement, the text-to-SQL model should understand the concept and calculation of Weighted Average Cost of Capital (WACC), which involves multiple factors including the cost of equity, cost of debt, and the respective proportions of each in the capital structure. In addition, the model needs to comprehend the specific schema of the financial database, where relevant data is distributed across multiple tables such as 'Equity', 'Debt', and 'Capital Structure'.
|
| 22 |
+
|
| 23 |
+
To tackle the aforementioned limitations due to the lack of the domain-specific knowledge for SQL generation, recent studies have proposed collecting and annotating explicit knowledge, which is then leveraged for SQL generation (Dou et al., 2022; Li et al., 2023). However, while these approaches substantially improve the performance of existing text-to-SQL models, they rely on extensive human annotations, which may be suboptimal (and nearly impractical) to conduct for all queries considering a diverse source of domain-specific knowledge from numerous databases. To address this issue, recent work proposes generating a few pieces of knowledge for each query based on the query itself and its relevant database schema (Hong et al., 2024) (see Figure 1 (B)). However, although this method demonstrates promise in automatic knowledge generation, certain knowledge required for one query
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: (A) Text-to-SQL aims to translate a user query into a SQL statement executable over a database, to access the desired information. (B) Existing Text-to-SQL with Knowledge Generation approaches first generate the knowledge relevant to the user query and then formulate the SQL statement with this generated knowledge. (C) Our Text-to-SQL with Knowledge Base Construction approach builds the repository of the knowledge and then reuses the knowledge within it across multiple queries and databases. (Right:) We observe that the knowledge in the training set of the text-to-SQL benchmark dataset (Li et al., 2023) covers $21\%$ of the knowledge required for test-time queries, and our constructed knowledge base further covers $50\%$ of them.
|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
|
| 30 |
+
can be directly reused or provide insights for multiple queries within the same database, as shown in Figure 1 (Right). Also, this knowledge can be generalizable to other queries for different databases.
|
| 31 |
+
|
| 32 |
+
Motivated by these observations, this work proposes an automatic approach to build a knowledge base, designed to serve as a comprehensive repository of domain-specific knowledge for text-to-SQL and capable of providing knowledge for multiple queries with the same database and even across the different databases. To construct this knowledge base, we generate knowledge entries based on available samples and their associated database schemas through LLM prompting, and then compile all of them together. During this prompting process, we provide LLMs with relevant examples to contextualize and guide the generation of useful knowledge in the right format that is further grounded in the database schema. Then, once constructed, the knowledge base allows for the retrieval of relevant knowledge for the given test-time query, which is then used alongside the query to formulate the SQL statement. Note that while ideally the knowledge base would cover all possible queries, it may not always do so. Nevertheless, the existing knowledge in it could still offer valuable insights for generating the required knowledge for new queries. Thus, by leveraging similar knowledge from the knowledge base, we further prompt LLMs to produce the most suitable knowledge for the query at inference time. We call our method Knowledge-Augmented Text-to-SQL (KAT-SQL), depicted in Figure 1 (C).
|
| 33 |
+
|
| 34 |
+
We experimentally validate the proposed KAT-SQL on two different text-to-SQL scenarios, involving both the overlapping and non-overlapping databases between training and test phases, showing that the proposed knowledge base construction-based text-to-SQL approach surpasses the exist
|
| 35 |
+
|
| 36 |
+
ing (knowledge-augmented) text-to-SQL baselines. We also assess the generalizability of our knowledge base constructed from one dataset by applying it to different datasets that lack any annotated knowledge, demonstrating that our knowledge base is versatile and can effectively improve SQL generation for even unseen databases from other datasets.
|
| 37 |
+
|
| 38 |
+
# 2 Related Work
|
| 39 |
+
|
| 40 |
+
LLM-Powered Text-to-SQL LLMs have shown remarkable performances across a wide range of tasks (OpenAI, 2023; Anil et al., 2023; AI@Meta, 2024), including text-to-SQL, due to their strong capability in understanding natural language and generating structured code (Rajkumar et al., 2022; Gao et al., 2024). Specifically, various studies have developed and advanced the prompting techniques for text-to-SQL, for example, using Chain-of-Thought (CoT) (Wei et al., 2022; Liu and Tan, 2023; Tai et al., 2023), investigating sophisticated prompt design strategies (Chang and Fosler-Lussier, 2023), and aggregating LLM-generated outputs from multiple prompts (Lee et al., 2024; Dong et al., 2023) akin to self-consistency (Wang et al., 2023b). In addition, another line of study proposes decomposing the text-to-SQL problem into multiple subtasks, and feeding the solutions of subtasks (from multiple models or agents) into the LLM to derive the final SQL statement (Gu et al., 2023; Pourreza and Rafiei, 2023; Wang et al., 2023a). The knowledge internalized in LLMs might however not be sufficient to handle diverse queries, which oftentimes requires grounding in the database schemas or additional domain-specific information for specialized domains, which gives rise to the need for leveraging external knowledge for text-to-SQL.
|
| 41 |
+
|
| 42 |
+
Knowledge-Augmented Text-to-SQL There are a few recent studies that propose augmenting text
|
| 43 |
+
|
| 44 |
+
to-SQL models with explicit knowledge. Specifically, Dou et al. (2022) collect formulaic knowledge (e.g., Trade Balance = Exports - Imports) available from public resources such as finance reports and store the collected knowledge into a knowledge bank with proper human-involved post-processing. The text-to-SQL model then retrieves relevant knowledge for any given query from the knowledge bank and uses it to convert the query into the SQL statement. In addition, Li et al. (2023) release a large-scale benchmark dataset for the text-to-SQL task, where each question is associated with specific knowledge that is manually annotated by humans. Manual annotation is however costly and time consuming, requiring effort and expertise on the part of domain-experts. To address this challenge, more recent work proposes automatically generating the knowledge based on the question and database schema, and utilizing this knowledge for text-to-SQL (Hong et al., 2024). In our work, instead of generating only a few pieces of knowledge for each question, we propose to construct a comprehensive knowledge base. This provides a repository of reusable knowledge that can be leveraged across multiple queries, which can be further adapted to various databases over different domains in a scalable way, in contrast to existing work.
|
| 45 |
+
|
| 46 |
+
Data Generation with LLMs The recent advent of LLMs has revolutionized the field of data generation, as they can produce vast amounts of high-quality samples without costly human annotation. Specifically, several efforts around LLM-based synthetic data generation, such as Self-Instruct (Wang et al., 2023c), Alpaca (Taori et al., 2023), EvolInstruct (Xu et al., 2023), Orca (Mukherjee et al., 2023), and InstructLab (Sudalairaj et al., 2024), propose generating a large number of samples from LLMs by prompting them. Also, motivated by the capabilities of LLMs in generating synthetic data and memorizing factual knowledge, some other work aims to populate an encyclopedic knowledge base like Wikidata (Vrandecic and Krötzsch, 2014) with LLMs (Alivanistos et al., 2022; Nayak and Timmapathini, 2023; Veseli et al., 2023). Most of the knowledge in such encyclopedic knowledge bases is however unsuitable for text-to-SQL since it is neither relevant to formulate SQL statements from user queries nor aware of database schemas necessary for the query conversion. Thus, unlike them, our approach stands apart as the first to automatically construct a text-to-SQL knowledge base.
|
| 47 |
+
|
| 48 |
+
# 3 Method
|
| 49 |
+
|
| 50 |
+
In this section, we present Knowledge-Augmented Text-to-SQL (KAT-SQL), an approach that automatically constructs a knowledge base and utilizes the relevant knowledge from it for text-to-SQL.
|
| 51 |
+
|
| 52 |
+
# 3.1 Problem Statement
|
| 53 |
+
|
| 54 |
+
We begin with formally explaining text-to-SQL and the knowledge augmentation technique for it.
|
| 55 |
+
|
| 56 |
+
Text-to-SQL Text-to-SQL aims to translate a natural language query from a user into a syntactically correct and semantically precise SQL statement. Formally, let $\mathbf{q}$ be the user query (consisting of a sequence of tokens) and $\mathcal{D}$ be the database schema containing multiple tables and columns. Then, the SQL generation model $f$ can be represented as follows: $s = f(\mathbf{q},\mathcal{D})$ where $s$ is the SQL statement (consisting of a sequence of tokens) that attempts to retrieve the information requested by $\mathbf{q}$ over $\mathcal{D}$ .
|
| 57 |
+
|
| 58 |
+
In this work, we operationalize $f$ with LLMs, to harness their strong capability in understanding the semantics of $q$ and generating the corresponding SQL code $s$ , as follows: $s = \mathsf{LLM}_{\theta}(\mathcal{T}(q,\mathcal{D}))$ where $\theta$ is the model parameters and $\mathcal{T}$ is the prompt template. Typically, the model parameters $\theta$ remain fixed due to the high costs associated with further fine-tuning of them and sometimes their limited accessibility. Also, the prompt template $\mathcal{T}$ serves as a structured format that outlines the context, which includes task descriptions and instructions as well as few-shot demonstrations, to guide the model in generating accurate SQL codes.
|
| 59 |
+
|
| 60 |
+
Notably, while there have been great successes in advancing the LLM itself and optimizing its usage for text-to-SQL, such as using advanced prompting techniques or breaking down the task into multiple subtasks (Wei et al., 2022; Liu and Tan, 2023; Tai et al., 2023; Gu et al., 2023; Pourreza and Rafiei, 2023; Wang et al., 2023a), these improvements alone may not be sufficient to fully handle queries that require the deep domain knowledge or precise understanding of complex database schemas. In other words, the internal parametric knowledge of LLMs, while robust, may not fully encompass the diverse range of query variations and database structures, especially when these databases have distinct schemas or certain specialized terminology.
|
| 61 |
+
|
| 62 |
+
Knowledge-Augmented Text-to-SQL To tackle the aforementioned limitations, we focus on augmenting text-to-SQL with the knowledge relevant
|
| 63 |
+
|
| 64 |
+
to the query, providing valuable insights into the domain-specific terminology and complex database schemas. If we denote this knowledge as $\pmb{k}$ , then the previous text-to-SQL process is redefined to incorporate it, as follows: $s = \mathsf{LLM}_{\theta}(\mathcal{T}(q,k,\mathcal{D}))$ .
|
| 65 |
+
|
| 66 |
+
While there have been few studies that explore this knowledge-augmented text-to-SQL paradigm, there are still a couple of challenges. Specifically, Dou et al. (2022) and Li et al. (2023) propose collecting and annotating the explicit knowledge required to convert queries into SQL statements. Yet, to operationalize, this annotation-based approach can be costly and time-consuming, especially when dealing with a large number of diverse queries. On the other hand, Hong et al. (2024) propose an automatic generation of knowledge, based on the question and its associated database schema. However, this method is still limiting as it generates only a few pieces of knowledge for each query without leveraging the potential for reuse. In contrast, since much of the knowledge used for one query can be applicable to multiple similar queries (See Figure 1, Right), we aim to design a more effective approach for knowledge augmentation, discussed below.
|
| 67 |
+
|
| 68 |
+
# 3.2 Knowledge Base Construction
|
| 69 |
+
|
| 70 |
+
To address the aforementioned limitations of existing approaches in knowledge augmentation for text-to-SQL, we propose a novel approach to automatically construct a comprehensive and reusable knowledge base. Ideally, this can serve as a foundational resource, encapsulating diverse domain information and offering insights into various database schemas, to enhance the understanding of queries and their associated database structures.
|
| 71 |
+
|
| 72 |
+
Formally, we design this knowledge base $\mathcal{K}$ as a collection of knowledge entries, each represented as a concise sentence, denoted as follows: $\pmb{k} \in \mathcal{K}$ . For instance, in the medical domain, one knowledge entry might be "Abnormal white blood cell count refers to WBC $\leq 3.5$ or WBC $\geq 9.0$ ", which describes the abnormal range of white blood cell counts and its corresponding column name "WBC" in the database schema, applicable to queries related to abnormal white blood cells. The next question to answer is then how to construct this knowledge base based on the available resources.
|
| 73 |
+
|
| 74 |
+
In this work, we start with collecting all the existing knowledge entries from the publicly available dataset (Li et al., 2023), which includes the knowledge and its related pair of query and database schema. Yet, while this initial collection can serve
|
| 75 |
+
|
| 76 |
+
as the foundational layer of our knowledge base, it may not capture the full scope of the required information. To address this gap, we propose an automatic knowledge base expansion technique that leverages LLMs, which possess domain-specific knowledge and the ability to comprehend the given context (including instructions, codes, and database structures) by generating additional knowledge entries. Specifically, given the query and its associated database schema from the available datasets, we prompt LLMs (along with a prompting template $\mathcal{T}$ for knowledge generation) to produce the knowledge, formulated as follows: $k = \mathsf{LLM}(\mathcal{T}(q,\mathcal{D}))$ , and then store this knowledge $k$ into the knowledge base $\mathcal{K}$ . In addition, as it may be more accurate and reliable to provide the LLM with relevant examples (which can help it understand the context, nuances, and expectations of the desired output), we further prepend the small number of relevant examples into the prompt of LLM. It is worth noting that these examples are comprised of the triplets of the user queries, their associated database schemas, and the knowledge they are derived from, and that those triplets come from the existing dataset (used to construct the initial knowledge base). Also, we select only those highly relevant to the query based on its embedding-level cosine similarities with samples from the existing dataset, calculated by MPNet (Song et al., 2020). This process can ultimately enable the LLM to generate more precise and contextually appropriate knowledge for text-to-SQL.
|
| 77 |
+
|
| 78 |
+
In addition to this relevant example-based knowledge generation approach, to further enrich the diversity and comprehensiveness of the knowledge base, we implement a simple yet effective strategy that involves sampling and permutation of few-shot examples provided to the LLM. Specifically, for the given query and its associated database schema, instead of generating their corresponding knowledge only once, we iteratively sample a different set of relevant examples (provided to contextualize the LLM) multiple times and further permute their order. This can allow the LLM to explore different contextual nuances and generate a wider range of knowledge entries, with the goal of ultimately increasing the robustness and applicability of the knowledge base for a broader range of queries.
|
| 79 |
+
|
| 80 |
+
# 3.3 Text-to-SQL with Knowledge Base
|
| 81 |
+
|
| 82 |
+
Based on the LLM-powered knowledge base construction process, we now have the knowledge base $\mathcal{K}$ . Hereafter, the next question to answer is then
|
| 83 |
+
|
| 84 |
+
# Algorithm 1 Knowledge-Augmented Text-to-SQL
|
| 85 |
+
|
| 86 |
+
Require: Dataset $D$ containing query-schema pairs $(\mathbf{q},\mathcal{D})$ ; LLM model LLM; Prompt templates $\mathcal{T}$
|
| 87 |
+
|
| 88 |
+
Ensure: SQL statement $s$ for a given query $q$
|
| 89 |
+
|
| 90 |
+
1: Phase 1: Knowledge Base Construction
|
| 91 |
+
2: $\mathcal{K}\gets \{\} \cup D$ ▷ Initialize knowledge base
|
| 92 |
+
3: for all $(\mathbf{q},\mathcal{D})\in D$ do
|
| 93 |
+
4: $\mathcal{E} \gets$ Retrieve top- $k$ relevant examples from $D$
|
| 94 |
+
5: $k_{\mathrm{new}} \gets \mathsf{LLM}(\mathcal{T}_{\mathrm{gen}}(\boldsymbol{q},\mathcal{D},\mathcal{E}))$ ▷ Generate knowledge
|
| 95 |
+
6: $\mathcal{K}\gets \mathcal{K}\cup \pmb{k}_{\mathrm{new}}$ Store knowledge
|
| 96 |
+
7: end for
|
| 97 |
+
8: Phase 2: Knowledge-Augmented SQL Generation
|
| 98 |
+
9: function KAT-SQL(q, $\mathcal{D},\mathcal{K}$
|
| 99 |
+
10: $\{\pmb {k}_i\}_{i = 1}^j\gets$ Retrieve top- $j$ knowledge from $\mathcal{K}$
|
| 100 |
+
11: $\pmb{k}^{\prime} \gets \mathsf{LLM}(\mathcal{T}_{\mathrm{ref}}(\pmb{q}, \{\pmb{k}_i\}_{i=1}^{j}, \mathcal{D})) \triangleright$ Refine knowledge
|
| 101 |
+
12: $s\gets \mathsf{LLM}(\mathcal{T}_{\mathrm{text - to - SQL}}(\boldsymbol {q},\boldsymbol{k}^{\prime},\mathcal{D}))$ Generate SQL
|
| 102 |
+
13: return s
|
| 103 |
+
14: end function
|
| 104 |
+
|
| 105 |
+
Figure 2: A simplified overview of the proposed KAT-SQL method. Please see Algorithms 2 and 3 for detailed versions.
|
| 106 |
+
|
| 107 |
+
how to use this knowledge base for text-to-SQL.
|
| 108 |
+
|
| 109 |
+
Given the extensive nature of $\mathcal{K}$ , containing a large number of entries, it is crucial to identify and retrieve the most pertinent entries for the query $q$ . Formally, this process can be represented as follows: $\{\pmb{k}_i\}_{i=1}^j = \text{Retriever}(\pmb{q}, \mathcal{K})$ . Also, this can be operationalized by calculating the embedding-level similarities between the query and all the knowledge entries in the knowledge base, then selecting the top- $j$ similar entries $\{\pmb{k}_i\}_{i=1}^j$ , where embeddings are obtained from a sentence embedding model (Karpukhin et al., 2020; Song et al., 2020). Moreover, to further enhance the retrieval accuracy, we train this embedding model with contrastive learning, which maximizes the similarity between the query and its relevant knowledge while minimizing the similarities of others, denoted as follows: $-\log \frac{\exp(\sin(\pmb{q}, \pmb{k}^+) / \tau)}{\exp(\sin(\pmb{q}, \pmb{k}^+) / \tau) + \sum_{k^-} \exp(\sin(\pmb{q}, \pmb{k}^-) / \tau)}$ , where $\sin(\pmb{q}, \pmb{k})$ denotes the similarity measure between query $q$ and knowledge $k$ , $\tau$ is the temperature parameter, $k^+$ is the relevant knowledge, and $k^-$ represents the set of irrelevant knowledge.
|
| 110 |
+
|
| 111 |
+
Note that while the retrieved knowledge entries from $\kappa$ are relevant to the given query and can assist in SQL statement formulation, they may require additional refinement to perfectly align with the query's specific needs. For instance, if the user query pertains to abnormal data conditions, but the retrieved knowledge primarily focuses on normal data, a direct application of this knowledge could lead to inaccurate SQL generation. To address this issue, we further prompt the LLM to generate the knowledge tailored to the given query by considering its relevant knowledge entries and database
|
| 112 |
+
|
| 113 |
+
schema, as follows: $k' = \mathsf{LLM}(\mathcal{T}(\pmb{q},\{\pmb{k}_i\}_{i=1}^j,\mathcal{D}))$ , where $\{\pmb{k}_i\}_{i=1}^j$ is the knowledge retrieved from $\mathcal{K}$ . This refined knowledge $k'$ is subsequently used as input, along with the user query and its associated database schema, to guide the text-to-SQL LLM in generating a more accurate and contextually appropriate SQL statement: $s = \mathsf{LLM}(\mathcal{T}(\pmb{q},\pmb{k}',\mathcal{D}))$ . Please see Algorithm 1 for our overall approach.
|
| 114 |
+
|
| 115 |
+
# 4 Experimental Setup
|
| 116 |
+
|
| 117 |
+
# 4.1 Datasets and Tasks
|
| 118 |
+
|
| 119 |
+
Datasets To validate the efficacy of KAT-SQL, we first use two widely used text-to-SQL benchmark datasets, namely BIRD (Li et al., 2023) and Spider (Yu et al., 2018). Specifically, BIRD is a recently released large-scale text-to-SQL dataset, built on top of 95 distinct databases spanning 37 domains. Additionally, each query in this dataset is associated with knowledge that is manually annotated by humans, providing a useful prior for formulating SQL statements. Spider is another benchmark dataset, built upon 200 databases across 138 domains. Unlike BIRD, samples in Spider do not have annotated knowledge for text-to-SQL. Lastly, we consider a challenging real-world text-to-SQL data, namely CSTINSIGHT, which is designed with actual customer queries over a data lakehouse with 34 tables without human-annotated knowledge.
|
| 120 |
+
|
| 121 |
+
Tasks/Scenarios We evaluate our KAT-SQL on three realistic text-to-SQL tasks. First of all, we consider the scenario where the prior information about some samples and their associated knowledge for each database is available, meaning that the databases used in training samples overlap with those in test samples (Overlap). We note that this setting is practical, since annotating a few pairs of questions and their corresponding knowledge for each database in advance is feasible. In addition to this, we test KAT-SQL with the existing benchmark setup, which is more challenging since it assumes there are no overlaps between databases during the training and test phases (Non-Overlap). In other words, no samples from the test-time databases are available beforehand, which means the model should be able to generalize to test-time queries based on the schemas of test-time databases as well as the samples and their associated knowledge from the different (training-time) databases. Lastly, we validate KAT-SQL on the most challenging scenario, where there are no overlaps between the
|
| 122 |
+
|
| 123 |
+
Table 1: Main results on text-to-SQL benchmark datasets across multiple scenarios, with the best results in bold.
|
| 124 |
+
|
| 125 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">BIRD (Overlap)</td><td colspan="2">BIRD (Non-Overlap)</td><td colspan="2">Spider</td><td colspan="2">CSTINSIGHT</td></tr><tr><td>EX</td><td>VES</td><td>EX</td><td>VES</td><td>EX</td><td>VES</td><td>EX</td><td>VES</td></tr><tr><td>No Knowledge</td><td>23.76</td><td>28.81</td><td>20.66</td><td>16.72</td><td>70.99</td><td>37.53</td><td>4.76</td><td>5.28</td></tr><tr><td>DELLM</td><td>34.70</td><td>33.15</td><td>24.64</td><td>19.27</td><td>72.44</td><td>42.90</td><td>11.90</td><td>12.02</td></tr><tr><td>KAT-SQL (Ours)</td><td>41.18</td><td>41.33</td><td>41.07</td><td>31.14</td><td>74.56</td><td>47.20</td><td>14.29</td><td>14.50</td></tr><tr><td>Oracle Knowledge</td><td>54.67</td><td>49.71</td><td>49.41</td><td>37.93</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr></table>
|
| 126 |
+
|
| 127 |
+
databases used during training and testing, but also no knowledge is available for both training and test samples. This setup aims to test the model's ability to generalize (in the absence of any prior knowledge about the dataset), allowing us to evaluate how well our knowledge base constructed with one dataset performs on different datasets. Notably, since the Spider and CSTINSIGHT datasets have no available knowledge for all queries, we use them for the most challenging last scenario; meanwhile, we use the BIRD dataset for the first two scenarios.
|
| 128 |
+
|
| 129 |
+
# 4.2 Baselines and Our Model
|
| 130 |
+
|
| 131 |
+
We compare our KAT-SQL approach against relevant baselines that target our primary objective of improving knowledge-augmented text-to-SQL systems, which vary in their usage of knowledge. We note that for the fairest comparison, we fix the LLM as the same for all methods, explained as follows: 1. No Knowledge - which uses only the queries themselves to formulate the SQL statements without any additional knowledge. 2. DELLM - which generates the knowledge based on the query and its relevant database structures, and use this synthesized knowledge for text-to-SQL (Hong et al., 2024). 3. KAT-SQL - which is our model, building the knowledge base and utilizing the knowledge from it (with retrieval) for text-to-SQL. 4. Oracle Knowledge - which uses oracle knowledge annotated by humans, along with the queries to generate the SQL statements. This approach serves as an upper bound and is not directly comparable to other models due to its reliance on accurate, manually curated knowledge that is typically unavailable.
|
| 132 |
+
|
| 133 |
+
# 4.3 Evaluation Metrics
|
| 134 |
+
|
| 135 |
+
Following the standard evaluation protocols from prior work (Li et al., 2023; Hong et al., 2024), we use the following two metrics: 1) Execution Accuracy (EX), which measures the ratio of generated SQL code that has the same execution results with ground-truth SQL code; 2) Valid Efficiency Score (VES), which considers the efficiency of generated
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 3: Results for coverage and relevance of knowledge entries in the constructed knowledge base against gold knowledge, with different numbers of knowledge generation steps.
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
|
| 142 |
+
SQLs by weighting them based on their relative efficiency improvement over ground-truth SQLs further multiplied by execution accuracy.
|
| 143 |
+
|
| 144 |
+
# 4.4 Implementation Details
|
| 145 |
+
|
| 146 |
+
We mainly use Llama-3 70B (AI@Meta, 2024) as the basis for text-to-SQL generation and knowledge generation across all baselines and our model variants for most experiments, for a fair comparison, while we also experiment with other LLMs in an analysis (Table 6) to see the robustness of KAT-SQL. For the hyperparameters, except for the temperature (which we set as 0.0 for reproducibility), we use its default values. In addition, for the retriever, we use MPNet (Song et al., 2020), which is based on dense retrieval; we train it with a batch size of 128 and a number of training epochs of 30. We provide the detailed prompts used to elicit the knowledge and SQL generations in Appendix A.
|
| 147 |
+
|
| 148 |
+
# 5 Experimental Results and Analyses
|
| 149 |
+
|
| 150 |
+
Main Results We provide main results in Table 1, which confirms that our KAT-SQL approach consistently outperforms all baselines by large margins. Specifically, while we observe some performance improvement of the knowledge-augmented text-to-SQL approach (namely DELLM, which generates a few pieces of knowledge for each query) over the baseline without knowledge augmentation, KAT-SQL achieves even greater gains, demonstrating the effectiveness of our knowledge base construction-based text-to-SQL paradigm. However, the performance of the (incomparable) model with the oracle knowledge (annotated by human experts) remains
|
| 151 |
+
|
| 152 |
+
Table 2: Results for knowledge generation with and without the use of the Knowledge Base (KB), while varying the prompt construction with and without the relevant few-shot examples.
|
| 153 |
+
|
| 154 |
+
<table><tr><td></td><td></td><td colspan="2">Overlap</td><td colspan="2">Non-Overlap</td></tr><tr><td>KB</td><td>Few-Shot</td><td>EM</td><td>SS</td><td>EM</td><td>SS</td></tr><tr><td rowspan="2">w/o KB</td><td>Random</td><td>10.96</td><td>68.77</td><td>7.88</td><td>66.77</td></tr><tr><td>Retrieval</td><td>20.21</td><td>73.62</td><td>9.24</td><td>68.78</td></tr><tr><td rowspan="2">w/ KB</td><td>Random</td><td>11.13</td><td>69.14</td><td>7.93</td><td>66.80</td></tr><tr><td>Retrieval</td><td>24.97</td><td>77.87</td><td>12.94</td><td>71.24</td></tr></table>
|
| 155 |
+
|
| 156 |
+
superior to all other approaches, which suggests potential future opportunities for developing a more advanced pipeline for knowledge generation.
|
| 157 |
+
|
| 158 |
+
Analysis on Knowledge Base To further understand the coverage and relevance of the knowledge within our knowledge base, we compare each piece of knowledge required for test-time queries with all the available entries in the knowledge base, as a function of the number of knowledge generation steps during knowledge base construction. For evaluation, we use two metrics: Exact Match, which identifies whether the knowledge base contains an entry that precisely matches the knowledge required for a given query, and Semantic Similarity, which assesses how closely related the most similar entry (in the knowledge base) is to the required knowledge based on the embedding-level similarity. As shown in Figure 3, we observe that, under the Overlap setting, half of the knowledge entries needed for test-time queries are available in the knowledge base while the Semantic Similarity is around $90\%$ , which demonstrates substantial coverage by our knowledge base. In addition, for the challenging setup where training and test databases are distinct, we still observe that $20\%$ of the test-time knowledge entries are available in the knowledge base and that the Semantic Similarity exceeds $80\%$ , showing the utility of our knowledge base. Finally, as we increase the number of knowledge generation steps for each instance during knowledge base construction, we observe a corresponding improvement in both coverage and relevance of our knowledge base, which supports the effectiveness of our expansion strategy to enrich its diversity.
|
| 159 |
+
|
| 160 |
+
Analysis on Knowledge Generation Recall that we further refine the retrieved knowledge to make it more suitable for each query, in addition to constructing the knowledge base and retrieving the relevant knowledge. Thus, to see how relevant the generated knowledge is to the human-annotated gold knowledge with regards to the use of our knowledge base, we report comparison results according
|
| 161 |
+
|
| 162 |
+
Table 3: Text-to-SQL results without using any knowledge, based on the retrieved knowledge, and based on the refined knowledge from the retrieved knowledge (Our KAT-SQL).
|
| 163 |
+
|
| 164 |
+
<table><tr><td>Settings</td><td>Models</td><td>EX</td></tr><tr><td rowspan="3">Overlap</td><td>KAT-SQL (Ours)</td><td>41.18</td></tr><tr><td>w/o Generation</td><td>38.94</td></tr><tr><td>w/o Retrieval & Generation</td><td>23.76</td></tr><tr><td rowspan="3">Non-Overlap</td><td>KAT-SQL (Ours)</td><td>41.07</td></tr><tr><td>w/o Generation</td><td>38.42</td></tr><tr><td>w/o Retrieval & Generation</td><td>20.66</td></tr></table>
|
| 165 |
+
|
| 166 |
+
Table 4: Retrieval results with different scenarios and models.
|
| 167 |
+
|
| 168 |
+
<table><tr><td>Settings</td><td>Models</td><td>MRR</td><td>Top@3</td><td>Top@10</td></tr><tr><td rowspan="3">Overlap</td><td>BERT</td><td>0.5506</td><td>0.6621</td><td>0.8911</td></tr><tr><td>TAS-B</td><td>0.5630</td><td>0.6943</td><td>0.9035</td></tr><tr><td>TAS-B*</td><td>0.8288</td><td>0.9143</td><td>0.9765</td></tr><tr><td rowspan="3">Non-Overlap</td><td>BERT</td><td>0.2148</td><td>0.2692</td><td>0.4231</td></tr><tr><td>TAS-B</td><td>0.2364</td><td>0.3846</td><td>0.4615</td></tr><tr><td>TAS-B*</td><td>0.7565</td><td>0.8347</td><td>0.9210</td></tr></table>
|
| 169 |
+
|
| 170 |
+
to Exact Match and Semantic Similarity (SS) in Table 2. We observe that when we retrieve the relevant knowledge from the knowledge base and then use it for knowledge generation, there are performance gains over the case where we do not leverage it, which indicates that the retrieved knowledge is helpful in formulating the necessary knowledge for test-time queries. We also provide few-shot examples to guide the knowledge generation model in generating useful knowledge in the right format, and when we select them based on their similarities with the given query, we observe further gains in the quality of the generated knowledge.
|
| 171 |
+
|
| 172 |
+
Beyond evaluating the quality of the generated knowledge by comparing it to the human-annotated gold knowledge, we also examine the impact of knowledge generation on downstream text-to-SQL performance with and without the incorporation of generated knowledge. As shown in Table 3, compared to the results without the knowledge retrieval and generation on both Overlap and Non-Overlap settings, there are substantial improvements when we incorporate the retrieved knowledge from our knowledge base into the text-to-SQL generation process. Furthermore, instead of directly using the retrieved knowledge, refining this retrieved knowledge yields additional improvements, underscoring the importance of not only retrieving relevant knowledge but also tailoring it to better align with the specific needs of test-time queries.
|
| 173 |
+
|
| 174 |
+
Retrieval Analysis We also analyze the accuracy of knowledge retrieval from our knowledge base by reporting its retrieval performance in Table 4 according to Mean Reciprocal Rank (MRR) and
|
| 175 |
+
|
| 176 |
+
Table 5: Breakdown text-to-SQL results into overlapping and non-overlapping domain settings between training (knowledge base construction) and test (text-to-SQL evaluation) databases.
|
| 177 |
+
|
| 178 |
+
<table><tr><td>Models</td><td>Overlap</td><td>Non-Overlap</td></tr><tr><td>No Knowledge</td><td>22.85</td><td>16.20</td></tr><tr><td>DELLM</td><td>27.20</td><td>19.43</td></tr><tr><td>KAT-SQL (Ours)</td><td>49.37</td><td>24.19</td></tr></table>
|
| 179 |
+
|
| 180 |
+
Top@K Accuracy. We observe that the retrieval accuracy on the Overlap setting is higher than that on the Non-Overlap setting, due to the less availability of relevant knowledge required for test-time queries in the Non-Overlap setting. Yet, when we replace the knowledge base constructed from our approach with the Oracle knowledge base $(\ast)$ , which includes all the necessary knowledge for test-time queries, the MRR on both settings reaches around $80\%$ , indicating the importance of expanding the coverage of the knowledge base for accurate knowledge retrieval. The table also compares the performance of different basis models for retrieval - BERT (Devlin et al., 2019) and TAS-B (Hofstätter et al., 2021) - with the latter being fine-tuned for retrieval. It can be seen that the extra training of the model on retrieval tasks aids in achieving superior performance for retrieving the knowledge for text-to-SQL.
|
| 181 |
+
|
| 182 |
+
# Generalization Analysis to Different Domains
|
| 183 |
+
|
| 184 |
+
To see whether our knowledge base can be generalizable to databases of different domains (that are not overlapped with those for knowledge base construction), we breakdown the performance based on whether test databases share domains with training databases or belong to different domains (according to 37 domains categorized from Li et al. (2023)). As shown in Table 5, our KAT-SQL achieves substantially higher performance when test databases overlap with training domains compared to those from unseen domains; however, even in the latter case, KAT-SQL still outperforms existing baselines. These results indicate that, while the lack of domain overlaps degrades the performance, our knowledge base still provides meaningful benefits for unseen domains, demonstrating its generalizability.
|
| 185 |
+
|
| 186 |
+
Analysis with Different LLMs To evaluate how robust our KAT-SAL approach is across different LLMs, we conduct the additional analysis instantiating the text-to-SQL and knowledge generation models with other recent LLMs such as Granite 34B (Mishra et al., 2024) and Mixtral 8x7B (Jiang et al., 2024); results are shown in Table 6. From this, we observe that KAT-SQL consistently out
|
| 187 |
+
|
| 188 |
+
Table 6: Text to SQL results with different LLMs.
|
| 189 |
+
|
| 190 |
+
<table><tr><td>LLMs</td><td>Methods</td><td>Overlap</td><td>Non-Overlap</td></tr><tr><td rowspan="4">Llama</td><td>No Knowledge</td><td>23.76</td><td>20.66</td></tr><tr><td>DELLM</td><td>34.70</td><td>24.64</td></tr><tr><td>KAT-SQL</td><td>41.18</td><td>41.07</td></tr><tr><td>Oracle Knowledge</td><td>54.67</td><td>49.41</td></tr><tr><td rowspan="4">Granite</td><td>No Knowledge</td><td>25.83</td><td>17.75</td></tr><tr><td>DELLM</td><td>34.04</td><td>20.21</td></tr><tr><td>KAT-SQL</td><td>39.28</td><td>35.83</td></tr><tr><td>Oracle Knowledge</td><td>46.56</td><td>38.32</td></tr><tr><td rowspan="4">Mixtral</td><td>No Knowledge</td><td>11.75</td><td>10.58</td></tr><tr><td>DELLM</td><td>27.17</td><td>11.29</td></tr><tr><td>KAT-SQL</td><td>29.31</td><td>20.30</td></tr><tr><td>Oracle Knowledge</td><td>37.26</td><td>30.88</td></tr></table>
|
| 191 |
+
|
| 192 |
+
Table 7: Results of our KAT-SQL approach with the state-of-the-art text-to-SQL model on the BIRD leaderboard.
|
| 193 |
+
|
| 194 |
+
<table><tr><td>Models</td><td>EX</td></tr><tr><td>ChatGPT</td><td>24.05</td></tr><tr><td>ChatGPT + CoT</td><td>25.88</td></tr><tr><td>ExSL + granite-20b-code</td><td>51.69</td></tr><tr><td>ExSL + granite-20b-code w/ KAT-SQL (Ours)</td><td>57.56</td></tr><tr><td>ExSL + granite-20b-code w/ Oracle Knowledge</td><td>65.38</td></tr></table>
|
| 195 |
+
|
| 196 |
+
performs all baselines regardless of the choice of LLMs, which demonstrates the effectiveness and versatility of our proposed approach.
|
| 197 |
+
|
| 198 |
+
Finally, we augment the state-of-the-art text-to-SQL model (in the setting without oracle knowledge) on the BIRD leaderboard (Li et al., 2023), namely ExSL + granite-20b-code, using the knowledge generated from our proposed knowledge base construction-based approach. As shown in Table 7, we observe that the text-to-SQL model combined with our KAT-SQL approach establishes the new state-of-the-art performance, highlighting the value of our method as a powerful tool for text-to-SQL.
|
| 199 |
+
|
| 200 |
+
Analysis on Efficiency While our primary focus is on improving the text-to-SQL accuracy through knowledge base construction and augmentation, we also consider the efficiency of our approach. It is worth noting that the construction of the knowledge base is performed offline and does not affect real-time query processing; therefore, the extra computational overhead comes from retrieving relevant knowledge and generating the SQL statement in response to the query. In this regard, our retrieval process accounts for only $2\%$ of the overall generation time, thanks to efficient search algorithm (Douze et al., 2024), making its impact negligible. Also, although incorporating knowledge into the text-to-SQL pipeline increases the prompt length by $30\%$ , this overhead aligns with other knowledge augmentation methods (such as DELLM) and does not introduce additional latency specific to our approach. Overall, each query is processed under 5 seconds.
|
| 201 |
+
|
| 202 |
+
Table 8: Case study of knowledge and SQL generation results from three queries.
|
| 203 |
+
|
| 204 |
+
<table><tr><td>Example</td><td>Query</td><td>Generated Knowledge and SQL</td></tr><tr><td>Example 1</td><td>Which position has a lower minimum salary, Account Representative or Trainee?</td><td>Generated Knowledge:
|
| 205 |
+
1) lower minimum salary refers to MIN(minsalary)
|
| 206 |
+
2) Account Representative and Trainee are position titles
|
| 207 |
+
Generated SQL:
|
| 208 |
+
SELECT positiontitle FROM position WHERE positiontitle = 'Account Representative' OR positiontitle = 'Trainee' ORDER BY minsalary ASC LIMIT 1</td></tr><tr><td>Example 2</td><td>Among the employees working at the office in New York, how many of them have a good job performance?</td><td>Generated Knowledge:
|
| 209 |
+
1) New York refers to state = 'NY'
|
| 210 |
+
2) good job performance refers to performance = 'Good'
|
| 211 |
+
Generated SQL:
|
| 212 |
+
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1_performance = 'Good'</td></tr><tr><td>Example 3</td><td>For all patients born in 1982, state if their albumin is within normal range.</td><td>Generated Knowledge:
|
| 213 |
+
1) albumin is within normal range refers to ALB between 3.5 and 5.5
|
| 214 |
+
Generated SQL:
|
| 215 |
+
SELECT CASE WHEN T2.ALB >= 3.5 AND T2.ALB <= 5.5 THEN 'normal' ELSE 'abnormal' END FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T1.Birthday) = '1982'</td></tr></table>
|
| 216 |
+
|
| 217 |
+
Table 9: Examples of original and its (similar) constructed knowledge within the knowledge base.
|
| 218 |
+
|
| 219 |
+
<table><tr><td>Example</td><td>Original Knowledge</td><td>Constructed Similar Knowledge</td></tr><tr><td>Example 1</td><td>albumin is within normal range refers to ALB between 3.5 and 5.5</td><td>1) albumin is outside the normal range refers to ALB less than 3.5 or greater than 5.5
|
| 220 |
+
2) glucose is within normal range refers to GLU between 70 and 100 mg/dL
|
| 221 |
+
3) Hemoglobin (Hb) is considered normal for males if levels range from 13.5 to 17.5 g/dL</td></tr><tr><td>Example 2</td><td>Eligible free rate for K-12 = Free Meal Count (K-12) / Enrollment (K-12)</td><td>1) Eligible reduced-price rate for K-12 = Reduced-Price Meal Count (K-12) / Enrollment (K-12)
|
| 222 |
+
2) Eligible free meal rate for students aged 5-17 = Free Meal Count (Ages 5-17) / Enrollment (Ages 5-17)
|
| 223 |
+
3) Difference between K-12 and ages 5-17 enrollment = Enrollment (K-12) - Enrollment (Ages 5-17)</td></tr><tr><td>Example 3</td><td>Slovakia can be represented as Country = 'SVK'</td><td>1) France can be represented as Country = 'FRA'
|
| 224 |
+
2) Brazil can be represented as Country = 'BRA'
|
| 225 |
+
3) Monaco can be represented as Country = 'MCO'</td></tr></table>
|
| 226 |
+
|
| 227 |
+
Examples We provide examples for the knowledge generation and text-to-SQL in Table 8 as well as the entries in the knowledge base in Table 9.
|
| 228 |
+
|
| 229 |
+
# 6 Conclusion
|
| 230 |
+
|
| 231 |
+
In this work, we proposed a novel knowledge base construction-based text-to-SQL approach called KAT-SQL, based on the motivation that one piece of knowledge can be reused across multiple queries and databases. Our approach involves the creation of the knowledge base from which relevant knowledge is retrieved and utilized to generate SQL statements from queries. Through extensive evaluations on multiple datasets with two different scenarios, we showed that our KAT-SQL outperforms relevant knowledge-augmented text-to-SQL baselines. In addition, our detailed analyses highlight the effectiveness of each component in the knowledge generation and retrieval processes, but also the high coverage and relevance of the entries in the base.
|
| 232 |
+
|
| 233 |
+
# Limitations
|
| 234 |
+
|
| 235 |
+
In this work, we propose constructing a knowledge base and then leveraging it for text-to-SQL tasks,
|
| 236 |
+
|
| 237 |
+
showcasing the clear advantages of constructing the knowledge base for text-to-SQL. However, as the performance gaps between the models with oracle knowledge and the generated knowledge from our knowledge base indicate, there is still room to improve the coverage of the knowledge base with advanced knowledge base construction methods, which is a promising area for future work.
|
| 238 |
+
|
| 239 |
+
# Ethics Statement
|
| 240 |
+
|
| 241 |
+
We recognize that any text-to-SQL system, including our proposed approach, may carry the inherent risk of generating SQL queries that may inadvertently or intentionally access, modify, or delete sensitive information within a database. While this vulnerability is not exclusive to our method and is a well-known challenge in the broader field of text-to-SQL systems, it underscores the importance of implementing robust security measures and access controls before deploying such systems. Similar to this, safety is particularly crucial in our application, so as to avoid the risk of sensitive information being stored in the knowledge base and subsequently being inappropriately reused.
|
| 242 |
+
|
| 243 |
+
# References
|
| 244 |
+
|
| 245 |
+
AI@Meta. 2024. Llama 3 model card.
|
| 246 |
+
|
| 247 |
+
Dimitrios Alivanistos, Selene Baez Santamaría, Michael Cochez, Jan-Christoph Kalo, Emile van Krieken, and Thiviyan Thanapalasingam. 2022. Prompting as probing: Using language models for knowledge base construction. In Proceedings of the Semantic Web Challenge on Knowledge Base Construction from Pre-trained Language Models 2022 co-located with the 21st International Semantic Web Conference (ISWC2022), Virtual Event, Hangzhou, China, October 2022, volume 3274 of CEUR Workshop Proceedings, pages 11-34. CEUR-WS.org.
|
| 248 |
+
Rohan Anil, Sebastian Borgeaud, Yonghui Wu, JeanBaptiste Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M. Dai, Anja Hauth, Katie Millican, David Silver, Slav Petrov, Melvin Johnson, Ioannis Antonoglou, Julian Schrittwieser, Amelia Glaese, Jilin Chen, Emily Pitler, Timothy P. Lillicrap, Angeliki Lazaridou, Orhan Firat, James Molloy, Michael Isard, Paul Ronald Barham, Tom Hennigan, Benjamin Lee, Fabio Viola, Malcolm Reynolds, Yuanzhong Xu, Ryan Doherty, Eli Collins, Clemens Meyer, Eliza Rutherford, Erica Moreira, Kareem Ayoub, Megha Goel, George Tucker, Enrique Piqueras, Maxim Krikun, Iain Barr, Nikolay Savinov, Ivo Danihelka, Becca Roelofs, Anaïs White, Anders Andreassen, Tamara von Glehn, Lakshman Yagati, Mehran Kazemi, Lucas Gonzalez, Misha Khalman, Jakub Sygnowski, and et al. 2023. Gemini: A family of highly capable multimodal models. arXiv preprint arXiv:2312.11805.
|
| 249 |
+
Ruichu Cai, Boyan Xu, Zhenjie Zhang, Xiaoyan Yang, Zijian Li, and Zhihao Liang. 2018. An encoder-decoder framework translating natural language to database queries. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI 2018, July 13-19, 2018, Stockholm, Sweden, pages 3977-3983. ijcai.org.
|
| 250 |
+
Shuaichen Chang and Eric Fosler-Lussier. 2023. How to prompt llms for text-to-sql: A study in zero-shot, single-domain, and cross-domain settings. arXiv preprint arXiv:2305.11853.
|
| 251 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171-4186. Association for Computational Linguistics.
|
| 252 |
+
Xuemei Dong, Chao Zhang, Yuhang Ge, Yuren Mao, Yunjun Gao, Lu Chen, Jinshu Lin, and Dongfang Lou. 2023. C3: zero-shot text-to-sql with chatgpt. arXiv preprint arXiv:2307.07306.
|
| 253 |
+
|
| 254 |
+
Longxu Dou, Yan Gao, Xuqi Liu, Mingyang Pan, Dingzirui Wang, Wanxiang Che, Dechen Zhan, MinYen Kan, and Jian-Guang Lou. 2022. Towards knowledge-intensive text-to-sql semantic parsing with formulaic knowledge. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 5240-5253. Association for Computational Linguistics.
|
| 255 |
+
Matthijs Douze, Alexandr Guzhva, Chengqi Deng, Jeff Johnson, Gergely Szilvasy, Pierre-Emmanuel Mazaré, Maria Lomeli, Lucas Hosseini, and Hervé Jégou. 2024. The faiss library. arXiv preprint arXiv:2401.08281.
|
| 256 |
+
Dawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun, Yichen Qian, Bolin Ding, and Jingren Zhou. 2024. Text-to-sql empowered by large language models: A benchmark evaluation. Proc. VLDB Endow., 17(5):1132-1145.
|
| 257 |
+
Zihui Gu, Ju Fan, Nan Tang, Lei Cao, Bowen Jia, Sam Madden, and Xiaoyong Du. 2023. Few-shot text-tosql translation using structure and content prompt learning. Proc. ACM Manag. Data, 1(2):147:1-147:28.
|
| 258 |
+
Sebastian Hofstätter, Sheng-Chieh Lin, Jheng-Hong Yang, Jimmy Lin, and Allan Hanbury. 2021. Efficiently teaching an effective dense retriever with balanced topic aware sampling. In SIGIR '21: The 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, Virtual Event, Canada, July 11-15, 2021, pages 113-122. ACM.
|
| 259 |
+
Zijin Hong, Zheng Yuan, Hao Chen, Qinggang Zhang, Feiran Huang, and Xiao Huang. 2024. Knowledge-to-sql: Enhancing SQL generation with data expert LLM. arXiv preprint arXiv:2402.11517.
|
| 260 |
+
Albert Q. Jiang, Alexandre Sablayrolles, Antoine Roux, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de Las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Sandeep Subramanian, Sophia Yang, Szymon Antoniak, Teven Le Scao, Théophile Gervet, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. 2024. Mixtral of experts. arXiv preprint arXiv:2401.04088.
|
| 261 |
+
Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick S. H. Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pages 6769-6781. Association for Computational Linguistics.
|
| 262 |
+
Dongjun Lee, Choongwon Park, Jaehyuk Kim, and Heesoo Park. 2024. MCS-SQL: leveraging multiple
|
| 263 |
+
|
| 264 |
+
prompts and multiple-choice selection for text-to-sql generation. arXiv preprint arXiv:2405.07467.
|
| 265 |
+
Jinyang Li, Binyuan Hui, Ge Qu, Jiaxi Yang, Binhua Li, Bowen Li, Bailin Wang, Bowen Qin, Ruiying Geng, Nan Huo, Xuanhe Zhou, Chenhao Ma, Guoliang Li, Kevin Chen-Chuan Chang, Fei Huang, Reynold Cheng, and Yongbin Li. 2023. Can LLM already serve as A database interface? A big bench for large-scale database grounded text-to-sqls. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.
|
| 266 |
+
Xiping Liu and Zhao Tan. 2023. Divide and prompt: Chain of thought prompting for text-to-sql. arXiv preprint arXiv:2304.11556.
|
| 267 |
+
Mayank Mishra, Matt Stallone, Gaoyuan Zhang, Yikang Shen, Aditya Prasad, Adriana Meza Soria, Michele Merler, Parameswaran Selvam, Saptha Surendran, Shivdeep Singh, Manish Sethi, Xuan-Hong Dang, Pengyuan Li, Kun-Lung Wu, Syed Zawad, Andrew Coleman, Matthew White, Mark Lewis, Raju Pavuluri, Yan Koyfman, Boris Lublinsky, Maximilien de Bayser, Ibrahim Abdelaziz, Kinjal Basu, Mayank Agarwal, Yi Zhou, Chris Johnson, Aanchal Goyal, Hima Patel, S. Yousaf Shah, Petros Zerfos, Heiko Ludwig, Asim Munawar, Maxwell Crouse, Pavan Kapanipathi, Shweta Salaria, Bob Calio, Sophia Wen, Seetharami Seelam, Brian Belgodere, Carlos A. Fonseca, Amith Singhee, Nirmit Desai, David D. Cox, Ruchir Puri, and Rameswar Panda. 2024. Granite code models: A family of open foundation models for code intelligence. arXiv preprint arXiv:2405.04324.
|
| 268 |
+
Subhabrata Mukherjee, Arindam Mitra, Ganesh Jawahar, Sahaj Agarwal, Hamid Palangi, and Ahmed Awadallah. 2023. Orca: Progressive learning from complex explanation traces of GPT-4. arXiv preprint arXiv:2306.02707.
|
| 269 |
+
Anmol Nayak and Hariprasad Timmapathini. 2023. LLM2KB: constructing knowledge bases using instruction tuned context aware large language models. In Joint proceedings of the 1st workshop on Knowledge Base Construction from Pre-Trained Language Models (KBC-LM) and the 2nd challenge on Language Models for Knowledge Base Construction (LM-KBC) co-located with the 22nd International Semantic Web Conference (ISWC 2023), Athens, Greece, November 6, 2023, volume 3577 of CEUR Workshop Proceedings. CEUR-WS.org.
|
| 270 |
+
OpenAI. 2023. GPT-4 technical report. arXiv preprint arXiv:2303.08774.
|
| 271 |
+
Mohammadreza Pourreza and Davood Rafiei. 2023. DIN-SQL: decomposed in-context learning of text-to-sql with self-correction. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.
|
| 272 |
+
|
| 273 |
+
Nitarshan Rajkumar, Raymond Li, and Dzmitry Bahdanau. 2022. Evaluating the text-to-sql capabilities of large language models. arXiv preprint arXiv:2204.00498.
|
| 274 |
+
Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and TieYan Liu. 2020. Mpnet: Masked and permuted pretraining for language understanding. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual.
|
| 275 |
+
Shivchander Sudalairaj, Abhishek Bhandwaldar, Aldo Pareja, Kai Xu, David D. Cox, and Akash Srivastava. 2024. LAB: large-scale alignment for chatbots. arXiv preprint arXiv:2403.01081.
|
| 276 |
+
Chang-Yu Tai, Ziru Chen, Tianshu Zhang, Xiang Deng, and Huan Sun. 2023. Exploring chain of thought style prompting for text-to-sql. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, EMNLP 2023, Singapore, December 6-10, 2023, pages 5376-5393. Association for Computational Linguistics.
|
| 277 |
+
Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. 2023. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca.
|
| 278 |
+
Blerta Veseli, Simon Razniewski, Jan-Christoph Kalo, and Gerhard Weikum. 2023. Evaluating the knowledge base completion potential of GPT. In *Findings of the Association for Computational Linguistics: EMNLP* 2023, Singapore, December 6-10, 2023, pages 6432-6443. Association for Computational Linguistics.
|
| 279 |
+
Denny Vrandecic and Markus Krötzsch. 2014. Wikidata: a free collaborative knowledgebase. Commun. ACM, 57(10):78-85.
|
| 280 |
+
Bing Wang, Changyu Ren, Jian Yang, Xinnian Liang, Jiaqi Bai, Qian-Wen Zhang, Zhao Yan, and Zhoujun Li. 2023a. MAC-SQL: A multi-agent collaborative framework for text-to-sql. arXiv preprint arXiv:2312.11242.
|
| 281 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V. Le, Ed H. Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. 2023b. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net.
|
| 282 |
+
Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A. Smith, Daniel Khashabi, and Hannaneh Hajishirzi. 2023c. Self-instruct: Aligning language models with self-generated instructions. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2023, Toronto, Canada, July 9-14, 2023, pages 13484-13508. Association for Computational Linguistics.
|
| 283 |
+
|
| 284 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed H. Chi, Quoc V. Le, and Denny Zhou. 2022. Chain-of-thought prompting elicits reasoning in large language models. In Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022, New Orleans, LA, USA, November 28 - December 9, 2022.
|
| 285 |
+
Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. 2023. Wizardlm: Empowering large language models to follow complex instructions. arXiv preprint arXiv:2304.12244.
|
| 286 |
+
Xiaojun Xu, Chang Liu, and Dawn Song. 2017. SQLnet: Generating structured queries from natural language without reinforcement learning. arXiv preprint arXiv:1711.04436.
|
| 287 |
+
Navid Yaghmazadeh, Yuepeng Wang, Isil Dillig, and Thomas Dillig. 2017. Squizer: query synthesis from natural language. Proc. ACM Program. Lang., 1(OOPSLA):63:1-63:26.
|
| 288 |
+
Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, Zilin Zhang, and Dragomir R. Radev. 2018. Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 31 - November 4, 2018, pages 3911-3921. Association for Computational Linguistics.
|
| 289 |
+
John M. Zelle and Raymond J. Mooney. 1996. Learning to parse database queries using inductive logic programming. In Proceedings of the Thirteenth National Conference on Artificial Intelligence and Eighth Innovative Applications of Artificial Intelligence Conference, AAAI 96, IAAI 96, Portland, Oregon, USA, August 4-8, 1996, Volume 2, pages 1050-1055. AAAI Press / The MIT Press.
|
| 290 |
+
|
| 291 |
+
# A Prompts
|
| 292 |
+
|
| 293 |
+
We provide prompts used to elicit the knowledge generation and the SQL generation in Table 10.
|
| 294 |
+
|
| 295 |
+
# B Algorithms
|
| 296 |
+
|
| 297 |
+
We provide the pseudo-code for knowledge base construction in Algorithm 2 and the pseudo-code for our full KAT-SQL approach in Algorithm 3.
|
| 298 |
+
|
| 299 |
+
# C Additional Experimental Results
|
| 300 |
+
|
| 301 |
+
Knowledge Base Statistics The resulting knowledge base for the database overlapping and nonoverlapping scenarios contains 86,254 and 117,328 knowledge entries, respectively, which are greater than the original number of knowledge entries annotated in the BIRD dataset, which is 12,751.
|
| 302 |
+
|
| 303 |
+
Knowledge Base Construction Cost While the construction of the knowledge base is performed offline and does not impact real-time operations of text-to-SQL, we provide the cost to construct the knowledge base for our KAT2SQL approach to enable researchers to estimate resource requirements for scaling and implementation. Note that the exact computational costs and time required for knowledge base construction vary depending on hardware types and configurations, and with four H100 GPUs that can process 2K tokens per second and generate 10 tokens per second for Llama 70B, the time required to generate each knowledge entry is around 2 seconds. Therefore, for the knowledge base with 100K entries, the total generation time would be 56 hours divided by the number of parallel models (it completes in 7 hours with 8 models).
|
| 304 |
+
|
| 305 |
+
Retrieval over Different Knowledge Sources It is worthwhile to note that, for text-to-SQL tasks, it is crucial to consider the relationship between the query and the database (in addition to the consideration of the domain-specific knowledge for domain-specific queries); therefore, using the unstructured knowledge sources (such as web search) may not be optimal for this purpose since they often lack the structured, schema-specific information necessary for accurately formulating SQL queries. Nevertheless, to further validate this claim, we perform retrieval over Wikipedia, instead of performing retrieval over the constructed knowledge base, and observe only the marginal performance gain $(3\%)$ compared to the baseline without augmentation.
|
| 306 |
+
|
| 307 |
+
Table 10: A list of prompts that we use for knowledge generation and SQL generation. It is worth noting that the variable inside the parentheses $\{\}$ is replaced with its actual values.
|
| 308 |
+
|
| 309 |
+
<table><tr><td>Types</td><td>Prompts</td></tr><tr><td rowspan="10">Knowledge Generation</td><td>DB Schema: {Database Schema}</td></tr><tr><td>Question: {Few-Shot Question 1}</td></tr><tr><td>Evidence: {Few-Shot Evidence 1}</td></tr><tr><td>Question: {Few-Shot Question 2}</td></tr><tr><td>Evidence: {Few-Shot Evidence 2}</td></tr><tr><td>...</td></tr><tr><td>Question: {Few-Shot Question 10}</td></tr><tr><td>Evidence: {Few-Shot Evidence 10}</td></tr><tr><td>Question: {Target Question}</td></tr><tr><td>Evidence:</td></tr><tr><td rowspan="14">SQL Generation</td><td>DB Schema: {Database Schema}</td></tr><tr><td>Question: {Few-Shot Question 1}</td></tr><tr><td>Evidence: {Few-Shot Evidence 1}</td></tr><tr><td>SQL: {Few-Shot SQL 1}</td></tr><tr><td>Question: {Few-Shot Question 2}</td></tr><tr><td>Evidence: {Few-Shot Evidence 2}</td></tr><tr><td>SQL: {Few-Shot SQL 2}</td></tr><tr><td>...</td></tr><tr><td>Question: {Few-Shot Question 10}</td></tr><tr><td>Evidence: {Few-Shot Evidence 10}</td></tr><tr><td>SQL: {Few-Shot SQL 10}</td></tr><tr><td>Question: {Target Question}</td></tr><tr><td>Evidence: {Generated Knowledge}</td></tr><tr><td>SQL:</td></tr></table>
|
| 310 |
+
|
| 311 |
+
Algorithm 2 Knowledge Base Construction for KAT-SQL
|
| 312 |
+
Require: Dataset $D$ containing query-schema-knowledge triplets $(q,\mathcal{D},k)$ ; Prompt template $\mathcal{T}$
|
| 313 |
+
Ensure: Knowledge base $\mathcal{K}$
|
| 314 |
+
1: $\mathcal{K} \gets \{\}$ ▷ Initialize an empty knowledge base
|
| 315 |
+
2: for all $(q,\mathcal{D},k) \in D$ do
|
| 316 |
+
3: $\mathcal{K} \gets \mathcal{K} \cup k$ ▷ Add existing knowledge to the knowledge base
|
| 317 |
+
4: end for
|
| 318 |
+
5: for all query-schema pair $(q,\mathcal{D}) \in D$ do
|
| 319 |
+
6: $\mathcal{E} \gets \text{Top-}k$ relevant examples to the query $q$ from $D$
|
| 320 |
+
7: for $i = 1$ to $N$ do ▷ Iteratively expand knowledge
|
| 321 |
+
8: $\mathcal{E}_{\text{perm}} \gets \text{Permute examples } \mathcal{E}$
|
| 322 |
+
9: $k_{\text{new}} \gets \text{LLM}(\mathcal{T}(q,\mathcal{D},\mathcal{E}_{\text{perm}}))$ ▷ Generate knowledge using LLM with examples
|
| 323 |
+
10: $\mathcal{K} \gets \mathcal{K} \cup k_{\text{new}}$ ▷ Store generated knowledge in the knowledge base
|
| 324 |
+
11: end for
|
| 325 |
+
12: end for
|
| 326 |
+
|
| 327 |
+
Algorithm 3 Knowledge-Augmented Text-to-SQL (KAT-SQL)
|
| 328 |
+
Require: Query q; Database schema D; Knowledge base K
|
| 329 |
+
Ensure: SQL statement s
|
| 330 |
+
1: function KAT-SQL(q, D, K)
|
| 331 |
+
2: {ki}j{i=1} ← RETRIEVER(q, K) ▷ Retrieve relevant knowledge entries from K
|
| 332 |
+
3: Tref ← CREATEPROMPT(q, {ki}j{i=1}, D) ▷ Construct the prompt with retrieved knowledge
|
| 333 |
+
4: k' ← LLM(Tref) ▷ Refine knowledge using LLM
|
| 334 |
+
5: Taug ← CREATEPROMPT(q, k', D) ▷ Augment the prompt with refined knowledge
|
| 335 |
+
6: s ← LLM(Taug) ▷ Generate SQL with knowledge augmentation
|
| 336 |
+
7: return s
|
| 337 |
+
8: end function
|
| 338 |
+
9: function RETRIEVER(q, K)
|
| 339 |
+
10: Compute embeddings for q and all knowledge entries k ∈ K
|
| 340 |
+
11: Retrieve top-j relevant knowledge entries {ki}j{i=1} based on embedding similarities
|
| 341 |
+
12: return {ki}j{i=1}
|
| 342 |
+
13: end function
|
| 343 |
+
14: function CREATEPROMPT(q, k, D)
|
| 344 |
+
15: Construct the prompt template T using the query q, knowledge k, and database schema D
|
| 345 |
+
16: return T
|
| 346 |
+
17: end function
|
2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:65dfd308339eb90680f9af2924b670538ed170594f7a03648ebe5181c7441127
|
| 3 |
+
size 561550
|
2025/Knowledge Base Construction for Knowledge-Augmented Text-to-SQL/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2025/KodCode_ A Diverse, Challenging, and Verifiable Synthetic Dataset for Coding/c07b8238-09a6-4515-adae-2ea968c88497_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|