12. RAG Deployment Patterns¶
Category: Production RAG Engineering
Module: Part VI โ Production Deployment
Difficulty: Advanced
๐ Overview¶
Deploying a RAG system is not simply a matter of running an API and connecting it to a vector database.
A production RAG deployment must account for:
Application Deployment
โ
Retrieval Deployment
โ
Index Deployment
โ
Model Deployment
โ
Knowledge Deployment
โ
Configuration Deployment
โ
Observability
โ
Security
โ
Scalability
โ
Rollback
Different workloads require different deployment patterns.
For example:
Small Internal RAG
โ Single Service
Enterprise RAG
โ Microservices
High-Traffic RAG
โ Horizontally Scaled Services
High-Risk RAG
โ Canary / Blue-Green
Global RAG
โ Multi-Region
Frequently Changing RAG
โ Independent Index Deployment
The goal is not to choose the most complex deployment pattern.
The goal is to choose the simplest deployment architecture that satisfies the required quality, availability, latency, security, scalability, and cost objectives.
๐ฏ Learning Objectives¶
After completing this chapter, you will be able to:
- Understand major RAG deployment patterns
- Design monolithic RAG deployments
- Design modular RAG deployments
- Design microservice-based RAG platforms
- Understand serverless RAG deployment
- Deploy RAG using containers
- Deploy RAG using Kubernetes
- Design blue-green deployments
- Design rolling deployments
- Design canary deployments
- Design shadow deployments
- Design A/B deployments
- Design multi-region RAG
- Design active-active architectures
- Design active-passive architectures
- Deploy retrieval and generation independently
- Deploy indexes independently from application code
- Design model rollout strategies
- Design embedding migration strategies
- Design zero-downtime RAG deployments
- Design rollback mechanisms
- Design disaster recovery
- Design deployment pipelines
- Build CI/CD quality gates
- Design environment strategies
- Understand infrastructure-as-code for RAG
- Design deployment observability
- Choose appropriate deployment patterns based on workload requirements
๐ง 1. Why RAG Deployment Is Different¶
Traditional backend deployment often looks like:
RAG introduces additional deployable components:
Application
Retriever
Embedding Model
Vector Index
Keyword Index
Reranker
Prompt
LLM
Knowledge Base
Configuration
Evaluation Dataset
Therefore:
It is a coordinated deployment of multiple versioned artifacts.
๐ง 2. RAG Deployment Surface¶
flowchart TD
A["RAG System"] --> B["Application"]
A --> C["Retrieval"]
A --> D["Indexes"]
A --> E["Models"]
A --> F["Prompts"]
A --> G["Knowledge"]
A --> H["Configuration"]
B --> I["Deployment"]
C --> I
D --> I
E --> I
F --> I
G --> I
H --> I
๐ง 3. Version Everything¶
A production RAG deployment should identify:
Application Version
Retriever Version
Embedding Version
Index Version
Reranker Version
Prompt Version
LLM Version
Configuration Version
Knowledge Version
Example:
{
"application": "v12",
"retriever": "v8",
"embedding": "v4",
"index": "v17",
"reranker": "v3",
"prompt": "v9",
"model": "model-x",
"configuration": "v11"
}
This enables:
๐ง 4. Deployment Units¶
A mature RAG platform may have:
API Service
Query Service
Retrieval Service
Reranking Service
Generation Service
Ingestion Worker
Indexing Worker
Evaluation Service
Not every system needs all of them as separate services.
๐ง 5. Deployment Granularity¶
There are several options:
Choose based on:
๐ง 6. Pattern 1 โ Monolithic RAG¶
The simplest deployment:
RAG Application
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โผ โผ โผ
Retrieval Context LLM
โ โ โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โผ
Response
Everything runs inside one application.
๐ง 7. Monolithic Deployment¶
Docker Container
โ
โโโ API
โโโ Retrieval
โโโ Prompt
โโโ Validation
โโโ Generation
External:
๐ง 8. Advantages of Monolithic RAG¶
Simple
Easy to Develop
Easy to Debug
Low Operational Overhead
Low Network Overhead
Easy Local Deployment
๐ง 9. Limitations¶
Independent Scaling is Difficult
Large Deployment Unit
Higher Blast Radius
Retrieval and Generation Coupled
Harder Provider Isolation
๐ง 10. When to Use¶
Good for:
Avoid unnecessary microservices at this stage.
๐ง 11. Pattern 2 โ Modular Monolith¶
A stronger intermediate architecture:
RAG Application
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โผ โผ โผ
Query Module Retrieval Module Generation
โ โ โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โผ
Response
The modules have explicit interfaces but run in one process.
๐ง 12. Why Modular Monolith?¶
It provides:
without immediately introducing distributed-system complexity.
๐ง 13. Pattern 3 โ Microservice RAG¶
At larger scale:
flowchart TD
A["API Gateway"] --> B["RAG Orchestrator"]
B --> C["Query Service"]
B --> D["Retrieval Service"]
B --> E["Generation Service"]
D --> F["Vector Search"]
D --> G["Keyword Search"]
E --> H["Model Gateway"]
I["Ingestion Service"] --> J["Indexing"]
๐ง 14. Microservice Boundaries¶
Potential services:
Query Service
Retrieval Service
Reranking Service
Context Service
Generation Service
Ingestion Service
Indexing Service
Evaluation Service
But do not split services purely because components exist.
๐ง 15. Independent Scaling¶
One of the strongest reasons for service separation:
They have very different scaling characteristics.
๐ง 16. Microservice Trade-Off¶
Benefits:
Costs:
Network Latency
Distributed Tracing
Operational Complexity
Service Discovery
Failure Handling
Deployment Complexity
๐ง 17. Pattern 4 โ Retrieval as a Platform¶
Multiple applications can consume a shared retrieval platform.
Retrieval Platform
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโ
โผ โผ โผ
Chat Copilot Agent
โ โ โ
โโโโโโโโโโโโโผโโโโโโโโโโโโ
โผ
Evidence
๐ง 18. Why Retrieval Platform?¶
Centralize:
Applications focus on business capabilities.
๐ง 19. Pattern 5 โ Serverless RAG¶
A serverless deployment may use:
Ingestion:
๐ง 20. Serverless Advantages¶
No Server Management
Automatic Scaling
Pay Per Use
Fast Initial Deployment
Good for Variable Traffic
๐ง 21. Serverless Limitations¶
Potential issues:
Cold Starts
Execution Limits
Concurrency Limits
Long-Running Processing
Connection Management
Vendor Coupling
๐ง 22. Good Serverless Workloads¶
Low / Variable Traffic
Event-Driven Ingestion
Document Processing
Lightweight APIs
Scheduled Evaluation
๐ง 23. Pattern 6 โ Containerized RAG¶
A common production pattern:
Possible platforms:
๐ง 24. Container Architecture¶
flowchart LR
A["Container Registry"] --> B["Deployment Platform"]
B --> C["RAG API"]
B --> D["Retrieval Worker"]
B --> E["Ingestion Worker"]
B --> F["Evaluation Worker"]
C --> G["Vector DB"]
D --> G
๐ง 25. Why Containers?¶
Containers provide:
๐ง 26. Pattern 7 โ Kubernetes RAG¶
For complex enterprise environments:
Kubernetes Cluster
โ
โโโ RAG API
โโโ Retrieval Service
โโโ Reranker
โโโ Ingestion Workers
โโโ Indexing Workers
โโโ Evaluation Workers
External:
๐ง 27. Kubernetes Scaling¶
Load Balancer
โ
โโโโโโโโโโโผโโโโโโโโโโ
โผ โผ โผ
Pod 1 Pod 2 Pod 3
โ โ โ
โโโโโโโโโโโผโโโโโโโโโโ
โผ
Retrieval
Autoscaling can respond to:
๐ง 28. Kubernetes Advantages¶
Horizontal Scaling
Self-Healing
Rolling Deployments
Service Discovery
Resource Isolation
Declarative Configuration
๐ง 29. Kubernetes Challenges¶
Do not use Kubernetes merely because it is available.
๐ง 30. Pattern 8 โ Rolling Deployment¶
Replace instances gradually.
Version 1:
Pod A
Pod B
Pod C
Pod D
โ
Update A
Pod A = V2
Pod B = V1
Pod C = V1
Pod D = V1
โ
Update B
Pod A = V2
Pod B = V2
Pod C = V1
Pod D = V1
Eventually:
๐ง 31. Rolling Deployment Advantages¶
๐ง 32. Rolling Deployment Risk¶
During rollout:
may run simultaneously.
Therefore:
must remain compatible.
๐ง 33. Pattern 9 โ Blue-Green Deployment¶
Maintain two environments:
Traffic initially:
After validation:
๐ง 34. Blue-Green Advantages¶
๐ง 35. Blue-Green RAG¶
Blue and Green may contain:
But index deployment requires additional planning.
๐ง 36. Index Blue-Green¶
This allows index rollback independently from application rollback.
๐ง 37. Pattern 10 โ Canary Deployment¶
Send a small percentage of traffic to the new version.
Monitor:
๐ง 38. Canary for RAG¶
Canary changes can include:
๐ง 39. Quality-Aware Canary¶
Traditional canary:
RAG canary should additionally monitor:
๐ง 40. Canary Promotion¶
Promotion should stop if quality or operational metrics degrade.
๐ง 41. Pattern 11 โ Shadow Deployment¶
The new version receives copied traffic but does not affect the user response.
flowchart LR
A["Production Request"] --> B["Current RAG"]
A --> C["Shadow RAG"]
B --> D["User Response"]
C --> E["Evaluation Only"]
๐ง 42. Shadow Deployment Benefits¶
Useful for testing:
against real production queries.
๐ง 43. Shadow Deployment Risk¶
Shadow systems still consume:
Therefore cost must be controlled.
๐ง 44. Pattern 12 โ A/B Deployment¶
Different users receive different versions.
Compare:
๐ง 45. A/B Testing in RAG¶
Possible experiments:
Prompt A vs Prompt B
Retriever A vs Retriever B
Chunking A vs Chunking B
Reranker A vs Reranker B
Model A vs Model B
๐ง 46. Pattern 13 โ Multi-Region¶
Global systems may deploy RAG into multiple regions.
Global Router
โ
โโโโโโโโโโโโดโโโโโโโโโโโ
โผ โผ
Region A Region B
โ โ
RAG Stack RAG Stack
โ โ
Index A Index B
๐ง 47. Why Multi-Region?¶
Reasons include:
๐ง 48. Active-Active¶
Both regions serve traffic:
Advantages:
Challenges:
๐ง 49. Active-Passive¶
One region serves traffic.
During failure:
๐ง 50. Active-Active vs Active-Passive¶
| Pattern | Availability | Complexity | Cost |
|---|---|---|---|
| Active-Active | Very High | High | High |
| Active-Passive | High | Medium | Medium |
| Single Region | Lower | Low | Lower |
Choose based on business requirements.
๐ง 51. Multi-Region Index Strategy¶
Possible approaches:
or:
or:
Selection depends on:
๐ง 52. Pattern 14 โ Edge / Regional Retrieval¶
For latency-sensitive workloads:
Useful when:
๐ง 53. Pattern 15 โ Dedicated Tenant Deployment¶
For high-value enterprise tenants:
Tenant A
โโโ RAG API
โโโ Index
โโโ Storage
Tenant B
โโโ RAG API
โโโ Index
โโโ Storage
Benefits:
Cost:
๐ง 54. Pattern 16 โ Shared RAG Platform¶
Multiple tenants share infrastructure:
RAG Platform
โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โผ โผ โผ
Tenant A Tenant B Tenant C
Isolation occurs through:
๐ง 55. Hybrid Tenant Deployment¶
A mature enterprise platform can use:
This balances:
๐ง 56. Pattern 17 โ Independent Index Deployment¶
Do not necessarily deploy the index together with application code.
The two can evolve independently.
๐ง 57. Why Independent Index Deployment?¶
Useful when:
๐ง 58. Index Deployment Pipeline¶
flowchart LR
A["Source Data"] --> B["Index Builder"]
B --> C["Evaluation"]
C --> D["Index V18"]
D --> E["Canary"]
E --> F["Production"]
๐ง 59. Embedding Migration¶
Changing embeddings can require re-indexing.
Embedding V1
โ
New Embedding V2
โ
Re-Embed Documents
โ
Build New Index
โ
Evaluate
โ
Deploy
Do not blindly replace the existing index.
๐ง 60. Dual-Index Migration¶
During migration:
Compare:
Then switch traffic.
๐ง 61. Pattern 18 โ Dual Read¶
Both systems are queried:
Useful for:
๐ง 62. Pattern 19 โ Dual Write¶
During migration:
This helps keep both indexes current.
Use carefully because it increases:
๐ง 63. Migration Strategy¶
A safer migration:
Build New
โ
Backfill
โ
Dual Write
โ
Dual Read
โ
Compare
โ
Canary
โ
Switch
โ
Retire Old
๐ง 64. Pattern 20 โ Immutable Deployment¶
Treat deployment artifacts as immutable:
Do not modify deployed artifacts in place.
๐ง 65. Reproducible Deployment¶
Given:
you should be able to reconstruct the deployment.
๐ง 66. Deployment Manifest¶
Example:
application:
version: v12
retriever:
version: v8
embedding:
version: v4
index:
version: v17
reranker:
version: v3
prompt:
version: v9
model:
version: model-x
๐ง 67. Deployment Metadata¶
Expose deployment information through:
Example:
๐ง 68. Environment Strategy¶
Use:
Each environment should have appropriate:
๐ง 69. Development Environment¶
Optimize for:
Possible:
๐ง 70. Staging Environment¶
Should resemble production enough to validate:
๐ง 71. Production Environment¶
Requires:
๐ง 72. Configuration Promotion¶
Do not copy configuration manually.
Use:
๐ง 73. Secrets Promotion¶
Never move secrets through Git.
Use:
๐ง 74. CI/CD Pipeline¶
flowchart LR
A["Git Commit"] --> B["Build"]
B --> C["Unit Tests"]
C --> D["Integration Tests"]
D --> E["RAG Evaluation"]
E --> F["Security Tests"]
F --> G["Performance Tests"]
G --> H["Build Artifact"]
H --> I["Staging"]
I --> J["Canary"]
J --> K["Production"]
๐ง 75. RAG-Specific Quality Gate¶
Traditional deployment:
RAG deployment:
Tests
โ
Retrieval Evaluation
โ
Generation Evaluation
โ
Citation Evaluation
โ
Security
โ
Performance
โ
Deploy
๐ง 76. Deployment Gate Example¶
Recall@10 >= target
AND
Groundedness >= target
AND
Citation Accuracy >= target
AND
p95 <= target
AND
Cost/request <= target
If any critical condition fails:
๐ง 77. Deployment Observability¶
Monitor deployment impact:
๐ง 78. Deployment Dashboard¶
Track:
๐ง 79. Rollback Strategy¶
Rollback may involve:
These should not necessarily be rolled back together.
๐ง 80. Application Rollback¶
Simple if deployments are immutable.
๐ง 81. Index Rollback¶
Traffic can be switched back.
๐ง 82. Prompt Rollback¶
Prompt versioning makes this possible.
๐ง 83. Model Rollback¶
Use model gateways where possible to simplify routing.
๐ง 84. Partial Rollback¶
A powerful production capability:
The system does not need to roll back every component.
๐ง 85. Zero-Downtime Deployment¶
A production RAG deployment should ideally maintain:
while replacing components.
Use:
depending on risk.
๐ง 86. Deployment Compatibility¶
During rollout:
may coexist.
Therefore ensure compatibility between:
๐ง 87. Schema Evolution¶
Example:
New fields should ideally be introduced compatibly before old fields are removed.
๐ง 88. Expand-and-Contract¶
A safer migration pattern:
Example:
Add New Metadata Field
โ
Deploy Consumers
โ
Populate Field
โ
Switch Retrieval
โ
Remove Old Field
๐ง 89. Deployment Blast Radius¶
Not every change should affect:
Use:
๐ง 90. Tenant-Based Rollout¶
Useful for enterprise platforms.
๐ง 91. Region-Based Rollout¶
Useful for global systems.
๐ง 92. Feature Flag Rollout¶
Roll out gradually:
๐ง 93. Model Deployment Patterns¶
Models can be deployed through:
๐ง 94. Managed Model Deployment¶
Advantages:
๐ง 95. Self-Hosted Model Deployment¶
Benefits:
Challenges:
๐ง 96. Model Canary¶
Compare:
๐ง 97. Prompt Deployment¶
Prompts should be treated as versioned artifacts.
Deploy independently when architecture permits.
๐ง 98. Prompt Canary¶
Evaluate:
๐ง 99. Retrieval Deployment¶
Retrieval components can also be independently deployed:
Use:
before full rollout.
๐ง 100. Deployment Pattern Selection¶
Use the following mental model:
Small System
โ
Monolith
Growing System
โ
Modular Monolith
Independent Scaling Required
โ
Microservices
Variable / Event-Driven Workload
โ
Serverless
Complex Enterprise Platform
โ
Containers / Kubernetes
High Deployment Risk
โ
Canary / Blue-Green
Global Availability
โ
Multi-Region
Migration
โ
Dual Read / Dual Write
๐ง 101. Deployment Decision Matrix¶
| Requirement | Recommended Pattern |
|---|---|
| Simple application | Monolith |
| Strong modularity | Modular Monolith |
| Independent scaling | Microservices |
| Event-driven workload | Serverless / Workers |
| Enterprise platform | Containers / Kubernetes |
| Low deployment risk | Blue-Green |
| Gradual rollout | Canary |
| Production comparison | Shadow |
| Experimentation | A/B |
| Global availability | Multi-Region |
| High isolation tenant | Dedicated |
| Migration | Dual Read / Dual Write |
| Independent index lifecycle | Separate Index Deployment |
๐ง 102. Deployment Architecture by Maturity¶
Stage 1¶
Stage 2¶
Stage 3¶
Stage 4¶
Stage 5¶
๐ง 103. Production Deployment Architecture¶
flowchart TD
A["Users"] --> B["Global Load Balancer"]
B --> C["Region A"]
B --> D["Region B"]
C --> E["RAG Gateway"]
D --> F["RAG Gateway"]
E --> G["Retrieval Platform"]
F --> H["Retrieval Platform"]
G --> I["Index A"]
H --> J["Index B"]
E --> K["Model Gateway"]
F --> L["Model Gateway"]
K --> M["LLM"]
L --> N["LLM"]
O["CI/CD"] --> P["Deployment Controller"]
P --> E
P --> F
Q["Index Pipeline"] --> I
Q --> J
R["Observability"] --> E
R --> F
R --> G
R --> H
๐ง 104. Production Deployment Workflow¶
Developer
โ
Git
โ
CI
โ
Unit Tests
โ
Integration Tests
โ
RAG Evaluation
โ
Security Tests
โ
Performance Tests
โ
Artifact
โ
Staging
โ
Canary
โ
Production
โ
Observe
โ
Promote / Rollback
๐ง 105. Deployment Safety¶
Every production deployment should answer:
What changed?
Who receives the change?
How do we measure impact?
How quickly can we rollback?
What happens to existing requests?
What happens to indexes?
What happens to cached results?
What happens if the new version fails?
๐ง 106. Cache During Deployment¶
Deployment can create stale caches.
Example:
Cache keys should include version information where appropriate:
๐ง 107. Deployment and Index Compatibility¶
Avoid:
This creates runtime failures.
Use:
during transitions.
๐ง 108. Deployment and Freshness¶
Application deployment does not automatically mean:
Keep separate lifecycles:
๐ง 109. Knowledge Deployment¶
A document update may follow:
This is a deployment of knowledge rather than application code.
๐ง 110. Knowledge Canary¶
For high-risk knowledge changes:
Useful for:
๐ง 111. Regulated RAG Deployment¶
Regulated systems may require:
๐ง 112. Approval Workflow¶
๐ง 113. GitOps¶
For Kubernetes-based environments:
Benefits:
๐ง 114. Infrastructure as Code¶
Infrastructure should be versioned:
Example:
๐ง 115. Deployment as Code¶
The same principle applies to:
๐ง 116. Immutable Artifacts¶
Examples:
Avoid mutable production artifacts.
๐ง 117. Disaster Recovery Deployment¶
A recovery architecture should define:
๐ง 118. RAG Disaster Recovery¶
flowchart LR
A["Primary Region"] --> B["Replication"]
B --> C["Secondary Region"]
A --> D["Backup"]
D --> E["Restore"]
C --> F["Failover"]
E --> F
๐ง 119. RPO / RTO¶
Define:
Example:
These are illustrative.
๐ง 120. Deployment Observability Checklist¶
โ Deployment version tracked
โ Traffic split visible
โ Error rate monitored
โ Latency monitored
โ Retrieval quality monitored
โ Groundedness monitored
โ Citation quality monitored
โ Token usage monitored
โ Cost monitored
โ Index version tracked
โ Rollback available
๐งช 121. Practical Project¶
Build a deployment platform for:
Production RAG Application
Support:
Docker
CI/CD
Staging
Canary
Blue-Green
Index Versioning
Prompt Versioning
Model Routing
Rollback
Observability
๐งช 122. Suggested Repository¶
production-rag-deployment/
โ
โโโ application/
โ โโโ rag-api/
โ โโโ retrieval/
โ โโโ generation/
โ
โโโ deployment/
โ โโโ docker/
โ โโโ kubernetes/
โ โโโ helm/
โ โโโ manifests/
โ
โโโ infrastructure/
โ โโโ terraform/
โ
โโโ ci/
โ โโโ build.yaml
โ โโโ test.yaml
โ โโโ deploy.yaml
โ
โโโ evaluation/
โ โโโ datasets/
โ โโโ gates/
โ
โโโ indexes/
โ โโโ v1/
โ โโโ v2/
โ
โโโ docs/
โโโ architecture/
โโโ deployment/
โโโ runbooks/
๐งช 123. Deployment Exercise¶
Implement:
Version 1
โ
Production
Version 2
โ
Staging
โ
Evaluation
โ
Canary 5%
โ
Canary 25%
โ
Canary 50%
โ
100%
Then deliberately introduce:
and verify:
๐งช 124. Index Deployment Exercise¶
Create:
Then:
with an improved chunking strategy.
Perform:
๐งช 125. Model Deployment Exercise¶
Compare:
using:
Measure:
๐งช 126. Multi-Region Exercise¶
Deploy:
Test:
Verify:
๐ง 127. Deployment Anti-Patterns¶
Anti-Pattern 1¶
without evaluation or canary for high-risk changes.
Anti-Pattern 2¶
all changed simultaneously without version tracking.
Anti-Pattern 3¶
with no version or rollback capability.
Anti-Pattern 4¶
Anti-Pattern 5¶
Anti-Pattern 6¶
Anti-Pattern 7¶
Anti-Pattern 8¶
with no audit trail.
๐ง 128. Deployment Design Principles¶
Principle 1 โ Deploy Small Changes¶
Principle 2 โ Separate Lifecycles¶
Treat these independently:
Principle 3 โ Automate Quality Gates¶
Principle 4 โ Make Rollback Easy¶
Rollback should be:
Principle 5 โ Prefer Progressive Delivery¶
Principle 6 โ Observe Quality¶
Traditional deployment metrics are not enough.
Track:
๐ง 129. Deployment Pattern Summary¶
MONOLITH
โ
Simple
MODULAR MONOLITH
โ
Structured
MICROSERVICES
โ
Independent Scaling
SERVERLESS
โ
Variable / Event-Driven
CONTAINERS
โ
Portable Production
KUBERNETES
โ
Complex Enterprise Platform
ROLLING
โ
Incremental Replacement
BLUE-GREEN
โ
Fast Rollback
CANARY
โ
Controlled Risk
SHADOW
โ
Production Comparison
A/B
โ
Experimentation
ACTIVE-ACTIVE
โ
High Availability
ACTIVE-PASSIVE
โ
Disaster Recovery
DUAL READ
โ
Migration
DUAL WRITE
โ
Migration Synchronization
๐ง 130. Final Mental Model¶
Production RAG deployment should be viewed as:
RAG DEPLOYMENT
โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
APPLICATION INDEX MODEL
โ โ โ
Version Version Version
โ โ โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โผ
CONFIGURATION
โ
โผ
CI / CD PIPELINE
โ
โผ
STAGING
โ
โผ
EVALUATION
โ
โผ
CANARY
โ
โโโโโโโดโโโโโโ
โผ โผ
PASS FAIL
โ โ
โผ โผ
PROMOTE ROLLBACK
โ
โผ
PRODUCTION
โ
โผ
OBSERVABILITY
โ
โผ
CONTINUOUS IMPROVEMENT
๐ง 131. Deployment Formula¶
A useful conceptual model:
๐ง 132. What Makes RAG Deployment Production-Grade?¶
A production deployment should answer:
What changed?
Which version is running?
Which index is active?
Which model is active?
Which users receive the change?
How was the change evaluated?
What is the blast radius?
How do we monitor quality?
How do we rollback?
Can we reproduce the deployment?
Can we recover from regional failure?
If these questions cannot be answered, the deployment architecture is not mature enough.
๐ 133. Key Takeaways¶
- RAG deployment involves more than deploying an application.
- Application, retrieval, index, model, prompt, knowledge, and configuration have different lifecycles.
- Version every important RAG artifact.
- Monolithic RAG is appropriate for simple systems.
- Modular monoliths provide strong boundaries without distributed-system overhead.
- Microservices become useful when components require independent scaling or ownership.
- Retrieval can be exposed as a shared platform capability.
- Serverless is useful for variable and event-driven workloads.
- Containers provide portability and predictable runtime environments.
- Kubernetes is useful for complex enterprise platforms but introduces significant operational complexity.
- Rolling deployments provide incremental replacement.
- Blue-green deployments provide clean environments and fast rollback.
- Canary deployments reduce blast radius.
- Shadow deployments allow production comparison without affecting users.
- A/B deployments enable controlled experimentation.
- Multi-region deployments improve availability and latency but increase complexity.
- Active-active architectures provide high availability at higher operational cost.
- Active-passive architectures simplify disaster recovery.
- Dedicated tenant deployment provides strong isolation at higher cost.
- Shared tenant deployment improves infrastructure efficiency but requires strong isolation controls.
- Hybrid tenant deployment balances cost and isolation.
- Indexes should have independent versioning and deployment lifecycles.
- Embedding migrations should use controlled index migration strategies.
- Dual-read and dual-write patterns can help during large migrations.
- RAG deployments should use immutable artifacts where practical.
- CI/CD pipelines should include retrieval and generation evaluation, not just unit tests.
- Quality gates should include retrieval quality, groundedness, citation quality, latency, and cost.
- Progressive delivery is particularly valuable for high-risk RAG changes.
- Deployment observability must measure AI-specific quality signals.
- Rollback should be possible for application, retriever, index, prompt, model, and configuration independently where architecture permits.
- Schema evolution must maintain compatibility during rolling deployments.
- Knowledge deployment and application deployment should be treated as separate lifecycles.
- Infrastructure should be managed through infrastructure-as-code.
- Secrets should never be stored in source control.
- Production deployments should be observable, reproducible, auditable, and reversible.
- The correct deployment pattern depends on scale, availability, security, latency, team capability, cost, and business risk.
- The objective is not the most sophisticated deployment architecture.
- The objective is safe, measurable, repeatable, scalable, and reversible RAG delivery.
๐งญ 134. Chapter Navigation¶
Part VI โ Production RAG Deployment & Operations¶
Previous:
11. Building Production RAG Systems
Next:
13. RAG Caching Strategies
Production RAG Engineering Path¶
01 Prompt Assembly
โ
02 Context Selection & Context Engineering
โ
03 Response Validation
โ
04 Citation & Source Attribution
โ
05 Enterprise Response
โ
06 RAG Evaluation & Benchmarking
โ
07 RAG Observability
โ
08 RAG Performance Optimization
โ
09 RAG Cost Optimization
โ
10 Production Retrieval Architecture
โ
11 Building Production RAG Systems
โ
12 RAG Deployment Patterns
โ
13 RAG Caching Strategies
โ
14 Multi-Tenant RAG
โ
15 RAG Testing Frameworks
โ
16 RAG Failure Patterns
Enterprise AI Engineering Handbook
Building Production-Grade Enterprise AI Systems โ One Chapter at a Time.