HARNESS ATLASAn Astra × QZ project ↗
← THE CORPUS

RESEARCH NOTE 10 / 2023

DSPy

DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines

Omar Khattab, Arnav Singhvi, Paridhi Maheshwari, Zhiyuan Zhang, Keshav Santhanam, Sri Vardhamanan, Saiful Haq, Ashutosh Sharma, Thomas T. Joshi, Hanna Moazam, Heather Miller, Matei Zaharia, Christopher Potts

arXiv:2310.03714v1 · submitted 2023-10-05

Corpus interpretation

The idea in one paragraph.

Stop hand-writing prompts. Express an LM pipeline as declarative modules with typed signatures, then compile it against a metric, letting an optimiser choose the prompts.

THE MACHINERY

01

Signatures

Declare what a step does as typed input and output fields, not as prose.

02

Modules

Composable, parameterised strategies (Predict, ChainOfThought, ReAct) over a signature.

03

Teleprompters / optimisers

Compile a program by bootstrapping demonstrations and searching prompts against a metric.

04

Bootstrapped demonstrations

Generate few-shot examples from the program's own successful traces.

What the paper reports.

Findings are reproduced as concise corpus summaries, with their original confidence labels. They are not independent replications.

Paper reports

Within minutes of compiling, a few lines of DSPy let GPT-3.5 and llama2-13b-chat self-bootstrap pipelines that beat standard few-shot prompting by over 25% and 65% respectively.

Inspect a source excerpt
a few lines of DSPy allow GPT-3.5 and llama2-13b-chat to self-bootstrap pipelines that outperform standard few-shot prompting (generally by over…
Read the passage in context on arXiv ↗
Paper reports

They also beat pipelines with expert-created demonstrations by 5-46% and 16-40% respectively.

Paper reports

Programs compiled to small open models (770M T5, llama2-13b-chat) are competitive with expert-written prompt chains for GPT-3.5.

LIMITATIONS / CORPUS READING

Where to keep your judgement.

  • Requires a metric and a train set - unavailable for most open-ended agent work.
  • Optimises the prompt only; tools, memory, and control flow stay fixed.
Atlas interpretation

Why it belongs in this atlas.

The first rung where the agent writes its own instructions. The talk's framing is exact: this gives you CRUD over the system prompt. Note the ceiling - only the prompt moves.

Read the connections.