Live data from Hacker News

40% of the code GitHub Copilot users check-in is AI generated and unmodified

microsoft.com

11–20 of 129 posts

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#11
I think it’s more interesting that they track this.

I’d be more interested to see the other stats..

How much code is AI generated and then modified.

How much modification is typically needed.

How often suggestions are not used/abandoned/deleted.

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#12
I just added an Ask AI feature to our product to help customer who want to write inline javascript functions to modify workflows with code instead of UI... so far it generates amazingly good code with a realtively simple system prompt.. that just let's the AI know ahead of time details about our API such that when a customer says: "Write a function to search for a lead in salesforce with jsforce and update an activity record with the duration of the call." It can really generate code that does just that... I do have to tell it to use a specific jsforce library or it'll just generate non working code... but IMO that's unreal and amazing...

That question generated this code: [I did not write anything beyond this point]

Here's an example function that searches for a lead in Salesforce using jsforce and updates an activity record with the duration of the call:

``` exports.handler = async (event, context) => { const jsforce = require('jsforce');

  // Create a connection to Salesforce using the access token and instance URL
  const conn = new jsforce.Connection({
    instanceUrl: event.salesforce.instanceUrl,
    accessToken: event.salesforce.token
  });

  // Search for a lead with the given caller number
  const lead = await conn.sobject('Lead').findOne({ Phone: event.activity.caller_number });

  if (lead) {
    // If a lead is found, update the activity record with the duration of the call
    const duration = 10; // Replace with actual duration of the call
    await context.ctm.update({
      activity: {
        id: event.activity.id,
        duration: duration
      }
    });
  } else {
    console.log('Lead not found');
  }
}; ```

Note that this function assumes that the caller number is stored in the Phone field of the Lead object in Salesforce. You may need to modify the code to match your specific use case. Also, the duration of the call is hardcoded to 10 seconds in this example, but you should replace it with the actual duration of the call.

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#13
post #10

lol I use co-pilot and there is no way this stat is true.

In my experience it's more like 80-90%, given the right prompts. Very little needs to be changed, usually

I'd say closer to 40%. You almost ways need to adjust the parameters of function. Almost always need to rename variables, etc. And this is writing mostly boilerplate too.

For more custom stuff, I mostly just ignore the suggestions since they are mostly useless.

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#14

A lot of the code it generates is trivial, or 1-2 lines of code that's obvious, at least for me. In which case, it makes no sense to modify it. I have a feeling this is the bulk of it.

This is my experience as well. For longer code, Copilot introduces errors through making up variables and method names that don't actually exist on the object. These errors are very annoying but only 5% of the generated code.

I tried Copilot last month and canceled my subscription because of all the small errors in generated functions. It was more painful to debug than write it myself.

Maybe I should have lowered expectations and thought of it as improved code complete. I got spoiled by copy/pasting from ChatGPT. As it stands now I'd rather pay for a subscription to have the latest ChatGPT than for Copilot.

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#15
Copilots positioned to optimise what i call "Google developer" flow. These are commadonity devs every workplace has who dont really know how to code, but rather know how to ask google questions to get the code they can slap together to meet a AC.

On the other side you have devs who have AI in their head. They often use tools to optimise their flow. Ive always used resharper as a developer and think autocomplete is certainly a developer efficiency improver. 99% of the suggestions resharper makes, i checkin. Thats why i use it, it has less fuzz because it doesnt try to be everything.

Pressing alt+tab and scrolling through some search results isnt something that adds overhead to my flow - after 30yrs im pretty good filtering content.

I do alot of PoCs though, so if i wanted to write in a language i didnt understand, i think copilot can improve my flow somewhat to get me to serach terms that will benifit me quicker.

Overall im still a few years away from relying on AI to help me code. Its going to be great for retirement though, if i had a family and kids it would allow me to checkout of self-paced learning while still maintaining my edge.

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#16
post #10

Earlier quoted context omitted.

In my experience it's more like 80-90%, given the right prompts. Very little needs to be changed, usually

I'd say closer to 40%. You almost ways need to adjust the parameters of function. Almost always need to rename variables, etc. And this is writing mostly boilerplate too. For more custom stuff, I mostly just ignore the suggestions since they are mostly useless.

> 40% of the code GitHub Copilot users check-in is AI generated and unmodified

> there is no way that stat is true

> I'd say closer to 40%

What?

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#17
post #9

I'm not surprised. A lot of the code I'll write in a day is trivial, calling helpers, writing test scaffolding, etc. I'm still building cool things the other 60% of time, but this job as we know it comes with a lot of repetition. (esp. if you write unit tests ;-))

unit test definitely a great use of copilot.

What are you talking about?

I don't know anyone who uses it for this; specifically tests are really bad if they're subtly wrong.

Maybe to scaffold the test function, but the actual test if completely useless if you don't trust it.

So like... generate code and have robust tests, or write robust code... but, it's really really daft to generate tests that might hallucinate some random crap (and copilot really does sometimes).

Other people have said this, but copilot is auto complete.

You use it every time you press tab.

Do you accept an auto-complete suggestion 40% of the time? ...mmmm, yes, well, guess why 40% of code is generated by copilot.

It's not because people are generating tests with it.

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#18

Earlier quoted context omitted.

I'd say closer to 40%. You almost ways need to adjust the parameters of function. Almost always need to rename variables, etc. And this is writing mostly boilerplate too. For more custom stuff, I mostly just ignore the suggestions since they are mostly useless.

> 40% of the code GitHub Copilot users check-in is AI generated and unmodified > there is no way that stat is true > I'd say closer to 40% What?

Technically 0% is closer to 40% than it is to 90% although it would be weird phrasing.

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#19
So far I’ve found copilot is like a weather forecast.

The shorter the prediction the higher probability of it being correct.

The longer, and more complex the prediction the less likely it’s all correct. But, with a close review you can spot the errors and correct it.

I’ve found most useful to get ideas on the page fast.

It’s also absolutely insane to be writing a parser, and have it suggest unit tests and code where it clearly has developed an understanding of the language before the parser is complete.

Re: 40% of the code GitHub Copilot users check-in is AI generated and unmodified

#20
post #9

Earlier quoted context omitted.

unit test definitely a great use of copilot.

What are you talking about? I don't know anyone who uses it for this; specifically tests are really bad if they're subtly wrong. Maybe to scaffold the test function, but the actual test if completely useless if you don't trust it. So like... generate code and have robust tests, or write robust code... but, it's really really daft to generate tests that might hallucinate some random crap (and copilot really does somet…

Most of the time I know exactly what tests I want to write but it's annoying to write them. Copilot autocompletes, I check it and then I use it.
Post reply on HN