ai

RAG Architecture กับ Site Reliability

rag architecture site reliability sre
RAG Architecture กับ Site Reliability

RAG Architecture คืออะไร

RAG Architecture กับ Site Reliability

RAG (Retrieval-Augmented Generation) เป็นสถาปัตยกรรมที่รวม 2 ส่วนหลักเข้าด้วยกัน คือ Retrieval Component ที่ค้นหาข้อมูลที่เกี่ยวข้องจาก Knowledge Base (มักเป็น Vector Database) และ Generation Component ที่ใช้ LLM สร้างคำตอบจาก Context ที่ค้นพบ ทำให้ LLM ตอบคำถามได้ถูกต้องและอ้างอิงข้อมูลจริง ลดปัญหา Hallucination ที่เป็นจุดอ่อนหลักของ LLM

เมื่อ RAG System ถูกใช้ใน Production ที่ User จำนวนมากเข้าถึง ความเสถียร (Reliability) กลายเป็นสิ่งสำคัญมาก Site Reliability Engineering (SRE) Principles จะช่วยให้ออกแบบ RAG System ที่ทนทานต่อ Failure, Monitor ได้ครอบคลุม และ Scale ได้ตาม Traffic

RAG System Architecture สำหรับ Production

  • API Gateway: Rate Limiting, Authentication, Load Balancing
  • Query Preprocessor: Query Rewriting, Intent Classification, Cache Lookup
  • Embedding Service: แปลง Query เป็น Vector (Sentence Transformers / OpenAI)
  • Vector Database: Qdrant / Milvus / Pinecone สำหรับ Similarity Search
  • Reranker: จัดอันดับผลลัพธ์ใหม่ด้วย Cross-encoder
  • LLM Service: Generate คำตอบจาก Retrieved Context
  • Response Validator: ตรวจสอบคุณภาพคำตอบ, Hallucination Detection
  • Cache Layer: Redis สำหรับ Semantic Cache ลด Latency และ Cost
RAG Architecture กับ Site Reliability

Incident Response สำหรับ RAG System

  • LLM Service Down: Circuit Breaker เปิด → Fallback ส่ง Retrieved Context กลับแทน → Alert On-call → Scale/Restart LLM Service
  • Vector DB Slow: Switch ไป Keyword Search Fallback → Alert → ตรวจสอบ Index Health และ Resource Usage
  • High Latency: เพิ่ม Cache TTL → Scale Embedding/LLM Workers → ตรวจสอบ GPU Utilization
  • Hallucination Spike: ตรวจสอบ Retrieval Relevance → อาจมี Data Quality Issue → Update Knowledge Base
  • Error Budget Exhausted: Freeze Deployments → Focus on Reliability → ทำ Post-mortem

RAG Architecture คืออะไร

RAG (Retrieval-Augmented Generation) รวม Information Retrieval กับ LLM Generation ดึงข้อมูลจาก Vector Database มาเป็น Context ให้ LLM ตอบคำถามได้ถูกต้องและอ้างอิงข้อมูลจริง ลด Hallucination ใช้ใน Chatbot, Knowledge Base, Customer Support

XM Legend · เทรดเดอร์ & ผู้สอน Forex 13 ปี

ผู้ก่อตั้ง SiamCafe ตั้งแต่ปี 1997 · เทรดเดอร์สาย Forex มากกว่า 13 ปี ได้รับการยกย่องเป็น XM Legend · แบ่งปันความรู้ Forex, ไอที, AI และการเทรด จากประสบการณ์จริงในตลาดจริง