Guidance vs Dspy
Guidance and Dspy are both popular ml inference & agents tools. This page compares their internal architecture, technology stack, data flow patterns, and system behavior — based on automated structural analysis of their source code. They share 2 technologies including pydantic, openai.
guidance-ai/guidance
stanfordnlp/dspy
Technology Stack
Shared Technologies
Only in Guidance
llguidance numpy transformers llama-cpp-python jupyter-widgets svelteOnly in Dspy
litellm json_repair tenacity diskcache pytest asyncerArchitecture Layers
Guidance (4 layers)
Dspy (5 layers)
Data Flow
Guidance (5 stages)
- Function Definition
- Grammar Compilation
- Token Generation
- Constraint Enforcement
- State Update
Dspy (6 stages)
- Signature Definition
- Module Creation
- Adapter Processing
- LM Execution
- Response Parsing
- Optimization
System Behavior
| Dimension | Guidance | Dspy |
|---|---|---|
| Data Pools | 3 | 2 |
| Feedback Loops | 3 | 3 |
| Delays | 3 | 3 |
| Control Points | 4 | 4 |
Code Patterns
Unique to Guidance
ast pattern backend adapter constraint compilation widget messagingUnique to Dspy
adapter pattern type system signature-based programming composable modules optimization frameworkWhen to Choose
Choose Guidance when you need
- Unique tech: llguidance, numpy, transformers
- Loosely coupled, more modular
Choose Dspy when you need
- Unique tech: litellm, json_repair, tenacity
- Tighter integration between components
Frequently Asked Questions
What are the main differences between Guidance and Dspy?
Guidance has 10 components with a connectivity ratio of 0.8, while Dspy has 10 components with a ratio of 2.1. They share 2 technologies but differ in 12 others.
Should I use Guidance or Dspy?
Choose Guidance if you need: Unique tech: llguidance, numpy, transformers; Loosely coupled, more modular. Choose Dspy if you need: Unique tech: litellm, json_repair, tenacity; Tighter integration between components.
How does the architecture of Guidance compare to Dspy?
Guidance is organized into 4 architecture layers with a 5-stage data pipeline. Dspy has 5 layers with a 6-stage pipeline.
What technology does Guidance use that Dspy doesn't?
Guidance uniquely uses: llguidance, numpy, transformers, llama-cpp-python, jupyter-widgets. Dspy uniquely uses: litellm, json_repair, tenacity, diskcache, pytest.
Explore the interactive analysis
See the full architecture maps, code patterns, and dependency graphs.
Guidance DspyRelated ML Inference & Agents Comparisons
Compared on March 25, 2026 by CodeSea. Written by Karolina Sarna.