I want to start off this series, with some general theory and then we'll go into building an actual application!
By now you've probably already tried some form of zero shot or few shot prompting. If you haven't here's quick explanation:
Both are ways of getting a large language model (LLM) to perform a task that it wasn't specifically trained for without finetuning. Some usecases could be:
- Sentiment analysis on text the model's never seen before
- Writing in your, or your company's style or tone of voice
- Creating product names The list goes on, but I think you get it.
Zero Shot:
The simplest one is to just tell or ask the model to do what you want, with no examples whatsoever. This can work quite well, given the vast training data most of the really popular LLMs are trained on.
Few Shot:
This one just means giving the model a few examples of the task or final output you want. It's a way of guiding the model to your final outcome.
Both of these are a great ways of getting simple, shorter tasks done. But once you have anything more complex, you need more of a "human" brain. And human brains allow us to think and reason. That's where chain of thought comes into the picture.
Chain of Thought
The TLDR; chain of thought is a way to prompt the LLM to reason its way through a problem by chaining rationales, one step at a time, until it reaches a solution. Again, there are two types:
Zero shot:
This involves getting the model to work through a problem using natural language, like "show your rationale, step by step" or ""Let's break this down into smaller steps and consider each one in turn. What is the first step we need to take, and what information do we need to gather in order to take that step? Once we have that information, what is the next logical step to take? Let's continue this process until we have a clear understanding of the issue at hand and a plan for how to proceed."
Few shot:
With shot you give some examples of rationale chains, so it knows how to work through a problem. For example, by providing a few examples on how to do BODMAS, before asking it to solve a maths problem.
So, there you have it, a very quick theory session on prompt engineering. In the next post, we'll start putting this (in particular chain of thought) into action by building a content engine. All powered by AI.
Top comments (0)