gear / dsp

The Demonstrate-Search-Predict Framework: Composing retrieval and language models for knowledge-intensive NLP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🎓𝗗𝗦𝗣: Demonstrate–Search–Predict

DSP is a framework for composing retrieval models (RMs) and language models (LMs) into powerful pipelines that tackle knowledge-intensive tasks.

You write a DSP program in a few lines of code. The program specifies an NLP system by describing a pipeline of interactions between RMs and LMs.

In DSP, you don't hard-code few-shot prompts. Instead, the DSP runtime annotates the examples for your pipeline, starting from a few end-task examples (e.g., question and final answer) that are pipeline-agnostic.

You can get an overview via our Twitter threads:

And read more in the paper:

Installation

pip install dsp-ml

🏃 Getting Started

Our intro notebook provides examples of five "multi-hop" question answering programs of increasing complexity written in DSP.

You can open the intro notebook in Google Colab. You don't even need an API key to get started with it.

Once you go through the notebook, you'll be ready to create your own DSP pipelines!

[NEW!] DSP Compiler

Our compiler notebook introduces the new experimental compiler, which can optimize DSP programs automatically for (much) cheaper execution.

You can open the compiler notebook in Google Colab. You don't even need an API key to get started with it.

✍️ Reference

If you use DSP in a research paper, please cite our work as follows:

@article{khattab2022demonstrate,
  title={Demonstrate-Search-Predict: Composing Retrieval and Language Models for Knowledge-Intensive {NLP}},
  author={Khattab, Omar and Santhanam, Keshav and Li, Xiang Lisa and Hall, David and Liang, Percy and Potts, Christopher and Zaharia, Matei},
  journal={arXiv preprint arXiv:2212.14024},
  year={2022}
}

About

The Demonstrate-Search-Predict Framework: Composing retrieval and language models for knowledge-intensive NLP

License:MIT License


Languages

Language:Jupyter Notebook 83.4%Language:Python 16.6%