chapter one

1 Introduction to prompt programming and DSPy

 

This chapter covers

  • The concept of prompt programming
  • The DSPy framework
  • A comparison of prompt programming to prompt engineering
  • The limitations of prompt engineering

The initial phase of building LLM based applications has an almost intoxicating effect. You can write a prompt asking to summarize an article and get it done in an instant. However, when inspecting the summary it might miss the most important fact. So you try to change the prompt and check again. This time it misses a different fact. Does this hit-and-miss process sound familiar?

LMs can be sensitive to the specific prompts we give them; even slightly different prompts can elicit different responses, and some may be much more effective than others. So, when developing LM-based applications, we often have to test and evaluate many variations before we can identify high-qualityrompts. This is typically a trial-and-error process, and usually difficult and time-consuming.

1.1 What makes prompt programming different?

1.1.1 The goals of prompt programming

1.1.2 Prompt programming vs prompt engineering

1.2 Introducing DSPy

1.2.1 DSPy code example

1.2.2 Advantages to working with code

1.2.3 A methodical search for optimal prompts

1.2.4 The bitter lesson

1.2.5 A data-driven approach to tuning prompts

1.2.6 Adapting to change

1.2.7 Making the best use of LMs

1.3 Working with complex LM-based applications in DSPy

1.4 Where is DSPy useful?

1.5 Building LLM applications through baselines and optimization

1.6 Summary