File size: 187,770 Bytes
837b615 |
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 |
{
"id": "2012.15723",
"annotator": "sarkar",
"input": [
"\\documentclass[11pt,a4paper]{article}\n",
"\\usepackage[hyperref]{acl2021}\n",
"\\usepackage{times}\n",
"\\usepackage{latexsym}\n",
"\\renewcommand{\\UrlFont}{\\ttfamily\\small}\n",
"\\usepackage{microtype}\n",
"\\usepackage{array}\n",
"\\usepackage{pifont}\n",
"\\usepackage{tabularx}\n",
"\\usepackage{adjustbox}\n",
"\\usepackage{multirow}\n",
"\\usepackage{enumitem}\n",
"\\usepackage{xspace}\n",
"\\usepackage{tcolorbox}\n",
"\\usepackage{booktabs,subcaption,amsfonts,dcolumn}\n",
"\\usepackage{hyperref}\n",
"\\usepackage{url}\n",
"\\usepackage{amsmath,amsthm,amsfonts,amssymb,bm,stmaryrd}\n",
"\\usepackage{xcolor}\t\t\n",
"\\usepackage[noorphans,vskip=0.75ex,leftmargin=2ex]{quoting}\n",
"\\aclfinalcopy \n",
"\\def\\aclpaperid{982} \n",
"\\definecolor{darkblue}{rgb}{0, 0, 0.5}\n",
"\\hypersetup{colorlinks=true, citecolor=darkblue, linkcolor=darkblue, urlcolor=darkblue}\n",
"\\usepackage[compact]{titlesec}\n",
"\\titlespacing{\\section}{0pt}{2ex}{1ex}\n",
"\\titlespacing{\\subsection}{0pt}{1ex}{1ex}\n",
"\\setlength{\\parskip}{0cm}\n",
"\\setlength{\\parindent}{1em}\n",
"\\providecommand{\\todo}[1]{\n",
"}\n",
"\\providecommand{\\danqi}[1]{\n",
" {\\protect\\color{purple}{[Danqi: #1]}}\n",
"}\n",
"\\providecommand{\\tianyu}[1]{\n",
" {\\protect\\color{blue}{[Tianyu: #1]}}\n",
"}\n",
"\\providecommand{\\adam}[1]{\n",
" {\\protect\\color{teal}{[Adam: #1]}}\n",
"}\n",
"\\newcommand{\\cmark}{\\ding{51}}\n",
"\\newcommand{\\xmark}{\\ding{55}}\n",
"\\newcommand\\sys[1]{\\textsc{#1}}\n",
"\\newcommand\\ti[1]{\\textit{#1}}\n",
"\\newcommand\\ts[1]{\\textsc{#1}}\n",
"\\newcommand\\tf[1]{\\textbf{#1}}\n",
"\\newcommand\\ttt[1]{\\texttt{#1}}\n",
"\\newcommand\\mf[1]{\\mathbf{#1}}\n",
"\\newcommand\\tmp[1]{\\color{gray}{#1}}\n",
"\\newcommand\\warn[1]{\\textbf{\\color{red}{#1}}}\n",
"\\providecommand{\\todon}{\n",
" {\\protect\\color{red}{00.0 (0.0)}}\n",
"}\n",
"\\newcommand{\\ours}{LM-BFF\\xspace}\n",
"\\newcommand{\\dtrain}{\\mathcal{D}_{\\text{train}}}\n",
"\\newcommand{\\ddev}{\\mathcal{D}_{\\text{dev}}}\n",
"\\newcommand{\\dtest}{\\mathcal{D}_{\\text{test}}}\n",
"\\newcommand{\\seedset}{\\mathcal{S}_{\\text{seed}}}\n",
"\\newcommand{\\maskx}{\\texttt{<X>}}\n",
"\\newcommand{\\masky}{\\texttt{<Y>}}\n",
"\\newcommand{\\maskz}{\\texttt{<Z>}}\n",
"\\newcommand{\\lsent}{\\texttt{<}S_1\\ttt{>}}\n",
"\\newcommand{\\lfirstsent}{\\texttt{<}S_1\\ttt{>}}\n",
"\\newcommand{\\lsecondsent}{\\texttt{<}S_2\\ttt{>}}\n",
"\\newcommand{\\sent}{\\ttt{<}$S_1$\\ttt{>}}\n",
"\\newcommand{\\firstsent}{\\ttt{<}$S_1$\\ttt{>}}\n",
"\\newcommand{\\secondsent}{\\ttt{<}$S_2$\\ttt{>}}\n",
"\\newcommand{\\xinput}{{x}_{\\mathrm{in}}}\n",
"\\newcommand{\\xprompt}{x_{\\mathrm{prompt}}}\n",
"\\newcommand{\\gen}{\\mathrm{g}}\n",
"\\newcommand{\\template}{\\mathcal{T}}\n",
"\\newcommand{\\lwordset}{\\mathcal{W}}\n",
"\\newcommand{\\lwordmap}{\\mathcal{M}}\n",
"\\newcommand{\\vocabulary}{\\mathcal{V}}\n",
"\\newcommand{\\labelset}{\\mathcal{Y}}\n",
"\\newcommand{\\mapping}{\\mathcal{M}}\n",
"\\newcommand{\\totalk}{K_{\\text{tot}}}\n",
"\\newcommand{\\lm}{\\mathcal{L}}\n",
"\\newcommand{\\cls}{\\texttt{[CLS]}}\n",
"\\newcommand{\\sep}{\\texttt{[SEP]}}\n",
"\\newcommand{\\mask}{\\texttt{[MASK]}}\n",
"\\DeclareMathOperator*{\\argmax}{arg\\,max}\n",
"\\DeclareMathOperator*{\\argmin}{arg\\,min}\n",
"\\renewcommand{\\paragraph}[1]{\\vspace{0.2cm}\\noindent\\textbf{#1}}\n",
"\\newcommand{\\tpf}[1]{\\noindent\\textbf{#1}}\n",
"\\newcommand{\\tableindent}{~~}\n",
"\\newcommand\\BibTeX{B\\textsc{ib}\\TeX}\n",
"\\title{Making Pre-trained Language Models Better Few-shot Learners}\n",
"\\author{Tianyu Gao$^{\\dagger*}$ \\quad Adam Fisch$^{\\ddagger*}$ \\quad Danqi Chen$^{\\dagger}$ \\\\\n",
"$^{\\dagger}$Princeton University\\quad $^{\\ddagger}$Massachusetts Institute of Technology\\\\\n",
"\\ttt{\\{tianyug,danqic\\}@cs.princeton.edu}\\\\\n",
"\\ttt{[email protected]}\n",
"}\n",
"\\date{}\n",
"\\begin{document}\n",
"\\maketitle\n",
"\\renewcommand{\\thefootnote}{\\fnsymbol{footnote}}\n",
"\\footnotetext[1]{The first two authors contributed equally.}\n",
"\\renewcommand{\\thefootnote}{\\arabic{footnote}}\n",
"\\begin{abstract}\n",
"The recent GPT-3 model~\\cite{brown2020language} achieves remarkable few-shot performance solely by leveraging a natural-language prompt and a few task demonstrations as input context.\n",
"Inspired by their findings, we study few-shot learning in a more practical scenario, where we use smaller language models for which fine-tuning is computationally efficient.\n",
"\\end{abstract}\n",
"\\section{Introduction}\n",
"\\begin{figure*}[t]\n",
" \\centering\n",
" \\includegraphics[width=0.95\\textwidth]{figures/in_context3.pdf}\n",
" \\caption{An illustration of (a) masked language model (MLM) pre-training, (b) standard fine-tuning, and (c) our proposed {\\ours} using prompt-based fine-tuning with demonstrations. The underlined text is the task-specific \\emph{template}, and colored words are \\emph{label words}.}\n",
" \\label{fig:overview}\n",
"\\end{figure*}\n",
"\\label{sec:intro}\n",
"The GPT-3 model \\cite{brown2020language} has made waves in the NLP community by demonstrating astounding few-shot capabilities on myriad language understanding tasks.\n",
"Given only a \\ti{natural language prompt} and a few \\emph{demonstrations} of the task, GPT-3 is able to make accurate predictions without updating any of the weights of its underlying language model.\n",
"However, while remarkable, GPT-3 consists of 175B parameters, which makes it challenging to use in most real-wold applications.\n",
"In this work, we study a more practical scenario in which we only assume access to a moderately-sized language model such as BERT~\\cite{devlin2019bert} or RoBERTa~\\cite{liu2019roberta}, and a small number of examples (i.e., a \\emph{few-shot} setting), which we can use to fine-tune the weights of\n",
"the language model.\n",
"This setting is appealing as\n",
"(1) such models can be trained on typical research hardware;\n",
"(2) few-shot settings are realistic, as it is generally both easy to acquire a few annotations (e.g., 32 examples) and efficient to train on them; and\n",
"(3) updating parameters typically leads to better performance.\n",
"Inspired by GPT-3's findings, we propose several novel strategies for expanding its few-shot learning abilities to our setting, considering both classification and---for the first time---regression.\n",
"First, we follow the route of \\ti{prompt-based} prediction, first developed by the GPT series~\\cite{radford2018improving,radford2019language,brown2020language} for zero-shot prediction and recently studied by PET~\\cite{schick2020exploiting, schick2020size} for fine-tuning.\n",
"Prompt-based prediction treats the downstream task as a (masked) language modeling problem, where the model directly generates a textual response (referred to as a \\emph{label word}) to a given prompt defined by a task-specific \\emph{template} (see Figure~\\ref{fig:overview}(c)).\n",
"Finding the right prompts, however, is an art---requiring both domain expertise and an understanding of the language model's inner workings.\n",
"Even if significant effort is invested, manual prompts are likely to be suboptimal.\n",
"We address this issue by introducing automatic prompt generation, including a pruned brute-force search to identify the best working label words, and a novel decoding objective to automatically generate templates using the generative T5 model~\\cite{raffel2020exploring}---all of which only require the few-shot training data. This allows us to cheaply obtain effective prompts that match or outperform our manually chosen ones.\n",
"Second, we adopt the idea of incorporating demonstrations \n",
"as\n",
"additional context.\n",
"and we obtain gains up to 30\\\n",
"For instance, we find that a RoBERTa-large model achieves around 90\\\n",
"\\section{Related Work}\n",
"\\label{sec:related_work}\n",
"\\tpf{Language model prompting.} The GPT series~\\citep{radford2018improving,radford2019language,brown2020language} fueled the development of prompt-based learning,\n",
"and we follow many of its core concepts.\n",
"We are also greatly inspired by the recent PET work~\\citep{schick2020exploiting,schick2020size}, although they mainly focus on a semi-supervised setting where a large set of unlabeled examples are provided.\n",
"Furthermore, we deviate from their evaluation by providing a more rigorous framework, as we will discuss in \\S\\ref{sec:setup}.\n",
"Finally, there is a large body of work on prompting for mining knowledge from pre-trained models \\cite[][\\emph{inter alia}]{trinh2018simple,petroni2019language,davison2019commonsense,talmor2020olmpics}. Different from these works, we focus on leveraging prompting for fine-tuning on downstream tasks.\n",
"\\paragraph{Automatic prompt search.}\n",
"\\citet{schick2020exploiting} and \\citet{schick2020automatically} explore ways of identifying label words automatically,\n",
"however, none of these results lead to better performance compared to hand-picked ones.\n",
"Several other attempts have been made in addition---yet these approaches either operate in limited domains,\n",
"such as finding patterns to express specific relations~\\cite{jiang2020can},\n",
"or require a large number of examples for gradient-guided search~\\cite{shin2020autoprompt,zhong2021factual}. Our approach aims to develop general-purpose search methods that rely only on a few annotations.\n",
"\\paragraph{Fine-tuning of language models.} A number of recent studies have focused on better methods for fine-tuning language models~\\cite{howard2018universal,dodge2020fine,lee2020mixout, zhang2020revisiting}. These works mainly focus on optimization and regularization techniques to stabilize fine-tuning. Here we use standard optimization techniques, and instead mainly focus our efforts on better prompt-based fine-tuning in a more extreme few-shot setting. We anticipate that results of these studies are largely complementary to ours.\n",
"\\paragraph{Few-shot learning.} Broadly speaking, our setting is also connected to other few-shot learning paradigms in NLP, including\n",
"(1) {semi-supervised learning}~\\cite{miyato2017adversarial,xie2020unsupervised,chen2020mixtext}, where a set of unlabeled examples are given;\n",
"(2) {meta-learning}~\\cite{yu2018diverse,han2018fewrel,bansal2020learning,bansal2020self, bao2020fewshot}, where a set of auxiliary tasks are given; and\n",
"(3) {intermediate training}~\\cite{phang2018sentence,yin2020universal}, where a related, intermediate task is given. We deviate from these settings by making minimal assumptions about available resources: we only assume a few annotated examples and a pre-trained language model. Our focus is on understanding how far we can push without any other advantages.\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.98\\columnwidth}{!}{\n",
"\\begin{tabular}{llcrrrcl}\n",
"\\toprule\n",
"\\tf{Category} & \\tf{Dataset} & $|\\mathcal{Y}|$ & $L$ & \\#Train & \\#Test & \\tf{Type} & \\tf{Labels (classification tasks)} \\\\\n",
"\\bottomrule\n",
" & SST-2 & 2 & 19 & 6,920 & 872 & sentiment & positive, negative \\\\\n",
"& SST-5 & 5 & 18 & 8,544 & 2,210 & sentiment & v. pos., positive, neutral, negative, v. neg. \\\\\n",
"& MR & 2 & 20 & 8,662& 2,000 & sentiment & positive, negative \\\\\n",
"single- & CR & 2 & 19 & 1,775 & 2,000 & sentiment & positive, negative \\\\\n",
"sentence & MPQA & 2 & 3 & 8,606 & 2,000 & opinion polarity & positive, negative \\\\\n",
"& Subj & 2 & 23 & 8,000 & 2,000 & subjectivity & subjective, objective \\\\\n",
"& TREC & 6 & 10 & 5,452 & 500 & question cls. & abbr., entity, description, human, loc., num.\\\\\n",
"& CoLA & 2 & 8 & 8,551 & 1,042 & acceptability & grammatical, not\\_grammatical\\\\\n",
"\\midrule\n",
" & MNLI & 3 & 22/11 & 392,702 & 9,815 & NLI & entailment, neutral, contradiction\\\\\n",
"& SNLI & 3 & 14/8 & 549,367 & 9,842 & NLI & entailment, neutral, contradiction \\\\\n",
"sentence- & QNLI & 2 & 11/30 & 104,743 & 5,463 & NLI & entailment, not\\_entailment \\\\\n",
"pair & RTE & 2 & 49/10 & 2,490 & 277 & NLI & entailment, not\\_entailment \\\\\n",
" & MRPC & 2 & 22/21 & 3,668 & 408 & paraphrase & equivalent, not\\_equivalent \\\\\n",
"& QQP & 2 & 12/12 & 363,846 & 40,431 & paraphrase & equivalent, not\\_equivalent \\\\\n",
"& STS-B & $\\mathcal{R}$ & 11/11 & 5,749 & 1,500 & sent. similarity & - \\\\\n",
"\\bottomrule\n",
"\\end{tabular}\n",
"}\n",
"\\end{center}\n",
"\\caption{The datasets evaluated in this work. $|\\mathcal{Y}|$: \\# of classes for classification tasks (with one exception: STS-B is a real-valued regression task over the interval $[0, 5]$). $L$: average \\# of words in input sentence(s). Note that we only sample $\\dtrain$ and $\\ddev$ of $K \\times |\\labelset|$ examples from the original training set in our few-shot experiments (\\S\\ref{sec:setup}).}\n",
"\\label{tab:datasets}\n",
"\\end{table*}\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.98\\columnwidth}{!}{\n",
"\\begin{tabular}{lll}\n",
"\\toprule\n",
"\\tf{Task} & \\tf{Template} & \\tf{Label words}\\\\\n",
"\\midrule\n",
"SST-2 & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"SST-5 & {\\sent} It was {\\mask} . & v.positive: great, positive: good, neutral: okay, negative: bad, v.negative: terrible\\\\\n",
"MR & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"CR & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"Subj & {\\sent} This is {\\mask} . & subjective: subjective, objective: objective \\\\\n",
"TREC & {\\mask} : {\\sent} & abbreviation: Expression, entity: Entity, description: Description \\\\\n",
"&& human: Human, location: Location, numeric: Number \\\\\n",
"COLA & {\\sent} This is {\\mask} . & grammatical: correct, not\\_grammatical: incorrect \\\\\n",
"\\midrule\n",
"MNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, netural: Maybe, contradiction: No \\\\\n",
"SNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, netural: Maybe, contradiction: No\\\\\n",
"QNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, not\\_entailment: No \\\\\n",
"RTE & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, not\\_entailment: No \\\\\n",
"MRPC & {\\firstsent} {\\mask} , {\\secondsent} & equivalent: Yes, not\\_equivalent: No\\\\\n",
"QQP & {\\firstsent} {\\mask} , {\\secondsent} & equivalent: Yes, not\\_equivalent: No\\\\\n",
"STS-B & {\\firstsent} {\\mask} , {\\secondsent} & $y_u$: Yes, $y_l$: No \\\\\n",
"\\bottomrule\n",
"\\end{tabular}\n",
"}\n",
"\\end{center}\n",
"STS-B is a regression task (\\S\\ref{sec:regression}).\n",
"}\n",
"\\label{tab:manual_prompts}\n",
"\\vspace{-5pt}\n",
"\\end{table*}\n",
"\\section{Problem Setup}\n",
"\\label{sec:setup}\n",
"\\paragraph{Task formulation.}\n",
"In this work, we assume access to a pre-trained language model $\\lm$ that we wish to fine-tune on a task $\\mathcal{D}$ with a label space $\\labelset$. For the task, we only assume $K$ training examples \\emph{per class}\\footnote{For regression, we partition the data into two ``classes'' according to being above or below the median value.} for the task's training set $\\dtrain$, such that the total number of examples is $\\totalk = K \\times |\\labelset|$, and $\\dtrain = \\{(\\xinput^i, y^i)\\}_{i=1}^{\\totalk}$.\n",
"Our goal is then to develop task-agnostic learning strategies that generalize well to an unseen test set $(\\xinput^{\\text{test}}, y^{\\text{test}})\\sim \\dtest$. \n",
"For model selection and hyper-parameter tuning, we assume a development set $\\ddev$, of the same size as the few-shot training set, i.e., $|\\ddev| = |\\dtrain|$. This distinction is important: using a larger development set confers a significant advantage\n",
"(see our experiments in Appendix~\\ref{app:dev_size}),\n",
"and subverts our initial goal of learning from limited data.\\footnote{In contrast, \\newcite{schick2020exploiting,schick2020size} do not use a development set, and adopt a set of hyper-parameters based on practical considerations.\n",
"This is akin to ``shooting in the dark'' on a setting that we show can have unintuitive outcomes.}\n",
"\\paragraph{Evaluation datasets.}\n",
"including\n",
"8 tasks from the GLUE benchmark~\\cite{wang2019glue},\n",
"SNLI~\\cite{bowman2015large_snli}, and 6 other popular sentence classification tasks (SST-5, MR, CR, MPQA, Subj, TREC). All of the dataset details are provided in Appendix~\\ref{app:datasets}. For \\emph{single-sentence} tasks, the goal is to make a prediction based on an input sentence $\\xinput = x_1$, such as whether a movie review is positive or not. For \\emph{sentence-pair} tasks, the goal is to take a pair of input sentences $\\xinput = (x_1, x_2)$ and predict the relationship between them. We also interchangeably refer to the inputs as {\\firstsent} or (\\firstsent, \\secondsent).\n",
"Note that we mainly use SST-2 and SNLI for pilot experiments and model development, making it close to a true few-shot setting, at least for all the other datasets we evaluate on.\n",
"\\begin{comment}\n",
"\\vspace{-3pt}\n",
"\\begin{enumerate}[leftmargin=*]\n",
" \\item \\emph{Single-sentence tasks.} The goal is to make a prediction based on an input sentence $\\xinput = x_1$ (sometimes referred as \\firstsent), such as whether a movie review is positive or not.\n",
" Our tasks range from sentiment analysis to question classification and grammaticality assessment.\n",
" \\vspace{-3pt}\n",
" \\item \\emph{Sentence-pair tasks.} The goal is to make a prediction based on a pair of input sentences $\\xinput = (x_1, x_2)$ (sometimes referred as \\firstsent, \\secondsent), such as predicting the relationship between them.\n",
" Our tasks include natural language inference and paraphrase detection.\n",
"\\end{enumerate}\n",
"\\vspace{-3pt}\n",
"\\end{comment}\n",
"\\paragraph{Evaluation protocol.}\n",
"Systematically evaluating few-shot performance can be tricky.\n",
"It is well-known that\n",
"fine-tuning on small datasets can suffer from instability~\\cite{dodge2020fine,zhang2020revisiting}, and results may change dramatically given a new split of data.\n",
"This issue has also been discussed in\n",
"\\newcite{schick2020size}---they suggest using a fixed set of training examples. We argue that sampling\n",
"multiple splits gives a\n",
"more robust measure of performance,\n",
"and a better estimate of the variance.\n",
"We also observe that hyper-parameters\n",
"can make a significant difference,\n",
"thus we sweep multiple hyper-parameters for each data sample, and take the best setting as measured on the $\\ddev$ of that sample (see Appendix~\\ref{app:hyper_selection}).\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.98\\columnwidth}{!}{\n",
"\\begin{tabular}{lll}\n",
"\\toprule\n",
"\\tf{Task} & \\tf{Template} & \\tf{Label words}\\\\\n",
"\\midrule\n",
"SST-2 & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"SST-5 & {\\sent} It was {\\mask} . & v.positive: great, positive: good, neutral: okay, negative: bad, v.negative: terrible\\\\\n",
"MR & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"CR & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"Subj & {\\sent} This is {\\mask} . & subjective: subjective, objective: objective \\\\\n",
"TREC & {\\mask} : {\\sent} & abbreviation: Expression, entity: Entity, description: Description \\\\\n",
"&& human: Human, location: Location, numeric: Number \\\\\n",
"COLA & {\\sent} This is {\\mask} . & grammatical: correct, not\\_grammatical: incorrect \\\\\n",
"\\midrule\n",
"MNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, netural: Maybe, contradiction: No \\\\\n",
"SNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, netural: Maybe, contradiction: No\\\\\n",
"QNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, not\\_entailment: No \\\\\n",
"RTE & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, not\\_entailment: No \\\\\n",
"MRPC & {\\firstsent} {\\mask} , {\\secondsent} & equivalent: Yes, not\\_equivalent: No\\\\\n",
"QQP & {\\firstsent} {\\mask} , {\\secondsent} & equivalent: Yes, not\\_equivalent: No\\\\\n",
"STS-B & {\\firstsent} {\\mask} , {\\secondsent} & $y_u$: Yes, $y_l$: No \\\\\n",
"\\bottomrule\n",
"\\end{tabular}\n",
"}\n",
"\\end{center}\n",
"STS-B is a regression task (\\S\\ref{sec:regression}).\n",
"}\n",
"\\label{tab:manual_prompts}\n",
"\\vspace{-5pt}\n",
"\\end{table*}\n",
"\\section{Prompt-based Fine-tuning}\n",
"\\label{sec:prompt_finetuning}\n",
"Given a masked language model\n",
"$\\lm$,\n",
"we first convert input $\\xinput$ to a token sequence $\\tilde{x}$, and the language model $\\lm$ then\n",
"maps $\\tilde{x}$ to a sequence of hidden vectors $\\{\\mf{h}_k \\in \\mathbb{R}^d\\}$.\n",
"During standard fine-tuning, we usually take $\\tilde{x}_{\\text{single}} = \\cls x_1 \\sep$ or $\\tilde{x}_{\\text{pair}} = \\cls x_1 \\sep x_2 \\sep$.\n",
"For downstream classification tasks with a label space $\\labelset$, we train a task-specific head, $\\mathrm{softmax}(\\mf{W}_o \\mf{h}_{\\cls})$, by maximizing the log-probability of the correct label, where $\\mf{h}_{\\cls}$ is the hidden vector of \\cls, and $\\mf{W}_o \\in \\mathbb{R}^{\\mathcal{|\\labelset|} \\times d}$ is a set of randomly initialized parameters introduced at the start of fine-tuning.\n",
"Similarly, for a regression task, we can introduce $\\mf{w}_o \\in \\mathbb{R}^d$ and optimize the mean squared error between $\\mf{w}_o \\cdot \\mf{h}_{\\cls}$ and the gold label.\n",
"In either case, the number of new parameters can be substantial---for example, a simple binary classification task will introduce 2,048 new parameters for a RoBERTa-large model---making it challenging to learn from a small amount of annotated data (e.g., 32 examples).\n",
"An alternative approach to solving this problem is \\ti{prompt-based fine-tuning}, in which $\\lm$ is directly tasked with ``auto-completing'' natural language prompts. \n",
"For instance, we can formulate a binary sentiment classification task using a prompt with\n",
"input $x_1$\n",
"(e.g., ``\\ti{No reason to watch it .}'') as:\n",
"\\begin{equation*}\n",
" \\resizebox{.85\\hsize}{!}{\n",
" $\\xprompt = \\text{\\cls~$x_1$~{It was}~\\mask~. \\sep}$\n",
" }\n",
"\\end{equation*}\n",
"and let $\\lm$ decide whether it is more appropriate to fill in ``\\emph{great}'' (positive) or ``\\emph{terrible}'' (negative) for \\mask.\n",
"We now formalize this approach for classification and regression (\\S\\ref{sec:classification} and \\S\\ref{sec:regression}), and discuss the importance of prompt selection (\\S\\ref{sec:manual_prompts}).\n",
"\\subsection{Classification}\n",
"\\label{sec:classification}\n",
"Let $\\mapping \\colon \\labelset \\rightarrow \\vocabulary$ be a mapping from the task label space to individual words\\footnote{More generally, we can consider a one-to-many mapping $\\mapping\\colon \\labelset \\rightarrow 2^{|\\labelset|}$ in which we map labels to sets of words. However, we did not find significant gains in our experiments.}\n",
"in the vocabulary $\\vocabulary$ of $\\lm$.\n",
"Then for each $\\xinput$, let the manipulation ${x}_{\\mathrm{prompt}} = \\template(\\xinput)$\n",
"be a \\emph{masked language modeling} (MLM) input which contains one \\mask~token.\n",
"In this way, we can treat our task as an\n",
"MLM, and model the probability of predicting class $y \\in \\labelset$ as:\n",
"\\vspace{-10pt}\n",
"\\begin{equation}\n",
"\\label{eq:lm-classification}\n",
"\\resizebox{.85\\hsize}{!}{\n",
"$\\begin{aligned}\n",
"p(y \\mid \\xinput) &= p\\left(\\mask = \\mapping(y) \\mid \\xprompt\\right) \\\\\n",
"&=\\frac{\\exp\\left(\\mf{w}_{\\mapping(y)} \\cdot \\mf{h}_{\\mask}\\right)}{\\sum_{y' \\in \\labelset} {\\exp\\left(\\mf{w}_{\\mapping(y')} \\cdot \\mf{h}_{\\mask}\\right)}},\n",
"\\end{aligned}$\n",
"}\n",
"\\end{equation}\n",
"where $\\mf{h}_{\\mask}$ is the hidden vector of {\\mask} \n",
"and $\\mf{w}_v$ denotes the pre-softmax vector corresponding to $v \\in \\vocabulary$.\n",
"When supervised examples $\\{(\\xinput, y)\\}$ are available, $\\mathcal{L}$ can be fine-tuned to minimize the cross-entropy loss.\n",
"It is important to note that this approach re-uses the pre-trained weights $\\mf{w}_v$ and does not introduce any new parameters. It also reduces the gap between pre-training and fine-tuning, making it more effective in few-shot scenarios.\n",
"\\subsection{Regression}\n",
"\\label{sec:regression}\n",
"We assume the same basic setup as in classification, but treat the label space $\\labelset$ as a bounded interval $[v_l, v_u]$.\n",
"Inspired by ~\\citet{mettes2019hyperspherical},\n",
"we model the problem as an interpolation between two opposing poles, $\\{y_l, y_u\\}$, with values $v_l$ and $v_u$ respectively.\n",
"For instance, we can formulate our previous sentiment analysis task as a regression problem in the range $[0, 1]$, where we slide between ``\\emph{terrible}'' ($v_l = 0$) and ``\\emph{great}'' ($v_u = 1$). In this way, we can express $y$ as a \\emph{mixture model}:\n",
"\\begin{equation}\n",
" y = v_l \\cdot p(y_l \\mid \\xinput) + v_u \\cdot p(y_u \\mid \\xinput),\n",
"\\end{equation}\n",
"where $p(y_u \\mid \\xinput)$ is the probability of $y_u$, and $p(y_l \\mid \\xinput) = 1 - p(y_u \\mid \\xinput)$.\n",
"Then we define $\\mapping \\colon \\{y_l, y_u\\} \\rightarrow \\vocabulary$,\n",
"and model $p(y_u \\mid \\xinput)$ the same as Eq. (\\ref{eq:lm-classification}).\n",
"\\begin{comment}\n",
"\\begin{equation}\n",
"\\label{eq:lm-regression}\n",
"\\resizebox{.89\\hsize}{!}{$\\displaystyle\n",
"p(y_u \\mid \\xinput) = \\frac{\\exp\\left(\\mf{w}_{w_u} \\cdot \\mf{h}_{\\mask}\\right)}{\\sum_{w' \\in \\{w_u, w_l\\}}\\exp\\left(\\mf{w}_{w'} \\cdot \\mf{h}_{\\mask}\\right)}.\n",
"$}\n",
"\\end{equation}\n",
"\\end{comment}\n",
"We fine-tune $\\mathcal{L}$ to minimize the KL-divergence between the inferred $p(y_u \\mid \\xinput)$\n",
"and the observed mixture weight, $(y\n",
"- v_l) / (v_u - v_l)$.\n",
"\\begin{table}[!t]\n",
" \\centering\n",
" \\resizebox{0.95\\columnwidth}{!}{\n",
" \\begin{tabular}{l cc c}\n",
" \\toprule\n",
" \\midrule\n",
" \\multicolumn{2}{l}{SST-2 (positive/negative)} & mean (std)\\\\\n",
" \\midrule\n",
" {\\sent} It was {\\mask} . & great/terrible & \\tf{92.7 (0.9)} \\\\\n",
" {\\sent} It was {\\mask} . & good/bad & 92.5 (1.0) \\\\\n",
" {\\sent} It was {\\mask} . & cat/dog & 91.5 (1.4) \\\\\n",
" {\\sent} It was {\\mask} . & dog/cat & 86.2 (5.4) \\\\\n",
" {\\sent} It was {\\mask} . & terrible/great & 83.2 (6.9) \\\\\n",
" {Fine-tuning} & - & 81.4 (3.8) \\\\\n",
" \\midrule\n",
" \\multicolumn{2}{l}{SNLI (entailment/neutral/contradiction)} & mean (std)\\\\\n",
" \\midrule\n",
" {\\firstsent} ? {\\mask} , {\\secondsent} & Yes/Maybe/No & \\tf{77.2 (3.7)} \\\\\n",
" {\\firstsent} . {\\mask} , {\\secondsent} & Yes/Maybe/No & 76.2 (3.3) \\\\\n",
" {\\firstsent} ? {\\mask} {\\secondsent} & Yes/Maybe/No & 74.9 (3.0) \\\\\n",
" {\\firstsent} {\\secondsent} {\\mask} & Yes/Maybe/No & 65.8 (2.4) \\\\\n",
" {\\secondsent} ? {\\mask} , {\\firstsent} & Yes/Maybe/No & 62.9 (4.1) \\\\\n",
" {\\firstsent} ? {\\mask} , {\\secondsent} & Maybe/No/Yes & 60.6 (4.8) \\\\\n",
" {Fine-tuning} & - & 48.4 (4.8) \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" }\n",
" \\label{tab:prompt_search}\n",
"\\end{table}\n",
"\\subsection{Manual prompts: the good and the bad}\n",
"\\label{sec:manual_prompts}\n",
"The key challenge is to construct the template $\\template$ and label words $\\mapping(\\labelset)$---we refer to these two together as a \\ti{prompt} $\\mathcal{P}$.\n",
"Previous works~\\cite{schick2020exploiting,schick2020size} hand-craft both the templates and label words, which usually requires domain expertise and trial-and-error.\n",
"Table~\\ref{tab:manual_prompts}\n",
"These templates and label words were designed by intuition, and by considering formats used in previous literature. \n",
"the better the final accuracy is\n",
"(\\ti{great}/\\ti{terrible} $>$ \\ti{good}/\\ti{bad} $>$ \\ti{cat}/\\ti{dog}).\n",
"Furthermore, with the same set of label words,\n",
"can make a difference.\n",
"For example, for SNLI, if we put \\mask~at the end, or swap sentence order, we observe a $>$10\\\n",
"Searching for prompts, however, is hard, as the search space can be very large---especially for the template. Even worse, we only have a few examples to use to guide our search, which can easily overfit. We will address these issues next.\n",
"\\section{Automatic Prompt Generation}\n",
"\\label{sec:auto_prompt}\n",
"Here, we assume a classification task, but the process for regression is analogous.\n",
"\\subsection{Automatic selection of label words}\n",
"\\label{sec:label_search}\n",
"Naively searching all possible assignments, however, is (1) generally intractable, as the search space is exponential in the number of classes; and (2) prone to overfitting, as we will tend to uncover spurious correlations given only a few annotations. As a simple solution,\n",
"for each class $c \\in \\labelset$, we construct a pruned set $\\mathcal{V}^c \\subset \\mathcal{V}$ of the top $k$ vocabulary words based on their conditional likelihood using the initial $\\lm$. That is, let $\\dtrain^c \\subset \\dtrain$ be the subset of all examples of class $c$. We take $\\mathcal{V}^c$ as\n",
"\\begin{equation}\n",
"\\resizebox{.89\\hsize}{!}{$\\displaystyle\n",
" \\underset{v \\in \\mathcal{V}}{\\mathrm{Top}\\text{-}k} \\left\\{\\sum_{\\xinput \\in \\dtrain^c} \\hspace{-5pt}\\log P_{\\lm}\\Big(\\mask = v \\mid \\template(\\xinput)\\Big)\\right\\},\n",
"$}\n",
"\\end{equation}\n",
"where ${P}_{\\lm}$ denotes the output probability distribution of $\\lm$.\n",
"To further narrow down the search space, we find the top $n$ assignments over the pruned space that maximize zero-shot accuracy on $\\dtrain$ (both $n$ and $k$ are hyper-parameters, see\n",
"Appendix~\\ref{app:prompts}).\n",
"This approach is similar to the automatic verbalizer search methods in \\newcite{schick2020exploiting,schick2020automatically}, except that we use a much simpler search process (brute-force) and also apply re-ranking---which we find to be quite helpful.\n",
"\\subsection{Automatic generation of templates}\n",
"\\label{sec:template_search}\n",
"Next, we study how to generate a diverse set of templates $\\{\\template\\}$ automatically from a fixed set of label words $\\mapping(\\labelset)$.\n",
"To address this challenging problem, we propose to use T5~\\cite{raffel2020exploring}, a large pre-trained text-to-text Transformer.\n",
"T5 is pre-trained to fill in missing spans (replaced by T5 mask tokens, e.g., \\maskx~or \\masky) in its input.\n",
"For example, given the input ``\\ti{Thank you {\\maskx} me to your party {\\masky} week}'', T5 is trained to generate ``\\ti{{\\maskx} for inviting {\\masky} last {\\maskz}}'',\n",
"meaning that ``\\ti{for inviting}'' is the replacement for {\\maskx} and ``\\ti{last}'' is the replacement for {\\masky}.\n",
"This is well suited for prompt generation: we can simply take input sentences from $\\dtrain$ and let the T5 model construct the template $\\template$, without having to specify a pre-defined number of tokens for it.\n",
"Given an input example $(\\xinput, y) \\in \\dtrain$, \n",
"we consider the following simple conversions, denoted as $\\template_{\\gen}(\\xinput, y)$, for formulating the T5 model inputs:\\footnote{We consider putting the label word both before and after the input sentence for single-sentence tasks. However, we find that it is always better to put the label words in the middle (between the two sentences) for sentence-pair tasks.}\n",
"\\begin{equation*}\n",
"\\resizebox{.85\\hsize}{!}{\n",
"$\\begin{aligned}\n",
"\\lsent &\\longrightarrow~\\maskx~\\lwordmap(y)~\\masky~\\lsent, \\\\\n",
"\\lsent &\\longrightarrow~\\lsent~\\maskx~\\lwordmap(y)~\\masky,\\\\\n",
"\\lfirstsent,\\lsecondsent &\\longrightarrow \\lfirstsent~\\maskx~\\lwordmap(y)~\\masky~\\lsecondsent.\n",
"\\end{aligned}$\n",
"}\n",
"\\end{equation*}\n",
"As shown in Figure~\\ref{fig:template_search}, we rely on the T5 model to fill in the placeholders. \n",
"When decoding, our goal here is to find an output that can work well for \\emph{all} examples in $\\dtrain$,\n",
"i.e.,\n",
"where $P_{\\text{T5}}$ denotes the output probability distribution of T5.\n",
"It can be decomposed according to:\n",
"\\vspace{-0.5em}\n",
"\\begin{equation}\n",
"\\resizebox{.87\\hsize}{!}{$\\displaystyle\n",
" \\sum_{j = 1}^{|\\template|}\\hspace{-10pt}\\sum_{~~~~~(\\xinput, y) \\in \\dtrain} {\\hspace{-14pt}\\log{P_{\\text{T5}}\\big(t_j \\mid t_1,...,t_{j-1}, \\template_{\\gen}\\big(\\xinput,y\\big)\\big)}},\n",
"$}\n",
"\\end{equation}\n",
"where $(t_1, \\ldots, t_{|\\template|})$ are the template tokens.\n",
"\\begin{figure}[t]\n",
" \\centering\n",
" \\includegraphics[width=0.48\\textwidth]{figures/template_search.pdf}\n",
" \\caption{Our approach for template generation.\n",
" }\n",
" \\label{fig:template_search}\n",
" \\vspace{-5pt}\n",
"\\end{figure}\n",
"\\section{Fine-tuning with Demonstrations}\n",
"\\label{sec:demonstrations}\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.0\\textwidth}{!}{\n",
"\\begin{tabular}{lcccccccc}\n",
"\\toprule\n",
"& \\tf{SST-2} & \\tf{SST-5} & \\tf{MR} & \\tf{CR} & \\tf{MPQA} & \\tf{Subj} & \\tf{TREC} & \\tf{CoLA} \\\\\n",
"& (acc) & (acc) & (acc) & (acc) & (acc) & (acc) & (acc) & (Matt.)\\\\\n",
"\\midrule\n",
"Majority$^\\dagger$ & \\ti{50.9} & \\ti{23.1} & \\ti{50.0} & \\ti{50.0} & \\ti{50.0} & \\ti{50.0} & \\ti{18.8} & \\ti{0.0} \\\\\n",
"Prompt-based zero-shot$^\\ddagger$ & 83.6 &\t35.0 &\t80.8 &\t79.5 &\t67.6 &\t51.4 &\t32.0 &\t2.0 \\\\\n",
"``GPT-3'' in-context learning &84.8 (1.3) &\t30.6 (0.9) &\t80.5 (1.7) &\t87.4 (0.8) &\t63.8 (2.1) &\t53.6 (1.0) &\t26.2 (2.4) &\t-1.5 (2.4) \\\\\n",
"Fine-tuning & 81.4 (3.8) &\t43.9 (2.0) &\t76.9 (5.9) &\t75.8 (3.2) &\t72.0 (3.8) &\t90.8 (1.8) &\t{88.8} (2.1) &\t\\tf{33.9} (14.3) \\\\\n",
"\\midrule\n",
"Prompt-based FT (man) & 92.7 (0.9) &\t47.4 (2.5) &\t87.0 (1.2) &\t90.3 (1.0) &\t84.7 (2.2) &\t91.2 (1.1) &\t84.8 (5.1) &\t9.3 (7.3) \\\\\n",
"\\tableindent + demonstrations & 92.6 (0.5) &\t\\tf{50.6} (1.4) &\t86.6 (2.2) &\t90.2 (1.2) &\t\\tf{87.0} (1.1) &\t\\tf{92.3} (0.8) &\t87.5 (3.2) &\t18.7 (8.8) \t\\\\\n",
"Prompt-based FT (auto) & 92.3 (1.0) &\t49.2 (1.6) &\t85.5 (2.8) &\t89.0 (1.4) &\t85.8 (1.9) &\t91.2 (1.1) &\t88.2 (2.0) &\t14.0 (14.1) \\\\\n",
"\\tableindent + demonstrations & \\tf{93.0} (0.6) &\t49.5 (1.7) &\t\\tf{87.7} (1.4) &\t\\tf{91.0} (0.9) &\t86.5 (2.6) &\t91.4 (1.8) &\t\\tf{89.4} (1.7) &\t21.8 (15.9)\\\\\n",
"\\midrule\n",
"Fine-tuning (full)$^\\dagger$ & \\ti{95.0} & \\ti{58.7} & \\ti{90.8} & \\ti{89.4} & \\ti{87.8} & \\ti{97.0} & \\ti{97.4} & \\ti{62.6} \\\\\n",
"\\midrule\n",
" & \\tf{MNLI} & \\tf{MNLI-mm} & \\tf{SNLI} & \\tf{QNLI} & \\tf{RTE} & \\tf{MRPC} & \\tf{QQP} & \\tf{STS-B} \\\\\n",
" & (acc) & (acc) & (acc) & (acc) & (acc) & (F1) & (F1) & (Pear.)\\\\\n",
"\\midrule\n",
"Majority$^\\dagger$ & \\ti{32.7} & \\ti{33.0} & \\ti{33.8} & \\ti{49.5} & \\ti{52.7} & \\ti{81.2} & \\ti{0.0} & \\ti{-} \\\\\n",
"Prompt-based zero-shot$^\\ddagger$ &\t50.8 &\t51.7 &\t49.5 &\t50.8 &\t51.3 & 61.9 &\t49.7 &\t-3.2 \\\\\n",
"``GPT-3'' in-context learning & 52.0 (0.7) &\t53.4 (0.6) &\t47.1 (0.6) &\t53.8 (0.4) &\t60.4 (1.4) &\t45.7 (6.0) &\t36.1 (5.2) &\t14.3 (2.8) \\\\\n",
"Fine-tuning &\t45.8 (6.4) &\t47.8 (6.8) &\t48.4 (4.8) &\t60.2 (6.5) &\t54.4 (3.9) & {76.6} (2.5) &\t60.7 (4.3) &\t53.5 (8.5) \\\\\n",
"\\midrule\n",
"Prompt-based FT (man) &\t68.3 (2.3) &\t70.5 (1.9) &\t77.2 (3.7) &\t64.5 (4.2) &\t69.1 (3.6) & 74.5 (5.3) &\t65.5 (5.3) &\t71.0 (7.0) \\\\\n",
"\\tableindent + demonstrations &\t\\tf{70.7} (1.3) &\t\\tf{72.0} (1.2) &\t\\tf{79.7} (1.5) &\t\\tf{69.2} (1.9) &\t68.7 (2.3) & 77.8 (2.0) &\t\\tf{69.8} (1.8) &\t73.5 (5.1) \t\\\\\n",
"Prompt-based FT (auto) &\t68.3 (2.5) &\t70.1 (2.6) &\t77.1 (2.1) &\t68.3 (7.4) &\t\\tf{73.9} (2.2) & 76.2 (2.3) &\t67.0 (3.0) &\t75.0 (3.3) \\\\\n",
"\\tableindent + demonstrations & 70.0 (3.6) &\t\\tf{72.0} (3.1) &\t77.5 (3.5) &\t68.5 (5.4) &\t{71.1} (5.3) &\t\\tf{78.1} (3.4) &\t67.7 (5.8) &\t\\tf{76.4} (6.2) \\\\\n",
"\\midrule\n",
"Fine-tuning (full)$^\\dagger$ & \\ti{89.8} &\t\\ti{89.5} & \\ti{92.6}\t &\t\\ti{93.3} &\t\\ti{80.9} &\t\\ti{91.4} &\t\\ti{81.7} & \\ti{91.9} \\\\\n",
"\\bottomrule\n",
"\\end{tabular}}\n",
"\\end{center}\n",
"\\caption{\n",
"Our main results using RoBERTa-large.\n",
"$\\dagger$: full training set is used (see dataset sizes in\n",
"Table~\\ref{tab:datasets});\n",
"$\\ddagger$: no training examples are used; otherwise we use\n",
"$K = 16$ (per class)\n",
"for few-shot experiments.\n",
"We report mean (and standard deviation) performance over 5 different splits (\\S \\ref{sec:setup}).\n",
"{Majority:} majority class;\n",
"{FT:} fine-tuning;\n",
"{man:} manual prompt\n",
"(Table~\\ref{tab:manual_prompts});\n",
"{auto:} automatically searched templates (\\S\\ref{sec:template_search});\n",
"{``GPT-3'' in-context learning:} using the in-context learning proposed in \\newcite{brown2020language} with RoBERTa-large (no parameter updates).\n",
"}\n",
"\\label{tab:main_results}\n",
"\\end{table*}\n",
"In this section, we study whether we can leverage demonstrations when \\ti{fine-tuning} medium-sized LMs, and find better ways to exploit them.\n",
"\\subsection{Training examples as demonstrations}\n",
"GPT-3's naive approach to in-context learning simply involves concatenating the input with up to 32 examples randomly drawn from the training set.\n",
"This approach is suboptimal as\n",
"(1) the number of available demonstrations is bounded by the model's maximum input length;\\footnote{GPT-3 uses a context size of 2,048 while most smaller language models (e.g., RoBERTa) have a context size of 512.}\n",
"and (2) mixing numerous random examples from different classes together creates extremely long contexts which can be hard to leverage, especially for a smaller model.\n",
"To address these issues,\n",
"we propose a simpler solution:\n",
"at each training step,\n",
"convert it into $\\template\\big(\\xinput^{(c)}\\big)$ with {\\mask} replaced by $\\mapping(y_{\\phantom{t}}^{(c)})$---we denote this as $\\tilde{\\template}\\big(\\xinput^{(c)}, y_{\\phantom{t}}^{(c)}\\big)$---and then concatenate them with $\\xinput$ (Figure~\\ref{fig:overview}(c)):\n",
"\\begin{equation*}\n",
"\\resizebox{.89\\hsize}{!}{$\\displaystyle\n",
" \\template\\big(\\xinput\\big) \\oplus \\tilde{\\template}\\big(\\xinput^{(1)}, y_{\\phantom{t}}^{(1)}\\big) \\oplus \\cdots \\oplus \\tilde{\\template}\\big(\\xinput^{(|\\labelset|)}, y_{\\phantom{t}}^{(|\\labelset|)}\\big).\n",
"$}\n",
"\\end{equation*}\n",
"Here $\\oplus$ denotes concatenation of input sequences.\n",
"We observe that controlling the construction of the demonstration examples $\\{(\\xinput^{(c)}, y_{\\phantom{t}}^{(c)})\\}$ is crucial for good final performance.\n",
"For example, if the set of contrastive demonstrations $\\xinput^{(c)}$ are all dramatically different---from each other, or from the query $\\xinput$---then it becomes challenging for the language model to decipher meaningful patterns. As a result, the model may simply ignore the context, or even get confused by the additional examples.\n",
"Specifically, we use a pre-trained SBERT~\\cite{reimers2019sentence} model to obtain embeddings for all input sentences (for sentence-pair tasks, we use the concatenation of the two sentences).\n",
"Here we just feed the raw sentences without the templates into SBERT.\n"
],
"output": {
"What experiments do you suggest doing?": [
"1. Task performance with a single prompt: Authors should compare the performance in different tasks using a single prompt from the proposed approach with that of other approaches.",
"2. Analyzing the efficacy of template and label word generation: The authors can compare the performance of template and label word optimization separately and together to measure the effectiveness of different parts of the approach.",
"3. Task performance with Ensemble prompts: Authors should conduct an experiment to compare performance with ensembles of generated prompts.",
"4. Impact of Sampling Policy: The authors should conduct an experiment to analyze the impact of different sampling techniques on the performance of demonstrations in context.",
"5. Analyzing Sample Efficiency: The authors should conduct a comparative analysis of LM-BFF in different sample availability settings."
],
"Why do you suggest these experiments?": [
"1. Single prompt task performance highlights the quality of the best prompt attained from an automatically searched prompt, which is crucial to assess the quality of the proposed approach.",
"2. Separately generating templates and label words and finally comparing the performance in combining them should give a better view of whether the template or the label word generation is more important in this space.",
"3. With automated prompt search, it is possible to generate several prompts as required. Therefore, using different prompts and individually trained models, then using an ensemble of those models can offer much better results. Therefore, it is important to see whether ensemble results with the proposed approach can outperform that of previous approaches.",
"4. This experiment would provide further insights into the effectiveness of selective sampling in incorporating demonstrations in context, thereby justifying the choice of sampling strategy.",
"5. This experiment can provide further insight into whether the proposed approach does better compared to previous approaches in different data-constrained settings, where the proposed approach is more important."
]
},
"paper_info": {
"title": "Making Pre-trained Language Models Better Few-shot Learners",
"authors": [
"Tianyu Gao",
"Adam Fisch",
"Danqi Chen"
],
"abstract": "The recent GPT-3 model (Brown et al., 2020) achieves remarkable few-shot\nperformance solely by leveraging a natural-language prompt and a few task\ndemonstrations as input context. Inspired by their findings, we study few-shot\nlearning in a more practical scenario, where we use smaller language models for\nwhich fine-tuning is computationally efficient. We present LM-BFF--better\nfew-shot fine-tuning of language models--a suite of simple and complementary\ntechniques for fine-tuning language models on a small number of annotated\nexamples. Our approach includes (1) prompt-based fine-tuning together with a\nnovel pipeline for automating prompt generation; and (2) a refined strategy for\ndynamically and selectively incorporating demonstrations into each context.\nFinally, we present a systematic evaluation for analyzing few-shot performance\non a range of NLP tasks, including classification and regression. Our\nexperiments demonstrate that our methods combine to dramatically outperform\nstandard fine-tuning procedures in this low resource setting, achieving up to\n30% absolute improvement, and 11% on average across all tasks. Our approach\nmakes minimal assumptions on task resources and domain expertise, and hence\nconstitutes a strong task-agnostic method for few-shot learning.",
"comments": "Accepted to ACL 2021. The code is publicly available at\n https://github.com/princeton-nlp/LM-BFF"
},
"raw_data": {
"context_before_exp": [
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\documentclass[11pt,a4paper]{article}\n",
"\\usepackage[hyperref]{acl2021}\n",
"\\usepackage{times}\n",
"\\usepackage{latexsym}\n",
"\\renewcommand{\\UrlFont}{\\ttfamily\\small}\n",
"\n",
"\n",
"\n",
"\n",
"\\usepackage{microtype}\n",
"\\usepackage{array}\n",
"\\usepackage{pifont}\n",
"\\usepackage{tabularx}\n",
"\\usepackage{adjustbox}\n",
"\\usepackage{multirow}\n",
"\\usepackage{enumitem}\n",
"\\usepackage{xspace}\n",
"\\usepackage{tcolorbox}\n",
"\\usepackage{booktabs,subcaption,amsfonts,dcolumn}\n",
"\\usepackage{hyperref}\n",
"\\usepackage{url}\n",
"\\usepackage{amsmath,amsthm,amsfonts,amssymb,bm,stmaryrd}\n",
"\\usepackage{xcolor}\t\t\n",
"\\usepackage[noorphans,vskip=0.75ex,leftmargin=2ex]{quoting}\n",
"\n",
"\\aclfinalcopy \n",
"\\def\\aclpaperid{982} \n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\definecolor{darkblue}{rgb}{0, 0, 0.5}\n",
"\\hypersetup{colorlinks=true, citecolor=darkblue, linkcolor=darkblue, urlcolor=darkblue}\n",
"\n",
"\\usepackage[compact]{titlesec}\n",
"\\titlespacing{\\section}{0pt}{2ex}{1ex}\n",
"\\titlespacing{\\subsection}{0pt}{1ex}{1ex}\n",
"\n",
"\\setlength{\\parskip}{0cm}\n",
"\\setlength{\\parindent}{1em}\n",
"\n",
"\n",
"\\providecommand{\\todo}[1]{\n",
" {\\protect\\color{red}{[TODO: #1]}}\n",
"}\n",
"\n",
"\\providecommand{\\danqi}[1]{\n",
" {\\protect\\color{purple}{[Danqi: #1]}}\n",
"}\n",
"\n",
"\\providecommand{\\tianyu}[1]{\n",
" {\\protect\\color{blue}{[Tianyu: #1]}}\n",
"}\n",
"\n",
"\\providecommand{\\adam}[1]{\n",
" {\\protect\\color{teal}{[Adam: #1]}}\n",
"}\n",
"\n",
"\n",
"\\newcommand{\\cmark}{\\ding{51}}\n",
"\\newcommand{\\xmark}{\\ding{55}}\n",
"\\newcommand\\sys[1]{\\textsc{#1}}\n",
"\\newcommand\\ti[1]{\\textit{#1}}\n",
"\\newcommand\\ts[1]{\\textsc{#1}}\n",
"\\newcommand\\tf[1]{\\textbf{#1}}\n",
"\\newcommand\\ttt[1]{\\texttt{#1}}\n",
"\\newcommand\\mf[1]{\\mathbf{#1}}\n",
"\\newcommand\\tmp[1]{\\color{gray}{#1}}\n",
"\\newcommand\\warn[1]{\\textbf{\\color{red}{#1}}}\n",
"\n",
"\n",
"\\providecommand{\\todon}{\n",
" {\\protect\\color{red}{00.0 (0.0)}}\n",
"}\n",
"\n",
"\\newcommand{\\ours}{LM-BFF\\xspace}\n",
"\\newcommand{\\dtrain}{\\mathcal{D}_{\\text{train}}}\n",
"\\newcommand{\\ddev}{\\mathcal{D}_{\\text{dev}}}\n",
"\\newcommand{\\dtest}{\\mathcal{D}_{\\text{test}}}\n",
"\\newcommand{\\seedset}{\\mathcal{S}_{\\text{seed}}}\n",
"\\newcommand{\\maskx}{\\texttt{<X>}}\n",
"\\newcommand{\\masky}{\\texttt{<Y>}}\n",
"\\newcommand{\\maskz}{\\texttt{<Z>}}\n",
"\\newcommand{\\lsent}{\\texttt{<}S_1\\ttt{>}}\n",
"\\newcommand{\\lfirstsent}{\\texttt{<}S_1\\ttt{>}}\n",
"\\newcommand{\\lsecondsent}{\\texttt{<}S_2\\ttt{>}}\n",
"\\newcommand{\\sent}{\\ttt{<}$S_1$\\ttt{>}}\n",
"\\newcommand{\\firstsent}{\\ttt{<}$S_1$\\ttt{>}}\n",
"\\newcommand{\\secondsent}{\\ttt{<}$S_2$\\ttt{>}}\n",
"\\newcommand{\\xinput}{{x}_{\\mathrm{in}}}\n",
"\\newcommand{\\xprompt}{x_{\\mathrm{prompt}}}\n",
"\\newcommand{\\gen}{\\mathrm{g}}\n",
"\n",
"\n",
"\\newcommand{\\template}{\\mathcal{T}}\n",
"\\newcommand{\\lwordset}{\\mathcal{W}}\n",
"\\newcommand{\\lwordmap}{\\mathcal{M}}\n",
"\\newcommand{\\vocabulary}{\\mathcal{V}}\n",
"\\newcommand{\\labelset}{\\mathcal{Y}}\n",
"\\newcommand{\\mapping}{\\mathcal{M}}\n",
"\\newcommand{\\totalk}{K_{\\text{tot}}}\n",
"\\newcommand{\\lm}{\\mathcal{L}}\n",
"\\newcommand{\\cls}{\\texttt{[CLS]}}\n",
"\\newcommand{\\sep}{\\texttt{[SEP]}}\n",
"\\newcommand{\\mask}{\\texttt{[MASK]}}\n",
"\\DeclareMathOperator*{\\argmax}{arg\\,max}\n",
"\\DeclareMathOperator*{\\argmin}{arg\\,min}\n",
"\\renewcommand{\\paragraph}[1]{\\vspace{0.2cm}\\noindent\\textbf{#1}}\n",
"\\newcommand{\\tpf}[1]{\\noindent\\textbf{#1}}\n",
"\n",
"\\newcommand{\\tableindent}{~~}\n",
"\n",
"\\newcommand\\BibTeX{B\\textsc{ib}\\TeX}\n",
"\n",
"\\title{Making Pre-trained Language Models Better Few-shot Learners}\n",
"\n",
"\\author{Tianyu Gao$^{\\dagger*}$ \\quad Adam Fisch$^{\\ddagger*}$ \\quad Danqi Chen$^{\\dagger}$ \\\\\n",
"$^{\\dagger}$Princeton University\\quad $^{\\ddagger}$Massachusetts Institute of Technology\\\\\n",
"\\ttt{\\{tianyug,danqic\\}@cs.princeton.edu}\\\\\n",
"\\ttt{[email protected]}\n",
"}\n",
"\n",
"\\date{}\n",
"\n",
"\n",
"\\begin{document}\n",
"\\maketitle\n",
"\\renewcommand{\\thefootnote}{\\fnsymbol{footnote}}\n",
"\\footnotetext[1]{The first two authors contributed equally.}\n",
"\\renewcommand{\\thefootnote}{\\arabic{footnote}}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{abstract}\n",
"The recent GPT-3 model~\\cite{brown2020language} achieves remarkable few-shot performance solely by leveraging a natural-language prompt and a few task demonstrations as input context.\n",
"Inspired by their findings, we study few-shot learning in a more practical scenario, where we use smaller language models for which fine-tuning is computationally efficient.\n",
"We present {\\ours}---\\underline{b}etter \\underline{f}ew-shot \\underline{f}ine-tuning of \\underline{l}anguage \\underline{m}odels\\footnote{Alternatively, {l}anguage {m}odels' \\underline{b}est \\underline{f}riends \\underline{f}orever.}---a suite of simple and complementary techniques for fine-tuning language models on a small number of annotated examples. Our approach includes (1) prompt-based fine-tuning together with a novel pipeline for automating prompt generation; and (2) a refined strategy for dynamically and selectively incorporating demonstrations into each context.\n",
"Finally, we present a systematic evaluation for analyzing few-shot performance on a range of NLP tasks, including classification and regression. Our experiments demonstrate that our methods combine to dramatically outperform standard fine-tuning procedures in this low resource setting, achieving up to 30\\\n",
"\n",
"\\end{abstract}\n",
"\n",
"\n",
"\n",
"\\section{Introduction}\n",
"\n",
"\n",
"\\begin{figure*}[t]\n",
" \\centering\n",
" \\includegraphics[width=0.95\\textwidth]{figures/in_context3.pdf}\n",
" \\caption{An illustration of (a) masked language model (MLM) pre-training, (b) standard fine-tuning, and (c) our proposed {\\ours} using prompt-based fine-tuning with demonstrations. The underlined text is the task-specific \\emph{template}, and colored words are \\emph{label words}.}\n",
" \n",
" \\label{fig:overview}\n",
"\\end{figure*}\n",
"\n",
"\\label{sec:intro}\n",
"\n",
"The GPT-3 model \\cite{brown2020language} has made waves in the NLP community by demonstrating astounding few-shot capabilities on myriad language understanding tasks.\n",
"Given only a \\ti{natural language prompt} and a few \\emph{demonstrations} of the task, GPT-3 is able to make accurate predictions without updating any of the weights of its underlying language model.\n",
"However, while remarkable, GPT-3 consists of 175B parameters, which makes it challenging to use in most real-wold applications.\n",
"\n",
"In this work, we study a more practical scenario in which we only assume access to a moderately-sized language model such as BERT~\\cite{devlin2019bert} or RoBERTa~\\cite{liu2019roberta}, and a small number of examples (i.e., a \\emph{few-shot} setting), which we can use to fine-tune the weights of\n",
"the language model.\n",
"This setting is appealing as\n",
"(1) such models can be trained on typical research hardware;\n",
"(2) few-shot settings are realistic, as it is generally both easy to acquire a few annotations (e.g., 32 examples) and efficient to train on them; and\n",
"(3) updating parameters typically leads to better performance.\n",
"Inspired by GPT-3's findings, we propose several novel strategies for expanding its few-shot learning abilities to our setting, considering both classification and---for the first time---regression.\n",
"\n",
"\n",
"\n",
"First, we follow the route of \\ti{prompt-based} prediction, first developed by the GPT series~\\cite{radford2018improving,radford2019language,brown2020language} for zero-shot prediction and recently studied by PET~\\cite{schick2020exploiting, schick2020size} for fine-tuning.\n",
"Prompt-based prediction treats the downstream task as a (masked) language modeling problem, where the model directly generates a textual response (referred to as a \\emph{label word}) to a given prompt defined by a task-specific \\emph{template} (see Figure~\\ref{fig:overview}(c)).\n",
"\n",
"Finding the right prompts, however, is an art---requiring both domain expertise and an understanding of the language model's inner workings.\n",
"Even if significant effort is invested, manual prompts are likely to be suboptimal.\n",
"We address this issue by introducing automatic prompt generation, including a pruned brute-force search to identify the best working label words, and a novel decoding objective to automatically generate templates using the generative T5 model~\\cite{raffel2020exploring}---all of which only require the few-shot training data. This allows us to cheaply obtain effective prompts that match or outperform our manually chosen ones.\n",
"\n",
"\n",
"\n",
"\n",
"Second, we adopt the idea of incorporating demonstrations \n",
"as\n",
"additional context.\n",
"GPT-3's naive ``in-context learning'' paradigm picks up to 32 randomly sampled examples, and concatenates them with the input. This method is not guaranteed to prioritize the most informative demonstrations, and mixing random examples from different classes together creates long contexts which can be hard to learn from. Additionally, the number of usable demonstrations is bounded by the model's maximum input length.\n",
"We develop a more refined strategy, where, for each input, we randomly sample a \\emph{single} example at a time from \\emph{each} class to create multiple, minimal demonstration \\emph{sets}.\n",
"We also devise a novel sampling strategy that pairs inputs with similar examples, thereby providing the model with more discriminative comparisons.\n",
"\n",
"\n",
"We present a systematic evaluation for analyzing few-shot performance on 8 single-sentence and 7 sentence-pair NLP tasks. We observe that given a small number of training examples, (1) prompt-based fine-tuning largely outperforms standard fine-tuning; (2) our automatic prompt search method matches or outperforms manual prompts; and (3) incorporating demonstrations is effective for fine-tuning, and boosts few-shot performance.\n",
"Together, these simple-yet-effective methods contribute towards a dramatic improvement across the tasks we evaluate on,\n",
"and we obtain gains up to 30\\\n",
"For instance, we find that a RoBERTa-large model achieves around 90\\\n",
"\n",
"\n",
"\n",
"\\section{Related Work}\n",
"\\label{sec:related_work}\n",
"\n",
"\n",
"\\tpf{Language model prompting.} The GPT series~\\citep{radford2018improving,radford2019language,brown2020language} fueled the development of prompt-based learning,\n",
"and we follow many of its core concepts.\n",
"We are also greatly inspired by the recent PET work~\\citep{schick2020exploiting,schick2020size}, although they mainly focus on a semi-supervised setting where a large set of unlabeled examples are provided.\n",
"We only use a few annotated examples as supervision, and also explore automatically generated prompts and fine-tuning with demonstrations.\n",
"Furthermore, we deviate from their evaluation by providing a more rigorous framework, as we will discuss in \\S\\ref{sec:setup}.\n",
"Finally, there is a large body of work on prompting for mining knowledge from pre-trained models \\cite[][\\emph{inter alia}]{trinh2018simple,petroni2019language,davison2019commonsense,talmor2020olmpics}. Different from these works, we focus on leveraging prompting for fine-tuning on downstream tasks.\n",
"\n",
"\n",
"\n",
"\\paragraph{Automatic prompt search.}\n",
"\\citet{schick2020exploiting} and \\citet{schick2020automatically} explore ways of identifying label words automatically,\n",
"however, none of these results lead to better performance compared to hand-picked ones.\n",
"In contrast, our method searches over both templates and label words, and is able to match or outperform our manual prompts.\n",
"Several other attempts have been made in addition---yet these approaches either operate in limited domains,\n",
"such as finding patterns to express specific relations~\\cite{jiang2020can},\n",
"or require a large number of examples for gradient-guided search~\\cite{shin2020autoprompt,zhong2021factual}. Our approach aims to develop general-purpose search methods that rely only on a few annotations.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\paragraph{Fine-tuning of language models.} A number of recent studies have focused on better methods for fine-tuning language models~\\cite{howard2018universal,dodge2020fine,lee2020mixout, zhang2020revisiting}. These works mainly focus on optimization and regularization techniques to stabilize fine-tuning. Here we use standard optimization techniques, and instead mainly focus our efforts on better prompt-based fine-tuning in a more extreme few-shot setting. We anticipate that results of these studies are largely complementary to ours.\n",
"\n",
"\n",
"\n",
"\\paragraph{Few-shot learning.} Broadly speaking, our setting is also connected to other few-shot learning paradigms in NLP, including\n",
"(1) {semi-supervised learning}~\\cite{miyato2017adversarial,xie2020unsupervised,chen2020mixtext}, where a set of unlabeled examples are given;\n",
"(2) {meta-learning}~\\cite{yu2018diverse,han2018fewrel,bansal2020learning,bansal2020self, bao2020fewshot}, where a set of auxiliary tasks are given; and\n",
"(3) {intermediate training}~\\cite{phang2018sentence,yin2020universal}, where a related, intermediate task is given. We deviate from these settings by making minimal assumptions about available resources: we only assume a few annotated examples and a pre-trained language model. Our focus is on understanding how far we can push without any other advantages.\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.98\\columnwidth}{!}{\n",
"\\begin{tabular}{llcrrrcl}\n",
"\\toprule\n",
"\\tf{Category} & \\tf{Dataset} & $|\\mathcal{Y}|$ & $L$ & \\#Train & \\#Test & \\tf{Type} & \\tf{Labels (classification tasks)} \\\\\n",
"\\bottomrule\n",
" & SST-2 & 2 & 19 & 6,920 & 872 & sentiment & positive, negative \\\\\n",
"& SST-5 & 5 & 18 & 8,544 & 2,210 & sentiment & v. pos., positive, neutral, negative, v. neg. \\\\\n",
"& MR & 2 & 20 & 8,662& 2,000 & sentiment & positive, negative \\\\\n",
"single- & CR & 2 & 19 & 1,775 & 2,000 & sentiment & positive, negative \\\\\n",
"sentence & MPQA & 2 & 3 & 8,606 & 2,000 & opinion polarity & positive, negative \\\\\n",
"& Subj & 2 & 23 & 8,000 & 2,000 & subjectivity & subjective, objective \\\\\n",
"& TREC & 6 & 10 & 5,452 & 500 & question cls. & abbr., entity, description, human, loc., num.\\\\\n",
"& CoLA & 2 & 8 & 8,551 & 1,042 & acceptability & grammatical, not\\_grammatical\\\\\n",
"\\midrule\n",
" & MNLI & 3 & 22/11 & 392,702 & 9,815 & NLI & entailment, neutral, contradiction\\\\\n",
"& SNLI & 3 & 14/8 & 549,367 & 9,842 & NLI & entailment, neutral, contradiction \\\\\n",
"sentence- & QNLI & 2 & 11/30 & 104,743 & 5,463 & NLI & entailment, not\\_entailment \\\\\n",
"pair & RTE & 2 & 49/10 & 2,490 & 277 & NLI & entailment, not\\_entailment \\\\\n",
" & MRPC & 2 & 22/21 & 3,668 & 408 & paraphrase & equivalent, not\\_equivalent \\\\\n",
"& QQP & 2 & 12/12 & 363,846 & 40,431 & paraphrase & equivalent, not\\_equivalent \\\\\n",
"& STS-B & $\\mathcal{R}$ & 11/11 & 5,749 & 1,500 & sent. similarity & - \\\\\n",
"\\bottomrule\n",
"\\end{tabular}\n",
"}\n",
"\\end{center}\n",
"\\caption{The datasets evaluated in this work. $|\\mathcal{Y}|$: \\# of classes for classification tasks (with one exception: STS-B is a real-valued regression task over the interval $[0, 5]$). $L$: average \\# of words in input sentence(s). Note that we only sample $\\dtrain$ and $\\ddev$ of $K \\times |\\labelset|$ examples from the original training set in our few-shot experiments (\\S\\ref{sec:setup}).}\n",
"\\label{tab:datasets}\n",
"\\end{table*}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.98\\columnwidth}{!}{\n",
"\\begin{tabular}{lll}\n",
"\\toprule\n",
"\\tf{Task} & \\tf{Template} & \\tf{Label words}\\\\\n",
"\\midrule\n",
"SST-2 & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"SST-5 & {\\sent} It was {\\mask} . & v.positive: great, positive: good, neutral: okay, negative: bad, v.negative: terrible\\\\\n",
"MR & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"CR & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"Subj & {\\sent} This is {\\mask} . & subjective: subjective, objective: objective \\\\\n",
"TREC & {\\mask} : {\\sent} & abbreviation: Expression, entity: Entity, description: Description \\\\\n",
"&& human: Human, location: Location, numeric: Number \\\\\n",
"COLA & {\\sent} This is {\\mask} . & grammatical: correct, not\\_grammatical: incorrect \\\\\n",
"\\midrule\n",
"MNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, netural: Maybe, contradiction: No \\\\\n",
"SNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, netural: Maybe, contradiction: No\\\\\n",
"QNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, not\\_entailment: No \\\\\n",
"RTE & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, not\\_entailment: No \\\\\n",
"MRPC & {\\firstsent} {\\mask} , {\\secondsent} & equivalent: Yes, not\\_equivalent: No\\\\\n",
"QQP & {\\firstsent} {\\mask} , {\\secondsent} & equivalent: Yes, not\\_equivalent: No\\\\\n",
"STS-B & {\\firstsent} {\\mask} , {\\secondsent} & $y_u$: Yes, $y_l$: No \\\\\n",
"\\bottomrule\n",
"\\end{tabular}\n",
"}\n",
"\\end{center}\n",
"\\caption{Manual templates and label words that we used in our experiments. \n",
"STS-B is a regression task (\\S\\ref{sec:regression}).\n",
"}\n",
"\\label{tab:manual_prompts}\n",
"\\vspace{-5pt}\n",
"\\end{table*}\n",
"\n",
"\n",
"\n",
"\\section{Problem Setup}\n",
"\\label{sec:setup}\n",
"\n",
"\\paragraph{Task formulation.}\n",
"\n",
"In this work, we assume access to a pre-trained language model $\\lm$ that we wish to fine-tune on a task $\\mathcal{D}$ with a label space $\\labelset$. For the task, we only assume $K$ training examples \\emph{per class}\\footnote{For regression, we partition the data into two ``classes'' according to being above or below the median value.} for the task's training set $\\dtrain$, such that the total number of examples is $\\totalk = K \\times |\\labelset|$, and $\\dtrain = \\{(\\xinput^i, y^i)\\}_{i=1}^{\\totalk}$.\n",
"Our goal is then to develop task-agnostic learning strategies that generalize well to an unseen test set $(\\xinput^{\\text{test}}, y^{\\text{test}})\\sim \\dtest$. \n",
"For model selection and hyper-parameter tuning, we assume a development set $\\ddev$, of the same size as the few-shot training set, i.e., $|\\ddev| = |\\dtrain|$. This distinction is important: using a larger development set confers a significant advantage\n",
"(see our experiments in Appendix~\\ref{app:dev_size}),\n",
"and subverts our initial goal of learning from limited data.\\footnote{In contrast, \\newcite{schick2020exploiting,schick2020size} do not use a development set, and adopt a set of hyper-parameters based on practical considerations.\n",
"This is akin to ``shooting in the dark'' on a setting that we show can have unintuitive outcomes.}\n",
"For all of the following experiments (unless specified otherwise), we take $\\lm=$ RoBERTa-large and $K=16$.\n",
"\n",
"\n",
"\\paragraph{Evaluation datasets.}\n",
"\n",
"We conduct a systematic study across $8$ single-sentence and $7$ sentence-pair English tasks, \n",
"\n",
"including\n",
"8 tasks from the GLUE benchmark~\\cite{wang2019glue},\n",
"\n",
"SNLI~\\cite{bowman2015large_snli}, and 6 other popular sentence classification tasks (SST-5, MR, CR, MPQA, Subj, TREC). All of the dataset details are provided in Appendix~\\ref{app:datasets}. For \\emph{single-sentence} tasks, the goal is to make a prediction based on an input sentence $\\xinput = x_1$, such as whether a movie review is positive or not. For \\emph{sentence-pair} tasks, the goal is to take a pair of input sentences $\\xinput = (x_1, x_2)$ and predict the relationship between them. We also interchangeably refer to the inputs as {\\firstsent} or (\\firstsent, \\secondsent).\n",
"\n",
"\n",
"Note that we mainly use SST-2 and SNLI for pilot experiments and model development, making it close to a true few-shot setting, at least for all the other datasets we evaluate on.\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{comment}\n",
"\\vspace{-3pt}\n",
"\\begin{enumerate}[leftmargin=*]\n",
" \\item \\emph{Single-sentence tasks.} The goal is to make a prediction based on an input sentence $\\xinput = x_1$ (sometimes referred as \\firstsent), such as whether a movie review is positive or not.\n",
" Our tasks range from sentiment analysis to question classification and grammaticality assessment.\n",
" \n",
" \\vspace{-3pt}\n",
" \\item \\emph{Sentence-pair tasks.} The goal is to make a prediction based on a pair of input sentences $\\xinput = (x_1, x_2)$ (sometimes referred as \\firstsent, \\secondsent), such as predicting the relationship between them.\n",
" Our tasks include natural language inference and paraphrase detection.\n",
" \n",
"\\end{enumerate}\n",
"\\vspace{-3pt}\n",
"\\end{comment}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\paragraph{Evaluation protocol.}\n",
"Systematically evaluating few-shot performance can be tricky.\n",
"It is well-known that\n",
"fine-tuning on small datasets can suffer from instability~\\cite{dodge2020fine,zhang2020revisiting}, and results may change dramatically given a new split of data.\n",
"\n",
"To account for this, we measure average performance across 5 different randomly sampled $\\dtrain$ and $\\ddev$ splits.\n",
"\n",
"This issue has also been discussed in\n",
"\\newcite{schick2020size}---they suggest using a fixed set of training examples. We argue that sampling\n",
"\n",
"multiple splits gives a\n",
"more robust measure of performance,\n",
"and a better estimate of the variance.\n",
"We also observe that hyper-parameters\n",
"\n",
"can make a significant difference,\n",
"\n",
"\n",
"thus we sweep multiple hyper-parameters for each data sample, and take the best setting as measured on the $\\ddev$ of that sample (see Appendix~\\ref{app:hyper_selection}).\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.98\\columnwidth}{!}{\n",
"\\begin{tabular}{lll}\n",
"\\toprule\n",
"\\tf{Task} & \\tf{Template} & \\tf{Label words}\\\\\n",
"\\midrule\n",
"SST-2 & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"SST-5 & {\\sent} It was {\\mask} . & v.positive: great, positive: good, neutral: okay, negative: bad, v.negative: terrible\\\\\n",
"MR & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"CR & {\\sent} It was {\\mask} . & positive: great, negative: terrible\\\\\n",
"Subj & {\\sent} This is {\\mask} . & subjective: subjective, objective: objective \\\\\n",
"TREC & {\\mask} : {\\sent} & abbreviation: Expression, entity: Entity, description: Description \\\\\n",
"&& human: Human, location: Location, numeric: Number \\\\\n",
"COLA & {\\sent} This is {\\mask} . & grammatical: correct, not\\_grammatical: incorrect \\\\\n",
"\\midrule\n",
"MNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, netural: Maybe, contradiction: No \\\\\n",
"SNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, netural: Maybe, contradiction: No\\\\\n",
"QNLI & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, not\\_entailment: No \\\\\n",
"RTE & {\\firstsent} ? {\\mask} , {\\secondsent} & entailment: Yes, not\\_entailment: No \\\\\n",
"MRPC & {\\firstsent} {\\mask} , {\\secondsent} & equivalent: Yes, not\\_equivalent: No\\\\\n",
"QQP & {\\firstsent} {\\mask} , {\\secondsent} & equivalent: Yes, not\\_equivalent: No\\\\\n",
"STS-B & {\\firstsent} {\\mask} , {\\secondsent} & $y_u$: Yes, $y_l$: No \\\\\n",
"\\bottomrule\n",
"\\end{tabular}\n",
"}\n",
"\\end{center}\n",
"\\caption{Manual templates and label words that we used in our experiments. \n",
"STS-B is a regression task (\\S\\ref{sec:regression}).\n",
"}\n",
"\\label{tab:manual_prompts}\n",
"\\vspace{-5pt}\n",
"\\end{table*}\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Prompt-based Fine-tuning}\n",
"\\label{sec:prompt_finetuning}\n",
"\n",
"Given a masked language model\n",
"$\\lm$,\n",
"we first convert input $\\xinput$ to a token sequence $\\tilde{x}$, and the language model $\\lm$ then\n",
"\n",
"maps $\\tilde{x}$ to a sequence of hidden vectors $\\{\\mf{h}_k \\in \\mathbb{R}^d\\}$.\n",
"During standard fine-tuning, we usually take $\\tilde{x}_{\\text{single}} = \\cls x_1 \\sep$ or $\\tilde{x}_{\\text{pair}} = \\cls x_1 \\sep x_2 \\sep$.\n",
"\n",
"For downstream classification tasks with a label space $\\labelset$, we train a task-specific head, $\\mathrm{softmax}(\\mf{W}_o \\mf{h}_{\\cls})$, by maximizing the log-probability of the correct label, where $\\mf{h}_{\\cls}$ is the hidden vector of \\cls, and $\\mf{W}_o \\in \\mathbb{R}^{\\mathcal{|\\labelset|} \\times d}$ is a set of randomly initialized parameters introduced at the start of fine-tuning.\n",
"\n",
"Similarly, for a regression task, we can introduce $\\mf{w}_o \\in \\mathbb{R}^d$ and optimize the mean squared error between $\\mf{w}_o \\cdot \\mf{h}_{\\cls}$ and the gold label.\n",
"In either case, the number of new parameters can be substantial---for example, a simple binary classification task will introduce 2,048 new parameters for a RoBERTa-large model---making it challenging to learn from a small amount of annotated data (e.g., 32 examples).\n",
"\n",
"\n",
"\n",
"An alternative approach to solving this problem is \\ti{prompt-based fine-tuning}, in which $\\lm$ is directly tasked with ``auto-completing'' natural language prompts. \n",
"For instance, we can formulate a binary sentiment classification task using a prompt with\n",
"\n",
"input $x_1$\n",
"(e.g., ``\\ti{No reason to watch it .}'') as:\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{equation*}\n",
" \\resizebox{.85\\hsize}{!}{\n",
" $\\xprompt = \\text{\\cls~$x_1$~{It was}~\\mask~. \\sep}$\n",
" }\n",
"\\end{equation*}\n",
"and let $\\lm$ decide whether it is more appropriate to fill in ``\\emph{great}'' (positive) or ``\\emph{terrible}'' (negative) for \\mask.\n",
"We now formalize this approach for classification and regression (\\S\\ref{sec:classification} and \\S\\ref{sec:regression}), and discuss the importance of prompt selection (\\S\\ref{sec:manual_prompts}).\n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Classification}\n",
"\\label{sec:classification}\n",
"\n",
"Let $\\mapping \\colon \\labelset \\rightarrow \\vocabulary$ be a mapping from the task label space to individual words\\footnote{More generally, we can consider a one-to-many mapping $\\mapping\\colon \\labelset \\rightarrow 2^{|\\labelset|}$ in which we map labels to sets of words. However, we did not find significant gains in our experiments.}\n",
"\n",
"in the vocabulary $\\vocabulary$ of $\\lm$.\n",
"Then for each $\\xinput$, let the manipulation ${x}_{\\mathrm{prompt}} = \\template(\\xinput)$\n",
"\n",
"be a \\emph{masked language modeling} (MLM) input which contains one \\mask~token.\n",
"\n",
"In this way, we can treat our task as an\n",
"\n",
"MLM, and model the probability of predicting class $y \\in \\labelset$ as:\n",
"\\vspace{-10pt}\n",
"\\begin{equation}\n",
"\\label{eq:lm-classification}\n",
"\\resizebox{.85\\hsize}{!}{\n",
"$\\begin{aligned}\n",
"p(y \\mid \\xinput) &= p\\left(\\mask = \\mapping(y) \\mid \\xprompt\\right) \\\\\n",
"&=\\frac{\\exp\\left(\\mf{w}_{\\mapping(y)} \\cdot \\mf{h}_{\\mask}\\right)}{\\sum_{y' \\in \\labelset} {\\exp\\left(\\mf{w}_{\\mapping(y')} \\cdot \\mf{h}_{\\mask}\\right)}},\n",
"\\end{aligned}$\n",
"}\n",
"\n",
"\n",
"\n",
"\\end{equation}\n",
"where $\\mf{h}_{\\mask}$ is the hidden vector of {\\mask} \n",
"\n",
"and $\\mf{w}_v$ denotes the pre-softmax vector corresponding to $v \\in \\vocabulary$.\n",
"When supervised examples $\\{(\\xinput, y)\\}$ are available, $\\mathcal{L}$ can be fine-tuned to minimize the cross-entropy loss.\n",
"It is important to note that this approach re-uses the pre-trained weights $\\mf{w}_v$ and does not introduce any new parameters. It also reduces the gap between pre-training and fine-tuning, making it more effective in few-shot scenarios.\n",
"\n",
"\n",
"\n",
"\\subsection{Regression}\n",
"\\label{sec:regression}\n",
"We assume the same basic setup as in classification, but treat the label space $\\labelset$ as a bounded interval $[v_l, v_u]$.\n",
"\n",
"\n",
"Inspired by ~\\citet{mettes2019hyperspherical},\n",
"we model the problem as an interpolation between two opposing poles, $\\{y_l, y_u\\}$, with values $v_l$ and $v_u$ respectively.\n",
"For instance, we can formulate our previous sentiment analysis task as a regression problem in the range $[0, 1]$, where we slide between ``\\emph{terrible}'' ($v_l = 0$) and ``\\emph{great}'' ($v_u = 1$). In this way, we can express $y$ as a \\emph{mixture model}:\n",
"\\begin{equation}\n",
" y = v_l \\cdot p(y_l \\mid \\xinput) + v_u \\cdot p(y_u \\mid \\xinput),\n",
"\\end{equation}\n",
"where $p(y_u \\mid \\xinput)$ is the probability of $y_u$, and $p(y_l \\mid \\xinput) = 1 - p(y_u \\mid \\xinput)$.\n",
"\n",
"Then we define $\\mapping \\colon \\{y_l, y_u\\} \\rightarrow \\vocabulary$,\n",
"and model $p(y_u \\mid \\xinput)$ the same as Eq. (\\ref{eq:lm-classification}).\n",
"\\begin{comment}\n",
"\\begin{equation}\n",
"\\label{eq:lm-regression}\n",
"\\resizebox{.89\\hsize}{!}{$\\displaystyle\n",
"p(y_u \\mid \\xinput) = \\frac{\\exp\\left(\\mf{w}_{w_u} \\cdot \\mf{h}_{\\mask}\\right)}{\\sum_{w' \\in \\{w_u, w_l\\}}\\exp\\left(\\mf{w}_{w'} \\cdot \\mf{h}_{\\mask}\\right)}.\n",
"$}\n",
"\\end{equation}\n",
"\\end{comment}\n",
"\n",
"We fine-tune $\\mathcal{L}$ to minimize the KL-divergence between the inferred $p(y_u \\mid \\xinput)$\n",
"\n",
"and the observed mixture weight, $(y\n",
"- v_l) / (v_u - v_l)$.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[!t]\n",
" \\centering\n",
" \\resizebox{0.95\\columnwidth}{!}{\n",
" \\begin{tabular}{l cc c}\n",
" \\toprule\n",
" \\tf{Template} & \\tf{Label words} & \\tf{Accuracy} \\\\\n",
" \\midrule\n",
" \\multicolumn{2}{l}{SST-2 (positive/negative)} & mean (std)\\\\\n",
" \\midrule\n",
" {\\sent} It was {\\mask} . & great/terrible & \\tf{92.7 (0.9)} \\\\\n",
" {\\sent} It was {\\mask} . & good/bad & 92.5 (1.0) \\\\\n",
" {\\sent} It was {\\mask} . & cat/dog & 91.5 (1.4) \\\\\n",
" {\\sent} It was {\\mask} . & dog/cat & 86.2 (5.4) \\\\\n",
" {\\sent} It was {\\mask} . & terrible/great & 83.2 (6.9) \\\\\n",
" {Fine-tuning} & - & 81.4 (3.8) \\\\\n",
" \\midrule\n",
" \\multicolumn{2}{l}{SNLI (entailment/neutral/contradiction)} & mean (std)\\\\\n",
" \\midrule\n",
" {\\firstsent} ? {\\mask} , {\\secondsent} & Yes/Maybe/No & \\tf{77.2 (3.7)} \\\\\n",
" {\\firstsent} . {\\mask} , {\\secondsent} & Yes/Maybe/No & 76.2 (3.3) \\\\\n",
" {\\firstsent} ? {\\mask} {\\secondsent} & Yes/Maybe/No & 74.9 (3.0) \\\\\n",
" {\\firstsent} {\\secondsent} {\\mask} & Yes/Maybe/No & 65.8 (2.4) \\\\\n",
" {\\secondsent} ? {\\mask} , {\\firstsent} & Yes/Maybe/No & 62.9 (4.1) \\\\\n",
" {\\firstsent} ? {\\mask} , {\\secondsent} & Maybe/No/Yes & 60.6 (4.8) \\\\\n",
" {Fine-tuning} & - & 48.4 (4.8) \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\caption{The impact of templates and label words on prompt-based fine-tuning ($K=16$).\n",
" }\n",
" \\label{tab:prompt_search}\n",
"\\end{table}\n",
"\n",
"\\subsection{Manual prompts: the good and the bad}\n",
"\\label{sec:manual_prompts}\n",
"\n",
"\n",
"The key challenge is to construct the template $\\template$ and label words $\\mapping(\\labelset)$---we refer to these two together as a \\ti{prompt} $\\mathcal{P}$.\n",
"\n",
"Previous works~\\cite{schick2020exploiting,schick2020size} hand-craft both the templates and label words, which usually requires domain expertise and trial-and-error.\n",
"Table~\\ref{tab:manual_prompts}\n",
"summarizes manual templates and label words chosen for each dataset in our experiments.\n",
"These templates and label words were designed by intuition, and by considering formats used in previous literature. \n",
"\n",
"\n",
"\n",
"To better understand what constitutes a good template or label word, we conduct a pilot study on SST-2 and SNLI.\n",
"\n",
"Table~\\ref{tab:prompt_search} shows that different prompts can lead to substantial differences in final accuracy.\n",
"\n",
"Specifically, when a template is fixed, the better the label words match the ``semantic classes'',\n",
"the better the final accuracy is\n",
"(\\ti{great}/\\ti{terrible} $>$ \\ti{good}/\\ti{bad} $>$ \\ti{cat}/\\ti{dog}).\n",
"In extreme cases where we swap plausible label words (e.g., \\ti{terrible}/\\ti{great}), we achieve the worst overall performance.\\footnote{It is unclear, however, why RoBERTa thinks that ``cat'' is more positive than ``dog''. The authors tend to disagree.}\n",
"\n",
"Furthermore, with the same set of label words,\n",
"even a small change in the template\n",
"\n",
"can make a difference.\n",
"For example, for SNLI, if we put \\mask~at the end, or swap sentence order, we observe a $>$10\\\n",
"The above evidence clearly underlines the importance of selecting good templates and label words.\n",
"Searching for prompts, however, is hard, as the search space can be very large---especially for the template. Even worse, we only have a few examples to use to guide our search, which can easily overfit. We will address these issues next.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Automatic Prompt Generation}\n",
"\\label{sec:auto_prompt}\n",
"\n",
"We now explore principled ways of automating the search process for label words (\\S\\ref{sec:label_search}) and templates (\\S\\ref{sec:template_search}). Our goals are to reduce the human involvement required to design prompts, and to find more optimal settings than those that we manually choose.\n",
"Here, we assume a classification task, but the process for regression is analogous.\n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Automatic selection of label words}\n",
"\\label{sec:label_search}\n",
"We first study how to construct a label word mapping $\\mapping$ that maximizes accuracy on $\\ddev$ after fine-tuning, given a fixed template $\\template$.\n",
"Naively searching all possible assignments, however, is (1) generally intractable, as the search space is exponential in the number of classes; and (2) prone to overfitting, as we will tend to uncover spurious correlations given only a few annotations. As a simple solution,\n",
"for each class $c \\in \\labelset$, we construct a pruned set $\\mathcal{V}^c \\subset \\mathcal{V}$ of the top $k$ vocabulary words based on their conditional likelihood using the initial $\\lm$. That is, let $\\dtrain^c \\subset \\dtrain$ be the subset of all examples of class $c$. We take $\\mathcal{V}^c$ as\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{equation}\n",
"\\resizebox{.89\\hsize}{!}{$\\displaystyle\n",
" \\underset{v \\in \\mathcal{V}}{\\mathrm{Top}\\text{-}k} \\left\\{\\sum_{\\xinput \\in \\dtrain^c} \\hspace{-5pt}\\log P_{\\lm}\\Big(\\mask = v \\mid \\template(\\xinput)\\Big)\\right\\},\n",
"$}\n",
"\\end{equation}\n",
"where ${P}_{\\lm}$ denotes the output probability distribution of $\\lm$.\n",
"To further narrow down the search space, we find the top $n$ assignments over the pruned space that maximize zero-shot accuracy on $\\dtrain$ (both $n$ and $k$ are hyper-parameters, see\n",
"Appendix~\\ref{app:prompts}).\n",
"Then we fine-tune all top $n$ assignments, and re-rank to find the best one using $\\ddev$.\n",
"This approach is similar to the automatic verbalizer search methods in \\newcite{schick2020exploiting,schick2020automatically}, except that we use a much simpler search process (brute-force) and also apply re-ranking---which we find to be quite helpful.\n",
"\n",
"\n",
"\\subsection{Automatic generation of templates}\n",
"\\label{sec:template_search}\n",
"\n",
"Next, we study how to generate a diverse set of templates $\\{\\template\\}$ automatically from a fixed set of label words $\\mapping(\\labelset)$.\n",
"To address this challenging problem, we propose to use T5~\\cite{raffel2020exploring}, a large pre-trained text-to-text Transformer.\n",
"T5 is pre-trained to fill in missing spans (replaced by T5 mask tokens, e.g., \\maskx~or \\masky) in its input.\n",
"For example, given the input ``\\ti{Thank you {\\maskx} me to your party {\\masky} week}'', T5 is trained to generate ``\\ti{{\\maskx} for inviting {\\masky} last {\\maskz}}'',\n",
"meaning that ``\\ti{for inviting}'' is the replacement for {\\maskx} and ``\\ti{last}'' is the replacement for {\\masky}.\n",
"This is well suited for prompt generation: we can simply take input sentences from $\\dtrain$ and let the T5 model construct the template $\\template$, without having to specify a pre-defined number of tokens for it.\n",
"\n",
"\n",
"\n",
"Given an input example $(\\xinput, y) \\in \\dtrain$, \n",
"we consider the following simple conversions, denoted as $\\template_{\\gen}(\\xinput, y)$, for formulating the T5 model inputs:\\footnote{We consider putting the label word both before and after the input sentence for single-sentence tasks. However, we find that it is always better to put the label words in the middle (between the two sentences) for sentence-pair tasks.}\n",
"\n",
"\\begin{equation*}\n",
"\\resizebox{.85\\hsize}{!}{\n",
"$\\begin{aligned}\n",
"\\lsent &\\longrightarrow~\\maskx~\\lwordmap(y)~\\masky~\\lsent, \\\\\n",
"\\lsent &\\longrightarrow~\\lsent~\\maskx~\\lwordmap(y)~\\masky,\\\\\n",
"\\lfirstsent,\\lsecondsent &\\longrightarrow \\lfirstsent~\\maskx~\\lwordmap(y)~\\masky~\\lsecondsent.\n",
"\\end{aligned}$\n",
"}\n",
"\n",
"\n",
"\n",
"\\end{equation*}\n",
"\n",
"\n",
"As shown in Figure~\\ref{fig:template_search}, we rely on the T5 model to fill in the placeholders. \n",
"\n",
"When decoding, our goal here is to find an output that can work well for \\emph{all} examples in $\\dtrain$,\n",
"i.e.,\n",
"\n",
"the output template $\\template$ that maximizes $\\sum_{(\\xinput, y) \\in \\dtrain}{\\log P_{\\text{T5}}(\\template \\mid \\template_{\\gen}(\\xinput, y))}$,\n",
"where $P_{\\text{T5}}$ denotes the output probability distribution of T5.\n",
"It can be decomposed according to:\n",
"\\vspace{-0.5em}\n",
"\\begin{equation}\n",
"\\resizebox{.87\\hsize}{!}{$\\displaystyle\n",
" \\sum_{j = 1}^{|\\template|}\\hspace{-10pt}\\sum_{~~~~~(\\xinput, y) \\in \\dtrain} {\\hspace{-14pt}\\log{P_{\\text{T5}}\\big(t_j \\mid t_1,...,t_{j-1}, \\template_{\\gen}\\big(\\xinput,y\\big)\\big)}},\n",
"$}\n",
"\\end{equation}\n",
"where $(t_1, \\ldots, t_{|\\template|})$ are the template tokens.\n",
"\n",
"\\begin{figure}[t]\n",
" \\centering\n",
" \\includegraphics[width=0.48\\textwidth]{figures/template_search.pdf}\n",
" \\caption{Our approach for template generation.\n",
" }\n",
" \\label{fig:template_search}\n",
" \\vspace{-5pt}\n",
" \n",
"\\end{figure}\n",
"\n",
"\n",
"\n",
"\n",
"We use beam search to decode multiple template candidates. Concretely, we use a wide beam width (e.g., 100) to cheaply obtain a large set of diverse templates. We then fine-tune each generated template on $\\dtrain$ and use $\\ddev$ to either pick the single template with the best performance (Table~\\ref{tab:main_results}), or the top $k$ templates to use as an ensemble (Table~\\ref{tab:ensemble}). Though it might appear to be expensive to fine-tune the model on each individual template, this is fast in practice due to the small size of $\\dtrain$, and is also fully automated: making it easy to use, compared to manually tuning prompts for each dataset.\n",
"\n",
"\n",
"\\section{Fine-tuning with Demonstrations}\n",
"\\label{sec:demonstrations}\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.0\\textwidth}{!}{\n",
"\\begin{tabular}{lcccccccc}\n",
"\\toprule\n",
"& \\tf{SST-2} & \\tf{SST-5} & \\tf{MR} & \\tf{CR} & \\tf{MPQA} & \\tf{Subj} & \\tf{TREC} & \\tf{CoLA} \\\\\n",
"& (acc) & (acc) & (acc) & (acc) & (acc) & (acc) & (acc) & (Matt.)\\\\\n",
"\\midrule\n",
"\n",
"Majority$^\\dagger$ & \\ti{50.9} & \\ti{23.1} & \\ti{50.0} & \\ti{50.0} & \\ti{50.0} & \\ti{50.0} & \\ti{18.8} & \\ti{0.0} \\\\\n",
"Prompt-based zero-shot$^\\ddagger$ & 83.6 &\t35.0 &\t80.8 &\t79.5 &\t67.6 &\t51.4 &\t32.0 &\t2.0 \\\\\n",
"\n",
"``GPT-3'' in-context learning &84.8 (1.3) &\t30.6 (0.9) &\t80.5 (1.7) &\t87.4 (0.8) &\t63.8 (2.1) &\t53.6 (1.0) &\t26.2 (2.4) &\t-1.5 (2.4) \\\\\n",
"Fine-tuning & 81.4 (3.8) &\t43.9 (2.0) &\t76.9 (5.9) &\t75.8 (3.2) &\t72.0 (3.8) &\t90.8 (1.8) &\t{88.8} (2.1) &\t\\tf{33.9} (14.3) \\\\\n",
"\n",
"\\midrule\n",
"Prompt-based FT (man) & 92.7 (0.9) &\t47.4 (2.5) &\t87.0 (1.2) &\t90.3 (1.0) &\t84.7 (2.2) &\t91.2 (1.1) &\t84.8 (5.1) &\t9.3 (7.3) \\\\\n",
"\\tableindent + demonstrations & 92.6 (0.5) &\t\\tf{50.6} (1.4) &\t86.6 (2.2) &\t90.2 (1.2) &\t\\tf{87.0} (1.1) &\t\\tf{92.3} (0.8) &\t87.5 (3.2) &\t18.7 (8.8) \t\\\\\n",
"Prompt-based FT (auto) & 92.3 (1.0) &\t49.2 (1.6) &\t85.5 (2.8) &\t89.0 (1.4) &\t85.8 (1.9) &\t91.2 (1.1) &\t88.2 (2.0) &\t14.0 (14.1) \\\\\n",
"\\tableindent + demonstrations & \\tf{93.0} (0.6) &\t49.5 (1.7) &\t\\tf{87.7} (1.4) &\t\\tf{91.0} (0.9) &\t86.5 (2.6) &\t91.4 (1.8) &\t\\tf{89.4} (1.7) &\t21.8 (15.9)\\\\\n",
"\\midrule\n",
"Fine-tuning (full)$^\\dagger$ & \\ti{95.0} & \\ti{58.7} & \\ti{90.8} & \\ti{89.4} & \\ti{87.8} & \\ti{97.0} & \\ti{97.4} & \\ti{62.6} \\\\\n",
"\n",
"\\midrule\n",
" & \\tf{MNLI} & \\tf{MNLI-mm} & \\tf{SNLI} & \\tf{QNLI} & \\tf{RTE} & \\tf{MRPC} & \\tf{QQP} & \\tf{STS-B} \\\\\n",
" & (acc) & (acc) & (acc) & (acc) & (acc) & (F1) & (F1) & (Pear.)\\\\\n",
"\\midrule\n",
"\n",
"Majority$^\\dagger$ & \\ti{32.7} & \\ti{33.0} & \\ti{33.8} & \\ti{49.5} & \\ti{52.7} & \\ti{81.2} & \\ti{0.0} & \\ti{-} \\\\\n",
"Prompt-based zero-shot$^\\ddagger$ &\t50.8 &\t51.7 &\t49.5 &\t50.8 &\t51.3 & 61.9 &\t49.7 &\t-3.2 \\\\\n",
"\n",
"``GPT-3'' in-context learning & 52.0 (0.7) &\t53.4 (0.6) &\t47.1 (0.6) &\t53.8 (0.4) &\t60.4 (1.4) &\t45.7 (6.0) &\t36.1 (5.2) &\t14.3 (2.8) \\\\\n",
"Fine-tuning &\t45.8 (6.4) &\t47.8 (6.8) &\t48.4 (4.8) &\t60.2 (6.5) &\t54.4 (3.9) & {76.6} (2.5) &\t60.7 (4.3) &\t53.5 (8.5) \\\\\n",
"\n",
"\\midrule\n",
"Prompt-based FT (man) &\t68.3 (2.3) &\t70.5 (1.9) &\t77.2 (3.7) &\t64.5 (4.2) &\t69.1 (3.6) & 74.5 (5.3) &\t65.5 (5.3) &\t71.0 (7.0) \\\\\n",
"\\tableindent + demonstrations &\t\\tf{70.7} (1.3) &\t\\tf{72.0} (1.2) &\t\\tf{79.7} (1.5) &\t\\tf{69.2} (1.9) &\t68.7 (2.3) & 77.8 (2.0) &\t\\tf{69.8} (1.8) &\t73.5 (5.1) \t\\\\\n",
"Prompt-based FT (auto) &\t68.3 (2.5) &\t70.1 (2.6) &\t77.1 (2.1) &\t68.3 (7.4) &\t\\tf{73.9} (2.2) & 76.2 (2.3) &\t67.0 (3.0) &\t75.0 (3.3) \\\\\n",
"\\tableindent + demonstrations & 70.0 (3.6) &\t\\tf{72.0} (3.1) &\t77.5 (3.5) &\t68.5 (5.4) &\t{71.1} (5.3) &\t\\tf{78.1} (3.4) &\t67.7 (5.8) &\t\\tf{76.4} (6.2) \\\\\n",
"\\midrule\n",
"Fine-tuning (full)$^\\dagger$ & \\ti{89.8} &\t\\ti{89.5} & \\ti{92.6}\t &\t\\ti{93.3} &\t\\ti{80.9} &\t\\ti{91.4} &\t\\ti{81.7} & \\ti{91.9} \\\\\n",
"\n",
"\\bottomrule\n",
"\\end{tabular}}\n",
"\\end{center}\n",
"\n",
"\\caption{\n",
"Our main results using RoBERTa-large.\n",
"$\\dagger$: full training set is used (see dataset sizes in\n",
"Table~\\ref{tab:datasets});\n",
"$\\ddagger$: no training examples are used; otherwise we use\n",
"\n",
"$K = 16$ (per class)\n",
"for few-shot experiments.\n",
"\n",
"We report mean (and standard deviation) performance over 5 different splits (\\S \\ref{sec:setup}).\n",
"{Majority:} majority class;\n",
"{FT:} fine-tuning;\n",
"{man:} manual prompt\n",
"(Table~\\ref{tab:manual_prompts});\n",
"{auto:} automatically searched templates (\\S\\ref{sec:template_search});\n",
"{``GPT-3'' in-context learning:} using the in-context learning proposed in \\newcite{brown2020language} with RoBERTa-large (no parameter updates).\n",
"}\n",
"\\label{tab:main_results}\n",
"\\end{table*}\n",
"\n",
"In this section, we study whether we can leverage demonstrations when \\ti{fine-tuning} medium-sized LMs, and find better ways to exploit them.\n",
"\n",
"\\subsection{Training examples as demonstrations}\n",
"GPT-3's naive approach to in-context learning simply involves concatenating the input with up to 32 examples randomly drawn from the training set.\n",
"This approach is suboptimal as\n",
"(1) the number of available demonstrations is bounded by the model's maximum input length;\\footnote{GPT-3 uses a context size of 2,048 while most smaller language models (e.g., RoBERTa) have a context size of 512.}\n",
"\n",
"and (2) mixing numerous random examples from different classes together creates extremely long contexts which can be hard to leverage, especially for a smaller model.\n",
"To address these issues,\n",
"we propose a simpler solution:\n",
"at each training step,\n",
"we randomly sample \\ti{one}\\footnote{We also explored sampling multiple examples per class, but did not observe any improvements.} example $\\big(\\xinput^{(c)}, y_{\\phantom{t}}^{(c)}\\big)\\in \\dtrain$ from each class,\n",
"convert it into $\\template\\big(\\xinput^{(c)}\\big)$ with {\\mask} replaced by $\\mapping(y_{\\phantom{t}}^{(c)})$---we denote this as $\\tilde{\\template}\\big(\\xinput^{(c)}, y_{\\phantom{t}}^{(c)}\\big)$---and then concatenate them with $\\xinput$ (Figure~\\ref{fig:overview}(c)):\n",
"\n",
"\\begin{equation*}\n",
"\\resizebox{.89\\hsize}{!}{$\\displaystyle\n",
" \\template\\big(\\xinput\\big) \\oplus \\tilde{\\template}\\big(\\xinput^{(1)}, y_{\\phantom{t}}^{(1)}\\big) \\oplus \\cdots \\oplus \\tilde{\\template}\\big(\\xinput^{(|\\labelset|)}, y_{\\phantom{t}}^{(|\\labelset|)}\\big).\n",
"$}\n",
"\n",
"\\end{equation*}\n",
"Here $\\oplus$ denotes concatenation of input sequences.\n",
"During both training and inference we sample multiple demonstration sets for each $\\xinput$. Note that both $\\xinput$ and demonstration examples are sampled from the same set $\\dtrain$ during training. At testing time, we still sample demonstration sets from $\\dtrain$ and ensemble predictions across all sets.\n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Sampling similar demonstrations}\n",
"\\label{sec:demonstration_sampling}\n",
"We observe that controlling the construction of the demonstration examples $\\{(\\xinput^{(c)}, y_{\\phantom{t}}^{(c)})\\}$ is crucial for good final performance.\n",
"For example, if the set of contrastive demonstrations $\\xinput^{(c)}$ are all dramatically different---from each other, or from the query $\\xinput$---then it becomes challenging for the language model to decipher meaningful patterns. As a result, the model may simply ignore the context, or even get confused by the additional examples.\n",
"To address this issue, we devise a simple strategy in which we only sample examples that are semantically close to $\\xinput$.\n",
"Specifically, we use a pre-trained SBERT~\\cite{reimers2019sentence} model to obtain embeddings for all input sentences (for sentence-pair tasks, we use the concatenation of the two sentences).\n",
"Here we just feed the raw sentences without the templates into SBERT.\n",
"For each query $\\xinput$ and each label $c\\in \\labelset$, we sort all training instances with the label $x \\in \\dtrain^{c}$ by their similarity score to the query $\\cos(\\mf{e}(\\xinput), \\mf{e}(x))$, and only sample from the top $r = 50\\\n",
"\n",
"\n",
"\n",
"\n"
],
"context_after_exp": [
"\\section{Experiments}\n",
"\\label{sec:experiments}\n",
"We present our main results, and address several research questions pertaining to our \\ours approach.\n",
"Implementation details are in Appendix~\\ref{app:exp_details}.\n",
"\n",
"\\subsection{Main results}\n",
"\\label{sec:mainresult}\n",
"We use a RoBERTa-large model and set $K = 16$ in our experiments.\n",
"A comparison of using RoBERTa vs BERT can be found in\n",
"Appendix~\\ref{app:analysis_bert}.\n",
"For automatic prompt search, in our main table we report automatic template search only (which consistently performs the best, see Table~\\ref{tab:auto_search}). To put our results in perspective, we compare to a number of baselines, namely\n",
"(1) standard fine-tuning in our few-shot setting;\n",
"(2) standard fine-tuning using the full training set;\n",
"(3) simply taking the most frequent class (measured on the full training set);\n",
"(4) prompt-based zero-shot prediction where we take our manual prompts and use $\\lm$ ``out-of-the-box'' without using any training examples; and\n",
"(5) ``GPT-3'' in-context learning, where we use the same prompt-based zero-shot setting, but augment the context with randomly sampled 32 demonstrations\n",
"(and still use RoBERTa-large, not GPT-3).\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{0.93\\columnwidth}{!}{\n",
" \\begin{tabular}{lcc}\n",
" \\toprule\n",
" {Prompt-based Fine-tuning} & \\tf{MNLI} & \\tf{RTE} \\\\\n",
" \\midrule\n",
" Our single manual $\\mathcal{P}$ & 68.3 (2.3) & 69.1 (3.6) \\\\\n",
" $\\mathcal{P}_{\\text{PET}}$ & 71.9 (1.5) & 69.2 (4.0) \\\\\n",
" $\\mathcal{P}_{\\text{ours}}$, $|\\mathcal{P}_{\\text{ours}}| = |\\mathcal{P}_{\\text{PET}}|$ & 70.4 (3.1) &\t73.0 (3.2)\\\\\n",
" \n",
" \\tableindent + demonstrations & 74.0 (1.9) & 71.9 (4.6)\\\\\n",
" $\\mathcal{P}_{\\text{ours}}$, $|\\mathcal{P}_{\\text{ours}}| = 20$&72.7 (2.5) & \\tf{73.1} (3.3)\\\\\n",
" \\tableindent + demonstrations& \\tf{75.4} (1.6) & 72.3 (4.5)\\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\caption{Ensemble models using manual prompts from PET~\\cite{schick2020exploiting,schick2020size} and our automatic templates. PET uses 4 prompts for MNLI and 5 for RTE. We also use an equal number of templates \n",
" in $|\\mathcal{P}_{\\text{ours}}| = |\\mathcal{P}_{\\text{PET}}|$ \n",
" for a fair comparison.}\n",
" \\vspace{-3pt}\n",
" \\label{tab:ensemble}\n",
"\\end{table}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{0.90\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Manual & \\tf{92.7} & \\tf{77.2} & 84.8&74.5 \\\\\n",
" \\midrule\n",
" Auto T & 92.3 & 77.1 & {88.2} &76.2 \\\\\n",
" Auto L & 91.5 & 75.6 & 87.0 & \\tf{77.2} \\\\\n",
" Auto T + L & 92.1 & 77.0 & \\tf{89.2} &74.0 \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
"\n",
" \\caption{\n",
" Comparison between manual prompts and different automatic prompt generation methods: auto-generated templates (Auto T), auto-generated label words (Auto L), and their combination (Auto T + L).\n",
" \n",
" \n",
" \n",
" }\n",
"\n",
" \\vspace{-3pt}\n",
" \\label{tab:auto_search}\n",
"\\end{table}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\paragraph{Single-prompt results.}\n",
"Table~\\ref{tab:main_results} shows our main results using a single prompt, either from our manually designed ones (Table~\\ref{tab:manual_prompts}) , or the best generated ones.\n",
"First, prompt-based zero-shot prediction achieves much better performance than the majority class, showing the pre-encoded knowledge in RoBERTa.\n",
"Also, ``GPT-3'' in-context learning\n",
"does not always improve over zero-shot prediction, likely because smaller language models are not expressive enough to use off-the-shelf like GPT-3. \n",
"\n",
"Second, prompt-based fine-tuning can greatly outperform standard fine-tuning, both when using a manual prompt or a generated one.\n",
"\n",
"CoLA is one interesting exception, as the input may be a non-grammatical sentence which is out of the distribution of $\\lm$. \n",
"Generally, our automatically searched templates can achieve comparable or even higher results than manual ones,\n",
"especially for tasks in which constructing strong manual templates is less intuitive (e.g., TREC, QNLI and MRPC).\n",
"\n",
"\n",
"\n",
"\\begin{table}[!t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{0.92\\columnwidth}{!}{\n",
" \\begin{tabular}{ll}\n",
" \\toprule\n",
" \\tf{SST-2} & (positive/negative) \\\\\n",
" \\midrule\n",
"\n",
" Auto T & $\\mapping(\\labelset)$ = \\{great, terrible\\}\\\\\n",
" & \\#1. {\\sent} A {\\mask} one .\\\\\n",
" & \\#2. {\\sent} A {\\mask} piece .\\\\\n",
" & \\#3. {\\sent} All in all {\\mask} .\\\\\n",
" \\midrule\n",
" Auto L & $\\template(\\xinput)$ = \\sent~It was \\mask . \\\\\n",
" & \\#1. irresistible/pathetic\\\\\n",
" & \\#2. wonderful/bad \\\\\n",
" & \\#3. delicious/bad \\\\\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
" \\midrule\n",
" \\tf{SNLI} & (entailment/neutral/contradiction) \\\\\n",
" \\midrule\n",
" Auto T & $\\mapping(\\labelset)$ = \\{Yes, Maybe, No\\} \\\\\n",
" & \\#1. {\\firstsent} . {\\mask} , no , {\\secondsent} \\\\\n",
" & \\#2. {\\firstsent} . {\\mask} , in this case {\\secondsent} \\\\\n",
" & \\#3. {\\firstsent} . {\\mask} this time {\\secondsent} \\\\\n",
" \\midrule\n",
" Auto L & $\\template(\\xinput)$ = \\firstsent~? \\mask~, \\secondsent \\\\\n",
" & \\#1. Alright/Watch/Except \\\\\n",
" & \\#2. Hi/Watch/Worse \\\\\n",
" & \\#3. Regardless/Fortunately/Unless \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\vspace{-3pt}\n",
" \\caption{Examples of our automatically generated templates (Auto T) and label words (Auto L).}\n",
" \\vspace{-8pt}\n",
" \\label{tab:generated_template}\n",
" \\end{table}\n",
"\n",
"Finally, using demonstrations in context leads to consistent gains in a majority of tasks.\n",
"\n",
"\n",
" \n",
"\n",
"In summary, our combined solution---fine-tuning with automatically searched templates and sampled demonstration sets---achieves a $30\\\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\paragraph{Ensemble results.} An advantage of automatic prompt search is that we can generate as many prompts as we want, train individual models, and create large ensembles. PET~\\cite{schick2020exploiting,schick2020size} also ensembles multiple models trained with manual prompts.\\footnote{They then use unlabeled data and distillation to get a single model, which is outside of our scope.} In Table~\\ref{tab:ensemble}, we make a direct comparison of our searched prompts and PET's manual prompts on MNLI and RTE (two datasets that we evaluate in common).\\footnote{In the PET NLI templates, the hypothesis is put before the premise, which we actually found to be suboptimal. In our experiments, we swap the two and get better results.}\n",
"As the results show, an ensemble with multiple templates always improves performance.\n",
"An ensemble of the same number of automatic templates achieves comparable or better performance than the ensemble of PET's manual prompts. Increasing the number of automatic templates brings further gains.\n",
"\n",
"\n",
"\\subsection{Analysis of generated prompts}\n",
"Table~\\ref{tab:auto_search} gives the results of using manual vs automatic prompts.\n",
"For automatic prompts, we compare\n",
"\n",
"\n",
"template search (Auto T),\n",
"label word search (Auto L),\n",
"and a joint variant (Auto T + L) in which \n",
"we start from manual label words, apply Auto T, and then Auto L.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"In most cases, Auto T achieves comparable or higher performance than manual ones, and is consistently the best variant. Auto L outperforms manual prompts on TREC and MRPC---but is considerably worse on SNLI. Auto T + L is often better than Auto L, but only sometimes better than Auto T.\n",
"\n",
"\n",
"\n",
"Table~\\ref{tab:generated_template} shows examples from Auto T and Auto L (A full list in Appendix~\\ref{app:generated_prompts}).\n",
"Auto T templates generally fit the context and label words well, but can contain biased peculiarities (e.g., ``\\emph{\\{Yes/No\\}, no}'' in SNLI).\n",
"For Auto L words, things are mixed: while most look intuitively reasonable, there are also some mysterious abnormalities (e.g., ``\\emph{Hi}'' for the ``entailment'' class in SNLI).\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Analysis of demonstration sampling}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.0\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" & \\tf{SST-2} & \\tf{SNLI} &\\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Prompt-based FT & \\tf{92.7} & 77.2 & 84.8 & 74.5 \\\\\n",
" \\midrule\n",
" Uniform sampling & 92.3 & 78.8 & 85.6 & 70.9 \\\\\n",
" \\tableindent + RoBERTa sel. & \\tf{92.7} & 79.5 & 83.4 & 76.6 \\\\\n",
" \\tableindent + SBERT sel. & 92.6 & \\tf{79.7} & \\tf{87.5} & \\tf{77.8} \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
"\n",
" \\caption{\n",
" Impact of demonstration sampling strategies.\n",
" Uniform sampling randomly samples demonstrations, while selective (sel.) sampling only takes top sentences measured by the sentence encoders (\\S \\ref{sec:demonstrations}).\n",
" }\n",
" \\vspace{-10pt}\n",
" \\label{tab:pair_ablation}\n",
"\\end{table}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"Table~\\ref{tab:pair_ablation} compares the performance of demonstrations using uniform sampling to selective sampling by SBERT.\n",
"\n",
"We acknowledge that SBERT is trained on SNLI and MNLI datasets, thus we also tried a simple sentence encoder using mean pooling of hidden representations from RoBERTa-large.\n",
"\n",
"\n",
"We find that in either case, using selective sampling outperforms uniform sampling, highlighting the importance of sampling similar examples for incorporating demonstrations in context.\n",
"\n",
"\n",
"\n",
"\\subsection{Sample efficiency}\n",
"\n",
"\n",
"\n",
"Figure~\\ref{fig:sample} illustrates\n",
"how standard fine-tuning and our \\ours compare as $K$ increases.\n",
"For a simple task such as SST-2 (also see MR, CR and MPQA in Table~\\ref{tab:main_results}), despite using only 32 total examples, \\ours has already nearly saturated its performance and is comparable to standard fine-tuning over the entire dataset. On the harder task of SNLI, \\ours continues to improve as $K$ increases while still maintaining a performance gap over standard fine-tuning, until the two converge around $K = 256$.\n",
"\n",
"\n",
"\\section{Analysis}\n",
"\\label{sec:analysis}\n",
"\n",
"\n",
"\\subsection{Generated vs. manual prompts}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\danqi{I am also thinking we need to discuss the imbalanced-class issue for SNLI tasks (zero-shot and after fine-tuning). }\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{0.90\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Manual & \\tf{92.7} & \\tf{77.2} & 84.8&74.5 \\\\\n",
" \\midrule\n",
" Auto T & 92.3 & 77.1 & {88.2} &76.2 \\\\\n",
" Auto L & 91.5 & 75.6 & 87.0 & \\tf{77.2} \\\\\n",
" Auto T + L & 92.1 & 77.0 & \\tf{89.2} &74.0 \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
"\n",
" \\caption{\n",
" Comparison between manual prompts and different automatic prompt generation methods: auto-generated templates (Auto T), auto-generated label words (Auto L), and their combination (Auto T + L).\n",
" \n",
" \n",
" \n",
" }\n",
"\n",
" \\vspace{-3pt}\n",
" \\label{tab:auto_search}\n",
"\\end{table}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[!t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{0.92\\columnwidth}{!}{\n",
" \\begin{tabular}{ll}\n",
" \\toprule\n",
" \\tf{SST-2} & (positive/negative) \\\\\n",
" \\midrule\n",
"\n",
" Auto T & $\\mapping(\\labelset)$ = \\{great, terrible\\}\\\\\n",
" & \\#1. {\\sent} A {\\mask} one .\\\\\n",
" & \\#2. {\\sent} A {\\mask} piece .\\\\\n",
" & \\#3. {\\sent} All in all {\\mask} .\\\\\n",
" \\midrule\n",
" Auto L & $\\template(\\xinput)$ = \\sent~It was \\mask . \\\\\n",
" & \\#1. irresistible/pathetic\\\\\n",
" & \\#2. wonderful/bad \\\\\n",
" & \\#3. delicious/bad \\\\\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
" \\midrule\n",
" \\tf{SNLI} & (entailment/neutral/contradiction) \\\\\n",
" \\midrule\n",
" Auto T & $\\mapping(\\labelset)$ = \\{Yes, Maybe, No\\} \\\\\n",
" & \\#1. {\\firstsent} . {\\mask} , no , {\\secondsent} \\\\\n",
" & \\#2. {\\firstsent} . {\\mask} , in this case {\\secondsent} \\\\\n",
" & \\#3. {\\firstsent} . {\\mask} this time {\\secondsent} \\\\\n",
" \\midrule\n",
" Auto L & $\\template(\\xinput)$ = \\firstsent~? \\mask~, \\secondsent \\\\\n",
" & \\#1. Alright/Watch/Except \\\\\n",
" & \\#2. Hi/Watch/Worse \\\\\n",
" & \\#3. Regardless/Fortunately/Unless \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\vspace{-3pt}\n",
" \\caption{Examples of our automatically generated templates (Auto T) and label words (Auto L).}\n",
" \\vspace{-8pt}\n",
" \\label{tab:generated_template}\n",
" \\end{table}\n",
"\n",
"In this section, we study the quality of our automatically generated prompts. This includes two parts: automatically generated templates (auto T) using manual label words and generated label words (auto L) using manual templates. Table~\\ref{tab:auto_search} shows the results of using manual or automatic prompts on selected datasets. In most cases, auto T achieves comparable or even higher performance than manual prompts. Auto L can outperform manual prompts on some datasets, but there are also cases where auto L perform significantly worse than the original results.\n",
"\n",
"To further analyze the automatic search results, we demonstrate some of the generated examples in Table~\\ref{tab:generated_template}.\n",
"Generated templates fit the context and the manual label words for most cases.\n",
"For automatically generated label words, things are mixed: while most of them look intuitively reasonable, there are some abnormal label words (e.g., ``better'' for the negative class in SST-5). We believe this is due to the overfitting issue of automatic label word search.\n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Analysis of in-context learning}\n",
"\\label{sec:in_context_analysis}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"In this section we compare different variants of in-context fine-tuning. Table~\\ref{tab:pair_ablation} reports the performance of in-context fine-tuning without filtering, filtered by RoBERTa and filtered by Sentence-BERT. Since RoBERTa does not provide sentence embedding directly, we use the mean pooling over representations at all positions.\n",
"\n",
"From Table~\\ref{tab:pair_ablation}, we can see that all variants outperform prompt-based fine-tuning on most tasks. Compared to the vanilla in-context fine-tuning, using either of the encoders leads to further boost.\n",
"Among them, Sentence-BERT filtering achieves the best performance, and we take it as the default in-context fine-tuning model. We acknowledge that Sentence-BERT is trained on SNLI~\\cite{bowman2015large_snli}, MNLI~\\cite{williams2018broad_mnli} and STS-B~\\cite{cer2017semeval_sts-b} datasets, and this may contribute to the good performance in filtering.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.0\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" & \\tf{SST-2} & \\tf{SNLI} &\\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Prompt-based FT & \\tf{92.7} & 77.2 & 84.8 & 74.5 \\\\\n",
" \\midrule\n",
" Uniform sampling & 92.3 & 78.8 & 85.6 & 70.9 \\\\\n",
" \\tableindent + RoBERTa sel. & \\tf{92.7} & 79.5 & 83.4 & 76.6 \\\\\n",
" \\tableindent + SBERT sel. & 92.6 & \\tf{79.7} & \\tf{87.5} & \\tf{77.8} \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
"\n",
" \\caption{\n",
" Impact of demonstration sampling strategies.\n",
" Uniform sampling randomly samples demonstrations, while selective (sel.) sampling only takes top sentences measured by the sentence encoders (\\S \\ref{sec:demonstrations}).\n",
" }\n",
" \\vspace{-10pt}\n",
" \\label{tab:pair_ablation}\n",
"\\end{table}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Comparisons of pre-trained LMs}\n",
"\n",
"\\label{sec:analysis_bert}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
" \\begin{table}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.0\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" \\tf{BERT-large} & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Fine-tuning & 79.5 &\t51.4 & 80.3& \\tf{74.4} \\\\\n",
" \\midrule\n",
" Prompt-based FT & 85.6 & 59.2 & 79.0 & 66.8 \\\\\n",
" \\tableindent + demo (1-seg) & \\tf{87.5} & 50.4 & 77.2 & 68.5 \\\\\n",
" \\tableindent + demo (2-seg) & 86.1 & \\tf{61.3} & 77.9 & 73.2 \\\\\n",
" \\tableindent + demo ($n$-seg) & 86.4 & 58.6 & \\tf{79.6} & 71.0 \\\\\n",
" \\midrule\n",
" \\tf{RoBERTa-large} & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Fine-tuning & 81.4 & 48.4 & \\tf{88.8} & 76.6\\\\\n",
" \\midrule\n",
" Prompt-based FT & \\tf{92.7} & 77.2 & 84.8 & 74.5 \\\\\n",
" \\tableindent + demonstrations & 92.6 & \\tf{79.7} & 87.5 & \\tf{77.8} \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\caption{A comparison of BERT-large vs RoBERTa-large. We use manual prompts in these experiments.}\n",
" \\label{tab:bert}\n",
" \\end{table}\n",
" \n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"Table~\\ref{tab:bert} shows the results of using BERT-large (uncased) and RoBERTa-large in our settings. Our in-context fine-tuning also works for BERT on some datasets, but the results are mixed compared to RoBERTa. This might be due to that BERT uses different segment embeddings to distinguish different parts of inputs (e.g., premise and hypothesis in NLI). There are only 2 pre-trained segment embeddings, and for in-context learning, we need to train new segment embeddings from scratch, which increases the instability of few-shot fine-tuning. \n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Sample Efficiency}\n",
"\n",
"\n",
"\\begin{figure}\n",
" \\centering\n",
" \\includegraphics[width=0.235\\textwidth]{figures/sample_sst2.pdf}\n",
" \\includegraphics[width=0.235\\textwidth]{figures/sample_snli.pdf}\n",
" \\caption{Performance of fine-tuning and our LM-BFF with different $K$ (numbers of instances per class).\n",
" \\todo{The last point of SNLI is a placeholder.}}\n",
" \\label{fig:sample}\n",
"\\end{figure} \n",
"\n",
"It is interesting to see how the standard fine-tuning and our method (LM-BFF) perform with increasing K and where we stand compared to taking the full dataset fine-tuning. Figure~\\ref{fig:sample} gives a comparison on SST-2 and SNLI. \n",
"We can see that for simple tasks like SST-2 (also see MR, CR and MPQA in Table~\\ref{tab:main_results}), LM-BFF already achieves comparable results to full dataset fine-tuning only with 32 examples. \n",
"With increasing $K$, LM-BFF continues to show performance gain compared to standard fine-tuning, until after $K=256$ where the two approaches converge.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Discussion}\n",
"\\label{sec:limitations}\n",
"\n",
"Reformulating NLP tasks as MLM has exciting implications for few-shot learning, but also has limitations. \n",
"First, while LM-BFF greatly outperforms standard fine-tuning, Table~\\ref{tab:main_results} shows that, overall, the performance still substantially lags behind \n",
"fine-tuning with thousands of examples, especially for harder tasks. \n",
"Additionally, just like standard fine-tuning, our results also suffer from high variance. \n",
"As described in \\S\\ref{sec:related_work}, several recent studies have tried to counter instability in few-shot fine-tuning \n",
"\n",
"and we expect these methods to also help here. \n",
"\n",
"\n",
"\n",
"With respect to automatic prompt generation, despite its effectiveness, \n",
"we still find it practically challenging to expand the search space, \n",
"or generalize well based on only approximately 32 examples. \n",
"This is partly due to our lingering reliance on \\emph{some} manual design---either manual templates (for label word search) or manual label words (for template search), \n",
"\n",
"which allows us to get our search off the ground, but does also bias it towards areas of the search space that we might have already imagined.\n",
"\n",
"\n",
"\n",
"\n",
"Finally, it is important to clarify that LM-BFF favors certain tasks which \n",
"(1) can be naturally posed as a ``fill-in-the-blank'' problem; \n",
"(2) have relatively short input sequences; and \n",
"(3) do not contain many output classes. \n",
"Issues (2) and (3) might be ameliorated with longer-context language models~\\cite[e.g.,][]{Beltagy2020Longformer}.\n",
"\n",
"For tasks that are not straightforward to formulate in prompting, such as structured prediction, issue (1) is more fundamental. \n",
"We leave it as an open question for future work.\n",
"\n",
"\\begin{figure}[!t]\n",
" \\centering\n",
" \\includegraphics[width=0.237\\textwidth, trim=4 5 0 0, clip]{figures/sample_sst2.pdf}\n",
" \\includegraphics[width=0.237\\textwidth, trim=4 5 0 0, clip]{figures/sample_snli.pdf}\n",
" \\caption{Standard fine-tuning vs our LM-BFF as a function of $K$ (\\# instances per class). For lower $K$, our method consistently outperforms standard fine-tuning.}\n",
" \\label{fig:sample}\n",
"\\end{figure}\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Conclusion}\n",
"\\label{sec:conclusion}\n",
"\n",
"In this paper we presented LM-BFF, a set of simple but effective techniques for fine-tuning language models using only a few examples. Our approach proposes to\n",
"(1) use prompt-based fine-tuning with automatically searched prompts;\n",
"and (2) include selected task demonstrations (training examples) as part of the input context.\n",
"We show \n",
"that our method outperforms vanilla fine-tuning by up to $30\\\n",
"We concluded by discussing the limitations of our approach, and posed open questions for future study.\n",
"\n",
"\\section*{Acknowledgements}\n",
"We thank the members of Princeton, MIT, Tsinghua NLP groups and the anonymous reviewers for their valuable feedback. TG is supported by a Graduate Fellowship at Princeton University and AF is supported by an NSF Graduate Research Fellowship. This research is also partly supported by a Google Research Scholar Award.\n",
"\n",
"\n",
"\\begin{comment}\n",
"\n",
"\\section*{Ethical Considerations}\n",
"\n",
"This work aims to further progress on few-shot learning across a range of NLP tasks. In general, allowing for overall smaller models to be used effectively with few labeled examples expands the accessibility of NLP solutions to more users with limited resources.\n",
"Nevertheless, our work makes use of medium-sized pre-trained language models, which---though smaller by design than other contemporary, massive models such as GPT-3---still require care when being deployed in potentially sensitive situations.\n",
"More concretely, leveraging the built-in knowledge of pre-trained language models as much as possible is a key feature we exploit in this work for effective few-shot learning.\n",
"At the same time, it is well known that these models can inherit the biases present in the data they are trained on---and therefore for some problems (such as those that are race- or gender-sensitive) may require modification and oversight.\n",
"However, though our methods may have similar bias concerns as a result, they are agnostic to the specific choice of language models, and we anticipate that developments in ethically-compliant language models can straighforwardly carry through in our use cases.\n",
"\n",
"\\end{comment}\n",
"\n",
"\n",
"\n",
"\\clearpage\n",
"\\bibliography{ref}\n",
"\\bibliographystyle{acl_natbib}\n",
"\n",
"\n",
"\\clearpage\n",
"\\appendix\n",
"\\counterwithin{figure}{section}\n",
"\\counterwithin{table}{section}\n",
"\n",
"\n",
"\\clearpage\n",
"\\section{Impact of Development Sets}\n",
"\\label{app:dev_size}\n",
"\n",
"\n",
"Table~\\ref{tab:exp_large_dev} shows how the size of the development sets can affect the final performance of the model.\n",
"For ``No $\\ddev$'', we take the same hyper-parameters from~\\citet{schick2020exploiting,schick2020size}: batch size = 16, learning rate = 1e-5 and training steps = 250. We also experiment with a variant that we sample a development set of 10 times larger than the training set. We can see that using larger development sets leads to better performance, and this is why we stick to $|\\dtrain| = |\\ddev|$ in our few-shot setting.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[h]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.0\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" {Fine-tuning} & \\tf{SST-2} & \\tf{SNLI} &\\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" No $\\ddev$ & 79.5 & 49.2 & 83.9 & 77.8 \\\\\n",
" $|\\ddev| = |\\dtrain|$ & 81.4 & 48.4 & 88.8 & 76.6 \\\\\n",
" $|\\ddev| = 10|\\dtrain|$ & 83.5 & 52.0 & 89.4 & 79.6 \\\\\n",
" \\midrule\n",
" {Prompt-based FT} & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" No $\\ddev$ & 92.1 & 75.3 & 84.8 & 70.2 \\\\\n",
" $|\\ddev| = |\\dtrain|$ & 92.7 & 77.2 & 84.8 & 74.5 \\\\\n",
" $|\\ddev| = 10|\\dtrain|$ & 93.0 & 79.7 & 89.3 & 80.9 \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\vspace{-5pt}\n",
" \\caption{Impact of different sizes of development sets. Standard deviations are omitted here to save space. For No $|\\ddev|$, we use the same set of hyper-parameters as \\newcite{schick2020exploiting,schick2020size}.}\n",
" \\vspace{-15pt}\n",
" \\label{tab:exp_large_dev}\n",
"\\end{table}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Datasets}\n",
"\\label{app:datasets}\n",
"\n",
"\n",
"\n",
"For SNLI~\\cite{bowman2015large_snli} and datasets from GLUE~\\cite{wang2019glue}, including SST-2~\\cite{socher2013recursive_sst-2}, CoLA~\\cite{warstadt2019neural_cola}, MNLI~\\cite{williams2018broad_mnli}, QNLI~\\cite{rajpurkar2016squad}, RTE~\\cite{dagan2005pascal_rte1,bar2006second,giampiccolo2007third_rte3,bentivogli2009fifth_rte4}, MRPC~\\cite{dolan2005automatically_mrpc}, QQP\\footnote{\\url{https://www.quora.com/q/quoradata/}} and STS-B~\\cite{cer2017semeval_sts-b}, we follow~\\newcite{zhang2020revisiting} and use their original development sets for testing. For datasets which require a cross-validation evaluation---MR~\\cite{pang2005seeing_mr}, CR~\\cite{hu2004mining_cr}, MPQA~\\cite{wiebe2005annotating_mpqa}, Subj~\\cite{pang2004sentimental_subj}---we simply randomly sample 2,000 examples as the testing set and leave them out from training. For SST-5~\\cite{socher2013recursive_sst-2} and TREC~\\cite{voorhees2000building_trec}, we use their official test sets. We show dataset statistics in Table~\\ref{tab:datasets}.\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.98\\columnwidth}{!}{\n",
"\\begin{tabular}{llcrrrcl}\n",
"\\toprule\n",
"\\tf{Category} & \\tf{Dataset} & $|\\mathcal{Y}|$ & $L$ & \\#Train & \\#Test & \\tf{Type} & \\tf{Labels (classification tasks)} \\\\\n",
"\\bottomrule\n",
" & SST-2 & 2 & 19 & 6,920 & 872 & sentiment & positive, negative \\\\\n",
"& SST-5 & 5 & 18 & 8,544 & 2,210 & sentiment & v. pos., positive, neutral, negative, v. neg. \\\\\n",
"& MR & 2 & 20 & 8,662& 2,000 & sentiment & positive, negative \\\\\n",
"single- & CR & 2 & 19 & 1,775 & 2,000 & sentiment & positive, negative \\\\\n",
"sentence & MPQA & 2 & 3 & 8,606 & 2,000 & opinion polarity & positive, negative \\\\\n",
"& Subj & 2 & 23 & 8,000 & 2,000 & subjectivity & subjective, objective \\\\\n",
"& TREC & 6 & 10 & 5,452 & 500 & question cls. & abbr., entity, description, human, loc., num.\\\\\n",
"& CoLA & 2 & 8 & 8,551 & 1,042 & acceptability & grammatical, not\\_grammatical\\\\\n",
"\\midrule\n",
" & MNLI & 3 & 22/11 & 392,702 & 9,815 & NLI & entailment, neutral, contradiction\\\\\n",
"& SNLI & 3 & 14/8 & 549,367 & 9,842 & NLI & entailment, neutral, contradiction \\\\\n",
"sentence- & QNLI & 2 & 11/30 & 104,743 & 5,463 & NLI & entailment, not\\_entailment \\\\\n",
"pair & RTE & 2 & 49/10 & 2,490 & 277 & NLI & entailment, not\\_entailment \\\\\n",
" & MRPC & 2 & 22/21 & 3,668 & 408 & paraphrase & equivalent, not\\_equivalent \\\\\n",
"& QQP & 2 & 12/12 & 363,846 & 40,431 & paraphrase & equivalent, not\\_equivalent \\\\\n",
"& STS-B & $\\mathcal{R}$ & 11/11 & 5,749 & 1,500 & sent. similarity & - \\\\\n",
"\\bottomrule\n",
"\\end{tabular}\n",
"}\n",
"\\end{center}\n",
"\\caption{The datasets evaluated in this work. $|\\mathcal{Y}|$: \\# of classes for classification tasks (with one exception: STS-B is a real-valued regression task over the interval $[0, 5]$). $L$: average \\# of words in input sentence(s). Note that we only sample $\\dtrain$ and $\\ddev$ of $K \\times |\\labelset|$ examples from the original training set in our few-shot experiments (\\S\\ref{sec:setup}).}\n",
"\\label{tab:datasets}\n",
"\\end{table*}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Experimental Details}\n",
"\\label{app:exp_details}\n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Hyper-parameter selection}\n",
"\\label{app:hyper_selection}\n",
"For grid search, we take learning rates from \\{1e-5, 2e-5, 5e-5\\} and batch sizes from \\{2, 4, 8\\}.\n",
"These numbers are picked by pilot experiments on the SST-2 and SNLI datasets.\n",
"We also use early stopping to avoid overfitting.\n",
"For each trial, we train the model for 1,000 steps, validate the performance every 100 steps, and take the best checkpoint.\n",
"\n",
"\n",
"\n",
"\\subsection{Prompt-based fine-tuning}\n",
"\\label{app:prompts}\n",
"Table~\\ref{tab:manual_prompts} shows all the manual templates and label words we use in experiment.\n",
"For automatically template generation, we take the T5-3B\\footnote{We take the T5 1.0 checkpoint, which is trained on both unsupervised and downstream task data. We compared it to T5 1.1 (without downstream task data) and did not find a significant difference in generated templates.} model, which is the largest publicly available one that can fit on a single GPU.\n",
"For automatically searching label words, we set $k$ to 100 for all tasks except SST-5 and TREC. For SST-5 we set a smaller $k = 30$, as it is a 5-way classification task. For TREC, we observe that filtering $\\mathcal{V}^c$ using conditional likelihood alone is still noisy, thus we set $k = 1000$, and then re-rank $\\mathcal{V}^c$ by the nearest neighbors of the original manual label words and take the top 30 per class. We set $n$ to 100 in all experiments. \n",
"Due to the large number of trials in automatic search, we take a fixed set of hyper-parameters in this part: batch size of 8 and learning rate of 1e-5.\n",
"\n",
"Since the idea of prompt-based fine-tuning is to make the input and output distribution close to the pre-training, the implementation details are crucial.\n",
"For templates, we put extra space before sentences if it is not at the beginning of the input.\n",
"Also, we lowercase the first letter of the sentence if it is concatenated with a prefix (e.g., \\secondsent~in Table~\\ref{tab:manual_prompts}).\n",
"Also if one sentence is appended any punctuation (e.g., \\firstsent~in Table~\\ref{tab:manual_prompts}), then the last character of the original sentence is discarded.\n",
"Finally, we prepend a space for label words in $\\mapping(\\labelset)$. For example, we use ``\\_great'' instead of ``great'' in the RoBERTa vocabulary, where ``\\_'' stands for space.\n",
"\n",
"\\subsection{Fine-tuning with demonstrations}\n",
"\\label{app:demonstrations}\n",
"When using demonstrations, we sample $16$ different sets of demonstrations for each input and average the predicted log probability for each class during inference.\n",
"We find that further increasing the number of samples does not bring substantial improvement.\n",
"Additional, we have tried different aggregation methods like taking the result with the maximum confidence and we did not find a meaningful improvement.\n",
"For selective demonstrations, we take \\ttt{roberta-large-nli-stsb- mean-tokens}\\footnote{\\url{https://github.com/UKPLab/sentence-transformers}}\n",
"from \\newcite{reimers2019sentence}\n",
"as our sentence embedding model.\n",
"\n",
"\n",
"\n",
"\\section{Comparisons of BERT vs RoBERTa}\n",
"\\label{app:analysis_bert}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
" \\begin{table}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.0\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" \\tf{BERT-large} & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Fine-tuning & 79.5 &\t51.4 & 80.3& \\tf{74.4} \\\\\n",
" \\midrule\n",
" Prompt-based FT & 85.6 & 59.2 & 79.0 & 66.8 \\\\\n",
" \\tableindent + demo (1-seg) & \\tf{87.5} & 50.4 & 77.2 & 68.5 \\\\\n",
" \\tableindent + demo (2-seg) & 86.1 & \\tf{61.3} & 77.9 & 73.2 \\\\\n",
" \\tableindent + demo ($n$-seg) & 86.4 & 58.6 & \\tf{79.6} & 71.0 \\\\\n",
" \\midrule\n",
" \\tf{RoBERTa-large} & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Fine-tuning & 81.4 & 48.4 & \\tf{88.8} & 76.6\\\\\n",
" \\midrule\n",
" Prompt-based FT & \\tf{92.7} & 77.2 & 84.8 & 74.5 \\\\\n",
" \\tableindent + demonstrations & 92.6 & \\tf{79.7} & 87.5 & \\tf{77.8} \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\caption{A comparison of BERT-large vs RoBERTa-large. We use manual prompts in these experiments.}\n",
" \\label{tab:bert}\n",
" \\end{table}\n",
" \n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"Table~\\ref{tab:bert} compares the results of BERT-large (uncased) and RoBERTa-large in our settings.\n",
"Pre-trained BERT provides two segment embeddings (A/B) for different parts of input. The common practice, when fine-tuning BERT, is that using only segment A for single-sentence tasks, and using segment A/B for the two sentences in sentence-pair tasks. \n",
"In our case of incorporating demonstrations, however, we have more than two sentences. Thus we explore the following different strategies for segments:\n",
"(1) using the A segment for all sentences (1-seg);\n",
"(2) using the A segment for the original input and the B segment for the demonstrations (2-seg); \n",
"\n",
"(3) using different segment embeddings for each sentence ($n$-seg), e.g., for SNLI, we use different segments for each premise and hypothesis in both the original input and the demonstrations, which leads to a total number of 8 segment embeddings. This introduces new segment embeddings (randomly initialized and learned during fine-tuning) as the pre-trained BERT only has two. \n",
"\n",
"Table~\\ref{tab:bert} shows that\n",
"prompt-based fine-tuning with demonstrations also works for BERT, and 2-seg works the best when incorporating demonstrations.\n",
"Still, we take RoBERTa-large as our main model, for RoBERTa performs much better than BERT and RoBERTa saves the trouble to tune the usage of segment embeddings.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Generated Prompts}\n",
"\\label{app:generated_prompts}\n",
"\n",
"We demonstrate the top 3 automatically generated templates and label words for all tasks in Table~\\ref{tab:full_generated_prompt}. In general, most automatic templates are reasonable and grammatically correct.\n",
"For the label words, the generated results look intuitive for most single sentence tasks. For other tasks, the automatic ones can be counterintuitive in some cases.\n",
"It is still unclear why the language model picks these words and sometimes they actually work well.\n",
"We leave this for future study.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table*}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.91\\columnwidth}{!}{\n",
" \\begin{tabular}{lll}\n",
" \\toprule\n",
" \\tf{Task} & \\tf{Auto template} & \\tf{Auto label words}\\\\\n",
" \\midrule\n",
" \n",
"\n",
" \n",
" \\tf{SST-2} & (positive/negative) \\\\\n",
" & {\\sent} A {\\mask} one . & irresistible/pathetic \\\\\n",
" & {\\sent} A {\\mask} piece . & wonderful/bad \\\\\n",
" & {\\sent} All in all {\\mask} . & delicious/bad \\\\\n",
" \\midrule\n",
" \\tf{SST-5} & (very positive/positive/neutral/negative/very negative) \\\\\n",
" & {\\sent} The movie is {\\mask} . & wonderful/remarkable/hilarious/better/awful \\\\\n",
" & {\\sent} The music is {\\mask} . & wonderful/perfect/hilarious/better/awful \\\\\n",
" & {\\sent} But it is {\\mask} . & unforgettable/extraordinary/good/better/terrible \\\\\n",
" \\midrule\n",
" \\tf{MR} & (positive/negative) \\\\\n",
" & It was {\\mask} ! {\\sent} & epic/terrible \\\\\n",
" & {\\sent} It's {\\mask} . & epic/awful \\\\\n",
" & {\\sent} A {\\mask} piece of work . & exquisite/horrible \\\\\n",
" \\midrule\n",
" \\tf{CR} & (positive/negative) \\\\\n",
" & {\\sent} It's {\\mask} ! & fantastic/horrible \\\\\n",
" & {\\sent} The quality is {\\mask} . & neat/pointless \\\\\n",
" & {\\sent} That is {\\mask} . & magnificent/unacceptable \\\\\n",
" \\midrule\n",
" \\tf{MPQA} & (positive/negative) \\\\\n",
" & {\\sent} is {\\mask} . & important/close \\\\\n",
" & {\\sent}, {\\mask} ! & needed/bad \\\\\n",
" & {\\sent}. {\\mask} . & unexpected/shocking \\\\\n",
" \\midrule\n",
" \\tf{Subj} & (subjective/objective) \\\\\n",
" & {\\sent} It's all {\\mask} . & everywhere/tragic \\\\\n",
" & {\\sent} It's {\\mask} . & everywhere/horrifying \\\\\n",
" & {\\sent} Is it {\\mask} ? & something/surreal \\\\\n",
" \\midrule\n",
" \\tf{TREC} & (abbreviation/entity/description/human/location/numeric) \\\\\n",
" & Q: {\\mask} : {\\sent} & Application/Advisor/Discussion/Culture/Assignment/Minute \\\\\n",
" & {\\sent} Why {\\mask}? & Production/AE/Context/Artist/Assignment/Minute \\\\\n",
" & {\\sent} Answer: {\\mask} . & Personality/Advisor/Conclusion/Hum/Assignment/Minute \\\\\n",
" \\midrule\n",
" \\tf{CoLA} & (grammatical/not\\_grammatical) \\\\\n",
" & {\\sent} You are {\\mask} . & one/proof \\\\\n",
" & It is {\\mask} . {\\sent} & wrong/sad \\\\\n",
" & I am {\\mask} . {\\sent} & misleading/disappointing \\\\\n",
" \\midrule\n",
" \n",
" \\tf{MNLI} & (entailment/neutral/contradiction) \\\\\n",
" & {\\firstsent} . {\\mask} , you are right , {\\secondsent} & Fine/Plus/Otherwise \\\\\n",
" & {\\firstsent} . {\\mask} you're right {\\secondsent} & There/Plus/Otherwise \\\\\n",
" & {\\firstsent} . {\\mask} ! {\\secondsent} & Meaning/Plus/Otherwise \\\\\n",
" \\midrule\n",
" \\tf{SNLI} & (entailment/neutral/contradiction) \\\\\n",
" & {\\firstsent} . {\\mask} , no , {\\secondsent} & Alright/Watch/Except \\\\\n",
" & {\\firstsent} . {\\mask} , in this case {\\secondsent} & Hi/Watch/Worse \\\\\n",
" & {\\firstsent} . {\\mask} this time {\\secondsent} & Regardless/Fortunately/Unless \\\\\n",
" \\midrule\n",
" \\tf{QNLI} & (entailment/not\\_entailment) \\\\\n",
" & {\\firstsent} ? {\\mask} . Yes , {\\secondsent} & Okay/Nonetheless \\\\\n",
" & {\\firstsent} ? {\\mask} . It is known that {\\secondsent} & Notably/Yet \\\\\n",
" & {\\firstsent} ? {\\mask} , however , {\\secondsent} & Specifically/Notably \\\\\n",
" \\midrule\n",
" \\tf{RTE} & (entailment/not\\_entailment) \\\\\n",
" & {\\firstsent} . {\\mask} , I believe {\\secondsent} & Clearly/Yet \\\\\n",
" & {\\firstsent} . {\\mask} , I think that {\\secondsent} & Accordingly/meanwhile \\\\\n",
" & {\\firstsent} . {\\mask} , I think {\\secondsent} & So/Meanwhile \\\\\n",
" \\midrule\n",
" \\tf{MRPC} & (equivalent/not\\_equivalent) \\\\\n",
" & {\\firstsent} . {\\mask} ! {\\secondsent} & Rather/Alas \\\\\n",
" & {\\firstsent} . {\\mask} . This is the first time {\\secondsent} & At/Thus \\\\\n",
" & {\\firstsent} . {\\mask} . That's right . {\\secondsent} & Instead/Moreover \\\\\n",
" \\midrule\n",
" \\tf{QQP} & (equivalent/not\\_equivalent)\\\\\n",
" & {\\firstsent} ? {\\mask} , but {\\secondsent} & Me/Since \\\\\n",
" & {\\firstsent} ? {\\mask} , please , {\\secondsent} & Um/Best \\\\\n",
" & {\\firstsent} ? {\\mask} , I want to know {\\secondsent} & Ironically/Beyond \\\\\n",
" \\midrule\n",
" \\tf{STS-B} & ($y_u$/$y_l$)\\\\\n",
" & {\\firstsent} . {\\mask} sir {\\secondsent} & Note/Next \\\\\n",
" & {\\firstsent} . {\\mask} , it is not . {\\secondsent} & Yesterday/meanwhile \\\\\n",
" & {\\firstsent} . {\\mask} . It is {\\secondsent} & Yeah/meanwhile \\\\\n",
" \\bottomrule\n",
" \n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\caption{Top 3 automatically generated templates and label words for all tasks based on one split of $K=16$ training examples. Note that automatic template results are based on manual label words and automatic label word results are based on manual templates provided in Table~\\ref{tab:manual_prompts}.}\n",
" \\label{tab:full_generated_prompt}\n",
" \\end{table*}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\clearpage\n",
"\\section{Impact of Development Sets}\n",
"\\label{app:dev_size}\n",
"\n",
"\n",
"Table~\\ref{tab:exp_large_dev} shows how the size of the development sets can affect the final performance of the model.\n",
"For ``No $\\ddev$'', we take the same hyper-parameters from~\\citet{schick2020exploiting,schick2020size}: batch size = 16, learning rate = 1e-5 and training steps = 250. We also experiment with a variant that we sample a development set of 10 times larger than the training set. We can see that using larger development sets leads to better performance, and this is why we stick to $|\\dtrain| = |\\ddev|$ in our few-shot setting.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table}[h]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.0\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" {Fine-tuning} & \\tf{SST-2} & \\tf{SNLI} &\\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" No $\\ddev$ & 79.5 & 49.2 & 83.9 & 77.8 \\\\\n",
" $|\\ddev| = |\\dtrain|$ & 81.4 & 48.4 & 88.8 & 76.6 \\\\\n",
" $|\\ddev| = 10|\\dtrain|$ & 83.5 & 52.0 & 89.4 & 79.6 \\\\\n",
" \\midrule\n",
" {Prompt-based FT} & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" No $\\ddev$ & 92.1 & 75.3 & 84.8 & 70.2 \\\\\n",
" $|\\ddev| = |\\dtrain|$ & 92.7 & 77.2 & 84.8 & 74.5 \\\\\n",
" $|\\ddev| = 10|\\dtrain|$ & 93.0 & 79.7 & 89.3 & 80.9 \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\vspace{-5pt}\n",
" \\caption{Impact of different sizes of development sets. Standard deviations are omitted here to save space. For No $|\\ddev|$, we use the same set of hyper-parameters as \\newcite{schick2020exploiting,schick2020size}.}\n",
" \\vspace{-15pt}\n",
" \\label{tab:exp_large_dev}\n",
"\\end{table}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Datasets}\n",
"\\label{app:datasets}\n",
"\n",
"\n",
"\n",
"For SNLI~\\cite{bowman2015large_snli} and datasets from GLUE~\\cite{wang2019glue}, including SST-2~\\cite{socher2013recursive_sst-2}, CoLA~\\cite{warstadt2019neural_cola}, MNLI~\\cite{williams2018broad_mnli}, QNLI~\\cite{rajpurkar2016squad}, RTE~\\cite{dagan2005pascal_rte1,bar2006second,giampiccolo2007third_rte3,bentivogli2009fifth_rte4}, MRPC~\\cite{dolan2005automatically_mrpc}, QQP\\footnote{\\url{https://www.quora.com/q/quoradata/}} and STS-B~\\cite{cer2017semeval_sts-b}, we follow~\\newcite{zhang2020revisiting} and use their original development sets for testing. For datasets which require a cross-validation evaluation---MR~\\cite{pang2005seeing_mr}, CR~\\cite{hu2004mining_cr}, MPQA~\\cite{wiebe2005annotating_mpqa}, Subj~\\cite{pang2004sentimental_subj}---we simply randomly sample 2,000 examples as the testing set and leave them out from training. For SST-5~\\cite{socher2013recursive_sst-2} and TREC~\\cite{voorhees2000building_trec}, we use their official test sets. We show dataset statistics in Table~\\ref{tab:datasets}.\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table*}[t]\n",
"\\begin{center}\n",
"\\centering\n",
"\\resizebox{1.98\\columnwidth}{!}{\n",
"\\begin{tabular}{llcrrrcl}\n",
"\\toprule\n",
"\\tf{Category} & \\tf{Dataset} & $|\\mathcal{Y}|$ & $L$ & \\#Train & \\#Test & \\tf{Type} & \\tf{Labels (classification tasks)} \\\\\n",
"\\bottomrule\n",
" & SST-2 & 2 & 19 & 6,920 & 872 & sentiment & positive, negative \\\\\n",
"& SST-5 & 5 & 18 & 8,544 & 2,210 & sentiment & v. pos., positive, neutral, negative, v. neg. \\\\\n",
"& MR & 2 & 20 & 8,662& 2,000 & sentiment & positive, negative \\\\\n",
"single- & CR & 2 & 19 & 1,775 & 2,000 & sentiment & positive, negative \\\\\n",
"sentence & MPQA & 2 & 3 & 8,606 & 2,000 & opinion polarity & positive, negative \\\\\n",
"& Subj & 2 & 23 & 8,000 & 2,000 & subjectivity & subjective, objective \\\\\n",
"& TREC & 6 & 10 & 5,452 & 500 & question cls. & abbr., entity, description, human, loc., num.\\\\\n",
"& CoLA & 2 & 8 & 8,551 & 1,042 & acceptability & grammatical, not\\_grammatical\\\\\n",
"\\midrule\n",
" & MNLI & 3 & 22/11 & 392,702 & 9,815 & NLI & entailment, neutral, contradiction\\\\\n",
"& SNLI & 3 & 14/8 & 549,367 & 9,842 & NLI & entailment, neutral, contradiction \\\\\n",
"sentence- & QNLI & 2 & 11/30 & 104,743 & 5,463 & NLI & entailment, not\\_entailment \\\\\n",
"pair & RTE & 2 & 49/10 & 2,490 & 277 & NLI & entailment, not\\_entailment \\\\\n",
" & MRPC & 2 & 22/21 & 3,668 & 408 & paraphrase & equivalent, not\\_equivalent \\\\\n",
"& QQP & 2 & 12/12 & 363,846 & 40,431 & paraphrase & equivalent, not\\_equivalent \\\\\n",
"& STS-B & $\\mathcal{R}$ & 11/11 & 5,749 & 1,500 & sent. similarity & - \\\\\n",
"\\bottomrule\n",
"\\end{tabular}\n",
"}\n",
"\\end{center}\n",
"\\caption{The datasets evaluated in this work. $|\\mathcal{Y}|$: \\# of classes for classification tasks (with one exception: STS-B is a real-valued regression task over the interval $[0, 5]$). $L$: average \\# of words in input sentence(s). Note that we only sample $\\dtrain$ and $\\ddev$ of $K \\times |\\labelset|$ examples from the original training set in our few-shot experiments (\\S\\ref{sec:setup}).}\n",
"\\label{tab:datasets}\n",
"\\end{table*}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Experimental Details}\n",
"\\label{app:exp_details}\n",
"\n",
"\n",
"\n",
"\n",
"\\subsection{Hyper-parameter selection}\n",
"\\label{app:hyper_selection}\n",
"For grid search, we take learning rates from \\{1e-5, 2e-5, 5e-5\\} and batch sizes from \\{2, 4, 8\\}.\n",
"These numbers are picked by pilot experiments on the SST-2 and SNLI datasets.\n",
"We also use early stopping to avoid overfitting.\n",
"For each trial, we train the model for 1,000 steps, validate the performance every 100 steps, and take the best checkpoint.\n",
"\n",
"\n",
"\n",
"\\subsection{Prompt-based fine-tuning}\n",
"\\label{app:prompts}\n",
"Table~\\ref{tab:manual_prompts} shows all the manual templates and label words we use in experiment.\n",
"For automatically template generation, we take the T5-3B\\footnote{We take the T5 1.0 checkpoint, which is trained on both unsupervised and downstream task data. We compared it to T5 1.1 (without downstream task data) and did not find a significant difference in generated templates.} model, which is the largest publicly available one that can fit on a single GPU.\n",
"For automatically searching label words, we set $k$ to 100 for all tasks except SST-5 and TREC. For SST-5 we set a smaller $k = 30$, as it is a 5-way classification task. For TREC, we observe that filtering $\\mathcal{V}^c$ using conditional likelihood alone is still noisy, thus we set $k = 1000$, and then re-rank $\\mathcal{V}^c$ by the nearest neighbors of the original manual label words and take the top 30 per class. We set $n$ to 100 in all experiments. \n",
"Due to the large number of trials in automatic search, we take a fixed set of hyper-parameters in this part: batch size of 8 and learning rate of 1e-5.\n",
"\n",
"Since the idea of prompt-based fine-tuning is to make the input and output distribution close to the pre-training, the implementation details are crucial.\n",
"For templates, we put extra space before sentences if it is not at the beginning of the input.\n",
"Also, we lowercase the first letter of the sentence if it is concatenated with a prefix (e.g., \\secondsent~in Table~\\ref{tab:manual_prompts}).\n",
"Also if one sentence is appended any punctuation (e.g., \\firstsent~in Table~\\ref{tab:manual_prompts}), then the last character of the original sentence is discarded.\n",
"Finally, we prepend a space for label words in $\\mapping(\\labelset)$. For example, we use ``\\_great'' instead of ``great'' in the RoBERTa vocabulary, where ``\\_'' stands for space.\n",
"\n",
"\\subsection{Fine-tuning with demonstrations}\n",
"\\label{app:demonstrations}\n",
"When using demonstrations, we sample $16$ different sets of demonstrations for each input and average the predicted log probability for each class during inference.\n",
"We find that further increasing the number of samples does not bring substantial improvement.\n",
"Additional, we have tried different aggregation methods like taking the result with the maximum confidence and we did not find a meaningful improvement.\n",
"For selective demonstrations, we take \\ttt{roberta-large-nli-stsb- mean-tokens}\\footnote{\\url{https://github.com/UKPLab/sentence-transformers}}\n",
"from \\newcite{reimers2019sentence}\n",
"as our sentence embedding model.\n",
"\n",
"\n",
"\n",
"\\section{Comparisons of BERT vs RoBERTa}\n",
"\\label{app:analysis_bert}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
" \\begin{table}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.0\\columnwidth}{!}{\n",
" \\begin{tabular}{lcccc}\n",
" \\toprule\n",
" \\tf{BERT-large} & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Fine-tuning & 79.5 &\t51.4 & 80.3& \\tf{74.4} \\\\\n",
" \\midrule\n",
" Prompt-based FT & 85.6 & 59.2 & 79.0 & 66.8 \\\\\n",
" \\tableindent + demo (1-seg) & \\tf{87.5} & 50.4 & 77.2 & 68.5 \\\\\n",
" \\tableindent + demo (2-seg) & 86.1 & \\tf{61.3} & 77.9 & 73.2 \\\\\n",
" \\tableindent + demo ($n$-seg) & 86.4 & 58.6 & \\tf{79.6} & 71.0 \\\\\n",
" \\midrule\n",
" \\tf{RoBERTa-large} & \\tf{SST-2} & \\tf{SNLI} & \\tf{TREC} & \\tf{MRPC} \\\\\n",
" \\midrule\n",
" Fine-tuning & 81.4 & 48.4 & \\tf{88.8} & 76.6\\\\\n",
" \\midrule\n",
" Prompt-based FT & \\tf{92.7} & 77.2 & 84.8 & 74.5 \\\\\n",
" \\tableindent + demonstrations & 92.6 & \\tf{79.7} & 87.5 & \\tf{77.8} \\\\\n",
" \\bottomrule\n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\caption{A comparison of BERT-large vs RoBERTa-large. We use manual prompts in these experiments.}\n",
" \\label{tab:bert}\n",
" \\end{table}\n",
" \n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"Table~\\ref{tab:bert} compares the results of BERT-large (uncased) and RoBERTa-large in our settings.\n",
"Pre-trained BERT provides two segment embeddings (A/B) for different parts of input. The common practice, when fine-tuning BERT, is that using only segment A for single-sentence tasks, and using segment A/B for the two sentences in sentence-pair tasks. \n",
"In our case of incorporating demonstrations, however, we have more than two sentences. Thus we explore the following different strategies for segments:\n",
"(1) using the A segment for all sentences (1-seg);\n",
"(2) using the A segment for the original input and the B segment for the demonstrations (2-seg); \n",
"\n",
"(3) using different segment embeddings for each sentence ($n$-seg), e.g., for SNLI, we use different segments for each premise and hypothesis in both the original input and the demonstrations, which leads to a total number of 8 segment embeddings. This introduces new segment embeddings (randomly initialized and learned during fine-tuning) as the pre-trained BERT only has two. \n",
"\n",
"Table~\\ref{tab:bert} shows that\n",
"prompt-based fine-tuning with demonstrations also works for BERT, and 2-seg works the best when incorporating demonstrations.\n",
"Still, we take RoBERTa-large as our main model, for RoBERTa performs much better than BERT and RoBERTa saves the trouble to tune the usage of segment embeddings.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\section{Generated Prompts}\n",
"\\label{app:generated_prompts}\n",
"\n",
"We demonstrate the top 3 automatically generated templates and label words for all tasks in Table~\\ref{tab:full_generated_prompt}. In general, most automatic templates are reasonable and grammatically correct.\n",
"For the label words, the generated results look intuitive for most single sentence tasks. For other tasks, the automatic ones can be counterintuitive in some cases.\n",
"It is still unclear why the language model picks these words and sometimes they actually work well.\n",
"We leave this for future study.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\begin{table*}[t]\n",
" \\begin{center}\n",
" \\centering\n",
" \\resizebox{1.91\\columnwidth}{!}{\n",
" \\begin{tabular}{lll}\n",
" \\toprule\n",
" \\tf{Task} & \\tf{Auto template} & \\tf{Auto label words}\\\\\n",
" \\midrule\n",
" \n",
"\n",
" \n",
" \\tf{SST-2} & (positive/negative) \\\\\n",
" & {\\sent} A {\\mask} one . & irresistible/pathetic \\\\\n",
" & {\\sent} A {\\mask} piece . & wonderful/bad \\\\\n",
" & {\\sent} All in all {\\mask} . & delicious/bad \\\\\n",
" \\midrule\n",
" \\tf{SST-5} & (very positive/positive/neutral/negative/very negative) \\\\\n",
" & {\\sent} The movie is {\\mask} . & wonderful/remarkable/hilarious/better/awful \\\\\n",
" & {\\sent} The music is {\\mask} . & wonderful/perfect/hilarious/better/awful \\\\\n",
" & {\\sent} But it is {\\mask} . & unforgettable/extraordinary/good/better/terrible \\\\\n",
" \\midrule\n",
" \\tf{MR} & (positive/negative) \\\\\n",
" & It was {\\mask} ! {\\sent} & epic/terrible \\\\\n",
" & {\\sent} It's {\\mask} . & epic/awful \\\\\n",
" & {\\sent} A {\\mask} piece of work . & exquisite/horrible \\\\\n",
" \\midrule\n",
" \\tf{CR} & (positive/negative) \\\\\n",
" & {\\sent} It's {\\mask} ! & fantastic/horrible \\\\\n",
" & {\\sent} The quality is {\\mask} . & neat/pointless \\\\\n",
" & {\\sent} That is {\\mask} . & magnificent/unacceptable \\\\\n",
" \\midrule\n",
" \\tf{MPQA} & (positive/negative) \\\\\n",
" & {\\sent} is {\\mask} . & important/close \\\\\n",
" & {\\sent}, {\\mask} ! & needed/bad \\\\\n",
" & {\\sent}. {\\mask} . & unexpected/shocking \\\\\n",
" \\midrule\n",
" \\tf{Subj} & (subjective/objective) \\\\\n",
" & {\\sent} It's all {\\mask} . & everywhere/tragic \\\\\n",
" & {\\sent} It's {\\mask} . & everywhere/horrifying \\\\\n",
" & {\\sent} Is it {\\mask} ? & something/surreal \\\\\n",
" \\midrule\n",
" \\tf{TREC} & (abbreviation/entity/description/human/location/numeric) \\\\\n",
" & Q: {\\mask} : {\\sent} & Application/Advisor/Discussion/Culture/Assignment/Minute \\\\\n",
" & {\\sent} Why {\\mask}? & Production/AE/Context/Artist/Assignment/Minute \\\\\n",
" & {\\sent} Answer: {\\mask} . & Personality/Advisor/Conclusion/Hum/Assignment/Minute \\\\\n",
" \\midrule\n",
" \\tf{CoLA} & (grammatical/not\\_grammatical) \\\\\n",
" & {\\sent} You are {\\mask} . & one/proof \\\\\n",
" & It is {\\mask} . {\\sent} & wrong/sad \\\\\n",
" & I am {\\mask} . {\\sent} & misleading/disappointing \\\\\n",
" \\midrule\n",
" \n",
" \\tf{MNLI} & (entailment/neutral/contradiction) \\\\\n",
" & {\\firstsent} . {\\mask} , you are right , {\\secondsent} & Fine/Plus/Otherwise \\\\\n",
" & {\\firstsent} . {\\mask} you're right {\\secondsent} & There/Plus/Otherwise \\\\\n",
" & {\\firstsent} . {\\mask} ! {\\secondsent} & Meaning/Plus/Otherwise \\\\\n",
" \\midrule\n",
" \\tf{SNLI} & (entailment/neutral/contradiction) \\\\\n",
" & {\\firstsent} . {\\mask} , no , {\\secondsent} & Alright/Watch/Except \\\\\n",
" & {\\firstsent} . {\\mask} , in this case {\\secondsent} & Hi/Watch/Worse \\\\\n",
" & {\\firstsent} . {\\mask} this time {\\secondsent} & Regardless/Fortunately/Unless \\\\\n",
" \\midrule\n",
" \\tf{QNLI} & (entailment/not\\_entailment) \\\\\n",
" & {\\firstsent} ? {\\mask} . Yes , {\\secondsent} & Okay/Nonetheless \\\\\n",
" & {\\firstsent} ? {\\mask} . It is known that {\\secondsent} & Notably/Yet \\\\\n",
" & {\\firstsent} ? {\\mask} , however , {\\secondsent} & Specifically/Notably \\\\\n",
" \\midrule\n",
" \\tf{RTE} & (entailment/not\\_entailment) \\\\\n",
" & {\\firstsent} . {\\mask} , I believe {\\secondsent} & Clearly/Yet \\\\\n",
" & {\\firstsent} . {\\mask} , I think that {\\secondsent} & Accordingly/meanwhile \\\\\n",
" & {\\firstsent} . {\\mask} , I think {\\secondsent} & So/Meanwhile \\\\\n",
" \\midrule\n",
" \\tf{MRPC} & (equivalent/not\\_equivalent) \\\\\n",
" & {\\firstsent} . {\\mask} ! {\\secondsent} & Rather/Alas \\\\\n",
" & {\\firstsent} . {\\mask} . This is the first time {\\secondsent} & At/Thus \\\\\n",
" & {\\firstsent} . {\\mask} . That's right . {\\secondsent} & Instead/Moreover \\\\\n",
" \\midrule\n",
" \\tf{QQP} & (equivalent/not\\_equivalent)\\\\\n",
" & {\\firstsent} ? {\\mask} , but {\\secondsent} & Me/Since \\\\\n",
" & {\\firstsent} ? {\\mask} , please , {\\secondsent} & Um/Best \\\\\n",
" & {\\firstsent} ? {\\mask} , I want to know {\\secondsent} & Ironically/Beyond \\\\\n",
" \\midrule\n",
" \\tf{STS-B} & ($y_u$/$y_l$)\\\\\n",
" & {\\firstsent} . {\\mask} sir {\\secondsent} & Note/Next \\\\\n",
" & {\\firstsent} . {\\mask} , it is not . {\\secondsent} & Yesterday/meanwhile \\\\\n",
" & {\\firstsent} . {\\mask} . It is {\\secondsent} & Yeah/meanwhile \\\\\n",
" \\bottomrule\n",
" \n",
" \\end{tabular}\n",
" }\n",
" \\end{center}\n",
" \\caption{Top 3 automatically generated templates and label words for all tasks based on one split of $K=16$ training examples. Note that automatic template results are based on manual label words and automatic label word results are based on manual templates provided in Table~\\ref{tab:manual_prompts}.}\n",
" \\label{tab:full_generated_prompt}\n",
" \\end{table*}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\\end{document}\n"
],
"del_percentage": 0.06272
}
} |