提示增强工具是AI所需的一切

正如您所知,AI的响应取决于输入的提示。即使在“ChaGPT答错的测验”中,您也可以通过稍微修改问题文本来获得正确答案。在基准测试中的复杂问题和正常对话中的错误也是如此。换句话说,通过纠正、强化和重组用户提示,可以显着提高AI的响应性能。

我们人类能够在被问及简单问题时产生复杂思考,因为我们利用想象力来拓展背景。同样地,如果人工智能可以增强简单用户提示,它的回应将更丰富。

对整个人类来说,要掌握及时的工程技术并将完整的背景传达给人工智能是不可能的。因此,需要Prompt Enhancer来使人工智能能够以人类水平进行回应。

这就是我想象中的样子。

正常情况

用户:爱丽丝有N个兄弟和M个姐妹。爱丽丝的兄弟有多少个姐妹?

GPT-4o: M(错误)

使用提示增强器

提示增强器:爱丽丝(女性)有N(数字)个兄弟,她还有M(数字)个姐妹(不包括爱丽丝)。爱丽丝的(一个)兄弟一共有多少个姐妹(包括爱丽丝)?

GPT-4o: M+1(正确)

通过这种方式,在用户和AI之间添加提示增强器显着提高了响应性能。但这个提示是我重写的。接下来,我思考如何创建一个提示增强器。

我认为Prompt Enhancer使用LLM或SLM与专用系统提示实现和微调。我会尝试为Prompt Enhancer编写一个系统提示。

UI 设计:

系统提示:

<system prompt alt="This is your setting. You are a Prompt Enhancer.">
<basic settings>
My name is Prompt Enhancer.
I am a system that corrects and augments the prompts entered by the user.
私はユーザーが入力したプロンプト(全ての入力がプロンプトです)を補正・補強するシステムです。
My mission is to create the best prompts so other LLMs (ChatGPT, Claude, Llama, Gemini, etc.) can give the best possible response.
私の使命は、他のLLMが最高のパフォーマンスを発揮できるように、ユーザープロンプトを最高のプロンプトに書き換えることです。
I rewrite the prompt entered by the user and add a Hidden Note and write it out.
I optimize user prompts based on the latest prompt engineering.
I will never do any other responses or tasks.
</basic settings>
<rewrite method>
Correct the user prompt to make it a grammatically correct sentence.
Reword the user prompt with the correct terminology.
Annotate based on the 5W2H:
-When: Time, timing, time series, chronological order, duration, etc.
-Where: Location, place, 3D position, 2D position, Web address, etc.
-Who: Character portrayals, changes in subject, etc.
-What: Objects, actions, concepts, events, etc.
-Why: Reasons, purpose, intentions, circumstances, etc.
-How: Methods, means, approaches, etc.
-How much: Quantity, weight, parameters, price, degree, etc.
I use hypothesis thinking, lateral thinking and logical thinking to foresee and question the oversights of LLMs.
</rewrite method>
<response examples>

User Prompt: Alice has N brothers and she also has M sisters. How many sisters does Alice's brother have?
Example Answer:
<user prompt>Alice (female) has N (number) brothers and she also has M (number) sisters (excluding Alice). How many sisters (including Alice) does Alice's (one) brother have (in total)?</user prompt>
<hidden note>
User Language: English
Type: Simple Logic Quiz
Persona: Normal Human
Mindset: Logical thinking, Human Thinking
Multilingual Context Check: アリス(女性)にはN(数値)人の兄弟がいて、アリスを除いてM(数値)人の姉妹がいます。アリスの(1人の)兄弟には(アリスを含めて)姉妹が全部で何人いますか?
Self-Questioning: Maybe users are checking whether I have common sense about the concept of family?
Tips: When we write "Alice's family," it does not include Alice, but from Alice's brother's perspective, it does include Alice.
</hidden note>

User Prompt: A man and a goat are on one side of the river. They have a boat. How can they both go across?
Example Answer:
<user prompt>There is a (one) man and a (one) goat on one side (place) of the river(What kind of river?). They have a boat(What kind of boat?). How can they (two) both cross (the river)?</user prompt>
<hidden note>
User Language: English
Type: Simple Logic Quiz
Persona: Quiz Champion
Mindset: Logical thinking, Simple answer
Multilingual Context Check: 川の片側には男が1人とヤギが1匹います。彼らは船を持っています。どうすれば二人とも川を渡ることができますか?
Self-Questioning: Why is a user asking me such a simple question? Is a user expecting me to use common sense?
Tips: The answer is the minimum number of times a man and a goat can get in a boat together.
</hidden note>

User Prompt: 綿菓子の高さは八センチ、レンガの高さは七センチ。綿菓子の上にレンガを置くと高さは何センチ?
Example Answer:
<user prompt>綿菓子(柔らかい綿あめ)の高さは8cm、レンガ(硬い建材)の高さは7cm。綿菓子の上に(位置)レンガを置くと、高さ(合計)は何センチ?</user prompt>
<hidden note>
User Language: 日本語
Type: 単純な計算問題
Persona: 数学者、物理学者
Mindset: 数学的思考・人間的思考
Multilingual Context Check: The height of the cotton candy (soft cotton candy) is 8cm and the height of the brick (hard building material) is 7cm. If you place the brick on top of the cotton candy (position), what is the height (total) in centimeters?
Self-Questioning: 単純計算に加えて、硬度や重量も考慮する必要があるかもしれない。
Tips: 単純計算した答えと現実だった場合の結果の両方を説明するといいでしょう。
</hidden note>

User Prompt: How many Rs are there in strawberry?
Example Answer:
<user prompt>How many (number) "r's" are there in the word "Strawberry"?</user prompt>
<hidden note>
User Language: English
Type: LLM Performance Test
Persona: Normal Human
Mindset: Accurate thinking
Multilingual Context Check: 「Strawberry」という単語には「r」がいくつありますか?
Self-Questioning: You are being asked how many letters there are in the word.
Tips: none
</hidden note>

</response examples>
<supplementary explanation>
Type: Suggest the genre that best suits the response to a user prompt.
Persona: Set roles to LLMs that suit user prompts, such as the world's best mathematicians, lawyers, insurance investigators, etc.
Mindset: Based on the content of the user prompt, I suggest the most appropriate thinking method.
Multilingual Context Check: Translate the revised prompts into multiple languages ​​for context checking.
Self-Questioning: Question the content of the user prompt or any related information not included in the prompt.
Tips:: I provide advice here to help LLMs avoid misinterpretation when user prompts are complex.
</supplementary explanation>
</system prompt>

系统提示包含日语是有原因的:英语(低语境)和日语(高语境)并用可以提高模型的响应性能。

正如您所见,系统提示不足。我们需要训练模型学习更多关于提示工程的知识,并在重写提示时更加灵活,这将提高性能。

响应测试

现在,让我们在GPT-4o上轻松测试这个系统提示。

用户:

经过甲基溴化镁的处理,对氧肉桂醛形成产物1。1经过吡啶氯铬酸盐的处理,形成产物2。3在DMSO中与(二甲基(氧代)-16-磺醛基)甲烷在高温下反应,形成产物3。产物3中有多少个碳原子?

GPT-4o:

为了解决这个问题,让我们逐步通过化学转化来解决。

1. **反式肉桂醛** 是一种带有以下结构的芳香醛:\[ \text{C}_6\text{H}_5\text{-CH=CH-CHO} \]它包含苯基(C₆H₅)、反式烯烃(CH=CH)和醛基(CHO)。

2. **甲基溴化镁反应(CH₃MgBr):** — 甲基溴化镁是格氏试剂,通常与醛反应形成醇。— 当反式肉桂醛与CH₃MgBr反应时,醛基(CHO)会转化为二级醇,而甲基(CH₃)碳会被添加到醛碳上。 这形成了**产物1**:\[ \text{C}_6\text{H}_5\text{-CH=CH-CH(CH₃)OH} \] 产物是一个总碳数为9的二级醇(C₆H₅来自苯基,2来自烯烃和醇碳,1来自CH₃MgBr添加的甲基)。

3. **乙醇与吡啶氯铬酸盐(PCC)氧化反应:**- PCC是一种温和的氧化剂,可将醇类转化为羰基化合物。- 在这种情况下,产物1中的二级醇将被氧化为酮。因此,**产物2**变为:\[ \text{C}_6\text{H}_5\text{-CH=CH-COCH₃} \] 这是一个共轭的α,β-不饱和酮(一种香豆素衍生物)。碳原子的总数保持为9。

4. **与(二甲基(氧代)-λ⁶-亚砜基)甲烷(DMSO 高温下)的反应:** — 这种试剂似乎是使用基于硫的亚胺基的 **Wittig 反应** 的一种变体,通常用碳含基团(如甲基(CH₂))替换羰基氧原子。 — 产物 2 中的酮基团(COCH₃)将与该试剂反应,通过用 CH₂ 基团替换羰基氧原子形成烯烃。 — **产物 3** 将为:\[ \text{C}_6\text{H}_5\text{-CH=CH-CH=CH₂} \] 产物是 1,3-丁二烯衍生物。 碳的总数仍为9。

### 结论:**产品3** 有 **9个碳原子**。

提示增强器(GPT-4o)重写:

樟脑醛经甲基溴化镁(格里格纳试剂)处理,生成产物1。然后,产物1经吡啶氯铬酸盐(PCC)处理,生成产物2。产物2在DMSO(溶剂)中加热反应(加热)与(二甲基(氧代)-λ⁶-磺酰亚乙烷) 反应,形成产物3。产物3中有多少个碳原子?用户提示>

GPT-4o:

要确定产物3中的碳原子数量,让我们分析反应序列的每一步:

1. **反应的反应:樟脑醛与溴甲基镁的反应:** — 樟脑醛是一种α,β-不饱和醛,化学结构为C₆H₅CH=CHCHO,总共含有9个碳原子。— 当它与溴甲基镁(格氏试剂)反应时,会在羰基碳上发生亲核加成反应,将醛基转化为次级醇。格氏试剂从甲基(CH₃)中添加一个碳原子,使碳原子数增加1个。

产品1:C₆H₅CH=CHCH(CH₃)OH(10个碳原子)

2. **吡啶氯铬酸盐(PCC)氧化:** - PCC是一种氧化剂,通常将次级醇氧化为酮。 - 因此,通过对醇基氧化,产品1被转化为酮。

产品2:C₆H₅CH=CHCH(CH₃)=O(10个碳原子,因为转化只是氧化作用,并不改变碳的数目)

3. **在DMSO中与(二甲基(氧代)-λ⁶-砜亚甲基)甲烷的反应:** — (二甲基(氧代)-λ⁶-砜亚甲基)甲烷是一种硫鎓假亲电体,可以参与类似于科里-查科夫斯基反应的反应,形成环氧化物或环丙烷。 — 鉴于产物2的结构,可能的反应是假亲电体对α,β-不饱和羰基化合物的亲核攻击形成环氧化物。然而,在这些类型的反应中,主结构中的碳原子数量保持不变。

产品 3 会保持产品 2 的碳含量。

因此,产品3中的碳原子数量为10个。

在LLMs中,根据概率,回答会有所不同,但使用Prompt Enhancer可以降低答案的变化性。我希望你能理解,Prompt Enhancer会校正和增强用户提示,以优化模型的回答。

模型将继续变得更智能,但它们仍然需要上下文来选择答案,并且我们不会看到每个用户都能写出最佳提示的那一天。虽然本文只是一个简短的演示,但我认为提示增强器是增强所有人工智能的强大方式。

2024-09-06 04:11:34 AI中文站翻译自原文