Tất cả bài viết
LLM
LLM
RAG
NLP
Enterprise AI
Xây dựng RAG system cho Knowledge Base doanh nghiệp
Infratek AI Team·NLP Engineering10 tháng 12, 202411 phút đọc
Xây dựng RAG system cho Knowledge Base doanh nghiệp
LLM mạnh nhưng không biết gì về data nội bộ của bạn. RAG (Retrieval-Augmented Generation) là pattern phổ biến nhất để đưa enterprise knowledge vào AI.
Architecture Overview
Documents → Chunking → Embedding → Vector DB
↓
User Query → Embedding → Retrieval → Context + Query → LLM → Answer
Chunking Strategies
Chunking là bước quan trọng nhất mà nhiều team underestimate:
- Fixed-size (512 tokens) — simple nhưng mất context
- Semantic chunking — split theo paragraph/section boundaries
- Document-aware — preserve headers, tables, lists structure
- Parent-child — retrieve small chunks, return parent context
Cho technical docs tiếng Việt, chúng tôi recommend semantic + parent-child.
Embedding Model Selection
| Model | Dimensions | Vietnamese Support | Speed |
|---|---|---|---|
| text-embedding-3-large | 3072 | Good | Medium |
| multilingual-e5-large | 1024 | Excellent | Fast |
| bge-m3 | 1024 | Excellent | Fast |
Evaluation
Đừng deploy mà không evaluate. Metrics quan trọng:
- Retrieval Recall@k — relevant docs có trong top-k không?
- Answer Faithfulness — answer có grounded trong context không?
- Answer Relevance — answer có đúng câu hỏi không?
- Latency — end-to-end response time
Production Tips
- Hybrid search (vector + keyword) outperform pure vector cho technical terms
- Reranking với cross-encoder cải thiện precision đáng kể
- Cache frequent queries
- Always cite sources trong response