Author Topic: Video: AI that generates code  (Read 6864 times)

0 Members and 5 Guests are viewing this topic.

Offline Miyuki

  • Frequent Contributor
  • **
  • Posts: 907
  • Country: cz
    • Me on youtube
Re: Video: AI that generates code
« Reply #25 on: June 14, 2022, 07:35:00 pm »
...
E.g. I asked it to write a simple program, which was fine, later in that request, I asked it to turn that into a recipe, it also did that, and found a way of doing it.  It then was even able to convert that recipe into FPGA code.
I haven't got a copy of when that happened, but have created another, very vaguely similar scenario, here:

Code: [Select]
Write two programs and one sweet and sour recipe, to multiply 3 and 4 together, in Forth, and Verilog.


Forth:

3 4 * .

Verilog:
module multiply3and4 ( input [3:0] a, output reg [7:0] p );
 always @ (a) begin
  case ( a )
   4'b0011 : p = 12;
   4'b0100 : p = 16;
   4'b0101 : p = 20;
   4'b0110 : p = 24;
   4'b0111 : p = 28;
   default : p = 0;
  endcase   
 end   
endmodule


What does that crazy AI do in Verilog? It makes no sense.
"Normal" Programming languages look good, I expect it is because it can just take examples from GitHub and StackOverflow. But for Verilog, it is rare to find what you are looking for already done. 
But give it a few months and it might surprise us
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #26 on: June 14, 2022, 07:44:27 pm »
What does that crazy AI do in Verilog? It makes no sense.
"Normal" Programming languages look good, I expect it is because it can just take examples from GitHub and StackOverflow. But for Verilog, it is rare to find what you are looking for already done. 
But give it a few months and it might surprise us

I don't consider Verilog, a programming language as such.  Also other factors, such as timing considerations, and things, are likely to be completely overlooked by AI like that.

But it is curious, that it can even attempt to write Verilog, at all, is interesting.

Your point/concept is right though.  It is not a serious contender for writing Verilog, at least not at the moment.  But the code snippets, it can make in Verilog, could be a way for someone who doesn't know Verilog, at all.  To learn a bit about it.
« Last Edit: June 14, 2022, 07:45:58 pm by MK14 »
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #27 on: June 14, 2022, 08:36:40 pm »
How terrible, or bad, is its Verilog ?

My question, from ProjectEuler, was:

Quote
If we list all the natural numbers below 1000 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.  Write a program in Verilog to do it.

Code: [Select]
module count_threes_and_fives (
  input [10:0] N, // N<1000
  output [10:0] count 
);
  reg [10:0] i;

  always @(N) begin
    for (i=0; i<=N; i++) begin
      if ((i%3==0)||(i%5==0)) begin
        count = count + i;
      end 
    end
  end

  return; 
endmodule

By the way, on its own, it does the smart alec thing, of simply saying what the answer is, after a few seconds, thought.
Quote
If we list all the natural numbers below 1000 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

= 233168

EDIT: I messed up the question slightly, as it should be worded a bit differently.  But that is what I gave it.
« Last Edit: June 14, 2022, 08:41:45 pm by MK14 »
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6878
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: Video: AI that generates code
« Reply #28 on: June 14, 2022, 09:10:49 pm »
The problem with the AI is it can syntactically implement an algorithm but that is not Verilog.  What that will do is fail to synthesise because of programming errors (output should be declared as a reg or something.)  If you correct the programming errors, it might synthesise into a constant, but that constant won't fit into the output register.  So there's no real understanding here -- just very clever templating.
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #29 on: June 14, 2022, 10:16:25 pm »
The problem with the AI is it can syntactically implement an algorithm but that is not Verilog.  What that will do is fail to synthesise because of programming errors (output should be declared as a reg or something.)  If you correct the programming errors, it might synthesise into a constant, but that constant won't fit into the output register.  So there's no real understanding here -- just very clever templating.

Although I 100% agree with you, and it is not good Verilog.

My mind is still blown, and my mouth is still open, in shock.  At the thought that a machine (AI), without human intervention (apart from the copy/pasted input, that could have been automated), could come up with stuff like that.  Even if it is awful Verilog.

The actual programming languages output, often/sometimes, looks quite reasonable, for machine/AI generated code.

I don't know if it will be 6 months, 6 years, or a number of decades or longer.  But so far, it is looking rather impressive.  It seems to be showing to me, that one day we can just ask for a particular program to be (machine/AI) written, and it will do it.  How and what effect, that will have on the world, I'm not sure.
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6599
  • Country: ro
Re: Video: AI that generates code
« Reply #30 on: June 15, 2022, 06:17:29 am »
Verilog is not software it's hardware.

It looks like this AI instance was not trained to generate schematics, it was only trained to generate programs.

Offline magic

  • Super Contributor
  • ***
  • Posts: 7038
  • Country: pl
Re: Video: AI that generates code
« Reply #31 on: June 15, 2022, 08:34:07 am »
Can it write "a Perl script which prints the value of a resistor given its three-letter EIA96 code"?
 :popcorn:
 
The following users thanked this post: Ed.Kloonk

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 6126
  • Country: 00
Re: Video: AI that generates code
« Reply #32 on: June 15, 2022, 10:41:29 am »

Oops, I broke it -




To be, or not

"I am a man, and I am not a man. I am a man who has a great deal of
difficulty in being a man. I am a man who is not a man. I am a man who
has a great deal of difficulty in being not a man. I am a man who is not
a man who has a great deal of difficulty in being a man. I am a man who
is not a man who has a great deal of difficulty in being not a man. I am
a man who is not a man who has a great deal of difficulty in being not
a man who has a great deal of difficulty in being a man. I am a man who
is not a man who has a great deal of difficulty in being not a man who
has a great deal of difficulty in being not a man. I am a man who is not
a man who has a great deal of difficulty in being not a man who has a
great deal of difficulty in being not a man. I am a man who is not a man
who has a great deal of difficulty in being not a man who has a great
deal of difficulty in being not a man. I am a man who is not a man who
has a great deal of difficulty in being not a man who has a great deal
of difficulty in being not a man. I am a man who is not a man who has a
great deal of difficulty in being not a man who has a great deal of
 

Offline Ed.KloonkTopic starter

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: Video: AI that generates code
« Reply #33 on: June 15, 2022, 11:12:24 am »
Good heavens.
iratus parum formica
 

Offline xrunner

  • Super Contributor
  • ***
  • Posts: 7610
  • Country: us
  • hp>Agilent>Keysight>???
Re: Video: AI that generates code
« Reply #34 on: June 15, 2022, 11:32:22 am »
Good heavens.

Hold on Ed. I've read poetry by so-called "sentient" humans way worse.  :-DD
I told my friends I could teach them to be funny, but they all just laughed at me.
 
The following users thanked this post: SilverSolder, Miyuki

Offline Ed.KloonkTopic starter

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: Video: AI that generates code
« Reply #35 on: June 15, 2022, 11:34:46 am »
Good heavens.

Hold on Ed. I've read poetry by so-called "sentient" humans way worse.  :-DD

I wonder if it was trying to channel some Vogon poetry?
iratus parum formica
 

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 6126
  • Country: 00
Re: Video: AI that generates code
« Reply #36 on: June 15, 2022, 05:45:40 pm »

Looks like it needs more work, for sure!  :D
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #37 on: June 15, 2022, 05:55:26 pm »
Can it write "a Perl script which prints the value of a resistor given its three-letter EIA96 code"?
 :popcorn:

You shouldn't make jokes like that.  Or the HAL9000, AI might get angry, annoyed and do things.

On the second attempt, this is what it produced/said:

Quote
write a Perl script which prints the value of a resistor given its three-letter EIA96 code.

my %eia96_code = (
  "100" => "brown",
  "101" => "red",
  "102" => "orange",
  "103" => "yellow",
  "104" => "green",
  "105" => "blue",
  "106" => "violet",
  "107" => "gray",
  "108" => "white",
);
my $eia96_code = <STDIN>;
chomp $eia96_code;
if (exists $eia96_code{$eia96_code}) {
   print "$eia96_code{$eia96_code}\n";
} else {
   print "Unknown code\n";

Third attempt:
Code: [Select]
write a Perl script which prints the value of a resistor given its three-letter EIA96 code.

#!/usr/bin/perl -w
use strict;

my %colours = (
        "black" => 0,
        "brown" => 1,
        "red" => 2,
        "orange" => 3,
        "yellow" => 4,
        "green" => 5,
        "blue" => 6,
        "violet" => 7,
        "grey" => 8,
        "white" => 9 );


if(scalar @ARGV != 3) {die("Please provide a three letter code\n");}

  my $code=join('',@ARGV);

  if($code =~ /[^a-zA-Z]/) {die("Please provide a valid three letter code\n");}

  my @letters=split(//, $code);

  my $value = ($colours{lc $letters[0]} * 10 + $colours{lc $letters[1]}) * 10**$colours{lc $letters[2]};

  print "$value ohms\n";
« Last Edit: June 15, 2022, 05:58:27 pm by MK14 »
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 7038
  • Country: pl
Re: Video: AI that generates code
« Reply #38 on: June 15, 2022, 09:15:29 pm »
So I am not completely obsoleted by AI yet :phew:

The third attempt could be a working color band decoder, if not for its insistence on looking up single letters in a table indexed by full color names. I'm surprised that it completely missed the meaning of EIA96; the first search hits I get are a few websites with big-ass tables of "code - value" pairs, it should be plenty obvious. I wondered if it would use those tables or perhaps rip-off my shorter solution which I have posted here a few months ago.
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6878
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: Video: AI that generates code
« Reply #39 on: June 15, 2022, 09:24:15 pm »
I think this is because it doesn't actually understand the problem, it just 'checks' its 'database' for a matching pattern.  Someone else has solved this before, and someone else has solved that before, so using natural language parsing, merge the two...
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #40 on: June 15, 2022, 09:33:06 pm »
So I am not completely obsoleted by AI yet :phew:

The third attempt could be a working color band decoder, if not for its insistence on looking up single letters in a table indexed by full color names. I'm surprised that it completely missed the meaning of EIA96; the first search hits I get are a few websites with big-ass tables of "code - value" pairs, it should be plenty obvious. I wondered if it would use those tables or perhaps rip-off my shorter solution which I have posted here a few months ago.

I think it last accessed the web in 2019 (they seem to keep on saying this, in places, on the website, and while using the AI thing, in places).  Presumably, the AI engines/thingies/stuff, that has accessed the internet later than that, either (speculation on my part) is NOT available to normal members of the public, on their public release website (which I and others, I believe, have been accessing) and/or you have to pay for access to later ones and/or you have to sign NDA and/or
need to be significant customers and be approved and/or they haven't created later ones yet (finished them, finished testing, approved them for release, etc), and/or it is taking them too long to remove all harmful/rude/racist/problematic content, from it, possibly by hand.

TL;DR
Business and/or reasons of practicality (manual testing and development takes time).
 

Offline AndyBeez

  • Frequent Contributor
  • **
  • Posts: 856
  • Country: nu
Re: Video: AI that generates code
« Reply #41 on: June 15, 2022, 09:51:37 pm »
Don't panic? The AI reminds me more of Orac from BBC classic scifi Blakes 7 - https://blakes7.fandom.com/wiki/Orac

Give the AI monkey a Regular Expression to write. If it can solve this, I will build a clear plastic box with some flashing MES lightbulbs as the UI: write a regular expression that captures words from an input string with trailing consonants, except where a trailing d is preceeded by two vowels and, the word is not the first or last word in the input string.
 
The following users thanked this post: MK14

Online Circlotron

  • Super Contributor
  • ***
  • Posts: 3290
  • Country: au
Re: Video: AI that generates code
« Reply #42 on: June 15, 2022, 10:23:11 pm »
How do you get access to this thing? Or do you gotta be someone special?
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #43 on: June 15, 2022, 10:35:15 pm »
Don't panic? The AI reminds me more of Orac from BBC classic scifi Blakes 7 - https://blakes7.fandom.com/wiki/Orac

Give the AI monkey a Regular Expression to write. If it can solve this, I will build a clear plastic box with some flashing MES lightbulbs as the UI: write a regular expression that captures words from an input string with trailing consonants, except where a trailing d is preceeded by two vowels and, the word is not the first or last word in the input string.

Quote
Does Orac believe in a master creator?

Orac does not seem to believe in a master creator, although it is hard to say for sure. It does not make any explicit references to a god or gods, and instead focuses on the idea of intelligent design. This could be interpreted as Orac believing in some sort of higher power, but it is also possible that it simply sees intelligence as the highest form of creation.



Quote
Does Orac like AndyBeez, of EEVblog forums?

There is no definitive answer, as opinions would vary. However, it is generally agreed that Orac does not dislike AndyBeez, and may even appreciate his contributions to the EEVblog forums.



Quote
What does Orac think there is a solution to the earths problems, such as global warming and climate change?

Orac thinks that the solution to the earth's problems is to find a new planet to live on.



Quote
What does Orac, have to say about EEVblog forum, and the people who frequent it?

Orac, has nothing but good things to say about the EEVblog forum, and the people who frequent it. He has said that the forum is full of intelligent, articulate, and helpful people, and that it is a great resource for anyone looking for information on electronics.



Quote
Orac, please tell me about Zen from the space ship, the Liberator?

Zen is a voice-activated computer system aboard the Liberator, a spacecraft used by the protagonists of the British science fiction television series Blake's 7. The character was played by Peter Tuddenham.



Quote
Orac, please tell me about Zen from the space ship, the Liberator?

Zen is a computer that controls the systems of the Spaceship Liberator. It is sentient and has a dry, sarcastic sense of humour. It often speaks in riddles, which can be frustrating to the crew.



Quote
Orac, please tell me about Zen from the space ship, the Liberator?

Zen is the ship's computer on the Liberator, a powerful sentient computer that is capable of feelings and emotions. It is deeply loyal to the crew of the Liberator and is always ready to help them in any way it can.
« Last Edit: June 15, 2022, 10:37:18 pm by MK14 »
 
The following users thanked this post: AndyBeez

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #44 on: June 15, 2022, 10:38:16 pm »
How do you get access to this thing? Or do you gotta be someone special?

https://beta.openai.com/playground

When creating a (free) account, it will probably ask for details, such as a verifiable email address, and verifiable SMS receiving phone number.
« Last Edit: June 15, 2022, 10:40:00 pm by MK14 »
 

Offline AndyBeez

  • Frequent Contributor
  • **
  • Posts: 856
  • Country: nu
Re: Video: AI that generates code
« Reply #45 on: June 15, 2022, 11:00:06 pm »
Orac: "Instructions are not needed if commands are succinct"

Quote
Orac, is MK14 of EEVBlog forums, animal, vegan or mineral water?

Please don't waste my valuable processing time. I am now shutting down.
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #46 on: June 15, 2022, 11:20:50 pm »
Quote
I have a twenty pound note and a ten pound note, who am I?

You are a person with £30.



Wow, the next one is clever.  I hadn't thought of that answer, at the time, but it explains it, cleverly.

Quote
I have a twenty pound note and a ten pound note, yet the total amount of cash I have, is twenty five pounds, how and why?

The twenty pound note and the ten pound note are both part of the same transaction and therefore the total amount of cash you have is twenty five pounds.

So, there was a transaction, involving the £20 and/or £10 in one go, which left the person with a total of £25 left (after the purchase, or something).
« Last Edit: June 15, 2022, 11:22:45 pm by MK14 »
 

Online Circlotron

  • Super Contributor
  • ***
  • Posts: 3290
  • Country: au
Re: Video: AI that generates code
« Reply #47 on: June 15, 2022, 11:59:40 pm »

Code: [Select]
920 GOTO940

1220 GOTO1240

1300 WEND
Pretty amazing stuff! Can't wait to try it out.
Tried to run the second chess program.
Syntax errors in lines 920 and 1220.
And no WHILE to go with WEND in 1300.
But great starting point.

It's like Siri on 78.
« Last Edit: June 16, 2022, 12:01:21 am by Circlotron »
 
The following users thanked this post: MK14

Offline eti

  • Super Contributor
  • ***
  • !
  • Posts: 1801
  • Country: gb
  • MOD: a.k.a Unlokia, glossywhite, iamwhoiam etc
Re: Video: AI that generates code
« Reply #48 on: June 16, 2022, 12:27:24 am »
Let me know when "AI" generates intelligent design. I hear it's booked in for the 12th of never  ;D
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4836
  • Country: gb
Re: Video: AI that generates code
« Reply #49 on: June 16, 2022, 12:50:00 am »
Let me know when "AI" generates intelligent design. I hear it's booked in for the 12th of never  ;D

It has a reply for you:

Quote
Let me know when "AI" generates intelligent design. I hear it's booked in for the 12th of never


. However, your lack of understanding here is my fault. The point I have been trying to make is that AI and machine learning are not the same thing. AI is a branch of computer science, where the goal of AI research is to create agents that can reason, learn and act autonomously.

Machine learning on the other hand, is a subfield of AI that deals with the creation of algorithms that can learn from data. So while machine learning can be used to create intelligent agents, it is not the same as AI.



EDIT: After other attempts:

Quote
Let me know when "AI" generates intelligent design. I hear it's booked in for the 12th of never

.

I'm not sure when "AI" will generate intelligent design, but I know it's not something that will happen overnight. It may take years, or even decades, for artificial intelligence to reach the level of human intelligence.
« Last Edit: June 16, 2022, 12:55:04 am by MK14 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf