Part 7 — Declarative Prompting with DSPy

The Problem with Hand-Written Prompts Even with a solid Prompt Standard, hand-crafted prompts have a fundamental weakness: they are optimized by human intuition, not by data. You write a prompt, test it on a few examples, adjust the wording, and hope it generalizes. This is called “vibes-based prompting,” and it has three problems: Fragility: A prompt tuned for GPT-4 may perform poorly on Claude or a local open-weights model. Scalability: As your pipeline grows (RAG → reasoning → tool calls → validation), manually tuning each prompt becomes a maintenance nightmare. Opacity: You cannot explain why a specific phrasing works better — you just know it does. What Is DSPy? DSPy (Declarative Self-improving Python) is a framework that treats prompts as internal parameters to be optimized, not strings to be hand-written. ...

May 9, 2026 · 3 min · Lê Tuấn Anh