Retrieval-augmented generation (RAG) is critical for reducing hallucinations and incorporating external knowledge into Large Language Models (LLMs). However, advanced RAG systems face a trade-off between performance and efficiency. Multi-round RAG approaches achieve strong reasoning but incur excessive LLM calls and token costs, while Graph RAG methods suffer from computationally expensive, error-prone graph construction and retrieval redundancy. To address these challenges, we propose T2RAG, a novel framework that operates on a simple, graph-free knowledge base of atomic triplets. T2RAG leverages an LLM to decompose questions into searchable triplets with placeholders, which it then iteratively resolves by retrieving evidence from the triplet database. Empirical results show that T2RAG significantly outperforms state-of-the-art multi-round and Graph RAG methods, achieving an average performance gain of up to 11% across six datasets while reducing retrieval costs by up to 45%.
Assuming you have an environment with torch>=2.0.
pip install -r requirements.txtyou may need manually download some packages based on your torch version.
export CUDA_VISIBLE_DEVICES=0 # or your preferred device number
export HF_HOME='~/.hf' # or your preferred path
export OPENAI_API_KEY=<your openai api key>
export GOOGLE_API_KEY=<your gemini api key>python main.py --dataset 2wikimultihopqa --method trag--dataset [popqa, 2wikimultihopqa, musique, hotpotqa, story, medical]
--method [trag, standard, hippo]Final and intermediate results are saved in outputs/<dataset>_<method>.
[2025.08] Support GPT-OSS