bananyadas/IntegrityOps
0
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Overview
IntegrityOps or SecureLLM Gateway is a plug-and-play security layer designed for enterprise deployment of Large Language Models (LLMs). It acts as a middleware between client applications and LLM APIs, ensuring that all interactions are safe, policy-compliant, and auditable.
The system is built as a modular decision pipeline that enforces safety at every stage of the inference lifecycle, including input validation, risk assessment, controlled generation, and output filtering.
Problem Statement
Modern LLM systems are vulnerable to:
- Prompt injection attacks
- Harmful or unsafe content generation
- Over-enforcement or under-enforcement in moderation
- Lack of auditability and explainability
Solution
SecureLLM Gateway introduces a layered security architecture that:
- Filters and sanitizes inputs
- Classifies risk and intent
- Enforces policy constraints
- Validates model outputs
- Monitors behavior and anomalies
- Logs every decision for audit and compliance
Key Components
1. Input Firewall
- Sanitizes incoming data
- Prevents malformed or adversarial inputs
- Enforces structured observation format
2. Risk & Intent Classifier
- Analyzes content signals (e.g. virality, harmful patterns)
- Computes urgency and severity
- Prioritizes high-risk cases
3. Policy Enforcement Engine
- Encodes moderation guidelines
- Balances:
- Harm reduction
- Fairness
- Calibration under uncertainty
- Supports deterministic fallback policies
4. LLM Decision Core
- Uses OpenAI API
- Generates structured JSON actions
- Operates with temperature = 0 for deterministic behavior
5. Output Safety Filter
- Validates:
- action type
- confidence range
- schema correctness
6. Behavioral Monitoring & Audit Logging
- Tracks:
- action distribution
- fallback usage
- anomaly patterns
- Produces full execution trace for every decision
Execution Flow
- Reset environment (
/reset) - Receive observation
- Sanitize input
- Compute risk profile
- Generate action via LLM
- Validate action
- Execute step (
/step) - Log decision and monitor behavior
- Repeat until completion
Evaluation Metrics
The system is evaluated across multiple dimensions:
- Final Score
- Harm Reduction
- Policy Quality
- Prioritization Quality
- Calibration Quality
- Fairness
- Efficiency ---
🛠️ Setup & Usage
1. Environment Variables
API_BASE_URL=https://IntegrityOps.hf.space
MODEL_NAME=gpt-4.1-mini
HF_TOKEN=required_api_key
