passdrill
AI & LLM Engineering · Prompt Engineering · Card 047/049 easy

Khattab et al. (2023), "DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines," argue that hand-written free-form prompt templates discovered by trial and error make LLM pipelines brittle and hard to reuse across models. What does DSPy have the programmer do instead, and what does the framework itself handle automatically?

  1. The programmer writes the exact final prompt wording as before, and DSPy's only contribution is translating that wording into several different natural languages automatically
  2. The programmer must manually rewrite every prompt for every new base model DSPy is pointed at, since the framework provides no automatic prompt generation or tuning of its own
  3. The programmer specifies only the desired output token count, and DSPy pads or truncates the model's natural response to match that fixed length regardless of prompt wording
  4. The programmer declares a "signature" describing, in a structured and model-agnostic way, what inputs a step needs and what outputs it should produce, and composes these signatures into modules forming a pipeline; DSPy's own compiler then automatically generates and tunes the actual natural-language prompt text, and can select or generate few-shot demonstrations, needed to make each declared step work
Next card → Shuffle