HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
stanfordnlp
dspy
Python2023–2026
stanfordnlp / dspy

dspy

DSPy: The framework for programming—not prompting—language models

25Distinct people
26Mentions
0Explicit recommenders
39KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

DSPy: The framework for programming—not prompting—language models

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year26 dated mentions

Observed mentions: 2023-08-25 06:44:01 UTC to 2026-09-28 17:37:56 UTC.

051015202023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 5 mentions; 3 submissions, 2 comments20232024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 18 mentions; 2 submissions, 16 comments20242025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC532
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC18216
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC000
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC303

What Hacker News says

26 sources
>People really don't understand how much better LLM swarms get with more agents. I never hit a point of diminishing returns on text quality Could you elaborate please ? One use for swarms is to use multiple agents/prompts in place of one single agent with one long prompt in order to increase performance by splitting one big task into many. It is very time consuming though, as it requires experimenting to determine how best to divide one task into subtasks, including writing code to parse and sanitize each task output and plug it back into the rest of the agent graph. Dspy [1] seems to target this problem space but last time I checked it only focused on single prompt optimization (by selecting which few shots examples lead to the best prompt performance for instance), but even though I have seen papers on the subject, I have yet to find a
Read the rest
framework that tackles the problem of agent graph optimization although research on this topic has been done [2][3][4] [1]DSPy: The framework for programming—not prompting—foundation models: https://github.com/stanfordnlp/dspy [2]TextGrad: Automatic 'Differentiation' via Text -- using large language models to backpropagate textual gradients: https://github.com/zou-group/textgrad [3]What's the Magic Word? A Control Theory of LLM Prompting: https://arxiv.org/abs/2310.04444 [4]Language Agents as Optimizable Graphs: https://arxiv.org/abs/2402.16823
In Swarm, a new agent framework by OpenAI
At least some of it comes from "hype" too. The author of Dspy (the writer) (https://github.com/stanfordnlp/dspy) should know this, given that Dspy is nothing more than fancy prompts optimizing prompts to be fancier according to prompt chains described in papers (i.e. Chain of thought, Tree of thought, etc). Textgrad (https://github.com/zou-group/textgrad) is an even worse example of this, as it makes people think that it's not just a prompt optimizing another prompt Dspy has 17k stars, meanwhile PyReft (https://github.com/stanfordnlp/pyreft) isn't even at 1200 yet and it has Christopher Manning (head of AI at stanford) working on it (see their paper: https://arxiv.org/abs/2404.03592). Sometimes what the world deems "impactful" in the short-medium term is wrong. Think long term. PyReft is likely the beginning of an explosion in demand for
Read the rest
ultra parameter efficient techniques, while Dspy will likely fade into obscurity over time. I also know that the folks writing better samplers/optimizers for LLMs get almost no love/credit relative to the outsized impact they have on the field. A new sampler potentially improves EVERY LLM EVER! Folks like Clara Meister or the authors of the min_p paper preprint have had far larger impacts on the field than their citation counts might suggest, based on the fact that typiciality or min_p sampling is now considered generally superior to top_p/top_k (OpenAI, Anthropic, Gemini, et al still use top_p/top_k) and min_p/typicality are implemented by every open source LLM inference engine (i.e. huggingface, vllm, sglang, etc)
In On Impactful AI Research
Is AdalFlow also focused on automated prompt optimization or is it broader in scope? It looks like there are also some features around evaluation. I'd be really interested to see a comparison between AdalFlow, DSPy [0], LangChain [1] and magentic [2] (package I've created, narrower in scope). [0] https://github.com/stanfordnlp/dspy [1] https://github.com/langchain-ai/langchain [2] https://github.com/jackmpcollins/magentic
In Show HN: AdalFlow: The library to build and auto-optimize any LLM task pipeline

Thoughts on DSPy

Been tinkering with DSPy and I thought I will share my thoughts. Let’s start by setting some context. Let’s say you are building a RAG(Retrieval Augmented Generation). The typical approach is to: 1. Chunk the documents 2. Insert into a vector store 3. Given a query, retrieve the context(s) by kNN search 4. Give the context to a language model for answer generation. This gives a great starting point but obviously this does not guarantee 100% accuracy from first iteration. Now, the typical approach is to iterate and make it better. Generally this involves tweaking: 1. Chunking and insertion strategy 2. Retrieval strategy 3. Prompt engineering After some trial n error, you arrive at the most optimal combination hyper parameter settings that gives you the best accuracy. After a few days, you realize the RAG’s accuracy has regressed. Now, ag
Read the rest
ain you are back to square one. This is a monolithic and unsustainable way to optimize. This is what DSPy tries to solve. DSPy is primarily two things: 1. Separate programming from prompt engineering using signatures and give greater control to program language models using traditional programming techniques. 2. Incorporate best practice prompting techniques in the framework to optimize the LMs response. With DSPy, you can implement and iterate on improving your app additional tools at your disposal. First, you can separate your prompts and write a signature instead. A signature looks like this “context, question -> answer”. This signature gets “compiled” into an actual prompt. In addition, you can also break this problem into 2 modules, 1. Retrieval module 2. Generation module Modules are classes that that take a signature with inputs and generate an output and you can start iterating on each module separately. Now, with the retrieval module, you can do a an iterative query generation & context retrieval before passing it to the generation module. This is a technique used to improve RAG performance by building up additional context by incrementally asking questions based on retrieved context and using the generate questions to retrieve additional context. With DSPy, this becomes straightforward because, DSPy exposes constructs like - Settings where you can define the number of hops - Signature like “context, question -> query” that gets compiled into a proper prompt - Optimizers to incrementally append retrieved contexts to the prompt automatically by the framework Coming to the answer generation module, it’s not atypical to define a set of rules while prompt engineering. DSPy solves this using run time assertions with backtracking where in, you can define an assertion instead of a rule and DSPy with automatically backtrack and improve the prompt if the assertion fails. DSPy will automatically back track and prefix the prompt to include additional rules to optimize the prompt further. Obviously, you can do this with prompt engineering & program composition. But, where DSPy really shines is when you are optimizing a large pipeline that is prone to brittleness with prompt engineering techniques. DSPy helps you compose the pipeline into isolated set of modules & lets you apply best practice prompting techniques without having to think much about the prompt. There are two implementations of the framework today. - Python - https://github.com/stanfordnlp/dspy - Typescript - https://github.com/dosco/llm-client/ One specific feature I would like to see is to expose the prompt templates as config and give greater control to the developers in incorporating our “versions” of templates for CoT, Fewshots etc. This will also help with the adoption of DSPy to languages other than English. Finally, I was able to understand what DSPy is adding to its prompts and what sort of optimizations it is doing by using Langtrace, an open source tracing tool i am building that can be setup with just 2 lines of code. https://github.com/Scale3-Labs/langtrace
1 points · Open discussion
I’ve observed that Pydantic - which we’ve used for years in our API stack - has become very popular in LLM applications, for its type-adjacent features. It serves as a foundational technology for prompting libraries like [DSPy](https://github.com/stanfordnlp/dspy) which are abstracting “up the stack” of LLM apps. (some opinions there) Operating AI apps reveals a big challenge, in that debugging probabilistic code paths requires more than the usual introspective abilities, and in an environment where function calls can have very real monetary impact we have to be able to see what’s happening in the runtime. See LangChain’s hosted solution (can’t recall the name) that allows an operator to see prompts and responses “on the wire”. (It just occurred to me that Langchain and Pydantic have a lot in common here, in approach.) Having a coupling b
Read the rest
etween Pydantic - which is *just about* the data layer itself - and an observability tool seems very interesting to me, and having this come from the folks who built it does not seem unreasonable. WRT open source and monetization, I would be lying if I said I wasn’t a little worried - given the recent few months - but I am choosing to see this in a positive light, given this team’s “believability weight” (to overuse Dalio) and history of delivering solid and really useful tooling.
In Pydantic Logfire
I recommend reviewing Stanford's dspy library - great examples of few-shot learning that works by generating and tuning prompts for LLMs and even distilling instruction following tasks to smaller models like T5. Second, as others mentioned, using QLoRA for supervised fine-tuning followed by DPO/KTO for preference optimization. This strategy placed Huggingface's Zephyr and IBM's Neural Chat on leaderboards for 7B parameter models. I also recommend reviewing the Unsloth library which has excellent accelerated examples of using these methods, along with the axolotl library. Lastly, skypilot and Modal both have excellent examples that showcase using axolotl to efficiently finetune models on cloud GPUs. [1] https://github.com/stanfordnlp/dspy [2] https://github.com/unslothai/unsloth [3] https://github.com/OpenAccess-AI-Collective/axolotl [4] h
Read the rest
In Ask HN: Most efficient way to fine-tune an LLM in 2024?

Showing the 15 most recent of 26 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.