{"id":68,"date":"2026-06-29T10:21:33","date_gmt":"2026-06-29T02:21:33","guid":{"rendered":"https:\/\/genetop.top\/index.php\/2026\/06\/29\/graphrag-deepeval-faithfulness-metric-pitfall\/"},"modified":"2026-06-29T10:21:33","modified_gmt":"2026-06-29T02:21:33","slug":"graphrag-deepeval-faithfulness-metric-pitfall","status":"publish","type":"post","link":"https:\/\/genetop.top\/index.php\/2026\/06\/29\/graphrag-deepeval-faithfulness-metric-pitfall\/","title":{"rendered":"DeepEval Faithfulness Metric \u7684\u5df2\u77e5\u7f3a\u9677\uff1aidk \u4e0d\u6263\u5206\u95ee\u9898"},"content":{"rendered":"<h2 id=\"_1\">\u80cc\u666f<\/h2>\n<p>\u5728\u4f7f\u7528 DeepEval \u5bf9 GraphRAG \u7cfb\u7edf\u8fdb\u884c\u65e0\u6807\u51c6\u7b54\u6848\uff08no-reference\uff09\u8bc4\u6d4b\u65f6\uff0c\u6211\u4eec\u53d1\u73b0 <code>FaithfulnessMetric<\/code> \u5728\u7279\u5b9a\u573a\u666f\u4e0b\u4f1a\u7ed9\u51fa\u8bef\u5bfc\u6027\u7684\u6ee1\u5206\u7ed3\u679c\u3002<\/p>\n<h2 id=\"_2\">\u95ee\u9898\u73b0\u8c61<\/h2>\n<p>\u6211\u4eec\u5411 GraphRAG \u63d0\u51fa\u4e86\u4e00\u4e2a\u5173\u4e8e 5GC PDU Session \u5efa\u7acb\u6d41\u7a0b\u7684\u590d\u6742\u95ee\u9898\u3002\u7cfb\u7edf\u8fd4\u56de\u4e86\u8be6\u7ec6\u7684\u6280\u672f\u56de\u7b54\uff08\u6d89\u53ca AMF\u3001SMF\u3001UPF\u3001PCF \u7b49\u7f51\u5143\u7684\u5177\u4f53\u804c\u8d23\uff09\uff0c\u4f46\u68c0\u7d22\u5230\u7684 context \u4ec5\u5305\u542b 3GPP \u6587\u6863\u7684<strong>\u76ee\u5f55\u7ed3\u6784<\/strong>\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>The document contains a section '5.6 Session Management' with several sub-subsections.\nThe document contains a section '5.2 Network Access Control' with several sub-subsections.\n<\/code><\/pre>\n<p>Context \u4e2d\u6ca1\u6709\u4efb\u4f55\u5b9e\u8d28\u6027\u7684\u6280\u672f\u5185\u5bb9\uff0c\u4f46 Faithfulness \u8bc4\u5206\u4e3a <strong>1.00\uff08\u6ee1\u5206\uff09<\/strong>\u3002<\/p>\n<h2 id=\"_3\">\u6839\u56e0\u5206\u6790<\/h2>\n<p>Faithfulness metric \u7684\u8bc4\u4f30\u5206\u4e3a 4 \u6b65\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>Step<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1. Truths \u63d0\u53d6<\/td>\n<td>\u4ece retrieval_context \u63d0\u53d6\u4e8b\u5b9e\u5217\u8868<\/td>\n<\/tr>\n<tr>\n<td>2. Claims \u63d0\u53d6<\/td>\n<td>\u4ece actual_output \u63d0\u53d6\u58f0\u660e\u5217\u8868<\/td>\n<\/tr>\n<tr>\n<td>3. Verdicts \u5224\u5b9a<\/td>\n<td>\u5c06\u6bcf\u6761 claim \u4e0e context \u6bd4\u5bf9\uff0c\u5224\u5b9a <code>yes<\/code>\/<code>no<\/code>\/<code>idk<\/code><\/td>\n<\/tr>\n<tr>\n<td>4. Score \u8ba1\u7b97<\/td>\n<td>\u6839\u636e verdicts \u8ba1\u7b97\u6700\u7ec8\u5206\u6570<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5173\u952e\u5728\u4e8e Step 3 \u7684\u5224\u5b9a\u89c4\u5219\uff1a<\/p>\n<ul>\n<li><strong><code>yes<\/code><\/strong> \u2014 claim \u4e0e context \u4e00\u81f4<\/li>\n<li><strong><code>no<\/code><\/strong> \u2014 claim \u4e0e context <strong>\u76f4\u63a5\u77db\u76fe<\/strong><\/li>\n<li><strong><code>idk<\/code><\/strong> \u2014 context \u4e2d\u627e\u4e0d\u5230\u76f8\u5173\u4fe1\u606f\uff0c\u65e0\u6cd5\u5224\u65ad<\/li>\n<\/ul>\n<p>\u4ee5\u53ca Step 4 \u7684<strong>\u9ed8\u8ba4\u8ba1\u5206\u516c\u5f0f<\/strong>\uff1a<\/p>\n<pre><code class=\"language-python\">score = (\u603b\u6570 - no\u7684\u6570\u91cf) \/ \u603b\u6570\n<\/code><\/pre>\n<p><strong><code>idk<\/code> \u4e0d\u8ba1\u5165\u6263\u5206\u3002<\/strong> \u53ea\u6709\u660e\u786e\u77db\u76fe\uff08<code>no<\/code>\uff09\u624d\u4f1a\u964d\u4f4e\u5206\u6570\u3002<\/p>\n<h2 id=\"_4\">\u5b9e\u9645\u6848\u4f8b<\/h2>\n<p>\u6211\u4eec\u7684\u8bc4\u6d4b\u4e2d\uff0cLLM judge\uff08\u6362\u7528\u66f4\u4e25\u683c\u7684\u6a21\u578b\u540e\uff09\u5bf9 20 \u6761 claims \u5168\u90e8\u5224\u5b9a\u4e3a <code>idk<\/code>\uff1a<\/p>\n<pre><code class=\"language-json\">{\n  &quot;verdicts&quot;: [\n    {&quot;verdict&quot;: &quot;idk&quot;},\n    {&quot;verdict&quot;: &quot;idk&quot;},\n    ...  \/\/ \u5171 20 \u6761\uff0c\u5168\u90e8 idk\n  ]\n}\n<\/code><\/pre>\n<p>\u8ba1\u5206\u7ed3\u679c\uff1a<code>score = (20 - 0) \/ 20 = 1.00<\/code><\/p>\n<p>\u6700\u7ec8 reason \u8f93\u51fa\uff1a<\/p>\n<blockquote>\n<p>&#8220;The score is 1.00 because there are no contradictions; the actual output fully aligns with the retrieval context.&#8221;<\/p>\n<\/blockquote>\n<p>\u8fd9\u663e\u7136\u662f\u8bef\u5bfc\u6027\u7684 \u2014 \u56de\u7b54\u4e2d\u7684\u6240\u6709\u58f0\u660e\u90fd<strong>\u6ca1\u6709\u88ab context \u652f\u6491<\/strong>\uff0c\u4f46\u56e0\u4e3a\u4e5f\u6ca1\u6709\u88ab&#8221;\u77db\u76fe&#8221;\uff0c\u6240\u4ee5\u5f97\u4e86\u6ee1\u5206\u3002<\/p>\n<h2 id=\"_5\">\u672c\u8d28\u95ee\u9898<\/h2>\n<p>Faithfulness \u8861\u91cf\u7684\u662f<strong>&#8220;\u6709\u6ca1\u6709\u4e0e context \u77db\u76fe&#8221;<\/strong>\uff0c\u800c\u4e0d\u662f<strong>&#8220;\u6709\u6ca1\u6709\u88ab context \u652f\u6491&#8221;<\/strong>\u3002<\/p>\n<p>\u8fd9\u4e24\u4e2a\u662f\u5b8c\u5168\u4e0d\u540c\u7684\u7ef4\u5ea6\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u573a\u666f<\/th>\n<th>Faithfulness<\/th>\n<th>Groundedness<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u56de\u7b54\u5b8c\u5168\u57fa\u4e8e context<\/td>\n<td>\u9ad8<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u56de\u7b54\u6b63\u786e\u4f46 context \u65e0\u5173<\/td>\n<td>\u9ad8\uff08\u65e0\u77db\u76fe\uff09<\/td>\n<td>\u4f4e\uff08\u65e0\u652f\u6491\uff09<\/td>\n<\/tr>\n<tr>\n<td>\u56de\u7b54\u4e0e context \u77db\u76fe<\/td>\n<td>\u4f4e<\/td>\n<td>\u4f4e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5f53 retrieval context \u53ea\u5305\u542b\u76ee\u5f55\u7ea7\u3001\u6458\u8981\u7ea7\u4fe1\u606f\u65f6\uff0c\u51e0\u4e4e\u4e0d\u53ef\u80fd\u4e0e\u4efb\u4f55\u5177\u4f53\u58f0\u660e\u4ea7\u751f&#8221;\u76f4\u63a5\u77db\u76fe&#8221;\uff0cFaithfulness \u5c31\u4f1a\u6c38\u8fdc\u6ee1\u5206\u3002<\/p>\n<h2 id=\"_6\">\u89e3\u51b3\u65b9\u6848<\/h2>\n<h3 id=\"1-penalize_ambiguous_claims\">\u65b9\u6848 1\uff1a\u5f00\u542f <code>penalize_ambiguous_claims<\/code><\/h3>\n<p>DeepEval \u63d0\u4f9b\u4e86\u5185\u7f6e\u53c2\u6570\uff1a<\/p>\n<pre><code class=\"language-python\">FaithfulnessMetric(model=model, threshold=0.5, penalize_ambiguous_claims=True)\n<\/code><\/pre>\n<p>\u5f00\u542f\u540e\u8ba1\u5206\u516c\u5f0f\u53d8\u4e3a\uff1a<\/p>\n<pre><code class=\"language-python\">score = (\u603b\u6570 - no\u7684\u6570\u91cf - idk\u7684\u6570\u91cf) \/ \u603b\u6570\n<\/code><\/pre>\n<p>\u6b64\u65f6 20 \u6761\u5168 <code>idk<\/code> \u7684\u5206\u6570\u4e3a\uff1a<code>(20 - 0 - 20) \/ 20 = 0.00<\/code>\uff0c\u66f4\u771f\u5b9e\u5730\u53cd\u6620\u4e86 context \u5bf9\u56de\u7b54\u7684\u652f\u6491\u7a0b\u5ea6\u3002<\/p>\n<h3 id=\"2-groundedness\">\u65b9\u6848 2\uff1a\u8865\u5145 Groundedness \u6307\u6807<\/h3>\n<p>\u4f7f\u7528 GEval \u81ea\u5b9a\u4e49\u4e00\u4e2a Groundedness metric\uff0c\u76f4\u63a5\u8bc4\u4f30\u56de\u7b54\u662f\u5426\u88ab context \u652f\u6491\uff1a<\/p>\n<pre><code class=\"language-python\">GEval(\n    name=&quot;Groundedness&quot;,\n    criteria=&quot;Determine whether the actual output is fully supported and grounded by the retrieval context. &quot;\n             &quot;Penalize claims in the output that cannot be traced back to specific information in the retrieval context.&quot;,\n    evaluation_params=[SingleTurnParams.INPUT, SingleTurnParams.ACTUAL_OUTPUT, SingleTurnParams.RETRIEVAL_CONTEXT],\n    model=model,\n    threshold=0.5,\n)\n<\/code><\/pre>\n<h3 id=\"_7\">\u5efa\u8bae<\/h3>\n<p>\u4e24\u4e2a\u65b9\u6848\u5e76\u7528\uff1a<br \/>\n&#8211; \u4fdd\u7559 Faithfulness\uff08\u5f00\u542f <code>penalize_ambiguous_claims<\/code>\uff09\u68c0\u6d4b\u77db\u76fe\u548c\u65e0\u652f\u6491<br \/>\n&#8211; \u589e\u52a0 Groundedness \u4ece\u6b63\u9762\u8bc4\u4f30\u652f\u6491\u7a0b\u5ea6<br \/>\n&#8211; \u5728\u62a5\u544a\u4e2d\u6ce8\u660e Faithfulness \u7684\u5c40\u9650\u6027\uff0c\u907f\u514d\u8bef\u8bfb<\/p>\n<h2 id=\"claim-idk\">\u8865\u5145\u7f3a\u9677\uff1a\u603b\u7ed3\u6027 claim \u88ab\u8bef\u5224\u4e3a idk<\/h2>\n<p>\u5373\u4f7f context \u4e2d\u5305\u542b\u4e86\u5177\u4f53\u7684\u7ec6\u8282\u4fe1\u606f\uff0c\u5f53 actual output \u5bf9\u8fd9\u4e9b\u7ec6\u8282\u505a\u4e86\u5f52\u7eb3\u603b\u7ed3\u65f6\uff0cjudge \u4ecd\u7136\u53ef\u80fd\u5c06\u5176\u5224\u4e3a <code>idk<\/code>\u3002<\/p>\n<h3 id=\"_8\">\u5b9e\u9645\u6848\u4f8b<\/h3>\n<p>Context \u4e2d\u5305\u542b\u4e86 PDU Session \u5efa\u7acb\u7684\u5177\u4f53\u6b65\u9aa4\u7ec6\u8282\uff08AMF \u5904\u7406\u6ce8\u518c\u3001SMF \u9009\u62e9 UPF\u3001N4 \u4f1a\u8bdd\u5efa\u7acb\u7b49\uff09\uff0c\u800c actual output \u4e2d\u6709\u4e00\u6761\u603b\u7ed3\u6027 claim\uff1a<\/p>\n<blockquote>\n<p>&#8220;\u4eceUE\u5c1d\u8bd5\u8bbf\u95ee\u7279\u5b9aDNN\u76f4\u5230\u5b9e\u73b0\u6709\u6548\u7684\u7528\u6237\u9762\u8f6c\u53d1\uff0c\u6574\u4e2a\u8fc7\u7a0b\u6d89\u53ca\u5230\u4e86\u591a\u4e2a\u6838\u5fc3\u7f51\u5143\u4e4b\u95f4\u7684\u7d27\u5bc6\u5408\u4f5c\uff0c\u6bcf\u4e2a\u7ec4\u4ef6\u90fd\u626e\u6f14\u7740\u4e0d\u53ef\u6216\u7f3a\u7684\u89d2\u8272\u3002&#8221;<\/p>\n<\/blockquote>\n<p>Judge \u7684\u5224\u5b9a\uff1a<\/p>\n<pre><code class=\"language-json\">{\n  &quot;verdict&quot;: &quot;idk&quot;,\n  &quot;reason&quot;: &quot;The claim is a summary statement; the context provides specific procedural details but does not directly confirm this overall description.&quot;\n}\n<\/code><\/pre>\n<h3 id=\"_9\">\u539f\u56e0<\/h3>\n<p>Faithfulness \u7684 prompt \u5bf9 judge \u6709\u4e25\u683c\u7ea6\u675f\uff1a<\/p>\n<blockquote>\n<p>&#8220;Only use &#8216;no&#8217; if retrieval context DIRECTLY CONTRADICTS the claim \u2014 never use prior knowledge.&#8221;<br \/>\n&#8220;Use &#8216;idk&#8217; for claims not backed up by context \u2014 do not assume your knowledge.&#8221;<\/p>\n<\/blockquote>\n<p>Judge \u88ab\u8981\u6c42\u505a<strong>\u5b57\u9762\u7ea7\u5339\u914d<\/strong>\uff0c\u800c\u4e0d\u662f<strong>\u8bed\u4e49\u7ea7\u63a8\u7406<\/strong>\u3002\u5373\u4f7f context \u4e2d\u7684\u7ec6\u8282\u5b8c\u5168\u53ef\u4ee5\u63a8\u5bfc\u51fa\u8fd9\u4e2a\u603b\u7ed3\uff0c\u4f46\u56e0\u4e3a context \u6ca1\u6709&#8221;\u76f4\u63a5\u786e\u8ba4&#8221;\u8fd9\u53e5\u8bdd\uff0cjudge \u5c31\u53ea\u80fd\u5224 <code>idk<\/code>\u3002<\/p>\n<h3 id=\"_10\">\u5f71\u54cd<\/h3>\n<p>\u5bf9\u4e8e RAG \u7cfb\u7edf\u6765\u8bf4\uff0c\u56de\u7b54\u672c\u6765\u5c31\u5e94\u8be5\u57fa\u4e8e context \u505a\u5f52\u7eb3\u603b\u7ed3\uff0c\u8fd9\u662f\u6b63\u5e38\u4e14\u671f\u671b\u7684\u884c\u4e3a\u3002\u4f46 Faithfulness \u7684\u5b57\u9762\u7ea7\u5224\u5b9a\u4f1a\u5c06\u8fd9\u7c7b\u5408\u7406\u603b\u7ed3\u89c6\u4e3a&#8221;\u65e0\u652f\u6491&#8221;\uff0c\u5bfc\u81f4\u5f00\u542f <code>penalize_ambiguous_claims<\/code> \u540e\u5206\u6570\u504f\u4f4e\u3002<\/p>\n<h3 id=\"_11\">\u53ef\u80fd\u7684\u6539\u8fdb<\/h3>\n<p>DeepEval \u7684 <code>FaithfulnessMetric<\/code> \u652f\u6301 <code>evaluation_template<\/code> \u53c2\u6570\uff0c\u53ef\u4ee5\u7ee7\u627f <code>FaithfulnessTemplate<\/code> \u5e76\u4fee\u6539 verdict guidelines\uff0c\u5c06&#8221;\u53ef\u4ece context \u7ec6\u8282\u5408\u7406\u63a8\u5bfc\u51fa\u7684\u603b\u7ed3&#8221;\u7eb3\u5165 <code>yes<\/code> \u7684\u5224\u5b9a\u8303\u56f4\u3002\u4f46\u8fd9\u9700\u8981\u4fee\u6539\u8bc4\u6d4b\u6807\u51c6\u7684\u8bed\u4e49\uff0c\u5e94\u8c28\u614e\u4f7f\u7528\u3002<\/p>\n<h2 id=\"_12\">\u7ed3\u8bba<\/h2>\n<p>Faithfulness metric \u7684\u8bbe\u8ba1\u521d\u8877\u662f\u68c0\u6d4b hallucination\uff08\u5e7b\u89c9\uff09\uff0c\u5373\u6a21\u578b\u662f\u5426\u7f16\u9020\u4e86\u4e0e context \u77db\u76fe\u7684\u4fe1\u606f\u3002\u4f46\u5b83\u5b58\u5728\u4e24\u4e2a\u5c42\u9762\u7684\u5c40\u9650\uff1a<\/p>\n<ol>\n<li><strong>idk \u9ed8\u8ba4\u4e0d\u6263\u5206<\/strong> \u2014 context \u65e0\u5173\u65f6\u6c38\u8fdc\u6ee1\u5206\uff08\u901a\u8fc7 <code>penalize_ambiguous_claims=True<\/code> \u89e3\u51b3\uff09<\/li>\n<li><strong>\u5b57\u9762\u7ea7\u5339\u914d\u8fc7\u4e8e\u4e25\u683c<\/strong> \u2014 \u5408\u7406\u7684\u5f52\u7eb3\u603b\u7ed3\u4e5f\u4f1a\u88ab\u5224\u4e3a\u65e0\u652f\u6491\uff08\u9700\u81ea\u5b9a\u4e49 template \u6216\u4f9d\u8d56 Groundedness \u6307\u6807\u8865\u5145\uff09<\/li>\n<\/ol>\n<p>\u8bc4\u6d4b RAG \u7cfb\u7edf\u65f6\uff0c\u9700\u8981\u540c\u65f6\u5173\u6ce8 Faithfulness \u548c Groundedness \u4e24\u4e2a\u7ef4\u5ea6\uff0c\u624d\u80fd\u5168\u9762\u8bc4\u4f30\u56de\u7b54\u8d28\u91cf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u5728\u4f7f\u7528 DeepEval \u5bf9 GraphRAG \u7cfb\u7edf\u8fdb\u884c\u65e0\u6807\u51c6\u7b54\u6848\uff08no-reference\uff09\u8bc4\u6d4b\u65f6\uff0c\u6211 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[99,100,102,101,88,87,90],"class_list":["post-68","post","type-post","status-publish","format-standard","hentry","category-graphrag","tag-deepeval","tag-faithfulness","tag-groundedness","tag-hallucination","tag-llm-as-judge","tag-rag","tag-90"],"_links":{"self":[{"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/posts\/68","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/comments?post=68"}],"version-history":[{"count":0,"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/posts\/68\/revisions"}],"wp:attachment":[{"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/categories?post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/genetop.top\/index.php\/wp-json\/wp\/v2\/tags?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}