Prompt Engineering for LLMs

by John Berryman, Albert Ziegler

Artificial Intelligence

Book Details

Book Title

Prompt Engineering for LLMs

Author

John Berryman, Albert Ziegler

Publisher

O’Reilly Media

Publication Date

2024

ISBN

9781098156152

Number of Pages

282

Language

English

Format

PDF

File Size

12.1MB

Subject

Cybernetics:Artificial Intelligence

Table of Contents

  • Copyright
  • Table of Contents
  • Preface
  • Part I. Foundations
  • Chapter 1. Introduction to Prompt Engineering
  • LLMs Are Magic
  • Language Models: How Did We Get Here?
  • Prompt Engineering
  • Conclusion
  • Chapter 2. Understanding LLMs
  • What Are LLMs?
  • How LLMs See the World
  • One Token at a Time
  • Temperature and Probabilities
  • The Transformer Architecture
  • Conclusion
  • Chapter 3. Moving to Chat
  • Reinforcement Learning from Human Feedback
  • Moving from Instruct to Chat
  • The Changing API
  • Prompt Engineering as Playwriting
  • Conclusion
  • Chapter 4. Designing LLM Applications
  • The Anatomy of the Loop
  • Zooming In to the Feedforward Pass
  • Evaluating LLM Application Quality
  • Conclusion
  • Part II. Core Techniques
  • Chapter 5. Prompt Content
  • Sources of Content
  • Static Content
  • Dynamic Content
  • Conclusion
  • Chapter 6. Assembling the Prompt
  • Anatomy of the Ideal Prompt
  • What Kind of Document?
  • Formatting Snippets
  • Elastic Snippets
  • Relationships Among Prompt Elements
  • Putting It All Together
  • Conclusion
  • Chapter 7. Taming the Model
  • Anatomy of the Ideal Completion
  • Beyond the Text: Logprobs
  • Choosing the Model
  • Conclusion
  • Part III. An Expert of the Craft
  • Chapter 8. Conversational Agency
  • Tool Usage
  • Reasoning
  • Context for Task-Based Interactions
  • Building a Conversational Agent
  • Conclusion
  • Chapter 9. LLM Workflows
  • Would a Conversational Agent Suffice?
  • Basic LLM Workflows
  • Advanced LLM Workflows
  • Conclusion
  • Chapter 10. Evaluating LLM Applications
  • What Are We Even Testing?
  • Offline Evaluation
  • Online Evaluation
  • Conclusion
  • Chapter 11. Looking Ahead
  • Multimodality
  • Conclusion
  • Index
  • About the Authors
  • Colophon