12
$\begingroup$

I have been looking into Viv, an artificial intelligent agent in development. Here is a demonstration of Viv (by Dag Kittlaus).

Based on what I understand, this AI can generate new code and execute it based on a query from the user.

What I am curious to know is how this AI can learn to generate code based on some query. What kind of machine learning algorithms are involved in this process?

One thing I considered is breaking down a dataset of programs by step. For example, here is the code to take an average of 5 terms

  1. Add all 5 terms together
  2. Divide by 5

Then I would train an algorithm to convert text to code. That is as far as I have figured out. However, I haven't tried anything because I'm not sure where to start.

Does anybody have any ideas on how Viv is implemented?

$\endgroup$
2
  • 1
    $\begingroup$ I was looking into genetic algorithms and things of that sort when I came across this video: Genetic Algorithms for Automated Source Code Evolution: a C++11 tutorial by David Miller, who seems to know what he's doing. I watched like 20 minutes of it. Interesting stuff and he goes step by step with everything. $\endgroup$
    – rarman555
    Feb 10, 2017 at 8:13
  • $\begingroup$ I wouldn't be surprised if it's based on NLP and statistical models that consider existing codes that are associated with comments/documents. So some paraphrasing models for the comments to cover a wide rage of tests, and some correction models after getting the initial draft of the code. This is my guess. $\endgroup$
    – Yahya
    Aug 1, 2021 at 21:40

1 Answer 1

1
$\begingroup$

4 years and 6 months have past since your unanswered question.

That is an eternity in terms of Machine Learning and things have evolved a lot. So I will answer about the present, not the past.

Today, there are some code generating models, like GitHub Copilot and OpenAi Codex which are based on NLG (Natural Language Generation). The principle is very simple:

  1. Make a huge (billions of parameters) model to predict the next "word" (token) in a sequence of text.
  2. Train that model with all available data you can find, and it will understand our language and all kinds of concepts, from philosophy to medicine (that's a GPT).
  3. Then you fine-tune it to perform well in programming code, specially in a database filled with code comments.

And now you have a highly capable model for code prediction (generation) from a comment (imperative natural language query).


There are also other AI strategies for code prediction, like https://www.tabnine.com/

$\endgroup$

You must log in to answer this question.

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