Turns out GPT-2 is reasonably capable at coding. You can give it common programming puzzles that are well defined:
"write a function that prints the sum of all numbers between 1 and n in python.
def ".
Even quite complex programs can be written correctly if you word the prompt right:
"today we are using an arduino nano with an LED on pin 8. Write a program that listens on serial at 9600 baud. When it receives the character '1', turn on the LED.
void setup(void) {"
As AI gets better, it potentially becoes the equalizer of the computing world - a person with no programming experience can write a program just as well as a person with lots of experience.
3 years ago
@marginalia Hmm, I hadn't considered it as translation, but I think you are right.
What I found in my (short) time playing with it is that it turns into a problem of specification. The more precisely you can describe what you want, the better the results were. The AI will try to fill the gaps in the spec with something that may not be what you want. This is rather 'human'....
Now to teach people how to figure out what they actually want!
There are also big limits - particularly on things it has never seen before. Programming new hardware would require ridiculous precision of specification - again just like reality. 路 3 years ago
@skyjake One thing I realized today is that programming languages are less 'fuzzy' and have fewer edge-cases that natural language. Most code on the internet will at least compile!. Thus if an AI can produce a page of text indistinguisable from human-written, it will probably be quite capable at coding.
Also, GPT-2 has a lot of contextual information. With one prompt I gave it it generated a program and then explained why that program wouldn't do what I wanted it to do but would do what I had specified it to do! (I told it to turn an LED on every 500ms. How should the AI figure out when to turn the LED off). 路 3 years ago
That seems like it's mostly translating natural language programming instruction to a programming language, which is a hard programming problem (implementing solutions), but not *the* hard problem in programming (i.e. solving problems). 路 3 years ago
I was about to comment here but it turned out in to a longer post:
gemini://skyjake.fi/gemlog/2021-07_artificial-programming.gmi 路 3 years ago
gemini://skyjake.fi/gemlog/2021-07_artificial-programming.gmi
Experiments were done on textsynth:
https://bellard.org/textsynth/ 路 3 years ago
https://bellard.org/textsynth/
Image showing it's result for the arduino nano prompt:
https://i.postimg.cc/MHrbpjpj/led-1.jpg 路 3 years ago