20.1 Why “AI-Native” Is a Distinct Discipline
Traditional cloud-native architecture optimizes for stateless, horizontally-scalable request/response workloads. AI-native architecture layers three additional concerns on top:
- Heterogeneous compute — CPU for orchestration, GPU for inference/training, and increasingly specialized accelerators (Inferentia, TPU) — each with different scaling, cost, and scheduling characteristics.
- Non-deterministic, latency-variable workloads — an LLM call can take 300ms or 30s depending on token count, model load, and provider throttling. Architecture must absorb this variance without cascading failure.
- Stateful conversational/agentic context — unlike classic stateless microservices, agents carry memory, tool state, and multi-turn context that must be externalized, versioned, and made resumable.
20.2 The 12-Factor App, Reinterpreted for AI Workloads
| Factor | Classic Meaning | AI-Native Reinterpretation |
|---|---|---|
| I. Codebase | One codebase, many deploys | One codebase per agent/service; prompts and model configs are versioned artifacts in the same repo (prompt-as-code) |
| II. Dependencies | Explicitly declare/isolate | Pin model versions explicitly (gpt-4o-2024-08-06, not gpt-4o-latest) — silent model upgrades are dependency drift |
| III. Config | Store config in environment | API keys, endpoint URLs, and temperature/top-p/max-tokens/system-prompt-version live in config, not code |
| IV. Backing services | Treat as attached resources | LLM provider (Bedrock/Azure OpenAI/Vertex), vector DB, and feature store are all swappable backing services behind an interface |
| V. Build, release, run | Strict separation | Add an eval gate between build and release — a prompt/model change is a release candidate that must pass an offline eval suite before promotion |
| VI. Processes | Stateless, share-nothing | Inference processes are stateless; conversation state and agent memory live externally (Redis, DynamoDB, Cosmos DB) |
| VII. Port binding | Self-contained service | Model-serving containers (vLLM, TorchServe, Triton) expose OpenAI-compatible ports for drop-in provider swap |
| VIII. Concurrency | Scale via process model | Scale via request batching (continuous batching in vLLM) in addition to horizontal replica scaling — GPU utilization depends on batch size, not just replica count |
| IX. Disposability | Fast startup/graceful shutdown | GPU pods have slow startup (model load can be 60–300s) — mitigate with warm pools, not fast disposability alone |
| X. Dev/prod parity | Keep environments similar | Use smaller/quantized models in dev deliberately for cost, but run the eval suite against the prod model before release to catch behavior drift |
| XI. Logs | Treat as event streams | Log full prompt/response pairs (redacted of PII) as structured events for eval, audit, and drift detection — not just metrics |
| XII. Admin processes | Run as one-off processes | Re-indexing a vector store, re-embedding a corpus, or re-running an eval suite are admin processes — run them as Kubernetes Jobs, not ad hoc scripts |
20.3 Reference Architecture — Enterprise AI Platform
┌─────────────────────────────────────────────────────────────────┐
│ API Gateway / CDN / WAF │
│ (Rate limiting, Auth, DDoS protection) │
└──────────────────────────┬───────────────────────────────────────┘
│
┌───────────────────────────▼──────────────────────────────────────┐
│ Application Layer │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Domain │ │ Domain │ │ Domain │ │ Orchestr.│ │
│ │ Service A│ │ Service B│ │ Service C│ │ /BFF │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
└───────┼──────────────┼──────────────┼──────────────┼─────────────┘
│ │ │ │
┌───────▼──────────────▼──────────────▼──────────────▼─────────────┐
│ AI/ML Layer │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ LLM │ │ NLP/ML │ │ Custom │ │ Document │ │
│ │ Gateway │ │ Pipeline │ │ Models │ │ Intel. │ │
│ │(Bedrock/ │ │(SageMaker│ │(SageMaker│ │(Textract/│ │
│ │ AzureOAI)│ │/Azure ML)│ │ Endpoint)│ │ Doc Intel│ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
└───────┼──────────────┼──────────────┼──────────────┼──────────────┘
│ │ │ │
┌───────▼──────────────▼──────────────▼──────────────▼──────────────┐
│ Data Layer │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Vector DB│ │ Data │ │ Feature │ │ Object │ │
│ │(OpenSrch/│ │ Warehouse│ │ Store │ │ Storage │ │
│ │AI Search)│ │(Redshift/│ │ │ │(S3/Blob) │ │
│ │ │ │Synapse) │ │ │ │ │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└──────────────────────────────────────────────────────────────────┘
Key architectural decisions to defend in an interview:
- LLM Gateway as an abstraction layer: never call a provider SDK directly from a domain service. A gateway (self-built or LiteLLM/Portkey-style) gives you provider fallback, cost tracking, PII redaction, and centralized guardrails.
- Vector DB stays inside the VPC/VNet for regulated data — this is why OpenSearch/AI Search often beats a SaaS vector DB for enterprise deals.
- Feature store decouples training and serving — the same feature computation logic must produce identical values offline (training) and online (inference) to avoid train/serve skew.
20.4 Interview Q&A
Q1: What does “cloud-native” mean for an AI workload specifically, versus a traditional web app?
A: Cloud-native traditionally means containerized, horizontally scalable, stateless, and API-driven. For AI workloads I extend this with three things: (1) heterogeneous scheduling — GPU and CPU pools need separate autoscaling policies because GPU nodes are expensive and slow to boot; (2) externalized conversational state — an agent’s session must survive pod restarts, so memory lives in Redis/DynamoDB, not in-process; (3) a release pipeline that treats prompts and model versions as first-class deployable artifacts with their own eval gate, not just code. The 12-factor principles still apply, but “config” now includes model parameters, and “logs” now includes full prompt/response pairs for auditability.
Q2: How do you avoid vendor lock-in when building on Bedrock or Azure OpenAI?
A: Introduce an LLM gateway abstraction (interface with
generate(),embed(),stream()) so domain services never import a provider SDK directly. Behind that interface, route to Bedrock, Azure OpenAI, or a self-hosted vLLM endpoint based on config. This also enables cost-based routing (cheap model for simple queries, frontier model for complex reasoning) and provider failover during outages. The trade-off is you lose access to provider-specific features (e.g., Bedrock Agents’ native tool orchestration) unless you build an adapter for each.