5.1 RAG系统评估工具.html 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009
  1. <!doctype html>
  2. <html lang="zh" class="no-js">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <link rel="prev" href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/%E6%95%B0%E6%8D%AE%E9%9B%86%E7%94%9F%E6%88%90%E4%B8%8E%E4%BC%98%E5%8C%96%28%E6%89%A9%E5%B1%95%E8%B5%84%E6%96%99%29.html">
  7. <link rel="next" href="5.2%20%E5%AE%9E%E7%8E%B0EnterpriseKB-RAG%E7%B3%BB%E7%BB%9F%E7%9A%84%E8%AF%84%E4%BC%B0.html">
  8. <link rel="icon" href="../img/AI.jpg">
  9. <meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.21">
  10. <title>5.1 RAG系统评估工具 - 企业知识库RAG智能问答项目V1.0</title>
  11. <link rel="stylesheet" href="../assets/stylesheets/main.2a3383ac.min.css">
  12. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  13. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&amp;display=fallback">
  14. <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
  15. <link rel="stylesheet" href="../stylesheets/extra.css">
  16. <style>
  17. .faithfulness-guide {
  18. --faith-ink: #172033;
  19. --faith-muted: #5d687a;
  20. --faith-border: #d9e1ea;
  21. --faith-blue: #1769aa;
  22. --faith-blue-soft: #eef7ff;
  23. --faith-green: #16834a;
  24. --faith-green-soft: #eefbf4;
  25. --faith-red: #c93636;
  26. --faith-red-soft: #fff3f2;
  27. --faith-amber: #a65a00;
  28. --faith-amber-soft: #fff8e8;
  29. --faith-surface: #f7f9fc;
  30. color: var(--faith-ink);
  31. margin: 1.1rem 0 2.2rem;
  32. }
  33. .faithfulness-guide * {
  34. box-sizing: border-box;
  35. }
  36. .faith-figure {
  37. margin: 0;
  38. padding: 1rem;
  39. border: 1px solid var(--faith-border);
  40. border-top: 4px solid var(--faith-blue);
  41. border-radius: 8px;
  42. background: #fff;
  43. box-shadow: 0 8px 24px rgba(23, 32, 51, 0.08);
  44. text-align: left;
  45. }
  46. .faith-figure figcaption {
  47. display: flex;
  48. align-items: center;
  49. gap: 0.55rem;
  50. max-width: none;
  51. margin: 0 0 0.9rem;
  52. color: var(--faith-ink);
  53. font-size: 1rem;
  54. font-style: normal;
  55. font-weight: 700;
  56. text-align: left;
  57. }
  58. .faith-step-label {
  59. flex: 0 0 auto;
  60. padding: 0.16rem 0.46rem;
  61. border-radius: 4px;
  62. background: var(--faith-blue);
  63. color: #fff;
  64. font-size: 0.68rem;
  65. line-height: 1.45;
  66. }
  67. .faith-flow {
  68. display: grid;
  69. grid-template-columns: 105px 28px minmax(230px, 1fr) 28px 190px;
  70. gap: 0.55rem;
  71. align-items: stretch;
  72. text-align: left;
  73. }
  74. .faith-node {
  75. min-width: 0;
  76. padding: 0.8rem;
  77. border: 1px solid var(--faith-border);
  78. border-radius: 6px;
  79. background: var(--faith-surface);
  80. }
  81. .faith-node--question {
  82. border-color: #d7c89e;
  83. background: var(--faith-amber-soft);
  84. }
  85. .faith-node--context {
  86. border-color: #b7d6ef;
  87. background: var(--faith-blue-soft);
  88. }
  89. .faith-node--answer {
  90. border-color: #c5d1df;
  91. background: #f6f8fb;
  92. }
  93. .faith-node__label {
  94. display: block;
  95. margin-bottom: 0.55rem;
  96. color: var(--faith-muted);
  97. font-size: 0.68rem;
  98. font-weight: 700;
  99. letter-spacing: 0;
  100. text-transform: uppercase;
  101. }
  102. .faith-node p {
  103. margin: 0;
  104. color: var(--faith-ink);
  105. font-size: 0.78rem;
  106. line-height: 1.6;
  107. }
  108. .faith-node strong {
  109. color: inherit;
  110. }
  111. .faith-doc-list,
  112. .faith-answer-list,
  113. .faith-verdict-list,
  114. .faith-case-list {
  115. margin: 0 !important;
  116. padding: 0 !important;
  117. list-style: none !important;
  118. }
  119. .faith-doc-list {
  120. display: grid;
  121. gap: 0.42rem;
  122. }
  123. .faith-doc-list li {
  124. display: grid;
  125. grid-template-columns: 2rem minmax(0, 1fr);
  126. gap: 0.5rem;
  127. align-items: start;
  128. margin: 0;
  129. padding: 0.45rem 0.5rem;
  130. border: 1px solid #d6e7f5;
  131. border-radius: 5px;
  132. background: #fff;
  133. }
  134. .faith-doc-list li.is-noise {
  135. border-style: dashed;
  136. background: #f8fafc;
  137. color: var(--faith-muted);
  138. }
  139. .faith-id {
  140. display: inline-flex;
  141. align-items: center;
  142. justify-content: center;
  143. width: 2rem;
  144. min-height: 1.45rem;
  145. border-radius: 4px;
  146. background: var(--faith-blue);
  147. color: #fff;
  148. font-size: 0.68rem;
  149. font-weight: 800;
  150. line-height: 1;
  151. }
  152. .faith-doc-list li.is-noise .faith-id {
  153. background: #758195;
  154. }
  155. .faith-doc-list p {
  156. color: inherit;
  157. font-size: 0.69rem;
  158. line-height: 1.45;
  159. }
  160. .faith-arrow {
  161. display: flex;
  162. flex-direction: column;
  163. align-items: center;
  164. justify-content: center;
  165. gap: 0.3rem;
  166. color: var(--faith-muted);
  167. font-size: 0.62rem;
  168. font-weight: 700;
  169. text-align: center;
  170. }
  171. .faith-arrow::after {
  172. content: "→";
  173. color: var(--faith-blue);
  174. font-size: 1.7rem;
  175. font-weight: 400;
  176. line-height: 1;
  177. }
  178. .faith-answer-list {
  179. display: grid;
  180. gap: 0.48rem;
  181. }
  182. .faith-answer-list li {
  183. display: grid;
  184. grid-template-columns: 2rem minmax(0, 1fr);
  185. gap: 0.5rem;
  186. align-items: start;
  187. margin: 0;
  188. padding: 0.46rem 0.5rem;
  189. border-left: 3px solid var(--faith-green);
  190. background: #fff;
  191. font-size: 0.7rem;
  192. line-height: 1.45;
  193. }
  194. .faith-answer-list li.is-unsupported {
  195. border-left-color: var(--faith-red);
  196. background: var(--faith-red-soft);
  197. }
  198. .faith-answer-list .faith-id {
  199. background: var(--faith-green);
  200. }
  201. .faith-answer-list li.is-unsupported .faith-id {
  202. background: var(--faith-red);
  203. }
  204. .faith-backcheck {
  205. display: grid;
  206. grid-template-columns: minmax(0, 1fr) auto;
  207. gap: 0.85rem;
  208. align-items: center;
  209. margin-top: 0.8rem;
  210. padding-top: 0.8rem;
  211. border-top: 1px dashed #b8c4d2;
  212. }
  213. .faith-backcheck__title {
  214. margin: 0 0 0.45rem;
  215. color: var(--faith-muted);
  216. font-size: 0.7rem;
  217. font-weight: 700;
  218. }
  219. .faith-verdict-list {
  220. display: flex;
  221. flex-wrap: wrap;
  222. gap: 0.42rem;
  223. }
  224. .faith-verdict-list li {
  225. margin: 0;
  226. padding: 0.35rem 0.5rem;
  227. border-radius: 4px;
  228. background: var(--faith-green-soft);
  229. color: var(--faith-green);
  230. font-size: 0.68rem;
  231. font-weight: 700;
  232. }
  233. .faith-verdict-list li.is-no {
  234. background: var(--faith-red-soft);
  235. color: var(--faith-red);
  236. }
  237. .faith-score {
  238. min-width: 8rem;
  239. padding: 0.68rem 0.85rem;
  240. border: 2px solid var(--faith-green);
  241. border-radius: 6px;
  242. background: var(--faith-green-soft);
  243. color: var(--faith-green);
  244. text-align: center;
  245. }
  246. .faith-score span {
  247. display: block;
  248. color: var(--faith-muted);
  249. font-size: 0.62rem;
  250. font-weight: 700;
  251. }
  252. .faith-score strong {
  253. display: block;
  254. margin-top: 0.12rem;
  255. font-size: 1.12rem;
  256. line-height: 1.2;
  257. }
  258. .faith-explanation {
  259. margin-top: 1.15rem;
  260. padding: 0.95rem 1rem;
  261. border-left: 4px solid var(--faith-blue);
  262. background: var(--faith-blue-soft);
  263. }
  264. .faith-explanation__lead {
  265. margin: 0 !important;
  266. color: var(--faith-ink);
  267. font-size: 0.88rem;
  268. line-height: 1.7;
  269. }
  270. .faith-explanation__lead strong {
  271. color: var(--faith-blue);
  272. }
  273. .faith-steps {
  274. display: grid;
  275. grid-template-columns: repeat(3, minmax(0, 1fr));
  276. margin-top: 0.8rem;
  277. border-top: 1px solid #c9deef;
  278. }
  279. .faith-step {
  280. min-width: 0;
  281. padding: 0.72rem 0.75rem 0 0;
  282. }
  283. .faith-step + .faith-step {
  284. padding-left: 0.75rem;
  285. border-left: 1px solid #c9deef;
  286. }
  287. .faith-step strong {
  288. display: block;
  289. margin-bottom: 0.18rem;
  290. color: var(--faith-blue);
  291. font-size: 0.75rem;
  292. }
  293. .faith-step p {
  294. margin: 0;
  295. color: var(--faith-muted);
  296. font-size: 0.7rem;
  297. line-height: 1.55;
  298. }
  299. .faith-section-title {
  300. display: flex;
  301. align-items: baseline;
  302. gap: 0.55rem;
  303. margin: 1.45rem 0 0.72rem !important;
  304. color: var(--faith-ink);
  305. font-size: 1rem !important;
  306. line-height: 1.45;
  307. }
  308. .faith-section-title span {
  309. color: var(--faith-muted);
  310. font-size: 0.68rem;
  311. font-weight: 400;
  312. }
  313. .faith-case-grid {
  314. display: grid;
  315. grid-template-columns: repeat(2, minmax(0, 1fr));
  316. gap: 0.75rem;
  317. }
  318. .faith-case {
  319. min-width: 0;
  320. padding: 0.85rem;
  321. border: 1px solid var(--faith-border);
  322. border-radius: 7px;
  323. background: #fff;
  324. }
  325. .faith-case.is-good {
  326. border-top: 4px solid var(--faith-green);
  327. }
  328. .faith-case.is-bad {
  329. border-top: 4px solid var(--faith-red);
  330. }
  331. .faith-case__head {
  332. display: flex;
  333. align-items: flex-start;
  334. justify-content: space-between;
  335. gap: 0.6rem;
  336. margin-bottom: 0.55rem;
  337. }
  338. .faith-case__head h6 {
  339. margin: 0 !important;
  340. color: var(--faith-ink);
  341. font-size: 0.79rem !important;
  342. line-height: 1.4;
  343. }
  344. .faith-case__score {
  345. flex: 0 0 auto;
  346. padding: 0.18rem 0.4rem;
  347. border-radius: 4px;
  348. background: var(--faith-green-soft);
  349. color: var(--faith-green);
  350. font-size: 0.7rem;
  351. font-weight: 800;
  352. white-space: nowrap;
  353. }
  354. .faith-case.is-bad .faith-case__score {
  355. background: var(--faith-red-soft);
  356. color: var(--faith-red);
  357. }
  358. .faith-case__answer {
  359. margin: 0 0 0.55rem !important;
  360. padding: 0.55rem 0.62rem;
  361. border-left: 3px solid #9aa8b8;
  362. background: var(--faith-surface);
  363. color: var(--faith-ink);
  364. font-size: 0.7rem;
  365. line-height: 1.55;
  366. }
  367. .faith-case__meta {
  368. display: flex;
  369. flex-wrap: wrap;
  370. gap: 0.35rem;
  371. margin-bottom: 0.5rem;
  372. }
  373. .faith-case__meta span {
  374. padding: 0.16rem 0.35rem;
  375. border: 1px solid var(--faith-border);
  376. border-radius: 4px;
  377. color: var(--faith-muted);
  378. font-size: 0.65rem;
  379. font-weight: 700;
  380. }
  381. .faith-case__conclusion {
  382. margin: 0 !important;
  383. color: var(--faith-muted);
  384. font-size: 0.68rem;
  385. line-height: 1.5;
  386. }
  387. .faith-case__conclusion strong {
  388. color: var(--faith-ink);
  389. }
  390. .faith-distinction {
  391. display: grid;
  392. grid-template-columns: repeat(2, minmax(0, 1fr));
  393. gap: 0;
  394. margin-top: 1.15rem;
  395. border: 1px solid var(--faith-border);
  396. border-radius: 6px;
  397. overflow: hidden;
  398. background: #fff;
  399. }
  400. .faith-distinction > div {
  401. padding: 0.82rem 0.9rem;
  402. }
  403. .faith-distinction > div + div {
  404. border-left: 1px solid var(--faith-border);
  405. }
  406. .faith-distinction h6 {
  407. margin: 0 0 0.28rem !important;
  408. color: var(--faith-ink);
  409. font-size: 0.75rem !important;
  410. }
  411. .faith-distinction p {
  412. margin: 0 !important;
  413. color: var(--faith-muted);
  414. font-size: 0.68rem;
  415. line-height: 1.55;
  416. }
  417. .faith-distinction strong {
  418. color: var(--faith-blue);
  419. }
  420. .faith-source-note {
  421. margin: 0.45rem 0 0 !important;
  422. color: var(--faith-muted);
  423. font-size: 0.62rem;
  424. line-height: 1.45;
  425. }
  426. .model-tag {
  427. display: inline-flex;
  428. align-items: center;
  429. justify-content: center;
  430. min-height: 1.25rem;
  431. padding: 0.12rem 0.35rem;
  432. border-radius: 4px;
  433. color: #fff;
  434. font-size: 0.58rem;
  435. font-weight: 800;
  436. line-height: 1.25;
  437. white-space: nowrap;
  438. }
  439. .model-tag--retriever {
  440. background: #596579;
  441. }
  442. .model-tag--rag {
  443. background: var(--faith-blue);
  444. }
  445. .model-tag--llm {
  446. background: #7650a8;
  447. }
  448. .model-tag--embedding {
  449. background: #087f8c;
  450. }
  451. .model-tag--compute {
  452. background: #4f5b6c;
  453. }
  454. .model-tag--human {
  455. background: var(--faith-amber);
  456. }
  457. .model-prompt {
  458. display: grid;
  459. gap: 0.38rem;
  460. margin-top: 0.65rem;
  461. padding: 0.55rem 0.62rem;
  462. border: 1px dashed #cbbbe2;
  463. border-radius: 5px;
  464. background: #fbf9ff;
  465. text-align: left;
  466. }
  467. .model-prompt--inside {
  468. margin: 0 0 0.55rem;
  469. }
  470. .model-prompt__row {
  471. display: grid;
  472. grid-template-columns: auto minmax(0, 1fr);
  473. gap: 0.48rem;
  474. align-items: start;
  475. }
  476. .model-prompt__row + .model-prompt__row {
  477. padding-top: 0.38rem;
  478. border-top: 1px solid #e4dcef;
  479. }
  480. .model-prompt__row p {
  481. margin: 0 !important;
  482. color: var(--faith-muted);
  483. font-size: 0.62rem;
  484. line-height: 1.5;
  485. }
  486. .model-prompt__row strong {
  487. color: var(--faith-ink);
  488. }
  489. .model-prompt__output {
  490. color: #7650a8;
  491. font-weight: 700;
  492. }
  493. .model-label {
  494. display: flex;
  495. flex-wrap: wrap;
  496. gap: 0.28rem;
  497. align-items: center;
  498. }
  499. .context-relevance-guide .faith-figure {
  500. border-top-color: var(--faith-blue);
  501. }
  502. .context-relevance-guide .faith-score {
  503. border-color: var(--faith-blue);
  504. background: var(--faith-blue-soft);
  505. color: var(--faith-blue);
  506. }
  507. .context-recall-guide .faith-figure {
  508. border-top-color: var(--faith-amber);
  509. }
  510. .context-recall-guide .faith-step-label {
  511. background: var(--faith-amber);
  512. }
  513. .context-recall-guide .faith-score {
  514. border-color: var(--faith-amber);
  515. background: var(--faith-amber-soft);
  516. color: var(--faith-amber);
  517. }
  518. .recall-map {
  519. display: grid;
  520. grid-template-columns: 112px minmax(0, 1fr);
  521. gap: 0.7rem;
  522. align-items: stretch;
  523. }
  524. .recall-question,
  525. .recall-compare {
  526. min-width: 0;
  527. padding: 0.72rem;
  528. border: 1px solid var(--faith-border);
  529. border-radius: 6px;
  530. }
  531. .recall-question {
  532. display: flex;
  533. flex-direction: column;
  534. justify-content: center;
  535. border-color: #d7c89e;
  536. background: var(--faith-amber-soft);
  537. }
  538. .recall-question p {
  539. margin: 0 !important;
  540. font-size: 0.72rem;
  541. line-height: 1.65;
  542. }
  543. .recall-compare {
  544. background: var(--faith-surface);
  545. }
  546. .recall-head,
  547. .recall-row {
  548. display: grid;
  549. grid-template-columns: minmax(0, 1fr) 3.35rem minmax(0, 1fr);
  550. gap: 0.42rem;
  551. align-items: stretch;
  552. }
  553. .recall-head {
  554. align-items: center;
  555. margin-bottom: 0.45rem;
  556. color: var(--faith-muted);
  557. font-size: 0.66rem;
  558. text-align: center;
  559. }
  560. .recall-head strong:first-child {
  561. color: var(--faith-blue);
  562. }
  563. .recall-head strong:last-child {
  564. color: var(--faith-amber);
  565. }
  566. .recall-head b {
  567. display: inline-flex;
  568. align-items: center;
  569. justify-content: center;
  570. min-height: 1.55rem;
  571. border-radius: 4px;
  572. background: #e8edf3;
  573. color: var(--faith-ink);
  574. font-size: 0.68rem;
  575. }
  576. .recall-row {
  577. margin-top: 0.4rem;
  578. font-size: 0.64rem;
  579. line-height: 1.45;
  580. }
  581. .recall-row > div {
  582. min-width: 0;
  583. padding: 0.48rem;
  584. border: 1px solid #d6e7f5;
  585. border-radius: 5px;
  586. background: #fff;
  587. }
  588. .recall-row > div:last-child {
  589. border-color: #ead7b3;
  590. background: #fffdf8;
  591. }
  592. .recall-row em {
  593. display: inline-flex;
  594. align-items: center;
  595. justify-content: center;
  596. min-width: 1.75rem;
  597. min-height: 1.25rem;
  598. margin-right: 0.28rem;
  599. border-radius: 4px;
  600. background: var(--faith-blue);
  601. color: #fff;
  602. font-size: 0.61rem;
  603. font-style: normal;
  604. font-weight: 800;
  605. }
  606. .recall-row > div:last-child em {
  607. background: var(--faith-amber);
  608. }
  609. .recall-row > span {
  610. display: flex;
  611. align-items: center;
  612. justify-content: center;
  613. border-radius: 4px;
  614. background: var(--faith-green-soft);
  615. color: var(--faith-green);
  616. font-size: 0.61rem;
  617. font-weight: 800;
  618. text-align: center;
  619. }
  620. .recall-row.is-missing > div:first-child {
  621. border-style: dashed;
  622. border-color: #d8dee7;
  623. background: #f4f6f8;
  624. color: var(--faith-muted);
  625. }
  626. .recall-row.is-missing > div:last-child {
  627. border-color: #f0c7c4;
  628. background: var(--faith-red-soft);
  629. }
  630. .recall-row.is-missing > span {
  631. background: var(--faith-red-soft);
  632. color: var(--faith-red);
  633. }
  634. .recall-noise {
  635. margin: 0.52rem 0 0 !important;
  636. padding: 0.42rem 0.5rem;
  637. border-left: 3px solid #8995a5;
  638. background: #fff;
  639. color: var(--faith-muted);
  640. font-size: 0.62rem;
  641. line-height: 1.5;
  642. }
  643. .recall-result {
  644. display: flex;
  645. align-items: center;
  646. justify-content: space-between;
  647. gap: 0.8rem;
  648. margin-top: 0.72rem;
  649. padding: 0.68rem 0.78rem;
  650. border: 1px solid #e2c993;
  651. border-radius: 6px;
  652. background: var(--faith-amber-soft);
  653. }
  654. .recall-result p {
  655. margin: 0 !important;
  656. color: var(--faith-muted);
  657. font-size: 0.69rem;
  658. line-height: 1.5;
  659. text-align: left;
  660. }
  661. .recall-result p > strong {
  662. color: var(--faith-amber);
  663. }
  664. .recall-result > strong {
  665. flex: 0 0 auto;
  666. color: var(--faith-amber);
  667. font-size: 0.92rem;
  668. white-space: nowrap;
  669. }
  670. .context-metric-guide .faith-case.is-mid {
  671. border-top: 4px solid var(--faith-amber);
  672. }
  673. .context-metric-guide .faith-case.is-mid .faith-case__score {
  674. background: var(--faith-amber-soft);
  675. color: var(--faith-amber);
  676. }
  677. .context-metric-guide .faith-case__answer {
  678. min-height: 3.35rem;
  679. }
  680. .context-metric-guide .faith-distinction {
  681. margin-top: 0.85rem;
  682. }
  683. .relevancy-guide .faith-figure {
  684. border-top-color: #087f8c;
  685. }
  686. .relevancy-guide .faith-step-label {
  687. background: #087f8c;
  688. }
  689. .relevancy-guide .faith-score {
  690. border-color: #087f8c;
  691. background: #eefafb;
  692. color: #087f8c;
  693. }
  694. .relevancy-average-box {
  695. min-width: 13.5rem;
  696. padding: 0.7rem 0.8rem;
  697. border: 2px solid #087f8c;
  698. border-radius: 6px;
  699. background: #eefafb;
  700. text-align: center;
  701. }
  702. .relevancy-average-box span {
  703. display: block;
  704. color: var(--faith-muted);
  705. font-size: 0.62rem;
  706. font-weight: 700;
  707. }
  708. .relevancy-average-box .model-tag {
  709. display: inline-flex;
  710. margin-right: 0.22rem;
  711. color: #fff;
  712. font-size: 0.58rem;
  713. vertical-align: middle;
  714. }
  715. .relevancy-average-box strong {
  716. display: block;
  717. margin: 0.2rem 0;
  718. color: #087f8c;
  719. font-size: 0.83rem;
  720. line-height: 1.4;
  721. }
  722. .relevancy-average-box p {
  723. margin: 0 !important;
  724. color: var(--faith-ink);
  725. font-size: 0.66rem;
  726. line-height: 1.45;
  727. }
  728. .relevancy-average-box b {
  729. color: #087f8c;
  730. font-size: 0.82rem;
  731. }
  732. .relevancy-chain-note {
  733. margin: 0.65rem 0 0 !important;
  734. padding: 0.55rem 0.65rem;
  735. border-radius: 5px;
  736. background: #fff;
  737. color: var(--faith-muted);
  738. font-size: 0.69rem;
  739. line-height: 1.55;
  740. }
  741. .relevancy-chain-note strong {
  742. color: #087f8c;
  743. }
  744. .relevancy-case-intro {
  745. margin: -0.25rem 0 0.7rem !important;
  746. color: var(--faith-muted);
  747. font-size: 0.68rem;
  748. line-height: 1.5;
  749. }
  750. .relevancy-case-grid {
  751. display: grid;
  752. grid-template-columns: repeat(3, minmax(0, 1fr));
  753. gap: 0.7rem;
  754. }
  755. .relevancy-guide .faith-case {
  756. padding: 0.75rem;
  757. }
  758. .relevancy-case__reverse {
  759. margin: 0 0 0.45rem !important;
  760. color: var(--faith-muted);
  761. font-size: 0.66rem;
  762. line-height: 1.5;
  763. }
  764. .relevancy-case__reverse strong {
  765. color: var(--faith-ink);
  766. }
  767. .relevancy-case__math {
  768. margin: 0 0 0.48rem;
  769. padding: 0.36rem 0.42rem;
  770. border-radius: 4px;
  771. background: var(--faith-surface);
  772. color: var(--faith-muted);
  773. font-size: 0.63rem;
  774. font-weight: 700;
  775. line-height: 1.45;
  776. text-align: center;
  777. }
  778. .relevancy-guide .faith-case.is-high {
  779. border-top: 4px solid var(--faith-green);
  780. }
  781. .relevancy-guide .faith-case.is-mid {
  782. border-top: 4px solid var(--faith-amber);
  783. }
  784. .relevancy-guide .faith-case.is-low {
  785. border-top: 4px solid var(--faith-red);
  786. }
  787. .relevancy-guide .faith-case.is-mid .faith-case__score {
  788. background: var(--faith-amber-soft);
  789. color: var(--faith-amber);
  790. }
  791. .relevancy-guide .faith-case.is-low .faith-case__score {
  792. background: var(--faith-red-soft);
  793. color: var(--faith-red);
  794. }
  795. .relevancy-caution {
  796. display: flex;
  797. gap: 0.65rem;
  798. align-items: flex-start;
  799. margin-top: 0.8rem;
  800. padding: 0.68rem 0.78rem;
  801. border-left: 4px solid var(--faith-amber);
  802. background: var(--faith-amber-soft);
  803. color: var(--faith-muted);
  804. font-size: 0.7rem;
  805. line-height: 1.55;
  806. }
  807. .relevancy-caution strong {
  808. flex: 0 0 auto;
  809. color: var(--faith-amber);
  810. }
  811. .relevancy-caution p {
  812. margin: 0 !important;
  813. }
  814. @media screen and (max-width: 900px) {
  815. .faith-flow {
  816. grid-template-columns: 1fr;
  817. }
  818. .relevancy-case-grid {
  819. grid-template-columns: 1fr;
  820. }
  821. .faith-arrow {
  822. min-height: 2.3rem;
  823. }
  824. .faith-arrow::after {
  825. content: "↓";
  826. }
  827. }
  828. @media screen and (max-width: 640px) {
  829. .faith-figure {
  830. padding: 0.75rem;
  831. }
  832. .faith-backcheck,
  833. .faith-steps,
  834. .faith-case-grid,
  835. .faith-distinction {
  836. grid-template-columns: 1fr;
  837. }
  838. .recall-map {
  839. grid-template-columns: 1fr;
  840. }
  841. .recall-question {
  842. display: block;
  843. }
  844. .recall-head,
  845. .recall-row {
  846. grid-template-columns: minmax(0, 1fr) 2.65rem minmax(0, 1fr);
  847. gap: 0.25rem;
  848. }
  849. .recall-row > div {
  850. padding: 0.4rem;
  851. }
  852. .recall-row em {
  853. display: flex;
  854. width: fit-content;
  855. margin: 0 0 0.22rem;
  856. }
  857. .recall-result {
  858. align-items: flex-start;
  859. flex-direction: column;
  860. }
  861. .model-prompt__row {
  862. grid-template-columns: 1fr;
  863. }
  864. .faith-backcheck {
  865. align-items: stretch;
  866. }
  867. .faith-step + .faith-step,
  868. .faith-distinction > div + div {
  869. padding-left: 0;
  870. border-left: 0;
  871. }
  872. .faith-step + .faith-step {
  873. margin-top: 0.6rem;
  874. padding-top: 0.6rem;
  875. border-top: 1px solid #c9deef;
  876. }
  877. .faith-distinction > div + div {
  878. border-top: 1px solid var(--faith-border);
  879. }
  880. .faith-score {
  881. width: 100%;
  882. }
  883. .relevancy-average-box {
  884. width: 100%;
  885. min-width: 0;
  886. }
  887. .relevancy-caution {
  888. display: block;
  889. }
  890. .relevancy-caution strong {
  891. display: block;
  892. margin-bottom: 0.2rem;
  893. }
  894. }
  895. @media print {
  896. .faith-figure,
  897. .faith-case,
  898. .faith-distinction {
  899. break-inside: avoid;
  900. box-shadow: none;
  901. }
  902. }
  903. </style>
  904. <script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
  905. </head>
  906. <body dir="ltr">
  907. <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
  908. <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
  909. <label class="md-overlay" for="__drawer"></label>
  910. <div data-md-component="skip">
  911. <a href="#_1" class="md-skip">
  912. 跳转至
  913. </a>
  914. </div>
  915. <div data-md-component="announce">
  916. </div>
  917. <header class="md-header md-header--shadow" data-md-component="header">
  918. <nav class="md-header__inner md-grid" aria-label="页眉">
  919. <a href="../index.html" title="企业知识库RAG智能问答项目V1.0" class="md-header__button md-logo" aria-label="企业知识库RAG智能问答项目V1.0" data-md-component="logo">
  920. <img src="../img/AI.jpg" alt="logo">
  921. </a>
  922. <label class="md-header__button md-icon" for="__drawer">
  923. <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"></path></svg>
  924. </label>
  925. <div class="md-header__title" data-md-component="header-title">
  926. <div class="md-header__ellipsis">
  927. <div class="md-header__topic">
  928. <span class="md-ellipsis">
  929. 企业知识库RAG智能问答项目V1.0
  930. </span>
  931. </div>
  932. <div class="md-header__topic" data-md-component="header-topic">
  933. <span class="md-ellipsis">
  934. 5.1 RAG系统评估工具
  935. </span>
  936. </div>
  937. </div>
  938. </div>
  939. <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
  940. <label class="md-header__button md-icon" for="__search">
  941. <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"></path></svg>
  942. </label>
  943. <div class="md-search" data-md-component="search" role="dialog">
  944. <label class="md-search__overlay" for="__search"></label>
  945. <div class="md-search__inner" role="search">
  946. <form class="md-search__form" name="search">
  947. <input type="text" class="md-search__input" name="query" aria-label="搜索" placeholder="搜索" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
  948. <label class="md-search__icon md-icon" for="__search">
  949. <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"></path></svg>
  950. <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"></path></svg>
  951. </label>
  952. <nav class="md-search__options" aria-label="查找">
  953. <button type="reset" class="md-search__icon md-icon" title="清空当前内容" aria-label="清空当前内容" tabindex="-1">
  954. <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>
  955. </button>
  956. </nav>
  957. </form>
  958. <div class="md-search__output">
  959. <div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
  960. <div class="md-search-result" data-md-component="search-result">
  961. <div class="md-search-result__meta">
  962. 正在初始化搜索引擎
  963. </div>
  964. <ol class="md-search-result__list" role="presentation"></ol>
  965. </div>
  966. </div>
  967. </div>
  968. </div>
  969. </div>
  970. </nav>
  971. </header>
  972. <div class="md-container" data-md-component="container">
  973. <main class="md-main" data-md-component="main">
  974. <div class="md-main__inner md-grid">
  975. <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation">
  976. <div class="md-sidebar__scrollwrap">
  977. <div class="md-sidebar__inner">
  978. <nav class="md-nav md-nav--primary" aria-label="导航栏" data-md-level="0">
  979. <label class="md-nav__title" for="__drawer">
  980. <a href="../index.html" title="企业知识库RAG智能问答项目V1.0" class="md-nav__button md-logo" aria-label="企业知识库RAG智能问答项目V1.0" data-md-component="logo">
  981. <img src="../img/AI.jpg" alt="logo">
  982. </a>
  983. 企业知识库RAG智能问答项目V1.0
  984. </label>
  985. <ul class="md-nav__list" data-md-scrollfix>
  986. <li class="md-nav__item">
  987. <a href="../index.html" class="md-nav__link">
  988. <span class="md-ellipsis">
  989. 知识库内容
  990. </span>
  991. </a>
  992. </li>
  993. <li class="md-nav__item md-nav__item--nested">
  994. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2">
  995. <label class="md-nav__link" for="__nav_2" id="__nav_2_label" tabindex="0">
  996. <span class="md-ellipsis">
  997. ① 项目概述
  998. </span>
  999. <span class="md-nav__icon md-icon"></span>
  1000. </label>
  1001. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_2_label" aria-expanded="false">
  1002. <label class="md-nav__title" for="__nav_2">
  1003. <span class="md-nav__icon md-icon"></span>
  1004. ① 项目概述
  1005. </label>
  1006. <ul class="md-nav__list" data-md-scrollfix>
  1007. <li class="md-nav__item">
  1008. <a href="../%E2%91%A0%20%E9%A1%B9%E7%9B%AE%E6%A6%82%E8%BF%B0/1.1%20%E9%A1%B9%E7%9B%AE%E6%9E%B6%E6%9E%84.html" class="md-nav__link">
  1009. <span class="md-ellipsis">
  1010. 1.1 项目架构
  1011. </span>
  1012. </a>
  1013. </li>
  1014. <li class="md-nav__item">
  1015. <a href="../%E2%91%A0%20%E9%A1%B9%E7%9B%AE%E6%A6%82%E8%BF%B0/1.2%20%E9%A1%B9%E7%9B%AE%E7%8E%AF%E5%A2%83%28window%29.html" class="md-nav__link">
  1016. <span class="md-ellipsis">
  1017. 1.2 项目环境(window)
  1018. </span>
  1019. </a>
  1020. </li>
  1021. <li class="md-nav__item">
  1022. <a href="../%E2%91%A0%20%E9%A1%B9%E7%9B%AE%E6%A6%82%E8%BF%B0/1.3%20%E9%A1%B9%E7%9B%AE%E7%8E%AF%E5%A2%83%28mac%29.html" class="md-nav__link">
  1023. <span class="md-ellipsis">
  1024. 1.3 项目环境(mac)
  1025. </span>
  1026. </a>
  1027. </li>
  1028. </ul>
  1029. </nav>
  1030. </li>
  1031. <li class="md-nav__item md-nav__item--nested">
  1032. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3">
  1033. <label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
  1034. <span class="md-ellipsis">
  1035. ② 项目工具
  1036. </span>
  1037. <span class="md-nav__icon md-icon"></span>
  1038. </label>
  1039. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
  1040. <label class="md-nav__title" for="__nav_3">
  1041. <span class="md-nav__icon md-icon"></span>
  1042. ② 项目工具
  1043. </label>
  1044. <ul class="md-nav__list" data-md-scrollfix>
  1045. <li class="md-nav__item">
  1046. <a href="../%E2%91%A1%20%E9%A1%B9%E7%9B%AE%E5%B7%A5%E5%85%B7/2.1%20Ollama%E5%A4%A7%E6%A8%A1%E5%9E%8B%E9%AB%98%E6%95%88%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7.html" class="md-nav__link">
  1047. <span class="md-ellipsis">
  1048. 2.1 Ollama大模型高效管理工具
  1049. </span>
  1050. </a>
  1051. </li>
  1052. <li class="md-nav__item">
  1053. <a href="../%E2%91%A1%20%E9%A1%B9%E7%9B%AE%E5%B7%A5%E5%85%B7/2.2%20LangChain%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86.md.html" class="md-nav__link">
  1054. <span class="md-ellipsis">
  1055. 2.2 LangChain基础知识.md
  1056. </span>
  1057. </a>
  1058. </li>
  1059. <li class="md-nav__item">
  1060. <a href="../%E2%91%A1%20%E9%A1%B9%E7%9B%AE%E5%B7%A5%E5%85%B7/2.3%20%E5%90%91%E9%87%8F%E7%B4%A2%E5%BC%95%EF%BC%9AHNSW%E3%80%81IVF%E4%B8%8EIVF_PQ.html" class="md-nav__link">
  1061. <span class="md-ellipsis">
  1062. 2.3 向量索引:HNSW、IVF与IVF_PQ
  1063. </span>
  1064. </a>
  1065. </li>
  1066. <li class="md-nav__item">
  1067. <a href="../%E2%91%A1%20%E9%A1%B9%E7%9B%AE%E5%B7%A5%E5%85%B7/2.4%20Milvus%E5%90%91%E9%87%8F%E6%95%B0%E6%8D%AE%E5%BA%93.html" class="md-nav__link">
  1068. <span class="md-ellipsis">
  1069. 2.4 Milvus向量数据库
  1070. </span>
  1071. </a>
  1072. </li>
  1073. </ul>
  1074. </nav>
  1075. </li>
  1076. <li class="md-nav__item md-nav__item--nested">
  1077. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4">
  1078. <label class="md-nav__link" for="__nav_4" id="__nav_4_label" tabindex="0">
  1079. <span class="md-ellipsis">
  1080. ③ 基于Mysql库的问答系统
  1081. </span>
  1082. <span class="md-nav__icon md-icon"></span>
  1083. </label>
  1084. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="false">
  1085. <label class="md-nav__title" for="__nav_4">
  1086. <span class="md-nav__icon md-icon"></span>
  1087. ③ 基于Mysql库的问答系统
  1088. </label>
  1089. <ul class="md-nav__list" data-md-scrollfix>
  1090. <li class="md-nav__item">
  1091. <a href="../%E2%91%A2%20%E5%9F%BA%E4%BA%8EMysql%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/3.1%20Python%E6%97%A5%E5%BF%97%E4%BB%8B%E7%BB%8D%E4%B8%8E%E5%BA%94%E7%94%A8.html" class="md-nav__link">
  1092. <span class="md-ellipsis">
  1093. 3.1 Python日志介绍与应用
  1094. </span>
  1095. </a>
  1096. </li>
  1097. <li class="md-nav__item">
  1098. <a href="../%E2%91%A2%20%E5%9F%BA%E4%BA%8EMysql%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/3.2%20Redis%E6%95%B0%E6%8D%AE%E5%BA%93%E7%AE%80%E4%BB%8B%E4%B8%8E%E4%BD%BF%E7%94%A8.html" class="md-nav__link">
  1099. <span class="md-ellipsis">
  1100. 3.2 Redis数据库简介与使用
  1101. </span>
  1102. </a>
  1103. </li>
  1104. <li class="md-nav__item">
  1105. <a href="../%E2%91%A2%20%E5%9F%BA%E4%BA%8EMysql%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/3.3%20%E5%9F%BA%E4%BA%8EMysql%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AE%9E%E7%8E%B0%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F.html" class="md-nav__link">
  1106. <span class="md-ellipsis">
  1107. 3.3 基于Mysql数据库实现问答系统
  1108. </span>
  1109. </a>
  1110. </li>
  1111. <li class="md-nav__item">
  1112. <a href="../%E2%91%A2%20%E5%9F%BA%E4%BA%8EMysql%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/3.4%20BM25%E7%AE%97%E6%B3%95%E7%AE%80%E4%BB%8B%E4%B8%8E%E5%BA%94%E7%94%A8.html" class="md-nav__link">
  1113. <span class="md-ellipsis">
  1114. 3.4 BM25算法简介与应用
  1115. </span>
  1116. </a>
  1117. </li>
  1118. </ul>
  1119. </nav>
  1120. </li>
  1121. <li class="md-nav__item md-nav__item--nested">
  1122. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5">
  1123. <label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
  1124. <span class="md-ellipsis">
  1125. ④ 基于Milvus库的问答系统
  1126. </span>
  1127. <span class="md-nav__icon md-icon"></span>
  1128. </label>
  1129. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="false">
  1130. <label class="md-nav__title" for="__nav_5">
  1131. <span class="md-nav__icon md-icon"></span>
  1132. ④ 基于Milvus库的问答系统
  1133. </label>
  1134. <ul class="md-nav__list" data-md-scrollfix>
  1135. <li class="md-nav__item">
  1136. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.1%20%E6%95%B4%E4%BD%93%E6%9E%B6%E6%9E%84%E4%B8%8E%E5%B7%A5%E7%A8%8B%E6%B5%81%E7%A8%8B.html" class="md-nav__link">
  1137. <span class="md-ellipsis">
  1138. 4.1 整体架构与工程流程
  1139. </span>
  1140. </a>
  1141. </li>
  1142. <li class="md-nav__item">
  1143. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.2%20%E5%9F%BA%E7%A1%80%E6%A8%A1%E5%9D%97.html" class="md-nav__link">
  1144. <span class="md-ellipsis">
  1145. 4.2 基础模块
  1146. </span>
  1147. </a>
  1148. </li>
  1149. <li class="md-nav__item">
  1150. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.3%20%E6%96%87%E6%A1%A3%E5%A4%84%E7%90%86%E6%A8%A1%E5%9D%97.html" class="md-nav__link">
  1151. <span class="md-ellipsis">
  1152. 4.3 文档处理模块
  1153. </span>
  1154. </a>
  1155. </li>
  1156. <li class="md-nav__item">
  1157. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.4%20%E5%90%91%E9%87%8F%E5%AD%98%E5%82%A8.html" class="md-nav__link">
  1158. <span class="md-ellipsis">
  1159. 4.4 向量存储
  1160. </span>
  1161. </a>
  1162. </li>
  1163. <li class="md-nav__item"><a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.5%20BERT%E5%9F%BA%E7%A1%80%E4%B8%8E%E4%BB%BB%E5%8A%A1%E5%BE%AE%E8%B0%83.html" class="md-nav__link"><span class="md-ellipsis">4.5 BERT基础与任务微调</span></a></li><li class="md-nav__item">
  1164. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.6%20prompts%E8%AE%BE%E8%AE%A1%E4%B8%8Equery%E6%84%8F%E5%9B%BE%E8%AF%86%E5%88%AB.html" class="md-nav__link">
  1165. <span class="md-ellipsis">
  1166. 4.6 prompts设计与query意图识别
  1167. </span>
  1168. </a>
  1169. </li>
  1170. <li class="md-nav__item">
  1171. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.7%20%E6%A3%80%E7%B4%A2%E7%AD%96%E7%95%A5%E4%B8%8ERAG%E7%B3%BB%E7%BB%9F%E8%AE%BE%E8%AE%A1.html" class="md-nav__link">
  1172. <span class="md-ellipsis">
  1173. 4.7 检索策略与RAG系统设计
  1174. </span>
  1175. </a>
  1176. </li>
  1177. <li class="md-nav__item">
  1178. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.8%20RAG%E7%B3%BB%E7%BB%9F%E8%BF%90%E8%A1%8C.html" class="md-nav__link">
  1179. <span class="md-ellipsis">
  1180. 4.8 RAG系统运行
  1181. </span>
  1182. </a>
  1183. </li>
  1184. <li class="md-nav__item">
  1185. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.9%20%E6%96%87%E6%A1%A3%E8%A7%A3%E6%9E%90%E5%B7%A5%E5%85%B7%28%E6%89%A9%E5%B1%95%E8%B5%84%E6%96%99%29.html" class="md-nav__link">
  1186. <span class="md-ellipsis">
  1187. 4.9 文档解析工具(扩展资料)
  1188. </span>
  1189. </a>
  1190. </li>
  1191. <li class="md-nav__item">
  1192. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/4.10%20RAG%E4%B8%AD%E7%9A%84Query%E6%94%B9%E5%86%99%28%E6%89%A9%E5%B1%95%E8%B5%84%E6%96%99%29.html" class="md-nav__link">
  1193. <span class="md-ellipsis">
  1194. 4.10 RAG中的Query改写(扩展资料)
  1195. </span>
  1196. </a>
  1197. </li>
  1198. <li class="md-nav__item">
  1199. <a href="../%E2%91%A3%20%E5%9F%BA%E4%BA%8EMilvus%E5%BA%93%E7%9A%84%E9%97%AE%E7%AD%94%E7%B3%BB%E7%BB%9F/%E6%95%B0%E6%8D%AE%E9%9B%86%E7%94%9F%E6%88%90%E4%B8%8E%E4%BC%98%E5%8C%96%28%E6%89%A9%E5%B1%95%E8%B5%84%E6%96%99%29.html" class="md-nav__link">
  1200. <span class="md-ellipsis">
  1201. 数据集生成与优化(扩展资料)
  1202. </span>
  1203. </a>
  1204. </li>
  1205. </ul>
  1206. </nav>
  1207. </li>
  1208. <li class="md-nav__item md-nav__item--active md-nav__item--nested">
  1209. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" checked>
  1210. <label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
  1211. <span class="md-ellipsis">
  1212. ⑤ RAG系统评估
  1213. </span>
  1214. <span class="md-nav__icon md-icon"></span>
  1215. </label>
  1216. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="true">
  1217. <label class="md-nav__title" for="__nav_6">
  1218. <span class="md-nav__icon md-icon"></span>
  1219. ⑤ RAG系统评估
  1220. </label>
  1221. <ul class="md-nav__list" data-md-scrollfix>
  1222. <li class="md-nav__item md-nav__item--active">
  1223. <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
  1224. <label class="md-nav__link md-nav__link--active" for="__toc">
  1225. <span class="md-ellipsis">
  1226. 5.1 RAG系统评估工具
  1227. </span>
  1228. <span class="md-nav__icon md-icon"></span>
  1229. </label>
  1230. <a href="5.1%20RAG%E7%B3%BB%E7%BB%9F%E8%AF%84%E4%BC%B0%E5%B7%A5%E5%85%B7.html" class="md-nav__link md-nav__link--active">
  1231. <span class="md-ellipsis">
  1232. 5.1 RAG系统评估工具
  1233. </span>
  1234. </a>
  1235. <nav class="md-nav md-nav--secondary" aria-label="目录">
  1236. <label class="md-nav__title" for="__toc">
  1237. <span class="md-nav__icon md-icon"></span>
  1238. 目录
  1239. </label>
  1240. <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
  1241. <li class="md-nav__item">
  1242. <a href="#_1" class="md-nav__link">
  1243. <span class="md-ellipsis">
  1244. 学习目标
  1245. </span>
  1246. </a>
  1247. </li>
  1248. <li class="md-nav__item">
  1249. <a href="#_2" class="md-nav__link">
  1250. <span class="md-ellipsis">
  1251. 一、概述
  1252. </span>
  1253. </a>
  1254. </li>
  1255. <li class="md-nav__item">
  1256. <a href="#ragas" class="md-nav__link">
  1257. <span class="md-ellipsis">
  1258. 二、RAGAS评估框架
  1259. </span>
  1260. </a>
  1261. <nav class="md-nav" aria-label="二、RAGAS评估框架">
  1262. <ul class="md-nav__list">
  1263. <li class="md-nav__item">
  1264. <a href="#1" class="md-nav__link">
  1265. <span class="md-ellipsis">
  1266. 1 数据说明
  1267. </span>
  1268. </a>
  1269. </li>
  1270. <li class="md-nav__item">
  1271. <a href="#2" class="md-nav__link">
  1272. <span class="md-ellipsis">
  1273. 2 评估指标
  1274. </span>
  1275. </a>
  1276. <nav class="md-nav" aria-label="2 评估指标">
  1277. <ul class="md-nav__list">
  1278. <li class="md-nav__item">
  1279. <a href="#21-context-relevance" class="md-nav__link">
  1280. <span class="md-ellipsis">
  1281. 2.1 上下文相关性 (context relevance)
  1282. </span>
  1283. </a>
  1284. </li>
  1285. <li class="md-nav__item">
  1286. <a href="#22-context-recall" class="md-nav__link">
  1287. <span class="md-ellipsis">
  1288. 2.2 上下文召回率 (context recall)
  1289. </span>
  1290. </a>
  1291. </li>
  1292. <li class="md-nav__item">
  1293. <a href="#23-faithfulness" class="md-nav__link">
  1294. <span class="md-ellipsis">
  1295. 2.3 忠实度(faithfulness)
  1296. </span>
  1297. </a>
  1298. </li>
  1299. <li class="md-nav__item">
  1300. <a href="#24-answer-relevancy" class="md-nav__link">
  1301. <span class="md-ellipsis">
  1302. 2.4 答案相关性(answer relevancy)
  1303. </span>
  1304. </a>
  1305. </li>
  1306. </ul>
  1307. </nav>
  1308. </li>
  1309. </ul>
  1310. </nav>
  1311. </li>
  1312. <li class="md-nav__item">
  1313. <a href="#_3" class="md-nav__link">
  1314. <span class="md-ellipsis">
  1315. 本章小结
  1316. </span>
  1317. </a>
  1318. </li>
  1319. </ul>
  1320. </nav>
  1321. </li>
  1322. <li class="md-nav__item">
  1323. <a href="5.2%20%E5%AE%9E%E7%8E%B0EnterpriseKB-RAG%E7%B3%BB%E7%BB%9F%E7%9A%84%E8%AF%84%E4%BC%B0.html" class="md-nav__link">
  1324. <span class="md-ellipsis">
  1325. 5.2 实现企业知识库RAG系统的评估
  1326. </span>
  1327. </a>
  1328. </li>
  1329. <li class="md-nav__item">
  1330. <a href="5.3%20RAG%E8%AF%84%E4%BC%B0%E6%95%B0%E6%8D%AE%E9%9B%86%E7%9A%84%E6%9E%84%E9%80%A0%28%E6%89%A9%E5%B1%95%29.html" class="md-nav__link">
  1331. <span class="md-ellipsis">
  1332. 5.3 RAG评估数据集的构造(扩展)
  1333. </span>
  1334. </a>
  1335. </li>
  1336. </ul>
  1337. </nav>
  1338. </li>
  1339. <li class="md-nav__item md-nav__item--nested">
  1340. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7">
  1341. <label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
  1342. <span class="md-ellipsis">
  1343. ⑥ 融合Mysql的RAG系统
  1344. </span>
  1345. <span class="md-nav__icon md-icon"></span>
  1346. </label>
  1347. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
  1348. <label class="md-nav__title" for="__nav_7">
  1349. <span class="md-nav__icon md-icon"></span>
  1350. ⑥ 融合Mysql的RAG系统
  1351. </label>
  1352. <ul class="md-nav__list" data-md-scrollfix>
  1353. <li class="md-nav__item">
  1354. <a href="../%E2%91%A5%20%E8%9E%8D%E5%90%88Mysql%E7%9A%84RAG%E7%B3%BB%E7%BB%9F/6.1%20%E8%9E%8D%E5%90%88FQA%E5%92%8C%E7%9F%A5%E8%AF%86%E5%BA%93%E6%9F%A5%E8%AF%A2.html" class="md-nav__link">
  1355. <span class="md-ellipsis">
  1356. 6.1 融合FQA和知识库查询
  1357. </span>
  1358. </a>
  1359. </li>
  1360. <li class="md-nav__item">
  1361. <a href="../%E2%91%A5%20%E8%9E%8D%E5%90%88Mysql%E7%9A%84RAG%E7%B3%BB%E7%BB%9F/6.2%20%E8%9E%8D%E5%90%88FAQ%20%E5%92%8C%E7%9F%A5%E8%AF%86%E5%BA%93%E6%9F%A5%E8%AF%A2%EF%BC%88%E4%BC%98%E5%8C%96%E7%89%88%EF%BC%89.html" class="md-nav__link">
  1362. <span class="md-ellipsis">
  1363. 6.2 融合FAQ 和知识库查询(优化版)
  1364. </span>
  1365. </a>
  1366. </li>
  1367. <li class="md-nav__item">
  1368. <a href="../%E2%91%A5%20%E8%9E%8D%E5%90%88Mysql%E7%9A%84RAG%E7%B3%BB%E7%BB%9F/6.3%20%E5%9F%BA%E4%BA%8E%20FastAPI%20%E7%9A%84%20FAQ%20%E4%B8%8E%E7%9F%A5%E8%AF%86%E5%BA%93%E6%9F%A5%E8%AF%A2%E6%8E%A5%E5%8F%A3.html" class="md-nav__link">
  1369. <span class="md-ellipsis">
  1370. 6.3 基于 FastAPI 的 FAQ 与知识库查询接口
  1371. </span>
  1372. </a>
  1373. </li>
  1374. <li class="md-nav__item">
  1375. <a href="../%E2%91%A5%20%E8%9E%8D%E5%90%88Mysql%E7%9A%84RAG%E7%B3%BB%E7%BB%9F/6.4%20FastAPI%E5%92%8CFlask%E7%9A%84%E5%8C%BA%E5%88%AB%E5%92%8C%E8%81%94%E7%B3%BB%28%E6%89%A9%E5%B1%95%E8%B5%84%E6%96%99%29.html" class="md-nav__link">
  1376. <span class="md-ellipsis">
  1377. 6.4 FastAPI和Flask的区别和联系(扩展资料)
  1378. </span>
  1379. </a>
  1380. </li>
  1381. </ul>
  1382. </nav>
  1383. </li>
  1384. <li class="md-nav__item md-nav__item--nested">
  1385. <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8">
  1386. <label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
  1387. <span class="md-ellipsis">
  1388. ⑦ 企业级生产环境部署
  1389. </span>
  1390. <span class="md-nav__icon md-icon"></span>
  1391. </label>
  1392. <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
  1393. <label class="md-nav__title" for="__nav_8">
  1394. <span class="md-nav__icon md-icon"></span>
  1395. ⑦ 企业级生产环境部署
  1396. </label>
  1397. <ul class="md-nav__list" data-md-scrollfix>
  1398. <li class="md-nav__item">
  1399. <a href="../%E2%91%A6%20%E4%BC%81%E4%B8%9A%E7%BA%A7%E7%94%9F%E4%BA%A7%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2/7.1%20Docker%E7%9A%84%E5%8E%9F%E7%90%86%E5%92%8C%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8.html" class="md-nav__link">
  1400. <span class="md-ellipsis">
  1401. 7.1 Docker的原理和基本使用
  1402. </span>
  1403. </a>
  1404. </li>
  1405. <li class="md-nav__item">
  1406. <a href="../%E2%91%A6%20%E4%BC%81%E4%B8%9A%E7%BA%A7%E7%94%9F%E4%BA%A7%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2/7.2%20%E6%9C%8D%E5%8A%A1%E9%83%A8%E7%BD%B2.html" class="md-nav__link">
  1407. <span class="md-ellipsis">
  1408. 7.2 服务部署
  1409. </span>
  1410. </a>
  1411. </li>
  1412. </ul>
  1413. </nav>
  1414. </li>
  1415. </ul>
  1416. </nav>
  1417. </div>
  1418. </div>
  1419. </div>
  1420. <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc">
  1421. <div class="md-sidebar__scrollwrap">
  1422. <div class="md-sidebar__inner">
  1423. <nav class="md-nav md-nav--secondary" aria-label="目录">
  1424. <label class="md-nav__title" for="__toc">
  1425. <span class="md-nav__icon md-icon"></span>
  1426. 目录
  1427. </label>
  1428. <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
  1429. <li class="md-nav__item">
  1430. <a href="#_1" class="md-nav__link">
  1431. <span class="md-ellipsis">
  1432. 学习目标
  1433. </span>
  1434. </a>
  1435. </li>
  1436. <li class="md-nav__item">
  1437. <a href="#_2" class="md-nav__link">
  1438. <span class="md-ellipsis">
  1439. 一、概述
  1440. </span>
  1441. </a>
  1442. </li>
  1443. <li class="md-nav__item">
  1444. <a href="#ragas" class="md-nav__link">
  1445. <span class="md-ellipsis">
  1446. 二、RAGAS评估框架
  1447. </span>
  1448. </a>
  1449. <nav class="md-nav" aria-label="二、RAGAS评估框架">
  1450. <ul class="md-nav__list">
  1451. <li class="md-nav__item">
  1452. <a href="#1" class="md-nav__link">
  1453. <span class="md-ellipsis">
  1454. 1 数据说明
  1455. </span>
  1456. </a>
  1457. </li>
  1458. <li class="md-nav__item">
  1459. <a href="#2" class="md-nav__link">
  1460. <span class="md-ellipsis">
  1461. 2 评估指标
  1462. </span>
  1463. </a>
  1464. <nav class="md-nav" aria-label="2 评估指标">
  1465. <ul class="md-nav__list">
  1466. <li class="md-nav__item">
  1467. <a href="#21-context-relevance" class="md-nav__link">
  1468. <span class="md-ellipsis">
  1469. 2.1 上下文相关性 (context relevance)
  1470. </span>
  1471. </a>
  1472. </li>
  1473. <li class="md-nav__item">
  1474. <a href="#22-context-recall" class="md-nav__link">
  1475. <span class="md-ellipsis">
  1476. 2.2 上下文召回率 (context recall)
  1477. </span>
  1478. </a>
  1479. </li>
  1480. <li class="md-nav__item">
  1481. <a href="#23-faithfulness" class="md-nav__link">
  1482. <span class="md-ellipsis">
  1483. 2.3 忠实度(faithfulness)
  1484. </span>
  1485. </a>
  1486. </li>
  1487. <li class="md-nav__item">
  1488. <a href="#24-answer-relevancy" class="md-nav__link">
  1489. <span class="md-ellipsis">
  1490. 2.4 答案相关性(answer relevancy)
  1491. </span>
  1492. </a>
  1493. </li>
  1494. </ul>
  1495. </nav>
  1496. </li>
  1497. </ul>
  1498. </nav>
  1499. </li>
  1500. <li class="md-nav__item">
  1501. <a href="#_3" class="md-nav__link">
  1502. <span class="md-ellipsis">
  1503. 本章小结
  1504. </span>
  1505. </a>
  1506. </li>
  1507. </ul>
  1508. </nav>
  1509. </div>
  1510. </div>
  1511. </div>
  1512. <div class="md-content" data-md-component="content">
  1513. <article class="md-content__inner md-typeset">
  1514. <h1>5.1 RAG系统评估工具</h1>
  1515. <h2 id="_1">学习目标<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
  1516. <ul>
  1517. <li>了解RAG系统评估的指标</li>
  1518. <li>掌握RAGAS框架的原理和使用方式</li>
  1519. </ul>
  1520. <h2 id="_2">一、概述<a class="headerlink" href="#_2" title="Permanent link">¶</a></h2>
  1521. <p>当我们为某个真实线上系统开发了检索增强生成 (RAG) 应用,那么在此应用正式上线提供服务前,我们需要评估 RAG 的表现到底是怎样的。如果发现现有的 RAG 效果不够理想,可能需要一些新的 RAG 算法流程来改进。在这之前,就需要对 RAG 流程进行评估,得到评估指标,然后才能进行自动化对比,观察改进的流程是否真的有效。</p>
  1522. <h2 id="ragas">二、RAGAS评估框架<a class="headerlink" href="#ragas" title="Permanent link">¶</a></h2>
  1523. <p>RAGAS (Retrieval Augmented Generation Assessment) 我们一般称为 Automated Evaluation of Retrieval Augmented Generation,即检索增强生成的自动评估。Ragas是一个大模型评测框架,可以评估检索增强生成(RAG)的效果,帮助分析模型的输出,了解模型在给定任务上的表现。Github地址: https://github.com/explodinggradients/ragas</p>
  1524. <p>RAGAS的评估主要基于两个方向:检索部分和生成部分,那么针对不同的部分评估的指标也会有所区分。接下来,我们将分别介绍RAGAS评估框架所需的数据,评估指标,实际用例等。</p>
  1525. <h3 id="1">1 数据说明<a class="headerlink" href="#1" title="Permanent link">¶</a></h3>
  1526. <p>最开始的 RAGAs 在评估数据集时,不必依赖人工标注的标准答案,而是通过底层的大语言模型 (LLM) 来进行评估。所以只需要一个带有问题-答案对的评估数据集(QA 对),如:https://huggingface.co/datasets/m-ric/huggingface_doc
  1527. 具体字段:</p>
  1528. <ul>
  1529. <li>question:作为 RAG 管道输入的用户查询,输入。</li>
  1530. <li>answer:从 RAG 管道生成的答案,输出。</li>
  1531. <li>contexts:从用于回答question外部知识源中检索的上下文。</li>
  1532. <li>ground_truths:question的基本事实答案。这是唯一人工注释的信息。</li>
  1533. </ul>
  1534. <hr>
  1535. <h3 id="2">2 评估指标<a class="headerlink" href="#2" title="Permanent link">¶</a></h3>
  1536. <div align="center"><img src="../img/9-7-1.png" style="zoom:40%"><img></div>
  1537. <hr>
  1538. <ul>
  1539. <li><strong>评估检索(context)</strong>的指标:提供了上下文相关性(context_relevancy)和上下文召回率(context_recall),这些可以衡量你的检索系统的性能,即检索的段落是否相关。</li>
  1540. <li><strong>评估生成(answer)</strong>的指标:提供了忠实度(faithfulness),用以衡量生成的信息是否准确无误;以及答案相关性(answer_relevancy),用以衡量答案对问题的切题程度,即模型生成的答案是否恰当。</li>
  1541. </ul>
  1542. <hr>
  1543. <h4 id="21-context-relevance">2.1 上下文相关性 (context relevance)<a class="headerlink" href="#21-context-relevance" title="Permanent link">¶</a></h4>
  1544. <section class="faithfulness-guide context-metric-guide context-relevance-guide" aria-label="上下文相关性图解与示例">
  1545. <figure class="faith-figure">
  1546. <figcaption><span class="faith-step-label">看“干不干净”</span>检索回来的内容里,有多少句真正能回答问题?</figcaption>
  1547. <div class="faith-flow">
  1548. <div class="faith-node faith-node--question">
  1549. <span class="faith-node__label">用户问题 q</span>
  1550. <p>满一年有几天年假?未休年假何时前用完?最小申请单位是多少?</p>
  1551. </div>
  1552. <div class="faith-arrow"><span>检索器</span></div>
  1553. <div class="faith-node faith-node--context">
  1554. <span class="faith-node__label model-label"><span class="model-tag model-tag--retriever">检索器</span>输出:上下文 C1–C4</span>
  1555. <ol class="faith-doc-list">
  1556. <li><span class="faith-id">C1</span><p>满 12 个月后,每年有 <strong>5 天</strong>带薪年假。</p></li>
  1557. <li><span class="faith-id">C2</span><p>未休年假可结转至<strong>次年 3 月 31 日前</strong>。</p></li>
  1558. <li><span class="faith-id">C3</span><p>年假最小申请单位为 <strong>0.5 天</strong>。</p></li>
  1559. <li class="is-noise"><span class="faith-id">C4</span><p>连续病假 2 天须提交医疗证明。</p></li>
  1560. </ol>
  1561. </div>
  1562. <div class="faith-arrow"><span>评估 LLM</span></div>
  1563. <div class="faith-node faith-node--answer">
  1564. <span class="faith-node__label model-label"><span class="model-tag model-tag--llm">评估 LLM</span>输出:必要 / 无关</span>
  1565. <ol class="faith-answer-list">
  1566. <li><span class="faith-id">C1</span><span>回答年假天数:有用</span></li>
  1567. <li><span class="faith-id">C2</span><span>回答结转期限:有用</span></li>
  1568. <li><span class="faith-id">C3</span><span>回答申请单位:有用</span></li>
  1569. <li class="is-unsupported"><span class="faith-id">C4</span><span>讲病假证明:无关</span></li>
  1570. </ol>
  1571. </div>
  1572. </div>
  1573. <div class="model-prompt">
  1574. <div class="model-prompt__row">
  1575. <span class="model-tag model-tag--llm">评估 LLM</span>
  1576. <p><strong>输入:</strong>用户问题 q + 检索上下文 C1–C4 <strong>提示词(简化):</strong>“从上下文中原样提取回答问题所必需的句子;没有则输出‘信息不足’。” <span class="model-prompt__output">输出:C1–C3 有用,C4 无关</span></p>
  1577. </div>
  1578. </div>
  1579. <div class="faith-backcheck">
  1580. <div>
  1581. <p class="faith-backcheck__title"><span class="model-tag model-tag--compute">程序计算</span> 总共检索 4 句,其中 3 句是回答问题所必需的</p>
  1582. <ul class="faith-verdict-list">
  1583. <li>有用句:C1、C2、C3</li>
  1584. <li class="is-no">噪声句:C4</li>
  1585. </ul>
  1586. </div>
  1587. <div class="faith-score"><span>程序计算 · 上下文相关性</span><strong>3 / 4 = 0.75</strong></div>
  1588. </div>
  1589. </figure>
  1590. <div class="faith-explanation">
  1591. <p class="faith-explanation__lead"><strong>一句话抓住核心:</strong>上下文相关性衡量检索结果的“信息密度”。分母是检索回来的全部句子,混入无关内容就会降分。</p>
  1592. <div class="faith-steps">
  1593. <div class="faith-step"><strong>1|数全部检索句</strong><p>C1–C4 共 4 句,作为分母。</p></div>
  1594. <div class="faith-step"><strong>2|抽取必要句</strong><p>LLM 判断 C1–C3 能回答问题,共 3 句。</p></div>
  1595. <div class="faith-step"><strong>3|算有用占比</strong><p>相关性 = 必要句数 / 检索总句数 = 3 / 4。</p></div>
  1596. </div>
  1597. </div>
  1598. <h5 class="faith-section-title">多捞一条无关内容,分数会怎样?</h5>
  1599. <div class="faith-case-grid">
  1600. <article class="faith-case is-good">
  1601. <div class="faith-case__head"><h6>检索 A|只有 C1–C3</h6><span class="faith-case__score">1.00</span></div>
  1602. <p class="faith-case__answer">3 句全部能回答问题:3 / 3 = 1.00</p>
  1603. <p class="faith-case__conclusion"><strong>干净。</strong>没有多余信息。</p>
  1604. </article>
  1605. <article class="faith-case is-mid">
  1606. <div class="faith-case__head"><h6>检索 B|C1–C3 + 病假 C4</h6><span class="faith-case__score">0.75</span></div>
  1607. <p class="faith-case__answer">4 句中只有 3 句有用:3 / 4 = 0.75</p>
  1608. <p class="faith-case__conclusion"><strong>有噪声。</strong>该找的信息都在,但多捞了无关内容。</p>
  1609. </article>
  1610. </div>
  1611. <p class="faith-source-note">记忆口诀:相关性看“捞回来的内容有多少有用”,怕的是多捞废料。本节沿用课件旧版 Ragas 的句子级计算方式。</p>
  1612. </section>
  1613. <hr>
  1614. <h4 id="22-context-recall">2.2 上下文召回率 (context recall)<a class="headerlink" href="#22-context-recall" title="Permanent link">¶</a></h4>
  1615. <section class="faithfulness-guide context-metric-guide context-recall-guide" aria-label="上下文召回率图解与示例">
  1616. <figure class="faith-figure">
  1617. <figcaption><span class="faith-step-label">看“全不全”</span>把 RAG 检索结果与标准答案并排 VS</figcaption>
  1618. <div class="recall-map">
  1619. <div class="recall-question">
  1620. <span class="faith-node__label">用户问题 q</span>
  1621. <p>满一年有几天年假?未休年假何时前用完?最小申请单位是多少?</p>
  1622. </div>
  1623. <div class="recall-compare">
  1624. <div class="recall-head">
  1625. <strong>RAG 检索结果 c(q) <span class="model-tag model-tag--retriever">检索器输出</span></strong>
  1626. <b>VS</b>
  1627. <strong>标准答案 GT <span class="model-tag model-tag--human">人工标注</span></strong>
  1628. </div>
  1629. <div class="model-prompt model-prompt--inside">
  1630. <div class="model-prompt__row">
  1631. <span class="model-tag model-tag--llm">评估 LLM</span>
  1632. <p><strong>输入:</strong>检索上下文 + 标准答案 GT <strong>提示词(简化):</strong>“把标准答案列成可独立核验的事实,并逐条检查:仅凭检索上下文能否推出?输出‘是 / 否’及理由。” <span class="model-prompt__output">输出:G1、G2 支撑,G3 缺失</span></p>
  1633. </div>
  1634. </div>
  1635. <div class="recall-row is-match">
  1636. <div><em>C1</em>满 12 个月后,每年有 5 天年假。</div>
  1637. <span>✓ 支撑</span>
  1638. <div><em>G1</em>满 12 个月后,每年有 5 天年假。</div>
  1639. </div>
  1640. <div class="recall-row is-match">
  1641. <div><em>C2</em>未休年假可结转至次年 3 月 31 日前。</div>
  1642. <span>✓ 支撑</span>
  1643. <div><em>G2</em>未休年假可结转至次年 3 月 31 日前。</div>
  1644. </div>
  1645. <div class="recall-row is-missing">
  1646. <div>所有检索内容均未提到</div>
  1647. <span>✕ 缺失</span>
  1648. <div><em>G3</em>年假最小申请单位为 0.5 天。</div>
  1649. </div>
  1650. <p class="recall-noise"><strong>C4|额外检索:</strong>连续病假 2 天须提交医疗证明。它是噪声,但不影响召回率。</p>
  1651. </div>
  1652. </div>
  1653. <div class="recall-result">
  1654. <p><strong>核对结果:</strong>G1、G2 已找回,G3 缺失;标准答案一共需要 3 条事实。</p>
  1655. <strong><span class="model-tag model-tag--compute">程序计算</span> 上下文召回率 = 2 / 3 ≈ 0.67</strong>
  1656. </div>
  1657. </figure>
  1658. <div class="faith-explanation">
  1659. <p class="faith-explanation__lead"><strong>一句话抓住核心:</strong>上下文召回率先拆标准答案 GT,不是拆 AI 生成答案;它检查标准答案需要的事实是否都被检索回来。</p>
  1660. <div class="faith-steps">
  1661. <div class="faith-step"><strong>1|列出标准答案事实</strong><p>评估 LLM 在同一次判断中列出 G1–G3,共 3 条事实,作为分母。</p></div>
  1662. <div class="faith-step"><strong>2|逐条找依据</strong><p>在检索上下文中回查,G1、G2 有依据,G3 缺失。</p></div>
  1663. <div class="faith-step"><strong>3|算找回比例</strong><p>召回率 = 被支撑的 GT 事实数 / GT 事实总数 = 2 / 3。</p></div>
  1664. </div>
  1665. </div>
  1666. <h5 class="faith-section-title">多一条噪声不扣分,漏一个要点才扣分</h5>
  1667. <div class="faith-case-grid">
  1668. <article class="faith-case is-good">
  1669. <div class="faith-case__head"><h6>检索 A|C1–C4 全部返回</h6><span class="faith-case__score">1.00</span></div>
  1670. <p class="faith-case__answer">G1、G2、G3 全有依据:3 / 3 = 1.00</p>
  1671. <p class="faith-case__conclusion"><strong>找全了。</strong>即使多了病假 C4,也不降低召回率。</p>
  1672. </article>
  1673. <article class="faith-case is-bad">
  1674. <div class="faith-case__head"><h6>检索 B|只有 C1、C2、C4</h6><span class="faith-case__score">0.67</span></div>
  1675. <p class="faith-case__answer">G3“最小 0.5 天”没有依据:2 / 3 ≈ 0.67</p>
  1676. <p class="faith-case__conclusion"><strong>漏要点了。</strong>缺少标准答案所需的一条事实。</p>
  1677. </article>
  1678. </div>
  1679. <div class="faith-distinction">
  1680. <div>
  1681. <h6>上下文相关性:怕“多”</h6>
  1682. <p>分母是<strong>全部检索句</strong>。无关内容越多,结果越不干净,分数越低。</p>
  1683. </div>
  1684. <div>
  1685. <h6>上下文召回率:怕“少”</h6>
  1686. <p>分母是<strong>标准答案事实</strong>。需要的信息漏得越多,分数越低。</p>
  1687. </div>
  1688. </div>
  1689. <p class="faith-source-note">记忆口诀:相关性看“捞得干不干净”,召回率看“该捞的找全没有”。</p>
  1690. </section>
  1691. <hr>
  1692. <h4 id="23-faithfulness">2.3 忠实度(faithfulness)<a class="headerlink" href="#23-faithfulness" title="Permanent link">¶</a></h4>
  1693. <section class="faithfulness-guide" aria-label="忠实度图解与示例">
  1694. <figure class="faith-figure">
  1695. <figcaption><span class="faith-step-label">先看图</span>答案拆成 S1–S3,再逐条回看检索上下文 C1–C4</figcaption>
  1696. <div class="faith-flow">
  1697. <div class="faith-node faith-node--question">
  1698. <span class="faith-node__label">用户问题 q</span>
  1699. <p>我在公司连续工作满一年,今年有多少天带薪年假?</p>
  1700. </div>
  1701. <div class="faith-arrow"><span>检索器</span></div>
  1702. <div class="faith-node faith-node--context">
  1703. <span class="faith-node__label model-label"><span class="model-tag model-tag--retriever">检索器</span>输出:上下文 c(q)</span>
  1704. <ol class="faith-doc-list">
  1705. <li><span class="faith-id">C1</span><p>连续服务满 12 个月后,每个自然年度享有 <strong>5 天带薪年假</strong>。</p></li>
  1706. <li><span class="faith-id">C2</span><p>未休完的年假经批准,可结转至<strong>次年 3 月 31 日前</strong>使用。</p></li>
  1707. <li><span class="faith-id">C3</span><p>年假可以分次申请,最小申请单位为 <strong>0.5 天</strong>。</p></li>
  1708. <li class="is-noise"><span class="faith-id">C4</span><p>连续病假达到 2 个工作日,须提交医疗机构证明。</p></li>
  1709. </ol>
  1710. </div>
  1711. <div class="faith-arrow"><span>RAG LLM 生成<br>评估 LLM 拆分</span></div>
  1712. <div class="faith-node faith-node--answer">
  1713. <span class="faith-node__label model-label"><span class="model-tag model-tag--llm">评估 LLM ①</span>输出:答案事实 S(a(q))</span>
  1714. <ol class="faith-answer-list">
  1715. <li><span class="faith-id">S1</span><span>满一年有 <strong>5 天</strong>带薪年假。</span></li>
  1716. <li><span class="faith-id">S2</span><span>未休年假可结转至次年 3 月 31 日前。</span></li>
  1717. <li class="is-unsupported"><span class="faith-id">S3</span><span>每次最多只能连续休 <strong>3 天</strong>。</span></li>
  1718. </ol>
  1719. </div>
  1720. </div>
  1721. <div class="model-prompt">
  1722. <div class="model-prompt__row">
  1723. <span class="model-tag model-tag--rag">RAG 生成 LLM</span>
  1724. <p><strong>输入:</strong>用户问题 q + 检索上下文 c(q) <strong>提示词(简化):</strong>“请仅依据检索上下文回答用户问题。” <span class="model-prompt__output">输出:AI 答案 a(q)</span></p>
  1725. </div>
  1726. <div class="model-prompt__row">
  1727. <span class="model-tag model-tag--llm">评估 LLM ①</span>
  1728. <p><strong>输入:</strong>问题 q + AI 答案 a(q) <strong>提示词(简化):</strong>“把答案拆成可独立判断真假的事实陈述。” <span class="model-prompt__output">输出:S1–S3</span></p>
  1729. </div>
  1730. <div class="model-prompt__row">
  1731. <span class="model-tag model-tag--llm">评估 LLM ②</span>
  1732. <p><strong>输入:</strong>检索上下文 c(q) + S1–S3 <strong>提示词(简化):</strong>“仅依据上下文,逐条判断陈述是否成立;输出‘是 / 否’及理由。” <span class="model-prompt__output">输出:S1、S2 支持,S3 不支持</span></p>
  1733. </div>
  1734. </div>
  1735. <div class="faith-backcheck">
  1736. <div>
  1737. <p class="faith-backcheck__title"><span class="model-tag model-tag--llm">评估 LLM ②</span> 逐条核验:仅凭 C1–C4,能否推出这条陈述?</p>
  1738. <ul class="faith-verdict-list">
  1739. <li>S1 ← C1:支持,计入 V</li>
  1740. <li>S2 ← C2:支持,计入 V</li>
  1741. <li class="is-no">S3:无来源,不计入 V</li>
  1742. </ul>
  1743. </div>
  1744. <div class="faith-score"><span>程序计算 · 忠实度</span><strong>F = 2 / 3 ≈ 0.67</strong></div>
  1745. </div>
  1746. </figure>
  1747. <div class="faith-explanation">
  1748. <p class="faith-explanation__lead"><strong>一句话抓住核心:</strong>被拆分的是 RAG 最终生成的答案 a(q),不是检索上下文 c(q);忠实度只检查“答案中写出的每条事实,有没有检索依据”。</p>
  1749. <div class="faith-steps">
  1750. <div class="faith-step"><strong>1|拆答案</strong><p>把生成答案拆成可独立判断真假的事实陈述,得到集合 S。</p></div>
  1751. <div class="faith-step"><strong>2|找依据</strong><p>让评估 LLM 将每条陈述与原始检索上下文逐一比对。</p></div>
  1752. <div class="faith-step"><strong>3|算比例</strong><p>有依据的陈述组成 V,最终 F = |V| / |S|。</p></div>
  1753. </div>
  1754. </div>
  1755. <h5 class="faith-section-title">同一批检索结果,不同回答会得到什么分数?</h5>
  1756. <div class="faith-case-grid">
  1757. <article class="faith-case is-good">
  1758. <div class="faith-case__head"><h6>案例 1|只使用部分检索信息</h6><span class="faith-case__score">F = 1.00</span></div>
  1759. <p class="faith-case__answer">“工作满一年后,每年有 5 天带薪年假。”</p>
  1760. <div class="faith-case__meta"><span>S = 1</span><span>V = 1</span><span>S1 ← C1</span></div>
  1761. <p class="faith-case__conclusion"><strong>没用完 C2–C4,不扣分。</strong>忠实度不要求把检索到的所有内容都写进答案。</p>
  1762. </article>
  1763. <article class="faith-case is-good">
  1764. <div class="faith-case__head"><h6>案例 2|同义改写,事实不变</h6><span class="faith-case__score">F = 1.00</span></div>
  1765. <p class="faith-case__answer">“连续任职 12 个月,即可享受每年 5 个工作日的带薪休假。”</p>
  1766. <div class="faith-case__meta"><span>S = 1</span><span>V = 1</span><span>S1 ← C1</span></div>
  1767. <p class="faith-case__conclusion"><strong>表达改变,不扣分。</strong>只要事实含义与检索上下文一致,就能被支撑。</p>
  1768. </article>
  1769. <article class="faith-case is-bad">
  1770. <div class="faith-case__head"><h6>案例 3|把关键数字改错</h6><span class="faith-case__score">F = 0.00</span></div>
  1771. <p class="faith-case__answer">“工作满一年后,每年有 7 天带薪年假。”</p>
  1772. <div class="faith-case__meta"><span>S = 1</span><span>V = 0</span><span>与 C1 矛盾</span></div>
  1773. <p class="faith-case__conclusion"><strong>“7 天”没有依据。</strong>即使句式很像原文,只要关键事实被改动,这条陈述就不通过。</p>
  1774. </article>
  1775. <article class="faith-case is-bad">
  1776. <div class="faith-case__head"><h6>案例 4|凭空增加新规定</h6><span class="faith-case__score">F = 0.50</span></div>
  1777. <p class="faith-case__answer">“满一年有 5 天年假;每次最多只能连续休 3 天。”</p>
  1778. <div class="faith-case__meta"><span>S = 2</span><span>V = 1</span><span>1 条有依据,1 条无来源</span></div>
  1779. <p class="faith-case__conclusion"><strong>新增事实会拉低分数。</strong>第一条由 C1 支撑,第二条在 C1–C4 中都找不到。</p>
  1780. </article>
  1781. </div>
  1782. <div class="faith-distinction">
  1783. <div>
  1784. <h6>忠实度 ≠ 文档本身是否正确</h6>
  1785. <p>即使检索文档里的制度写错了,模型原样复述仍可能得到高忠实度,因为它忠实于检索上下文。</p>
  1786. </div>
  1787. <div>
  1788. <h6>忠实度 ≠ 答案相关性</h6>
  1789. <p>若回答“连续病假两天需提交证明”,内容完全来自 C4,<strong>忠实度可为 1</strong>;但没有回答年假问题,答案相关性很低。</p>
  1790. </div>
  1791. </div>
  1792. <p class="faith-source-note">记忆口诀:忠实度看“有没有依据”,答案相关性看“有没有答题”。</p>
  1793. </section>
  1794. <hr>
  1795. <h4 id="24-answer-relevancy">2.4 答案相关性(answer relevancy)<a class="headerlink" href="#24-answer-relevancy" title="Permanent link">¶</a></h4>
  1796. <section class="faithfulness-guide relevancy-guide" aria-label="答案相关性图解与示例">
  1797. <figure class="faith-figure">
  1798. <figcaption><span class="faith-step-label">一条链记住</span>答案反推问 → 原问逐个比 → 相似求平均 → 得到 AR</figcaption>
  1799. <div class="faith-flow">
  1800. <div class="faith-node faith-node--question">
  1801. <span class="faith-node__label">原始问题 q</span>
  1802. <p>我在公司工作满一年,今年有多少天带薪年假?</p>
  1803. </div>
  1804. <div class="faith-arrow"><span>RAG 生成 LLM</span></div>
  1805. <div class="faith-node faith-node--context">
  1806. <span class="faith-node__label model-label"><span class="model-tag model-tag--rag">RAG 生成 LLM</span>AI 答案 a(q)</span>
  1807. <p>连续工作满一年后,每个自然年度享有 <strong>5 天带薪年假</strong>。</p>
  1808. </div>
  1809. <div class="faith-arrow"><span>评估 LLM</span></div>
  1810. <div class="faith-node faith-node--answer">
  1811. <span class="faith-node__label model-label"><span class="model-tag model-tag--llm">评估 LLM</span>输出:反推问题 q1–q3</span>
  1812. <ol class="faith-doc-list">
  1813. <li><span class="faith-id">q1</span><p>满一年有几天带薪年假?</p></li>
  1814. <li><span class="faith-id">q2</span><p>任职 12 个月后的年假天数是多少?</p></li>
  1815. <li><span class="faith-id">q3</span><p>满一周年可享多少天年假?</p></li>
  1816. </ol>
  1817. </div>
  1818. </div>
  1819. <div class="model-prompt">
  1820. <div class="model-prompt__row">
  1821. <span class="model-tag model-tag--rag">RAG 生成 LLM</span>
  1822. <p><strong>输入:</strong>用户问题 q + 检索上下文 c(q) <strong>提示词(简化):</strong>“请仅依据检索上下文回答用户问题。” <span class="model-prompt__output">输出:AI 答案 a(q)</span></p>
  1823. </div>
  1824. <div class="model-prompt__row">
  1825. <span class="model-tag model-tag--llm">评估 LLM</span>
  1826. <p><strong>输入:</strong>AI 答案 a(q) <strong>提示词(简化):</strong>“仅根据这份答案,反推一个它最可能在回答的问题,并判断答案是否回避作答。” <span class="model-prompt__output">同一提示运行 3 次,输出 q1–q3</span></p>
  1827. </div>
  1828. <div class="model-prompt__row">
  1829. <span class="model-tag model-tag--embedding">向量模型</span>
  1830. <p>将原问题 q 与 q1–q3 转成向量;随后由程序计算余弦相似度。<strong>这里不是让 LLM 主观打分。</strong></p>
  1831. </div>
  1832. </div>
  1833. <div class="faith-backcheck">
  1834. <div>
  1835. <p class="faith-backcheck__title"><span class="model-tag model-tag--compute">程序计算</span> 用向量逐一比较,得到 3 个余弦相似度</p>
  1836. <ul class="faith-verdict-list">
  1837. <li>sim(q, q1) = 0.96</li>
  1838. <li>sim(q, q2) = 0.94</li>
  1839. <li>sim(q, q3) = 0.92</li>
  1840. </ul>
  1841. </div>
  1842. <div class="relevancy-average-box">
  1843. <span><span class="model-tag model-tag--compute">程序计算</span> 相加后除以 3</span>
  1844. <strong>(0.96 + 0.94 + 0.92) ÷ 3 = 0.94</strong>
  1845. <p><b>0.94</b> 就是这一个答案的最终 AR</p>
  1846. </div>
  1847. </div>
  1848. </figure>
  1849. <div class="faith-explanation">
  1850. <p class="faith-explanation__lead"><strong>AR 是什么?</strong>AR = Answer Relevancy,是“这一个答案”的最终相关性分数。多个相似度求完平均后,流程就结束;这个平均值就是最终 AR。</p>
  1851. <div class="faith-steps">
  1852. <div class="faith-step"><strong>1|一个答案 → 多个问题</strong><p>评估 LLM 根据当前答案反推 q1、q2、q3。</p></div>
  1853. <div class="faith-step"><strong>2|多个问题 → 多个相似度</strong><p>每个反推问题分别与原问题 q 比较,得到 0.96、0.94、0.92。</p></div>
  1854. <div class="faith-step"><strong>3|多个相似度 → 一个 AR</strong><p>把三个数相加再除以 3,平均值 0.94 就是最终分数。</p></div>
  1855. </div>
  1856. <p class="relevancy-chain-note"><strong>为什么取平均?</strong>同一答案可能反推出措辞不同的问题。平均值把多次比较汇总成一个分数,也能减少某一次反推措辞偶然性的影响。</p>
  1857. </div>
  1858. <h5 class="faith-section-title">换一个答案,再把上面的完整流程重新跑一遍</h5>
  1859. <p class="relevancy-case-intro">下面是回答 A、B、C 三个独立案例。每个回答都会各自反推 3 个问题、算出 3 个相似度,再取平均得到自己的最终 AR;它们不是上方的 q1、q2、q3。</p>
  1860. <div class="relevancy-case-grid">
  1861. <article class="faith-case is-high">
  1862. <div class="faith-case__head"><h6>回答 A|直接且完整</h6><span class="faith-case__score">最终 AR ≈ 0.94</span></div>
  1863. <p class="faith-case__answer">“满一年后,每年有 5 天带薪年假。”</p>
  1864. <p class="relevancy-case__reverse"><strong>反推方向:</strong>大多仍在问“满一年有几天年假?”</p>
  1865. <div class="relevancy-case__math">0.96、0.94、0.92 → 平均 0.94</div>
  1866. <p class="faith-case__conclusion"><strong>高相关。</strong>完整回应了原问题。</p>
  1867. </article>
  1868. <article class="faith-case is-mid">
  1869. <div class="faith-case__head"><h6>回答 B|只答了一部分</h6><span class="faith-case__score">最终 AR ≈ 0.62</span></div>
  1870. <p class="faith-case__answer">“员工满一年后,可以享受带薪年假。”</p>
  1871. <p class="relevancy-case__reverse"><strong>反推方向:</strong>更像在问“满一年后能否休年假?”</p>
  1872. <div class="relevancy-case__math">0.66、0.62、0.58 → 平均 0.62</div>
  1873. <p class="faith-case__conclusion"><strong>中等相关。</strong>丢失了“多少天”。</p>
  1874. </article>
  1875. <article class="faith-case is-low">
  1876. <div class="faith-case__head"><h6>回答 C|答非所问</h6><span class="faith-case__score">最终 AR ≈ 0.11</span></div>
  1877. <p class="faith-case__answer">“连续病假两天,需要提交医疗机构证明。”</p>
  1878. <p class="relevancy-case__reverse"><strong>反推方向:</strong>都会围绕“病假需要什么证明?”</p>
  1879. <div class="relevancy-case__math">0.12、0.11、0.10 → 平均 0.11</div>
  1880. <p class="faith-case__conclusion"><strong>低相关。</strong>与原问题方向不同。</p>
  1881. </article>
  1882. </div>
  1883. <div class="relevancy-caution">
  1884. <strong>别混淆</strong>
  1885. <p>“满一年有 7 天年假”仍可能得到较高的答案相关性,因为它确实在回答“多少天”;但“7 天”没有检索依据,所以忠实度低。</p>
  1886. </div>
  1887. <p class="faith-source-note">记忆口诀:答案反推问,原问逐个比,相似求平均,最终就是 AR。以上分数为示意值;若答案是“不知道”等回避式回答,Ragas 会将结果置为 0。</p>
  1888. </section>
  1889. <h2 id="_3">本章小结<a class="headerlink" href="#_3" title="Permanent link">¶</a></h2>
  1890. <ul>
  1891. <li>本章节主要介绍了RAG系统如何实现评估的方式,重点分析了RAGAS系统中:上下文相关性、上下文召回率、忠实度以及答案相关性的相关指标。</li>
  1892. </ul>
  1893. </article>
  1894. </div>
  1895. <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
  1896. </div>
  1897. </main>
  1898. <footer class="md-footer">
  1899. <div class="md-footer-meta md-typeset">
  1900. <div class="md-footer-meta__inner md-grid">
  1901. <div class="md-copyright">
  1902. <div class="md-copyright__highlight">
  1903. © EnterpriseKB-RAG 2026. Internal knowledge base demo site.
  1904. </div>
  1905. Made with
  1906. <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
  1907. Material for MkDocs
  1908. </a>
  1909. </div>
  1910. </div>
  1911. </div>
  1912. </footer>
  1913. </div>
  1914. <div class="md-dialog" data-md-component="dialog">
  1915. <div class="md-dialog__inner md-typeset"></div>
  1916. </div>
  1917. <script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "\u5df2\u590d\u5236", "clipboard.copy": "\u590d\u5236", "search.result.more.one": "\u5728\u8be5\u9875\u4e0a\u8fd8\u6709 1 \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.more.other": "\u5728\u8be5\u9875\u4e0a\u8fd8\u6709 # \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.none": "\u6ca1\u6709\u627e\u5230\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.one": "\u627e\u5230 1 \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.other": "# \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.placeholder": "\u952e\u5165\u4ee5\u5f00\u59cb\u641c\u7d22", "search.result.term.missing": "\u7f3a\u5c11", "select.version": "\u9009\u62e9\u5f53\u524d\u7248\u672c"}, "version": null}</script>
  1918. <script src="../assets/javascripts/bundle.f55a23d4.min.js"></script>
  1919. <script src="../javascripts/extra.js"></script>
  1920. <script src="../javascripts/mathjax.js"></script>
  1921. <!-- <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>-->
  1922. <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
  1923. </body>
  1924. </html>