We propose a method combining machine learning with a static analysis tool (i.e. Infer) to automatically repair source code. Machine Learning methods perform well for producing idiomatic source code. However, their output is sometimes difficult to trust as language models can output incorrect code with high confidence. Static analysis tools are trustable, but also less flexible and produce non-idiomatic code. In this paper, we propose to fix resource leak bugs in IR space, and to use a sequence-to-sequence model to propose fix in source code space. We also study several decoding strategies, and use Infer to filter the output of the model. On a dataset of CodeNet submissions with potential resource leak bugs, our method is able to find a function with the same semantics that does not raise a warning with around 97% precision and 66% recall.


翻译:我们提出了一种结合机器学习和静态分析工具(即Infer)的方法,用于自动修复源代码。机器学习方法在生成成惯用语源代码方面效果良好。 但是,由于语言模型可能会以高置信度输出不正确的代码,因此其输出有时很难信任。 静态分析工具可信性高,但灵活性较差且产生的代码不是惯用语。在本文中,我们建议在IR空间中修复资源泄漏缺陷,并使用序列到序列模型在源代码空间中提出修复建议。我们还研究了几种解码策略,并使用Infer来过滤模型输出。 在CodeNet提交的缺陷数据集中,我们的方法能够找到一种具有相同语义但不会引发警告的函数,准确率约为97%,召回率为66%。

0
下载
关闭预览

相关内容

专知会员服务
72+阅读 · 2021年1月12日
近期必读的五篇 EMNLP 2020【反事实推理】相关论文和代码
专知会员服务
25+阅读 · 2020年11月23日
专知会员服务
123+阅读 · 2020年9月8日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
手把手教你写 Dart ffi
阿里技术
0+阅读 · 2022年11月7日
逆强化学习-学习人先验的动机
CreateAMind
15+阅读 · 2019年1月18日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
手把手教你用Python库Keras做预测(附代码)
数据派THU
14+阅读 · 2018年5月30日
【推荐】用TensorFlow实现LSTM社交对话股市情感分析
机器学习研究会
11+阅读 · 2018年1月14日
【推荐】(TensorFlow)SSD实时手部检测与追踪(附代码)
机器学习研究会
11+阅读 · 2017年12月5日
可解释的CNN
CreateAMind
17+阅读 · 2017年10月5日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2010年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Arxiv
0+阅读 · 2023年6月5日
Arxiv
0+阅读 · 2023年6月2日
Arxiv
0+阅读 · 2023年6月1日
VIP会员
相关VIP内容
专知会员服务
72+阅读 · 2021年1月12日
近期必读的五篇 EMNLP 2020【反事实推理】相关论文和代码
专知会员服务
25+阅读 · 2020年11月23日
专知会员服务
123+阅读 · 2020年9月8日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
相关资讯
手把手教你写 Dart ffi
阿里技术
0+阅读 · 2022年11月7日
逆强化学习-学习人先验的动机
CreateAMind
15+阅读 · 2019年1月18日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
手把手教你用Python库Keras做预测(附代码)
数据派THU
14+阅读 · 2018年5月30日
【推荐】用TensorFlow实现LSTM社交对话股市情感分析
机器学习研究会
11+阅读 · 2018年1月14日
【推荐】(TensorFlow)SSD实时手部检测与追踪(附代码)
机器学习研究会
11+阅读 · 2017年12月5日
可解释的CNN
CreateAMind
17+阅读 · 2017年10月5日
相关基金
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2010年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员