An Explainable Graph Attention Network for Indirect Prompt Injection Detection in RAG Systems

Retrieval-Augmented Generation (RAG) enables large language models (LLMs) to answer queries using information obtained from external documents. However, retrieved content may contain concealed commands intended to influence the model's behaviour, creating a security risk called indirect prompt injection. This research develops a GAT-based approach to identify harmful instructions in retrieved documents before they reach the language model. Each document is split into individual sentences, which are encoded using a frozen DeBERTa-v3-base model. A graph is constructed from the sentence embeddings, linking adjacent sentences and pairs with a cosine similarity score above 0.7. A two-layer Graph Attention Network (GAT), comprising approximately 0.4 million trainable parameters, processes the graph to classify the document as benign or malicious. The model was evaluated using 10,000 samples collected from financial and corporate policy documents. The dataset contains 6,400 training samples, 1,600 validation samples, and 2,000 testing samples, with equal representation of both classes. Following the addition of calibrated Gaussian noise to the input features, the model obtained 99.80% test accuracy, an F1-score of 0.998, and a Matthews correlation coefficient of 0.996. Its 95% Wilson confidence interval for accuracy ranged from 99.49% to 99.92%. The keyword-based approach recorded an accuracy of 87.93%, but 24.1% of the malicious samples contained none of its specified trigger terms. Its performance on unseen data remains to be established through further experiments involving independently collected datasets, additional application domains, and attack techniques excluded from the original evaluation.

Authors

Publication Details

Journal
International Journal for Research in Applied Science and Engineering Technology
Published
2026-11-04
DOI
https://doi.org/10.22214/ijraset.2026.85566
Primary Topic
Adversarial Robustness in Machine Learning
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

An Explainable Graph Attention Network for Indirect Prompt Injection Detection in RAG Systems

Ch. D. V. Subba Rao, V. Rudrani
International Journal for Research in Applied Science and Engineering Technology
Adversarial Robustness in Machine Learning
article

An Explainable Graph Attention Network for Indirect Prompt Injection Detection in RAG Systems

Ch. D. V. Subba Rao, V. Rudrani
article en

Abstract

Retrieval-Augmented Generation (RAG) enables large language models (LLMs) to answer queries using information obtained from external documents. However, retrieved content may contain concealed commands intended to influence the model's behaviour, creating a security risk called indirect prompt injection. This research develops a GAT-based approach to identify harmful instructions in retrieved documents before they reach the language model. Each document is split into individual sentences, which are encoded using a frozen DeBERTa-v3-base model. A graph is constructed from the sentence embeddings, linking adjacent sentences and pairs with a cosine similarity score above 0.7. A two-layer Graph Attention Network (GAT), comprising approximately 0.4 million trainable parameters, processes the graph to classify the document as benign or malicious. The model was evaluated using 10,000 samples collected from financial and corporate policy documents. The dataset contains 6,400 training samples, 1,600 validation samples, and 2,000 testing samples, with equal representation of both classes. Following the addition of calibrated Gaussian noise to the input features, the model obtained 99.80% test accuracy, an F1-score of 0.998, and a Matthews correlation coefficient of 0.996. Its 95% Wilson confidence interval for accuracy ranged from 99.49% to 99.92%. The keyword-based approach recorded an accuracy of 87.93%, but 24.1% of the malicious samples contained none of its specified trigger terms. Its performance on unseen data remains to be established through further experiments involving independently collected datasets, additional application domains, and attack techniques excluded from the original evaluation.

International Journal for Research in Applied Science and Engineering TechnologyVol. 14(11)
Openalex Percentile: Top 17%
Adversarial Robustness in Machine Learning
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon