WEBVTT

00:00.000 --> 00:02.220
Eden: Let's discuss what's flow engineering,

00:02.220 --> 00:06.240
which is a new idea that has recently been discussed

00:06.240 --> 00:08.760
in the generative AI community.

00:08.760 --> 00:10.380
Now I warn you in advance,

00:10.380 --> 00:12.720
this is a very theoretical video

00:12.720 --> 00:16.260
and the idea of flow engineering is pretty abstract

00:16.260 --> 00:19.530
and not yet formalized to the end.

00:19.530 --> 00:20.880
So I don't expect you

00:20.880 --> 00:23.220
to understand everything in this video,

00:23.220 --> 00:25.380
but I promise you, by the end of this course,

00:25.380 --> 00:28.143
you'll know exactly what flow engineering is all about.

00:30.030 --> 00:33.660
Flow engineering is a systematic and strategic approach

00:33.660 --> 00:37.140
for developing software that will incorporate

00:37.140 --> 00:39.720
AI-driven decision-making processes.

00:39.720 --> 00:42.390
The essential goal of flow engineering

00:42.390 --> 00:44.100
is to manage and optimize

00:44.100 --> 00:47.940
how AI systems with LLMs handle tasks

00:47.940 --> 00:52.830
by defining a clear flow or a sequence of operations.

00:52.830 --> 00:54.870
These flows are not merely linear,

00:54.870 --> 00:58.230
so they may involve complex decision-making nodes

00:58.230 --> 01:01.170
where the AI may generate multiple outputs,

01:01.170 --> 01:05.220
which are often assessed and refined in an iterative cycle.

01:05.220 --> 01:08.190
Flow engineering is a structured process

01:08.190 --> 01:12.240
in AI development systems which guides the AI

01:12.240 --> 01:14.760
through a series of well-defined steps

01:14.760 --> 01:18.093
in order to improve the output quality of the AI system.

01:19.890 --> 01:23.310
Flow engineering aims to incorporate systematic planning

01:23.310 --> 01:24.750
and testing phase

01:24.750 --> 01:27.690
that mimic human development processes,

01:27.690 --> 01:30.570
and all of this to enhance reliability

01:30.570 --> 01:34.143
and functionality of AI-generated solutions.

01:37.140 --> 01:40.140
One of the issues with AutoGPT

01:40.140 --> 01:44.430
and other autonomous agents projects like BabyAGI,

01:44.430 --> 01:46.320
they are long-term planning.

01:46.320 --> 01:50.250
So they receive a goal, something to achieve,

01:50.250 --> 01:53.160
and then they start breaking it down to tasks,

01:53.160 --> 01:57.090
and then they start implementing and executing those tasks

01:57.090 --> 02:01.680
and derive subtasks of those tasks and so on and so on.

02:01.680 --> 02:05.010
And de facto, they aren't really working.

02:05.010 --> 02:08.550
So the point here is that we as developers

02:08.550 --> 02:11.550
want to give the instructions of what to do.

02:11.550 --> 02:14.610
We don't want the AI to start going and creating

02:14.610 --> 02:17.700
some imaginary attempts and start executing them.

02:17.700 --> 02:20.370
This is highly prone for problems

02:20.370 --> 02:23.880
and for the LLM to simply go out of hand.

02:23.880 --> 02:27.960
We as developers want to tell the LLM exactly what to do.

02:27.960 --> 02:30.360
We want to define the tasks and we want the LLM

02:30.360 --> 02:33.093
to stay within the context of those tasks.

02:34.020 --> 02:36.690
There are still decisions the LLM could make.

02:36.690 --> 02:39.240
For example, determining if the output

02:39.240 --> 02:40.920
is ready to be released

02:40.920 --> 02:43.020
and if it's a good enough solution

02:43.020 --> 02:45.570
or which step now to take.

02:45.570 --> 02:47.460
However, we, as developers,

02:47.460 --> 02:50.610
we define the scope and we do most of the planning

02:50.610 --> 02:51.443
for the LLM

02:51.443 --> 02:55.770
and the LLM can work within the flow that we have created.

02:55.770 --> 02:59.160
We give the LLM the blueprints to follow.

02:59.160 --> 03:01.890
And if we think about it as a state machine,

03:01.890 --> 03:04.260
we, as developers, we write the states.

03:04.260 --> 03:07.560
So we write what is the flow and what's need to be done,

03:07.560 --> 03:09.150
and what steps do we have.

03:09.150 --> 03:12.570
However, we can incorporate an LLM to decide

03:12.570 --> 03:15.540
which flow to take based on the input it gets.

03:15.540 --> 03:17.670
For example, whether to curate an answer

03:17.670 --> 03:20.160
or to simply release it to the user.

03:20.160 --> 03:21.420
And in the state machine

03:21.420 --> 03:23.400
is whether to go to step i,

03:23.400 --> 03:26.160
or maybe to i plus two, or whatever.

03:26.160 --> 03:28.740
So the state machine is an engineering decision,

03:28.740 --> 03:30.963
and no statistics is involved there.

03:33.240 --> 03:36.360
And LangGraph in the context of flow engineering

03:36.360 --> 03:38.790
is implementing this middle ground.

03:38.790 --> 03:41.910
It's the intermediate between fully autonomous agents

03:41.910 --> 03:44.460
that can decide what to do and how to do it

03:44.460 --> 03:47.790
and the LangChain chain, which is fully deterministic

03:47.790 --> 03:51.600
and there is no flexibility within this flow.

03:51.600 --> 03:53.400
So with flow engineering,

03:53.400 --> 03:57.390
we can achieve complex agentic solutions

03:57.390 --> 04:00.030
which will require us to build a state machine

04:00.030 --> 04:02.730
to define the steps of our flow.

04:02.730 --> 04:06.600
And we can use an LLM to either be a part of the step,

04:06.600 --> 04:10.650
for example, to make an LLM call to generate a tweet,

04:10.650 --> 04:13.110
and it can also be something

04:13.110 --> 04:15.570
that will tell us which steps to go to.

04:15.570 --> 04:19.530
So we leverage the LLM to do stuff within a step

04:19.530 --> 04:23.370
and we can leverage the LLM to decide which step to go.

04:23.370 --> 04:26.040
But the point here is that we, as developers,

04:26.040 --> 04:29.163
we define the flow and we have full control of it.

04:31.200 --> 04:34.320
And in LangGraph we can define graphs,

04:34.320 --> 04:36.540
and those are going to be nodes and edges,

04:36.540 --> 04:39.960
and we can have cycles in them, and we can build,

04:39.960 --> 04:41.280
and we'll do this in the course,

04:41.280 --> 04:43.500
very advanced logic

04:43.500 --> 04:47.580
that will give us a very complex AI system.

04:47.580 --> 04:50.490
And this is an example of a graph

04:50.490 --> 04:53.070
that is going to write a tweet,

04:53.070 --> 04:56.400
but it's going to also reflect and critique this tweet

04:56.400 --> 04:57.990
and do this in iterations

04:57.990 --> 05:00.663
until we get a very nice Twitter post.

05:03.060 --> 05:06.810
I believe that in the near future when we'll develop

05:06.810 --> 05:09.750
AI software and generative AI software,

05:09.750 --> 05:11.670
then the time we'll spend on the software

05:11.670 --> 05:13.470
will distribute the following.

05:13.470 --> 05:15.840
60% is going to go to flow engineering

05:15.840 --> 05:17.370
and into architecture,

05:17.370 --> 05:21.240
the state machine, the nodes of what steps can we make,

05:21.240 --> 05:23.760
maybe we can incorporate an LLM within them

05:23.760 --> 05:27.090
and maybe even the LLM can decide which step to do.

05:27.090 --> 05:29.940
However, 35% will go to fine-tuning,

05:29.940 --> 05:33.000
so to make the model very specific for the tasks

05:33.000 --> 05:34.080
that we need to achieve.

05:34.080 --> 05:36.663
And 5% will be dedicated to prompt engineering.

05:39.150 --> 05:39.983
Alrighty.

05:39.983 --> 05:43.380
So I know that this video was super abstract

05:43.380 --> 05:46.170
and you probably didn't understand everything.

05:46.170 --> 05:47.100
Don't worry.

05:47.100 --> 05:50.550
I know this is a new topic and it's kind of ambiguous.

05:50.550 --> 05:53.580
However, I promise you that by the end of this course,

05:53.580 --> 05:56.520
you'll know exactly what flow engineering is

05:56.520 --> 05:58.860
and you'll understand why it is so important

05:58.860 --> 06:01.260
when we build those advanced agents

06:01.260 --> 06:02.960
using flow engineering techniques.
