Skip to content

Latest commit

 

History

111 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAG4RE

Python License: MIT Transformers Sentence-Transformers GitHub stars GitHub last commit GitHub issues GitHub repo size

Implementation for the paper: Retrieval-Augmented Generation-Based Relation Extraction

RAG4RE icon

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.

Citation

@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}
}

Dataset Notes

Because TACRED is restricted, prompts/raw outputs that expose original text are not directly redistributed.

Project Structure

.
├── 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

Setup

  1. 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
  1. Review and update experiment settings in src/config.ini.
  • Paths in the config are project-relative.
  • Choose dataset, prompt type (simple or rag), and model.

Run

  1. Generate sentence embeddings.
rag4re --config src/config.ini embed
  1. Compute retrieval similarity index.
rag4re --config src/config.ini similarity
  1. Run generation pipeline.
rag4re --config src/config.ini pipeline
  1. Run evaluation.
rag4re --config src/config.ini evaluate
  1. Run the complete workflow.
rag4re --config src/config.ini all

Environment

The experiments were run on NVIDIA GeForce GTX 1080 Ti GPUs (4 x 12GB) with large CPU memory availability.

About

Retrieval-Augmented Generation-based Relation Extraction

Resources

Stars

49 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages