zlacker

[return to "Memory and new controls for ChatGPT"]
1. anothe+Pf[view] [source] 2024-02-13 19:29:04
>>Josely+(OP)
This is a bit off topic to the actual article, but I see a lot of top ranking comments complaining that ChatGPT has become lazy at coding. I wanted to make two observations:

1. Yes, GPT-4 Turbo is quantitatively getting lazier at coding. I benchmarked the last 2 updates to GPT-4 Turbo, and it got lazier each time.

2. For coding, asking GPT-4 Turbo to emit code changes as unified diffs causes a 3X reduction in lazy coding.

Here are some articles that discuss these topics in much more detail.

https://aider.chat/docs/unified-diffs.html

https://aider.chat/docs/benchmarks-0125.html

◧◩
2. omalle+6q[view] [source] 2024-02-13 20:21:14
>>anothe+Pf
Can you say in one or two sentences what you mean by “lazy at coding” in this context?
◧◩◪
3. anothe+xu[view] [source] 2024-02-13 20:47:50
>>omalle+6q
Short answer: Rather than fully writing code, GPT-4 Turbo often inserts comments like "... finish implementing function here ...". I made a benchmark based on asking it to refactor code that provokes and quantifies that behavior.

Longer answer:

I found that I could provoke lazy coding by giving GPT-4 Turbo refactoring tasks, where I ask it to refactor a large method out of a large class. I analyzed 9 popular open source python repos and found 89 such methods that were conceptually easy to refactor, and built them into a benchmark [0].

GPT succeeds on this task if it can remove the method from its original class and add it to the top level of the file with appropriate changes to the size of the abstract syntax tree. By checking that the size of the AST hasn't changed much, we can infer that GPT didn't replace a bunch of code with a comment like "... insert original method here...". The benchmark also gathers other laziness metrics like counting the number of new comments that contain "...". These metrics correlate well with the AST size tests.

[0] https://github.com/paul-gauthier/refactor-benchmark

◧◩◪◨
4. Taylor+CE[view] [source] 2024-02-13 21:43:46
>>anothe+xu
I have a bunch of code I need to refactor, and also write tests for. (I guess I should make the tests before the refactor). How do you do a refactor with GPT-4? Do you just dump the file in to the chat window? I also pay for github copilot, but not GPT-4. Can I use copilot for this?

Any advice appreciated!

◧◩◪◨⬒
5. rkuyke+jH[view] [source] 2024-02-13 21:58:20
>>Taylor+CE
> Do you just dump the file in to the chat window?

Yes, along with what you want it to do.

> I also pay for github copilot, but not GPT-4. Can I use copilot for this?

Not that I know of. CoPilot is good at generating new code but can't change existing code.

◧◩◪◨⬒⬓
6. redbla+II[view] [source] 2024-02-13 22:06:15
>>rkuyke+jH
Copilot will change existing code. (though I find it's often not very good at it) I frequently highlight a section of code that has an issue, press ctrl-i and type something like "/fix SomeError: You did it wrong"
[go to top]