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?


2 Answers 2


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.

  • $\begingroup$ 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. $\endgroup$
    – Landon G
    Commented Apr 11, 2020 at 21:10
  • $\begingroup$ 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. $\endgroup$
    – nbro
    Commented Apr 13, 2020 at 17:27

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, 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) 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 and genetic programming respectively, that can do this to some extent; see the answers to this question 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) 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, which also suggests that ML-based solutions may not be enough to solve many tasks.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .