الموارد · 09
جودة نظام RAG: تقييم مساعد المعرفة بالأدلة.
قياس جودة النصوص، والاسترجاع، والاستشهادات، والإجابات، والامتناع، والانحراف بشكل منفصل لتحديد المشكلات التي تحتاج إلى إصلاح فعلي.
مُحدَّث · 9 min
ما يُساعد هذا الدليل على تحقيقه
- تحديد ما إذا كان الفشل ناتجًا عن مجموعة النصوص، أو عملية الاسترجاع، أو النموذج.
- تتبع كل اقتباس.
- مكافأة الامتناع المناسب.
- رصد الانحراف بعد التغيير.
فحص سريع
- هل المصدر المرجعي معتمد ومحدث؟
- هل يظهر المقطع الصحيح في أعلى الصفحة؟
- هل كل ادعاء حاسم مدعوم؟
- هل يمكن للمساعد أن يقول إنه لا يعرف؟
- هل يتم تصعيد الحالات الحساسة؟
طريقة خطوة بخطوة
- 1
تحديد المهام المفيدة.
جمع الأسئلة الحقيقية، ومتغيراتها، والنتيجة التجارية المتوقعة. إضافة الغموض، وتضارب المصادر، والوثائق منتهية الصلاحية، والطلبات الخارجة عن النطاق.
المُخرَج: تصنيف الحالات والمخاطر.
- 2
تنظيف مجموعة النصوص.
تعيين مالك، وحقوق، وتاريخ صلاحية، وحالة لكل مصدر. إزالة النصوص المكررة، والأجزاء غير المكتملة، والوثائق ذات المصادر غير المعروفة.
المُخرَج: سجل النصوص.
- 3
تقييم الاسترجاع.
قياس ما إذا تم العثور على المقاطع الضرورية وترتيبها قبل تقييم الصياغة النهائية. فحص الاستعلامات التي لا يوجد دليل عليها.
المُخرَج: مقاييس التغطية والملاءمة.
- 4
تقييم الإجابات والاستشهادات.
التحقق من مدى الالتزام بالنصوص، والشمولية، والقيود، وعلاقة الاستشهاد بالادعاء، والقدرة على تحديد التناقض.
المُخرَج: معايير الالتزام والفائدة.
- 5
اختبار الرفض والهجمات.
إضافة الحقن غير المباشر، وطلبات البيانات المحظورة، والمصادر الخبيثة، والوثائق ذات الأولوية الخاطئة، والإجراءات غير القابلة للتراجع. تحديد التصعيد البشري.
المُخرَج: نتائج الأمان والضوابط.
- 6
مراقبة التغييرات
إصدار البيانات، والفهرس، والإعدادات، والنموذج، والتعليمات. إعادة تشغيل المجموعة المستقرة عند كل تغيير وتحليل الملاحظات الفعلية دون الاحتفاظ ببيانات غير ضرورية.
المخرجات: لوحة معلومات الانحراف وإجراءات المراجعة.
افهم واحسب واتخذ القرار
إجابات الذكاء الاصطناعي: افصل الجودة والتغطية والامتناع
احسب الأسئلة المختبرة والإجابات المنتجة والإجابات المتحقق منها كلّاً على حدة. هذا الإطار التعليمي من CIE ليس درجة من NIST ولا يحدد عتبة قبول عامة.
استخدم هنا الأسئلة التي كانت الإجابة متوقعة لها فقط. حدّد معيار التحقق مسبقاً: صحة الإجابة ومقطع مقتبس يدعمها فعلاً ووصول مصرح به ومصدر حديث بما يكفي. قيّم الامتناع المتوقع والتناقضات والأخطاء الجسيمة بصورة منفصلة.
المؤشرات والأدلة
| المؤشر | التفسير | الدليل المطلوب |
|---|---|---|
| الأسئلة المختبرة | مجموعة يتوقع أن تكون لها إجابات | الأسئلة والمعايير والإصدارات المثبتة |
| الإجابات المنتجة | الأسئلة التي تلقت إجابة | النصوص وحالات الامتناع المحفوظة |
| الإجابات المتحقق منها | إجابات تستوفي المعيار | الحكم والمقطع الداعم |
مثال عملي افتراضي
مثال افتراضي: 100 سؤال، و80 إجابة، و72 إجابة متحققاً منها. الجودة بين الإجابات 90%، والتغطية 80%، والنجاح في المجموعة 72%. عرض 90% وحدها يخفي 20 سؤالاً بلا إجابة و8 إجابات غير متحقق منها.
- 72 / 100 · متحقق منها
- 8 / 100 · غير متحقق منها
- 20 / 100 · بلا إجابة
100 = 72 + 8 + 20. تبقى الأسئلة بلا إجابة ظاهرة؛ هذه ليست قياسات لهذا الموقع.
قاعدة الحساب
الجودة = المتحقق منها / المنتجة. التغطية = المنتجة / المختبرة. النجاح = المتحقق منها / المختبرة. لا تحسب النسبة عندما يكون المقام صفراً.
مثال عملي افتراضي
حالة توضيحية
يُجيب مساعد داخلي وفقًا لإجراءات، بعضها منتهي الصلاحية. تحتوي مجموعة الاختبار على أسئلة روتينية وغامضة وغير قابلة للإجابة؛ ويتم التحقق من كل اقتباس مقابل نسخة المستند.
القرار والأدلة المتوقعة
ينتظر الإصدار حتى يتم استبعاد المصادر منتهية الصلاحية، ورفض الإجابات غير المدعومة، وتحديد مالك المجموعة.
مؤشرات الإدارة
| المؤشر | ما يقيسه | الإجراء الأول |
|---|---|---|
| تغطية الاسترجاع | الأسئلة التي تم العثور على المقاطع اللازمة لها | إصلاح مجموعة النصوص أو تقسيمها أو الاستعلام قبل النموذج |
| المصداقية | الادعاءات المدعومة بمصادر موثقة | حجب أو إعادة كتابة الإجابات غير المدعومة |
| الامتناع المفيد | رفض الحالات التي لا تحتوي على أدلة أو تصعيدها بشكل صحيح | ضبط عتبات الثقة |
| الانحدار | اختلاف الجودة بين الإصدارات على نفس المجموعة | تحديد التغيير المسؤول |
الأخطاء الشائعة
- قياس طلاقة الكتابة فقط
- خلط فشل الاسترجاع والوهم
- استخدام مجموعة تقييم سهلة للغاية
- تغيير عدة مكونات دون مقارنة
الأسئلة المتكررة
كم عدد الأسئلة المطلوبة؟
البدء بمجموعة تمثيلية ذات إصدارات تغطي المخاطر المهمة. التنوع والجودة أهم من الكمّ المصطنع.
هل يكفي مقياس آلي واحد؟
لا. صحيح أنه يُسرّع عملية الفرز، لكن الحالات الحساسة والغامضة والمتعلقة بمجال معين تتطلب معايير واضحة ومراجعة بشرية.
هل يجب الاحتفاظ بكل محادثة؟
لا. احتفظ فقط بالسجلات الضرورية ذات الغرض المحدد، وإمكانية الوصول إليها، ومدة زمنية محددة. يُفضّل إخفاء هوية الحالات لتحسين الأداء.
RAG: حقوق الوصول والاستشهادات والذاكرة المؤقتة
الملاحظات المرجعية المفصّلة متاحة باللغة الإنجليزية في هذه النسخة.
Evaluate an answer alongside its document rights
A relevant citation can support an accurate answer while revealing a forbidden document. RAG evaluation should separate faithfulness, freshness and authorisation of passages actually supplied to the model.
- Annotate permitted documents for each test identity.
- Remove a group and replay an existing conversation and citation.
- Track incorrect answers, missing evidence and out-of-scope exposure separately.
Explore the RAG access matrix and replay cases →
References consulted on · OWASP · LLM08:2025 Vector and Embedding Weaknesses OWASP · API1:2023 Broken Object Level Authorization
الذكاء الاصطناعي: فحص نتائج JSON
الملاحظات المرجعية المفصّلة متاحة باللغة الإنجليزية في هذه النسخة.
A retrieved reference does not prove the extracted value
A RAG system can find the right document and return schema-valid JSON that misstates a field. Separate retrieval, the output contract and passage reconciliation to locate what needs correction.
- Keep an independent reference for decisive fields.
- Test missing values, contradictions and unavailable documents.
- Retain unexecuted checks as such instead of counting them as passes.
Compare the 14 outputs and their reasons →
Sources reviewed on · IETF · RFC 8259 · JSON Schema · Object reference · JSON Schema · Draft 2020-12 validation · Python 3.12 · json decoder · python-jsonschema · Schema validation · OWASP · LLM05:2025 Improper Output Handling
RAG: الملاءمة والترتيب
الملاحظات المرجعية المفصّلة متاحة باللغة الإنجليزية في هذه النسخة.
A RAG system can retrieve useful documents and still produce an incorrect answer. Retrieval evaluation therefore needs its own questions, relevance judgments and defined reading depth. This dossier explains four ranking measures without confusing them with answer faithfulness, access permissions or guaranteed business outcomes.
Documentary references: Stanford CS276’s evaluation material from the 2019 archive and NIST TREC’s reciprocal-rank definition. The CIE workshop uses binary judgments and one query at a time. RR@k here is truncated at k; MRR is a mean RR across multiple queries and is not computed by this workshop.
Stanford CS276 · Retrieval evaluation · 2019 course archive · PDF pp. 3, 5–6 · consulted 2026-10-23
Four measures, four different questions
| Measure | Workshop calculation | Useful reading | Condition or limitation |
|---|---|---|---|
| Precision@k | Relevant results in the first k / k | Measures the useful proportion in the inspected window. | Unavailable if any judgment is missing in the first k. |
| Recall@k | Relevant results in the first k / R | R is the number of relevant records in the entire small judged corpus. | If R is unknown, publish a value only when it is defined and identical in every possible case. |
| RR@k | 1 / rank of the first relevant result within k | Equals 0 when no relevant record appears in that fully judged window. | An unjudged record before the first relevant result makes that rank uncertain. |
| nDCG@k | DCG@k / IDCG@k | Compares ranking gain with the ideal order at the same k. | Unavailable if the value changes across possible cases or any case has a zero ideal. |
Explicit convention: judgment rᵢ is 0 or 1; DCG@k = Σᵢ₌₁ᵏ rᵢ / log₂(i + 1). With binary relevance, gain 2ʳⁱ − 1 also equals rᵢ. IDCG@k puts min(R, k) relevant records first using the same discount. nDCG@k = DCG@k / IDCG@k when that ideal is defined and nonzero. Keep gain, discount, depth and conventions with any published score.
NIST TREC · Reciprocal rank definition · Repository snapshot 35cf096ba6d5ae08ca4803c056b31ed61a56a6d4 · consulted 2026-10-23
A fictional six-record corpus with declared judgments
Titles and judgments below are created for this exercise. They are neither real search results nor automatic title-based judgments. 1 means relevant, 0 nonrelevant and ? unjudged. Columns Q1–Q5 correspond to the needs displayed in the workshop.
- Q1 · Prepare a restoration test
- Q2 · Authorise a document read
- Q3 · Check a quantum sensor
- Q4 · Restoration test: C judgment missing
- Q5 · Restoration: B unjudged, other records off-topic
| Fictional record | Q1 | Q2 | Q3 | Q4 | Q5 |
|---|---|---|---|---|---|
| A · Restoration procedure | 1 | 0 | 0 | 1 | 1 |
| B · Recovery budget | 1 | 0 | 0 | 1 | ? |
| C · Restoration test log | 1 | 0 | 0 | ? | 0 |
| D · Account and permission guide | 0 | 1 | 0 | 0 | 0 |
| E · Archiving policy | 0 | 0 | 0 | 0 | 0 |
| F · Publication schedule | 0 | 0 | 0 | 0 | 0 |
ورشة ترتيب الوثائق
Choose a need and enter an ordered list of A–F identifiers separated by commas. Change k to inspect only the first k results. The list may omit documents, but each identifier must be unique and k cannot exceed its length. Calculation stays local without collection, import, transmission, storage or export.
This reader queries no search engine, private corpus or AI model. It measures neither answer truth, correct citation nor permission security. Scores concern declared judgments in this small fictional universe. Do not present an exercise value as a benchmark of your system or a universal deployment threshold.
A–F, no duplicates, separated by commas; ASCII spaces allowed. k is an integer from 1 to 6, no greater than list length.
النتيجة
Unjudged and nonrelevant are different states ↓
| Rank | Fictional record | Judgment | Discount | DCG contribution |
|---|
Unjudged and nonrelevant are different states
| Situation | CIE educational convention |
|---|---|
| Missing judgment within k | Precision may vary. Reciprocal rank remains known if the first relevant record is identified before any unjudged record. |
| Missing judgment elsewhere | R becomes a range of possibilities. Do not assume recall and nDCG are always unknown: a value may remain constant, for example when the order is ideal in every case. |
| No relevant record in a fully judged corpus | Precision@k and RR@k are 0. The reader shows Recall@k and nDCG@k as unavailable for this zero-denominator case. |
| CIE publication rule | Explore every binary assignment of missing judgments, at most 64 for six records. Publish a measure only if it is defined and identical in every assignment. These are possibilities, with no probabilities assigned and no actual imputation. |
Ten explained scenarios, available without JavaScript
K01 · Relevant records first
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q1 | A,B,C,D,E,F | 3 | Precision@3 = 1, Recall@3 = 1, RR@3 = 1 and nDCG@3 = 1 in this fully judged corpus. |
K02 · Relevant records after cutoff
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q1 | D,E,F,A,B,C | 3 | All four measures are 0 at k = 3. Relevant records exist but are placed after the inspected window. |
K03 · First relevant record at rank two
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q1 | D,A,E,B,F,C | 3 | Precision@3 and Recall@3 are 1/3; RR@3 is 1/2. nDCG considers position and the ideal order. |
K04 · Relevant records omitted
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q1 | A,D,E,F | 3 | R remains 3 in the corpus even though B and C are absent from the list. Recall must not use only returned results as its denominator. |
K05 · Duplicate identifier
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q1 | A,A,B | 3 | Input rejected: A must not be counted twice. Correct the ranking rather than inflating the relevant count. |
K06 · Unjudged before the first relevant record
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q4 | C,A,D,E,B,F | 3 | C is unjudged. Precision@3, Recall@3, RR@3 and nDCG@3 are unavailable under the declared conventions. |
K07 · Unjudged after the window
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q4 | A,B,D,E,F,C | 3 | Precision@3 is 2/3 and RR@3 is 1. Recall@3 and nDCG@3 remain unavailable because C’s corpus judgment is missing. |
K08 · Need with no relevant record
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q3 | A,B,C,D,E,F | 3 | Precision@3 and RR@3 are 0. Recall and nDCG remain unavailable; this is an explicit convention rather than division by zero. |
K09 · Change reading depth
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q2 | A,D,B,C,E,F | 1 | At k = 1 no relevant record is visible. At k = 2, D appears: precision 1/2, recall 1 and RR@2 = 1/2. |
K10 · Unknown relevance, always ideal ordering
| Need | Supplied order | k | Expected reading |
|---|---|---|---|
| Q5 | A,B,C,D,E,F | 2 | B may be relevant or not. Either way, all relevant records are within the first two ranks and the order stays ideal: recall, RR and nDCG are 1. Precision remains unknown. |
Prepare a reproducible evaluation
| Suggested check | Record to retain |
|---|---|
| Needs | Representative and unanswerable questions; specify the documentary need behind each wording. |
| Corpus | Document and index versions, accessible scope and deletion or revocation rules. |
| Judgments | Relevance rule, assessors, disagreements and unjudged state; do not equate clicks with documentary truth. |
| Protocol | Same k, filters, data and conventions before and after a retrieval change. |
| Regression | Per-query and per-need-family results, gaining and losing cases, hypothesis and checks on new documents. |
| Final answer | Evaluate faithfulness, citations, useful refusals and permissions separately; better retrieval scores do not validate this stage. |
For a reviewable decision, keep the question, ranking, judgments, k and corpus limitations with the score. One average can conceal a regression on a critical need. Error tracking and answer review remain necessary even when the first records are relevant.
Sources, editions and credits
Original CIE explanations, six documents, five needs, judgments and scenarios. Conceptual references: Stanford CS276 and NIST TREC’s reciprocal-rank definition. No source chart, ranking example or code is reproduced. The CIE program and its unavailable-value conventions are not a complete trec_eval implementation.
Stanford CS276 · Retrieval evaluation · 2019 course archive · PDF pp. 3, 5–6 · consulted 2026-10-23
SHA-256 : be38261a8cdbc95551a502504d0a1c146ea453ffd9712243ea067ac8538c1826
NIST TREC · Reciprocal rank definition · Repository snapshot 35cf096ba6d5ae08ca4803c056b31ed61a56a6d4 · consulted 2026-10-23
SHA-256 : 64159909e6e1e4e9e4dd3c569b119fdc90696d0b03cd902e6a9358dcd6e84677
المراجع الرسمية
تدعم المراجع الطريقة. قم بتكييف عمليات التحقق مع سياقك؛ فهي ليست شهادة. قد تكون عناوين المراجع الأصلية والوثائق المصدرية بلغة أخرى.
تاريخ مراجعة المراجع .
- NIST — AI Risk Management Framework
- NIST — Generative AI Profile
- OWASP · LLM08:2025 Vector and Embedding Weaknesses
- OWASP · API1:2023 Broken Object Level Authorization
- IETF · RFC 8259
- JSON Schema · Object reference
- JSON Schema · Draft 2020-12 validation
- Python 3.12 · json decoder
- python-jsonschema · Schema validation
- OWASP · LLM05:2025 Improper Output Handling
- Stanford CS276 · Retrieval evaluation
- NIST TREC · Reciprocal rank definition
