สร้าง RAG รองรับ 10,000 คำถามได้อย่าง How I Built a RAG System That Answers 10,000 Questions Per Second
How I Built a RAG System That Answers 10,000 Questions Per Second 1. ปัญหาที่ต้องแก้ LLM ตอบเก่ง แต่มีปัญหา: ช้าเมื่อข้อมูลเยอะ ตอบมั่ว (Hallucination) ข้อมูลไม่อัปเดต Scale ไม่ได้ ทางออก: 👉 ใช้ RAG (Retrieval-Augmented Generation) + ออกแบบระบบให้รองรับ High Throughput 2. ภาพรวมสถาปัตยกรรม (High-Level Architecture) User Query ↓ API Gateway (Load Balancer) ↓ Query Encoder (Embedding) ↓ Vector Search (ANN) ↓ Context Builder ↓ LLM Inference ↓ Response Cache ↓ User 3. เคล็ดลับที่ทำให้เร็วระดับ 10,000 QPS 🔹 1. แยก “Retrieval” กับ “Generation” Retrieval → เร็ว, deterministic Generation → แพง, ใช้เฉพาะจำเป็น 📌 หลักคิด: อย่าให้ LLM ทำงาน ถ้าไม่จำเป็น 🔹 2. ใช้ Vector Database ที่เหมาะ สิ่งที่ต้องมี: Approximate Nearest Neighbor (ANN) In-memory index Parallel search ตัวอย่างแนวคิด (ไม่จำเป็นต้องยึดชื่อ): IVF / HNSW Shar...