# Prompt 技巧指南-让 ChatGPT 回答准确十倍！

05/05 13:03

## Zero-shot （零样本）

Prompt:

1 Classify the text into neutral, negative, or positive.
2
3 Text: I think the vacation is okay.
4 Sentiment:


Neutral


## Few-Shot （少样本）

Prompt:

1 A "whatpu" is a small, furry animal native to Tanzania. An example of a sentence that uses
2 the word whatpu is:
3 We were traveling in Africa and we saw these very cute whatpus.
4 To do a "farduddle" means to jump up and down really fast. An example of a sentence that uses
5 the word farduddle is:


When we won the game, we all started to farduddle in celebration.


## Chain-of-Thought(CoT)

Prompt:

1 The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1.
2
3 A:


Yes, the odd numbers in this group add up to 107, which is an even number.


Prompt:

1 The odd numbers in this group add up to an even number: 4, 8, 9, 15, 12, 2, 1.
2 A: Adding all the odd numbers (9, 15, 1) gives 25. The answer is False.
3
4 The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1.
5 A:


Adding all the odd numbers (15, 5, 13, 7, 1) gives 41. The answer is False.


## Zero-Shot CoT

Zero-shot 可以和 CoT 结合起来用，即不给例子，直接让 LLM 在回答里带上一步步思考，并得到最后的答案。这样即省了 token 的消耗，又可以得到准确的答案。最常见的一种方式是在问题后面加上 "Let's think step by step"。

Prompt:

1 I went to the market and bought 10 apples. I gave 2 apples to the neighbor and 2 to the repairman. I then went and bought 5 more apples and ate 1. How many apples did I remain with?
2
3 Let's think step by step.


1 First, you started with 10 apples.
2 You gave away 2 apples to the neighbor and 2 to the repairman, so you had 6 apples left.
3 Then you bought 5 more apples, so now you had 11 apples.
4 Finally, you ate 1 apple, so you would remain with 10 apples.


## PAL (Program-Aided Language Models)

Program-Aided Language Models(程序辅助语言模型)使用 LLM 阅读自然语言问题，并生成程序作为中间推理步骤的方法。(PAL) 与思维链提示的不同之处在于，它不是使用自由格式的文本来获得解决方案，而是将解决方案步骤变为编程代码运行，提高了结果的准确性。该方法的缺点是需要较长的提示样例，通常也是一些程序代码，这样才能让 LLM 也用代码回答。

0 评论
0 收藏
0