File size: 137,338 Bytes
2ffb90d |
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 |
WEBVTT
00:00:00.399 --> 00:00:04.720
great um yeah so today we're going to be
00:00:03.320 --> 00:00:07.040
talking a little bit about generation
00:00:04.720 --> 00:00:08.639
algorithms um this will be sort of a
00:00:07.040 --> 00:00:10.160
tour through some of the most common
00:00:08.639 --> 00:00:12.080
methods and we're going to talk a little
00:00:10.160 --> 00:00:13.480
bit about the theory behind them as well
00:00:12.080 --> 00:00:15.080
um if you're looking at the slides on
00:00:13.480 --> 00:00:18.359
the website these might be ever so
00:00:15.080 --> 00:00:20.000
slightly different um but yeah I'll try
00:00:18.359 --> 00:00:21.640
to stop at each section boundary for
00:00:20.000 --> 00:00:23.840
questions also feel free to sort of
00:00:21.640 --> 00:00:25.720
interrupt at any point for
00:00:23.840 --> 00:00:27.720
clarifications so we're starting off
00:00:25.720 --> 00:00:29.560
today with some great news um let's say
00:00:27.720 --> 00:00:31.199
that you have some friend who maybe owns
00:00:29.560 --> 00:00:34.800
a giant tech company and they've gifted
00:00:31.199 --> 00:00:36.480
you this absolutely massive new model M
00:00:34.800 --> 00:00:38.079
um it's a great model it's pre-trained
00:00:36.480 --> 00:00:40.879
with the latest architecture it's
00:00:38.079 --> 00:00:42.920
pre-trained on um trillions of tokens of
00:00:40.879 --> 00:00:44.520
text it's got seven billion parameters
00:00:42.920 --> 00:00:46.399
it looks like a really promising new
00:00:44.520 --> 00:00:48.399
model you know it's the top of all these
00:00:46.399 --> 00:00:50.320
leaderboards um but if you actually take
00:00:48.399 --> 00:00:52.520
your new model M and you sort of open up
00:00:50.320 --> 00:00:53.719
this box and kind of Shake It Out maybe
00:00:52.520 --> 00:00:55.239
from last class you know a little bit
00:00:53.719 --> 00:00:57.000
architecturally what this model might
00:00:55.239 --> 00:00:58.239
look like but if you actually kind of
00:00:57.000 --> 00:01:00.320
take a closer look at it from a
00:00:58.239 --> 00:01:01.719
different angle what you see is that m
00:01:00.320 --> 00:01:04.920
is actually just a conditional
00:01:01.719 --> 00:01:07.200
probability distribution um you put some
00:01:04.920 --> 00:01:09.680
input X into your model and you get some
00:01:07.200 --> 00:01:10.680
probability out for any given sequence
00:01:09.680 --> 00:01:13.360
that you're sort of interested in
00:01:10.680 --> 00:01:14.960
evaluating right um and in particular M
00:01:13.360 --> 00:01:17.560
gives you a probability distribution
00:01:14.960 --> 00:01:19.439
over all tokens in its vocabulary to
00:01:17.560 --> 00:01:21.040
predict like what token you would output
00:01:19.439 --> 00:01:24.840
next right and so this is what this
00:01:21.040 --> 00:01:26.880
equation says um given some input X and
00:01:24.840 --> 00:01:29.520
everything that you've predicted so far
00:01:26.880 --> 00:01:32.399
you get the probability of the next
00:01:29.520 --> 00:01:33.600
token in YJ and if you multiply this out
00:01:32.399 --> 00:01:34.840
over all the probabilities in your
00:01:33.600 --> 00:01:37.159
sequence you can calculate the
00:01:34.840 --> 00:01:41.240
probability of any output y given your
00:01:37.159 --> 00:01:42.640
input X so what this like super fancy
00:01:41.240 --> 00:01:44.119
model that you spend a lot of money to
00:01:42.640 --> 00:01:46.280
train is really just a conditional
00:01:44.119 --> 00:01:47.920
probability distribution um but this
00:01:46.280 --> 00:01:49.600
turns out to be okay because you can use
00:01:47.920 --> 00:01:51.920
a conditional probability distribution
00:01:49.600 --> 00:01:54.399
to do sort of any task that we're really
00:01:51.920 --> 00:01:56.719
interested in in NLP um pretty much any
00:01:54.399 --> 00:01:58.680
task right so by changing what you
00:01:56.719 --> 00:02:01.360
consider your input X and your output y
00:01:58.680 --> 00:02:03.560
to be you can can get outputs from this
00:02:01.360 --> 00:02:06.479
model for things like translation for
00:02:03.560 --> 00:02:08.720
summarization for reasoning Tas um just
00:02:06.479 --> 00:02:10.520
by sort of changing what you consider
00:02:08.720 --> 00:02:12.760
your inputs and outputs in this
00:02:10.520 --> 00:02:14.239
setting but there's sort of both good
00:02:12.760 --> 00:02:15.920
and bad things about your model being a
00:02:14.239 --> 00:02:17.120
probability distribution instead of just
00:02:15.920 --> 00:02:20.599
an oracle that gives you sort of a
00:02:17.120 --> 00:02:22.080
single answer for every input um one
00:02:20.599 --> 00:02:24.480
kind of nice thing about this
00:02:22.080 --> 00:02:26.080
distribution um is that you can get at
00:02:24.480 --> 00:02:27.720
an idea of something like confidence
00:02:26.080 --> 00:02:30.120
right if you give your model the input 2
00:02:27.720 --> 00:02:32.480
plus 2 equals and almost all the
00:02:30.120 --> 00:02:34.200
probability mass is on the token of four
00:02:32.480 --> 00:02:35.760
you can say like the model predicts with
00:02:34.200 --> 00:02:38.319
pretty high confidence that 2 plus 2
00:02:35.760 --> 00:02:39.480
equals four um versus if you give it
00:02:38.319 --> 00:02:40.959
something that's maybe a little more
00:02:39.480 --> 00:02:43.120
open-ended like you ask it to predict
00:02:40.959 --> 00:02:44.640
Graham's favorite color and you see this
00:02:43.120 --> 00:02:47.040
distribution that's sort of a lot
00:02:44.640 --> 00:02:48.440
flatter you know the most likely output
00:02:47.040 --> 00:02:49.720
is green but maybe we don't have a lot
00:02:48.440 --> 00:02:51.560
of confidence that that's the correct
00:02:49.720 --> 00:02:53.040
answer um this is really closely tied
00:02:51.560 --> 00:02:55.200
into the idea of calibration which you
00:02:53.040 --> 00:02:58.879
guys talked about um I guess a couple of
00:02:55.200 --> 00:03:00.640
classes ago now the flip side of this
00:02:58.879 --> 00:03:03.680
though is that you know Noti that for
00:03:00.640 --> 00:03:06.760
this case like 2 plus 2al 4 not all of
00:03:03.680 --> 00:03:08.519
the probability mass is on four um and
00:03:06.760 --> 00:03:09.720
so models that are conditional
00:03:08.519 --> 00:03:11.560
probability distributions can
00:03:09.720 --> 00:03:13.560
hallucinate right um pretty much no
00:03:11.560 --> 00:03:15.799
matter what you do there's going to be
00:03:13.560 --> 00:03:17.680
some nonzero probability to some output
00:03:15.799 --> 00:03:19.920
that's incorrect or
00:03:17.680 --> 00:03:21.239
undesirable um in some cases maybe even
00:03:19.920 --> 00:03:23.760
offensive something that you don't want
00:03:21.239 --> 00:03:25.280
the model to Output um and this is sort
00:03:23.760 --> 00:03:27.840
of an artifact of the way these models
00:03:25.280 --> 00:03:29.280
are trained if there's some great work
00:03:27.840 --> 00:03:31.400
kind of more on the theory side here
00:03:29.280 --> 00:03:32.840
that shows that this is actually true
00:03:31.400 --> 00:03:35.120
even if everything in your input
00:03:32.840 --> 00:03:36.920
training data is sort of correct and
00:03:35.120 --> 00:03:38.439
factual and doesn't have any errors
00:03:36.920 --> 00:03:41.200
you'll still wind up with a situation
00:03:38.439 --> 00:03:44.480
where some nonzero probability mass is
00:03:41.200 --> 00:03:47.000
on some outputs that are undesirable or
00:03:44.480 --> 00:03:50.120
hallucinatory for sort of most inputs
00:03:47.000 --> 00:03:52.159
that you care about evaluating so if we
00:03:50.120 --> 00:03:55.079
have these issues how do we actually get
00:03:52.159 --> 00:03:56.519
a good output out of the model um and to
00:03:55.079 --> 00:03:58.640
do that we're first going to talk about
00:03:56.519 --> 00:04:00.079
some sampling methods um but I want to
00:03:58.640 --> 00:04:01.879
pause here in case there are of any
00:04:00.079 --> 00:04:04.159
questions on this idea of a model is a
00:04:01.879 --> 00:04:04.159
conditional
00:04:05.040 --> 00:04:11.680
distribution great so we can jump right
00:04:07.519 --> 00:04:13.560
in so we have this model right we know
00:04:11.680 --> 00:04:15.959
at each step at each token we might want
00:04:13.560 --> 00:04:17.919
to decode the distribution of likelihood
00:04:15.959 --> 00:04:18.959
over all vocabulary tokens right this
00:04:17.919 --> 00:04:21.680
conditional distribution we've been
00:04:18.959 --> 00:04:24.240
talking about um for the next time step
00:04:21.680 --> 00:04:26.400
and what we want out of this is a good
00:04:24.240 --> 00:04:28.000
output um for some definition of good
00:04:26.400 --> 00:04:30.919
that we can sort of develop as we go
00:04:28.000 --> 00:04:32.479
here so maybe the natural first thing to
00:04:30.919 --> 00:04:34.880
try is we have a probability
00:04:32.479 --> 00:04:36.600
distribution can we just sample from it
00:04:34.880 --> 00:04:39.600
right and this is something called
00:04:36.600 --> 00:04:41.639
ancestral sampling so at each time step
00:04:39.600 --> 00:04:43.560
we're going to draw a token from this
00:04:41.639 --> 00:04:45.039
distribution sort of according to its
00:04:43.560 --> 00:04:47.199
relative probability right so if
00:04:45.039 --> 00:04:48.639
something has twice as much probability
00:04:47.199 --> 00:04:51.280
Mass according to the model we'll draw
00:04:48.639 --> 00:04:54.000
it twice as often um and we can sample
00:04:51.280 --> 00:04:55.560
from this distribution at each time step
00:04:54.000 --> 00:04:58.080
and this is sort of this is sort of a
00:04:55.560 --> 00:05:00.199
nice setup um we get exact samples from
00:04:58.080 --> 00:05:02.639
the model distribution so using the
00:05:00.199 --> 00:05:04.479
setup if you can you imagine like
00:05:02.639 --> 00:05:06.680
drawing an almost infinite number of
00:05:04.479 --> 00:05:08.320
samples like a ridiculously large number
00:05:06.680 --> 00:05:10.160
and you look at their probabilities
00:05:08.320 --> 00:05:11.840
you'd sort of get something from this
00:05:10.160 --> 00:05:13.039
distribution with exactly the
00:05:11.840 --> 00:05:15.720
probability that the real model
00:05:13.039 --> 00:05:17.280
distribution is given you um so this is
00:05:15.720 --> 00:05:19.039
great this gives us an exact sample from
00:05:17.280 --> 00:05:21.400
the model this seems to be exactly what
00:05:19.039 --> 00:05:22.880
we want um but you can guess probably by
00:05:21.400 --> 00:05:24.639
the fact that we're only like 10 minutes
00:05:22.880 --> 00:05:27.000
into class here this is not really the
00:05:24.639 --> 00:05:28.280
end of the story um and there's actually
00:05:27.000 --> 00:05:30.800
a couple of problems with sampling
00:05:28.280 --> 00:05:32.560
directly from our model distribu
00:05:30.800 --> 00:05:35.280
the one that we're really going to focus
00:05:32.560 --> 00:05:37.919
on first here is this idea of a long
00:05:35.280 --> 00:05:41.400
tail so a model like llama and maybe our
00:05:37.919 --> 00:05:43.639
new model M um has 32,000 vocabulary
00:05:41.400 --> 00:05:46.280
tokens and you can imagine maybe out of
00:05:43.639 --> 00:05:48.000
those tokens there might be one or even
00:05:46.280 --> 00:05:49.720
2,000 of those tokens that are sort of a
00:05:48.000 --> 00:05:51.919
reasonable next thing to predict for a
00:05:49.720 --> 00:05:53.479
really open-ended task right but there's
00:05:51.919 --> 00:05:55.440
going to be all kinds of things in that
00:05:53.479 --> 00:05:57.039
distribution um that are maybe like
00:05:55.440 --> 00:05:58.440
punctuation there maybe tokens that
00:05:57.039 --> 00:06:00.280
won't actually lead to the correct
00:05:58.440 --> 00:06:01.840
answer like there's a lot of things in
00:06:00.280 --> 00:06:04.560
this distribution that would be all
00:06:01.840 --> 00:06:06.160
really low likelihood and this is fine
00:06:04.560 --> 00:06:08.759
these things just get low probability
00:06:06.160 --> 00:06:11.039
Mass but the problem is if you give sort
00:06:08.759 --> 00:06:13.639
of a small amount of probability Mass to
00:06:11.039 --> 00:06:16.599
30,000 different things that mass will
00:06:13.639 --> 00:06:19.360
add up pretty quickly um and to see this
00:06:16.599 --> 00:06:20.360
we have sort of this illustration here
00:06:19.360 --> 00:06:21.560
um I don't know if you can see the
00:06:20.360 --> 00:06:23.280
difference between the green and the
00:06:21.560 --> 00:06:25.720
yellow but I've also drawn a little bar
00:06:23.280 --> 00:06:27.800
between them this is a really longtailed
00:06:25.720 --> 00:06:29.720
distribution and the green part of the
00:06:27.800 --> 00:06:31.960
distribution which is a lot of tokens
00:06:29.720 --> 00:06:34.000
with high likelihood has 50% of the
00:06:31.960 --> 00:06:35.560
total probability the Yellow Part which
00:06:34.000 --> 00:06:37.360
is all a lot of things that are all
00:06:35.560 --> 00:06:40.280
individually not super likely is the
00:06:37.360 --> 00:06:41.720
other 50% of the probability and so what
00:06:40.280 --> 00:06:44.360
that means is if you're doing something
00:06:41.720 --> 00:06:46.120
like ancestral sampling 50% of the time
00:06:44.360 --> 00:06:49.160
you'll be sampling something really
00:06:46.120 --> 00:06:51.520
unlikely from this long tail um that
00:06:49.160 --> 00:06:53.759
seems sort of not like what we want
00:06:51.520 --> 00:06:56.080
right um so is there anything we can do
00:06:53.759 --> 00:06:58.080
about this and the obvious for solution
00:06:56.080 --> 00:06:59.400
here is can we just cut off that tail
00:06:58.080 --> 00:07:01.680
like if we know these tokens are not
00:06:59.400 --> 00:07:03.039
super likely can we just ignore them and
00:07:01.680 --> 00:07:05.039
there's a couple of different ways to do
00:07:03.039 --> 00:07:07.919
that um the first of these is something
00:07:05.039 --> 00:07:10.080
called topk sampling where we say okay
00:07:07.919 --> 00:07:12.479
you know maybe we think there are 10
00:07:10.080 --> 00:07:14.000
reasonable like outputs is right maybe
00:07:12.479 --> 00:07:17.280
we'll just sample from the 10 most
00:07:14.000 --> 00:07:19.759
probable tokens um here maybe we say if
00:07:17.280 --> 00:07:21.479
we want to pick top six sampling we'll
00:07:19.759 --> 00:07:23.919
sample from just the six most probable
00:07:21.479 --> 00:07:26.240
tokens and so in this example you can
00:07:23.919 --> 00:07:27.680
see we originally had 10 tokens and
00:07:26.240 --> 00:07:30.560
we're going to sample from just the blue
00:07:27.680 --> 00:07:32.919
ones just the six most likely tokens
00:07:30.560 --> 00:07:34.360
um in this example this distribution is
00:07:32.919 --> 00:07:37.280
pretty flat there's a lot of things that
00:07:34.360 --> 00:07:40.120
are like kind of likely right so that
00:07:37.280 --> 00:07:43.000
those six tokens are only 68% of the
00:07:40.120 --> 00:07:45.360
total probability Mass um if we go like
00:07:43.000 --> 00:07:47.240
one time step further here we might have
00:07:45.360 --> 00:07:49.360
a distribution that's a lot peier most
00:07:47.240 --> 00:07:51.759
of the mass is on just a single token
00:07:49.360 --> 00:07:53.919
and so sampling from just the top six
00:07:51.759 --> 00:07:56.400
tokens actually captures 99% of the
00:07:53.919 --> 00:07:58.360
probability mes maybe we say that seems
00:07:56.400 --> 00:08:01.199
a little excessive right we don't really
00:07:58.360 --> 00:08:03.400
need um maybe all of these tokens that
00:08:01.199 --> 00:08:05.479
are all kind of low probability maybe we
00:08:03.400 --> 00:08:07.000
just want to sort of sample from the top
00:08:05.479 --> 00:08:08.080
half of our distribution or something or
00:08:07.000 --> 00:08:10.840
the top
00:08:08.080 --> 00:08:12.919
90% um so instead of choosing a top
00:08:10.840 --> 00:08:15.560
number of tokens to sample from you
00:08:12.919 --> 00:08:17.400
could choose a top amount of probability
00:08:15.560 --> 00:08:20.000
and this is something called top P or
00:08:17.400 --> 00:08:21.520
nucleus sampling so P here is the amount
00:08:20.000 --> 00:08:24.039
of probability from your distribution
00:08:21.520 --> 00:08:26.639
you want to consider so if you decide
00:08:24.039 --> 00:08:29.280
your p is about like 94% of the
00:08:26.639 --> 00:08:31.639
probability Mass you in this first examp
00:08:29.280 --> 00:08:33.719
example here would choose almost all of
00:08:31.639 --> 00:08:35.440
the tokens you keep adding tokens in
00:08:33.719 --> 00:08:37.159
until you reach an amount of total
00:08:35.440 --> 00:08:39.479
probability that's about
00:08:37.159 --> 00:08:40.880
094 but then when you get to the Second
00:08:39.479 --> 00:08:43.240
Step where you have a couple of really
00:08:40.880 --> 00:08:45.959
highly probable tokens you'd only need a
00:08:43.240 --> 00:08:47.959
couple of tokens to add up to 094 or
00:08:45.959 --> 00:08:50.320
even higher than 0.94 and so you would
00:08:47.959 --> 00:08:52.200
just sample from a smaller set of tokens
00:08:50.320 --> 00:08:54.600
so in top K sampling the total amount of
00:08:52.200 --> 00:08:56.560
probability your sampling from can move
00:08:54.600 --> 00:08:58.120
around in top P sampling the total
00:08:56.560 --> 00:08:59.839
number of tokens you're sampling from
00:08:58.120 --> 00:09:01.959
might change
00:08:59.839 --> 00:09:04.760
um but maybe we sort of don't want to
00:09:01.959 --> 00:09:07.279
impose a strong constraint like we want
00:09:04.760 --> 00:09:09.279
like 94% here maybe just what we really
00:09:07.279 --> 00:09:11.040
care about is saying that we're not
00:09:09.279 --> 00:09:14.000
going to sample anything that's really
00:09:11.040 --> 00:09:16.800
really unlikely right another way of
00:09:14.000 --> 00:09:18.560
doing this is called Epsilon sampling
00:09:16.800 --> 00:09:20.519
where we just sample tokens that have at
00:09:18.560 --> 00:09:22.920
least some minimum amount of probability
00:09:20.519 --> 00:09:24.720
to them right so maybe we just want
00:09:22.920 --> 00:09:29.519
tokens that have probability of at least
00:09:24.720 --> 00:09:31.240
0.05 here um in this first um example
00:09:29.519 --> 00:09:32.640
everything has at least some reasonable
00:09:31.240 --> 00:09:34.240
amount of probability so we're actually
00:09:32.640 --> 00:09:36.240
going to sample from our full
00:09:34.240 --> 00:09:37.720
distribution and then in the second
00:09:36.240 --> 00:09:39.279
example when we have a lot of things
00:09:37.720 --> 00:09:41.160
that are really unlikely we'll only
00:09:39.279 --> 00:09:43.800
sample from sort of the more likely part
00:09:41.160 --> 00:09:45.240
of the distribution um so all three of
00:09:43.800 --> 00:09:47.000
these methods are sort of different ways
00:09:45.240 --> 00:09:49.399
of trying to cut off the long tail using
00:09:47.000 --> 00:09:51.480
sort of different
00:09:49.399 --> 00:09:53.000
characteristics the tail of the
00:09:51.480 --> 00:09:55.680
distribution though isn't the only thing
00:09:53.000 --> 00:09:58.000
we could choose to modify um we could
00:09:55.680 --> 00:09:59.880
also choose to modify this sort of
00:09:58.000 --> 00:10:02.120
peakiness of the distribution
00:09:59.880 --> 00:10:03.880
so if you look here at the middle of
00:10:02.120 --> 00:10:06.600
these diagrams say this is your original
00:10:03.880 --> 00:10:08.519
distribution over next tokens and maybe
00:10:06.600 --> 00:10:11.040
you want to modify some properties of
00:10:08.519 --> 00:10:12.640
this distribution like you say I want an
00:10:11.040 --> 00:10:14.200
output that's really diverse and
00:10:12.640 --> 00:10:15.680
interesting and open-ended like maybe
00:10:14.200 --> 00:10:17.920
this is something like story generation
00:10:15.680 --> 00:10:20.120
where you want to have sort of a lot of
00:10:17.920 --> 00:10:21.279
maybe surprising things in your output
00:10:20.120 --> 00:10:23.480
you could say I want to sort of
00:10:21.279 --> 00:10:26.440
distribute my probability Mass more over
00:10:23.480 --> 00:10:28.399
the token space and you can do this um
00:10:26.440 --> 00:10:32.720
by sort of flattening this distribution
00:10:28.399 --> 00:10:34.240
like you see on the the right here um
00:10:32.720 --> 00:10:36.800
where now there's sort of more
00:10:34.240 --> 00:10:39.040
probability Mass spread over this um
00:10:36.800 --> 00:10:40.320
like wider set of tokens you could also
00:10:39.040 --> 00:10:42.720
say the opposite right you could say
00:10:40.320 --> 00:10:44.120
maybe I'm doing something like math
00:10:42.720 --> 00:10:45.519
where there shouldn't really be a lot of
00:10:44.120 --> 00:10:47.800
correct answers there should be really
00:10:45.519 --> 00:10:50.399
only one or maybe only like a few
00:10:47.800 --> 00:10:52.320
potential reasonable next answers and so
00:10:50.399 --> 00:10:54.160
you can make your distribution peier or
00:10:52.320 --> 00:10:56.639
sharper so that more of the probability
00:10:54.160 --> 00:11:00.200
mass is on the things at the very top um
00:10:56.639 --> 00:11:02.000
the way you do this is you modify y your
00:11:00.200 --> 00:11:04.320
loges your outputs of the last layer of
00:11:02.000 --> 00:11:06.399
the model before you apply softn so when
00:11:04.320 --> 00:11:08.360
you're predicting you get your outputs
00:11:06.399 --> 00:11:10.040
of the last layer of the model and then
00:11:08.360 --> 00:11:11.560
you apply softmax which turns those
00:11:10.040 --> 00:11:15.240
outputs into a distribution right they
00:11:11.560 --> 00:11:17.399
all sum up the um like Mass over all
00:11:15.240 --> 00:11:18.839
vocabulary tokens sums to one and so
00:11:17.399 --> 00:11:21.920
that is sort of a distribution you could
00:11:18.839 --> 00:11:23.519
sample from if you divide those Logics
00:11:21.920 --> 00:11:26.000
by some number before you apply that
00:11:23.519 --> 00:11:27.880
softmax you can make that distribution
00:11:26.000 --> 00:11:30.760
flatter by using a number greater than
00:11:27.880 --> 00:11:32.440
one or peier by using a number less than
00:11:30.760 --> 00:11:35.079
one and this is this type of parameter
00:11:32.440 --> 00:11:36.839
is called temperature um you can apply
00:11:35.079 --> 00:11:38.480
this with any of the other methods for
00:11:36.839 --> 00:11:40.279
sort of cutting off the long tail but
00:11:38.480 --> 00:11:41.920
what people will often do is just apply
00:11:40.279 --> 00:11:43.639
a temperature and then sample from that
00:11:41.920 --> 00:11:45.320
distribution and that's what we call
00:11:43.639 --> 00:11:48.720
temperature
00:11:45.320 --> 00:11:49.920
sampling so these I think most of you
00:11:48.720 --> 00:11:51.320
might already have been at least a
00:11:49.920 --> 00:11:53.000
little bit familiar with some of these
00:11:51.320 --> 00:11:56.079
methods I want to touch briefly on a
00:11:53.000 --> 00:11:58.160
couple of other ideas for modifying this
00:11:56.079 --> 00:11:59.680
distribution maybe some more complex and
00:11:58.160 --> 00:12:01.839
more recent ideas and the one that I
00:11:59.680 --> 00:12:04.279
want to talk about in more detail is
00:12:01.839 --> 00:12:05.399
something called contrastive decoding so
00:12:04.279 --> 00:12:07.360
the idea here is that we could
00:12:05.399 --> 00:12:10.800
incorporate some extra information at
00:12:07.360 --> 00:12:12.760
decoding time um using some other
00:12:10.800 --> 00:12:15.320
distribution some other data or in this
00:12:12.760 --> 00:12:17.320
case some other model so if you've ever
00:12:15.320 --> 00:12:19.240
played around with a really like
00:12:17.320 --> 00:12:21.800
relatively small language model maybe
00:12:19.240 --> 00:12:23.320
something like gbt2 small um You
00:12:21.800 --> 00:12:26.560
probably noticed you try to give it some
00:12:23.320 --> 00:12:28.240
inputs and maybe it degenerates into
00:12:26.560 --> 00:12:30.160
just repeating the same sequence over
00:12:28.240 --> 00:12:31.720
and over maybe it gives you outputs that
00:12:30.160 --> 00:12:33.399
are just completely incorrect like you
00:12:31.720 --> 00:12:35.320
ask it a factual question and it gets it
00:12:33.399 --> 00:12:37.120
wrong um and you don't see those
00:12:35.320 --> 00:12:39.519
problems if you look at sort of a larger
00:12:37.120 --> 00:12:41.399
model that's trained on more data so the
00:12:39.519 --> 00:12:43.199
question here is can you use what that
00:12:41.399 --> 00:12:46.480
smaller model is getting wrong to make
00:12:43.199 --> 00:12:49.120
your larger model even better um and the
00:12:46.480 --> 00:12:51.360
way we do this is by sort of the
00:12:49.120 --> 00:12:52.880
intuition that if the smaller model
00:12:51.360 --> 00:12:55.079
doesn't have a lot of probability on
00:12:52.880 --> 00:12:57.160
some answer but the the larger model
00:12:55.079 --> 00:12:58.519
does it's likely because that larger
00:12:57.160 --> 00:13:02.279
model has learned something with the
00:12:58.519 --> 00:13:04.000
smaller model didn't know and so here we
00:13:02.279 --> 00:13:06.199
modify the probability distribution
00:13:04.000 --> 00:13:08.199
coming out of the larger model to choose
00:13:06.199 --> 00:13:11.120
outputs that that model thinks are very
00:13:08.199 --> 00:13:12.600
likely and the amateur or the the weaker
00:13:11.120 --> 00:13:15.480
model thinks are not
00:13:12.600 --> 00:13:20.000
likely so in this example here from
00:13:15.480 --> 00:13:22.560
their paper um if you have sort of a
00:13:20.000 --> 00:13:27.199
input like Barack Obama was born in
00:13:22.560 --> 00:13:29.720
Hawaii he was born in L um the smaller
00:13:27.199 --> 00:13:31.360
model would often do something like
00:13:29.720 --> 00:13:35.399
start repeating and actually if you
00:13:31.360 --> 00:13:36.720
sample sort of naively from the um
00:13:35.399 --> 00:13:38.560
larger model you can wind up in these
00:13:36.720 --> 00:13:40.000
situations as well right so if you just
00:13:38.560 --> 00:13:41.959
choose the most likely thing at each
00:13:40.000 --> 00:13:43.399
step you wind up in this Loop where it's
00:13:41.959 --> 00:13:45.560
like he was born in Hawaii he was born
00:13:43.399 --> 00:13:48.199
in Hawaii he was born in Hawaii um and
00:13:45.560 --> 00:13:51.320
this is behavior we generally don't want
00:13:48.199 --> 00:13:52.680
um if you do something like nucleus or
00:13:51.320 --> 00:13:53.720
top PE sampling you can wind up with
00:13:52.680 --> 00:13:55.880
things that are actually completely
00:13:53.720 --> 00:13:58.839
incorrect like he was born in Washington
00:13:55.880 --> 00:14:01.480
DC um but if you use contrastive
00:13:58.839 --> 00:14:04.120
decoding you take the outputs coming out
00:14:01.480 --> 00:14:05.720
of your expert model here and you
00:14:04.120 --> 00:14:07.680
subtract out the probabilities coming
00:14:05.720 --> 00:14:10.160
out of the weaker model and you can wind
00:14:07.680 --> 00:14:11.880
up with things that the higher model the
00:14:10.160 --> 00:14:13.759
stronger model ascribed probability to
00:14:11.880 --> 00:14:15.480
but the weaker model did not likely
00:14:13.759 --> 00:14:16.920
because these are sort of facts that the
00:14:15.480 --> 00:14:18.959
larger model knows that the smaller
00:14:16.920 --> 00:14:20.800
model does not so here we actually get
00:14:18.959 --> 00:14:23.199
the year Barack Obama was born which is
00:14:20.800 --> 00:14:25.800
maybe a fact that the larger model knows
00:14:23.199 --> 00:14:27.639
and the smaller model didn't know um and
00:14:25.800 --> 00:14:29.759
so this is just one of sort of a broad
00:14:27.639 --> 00:14:32.560
class of methods where you use external
00:14:29.759 --> 00:14:35.199
information to improve your decoding by
00:14:32.560 --> 00:14:38.720
modifying this distribution at each
00:14:35.199 --> 00:14:40.720
set um those are sort of a brief tour of
00:14:38.720 --> 00:14:43.920
a couple of different sampling methods
00:14:40.720 --> 00:14:43.920
before we move into search
00:14:44.600 --> 00:14:50.440
yeah
00:14:46.279 --> 00:14:54.880
yeah is it going to improve upon just
00:14:50.440 --> 00:14:57.240
the yeah it generally does um and the
00:14:54.880 --> 00:14:59.800
intuition for why this might be I think
00:14:57.240 --> 00:15:01.680
is that there are sort of these
00:14:59.800 --> 00:15:04.560
degenerate cases like just repeating
00:15:01.680 --> 00:15:06.120
over and over that both the expert and
00:15:04.560 --> 00:15:09.000
the weak model would give relatively
00:15:06.120 --> 00:15:10.880
high probability to um maybe the expert
00:15:09.000 --> 00:15:13.199
model is like slightly less likely to do
00:15:10.880 --> 00:15:14.959
these things but it's still like sort of
00:15:13.199 --> 00:15:16.639
an easy case for the model to learn and
00:15:14.959 --> 00:15:18.120
so both of those models will have high
00:15:16.639 --> 00:15:20.079
probability for those things but the
00:15:18.120 --> 00:15:21.800
things that are genuinely like good
00:15:20.079 --> 00:15:23.880
outputs that only the expert would get
00:15:21.800 --> 00:15:25.519
right those will have low probability
00:15:23.880 --> 00:15:27.600
under the weak model and so you're sort
00:15:25.519 --> 00:15:30.880
of subtracting out all the degenerate
00:15:27.600 --> 00:15:33.759
behaviors and keeping to really good out
00:15:30.880 --> 00:15:35.240
this if you're generating a longer
00:15:33.759 --> 00:15:37.440
sequence with with
00:15:35.240 --> 00:15:40.759
contacing how do you know which steps
00:15:37.440 --> 00:15:45.120
you want to bring out yeah this is a
00:15:40.759 --> 00:15:48.560
great question so for this particular
00:15:45.120 --> 00:15:50.560
case oh yeah sorry so this was if you're
00:15:48.560 --> 00:15:52.279
doing contrastive decoding over a really
00:15:50.560 --> 00:15:54.399
long sequence like when do you choose to
00:15:52.279 --> 00:15:55.800
bring in the expert right and for
00:15:54.399 --> 00:15:58.600
contrastive decoding we're actually
00:15:55.800 --> 00:16:00.759
going to do this at every individual
00:15:58.600 --> 00:16:02.440
time step so we're going to use the
00:16:00.759 --> 00:16:04.800
expert model to decode and we're going
00:16:02.440 --> 00:16:07.000
to bring in the amateur to sort of
00:16:04.800 --> 00:16:09.079
subtract out probabilities at each next
00:16:07.000 --> 00:16:10.399
token prediction um you don't have to do
00:16:09.079 --> 00:16:12.800
that I think that's that's what they do
00:16:10.399 --> 00:16:15.000
in the paper um you could also decide to
00:16:12.800 --> 00:16:16.680
only do this sort of if you have high
00:16:15.000 --> 00:16:19.639
uncertainty or something if you don't
00:16:16.680 --> 00:16:22.639
have a really sharp probability
00:16:19.639 --> 00:16:22.639
distribution
00:16:23.160 --> 00:16:28.160
yeah yeah how weak should the weak
00:16:25.399 --> 00:16:30.199
predictor be um in the in the paper what
00:16:28.160 --> 00:16:31.600
they're look at is actually not a huge
00:16:30.199 --> 00:16:34.560
difference between the two models so you
00:16:31.600 --> 00:16:35.800
can see here this is gpd2 XL and small
00:16:34.560 --> 00:16:37.319
so there's a difference in parameter
00:16:35.800 --> 00:16:39.519
counts and like a bit of a difference in
00:16:37.319 --> 00:16:42.160
data I think here but these are actually
00:16:39.519 --> 00:16:44.959
not like gpd2 XL is certainly not like a
00:16:42.160 --> 00:16:48.399
super strong model now um I think they
00:16:44.959 --> 00:16:50.920
try a couple of different settings and
00:16:48.399 --> 00:16:52.319
the general intuition I think if I'm
00:16:50.920 --> 00:16:54.880
remembering it correctly is that you
00:16:52.319 --> 00:16:56.319
want a model that's not like so close in
00:16:54.880 --> 00:16:58.000
performance to your expert that you're
00:16:56.319 --> 00:16:59.839
basically just subtracting out useful
00:16:58.000 --> 00:17:02.240
things but you also don't want a model
00:16:59.839 --> 00:17:03.519
that's like so degenerate that it is not
00:17:02.240 --> 00:17:04.959
hasn't learned anything useful about
00:17:03.519 --> 00:17:06.839
your task at all so I think it might
00:17:04.959 --> 00:17:09.600
depend on what task you're looking
00:17:06.839 --> 00:17:12.919
at
00:17:09.600 --> 00:17:14.559
yes this is for inference um so actually
00:17:12.919 --> 00:17:17.640
everything we look at today will not
00:17:14.559 --> 00:17:17.640
require aning of the
00:17:19.360 --> 00:17:26.559
model Okay cool so now we're going to
00:17:24.000 --> 00:17:30.039
step into sort of a slightly different
00:17:26.559 --> 00:17:31.280
um set of strategies here which is maybe
00:17:30.039 --> 00:17:33.039
we don't just want something from the
00:17:31.280 --> 00:17:35.160
model distribution or something from a
00:17:33.039 --> 00:17:37.760
modified distribution maybe we actually
00:17:35.160 --> 00:17:39.840
just want the quote unquote best thing
00:17:37.760 --> 00:17:42.960
the single most likely output given our
00:17:39.840 --> 00:17:45.200
input right and here this would be the Y
00:17:42.960 --> 00:17:48.039
hat the single sequence that satisfies
00:17:45.200 --> 00:17:51.919
that has the highest score py given X
00:17:48.039 --> 00:17:54.240
for the X that we gave the model um this
00:17:51.919 --> 00:17:56.000
is this section is called mode seeking
00:17:54.240 --> 00:17:58.039
search because this is the mode of the
00:17:56.000 --> 00:18:00.440
distribution over outputs if you sampled
00:17:58.039 --> 00:18:01.760
a huge huge number of times and you
00:18:00.440 --> 00:18:04.720
looked at the single most likely
00:18:01.760 --> 00:18:06.720
sequence you got it would be this y hat
00:18:04.720 --> 00:18:09.280
and so how do we find this
00:18:06.720 --> 00:18:11.600
thing well one idea is we know the
00:18:09.280 --> 00:18:13.159
distribution at each individual setep
00:18:11.600 --> 00:18:16.000
can we just pick the most likely thing
00:18:13.159 --> 00:18:18.960
from that distribution and so in Greedy
00:18:16.000 --> 00:18:21.080
decoding we take the argmax the single
00:18:18.960 --> 00:18:22.720
highest probability token at each step
00:18:21.080 --> 00:18:24.840
and we continue generating until the
00:18:22.720 --> 00:18:26.600
single highest most the single highest
00:18:24.840 --> 00:18:28.840
probability token is the stop token
00:18:26.600 --> 00:18:31.559
right the end of sequence token
00:18:28.840 --> 00:18:33.400
um for an individual token right if we
00:18:31.559 --> 00:18:35.559
only want a single token output this is
00:18:33.400 --> 00:18:38.320
exactly what we want this is the single
00:18:35.559 --> 00:18:40.400
most likely output um and that's great
00:18:38.320 --> 00:18:44.000
but if we're looking at something that
00:18:40.400 --> 00:18:45.120
is maybe several tokens long are we
00:18:44.000 --> 00:18:47.360
actually going to get the highest
00:18:45.120 --> 00:18:49.720
probability thing and if you kind of
00:18:47.360 --> 00:18:52.159
squint at this you can see that maybe we
00:18:49.720 --> 00:18:54.120
have a problem here where the highest
00:18:52.159 --> 00:18:56.320
probability sequence that you get from
00:18:54.120 --> 00:18:58.039
multiplying across multiple steps
00:18:56.320 --> 00:18:59.559
doesn't necessarily start with the token
00:18:58.039 --> 00:19:01.600
that was highest probability at time
00:18:59.559 --> 00:19:03.200
step one right maybe if you're doing
00:19:01.600 --> 00:19:04.720
something like unconditional generation
00:19:03.200 --> 00:19:06.720
the highest probability token at time
00:19:04.720 --> 00:19:08.360
step one is always the but there could
00:19:06.720 --> 00:19:09.919
be a really probable sentence that just
00:19:08.360 --> 00:19:11.480
doesn't happen to start with the the
00:19:09.919 --> 00:19:12.720
word the' and you would never find it
00:19:11.480 --> 00:19:15.080
using GRE
00:19:12.720 --> 00:19:17.360
decoding so this isn't going to give us
00:19:15.080 --> 00:19:19.799
the highest probability output over a
00:19:17.360 --> 00:19:22.000
sequence that's more than one token one
00:19:19.799 --> 00:19:23.360
can we do anything better to try to find
00:19:22.000 --> 00:19:25.640
this um
00:19:23.360 --> 00:19:27.559
output and here we get into sort of one
00:19:25.640 --> 00:19:29.520
of the most popular decoding methods the
00:19:27.559 --> 00:19:32.600
one that you maybe heard of before which
00:19:29.520 --> 00:19:35.080
is beam search the idea here is that we
00:19:32.600 --> 00:19:36.559
don't want to miss a high probability
00:19:35.080 --> 00:19:38.880
token that's hidden behind a lower
00:19:36.559 --> 00:19:40.200
probability prefix so we want to kind of
00:19:38.880 --> 00:19:42.000
search through a couple of different
00:19:40.200 --> 00:19:43.760
options so that we don't discard
00:19:42.000 --> 00:19:47.120
something too early that might have high
00:19:43.760 --> 00:19:49.360
probability um later on in generation
00:19:47.120 --> 00:19:50.919
and this is a type of bread first search
00:19:49.360 --> 00:19:53.200
so we're going to look at a wide variety
00:19:50.919 --> 00:19:54.600
of options at a given time step we're
00:19:53.200 --> 00:19:55.600
going to pick some set of them to
00:19:54.600 --> 00:19:57.120
continue and then we're going to look at
00:19:55.600 --> 00:19:58.919
a wide variety of options for the next
00:19:57.120 --> 00:19:59.960
time step instead of generating all the
00:19:58.919 --> 00:20:02.200
way through a sequence and then
00:19:59.960 --> 00:20:04.320
generating all the way through another
00:20:02.200 --> 00:20:05.760
sequence um and how this works is we're
00:20:04.320 --> 00:20:07.559
going to pick sort of a number of
00:20:05.760 --> 00:20:09.400
candidates we'd like to explore a beam
00:20:07.559 --> 00:20:11.039
with so in this example we're going to
00:20:09.400 --> 00:20:12.799
pick three and we're going to say all
00:20:11.039 --> 00:20:15.480
right here are maybe three options for
00:20:12.799 --> 00:20:17.640
time step one for if we pick each of
00:20:15.480 --> 00:20:19.760
those three options what would be the
00:20:17.640 --> 00:20:21.799
three most likely things for time step
00:20:19.760 --> 00:20:23.200
two right rather than choosing just the
00:20:21.799 --> 00:20:24.520
single most likely thing in Greedy
00:20:23.200 --> 00:20:26.960
decoding we're going to pick three
00:20:24.520 --> 00:20:29.120
options and so now we have three options
00:20:26.960 --> 00:20:32.559
for time step one three options for time
00:20:29.120 --> 00:20:34.280
step two we now have nine options um
00:20:32.559 --> 00:20:36.320
here right three options and then three
00:20:34.280 --> 00:20:37.679
more for each of these and we don't want
00:20:36.320 --> 00:20:40.159
to continue doing this because this is
00:20:37.679 --> 00:20:41.960
going to sort of combinator explode so
00:20:40.159 --> 00:20:44.080
we need to choose some subset of these
00:20:41.960 --> 00:20:45.880
to continue with and the way we do that
00:20:44.080 --> 00:20:47.799
is we look at the probability over this
00:20:45.880 --> 00:20:49.240
two token sequence and we choose the two
00:20:47.799 --> 00:20:51.520
that have the highest probability
00:20:49.240 --> 00:20:53.400
overall so in this instance we've chosen
00:20:51.520 --> 00:20:55.679
sort of one thing from this first group
00:20:53.400 --> 00:20:57.760
and two things from the second group and
00:20:55.679 --> 00:20:59.760
now we're back down to three hypotheses
00:20:57.760 --> 00:21:02.120
each now two tokens long and we'll
00:20:59.760 --> 00:21:04.000
continue generating to time step three
00:21:02.120 --> 00:21:05.600
we'll get nine options we'll pre it back
00:21:04.000 --> 00:21:07.760
down to three and we'll continue until
00:21:05.600 --> 00:21:09.159
the end of generation where we now have
00:21:07.760 --> 00:21:10.679
three sequences and we'll just pick the
00:21:09.159 --> 00:21:14.000
one that's highest probability out of
00:21:10.679 --> 00:21:15.679
those three to return um this is not
00:21:14.000 --> 00:21:17.360
guaranteed to get you the highest
00:21:15.679 --> 00:21:18.480
probability thing right you still have
00:21:17.360 --> 00:21:20.039
this risk that you could be sort of
00:21:18.480 --> 00:21:22.279
pruning out something that's high
00:21:20.039 --> 00:21:24.159
probability but in general this sort of
00:21:22.279 --> 00:21:26.600
works um much better than greedy
00:21:24.159 --> 00:21:28.520
decoding and this is if you have a
00:21:26.600 --> 00:21:31.120
language model and you're sort of not
00:21:28.520 --> 00:21:32.440
what um decoding method it's using outs
00:21:31.120 --> 00:21:34.200
are pretty good it's either beam search
00:21:32.440 --> 00:21:37.120
or temperature samping right this is
00:21:34.200 --> 00:21:40.039
very effective this is used um pretty
00:21:37.120 --> 00:21:41.760
broadly there are however some issues
00:21:40.039 --> 00:21:43.760
with beam search and one of the biggest
00:21:41.760 --> 00:21:46.159
ones is that when you're doing this
00:21:43.760 --> 00:21:47.679
maximum likelihood sampling you really
00:21:46.159 --> 00:21:50.080
or the sampling to search for something
00:21:47.679 --> 00:21:51.760
that's very high likelihood um you
00:21:50.080 --> 00:21:53.679
really sacrifice a lot of diversity in
00:21:51.760 --> 00:21:55.320
your outputs and in particular you could
00:21:53.679 --> 00:21:57.279
wind up at the end of beam search with
00:21:55.320 --> 00:21:58.919
three different outputs to choose from
00:21:57.279 --> 00:22:00.120
that are all pretty pretty much the same
00:21:58.919 --> 00:22:02.640
like they're slightly different token
00:22:00.120 --> 00:22:04.559
sequences but they look very similar and
00:22:02.640 --> 00:22:07.480
so maybe you want to S get sort of a
00:22:04.559 --> 00:22:08.919
more diverse set um there's a couple of
00:22:07.480 --> 00:22:10.640
different methods in this category I'm
00:22:08.919 --> 00:22:12.679
going to very briefly shout out two of
00:22:10.640 --> 00:22:14.200
them um but the idea here is to sort of
00:22:12.679 --> 00:22:16.440
reintroduce some of the benefits of
00:22:14.200 --> 00:22:19.120
sampling while still doing this kind of
00:22:16.440 --> 00:22:20.919
search for high probability things um
00:22:19.120 --> 00:22:22.600
diverse beam search is one of these
00:22:20.919 --> 00:22:25.520
methods and here the idea is that we
00:22:22.600 --> 00:22:27.279
want to modify that scoring step when we
00:22:25.520 --> 00:22:28.600
choose which three out of our nine beams
00:22:27.279 --> 00:22:30.200
we want to continue
00:22:28.600 --> 00:22:32.000
to avoid choosing things that are really
00:22:30.200 --> 00:22:34.320
really close to each other right so
00:22:32.000 --> 00:22:36.039
maybe our highest probability thing is
00:22:34.320 --> 00:22:37.559
some sequence a and then if we look at
00:22:36.039 --> 00:22:39.520
the other sequences there's one that's
00:22:37.559 --> 00:22:41.279
pretty high probability but very similar
00:22:39.520 --> 00:22:43.600
to that sequence and there's one that's
00:22:41.279 --> 00:22:45.320
like slightly lower probability but very
00:22:43.600 --> 00:22:47.200
different and so maybe we would choose a
00:22:45.320 --> 00:22:49.679
sequence that is a little lower
00:22:47.200 --> 00:22:51.760
probability to maximize diversity in our
00:22:49.679 --> 00:22:53.799
set to try to get like sort of a wider
00:22:51.760 --> 00:22:56.200
range of options to choose from later in
00:22:53.799 --> 00:22:58.200
generation so this modifies the scoring
00:22:56.200 --> 00:23:00.120
to not just take into account likelihood
00:22:58.200 --> 00:23:03.200
but also similarity to other
00:23:00.120 --> 00:23:05.400
KS another option down this path is
00:23:03.200 --> 00:23:07.640
stochastic beam search where we're going
00:23:05.400 --> 00:23:09.279
to keep the scoring the same but rather
00:23:07.640 --> 00:23:11.679
than choosing just the top three most
00:23:09.279 --> 00:23:13.279
likely tokens to expand out each beam
00:23:11.679 --> 00:23:15.200
we're actually going to sample from some
00:23:13.279 --> 00:23:17.000
distribution and you could sample from
00:23:15.200 --> 00:23:18.760
the model distribution directly using
00:23:17.000 --> 00:23:20.200
ancestral sampling or you could use any
00:23:18.760 --> 00:23:22.679
of our sampling methods we talked about
00:23:20.200 --> 00:23:24.200
in the last section to do this and the
00:23:22.679 --> 00:23:25.799
the idea here is sort of similar to
00:23:24.200 --> 00:23:29.279
diverse beam search we want to get sort
00:23:25.799 --> 00:23:31.240
of a wider exploration of our models
00:23:29.279 --> 00:23:33.520
like output space you know we want to
00:23:31.240 --> 00:23:35.360
sort of explore more things instead of
00:23:33.520 --> 00:23:36.760
just seeking winding up with a bunch of
00:23:35.360 --> 00:23:39.679
outputs that look very similar at the
00:23:36.760 --> 00:23:41.120
end of beam search um if folks are
00:23:39.679 --> 00:23:43.679
interested in these I think these are
00:23:41.120 --> 00:23:46.159
both linked on the website um the the
00:23:43.679 --> 00:23:48.679
papers that both of these ideas came
00:23:46.159 --> 00:23:51.480
from
00:23:48.679 --> 00:23:54.400
Yes um for stochastic
00:23:51.480 --> 00:23:57.039
resarch the sampl probability takes into
00:23:54.400 --> 00:23:59.039
account the current part that we already
00:23:57.039 --> 00:24:02.000
travel okay
00:23:59.039 --> 00:24:04.320
yeah exactly so it's this um like
00:24:02.000 --> 00:24:05.640
selection step here but we're instead of
00:24:04.320 --> 00:24:07.760
just doing greedy selection we're going
00:24:05.640 --> 00:24:11.760
to do
00:24:07.760 --> 00:24:17.520
assembling yes my question was on the T
00:24:11.760 --> 00:24:23.200
yeah like you for something super simple
00:24:17.520 --> 00:24:26.520
like if both of them have a high are you
00:24:23.200 --> 00:24:28.120
like yeah so you would if it has a
00:24:26.520 --> 00:24:30.080
really high probability under both
00:24:28.120 --> 00:24:32.880
models it would have a lower probability
00:24:30.080 --> 00:24:35.080
after doing this sort of contrasted
00:24:32.880 --> 00:24:36.600
de right so if the if the smaller
00:24:35.080 --> 00:24:38.799
model's really good at your task this
00:24:36.600 --> 00:24:40.960
might not work very
00:24:38.799 --> 00:24:43.360
well yeah I think in the paper they're
00:24:40.960 --> 00:24:45.320
generally evaluating on these sort of
00:24:43.360 --> 00:24:48.279
like open ended generation task I bet
00:24:45.320 --> 00:24:51.279
this works a lot worse for
00:24:48.279 --> 00:24:51.279
now
00:24:56.760 --> 00:24:59.760
yes
00:25:02.440 --> 00:25:08.120
you yeah this is a great question um and
00:25:05.960 --> 00:25:11.559
so the question is how do we measure
00:25:08.120 --> 00:25:14.120
similar beams um you can sort of Define
00:25:11.559 --> 00:25:15.559
any kind of similarity function you like
00:25:14.120 --> 00:25:17.520
here um anything that you'd use to
00:25:15.559 --> 00:25:20.440
evaluate like how similar something is
00:25:17.520 --> 00:25:22.360
to a gold reference right um I think in
00:25:20.440 --> 00:25:25.039
the original diverse beam search they do
00:25:22.360 --> 00:25:27.760
this by looking at like exact token
00:25:25.039 --> 00:25:30.640
match across the two right like if these
00:25:27.760 --> 00:25:33.880
beams are the same in all but one of the
00:25:30.640 --> 00:25:35.600
tokens or they have like you know 50% of
00:25:33.880 --> 00:25:37.120
the tokens are shared across the beams
00:25:35.600 --> 00:25:38.559
and maybe these are really similar and
00:25:37.120 --> 00:25:40.559
they should try to choose two things
00:25:38.559 --> 00:25:42.600
that are different um but you could swap
00:25:40.559 --> 00:25:46.200
that out for any
00:25:42.600 --> 00:25:49.440
metc yes so
00:25:46.200 --> 00:25:50.960
the there's kind of like a that's Happ
00:25:49.440 --> 00:25:53.360
at
00:25:50.960 --> 00:25:55.000
every for the stochastic be search
00:25:53.360 --> 00:25:57.720
there's like a shering what do you mean
00:25:55.000 --> 00:26:00.520
by a shepher so it says modify the next
00:25:57.720 --> 00:26:03.000
sech selection because they're like um
00:26:00.520 --> 00:26:06.919
it is searching at a different space and
00:26:03.000 --> 00:26:09.679
it's not searching within the same 3D
00:26:06.919 --> 00:26:14.080
SE is it searching in a different space
00:26:09.679 --> 00:26:15.799
yeah so it's um in the same probability
00:26:14.080 --> 00:26:18.399
distribution but it'll see a different
00:26:15.799 --> 00:26:20.840
part of the distribution so when you're
00:26:18.399 --> 00:26:22.640
doing the grey search you'll only ever
00:26:20.840 --> 00:26:24.559
look at the top three tokens in the next
00:26:22.640 --> 00:26:27.120
token distribution because you're just
00:26:24.559 --> 00:26:29.840
selecting like the maximums um but in
00:26:27.120 --> 00:26:31.360
sampling you could you could get the
00:26:29.840 --> 00:26:32.880
same tokens right if they're really high
00:26:31.360 --> 00:26:35.720
likelihood but you could also sample
00:26:32.880 --> 00:26:38.399
something that's further down in the
00:26:35.720 --> 00:26:42.760
distribution yeah as a followup to that
00:26:38.399 --> 00:26:44.880
like into uh our stamping we take into
00:26:42.760 --> 00:26:46.960
account the probability of the prefix
00:26:44.880 --> 00:26:50.679
like the current hypothesis right
00:26:46.960 --> 00:26:51.760
because otherwise it is the same as just
00:26:50.679 --> 00:26:54.279
uh
00:26:51.760 --> 00:26:57.159
in yeah so in the sampling we're taking
00:26:54.279 --> 00:27:00.120
into account the previous the prefix
00:26:57.159 --> 00:27:02.600
yeah so so it we will take into account
00:27:00.120 --> 00:27:06.200
the prefix but this sampling mechanism
00:27:02.600 --> 00:27:08.320
here could be ancestral sampling um the
00:27:06.200 --> 00:27:10.480
only the difference here is that we're
00:27:08.320 --> 00:27:12.600
also doing a sort of search step on top
00:27:10.480 --> 00:27:14.679
of that to choose the maximum likelihood
00:27:12.600 --> 00:27:18.080
things across multiple
00:27:14.679 --> 00:27:20.559
me another important thing um is you
00:27:18.080 --> 00:27:22.279
sample without replacement and so
00:27:20.559 --> 00:27:24.120
normally you sample with replacement and
00:27:22.279 --> 00:27:25.840
you might get exactly the same thing but
00:27:24.120 --> 00:27:28.000
when you're doing stasic beam search you
00:27:25.840 --> 00:27:30.240
sample without replacement so you get
00:27:28.000 --> 00:27:33.279
like three ones according to the
00:27:30.240 --> 00:27:36.080
probability but they're guaranteed to be
00:27:33.279 --> 00:27:37.799
different right so beam search like one
00:27:36.080 --> 00:27:39.559
of the characteristics of beam search is
00:27:37.799 --> 00:27:41.640
you always get three different things
00:27:39.559 --> 00:27:44.240
because you're picking the three top
00:27:41.640 --> 00:27:45.760
when you do sampling uh like stochastic
00:27:44.240 --> 00:27:47.399
Bean shirts you get three different
00:27:45.760 --> 00:27:49.440
things they're not guaranteed to be the
00:27:47.399 --> 00:27:51.760
top they could be distributed according
00:27:49.440 --> 00:27:54.360
to the prob distribution but they're
00:27:51.760 --> 00:27:55.840
guaranteed so um you can take a look at
00:27:54.360 --> 00:27:58.039
the paper for more details of exactly
00:27:55.840 --> 00:28:00.159
how it looks but that that's
00:27:58.039 --> 00:28:03.039
so then is the main difference that
00:28:00.159 --> 00:28:05.120
compared to plus temping that we have n
00:28:03.039 --> 00:28:08.519
options that we're cheing tet instead of
00:28:05.120 --> 00:28:10.320
going with the going with only one and
00:28:08.519 --> 00:28:11.200
you can't yeah you can't simple the same
00:28:10.320 --> 00:28:14.960
thing
00:28:11.200 --> 00:28:16.919
right yeah so just uh repeat recording
00:28:14.960 --> 00:28:19.159
is that n options we're keeping track of
00:28:16.919 --> 00:28:22.240
and they're all going to be unique token
00:28:19.159 --> 00:28:24.240
sequences at least um you can actually
00:28:22.240 --> 00:28:26.200
get the same output sequence from two
00:28:24.240 --> 00:28:28.120
different toen sequences if you tokenize
00:28:26.200 --> 00:28:32.360
slightly differently um but these will
00:28:28.120 --> 00:28:37.840
always be unique tokens
00:28:32.360 --> 00:28:39.279
Le so that was sort of a a why like a a
00:28:37.840 --> 00:28:41.320
set of methods that we've developed to
00:28:39.279 --> 00:28:43.600
try to find the most probable sequence
00:28:41.320 --> 00:28:44.480
out of the model um but in the next
00:28:43.600 --> 00:28:46.039
section here we're going to sort of
00:28:44.480 --> 00:28:50.240
think about whether that's actually what
00:28:46.039 --> 00:28:51.679
we want to do at all um so what is like
00:28:50.240 --> 00:28:54.240
is do we really want the highest
00:28:51.679 --> 00:28:56.880
probability thing um we know that
00:28:54.240 --> 00:28:58.600
outputs with really low probability tend
00:28:56.880 --> 00:29:00.640
to be really like worse than outfits
00:28:58.600 --> 00:29:03.240
with high probability right maybe I'm
00:29:00.640 --> 00:29:05.840
trying to predict like what the next
00:29:03.240 --> 00:29:08.640
sentence should be after the cat saw the
00:29:05.840 --> 00:29:11.240
dog right the cat sat down is way higher
00:29:08.640 --> 00:29:12.559
probability than the cat grew wings and
00:29:11.240 --> 00:29:14.039
at least with the cats I've met that
00:29:12.559 --> 00:29:15.679
sounds pretty that sounds pretty much
00:29:14.039 --> 00:29:19.559
right right like this is a much better
00:29:15.679 --> 00:29:21.720
output than the cat gr wings but if you
00:29:19.559 --> 00:29:24.159
look at just the outputs with relatively
00:29:21.720 --> 00:29:25.960
high probability it's sort of less clear
00:29:24.159 --> 00:29:27.880
that this defines an exact ranking
00:29:25.960 --> 00:29:30.559
between those outputs right
00:29:27.880 --> 00:29:32.600
is the cat sat down necessarily better
00:29:30.559 --> 00:29:34.519
than the cat ran away these both seem
00:29:32.600 --> 00:29:35.720
like pretty reasonable outputs to me
00:29:34.519 --> 00:29:40.200
even though one of them is slightly
00:29:35.720 --> 00:29:42.799
higher probability and so we do we
00:29:40.200 --> 00:29:45.240
really like necessarily need to recover
00:29:42.799 --> 00:29:47.200
the cat that down um and this gets a
00:29:45.240 --> 00:29:49.399
little a little more complicated still
00:29:47.200 --> 00:29:51.120
if we look at sort of a range of outputs
00:29:49.399 --> 00:29:53.120
so say there's sort of six outputs that
00:29:51.120 --> 00:29:55.240
our model could give us um and here
00:29:53.120 --> 00:29:57.559
we're looking at sort of full sequences
00:29:55.240 --> 00:30:00.120
not individual tokens just for clarity
00:29:57.559 --> 00:30:02.640
so maybe our outputs in order of
00:30:00.120 --> 00:30:05.840
probability are the cat sat down it ran
00:30:02.640 --> 00:30:08.240
away it sprinted off it got out of there
00:30:05.840 --> 00:30:09.720
it's very small and it grew Wings right
00:30:08.240 --> 00:30:11.440
so we're definitely sure that the cat
00:30:09.720 --> 00:30:13.159
sat down is a better output than the cat
00:30:11.440 --> 00:30:15.360
grew wings and if we're doing a mod
00:30:13.159 --> 00:30:17.600
seeking search we would find that as our
00:30:15.360 --> 00:30:19.440
most likely thing if we're if we you
00:30:17.600 --> 00:30:21.440
know do a good job searching and we'd
00:30:19.440 --> 00:30:23.519
return that as our output but if you
00:30:21.440 --> 00:30:25.919
look at the rest of this distribution
00:30:23.519 --> 00:30:27.880
you see that there's actually a whole
00:30:25.919 --> 00:30:29.240
set of outputs after that all say
00:30:27.880 --> 00:30:31.720
something that kind of means the cat
00:30:29.240 --> 00:30:33.480
left the area right it's just that this
00:30:31.720 --> 00:30:35.200
probability is split over these three
00:30:33.480 --> 00:30:37.080
different generations and if you
00:30:35.200 --> 00:30:39.120
actually add up the probability mass of
00:30:37.080 --> 00:30:40.880
all three of these sequences this is
00:30:39.120 --> 00:30:42.919
double the probability mass of the cat
00:30:40.880 --> 00:30:44.360
sat down but because none of these
00:30:42.919 --> 00:30:45.960
individual sequences is higher
00:30:44.360 --> 00:30:47.399
probability if you're doing mode seeking
00:30:45.960 --> 00:30:50.640
search you wouldn't you wouldn't be able
00:30:47.399 --> 00:30:52.480
to see this effect right so do we really
00:30:50.640 --> 00:30:53.760
want to return the cat sat down or do we
00:30:52.480 --> 00:30:55.200
want to return something that means the
00:30:53.760 --> 00:30:57.559
cat left the
00:30:55.200 --> 00:30:59.200
area the question then is like if it's
00:30:57.559 --> 00:31:03.120
not probability that makes an output
00:30:59.200 --> 00:31:04.679
good what is it so we have this one
00:31:03.120 --> 00:31:06.039
output that's really high probability
00:31:04.679 --> 00:31:09.000
but it's very different from everything
00:31:06.039 --> 00:31:10.720
else in our set and then we have a
00:31:09.000 --> 00:31:13.200
couple of outputs that are all pretty
00:31:10.720 --> 00:31:15.080
high probability and similar to a bunch
00:31:13.200 --> 00:31:17.840
of other relatively high probability
00:31:15.080 --> 00:31:19.720
things so maybe it's sort of less risky
00:31:17.840 --> 00:31:21.399
to return one of these right are thing
00:31:19.720 --> 00:31:23.200
that's higher probability but different
00:31:21.399 --> 00:31:24.600
than everything else could be different
00:31:23.200 --> 00:31:26.840
because it's way better or it could be
00:31:24.600 --> 00:31:29.000
different because it's way worse um
00:31:26.840 --> 00:31:31.120
another way to think about this is you
00:31:29.000 --> 00:31:32.600
know maybe if you and your friends were
00:31:31.120 --> 00:31:34.200
cheating on a test which you shouldn't
00:31:32.600 --> 00:31:35.480
do but if you were going to do it and
00:31:34.200 --> 00:31:37.519
all of your friends sent you their
00:31:35.480 --> 00:31:39.240
answers um maybe one of your friends has
00:31:37.519 --> 00:31:40.960
a slightly higher score in the class
00:31:39.240 --> 00:31:42.519
than everyone else but they said the
00:31:40.960 --> 00:31:44.480
answer was answer a and everyone else
00:31:42.519 --> 00:31:45.799
said the answer was B right you still
00:31:44.480 --> 00:31:48.480
might go with the answer that everyone
00:31:45.799 --> 00:31:50.679
else said because like what there's it
00:31:48.480 --> 00:31:52.679
sort of feels less risky like maybe
00:31:50.679 --> 00:31:54.440
everyone else got the answer get that
00:31:52.679 --> 00:31:55.880
answer and so your one friend could be
00:31:54.440 --> 00:31:56.919
right when everyone else is wrong or
00:31:55.880 --> 00:31:59.679
they could have made a mistake that no
00:31:56.919 --> 00:32:01.240
one El else is making so this is sort of
00:31:59.679 --> 00:32:03.519
the same concept right we want an output
00:32:01.240 --> 00:32:06.320
that's relatively high probability but
00:32:03.519 --> 00:32:09.399
also relatively low
00:32:06.320 --> 00:32:11.320
risk and so here maybe if we were using
00:32:09.399 --> 00:32:13.679
this criteria we'd return the cat ran
00:32:11.320 --> 00:32:14.720
away as our sort of as our sort of
00:32:13.679 --> 00:32:16.720
single
00:32:14.720 --> 00:32:19.440
output so how do you find something
00:32:16.720 --> 00:32:21.000
that's high probability and low risk
00:32:19.440 --> 00:32:22.480
there's sort of two questions here right
00:32:21.000 --> 00:32:24.399
we have to figure out how to estimate
00:32:22.480 --> 00:32:26.120
probability and if we're looking at a
00:32:24.399 --> 00:32:28.519
set of outputs like the six we saw
00:32:26.120 --> 00:32:29.880
before maybe we can just do this by
00:32:28.519 --> 00:32:31.720
counting right we could sample
00:32:29.880 --> 00:32:34.000
everything from the model and get exact
00:32:31.720 --> 00:32:35.200
probability or we could take a sample
00:32:34.000 --> 00:32:38.080
from the model and just look at
00:32:35.200 --> 00:32:40.200
probabilities in that set and from there
00:32:38.080 --> 00:32:41.840
from that sample um sort of one
00:32:40.200 --> 00:32:43.559
reasonable thing to do is just count
00:32:41.840 --> 00:32:45.320
frequency right if something's in our
00:32:43.559 --> 00:32:47.919
sample twice as often we just say it's
00:32:45.320 --> 00:32:49.799
twice as frequent or it's twice as
00:32:47.919 --> 00:32:52.880
probable um this is something called
00:32:49.799 --> 00:32:54.440
Monte Carlos sampling if you do this um
00:32:52.880 --> 00:32:56.039
enough times like if you sample an
00:32:54.440 --> 00:32:58.279
infinite set this is would give you
00:32:56.039 --> 00:33:00.880
exactly the model distri distribution um
00:32:58.279 --> 00:33:02.840
but for the sort of reasonable size sets
00:33:00.880 --> 00:33:04.200
we're working with maybe like a 100
00:33:02.840 --> 00:33:06.320
samples this gives us a sort of
00:33:04.200 --> 00:33:09.440
reasonable approximation for what we for
00:33:06.320 --> 00:33:10.840
what we need to do here at least so
00:33:09.440 --> 00:33:12.000
we're just going to take a sample to get
00:33:10.840 --> 00:33:13.440
probability and we're just going to
00:33:12.000 --> 00:33:15.519
count things in that sample to see how
00:33:13.440 --> 00:33:17.320
likely things are that doesn't seem too
00:33:15.519 --> 00:33:20.080
bad how do we estimate
00:33:17.320 --> 00:33:21.679
risk the idea here is that we have a
00:33:20.080 --> 00:33:24.080
bunch of other things in this set of
00:33:21.679 --> 00:33:26.080
outputs and we can treat those as sort
00:33:24.080 --> 00:33:27.880
of like pseudo references right we can
00:33:26.080 --> 00:33:29.840
evaluate agreement between the thing
00:33:27.880 --> 00:33:31.519
we're looking at and each of those other
00:33:29.840 --> 00:33:33.480
references and this is sort of the same
00:33:31.519 --> 00:33:35.519
idea of calculating similarity in
00:33:33.480 --> 00:33:37.159
diverse beam search we're going to use
00:33:35.519 --> 00:33:39.639
some kind of metric to compare how
00:33:37.159 --> 00:33:41.279
similar these things are um this metric
00:33:39.639 --> 00:33:43.080
could be anything you use Downstream it
00:33:41.279 --> 00:33:44.840
could be like an engram overlap metric
00:33:43.080 --> 00:33:48.600
like Rouge or blue or it could also be
00:33:44.840 --> 00:33:51.120
something um neural or semantic like um
00:33:48.600 --> 00:33:54.799
something like BT score or Bart
00:33:51.120 --> 00:33:56.600
score and so this concept um is a type
00:33:54.799 --> 00:33:57.919
of decoding called minimum based risk
00:33:56.600 --> 00:33:59.600
decoding
00:33:57.919 --> 00:34:01.840
and what this equation captures is
00:33:59.600 --> 00:34:03.919
exactly the intuition that we were um
00:34:01.840 --> 00:34:06.600
sort of talking about just a slide ago
00:34:03.919 --> 00:34:08.159
where we're going to choose something
00:34:06.600 --> 00:34:09.919
that is low risk which means it's
00:34:08.159 --> 00:34:11.960
similar to a lot of other things in this
00:34:09.919 --> 00:34:12.800
set of outputs we've sampled and we're
00:34:11.960 --> 00:34:14.800
going to choose something that's
00:34:12.800 --> 00:34:17.560
relatively high probability which means
00:34:14.800 --> 00:34:19.159
that sort of when we sum up over this if
00:34:17.560 --> 00:34:21.399
something occurs in our set a bunch of
00:34:19.159 --> 00:34:23.320
times it's going to have pretty strong
00:34:21.399 --> 00:34:25.800
weight in picking which um of these
00:34:23.320 --> 00:34:27.000
outputs are similar right if sort of
00:34:25.800 --> 00:34:28.399
there's one thing in the set that
00:34:27.000 --> 00:34:29.919
appears a bunch of times it's going to
00:34:28.399 --> 00:34:32.040
have a strong influence on which thing
00:34:29.919 --> 00:34:34.119
we pick and so that kind of captures
00:34:32.040 --> 00:34:38.520
high probability in this
00:34:34.119 --> 00:34:41.119
setting so to see how this works we can
00:34:38.520 --> 00:34:44.639
look at an example um in
00:34:41.119 --> 00:34:47.399
summarization so we choose some Metric
00:34:44.639 --> 00:34:49.639
maybe we choose um Rouge which is an
00:34:47.399 --> 00:34:51.399
engram overlap metric for summarization
00:34:49.639 --> 00:34:52.879
and we say we're going to sample 100
00:34:51.399 --> 00:34:55.960
things and we're going to use this
00:34:52.879 --> 00:35:00.359
equation to choose the one that has the
00:34:55.960 --> 00:35:03.960
sort of lower EST risk according to MBR
00:35:00.359 --> 00:35:06.480
um so if we do that and we look at this
00:35:03.960 --> 00:35:07.560
sort of table of results here um you can
00:35:06.480 --> 00:35:09.680
see that this
00:35:07.560 --> 00:35:11.320
outperforms the other sampling methods
00:35:09.680 --> 00:35:13.720
that we've looked at before so greedy
00:35:11.320 --> 00:35:15.640
decoding here is just sampling the
00:35:13.720 --> 00:35:18.760
single most likely thing in each step
00:35:15.640 --> 00:35:21.800
beam search here is the BS with five or
00:35:18.760 --> 00:35:24.359
10 beams and DBS is the diverse beam
00:35:21.800 --> 00:35:27.040
search we were talking about um if we
00:35:24.359 --> 00:35:29.440
use minimum based risk and we use grou
00:35:27.040 --> 00:35:31.240
is the sort of determiner of similarity
00:35:29.440 --> 00:35:32.680
we do way better across all of our
00:35:31.240 --> 00:35:33.960
metrics but we especially do really good
00:35:32.680 --> 00:35:36.680
at Rouge because that's sort of the
00:35:33.960 --> 00:35:38.119
metric that we've been using to evaluate
00:35:36.680 --> 00:35:40.240
and then if we swap this out for other
00:35:38.119 --> 00:35:43.599
metrics you still see an performance
00:35:40.240 --> 00:35:46.440
improvement over these um search methods
00:35:43.599 --> 00:35:48.119
here um what's the sort of catch here
00:35:46.440 --> 00:35:49.920
the catch here is that MBR requires you
00:35:48.119 --> 00:35:51.599
to sample a hundred things and so this
00:35:49.920 --> 00:35:54.760
is a lot more expensive it's a lot
00:35:51.599 --> 00:35:54.760
slower at infin
00:35:54.800 --> 00:35:58.800
time um yes
00:36:04.200 --> 00:36:10.040
yes a great question why does the beam
00:36:07.000 --> 00:36:14.000
search with more beams perform worse um
00:36:10.040 --> 00:36:16.720
this is a well a relatively welln
00:36:14.000 --> 00:36:19.359
phenomena called the cursive beam search
00:36:16.720 --> 00:36:21.640
which is we actually lost your M so you
00:36:19.359 --> 00:36:24.599
mic and we can speak okay yeah so this
00:36:21.640 --> 00:36:26.079
is called the cursive beam search um and
00:36:24.599 --> 00:36:27.760
the idea here is that beam search is
00:36:26.079 --> 00:36:29.359
like an approxim search right so if you
00:36:27.760 --> 00:36:31.200
add more beams you should be doing
00:36:29.359 --> 00:36:33.319
better and better at finding the maximum
00:36:31.200 --> 00:36:34.800
likelihood thing and generally you are
00:36:33.319 --> 00:36:37.160
you get something that is higher
00:36:34.800 --> 00:36:39.160
probability but as you add more beams
00:36:37.160 --> 00:36:42.319
you also often get something that does
00:36:39.160 --> 00:36:42.319
worse on your Downstream
00:36:44.160 --> 00:36:47.560
metrics back up
00:36:54.240 --> 00:36:58.680
there is that back online
00:36:59.119 --> 00:37:06.520
yeah is that back is that any louder no
00:37:03.520 --> 00:37:06.520
it
00:37:07.000 --> 00:37:12.640
question oh there we go is that better
00:37:09.599 --> 00:37:13.760
great um yeah so why why does this
00:37:12.640 --> 00:37:16.040
happen right why do you get something
00:37:13.760 --> 00:37:18.560
that's higher likelihood but um lower
00:37:16.040 --> 00:37:22.040
performance Downstream um and this is
00:37:18.560 --> 00:37:24.000
like another sort of degeneracy of beam
00:37:22.040 --> 00:37:25.680
search that this idea that the thing
00:37:24.000 --> 00:37:27.440
that is the absolute highest likelihood
00:37:25.680 --> 00:37:28.599
in your distribution might not actually
00:37:27.440 --> 00:37:31.079
be what you want
00:37:28.599 --> 00:37:33.960
Downstream um this is sort of one of the
00:37:31.079 --> 00:37:35.200
other things that people use to motivate
00:37:33.960 --> 00:37:37.599
why you might want to do something like
00:37:35.200 --> 00:37:39.400
MBR instead um and there's a great paper
00:37:37.599 --> 00:37:41.640
about this problem called the inadequacy
00:37:39.400 --> 00:37:43.680
of the mode because beam search is
00:37:41.640 --> 00:37:45.520
looking for the mode of the
00:37:43.680 --> 00:37:47.880
distribution well one other thing I'd
00:37:45.520 --> 00:37:49.680
like to mention is it also goes together
00:37:47.880 --> 00:37:51.119
with how you train your models because
00:37:49.680 --> 00:37:53.760
most of our models are trained using
00:37:51.119 --> 00:37:57.079
maximum likelihood maximum likelihood
00:37:53.760 --> 00:37:59.040
isn't explicitly maximizing our ability
00:37:57.079 --> 00:38:01.079
to get the best answer it's explicitly
00:37:59.040 --> 00:38:05.720
maximizing our ability to estimate the
00:38:01.079 --> 00:38:10.160
the distribution of answers so if I
00:38:05.720 --> 00:38:13.040
say um if you said like what is what is
00:38:10.160 --> 00:38:15.839
your favorite hobby or something like
00:38:13.040 --> 00:38:17.680
that uh what is your favorite hobby in a
00:38:15.839 --> 00:38:19.280
dialogue system often it'll answer I
00:38:17.680 --> 00:38:22.400
don't know or something like that
00:38:19.280 --> 00:38:24.920
because it like you know that that's
00:38:22.400 --> 00:38:26.599
more likely than answering any specific
00:38:24.920 --> 00:38:29.240
hobby like it's more likely than
00:38:26.599 --> 00:38:32.119
answering basketball bowling you know
00:38:29.240 --> 00:38:35.040
whatever else because you have many many
00:38:32.119 --> 00:38:36.560
different options and so like especially
00:38:35.040 --> 00:38:39.880
if it's something that's a little bit
00:38:36.560 --> 00:38:42.160
more comp complicated it will avoid
00:38:39.880 --> 00:38:44.680
answering that and in particular it ends
00:38:42.160 --> 00:38:47.240
up answering very short things for
00:38:44.680 --> 00:38:49.280
example um or sometimes it ends up
00:38:47.240 --> 00:38:51.160
repeating itself over and over again or
00:38:49.280 --> 00:38:53.240
or things like that so it also goes
00:38:51.160 --> 00:38:57.760
together with like the training of the
00:38:53.240 --> 00:38:59.359
model yeah and this is um one of the
00:38:57.760 --> 00:39:01.079
this is still a problem in modern
00:38:59.359 --> 00:39:02.560
systems so if you actually look at the
00:39:01.079 --> 00:39:03.839
single like if you could enumerate
00:39:02.560 --> 00:39:05.680
everything and see the single most
00:39:03.839 --> 00:39:07.520
likely sequence it's often the empty
00:39:05.680 --> 00:39:10.920
sequence just not opening anything at
00:39:07.520 --> 00:39:12.640
all um and so if that's your true mode
00:39:10.920 --> 00:39:16.119
of the distribution then doing better at
00:39:12.640 --> 00:39:16.119
mode seeking is not always like
00:39:16.599 --> 00:39:19.599
helpful
00:39:25.440 --> 00:39:32.960
yes could this be influenced by the
00:39:28.200 --> 00:39:32.960
confidence problem like um how
00:39:37.560 --> 00:39:41.079
so seems
00:39:49.760 --> 00:39:53.599
bees
00:39:51.010 --> 00:39:57.280
[Music]
00:39:53.599 --> 00:39:59.760
might right I think I I think I see
00:39:57.280 --> 00:40:02.000
what you're saying which is that like
00:39:59.760 --> 00:40:04.200
the the confidence gives you the
00:40:02.000 --> 00:40:06.680
confidence of like a single exact
00:40:04.200 --> 00:40:11.000
sequence right not the like actual sort
00:40:06.680 --> 00:40:13.200
of semantic space of and so yeah if you
00:40:11.000 --> 00:40:14.920
looked at just like the if you look at
00:40:13.200 --> 00:40:17.000
just the probability scores you get the
00:40:14.920 --> 00:40:18.520
probability of an exact string when what
00:40:17.000 --> 00:40:20.119
you really actually care about with
00:40:18.520 --> 00:40:22.319
confidence is the probability of sort of
00:40:20.119 --> 00:40:23.800
like things that mean the same thing
00:40:22.319 --> 00:40:25.359
yeah this is um part of why like
00:40:23.800 --> 00:40:28.359
calibration is really hard for long
00:40:25.359 --> 00:40:28.359
sequences
00:40:30.720 --> 00:40:37.319
great so we're g to touch sort of
00:40:34.359 --> 00:40:39.520
briefly on a couple of other things that
00:40:37.319 --> 00:40:40.920
aren't sort of always explicitly
00:40:39.520 --> 00:40:42.480
described in this framework but that you
00:40:40.920 --> 00:40:45.040
can think of as variance of minimum
00:40:42.480 --> 00:40:46.960
based risk um and if you're interested
00:40:45.040 --> 00:40:49.560
in this analysis um I think as Graham
00:40:46.960 --> 00:40:51.800
mentioned earlier um Alex Z is a first
00:40:49.560 --> 00:40:53.680
year MLT and I wrote a paper about this
00:40:51.800 --> 00:40:57.839
um which you can check out if you're
00:40:53.680 --> 00:41:01.200
interested so the um two that I really
00:40:57.839 --> 00:41:03.800
want to touch on here are other sort of
00:41:01.200 --> 00:41:05.240
inference time things you can consider
00:41:03.800 --> 00:41:07.520
which might look a little bit different
00:41:05.240 --> 00:41:09.480
on the first BL um the first of these is
00:41:07.520 --> 00:41:11.680
output ensembling so say you have
00:41:09.480 --> 00:41:13.240
multiple different models and you get
00:41:11.680 --> 00:41:15.480
outputs from all of them and now you
00:41:13.240 --> 00:41:19.560
need to choose a best output among that
00:41:15.480 --> 00:41:21.599
set um one of the sort of common ways to
00:41:19.560 --> 00:41:24.480
do this is to compare like an embedding
00:41:21.599 --> 00:41:25.920
similarity across models like does model
00:41:24.480 --> 00:41:27.560
one think these two things are really
00:41:25.920 --> 00:41:28.880
similar does model two think these two
00:41:27.560 --> 00:41:32.599
things are really similar and try to
00:41:28.880 --> 00:41:34.680
choose something that the um has really
00:41:32.599 --> 00:41:37.319
high similarity with a lot of other
00:41:34.680 --> 00:41:39.200
outputs um of course now that we've just
00:41:37.319 --> 00:41:41.440
recently been talking about MBR you can
00:41:39.200 --> 00:41:44.920
see that you can probably see that this
00:41:41.440 --> 00:41:46.280
is um the same general formulation just
00:41:44.920 --> 00:41:47.880
rather than summing over a set of
00:41:46.280 --> 00:41:49.520
outputs from a single model now you're
00:41:47.880 --> 00:41:52.160
looking at outputs over a whole set of
00:41:49.520 --> 00:41:54.640
models um so some types of ensembling
00:41:52.160 --> 00:41:57.319
fall into this category of minimum based
00:41:54.640 --> 00:42:00.680
risk methods another thing in this
00:41:57.319 --> 00:42:03.280
category is a um sort of recent decoding
00:42:00.680 --> 00:42:06.079
method called self-consistency and the
00:42:03.280 --> 00:42:08.200
idea here is that you want to do
00:42:06.079 --> 00:42:09.359
something like mathematical reasoning
00:42:08.200 --> 00:42:10.599
and you really care about getting the
00:42:09.359 --> 00:42:12.000
final answer right but you don't
00:42:10.599 --> 00:42:15.000
necessarily care about getting all of
00:42:12.000 --> 00:42:18.079
the the reasoning steps in between right
00:42:15.000 --> 00:42:19.520
so you prompt the model for an answer um
00:42:18.079 --> 00:42:20.800
using something like Chain of Thought
00:42:19.520 --> 00:42:22.680
right you ask it to sort of talk through
00:42:20.800 --> 00:42:26.440
the steps it's going to do and then give
00:42:22.680 --> 00:42:28.599
you a final answer um you sample many
00:42:26.440 --> 00:42:30.400
puts using this and then you completely
00:42:28.599 --> 00:42:32.200
throw away the chains of thought um and
00:42:30.400 --> 00:42:35.359
you just take the answer from each
00:42:32.200 --> 00:42:37.640
output um you have that set of answers
00:42:35.359 --> 00:42:38.960
maybe you have like 20 30 100 answers
00:42:37.640 --> 00:42:40.000
you just return the one that was most
00:42:38.960 --> 00:42:43.720
frequently
00:42:40.000 --> 00:42:46.119
generated um what this is doing is a
00:42:43.720 --> 00:42:48.800
type of MBR where the metric that you
00:42:46.119 --> 00:42:51.160
actually care about is exact match of
00:42:48.800 --> 00:42:51.839
this answer right ignoring the rest of
00:42:51.160 --> 00:42:54.079
the
00:42:51.839 --> 00:42:55.800
generation um and so here we have sort
00:42:54.079 --> 00:42:56.839
of the same intuition that we want an
00:42:55.800 --> 00:42:59.160
output
00:42:56.839 --> 00:43:01.520
that is high probability right we're
00:42:59.160 --> 00:43:03.359
getting it generated a lot but also low
00:43:01.520 --> 00:43:06.079
risk not a lot of the other outputs in
00:43:03.359 --> 00:43:08.440
our in our set disagree with this
00:43:06.079 --> 00:43:10.359
answer so those are a couple of
00:43:08.440 --> 00:43:11.920
different variants of methods where
00:43:10.359 --> 00:43:13.880
we're sort of sampling a wide set of
00:43:11.920 --> 00:43:17.359
sequences and trying to choose the best
00:43:13.880 --> 00:43:20.960
one um MBR is one set is one type of
00:43:17.359 --> 00:43:22.680
sort of sequence set reranking method um
00:43:20.960 --> 00:43:24.760
you could do other things to rerank sets
00:43:22.680 --> 00:43:27.400
as well but this is sort of one
00:43:24.760 --> 00:43:30.359
representative class of these yes uh or
00:43:27.400 --> 00:43:32.280
of the of these methods before we get
00:43:30.359 --> 00:43:35.200
into constrain generation those are sort
00:43:32.280 --> 00:43:37.000
of the three broad categories of
00:43:35.200 --> 00:43:39.480
inference methods we'll discuss which is
00:43:37.000 --> 00:43:41.680
sort of sampling from some distribution
00:43:39.480 --> 00:43:45.040
searching over some space of
00:43:41.680 --> 00:43:47.400
distributions and doing some kind of um
00:43:45.040 --> 00:43:48.559
analysis over a set of samples to choose
00:43:47.400 --> 00:43:51.359
which ones they
00:43:48.559 --> 00:43:52.559
return um does anyone have any questions
00:43:51.359 --> 00:43:55.079
at this
00:43:52.559 --> 00:44:00.680
point
00:43:55.079 --> 00:44:00.680
yeah that a model
00:44:05.800 --> 00:44:12.760
cannot yeah like why is averaging model
00:44:08.359 --> 00:44:16.400
weights not MBR um I think it's not MBR
00:44:12.760 --> 00:44:18.559
because the two um the key thing that I
00:44:16.400 --> 00:44:20.880
think really makes a method MBR is this
00:44:18.559 --> 00:44:22.480
concept of comparing between multiple um
00:44:20.880 --> 00:44:24.880
sort of pseudo
00:44:22.480 --> 00:44:26.839
references um and there you don't have
00:44:24.880 --> 00:44:28.359
the same like you aage model way can you
00:44:26.839 --> 00:44:32.440
wind up with sort of a single output on
00:44:28.359 --> 00:44:34.040
the end that maybe is like using like
00:44:32.440 --> 00:44:35.800
information from these two model
00:44:34.040 --> 00:44:38.240
distributions that you've sort of smush
00:44:35.800 --> 00:44:41.160
together um but it's not the same
00:44:38.240 --> 00:44:44.720
concept of like comparing against pseudo
00:44:41.160 --> 00:44:44.720
references or ranking in a
00:44:48.920 --> 00:44:55.599
set right so now this is sort of a this
00:44:52.720 --> 00:44:57.559
was a wide variety of methods to try to
00:44:55.599 --> 00:44:59.040
find an output that's just sort of good
00:44:57.559 --> 00:45:01.440
right we want an output that that is
00:44:59.040 --> 00:45:03.480
nice out of our model um but now we'd
00:45:01.440 --> 00:45:05.880
like to maybe enclose a few additional
00:45:03.480 --> 00:45:08.280
constraints so say I'm asking our model
00:45:05.880 --> 00:45:10.720
for some Hobbies I could use to stay in
00:45:08.280 --> 00:45:11.920
to stay in shape and no matter what I
00:45:10.720 --> 00:45:14.160
don't want the model to recommend
00:45:11.920 --> 00:45:16.880
climbing like I I just I don't want this
00:45:14.160 --> 00:45:18.400
as an option I've tried it I'm not a fan
00:45:16.880 --> 00:45:21.240
um how do I get the model to stop
00:45:18.400 --> 00:45:22.760
suggesting climbing to me and if you've
00:45:21.240 --> 00:45:24.559
sort of played around with some of the
00:45:22.760 --> 00:45:26.200
more recent llms you'd say maybe this is
00:45:24.559 --> 00:45:27.480
easy right you just tell the model the
00:45:26.200 --> 00:45:30.160
instruction that you don't want to talk
00:45:27.480 --> 00:45:31.640
about climbing and having talked to Bard
00:45:30.160 --> 00:45:33.640
recently I can tell you unfortunately
00:45:31.640 --> 00:45:34.800
that it's not that easy so I tell the
00:45:33.640 --> 00:45:36.599
model I don't want to talk about
00:45:34.800 --> 00:45:38.000
climbing it does okay for a little bit
00:45:36.599 --> 00:45:40.920
and then it's like all right but maybe
00:45:38.000 --> 00:45:42.359
you want to try rap climbing um and so
00:45:40.920 --> 00:45:44.559
we could continue trying to instruction
00:45:42.359 --> 00:45:46.200
to our model but maybe there's sort of a
00:45:44.559 --> 00:45:49.079
way to impose this constraint on the
00:45:46.200 --> 00:45:50.680
decoding side instead and so I'd say all
00:45:49.079 --> 00:45:52.960
right I'm going to do something dramatic
00:45:50.680 --> 00:45:54.440
right I know I can manipulate the
00:45:52.960 --> 00:45:56.200
probability distribution I'm just going
00:45:54.440 --> 00:45:57.920
to set the probability of climbing to be
00:45:56.200 --> 00:46:00.440
zero I don't want to see this token like
00:45:57.920 --> 00:46:02.640
I'm I'm completely over it um and this
00:46:00.440 --> 00:46:04.839
is sort of nice in some sense because
00:46:02.640 --> 00:46:06.720
this is pretty easy to do um remember
00:46:04.839 --> 00:46:08.440
we're doing a soft Max over the outputs
00:46:06.720 --> 00:46:10.599
to choose this probability distribution
00:46:08.440 --> 00:46:12.400
and so if we add a huge negative number
00:46:10.599 --> 00:46:14.160
to the logic for climbing before we do
00:46:12.400 --> 00:46:15.520
this softmax its probability is going to
00:46:14.160 --> 00:46:18.640
be basically zero and we're never going
00:46:15.520 --> 00:46:20.240
to see it as an output um but this
00:46:18.640 --> 00:46:22.480
doesn't seem like a perfect solution
00:46:20.240 --> 00:46:24.400
right because you know what if the model
00:46:22.480 --> 00:46:26.160
recommends bouldering to me do I have to
00:46:24.400 --> 00:46:28.599
write like a sort of a list of every
00:46:26.160 --> 00:46:30.599
possible climbing synonym in the world
00:46:28.599 --> 00:46:32.079
um what if there's sort of an allowable
00:46:30.599 --> 00:46:33.920
way to use this token like I want the
00:46:32.079 --> 00:46:35.319
model to suggest hiking because climbing
00:46:33.920 --> 00:46:37.480
up a mountain to see a good view is
00:46:35.319 --> 00:46:38.720
relaxing but that's a use of the word
00:46:37.480 --> 00:46:41.400
climbing and we just said that we can't
00:46:38.720 --> 00:46:43.520
use the word climbing um or what if we
00:46:41.400 --> 00:46:45.480
sort of generate other related terms
00:46:43.520 --> 00:46:47.520
before we get to the restricted term
00:46:45.480 --> 00:46:49.359
like the model starts suggesting maybe
00:46:47.520 --> 00:46:51.480
you can work out by going to an indoor
00:46:49.359 --> 00:46:52.920
rock blank and then what are we going to
00:46:51.480 --> 00:46:54.800
say there's not we can't say rock
00:46:52.920 --> 00:46:57.079
climbing so maybe the model suggests
00:46:54.800 --> 00:46:58.640
rock climbing is rock collecting is a
00:46:57.079 --> 00:47:01.400
hobby to stay in shape and that doesn't
00:46:58.640 --> 00:47:03.480
sound good either um you could continue
00:47:01.400 --> 00:47:05.640
like sort of engineering more and more
00:47:03.480 --> 00:47:06.599
complicated rules here but maybe we
00:47:05.640 --> 00:47:08.760
could do something that's a little
00:47:06.599 --> 00:47:10.559
simpler so what if I just sample a bunch
00:47:08.760 --> 00:47:11.920
of outputs from the model and then I
00:47:10.559 --> 00:47:14.359
check if they're about climbing and I
00:47:11.920 --> 00:47:16.280
get rid of them if they are right um
00:47:14.359 --> 00:47:18.200
this is sort of the advantage that it's
00:47:16.280 --> 00:47:19.599
pretty easy to check after the fact if
00:47:18.200 --> 00:47:22.480
the sequence has satisfied this
00:47:19.599 --> 00:47:24.400
constraint you know we could train some
00:47:22.480 --> 00:47:26.200
smaller model to guess if the topic of a
00:47:24.400 --> 00:47:27.960
sentence is about climbing could check
00:47:26.200 --> 00:47:30.040
for keywords we could have a friend
00:47:27.960 --> 00:47:31.359
who's willing to see this content like
00:47:30.040 --> 00:47:33.040
filter through it and throw everything
00:47:31.359 --> 00:47:36.480
out that's not about climing that is
00:47:33.040 --> 00:47:38.280
about climbing but if this model um
00:47:36.480 --> 00:47:40.119
ascribes really high likelihood to this
00:47:38.280 --> 00:47:42.559
like if this model was trained on you
00:47:40.119 --> 00:47:44.760
know data from CS PhD students this
00:47:42.559 --> 00:47:46.240
could be an extremely high likelihood
00:47:44.760 --> 00:47:48.319
suggestion and so we might need to
00:47:46.240 --> 00:47:49.839
regenerate hundreds or thousands of
00:47:48.319 --> 00:47:52.559
sequences to find something that's not
00:47:49.839 --> 00:47:55.240
about climing um and that feels a little
00:47:52.559 --> 00:47:56.920
bit inefficient right so is there
00:47:55.240 --> 00:47:59.040
something that we can do that's a little
00:47:56.920 --> 00:48:01.599
bit better than that well really we'd
00:47:59.040 --> 00:48:03.200
like to guess at some point during our
00:48:01.599 --> 00:48:05.200
generation if the sequence is going to
00:48:03.200 --> 00:48:08.000
be about climbing and maybe like
00:48:05.200 --> 00:48:10.640
recalibrate or you know we could even
00:48:08.000 --> 00:48:12.079
restart or sort of shape Our Generations
00:48:10.640 --> 00:48:14.520
so that we don't wind up with a sequence
00:48:12.079 --> 00:48:16.319
that's about climbing in the first place
00:48:14.520 --> 00:48:19.359
um one of the methods that we'll discuss
00:48:16.319 --> 00:48:20.920
to do this is a method called fudge um
00:48:19.359 --> 00:48:22.800
and unfortunately in their paper they
00:48:20.920 --> 00:48:24.240
don't have the same anti-climbing bias I
00:48:22.800 --> 00:48:27.000
do so this example is actually about
00:48:24.240 --> 00:48:29.000
formality instead um the idea here is
00:48:27.000 --> 00:48:32.079
that we want a sequence output of the
00:48:29.000 --> 00:48:34.079
model that is sort of satisfies this
00:48:32.079 --> 00:48:36.079
constraint of being formal and the way
00:48:34.079 --> 00:48:39.960
we're going to do this is at each step
00:48:36.079 --> 00:48:41.640
of prediction we get the outputs of what
00:48:39.960 --> 00:48:44.160
the model predicts is the next token
00:48:41.640 --> 00:48:47.319
right this sort of distribution here in
00:48:44.160 --> 00:48:49.760
blue and we also have some second
00:48:47.319 --> 00:48:52.079
distribution which says given sort of
00:48:49.760 --> 00:48:54.480
what we have so far How likely is this
00:48:52.079 --> 00:48:56.920
to be a formal sentence at the end right
00:48:54.480 --> 00:48:58.880
does a sentence that starts do you want
00:48:56.920 --> 00:49:01.200
have a high likelihood of being formal
00:48:58.880 --> 00:49:04.559
versus a sentence that starts do you
00:49:01.200 --> 00:49:07.200
prefer and so this sort of guess at what
00:49:04.559 --> 00:49:09.520
will be formal at the end of the um
00:49:07.200 --> 00:49:10.960
generation will put High likelihood on
00:49:09.520 --> 00:49:13.599
things that result in really formal
00:49:10.960 --> 00:49:15.880
sentences like do you prefer or do you
00:49:13.599 --> 00:49:17.200
thus whereas the original model might
00:49:15.880 --> 00:49:19.440
have higher likelihood on things that
00:49:17.200 --> 00:49:22.559
are maybe more commonly said like do you
00:49:19.440 --> 00:49:24.319
want um so we combine these two
00:49:22.559 --> 00:49:26.280
distributions you can just multiply them
00:49:24.319 --> 00:49:29.079
together and then we sample from this
00:49:26.280 --> 00:49:30.520
modified distribution which now has some
00:49:29.079 --> 00:49:32.359
sort of high weight on things that the
00:49:30.520 --> 00:49:33.559
model thinks are likely but also takes
00:49:32.359 --> 00:49:35.960
into account the likelihood of
00:49:33.559 --> 00:49:38.240
satisfying a constraint um this is
00:49:35.960 --> 00:49:40.640
another sort of method of modifying or
00:49:38.240 --> 00:49:42.520
sampling distribution um with some
00:49:40.640 --> 00:49:44.520
external information here and so there's
00:49:42.520 --> 00:49:47.440
results and sequences that wind up being
00:49:44.520 --> 00:49:48.799
sort of more likely to be formal without
00:49:47.440 --> 00:49:50.280
having to sample a whole bunch of
00:49:48.799 --> 00:49:52.880
sentences and reject the ones that we
00:49:50.280 --> 00:49:54.720
think don't satisfy this constraint so
00:49:52.880 --> 00:49:57.119
how do we get sort of a guess of what
00:49:54.720 --> 00:49:58.839
will be formal at the end of Generation
00:49:57.119 --> 00:50:01.319
Um this is where the name fudge comes
00:49:58.839 --> 00:50:03.319
from the fud stands for future
00:50:01.319 --> 00:50:06.640
discriminator and so what they do is
00:50:03.319 --> 00:50:08.920
they train a model on prefixes to guess
00:50:06.640 --> 00:50:10.400
whether that sequence will be formal um
00:50:08.920 --> 00:50:12.040
you can do this if you have a bunch of
00:50:10.400 --> 00:50:15.319
data that's sort of sorted into formal
00:50:12.040 --> 00:50:17.720
and not formal right every um sort of
00:50:15.319 --> 00:50:20.119
prefix of a sentence in the formal
00:50:17.720 --> 00:50:21.480
category is a training example right you
00:50:20.119 --> 00:50:23.720
know a sentence that starts do you
00:50:21.480 --> 00:50:27.599
prefer you can shop off each token to
00:50:23.720 --> 00:50:29.920
get sort of a um set of sequ of prefixes
00:50:27.599 --> 00:50:31.160
to sequences that have the label formal
00:50:29.920 --> 00:50:33.559
and you can do the same thing to your
00:50:31.160 --> 00:50:34.920
informal set and train a discriminator
00:50:33.559 --> 00:50:36.559
to choose between them to say like
00:50:34.920 --> 00:50:38.400
what's the probability the sentence but
00:50:36.559 --> 00:50:41.160
will belong to the formal set when we
00:50:38.400 --> 00:50:43.319
finish and so this idea of sort of
00:50:41.160 --> 00:50:44.359
trying to guess at a given decoding step
00:50:43.319 --> 00:50:49.480
if we're going to wind up with our
00:50:44.359 --> 00:50:50.799
constraints satisfied at the end um is a
00:50:49.480 --> 00:50:53.000
sort of key way to do constraint
00:50:50.799 --> 00:50:56.000
decoding um and one that we'll return to
00:50:53.000 --> 00:50:58.280
in just a couple slides here
00:50:56.000 --> 00:51:00.440
I want to talk touch on something
00:50:58.280 --> 00:51:03.079
slightly different which is that maybe
00:51:00.440 --> 00:51:04.599
one of the constraints we care about is
00:51:03.079 --> 00:51:07.319
something a little more nebulous like we
00:51:04.599 --> 00:51:09.160
want to match human preference um the
00:51:07.319 --> 00:51:12.079
way that we usually accomplish this
00:51:09.160 --> 00:51:14.920
constraint is a little bit different
00:51:12.079 --> 00:51:16.040
right um this we' usually do through
00:51:14.920 --> 00:51:18.839
like reinforcement learning through
00:51:16.040 --> 00:51:21.559
human feedback um and so we take sort of
00:51:18.839 --> 00:51:24.960
our original model distribution and we
00:51:21.559 --> 00:51:27.960
take a sort of really like tight like
00:51:24.960 --> 00:51:30.200
distrib tion of evidence that says like
00:51:27.960 --> 00:51:31.680
um this model says that this sequence is
00:51:30.200 --> 00:51:33.960
really high reward this sequence is
00:51:31.680 --> 00:51:35.640
really low reward and we try to sort of
00:51:33.960 --> 00:51:38.200
combine them somehow through training so
00:51:35.640 --> 00:51:41.240
we get a new model that is um quote
00:51:38.200 --> 00:51:43.240
unquote aligned and that it has like a
00:51:41.240 --> 00:51:45.280
higher likelihood of giving us things
00:51:43.240 --> 00:51:48.640
that have really high reward according
00:51:45.280 --> 00:51:51.319
to our reward distribution um you can
00:51:48.640 --> 00:51:53.599
view this though as a type of basian
00:51:51.319 --> 00:51:55.119
inference and so what this means is the
00:51:53.599 --> 00:51:57.440
distribution that we really want to get
00:51:55.119 --> 00:51:59.880
at the end is a distribution that
00:51:57.440 --> 00:52:03.160
combines our original models
00:51:59.880 --> 00:52:05.680
distribution and some idea of like How
00:52:03.160 --> 00:52:08.480
likely we are to satisfy the reward
00:52:05.680 --> 00:52:10.720
right um this we do through
00:52:08.480 --> 00:52:12.359
reinforcement learning but if we sort of
00:52:10.720 --> 00:52:14.480
know what these two distributions look
00:52:12.359 --> 00:52:16.119
like we've we've just been talking about
00:52:14.480 --> 00:52:17.680
a lot of methods that modify the
00:52:16.119 --> 00:52:20.119
original models distribution with
00:52:17.680 --> 00:52:21.880
external information it seems like maybe
00:52:20.119 --> 00:52:24.760
we could just add that external
00:52:21.880 --> 00:52:26.200
information in at decoding time to get
00:52:24.760 --> 00:52:29.040
some of the same
00:52:26.200 --> 00:52:31.040
effects um and it turns out you can do
00:52:29.040 --> 00:52:32.799
exactly this so this is a paper from
00:52:31.040 --> 00:52:36.680
last year called reward augmented
00:52:32.799 --> 00:52:39.079
decoding and the idea here is sort of um
00:52:36.680 --> 00:52:41.839
in the same conceptual class as fudge
00:52:39.079 --> 00:52:44.079
but instead of um predicting whether
00:52:41.839 --> 00:52:46.079
we're likely to satisfy the constraint
00:52:44.079 --> 00:52:47.599
we're predicting how much reward we
00:52:46.079 --> 00:52:49.880
think that sequence will have at the end
00:52:47.599 --> 00:52:52.599
of generation so we take our original
00:52:49.880 --> 00:52:54.839
model without doing any rhf and we get
00:52:52.599 --> 00:52:58.160
the output we get the predictions for
00:52:54.839 --> 00:52:59.400
the next token and then we use a model
00:52:58.160 --> 00:53:02.359
that's been trained to predict the
00:52:59.400 --> 00:53:05.040
likely reward given some prefix like a
00:53:02.359 --> 00:53:06.720
future discriminator and we calculate
00:53:05.040 --> 00:53:08.200
the likely reward if we pick each of
00:53:06.720 --> 00:53:09.799
those tokens and then we use the
00:53:08.200 --> 00:53:12.319
combination of those two distributions
00:53:09.799 --> 00:53:13.720
to choose what to decode next um and
00:53:12.319 --> 00:53:16.000
this sort of gives you some of the
00:53:13.720 --> 00:53:18.440
benefits of rlf without actually having
00:53:16.000 --> 00:53:21.200
to do reinforcement learning so it's a
00:53:18.440 --> 00:53:23.160
way of treating like aligning to human
00:53:21.200 --> 00:53:26.839
feedback as just another constraint that
00:53:23.160 --> 00:53:30.400
you can impose at decoding point
00:53:26.839 --> 00:53:32.319
so those were sort of a a subset of the
00:53:30.400 --> 00:53:34.280
um constrains decoding strategies that
00:53:32.319 --> 00:53:35.799
people use um before we get into the
00:53:34.280 --> 00:53:38.400
human and the loop stack are there any
00:53:35.799 --> 00:53:38.400
questions on
00:53:39.040 --> 00:53:43.599
this yes for
00:53:44.960 --> 00:53:48.319
the do you have
00:53:52.799 --> 00:53:57.440
to right so for the discrimin do you
00:53:55.640 --> 00:54:00.000
need to train one for every constraint
00:53:57.440 --> 00:54:01.440
and you do yeah so you need to have some
00:54:00.000 --> 00:54:02.920
set of data that satisfies your
00:54:01.440 --> 00:54:05.319
constraint and some set of data that
00:54:02.920 --> 00:54:08.200
doesn't before you can enforce a new
00:54:05.319 --> 00:54:10.200
constraint in an alternative might be
00:54:08.200 --> 00:54:12.040
like in the paper that's what they did
00:54:10.200 --> 00:54:16.400
but an alternative might be just to
00:54:12.040 --> 00:54:18.359
train a discriminator to determine
00:54:16.400 --> 00:54:20.880
whether any constraint was violated so
00:54:18.359 --> 00:54:23.359
if you have 100 constraints you could do
00:54:20.880 --> 00:54:25.599
a binary prier about whether any
00:54:23.359 --> 00:54:26.880
constraint is violated and then
00:54:25.599 --> 00:54:29.040
also
00:54:26.880 --> 00:54:30.559
sufficient but if you wanted to add a
00:54:29.040 --> 00:54:34.079
new constraint you'd still have to
00:54:30.559 --> 00:54:34.079
retrain or you have to retrain
00:54:35.160 --> 00:54:41.319
or the the reason that this is sort of
00:54:38.119 --> 00:54:43.119
relatively reasonable to do is that this
00:54:41.319 --> 00:54:45.240
determination of if a constraint is
00:54:43.119 --> 00:54:46.960
likely to be violated is sort of a a
00:54:45.240 --> 00:54:48.520
lighter weight or an easier task to
00:54:46.960 --> 00:54:50.520
learn you can use a relatively small
00:54:48.520 --> 00:54:52.079
model for this versus like your big
00:54:50.520 --> 00:54:53.680
model just that has to be able to
00:54:52.079 --> 00:54:55.920
predict the next token for any sequence
00:54:53.680 --> 00:54:58.400
anymore yeah another another like
00:54:55.920 --> 00:55:00.760
interesting thing is if you think about
00:54:58.400 --> 00:55:01.520
it normally you're predicting with your
00:55:00.760 --> 00:55:04.119
big
00:55:01.520 --> 00:55:06.359
softmax like this over all of your
00:55:04.119 --> 00:55:09.680
vocabulary you can even use the same
00:55:06.359 --> 00:55:11.920
representations here to predict with a
00:55:09.680 --> 00:55:13.359
binary classifier uh whether the
00:55:11.920 --> 00:55:14.559
constraint is violated let's say you
00:55:13.359 --> 00:55:17.240
have 100
00:55:14.559 --> 00:55:19.240
constraints this is still a vector of
00:55:17.240 --> 00:55:21.520
size 100 compared to your vector of size
00:55:19.240 --> 00:55:26.240
32,000 that you're using for llama right
00:55:21.520 --> 00:55:28.280
so it's not like this adds the training
00:55:26.240 --> 00:55:32.799
would cost some time but it adds very
00:55:28.280 --> 00:55:32.799
little like inference time I guess
00:55:33.440 --> 00:55:38.960
basically the rock
00:55:35.880 --> 00:55:41.400
sound so when you do the constraint you
00:55:38.960 --> 00:55:43.160
use like a more General
00:55:41.400 --> 00:55:44.680
like do
00:55:43.160 --> 00:55:48.160
notest
00:55:44.680 --> 00:55:50.799
or I guess like in that constraint for
00:55:48.160 --> 00:55:50.799
you can add
00:55:52.559 --> 00:55:57.000
like, is there
00:55:57.880 --> 00:56:00.720
like is there a way to generalize your
00:55:59.400 --> 00:56:04.760
constraint would be like don't talk
00:56:00.720 --> 00:56:07.039
about this whole set of hobes um you
00:56:04.760 --> 00:56:08.960
could do that by training a
00:56:07.039 --> 00:56:10.400
discriminator um by training one
00:56:08.960 --> 00:56:12.359
discriminator that considers all of
00:56:10.400 --> 00:56:15.119
those or by training like a hundred
00:56:12.359 --> 00:56:17.559
different discriminators and then um
00:56:15.119 --> 00:56:19.520
sort of taking like the maximum score
00:56:17.559 --> 00:56:21.240
from any of them right like you want to
00:56:19.520 --> 00:56:23.240
you want to be able to exclude all of
00:56:21.240 --> 00:56:27.799
these things so you consider if any of
00:56:23.240 --> 00:56:30.720
them are violated yeah and for um reward
00:56:27.799 --> 00:56:32.839
augmented recoding how do we sort of
00:56:30.720 --> 00:56:36.039
like frame that reward model or is that
00:56:32.839 --> 00:56:38.400
just come from the previously done rhf
00:56:36.039 --> 00:56:41.079
data that the store from there and then
00:56:38.400 --> 00:56:44.119
you sort of like FR another
00:56:41.079 --> 00:56:47.880
discriminator but this one
00:56:44.119 --> 00:56:50.799
now I I fully understand yeah so how do
00:56:47.880 --> 00:56:52.920
we get the the reward model here this is
00:56:50.799 --> 00:56:55.280
we can use the same data that we' use
00:56:52.920 --> 00:56:58.000
for rhf but we need a slightly different
00:56:55.280 --> 00:57:01.119
model so for rhf we'll train a reward
00:56:58.000 --> 00:57:02.599
model over full sequences right and here
00:57:01.119 --> 00:57:05.280
we need to do the same trick where we
00:57:02.599 --> 00:57:07.280
sort of look at just prefixes and try to
00:57:05.280 --> 00:57:09.640
guess the reward Downstream but if we
00:57:07.280 --> 00:57:12.440
have already have preference data then
00:57:09.640 --> 00:57:15.119
we have some um like we have a data
00:57:12.440 --> 00:57:16.720
source to do this with I think if I'm
00:57:15.119 --> 00:57:19.240
remembering correctly they also had a
00:57:16.720 --> 00:57:20.920
couple more sort of tricks for data
00:57:19.240 --> 00:57:22.640
augmentation to get this to work this is
00:57:20.920 --> 00:57:25.720
sort of like a non-trivial thing to
00:57:22.640 --> 00:57:28.039
figure out um because like reward is
00:57:25.720 --> 00:57:30.200
generally a secret bual
00:57:28.039 --> 00:57:32.280
attribute and also if you don't know
00:57:30.200 --> 00:57:34.160
very much about rhf we're going to cover
00:57:32.280 --> 00:57:36.400
that the future class so don't worry if
00:57:34.160 --> 00:57:37.880
this is a yeah sorry to Jump Ahead a
00:57:36.400 --> 00:57:39.880
little no no
00:57:37.880 --> 00:57:43.640
wores
00:57:39.880 --> 00:57:47.240
yeah application this like why would we
00:57:43.640 --> 00:57:49.640
doing this to ensure it could be like
00:57:47.240 --> 00:57:52.839
our llm would want to highlight certain
00:57:49.640 --> 00:57:53.799
qualities like we want our evence to be
00:57:52.839 --> 00:57:55.960
more
00:57:53.799 --> 00:57:57.839
empathetic is there
00:57:55.960 --> 00:57:59.440
something yeah like what are the real
00:57:57.839 --> 00:58:01.280
world applications like could we use
00:57:59.440 --> 00:58:03.680
this to make L more empathetic or
00:58:01.280 --> 00:58:06.359
something yeah any any real attribute
00:58:03.680 --> 00:58:08.000
that you can sort of collect like
00:58:06.359 --> 00:58:09.839
positive and negative data for you could
00:58:08.000 --> 00:58:12.200
do this kind of constraints for I think
00:58:09.839 --> 00:58:15.119
the the ones you see most commonly are
00:58:12.200 --> 00:58:16.480
the human preference and then like
00:58:15.119 --> 00:58:18.839
negative constraints like you don't want
00:58:16.480 --> 00:58:20.000
your model to generate offensive content
00:58:18.839 --> 00:58:21.839
and if you can build like a good
00:58:20.000 --> 00:58:23.319
discriminator for is a sentence going in
00:58:21.839 --> 00:58:26.160
a really offensive Direction you can
00:58:23.319 --> 00:58:28.440
kind of stop it from gener
00:58:26.160 --> 00:58:30.480
yeah would it be a good idea if you
00:58:28.440 --> 00:58:33.760
generate a bunch of cons and ask the
00:58:30.480 --> 00:58:35.480
model itself whether it violates the
00:58:33.760 --> 00:58:37.319
yeah you could do that for sure could
00:58:35.480 --> 00:58:38.920
you ask like could you generate a bunch
00:58:37.319 --> 00:58:42.440
of samples and ask the model if it
00:58:38.920 --> 00:58:44.720
violates the constraint um this is also
00:58:42.440 --> 00:58:47.119
a type of sort of sample and then rerank
00:58:44.720 --> 00:58:52.319
strategy um but yeah this would be sort
00:58:47.119 --> 00:58:54.000
of a more um clever like less
00:58:52.319 --> 00:58:55.559
heavyweight version of this checking if
00:58:54.000 --> 00:58:57.319
it's about climate means right you'd
00:58:55.559 --> 00:58:58.520
like ask the model if it violated the
00:58:57.319 --> 00:59:00.160
constraint and if it's a good enough
00:58:58.520 --> 00:59:02.480
model it could probably do that pretty
00:59:00.160 --> 00:59:05.160
well I suppose in that case you don't
00:59:02.480 --> 00:59:08.160
have to thing anything yeah yeah and
00:59:05.160 --> 00:59:10.359
this is sort of a general like the
00:59:08.160 --> 00:59:12.240
generating text that like satisfies a
00:59:10.359 --> 00:59:14.079
constraint is harder than checking if a
00:59:12.240 --> 00:59:16.280
text satisfies a constraint so even if
00:59:14.079 --> 00:59:17.880
the model isn't good about like not
00:59:16.280 --> 00:59:19.440
generating text about climbing when you
00:59:17.880 --> 00:59:20.520
tell it to it might be able to tell if
00:59:19.440 --> 00:59:23.640
text is
00:59:20.520 --> 00:59:26.640
about yeah yeah so how do
00:59:23.640 --> 00:59:26.640
you
00:59:28.400 --> 00:59:32.359
have different
00:59:32.920 --> 00:59:36.319
different you have
00:59:36.599 --> 00:59:42.119
to yeah like how do you collect the data
00:59:38.839 --> 00:59:45.720
to train this discriminator um generally
00:59:42.119 --> 00:59:47.160
you're going to see like you'll look to
00:59:45.720 --> 00:59:48.720
see if there are data sets that already
00:59:47.160 --> 00:59:50.160
captured this attribute or you could
00:59:48.720 --> 00:59:51.599
sort of write her istics to try to
00:59:50.160 --> 00:59:53.839
recover it if it's an attribute that not
00:59:51.599 --> 00:59:55.480
a lot of other people care about like
00:59:53.839 --> 00:59:58.280
you could write your puristic to check
00:59:55.480 --> 01:00:00.160
if text is about climbing for instance
00:59:58.280 --> 01:00:02.359
um and then try to recover what noisy
01:00:00.160 --> 01:00:04.200
samples of data that is or is not about
01:00:02.359 --> 01:00:05.559
climbing maybe you could scrape a
01:00:04.200 --> 01:00:07.000
climbing forum and then scrape like a
01:00:05.559 --> 01:00:09.079
hiking forum and use the difference
01:00:07.000 --> 01:00:10.319
between them um but for a lot of tests
01:00:09.079 --> 01:00:11.760
there's actually pretty good data sets
01:00:10.319 --> 01:00:14.400
already out there for this so there's
01:00:11.760 --> 01:00:17.480
like in there's a lot of style transfer
01:00:14.400 --> 01:00:20.200
tasks that are like go from informal to
01:00:17.480 --> 01:00:22.240
formal or go from this to that or like
01:00:20.200 --> 01:00:24.039
make this text in an iic contamin and
01:00:22.240 --> 01:00:26.559
you can find like data from those
01:00:24.039 --> 01:00:26.559
sources
01:00:26.799 --> 01:00:31.599
we never like talked about F yet but I'm
01:00:29.520 --> 01:00:34.520
really curious with like the word a
01:00:31.599 --> 01:00:38.039
beting whether it would perform better
01:00:34.520 --> 01:00:39.079
than like fineing on RF like certainly
01:00:38.039 --> 01:00:42.720
more
01:00:39.079 --> 01:00:45.039
efficient but I I was I think this is a
01:00:42.720 --> 01:00:49.760
comparison they make in their paper but
01:00:45.039 --> 01:00:52.520
I don't remember their pun on yeah um in
01:00:49.760 --> 01:00:55.280
general there's this sort of a like you
01:00:52.520 --> 01:00:57.039
can pay a onetime kind of heavy cost to
01:00:55.280 --> 01:00:58.880
fine-tune or you can pay costs at
01:00:57.039 --> 01:01:01.160
inference time every time to make sort
01:00:58.880 --> 01:01:03.880
of a to make your model better in any of
01:01:01.160 --> 01:01:06.160
these ways and depending on how much
01:01:03.880 --> 01:01:09.119
inference you're playing do like one or
01:01:06.160 --> 01:01:09.119
the other of these could be
01:01:11.240 --> 01:01:16.400
better
01:01:12.839 --> 01:01:19.200
great so now we're going to talk about
01:01:16.400 --> 01:01:21.160
sort of methods for introducing human
01:01:19.200 --> 01:01:22.680
interaction into the decoding process
01:01:21.160 --> 01:01:25.240
and everything we've looked at so far
01:01:22.680 --> 01:01:26.920
has been very sort of black booss kind
01:01:25.240 --> 01:01:28.920
of hands off right like you give the
01:01:26.920 --> 01:01:30.640
model M some input maybe we do some kind
01:01:28.920 --> 01:01:33.640
of manipulation on the decoding side you
01:01:30.640 --> 01:01:37.160
get one output back right um but in a
01:01:33.640 --> 01:01:38.920
lot of situations where maybe you have
01:01:37.160 --> 01:01:40.960
some high-risk application and you need
01:01:38.920 --> 01:01:42.640
somebody to be consistently monitoring
01:01:40.960 --> 01:01:43.799
and maybe intervening or you're doing
01:01:42.640 --> 01:01:46.359
something where you want to do some kind
01:01:43.799 --> 01:01:47.960
of human AI collaboration um and you
01:01:46.359 --> 01:01:49.160
want to be able to go back and forth or
01:01:47.960 --> 01:01:50.960
you want to have a conversation with the
01:01:49.160 --> 01:01:53.480
model what you're actually doing is sort
01:01:50.960 --> 01:01:54.960
of a series of decodings with human
01:01:53.480 --> 01:01:56.319
intervention in between
01:01:54.960 --> 01:01:58.640
um and I'm going to talk about a couple
01:01:56.319 --> 01:02:00.760
of these strategies briefly I think if
01:01:58.640 --> 01:02:02.200
you've used sort of a modern llm you're
01:02:00.760 --> 01:02:04.440
probably familiar with at least a few of
01:02:02.200 --> 01:02:06.720
them already um we'll sort of put names
01:02:04.440 --> 01:02:08.359
to each of them and the set of examples
01:02:06.720 --> 01:02:10.880
that we're running with here are from a
01:02:08.359 --> 01:02:13.880
paper called wordcraft which is about um
01:02:10.880 --> 01:02:15.480
story generation with llm assistants but
01:02:13.880 --> 01:02:17.559
these can also be applied sort of more
01:02:15.480 --> 01:02:20.319
generally to any kind of task where
01:02:17.559 --> 01:02:23.799
you'd want to go back and forth with a
01:02:20.319 --> 01:02:25.319
model um the sort of easiest or maybe
01:02:23.799 --> 01:02:27.599
simplest place to start here is just
01:02:25.319 --> 01:02:29.760
with interleaving text right you can
01:02:27.599 --> 01:02:31.400
choose when the model starts and stops
01:02:29.760 --> 01:02:33.720
decoding and you can choose when a human
01:02:31.400 --> 01:02:34.920
is writing text in between and you can
01:02:33.720 --> 01:02:36.680
condition your model in sort of a
01:02:34.920 --> 01:02:39.240
mixture of human and model generated
01:02:36.680 --> 01:02:41.279
text to choose what to continue next um
01:02:39.240 --> 01:02:43.680
you can also do something like have the
01:02:41.279 --> 01:02:45.319
model generate a set of text edit that
01:02:43.680 --> 01:02:47.119
text in some way maybe the human is
01:02:45.319 --> 01:02:48.640
imposing some really subtle constraint
01:02:47.119 --> 01:02:50.559
like I want it to sound like my writing
01:02:48.640 --> 01:02:52.200
style we don't have a discriminator for
01:02:50.559 --> 01:02:54.119
this but the human can sort of modify
01:02:52.200 --> 01:02:55.680
the text and then continue generating
01:02:54.119 --> 01:02:57.160
from that point and that will influence
01:02:55.680 --> 01:03:01.160
the style of the text that continues
01:02:57.160 --> 01:03:03.240
being generative um a this case here is
01:03:01.160 --> 01:03:04.720
sort of a you're writing a story
01:03:03.240 --> 01:03:06.520
together and so you're going back and
01:03:04.720 --> 01:03:07.799
forth and editing the text like that but
01:03:06.520 --> 01:03:10.319
you can also think of any kind of
01:03:07.799 --> 01:03:11.920
conversation with a model as the same
01:03:10.319 --> 01:03:15.319
kind of interleaving of text right the
01:03:11.920 --> 01:03:17.000
model gives some um text you provide
01:03:15.319 --> 01:03:18.599
some text you go back and forth on like
01:03:17.000 --> 01:03:20.480
who's providing the text that conditions
01:03:18.599 --> 01:03:23.039
the
01:03:20.480 --> 01:03:24.880
model you also might want to do things
01:03:23.039 --> 01:03:26.760
like more fine brain replace
01:03:24.880 --> 01:03:28.559
so here the person has highlighted some
01:03:26.760 --> 01:03:31.640
text and said like make this more
01:03:28.559 --> 01:03:33.960
descriptive or shorten this to two words
01:03:31.640 --> 01:03:36.079
or maybe you want some additional
01:03:33.960 --> 01:03:38.520
constraint like can this be happier can
01:03:36.079 --> 01:03:40.960
this be sad like change the ending or
01:03:38.520 --> 01:03:43.760
something um you can accomplish this in
01:03:40.960 --> 01:03:45.799
a variety of ways um here this is done
01:03:43.760 --> 01:03:47.680
through input manipulation so you prompt
01:03:45.799 --> 01:03:50.359
your model differently with different
01:03:47.680 --> 01:03:52.200
constraints you can also do this with an
01:03:50.359 --> 01:03:54.440
actual modeling change like if you want
01:03:52.200 --> 01:03:56.119
some kind of infilling model um
01:03:54.440 --> 01:03:57.720
particularly for things like code this
01:03:56.119 --> 01:04:01.119
can be helpful so you want context from
01:03:57.720 --> 01:04:02.440
left and right sides um or you can do
01:04:01.119 --> 01:04:03.799
this with the decoding changes that we
01:04:02.440 --> 01:04:05.960
talked about in the previous section
01:04:03.799 --> 01:04:07.799
right you could add a discriminator for
01:04:05.960 --> 01:04:09.680
descriptiveness of text or you could do
01:04:07.799 --> 01:04:11.680
some kind of sampling ranking method to
01:04:09.680 --> 01:04:13.880
recover a more descriptive
01:04:11.680 --> 01:04:16.640
output another thing that's very common
01:04:13.880 --> 01:04:17.960
in this space is sampling and reranking
01:04:16.640 --> 01:04:20.839
methods where the human is the one
01:04:17.960 --> 01:04:23.640
choosing what to return right so in
01:04:20.839 --> 01:04:25.960
wordcraft you see a set of choices and
01:04:23.640 --> 01:04:28.200
you can choose text to insert but more
01:04:25.960 --> 01:04:30.720
commonly in something like um chat gbt
01:04:28.200 --> 01:04:33.160
or Bard you see this little option to
01:04:30.720 --> 01:04:34.880
regenerate text right you as the human
01:04:33.160 --> 01:04:36.160
can reject the text and say like no I
01:04:34.880 --> 01:04:38.680
don't like this give me a different
01:04:36.160 --> 01:04:41.359
output and this is also sort of a way of
01:04:38.680 --> 01:04:44.079
controlling decoding um just by doing it
01:04:41.359 --> 01:04:46.319
on on a human rather in an algorithmic
01:04:44.079 --> 01:04:49.279
level of course you don't necessarily
01:04:46.319 --> 01:04:51.200
need a human in here and so um some
01:04:49.279 --> 01:04:52.960
recent work has looked at functionally
01:04:51.200 --> 01:04:55.799
using models to make these decisions
01:04:52.960 --> 01:04:57.480
instead um this is a a a prompting paper
01:04:55.799 --> 01:05:00.359
called free of thought which was sort of
01:04:57.480 --> 01:05:02.279
very popular on Twitter last summer um
01:05:00.359 --> 01:05:06.119
and the idea here is that you're going
01:05:02.279 --> 01:05:08.480
to generate um several smaller sequences
01:05:06.119 --> 01:05:11.200
um like a couple of sentences a
01:05:08.480 --> 01:05:13.160
reasoning step or a thought in the paper
01:05:11.200 --> 01:05:14.839
and you're going to use a model to
01:05:13.160 --> 01:05:16.839
choose which ones to continue and you
01:05:14.839 --> 01:05:19.000
can do different sort of constraints
01:05:16.839 --> 01:05:21.960
here like I want to sort of rank this
01:05:19.000 --> 01:05:25.079
set of three or maybe I want to predict
01:05:21.960 --> 01:05:26.839
if any in this set is wrong like is this
01:05:25.079 --> 01:05:29.400
a good reasoning step and if the model
01:05:26.839 --> 01:05:32.240
says no you no longer continue that but
01:05:29.400 --> 01:05:33.559
the idea here is through prompting
01:05:32.240 --> 01:05:35.640
really achieving something that's sort
01:05:33.559 --> 01:05:38.960
of if you squint at it looks a lot like
01:05:35.640 --> 01:05:41.279
beam search right instead of doing a um
01:05:38.960 --> 01:05:43.160
like token level thing and making a
01:05:41.279 --> 01:05:45.079
decision based on likelihood you're
01:05:43.160 --> 01:05:47.880
generating sort of several sentences out
01:05:45.079 --> 01:05:50.599
a time and making a decision based on
01:05:47.880 --> 01:05:52.359
this models feedback right this signal
01:05:50.599 --> 01:05:53.799
from an external source which here is a
01:05:52.359 --> 01:05:55.279
model but could also be a human if
01:05:53.799 --> 01:05:57.920
you're willing willing to sort of wait
01:05:55.279 --> 01:06:01.559
around for them to make the decision and
01:05:57.920 --> 01:06:03.839
so this is a way of sort of giving
01:06:01.559 --> 01:06:06.640
feedback on a broader level than single
01:06:03.839 --> 01:06:09.079
tokens um to guide a decoding process to
01:06:06.640 --> 01:06:09.079
a final
01:06:09.839 --> 01:06:15.079
outut so the last couple of things we'll
01:06:12.760 --> 01:06:17.520
talk about here are sort of practical
01:06:15.079 --> 01:06:19.839
considerations speed choosing decoding
01:06:17.520 --> 01:06:22.599
methods um but I can take any questions
01:06:19.839 --> 01:06:22.599
before that
01:06:23.000 --> 01:06:26.000
to
01:06:26.760 --> 01:06:32.920
great so how do you make this fast and
01:06:30.359 --> 01:06:34.920
in particular if you've ever tried to
01:06:32.920 --> 01:06:36.920
sort of Benchmark performance of a model
01:06:34.920 --> 01:06:38.720
what you realize pretty quickly is that
01:06:36.920 --> 01:06:40.720
the vast majority of time is actually
01:06:38.720 --> 01:06:43.440
spent in decoding you have to generate
01:06:40.720 --> 01:06:45.319
one token at a time you have to sort of
01:06:43.440 --> 01:06:46.920
pass that back through the model to get
01:06:45.319 --> 01:06:51.279
conditioning to generate the next token
01:06:46.920 --> 01:06:53.599
and so this is um generally fairly slow
01:06:51.279 --> 01:06:54.839
um this is sort of a a major impediment
01:06:53.599 --> 01:06:56.359
if you're d to do something like a
01:06:54.839 --> 01:06:57.839
streaming application where you want or
01:06:56.359 --> 01:06:59.559
a chat application where you don't want
01:06:57.839 --> 01:07:03.599
the person to be waiting around for an
01:06:59.559 --> 01:07:06.799
answer um one way to do this is a method
01:07:03.599 --> 01:07:09.160
called Spectra of decoding and this is a
01:07:06.799 --> 01:07:12.599
method where you're using a smaller
01:07:09.160 --> 01:07:14.039
model um not as like we're in contrast
01:07:12.599 --> 01:07:16.240
of decoding right we're using a smaller
01:07:14.039 --> 01:07:17.559
model to decide what not to generate but
01:07:16.240 --> 01:07:20.119
here we're using a smaller model to
01:07:17.559 --> 01:07:21.880
decide be what to generate um and the
01:07:20.119 --> 01:07:24.960
idea here is that most of these tokens
01:07:21.880 --> 01:07:26.480
are maybe not super hard to side it's
01:07:24.960 --> 01:07:27.400
just that occasionally the bigger model
01:07:26.480 --> 01:07:30.240
might want to go in a different
01:07:27.400 --> 01:07:32.920
direction so these green tokens here are
01:07:30.240 --> 01:07:35.160
generated by a smaller model our amateur
01:07:32.920 --> 01:07:37.079
model here and the larger model acts
01:07:35.160 --> 01:07:39.960
largely as a verifier and what it does
01:07:37.079 --> 01:07:43.000
is it checks if the output so far is
01:07:39.960 --> 01:07:44.920
going in a an a Direction that's sort of
01:07:43.000 --> 01:07:46.400
in distribution for the big model like
01:07:44.920 --> 01:07:49.240
something that's within the realm of
01:07:46.400 --> 01:07:50.720
what it might SLE and to there's sort of
01:07:49.240 --> 01:07:52.400
an involved discussion in this paper of
01:07:50.720 --> 01:07:55.200
how you determine if something is in
01:07:52.400 --> 01:07:58.000
distribution um so here the smaller
01:07:55.200 --> 01:08:00.240
models generates like five or six tokens
01:07:58.000 --> 01:08:02.559
that the larger model says okay this
01:08:00.240 --> 01:08:03.680
looks great until it hits a token that
01:08:02.559 --> 01:08:06.079
the larger model would not have
01:08:03.680 --> 01:08:07.920
generated in that circumstance and then
01:08:06.079 --> 01:08:10.279
the larger model rejects that token and
01:08:07.920 --> 01:08:13.000
generates a different token instead so
01:08:10.279 --> 01:08:15.440
you can see here each of these red and
01:08:13.000 --> 01:08:17.600
then blue sections is where the larger
01:08:15.440 --> 01:08:19.400
model has rejected something and has to
01:08:17.600 --> 01:08:21.920
actually autor regressively decode a
01:08:19.400 --> 01:08:24.199
single token by contrast if you were
01:08:21.920 --> 01:08:27.359
doing regular decoding at each
01:08:24.199 --> 01:08:28.799
individual token in this sequence the um
01:08:27.359 --> 01:08:31.640
larger model would have had to make the
01:08:28.799 --> 01:08:35.359
fall forward pass to decoda token so
01:08:31.640 --> 01:08:37.359
here rather than de doing maybe what
01:08:35.359 --> 01:08:39.239
probably like 20ish decoding steps to
01:08:37.359 --> 01:08:41.560
get this full sequence the larger model
01:08:39.239 --> 01:08:43.040
has done about eight decoring steps and
01:08:41.560 --> 01:08:47.560
everything else is able to sort of
01:08:43.040 --> 01:08:49.759
verify a block of tokens at once um this
01:08:47.560 --> 01:08:51.400
sort of idea of like using a smaller
01:08:49.759 --> 01:08:54.120
model as an approximation is pretty
01:08:51.400 --> 01:08:55.839
powerful um and there's some great um
01:08:54.120 --> 01:08:58.159
followup work cons specul decoding and
01:08:55.839 --> 01:08:59.000
sort of ways to do this faster or with
01:08:58.159 --> 01:09:01.520
stronger
01:08:59.000 --> 01:09:04.839
guarantees um but this General concept
01:09:01.520 --> 01:09:06.920
is I would bet probably how models like
01:09:04.839 --> 01:09:09.080
um part of how models like chat GPT or
01:09:06.920 --> 01:09:11.159
Bard are sort of generating text so
01:09:09.080 --> 01:09:13.120
quickly um there's another element here
01:09:11.159 --> 01:09:16.159
which is like the model architecture
01:09:13.120 --> 01:09:17.679
being sparse but I think that um if you
01:09:16.159 --> 01:09:19.920
folks talk about mixture of experts we
01:09:17.679 --> 01:09:22.880
might get into that
01:09:19.920 --> 01:09:26.080
later um how do you do this kind of fast
01:09:22.880 --> 01:09:27.679
inference um libraries like BLM will
01:09:26.080 --> 01:09:29.440
Implement things I think Implement
01:09:27.679 --> 01:09:32.199
speculative decoding and Implement sort
01:09:29.440 --> 01:09:34.400
of Hardware level tricks like choosing
01:09:32.199 --> 01:09:37.799
which attention um weights to Cash wear
01:09:34.400 --> 01:09:39.199
to do faster inflence um there's also
01:09:37.799 --> 01:09:40.799
great libraries for doing things like
01:09:39.199 --> 01:09:42.679
constraint decoding so things like
01:09:40.799 --> 01:09:45.520
outlines will let you set constraints
01:09:42.679 --> 01:09:46.960
like I want my outputs to all be Json
01:09:45.520 --> 01:09:48.640
and it will impose additional
01:09:46.960 --> 01:09:50.839
constraints during decoding to ensure
01:09:48.640 --> 01:09:52.279
that that happens and then pretty much
01:09:50.839 --> 01:09:53.960
anything in these first couple of
01:09:52.279 --> 01:09:56.560
sections we talked about um like
01:09:53.960 --> 01:09:58.440
sampling mode seeking search and
01:09:56.560 --> 01:10:00.400
sometimes MBR will also be implemented
01:09:58.440 --> 01:10:05.080
in pretty much any Library you use for
01:10:00.400 --> 01:10:07.679
models like huggingface Fair seek or
01:10:05.080 --> 01:10:10.000
Jacks so to kind of take a step back
01:10:07.679 --> 01:10:12.520
here is when you get to the end of class
01:10:10.000 --> 01:10:15.640
um there's really two broad categories
01:10:12.520 --> 01:10:17.679
of methods that we talked about today um
01:10:15.640 --> 01:10:20.360
given our initial distribution from the
01:10:17.679 --> 01:10:22.600
model for a next token given our our
01:10:20.360 --> 01:10:24.920
input we can do two kind of different
01:10:22.600 --> 01:10:26.400
things we can each individual decoding
01:10:24.920 --> 01:10:28.360
step choose some kind of function to
01:10:26.400 --> 01:10:30.280
manipulate this distribution and this
01:10:28.360 --> 01:10:32.280
could be something like short like
01:10:30.280 --> 01:10:33.960
cutting off the long tail like modifying
01:10:32.280 --> 01:10:36.239
the temperature or adding external
01:10:33.960 --> 01:10:38.400
information from another model or from a
01:10:36.239 --> 01:10:41.480
discriminator model
01:10:38.400 --> 01:10:43.159
right or we can over a larger part of
01:10:41.480 --> 01:10:45.120
the decoding process choose some
01:10:43.159 --> 01:10:47.120
function to choose between sequences and
01:10:45.120 --> 01:10:49.199
this could be like choosing between next
01:10:47.120 --> 01:10:51.679
tokens in beam search when we pruning
01:10:49.199 --> 01:10:53.120
beams this could be choosing from Full
01:10:51.679 --> 01:10:56.760
sequences when we're doing something
01:10:53.120 --> 01:10:58.040
like MB r or sample and rerank methods
01:10:56.760 --> 01:11:00.239
um and you can do these two things in
01:10:58.040 --> 01:11:01.440
parallel right you can choose like a
01:11:00.239 --> 01:11:03.159
different function to manipulate the
01:11:01.440 --> 01:11:04.760
next token distribution and then some
01:11:03.159 --> 01:11:06.199
sort of like broader thing to choose
01:11:04.760 --> 01:11:08.280
what you do with the full sequences you
01:11:06.199 --> 01:11:09.920
get out of that distribution um but
01:11:08.280 --> 01:11:12.040
there are sort of these two broad
01:11:09.920 --> 01:11:14.880
categories of
01:11:12.040 --> 01:11:17.440
decoding so what should you take away
01:11:14.880 --> 01:11:19.400
from this um I think a couple of things
01:11:17.440 --> 01:11:21.000
you decoding methods can be really
01:11:19.400 --> 01:11:23.040
powerful to control features of your
01:11:21.000 --> 01:11:25.040
output if you want to impose particular
01:11:23.040 --> 01:11:26.679
constraints if you want to factor in
01:11:25.040 --> 01:11:27.960
reward function or factor in a data
01:11:26.679 --> 01:11:31.800
source that you maybe didn't have at
01:11:27.960 --> 01:11:34.239
training time um and to some extent you
01:11:31.800 --> 01:11:36.120
can do a more expensive decoding method
01:11:34.239 --> 01:11:37.520
to compensate for a worse model or to
01:11:36.120 --> 01:11:39.080
compensate for a model that hasn't been
01:11:37.520 --> 01:11:42.480
trained to do exactly the thing you want
01:11:39.080 --> 01:11:44.800
it to do um of course you can't you know
01:11:42.480 --> 01:11:47.679
use this to make gpt2 small as good as
01:11:44.800 --> 01:11:49.840
gp4 but you can sort of for some points
01:11:47.679 --> 01:11:51.679
in the middle spend more um computed
01:11:49.840 --> 01:11:53.159
inference time to pay for not spending
01:11:51.679 --> 01:11:55.639
as much computed training time and
01:11:53.159 --> 01:11:57.440
particularly if you don't have access to
01:11:55.639 --> 01:11:59.400
the kind of giant gpus you might need to
01:11:57.440 --> 01:12:01.840
continue fine-tuning your model this can
01:11:59.400 --> 01:12:05.679
be a really a really powerful
01:12:01.840 --> 01:12:07.800
alternative um yeah so say like you're
01:12:05.679 --> 01:12:12.560
building like something in production
01:12:07.800 --> 01:12:15.920
right people usually do um sort of like
01:12:12.560 --> 01:12:18.760
that you know inance before cling to see
01:12:15.920 --> 01:12:21.840
if it's G to work at do
01:12:18.760 --> 01:12:25.080
that like try to see like if you have a
01:12:21.840 --> 01:12:26.800
model that you can do some kind of
01:12:25.080 --> 01:12:29.199
expensive decoding method for to get
01:12:26.800 --> 01:12:31.120
good outputs is it then worth try
01:12:29.199 --> 01:12:34.000
training that model right um there's
01:12:31.120 --> 01:12:36.560
some great recent work on like training
01:12:34.000 --> 01:12:39.400
models to produce the same kind of
01:12:36.560 --> 01:12:40.760
outputs you get out of MVR without um
01:12:39.400 --> 01:12:43.239
actually doing a really expensive
01:12:40.760 --> 01:12:45.600
inference Stu so at some level like yeah
01:12:43.239 --> 01:12:48.120
you can decide like this model is good
01:12:45.600 --> 01:12:49.920
enough with its expensive method we can
01:12:48.120 --> 01:12:50.920
try to make it cheaper by spending more
01:12:49.920 --> 01:12:53.960
money on
01:12:50.920 --> 01:12:55.520
funing um but that's not it's not like
01:12:53.960 --> 01:12:57.320
necessarily guaranteed that that's will
01:12:55.520 --> 01:13:00.679
be the case
01:12:57.320 --> 01:13:03.040
Okay um the methods that we looked at
01:13:00.679 --> 01:13:06.199
have these sort of trade-offs in quality
01:13:03.040 --> 01:13:07.960
in diversity and in inference speed so
01:13:06.199 --> 01:13:10.320
sampling from your model directly is
01:13:07.960 --> 01:13:13.120
pretty fast to do you get really diverse
01:13:10.320 --> 01:13:14.960
outputs but it tends to be lower quality
01:13:13.120 --> 01:13:16.320
um whereas more restricted sampling
01:13:14.960 --> 01:13:18.520
these sort of mode seeking search
01:13:16.320 --> 01:13:20.639
methods tend to be higher quality but
01:13:18.520 --> 01:13:21.880
you get less less diverse outputs and
01:13:20.639 --> 01:13:23.560
that's why we have these methods like
01:13:21.880 --> 01:13:26.719
diverse and stochastic resarch to
01:13:23.560 --> 01:13:28.760
counter this a bit um and then methods
01:13:26.719 --> 01:13:30.400
like MBR or other sample and rerank
01:13:28.760 --> 01:13:32.679
methods tend to be very high quality
01:13:30.400 --> 01:13:34.280
outputs but you pay for this with much
01:13:32.679 --> 01:13:36.520
slower inference
01:13:34.280 --> 01:13:38.679
time um but if I can kind of convince
01:13:36.520 --> 01:13:41.560
you of anything today I think it would
01:13:38.679 --> 01:13:43.600
be this which is that these the decoding
01:13:41.560 --> 01:13:45.600
method you choose for your model has a
01:13:43.600 --> 01:13:47.960
really strong impact on performance
01:13:45.600 --> 01:13:49.520
Downstream um you can get radically
01:13:47.960 --> 01:13:51.239
different results out of the same model
01:13:49.520 --> 01:13:52.639
without doing any additional training
01:13:51.239 --> 01:13:55.120
just by choosing the different decoding
01:13:52.639 --> 01:13:57.880
method that you might want to try and so
01:13:55.120 --> 01:13:59.679
when you sort of let your libraries pick
01:13:57.880 --> 01:14:01.159
a quote unquote like sensible default
01:13:59.679 --> 01:14:03.760
you can leave a lot of performance on
01:14:01.159 --> 01:14:06.480
the train on the table so I encourage
01:14:03.760 --> 01:14:08.199
you folks that if if you're um deploying
01:14:06.480 --> 01:14:09.760
models in production or if you're doing
01:14:08.199 --> 01:14:10.840
research or you know maybe look at your
01:14:09.760 --> 01:14:13.280
outputs and your model has some
01:14:10.840 --> 01:14:15.320
undesirable behaviors to consider if the
01:14:13.280 --> 01:14:17.800
decoding method you're using is imposing
01:14:15.320 --> 01:14:20.000
some kind of Intuition or some kind of
01:14:17.800 --> 01:14:21.840
inductive bias and if you can alter that
01:14:20.000 --> 01:14:24.239
to get some of these behaviors without
01:14:21.840 --> 01:14:26.320
resorting to additional training
01:14:24.239 --> 01:14:28.719
um and that's sort of the end I can take
01:14:26.320 --> 01:14:28.719
any other
01:14:34.320 --> 01:14:38.719
questions okay um yeah I guess we don't
01:14:37.199 --> 01:14:41.360
have any questions we can take questions
01:14:38.719 --> 01:14:45.560
up here um one one thing I'd like to
01:14:41.360 --> 01:14:47.679
point out also is that um I I love the
01:14:45.560 --> 01:14:50.760
final thing that Amanda said here
01:14:47.679 --> 01:14:54.199
another thing is that my impression from
01:14:50.760 --> 01:14:56.400
dealing with things is that it's a lot
01:14:54.199 --> 01:14:58.159
easier to predict the effect of
01:14:56.400 --> 01:14:59.920
inference time decoding time
01:14:58.159 --> 01:15:01.120
manipulations than it is to predict the
01:14:59.920 --> 01:15:04.239
effect of
01:15:01.120 --> 01:15:07.480
like um fine-tuning or something like
01:15:04.239 --> 01:15:11.040
this like just to give a an
01:15:07.480 --> 01:15:12.480
example beam search with the maximum
01:15:11.040 --> 01:15:15.199
likelihood trained model tends to
01:15:12.480 --> 01:15:16.719
generate things that are shorter um
01:15:15.199 --> 01:15:18.040
whereas greedy decoding tends to
01:15:16.719 --> 01:15:19.639
generate things that are longer and
01:15:18.040 --> 01:15:22.000
repeat more often and stuff like that
01:15:19.639 --> 01:15:25.920
and if you try a few methods like this
01:15:22.000 --> 01:15:28.920
you'll quickly find these kind of qus of
01:15:25.920 --> 01:15:31.320
each of the methods and so by forming a
01:15:28.920 --> 01:15:32.719
good intuition of this you will also
01:15:31.320 --> 01:15:34.000
know how to fix these problems when you
01:15:32.719 --> 01:15:35.600
see them it's like oh my model's
01:15:34.000 --> 01:15:37.320
repeating itself a lot maybe I shouldn't
01:15:35.600 --> 01:15:38.679
be using grey search I should be
01:15:37.320 --> 01:15:41.199
switching over to something else or
01:15:38.679 --> 01:15:43.320
something like that so um this is a good
01:15:41.199 --> 01:15:45.880
thing to know and play around with yeah
01:15:43.320 --> 01:15:47.239
and I think pretty underutilized too um
01:15:45.880 --> 01:15:48.880
a lot of folks will not think about a
01:15:47.239 --> 01:15:50.920
decoding method to fix their problem
01:15:48.880 --> 01:15:52.280
even if like your model might actually
01:15:50.920 --> 01:15:53.760
be perfectly fine under a different
01:15:52.280 --> 01:15:56.000
decoding strategy
01:15:53.760 --> 01:15:58.320
great okay thanks a lot everyone you can
01:15:56.000 --> 01:15:58.320
uh
01:16:02.280 --> 01:16:05.280
finish
|