LLM series - DoiT International: Prompt engineering, not for dummies

This is a guest post for the Computer Weekly Developer Network written by Sascha Heyer in his capacity as senior machine learning (ML) engineer at DoiT International and oversees machine learning and system designs. 

With over 15 years of experience in software development, Heyer has knowledge of the application of the cloud for businesses, assisting over 320 companies to deploy ML during his time at DoiT. 

Prior to joining DoiT, he was the founder of the AI annotation platform IO Annotator and worked as the team lead for ecx.io – and IBM company. On top of this, he also runs a YouTube account where he explains different AI applications, machine learning algorithms and more. 

Heyer writes in full as follows…

If we summed up the past year in a word, it would be ‘AI.’ The explosion of OpenAI’s ChatGPT characterised 2023. It completely reshaped how machine learning (ML) engineers solve problems and code, so they must understand how to use these new tools as quickly as possible.

While consumers have been using AI for tasks like planning holidays, generating social media captions, or deciding which TV show to watch next, Large Language Models (LLMs) like ChatGPT (GPT4) and Google’s PaLM can only be properly trained by companies with money to invest in the project.

DoiT’s Heyer: Upskill now or get left behind.

Despite the investment required, transitioning from traditional ML to LLMs is pivotal. Formerly, engineers had to navigate various ML models for each use case – from simple linear regression to complex deep learning models – leading to time-consuming, repetitive and potentially error-prone processes.

However, LLMs have enabled them to shift their focus from manual model building to understanding how to harness the new capabilities at their disposal. As LLMs come pre-trained, we call them ‘foundation models’ as they require less manual intervention, allowing engineers to concentrate on prompt engineering for specific tasks rather than having to rely on multiple models.

Four types of prompts

While OpenAI recently launched a prompt engineering guide to support users, this process doesn’t come without complexities. Prompt engineering is skilled work that requires precise wording, formatting and structuring to achieve the desired results. While it’s an art rather than an exact science, well-crafted prompts significantly enhance LLM performance.

Different prompting techniques use different approaches and therefore, provide different answers.

These include:

  • Input Output Prompting – when an answer is given in response to an input.
  • Chain of Thought (CoT) Prompting – when the model is asked how it reached an answer.
  • Self-Consistency with CoT – when the engineer finds the most consistent answer from the CoT method.
  • Tree of Thoughts – when multiple CoT prompts are provided and used by the model to find the most effective answer.

This is an active research area with new techniques every week.

Mastering prompt engineering is a case of trial and error combined with good techniques, but ML engineers need to ensure they’re getting what they need.

This town is big enough

Despite the vast potential of LLMs, they haven’t rendered traditional ML techniques redundant – instead, they should be viewed as complementary. Traditional tools are still valuable for small datasets, straightforward use cases, or unique situations where LLMs may not have the deep expertise required.

The exponential growth of LLMs has required ML engineers to upskill in prompt engineering quickly and this expertise will become more valuable as the technology evolves.

It’s a case of upskill now or get left behind.