The study introduces LM Assertions, a novel programming construct designed to enforce user-specified properties on Language Model (LM) outputs within a pipeline framework. This is integrated into the DSPy programming model for LMs, enabling more reliable and accurate systems. LM Assertions can be integrated at compile time through automatic prompt optimization or at inference time via automatic self-refinement and backtracking. The early case studies show that LM Assertions not only improve compliance with rules and guidelines but also enhance task performance.

 

Publication date: 20 Dec 2023
Project Page: https://arxiv.org/abs/2312.13382v1
Paper: https://arxiv.org/pdf/2312.13382