Guidance vs Dspy
Guidance and Dspy are both ml inference & agents tools. The structural differences are in the side-by-side below. The sharper question is what each one assumes you'll never violate: CodeSea found 12 unvalidated assumptions in Guidance and 12 in Dspy. They share 1 technologies including pydantic.
guidance-ai/guidance
stanfordnlp/dspy
Hidden Assumptions
What each codebase relies on but never validates. The category mix shows where each is most exposed when the world it runs in changes.
Guidance (12)
The tokenizer parameter has a _ll_tokenizer attribute that is compatible with llguidance.LLInterpreter but never checks if this attribute exists or is the right type
The model.isNew() check will eventually return false within a reasonable time, but uses unbounded polling every 100ms without timeout
The llguidance module is available and compatible, but only catches import error at module level, not version compatibility at runtime
Dspy (12)
Language models will treat field headers like [[ ## field_name ## ]] as meaningful delimiters and not generate them as part of actual content
All adapters will successfully fallback to JSONAdapter when parsing fails, and JSONAdapter will always be available and functional
The LITELLM_LOCAL_MODEL_COST_MAP environment variable can be safely set to 'True' without conflicting with user's existing environment configuration
| Assumption category | Guidance | Dspy |
|---|---|---|
| Shape | 1 | 1 |
| Ordering | 1 | 1 |
| Environment | 2 | 2 |
| Scale | 1 | 1 |
| Domain | 1 | 3 |
| Contract | 3 | 2 |
| Temporal | 2 | 1 |
| Resource | 1 | 1 |
Technology Stack
Shared Technologies
Only in Guidance
llguidance jinja2 numpy transformers openai svelte typescript jupyter-widgetsOnly in Dspy
litellm diskcache tenacity json repair regex asyncio optuna cloudpickleArchitecture Layers
Guidance (4 layers)
Dspy (6 layers)
Data Flow
Guidance (6 stages)
- Parse grammar definition
- Compile to parser
- Generate tokens
- Validate constraints
- Update model state
- Display in notebook
Dspy (7 stages)
- Define signature contract
- Create module instance
- Execute with input data
- Format prompt through adapter
- Call language model
- Parse structured response
- Return prediction result
System Behavior
| Dimension | Guidance | Dspy |
|---|---|---|
| Data Pools | 3 | 4 |
| Feedback Loops | 2 | 4 |
| Delays | 3 | 4 |
| Control Points | 5 | 6 |
Code Patterns
Unique to Guidance
grammar compilation real-time constraint enforcement sandboxed visualization backend abstraction tag-based embeddingUnique to Dspy
signature-based programming adapter pattern for lm interfaces module composition meta-learning optimization type-driven custom content context managementWhen to Choose
Choose Guidance when you need
- Unique tech: llguidance, jinja2, numpy
- Simpler system dynamics
- Fewer domain assumptions to break
Choose Dspy when you need
- Unique tech: litellm, diskcache, tenacity
- Richer system behavior (more feedback loops and control points)
- Fine when domain stays stable; it makes more domain assumptions
Frequently Asked Questions
What are the main differences between Guidance and Dspy?
Guidance has 9 components with a connectivity ratio of 0.0, while Dspy has 10 components with a ratio of 0.0. They share 1 technologies but differ in 16 others.
Should I use Guidance or Dspy?
Choose Guidance if you need: Unique tech: llguidance, jinja2, numpy; Simpler system dynamics. Choose Dspy if you need: Unique tech: litellm, diskcache, tenacity; Richer system behavior (more feedback loops and control points).
How does the architecture of Guidance compare to Dspy?
Guidance is organized into 4 architecture layers with a 6-stage data pipeline. Dspy has 6 layers with a 7-stage pipeline.
What technology does Guidance use that Dspy doesn't?
Guidance uniquely uses: llguidance, jinja2, numpy, transformers, openai. Dspy uniquely uses: litellm, diskcache, tenacity, json repair, regex.
Explore the interactive analysis
See the full hidden-assumptions report, pipeline, and system behavior.
Guidance DspyRelated ML Inference & Agents Comparisons
Compared on April 20, 2026 by CodeSea. Written by Karolina Sarna.