本页目录

📗 第 5 章 · Prompt engineering techniques

所属课程:课程 004 Building with the the AI API
官方章节名:Prompt engineering techniques
课时数:7
CCAR-F 主命中领域:D3 20%
归档日期:2026-10-15


📋 本章课时清单

本章序 全课序 类型 课时 lesson ID 直链 精译
1 24 🎬 视频 Prompt engineering 287745 直链 ✅ 已精译
2 25 🎬 视频 Being clear and direct 287744 直链 ✅ 已精译
3 26 🎬 视频 Being specific 287740 直链 ✅ 已精译
4 27 🎬 视频 Structure with XML tags 287741 直链 ✅ 已精译
5 28 🎬 视频 Providing examples 287746 直链 ✅ 已精译
6 29 🎬 视频 Exercise on prompting 287748 直链 ⏸ 不补
7 30 📝 测验 Quiz on prompt engineering techniques 289121 直链 ⏸ 不补

🎯 本章考点提示

D3(20%)核心,7 课时。官方提示工程四件套:Being clear and direct / Being specific / Structure with XML tags / Providing examples。

⭐ 这四条是 D3 的命题骨架;课程003 未系统覆盖,属本课新增。


📖 逐课精译

课时 1 · Prompt engineering

类型:🎬 视频 | lesson ID:287745 | 官方直链

🎯 本课学习目标(据官方段落反推)

  1. 能说出提示词工程的定义:把写好的提示词迭代改进到更可靠、更高质量的输出。
  2. 能背出五步迭代循环(Set a goal → Write initial → Evaluate → Apply techniques → Re-evaluate)。
  3. 能说出 PromptEvaluator 及其 max_concurrent_tasks 参数的用途与并发策略。
  4. 能写出 generate_dataset 生成测试数据、run_evaluation 带 extra_criteria 的调用。
  5. 能解释「基线(baseline)→ 一次只改一处 → 可量化提升」的工程原则,以及初始低分(如 2.3/10)为何正常。

一、开场:提示词工程是什么

官方原句:Prompt engineering is about taking a prompt you've written and improving it to get more reliable, higher-quality outputs. This process involves iterative refinement - starting with a basic prompt, evaluating its performance, then systematically applying engineering techniques to improve it.

精译:提示词工程就是把你写好的提示词拿来改进,以获得更可靠、更高质量的输出。这个过程涉及迭代式精炼(iterative refinement)——从一个基础提示词起步,评估它的表现,然后系统地应用工程技巧来改进它。

⭐ 开章定调(D3 20% 核心):这是第 5 章的元定义。三个关键词:improving(改进已有)、iterative refinement(迭代精炼)、systematically applying techniques(系统应用技巧)。注意它把「提示词工程」定义为循环改进而非一次性创作——天然承接第 4 章「评估=度量」的闭环:没有评估,就无法知道该改进哪里。


二、⭐⭐ 五步迭代循环(The Iterative Improvement Process)

官方原句:The approach follows a clear cycle that you can repeat until you achieve your desired results:

  1. Set a goal - Define what you want your prompt to accomplish
  2. Write an initial prompt - Create a basic first attempt
  3. Evaluate the prompt - Test it against your criteria
  4. Apply prompt engineering techniques - Use specific methods to improve performance
  5. Re-evaluate - Verify that your changes actually improved the results

You repeat the last two steps until you're satisfied. Each iteration should show measurable improvement in your evaluation scores.

精译:这套方法遵循一个清晰的循环,你可以不断重复直到达到期望结果:① 设定目标——明确你的提示词要实现什么;② 写初始提示词——做第一个基本尝试;③ 评估提示词——对照你的标准测试它;④ 应用提示词工程技巧——用具体方法提升表现;⑤ 重新评估——验证改动是否真的改善了结果。你重复后两步直到满意。每次迭代都应让评估分数出现可衡量的提升。

⭐⭐ 本课第一号考点(D3)——五步循环是必背骨架: * 顺序:Set a goal → Write an initial prompt → Evaluate → Apply techniques → Re-evaluate。 * 关键:重复的是「后两步」(Apply techniques ↔ Re-evaluate),不是全部五步——目标(goal)和初始提示词只做一次。 * 可量化:每次迭代必须「measurable improvement in evaluation scores」——这再次把「评估分数」作为迭代的标尺(承接第 4 章,也为后面课时 2–5 的各类技巧提供「是否有效」的判定依据)。


三、⭐⭐ 搭建评估管线:PromptEvaluator(Setting Up Your Evaluation Pipeline)

官方原句:To demonstrate this process, we'll work with a practical example: creating a prompt that generates one-day meal plans for athletes. The prompt needs to take into account an athlete's height, weight, goals, and dietary restrictions, then produce a comprehensive meal plan.

The evaluation setup uses a PromptEvaluator class that handles dataset generation and model grading. When creating your evaluator instance, you can control concurrency with the max_concurrent_tasks parameter:

evaluator = PromptEvaluator(max_concurrent_tasks=5)

Start with a low concurrency value (like 3) to avoid rate limit errors. You can increase it if your API quota allows for faster processing.

精译:为演示这一过程,我们用一个实用例子:写一个为运动员生成一日餐计划的提示词。提示词需要考虑运动员的身高、体重、目标、饮食限制,然后产出全面的餐食计划。评估环境用一个 PromptEvaluator 类,负责数据集生成和模型评分。创建评估器实例时,用 max_concurrent_tasks 参数控制并发度:evaluator = PromptEvaluator(max_concurrent_tasks=5)。先从较低的并发值(如 3)开始,以避开限流(rate limit)错误;如果 API 配额允许,可以调高以获得更快的处理。

⭐⭐ 本课第二号考点(D1/D5): * PromptEvaluator 是官方为演示封装的类,两大职责:dataset generation(数据集生成,课时 3 的自动化形态)+ model grading(模型评分,课时 5/6 的封装)。它就是第 4 章「评估工作流」的可复用类。 * max_concurrent_tasks 控制并发度。初始用低并发(如 3)防限流(rate limit),配额允许再调高提速。这属于 D5 治理:控制并发以避免触发 API 限流,是工程纪律(呼应课程 003 的速率限制)。


四、⭐⭐ 生成测试数据(Generating Test Data)

官方原句:The evaluation system can automatically generate test cases based on your prompt requirements. You define what inputs your prompt needs:

dataset = evaluator.generate_dataset( task_description="Write a compact, concise 1 day meal plan for a single athlete", prompt_inputs_spec={ "height": "Athlete's height in cm", "weight": "Athlete's weight in kg", "goal": "Goal of the athlete", "restrictions": "Dietary restrictions of the athlete" }, output_file="dataset.json", num_cases=3 )

Keep the number of test cases low (2-3) during development to speed up your iteration cycle. You can increase this for final validation.

精译:评估系统能根据你的提示词需求自动生成测试用例。你定义提示词需要的输入:generate_dataset 接收 task_description(任务描述)、prompt_inputs_spec(输入规格,如身高/体重/目标/饮食限制)、output_file(落盘文件)、num_cases(用例数)。开发期把用例数保持在低位(2–3)以加速迭代周期;最终验证时再调高。

⭐⭐ 本课第三号考点(D3/D4): * generate_dataset 四参数:task_description(任务描述)、prompt_inputs_spec(输入规格 dict)、output_file(落盘)、num_cases(用例数)。这是课时 3「生成数据集」的参数化封装。 * prompt_inputs_spec 是关键:它是一个 dict,键=输入名,值=说明。它定义了「提示词需要哪些输入」,评估系统据此生成多样化的测试用例——输入规格决定测试覆盖面。 * 开发/验证两阶段用例数:开发期 2–3 条(快迭代),最终验证调高(更全面)。这再次呼应「评估是批处理、吞吐优先」——开发期少跑、快跑。


五、⭐⭐ 写初始提示词(Writing Your Initial Prompt)

官方原句:Start with a simple, naive prompt to establish a baseline. Here's an example of a deliberately basic first attempt:

def run_prompt(prompt_inputs):
    prompt = f"""
What should this person eat?

- Height: {prompt_inputs["height"]}
- Weight: {prompt_inputs["weight"]}
- Goal: {prompt_inputs["goal"]}
- Dietary restrictions: {prompt_inputs["restrictions"]}
"""
    messages = []
    add_user_message(messages, prompt)
    return chat(messages)

官方原句:This basic prompt will likely produce poor results, but it gives you a starting point to measure improvement against.

精译:用一个简单、天真的提示词开始,以建立一个基线。下面是一个刻意写得基础的首次尝试:run_prompt(prompt_inputs) 用 f-string 拼出提示词(把身高/体重/目标/饮食限制填进去),加用户消息后 chat(messages)。这个基础提示词很可能产出糟糕的结果,但它给你一个衡量改进的起点。

⭐⭐ 本课第四号考点(D3/D4): * naive prompt(天真提示词)是有意的:先故意写一个最简单的版本建立 baseline,再靠迭代提升。基线不是「好」,而是「可对照的起点」——呼应课时 4/6 的 baseline 概念。 * 函数签名:run_prompt(prompt_inputs) 接收一个 dict(prompt_inputs["height"] 等),返回 chat(messages) 的结果。这是评估系统的统一回调签名——run_evaluation(run_prompt_function=run_prompt, ...) 传入的就是它。 * 结构上仍是加 user 消息 → chat() 的极简形态(还没上 system prompt / 结构化 / 示例——那些正是课时 2–5 要逐个加的技巧)。


六、⭐⭐ 加评估标准(Adding Evaluation Criteria)

官方原句:When running your evaluation, you can specify additional criteria that the grading model should consider:

results = evaluator.run_evaluation( run_prompt_function=run_prompt, dataset_file="dataset.json", extra_criteria=""" The output should include: - Daily caloric total - Macronutrient breakdown - Meals with exact foods, portions, and timing """ )

This helps ensure your prompt is evaluated against the specific requirements that matter for your use case.

精译:运行评估时,你可以指定评分模型应考虑的额外标准:run_evaluation(run_prompt_function=run_prompt, dataset_file="dataset.json", extra_criteria="""...""")。extra_criteria 里写「输出应包含:每日总热量、宏量营养素分解、含具体食物/份量/时间的餐次」。这能确保你的提示词针对对你用例重要的具体需求被评估。

⭐⭐ 本课第五号考点(D3/D4): * run_evaluation 三参数:run_prompt_function(回调函数)、dataset_file(数据集)、extra_criteria(额外标准)。 * extra_criteria 的作用:把领域要求注入评分模型——不是笼统「评好不好」,而是按你定义的指标评(热量/营养素/餐次细节)。这实现了课时 1「评估要针对具体标准」和课时 5「评估标准先于 grader」的落地。 * extra_criteria ≠ 系统提示词:它是给评分模型看的评判维度,不是给生成模型看的输出约束——评分标准与生成指令分离,这是本课的一个细微但重要的概念点。


七、⭐ 分析结果(Analyzing Results)

官方原句:After running an evaluation, you'll get both a numerical score and a detailed HTML report. The report shows you exactly how each test case performed, including the model's reasoning for each score.

Don't be discouraged by low initial scores - a score of 2.3 out of 10 is typical for a first attempt. The goal is to see consistent improvement as you apply engineering techniques.

The detailed evaluation report helps you understand exactly where your prompt is failing and what improvements are needed. Use this feedback to guide your next iteration.

精译:运行评估后,你会得到数值分数和一份详细的 HTML 报告。报告展示每条用例表现如何,包括评分模型对每个分数的推理(reasoning)。别被低初始分数打击——2.3/10 对首次尝试很正常。目标是在应用工程技巧时看到持续的提升。详细报告帮你精确定位提示词在哪失败、需要哪些改进,用这份反馈指导下一次迭代。

⭐ 承前(D3/D5):双输出——数值分 + HTML 报告。报告含逐条用例的 model reasoning(正好是课时 5「评分要带 reasoning」的消费端)。2.3/10 首次正常、目标是持续提升(consistent improvement)——这再次强调「分数是相对改进的标尺,不是绝对好坏」(同课时 4/6)。反馈驱动下一轮迭代,闭环成型。


八、⭐ Next Steps(后续步骤)与原则

官方原句:With your baseline established, you're ready to start applying specific prompt engineering techniques. Each technique you learn should result in measurable improvement in your evaluation scores, gradually transforming your basic prompt into a reliable, high-performing tool.

Remember that prompt engineering is an iterative process. The key is to make one change at a time, evaluate the impact, and build on what works. This systematic approach ensures you understand which techniques provide the most value for your specific use case.

精译:基线建立后,你就可以开始应用具体的提示词工程技巧了。你学到的每个技巧都应让评估分数可量化地提升,逐步把你的基础提示词变成可靠、高性能的工具。记住提示词工程是迭代过程:关键是一次只改一处、评估影响、在有效的基础上叠加。这种系统化做法能确保你清楚哪些技巧对你的用例最有价值。

⭐⭐ 本课第六号考点(D3)——工程原则: * 一次只改一处(make one change at a time):这是控制变量的核心——否则无法归因是哪个技巧起了作用。这是最像判断题/简答题的原则点。 * 逐技巧可量化:每个技巧都应带来评估分数提升(承接 §2 的 measurable improvement)。 * 系统化归因:which techniques provide the most value for your specific use case——技巧没有绝对好坏,只有对某用例的价值大小(呼应课时 4「按场景调权重」的相对主义)。


九、⭐ Key Takeaways(本课官方无独立 Key Takeaways 段,据正文反推)

  1. 提示词工程 = 改进已有提示词的迭代精炼,不是一次写对。
  2. 五步循环:Set a goal → Write initial → Evaluate → Apply techniques → Re-evaluate(后两步重复)。
  3. PromptEvaluator 封装数据集生成+模型评分;max_concurrent_tasks 低并发(3)防限流,配额允许再调高。
  4. generate_dataset(task_description / prompt_inputs_spec / output_file / num_cases)+ run_evaluation(run_prompt_function / dataset_file / extra_criteria)。
  5. 初始 naive prompt 建基线(2.3/10 正常);一次只改一处、逐技巧可量化提升。

🔤 本课新生词(临时小表 · 已回灌 30-单词表/04- 第 5 章分组)

星 词汇 音标 本课义 备注
⭐⭐ iterative (adj.) / iterative refinement /ˈɪtərətɪv/ 迭代的 / 迭代式精炼 已在 §4 课时2 收录
⭐⭐ refinement (n.) /rɪˈfaɪnmənt/ 精炼、改良 已在 §3 课时9 收录
⭐⭐ systematically (adv.) /ˌsɪstəˈmætɪkli/ 系统地 已在 §4 课时1 收录
⭐ naive (adj.) /naɪˈiːv/ 天真的、朴素的 naive prompt
⭐⭐ dietary (adj.) / dietary restrictions /ˈdaɪəteri/ 饮食的 / 饮食限制 运动员餐食例
⭐ meal plan — 餐食计划 本课业务例子
⭐⭐ concurrency (n.) / max_concurrent_tasks /kənˈkʌrənsi/ 并发 / 最大并发任务数 PromptEvaluator 参数
⭐⭐ rate limit — 限流 低并发要防的错误
⭐⭐ quota (n.) /ˈkwoʊtə/ 配额 API 配额允许才调高
⭐⭐ task_description — 任务描述 generate_dataset 参数
⭐⭐ prompt_inputs_spec — 输入规格 定义提示词需要的输入
⭐ num_cases — 用例数 开发期 2–3、验证期调高
⭐ macronutrient (n.) /ˌmækroʊˈnuːtriənt/ 宏量营养素 extra_criteria 之一
⭐⭐ extra_criteria — 额外(评估)标准 给评分模型看的指标
⭐ caloric total — 总热量 extra_criteria 之一
⭐ portion (n.) /ˈpɔːrʃn/ 份量 extra_criteria 之一
⭐⭐ HTML report — HTML 报告 含逐条 reasoning
⭐⭐ reasoning (n.) /ˈriːznɪŋ/ 推理(说明) 已在 §4 课时5 收录
⭐ discouraged (adj.) /dɪsˈkɜːrɪdʒd/ 灰心的、受挫的 Don't be discouraged
⭐ high-performing (adj.) — 高性能的 high-performing tool
⭐⭐ one change at a time — 一次只改一处 控制变量的关键原则
⭐⭐ build on (v.) — 在……基础上叠加 build on what works
⭐ attribute / systematic approach — 归因 / 系统化做法 判断技巧价值的方法

课时 2 · Being clear and direct

类型:🎬 视频 | lesson ID:287744 | 官方直链

🎯 本课学习目标(据官方段落反推)

  1. 能说出提示词第一行最重要,是「为后续一切定调」。
  2. 能区分清晰(clear)与直接(direct)两个原则,并各举一条做法。
  3. 能把含糊问题式提示词改写为动词开头、明确任务的指令式提示词。
  4. 能记住本课案例:改第一行后评估分从 2.32 → 3.92。

一、开场:第一行最重要

官方原句:The first line of your prompt is the most important part of your entire request. This is where you set the stage for everything that follows, and getting it right can dramatically improve your results.

精译:提示词的第一行是整个请求里最重要的部分。这是你为后续一切定调的地方,把这里写对能大幅改善结果。

⭐ 开篇定调(D3):把「第一行」提到最重要的高度——它是整条提示词的战略要地。set the stage(搭台/定调)形象说明:后续内容都在第一行划定的范围里展开。


二、⭐⭐ 清晰与直接两大原则(Being Clear and Direct)

官方原句:When crafting that crucial first line, you want to focus on two key principles: clarity and directness. This means using simple language that leaves no room for ambiguity about what you want the AI to do.

精译:打磨这条关键第一行时,你要聚焦两大原则:清晰(clarity)和直接(directness)。这意味着用简单的语言,对你想让 AI 做的事不留任何含糊空间。

⭐⭐ 本课第一号考点(D3)——clarity vs directness 是并列双原则: * Clarity(清晰):语言简单易懂、零歧义——重在「把话说清楚」。 * Directness(直接):重在「怎么组织这条请求」——指令而非提问。 * 记忆:clarity = 说什么(clear language);directness = 怎么说(structure/语气)。两者是「内容 vs 形式」的互补。


三、⭐⭐ Clear Communication(清晰沟通)

官方原句:Being "clear" means:

  • Use simple language that anyone can understand
  • State exactly what you want without beating around the bush**
  • Lead with a straightforward statement of the AI's task

Instead of writing something vague like "I need to know about those things people put on their roofs that use sun - those solar panel things, I think they're called," be direct and write: "Write three paragraphs about how solar panels work."

精译:「清晰」意味着:用任何人都能懂的简单语言;开门见山说出你确切要什么,不绕弯子;以对 AI 任务的直白陈述开头。与其写含糊的「我想知道人们装屋顶上那些用太阳的东西——那些太阳能板什么的,好像是这么叫的」,不如直接写:「写三段关于太阳能板如何工作的文字。」

⭐⭐ 本课第二号考点(D3)——反例对比是经典题型: * 三条标准:① 简单语言 ② 不绕弯(beating around the bush)③ 以直白任务陈述开头。 * 反例(vague):口语化、迟疑、自我修正、用「those things / I think they're called」这类不确定指代。 * 正例(clear):祈使句开头 + 明确对象(太阳能板)+ 明确产出(三段文字)。 * 口诀:清除不确定性、给动词、给对象、给产出。


四、⭐⭐ Direct Instructions(直接指令)

官方原句:Being "direct" focuses on how you structure your request:

  • Use instructions, not questions**
  • Start with direct action verbs like "Write," "Create," or "Generate"

Rather than asking "I was reading about renewable energy and geothermal energy sounds neat. What countries use it?" try: "Identify three countries that use geothermal energy. Include generation stats for each."

精译:「直接」聚焦于你如何组织这条请求:用指令而非提问;以「Write」「Create」「Generate」这类直接的动作动词开头。与其问「我在读可再生能源的文章,地热能听起来不错。哪些国家用它?」不如写:「找出三个使用地热能的国家。每个都附上发电数据。」

⭐⭐ 本课第三号考点(D3)——指令 vs 提问: * 用指令(imperative),不用提问(question)。反例是「What countries use it?」这种开放式问题;正例是「Identify three countries…」这种祈使句。 * 动作动词开头:Write / Create / Generate / Identify——用行为动词点明要 AI 干什么。 * 这直接呼应课时 1「五步循环第 4 步的工程技巧」:第一行 = 动词开头的一句话任务声明。


五、⭐⭐ 实践:改写餐食提示词(Putting It Into Practice)

官方原句:Let's see this technique in action. Starting with a weak prompt that simply asked "What should this person eat?" we can apply our clear and direct approach.

The improved version becomes: "Generate a one-day meal plan for an athlete that meets their dietary restrictions."

This revision immediately tells the AI:

  • What action to take (generate)
  • What to create (a meal plan)
  • Key constraints (one day, for an athlete, meeting dietary restrictions)

精译:看这个技巧的实际运用。从一个只是问「这个人该吃什么?」的弱提示词出发,套用清晰直接的方法,改进版变成:「为一个运动员生成一份满足其饮食限制的一日餐食计划。」这一改动立刻告诉 AI:做什么动作(生成)、创建什么(餐食计划)、关键约束(一日、针对运动员、满足饮食限制)。

⭐⭐ 本课第四号考点(D3)——逐项拆解是分析题范式: * 弱版本:What should this person eat?——疑问句、无动作动词、无对象范围。 * 改进版:Generate a one-day meal plan for an athlete that meets their dietary restrictions.——动词 Generate + 对象 meal plan + 三个约束(one day / for an athlete / meeting dietary restrictions)。 * 三段信息拆解:Action(Generate)+ Output(meal plan)+ Constraints(一天/运动员/饮食限制)。这几乎是「第一行公式」:动词 + 产出物 + 限定条件。


六、⭐⭐ 结果说话(Results Matter)

官方原句:This simple change can have a significant impact on performance. In our example, the evaluation score jumped from 2.32 to 3.92 - a substantial improvement from just restructuring that opening line.

The key takeaway is that the AI responds best when you treat it like a capable assistant who needs clear direction rather than someone who has to guess what you want. Start strong with a direct action verb, be specific about the task, and you'll see better results right away.

精译:这个简单改动对表现有显著影响。在我们的例子里,评估分从 2.32 跳到 3.92——仅靠重构开头那一行就带来大幅提升。关键要点是:当你把 AI 当作一个需要明确方向的得力助手、而不是一个要靠猜的机器时,它表现最好。用直接的动作动词开头、把任务写具体,你立刻会看到更好的结果。

⭐⭐ 本课第五号考点(D3)——数值案例是送分点: * 2.32 → 3.92:仅改第一行,提升约 1.6 分(相对提升约 69%)。这个数字是记忆锚点,考题可能问「clear and direct 技巧使评估分从多少提到多少」。 * 能力框架:把 AI 当「capable assistant who needs clear direction」,而非「someone who has to guess」。提示词工程 = 减少 AI 的猜测空间。 * 落地公式:动作动词开头 + 任务具体 → 立即见效。注意「right away」——这一技巧是低投入高回报的基线项。


七、⭐ Key Takeaways(本课官方无独立 Key Takeaways 段,据正文反推)

  1. 第一行是提示词最重要的部分,为后续定调。
  2. 两原则:Clarity(简单语言、零歧义、直白陈述)+ Directness(指令非提问、动作动词开头)。
  3. 反例→正例:含糊提问(What should this person eat?)→ 动词+产出+约束(Generate a one-day meal plan…)。
  4. 数值:改第一行 2.32 → 3.92。
  5. 理念:把 AI 当需要明确方向的助手,减少它的猜测空间。

🔤 本课新生词(临时小表 · 已回灌 30-单词表/04- 第 5 章分组)

星 词汇 音标 本课义 备注
⭐⭐ set the stage — 为……定调、搭台 第一行的作用
⭐⭐ clarity (n.) /ˈklærəti/ 清晰 两原则之一
⭐⭐ directness (n.) /dəˈrektnəs/ 直接 两原则之一
⭐⭐ ambiguity (n.) /ˌæmbɪˈɡjuːəti/ 歧义、含糊 no room for ambiguity
⭐ beating around the bush — 绕弯子、兜圈子 清晰原则禁止
⭐ straightforward (adj.) /ˌstreɪtˈfɔːrwərd/ 直白的、直截了当的 straightforward statement
⭐ vague (adj.) /veɪɡ/ 含糊的 反例提示词的定性
⭐⭐ solar panel — 太阳能板 清晰反例的例子
⭐ renewable (adj.) /rɪˈnuːəbl/ 可再生的 renewable energy
⭐⭐ geothermal (adj.) /ˌdʒiːoʊˈθɜːrml/ 地热的 直接反例的例子
⭐⭐ action verb — 动作动词 Write/Create/Generate
⭐⭐ instruction (n.) /ɪnˈstrʌkʃn/ 指令 用指令而非提问
⭐⭐ imperative (adj.) /ɪmˈperətɪv/ 祈使的、命令式的 指令句的语法形态
⭐ weak prompt — 弱提示词 反例起点
⭐⭐ constraint (n.) /kənˈstreɪnt/ 约束 已在 §3 课时8 收录
⭐⭐ restructure (v.) /ˌriːˈstrʌktʃər/ 重构 restructuring that opening line
⭐ substantial (adj.) /səbˈstænʃl/ 大幅的、可观的 substantial improvement
⭐⭐ takeaway (n.) /ˈteɪkəweɪ/ 要点、收获 已在 §3 课时1 收录
⭐ capable (adj.) /ˈkeɪpəbl/ 能干的、有能力的 capable assistant
⭐⭐ guess (v.) /ɡes/ 猜、猜测 减少 AI 的猜测空间

课时 3 · Being specific

类型:🎬 视频 | lesson ID:287740 | 官方直链

🎯 本课学习目标(据官方段落反推)

  1. 能说出「具体(specific)」为什么能同时提升输出的一致性与质量。
  2. 能区分两类具体化手段:输出质量准则(Output Quality Guidelines)与过程步骤(Process Steps)。
  3. 能举出 Output Guidelines 控制的四类维度(长度/结构/属性/语气)。
  4. 能说出 Process Steps 适合的四类场景(排障/决策/批判性思考/多角度)。
  5. 能记住数值案例:加准则后评估分 3.92 → 7.86。

一、开场:具体化 = 给 AI 更清晰的目标

官方原句:One of the most effective ways to improve your results is to be specific about what you want. Instead of leaving everything up to the model's interpretation, you can provide clear guidelines or steps that direct the AI toward the kind of output you're looking for.

精译:改善结果最有效的方法之一,是对你想要的东西具体化。与其把一切都交给模型的解读,不如提供清晰的准则或步骤,把 AI 引向你想要的那种输出。

官方原句:if you ask the AI to "write a short story about a character who discovers a hidden talent," the AI could go in countless directions. The story might be 200 words or 2,000 words. It might have one character or five... By adding specific guidelines, you give the AI a clearer target to aim for. This dramatically improves both the consistency and quality of the output.

精译:如果你让 AI「写一个角色发现隐藏天赋的短故事」,AI 可能朝无数方向去。故事可能 200 词或 2000 词,可能一个角色或五个。而加入具体的准则后,你就给了 AI 一个更清晰的目标去瞄准。这大幅同时提升输出的一致性与质量。

⭐⭐ 本课第一号考点(D3): * 问题根源:不加约束,模型靠「interpretation(解读)」自由发挥 → consistency(一致性)差、质量(quality)参差。 * 解法:clear guidelines or steps(清晰准则或步骤)→ 给出 clearer target。 * 双收益:dramatically improves BOTH consistency AND quality——一致性+质量是具体化的两大目标,这是本课的纲。


二、⭐⭐ 两类具体化手段(Two Types of Guidelines)

官方原句:There are two main approaches to being specific in your prompts, and you'll often see them used together in professional applications.

精译:提示词里具体化有两大类手段,在专业应用里你常会看到它们一起使用。

⭐⭐ 本课第二号考点(D3)——二分类是骨架: * ① Output Quality Guidelines(输出质量准则):列「输出应具备哪些特质」。 * ② Process Steps(过程步骤):给 AI 一条按序执行的步骤链。 * 关键:professional applications 常两者并用——准则管「产出长什么样」,步骤管「怎么想/怎么做到」。


三、⭐⭐ Output Quality Guidelines(输出质量准则)

官方原句:The first type focuses on listing qualities that your output should have. These guidelines help you control:

  • Length of the response
  • Structure and format
  • Specific attributes or elements to include
  • Tone or style requirements

For example, you might specify that a story should be under 1,000 words, include a clear action that reveals the character's talent, and feature at least one supporting character.

精译:第一类聚焦于列举输出应具备的特质。这些准则帮你控制:回答的长度、结构与格式、要包含的具体属性或元素、语气或风格要求。例如,你可以规定故事在 1000 词以内、包含一个揭示角色天赋的清晰动作、并至少有一个配角。

⭐⭐ 本课第三号考点(D3)——Output Guidelines 四维度是枚举题: * ① Length(长度) ② Structure and format(结构/格式) ③ Attributes/elements(属性/元素) ④ Tone or style(语气/风格)。 * 例:under 1,000 words(长度)+ clear action that reveals talent(元素)+ at least one supporting character(结构/元素)。 * 记忆:Output Guidelines = 给「结果」定规格(like a spec for the final product)。


四、⭐⭐ Process Steps(过程步骤)

官方原句:The second type provides specific steps for the AI to follow. This approach is particularly useful when you want the AI to think through a problem systematically or consider multiple perspectives before arriving at a final answer.

Instead of jumping straight to writing, you might ask the AI to:

  1. Brainstorm three talents* that would create dramatic tension***
  2. Pick the most interesting talent
  3. Outline a pivotal scene that reveals the talent
  4. Brainstorm supporting character types that could increase the impact

精译:第二类提供 AI 要遵循的具体步骤。当你想让 AI 在给出最终答案前系统地思考问题、或考虑多个视角时,这类特别有用。与其直接跳到写作,你可以让 AI:① 头脑风暴三个能制造戏剧张力的天赋;② 挑出最有趣的一个;③ 勾勒一个揭示天赋的关键场景;④ 头脑风暴能增强冲击力的配角类型。

⭐⭐ 本课第四号考点(D3)——Process Steps 的价值与示例: * 适用目的:让 AI systematically think through / consider multiple perspectives,再给 final answer。 * 示例是四步链:Brainstorm → Pick → Outline → Brainstorm。注意每步都用一个动作动词开头(呼应课时 2 的动作动词)。 * 核心价值:逼 AI 分步推理、多角度思考,而不是「跳到最后直接写」。这为后面课时(结构/示例)和 agentic 的思考展开埋了伏笔。


五、⭐⭐ 真实影响:数值案例(Real-World Impact)

官方原句:The difference that specificity makes is dramatic. In testing a meal planning prompt, adding guidelines improved the evaluation score from 3.92 to 7.86 - more than doubling the quality of the output simply by telling the AI exactly what elements to include.

Guidelines: 1. Include accurate daily calorie amount 2. Show protein, fat, and carb amounts 3. Specify when to eat each meal 4. Use only foods that fit restrictions 5. List all portion sizes in grams 6. Keep budget-friendly if mentioned

精译:具体化带来的差异是惊人的。在测试餐食计划提示词时,加入准则把评估分从 3.92 提到 7.86——仅靠告诉 AI 确切要包含哪些元素,输出质量就翻了一倍多。示例准则:① 含准确每日热量 ② 给出蛋白质/脂肪/碳水含量 ③ 说明每餐时间 ④ 只用符合限制的食物 ⑤ 所有份量以克列出 ⑥ 若提到则保持预算友好。

⭐⭐ 本课第五号考点(D3)——数值与准则清单都是送分点: * 3.92 → 7.86:与课时 2 的 2.32 → 3.92 形成连续递进(2.32 → 3.92 → 7.86)。这是本章逐技巧提升评估分的最佳叙事——每题问「某技巧让分数提到多少」都能对号入座。 * 六条准则示例涵盖:数值精度(热量/营养/克数)、时间(每餐时间)、约束(符合限制)、成本(预算友好)——正是课时 1 extra_criteria 的提示词版。 * 核心因果:「telling the AI exactly what elements to include」 = 把「要什么」说死 → 质量翻倍。


六、⭐⭐ 何时用哪种(When to Use Each Approach)

官方原句:Always Use Output Guidelines: You should include quality guidelines in almost every prompt. They're your safety net for getting consistent, useful results.

Use Process Steps For Complex Problems: Add step-by-step instructions when you're dealing with:

  • Troubleshooting complex problems
  • Decision-making scenarios
  • Critical thinking tasks
  • Any situation where you want the AI to consider multiple angles* *

精译:始终使用 Output Guidelines:几乎每条提示词都应包含质量准则,它们是你获得一致、有用结果的安全网。对复杂问题用 Process Steps:在处理以下情况时加逐步指令——排查复杂问题、决策场景、批判性思考任务、以及任何你想让 AI 考虑多个角度的情形。

官方原句:if you're asking the AI to analyze why a sales team's performance dropped, you'd want to guide it through examining market metrics, industry changes, individual performance, organizational changes, and customer feedback - rather than letting it focus on just one potential cause.

精译:如果你让 AI 分析销售团队业绩为何下滑,你要引导它依次考察市场指标、行业变化、个人表现、组织变化、客户反馈——而不是让它只盯住某一个可能原因。

⭐⭐ 本课第六号考点(D3)——使用场景是判断题素材: * Output Guidelines = 几乎每条提示词都用(safety net,保底一致/有用)。 * Process Steps = 复杂问题专用:Troubleshooting / Decision-making / Critical thinking / 多角度。 * 销售下滑例子:把「多角度」讲透——市场/行业/个人/组织/客户反馈 五个维度都要查,防只盯单因。这是 Process Steps 最典型的防止片面归因用途。


七、⭐⭐ 结合使用(Combining Both Approaches)

官方原句:In professional prompting, you'll often see both techniques used together. You might have guidelines that control the format and content of your output, plus steps that ensure the AI thinks through the problem thoroughly before responding.

This combination gives you both consistency in your results and confidence that the AI has considered all the important factors in reaching its conclusion.

精译:在专业提示词里,你常会看到两种技巧一起用。你可以有控制输出格式与内容的准则,外加步骤确保 AI 在回应前把问题想透。这种组合既给了你结果上的一致性,也给了你信心——AI 在得出结论前已考虑了所有重要因素。

⭐⭐ 本课第七号考点(D3)——组合是专业级做法: * Output Guidelines(管格式/内容)+ Process Steps(管思考过程)= professional prompting 标配。 * 双收益:consistency(一致性) 来自准则,confidence(信心/全面性) 来自步骤。 * 这是本课收尾升华:具体化不局限于某一种,而是准则定产品、步骤定过程的叠加(呼应 §二 的「used together」)。


八、⭐ Key Takeaways(本课官方无独立 Key Takeaways 段,据正文反推)

  1. 具体化 = 给 AI clearer target,同时提升一致性+质量。
  2. 两类:Output Quality Guidelines(管结果:长度/结构/属性/语气)+ Process Steps(管过程:排障/决策/批判/多角度)。
  3. 数值:加准则 3.92 → 7.86(连续课时 2 的 2.32 → 3.92)。
  4. 使用时机:Output Guidelines 几乎总用(安全网);Process Steps 用于复杂问题。
  5. 专业级 = 两者结合:准则定格式/内容,步骤定思考过程。

🔤 本课新生词(临时小表 · 已回灌 30-单词表/04- 第 5 章分组)

星 词汇 音标 本课义 备注
⭐⭐ interpretation (n.) /ɪnˌtɜːrprəˈteɪʃn/ 解读、阐释 不加约束时的模型行为
⭐⭐ countless (adj.) /ˈkaʊntləs/ 无数的 countless directions
⭐⭐ consistency (n.) /kənˈsɪstənsi/ 一致性 具体化的目标之一
⭐⭐ guideline (n.) /ˈɡaɪdlaɪn/ 准则、指导方针 Output Guidelines
⭐ attribute (n.) /ˈætrɪbjuːt/ 属性、特质 准则控制的维度之一
⭐ tone (n.) /toʊn/ 语气 准则控制的维度之一
⭐ supporting character — 配角 故事的示例元素
⭐⭐ brainstorm (v.) /ˈbreɪnstɔːrm/ 头脑风暴 Process Steps 示例动作
⭐ pivotal (adj.) /ˈpɪvətl/ 关键的、枢纽的 pivotal scene
⭐ dramatic tension — 戏剧张力 示例目标
⭐⭐ systematically (adv.) /ˌsɪstəˈmætɪkli/ 系统地 已在 §4 课时1 收录
⭐ perspective (n.) /pərˈspektɪv/ 视角 multiple perspectives
⭐⭐ more than doubling — 翻了一倍多 3.92 → 7.86 的定性
⭐ calorie (n.) /ˈkæləri/ 热量 准则示例
⭐ protein / fat / carb — 蛋白质/脂肪/碳水 准则示例
⭐ portion size — 份量 准则示例
⭐ budget-friendly (adj.) — 预算友好的 准则示例
⭐⭐ safety net — 安全网 Output Guidelines 的定位
⭐⭐ troubleshooting (n.) /ˈtrʌblʃuːtɪŋ/ 排查、排障 Process Steps 场景之一
⭐⭐ decision-making (n.) — 决策 Process Steps 场景之一
⭐⭐ critical thinking — 批判性思考 Process Steps 场景之一
⭐ organizational (adj.) /ˌɔːrɡənəˈzeɪʃənl/ 组织的 销售下滑五维度之一
⭐ market metrics — 市场指标 销售下滑五维度之一
⭐ customer feedback — 客户反馈 销售下滑五维度之一
⭐⭐ thoroughly (adv.) /ˈθɜːrəli/ 彻底地 已在 §4 课时1 收录
⭐ confidence (n.) /ˈkɑːnfɪdəns/ 信心 组合的双收益之一

课时 4 · Structure with XML tags

类型:🎬 视频 | lesson ID:287741 | 官方直链

🎯 本课学习目标(据官方段落反推)

  1. 能说出 XML 标签给提示词带来的结构与清晰度价值,尤其在大段数据插值时。
  2. 能解释「为什么无边界会让 AI 分不清指令与数据」。
  3. 能说出自定义标签名应描述性强(如 <sales_records> 优于 <data>)。
  4. 能列出 XML 标签的适用场景(大段上下文/混合内容/边界清晰/复杂插值)。
  5. 能读懂 <athlete_information> 的完整提示词实例。

一、开场:XML 标签为何重要

官方原句:When you're building prompts that include a lot of content, the AI can sometimes struggle to understand which pieces of text belong together or what different sections are supposed to represent. XML tags provide a simple way to add structure and clarity to your prompts, especially when you're interpolating large amounts of data.

精译:当你构建包含大量内容的提示词时,AI 有时会难以理解哪些文本片段该归为一组,或不同部分分别代表什么。XML 标签为提示词增加结构与清晰度提供了一种简单方式,尤其是当你插值(interpolating)大量数据时。

⭐ 承上启下(D3/D4):本课是官方「四件套」第 3 件。核心矛盾:内容一多,AI 分不清「指令 vs 数据」。解法是用标签划出边界。interpolating(插值)正是课时 1 prompt_inputs f-string 拼接数据的场景——数据一多,边界就糊。


二、⭐⭐ 为什么结构重要(Why Structure Matters)

官方原句:Consider a prompt where you need to analyze 20 pages of sales records. Without clear boundaries, the AI might have trouble distinguishing between your instructions and the actual data you want analyzed.

By wrapping the sales records in XML tags like <sales_records> and </sales_records>, you create clear delimiters that help the AI understand the structure of your prompt.

精译:考虑一个需要分析 20 页销售记录的提示词。没有清晰的边界时,AI 可能难以区分你的指令和你要分析的实际数据。而把销售记录用 <sales_records> 和 </sales_records> 这样的 XML 标签包起来,你就创建了清晰的定界符(delimiters),帮 AI 理解提示词的结构。

⭐⭐ 本课第一号考点(D3/D4): * 问题:20 pages of sales records + 无边界 → AI 分不清指令(instruction)vs 数据(data)。 * 解法:开标签 <sales_records> + 闭标签 </sales_records> 包住数据 → clear delimiters(清晰定界符)。 * 机制:XML 标签本质是给提示词分区,告诉 AI「这坨是数据、那段是指令」。边界即语义。


三、⭐⭐ 实例:代码与文档分离(Code and Documentation)

官方原句:If you ask the AI to debug code using provided documentation, mixing everything together creates confusion.

The "Not Great" version makes it nearly impossible to tell what's code versus documentation. The "Better" version uses <my_code> and <docs> tags to create clear boundaries.

精译:如果你让 AI 用提供的文档去调试代码,把所有东西混在一起会造成混乱。「不够好」的版本让人几乎无法分辨代码还是文档;「更好」的版本用 <my_code> 和 <docs> 标签创建清晰边界。

⭐⭐ 本课第二号考点(D3/D4)——Not Great vs Better 对比: * Not Great:代码与文档混杂 → nearly impossible 分辨。 * Better:<my_code> 包代码、<docs> 包文档 → 一物一标签、各归各位。 * 记忆:两种内容 = 两对标签,让 AI 分别对待。这是「混合不同类型内容」场景的示范(呼应 §五 的适用场景)。


四、⭐⭐ 自定义标签名(Custom Tag Names)

官方原句:You don't need to use official XML tags. Create descriptive names that make sense for your content:

  • <sales_records> is better than <data>
  • <athlete_information> clearly identifies user details
  • <my_code> and <docs> separate different types of content

The more specific and descriptive your tag names, the better the AI can understand the purpose of each section.

精译:你不必用官方的 XML 标签。为你的内容创建有描述性的名字:<sales_records> 优于 <data>;<athlete_information> 清楚标识用户详情;<my_code> 和 <docs> 分隔不同类型的内容。标签名越具体、越有描述性,AI 就越能理解每个部分的用途。

⭐⭐ 本课第三号考点(D3)——自定义标签是送分点: * 不需要官方标签:<p>/<div> 这类 HTML 语义不必要,用业务名即可。 * 命名原则:描述性 > 通用性——&lt;sales_records&gt; 优于 &lt;data&gt;(后者太笼统)。 * 一物一标签:&lt;my_code&gt;/&lt;docs&gt; 用不同的名字分隔内容类型。 * 考题可能问「下列标签命名哪个更好?」→ 选最具体描述内容用途的那个。


五、⭐⭐ 何时用 XML 标签(When to Use XML Tags)

官方原句:XML tags are most useful when:

  • Including large amounts of context or data**
  • Mixing different types of content (code, documentation, data)
  • You want to be extra clear about content boundaries**
  • Working with complex prompts that interpolate multiple variables**

Even for shorter content, XML tags can help serve as delimiters that make your prompt structure more obvious.

精译:XML 标签在以下情况最有用:包含大量上下文或数据;混合不同类型内容(代码、文档、数据);想对内容边界格外清楚;处理插值多个变量的复杂提示词。即使较短的内容,XML 标签也能作为定界符,让提示词结构更明显。

⭐⭐ 本课第四号考点(D3)——适用场景是枚举/判断题: * 四大场景:① 大段数据 ② 混合内容 ③ 边界要清晰 ④ 多变量复杂插值。 * 补充:短内容也适用——标签作为 delimiter 让结构更明显(不是只有长提示词才用)。 * 记忆:内容多、种类杂、边界糊、插值烦 → 上标签。


六、⭐⭐ 实战示例(Real-World Application)

官方原句:In practice, you might structure a prompt like this:

``` <athlete_information> - Height: 6'2" - Weight: 180 lbs - Goal: Build muscle - Dietary restrictions: Vegetarian </athlete_information>

Generate a meal plan based on the athlete information above. ```

This makes it crystal clear that the height, weight, goal, and restrictions are all related athlete data that should be considered together when generating the meal plan.

While you might not see dramatic improvements with simple prompts, XML tags become increasingly valuable as your prompts grow more complex and include larger amounts of varied content.

精译:实践中你可以这样组织提示词:用 &lt;athlete_information&gt; … &lt;/athlete_information&gt; 包住身高/体重/目标/饮食限制四行数据,下面写「根据上面的运动员信息生成餐食计划」。这让一切都一目了然:身高、体重、目标、限制是相互关联的运动员数据,生成餐食计划时应作为一个整体来考虑。在简单提示词上你可能看不到戏剧性提升,但随着提示词变得更复杂、包含更多样且量更大的内容,XML 标签会越来越有价值。

⭐⭐ 本课第五号考点(D3/D4): * 完整实例:数据区(&lt;athlete_information&gt;)+ 指令区(Generate a meal plan…)分离。注意这里指令直接承接课时 2/3 的动作动词(Generate)与约束(based on the athlete information above)。 * 语义:crystal clear——标签让 AI 把四行数据当作一个整体看待。 * 价值曲线:简单提示词收益有限,越复杂/内容越多收益越大——这是本课收尾的价值判断(呼应课时 1 的「技巧价值因用例而异」)。


七、⭐ Key Takeaways(本课官方无独立 Key Takeaways 段,据正文反推)

  1. XML 标签 = 给提示词加结构与边界,尤其在大数据插值时。
  2. 作用:创建 clear delimiters,让 AI 分清指令 vs 数据、代码 vs 文档。
  3. 自定义标签:用描述性名字(&lt;sales_records&gt; 优于 &lt;data&gt;)。
  4. 适用:大段数据/混合内容/边界清晰/多变量插值;短内容也可作 delimiter。
  5. 价值:提示词越复杂、内容越多,XML 标签越有价值。

🔤 本课新生词(临时小表 · 已回灌 30-单词表/04- 第 5 章分组)

星 词汇 音标 本课义 备注
⭐⭐ structure (n.) /ˈstrʌktʃər/ 结构 XML 标签的收益
⭐ clarity (n.) /ˈklærəti/ 清晰 已在 §5 课时2 收录
⭐⭐ interpolate (v.) / interpolating /ɪnˈtɜːrpəleɪt/ 插值、插入 大数据拼接场景
⭐⭐ boundary (n.) /ˈbaʊndri/ 边界 无边界导致混淆
⭐⭐ delimiter (n.) /dɪˈlɪmɪtər/ 定界符 XML 标签的本质
⭐ distinguish (v.) /dɪˈstɪŋɡwɪʃ/ 区分 已在 §3 课时11 收录
⭐⭐ wrap (v.) /ræp/ 包裹 用标签包住数据
⭐⭐ opening tag / closing tag — 开标签 / 闭标签 &lt;sales_records&gt; / &lt;/sales_records&gt;
⭐⭐ descriptive (adj.) /dɪˈskrɪptɪv/ 有描述性的 标签命名原则
⭐⭐ specific (adj.) /spəˈsɪfɪk/ 具体的 已在 §5 课时3 收录
⭐ purpose (n.) /ˈpɜːrpəs/ 用途、目的 让 AI 理解每段用途
⭐ sales records — 销售记录 20 页数据示例
⭐ confusion (n.) /kənˈfjuːʒn/ 混乱 混杂的后果
⭐ debug (v.) /ˌdiːˈbʌɡ/ 调试 代码/文档示例
⭐ documentation (n.) /ˌdɑːkjumenˈteɪʃn/ 文档 &lt;docs&gt; 包的内容
⭐⭐ crystal clear — 一目了然、清清楚楚 标签后的效果
⭐ varied (adj.) /ˈverid/ 多样的 varied content

课时 5 · Providing examples

类型:🎬 视频 | lesson ID:287746 | 官方直链

🎯 本课学习目标(据官方段落反推)

  1. 能说出 one-shot / multi-shot prompting 的定义:给 AI 提供「输入/输出」样例对。
  2. 能用情绪分析+讽刺的例子,说明样例如何解决 corner case。
  3. 能说出样例应用 XML 标签包裹(&lt;sample_input&gt;/&lt;ideal_output&gt;)。
  4. 能区分 one-shot 与 multi-shot 的适用场景。
  5. 能说出从评估中挑选高分样例(如 score 10)来当样例,并解释为何该输出好。

一、开场:样例的力量

官方原句:Providing examples in your prompts is one of the most effective prompt engineering techniques. This approach, known as "one-shot" or "multi-shot" prompting, involves giving the AI sample input/output pairs to guide its responses.

精译:在提示词里提供样例,是你会用到最有效的提示词工程技巧之一。这种方法称为 one-shot 或 multi-shot prompting,即给 AI 提供「输入/输出」样例对来引导它的回答。

⭐ 承上启下(D3):官方四件套第 4 件。核心概念:sample input/output pairs(输入/输出对)。这正是第 4 章数据集里 {"input":..., "output":...} 的提示词版——把「好的输入→好的输出」直接展示给模型。one-shot=1 个样例,multi-shot=多个。


二、⭐⭐ 样例如何工作:情绪分析+讽刺(How Examples Work)

官方原句:Let's look at a sentiment analysis example. Say you want the AI to categorize whether a tweet is positive or negative.

The challenge here is sarcasm. A tweet like "Yeah, sure, that was the best movie I've seen since 'Plan 9 from Outer Space'" appears positive on the surface, but it's actually sarcastic and negative (Plan 9 is famously one of the worst movies ever made).

精译:看一个情绪分析的例子。假设你想让 AI 判断一条推文是正面还是负面。这里的挑战是讽刺(sarcasm)。一条「是啊,当然了,那是我自『外太空第九号计划』以来看过最好的电影」的推文表面看是正面,但实际上讽刺且负面(《外太空第九号计划》是公认的史上最烂电影之一)。

⭐⭐ 本课第一号考点(D3)——讽刺是核心挑战: * 任务:情绪二分类(positive/negative)。 * 难点:sarcasm(讽刺)——表层语义与真实语义相反,纯看字面会判错。 * 例子:"Yeah, sure, that was the best movie..." 字面正面、实则负面(Plan 9 from Outer Space 是最烂片梗)。 * 记忆:讽刺 = 为什么「只看表面」会失败的最好例子 → 引出「需要样例教模型处理 corner case」。


三、⭐⭐ 用样例处理 Corner Case(Adding Examples to Handle Corner Cases)

官方原句:To solve this, you can add examples that show the AI how to handle tricky cases. The improved prompt includes:

  • A clear positive example: "Great game tonight!" → "Positive"
  • A sarcastic example: "Oh yeah, I really needed a flight delay tonight! Excellent!" → "Negative"
  • Context explaining why sarcasm should be treated carefully**

Notice how the examples are wrapped in XML tags like &lt;sample_input&gt; and &lt;ideal_output&gt;. This structure makes it crystal clear to the AI what each part represents.

精译:为解决这个问题,你可以加样例展示 AI 如何处理棘手情形。改进后的提示词包含:一个清晰的正面样例(「今晚比赛太棒了!」→「正面」)、一个讽刺样例(「哦对,我今晚真是太需要航班延误了!太好了!」→「负面」)、以及解释为什么讽刺要谨慎对待的上下文。注意样例都用 &lt;sample_input&gt; 和 &lt;ideal_output&gt; 这样的 XML 标签包裹,这种结构让 AI 对每部分代表什么一目了然。

⭐⭐ 本课第二号考点(D3/D4): * 三个改进要素:正面样例 + 讽刺样例 + 解释性上下文。 * 样例格式:input → output(「推文」→「情绪标签」)。 * 标签包裹:&lt;sample_input&gt;(样例输入)+ &lt;ideal_output&gt;(理想输出)——直接承接课时 4 的 XML 标签技巧,把「样例」结构化。这是本章两技巧的第一次组合。 * 记忆:样例本身也要用标签框起来,让「哪部分是输入、哪部分是理想输出」无歧义。


四、⭐⭐ 何时用样例(When to Use Examples)

官方原句:Examples are particularly useful for:

  • Capturing corner cases or edge scenarios**
  • Defining complex output formats (like specific JSON structures)
  • Showing the exact style or tone you want
  • Demonstrating how to handle ambiguous inputs**

精译:样例在以下情况特别有用:捕捉边界情形或边缘场景;定义复杂输出格式(如特定的 JSON 结构);展示你想要的精确风格或语气;演示如何处理歧义输入。

⭐⭐ 本课第三号考点(D3)——适用场景是枚举/匹配题: * ① Corner cases / edge scenarios(边界/边缘情形)——本课讽刺即此。 * ② Complex output formats(复杂输出格式,如 JSON 结构)——呼应第 3/4 章的结构化输出。 * ③ Exact style/tone(精确风格/语气)。 * ④ Ambiguous inputs(歧义输入)。 * 记忆:边界、格式、风格、歧义 → 用样例。这些恰好都是「光用文字指令难以说清」的情形。


五、⭐⭐ One-Shot vs Multi-Shot

官方原句:One-Shot*: Provide a single example to establish the pattern. Multi-Shot: Provide multiple examples to cover different scenarios*.

Use multi-shot when you need to handle various edge cases or want to show different types of valid responses.

精译:One-Shot:提供一个单一样例来建立模式。Multi-Shot:提供多个样例来覆盖不同场景。当你要处理各种边界情形、或想展示不同类型的有效回答时,用 multi-shot。

⭐⭐ 本课第四号考点(D3)——one-shot vs multi-shot 是必考概念对比: * One-Shot:1 个样例 → establish the pattern(确立模式)——适合简单一致的任务。 * Multi-Shot:多个样例 → cover different scenarios(覆盖不同场景)——适合多边界情形或多种合法回答。 * 选择依据:边界情形多 / 合法输出类型多 → multi-shot。 * 记忆:一个立模式,多个覆盖场景。


六、⭐⭐ 从评估中找好样例(Finding Good Examples from Evaluations)

官方原句:When running prompt evaluations, look for your highest-scoring outputs to use as examples:

Find responses that scored 10 (or your highest available score) and use those input/output pairs as examples in your prompt. This helps the AI understand what "perfect" output looks like for your specific use case.

精译:运行提示词评估时,找得分最高的输出当样例:找出得 10 分(或你的最高可用分)的回答,把这些输入/输出对用作提示词里的样例。这能帮 AI 理解「完美」输出对你的具体用例长什么样。

⭐⭐ 本课第五号考点(D3)——评估↔样例的回环是本课亮点: * 来源:从评估结果里挑 score 10(或最高分) 的回答。 * 做法:把高分输入/输出对回填为提示词样例。 * 价值:让 AI 看到「完美输出」的范本——这是第 4 章「评估」与第 5 章「样例」的直接闭环:评估产出的最好结果,反哺成提示词里教模型的例子。这是考试里很值得强调的「评估数据怎么用」考点。


七、⭐⭐ 给样例加解释(Adding Context to Examples)

官方原句:Don't just provide the input/output pair - explain why the output is good:

``` <ideal_output> [Your example output here] </ideal_output>

This example is well-structured, provides detailed information on food choices and quantities, and aligns with the athlete's goals and restrictions. ```

This additional context helps the AI understand the reasoning behind good responses, not just the format.

精译:别只给输入/输出对——还要解释为什么这个输出是好的:&lt;ideal_output&gt;…&lt;/ideal_output&gt; 下面附「这个例子结构良好、对食物选择和数量提供了详细信息,且与运动员的目标和限制一致」。这份额外上下文帮 AI 理解好回答背后的推理(reasoning),而不只是格式。

⭐⭐ 本课第六号考点(D3/D4): * 不只给格式,还给理由:在 &lt;ideal_output&gt; 后用自然语言解释「为什么好」(well-structured / detailed / aligns with goals)。 * 机制:帮 AI 理解 reasoning(推理/理由) 而非只抄格式。 * 呼应:这与课时 5(第 4 章)「评分要带 strengths/weaknesses/reasoning」同构——教模型「好」的标准,比只给「好的样子」更有效。


八、⭐⭐ Best Practices(最佳实践)

官方原句:Best Practices:

  • Always use XML tags to structure your examples clearly
  • Be explicit about what you're showing: "Here is an example input with an ideal response"
  • Include examples that address your most common failure cases**
  • Explain why your example outputs are considered ideal
  • Keep examples relevant to your specific task

精译:最佳实践:始终用 XML 标签清晰组织样例;明说你在展示什么(「这是一个输入及理想回答的示例」);包含针对你最常失败情形的样例;解释为什么你的样例输出被认为是理想的;让样例与你特定任务相关。

官方原句:Examples are especially powerful because they show rather than tell. Instead of trying to describe exactly what you want in words, you demonstrate it directly. This makes your prompts much more reliable and helps the AI understand subtle requirements that might be hard to express in instructions alone.

精译:样例尤其强大,因为它们示范而非言说(show rather than tell)。与其用文字描述你确切要什么,不如直接演示。这让提示词可靠得多,并帮 AI 理解那些单靠指令难以表达的微妙需求。

⭐⭐ 本课第七号考点(D3)——五条最佳实践+核心理念: * 五条:① 用 XML 标签 ② 明说内容 ③ 覆盖最常见失败 ④ 解释为何理想 ⑤ 保持任务相关。 * 核心理念:show rather than tell(示范而非言说)——直接演示比描述更可靠,能传达难以用指令言说的微妙需求。 * 记忆:样例的价值 = 把「隐性要求」变成「显性示范」。这是本课收尾的升华,也是最可能的简答题答案。


九、⭐ Key Takeaways(本课官方无独立 Key Takeaways 段,据正文反推)

  1. 样例 = 最有效的技巧之一;one-shot/multi-shot = 给输入/输出对。
  2. 讽刺例子:教模型处理 corner case(正面字面+负面实义)。
  3. 样例用 XML 标签(&lt;sample_input&gt;/&lt;ideal_output&gt;)包裹。
  4. one-shot 立模式,multi-shot 覆盖场景;多边界/多类型时用 multi-shot。
  5. 从评估挑 score 10 回答当样例,并解释「为何好」(show rather than tell)。

🔤 本课新生词(临时小表 · 已回灌 30-单词表/04- 第 5 章分组)

星 词汇 音标 本课义 备注
⭐⭐ one-shot prompting — 单样例提示 1 个样例立模式
⭐⭐ multi-shot prompting — 多样例提示 已在 §4 课时1 收录(multishot)
⭐⭐ sample input/output pairs — 输入/输出样例对 样例技巧的本质
⭐⭐ sentiment analysis — 情绪分析 本课例子任务
⭐⭐ sarcasm (n.) / sarcastic (adj.) /ˈsɑːrkæzəm/ 讽刺 情绪分析的难点
⭐ tweet (n.) /twiːt/ 推文 分析对象
⭐ on the surface — 表面上 appears positive on the surface
⭐⭐ corner case — 边界情形 已在 §4 课时1 收录
⭐ edge scenario — 边缘场景 已在 §4 课时1 收录
⭐⭐ tricky (adj.) /ˈtrɪki/ 棘手的 tricky cases
⭐⭐ sample_input / ideal_output — 样例输入 / 理想输出 样例的 XML 标签
⭐ ambiguous (adj.) /æmˈbɪɡjuəs/ 歧义的、含糊的 已在 §5 课时2 收录(ambiguity)
⭐⭐ pattern (n.) /ˈpætərn/ 模式 one-shot 建立 pattern
⭐⭐ highest-scoring — 得分最高的 从评估挑 score 10
⭐ perfect output — 完美输出 高分样例的价值
⭐⭐ well-structured (adj.) — 结构良好的 解释「为何好」之一
⭐⭐ show rather than tell — 示范而非言说 样例的核心理念
⭐⭐ demonstrate (v.) /ˈdemənstreɪt/ 演示、示范 直接展示
⭐ subtle (adj.) /ˈsʌtl/ 微妙的、难以捉摸的 subtle requirements
⭐ explicit (adj.) /ɪkˈsplɪsɪt/ 明确的 明说你在展示什么
⭐ failure case — 失败情形 样例要覆盖常见失败

课时 6 · Exercise on prompting

类型:🎬 视频 | lesson ID:287748 | 官方直链

  • 精译状态:⏸ 不补(决定 2026-10-16)——练习课,官方无讲稿/字幕正文,仅动手任务,无可精译语料。
  • 建议复习指向:巩固本章四件套——Being clear and direct(课时 2)/ Being specific(课时 3)/ Structure with XML tags(课时 4)/ Providing examples(课时 5)。自测即按「一次只改一处」原则,把课时 1 的 naive meal-plan 提示词逐条套用四技巧并跑评估,验证各技巧对评估分的提升(2.32 → 3.92 → 7.86 递进)。
  • 本章新生词:无(练习课不产生新语料;相关词已随课时 1–5 回灌)

课时 7 · Quiz on prompt engineering techniques

类型:📝 测验 | lesson ID:289121 | 官方直链

  • 精译状态:⏸ 不补(决定 2026-10-16)——章末测验,题目本身即考点,无讲稿语料,且需登录态取得。
  • 建议复习指向:本章 5 课已精译完毕,测验覆盖的考点分布为——D3 提示词工程核心:五步迭代循环与「一次只改一处」(课时 1)、clarity/directness 与动作动词(课时 2)、Output Guidelines vs Process Steps(课时 3)、XML 标签定界符与描述性命名(课时 4)、one-shot/multi-shot 与 show rather than tell(课时 5)。做题前建议重点回看各课的「⭐⭐」考点小节。
  • 本章新生词:无(章末测验不产生新语料)

✅ 本章进度

  • [x] 抓取本章讲稿/字幕(用户提供,2026-10-16)
  • [x] 逐课精译(7 课时)—— 精译 5 课 ✅ + 不补 2 课 ⏸ = 7 课全覆盖(2026-10-16)
  • 已精译(5):课时 1–5(四件套:Being clear and direct / Being specific / Structure with XML tags / Providing examples)
  • ⏸ 不补(2):课时 6 为练习课(无讲稿正文);课时 7 为章末测验(题目需登录态)
  • 说明:这 2 课官方均无可精译的讲稿/字幕语料,考点与生词已被相邻正课覆盖,故统一标注不补并各附复习指向
  • [x] 生词回灌 30-单词表/04-—— 已建「第 5 章」速查分组(95 条)
  • [x] ~~章节测验/练习(课时 7 Quiz)~~ —— ⏸ 不补(题目需登录态;复习指向见课时 7 条目)

🔗 关联

输入至少 2 个字符,检索全部课程与单词表