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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
1
00:00:00,399 --> 00:00:04,120
so this time I'm going to be talking

2
00:00:02,080 --> 00:00:05,799
about language modeling uh obviously

3
00:00:04,120 --> 00:00:07,240
language modeling is a big topic and I'm

4
00:00:05,799 --> 00:00:09,880
not going to be able to cover it all in

5
00:00:07,240 --> 00:00:11,320
one class but this is kind of the basics

6
00:00:09,880 --> 00:00:13,080
of uh what does it mean to build a

7
00:00:11,320 --> 00:00:15,320
language model what is a language model

8
00:00:13,080 --> 00:00:18,439
how do we evaluate language models and

9
00:00:15,320 --> 00:00:19,920
other stuff like that and around the end

10
00:00:18,439 --> 00:00:21,320
I'm going to talk a little bit about

11
00:00:19,920 --> 00:00:23,039
efficiently implementing things in

12
00:00:21,320 --> 00:00:25,080
neural networks it's not directly

13
00:00:23,039 --> 00:00:27,760
related to language models but it's very

14
00:00:25,080 --> 00:00:31,200
important to know how to do uh to solve

15
00:00:27,760 --> 00:00:34,200
your assignments so I'll cover both

16
00:00:31,200 --> 00:00:34,200
is

17
00:00:34,239 --> 00:00:38,480
cool okay so the first thing I'd like to

18
00:00:36,760 --> 00:00:41,239
talk about is generative versus

19
00:00:38,480 --> 00:00:43,000
discriminative models and the reason why

20
00:00:41,239 --> 00:00:45,280
is up until now we've been talking about

21
00:00:43,000 --> 00:00:47,559
discriminative models and these are

22
00:00:45,280 --> 00:00:49,640
models uh that are mainly designed to

23
00:00:47,559 --> 00:00:53,800
calculate the probability of a latent

24
00:00:49,640 --> 00:00:56,039
trait uh given the data and so this is

25
00:00:53,800 --> 00:00:58,800
uh P of Y given X where Y is the lat and

26
00:00:56,039 --> 00:01:00,800
trait we want to calculate and X is uh

27
00:00:58,800 --> 00:01:04,760
the input data that we're calculating it

28
00:01:00,800 --> 00:01:07,799
over so just review from last class what

29
00:01:04,760 --> 00:01:10,240
was X from last class from the example

30
00:01:07,799 --> 00:01:10,240
in L

31
00:01:11,360 --> 00:01:15,880
class

32
00:01:13,040 --> 00:01:18,280
anybody yeah some text yeah and then

33
00:01:15,880 --> 00:01:18,280
what was

34
00:01:20,400 --> 00:01:26,119
why it shouldn't be too

35
00:01:23,799 --> 00:01:27,920
hard yeah it was a category or a

36
00:01:26,119 --> 00:01:31,680
sentiment label precisely in the

37
00:01:27,920 --> 00:01:33,399
sentiment analysis tasks so so um a

38
00:01:31,680 --> 00:01:35,560
generative model on the other hand is a

39
00:01:33,399 --> 00:01:38,840
model that calculates the probability of

40
00:01:35,560 --> 00:01:40,880
data itself and is not specifically

41
00:01:38,840 --> 00:01:43,439
conditional and there's a couple of

42
00:01:40,880 --> 00:01:45,439
varieties um this isn't like super

43
00:01:43,439 --> 00:01:48,280
standard terminology I just uh wrote it

44
00:01:45,439 --> 00:01:51,520
myself but here we have a standalone

45
00:01:48,280 --> 00:01:54,360
probability of P of X and we can also

46
00:01:51,520 --> 00:01:58,000
calculate the joint probability P of X

47
00:01:54,360 --> 00:01:58,000
and Y

48
00:01:58,159 --> 00:02:02,880
so probabilistic language models

49
00:02:01,079 --> 00:02:06,640
basically what they do is they calculate

50
00:02:02,880 --> 00:02:08,560
this uh probability usually uh we think

51
00:02:06,640 --> 00:02:10,360
of it as a standalone probability of P

52
00:02:08,560 --> 00:02:11,800
of X where X is something like a

53
00:02:10,360 --> 00:02:15,160
sentence or a

54
00:02:11,800 --> 00:02:16,920
document and it's a generative model

55
00:02:15,160 --> 00:02:19,640
that calculates the probability of

56
00:02:16,920 --> 00:02:22,360
language recently the definition of

57
00:02:19,640 --> 00:02:23,959
language model has expanded a little bit

58
00:02:22,360 --> 00:02:26,160
so now

59
00:02:23,959 --> 00:02:28,640
um people also call things that

60
00:02:26,160 --> 00:02:31,080
calculate the probability of text and

61
00:02:28,640 --> 00:02:35,200
images as like multimodal language

62
00:02:31,080 --> 00:02:38,160
models or uh what are some of the other

63
00:02:35,200 --> 00:02:40,480
ones yeah I think that's the main the

64
00:02:38,160 --> 00:02:42,840
main exception to this rule usually

65
00:02:40,480 --> 00:02:45,080
usually it's calculating either of text

66
00:02:42,840 --> 00:02:47,680
or over text in some multimodal data but

67
00:02:45,080 --> 00:02:47,680
for now we're going to

68
00:02:48,800 --> 00:02:54,200
consider

69
00:02:50,319 --> 00:02:56,440
um then there's kind of two fundamental

70
00:02:54,200 --> 00:02:58,159
operations that we perform with LMS

71
00:02:56,440 --> 00:03:00,519
almost everything else we do with LMS

72
00:02:58,159 --> 00:03:03,640
can be considered like one of these two

73
00:03:00,519 --> 00:03:05,319
types of things the first thing is calc

74
00:03:03,640 --> 00:03:06,440
scoring sentences or calculating the

75
00:03:05,319 --> 00:03:09,599
probability of

76
00:03:06,440 --> 00:03:12,280
sentences and this

77
00:03:09,599 --> 00:03:14,720
is uh for example if we calculate the

78
00:03:12,280 --> 00:03:16,400
probability of Jane went to the store uh

79
00:03:14,720 --> 00:03:19,000
this would have a high probability

80
00:03:16,400 --> 00:03:20,879
ideally um and if we have this kind of

81
00:03:19,000 --> 00:03:23,400
word salid like this this would be given

82
00:03:20,879 --> 00:03:26,080
a low probability uh according to a

83
00:03:23,400 --> 00:03:28,000
English language model if we had a

84
00:03:26,080 --> 00:03:30,000
Chinese language model ideally it would

85
00:03:28,000 --> 00:03:31,319
also probably give low probability first

86
00:03:30,000 --> 00:03:32,879
sentence too because it's a language

87
00:03:31,319 --> 00:03:35,000
model of natural Chinese and not of

88
00:03:32,879 --> 00:03:36,200
natural English so there's also

89
00:03:35,000 --> 00:03:37,360
different types of language models

90
00:03:36,200 --> 00:03:38,400
depending on the type of data you play

91
00:03:37,360 --> 00:03:41,360
in

92
00:03:38,400 --> 00:03:43,599
the another thing I can do is generate

93
00:03:41,360 --> 00:03:45,239
sentences and we'll talk more about the

94
00:03:43,599 --> 00:03:48,280
different methods for generating

95
00:03:45,239 --> 00:03:50,319
sentences but typically they fall into

96
00:03:48,280 --> 00:03:51,799
one of two categories one is sampling

97
00:03:50,319 --> 00:03:53,200
like this where you try to sample a

98
00:03:51,799 --> 00:03:55,480
sentence from the probability

99
00:03:53,200 --> 00:03:57,280
distribution of the language model

100
00:03:55,480 --> 00:03:58,360
possibly with some modifications to the

101
00:03:57,280 --> 00:04:00,760
probability

102
00:03:58,360 --> 00:04:03,079
distribution um the other thing which I

103
00:04:00,760 --> 00:04:04,760
didn't write on the slide is uh finding

104
00:04:03,079 --> 00:04:07,439
the highest scoring sentence according

105
00:04:04,760 --> 00:04:09,760
to the language model um and we do both

106
00:04:07,439 --> 00:04:09,760
of those

107
00:04:10,560 --> 00:04:17,600
S so more concretely how can we apply

108
00:04:15,199 --> 00:04:21,199
these these can be applied to answer

109
00:04:17,600 --> 00:04:23,840
questions so for example um if we have a

110
00:04:21,199 --> 00:04:27,240
multiple choice question we can score

111
00:04:23,840 --> 00:04:30,639
possible multiple choice answers and uh

112
00:04:27,240 --> 00:04:32,880
the way we do this is we calculate

113
00:04:30,639 --> 00:04:35,440
we first

114
00:04:32,880 --> 00:04:38,440
take uh like we have

115
00:04:35,440 --> 00:04:38,440
like

116
00:04:38,560 --> 00:04:43,919
um

117
00:04:40,960 --> 00:04:46,919
where is

118
00:04:43,919 --> 00:04:46,919
CMU

119
00:04:47,560 --> 00:04:51,600
located um

120
00:04:51,960 --> 00:04:59,560
that's and actually maybe promete this

121
00:04:54,560 --> 00:05:01,360
all again to an a here and then we say X

122
00:04:59,560 --> 00:05:05,800
X1 is equal to

123
00:05:01,360 --> 00:05:07,520
this and then we have X2 which is

124
00:05:05,800 --> 00:05:09,720
Q

125
00:05:07,520 --> 00:05:12,479
where is

126
00:05:09,720 --> 00:05:14,120
CMU

127
00:05:12,479 --> 00:05:18,080
located

128
00:05:14,120 --> 00:05:19,720
a um what's something

129
00:05:18,080 --> 00:05:21,960
plausible

130
00:05:19,720 --> 00:05:24,560
uh what was

131
00:05:21,960 --> 00:05:26,319
it okay now now you're going to make it

132
00:05:24,560 --> 00:05:27,960
tricky and make me talk about when we

133
00:05:26,319 --> 00:05:29,960
have multiple right answers and how we

134
00:05:27,960 --> 00:05:31,759
evaluate and stuff let let's ignore that

135
00:05:29,960 --> 00:05:35,080
for now it's say New

136
00:05:31,759 --> 00:05:37,199
York it's not located in New York is

137
00:05:35,080 --> 00:05:40,560
it

138
00:05:37,199 --> 00:05:40,560
okay let's say

139
00:05:40,960 --> 00:05:45,199
Birmingham hopefully there's no CMU

140
00:05:43,199 --> 00:05:47,120
affiliate in Birmingham I think we're

141
00:05:45,199 --> 00:05:49,000
we're pretty so um and then you would

142
00:05:47,120 --> 00:05:53,880
just calculate the probability of X1 and

143
00:05:49,000 --> 00:05:56,440
the probability of X2 X3 X4 Etc and um

144
00:05:53,880 --> 00:06:01,479
then pick the highest saring one and

145
00:05:56,440 --> 00:06:01,479
actually um there's a famous

146
00:06:03,199 --> 00:06:07,440
there's a famous uh leaderboard for

147
00:06:05,840 --> 00:06:08,759
language models that probably a lot of

148
00:06:07,440 --> 00:06:09,759
people know about it's called the open

149
00:06:08,759 --> 00:06:13,120
llm

150
00:06:09,759 --> 00:06:15,639
leaderboard and a lot of these tasks

151
00:06:13,120 --> 00:06:17,319
here basically correspond to doing

152
00:06:15,639 --> 00:06:21,000
something like that like hel swag is

153
00:06:17,319 --> 00:06:22,599
kind of a multiple choice uh is a

154
00:06:21,000 --> 00:06:24,160
multiple choice question answering thing

155
00:06:22,599 --> 00:06:27,880
about common sense where they calculate

156
00:06:24,160 --> 00:06:30,280
it by scoring uh scoring the

157
00:06:27,880 --> 00:06:31,880
outputs so that's a very common way to

158
00:06:30,280 --> 00:06:35,000
use language

159
00:06:31,880 --> 00:06:36,960
models um another thing is generating a

160
00:06:35,000 --> 00:06:40,080
continuation of a question prompt so

161
00:06:36,960 --> 00:06:42,639
basically this is when you uh

162
00:06:40,080 --> 00:06:44,759
sample and so what you would do is you

163
00:06:42,639 --> 00:06:48,440
would prompt the

164
00:06:44,759 --> 00:06:50,560
model with this uh X here and then you

165
00:06:48,440 --> 00:06:53,800
would ask it to generate either the most

166
00:06:50,560 --> 00:06:56,400
likely uh completion or generate um

167
00:06:53,800 --> 00:06:58,960
sample multiple completions to get the

168
00:06:56,400 --> 00:07:00,720
answer so this is very common uh people

169
00:06:58,960 --> 00:07:03,759
are very familiar with this there's lots

170
00:07:00,720 --> 00:07:07,160
of other uh things you can do though so

171
00:07:03,759 --> 00:07:09,400
um you can classify text and there's a

172
00:07:07,160 --> 00:07:12,720
couple ways you can do this uh one way

173
00:07:09,400 --> 00:07:15,960
you can do this is um like let's say we

174
00:07:12,720 --> 00:07:15,960
have a sentiment sentence

175
00:07:16,160 --> 00:07:21,520
here

176
00:07:17,759 --> 00:07:25,440
um you can say uh

177
00:07:21,520 --> 00:07:30,919
this is

178
00:07:25,440 --> 00:07:33,919
gr and then you can say um

179
00:07:30,919 --> 00:07:37,680
star

180
00:07:33,919 --> 00:07:38,879
rating five or something like that and

181
00:07:37,680 --> 00:07:41,400
then you could also have star rating

182
00:07:38,879 --> 00:07:43,680
four star rating three star rating two

183
00:07:41,400 --> 00:07:45,080
star rating one and calculate the

184
00:07:43,680 --> 00:07:46,639
probability of all of these and find

185
00:07:45,080 --> 00:07:50,360
which one has the highest probability so

186
00:07:46,639 --> 00:07:51,800
this is a a common way you can do things

187
00:07:50,360 --> 00:07:54,319
another thing you can do which is kind

188
00:07:51,800 --> 00:07:55,240
of interesting and um there are papers

189
00:07:54,319 --> 00:07:58,319
on this but they're kind of

190
00:07:55,240 --> 00:08:00,800
underexplored is you can do like star

191
00:07:58,319 --> 00:08:04,800
rating

192
00:08:00,800 --> 00:08:04,800
five and then

193
00:08:04,879 --> 00:08:13,280
generate generate the output um and so

194
00:08:10,319 --> 00:08:15,039
that basically says Okay I I want a

195
00:08:13,280 --> 00:08:16,680
positive sentence now I'm going to score

196
00:08:15,039 --> 00:08:19,120
the actual review and see whether that

197
00:08:16,680 --> 00:08:22,319
matches my like conception of a positive

198
00:08:19,120 --> 00:08:24,080
sentence and there's a few uh papers

199
00:08:22,319 --> 00:08:25,680
that do

200
00:08:24,080 --> 00:08:28,240
this

201
00:08:25,680 --> 00:08:31,240
um let

202
00:08:28,240 --> 00:08:31,240
me

203
00:08:34,640 --> 00:08:38,760
this is a kind of older one and then

204
00:08:36,240 --> 00:08:42,080
there's another more recent one by Sean

205
00:08:38,760 --> 00:08:43,839
Min I believe um uh but they demonstrate

206
00:08:42,080 --> 00:08:45,480
how you can do both generative and

207
00:08:43,839 --> 00:08:47,600
discriminative classification in this

208
00:08:45,480 --> 00:08:51,760
way so that's another thing that you can

209
00:08:47,600 --> 00:08:51,760
do uh with language

210
00:08:53,279 --> 00:08:56,839
models and then the other thing you can

211
00:08:55,200 --> 00:08:59,000
do is you can generate the label given a

212
00:08:56,839 --> 00:09:00,680
classification proc so you you say this

213
00:08:59,000 --> 00:09:03,079
is is great star rating and then

214
00:09:00,680 --> 00:09:05,720
generate five

215
00:09:03,079 --> 00:09:09,320
whatever finally um you can do things

216
00:09:05,720 --> 00:09:10,920
like correct a grammar so uh for example

217
00:09:09,320 --> 00:09:12,560
if you score the probability of each

218
00:09:10,920 --> 00:09:14,839
word and you find words that are really

219
00:09:12,560 --> 00:09:17,760
low probability then you can uh replace

220
00:09:14,839 --> 00:09:20,160
them with higher probability words um or

221
00:09:17,760 --> 00:09:21,720
you could ask a model please paraphrase

222
00:09:20,160 --> 00:09:24,000
this output and it will paraphrase it

223
00:09:21,720 --> 00:09:27,640
into something that gives you uh you

224
00:09:24,000 --> 00:09:30,720
know that has better gra so basically

225
00:09:27,640 --> 00:09:33,079
like as I said language models are very

226
00:09:30,720 --> 00:09:34,600
diverse um and they can do a ton of

227
00:09:33,079 --> 00:09:35,680
different things but most of them boil

228
00:09:34,600 --> 00:09:38,440
down to doing one of these two

229
00:09:35,680 --> 00:09:42,079
operations scoring or

230
00:09:38,440 --> 00:09:42,079
generating any questions

231
00:09:42,480 --> 00:09:47,600
s

232
00:09:44,640 --> 00:09:50,000
okay so next I I want to talk about a

233
00:09:47,600 --> 00:09:52,279
specific type of language models uh Auto

234
00:09:50,000 --> 00:09:54,240
regressive language models and auto

235
00:09:52,279 --> 00:09:56,720
regressive language models are language

236
00:09:54,240 --> 00:10:00,240
models that specifically calculate this

237
00:09:56,720 --> 00:10:02,320
probability um in a fashion where you

238
00:10:00,240 --> 00:10:03,680
calculate the probability of one token

239
00:10:02,320 --> 00:10:05,519
and then you calculate the probability

240
00:10:03,680 --> 00:10:07,680
of the next token given the previous

241
00:10:05,519 --> 00:10:10,519
token the probability of the third token

242
00:10:07,680 --> 00:10:13,760
G given the previous two tokens almost

243
00:10:10,519 --> 00:10:18,600
always this happens left to right um or

244
00:10:13,760 --> 00:10:20,519
start to finish um and so this is the

245
00:10:18,600 --> 00:10:25,000
next token here this is a context where

246
00:10:20,519 --> 00:10:28,440
usually um the context is the previous

247
00:10:25,000 --> 00:10:29,640
tokens Can anyone think of a time when

248
00:10:28,440 --> 00:10:32,440
you might want to do

249
00:10:29,640 --> 00:10:37,839
right to left instead of left to

250
00:10:32,440 --> 00:10:40,399
right yeah language that's from right to

251
00:10:37,839 --> 00:10:41,680
yeah that's actually exactly what I what

252
00:10:40,399 --> 00:10:43,079
I was looking for so if you have a

253
00:10:41,680 --> 00:10:46,839
language that's written from right to

254
00:10:43,079 --> 00:10:49,320
left actually uh things like uh Arabic

255
00:10:46,839 --> 00:10:51,360
and Hebrew are written right to left so

256
00:10:49,320 --> 00:10:53,720
um both of those are

257
00:10:51,360 --> 00:10:56,360
chronologically like earlier to later

258
00:10:53,720 --> 00:10:59,399
because you know if if you're thinking

259
00:10:56,360 --> 00:11:01,079
about how people speak um the the first

260
00:10:59,399 --> 00:11:02,440
word that an English speaker speaks is

261
00:11:01,079 --> 00:11:04,000
on the left just because that's the way

262
00:11:02,440 --> 00:11:06,079
you write it but the first word that an

263
00:11:04,000 --> 00:11:09,639
Arabic speaker speaks is on the the

264
00:11:06,079 --> 00:11:12,360
right because chronologically that's uh

265
00:11:09,639 --> 00:11:13,519
that's how it works um there's other

266
00:11:12,360 --> 00:11:16,320
reasons why you might want to do right

267
00:11:13,519 --> 00:11:17,839
to left but uh it's not really that left

268
00:11:16,320 --> 00:11:21,720
to right is important it's that like

269
00:11:17,839 --> 00:11:24,440
start to finish is important in spoken

270
00:11:21,720 --> 00:11:27,880
language so um one thing I should

271
00:11:24,440 --> 00:11:30,240
mention here is that this is just a rule

272
00:11:27,880 --> 00:11:31,560
of probability that if you have multiple

273
00:11:30,240 --> 00:11:33,720
variables and you're calculating the

274
00:11:31,560 --> 00:11:35,760
joint probability of variables the

275
00:11:33,720 --> 00:11:38,000
probability of all of the variables

276
00:11:35,760 --> 00:11:40,240
together is equal to this probability

277
00:11:38,000 --> 00:11:41,920
here so we're not making any

278
00:11:40,240 --> 00:11:44,399
approximations we're not making any

279
00:11:41,920 --> 00:11:46,959
compromises in order to do this but it

280
00:11:44,399 --> 00:11:51,639
all hinges on whether we can predict

281
00:11:46,959 --> 00:11:53,440
this probability um accurately uh

282
00:11:51,639 --> 00:11:56,160
actually another question does anybody

283
00:11:53,440 --> 00:11:57,800
know why we do this decomposition why

284
00:11:56,160 --> 00:12:00,959
don't we just try to predict the

285
00:11:57,800 --> 00:12:00,959
probability of x

286
00:12:02,120 --> 00:12:05,399
directly any

287
00:12:07,680 --> 00:12:12,760
ideas uh of big X sorry uh why don't we

288
00:12:11,079 --> 00:12:17,560
try to calculate the probability of this

289
00:12:12,760 --> 00:12:21,360
is great directly without deated the

290
00:12:17,560 --> 00:12:21,360
IND that

291
00:12:25,519 --> 00:12:31,560
possibility it could be word salid if

292
00:12:27,760 --> 00:12:35,279
you did it in a in a particular way yes

293
00:12:31,560 --> 00:12:35,279
um so that that's a good point

294
00:12:39,519 --> 00:12:47,000
yeah yeah so for example we talked about

295
00:12:43,760 --> 00:12:50,120
um uh we'll talk about

296
00:12:47,000 --> 00:12:51,920
models um or I I mentioned this briefly

297
00:12:50,120 --> 00:12:54,000
last time you can mention it in more

298
00:12:51,920 --> 00:12:55,639
detail this time but this is great we

299
00:12:54,000 --> 00:12:59,880
probably have never seen this before

300
00:12:55,639 --> 00:13:01,399
right so if we predict only things that

301
00:12:59,880 --> 00:13:03,199
we've seen before if we only assign a

302
00:13:01,399 --> 00:13:04,600
non-zero probability to the things we've

303
00:13:03,199 --> 00:13:06,000
seen before there's going to be lots of

304
00:13:04,600 --> 00:13:07,079
sentences that we've never seen before

305
00:13:06,000 --> 00:13:10,000
it makes it

306
00:13:07,079 --> 00:13:13,760
supercars um that that's basically close

307
00:13:10,000 --> 00:13:16,399
to what I wanted to say so um the reason

308
00:13:13,760 --> 00:13:18,040
why we don't typically do it with um

309
00:13:16,399 --> 00:13:21,240
predicting the whole sentence directly

310
00:13:18,040 --> 00:13:22,800
is because if we think about the size of

311
00:13:21,240 --> 00:13:24,959
the classification problem we need to

312
00:13:22,800 --> 00:13:27,880
solve in order to predict the next word

313
00:13:24,959 --> 00:13:30,320
it's a v uh where V is the size of the

314
00:13:27,880 --> 00:13:33,120
vocabulary but the size of the

315
00:13:30,320 --> 00:13:35,399
classification problem that we need to

316
00:13:33,120 --> 00:13:38,040
um we need to solve if we predict

317
00:13:35,399 --> 00:13:40,079
everything directly is V to the N where

318
00:13:38,040 --> 00:13:42,240
n is the length of the sequence and

319
00:13:40,079 --> 00:13:45,240
that's just huge the vocabulary is so

320
00:13:42,240 --> 00:13:48,440
big that it's hard to kind of uh know

321
00:13:45,240 --> 00:13:51,000
how we handle that so basically by doing

322
00:13:48,440 --> 00:13:53,160
this sort of decomposition we decompose

323
00:13:51,000 --> 00:13:56,440
this into uh

324
00:13:53,160 --> 00:13:58,120
n um prediction problems of size V and

325
00:13:56,440 --> 00:13:59,519
that's kind of just a lot more

326
00:13:58,120 --> 00:14:03,079
manageable for from the point of view of

327
00:13:59,519 --> 00:14:06,000
how we train uh know how we train

328
00:14:03,079 --> 00:14:09,399
models um that being said there are

329
00:14:06,000 --> 00:14:11,360
other Alternatives um something very

330
00:14:09,399 --> 00:14:13,920
widely known uh very widely used is

331
00:14:11,360 --> 00:14:16,440
called a MK language model um a mast

332
00:14:13,920 --> 00:14:19,480
language model is something like Bert or

333
00:14:16,440 --> 00:14:21,680
debera or Roberta or all of these models

334
00:14:19,480 --> 00:14:25,000
that you might have heard if you've been

335
00:14:21,680 --> 00:14:28,279
in MLP for more than two years I guess

336
00:14:25,000 --> 00:14:30,680
um and basically what they do is they

337
00:14:28,279 --> 00:14:30,680
predict

338
00:14:32,199 --> 00:14:37,480
uh they like mask out this word and they

339
00:14:34,839 --> 00:14:39,480
predict the middle word so they mask out

340
00:14:37,480 --> 00:14:41,440
is and then try to predict that given

341
00:14:39,480 --> 00:14:45,320
all the other words the problem with

342
00:14:41,440 --> 00:14:48,959
these models is uh twofold number one

343
00:14:45,320 --> 00:14:51,880
they don't actually give you a uh good

344
00:14:48,959 --> 00:14:55,399
probability here uh like a a properly

345
00:14:51,880 --> 00:14:57,800
formed probability here

346
00:14:55,399 --> 00:14:59,160
because this is true only as long as

347
00:14:57,800 --> 00:15:01,920
you're only conditioning on things that

348
00:14:59,160 --> 00:15:03,480
you've previously generated so that

349
00:15:01,920 --> 00:15:04,839
they're not actually true language

350
00:15:03,480 --> 00:15:06,920
models from the point of view of being

351
00:15:04,839 --> 00:15:10,040
able to easily predict the probability

352
00:15:06,920 --> 00:15:11,399
of a sequence um and also it's hard to

353
00:15:10,040 --> 00:15:13,399
generate from them because you need to

354
00:15:11,399 --> 00:15:15,440
generate in some order and mass language

355
00:15:13,399 --> 00:15:17,600
models don't specify economical orders

356
00:15:15,440 --> 00:15:19,120
so they're good for some things like

357
00:15:17,600 --> 00:15:21,720
calculating representations of the

358
00:15:19,120 --> 00:15:22,920
output but they're not useful uh they're

359
00:15:21,720 --> 00:15:25,240
not as useful for

360
00:15:22,920 --> 00:15:26,880
Generation Um there's also energy based

361
00:15:25,240 --> 00:15:28,759
language models which basically create a

362
00:15:26,880 --> 00:15:30,000
scoring function that's not necessarily

363
00:15:28,759 --> 00:15:31,279
left to right or right to left or

364
00:15:30,000 --> 00:15:33,120
anything like that but that's very

365
00:15:31,279 --> 00:15:34,639
Advanced um if you're interested in them

366
00:15:33,120 --> 00:15:36,319
I can talk more about them that we'll

367
00:15:34,639 --> 00:15:38,920
skip

368
00:15:36,319 --> 00:15:41,600
them and um also all of the language

369
00:15:38,920 --> 00:15:45,639
models that you hear about nowadays GPT

370
00:15:41,600 --> 00:15:48,800
uh llama whatever else are all other

371
00:15:45,639 --> 00:15:52,880
models cool so I'm going to go into the

372
00:15:48,800 --> 00:15:52,880
very um any questions about that

373
00:15:57,600 --> 00:16:00,600
yeah

374
00:16:00,680 --> 00:16:04,160
yeah so in Mass language models the

375
00:16:02,680 --> 00:16:06,000
question was in Mass language models

376
00:16:04,160 --> 00:16:08,360
couldn't you just mask out the last

377
00:16:06,000 --> 00:16:10,759
token and predict that sure you could do

378
00:16:08,360 --> 00:16:13,079
that but there it's just not trained

379
00:16:10,759 --> 00:16:14,720
that way so it won't do a very good job

380
00:16:13,079 --> 00:16:16,880
if you always trained it that way it's

381
00:16:14,720 --> 00:16:18,160
an autor regressive language model so

382
00:16:16,880 --> 00:16:22,240
you're you're back to where you were in

383
00:16:18,160 --> 00:16:24,800
the first place um cool so now we I'll

384
00:16:22,240 --> 00:16:26,399
talk about unigram language models and

385
00:16:24,800 --> 00:16:29,319
so the simplest language models are

386
00:16:26,399 --> 00:16:33,560
count-based unigram language models and

387
00:16:29,319 --> 00:16:35,319
the way they work is um basically we

388
00:16:33,560 --> 00:16:38,519
want to calculate this probability

389
00:16:35,319 --> 00:16:41,240
conditioned on all the previous ones and

390
00:16:38,519 --> 00:16:42,360
the way we do this is we just say

391
00:16:41,240 --> 00:16:45,680
actually we're not going to worry about

392
00:16:42,360 --> 00:16:48,759
the order at all and we're just going to

393
00:16:45,680 --> 00:16:52,240
uh predict the probability of the next

394
00:16:48,759 --> 00:16:55,279
word uh independently of all the other

395
00:16:52,240 --> 00:16:57,519
words so if you have something like this

396
00:16:55,279 --> 00:16:59,720
it's actually extremely easy to predict

397
00:16:57,519 --> 00:17:02,480
the probability of this word and the way

398
00:16:59,720 --> 00:17:04,280
you do this is you just count up the

399
00:17:02,480 --> 00:17:08,360
number of times this word appeared in

400
00:17:04,280 --> 00:17:10,480
the training data set and divide by the

401
00:17:08,360 --> 00:17:12,559
uh divide by the total number of words

402
00:17:10,480 --> 00:17:14,240
in the pring data set and now you have a

403
00:17:12,559 --> 00:17:15,959
language model this is like language

404
00:17:14,240 --> 00:17:17,760
model 101 it's the easiest possible

405
00:17:15,959 --> 00:17:19,520
language model you can write in you know

406
00:17:17,760 --> 00:17:21,120
three lines of python

407
00:17:19,520 --> 00:17:25,039
basically

408
00:17:21,120 --> 00:17:28,480
um so it has a few problems uh the first

409
00:17:25,039 --> 00:17:31,120
problem with this language model is um

410
00:17:28,480 --> 00:17:32,960
handling unknown words so what happens

411
00:17:31,120 --> 00:17:38,679
if you have a word that you've never

412
00:17:32,960 --> 00:17:41,000
seen before um in this language model

413
00:17:38,679 --> 00:17:42,240
here what is the probability of any

414
00:17:41,000 --> 00:17:44,720
sequence that has a word that you've

415
00:17:42,240 --> 00:17:47,440
never seen before yeah the probability

416
00:17:44,720 --> 00:17:49,240
of the sequence gets zero so there might

417
00:17:47,440 --> 00:17:51,120
not be such a big problem for generating

418
00:17:49,240 --> 00:17:52,480
things from the language model because

419
00:17:51,120 --> 00:17:54,520
you know maybe it's fine if you only

420
00:17:52,480 --> 00:17:55,960
generate words that you've seen before

421
00:17:54,520 --> 00:17:57,679
uh but it is definitely a problem of

422
00:17:55,960 --> 00:17:59,720
scoring things with the language model

423
00:17:57,679 --> 00:18:02,039
and it's also a problem of uh for

424
00:17:59,720 --> 00:18:04,440
something like translation if you get an

425
00:18:02,039 --> 00:18:05,840
unknown word uh when you're translating

426
00:18:04,440 --> 00:18:07,799
something then you would like to be able

427
00:18:05,840 --> 00:18:11,320
to translate it reasonably but you can't

428
00:18:07,799 --> 00:18:13,799
do that so um that's an issue so how do

429
00:18:11,320 --> 00:18:15,840
we how do we fix this um there's a

430
00:18:13,799 --> 00:18:17,640
couple options the first option is to

431
00:18:15,840 --> 00:18:19,440
segment to characters and subwords and

432
00:18:17,640 --> 00:18:21,720
this is now the preferred option that

433
00:18:19,440 --> 00:18:24,360
most people use nowadays uh just run

434
00:18:21,720 --> 00:18:26,840
sentence piece segment your vocabulary

435
00:18:24,360 --> 00:18:28,400
and you're all set you're you'll now no

436
00:18:26,840 --> 00:18:29,679
longer have any unknown words because

437
00:18:28,400 --> 00:18:30,840
all the unknown words get split into

438
00:18:29,679 --> 00:18:33,559
shorter

439
00:18:30,840 --> 00:18:36,240
units there's also other options that

440
00:18:33,559 --> 00:18:37,919
you can use if you're uh very interested

441
00:18:36,240 --> 00:18:41,280
in or serious about this and want to

442
00:18:37,919 --> 00:18:43,720
handle this like uh as part of a

443
00:18:41,280 --> 00:18:45,960
research project or something like this

444
00:18:43,720 --> 00:18:48,520
and uh the way you can do this is you

445
00:18:45,960 --> 00:18:50,120
can build an unknown word model and an

446
00:18:48,520 --> 00:18:52,200
unknown word model basically what it

447
00:18:50,120 --> 00:18:54,520
does is it uh predicts the probability

448
00:18:52,200 --> 00:18:56,200
of unknown words using characters and

449
00:18:54,520 --> 00:18:59,559
then it models the probability of words

450
00:18:56,200 --> 00:19:01,159
using words and so now you can you have

451
00:18:59,559 --> 00:19:02,559
kind of like a hierarchical model where

452
00:19:01,159 --> 00:19:03,919
you first try to predict words and then

453
00:19:02,559 --> 00:19:06,720
if you can't predict words you predict

454
00:19:03,919 --> 00:19:08,960
unknown words so this isn't us as widely

455
00:19:06,720 --> 00:19:11,520
anymore but it's worth thinking about uh

456
00:19:08,960 --> 00:19:11,520
or knowing

457
00:19:11,840 --> 00:19:20,880
about okay uh so a second detail um a

458
00:19:17,200 --> 00:19:22,799
parameter uh so parameterizing in log

459
00:19:20,880 --> 00:19:25,880
space

460
00:19:22,799 --> 00:19:28,400
so the um multiplication of

461
00:19:25,880 --> 00:19:29,840
probabilities can be reexpressed is the

462
00:19:28,400 --> 00:19:31,840
addition of log

463
00:19:29,840 --> 00:19:34,159
probabilities uh so this is really

464
00:19:31,840 --> 00:19:35,720
important and this is widely used in all

465
00:19:34,159 --> 00:19:37,520
language models whether they're unigram

466
00:19:35,720 --> 00:19:39,640
language models or or neural language

467
00:19:37,520 --> 00:19:41,799
models there's actually a very simple

468
00:19:39,640 --> 00:19:45,440
reason why we why we do it this way does

469
00:19:41,799 --> 00:19:45,440
anybody uh know the

470
00:19:46,440 --> 00:19:52,679
answer what would happen if we

471
00:19:48,280 --> 00:19:56,720
multiplied uh let's say uh 30 30 tokens

472
00:19:52,679 --> 00:20:00,360
worth of probabilities together um

473
00:19:56,720 --> 00:20:02,120
yeah uh yeah too too small um so

474
00:20:00,360 --> 00:20:06,120
basically the problem is numerical

475
00:20:02,120 --> 00:20:07,520
underflow um so modern computers if if

476
00:20:06,120 --> 00:20:08,840
we weren't doing this on a computer and

477
00:20:07,520 --> 00:20:11,240
we were just doing math it wouldn't

478
00:20:08,840 --> 00:20:14,280
matter at all um but because we're doing

479
00:20:11,240 --> 00:20:17,280
it on a computer uh we

480
00:20:14,280 --> 00:20:17,280
have

481
00:20:20,880 --> 00:20:26,000
ours we have our

482
00:20:23,000 --> 00:20:26,000
32bit

483
00:20:27,159 --> 00:20:30,159
float

484
00:20:32,320 --> 00:20:37,720
where we have uh the exponent in the the

485
00:20:35,799 --> 00:20:40,159
fraction over here so the largest the

486
00:20:37,720 --> 00:20:41,960
exponent can get is limited by the

487
00:20:40,159 --> 00:20:45,880
number of exponent bits that we have in

488
00:20:41,960 --> 00:20:48,039
a 32-bit float and um if that's the case

489
00:20:45,880 --> 00:20:52,480
I forget exactly how large it is it's

490
00:20:48,039 --> 00:20:53,440
like yeah something like 30 minus 38 is

491
00:20:52,480 --> 00:20:56,640
that

492
00:20:53,440 --> 00:20:58,520
right yeah but anyway like if the number

493
00:20:56,640 --> 00:21:00,640
gets too small you'll underflow it goes

494
00:20:58,520 --> 00:21:02,400
to zero and you'll get a zero

495
00:21:00,640 --> 00:21:05,720
probability despite the fact that it's

496
00:21:02,400 --> 00:21:07,640
not actually zero so um that's usually

497
00:21:05,720 --> 00:21:09,440
why we do this it's also a little bit

498
00:21:07,640 --> 00:21:12,960
easier for people just to look at like

499
00:21:09,440 --> 00:21:15,200
minus 30 instead of looking to something

500
00:21:12,960 --> 00:21:19,960
something time 10 to the minus 30 or

501
00:21:15,200 --> 00:21:24,520
something so uh that is why we normally

502
00:21:19,960 --> 00:21:27,159
go um another thing that you can note is

503
00:21:24,520 --> 00:21:28,760
uh you can treat each of these in a

504
00:21:27,159 --> 00:21:31,360
unigram model you can treat each of

505
00:21:28,760 --> 00:21:37,039
these as parameters so we talked about

506
00:21:31,360 --> 00:21:39,640
parameters of a model uh like a um like

507
00:21:37,039 --> 00:21:41,120
a bag of words model and we can

508
00:21:39,640 --> 00:21:44,080
similarly treat these unigram

509
00:21:41,120 --> 00:21:47,760
probabilities as parameters so um how

510
00:21:44,080 --> 00:21:47,760
many parameters does a unigram model

511
00:21:48,080 --> 00:21:51,320
have any

512
00:21:57,039 --> 00:22:02,400
ideas

513
00:21:59,600 --> 00:22:04,440
yeah yeah exactly parameters equal to

514
00:22:02,400 --> 00:22:08,120
the size of the vocabulary so this one's

515
00:22:04,440 --> 00:22:10,880
easy and then we can go um we can go to

516
00:22:08,120 --> 00:22:13,880
the slightly less easy ones

517
00:22:10,880 --> 00:22:16,039
there so anyway this is a unigram model

518
00:22:13,880 --> 00:22:17,960
uh it's it's not too hard um you

519
00:22:16,039 --> 00:22:20,480
basically count up and divide and then

520
00:22:17,960 --> 00:22:22,720
you add the the probabilities here you

521
00:22:20,480 --> 00:22:25,440
could easily do it in a short Python

522
00:22:22,720 --> 00:22:28,400
program higher order engram models so

523
00:22:25,440 --> 00:22:31,600
higher order engram models um what these

524
00:22:28,400 --> 00:22:35,520
do is they essentially limit the context

525
00:22:31,600 --> 00:22:40,240
length to a length of N and then they

526
00:22:35,520 --> 00:22:42,600
count and divide so the way it works

527
00:22:40,240 --> 00:22:45,559
here maybe this is a little bit uh

528
00:22:42,600 --> 00:22:47,320
tricky but I can show an example so what

529
00:22:45,559 --> 00:22:49,840
we do is we count up the number of times

530
00:22:47,320 --> 00:22:51,320
we've seen this is an example and then

531
00:22:49,840 --> 00:22:53,480
we divide by the number of times we've

532
00:22:51,320 --> 00:22:55,960
seen this is n and that's the

533
00:22:53,480 --> 00:22:56,960
probability of example given the the

534
00:22:55,960 --> 00:22:58,720
previous

535
00:22:56,960 --> 00:23:00,559
coms

536
00:22:58,720 --> 00:23:02,039
so the problem with this is anytime we

537
00:23:00,559 --> 00:23:03,400
get a sequence that we've never seen

538
00:23:02,039 --> 00:23:04,960
before like we would like to model

539
00:23:03,400 --> 00:23:07,200
longer sequences to make this more

540
00:23:04,960 --> 00:23:08,600
accurate but anytime we've get a uh we

541
00:23:07,200 --> 00:23:10,720
get a sequence that we've never seen

542
00:23:08,600 --> 00:23:12,919
before um it will get a probability of

543
00:23:10,720 --> 00:23:15,919
zero similarly because this count on top

544
00:23:12,919 --> 00:23:19,919
of here will be zero so the way that uh

545
00:23:15,919 --> 00:23:22,640
engram language models work with this uh

546
00:23:19,919 --> 00:23:27,320
handle this is they have fall back to

547
00:23:22,640 --> 00:23:31,840
Shorter uh engram models so um this

548
00:23:27,320 --> 00:23:33,480
model sorry when I say NR uh n is the

549
00:23:31,840 --> 00:23:35,520
length of the context so this is a four

550
00:23:33,480 --> 00:23:37,679
gr model here because the top context is

551
00:23:35,520 --> 00:23:40,520
four so the photogram model would

552
00:23:37,679 --> 00:23:46,640
calculate this and then interpolate it

553
00:23:40,520 --> 00:23:48,640
like this with a um with a trigram model

554
00:23:46,640 --> 00:23:50,400
uh and then the trigram model itself

555
00:23:48,640 --> 00:23:51,720
would interpolate with the Byram model

556
00:23:50,400 --> 00:23:53,440
the Byram model would interpolate with

557
00:23:51,720 --> 00:23:56,880
the unram

558
00:23:53,440 --> 00:23:59,880
model oh this one oh

559
00:23:56,880 --> 00:23:59,880
okay

560
00:24:02,159 --> 00:24:05,440
um one

561
00:24:07,039 --> 00:24:12,320
second could you uh help get it from the

562
00:24:10,000 --> 00:24:12,320
lock

563
00:24:26,799 --> 00:24:29,799
box

564
00:24:43,640 --> 00:24:50,200
um okay sorry

565
00:24:46,880 --> 00:24:53,640
so getting bad

566
00:24:50,200 --> 00:24:56,640
here just

567
00:24:53,640 --> 00:24:56,640
actually

568
00:24:56,760 --> 00:25:02,559
okay uh oh wow that's a lot

569
00:25:02,960 --> 00:25:12,080
better cool okay so

570
00:25:08,279 --> 00:25:14,159
um so this is uh how we deal with the

571
00:25:12,080 --> 00:25:18,799
fact that models can

572
00:25:14,159 --> 00:25:23,919
be um models can be more precise but

573
00:25:18,799 --> 00:25:26,679
more sparse and less precise but less

574
00:25:23,919 --> 00:25:28,720
sparse this is also another concept that

575
00:25:26,679 --> 00:25:31,039
we're going to talk about more later uh

576
00:25:28,720 --> 00:25:33,240
in another class but this is a variety

577
00:25:31,039 --> 00:25:33,240
of

578
00:25:33,679 --> 00:25:38,440
ensembling where we have different

579
00:25:35,960 --> 00:25:40,360
models that are good at different things

580
00:25:38,440 --> 00:25:42,279
and we combine them together so this is

581
00:25:40,360 --> 00:25:44,760
the first instance that you would see of

582
00:25:42,279 --> 00:25:46,159
this there are other instances of this

583
00:25:44,760 --> 00:25:50,320
but the reason why I mentioned that this

584
00:25:46,159 --> 00:25:51,840
is a a variety of ensembling is actually

585
00:25:50,320 --> 00:25:55,520
you're probably not going to be using

586
00:25:51,840 --> 00:25:57,840
engram models super widely unless you

587
00:25:55,520 --> 00:26:00,520
really want to process huge data sets

588
00:25:57,840 --> 00:26:02,399
because that is one advantage of them

589
00:26:00,520 --> 00:26:03,960
but some of these smoothing methods

590
00:26:02,399 --> 00:26:05,720
actually might be interesting even if

591
00:26:03,960 --> 00:26:10,520
you're using other models and ensembling

592
00:26:05,720 --> 00:26:10,520
them together so

593
00:26:10,600 --> 00:26:15,679
the in order to decide this

594
00:26:13,679 --> 00:26:19,559
interpolation coefficient one way we can

595
00:26:15,679 --> 00:26:23,440
do it is just set a fixed um set a fixed

596
00:26:19,559 --> 00:26:26,039
amount of probability that we use for

597
00:26:23,440 --> 00:26:29,000
every um every time so we could say that

598
00:26:26,039 --> 00:26:32,000
we always set this Lambda to 0.8 and

599
00:26:29,000 --> 00:26:34,320
some always set this Lambda 1us Lambda

600
00:26:32,000 --> 00:26:36,559
to 0.2 and interpolate those two

601
00:26:34,320 --> 00:26:39,120
together but actually there's more

602
00:26:36,559 --> 00:26:42,240
sophisticated methods of doing this and

603
00:26:39,120 --> 00:26:44,080
so one way of doing this is uh called

604
00:26:42,240 --> 00:26:47,240
additive

605
00:26:44,080 --> 00:26:50,600
smoothing excuse me and the the way that

606
00:26:47,240 --> 00:26:54,039
additive smoothing works is um basically

607
00:26:50,600 --> 00:26:54,919
we add Alpha to the uh to the top and

608
00:26:54,039 --> 00:26:58,000
the

609
00:26:54,919 --> 00:27:02,159
bottom and the reason why this is slight

610
00:26:58,000 --> 00:27:06,279
different as is as our accounts get

611
00:27:02,159 --> 00:27:10,799
larger we start to approach the true

612
00:27:06,279 --> 00:27:10,799
distribution so just to give an

613
00:27:12,080 --> 00:27:19,480
example let's say we have uh the

614
00:27:17,640 --> 00:27:21,640
box

615
00:27:19,480 --> 00:27:26,279
is

616
00:27:21,640 --> 00:27:26,279
um let's say initially we

617
00:27:26,520 --> 00:27:29,520
have

618
00:27:31,159 --> 00:27:37,600
uh let let's say our Alpha is

619
00:27:33,840 --> 00:27:43,559
one so initially if we have

620
00:27:37,600 --> 00:27:47,320
nothing um if we have no no evidence for

621
00:27:43,559 --> 00:27:47,320
our sorry I I

622
00:27:49,720 --> 00:27:54,960
realize let's say this is

623
00:27:52,640 --> 00:27:56,840
our fallback

624
00:27:54,960 --> 00:27:59,240
distribution um where this is a

625
00:27:56,840 --> 00:28:01,880
probability of Z 0.5 this is a

626
00:27:59,240 --> 00:28:03,360
probability of 0.3 and this is a

627
00:28:01,880 --> 00:28:06,559
probability of

628
00:28:03,360 --> 00:28:09,919
0.2 so now let's talk about our byr

629
00:28:06,559 --> 00:28:13,399
model um and our byr

630
00:28:09,919 --> 00:28:18,000
model has counts which is the

631
00:28:13,399 --> 00:28:18,000
the the box and the

632
00:28:19,039 --> 00:28:24,480
is so if we do something like this then

633
00:28:22,720 --> 00:28:26,720
um initially we have no counts like

634
00:28:24,480 --> 00:28:28,159
let's say we we have no data uh about

635
00:28:26,720 --> 00:28:30,760
this distribution

636
00:28:28,159 --> 00:28:33,200
um our counts would be zero and our

637
00:28:30,760 --> 00:28:35,919
Alpha would be

638
00:28:33,200 --> 00:28:37,840
one and so we would just fall back to

639
00:28:35,919 --> 00:28:40,960
this distribution we just have like one

640
00:28:37,840 --> 00:28:43,320
times uh one times this distribution

641
00:28:40,960 --> 00:28:45,679
let's say we then we have one piece of

642
00:28:43,320 --> 00:28:48,640
evidence and once we have one piece of

643
00:28:45,679 --> 00:28:52,279
evidence now this would be

644
00:28:48,640 --> 00:28:53,960
0.33 um and this would uh be Alpha equal

645
00:28:52,279 --> 00:28:56,399
to 1 so we'd have

646
00:28:53,960 --> 00:28:58,679
0.5 *

647
00:28:56,399 --> 00:29:00,399
0.33

648
00:28:58,679 --> 00:29:04,039
uh and

649
00:29:00,399 --> 00:29:07,720
0.5 time

650
00:29:04,039 --> 00:29:10,840
0.3 uh is the probability of the Box

651
00:29:07,720 --> 00:29:12,840
because um basically we we have one

652
00:29:10,840 --> 00:29:14,720
piece of evidence and we are adding a

653
00:29:12,840 --> 00:29:17,080
count of one to the lower order

654
00:29:14,720 --> 00:29:18,320
distribution then if we increase our

655
00:29:17,080 --> 00:29:24,159
count

656
00:29:18,320 --> 00:29:24,159
here um now we rely more

657
00:29:24,880 --> 00:29:30,960
strongly sorry that that would be wrong

658
00:29:27,720 --> 00:29:32,399
so so now we rely more strongly on the

659
00:29:30,960 --> 00:29:33,880
higher order distribution because we

660
00:29:32,399 --> 00:29:37,039
have more evidence for the higher order

661
00:29:33,880 --> 00:29:39,610
distribution so basically in this case

662
00:29:37,039 --> 00:29:41,240
um the probability

663
00:29:39,610 --> 00:29:44,559
[Music]

664
00:29:41,240 --> 00:29:48,200
of Lambda which I showed

665
00:29:44,559 --> 00:29:52,000
before is equal to the the sum of the

666
00:29:48,200 --> 00:29:54,200
counts plus um the sum of the counts

667
00:29:52,000 --> 00:29:56,480
over the sum of the counts plus

668
00:29:54,200 --> 00:29:58,159
Ali so as the sum of the counts gets

669
00:29:56,480 --> 00:30:00,240
larger you rely on the higher order

670
00:29:58,159 --> 00:30:01,640
distribution is the sum of the counts is

671
00:30:00,240 --> 00:30:02,760
if the sum of the counts is smaller you

672
00:30:01,640 --> 00:30:04,320
rely more on the lower order

673
00:30:02,760 --> 00:30:06,720
distribution so the more evidence you

674
00:30:04,320 --> 00:30:11,640
have the more you rely on so that's the

675
00:30:06,720 --> 00:30:11,640
basic idea behind these smoothing things

676
00:30:11,679 --> 00:30:16,679
um there's also a number of other

677
00:30:14,519 --> 00:30:18,760
varieties called uh

678
00:30:16,679 --> 00:30:20,799
discounting so uh the discount

679
00:30:18,760 --> 00:30:23,679
hyperparameter basically you subtract

680
00:30:20,799 --> 00:30:26,080
this off um uh you subtract this from

681
00:30:23,679 --> 00:30:27,840
the count so you would subtract like 0.5

682
00:30:26,080 --> 00:30:32,679
from each of the counts that you it's

683
00:30:27,840 --> 00:30:36,279
just empirically this is a better match

684
00:30:32,679 --> 00:30:38,600
for the fact that um natural language

685
00:30:36,279 --> 00:30:40,039
has a very longtailed distribution um

686
00:30:38,600 --> 00:30:41,600
you can kind of do the math and show

687
00:30:40,039 --> 00:30:43,720
that that works and that's actually in

688
00:30:41,600 --> 00:30:46,080
this um in this paper if you're

689
00:30:43,720 --> 00:30:49,880
interested in looking at more details of

690
00:30:46,080 --> 00:30:51,519
that um and then kind of the

691
00:30:49,880 --> 00:30:53,440
stateoftheart in language modeling

692
00:30:51,519 --> 00:30:56,600
before neural language models came out

693
00:30:53,440 --> 00:30:59,919
was this kesser smoothing and what it

694
00:30:56,600 --> 00:31:02,440
does is it discounts but it also

695
00:30:59,919 --> 00:31:04,480
modifies the lower order distribution so

696
00:31:02,440 --> 00:31:07,200
in the lower order distribution you

697
00:31:04,480 --> 00:31:09,039
basically um modify the counts with

698
00:31:07,200 --> 00:31:11,919
respect to how many times that word has

699
00:31:09,039 --> 00:31:13,519
appeared in new contexts with the IDE

700
00:31:11,919 --> 00:31:16,360
idea being that you only use the lower

701
00:31:13,519 --> 00:31:18,880
order distribution when you have uh new

702
00:31:16,360 --> 00:31:21,200
contexts um and so you can kind of Be

703
00:31:18,880 --> 00:31:23,600
Clever

704
00:31:21,200 --> 00:31:25,399
About You Can Be Clever about how you

705
00:31:23,600 --> 00:31:27,639
build this distribution based on the

706
00:31:25,399 --> 00:31:29,360
fact that you're only using it in the

707
00:31:27,639 --> 00:31:31,320
case when this distribution is not very

708
00:31:29,360 --> 00:31:33,960
Rel

709
00:31:31,320 --> 00:31:36,080
so I I would spend a lot more time

710
00:31:33,960 --> 00:31:37,960
teaching this when uh engram models were

711
00:31:36,080 --> 00:31:39,840
kind of the thing uh that people were

712
00:31:37,960 --> 00:31:41,960
using but now I'm going to go over them

713
00:31:39,840 --> 00:31:43,600
very quickly so you know don't worry if

714
00:31:41,960 --> 00:31:46,559
you weren't able to follow all the

715
00:31:43,600 --> 00:31:47,960
details but the basic um the basic thing

716
00:31:46,559 --> 00:31:49,279
take away from this is number one these

717
00:31:47,960 --> 00:31:51,639
are the methods that people use for

718
00:31:49,279 --> 00:31:53,440
engram language models number two if

719
00:31:51,639 --> 00:31:55,720
you're thinking about combining language

720
00:31:53,440 --> 00:31:57,519
models together in some way through you

721
00:31:55,720 --> 00:31:59,279
know ensembling their probability or

722
00:31:57,519 --> 00:32:00,480
something like this this is something

723
00:31:59,279 --> 00:32:02,279
that you should think about a little bit

724
00:32:00,480 --> 00:32:03,679
more carefully because like some

725
00:32:02,279 --> 00:32:05,240
language models might be good in some

726
00:32:03,679 --> 00:32:07,440
context other language models might be

727
00:32:05,240 --> 00:32:09,440
good in other contexts so you would need

728
00:32:07,440 --> 00:32:11,799
to think about that when you're doing um

729
00:32:09,440 --> 00:32:18,200
when you're combining the model

730
00:32:11,799 --> 00:32:18,200
that cool um any any questions about

731
00:32:19,080 --> 00:32:24,840
this Okay

732
00:32:21,159 --> 00:32:27,840
cool so there's a lot of problems that

733
00:32:24,840 --> 00:32:30,760
we have to deal with um when were

734
00:32:27,840 --> 00:32:32,600
creating engram models and that actually

735
00:32:30,760 --> 00:32:35,279
kind of motivated the reason why we

736
00:32:32,600 --> 00:32:36,639
moved to neural language models the

737
00:32:35,279 --> 00:32:38,720
first one is similar to what I talked

738
00:32:36,639 --> 00:32:40,519
about last time with text classification

739
00:32:38,720 --> 00:32:42,600
um that they can't share strength among

740
00:32:40,519 --> 00:32:45,159
similar words like bought and

741
00:32:42,600 --> 00:32:46,919
purchase um another thing is that they

742
00:32:45,159 --> 00:32:49,440
can't easily condition on context with

743
00:32:46,919 --> 00:32:51,240
intervening words so engram models if

744
00:32:49,440 --> 00:32:52,799
you have a rare word in your context

745
00:32:51,240 --> 00:32:54,320
immediately start falling back to the

746
00:32:52,799 --> 00:32:56,799
unigram distribution and they end up

747
00:32:54,320 --> 00:32:58,720
being very bad so uh that was another

748
00:32:56,799 --> 00:33:01,000
issue

749
00:32:58,720 --> 00:33:04,760
and they couldn't handle long distance

750
00:33:01,000 --> 00:33:09,080
um dependencies so if this was beyond

751
00:33:04,760 --> 00:33:10,559
the engram context that they would uh be

752
00:33:09,080 --> 00:33:14,320
handling then you wouldn't be able to

753
00:33:10,559 --> 00:33:15,840
manage this so actually before neural

754
00:33:14,320 --> 00:33:18,000
language models became a really big

755
00:33:15,840 --> 00:33:19,960
thing uh people came up with a bunch of

756
00:33:18,000 --> 00:33:22,760
individual solutions for this in order

757
00:33:19,960 --> 00:33:24,440
to solve the problems but actually it

758
00:33:22,760 --> 00:33:26,679
wasn't that these Solutions didn't work

759
00:33:24,440 --> 00:33:29,159
at all it was just that engineering all

760
00:33:26,679 --> 00:33:30,519
of them together was so hard that nobody

761
00:33:29,159 --> 00:33:32,120
actually ever did that and so they

762
00:33:30,519 --> 00:33:35,120
relied on just engram models out of the

763
00:33:32,120 --> 00:33:37,600
box and that wasn't scalable so it's

764
00:33:35,120 --> 00:33:39,279
kind of a funny example of how like

765
00:33:37,600 --> 00:33:42,000
actually neural networks despite all the

766
00:33:39,279 --> 00:33:43,559
pain that they cause in some areas are a

767
00:33:42,000 --> 00:33:47,120
much better engineering solution to

768
00:33:43,559 --> 00:33:51,279
solve all the issues that previous

769
00:33:47,120 --> 00:33:53,159
method cool um so when they use uh Eng

770
00:33:51,279 --> 00:33:54,799
grab models neural language models

771
00:33:53,159 --> 00:33:56,559
achieve better performance but Eng grab

772
00:33:54,799 --> 00:33:58,440
models are very very fast to estimate

773
00:33:56,559 --> 00:33:59,880
and apply you can even estimate them

774
00:33:58,440 --> 00:34:04,399
completely in

775
00:33:59,880 --> 00:34:07,720
parallel um engram models also I I don't

776
00:34:04,399 --> 00:34:10,399
know if this is necessarily

777
00:34:07,720 --> 00:34:13,200
A a thing that

778
00:34:10,399 --> 00:34:15,079
you a reason to use engram language

779
00:34:13,200 --> 00:34:17,720
models but it is a reason to think a

780
00:34:15,079 --> 00:34:20,320
little bit critically about uh neural

781
00:34:17,720 --> 00:34:22,720
language models which is neural language

782
00:34:20,320 --> 00:34:24,320
models actually can be worse than engram

783
00:34:22,720 --> 00:34:26,679
language models at modeling very low

784
00:34:24,320 --> 00:34:28,480
frequency phenomenas so engram language

785
00:34:26,679 --> 00:34:29,960
model can learn from a single example

786
00:34:28,480 --> 00:34:32,119
they only need a single example of

787
00:34:29,960 --> 00:34:36,879
anything before the probability of that

788
00:34:32,119 --> 00:34:38,639
continuation goes up very high um and uh

789
00:34:36,879 --> 00:34:41,359
but neural language models actually can

790
00:34:38,639 --> 00:34:43,599
forget or not memorize uh appropriately

791
00:34:41,359 --> 00:34:46,280
from single examples so they can be

792
00:34:43,599 --> 00:34:48,040
better at that um there's a toolkit the

793
00:34:46,280 --> 00:34:49,919
standard toolkit for estimating engram

794
00:34:48,040 --> 00:34:54,359
language models is called KLM it's kind

795
00:34:49,919 --> 00:34:57,599
of frighteningly fast um and so people

796
00:34:54,359 --> 00:35:00,400
have been uh saying like I've seen some

797
00:34:57,599 --> 00:35:01,599
jokes which are like job postings that

798
00:35:00,400 --> 00:35:04,040
say people who have been working on

799
00:35:01,599 --> 00:35:05,880
large language models uh for we want

800
00:35:04,040 --> 00:35:07,359
people who have been 10 years of

801
00:35:05,880 --> 00:35:09,240
experience working on large language

802
00:35:07,359 --> 00:35:11,960
models or something like that and a lot

803
00:35:09,240 --> 00:35:13,440
of people are saying wait nobody has 10

804
00:35:11,960 --> 00:35:16,400
years of experience working on large

805
00:35:13,440 --> 00:35:18,160
language models well Kenneth hfield who

806
00:35:16,400 --> 00:35:19,440
created KLM does have 10 years of

807
00:35:18,160 --> 00:35:22,800
experience working on large language

808
00:35:19,440 --> 00:35:24,599
models because he was estimating uh

809
00:35:22,800 --> 00:35:27,720
seven gr

810
00:35:24,599 --> 00:35:30,320
bottles um seven models with a

811
00:35:27,720 --> 00:35:35,040
vocabulary of let's say

812
00:35:30,320 --> 00:35:37,720
100,000 on um you know web text so how

813
00:35:35,040 --> 00:35:41,119
many parameters is at that's more than

814
00:35:37,720 --> 00:35:44,320
any you know large neural language model

815
00:35:41,119 --> 00:35:45,640
that we have nowadays so um they they

816
00:35:44,320 --> 00:35:47,520
have a lot of these parameters are

817
00:35:45,640 --> 00:35:49,400
sparse they're zero counts so obviously

818
00:35:47,520 --> 00:35:52,160
you don't uh you don't memorize all of

819
00:35:49,400 --> 00:35:55,040
them but uh

820
00:35:52,160 --> 00:35:57,800
yeah cool um another thing that maybe I

821
00:35:55,040 --> 00:35:59,359
should mention like so this doesn't

822
00:35:57,800 --> 00:36:01,960
sound completely outdated there was a

823
00:35:59,359 --> 00:36:05,400
really good paper

824
00:36:01,960 --> 00:36:08,400
recently that used the fact that engrams

825
00:36:05,400 --> 00:36:08,400
are

826
00:36:11,079 --> 00:36:17,319
so uses effect that engram models are so

827
00:36:14,280 --> 00:36:18,960
scalable it's this paper um it's called

828
00:36:17,319 --> 00:36:21,079
Data selection for language models via

829
00:36:18,960 --> 00:36:22,359
importance rese sampling and one

830
00:36:21,079 --> 00:36:24,359
interesting thing that they do in this

831
00:36:22,359 --> 00:36:28,920
paper is that they don't

832
00:36:24,359 --> 00:36:31,560
actually um they don't

833
00:36:28,920 --> 00:36:32,800
actually use neural models in any way

834
00:36:31,560 --> 00:36:34,920
despite the fact that they use the

835
00:36:32,800 --> 00:36:36,880
downstream data that they sample in

836
00:36:34,920 --> 00:36:41,319
order to calculate neural models but

837
00:36:36,880 --> 00:36:42,880
they run engram models over um over lots

838
00:36:41,319 --> 00:36:47,359
and lots of data and then they fit a

839
00:36:42,880 --> 00:36:50,000
gaussian distribution to the enr model

840
00:36:47,359 --> 00:36:51,520
counts basically uh in order to select

841
00:36:50,000 --> 00:36:53,040
the data in the reason why they do this

842
00:36:51,520 --> 00:36:55,280
is they want to do this over the entire

843
00:36:53,040 --> 00:36:56,760
web and running a neural model over the

844
00:36:55,280 --> 00:36:58,920
entire web would be too expensive so

845
00:36:56,760 --> 00:37:00,319
they use angr models instead so that's

846
00:36:58,920 --> 00:37:02,359
just an example of something in the

847
00:37:00,319 --> 00:37:04,920
modern context where keeping this in

848
00:37:02,359 --> 00:37:04,920
mind is a good

849
00:37:08,200 --> 00:37:14,000
idea okay I'd like to move to the next

850
00:37:10,960 --> 00:37:15,319
part so a language model evaluation uh

851
00:37:14,000 --> 00:37:17,200
this is important to know I'm not going

852
00:37:15,319 --> 00:37:19,079
to talk about language model evaluation

853
00:37:17,200 --> 00:37:20,599
on other tasks I'm only going to talk

854
00:37:19,079 --> 00:37:23,800
right now about language model

855
00:37:20,599 --> 00:37:26,280
evaluation on the task of language

856
00:37:23,800 --> 00:37:29,079
modeling and there's a number of metrics

857
00:37:26,280 --> 00:37:30,680
that we use for the task of language

858
00:37:29,079 --> 00:37:32,720
modeling evaluating language models on

859
00:37:30,680 --> 00:37:35,560
the task of language modeling the first

860
00:37:32,720 --> 00:37:38,480
one is log likelihood and basically uh

861
00:37:35,560 --> 00:37:40,160
the way we calculate log likelihood is

862
00:37:38,480 --> 00:37:41,640
uh sorry there's an extra parenthesis

863
00:37:40,160 --> 00:37:45,480
here but the way we calculate log

864
00:37:41,640 --> 00:37:47,160
likelihood is we get a test set that

865
00:37:45,480 --> 00:37:50,400
ideally has not been included in our

866
00:37:47,160 --> 00:37:52,520
training data and we take all of the

867
00:37:50,400 --> 00:37:54,200
documents or sentences in the test set

868
00:37:52,520 --> 00:37:57,040
we calculate the log probability of all

869
00:37:54,200 --> 00:37:59,520
of them uh we don't actually use this

870
00:37:57,040 --> 00:38:02,640
super broadly to evaluate models and the

871
00:37:59,520 --> 00:38:04,200
reason why is because this number is

872
00:38:02,640 --> 00:38:05,720
very dependent on the size of the data

873
00:38:04,200 --> 00:38:07,119
set so if you have a larger data set

874
00:38:05,720 --> 00:38:08,720
this number will be larger if you have a

875
00:38:07,119 --> 00:38:10,960
smaller data set this number will be

876
00:38:08,720 --> 00:38:14,040
smaller so the more common thing to do

877
00:38:10,960 --> 00:38:15,839
is per word uh log likelihood and per

878
00:38:14,040 --> 00:38:19,800
word log likelihood is basically

879
00:38:15,839 --> 00:38:22,760
dividing the um dividing the log

880
00:38:19,800 --> 00:38:25,520
probability of the entire corpus with uh

881
00:38:22,760 --> 00:38:28,359
the number of words that you have in the

882
00:38:25,520 --> 00:38:31,000
corpus

883
00:38:28,359 --> 00:38:34,599
um it's also common for papers to report

884
00:38:31,000 --> 00:38:36,359
negative log likelihood uh where because

885
00:38:34,599 --> 00:38:37,800
that's used as a loss and there lower is

886
00:38:36,359 --> 00:38:40,440
better so you just need to be careful

887
00:38:37,800 --> 00:38:42,560
about which one is being

888
00:38:40,440 --> 00:38:43,880
reported so this is pretty common I

889
00:38:42,560 --> 00:38:45,400
think most people are are somewhat

890
00:38:43,880 --> 00:38:49,040
familiar with

891
00:38:45,400 --> 00:38:49,800
this another thing that you might see is

892
00:38:49,040 --> 00:38:53,079
uh

893
00:38:49,800 --> 00:38:55,000
entropy and uh specifically this is

894
00:38:53,079 --> 00:38:57,319
often called cross entropy because

895
00:38:55,000 --> 00:38:59,880
you're calculating

896
00:38:57,319 --> 00:39:01,599
the you're estimating the model on a

897
00:38:59,880 --> 00:39:05,079
training data set and then evaluating it

898
00:39:01,599 --> 00:39:08,400
on a separate data set uh so uh on the

899
00:39:05,079 --> 00:39:12,200
test data set and this is calcul often

900
00:39:08,400 --> 00:39:14,640
or usually calculated as log 2 um of the

901
00:39:12,200 --> 00:39:17,119
probability divided by the number of

902
00:39:14,640 --> 00:39:18,760
words or units in the Corpus does anyone

903
00:39:17,119 --> 00:39:23,839
know why this is log

904
00:39:18,760 --> 00:39:23,839
two as opposed to a normal uh

905
00:39:25,440 --> 00:39:31,319
log

906
00:39:28,440 --> 00:39:31,319
anyone yeah

907
00:39:33,119 --> 00:39:38,720
so yeah so it's calculating as bits um

908
00:39:36,760 --> 00:39:43,160
and this is kind of

909
00:39:38,720 --> 00:39:45,240
a um this is kind of a historical thing

910
00:39:43,160 --> 00:39:47,119
and it's not super super important for

911
00:39:45,240 --> 00:39:51,800
language models but it's actually pretty

912
00:39:47,119 --> 00:39:54,599
interesting uh to to think about and so

913
00:39:51,800 --> 00:39:57,480
actually any probabilistic distribution

914
00:39:54,599 --> 00:40:00,040
can also be used for data compression

915
00:39:57,480 --> 00:40:03,319
um and so you know when you're running a

916
00:40:00,040 --> 00:40:05,000
zip file or you're running gzip or bz2

917
00:40:03,319 --> 00:40:07,359
or something like that uh you're

918
00:40:05,000 --> 00:40:09,240
compressing a file into a smaller file

919
00:40:07,359 --> 00:40:12,000
and any language model can also be used

920
00:40:09,240 --> 00:40:15,280
to compress a SM file into a smaller

921
00:40:12,000 --> 00:40:17,119
file um and so the way it does this is

922
00:40:15,280 --> 00:40:19,200
if you have more likely

923
00:40:17,119 --> 00:40:20,960
sequences uh for example more likely

924
00:40:19,200 --> 00:40:25,079
sentences or more likely documents you

925
00:40:20,960 --> 00:40:26,920
can press them into a a shorter uh

926
00:40:25,079 --> 00:40:29,440
output and

927
00:40:26,920 --> 00:40:29,440
kind of

928
00:40:29,640 --> 00:40:33,800
the

929
00:40:31,480 --> 00:40:35,720
ideal I I think it's pretty safe to say

930
00:40:33,800 --> 00:40:37,920
ideal because I think you can't get a

931
00:40:35,720 --> 00:40:42,920
better method for compression than this

932
00:40:37,920 --> 00:40:45,000
uh if I unless I'm uh you know not well

933
00:40:42,920 --> 00:40:46,800
versed enough in information Theory but

934
00:40:45,000 --> 00:40:49,240
I I think this is basically the ideal

935
00:40:46,800 --> 00:40:51,960
method for data compression and the way

936
00:40:49,240 --> 00:40:54,640
it works is um I have a figure up here

937
00:40:51,960 --> 00:40:58,800
but I'd like to recreate it here which

938
00:40:54,640 --> 00:41:02,640
is let's say we have a vocabulary of

939
00:40:58,800 --> 00:41:07,200
a um which has

940
00:41:02,640 --> 00:41:08,800
50% and then we have a vocabulary uh B

941
00:41:07,200 --> 00:41:11,560
which is

942
00:41:08,800 --> 00:41:14,040
33% and a vocabulary

943
00:41:11,560 --> 00:41:18,520
C

944
00:41:14,040 --> 00:41:18,520
uh yeah C which is about

945
00:41:18,640 --> 00:41:25,640
17% and so if you have a single token

946
00:41:22,960 --> 00:41:26,839
sequence um if you have a single token

947
00:41:25,640 --> 00:41:30,880
sequence

948
00:41:26,839 --> 00:41:30,880
what you do is you can

949
00:41:31,319 --> 00:41:38,800
see divide this into zero and one so if

950
00:41:36,400 --> 00:41:40,680
your single token sequence is a you can

951
00:41:38,800 --> 00:41:42,760
just put zero and you'll be done

952
00:41:40,680 --> 00:41:46,800
encoding it if your single token

953
00:41:42,760 --> 00:41:51,920
sequence is B

954
00:41:46,800 --> 00:41:56,520
then um one overlaps with b and c so now

955
00:41:51,920 --> 00:42:00,920
you need to further split this up into

956
00:41:56,520 --> 00:42:00,920
uh o and one and you can see

957
00:42:04,880 --> 00:42:11,440
that let make sure I did that right yeah

958
00:42:08,359 --> 00:42:11,440
you can you can see

959
00:42:15,599 --> 00:42:25,720
that one zero is entirely encompassed by

960
00:42:19,680 --> 00:42:29,200
uh by B so now B is one Z and C uh C is

961
00:42:25,720 --> 00:42:32,359
not L encompassed by that so you would

962
00:42:29,200 --> 00:42:39,240
need to further break this up and say

963
00:42:32,359 --> 00:42:41,880
it's Z one here and now one one

964
00:42:39,240 --> 00:42:45,520
one is encompassed by this so you would

965
00:42:41,880 --> 00:42:48,680
get uh you would get C if it was 111 and

966
00:42:45,520 --> 00:42:51,119
so every every sequence that started

967
00:42:48,680 --> 00:42:53,000
with zero would start out with a every

968
00:42:51,119 --> 00:42:54,960
sequence that started out with one zero

969
00:42:53,000 --> 00:42:57,200
would start with b and every sequence

970
00:42:54,960 --> 00:43:02,079
that started with 11 one1

971
00:42:57,200 --> 00:43:04,920
start um and so then you can look at the

972
00:43:02,079 --> 00:43:06,960
next word and let's say we're using a

973
00:43:04,920 --> 00:43:09,839
unigram model if we're using a unigram

974
00:43:06,960 --> 00:43:12,960
model for the next uh the next token

975
00:43:09,839 --> 00:43:18,200
let's say the next token is C

976
00:43:12,960 --> 00:43:23,640
so now the next token being C we already

977
00:43:18,200 --> 00:43:27,920
have B and now we take we subdivide

978
00:43:23,640 --> 00:43:33,040
B into

979
00:43:27,920 --> 00:43:35,720
a BC ba a BB and BC and then we find the

980
00:43:33,040 --> 00:43:40,720
next binary sequence that is entirely

981
00:43:35,720 --> 00:43:44,000
encompassed by uh BC by this like

982
00:43:40,720 --> 00:43:45,359
interval and so the moment we find a a

983
00:43:44,000 --> 00:43:48,520
binary sequence that's entirely

984
00:43:45,359 --> 00:43:50,599
encompassed by the interval uh then that

985
00:43:48,520 --> 00:43:53,400
is the the sequence that we can use to

986
00:43:50,599 --> 00:43:54,640
represent that SC and so um if you're

987
00:43:53,400 --> 00:43:56,520
interested in this you can look up the

988
00:43:54,640 --> 00:44:00,400
arithmetic coding on on wikip it's

989
00:43:56,520 --> 00:44:02,079
pretty fascinating but basically um here

990
00:44:00,400 --> 00:44:04,040
this is showing the example of the

991
00:44:02,079 --> 00:44:07,160
unigram model where the probabilities

992
00:44:04,040 --> 00:44:10,240
don't change based on the context but

993
00:44:07,160 --> 00:44:13,000
what if we knew that

994
00:44:10,240 --> 00:44:15,599
c had a really high probability of

995
00:44:13,000 --> 00:44:22,160
following B so if that's the case now we

996
00:44:15,599 --> 00:44:24,559
have like a a b c here um like based on

997
00:44:22,160 --> 00:44:25,880
our our byr model or neural language

998
00:44:24,559 --> 00:44:29,319
model or something like that so now this

999
00:44:25,880 --> 00:44:31,240
is interval is much much larger so it's

1000
00:44:29,319 --> 00:44:35,079
much more likely to entirely Encompass a

1001
00:44:31,240 --> 00:44:39,720
shorter string and because of that the

1002
00:44:35,079 --> 00:44:42,440
um the output can be much shorter and so

1003
00:44:39,720 --> 00:44:45,760
if you use this arithmetic encoding um

1004
00:44:42,440 --> 00:44:49,440
over a very long sequence of outputs

1005
00:44:45,760 --> 00:44:52,440
your the length of the sequence that is

1006
00:44:49,440 --> 00:44:56,000
needed to encode this uh this particular

1007
00:44:52,440 --> 00:45:00,359
output is going to be essentially um the

1008
00:44:56,000 --> 00:45:03,319
number of bits according to times the

1009
00:45:00,359 --> 00:45:06,480
times the sequence so this is very

1010
00:45:03,319 --> 00:45:10,000
directly connected to like compression

1011
00:45:06,480 --> 00:45:13,160
and information Theory and stuff like

1012
00:45:10,000 --> 00:45:15,359
that so that that's where entropy comes

1013
00:45:13,160 --> 00:45:17,680
from uh are are there any questions

1014
00:45:15,359 --> 00:45:17,680
about

1015
00:45:19,319 --> 00:45:22,319
this

1016
00:45:24,880 --> 00:45:28,119
yeah

1017
00:45:26,800 --> 00:45:31,880
uh for

1018
00:45:28,119 --> 00:45:34,319
c um so

1019
00:45:31,880 --> 00:45:36,599
111 is

1020
00:45:34,319 --> 00:45:37,920
because let me let me see if I can do

1021
00:45:36,599 --> 00:45:40,559
this

1022
00:45:37,920 --> 00:45:44,240
again

1023
00:45:40,559 --> 00:45:44,240
so I had one

1024
00:45:46,079 --> 00:45:54,520
one so here this interval is

1025
00:45:50,920 --> 00:45:56,839
one this interval is one one this

1026
00:45:54,520 --> 00:46:00,079
interval is 111

1027
00:45:56,839 --> 00:46:03,520
and 111 is the first interval that is

1028
00:46:00,079 --> 00:46:05,520
entirely overlapping with with c um and

1029
00:46:03,520 --> 00:46:08,760
it's not one Z because one one Z is

1030
00:46:05,520 --> 00:46:08,760
overlaping with b and

1031
00:46:09,960 --> 00:46:13,599
c so which

1032
00:46:14,280 --> 00:46:21,720
Cas so which case one

1033
00:46:20,160 --> 00:46:24,800
Z

1034
00:46:21,720 --> 00:46:26,319
one one one

1035
00:46:24,800 --> 00:46:30,800
Z

1036
00:46:26,319 --> 00:46:30,800
when would you use 110 to represent

1037
00:46:32,119 --> 00:46:38,839
something it's a good question I guess

1038
00:46:36,119 --> 00:46:40,599
maybe you wouldn't which seems a little

1039
00:46:38,839 --> 00:46:43,280
bit wasteful

1040
00:46:40,599 --> 00:46:46,160
so let me let me think about that I

1041
00:46:43,280 --> 00:46:49,920
think um it might be the case that you

1042
00:46:46,160 --> 00:46:52,319
just don't use it um

1043
00:46:49,920 --> 00:46:53,559
but yeah I'll try to think about that a

1044
00:46:52,319 --> 00:46:55,920
little bit more because it seems like

1045
00:46:53,559 --> 00:46:59,200
you should use every bet string right so

1046
00:46:55,920 --> 00:47:01,559
um yeah if anybody uh has has the answer

1047
00:46:59,200 --> 00:47:05,160
I'd be happy to hear it otherwise I take

1048
00:47:01,559 --> 00:47:07,079
you cool um so next thing is perplexity

1049
00:47:05,160 --> 00:47:10,640
so this is another one that you see

1050
00:47:07,079 --> 00:47:13,240
commonly and um so perplexity is

1051
00:47:10,640 --> 00:47:16,880
basically two to the ENT uh two to the

1052
00:47:13,240 --> 00:47:20,760
per word entropy or e to the uh negative

1053
00:47:16,880 --> 00:47:24,880
word level log likelihood in log space

1054
00:47:20,760 --> 00:47:28,240
um and so this uh T larger tends to be

1055
00:47:24,880 --> 00:47:32,559
better I'd like to do a little exercise

1056
00:47:28,240 --> 00:47:34,599
to see uh if this works so like let's

1057
00:47:32,559 --> 00:47:39,079
say we have one a dog sees a squirrel it

1058
00:47:34,599 --> 00:47:40,960
will usually um and can anyone guess the

1059
00:47:39,079 --> 00:47:43,480
next word just yell it

1060
00:47:40,960 --> 00:47:46,400
out bar

1061
00:47:43,480 --> 00:47:47,400
okay uh what about that what about

1062
00:47:46,400 --> 00:47:50,400
something

1063
00:47:47,400 --> 00:47:50,400
else

1064
00:47:52,640 --> 00:47:57,520
Chase Run

1065
00:47:54,720 --> 00:48:00,800
Run

1066
00:47:57,520 --> 00:48:00,800
okay John

1067
00:48:01,960 --> 00:48:05,280
John anything

1068
00:48:07,000 --> 00:48:10,400
else any other

1069
00:48:11,280 --> 00:48:16,960
ones so basically what this shows is

1070
00:48:13,640 --> 00:48:16,960
humans are really bad language

1071
00:48:17,160 --> 00:48:24,079
models so uh interestingly every single

1072
00:48:21,520 --> 00:48:26,559
one of the words you predicted here is a

1073
00:48:24,079 --> 00:48:32,240
uh a regular verb

1074
00:48:26,559 --> 00:48:35,200
um but in natural language model gpt2 uh

1075
00:48:32,240 --> 00:48:38,079
the first thing it predicts is B uh

1076
00:48:35,200 --> 00:48:40,440
which is kind of a like the Cula there's

1077
00:48:38,079 --> 00:48:43,400
also start and that will be like start

1078
00:48:40,440 --> 00:48:44,880
running start something um and humans

1079
00:48:43,400 --> 00:48:46,400
actually are really bad at doing this

1080
00:48:44,880 --> 00:48:49,079
are really bad at predicting next words

1081
00:48:46,400 --> 00:48:51,760
we're not trained that way um and so uh

1082
00:48:49,079 --> 00:48:54,319
we end up having these biases but anyway

1083
00:48:51,760 --> 00:48:55,799
um the reason why I did this quiz was

1084
00:48:54,319 --> 00:48:57,280
because that's essentially what

1085
00:48:55,799 --> 00:49:01,160
perplexity

1086
00:48:57,280 --> 00:49:02,680
means um and what what perplexity is is

1087
00:49:01,160 --> 00:49:04,559
it's the number of times you'd have to

1088
00:49:02,680 --> 00:49:07,000
sample from the probability distribution

1089
00:49:04,559 --> 00:49:09,200
before you get the answer right so you

1090
00:49:07,000 --> 00:49:11,160
were a little bit biased here because we

1091
00:49:09,200 --> 00:49:13,359
were doing sampling without replacement

1092
00:49:11,160 --> 00:49:15,480
so like nobody was actually picking a

1093
00:49:13,359 --> 00:49:17,000
word that had already been said but it's

1094
00:49:15,480 --> 00:49:18,319
essentially like if you guessed over and

1095
00:49:17,000 --> 00:49:20,839
over and over again how many times would

1096
00:49:18,319 --> 00:49:22,720
you need until you get it right and so

1097
00:49:20,839 --> 00:49:25,119
here like if the actual answer was start

1098
00:49:22,720 --> 00:49:27,480
the perplexity would be 4.66 so we'd

1099
00:49:25,119 --> 00:49:30,240
expect language model to get it in uh

1100
00:49:27,480 --> 00:49:34,400
four guesses uh between four and five

1101
00:49:30,240 --> 00:49:38,559
guesses and you guys all did six so you

1102
00:49:34,400 --> 00:49:41,599
lose um so uh another important thing to

1103
00:49:38,559 --> 00:49:42,799
mention is evaluation in vocabulary uh

1104
00:49:41,599 --> 00:49:44,880
so for fair

1105
00:49:42,799 --> 00:49:47,319
comparison um make sure that the

1106
00:49:44,880 --> 00:49:49,559
denominator is the same so uh if you're

1107
00:49:47,319 --> 00:49:51,559
calculating the perplexity make sure

1108
00:49:49,559 --> 00:49:53,359
that you're dividing by the same number

1109
00:49:51,559 --> 00:49:55,799
uh every time you're dividing by words

1110
00:49:53,359 --> 00:49:58,520
if it's uh the other paper or whatever

1111
00:49:55,799 --> 00:50:00,680
is dividing by words or like let's say

1112
00:49:58,520 --> 00:50:02,160
you're comparing llama to gp2 they have

1113
00:50:00,680 --> 00:50:04,880
different tokenizers so they'll have

1114
00:50:02,160 --> 00:50:07,040
different numbers of tokens so comparing

1115
00:50:04,880 --> 00:50:10,880
uh with different denominators is not uh

1116
00:50:07,040 --> 00:50:12,440
not fair um if you're allowing unknown

1117
00:50:10,880 --> 00:50:14,559
words or characters so if you allow the

1118
00:50:12,440 --> 00:50:17,640
model to not predict

1119
00:50:14,559 --> 00:50:19,119
any token then you need to be fair about

1120
00:50:17,640 --> 00:50:22,040
that

1121
00:50:19,119 --> 00:50:25,160
too um so I'd like to go into a few

1122
00:50:22,040 --> 00:50:27,960
Alternatives these are very similar to

1123
00:50:25,160 --> 00:50:29,400
the Network classifiers and bag of words

1124
00:50:27,960 --> 00:50:30,680
classifiers that I talked about before

1125
00:50:29,400 --> 00:50:32,480
so I'm going to go through them rather

1126
00:50:30,680 --> 00:50:35,480
quickly because I think you should get

1127
00:50:32,480 --> 00:50:38,119
the basic idea but basically the

1128
00:50:35,480 --> 00:50:40,000
alternative is uh featued models so we

1129
00:50:38,119 --> 00:50:42,559
calculate features of to account based

1130
00:50:40,000 --> 00:50:44,599
models as featued models so we calculate

1131
00:50:42,559 --> 00:50:46,880
features of the context and based on the

1132
00:50:44,599 --> 00:50:48,280
features calculate probabilities

1133
00:50:46,880 --> 00:50:50,480
optimize the feature weights using

1134
00:50:48,280 --> 00:50:53,839
gradient descent uh

1135
00:50:50,480 --> 00:50:56,119
Etc and so for example if we have uh

1136
00:50:53,839 --> 00:50:58,880
input giving a

1137
00:50:56,119 --> 00:51:02,960
uh we calculate features so um we might

1138
00:50:58,880 --> 00:51:05,400
look up uh the word identity of the two

1139
00:51:02,960 --> 00:51:08,240
previous words look up the word identity

1140
00:51:05,400 --> 00:51:11,000
of the word uh directly previous add a

1141
00:51:08,240 --> 00:51:13,480
bias add them all together get scores

1142
00:51:11,000 --> 00:51:14,960
and calculate probabilities where each

1143
00:51:13,480 --> 00:51:16,920
Vector is the size of the output

1144
00:51:14,960 --> 00:51:19,680
vocabulary and feature weights are

1145
00:51:16,920 --> 00:51:21,799
optimized using SGD so this is basically

1146
00:51:19,680 --> 00:51:24,240
a bag of words classifier but it's a

1147
00:51:21,799 --> 00:51:27,200
multiclass bag of words classifier over

1148
00:51:24,240 --> 00:51:28,960
the next token so it's very similar to

1149
00:51:27,200 --> 00:51:30,839
our classification task before except

1150
00:51:28,960 --> 00:51:33,160
now instead of having two classes we

1151
00:51:30,839 --> 00:51:36,280
have you know 10,000 classes or 100,000

1152
00:51:33,160 --> 00:51:38,480
classes oh yeah sorry very quick aside

1153
00:51:36,280 --> 00:51:40,280
um these were actually invented by Rony

1154
00:51:38,480 --> 00:51:41,440
Rosenfeld who's the head of the machine

1155
00:51:40,280 --> 00:51:45,119
learning department at the end the

1156
00:51:41,440 --> 00:51:47,799
machine learning Department uh so um 27

1157
00:51:45,119 --> 00:51:50,760
years ago I guess so he has even more

1158
00:51:47,799 --> 00:51:52,680
experience large language modeling than

1159
00:51:50,760 --> 00:51:55,880
um

1160
00:51:52,680 --> 00:51:58,599
cool so um the one difference with a bag

1161
00:51:55,880 --> 00:52:02,119
of words classifier is

1162
00:51:58,599 --> 00:52:05,480
um we we have

1163
00:52:02,119 --> 00:52:07,640
biases um and we have the probability

1164
00:52:05,480 --> 00:52:09,400
Vector given the previous word but

1165
00:52:07,640 --> 00:52:11,720
instead of using a bag of words this

1166
00:52:09,400 --> 00:52:15,440
actually is using uh How likely is it

1167
00:52:11,720 --> 00:52:16,960
giving given two words previous so uh

1168
00:52:15,440 --> 00:52:18,040
the feature design would be a little bit

1169
00:52:16,960 --> 00:52:19,119
different and that would give you a

1170
00:52:18,040 --> 00:52:22,920
total

1171
00:52:19,119 --> 00:52:24,359
score um as a reminder uh last time we

1172
00:52:22,920 --> 00:52:26,440
did a training algorithm where we

1173
00:52:24,359 --> 00:52:27,480
calculated gradients loss function with

1174
00:52:26,440 --> 00:52:29,960
respect to the

1175
00:52:27,480 --> 00:52:32,319
parameters and uh we can use the chain

1176
00:52:29,960 --> 00:52:33,839
Rule and back propagation and updates to

1177
00:52:32,319 --> 00:52:36,400
move in the direction that increases

1178
00:52:33,839 --> 00:52:39,040
enough so nothing extremely different

1179
00:52:36,400 --> 00:52:42,640
from what we had for our

1180
00:52:39,040 --> 00:52:44,240
B um similarly this solves some problems

1181
00:52:42,640 --> 00:52:47,240
so this didn't solve the problem of

1182
00:52:44,240 --> 00:52:49,119
sharing strength among similar words it

1183
00:52:47,240 --> 00:52:50,839
did solve the problem of conditioning on

1184
00:52:49,119 --> 00:52:52,839
context with intervening words because

1185
00:52:50,839 --> 00:52:56,920
now we can condition directly on Doctor

1186
00:52:52,839 --> 00:52:59,680
without having to um combine with

1187
00:52:56,920 --> 00:53:01,200
gitrid um and it doesn't necessarily

1188
00:52:59,680 --> 00:53:03,480
handle longdistance dependencies because

1189
00:53:01,200 --> 00:53:05,240
we're still limited in our context with

1190
00:53:03,480 --> 00:53:09,079
the model I just

1191
00:53:05,240 --> 00:53:11,920
described so um if we so sorry back to

1192
00:53:09,079 --> 00:53:13,480
neural networks is what I should say um

1193
00:53:11,920 --> 00:53:15,160
so if we have a feedforward neural

1194
00:53:13,480 --> 00:53:18,480
network language model the way this

1195
00:53:15,160 --> 00:53:20,400
could work is instead of looking up

1196
00:53:18,480 --> 00:53:23,079
discrete features uh like we had in a

1197
00:53:20,400 --> 00:53:25,960
bag of words model uh we would look up

1198
00:53:23,079 --> 00:53:27,400
dents embeddings and so we concatenate

1199
00:53:25,960 --> 00:53:29,359
together these dense

1200
00:53:27,400 --> 00:53:32,319
embeddings and based on the dense

1201
00:53:29,359 --> 00:53:34,599
embeddings uh we do some sort of uh

1202
00:53:32,319 --> 00:53:36,079
intermediate layer transforms to extract

1203
00:53:34,599 --> 00:53:37,200
features like we did for our neural

1204
00:53:36,079 --> 00:53:39,359
network based

1205
00:53:37,200 --> 00:53:41,520
classifier um we multiply this by

1206
00:53:39,359 --> 00:53:43,559
weights uh we have a bias and we

1207
00:53:41,520 --> 00:53:46,559
calculate

1208
00:53:43,559 --> 00:53:49,200
scores and uh then we take a soft Max to

1209
00:53:46,559 --> 00:53:49,200
do

1210
00:53:50,400 --> 00:53:55,799
classification so um this can calculate

1211
00:53:53,359 --> 00:53:58,000
combination features uh like we we also

1212
00:53:55,799 --> 00:54:02,280
used in our uh neural network based

1213
00:53:58,000 --> 00:54:04,119
classifiers so um this could uh give us

1214
00:54:02,280 --> 00:54:05,760
a positive number for example if the

1215
00:54:04,119 --> 00:54:07,760
previous word is a determiner and the

1216
00:54:05,760 --> 00:54:10,440
second previous word is a verb so that

1217
00:54:07,760 --> 00:54:14,520
would be like uh in giving and then that

1218
00:54:10,440 --> 00:54:14,520
would allow us upway to that particular

1219
00:54:15,000 --> 00:54:19,559
examples um so this allows us to share

1220
00:54:17,640 --> 00:54:21,640
strength in various places in our model

1221
00:54:19,559 --> 00:54:23,520
which was also You Know instrumental in

1222
00:54:21,640 --> 00:54:25,599
making our our neural network

1223
00:54:23,520 --> 00:54:28,000
classifiers work for similar work and

1224
00:54:25,599 --> 00:54:30,119
stuff and so these would be word

1225
00:54:28,000 --> 00:54:32,160
embeddings so similar words get similar

1226
00:54:30,119 --> 00:54:35,079
embeddings another really important

1227
00:54:32,160 --> 00:54:38,480
thing is uh similar output words also

1228
00:54:35,079 --> 00:54:41,839
get similar rows in The softmax Matrix

1229
00:54:38,480 --> 00:54:44,440
and so here remember if you remember

1230
00:54:41,839 --> 00:54:48,240
from last class this was a big Matrix

1231
00:54:44,440 --> 00:54:50,400
where the size of the Matrix was the

1232
00:54:48,240 --> 00:54:53,319
number of vocabulary items times the

1233
00:54:50,400 --> 00:54:55,920
size of a word embedding this is also a

1234
00:54:53,319 --> 00:54:58,319
matrix where this is

1235
00:54:55,920 --> 00:55:02,200
the number of vocabulary items times the

1236
00:54:58,319 --> 00:55:04,160
size of a context embedding gr and so

1237
00:55:02,200 --> 00:55:06,160
these will also be similar because words

1238
00:55:04,160 --> 00:55:08,280
that appear in similar contexts will

1239
00:55:06,160 --> 00:55:11,920
also you know want similar embeddings so

1240
00:55:08,280 --> 00:55:15,119
they get uploaded in at the same

1241
00:55:11,920 --> 00:55:17,119
time and similar hidden States will have

1242
00:55:15,119 --> 00:55:19,799
similar context so ideally like if you

1243
00:55:17,119 --> 00:55:20,920
have giving a or delivering a or

1244
00:55:19,799 --> 00:55:22,680
something like that those would be

1245
00:55:20,920 --> 00:55:27,000
similar contexts so they would get

1246
00:55:22,680 --> 00:55:27,000
similar purple embeddings out out of the

1247
00:55:28,440 --> 00:55:31,599
so one trick that's widely used in

1248
00:55:30,200 --> 00:55:34,960
language model that further takes

1249
00:55:31,599 --> 00:55:38,799
advantage of this is uh tying

1250
00:55:34,960 --> 00:55:44,160
embeddings so here what this does is

1251
00:55:38,799 --> 00:55:48,280
sharing parameters between this um

1252
00:55:44,160 --> 00:55:49,920
lookup Matrix here and this uh Matrix

1253
00:55:48,280 --> 00:55:51,119
over here that we use for calculating

1254
00:55:49,920 --> 00:55:56,200
the

1255
00:55:51,119 --> 00:55:58,839
softmax and um the reason why this is

1256
00:55:56,200 --> 00:56:00,559
useful is twofold number one it gives

1257
00:55:58,839 --> 00:56:02,079
you essentially more training data to

1258
00:56:00,559 --> 00:56:04,440
learn these embeddings because instead

1259
00:56:02,079 --> 00:56:05,799
of learning the embeddings whenever a

1260
00:56:04,440 --> 00:56:08,520
word is in

1261
00:56:05,799 --> 00:56:10,599
context separately from learning the

1262
00:56:08,520 --> 00:56:13,520
embeddings whenever a word is predicted

1263
00:56:10,599 --> 00:56:15,480
you learn the the same embedding Matrix

1264
00:56:13,520 --> 00:56:19,319
whenever the word is in the context or

1265
00:56:15,480 --> 00:56:21,520
whatever it's predicted and so um that

1266
00:56:19,319 --> 00:56:24,119
makes it more accurate to learn these uh

1267
00:56:21,520 --> 00:56:26,960
embeddings well another thing is the

1268
00:56:24,119 --> 00:56:31,119
embedding mat can actually be very large

1269
00:56:26,960 --> 00:56:34,920
so like let's say we have aab of

1270
00:56:31,119 --> 00:56:37,520
10 100,000 and we have an embedding a

1271
00:56:34,920 --> 00:56:40,799
word embedding size of like 512 or

1272
00:56:37,520 --> 00:56:45,319
something like that

1273
00:56:40,799 --> 00:56:45,319
that's um 51 million

1274
00:56:46,839 --> 00:56:52,440
parameters um and this doesn't sound

1275
00:56:49,559 --> 00:56:55,520
like a lot of parameters at first but it

1276
00:56:52,440 --> 00:56:57,880
actually is a lot to learn when um

1277
00:56:55,520 --> 00:57:01,000
these get updated relatively

1278
00:56:57,880 --> 00:57:03,400
infrequently uh because

1279
00:57:01,000 --> 00:57:06,079
um these get updated relatively

1280
00:57:03,400 --> 00:57:07,960
infrequently because they only are

1281
00:57:06,079 --> 00:57:09,559
updated whenever that word or token

1282
00:57:07,960 --> 00:57:12,319
actually appears in your training data

1283
00:57:09,559 --> 00:57:14,119
so um this can be a good thing for

1284
00:57:12,319 --> 00:57:16,319
parameter savings parameter efficiency

1285
00:57:14,119 --> 00:57:16,319
as

1286
00:57:16,440 --> 00:57:22,520
well um so this uh solves most of the

1287
00:57:19,599 --> 00:57:24,319
problems here um but it doesn't solve

1288
00:57:22,520 --> 00:57:26,839
the problem of longdistance dependencies

1289
00:57:24,319 --> 00:57:29,839
because still limited by the overall

1290
00:57:26,839 --> 00:57:31,359
length of uh the context that we're

1291
00:57:29,839 --> 00:57:32,520
concatenating together here sure we

1292
00:57:31,359 --> 00:57:35,760
could make that longer but that would

1293
00:57:32,520 --> 00:57:37,200
make our model larger and um and bring

1294
00:57:35,760 --> 00:57:39,720
various

1295
00:57:37,200 --> 00:57:42,520
issues and so what I'm going to talk

1296
00:57:39,720 --> 00:57:44,599
about in on thur day is how we solve

1297
00:57:42,520 --> 00:57:47,559
this problem of modeling long contexts

1298
00:57:44,599 --> 00:57:49,720
so how do we um build recurrent neural

1299
00:57:47,559 --> 00:57:52,559
networks uh how do we build

1300
00:57:49,720 --> 00:57:54,960
convolutional uh convolutional networks

1301
00:57:52,559 --> 00:57:57,520
or how do we build attention based

1302
00:57:54,960 --> 00:58:00,720
Transformer models and these are all

1303
00:57:57,520 --> 00:58:02,119
options that are used um Transformers

1304
00:58:00,720 --> 00:58:04,359
are kind of

1305
00:58:02,119 --> 00:58:06,039
the the main thing that people use

1306
00:58:04,359 --> 00:58:08,400
nowadays but there's a lot of versions

1307
00:58:06,039 --> 00:58:11,880
of Transformers that borrow ideas from

1308
00:58:08,400 --> 00:58:14,960
recurrent uh and convolutional models

1309
00:58:11,880 --> 00:58:17,359
um recently a lot of long context models

1310
00:58:14,960 --> 00:58:19,440
us use ideas from recurrent networks and

1311
00:58:17,359 --> 00:58:22,160
a lot of for example speech models or

1312
00:58:19,440 --> 00:58:24,160
things like or image models use ideas

1313
00:58:22,160 --> 00:58:25,920
from convolutional networks so I think

1314
00:58:24,160 --> 00:58:28,760
learning all but at the same time is a

1315
00:58:25,920 --> 00:58:32,160
good idea in comparing

1316
00:58:28,760 --> 00:58:34,319
them cool uh any any questions about

1317
00:58:32,160 --> 00:58:35,799
this part I went through this kind of

1318
00:58:34,319 --> 00:58:37,319
quickly because it's pretty similar to

1319
00:58:35,799 --> 00:58:40,079
the the classification stuff that we

1320
00:58:37,319 --> 00:58:42,680
covered last time but uh any any things

1321
00:58:40,079 --> 00:58:42,680
that people want to

1322
00:58:43,880 --> 00:58:49,039
ask okay so next I'm going to talk about

1323
00:58:46,839 --> 00:58:51,559
a few other desiderata of language

1324
00:58:49,039 --> 00:58:53,039
models so the next one is really really

1325
00:58:51,559 --> 00:58:55,640
important it's a concept I want

1326
00:58:53,039 --> 00:58:57,640
everybody to know I actually

1327
00:58:55,640 --> 00:58:59,520
taught this informally up until this

1328
00:58:57,640 --> 00:59:02,039
class but now I I actually made slides

1329
00:58:59,520 --> 00:59:05,079
for it starting this time which is

1330
00:59:02,039 --> 00:59:07,240
calibration so the idea of calibration

1331
00:59:05,079 --> 00:59:10,200
is that the model quote unquote knows

1332
00:59:07,240 --> 00:59:14,559
when it knows or the the fact that it is

1333
00:59:10,200 --> 00:59:17,480
able to provide a a good answer um uh

1334
00:59:14,559 --> 00:59:21,640
provide a good confidence in its answer

1335
00:59:17,480 --> 00:59:23,640
and more formally this can be specified

1336
00:59:21,640 --> 00:59:25,240
as

1337
00:59:23,640 --> 00:59:27,799
the

1338
00:59:25,240 --> 00:59:29,200
feature that the model probability of

1339
00:59:27,799 --> 00:59:33,119
the answer matches the actual

1340
00:59:29,200 --> 00:59:37,319
probability of getting it right um and

1341
00:59:33,119 --> 00:59:37,319
so what this means

1342
00:59:41,960 --> 00:59:47,480
is the

1343
00:59:44,240 --> 00:59:51,839
probability of the

1344
00:59:47,480 --> 00:59:51,839
answer um is

1345
00:59:52,720 --> 00:59:59,880
correct given the fact that

1346
00:59:56,319 --> 00:59:59,880
the model

1347
01:00:00,160 --> 01:00:07,440
probability is equal to

1348
01:00:03,640 --> 01:00:07,440
P is equal to

1349
01:00:08,559 --> 01:00:12,760
ke

1350
01:00:10,480 --> 01:00:15,319
so I know this is a little bit hard to

1351
01:00:12,760 --> 01:00:18,240
parse I it always took me like a few

1352
01:00:15,319 --> 01:00:21,720
seconds to parse before I uh like when I

1353
01:00:18,240 --> 01:00:25,160
looked at it but basically if the model

1354
01:00:21,720 --> 01:00:26,920
if the model says the probability of it

1355
01:00:25,160 --> 01:00:29,440
being correct is

1356
01:00:26,920 --> 01:00:33,559
0.7 then the probability that the answer

1357
01:00:29,440 --> 01:00:35,960
is correct is actually 0.7 so um you

1358
01:00:33,559 --> 01:00:41,520
know if it says uh the probability is

1359
01:00:35,960 --> 01:00:41,520
0.7 100 times then it will be right 70

1360
01:00:43,640 --> 01:00:52,160
times and so the way we formalize this

1361
01:00:48,039 --> 01:00:55,200
um is is by this uh it was proposed by

1362
01:00:52,160 --> 01:00:57,760
this seminal paper by gu it all in

1363
01:00:55,200 --> 01:01:00,319
2017

1364
01:00:57,760 --> 01:01:03,319
and

1365
01:01:00,319 --> 01:01:05,520
unfortunately this data itself is hard

1366
01:01:03,319 --> 01:01:08,119
to collect

1367
01:01:05,520 --> 01:01:11,200
because the model probability is always

1368
01:01:08,119 --> 01:01:13,359
different right and so if the model

1369
01:01:11,200 --> 01:01:15,359
probability is like if the model

1370
01:01:13,359 --> 01:01:20,480
probability was actually 0.7 that'd be

1371
01:01:15,359 --> 01:01:22,000
nice but actually it's 0.793 to 6 8 5

1372
01:01:20,480 --> 01:01:24,599
and you never get another example where

1373
01:01:22,000 --> 01:01:26,319
the probability is exactly the same so

1374
01:01:24,599 --> 01:01:28,280
what we do instead is we divide the

1375
01:01:26,319 --> 01:01:30,240
model probabilities into buckets so we

1376
01:01:28,280 --> 01:01:32,880
say the model probability is between 0

1377
01:01:30,240 --> 01:01:36,599
and 0.1 we say the model probability is

1378
01:01:32,880 --> 01:01:40,319
between 0.1 and 0.2 0.2 and 0.3 so we

1379
01:01:36,599 --> 01:01:44,599
create buckets like this like these and

1380
01:01:40,319 --> 01:01:46,520
then we looked at the model confidence

1381
01:01:44,599 --> 01:01:52,839
the average model confidence within that

1382
01:01:46,520 --> 01:01:55,000
bucket so maybe uh between 0.1 and 0 uh

1383
01:01:52,839 --> 01:01:58,000
between 0 and 0.1 the model confidence

1384
01:01:55,000 --> 01:02:00,920
on average is 0 055 or something like

1385
01:01:58,000 --> 01:02:02,640
that so that would be this T here and

1386
01:02:00,920 --> 01:02:05,079
then the accuracy is how often did it

1387
01:02:02,640 --> 01:02:06,680
actually get a correct and this can be

1388
01:02:05,079 --> 01:02:09,720
plotted in this thing called a

1389
01:02:06,680 --> 01:02:15,039
reliability diagram and the reliability

1390
01:02:09,720 --> 01:02:17,599
diagram basically um the the

1391
01:02:15,039 --> 01:02:20,359
outputs uh

1392
01:02:17,599 --> 01:02:26,359
here so this is

1393
01:02:20,359 --> 01:02:26,359
um the this is the model

1394
01:02:27,520 --> 01:02:34,119
yeah I think the red is the model

1395
01:02:30,760 --> 01:02:36,400
um expected probability and then the

1396
01:02:34,119 --> 01:02:40,559
blue uh the blue is the actual

1397
01:02:36,400 --> 01:02:43,240
probability and then um

1398
01:02:40,559 --> 01:02:45,160
the difference between the expected and

1399
01:02:43,240 --> 01:02:47,160
the actual probability is kind of like

1400
01:02:45,160 --> 01:02:48,359
the penalty there is how how poorly

1401
01:02:47,160 --> 01:02:52,000
calibrated

1402
01:02:48,359 --> 01:02:55,880
the and one really important thing to

1403
01:02:52,000 --> 01:02:58,440
know is that calibration in accuracy are

1404
01:02:55,880 --> 01:03:00,599
not necessarily they don't go hand inand

1405
01:02:58,440 --> 01:03:02,359
uh they do to some extent but they don't

1406
01:03:00,599 --> 01:03:06,440
uh they don't necessarily go hand in

1407
01:03:02,359 --> 01:03:06,440
hand and

1408
01:03:07,200 --> 01:03:14,319
the example on the left is a a bad model

1409
01:03:11,200 --> 01:03:16,279
but a well calibrated so its accuracy is

1410
01:03:14,319 --> 01:03:18,720
uh its error is

1411
01:03:16,279 --> 01:03:20,000
44.9% um but it's well calibrated as you

1412
01:03:18,720 --> 01:03:21,440
can see like when it says it knows the

1413
01:03:20,000 --> 01:03:23,880
answer it knows the answer when it

1414
01:03:21,440 --> 01:03:27,799
doesn't answer does this model on the

1415
01:03:23,880 --> 01:03:30,000
other hand has better erir and um but

1416
01:03:27,799 --> 01:03:31,880
worse calibration so the reason why is

1417
01:03:30,000 --> 01:03:36,680
the model is very very confident all the

1418
01:03:31,880 --> 01:03:39,640
time and usually what happens is um

1419
01:03:36,680 --> 01:03:41,200
models that overfit to the data

1420
01:03:39,640 --> 01:03:43,359
especially when you do early stopping on

1421
01:03:41,200 --> 01:03:44,760
something like accuracy uh when you stop

1422
01:03:43,359 --> 01:03:47,279
the training on something like accuracy

1423
01:03:44,760 --> 01:03:49,960
will become very overconfident and uh

1424
01:03:47,279 --> 01:03:52,599
give confidence estimates um that are in

1425
01:03:49,960 --> 01:03:54,000
cor like this so this is important to

1426
01:03:52,599 --> 01:03:56,079
know and the reason why it's important

1427
01:03:54,000 --> 01:03:58,000
to know is actually because you know

1428
01:03:56,079 --> 01:04:00,960
models are very good at making up things

1429
01:03:58,000 --> 01:04:02,359
that aren't actually correct nowadays um

1430
01:04:00,960 --> 01:04:04,920
and but if you have a really well

1431
01:04:02,359 --> 01:04:07,760
calibrated model you could at least say

1432
01:04:04,920 --> 01:04:09,920
with what confidence you have this

1433
01:04:07,760 --> 01:04:12,760
working so how do you calculate the

1434
01:04:09,920 --> 01:04:14,160
probability of an answer so H yeah sorry

1435
01:04:12,760 --> 01:04:17,599
uh yes

1436
01:04:14,160 --> 01:04:17,599
yes yeah please

1437
01:04:17,799 --> 01:04:26,559
go the probability of percent or

1438
01:04:23,200 --> 01:04:28,039
percent um usually this would be for a

1439
01:04:26,559 --> 01:04:29,599
generated output because you want to

1440
01:04:28,039 --> 01:04:32,559
know the the probability that the

1441
01:04:29,599 --> 01:04:32,559
generated output is

1442
01:04:53,160 --> 01:04:56,160
cor

1443
01:05:01,079 --> 01:05:06,319
great that's what I'm about to talk

1444
01:05:03,000 --> 01:05:07,839
about so perfect perfect question um so

1445
01:05:06,319 --> 01:05:10,160
how do we calculate the answer

1446
01:05:07,839 --> 01:05:13,279
probability or um how do we calculate

1447
01:05:10,160 --> 01:05:15,039
the confidence in an answer um we're

1448
01:05:13,279 --> 01:05:18,319
actually going to go into more detail

1449
01:05:15,039 --> 01:05:20,760
about this um in a a later class but the

1450
01:05:18,319 --> 01:05:23,200
first thing is probability of the answer

1451
01:05:20,760 --> 01:05:25,799
and this is easy when there's a single

1452
01:05:23,200 --> 01:05:29,079
answer um like if there's only one

1453
01:05:25,799 --> 01:05:31,839
correct answer and you want your model

1454
01:05:29,079 --> 01:05:34,160
to be solving math problems and you want

1455
01:05:31,839 --> 01:05:38,319
it to return only the answer and nothing

1456
01:05:34,160 --> 01:05:40,760
else if it returns anything else like it

1457
01:05:38,319 --> 01:05:44,920
won't work then you can just use the

1458
01:05:40,760 --> 01:05:47,119
probability of the answer but what

1459
01:05:44,920 --> 01:05:49,559
if

1460
01:05:47,119 --> 01:05:52,000
um what if there are multiple acceptable

1461
01:05:49,559 --> 01:05:54,680
answers um and maybe a perfect example

1462
01:05:52,000 --> 01:06:02,240
of that is like where is CMU located

1463
01:05:54,680 --> 01:06:04,400
or um uh where where are we right now um

1464
01:06:02,240 --> 01:06:06,960
if the answer is where are we right

1465
01:06:04,400 --> 01:06:08,880
now um could be

1466
01:06:06,960 --> 01:06:12,880
Pittsburgh could be

1467
01:06:08,880 --> 01:06:12,880
CMU could be carnegy

1468
01:06:16,200 --> 01:06:24,440
melon could be other other things like

1469
01:06:18,760 --> 01:06:26,760
this right um and so another way that

1470
01:06:24,440 --> 01:06:28,319
you can calculate the confidence is

1471
01:06:26,760 --> 01:06:31,240
calculating the probability of the

1472
01:06:28,319 --> 01:06:33,680
answer plus uh you know paraphrases of

1473
01:06:31,240 --> 01:06:35,799
the answer or other uh other things like

1474
01:06:33,680 --> 01:06:37,680
this and so then you would just sum the

1475
01:06:35,799 --> 01:06:38,839
probability over all the qu like

1476
01:06:37,680 --> 01:06:41,680
acceptable

1477
01:06:38,839 --> 01:06:45,359
answers

1478
01:06:41,680 --> 01:06:47,680
um another thing that you can do is um

1479
01:06:45,359 --> 01:06:49,279
sample multiple outputs and count the

1480
01:06:47,680 --> 01:06:51,000
number of times you get a particular

1481
01:06:49,279 --> 01:06:54,440
answer this doesn't solve the problem of

1482
01:06:51,000 --> 01:06:58,119
paraphrasing ex paraphrases existing but

1483
01:06:54,440 --> 01:06:59,880
it does solve the problem of uh it does

1484
01:06:58,119 --> 01:07:01,480
solve two problems sometimes there are

1485
01:06:59,880 --> 01:07:05,240
language models where you can't get

1486
01:07:01,480 --> 01:07:06,640
probabilities out of them um this is not

1487
01:07:05,240 --> 01:07:08,680
so much of a problem anymore with the

1488
01:07:06,640 --> 01:07:11,240
GPT models because they're reintroducing

1489
01:07:08,680 --> 01:07:12,440
the ability to get probabilities but um

1490
01:07:11,240 --> 01:07:13,720
there are some models where you can just

1491
01:07:12,440 --> 01:07:16,279
sample from them and you can't get

1492
01:07:13,720 --> 01:07:18,680
probabilities out but also more

1493
01:07:16,279 --> 01:07:21,039
importantly um sometimes when you're

1494
01:07:18,680 --> 01:07:23,000
using things like uh Chain of Thought

1495
01:07:21,039 --> 01:07:26,520
reasoning which I'll talk about in more

1496
01:07:23,000 --> 01:07:29,839
detail but basically it's like um please

1497
01:07:26,520 --> 01:07:31,480
solve this math problem and explain

1498
01:07:29,839 --> 01:07:33,480
explain your solution and then if it

1499
01:07:31,480 --> 01:07:35,119
will do that it will generate you know a

1500
01:07:33,480 --> 01:07:36,279
really long explanation of how it got to

1501
01:07:35,119 --> 01:07:40,119
the solution and then it will give you

1502
01:07:36,279 --> 01:07:41,640
the answer at the very end and so then

1503
01:07:40,119 --> 01:07:44,960
you can't calculate the probability of

1504
01:07:41,640 --> 01:07:47,720
the actual like answer itself because

1505
01:07:44,960 --> 01:07:49,359
there's this long reasoning chain in

1506
01:07:47,720 --> 01:07:51,960
between and you have like all these

1507
01:07:49,359 --> 01:07:53,559
other all that other text there but what

1508
01:07:51,960 --> 01:07:55,480
you can do is you can sample those

1509
01:07:53,559 --> 01:07:56,920
reasoning chains 100 times and then see

1510
01:07:55,480 --> 01:07:59,599
how many times you got a particular

1511
01:07:56,920 --> 01:08:02,960
answer and that's actually a pretty um a

1512
01:07:59,599 --> 01:08:06,079
Prett pretty reasonable way of uh

1513
01:08:02,960 --> 01:08:09,000
getting a have

1514
01:08:06,079 --> 01:08:11,200
yet this is my favorite one I I love how

1515
01:08:09,000 --> 01:08:12,880
we can do this now it's just absolutely

1516
01:08:11,200 --> 01:08:16,480
ridiculous but you could ask the model

1517
01:08:12,880 --> 01:08:20,279
how confident it is and um it sometimes

1518
01:08:16,480 --> 01:08:22,359
gives you a reasonable uh a reasonable

1519
01:08:20,279 --> 01:08:24,600
answer um there's a really nice

1520
01:08:22,359 --> 01:08:26,400
comparison of different methods uh in

1521
01:08:24,600 --> 01:08:29,679
this paper which is also on on the

1522
01:08:26,400 --> 01:08:31,960
website and basically long story short

1523
01:08:29,679 --> 01:08:34,000
the conclusion from this paper is the

1524
01:08:31,960 --> 01:08:35,640
sampling multiple outputs one is the

1525
01:08:34,000 --> 01:08:36,839
best way to do it if you can't directly

1526
01:08:35,640 --> 01:08:39,520
calculate

1527
01:08:36,839 --> 01:08:41,359
probabilities um another thing that I'd

1528
01:08:39,520 --> 01:08:42,600
like people to pay very close attention

1529
01:08:41,359 --> 01:08:45,040
to is in the

1530
01:08:42,600 --> 01:08:46,480
Generation Um in the generation class

1531
01:08:45,040 --> 01:08:49,600
we're going to be talking about minimum

1532
01:08:46,480 --> 01:08:52,600
based risk which is a Criterion for

1533
01:08:49,600 --> 01:08:54,719
deciding how risky an output is and it's

1534
01:08:52,600 --> 01:08:56,199
actually a really good uh confidence

1535
01:08:54,719 --> 01:08:58,000
metric as well but I'm going to leave

1536
01:08:56,199 --> 01:08:59,440
that till when we discuss it more detail

1537
01:08:58,000 --> 01:09:02,759
with

1538
01:08:59,440 --> 01:09:05,359
it um any any questions

1539
01:09:02,759 --> 01:09:08,440
here okay

1540
01:09:05,359 --> 01:09:10,480
cool um so the other Criterion uh this

1541
01:09:08,440 --> 01:09:12,520
is just yet another Criterion that we

1542
01:09:10,480 --> 01:09:15,239
would like language models to be good at

1543
01:09:12,520 --> 01:09:17,600
um its efficiency and so basically the

1544
01:09:15,239 --> 01:09:21,920
model is easy to run on limited Hardware

1545
01:09:17,600 --> 01:09:25,400
by some you know uh metric of easy and

1546
01:09:21,920 --> 01:09:29,319
some metrics that we like to talk about

1547
01:09:25,400 --> 01:09:32,400
our parameter account so often you will

1548
01:09:29,319 --> 01:09:34,239
see oh this is the best model under

1549
01:09:32,400 --> 01:09:35,520
three billion parameters or this is the

1550
01:09:34,239 --> 01:09:37,960
best model under seven billion

1551
01:09:35,520 --> 01:09:39,600
parameters or um we trained a model with

1552
01:09:37,960 --> 01:09:42,159
one trillion parameters or something

1553
01:09:39,600 --> 01:09:44,719
like that you know

1554
01:09:42,159 --> 01:09:46,839
uh the thing is parameter count doesn't

1555
01:09:44,719 --> 01:09:49,640
really mean that much um from the point

1556
01:09:46,839 --> 01:09:52,839
of view of like ease of using the model

1557
01:09:49,640 --> 01:09:54,400
um unless you also think about other uh

1558
01:09:52,839 --> 01:09:56,480
you know deser

1559
01:09:54,400 --> 01:09:58,840
like just to give one example this is a

1560
01:09:56,480 --> 01:10:00,880
parameter count um let's say you have a

1561
01:09:58,840 --> 01:10:02,960
parameter count of 7 billion is that 7

1562
01:10:00,880 --> 01:10:05,719
billion parameters at 32-bit Precision

1563
01:10:02,960 --> 01:10:07,800
or is that 7 billion parameters at 4bit

1564
01:10:05,719 --> 01:10:09,400
Precision um will make a huge difference

1565
01:10:07,800 --> 01:10:12,960
in your memory footprint your speed

1566
01:10:09,400 --> 01:10:14,920
other things like that um so some of the

1567
01:10:12,960 --> 01:10:18,040
things that are more direct with respect

1568
01:10:14,920 --> 01:10:19,800
to efficiency are memory usage um and

1569
01:10:18,040 --> 01:10:22,440
there's two varieties of memory usage

1570
01:10:19,800 --> 01:10:24,280
one is model uh model only memory usage

1571
01:10:22,440 --> 01:10:27,120
so when you load loaded the model into

1572
01:10:24,280 --> 01:10:29,120
memory uh how much space does it take

1573
01:10:27,120 --> 01:10:31,159
and also Peak memory consumption when

1574
01:10:29,120 --> 01:10:33,159
you run have run the model over a

1575
01:10:31,159 --> 01:10:35,920
sequence of a certain length how much is

1576
01:10:33,159 --> 01:10:40,040
it going to P so that's another

1577
01:10:35,920 --> 01:10:43,000
thing another thing is latency um and

1578
01:10:40,040 --> 01:10:46,440
with respect to latency this can be

1579
01:10:43,000 --> 01:10:49,440
either how long does it take to start

1580
01:10:46,440 --> 01:10:52,080
outputting the first token um and how

1581
01:10:49,440 --> 01:10:54,840
long does it take to uh finish

1582
01:10:52,080 --> 01:10:59,480
outputting uh a generation of a certain

1583
01:10:54,840 --> 01:11:01,199
length and the first will have more to

1584
01:10:59,480 --> 01:11:04,960
do with how long does it take to encode

1585
01:11:01,199 --> 01:11:06,480
a sequence um which is usually faster

1586
01:11:04,960 --> 01:11:09,080
than how long does it take to generate a

1587
01:11:06,480 --> 01:11:11,360
sequence so this will have to do with

1588
01:11:09,080 --> 01:11:13,000
like encoding time this will require

1589
01:11:11,360 --> 01:11:15,880
encoding time of course but it will also

1590
01:11:13,000 --> 01:11:15,880
require generation

1591
01:11:16,280 --> 01:11:21,840
time also throughput so you know how

1592
01:11:19,239 --> 01:11:23,679
much um how many sentences can you

1593
01:11:21,840 --> 01:11:25,400
process in a certain amount of time so

1594
01:11:23,679 --> 01:11:26,480
of these are kind of desad that you you

1595
01:11:25,400 --> 01:11:29,000
would

1596
01:11:26,480 --> 01:11:30,280
say um we're going to be talking about

1597
01:11:29,000 --> 01:11:31,920
this more in the distillation and

1598
01:11:30,280 --> 01:11:33,199
compression and generation algorithms

1599
01:11:31,920 --> 01:11:35,640
classes so I won't go into a whole lot

1600
01:11:33,199 --> 01:11:36,840
of detail about this but um it's just

1601
01:11:35,640 --> 01:11:39,960
another thing that we want to be

1602
01:11:36,840 --> 01:11:43,560
thinking about in addition to

1603
01:11:39,960 --> 01:11:45,360
complexity um but since I'm I'm on the

1604
01:11:43,560 --> 01:11:47,800
topic of efficiency I would like to talk

1605
01:11:45,360 --> 01:11:49,480
just a little bit about it um in terms

1606
01:11:47,800 --> 01:11:51,000
of especially things that will be useful

1607
01:11:49,480 --> 01:11:53,600
for implementing your first

1608
01:11:51,000 --> 01:11:55,840
assignment and uh one thing that every

1609
01:11:53,600 --> 01:11:58,639
body should know about um if you've done

1610
01:11:55,840 --> 01:11:59,920
any like deep learning with pytorch or

1611
01:11:58,639 --> 01:12:02,639
something like this you already know

1612
01:11:59,920 --> 01:12:05,880
about this probably but uh I think it's

1613
01:12:02,639 --> 01:12:08,760
worth mentioning but basically mini

1614
01:12:05,880 --> 01:12:12,120
batching or batching uh is uh very

1615
01:12:08,760 --> 01:12:15,320
useful and the basic idea behind it is

1616
01:12:12,120 --> 01:12:17,560
that on Modern Hardware if you do many

1617
01:12:15,320 --> 01:12:20,520
of the same operations at once it's much

1618
01:12:17,560 --> 01:12:24,320
faster than doing um

1619
01:12:20,520 --> 01:12:25,480
like uh operations executively and

1620
01:12:24,320 --> 01:12:27,280
that's especially the case if you're

1621
01:12:25,480 --> 01:12:30,520
programming in an extremely slow

1622
01:12:27,280 --> 01:12:33,239
programming language like python um I

1623
01:12:30,520 --> 01:12:37,239
love python but it's slow I mean like

1624
01:12:33,239 --> 01:12:38,719
there's no argument about that um and so

1625
01:12:37,239 --> 01:12:40,520
what mini batching does is it combines

1626
01:12:38,719 --> 01:12:43,600
together smaller operations into one big

1627
01:12:40,520 --> 01:12:47,480
one and the basic idea uh for example if

1628
01:12:43,600 --> 01:12:51,679
we want to calculate our um our linear

1629
01:12:47,480 --> 01:12:56,560
layer with a t uh nonlinearity after it

1630
01:12:51,679 --> 01:12:59,760
we will take several inputs X1 X2 X3

1631
01:12:56,560 --> 01:13:02,040
concatenate them together and do a

1632
01:12:59,760 --> 01:13:04,600
Matrix Matrix multiply instead of doing

1633
01:13:02,040 --> 01:13:07,960
three Vector Matrix

1634
01:13:04,600 --> 01:13:09,239
multiplies and so what we do is we take

1635
01:13:07,960 --> 01:13:11,280
a whole bunch of examples we take like

1636
01:13:09,239 --> 01:13:13,840
64 examples or something like that and

1637
01:13:11,280 --> 01:13:18,000
we combine them together and calculate

1638
01:13:13,840 --> 01:13:21,280
out thingsit one thing to know is that

1639
01:13:18,000 --> 01:13:22,560
if you're working with sentences there's

1640
01:13:21,280 --> 01:13:24,719
different ways you can calculate the

1641
01:13:22,560 --> 01:13:27,360
size of your mini

1642
01:13:24,719 --> 01:13:28,880
normally nowadays the thing that people

1643
01:13:27,360 --> 01:13:30,400
do and the thing that I recommend is to

1644
01:13:28,880 --> 01:13:31,679
calculate the size of your mini batches

1645
01:13:30,400 --> 01:13:33,639
based on the number of tokens in the

1646
01:13:31,679 --> 01:13:35,840
mini batch it used to be that you would

1647
01:13:33,639 --> 01:13:39,719
do it based on the number of sequences

1648
01:13:35,840 --> 01:13:43,800
but the the problem is um one like 50

1649
01:13:39,719 --> 01:13:47,120
sequences of length like 100 is much

1650
01:13:43,800 --> 01:13:49,480
more memory intensive than uh 50

1651
01:13:47,120 --> 01:13:51,960
sequences of Link five and so you get

1652
01:13:49,480 --> 01:13:53,920
these vastly varying these mini batches

1653
01:13:51,960 --> 01:13:57,000
of vastly varying size and that's both

1654
01:13:53,920 --> 01:13:59,800
bad for you know memory overflows and

1655
01:13:57,000 --> 01:14:01,639
bad for um and bad for learning

1656
01:13:59,800 --> 01:14:04,280
stability so I I definitely recommend

1657
01:14:01,639 --> 01:14:06,880
doing it based on the number of

1658
01:14:04,280 --> 01:14:09,080
comps uh another thing is gpus versus

1659
01:14:06,880 --> 01:14:12,400
CPUs so

1660
01:14:09,080 --> 01:14:14,600
um uh CPUs one way you can think of it

1661
01:14:12,400 --> 01:14:17,320
is a CPUs kind of like a motorcycle it's

1662
01:14:14,600 --> 01:14:19,600
very fast at picking up and doing a

1663
01:14:17,320 --> 01:14:23,960
bunch of uh things very quickly

1664
01:14:19,600 --> 01:14:26,600
accelerating uh into starting new uh new

1665
01:14:23,960 --> 01:14:28,760
tasks a GPU is more like an airplane

1666
01:14:26,600 --> 01:14:30,719
which uh you wait forever in line in

1667
01:14:28,760 --> 01:14:33,360
security and

1668
01:14:30,719 --> 01:14:34,800
then and then uh it takes a long time to

1669
01:14:33,360 --> 01:14:40,400
get off the ground and start working but

1670
01:14:34,800 --> 01:14:43,679
once it does it's extremely fast um and

1671
01:14:40,400 --> 01:14:45,360
so if we do a simple example of how long

1672
01:14:43,679 --> 01:14:47,600
does it take to do a Matrix Matrix

1673
01:14:45,360 --> 01:14:49,040
multiply I calculated this a really long

1674
01:14:47,600 --> 01:14:51,280
time ago it's probably horribly out of

1675
01:14:49,040 --> 01:14:55,120
date now but the same general principle

1676
01:14:51,280 --> 01:14:56,560
stands which is if we have have um the

1677
01:14:55,120 --> 01:14:58,480
number of seconds that it takes to do a

1678
01:14:56,560 --> 01:15:02,080
Matrix Matrix multiply doing one of size

1679
01:14:58,480 --> 01:15:03,920
16 is actually faster on CPU because uh

1680
01:15:02,080 --> 01:15:07,760
the overhead it takes to get started is

1681
01:15:03,920 --> 01:15:10,880
very low but if you um once you start

1682
01:15:07,760 --> 01:15:13,360
getting up to size like 128 by 128

1683
01:15:10,880 --> 01:15:15,800
Matrix multiplies then doing it on GPU

1684
01:15:13,360 --> 01:15:17,320
is faster and then um it's you know a

1685
01:15:15,800 --> 01:15:19,679
100 times faster once you start getting

1686
01:15:17,320 --> 01:15:21,600
up to very large matrices so um if

1687
01:15:19,679 --> 01:15:24,000
you're dealing with very large networks

1688
01:15:21,600 --> 01:15:26,800
handling a GPU is good

1689
01:15:24,000 --> 01:15:30,159
um and this is the the speed up

1690
01:15:26,800 --> 01:15:31,440
percentage um one thing I should mention

1691
01:15:30,159 --> 01:15:34,239
is

1692
01:15:31,440 --> 01:15:36,440
um compute with respect to like doing

1693
01:15:34,239 --> 01:15:39,800
the assignments for this class if you

1694
01:15:36,440 --> 01:15:43,199
have a relatively recent Mac you're kind

1695
01:15:39,800 --> 01:15:44,760
of in luck because actually the gpus on

1696
01:15:43,199 --> 01:15:47,239
the Mac are pretty fast and they're well

1697
01:15:44,760 --> 01:15:48,960
integrated with um they're well

1698
01:15:47,239 --> 01:15:52,080
integrated with pipor and other things

1699
01:15:48,960 --> 01:15:53,440
like that so decently sized models maybe

1700
01:15:52,080 --> 01:15:54,840
up to the size that you would need to

1701
01:15:53,440 --> 01:15:57,840
run for assignment one or even

1702
01:15:54,840 --> 01:16:00,880
assignment two might uh just run on your

1703
01:15:57,840 --> 01:16:03,639
uh laptop computer um if you don't have

1704
01:16:00,880 --> 01:16:05,280
a GPU uh that you have immediately

1705
01:16:03,639 --> 01:16:06,760
accessible to you I we're going to

1706
01:16:05,280 --> 01:16:08,400
recommend that you use collab where you

1707
01:16:06,760 --> 01:16:10,120
can get a GPU uh for the first

1708
01:16:08,400 --> 01:16:12,440
assignments and then we'll have plug

1709
01:16:10,120 --> 01:16:15,159
reddits that you can use otherwise but

1710
01:16:12,440 --> 01:16:16,800
um GPU is usually like something that

1711
01:16:15,159 --> 01:16:18,440
you can get on the cloud or one that you

1712
01:16:16,800 --> 01:16:21,080
have on your Mac or one that you have on

1713
01:16:18,440 --> 01:16:24,600
your gaming computer or something like

1714
01:16:21,080 --> 01:16:26,040
that um there's a few speed tricks that

1715
01:16:24,600 --> 01:16:30,000
you should know for efficient GPU

1716
01:16:26,040 --> 01:16:32,480
operations so um one mistake that people

1717
01:16:30,000 --> 01:16:35,880
make when creating models is they repeat

1718
01:16:32,480 --> 01:16:38,080
operations over and over again and um

1719
01:16:35,880 --> 01:16:40,600
you don't want to be doing this so like

1720
01:16:38,080 --> 01:16:43,239
for example um this is multiplying a

1721
01:16:40,600 --> 01:16:45,320
matrix by a constant multiple times and

1722
01:16:43,239 --> 01:16:46,880
if you're just using out of thee box pie

1723
01:16:45,320 --> 01:16:49,280
torch this would be really bad because

1724
01:16:46,880 --> 01:16:50,400
you'd be repeating the operation uh when

1725
01:16:49,280 --> 01:16:52,679
it's not

1726
01:16:50,400 --> 01:16:54,480
necessary um you can also reduce the

1727
01:16:52,679 --> 01:16:57,360
number of operations that you need to

1728
01:16:54,480 --> 01:17:00,320
use so uh use Matrix Matrix multiplies

1729
01:16:57,360 --> 01:17:03,080
instead of Matrix Vector

1730
01:17:00,320 --> 01:17:07,920
multiplies and another thing is uh

1731
01:17:03,080 --> 01:17:10,719
reducing CPU GPU data movement and um so

1732
01:17:07,920 --> 01:17:12,360
when you do try to move memory um when

1733
01:17:10,719 --> 01:17:17,080
you do try to move memory try to do it

1734
01:17:12,360 --> 01:17:20,040
as early as possible and as uh and as

1735
01:17:17,080 --> 01:17:22,199
few times as possible and the reason why

1736
01:17:20,040 --> 01:17:24,199
you want to move things early or start

1737
01:17:22,199 --> 01:17:25,920
operations early is many GPU operations

1738
01:17:24,199 --> 01:17:27,159
are asynchronous so you can start the

1739
01:17:25,920 --> 01:17:28,800
operation and it will run in the

1740
01:17:27,159 --> 01:17:33,120
background while other things are

1741
01:17:28,800 --> 01:17:36,080
processing so um it's a good idea to try

1742
01:17:33,120 --> 01:17:39,840
to um to optimize and you can also use

1743
01:17:36,080 --> 01:17:42,360
your python profiler or um envidia GPU

1744
01:17:39,840 --> 01:17:43,679
profilers to try to optimize these

1745
01:17:42,360 --> 01:17:46,520
things as

1746
01:17:43,679 --> 01:17:49,840
well cool that's all I have uh we're

1747
01:17:46,520 --> 01:17:49,840
right at time