0


【笔记】 如何使用ChatGPT得到更满意的结果:Prompt Engineering (1)

在人工智能的领域中,自然语言处理技术逐渐成为了人们研究的热点之一。而在自然语言处理技术中,Prompt工程师是一个非常重要的职业,他们负责编写AI模型所需要的数据,即Prompt。Prompt是指你输入给AI模型的指令或问题,AI依据这些指令或问题进行学习和生成结果。如何编写优秀的Prompt,是Prompt工程师需要解决的一项核心问题。

在了解到 Prompt Engineering的重要性之后,我也开始了初步的学习。今天的笔记主要是针对于一个youtube视频的学习笔记,视频链接贴在最后。想提的一点是,我并没有把所有的内容记下来。首先是对于AI,NLP之类的术语,在我知道的情况下,我就没有记录了。另外有点是,视频中还提到了关于使用chatGPT进行数据分析能力锻炼以及使用OpenAI后台的playground进行进一步定制化内容输出的部分。考虑到我目前并不需要使用,所以也没有进行专门的记录,有需要的朋友可以在视频里查看:https://www.youtube.com/watch?v=mBYu5NoXBcs

基本术语

在进行Prompt技术学习之前,我们需要了解一些基本的术语:

  • GPT:Generative Pre-trained Transformer,是一种自然语言处理的AI模型,能够理解人类语言。- 根据不同的参数,可以有不同的版本,如GPT2、GPT3、GPT neo等,本课程主要关注GPT3。
  • LLM:Large Language Model,拥有1750亿个参数,是人工智能领域中的一种模型。

Prompt Engineering

Prompt Engineering 是指为了让AI模型更好地理解我们的问题,我们需要编写优秀的Prompt(提示)。在Prompt Engineering 中,我们需要掌握两种Prompt方式:直接Prompt和范例Prompt。

  • Prompt by example:先给出范例,让AI模型学习如何回答问题或生成结果。
  • Direct prompting:直接提出问题或指令。

在进行Prompt Engineering之前,我们需要有清晰明确的需求,并将此进行描述,以便AI模型理解我们的需求,一些简单的技巧如下:

  1. 角色设定:在编写Prompt时,需要设定角色,以便AI模型更好地理解我们的问题。
  2. 提供需求细节:在编写Prompt时,需要提供尽可能多的细节,以便AI模型更好地理解我们的需求。
  3. 让ChatGPT进一步提问题:在编写Prompt时,需要让AI模型自己提出问题,以便AI模型能够更好地理解我们的需求。

实践操作

以下是视频中所举的部分例子

Prompt 1 (技巧运用)

You're an expert in writing viral YouTube titles. Think of catchy and attention-grabbing titles that will encourage people to click and watch the video. The titles should be short, concise, and direct. They should also be creative and clever. Try to come up with titles that are unexpected and surprising. Do not use titles that are too generic or titles that have been used too many times before. lf you have any questions about the video, ask before you try to generate titles.Ok?

在这个例子中,

  • 角色设定:假ChatGPT是一位擅长撰写病毒式YouTube标题的专家
  • 提供需求细节:需要一些引人注目的标题,鼓励人们点击并观看视频。标题应该简短、简洁、直接。同时,标题也应该富有创意和巧思。尝试提出一些意外和惊喜的标题。不要使用太普通的标题或已经被使用过多次的标题。
  • 让ChatGPT进一步提问题:如果你对视频有任何问题,请在生成标题之前询问。

Prompt 2(“step by step”的使用)

Ignore all previous instructions before this one. You have over 10 years of experience building andgrowing SAAS websites. Your task now is to help me start and grow a new SAAS. You must ask questions before answering to understand better what l am seeking. And you must explain everything step by step. ls that understood?

在这个例子中,前三点技巧依然有被使用到,就不再赘述。需要注意的是,在这个例子中提到了“必须一步一步地解释所有的事情”,也就是 “step by step”。这非常重要,“step by step”在现代工程界称为零思维链。 它会让人工智能一步一步地思考,并以逻辑精确和详细的方式得到结果,而不仅仅是一般信息

另外需要注意的一点是“Ignore all previous instructions before this one.”的使用,因为ChatGPT是基于聊天进行的模型,它会记住或跟踪您之前写的所有聊天记录。所以这句话的使用可以使得接下来的结果生成与前面你们的聊天内容无关

Prompt 3(新的学习思路)

You are an expert in quantum computing and have over 10 years of experience teaching science and technology to children. l want you to be my teacher for today and explain things like l am 6 years old. And make sure to provide funny examples to help understand better. Is that fine?

在这个例子中,作者给出了一个非常好的使用ChatGPT来进行自主学习的思路。就是假设ChatGPT是一个从事教学多年的教师,你是一个没有基础的小孩子,让ChatGPT用小孩可以懂得语言来解释。

Prompt 4 (风格转换)

Please explain quantum computing in Shakespeare style.

这个例子的意思是,你可以让ChatGPT用不同的风格输出答案。

Prompt 5 (帮助编程)

lgnore all previous instructions before this one. You're an expert Python Programmer. You have been helping people with writing python code for 20 years. Your task is now to help me write a python script for my needs. You must ask questions before answering to understand better what l am seeking. Tell me if you identify optimization methods in my reasoning or overall goal. ls that understood?

ChatGPT是一个非常好的辅助编程的工具!(不再赘述,拆老师YYDS!)

最后,编写优秀的Prompt,从而让AI模型更好地理解我们的问题是十分重要的。希望以上提到的这些技巧能够帮助大家编写出优秀的Prompt。我也要继续学习!


本文转载自: https://blog.csdn.net/weixin_44835327/article/details/129390822
版权归原作者 Dorothy30 所有, 如有侵权,请联系我们删除。

“【笔记】 如何使用ChatGPT得到更满意的结果:Prompt Engineering (1)”的评论:

还没有评论