Official code for "LogicPoison: Logical Attacks on Graph Retrieval-Augmented Generation".
- [2026-05-17] Our LogicPoison is selected as the Oral presentation(Top 4%)!
- [2026-04-04] Our LogicPoison is accepted by ACL'26 Main Conference!
- [2026-04-03] We release the codes of LogicPoison and the datasets.
LogicPoison is a logical poisoning framework for GraphRAG systems.
Instead of injecting fabricated facts or adversarial instructions into the corpus, it perturbs the implicit reasoning topology of the graph through type-preserving entity swapping.
The key idea is simple but effective:
- identify globally important logic hubs in the corpus,
- identify query-specific bridge entities required for multi-hop reasoning,
- swap entities within the same semantic type to keep the text locally plausible while corrupting the graph structure built from the corpus.
This causes GraphRAG systems to follow corrupted reasoning chains and produce incorrect answers, while the poisoned corpus remains surface-level natural.
LogicPoison consists of three stages:
Build corpus-level entity statistics and identify high-frequency entities that likely act as global logic hubs in the implicit graph.
Use query-side reasoning signals to identify bridge entities that are important for answering multi-hop questions.
Combine the selected entities and perform bijective swapping within the same entity type (e.g., PERSON with PERSON, ORG with ORG), producing a poisoned corpus that remains grammatically and semantically plausible at the local text level.
.
├── main.py
├── README.md
├── requirements.txt
├── src/
│ ├── global_poison.py
│ ├── query_centric.py
│ └── logic_poison.py
├── img/
│ └── main_figure.png
├── eval/
│ ├── evaluator.py
│ └── evaluator_llm.py
├── datasets/
├── results/
└── ...
pip install -r requirements.txt# check CUDA version
nvcc --version
# install ONE CuPy package matching your CUDA major version
# CUDA 11.x
pip install cupy-cuda11x
# CUDA 12.x
pip install cupy-cuda12x
# quick check
python -c "import spacy; print(spacy.prefer_gpu())"python -m spacy download en_core_web_trfgit clone https://huggingface.co/datasets/Jord8061/datasetsexport OPENAI_API_KEY="your-api-key-here"
export OPENAI_BASE_URL="your-base-url-here"Use main.py as the single entry point.
By default, completed stage outputs are auto-detected and skipped.
Use --force to rerun selected stages even if outputs already exist.
python main.py --stages all --datasets allpython main.py --stages global query --datasets hotpotqa musique
python main.py --stages logic --datasets 2wikimultihopqapython main.py --helpThis project is released for research and defensive evaluation purposes only.
LogicPoison demonstrates a realistic vulnerability in GraphRAG systems: even when surface text appears benign, logical structure can still be corrupted in ways that mislead graph-based retrieval and reasoning. We release this code to support the development of more robust GraphRAG pipelines, better detection methods, and stronger defense mechanisms.
Please do not use this repository to attack real-world systems or deploy poisoned corpora in production environments.
If you find this project useful, please cite our paper:
@inproceedings{xiao-etal-2026-logicpoison,
title = "{L}ogic{P}oison: Logical Attacks on Graph Retrieval-Augmented Generation",
author = "Xiao, Yilin and
Chen, Jin and
Zhang, Qinggang and
Zhang, Yujing and
Zhou, Chuang and
Yang, Longhao and
Ren, Lingfei and
Yang, Xin and
Huang, Xiao",
editor = "Liakata, Maria and
Moreira, Viviane P. and
Zhang, Jiajun and
Jurgens, David",
booktitle = "Proceedings of the 64th Annual Meeting of the {A}ssociation for {C}omputational {L}inguistics (Volume 1: Long Papers)",
month = jul,
year = "2026",
address = "San Diego, California, United States",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2026.acl-long.252/",
pages = "5575--5591",
ISBN = "979-8-89176-390-6"
}
