RAG技术教程-学习笔记-系列总览

RAG技术教程-学习笔记-系列总览

1. RAG 技术教程:从原理到生产实践

本系列基于吴恩达(Andrew Ng)与 An Hassan 合作的 RAG 课程内容整理,面向有基础知识的开发者,系统讲解检索增强生成(RAG)技术从原理到生产部署的完整知识体系。

1.1 学习路径

#mermaid-svg-xI6Rzrz95HaVPdB0{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-xI6Rzrz95HaVPdB0 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-xI6Rzrz95HaVPdB0 .error-icon{fill:#552222;}#mermaid-svg-xI6Rzrz95HaVPdB0 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-xI6Rzrz95HaVPdB0 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-xI6Rzrz95HaVPdB0 .marker.cross{stroke:#333333;}#mermaid-svg-xI6Rzrz95HaVPdB0 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-xI6Rzrz95HaVPdB0 p{margin:0;}#mermaid-svg-xI6Rzrz95HaVPdB0 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-xI6Rzrz95HaVPdB0 .cluster-label text{fill:#333;}#mermaid-svg-xI6Rzrz95HaVPdB0 .cluster-label span{color:#333;}#mermaid-svg-xI6Rzrz95HaVPdB0 .cluster-label span p{background-color:transparent;}#mermaid-svg-xI6Rzrz95HaVPdB0 .label text,#mermaid-svg-xI6Rzrz95HaVPdB0 span{fill:#333;color:#333;}#mermaid-svg-xI6Rzrz95HaVPdB0 .node rect,#mermaid-svg-xI6Rzrz95HaVPdB0 .node circle,#mermaid-svg-xI6Rzrz95HaVPdB0 .node ellipse,#mermaid-svg-xI6Rzrz95HaVPdB0 .node polygon,#mermaid-svg-xI6Rzrz95HaVPdB0 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-xI6Rzrz95HaVPdB0 .rough-node .label text,#mermaid-svg-xI6Rzrz95HaVPdB0 .node .label text,#mermaid-svg-xI6Rzrz95HaVPdB0 .image-shape .label,#mermaid-svg-xI6Rzrz95HaVPdB0 .icon-shape .label{text-anchor:middle;}#mermaid-svg-xI6Rzrz95HaVPdB0 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-xI6Rzrz95HaVPdB0 .rough-node .label,#mermaid-svg-xI6Rzrz95HaVPdB0 .node .label,#mermaid-svg-xI6Rzrz95HaVPdB0 .image-shape .label,#mermaid-svg-xI6Rzrz95HaVPdB0 .icon-shape .label{text-align:center;}#mermaid-svg-xI6Rzrz95HaVPdB0 .node.clickable{cursor:pointer;}#mermaid-svg-xI6Rzrz95HaVPdB0 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-xI6Rzrz95HaVPdB0 .arrowheadPath{fill:#333333;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-xI6Rzrz95HaVPdB0 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-xI6Rzrz95HaVPdB0 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-xI6Rzrz95HaVPdB0 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-xI6Rzrz95HaVPdB0 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-xI6Rzrz95HaVPdB0 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-xI6Rzrz95HaVPdB0 .cluster text{fill:#333;}#mermaid-svg-xI6Rzrz95HaVPdB0 .cluster span{color:#333;}#mermaid-svg-xI6Rzrz95HaVPdB0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-xI6Rzrz95HaVPdB0 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-xI6Rzrz95HaVPdB0 rect.text{fill:none;stroke-width:0;}#mermaid-svg-xI6Rzrz95HaVPdB0 .icon-shape,#mermaid-svg-xI6Rzrz95HaVPdB0 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-xI6Rzrz95HaVPdB0 .icon-shape p,#mermaid-svg-xI6Rzrz95HaVPdB0 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-xI6Rzrz95HaVPdB0 .icon-shape .label rect,#mermaid-svg-xI6Rzrz95HaVPdB0 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-xI6Rzrz95HaVPdB0 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-xI6Rzrz95HaVPdB0 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-xI6Rzrz95HaVPdB0 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 模块一

RAG 概述
模块二

信息检索与搜索基础
模块三

向量数据库与信息检索
模块四

LLM 与文本生成
模块五

生产环境中的 RAG 系统

1.2 系列目录

模块 标题 核心内容 建议学习时间
RAG 入门:从"模型不知道的事"到检索增强生成 RAG 定义、系统架构、LLM 基础、检索器角色、应用场景 1-2 小时
RAG 检索器:关键词、语义与混合搜索的技术选型 TF-IDF、BM25、嵌入模型、混合搜索 RRF、检索评估 2-3 小时
从理论到生产:向量数据库、分块与重排序 HNSW 算法、向量数据库、分块策略、查询解析、重排序 2-3 小时
LLM 与文本生成:从 Transformer 到 Agentic RAG Transformer、采样策略、提示工程、幻觉处理、Agentic RAG 2-3 小时
生产环境中的 RAG:评估、优化与安全 评估体系、可观测性、量化、成本优化、安全、多模态 2-3 小时

1.3 每篇核心要点速览

模块一:RAG = 检索器 + LLM + 知识库。核心思想是在提示中注入检索到的信息,利用 LLM 的上下文理解能力生成回答。

模块二:三种搜索技术------关键词搜索(BM25)、语义搜索(嵌入模型)、元数据过滤。生产环境使用混合搜索(RRF 融合)。

模块三:HNSW 算法实现高效向量检索。分块策略决定搜索质量,重排序是优先尝试的优化手段。

模块四:Transformer 的注意力机制是 LLM 的核心。采样参数控制生成行为,提示工程决定输出质量,Agentic RAG 是高级形态。

模块五:生产环境需要评估体系、可观测性、成本优化和安全防护。量化技术平衡性能与成本。

1.4 前置知识

本系列假设读者具备以下基础:

  • Python 基础编程能力
  • 对机器学习有初步了解(知道什么是向量、模型)
  • 了解 API 调用的基本概念

不需要的前置知识:

  • 不需要深入了解 Transformer 数学原理(模块四会讲解)
  • 不需要有 RAG 实际开发经验(从零开始)
  • 不需要数学背景(所有公式都有直观解释)

1.5 来源与版权

本系列内容基于以下课程整理:

  • 课程名称:Building and Evaluating Advanced RAG Applications
  • 讲师:An Hassan(前 Weaviate、Cohere 工程师)
  • 平台DeepLearning.AI
  • 原始内容:课程视频字幕及配套材料

本系列为学习笔记性质的二次创作内容,对原始课程内容进行了重新组织、补充说明和案例扩展。原始课程版权归 DeepLearning.AI 及讲师所有。如需引用,请注明原始课程来源。

1.6 反馈与交流

如果在阅读过程中发现错误或有改进建议,欢迎反馈。