DSPy Assertions is a programming construct that expresses computational constraints for language model (LM) pipelines, integrated into the recent DSPy programming model. The researchers propose strategies to use assertions at inference time for automatic self-refinement with LMs. They found that LM Assertions improve not only compliance with imposed rules but also downstream task performance, passing constraints up to 164% more often and generating up to 37% more higher-quality responses.