martinfowler.com · Saved

An example of LLM prompting for programming

martinfowler.com/articles/2023-chatgpt-xu-hao.html

What Jamie wrote

This is an incredible example of creating a solution using ChatGPT. I've done many examples of having ChatGPT write code, but this approach creates a solution that can be debated and improved before you just spit out code.

A common way of interacting with an LLM is to give it a problem and ask it to generate some final product, whether than be prose or (in this case) code. With Generated Knowledge we split our interaction into separate steps: first ask the LLM to generate some useful information about the problem, and then we feed that information back into the LLM to generate the final product.

This is a super interesting way of working with another system in a pair-programming manner.

My take away from this discussion was that using chain of thought and generated knowledge prompting approaches can be a significantly useful tool for programming. In particular it shows that to use LLMs well, we need to learn how to construct prompts to get the best results. This experience suggests that it’s useful to interact with the LLM like a junior partner, starting them with architectural guidelines, asking them to show their reasoning, and tweaking their outputs as we go.

This is whole thing is incredible. 🤯