Q: What are the main security concerns with LLMs?
A:
- Prompt Injection: Malicious inputs that override instructions
- Data Leakage: Training data or sensitive info exposure
- Jailbreaking: Bypassing safety guardrails
- Model Theft: Stealing model weights or architecture
- Adversarial Attacks: Inputs that cause misbehavior
Q: Explain prompt injection types.
A:
- Direct: User input is the attack ("ignore previous")
- Indirect: Data from external sources contains attack
- Jailbreaking: Tricking model into unsafe behavior
Q: How do you prevent prompt injection?
A:
- Input validation and sanitization
- Separate user input from system prompts
- Use structured outputs (JSON mode)
- Implement output filtering
- Rate limiting and monitoring
- Multi-layered defense
Q: How do you secure an AI inference endpoint?
A:
- Authentication (API keys, OAuth)
- Rate limiting
- Input validation
- Output sanitization
- Audit logging
- Cost controls
- DDoS protection
Q: Design a secure AI chatbot architecture.
A:
┌─────────────────────────────────────────┐
│ User Input │
└──────────────────┬──────────────────────┘
▼
┌─────────────────────────────────────────┐
│ Input Guardrails │
│ - Prompt injection detection │
│ - Content filtering │
│ - Rate limiting │
└──────────────────┬──────────────────────┘
▼
┌─────────────────────────────────────────┐
│ LLM Inference │
│ - System prompt isolation │
│ - Limited context window │
└──────────────────┬──────────────────────┘
▼
┌─────────────────────────────────────────┐
│ Output Guardrails │
│ - PII/PHI filtering │
│ - Hallucination detection │
│ - Safety checks │
└─────────────────────────────────────────┘
Next: Review AIOps Interview questions.