[{"data":1,"prerenderedAt":284},["ShallowReactive",2],{"content-query-OjHRl6KAwg":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"body":13,"_type":278,"_id":279,"_source":280,"_file":281,"_stem":282,"_extension":283},"/news/zh/3051","zh",false,"","【昇思MindSpore技术公开课】第十二讲 Prompt engineering 课程回顾","昇思MindSpore技术公开课大模型专题精彩继续！","2024-04-10","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/d03be8fce36e4f9598899fca3ca5a9fd.png","news",{"type":14,"children":15,"toc":275},"root",[16,24,30,46,51,56,61,69,79,84,89,94,108,113,123,143,163,170,188,195,209,216,221,228,242,249,256,263],{"type":17,"tag":18,"props":19,"children":21},"element","h1",{"id":20},"昇思mindspore技术公开课第十二讲-prompt-engineering-课程回顾",[22],{"type":23,"value":8},"text",{"type":17,"tag":25,"props":26,"children":27},"p",{},[28],{"type":23,"value":29},"昇思MindSpore技术公开课大模型专题精彩继续！上期课程我们针对大模型提示词工程（Prompt engineering）进行了一些列知识点的讲解，并且带领大家使用Ascend+MindFormers+MindSpore部署Baichuan2的多轮对话聊天机器人。下面我们对Prompt engineering的课程知识点进行总结：",{"type":17,"tag":25,"props":31,"children":32},{},[33,39,41],{"type":17,"tag":34,"props":35,"children":36},"strong",{},[37],{"type":23,"value":38},"1",{"type":23,"value":40},"**、**",{"type":17,"tag":34,"props":42,"children":43},{},[44],{"type":23,"value":45},"什么是Prompt？",{"type":17,"tag":25,"props":47,"children":48},{},[49],{"type":23,"value":50},"**Prompt定义：**涉及传递给语言模型，以实现所需任务的指令和上下文，驱动大模型进行图文表达的文本描述。",{"type":17,"tag":25,"props":52,"children":53},{},[54],{"type":23,"value":55},"**Prompt engineering定义：**是开发和优化提示，以有效地将语言模型用于各种应用程序的实践。",{"type":17,"tag":25,"props":57,"children":58},{},[59],{"type":23,"value":60},"**主要使用Prompt的场景主要分为两个部分：**语言对话和文生图两种常见类别。",{"type":17,"tag":25,"props":62,"children":63},{},[64],{"type":17,"tag":65,"props":66,"children":68},"img",{"alt":7,"src":67},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/14c374ce866f4b448a737b0b3d9f8a8d.png",[],{"type":17,"tag":25,"props":70,"children":71},{},[72,74],{"type":23,"value":73},"**2、**",{"type":17,"tag":34,"props":75,"children":76},{},[77],{"type":23,"value":78},"如何定义一个Prompt的好坏?",{"type":17,"tag":25,"props":80,"children":81},{},[82],{"type":23,"value":83},"（1）**角色赋予：**就是让大语言模型（LLM）明白自已的身份，说与身份对应的话",{"type":17,"tag":25,"props":85,"children":86},{},[87],{"type":23,"value":88},"（2）**细化指令：**从产出结果出发，逆向推导要点，并给出明确要求。",{"type":17,"tag":25,"props":90,"children":91},{},[92],{"type":23,"value":93},"（3）**格式控制：**给出字数限制，要点列举，文章结构，如标题分级，还有押韵比喻等手法，让输出的内容更符合预期。",{"type":17,"tag":25,"props":95,"children":96},{},[97,102,103],{"type":17,"tag":34,"props":98,"children":99},{},[100],{"type":23,"value":101},"3",{"type":23,"value":40},{"type":17,"tag":34,"props":104,"children":105},{},[106],{"type":23,"value":107},"如何撰写优质的Prompt？",{"type":17,"tag":25,"props":109,"children":110},{},[111],{"type":23,"value":112},"假设我们有一个任务：我现在要去天津旅游，我想要baichuan2大模型给我一份旅游攻略",{"type":17,"tag":25,"props":114,"children":115},{},[116,118],{"type":23,"value":117},"**第一步：**说清楚：大语言模型没办法洞察用户的内心，所以要确保 Prompt 有清晰明确地表达你的意图。",{"type":17,"tag":34,"props":119,"children":120},{},[121],{"type":23,"value":122},"Prompt=“给我一份去天津三天两晚的旅游攻略”。",{"type":17,"tag":25,"props":124,"children":125},{},[126,128],{"type":23,"value":127},"**第二步：**做强调：我们可以突出我们重点所需要的地方，对一些我们希望固定输出的内容进行强调，或者将一些细节进行输入。",{"type":17,"tag":34,"props":129,"children":130},{},[131,133,141],{"type":23,"value":132},"Prompt=“给我一份去天津三天两晚的旅游攻略，",{"type":17,"tag":34,"props":134,"children":135},{},[136],{"type":17,"tag":34,"props":137,"children":138},{},[139],{"type":23,"value":140},"我特别想去看大爷跳水和吃煎饼果子",{"type":23,"value":142},"”。",{"type":17,"tag":25,"props":144,"children":145},{},[146,148],{"type":23,"value":147},"**第三步：**定人设：我们可以给大模型预设定一个人设，假设它是某个相对应场景非常专业的人士，这样子可以使得输出的结果更加的精确。",{"type":17,"tag":34,"props":149,"children":150},{},[151,153,161],{"type":23,"value":152},"Prompt=“",{"type":17,"tag":34,"props":154,"children":155},{},[156],{"type":17,"tag":34,"props":157,"children":158},{},[159],{"type":23,"value":160},"你是有10年资历携程旅行资深的规划师，拥有给2000名私人用户进行短程旅游的规划经验，行程的规划更加细致",{"type":23,"value":162},"，现在给我一份去天津三天两晚的旅游攻略，我特别想去看大爷跳水和吃煎饼果子”。",{"type":17,"tag":25,"props":164,"children":165},{},[166],{"type":17,"tag":65,"props":167,"children":169},{"alt":7,"src":168},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/16b4168b2f4b466188c1c3ed47327540.png",[],{"type":17,"tag":25,"props":171,"children":172},{},[173,175],{"type":23,"value":174},"**第四步：**追问细节：目前大多数模型都有长记忆的回答功能，我们可以根据它的回答去在细节上进行询问。",{"type":17,"tag":34,"props":176,"children":177},{},[178,179,187],{"type":23,"value":152},{"type":17,"tag":34,"props":180,"children":181},{},[182],{"type":17,"tag":34,"props":183,"children":184},{},[185],{"type":23,"value":186},"五大道是一个错综复杂的地方，请给我设计一条线路以便我能够在一个下午游览整个五大道的景点",{"type":23,"value":142},{"type":17,"tag":25,"props":189,"children":190},{},[191],{"type":17,"tag":65,"props":192,"children":194},{"alt":7,"src":193},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/d73bb960a7da4f968d814f792e94910c.png",[],{"type":17,"tag":25,"props":196,"children":197},{},[198,203,204],{"type":17,"tag":34,"props":199,"children":200},{},[201],{"type":23,"value":202},"4",{"type":23,"value":40},{"type":17,"tag":34,"props":205,"children":206},{},[207],{"type":23,"value":208},"如何产出一个优质的Prompt？",{"type":17,"tag":25,"props":210,"children":211},{},[212],{"type":17,"tag":65,"props":213,"children":215},{"alt":7,"src":214},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/f4ebdb3afcca4fed8cd32afdc7d2d561.png",[],{"type":17,"tag":25,"props":217,"children":218},{},[219],{"type":23,"value":220},"下面给出一个小案例：",{"type":17,"tag":25,"props":222,"children":223},{},[224],{"type":17,"tag":65,"props":225,"children":227},{"alt":7,"src":226},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/f837d6ddeff045f285a241f8d5ebe571.png",[],{"type":17,"tag":25,"props":229,"children":230},{},[231,236,237],{"type":17,"tag":34,"props":232,"children":233},{},[234],{"type":23,"value":235},"5",{"type":23,"value":40},{"type":17,"tag":34,"props":238,"children":239},{},[240],{"type":23,"value":241},"浅谈一些我们在进行Prompt的时候遇到的问题",{"type":17,"tag":25,"props":243,"children":244},{},[245],{"type":17,"tag":65,"props":246,"children":248},{"alt":7,"src":247},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/d89a75fe35804c7ea7fb26b82974c6ad.png",[],{"type":17,"tag":25,"props":250,"children":251},{},[252],{"type":17,"tag":65,"props":253,"children":255},{"alt":7,"src":254},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/60f99dd15712447e96bbf8af46f9f50b.png",[],{"type":17,"tag":25,"props":257,"children":258},{},[259],{"type":17,"tag":65,"props":260,"children":262},{"alt":7,"src":261},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/04/12/35ed4528f66a43f9aa87590b4bd29be2.png",[],{"type":17,"tag":25,"props":264,"children":265},{},[266,268,273],{"type":23,"value":267},"最后大家可以根据启智社区上的README.md（关注MindSpore公众号，点击文章结尾处“",{"type":17,"tag":34,"props":269,"children":270},{},[271],{"type":23,"value":272},"阅读原文",{"type":23,"value":274},"”，可前往查看），即可以在Ascend设备上进行Baichuan2的模型多轮对话。",{"title":7,"searchDepth":276,"depth":276,"links":277},4,[],"markdown","content:news:zh:3051.md","content","news/zh/3051.md","news/zh/3051","md",1776506078809]