-: The third principle is providing examples,
inserting a diverse set of test cases
where the task was done correctly.
Now this is really important.
In fact, it's one of the main things
that researchers test when they're trying out a new model
and they see how well it does
with no examples versus one example versus three or five
or 100 examples of the task.
And that's called zero shock or few shock.
And the reason why we put this third,
even though it's so important,
is that it's the more costly prompt engineering tactic.
Providing direction is usually pretty quick.
You can just say in the style of Steve Jobs
or if you're specifying the format, you can just say,
I want this in terms of a comma separated list.
Whereas providing examples, you have to go out
and find good examples and cherry pick them
and put them into the prompt in some way.
So let's look at how this works with text models.
This is our generic prompt where we're just looking
for a list of 10 product names for a pair of shoes
that can fit any foot size.
But our engineered prompt actually includes some examples.
We provided three examples of the types
of names that we like.
Now in the product template, we have a space for those.
You can see in the hashtag Examples.
And then we have the curly braces
where we insert the product examples there.
And typically, I would like to put
that in the middle of the prompt.
You start with the task
'cause that's the most important thing.
You give it some style direction
or roles that it needs to play.
And then you would also insert the examples underneath that.
Now you can see that in our examples,
not only did we say we want it in the style of Steve Jobs,
but we also made every single product name start with an i.
And that has fixed the creativity to a specific point.
Now, Steve Jobs didn't name every single product with an i,
but if you do this,
then you will get only names that come out with is.
And that's an important thing to note about examples,
is that they are do make the prompt much more reliable
but at the cost of creativity.
You're constraining creativity to just give product names
that start with i.
Now, if you want to give a more diverse set of examples,
you're gonna get a more diverse set of responses as well.
Now let's see how we can change the results
that we get based on the variable that we've input.
So in this case, I went back and I changed all of the names
in the examples to start with Apple and then the product.
And you can see that the responses about Apple,
Fit, Apple FlexWalk, Apple OmniFit.
So we constrained it in that direction now instead.
If you add the word mini to everything,
that adds the word mini to every response.
If you begin with the word Air,
then it will come back with different names there.
So it just goes to show how much of an impact on results
that changing the examples can have.
Now let's look at image models
where it works a little bit differently.
You can't usually give more
than one example with image models.
And you see in the naive prompt,
we didn't give any examples.
So it's gone in lots of different directions.
It's pretty creative there, right?
Like, we have this old-man-looking shoe at the top,
we have the robot shoe with a robot leg at the bottom.
The one on the bottom right
actually looks like an astronaut shoe.
Now, in terms of prompt engineering,
we can see that the engineered prompt
actually gives us pretty reliable results.
Of all four of the options,
they all constrained to the same shape.
That's because we included this one example here, the image.
In the prompt template, we don't list this,
but there's a place to upload an example image
for Stable Diffusion.
They call this image-to-image in the literature.
And you can see here we've uploaded an image of...
This is specifically a Nike shoe that has this weird bend
because it's flexible, and we've uploaded that,
but we set it at 35% weight.
And you can change the weight from zero
to 100% would make it very similar,
and 0% would make it very dissimilar.
But we've settled on 35%.
We can see we're getting pretty good results.
We get this weird bend.
We also take from the example the black and the white.
Now, again, in terms of constraining creativity,
one thing I found in testing this is that I couldn't get it
to do any colors other than black and white
because it's reading too much into this one example here.
You can see I managed to get the blue
and the pink highlights in there,
but I couldn't change the color of the sole
or the, you know, overall background color of the shoe.
So here's a few examples
where I've changed the results based on, literally,
the same prompt, just a different background image,
different upload image.
Here, I uploaded some wool shoes
and I got a very weird response.
This one here, the fuzzy one.
I uploaded a pair of Crocs and got this,
and then I uploaded some platform heels and got this.
So you can see, you can really change the results,
and the model takes a lot
of steering from the example image that you upload.
So choosing a good example image makes a big difference.
And both in terms of the format
and the form, but also the style.
So if you have an image that works really well,
that captures your style pretty well,
then you can use that as an example
when you're doing any type of image.
And that's gonna give you pretty consistent results.