krypticmouse/DSRs
Performance centered DSPy rewrite to(not port) Rust
What it solves
DSRs provides a high-performance, type-safe alternative to the DSPy framework for building LM-powered applications. It replaces manual prompt engineering with a programmatic approach to defining LM pipelines, allowing developers to optimize prompts and pipeline structures automatically using training data and metrics.
How it works
Instead of writing static prompts, developers define Signatures (input/output specifications) and Modules (composable pipeline components). The framework uses Predictors to handle the interaction with Language Models (supporting both API-based and local backends like Ollama).
To improve performance, DSRs includes several Optimizers (such as COPRO, MIPROv2, and GEPA) that iteratively refine prompts or generate new ones based on evaluation metrics and training examples, effectively "compiling" the pipeline for better accuracy.
Who it’s for
Rust developers building LLM applications who need the performance, memory safety, and concurrency of Rust, as well as those who want to move away from manual prompt tuning toward an automated, data-driven optimization process.
Highlights
- Automatic Prompt Optimization: Includes multiple optimizers (COPRO, MIPROv2, GEPA) to refine instructions based on data.
- Type-Safe Signatures: Uses Rust's type system to define strict input and output specifications for LM interactions.
- Flexible Backends: Supports various LM providers, including OpenAI and local models via vLLM or Ollama.
- Built-in Evaluation: Provides a framework for defining metrics and running evaluations over test sets.
- Chain of Thought (CoT): Built-in support for adding reasoning steps to any signature.
- Execution Tracing: A tracing system that captures dataflow as a Directed Acyclic Graph (DAG) for debugging and analysis.
Related
- Project
- Project
- Project
- Project