ChatGPT Prompt Engineering – 2. 基本原则 (2)

基本原则

原则 2:给模型时间去“思考”

技巧 1:显式制定完成任务所需要的步骤

输入:

Perform the following actions:

1 – Summarize the following text delimited by triple quotes with 1 sentence.
2 – Translate the summary into French.
3 – List each name in the French summary.
4 – Output a json object that contains the following keys: french_summary, num_names.

Separate your answers with line breaks.

Text:

”’
In a charming village, siblings Jack and Jill set out on a quest to fetch water from a hilltop well. As they climbed, singing joyfully, misfortune struck—Jack tripped on a stone and tumbled down the hill, with Jill following suit. Though slightly battered, the pair returned home to comforting embraces. Despite the mishap, their adventurous spirits remained undimmed, and they continued exploring with delight.
”’

输出:

Two siblings, Jack and Jill, go on an adventurous quest to fetch water from a hilltop well, but misfortune strikes as Jack trips and tumbles down the hill, with Jill following, yet they return home with comforting embraces and continue their exploration undeterred.

Deux frères et sœurs, Jack et Jill, partent pour une aventureuse quête pour aller chercher de l’eau d’un puits au sommet de la colline, mais une malchance les frappe, et bien que légèrement blessés, ils continuent leur exploration avec des esprits intrépides.

Names: Jack, Jill.

{“french_summary”: “Deux frères et sœurs, Jack et Jill, partent pour une aventureuse quête pour aller chercher de l’eau d’un puits au sommet de la colline, mais une malchance les frappe, et bien que légèrement blessés, ils continuent leur exploration avec des esprits intrépides.”, “num_names”: 2}

继续阅读ChatGPT Prompt Engineering – 2. 基本原则 (2)

ChatGPT Prompt Engineering – 1. 基本原则 (1)

Andrew Ng 最近在他的 deeplearning.ai 上发布了 ChatGPT Prompt Engineering for Developers 教程。这个教程大概一个半小时左右,属于 how to 而非 what is,虽然标题带有 for Developers,但不需要编程基础也可以看懂。

这篇文章是我对 Andrew 教程的 notes + 简短总结。并非原创,只是为了自己学习+记忆方便。文章中的输入/输出使用 ChatGPT 的免费版本。

看完教程的一些感想:

  1. Prompt Engineering,与其说它是 engineering 不如应该说它是 communication,使用与人对话的方式,而非机械思维,可以得到更合理的答案
  2. 编程思维可以有效改善 Prompt Engineering:比如使用分隔符,结构化输出,条件验证这些技巧
  3. Somehow ChatGPT 看似具备了抽象,比喻,概括等我们之前认为只有人类才具备的语言能力,利用这些能力,我们可以大大提升我们的信息获取/生成效率
  4. ChatGPT 将会取代重复性较高,创意性较低的知识型工作,比如文员,翻译,插画师等等
  5. 可以用 ChatGPT 进行 task-based 编程,但我不认为可以用 ChatGPT 开发较复杂的软件(我很难想象如何用 ChatGPT 进行功能迭代)
  6. ChatGPT 是乘法,我的理解是:a (你的能力) × b(你使用 ChatGPT 的能力) × c(ChatGPT 模型的能力)
  7. 考虑到各大公司对 xGPT 的投入力度,c 会随着时间大幅增长,所以 xGPT 可能是自计算机出现以来,人类最强的 knowledge leverage
  8. b 需要 programming thinking, creative thinking, 以及 lateral thinking, which might be a good thing or bad thing for programmers
  9. a 取决与自己的 knowns 和 known unknowns,所以我们可能需要努力减少自己的 unknown unknowns,而非做一个专才

不废话了,下面是 notes,夹杂一些自己的感想:

基本原则

原则 1:使用明确的指令

技巧 1:使用分隔符

使用不常见的字符组合 ~~~ 或 ”’ 作为分隔符,用来提供明确的输入。

输入:

Summarize the text delimited by triple backticks into a single sentence.

```
You should express what you want a model to do by providing instructions that are as clear and specific as you can possibly make them.  This will guide the model towards the desired output, and reduce the chances of receiving irrelevant or incorrect responses. Don't confuse writing a clear prompt with writing a short prompt. In many cases, longer prompts provide more clarity and context for the model, which can lead to more detailed and relevant outputs.
```

输出:

Providing clear and specific instructions to a model will guide it towards the desired output and reduce the chances of receiving irrelevant or incorrect responses, and longer prompts can provide more clarity and context for the model, leading to more detailed and relevant outputs.
继续阅读ChatGPT Prompt Engineering – 1. 基本原则 (1)