Title: Prompt Engineering

  • Not So Typical Intro to LLMs
  • Prompt Engineering
  • Formatting Prompt in Python
  • Hands-on Walkthrough and Tasks

  • ✦ Getting the LLMs to give you the output you want can be challenging. It can be likened to taming magical beasts because they may not do your bidding. This is where prompt engineering comes in.
    • A prompt is the term used to describe a question, statement, or instruction given to an LLM, like ChatGPT.
    • It serves as a starting point for the AI to generate a response or complete a task. 



Importance of Prompt Engineering

  • ✦ Prompt engineering refers to the art and science of the design of prompts for LLMs to produce high-quality, coherent outputs.
    • This is a crucial aspect of working with LLMs, as the quality of the prompt can greatly affect the quality of the generated text.
    • One fundamental challenge is that the responses from LLM are not fully predictable.
    • Indeed, it is not an exact science. Sometimes, changing a word or the order the sentences in the prompt may produce a very different response.



How do the Prompt works?

  • ✦ Why do they sometimes provide high-quality responses and other times fabricate facts (or what we call hallucinate)?

    • Or why does adding let’s think step-by-step to a prompt suddenly improve the quality?
    • But the truth is, we still don’t fully understand how LLMs work.
  • ✦ We won’t bore you with complex prompt just yet; instead, we will just share a few examples that can instantly improve the performance or your prompts:

    • “Let’s think step by step” — works great for reasoning or logical tasks..
    • “Take a deep breath and work on this problem step-by-step“— an improved version of the previous point. It can add a few more percent of quality
    • “This is very important to my career” — just add it to the end of your prompt and you’ll notice a 5–20% improvement in quality.
    • "I will reward you with $100 if your response is great" - try and it and share with us!
  • ✦ Due to all this, scientists and enthusiasts can only experiment with different prompts, trying to make models perform better.




Prompt Engineering Playbook

  • ✦ Writing an effective prompt can be a tricky process that demands patience, creativity, and a good grasp of how LLMs behave in general.
    • It is an iterative process that involves some trial-and-error to progressively refine the prompts to get closer to your intended responses.
    • While the outputs from LLM are unpredictable, we can use well-established prompting techniques to increase the consistency and desirability of the LLM output.
    • For this reason, prompt engineering is also sometimes called natural language programming.
  • ✦ After signing up for AI Champions Bootcamp, all participants have been encouraged to complete the 🪄📖 Prompt Engineering Playbook 📖🪄 before this programme starts.
    • If you have yet to complete the Playbook, we'd like you to go through page 1 to page 87 of the Playbook before trying out the hands-on tasks for week 1.
image

📖 Prompt Engineering Playbook
NEW

Info

If you have access to the WOG network, you can also find the Public Sector version of the Prompt Engineering Playbook in the "Learn" section on launchpad.gov.sg. For the purpose of this training, you can refer to either version.

👍🏼 We highly recommend spending a few evenings to complete the remaining pages of Prompt Engineering Playbook. This will not only allow you to better control the model’s behaviour but will also help improve quality of the output, a great help for your POC development down the road.




Further Readings

If you're keen to explore further, there are extra resource in 6. Further Readings that you might find interesting, including tools that current under active research or tools that the open source community has built.