PulseExploreJournal ClubDebatesTrendingResearchersJournals
Instagram
HomeExploreJournal ClubTrending
Synapse
⌘+K
Synapse
March 3, 2026Algorithms7 citationsOpen Access

Embedding-Based Detection of Indirect Prompt Injection Attacks in Large Language Models Using Semantic Context Analysis

MAMohammed AlamsabiMTMichael TchuindjangSBSarfraz Brohi

Key Points

  • Detection of indirect prompt injection attacks achieves 97.7% accuracy with OpenAI embeddings and XGBoost.
  • Analysis across 70,000 samples shows superior performance, with an F1-score of 0.977, compared to previous methods.
  • Embedding-based approach employs multiple models, including GTE-large and MiniLM-L6-v2, for effective detection.
  • Integrates as a lightweight external detection layer, avoiding changes to underlying LLM architecture.

Abstract

Large Language Models (LLMs) are vulnerable to Indirect Prompt Injection Attacks (IPIAs), where malicious instructions are embedded within external content rather than direct user input. This study presents an embedding-based detection approach that analyses the semantic relationship between user intent and external content, enabling the early identification of IPIAs that conventional defences overlook. We also provide a dataset of 70,000 samples, constructed using 35,000 malicious instances from the Benchmark for Indirect Prompt Injection Attacks (BIPIA) and 35,000 benign instances generated using ChatGPT-4o-mini. Furthermore, we performed a comparative analysis of three embedding models, namely OpenAI text-embedding-3-small, GTE-large, and MiniLM-L6-v2, evaluated in combination with XGBoost, LightGBM, and Random Forest classifiers. The best-performing configuration using OpenAI embeddings with XGBoost achieved an accuracy of 97.7% and an F1-score of 0.977, matching or exceeding the performance of existing IPIA detection methods while offering practical deployment advantages. Unlike prevention-focused approaches that require modifications to the underlying LLM architecture, the proposed method operates as a model-agnostic external detection layer with an average inference time of 0.001 ms per sample. This detection-based approach complements existing prevention mechanisms by providing a lightweight, scalable solution that can be integrated into LLM pipelines without requiring architectural changes.

Ask AI
Helpful
Bookmark
Share
View Full Paper

Cite This Study

Alamsabi et al. (2026) studied this question.

synapsesocial.com/papers/69a75b88c6e9836116a22f7bhttps://doi.org/10.3390/a19010092
Ask AI
Helpful
Bookmark
Share
View Full Paper