Exploring the Curious Case of Code Prompts

Li Zhang, Liam Dugan, Hainiu Xu, Chris Callison-burch


Abstract
Recent work has shown that prompting language models with code-like representations of natural language leads to performance improvements on structured reasoning tasks. However, such tasks comprise only a small subset of all natural language tasks. In our work, we seek to answer whether or not code-prompting is the preferred way of interacting with language models in general. We compare code and text prompts across three popular GPT models (davinci, code-davinci-002, and text-davinci-002) on a broader selection of tasks (e.g., QA, sentiment, summarization) and find that with few exceptions, code prompts do not consistently outperform text prompts. Furthermore, we show that the style of code prompt has a large effect on performance for some (but not all) tasks and that fine-tuning on text instructions leads to better relative performance of code prompts.
Anthology ID:
2023.nlrse-1.2
Volume:
Proceedings of the 1st Workshop on Natural Language Reasoning and Structured Explanations (NLRSE)
Month:
June
Year:
2023
Address:
Toronto, Canada
Editors:
Bhavana Dalvi Mishra, Greg Durrett, Peter Jansen, Danilo Neves Ribeiro, Jason Wei
Venue:
NLRSE
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
9–17
Language:
URL:
https://aclanthology.org/2023.nlrse-1.2
DOI:
10.18653/v1/2023.nlrse-1.2
Bibkey:
Cite (ACL):
Li Zhang, Liam Dugan, Hainiu Xu, and Chris Callison-burch. 2023. Exploring the Curious Case of Code Prompts. In Proceedings of the 1st Workshop on Natural Language Reasoning and Structured Explanations (NLRSE), pages 9–17, Toronto, Canada. Association for Computational Linguistics.
Cite (Informal):
Exploring the Curious Case of Code Prompts (Zhang et al., NLRSE 2023)
Copy Citation:
PDF:
https://aclanthology.org/2023.nlrse-1.2.pdf