The problem of reversing the compilation process, decompilation, is an important tool in reverse engineering of computer software. Recently, researchers have proposed using techniques from neural machine translation to automate the process in decompilation. Although such techniques hold the promise of targeting a wider range of source and assembly languages, to date they have primarily targeted C code. In this paper we argue that existing neural decompilers have achieved higher accuracy at the cost of requiring language-specific domain knowledge such as tokenizers and parsers to build an abstract syntax tree (AST) for the source language, which increases the overhead of supporting new languages. We explore a different tradeoff that, to the extent possible, treats the assembly and source languages as plain text, and show that this allows us to build a decompiler that is easily retargetable to new languages. We evaluate our prototype decompiler, Beyond The C (BTC), on Go, Fortran, OCaml, and C, and examine the impact of parameters such as tokenization and training data selection on the quality of decompilation, finding that it achieves comparable decompilation results to prior work in neural decompilation with significantly less domain knowledge. We will release our training data, trained decompilation models, and code to help encourage future research into language-agnostic decompilation.
translated by 谷歌翻译
Machine Learning for Source Code (ML4Code) is an active research field in which extensive experimentation is needed to discover how to best use source code's richly structured information. With this in mind, we introduce JEMMA, an Extensible Java Dataset for ML4Code Applications, which is a large-scale, diverse, and high-quality dataset targeted at ML4Code. Our goal with JEMMA is to lower the barrier to entry in ML4Code by providing the building blocks to experiment with source code models and tasks. JEMMA comes with a considerable amount of pre-processed information such as metadata, representations (e.g., code tokens, ASTs, graphs), and several properties (e.g., metrics, static analysis results) for 50,000 Java projects from the 50KC dataset, with over 1.2 million classes and over 8 million methods. JEMMA is also extensible allowing users to add new properties and representations to the dataset, and evaluate tasks on them. Thus, JEMMA becomes a workbench that researchers can use to experiment with novel representations and tasks operating on source code. To demonstrate the utility of the dataset, we also report results from two empirical studies on our data, ultimately showing that significant work lies ahead in the design of context-aware source code models that can reason over a broader network of source code entities in a software project, the very task that JEMMA is designed to help with.
translated by 谷歌翻译
评论是源代码的重要组成部分,是文档的主要来源。这引起了人们对使用大量注释的兴趣训练或评估消耗或生产它们的工具,例如生成甲骨文,甚至是从注释中生成代码,或自动生成代码摘要。这项工作大部分对评论的结构和质量做出了强烈的假设,例如假设它们主要由适当的英语句子组成。但是,我们对这些用例的现有评论的实际质量知之甚少。评论通常包含在其他类型的文本中看不到的独特结构和元素,并且从中过滤或提取信息需要额外的谨慎。本文探讨了来自GitHub的840个最受欢迎的开源项目和Srilab数据集的8422个项目的Python评论的内容和质量,并且Na \“ Ive vs.深入过滤的影响都可以使用现有注释来用于使用现有注释。培训和评估产生评论的系统。
translated by 谷歌翻译
人类开发人员可以使用网络安全缺陷生产代码。可以新兴'智能'代码完成工具有助于修复这些缺点吗?在这项工作中,我们研究了对零拍摄漏洞修复的代码(如Openai的Codex和AI21的侏罗纪J-1)使用大型语言模型(如Openai的Codex和AI21的J-1)。我们调查设计方面的挑战,提示将Coax LLMS进入生成不安全代码的修复版本。由于许多方法来短语和句法 - 具有自然语言,这很困难。通过对四个商业,黑盒子,“现成的”典型的模型进行大规模研究,以及局部训练的模型,在合成,手工制作和现实世界的安全错误场景的混合中,我们的实验表明,LLMS可以共同修复100%的综合生成和手工制作的情景,以及58%的脆弱性,在真实的开源项目中的历史错误中选择。
translated by 谷歌翻译
随着研究人员和从业人员将机器学习应用于越来越多的软件工程问题,他们使用的方法变得更加复杂。许多现代方法都以抽象语法树(AST)或其扩展形式使用内部代码结构:基于路径的表示,复杂的图将AST与其他边缘结合在一起。即使可以使用不同的解析器来从代码中提取AST的过程,但选择解析器对最终模型质量的影响仍然没有研究。此外,研究人员经常省略提取特定代码表示的确切细节。在这项工作中,我们在方法名称预测任务中评估了两个模型,即Code2Seq和Treelstm,由八个不同的解析器用于Java语言。为了将数据制备的过程与不同的解析器统一,我们开发了SuperParser,这是基于Pathminer的多语言解析器 - 不合Snostic库。 SuperParser促进了适用于培训和评估ML模型的数据集的端到端创建,这些模型与源代码中的结构信息合作。我们的结果表明,不同解析器建造的树木的结构和内容各不相同。然后,我们分析这种多样性如何影响模型的质量,并表明两种模型最不合适的解析器之间的质量差距非常重要。最后,我们讨论了解析器的其他功能,研究人员和从业人员在选择解析器时应考虑这些特征,以及对模型质量的影响。 SuperParser代码可在https://doi.org/10.5281/zenodo.6366591上公开获得。我们还发布了Java-Norm,即我们用于评估模型的数据集:https://doi.org/10.5281/zenodo.6366599。
translated by 谷歌翻译
As the complexity of modern software continues to escalate, software engineering has become an increasingly daunting and error-prone endeavor. In recent years, the field of Neural Code Intelligence (NCI) has emerged as a promising solution, leveraging the power of deep learning techniques to tackle analytical tasks on source code with the goal of improving programming efficiency and minimizing human errors within the software industry. Pretrained language models have become a dominant force in NCI research, consistently delivering state-of-the-art results across a wide range of tasks, including code summarization, generation, and translation. In this paper, we present a comprehensive survey of the NCI domain, including a thorough review of pretraining techniques, tasks, datasets, and model architectures. We hope this paper will serve as a bridge between the natural language and programming language communities, offering insights for future research in this rapidly evolving field.
translated by 谷歌翻译
在本文中,我们解决了深入学习的软件漏洞自动修复问题。数据驱动漏洞修复的主要问题是已知确认漏洞的少数现有数据集仅由几千例组成。然而,培训深度学习模型通常需要数十万例的例子。在这项工作中,我们利用了错误修复任务和漏洞修复任务的直觉相关,并且可以传输来自错误修复的知识可以传输到修复漏洞。在机器学习界中,这种技术称为转移学习。在本文中,我们提出了一种修复名为Vreepair的安全漏洞的方法,该方法是基于转移学习。 vreepair首先在大型错误修复语料库上培训,然后在漏洞修复数据集上调整,这是一个较小的数量级。在我们的实验中,我们表明,仅在错误修复语料库上培训的模型可能已经修复了一些漏洞。然后,我们证明转移学习改善了修复易受攻击的C功能的能力。我们还表明,转移学习模型比具有去噪任务训练的模型更好,并在漏洞固定任务上进行微调。总而言之,本文表明,与在小型数据集上的学习相比,转移学习适用于修复C中的安全漏洞。
translated by 谷歌翻译
代码克隆是实现类似功能的代码段对。克隆检测是自动源代码理解的基本分支,在重构建议,窃检测和代码摘要中具有许多应用程序。克隆检测的一个特别有趣的案例是检测语义克隆,即具有相同功能但实现方面有显着差异的代码段。检测语义克隆的一种有希望的方法是对比度学习(CL),这是一种在计算机视觉中流行的机器学习范式,但尚未用于代码处理。我们的工作旨在评估最受欢迎的CL算法以及两个任务上的三个源代码表示形式。第一个任务是代码克隆检测,我们在包含104个算法的实现的POJ-104数据集上进行了评估。第二个任务是窃检测。为了评估此任务上的模型,我们介绍了CodeTransFormator,这是用于转换源代码的工具。我们使用它来创建一个基于竞争性编程解决方案模仿窃代码的数据集。我们为这两项任务培训了九个模型,并将其与现有的六种方法进行了比较,包括传统工具和现代培训的神经模型。我们评估的结果表明,提议的模型在每个任务中都具有多样性,但是基于图的模型的性能通常高于其他模型。在CL算法中,SIMCLR和SWAV带来更好的结果,而MoCo是最强大的方法。我们的代码和训练有素的模型可在https://doi.org/10.5281/zenodo.6360627,https://doi.org/10.5281/zenodo.5596345获得。
translated by 谷歌翻译
在本文中,我们利用低级编译器中间表示(IR)来改善代码翻译。传统的转运器依赖于句法信息和手工制作的规则,这限制了其适用性并产生不自然的代码。将神经机器翻译(NMT)方法应用于代码,已成功扩大了可以获得自然翻译的程序集。但是,它们将代码视为文本令牌的序列,并且在具有不同语言的语义不同的类似代码之间仍然没有足够的区分。结果是低质量的翻译,降低了NMT的实用性,并强调对方法的需求显着提高了其准确性。在这里,我们建议与IRS,特别是LLVM IR增强代码翻译,并在C ++,Java,Rust和Go语言上进行结果。我们的方法改善了无监督的代码翻译的最新技术状态,将正确翻译的数量平均增加了11%,而Java -Rust Pair则最多可提高79%。我们通过添加数百个GO和RUST功能来扩展代码翻译的先前测试集。此外,我们在IR代表问题,从IR生成编程源代码以及使用IRS作为中介枢轴进行翻译的研究。
translated by 谷歌翻译
自动化程序维修(APR)旨在自动修复源代码中的错误。最近,随着深度学习(DL)领域的进步,神经程序修复(NPR)研究的兴起,该研究将APR作为翻译任务从Buggy Code开始,以纠正代码并采用基于编码器decoder架构的神经网络。与其他APR技术相比,NPR方法在适用性方面具有很大的优势,因为它们不需要任何规范(即测试套件)。尽管NPR一直是一个热门的研究方向,但该领域还没有任何概述。为了帮助感兴趣的读者了解现有NPR系统的体系结构,挑战和相应的解决方案,我们对本文的最新研究进行了文献综述。我们首先介绍该领域的背景知识。接下来,要理解,我们将NPR过程分解为一系列模块,并在每个模块上阐述各种设计选择。此外,我们确定了一些挑战并讨论现有解决方案的影响。最后,我们得出结论,并为未来的研究提供了一些有希望的方向。
translated by 谷歌翻译
Decompilation aims to transform a low-level program language (LPL) (eg., binary file) into its functionally-equivalent high-level program language (HPL) (e.g., C/C++). It is a core technology in software security, especially in vulnerability discovery and malware analysis. In recent years, with the successful application of neural machine translation (NMT) models in natural language processing (NLP), researchers have tried to build neural decompilers by borrowing the idea of NMT. They formulate the decompilation process as a translation problem between LPL and HPL, aiming to reduce the human cost required to develop decompilation tools and improve their generalizability. However, state-of-the-art learning-based decompilers do not cope well with compiler-optimized binaries. Since real-world binaries are mostly compiler-optimized, decompilers that do not consider optimized binaries have limited practical significance. In this paper, we propose a novel learning-based approach named NeurDP, that targets compiler-optimized binaries. NeurDP uses a graph neural network (GNN) model to convert LPL to an intermediate representation (IR), which bridges the gap between source code and optimized binary. We also design an Optimized Translation Unit (OTU) to split functions into smaller code fragments for better translation performance. Evaluation results on datasets containing various types of statements show that NeurDP can decompile optimized binaries with 45.21% higher accuracy than state-of-the-art neural decompilation frameworks.
translated by 谷歌翻译
大型语言模型,例如OpenAI的法典和DeepMind的字母,可以生成代码来解决以自然语言表达的各种问题。这项技术已经在至少一项广泛使用的编程编辑器扩展程序中进行了商业化:Github Copilot。在本文中,我们探讨了具有大型语言模型(LLM辅助编程)的编程与程序员协助的先前概念化相似,并且与众不同。我们借鉴了公开可用的经验报告,有关LLM辅助编程以及先前的可用性和设计研究。我们发现,尽管LLM辅助编程通过搜索和重用分享了一些编译,配对编程和编程的属性,但技术可能性和实践经验都存在根本差异。因此,应该将LLM辅助编程视为具有自己独特的属性和挑战的新方法。最后,我们借鉴了用户研究的观察结果,在该观察中,非专家最终用户程序员使用LLM辅助工具来求解电子表格中的数据任务。我们讨论可能出现的问题,并在将大型语言模型应用于最终用户编程时,尤其是对于几乎没有编程专业知识的用户。
translated by 谷歌翻译
Deep learning has had a significant impact on many fields. Recently, code-to-code neural models have been used in code translation, code refinement and decompilation. However, the question of whether these models can automate compilation has yet to be investigated. In this work, we explore neural compilation, building and evaluating Transformer models that learn how to produce x86 assembler from C code. Although preliminary results are relatively weak, we make our data, models and code publicly available to encourage further research in this area.
translated by 谷歌翻译
反向工程师受益于二进制中的标识符(例如函数名称)的存在,但通常将其删除以释放。训练机器学习模型自动预测功能名称是有希望的,但从根本上讲很难:与自然语言中的单词不同,大多数函数名称仅出现一次。在本文中,我们通过引入极端功能标签(XFL)来解决此问题,这是一种极端的多标签学习方法,可为二进制功能选择适当的标签。 XFL将函数名称分为代币,将每个功能视为具有自然语言标记文本的问题的信息标签。我们将二进制代码的语义与通过dexter进行标签,这是一种新颖的函数,将基于静态分析的特征与来自呼叫图的本地上下文和整个二进制的全局上下文相结合。我们证明,XFL/Dexter在Debian Project的10,047个二进制数据集上的功能标签上优于最新技术,获得了83.5%的精度。我们还研究了XFL与文献中的替代二进制嵌入的组合,并表明Dexter始终为这项任务做得最好。结果,我们证明了二进制函数标记可以通过多标签学习有效地措辞,并且二进制函数嵌入得益于包括明确的语义特征。
translated by 谷歌翻译
Code completion aims to help improve developers' productivity by suggesting the next code tokens from a given context. Various approaches have been proposed to incorporate abstract syntax tree (AST) information for model training, ensuring that code completion is aware of the syntax of the programming languages. However, existing syntax-aware code completion approaches are not on-the-fly, as we found that for every two-thirds of characters that developers type, AST fails to be extracted because it requires the syntactically correct source code, limiting its practicality in real-world scenarios. On the other hand, existing on-the-fly code completion does not consider syntactic information yet. In this paper, we propose PyCoder to leverage token types, a kind of lightweight syntactic information, which is readily available and aligns with the natural order of source code. Our PyCoder is trained in a multi-task training manner so that by learning the supporting task of predicting token types during the training phase, the models achieve better performance on predicting tokens and lines of code without the need for token types in the inference phase. Comprehensive experiments show that PyCoder achieves the first rank on the CodeXGLUE leaderboard with an accuracy of 77.12% for the token-level predictions, which is 0.43%-24.25% more accurate than baselines. In addition, PyCoder achieves an exact match of 43.37% for the line-level predictions, which is 3.63%-84.73% more accurate than baselines. These results lead us to conclude that token type information (an alternative to syntactic information) that is rarely used in the past can greatly improve the performance of code completion approaches, without requiring the syntactically correct source code like AST-based approaches do. Our PyCoder is publicly available on HuggingFace.
translated by 谷歌翻译
The International Workshop on Reading Music Systems (WoRMS) is a workshop that tries to connect researchers who develop systems for reading music, such as in the field of Optical Music Recognition, with other researchers and practitioners that could benefit from such systems, like librarians or musicologists. The relevant topics of interest for the workshop include, but are not limited to: Music reading systems; Optical music recognition; Datasets and performance evaluation; Image processing on music scores; Writer identification; Authoring, editing, storing and presentation systems for music scores; Multi-modal systems; Novel input-methods for music to produce written music; Web-based Music Information Retrieval services; Applications and projects; Use-cases related to written music. These are the proceedings of the 3rd International Workshop on Reading Music Systems, held in Alicante on the 23rd of July 2021.
translated by 谷歌翻译
源代码存储库由大型代码库组成,通常包含容易发生的程序。软件的复杂性日益增加导致时间和识别这些缺陷的时间和成本急剧上升。存在各种方法可以自动生成错误代码的修复程序。但是,由于特定错误的可能解决方案的组合空间很大,因此没有很多工具和数据集可以有效地评估生成的代码。在这项工作中,我们介绍了FixeVal,这是一个基准,其中包括竞争性编程问题及其各自修复程序的基准。我们引入了丰富的测试套件,以评估和评估模型生成程序修复的正确性。我们将两种在编程语言上鉴定的变压器语言模型视为我们的基准,并使用基于匹配和基于执行的评估指标对其进行比较。我们的实验表明,基于匹配的指标不能准确反映模型生成的程序修复,而基于执行的方法通过专门为该解决方案设计的所有情况和场景评估程序。因此,我们认为FixeVal提供了朝着实际自动错误修复和模型生成的代码评估的步骤。
translated by 谷歌翻译
This paper presents the OPUS ecosystem with a focus on the development of open machine translation models and tools, and their integration into end-user applications, development platforms and professional workflows. We discuss our on-going mission of increasing language coverage and translation quality, and also describe on-going work on the development of modular translation models and speed-optimized compact solutions for real-time translation on regular desktops and small devices.
translated by 谷歌翻译
源代码的最先进的神经模型倾向于在代码的生成时进行评估,并且通常在长地平任务中的产生,例如整个方法体的产生。我们建议使用静态程序分析仪的弱监督来解决这一缺陷。我们的神经统计方法允许深入的生成模型来象征地计算它已经生成的代码中的静态分析工具,长距离语义关系。在培训期间,该模型观察这些关系,并学习生成条件上的程序。考虑到包含该方法的类的剩余部分,我们将我们的方法应用于生成整个Java方法的问题。我们的实验表明,该方法显着地优于最先进的变换器和模型,明确试图在制作程序中没有基本语义错误的程序以及在句法匹配地面真理方面来学习此任务的模型。
translated by 谷歌翻译
变量名称对于传达预期的程序行为至关重要。基于机器学习的程序分析方法使用变量名称表示广泛的任务,例如建议新的变量名称和错误检测。理想情况下,这些方法可以捕获句法相似性的名称之间的语义关系,例如,名称平均和均值的事实是相似的。不幸的是,以前的工作发现,即使是先前的最佳的表示方法主要是捕获相关性(是否有两个变量始终链接),而不是相似性(是否具有相同的含义)。我们提出了VarCLR,一种用于学习变量名称的语义表示的新方法,这些方法有效地捕获了这种更严格的意义上的可变相似性。我们观察到这个问题是对比学习的优秀契合,旨在最小化明确类似的输入之间的距离,同时最大化不同输入之间的距离。这需要标记的培训数据,因此我们构建了一种新颖的弱监督的变量重命名数据集,从GitHub编辑开采。我们表明VarCLR能够有效地应用BERT等复杂的通用语言模型,以变为变量名称表示,因此也是与变量名称相似性搜索或拼写校正等相关的下游任务。 varclr产生模型,显着越优于idbench的最先进的现有基准,明确地捕获可变相似度(与相关性不同)。最后,我们贡献了所有数据,代码和预先训练模型的版本,旨在为现有或未来程序分析中使用的可变表示提供的可变表示的替代品。
translated by 谷歌翻译