Skip to main content
LawSphereX

Language-to-Code Translation with a Single Labeled Example

Subject: Translation and Multilingual Computing

Author or source: Kaj Bostrom, Harsh Jhamtani, Hao Fang, Sam Thomson, Richard Shin, Patrick Xia, Benjamin Van Durme, Jason Eisner, Jacob Andreas

Updated:

Tools for translating natural language into code promise natural, open-ended interaction with databases, web APIs, and other software systems.

Kaj Bostrom, Harsh Jhamtani, Hao Fang, Sam Thomson, Richard Shin, Patrick Xia, Benjamin Van Durme, Jason Eisner, Jacob Andreas. 2024. Language-to-Code Translation with a Single Labeled Example. Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics. DOI 10.18653/v1/2024.emnlp-main.462. CC BY 4.0. Original PDF and author abstract are reproduced unchanged apart from whitespace in the abstract. LawSphereX prepared the reading prompt and cover. No endorsement implied.

Publication sources

Authors’ abstract

Source page 1–12

Tools for translating natural language into code promise natural, open-ended interaction with databases, web APIs, and other software systems. However, this promise is complicated by the diversity and continual development of these systems, each with its own interface and distinct set of features. Building a new language-to-code translator, even starting with a large language model (LM), typically requires annotating a large set of natural language commands with their associated programs. In this paper, we describe ICIP (In-Context Inverse Programming), a method for bootstrapping a language-to-code system using mostly (or entirely) unlabeled programs written using a potentially unfamiliar (but human-readable) library or API. ICIP uses a pre-trained LM to assign candidate natural language descriptions to these programs, then iteratively refines the descriptions to ensure global consistency. Across nine different application domains from the Overnight and Spider benchmarks and text-davinci-003 and CodeLlama-7b-Instruct models, ICIP outperforms a number of prompting baselines. Indeed, in a “nearly unsupervised” setting with only a single annotated program and 100 unlabeled examples, it achieves up to 85% of the performance of a fully supervised system.

Reading guide for translation and multilingual computing

Source page 1–12

List the languages and directions in the evaluation. Compare scores within a language pair before drawing conclusions across languages or domains.