top of page

DSPy: Programming - not Prompting the LLMs

Writer's picture: Dennis KuriakoseDennis Kuriakose



Stanford researchers have developed and refined a workflow and prompt optimization framework called DSPy. DSPy simplifies prompt writing and model fine-tuning by introducing a modular structure, creating a layer of abstraction between large language models (LLMs) and end-user applications. This marks a significant advancement over retrieval-augmented generation (RAG) frameworks like Langchain, which require developers to manually craft and continually refine prompts with each new model release.   


In this MLOps.community YouTube podcast, Omar Khattab - the creator of DSPy & Stanford PhD scholar, explains why DSPy is an important shift in Information Retrieval (IR)


Additional resources


Adding depth to DSPy Programs: https://www.youtube.com/watch?v=0c7Ksd6BG88

DSPy documentation: https://dspy-docs.vercel.app/

Recipes for building DSPy pipelines: Weaviate Code repository


Highlights


  • Shift from fine-tuning to prompting in retrieval-based NLP: Omar highlights the transition from fine-tuning retriever and language models together to prompt-based methods for conditioning LLMs on retrieval, citing their work on an open-source RAG implementation in 2022.

  • Late interaction as a more efficient and accurate retrieval approach: Omar emphasizes the limitations of encoding entire documents as vectors and introduces late interaction, which represents documents as matrices of smaller vectors, leading to data efficiency gains and improved quality.

  • Emphasis on system architecture and pipeline construction: Omar stresses the importance of building modular, reusable modules that can be combined into complex pipelines for specific tasks, rather than focusing solely on specific models or prompting techniques.

  • DSP as an open-source framework for programming pipelines: Omar contrasts DSP with other libraries, highlighting DSP’s focus on task-independent and adaptive modules with natural language signatures.

  • Automatic compilation and optimization in DSP: the DSP compiler that optimizes user-defined pipelines based on data, models, and metrics, automatically generating prompts and fine-tuning models, enabling seamless transitions between different prompting techniques and models.

  • Teleprompters for iterative development: Omar discusses DSP’s use of teleprompters to automatically optimize modules using techniques like few-shot bootstrapping and fine-tuning, allowing for flexible experimentation and exploration of different approaches.

  • Agents as programs within DSP: Omar views agents as just another type of program that can be constructed within DSP, emphasizing the importance of a structured approach for agent development, utilizing DSP’s modularity and optimization capabilities.

6 views0 comments

Recent Posts

See All

Comments


Follow

  • X
  • LinkedIn

©2024 Collationist.

bottom of page