# Kinship KG–QA (Hinton)

A lightweight **knowledge-graph + question answering (KGQA)** resource adapted from the UCI *Kinship* dataset created by Geoff Hinton.

This dataset provides a small family-tree knowledge graph paired with templated multi-hop QA tasks designed for **MultiHop KGQA**.

## Key Features

-   Small **knowledge graph with two family trees**
-   **Human-readable entities and relations**
-   Templated **1--3 hop QA pairs**
-   **Explicit start entity** for navigation-based models
-   **Gold reasoning paths** provided
-   **Paraphrased questions** for robustness evaluation

> ⚠️ This dataset is **distinct from the Australian Kinship dataset** (Denham et al.).

---

## Contents

### 1) Knowledge Graph (KG) Triples
KG triples are stored under the `kg/` directory.
```
kg/
├─ orig/
│ ├─ train.txt
│ ├─ dev.txt
│ ├─ test.txt
│ └─ triplets.txt
└─ gender/
├─ train.txt
├─ dev.txt
├─ test.txt
└─ triplets.txt
```

All triple files follow the format:

`head  relation  tail`
- Files are **tab-separated**.
- Entities and relations are stored using **human-readable labels**.

**File descriptions**

| File            | Description                     |
|-----------------|---------------------------------|
| `train.txt`     | Training triples                |
| `dev.txt`       | Validation triples              |
| `test.txt`      | Test triples                    |
| `triplets.txt`  | Full graph used for navigation  |

> Because the Kinship graph is very small, `dev.txt` and `test.txt` are identical.
---

#### 1-a) `kg/orig/` — Original Kinship Graph

This folder contains the **original Kinship triples** derived from the dataset.

- These triples represent the **core family relationships**.
- This graph should be used for **navigation-based QA experiments**.

---

#### 1-b) `kg/gender/` — Extended Graph with Gender Information

This folder contains the same triples as `kg/orig/` with additional relations describing **gender**.

Purpose:

- Provide additional semantic signals when **pre-training knowledge graph embeddings (KGE)**.

Important restrictions:

- The **gender relation does not appear in the QA questions**.
- Using this graph for navigation may allow models to exploit **shortcut paths** that produce **invalid or nonsensical reasoning chains**.

Therefore:

- ✅ Suitable for **embedding pre-training**
- ❌ **Should not be used for reasoning or navigation**

---

### 2) Question Answering (QA) Files

QA datasets are stored under the `qa/` directory.
```
qa/
├─ kinship_qa_2hop.csv
├─ kinship_qa_3hop.csv
└─ kinship_qa_nhop.csv
```

| File                         | Description                                |
|------------------------------|--------------------------------------------|
| `kinship_qa_2hop.csv` | Contains only 2-hop questions              |
| `kinship_qa_3hop.csv` | Contains only 3-hop questions              |
| `kinship_qa_nhop.csv` | Mixed dataset containing 1–3 hop questions |

---

### Important Note on 1-Hop Questions

1-hop questions are used **only for training** in the mixed-hop dataset.

This design choice is motivated by two factors:

- The overall dataset is **very small**
- Multi-hop reasoning (2–3 hops) requires learning the underlying **1-hop relations**

Using 1-hop questions during training helps models **learn the base relational structure** needed for multi-hop reasoning.

---

### 3) Original Source Data

#### Data formats
```
source/
└─ kinship.data
```
This file contains the **original Kinship dataset** from which the KG triples were derived. The source file is redistributed from the [UCI Machine Learning Repository](https://archive.ics.uci.edu/dataset/55/kinship) under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.

---

### Triple example
```text
Victoria	father	Christopher      # (head_id, relation_id, tail_id)
```

### CSV schema

| Column                  | Description                                                                                   |
|-------------------------|-----------------------------------------------------------------------------------------------|
| `Question-Number`       | Integer question ID                                                                           |
| `Question`              | Natural-language question                                                                     |
| `Question-Paraphrased`  | List of paraphrased questions                                                                 |
| `Source`                | Start entity (human-readable)                                                                 |
| `Source-Entity`         | Encoded start entity (kept for compatibility)                                                 |
| `Answer`                | Gold answer (human-readable)                                                                  |
| `Answer-Entity`         | Encoded answer entity                                                                         |
| `Hops`                  | Reasoning hop count (1 / 2 / 3)                                                               |
| `Paths`                 | Gold reasoning path as an ordered list of triples `(h, r, t)` from source to answer           |
| `Paths-Label`           | Same path using human-readable labels                                                         |         
| `SplitLabel`            | Dataset split (`train`/`dev`/`test`)                                                          |

**Compatibility Note**

Since this dataset already uses **human-readable labels**, the following columns are identical:
-   `Source == Source-Entity`
-   `Answer == Answer-Entity`
-   `Paths == Paths-Label`

These columns are preserved **for compatibility with other MultiHopKGQA datasets** that require entity ID mappings.

**Path encoding example**
```text
[[Victoria, father, Christopher], [Christopher, wife, Penelope]]
```

---

## Usage notes

- **Directionality.** Triples are provided as directed; many experiments treat the KG as **undirected** (mirror edges at load time if needed).  
- **Embedding sizes.** This is a toy graph; small KGE dimensions (e.g., `d=12`) are sufficient.  

---

## Quick example

**Question:** “Who is the **wife** of the **father** of Victoria?”  
**Question-Paraphrased:** “What is the name of Victoria's **father's** **wife**?”   
**Start:** `Victoria`  
**Gold path:** `(Victoria, father, Christopher) → (Christopher, wife, Penelope)`  
**Answer:** `Penelope` (2-hop)

---

## Citation

If you use this resource, please cite the original UCI Kinship entry and our paper introducing the QA setup.
```bibtex
@misc{kinship_55,
  author       = {Hinton, Geoff},
  title        = {{Kinship}},
  year         = {1986},
  howpublished = {UCI Machine Learning Repository},
  note         = {{DOI}: https://doi.org/10.24432/C5WS4D}
}
```

```bibtex

@article{hernandez2026theseus,
  author = {Hernandez, Eduin E. and Garcia, Luis F. and Askar, Nurassyl and Diaz, Sergio A. and Rini, Stefano},
  title = {Theseus in the Graph: Towards Traceable Multi-Hop Graph Navigation},
  journal = {arXiv preprint arXiv:2609.14528},
  year    = {2026}
}
```

## Dataset Statistics
- Knowledge Graph
  - Entities: 24
  - Relations: 12
  - Triples: 112

- Question Answering

| Hop       | Total | Train | Dev | Test |
| --------- | ----- | ----- | --- | ---- |
| **1-hop** | 112   | 112   | 0   | 0    |
| **2-hop** | 248   | 173   | 37  | 38   |
| **3-hop** | 420   | 294   | 63  | 63   |

Total QA pairs: 780

Note: 1-hop questions are used exclusively for training due to the small size of the dataset.

## License

The MultiHop KGQA contributions to this dataset, including the knowledge-graph representation, QA pairs, reasoning paths, dataset splits, and paraphrased questions, are licensed under the [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/) license.

The original UCI Kinship dataset, including `source/kinship.data`, is distributed by the [UCI Machine Learning Repository](https://archive.ics.uci.edu/dataset/55/kinship) under the **CC BY 4.0** license.

Please cite both the original Kinship dataset and our work when using this resource. See the [Citation](#citation) section above for the corresponding references.