Live data from Hacker News

Prevent cognitive debt by manually retyping LLM-generated code

ankursethi.com

61–70 of 479 posts

Re: Prevent cognitive debt by manually retyping LLM-generated code

#61
post #60

As someone who, at a point, would copy homework from someone else, copy book reports from online, and use the answer sheets to complete assignments, I can tell you this strategy is long known to accumulate and not prevent cognitive debt

How so?

Re: Prevent cognitive debt by manually retyping LLM-generated code

#63
post #31

This does not sound fun. It's better to work on your side projects with manual coding. You will learn more. Retyping things is inefficient for learning. It's like trying to retype calculus solutions — you don't learn from it. Even if there is an explanation of why the code is written in such a way, you did not come up with it, and you don't know alternative solutions. It is a practice for memorizing, not for building…

For fun I typed out code from old old magazines and it taught me quite a few things.

Also essays too and other texts non code from llm or books, it helps.

Re: Prevent cognitive debt by manually retyping LLM-generated code

#64
Alternatively, what I tend to do after receiving generated code is a lot of asking "why?".

I've learned things I wouldn't otherwise have learned because I hadn't considered using the tools the LLM recommends. It's also a way to eliminate some hallucinating, given that critical questions are posed as unbiased as possible. For that, I also like to open a new chat with a different model and asking open-ended questions about a recommended tool I don't know much about, to double-check that the original LLM was likely correct in its recommendation in the first place.

Re: Prevent cognitive debt by manually retyping LLM-generated code

#65
I don't think it's bad to manually retype code as a way of learning.

Isn't a working program itself the best textbook? It's just a difference in learning methods. Depending on Stack Overflow is also a dependency, and searching for code on GitHub is also a dependency. How much dependency you allow is purely a personal difference, and it varies depending on your own study habits and learning style. Whether your learning method is superior or not likely depends on how your brain works.

People tend to think that the more painful something is, the better it is.

I don't deny that there are talented people who can read the manual and build everything from scratch. But I think that analyzing and rebuilding a working template step by step is also valuable.

I agree with the view that LLMs may cause cognitive decline. But if you go down that path, Socrates already criticized writing for weakening human memory. And how did that turn out? Books became a universal medium for knowledge. Then the internet came along. When Stack Overflow appeared, there was opposition, but it also had explosive adoption. LLMs are just the next step in that sequence.

If there is cognitive decline, I think there's also compensation in other areas. Using LLMs clearly causes some cognitive decline. And I think there are areas that need to be reinforced to compensate.

But having a baseline to work from—modifying already-working code—is genuinely helpful. I don't see what's wrong with using that as a way to learn.

Re: Prevent cognitive debt by manually retyping LLM-generated code

#66
post #31

This does not sound fun. It's better to work on your side projects with manual coding. You will learn more. Retyping things is inefficient for learning. It's like trying to retype calculus solutions — you don't learn from it. Even if there is an explanation of why the code is written in such a way, you did not come up with it, and you don't know alternative solutions. It is a practice for memorizing, not for building…

> Retyping things is inefficient for learning. It's like trying to retype calculus solutions

Says who? You're saying this unequivocally like you have research that supports this.

I used to re-write the notes I took for studying and it was like night and day for how well I did on tests. IT also gave me a chance to tighten the information I was receiving. And it's exactly what's happening here.

Re: Prevent cognitive debt by manually retyping LLM-generated code

#67
This resonates with me. The concept of cig it I've debt was something I've been experiencing but didn't have a name for it.

I think it is worth noting that not all code is equal... One could argue that adding a library is in some ways similar to copy/pasting code in as much as, one doesn't know what the code is doing, and yet that doesn't leave me with a sense of unease!

So it might be that as I'm working with an LLM there are parts (boring, as the author calls them) that are not worth "knowing" how they work, something uninteresting or that a correct output is all that us needed, I'm totally fine having the agent write that code, but the sections I need to know how they work, I think it might make sense to write those by hand!

Re: Prevent cognitive debt by manually retyping LLM-generated code

#68
post #60

As someone who, at a point, would copy homework from someone else, copy book reports from online, and use the answer sheets to complete assignments, I can tell you this strategy is long known to accumulate and not prevent cognitive debt

u sure?

Re: Prevent cognitive debt by manually retyping LLM-generated code

#69
This is the workflow that Vs Code Copilot does. All the AI generated code changes are in a git worktree and you can step through them all. This is what I missed after Claude forced third parties to start charging API pricing and now I have to use Claude directly and I have to do this same review process in a clunkier way via my git client.

Re: Prevent cognitive debt by manually retyping LLM-generated code

#70
post #44

I already wrote my opinion on this, which I don't think anyone read, but my idea is to let AI code the working system, and then prompt it to teach you, give you challenges, and grade your work. If you write, you should write in your own words, to demonstrate your own understanding - the so-called Feynman technique. Never verbatim. That's as true for coding as it is for study notes.

My counterpoint to that is, you never know when the factuality of its analysis is mistaken because you're making it the point of authority over knowledge you should be working to acquiring.

In math classes back at school, it didn't matter how much the math professor explained how the formula works. What mattered is me putting in the effort to understand it. The implication to your example is, I should already be familiar enough to understand the generated code to the point where all the explanation that it's doing is effectively a "Quality of Life feature".

Post reply on HN