这是我如何使用LLMs来帮助我编写代码
11th March 2025
2025年3月11日
Online discussions about using Large Language Models to help write code inevitably produce comments from developers who’s experiences have been disappointing. They often ask what they’re doing wrong—how come some people are reporting such great results when their own experiments have proved lacking?
关于使用大型语言模型来帮助编写代码的在线讨论不可避免地会产生一些开发者的评论,他们的经历令人失望。他们常常问自己做错了什么——为什么有些人报告了如此出色的结果,而他们自己的实验却证明不尽如人意?
Using LLMs to write code is difficult and unintuitive. It takes significant effort to figure out the sharp and soft edges of using them in this way, and there’s precious little guidance to help people figure out how best to apply them.
使用LLM编写代码是困难和不直观的。弄清楚以这种方式使用它们的尖锐和柔和边缘需要付出相当大的努力,而几乎没有指导可以帮助人们弄清楚如何最好地应用它们。
If someone tells you that coding with LLMs is easy they are (probably unintentionally) misleading you. They may well have stumbled on to patterns that work, but those patterns do not come naturally to everyone.
如果有人告诉您使用LLMs编码是简单的,他们可能是在(无意中)误导您。他们可能确实发现了有效的模式,但这些模式并不是每个人都能自然掌握的。
I’ve been getting great results out of LLMs for code for over two years now. Here’s my attempt at transferring some of that experience and intution to you.
我已经从LLM中获得了超过两年的代码出色结果。以下是我尝试将一些经验和直觉传递给你的方式。
Set reasonable expectations #
设定合理的期望 #
Ignore the “AGI” hype—LLMs are still fancy autocomplete. All they do is predict a sequence of tokens—but it turns out writing code is mostly about stringing tokens together in the right order, so they can be extremely useful for this provided you point them in the right direction.
忽略“AGI”的炒作——LLMs 仍然是高级自动补全。它们所做的只是预测一系列标记——但事实证明,编写代码主要是将标记按正确顺序串联在一起,因此只要你指引它们正确的方向,它们可以是 极其 有用的。
If you assume that this technology will implement your project perfectly without you needing to exercise any of your own skill you’ll quickly be disappointed.
如果你认为这项技术会完美地实现你的项目,而你不需要发挥任何自己的技能,你会很快感到失望。
Instead, use them to augment your abilities. My current favorite mental model is to think of them as an over-confident pair programming assistant who’s lightning fast at looking things up, can churn out rele...