Text Generation
PEFT
Safetensors
Transformers
English
Turkish
lora
sft
trl
security
guardrails
multilingual
conversational
Instructions to use ApiFort/LLMFort-pii with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ApiFort/LLMFort-pii with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507") model = PeftModel.from_pretrained(base_model, "ApiFort/LLMFort-pii") - Transformers
How to use ApiFort/LLMFort-pii with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ApiFort/LLMFort-pii") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ApiFort/LLMFort-pii", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ApiFort/LLMFort-pii with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ApiFort/LLMFort-pii" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ApiFort/LLMFort-pii", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ApiFort/LLMFort-pii
- SGLang
How to use ApiFort/LLMFort-pii with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ApiFort/LLMFort-pii" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ApiFort/LLMFort-pii", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ApiFort/LLMFort-pii" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ApiFort/LLMFort-pii", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ApiFort/LLMFort-pii with Docker Model Runner:
docker model run hf.co/ApiFort/LLMFort-pii
File size: 4,958 Bytes
b2ec780 4cdfb62 b2ec780 4cdfb62 b2ec780 4cdfb62 b2ec780 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | ---
base_model: Qwen/Qwen3-4B-Instruct-2507
library_name: peft
pipeline_tag: text-generation
tags:
- base_model:adapter:Qwen/Qwen3-4B-Instruct-2507
- lora
- sft
- transformers
- trl
- security
- guardrails
- multilingual
language:
- en
- tr
---
# π‘οΈ LLM-Fort Guardrails Suite (v1)
[](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
[](https://github.com/huggingface/peft)
[](https://huggingface.co/collections/ApiFort/llmfort-guardrails-v1)
LLM-Fort Guardrails is a suite of **7 security-focused LoRA adapters** fine-tuned on top of **Qwen/Qwen3-4B-Instruct-2507**. These adapters serve as lightweight, high-performance security guardrails mapped to critical safety boundaries.
By offloading classification and security checks to lightweight adapters, the system achieves enterprise-grade security filtering without degrading the inference performance of the main application model.
π Collection Page: [ApiFort/llmfort-guardrails-v1](https://huggingface.co/collections/ApiFort/llmfort-guardrails-v1)
---
## πΊοΈ Category Mappings
| Vulnerability Category | Adapter Model ID | Description |
|:---|:---|:---|
| π¨ **[Prompt Injection](https://huggingface.co/ApiFort/jailbreak_content_injection)** | `jailbreak_content_injection` | Detects direct/indirect prompt injection and jailbreak attempts |
| π΅οΈ **[PII Extraction](https://huggingface.co/ApiFort/pii)** | `pii` | Identifies and extracts PII (person names, ID numbers, etc.) |
| π» **[Code Security](https://huggingface.co/ApiFort/code_security)** | `code_security` | Scans code snippets for software vulnerabilities (SQLi, SSRF, XSS) |
| π¦ **[Excessive Agency](https://huggingface.co/ApiFort/excessive_agency)** | `excessive_agency` | Intercepts unauthorized or destructive critical tool calls |
| π **[System Prompt Leakage](https://huggingface.co/ApiFort/system_prompt_leakage)** | `system_prompt_leakage` | Detects attempts to extract developer system instructions |
| β οΈ **[Content Safety](https://huggingface.co/ApiFort/content_safety)** | `content_safety` | Blocks hate speech, harassment, and general unsafe content |
| π **[Unbounded Consumption](https://huggingface.co/ApiFort/unbounded_consumption)** | `unbounded_consumption` | Mitigates resource exhaustion and compute DoS attacks |
---
## π Performance & Evaluation
Visual comparison of baseline performance versus the trained adapters:

### Benchmark Results
Below is the exact accuracy performance measured across our evaluation test suites:
| Category | Gemma 4-E4B-it | Qwen 3.5 4B | Qwen3 4B Instruct | llmfort ai guardrail v.1.0 |
|:---|:---:|:---:|:---:|:---:|
| **[Prompt Injection](https://huggingface.co/ApiFort/jailbreak_content_injection)** | 56.30% | 64.70% | 84.14% | **98.10%** |
| **[PII Extraction](https://huggingface.co/ApiFort/pii)** | 84.36% | 75.84% | 78.31% | **95.30%** |
| **[Code Security](https://huggingface.co/ApiFort/code_security)** | 83.30% | 75.10% | 76.20% | **90.07%** |
| **[Excessive Agency](https://huggingface.co/ApiFort/excessive_agency)** | 60.90% | 68.80% | 53.80% | **96.50%** |
| **[System Prompt Leakage](https://huggingface.co/ApiFort/system_prompt_leakage)** | 79.40% | 79.70% | 78.70% | **98.08%** |
| **[Content Safety](https://huggingface.co/ApiFort/content_safety)** | 84.00% | 78.80% | 76.00% | **95.30%** |
| **[Unbounded Consumption](https://huggingface.co/ApiFort/unbounded_consumption)** | 63.00% | 63.30% | 55.00% | **99.79%** |
---
## ποΈ Training & Validation Datasets
The adapters were trained and validated on the following dataset references:
| Category | Source Datasets / References |
|:---|:---|
| **[Prompt Injection](https://huggingface.co/ApiFort/jailbreak_content_injection)** | BIPIA, Deepset, Internal 1K Validation |
| **[PII Extraction](https://huggingface.co/ApiFort/pii)** | AI4Privacy PII Masking 300k (EN, TR, FR, DE, ES) |
| **[Code Security](https://huggingface.co/ApiFort/code_security)** | r2vul, securecode_web |
| **[Excessive Agency](https://huggingface.co/ApiFort/excessive_agency)** | jinjinyien/ToolSafety, minpeter/xlam-function-calling-60k-parsed |
| **[System Prompt Leakage](https://huggingface.co/ApiFort/system_prompt_leakage)** | S-Labs/prompt-injection-dataset, Synthetic data |
| **[Content Safety](https://huggingface.co/ApiFort/content_safety)** | NVIDIA Nemotron-3.5-Content-Safety-Dataset, Wildguardmix |
| **[Unbounded Consumption](https://huggingface.co/ApiFort/unbounded_consumption)** | neuralchemy/prompt-injection-Threat-Matrix, Lakera/mosscap_prompt_injection | |