{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,11,19]],"date-time":"2026-11-19T12:07:36Z","timestamp":1795090056723,"version":"4.10.2"},"reference-count":59,"publisher":"Association for Computing Machinery (ACM)","issue":"FSE","license":[{"start":{"date-parts":[[2024,7,12]],"date-time":"2024-07-12T00:00:00Z","timestamp":1720742400000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Proc. ACM Softw. Eng."],"published-print":{"date-parts":[[2024,7,12]]},"abstract":"<jats:p>Informal natural language that describes code functionality, such as code comments or function documentation, may contain substantial information about a program\u2019s intent. However, there is typically no guarantee that a program\u2019s implementation and natural language documentation are aligned. In the case of a conflict, leveraging information in code-adjacent natural language has the potential to enhance fault localization, debugging, and code trustworthiness. In practice, however, this information is often underutilized due to the inherent ambiguity of natural language, which makes natural language intent challenging to check programmatically. The \u201cemergent abilities\u201d of Large Language Models (LLMs) have the potential to facilitate the translation of natural language intent to programmatically checkable assertions. However, it is unclear if LLMs can correctly translate informal natural language specifications into formal specifications that match programmer intent. Additionally, it is unclear if such translation could be useful in practice.<\/jats:p>\n                  <jats:p>\n                    In this paper, we describe\n                    <jats:italic toggle=\"yes\">nl2postcond<\/jats:italic>\n                    , the problem of leveraging LLMs for transforming informal natural language to formal method postconditions, expressed as program assertions. We introduce and validate metrics to measure and compare different\n                    <jats:italic toggle=\"yes\">nl2postcond<\/jats:italic>\n                    approaches, using the correctness and\n                    <jats:italic toggle=\"yes\">discriminative power<\/jats:italic>\n                    of generated postconditions. We then use qualitative and quantitative methods to assess the quality of\n                    <jats:italic toggle=\"yes\">nl2postcond<\/jats:italic>\n                    postconditions, finding that they are generally correct and able to discriminate incorrect code. Finally, we find that\n                    <jats:italic toggle=\"yes\">nl2postcond<\/jats:italic>\n                    via LLMs has the potential to be helpful in practice;\n                    <jats:italic toggle=\"yes\">nl2postcond<\/jats:italic>\n                    generated postconditions were able to catch 64 real-world historical bugs from\n                    <jats:italic toggle=\"yes\">Defects4J<\/jats:italic>\n                    .\n                  <\/jats:p>","DOI":"10.1145\/3660791","type":"journal-article","created":{"date-parts":[[2024,7,12]],"date-time":"2024-07-12T10:22:09Z","timestamp":1720779729000},"page":"1889-1912","source":"Crossref","is-referenced-by-count":72,"title":["Can Large Language Models Transform Natural Language Intent into Formal Method Postconditions?"],"prefix":"10.1145","volume":"1","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-4618-4939","authenticated-orcid":false,"given":"Madeline","family":"Endres","sequence":"first","affiliation":[{"name":"University of Michigan, Ann Arbor, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-8486-7749","authenticated-orcid":false,"given":"Sarah","family":"Fakhoury","sequence":"additional","affiliation":[{"name":"Microsoft Research, Seattle, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-6889-7171","authenticated-orcid":false,"given":"Saikat","family":"Chakraborty","sequence":"additional","affiliation":[{"name":"Microsoft Research, Seattle, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-4446-4777","authenticated-orcid":false,"given":"Shuvendu K.","family":"Lahiri","sequence":"additional","affiliation":[{"name":"Microsoft Research, Seattle, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2024,7,12]]},"reference":[{"key":"e_1_3_1_2_2","doi-asserted-by":"publisher","DOI":"10.1145\/1370175.1370223"},{"key":"e_1_3_1_3_2","unstructured":"Amazon AWS. 2023. Amazon CodeWhisperer. Accessed September 27 2023. https:\/\/aws.amazon.com\/codewhisperer\/."},{"key":"e_1_3_1_4_2","doi-asserted-by":"publisher","DOI":"10.1145\/3213846.3213872"},{"key":"e_1_3_1_5_2","doi-asserted-by":"publisher","DOI":"10.1016\/0950-5849(93)90083-F"},{"key":"e_1_3_1_6_2","doi-asserted-by":"publisher","DOI":"10.1007\/11804192_16"},{"key":"e_1_3_1_7_2","article-title":"Evaluating large language models trained on code","author":"Chen Mark","year":"2021","unstructured":"Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. 2021. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374 (2021).","journal-title":"arXiv preprint arXiv:2107.03374"},{"key":"e_1_3_1_8_2","doi-asserted-by":"publisher","DOI":"10.1145\/2384616.2384633"},{"key":"e_1_3_1_9_2","doi-asserted-by":"publisher","unstructured":"Edsger W. Dijkstra and Carel S. Scholten. 1990. Predicate Calculus and Program Semantics. (1990). https:\/\/doi.org\/10.1007\/978-1-4612-3228-5 10.1007\/978-1-4612-3228-5","DOI":"10.1007\/978-1-4612-3228-5"},{"key":"e_1_3_1_10_2","doi-asserted-by":"publisher","DOI":"10.1145\/3510003.3510141"},{"key":"e_1_3_1_11_2","doi-asserted-by":"publisher","DOI":"10.1145\/302405.302467"},{"key":"e_1_3_1_12_2","article-title":"Towards Generating Functionally Correct Code Edits from Natural Language Issue Descriptions","author":"Fakhoury Sarah","year":"2023","unstructured":"Sarah Fakhoury, Saikat Chakraborty, Madan Musuvathi, and Shuvendu K Lahiri. 2023. Towards Generating Functionally Correct Code Edits from Natural Language Issue Descriptions. arXiv preprint arXiv:2304.03816 (2023).","journal-title":"arXiv preprint arXiv:2304.03816"},{"key":"e_1_3_1_13_2","doi-asserted-by":"crossref","unstructured":"Sarah Fakhoury Aaditya Naik Georgios Sakkas Saikat Chakraborty and Shuvendu K. Lahiri. 2024. LLM-based Test-driven Interactive Code Generation: User Study and Empirical Evaluation. (2024). arXiv:2404.10100 [cs.SE]","DOI":"10.1145\/3639478.3643525"},{"key":"e_1_3_1_14_2","doi-asserted-by":"publisher","DOI":"10.1145\/2025113.2025179"},{"key":"e_1_3_1_15_2","doi-asserted-by":"publisher","DOI":"10.1145\/2837614.2837664"},{"key":"e_1_3_1_16_2","unstructured":"GitHub. 2023. GitHub Copilot. Accessed September 27 2023. https:\/\/github.com\/features\/copilot\/."},{"key":"e_1_3_1_17_2","doi-asserted-by":"publisher","DOI":"10.1145\/2931037.2931061"},{"key":"e_1_3_1_18_2","doi-asserted-by":"publisher","DOI":"10.1145\/3338906.3342494"},{"key":"e_1_3_1_19_2","article-title":"Paired t test","author":"Hsu Henry","year":"2014","unstructured":"Henry Hsu and Peter A Lachenbruch. 2014. Paired t test. Wiley StatsRef: statistics reference online (2014).","journal-title":"Wiley StatsRef: statistics reference online"},{"key":"e_1_3_1_20_2","unstructured":"Daniel Jackson. 1992. Aspect a formal specification language for detecting bugs. Ph. D. Dissertation. Citeseer."},{"key":"e_1_3_1_21_2","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2010.62"},{"key":"e_1_3_1_22_2","doi-asserted-by":"publisher","DOI":"10.1145\/2610384.2628055"},{"key":"e_1_3_1_23_2","article-title":"I speak, you verify: Toward trustworthy neural program synthesis","author":"Key Darren","year":"2022","unstructured":"Darren Key, Wen-Ding Li, and Kevin Ellis. 2022. I speak, you verify: Toward trustworthy neural program synthesis. arXiv preprint arXiv:2210.00848 (2022).","journal-title":"arXiv preprint arXiv:2210.00848"},{"key":"e_1_3_1_24_2","article-title":"The stack: 3 tb of permissively licensed source code","author":"Kocetkov Denis","year":"2022","unstructured":"Denis Kocetkov, Raymond Li, Loubna Ben Allal, Jia Li, Chenghao Mou, Carlos Mu\u00f1oz Ferrandis, Yacine Jernite, Margaret Mitchell, Sean Hughes, Thomas Wolf, et al. 2022. The stack: 3 tb of permissively licensed source code. arXiv preprint arXiv:2211.15533 (2022).","journal-title":"arXiv preprint arXiv:2211.15533"},{"key":"e_1_3_1_25_2","article-title":"Interactive code generation via test-driven user-intent formalization","author":"Lahiri Shuvendu K","year":"2022","unstructured":"Shuvendu K Lahiri, Aaditya Naik, Georgios Sakkas, Piali Choudhury, Curtis von Veh, Madanlal Musuvathi, Jeevana Priya Inala, Chenglong Wang, and Jianfeng Gao. 2022. Interactive code generation via test-driven user-intent formalization. arXiv preprint arXiv:2208.05950 (2022).","journal-title":"arXiv preprint arXiv:2208.05950"},{"key":"e_1_3_1_26_2","article-title":"Can language models learn from explanations in context?","author":"Lampinen Andrew K.","year":"2022","unstructured":"Andrew K. Lampinen, Ishita Dasgupta, Stephanie C. Y. Chan, Kory Matthewson, Michael Henry Tessler, Antonia Creswell, James L. McClelland, Jane X. Wang, and Felix Hill. 2022. Can language models learn from explanations in context? arXiv:2204.02329 [cs.CL]","journal-title":"arXiv:2204.02329"},{"key":"e_1_3_1_27_2","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-17511-4_20"},{"key":"e_1_3_1_28_2","doi-asserted-by":"publisher","DOI":"10.1145\/1287624.1287685"},{"key":"e_1_3_1_29_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE48619.2023.00085"},{"key":"e_1_3_1_30_2","article-title":"StarCoder: may the source be with you!","author":"Li Raymond","year":"2023","unstructured":"Raymond Li, Loubna Ben Allal, Yangtian Zi, Niklas Muennighoff, Denis Kocetkov, Chenghao Mou, Marc Marone, Christopher Akiki, Jia Li, Jenny Chim, et al. 2023. StarCoder: may the source be with you! arXiv preprint arXiv:2305.06161 (2023).","journal-title":"arXiv preprint arXiv:2305.06161"},{"key":"e_1_3_1_31_2","unstructured":"Jiawei Liu Chunqiu Steven Xia Yuyao Wang and Lingming Zhang. 2023. Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation. 37th cconference on Neural Information processing Systems (NeurIPS) 2023 (2023). https:\/\/arxiv.org\/abs\/2305.01210"},{"key":"e_1_3_1_32_2","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2022.3183297"},{"key":"e_1_3_1_33_2","article-title":"The Spec# programming system: An overview","author":"Mike B","year":"2004","unstructured":"B Mike, K Rustan M Leino, and S Wolfram. 2004. The Spec# programming system: An overview. In Construction and Analysis of Safe, Secure, and Interoperable Smart devices (CASSIS)\u201d volume 3362 of Lecture Notes in Computer Science.","journal-title":"In Construction and Analysis of Safe, Secure, and Interoperable Smart devices (CASSIS)\u201d volume 3362 of Lecture Notes in Computer Science"},{"key":"e_1_3_1_34_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE43902.2021.00112"},{"key":"e_1_3_1_35_2","article-title":"Codegen: An open large language model for code with multi-turn program synthesis","author":"Nijkamp Erik","year":"2022","unstructured":"Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong. 2022. Codegen: An open large language model for code with multi-turn program synthesis. arXiv preprint arXiv:2203.13474 (2022).","journal-title":"arXiv preprint arXiv:2203.13474"},{"key":"e_1_3_1_36_2","article-title":"Demystifying GPT Self-Repair for Code Generation","author":"Olausson Theo X","year":"2023","unstructured":"Theo X Olausson, Jeevana Priya Inala, Chenglong Wang, Jianfeng Gao, and Armando Solar-Lezama. 2023. Demystifying GPT Self-Repair for Code Generation. arXiv preprint arXiv:2306.09896 (2023).","journal-title":"arXiv preprint arXiv:2306.09896"},{"key":"e_1_3_1_37_2","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-540-24853-8_12"},{"key":"e_1_3_1_38_2","first-page":"27730","article-title":"Training language models to follow instructions with human feedback","volume":"35","author":"Ouyang Long","year":"2022","unstructured":"Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems 35 (2022), 27730\u201327744.","journal-title":"Advances in Neural Information Processing Systems"},{"key":"e_1_3_1_39_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE.2012.6227137"},{"key":"e_1_3_1_40_2","unstructured":"Kexin Pei David Bieber Kensen Shi Charles Sutton and Pengcheng Yin. 2023. Can Large Language Models Reason about Program Invariants? 202 (2023) 27496\u201327520. https:\/\/proceedings.mlr.press\/v202\/pei23a.html"},{"key":"e_1_3_1_41_2","doi-asserted-by":"publisher","DOI":"10.1145\/3379597.3387442"},{"key":"e_1_3_1_42_2","unstructured":"Richard Rutledge Sheryl Duggins Dan Lo and Frank Tsui. 2014. Formal specification-driven development. In Proceedings of the International Conference on Software Engineering Research and Practice (SERP). The Steering Committee of The World Congress in Computer Science Computer . . . 1."},{"key":"e_1_3_1_43_2","volume-title":"8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020","author":"Ryan Gabriel","year":"2020","unstructured":"Gabriel Ryan, Justin Wong, Jianan Yao, Ronghui Gu, and Suman Jana. 2020. CLN2INV: Learning Loop Invariants with Continuous Logic Networks. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. https:\/\/openreview.net\/forum?id=HJlfuTEtvB"},{"key":"e_1_3_1_44_2","doi-asserted-by":"publisher","DOI":"10.1007\/S10703-016-0248-5"},{"key":"e_1_3_1_45_2","doi-asserted-by":"publisher","DOI":"10.1145\/1273463.1273487"},{"key":"e_1_3_1_46_2","doi-asserted-by":"publisher","DOI":"10.1145\/2034773.2034811"},{"key":"e_1_3_1_47_2","unstructured":"Tabnine. 2023. Tabnine Code Completion. Accessed September 27 2023. https:\/\/www.tabnine.com\/."},{"key":"e_1_3_1_48_2","doi-asserted-by":"publisher","DOI":"10.1145\/1294261.1294276"},{"key":"e_1_3_1_49_2","doi-asserted-by":"publisher","DOI":"10.1145\/1985793.1985796"},{"key":"e_1_3_1_50_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICST.2012.106"},{"key":"e_1_3_1_51_2","doi-asserted-by":"publisher","unstructured":"Michele Tufano Dawn Drain Alexey Svyatkovskiy Shao Kun Deng and Neel Sundaresan. 2020. Unit Test Case Generation with Transformers and Focal Context. https:\/\/doi.org\/10.48550\/ARXIV.2009.05617 10.48550\/ARXIV.2009.05617","DOI":"10.48550\/ARXIV.2009.05617"},{"key":"e_1_3_1_52_2","article-title":"Unit Test Case Generation with Transformers and Focal Context","author":"Tufano Michele","year":"2021","unstructured":"Michele Tufano, Dawn Drain, Alexey Svyatkovskiy, Shao Kun Deng, and Neel Sundaresan. 2021. Unit Test Case Generation with Transformers and Focal Context. arXiv:2009.05617 [cs.SE]","journal-title":"arXiv:2009.05617"},{"key":"e_1_3_1_53_2","doi-asserted-by":"publisher","DOI":"10.1145\/3524481.3527220"},{"key":"e_1_3_1_54_2","article-title":"Can Large Language Models Write Good Property-Based Tests?","author":"Vikram Vasudev","year":"2023","unstructured":"Vasudev Vikram, Caroline Lemieux, and Rohan Padhye. 2023. Can Large Language Models Write Good Property-Based Tests? arXiv preprint arXiv:2307.04346 (2023).","journal-title":"arXiv preprint arXiv:2307.04346"},{"key":"e_1_3_1_55_2","article-title":"Emergent Abilities of Large Language Models","author":"Wei Jason","year":"2022","unstructured":"Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, et al. 2022. Emergent Abilities of Large Language Models. Transactions on Machine Learning Research (2022).","journal-title":"Transactions on Machine Learning Research"},{"key":"e_1_3_1_56_2","article-title":"Chain-of-Thought Prompting Elicits Reasoning in Large Language Models","author":"Wei Jason","year":"2023","unstructured":"Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. 2023. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv:2201.11903 [cs.CL]","journal-title":"arXiv:2201.11903"},{"key":"e_1_3_1_57_2","doi-asserted-by":"publisher","DOI":"10.1145\/3385412.3385986"},{"key":"e_1_3_1_58_2","doi-asserted-by":"publisher","DOI":"10.1109\/ASE.2009.94"},{"key":"e_1_3_1_59_2","article-title":"Least-to-Most Prompting Enables Complex Reasoning in Large Language Models","author":"Zhou Denny","year":"2023","unstructured":"Denny Zhou, Nathanael Sch\u00e4rli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Claire Cui, Olivier Bousquet, Quoc Le, and Ed Chi. 2023. Least-to-Most Prompting Enables Complex Reasoning in Large Language Models. arXiv:2205.10625 [cs.AI]","journal-title":"arXiv:2205.10625"},{"key":"e_1_3_1_60_2","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE.2017.11"}],"container-title":["Proceedings of the ACM on Software Engineering"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3660791","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3660791","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,2,4]],"date-time":"2026-02-04T07:54:25Z","timestamp":1770191665000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3660791"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2024,7,12]]},"references-count":59,"journal-issue":{"issue":"FSE","published-print":{"date-parts":[[2024,7,12]]}},"alternative-id":["10.1145\/3660791"],"URL":"https:\/\/doi.org\/10.1145\/3660791","relation":{},"ISSN":["2994-970X"],"issn-type":[{"value":"2994-970X","type":"electronic"}],"subject":[],"published":{"date-parts":[[2024,7,12]]}}}