《谷歌:2024提示词工程(Prompt Engineering)白皮书(英文版)(65页).pdf》由会员分享,可在线阅读,更多相关《谷歌:2024提示词工程(Prompt Engineering)白皮书(英文版)(65页).pdf(65页珍藏版)》请在三个皮匠报告上搜索。
1、Prompt EngineeringAuthor:Lee BoonstraPrompt EngineeringSeptember 20242AcknowledgementsReviewers and ContributorsMichael ShermanYuan CaoErick ArmbrustAnant NawalgariaAntonio GulliSimone CammelCurators and EditorsAntonio GulliAnant NawalgariaGrace Mollison Technical WriterJoey HaymakerDesignerMichael
2、Lanning Introduction 6Prompt engineering 7LLM output configuration 8 Output length 8 Sampling controls 9 Temperature 9 Top-K and top-P 10Puttingitalltogether 11Prompting techniques 12 General prompting/zero shot 13 One-shot&few-shot 14 System,contextual and role prompting 17 System prompting 18 Role
3、 prompting 21 Contextual prompting 23Table of contents Step-back prompting 25 Chain of Thought(CoT)29 Self-consistency 32 Tree of Thoughts(ToT)36 ReAct(reason&act)37 Automatic Prompt Engineering 40 Code prompting 42 Prompts for writing code 42 Prompts for explaining code 44 Prompts for translating c
4、ode 46 Prompts for debugging and reviewing code 48 What about multimodal prompting?54Best Practices 54 Provide examples 54 Design with simplicity 55Bespecificabouttheoutput 56 Use Instructions over Constraints 56 Control the max token length 58 Use variables in prompts 58 Experiment with input forma
5、ts and writing styles 59Forfew-shotpromptingwithclassificationtasks,mixuptheclasses 59 Adapt to model updates 60 Experiment with output formats 60 Experiment together with other prompt engineers 61 CoT Best practices 61Documentthevariouspromptattempts 62Summary 63Endnotes 65Prompt EngineeringSeptemb
6、er 20246IntroductionWhen thinking about a large language model input and output,a text prompt(sometimes accompanied by other modalities such as image prompts)is the input the model uses topredictaspecificoutput.Youdontneedtobeadatascientistoramachinelearningengineereveryonecanwriteaprompt.However,cr