With the increasing relevance and hype around Large Language Models (LLMs) that are publicly available, getting incremental performance improvements is often times the difference between you and your competitors. As developers, we’re often wary of letting anyone other than ourselves write code that we are responsible for. This reluctance is understandable (as is continuing to use EMACs in 2023), but it is likely that the industry standard will change, and leveraging LLMs to help write your code will become industry standard. Although there has been some recent discussion around tips for prompt engineering, we want to share with you some tips about prompt engineering specifically for developers.
A diverse range of valid examples can help the model recognize different patterns and improve its performance across a variety of use cases. Not to mention knowing test cases always helps you validate the sometimes questionable code written by the LLMs.
We have found that occasionally, LLMs will mix up syntax between library versions that are incompatible- especially in playgrounds outside of IDEs. One way to avoid this would be to always use languages which are backwards compatible, like Clojure. That’s a luxury many of us cannot afford however. One way to ameliorate this is to be specific with the LLM which version you’re looking for, and have some gotchas in mind that will alert you to a mismatch.
Similar to adding test cases, code comments can add valuable context to the LLM. Not to mention it will help your collaborators understand your intent as well.
The cognitive load of being a developer is not fully the realm of computers yet. The more specific you can be with your inputs and outputs, the greater the likelihood that your generated code will solve the issue. After all, LLMs can easily help you with the boilerplate around a react file, but they won’t tell you how to design a front end with design requirements in mind. This may not be what everyone wants to hear- but it is what will keep you employed.
We hope you find these tips helpful. If you’re interested in a free sandbox in which you can write code by interfacing with our chatbot, PromptOps, check out the link below to join our public workspace, or add your email to join the waitlist to add it to your own.