Skip to content

Clarify generation and prompting limits - #34

Draft
3lf wants to merge 5 commits into
docs/base-provider-snapshotsfrom
docs/base-generation-prompting
Draft

3lf wants to merge 5 commits into
docs/base-provider-snapshotsfrom
docs/base-generation-prompting

Conversation

@3lf

@3lf 3lf commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Describe Temperature as output diversity and make the presets change one sampling control at a time. Clarify diffusion, byte-level tokenization, beam search, seed limitations, normalized final-answer voting and the decision example’s probabilities. Distinguish developer/system roles and explain the request-scoped Responses instructions caveat.

Align the prompting, phrasing-sensitivity and Lost-in-the-Middle diagrams with the qualified text, preserve the formal sample letter, and keep the former Temperature fragment working. This draft depends on #33 and targets docs/base-provider-snapshots.

  • Source validation at 88d6a7a159eafbdeee6c2c36f826063adce0a5b6: 79 Node tests, source/anchor QA, volatile-data checks and workflow lint. CI.
  • Anchor baseline: 363 source headings and 199 internal links (195 → 199); updated counters reflect the actual source.
  • Stock three-edition output: 291 pages per edition, with exact reviewed inventories retained and the 300-page ceiling unchanged. Automated PDF checks render every page; changed figure pixels receive focused visual review.

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 1c5ffc0: needs changes, priority low.

Small incomplete fixes: the temperature heading (WRAP-022), "raw text" for diffusion models (WRAP-021) and figure vis-47 (WRAP-029). The intermediate commit 27a208f fails QA on its own (WRAP-096).

Size: this PR takes README.md from 518,162 to 521,762 bytes (+3,600). 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 21 findings below are nits, or on lines this PR does not change but within its topic:

Minor

  • WRAP-022 · README.md:1078 · incomplete fix in #34
    PR #34 reframed temperature as a «ولوم تنوع» (diversity knob) and says explicitly that a higher temperature «لزوماً خلاق‌تر یا درست‌ترش نمی‌کنه» and «دمای پایین‌تر، تضمین درستی نیست» (lines 1090 and 1312). But the heading and the table of contents still present temperature as «خلاقیت / دقت» (creativity / accuracy), i.e. low temperature = accuracy. The examples on lines 1102 and 1103 (where PR #39 only removed the English labels) still state flatly that temperature=0.9 «مدل رو به سمت ایده‌های خارج از چارچوب هل می‌ده» and that a high temperature produces «متن زنده و غیرتکراری». The Temperature panel of figure vis-07 also says «ریسک انتخاب». A reader who only sees the heading and the TOC keeps the old belief.
    Suggested fix: Heading: «## مقدار Temperature (ولوم تنوع) 🌡️», and update the TOC entry on line 108 and the anchor #مقدار-temperature-ولوم-تنوع-️ in the same change. Line 1102: «مقدار temperature=0.9 می‌تونه پیشنهادهای متنوع‌تری بده؛ خودت از بینشون انتخاب کن.» Line 1103: «دمای بالاتر ممکنه تکرار رو کمتر کنه؛ کیفیت متن رو از روی نتیجه بسنج.»
  • WRAP-023 · README.md:1099 · pre-existing
    1 is the default temperature in OpenAI Chat Completions (range 0 to 2) and means the model's own distribution, unchanged. So «نزدیک به 1» (close to 1) is the wrong threshold for nonsense output, and it scares readers away from the service default. The chapter also contradicts itself: the presets table (lines 1339 and 1340) suggests 0.8 to 1.2 for brainstorming and 0.9 to 1.5 for creative writing, exactly the range this passage calls dangerous. (Anthropic's temperature range only goes up to 1, and Claude Opus 5.5, which the book uses in the API chapter, rejects sampling parameters entirely.)
    Suggested fix: Suggested wording: «هشدار: اگه دما رو خیلی بالاتر از پیش‌فرض ببری (مثلاً بیشتر از 1.2 روی APIهایی که تا 2 اجازه می‌دن)، احتمال جواب بی‌ربط و عجیب بیشتر می‌شه. پیش‌فرض خیلی از APIها 1 است؛ بازه مجاز و پیش‌فرض رو تو مستندات همون مدل ببین.» Then either limit the table's «نوشتن خلاقانه» row to 0.8 to 1.2, or add next to it «فقط جایی که API بیشتر از ۱ رو قبول کنه».
  • WRAP-024 · README.md:1126 · pre-existing
    The text itself says to keep either Temperature or Top-p fixed, but the presets table (lines 1338 to 1340) moves both away from their defaults at once for the essay, brainstorming and creative writing rows (e.g. temperature 0.9 to 1.5 together with top_p at 0.95). OpenAI also explicitly recommends changing only one of them. The reader can't tell which advice to trust.
    Suggested fix: Set the table's Top-p column to 1.0 (the default) on every row and add below the table: «اینجا فقط دما رو تنظیم کردیم؛ اگه ترجیح می‌دی با Top-p کار کنی، دما رو روی پیش‌فرض بذار.»
  • WRAP-025 · README.md:1453 · pre-existing
    Two points about message roles and trust are missing. (1) OpenAI's current guide introduces developer instructions through the developer role (or the instructions parameter in Responses), which takes priority over the user message. The book never mentions developer, so a reader who opens the docs will be confused. (2) Chapter 6 says the system prompt «یک‌بار تنظیم می‌شه» (is set once) and its effect lasts for the whole conversation (lines 1393, 1405, 1448), and Chapter 7 (line 1744, rewritten in PR #35) recommends Responses for keeping state on the server. But per OpenAI's docs, instructions apply only to that request and are not carried over to later turns via previous_response_id. A reader who combines the two loses their system prompt from the second turn on.
    Suggested fix: Below line 1462: «تو مستندات جدید OpenAI همین نقش با اسم developer اومده و اولویتش از پیام کاربر بالاتره؛ Chat Completions هنوز system رو هم قبول می‌کنه.» Below line 1744: «اگه با Responses و previous_response_id کار می‌کنی، instructions نوبت‌های قبل نگه داشته نمی‌شه؛ تو هر درخواست دوباره بفرستش.»
  • WRAP-026 · README.md:2812 · pre-existing
    In the hypothetical example, «دسترسی مشکوک» (suspicious access) has a probability of 2 percent (line 2876), but line 2881 defines urgency level two as exactly «گزارش دسترسی مشکوک» and says the score is built from the level probabilities. If the score is the weighted average of the levels (which is what the OpenAI docs describe), a score of 1.1 means level two has a probability of at least 10 percent, which does not fit 2 percent. A reader who does the math will wonder why two questions about the same signal give inconsistent numbers.
    Suggested fix: Either bring the table value close to one («مثلاً ۰٫۹۸ در مقیاس صفر تا دو») and change the sentence on line 2881 to «امتیاز ۰٫۹۸ یعنی برآورد فوریت خیلی نزدیک سطح یکه», or set the «بله» (yes) probability of the second question to about 10 percent and explain in the text why the two numbers are related.
    Source: https://developers.openai.com/api/docs/guides/decisions
  • WRAP-027 · README.md:3780 · pre-existing
    In image vis-39 itself, the third box of the bottom row is labelled «اطلاعات مهم آخز» (with «ز») instead of «آخر». A spelling mistake in a figure of a Persian teaching book, and it repeats in all three PDF editions.
    Suggested fix: Regenerate the image with the label «اطلاعات مهم آخر», then proofread all Persian labels in the figure once at high zoom.
  • WRAP-028 · README.md:3819 · pre-existing
    Testing several phrasings shows and measures instability; it does not make the model's output more stable by itself. Yet figure vis-40 draws «تست چند بیان» (multi-phrasing test) as a model input next to «قالب ثابت» (fixed format) and «مثال» (example). The section text is correct (lines 3880 and 3882 use the comparison of phrasings for «بررسی» (review) and «تست مقاومت» (robustness testing) during evaluation). PR #38 fixed the direction of the figure's input arrows but not this.
    Suggested fix: Caption: «چند بیان مختلف از یه خواسته می‌تونه جواب‌های ناپایدار بده؛ قالب ثابت و مثال می‌تونن خروجی رو یکدست‌تر کنن و تستِ چند بیان نشون می‌ده این کار واقعاً جواب داده یا نه.» In the figure, move «تست چند بیان» out of the model inputs and draw it next to the outputs as a measurement step.
Nits (14)
  • WRAP-096 · book/content-inventory.json:18 · new in #34
    PR #34 has two commits. The first one, 27a208fdb5, turns a «⚠️» warning into a «💡» tip but does not update content-inventory.json; the second commit only fixes those counters. So 27a208fdb5 on its own fails the PDF QA (tip 40 vs 39, warn 14 vs 15), and CI never ran on it. If the PR is merged with a merge commit, a red commit lands in main's history and will mislead git bisect.
    Suggested fix: Either squash-merge PR #34, or squash the two commits into one before merging (the decision and the force-push are the owner's call).
  • WRAP-083 · README.md:311 · pre-existing
    The text says there are three core concepts, but the chapter has four numbered subsections («۴. معماری‌های پشت صحنه») and the TOC lists four as well. Section 4 itself says «فقط برای آشنایی با اسم‌هاست» (only to get familiar with the names), but the chapter's opening sentence doesn't say so.
    Suggested fix: Suggested wording: «کلاً ۳ تا مفهوم اصلی داریم که اگه بفهمیم، تقریباً کل داستان دستمون میاد؛ آخر فصل هم چند اسم معماری رو که زیاد می‌شنوی کوتاه معرفی می‌کنیم:»
  • WRAP-084 · README.md:334 · pre-existing
    Today's common tokenizers (such as o200k_base) use byte-level BPE and start from bytes, not characters. For Persian the difference matters: each Persian letter is two bytes in UTF-8, which is one reason Persian text costs more tokens, a point the book covers a few lines later. Simplifying it to «از حروف» (from characters) hides that mechanism.
    Suggested fix: Suggested wording: «... روشی که از واحدهای خیلی کوچیک (تو خیلی از مدل‌ها، بایت‌ها) شروع می‌کنه و تکه‌های پرتکرار رو قدم‌به‌قدم به هم می‌چسبونه. هر حرف فارسی تو حافظه کامپیوتر معمولاً دو بایته؛ برای همین کلمه‌های کم‌تکرار فارسی ممکنه به تکه‌های بیشتری بشکنن.»
  • WRAP-085 · README.md:366 · pre-existing
    The alt text and the figure match each other (an animal cluster: cat, tiger, lion; a food cluster: apple, banana), but the text right above the figure uses a different example (king and queen, apple and orange, apple and car). The reader will look for those words in the figure. Also, «شیر» is ambiguous in Persian (lion or milk) and is exactly the kind of word a context-free word embedding leaves stuck between two clusters.
    Suggested fix: Either align the text's example with the figure («گربه نزدیک ببره، سیب نزدیک موز، ولی سیب از گربه دوره») or add below the figure: «تو شکل از کلمه‌های دیگه‌ای استفاده کردیم؛ ایده همونه.» «شیر» could also be used for a short note on words with several meanings.
  • WRAP-086 · README.md:433 · pre-existing
    Vocabularies of today's tokenizers are usually above 100,000 tokens (o200k_base has about 200,000), so «ده‌ها هزار» (tens of thousands) understates the size. Also, in the «سه گزینه برتر» (top three options) list the first item is the least likely one («برنده» at 5 percent), while figure vis-03 correctly orders them by probability.
    Suggested fix: Suggested wording: «از بین ده‌ها یا صدها هزار توکن ممکن (بسته به توکنایزر)...», and order the list as «خوشحال (۲۰ درصد)، آزاد (۱۵ درصد)، برنده (۵ درصد)».
  • WRAP-087 · README.md:452 · pre-existing
    Beam search is not a «ترکیبی» (hybrid) method. It is a deterministic search that keeps several likely sequences at once and finally picks the most likely complete sequence; «ترکیبی» suggests a mix of sampling and argmax. General-purpose chat APIs also usually don't expose beam search.
    Suggested fix: Suggested wording: «... انتخاب قطعی با argmax (حریصانه)، یا جست‌وجوهایی مثل beam search که چند ادامه محتمل رو با هم جلو می‌برن و آخر بهترین دنباله کامل رو برمی‌دارن.»
  • WRAP-088 · README.md:604 · pre-existing
    The sample letter says «از مرخصی استحقاقی خود استفاده نمایم» (line 594), but the prompt never named the type of leave, so the model added an assumption («مرخصی استحقاقی», earned leave). The sentence «از خودش چیزی نساخته» (it made nothing up) doesn't match the sample, and it misses a good chance to teach checking for added assumptions. The letter is deliberately formal and should not be made colloquial.
    Suggested fix: Change only the explanatory sentence: «جاهای خالی رو ساختگی پر نکرده، ولی یه فرض کوچیک اضافه کرده: «مرخصی استحقاقی». اگه نوع مرخصی برات مهمه، تو پرامپت بگو یا قبل از ارسال چکش کن.» Leave the formal letter as it is.
  • WRAP-097 · README.md:1196 · new in #34
    The rule «بار اول فارسی (English)» (Persian first, English in parentheses on first use) is broken in several places in the chain. PR #34 removed «حریصانه» from next to Greedy, so Greedy now has no Persian equivalent anywhere in the book (lines 1200 and 1203). PR #35 wrote «حالت JSON mode» (line 740), which says "mode" twice («حالت» and «mode»), and used «اتمی» (line 4534) without (Atomic), which a Persian reader is more likely to associate with «هسته‌ای» (nuclear). PR #36 used «Rollback» (line 3222) without a Persian equivalent.
    Suggested fix: Line 1203: «...همون حالت حریصانه (Greedy).»; line 740: «...حالت JSON (JSON mode) رو روشن می‌کنه»; line 4534: «بررسی و ثبت کلید باید اتمی (Atomic) باشه؛ یعنی...»; line 3222: «...با برگردوندن نسخه قبلی (Rollback) داده‌ها رو کامل برگردوند.»
  • WRAP-089 · README.md:1289 · pre-existing
    Per OpenAI's docs, seed is only a best-effort attempt at identical output for repeated requests with the same parameters. Once the prompt changes, the request is no longer the same, so seed does not make a comparison of two prompts fair. One sample per prompt is also not enough to say which one is better. The note on line 1300 says «خروجی‌ها خیلی به هم نزدیک می‌شن» (outputs become very close), which is stronger than the docs' "Determinism is not guaranteed". (The «منسوخ‌شده» (deprecated) claim on line 1300 is correct.)
    Suggested fix: Suggested wording: «مثلاً داری دو نسخه از یه پرامپت رو مقایسه می‌کنی. seed کمک می‌کنه اجرای تکراری همون درخواست تا حد ممکن یکسان بمونه؛ ولی برای مقایسه دو پرامپت، هر کدوم رو روی چند ورودی و چند بار اجرا کن و نتیجه‌ها رو با یه معیار ثابت بسنج.» On line 1300: «ولی ممکنه خروجی‌ها باز هم فرق کنن.»
  • WRAP-090 · README.md:1442 · pre-existing
    The sentence reads as a guarantee, while a system prompt only makes consistent output more likely. The PRs in this chain already softened this kind of absolute promise in chapters 3 to 5 (e.g. lines 560, 708, 1090), but this one was missed. Line 1395 also correctly says a system prompt is not a security lock.
    Suggested fix: Suggested wording: «- یکپارچگی خروجی‌ها: کمک می‌کنه جواب‌ها منسجم‌تر و هم‌سبک‌تر باشن؛ با چند ورودی متفاوت تستش کن.»
  • WRAP-091 · README.md:2243 · pre-existing
    In the original Self-Consistency method, several step-by-step reasoning paths (CoT) are sampled and the vote is taken on the extracted final answers. The text mentions neither part: that each run should ask for a step-by-step solution, or that the final answer has to be extracted and normalized before voting (e.g. «۱۴:۱۵» vs «ساعت دو و ربع»). Without that, voting over full responses doesn't work.
    Suggested fix: Add to line 2303: «هر بار از مدل راه‌حل مرحله‌ای می‌خوای، ولی فقط جواب نهایی هر اجرا رو جدا می‌کنی و همون‌ها رو با هم مقایسه می‌کنی.» Add to step 3 of the prerequisites: «قبل از رای‌گیری، جواب‌ها رو به یه شکل یکسان دربیار (مثلاً ساعت با قالب HH:MM).»
  • WRAP-093 · README.md:3597 · pre-existing
    The sentence presents Jailbreak as another name for this whole attack and then lists both the direct and the indirect type under it. But Jailbreak is a form of prompt injection aimed at bypassing the model's own safety rules; indirect injection (e.g. a hidden instruction in a web page to send data out) is not a Jailbreak. Line 3680 correctly ties Jailbreak to the direct case, so line 3662 is also not fully consistent with line 3680.
    Suggested fix: Suggested wording: «یه نکته مهم: به این حمله تزریق پرامپت (Prompt Injection) می‌گن و معمولاً دو مدل رایج داره: ... . به تلاش برای دور زدن قواعد ایمنی خود مدل، که معمولاً از پیام کاربر میاد، Jailbreak هم می‌گن؛ پس هر Jailbreak یه جور تزریقه، ولی هر تزریقی Jailbreak نیست.»
    Source: https://genai.owasp.org/llmrisk/llm01-prompt-injection/
  • WRAP-094 · README.md:3780 · pre-existing
    PR #37 scoped the text (line 3825) and the caption (line 3847) to «تو بعضی آزمون‌ها، استفاده از اطلاعات میانه ضعیف‌تر بوده» (in some tests, use of information in the middle was weaker), but the image alt text, which screen readers read out, still describes the effect in general terms and with the word «توجه» (attention). The figure also has four solution boxes (important info first, important info last, summary, retrieval), not three.
    Suggested fix: Suggested alt text: «تصویر «یه کانتکست بلند که اطلاعاتِ اول و آخرش پررنگ‌تر و میانه‌ش کم‌رنگ‌تر نشون داده شده، همراه چهار راه: اطلاعات مهم اول، اطلاعات مهم آخر، خلاصه و بازیابی» (images/vis-39-lost-in-the-middle.png)»
  • WRAP-095 · README.md:5765 · new in #34
    The heading changed from «ساده و مستقیم» to «روشن و مستقیم» (simple and direct to clear and direct), but the next sentence still defines «ساده», which is no longer in the heading. Two lines above (line 5869), «توصیه‌های زیر از راهنمای OpenAI ... شروع می‌شن» uses the wrong verb: it means "taken from" or "based on", not "start".
    Suggested fix: Line 5875: «۲. ساده و مستقیم بنویس. ساده یعنی بی‌ابهام، نه اینکه اطلاعات لازم رو حذف کنی.» Line 5869: «توصیه‌های زیر از راهنمای OpenAI برای مدل‌های استدلالی خودش گرفته شدن.»

Comment thread README.md Outdated
**۳. مدل‌های زبانی دیفیوژنی (Diffusion LLM) 🌫️**

یادته گفتیم مدل توکن‌به‌توکن و پشت‌سرهم تولید می‌کنه؟ مدل‌های دیفیوژنی (همون خانواده‌ای که تصویر تولید می‌کنه) راه متفاوتی می‌رن: **کل متن رو هم‌زمان و موازی** تولید می‌کنن؛ از یه حالت خام شروع می‌کنن و قدم‌به‌قدم پالایشش می‌دن. نتیجه‌ش سرعت تولید خیلی بالاست (حدود هزار توکن در ثانیه تو نمونه‌هایی مثل Mercury و Gemini Diffusion). هنوز اول راهن و کیفیت‌شون به پای مدل‌های اصلی نمی‌رسه، ولی احتمالاً تو سال‌های آینده بیشتر ازشون می‌شنوی.
یادته گفتیم مدل توکن‌به‌توکن و پشت‌سرهم تولید می‌کنه؟ مدل‌های دیفیوژنی راه متفاوتی دارن: از یه متن خام شروع می‌کنن و تو چند دور، **چند جای متن رو موازی پالایش می‌کنن**. بسته به روش، این کار می‌تونه روی یه بلوک از متن انجام بشه و بعد بلوک بعدی ساخته بشه؛ لازم نیست کل جواب نهایی یک‌جا تولید بشه. این موازی‌سازی می‌تونه به سرعت کمک کنه، ولی سرعت و کیفیت واقعی به مدل، تعداد دورهای پالایش و نوع کار بستگی داره.

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 (new in #34) · WRAP-021

Common diffusion language models (such as LLaDA and Mercury) start from a sequence of masked tokens or noise, not from «متن خام» ("raw text"), which a reader will picture as a rough first draft. main had «از یه حالت خام شروع می‌کنن» ("start from a raw state"), which was more accurate; PR #34 changed «حالت» (state) to «متن» (text). Figure vis-04 also shows the starting point as unreadable scribbles (noise), not text.

Suggested fix: Suggested wording: «از یه دنباله پر از جای خالی (توکن‌های ماسک‌شده) شروع می‌کنن و تو چند دور، چند جای متن رو موازی پر و پالایش می‌کنن.»

Comment thread README.md
> 💡 **جانِ کلام:** با مدل چتی مثل یه دستیار حرف بزن که باید راهنماییش کنی؛ با مدل استدلالی مثل یه متخصص که فقط باید «صورت‌مسئله، قیدها و معیار تحویل» رو بدونه. ([راهنمای رسمی OpenAI](https://developers.openai.com/api/docs/guides/reasoning-best-practices))
> 💡 **جانِ کلام:** با صورت‌مسئله، قیدها و معیار تحویل روشن شروع کن؛ اگه نتیجه نگرفتی، داده یا مثال مفید اضافه کن و دوباره بسنج. این‌ها توصیه شروعن، نه تضمین یا قانون مشترک همه مدل‌ها. ([راهنمای رسمی OpenAI](https://developers.openai.com/api/docs/guides/reasoning-best-practices))

![پرامپت کوتاه با صورت مسئله و قیدها برای مدل استدلالی، همراه تنظیم تلاش استدلال و بررسی جواب](images/vis-47-reasoning-model-prompting.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 (incomplete fix in #34) · WRAP-029

PR #34 softened the text and the caption: a good example is still useful (line 5867, recommendation 4), and a required method or step should «حتماً» (definitely) be stated (line 5877). But figure vis-47 is unchanged: under the heading «شلوغی بی‌فایده» (useless clutter) it still crosses out a step-by-step flowchart and a grid of boxes (which reads as "several examples"). The figure's visual message, that steps and examples are redundant, contradicts the new text. The new caption (line 5914) is correct but does not explain the figure.

Suggested fix: Either fix the figure (label the red box «دستور تکراری و دیکته بی‌دلیل» and remove the grid box), or make the caption explicit: «> 🖼️ دستورهای تکراری و دیکته‌کردن قدم‌هایی که جزو خواسته نیستن کمکی نمی‌کنن؛ قید و مرحله اجباری و مثال مفید رو نگه دار و با تست بسنج.»

@3lf
3lf force-pushed the docs/base-generation-prompting branch from bbe8ff1 to 88d6a7a 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