-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsc-openai-c2-L8-vid9_1.srt
More file actions
1479 lines (1165 loc) · 28.1 KB
/
sc-openai-c2-L8-vid9_1.srt
File metadata and controls
1479 lines (1165 loc) · 28.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1
00:00:04,533 --> 00:00:06,266
In the previous few videos,
2
00:00:06,266 --> 00:00:12,300
users shown how to build an application
using an hour from evaluating these inputs
3
00:00:12,600 --> 00:00:15,433
to processing the inputs to then doing
4
00:00:15,433 --> 00:00:18,566
final open checking
and before you show the outputs to a user.
5
00:00:19,200 --> 00:00:20,766
Obviously built such a system.
6
00:00:20,766 --> 00:00:22,500
How do you know how is working?
7
00:00:22,500 --> 00:00:26,200
And maybe even as you deploy it
and let users use it,
8
00:00:26,500 --> 00:00:30,633
how can you track how is doing
and finding these shortcomings
9
00:00:30,633 --> 00:00:34,233
and continue to improve the quality
of the answers in the system?
10
00:00:34,766 --> 00:00:37,600
In this video, I'd like to share with you
some best practices
11
00:00:37,600 --> 00:00:40,700
for evaluating the outputs of an Elm.
12
00:00:41,100 --> 00:00:42,133
And I want to show you
13
00:00:42,133 --> 00:00:45,800
specifically what it feels like
to build one of these systems.
14
00:00:46,200 --> 00:00:49,933
One key distinction between what
you hear me talk about in this video
15
00:00:50,100 --> 00:00:54,166
and what you may have seen in more
traditional machine learning supervised
16
00:00:54,166 --> 00:00:58,133
only applications is because you can build
such an application so quickly.
17
00:00:58,433 --> 00:01:03,200
The methods evaluating it,
it tends not to start off with a test set.
18
00:01:03,233 --> 00:01:08,166
Instead, you often end up gradually
building up a set of test examples.
19
00:01:08,700 --> 00:01:10,766
Let me show you what I mean by that.
20
00:01:10,766 --> 00:01:14,600
You may remember this diagram
from the second video about how problems
21
00:01:14,600 --> 00:01:18,566
development speeds up
the core parts of multiple development
22
00:01:18,566 --> 00:01:22,300
from maybe months
to just minutes or hours.
23
00:01:22,300 --> 00:01:24,366
Like most, a very small number of days
24
00:01:25,433 --> 00:01:27,933
in the
traditional supervised learning approach.
25
00:01:28,333 --> 00:01:32,133
If you needed to collect, say, 10,000
people examples anyway,
26
00:01:32,533 --> 00:01:38,033
then the incremental costs of collecting
another 1000 test examples isn't that bad.
27
00:01:38,066 --> 00:01:41,400
So in the traditional supervised
learning setting,
28
00:01:41,400 --> 00:01:44,600
it was not unusual to click
a training site, collect
29
00:01:44,600 --> 00:01:48,400
a development set or hold our
cross-validation set in a test set,
30
00:01:48,633 --> 00:01:51,900
and then tap those at hand
throughout this development process.
31
00:01:52,533 --> 00:01:55,800
But if you're able to specify
a prompt in just minutes
32
00:01:56,000 --> 00:02:00,133
and get something working in hours,
then it would seem like a huge pain
33
00:02:00,133 --> 00:02:05,100
if you had to pause for a long time
to collect a thousand test examples
34
00:02:05,100 --> 00:02:08,633
because you can now get this working
with zero training examples.
35
00:02:09,366 --> 00:02:12,600
So when building an application
using an element,
36
00:02:12,833 --> 00:02:14,766
this is what it often feels like.
37
00:02:14,766 --> 00:02:18,866
First you would tune the prompts on
just a small handful of examples.
38
00:02:18,866 --> 00:02:21,566
Maybe one, two, 3 to 5 examples
39
00:02:21,900 --> 00:02:24,100
and try to get a prompt
that works on them.
40
00:02:24,866 --> 00:02:28,433
And then as you have the system
undergo additional testing,
41
00:02:28,733 --> 00:02:32,400
you occasionally run into a few examples
that are tricky.
42
00:02:32,400 --> 00:02:34,966
The prompt doesn't work on them
or the outcome doesn't work on them.
43
00:02:35,433 --> 00:02:38,933
And in that case, you can take these
additional one or two or three
44
00:02:38,933 --> 00:02:42,700
or five examples
and add them to the set to your testing on
45
00:02:42,700 --> 00:02:45,733
to just add additional tricky examples
opportunistically.
46
00:02:46,600 --> 00:02:49,500
Eventually,
you have enough of these examples
47
00:02:49,500 --> 00:02:54,833
you've added to your slowly
growing development set that it becomes
48
00:02:54,833 --> 00:02:58,800
a bit inconvenient to manually run
every example through the prompt.
49
00:02:58,800 --> 00:03:02,033
Every time you change the problem
and then you start to develop metrics
50
00:03:02,266 --> 00:03:03,500
to measure performance
51
00:03:03,500 --> 00:03:06,533
on just a small set of examples
such as maybe average accuracy
52
00:03:07,700 --> 00:03:09,966
and one
53
00:03:09,966 --> 00:03:14,700
interesting aspect of this process
is if you decide at any moment in time
54
00:03:14,966 --> 00:03:16,800
your system is working well enough,
55
00:03:16,800 --> 00:03:19,833
you can stop right there
and not go on to the next bullet.
56
00:03:20,400 --> 00:03:25,300
And the fact that many deploy applications
that start at maybe the first or
57
00:03:25,300 --> 00:03:29,066
the second bullet and are running actually
and they're running just fine.
58
00:03:30,266 --> 00:03:33,600
Now, if your hand-built
59
00:03:34,300 --> 00:03:38,433
development set the evaluating
the model long isn't giving you sufficient
60
00:03:38,433 --> 00:03:42,066
confidence yet in the performance
of your system, then that's when you may
61
00:03:42,066 --> 00:03:47,133
go to the next step of of collecting
a randomly sample set of examples.
62
00:03:47,633 --> 00:03:50,400
To tune the model to and this would
63
00:03:50,766 --> 00:03:53,800
continue to be a development set
through a whole lot of cross-validation.
64
00:03:53,800 --> 00:03:55,966
So that could be quite
because to be quite common
65
00:03:55,966 --> 00:03:58,800
to continue to tune your prompt to this
66
00:03:59,733 --> 00:04:03,200
and only if you need even higher fidelity
67
00:04:03,200 --> 00:04:07,133
estimate of the performance of the system,
then might you collect and
68
00:04:07,300 --> 00:04:11,100
use the holdout test sets
that you don't even look at yourself
69
00:04:11,400 --> 00:04:12,800
when you're tuning the model.
70
00:04:14,300 --> 00:04:15,166
And so
71
00:04:15,166 --> 00:04:18,366
step four tends to be more important
if, say,
72
00:04:18,600 --> 00:04:22,800
your system is getting the right answer
91% of the time.
73
00:04:22,800 --> 00:04:26,300
He wants it to that to get it
to give the right answer.
74
00:04:26,333 --> 00:04:28,366
92 or 93% of the time.
75
00:04:28,700 --> 00:04:31,666
Then you do need
the largest end of examples to measure
76
00:04:31,866 --> 00:04:36,566
those differences
between 91 and 93% performance.
77
00:04:36,566 --> 00:04:39,900
And then only if you really need
an unbiased,
78
00:04:40,033 --> 00:04:42,600
fair estimate of
how was the system doing, then
79
00:04:43,133 --> 00:04:47,133
you need to go beyond the development
set to also collect a holdout test set.
80
00:04:47,400 --> 00:04:51,066
One important caveat
I've seen a lot of applications of large
81
00:04:51,066 --> 00:04:55,600
language models
where there isn't meaningful risk of harm
82
00:04:56,333 --> 00:04:58,466
if it gives not quite the right answer,
83
00:04:58,833 --> 00:05:01,600
but obviously for any high stakes
applications,
84
00:05:01,600 --> 00:05:05,733
if there's a risk of bias
or inappropriate outputs
85
00:05:06,000 --> 00:05:09,633
causing harm to someone,
then the responsibility
86
00:05:09,633 --> 00:05:13,366
to collect a test set to rigorously
evaluate the performance of the system
87
00:05:13,566 --> 00:05:16,300
to make sure it's doing the right thing
before you use it.
88
00:05:16,566 --> 00:05:18,833
That becomes much more important.
89
00:05:18,833 --> 00:05:23,333
But if, for example,
if you are using it to summarize articles
90
00:05:23,333 --> 00:05:27,566
just for yourself to read and no one else,
then maybe the risk of harm
91
00:05:27,566 --> 00:05:30,900
is more modest
and you can stop early in this process
92
00:05:30,900 --> 00:05:35,100
without going to the expense of bullets
four and five and collecting larger
93
00:05:35,300 --> 00:05:38,100
datasets
on which to evaluate your algorithm.
94
00:05:38,100 --> 00:05:40,166
So in this example,
95
00:05:41,100 --> 00:05:45,200
let me start with the usual
helper functions.
96
00:05:45,200 --> 00:05:45,600
First,
97
00:05:48,333 --> 00:05:49,166
use a utils
98
00:05:49,166 --> 00:05:52,333
function
to get a list of products and categories.
99
00:05:53,100 --> 00:05:56,633
So in the computers in that top category,
100
00:05:57,033 --> 00:06:00,833
there's a list of computers, laptops
and smartphones and CSC category.
101
00:06:01,300 --> 00:06:03,800
So this is smartphones and systems
and so on.
102
00:06:03,800 --> 00:06:07,500
For other categories.
103
00:06:11,833 --> 00:06:18,000
Now, let's say
104
00:06:18,100 --> 00:06:24,200
this hospital, the actress is given
a user input such as what TV can they buy?
105
00:06:24,200 --> 00:06:26,000
If I'm on the budget
106
00:06:26,100 --> 00:06:28,733
to retrieve the relevant
107
00:06:28,733 --> 00:06:34,433
categories in products so that we have
the right info to answer the user's query.
108
00:06:34,933 --> 00:06:37,100
So here's a prompt for you
to pause the video
109
00:06:37,100 --> 00:06:39,366
and read through this in detail
if you wish.
110
00:06:39,366 --> 00:06:41,866
But the prompt specifies
a set of instructions
111
00:06:42,300 --> 00:06:47,033
and actually gives the language model
one example of a good output.
112
00:06:47,166 --> 00:06:50,766
This is sometimes called a few short
lets actually one side prompting because
113
00:06:50,766 --> 00:06:53,266
we're actually using a user message
in the system.
114
00:06:53,266 --> 00:06:56,733
Message
to give it one example of good output.
115
00:06:56,733 --> 00:06:58,833
This one says
I want the most expensive computer.
116
00:06:59,133 --> 00:06:59,433
You know,
117
00:06:59,433 --> 00:07:03,600
let's just return all the computers
because we don't have pricing information.
118
00:07:03,600 --> 00:07:08,133
Now let's use this front on the hospital
message.
119
00:07:08,366 --> 00:07:12,933
Which TV can I buy if I'm on a budget?
120
00:07:15,233 --> 00:07:17,300
And so we're passing in
121
00:07:17,633 --> 00:07:22,300
to this both the prompt customer,
such as zero as was the Partizan category.
122
00:07:22,300 --> 00:07:26,100
This is a information that we retrieve
a top using the UTILS function.
123
00:07:26,633 --> 00:07:30,633
And here in this cell,
the relevant information to this query,
124
00:07:30,633 --> 00:07:34,066
which is under the category
televisions and home theater systems,
125
00:07:34,066 --> 00:07:36,866
this is on this of TVs and home
theater systems.
126
00:07:36,866 --> 00:07:39,900
That's relevant
to see how well the prompt is doing.
127
00:07:39,900 --> 00:07:43,333
You may be validated on a second prompt.
128
00:07:43,500 --> 00:07:45,800
Of course, that says I mean the challenge
if I'm a smart phone,
129
00:07:47,300 --> 00:07:49,300
it looks like us correctly retrieving
130
00:07:50,700 --> 00:07:52,466
this data.
131
00:07:52,466 --> 00:07:55,666
How do we smartphones, accessories
and this rather than products?
132
00:07:56,066 --> 00:08:00,500
And here's another one.
133
00:08:00,500 --> 00:08:02,766
So what computers do you have?
134
00:08:02,766 --> 00:08:05,533
And hopefully I retrieve
a list of the computers.
135
00:08:06,400 --> 00:08:08,633
So here I have three prompts
136
00:08:08,633 --> 00:08:12,833
and if you are developing this prompt
for the first time,
137
00:08:12,833 --> 00:08:18,033
it would be quite reasonable to to have
one or two or three examples like this.
138
00:08:18,366 --> 00:08:22,500
And to keep on tuning the prompt
until it gives appropriate outputs,
139
00:08:22,866 --> 00:08:26,266
until the prompt is retrieving
the relevant products and categories
140
00:08:26,666 --> 00:08:30,133
to the customer requests
for all of your prompts.
141
00:08:30,200 --> 00:08:34,600
All three of them in this example.
142
00:08:34,600 --> 00:08:38,400
And if the prompt had been missing
some products or something,
143
00:08:38,400 --> 00:08:40,500
then what we would do
is probably go back to edit
144
00:08:40,500 --> 00:08:42,300
the prompt a few times
until it gets it right.
145
00:08:42,300 --> 00:08:46,266
On all three of these prompts.
146
00:08:46,266 --> 00:08:49,200
After
you've gotten the system to this point,
147
00:08:49,900 --> 00:08:53,233
you might then start running the system
in testing,
148
00:08:53,233 --> 00:08:57,300
maybe send it to internal test users
or try using it yourself
149
00:08:57,633 --> 00:08:59,700
and just run it for a while
to see what happens.
150
00:09:00,500 --> 00:09:05,966
And sometimes you will run across a prompt
that it fails on.
151
00:09:05,966 --> 00:09:07,600
So here's an example of a prompt
152
00:09:07,600 --> 00:09:11,100
Tell people to slice pro phone and fill
this out camera Also what TVs you have.
153
00:09:11,966 --> 00:09:14,966
So when I run it on this prompt
it looks like is outputting
154
00:09:15,366 --> 00:09:19,066
the right data,
but it also outputs a bunch of text here.
155
00:09:19,100 --> 00:09:24,700
This extra chunk makes it harder
to parse this into a python.
156
00:09:24,700 --> 00:09:29,100
This dictionaries so we don't like that
is outputting this extra chunk.
157
00:09:29,866 --> 00:09:34,733
So when you run across one example
that the system fails on,
158
00:09:34,733 --> 00:09:38,933
then common practice is to just no doubt
that this is a somewhat tricky example.
159
00:09:39,133 --> 00:09:43,166
So let's add this to our set of examples
that we're going to test the system
160
00:09:43,166 --> 00:09:44,700
on systematically.
161
00:09:44,700 --> 00:09:48,800
And if you keep on running the system
for a while longer, maybe it works.
162
00:09:48,800 --> 00:09:49,666
On those examples.
163
00:09:49,666 --> 00:09:53,366
We tested the prompt to see examples of
maybe we'll work on many examples, but
164
00:09:54,166 --> 00:09:58,133
just by chance you might run across
another example where January's an error.
165
00:09:58,800 --> 00:10:03,900
So this custom message
four also causes the system to output
166
00:10:04,033 --> 00:10:06,900
a bunch of junk text
at the end that we don't
167
00:10:06,900 --> 00:10:10,400
want.
168
00:10:10,400 --> 00:10:12,200
Try to be helpful
to get all this extra text.
169
00:10:12,200 --> 00:10:14,266
We actually don't want this
as So at this point,
170
00:10:14,266 --> 00:10:17,866
you may have run this prompt
maybe on hundreds of examples.
171
00:10:17,866 --> 00:10:21,500
Maybe your test uses,
but you would just take the examples.
172
00:10:21,500 --> 00:10:24,766
The tricky ones is doing poorly on
and now have this
173
00:10:25,266 --> 00:10:28,733
set of five examples
in text from 0 to 4 have.
174
00:10:28,733 --> 00:10:32,533
This are the five examples that you use
to further fine tune the prompts.
175
00:10:34,133 --> 00:10:37,966
And in both of these examples
176
00:10:39,200 --> 00:10:43,633
I'll put a bunch of extra junk
text at the end that we don't want.
177
00:10:44,166 --> 00:10:46,466
And after a little bit of trial and error,
178
00:10:46,866 --> 00:10:49,966
you might decide to modify
the prompts as follows.
179
00:10:51,233 --> 00:10:52,466
So here's a new prompt.
180
00:10:52,466 --> 00:10:54,433
This is called from V two.
181
00:10:54,433 --> 00:10:57,533
But what we did here was
we added to the prompt.
182
00:10:57,600 --> 00:11:01,366
Did not output any additional
text is not in Jason format just emphasize
183
00:11:01,366 --> 00:11:07,133
piece of output this Jason stuff
and add in a second example using the user
184
00:11:07,133 --> 00:11:11,800
and assistant message for future property
where the user also cheapest computer
185
00:11:12,333 --> 00:11:16,666
and in both of the few shot examples,
we're demonstrating to the system
186
00:11:16,933 --> 00:11:20,766
a response
where it gives only Jason outputs.
187
00:11:20,900 --> 00:11:23,700
So here's the extra thing that we just
added to the problem to the output.
188
00:11:23,700 --> 00:11:27,133
Any additional text
is not in Jason formats and we use future
189
00:11:27,200 --> 00:11:30,966
use the one future system
one and Fichajes to future assistant to
190
00:11:31,300 --> 00:11:33,866
to give it two of these few shot
191
00:11:34,300 --> 00:11:38,533
prompts
suddenly shift into to find that prompt
192
00:11:38,966 --> 00:11:43,200
and you have to go back and manually rerun
this prompt on all five of the examples
193
00:11:43,200 --> 00:11:47,100
of user inputs, including this one
that previously had given a broken output.
194
00:11:47,400 --> 00:11:50,133
You find that it now
gives a correct output.
195
00:11:51,000 --> 00:11:53,833
And if you were to go back and rerun
this new problem,
196
00:11:53,866 --> 00:11:58,766
this is from version
V two on that customer message example
197
00:11:59,100 --> 00:12:03,433
that results in the broken output
with extra junk after the JSON output,
198
00:12:03,933 --> 00:12:07,966
then this will generate a better output
199
00:12:08,633 --> 00:12:12,166
and I'm not going to do it here,
but I encourage you to pause the video
200
00:12:12,166 --> 00:12:16,000
and rerun it yourself on Custom Message
four as well on this prompt V
201
00:12:16,000 --> 00:12:20,966
to see if it also generates
the correct output and hopefully it will.
202
00:12:20,966 --> 00:12:24,333
I think it should.
203
00:12:24,333 --> 00:12:28,600
And of course when you modify
the prompts, it's also useful to do
204
00:12:29,433 --> 00:12:32,133
a bit of regression
testing to make sure that
205
00:12:32,866 --> 00:12:36,300
when fixing the incorrect outputs
on prompts three and four,
206
00:12:36,566 --> 00:12:40,000
it doesn't break
the outputs on from zero either.
207
00:12:41,266 --> 00:12:43,500
Now you can kind of tell that
208
00:12:43,500 --> 00:12:47,366
if I had to copy paste
five prompts customer such as zero
209
00:12:47,533 --> 00:12:50,866
one, two, three and four into my
for the notebook and run them
210
00:12:50,866 --> 00:12:52,166
and then manually look at them
211
00:12:52,166 --> 00:12:55,133
to see if the output in the right
categories and products.