Answers.Body: <p>I am not an expert on this specific topic, but I can say a few words. I will use the term &quot;programming&quot; to refer to software development (of any kind).</p>
  <blockquote>
  <p>If you are in the camp that this isn't that hard, why hasn't it become mainstream?</p>
  </blockquote>
  <p>It's definitely hard, otherwise, we would have already some useful artificial programmers.</p>
  <blockquote>
  <p>Why is creating AI that can code a hard task?</p>
  </blockquote>
  <p>Programming is actually a hard task because it often requires creativity and a deep understanding of the context(s), goal(s), programming languages, etc. In other words, it's a very complex task (even for humans), apart from the exceptions where you can copy and paste.</p>
  <p>Programming can probably be considered <a href="https://ai.stackexchange.com/a/12147/2444">an AI-complete problem</a>, i.e. a problem that probably requires an AGI to be solved. In other words, if an AI was as capable as humans in terms of programming, then that probably means it is an AGI (but this is not guaranteed), i.e. programming is a task that probably requires general intelligence. This is why I say that programming is an AI-complete problem. However, note that being able to program is just <a href="https://en.wikipedia.org/wiki/Necessity_and_sufficiency" rel="nofollow noreferrer">a necessary (but not sufficient)</a> ability that an AI needs to possess in order for it to be an AGI (although not all general intelligences, e.g. animals, may be able to develop software, but the definition of general intelligence is also fuzzy).</p>
  <p>AFAIK, no AGI has yet been created, and I think we are still very far away from that goal. Currently, most AI systems are only able to tackle a specific problem (i.e. we only have narrow AIs, such as AlphaGo). You could say that programming is a very specific problem too, but this is misleading or wrong, because, unless you just want to develop very specific programs in a very limited context (and there are already machine learning models and approaches, such as <a href="https://arxiv.org/pdf/1511.06279.pdf" rel="nofollow noreferrer"><strong>neural programmer-interpreters</strong></a> and <strong>genetic programming</strong> respectively, that can do this to some extent; see the answers to <a href="https://ai.stackexchange.com/q/7364/2444">this question</a> for other examples), then you will need to know a lot about other contexts too. For example, consider the task of developing a program that can detect signs of cancer in images. To develop this program, the AI would need to have the knowledge of an AI engineer, doctor, etc.</p>
  <p>Furthermore, programming often requires common-sense knowledge. For example, while reading the software specifications, the AI needs to interpret them in the way that they were originally meant to be interpreted. This also suggests that <a href="https://ai.stackexchange.com/a/13262/2444">programming requires an AGI (or human-level AI)</a> to be solved.</p>
  <p>(Finally, to address a comment, note that writing a 4-line program is not equivalent to writing a 10-line program. Also, the length of the program often doesn't correspond to its difficulty or complexity, so that alone is not a good measure of the ability to program.)</p>
  <blockquote>
  <p>What are the barriers/problems we have to solve before we can solve this problem?</p>
  </blockquote>
  <p>I think that the answer to this question is also the answer to the question &quot;How can we create an AGI?&quot;. However, to be more concrete, I think that, in order to be able to create an AI that is able to program as well as humans, we will need to be able to create an AI that is able to think about low- and high-level concepts, compose them and it will probably require common-sense knowledge (so knowledge representation). A typical supervised learning solution will not be enough to solve this task. See the paper <a href="https://arxiv.org/pdf/1901.02918.pdf" rel="nofollow noreferrer">Making AI Meaningful Again</a>, which also suggests that ML-based solutions may not be enough to solve many tasks.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-09T15:26:14.213Z
Answers.LastActivityDate: 2020-12-07T14:26:44.777Z
Answers.LastEditDate: 2020-12-07T14:26:44.777Z
Answers.UserDisplayName: nbro
Answers.Body: <p>AI has been applied to programming (check out TabNine, my favorite autocomplete engine) although not in as robust a fashion as you describe. </p>
  
  <p>Programming requires a high level of abstract while AI is typically trained to solve a very specific task. Given thousands of examples of insert sort in Python I think a model could be trained (perhaps after autocomplete and syntax correction) figure it out. However at this point the field has not developed a more general intelligence that can apply the ideas of the algorithm to other problems.</p>
  
  <p>Addition based on comments:</p>
  
  <p>Big picture, training an algorithm to solve a general class of problems (say, web dev) requires a huge number of examples or an immense number of trials. Further, as the complexity of the problem grows the number of parameters necessary to build the model grows. Writing code is a very complex problem and would thus require a huge amount of data and a huge number of parameters making it totally infeasible with today's math and (because of how the math is solved) hardware.</p>
  
  <p>Modern AI is has a very simple goal: find the model that solves a problem optimally. If we could quickly search every possible model this would be simple. Fields like machine (deep) learning and reinforcement learning are concerned with finding a good solution in a reasonable amount of time. At this point no such solution exists for a problem of such complexity. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-11T21:10:25.297Z
Answers.Text: thank you for the response and you have some good points. To add one more question, what is stopping our current techniques in "narrow AI" from achieving this goal? If given enough data, do you think this could be solved with narrow AI? Is this not a problem that can be solved with just "more data"? Is this generally unreachable with current techniques? I'd like to hear your thoughts and again thank you for the response.
Answers.UserDisplayName: Landon G
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-13T17:27:38.300Z
Answers.Text: As you say, TabNine isn't really an AI that codes, it's just an auto-completion system. So, in my opinion, it has little to do with the question, so it can be misleading. Anyway, it's not a big problem to mention AI applied in software development tasks.
Answers.UserDisplayName: nbro
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-09T04:38:03.273Z
Answers.LastActivityDate: 2020-04-13T02:39:00.257Z
Answers.LastEditDate: 2020-04-13T02:39:00.257Z
Answers.UserDisplayName: Chris
Body: <p>For people who have experience in the field, why is creating AI that has the ability to write programs (that are syntactically correct and useful) a hard task? </p>
  
  <p>What are the barriers/problems we have to solve before we can solve this problem? If you are in the camp that this isn't that hard, why hasn't it become mainstream?</p>
  
Tags: <machine-learning><philosophy><genetic-programming><ai-completeness><inductive-programming>
Title: Why is creating an AI that can code a hard task?
UserDisplayName: Landon G
ThreadText: # Why is creating an AI that can code a hard task?
  
  (Asked by: username_0 on 2020-04-08)
  
  For people who have experience in the field, why is creating AI that has the ability to write programs (that are syntactically correct and useful) a hard task?
  
  What are the barriers/problems we have to solve before we can solve this problem? If you are in the camp that this isn't that hard, why hasn't it become mainstream?
  
  **Tags:** machine-learning, philosophy, genetic-programming, ai-completeness, inductive-programming
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2020-04-09. Score: 2 | Accepted answer
  
  AI has been applied to programming (check out TabNine, my favorite autocomplete engine) although not in as robust a fashion as you describe.
  
  Programming requires a high level of abstract while AI is typically trained to solve a very specific task. Given thousands of examples of insert sort in Python I think a model could be trained (perhaps after autocomplete and syntax correction) figure it out. However at this point the field has not developed a more general intelligence that can apply the ideas of the algorithm to other problems.
  
  Addition based on comments:
  
  Big picture, training an algorithm to solve a general class of problems (say, web dev) requires a huge number of examples or an immense number of trials. Further, as the complexity of the problem grows the number of parameters necessary to build the model grows. Writing code is a very complex problem and would thus require a huge amount of data and a huge number of parameters making it totally infeasible with today's math and (because of how the math is solved) hardware.
  
  Modern AI is has a very simple goal: find the model that solves a problem optimally. If we could quickly search every possible model this would be simple. Fields like machine (deep) learning and reinforcement learning are concerned with finding a good solution in a reasonable amount of time. At this point no such solution exists for a problem of such complexity.
  
  > **Comments:**
  > **username_0**: thank you for the response and you have some good points. To add one more question, what is stopping our current techniques in "narrow AI" from achieving this goal? If given enough data, do you think this could be solved with narrow AI? Is this not a problem that can be solved with just "more data"? Is this generally unreachable with current techniques? I'd like to hear your thoughts and again thank you for the response.  
  > **username_1**: As you say, TabNine isn't really an AI that codes, it's just an auto-completion system. So, in my opinion, it has little to do with the question, so it can be misleading. Anyway, it's not a big problem to mention AI applied in software development tasks.  
  
  ---
  
  ### Answer by username_1 on 2020-04-09. Score: 1
  
  I am not an expert on this specific topic, but I can say a few words. I will use the term "programming" to refer to software development (of any kind).
  
  > If you are in the camp that this isn't that hard, why hasn't it become mainstream?
  
  It's definitely hard, otherwise, we would have already some useful artificial programmers.
  
  > Why is creating AI that can code a hard task?
  
  Programming is actually a hard task because it often requires creativity and a deep understanding of the context(s), goal(s), programming languages, etc. In other words, it's a very complex task (even for humans), apart from the exceptions where you can copy and paste.
  
  Programming can probably be considered [an AI-complete problem](https://ai.stackexchange.com/a/12147/2444), i.e. a problem that probably requires an AGI to be solved. In other words, if an AI was as capable as humans in terms of programming, then that probably means it is an AGI (but this is not guaranteed), i.e. programming is a task that probably requires general intelligence. This is why I say that programming is an AI-complete problem. However, note that being able to program is just [a necessary (but not sufficient)](https://en.wikipedia.org/wiki/Necessity_and_sufficiency) ability that an AI needs to possess in order for it to be an AGI (although not all general intelligences, e.g. animals, may be able to develop software, but the definition of general intelligence is also fuzzy).
  
  AFAIK, no AGI has yet been created, and I think we are still very far away from that goal. Currently, most AI systems are only able to tackle a specific problem (i.e. we only have narrow AIs, such as AlphaGo). You could say that programming is a very specific problem too, but this is misleading or wrong, because, unless you just want to develop very specific programs in a very limited context (and there are already machine learning models and approaches, such as [**neural programmer-interpreters**](https://arxiv.org/pdf/1511.06279.pdf) and **genetic programming** respectively, that can do this to some extent; see the answers to [this question](https://ai.stackexchange.com/q/7364/2444) for other examples), then you will need to know a lot about other contexts too. For example, consider the task of developing a program that can detect signs of cancer in images. To develop this program, the AI would need to have the knowledge of an AI engineer, doctor, etc.
  
  Furthermore, programming often requires common-sense knowledge. For example, while reading the software specifications, the AI needs to interpret them in the way that they were originally meant to be interpreted. This also suggests that [programming requires an AGI (or human-level AI)](https://ai.stackexchange.com/a/13262/2444) to be solved.
  
  (Finally, to address a comment, note that writing a 4-line program is not equivalent to writing a 10-line program. Also, the length of the program often doesn't correspond to its difficulty or complexity, so that alone is not a good measure of the ability to program.)
  
  > What are the barriers/problems we have to solve before we can solve this problem?
  
  I think that the answer to this question is also the answer to the question "How can we create an AGI?". However, to be more concrete, I think that, in order to be able to create an AI that is able to program as well as humans, we will need to be able to create an AI that is able to think about low- and high-level concepts, compose them and it will probably require common-sense knowledge (so knowledge representation). A typical supervised learning solution will not be enough to solve this task. See the paper [Making AI Meaningful Again](https://arxiv.org/pdf/1901.02918.pdf), which also suggests that ML-based solutions may not be enough to solve many tasks.
  
  
  ---
  
  