完善文档

This commit is contained in:
chenxin committed 2026-09-22 10:58:39 +08:00
1 parent 192ea96eb4
commit efc08dab5e
82 files changed
+1455 -109

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
# RAG
RAG 与知识系统文档目录。
+16
View File
@@ -0,0 +1,16 @@
# Chunking
## 原则
优先保持语义完整性,而不是机械固定长度切分。
考虑:
- 标题层级
- 段落
- 代码块
- 表格
- 文档结构
- Token 长度
Chunk 必须携带可追溯 metadata。
+12
View File
@@ -0,0 +1,12 @@
# Embedding
Embedding 用于把文本、实体或其他内容映射到向量空间。
要求:
- 明确模型版本
- 明确维度
- 保存模型标识
- 模型变更时考虑重建索引
Embedding 与业务代码通过统一接口隔离。
+13
View File
@@ -0,0 +1,13 @@
# RAG Evaluation
评估至少覆盖:
- Recall
- Precision
- MRR
- NDCG
- Context Relevance
- Answer Faithfulness
- Citation / Source Accuracy
评估集应版本化,模型、Embedding、Chunking 或检索策略发生重要变化时重新评估。
+13
View File
@@ -0,0 +1,13 @@
# RAG Ingestion
流程:
`File -> Parse -> Normalize -> Chunk -> Metadata -> Embedding -> Index`
解析工具:
- unstructured
- PyMuPDF
- MarkItDown
每个 chunk 应保留来源、文档 ID、位置和版本信息。
+29
View File
@@ -0,0 +1,29 @@
# RAG
## 架构
```mermaid
flowchart LR
Query --> Understanding
Understanding --> BM25
Understanding --> Vector
Understanding --> Graph
BM25 --> Fusion
Vector --> Fusion
Graph --> Fusion
Fusion --> Reranker
Reranker --> Compression
Compression --> LLM
```
## 检索
采用 Hybrid Retrieval:
- Keyword
- BM25
- Vector
- Graph
- Metadata Filter
最终通过 Reranker 与 Context Compression 提高上下文质量。
+9
View File
@@ -0,0 +1,9 @@
# Reranking
Reranker 用于对候选结果进行二次相关性排序。
典型流程:
`Recall -> Candidate Set -> Reranker -> Top K`
Reranker 不是召回器,不能替代低成本高召回率的第一阶段检索。
+12
View File
@@ -0,0 +1,12 @@
# Retrieval
支持:
- BM25
- Vector Search
- Graph Search
- Metadata Filter
推荐采用多路召回后统一融合。
检索必须保留 source metadata,确保最终上下文可追溯。