Module 4

Architecture Anti-Patterns

Common mistakes in AI implementation that create systemic risk.

The 'Black Box' Fallacy

Trusting LLM outputs without a verification layer.

Common Anti-Patterns

Avoid these implementation traps: • The Prompt-as-Code Pattern: Putting business logic entirely in the system prompt. • The Direct-to-DB Agent: Giving an LLM agent write-access to production DBs without a middle-tier API. • The Silent Failure: Using LLMs in a way that they can fail semi-correctly without alerting the system.

The Correct approach

The Verification Loop: 1. Input $ ightarrow$ 2. LLM $ ightarrow$ 3. Deterministic Validator $ ightarrow$ 4. Output. Never skip step 3.

The Semantic Gap

Technical correctness $ eq$ Semantic correctness. A prompt can be syntactically perfect but logically disastrous.

Red-Teaming Checklist

Audit all 'system prompt' dependencies
Verify all Agent tool-calls have strict schemas ✓
Implement output validation for all LLM responses
Check for prompt-leaking vulnerabilities
Previous
Current: /cyber-security-course/modules/antipatterns
Next