WEBVTT

00:00.210 --> 00:01.290
Instructor: So in this video,

00:01.290 --> 00:03.630
I want to discuss some very good tips

00:03.630 --> 00:06.630
that can help you get started with prompt engineering

00:06.630 --> 00:08.970
and to manufacture some prompts

00:08.970 --> 00:12.870
that will produce you some awesome responses.

00:12.870 --> 00:15.330
Those tips are low hanging fruit.

00:15.330 --> 00:18.000
That means that it's super easy to incorporate them,

00:18.000 --> 00:20.130
and to implement them in your prompts.

00:20.130 --> 00:21.210
So once you do that,

00:21.210 --> 00:23.460
your prompt's going to be much, much better,

00:23.460 --> 00:26.010
and you'll see an improvement in your answers

00:26.010 --> 00:28.200
that you get from the large language model.

00:28.200 --> 00:31.320
So the first thing we need to consider is the context.

00:31.320 --> 00:33.930
Now the context is super important

00:33.930 --> 00:38.040
because it gives our prompt some contextual relevance

00:38.040 --> 00:41.790
and for generating coherent and accurate responses,

00:41.790 --> 00:43.557
we need to have the context.

00:43.557 --> 00:46.680
Now, if we don't provide the context to our prompt,

00:46.680 --> 00:50.664
then we are simply leaving this task of creating the context

00:50.664 --> 00:52.440
to the large language model,

00:52.440 --> 00:56.940
and the LLM will not provide the context that we may want.

00:56.940 --> 00:59.460
And we're simply leaving the LLM to guess

00:59.460 --> 01:00.780
what is the context,

01:00.780 --> 01:03.800
and that may generate a response that will be off topic

01:03.800 --> 01:05.790
and it won't be relevant

01:05.790 --> 01:07.950
or inconsistent with the goal that we want

01:07.950 --> 01:10.323
to achieve with our prompt.

01:10.323 --> 01:15.181
Okay, so this is example that we pass to the LLM sub context

01:15.181 --> 01:19.050
and we can see what kind of context the LLM deduces

01:19.050 --> 01:21.090
from the context that we gave it.

01:21.090 --> 01:22.890
So the prompt is the following.

01:22.890 --> 01:25.880
We want to tell the LLM to break down our prompt

01:25.880 --> 01:28.410
with contextual relevance.

01:28.410 --> 01:31.350
So the prompt is we want to generate a list

01:31.350 --> 01:33.390
of technical interview questions

01:33.390 --> 01:35.384
for a senior DevOps engineer position

01:35.384 --> 01:38.424
in a tech startup in a fast-paced culture

01:38.424 --> 01:40.757
working in the cloud, okay?

01:40.757 --> 01:44.220
So the task is to break down the prompt

01:44.220 --> 01:45.690
into contextual relevance.

01:45.690 --> 01:46.800
This is the task.

01:46.800 --> 01:48.300
And what comes after it,

01:48.300 --> 01:51.033
the entire sentence over here is the context.

01:53.190 --> 01:55.500
Now, what we can learn from the response

01:55.500 --> 01:59.144
that we got is that the LLM was smart enough

01:59.144 --> 02:03.420
to first recognize what is the context that we provided,

02:03.420 --> 02:06.420
and it was even able to label it as context

02:06.420 --> 02:09.810
and it was even able to label the task,

02:09.810 --> 02:13.050
which was to generate the technical interview question,

02:13.050 --> 02:14.580
which is super, super cool,

02:14.580 --> 02:17.670
and it is helping us to get a better result.

02:17.670 --> 02:20.610
So now I'm simply going to paste in the prompt

02:20.610 --> 02:23.940
that we want only the interview questions.

02:23.940 --> 02:25.293
Now let's review them.

02:27.720 --> 02:29.580
Now, we're not going to review all

02:29.580 --> 02:30.840
of the questions over here,

02:30.840 --> 02:33.210
but let's take a look at the first one.

02:33.210 --> 02:36.000
So how would you handle a sudden spike in traffic

02:36.000 --> 02:37.590
on the company's website?

02:37.590 --> 02:38.670
What steps would you take

02:38.670 --> 02:40.470
to ensure the website remains available

02:40.470 --> 02:42.563
and responsive to the users?

02:42.563 --> 02:46.424
So I personally come from a software engineering, DevOps,

02:46.424 --> 02:49.923
and cloud native application development background.

02:49.923 --> 02:51.923
And I can tell you right now

02:51.923 --> 02:55.123
that this interview question is very deep

02:55.123 --> 02:59.661
and you can talk only on this question for a half an hour,

02:59.661 --> 03:02.970
an hour, even two hours about the strategies,

03:02.970 --> 03:05.501
about how to implement, about use cases.

03:05.501 --> 03:07.704
So it's a very deep question,

03:07.704 --> 03:10.470
and even when I was interviewing candidates

03:10.470 --> 03:12.210
to a software engineering position,

03:12.210 --> 03:13.725
which also involved DevOps,

03:13.725 --> 03:16.350
this was a question that I asked it

03:16.350 --> 03:18.213
in a similar way or another.

03:19.540 --> 03:20.910
So just to summarize,

03:20.910 --> 03:24.150
the more contextual relevance that we add to our prompt,

03:24.150 --> 03:26.160
the better the results that we will get.

03:26.160 --> 03:28.500
So this is a very low hanging fruit

03:28.500 --> 03:30.000
and it's super easy to put

03:30.000 --> 03:32.613
and this will make the results much, much better.

03:33.720 --> 03:37.320
Okay, so the second tip is that we need

03:37.320 --> 03:41.400
to set a clear task that will not be ambiguous.

03:41.400 --> 03:45.180
So the task definition need to set a specific goal

03:45.180 --> 03:48.410
or objective for the LLM to achieve.

03:48.410 --> 03:52.050
So if we don't provide this goal that is clear,

03:52.050 --> 03:55.540
that is precise, that it is exactly what we want,

03:55.540 --> 03:59.670
then we simply leave it for the LLM to choose for us.

03:59.670 --> 04:02.760
So I like to think of it like when my wife sends me

04:02.760 --> 04:04.950
to the supermarket to buy apples.

04:04.950 --> 04:07.650
So okay, she didn't say what kind of apples,

04:07.650 --> 04:09.120
green apples, red apples.

04:09.120 --> 04:13.380
Does she want small ones, medium ones, large ones? I dunno.

04:13.380 --> 04:14.707
So I bring them apples

04:14.707 --> 04:17.760
and of course the result is not what she wanted

04:17.760 --> 04:19.050
and she's disappointed

04:19.050 --> 04:21.750
because I didn't bring her the apples she wanted.

04:21.750 --> 04:24.510
Now, in my opinion, being a prompt engineer

04:24.510 --> 04:27.240
is having great communication skills.

04:27.240 --> 04:30.780
So it is important to have communication skills with people,

04:30.780 --> 04:33.780
of course, because you want to know how to convey a message

04:33.780 --> 04:36.330
and you want people to understand what you want.

04:36.330 --> 04:38.250
So the same thing is happening

04:38.250 --> 04:40.200
with the large language model.

04:40.200 --> 04:42.510
If we want to be great in prompt engineering,

04:42.510 --> 04:44.220
then we need to sharpen

04:44.220 --> 04:46.290
and to improve our communication skills,

04:46.290 --> 04:48.060
but this time with the LLM.

04:48.060 --> 04:50.520
And the LLM likes to get the prompts

04:50.520 --> 04:55.520
that are having concise, clear and non-ambiguous tasks.

04:57.450 --> 05:01.171
Okay, so I think now is a good time to review an example

05:01.171 --> 05:02.790
of an ambiguous task

05:02.790 --> 05:06.240
because it will help us avoid those kind of tasks.

05:06.240 --> 05:08.430
So let's take a look at the prompt,

05:08.430 --> 05:12.406
improve the user experience of this e-commerce website.

05:12.406 --> 05:15.150
Now this prompt is ambiguous

05:15.150 --> 05:18.088
because it doesn't specify what aspect

05:18.088 --> 05:21.208
of the user experience needs to be improved

05:21.208 --> 05:23.520
or how should it be improved.

05:23.520 --> 05:26.580
This prompt doesn't provide any specific guidelines

05:26.580 --> 05:31.500
or metrics for evaluating the success criteria of the task.

05:31.500 --> 05:34.152
The task would be interpreted in many, many ways,

05:34.152 --> 05:37.560
and this could lead to confusion, lack of clarity,

05:37.560 --> 05:40.083
and lower performance overall.

05:40.950 --> 05:43.770
Okay, now let's change this prompt

05:43.770 --> 05:45.570
and let's make it clearer,

05:45.570 --> 05:48.450
make it less ambiguous and overall better.

05:48.450 --> 05:50.520
So now the task is identify

05:50.520 --> 05:53.790
and address specific pain points in the user experience

05:53.790 --> 05:58.080
of the e-commerce website to increase customer satisfaction

05:58.080 --> 05:59.940
and sales conversion rates.

05:59.940 --> 06:02.488
Now this version of the prompt is clearer

06:02.488 --> 06:05.912
because it specifies that the task involves with identifying

06:05.912 --> 06:09.592
and addressing specific pain points in the user experience

06:09.592 --> 06:12.420
rather than simply improving the user experience

06:12.420 --> 06:13.770
in a general sense.

06:13.770 --> 06:17.940
So this prompt also includes specific goals for the task,

06:17.940 --> 06:20.070
like increasing customer satisfaction

06:20.070 --> 06:21.600
and sales conversion rates.

06:21.600 --> 06:25.050
And this provides more concrete metrics

06:25.050 --> 06:27.423
for evaluating the success of the task.

06:29.220 --> 06:32.940
Now, this task was not ambiguous, it was clear

06:32.940 --> 06:36.543
and it was accurate because we were very specific.

06:36.543 --> 06:39.667
And as far as specificity, then it will refer to the level

06:39.667 --> 06:44.667
of detail that we include in our prompt to be more precise.

06:44.910 --> 06:47.490
The more specific the prompt will be,

06:47.490 --> 06:51.480
the more likely that the LLM will generate a targeted

06:51.480 --> 06:53.910
and accurate response.

06:53.910 --> 06:58.860
Okay, the final idea I want to introduce is iterations.

06:58.860 --> 07:02.280
Now iterations are crucial in prompt engineering

07:02.280 --> 07:05.580
and in the design of a prompt process.

07:05.580 --> 07:08.550
I'm a very big fan of this process.

07:08.550 --> 07:12.026
It is being practiced a lot in software.

07:12.026 --> 07:15.542
It's also introduced in the book "The Lean Startup."

07:15.542 --> 07:19.706
And basically to iterate is to repeat and repeat and repeat.

07:19.706 --> 07:22.186
And each time we repeat the process,

07:22.186 --> 07:24.266
we simply change it a bit

07:24.266 --> 07:28.770
and we simply make our execution better.

07:28.770 --> 07:30.900
So in prompt engineering,

07:30.900 --> 07:34.260
the iteration will involve refining the prompt

07:34.260 --> 07:36.990
that will improve it overall, okay?

07:36.990 --> 07:40.940
So it would also involve testing and evaluating the output.

07:40.940 --> 07:43.770
Each iteration should rely on the output

07:43.770 --> 07:45.540
of the previous iteration,

07:45.540 --> 07:47.979
and through this output, it should refine

07:47.979 --> 07:50.640
and make the prompt better.

07:50.640 --> 07:54.750
So this process will result in an optimized prompt

07:54.750 --> 07:58.620
according to our likings, after we iterate, we refine it

07:58.620 --> 08:00.720
and we have the perfect prompt

08:00.720 --> 08:03.753
that will give us the perfect result that we want.

08:06.870 --> 08:10.050
So we are going to finish this video soon,

08:10.050 --> 08:13.320
and I want that the takeaway from this video to be

08:13.320 --> 08:17.940
that the time we take to write a prompt is super important.

08:17.940 --> 08:20.850
And before we write a prompt, I know it's tempting

08:20.850 --> 08:23.550
to simply write something fast and click enter,

08:23.550 --> 08:27.600
but if we invest the time of prompt engineering our prompt

08:27.600 --> 08:31.167
and making it more precise, refining the tasks,

08:31.167 --> 08:35.580
adding the context, being specific, not being ambiguous,

08:35.580 --> 08:40.106
and constantly refining our prompts over iterations,

08:40.106 --> 08:44.619
then the results that we will get will be much better,

08:44.619 --> 08:47.523
and this will overall save us time.

08:48.450 --> 08:50.880
So that's what's really prompt engineering is about,

08:50.880 --> 08:52.463
in my opinion, to manufacture

08:52.463 --> 08:55.590
and to create this perfect prompt

08:55.590 --> 08:57.813
that will give you exactly what you want.
