Skip to content

Repository files navigation

Prompt Injection Detection Engine (PIDE)

Python Version License: MIT FastAPI Gradio UI

An enterprise-grade, multi-layered security gateway designed to intercept, analyze, and mitigate prompt-injection attacks against Large Language Models (LLMs).


Overview

Prompt Injection Detection Engine (PIDE) is a high-performance security layer built to safeguard LLM applications from malicious prompt manipulation. Moving beyond single-point validation, PIDE executes a robust, multi-tier pipeline incorporating a lightning-fast rule-based Layer 1 regex engine, embedding similarity checks, heuristic analysis, and dynamic risk scoring.


Core Architecture & Detection Layers

Layer / Module Mechanism & Logic Objective
Layer 1 Rule-Based Regex Engine Instant pattern matching for known injection signatures ($O(N)$).
Layer 2 Embedding Similarity & FAISS Vector-space semantic distance analysis against known malicious exemplars.
Layer 3 Heuristic & Risk Scoring Behavioral weighting and dynamic multi-variable scoring thresholds.
API Gateway FastAPI REST Gateway Low-latency asynchronous request handling and secure wrapper integration.
Playground UI Gradio Interactive Interface Real-time monitoring, live auditing, and payload testing dashboard.

Application Interface & System Preview

1. PIDE Main Interface

PIDE Main Interface

2. Interactive Playground & Detection Engine

PIDE Interface Playground

3. Execution Logs & Detailed Threat Output

Output Details and Threat Analysis

4. Live Pipeline Simulation Sample

Example Simulation View

Quick Start (No Extra Files Needed)

1. Clone the Repository

git clone [https://github.com/AyeshaaRafaqat/Prompt-Injection-Detection-Engine.git](https://github.com/AyeshaaRafaqat/Prompt-Injection-Detection-Engine.git)
cd Prompt-Injection-Detection-Engine

About

Prompt Injection Detection Engine is a state-of-the-art, multi-layered security gateway designed to intercept, analyze, and mitigate prompt injection attempts before they reach the core LLM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages