Enhance model card with metadata, paper link, usage example, and dataset info
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
|
@@ -1,3 +1,88 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
library_name: transformers
|
| 5 |
+
datasets:
|
| 6 |
+
- Edaizi/KG-TRACES-WebQSP
|
| 7 |
+
- Edaizi/KG-TRACES-CWQ
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# β¨ KG-TRACES: Unleashing Explainable Reasoning in LLMs with Knowledge Graphs β¨
|
| 11 |
+
|
| 12 |
+
This repository contains the official implementation of **KG-TRACES**, a novel framework that enhances the reasoning ability of Large Language Models (LLMs) through explicit supervision over reasoning paths and processes. KG-TRACES aims to provide explainable, accurate, and traceable reasoning by leveraging the power of Knowledge Graphs.
|
| 13 |
+
|
| 14 |
+
For more details, refer to the accompanying paper:
|
| 15 |
+
[**KG-TRACES: Enhancing Large Language Models with Knowledge Graph-constrained Trajectory Reasoning and Attribution Supervision**](https://huggingface.co/papers/2506.00783)
|
| 16 |
+
|
| 17 |
+
The full codebase and more information can be found on the official GitHub repository:
|
| 18 |
+
[https://github.com/Edaizi/KG-TRACES](https://github.com/Edaizi/KG-TRACES)
|
| 19 |
+
|
| 20 |
+
<p align="center">
|
| 21 |
+
<img src="https://github.com/Edaizi/KG-TRACES/raw/main/assets/teaser.png" width="750" alt="KG-TRACES Teaser Image: Comparison of Reasoning Methods">
|
| 22 |
+
</p>
|
| 23 |
+
*Figure 1: KG-TRACES (d) stands out by generating faithful, attributable responses, adapting to different KG access conditions.*
|
| 24 |
+
|
| 25 |
+
## π‘ Our Solution: KG-TRACES
|
| 26 |
+
|
| 27 |
+
KG-TRACES is a novel framework that explicitly teaches LLMs *how* to reason by supervising their internal "thought process" with knowledge graphs guidance. We guide them to:
|
| 28 |
+
|
| 29 |
+
1. πΊοΈ **Chart the Course**: Predict symbolic **knowledge graph reasoning paths** from question to answer.
|
| 30 |
+
2. π **Show Their Work**: Generate **attribution-aware reasoning explanations**, clearly claim whether each step comes from the KG or the LLM's internal knowledge π§ , and how effective it was!
|
| 31 |
+
|
| 32 |
+
<p align="center">
|
| 33 |
+
<img src="https://github.com/Edaizi/KG-TRACES/raw/main/assets/method.png" width="750" alt="KG-TRACES Method Overview">
|
| 34 |
+
</p>
|
| 35 |
+
*Figure 2: The KG-TRACES framework*
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## π Why KG-TRACES Rocks
|
| 40 |
+
|
| 41 |
+
* π **Crystal-Clear Explanations**: Understand *why* the LLM reached its conclusion.
|
| 42 |
+
* π‘οΈ **Trustworthy & Attributable**: Know the evidence source of each reasoning step.
|
| 43 |
+
* πͺ **Robust Performance**: Excels even with limited or no direct KG access during inference.
|
| 44 |
+
* π **Versatile**: Shows strong generalization to specialized fields like medicine.
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## π Quickstart: Pretrained Models
|
| 49 |
+
|
| 50 |
+
You can easily load our fine-tuned KG-TRACES models from the Hugging Face Model Hub using the `transformers` library:
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 54 |
+
|
| 55 |
+
model_hub_name = "Edaizi/KG-TRACES"
|
| 56 |
+
tokenizer = AutoTokenizer.from_pretrained(model_hub_name)
|
| 57 |
+
model = AutoModelForCausalLM.from_pretrained(model_hub_name)
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## π Datasets
|
| 61 |
+
|
| 62 |
+
We've meticulously prepared augmented SFT datasets for WebQSP and CWQ, packed with reasoning paths and augmented reasoning processes with source attributions. Find them on Hugging Face:
|
| 63 |
+
|
| 64 |
+
- [KG-TRACES-WebQSP](https://huggingface.co/datasets/Edaizi/KG-TRACES-WebQSP)
|
| 65 |
+
- [KG-TRACES-CWQ](https://huggingface.co/datasets/Edaizi/KG-TRACES-CWQ)
|
| 66 |
+
|
| 67 |
+
You can load these datasets as follows:
|
| 68 |
+
```python
|
| 69 |
+
from datasets import load_dataset
|
| 70 |
+
|
| 71 |
+
webqsp_sft_data = load_dataset("Edaizi/KG-TRACES-WebQSP")
|
| 72 |
+
cwq_sft_data = load_dataset("Edaizi/KG-TRACES-CWQ")
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## π Citation
|
| 76 |
+
If KG-TRACES helps your research or project, we'd love a shout-out! Please cite:
|
| 77 |
+
|
| 78 |
+
```bibtex
|
| 79 |
+
@misc{wu2025kgtracesenhancinglargelanguage,
|
| 80 |
+
title={KG-TRACES: Enhancing Large Language Models with Knowledge Graph-constrained Trajectory Reasoning and Attribution Supervision},
|
| 81 |
+
author={Rong Wu and Pinlong Cai and Jianbiao Mei and Licheng Wen and Tao Hu and Xuemeng Yang and Daocheng Fu and Botian Shi},
|
| 82 |
+
year={2025},
|
| 83 |
+
eprint={2506.00783},
|
| 84 |
+
archivePrefix={arXiv},
|
| 85 |
+
primaryClass={cs.CL},
|
| 86 |
+
url={https://arxiv.org/abs/2506.00783},
|
| 87 |
+
}
|
| 88 |
+
```
|