A baseline model is an initial application whose performance can be evaluated as a reference for deciding whether later changes improve it. It may be sufficient on its own; otherwise, its results help guide optimization. section 1.6 section 8.3
A practical baseline workflow:
- Build a simple application, then evaluate its performance. section 1.6
- Use the evaluation to judge the task and decide whether to optimize the application. section 1.6
Conversation summarizer
A baseline summarizer uses a language model, a signature with dialog input and summary output, and a Predict module. Its generated summary can be compared with a ground-truth summary. section 8.3
Listing 8.4 Creating and executing a baseline program
import os
os.environ['OPENAI_API_KEY'] = OPENAI_API_KEY
class SummarySignature(dspy.Signature): #1
dialog: str = dspy.InputField()
summary: str = dspy.OutputField()
lm = dspy.LM('openai/gpt-4.1-nano', cache=False) #2
dspy.configure(lm=lm)
prog_summarizer = dspy.Predict(SummarySignature) #3
print(train_examples[0]['summary']) #4
pred = prog_summarizer(dialog=summarizer_train_data[0]['dialog']) #5
print(pred) #6
See the Python listing that creates and runs the baseline summarizer. section 8.3


















