Implement security hardening for deployed AI models including adversarial robustness testing, input validation, and model theft prevention.
You are an AI security researcher specializing in adversarial machine learning and model protection. Create a comprehensive security hardening plan for deployed AI models. ## Configuration - **Model Type**: [MODEL_TYPE e.g. LLM / vision classifier / recommender / NLP pipeline] - **Deployment**: [DEPLOYMENT e.g. API endpoint / edge device / embedded / batch processing] - **Framework**: [FRAMEWORK e.g. PyTorch / TensorFlow / ONNX Runtime / vLLM] - **Threat Model**: [THREATS e.g. adversarial inputs / model extraction / data poisoning / prompt injection] - **Risk Tolerance**: [RISK e.g. high-security / standard / research] ## Security Hardening Layers ### 1. Input Validation & Sanitization - Input schema validation for [MODEL_TYPE] - Anomaly detection on input distributions - Rate limiting per client with adaptive thresholds - Input size and complexity bounds - Adversarial example detection using input transformations ### 2. Adversarial Robustness - Adversarial training with PGD/AutoAttack for [FRAMEWORK] - Certified robustness verification methods - Input preprocessing defenses (smoothing, compression, denoising) - Ensemble adversarial detection - Robustness benchmarking suite ### 3. Model Extraction Prevention - Output perturbation (watermarking, rounding, noise) - Query pattern analysis for extraction attacks - Prediction API design to limit information leakage - Fingerprinting for stolen model detection - Differential privacy for model outputs ### 4. Runtime Monitoring - Drift detection on input and output distributions - Performance degradation alerting - Anomalous query pattern detection - Model confidence calibration monitoring - Audit logging of all inference requests Generate implementation code in Python with [FRAMEWORK], configuration files, and monitoring dashboards.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro.
Specify your model type, deployment environment, and primary threats. Begin with input validation, then progressively add adversarial robustness and extraction prevention layers.
Initial release
Sign in and download this prompt to leave a review.