Agent Tuning & Optimization 相关度: 9/10

Optimizing LLM Prompt Engineering with DSPy Based Declarative Learning

Shiek Ruksana, Sailesh Kiran Kurra, Thipparthi Sanjay Baradwaj
arXiv: 2604.04869v1 发布: 2026-04-06 更新: 2026-04-06

AI 摘要

论文研究了基于DSPy的声明式学习在优化LLM提示工程方面的应用,提高了LLM的准确性和效率。

主要贡献

  • 提出了统一的DSPy LLM架构
  • 实现了提示合成、纠正、校准和自适应推理控制
  • 在多个任务上验证了DSPy方法的有效性

方法论

采用声明式框架DSPy,结合符号规划、无梯度优化和模块重写,实现提示的自动化优化。

原文摘要

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.

标签

LLM Prompt Engineering DSPy Declarative Learning

arXiv 分类

cs.LG