Model NewsTopic: AI Models →

dspy-wsp: Weight-space programming for DSPy

Cmpnd released dspy-wsp, a DSPy optimizer using weight-space programming to let frontier models edit smaller model weights. 6B to 9B parameters.

Headline card: dspy-wsp: Weight-space programming for DSPy
On this page
  1. What changed
  2. Why it matters
  3. What to test
  4. The conclusion
  5. Related reading

What changed

Cmpnd released dspy-wsp, a prototype optimizer that brings weight-space programming to DSPy as a standard tool. The company tested the approach and found that every decision model it evaluated improved when a frontier LLM directly edited the smaller model’s weights.

Weight-space programming is a technique where a larger language model reads another model’s weight tensors, reasons about what each part computes, and rewrites them to match a goal stated in plain English. There are no gradients, no training loop, and no fine-tuning dataset. The technique builds on research from MIT where GPT-6-Astra edited 0.016% of Qwen3.5-0.8B’s weights to fix a looping problem, raising its MATH-500 score from 7.9% to 48.1%.

The tool is available under MIT license via pip install dspy-wsp and requires DSPy 3.5. Cmpnd tested WeightSpace on five open decision models ranging from 0.6B to 9B parameters. For each model, GPT-6-Astra performed 25 forward passes at maximum reasoning effort, with the company reporting costs of about $5 to $10 per model. The edited weights run locally on consumer hardware. All experiments ran on one Mac with 2B models consuming about 6 GB of memory.

Why it matters

Weight-space programming opens a new optimization path for teams deploying models locally or on edge hardware. Prior approaches rely on prompt optimization, which edits instructions and examples, or fine-tuning, which requires gradients, training loops, and usually a GPU. This technique allows reasoning from a frontier LLM to reach model weights directly.

The practical advantages are significant. First, the edited weights ship as a small, verifiable patch rather than a full model checkpoint. Second, optimization requires only forward passes on practice data, not backward gradients or large training datasets. The patch can run offline, eliminating API calls during inference.

Decision models appear to benefit most from this approach. These models answer multiple typed questions at once, returning probability distributions that downstream logic can threshold and interpret. The Typed Decisions benchmark measures accuracy on 400 test cases, each containing 5 typed decisions. Cmpnd’s results show that weaker models gain more from editing than stronger ones: d1-omni-600M rose from 50.9% to 69.1%, a gain of 18.3 points when combined with ReAnchor, while Clef-Flash at 9B parameters gained only 1.9 points from WeightSpace alone.

The technique composes well with existing DSPy optimizers. When combined with ReAnchor, an optimizer that refits decision thresholds without LLM calls, gains ranged from 6.5 to 20.0 points across all models tested. This stacking suggests the approaches target different mechanisms: WeightSpace changes the model’s reasoning, while ReAnchor recalibrates its output scale.

For organizations running inference locally, this could reduce latency and cost by eliminating API calls for smaller, domain-specific models while still using frontier model reasoning during the optimization phase.

What to test

Before adopting dspy-wsp in production, teams should verify these claims and limitations:

The speed and cost trade-off. Runs take 78 to 167 minutes each at $5 to $10 per optimization. Confirm whether the gains justify that investment for your use case. Test whether GPT-6-Astra at maximum reasoning effort is necessary, or whether cheaper writer models work adequately.

Scaling limits. The company reports that larger models gain less from editing. Clef-Flash at 9B gained only 1.9 points from WeightSpace alone. Test whether this pattern holds for your model size and domain. Verify whether the 9B model’s behavior is typical or specific to that architecture.

Editing quality and stability. The research documentation lists every edit performed, showing they are small and targeted. Reproduce those edits on your own data to verify they transfer. Check whether repeated runs produce similar patches or diverge significantly. This matters for understanding whether the approach finds stable solutions or just fortunate edits.

Data separation. The tool separates trainset (for practice), holdout (for scoring during optimization), and valset (hidden until the end). Verify that this prevents data leakage in your pipeline and that results on valset match the company’s claims.

Memory and hardware requirements. Cmpnd tested on one Mac and reports that 2B models used about 6 GB of memory. Confirm those requirements on your hardware and test larger models on your GPU. Verify that 4 GB is sufficient for d1-omni-600M on your target hardware.

Writer model dependency. Results vary significantly based on the writer LLM. Cmpnd compared GPT-6-Astra to gpt-6.1-sol and saw different gains on each model. Test your preferred writer against the company’s baseline to understand the sensitivity. This is critical if you want to optimize costs.

Inference backend support. The tool supports MLX on Mac, PyTorch on CPU and GPU, and vLLM on NVIDIA GPUs for text generation. Test on your target inference stack before committing to a deployment strategy.

The conclusion

dspy-wsp brings an experimental but practical optimization method to DSPy users. The approach trades LLM reasoning cost for gradient-free weight editing, making it attractive for teams deploying smaller decision models locally. Results are genuine: every model tested improved, and gains stack well with existing optimizers.

The limitations are clear: runs are slow and costly, editing works best on smaller models, and the technique is very early. Cmpnd frames this as an invitation to experiment and report back, not a production-ready tool. Writer model choice matters significantly, and larger models show diminishing returns.

Three directions merit watching: whether editing quality scales to reasoning tasks beyond typed decisions, whether cheaper or more specialized writer models can match GPT-6-Astra’s results, and how the community extends the sandbox security model for multiuser or untrusted deployments.

For teams optimizing decision models at 2B parameters or smaller, dspy-wsp is worth testing on a non-critical workload. For larger models or open-ended reasoning tasks, treat it as research-stage and monitor the repository for updates.

AI Tool Herald may earn a commission from some links on this site. It never changes what we report or recommend. Affiliate disclosure