鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
2
4
1

Study Notes: Advanced Prompting Techniques for Generative AI (微软AI学习Advanced Prompting)

耄耋之王园区形态
耄耋之王园区形态
2026-05-04 22:41
阅读 969
耄耋之王园区形态
2026-05-04 22:41
阅读 969

1. Why Advanced Prompting Matters

  • LLMs do not know everything. Like humans (especially children), when an AI lacks a correct answer, it will still try to give its “best guess” — this is known as hallucination.
  • The goal of these techniques is to ensure the output is correct, consistent, and useful.
  • These methods act as ways to ask the model, “Are you really sure about this response? You didn’t make it up?”

2. Overview of Prompting Principles Discussed

  • Zero-shot prompting – the most basic form; you send a prompt and hope for the best.
  • Chain-of-thought – guiding the model step-by-step through reasoning.
  • Generated knowledge / RAG – injecting extra context or facts to improve responses.
  • Least-to-most – breaking a large problem into a series of smaller, ordered sub‑problems.
  • Self-refine – critiquing the LLM’s own output and iteratively improving it.
  • Myotic prompting (likely ‘maieutic prompting’) – validating each part of an answer by asking the model to explain itself and check for consistency.

3. Zero-Shot Prompting

  • The simplest form: construct a prompt, send it to the AI assistant, and accept whatever response comes back.
  • Works well for general knowledge but provides no guidance or verification.

4. Chain-of-Thought (CoT)

Analogy: Imagine a teacher showing a student how to solve a problem step-by-step. In CoT, you are the teacher and the LLM is the student. You show it examples with full reasoning chains so it learns to mimic that behaviour.

How it works:

  1. Provide a similar example problem with the full calculation/working shown.
  2. Then present the actual question you need answered.
  3. The LLM uses the pattern you demonstrated to produce a correct, reasoned response.

Example (Apple Problem):

  • Original (zero-shot) question:
    “Alice has five apples. She throws away three apples. She gives two apples to Bob, and Bob gives one back. How many apples does Alice have?”
    Result: The model incorrectly answers 5.
  • Chain-of-thought approach:
    • First, give a worked example:
      “Lisa has seven apples. She throws away one apple. She gives four apples to Bart, and Bart gives one back.
      Calculation: 7 – 1 = 6 → 6 – 4 = 2 → 2 + 1 = 3. So Lisa has 3 apples.”
    • Then add the original Alice question.
    • New result: The model now correctly answers 1 (5 – 3 – 2 + 1 = 1).

Why it works: You show the LLM the “chain” — the entire reasoning from start to finish — so it replicates that structured thinking.


5. Generated Knowledge (and RAG – Retrieve Augmented Generation)

Core idea: Give the model extra factual context that it wouldn’t have on its own, leading to a much better, more relevant answer.

Mechanism:

  1. Start with a template containing placeholders (e.g., {company_name}, {products_list}).
  2. Fetch the missing data from your own company systems or databases (e.g., via an API call).
  3. Insert that data into the template and send the complete prompt to the LLM.
  4. The LLM now has the exact knowledge it needs to generate a precise answer.

Example (Insurance):

  • Generic question without context:
    “Please suggest an insurance. My budget is $1,000 and it should cover car and home.”
    Result: A very generic reply – “There are multiple insurances…” – not helpful for a specific company.
  • With generated knowledge (RAG):
    First, you fetch the actual product list from “Acme Insurance” and inject it into the prompt:
    e.g., “Acme Insurance offers: 1. Basic Auto ($500), 2. Full Home ($600), 3. Combined Car+Home ($900) …”
    Then ask the same budget question.
    Result: The LLM now recommends specific products that fit within the $1,000 budget, using the real data.
  • Note: Building the data-fetching pipeline is the “devil in the detail”; Azure provides many code samples for Python, JavaScript, Java, .NET, etc.

6. Least-to-Most

Concept: Break a complex problem down into a sequence of smaller, easier sub‑problems, then solve each one in order. Very similar to chain-of-thought, but explicitly about decomposing a large task.

How to apply:

  • First, ask the LLM for the high-level steps needed to solve a problem.
  • Then, for each step, probe deeper to get detailed, actionable answers (often including code).

Example (Data Science):

  1. Initial prompt: “How would I do data science in five steps?”
    LLM responds: “1. Collect data, 2. Clean data, 3. Analyze data, 4. Plot data, 5. Present data.”
  2. Now you use that breakdown to guide more specific prompts:
    Follow-up prompt: “How would I do collect data in data science?”
    (The model now gives a more focused explanation about data collection.)
  3. To get even better output, add extra context and instructions:
    Enhanced prompt: “Show me Python code for collect data in data science.”
    Result: Practical Python code to read a CSV, inspect headers, select features, etc.

Takeaway: The more specific the sub‑step and the richer the instruction (e.g., “show me Python code”), the better the response.


7. Self-Refine

Idea: Treat the LLM’s output as a draft and critique it iteratively to improve it. You act as an editor asking the model to reconsider and enhance its own work.

Process:

  1. Give the model an initial task (e.g., “Create a Python web API with routes for products and customers”).
  2. After receiving the first answer, ask for improvements: “Suggest three improvements to the above code.”
  3. The model will reflect on its earlier output and supply a refined version.
  4. You can repeat this loop as many times as necessary until you are satisfied.

Key insight: This makes the LLM its own critic, helping to catch errors and enhance quality without you having to manually rewrite everything.


8. Myotic (Maieutic) Prompting

Concept: Validate the correctness of a multi‑part answer by cross‑examining each piece. The name likely references the Socratic method of eliciting truth through questioning.

How it works:

  1. Ask a complex question and get a response that contains several distinct parts or steps.
  2. For each part, ask the LLM to explain itself in detail (or even provide a counter‑argument).
  3. If an explanation becomes inconsistent, nonsensical, or seems made‑up, you can discard that part of the answer.

Example (Crisis Plan):

  • Prompt: “How can we create a crisis plan to mitigate a pandemic in five steps?”
  • The model returns five steps.
  • Then, for every step, ask: “Can you explain more in detail how I can deal with this step?”
  • Examine the explanations: if a step’s explanation does not make logical sense, that step is likely an hallucination and should be disregarded.

Purpose: This technique forces the model to expose its reasoning, making it easier to spot fabrications.


9. Summary and Final Thoughts

  • Zero-shot is the baseline; the advanced techniques greatly improve correctness.
  • Chain-of-thought teaches the model reasoning by example.
  • Generated knowledge (RAG) enriches prompts with real, timely data.
  • Least-to-most decomposes complex problems into manageable chunks.
  • Self-refine iterates and improves output through constructive critique.
  • Myotic prompting verifies each part of an answer to filter out hallucinations.
  • By using these patterns, you move from “hoping for the best” to deliberately engineering high‑quality, trustworthy outputs from your AI assistant.
AI
技术
学习打卡
2
1
分享
操作
评论
相关内容
0个评论
全部评论
点击登录,快来和大家讨论吧~
表情
图片

目录

🔥 热门文章
1
手把手教你设计一个成熟的 Agent Harness
2500
2
我用 REA 逆向了付费颜色 APP,结果很意外!
570
3
离谱,DeepSeek 崩了 5 小时,大家却喊:梁圣恩情还不完??
420
4
DeepSeek 全新模型发布,性价比最高的一集!
380
5
B 站上 DeepSeek 闹鱼灾了,我发起《大肥鱼清除计划》!
370
6
自己学习ai,直接买cursor 的套餐,还是买gpt 或者claude 的套餐?
360
7
又一个国产版 Codex 神器,也来卷办公了!
330
8
day3-如何写出一个高质量的 Skill(组内分享) 高质量 Skill 不是“一个调得很顺的巨型 Prompt”,而是一个可验证、可回归、可维护的能力包。 先定义“什么算好”,再实现“怎么做好”。评估体系先于 Skill 本身成型。 下面用“故障诊断 Markdown 转 YAML”作为例子,但方法是通用的。 --- 一、先想清楚:Skill 到底是什么 一个 Skill 至少包含四部分: 部分 作用 接口 输入什么、输出什么、边界在哪 流程 分几步做,每步的产物是什么 规则 硬约束、经验规则、失败模式 降级策略 不确定时怎么办,而不是硬编一个看似合理的结果 高质量 Skill 的共同点:职责单一、接口清晰、规则可定位、输出可验证。 反例:把几十条经验全塞进一个主 Prompt,改一条规则要重调整个 Prompt,评估时也不知道是哪条规则退化。 --- 二、核心方法:先建评估,再写 Skill 不要先写转换器再补测试。正确顺序是: 1. 定义输出契约:什么算合法、什么算合格; 2. 建金标准集:一小批人工认可“可放行”的样本; 3. 先写评估 Skill:让它在金标准集上跑出基线; 4. 再迭代生成 Skill:每次修改跑同一套评估,无退化且目标维度提升才算正向。 这就是评估驱动开发:评估是 Skill 的单元测试,金标准集是回归锚点。 --- 三、评估 Skill:三层门禁,逐层递进 前一层不过,后一层不跑。每层留可追溯证据。 第 1 层:确定性硬门禁 用解析器、Schema、校验器完成,不消耗模型成本。 · 输出可解析; · 必填字段齐全,类型/枚举合法; · 引用目标存在,无悬空引用、无不可达节点; · 关键路径至少有一条能到达预期出口。 不通过直接打回。 第 2 层:语义断言 用脚本 + 结构遍历检查“逻辑对不对”,仍然保持确定性。 通用检查项: · 覆盖率:源材料里的关键步骤、分支、条件,输出里是否都有对应? · 完整性:每个判断节点是否都有明确出口?有没有死胡同? · 可达性:每条路径是否都能到达预期终点?有没有无出口循环? · 顺序与依赖:有先后依赖的操作,是否保留了顺序?有没有被拍平成无序列表? 例子:故障诊断转换中,检查“每个判断项是否有是/否/异常出口”“每条路径是否能到根因”。 第 3 层:LLM-as-Judge 只处理解析器表达不了的维度:忠实度、完整性、可执行性。 但 Judge 会漂移,不能单独放行,必须建立在第 1、2 层之上。Judge 的 Prompt、rubric、模型版本都要版本化,换模型必须用金标准集重新校准。 通用 Judge 维度: 维度 问什么 忠实度 输出是否忠实源材料意图?有没有自行发明内容? 完整性 关键步骤、条件、证据是否保留?隐式知识有没有被压成空话? 收敛性 输出是否仍指向原目标,而不是发散? 可执行性 下游不依赖源材料能否直接使用? --- 四、金标准集:回归测试的锚点 不需要一开始就标注几百份。用已认可的样本当种子,扩到 15~30 份,覆盖失败模式而非随机抽样: · 完整正例:典型流程; · 边界/异常分支:异常路径、循环、前置失败回退; · 已知易错模式:实际踩过的坑; · 留出集:不参与调优,只用于最终验收,防过拟合。 金标准不需要完美,只需要当前标准下认可可放行。 回归指标:关键路径用 pass^k(k 次全过),稳定性用 pass@k。 --- 五、工程约束:让批量产出可重放 · 幂等:同输入 + 同 Skill 版本 + 同规则 → 输出一致,否则无法判断变好是 Skill 改了还是随机波动; · 隔离不阻断:单份失败进隔离队列,记录失败层和原因,不阻塞其余; · 版本绑定:规则、rubric、金标准集进 Git;每份报告绑定“源版本 + 生成 Skill 版本 + 评估 Skill 版本 + Judge 模型版本”; · 抽样人工复核:Judge 临界样本 + 易错模式,人工抽检结果反过来校准 rubric。 --- 六、Skill 本身怎么写 · SKILL.md 控制篇幅,写清:输入约定、输出契约、分步流程、硬规则、降级策略; · 经验规则放 references/ 或 rules/,按失败模式分类,不要全塞进主 Prompt; · 不确定时标 needs_review: true,不要硬编看似合理的结果; · 迭代由评估报告驱动:报告告诉你哪层挂了、哪类失败模式,你改对应规则文件,而不是漫无目的调 Prompt。 --- 七、落地顺序(不要反过来) 1. 固化输出契约:Schema + 结构约束; 2. 建金标准集:从已认可的 + 最易出错的样本开始; 3. 先写评估 Skill:跑出基线报告; 4. 再迭代生成 Skill:每次修改对比逐项通过率,无退化且目标提升才算正向; 5. 批量运行 + 隔离回放:失败进队列,结束后人工抽检; 6. 评估 Skill 自身版本化:换 Judge 模型必须重新校准。 --- 八、给组员的三条硬要求 1. 不许凭感觉说“变好了”:每次修改必须附评估报告对比,逐项通过率说话。 2. 不许跳过确定性门禁直接看 Judge 分数:前两层挂了,Judge 分数没有意义。 3. 不许把规则堆进主 Prompt:规则按失败模式分文件,评估报告要能定位到具体文件。 --- 一句话收尾 生成 Skill 决定“能不能做”,评估 Skill 决定“敢不敢用”。 先让评估体系站稳,再让生成器迭代。这样交付的不是一堆“看起来还行”的产出,而是一套可证明、可回归、可交接的 Skill 质量体系。
310
9
AI 越强,被它拒绝的代价就越大 我有时候会想:AI 越来越厉害之后,有些事情,会不会反而越来越难做? 这个想法看起来有点矛盾。AI 明明在降低门槛,让不会写代码的人做出软件,让不会画画的人生成图片,让一个人完成过去需要整支团队才能完成的工作。但今天用 Codex 的时候,AI 拒绝帮我编写 SQL 注入的请求体,而那还是我有源码、在本地跑测试的情况。那么,往后是否只会更难? 我们假设某一天,AI 说:「这个请求违规,我不能帮助你。」到那个时候,你还有多少能力,能绕过它,把事情做完? 这里的「违规」需要打个引号。平台的规则、模型的判断、法律的要求,以及一件事实际有没有造成伤害,彼此之间并不总是画得上等号。一个请求可能确实危险,也可能只是缺少上下文被误判,或者恰好落在某家公司的限制范围里。 无论是哪种情况,随着我们越来越依赖 AI,这句拒绝都可能变得越来越贵。 今天,一个程序员让 AI 帮忙写代码,AI 拒绝了,他大概率还有别的办法:查文档、找开源项目、问同行,或者自己写。麻烦一点,慢一点,但路还在。 可如果十年之后,大部分程序都由 AI 完成,情况就不一样了。 很多人从接触编程的第一天起,就习惯了描述需求、等待生成、运行结果、继续迭代。他们能做出相当复杂的产品,却未必经历过独立处理底层问题的训练。平时,这种能力结构完全够用,效率甚至更高。只有 AI 拒绝的时候,他们才会发现:平常被省掉的那段学习过程,恰好是此刻最需要的东西。 到那时,一次拒绝的成本,可能就从「今晚多花两个小时」,变成「先花半年学会这门技术」。 拿 SQL 注入举个稍显极端的例子:往后,连真正理解这类攻击如何发生、能够独立构造测试的人,会不会也越来越少? 这里也包括那些有正当需求的人。一个开发者想检查自己的旧系统,一个经过授权的安全研究员想复现漏洞,假如 AI 识别到危险模式就拒绝,而使用者又只熟悉「让 AI 帮我检查」,这项原本可以独立完成的工作,就这样卡住了。 但是安全专家不会因此消失,但这类技能可能越来越集中在少数人手里。你仍然可以找专家,只是要付出更多的钱、更多的时间,以及更高的沟通成本。 类似的困境,未必只发生在网络安全领域。 你想从一个停止维护的软件里取回自己的数据,需要解析它的旧文件格式。AI 判断这涉及规避保护措施,拒绝继续。你拥有这些数据,却没有能力把它们读出来。 你买了一台设备,厂商停止提供服务。你想修改程序让它继续运转,过程中需要处理某种访问限制。AI 不愿协助,而你所掌握的维修方式,早已只剩下「把报错发给 AI」。 你想给常用的网站写一个辅助工具,减少重复操作。平台将此归入自动化限制,AI 也据此拒绝。过去会写脚本的人可以自己判断、自己处理;未来的使用者,可能连从哪里开始都不知道。 这些例子有一个共同点:当工具同时承担了「执行工作」和「传授知识」的角色,它的拒绝就不只是挡住了一次任务,也挡住了获得这种能力的机会。 更麻烦的是,这种依赖往往是我们主动选择的,而且每一步都很合理。 既然 AI 几秒钟就能做好,为什么还要花几个月学习?既然公司可以采购成熟的 AI 服务,为什么还要养一支负责基础工作的团队?既然市场上已经很少有人手写这些东西,学校为什么还要花大量时间教? 对个人、公司和学校来说,这些选择都有现实依据。但叠加起来,整个社会保留的独立能力就可能越来越少。等到某项能力突然受到限制,我们才发现,备用方案早已在追求效率的过程中被一点点削掉了。 所以,「AI 越强,做事越便宜」可能只描述了未来的一半。 另一半是:被允许的事情越来越便宜,被拒绝的事情依然需要人工完成,却要面对更少的人才、更高的报价,以及越来越难获得的知识。两边的成本差距,会越拉越大。 有人会说,可以换一个模型,或者用本地模型。这确实是重要的选项。只要工具之间还有充分竞争,开放模型还足够可用,限制就未必能形成真正的门槛。 但备用方案也需要维护。它需要硬件、知识、软件生态,以及一群仍然理解这些系统的人。如果大多数人已经习惯了最方便的商业服务,那么「理论上还有别的办法」和「普通人实际用得起、用得明白」,之间仍然可能隔着很远。 我担心的,正是这段距离。 我不指望 AI 对任何请求都照单全收。对明显会伤害他人的行为设置限制,有充分的理由。但我们也需要关心:限制由谁定义,误判有没有申诉渠道,用户能不能换工具,以及脱离这个工具之后,还剩下多少独立行动的能力。 保留这些能力,平时看起来甚至有点低效,明明可以自动生成,还要理解原理;明明可以一键完成,还要知道手动怎么做。 但这些看似多余的知识,会在工具拒绝、失效、涨价或改变规则的那一刻,成为真正的选择权。 AI 越强,我们可能越需要留意它说「不」的那一刻。 因为那句话的分量,最终取决于:它拒绝之后,我们还能做什么。
310
10
什么是LLM
300
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
零感AI零感AI
墨得问题墨得问题