Ensemble Prompt Injection Detection
Project description
PromptForest - Fast and Reliable Injection Detector Ensemble
📖 TRY IT OUT ON A NOTEBOOK HERE!
PromptForest is a prompt injection detector ensemble focused on real-world latency and reliability.
We rely on an ensemble of small, accurate prompt detection models using a voting system to generate accurate detections.
By comparing predictions across multiple models, the system can flag prompts where models disagree, helping to reduce the risk of false negatives.
This discrepancy score enables downstream workflows such as:
- Human-in-the-loop review for high-risk or ambiguous prompts
- Adaptive throttling or alerting in production systems
- Continuous monitoring and model improvement
Quick Start
To use PromptForest, simply install the pip package and serve it at a port of your choice. It should automatically start downloading the default model ensemble.
Gated models are downloaded through our own ensemble github respository and are released in accordance to their terms and conditions.
pip install promptforest
promptforest serve --port 8000
Statistics
E2E Request Latency
Average Case: 100ms
Worst Case: 200ms
PromptForest was evaluated against the models from Deepset, ProtectAI, Meta and Vijil, with Promptforest and the SOTA model Qualifire's Sentinel V2 performing the best in terms of reliability.
| Metric | PromptForest | Sentinel v2 |
|---|---|---|
| Accuracy | 0.901 | 0.973 |
| Avg Confidence on Wrong Answers | 0.642 | 0.76 |
| Expected Calibration Error (ECE) | 0.070 | 0.096 |
| Total Model Size | ~237M params | ~600M params |
Key Insights
-
Calibrated uncertainty: PromptForest is less confident on wrong predictions than compared models, resulting in a much lower ECE.
-
Parameter efficiency: Achieves competitive reliability with <50% of the parameters.
-
Interpretability: Confidence scores can be used to flag uncertain predictions for human review.
Using Sentinel v2 as a baseline, and given that other models perform worse than Sentinel in published benchmarks, PromptForest is expected to offer more reliable and calibrated predictions than most alternatives.
Models
| Provider | Model Name |
|---|---|
| Meta | Llama Prompt Guard 86M (Built with Llama) |
| Vijil | Vijil Dome Prompt Injection Detection |
| Appleroll | PromptForest-XGB |
Current Goals
This project is actively being updated. Our current focus is on implementing weights on individual models to improve accuracy, as well as retraining the XGBoost model with an updated corpus.
Disclaimer & Limitations
PromptForest uses a combination of open-source and third-party machine learning models, including models and weights released by other organizations under their respective licenses (e.g. Meta LLaMA Prompt Guard and other public prompt-injection detectors). All third-party components remain the property of their original authors and are used in accordance with their licenses.
PromptForest is not a standalone security solution and should not be relied upon as the sole defense mechanism for protecting production systems. Prompt injection detection is an inherently adversarial and evolving problem, and no automated system can guarantee complete protection.
This project has not yet been extensively validated against real-world, large-scale, or targeted prompt-injection attacks. Results may vary depending on deployment context, model configuration, and threat model.
PromptForest is intended to be used as one layer in a defense-in-depth strategy, alongside input validation, output filtering, access control, sandboxing, monitoring, and human oversight.
License
This project is licensed under Apache 2.0. Third-party models and weights are redistributed under their original licenses (see THIRD_PARTY_LICENSES folder for details). Users must comply with these licenses.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptforest-0.7.0.tar.gz.
File metadata
- Download URL: promptforest-0.7.0.tar.gz
- Upload date:
- Size: 654.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0719c1df95e98f6ad15d27178b4f01c2d64338693af7a4bd50be505a059796b
|
|
| MD5 |
2dc08cf2b085788bff9ba1162e411e4a
|
|
| BLAKE2b-256 |
bf49e8808684d85cb5c7d92a8545feaf2cfe095415ff26f6a46cbd1a2eb945f5
|
File details
Details for the file promptforest-0.7.0-py3-none-any.whl.
File metadata
- Download URL: promptforest-0.7.0-py3-none-any.whl
- Upload date:
- Size: 677.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bcb5a192944b482a4c812e0e6c01ccf15e22465c9fdfb285c93d945f12e3b53
|
|
| MD5 |
c89bdaf2b51014d5b33587b69c721d42
|
|
| BLAKE2b-256 |
da78a4b28a14078e5768a099a162d92f4b719aa606f99688916158d507319e1c
|