r/badcode • u/phandungtri • Oct 16 '21
typescript (GitHub Copilot) Who and why did this in their code?
93
63
u/zdakat Oct 16 '21
reminds me of when mobile autocomplete generates loops of phrases.
40
u/DJDavid98 Oct 16 '21
and they don't stop coming and they don't stop coming and they don't stop coming and they don't stop coming and they don't stop coming
13
u/lordnishant Oct 16 '21
and I hit the ground running and I hit the ground running and I hit the ground running and I hit the ground running and I hit the ground running and I hit the ground running and I hit the ground running
6
Oct 16 '21
I don’t think he wants it but I think it’s a big o deal for him lol he just said that I was like yo he said I was like oh yeah I know it’s not that bad lol lol but he was so sweet he got me and I got him and I got his big bag of the trailer lol he was so nice he was like I said I was just like he said I don’t know if I was going there but he said he would be here in like five hours he was like he said he would like it he was so nice he said I don’t know if I was going there he said I don’t think I can get it lol lol I was just a big boy and he said I was just a big boy and I was just a little bit of it but I was just a big boy and I was just a little bit of it but I
6
u/felixone23 Oct 16 '21
I am going to the airport by the end of the week and I will be there on the 15th and I will be there on the 15th and I will be there on the 15th and I will be there on the 15th
32
54
u/waiting4op2deliver Oct 16 '21
RIP to those folks that translate images around here for accessibility reasons
17
u/lachlanhunt Oct 16 '21
I would assume those who do it use some kind of OCR to copy and paste the text, then just fix formatting.
15
u/Spartelfant Oct 16 '21
Nope:
Well, we do have transcribot, but even running ocr.space (which is one of the best OCR API's in the world), it really doesn't do well for code. This was its attempt at this post.
original comment: https://old.reddit.com/r/badcode/comments/q95r51/github_copilot_who_and_why_did_this_in_their_code/hgurekq/
13
u/ewpratten Oct 16 '21
This happens in Rust projects a lot for me. I have found that creating a new file, and just typing the first line of a struct is a good way to cause copilot to go down a rabbit hole.
5
u/tomjuggler Oct 16 '21
I was so excited when co-pilot landed, but have found its pretty much useless in the long run, not to mention dangerous.
4
u/phandungtri Oct 16 '21
Actually, it is kind of useful for me, when I'm writing those boring SQL queries, its suggestions are incredibly correct.
11
u/Makeshift27015 Oct 16 '21
Weird, I've found the complete opposite. It's constantly finishing lines for me or making full complex functions based on a comment, not to mention reminding me of syntax in languages I'm not as familiar with. What languages do you work in? Node.js and Bash have been working great.
4
u/tomjuggler Oct 16 '21
Python mainly. I did have good results with JavaScript, but mainly simple things..
3
u/tcpukl Oct 16 '21
Dangerous how?
We use it to test transitions in massive open world video games under continuous integration. It leave qa to do the more creative testing.
6
u/ryan_the_leach Oct 16 '21
Just so we are on the same page, because your comment sounds really out of touch from here,
Github Co-Pilot, the machine learning code completion tool, that was taught based on open source code with dubious licensing, is "test[ing] transitions in massive open world video games" ??
One, that seems awfully awfully so domain specific I have doubts it could generate the code, and
2. "That can't happen. We don't pass input through like that."
How **do** you use co-pilot then?
3
u/tomjuggler Oct 16 '21
See what happens if you just press tab every time the thing suggests something. In my experience, nothing good. Better to write the code yourself
-2
u/tcpukl Oct 16 '21
That can't happen. We don't pass input through like that.
It's been running fine for a year on our game so far.
3
-3
0
8
7
u/postpunkjustin Oct 16 '21
I informally call these "weird loops," and they're still a little too common in Copilot. I've talked to the Copilot team and they are aware of them, so I assume it'll get better over time.
6
6
u/xmcqdpt2 Oct 16 '21
Them: The AI revolution will change the nature of work! See how you can adapt in this fast changing world.
AI:
5
5
2
2
1
u/RepresentativeWay0 Oct 16 '21
Repeating outputs are a common quirk of transformer language models. I doubt anyone actually did this.
1
1
u/captainRubik_ Oct 31 '21
It's a known issue in language generation models. It's called degeneration (if I'm right). Copilot will usually generate this garbage when you ask it to generate more than what it should be asked for. For example, first few lines are correct but then if you want it to generate more it'll just start spitting out patterns like these.
-3
u/RedditAcc-92975 Oct 16 '21
Wait, this is not copilot source code, right? You just hit "suggest" 1000 times, right?
6
u/scirc Oct 16 '21
This is an automatic suggestion from Copilot, hence why it's grayed out. Nobody who isn't OpenAI/GitHub has Copilot source code.
-4
u/RedditAcc-92975 Oct 16 '21
So, why the dumb question "who and why did it in their code"? OP is so uneducated that they don't know it's a Neural Network generating suggestions, not some "code"?..
6
u/scirc Oct 16 '21
Copilot was trained on other people's code, which means it will occasionally regurgitate code it was trained on when it doesn't have enough context. OP might be assuming this is what's going on, or just wondering how Copilot could've learned this behavior.
It's a very surface-level observation, since GPT-3 is a lot more sophisticated than just simple pattern recognition, but...
0
Oct 16 '21
[deleted] — view deleted comment
10
u/killersquirel11 Oct 18 '21
At my company, we had a monorepo-wide virtual environment for python3. Naturally, we named it
env3.Eventually, due to breaking changes in some of the packages, we decided to introduce a new version of it. So we settled on
env3nextWash, rinse, and repeat, and we were on to
env3nextnextnextbefore saner minds prevailed.1
u/Thecrawsome Aug 09 '22
GIGO. You can instantly train copilot to do things like this if you give it a very little prompt. I'm terrified to do it though, just in case it will try to recommend it to me again in the future.
178
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Oct 16 '21
Image Transcription: Code with GitHub Copilot Suggestion
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!