Code Generation for Collectible Card Games with Complex APIs


  • John Licato University of South Florida
  • Logan Fields University of South Florida
  • Brayden Hollis Air Force Research Lab



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.




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).



Special Track: Applied Natural Language Processing