WEBVTT

00:00.180 --> 00:02.910
-: The third principle is providing examples,

00:02.910 --> 00:04.980
inserting a diverse set of test cases

00:04.980 --> 00:07.200
where the task was done correctly.

00:07.200 --> 00:09.030
Now this is really important.

00:09.030 --> 00:10.506
In fact, it's one of the main things

00:10.506 --> 00:13.920
that researchers test when they're trying out a new model

00:13.920 --> 00:15.270
and they see how well it does

00:15.270 --> 00:18.960
with no examples versus one example versus three or five

00:18.960 --> 00:21.150
or 100 examples of the task.

00:21.150 --> 00:23.970
And that's called zero shock or few shock.

00:23.970 --> 00:25.980
And the reason why we put this third,

00:25.980 --> 00:26.947
even though it's so important,

00:26.947 --> 00:31.290
is that it's the more costly prompt engineering tactic.

00:31.290 --> 00:33.150
Providing direction is usually pretty quick.

00:33.150 --> 00:35.259
You can just say in the style of Steve Jobs

00:35.259 --> 00:38.490
or if you're specifying the format, you can just say,

00:38.490 --> 00:41.910
I want this in terms of a comma separated list.

00:41.910 --> 00:43.920
Whereas providing examples, you have to go out

00:43.920 --> 00:46.140
and find good examples and cherry pick them

00:46.140 --> 00:49.020
and put them into the prompt in some way.

00:49.020 --> 00:52.230
So let's look at how this works with text models.

00:52.230 --> 00:54.589
This is our generic prompt where we're just looking

00:54.589 --> 00:57.450
for a list of 10 product names for a pair of shoes

00:57.450 --> 00:59.310
that can fit any foot size.

00:59.310 --> 01:02.820
But our engineered prompt actually includes some examples.

01:02.820 --> 01:05.191
We provided three examples of the types

01:05.191 --> 01:07.290
of names that we like.

01:07.290 --> 01:10.890
Now in the product template, we have a space for those.

01:10.890 --> 01:13.590
You can see in the hashtag Examples.

01:13.590 --> 01:15.000
And then we have the curly braces

01:15.000 --> 01:17.553
where we insert the product examples there.

01:18.450 --> 01:19.709
And typically, I would like to put

01:19.709 --> 01:21.592
that in the middle of the prompt.

01:21.592 --> 01:23.070
You start with the task

01:23.070 --> 01:24.352
'cause that's the most important thing.

01:24.352 --> 01:26.220
You give it some style direction

01:26.220 --> 01:28.140
or roles that it needs to play.

01:28.140 --> 01:32.673
And then you would also insert the examples underneath that.

01:34.446 --> 01:36.510
Now you can see that in our examples,

01:36.510 --> 01:39.840
not only did we say we want it in the style of Steve Jobs,

01:39.840 --> 01:43.757
but we also made every single product name start with an i.

01:43.757 --> 01:48.757
And that has fixed the creativity to a specific point.

01:48.930 --> 01:51.635
Now, Steve Jobs didn't name every single product with an i,

01:51.635 --> 01:53.591
but if you do this,

01:53.591 --> 01:57.060
then you will get only names that come out with is.

01:57.060 --> 02:00.270
And that's an important thing to note about examples,

02:00.270 --> 02:03.720
is that they are do make the prompt much more reliable

02:03.720 --> 02:05.400
but at the cost of creativity.

02:05.400 --> 02:08.790
You're constraining creativity to just give product names

02:08.790 --> 02:10.080
that start with i.

02:10.080 --> 02:13.410
Now, if you want to give a more diverse set of examples,

02:13.410 --> 02:16.923
you're gonna get a more diverse set of responses as well.

02:17.820 --> 02:20.994
Now let's see how we can change the results

02:20.994 --> 02:24.690
that we get based on the variable that we've input.

02:24.690 --> 02:28.200
So in this case, I went back and I changed all of the names

02:28.200 --> 02:31.830
in the examples to start with Apple and then the product.

02:31.830 --> 02:32.664
And you can see that the responses about Apple,

02:32.664 --> 02:36.600
Fit, Apple FlexWalk, Apple OmniFit.

02:36.600 --> 02:39.150
So we constrained it in that direction now instead.

02:39.150 --> 02:40.740
If you add the word mini to everything,

02:40.740 --> 02:43.170
that adds the word mini to every response.

02:43.170 --> 02:45.000
If you begin with the word Air,

02:45.000 --> 02:47.370
then it will come back with different names there.

02:47.370 --> 02:50.484
So it just goes to show how much of an impact on results

02:50.484 --> 02:53.013
that changing the examples can have.

02:54.600 --> 02:56.100
Now let's look at image models

02:56.100 --> 02:57.810
where it works a little bit differently.

02:57.810 --> 02:59.310
You can't usually give more

02:59.310 --> 03:01.530
than one example with image models.

03:01.530 --> 03:03.330
And you see in the naive prompt,

03:03.330 --> 03:05.220
we didn't give any examples.

03:05.220 --> 03:07.200
So it's gone in lots of different directions.

03:07.200 --> 03:08.760
It's pretty creative there, right?

03:08.760 --> 03:11.730
Like, we have this old-man-looking shoe at the top,

03:11.730 --> 03:15.330
we have the robot shoe with a robot leg at the bottom.

03:15.330 --> 03:16.800
The one on the bottom right

03:16.800 --> 03:18.660
actually looks like an astronaut shoe.

03:18.660 --> 03:20.640
Now, in terms of prompt engineering,

03:20.640 --> 03:23.460
we can see that the engineered prompt

03:23.460 --> 03:25.890
actually gives us pretty reliable results.

03:25.890 --> 03:27.546
Of all four of the options,

03:27.546 --> 03:30.480
they all constrained to the same shape.

03:30.480 --> 03:34.260
That's because we included this one example here, the image.

03:34.260 --> 03:37.050
In the prompt template, we don't list this,

03:37.050 --> 03:40.741
but there's a place to upload an example image

03:40.741 --> 03:42.210
for Stable Diffusion.

03:42.210 --> 03:45.240
They call this image-to-image in the literature.

03:45.240 --> 03:49.020
And you can see here we've uploaded an image of...

03:49.020 --> 03:52.545
This is specifically a Nike shoe that has this weird bend

03:52.545 --> 03:56.220
because it's flexible, and we've uploaded that,

03:56.220 --> 03:59.190
but we set it at 35% weight.

03:59.190 --> 04:00.600
And you can change the weight from zero

04:00.600 --> 04:02.300
to 100% would make it very similar,

04:02.300 --> 04:04.620
and 0% would make it very dissimilar.

04:04.620 --> 04:06.870
But we've settled on 35%.

04:06.870 --> 04:08.370
We can see we're getting pretty good results.

04:08.370 --> 04:09.690
We get this weird bend.

04:09.690 --> 04:14.040
We also take from the example the black and the white.

04:14.040 --> 04:16.557
Now, again, in terms of constraining creativity,

04:16.557 --> 04:20.490
one thing I found in testing this is that I couldn't get it

04:20.490 --> 04:22.710
to do any colors other than black and white

04:22.710 --> 04:26.340
because it's reading too much into this one example here.

04:26.340 --> 04:27.990
You can see I managed to get the blue

04:27.990 --> 04:29.460
and the pink highlights in there,

04:29.460 --> 04:32.160
but I couldn't change the color of the sole

04:32.160 --> 04:35.223
or the, you know, overall background color of the shoe.

04:36.540 --> 04:38.430
So here's a few examples

04:38.430 --> 04:42.000
where I've changed the results based on, literally,

04:42.000 --> 04:44.280
the same prompt, just a different background image,

04:44.280 --> 04:45.660
different upload image.

04:45.660 --> 04:47.190
Here, I uploaded some wool shoes

04:47.190 --> 04:49.470
and I got a very weird response.

04:49.470 --> 04:51.390
This one here, the fuzzy one.

04:51.390 --> 04:53.449
I uploaded a pair of Crocs and got this,

04:53.449 --> 04:56.010
and then I uploaded some platform heels and got this.

04:56.010 --> 04:57.769
So you can see, you can really change the results,

04:57.769 --> 04:59.580
and the model takes a lot

04:59.580 --> 05:02.940
of steering from the example image that you upload.

05:02.940 --> 05:05.793
So choosing a good example image makes a big difference.

05:05.793 --> 05:08.223
And both in terms of the format

05:08.223 --> 05:11.310
and the form, but also the style.

05:11.310 --> 05:13.800
So if you have an image that works really well,

05:13.800 --> 05:15.545
that captures your style pretty well,

05:15.545 --> 05:18.556
then you can use that as an example

05:18.556 --> 05:20.970
when you're doing any type of image.

05:20.970 --> 05:23.570
And that's gonna give you pretty consistent results.
