2 ms·
The major tips I would add to this are: 0. ask it to ask you clarifying questions, which it rarely does by default when you're prompting it to do a task; often
by gwern 3y ago
The major tips I would add to this are:
0. ask it to ask you clarifying questions, which it rarely does by default when you're prompting it to do a task; often it has a few questions, which you can efficiently update your original prompt to cover.
1. make it generate a test-suite; have it iteratively generate new tests which don't overlap with the old ones.
2. ask GPT-4 explicitly to identify improvements, edge-cases and bugfixes, and then go through the list one by one having it rewrite for each one; not infrequently, a fancy rewrite will fail the test-suite from #1, but given the failing test-case, GPT-4 can fix it.
3. once it is clean and it's either done the list or you've disapproved the suggestions, and the test-suite is passing, ask it to write a summary design doc at the beginning.
With all this, you're set up for fairly maintainable code: with the test-suite and the up-front design doc, future LLMs can handle it natively and well, and humans should be able to read it easily after #2 has finished, so you don't need to care where it came from or try to track 'taint' through all future refactorings or usage - GPT-4 can write pretty readable human-like code, it just doesn't necessarily do it the best way the first time (also like a human), so you have to apply inner-monologue ideas.
- jstummbillig 3y agoOther than "this is fantastic, thank you!", I have no actual response to your comment, but it would be remiss not to ask for more insights into coding with ai (maybe in a post in your blog?)
- gwern 3y agohttps://gwern.net/tla#effective-gpt-4-programming https://gwern.net/tla#effective-gpt-4-programming