Implementation for the paper: Retrieval-Augmented Generation-Based Relation Extraction
The project provides an end-to-end pipeline for relation extraction with and without retrieval augmentation across datasets such as TACRED, TACREV, Re-TACRED, and SemEval.
@article{doi:10.1177/22104968251385519,
author = {Sefika Efeoglu and Adrian Paschke},
title = {Retrieval-Augmented Generation-Based Relation Extraction},
journal = {Semantic Web},
volume = {16},
number = {5},
pages = {22104968251385519},
year = {2025},
doi = {10.1177/22104968251385519},
url = {https://doi.org/10.1177/22104968251385519}
}- TACRED is licensed by LDC and must be obtained from LDC2018T24.
- TACREV is constructed from TACRED using DFKI-NLP/tacrev.
- Re-TACRED is derived from TACRED using gstoica27/Re-TACRED.
- SemEval 2010 Task 8 is available on Hugging Face.
Because TACRED is restricted, prompts/raw outputs that expose original text are not directly redistributed.
.
├── LICENSE
├── README.md
├── requirements.txt
├── data/
├── results/
└── src/
├── config.ini
├── main.py
├── utils.py
├── data_augmentation/
│ ├── embeddings/
│ └── prompt_generation/
├── data_preparation/
├── evaluation/
│ └── results_analysis.py
├── generation_module/
│ └── generation.py
└── retrieval/
├── refinement.py
└── retriever.py
- Install as a package (editable mode for development).
pip install -e .Optional: if you prefer plain requirements installation instead of packaging:
pip install -r requirements.txt- Review and update experiment settings in
src/config.ini.
- Paths in the config are project-relative.
- Choose dataset, prompt type (
simpleorrag), and model.
- Generate sentence embeddings.
rag4re --config src/config.ini embed- Compute retrieval similarity index.
rag4re --config src/config.ini similarity- Run generation pipeline.
rag4re --config src/config.ini pipeline- Run evaluation.
rag4re --config src/config.ini evaluate- Run the complete workflow.
rag4re --config src/config.ini allThe experiments were run on NVIDIA GeForce GTX 1080 Ti GPUs (4 x 12GB) with large CPU memory availability.