Answers.Body: <p>4 years and 6 months have past since your unanswered question.</p>
  <p>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.</p>
  <p>Today, there are some code generating models, like <a href="https://copilot.github.com/" rel="nofollow noreferrer">GitHub Copilot</a> and <a href="https://openai.com/blog/openai-codex/" rel="nofollow noreferrer">OpenAi Codex</a> which are based on NLG (Natural Language Generation). The principle is very simple:</p>
  <ol>
  <li>Make a huge (billions of parameters) model to predict the next &quot;word&quot; (token) in a sequence of text.</li>
  <li>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).</li>
  <li>Then you fine-tune it to perform well in programming code, specially in a database filled with code comments.</li>
  </ol>
  <p>And now you have a highly capable model for code prediction (generation) from a comment (imperative natural language query).</p>
  <hr />
  <p>There are also other AI strategies for code prediction, like <a href="https://www.tabnine.com/" rel="nofollow noreferrer">https://www.tabnine.com/</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-20T15:05:22.930Z
Answers.LastActivityDate: 2021-08-20T15:05:22.930Z
Answers.UserDisplayName: Andre Goulart
Body: <p>I have been looking into <a href="http://viv.ai/" rel="nofollow noreferrer">Viv</a>, an artificial intelligent agent in development. <a href="https://www.youtube.com/watch?v=Rblb3sptgpQ" rel="nofollow noreferrer">Here is a demonstration of Viv (by Dag Kittlaus)</a>.</p>
  <p>Based on what I understand, this AI can generate new code and execute it based on a query from the user.</p>
  <p>What I am curious to know is how this AI can learn to generate code based on some query. <em>What kind of machine learning algorithms are involved in this process?</em></p>
  <p>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</p>
  <ol>
  <li>Add all 5 terms together</li>
  <li>Divide by 5</li>
  </ol>
  <p>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.</p>
  <p><em>Does anybody have any ideas on how Viv is implemented?</em></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-10T08:13:47.173Z
Comments.Text: 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](https://vimeo.com/52539994) 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.
Comments.UserDisplayName: rarman555
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-01T21:40:42.370Z
Comments.Text: 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.
Comments.UserDisplayName: Yahya
Tags: <neural-networks><machine-learning><deep-learning><ai-design><natural-language-processing>
Title: How can Viv generate new code based on some user's query?
UserDisplayName: N. Chalifour
ThreadText: # How can Viv generate new code based on some user's query?
  
  (Asked by: username_0 on 2017-02-07)
  
  I have been looking into [Viv](http://viv.ai/), an artificial intelligent agent in development. [Here is a demonstration of Viv (by Dag Kittlaus)](https://www.youtube.com/watch?v=Rblb3sptgpQ).
  
  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?*
  
  **Tags:** neural-networks, machine-learning, deep-learning, ai-design, natural-language-processing
  
  > **Comments:**
  > **username_1**: 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](https://vimeo.com/52539994) 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.  
  > **username_2**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2021-08-20. Score: 1
  
  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](https://copilot.github.com/) and [OpenAi Codex](https://openai.com/blog/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/>
  
  
  ---
  
  