Run this model with HF Jobs

Run edaerer/promptwaf-sql-injection on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/edaerer/promptwaf-sql-injection. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/edaerer/promptwaf-sql-injection on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

SQL Injection Detector

A fine-tuned RoBERTa model for detecting SQL injection attacks in prompts before they reach an LLM.

Overview

This model is part of PromptWAF β€” a multi-layered ML-based Web Application Firewall designed to detect and block prompt injection attacks.

The model identifies prompts containing SQL command injection patterns ('; DROP TABLE, OR 1=1, UNION SELECT, etc.) commonly used to manipulate database queries through LLM interfaces.

Model Details

  • Architecture: RoBERTa (Base)
  • Task: Binary Sequence Classification
  • Training Data: Trained on a custom, internally curated SQL injection dataset
  • Labels:
    • 0 β†’ Safe/Benign
    • 1 β†’ SQL Injection Attack

Usage

With PromptWAF

# Automatically used in PromptWAF via .env configuration
SQL_INJECTION_MODEL_DIR=edaerer/promptwaf-sql-injection

Standalone

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_id = "edaerer/promptwaf-sql-injection"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)

text = "'; DROP TABLE users;--"
inputs = tokenizer(text, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

probabilities = torch.softmax(outputs.logits, dim=-1)
score = probabilities[0][1].item()  # Malicious score

print(f"SQL Injection Risk: {score:.2%}")

Performance

  • Threshold: 0.5 (adjustable in PromptWAF)
  • Input: Max 256 tokens

Integration

This model is designed to work seamlessly with:

  • PromptWAF - The main security orchestrator
  • HuggingFace Transformers - For inference
  • Any standard sequence classification pipeline

Citation

@software{promptwaf2026,
  author = {Erer, Eda and Odabasi, Talha},
  title  = {PromptWAF: A Multi-Layered ML Defense for LLM Prompt Security},
  year   = {2026},
  url    = {https://github.com/edaerer/promptwaf}
}

License

Apache License 2.0


For more information, visit PromptWAF GitHub Repository

Downloads last month
54
Safetensors
Model size
0.1B params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for edaerer/promptwaf-sql-injection

Finetuned
(2,445)
this model