Code Generation for Collectible Card Games with Complex APIs

Authors

  • John Licato University of South Florida
  • Logan Fields University of South Florida https://orcid.org/0000-0002-9069-8355
  • Brayden Hollis Air Force Research Lab

DOI:

https://doi.org/10.32473/flairs.36.133044

Abstract

Large pre-trained language models (LMs) such as GPT-3 Codex are able to generate code remarkably well given prompts of natural language text. But if we want to use such LMs to generate code compatible with a specific API or library (e.g., an API which provides the environments in which certain rules, laws, or orders are to be carried out), the amount of computational and data resources required to fine-tune such models can be cost prohibitive to most organizations. Given these practical limitations, is it possible to utilize these massive code-generation LMs to write code compatible with a given API? We develop an algorithm that selects code examples using a smaller LM trained to predict which features of an API are likely to be used in the resulting code, which is a simpler problem than actually generating the code. The selected examples are then used to build a prompt for the larger LM, which in turn generates the final code. We demonstrate our results on a benchmark dataset derived from the collectible card game "Magic: the Gathering," and obtain state-of-the-art results.

Downloads

Published

08-05-2023

How to Cite

Licato, J., Fields, L., & Hollis, B. (2023). Code Generation for Collectible Card Games with Complex APIs. The International FLAIRS Conference Proceedings, 36(1). https://doi.org/10.32473/flairs.36.133044

Issue

Section

Special Track: Applied Natural Language Processing