Live data from Hacker News

Prevent cognitive debt by manually retyping LLM-generated code

ankursethi.com

11–20 of 479 posts

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

#11
This method doesn't seem bad.

Realistically, LLMs write code much better than most people. In my domain, there are areas where I still write better code than an LLM, especially when it comes to physical constraints it might not understand, but there are far more domains where the LLM writes much better code than I do. In that sense, writing code with an LLM and keeping track of it feels more helpful than I expected.

Practicing solo coding for an hour a day often ends up being mechanical and not very useful. This might actually be more helpful.

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

#12
post #6

But this way you move way slowly even on personal projects, like you will not even get the basic UI for the app done in a few days? Is that OK for you?

It is meant to offset not knowing why everything degrades and you can't make progress after the first month. Is that OK for you?

No you misunderstand me. I support such a view but cannot hold it because my pace at work is so much fast. And hand coding like this will make personal projects s slow and choreful with no visible progress. Like where is the joy in that?

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

#13
Good advice yesterday, good advice today, and good advice tomorrow.

I don't remember if I read this advice or just intuited it myself (perhaps after some hard lessons), but it's a programming habit I've kept for as long as I can remember (I started coding in the 90s). If I feel rushed, e.g. someone looking over my shoulder, and I copy+paste something, it always leaves me with a sense of unease. It creates a memory & comprehension hole that sticks out like a sore thumb, even for seemingly simple snippets. You can't really be sure it's simple without stepping through it carefully, and simple can be deceptive because it's usually the interactions and assumptions wrt surrounding code that lead to surprises. Typing out code manually gives you time and space to consider the broader picture.

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

#15
If you copy/paste code from a teaching book, you will probably not learn as well as if you type it.

Typing itself is irrelevant, it is the timing spent, even if only seconds, pondering at what each word or syntactic element is and why use it.

Being slower does not automatically make you learn better, focus on the learning is what makes the difference.

If you don't have the opportunity to learn, the time to actually think, then a faster tool is not helping.

TL;DR: what matters is why you are doing something, is it solely to get the task done or is it primary to learn, or both?

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

#16

You are cooked if you can’t actually write better code than llm. Try reading some books or documentation

I think there are far more people who can't write better code than an LLM. Of course, there are a few exceptions, but it's a fact that LLMs are already handling PhD-level mathematics and papers.

I also think I write better code than an LLM in certain areas, but in most programming domains, the LLM knows more than I do across many dimensions. As prompts get deeper, LLMs are already producing PhD-level code—and that's been shown in research. The vast majority of people don't have that level of education. Of course, having a PhD doesn't guarantee good coding, but at least it's clear that LLMs can handle that level of capability.

People might disagree, but my view is firm on this.

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

#17
I like the "cognitive debt" term. With the latest models, what I've observed is that they are really good, but I don't use them to write main code because I need to know what I'm doing.

The article is not wrong though that it pays off to have some imagination on how to use the models. For example, I want to use SIMD instructions in an ESP32-P4 CPU. Those instructions are undocumented for the most part, with just a couple of handwavey blog posts and some infuriatingly vague marketing material. So I just asked an LLM to create a `SIMD_P4.md` document with all the details. Lo and behold, it practically reverse-engineered the ISA. Now I can program in assembler by hand all I want and build that skill in my own brain, and whenever I find a slightly unclear op in the document, I ask the LLM to refine the documentation in that op.

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

#18
post #6

But this way you move way slowly even on personal projects, like you will not even get the basic UI for the app done in a few days? Is that OK for you?

It is meant to offset not knowing why everything degrades and you can't make progress after the first month. Is that OK for you?

Has this been your first hand experience?

And if so, in what work, and have you tried debugging issues with SOTA models?

From my experience it is certainly not the case that you cannot make progress after the first month.

I work on native mobile applications.

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

#19
post #16

You are cooked if you can’t actually write better code than llm. Try reading some books or documentation

I think there are far more people who can't write better code than an LLM. Of course, there are a few exceptions, but it's a fact that LLMs are already handling PhD-level mathematics and papers. I also think I write better code than an LLM in certain areas, but in most programming domains, the LLM knows more than I do across many dimensions. As prompts get deeper, LLMs are already producing PhD-level code—and that's…

> I also think I write better code than an LLM in certain areas, but in most programming domains, the LLM knows more than I do across many dimensions.

Remember that the quality of the LLMs code in the areas you don’t know is as good as the quality as the area you do know. You’re only able to gauge the quality of what you do know.

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

#20

But this way you move way slowly even on personal projects, like you will not even get the basic UI for the app done in a few days? Is that OK for you?

Do you really find your typing speed to be the bottleneck in getting things done? I suppose that's pretty easily fixed, at least.

Anyway the author did address that

> Using LLMs this way allows me to work faster than not using LLMs at all, but I'm still slower than those who are willing to allow the machine to think for them. Instead of being 10x faster, I'm probably only 2x faster. But what I lose out on in terms of speed, I gain in terms of a deeper understanding of my code.

Post reply on HN