Skip to content

Commit 2d2554f

Browse files
committed
README updates
1 parent 81a8798 commit 2d2554f

File tree

1 file changed

+7
-35
lines changed

1 file changed

+7
-35
lines changed

README.md

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ For complex tasks, **DSPy** can routinely teach powerful models like `GPT-3.5` a
2525
If you want to see **DSPy** in action, **[open our intro tutorial notebook](intro.ipynb)**.
2626

2727

28-
### a. Table of Contents
28+
### Table of Contents
2929

3030

3131
1. **[Installation](#1-installation)**
@@ -36,7 +36,7 @@ If you want to see **DSPy** in action, **[open our intro tutorial notebook](intr
3636

3737

3838

39-
### b. Analogy to Neural Networks
39+
### Analogy to Neural Networks
4040

4141
If you're looking for an analogy, think of this one. When we build neural networks, we don't write manual _for-loops_ over lists of _hand-tuned_ floats. Instead, you might use a framework like [PyTorch](https://pytorch.org/) to compose declarative layers (e.g., `Convolution` or `Dropout`) and then use optimizers (e.g., SGD or Adam) to learn the parameters of the network.
4242

@@ -200,8 +200,6 @@ Or open it directly in free Google Colab: [<img align="center" src="https://cola
200200
<details>
201201
<summary><h3 style="display: inline">Intro Tutorial [coming soon]</h3></summary>
202202

203-
----
204-
205203
**[Intro-01] Getting Started: High Quality Pipelined Prompts with Minimal Effort**
206204

207205
**[Intro-02] Using DSPy For Your Own Task: Building Blocks**
@@ -212,15 +210,11 @@ Or open it directly in free Google Colab: [<img align="center" src="https://cola
212210

213211
</details>
214212

215-
----
216-
217213

218214
###
219215
<details>
220216
<summary><h3 style="display: inline">Advanced Demos [coming soon]</h3></summary>
221217

222-
----
223-
224218

225219
**[Advanced-01] Long-Form QA & Programmatic Evaluation.**
226220

@@ -237,15 +231,11 @@ Or open it directly in free Google Colab: [<img align="center" src="https://cola
237231

238232
</details>
239233

240-
----
241-
242234

243235
###
244236
<details>
245237
<summary><h3 style="display: inline">Module Reference [coming soon]</h3></summary>
246238

247-
----
248-
249239

250240
#### Language Model Clients
251241

@@ -272,8 +262,9 @@ Or open it directly in free Google Colab: [<img align="center" src="https://cola
272262
- `dspy.Retrieve`
273263
- `dspy.ChainOfThought`
274264
- `dspy.SelfConsistency` [coming soon; use functional `dspy.majority` now]
275-
- `dspy.Reflection` [coming soon]
276265
- `dspy.MultiChainReasoning` [coming soon]
266+
- `dspy.SelfCritique` [coming soon]
267+
- `dspy.SelfRevision` [coming soon]
277268

278269

279270
#### Teleprompters
@@ -285,8 +276,6 @@ Or open it directly in free Google Colab: [<img align="center" src="https://cola
285276

286277
</details>
287278

288-
----
289-
290279

291280

292281
## 5) FAQ: Is DSPy right for me?
@@ -300,8 +289,6 @@ If you're a NLP/AI researcher (or a practitioner exploring new pipelines or new
300289
<details>
301290
<summary><h4 style="display: inline">[5.a] DSPy vs. thin wrappers around prompts (OpenAI API, MiniChain, basic templating, etc.)</h4></summary>
302291

303-
----
304-
305292
In other words: _Why can't I just write my prompts directly as string templates?_ Well, for extremely simple settings, this _might_ work just fine. (If you're familiar with neural networks, this is like expressing a tiny two-layer NN as a Python for-loop. It kinda works.)
306293

307294
However, when you need higher quality (or manageable cost), then you need to iteratively explore multi-stage decomposition, improved prompting, data bootstrapping, careful finetuning, retrieval augmentation, and/or using smaller (or cheaper, or local) models. The true expressive power of building with foundation models lies in the interactions between these pieces. But every time you change one piece, you likely break (or weaken) multiple other components.
@@ -312,60 +299,45 @@ Oh, and you wouldn't need to maintain long, brittle, model-specific strings at t
312299

313300
</details>
314301

315-
----
316-
317302
####
318303
<details>
319304
<summary><h4 style="display: inline">[5.b] DSPy vs. application development libraries like LangChain, LlamaIndex</h4></summary>
320305

321-
----
322306

323307
> _Note: If you use LangChain as a thin wrapper around your own prompt strings, refer to answer [5.a] instead._
324308
325309

326310
LangChain and LlamaIndex are popular libraries that target high-level application development with LMs. They offer many _batteries-included_, pre-built application modules that plug in with your data or configuration. In practice, many usecases genuinely _don't need_ any special components indeed. If you'd be happy to use someone's generic, off-the-shelf prompt for question answering over PDFs or standard text-to-SQL as long as it's easy to set up on your data, then you will probably find a very rich ecosystem in these libraries.
327311

328-
329312
Unlike these libraries, **DSPy** doesn't internally contain hand-crafted prompts that target specific applications you can build. Instead, **DSPy** introduces a very small set of much more powerful and general-purpose modules _that can learn to prompt (or finetune) your LM within your pipeline on your data_.
330313

331314
**DSPy** offers a whole different degree of modularity: when you change your data, make tweaks to your program's control flow, or change your target LM, the **DSPy compiler** can map your program into a new set of prompts (or finetunes) that are optimized specifically for this pipeline. Because of this, you may find that **DSPy** obtains the highest quality for your task, with the least effort, provided you're willing to implement (or extend) your own short program.
332315

333-
> If you're familiar with neural networks, this is like the difference between PyTorch (i.e., representing **DSPy**) and HuggingFace Transformers (i.e., representing the higher-level libraries). If you simply want to use off-the-shelf `BERT-base-uncased` or `GPT2-large` or apply minimal finetuning to them, HF Transformers makes it very straightforward. If, however, you're looking to build your own architecture (or extend an existing one significantly), you have to quickly drop down into something much more modular like PyTorch. Luckily, HF Transformers _is_ implemented in backends like PyTorch. We are similarly excited about high-level wrapper around **DSPy** for common applications. If this is implemented using **DSPy**, your high-level application can also adapt significantly to your data in a way that static prompt chains won't. Please [open an issue](https://github.com/stanfordnlp/dspy/issues/new) if this is something you want to help with.
334-
335-
316+
If you're familiar with neural networks:
317+
> This is like the difference between PyTorch (i.e., representing **DSPy**) and HuggingFace Transformers (i.e., representing the higher-level libraries). If you simply want to use off-the-shelf `BERT-base-uncased` or `GPT2-large` or apply minimal finetuning to them, HF Transformers makes it very straightforward. If, however, you're looking to build your own architecture (or extend an existing one significantly), you have to quickly drop down into something much more modular like PyTorch. Luckily, HF Transformers _is_ implemented in backends like PyTorch. We are similarly excited about high-level wrapper around **DSPy** for common applications. If this is implemented using **DSPy**, your high-level application can also adapt significantly to your data in a way that static prompt chains won't. Please [open an issue](https://github.com/stanfordnlp/dspy/issues/new) if this is something you want to help with.
336318
</details>
337319
338-
----
339-
340320

341321
####
342322
<details>
343323
<summary><h4 style="display: inline">[5.c] DSPy vs. generation control libraries like Guidance, LLMQL, RELM, Outlines</h4></summary>
344324

345-
----
346-
347325

348326
Guidance, LLMQL, RELM, and Outlines are all exciting new libraries for controlling the individual completions of LMs, e.g., if you want to enforce JSON output schema or constrain sampling to a particular regular expression.
349327

350328
This is very useful in many settings, but it's generally focused on low-level, structured control of a single LM call. It doesn't help ensure the JSON (or structured output) you get is going to be correct or useful for your task.
351329

352330
In contrast, **DSPy** automatically optimizes the prompts in your programs to align them with various task needs, which may also include producing valid structured ouputs. That said, we are considering allowing **Signatures** in **DSPy** to express regex-like constraints that are implemented by these libraries.
353-
354-
355-
356331
</details>
357332

358333

359-
----
360-
361-
362334

363335

364336
## Contributors & Acknowledgements
365337

366338
**DSPy** is led by **Omar Khattab** at Stanford NLP with **Chris Potts** and **Matei Zaharia**.
367339

368-
Key contributors and team members include **Aranv Singhvi**, **Paridhi Maheshwari**, **Keshav Santhanam**, **Sri Vardhamanan**, **Eric Zhang**, **Hanna Moazam**, and **Thomas Joshi**.
340+
Key contributors and team members include **Arnav Singhvi**, **Paridhi Maheshwari**, **Keshav Santhanam**, **Sri Vardhamanan**, **Eric Zhang**, **Hanna Moazam**, and **Thomas Joshi**.
369341

370342
**DSPy** includes important contributions from **Igor Kotenkov** and reflects discussions with **Lisa Li**, **David Hall**, **Ashwin Paranjape**, **Heather Miller**, **Percy Liang**, and many others.
371343

0 commit comments

Comments
 (0)