Optimizing LLM Prompt Engineering with DSPy Based Declarative Learning
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) have shown strong performance across a wide range of natural language processing tasks; however, their effectiveness is highly dependent on prompt design, structure, and embedded reasoning signals. Conventional prompt engineering methods largely rely on heuristic trial-and-error processes, which limits scalability, reproducibility, and generalization across tasks. DSPy, a declarative framework for optimizing text-processing pipelines, offers an alternative approach by enabling automated, modular, and learnable prompt construction for LLM-based systems.This paper presents a systematic study of DSPy-based declarative learning for prompt optimization, with emphasis on prompt synthesis, correction, calibration, and adaptive reasoning control. We introduce a unified DSPy LLM architecture that combines symbolic planning, gradient free optimization, and automated module rewriting to reduce hallucinations, improve factual grounding, and avoid unnecessary prompt complexity. Experimental evaluations conducted on reasoning tasks, retrieval-augmented generation, and multi-step chain-of-thought benchmarks demonstrate consistent gains in output reliability, efficiency, and generalization across models. The results show improvements of up to 30 to 45% in factual accuracy and a reduction of approximately 25% in hallucination rates. Finally, we outline key limitations and discuss future research directions for declarative prompt optimization frameworks.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 4 of its 21 references that are in the map. First posted on arXiv 6 Apr 2026.
Builds on
4 of 21 references.
References · 4
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2023DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines
- 2025Self-Supervised Prompt Optimization
- 2024GReaTer: Gradients over Reasoning Makes Smaller Language Models Strong Prompt Optimizers
- 2024Towards Generalist Prompting for Large Language Models by Mental Models
- 2026Prompt Minimization: Reducing Input Redundancy Without Sacrificing Output Fidelity
- 2025Better by Comparison: Retrieval-Augmented Contrastive Reasoning for Automatic Prompt Optimization
- 2024PRompt Optimization in Multi-Step Tasks (PROMST): Integrating Human Feedback and Heuristic-based Sampling
- 2025Local Prompt Optimization