Code Generation for Collectible Card Games with Complex APIs

John Licato, Logan Fields, Brayden Hollis
{"title":"Code Generation for Collectible Card Games with Complex APIs","authors":"John Licato, Logan Fields, Brayden Hollis","doi":"10.32473/flairs.36.133044","DOIUrl":null,"url":null,"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.","PeriodicalId":302103,"journal":{"name":"The International FLAIRS Conference Proceedings","volume":"151 ","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2023-05-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"The International FLAIRS Conference Proceedings","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.32473/flairs.36.133044","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

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.
具有复杂api的卡片收集游戏的代码生成
大型预训练语言模型(LMs),如GPT-3 Codex,能够在给定自然语言文本提示的情况下非常好地生成代码。但是,如果我们想使用这样的lm来生成与特定API或库(例如,提供执行某些规则、法律或命令的环境的API)兼容的代码,那么对大多数组织来说,微调此类模型所需的计算量和数据资源的成本可能会令人望而生畏。考虑到这些实际限制,是否有可能利用这些大规模代码生成LMs来编写与给定API兼容的代码?我们开发了一种算法,该算法使用经过训练的较小的LM来选择代码示例,以预测可能在结果代码中使用API的哪些特征,这比实际生成代码要简单得多。然后使用选定的示例为较大的LM构建提示符,从而生成最终的代码。我们在收集卡牌游戏“Magic: the Gathering”的基准数据集上展示了我们的结果,并获得了最先进的结果。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信