Prompt Engineering_v7信息安全资料 .docxVIP

  • 0
  • 0
  • 约8.43万字
  • 约 71页
  • 2026-02-10 发布于浙江
  • 举报

Prompt

EngineeringAuthor:LeeBoonstra

PromptEngineering

Acknowledgements

Contentcontributors

MichaelSherman

YuanCao

ErickArmbrust

AnantNawalgaria

AntonioGulli

SimoneCammel

CuratorsandEditors

AntonioGulli

AnantNawalgaria

GraceMollison

TechnicalWriter

JoeyHaymaker

Designer

MichaelLanning

February2025 2

Tableofcontents

Introduction 6

Promptengineering 7

LLMoutputconfiguration 8

Outputlength 8

Samplingcontrols 9

Temperature 9

Top-Kandtop-P 10

Puttingitalltogether 11

Promptingtechniques 13

Generalprompting/zeroshot 13

One-shotfew-shot 15

System,contextualandroleprompting 18

Systemprompting 19

Roleprompting 21

Contextualprompting 23

Step-backprompting 25

ChainofThought(CoT) 29

Self-consistency 32

TreeofThoughts(ToT) 36

ReAct(reasonact) 37

AutomaticPromptEngineering 40

Codeprompting 42

Promptsforwritingcode 42

Promptsforexplainingcode 44

Promptsfortranslatingcode 46

Promptsfordebuggingandreviewingcode 48

Whataboutmultimodalprompting? 54

BestPractices 54

Provideexamples 54

Designwithsimplicity 55

Bespecificabouttheoutput 56

UseInstructionsoverConstraints 56

Controlthemaxtokenlength 58

Usevariablesinprompts 58

Experimentwithinputformatsandwritingstyles 59

Forfew-shotpromptingwithclassificationtasks,mixuptheclasses 59

Adapttomodelupdates 60

Experimentwithoutputformats 60

JSONRepair 61

WorkingwithSchemas 62

Experimenttogetherwithotherpromptengineers 63

CoTBestpractices 64

Documentthevariouspromptattempts 64

Summary 66

Endnotes 68

PromptEngineering

Youdon’tneedtobeadatascientistoramachinelearningengineer–everyonecanwriteaprompt.

Introduction

Whenthinkingaboutalargelanguagemodelinputandoutput,atextprompt(sometimesaccompaniedbyothermodalitiessuchasimageprompts)istheinputthemodeluses

topredictaspecificoutput.Youdon’tneedtobeadatascientistoramachinelearningengineer–everyonecanwriteapromp

文档评论(0)

1亿VIP精品文档

相关文档