Building a Secure LLM Proxy with Fine‑Tuned Gemma 3 for Production Applications
说明与用途
AEGIS 是一个轻量级代理,使用 MIME 验证、OCR、PII 清理、Gemma 3 安全分类器和 Web 内容清理,保护 LLM 接口免受 PII 泄露、提示注入和恶意文件的影响。
问题
Freelance developers and small agencies need a low‑cost, lightweight security layer to protect client‑facing LLM endpoints from accidental PII leakage, prompt injection, and malicious payloads in documents or web context.
结果
AEGIS provides a drop‑in security proxy that sanitizes PII, neutralizes prompt injections, de‑weaponizes uploaded documents, and filters web context, enabling independent developers to offer a compliance layer on modest budgets.
工作流
- Receive untrusted payload (text, PDF, image, web search)
- Layer 1: Magika deep MIME & polyglot verification
- Layer 2: Dual‑stream OCR & hidden text extraction
- Layer 3: Context‑aware Presidio + regex PII scrubber (redacts
<EMAIL>,<PHONE>,<API_KEY>) - Layer 4: Fine‑tuned Gemma 3 / LoRA safety classifier (detects prompt injections & malicious payloads)
- Layer 5: Sanitized web retrieval via SerpApi (filters poisoned knowledge)
- Forward clean, verified context to target LLM
- Return response to user
证据
AEGIS is a lightweight, drop‑in security proxy that developers can place in front of their LLM endpoints.
It acts as an intermediary gateway that sanitizes personal data in real time, inspects and OCRs uploaded documents, evaluates prompt safety using an open‑source fine‑tuned Gemma 3 model, and provides sanitized web retrieval through SerpApi.
The gateway handles inbound requests across multiple input types. Plain text prompts are stripped of credentials and personal identifiers before being evaluated by the safety classifier.
For file uploads undergo deep MIME verification and visual OCR to detect obscured text before text extraction proceeds.
- 记录日期: 2026-10-18T08:41:06.633Z