liveBook · Manning

Optimal prompt

As explained in Building LLM Applications with DSPy

A prompt selected as the best-performing configuration for a particular language-model call under an evaluation criterion.

An optimal prompt is one selected for strong performance on a particular language-model call. Finding one by trial and error is difficult: the search space is large, and small test sets or limited exploration can make results unreliable. section 1.2.3

A practical route is to build and evaluate a baseline application, then use DSPy to discover prompts for its language-model calls. Once the application performs satisfactorily, it can move into production. section 1.6

Figure 1.7 DSPy supports automatically optimizing the prompts used by an application.
figure

Shows DSPy automatically optimizing the prompts used by an application. section 1.6

How Building LLM Applications with DSPy covers it

How deep it goes
Traces prompt discovery from baseline evaluation through application optimization and production.
Examples
Uses conversation summarization as a baseline application and contrasts automated optimization with trial-and-error prompting.
What it assumes
Assumes a baseline application can be built and evaluated before prompt optimization.
What you can do after
Apply it via DSPy to optimize application prompts after evaluating a baseline, then move satisfactory applications into production.
How it connects
Connects prompt engineering with DSPy, language-model applications, and evaluation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building LLM Applications with DSPy. The section links point to the parts of the book it draws on.