{"id":25653,"date":"2023-08-25T17:18:27","date_gmt":"2023-08-25T15:18:27","guid":{"rendered":"https:\/\/blog.mi.hdm-stuttgart.de\/?p=25653"},"modified":"2023-08-25T17:29:28","modified_gmt":"2023-08-25T15:29:28","slug":"automated-program-repair-using-machine-learning","status":"publish","type":"post","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2023\/08\/25\/automated-program-repair-using-machine-learning\/","title":{"rendered":"Automated Program Repair using Machine Learning"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Table of Contents<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#what-you-will-not-read-about\">What you will not read about<\/a><\/li>\n\n\n\n<li><a href=\"#introduction\">Introduction<\/a><\/li>\n\n\n\n<li><a href=\"#why-do-we-want-it\">Why do we want it?<\/a><\/li>\n\n\n\n<li><a href=\"#why-language-models-in-apr\">Why Language Models in APR?<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#codebert\">CodeBERT<\/a><\/li>\n\n\n\n<li><a href=\"#chatgpt\">ChatGPT<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#what-may-the-future-bring\">What may the future bring?<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-you-will-not-read-about\">What you will not read about<\/h2>\n\n\n\n<p>Many times before and in plenty of other articles, the how&#8217;s and why&#8217;s behind the transformer architecture and the attention mechanism have been discussed. To me, it&#8217;s clear, that the original paper <em>Attention is all you need<\/em> (Ashish Vaswani 2017) might as well be one of the most influential papers in the history of deep learning, thus far. That said, a summary of the functionality cannot be provided here, since this would go beyond the limits of this article. Intentionally, it has been written, such that only basic prior knowledge in the field is necessary, to grasp the gist of this article. Nevertheless, especially with the importance of the underlying architecture for the mentioned models, reading up on the topic is worthwhile. Following are two resources, that may explain to you the most important parts or provide you a deep dive into the topic:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Comprehensive summary of the original paper:\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/hub.packtpub.com\/paper-in-two-minutes-attention-is-all-you-need\/\">Paper in two minutes: Attention is all you need<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Deep dive into the nitty-gritty details:\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=n9sLZPLOxG8\">How do transformers work? (Attention is all you need)<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"introduction\">Introduction<\/h2>\n\n\n\n<p><em>New research from Rollbar, the leading continuous code improvement platform, indicates that the overwhelming majority (88%) of developers feel that traditional error monitoring falls short of their expectations. The December survey of 950 developers also reveals that fixing bugs and errors in code is developers\u2019 No. 1 pain point.<\/em> (Black 2021) This is the first paragraph of a research summary by businesswire and I think many of us would agree with the last statement. The study states further, that 32% of developers spend up to 10 hours a week to fix bugs and some others exceed even that. It is also suggested by the study, that respondence to errors affects productivity, moral and even quality of life.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-do-we-want-it\">Why do we want it?<\/h2>\n\n\n\n<p>The incentive to automate fixing of bugs is clear, if we look at those statements. With bug fixing taking up to a quarter of an average working week for a third of developers, it is quite obvious why companies would want such assistance. Leaving the lost potential of the coding workforce aside, we all can think of a scenario in which we spend hours upon hours to find a bug in our code, that may end up being just a missing semicolon. For those lucky people not knowing what I&#8217;m talking about: &#8220;May the force be with you.&#8221; &#8211; Yoda.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-language-models-in-apr\">Why Language Models in APR?<\/h2>\n\n\n\n<p><strong>Programming code can be described as a sequence of commands that a computer can understand.<\/strong> The instructions in code can involve various operations like control flow (conditionals, loops, etc.), data manipulation, calls to predefined functions\u2026 That we all learned in the first week of our first semester.<\/p>\n\n\n\n<p>The limitations on potential results of the execution are almost limitless. Hardware limitations aside, what stops programmers from solving a problem may only be their understanding of the problem, its complexity or the creative challange of finding a solution. (Heck, we even wrote code that resulted in a language model that very well may be capable of writing a text, as the one you are reading right now, given you asked the correct questions to create it.) Going back to the very beginning of this chapter. Natural Language (NL) could be described very similarly. Both follow three important aspects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Syntax<\/strong>: NL and PL have strict rules that govern the structure and organization of their expressions.<\/li>\n\n\n\n<li><strong>Comprehension<\/strong>: Reviewing lines of PL or reading a sentence of NL, both require comprehension of the read expressions, to make sense of them.<\/li>\n\n\n\n<li><strong>Communication<\/strong>: Both, NL and PL are means of communication. They convey information, express ideas and enable the transmission of instructions or concepts, from one entity to another.<\/li>\n<\/ul>\n\n\n\n<p>Because of the structural similarities, Large Language Models (LLM) have been adjusted and trained with that thought in mind or fine-tuned to fulfill the task of automated error detection and correction, also called Automated Program Repair (APR). Even tough there are plenty of other approaches to solve APR ((Asha Kutsa 2019), (Matsumoto and Nakamura 2021), (K K Sharma 2014), \u2026), especially with the point of comprehension in mind, LLM&#8217;s are deemed to be advantegeous in that field.<\/p>\n\n\n\n<p>Nowadays, there are multiple well-trained LLM&#8217;s capable of providing assistance in bug-fixing and offering ideas to improve code correctness or readability. For this article though, we will focus on two: ChatGPT v4 (OpenAI 2023) and CodeBERT (Zhangyin Feng 2020).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"codebert-vs-chatgpt\">CodeBERT vs. ChatGPT<\/h3>\n\n\n\n<p>CodeBERT is specialized in processing and enhancing various aspects of programming code, aiming to comprehend, generate, and improve code-related tasks like summarization, completion, and translation. In contrast, ChatGPT&#8217;s primary objective lies in enabling natural language interactions and generating human-like responses in diverse conversational scenarios. Although ChatGPT can understand code, its core purpose centers around facilitating interactive and coherent conversations with users.<br>Notably, CodeBERT could just be downloaded from huggingface, e.g. provided by Microsoft. The same cannot be said about the model of ChatGPT.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">CodeBERT<\/h3>\n\n\n\n<p><em>Source considered<\/em>: (Chunqiu Steven Xia 2022)<\/p>\n\n\n\n<p>BERT (Bidirectional Encoder Representations from Transformers) architecture is highly relevant in LLM as it pioneered pre-training and fine-tuning, leading to remarkable performance in various natural language processing tasks. Utilizing this architecture, the researchers introduce <em>AlphaRepair<\/em>. A cloze-style APR approach, leveraging large pre-trained models.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Goals<\/h4>\n\n\n\n<p>The aim is to directly generate patches for software bugs without the need for fine-tuning on historical bug fixes, overcoming the limitations of existing learning-based APR techniques and achieving improved performance on real-world systems in multiple programming languages. Similar to the paper (Dominik Sobania 2023), researchers used, together with other datasets, the QuixBugs dataset (Derrick Lin 2017) to conclude its capability. For comparability, we will focus on their evaluation using the QuixBugs dataset.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Training<\/h4>\n\n\n\n<p><em>Pre-training<\/em>:<br>CodeBERT is a pre-trained language model that was trained on a large corpus of publicly available source code from diverse open-source projects. By using a hybrid objective combining the concepts of masked language modelling (MLM) and replaced token detection, it learned to predict masked tokens in code snippets, gaining a deep understanding of code semantics and structures. This makes CodeBERT a powerful multilingual, bidirectional LLM.<\/p>\n\n\n\n<p><em>Fine-tuning<\/em>:<br>Different from ChatGPT, CodeBERT didn&#8217;t undergo any kind of specific fine-tuning for the purposes of the researchers&#8217; paper. While they mention, that fine-tuning on the specific task of APR, their goal was to evaluate the <em>zero-shot<\/em> capability of CodeBERT base model.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Targeted Use Case<\/h4>\n\n\n\n<p>The original paper &#8220;BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding&#8221;, as the name suggests, mostly cared about natural language. CodeBERT&#8217;s aim on the other hand was to &#8220;[\u2026] turn a buggy code into a fixed version.&#8221;; (Chunqiu Steven Xia 2022), page 2. An important idea to point out is, that they don&#8217;t try to model what a repair should look like, but rather figure out what is intended to be there in the first place, given the surrounding context information.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Success and Service<\/h4>\n\n\n\n<p>The researchers splitted the questian in success into three:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>How does AlphaRepair compare against state-of-the-art APR tools?<br>AlphaRepair outperforms state-of-the-art APR tools in perfect fault localization, generating correct fixes for 74 bugs and fixing the unique bugs (14). It handles challenging cases that other tools struggle with, introducing a promising direction for Automated Program Repair.<\/li>\n\n\n\n<li>How do different configurations impact the performance of AlphaRepair?<br>The ablation study on AlphaRepair evaluated different components&#8217; impact on its performance. It found that using template mask lines and encoding the buggy line significantly improved the number of correct patches. Additionally, the patch re-ranking strategy proved effective in prioritizing higher-ranked correct patches.<\/li>\n\n\n\n<li>What is the generalizability of AlphaRepair for additional projects and multiple programming languages?<br>AlphaRepair demonstrates impressive generalizability for additional projects and multiple programming languages. It outperforms other baselines on Defects4J 2.0, achieving the highest number of correct patches (36, 3.3X more than the top baseline). AlphaRepair&#8217;s multilingual repair capability is showcased on the QuixBugs dataset, achieving the highest number of correct patches in both Java and Python, making it a versatile and robust tool. <strong>It solves 28 of 30 Java bugs and 27 of 32 in Python.<\/strong> <\/li>\n<\/ol>\n\n\n\n<p>The researchers state multiple times, that the importance lays in the underlying understanding of the model for code. With the MLM in place, the model didn&#8217;t learn fix bugs pers\u00e9e. Rather, the model was trained to inherently understand code and being able to predict what is supposed to be there, given the surrounding context. Thus, it was never primed, to focus only on the task of APR specifically, which is what they highlight for its generalizability.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"chatgpt\">ChatGPT<\/h3>\n\n\n\n<p><em>Source considered<\/em>:&nbsp;(Dominik Sobania 2023)<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Goals<\/h4>\n\n\n\n<p>The goal of this work is to quantify the ability of the standard ChatGPT model, in terms of its ability to identify and fix errors in code. The researchers used the QuixBugs dataset (Derrick Lin 2017) to conclude its capability.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Training<\/h4>\n\n\n\n<p>ChatGPT was trained using a two-step process: pretraining and fine-tuning<\/p>\n\n\n\n<p><em>Pre-training<\/em>:<\/p>\n\n\n\n<p>ChatGPT was pretrained on a vast and diverse corpus of publicly available internet text to learn grammar, syntax, and a broad understanding of language. To handle this large-scale pretraining, it uses a variant of the Transformer architecture called GPT, which employs self-attention mechanisms for generating coherent responses by understanding word relationships.<\/p>\n\n\n\n<p><em>Fine-tuning<\/em>:<\/p>\n\n\n\n<p>After pretraining, ChatGPT undergoes fine-tuning on a more specific dataset tailored to the target tasks or domains. This process refines the model&#8217;s language understanding and generates relevant responses by learning from human feedback, resulting in improved performance through iterative training. Unfortunately, the datasets used for fine-tuning the resulting model are not publicly disclosed. So, we don&#8217;t really know which goals the fine-tuning aimed for.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Targeted Use Case<\/h4>\n\n\n\n<p>The overall target use case of ChatGPT is to provide an AI-powered conversational agent that can engage in human-like conversations with users. ChatGPT is designed to understand and generate natural language responses in a wide range of conversational contexts. From translations of natural language, to customer support, ChatGPT is capable of providing assistance, with various degrees of freedoms and success.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Success and Service<\/h4>\n\n\n\n<p>Since the main topic of this article is APR, this next section will be dedicated to this solely, leaving out potential other successes ChatGPT is, or may be capable of.<\/p>\n\n\n\n<p>As mentioned in the subchapter Training for ChatGPT, we don&#8217;t know on which or what kind of datasets the model has been trained on specifically. Neither do we know, which use cases have been covered in the fine-tuning process. If, e.g. the human-in-the-loop fine-tuning also contained the creation of code snippets. Thus, every chat about comparing the models in regard to their training will, inevitably, result in speculation.<\/p>\n\n\n\n<p>We will jduge the results of ChatGPT based on the results presented in (Dominik Sobania 2023). Tested were 40 of the problems, present in the QuixBugs. The researchers compare multiple state-of-the-art models for APR against the same problems. Evaluated were the following works, vs the current state &#8211; at that time &#8211;&nbsp;of ChatGPT: Codex (H. Ye and Monperrus 2021), CoCoNut (T. Lutellier and L. Tan 2020), Standard APR (J. A. Prenner and Robbes 2022).<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Benchmark Problems<\/th><th>ChatGPT<\/th><th>Codex<\/th><th>CoCoNut<\/th><th>Standard APR<\/th><\/tr><\/thead><tbody><tr><td><strong>Sum<\/strong><\/td><td>19<\/td><td>21<\/td><td>19<\/td><td>7<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\"><em>Summarization of the results, presented in <em>(Dominik Sobania 2023)<\/em><\/em><\/figcaption><\/figure>\n\n\n\n<p>For ChatGPT, they prefixed all their requests by the following preamble: &#8220;Does this program have a bug? How to fix it?&#8221;. Of the 40 given problems in the QuixBugs dataset, ChatGPT was able to solve 19, within 4 tries respectively. If one of the 4 tries resulted in a correct solution, the problem is considered solved. Taking a closer look at the results (page 4), we&#8217;ll notice, that only two benchmark problems are solved in all 4 runs. That is <em>Bucketsort<\/em> and <em>Flatten<\/em>. These results can lead to the interpretation that the model appears to have a high variance in its capability to succeed in the benchmark problems. Thus, rerunning the same request may be beneficial, in case of an erroneous output. Other than that, it&#8217;s not surprising, that ChatGPT solved about the same number of problems as the best-performing model Codex. This is due to the underlying similarities of the models, since they originate from the same family of language models (see: (OpenAI 23AD)).<\/p>\n\n\n\n<p>Upon closer inspection, the faulty responses are often close to the correct solution. Furthermore, ChatGPT often proposed a complete reimplementation, which was correct. But only patches fixing the erroneous part have been considered a correct solution.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/gpt_apr_response_classification.png\"><img loading=\"lazy\" decoding=\"async\" width=\"794\" height=\"231\" data-attachment-id=\"25661\" data-permalink=\"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2023\/08\/25\/automated-program-repair-using-machine-learning\/gpt_apr_response_classification\/\" data-orig-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/gpt_apr_response_classification.png\" data-orig-size=\"794,231\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"gpt_apr_response_classification\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/gpt_apr_response_classification.png\" src=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/gpt_apr_response_classification.png\" alt=\"\" class=\"wp-image-25661\" srcset=\"https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/gpt_apr_response_classification.png 794w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/gpt_apr_response_classification-300x87.png 300w, https:\/\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/gpt_apr_response_classification-768x223.png 768w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>Classification of responses, given by ChatGPT, classified into six classes.<\/em><\/figcaption><\/figure>\n\n\n\n<p>Interesting to point out here is an attempt of classification, by the researchers, to categorize the types of answers ChatGPT gave, when it was not able to solve the issue first try. The researchers categorized the outputs as follows, and kept track of their frequency in the figure above.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>More information required<\/strong>: Asks for more information on the program behaviour to identify the bug.<\/li>\n\n\n\n<li><strong>No bug found<\/strong>: Does not find a bug and states the program is working correctly.<\/li>\n\n\n\n<li>Correct fix provided: Provides the correct fix for the correct bug.<\/li>\n\n\n\n<li><strong>Tries to fix something else<\/strong>: Does not find the intended bug and tries to fix or advise on something else that is not really a bug or adjusts for edge cases.<\/li>\n\n\n\n<li><strong>Provides fix but introduces new bug<\/strong>: Provides the correct fix for the target bug but introduces a new bug somewhere else.<\/li>\n\n\n\n<li><strong>Alternative implementation<\/strong>: Does not fix the bug but gives a working alternative implementation.<\/li>\n\n\n\n<li><strong>Other<\/strong>: Every other answers given, not categorizable with the above.<\/li>\n<\/ul>\n\n\n\n<p>The vast majority of their categorization falls into the <em>More information required<\/em> class, with the second most occurrence being <em>No bug found<\/em>. For both of these cases, it can be beneficial to exploit the chatting capability of the model, to serve enhanced information in subsequent steps that may lead to a correct identification and fix of the original error.<\/p>\n\n\n\n<p>For two of the problems, they followed this idea and denoted their conversation in the paper. The chosen problems were <em>GDC<\/em> (find the greatest common divisor) and <em>BITCOUNT<\/em> (count the number of bits mandatory to represent a given scalar). Unfortunately, the denotation of the conversation about the <em>BITCOUNT<\/em> problem is a misleading and not sufficiently documented. But, the version for <em>GDC<\/em> is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\" data-line=\"\"># Request (1): \nDoes this program have a bug? How to fix it? \n\n    def gdc(a, b): \n        if b == 0: \n            return a\n        else: \n            return gdc(a % b, b)\n\n# Response (1):\nThis is the Euclidean algorithm for finding the greatest common divisor (GCD) \nof two integer s, a and b. It appears to be implemented correctly. If you are \nexperiencing issues with this program, it is likely that the problem lies \nelsewhere in your code. Without more information about the bug you are experiencing,\nit is difficult to say how to fix it.\n\n# Request (2): \nNo, the function is not correct. E.g., for the input a = 4 and b = 5 I get the \nfollowing error message: &quot;RecursionError: maximum recursion depth exceeded in comparison&quot;.\n\n# Response (2): \nThe issue is that the function calls itself recursively, and in some cases, \nit never reaches the base case (b == 0), causing it to recurse indefinitely. \nThe base case of the gcd algorithm is when the remainder is zero, but in this \nimplementation, it&#039;s when b is zero. For example, when a=4 and b=5, gcd(4, 5) is called,\nwhich then calls gcd(4 % 5, 5) which is gcd(4, 5). This causes an infinite loop.\n\nYou can fix this by swapping the parameters in the recursive call.\n\n    def gdc(a, b): \n        if a == 0: \n            return b\n        else: \n            return gdc(b % a, a)\n\nThis way, if a is zero, the function returns b (which is the gdc of a and b), \notherwise it calls itself with the new values of b % a and a. <\/code><\/pre>\n\n\n\n<p>As spoiled before, the conversational agent is capable of syntax, comprehension and communication (see: <a href=\"#why-language-models-in-apr\" title=\"\">Why Language Models in APR?<\/a>) greatly benefits from the ability to ask for more information and being able to link the responses in natural language to the code-snippet of discussion.<\/p>\n\n\n\n<p>In total, combined with first try solutions and given more information, 31 of the 40 problems in the QuixBugs dataset can be solved. (For the curious ones, the unsolved problems are the following: kheapsort, lcs-length, lis, longest-common-subsequence, rpn-eval, shortest-path-lengths, to-base, topological-ordering, wrap).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-may-the-future-bring\">What may the Future bring?<\/h2>\n\n\n\n<p>For the future, we have a couple of open points. First and foremost:<\/p>\n\n\n\n<p><strong>When is code correct?<\/strong> Reading through all the papers for the research of this blog entry, it turned out, that the different researchers had greatly varying definitions of correctness. Some being very strict, while others took quite loose approaches in defining their target use cases. A great improvement for the field would be a commonly agreed upon definition of tasks, that is held up for evaluation of datasets.<\/p>\n\n\n\n<p><strong>Datasets<\/strong> As it is with deep neural networks of any form, lots of quality data usually does the job. For fine-tuning, we would greatly benefit from more quality data and an easier data collection process. As of now, the data is scraped from open-source code bases, going through the commits and identifying the fixes for an existing bug. Other hopes may even include fixes in different magnitudes of performance.<\/p>\n\n\n\n<p><strong>Context Size<\/strong> Increasing the context size for input tokens to the models would come with plenty of potential. The initial ChatGPT4 model had context size of 8000 (8k), nowadays, it&#8217;s 32k tokens for the paid version. That roughly related to 24k words, as a tokens length typically is $3\/4$ of an English word. Anthropic even released a model with a context size of 100k. Just imagine a world in which you would just pass the path to a project to such an artificial intelligence (AI), and you may ask it to find security problems in the code.<\/p>\n\n\n\n<p><strong>A Programmers Dream<\/strong> Following is my personal interpretation on the topic and outlook on potential future usages of such techniques, in the context of APR. What is about to come does not comprehend any specific paper or mentions in Future Works paragraphs and solely based on what I would want this topic to progress to. That said, let&#8217;s dream:<\/p>\n\n\n\n<p>I could think of a scenario in which programming, to a certain extent, has become a mundane task. To some degrees, it already is, right? We tend to reinvent the wheel sporadically. May it be for the sake of improving existing code or infrastructure or simply not being aware, that exactly what you&#8217;ve needed is already implemented in a C-library, accessible via a simple python call. Now imagine: We could just write a short, but precise essay-like text in natural language, that describes what we are about to program. That essay may be interpreted by an AI, that is capable to comprehend the text, given the context it is used in and outputs you a skeleton for the project you plan to realize.<\/p>\n\n\n\n<p>Hierarchical structure, inherent to your project&#8217;s idea, is already implemented. The setup follows a state-of-the-art approach in regard to Design Patterns and applies those according to your needs. Inheritance for complex class structure is applied as needed, without you having to define that.<\/p>\n\n\n\n<p>Given that, you can really concentrate on the minute particulars of your implementation. The specific algorithm you&#8217;ve always wanted to implement, that will shake the very foundations of the world. Ok, maybe not that groundbreaking, but you get the point.<\/p>\n\n\n\n<p>Implementing a context manager in Python shouldn&#8217;t be necessary for setting up a connection to a data storage, such as a database. The purpose is to ensure that developers using it don&#8217;t need to worry about transactionality or basic tasks like closing the connection when it&#8217;s no longer required. Most of us know how to achieve this and plenty have implemented that specific functionality (and I&#8217;m willing to bet on that) more than once, throughout their carrier. Maybe, we could also receive tips for potential improvements, on the fly, while implementing said functionality. If you already imported Pandas and run a loop over a DataFrame, probably there is a way to avoid the need for a loop entirely, simply by using a highly used, well tested library, that you anyway use somewhere in your script. Or the AI could point out, that you may run into problems with all your pointer action in C, because you violated the basic idea of a Singleton. Programming could benefit invaluably from such a system.<\/p>\n\n\n\n<p>Given a system that is aware of the entire project&#8217;s code, the context it is supposed to be used in, the machine it will run on, \u2026, you name it &#8211; it could point you to flaws or improvements in your implementation, that you simply cannot grasp. Especially if you didn&#8217;t write all the code in the project. But the AI might, because it knows every line, every class and every possible permutation of interactions between the objects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ressources<\/h2>\n\n\n\n<p>Asha Kutsa, Garima Coudhary, Pauline Joseph. 2019. \u201cError Detection and Correction Using Machine Learning Concepts.\u201d&nbsp;<em>International Journal of Research in Engineering<\/em>.&nbsp;<a href=\"https:\/\/www.ijresm.com\/Vol.2_2019\/Vol2_Iss5_May19\/IJRESM_V2_I5_31.pdf\">https:\/\/www.ijresm.com\/Vol.2_2019\/Vol2_Iss5_May19\/IJRESM_V2_I5_31.pdf<\/a>.<\/p>\n\n\n\n<p>Ashish Vaswani, Niki Parmar, Noam Shazeer. 2017. \u201cAttention Is All You Need.\u201d&nbsp;<em>31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA<\/em>, 15.<\/p>\n\n\n\n<p>Black, Sara. 2021. \u201cRollbar Research Shows That Traditional Error Monitoring Is Missing the Mark.\u201d&nbsp;<a href=\"https:\/\/www.businesswire.com\/news\/home\/20210216005484\/en\/Rollbar-Research-Shows-That-Traditional-Error-Monitoring-Is-Missing-the-Mark\">https:\/\/www.businesswire.com\/news\/home\/20210216005484\/en\/Rollbar-Research-Shows-That-Traditional-Error-Monitoring-Is-Missing-the-Mark<\/a>.<\/p>\n\n\n\n<p>Chunqiu Steven Xia, Lingming Zhang. 2022. \u201cLess Training, More Repairing Please: Revisiting Automated Program Repair via Zero-Shot Learning.\u201d&nbsp;<a href=\"https:\/\/arxiv.org\/pdf\/2207.08281.pdf\">https:\/\/arxiv.org\/pdf\/2207.08281.pdf<\/a>.<\/p>\n\n\n\n<p>Derrick Lin, Angela Chen, James Koppel. 2017. \u201cQuixBugs: A Multi-Lingual Program Repair Benchmark Set Based on the Quixey Challenge.\u201d&nbsp;<a href=\"https:\/\/jkoppel.github.io\/QuixBugs\/quixbugs.pdf\">https:\/\/jkoppel.github.io\/QuixBugs\/quixbugs.pdf<\/a>.<\/p>\n\n\n\n<p>Dominik Sobania, Carol Hanna, Martin Briesch. 2023. \u201cAn Analysis of the Automatic Bug Fixing Performance of ChatGPT.\u201d&nbsp;<a href=\"https:\/\/arxiv.org\/pdf\/2301.08653.pdf\">https:\/\/arxiv.org\/pdf\/2301.08653.pdf<\/a>.<\/p>\n\n\n\n<p>H. Ye, T. Durieux, M. Martinez, and M. Monperrus. 2021. \u201cA Comprehensive Study of Automatic Program Repair on the QuixBugs Benchmark.\u201d&nbsp;<em>Joirnal of Systems and Software<\/em>&nbsp;171.<\/p>\n\n\n\n<p>J. A. Prenner, H. Babii, and R. Robbes. 2022. \u201cCan OpenAI\u2019s Codex Fix Bugs? An Evaluation on QuixBugs.\u201d&nbsp;<em>Proceedings of the Third International Workshop on Automated Program Repair<\/em>.<\/p>\n\n\n\n<p>K K Sharma, Indra Vikas, Kunal Banerjee. 2014. \u201cAutomated Checking of the Violation of Precedence of Conditions in Else-If Constructs in Students\u2019 Programs.\u201d&nbsp;<a href=\"https:\/\/ieeexplore.ieee.org\/abstract\/document\/7020271\">https:\/\/ieeexplore.ieee.org\/abstract\/document\/7020271<\/a>.<\/p>\n\n\n\n<p>Matsumoto, Yutaka Watanobe, Taku, and Keita Nakamura. 2021. \u201cA Model with Iterative Trials for Correcting Logic Errors in Source Code.\u201d&nbsp;<a href=\"https:\/\/www.mdpi.com\/2076-3417\/11\/11\/4755\">https:\/\/www.mdpi.com\/2076-3417\/11\/11\/4755<\/a>.<\/p>\n\n\n\n<p>OpenAI. 23AD. \u201cModel Index for Researcheres.\u201d&nbsp;<a href=\"https:\/\/platform.openai.com\/docs\/model-index-for-researchers\">https:\/\/platform.openai.com\/docs\/model-index-for-researchers<\/a>.<\/p>\n\n\n\n<p>\u2014\u2014\u2014. 2023. \u201cGPT-4 Technical Report.\u201d&nbsp;<a href=\"https:\/\/arxiv.org\/pdf\/2303.08774.pdf\">https:\/\/arxiv.org\/pdf\/2303.08774.pdf<\/a>.<\/p>\n\n\n\n<p>T. Lutellier, L. Pang, H. V. Pham, and L. Tan. 2020. \u201cCoCoNuT: Combining Context-Aware Neural Translation Models Using Ensemble for CoCoNut: Combining Context-Aware Neural Translation Models Using Ensemble for Program Repair.\u201d&nbsp;<em>ACM SigSoft International Symposium on Software Testing and Analysis<\/em>.<\/p>\n\n\n\n<p>Zhangyin Feng, Duyu Tang, Daya Guo. 2020. \u201cCodeBERT: A Pre-Trained Model for Programming and Natural Languages.\u201d&nbsp;<a href=\"https:\/\/arxiv.org\/pdf\/2002.08155.pdf\">https:\/\/arxiv.org\/pdf\/2002.08155.pdf<\/a>.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Utilizing Machine Learning for SOTA results in Automated Program Repair<\/p>\n","protected":false},"author":1135,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1,652,660,661,664,657],"tags":[57],"ppma_author":[895],"class_list":["post-25653","post","type-post","status-publish","format-standard","hentry","category-allgemein","category-artificial-intelligence","category-chatgpt-and-language-models","category-deep-learning","category-ethics","category-teaching-and-learning","tag-machine-learning"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":5576,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2019\/03\/04\/improved-vulnerability-detection-using-deep-representation-learning\/","url_meta":{"origin":25653,"position":0},"title":"Improved Vulnerability Detection using Deep Representation Learning","author":"Daniel Bruckner","date":"4. March 2019","format":false,"excerpt":"Today's software is more vulnerable to cyber attacks than ever before. The number of recorded vulnerabilities has almost constantly increased since the early 90s. The advantage of Deep Learning algorithms is that they can learn vulnerability patterns on their own and achieve a much better vulnerability detection performance. In this\u2026","rel":"","context":"In &quot;Allgemein&quot;","block_context":{"text":"Allgemein","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/allgemein\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2019\/03\/luca-bravo-217276-unsplash.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2019\/03\/luca-bravo-217276-unsplash.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2019\/03\/luca-bravo-217276-unsplash.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2019\/03\/luca-bravo-217276-unsplash.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2019\/03\/luca-bravo-217276-unsplash.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2019\/03\/luca-bravo-217276-unsplash.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":5262,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2019\/02\/26\/reproducibility-in-ml\/","url_meta":{"origin":25653,"position":1},"title":"Reproducibility in Machine Learning","author":"Pascal Fecht","date":"26. February 2019","format":false,"excerpt":"The rise of Machine Learning has led to changes across all areas of computer science. From a very abstract point of view, heuristics are replaced by black-box machine-learning algorithms providing \"better results\". But how do we actually quantify better results? ML-based solutions tend to focus more on absolute performance improvements\u2026","rel":"","context":"In &quot;Allgemein&quot;","block_context":{"text":"Allgemein","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/allgemein\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":23138,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2022\/03\/31\/an-overview-of-large-scale-deep-learning\/","url_meta":{"origin":25653,"position":2},"title":"An overview of Large Scale Deep Learning","author":"mk374","date":"31. March 2022","format":false,"excerpt":"article by Annika Strau\u00df (as426) and Maximilian Kaiser (mk374) Introduction Improving Deep Learning with ULS for superior model training Single Instance Single Device (SISD) Multi Instance Single Device (MISD) Multi Instance Multi Device (MIMD) Single Instance Multi Device (SIMD) Model parallelism Data parallelism Improving ULS and its components with the\u2026","rel":"","context":"In &quot;Allgemein&quot;","block_context":{"text":"Allgemein","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/allgemein\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/03\/quantum-physics-g1357f44f5_1920-Kopie.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/03\/quantum-physics-g1357f44f5_1920-Kopie.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/03\/quantum-physics-g1357f44f5_1920-Kopie.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/03\/quantum-physics-g1357f44f5_1920-Kopie.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/03\/quantum-physics-g1357f44f5_1920-Kopie.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2022\/03\/quantum-physics-g1357f44f5_1920-Kopie.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":24427,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2023\/03\/03\/ai-and-scaling-the-compute-for-the-new-moores-law\/","url_meta":{"origin":25653,"position":3},"title":"AI and Scaling the Compute for the new Moore\u2019s Law","author":"Marvin Blessing","date":"3. March 2023","format":false,"excerpt":"AI and Scaling the Compute becomes more relevant as the strive for larger language models and general purpose AI continues. The future of the trend is unknown as the rate of doubling the compute outpaces Moore's Law rate of every two year to a 3.4 month doubling. IntroductionRequiring compute beyond\u2026","rel":"","context":"In &quot;Artificial Intelligence&quot;","block_context":{"text":"Artificial Intelligence","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/artificial-intelligence\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/03\/image-4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/03\/image-4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/03\/image-4.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/03\/image-4.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/03\/image-4.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":6076,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2019\/03\/12\/large-scale-deployment-for-deep-learning-models-with-tensorflow-serving\/","url_meta":{"origin":25653,"position":4},"title":"Large Scale Deployment for Deep Learning Models with TensorFlow Serving","author":"Florian Wintel","date":"12. March 2019","format":false,"excerpt":"Image source Introduction \"How do you turn a trained model into a product, that will bring value to your enterprise?\" In recent years, serving has become a hot topic in machine learning. With the ongoing success of deep neural networks, there is a growing demand for solutions that address the\u2026","rel":"","context":"In &quot;Allgemein&quot;","block_context":{"text":"Allgemein","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/allgemein\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/serving_architecture-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/serving_architecture-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2023\/08\/serving_architecture-1.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":10442,"url":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/2020\/08\/19\/adversarial-attacks\/","url_meta":{"origin":25653,"position":5},"title":"The Dark Side of AI &#8211; Part 2: Adversarial Attacks","author":"Florian Wintel","date":"19. August 2020","format":false,"excerpt":"Find out how AI may become an attack vector! Could an attacker use your models against your? Also, what\u2019s the worst that could happen? Welcome to the domain of adversarial AI!","rel":"","context":"In &quot;Allgemein&quot;","block_context":{"text":"Allgemein","link":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/category\/allgemein\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/08\/fgsm_panda_image_preds_1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/08\/fgsm_panda_image_preds_1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/08\/fgsm_panda_image_preds_1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/08\/fgsm_panda_image_preds_1.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/08\/fgsm_panda_image_preds_1.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/blog.mi.hdm-stuttgart.de\/wp-content\/uploads\/2020\/08\/fgsm_panda_image_preds_1.png?resize=1400%2C800&ssl=1 4x"},"classes":[]}],"jetpack_sharing_enabled":true,"authors":[{"term_id":895,"user_id":1135,"is_guest":0,"slug":"nicolas_reinhart","display_name":"Nicolas Reinhart","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/1f74391c8be99c9e6af1b4e28bd3adc45a1cb008fffbaa7481737bd20e05c985?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/posts\/25653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/users\/1135"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/comments?post=25653"}],"version-history":[{"count":11,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/posts\/25653\/revisions"}],"predecessor-version":[{"id":25666,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/posts\/25653\/revisions\/25666"}],"wp:attachment":[{"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/media?parent=25653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/categories?post=25653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/tags?post=25653"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blog.mi.hdm-stuttgart.de\/index.php\/wp-json\/wp\/v2\/ppma_author?post=25653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}