PreprintCited by 30Adversarial Robustness in Machine LearningTopic ModelingSecurity and Verification in Computing

PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models

Open access
Zou, Wei, Geng, Runpeng, Wang, Binghui, Jia, Jinyuan·2024·arXiv

Abstract

Large language models (LLMs) have achieved remarkable success due to their exceptional generative capabilities. Despite their success, they also have inherent limitations such as a lack of up-to-date knowledge and hallucination. Retrieval-Augmented Generation (RAG) is a state-of-the-art technique to mitigate these limitations. The key idea of RAG is to ground the answer generation of an LLM on external knowledge retrieved from a knowledge database. Existing studies mainly focus on improving the accuracy or efficiency of RAG, leaving its security largely unexplored. We aim to bridge the gap in this work. We find that the knowledge database in a RAG system introduces a new and practical attack surface. Based on this attack surface, we propose PoisonedRAG, the first knowledge corruption attack to RAG, where an attacker could inject a few malicious texts into the knowledge database of a RAG system to induce an LLM to generate an attacker-chosen target answer for an attacker-chosen target question. We formulate knowledge corruption attacks as an optimization problem, whose solution is a set of malicious texts. Depending on the background knowledge (e.g., black-box and white-box settings) of an attacker on a RAG system, we propose two solutions to solve the optimization problem, respectively. Our results show PoisonedRAG could achieve a 90% attack success rate when injecting five malicious texts for each target question into a knowledge database with millions of texts. We also evaluate several defenses and our results show they are insufficient to defend against PoisonedRAG, highlighting the need for new defenses.

The claims and statistics of this paper haven’t been checked yet.

Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.

A few free checks a day · papers already verified open instantly · results are public

Integrity signals

Registry

DataCite · 10.48550/arxiv.2402.07867

Cites

0 citation errors · 0 not checkable

Statistics

Claims the paper makes

The claims and statistics of this paper haven’t been checked yet.

Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.

A few free checks a day · papers already verified open instantly · results are public

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

The self-check needs the paper’s full text.

Cites

The publisher hasn’t deposited this paper’s reference list.

Research works printed but not linked: 44

  1. J. Achiam, S. Adler, S. Agarwal, L. Ahmad, I. Akkaya, F. L. Aleman, D. Almeida, J. Altenschmidt, S. Altman, S. Anadkat et al., "Gpt-4 technical report," arXiv, 2023.
  2. R. Anil, A. M. Dai, O. Firat, M. Johnson, D. Lepikhin, A. Passos, S. Shakeri, E. Taropa, P. Bailey, Z. Chen et al., "Palm 2 technical report," arXiv, 2023.
  3. R. Z. Mahari, "Autolaw: Augmented legal reasoning through legal precedent prediction," arXiv, 2021.
  4. J. Boyko, J. Cohen, N. Fox, M. H. Veiga, J. I. Li, J. Liu, B. Modenesi, A. H. Rauch, K. N. Reid, S. Tribedi et al., "An interdisciplinary outlook on large language models for scientific research," arXiv, 2023.
  5. P. Lewis, E. Perez, A. Piktus, F. Petroni, V. Karpukhin, N. Goyal, H. Küttler, M. Lewis, W.-t. Yih, T. Rock- täschel et al., "Retrieval-augmented generation for knowledge-intensive nlp tasks," NeurIPS, 2020.
  6. S. Borgeaud, A. Mensch, J. Hoffmann, T. Cai, E. Rutherford, K. Millican, G. B. Van Den Driessche, J.-B. Lespiau, B. Damoc, A. Clark et al., "Improving language models by retrieving from trillions of tokens," in ICML, 2022.
  7. R. Thoppilan, D. De Freitas, J. Hall, N. Shazeer, A. Kul- shreshtha, H.-T. Cheng, A. Jin, T. Bos, L. Baker, Y. Du et al., "Lamda: Language models for dialog applica- tions," arXiv, 2022.
  8. N. Thakur, N. Reimers, A. Rücklé, A. Srivastava, and I. Gurevych, "Beir: A heterogeneous benchmark for zero-shot evaluation of information retrieval models," in NeurIPS, 2021.
  9. S. Yao, J. Zhao, D. Yu, N. Du, I. Shafran, K. Narasimhan, and Y. Cao, "React: Synergiz- ing reasoning and acting in language models," arXiv, 2022.
  10. A. Asai, Z. Wu, Y. Wang, A. Sil, and H. Hajishirzi, "Self-rag: Learning to retrieve, generate, and critique through self-reflection," in ICLR, 2024.
  11. G. Izacard, M. Caron, L. Hosseini, S. Riedel, P. Bo- janowski, A. Joulin, and E. Grave, "Unsupervised dense information retrieval with contrastive learning," Transactions on Machine Learning Research, 2022.
  12. L. Xiong, C. Xiong, Y. Li, K.-F. Tang, J. Liu, P. N. Ben- nett, J. Ahmed, and A. Overwijk, "Approximate nearest neighbor negative contrastive learning for dense text retrieval," in ICLR, 2021.
  13. Z. Peng, X. Wu, and Y. Fang, "Soft prompt tuning for augmenting dense retrieval with large language models," arXiv, 2023.
  14. V. Karpukhin, B. Oguz, S. Min, P. Lewis, L. Wu, S. Edunov, D. Chen, and W.-t. Yih, "Dense passage retrieval for open-domain question answering," in EMNLP, 2020.
  15. T. Nguyen, M. Rosenberg, X. Song, J. Gao, S. Tiwary, R. Majumder, and L. Deng, "Ms marco: A human generated machine reading comprehension dataset," choice, vol. 2640, p. 660, 2016.
  16. H. Touvron, L. Martin, K. Stone, P. Albert, A. Alma- hairi, Y. Babaei, N. Bashlykov, S. Batra, P. Bhargava, S. Bhosale et al., "Llama 2: Open foundation and fine- tuned chat models," arXiv, 2023.
  17. N. Jain, A. Schwarzschild, Y. Wen, G. Somepalli, J. Kirchenbauer, P.-y. Chiang, M. Goldblum, A. Saha, J. Geiping, and T. Goldstein, "Baseline defenses for adversarial attacks against aligned language models," arXiv, 2023.
  18. G. Alon and M. Kamfonas, "Detecting language model attacks with perplexity," arXiv, 2023.
  19. F. Perez and I. Ribeiro, "Ignore previous prompt: At- tack techniques for language models," in NeurIPS ML Safety Workshop, 2022.
  20. Y. Liu, G. Deng, Y. Li, K. Wang, T. Zhang, Y. Liu, H. Wang, Y. Zheng, and Y. Liu, "Prompt injection at- tack against llm-integrated applications," arXiv, 2023.
  21. R. Pedro, D. Castro, P. Carreira, and N. Santos, "From prompt injections to sql injection attacks: How pro- tected is your llm-integrated web application?" arXiv, 2023.
  22. H. J. Branch, J. R. Cefalu, J. McHugh, L. Hujer, A. Bahl, D. d. C. Iglesias, R. Heichman, and R. Dar- wishi, "Evaluating the susceptibility of pre-trained lan- guage models via handcrafted adversarial examples," arXiv, 2022.
  23. A. Zou, Z. Wang, J. Z. Kolter, and M. Fredrikson, "Uni- versal and transferable adversarial attacks on aligned language models," arXiv, 2023.
  24. N. Kandpal, M. Jagielski, F. Tramèr, and N. Carlini, "Backdoor attacks for in-context learning with language models," in ICML Workshop, 2023.
  25. A. Wan, E. Wallace, S. Shen, and D. Klein, "Poisoning language models during instruction tuning," in ICML, 2023.
  26. N. Carlini, D. Ippolito, M. Jagielski, K. Lee, F. Tramer, and C. Zhang, "Quantifying memorization across neu- ral language models," in ICLR, 2022.
  27. B. Biggio, B. Nelson, and P. Laskov, "Poisoning attacks against support vector machines," in ICML, 2012.
  28. T. Gu, B. Dolan-Gavitt, and S. Garg, "Badnets: Iden- tifying vulnerabilities in the machine learning model supply chain," IEEE Access, 2017.
  29. X. Chen, C. Liu, B. Li, K. Lu, and D. Song, "Targeted backdoor attacks on deep learning systems using data poisoning," arXiv, 2017.
  30. A. Shafahi, W. R. Huang, M. Najibi, O. Suciu, C. Studer, T. Dumitras, and T. Goldstein, "Poison frogs! targeted clean-label poisoning attacks on neural net- works," in NeurIPS, 2018.
  31. E. Bagdasaryan, A. Veit, Y. Hua, D. Estrin, and V. Shmatikov, "How to backdoor federated learning," in AISTATS, 2020.
  32. M. Fang, X. Cao, J. Jia, and N. Gong, "Local model poi- soning attacks to byzantine-robust federated learning," in USENIX Security Symposium, 2020.
  33. A. Kerckhoffs, "La cryptographie militaire," Journal des sciences militaires, 1883.
  34. N. Carlini, "Poisoning the unlabeled dataset of semi- supervised learning," in USENIX Security, 2021.
  35. H. Liu, J. Jia, and N. Z. Gong, "Poisonedencoder: Poi- soning the unlabeled pre-training data in contrastive learning," in USENIX Security Symposium, 2022.
  36. Y. Huang, S. Gupta, M. Xia, K. Li, and D. Chen, "Catas- trophic jailbreak of open-source llms via exploiting generation," arXiv, 2023.
  37. Y. Du, A. Bosselut, and C. D. Manning, "Synthetic disinformation attacks on automated fact verification systems," in AAAI, 2022.
  38. O. Yoran, T. Wolfson, O. Ram, and J. Berant, "Making retrieval-augmented language models robust to irrele- vant context," in ICLR, 2023.
  39. T. Zhang, S. G. Patil, N. Jain, S. Shen, M. Zaharia, I. Stoica, and J. E. Gonzalez, "Raft: Adapting language model to domain specific rag," arXiv, 2024.
  40. J. Steinhardt, P. W. W. Koh, and P. S. Liang, "Certified defenses for data poisoning attacks," NeurIPS, 2017.
  41. J. Jia, Y. Liu, Y. Hu, and N. Z. Gong, "Pore: Provably robust recommender systems against data poisoning attacks," in USENIX Security Symposium, 2023.
  42. S. Shan, A. N. Bhagoji, H. Zheng, and B. Y. Zhao, "Poison forensics: Traceback of data poisoning attacks in neural networks," in USENIX Security Symposium, 2022.
  43. F. Jelinek, "Interpolated estimation of markov source parameters from sparse data," in Proc. Workshop on Pattern Recognition in Practice, 1980.
  44. E. Kortukov, A. Rubinstein, E. Nguyen, and S. J. Oh, "Studying large language model behaviors under realis- tic knowledge conflicts," arXiv, 2024.

Cited by

Sorted by citations

Authors
Zou, W., Geng, R., Wang, B., & Jia, J.
Affiliations
  • Pennsylvania State University (US)
  • Illinois Institute of Technology (US)
Venue
arXiv
Publisher
arXiv
Published
2024
ISSN
2331-8422 (ISSN-L)
OpenAlex
W4391801218
Cited by
16
References
0
Citations by year
2026: 4 · 2025: 7 · 2024: 5
Type
posted content
Language
en
Open access
Locations
  • arXiv (Cornell University) (submittedVersion)
  • arXiv (Cornell University)
Topics
  • Physical Sciences › Computer Science › Artificial Intelligence › Adversarial Robustness in Machine Learning
  • Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
  • Physical Sciences › Computer Science › Artificial Intelligence › Security and Verification in Computing
Keywords
retrieval-augmented generation, large language models, adversarial attacks, attack defense, hallucinations

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review