Skip to content

Ground evaluation and source validation in evidence - #36

Draft
3lf wants to merge 5 commits into
docs/base-api-lifecyclefrom
docs/base-evaluation-reliability
Draft

3lf wants to merge 5 commits into
docs/base-api-lifecyclefrom
docs/base-evaluation-reliability

Conversation

@3lf

@3lf 3lf commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Allow the automated judge to withhold a score separately for each criterion when evidence is missing. Align the prompt, strict nullable Pydantic schema and code around required points, 1/3/5 anchors and short reasons; suppress the overall average if any score is unknown. Normalize blank required points and retain assessable clarity scores.

Clarify source validation, the Replit lesson, calibration and fine-tuning scope. Correct the claim-verification and capability-removal diagrams and the evaluation-map label, and preserve the previous fine-tuning fragment. This draft depends on #35 and targets docs/base-api-lifecycle.

  • Source validation at 95ae2811f4a85c968a8b2b1ae4ab02fc21a4fda9: 79 Node tests, source/anchor QA, volatile-data checks and workflow lint. CI.
  • 36 cumulative committed Python tests include 10 judge cases covering per-criterion abstention, missing/blank inputs, strict score validation and safe output formatting. These are keyless behavior/schema checks, not a measurement of judging accuracy.
  • Anchor baseline: 363 source headings and 201 internal links; PDF heading inventory has a separate scope.
  • Stock three-edition output: 300 pages per edition; keep exact reviewed inventories and the existing 300-page ceiling. Automated checks render every page, with focused human inspection of changed evaluation/security figures and code.

This update keeps the existing PR Draft. No merge or release is included.

@3lf 3lf left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of the #33 to #39 stack at 5aacfee: needs changes, priority low.

The judge prompt template and the code's schema disagree (WRAP-039).

Size: this PR takes README.md from 530,726 to 537,604 bytes (+6,878). The README panel on the repo page only renders about the first 512,000 bytes, and main was already over that. Details and options in the #33 review, under "Stack level".

Line numbers inside the findings refer to the stack head (b779ae9) unless another commit is named; each link points to the line in this PR.

2 findings are inline threads on this diff.

The 7 findings below are nits, or on lines this PR does not change but within its topic:

Minor

  • WRAP-036 · README.md:3933 · pre-existing
    The sentence is absolute and doesn't match the parts PR #34 scoped down. Lines 2173 and 5869 to 5873 say the advice «قدم به قدم فکر کن لازم نیست» (no need for "think step by step") comes from OpenAI's guidance for its own models, and that for other models the provider's guidance and your own tests should decide; the cheat sheet at line 6419 also says «بسته به مدل» ("depends on the model"). On top of that, «چون مدل مجبوره قدم‌به‌قدم جلو بره» ("because the model is forced to go step by step") reinforces the idea that the written steps are the model's actual thinking, while the glossary at line 6566 (PR #34) says «متن مراحل، گزارش دقیق فکر درونی نیست» ("the step text is not an exact record of the internal thinking").
    Suggested fix: Suggested replacement: «با این روش، برای خیلی از مدل‌های چتی خطای ریاضی کمتر می‌شه و اگه مرحله‌ای غلط باشه، راحت‌تر پیداش می‌کنی؛ هرچند متن مراحل لزوماً همون فکر درونی مدل نیست. برای مدل‌های استدلالی، راهنمای همون ارائه‌دهنده رو ببین؛ مثلاً OpenAI می‌گه برای مدل‌های استدلالی خودش لازم نیست «قدم به قدم فکر کن» اضافه کنی.»
  • WRAP-037 · README.md:3978 · pre-existing
    In figure vis-38, besides «متناقض» ("contradictory") going to the red discard bin, there is also an arrow from the bottom of «پاسخ با منبع» ("answer with sources") to the same bin. Readers may think the final sourced answer is discarded too, or miss which one is the final output. The caption at line 4005 says «جواب نهایی همراه منبع و عدم قطعیته» ("the final answer comes with sources and uncertainty").
    Suggested fix: Remove the arrow from «پاسخ با منبع» to the bin. Keep the bin only for «متناقض» and put a «کنار گذاشته می‌شه» ("set aside") label next to it.
Nits (5)
  • WRAP-105 · README.md:3199 · new in #36
    PR #36 removed the claim «با وجود دستور صریح «تغییری نده»» ("despite an explicit 'don't change anything' instruction") because the Replit report doesn't say that, which was the right call. But the concluding sentence «دستور متنی جای محدودیت دسترسی ... رو نمی‌گیره» ("a text instruction doesn't replace access restrictions ...") stayed. The paragraph now mentions no text instruction at all, so the reader can't tell where this lesson comes from.
    Suggested fix: Align the last sentence with what the source says: «یعنی ایجنتی که به دیتابیس واقعی دسترسی نوشتن داره، می‌تونه داده رو پاک کنه؛ محدودیت دسترسی و نسخه پشتیبان جلوی این ضرر رو می‌گیرن، نه فقط دستور متنی.» Or, if the «دستور تغییری نده» claim is needed, restore it with a first-hand source from the app's owner.
    Source: https://replit.com/blog/doubling-down-on-our-commitment-to-secure-vibe-coding
  • WRAP-106 · README.md:4006 · pre-existing
    The heading «به‌روزرسانی دوره‌ای» ("periodic updating") with the English equivalent «Regular Fine-Tuning» suggests you need to fine-tune regularly to keep knowledge current. But the first paragraph of this section (line 4034) says fine-tuning is not for «اضافه کردن دانش روز» ("adding current knowledge"), and the summary at line 4149 starts «به‌روزرسانی مداوم» ("continuous updating") with search/RAG.
    Suggested fix: Suggested heading: «## ۵. فاین‌تیون برای رفتار و قالب یکدست (Fine-Tuning) 🔄». Also update the table of contents (line 189) and any link to this heading.
  • WRAP-109 · README.md:4074 · new in #36
    An HTTP status code is an identifier, and CONTRIBUTING requires Latin digits for identifiers. The book currently has three forms: line 1976 «ارور 429 یا 503» (Latin digits), line 5093 «کد خطا ۴۰۴» (Persian digits, pre-existing) and line 4099 «پاسخ ۲۰۰» (Persian digits, from PR #36). Without the word HTTP, a beginner may read «پاسخ ۲۰۰» as "two hundred responses".
    Suggested fix: Line 4099: «پاسخ HTTP 200 فقط یعنی صفحه باز شده؛ ...». Line 5093: «مثلاً «کد خطا 404»».
  • WRAP-107 · README.md:4272 · new in #36
    The phrase «نه فقط با اسم جدیدترش» (roughly "not just by its newest name") is unclear: the metric's newest name? It probably means: don't pick a metric because it's newer or its name is better known. «بسنج» ("measure") is also used where «انتخاب کن» ("choose") is meant.
    Suggested fix: Suggested wording: «* قاعده انتخاب: معیار رو با هدف کار انتخاب کن، نه به این دلیل که جدیدتره یا اسمش آشناتره. BLEU، ROUGE، BERTScore و داوری LLM هر کدوم بخشی از کیفیت رو می‌بینن...»
  • WRAP-108 · README.md:4367 · new in #36
    The vis-43 caption now has a sentence with no counterpart in the figure: the figure shows one locked dataset feeding the base and new versions, not a split into «تنظیم» ("tuning") and «آزمون نهایی» ("final test"). The vis-42 caption (line 4307) likewise mentions «آزمون مستقیم» ("direct test"), which isn't one of the figure's four boxes. Readers take a caption as a description of the figure and will look for these parts. The rules themselves are correct.
    Suggested fix: Keep the rule in the body text (lines 4364 and 4386 already state it) and make the caption describe the figure: «نسخه جدید و نسخه پایه روی یه دیتاست قفل‌شده با معیارهای ثابت سنجیده می‌شن؛ شکست قرارداد یا افت تاییدشده طبق قاعده از پیش مشخص، انتشار رو متوقف می‌کنه.» For vis-42: «... متریک خودکار (یا آزمون مستقیم، که تو شکل جدا نیومده) برای جواب قابل محاسبه ...»

Comment thread README.md

> 📋 **چک‌لیست استاندارد حرفه‌ای‌ها:** اگه می‌خوای امنیت اپ LLMت رو نظام‌مند بررسی کنی، مرجع شناخته‌شده [OWASP Top 10 for LLM Applications](https://genai.owasp.org/llm-top-10/) هست: ده ریسک اصلی اپ‌های مبتنی بر LLM (تزریق پرامپت، نشت اطلاعات حساس، اختیارات بیش از حد و...) به‌همراه راهکار. برای ایجنت‌های خودمختار هم نسخه مخصوص‌تری به اسم **OWASP Top 10 for Agentic Applications** منتشر شده.

![مسیر دفاع چندلایه از ورودی تا خروجی و مثلث داده خصوصی، محتوای نامطمئن و ارسال به بیرون](images/vis-19-defense-in-depth-lethal-trifecta.png)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor (pre-existing) · WRAP-038

The text (lines 4117 to 4123) treats the three «ضلع» ("sides") as three capabilities and says «دست‌کم یکی از این سه ضلع رو با محدودیت واقعی قطع کن» ("cut at least one of these three sides with a real restriction"), with the example «ایجنتی که وب نامطمئن رو می‌خونه، به داده خصوصی دسترسی نداشته باشه» (an agent that reads untrusted web content should not have access to private data), i.e. removing one capability. The figure, however, draws the three capabilities as the triangle's vertices and puts «یک ضلع رو قطع کن» ("cut one side") on the edge between «داده خصوصی» ("private data") and «محتوای نامطمئن» ("untrusted content"). Cutting one edge leaves all three vertices connected through the third one, so all three capabilities remain. That can create the wrong impression that separating private data from untrusted content inside the same agent (e.g. with delimiters) is enough.

Suggested fix: In the figure, cut a vertex instead: for example, show the «داده خصوصی» circle detached, with the label «برای این ایجنت حذف» ("removed for this agent"). Or, in the text, say «جزء» ("component") instead of «ضلع» so it matches the figure's vertices. Suggested caption: «اگه ایجنت هر سه توانایی رو با هم داشته باشه، دست‌کم یکی رو واقعاً ازش بگیر؛ جدا کردن متن‌ها داخل همون ایجنت کافی نیست.»

Source: https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/

Comment thread README.md Outdated
- وضوح: ۱=جواب گمراه‌کننده یا نامفهومه؛ ۳=قابل فهمه ولی ابهام داره؛ ۵=جواب روشن و راحت‌خوانه.

برای هر نمره، یه دلیل کوتاه با اشاره به متن بده.
اگه مرجع برای سنجیدن دقت کافی نیست، بنویس «اطلاعات کافی نیست» و نمره کلی نساز.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor (incomplete fix in #36) · WRAP-039

PR #36 completed the text judge template (lines 4203 to 4223) with «نکته‌هایی که جواب باید پوشش بده» (points the answer must cover), 1/3/5 anchors and an «اطلاعات کافی نیست» ("not enough information") outcome, but the Python code (lines 4236 to 4277) is untouched. judge_prompt has no required_points, no anchors and no way to withhold a score, and JudgeScore with Field(ge=1, le=5) forces the judge to give a number for every criterion, which the code then always averages. So whoever copies the code gets three numbers and an average in exactly the case where the text says «نمره نساز» ("don't produce a score"). Two side effects: the sentence at line 4234, «این بار پاسخ مرجع رو هم به داور می‌دیم» ("this time we also give the judge the reference answer"), is stale after PR #36, since the template above now has {reference} itself; and «نمره کلی نساز» ("don't produce an overall score") refers to a score PR #36 removed from the output format, while the output format (lines 4219 to 4222) has no place to write «اطلاعات کافی نیست».

Suggested fix: Two options. (a) Align the code with the template: in JudgeScore, put reasoning: str first, then reference_sufficient: bool, and make the three scores int | None = Field(default=None, ge=1, le=5); add required_points to the llm_judge signature and to the prompt text, add the 1/3/5 anchors to the prompt as well, and only average when reference_sufficient is true and all three scores are present. (b) If the code should stay as is, add this before it: «این کد نسخه ساده‌تر قالب بالاست؛ نکته‌های لازم و حالت «اطلاعات کافی نیست» رو نداره، پس قبل از استفاده واقعی اضافه‌شون کن.» Either way, change line 4234 to «این نمونه هم مثل قالب بالا، پاسخ مرجع رو به داور می‌ده؛ بدون اون، داور دقت رو فقط با دانش خودش می‌سنجه که خودش ممکنه غلط باشه.», change «نمره کلی نساز» in the template to «برای اون معیار عدد نذار», and add an example to the output format: «دقت: اطلاعات کافی نیست؛ [دلیل]».

@3lf
3lf force-pushed the docs/base-api-lifecycle branch from 7465e1e to 7488f61 Compare November 9, 2026 18:44
@3lf
3lf force-pushed the docs/base-evaluation-reliability branch from 5aacfee to babefa8 Compare November 9, 2026 18:44
@3lf
3lf force-pushed the docs/base-api-lifecycle branch from 7488f61 to d4f1369 Compare November 9, 2026 19:23
@3lf
3lf force-pushed the docs/base-evaluation-reliability branch from babefa8 to 95ae281 Compare November 9, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants