AI programming is creepy!

in #dev7 months ago

image.png

I recently got accepted into GitHub's Copilot program. This is an AI driven pair programming experiment. Basically it is an extension to your favorite IDE that tries to guess what you are doing and provide code samples.

On paper, it sounds like Skynet, but in reality it is just a nural network trained on billions of lines of code from GitHub. While it doesn't know your code, it has surely seen something similar to it in its training set.

image.png

As our AI technology has not advanced past the first step of AI evolution, it must be trained extensively on anything it needs to do. For those curious, the next step in the AI evolution is AGI, or Artificial General Intelligence, an AI that can be trained on many things and approach any unknown problem and be able to tackle it. Right now we have to train AI on very specific problems and that's all it can do. A good example would be an AI that can play any board game, right now we need to have to train it on the specific board game(s) it will play, like Chess. Training it on Chess doesn't allow it to play Monopoly.

So the idea with Copilot is not to code for you, but with you and that's why they market it as pair programming. It gives you suggestions and you choose to follow those suggestions, take pieces from it, or ignore it all together. It isn't going to program for you, but mostly save you looking up code examples, although a lot of the times you are on your own. When it works though, it is creepy af!

Let me show you some examples.

I was working with Beem (Python Hive library) with one of the small components of my new project. I was specifically adding some error handling to make sure an account exists before moving forward. I was making what is called a guard clause, a check or gate you put at the start of a complex function to end it immediately if a certain condition isn't met.

    try:
        _ = Account(to)
    except 

I was at this point, I was about to type in the exception name, but knew I had to first import it. I was about to type the import in and this is what I saw.

image.png

Copilot knew I needed to add an exception, and it specifically knew which one. Now I am 99.9% confident Copilot was not trained on code that used Beem. So it liekly saw I was typing an exception and like matched the name of the exception, but it was really cool, creepy, and helpful that I only had to hit tab to type it in with the appropriate comma.

Another example that happened just a few seconds before.

image.png

I was building in some checks for transfer memos, and I made some changes to add a command to mimimize errors.

When I went down to add a check for it, it knew exactly what I was about to type, well almost. I ended up going the guard clause route (very good programming practice, learn them!) so what I really went with was very close.

    if command != 'mint':
        return 0

In fact, I hit tab anyway and let it fill it in and just changed it to != from ==. Still saved me a few keystrokes.

Now Copilot doesn't just write code, it also assists with commenting. This comment was completely written by AI.

    # Confirm mint command
    if command != 'mint':
        return 0

From what I have noticed, the AI uses your code as much as it uses the data set it was trained on.

Something I commonly do is fetch blocks, almost immediately after I iterate them. I typically will start complex tasks by creating comments with pseudo code that represent each step I am about to do, so I can replace each comment with each task.

In this case I lead with # fetch blocks, it knew I would then iterate them and wrote some pseudo code to represent that.

xH68Eyc40v.gif

If that doesn't impress you, maybe this will.

Here is an example of me creating a function to upload an image to imgur.

U3LpSl5Qxr.gif

I have had this sort of moment a few times in just 48 hours of using Copilot. It's not always right, but it is certainly helpful. In fact, I had to do something like this with a very obscure framework I doubted it had any previous training on, and low and behold it had the function I needed. It wasn't perfect, but I actually used the 10 lines of code and 6 comments in my final code. Granted I had to change some of it and it wasn't exactly what I was looking for, but it took me from knowing very little of what I needed to do, to putting me on the right track.

The function ended up taking me over an hour to write, and ended up only being 6 lines of code. I had to do a lot of digging and experimenting to find exactly what was the proper syntax. Seeing as there really is no example code, it was a painful process. Oddly enough, Copilot knew enough to give me something to work with.

DN12wZifVj.gif

Some of the examples I have seen on the net for Copilot are really cool from writing complete apps and tic tac toe games just using Copilot, my experience is it doesn't suggest anywhere near enough to do anything like that, and in fact using some of these examples never triggered the same code generation. Maybe things changed since then, but I find it doesn't speak up that often, but when it does it is usually helpful, even if it is just to jog your brain to put you on the right path.

I don't see Copilot making an inexperienced programmer a Senior programmer, but it certainly does help save some time from time to time. I am still learning how to take advantage of it better, but there are not many things you can do with it outside of code and see what it suggests. You can however cycle through suggestions with Alt-[ ] to see what other suggestions it has (if it does).

A big concern of mine is my code being shared or used in training. You do not have to worry about this as it will only collect data on what solutions you choose, not how you modify it or any of your code. This helps it improve the model but training is done on selected open source code on GitHub.

If you want to sign up for Copilot, you can apply here.

I have noticed the amount of users with the Copilot extension installed has grown from around 80K to almost 500K, so it looks like they are opening the doors to many more users.

Image Sources: cover, 1

Sort:  

That sounds absolutely brilliant! Imagine how much effective code a single programmer can create and test and debug in a working day with a well-trained AI for his common framework applications. There's a shortage of programmers, it will be there forever! The human mind is full of beauty & innovation. Let's squeeze as hard as we can, as long as we can. This life is not forever.

edit:
Did you try to write TestCases or recreate code to become more modular? I would bet those are great use-cases for an AI.
Btw. I started the tutorial you recommended for HIVE Beginners. Haven't been seriously coding for years, but I'll get back to it this winter.

amazing, this seems both useful but also a bit creepy at the same time.

Looks like it won't replace programmers, but still I feel you when you say it is scary

This looks dope. My friend has been having a hard time with this, I'll send him a link. Thanks.

I've heard about this, but not tried it. Some IDEs already try to second guess what you want, but this looks like the next level. Anything that saves you having to Google what functions or parameters you need can be useful, but we need to keep control and understand what the code does. I don't know what level automated code generation is at, but it may be doing things that most programmers would not understand. People have said for decades that programming will be a redundant profession, but I hope we have a few years yet as it's my job.

It´s like having your own personal stalker

This is actually A cool thing, maybe just maybe it can help write some good code and faster.

Thank you for your long article presenting the Copilot feature.

This looks really interesting and helpful. Is it better than Tabnine?

Are you using PyCharm?

How do you get into the Copilot program?

@tipu curate

Hahaha Creepy as you called it and very cool too. This is far better than the extension on my Vscode. The extension doesn’t do 10% of what copilot AI did. I will register now.

The function ended up taking me over an hour to write, and ended up only being 6 lines of code. I had to do a lot of digging and experimenting to find exactly what was the proper syntax. Seeing as there really is no example code, it was a painful process. Oddly enough, Copilot knew enough to give me something to work with.

Very cool.

I would wish I had not forgotten the open ai that writes simple code from words. It was so cool.

I would expect at some point in time programming become writing what you want. That needs a lot of time and will be most likely only work for max. Medium difficulty.

But i think that is where the ball is going.

I don't see Copilot making an inexperienced programmer a Senior programmer, but it certainly does help save some time from time to time. I am still learning how to take advantage of it better, but there are not many things you can do with it outside of code and see what it suggests.

Uhm well, then maybe you should try GPT-3 or GPT-J-6B instead and report back with some comparisons to take the best choice. };)

I was actually looking at using GPT-3 for my nee project but I don’t have time to build a model and build the rest of my app before Hivefest. But one thing I noticed is all the services that utilized GPT-3 had clauses you can’t try to use their service to get backend access to GPT-3. Must be a common concern.

We are training the machines. The algorithm learns from us more than we learn from it.
It is beneficial though cause as you said this trained AI is taking the boiler plate code and not the creativity process. If and When the general AI take over we are in some dip it.

Programming getting faster too... Like everywhere else. !LUV !PIZZA

Automation-is-Coming.jpg

<><

<><

LUV

Connect

Trade


@themarkymark, you've been given LUV from @networkallstar.

Check the LUV in your H-E wallet. (10/10)

I am very interested in this topic. I follow her. Some scientists argue that artificial intelligence has already been created, others that it will be created in 40 years ... What do you think?

I don’t think we have achieved stage two of AI. There is generally accepted three stages.

ANI - Narrow intelligence. This is where I believe we are. You train ai on exactly what you need done. Training an ai to play chess doesn’t mean it can play checkers.

AGI - General intelligence. An ai that can do many things without being training for it. You train it on gaming and it can do reasonably well on all games and doesn’t need to specifically be trained on every one.

ASI - Super intelligence. This is potentially end of world stage, an ai that is smarter than us, can learn, can truly think, and can deal with any problem thrown at it. Smart people learn much faster and ASI can potentially grow to be tens of thousand times smarter than us in a short period of time. Can potentially solve everyone problem from death or cancer or destroy us in the process.

 7 months ago 

I see they are finally trying to be useful instead of being creepy and showing "relevant ads".

I used ReSharper in Visual Studio for C# which actually helped me to improve writing code. This actually looks cool, would definitely try it too.

The A.I that doesn't need to be taught before and auto fills your programing code, would make coding much more but errors could still occur, I love python programming to it's easier then other programing languages.

I haven't tried github copilot yet, but I've been enjoying a similar vscode extension "tab nine" for while
https://marketplace.visualstudio.com/items?itemName=TabNine.tabnine-vscode

Collaborating with Copilot means you are training an AI to put you out of a job. Programmers are expensive. If you argue against this point then you argue against any development of, or move towards General AI.

Why do you think Micro$oft bought GitHub? It provides the training dataset for Copilot. Do you think Micro$oft really just simply want to help you out of the goodness of their own heart? Micro$oft has no heart, because it is a corporation, and as such corporations exist for one sole purpose, to make profit. If they can reduce costs for themselves or their customers, they can make more profit.

Humans are incredibly inefficient part of the equation. We see humans being replaced en mass with automation, whether it be through software or physical devices. The writing is on the wall.

BTW this is NOT an anti-capitalist or anti-profit rant. I have run my own businesses for the past 20 years. A good part of that time I worked as a programmer.

My point is, that we must think twice about the convenience of the technology that we use, because there are advantages and disadvantages. Perhaps the disadvantages outweigh the advantages.

Technology will grow and improve regardless if you embrace it. Ai without a doubt will start replacing jobs. Programming likely won’t be any time soon. The likely first job will be something like truck drivers. A massive industry that will drastically improve commerce but equally increase unemployment.

Yes, the march of technology is one thing, but to "actively embrace it" and hurry the demise of your employment is another.

But that march is also dependent upon people using it. The change of technology is dependent upon people and does not happen by itself. By extension, if people become too reliant upon AI, innovation will plateau and stagnate. AI is a complex algorithm. It has no needs of it's own. It is the needs and desires of humans that drive innovation.

Further, AI of any use or power requires vast resources which are owned by a few centralized corporations. It will be in their interest to ensure that said AI does not assist in building competing technologies or companies and their innovations. Once again we will reach a bottle neck of innovation.

Programming likely won’t be any time soon.

It's demise (your unemployment) will come sooner the more that you use these AI assist tools.

Also, what is the licensing status of the code written with this tool? What does the fine print say? Can M$ change the terms and conditions whenever they want, thereby rendering the code produced by it theirs? They are well known for their IP grabs.

Also, what is the licensing status of the code written with this tool? What does the fine print say?

It says you own the code when you selected it.

image.png

There are however some interesting arguments about how Copilot uses software that has one license, but you may use the code under a different license.

Most of the code I see copilot create is more autocomplete style, rather than writing sections or even functions. Although it can produce larger portions of code and in some cases complete apps like the Tic Tac Toe example.

I feel that this is likely to make programming more efficient rather than obsolete. Once the third stage of AI's are here, it's another story. However, it seems like the current generation is predicting chunks of programming that are non-creative. That is, the programmer still comes up with the intent, the logic, and the algorithm while the AI does some of the more mundane tasks.

Once upon a time, there was a thriving industry of men called scriveners who were mainly hired by lawyers to copy documents out by hand and ensure that they were exact replicas. Now, we have photocopiers and printers. Where are the unhappy, out of work scriveners? Somehow, they found new occupations. I feel that the same will happen here when/if programmers are replaced by AI's. I think it will be a while, though. I base this on my interactions with the AI's we currently have such as text generation AI's. Some seem to think it is miraculous. I am less impressed.

I am fascinated by AI. I honestly didn't think we would come this far. I have not done any programming for years, but you make it sound intriguing. It sounds like, at this point, the AI is more of a time-saving assistant than a true code generator, but how strange that it knew how to make suggestions based on code it apparently had not been trained on. Have you ever seen the show "Person of Interest"? The AI depicted there is ridiculously fictional, but it made me wonder what a true AI would look like. How many years away from that more general AI that you described do you think we are?

Automation is coming for so many jobs, it's crazy.

This is the tip of the iceberg I'd imagine.

the future is in our hands, I hope AI will be of great help to humanity

Almost every code based programming is creepy for me.
But respect for all the people, who do this.
Definitely not an easy thing. At least not from my perspective/viewpoint.


The rewards earned on this comment will go directly to the person sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.

It's really awesome. Keep up the good work

Congratulations, your post has been curated by @r2cornell-curate.

Manually curated by <@melissaofficial >

Also, find us on Discord (https://discord.gg/BAn2amn)
logo3 Discord.png

PIZZA! PIZZA!

PIZZA Holders sent $PIZZA tips in this post's comments:
@samsmith1971(5/20) tipped @themarkymark (x1)
networkallstar tipped themarkymark (x1)

Join us in Discord!

This is pretty amazing! My husband writes software, both in the course of business and as a pleasurable pursuit. I must see if he has heard of this and if it can be of any use to him. He does all of his personal programming offline as he is paranoid about having his code nicked too. Thank you for sharing. !PIZZA

I've been learning programming for a couple of months now and damn, now that I understand how huge this program is I can just say congrats and kick ass.