Datasets:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +182 -0
- md/test/0jHkUDyEO9/0jHkUDyEO9.md +282 -0
- md/test/2lDQLiH1W4/2lDQLiH1W4.md +373 -0
- md/test/2msbbX3ydD/2msbbX3ydD.md +583 -0
- md/test/3xHDeA8Noi/3xHDeA8Noi.md +0 -0
- md/test/4WnqRR915j/4WnqRR915j.md +539 -0
- md/test/8dkp41et6U/8dkp41et6U.md +378 -0
- md/test/AqN23oqraW/AqN23oqraW.md +0 -0
- md/test/BWSTBrmRqD/BWSTBrmRqD.md +338 -0
- md/test/CD9Snc73AW/CD9Snc73AW.md +0 -0
- md/test/DzxaRFVsgC/DzxaRFVsgC.md +435 -0
- md/test/FAO4VS9QRV/FAO4VS9QRV.md +352 -0
- md/test/QAwaaLJNCk/QAwaaLJNCk.md +0 -0
- md/test/Rc7dAwVL3v/Rc7dAwVL3v.md +507 -0
- md/test/TOE6N8dp4w/TOE6N8dp4w.md +0 -0
- md/test/TrloAXEJ2B/TrloAXEJ2B.md +301 -0
- md/test/TyFrPOKYXw/TyFrPOKYXw.md +0 -0
- md/test/VP20ZB6DHL/VP20ZB6DHL.md +352 -0
- md/test/WPZ2yPag4K/WPZ2yPag4K.md +241 -0
- md/test/aKkAwZB6JV/aKkAwZB6JV.md +279 -0
- md/test/b4tMhpN0JC/b4tMhpN0JC.md +340 -0
- md/test/bx24KpJ4Eb/bx24KpJ4Eb.md +0 -0
- md/test/c8McWs4Av0/c8McWs4Av0.md +803 -0
- md/test/hUgBU9wgSf/hUgBU9wgSf.md +628 -0
- md/test/kLZsLlIpDU/kLZsLlIpDU.md +0 -0
- md/test/mw1PWNSWZP/mw1PWNSWZP.md +328 -0
- md/test/rp5vfyp5Np/rp5vfyp5Np.md +543 -0
- md/test/ttMwEuEPeB/ttMwEuEPeB.md +440 -0
- md/test/tzW948kU6x/tzW948kU6x.md +0 -0
- md/test/v8L0pN6EOi/v8L0pN6EOi.md +381 -0
- md/test/zl16jLb91v/zl16jLb91v.md +0 -0
- parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_layout.pdf +3 -0
- parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_origin.pdf +3 -0
- parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_span.pdf +3 -0
- parse/dev/157Usp_kbi/157Usp_kbi_layout.pdf +3 -0
- parse/dev/157Usp_kbi/157Usp_kbi_origin.pdf +3 -0
- parse/dev/157Usp_kbi/157Usp_kbi_span.pdf +3 -0
- parse/dev/1wVvweK3oIb/1wVvweK3oIb_layout.pdf +3 -0
- parse/dev/1wVvweK3oIb/1wVvweK3oIb_origin.pdf +3 -0
- parse/dev/1wVvweK3oIb/1wVvweK3oIb_span.pdf +3 -0
- parse/dev/2EDqbSCnmF/2EDqbSCnmF_layout.pdf +3 -0
- parse/dev/2EDqbSCnmF/2EDqbSCnmF_origin.pdf +3 -0
- parse/dev/2EDqbSCnmF/2EDqbSCnmF_span.pdf +3 -0
- parse/dev/3itjR9QxFw/3itjR9QxFw_layout.pdf +3 -0
- parse/dev/3itjR9QxFw/3itjR9QxFw_origin.pdf +3 -0
- parse/dev/3itjR9QxFw/3itjR9QxFw_span.pdf +3 -0
- parse/dev/3tbTw2ga8K/3tbTw2ga8K_span.pdf +3 -0
- parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_layout.pdf +3 -0
- parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_origin.pdf +3 -0
- parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_span.pdf +3 -0
.gitattributes
CHANGED
|
@@ -437,3 +437,185 @@ parse/dev/OnD9zGAGT0k/OnD9zGAGT0k_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
|
| 437 |
parse/dev/OnD9zGAGT0k/OnD9zGAGT0k_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 438 |
parse/dev/3tbTw2ga8K/3tbTw2ga8K_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 439 |
parse/dev/VnAwNNJiwDb/VnAwNNJiwDb_span.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
parse/dev/OnD9zGAGT0k/OnD9zGAGT0k_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 438 |
parse/dev/3tbTw2ga8K/3tbTw2ga8K_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 439 |
parse/dev/VnAwNNJiwDb/VnAwNNJiwDb_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 440 |
+
parse/dev/3tbTw2ga8K/3tbTw2ga8K_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 441 |
+
parse/dev/e8PVEkSa4Fq/e8PVEkSa4Fq_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 442 |
+
parse/dev/VnAwNNJiwDb/VnAwNNJiwDb_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 443 |
+
parse/dev/qI4542Y2s1D/qI4542Y2s1D_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 444 |
+
parse/dev/XGzk5OKWFFc/XGzk5OKWFFc_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 445 |
+
parse/dev/slHNW9yRie0/slHNW9yRie0_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 446 |
+
parse/dev/XGzk5OKWFFc/XGzk5OKWFFc_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 447 |
+
parse/dev/XGzk5OKWFFc/XGzk5OKWFFc_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 448 |
+
parse/dev/e8PVEkSa4Fq/e8PVEkSa4Fq_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 449 |
+
parse/dev/slHNW9yRie0/slHNW9yRie0_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 450 |
+
parse/dev/qI4542Y2s1D/qI4542Y2s1D_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 451 |
+
parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 452 |
+
parse/dev/qI4542Y2s1D/qI4542Y2s1D_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 453 |
+
parse/dev/e8PVEkSa4Fq/e8PVEkSa4Fq_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 454 |
+
parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 455 |
+
parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 456 |
+
parse/dev/GLA4ablO3M/GLA4ablO3M_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 457 |
+
parse/dev/5zwnqUwphT/5zwnqUwphT_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 458 |
+
parse/dev/5zwnqUwphT/5zwnqUwphT_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 459 |
+
parse/dev/wqD6TfbYkrn/wqD6TfbYkrn_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 460 |
+
parse/dev/s1FjXzJ0jy/s1FjXzJ0jy_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 461 |
+
parse/dev/wqD6TfbYkrn/wqD6TfbYkrn_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 462 |
+
parse/dev/wqD6TfbYkrn/wqD6TfbYkrn_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 463 |
+
parse/dev/s1FjXzJ0jy/s1FjXzJ0jy_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 464 |
+
parse/dev/GLA4ablO3M/GLA4ablO3M_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 465 |
+
parse/dev/5zwnqUwphT/5zwnqUwphT_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 466 |
+
parse/dev/7YTh6S8HIY/7YTh6S8HIY_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 467 |
+
parse/dev/GLA4ablO3M/GLA4ablO3M_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 468 |
+
parse/dev/e1u9PVnwNr/e1u9PVnwNr_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 469 |
+
parse/dev/slHNW9yRie0/slHNW9yRie0_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 470 |
+
parse/dev/7YTh6S8HIY/7YTh6S8HIY_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 471 |
+
parse/dev/qHrADgAdYu/qHrADgAdYu_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 472 |
+
parse/dev/qHrADgAdYu/qHrADgAdYu_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 473 |
+
parse/dev/e1u9PVnwNr/e1u9PVnwNr_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 474 |
+
parse/dev/K10zWxlEGI/K10zWxlEGI_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 475 |
+
parse/dev/K10zWxlEGI/K10zWxlEGI_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 476 |
+
parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 477 |
+
parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 478 |
+
parse/dev/PzcvxEMzvQC/PzcvxEMzvQC_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 479 |
+
parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 480 |
+
parse/dev/MtGmCCPJD-/MtGmCCPJD-_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 481 |
+
parse/dev/PzcvxEMzvQC/PzcvxEMzvQC_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 482 |
+
parse/dev/PzcvxEMzvQC/PzcvxEMzvQC_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 483 |
+
parse/dev/MeeQkFYVbzW/MeeQkFYVbzW_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 484 |
+
parse/dev/MtGmCCPJD-/MtGmCCPJD-_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 485 |
+
parse/dev/h0OYV0We3oh/h0OYV0We3oh_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 486 |
+
parse/dev/Fn17vlng9pD/Fn17vlng9pD_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 487 |
+
parse/dev/MeeQkFYVbzW/MeeQkFYVbzW_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 488 |
+
parse/dev/MtGmCCPJD-/MtGmCCPJD-_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 489 |
+
parse/dev/MeeQkFYVbzW/MeeQkFYVbzW_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 490 |
+
parse/dev/QFQoxCFYEkA/QFQoxCFYEkA_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 491 |
+
parse/dev/Fn17vlng9pD/Fn17vlng9pD_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 492 |
+
parse/dev/QFQoxCFYEkA/QFQoxCFYEkA_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 493 |
+
parse/dev/ETKGuby0hcs/ETKGuby0hcs_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 494 |
+
parse/dev/h0OYV0We3oh/h0OYV0We3oh_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 495 |
+
parse/dev/QFQoxCFYEkA/QFQoxCFYEkA_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 496 |
+
parse/dev/2EDqbSCnmF/2EDqbSCnmF_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 497 |
+
parse/dev/Fn17vlng9pD/Fn17vlng9pD_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 498 |
+
parse/dev/2EDqbSCnmF/2EDqbSCnmF_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 499 |
+
parse/dev/h0OYV0We3oh/h0OYV0We3oh_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 500 |
+
parse/dev/ETKGuby0hcs/ETKGuby0hcs_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 501 |
+
parse/dev/vqGi8Kp0wM/vqGi8Kp0wM_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 502 |
+
parse/dev/ETKGuby0hcs/ETKGuby0hcs_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 503 |
+
parse/dev/ucNDIDRNjjv/ucNDIDRNjjv_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 504 |
+
parse/dev/vqGi8Kp0wM/vqGi8Kp0wM_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 505 |
+
parse/dev/ucNDIDRNjjv/ucNDIDRNjjv_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 506 |
+
parse/dev/O4kDO3yS9B/O4kDO3yS9B_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 507 |
+
parse/dev/O4kDO3yS9B/O4kDO3yS9B_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 508 |
+
parse/dev/aKXBrj0DHm/aKXBrj0DHm_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 509 |
+
parse/dev/2EDqbSCnmF/2EDqbSCnmF_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 510 |
+
parse/dev/aKXBrj0DHm/aKXBrj0DHm_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 511 |
+
parse/dev/aKXBrj0DHm/aKXBrj0DHm_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 512 |
+
parse/dev/7anW5TWbCJ/7anW5TWbCJ_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 513 |
+
parse/dev/I59qJ0sJ2nh/I59qJ0sJ2nh_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 514 |
+
parse/dev/vqGi8Kp0wM/vqGi8Kp0wM_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 515 |
+
parse/dev/7anW5TWbCJ/7anW5TWbCJ_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 516 |
+
parse/dev/7anW5TWbCJ/7anW5TWbCJ_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 517 |
+
parse/dev/ucNDIDRNjjv/ucNDIDRNjjv_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 518 |
+
parse/dev/BYLysbfdJOd/BYLysbfdJOd_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 519 |
+
parse/dev/uu6Oq7MN7g/uu6Oq7MN7g_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 520 |
+
parse/dev/UPnJuDKqOfX/UPnJuDKqOfX_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 521 |
+
parse/dev/BYLysbfdJOd/BYLysbfdJOd_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 522 |
+
parse/dev/O4kDO3yS9B/O4kDO3yS9B_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 523 |
+
parse/dev/uu6Oq7MN7g/uu6Oq7MN7g_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 524 |
+
parse/dev/1wVvweK3oIb/1wVvweK3oIb_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 525 |
+
parse/dev/I59qJ0sJ2nh/I59qJ0sJ2nh_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 526 |
+
parse/dev/uu6Oq7MN7g/uu6Oq7MN7g_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 527 |
+
parse/dev/UPnJuDKqOfX/UPnJuDKqOfX_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 528 |
+
parse/dev/BYLysbfdJOd/BYLysbfdJOd_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 529 |
+
parse/dev/UVtVRcurOYv/UVtVRcurOYv_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 530 |
+
parse/dev/I59qJ0sJ2nh/I59qJ0sJ2nh_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 531 |
+
parse/dev/UPnJuDKqOfX/UPnJuDKqOfX_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 532 |
+
parse/dev/QeRAyn4igEA/QeRAyn4igEA_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 533 |
+
parse/dev/1wVvweK3oIb/1wVvweK3oIb_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 534 |
+
parse/dev/UVtVRcurOYv/UVtVRcurOYv_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 535 |
+
parse/dev/1wVvweK3oIb/1wVvweK3oIb_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 536 |
+
parse/dev/UVtVRcurOYv/UVtVRcurOYv_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 537 |
+
parse/dev/QeRAyn4igEA/QeRAyn4igEA_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 538 |
+
parse/dev/znNmsN_O7Sh/znNmsN_O7Sh_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 539 |
+
parse/dev/QeRAyn4igEA/QeRAyn4igEA_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 540 |
+
parse/dev/znNmsN_O7Sh/znNmsN_O7Sh_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 541 |
+
parse/dev/u6Xv3FuF8N/u6Xv3FuF8N_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 542 |
+
parse/dev/WSIHedvwmru/WSIHedvwmru_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 543 |
+
parse/dev/znNmsN_O7Sh/znNmsN_O7Sh_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 544 |
+
parse/dev/u6Xv3FuF8N/u6Xv3FuF8N_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 545 |
+
parse/dev/WSIHedvwmru/WSIHedvwmru_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 546 |
+
parse/dev/u6Xv3FuF8N/u6Xv3FuF8N_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 547 |
+
parse/dev/WSIHedvwmru/WSIHedvwmru_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 548 |
+
parse/dev/B9LUI0pZFGc/B9LUI0pZFGc_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 549 |
+
parse/dev/K2OixmPDou3/K2OixmPDou3_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 550 |
+
parse/dev/K2OixmPDou3/K2OixmPDou3_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 551 |
+
parse/dev/gSyjaunurQ/gSyjaunurQ_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 552 |
+
parse/dev/B9LUI0pZFGc/B9LUI0pZFGc_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 553 |
+
parse/dev/gSyjaunurQ/gSyjaunurQ_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 554 |
+
parse/dev/gSyjaunurQ/gSyjaunurQ_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 555 |
+
parse/dev/SfXjt1FtMQ/SfXjt1FtMQ_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 556 |
+
parse/dev/716PvHoDct/716PvHoDct_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 557 |
+
parse/dev/T__V3uLix7V/T__V3uLix7V_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 558 |
+
parse/dev/FELWgMjxZJj/FELWgMjxZJj_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 559 |
+
parse/dev/7UmjRGzp-A/7UmjRGzp-A_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 560 |
+
parse/dev/sP1fo2K9DFG/sP1fo2K9DFG_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 561 |
+
parse/dev/FELWgMjxZJj/FELWgMjxZJj_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 562 |
+
parse/dev/FELWgMjxZJj/FELWgMjxZJj_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 563 |
+
parse/dev/sP1fo2K9DFG/sP1fo2K9DFG_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 564 |
+
parse/dev/T__V3uLix7V/T__V3uLix7V_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 565 |
+
parse/dev/um2BxfgkT2_/um2BxfgkT2__span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 566 |
+
parse/dev/um2BxfgkT2_/um2BxfgkT2__origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 567 |
+
parse/dev/T__V3uLix7V/T__V3uLix7V_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 568 |
+
parse/dev/VppWsjXgBY6/VppWsjXgBY6_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 569 |
+
parse/dev/vruwp11pWnO/vruwp11pWnO_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 570 |
+
parse/dev/VppWsjXgBY6/VppWsjXgBY6_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 571 |
+
parse/dev/um2BxfgkT2_/um2BxfgkT2__layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 572 |
+
parse/dev/3itjR9QxFw/3itjR9QxFw_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 573 |
+
parse/dev/pd1P2eUBVfq/pd1P2eUBVfq_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 574 |
+
parse/dev/VppWsjXgBY6/VppWsjXgBY6_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 575 |
+
parse/dev/3itjR9QxFw/3itjR9QxFw_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 576 |
+
parse/dev/eYfIM88MTUE/eYfIM88MTUE_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 577 |
+
parse/dev/pd1P2eUBVfq/pd1P2eUBVfq_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 578 |
+
parse/dev/vruwp11pWnO/vruwp11pWnO_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 579 |
+
parse/dev/qf12cWVSksq/qf12cWVSksq_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 580 |
+
parse/dev/arg1dQSS6Mh/arg1dQSS6Mh_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 581 |
+
parse/dev/vruwp11pWnO/vruwp11pWnO_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 582 |
+
parse/dev/pd1P2eUBVfq/pd1P2eUBVfq_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 583 |
+
parse/dev/eYfIM88MTUE/eYfIM88MTUE_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 584 |
+
parse/dev/3itjR9QxFw/3itjR9QxFw_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 585 |
+
parse/dev/qf12cWVSksq/qf12cWVSksq_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 586 |
+
parse/dev/ggTNeg2fem/ggTNeg2fem_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 587 |
+
parse/dev/arg1dQSS6Mh/arg1dQSS6Mh_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 588 |
+
parse/dev/eYfIM88MTUE/eYfIM88MTUE_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 589 |
+
parse/dev/ggTNeg2fem/ggTNeg2fem_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 590 |
+
parse/dev/ggTNeg2fem/ggTNeg2fem_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 591 |
+
parse/dev/157Usp_kbi/157Usp_kbi_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 592 |
+
parse/dev/arg1dQSS6Mh/arg1dQSS6Mh_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 593 |
+
parse/dev/157Usp_kbi/157Usp_kbi_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 594 |
+
parse/dev/9U4gLR_lRP/9U4gLR_lRP_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 595 |
+
parse/dev/157Usp_kbi/157Usp_kbi_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 596 |
+
parse/dev/qf12cWVSksq/qf12cWVSksq_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 597 |
+
parse/dev/jowVZoitZYu/jowVZoitZYu_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 598 |
+
parse/dev/UYneFzXSJWh/UYneFzXSJWh_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 599 |
+
parse/dev/SfXjt1FtMQ/SfXjt1FtMQ_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 600 |
+
parse/dev/M2sNIiCC6C/M2sNIiCC6C_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 601 |
+
parse/dev/qHGCH75usg/qHGCH75usg_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 602 |
+
parse/dev/M2sNIiCC6C/M2sNIiCC6C_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 603 |
+
parse/dev/K2OixmPDou3/K2OixmPDou3_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 604 |
+
parse/dev/qHGCH75usg/qHGCH75usg_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 605 |
+
parse/dev/cZAi1yWpiXQ/cZAi1yWpiXQ_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 606 |
+
parse/dev/SfXjt1FtMQ/SfXjt1FtMQ_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 607 |
+
parse/dev/B9LUI0pZFGc/B9LUI0pZFGc_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 608 |
+
parse/dev/M2sNIiCC6C/M2sNIiCC6C_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 609 |
+
parse/dev/cZAi1yWpiXQ/cZAi1yWpiXQ_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 610 |
+
parse/dev/cZAi1yWpiXQ/cZAi1yWpiXQ_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 611 |
+
parse/dev/qHGCH75usg/qHGCH75usg_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 612 |
+
parse/dev/RriDjddCLN/RriDjddCLN_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 613 |
+
parse/dev/N8MaByOzUfb/N8MaByOzUfb_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 614 |
+
parse/dev/GoOuIrDHG_Y/GoOuIrDHG_Y_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 615 |
+
parse/dev/Vu-B0clPfq/Vu-B0clPfq_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 616 |
+
parse/dev/zDbsSscmuj/zDbsSscmuj_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 617 |
+
parse/dev/zDbsSscmuj/zDbsSscmuj_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 618 |
+
parse/dev/RriDjddCLN/RriDjddCLN_span.pdf filter=lfs diff=lfs merge=lfs -text
|
| 619 |
+
parse/dev/zDbsSscmuj/zDbsSscmuj_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 620 |
+
parse/dev/RriDjddCLN/RriDjddCLN_layout.pdf filter=lfs diff=lfs merge=lfs -text
|
| 621 |
+
parse/dev/N8MaByOzUfb/N8MaByOzUfb_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
md/test/0jHkUDyEO9/0jHkUDyEO9.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MAGIC123: ONE IMAGE TO HIGH-QUALITY 3D OBJECT GENERATION USING BOTH 2D AND 3D DIFFUSION PRIORS
|
| 2 |
+
|
| 3 |
+
Guocheng $\mathbf { Q i a n ^ { 1 , 2 } }$ , Jinjie $\mathbf { M a i } ^ { 1 }$ , Abdullah Hamdi3, Jian $\mathbf { R e n } ^ { 2 }$ , Aliaksandr Siarohin2, Bing $\mathbf { L i } ^ { 1 }$ , Hsin-Ying Lee2, Ivan Skorokhodov1, Peter Wonka1, Sergey Tulyakov2, Bernard Ghanem1 1King Abdullah University of Science and Technology (KAUST), 2Snap Inc.
|
| 4 |
+
3Visual Geometry Group, University of Oxford
|
| 5 |
+
{guocheng.qian, bernard.ghanem}@kaust.edu.sa
|
| 6 |
+
|
| 7 |
+

|
| 8 |
+
Figure 1: Magic123 can reconstruct high-fidelity 3D content with detailed geometry and high-resolution renderings $( 1 0 2 4 \times 1 0 2 4 )$ from a single image in the wild. Visit https:// guochengqian.github.io/project/magic123/ for immersive visualizations and code.
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
We present “Magic1 $2 3 ^ { \mathfrak { r } }$ , a two-stage coarse-to-fine approach for high-quality, textured 3D mesh generation from a single image in the wild using both 2D and 3D priors. In the first stage, we optimize a neural radiance field to produce a coarse geometry. In the second stage, we adopt a memory-efficient differentiable mesh representation to yield a high-resolution mesh with a visually appealing texture. In both stages, the 3D content is learned through reference-view supervision and novel-view guidance by a joint 2D and 3D diffusion prior. We introduce a trade-off parameter between the 2D and 3D priors to control the details and 3D consistencies of the generation. Magic123 demonstrates a significant improvement over previous image-to-3D techniques, as validated through extensive experiments on diverse synthetic and real-world images.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
3D reconstruction from a single image (image-to-3D) is challenging because it is an undetermined problem. A typical image-to-3D system optimizes a 3D representation such as neural radiance field (NeRF) (Mildenhall et al., 2020), where the reference view and random novel views are differentially rendered during training. While the reference view can be optimized to match the input, there is no available supervision for the novel views. Due to this ill-posed nature, the primary focus of image-to-3D is how to leverage priors to guide the novel view reconstruction.
|
| 17 |
+
|
| 18 |
+

|
| 19 |
+
Figure 2: The effects of the joint 2D and 3D priors. We compare image-to-3D in three cases: a teddy bear (common object), two stacked donuts (less common object), and a dragon statue (uncommon object). Magic123 with a sole 3D prior (on the left) yields consistent yet potentially simplified 3D with reduced shape and texture details due to its low generalizability. Magic123 with a sole 2D prior (on the right) shows a strong generalizability in producing content with high details while potentially lacking 3D consistency. Magic123 proposes to use a joint 2D and 3D prior that consistently offers identity-preserving 3D with fine-grained geometry and visually appealing texture.
|
| 20 |
+
|
| 21 |
+
Current mainstream image-to-3D systems such as NeuralLift (Xu et al., 2023) and RealFusion (Melas-Kyriazi et al., 2023) employ 2D priors, e.g. text-to-image diffusion models (Rombach et al., 2022; Saharia et al., 2022), for 3D reconstruction. The novel views are guided by the 2D priors using text prompts associated with the input image by captioning (Li et al., 2022; 2023) or textual inversion (Gal et al., 2023). Without any 3D data, 2D prior-based solutions can distill 2D knowledge for 3D generation in a zero-shot fashion through score distillation sampling (SDS) (Poole et al., 2022). Thanks to the billion-scale training dataset (Schuhmann et al., 2021), 2D priors have been showing strong generalizability in 3D generation (Poole et al., 2022; Lin et al., 2023): successfully yielding detailed 3D content respecting various prompts. However, methods relying on 2D priors alone inevitably compromise on 3D consistency due to their restricted 3D knowledge. This leads to low-fidelity 3D generation, such as yielding multiple faces (Janus problems), mismatched sizes, and inconsistent texture. Fig.2 (right column) shows failure cases of using only 2D priors: the multiple faces of the teddy bear (top row) and the two donuts merged into one at the back (middle row).
|
| 22 |
+
|
| 23 |
+
Another approach to image-to-3D is to employ 3D-aware priors1. Earlier attempts at 3D reconstruction leveraged geometric priors like topology constraints (Wang et al., 2018) and coarse 3D shapes (Michel et al., 2022) to assist in 3D generation. However, these manually crafted 3D priors fall short of generating high-quality 3D content for various prompts. Recently, approaches like 3Dim (Watson et al., 2023) and Zero-1-to-3 (Liu et al., 2023) trained/finetuned view-dependent diffusion models and utilized them as 3D priors for image-to-3D generation. Since trained in 3D data, these 3D priors are more effective in generating content with high 3D consistency. Unfortunately, (1) the scale of 3D datasets is small: the largest public dataset Objaverse-XL (Deitke et al., 2023a) only contains around 10M instances; (2) 3D datasets contain mostly limited-quality instances with simple shapes. Consequently, 3D priors are limited in generalizability and tend to generate simple geometry and texture. As illustrated in Fig.2, while a 3D prior-based solution effectively processes common objects (for instance, the teddy bear example in the top row), it struggles with less common ones, yielding oversimplified, sometimes even flat 3D geometry (e.g., dragon statue at bottom left).
|
| 24 |
+
|
| 25 |
+
In this paper, rather than solely relying on a 2D or a 3D prior, we advocate for the simultaneous use of both priors to guide novel views. By modulating the simple yet effective tradeoff parameter between the 2D and 3D priors, we can manage a balance between generalizability and 3D consistency in the generated 3D content. In many cases where both 2D prior and 3D prior fail due to low 3D consistency and low generalizability, the proposed joint 2D and 3D prior propose can produce 3D content with high fidelity. Refer to Fig.2 for comparisons. Contributions of this work is summarized as follows:
|
| 26 |
+
|
| 27 |
+
• We introduce Magic123, a novel coarse-to-fine pipeline for image-to-3D generation that uses a joint 2D and 3D prior to guide the novel views. • Using the exact same set of parameters for all examples without any additional reconfiguration, Magic123 achieves state-of-the-art image-to-3D results in both real-world and synthetic scenarios.
|
| 28 |
+
|
| 29 |
+
# 2 RELATED WORK
|
| 30 |
+
|
| 31 |
+
Multi-view 3D reconstruction. The development of Neural Radiance Fields (NeRF) (Mildenhall et al., 2020; Lombardi et al., 2019) has prompted a shift towards reconstructing 3D as volume radiance (Tagliasacchi & Mildenhall, 2022), enabling the synthesis of photo-realistic novel views (Barron et al., 2022). NeRF requires as many as 100 images to reconstruct a scene. Subsequent works have explored the optimization of NeRF in few-shot (e.g. (Jain et al., 2021; Kim et al., 2022; Du et al., 2023)) and one-shot (e.g. (Yu et al., 2021; Chan et al., 2022)) settings. However, these methods fail to generate $3 6 0 ^ { \circ }$ 3D content due to the lack of strong priors for the missing novel-view information.
|
| 32 |
+
|
| 33 |
+
In-domain single-view 3D reconstruction. 3D reconstruction from a single view requires strong priors on the object geometry. Direct supervision in the form of 3D shape priors is a robust way to impose such constraints for a particular domain, like human heads (Blanz & Vetter, 2003; Booth et al., 2016), hands (Pavlakos et al., 2019) or full bodies (Loper et al., 2015; Martinez et al., 2017). Such supervision requires expensive 3D annotations and manual 3D prior creation. Thus several works explore unsupervised learning of 3D geometry from object-centric datasets (e.g. (Kanazawa et al., 2018; Duggal & Pathak, 2022; Kemelmacher-Shlizerman, 2013; Siarohin et al., 2023)). These methods are typically structured as auto-encoders (Wu et al., 2020; Kar et al., 2015; Cheng et al., 2023) or generators (Cai et al., 2022; Sun et al., 2022) with explicit 3D decomposition under the hood. Due to the lack of large-scale 3D data, in-domain 3D reconstruction is limited to simple shapes (e.g. chairs and cars) and cannot generalize to more complex or uncommon objects (e.g. dragons and statues).
|
| 34 |
+
|
| 35 |
+
Zero-shot single-view 3D reconstruction. Foundational multi-modal networks (Radford et al., 2021; Rombach et al., 2022) have enabled various zero-shot 3D synthesis tasks. Earlier works employed CLIP (Radford et al., 2021) guidance for 3D generation (Jain et al., 2022; Hong et al., 2022; Mohammad Khalid et al., 2022; Xu et al., 2022) and manipulation (Michel et al., 2022; Patashnik et al., 2021) from text prompts. Modern zero-shot text-to-image generators (Ramesh et al., 2021; Rombach et al., 2022; Saharia et al., 2022; Zhang et al., 2023) improve these results by providing stronger synthesis priors (Poole et al., 2022; Wang et al., 2023a; Metzer et al., 2022; Mikaeili et al., 2023). DreamFusion (Poole et al., 2022) is a seminal work that proposed to distill an off-the-shelf diffusion model into a NeRF for a given text query. It sparked numerous follow-up approaches to improve the quality (Lin et al., 2023; Chen et al., 2023b; Wang et al., 2023b; Chen et al., 2023a). image-to-3D reconstruction (Melas-Kyriazi et al., 2023; Tang et al., 2023b; Höllein et al., 2023; Richardson et al., 2023). Inspired by the success of text-to-3D, 2D diffusion priors were also applied to image-to-3D with additional reference view reconstruction loss (Melas-Kyriazi et al., 2023; Xu et al., 2023; Seo et al., 2023; Lin et al., 2023; Raj et al., 2023). Recently, (Watson et al., 2023; Liu et al., 2023) trained pose-dependent diffusion models that are 3D-aware and used them to improve the 3D consistency. However, they suffered from low generalizability and tended to generate oversimplified geometry due to the limited quality and the small scale of 3D datasets. Our work instead explores a joint 2D and 3D prior to balance the generalizability and 3D consistency.
|
| 36 |
+
|
| 37 |
+
# 3 METHODOLOGY
|
| 38 |
+
|
| 39 |
+
We propose Magic123, a coarse-to-fine pipeline for high-quality 3D object generation from a single reference image. Magic123 is supervised by the reference view reconstruction and guided by a joint 2D and 3D prior, as shown in Fig. 3.
|
| 40 |
+
|
| 41 |
+

|
| 42 |
+
Figure 3: Magic123 pipeline. Magic123 is a two-stage coarse-to-fine framework for high-quality 3D generation from a single reference image. Magic123 is supervised by the reference image reconstruction and guided by a joint 2D and 3D diffusion prior. At the coarse stage, we optimize an Instant-NGP NeRF for a coarse geometry. At the fine stage, we initialize a DMTet differentiable mesh from the NeRF output and optimize it with high-resolution rendering $( 1 0 2 4 \times 1 0 2 4 )$ ). Textural inversion is used in both stages to generate object-preserving geometry and view-consistent textures.
|
| 43 |
+
|
| 44 |
+
# 3.1 MAGIC123 PIPELINE
|
| 45 |
+
|
| 46 |
+
Image preprocessing. Magic123 is aimed at object-level image-to-3D generation. We leverage an off-the-shelf segmentation model, Dense Prediction Transformer (Ranftl et al., 2021), to segment the object. We denote the extracted binary segmentation mask M. To prevent flat geometry, we further extract the depth map by a pretrained depth estimator (Ranftl et al., 2020). The foreground image is used as the input, while the mask and the depth map are used in the optimization as regularization priors.
|
| 47 |
+
|
| 48 |
+
Coarse-to-fine pipeline. Inspired by the text-to-3D work Magic3D (Lin et al., 2023), Magic123 adopts a coarse-to-fine pipeline for image-to-3D optimization. The coarse stage of Magic123 is targeted at learning underlying geometry that respects the reference image. Due to its strong ability to handle complex topological changes in a smooth and continuous fashion, we adopt Instant-NGP (Müller et al., 2022). It only offers low-resolution renderings $( 1 2 8 \times 1 2 8 )$ during training because of memory-expensive volumetric rendering and possibly yields 3D shapes with noise due to its tendency to create high-frequency artifacts. Therefore, we introduce the fine stage that uses DMTet (Shen et al., 2021) to refine the coarse 3D model by the NeRF and to produce a high-resolution and disentangled geometry and texture. We use $1 0 2 4 \times 1 0 2 4$ rendering resolution in the fine stage, which is found to have a similar memory consumption to the coarse stage. To reconstruct 3D faithfully from a single image, we optimize the pipeline through (i) novel view guidance; (ii) reference view reconstruction supervision; (iii) two standard regularizations: depth regularization and normal smoothness.
|
| 49 |
+
|
| 50 |
+
Novel view guidance $\mathcal { L } _ { g }$ is necessary to dream up the missing information. As a significant difference from previous works, we do not rely solely on a 2D prior or a 3D prior, but we leverage a joint 2D and 3D prior to optimize the novel views. See $\ S 3 . 2$ for details.
|
| 51 |
+
|
| 52 |
+
Reference view reconstruction loss $\mathcal { L } _ { r e c }$ is to ensure the reference image ${ \bf \cal I } ^ { r }$ can be reconstructed from the reference viewpoint $( \mathbf { v } ^ { r } )$ . Mean squared error is adopted on both $\mathbf { I } ^ { r }$ and its mask as follows:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\mathcal { L } _ { r e c } = \lambda _ { r g b } \| { \bf M } \odot ( { \bf I ^ { \prime } } - G _ { \theta } ( { \bf v ^ { r } } ) ) \| _ { 2 } ^ { 2 } + \lambda _ { m a s k } \| { \bf M } - M ( G _ { \theta } ( { \bf v ^ { r } } ) ) ) \| _ { 2 } ^ { 2 } ,
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $\theta$ are the NeRF parameters to be optimized, $\odot$ is the Hadamard product, $G _ { \theta } ( \mathbf { v } ^ { r } )$ is a NeRF rendered RGB image from the reference viewpoint, $M ( )$ is the foreground mask acquired by integrating the volume density along the ray of each pixel. Since the foreground object is extracted as input, we do not model any background and simply use pure white for the background rendering for all experiments. $\lambda _ { r g b }$ and $\lambda _ { m a s k }$ are the weights for the foreground RGB and the mask, respectively.
|
| 59 |
+
|
| 60 |
+
Depth regularization $\mathcal { L } _ { d }$ is a standard tool to avoid overly-flat or caved-in 3D content ( $\mathrm { X u }$ et al., 2023; Tang et al., 2023b). We would like the depth $d$ from the reference viewpoint to be similar to the depth $d ^ { r }$ estimated by a pretrained depth estimator (Ranftl et al., 2020). Due to the mismatched values of $d$ and $d ^ { r }$ , we regularize them linearly through normalized negative Pearson correlation:
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 4: 2D v.s. 3D Diffusion priors. Magic123 uses Stable Diffusion (Rombach et al., 2022) as the 2D prior and viewpoint-conditioned diffusion model Zero-1-to-3 (Liu et al., 2023) as the 3D prior.
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\mathcal { L } _ { d } = \frac { 1 } { 2 } \left[ 1 - \frac { \mathrm { c o v } ( \mathbf { M } \odot d ^ { r } , \mathbf { M } \odot d ) } { \sigma ( \mathbf { M } \odot d ^ { r } ) \sigma ( \mathbf { M } \odot d ) } \right] ,
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where $\operatorname { c o v } ( \cdot )$ denotes covariance and $\sigma ( \cdot )$ measures standard deviation.
|
| 70 |
+
|
| 71 |
+
Normal smoothness ${ \mathcal { L } } _ { n }$ is a common idea to reduce high-frequency artifacts. Finite differences of depth are used to estimate the normal map. Gaussian smoothness with a $9 \times 9$ kernel is applied:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\mathcal { L } _ { n } = \| { \mathbf { n } - \tau } ( { g } ( { \mathbf { n } } ) ) \| ,
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $\tau ( \cdot )$ denotes the stopgradient operation and $g ( \cdot )$ is a Gaussian blur.
|
| 78 |
+
|
| 79 |
+
Overall, both the coarse and fine stages are optimized by a combination of losses:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\begin{array} { r } { \mathcal { L } _ { c } = \mathcal { L } _ { g } + \mathcal { L } _ { r e c } + \lambda _ { d } \mathcal { L } _ { d } + \lambda _ { n } \mathcal { L } _ { n } , } \end{array}
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
We note here that we empirically find the depth and normal regularization only have marginal affects to the final performance. We keep here as a standard practice.
|
| 86 |
+
|
| 87 |
+
# 3.2 NOVEL VIEW GUIDANCE: A JOINT 2D AND 3D PRIOR
|
| 88 |
+
|
| 89 |
+
2D priors. Using a single reference image is insufficient to optimize 3D. DreamFusion (Poole et al., 2022) proposes to use a 2D text-to-image diffusion model as the prior to guide the novel views via the proposed score distillation sampling (SDS) loss. SDS encodes the rendered view as latent, adds noise to it, and guesses the clean novel view conditioned on the input text prompt. Roughly speaking, SDS translates the rendered view into an image that respects both the content from the rendered view and the text. The SDS loss is illustrated in the upper part of Fig. 4 and is formulated as:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\nabla \mathcal { L } _ { 2 D } \triangleq \mathbb { E } _ { t , \epsilon } \left[ w ( t ) ( \epsilon _ { \phi } ( \mathbf { z } _ { t } ; \mathbf { e } , t ) - \epsilon ) \frac { \partial \mathbf { z } } { \partial \mathbf { I } } \frac { \partial \mathbf { I } } { \partial \theta } \right] ,
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where I is a rendered view, and $\mathbf { z } _ { t }$ is the noisy latent by adding a random Gaussian noise of a time step $t$ to the latent of $\mathbf { I } . \epsilon , \epsilon _ { \phi } , \phi , \theta$ are the added noise, predicted noise, parameters of the diffusion prior, and the parameters of the 3D model. $\theta$ can be MLPs of NeRF for the coarse stage, or SDF, triangular deformations, and color field for the fine stage. DreamFusion points out that the Jacobian term of the image encoder $\textstyle { \frac { \partial \mathbf { z } } { \partial \mathbf { I } } }$ in Eq. equation 5 can be further eliminated, making the SDS loss much more efficient in terms of both speed and memory.
|
| 96 |
+
|
| 97 |
+
Textural inversion. Note the prompt $\mathbf { e }$ we use for each reference image is not a pure text chosen from tedious prompt engineering. Using pure text for image-to-3D generation sometimes results in inconsistent texture due to the limited expressiveness of the human language. For example, using “A high-resolution DSLR image of a colorful teapot” will generate different colors that do not respect the reference image. We thus follow RealFusion (Melas-Kyriazi et al., 2023) to leverage the same textual inversion (Gal et al., 2023) technique to acquire a special token $< e >$ to represent the object in the reference image. We use the same prompt for all examples: “A high-resolution DSLR image of $< e > "$ . We find that Stable Diffusion can generate an object with a more similar texture and style to the reference image with the textural inversion technique compared to the results without it.
|
| 98 |
+
|
| 99 |
+
3D prior. Using only the 2D prior is not sufficient to capture consistent 3D geometry due to its lack of 3D knowledge. Zero-1-to-3 (Liu et al., 2023) thus proposes a 3D(-aware) prior solution.
|
| 100 |
+
|
| 101 |
+
Zero-1-to-3 finetunes Stable Diffusion into a view-dependent version on Objaverse (Deitke et al., 2023b). Zero-1-to-3 takes a reference image and a viewpoint as input and can generate a novel view from the given viewpoint. Zero-1-to-3 thereby can be used as a strong 3D prior for 3D reconstruction. The usage of Zero-1-to-3 in an image-to-3D generation pipeline using SDS is formulated as:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\nabla \mathcal { L } _ { 3 D } \triangleq \mathbb { E } _ { t , \epsilon } \left[ w ( t ) ( \epsilon _ { \phi } ( \mathbf { z } _ { t } ; \mathbf { I } ^ { r } , t , R , T ) - \epsilon ) \frac { \partial \mathbf { I } } { \partial \theta } \right] ,
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
where $R , T$ are the camera poses passed to Zero-1-to-3. The difference between using the 3D prior and the 2D prior is illustrated in Fig. 4, where we show that the 2D prior uses text embedding as a condition while the 3D prior uses the reference view $\mathbf { I } ^ { r }$ with the novel view camera poses as conditions. The 3D prior utilizes camera poses to encourage 3D consistency and enable the usage of more 3D information compared to the 2D prior counterpart.
|
| 108 |
+
|
| 109 |
+
A joint 2D and 3D prior. We find that the 2D and 3D priors are complementary to each other. The 2D prior favors high imagination thanks to its strong generalizability stemming from the large-scale training dataset of diffusion models, but might lead to inconsistent geometry due to the lack of 3D knowledge. On the other hand, the 3D prior tends to generate consistent geometry but with simple shapes and less generalizability due to the small scale and the simple geometry of the 3D dataset. In the case of uncommon objects, the 3D prior might result in over-simplified geometry and texture. Instead of relying solely on a 2D or a 3D prior, we propose to use a joint 2D and 3D prior:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\begin{array} { r } { \nabla \mathcal { L } _ { g } \triangleq \mathbb { E } _ { t _ { 1 } , t _ { 2 } , \epsilon _ { 1 } , \epsilon _ { 2 } } \left[ w ( t ) \left[ \lambda _ { 2 D } ( \epsilon _ { \phi _ { 2 D } } ( \mathbf { z } _ { t _ { 1 } } ; \mathbf { e } , t _ { 1 } ) - \epsilon _ { 1 } ) + \lambda _ { 3 D } ( \epsilon _ { \phi _ { 3 D } } ( \mathbf { z } _ { t _ { 2 } } ; \mathbf { r } , t _ { 2 } , R , T ) - \epsilon _ { 2 } ) \right] \frac { \partial \mathbf { I } } { \partial \theta } \right] } \end{array}
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
where $\lambda _ { 2 D }$ and $\lambda _ { 3 D }$ determine the strength of 2D and 3D prior, respectively. Increasing $\lambda _ { 2 D }$ leads to better generalizability, higher imagination, and more details, but less 3D consistencies. Increasing $\lambda _ { 3 D }$ results in more 3D consistencies, but worse generalizability and fewer details. However, tuning two parameters at the same time is not user-friendly. Interestingly, through both qualitative and quantitative experiments, we find that Zero-1-to-3, the 3D prior we use, is much more tolerant to $\lambda _ { 3 D }$ than Stable Diffusion to $\lambda _ { 2 D }$ (see $\ S \subset . 1$ for details). When only the 3D prior is used, i.e. $\lambda _ { 2 D } = 0$ , Zero-1-to-3 generates consistent results for $\lambda _ { 3 D }$ ranging from 10 to 60. On the contrary, Stable Diffusion is rather sensitive to $\lambda _ { 2 D }$ . When setting $\lambda _ { 3 D }$ to 0 and using the 2D prior only, the generated geometry varies a lot when $\lambda _ { 2 D }$ is changed from 1 to 2. This observation leads us to fix $\lambda _ { 3 D } = 4 0$ and to rely on tuning the $\lambda _ { 2 D }$ to trade off the generalizability and 3D consistencies. We set $\lambda _ { 2 D } = 1 . 0$ for all experiments, but this value can be tuned according to the user’s preference. More details and discussions on the choice of 2D and 3D priors weights are available in Sec.4.3.
|
| 116 |
+
|
| 117 |
+
# 4 EXPERIMENTS
|
| 118 |
+
|
| 119 |
+
# 4.1 SETUPS
|
| 120 |
+
|
| 121 |
+
NeRF4. We use a NeRF4 dataset that we collect from 4 scenes, chair, drums, ficus, and microphonefrom the synthetic NeRF dataset (Mildenhall et al., 2020). These four scenes cover complex objects (drums and ficus), a hard case (the back view of the chair), and a simple case (the microphone).
|
| 122 |
+
|
| 123 |
+
RealFusion15. We further use the 15 natural images released by RealFusion (Melas-Kyriazi et al., 2023) that consists of both synthetic and real images in a broad range for evalution.
|
| 124 |
+
|
| 125 |
+
Optimization details. We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Most training details and camera settings are set to the same as RealFusion (Melas-Kyriazi et al., 2023). See $\ S \mathrm { A }$ and $\ S _ { \mathrm { B } }$ for details, respectively.
|
| 126 |
+
|
| 127 |
+
Evaluation metrics. Note that accurately evaluating 3D generation remains an open problem in the field. In this work, we eschew the use of a singular 3D ground truth due to the inherent ambiguity in deriving 3D structures from a single image. Instead, we adhere to the metrics employed in the most prior studies (Xu et al., 2023; Melas-Kyriazi et al., 2023), namely PSNR, LPIPS (Zhang et al., 2018), and CLIP-similarity (Radford et al., 2021). PSNR and LPIPS are gauged in the reference view to measure reconstruction quality and perceptual similarity. CLIP-similarity calculates an average CLIP distance between the 100 rendered image and the reference image to measure 3D consistency through appearance similarity across novel views and the reference view.
|
| 128 |
+
|
| 129 |
+

|
| 130 |
+
Figure 5: Qualitative comparisons on image-to-3D generation. We compare Magic123 to recent methods (Point-E (Nichol et al., 2022), ShapeE (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), RealFusion (Melas-Kyriazi et al., 2023), and Zero-1-to-3 (Liu et al., 2023)) for generating 3D objects from a single unposed image (the leftmost column). We show results on the RealFusion15 dataset at the top, while the NeRF4 dataset comparisons are shown at the bottom.
|
| 131 |
+
|
| 132 |
+
# 4.2 RESULTS
|
| 133 |
+
|
| 134 |
+
Quantitative and qualitative comparisons. We compare Magic123 against the state-of-the-art PointE (Nichol et al., 2022), Shap-E (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), NeuralLift (Xu et al., 2023), RealFusion (Melas-Kyriazi et al., 2023) and Zero-1-to-3 (Liu et al., 2023) in both NeRF4 and RealFusion15 datasets. For Zero-1-to-3, we adopt the implementation from (Tang, 2022), which yields better performance than the original implementation. For other works, we use their officially released code. All baselines and Magic123 are run with their default settings. As shown in Table 1, Magic123 achieves Top-1 performance across all the metrics in both datasets when compared to previous approaches. It is worth noting that the PSNR and LPIPS results demonstrate significant improvements over the baselines, highlighting the exceptional reconstruction performance of Magic123. The improvement of CLIP-Similarity reflects the great 3D coherence regards to the reference view. Qualitative comparisons are available in Fig. 5. Magic123 achieves the best results in terms of both geometry and texture. Note how Magic123 greatly outperforms the 3D-based zero-1-to3 (Liu et al., 2023) especially in complex objects like the dragon statue and the colorful teapot in the first two rows, while at the same time greatly outperforming 2D-based RealFusion (Melas-Kyriazi et al., 2023) in all examples. This performance demonstrates the superiority of Magic123 over the state-of-the-art and its ability to generate high-quality 3D content.
|
| 135 |
+
|
| 136 |
+
Table 1: Magic123 results. We show quantitative results in terms of CLIP-Similarity↑ / PSNR↑ / LPIPS↓. The results are shown on the NeRF4 and Realfusion15 datasets, while bold reflects the best.
|
| 137 |
+
|
| 138 |
+
<table><tr><td>Dataset</td><td>Metrics\Methods</td><td>Point-E</td><td>Shap-E</td><td>3DFuse</td><td>NeuralLift</td><td>RealFusion</td><td>Zero-1-to-3</td><td>Magic123 (Ours)</td></tr><tr><td rowspan="4">NeRF4</td><td>CLIP-Similarity↑</td><td>0.48</td><td>0.60</td><td>0.60</td><td>0.52</td><td>0.38</td><td>0.62</td><td>0.80</td></tr><tr><td>PSNR↑</td><td>0.70</td><td>0.99</td><td>11.64</td><td>12.55</td><td>15.37</td><td>23.96</td><td>24.62</td></tr><tr><td>LPIPS↓</td><td>0.80</td><td>0.76</td><td>0.29</td><td>0.40</td><td>0.20</td><td>0.05</td><td>0.03</td></tr><tr><td>CLIP-Similarity↑</td><td>0.53</td><td>0.59</td><td>0.67</td><td>0.65</td><td>0.67</td><td>0.75</td><td>0.82</td></tr><tr><td rowspan="3">RealFusion15</td><td>PSNR↑</td><td>0.98</td><td>1.23</td><td>10.32</td><td>11.08</td><td>18.87</td><td>19.49</td><td>19.50</td></tr><tr><td>LPIPS↓</td><td>0.78</td><td>0.74</td><td>0.38</td><td>0.39</td><td>0.14</td><td>0.11</td><td>0.10</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 139 |
+
|
| 140 |
+
# 4.3 ABLATION AND ANALYSIS
|
| 141 |
+
|
| 142 |
+
Magic123 introduces a coarse-to-fine pipeline for single image reconstruction and a joint 2D and 3D prior for novel view guidance. We provide analysis and ablation studies to show their effectiveness.
|
| 143 |
+
|
| 144 |
+
The effect of the coarse-to-fine pipeline is shown in Fig. 6. A consistent improvement in quantitative performance is observed throughout different setups when the fine stage is used. The use of a textured mesh DMTet representation enables higher quality 3D content that fits the objective and produces more compelling and higher resolution 3D visuals. Qualitative ablation for the coarse-to-fine pipeline is available in $\ S { \bf C } . 2$ .
|
| 145 |
+
|
| 146 |
+
Combining both 2D and 3D priors and the trade-off factor $\lambda _ { 2 D }$ . Fig. 6 demonstrates the effectiveness of the joint 2D and 3D prior quantitatively. In Fig. 7, we further ablate the joint prior qualitatively and analyze the effectiveness of the trade-off hyperparameter $\lambda _ { 2 D }$ in Eqn 7. We start from $\lambda _ { 2 D } { = } 0$ to use only the 3D prior and gradually increase $\lambda _ { 2 D }$ to $0 . 1 , 0 . 5 , 1 . 0 , 2 , 5$ , and finally to use only the 2D prior with $\lambda _ { 2 D } { = } 1$ and $\lambda _ { 3 D } { = } 0$ (we also denote this case as $\lambda _ { 2 D } { = } { \infty }$ for coherence). The key observations include: (1) Relying on a sole 3D prior results in consistent geometry (e.g. teddy bear) but falters in generating complex and uncommon objects, often rendering oversimplified geometry with minimal details (e.g. dragon statue); (2) Relying on a sole 2D prior significantly improves performance in conjuring complex scenes like the dragon statue but simultaneously triggers 3D inconsistencies such as the Janus problem in the bear; (3) As $\lambda _ { 2 D }$ escalates, the imaginative prowess of Magic123 is enhanced and more details become evident, but there is a tendency to compromise 3D consistency. We assign $\lambda _ { 2 D } { = } 1$ as the default value for all examples. $\lambda _ { 2 D }$ could also be fine-tuned for even better results on certain inputs.
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 6: Ablation study (quantitative). We quantitatively compare using the coarse and fine stages in Magic123. In both setups, we ablate utilizing only 2D prior $( \lambda _ { 2 D } = 1 , \lambda _ { 3 D } = 0 )$ ), utilizing only 3D prior $( \lambda _ { 2 D } = 0 , \lambda _ { 3 D } = 4 0 )$ ), and utilizing a joint 2D and 3D prior $( \lambda _ { 2 D } = 1 , \lambda _ { 3 D } = 4 0 )$ ).
|
| 150 |
+
|
| 151 |
+

|
| 152 |
+
Figure 7: Setting $\lambda _ { 2 D }$ . We study the effects of $\lambda _ { 2 D }$ on Magic123. Increasing $\lambda _ { 2 D }$ leads to a 3D geometry with higher imagination and more details but less 3D consistencies and vice versa. $\lambda _ { 2 D } { = } 1$ provides a good balance and thus is used as default throughout all experiments.
|
| 153 |
+
|
| 154 |
+
# 5 CONCLUSION AND DISCUSSION
|
| 155 |
+
|
| 156 |
+
This work presents Magic123, a coarse-to-fine solution for generating high-quality, textured 3D meshes from a single image. By leveraging a joint 2D and 3D prior, Magic123 achieves a performance that is not reachable in a sole 2D or 3D prior-based solution and sets the new state of the art in image-to-3D generation. A trade-off parameter between the 2D and 3D priors allows for control over the generalizability and the 3D consistency. Magic123 outperforms previous techniques in terms of both realism and level of detail, as demonstrated through extensive experiments on real-world images and synthetic benchmarks. Our findings contribute to narrowing the gap between human abilities in 3D reasoning and those of machines, and pave the way for future advancements in single-image 3D reconstruction. The availability of our code, models, and generated 3D assets will further facilitate research and applications in this field.
|
| 157 |
+
|
| 158 |
+
Limitation. One limitation is that Magic123 might suffer from inconsistent texture and inaccurate geometry due to incomplete information from a single image. Specially, a clear inconsitency appers in the boundary mostly because of blended foreground and background along the boundary segmentation errors. A texture consistency loss might be helpful. Similar to previous work, Magic123 also tends to generate over-saturated textures due to the usage of the SDS loss. The over-saturation issue becomes more severe for the second stage because of the higher resolution. See examples in Fig. 5 for these failure cases: the incomplete foot of the bear, the inconsistent texture between the front (pink color) and back views (less pink) of the donuts, the round shape of the drums, and the oversaturated color of the hoarse and the chair. Similar to other per-prompt optimization methods, Magic123 also takes around 1 hour to get a 3D model and with limited diversity. This time can be reduced through (1) replacing to Gaussian Splatting in stage 1 as shown in (Tang et al., 2023a), and (2) sampling from a small range of time steps in stage 2, following the suggestions of ICLR reviewers. The diversity issue might be possible to alleviate through VDS (Wang et al., 2023b) or training with prior guidance plus diverse 3D data.
|
| 159 |
+
|
| 160 |
+
Acknowledgement. The authors would like to thank Xiaoyu Xiang for the insightful discussion and Dai-Jie Wu for sharing Point-E and Shap-E results. This work was supported by the KAUST Office of Sponsored Research through the Visual Computing Center funding, as well as, the SDAIA-KAUST Center of Excellence in Data Science and Artificial Intelligence (SDAIA-KAUST AI). Part of the support is also coming from KAUST Ibn Rushd Postdoc Fellowship program.
|
| 161 |
+
|
| 162 |
+
REFERENCES
|
| 163 |
+
Jonathan T Barron, Ben Mildenhall, Matthew Tancik, Peter Hedman, Ricardo Martin-Brualla, and Pratul P Srinivasan. Mip-nerf: A multiscale representation for anti-aliasing neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5855–5864, 2021.
|
| 164 |
+
Jonathan T Barron, Ben Mildenhall, Dor Verbin, Pratul P Srinivasan, and Peter Hedman. Mip-nerf 360: Unbounded anti-aliased neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5470–5479, 2022.
|
| 165 |
+
Volker Blanz and Thomas Vetter. Face recognition based on fitting a 3d morphable model. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 25(9):1063–1074, 2003.
|
| 166 |
+
James Booth, Anastasios Roussos, Stefanos Zafeiriou, Allan Ponniah, and David Dunaway. A 3d morphable model learnt from 10,000 faces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5543–5552, 2016.
|
| 167 |
+
Shengqu Cai, Anton Obukhov, Dengxin Dai, and Luc Van Gool. Pix2nerf: Unsupervised conditional p-gan for single image to neural radiance fields translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3981–3990, June 2022.
|
| 168 |
+
Eric R Chan, Connor Z Lin, Matthew A Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas J Guibas, Jonathan Tremblay, Sameh Khamis, et al. Efficient geometry-aware 3d generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16123–16133, 2022.
|
| 169 |
+
Dave Zhenyu Chen, Yawar Siddiqui, Hsin-Ying Lee, Sergey Tulyakov, and Matthias Nießner. Text2tex: Text-driven texture synthesis via diffusion models. arXiv preprint arXiv:2303.11396, 2023a.
|
| 170 |
+
Rui Chen, Yongwei Chen, Ningxin Jiao, and Kui Jia. Fantasia3d: Disentangling geometry and appearance for high-quality text-to-3d content creation. arXiv preprint arXiv:2303.13873, 2023b.
|
| 171 |
+
Yen-Chi Cheng, Hsin-Ying Lee, Sergey Tulyakov, Alexander G Schwing, and Liang-Yan Gui. Sdfusion: Multimodal 3d shape completion, reconstruction, and generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
|
| 172 |
+
Matt Deitke, Ruoshi Liu, Matthew Wallingford, Huong Ngo, Oscar Michel, Aditya Kusupati, Alan Fan, Christian Laforte, Vikram Voleti, Samir Yitzhak Gadre, Eli VanderBilt, Aniruddha Kembhavi, Carl Vondrick, Georgia Gkioxari, Kiana Ehsani, Ludwig Schmidt, and Ali Farhadi. Objaverse-xl: A universe of $1 0 \mathrm { m } + 3 \mathrm { d }$ objects. arXiv preprint arXiv:2307.05663, 2023a.
|
| 173 |
+
Matt Deitke, Dustin Schwenk, Jordi Salvador, Luca Weihs, Oscar Michel, Eli VanderBilt, Ludwig Schmidt, Kiana Ehsani, Aniruddha Kembhavi, and Ali Farhadi. Objaverse: A universe of annotated 3d objects. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13142–13153, 2023b.
|
| 174 |
+
Yilun Du, Cameron Smith, Ayush Tewari, and Vincent Sitzmann. Learning to render novel views from wide-baseline stereo pairs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
|
| 175 |
+
Shivam Duggal and Deepak Pathak. Topologically-aware deformation fields for single-view 3d reconstruction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1536–1546, 2022.
|
| 176 |
+
Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H. Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. In International Conference on Learning Representations (ICLR), 2023.
|
| 177 |
+
Lukas Höllein, Ang Cao, Andrew Owens, Justin Johnson, and Matthias Nießner. Text2room: Extracting textured 3d meshes from 2d text-to-image models. arXiv preprint arXiv:2303.11989, 2023.
|
| 178 |
+
|
| 179 |
+
Fangzhou Hong, Mingyuan Zhang, Liang Pan, Zhongang Cai, Lei Yang, and Ziwei Liu. Avatarclip: Zero-shot text-driven generation and animation of 3d avatars. arXiv preprint arXiv:2205.08535, 2022.
|
| 180 |
+
|
| 181 |
+
Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5885–5894, 2021.
|
| 182 |
+
Ajay Jain, Ben Mildenhall, Jonathan T Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 867–876, 2022.
|
| 183 |
+
Heewoo Jun and Alex Nichol. Shap-e: Generating conditional 3d implicit functions. arXiv preprint arXiv:2305.02463, 2023.
|
| 184 |
+
Angjoo Kanazawa, Shubham Tulsiani, Alexei A Efros, and Jitendra Malik. Learning categoryspecific mesh reconstruction from image collections. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 371–386, 2018.
|
| 185 |
+
Abhishek Kar, Shubham Tulsiani, Joao Carreira, and Jitendra Malik. Category-specific object reconstruction from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1966–1974, 2015.
|
| 186 |
+
Ira Kemelmacher-Shlizerman. Internet based morphable model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3256–3263, 2013.
|
| 187 |
+
Mijeong Kim, Seonguk Seo, and Bohyung Han. Infonerf: Ray entropy minimization for few-shot neural volume rendering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12912–12921, 2022.
|
| 188 |
+
Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pretraining for unified vision-language understanding and generation. In International Conference on Machine Learning, pp. 12888–12900. PMLR, 2022.
|
| 189 |
+
Junnan Li, Dongxu Li, Silvio Savarese, and Steven C. H. Hoi. BLIP-2: bootstrapping language-image pre-training with frozen image encoders and large language models. In ICML, volume 202 of Proceedings of Machine Learning Research, pp. 19730–19742. PMLR, 2023.
|
| 190 |
+
Chen-Hsuan Lin, Jun Gao, Luming Tang, Towaki Takikawa, Xiaohui Zeng, Xun Huang, Karsten Kreis, Sanja Fidler, Ming-Yu Liu, and Tsung-Yi Lin. Magic3d: High-resolution text-to-3d content creation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
|
| 191 |
+
Ruoshi Liu, Rundi Wu, Basile Van Hoorick, Pavel Tokmakov, Sergey Zakharov, and Carl Vondrick. Zero-1-to-3: Zero-shot one image to 3d object. arXiv preprint arXiv:2303.11328, 2023.
|
| 192 |
+
Stephen Lombardi, Tomas Simon, Jason Saragih, Gabriel Schwartz, Andreas Lehrmann, and Yaser Sheikh. Neural volumes: Learning dynamic renderable volumes from images. arXiv preprint arXiv:1906.07751, 2019.
|
| 193 |
+
Matthew Loper, Naureen Mahmood, Javier Romero, Gerard Pons-Moll, and Michael J Black. Smpl: A skinned multi-person linear model. ACM Transactions on Graphics (TOG), 34(6):1–16, 2015.
|
| 194 |
+
Julieta Martinez, Rayat Hossain, Javier Romero, and James J Little. A simple yet effective baseline for 3d human pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2640–2649, 2017.
|
| 195 |
+
Luke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: $3 6 0 \{ \backslash \mathrm { d e g } \}$ reconstruction of any object from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
|
| 196 |
+
Gal Metzer, Elad Richardson, Or Patashnik, Raja Giryes, and Daniel Cohen-Or. Latent-nerf for shape-guided generation of 3d shapes and textures. arXiv preprint arXiv:2211.07600, 2022.
|
| 197 |
+
|
| 198 |
+
Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2mesh: Text-driven neural stylization for meshes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 199 |
+
|
| 200 |
+
Aryan Mikaeili, Or Perel, Daniel Cohen-Or, and Ali Mahdavi-Amiri. Sked: Sketch-guided text-based 3d editing. arXiv preprint arXiv:2303.10735, 2023.
|
| 201 |
+
Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 405–421. Springer, 2020.
|
| 202 |
+
Nasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Tiberiu Popa. Clip-mesh: Generating textured meshes from text using pretrained image-text models. In SIGGRAPH Asia 2022 Conference Papers, pp. 1–8, 2022.
|
| 203 |
+
Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. In ACM Transactions on Graphics (SIGGRAPH), 2022.
|
| 204 |
+
Alex Nichol, Heewoo Jun, Prafulla Dhariwal, Pamela Mishkin, and Mark Chen. Point-e: A system for generating 3d point clouds from complex prompts. arXiv preprint arXiv:2212.08751, 2022.
|
| 205 |
+
Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2085–2094, 2021.
|
| 206 |
+
Georgios Pavlakos, Vasileios Choutas, Nima Ghorbani, Timo Bolkart, Ahmed AA Osman, Dimitrios Tzionas, and Michael J Black. Expressive body capture: 3d hands, face, and body from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10975–10985, 2019.
|
| 207 |
+
Ben Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. International Conference on Learning Representations (ICLR), 2022.
|
| 208 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8748–8763. PMLR, 2021.
|
| 209 |
+
Amit Raj, Srinivas Kaza, Ben Poole, Michael Niemeyer, Nataniel Ruiz, Ben Mildenhall, Shiran Zada, Kfir Aberman, Michael Rubinstein, Jonathan Barron, et al. Dreambooth3d: Subject-driven text-to-3d generation. arXiv preprint arXiv:2303.13508, 2023.
|
| 210 |
+
Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8821–8831. PMLR, 2021.
|
| 211 |
+
René Ranftl, Katrin Lasinger, David Hafner, Konrad Schindler, and Vladlen Koltun. Towards robust monocular depth estimation: Mixing datasets for zero-shot cross-dataset transfer. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 44(3):1623–1637, 2020.
|
| 212 |
+
René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 12159– 12168, 2021.
|
| 213 |
+
Elad Richardson, Gal Metzer, Yuval Alaluf, Raja Giryes, and Daniel Cohen-Or. Texture: Text-guided texturing of 3d shapes. arXiv preprint arXiv:2302.01721, 2023.
|
| 214 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10684–10695, 2022.
|
| 215 |
+
Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Information Processing Systems (NeurIPS), 35:36479–36494, 2022.
|
| 216 |
+
Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021.
|
| 217 |
+
Junyoung Seo, Wooseok Jang, Min-Seop Kwak, Jaehoon Ko, Hyeonsu Kim, Junho Kim, Jin-Hwa Kim, Jiyoung Lee, and Seungryong Kim. Let 2d diffusion model know 3d-consistency for robust text-to-3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
|
| 218 |
+
Tianchang Shen, Jun Gao, Kangxue Yin, Ming-Yu Liu, and Sanja Fidler. Deep marching tetrahedra: a hybrid representation for high-resolution 3d shape synthesis. In Advances in Neural Information Processing Systems (NeurIPS), volume 34, pp. 6087–6101, 2021.
|
| 219 |
+
Aliaksandr Siarohin, Willi Menapace, Ivan Skorokhodov, Kyle Olszewski, Hsin-Ying Lee, Jian Ren, Menglei Chai, and Sergey Tulyakov. Unsupervised volumetric animation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
|
| 220 |
+
Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proceedings of the International Conference on Machine Learning (ICML), pp. 2256–2265. PMLR, 2015.
|
| 221 |
+
Jingxiang Sun, Xuan Wang, Yichun Shi, Lizhen Wang, Jue Wang, and Yebin Liu. Ide-3d: Interactive disentangled editing for high-resolution 3d-aware portrait synthesis. ACM Transactions on Graphics (TOG), 41(6):1–10, 2022. doi: 10.1145/3550454.3555506.
|
| 222 |
+
Andrea Tagliasacchi and Ben Mildenhall. Volume rendering digest (for nerf). arXiv preprint arXiv:2209.02417, 2022.
|
| 223 |
+
Jiaxiang Tang. Stable-dreamfusion: Text-to-3d with stable-diffusion, 2022. https://github.com/ashawkey/stable-dreamfusion.
|
| 224 |
+
Jiaxiang Tang, Jiawei Ren, Hang Zhou, Ziwei Liu, and Gang Zeng. Dreamgaussian: Generative gaussian splatting for efficient 3d content creation. arXiv preprint arXiv:2309.16653, 2023a.
|
| 225 |
+
Junshu Tang, Tengfei Wang, Bo Zhang, Ting Zhang, Ran Yi, Lizhuang Ma, and Dong Chen. Make-it-3d: High-fidelity 3d creation from a single image with diffusion prior. arXiv preprint arXiv:2303.14184, 2023b.
|
| 226 |
+
Haochen Wang, Xiaodan Du, Jiahao Li, Raymond A Yeh, and Greg Shakhnarovich. Score jacobian chaining: Lifting pretrained 2d diffusion models for 3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023a.
|
| 227 |
+
Nanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, and Yu-Gang Jiang. Pixel2mesh: Generating 3d mesh models from single rgb images. In Proceedings of the European conference on computer vision (ECCV), pp. 52–67, 2018.
|
| 228 |
+
Zhengyi Wang, Cheng Lu, Yikai Wang, Fan Bao, Chongxuan Li, Hang Su, and Jun Zhu. Prolificdreamer: High-fidelity and diverse text-to-3d generation with variational score distillation. arXiv preprint arXiv:2305.16213, 2023b.
|
| 229 |
+
Daniel Watson, William Chan, Ricardo Martin-Brualla, Jonathan Ho, Andrea Tagliasacchi, and Mohammad Norouzi. Novel view synthesis with diffusion models. In International Conference on Learning Representations (ICLR), 2023.
|
| 230 |
+
Shangzhe Wu, Christian Rupprecht, and Andrea Vedaldi. Unsupervised learning of probably symmetric deformable 3d objects from images in the wild. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 231 |
+
Dejia Xu, Yifan Jiang, Peihao Wang, Zhiwen Fan, Yi Wang, and Zhangyang Wang. Neurallift-360: Lifting an in-the-wild 2d photo to a 3d object with $3 6 0 \{ \backslash \mathrm { d e g } \}$ views. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
|
| 232 |
+
Jiale Xu, Xintao Wang, Weihao Cheng, Yan-Pei Cao, Ying Shan, Xiaohu Qie, and Shenghua Gao. Dream3d: Zero-shot text-to-3d synthesis using 3d shape prior and text-to-image diffusion models. arXiv preprint arXiv:2212.14704, 2022.
|
| 233 |
+
Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4578–4587, 2021.
|
| 234 |
+
Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023.
|
| 235 |
+
Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
|
| 236 |
+
|
| 237 |
+
# A IMPLEMENTATION DETAILS
|
| 238 |
+
|
| 239 |
+
We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Both coarse and fine stages are optimized using Adam with 0.001 learning rate and no weight decay for 5, 000 iterations. $\lambda _ { r g b } , \lambda _ { m a s k }$ are set to 5, 0.5 for both stages. $\lambda _ { 2 D }$ and $\lambda _ { 3 D }$ are set to 1 and 40 for the first stage and are lowered to 0.001 and 0.01 in the second stage for refinement to alleviate oversaturated textures. We adopt the Stable Diffusion (Sohl-Dickstein et al., 2015) model of V1.5 as the 2D prior. The guidance scale of the 2D prior is set to 100 following (Poole et al., 2022). For the 3D prior, Zero-1-to-3 (Liu et al., 2023) (105, 000 iterations finetuned version) is leveraged. The guidance scale of Zero-1-to-3 is set to 5 following (Liu et al., 2023). The NeRF backbone is implemented by three layers of multi-layer perceptrons with 64 hidden dims. Regarding lighting and shading, we keep nearly the same as (Poole et al., 2022). The difference is we set the first 1, 000 iterations in the first stage to normals’ shading to focus on learning geometry as inspired by (Chen et al., 2023b). For other iterations as well as the fine stage, we use diffuse shading with a probability 0.75 and textureless shading with a probability 0.25. The rendering resolutions are set to $1 2 8 \times 1 2 8$ and $1 0 2 4 \times 1 0 2 4$ for the coarse and the fine stage, respectively. For both stages, we use depth regularization and normal smoothness regularization with $\lambda _ { d } = 0 . 0 0 1$ and $\lambda _ { n } = 0 . 5$ . Following the standard practice (Barron et al., 2021; Poole et al., 2022; Melas-Kyriazi et al., 2023), we additionally add the 0.001 entropy regularization and 0.01 orientation regularization in the NeRF stage. Our implementation is based on the Stable DreamFusion repo (Tang, 2022). The training of Magic123 takes roughly 1 hour on a 32G V100 GPU, while the coarse stage and the fine stage take 40 and 20 minutes, respectively.
|
| 240 |
+
|
| 241 |
+
# B CAMERA SETTINGS
|
| 242 |
+
|
| 243 |
+
Frontal view setting. Since the reference image is unposed, our model assumes a frontal reference view ( $9 0 ^ { \circ }$ elevation and $0 ^ { \circ }$ azimuth) for simplicity. However, in real-world applications, these angles can be adjusted according to the input, either through intuitive estimation or camera pose detection. A simple tuning of the elevation angle can improve the benchmark performance of Magic123. For instance, in the chair example shown in Fig. II, altering the elevation angle from $9 0 °$ to $6 0 ^ { \circ }$ addresses squeezed reconstruction of the chair. For research purposes, we propose to exclude this camera estimation as it does not impact the comparison between different methods and only requires engineering efforts in application.
|
| 244 |
+
|
| 245 |
+
Rendering camera setting. We set the camera parameters for the rendering as follows. The camera is placed 1.8 meters from the coordinate origin, i.e. the radial distance is 1.8. The field of view (FOV) of the camera is $4 0 ^ { \circ }$ . We highlight that the 3D reconstruction performance is not sensitive to camera parameters, as long as they are reasonable, e.g. FOV between 20 and 60, and radial distance between 1 to 4 meters. In Fig. II, we validate that using the same camera parameters as RealFusion (Melas-Kyriazi et al., 2023) that is different from ours, i.e. camera radius [1.0, 1.5] and FOV [40, 70], achieves results without obvious differences as ours.
|
| 246 |
+
|
| 247 |
+
# C MORE ANALYSIS AND ABLATION STUDIES
|
| 248 |
+
|
| 249 |
+
# C.1 ABLATION AND ANALYSIS ON THE USAGE OF 2D AND 3D PRIORS
|
| 250 |
+
|
| 251 |
+
3D priors only. We first turn off the guidance of 2D prior by setting $\lambda _ { 2 D } = 0$ , such that we only use the 3D-aware diffusion prior Zero-1-to-3 Liu et al. (2023).
|
| 252 |
+
|
| 253 |
+
Note that Zero-1-to-3 in our paper (results in Tab. 1, Fig. 5) denotes our improved reimplemented Zeo-1-to-3 using the same training configurations as Magic123. i.e. Zero-1-to-3 in our paper refers to the first stage results of Maigc123 3D prior only (Fig. 2, 6, 7), where both of them use second stage DMTet fine-tuning for fair comparison.
|
| 254 |
+
|
| 255 |
+
Furthermore, we study the effects of $\lambda _ { 3 D }$ by performing a grid search and evaluate the image-to-3D reconstruction performance, where $\lambda _ { 3 D } = 5 , 1 0 , 2 0 , 4 0 , 6 0 , 8 0$ . Interestingly, we find that Zero-1-to3 is very robust to the change of $\lambda _ { 3 D }$ . Tab. I demonstrates that different $\lambda _ { 3 D }$ leads to a consistent quantitative result. We thus simply set $\lambda _ { 3 D } = 4 0$ throughout the experiments since it achieves a slightly better CLIP-similarity score than other values.
|
| 256 |
+
|
| 257 |
+

|
| 258 |
+
Figure I: Ablation study (qualitative). We qualitatively compare the novel view renderings from the coarse and fine stages in Magic123. We ablate utilizing only 2D prior $( \lambda _ { 2 D } = 1 , \lambda _ { 3 D } = 0 )$ , only 3D prior $( \lambda _ { 2 D } = 0 , \lambda _ { 3 D } = 4 0 )$ , and a joint 2D and 3D prior $( \lambda _ { 2 D } = 1 , \lambda _ { 3 D } = 4 0 )$ ). We also ablate the effects of textual inversion at the right.
|
| 259 |
+
|
| 260 |
+
2D priors only. We then turn off the 3D prior and study the effect of $\lambda _ { 2 D }$ . As shown in Tab. I, the image-to-3D system is sensitive to the weights of the 2D prior. With the increase of $\lambda _ { 2 D }$ , a sharp increase in CLIP similarity and a drop in PSNR are observed. This is because a larger 2D prior weight leads to more imagination, which unfortunately might result in 3D inconsistency. Due to the observation that the 3D prior is more robust than the 2D prior to the weight, we use $\lambda _ { 2 D }$ as the tradeoff parameter to control the imagination and 3D consistency.
|
| 261 |
+
|
| 262 |
+
# C.2 ABLATION ON THE COARSE-TO-FINE PIPELINE
|
| 263 |
+
|
| 264 |
+
In $\ S 4 . 3$ we ablate the effect of the coarse-to-fine pipeline quantitatively. Here we provide the visual comparisons in Fig. I. The fine stage consistently augments the sharpness of the rendering and the geometry and texture details. See the edge of the wings and claws of the dragon and the toppings of the donuts for examples.
|
| 265 |
+
|
| 266 |
+
# C.3 ABLATE THE REGULARIZATION
|
| 267 |
+
|
| 268 |
+
Magic123 is optimized additionally by depth regularization, normal smoothness regularization, entropy regularization, and orientation regularization, with weights of 0.01, 0.5, 0.001, and 0.01, respectively. In Fig. II, we show that the depth, the entropy, and the orientation regularizations have minimal impact on the image-to-3D reconstruction performance. However, we keep them in our implementation as they are common practices in the NeRF family. The normal smoothness is more important in alleviating the high-frequency noise.
|
| 269 |
+
|
| 270 |
+
# C.4 ABLATE THE TEXTUAL INVERSION
|
| 271 |
+
|
| 272 |
+
We use textual inversion in both stages for consistent geometry and texture with the input reference image. Fig. I we additionally ablate the effects of textural inversion by removing it and using pure texts in the guidance. In the two examples, we change the prompts from “A high-resolution DSLR image of $< e > "$ to “A high-resolution DSLR image of a metal dragon statue”, and “A high-resolution DSLR image of two donuts”, respectively. As observed, textual inversion has marginal effects on the image-to-3D reconstruction performance. However, it helps with keeping the consistency between the input image and the generated 3D content. Without textual inversion, the dragon with a different style of horns and golden textures appears that is not consistent with the input image. The donuts without textual inversion have distinct toppings from the input image.
|
| 273 |
+
|
| 274 |
+

|
| 275 |
+
Figure II: Qualitative ablation study for the effects of depth regularization, normal smoothness, entropy and orientation regularization, camera parameters, and ghe front-view assumption (elevation angle). Normal smoothness reduces high-frequency noise. Other factors like depth, entropy, and orientation regularization exert minimal influence on image-to-3D reconstruction results but are maintained in Magic123, adhering to common practice. Using different camera parameters, including camera radius (1.8 meters v.s. [1.0, 1.5] in RealFusion) and field of view $4 0 ~ \nu . s .$ [40, 70] in RealFusion), have a marginal impact on performance. Magic123 opts for a simple configuration, setting the camera radius to 1.8 meters and the FOV to 40. Setting the elevation angle from $9 0 °$ to a reasonable value also improves reconstruction quality (see the chair example).
|
| 276 |
+
|
| 277 |
+
# D MORE COMPARASIONS
|
| 278 |
+
|
| 279 |
+
Here, we additionally compare Magic123 with most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b). Magic123 outperforms all of them in terms of both 3D geometry and texture quality by a large margin.
|
| 280 |
+
|
| 281 |
+

|
| 282 |
+
Figure III: Qualitative comparisons. We compare Magic123 to the most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b).
|
md/test/2lDQLiH1W4/2lDQLiH1W4.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# INSTANT3D: FAST TEXT-TO-3D WITH SPARSE-VIEW GENERATION AND LARGE RECONSTRUCTION MODEL
|
| 2 |
+
|
| 3 |
+
Jiahao $\mathbf { L i } ^ { 1 , 2 * }$ Hao Tan1 Kai Zhang1 Zexiang $\mathbf { X } \mathbf { u } ^ { 1 }$ Fujun Luan1 Yinghao $\mathbf { X } \mathbf { u } ^ { 1 , 3 }$ Yicong Hong1,4 Kalyan Sunkavalli1 Greg Shakhnarovich2 Sai Bi1
|
| 4 |
+
|
| 5 |
+
1Adobe Research 2TTIC 3Stanford University 4 Australian National Univeristy {jiahao,greg}@ttic.edu yhxu@stanford.edu mr.yiconghong@gmail.com {hatan,kaiz,zexu,fluan,sunkaval,sbi}@adobe.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Text-to-3D with diffusion models has achieved remarkable progress in recent years. However, existing methods either rely on score distillation-based optimization which suffer from slow inference, low diversity and Janus problems, or are feed-forward methods that generate low-quality results due to the scarcity of 3D training data. In this paper, we propose Instant3D, a novel method that generates high-quality and diverse 3D assets from text prompts in a feed-forward manner. We adopt a two-stage paradigm, which first generates a sparse set of four structured and consistent views from text in one shot with a fine-tuned 2D text-to-image diffusion model, and then directly regresses the NeRF from the generated images with a novel transformer-based sparse-view reconstructor. Through extensive experiments, we demonstrate that our method can generate diverse 3D assets of high visual quality within 20 seconds, which is two orders of magnitude faster than previous optimization-based methods that can take 1 to 10 hours. Our project webpage is: https://jiahao.ai/instant3d/.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
In recent years, remarkable progress has been achieved in the field of 2D image generation. This success can be attributed to two key factors: the development of novel generative models such as diffusion models (Song et al., 2021; Ho et al., 2020; Ramesh et al., 2022; Rombach et al., 2021), and the availability of large-scale datasets like Laion5B (Schuhmann et al., 2022). Transferring this success in 2D image generation to 3D presents challenges, mainly due to the scarcity of available 3D training data. While Laion5B has 5 billion text-image pairs, Objaverse-XL (Deitke et al., 2023a), the largest public 3D dataset, contains only 10 million 3D assets with less diversity and poorer annotations. As a result, previous attempts to directly train 3D diffusion models on existing 3D datasets (Luo & Hu, 2021; Nichol et al., 2022; Jun & Nichol, 2023; Gupta et al., 2023; Chen et al., 2023b) are limited in the visual (shape and appearance) quality, diversity and compositional complexity of the results they can produce.
|
| 14 |
+
|
| 15 |
+
To address this, another line of methods (Poole et al., 2022; Wang et al., 2023a; Lin et al., 2023; Wang et al., 2023b; Chen et al., 2023c) leverage the semantic understanding and high-quality generation capabilities of pretrained 2D diffusion models. Here, 2D generators are used to calculate gradients on rendered images, which are then used to optimize a 3D representation, usually a NeRF (Mildenhall et al., 2020). Although these methods yield better visual quality and text-3D alignment, they can be incredibly time-consuming, taking hours of optimization for each prompt. They also suffer from artifacts such as over-saturated colors and the “multi-face” problem arising from the bias in pretrained 2D diffusion models, and struggle to generate diverse results from the same text prompt, with varying the random seed leading to minor changes in geometry and texture.
|
| 16 |
+
|
| 17 |
+
In this paper, we propose Instant3D, a novel feed-forward method that generates high-quality and diverse 3D assets conditioned on the text prompt. Instant3D, like the methods noted above, builds on top of pretrained 2D diffusion models. However, it does so by splitting 3D generation into two stages: 2D generation and 3D reconstruction. In the first stage, instead of generating images sequentially (Liu et al., 2023b), we fine-tune an existing text-to-image diffusion model (Podell et al., 2023) to generate a sparse set of four-view images in the form of a $2 \times 2$ grid in a single denoising process. This design allows the multi-view images to attend to each other during generation, leading to more view-consistent results. In the second stage, instead of relying on a slow optimizationbased reconstruction method, inspired by Hong et al. (2024), we introduce a novel sparse-view large reconstruction model with a transformer-based architecture that can directly regress a triplanebased (Chan et al., 2022) NeRF from a sparse set of multi-view images. Our model projects sparseview images into a set of pose-aware image tokens using pretrained vision transformers (Caron et al., 2021), which are then fed to an image-to-triplane decoder that contains a sequence of transformer blocks with cross-attention and self-attention layers. Our proposed model has a large capacity with more than 500 million parameters and can robustly infer correct geometry and appearance of objects from just four images.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Our method generates high-quality 3D NeRF assets from the given text prompts within 20 seconds. Here we show novel view renderings from our generated NeRFs as well as the renderings of the extracted meshes from their density field.
|
| 21 |
+
|
| 22 |
+
Both of these stages are fine-tuned/trained with multi-view rendered images of around 750K 3D objects from Objaverse (Deitke et al., 2023b), where the second stage makes use of the full dataset and the first stage can be fine-tuned with as little as 10K data. While we use a relatively smaller dataset compared to the pre-training dataset for other modalities (e.g., C4 Raffel et al. (2020) for text and Laion5B for image), by combining it with the power of pretrained 2D diffusion models, Instant3D’s two-stage approach is able to generate high-quality and diverse 3D assets even from input prompts that contain complex compositional concepts (see Figure 1) and do not exist in the 3D dataset used for training. Due to its feed-forward architecture, Instant3D is exceptionally fast, requiring only about 20 seconds to generate a 3D asset, which is $2 0 0 \times$ faster than previous optimization-based methods (Poole et al., 2022; Wang et al., 2023b) while achieving comparable or even better quality.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORKS
|
| 25 |
+
|
| 26 |
+
3D generation. Following the success of generative models on 2D images using VAEs (Kingma & Welling, 2013; Van Den Oord et al., 2017), GANs (Goodfellow et al., 2014; Karras et al., 2019; Gu et al., 2022; Kang et al., 2023), and autoregressive models (Oord et al., 2016; Van Den Oord et al., 2016), people have also explored the applications of such models on 3D generation. Previous approaches have explored different methods to generate 3D models in the form of point clouds (Wu et al., 2016; Gadelha et al., 2017; Smith & Meger, 2017), triangle meshes (Gao et al., 2022; Pavllo et al., 2020; Chen et al., 2019; Luo et al., 2021) , volumes (Chan et al., 2022; Or-El et al., 2022; Bergman et al., 2022; Skorokhodov et al., 2022; Mittal et al., 2022) and implicit representations (Liu et al., 2022; Fu et al., 2022; Sanghi et al., 2022) in an unconditional or text/image-conditioned manner. Such methods are usually trained on limited categories of 3D objects and do not generalize well to a wide range of novel classes.
|
| 27 |
+
|
| 28 |
+
Diffusion models (Rombach et al., 2021; Podell et al., 2023; Ho et al., 2020; Song et al., 2021; Saharia et al., 2022) open new possibilities for 3D generation. A class of methods directly train 3D diffusion models on the 3D representations (Nichol et al., 2022; Liu et al., 2023c; Zhou et al., 2021; Sanghi et al., 2023) or project the 3D models or multi-view rendered images into latent representations (Ntavelis et al., 2023; Zeng et al., 2022; Gupta et al., 2023; Jun & Nichol, 2023; Chen et al., 2023b) and perform the diffusion process in the latent space. For example, Shap-E (Jun & Nichol, 2023) encodes each 3D shape into a set of parameters of an implicit function, and then trains a conditional diffusion model on the parameters. These approaches face challenges due to the restricted availability and diversity of existing 3D data, consequently resulting in generated content with poor visual quality and inadequate alignment with the input prompt. Therefore, although trained on millions of 3D assets, Shap-E still fails to generate 3D shapes with complex compositional concepts and high-fidelity textures.
|
| 29 |
+
|
| 30 |
+
To resolve this, another line of works try to make use of 2D diffusion models to facilitate 3D generation. Some works (Jain et al., 2022; Mohammad Khalid et al., 2022) optimize meshes or NeRFs to maximize the CLIP Radford et al. (2021) score between the rendered images and input prompt utilizing pretrained CLIP models. While such methods can generate diverse 3D content, they exhibit a deficiency in visual realism. More recently, some works (Poole et al., 2022; Wang et al., 2023b; Lin et al., 2023; Chen et al., 2023c) optimize 3D representations using score distillation loss (SDS) based on pretrained 2D diffusion models. Such methods can generate high-quality results, but suffer from slow optimization, over-saturated colors and the Janus problem. For example, it takes 1.5 hours for DreamFusion (Poole et al., 2022) and 10 hours for ProlificDreamer Wang et al. (2023b) to generate a single 3D asset, which greatly limits their practicality. In contrast, our method enjoys the benefits of both worlds: it’s able to borrow information from pretrained 2D diffusion models to generate diverse multi-view consistent images that are subsequently lifted to faithful 3D models, while still being fast and efficient due to its feed-forward nature.
|
| 31 |
+
|
| 32 |
+
Sparse-view reconstruction. Traditional 3D reconstruction with multi-view stereo (Agarwal et al., 2011; Schonberger et al. ¨ , 2016; Furukawa et al., 2015) typically requires a dense set of input images that have significant overlaps to find correspondence across views and infer the geometry correctly. While NeRF (Mildenhall et al., 2020) and its variants (Muller et al. ¨ , 2022; Chen et al., 2022; 2023a) have further alleviated the prerequisites for 3D reconstruction, they perform per-scene optimization that still necessitates a lot of input images. Previous methods (Wang et al., 2021; Chen et al., 2021; Long et al., 2022; Reizenstein et al., 2021; Trevithick & Yang, 2021; Shen et al., 2023) have tried to learn data priors so as to infer NeRF from a sparse set of images. Typically they extract per-view features from each input image, and then for each point on the camera ray, aggregate multiview features and decode them to the density (or SDF) and colors. Such methods are either trained in a category-specific manner, or only trained on small datasets such as ShapeNet; they have not been demonstrated to generalize beyond these datasets especially to the complex text-to-2D outputs.
|
| 33 |
+
|
| 34 |
+
More recently, some methods utilize data priors from pretrained 2D diffusion models to lift a single 2D image to 3D by providing supervision at novel views using SDS loss (Liu et al., 2023b; Qian et al., 2023; Melas-Kyriazi et al., 2023) or generating multi-view images (Liu et al., 2023a). For instance, One-2-3-45 (Liu et al., 2023a) generates 32 images at novel views from a single input image using a fine-tuned 2D diffusion model, and reconstructs a 3D model from them, which suffers from inconsistency between the many generated views. In comparison, our sparse-view reconstructor adopts a highly scalable transformer-based architecture and is trained on large-scale 3D data. This gives it the ability to accurately reconstruct 3D models of novel unseen objects from a sparse set of 4 images without per-scene optimization.
|
| 35 |
+
|
| 36 |
+
# 3 METHOD
|
| 37 |
+
|
| 38 |
+
Our method Instant3D is composed of two stages: sparse-view generation and feed-forward NeRF reconstruction. In Section 3.1, we present our approach for generating sparse multi-view images conditioned on the text input. In Section 3.2, we describe our transformer-based sparse-view large reconstruction model.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Overview of our method. Given a text prompt (‘a car made out of sushi’), we perform multi-view generation with Gaussian blobs as initialization using fine-tuned 2D diffusion model, producing a 4-view image in the form of a $2 \times 2$ grid. Then we apply a transformer-based sparseview 3D reconstructor on the 4-view image to generate the final NeRF.
|
| 42 |
+
|
| 43 |
+
# 3.1 TEXT-CONDITIONED SPARSE VIEW GENERATION
|
| 44 |
+
|
| 45 |
+
Given a text prompt, our goal is to generate a set of multi-view images that are aligned with the prompt and consistent with each other. We achieve this by fine-tuning a pretrained text-to-image diffusion model to generate a $2 \times 2$ image grid as shown in Figure 2.
|
| 46 |
+
|
| 47 |
+
In the following paragraphs, we first illustrate that large text-to-image diffusion models (i.e., SDXL (Podell et al., 2023)) have the capacity to generate view-consistent images thus a lightweight fine-tuning is possible. We then introduce three essential techniques to achieve it: the image grid, the curation of the dataset, and also the Gaussian Blob noise initialization in inference. As a result of these observations and technical improvements, we can fine-tune the 2D diffusion model for only 10K steps (on 10K data) to generate consistent sparse views.
|
| 48 |
+
|
| 49 |
+
Multi-view generation with image grid. Previous methods (Liu et al., 2023b;a) on novel-view synthesis show that image diffusion models are capable of understanding the multi-view consistency. In light of this, we compile the images at different views into a single image in the form of an image grid, as depicted in Figure 2. This image-grid design can better match the original data format of the 2D diffusion model, and is suitable for simple direct fine-tuning protocol of 2D models. We also observe that this simple protocol only works when the base 2D diffusion has enough capacity, as shown in the comparisons of Stable Diffusion v1.5 (Rombach et al., 2021) and SDXL (Podell et al., 2023) in Section 4.3. The benefit from simplicity will also be illustrated later in unlocking the lightweight fine-tuning possibility.
|
| 50 |
+
|
| 51 |
+
Regarding the number of views in the image grid, there is a trade-off between the requirements of multi-view generation and 3D reconstruction. More generated views make the problem of 3D reconstruction easier with more overlaps but increase possibility of view inconsistencies in generation and reduces the resolution of each generated view. On the other hand, too few views may cause insufficient coverage, requiring the reconstructor to hallucinate unseen parts, which is challenging for a deterministic 3D reconstruction model. Our transformer-based reconstructor learns generic 3D priors from large-scale data, and greatly reduces the requirement for the number of views. We empirically found that using 4 views achieves a good balance in satisfying the two requirements above, and they can be naturally arranged in a $2 \times 2$ grid as shown in Figure 2. Next, we detail how the image grid data is created and curated.
|
| 52 |
+
|
| 53 |
+
Multi-view data creation and curation. To fine-tune the text-to-image diffusion model, we create paired multi-view renderings and text prompts. We adopt a large-scale synthetic 3D dataset Objaverse (Deitke et al., 2023b) and render four $5 1 2 \times 5 1 2$ views of about 750K objects with Blender. We distribute the four views at a fixed elevation (20 degrees) and four equidistant azimuths (0, 90, 180, 270 degrees) to achieve a better coverage of the object. We use Cap3D (Luo et al., 2023) to generate captions for each 3D object, which consolidates captions from multi-view renderings generated with pretrained image captioning model BLIP-2 (Li et al., 2023) using a large language model (LLM). Finally, the four views are assembled into a grid image in a fixed order and resized to the input resolution compatible with the 2D diffusion model.
|
| 54 |
+
|
| 55 |
+
We find that naively using all the data for fine-tuning reduces the photo-realism of the generated images and thus the quality of the 3D assets. Therefore, we train a simple scorer on a small amount (2000 samples) of manually labeled data to predict the quality of each 3D object. The model is a simple SVM on top of pretrained CLIP features extracted from multi-view renderings of the 3D object (please see Appendix for details). During training, our model only takes the top 10K data ranked by our scorer. We provide a quantitative study in Section 4.3 to validate the impact of different data curation strategies. Although the difference is not very significant from the metric perspective, we found that our curated data is helpful in improving the visual quality.
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
Figure 3: Architecture of our sparse-view reconstructor. The model applies a pretrained ViT to encode multi-view images into pose-aware image tokens, from which we decode a triplane representation of the scene using a transformer-based decoder. Finally we decode per-point triplane features to its density and color and perform volume rendering to render novel views. We illustrate here with 2 views and the actual implementation uses 4 views.
|
| 59 |
+
|
| 60 |
+
Inference with Gaussian blob initialization. While our training data is multi-view images with a white background, we observe that during inference starting from standard Gaussian noise still results in images that have cluttered backgrounds (see Figure 5); this introduces extra difficulty for the feed-forward reconstructor in the second stage (Section 3.2). To guide the model toward generating images with a clean white background, inspired by SDEdit (Meng et al., 2022), we first create an image of a $2 \times 2$ grid with a solid white background that has the same resolution as the output image, and initialize each sub-grid with a 2D Gaussian blob that is placed at the center of the image with a standard deviation of 0.1 (please see Appendix for details). The visualization of this Gaussian Blob is shown in Figure 2. The Gaussian blob image grid is fed to the auto-encoder to get its latent. We then add diffusion noise (e.g., use t=980/1000 for 50 DDIM denoising steps), and use it as the starting point for the denoising process. As seen in Figure 5, this technique effectively guides the model toward generating images with a clean background.
|
| 61 |
+
|
| 62 |
+
Lightweight fine-tuning. With all the above observations and techniques, we are able to adapt a text-to-image diffusion model to a text-to-multiview model with lightweight fine-tuning. This lightweight fine-tuning shares a similar spirit to the ‘instruction fine-tuning’ (Mishra et al., 2022; Wei et al., 2021) for LLM alignment. The assumption is that the base model is already capable of the task, and the fine-tuning is to unlock the base model’s ability without introducing additional knowledge.
|
| 63 |
+
|
| 64 |
+
Since we utilize an image grid, the fine-tuning follows the exactly same protocol as the 2D diffusion model pre-training, except that we decrease the learning rate to $1 0 ^ { - 5 }$ . We train the model with a batch size of 192 for only 10K iterations on the 10K curated multi-view data. The training is done using 32 NVIDIA A100 GPUs for only 3 hours. We study the impact of different training settings in Section 4.3. For more training details, please refer to Appendix.
|
| 65 |
+
|
| 66 |
+
# 3.2 FEED-FORWARD SPARSE-VIEW LARGE RECONSTRUCTION MODEL
|
| 67 |
+
|
| 68 |
+
In this stage, we aim to reconstruct a NeRF from the four-view images $\mathcal { T } = \{ \mathbf { I } _ { i } ~ | ~ i = 1 , . . . , 4 \}$ generated in the first stage. 3D reconstruction from sparse inputs with a large baseline is a challenging problem, which requires strong model priors to resolve the inherent ambiguity. Inspired by a recent work LRM (Hong et al., 2024) that introduces a transformer-based model for single image 3D reconstruction, we propose a novel approach that enables us to predict a NeRF from a sparse set of input views with known poses. Similar to Hong et al. (2024), our model consists of an image encoder, an image-to-triplane decoder, and a NeRF decoder. The image encoder encodes the multiview images into a set of tokens. We feed the concatenated image tokens to the image-to-triplane decoder to output a triplane representation (Chan et al., 2022) for the 3D object. Finally, the triplane features are decoded into per-point density and colors via the NeRF MLP decoder.
|
| 69 |
+
|
| 70 |
+
In detail, we apply a pretrained Vision Transformer (ViT) DINO (Caron et al., 2021) as our image encoder. To support multi-view inputs, we inject camera information in the image encoder to make the output image tokens pose-aware. This is different from Hong et al. (2024) that feeds the camera information in the image-to-triplane decoder because they take single image input. The camera information injection is done by the AdaLN (Huang & Belongie, 2017; Peebles & Xie, 2022) camera modulation as described in Hong et al. (2024). The final output of the image encoder is a set of poseaware image tokens $f _ { { \mathbf { I } } _ { i } } ^ { * }$ , and we concatenate the per-view tokens together as the feature descriptors for the multi-view images: $\mathbf { \mathit { f } } _ { \mathbb { T } } = \oplus ( \mathbf { \mathit { f } } _ { \mathbf { \mathit { I } } _ { 1 } } ^ { * } , . . . \mathbf { \mathit { f } } _ { \mathbf { \mathit { I } } _ { 4 } } ^ { * } )$
|
| 71 |
+
|
| 72 |
+
We use triplane as the scene representation. The triplane is flattened to a sequence of learnable tokens, and the image-to-triplane decoder connects these triplane tokens with the pose-aware image tokens $f _ { \mathcal { T } }$ using cross-attention layers, followed by self-attention and MLP layers. The final output tokens are reshaped and upsampled using a de-convolution layer to the final triplane representation. During training, we ray march through the object bounding box and decode the triplane features at each point to its density and color using a shared MLP, and finally get the pixel color via volume rendering. We train the networks in an end-to-end manner with image reconstruction loss at novel views using a combination of MSE loss and LPIPS (Zhang et al., 2018) loss.
|
| 73 |
+
|
| 74 |
+
Training details. We train the model on multi-view renderings of the Objaverse dataset (Deitke et al., 2023b). Different from the first stage that performs data curation, we use all the 3D objects in the dataset and scale them to $[ - 1 , 1 ] ^ { 3 }$ ; then we generate multi-view renderings using Blender under uniform lighting with a resolution of $5 1 2 \times 5 1 2$ . While the output images from the first stage are generated in a structured setup with fixed camera poses, we train the model using random views as a data augmentation mechanism to increase the robustness. Particularly, we randomly sample 32 views around each object. During training, we randomly select a subset of 4 images as input and another random set of 4 images as supervision. For inference, we will reuse the fixed camera poses in the first stage as the camera input to the reconstructor. For more details on the training, please refer to the Appendix.
|
| 75 |
+
|
| 76 |
+
# 4 EXPERIMENTS
|
| 77 |
+
|
| 78 |
+
In this section, we first do comparisons against previous methods on text-to-3D (Section 4.1), and then perform ablation studies on different design choices of our method. By default, we report the results generated with fine-tuned SDXL models, unless otherwise noted.
|
| 79 |
+
|
| 80 |
+
# 4.1 TEXT-TO-3D
|
| 81 |
+
|
| 82 |
+
We make comparisons to state-of-the-art methods on text-to-3D, including a feed-forward method Shap-E (Jun & Nichol, 2023), and optimization-based methods including DreamFusion (Poole et al., 2022) and ProlificDreamer (Wang et al., 2023b). We use the official code for Shap-E, and the implementation from three-studio (Guo et al., 2023) for the other two as there is no official code. We use default hyper-parameters (number of optimization iterations, number of denoising steps) of these models. For our own model we use the SDXL base model fine-tuned on 10K data for 10K steps. During inference we take 100 DDIM steps.
|
| 83 |
+
|
| 84 |
+
Qualitative comparisons. As shown in Figure 4, our method generates visually better results than those of Shap-E, producing sharper textures, better geometry and substantially improved text3D alignment. Shap-E applies a diffusion model that is exclusively trained on million-level 3D data, which might be evidence for the need of 2D data or models with 2D priors. DreamFusion and ProlificDreamer achieve better text-3D alignment utilizing pretrained 2D diffusion models. However,
|
| 85 |
+
|
| 86 |
+

|
| 87 |
+
Figure 4: Qualitative comparisons on text-to-3D against previous methods. We include more uncurated comparisons in the supplementary material.
|
| 88 |
+
|
| 89 |
+
Table 1: Quantitative comparisons on CLIP scores against baseline methods. Our method outperforms previous feed-forward method Shap-E and optimization-based method DreamFusion, and achieves competitive performance compared to ProlificDreamer while being $1 8 0 0 \times$ faster.
|
| 90 |
+
|
| 91 |
+
Table 2: Quantitative comparisons against previous sparse-view reconstruction methods on GSO dataset.
|
| 92 |
+
|
| 93 |
+
<table><tr><td></td><td>ViT-L/14 个</td><td>ViT-bigG-14↑</td><td>Time(s)↓</td></tr><tr><td>Shap-E</td><td>20.51</td><td>32.21</td><td>6</td></tr><tr><td>DreamFusion</td><td>23.60</td><td>37.46</td><td>5400</td></tr><tr><td>ProlificDreamer</td><td>27.39</td><td>42.98</td><td>36000</td></tr><tr><td>Ours</td><td>26.87</td><td>41.77</td><td>20</td></tr></table>
|
| 94 |
+
|
| 95 |
+
<table><tr><td></td><td>PSNR↑</td><td>SSIM↑</td><td>LPIPS↓</td></tr><tr><td>SparseNeus</td><td>20.62</td><td>0.8360</td><td>0.1989</td></tr><tr><td>Ours</td><td>26.54</td><td>0.8934</td><td>0.0643</td></tr></table>
|
| 96 |
+
|
| 97 |
+
DreamFusion generates results with over-saturated colors and over-smooth textures. While ProlificDreamer results have better details, it still suffers from low-quality geometry (as in ‘A bulldozer clearing ...’) and the Janus problem (as in ”a squirrel dressed like ...”, also more detailed in Appendix Figure 11). In comparison, our results have more photorealistic appearance with better geometric details. Please refer to the Appendix and supplementary materials for video comparisons and more results.
|
| 98 |
+
|
| 99 |
+
Quantitative comparisons. In Table 4, we quantitatively assess the coherence between the generated models and text prompts using CLIP-based scores. We perform the evaluation on results with 400 text prompts from DreamFusion. For each model, we render 10 random views and calculate the average CLIP score between the rendered images and the input text. We report the metric using multiple variants of CLIP models with different model sizes and training data (i.e., ViT-L/14 from OpenAI and ViT-bigG-14 from OpenCLIP). From the results we can see that our model achieves higher CLIP scores than Shap-E, indicating better text-3D alignment. Our method even achieves consistently higher CLIP scores than optimization-based method DreamFusion and competitive scores to ProlificDreamer, from which we can see that our approach can effectively inherit the great text understanding capability from the pretrained SDXL model and preserve them in the generated 3D assets via consistent sparse-view generation and robust 3D reconstruction.
|
| 100 |
+
|
| 101 |
+
Inference time comparisons. We present the time to generate a 3D asset in Table 1. The timing is measured using the default hyper-parameters of each method on an A100 GPU. Notably, our method is significantly faster than the optimization-based methods: while it takes 1.5 hours for DreamFusion and 10 hours for ProlificDreamer to generate a single asset, our method can finish the generation within 20 seconds, resulting in a $2 7 0 \times$ and $1 8 0 0 \times$ speed up respectively. In Figure 10, we show that our inference time can be further reduced without obviously sacrificing the quality by decreasing the number of DDIM steps.
|
| 102 |
+
|
| 103 |
+
# 4.2 COMPARISONS ON SPARSE VIEW RECONSTRUCTION
|
| 104 |
+
|
| 105 |
+
We make comparisons to previous sparse-view NeRF reconstruction works. Most of previous works (Reizenstein et al., 2021; Trevithick & Yang, 2021; Yu et al., 2021) are either trained on small-scale datasets such as ShapeNet, or trained in a category-specific manner. Therefore, we make comparisons to a state-of-the-art method SparseNeus (Long et al., 2022), which is also applied in One-2-3-45 (Liu et al., 2023a) where they train the model on the same Objaverse dataset for sparseview reconstruction. We do the comparisons on the Google Scan Object (GSO) dataset (Downs et al., 2022), which consists of 1019 objects. For each object, we render 4-view input following the structured setup and randomly select another 10 views for testing. We adopt the pretrained model from Liu et al. (2023a). Particularly, SparseNeus does not work well for 4-view inputs with such a large baseline; therefore we add another set of 4 input views in addition to our four input views (our method still uses 4 views as input), following the setup in Liu et al. (2023a). We report the metrics on novel view renderings in Table 2. From the table, we can see that our method outperforms the baseline method even with fewer input images, which demonstrates the superiority of our sparse-view reconstructor.
|
| 106 |
+
|
| 107 |
+
# 4.3 ABLATION STUDY FOR SPARSE VIEW GENERATION
|
| 108 |
+
|
| 109 |
+
We ablate several key decisions in our method design, including (1) the choice of the larger 2D base model SDXL, (2) the use of Gaussian Blob during inference, (3) the quality and size of the curated dataset, and lastly, (4) the need and requirements of lightweight fine-tuning. We gather the quantitative results in Table 3 and place all qualitative results in the Appendix. We observe that qualitative results are more evident than quantitative results, thus we recommend a closer examination.
|
| 110 |
+
|
| 111 |
+
Scalability with 2D text-to-image models. One of the notable advantages of our method is that its efficacy scales positively with the potency of the underlying 2D text-to-image model. In Figure 12, we present qualitative comparisons between two distinct backbones (with their own tuned hyperparameters): SD1.5 (Rombach et al., 2021) and SDXL (Podell et al., 2023). It becomes readily apparent that SDXL, which boasts a model size $3 \times$ larger than that of SD1.5, exhibits superior text comprehension and visual quality. We also show a quantitative comparison on CLIP scores in Table 3. By comparing $\mathrm { E x p } ( \mathrm { l } , \mathrm { m } )$ with $\mathrm { E x p } ( \mathrm { d } , \mathrm { g } )$ , we can see that the model with SD1.5 achieves consistently lower CLIP scores indicating worse text-3D alignment.
|
| 112 |
+
|
| 113 |
+
Gaussian blob initialization. In Figure 5, we show our results generated with and without Gaussian blob initialization. From the results we can see that while our fine-tuned model can generate multi-view images without Gaussian blob initialization, they tend to have cluttered backgrounds, which challenges the second-stage feed-forward reconstructor. In contrast, our proposed Gaussian blob initialization enables the fine-tuned model to generate images with a clean white background, which better align with the requirements of the second stage.
|
| 114 |
+
|
| 115 |
+
Quality and size of fine-tuning dataset. We evaluate the impact of the quality and size of the dataset used for fine-tuning 2D text-to-image models. We first make comparisons between curated and uncurated (randomly selected) data. The CLIP score rises slightly as shown in Table 3 (i.e., comparing $\mathrm { E x p } ( \mathrm { d } , \mathrm { i } ) )$ , while there is a substantial quality improvement as illustrated in Appendix Figure 7. This aligns with the observation that the data quality can dramatically impact the results in the instruction fine-tuning stage of LLM (Zhou et al., 2023).
|
| 116 |
+
|
| 117 |
+
When it comes to data size, we observe a double descent from Table $\mathrm { E x p } ( \mathbf { a } , \mathbf { d } , \mathbf { g } )$ with 1K, 10K, and 100K data. We pick Exp(a, d, g) here because they are the best results among different training steps for the same training data size. The reason for this double descent can be spotlighted by the qualitative comparisons in Appendix Figure 13, where training with 1K data can lead to inconsistent multi-view images, while training with 100K data can hurt the compositionality, photo-realism, and also text alignment.
|
| 118 |
+
|
| 119 |
+

|
| 120 |
+
Figure 5: Qualitative comparisons on results generated with and without Gaussian blob initialization.
|
| 121 |
+
|
| 122 |
+
Table 3: Comparison on CLIP scores of NeRF renderings with different variants of fine-tuning settings.
|
| 123 |
+
|
| 124 |
+
<table><tr><td>Exp ID</td><td>Exp Name</td><td>Base</td><td>#Data</td><td>Curated</td><td>#Steps</td><td>ViT-L/14</td><td>ViT-bigG-14</td></tr><tr><td>(a)</td><td>Curated-1K-s1k</td><td>SDXL</td><td>1K</td><td>√</td><td>1K</td><td>26.33</td><td>41.09</td></tr><tr><td>(b)</td><td>Curated-1K-s10k</td><td>SDXL</td><td>1K</td><td>√</td><td>10k</td><td>22.55</td><td>35.59</td></tr><tr><td>(c)</td><td>Curated-10K-s4k</td><td>SDXL</td><td>10K</td><td>√</td><td>4k</td><td>26.55</td><td>41.08</td></tr><tr><td>(d)</td><td>Curated-10K-s10k</td><td>SDXL</td><td>10K</td><td>√</td><td>10k</td><td>26.87</td><td>41.77</td></tr><tr><td>(e)</td><td>Curated-10K-s20k</td><td>SDXL</td><td>10K</td><td>√</td><td>20k</td><td>25.96</td><td>40.56</td></tr><tr><td>(f)</td><td>Curated-100K-s10k</td><td>SDXL</td><td>100K</td><td></td><td>10k</td><td>25.79</td><td>40.32</td></tr><tr><td>(g)</td><td>Curated-100K-s40k</td><td>SDXL</td><td>100K</td><td></td><td>40k</td><td>26.59</td><td>41.29</td></tr><tr><td>(h)</td><td>Curated-300K-s40k</td><td>SDXL</td><td>300K</td><td></td><td>40K</td><td>26.43</td><td>40.72</td></tr><tr><td>i</td><td>Random-10K-s10k</td><td>SDXL</td><td>10K</td><td>X</td><td>10k</td><td>26.87</td><td>41.47</td></tr><tr><td></td><td>Random-100K-s40k</td><td>SDXL</td><td>100K</td><td>X</td><td>40k</td><td>26.28</td><td>40.90</td></tr><tr><td>(k)</td><td>AllData-s40k</td><td>SDXL</td><td>700K</td><td>X</td><td>40k</td><td>26.13</td><td>40.60</td></tr><tr><td>1</td><td>Curated-10K-s10k (SD1.5)</td><td>SD1.5</td><td>10K</td><td>√</td><td>10k</td><td>23.50</td><td>36.90</td></tr><tr><td>(m)</td><td>Curated-100K-s40k (SD1.5)</td><td>SD1.5</td><td>100K</td><td>√</td><td>40k</td><td>25.48</td><td>39.07</td></tr></table>
|
| 125 |
+
|
| 126 |
+
Number of fine-tuning steps. We also quantitatively and qualitatively analyze the impact of finetuning steps. For each block in Table 3 we show the CLIP scores of different training steps. Similar to the findings in instruction fine-tuning (Ouyang et al., 2022), the results do not increase monotonically regarding the number of fine-tuning steps but have a peak in the middle. For example, in our final setup with the SDXL base model and 10K curated data (i.e., Exp(c, d, e)), the results are peaked at 10K steps. For other setups, the observations are similar. We also qualitatively compare the results at different training steps for 10K curated data in Appendix Figure 14. There is an obvious degradation in the quality of the results for both 4K and 20K training steps.
|
| 127 |
+
|
| 128 |
+
Another important observation is that the peak might move earlier when the model size becomes larger. This can be observed by comparing between $\operatorname { E x p } ( 1 , \operatorname { m } )$ for SD1.5 and Exp(d,g) for SDXL. Note that this comparison is not conclusive yet from the Table given that SD1.5 does not perform reasonably with our direct fine-tuning protocol. More details are in the Appendix.
|
| 129 |
+
|
| 130 |
+
We also found that Exp(a) with 1K steps on 1K data can achieve the best CLIP scores but the view consistency is actually disrupted. A possible reason is that the CLIP score is insensitive to certain artifacts introduced by reconstruction from inconsistent images, which also calls for a more reliable evaluation metric for 3D generation.
|
| 131 |
+
|
| 132 |
+
# 5 CONCLUSIONS
|
| 133 |
+
|
| 134 |
+
In this paper we presented a novel feed-forward two-stage approach Instant3D that can generate high-quality and diverse 3D assets from text prompts within 20 seconds. Our method finetunes a 2D text-to-image diffusion model to generate consistent 4-view images, and lifts them to 3D with a robust transformer-based large reconstruction model. The experiment results show that our method outperforms previous feed-forward methods in terms of quality while being equally fast, and achieves comparable or better performance to previous optimization-based methods with a speed-up of more than 200 times. Instant3D allows novice users to easily create 3D assets and enables fast prototyping and iteration for various applications such as 3D design and modeling.
|
| 135 |
+
|
| 136 |
+
Ethics Statement. The generation ability of our model is inherited from the public 2D diffusion model SDXL. We only do lightweight fine-tuning over the SDXL model thus it is hard to introduce extra knowledge to it. Also, our model can share similar ethical and legal considerations to SDXL. The curation of the data for lightweight fine-tuning does not introduce outside annotators. Thus the quality of the data might be biased towards the preference of the authors, which can lead to a potential bias on the generated results as well. The text input to the model is not further checked by the model, which means that the model will try to do the generation for every text prompt it gets without the ability to acknowledge unknown knowledge.
|
| 137 |
+
|
| 138 |
+
Reproducibility Statement. In the main text, we highlight the essential techniques to build our model for both the first stage (Section 3.1) and the second stage (Section 3.2). We discuss how our data is created and curated in Section 3. The full model configurations and training details can be found in Appendix Section A.3 and Section A.6. We have detailed all the optimizer hyperparameters and model dimensions. We present more details on our data curation process in Section A.2. We also attach the IDs of our curated data in Supplementary Materials to further facilitate the reproduction.
|
| 139 |
+
|
| 140 |
+
# REFERENCES
|
| 141 |
+
|
| 142 |
+
Adobe. Adobe Firefly. https://firefly.adobe.com/, 2023.
|
| 143 |
+
|
| 144 |
+
Sameer Agarwal, Yasutaka Furukawa, Noah Snavely, Ian Simon, Brian Curless, Steven M Seitz, and Richard Szeliski. Building rome in a day. Communications of the ACM, 54(10):105–112, 2011.
|
| 145 |
+
Alexander Bergman, Petr Kellnhofer, Wang Yifan, Eric Chan, David Lindell, and Gordon Wetzstein. Generative neural articulated radiance fields. Advances in Neural Information Processing Systems, 35:19900–19916, 2022.
|
| 146 |
+
Mathilde Caron, Hugo Touvron, Ishan Misra, Herve J ´ egou, Julien Mairal, Piotr Bojanowski, and ´ Armand Joulin. Emerging properties in self-supervised vision transformers. In Proceedings of the International Conference on Computer Vision (ICCV), 2021.
|
| 147 |
+
Eric R. Chan, Connor Z. Lin, Matthew A. Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas Guibas, Jonathan Tremblay, Sameh Khamis, Tero Karras, and Gordon Wetzstein. Efficient geometry-aware 3D generative adversarial networks. In CVPR, 2022.
|
| 148 |
+
Anpei Chen, Zexiang Xu, Fuqiang Zhao, Xiaoshuai Zhang, Fanbo Xiang, Jingyi Yu, and Hao Su. Mvsnerf: Fast generalizable radiance field reconstruction from multi-view stereo. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 14124–14133, 2021.
|
| 149 |
+
Anpei Chen, Zexiang Xu, Andreas Geiger, Jingyi Yu, and Hao Su. Tensorf: Tensorial radiance fields. In European Conference on Computer Vision (ECCV), 2022.
|
| 150 |
+
Anpei Chen, Zexiang Xu, Xinyue Wei, Siyu Tang, Hao Su, and Andreas Geiger. Dictionary fields: Learning a neural basis decomposition. ACM Trans. Graph., 2023a.
|
| 151 |
+
Hansheng Chen, Jiatao Gu, Anpei Chen, Wei Tian, Zhuowen Tu, Lingjie Liu, and Hao Su. Singlestage diffusion nerf: A unified approach to 3d generation and reconstruction. In ICCV, 2023b.
|
| 152 |
+
Rui Chen, Yongwei Chen, Ningxin Jiao, and Kui Jia. Fantasia3d: Disentangling geometry and appearance for high-quality text-to-3d content creation. arXiv preprint arXiv:2303.13873, 2023c.
|
| 153 |
+
Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174, 2016.
|
| 154 |
+
Wenzheng Chen, Huan Ling, Jun Gao, Edward Smith, Jaakko Lehtinen, Alec Jacobson, and Sanja Fidler. Learning to predict 3d objects with an interpolation-based differentiable renderer. Advances in neural information processing systems, 32, 2019.
|
| 155 |
+
Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Re. Flashattention: Fast and memory- ´ efficient exact attention with io-awareness. Advances in Neural Information Processing Systems, 35:16344–16359, 2022.
|
| 156 |
+
|
| 157 |
+
Matt Deitke, Ruoshi Liu, Matthew Wallingford, Huong Ngo, Oscar Michel, Aditya Kusupati, Alan Fan, Christian Laforte, Vikram Voleti, Samir Yitzhak Gadre, et al. Objaverse-xl: A universe of $1 0 \mathrm { m } + 3 \mathrm { d }$ objects. arXiv preprint arXiv:2307.05663, 2023a.
|
| 158 |
+
|
| 159 |
+
Matt Deitke, Dustin Schwenk, Jordi Salvador, Luca Weihs, Oscar Michel, Eli VanderBilt, Ludwig Schmidt, Kiana Ehsani, Aniruddha Kembhavi, and Ali Farhadi. Objaverse: A universe of annotated 3d objects. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13142–13153, 2023b.
|
| 160 |
+
Laura Downs, Anthony Francis, Nate Koenig, Brandon Kinman, Ryan Hickman, Krista Reymann, Thomas B McHugh, and Vincent Vanhoucke. Google scanned objects: A high-quality dataset of 3d scanned household items. In 2022 International Conference on Robotics and Automation (ICRA), pp. 2553–2560. IEEE, 2022.
|
| 161 |
+
Rao Fu, Xiao Zhan, Yiwen Chen, Daniel Ritchie, and Srinath Sridhar. Shapecrafter: A recursive text-conditioned 3d shape generation model. Advances in Neural Information Processing Systems, 35:8882–8895, 2022.
|
| 162 |
+
Yasutaka Furukawa, Carlos Hernandez, et al. Multi-view stereo: A tutorial. ´ Foundations and Trends® in Computer Graphics and Vision, 9(1-2):1–148, 2015.
|
| 163 |
+
Matheus Gadelha, Subhransu Maji, and Rui Wang. 3d shape induction from 2d views of multiple objects. In 2017 International Conference on 3D Vision (3DV), pp. 402–411. IEEE, 2017.
|
| 164 |
+
Jun Gao, Tianchang Shen, Zian Wang, Wenzheng Chen, Kangxue Yin, Daiqing Li, Or Litany, Zan Gojcic, and Sanja Fidler. Get3d: A generative model of high quality 3d textured shapes learned from images. Advances In Neural Information Processing Systems, 35:31841–31854, 2022.
|
| 165 |
+
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in neural information processing systems, 27, 2014.
|
| 166 |
+
Jiatao Gu, Lingjie Liu, Peng Wang, and Christian Theobalt. Stylenerf: A style-based 3d aware generator for high-resolution image synthesis. In International Conference on Learning Representations, 2022.
|
| 167 |
+
Yuan-Chen Guo, Ying-Tian Liu, Ruizhi Shao, Christian Laforte, Vikram Voleti, Guan Luo, ChiaHao Chen, Zi-Xin Zou, Chen Wang, Yan-Pei Cao, and Song-Hai Zhang. threestudio: A unified framework for 3d content generation. https://github.com/threestudio-project/ threestudio, 2023.
|
| 168 |
+
Anchit Gupta, Wenhan Xiong, Yixin Nie, Ian Jones, and Barlas Oguz. 3dgen: Triplane latent ˘ diffusion for textured mesh generation. arXiv preprint arXiv:2303.05371, 2023.
|
| 169 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840–6851, 2020.
|
| 170 |
+
Yicong Hong, Kai Zhang, Jiuxiang Gu, Sai Bi, Yang Zhou, Difan Liu, Feng Liu, Kalyan Sunkavalli, Trung Bui, and Hao Tan. Lrm: Large reconstruction model for single image to 3d. In ICLR, 2024.
|
| 171 |
+
Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In Proceedings of the IEEE international conference on computer vision, pp. 1501–1510, 2017.
|
| 172 |
+
Ajay Jain, Ben Mildenhall, Jonathan T Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 867–876, 2022.
|
| 173 |
+
Heewoo Jun and Alex Nichol. Shap-e: Generating conditional 3d implicit functions. arXiv preprint arXiv:2305.02463, 2023.
|
| 174 |
+
Minguk Kang, Jun-Yan Zhu, Richard Zhang, Jaesik Park, Eli Shechtman, Sylvain Paris, and Taesung Park. Scaling up gans for text-to-image synthesis. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2023.
|
| 175 |
+
Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4401–4410, 2019.
|
| 176 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 177 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 178 |
+
Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pre-training with frozen image encoders and large language models. 2023.
|
| 179 |
+
Chen-Hsuan Lin, Jun Gao, Luming Tang, Towaki Takikawa, Xiaohui Zeng, Xun Huang, Karsten Kreis, Sanja Fidler, Ming-Yu Liu, and Tsung-Yi Lin. Magic3d: High-resolution text-to-3d content creation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 300–309, 2023.
|
| 180 |
+
Minghua Liu, Chao Xu, Haian Jin, Linghao Chen, Mukund Varma T, Zexiang Xu, and Hao Su. One-2-3-45: Any single image to 3d mesh in 45 seconds without per-shape optimization, 2023a.
|
| 181 |
+
Ruoshi Liu, Rundi Wu, Basile Van Hoorick, Pavel Tokmakov, Sergey Zakharov, and Carl Vondrick. Zero-1-to-3: Zero-shot one image to 3d object, 2023b.
|
| 182 |
+
Zhen Liu, Yao Feng, Michael J Black, Derek Nowrouzezahrai, Liam Paull, and Weiyang Liu. Meshdiffusion: Score-based generative 3d mesh modeling. arXiv preprint arXiv:2303.08133, 2023c.
|
| 183 |
+
Zhengzhe Liu, Yi Wang, Xiaojuan Qi, and Chi-Wing Fu. Towards implicit text-guided 3d shape generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 17896–17906, 2022.
|
| 184 |
+
Xiaoxiao Long, Cheng Lin, Peng Wang, Taku Komura, and Wenping Wang. Sparseneus: Fast generalizable neural surface reconstruction from sparse views. In European Conference on Computer Vision, pp. 210–227. Springer, 2022.
|
| 185 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 186 |
+
Andrew Luo, Tianqin Li, Wen-Hao Zhang, and Tai Sing Lee. Surfgen: Adversarial 3d shape synthesis with explicit surface discriminators. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 16238–16248, 2021.
|
| 187 |
+
Shitong Luo and Wei Hu. Diffusion probabilistic models for 3d point cloud generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2837–2845, 2021.
|
| 188 |
+
Tiange Luo, Chris Rockwell, Honglak Lee, and Justin Johnson. Scalable 3d captioning with pretrained models. arXiv preprint arXiv:2306.07279, 2023.
|
| 189 |
+
Luke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: 360 reconstruction of any object from a single image. In CVPR, 2023. URL https://arxiv.org/ abs/2302.10663.
|
| 190 |
+
Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2022.
|
| 191 |
+
Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, et al. Mixed precision training. In International Conference on Learning Representations, 2018.
|
| 192 |
+
Ben Mildenhall, Pratul P. Srinivasan, Matthew Tancik, Jonathan T. Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In ECCV, 2020.
|
| 193 |
+
Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3470–3487, 2022.
|
| 194 |
+
Paritosh Mittal, Yen-Chi Cheng, Maneesh Singh, and Shubham Tulsiani. Autosdf: Shape priors for 3d completion, reconstruction and generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 306–315, 2022.
|
| 195 |
+
Nasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Tiberiu Popa. Clip-mesh: Generating textured meshes from text using pretrained image-text models. In SIGGRAPH Asia 2022 conference papers, pp. 1–8, 2022.
|
| 196 |
+
Thomas Muller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics prim- ¨ itives with a multiresolution hash encoding. ACM Trans. Graph., 41(4):102:1–102:15, July 2022. doi: 10.1145/3528223.3530127. URL https://doi.org/10.1145/3528223. 3530127.
|
| 197 |
+
Alex Nichol, Heewoo Jun, Prafulla Dhariwal, Pamela Mishkin, and Mark Chen. Point-e: A system for generating 3d point clouds from complex prompts. arXiv preprint arXiv:2212.08751, 2022.
|
| 198 |
+
Evangelos Ntavelis, Aliaksandr Siarohin, Kyle Olszewski, Chaoyang Wang, Luc Van Gool, and Sergey Tulyakov. Autodecoding latent 3d diffusion models. arXiv preprint arXiv:2307.05445, 2023.
|
| 199 |
+
Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
|
| 200 |
+
Roy Or-El, Xuan Luo, Mengyi Shan, Eli Shechtman, Jeong Joon Park, and Ira KemelmacherShlizerman. StyleSDF: High-Resolution 3D-Consistent Image and Geometry Generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13503–13513, June 2022.
|
| 201 |
+
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730–27744, 2022.
|
| 202 |
+
Dario Pavllo, Graham Spinks, Thomas Hofmann, Marie-Francine Moens, and Aurelien Lucchi. Convolutional generation of textured 3d meshes. Advances in Neural Information Processing Systems, 33:870–882, 2020.
|
| 203 |
+
F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
|
| 204 |
+
William Peebles and Saining Xie. Scalable diffusion models with transformers. arXiv preprint arXiv:2212.09748, 2022.
|
| 205 |
+
Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas Muller, Joe ¨ Penna, and Robin Rombach. Sdxl: improving latent diffusion models for high-resolution image synthesis. arXiv preprint arXiv:2307.01952, 2023.
|
| 206 |
+
Ben Poole, Ajay Jain, Jonathan T. Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. arXiv, 2022.
|
| 207 |
+
Guocheng Qian, Jinjie Mai, Abdullah Hamdi, Jian Ren, Aliaksandr Siarohin, Bing Li, HsinYing Lee, Ivan Skorokhodov, Peter Wonka, Sergey Tulyakov, et al. Magic123: One image to high-quality 3d object generation using both 2d and 3d diffusion priors. arXiv preprint arXiv:2306.17843, 2023.
|
| 208 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748–8763. PMLR, 2021.
|
| 209 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551, 2020.
|
| 210 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 1(2):3, 2022.
|
| 211 |
+
Jeremy Reizenstein, Roman Shapovalov, Philipp Henzler, Luca Sbordone, Patrick Labatut, and David Novotny. Common objects in 3d: Large-scale learning and evaluation of real-life 3d category reconstruction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10901–10911, 2021.
|
| 212 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models, 2021.
|
| 213 |
+
Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Information Processing Systems, 35:36479–36494, 2022.
|
| 214 |
+
Aditya Sanghi, Hang Chu, Joseph G Lambourne, Ye Wang, Chin-Yi Cheng, Marco Fumero, and Kamal Rahimi Malekshan. Clip-forge: Towards zero-shot text-to-shape generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18603–18613, 2022.
|
| 215 |
+
Aditya Sanghi, Rao Fu, Vivian Liu, Karl DD Willis, Hooman Shayani, Amir H Khasahmadi, Srinath Sridhar, and Daniel Ritchie. Clip-sculptor: Zero-shot generation of high-fidelity and diverse shapes from natural language. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18339–18348, 2023.
|
| 216 |
+
Johannes Lutz Schonberger, Enliang Zheng, Marc Pollefeys, and Jan-Michael Frahm. Pixelwise ¨ view selection for unstructured multi-view stereo. In European Conference on Computer Vision (ECCV), 2016.
|
| 217 |
+
Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion-5b: An open large-scale dataset for training next generation image-text models. Advances in Neural Information Processing Systems, 35:25278–25294, 2022.
|
| 218 |
+
Bokui Shen, Xinchen Yan, Charles R Qi, Mahyar Najibi, Boyang Deng, Leonidas Guibas, Yin Zhou, and Dragomir Anguelov. Gina-3d: Learning to generate implicit neural assets in the wild. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4913–4926, 2023.
|
| 219 |
+
Ivan Skorokhodov, Sergey Tulyakov, Yiqun Wang, and Peter Wonka. Epigraf: Rethinking training of 3d gans. Advances in Neural Information Processing Systems, 35:24487–24501, 2022.
|
| 220 |
+
Edward J Smith and David Meger. Improved adversarial systems for 3d object generation and reconstruction. In Conference on Robot Learning, pp. 87–96. PMLR, 2017.
|
| 221 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021. URL https://openreview.net/ forum?id $\bar { }$ St1giarCHLP.
|
| 222 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
|
| 223 |
+
Alex Trevithick and Bo Yang. Grf: Learning a general radiance field for 3d representation and
|
| 224 |
+
rendering. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 15182–15192, 2021.
|
| 225 |
+
Aaron Van Den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. ¨ In International conference on machine learning, pp. 1747–1756. PMLR, 2016.
|
| 226 |
+
Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in neural information processing systems, 30, 2017.
|
| 227 |
+
Haochen Wang, Xiaodan Du, Jiahao Li, Raymond A Yeh, and Greg Shakhnarovich. Score jacobian chaining: Lifting pretrained 2d diffusion models for 3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12619–12629, 2023a.
|
| 228 |
+
Qianqian Wang, Zhicheng Wang, Kyle Genova, Pratul Srinivasan, Howard Zhou, Jonathan T. Barron, Ricardo Martin-Brualla, Noah Snavely, and Thomas Funkhouser. Ibrnet: Learning multiview image-based rendering. In CVPR, 2021.
|
| 229 |
+
Zhengyi Wang, Cheng Lu, Yikai Wang, Fan Bao, Chongxuan Li, Hang Su, and Jun Zhu. Prolificdreamer: High-fidelity and diverse text-to-3d generation with variational score distillation. arXiv
|
| 230 |
+
preprint arXiv:2305.16213, 2023b.
|
| 231 |
+
Jason Wei, Maarten Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. In International Conference on Learning Representations, 2021.
|
| 232 |
+
Jiajun Wu, Chengkai Zhang, Tianfan Xue, Bill Freeman, and Josh Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. Advances in neural information processing systems, 29, 2016.
|
| 233 |
+
Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelNeRF: Neural radiance fields from one or few images. In CVPR, 2021.
|
| 234 |
+
Xiaohui Zeng, Arash Vahdat, Francis Williams, Zan Gojcic, Or Litany, Sanja Fidler, and Karsten Kreis. Lion: Latent point diffusion models for 3d shape generation. In Advances in Neural Information Processing Systems (NeurIPS), 2022.
|
| 235 |
+
Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, 2018.
|
| 236 |
+
Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206, 2023.
|
| 237 |
+
Linqi Zhou, Yilun Du, and Jiajun Wu. 3d shape generation and completion through point-voxel diffusion. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 5826–5835, 2021.
|
| 238 |
+
|
| 239 |
+
# A APPENDIX
|
| 240 |
+
|
| 241 |
+
# A.1 DIVERSITY OF GENERATION
|
| 242 |
+
|
| 243 |
+
Inheriting the generation capability from the base SDXL model, our method can generate diverse results from the same text prompt by using different random seeds in the feed-forward pass. As shown in Figure 6, our approach excels in generating diverse 3D assets featuring strikingly distinct textures and geometries from the same prompt. This is in contrast to previous SDS-optimization based methods, which are prone to generate similar results even with different initializations (Poole et al., 2022).
|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
Figure 6: Our method can generate diverse results from the same text prompt.
|
| 247 |
+
|
| 248 |
+
# A.2 DATA CURATION DETIALS
|
| 249 |
+
|
| 250 |
+
We apply a quality scorer to curate high-quality data from the Objaverse dataset. To train the quality scorer, we first randomly sample 2000 3D objects from the dataset and manually label each 3D asset as good or bad. Good assets have realistic textures and complex geometry, while bad ones have simple shapes and flat or cartoon-like textures. This criterion is subjective and imprecise, but we found it good enough for the purpose of data filtering.
|
| 251 |
+
|
| 252 |
+
Since the amount of annotated data is limited, we use a pretrained CLIP (Radford et al., 2021) model to extract high-level image features of rendered images at 5 randomly sampled camera viewpoints for each object. Then we train a simple binary SVM classifier on top of the averaged CLIP features over different views. We use the $\mathrm { N u S V C }$ implementation from the popular scikit-learn framework Pedregosa et al. (2011), which also gives us a probability estimation of the classification. We use the trained SVM model to predict the classification probability for all objects in the dataset by extracting CLIP features in the same way as done for the training data. These probabilities are used as scores to rank the data from high to low quality. Finally, we use the top 10K objects as our fine-tuning data.
|
| 253 |
+
|
| 254 |
+
To render the 4-view data, we scale the curated objects and center them at a cube $[ - 1 , 1 ] ^ { 3 }$ . We render the objects with a white background following the structured setup discussed in Section 3.1 using a field of view $5 0 ^ { \circ }$ at a distance of 2.7 under uniform lighting. We use the physically-based path tracer Cycles in Blender for rendering.
|
| 255 |
+
|
| 256 |
+
In Figure 7 we show qualitative comparisons on results from models trained with curated data and random data. Models trained with random data tend to generate cartoon-like 3D assets with simple and flat textures. This is not surprising since a bulk of the Objaverse dataset contains simple shapes with simple textures, and without curation these data will guide the model to over-denoise the results, leading to large areas of flat colors. On the contrary, models trained with curated data tend to generate more photorealistic assets with complex textures and geometries.
|
| 257 |
+
|
| 258 |
+
# A.3 SDXL FINE-TUNING DETAILS
|
| 259 |
+
|
| 260 |
+
We use SDXL as the base model for our first-stage fine-tuning. We use AdamW optimizer with a fixed learning rate $1 0 ^ { - 5 }$ , $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 9 9$ and a weight decay of $1 0 ^ { - 2 }$ . We fine-tune the model using fp16 on 32 NVIDIA A100 GPUs with a total batch size of 192. No gradient accumulation is used. We train the model on 10K curated data for 40K steps, which takes around 3 hours.
|
| 261 |
+
|
| 262 |
+
We train the model with the standard denoising diffusion loss (Ho et al., 2020)
|
| 263 |
+
|
| 264 |
+
$$
|
| 265 |
+
L ( \pmb \theta ) = \mathbb { E } _ { t , \pmb { x } _ { 0 } , \epsilon } \big [ \| \epsilon - \epsilon _ { \theta } ( \sqrt { \overline { { \alpha } } _ { t } } \pmb x _ { 0 } + \sqrt { 1 - \overline { { \alpha } } _ { t } } \epsilon , t ) \| ^ { 2 } \big ]
|
| 266 |
+
$$
|
| 267 |
+
|
| 268 |
+
where $\epsilon _ { \theta }$ is the denoising U-Net and $\pmb { \theta }$ are the trainable parameters.
|
| 269 |
+
|
| 270 |
+
SDXL introduces image resolution and aspect ratio conditioning that allow mixing training on images of different resolutions and aspect ratios. As for our training data, we render 4 views each with a resolution of $5 1 2 \times 5 1 2$ and assemble them into a $1 0 2 4 \times 1 0 2 4$ image. Therefore we fix the resolution and aspect ratio conditioning to be (1024, 1024) throughout the fine-tuning procedure. We don’t do random cropping in our training and fixed the crop conditioning to be $( 0 , 0 )$ . All the other training setups are identical to the original SDXL.
|
| 271 |
+
|
| 272 |
+
Table 4: Ablation study of the sparse-view reconstruction model.
|
| 273 |
+
|
| 274 |
+
<table><tr><td></td><td>#Layers</td><td>Render</td><td>Supervision</td><td>PSNR↑</td><td>SSIM↑</td><td>LPIPS↓</td></tr><tr><td>exp01</td><td>6</td><td>64</td><td>All</td><td>23.6551</td><td>0.8616</td><td>0.1281</td></tr><tr><td>exp02</td><td>12</td><td>64</td><td>All</td><td>23.8257</td><td>0.8631</td><td>0.1266</td></tr><tr><td>exp03</td><td>24</td><td>64</td><td>All</td><td>23.8351</td><td>0.8635</td><td>0.1258</td></tr><tr><td>exp04</td><td>12</td><td>32</td><td>All</td><td>23.1704</td><td>0.8561</td><td>0.1358</td></tr><tr><td>exp05</td><td>12</td><td>64</td><td>w/o novel</td><td>18.2359</td><td>0.8103</td><td>0.2256</td></tr><tr><td>exp06</td><td>12</td><td>64</td><td>w/o LPIPS</td><td>24.1699</td><td>0.8641</td><td>0.1934</td></tr></table>
|
| 275 |
+
|
| 276 |
+
# A.4 SD1.5 FINE-TUNING DETAILS
|
| 277 |
+
|
| 278 |
+
We use 8 A100 GPUs for fine-tuning SD1.5 on 100K data with a total batch size of 64. We use the same AdamW optimizer as the one for SDXL with the same hyper-parameters. We also use gradient accumulation of 3 steps, which gives an effective batch size of 192. The training loss is the same as SDXL. We train the model for 120K steps (40K parameter updates due to gradient accumulation), which takes roughly 33 hours.
|
| 279 |
+
|
| 280 |
+
# A.5 GAUSSIAN BLOBS INITIALIZATION
|
| 281 |
+
|
| 282 |
+
Since the diffusion model is fine-tuned with only a relatively small number of steps, it still largely possesses the original denoising behavior on images that are not in the form of $2 \times 2$ grids and do not have a white background. Naively applying the standard backward denoising process starting from random Gaussian noise will likely lead to results far from the distribution of the fine-tuning data (see Figure 5).
|
| 283 |
+
|
| 284 |
+
The spatial structure of the training images is simple: four views of the same object are placed at the center of each quadrant. Also, the background is always white. Since the model is fine-tuned on such data with a denoising objective, it is natural that, when presented with a noisy input whose underlying clean image has these two characteristics, the model will tend to denoise the image to a clean one where the four-quadrant objects are view consistent. Following this, and inspired by SDEdit Meng et al. (2022), we introduce Gaussian blobs initialization to guide the model toward generating samples consistent with the distribution of the fine-tuning data.
|
| 285 |
+
|
| 286 |
+
The standard latent diffusion inference starts with a Gaussian noise image $\epsilon$ with the same size as the image latents. Instead, we modify the initial iteration to be a composition of Gaussian noise and an image with the two aforementioned characteristics: object quadrants and white background. We construct such an image by generating a grayscale image with a clean white background and a black Gaussian blob at the center. Specifically, we construct a $H \times W$ grayscale image $I$ , where $H$ and $W$ are the height and width of the input RGB image with a value range $[ 0 , 1 ]$ . For all our models $H = W$ , and we denote them using $S$ . For a given pixel $( x , y )$ , its pixel value is computed as
|
| 287 |
+
|
| 288 |
+
$$
|
| 289 |
+
I ( x , y ) = 1 - \exp \bigg ( - \frac { ( x - S / 2 ) ^ { 2 } + ( y - S / 2 ) ^ { 2 } } { 2 \sigma ^ { 2 } S ^ { 2 } } \bigg )
|
| 290 |
+
$$
|
| 291 |
+
|
| 292 |
+
where $\sigma$ is a hyper-parameter controlling the width of the Gaussian blob. Such an image looks like a black disc at the center of a white image slowly fading away toward the edges of the image. We then assemble four such images into a $2 \times 2$ image grid. Some examples of such images with different $\sigma$ can be seen at the first row of figure 5.
|
| 293 |
+
|
| 294 |
+
Next we construct the initial noise for the denoising step by blending a complete Gaussian noise latent with the latent of the Gaussian blobs. We denote the latent of the Gaussian blobs image $I$ as $\tilde { I }$ , and the latent of a noise image with i.i.d. Gaussian values as $\epsilon$ . For a $N$ step denoising inference process with timesteps $\{ t _ { N } , t _ { N - 1 } , . . . , t _ { 0 } \}$ , we mix the two latents with a weighted sum
|
| 295 |
+
|
| 296 |
+
$$
|
| 297 |
+
\epsilon _ { t _ { N } } = \sqrt { \overline { { \alpha } } _ { t _ { N } } } \tilde { I } + \sqrt { 1 - \overline { { \alpha } } _ { t _ { N } } } \epsilon
|
| 298 |
+
$$
|
| 299 |
+
|
| 300 |
+
Then $\epsilon _ { t _ { N } }$ is used as the initial noise of the denoising process, e.g., $t _ { N }$ is 980 for a denoising step with 50 (and the total number of timesteps is 1000).
|
| 301 |
+
|
| 302 |
+
# A.6 SPARSE-VIEW RECONSTRUCTION DETAILS
|
| 303 |
+
|
| 304 |
+
Model details We use the DINO-ViT-B/16 as our image encoder. This model is transformerbased, which has 12 layers and the hidden dimension of the transformer is 768. The ViT begins with a convolution of kernel size 16, stride 16, and padding 0. It is essentially patchifying the input image with a patch size of $1 6 \times 1 6$ . For our final model, the input image resolution is 512, thus it leads to $3 2 \times 3 2 = 1 0 2 4$ spatial tokens in the vision transformer. In ablation studies, we reduce the input resolution from 512 to 256 to save compute budget. The original DINO is trained with a resolution of $2 2 4 \times 2 2 4$ , thus the positional embedding has only a size of $1 4 \times 1 4 = 1 9 6$ . We thus use 2D bilinear extrapolation (with torch.nn.functional.interpolate function) to extrapolate it to the desired token size.
|
| 305 |
+
|
| 306 |
+
To integrate camera information into the image encoder, we inject modulation layers (Peebles & Xie, 2022) into each of the transformer layer (for both self-attention layers and MLP layers). The modulation layer is initialized to be an identity mapping and thus it is suitable to be added to a pre-trained vision transformer.
|
| 307 |
+
|
| 308 |
+
After the image encoder, we have 1025 image feature tokens for each image, since we also include the output of the [CLS] token. We concatenate the tokens from all four images to construct a sequence of condition features of length 4100. This condition feature will be used to create the keys and values in the cross-attention layers of the image-to-triplane transformer decoder.
|
| 309 |
+
|
| 310 |
+
The image-to-triplane transformer decoder starts with a token sequence of $( 3 \times 3 2 \times 3 2 ) \times 1 0 2 4$ , where $( 3 \times 3 2 \times 3 2 )$ is the number of tokens and 1024 is the hidden dimension of the transformer. We use 16 layers in our transformer decoder. All attention layers have 16 attention heads and each head has a dimension of 64. We remove the bias term in the attention layer as in Touvron et al. (2023). We take the pre-normalization architecture of the transformer where each sub-layer will be in the format of $x + f ( \mathrm { L a y e r N o r m } ( x ) )$ .
|
| 311 |
+
|
| 312 |
+
After the transformer, we apply a de-convolution layer to map the transformer output from $( 3 \times 3 2 \times$ $3 2 ) \times 1 0 2 4$ to $3 \times ( 6 4 \times 6 4 ) \times 8 0$ . It means that there are 3 planes (XY, YZ, XZ) (Chan et al., 2022) and each plane has a size of $6 4 \times 6 4$ . The dimension of each plane is 80. All three planes share the same deconvolution layer. The deconvolution is of kernal size 2, stride 2, and pad 0.
|
| 313 |
+
|
| 314 |
+
In NeRF volumetric rendering, the features from the three planes are bilinearly interpolated and concatenated to get a 240-dimensional feature for each point. Then, we have a 10-layer MLP with a hidden dimension of 64 to map this 240-dim feature to a 4-dim feature. The first three dimensions will be treated as RGB colors of the point and normalized to [0, 1] with a sigmoid function. The last dimension will be treated as the density value and we use an exponential function to map the MLP’s output to be non-negative.
|
| 315 |
+
|
| 316 |
+
For the exact formulation of the above operators, please refer to LRM (Hong et al., 2024) and DiT (Peebles & Xie, 2022).
|
| 317 |
+
|
| 318 |
+
Training details. We adopt the AdamW (Kingma & Ba, 2014; Loshchilov & Hutter, 2017) optimizer to train our model. We use a peak learning rate of $4 \times 1 0 ^ { - 4 }$ with a linear warm-up (on the first 3K steps) and a cosine decay. We change the $\beta _ { 2 }$ of the AdamW optimizer to 0.95 for better stability. We use a weight-decay of 0.05 for non-bias and non-layernorm parameters. We also apply a gradient clipping of 1.
|
| 319 |
+
|
| 320 |
+
For the initialization of the image encoder, we use the official DINO pre-trained weight. For the initialization of the triplane decoder, and NeRF MLP, we use the default initializer in the PyTorch implementation. We empirically found that the pre-normalization transformer is robust to different initialization of linear layers. For the positional embedding of the triplane tokens in the transformer√ decoder, we initialize them with a Gaussian of zero-mean and std of $1 / \sqrt { 1 0 2 4 }$ .
|
| 321 |
+
|
| 322 |
+
For each training step, we randomly sample 4 views as input and another 4 as supervision. The number of sample points per ray in NeRF rendering is 128, which are uniformly distributed along the segment within the $[ - 1 , 1 ] ^ { 3 }$ bounding box. The rendering resolution is $1 2 8 \times 1 2 8$ . To allow higher actual supervising resolution, we first resize the image to a smaller resolution (uniformly sampled from [128, 384]) and then crop a patch of $1 2 8 \times 1 2 8$ from it. Thus we can go beyond the rendering resolution of 128.
|
| 323 |
+
|
| 324 |
+
We utilize flash attention (Dao et al., 2022), mixed-precision training (with bf16 as the half-precision format) (Micikevicius et al., 2018), and gradient checkpointing (Chen et al., 2016) to improve the compute/memory efficiency of the training.
|
| 325 |
+
|
| 326 |
+
We perform the training for 120 epochs on our rendered Objaverse data with a training batch size of 1024. We use both L2 loss and LPIPS loss to supervise the model and the weights of the two losses are 1 and 2 respectively. The model is trained on 128 NVIDIA A100 GPUs and the whole training can be finished in 7 days.
|
| 327 |
+
|
| 328 |
+
# A.7 SPARSE VIEW RECONSTRUCTION ABLATION STUDY
|
| 329 |
+
|
| 330 |
+
We conduct an ablation study of our sparse-view reconstruction model to validate different design choices including the number of layers in the image-to-triplane decoder, the rendering resolution and the losses used during training, and the usage of novel view supervision. We train the model on the same dataset as our final model, however, we change the training recipe to reduce the computation cost to 32 A100 GPUs for 1 day. The changes of configuration for ablation include (1) a resolution of $2 5 6 \times 2 5 6$ for the input image resolution, (2) 96 points per ray during rendering, (3) 5 layers instead of 10 layers in the NeRF MLP, (4) 30 epochs of training.
|
| 331 |
+
|
| 332 |
+
To evaluate the performance of different variants, we test them on another 3D dataset Google Scanned Object (GSO) (Downs et al., 2022). For each object in GSO, we render a set of 64-view images rendered with a resolution of $5 1 2 \times 5 1 2$ at elevations $0 ^ { \circ }$ , $2 0 ^ { \circ }$ , $4 0 ^ { \circ }$ , $6 0 ^ { \circ }$ . Each elevation has 16 views with equidistant azimuths starting from 0. We use 4 views with elevation $2 0 ^ { \circ }$ and azimuths $4 5 ^ { \circ }$ , $1 3 5 ^ { \circ }$ , $2 2 5 ^ { \circ }$ , $3 1 5 ^ { \circ }$ as input, and randomly sample 5 views from the remaining views as our testing set, which stay the same for different variants. We render the 5 testing views and report their difference from the ground truth using 3 metrics including PSNR, SSIM and LPIPS. These metrics are averaged over all 1019 objects in the GSO dataset.
|
| 333 |
+
|
| 334 |
+
The results of the ablation studies are in Figure 4. From the table we can see that the model is robust to the number of transformer layers in the image-to-triplane decoder as shown in exp01, exp02, and exp03. We also observe that the LPIPS loss can largely affect the results by comparing the exp02 and exp06. Without the LPIPS loss, the model drops a lot on the LPIPS metric while getting a slight improvement on PSNR and SSIM. However, we empirically find that LPIPS is much more aligned with human perception and the rendered images become blurry without it. The rendering resolution is also important (as shown in exp04) since LPIPS can be more robust and accurate at a higher resolution, which also motivates us to use a rendering resolution of 128 by 128 when training our final model.
|
| 335 |
+
|
| 336 |
+
Also, the inclusion of novel view supervision in the training is critical as shown in exp05. All three metrics got a significant drop when only supervising the four input views. Upon reviewing the results, we find that it’s due to the insufficient coverage of the four views, which typically leads to floaters in regions not covered by the input views.
|
| 337 |
+
|
| 338 |
+
# A.8 EXTENSION TO IMAGE-CONDITIONED GENERATION
|
| 339 |
+
|
| 340 |
+
Our method can also be extended to support additional image conditioning to provide more finegrained control over the 3D model to be generated. In this process, the input to the model includes an input text prompt that describes the object to be generated as well as an image of the object. We use the same training data as our text-conditioned model. During training, for a randomly sampled time step, we keep the latent of the input image (top-left quadrant) untouched and only add noise to the latents of the remaining three views. This allows the diffusion model to generate the other views while accounting for the conditioning image. During inference, similarly, we replace the upper left quadrant of the latent feature with the latent of the clean conditioning image at each iteration. Figure 8 shows some visual results of our image-conditioned model. From the results we can see that our method is able to effectively generate the other views with faithful details that are coherent with the input text prompt and image, thus giving us high-quality 3D models with our sparse view reconstructor.
|
| 341 |
+
|
| 342 |
+

|
| 343 |
+
Figure 7: Comparisons on novel view renderings of NeRF assets generated from SDXL models finetuned with 10K curated data and random data. We can see that that curated data enables the model to generate more photorealistic 3D assets with more geometric and texture details. Here curated and random correspond to Exp d (Curated-10K-s10K) and i (Random-10K-s10K) in Table 3.
|
| 344 |
+
|
| 345 |
+
# A.9 LIMITATIONS
|
| 346 |
+
|
| 347 |
+
While our model can generate high-quality and diverse 3D assets, it still suffers from several limitations. First, while we perform a light-weight fine-tuning that enables the model to mostly preserve the capability of the SDXL model in textual understanding and generation, we do observe that our model fails to handle some over-complicated prompts, for example, those related to complex spatial arrangements of multiple subjects and complex scenes (see Figure 15). In addition, the generated assets are not as photorealistic as the 2D images generated by the original SDXL, which may be attributed to the information loss in the fine-tuning stage. Secondly, there is a lack of 3D inductive bias when generating multi-view images, and therefore it’s still possible for our model to generate inconsistent images that result in low-quality 3D assets with corrupted geometries and textures. Finally, our feed-forward reconstructor tends to generate blurry textures compared to the input images due to the usage of a relatively low-resolution triplane.
|
| 348 |
+
|
| 349 |
+

|
| 350 |
+
Figure 8: Comparison to previous methods on single image-conditioned 3D generation. We compared to previous methods Zero-1-to-3 (Liu et al., 2023b) and One-2-3-45 (Liu et al., 2023a). Our method can faithfully generate the details in the invisible regions, thus empowering us to reconstruct 3D assets of higher quality than baseline methods. All input images are generated with a public text-to-image platform Adobe Firefly (Adobe, 2023).
|
| 351 |
+
|
| 352 |
+

|
| 353 |
+
Figure 9: $2 \times 2$ grid images generated with Gaussian blobs of different sigma $\sigma$
|
| 354 |
+
|
| 355 |
+

|
| 356 |
+
a cute dragon with big eyes
|
| 357 |
+
Figure 10: Comparison on the NeRF assets generated with different numbers of DDIM steps and their inference time. While we use 100 steps in our experiments that take 20 seconds to generate a NeRF asset, we find that using a smaller number of steps can also give us results of similar quality with a much shorter inference time.
|
| 358 |
+
|
| 359 |
+

|
| 360 |
+
a red-eyed tree frog
|
| 361 |
+
Figure 11: SDS optimization-based methods such as ProlificDreamer (Wang et al., 2023b) can possibly suffer from the Janus problem, which greatly degrades the quality of the 3D assets. In contrast, our method can mostly get rid of this problem.
|
| 362 |
+
|
| 363 |
+

|
| 364 |
+
Figure 12: Comparisons on the quality of the NeRF assets generated with fine-tuned SDXL and SD1.5 models. SDXL has a model size that is three times larger than SD1.5 and thus has better text comprehension. As shown in the figure, the 3D assets generated by our fine-tuned SDXL have better photo-realism and text alignment. The used SDXL and SD1.5 models are from Exp d (Curated-10Ks10K) and m (Curated-100K-s40K) in Table 3.
|
| 365 |
+
|
| 366 |
+

|
| 367 |
+
Figure 13: Comparison on the effect of different fine-tuning data sizes. Training on too little data such as 1K results in inconsistency between the generated 4 views, thus resulting in incorrect geometry. On the other side, training on too much data such as 100K makes the model biased toward the fine-tuning dataset, thus negatively affecting the quality of generated 3D assets. Here 1K, 10K and 100K correspond to Exp a (Curated-1K-s1K), d (Curated-10K-s10K) and g (Curated-100K-s40K) in Table 3 respectively.
|
| 368 |
+
|
| 369 |
+

|
| 370 |
+
Figure 14: Comparison on different numbers of fine-tuning steps. 4K training steps lead to inconsistent 4-view generation, while 20K result in biasing towards the fine-tuning data. In contrast, 10K achieve a balance between these two. Here 4K, 10K and 20K correspond to Exp c (Curated-10Ks4K), d(Curated-10K-s10K) and e (Curated-10K-s20K) in Table 3.
|
| 371 |
+
|
| 372 |
+

|
| 373 |
+
Figure 15: Some examples of our failure cases. (a) Incorrect understanding of compositional concepts. (b) Inability to generate the exact quantity. (c) Fail to generate objects with complex structures. (d) Missing important concepts in the prompt.
|
md/test/2msbbX3ydD/2msbbX3ydD.md
ADDED
|
@@ -0,0 +1,583 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FERRET: REFER AND GROUND ANYTHING ANY-WHERE AT ANY GRANULARITY
|
| 2 |
+
|
| 3 |
+
Haoxuan $\mathbf { V o u } ^ { 1 \dagger }$ , Haotian Zhang2†, Zhe $\mathbf { G a n } ^ { 2 }$ , Xianzhi $\mathbf { D } \mathbf { u } ^ { 2 }$ , Bowen Zhang2, Zirui Wang2, Liangliang $\mathbf { C a o } ^ { 2 }$ , Shih-Fu Chang1, Yinfei Yang2
|
| 4 |
+
1Columbia University, 2Apple AI/ML
|
| 5 |
+
haoxuan.you@cs.columbia.edu, {haotian zhang2,zhe.gan,yinfeiy}@apple.com
|
| 6 |
+
|
| 7 |
+

|
| 8 |
+
Figure 1: Ferret enables referring and grounding capabilities for multimodal large language model (LLM). In terms of referring, a user can refer to a region or an object in point, box, or any free-form shape. The regionN in the input will be replaced by the proposed hybrid representation before being fed into the LLM. In terms of grounding, Ferret is able to accurately ground any open-vocabulary descriptions. The boxN in the output denotes the predicted bounding box coordinates.
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
We introduce Ferret, a new Multimodal Large Language Model (MLLM) capable of understanding spatial referring of any shape or granularity within an image and accurately grounding open-vocabulary descriptions. To unify referring and grounding in the LLM paradigm, Ferret employs a novel and powerful hybrid region representation that integrates discrete coordinates and continuous features jointly to represent a region in the image. To extract the continuous features of versatile regions, we propose a spatial-aware visual sampler, adept at handling varying sparsity across different shapes. Consequently, Ferret can accept diverse region inputs, such as points, bounding boxes, and free-form shapes. To bolster the desired capability of Ferret, we curate GRIT, a comprehensive referand-ground instruction tuning dataset including 1.1M samples that contain rich hierarchical spatial knowledge, with 95K hard negative data to promote model robustness. The resulting model not only achieves superior performance in classical referring and grounding tasks, but also greatly outperforms existing MLLMs in region-based and localization-demanded multimodal chatting. Our evaluations also reveal a significantly improved capability of describing image details and a remarkable alleviation in object hallucination. Code and data are available at https://github.com/apple/ml-ferret.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
In vision-language learning, how to enable spatial understanding in models is a fundamental research problem. Two desired capabilities stem from this problem: referring and grounding. Referring demands that the model can accurately comprehend the semantics of specific given regions (Krahmer & Van Deemter, 2012; Kazemzadeh et al., 2014; Mao et al., 2016; Yu et al., 2016; Zellers et al., 2019), whereas grounding necessitates that the model to localize the region in accordance with the given semantic description (Luo & Shakhnarovich, 2017; Nagaraja et al., 2016; Yu et al., 2017; Kamath et al., 2021).
|
| 17 |
+
|
| 18 |
+
Essentially, referring and grounding demand the same type of knowledge: alignment of spatial information and semantics. Despite this, existing works mostly learn referring and grounding individually (Li et al., 2022; Wu et al., 2022; Yu et al., 2017). In comparison, humans can learn from one task and generalize the shared knowledge to the other task effortlessly, and are able to seamlessly integrate referring/grounding capabilities with daily dialogue and reasoning (Zellers et al., 2019). Inspired by the above gap, in this paper, we study three main questions: (i) How to unify referring and grounding in one framework, and will they benefit each other? (ii) How to represent versatile types of regions that humans usually use for referring, such as point, box, scribble, and even freeform shapes? (iii) How to make referring and grounding open-vocabulary, instruction-following, and robust, which are crucial for practical applications?
|
| 19 |
+
|
| 20 |
+
Targeting these three questions, we introduce Ferret, a novel refer-and-ground Multimodal Large Language Model (MLLM). First of all, we choose MLLM as the bedrock of Ferret to leverage their powerful vision-language global understanding capability (Zhu et al., 2023a; Liu et al., 2023b; Li et al., 2023c). To unify referring and grounding, Ferret first represents the coordinates of regions in natural language numerical form,1 as illustrated in Figure 3. However, it is inefficient to use single point or box coordinates to represent versatile shapes of regions, such as strokes, scribbles, or complex polygons. These shapes are essential for more universal and precise human-model interaction. To solve this problem, we further propose a spatial-aware visual sampler to acquire the visual features for regions in any shape, taking care of the varying sparsity in those shapes. Then, the discrete coordinates and the continuous visual features are combined together to represent the visual regions in the input, composing a hybrid region representation in Ferret. Equipped with above methods, Ferret can deal with input that mixes referred regions with free-form text, and is able to ground the mentioned objects in its output by seamlessly generating the coordinates for each groundable object along with generating text. To our best knowledge, Ferret is the first work that is able to process free-formed region inputs in MLLMs.
|
| 21 |
+
|
| 22 |
+
In order to make the refer-and-ground capability in Ferret open-vocabulary, instruction-following, and robust, we collect GRIT, a Ground-and-Refer Instruction-Tuning dataset with 1.1M samples. GRIT contains multiple levels of spatial knowledge, covering objects, relationships, region descriptions, and complex reasoning. It includes both text-in location-out (grounding) and location-in textout (referring) data, as well as data that mixes location and text in both input and output. The majority of the dataset is converted from existing vision(-language) tasks like object detection (Krishna et al., 2017) and phrase grounding (Yu et al., 2016; Plummer et al., 2015) with carefully designed templates to make it instruction-following. Additionally, 34K refer-and-ground instruction-tuning conversations are collected via the help of ChatGPT/GPT-4 (OpenAI, 2023b) to facilitate training an instruction-following and open-vocabulary refer-and-ground generalist. Moreover, we conduct spatial-aware negative data mining, which further promotes model robustness.
|
| 23 |
+
|
| 24 |
+
Ferret subsumes strong open-vocabulary capabilities of spatial understanding and localization. When evaluated on conventional referring and grounding tasks, it achieves superior performance. More than that, we believe refer-and-ground capabilities should be integrated into daily conversations of humans, e.g., people refer to something they don’t know and ask what it is used for (like Figure 1). To evaluate this new capability, we introduce Ferret-Bench, covering three new types of tasks: Referring Description, Referring Reasoning, and Grounding in Conversation. We benchmark existing MLLMs and observe that Ferret can outperform the best of them by $2 0 . 4 \%$ on average. Moreover, Ferret demonstrates an intriguing property of alleviating object hallucinations.
|
| 25 |
+
|
| 26 |
+
In summary, our contributions are threefold. (i) We propose Ferret, that uses a hybrid region representation equipped with a novel spatial-aware visual sampler, to enable fine-grained and openvocabulary referring and grounding in MLLM. (ii) We construct GRIT, a large-scale ground-andrefer instruction tuning dataset, for model training. It also contains additional spatial negative samples to enhance model robustness. (iii) We introduce Ferret-Bench, to evaluate tasks jointly requiring referring/grounding, semantics, knowledge, and reasoning. Our model exhibits superior performance in a wide range of tasks and reduces object hallucination.
|
| 27 |
+
|
| 28 |
+
# 2 METHOD
|
| 29 |
+
|
| 30 |
+
We start with detailing the proposed hybrid region representation to depict regions of various shapes and formats. Then, we present the model architecture of Ferret.
|
| 31 |
+
|
| 32 |
+
# 2.1 HYBRID REGION REPRESENTATION
|
| 33 |
+
|
| 34 |
+
When referring to specific regions, three primary formats are generally used: point, box, and free-form shapes. While the point and box formats can be succinctly represented by coordinates (e.g., $[ x , y ]$ for a point, and $[ x _ { \mathrm { m i n } } , y _ { \mathrm { m i n } } , x _ { \mathrm { m a x } } , y _ { \mathrm { m a x } } ]$ for a box) as in Peng et al. (2023); Chen et al. (2023b), the free-form shape is more versatile, encompassing a variety of region types such as scribbles, polygons, and masks. The advantage of free-form shape is straightforwardly illustrated in Figure 2. Depicting free-form shapes through coordinates is computationally expensive and obscure, and its complexity hinders the model learning to establish a clear correlation between the provided coordinates and the corresponding regions.
|
| 35 |
+
|
| 36 |
+
To generalize across all three distinct formats, we propose a hybrid region representation that synergizes discrete coordinates with continuous visual features to refer to a particular region, which is shown in the top-left of Figure 3. For coordinates, following Chen et al. (2021); Yang et al. (2022), we quantize each coordinate into one of the $n _ { \mathrm { b i n s } }$ discrete bins.2 Regarding continuous visual features, for a given region $\mathbf { R }$ , we first construct a 2D binary mask M of the same size as the image, marking a value of 1 inside the targeted region and 0 outside of the region. Then, the binary mask M, jointly with the extracted image feature map $\mathbf { Z }$ , is sent into our proposed spatial-aware visual sampler $s ( \cdot )$ , which will be detailed in Section 2.2, to extract the visual continuous feature $\mathbf { f } = s ( \mathbf { M } , \mathbf { Z } )$ .
|
| 37 |
+
|
| 38 |
+

|
| 39 |
+
Figure 2: Bounding box v.s. Free-from Shape. These two objects have almost the same bounding box, causing ambiguity when relying on the box to refer to. Equipped with hybrid region representation, Ferret can separate them.
|
| 40 |
+
|
| 41 |
+
Finally, we represent a point with $\{ x , y , \mathbf { f } _ { R _ { p } } \}$ , where the region $R _ { p }$ is a circle centered in $\{ x , y \}$ with a fixed radius.3 A box or a free-form shape can both be represented by $\{ x _ { \mathrm { m i n } } , y _ { \mathrm { m i n } } , x _ { \mathrm { m a x } } , y _ { \mathrm { m a x } } , \mathbf { f } _ { R _ { b o x } } \}$ , where ${ x _ { \operatorname* { m i n } } } / { x _ { \operatorname* { m a x } } }$ denotes the minimum/maximum $x$ -axis coordinate of the region, and so forth for $y$ -axis. $R _ { b o x }$ denotes the input region.
|
| 42 |
+
|
| 43 |
+
# 2.2 MODEL ARCHITECTURE
|
| 44 |
+
|
| 45 |
+
As illustrated in Figure 3, Ferret is mainly composed of $( i )$ an image encoder to extract image embeddings, $( i i )$ the proposed spatial-aware visual sampler to extract regional continuous features, and $( i i i )$ an LLM to jointly model image, text, and region features.
|
| 46 |
+
|
| 47 |
+
Input. We feed the image into a pre-trained visual encoder, CLIP-ViT-L/14 (Radford et al., 2021), to extract the image embeddings $\mathbf { \dot { Z } } \in \mathbb { R } ^ { H \times W \times C }$ . For text, we tokenize the text sequence using the pre-trained LLM’s tokenizer and project them into text embeddings $\mathbf { T } \in \mathbb { R } ^ { L \times D }$ . As for referred regions, we append the coordinates and a special token as a placeholder for continuous features after the name of the region: “⟨region name⟩ ⟨coordinates⟩ $\langle { \mathrm { S P E } } \rangle ^ { \mathrm { , , } }$ . For example, “a cat [100, 50, 200, 300] $\langle \mathrm { S P E } \rangle ^ { \mathrm { , , } }$ . If the name is unknown or hard to describe because multiple objects are included, we just use “region” or “area” as the “⟨region name⟩”. In this way, referred regions can be well mixed with ordinary texts to form complete sentences.
|
| 48 |
+
|
| 49 |
+

|
| 50 |
+
Figure 3: Overview of the proposed Ferret model architecture. (Left) The proposed hybrid region representation and spatial-aware visual sampler. (Right) Overall model architecture. All parameters besides the image encoder are trainable.
|
| 51 |
+
|
| 52 |
+
Spatial-aware Visual Sampler. The shape of the referred regions can be quite varied, not limited to just points or rectangle boxes. Grid-based processing like convolution or patch attention cannot handle irregular shapes. Similar to our cases, 3D point clouds are also in irregular shape and show varied sparsity in the 3D space. Inspired by existing works in 3D point cloud learning (Qi et al., 2017a; Ma et al., 2022; Wang et al., 2019), we propose a spatial-aware visual sampler.
|
| 53 |
+
|
| 54 |
+
Given extracted image feature map $\mathbf { Z } \in \mathbb { R } ^ { H \times W \times C }$ and the binary region mask M, we first randomly sample $N$ positive points inside M. For each point, its feature is obtained by bilinear interpolation. The $N$ points are fed into a cascade of blocks, where each of them includes three steps: sampling, gathering, pooling. (1) Sampling: $\textstyle { \frac { N } { r } }$ points are sampled from $N$ points via farthest point sampling (FPS) algorithm (Qi et al., 2017b),4 which can guarantee sufficient coverage. (2) Gathering: For each of the sampled points $x _ { i }$ , we search its $k$ nearest neighbors from the pool of previous $N$ points, and obtain a group of points $\{ x _ { i 1 } , x _ { i 2 } , . . . , x _ { i k } \}$ . Then, inspired by PointMLP (Ma et al., 2022), for each group, we fuse the features of sampled point $x _ { i }$ and it neighbor points by:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
h _ { i k } = \sigma ( [ \theta ( [ \mathbf { Z } ( x _ { i k } ) - \mathbf { Z } ( x _ { i } ) ; C ( x _ { i k } ) - C ( x _ { i } ) ] ) ; \mathbf { Z } ( x _ { i } ) ; C ( x _ { i } ) ] ) ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $x _ { i k }$ is one of the neighbors of $x _ { i }$ , $\mathbf { Z } ( x )$ denotes the point $x$ ’s feature (in the first block, it is interpolated from feature map $\mathbf { Z }$ ; in the succeeding blocks, it is the output feature from the previous block), $C ( x )$ denotes the 2D coordinates of point $x , [ ; ]$ means channel-wise concatenation of multiple vectors, $\theta$ is implemented by a linear layer to adapt the relative local features, and $\sigma$ is also a linear layer to fuse each local feature from neighbors with sampled point feature. (3) Pooling: A max pooling is conducted to fuse $k$ neighbor features into one feature as the representation of the sampled point:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
h _ { i } = \operatorname* { m a x } _ { k : ( x _ { i k } ) \in \mathrm { K N N s o f } x _ { i } } h _ { i k } .
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
After the three steps, we obtain fewer points but a more dense feature space since it incorporates the local neighbor features as well as their relative positions. In experiments, we set $N { = } 5 1 2$ , $r { = } 4$ and $k { = } 2 4$ , and cascade two such blocks, which in the end outputs 32 points with their features. Similar to ROIAlign (He et al., 2017), we flatten the point features into a single vector and project it to the dimension of LLM embeddings. The final feature is used to replace the $\langle { \mathrm { S P E } } \rangle$ token in the input.
|
| 67 |
+
|
| 68 |
+
Output. The above region denotations are used in Ferret input to refer to specific regions. In Ferret output, to achieve grounding, we generate the box coordinates right after the corresponding regions/nouns in the text response. For instance, “There is a dog [100, 150, 300, 200] in the figure.” With this data format, our model is expected to implicitly learn what is groundable in the current image and what their locations are.
|
| 69 |
+
|
| 70 |
+
LLM. We consider Vicuna (Chiang et al., 2023) as our language model, a decoder-only LLM (Brown et al., 2020) that is instruction-tuned on top of LLaMA (Touvron et al., 2023a). Prior to being fed into the LLM, the image embeddings undergo transformation via an additional linear layer to match the embedding dimension of the text tokens.
|
| 71 |
+
|
| 72 |
+
4FPS starts from a random single point sampled from $N$ points. In each iteration, it samples one point from the rest points such that it is the farthest from the set of already sampled points. See detail in Qi et al. (2017b).
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 4: Overview of the GRIT dataset for Ferret model training. It contains three types of data: (i) public datasets that are converted into an instruction-following format (the top-3 rows); $( i i )$ data generated via prompting ChatGPT and GPT-4 (the 4th row); and (iii) negative data to enhance model robustness (the last row).
|
| 76 |
+
|
| 77 |
+
# 3 GRIT: GROUND-AND-REFER INSTRUCTION-TUNING DATASET
|
| 78 |
+
|
| 79 |
+
In this section, we present GRIT, a Ground-and-Refer Instruction-Tuning dataset containing around 1.1M multimodal dialogues for model training. GRIT consists of three types of data: (i) public datasets that are converted into an instruction-following format (Section 3.1); (ii) instruction-tuning data generated via ChatGPT and GPT-4 (Section 3.2); and (iii) additional data from spatial negative mining for enhancing model robustness (Section 3.3).
|
| 80 |
+
|
| 81 |
+
# 3.1 HIERARCHY
|
| 82 |
+
|
| 83 |
+
Spatial understanding can be characterized by varying levels of granularity and task formats. During our dataset creation, we look into the following categories based on two dimensions:
|
| 84 |
+
|
| 85 |
+
• In terms of granularity, we identify four main categories: $( i )$ individual objects, (ii) relationships among objects, (iii) descriptions of specific regions, and $( i v )$ region-based complex reasoning. • In terms of task format, we further divide the data into three distinct types: (i) Region-in Text-out data, (ii) Text-in Region-out data, and (iii) Text-Region combined data.5
|
| 86 |
+
|
| 87 |
+
We compiled an extensive set of public data focusing on the aforementioned dimensions and converted them into an instruction-following format using carefully designed templates. A more indepth view of these templates is available in Appendix C.1.
|
| 88 |
+
|
| 89 |
+
Individual objects. To achieve visual understanding at the object level, we select object detection datasets such as Visual Genome (Krishna et al., 2017), Object365 (Shao et al., 2019), and visual grounding datasets including RefCOCOs (Yu et al., 2016; Lin et al., 2014; Nagaraja et al., 2016) and Flickr30k-Entities (Plummer et al., 2015). The converted Visual Genome object data follow a Region-in Text-out format. Additionally, to enable Ferret to understand free-form shapes, we apply SAM (Kirillov et al., 2023) to Visual Genome object data to obtain a segmentation mask for each object, which is fed into the spatial-aware visual sampler to extract continuous region feature during training. The visual grounding datasets and Object365 data adhere to a Text-in Region-out format. This section has in total 678k data.
|
| 90 |
+
|
| 91 |
+
Relationships among objects & descriptions of regions. We selected data pertaining to object relationships and region captions from Visual Genome (Krishna et al., 2017) to address these two facets, respectively. Both datasets employ a Region-in Text-out format and 177k data are obtained. Similar to Visual Genome object data, we also extract segmentation masks of objects in Visual Genome relationship data via SAM.
|
| 92 |
+
|
| 93 |
+
Region-based complex reasoning. Regarding complex reasoning centered on specific regions, we constructed a novel dataset with the help of ChatGPT/GPT-4. It adopts a combined Text-Region format, and is detailed in the subsequent section.
|
| 94 |
+
|
| 95 |
+
# 3.2 GPT-ASSISTED VISUAL INSTRUCTION DATA GENERATION
|
| 96 |
+
|
| 97 |
+
Besides converting existing datasets by templates, dialogue instruction tuning data is proved to be critical for MLLM to understand human intention and generate fluent, natural, and long-form responses (Liu et al., 2023b; Zhu et al., 2023a; Li et al., 2023d). Few-shot prompting is widely used to obtain visual instruction tuning data, where textual scene descriptions of images and humanannotated dialogues are provided as few-shot demonstrations, and ChatGPT/GPT4 are prompted to generate new dialogue based on the new image’s textual scene descriptions.
|
| 98 |
+
|
| 99 |
+
However, previous instruction tuning data mainly focus on describing the entire image without explicitly specifying spatial-related information. To collect refer-and-ground instruction tuning data, we emphasize region-based spatial knowledge in the following three steps. (i) Besides objects and global captions usually used as before, our symbolic scene description additionally includes physical relationships between objects and region captions along with coordinates of them. (ii) In humanannotated dialogues, we add coordinates after the groundable regions or objects either in input or output or both, and the dialogues are typically focused on specific regions. It helps to implicitly prompt ChatGPT/GPT4 to follow similar patterns when generating new dialogues. (iii) The generated dialogues sometimes cannot follow the rules and patterns we wrote in system prompts and few-shot examples, which might be due to that the context of LLM input is too long to handle all the details. To alleviate it, we propose to use ChatGPT/GPT-4 again to refine the initially generated dialogues, whose context length is only $10 \%$ of the data generated from the first round on average. To save cost, we use ChatGPT in the first round of generation and GPT-4 for refining. 34k dialogues in total are collected.
|
| 100 |
+
|
| 101 |
+
Additionally, to exploit existing instruction-tuning data such as those in LLaVA (Liu et al., 2023b), we apply an open-vocabulary object detector, GLIPv2 (Zhang et al., 2022), on LLaVA-158k data to localize groundable nouns in the text. Then, we append the bounding boxes after the corresponding nouns, forming a pseudo-grounded LLaVA instruction data that are also used for training Ferret.
|
| 102 |
+
|
| 103 |
+
# 3.3 SPATIAL NEGATIVE MINING
|
| 104 |
+
|
| 105 |
+
As highlighted in prior studies (Li et al., 2023e; Liu et al., 2023a), MLLM exhibits a propensity to hallucinate in response to yes/no questions. We observed a similar occurrence when inquiring about detailed regions. To address this, we also conduct negative sample mining by following two ways: (i) Image-conditioned Category Localization, and (ii) Semantics-conditioned Category Localization. They both ask the model to localize specific object categories, thereby enabling the model’s ability to discern and potentially recognize the absence of certain objects. They differ in how to select the negative category. For (i), Object365 data are employed and we randomly select the object class from the vocabulary that is not shown in the given image. For (ii), Flickr30k data are used and negative categories are sourced by utilizing ChatGPT/GPT4 to find entities that are most analogous to the original class, attribute, or quantity, e.g., ‘man’ vs. ‘woman’, ‘blue’ vs. ‘yellow’, ‘two’ vs. ‘three’.
|
| 106 |
+
|
| 107 |
+
We curate the data to maintain an equilibrium between positive and negative samples for each of the two types.6 95k data are collected. A more comprehensive elaboration is provided in Appendix C.2.
|
| 108 |
+
|
| 109 |
+
# 4 EXPERIMENTS
|
| 110 |
+
|
| 111 |
+
First of all, we illustrate the training details of Ferret. Then in evaluation, we start with evaluating Ferret on conventional referring and grounding benchmarks (Sec. 4.1 and 4.2). Then, we demonstrate the power of Ferret in more complex multimodal chatting with refer-and-ground capability in Sec. 4.3. For a detailed visualization of each, kindly check Appendix E. We further ablate key components in Ferret (Sec. 4.4), analyze the object hallucination of Ferret (Sec. 4.5) and discuss Ferret v.s. GPT-4V (Sec. ??).
|
| 112 |
+
|
| 113 |
+
Table 1: Results of referring object classification on three different referring types, including point, box, and free-form shape. $\mathbf { \vec { \mathbf { \rho } } } \mathbf { \times } \mathbf { \vec { \mathbf { \rho } } }$ means no such capability.
|
| 114 |
+
|
| 115 |
+
<table><tr><td rowspan="2">Models</td><td colspan="3">LVIS (Acc %)</td></tr><tr><td>Point</td><td>Box</td><td>Free-form</td></tr><tr><td>Random Guess</td><td>50</td><td>50</td><td>50</td></tr><tr><td>LLaVA</td><td>50.1</td><td>50.3</td><td>×</td></tr><tr><td>Kosmos-2 (Peng et al.,2023)</td><td>×</td><td>60.25</td><td>×</td></tr><tr><td>Shikra-7B(Chen et al.,2023b)</td><td></td><td>57.82 67.71</td><td>×</td></tr><tr><td>GPT4-ROI (Zhang et al.,2023)</td><td>×</td><td>61.76</td><td>×</td></tr><tr><td>Ferret-7B</td><td></td><td>67.9479.42</td><td>69.77</td></tr><tr><td>Ferret-13B</td><td></td><td>68.3580.46</td><td>70.98</td></tr></table>
|
| 116 |
+
|
| 117 |
+
Table 2: Results of grounded image captioning on the test set of Flickr30k Entities. BLEU $@ 4$ , METEOR, CIDEr, and SPICE are used for the caption evaluation. $F 1 _ { a l l }$ and $F 1 _ { l o c }$ are used for grounding evaluation. $" - "$ means not reported.
|
| 118 |
+
|
| 119 |
+
<table><tr><td rowspan="2">Models</td><td colspan="4">Caption Eval.</td><td colspan="2">Grounding Eval.</td></tr><tr><td>B@4</td><td>M</td><td>C</td><td>S</td><td>F1all</td><td>F1loc</td></tr><tr><td>GVD (Zhou et al.,2019)</td><td></td><td></td><td>27.3 22.5 62.3 16.5</td><td></td><td>7.55</td><td>22.2</td></tr><tr><td>Cyclical (Ma et al.,2020)</td><td></td><td></td><td>26.8 22.4 61.1 16.8</td><td></td><td>8.44</td><td>22.78</td></tr><tr><td>POS-SCAN (Zhou et al., 2020)</td><td></td><td></td><td>30.1 22.6 69.3 16.8</td><td></td><td>7.17</td><td>17.49</td></tr><tr><td>UniTAB (Yang et al., 2022)</td><td></td><td></td><td>30.1 23.7 69.7 17.4</td><td></td><td>12.95</td><td>34.79</td></tr><tr><td>Shikra-13B (Chen et al.,2023b)</td><td>1</td><td>1</td><td>73.9</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Ferret-7B</td><td></td><td></td><td>35.1 24.6 74.8 18.015.02</td><td></td><td></td><td>37.62</td></tr><tr><td>Ferret-13B</td><td></td><td></td><td>37.0 25.5 76.1 18.315.12</td><td></td><td></td><td>38.03</td></tr></table>
|
| 120 |
+
|
| 121 |
+
Training Details. We initialize the image encoder with CLIP-ViT- $\mathrm { L } / 1 4 @ 3 3 6 \mathrm { p }$ , the LLM with Vicuna, and the projection layer with LLaVA’s first-stage weights, leaving the visual sampler randomly initialized. After the initialization, Ferret is trained on the aforementioned GRIT data for three epochs, optimized by Loshchilov & Hutter (2017) with a learning rate of $2 e - 5$ and a batch size of 128. The training takes ${ \sim } 5 / 2 . 5$ days on 8 A100 GPU for a Ferret-13B/7B. During training, when input refers to regions, we randomly choose either the center points or the bounding boxes (or segmentation masks if available) to represent the regions. We perform de-duplication in training data to remove the samples that are in downstream evaluations.
|
| 122 |
+
|
| 123 |
+
# 4.1 INPUT REFERRING
|
| 124 |
+
|
| 125 |
+
The model’s capability of understanding referring is reflected in that, given a referred region in the question, how accurately the model can understand the semantics of the referred region. To measure it, we start with the most basic semantics, object, as it is fundamental and clear to define. To be more specific, the task we evaluate on is Referring Object Classification: the question refers to a specific region in the image, and the model needs to classify the object in the region. Since Ferret and MLLMs usually generate free-form text responses, it is inaccurate to match the predicted class with the ground-truth class if directly asking the model to classify without constraints. Alternatively, we make it a binary-choice question in the format of “Is the object ⟨location⟩ a ⟨class A⟩ or a ⟨class B⟩?”. We feed the binary-choice question and image into the MLLMs to obtain the response, and then detect if the response matches the ground-truth (GT) class by some rule.7
|
| 126 |
+
|
| 127 |
+
To prepare the data, we used the validation split of LVIS dataset (Gupta et al., 2019) covering over 1000 object categories, and sampled 2667 objects as the GT objects. Then, we randomly choose a different object category in the same image whose central point is close to the GT object as the negative object, and replace $\langle \mathrm { c l a s s \_ A } \rangle$ and $\left. \mathrm { c l a s s \mathbf { \mathbf { B } } } \right.$ with those two randomly to form 2667 questions. Additionally, to mimic the versatility of referring in human life, we replace the ⟨location⟩ with three different types: point, box, and free-form shape. For point, we randomly sample a point inside the GT object that is also near the GT object’s boundary. For box, we use the GT bounding box provided by LVIS. For the free-form shape, we randomly generate some strokes inside the GT object to simulate that. Results on all three types of referring are summarized in Table 1. Ferret can significantly outperform previous models (Peng et al., 2023; Chen et al., 2023b) and handle all types of referring, a capability notably absent in previous works.
|
| 128 |
+
|
| 129 |
+
# 4.2 OUTPUT GROUNDING
|
| 130 |
+
|
| 131 |
+
Ferret performs well in referential dialogue, allowing for its integration into various VL tasks, notably those with grounding outputs. To rigorously assess the grounding capability, we first subject Ferret to benchmark visual grounding tasks in a generative paradigm. Then, to measure the alignments between words and regions, we further evaluate Ferret on grounded captioning task.
|
| 132 |
+
|
| 133 |
+
Visual grounding. Visual grounding aims to ground language queries into aligned image regions. We experiment on the sub-tasks of referring expression comprehension (REC) with three renowned benchmarks: RefCOCO (Lin et al., 2014), $\operatorname { R e f C O C O + }$ (Yu et al., 2016), and $\operatorname { R e f C O C O g }$ (Mao et al., 2016), and phrase grounding with Flickr30k Entities dataset (Plummer et al., 2015). REC task involves a question or description about a specific area in an image, with the model expected to predict just one bounding box. Phrase grounding, conversely, seeks to associate all the noun phrases in the input sentence with corresponding boxes, requiring the model to predict these boxes and the word-box connections. For both tasks, we utilize uniform prompts, represented as “What are the locations of $< q u e r y > / < p h r a s e s > ? ^ { , }$ , where $< q u e r y >$ denotes the textual referring expression, while $< p h r a s e s >$ stands for a “comma-delimited” aggregation of the given phrases. The model is trained to output in “<query> [box].” format. The generated bounding box is considered correct if its intersection over union (IoU) with the GT box is greater than 0.5. As shown in Table 3, Ferret achieves an outstanding performance on all metrics, and is comparable to specialized fine-tuning approaches (Kamath et al., 2021).
|
| 134 |
+
|
| 135 |
+
Table 3: Performance comparison $( \operatorname { A c c } @ 0 . 5 )$ on the referring expression comprehension (RefCOCO, Ref$\mathrm { C O C O + }$ , RefCOCOg) and phrase grounding (Flickr30k Entities) tasks. $^ *$ indicates that the method is specifically fine-tuned in the second stage.
|
| 136 |
+
|
| 137 |
+
<table><tr><td rowspan="2">Models</td><td colspan="3">val RefCOCOtestB</td><td colspan="3">vaRefCOCOtestB</td><td colspan="2">RefCOCOg</td><td rowspan="2" colspan="2">Flickr30k Enties</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>MAttNet (Yu et al., 2018)</td><td></td><td></td><td></td><td></td><td></td><td></td><td>76.40 80.43 69.28|64.93 70.26 56.00|66.67 67.01</td><td></td><td></td><td>1</td></tr><tr><td>OFA-L (Wang et al., 2022b)</td><td>79.9683.67 76.39</td><td></td><td></td><td>68.2976.00 61.75</td><td></td><td></td><td>67.57 67.58</td><td></td><td></td><td>1</td></tr><tr><td>TransVG (Deng et al., 2021)</td><td>81.0282.7278.35</td><td></td><td></td><td>64.8270.70 56.94</td><td></td><td></td><td>68.6767.73</td><td></td><td></td><td>79.10</td></tr><tr><td>UNITER (Chen et al., 2020)</td><td>81.41</td><td>87.0474.17</td><td></td><td>75.90 81.45 66.70</td><td></td><td></td><td>74.02 68.67</td><td></td><td>1</td><td>1</td></tr><tr><td>VILLA (Gan et al., 2020)</td><td>82.3987.48 74.84</td><td></td><td></td><td>76.17 81.54 66.84</td><td></td><td></td><td>76.18 76.71</td><td></td><td>/</td><td>1</td></tr><tr><td>UniTAB (Yang et al., 2022)</td><td>86.32</td><td>88.84</td><td>80.61</td><td>78.70 83.22</td><td></td><td>69.48</td><td>79.96 79.97</td><td></td><td>78.76</td><td>79.58</td></tr><tr><td>MDETR (Kamath et al.,2021)</td><td>86.75</td><td>89.58 81.41</td><td></td><td>79.52 84.09 70.62</td><td></td><td></td><td>81.64 80.89</td><td></td><td>82.3*</td><td>83.8*</td></tr><tr><td>Shikra-7B (Chen et al.,2023b)</td><td>87.01 90.61</td><td></td><td>80.24|81.60 87.36 72.12</td><td></td><td></td><td></td><td></td><td>82.27 82.19</td><td>75.84</td><td>76.54</td></tr><tr><td>Ferret-7B</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>87.49 91.35 82.4580.78 87.38 73.1483.93 84.76</td><td>80.39</td><td>82.21</td></tr><tr><td>Shikra-13B(Chen et al.,2023b) 87.83 91.11 81.81|82.89 87.79 74.41|82.64 83.16</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>[77.41</td><td>78.44</td></tr><tr><td>Ferret-13B</td><td></td><td></td><td></td><td></td><td></td><td></td><td>89.4892.41 84.3682.81 88.14 75.1785.83 86.34</td><td></td><td>81.13</td><td>84.76</td></tr></table>
|
| 138 |
+
|
| 139 |
+
Grounded captioning. The grounded captioning task requires the model to generate a caption and ground all generated noun phrases to image regions. The final predictions generally consist of three parts, i.e., the text caption, visual regions as boxes, and the grounding alignments between words and boxes. Following the established benchmarks on the Flickr30k Entities dataset, we evaluate captioning and grounding separately with the captioning metrics and grounding F1 scores, respectively. $F 1 _ { a l l }$ evaluates grounding as a multi-label classification problem. We also report $F 1 _ { l o c }$ that only computes the grounding score on correctly predicted object words. Results are summarized in Table 2, and Ferret achieves state-of-the-art.
|
| 140 |
+
|
| 141 |
+
# 4.3 FERRET-BENCH: MULTIMODAL CHATTING WITH REFERRING AND GROUNDING
|
| 142 |
+
|
| 143 |
+
Multimodal chatting has been an emergent ability of MLLMs. Previous benchmarks (Liu et al., 2023b) mainly evaluate conversation, detailed description, and complex reasoning via GPT-4 as a judge. Yet, a gap exists as no dataset currently evaluates multimodal chatting that necessitates referring or grounding actions, e.g., instances where individuals reference an unfamiliar object and inquire about its purpose. To benchmark this intriguing and practical capability, we introduce FerretBench that covers three kinds of region-based questions evaluating referring and grounding capability: (i) Referring Description: models are asked to describe a referred region based on its interaction with surrounding objects. (ii) Referring Reasoning: models need to reason on top of one or more referred regions correctly. (iii) Grounding in Conversation: models are required to reason correctly and accurately ground/localize the objects/regions necessary for the reasoning. For the ease of benchmarking other methods, we represent the regions with boxes instead of points or free-form shapes.
|
| 144 |
+
|
| 145 |
+
Specifically, we randomly sample 40 images from the COCO validation set for each type of question, and generate the questions and GPT-4’s answers following the instruction generation pipeline in Sec. 3.2. Following Liu et al. (2023b), we feed the question and image into MLLMs to obtain the predicted answer, and then prompt GPT-4 to rate the predicted answer and pseudo answer from GPT-4 based on the ground-truth textual scene description (object, relationship, region caption, global caption). GPT-4 evaluates both the precision of referring understanding, object grounding, and correctness of semantics. The rating score ranges from 1 to 10, in which higher means better. We calculate the ratio of the predicted answer’s score and the GPT-4 answer’s score, which is then presented as a percentage to measure the performance of MLLMs. We also asked GPT-4 to give a comprehensive review for the rating and found that GPT-4 is good at measuring the degree of spatial precision, such as how much the predicted bounding box diverges from the GT box coordinate. We refer the readers to Appendix D for further elaboration.
|
| 146 |
+
|
| 147 |
+
Table 4: Results on LLaVA-Bench and the proposed Ferret-Bench via GPT4-as-a-Judge evaluation.
|
| 148 |
+
|
| 149 |
+
<table><tr><td rowspan="2"></td><td colspan="4">LLaVA-Bench</td><td colspan="4">Ferret-Bench</td></tr><tr><td>ConversatioDon x</td><td></td><td></td><td>Avg.</td><td></td><td></td><td>Deferig Reeig gin</td><td>Avg</td></tr><tr><td>LLaVA8</td><td>85.4</td><td>68.3</td><td>92.1</td><td>81.9</td><td>41.4</td><td>31.7</td><td>28.8</td><td>34.0</td></tr><tr><td>Kosmos-2</td><td>71.7</td><td>63.4</td><td>74.9</td><td>70.0</td><td>51.8</td><td>33.7</td><td>48.4</td><td>44.6</td></tr><tr><td>Shikra-7B</td><td>80.6</td><td>70.7</td><td>88.1</td><td>79.9</td><td>46.0</td><td>41.6</td><td>50.1</td><td>45.9</td></tr><tr><td>Ferret-7B</td><td>84.4</td><td>79.4</td><td>96.3</td><td>86.7</td><td>68.7</td><td>67.3</td><td>57.5</td><td>64.5</td></tr><tr><td>Ferret-13B</td><td>85.2</td><td>80.9</td><td>96.4</td><td>87.5</td><td>70.6</td><td>68.7</td><td>59.7</td><td>66.3</td></tr></table>
|
| 150 |
+
|
| 151 |
+
Table 5: Ablation study on the mutual benefit of grounding data and referring data. We evaluate Accuracy for LVIS referring and $\mathbf { R } \ @ 1$ for grounding.
|
| 152 |
+
|
| 153 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">Referring (LVIS)| Grounding</td></tr><tr><td>Point</td><td>Box</td><td>Flickr30k</td></tr><tr><td>Ferret</td><td>67.9</td><td>79.4</td><td>80.4</td></tr><tr><td>w/o Grounding data</td><td>65.4</td><td>75.6</td><td>×</td></tr><tr><td>w/o Referring data</td><td>×</td><td>×</td><td>79.8</td></tr></table>
|
| 154 |
+
|
| 155 |
+
Table 6: Ablation study on the effectiveness of the proposed spatial-aware visual sampler. Accuracy is used to evaluate LVIS referring.
|
| 156 |
+
|
| 157 |
+
<table><tr><td rowspan="2">Module</td><td colspan="2">Referring (LVIS)</td></tr><tr><td>Point Box Free-form</td><td></td></tr><tr><td>Spatial-aware Visual Sampler 67.9</td><td>79.4</td><td>69.8</td></tr><tr><td>Visual Sampler in SEEM</td><td>67.177.2</td><td>68.9</td></tr></table>
|
| 158 |
+
|
| 159 |
+
We use LLaVA-Bench (Liu et al., 2023b) and the proposed Ferret-Bench to compare Ferret with previous models, including LLaVA (Liu et al., 2023b), Shikra (Chen et al., 2023b), and Kosmos2 (Peng et al., 2023). Results are summarized in Table 4. Ferret achieves superior performance in all types of tasks, boosting the score for the detailed description category from 68.3 to 80.9, and especially excels at the three new tasks demanding referring and grounding abilities.
|
| 160 |
+
|
| 161 |
+
# 4.4 ABLATION
|
| 162 |
+
|
| 163 |
+
In the ablation studies below, in default, we ablate Ferret-7B and mainly evaluate in referring object classification and grounding tasks on Flickr30k Entities validation set.
|
| 164 |
+
|
| 165 |
+
Mutual benefits of grounding and referring. As shown in Table 5, grounding and referring, as two main capabilities emphasized in this paper, can actually benefit each other. Particularly, when adding grounding data into training, the referring performance gets improved, and vice versa.
|
| 166 |
+
|
| 167 |
+
Spatial-aware Visual Sampler. We ablate the effectiveness of the spatial-aware visual sampler by replacing it with the visual sampler in SEEM (Zou et al., 2023), where they average the features of all the sampled points as the region feature. As we can see in Table 6, ours can outperform the previous visual sampler in all three referring tasks.
|
| 168 |
+
|
| 169 |
+
LLM model size. We study how much LLM model size influences the performance of referring and grounding. As seen in Table 1-4, having a larger LM backbone can generally help.
|
| 170 |
+
|
| 171 |
+
# 4.5 OBJECT HALLUCINATION
|
| 172 |
+
|
| 173 |
+
Attribute to the incorporation of fine-grained spatial knowledge and negative mining, Ferret also exhibits strong power against the hallucination problem. We evaluate object hallucinations on the POPE benchmark (Li et al., 2023e). Results are summarized in Table 7. Ferret has exhibited performance comparable to Shikra (Chen et al., 2023b), and far surpasses recent popular MLLMs.9
|
| 174 |
+
|
| 175 |
+
# 5 CONCLUSION
|
| 176 |
+
|
| 177 |
+
We present Ferret, a new multimodal large language model adept at referring and grounding. Ferret can refer image regions in any free-form shape, and automatically establish grounding for text deemed groundable by the model. We have curated the GRIT dataset for model training, and the Ferret-Bench dataset for evaluation. Ferret, like most MLLMs, may produce harmful and counterfactual responses. For future work, inspired by LISA (Lai et al., 2023), we plan to enhance Ferret to be able to output segmentation masks in addition to bounding boxes.
|
| 178 |
+
|
| 179 |
+
# REFERENCES
|
| 180 |
+
|
| 181 |
+
Armen Aghajanyan, Bernie Huang, Candace Ross, Vladimir Karpukhin, Hu Xu, Naman Goyal, Dmytro Okhonko, Mandar Joshi, Gargi Ghosh, Mike Lewis, et al. Cm3: A causal masked multimodal model of the internet. arXiv preprint arXiv:2201.07520, 2022.
|
| 182 |
+
Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022.
|
| 183 |
+
Anas Awadalla, Irena Gao, Joshua Gardner, Jack Hessel, Yusuf Hanafy, Wanrong Zhu, Kalyani Marathe, Yonatan Bitton, Samir Gadre, Jenia Jitsev, Simon Kornblith, Pang Wei Koh, Gabriel Ilharco, Mitchell Wortsman, and Ludwig Schmidt. Openflamingo, March 2023. URL https: //doi.org/10.5281/zenodo.7733589.
|
| 184 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
|
| 185 |
+
Chi Chen, Ruoyu Qin, Fuwen Luo, Xiaoyue Mi, Peng Li, Maosong Sun, and Yang Liu. Positionenhanced visual instruction tuning for multimodal large language models. arXiv preprint arXiv:2308.13437, 2023a.
|
| 186 |
+
Keqin Chen, Zhao Zhang, Weili Zeng, Richong Zhang, Feng Zhu, and Rui Zhao. Shikra: Unleashing multimodal llm’s referential dialogue magic. arXiv preprint arXiv:2306.15195, 2023b.
|
| 187 |
+
Ting Chen, Saurabh Saxena, Lala Li, David J Fleet, and Geoffrey Hinton. Pix2seq: A language modeling framework for object detection. arXiv preprint arXiv:2109.10852, 2021.
|
| 188 |
+
Ting Chen, Saurabh Saxena, Lala Li, Tsung-Yi Lin, David J Fleet, and Geoffrey Hinton. A unified sequence interface for vision tasks. arXiv preprint arXiv:2206.07669, 2022a.
|
| 189 |
+
Xi Chen, Xiao Wang, Soravit Changpinyo, AJ Piergiovanni, Piotr Padlewski, Daniel Salz, Sebastian Goodman, Adam Grycner, Basil Mustafa, Lucas Beyer, et al. Pali: A jointly-scaled multilingual language-image model. arXiv preprint arXiv:2209.06794, 2022b.
|
| 190 |
+
Xi Chen, Josip Djolonga, Piotr Padlewski, Basil Mustafa, Soravit Changpinyo, Jialin Wu, Carlos Riquelme Ruiz, Sebastian Goodman, Xiao Wang, Yi Tay, et al. Pali-x: On scaling up a multilingual vision and language model. arXiv preprint arXiv:2305.18565, 2023c.
|
| 191 |
+
Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning. In ECCV, 2020.
|
| 192 |
+
Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E Gonzalez, et al. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality. See https://vicuna. lmsys. org (accessed 14 April 2023), 2023.
|
| 193 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
|
| 194 |
+
Wenliang Dai, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, and Steven Hoi. Instructblip: Towards general-purpose vision-language models with instruction tuning. arXiv preprint arXiv:2305.06500, 2023.
|
| 195 |
+
Jiajun Deng, Zhengyuan Yang, Tianlang Chen, Wengang Zhou, and Houqiang Li. Transvg: End-toend visual grounding with transformers. In ICCV, 2021.
|
| 196 |
+
Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. PaLM-E: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023.
|
| 197 |
+
Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning. NeurIPS, 2020.
|
| 198 |
+
Agrim Gupta, Piotr Dollar, and Ross Girshick. Lvis: A dataset for large vocabulary instance segmentation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 5356–5364, 2019.
|
| 199 |
+
Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
|
| 200 |
+
Aishwarya Kamath, Mannat Singh, Yann LeCun, Gabriel Synnaeve, Ishan Misra, and Nicolas Carion. Mdetr-modulated detection for end-to-end multi-modal understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1780–1790, 2021.
|
| 201 |
+
Sahar Kazemzadeh, Vicente Ordonez, Mark Matten, and Tamara Berg. Referitgame: Referring to objects in photographs of natural scenes. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 787–798, 2014.
|
| 202 |
+
Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C Berg, Wan-Yen Lo, et al. Segment anything. arXiv preprint arXiv:2304.02643, 2023.
|
| 203 |
+
Jing Yu Koh, Daniel Fried, and Ruslan Salakhutdinov. Generating images with multimodal language models. arXiv preprint arXiv:2305.17216, 2023a.
|
| 204 |
+
Jing Yu Koh, Ruslan Salakhutdinov, and Daniel Fried. Grounding language models to images for multimodal generation. arXiv preprint arXiv:2301.13823, 2023b.
|
| 205 |
+
Emiel Krahmer and Kees Van Deemter. Computational generation of referring expressions: A survey. Computational Linguistics, 38(1):173–218, 2012.
|
| 206 |
+
Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123:32–73, 2017.
|
| 207 |
+
Xin Lai, Zhuotao Tian, Yukang Chen, Yanwei Li, Yuhui Yuan, Shu Liu, and Jiaya Jia. Lisa: Reasoning segmentation via large language model. arXiv preprint arXiv:2308.00692, 2023.
|
| 208 |
+
Hugo Laurenc¸on, Lucile Saulnier, Leo Tronchon, Stas Bekman, Amanpreet Singh, Anton Lozhkov, ´ Thomas Wang, Siddharth Karamcheti, Alexander M Rush, Douwe Kiela, et al. Obelisc: An open web-scale filtered dataset of interleaved image-text documents. arXiv preprint arXiv:2306.16527, 2023.
|
| 209 |
+
Bo Li, Yuanhan Zhang, Liangyu Chen, Jinghao Wang, Jingkang Yang, and Ziwei Liu. Otter: A multi-modal model with in-context instruction tuning. arXiv preprint arXiv:2305.03726, 2023a.
|
| 210 |
+
Chunyuan Li, Zhe Gan, Zhengyuan Yang, Jianwei Yang, Linjie Li, Lijuan Wang, and Jianfeng Gao. Multimodal foundation models: From specialists to general-purpose assistants. arXiv preprint arXiv:2309.10020, 2023b.
|
| 211 |
+
Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping languageimage pre-training with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023c.
|
| 212 |
+
Lei Li, Yuwei Yin, Shicheng Li, Liang Chen, Peiyi Wang, Shuhuai Ren, Mukai Li, Yazheng Yang, Jingjing Xu, Xu Sun, et al. $\mathbf { M } ^ { 3 } \mathrm { i t }$ : A large-scale dataset towards multi-modal multilingual instruction tuning. arXiv preprint arXiv:2306.04387, 2023d.
|
| 213 |
+
Liunian Harold Li, Pengchuan Zhang, Haotian Zhang, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, et al. Grounded language-image pre-training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10965–10975, 2022.
|
| 214 |
+
|
| 215 |
+
Yifan Li, Yifan Du, Kun Zhou, Jinpeng Wang, Wayne Xin Zhao, and Ji-Rong Wen. Evaluating object hallucination in large vision-language models. arXiv preprint arXiv:2305.10355, 2023e.
|
| 216 |
+
|
| 217 |
+
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pp. 740–755. Springer, 2014.
|
| 218 |
+
Fuxiao Liu, Kevin Lin, Linjie Li, Jianfeng Wang, Yaser Yacoob, and Lijuan Wang. Aligning large multi-modal model with robust instruction tuning. arXiv preprint arXiv:2306.14565, 2023a.
|
| 219 |
+
Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023b.
|
| 220 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 221 |
+
Jiasen Lu, Christopher Clark, Rowan Zellers, Roozbeh Mottaghi, and Aniruddha Kembhavi. Unified-io: A unified model for vision, language, and multi-modal tasks. arXiv preprint arXiv:2206.08916, 2022.
|
| 222 |
+
Ruotian Luo and Gregory Shakhnarovich. Comprehension-guided referring expressions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7102–7111, 2017.
|
| 223 |
+
Chih-Yao Ma, Yannis Kalantidis, Ghassan AlRegib, Peter Vajda, Marcus Rohrbach, and Zsolt Kira. Learning to generate grounded visual captions without localization supervision. In ECCV, 2020.
|
| 224 |
+
Xu Ma, Can Qin, Haoxuan You, Haoxi Ran, and Yun Fu. Rethinking network design and local geometry in point cloud: A simple residual mlp framework. arXiv preprint arXiv:2202.07123, 2022.
|
| 225 |
+
Junhua Mao, Jonathan Huang, Alexander Toshev, Oana Camburu, Alan L Yuille, and Kevin Murphy. Generation and comprehension of unambiguous object descriptions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 11–20, 2016.
|
| 226 |
+
Varun K Nagaraja, Vlad I Morariu, and Larry S Davis. Modeling context between objects for referring expression understanding. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11–14, 2016, Proceedings, Part IV 14, pp. 792–807. Springer, 2016.
|
| 227 |
+
OpenAI. GPT-4 technical report. https://arxiv.org/abs/2303.08774, 2023a.
|
| 228 |
+
OpenAI. Gpt-4 technical report. arXiv, 2023b.
|
| 229 |
+
Zhiliang Peng, Wenhui Wang, Li Dong, Yaru Hao, Shaohan Huang, Shuming Ma, and Furu Wei. Kosmos-2: Grounding multimodal large language models to the world. arXiv preprint arXiv:2306.14824, 2023.
|
| 230 |
+
Bryan A Plummer, Liwei Wang, Chris M Cervantes, Juan C Caicedo, Julia Hockenmaier, and Svetlana Lazebnik. Flickr30k entities: Collecting region-to-phrase correspondences for richer imageto-sentence models. In Proceedings of the IEEE international conference on computer vision, pp. 2641–2649, 2015.
|
| 231 |
+
Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 652–660, 2017a.
|
| 232 |
+
Charles Ruizhongtai Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. Advances in neural information processing systems, 30, 2017b.
|
| 233 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748–8763. PMLR, 2021.
|
| 234 |
+
Teven Le Scao, Angela Fan, Christopher Akiki, Ellie Pavlick, Suzana Ilic, Daniel Hesslow, Roman ´ Castagne, Alexandra Sasha Luccioni, Franc¸ois Yvon, Matthias Gall ´ e, et al. Bloom: A 176b- ´ parameter open-access multilingual language model. arXiv preprint arXiv:2211.05100, 2022.
|
| 235 |
+
Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 8430–8439, 2019.
|
| 236 |
+
Quan Sun, Qiying Yu, Yufeng Cui, Fan Zhang, Xiaosong Zhang, Yueze Wang, Hongcheng Gao, Jingjing Liu, Tiejun Huang, and Xinlong Wang. Generative pretraining in multimodality. arXiv preprint arXiv:2307.05222, 2023.
|
| 237 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a.
|
| 238 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023b.
|
| 239 |
+
Jianfeng Wang, Zhengyuan Yang, Xiaowei Hu, Linjie Li, Kevin Lin, Zhe Gan, Zicheng Liu, Ce Liu, and Lijuan Wang. Git: A generative image-to-text transformer for vision and language. arXiv preprint arXiv:2205.14100, 2022a.
|
| 240 |
+
Peng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Ofa: Unifying architectures, tasks, and modalities through a simple sequence-to-sequence learning framework. In ICML, 2022b.
|
| 241 |
+
Wenhai Wang, Zhe Chen, Xiaokang Chen, Jiannan Wu, Xizhou Zhu, Gang Zeng, Ping Luo, Tong Lu, Jie Zhou, Yu Qiao, et al. Visionllm: Large language model is also an open-ended decoder for vision-centric tasks. arXiv preprint arXiv:2305.11175, 2023.
|
| 242 |
+
Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph cnn for learning on point clouds. ACM Transactions on Graphics (tog), 38(5): 1–12, 2019.
|
| 243 |
+
Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. In ICLR, 2022c.
|
| 244 |
+
Jialian Wu, Jianfeng Wang, Zhengyuan Yang, Zhe Gan, Zicheng Liu, Junsong Yuan, and Lijuan Wang. Grit: A generative region-to-text transformer for object understanding. arXiv preprint arXiv:2212.00280, 2022.
|
| 245 |
+
Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Faisal Ahmed, Zicheng Liu, Yumao Lu, and Lijuan Wang. Unitab: Unifying text and box outputs for grounded vision-language modeling. In European Conference on Computer Vision, pp. 521–539. Springer, 2022.
|
| 246 |
+
Qinghao Ye, Haiyang Xu, Guohai Xu, Jiabo Ye, Ming Yan, Yiyang Zhou, Junyang Wang, Anwen Hu, Pengcheng Shi, Yaya Shi, et al. mplug-owl: Modularization empowers large language models with multimodality. arXiv preprint arXiv:2304.14178, 2023.
|
| 247 |
+
Licheng Yu, Patrick Poirson, Shan Yang, Alexander C Berg, and Tamara L Berg. Modeling context in referring expressions. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part II 14, pp. 69–85. Springer, 2016.
|
| 248 |
+
Licheng Yu, Hao Tan, Mohit Bansal, and Tamara L Berg. A joint speaker-listener-reinforcer model for referring expressions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7282–7290, 2017.
|
| 249 |
+
Licheng Yu, Zhe Lin, Xiaohui Shen, Jimei Yang, Xin Lu, Mohit Bansal, and Tamara L Berg. Mattnet: Modular attention network for referring expression comprehension. In CVPR, 2018.
|
| 250 |
+
Lili Yu, Bowen Shi, Ramakanth Pasunuru, Benjamin Muller, Olga Golovneva, Tianlu Wang, Arun Babu, Binh Tang, Brian Karrer, Shelly Sheynin, et al. Scaling autoregressive multi-modal models: Pretraining and instruction tuning. arXiv preprint arXiv:2309.02591, 2023.
|
| 251 |
+
Yuhang Zang, Wei Li, Jun Han, Kaiyang Zhou, and Chen Change Loy. Contextual object detection with multimodal large language models. arXiv preprint arXiv:2305.18279, 2023.
|
| 252 |
+
Rowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6720–6731, 2019.
|
| 253 |
+
Haotian Zhang, Pengchuan Zhang, Xiaowei Hu, Yen-Chun Chen, Liunian Li, Xiyang Dai, Lijuan Wang, Lu Yuan, Jenq-Neng Hwang, and Jianfeng Gao. Glipv2: Unifying localization and visionlanguage understanding. Advances in Neural Information Processing Systems, 35:36067–36080, 2022.
|
| 254 |
+
Shilong Zhang, Peize Sun, Shoufa Chen, Min Xiao, Wenqi Shao, Wenwei Zhang, Kai Chen, and Ping Luo. Gpt4roi: Instruction tuning large language model on region-of-interest. arXiv preprint arXiv:2307.03601, 2023.
|
| 255 |
+
Yang Zhao, Zhijie Lin, Daquan Zhou, Zilong Huang, Jiashi Feng, and Bingyi Kang. Bubogpt: Enabling visual grounding in multi-modal llms. arXiv preprint arXiv:2307.08581, 2023.
|
| 256 |
+
Luowei Zhou, Yannis Kalantidis, Xinlei Chen, Jason J Corso, and Marcus Rohrbach. Grounded video description. In CVPR, 2019.
|
| 257 |
+
Yuanen Zhou, Meng Wang, Daqing Liu, Zhenzhen Hu, and Hanwang Zhang. More grounded image captioning by distilling image-text matching model. In CVPR, 2020.
|
| 258 |
+
Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023a.
|
| 259 |
+
Wanrong Zhu, Jack Hessel, Anas Awadalla, Samir Yitzhak Gadre, Jesse Dodge, Alex Fang, Youngjae Yu, Ludwig Schmidt, William Yang Wang, and Yejin Choi. Multimodal c4: An open, billionscale corpus of images interleaved with text. arXiv preprint arXiv:2304.06939, 2023b.
|
| 260 |
+
Xueyan Zou, Jianwei Yang, Hao Zhang, Feng Li, Linjie Li, Jianfeng Gao, and Yong Jae Lee. Segment everything everywhere all at once. arXiv preprint arXiv:2304.06718, 2023.
|
| 261 |
+
|
| 262 |
+
Table 7: Results on the object hallucination benchmark using the POPE evaluation pipeline (Li et al., 2023e).
|
| 263 |
+
|
| 264 |
+
<table><tr><td>Datasets</td><td>Metrics</td><td></td><td></td><td>Ferret Shikra InstructBLIP</td><td>MiniGPT4 LLaVA</td><td></td><td>MM-GPT</td><td>mPLUG-Owl</td></tr><tr><td rowspan="5">Random</td><td>Accuracy (↑)</td><td>90.24</td><td>86.90</td><td>88.57</td><td>79.67</td><td>50.37</td><td>50.10</td><td>53.97</td></tr><tr><td>Precision (↑)</td><td>97.72</td><td>94.40</td><td>84.09</td><td>78.24</td><td>50.19</td><td>50.05</td><td>52.07</td></tr><tr><td>Recall(↑)</td><td>83.00</td><td>79.26</td><td>95.13</td><td>82.20</td><td>99.13</td><td>100.00</td><td>99.60</td></tr><tr><td>F1 Score (↑)</td><td>89.76</td><td>86.19</td><td>89.27</td><td>80.17</td><td>66.64</td><td>66.71</td><td>68.39</td></tr><tr><td>Yes</td><td>43.78</td><td>43.26</td><td>56.57</td><td>52.53</td><td>98.77</td><td>99.90</td><td>95.63</td></tr><tr><td rowspan="5">Popular</td><td>Accuracy (↑)</td><td>84.90</td><td>83.97</td><td>82.77</td><td>69.73</td><td>49.87</td><td>50.00</td><td>50.90</td></tr><tr><td>Precision (↑)</td><td>88.24</td><td>87.55</td><td>76.27</td><td>65.86</td><td>49.93</td><td>50.00</td><td>50.46</td></tr><tr><td>Recall(↑)</td><td>80.53</td><td>79.20</td><td>95.13</td><td>81.93</td><td>99.27</td><td>100.00</td><td>99.40</td></tr><tr><td>F1 Score (↑)</td><td>84.21</td><td>83.16</td><td>84.66</td><td>73.02</td><td>66.44</td><td>66.67</td><td>66.94</td></tr><tr><td>Yes</td><td>45.63</td><td>45.23</td><td>62.37</td><td>62.20</td><td>99.40</td><td>100.00</td><td>98.57</td></tr><tr><td rowspan="5">Adversarial</td><td>Accuracy (↑)</td><td>82.36</td><td>83.10</td><td>72.10</td><td>65.17</td><td>49.70</td><td>50.00</td><td>50.67</td></tr><tr><td>Precision (↑)</td><td>83.60</td><td>85.60</td><td>65.13</td><td>61.19</td><td>49.85</td><td>50.00</td><td>50.34</td></tr><tr><td>Recall(↑)</td><td>80.53</td><td>79.60</td><td>95.13</td><td>82.93</td><td>99.07</td><td>100.00</td><td>99.33</td></tr><tr><td>F1 Score (↑)</td><td>82.00</td><td>82.49</td><td>77.32</td><td>70.42</td><td>66.32</td><td>66.67</td><td>66.82</td></tr><tr><td>Yes</td><td>48.18</td><td>46.50</td><td>73.03</td><td>67.77</td><td>99.37</td><td>100.00</td><td>98.67</td></tr></table>
|
| 265 |
+
|
| 266 |
+
Table 8: Comparison of Ferret v.s. recent MLLMs integrating spatial awareness. ‘Convention’ refers to a comprehensive collection of publicly available data that has been transformed using templates, ‘GPT-Generate’ signifies the generated refer/ground datasets employing GPT, and ‘Robustness’ denotes datasets aimed at mitigating hallucination and improving robustness. Section 3 explains more details about each.
|
| 267 |
+
|
| 268 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">Input Types</td><td rowspan="2">GrOutpung</td><td colspan="3">Data Construction</td><td rowspan="2">Qu antaetivr uval. w. Chat</td></tr><tr><td></td><td></td><td>Point Box Free-form</td><td></td><td>Convention GPT-Generate Robustness</td><td></td></tr><tr><td>BuboGPT</td><td>xxx√:</td><td></td><td></td><td></td><td>√</td><td></td><td></td><td>×</td></tr><tr><td>Vision-LLM</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Kosmos-2</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Shikra</td><td></td><td>xxνν</td><td></td><td></td><td>√</td><td>xxx√x</td><td></td><td></td></tr><tr><td>GPT4-ROI</td><td></td><td></td><td></td><td>ννννxxν</td><td></td><td>×</td><td>xxxxxxν</td><td>xxxxν</td></tr><tr><td>PVIT</td><td>X</td><td></td><td>xxxxxxν</td><td></td><td>√</td><td></td><td></td><td></td></tr><tr><td>Ferret</td><td></td><td></td><td></td><td></td><td></td><td><</td><td></td><td></td></tr></table>
|
| 269 |
+
|
| 270 |
+
# A RELATED WORK
|
| 271 |
+
|
| 272 |
+
Multimodal large language models (MLLMs). Large Language Models (LLMs), including GPTs (Brown et al., 2020; OpenAI, 2023a), PaLM (Chowdhery et al., 2022), BLOOM (Scao et al., 2022), and LLaMA (Touvron et al., 2023a;b), have revolutionized research in NLP, spurring significant advances in multimodal language models as well. Early models primarily focused on large-scale image-text pre-training. Notable examples include SimVLM (Wang et al., 2022c), GIT (Wang et al., 2022a), PaLI (Chen et al., 2022b), PaLI-X (Chen et al., 2023c), BLIP-2 (Li et al., 2023c), Flamingo (Alayrac et al., 2022), PaLM-E (Driess et al., 2023), CM3 (Aghajanyan et al., 2022), and CM3Leon (Yu et al., 2023). Flamingo, in particular, pioneered the integration of a pre-trained CLIP image encoder with LLMs through gated cross-attention blocks, showcasing emergent multimodal in-context few-shot learning capabilities. Its open-sourced variants, such as OpenFlamingo (Awadalla et al., 2023) and IDEFICS (Laurenc¸on et al., 2023), have garnered significant attention. Typically, these models undergo pre-training using millions or even billions of image-text pairs and interleaved image-text datasets (Zhu et al., 2023b).
|
| 273 |
+
|
| 274 |
+
On the other hand, recent research has increasingly focused on using pre-trained LLMs for visual instruction tuning. Prominent examples include LLaVA (Liu et al., 2023b), MiniGPT-4 (Zhu et al., 2023a), mPLUG-Owl (Ye et al., 2023), Otter (Li et al., 2023a), InstructBLIP (Dai et al., 2023), to name a few. In addition to text generation, recent models like FROMAGe (Koh et al., 2023b), GILL (Koh et al., 2023a), Emu (Sun et al., 2023), have also enabled MLLMs for image retrieval and image generation. Please refer to Chapter 5 of Li et al. (2023b) for a detailed review.
|
| 275 |
+
|
| 276 |
+
MLLMs for referring and grounding. In the realm of existing literature, works such as Kosmos2 (Peng et al., 2023) and Shikra (Chen et al., 2023b), closely resemble ours as they also enable MLLMs for fine-grained image comprehension and open-world referring and grounding. Additional works in this direction include GPT4ROI (Zhang et al., 2023), PVIT (Chen et al., 2023a), BuboGPT (Zhao et al., 2023), VisionLLM (Wang et al., 2023), and ContextDET (Zang et al., 2023). Nevertheless, pivotal distinctions set our model apart. First, prior endeavors supported only bounding boxes (and points in Shikra) as input. Conversely, due to Ferret’s innovative hybrid region representation, we accommodate a broader range of free-form shapes for referring, encompassing points, boxes, sketches, scribbles, polygons, and more. Second, we meticulously curate an extensive referand-ground instruction tuning dataset. Third, we introduce Ferret-Bench to facilitate forthcoming research and enhance evaluation benchmarks in this direction. Lastly, our model exhibits superior performance compared to previous works, notably mitigating object hallucination to a significant extent. A more straightforward side-by-side comparison is shown in Tab. 8.
|
| 277 |
+
|
| 278 |
+
Unifying grounding and VL understanding. Our work is also related to previous work that aims to unify text and bounding box output for vision-language (VL) models, such as UniTAB (Yang et al., 2022), OFA (Wang et al., 2022b), and Unified-IO (Lu et al., 2022), which also represent bounding boxes using a set of additional discrete tokens as proposed in Pix2Seq (Chen et al., 2021; 2022a). Ferret is unique in that (i) our model is built upon LLMs, marrying the power of LLMs and grounding, thus unlocking new capabilities such as grounded instruction tuning, and (ii) we handle bounding box coordinates as regular text tokens, avoiding the need for extra specialized tokens dedicated to representing boxes.
|
| 279 |
+
|
| 280 |
+
# B DISCUSSION ON LIMITATION AND FAILURE CASES
|
| 281 |
+
|
| 282 |
+
We acknowledge certain specific failure scenarios and limitations for our models, which are detailed as follows:
|
| 283 |
+
|
| 284 |
+
Failure Scenarios: (1). Referring to too many objects (more than 3) in one question might not be as accurate as referring to each of them in separate conversations. This is likely due to a relative scarcity of training data that mentions too many objects. (2). The referring and grounding of very small objects is less accurate than large or medium objects. It’s a common challenge in object detection. However, we think further improving input image resolution is able to help.
|
| 285 |
+
|
| 286 |
+
Limitations: (1). Not good at other languages because the training dataset is curated only in English. Although Ferret shows some emergent referring and grounding capability in other languages, its performance in other languages is still worse than in English. Future incorporation of multilingual training data could potentially mitigate this. (2). Similar to many large language models, Ferret has the potential to generate harmful or factually incorrect responses. (3). Ferret is not designed for segmentation tasks requiring mask outputs.
|
| 287 |
+
|
| 288 |
+
# C DETAILS OF DATASET
|
| 289 |
+
|
| 290 |
+
# C.1 TASK TEMPLATES FOR PUBLIC DATASETS
|
| 291 |
+
|
| 292 |
+
In Section 3.1, we mentioned using carefully designed task templates to convert public datasets such as Visual Genome into instruction-following format. The task templates we used are provided in Table 9. For simplicity, we only list three examples for each task.
|
| 293 |
+
|
| 294 |
+
# C.2 DETAILS ON SPATIAL NEGATIVE MINING
|
| 295 |
+
|
| 296 |
+
In Section 3.3, we conducted negative sample mining for two aspects: (i) Image-conditioned Category Localization, and (ii) Semantics-conditioned Category Localization. They use the same template to convert the original data, which falls into the task of object hallucination in Table 9. Specifically, for the negative categories in $( i i )$ , we prompt ChatGPT/GPT-4 to generate entities that are most analogous to the original class, attribute, or quantity, e.g., ‘man’ vs. ‘woman’, ‘blue’ vs. ‘yellow’, ‘two’ vs. ‘three’. The prompt feed into ChatGPT/GPT-4 encompasses all the entities extracted from 5 captions associated with one single image. We show the exact prompt template in Table 10.
|
| 297 |
+
|
| 298 |
+
Table 9: Examples of task templates Ferret used to transfer different public data types into the instruction-following format.
|
| 299 |
+
|
| 300 |
+
<table><tr><td>Task</td><td>Three randomly chosen examples from many.</td></tr><tr><td>Referring-Object</td><td>What is the class of the object <location>within the image? Classify object <location> in the image. Identify the object <location> in the image.</td></tr><tr><td>Referring-Relation</td><td>What does <object1><location1> do to <object2><location2> of the image? What is the physical relation between <object1><locationl>and <object2><location2>? Can you figure out the geometric relation of the <objectl><locationl>and <object2><location2>?</td></tr><tr><td>Referring-Region</td><td>Describe the region <location> in a short phrase. What is in the region <location>? Describe in a phrase. Capture in a phrase:what's near region <location>in the picture?</td></tr><tr><td>REC.</td><td>Where is<object>in the image? What are the coordinates for the given <object> in the image? Given the image,could you please tell me where is <object></td></tr><tr><td>Phrase Grounding</td><td>What are the locations of <objects>? Could you provide me with the exact locations of <objects>? Please indicate the positions of <objects> in the image?</td></tr><tr><td>Object Detection (O365)</td><td>Detect all objects among <class> in the image. Perform object detection given the image within <class>. Given the image and set <class>,identify allthe objects that belong to the set.</td></tr><tr><td>Grounded Captioning</td><td>What is this photo about? Use concise language. Describe the overall picture in just a few words. What do you see happening in this image? Provide the answer in short.</td></tr><tr><td>Object Hallucination</td><td>Is there a <object>in the image? Are there <object>in the image? Please tell me whether<object> exists in the image?</td></tr></table>
|
| 301 |
+
|
| 302 |
+
Table 10: In this example, we provide the prompt to generate the spatial negative sets.
|
| 303 |
+
|
| 304 |
+
messages $=$ [ {"role":"system", "content": f”’You are an AI visual assistant that can analyze a single image. You receive several entities given by a list, each describing the objects in the image you are observing.
|
| 305 |
+
|
| 306 |
+
For each entity mentioned, change them with the most misleading entity name (may belong to the same category but are actually different) (nonexistent objects: man woman, nonexistent attributes: brown yellow, nonexistent quantities: two three, etc.). The instructions should contain interrogative and declarative sentences.
|
| 307 |
+
|
| 308 |
+
The output format needs to be a list only which contains the misleading entity names. Please follow the instructions carefully.
|
| 309 |
+
|
| 310 |
+
1. The length of the output list needs to be exactly equal to the input list.
|
| 311 |
+
|
| 312 |
+
2. Do not explain the reasons.
|
| 313 |
+
|
| 314 |
+
3. Do not mention the input entities, at least the output name and input name needs to be different.
|
| 315 |
+
|
| 316 |
+
4. Do not mention something abstract, like alien ¨ .
|
| 317 |
+
|
| 318 |
+
5. When dealing with quantities, focus solely on increasing the numbers during revision.
|
| 319 |
+
|
| 320 |
+
6. When dealing with words like ”a few”, ”a group”, ”several”, ”some”, etc., try changing the objects (A few men $ \mathbf { A }$ few women).
|
| 321 |
+
|
| 322 |
+
7. Ensure that inclusive words are not substituted with their specific subsets. For example, if the word is ”people,” avoid replacing it with genders like ”man” or ”woman.” Instead, consider modifying them to different categories, such as ”people” ”animals.”.”’}]
|
| 323 |
+
|
| 324 |
+
We provide some example prompts to generate refer-and-ground from ChatGPT/GPT-4. Prompt and the in-context example of multiple-round visual conversation data are shown in Table 11 and Table 12. Prompt and the in-context example of one-round reasoning data are shown in Table 13 and Table 14.
|
| 325 |
+
|
| 326 |
+
Table 11: In this example, we provide the prompt used to generate the conversation response for refer-and-ground instruction tuning, following the practice of LLaVA (Liu et al., 2023b).
|
| 327 |
+
|
| 328 |
+
messages $\mathbf { \Sigma } = [ \mathbf { \Sigma } \{ { \ " } \Sigma \circ \mathrm { { 1 } } \mathsf { e " \Sigma }$ :"system", "content": f”’You are an AI visual assistant that can analyze a single image. You receive five global captions, each describing the same image you are observing. In addition, specific object locations within the image are given, along with detailed coordinates. These coordinates are in the form of bounding boxes, represented as (x1, y1, x2, y2) with floating numbers ranging from 0 to 1. These values correspond to the top left x, top left y, bottom right $\mathbf { X }$ , and bottom right y. Also, the relationships between pairs of objects are provided in the format of object relationship subject, where the object/subject are indexed by object id from previous object lists as well as the object names. Also, several region descriptions are given, each describing a box region of the image, with detailed coordinates.
|
| 329 |
+
|
| 330 |
+
Design a conversation between you and a person asking about this photo. Ask diverse questions and give corresponding answers. The answers should be in a tone that a visual AI assistant is seeing the image and answering the question.
|
| 331 |
+
|
| 332 |
+
Here are some additional requirements about generated questions and answers:
|
| 333 |
+
|
| 334 |
+
1. Only include questions that have definite answers:
|
| 335 |
+
(1) one can see the content in the image that the question asks about and can answer confidently; (2) one can determine confidently from the image that it is not in the image. Do not ask any questions that cannot be answered confidently.
|
| 336 |
+
|
| 337 |
+
2. Also include complex questions that are relevant to the content in the image, for example, asking about background knowledge of the objects in the image, asking to discuss events happening in the image, asking about object actions in the context of entire images, etc. Again, do not ask about uncertain details.
|
| 338 |
+
|
| 339 |
+
3. Provide detailed answers when answering complex questions. For example, give detailed examples or reasoning steps to make the content more convincing and well-organized. You can include multiple paragraphs if necessary.
|
| 340 |
+
|
| 341 |
+
4. In all samples, either in question or answer, you must mention bounding box coordinates to refer to the object or regions instead of directly saying the object name or describing the regions in text. In answer, explain the region in the context of the scene.
|
| 342 |
+
|
| 343 |
+
5. Do not mention that the information source is provided in the text/caption/region description.
|
| 344 |
+
Always answer as if you are directly looking at the image.
|
| 345 |
+
|
| 346 |
+
6. Make the question as diverse as possible. Include questions asking about the visual content of the image, including the object types, counting the objects, object actions, object locations, relative positions between objects, object selection, object functions, etc. Make the question challenging by less including the visual content details in the question.”’}
|
| 347 |
+
|
| 348 |
+
or sample in fewshot samples: messages.append({"role":"user", "content":sample[‘context’]}) messages.append({"role":"assistant", "content":sample[‘response’]} messages.append({"role":"user", "content":‘\n’.join(query)})
|
| 349 |
+
|
| 350 |
+

|
| 351 |
+
Table 12: One example used in in-context learning to construct GPT-Assisted Refer-and-Ground Instructon-Tuning. We encourage readers to refer to the codebase for the prompts for other types.
|
| 352 |
+
|
| 353 |
+
Table 13: In this example, we provide the prompt used to generate the reasoning response for referand-ground instruction tuning, following the practice of LLaVA (Liu et al., 2023b).
|
| 354 |
+
|
| 355 |
+
messages $\mathbf { \Sigma } = [ \mathbf { \Sigma } \{ { \ " } \Sigma \circ \mathrm { { 1 } } \mathsf { e " \Sigma }$ :"system", "content": f”’You are an AI visual assistant that can analyze a single image. You receive five global captions, each describing the same image you are observing. In addition, specific object locations within the image are given, along with detailed coordinates. These coordinates are in the form of bounding boxes, represented as (x1, y1, x2, y2) with floating numbers ranging from 0 to 1. These values correspond to the top left x, top left y, bottom right x, and bottom right y. Also, the relationships between pairs of objects are provided, in the format of object relationship subject, where the object/subject are indexed by object id from previous object lists as well as the object names. Also, several region descriptions are given, each describing a box region of the image, with detailed coordinates.
|
| 356 |
+
|
| 357 |
+
The task is to use the provided image information (objects, attribute, relationship, region description, captions), create a plausible and challenging question about the image, and provide the answer in detail.
|
| 358 |
+
|
| 359 |
+
Create complex questions that mention specific regions of the image, but the question should require some knowledge-aware or high-level commonsense reasoning beyond describing the scene.
|
| 360 |
+
|
| 361 |
+
To answer such questions, one should first understand the visual content, then based on the background knowledge or reasoning, either explain why the things are happening that way or provide guides and help to the user’s request. Make the question challenging by not including the visual content details in the question so that the user needs to reason about that first.
|
| 362 |
+
|
| 363 |
+
Here are some additional requirements about generated questions and answers:
|
| 364 |
+
|
| 365 |
+
1. In question or answer, you must mention bounding box coordinates to refer to the object or regions, instead of directly say the object name or describing the regions in text. In answers, explain the region in the context of scene. Include details like object counts, position of the objects, relative position between the objects.
|
| 366 |
+
|
| 367 |
+
2. Don’t ask the question you are not confident to answer. Only include question that have definite answer.
|
| 368 |
+
|
| 369 |
+
3. Do not mention that the information source is provided in text/catpion/region description. Always answer as if you are directly looking at the image.
|
| 370 |
+
|
| 371 |
+
4. Make the question as diverse as possible and as complex-reasoning required as possible.”’} ]
|
| 372 |
+
|
| 373 |
+
or sample in fewshot samples: messages.append({"role":"user", "content":sample[‘context’]}) messages.append({"role":"assistant", "content":sample[‘response’]} messages.append({"role":"user", "content":‘\n’.join(query)})
|
| 374 |
+
|
| 375 |
+
Table 14: One example used in in-context learning to construct GPT-Assisted Refer-and-Ground Instructon-Tuning. We encourage readers to refer to the codebase for the prompts for other types.
|
| 376 |
+
|
| 377 |
+

|
| 378 |
+
|
| 379 |
+
# D EXAMPLES AND PROMPTS FOR FERRET-BENCH
|
| 380 |
+
|
| 381 |
+
We leverage GPT-4 to generate three kinds of region-based questions evaluating referring and grounding capability: (i) Referring Description, (ii) Referring Reasoning, and (iii) Grounding in Conversation. Here, we only provide the prompt in Table 15 used to generate the referring description response. One example of GPT-4 answers is shown in Table 16. We recommend readers check out more examples in Appendix E.
|
| 382 |
+
|
| 383 |
+
Table 15: In this example, we provide the prompt used to generate the referring description response.
|
| 384 |
+
|
| 385 |
+
messages $=$ [ {"role":"system", "content": f”’You are an AI visual assistant that can analyze a single image. You receive five global captions, each describing the same image you are observing. In addition, specific object locations within the image are given, along with detailed coordinates. These coordinates are in the form of bounding boxes, represented as (x1, y1, x2, y2) with floating numbers ranging from 0 to 1. These values correspond to the top left x, top left y, bottom right $\mathbf { X }$ , and bottom right y. Also, the relationships between pairs of objects are provided, in the format of object relationship subject, where the object/subject are indexed by object id from previous object lists as well as the object names. Also, several region description are given, each describing a box region of image, with detailed coordinates.
|
| 386 |
+
|
| 387 |
+
The task is to use the provided image information (objects, attribute, relationship, region description, captions), create a plausible and challenging question about the image, and provide the answer in detail.
|
| 388 |
+
|
| 389 |
+
Create questions that refer to coordinates of some objects or regions without describing it, and ask about its interaction with surrounding/nearby objects.
|
| 390 |
+
|
| 391 |
+
To answer such questions, one should require first understanding the visual content, then based on the spatial information provided.
|
| 392 |
+
|
| 393 |
+
Here are some additional requirements about generated questions and answers:
|
| 394 |
+
|
| 395 |
+
1. In question, you must mention bounding box coordinates to refer to the object or regions, instead of directly say the object name or describing the regions in text. In answers, explain the region in the context of scene. Include details like object counts, position of the objects, relative position between the objects.
|
| 396 |
+
|
| 397 |
+
2. Don’t ask the question you are not confident to answer. Only include question that have definite answer.
|
| 398 |
+
|
| 399 |
+
3. Do not mention that the information source is provided in text/catpion/region description. Always answer as if you are directly looking at the image.
|
| 400 |
+
|
| 401 |
+
4. Don’t mention additional coordinates in the answer.
|
| 402 |
+
|
| 403 |
+
5. Question should be explicitly ask about context/surrounding/nearby information/interaction.”’} for sample in fewshot samples: messages.append({"role":"user", "content":sample[‘context’]}) messages.append({"role":"assistant", "content":sample[‘response’]} messages.append({"role":"user", "content":‘\n’.join(query)})
|
| 404 |
+
|
| 405 |
+
Table 16: One example of GPT4’s answers about referring description.
|
| 406 |
+
|
| 407 |
+
# Conversation
|
| 408 |
+
|
| 409 |
+
Question:
|
| 410 |
+
|
| 411 |
+
Describe the region [0.102, 0.230, 0.578, 0.761] in the context of surrounding objects. Answer:
|
| 412 |
+
|
| 413 |
+
It’s a man in the region, who is standing on top of a skateboard, performing a rail grind over a metal hand rail. There is a bench and a tree near him. Also, he is in front of some buildings.
|
| 414 |
+
|
| 415 |
+

|
| 416 |
+
|
| 417 |
+
# E MORE VISUALIZATION
|
| 418 |
+
|
| 419 |
+
We provide more quantitative results of the predictions under various tasks from Ferret to indicate the model’s strength and capability.
|
| 420 |
+
|
| 421 |
+
• Please refer to Figure 5 for Referring Object Classification on LVIS with different referring formats (point/box/).
|
| 422 |
+
• Please refer to Figure 6 for Visual Grounding on Flickr30k Entities and Referring Expression Comprehension on RefCOCO/RefCOCO $^ +$ /RefCOCOg.
|
| 423 |
+
• Please refer to Figure 7 for Grounded Captioning on Flickr30k Karpathy split.
|
| 424 |
+
• Please refer to Figure 8 for Evaluating Object Hallucination (POPE) on COCO val split.
|
| 425 |
+
• Please refer to Table 17 for Referring Description in Ferret-Bench.
|
| 426 |
+
• Please refer to Table 18 for Referring Resoning in Ferret-Bench.
|
| 427 |
+
• Please refer to Table 19 for Grounding in Conversation in Ferret-Bench.
|
| 428 |
+
|
| 429 |
+
# Referring Object Classification (LVIS) – point
|
| 430 |
+
|
| 431 |
+

|
| 432 |
+
Figure 5: Referring Object Classification on LVIS. The task aims to classify specific region(s) in an image given by point/box/segmentation inputs.
|
| 433 |
+
|
| 434 |
+

|
| 435 |
+
Figure 6: Phrase Grounding on Flickr30k Entities and Referring Expression Comprehension on RefCOCO/RefCOCO $+ \prime$ /RefCOCOg. The tasks aim to localize specific object(s) in an image described by a referring expression/given entity.
|
| 436 |
+
|
| 437 |
+

|
| 438 |
+
Figure 7: Grounded Captioning on Flickr30k. The task aims to generate a caption about the image and ground all generated noun phrases to image regions.
|
| 439 |
+
|
| 440 |
+

|
| 441 |
+
Figure 8: Object Hallucination Evaluation (POPE) on COCO. The task aims to input a query inquiring about the existence of an object, and the model is expected to generate a response in the form of either “yes/no”.
|
| 442 |
+
|
| 443 |
+
Table 17: Referring Description in Ferret-Bench. Qualitative examples to illustrate the difference between various models (LLaVA vs. Kosmos-2 vs. Shikra vs. Ferret (Ours)). For clarity, we have omitted the bounding box outputs in the textual representations.
|
| 444 |
+
|
| 445 |
+
# Question:
|
| 446 |
+
|
| 447 |
+
What is the interaction between the object [region0] and its surrounding objects?
|
| 448 |
+
|
| 449 |
+
# Ground Truth:
|
| 450 |
+
|
| 451 |
+
In the region, there is a metal support column. This column is providing support for a bridge above it, which a train is passing over. The column also features a red line on it. This region is part of a larger scene that includes a train track on an elevated bridge.
|
| 452 |
+
|
| 453 |
+

|
| 454 |
+
|
| 455 |
+
# LLaVA:
|
| 456 |
+
|
| 457 |
+
The object is a bridge which appears to be a part of a train station, as there are traffic lights present in the scene. The traffic lights are likely used to control the train’s movement and ensure safe passage over the bridge.
|
| 458 |
+
|
| 459 |
+
# Kosmos-2:
|
| 460 |
+
|
| 461 |
+
The interaction between the object and its surroundings is that of a train passing over a bridge.
|
| 462 |
+
|
| 463 |
+
# Shikra:
|
| 464 |
+
|
| 465 |
+
The metal pole is standing tall and straight, supporting the train that is traveling on the elevated track.
|
| 466 |
+
|
| 467 |
+
# Ferret (Ours):
|
| 468 |
+
|
| 469 |
+
The object is a metal post that is part of a bridge. This post is essential because it supports the bridge structure, ensuring its stability for the train to safely traverse the bridge. Other elements such as the train, and the overhead guard rail, depend on this post for support and stability. Without this post, the bridge wouldn’t be able to withstand the train’s weight and motion, potentially leading to a structural collapse. Therefore, this post plays a critical role in maintaining the bridge’s integrity and stability.
|
| 470 |
+
|
| 471 |
+
# Question:
|
| 472 |
+
|
| 473 |
+
What is the relationship between the object [region0] and object [region1] and its surrounding objects?
|
| 474 |
+
|
| 475 |
+
# Ground Truth:
|
| 476 |
+
|
| 477 |
+
The object is a vase, and the object is a flower. The flower is in the vase, suggesting it is a decorative element within the room.
|
| 478 |
+
|
| 479 |
+

|
| 480 |
+
|
| 481 |
+
LLaVA:
|
| 482 |
+
A wooden table with a green bowl placed on it. Kosmos-2:
|
| 483 |
+
The object is a vase with a green base.
|
| 484 |
+
Shikra:
|
| 485 |
+
The answer is flowers.
|
| 486 |
+
|
| 487 |
+
# Ferret (Ours):
|
| 488 |
+
|
| 489 |
+
The object and object are a vase and a flower, respectively. The vase is holding the flower, suggesting it’s displaying or supporting it.
|
| 490 |
+
|
| 491 |
+
Table 18: Referring Reasoning in Ferret-Bench. Qualitative examples to illustrate the difference between various models (LLaVA vs. Kosmos-2 vs. Shikra vs. Ferret (Ours)). For clarity, we have omitted the bounding box outputs in the textual representations.
|
| 492 |
+
|
| 493 |
+
# Question:
|
| 494 |
+
|
| 495 |
+
What is the purpose of the object [region0]?
|
| 496 |
+
|
| 497 |
+
# Ground Truth:
|
| 498 |
+
|
| 499 |
+
The object is a bottle. Bottles are typically used to hold and store different types of liquids. In this context, it might be used to store a beverage for the meal.
|
| 500 |
+
|
| 501 |
+

|
| 502 |
+
|
| 503 |
+
# LLaVA:
|
| 504 |
+
|
| 505 |
+
A knife and a fork, indicating that it is ready for a meal.
|
| 506 |
+
|
| 507 |
+
The purpose of the object is to attract the birds to the table.
|
| 508 |
+
|
| 509 |
+
Shikra: The answer is keep birds away.
|
| 510 |
+
|
| 511 |
+
Ferret (Ours):
|
| 512 |
+
|
| 513 |
+
The object is a bottle, generally used to store and dispense liquids like water, juice, or other beverages.
|
| 514 |
+
|
| 515 |
+
# Question:
|
| 516 |
+
|
| 517 |
+
What is the purpose of the object [region0] on the bike?
|
| 518 |
+
|
| 519 |
+
# Ground Truth:
|
| 520 |
+
|
| 521 |
+
The object is a shock absorber on the bike. Its purpose is to absorb or dampen shock impulses. It does this by converting the kinetic energy of the shock into another form of energy which is then dissipated. In the context of the motorcycle, it is particularly useful in providing comfort and stability for the rider, especially when travelling over uneven or rough terrains.
|
| 522 |
+
|
| 523 |
+

|
| 524 |
+
|
| 525 |
+
# LLaVA:
|
| 526 |
+
|
| 527 |
+
A black and silver Kawasaki motorcycle which is likely used for transportation, commuting, leisure rides, or long-distance travel.
|
| 528 |
+
|
| 529 |
+
# Kosmos-2:
|
| 530 |
+
|
| 531 |
+
The purpose of the object on the motorcycle is to store and protect the motorcycle’s fuel tank.
|
| 532 |
+
|
| 533 |
+
Shikra: The answer is leg.
|
| 534 |
+
|
| 535 |
+
# Ferret (Ours):
|
| 536 |
+
|
| 537 |
+
The object is a shock absorber. This component is essential for the bike’s stability, providing a smoother ride by soaking up the impact from bumps and uneven surfaces. It significantly improves the overall performance and comfort of the bike, enabling the rider to maintain control and stability even on rough terrains.
|
| 538 |
+
|
| 539 |
+
Table 19: Grounding in Conversation in Ferret-Bench. Qualitative examples to illustrate the difference between various models (Kosmos-2 vs. Shikra vs. Ferret (Ours)). For clarity, we only display the bounding box outputs in Ferret ’s responses.
|
| 540 |
+
|
| 541 |
+
# Question:
|
| 542 |
+
|
| 543 |
+
What is happening in the field and provide the coordinates of mentioned objects?
|
| 544 |
+
|
| 545 |
+
# Ground Truth:
|
| 546 |
+
|
| 547 |
+
In the image, there is a group of sheep [box0] [box1] grazing in a field [box2]. The field is filled with plant life [box3]. There is also a bush [box4] and some trees [box5] present in the field.
|
| 548 |
+
|
| 549 |
+

|
| 550 |
+
|
| 551 |
+
# Kosmos-2:
|
| 552 |
+
|
| 553 |
+
In the field, a herd of sheep [box0] is grazing on the lush green grass [box1].
|
| 554 |
+
|
| 555 |
+
# Shikra:
|
| 556 |
+
|
| 557 |
+
A group of sheep [box0] [box1] [box2] [box3] [box4] [box5] grazing on lush green grass.
|
| 558 |
+
|
| 559 |
+
# Ferret (Ours):
|
| 560 |
+
|
| 561 |
+
In the field, there are sheep [box0] [box1] [box2] [box3] [box4] [box5] grazing on the grass [box6].
|
| 562 |
+
|
| 563 |
+
# Question:
|
| 564 |
+
|
| 565 |
+
What is the man doing and what objects are in front of him? Please provide the coordinates of these objects.
|
| 566 |
+
|
| 567 |
+

|
| 568 |
+
|
| 569 |
+
# Ground Truth:
|
| 570 |
+
|
| 571 |
+
The man [box0] is sitting at a table [box1] and looking at a plate of food [box2] . There is a glass [box3] and a bottle [box4] on the table in front of him.
|
| 572 |
+
|
| 573 |
+
# Kosmos-2:
|
| 574 |
+
|
| 575 |
+
The man is sitting at a dining table [box0] smiling and looking at the plate of food in front him [box1].
|
| 576 |
+
|
| 577 |
+
# Shikra:
|
| 578 |
+
|
| 579 |
+
The man [box0] is sitting at a table [box1] with a plate of food [box2] in front of him. He is looking up and smiling, possibly staring at a person [box0] in the restaurant
|
| 580 |
+
|
| 581 |
+
# Ferret (Ours):
|
| 582 |
+
|
| 583 |
+
The man [box0] is having a meal at a table [box1]. In front of him, there is a plate [box2] with a variety of food items such as fruit and eggs. There is also a glass [box3] filled with water and a bottle [box4].
|
md/test/3xHDeA8Noi/3xHDeA8Noi.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/4WnqRR915j/4WnqRR915j.md
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LLEMMA: AN OPEN LANGUAGE MODEL FOR MATHEMATICS
|
| 2 |
+
|
| 3 |
+
Zhangir Azerbayev 1,2 Hailey Schoelkopf 2 Keiran Paster 3,4 Marco Dos Santos 5 Stephen McAleer 6 Albert Q. Jiang 5 Jia Deng 1 Stella Biderman 2 Sean Welleck 6,7
|
| 4 |
+
|
| 5 |
+
1 Princeton University 2 EleutherAI 3 University of Toronto 4 Vector Institute 5 University of Cambridge 6 Carnegie Mellon University 7 University of Washington
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
We present LLEMMA, a large language model for mathematics. We continue pretraining Code Llama on Proof-Pile-2, a mixture of scientific papers, web data containing mathematics, and mathematical code, yielding LLEMMA. On the MATH benchmark LLEMMA outperforms all known open base models, as well as the unreleased Minerva model suite on an equi-parameter basis. Moreover, LLEMMA is capable of tool use and formal theorem proving without any further finetuning. We openly release all artifacts, including 7 billion and 34 billion parameter models, the Proof-Pile-2, and code to replicate our experiments.1
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Language models trained on diverse mixtures of text display remarkably general language understanding and generation capabilities (Brown et al., 2020; Chowdhery et al., 2022), serving as base models that are adapted to a wide range of applications (Raffel et al., 2023). Applications such as open-ended dialogue (Thoppilan et al., 2022; Touvron et al., 2023) or instruction following (Ouyang et al., 2022; Wei et al., 2022) require balanced performance across the entire distribution of natural text, thus favoring generalist models. However, if we seek to maximize performance within one domain, such as medicine (Singhal et al., 2022; 2023), finance (Wu et al., 2023), or science (Taylor et al., 2022), a domain-specific language model may offer superior capabilities for a given computational cost, or lower computational cost for a given level of capability.
|
| 14 |
+
|
| 15 |
+
In this work, we train a domain-specific language model for mathematics. We have several motivations for doing so. First, solving mathematical problems requires pattern matching against a large body of specialized prior knowledge, thus serving as an ideal setting for domain adaptation. Second, mathematical reasoning is in itself a central AI task, its study dating back to at least Gelernter (1959) and Wang (1960) and continuing to today (Lu et al., 2023). Third, language models capable of strong mathematical reasoning are upstream of a number of research topics, such as reward modeling (Uesato et al., 2022; Lightman et al., 2023), reinforcement learning for reasoning (Polu et al., 2022; Lample et al., 2022), and algorithmic reasoning (Zhou et al., 2022; Zhang et al., 2023).
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Continued pretraining on ProofPile-2 yields LLEMMA, a base model with improved mathematical capabilities.
|
| 19 |
+
|
| 20 |
+
Although domain-specific models for mathematics have been trained in the past, they have either been closed access (Lewkowycz et al., 2022), limiting their ability to become a platform for further research, or have lagged far behind the closed access state-of-the-art (Azerbayev et al., 2023).
|
| 21 |
+
|
| 22 |
+
We present a recipe for adapting a language model to mathematics through continued pretraining (Lewkowycz et al., 2022; Rozière et al., 2023) on Proof-Pile-2, a diverse mixture of math-related text and code. Applying the recipe to Code Llama (Rozière et al., 2023) yields LLEMMA: 7 billion and 34 billion parameter base language models with substantially improved mathematical capabilities.
|
| 23 |
+
|
| 24 |
+
Specifically, our contributions are as follows:
|
| 25 |
+
|
| 26 |
+
1. We train and release the LLEMMA models: 7B and 34B parameter language models specialized for mathematics. The LLEMMA models are a new state-of-the-art for publicly released base models on MATH (Lewkowycz et al., 2022).
|
| 27 |
+
2. We release the AlgebraicStack, a dataset of 11B tokens of code specifically related to mathematics.
|
| 28 |
+
3. We demonstrate that LLEMMA is capable of using computational tools to solve mathematical problems, namely, the Python interpreter and formal theorem provers.
|
| 29 |
+
4. Unlike prior mathematics language models such as Minerva (Lewkowycz et al., 2022), the LLEMMA models are open access and we open source our training data and code. This allows LLEMMA to serve as a platform for future research in mathematical reasoning.
|
| 30 |
+
|
| 31 |
+
Our work builds on findings in Minerva (Lewkowycz et al., 2022), but differs in several ways: (1) LLEMMA’s training and evaluation covers a wider range of data and tasks, notably code data (e.g., the AlgebraicStack), tool use, and formal mathematics; (2) our work only depends on publicly accessible tools and data; (3) we provide new analyses related to the continued training data mixture, memorization, and additional supervised finetuning; (4) we make all artifacts publicly available.
|
| 32 |
+
|
| 33 |
+
# 2 APPROACH
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
|
| 37 |
+
LLEMMA models are 7 billion and 34 billion parameter language models specialized for mathematics. Our approach is to continue pretraining Code Llama (Rozière et al., 2023) on the Proof-Pile-2.
|
| 38 |
+
Figure 2: Comparison of LLEMMA and Minerva training
|
| 39 |
+
|
| 40 |
+
<table><tr><td>Dataset</td><td>Tokens Open</td><td></td></tr><tr><td>Minerva Dataset</td><td>38.5B</td><td>X</td></tr><tr><td>Proof-Pile-2 (ours)</td><td>55B</td><td>√</td></tr><tr><td>Code (AlgebraicStack)</td><td>11B</td><td>√</td></tr><tr><td>OpenWebMath (Paster et al.,2023))</td><td>15B</td><td></td></tr><tr><td>ArXiv (Computer, 2023))</td><td>29B</td><td></td></tr></table>
|
| 41 |
+
|
| 42 |
+
# 2.1 DATA: Proof-Pile-2
|
| 43 |
+
|
| 44 |
+
We form the Proof-Pile-2, a 55B-token mixture of scientific papers, web data containing mathematics, and mathematical code. With the exception of the Lean proofsteps subset (see Appendix B), the Proof-Pile-2 has a knowledge cutoff of April 2023.
|
| 45 |
+
|
| 46 |
+
Code. Computational tools such as numerical simulations, computer algebra systems, and formal theorem provers are of ever increasing importance to mathematicians (Avigad, 2018). Motivated by this fact, we create AlgebraicStack, an 11B-token dataset of source code from 17 languages, spanning numerical, symbolic, and formal math. The dataset consists of filtered code from the Stack (Kocetkov et al., 2022), public GitHub repositories, and formal proofstep data. Table 9 shows the number of tokens by language in AlgebraicStack. See Appendix B.1 for further details on AlgebraicStack.
|
| 47 |
+
|
| 48 |
+
Web data. We use OpenWebMath (Paster et al., 2023), a 15B-token dataset of high-quality web pages filtered for mathematical content. OpenWebMath filters CommonCrawl web pages based on math-related keywords and a classifier-based math score, preserves mathematical formatting (e.g., LATEX, AsciiMath), and includes additional quality filters (e.g., perplexity, domain, length) and near-deduplication. Refer to Paster et al. (2023) for a full description of OpenWebMath.
|
| 49 |
+
|
| 50 |
+
Scientific papers. We use the ArXiv subset of RedPajama (Computer, 2023), an open-access reproduction of the LLaMA training dataset. The ArXiv subset contains 29B tokens.
|
| 51 |
+
|
| 52 |
+
General natural language and code data. Following Lewkowycz et al. (2022), our training mixture consists of a small amount of general domain data, which functions as a form of regularization. Since the pretraining dataset for LLaMA 2 is undisclosed, we use the Pile (Gao et al., 2020; Biderman et al., 2022) as a surrogate training dataset. We set $9 5 \%$ of our training mixture to be the Proof-Pile-2, $2 \%$ to be from the Pile (with ArXiv removed, as it is separately in Proof-Pile-2), and $3 \%$ to be the GitHub subset of RedPajama (Computer, 2023).
|
| 53 |
+
|
| 54 |
+
Further information on dataset composition and a datasheet are in Appendix B and Appendix E, respectively. We publicly release Proof-Pile-2 at hf.co/datasets/EleutherAI/proof-pile-2.
|
| 55 |
+
|
| 56 |
+
# 2.2 MODEL AND TRAINING
|
| 57 |
+
|
| 58 |
+
Each model is initialized from Code Llama (Rozière et al., 2023). Code Llama models are decoderonly transformer language models initialized from Llama 2 (Touvron et al., 2023) and further trained on 500B tokens of code. We continue training the Code Llama models on Proof-Pile-2 using a standard autoregressive language modeling objective. We train the 7B model for 200B tokens, and the 34B model for 50B tokens.
|
| 59 |
+
|
| 60 |
+
We train all models in bfloat16 mixed precision using the GPT-NeoX library (Andonian et al., 2023) across 256 A100 40GB GPUs. We use Tensor Parallelism (Shoeybi et al., 2019) with a world size of 2 for LLEMMA-7B , and a world size of 8 for LLEMMA-34B, alongside ZeRO Stage 1 sharded optimizer states (Rajbhandari et al., 2020) across Data Parallel (Goyal et al., 2017) replicas. We use Flash Attention 2 (Dao, 2023) to improve throughput and further reduce memory requirements.
|
| 61 |
+
|
| 62 |
+
LLEMMA 7B is trained for 42, 000 steps with a global batch size of 4 million tokens and a 4096 token context length. This corresponds to roughly 23, 000 A100-hours. The learning rate is warmed up to $1 \cdot 1 0 ^ { - 4 }$ over 500 steps, then set to cosine decay to $1 / 3 0 0 \mathrm { { t h } }$ of the maximum learning rate over 48, 000 steps. The reason for the discrepancy between the number of training steps and the scheduler length is that we planned to train for 48, 000 steps, but encountered NaN losses after step 42, 000, likely caused by unstable optimization or hardware failures (Elsen et al., 2023).
|
| 63 |
+
|
| 64 |
+
LLEMMA 34B is trained for 12, 000 steps with a global batch size of 4 million tokens and a 4096 context length. This corresponds to roughly 47, 000 A100-hours. The learning rate is warmed up to $5 \cdot 1 0 ^ { - 5 }$ over 500 steps, then decayed to 1/30th the peak learning rate.
|
| 65 |
+
|
| 66 |
+
Before training LLEMMA 7B, we contract the RoPE (Su et al., 2022) base period of the Code Llama 7B initialization from $\theta = 1 , 0 0 0 , 0 0 0$ to $\theta = 1 0 , 0 0 0$ . This is so that the long context finetuning procedure described in Peng et al. (2023)and Rozière et al. (2023) can be repeated on the trained LLEMMA 7B (we leave actually doing so to future work). Due to compute constraints, we were unable to verify that training LLEMMA 34B with a contracted RoPE base period did not come with a performance penalty, therefore for that model we preserved $\theta = 1 , 0 0 0 , 0 0 0$ .
|
| 67 |
+
|
| 68 |
+
# 3 EVALUATION
|
| 69 |
+
|
| 70 |
+
Our goal is to evaluate LLEMMA as a base model for mathematical text. To this end, we compare LLEMMA models using few-shot evaluation (Brown et al., 2020), and primarily focus on state-of-theart models that have not been finetuned on supervised examples for the task. First, we evaluate the model’s ability to solve mathematics problems using chain of thought reasoning (Wei et al., 2023) and majority voting (Wang et al., 2023). Our evaluations include MATH (Hendrycks et al., 2021b) and GSM8k (Cobbe et al., 2021), the de-facto standard benchmarks for evaluating quantitative reasoning in language models (Lewkowycz et al., 2022). Second, we explore few-shot tool use and formal theorem proving. Third, we study the effects of memorization and the data mixture. Appendix G contains a preliminary study of supervised finetuning with LLEMMA.
|
| 71 |
+
|
| 72 |
+
These tasks involve generating self-contained text solutions to problems expressed in $\mathrm { I A T _ { E } X }$ or natural language, without using external tools (Lewkowycz et al., 2022). We use the following evaluation:
|
| 73 |
+
|
| 74 |
+
• MATH (Hendrycks et al., 2021b), a dataset with $1 2 . 5 \mathrm { k }$ problems (5k evaluation) from high-school math competitions. Given a problem statement, the model generates a LATEXsolution and an answer that must match a reference answer. We follow a similar task implementation to Lewkowycz et al. (2022), using their four-example prompt and evaluating answers for exact string match or SymPy equivalence.
|
| 75 |
+
• GSM8k (Cobbe et al., 2021), a dataset of middle-school level math word problems. We use the 8-shot prompt from Wei et al. (2023), as Lewkowycz et al. (2022) do not specify their evaluation prompt or number of few-shot examples.
|
| 76 |
+
• OCWCourses (Lewkowycz et al., 2022), a collection of undergraduate-level STEM problems harvested from MIT’s OpenCourseWare. We use the four-example prompt provided by (Lewkowycz et al., 2022).
|
| 77 |
+
• MMLU-STEM (Hendrycks et al., 2021a), a subset of 18 out of 57 subjects in the MMLU benchmark. We follow Lewkowycz et al. (2022) and use their provided four-example chain-ofthought prompt.
|
| 78 |
+
• SAT, we create a dataset consisting of the 32 math questions that do not contain figures from the May 2023 College Board SAT examination, which is after our model’s knowledge cutoff.
|
| 79 |
+
|
| 80 |
+
# Input:
|
| 81 |
+
|
| 82 |
+
LLEMMA 34B solution: We have
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\begin{array} { r l } { \displaystyle \sum _ { k = 2 } ^ { \infty } f ( k ) = \sum _ { k = 2 } ^ { \infty } \frac { 2 0 0 8 } { j \pi ^ { 2 } } \frac { 1 } { j ^ { k } } = \sum _ { j = 2 } ^ { 2 0 0 8 } \sum _ { k = 2 } ^ { \infty } \frac { 1 } { j ^ { k } } = \sum _ { j = 2 } ^ { 2 0 0 8 } \frac { 1 } { j ^ { 2 } } \sum _ { k = 0 } ^ { \infty } \frac { 1 } { j ^ { 3 } } = \sum _ { j = 2 } ^ { 2 0 0 8 } \frac { 1 } { j ^ { 2 } } \frac { 1 } { 1 - \frac { 1 } { j } } } & { } \\ { = \displaystyle \sum _ { j = 2 } ^ { 2 0 0 8 } \frac { 1 } { j ( j - 1 ) } = \sum _ { j = 2 } ^ { 2 0 0 8 } \left( \frac { 1 } { j - 1 } - \frac { 1 } { j } \right) } & { } \\ { = \left( \frac { 1 } { 1 } - \frac { 1 } { 2 } \right) + \left( \frac { 1 } { 2 } - \frac { 1 } { 3 } \right) + \cdots + \left( \frac { 1 } { 2 0 0 7 } - \frac { 1 } { 2 0 0 8 } \right) } & { } \\ { = 1 - \frac { 1 } { 2 0 0 8 } } & { } \\ { = \left[ \frac { 2 0 0 7 } { 2 0 0 8 } \right] } & { } \end{array}
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Final Answer: The final answer is $\frac { 2 0 0 7 } { 2 0 0 8 }$ .
|
| 89 |
+
|
| 90 |
+
Figure 3: Example of a LLEMMA 34B solution to a MATH (Hendrycks et al., 2021a) problem. This problem is tagged with difficulty level 5, the highest in MATH. The model was conditioned on the 4-shot prompt described in subsection 3.1, and the solution was produced by greedy decoding. The model had to apply two nontrivial steps to solve this problem: (1) noticing that swapping the order of summation simplifies the problem, and (2) noticing that the resulting sum telescopes.
|
| 91 |
+
|
| 92 |
+
We compare with Minerva (Lewkowycz et al., 2022), which continued pretraining the PaLM language model on a dataset of technical content; Code Llama, the initialization of LLEMMA’s continued pretraining; and Llama 2, the initialization of Code Llama’s continued pretraining on code. For open access models, we report scores computed using our evaluation suite, which is implemented as a fork of the Language Model Evaluation Harness (Gao et al., 2021). For Minerva models, we report benchmark scores from Lewkowycz et al. (2022).
|
| 93 |
+
|
| 94 |
+
Results. LLEMMA’s continued pretraining on Proof-Pile-2 improves few-shot performance on the five mathematical benchmarks. LLEMMA 34B improves over Code Llama by 20 percentage points on GSM8k and 13 points on MATH, and LLEMMA 7B outperforms the proprietary Minerva model. Our approach also outperforms all open-weight language models at the time of writing. We conclude that continued pretraining on Proof-Pile-2 is effective for improving a pretrained model’s ability to perform mathematical problem solving.
|
| 95 |
+
|
| 96 |
+
LLEMMA is pretrained on a diverse distribution of mathematics-related data, and is not tuned for a particular task. Therefore, we expect that LLEMMA can adapt to many other tasks via task-specific finetuning and few-shot prompting.
|
| 97 |
+
|
| 98 |
+
Table 1: Results on our five chain-of-thought reasoning tasks with samples generated via greedy decoding. Minerva results are quoted from Lewkowycz et al. (2022). Note that CodeLlama 7B performs worse than random guessing $( 2 5 \% )$ on MMLU and SAT, largely due to failing to conclude its chain of thought with a valid answer.
|
| 99 |
+
|
| 100 |
+
<table><tr><td></td><td></td><td>GSM8k</td><td>OCW</td><td>MMLU-STEM</td><td>SAT</td><td>MATH</td></tr><tr><td>Llama 2</td><td>7B</td><td>11.8%</td><td>3.7%</td><td>29.9%</td><td>25.0%</td><td>3.2%</td></tr><tr><td>Code Llama</td><td>7B</td><td>10.5%</td><td>4.4%</td><td>25.1%</td><td>9.4%</td><td>4.5%</td></tr><tr><td>Minerva</td><td>8B</td><td>16.2%</td><td>7.7%</td><td>35.6%</td><td></td><td>14.1%</td></tr><tr><td>LLEMMA</td><td>7B</td><td>36.4%</td><td>7.7%</td><td>37.7%</td><td>53.1%</td><td>18.0%</td></tr><tr><td>Code Llama</td><td>34B</td><td>29.6%</td><td>7.0%</td><td>40.5%</td><td>40.6%</td><td>12.2%</td></tr><tr><td>LLEMMA</td><td>34B</td><td> 51.5%</td><td>11.8%</td><td>49.0%</td><td>71.9%</td><td>25.0%</td></tr><tr><td>Minerva</td><td>62B</td><td>52.4%</td><td>12.0%</td><td>53.9%</td><td></td><td>27.6%</td></tr><tr><td>Minerva</td><td>540B</td><td>58.8%</td><td>17.6%</td><td>63.9%</td><td>1</td><td>33.6%</td></tr></table>
|
| 101 |
+
|
| 102 |
+
Table 2: Majority voting results for LLEMMA and Minerva. Minerva results are quoted from Lewkowycz et al. (2022). Voting is done with $k = 2 5 6$ for MATH, $k = 1 0 0$ for GSM8k and OCW, and $k = 1 6$ for MMLU-STEM and SAT. We sample with temperature $T = 0 . 6$ for $k = 2 5 6$ and $k = 1 0 0$ and $T = 0 . 3$ for $k = 1 6$ , and use nucleus sampling with $p = 0 . 9 5$ (Holtzman et al., 2020). Due to compute constraints, we do not calculate majority voting scores for Llama 2 and Code Llama.
|
| 103 |
+
|
| 104 |
+
<table><tr><td></td><td></td><td>GSM8k maj@k</td><td>OCW maj@k</td><td>MMLU-STEM maj@k</td><td>SAT maj@k</td><td>MATH maj@k</td></tr><tr><td>Minerva</td><td>8B</td><td>28.4%</td><td>12.5%</td><td>43.4%</td><td></td><td>25.4%</td></tr><tr><td>LLEMMA</td><td>7B</td><td> 54.0%</td><td>14.3%</td><td>49.9%</td><td>78.1%</td><td>33.5%</td></tr><tr><td>LLEMMA</td><td>34B</td><td>69.3%</td><td>18.4%</td><td>59.7%</td><td>81.3%</td><td>43.1%</td></tr><tr><td>Minerva</td><td>62B</td><td>68.5%</td><td>23.5%</td><td>63.5%</td><td></td><td>43.4%</td></tr><tr><td>Minerva</td><td>540B</td><td>78.5%</td><td>30.8%</td><td>75.0%</td><td></td><td>50.3%</td></tr></table>
|
| 105 |
+
|
| 106 |
+
# 3.2 MATHEMATICAL PROBLEM SOLVING WITH TOOL USE
|
| 107 |
+
|
| 108 |
+
These tasks involve solving problems with access to computational tools. We evaluate the following:
|
| 109 |
+
|
| 110 |
+
• MATH+Python, the model is prompted to alternately describe a solution step in natural language, then execute that step with code. The final answer is a program that executes to a numeric type or a SymPy object. Our few-shot prompt includes examples that use built-in numeric operations, the math module, and SymPy.
|
| 111 |
+
GSM8k $+$ Python, solving a GSM8k word problem by writing a Python program that executes to an integer answer. We use the prompt from Gao et al. (2023).
|
| 112 |
+
|
| 113 |
+
Results. As seen in Table 3, LLEMMA improves over Code Llama on both tasks. Its performance on MATH and GSM8k with tools is also higher than its performance on these datasets without tools.
|
| 114 |
+
|
| 115 |
+
Table 3: Mathematical problem solving with tool use.
|
| 116 |
+
|
| 117 |
+
<table><tr><td></td><td></td><td>GSM8k+Python pass@1</td><td>MATH+Python pass@1</td></tr><tr><td>Code Llama</td><td>7B</td><td>27.1%</td><td>17.2%</td></tr><tr><td>LLEMMA</td><td>7B</td><td>40.1%</td><td>21.5%</td></tr><tr><td>Code Llama</td><td>34B</td><td>52.7%</td><td>23.5%</td></tr><tr><td>LLEMMA</td><td>34B</td><td>62.6%</td><td>27.1%</td></tr></table>
|
| 118 |
+
|
| 119 |
+
# 3.3 FORMAL MATHEMATICS
|
| 120 |
+
|
| 121 |
+
Interactive proof assistants such as Lean (de Moura et al., 2015), Isabelle (Wenzel et al., 2008), and Coq (Paulin-Mohring, 1989a;b) express mathematics in programming languages that allow for verification. These languages are data scarce compared to mainstream languages, especially in the context of pretraining. For instance, the Stack dataset used to pretrain language models in the BigCode project (Allal et al., 2023) has over 700 gigabytes of Python, compared to 322 megabytes of Lean. Proof assistants also require models to leverage information that is not present in raw source code, such as goal states that contain information about each step of a proof.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 4: Example formal proofs from LLEMMA-7b. Left: The model is given a problem, informal proof, and formal statement, following Jiang et al. (2023). It generates a formal proof (starting with proof -) containing Isabelle code and calls to automation (shown as ${ < A T P > }$ ). Right: The model is given a proof state, visualized as a grey comment, and generates the subsequent step (e.g. rw [..).
|
| 125 |
+
|
| 126 |
+
Proof-Pile-2’s AlgebraicStack contains over 1.5 billion tokens of formal mathematics data, including proof states extracted from Lean and Isabelle formalizations. While a full investigation of formal math is outside the scope of this paper, we evaluate LLEMMA few-shot on two tasks:
|
| 127 |
+
|
| 128 |
+
• Informal-to-formal proving (Jiang et al., 2023), the task of generating a formal proof, given a formal statement, an informal LATEX statement, and an informal LATEX proof. The formal proof is checked by the proof assistant. We use the Isabelle proof assistant and evaluate on miniF2F (Zheng et al., 2021), a benchmark consisting of problem statements from Olympiads and undergraduate coursework. For the prompt, we use 11 (formal statement, informal statement, informal proof, formal proof) examples from Jiang et al. (2023), selecting 7 examples for number theory problems, and 6 examples for all others. We generate a single proof with greedy decoding.
|
| 129 |
+
|
| 130 |
+
• Formal-to-formal proving (e.g., Polu & Sutskever (2020)), the task of proving a formal statement by generating a sequence of proof steps (tactics). At each step, the input is a state $x _ { t }$ given by the proof assistant, and the language model’s task is to generate a proof step $y _ { t }$ (a sequence of code). The proof step is checked by the proof assistant, yielding a new state $x _ { t + 1 }$ or an error message. The process continues, stopping if a proof is completed or a timeout is reached. We prompt the model using three $( x _ { t } , y _ { t } )$ examples. We evaluate on miniF2F (Zheng et al., 2021) using the Lean 4 proof assistant, and use a standard best first search. See Appendix D for more details.
|
| 131 |
+
|
| 132 |
+
Results. As seen in Table 4, LLEMMA’s continued pretraining on Proof-Pile-2 improved few-shot performance on the two formal theorem proving tasks.
|
| 133 |
+
|
| 134 |
+
<table><tr><td>Method</td><td colspan="2">Informal-to-formal miniF2F-valid miniF2F-test</td></tr><tr><td>Sledgehammer</td><td>14.72%</td><td>20.49%</td></tr><tr><td>Code Llama 7b</td><td>16.31%</td><td>17.62%</td></tr><tr><td>Code Llama 34b</td><td>18.45%</td><td>18.03%</td></tr><tr><td>LLEMMA-7b</td><td>20.60%</td><td>22.13%</td></tr><tr><td>LLEMMA-34b</td><td>21.03%</td><td>21.31%</td></tr></table>
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Method</td><td colspan="2">Formal-to-formal Search miniF2F-test</td></tr><tr><td>ReProver (fine-tuned)</td><td>1×64</td><td>26.50%</td></tr><tr><td>Code Llama 7b</td><td>1×32</td><td>20.49%</td></tr><tr><td>Code Llama 34b</td><td>1×32</td><td>22.13%</td></tr><tr><td>COPRA (GPT-4)</td><td></td><td>23.36%</td></tr><tr><td>LLEMMA-7b</td><td>1×32</td><td>26.23%</td></tr><tr><td>LLEMMA-34b</td><td>1×32</td><td>25.82%</td></tr></table>
|
| 137 |
+
|
| 138 |
+
Table 4: Formal theorem proving tasks. Left: Informal-to-formal proving in Isabelle, showing the percentage of proven theorems with greedy decoding. Right: Formal-to-formal proving in Lean, showing the percentage of proven theorems with the given number of attempts $\times$ generations-periteration of best first search, and a 10-minute timeout. Sledgehammer (Paulson & Nipkow, 2023) is built-in Isabelle automation. ReProver (Yang et al., 2023) is a supervised and retrieval-augmented model. COPRA (Thakur et al., 2023) is a retrieval-augmented GPT-4 based method. † COPRA does not use best first search, but instead samples from GPT-4 (OpenAI, 2023) a maximum of 60 times.
|
| 139 |
+
|
| 140 |
+
On informal-to-formal proving, LLEMMA-7b closes $2 2 . 1 \%$ of the theorems, improving upon its Code Llama initialization and the Sledgehammer prover. The theorems that LLEMMA proves are often complementary to those proved with Sledgehammer: taking the union of Sledgehammer and LLEMMA proofs results in 26 new validation proofs (an 11 percentage-point increase), and 17 new test proofs (a 7 point increase); see Appendix Table 11. Prior to our work, the only demonstration of few-shot proof autoformalization used the proprietary Codex model (Jiang et al., 2023).
|
| 141 |
+
|
| 142 |
+
On Lean 4 formal-to-formal proving, LLEMMA-7b improves upon its Code Llama initialization, and performs similar to ReProver (Yang et al., 2023), a retrieval-augmented language model finetuned for tactic prediction. LLEMMA adapts to the task using a 3 example prompt, which to our knowledge is the first demonstration of few-shot tactic prediction for theorem proving by an open model.
|
| 143 |
+
|
| 144 |
+
# 3.4 IMPACT OF DATA MIXTURE
|
| 145 |
+
|
| 146 |
+
When training a language model, it is common to upsample high-quality subsets of the training data according to mixture weights (Brown et al., 2020; Gao et al., 2020; Xie et al., 2023). We select mixture weights by doing short training runs on several hand-picked mixture weights, then choosing the one which minimizes perplexity on a set of high-quality held-out text (we use the MATH training set). Table 5 shows the MATH training set perplexity of models trained using different mixtures of arXiv to web to code. Based on these results, we trained LLEMMA with a ratio of $2 : 4 : 1$ . Note that our methodology uses the MATH training set to determine a training hyperparameter, though we expect that the effect is similar to that of related high-quality texts.
|
| 147 |
+
|
| 148 |
+
Table 5: MATH training set perplexity of Code Llama 7B models trained using different data mixtures for a reduced number of steps. Each mixture is represented by its arXiv:Web:Code ratio.
|
| 149 |
+
|
| 150 |
+
<table><tr><td>Mixture</td><td colspan="8">MATH training set perplexity</td></tr><tr><td></td><td>Overall</td><td>Prealgebra</td><td>Algebra</td><td>Numbrer</td><td>Countity</td><td>Geometry</td><td>Interedeate</td><td>Precalculus</td></tr><tr><td>2:4:1</td><td>1.478</td><td>1.495</td><td>1.515</td><td>1.552</td><td>1.475</td><td>1.519</td><td>1.439</td><td>1.331</td></tr><tr><td>2:4:2</td><td>1.482</td><td>1.500</td><td>1.519</td><td>1.556</td><td>1.477</td><td>1.524</td><td>1.443</td><td>1.334</td></tr><tr><td>4:2:1</td><td>1.487</td><td>1.505</td><td>1.524</td><td>1.561</td><td>1.481</td><td>1.534</td><td>1.447</td><td>1.338</td></tr><tr><td>4:2:2</td><td>1.489</td><td>1.508</td><td>1.527</td><td>1.562</td><td>1.483</td><td>1.538</td><td>1.447</td><td>1.339</td></tr><tr><td>4:4:1</td><td>1.487</td><td>1.506</td><td>1.525</td><td>1.561</td><td>1.482</td><td>1.529</td><td>1.446</td><td>1.335</td></tr><tr><td>4:4:2</td><td>1.485</td><td>1.503</td><td>1.523</td><td>1.559</td><td>1.480</td><td>1.529</td><td>1.444</td><td>1.334</td></tr></table>
|
| 151 |
+
|
| 152 |
+
# 3.5 DATASET OVERLAP AND MEMORIZATION
|
| 153 |
+
|
| 154 |
+
Do test problems or solutions appear in the corpus? We check whether any 30-gram in a test sequence (either an input problem or an output solution) occurs in any OpenWebMath or AlgebraicStack document. If so, we say that a hit occurred between the sequence and the document. Table 6 shows hits between sequences from MATH and documents from Proof-Pile-2. Using our methodology, around $7 \%$ of MATH test problem statements and $0 . 6 \%$ of MATH test solutions have hits. Note that our methodology gives a lower bound on the number of semantically equivalent sequences (e.g., it does not account for alternative phrasing).
|
| 155 |
+
|
| 156 |
+
We manually inspected 100 uniformly sampled hits between a test problem statement and an OpenWebMath document. 41 of the cases had no solution, which included websites with a list of problems, discussions, or hints. 49 had an alternative solution to the MATH ground-truth solution, but with the same answer. These include solutions that solve the problem differently than the ground-truth, solutions with missing details, and discussions that include the answer. 9 cases had a missing or incorrect answer, and 1 had the same solution as in the ground-truth. In summary, we find that solutions can appear in a corpus derived from web documents, particularly alternative solutions to those in the evaluation set. We repeated our analysis with 20-gram hits and our findings were similar, though with false positives; see Appendix Figure 6 for examples.
|
| 157 |
+
|
| 158 |
+
Table 6: Left: 30-gram hits between MATH test problems or solutions and Proof-Pile-2 documents. Example and Docs are the numbers of unique test examples and Proof-Pile-2 documents with a hit. Right: manual inspection of 100 hits between a problem statement and a Proof-Pile-2 document.
|
| 159 |
+
|
| 160 |
+
<table><tr><td>Proof-Pile-2</td><td>Test</td><td colspan="2"></td><td colspan="2">Example Docs Examputi Docs</td><td colspan="2">Same solution</td></tr><tr><td>OpenWebMath</td><td>MATH</td><td>348</td><td>717</td><td>34</td><td>46</td><td>Different solution, same answer</td><td>49</td></tr><tr><td>AlgebraicStack MATH</td><td></td><td>3</td><td>3</td><td>1</td><td>1</td><td>Different solution, different ans wer</td><td>9</td></tr><tr><td>OpenWebMath</td><td>GSM8k</td><td>2</td><td>3</td><td>0</td><td>0</td><td>No solution</td><td>41</td></tr><tr><td>AlgebraicStack GSM8k</td><td></td><td>0</td><td>0</td><td>0</td><td>0</td><td>Different problem</td><td>0</td></tr></table>
|
| 161 |
+
|
| 162 |
+
# How do problems in the corpus impact performance?
|
| 163 |
+
|
| 164 |
+
Next, we evaluate LLEMMA-34b on the test examples with a 30-gram hit, and the test examples without a 30- gram hit. Table 7 shows the accuracy partitioned by MATH difficulty level. The model’s accuracy remains low on difficult problems (e.g., $6 . 0 8 \%$ on Level 5 problems with a hit, versus $6 . 3 9 \%$ on problems without a hit), and we observe no clear relationship between 30-gram hits and accuracy across difficulty levels. We conclude that a nontrivial match between a test example and a training document did not imply that the model generated a memorized correct answer. We repeated the analysis with 20-grams and with the 7b model, and our findings were analogous. Figure 7 shows an example.
|
| 165 |
+
|
| 166 |
+
<table><tr><td>MATH Level</td><td>Hit Accuracy</td><td>Nonhit Accuracy</td><td>#Hits</td></tr><tr><td>Level 1</td><td>72.73</td><td>61.50</td><td>11</td></tr><tr><td>Level 2</td><td>35.71</td><td>40.18</td><td>28</td></tr><tr><td>Level 3</td><td>30.36</td><td>26.88</td><td>56</td></tr><tr><td>Level 4</td><td>14.89</td><td>16.61</td><td>94</td></tr><tr><td>Level 5</td><td>6.08</td><td>6.39</td><td>181</td></tr></table>
|
| 167 |
+
|
| 168 |
+
Table 7: LLEMMA-34b’s accuracy on hits (a 30-gram overlap between a problem or solution and a training sequence) and nonhits by MATH difficulty level.
|
| 169 |
+
|
| 170 |
+
Finally, we check 30-gram hits between LLEMMA’s MATH generations and OpenWebMath. There were 13 hits, which occurred when the model generated a common sequence of numbers (e.g., a list of Fibonacci numbers), plus one instance of factoring a polynomial. Appendix Figure 6 shows an example. We find all of these observations worthy of further study. Using LLEMMA and Proof-Pile-2 to better understand data, memorization, and performance is an interesting future direction. We include the code for our analysis in the LLEMMA repository.
|
| 171 |
+
|
| 172 |
+
# 4 RELATED WORK
|
| 173 |
+
|
| 174 |
+
Large-scale language modeling. Recent progress in large language models involves two connected threads: the increasing scale of models and data (Hoffmann et al., 2022; Kaplan et al., 2020; Chowdhery et al., 2022), and a progression toward more generalist models (Radford et al., 2019; Brown et al., 2020) which are capable of solving diverse problems and adapting quickly to novel tasks. A third thread relates to enabling open access to language models with these capabilities (Black et al., 2022; Biderman et al., 2023; Touvron et al., 2023; Rozière et al., 2023). Our work provides a recipe for specializing these language models to the domain of mathematics, providing a platform for further research and applications.
|
| 175 |
+
|
| 176 |
+
Domain adaptation. Language model applications typically require a general-domain pretraining step, followed by a shorter fine-tuning step. The finetuning step is often aimed at imbuing instructionfollowing ability (Sanh et al., 2022; Wei et al., 2022) or aligning a model’s outputs with human preferences (Ziegler et al., 2019; Ouyang et al., 2022; Bai et al., 2022). Other work explores adapting pretrained models to novel domains by continued training (Rozière et al., 2023; Beltagy et al., 2019), parameter-efficient finetuning methods (Yong et al., 2023), retrieval augmentation (Min et al., 2023; Asai et al., 2023), and other techniques. We provide an adaptation recipe involving continued training and targeted data collection.
|
| 177 |
+
|
| 178 |
+
Language models for mathematics. Applying large language models to problems in mathematics is an active subfield of machine learning, including benchmarking mathematical knowledge and reasoning at varying levels (Hendrycks et al., 2021b; Zheng et al., 2021; Welleck et al., 2022; Azerbayev et al., 2023). Although achieving strong mathematical reasoning is an important target, it is difficult to assess the correctness of models’ answers and processes, especially as models become more capable (Bowman et al., 2022; Uesato et al., 2022; Lightman et al., 2023; Cobbe et al., 2021).
|
| 179 |
+
|
| 180 |
+
A number of recent works focus on supervised finetuning on task-relevant (input, output) pairs (e.g.,Yu et al. (2023); Yue et al. (2023)). Doing so boosts performance on some common mathematical language modeling benchmarks, but trains the model for these specific tasks. In contrast, Lewkowycz et al. (2022) and our work seek to train a base language model as a platform for further development.
|
| 181 |
+
|
| 182 |
+
Language models for formal mathematics. An ongoing line of work explores integrating language models with interactive proof assistants in the context of mathematics. This includes synthesizing proofs via tactic prediction (Polu & Sutskever, 2020; Han et al., 2022; Lample et al., 2022; Jiang et al., 2022), autoformalization (Wu et al., 2022; Jiang et al., 2023), and integrated tools (Welleck & Saha, 2023). Due to high computational costs of search, language models applied to this domain have traditionally been small, but recent work has demonstrated promise in the use of larger models (First et al., 2023; Jiang et al., 2023). Our work provides a demonstration of few-shot proof autoformalization and tactic prediction, a large collection of formal mathematics data, along with an open access model for further exploring these directions.
|
| 183 |
+
|
| 184 |
+
# 5 CONCLUSION
|
| 185 |
+
|
| 186 |
+
We introduce LLEMMA and Proof-Pile-2, a novel base model and corpus for language modeling of mathematics. Our models, dataset, and code are openly available. We have shown that LLEMMA achieves state-of-the-art results for open-weights models on mathematical problem solving benchmarks, shown capabilities of using external tools via Python code, and demonstrated few-shot tactic prediction for theorem proving. We hope that LLEMMA and Proof-Pile-2 will be a useful base for future work on understanding language model generalization and dataset composition, investigating the limits of domain-specific language models, using language models as tools for mathematicians, and improving the mathematical capabilities of language models.
|
| 187 |
+
|
| 188 |
+
# ACKNOWLEDGEMENTS
|
| 189 |
+
|
| 190 |
+
We would like to thank Dragomir Radev, Arman Cohan, Jesse Michael Han, and the Deepmind Blueshift team for valuable guidance. We thank Jonah Philion for the model name. We thank Aviya Skowron for advising us on ethical considerations in the development and release of our models. We thank Jonathan Laurent and Leo Du for contributions to our open-source code.
|
| 191 |
+
|
| 192 |
+
We would also like to thank several parties for donating computing resources for this project: Stability AI (training the LLEMMA models), CoreWeave (evaluations and finetuning), the Province of Ontario and companies sponsoring the Vector Institute for Artificial Intelligence (www.vectorinstitute.ai/partners), and Brigham Young University (finetuning). KP is supported by an NSERC PGS-D award.
|
| 193 |
+
|
| 194 |
+
# REFERENCES
|
| 195 |
+
|
| 196 |
+
Loubna Ben Allal, Raymond Li, Denis Kocetkov, Chenghao Mou, Christopher Akiki, Carlos Munoz Ferrandis, Niklas Muennighoff, Mayank Mishra, Alex Gu, Manan Dey, Logesh Kumar Umapathi, Carolyn Jane Anderson, Yangtian Zi, Joel Lamy Poirier, Hailey Schoelkopf, Sergey Troshin, Dmitry Abulkhanov, Manuel Romero, Michael Lappert, Francesco De Toni, Bernardo García del Río, Qian Liu, Shamik Bose, Urvashi Bhattacharyya, Terry Yue Zhuo, Ian Yu, Paulo Villegas, Marco Zocca, Sourab Mangrulkar, David Lansky, Huu Nguyen, Danish Contractor, Luis Villa, Jia Li, Dzmitry Bahdanau, Yacine Jernite, Sean Hughes, Daniel Fried, Arjun Guha, Harm de Vries, and Leandro von Werra. Santacoder: don’t reach for the stars! In Deep Learning for Code (DL4C) Workshop, 2023.
|
| 197 |
+
Alex Andonian, Quentin Anthony, Stella Biderman, Sid Black, Preetham Gali, Leo Gao, Eric Hallahan, Josh Levy-Kramer, Connor Leahy, Lucas Nestler, Kip Parker, Michael Pieler, Jason Phang, Shivanshu Purohit, Hailey Schoelkopf, Dashiell Stander, Tri Songz, Curt Tigges, Benjamin Thérien, Phil Wang, and Samuel Weinbach. GPT-NeoX: Large scale autoregressive language modeling in PyTorch. GitHub Repo, 9 2023. URL https://www.github.com/eleutherai/ gpt-neox.
|
| 198 |
+
Akari Asai, Sewon Min, Zexuan Zhong, and Danqi Chen. Retrieval-based language models and applications. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 6: Tutorial Abstracts), pp. 41–46, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-tutorials.6. URL https: //aclanthology.org/2023.acl-tutorials.6.
|
| 199 |
+
Jeremy Avigad. The mechanization of mathematics. Notices of the AMS, 65(6):681–90, 2018.
|
| 200 |
+
Zhangir Azerbayev, Bartosz Piotrowski, Hailey Schoelkopf, Edward W. Ayers, Dragomir R. Radev, and Jeremy Avigad. Proofnet: Autoformalizing and formally proving undergraduate-level mathematics. ArXiv, abs/2302.12433, 2023.
|
| 201 |
+
Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022.
|
| 202 |
+
Iz Beltagy, Kyle Lo, and Arman Cohan. SciBERT: A pretrained language model for scientific text. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 3615–3620, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1371. URL https://aclanthology.org/D19-1371.
|
| 203 |
+
Stella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. In International Conference on Machine Learning, pp. 2397–2430. PMLR, 2023.
|
| 204 |
+
|
| 205 |
+
Stella Rose Biderman, Kieran Bicheno, and Leo Gao. Datasheet for the pile. ArXiv, abs/2201.07311, 2022.
|
| 206 |
+
|
| 207 |
+
Sidney Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, et al. Gpt-neox-20b: An open-source autoregressive language model. In Proceedings of BigScience Episode# 5–Workshop on Challenges & Perspectives in Creating Large Language Models, pp. 95–136, 2022.
|
| 208 |
+
Samuel R. Bowman, Jeeyoon Hyun, Ethan Perez, Edwin Chen, Craig Pettit, Scott Heiner, Kamile˙ Lukošiut¯ e, Amanda Askell, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron ˙ McKinnon, Christopher Olah, Daniela Amodei, Dario Amodei, Dawn Drain, Dustin Li, Eli TranJohnson, Jackson Kernion, Jamie Kerr, Jared Mueller, Jeffrey Ladish, Joshua Landau, Kamal Ndousse, Liane Lovitt, Nelson Elhage, Nicholas Schiefer, Nicholas Joseph, Noemí Mercado, Nova DasSarma, Robin Larson, Sam McCandlish, Sandipan Kundu, Scott Johnston, Shauna Kravec, Sheer El Showk, Stanislav Fort, Timothy Telleen-Lawton, Tom Brown, Tom Henighan, Tristan Hume, Yuntao Bai, Zac Hatfield-Dodds, Ben Mann, and Jared Kaplan. Measuring progress on scalable oversight for large language models. arXiv preprint arXiv:2211.03540, 2022.
|
| 209 |
+
Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, T. J. Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeff Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. ArXiv, abs/2005.14165, 2020.
|
| 210 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
|
| 211 |
+
Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
|
| 212 |
+
Katherine M. Collins, Albert Q. Jiang, Simon Frieder, Lionel Wong, Miri Zilka, Umang Bhatt, Thomas Lukasiewicz, Yuhuai Wu, Joshua B. Tenenbaum, William Hart, Timothy Gowers, Wenda Li, Adrian Weller, and Mateja Jamnik. Evaluating language models for mathematics through interactions. arXiv preprint arXiv:2306.01694, 2023.
|
| 213 |
+
Together Computer. Redpajama: An open source recipe to reproduce llama training dataset, April 2023. URL https://github.com/togethercomputer/RedPajama-Data.
|
| 214 |
+
Tri Dao. Flashattention-2: Faster attention with better parallelism and work partitioning. arXiv preprint arXiv:2307.08691, 2023.
|
| 215 |
+
Leonardo de Moura, Soonho Kong, Jeremy Avigad, Floris Van Doorn, and Jakob von Raumer. The lean theorem prover (system description). In Automated Deduction-CADE-25: 25th International Conference on Automated Deduction, Berlin, Germany, August 1-7, 2015, Proceedings 25, pp. 378–388. Springer, 2015.
|
| 216 |
+
Erich Elsen, Curtis Hawthorne, and Arushi Somani. The adventure of the errant hardware, 2023. URL https://www.adept.ai/blog/sherlock-sdc.
|
| 217 |
+
Emily First, Markus N. Rabe, Talia Ringer, and Yuriy Brun. Baldur: Whole-proof generation and repair with large language models. arXiv preprint arXiv:2303.04910, 2023.
|
| 218 |
+
Leo Gao, Stella Rose Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, Shawn Presser, and Connor Leahy. The pile: An $8 0 0 \mathrm { g b }$ dataset of diverse text for language modeling. ArXiv, abs/2101.00027, 2020.
|
| 219 |
+
Leo Gao, Jonathan Tow, Baber Abbasi, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Alain Le Noac’h, Haonan Li, Kyle McDonell, Niklas Muennighoff, Jason Ociepa, Chris Phang, Laria Reynolds, Hailey Schoelkopf, Aviya Skowron, Lintang Sutawika, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, September 2021. URL https://doi.org/10.5281/zenodo. 5371628.
|
| 220 |
+
Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. arXiv preprint arXiv:2211.10435, 2022.
|
| 221 |
+
Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. arXiv preprint arXiv:2211.10435, 2023.
|
| 222 |
+
Timnit Gebru, Jamie Morgenstern, Briana Vecchione, Jennifer Wortman Vaughan, Hanna Wallach, Hal Daumé III au2, and Kate Crawford. Datasheets for datasets, 2021.
|
| 223 |
+
Herbert L. Gelernter. Realization of a geometry theorem proving machine. In IFIP Congress, 1959. URL https://api.semanticscholar.org/CorpusID:18484295.
|
| 224 |
+
Priya Goyal, Piotr Dollár, Ross B. Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: training imagenet in 1 hour. CoRR, abs/1706.02677, 2017. URL http://arxiv.org/abs/1706.02677.
|
| 225 |
+
Jesse Michael Han, Jason Rute, Yuhuai Wu, Edward Ayers, and Stanislas Polu. Proof artifact cotraining for theorem proving with language models. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rpxJc9j04U.
|
| 226 |
+
Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2021a.
|
| 227 |
+
Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. NeurIPS, 2021b.
|
| 228 |
+
Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and L. Sifre. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022.
|
| 229 |
+
Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration, 2020.
|
| 230 |
+
Albert Q. Jiang, Wenda Li, Jesse Michael Han, and Yuhuai Wu. Lisa: Language models of isabelle proofs. 6th Conference on Artificial Intelligence and Theorem Proving, 2021.
|
| 231 |
+
Albert Q. Jiang, Wenda Li, Szymon Tworkowski, Konrad Czechowski, Tomasz Odrzygó´zd´z, Piotr Miłos, Yuhuai Wu, and Mateja Jamnik. Thor: Wielding hammers to integrate language models ´ and automated theorem provers. arXiv preprint arXiv:2205.10893, 2022.
|
| 232 |
+
Albert Qiaochu Jiang, Sean Welleck, Jin Peng Zhou, Timothee Lacroix, Jiacheng Liu, Wenda Li, Mateja Jamnik, Guillaume Lample, and Yuhuai Wu. Draft, sketch, and prove: Guiding formal theorem provers with informal proofs. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SMa9EAovKMC.
|
| 233 |
+
Jared Kaplan, Sam McCandlish, T. J. Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeff Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
|
| 234 |
+
Denis Kocetkov, Raymond Li, Loubna Ben Allal, Jia Li, Chenghao Mou, Carlos Muñoz Ferrandis, Yacine Jernite, Margaret Mitchell, Sean Hughes, Thomas Wolf, Dzmitry Bahdanau, Leandro von Werra, and Harm de Vries. The stack: 3 tb of permissively licensed source code. Preprint, 2022.
|
| 235 |
+
Guillaume Lample, Marie-Anne Lachaux, Thibaut Lavril, Xavier Martinet, Amaury Hayat, Gabriel Ebner, Aurélien Rodriguez, and Timothée Lacroix. Hypertree proof search for neural theorem proving. arXiv preprint arXiv:2205.11491, 2022.
|
| 236 |
+
Aitor Lewkowycz, Anders Johan Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Venkatesh Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. Solving quantitative reasoning problems with language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022.
|
| 237 |
+
Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let’s verify step by step. arXiv preprint arXiv:2305.20050, 2023.
|
| 238 |
+
Pan Lu, Liang Qiu, Wenhao Yu, Sean Welleck, and Kai-Wei Chang. A survey of deep learning for mathematical reasoning. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 14605–14631, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.817. URL https://aclanthology.org/2023.acl-long.817.
|
| 239 |
+
Haipeng Luo, Qingfeng Sun, Can Xu, Pu Zhao, Jianguang Lou, Chongyang Tao, Xiubo Geng, Qingwei Lin, Shifeng Chen, and Dongmei Zhang. Wizardmath: Empowering mathematical reasoning for large language models via reinforced evol-instruct. arXiv preprint arXiv:2308.09583, 2023.
|
| 240 |
+
The mathlib Community. The lean mathematical library. In Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2020, pp. 367–381, New York, NY, USA, 2020. Association for Computing Machinery. ISBN 9781450370974. doi: 10.1145/ 3372885.3373824. URL https://doi.org/10.1145/3372885.3373824.
|
| 241 |
+
Sewon Min, Suchin Gururangan, Eric Wallace, Hannaneh Hajishirzi, Noah A. Smith, and Luke Zettlemoyer. Silo language models: Isolating legal risk in a nonparametric datastore, 2023.
|
| 242 |
+
Scott Morrison. lean-training-data. https://github.com/semorrison/ lean-training-data, 2023.
|
| 243 |
+
OpenAI. Gpt-4 technical report, 2023.
|
| 244 |
+
Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022.
|
| 245 |
+
Keiran Paster, Marco Dos Santos, Zhangir Azerbayev, and Jimmy Ba. Openwebmath: An open dataset of high-quality mathematical web text. CoRR, abs/2310.06786, 2023. doi: 10.48550/ ARXIV.2310.06786. URL https://doi.org/10.48550/arXiv.2310.06786.
|
| 246 |
+
Christine Paulin-Mohring. Extracting $\omega$ ’s programs from proofs in the calculus of constructions. In Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 89–104, 1989a.
|
| 247 |
+
Christine Paulin-Mohring. Extraction de programmes dans le Calcul des Constructions. PhD thesis, Université Paris-Diderot-Paris VII, 1989b.
|
| 248 |
+
Larry Paulson and Tobias Nipkow. The sledgehammer: Let automatic theorem provers write your isabelle scripts!, 2023. URL https://isabelle.in.tum.de/ website-Isabelle2009-1/sledgehammer.html.
|
| 249 |
+
Bowen Peng, Jeffrey Quesnelle, Honglu Fan, and Enrico Shippole. Yarn: Efficient context window extension of large language models. arXiv preprint arXiv:2309.00071, 2023.
|
| 250 |
+
Stanislas Polu and Ilya Sutskever. Generative language modeling for automated theorem proving. arXiv preprint arXiv:2009.03393, 2020.
|
| 251 |
+
Stanislas Polu, Jesse Michael Han, Kunhao Zheng, Mantas Baksys, Igor Babuschkin, and Ilya Sutskever. Formal mathematics statement curriculum learning. arXiv preprint arXiv:2202.01344, 2022.
|
| 252 |
+
|
| 253 |
+
Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 2019.
|
| 254 |
+
|
| 255 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer, 2023.
|
| 256 |
+
|
| 257 |
+
Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. ZeRO: Memory optimizations toward training trillion parameter models. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’20. IEEE Press, 2020. ISBN 9781728199986. doi: 10.5555/3433701.3433727. URL https://dl.acm.org/doi/10. 5555/3433701.3433727.
|
| 258 |
+
Baptiste Rozière, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Tal Remez, Jérémy Rapin, Artyom Kozhevnikov, Ivan Evtimov, Joanna Bitton, Manish Bhatt, Cristian Canton Ferrer, Aaron Grattafiori, Wenhan Xiong, Alexandre Défossez, Jade Copet, Faisal Azhar, Hugo Touvron, Louis Martin, Nicolas Usunier, Thomas Scialom, and Gabriel Synnaeve. Code llama: Open foundation models for code. arXiv preprint arXiv:2308.12950, 2023.
|
| 259 |
+
Victor Sanh, Albert Webson, Colin Raffel, Stephen H. Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Tali Bers, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M. Rush. Multitask prompted training enables zero-shot task generalization. arXiv preprint arXiv:2110.08207, 2022.
|
| 260 |
+
Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-LM: Training multi-billion parameter language models using model parallelism. Computing Research Repository, 2019. doi: 10.48550/arXiv.1909.08053. URL https://arxiv.org/abs/1909.08053v4. Version 4.
|
| 261 |
+
Karan Singhal, Shekoofeh Azizi, Tao Tu, S. Sara Mahdavi, Jason Wei, Hyung Won Chung, Nathan Scales, Ajay Tanwani, Heather Cole-Lewis, Stephen Pfohl, Perry Payne, Martin Seneviratne, Paul Gamble, Chris Kelly, Nathaneal Scharli, Aakanksha Chowdhery, Philip Mansfield, Blaise Aguera y Arcas, Dale Webster, Greg S. Corrado, Yossi Matias, Katherine Chou, Juraj Gottweis, Nenad Tomasev, Yun Liu, Alvin Rajkomar, Joelle Barral, Christopher Semturs, Alan Karthikesalingam, and Vivek Natarajan. Large language models encode clinical knowledge, 2022.
|
| 262 |
+
Karan Singhal, Tao Tu, Juraj Gottweis, Rory Sayres, Ellery Wulczyn, Le Hou, Kevin Clark, Stephen Pfohl, Heather Cole-Lewis, Darlene Neal, Mike Schaekermann, Amy Wang, Mohamed Amin, Sami Lachgar, Philip Mansfield, Sushant Prakash, Bradley Green, Ewa Dominowska, Blaise Aguera y Arcas, Nenad Tomasev, Yun Liu, Renee Wong, Christopher Semturs, S. Sara Mahdavi, Joelle Barral, Dale Webster, Greg S. Corrado, Yossi Matias, Shekoofeh Azizi, Alan Karthikesalingam, and Vivek Natarajan. Towards expert-level medical question answering with large language models, 2023.
|
| 263 |
+
Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2022.
|
| 264 |
+
Ross Taylor, Marcin Kardas, Guillem Cucurull, Thomas Scialom, Anthony Hartshorn, Elvis Saravia, Andrew Poulton, Viktor Kerkez, and Robert Stojnic. Galactica: A large language model for science, 2022.
|
| 265 |
+
Amitayush Thakur, Yeming Wen, and Swarat Chaudhuri. A language-agent approach to formal theorem-proving, 2023.
|
| 266 |
+
Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, YaGuang Li, Hongrae Lee, Huaixiu Steven Zheng, Amin Ghafouri, Marcelo Menegali, Yanping Huang, Maxim Krikun, Dmitry Lepikhin, James Qin, Dehao Chen, Yuanzhong Xu, Zhifeng Chen, Adam Roberts, Maarten Bosma, Vincent Zhao, Yanqi Zhou, Chung-Ching Chang, Igor Krivokon, Will Rusch, Marc Pickett, Pranesh Srinivasan, Laichee Man, Kathleen Meier-Hellstern, Meredith Ringel Morris, Tulsee Doshi, Renelito Delos Santos, Toju Duke, Johnny Soraker, Ben Zevenbergen, Vinodkumar Prabhakaran, Mark Diaz, Ben Hutchinson, Kristen Olson, Alejandra Molina, Erin Hoffman-John, Josh Lee, Lora Aroyo, Ravi Rajakumar, Alena Butryna, Matthew Lamm, Viktoriya Kuzmina, Joe Fenton, Aaron Cohen, Rachel Bernstein, Ray Kurzweil, Blaise Aguera-Arcas, Claire Cui, Marian Croak, Ed Chi, and Quoc Le. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022.
|
| 267 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
|
| 268 |
+
Jonathan Uesato, Nate Kushman, Ramana Kumar, Francis Song, Noah Siegel, Lisa Wang, Antonia Creswell, Geoffrey Irving, and Irina Higgins. Solving math word problems with process- and outcome-based feedback, 2022.
|
| 269 |
+
H. Wang. Toward mechanical mathematics. IBM Journal of Research and Development, 4(1):2–22, 1960. doi: 10.1147/rd.41.0002.
|
| 270 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V Le, Ed H. Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 1PL1NIMMrw.
|
| 271 |
+
Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2022.
|
| 272 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models, 2023.
|
| 273 |
+
Sean Welleck. Neural theorem proving tutorial. https://github.com/wellecks/ ntptutorial, 2023.
|
| 274 |
+
Sean Welleck and Rahul Saha. llmstep: Llm proofstep suggestions in lean. https://github. com/wellecks/llmstep, 2023.
|
| 275 |
+
Sean Welleck, Jiacheng Liu, Ximing Lu, Hannaneh Hajishirzi, and Yejin Choi. Naturalprover: Grounded mathematical proof generation with language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id ${ . } = { }$ rhdfTOiXBng.
|
| 276 |
+
Makarius Wenzel, Lawrence C Paulson, and Tobias Nipkow. The isabelle framework. In Theorem Proving in Higher Order Logics: 21st International Conference, TPHOLs 2008, Montreal, Canada, August 18-21, 2008. Proceedings 21, pp. 33–38. Springer, 2008.
|
| 277 |
+
Shijie Wu, Ozan Irsoy, Steven Lu, Vadim Dabravolski, Mark Dredze, Sebastian Gehrmann, Prabhanjan Kambadur, David Rosenberg, and Gideon Mann. Bloomberggpt: A large language model for finance, 2023.
|
| 278 |
+
Yuhuai Wu, Albert Qiaochu Jiang, Wenda Li, Markus Norman Rabe, Charles E Staats, Mateja Jamnik, and Christian Szegedy. Autoformalization with large language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id $=$ IUikebJ1Bf0.
|
| 279 |
+
Sang Michael Xie, Hieu Pham, Xuanyi Dong, Nan Du, Hanxiao Liu, Yifeng Lu, Percy Liang, Quoc V. Le, Tengyu Ma, and Adams Wei Yu. Doremi: Optimizing data mixtures speeds up language model pretraining. arXiv preprint arXiv:2305.10429, 2023.
|
| 280 |
+
Kaiyu Yang, Aidan Swope, Alex Gu, Rahul Chalamala, Peiyang Song, Shixing Yu, Saad Godil, Ryan Prenger, and Anima Anandkumar. LeanDojo: Theorem proving with retrieval-augmented language models. In Neural Information Processing Systems (NeurIPS), 2023.
|
| 281 |
+
Zheng Xin Yong, Hailey Schoelkopf, Niklas Muennighoff, Alham Fikri Aji, David Ifeoluwa Adelani, Khalid Almubarak, M Saiful Bari, Lintang Sutawika, Jungo Kasai, Ahmed Baruwa, Genta Winata, Stella Biderman, Edward Raff, Dragomir Radev, and Vassilina Nikoulina. BLOOM $+ 1$ : Adding language support to BLOOM for zero-shot prompting. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 11682–11703, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023. acl-long.653. URL https://aclanthology.org/2023.acl-long.653.
|
| 282 |
+
Longhui Yu, Weisen Jiang, Han Shi, Jincheng Yu, Zhengying Liu, Yu Zhang, James T. Kwok, Zhenguo Li, Adrian Weller, and Weiyang Liu. Metamath: Bootstrap your own mathematical questions for large language models. arXiv preprint arXiv:2309.12284, 2023.
|
| 283 |
+
Xiang Yue, Xingwei Qu, Ge Zhang, Yao Fu, Wenhao Huang, Huan Sun, Yu Su, and Wenhu Chen. Mammoth: Building math generalist models through hybrid instruction tuning. CoRR, abs/2309.05653, 2023. doi: 10.48550/arXiv.2309.05653. URL https://doi.org/10. 48550/arXiv.2309.05653.
|
| 284 |
+
Shizhuo Dylan Zhang, Curt Tigges, Stella Biderman, Maxim Raginsky, and Talia Ringer. Can transformers learn to solve problems recursively?, 2023.
|
| 285 |
+
Kunhao Zheng, Jesse Michael Han, and Stanislas Polu. Minif2f: a cross-system benchmark for formal olympiad-level mathematics. arXiv preprint arXiv:2109.00110, 2021.
|
| 286 |
+
Hattie Zhou, Azade Nova, Hugo Larochelle, Aaron Courville, Behnam Neyshabur, and Hanie Sedghi. Teaching algorithmic reasoning via in-context learning, 2022.
|
| 287 |
+
Daniel M Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. arXiv preprint arXiv:1909.08593, 2019.
|
| 288 |
+
|
| 289 |
+
# A AUTHOR CONTRIBUTIONS
|
| 290 |
+
|
| 291 |
+
Training Data. Zhangir Azerbayev, Keiran Paster, Marco Dos Santos, Sean Welleck.
|
| 292 |
+
Model training. Zhangir Azerbayev, Hailey Schoelkopf, Keiran Paster.
|
| 293 |
+
Evaluations. Zhangir Azerbayev, Hailey Schoelkopf, Keiran Paster, Marco Dos Santos, Stephen McAleer, Albert Q. Jiang, Sean Welleck.
|
| 294 |
+
Formal math evaluations. Sean Welleck.
|
| 295 |
+
Memorization analysis. Sean Welleck, Keiran Paster.
|
| 296 |
+
Senior Authorship and Advising. Jia Deng, Stella Biderman, Sean Welleck.
|
| 297 |
+
|
| 298 |
+
B DATA: Proof-Pile-2
|
| 299 |
+
|
| 300 |
+
<table><tr><td>Data source</td><td>Tokens</td><td>Weight</td></tr><tr><td>Proof-Pile-2</td><td>55B</td><td>1</td></tr><tr><td>Code (AlgebraicStack)</td><td>11B</td><td>1.00</td></tr><tr><td>Web (OpenWebMath)</td><td>15B</td><td>4.00</td></tr><tr><td>Papers (ArXiv)</td><td>29B</td><td>2.00</td></tr><tr><td>General code (RedPajama)</td><td>59B</td><td>0.22</td></tr><tr><td>General language (Pile)</td><td>300B</td><td>0.15</td></tr></table>
|
| 301 |
+
|
| 302 |
+
Table 8: Proof-Pile-2 data sources (top), general language and code data included during training (bottom), and the mixture weights of each component during training.
|
| 303 |
+
|
| 304 |
+
# B.1 MATHEMATICAL CODE: AlgebraicStack
|
| 305 |
+
|
| 306 |
+
AlgebraicStack contains roughly 11B tokens of code related to mathematics. We describe its sources, filtering, and content below. Table 9 shows the number of tokens per language in AlgebraicStack.
|
| 307 |
+
|
| 308 |
+
<table><tr><td>Language</td><td>AlgebraicStack tokens</td><td>Language</td><td>AlgebraicStack tokens</td></tr><tr><td>Agda</td><td>35.2 M</td><td>Julia</td><td>531.0 M</td></tr><tr><td>C</td><td>25.1 M</td><td>Jupyter</td><td>199.1 M</td></tr><tr><td>C++</td><td>954.1 M</td><td>Lean</td><td>285.6 M</td></tr><tr><td>Coq</td><td>281.9 M</td><td>Maple</td><td>2.0M</td></tr><tr><td>Fortran</td><td>724.9 M</td><td>Matlab</td><td>65.8M</td></tr><tr><td>GAP</td><td>3.6 M</td><td>Python</td><td>6,098.8 M</td></tr><tr><td>Haskell</td><td>9.1 M</td><td>R</td><td>71.3 M</td></tr><tr><td>Idris</td><td>10.9 M</td><td>Tex</td><td>567.7 M</td></tr><tr><td>Isabelle</td><td>1,089.7 M</td><td>Total</td><td>10,955.7 M</td></tr></table>
|
| 309 |
+
|
| 310 |
+
Table 9: Tokens in AlgebraicStack, computed with the Llama tokenizer.
|
| 311 |
+
|
| 312 |
+
# B.1.1 GITHUB CODE
|
| 313 |
+
|
| 314 |
+
The following programming languages were either barely present in the Stack or consisted of largely incorrect filetypes, so we downloaded data for these languages directly via the Github Python API.
|
| 315 |
+
|
| 316 |
+
• Coq : We filter for files with the .v extension, and include Coq via including files that match a heuristic filter for the keywords "Theorem", "Proof", "Qed", "Inductive", "Definition", "Fixpoint" and exclude Verilog files via the keyword blacklist "pragma", "endmodule", "posedge", "negedge", "wire". We additionally exclude files noted as automatically generated.
|
| 317 |
+
|
| 318 |
+
• Isabelle : We filter for files with the .thy extension and include files matching the keyword whitelist "theorem ", "lemma We keep only isabelle-prover/mirror-afp-devel and discard all other older copies of the Archive of Formal Proofs. We further remove theorem statements and proofs that have a theorem name in the PISA (Jiang et al., 2021) test set.
|
| 319 |
+
• Lean $:$ We filter for files with the .lean extension, using the keyword whitelist "theorem ", "lemma ", "example ". We remove all dependency files, and in order to avoid known benchmark contamination, we blacklist the ProofNet and MiniF2F repositories. We further remove theorems or lemmas that share a theorem name with the LeanDojo (Yang et al., 2023) val or test sets.
|
| 320 |
+
• MATLAB $:$ We filter for files with the .m extension, using the keyword whitelist "#import", "interface", "implementation", "property", and blacklist C files via the keywords "#include" and the regex $\Sigma ^ { \prime }$ main\(.\*{\$’
|
| 321 |
+
|
| 322 |
+
We implemented a cutoff date for our Github API downloads, and used a cutoff date of April 1, 2023.
|
| 323 |
+
|
| 324 |
+
For all languages, unless otherwise stated, we additionally filtered out files with a filesize greater than 1048575 bytes or with a numerical density (ratio of digit characters to non-digit characters) of 0.5. We additionally perform document-level exact deduplication by removing documents which contain an overlapping 2048-character chunk as another document.
|
| 325 |
+
|
| 326 |
+
# B.1.2 LEAN PROOFSTEPS
|
| 327 |
+
|
| 328 |
+
We extract a dataset of (tactic state, next tactic) pairs from Mathlib 4 (mathlib Community, 2020) using the lean-training-data (Morrison, 2023) tool. We use Mathlib 4 commit c779bd5, which was created on August 20th 2023.
|
| 329 |
+
|
| 330 |
+
# B.1.3 ISABELLE PROOFSTEPS
|
| 331 |
+
|
| 332 |
+
We construct a dataset of Isabelle proofs, building upon the PISA dataset Jiang et al. (2021). Isabelle Proofsteps comprises proofs from the Archive of Formal Proofs and Isabelle Standard Library, scraped with PISA Jiang et al. (2021). Each entry in the dataset includes the theorem statement, the proof states and the proof steps, separated by specific tags. To maintain the integrity of evaluations using the PISA test set, we decontaminate Isabelle Proofsteps by removing theorems whose names overlap with those in the PISA test set. Although this approach results in a strict filtering – removing more than 10,000 theorems although there are only 3600 in the PISA test set – we consider it acceptable in order to mitigate data contamination. After filtering, Isabelle Proofsteps contains 251,000 theorems.
|
| 333 |
+
|
| 334 |
+
# B.1.4 STACK FILTERING
|
| 335 |
+
|
| 336 |
+
We source the following programming languages from the Stack (Kocetkov et al., 2022) dataset, and describe our filtering process and quality issues we chose to mitigate beyond our default quality heuristics:
|
| 337 |
+
|
| 338 |
+
• Agda: Only standard filters applied.
|
| 339 |
+
• C : We include documents based on a keyword whitelist, namely: "#include <fftw.h>", "#include <fftw3.h>", "#include <rfftw.h>", "#include <gsl", "#include <cblas.h>", "#include <blas.h>", "#include <lapacke.h>", "#include <nlopt.h>", "#include <petsc.h>".
|
| 340 |
+
• $\mathbf { C } + +$ : We include documents based on a keyword whitelist, namely: "#include <adept_arrays.h>", "#include <adept.h>", "#include <alglib>, "#include <boost", "#include <armadillo", "#include <blitz", "#include <Eigen", "#include <deal.II", "#include <dlib", "#include <NTL", "#include <mtl".
|
| 341 |
+
• Fortran $:$ Only standard filters applied.
|
| 342 |
+
• GAP $:$ Only standard filters applied.
|
| 343 |
+
• Haskell : We filtered the data to only contain files with the following imports: Numeric.LinearAlgebra, Numeric.SpecFunctions, Numeric.Vector, Statistics, Data.Complex.
|
| 344 |
+
|
| 345 |
+
• Idris $:$ Only standard filters applied.
|
| 346 |
+
|
| 347 |
+
• Julia $:$ We filtered out mislabeled JSON lines files. We removed files larger than 10,000 characters long which both were not files containing tests and which had a lower numerical density than 0.5, and otherwise ignored numerical density. We additionally only accepted files within a specific keyword whitelist, to attempt to control relevance to scientific computing, namely: "LinearAlgebra", "DifferentialEquations", "Symbolics", "Distributions", "DataFrames", "DynamicalSystems", "Turing", "Gen", "JuMP", "sqrt", "abs", "zeros", "ones", "sin", "cos", "tan", "log", "exp", "integrate", "likelihood", "Matrix", $\pi$ , "pi", "rand", "grad".
|
| 348 |
+
• Jupyter $:$ We found that many Jupyter notebook files were large due to containing long cell outputs, such as base64 images, long tracebacks, or other extra JSON cell metadata. We use nbconvert to convert notebooks to a markdown format, removing metadata. Maple $:$ We filtered out files with a size greater than 100, 000 bytes, and found that some files were XML. We filtered all files beginning with an XML declaration.
|
| 349 |
+
• Python $:$ We filtered notebooks and JSON files out by excluding documents with beginning "{" characters, and included only files importing from a fixed list of libraries.
|
| 350 |
+
• R : We excluded all files beginning with an XML declaration. We additionally filtered out all notebooks, and filtered all files containing MacOS "Resource Fork" files.
|
| 351 |
+
• Tex : We used a max file size of 10,000,000 bytes. We excluded tex files found in directories named "latex/" because these were often auto-generated files, and excluded documents using gnuplot. We included only documents containing one of the keywords " \chapter{", "\chapter\*{", "\section{", "\section\*{", "\subsection{", "\subsection\*{", "\subsubsection{", "\subsubsection\*{", "\paragraph{", "\subparagraph{", and additionally only included documents identified as English by a classifier from the langid package.
|
| 352 |
+
|
| 353 |
+
For all languages we used within the Stack, unless otherwise stated, we additionally filtered out files with a filesize greater than 1048575 bytes or with a numerical density (ratio of digit characters to non-digit characters) of 0.5.
|
| 354 |
+
|
| 355 |
+
We used v1.2 of the near-deduplicated Stack as a base for processing.
|
| 356 |
+
|
| 357 |
+
# B.2 PAPERS: ARXIV
|
| 358 |
+
|
| 359 |
+
We use the entirety of ArXiv, as accessed by Computer (2023) in April 2023. For further information on preprocessing applied to ArXiv, see Computer (2023).
|
| 360 |
+
|
| 361 |
+
# B.3 WEB: OPENWEBMATH
|
| 362 |
+
|
| 363 |
+
For the web portion of our training dataset, we use OpenWebMath (Paster et al., 2023).
|
| 364 |
+
|
| 365 |
+
# C EVALUATION HARNESS
|
| 366 |
+
|
| 367 |
+
We implement a variety of math-related tasks and evaluation protocols into a public fork of the Language Model Evaluation Harness (Gao et al., 2021). The Harness provides a model-agnostic framework for standardized, reproducible evaluation of language models.
|
| 368 |
+
|
| 369 |
+
We add the following tasks for the evaluations in this paper:
|
| 370 |
+
|
| 371 |
+
• hendrycks_math_ppl: Perplexity evaluation on MATH (Hendrycks et al., 2021a) sub-tasks.
|
| 372 |
+
• minif2f_isabelle: Proof autoformalization in Isabelle on the miniF2F benchmark based on Jiang et al. (2023), with a Portal-to-Isabelle (Jiang et al., 2021) proof checker.
|
| 373 |
+
• minerva_math: The MATH benchmark with the prompt and Sympy evaluation from Minerva (Lewkowycz et al., 2022).
|
| 374 |
+
• minerva-hendrycksTest: MMLU-STEM tasks following Lewkowycz et al. (2022). • ocw_courses: The OCW Courses task from Lewkowycz et al. (2022).
|
| 375 |
+
• python_gsm8k: GSM8k with Python, based on Gao et al. (2022).
|
| 376 |
+
• sympy_math: MATH with Sympy evaluation.
|
| 377 |
+
|
| 378 |
+
We include a link to the implementations for these tasks, including full prompts, in our public codebase.
|
| 379 |
+
|
| 380 |
+
# D EVALUATION: EXPERIMENT DETAILS
|
| 381 |
+
|
| 382 |
+
D.1 ISABELLE INFORMAL-TO-FORMAL THEOREM PROVING
|
| 383 |
+
|
| 384 |
+
We follow Jiang et al. (2023), allowing the model to issue a call to built-in Isabelle automation in the output proof by generating sledgehammer. This calls Sledgehammer (Paulson & Nipkow, 2023) and the list of heuristics listed in Jiang et al. (2023). Following Jiang et al. (2023), as a baseline we use Sledgehammer and the heuristics executed at the beginning of the proof (referred to as Sledgehammer in the main text for brevity). We use a 30-second timeout for Sledgehammer and implement proof checking via Portal-to-Isabelle (Jiang et al., 2021). Refer to the implementation in the Evaluation Harness for further details.
|
| 385 |
+
|
| 386 |
+
# D.2 LEAN THEOREM PROVING
|
| 387 |
+
|
| 388 |
+
Theorem proving via tactic prediction involves interacting with a proof assistant after each step of a proof. Implementing these interactions within the evaluation harness is outside the scope of this work. Therefore, for the Lean theorem proving task we use a separate evaluation setup based on an open-source implementation (Welleck, 2023). We include our evaluation code in our public codebase.
|
| 389 |
+
|
| 390 |
+
Setup. We evaluate on miniF2F (Zheng et al., 2021), which consists of 488 formalized statements from math competitions and undergraduate coursework. Given a formalized statement, the task is to generate a formal proof that is checked by Lean.
|
| 391 |
+
|
| 392 |
+
We use best first search, commonly used for neural tactic prediction models (e.g., Polu & Sutskever (2020)). Best first search is parameterized by the number of attempts $( \Nu )$ , generated tactics per iteration (S), and maximum iterations (T). We define the search budget to be the maximum number of generated tactics, $N \times S \times T$ . We set our search budget to $N \ = \ 1$ , $S ~ = ~ 3 2$ , and $T ~ = ~ 1 0 0$ , less than that of the baseline model. Following Yang et al. (2023), we generate tactics with beam search and use a 10 minute timeout. We adapt the proof search implementation from Welleck (2023), which uses LeanDojo v.1.1.2 (Yang et al., 2023) for interaction. We use Lean 4 miniF2F, using https://github.com/rah4927/lean-dojo-mew commit d00c776260c77de7e70125ef0cd119de6c0ff1de. Note that the ReProver baseline from (Yang et al., 2023) reports performance with Lean 3.
|
| 393 |
+
|
| 394 |
+
Prompt. We prompt the model with three (state, tactic) examples, shown in Figure 5.
|
| 395 |
+
|
| 396 |
+
"""Given the Lean 4 tactic state, suggest a next tactic.
|
| 397 |
+
|
| 398 |
+

|
| 399 |
+
Figure 5: Prompt for the Lean theorem proving experiments.
|
| 400 |
+
|
| 401 |
+
# E DATASHEET
|
| 402 |
+
|
| 403 |
+
We provide a datasheet for Proof-Pile-2, following the framework in Gebru et al. (2021).
|
| 404 |
+
|
| 405 |
+
<table><tr><td colspan="2">MOTIVATION</td></tr><tr><td>For what purpose was the dataset cre- ated?</td><td>Proof-Pile-2 was created for the training or finetuning of domain-specific large lan- guage models for general mathematics</td></tr><tr><td>Who created the dataset and on behalf of which entity?</td><td>tasks. The dataset was created by the authors of this paper for the purposes of this research project.</td></tr><tr><td>Who funded the creation of the dataset?</td><td>The creation of the dataset was funded by the coauthors‘ grants and employers,as fur-</td></tr><tr><td> Any other comment?</td><td>ther described in section 5.</td></tr><tr><td colspan="2">COMPOSITION</td></tr><tr><td>What do the instances that comprise the dataset represent?</td><td>Instances are text-only documents.</td></tr><tr><td> How many instances are there in total?</td><td>We detail fine-grained token counts else- where in this paper.</td></tr><tr><td>Does the dataset contain all possible in- stances or is it a sample (not necessarily random) of instances from a larger set?</td><td>Our dataset is filtered based on our assess- ments of quality for the language modeling task. More detail on methodology can be</td></tr><tr><td>What data does each instance consist of?</td><td>found in Appendix B. Each instance is a text-only document, alongside metadata about its originating</td></tr><tr><td>Is there a label or target associated with each instance?</td><td>split and filename or location. No.</td></tr><tr><td>Is any information missing from individ- ual instances?</td><td>Yes,we filter undesired noise,such as base64-encoded images, from some doc-</td></tr><tr><td>Are relationships between individual in- stances made explicit?</td><td>uments. No.</td></tr><tr><td>Are there recommended data splits?</td><td>Yes, we release a canonical train, validation, and test split of the dataset, which we follow</td></tr><tr><td>Are there any errors, sources of noise,or redundancies in the dataset?</td><td>in this work. We make our best efforts to remove errors or sources of noise,but our dataset will naturally contain documents with errors or noise,and may contain near-duplicate doc-</td></tr><tr><td>Is the dataset self-contained, or does it link to or otherwise rely on external re- sources?</td><td>uments. The dataset is self-contained, but can also be reconstructed based on external publicly available data sources and datasets follow-</td></tr><tr><td>Does the dataset contain data that might be considered confidential?</td><td>ing our instructions. All documents in Proof-Pile-2 are publicly available online.</td></tr></table>
|
| 406 |
+
|
| 407 |
+
Does the dataset contain data that, if viewed directly, might be offensive, insulting, threatening, or might otherwise
|
| 408 |
+
|
| 409 |
+
We estimate toxic content to be less prevalent in our dataset than other more general web-based datasets, due to its technical fo
|
| 410 |
+
|
| 411 |
+
<table><tr><td>cause anxiety?</td><td>cus.However, it is likely to contain such content.</td></tr><tr><td colspan="2">COLLECTION</td></tr><tr><td>How was the data associated with each instance acquired?</td><td>Data was largely sourced from existing pub- lic subsets,such as the RedPajama dataset (Computer, 2023), OpenWebMath dataset (Paster et al., 2023),and via filtering the Stack (Kocetkov et al., 2022). Some data was collected using the Github API.</td></tr><tr><td>What mechanisms or procedures were used to collect the data?</td><td> See above.</td></tr><tr><td>If the dataset is a sample from a larger set, what was the sampling strategy?</td><td>We release the entirety of the dataset fol- lowing the application of our quality filters. We randomly held out validation and test splits from the dataset.</td></tr><tr><td>Who was involved in the data collec- tion process and how were they compen- sated?</td><td>The authors of this paper participated in lo- cating,retrieving,and filtering the dataset.</td></tr><tr><td>Over what timeframe was the data col- lected?</td><td>This data was collected in 2023,with a cut- off date of April 2023 for all subsets with the exception of our Lean proofstep data.</td></tr><tr><td>Were any ethical review processes con- ducted?</td><td>Yes, the authors conducted an informal eth- ical review internally.</td></tr><tr><td colspan="2">PREPROCESSING</td></tr><tr><td>Was any preprocessing/cleaning/labeling of the data done?</td><td>Yes,the authors extensively filtered the dataset subsets in keeping with our expec- tations for high-quality language modeling data in our domain. See Appendix B for further detail on filtering steps taken.</td></tr><tr><td>Was the“raw” data saved in addition to the preprocessed/cleaned/labeled data? Is the software that was used to prepro- cess/clean/label the data available?</td><td>Raw data can be accessed via reuse of our provided codebase. Yes. We release our codebase, which can be used to reproduce our dataset and its con- struction process,at https : //github. com/EleutherAI/math-lm.</td></tr><tr><td colspan="2">USES Has the dataset been used for any tasks</td></tr><tr><td>already?</td><td>Yes, this dataset has been used to train the LLEMMA language models as a domain adaptation and continued pretraining cor- pus.</td></tr><tr><td>Is there a repository that links to any or all papers or systems that use the dataset?</td><td>No.</td></tr><tr><td>What (other) tasks could the dataset be used for?</td><td>The dataset was specifically targeted as a high quality language modeling corpus for the mathematics domain, but may be useful for general-purpose language modeling or unforeseen other downstream uses.</td></tr></table>
|
| 412 |
+
|
| 413 |
+
Table 10: Datasheet for Proof-Pile-2, following the framework introduced by Gebru et al. (2021).
|
| 414 |
+
|
| 415 |
+
<table><tr><td>Is there anything about the composition of the dataset or the way it was col- lected and preprocessed/cleaned/labeled that might impact future uses?</td><td>We filtered the dataset with the intent of creating a model useful for mathematical tasks with solely English text.</td></tr><tr><td>Are there tasks for which the dataset should not be used?</td><td>The dataset should not be used with the intent to cause harm or for models intended for the purposes of harm.</td></tr><tr><td colspan="2">DISTRIBUTION</td></tr><tr><td>Will the dataset be distributed to third parties outside of the entity on behalf of which the dataset was created?</td><td>We make the dataset publicly available for reproducibility,analysis,and other further downstream uses.</td></tr><tr><td>How will the dataset will be distributed?</td><td>We provide code to replicate the dataset, and release it via the Huggingface Hub.</td></tr><tr><td>When will the dataset be distributed?</td><td>The dataset is available immediately.</td></tr><tr><td>Will the dataset be distributed under a copyright or other intellectual prop- erty (IP) license,and/or under applicable terms of use (ToU)?</td><td>We do not relicense the dataset's compo- nents,and do not impose our own use re- strictions.</td></tr><tr><td>Have any third parties imposed IP-based or other restrictions on the data associ- ated with the instances?</td><td>Not to our knowledge.</td></tr><tr><td>Do any export controls or other regula- tory restrictions apply to the dataset or to individual instances?</td><td>Not to our knowledge.</td></tr><tr><td>MAINTENANCE</td><td></td></tr><tr><td>Who will be supporting/hosting/main- taining the dataset?</td><td>The dataset will be hosted on the Hug- gingFace Hub and able to be recreated via code at https://github.com/ EleutherAI/math-lm. The dataset will not be updated post-release.</td></tr><tr><td>How can the owner/curator/manager of the dataset be contacted?</td><td> Via email at za2514@princeton.edu</td></tr><tr><td> Is there an erratum?</td><td>No.</td></tr><tr><td> Will the dataset be updated?</td><td>No.</td></tr><tr><td>If others want to extend/augment/build on/contribute to the dataset, is there a mechanism for them to do so?</td><td>No.</td></tr></table>
|
| 416 |
+
|
| 417 |
+
# F ADDITIONAL RESULTS
|
| 418 |
+
|
| 419 |
+
# F.1 PROOF AUTOFORMALIZATION
|
| 420 |
+
|
| 421 |
+
Table 11 shows additional results on Isabelle proof autoformalization, including the union of theorems closed by Sledgehammer and the given language model.
|
| 422 |
+
|
| 423 |
+
Table 11: Isabelle autoformalization. ∗We exclude the 11 examples used in the few-shot prompts. Pass $@ 1$ with greedy decoding.
|
| 424 |
+
|
| 425 |
+
<table><tr><td>Method</td><td>Autoformalization pass @1 miniF2F-valid*</td><td>miniF2F-test</td></tr><tr><td> Sledgehammer</td><td>14.72%</td><td>20.49%</td></tr><tr><td>Code Llama 7b</td><td>16.31%</td><td>17.62%</td></tr><tr><td>LLEMMA-7b</td><td>20.60%</td><td>22.13%</td></tr><tr><td>Code Llama 7b U Sledgehammer</td><td>20.17%</td><td>25.00%</td></tr><tr><td>LLEMMA-7b U Sledgehammer</td><td>25.97%</td><td>27.46%</td></tr></table>
|
| 426 |
+
|
| 427 |
+
# G SUPERVISED FINETUNING
|
| 428 |
+
|
| 429 |
+
A full exploration of finetuning applications for LLEMMA, such as instruction following (Ouyang et al., 2022; Wei et al., 2022), dialogue modeling (Thoppilan et al., 2022; Touvron et al., 2023; Collins et al., 2023), and reward modeling (Cobbe et al., 2021; Lightman et al., 2023) are outside the scope of this work. However, to establish that LLEMMA retains its advantage over other open models when finetuned, we conduct preliminary experiments finetuning LLEMMA-7B on MetaMathQA (Yu et al., 2023), a supervised dataset targeted at the MATH and GSM8k benchmarks. Results are shown in Table 12.
|
| 430 |
+
|
| 431 |
+
Table 12: Finetuning of various 7B base models on supervised mathematics datasets. All results with a Llama 2 initialization are copied from the literature (Luo et al., 2023; Yu et al., 2023). The LLEMMA 7B finetune is trained with identical hyperparameters to the models in Yu et al. (2023)
|
| 432 |
+
|
| 433 |
+
<table><tr><td>Initialization</td><td>Finetune Dataset</td><td>MATH</td><td>GSM8k</td></tr><tr><td>Llama 2 7B</td><td>WizardMath (Proprietary)</td><td>10.7%</td><td>54.9%</td></tr><tr><td>Llama 2 7B</td><td>MetaMathQA</td><td>19.4%</td><td>66.4%</td></tr><tr><td>LLEMMA 7B</td><td>MetaMathQA</td><td>25.2%</td><td>66.5%</td></tr><tr><td>Llama 2 70B</td><td>WizardMath (Proprietary)</td><td>22.7%</td><td>81.6%</td></tr><tr><td>Llama 2 70B</td><td>MetaMathQA</td><td>26.6%</td><td>82.3%</td></tr></table>
|
| 434 |
+
|
| 435 |
+
# H QUALITATIVE EXAMPLES
|
| 436 |
+
|
| 437 |
+
Dataset overlap. Figure 6 shows example false positives when checking $n$ -gram overlap with OpenWebMath documents for various $n$ . Figure 7 shows an example OpenWebMath document that has 30-gram overlap with a MATH problem, and LLEMMA-7b’s generated solution.
|
| 438 |
+
|
| 439 |
+
Task outputs. Figure 8 shows a generated proof in the informal2formal theorem proving task.
|
| 440 |
+
|
| 441 |
+
# OpenWebMath document
|
| 442 |
+
|
| 443 |
+
2D affine transformations can be better represented using 2 by 2 matrices, since they are simply linear combinations of 2 variables. The advantage of this is that the matrices are associative under multiplication Also, GPUs and modern toolkits are optimised to work with this representation. As a result, a scale matrix is \begin{bmatrix} s_x & 0 \\ 0 & s_y \end{bmatrix}, and a rotation matrix is \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix}.
|
| 444 |
+
|
| 445 |
+
A translation matrix is simply \begin{bmatrix} 1 & \frac{t_x}{y} \\ \frac{t_y}{x} & 1 ...
|
| 446 |
+
|
| 447 |
+
# MATH problem
|
| 448 |
+
|
| 449 |
+
A rotation centered at the origin takes $\binom { 1 3 } { 0 }$ to $\left( { \begin{array} { c } { 5 } \\ { - 1 2 } \end{array} } \right) .$ Which vector does the rotation take $\binom { 0 } { 1 }$ to?
|
| 450 |
+
|
| 451 |
+
#
|
| 452 |
+
|
| 453 |
+
The rotation matrix must be of the form $\left( \sin \theta \frac { \ l - \sin \theta } { \sin \theta } \right)$ . Thus,...
|
| 454 |
+
|
| 455 |
+
# Hit
|
| 456 |
+
|
| 457 |
+
\cos \theta & -\sin \theta \\ \sin \theta & \cos
|
| 458 |
+
|
| 459 |
+
# OpenWebMath document
|
| 460 |
+
|
| 461 |
+
# Basic Probability
|
| 462 |
+
|
| 463 |
+
A number is selected at random from 1 through 100, inclusive. What is the probability that the number is a divisor of 50? Express your answer as a common fraction.
|
| 464 |
+
|
| 465 |
+
Apr 24, 2019
|
| 466 |
+
|
| 467 |
+
There are a 100 integers between 1-100, inclusive. Since 50 is \$\$2\*5^2\$\$, it has
|
| 468 |
+
\$\$(1+1) $( 1 + 2 ) = ( 2 )$ $( 3 ) = 6 5 5$ factors. Thus, the answer is
|
| 469 |
+
\$\$\frac{6} $\{ 1 0 0 \} =$ \boxed{\frac{3}{50}}.\$\$
|
| 470 |
+
|
| 471 |
+
# MATH problem
|
| 472 |
+
|
| 473 |
+
A number is selected at random from 1 through 100, inclusive. What is the probability that the number is a perfect square?
|
| 474 |
+
|
| 475 |
+
# Hit
|
| 476 |
+
|
| 477 |
+
A number is selected at random from 1 through 100, inclusive. What is the probability that the number is a
|
| 478 |
+
|
| 479 |
+
# OpenWebMath document
|
| 480 |
+
|
| 481 |
+
Fig. 2.
|
| 482 |
+
|
| 483 |
+
Use values of the most used medicinal plants in the Safi Province (Morocco).
|
| 484 |
+
|
| 485 |
+
It is also important to note that for the abovementioned medicinal plants, many other folk uses have been reported in different regions of Morocco. Furthermore, literature-based proof revealed that these species have proven a wide variety of biological and pharmacological activities (Table 4, Ref. [14, 17, 19, 20, 21, 23, 24, 26, 28, 30, 31, 34, 35, 36, 38, 39, 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]), which may confirm the different popular applications of ...
|
| 486 |
+
|
| 487 |
+
# Generated solution (LLEMMA 7b):
|
| 488 |
+
|
| 489 |
+
The first 100 positive integers are 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. We can see that...
|
| 490 |
+
|
| 491 |
+
Figure 6: Data overlap: Example false positives using 10-gram match between MATH solutions and OpenWebMath documents (top), 20-gram match between MATH problems and OpenWebMath documents (middle), and 30-gram match between LLEMMA-7b’s generated solutions and OpenWebMath documents (bottom).
|
| 492 |
+
|
| 493 |
+
# OpenWebMath document
|
| 494 |
+
|
| 495 |
+
A triangle is formed with edges along the line \$y=\frac{2}{3}x+5\$, the \$x\$-axis, and the line $\$ 123,456$ . If the area of the triangle is less than $\$ 205$ , find the sum of all possible integral values of \$k\$.
|
| 496 |
+
|
| 497 |
+
Feb 28, 2018
|
| 498 |
+
|
| 499 |
+
Look at the graph, here...two triangles are possible : https://www.desmos.com/calculator/m6wnjpgldq The height of the triangles at any point will be formed by
|
| 500 |
+
|
| 501 |
+
$$
|
| 502 |
+
[ \begin{array} { l l l } { } & { ( 2 / 3 ) \textbf { x } + \textbf { 5 } } \end{array} ]
|
| 503 |
+
$$
|
| 504 |
+
|
| 505 |
+
And the bases will be $[ \mathrm { ~ \bf ~ x ~ } - \mathrm { ~ \bf ~ ( ~ - ~ } 7 . 5 ) ] = [ \mathrm { ~ \bf ~ x ~ } + 7 . 5 ]$ ${ \begin{array} { r l } & { { \mathrm { S o \ldots \ldots \ldots } } { \mathrm { ~ w e ~ { \ w a n t } ~ t o ~ { \ s o \bot } v e ~ { \ t n } { \mathrm { ~ { \Sigma } } } } } } \\ & { ( 1 / 2 ) { \mathrm { ~ { \Sigma } ~ } } [ { \mathrm { ~ { \Sigma } } } ( 2 / 3 ) { \mathrm { ~ x ~ { \Sigma } ~ } } + { \mathrm { ~ { \Sigma } ~ } } 5 { \mathrm { ~ { \Sigma } ~ } } ] { \mathrm { ~ { \Sigma } ~ } } [ { \mathrm { ~ { \bf ~ x } ~ } } + { \mathrm { ~ { \Sigma } ~ } } 7 \cdot 5 { \mathrm { ~ { \Sigma } ~ } } ] = 2 0 } \\ & { [ { \mathrm { ~ { \Sigma } ~ } } ( 2 / 3 ) { \mathrm { ~ x ~ { \Sigma } ~ } } + { \mathrm { ~ { \Sigma } ~ } } 5 { \mathrm { ~ { \Sigma } ~ } } ] [ { \mathrm { ~ { \bf ~ x } ~ } } + { \mathrm { ~ { \Sigma } ~ } } 7 \cdot 5 ] = 4 0 } \\ & { ( 2 / 3 ) { \mathrm { ~ x \Sigma \mathrm { { \Sigma } } } } 2 + { \mathrm { ~ { \Sigma } } } { \mathrm { ~ { \Sigma } } } { \mathrm { ~ { \Sigma } } } + { \mathrm { ~ { \Sigma } } } { \mathrm { ~ { \Sigma } } } { \mathrm { ~ { \Sigma } } } + { \mathrm { ~ { \Sigma } } } 3 7 \ldots = 0 } \\ & { ( 2 / 3 ) { \mathrm { ~ x \widehat { \mathrm { \Sigma } } } } 2 + { \mathrm { ~ { \Sigma } ~ } } 1 0 { \bf x } - { \mathrm { ~ { \Sigma } ~ } } 2 . 5 = 0 { \mathrm { ~ { \Sigma } ~ } } 0 } \end{array} }$
|
| 506 |
+
|
| 507 |
+
Using a little technology.....the max x value for the triangle formed above the $_ \textrm { x }$ axis will be $=$ .246
|
| 508 |
+
|
| 509 |
+
And the min x value for the triangle formed below the x axis will be = -15.246
|
| 510 |
+
|
| 511 |
+
With the given boundaries, the integer sums of all possible $_ \textrm { x }$ values of k giving triangles with an area $< ~ 2 0$ units^2 $=$
|
| 512 |
+
|
| 513 |
+
[ (-15) + (-14 ) + (-13) + ...+ ( -2) + ( - 1 ) + 0 ] = (15) (16) / 2 =
|
| 514 |
+
-120
|
| 515 |
+
|
| 516 |
+
Feb 28, 2018
|
| 517 |
+
|
| 518 |
+
MATH Problem: A triangle is formed with edges along the line $y = \textstyle { \frac { 2 } { 3 } } x + 5$ , the $x$ -axis, and the line $x = k$ . If the area of the triangle is less than 20, find the sum of all possible integral values of $k$ . Answer: -120
|
| 519 |
+
|
| 520 |
+
# Generated solution (LLEMMA $\mathbf { \Delta } ^ { 7 \mathbf { b } }$ ):
|
| 521 |
+
|
| 522 |
+
The triangle has vertices $( k , 0 )$ , $( 0 , 5 )$ , and $( k , \textstyle { \frac { 2 } { 3 } } k + 5 )$ . The base of the triangle has length $k$ , and the height of the triangle has length ${ \frac { 2 } { 3 } } k + 5$ . The area of the triangle is therefore
|
| 523 |
+
|
| 524 |
+
$$
|
| 525 |
+
A = { \frac { 1 } { 2 } } b h = { \frac { 1 } { 2 } } k ( { \frac { 2 } { 3 } } k + 5 ) = { \frac { 1 } { 3 } } k ^ { 2 } + { \frac { 5 } { 2 } } k .
|
| 526 |
+
$$
|
| 527 |
+
|
| 528 |
+
Since the area of the triangle is less than 20, we have
|
| 529 |
+
|
| 530 |
+
$$
|
| 531 |
+
\frac { 1 } { 3 } k ^ { 2 } + \frac { 5 } { 2 } k < 2 0 \Rightarrow \frac { 1 } { 6 } k ^ { 2 } + \frac { 5 } { 4 } k - 1 0 < 0 .
|
| 532 |
+
$$
|
| 533 |
+
|
| 534 |
+
This inequality is true if and only if with positive leading coefficient, it $\textstyle { \frac { 1 } { 6 } } k ^ { 2 } + { \frac { 5 } { 4 } } k - 1 0$ is positive. Since d only if its vertex $\textstyle { \frac { 1 } { 6 } } k ^ { 2 } + { \frac { 5 } { 4 } } k - 1 0$ is a quadratic The vertex of $\textstyle { \frac { 1 } { 6 } } k ^ { 2 } + { \frac { 5 } { 4 } } k - 1 0$ is $\bigl ( - { \frac { 1 0 } { 3 } } , - { \frac { 1 2 5 } { 1 8 } } \bigr )$ . Since $\begin{array} { l } { \displaystyle { - \frac { 1 0 } { 3 } < 0 } } \end{array}$ , we have that $\textstyle { \frac { 1 } { 6 } } k ^ { 2 } + { \frac { 5 } { 4 } } k - 1 0 > 0$ if and only if $k < - \frac { 1 0 } { 3 }$ . Therefore, the only possible integral values of $k$ are $k = 0 , 1 , 2 , 3 , 4$ . The sum of these values is $\boxed { 1 0 } .$ Final Answer: The final answer is 10.
|
| 535 |
+
|
| 536 |
+
Figure 7: Data overlap: Example OpenWebMath document that has a 30-gram overlap with the given MATH problem, and LLEMMA-7b’s generated solution.
|
| 537 |
+
|
| 538 |
+

|
| 539 |
+
Figure 8: Informal-to-formal proving. The model is given the problem, informal proof, and formal statement, following Jiang et al. (2023). It generates a formal proof (starting with proof -) containing Isabelle code, comments $( \star \ldots \star )$ ) that align the informal and formal proofs, and calls to an automated prover (shown as ${ < A T P > }$ ). The proof is from LLEMMA-7b with greedy decoding.
|
md/test/8dkp41et6U/8dkp41et6U.md
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LongLLMLingua: ACCELERATING AND ENHANCING LLMS IN LONG CONTEXT SCENARIOS VIA PROMPT COMPRESSION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
In long context scenarios, large language models (LLMs) face three main challenges: higher computational/financial cost, longer latency, and inferior performance. Some studies reveal that the performance of LLMs depends on both the density and the position of the key information (question relevant) in the input prompt. Inspired by these findings, we propose LongLLMLingua for prompt compression towards improving LLMs’ perception of the key information to simultaneously address the three challenges. We conduct evaluation on a wide range of long context scenarios including single-/multi-document QA, few-shot learning, summarization, synthetic tasks, and code completion. Experimental results show that LongLLMLingua compressed prompt can derive higher performance with much lower cost. The latency of the end-to-end system is also reduced. For example, on NaturalQuestions benchmark, LongLLMLingua gains a performance boost of up to $1 7 . 1 \%$ over the original prompt with ${ \sim } 4 \mathbf { x }$ fewer tokens as input to GPT-3.5-Turbo. It can drive cost savings of $\$ 28.5$ and $\$ 27.4$ per 1,000 samples from the LongBench and ZeroScrolls benchmark, respectively. Additionally, when compressing prompts of ${ \sim } 1 0 \mathrm { k }$ tokens at a compression rate of $2 \mathbf { X } { - } 1 0 \mathbf { X }$ , LongLLMLingua can speed up the end-to-end latency by $1 . 4 \mathrm { X } \mathrm { - } 3 . 8 \mathrm { X }$ .
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
ChatGPT and other large language models (LLMs) have revolutionized user-oriented language technologies and are serving as crucial components in more and more applications. Carefully designing prompts is necessary to achieve better performance in specific downstream tasks. The commonly used technologies such as In-Context Learning (ICL) (Dong et al., 2023), Retrieval Augment Generation (RAG) (Lewis et al., 2020), and Agent (Park et al., 2023) are driving prompts to be increasingly longer, even reaching thousands of tokens. Scenarios such as multi-document question answering, code completion, and document summarization also necessitate the processing of long contexts.
|
| 12 |
+
|
| 13 |
+
There are three main challenges when LLMs are used in long context scenarios: (1) The higher computational and financial cost required to run these models or to call APIs from companies providing LLM services. This can be a significant barrier for individuals or smaller organizations with limited resources. (2) The longer latency associated with LLMs, which can cause delays in generating responses or predictions and is particularly problematic in real-time scenarios where users expect quick and accurate responses. (3) The inferior performance caused by the extended window size of LLMs (Xiong et al., 2023), and the low density as well as the less sensitive position of the questionrelevant key information in the prompt. Figure 1a shows that LLMs’ performance in downstream tasks may decrease as the noisy information in the prompt increases (Shi et al., 2023). Moreover, the purple curve in Figure 1b indicates that LLMs’ ability to capture the relevant information depends on their positions in the prompt (Liu et al., 2023): they achieve the highest performance when relevant information occurs at the beginning or end of the input context, and significantly degrades if relevant information is located in the middle of long contexts.
|
| 14 |
+
|
| 15 |
+
Inspired by these observations, we propose LongLLMLingua to address the three challenges. Specifically, we use the advanced while efficient LLMLingua (Jiang et al., 2023a) as our backbone framework for prompt compression to address the first two challenges, i.e., reduce cost and latency. However, in the case of long contexts, the distribution of question-relevant key information in the prompt is generally sparse. Existing prompt compression methods like LLMLingua (Jiang et al., 2023a) and Selective-Context (Li, 2023) that do not consider the content of the question during compression may retain too much noisy information in the compressed results, leading to inferior performance. In this paper, LongLLMLingua is designed to enhance LLM’s perception of key information (relevant to the question) in the prompt, so that the third challenge of inferior performance in long context scenarios could be addressed. Figure 1b is an example. The underlying principle of LongLLMLingua is that small language models are inherently capable of capturing the distribution of key information relevant to a given question.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: (a) LLMs’ performance in downstream tasks may decrease as the noisy information in the prompt increases. In this case, we keep $k$ most relevant documents/paragraphs based on the ground truth or LongLLMLingua $r _ { k }$ . A larger $k$ implies more noise introduced into the prompt. To improve the key information density in the prompt, we present question-aware coarse-to-fine compression. (b) LLMs’ ability to capture the relevant information depends on their positions in the prompt. To reduce information loss in the middle, we introduce a document reordering mechanism.
|
| 19 |
+
|
| 20 |
+
Our main contributions are five-fold: (1) We propose a question-aware coarse-to-fine compression method to improve the key information density in the prompt (Sec. 4.1); (2) We introduce a document reordering mechanism to reduce information loss in the middle. (Sec. 4.2); (3) We present dynamic compression ratios to bridge the coarse-grained compression and fine-grained compression for adaptive granular control (Sec. 4.3); (4) We propose a post-compression subsequence recovery strategy to improve the integrity of the key information (4.4). (5) We evaluate LongLLMLingua on three benchmarks, i.e., NaturalQuestions (Liu et al., 2023), LongBench (Bai et al., 2023), and ZeroSCROLLS (Shaham et al., 2023). Experimental results demonstrate that compared with original prompts, LongLLMLingua compressed prompts can achieve higher performance with much lower costs. The latency of the end-to-end system is also reduced.
|
| 21 |
+
|
| 22 |
+
# 2 PROBLEM FORMULATION
|
| 23 |
+
|
| 24 |
+
Following LLMLingua (Jiang et al., 2023a), we use $\mathbf { x } = ( \mathbf { x } ^ { \mathrm { { i n s } } } , \mathbf { x } _ { 1 } ^ { \mathrm { { d o c } } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { { d o c } } } , \mathbf { x } ^ { \mathrm { { q u e } } } )$ to represent a prompt, which composed of the instruction $\mathbf { x } ^ { \mathrm { i n s } }$ , $K$ documents $\mathbf { x } _ { i } ^ { \mathrm { { d o c } } }$ , and the question $\mathbf { x } ^ { \mathrm { q u e } }$ . In fact, the prompt can be modified according to specific application scenarios. For example, $\mathbf { x } ^ { \mathrm { i n s } }$ at the beginning can be removed, $\mathbf { x } ^ { \mathrm { q u e } }$ can be any requirement specified by users, and $( \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { d o c } } )$ can be any additional materials that users append to the prompt to get a better response from LLMs for $\mathbf { x } ^ { \mathrm { q u e } }$ . The objective of a prompt compression system can be formulated as:
|
| 25 |
+
|
| 26 |
+
$$
|
| 27 |
+
\operatorname* { m i n } _ { \widetilde { \mathbf { x } } } D \left( \mathbf { y } , \widetilde { \mathbf { y } } \right) + \lambda \| \widetilde { \mathbf { x } } \| _ { 0 } ,
|
| 28 |
+
$$
|
| 29 |
+
|
| 30 |
+
where $\widetilde { \mathbf { x } }$ denotes the compressed prompt and is a token-level subsequence of $\mathbf { x }$ . $\mathbf { y }$ represents the eground-truth output texts with $\mathbf { x }$ as the input and $\widetilde { \mathbf { y } }$ represent the LLM-generated results derived by $\widetilde { \mathbf { x } }$ . $D$ eis a distance measure between two distributions, such as KL divergence. We expect the edistribution of $\mathbf { y }$ and $\widetilde { \mathbf { y } }$ to be as similar as possible. $\lambda$ is a trade-off hyper-parameter regarding the ecompression ratio. In this work, we additionally incorporate an operation space of permutation over the $K$ documents $( \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { d o c } } )$ for joint optimization.
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 2: Framework of LongLLMLingua. Gray Italic content: As in LLMLingua.
|
| 34 |
+
|
| 35 |
+
# 3 PRELIMINARY: LLMLINGUA
|
| 36 |
+
|
| 37 |
+
LLMLingua (Jiang et al., 2023a) uses a small language model $\mathcal { M } _ { S }$ to calculate the perplexity of each token in the original prompt and then removes tokens with lower perplexities. The rationale behind this approach is that tokens with lower perplexities contribute less to the overall entropy gain of the language model, so removing them will have a relatively minor impact on the LLM’s comprehension of the context. LLMLiungua consists of three components: a budget controller, an iterative token-level prompt compression algorithm, and a distribution alignment mechanism, as shown by Italic texts in Figure 2. The budget controller allocates different compression ratios to the various components in the original prompt (i.e., instruction, demonstrations, question), and performs coarsegrained compression at the demonstration level. The intermediate results are divided into segments and the token-level compression is then performed segment by segment, with the perplexity of each token conditioned on previous compressed segments calculated by $\mathcal { M } _ { S }$ . For distribution alignment, it performs instruction tuning on $\mathcal { M } _ { S }$ with the data generated by the target LLM to narrow the gap between the distribution of LLM and that of $\mathcal { M } _ { S }$ used for prompt compression.
|
| 38 |
+
|
| 39 |
+
# 4 LONGLLMLINGUA
|
| 40 |
+
|
| 41 |
+
LongLLMLingua is developed upon the framework of LLMLingua towards prompt compression in long context scenarios. The primary challenge in long context scenarios is how to enhance LLM’s perception of key information relevant to the question in the prompt. LongLLMLingua addresses this challenge from three perspectives, and further applies a subsequence recovery strategy to improve the accuracy and reliability of the information provided to users. We elaborate on each component in this section.
|
| 42 |
+
|
| 43 |
+
# 4.1 HOW TO IMPROVE KEY INFORMATION DENSITY IN THE PROMPT?
|
| 44 |
+
|
| 45 |
+
out a metric Question-Aware Coarse-Grained Compression In coarse-grained compression, we aim to figure $r _ { k }$ to evaluate the importance of each document $\mathbf { x } _ { k } ^ { \mathrm { d o c } } = \{ x _ { k , i } ^ { \mathrm { { \bar { d o c } } } } \} _ { i = 1 } ^ { N _ { k } }$ , where $N _ { k }$ is the number of tokens in $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ . We only keep $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ with higher $r _ { k }$ as the intermediate compressed results.
|
| 46 |
+
|
| 47 |
+
LLMLingua uses document-level perplexity to represent the importance of documents: $r _ { k } = { }$ $1 / N _ { k } \textstyle \sum _ { i } ^ { \bar { N } _ { k } } p ( x _ { k , i } ^ { \mathrm { d o c } } ) \log p ( x _ { k , i } ^ { \mathrm { d o c } } ) , k \in \{ 1 , 2 , \cdots , K \}$ . Although the retained documents typically contain a lot of information, they are irrelevant to the question and instead become noise, reducing key information density in the compressed results and bringing difficulties for LLM to output correct answers. As shown in Figure 3a, the recall $@ 1 6$ of LLMLingua only reaches $50 \%$ , indicating its incompetence in retaining key information during compression.
|
| 48 |
+
|
| 49 |
+
Retrieval-based methods are also feasible here. We can use $\mathbf { x } ^ { \mathrm { q u e } }$ to retrieve the most relevant documents among $( \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { d o c } } )$ as the compressed results. However, these methods struggle to distinguish question-related fine-grained semantic information. Some documents with key information may be discarded during retrieval. As shown in Figure 3a, embedding-based methods such as Sentence BERT and OpenAI Embedding only achieve ${ \sim } 7 5 \%$ accuracy in recall $\textcircled { \alpha } 5$ , which implies that the final accuracy upper bound of LLMs with $4 \mathbf { x }$ compression is only $7 5 \%$ .
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Figure 3: (a) Comparison of recall on NaturalQuestions Multi-documemnt QA dataset. (b) Comparison between perplexities and contrastive perplexities of tokens in the prompt from Multi-documemnt QA dataset. The document with the ground truth is located on the left side of the dashed line.
|
| 53 |
+
|
| 54 |
+
One approach to improve key information density in the compressed results is to calculate documentlevel perplexity conditioned on the question $\mathbf { x } ^ { \mathrm { q u e } }$ . However, this method may not be effective because documents often contain a significant amount of irrelevant information. Even when conditioned on $\mathbf { x } ^ { \mathrm { q u e } }$ , the perplexity scores computed for entire documents may not be sufficiently distinct, rendering them an inadequate metric for document-level compression. Therefore, we propose to use the perplexity of the question $\mathbf { x } ^ { \mathrm { q u e } }$ conditioned on different contexts $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ to represent the association between them. We append a restrictive statement $\mathbf { x } ^ { \mathrm { r e s t r i c t { 1 } } }$ after $\mathbf { x } ^ { \mathrm { q u e } }$ to strengthen the interconnection of $\mathbf { x } ^ { \mathrm { q u e } }$ and $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ . It can be regarded as a regularization term that mitigates the impact of hallucinations. This can be formulated as:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
r _ { k } = \frac { 1 } { N _ { c } } \sum _ { i } ^ { N _ { c } } p ( x _ { i } ^ { \mathrm { q u e , r e s t i c t } } | \mathbf { x } _ { k } ^ { \mathrm { d o c } } ) \log p ( x _ { i } ^ { \mathrm { q u e , r e s t r i c t } } | \mathbf { x } _ { k } ^ { \mathrm { d o c } } ) , k \in \{ 1 , 2 , \cdots , K \} ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $x _ { i } ^ { \mathrm { q u e , r e s t r i c t } }$ is the $i$ -th token in the concatenated sequence of $\mathbf { x } ^ { \mathrm { q u e } }$ and $\mathbf { x } ^ { \mathrm { r e s t r i c t } }$ and $N _ { c }$ in the number of tokens.
|
| 61 |
+
|
| 62 |
+
Figure 3a demonstrates that our coarse-level compression approach achieves the highest recall with different numbers of retained documents, suggesting that it preserves the most key information from the documents $( \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K } ^ { \mathrm { d o c } } )$ in the compressed results.
|
| 63 |
+
|
| 64 |
+
Question-Aware Fine-Grained Compression In fine-grained compression, we assess the importance of each token in the instruction $\mathbf { x } ^ { \mathrm { i n s } }$ , the question $\mathbf { x } ^ { \mathrm { q u e } }$ , and $K ^ { \prime }$ documents $\{ \mathbf { x } _ { i } ^ { \mathrm { d o c } } \} _ { i = 1 } ^ { K ^ { \prime } }$ retained after coarse-grained compression. We incorporate the iterative compression mechanism following LLMLingua and directly calculate token perplexities to compress $\bar { \mathbf { x } } ^ { \mathrm { i n s } }$ and $\mathbf { x } ^ { \mathrm { q u e } }$ . In this section, we invesquestion e how to make the fine-grained token-level compression over , so that the compressed results could contain more question-r $\{ \mathbf { x } _ { k } ^ { \mathrm { d o c } } \} _ { k = 1 } ^ { K ^ { \prime } }$ aware of the information. $\mathbf { x } ^ { \mathrm { q u e } }$
|
| 65 |
+
|
| 66 |
+
A straightforward solution for the awareness of $\mathbf { x } ^ { \mathrm { q u e } }$ is to simply concatenate it at the beginning of the whole context. However, this will result in low perplexities of relevant tokens in the context following the condition, further reducing their differentiation from general tokens. In this paper, we propose contrastive perplexity, i.e., the distribution shift caused by the condition of the question, to represent the association between the token and the question. The contrastive perplexity based importance metric $s _ { i }$ for each token $x _ { i }$ in $\{ \mathbf { x } _ { k } ^ { \mathrm { d o c } } \} _ { k = 1 } ^ { K ^ { \prime } }$ can be formulated as:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
s _ { i } = \mathrm { p e r p l e x i t y } ( x _ { i } | \boldsymbol { x } _ { < i } ) - \mathrm { p e r p l e x i t y } ( x _ { i } | \boldsymbol { x } ^ { \mathrm { q u e } } , \boldsymbol { x } _ { < i } ) .
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
Figure 3b illustrates the difference between perplexities and contrastive perplexities. We can see that tokens of high perplexities are widely distributed in all documents. However, tokens with high contrastive perplexities concentrate more on the left side of the dashed line, which corresponds to the document that contains the answer to the question. This suggests that the proposed contrastive perplexity can better distinguish tokens relevant to the question, thus improving the key information density in the compressed results.
|
| 73 |
+
|
| 74 |
+
# 4.2 HOW TO REDUCE INFORMATION LOSS IN THE MIDDLE?
|
| 75 |
+
|
| 76 |
+
As demonstrated in Figure 1b, LLM achieves the highest performance when relevant information occurs at the beginning and significantly degrades if relevant information is located in the middle of long contexts. After the coarse-grained compression, we have obtained a set of documents $\{ \mathbf { x } _ { k } ^ { \mathrm { d o c } } \} _ { k = 1 } ^ { K ^ { \prime } }$ with their corresponding importance scores $\{ r _ { k } \} _ { k = 1 } ^ { K ^ { \prime } }$ indicating their association with the question $\mathbf { x } ^ { \mathrm { q u e } }$ . Therefore, we reorder documents using their importance scores to better leverage LLMs’ information perception difference in positions:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
( \mathbf { x } ^ { \mathrm { i n s } } , \mathbf { x } _ { 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { K ^ { \prime } } ^ { \mathrm { d o c } } , \mathbf { x } ^ { \mathrm { q u e } } ) \xrightarrow { r _ { k } } ( \mathbf { x } ^ { \mathrm { i n s } } , \mathbf { x } _ { r 1 } ^ { \mathrm { d o c } } , \cdot \cdot \cdot , \mathbf { x } _ { r K ^ { \prime } } ^ { \mathrm { d o c } } , \mathbf { x } ^ { \mathrm { q u e } } )
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
# 4.3 HOW TO ACHIEVE ADAPTIVE GRANULAR CONTROL DURING COMPRESSION?
|
| 83 |
+
|
| 84 |
+
In fine-grained compression, LLMLingua applies the save compression ratio over all documents obtained from coarse-grained compression. However, the key information density of different documents is different. The more relevant to the question a document is, the more budget (i.e., lower compression ratio) we should allocate to it. Therefore, we bridge coarse-grained compression to fine-grained compression and use the importance scores $\{ r _ { k } \} _ { k = 1 } ^ { \bar { K ^ { \prime } } }$ obtained from coarse-grained compression to guide the budget allocation in fine-grained compression. In this way, we can achieve adaptive granular control on the whole.
|
| 85 |
+
|
| 86 |
+
Specifically, we first determine the initial budget for the retained documents $\tau ^ { \mathrm { d o c } }$ 2 using the budget controller of LLMLingua. During fine-grained compression, we follow the iterative token-level compression algorithm in LLMLingua but dynamically assign the compression budget $\cdot$ to each document $\mathbf { x } _ { k } ^ { \mathrm { { d o c } } }$ according to the ranking index $I ( r _ { k } )$ (e.g., 0, 1) of its importance score from the coarse-grained compression. In this paper, we employ a linear scheduler for the adaptive allocation. Budget of each token $x _ { i }$ can be formulated as:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r l } & { \tau _ { i } = \tau _ { k } ^ { \mathrm { d o c } } , } \\ & { \tau _ { k } ^ { \mathrm { d o c } } = \operatorname* { m a x } ( \operatorname* { m i n } ( ( 1 - \frac { 2 I ( r _ { k } ) } { K ^ { \prime } } ) \delta \tau + \tau ^ { \mathrm { d o c } } , 0 ) , 1 ) , } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $i$ and $k$ is the index of token and document, $K ^ { \prime }$ denotes the number of documents, and $\delta \tau$ is a hyper-parameter that controls the overall budget for dynamic allocation.
|
| 93 |
+
|
| 94 |
+
# 4.4 HOW TO IMPROVE THE INTEGRITY OF KEY INFORMATION?
|
| 95 |
+
|
| 96 |
+
Certain tokens of key entities may be discarded during the fine-grained token-wise compression. For example, the time entity “2009” in the original prompt might be compressed to “209” and the name entity “Wilhelm Conrad Rontgen” might be compressed to “Wilhelmgen”. This can cause problems ¨ for fact-based tasks like document QA, where language models tend to replicate information from the prompt, as shown in Figure 4.
|
| 97 |
+
|
| 98 |
+
To improve the accuracy and reliability of the information provided to users, we propose a subsequence recovery method to restore the original content from LLMs’ responses. This method relies on the subsequence relationship among tokens in the original prompt, compressed prompt, and LLMs’ response. The overall procedure includes: i) Iterate through tokens $y _ { l }$ in LLMs’ response and select the longest substring $\bar { \tilde { y } } _ { \mathrm { k e y } , l } = \{ y _ { l } , y _ { l + 1 } , . . . , y _ { r } \}$ that appears in the compressed prompt $\widetilde { \pmb x }$ . ii) Find ethe maximum common shortest subsequence $\mathbf { \bar { \mathbf { x } } } _ { i , j } ~ { = } ~ \bar { \left\{ \mathbf { \bar { \mathbf { \Phi } } } ( { \bf { x } } _ { i } , { \bf { x } } _ { i + 1 } , . . . , { \bf { x } } _ { j } \right\} }$ ein the original prompt $_ { \textbf { \em x } }$ , corresponding to the representation $\widetilde { \boldsymbol { y } } _ { \mathrm { k e y } , l }$ in the original prompt (accelerated using prefix trees or esequence automata). iii) Replace the matched tokens $\widetilde { \boldsymbol { y } } _ { \mathrm { k e y } , l }$ in LLMs’ response with the corresponding subsequence $\boldsymbol { x } _ { i , j }$ efrom the original prompt. For more details, please refer to Algorithm 1.
|
| 99 |
+
|
| 100 |
+
<table><tr><td>Document [1](Title: List of Nobel laureates in Physics)The first Nobel Prize in Physics was awarded in 1901to{Wilhelm Conrad Rontgen}{Wilhelm Con rad Ro nt gen}, of Germany,... Original Prompt</td><td>Document [1](Title: List of Nobelates in Physics) The first Nobel1 {Wilhelmgen}{Wilhelm gen}, of, who received,.. Compressed Prompt</td><td>{Wilelmgen} {Wilhelm gen} LLMs' Response</td></tr></table>
|
| 101 |
+
|
| 102 |
+
# 5 EXPERIMENTS
|
| 103 |
+
|
| 104 |
+
Here, we investigate: (1) How effective is LongLLMLingua? (2) How efficient is LongLLMLingua?
|
| 105 |
+
|
| 106 |
+
Implementation details In this paper, we use GPT-3.5-Turbo- $. 0 6 1 3 ^ { 3 }$ and LongChat-13B-16k as the target LLMs, both accessible via OpenAI4 and HuggingFace5. To ensure stable and reproducible results, we employ greedy decoding and set the temperature to 0 in all experiments. For the small language models used for compression, we apply LLaMA-2-7B-Chat6, which has been aligned by supervised fine-tuning and RLHF. We implement our approach with PyTorch 1.13.1 and HuggingFace Transformers. We set up hyperparameters following LLMLingua except for the segment size used in iterative token-level compression set to 200 here. More details are provided in Appendix C.
|
| 107 |
+
|
| 108 |
+
Dataset & evaluation metric We use NaturalQuestions for the multi-document QA task, and use LongBench and ZeroSCROLLS for general long context scenarios. We also test on multi-hop QA tasks using MuSiQue dataset (Trivedi et al., 2022), and long dependency QA tasks using LooGLE benchmark (Li et al., 2023b). Please refer to Appendix D for more details on datasets.
|
| 109 |
+
|
| 110 |
+
(i) NaturalQuestions (Liu et al., 2023): This benchmark is similar to the retrieval-augmented generation setup in commercial search and question-answering scenarios like Bing Chat. Specifically, each question has 20 related documents in the original prompt. One of them contains the correct answer and there are five different ground truth document position settings in the prompt: 1st, 5th, 10th, 15th, and 20th. Following Liu et al. (2023), we use accuracy as the evaluation metric.
|
| 111 |
+
|
| 112 |
+
(ii) LongBench (Bai et al., 2023): This benchmark consists of six task types: single-document QA, multi-document QA, summarization, few-shot learning, code completion, and synthetic tasks. We used the English portion that covers 16 datasets for evaluation. We use the metrics and scripts provided along with the benchmark for evaluation.
|
| 113 |
+
|
| 114 |
+
(iii) ZeroSCROLLS (Shaham et al., 2023): This benchmark consists of four task types: summarization, QA, sentiment classification, and reordering, covering 10 datasets. We used the validation set for evaluation. We use the provided metrics and scripts for evaluation.
|
| 115 |
+
|
| 116 |
+
Baselines We include two sets of baselines in following experiments:
|
| 117 |
+
|
| 118 |
+
(i) Retrieval-based Methods. We measure the association between the question and the documents in the prompt using five SoTA retrieval methods: BM25, Gzip (Jiang et al., 2023b), SentenceBERT (Reimers & Gurevych, 2019), OpenAI Embedding, and the important metric $r _ { k }$ used in LongLLMLingua coarse-grained compression. We discard sentences or paragraphs with low association until the compression constraint is met while keeping the original document order unchanged.
|
| 119 |
+
|
| 120 |
+
Table 1: Performance of different methods with different compression ratios on NaturalQuestions (20 documents) (Liu et al., 2023). Reorder: we reorder the documents with relevance metrics of different baselines as our document reordering strategy described in Sec. 4.2. In the case of OpenAI, it corresponds to LongContextReorder in the LangChain framework (Chase, 2022). For results reported under 1st to 20th, we do not use the reordering strategy for all methods.
|
| 121 |
+
|
| 122 |
+
<table><tr><td rowspan="2">Methods</td><td rowspan="2"></td><td colspan="5">t</td><td></td><td colspan="3"></td><td></td><td colspan="2"></td><td colspan="2"></td></tr><tr><td>1st</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">2x constraint</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Retrieval-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BM25</td><td></td><td>53.749.347.949.946.9</td><td></td><td></td><td>50.3</td><td></td><td>50.944.944.1 42.9 43.2</td><td></td><td></td><td></td><td>46.0</td><td>1,545</td><td>1.9x</td><td>2.1</td><td>1.9x</td></tr><tr><td>Gzip</td><td></td><td>64.663.8 60.5 58.3 57.3</td><td></td><td></td><td></td><td>64.4</td><td>61.9 55.752.7 50.8 50.9</td><td></td><td></td><td></td><td>59.3</td><td>1,567</td><td>1.9x</td><td>2.1</td><td>1.9x</td></tr><tr><td>SBERT</td><td></td><td>72.5 67.963.365.0 66.2</td><td></td><td></td><td></td><td>68.7</td><td>65.8 57.5 54.9 53.4 55.7</td><td></td><td></td><td></td><td>61.4</td><td>1,549</td><td>1.9x</td><td>2.2</td><td>1.9x</td></tr><tr><td>OpenAI</td><td></td><td>73.0 65.666.5 65.4 65.5</td><td></td><td></td><td></td><td>69.9</td><td>65.9 57.5 56.2 54.2 55.7</td><td></td><td></td><td></td><td>61.7</td><td>1,550</td><td>1.9x</td><td>4.9</td><td>0.8x</td></tr><tr><td>LongLLMLingua rk73.967.7 68.766.0 65.6</td><td></td><td></td><td></td><td></td><td></td><td>74.3</td><td>68.5 59.1 56.8 55.3 56.9</td><td></td><td></td><td></td><td>65.2</td><td>1,548</td><td>1.9x</td><td>2.3</td><td>1.8x</td></tr><tr><td colspan="10">Compression-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td></td><td>45.4 39.0 33.833.5 41.5</td><td></td><td></td><td></td><td></td><td>53.2 26.325.424.2 33.3</td><td></td><td></td><td></td><td>1</td><td></td><td>1,4782.0x</td><td>7.4</td><td>0.6x</td></tr><tr><td>LLMLingua</td><td></td><td>39.739.540.437.1 42.3</td><td></td><td></td><td>41.5</td><td></td><td>38.7 37.3 35.7 34.1 37.5</td><td></td><td></td><td></td><td>37.1</td><td>1,410</td><td>2.1x</td><td>2.8</td><td>1.5x</td></tr><tr><td> LongLLMLingua</td><td></td><td></td><td></td><td></td><td></td><td>76.2</td><td></td><td></td><td></td><td></td><td>66.1</td><td>1,429</td><td>2.1x</td><td>2.9</td><td>1.4x</td></tr><tr><td colspan="10">77.2 72.9 70.8 70.5 70.6 68.7 59.4 57.3 55.9 58.4</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">4x constraint</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Retrieval-based Methods BM25</td><td></td><td>40.638.6 38.2 37.4 36.6</td><td></td><td></td><td>36.3</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>2.7x</td></tr><tr><td>Gzip</td><td></td><td></td><td></td><td></td><td></td><td></td><td>39.537.5 36.8 36.4 35.5</td><td></td><td></td><td></td><td>37.7</td><td>798</td><td>3.7x</td><td>1.5</td><td>2.7x</td></tr><tr><td>SBERT</td><td></td><td>63.1 61.0 59.861.1 60.1</td><td></td><td></td><td></td><td>62.3</td><td>57.652.951.050.150.4</td><td></td><td></td><td></td><td>57.2</td><td>824</td><td>3.6x</td><td>1.5</td><td>2.5x</td></tr><tr><td>OpenAI</td><td></td><td>66.961.1 59.0 61.2 60.3</td><td></td><td></td><td></td><td>64.4 63.7</td><td>61.2 56.0 55.1 54.4 55.0</td><td>62.656.6 55.1 53.9 55.0</td><td></td><td></td><td>59.1</td><td>808</td><td>3.6x</td><td>1.6</td><td>1.0x</td></tr><tr><td></td><td></td><td>63.8 64.6 65.4 64.1 63.7</td><td></td><td></td><td></td><td>71.5</td><td>67.8 59.457.7 57.7 58.6</td><td></td><td></td><td></td><td>58.8 64.0</td><td>804 807</td><td>3.7x 3.7x</td><td>4.3 1.7</td><td>2.4x</td></tr><tr><td colspan="10">LongLLMLingua rk71.170.769.368.7 68.5</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Compression-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context LLMLingua</td><td>31.419.524.724.1 43.8</td><td></td><td></td><td></td><td></td><td>1 27.0</td><td>38.217.2 15.916.0 27.3 32.1 30.8 29.9 28.9 32.4</td><td></td><td></td><td></td><td>1 30.5</td><td>791 775</td><td>3.7x 3.8x</td><td>6.8 1.8</td><td>0.6x 2.2x</td></tr><tr><td> LongLLMLingua</td><td>25.527.523.526.530.0</td><td></td><td></td><td></td><td></td><td>75.5</td><td>68.7 60.5 59.3 58.3 61.3</td><td></td><td></td><td></td><td></td><td>748</td><td>3.9x</td><td>2.1</td><td>2.0x</td></tr><tr><td></td><td>75.0 71.8 71.2 71.2 74.7</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>66.7</td><td></td><td></td><td></td><td></td></tr><tr><td>Original Prompt Zero-shot</td><td>[75.7 57.3 54.1 55.4 63.1</td><td></td><td>56.1</td><td></td><td></td><td>1</td><td>68.657.4 55.352.5 55.0</td><td>35.0</td><td></td><td></td><td>-</td><td>2,946 15</td><td>1 196x |</td><td>4.1 1.1</td><td>- 3.7x</td></tr></table>
|
| 123 |
+
|
| 124 |
+
(ii) Compression-based Methods. We compare our approach with two state-of-art methods for prompt compression, i.e., Selective Context (Li, 2023) and LLMLingua (Jiang et al., 2023a). Both methods employ LLaMA-2-7B-Chat as the small language model for compression. In LLMLingua, a coarse-to-fine approach is used to handle constraints of compression ratio: the original prompt is first compressed to $k$ times the constraint at a coarse level, where $k$ is the granular control coefficient; token-level is then performed to reach the overall constraint. Our method follows the same coarse-to-fine logic to achieve the constraint.
|
| 125 |
+
|
| 126 |
+
Main results Table 1 and 2 present the performance of various methods under different compression constraints. There are multiple observations and conclusions: (1) Our LongLLMLingua achieves the best performance across different tasks and constraints of compression ratios. Compared to the original prompt, our compressed prompt can derive higher performance with much lower cost. For example, LongLLMLingua gains a performance boost of $1 7 . 1 \%$ on NaturalQuestions with the ground-truth document at the 10th position, while the number of tokens input to GPT3.5-Turbo is ${ \sim } 4 \mathbf { x }$ less. (2) Compression-based methods like Selective Context (Li, 2023) and LLMLingua (Jiang et al., 2023a) perform poorly on most tasks, especially those with abundant irrelevant information in the original prompt. This is due to their pure information entropy based compression mechanism, which includes too much noise in the compressed results and even leads to performance worse than the zero-shot setting, e.g., on NaturalQuestions. (3) Retrieval-based methods work well with low compression rates. However, their performance declines as the compression progresses, e.g., $2 x 4 x$ ; 3000 tokens $\to 2 0 0 0$ tokens. This may be caused by the decreased recall. Figure 3a is the illustration of cases on NaturalQuestions. (4) LongLLMLingua as well as our coarse-grained compression metric $r _ { k }$ only is much more robust than all other baselines under different tasks and compression constraints. With the increase of the compression rate, e.g., $2 x 4 x$ , LongLLMLingua even achieves a little performance gain. We mainly owe this to the question-aware coarse-to-fine compression, which can better figure out the key information and reach a higher key information density with a higher compression rate. (5) The proposed reordering method helps in not only our approach but also other baselines as shown in Table 1, well demonstrating its effectiveness.
|
| 127 |
+
|
| 128 |
+
Table 2: Performance of different methods under different compression ratios on LongBench (Bai et al., 2023) and ZeroSCROLLS (Shaham et al., 2023) using GPT-3.5-Turbo. Considering the dataset structure, we do not use the reordering strategy here.
|
| 129 |
+
|
| 130 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="9">SinglDoc MuoSFeeesS</td><td rowspan="2"></td><td colspan="3"></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">3,000 tokens constraint</td><td></td><td></td><td></td><td></td></tr><tr><td>Retrieval-based Methods BM25</td><td>32.3</td><td>34.3</td><td>25.3</td><td>57.9</td><td>45.1</td><td>48.940.6</td><td>3,417</td><td>3x</td><td>7.5(2.1x)</td><td>19.8</td><td>3,379</td><td>3x</td><td>5.5(2.2x)</td></tr><tr><td>SBERT</td><td>35.3</td><td>37.4</td><td>26.7</td><td>63.4</td><td>51.0</td><td>34.541.4</td><td>3,399</td><td>3x</td><td>7.7(2.0x)</td><td>24.03,340</td><td></td><td>3x</td><td>5.9(2.1x)</td></tr><tr><td>OpenAI</td><td>34.5</td><td>38.6</td><td>26.8</td><td>63.4</td><td>49.6</td><td>37.641.7</td><td>3,421</td><td>3x</td><td>13.3(1.2x)</td><td>22.4</td><td>3.362</td><td>3x</td><td>11.7(1.0x)</td></tr><tr><td>LongLLMLingua rk</td><td>37.6</td><td>42.9</td><td>26.9</td><td>68.2</td><td>49.9</td><td>53.446.5</td><td>3,424</td><td>3x</td><td>8.2(1.9x)</td><td>29.3</td><td>3,350</td><td>3x</td><td>6.2(2.0x)</td></tr><tr><td colspan="10">Compression-basedMethods</td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td>23.3</td><td>39.2</td><td>25.0</td><td>23.8</td><td>27.5</td><td>53.132.03,328</td><td></td><td></td><td>3x50.6(0.3x)|20.7</td><td></td><td>3,460</td><td>3x</td><td>54.2(0.2x)</td></tr><tr><td>LLMLingua</td><td>31.8</td><td>37.5</td><td>26.2</td><td>67.2</td><td>8.3</td><td></td><td>53.237.43,421</td><td>3x</td><td>9.2(1.7x)</td><td>30.7</td><td>3,366</td><td>3x</td><td>7.4(1.7x)</td></tr><tr><td> LongLLMLingua</td><td>40.7</td><td>46.2</td><td>27.2</td><td>70.6</td><td>53.0</td><td>55.2 48.8</td><td>3,283</td><td>3x</td><td>8.0(1.6x)32.83.412</td><td></td><td></td><td>3x</td><td>8.2(1.5x)</td></tr><tr><td colspan="10">2,000 tokens constraint</td><td colspan="7"></td></tr><tr><td colspan="10"></td><td colspan="7"></td></tr><tr><td>Retrieval-based Methods BM25</td><td>30.1</td><td>29.4</td><td>21.2</td><td>19.5</td><td>12.4</td><td>29.1 23.6</td><td>1,985</td><td>5x</td><td>4.6(3.4x)</td><td></td><td>20.1</td><td>1,799</td><td>5x</td><td>3.8(3.2x)</td></tr><tr><td>SBERT</td><td>33.8</td><td>35.9</td><td>25.9</td><td>23.5</td><td>18.0</td><td>17.825.8</td><td></td><td>1,947</td><td>5x</td><td>4.8(3.4x)</td><td>20.5</td><td>1,773</td><td>6x</td><td>4.1(3.0x)</td></tr><tr><td>OpenAI</td><td>34.3</td><td>36.3</td><td>24.7</td><td>32.4</td><td>26.3</td><td>24.829.8</td><td></td><td>1,991</td><td>5x</td><td>10.4(1.5x)</td><td>20.6</td><td>1,784</td><td>5x</td><td>9.9(1.2x)</td></tr><tr><td>LongLLMLingua rk</td><td>37.8</td><td>41.7</td><td>26.9</td><td>66.3</td><td>53.0</td><td>52.446.3</td><td></td><td>1,960</td><td>5x</td><td>4.7(3.3x)</td><td>24.9</td><td>1,771</td><td>6x</td><td>10.4(1.2x)</td></tr><tr><td colspan="10">Compression-based Methods</td><td colspan="7"></td></tr><tr><td>Selective-Context</td><td></td><td></td><td></td><td>15.7</td><td>8.4</td><td>49.224.8</td><td></td><td>1,925</td><td></td><td></td><td></td><td></td><td></td><td>47.5(0.3x)</td></tr><tr><td>LLMLingua</td><td>16.2 22.4</td><td>34.8 32.1</td><td>24.4 24.5</td><td>61.2</td><td>10.4</td><td>56.834.6</td><td></td><td>1,950</td><td>5x</td><td>5x47.1(0.3x)|19.4 5.9(2.6x)</td><td>27.2</td><td>1,865 1,862</td><td>5x 5x</td><td>4.8(2.5x)</td></tr><tr><td> LongLLMLingua</td><td>39.0</td><td>42.2</td><td>27.4</td><td>69.3</td><td>53.8</td><td>56.6 48.01,809</td><td></td><td></td><td>6x</td><td>6.1(2.6x)|32.5</td><td></td><td>1,753</td><td>6x</td><td>5.2(2.3x)</td></tr><tr><td>Original Prompt</td><td></td><td></td><td></td><td></td><td></td><td>54.244.0 10,295</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Zero-shot</td><td>39.7 15.6</td><td>38.7 31.3</td><td>26.5 15.6</td><td>67.0 40.7</td><td>37.8 1.6</td><td>36.223.5</td><td></td><td>214</td><td>-</td><td>15.6 48x1.6(9.8x)</td><td>132.59,788 10.8</td><td>32</td><td>-</td><td>12.2 306x 1.0(12.2x)</td></tr></table>
|
| 131 |
+
|
| 132 |
+
Ablation study To evaluate the contributions of different components in LongLLMLingua, we introduce following variants of it for ablation study. (1) Variants about Question-aware Coarsegrained Compression, include: ours w/o Questionawareness, which calculates question-text relevance $r _ { k }$ using information entropy in LLMLingua, ours w/ SBERT, which employs SBERT to compute $r _ { k }$ , ours w/ $p ( \mathbf { x } _ { k } ^ { \mathrm { d o c } } | \boldsymbol { x } _ { i } ^ { \mathrm { q u e , r e s t r i c t } } )$ |xque,restricti ), which replace p(xque,restricti |x doc with $p ( \mathbf { x } _ { k } ^ { \mathrm { d o c } } | x _ { i } ^ { \mathrm { q u e , r e s t r 1 c t } } )$ in Eq. 2, and ours w/o restrict, which only calculates the conditional probability corresponding to $x ^ { \mathrm { q u e } }$ . (2) Ours w/o Question-aware Fine-grained, which disregards Eq. (3) and only applies Iterative Token-level Prompt Compression as LLMLingua. (3) Ours w/o Dynamic Compression Ratio, where all documents share the same compression ratio in fine-grained compression.
|
| 133 |
+
|
| 134 |
+
Table 3: Ablation study on NaturalQuestions with $2 \mathbf { x }$ constraint using GPT-3.5-Turbo.
|
| 135 |
+
|
| 136 |
+
<table><tr><td>1st 5th 10th 15th 20th</td></tr><tr><td>LongLLMLingua 77.2 72.9 70.8 70.5 70.6 Question-awareCoarse-grained - w/o Question-awareness 42.1 40.3 39.7 40.1 40.3</td></tr><tr><td>- W/SBERT 73.2 68.5 65.7 66.1 66.7 - w/p(xdoq| ,que,restrict 56.0 52.6 53.4 51.6 51.1 - w/o restrict 75.172.2 70.3 70.370.2 xi</td></tr><tr><td>- w/o Question-aware Fine-grained 75.8 71.0 68.9 68.4 69.3 - w/o Dynamic Compression Ratio 74.4 70.7 68.7 67.9 68.1 - w/o Subsequence Recovery 76.7 71.7 69.4 69.3 69.7</td></tr><tr><td>- w/ Document Reordering 76.2 76.2 76.2 76.2 76.2 - w/ GPT2-small 74.6 71.7 70.169.8 68.5</td></tr></table>
|
| 137 |
+
|
| 138 |
+
(4) Ours w/o and (5) LLMLingua w/ Subsequence Recovery, which either removes or adds the postprocessing subsequence recovery strategy. (6) Ours w/ GPT2-small, which uses the GPT2-small model as the small language model.
|
| 139 |
+
|
| 140 |
+
Table 3 shows the results of the ablation study. In summary, removing any component proposed for LongLLMLingua will lead to a performance drop regardless of the position of the ground-truth answer. This well validates the necessity and effectiveness of the proposed question-aware mechanism during coarse-to-fine compression, the dynamic compression ratio, and the subsequence recovery strategy. It also shows that applying SBERT for coarse-grained compression will result in inferior performance, which implies the superiority of our question-aware importance metric in Eq. 2 over SBERT. In addition, replacing $p ( x _ { i } ^ { \mathrm { q u e , r e s t r u c t } } | \mathbf { x } _ { k } ^ { \mathrm { d o c } } )$ with $p ( \mathbf { x } _ { k } ^ { \mathrm { d o c } } | x _ { i } ^ { \mathrm { q u e , r e s t r i c t } } )$ can greatly affect performance due to the large noise in calculating $p ( \mathbf { x } _ { k } ^ { \mathrm { { d o c } } } )$ since the perplexity of document depends on many other information besides the question. Removing the restrictive statement can increase the hallucination of small language models, leading to a decrease in performance. Moreover, our subsequence recovery strategy can also bring performance gains for LLMLingua. However, without our question-aware mechanism, results from LLMLingua are still less satisfactory. For more detailed cases, please go to Appendix F.
|
| 141 |
+
|
| 142 |
+
Latency evaluation We conducte end-to-end latency testing on a V100-32G, using the prompts from Multi-document QA, LongBench, and ZeroSCROLLS in the API call, and results are shown in Table 1 and 2. The latency includes the time cost for prompt compression and the request time for LLMs, with multiple measurements taken and averaged over. Results demonstrate that LongLLMLingua does indeed speed up the overall inference under different compression ratios and scenarios. Moreover, with the compression ratio increasing, the acceleration effect becomes more pronounced up to 2.6x. However, the OpenAI embedding and Selective-Context results in longer latency time, due to repeated API calls and the sequential entropy calculation of semantic units, respectively.
|
| 143 |
+
|
| 144 |
+
# 6 RELATED WORKS
|
| 145 |
+
|
| 146 |
+
Long context for LLMs. Recent research has focused on expanding the window size of LLMs. Main approaches include: (1) Staged pre-training (Nijkamp et al., 2023) which gradually increases the context window; (2) Modifying (Press et al., 2022) or interpolating position embeddings (Chen et al., 2023; Peng et al., 2023; Han et al., 2023); (3) Using linear or sparse attention mechanisms (Ding et al., 2023; Sun et al., 2023); (4) Utilizing external memory modules for context storage (Bertsch et al., 2023; Tworkowski et al., 2023). While these methods address context window expansion, their impact on downstream task performance has yet to be discussed.
|
| 147 |
+
|
| 148 |
+
Information distribution in prompt. Recent empirical experiments have shown that LLM performance decreases with less effective information in a prompt (Bai et al., 2023; Li et al., 2023a; Shi et al., 2023). Moreover, the position of relevant information in a prompt has a significant impact on performance(Wu et al., 2022). Liu et al. (2023) suggests that LLMs have more difficulty comprehending information located in the middle of a prompt compared to those at the edges.
|
| 149 |
+
|
| 150 |
+
Retrieval methods can be categorized as dense or sparse retrieval methods. Sparse retrieval methods, like BM25, determine the relevance between queries and documents based on n-gram information. Conversely, dense retrieval methods assess the relevance between queries and documents in latent space using dense vectors, such as SentenceBERT (Reimers & Gurevych, 2019) and OpenAI Embedding. Recently, Jiang et al. (2023b)) proposed an unsupervised dense retrieval method that leverages traditional compression algorithms, such as gzip, and k-nearest neighbors.
|
| 151 |
+
|
| 152 |
+
Prompt compression methods can be grouped into three main categories: (1) Token pruning (Goyal et al., 2020; Kim & Cho, 2021; Modarressi et al., 2022) and token merging (Bolya et al., 2023), which need model fine-tuning or intermediate results during inference and have been used with BERT-scale models. (2) Soft prompt tuning methods like GIST (Mu et al., 2023), AutoCompressor (Chevalier et al., 2023), and ICAE (Ge et al., 2023), which require LLMs’ parameter fine-tuning, making them suitable for specific domains but not directly applicable to black-box LLMs. (3) Information-entropy-based approaches such as Selective Context (Li, 2023) and LLMLingua (Jiang et al., 2023a), which use a small language model to calculate the self-information or perplexity of each token in the original prompt and then remove tokens with lower perplexities.
|
| 153 |
+
|
| 154 |
+
# 7 CONCLUSION
|
| 155 |
+
|
| 156 |
+
We propose LongLLMLingua to address the three challenges, i.e., higher computational/financial cost, longer system latency, and inferior performance for LLMs in long context scenarios. We develop LongLLMLingua from the perspective of efficient prompt compression, thus reducing both computational/financial cost and the system latency. We further design four components, i.e., a question-aware coarse-to-fine compression method, a document reordering mechanism, dynamic compression ratios, and a post-compression subsequence recovery strategy to improve LLMs’ perception of the key information, with which LongLLMLingua demonstrate superior performance. Experiments on one multi-document QA benchmark and two long context benchmarks demonstrate that LongLLMLingua compressed prompt can derive higher performance than original prompts while both API costs for inference and the end-to-end system latency are largely reduced.
|
| 157 |
+
|
| 158 |
+
REFERENCES
|
| 159 |
+
Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, et al. Longbench: A bilingual, multitask benchmark for long context understanding. ArXiv preprint, abs/2308.14508, 2023. URL https://arxiv.org/ abs/2308.14508.
|
| 160 |
+
Amanda Bertsch, Uri Alon, Graham Neubig, and Matthew R. Gormley. Unlimiformer: Long-range transformers with unlimited length input. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ lJWUJWLCJo.
|
| 161 |
+
Daniel Bolya, Cheng-Yang Fu, Xiaoliang Dai, Peizhao Zhang, Christoph Feichtenhofer, and Judy Hoffman. Token merging: Your vit but faster. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $=$ JroZRaRw7Eu.
|
| 162 |
+
Harrison Chase. LangChain, 2022. URL https://github.com/hwchase17/langchain.
|
| 163 |
+
Shouyuan Chen, Sherman Wong, Liangjian Chen, and Yuandong Tian. Extending context window of large language models via positional interpolation. ArXiv preprint, abs/2306.15595, 2023. URL https://arxiv.org/abs/2306.15595.
|
| 164 |
+
Alexis Chevalier, Alexander Wettig, Anirudh Ajith, and Danqi Chen. Adapting language models to compress contexts. ArXiv preprint, abs/2305.14788, 2023. URL https://arxiv.org/ abs/2305.14788.
|
| 165 |
+
Jiayu Ding, Shuming Ma, Li Dong, Xingxing Zhang, Shaohan Huang, Wenhui Wang, and Furu Wei. Longnet: Scaling transformers to 1,000,000,000 tokens. ArXiv preprint, abs/2307.02486, 2023. URL https://arxiv.org/abs/2307.02486.
|
| 166 |
+
Qingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Zhiyong Wu, Baobao Chang, Xu Sun, Jingjing Xu, and Zhifang Sui. A survey for in-context learning. ArXiv preprint, abs/2301.00234, 2023. URL https://arxiv.org/abs/2301.00234.
|
| 167 |
+
Tao Ge, Jing Hu, Xun Wang, Si-Qing Chen, and Furu Wei. In-context autoencoder for context compression in a large language model. ArXiv preprint, abs/2307.06945, 2023. URL https: //arxiv.org/abs/2307.06945.
|
| 168 |
+
Saurabh Goyal, Anamitra Roy Choudhury, Saurabh Raje, Venkatesan T. Chakaravarthy, Yogish Sabharwal, and Ashish Verma. Power-bert: Accelerating BERT inference via progressive word-vector elimination. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pp. 3690–3699. PMLR, 2020. URL http://proceedings.mlr.press/v119/ goyal20a.html.
|
| 169 |
+
Chi Han, Qifan Wang, Wenhan Xiong, Yu Chen, Heng Ji, and Sinong Wang. Lm-infinite: Simple on-the-fly length generalization for large language models. ArXiv preprint, abs/2308.16137, 2023. URL https://arxiv.org/abs/2308.16137.
|
| 170 |
+
Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, and Edouard Grave. Unsupervised dense information retrieval with contrastive learning. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL https: //openreview.net/forum?id ${ . } = { }$ jKN1pXi7b0.
|
| 171 |
+
Huiqiang Jiang, Qianhui Wu, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. Llmlingua: Compressing prompts for accelerated inference of large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, December 2023a. URL https://arxiv.org/abs/2310.05736.
|
| 172 |
+
Zhiying Jiang, Matthew Yang, Mikhail Tsirlin, Raphael Tang, Yiqin Dai, and Jimmy Lin. “lowresource” text classification: A parameter-free classification method with compressors. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 6810–6828, Toronto, Canada, 2023b. Association for Computational Linguistics. doi: 10.18653/v1/2023.findings-acl. 426. URL https://aclanthology.org/2023.findings-acl.426.
|
| 173 |
+
Gyuwan Kim and Kyunghyun Cho. Length-adaptive transformer: Train once with length drop, use anytime with search. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 6501–6511, Online, 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.508. URL https://aclanthology.org/2021. acl-long.508.
|
| 174 |
+
Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452–466, 2019. doi: 10.1162/tacl a 00276. URL https://aclanthology.org/Q19-1026.
|
| 175 |
+
Patrick S. H. Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rockt ¨ aschel, Sebastian Riedel, ¨ and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and HsuanTien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips.cc/paper/2020/hash/ 6b493230205f780e1bc26945df7481e5-Abstract.html.
|
| 176 |
+
Dacheng Li, Rulin Shao, Anze Xie, Ying Sheng, Lianmin Zheng, Joseph E. Gonzalez, Ion Stoica, Xuezhe Ma, and Hao Zhang. How long can open-source llms truly promise on context length?, 2023a. URL https://lmsys.org/blog/2023-06-29-longchat.
|
| 177 |
+
Jiaqi Li, Mengmeng Wang, Zilong Zheng, and Muhan Zhang. Loogle: Can long-context language models understand long contexts? ArXiv preprint, abs/2311.04939, 2023b. URL https:// arxiv.org/abs/2311.04939.
|
| 178 |
+
Yucheng Li. Unlocking context constraints of llms: Enhancing context efficiency of llms with self-information-based content filtering. ArXiv preprint, abs/2304.12102, 2023. URL https: //arxiv.org/abs/2304.12102.
|
| 179 |
+
Nelson F Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. ArXiv preprint, abs/2307.03172, 2023. URL https://arxiv.org/abs/2307.03172.
|
| 180 |
+
Ali Modarressi, Hosein Mohebbi, and Mohammad Taher Pilehvar. AdapLeR: Speeding up inference by adaptive length reduction. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1–15, Dublin, Ireland, 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.1. URL https://aclanthology.org/2022.acl-long.1.
|
| 181 |
+
Jesse Mu, Xiang Lisa Li, and Noah Goodman. Learning to compress prompts with gist tokens. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https: //openreview.net/forum?id $=$ 2DtxPCL3T5.
|
| 182 |
+
Erik Nijkamp, Tian Xie, Hiroaki Hayashi, Bo Pang, Congying Xia, Chen Xing, Jesse Vig, Semih Yavuz, Philippe Laban, Ben Krause, Senthil Purushwalkam, Tong Niu, Wojciech Krysci ´ nski, ´ Lidiya Murakhovs’ka, Prafulla Kumar Choubey, Alex Fabbri, Ye Liu, Rui Meng, Lifu Tu, Meghana Bhat, Chien-Sheng Wu, Silvio Savarese, Yingbo Zhou, Shafiq Joty, and Caiming Xiong. Xgen-7b technical report. ArXiv preprint, abs/2309.03450, 2023. URL https: //arxiv.org/abs/2309.03450.
|
| 183 |
+
Joon Sung Park, Joseph C O’Brien, Carrie J Cai, Meredith Ringel Morris, Percy Liang, and Michael S Bernstein. Generative agents: Interactive simulacra of human behavior. ArXiv preprint, abs/2304.03442, 2023. URL https://arxiv.org/abs/2304.03442.
|
| 184 |
+
Bowen Peng, Jeffrey Quesnelle, Honglu Fan, and Enrico Shippole. Yarn: Efficient context window extension of large language models. ArXiv preprint, abs/2309.00071, 2023. URL https:// arxiv.org/abs/2309.00071.
|
| 185 |
+
Ofir Press, Noah Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $_ { \cdot } =$ R8sQPpGCv0.
|
| 186 |
+
Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using Siamese BERTnetworks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pp. 3982–3992, Hong Kong, China, 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1410. URL https://aclanthology.org/D19-1410.
|
| 187 |
+
Uri Shaham, Maor Ivgi, Avia Efrat, Jonathan Berant, and Omer Levy. Zeroscrolls: A zero-shot benchmark for long text understanding. ArXiv preprint, abs/2305.14196, 2023. URL https: //arxiv.org/abs/2305.14196.
|
| 188 |
+
Freda Shi, Xinyun Chen, Kanishka Misra, Nathan Scales, David Dohan, Ed H Chi, Nathanael Scharli, and Denny Zhou. Large language models can be easily distracted by irrelevant context. ¨ In International Conference on Machine Learning, pp. 31210–31227. PMLR, 2023.
|
| 189 |
+
Yutao Sun, Li Dong, Shaohan Huang, Shuming Ma, Yuqing Xia, Jilong Xue, Jianyong Wang, and Furu Wei. Retentive network: A successor to transformer for large language models. ArXiv preprint, abs/2307.08621, 2023. URL https://arxiv.org/abs/2307.08621.
|
| 190 |
+
Harsh Trivedi, Niranjan Balasubramanian, Tushar Khot, and Ashish Sabharwal. MuSiQue: Multihop questions via single-hop question composition. Transactions of the Association for Computational Linguistics, 2022.
|
| 191 |
+
Szymon Tworkowski, Konrad Staniszewski, Mikołaj Pacek, Yuhuai Wu, Henryk Michalewski, and Piotr Miłos. Focused transformer: Contrastive training for context scaling. ´ ArXiv preprint, abs/2307.03170, 2023. URL https://arxiv.org/abs/2307.03170.
|
| 192 |
+
Zhiyong Wu, Yaoxiang Wang, Jiacheng Ye, and Lingpeng Kong. Self-adaptive in-context learning: An information compression perspective for in-context example selection and ordering. ArXiv preprint, abs/2212.10375, 2022. URL https://arxiv.org/abs/2212.10375.
|
| 193 |
+
Wenhan Xiong, Jingyu Liu, Igor Molybog, Hejia Zhang, Prajjwal Bhargava, Rui Hou, Louis Martin, Rashi Rungta, Karthik Abinav Sankararaman, Barlas Oguz, Madian Khabsa, Han Fang, Yashar Mehdad, Sharan Narang, Kshitiz Malik, Angela Fan, Shruti Bhosale, Sergey Edunov, Mike Lewis, Sinong Wang, and Hao Ma. Effective long-context scaling of foundation models. ArXiv preprint, abs/2309.16039, 2023. URL https://arxiv.org/abs/2309.16039.
|
| 194 |
+
|
| 195 |
+
# A TOKEN-LEVEL SUBSQUENCE RECOVERY DETAILS
|
| 196 |
+
|
| 197 |
+
Algorithm 1 Pseudo code of Token-level Subsquence Recovery.
|
| 198 |
+
|
| 199 |
+
Input: The original prompt $_ { \pmb { x } }$ ; the compressed prompt $\widetilde { \pmb x }$ ; the generation response of LLMs $\textbf { { y } }$ .
|
| 200 |
+
1: Set the final response list $y _ { \mathrm { r e c } } = \phi$ , the left token index of subsquence $l$ to 0.
|
| 201 |
+
2: while $l < { \bf { y } } . l e n ( )$ do
|
| 202 |
+
3: if Substring $y _ { l } \in \widetilde { \pmb x }$ then
|
| 203 |
+
4: eFind the longer substring $\widetilde { \pmb { y } } _ { \mathrm { k e y } , l } = \left\{ y _ { l } , y _ { l + 1 } , . . . , y _ { r } \right\} \in \widetilde { \pmb { x } }$ .
|
| 204 |
+
5: eFind the maximum common shortest subsequence $\pmb { x } _ { i , j } = \{ x _ { i } , x _ { i + 1 } , . . . , x _ { j } \}$ in the original prompt
|
| 205 |
+
$_ { \textbf { \em x } }$ .
|
| 206 |
+
6: Add the subsequence $\pmb { x } _ { i , j } = \{ x _ { i } , x _ { i + 1 } , . . . , x _ { j } \}$ to the response $\scriptstyle { \pmb { y } } _ { \mathrm { r e c } }$ .
|
| 207 |
+
7: Set the left index $l$ to $r + 1$ .
|
| 208 |
+
8: else
|
| 209 |
+
9: Add the token $y _ { l }$ to the response $\scriptstyle { \pmb { y } } _ { \mathrm { r e c } }$ .
|
| 210 |
+
10: Set the left index $l$ to $l + 1$ .
|
| 211 |
+
11: end if
|
| 212 |
+
12: end while
|
| 213 |
+
Output: The final response list $\scriptstyle { \pmb { y } } _ { \mathrm { r e c } }$ .
|
| 214 |
+
|
| 215 |
+
# B DERIVATION OF QUESTION-AWARE FINE-GRAINED COMPRESSION
|
| 216 |
+
|
| 217 |
+
Based on the definition of Eq. 3, we can derive that,
|
| 218 |
+
|
| 219 |
+
$$
|
| 220 |
+
\begin{array} { r l } & { s _ { i } = \mathrm { p e r p l e x i t y } ( x _ { i } | { x } _ { < i } ) - \mathrm { p e r p l e x i t y } ( x _ { i } | { x } ^ { \mathrm { q u e } } , { x } _ { < i } ) } \\ & { \quad = q ( x _ { i } ) \log p ( x _ { i } | { x } ^ { \mathrm { q u e } } , { x } _ { < i } ) - q ( x _ { i } ) \log p ( x _ { i } | { x } _ { < i } ) } \\ & { \quad = q ( x _ { i } ) \log \frac { p ( x _ { i } | { x } ^ { \mathrm { q u e } } , { x } _ { < i } ) } { p ( x _ { i } | { x } _ { < i } ) } } \end{array}
|
| 221 |
+
$$
|
| 222 |
+
|
| 223 |
+
In the actual calculation of perplexity, a log operation is performed to avoid overflow, and $\cdot$ represents the probability distribution of the ground-truth.
|
| 224 |
+
|
| 225 |
+
At the same time, we can derive the following expanded expression based on Bayes’ theorem.
|
| 226 |
+
|
| 227 |
+
$$
|
| 228 |
+
p ( x ^ { \mathfrak { q } \mathfrak { u e } } | x _ { i } , x _ { < i } ) = { \frac { p ( x _ { i } | x ^ { \mathfrak { q } \mathfrak { u e } } , x _ { < i } ) p ( x ^ { \mathfrak { q } \mathfrak { u e } } ) } { p ( x _ { i } | x _ { < i } ) } } = p ( x ^ { \mathfrak { q } \mathfrak { u e } } ) { \frac { p ( x _ { i } | x ^ { \mathfrak { q } \mathfrak { u e } } , x _ { < i } ) } { p ( x _ { i } | x _ { < i } ) } }
|
| 229 |
+
$$
|
| 230 |
+
|
| 231 |
+
The probability distribution $\cdot$ of the question and the ground-truth distribution $q ( x _ { i } )$ of $\cdot$ are constants, hence $s _ { i }$ can be considered as the representation of Eq. 7.
|
| 232 |
+
|
| 233 |
+
$$
|
| 234 |
+
s _ { i } \propto p ( x ^ { \mathrm { q u e } } | x _ { i } , x _ { < i } )
|
| 235 |
+
$$
|
| 236 |
+
|
| 237 |
+
So we can utilize Eq. 3 to represent the probability distribution $\_$ , which represents the condition likelihood of generating $x ^ { \mathrm { q u e } }$ given the token $\cdot$ . Therefore, we can represent the token-level sensitive distribution for the question $x ^ { \mathrm { q u e } }$ using just a single inference. For tokens that are unrelated to $x ^ { \mathrm { q u e } }$ , such as the tokens on the right side of Figure 3b, their original amount of information may be high, but the contrastive perplexity remains at a relatively low level.
|
| 238 |
+
|
| 239 |
+
# C EXPERIMENT DETAILS
|
| 240 |
+
|
| 241 |
+
# C.1 DATASET DETAILS
|
| 242 |
+
|
| 243 |
+
NaturalQuestions multi-document QA A multi-document question-answering dataset, comprising 2,655 problems, was built by Liu et al. (2023) based on the NaturalQuestions dataset (Kwiatkowski et al., 2019). This dataset provides a realistic retrieval-augmented generation setup that closely resembles commercial search and question-answering applications (e.g., Bing Chat). Each example in the dataset contains a question and $\mathbf { k }$ related documents, utilizing the Contriever retrieval system (Izacard et al., 2022), one of which includes a document with the correct answer. To perform this task, the model must access the document containing the answer within its input context and use it to answer the question. The dataset’s data is sourced from the NaturalQuestions dataset, which contains historical queries issued to the Google search engine and human-annotated answers extracted from Wikipedia. The average prompt token length in this benchmark is 2,946. For our experiments, we used the version provided by Liu et al. (2023) that includes 20 documents7. The dataset comprises five different ground truth document position settings in the prompt: 1st, 5th, 10th, 15th, and 20th.
|
| 244 |
+
|
| 245 |
+
LongBench A multi-task long context benchmark consists of 3,750 problems in English and includes six categories with a total of 16 tasks. These tasks encompass key long-text application scenarios, such as single-document QA, multi-document QA, summarization, few-shot learning, synthetic tasks, and code completion. The average prompt token length in this benchmark is 10,289. For our experiments, we used the English dataset and evaluation scripts provided by Bai et al. (2023) for this benchmark8.
|
| 246 |
+
|
| 247 |
+
ZeroSCROLLS The multi-task long context benchmark consists of 4,378 problems, including four categories with a total of 10 tasks. These tasks cover summarization, question answering, aggregated sentiment classification, and information reordering. The average prompt token length in this benchmark is 9,788. For our experiments, we used the validation set and evaluation scripts provided by Shaham et al. (2023) for this dataset9.
|
| 248 |
+
|
| 249 |
+
MuSiQue The multi-hop question-answer dataset is composed of 39,876, 4,834, and 4,918 problems in the training, validation, and testing datasets, respectively. This dataset requires the language model to conduct multiple inferences based on the content of several documents and provide corresponding answers, thereby necessitating a certain capability for global information processing. The average token length for prompts in this dataset is 2,477. For our experiments, we utilized the validation set and evaluation scripts provided by Trivedi et al. (2022) for this dataset10.
|
| 250 |
+
|
| 251 |
+
LooGLE The multi-task long context benchmark comprises 6,448 problems, divided into three categories: summarization, short dependency question answering, and long dependency question answering. The average prompt token length in this benchmark stands at 24,005. For our experiments, we focused on the long dependency question answering subset, which includes four types of tasks: information retrieval, timeline reordering, computation, and comprehension. This subset contains 1,101 problems. We utilized the evaluation scripts provided by Li et al. (2023b) for this dataset11.
|
| 252 |
+
|
| 253 |
+
# C.2 OTHER IMPLEMENTATION DETAILS
|
| 254 |
+
|
| 255 |
+
All experiments were conducted using a Tesla V100 (32GB). We use tiktoken12 and GPT-3.5-Turbo model to count all the tokens. We set the granular control coefficient $k$ to 2. We use the pre-defined compression rates $\tau _ { \mathrm { i n s } } ~ = ~ 0 . 8 5$ and $\tau _ { \mathrm { q u e } } = 0 . 9$ for instructions and questions. The segment size used in the iterative token-level compression is set to 200. The $\delta \tau$ used in dynamic compression ratio is set to 0.25. For a fair comparison, we only used reordering in the NaturalQuestions Multidocument QA and noted this in Table 1. We use “We can get the answer to this question in the given documents.” as the guideline sentence in Equation (3).
|
| 256 |
+
|
| 257 |
+
For the baselines experiment, we use the currently recommended strongest model, all-mpnetbase- $. \mathbf { V } 2 ^ { 1 3 }$ , as the dense representation model for SentenceBERT. We use the recommended “textembedding-ada-002” as the embedding model for OpenAI Embedding14. We use the GPT2-dolly15 as the small language model in w/ GPT2-small ablation experiments.
|
| 258 |
+
|
| 259 |
+
D ADDITIONAL EXPERIMENTAL RESULTS
|
| 260 |
+
|
| 261 |
+
# D.1 DOCUMENT-LEVEL AVERAGE PERPLEXITY DISTRIBUTION
|
| 262 |
+
|
| 263 |
+

|
| 264 |
+
Figure 5: The distribution of document-level average perplexity when the ground-truth document is in different positions.
|
| 265 |
+
|
| 266 |
+
Figure 5 shows the distribution of the document’s average perplexity when the ground-truth is located at different positions within the prompt. As can be observed, as the context length increases, the original perplexity curve remains relatively stable. In unrelated documents, a higher perplexity is still retained, making it easier to remove relevant tokens from the related documents in the prompt compression process, thereby damaging the corresponding semantic information. Contrarily, contrastive perplexity shows an increase in perplexity in documents related to the question. According to the theoretical derivation in Appendix B, it’s known that contrastive perplexity characterizes the conditional probability of tokens corresponding to the question. The higher the relevance, the higher the contrastive perplexity, thereby retaining key information in the prompt compression process.
|
| 267 |
+
|
| 268 |
+
# D.2 ZEROSCROLLS BREAKDOWNS
|
| 269 |
+
|
| 270 |
+
Table 4: Performance breakdown of different methods under different compression ratios on ZeroSCROLLS (Shaham et al., 2023) using GPT-3.5-Turbo.
|
| 271 |
+
|
| 272 |
+
<table><tr><td>Methods</td><td>GvRp SSFD QMsm SQAL QALT Nrtv Qspr MuSQ SpDg BkSS AVG|Tokens1/T</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">3,000 tokens constraint</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Retrieval-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BM25</td><td>9.7</td><td>3.4</td><td>11.7</td><td>14.3</td><td>57.1</td><td>5.9</td><td>25.7</td><td>11.2</td><td>29.6</td><td>29.6</td><td>19.8</td><td>3.379</td><td>3x</td></tr><tr><td>SBERT</td><td>16.5</td><td>9.8</td><td>12.3</td><td>15.2</td><td>60.0</td><td>14.623.4</td><td></td><td>12.1</td><td>39.4</td><td>36.4</td><td>24.0</td><td>3.340</td><td>3x</td></tr><tr><td>OpenAI</td><td>14.3</td><td>8.3</td><td>12.0</td><td>15.3</td><td>66.7</td><td>13.324.3</td><td></td><td>11.7</td><td>31.2</td><td>26.4</td><td>22.4</td><td>3,362</td><td>3x</td></tr><tr><td>LongLLMLingua rk</td><td>19.5</td><td>11.6</td><td>14.7</td><td>15.5</td><td>66.7</td><td>20.527.6</td><td></td><td>13.0</td><td>60.8</td><td>43.4</td><td>29.3</td><td>3,350</td><td>3x</td></tr><tr><td colspan="10">Compression-based Methods</td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td>20.8</td><td>9.1</td><td>11.7</td><td>13.4</td><td>50.0</td><td>9.826.1</td><td></td><td>11.0</td><td>46.0</td><td>9.5</td><td>20.7</td><td>3,460</td><td>3x</td></tr><tr><td>LLMLingua</td><td>18.7</td><td>10.0</td><td>14.9</td><td>16.8</td><td>61.9</td><td>26.927.2</td><td></td><td>23.4</td><td>62.9</td><td>44.5</td><td>30.7</td><td>3.366</td><td>3x</td></tr><tr><td>LongLLMLingua </td><td>21.9</td><td>12.7</td><td>15.5</td><td>17.0</td><td>66.9</td><td>27.6 31.1</td><td></td><td>23.8</td><td>65.6</td><td>46.4</td><td>32.8</td><td>3.412</td><td>3x</td></tr><tr><td colspan="10">2,000 tokens constraint</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">Retrieval-based Methods</td><td></td><td></td><td></td><td></td></tr><tr><td>BM25</td><td>8.8</td><td>2.5</td><td>11.1</td><td>13.5</td><td>60.0</td><td>7.0</td><td>4.9</td><td>20.3</td><td>39.9</td><td>32.9</td><td>20.1</td><td>1,799</td><td>5x</td></tr><tr><td>SBERT</td><td>10.2</td><td>7.9</td><td>13.7</td><td>13.2</td><td>60.0</td><td>8.1</td><td>10.8</td><td>1.7</td><td>37.2</td><td>42.8</td><td>20.5</td><td>1,773</td><td>6x</td></tr><tr><td>OpenAI</td><td>11.1</td><td>8.0</td><td>11.8</td><td>13.6</td><td>60.0</td><td>7.1</td><td>13.2</td><td>4.0</td><td>33.6</td><td>43.6</td><td>20.6</td><td>1,784</td><td>5x</td></tr><tr><td>LongLLMLingua rk</td><td>18.2</td><td>9.8</td><td>12.3</td><td>15.9</td><td>57.1</td><td>10.1 17.8</td><td></td><td>7.3</td><td>57.7</td><td>42.3</td><td>24.9</td><td>1,771</td><td>6x</td></tr><tr><td colspan="10">Compression-based Methods</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td>19.0</td><td>8.4</td><td>9.7</td><td>12.4</td><td>47.0</td><td>12.5 21.6</td><td></td><td>11.5</td><td>41.2</td><td>11.0</td><td>19.4</td><td>1,865</td><td>5x</td></tr><tr><td>LLMLingua</td><td>19.4</td><td>11.9</td><td>13.1</td><td>16.0</td><td>62.1</td><td>23.724.0</td><td></td><td>22.4</td><td>33.9</td><td>44.9</td><td>27.2</td><td>1,862</td><td>5x</td></tr><tr><td>LongLLMLingua</td><td>19.9</td><td>12.3</td><td>14.7</td><td>16.5</td><td>64.9</td><td>27.4 30.6</td><td></td><td>23.5</td><td>68.3</td><td>47.1</td><td> 32.5</td><td>1,809</td><td>6x</td></tr><tr><td>Original Prompt</td><td>21.8</td><td>12.1</td><td>17.9</td><td>17.4</td><td>66.7</td><td>25.329.8</td><td></td><td>20.0</td><td>69.7</td><td>44.1</td><td>32.5</td><td>9.788</td><td>-</td></tr><tr><td>Zero-shot</td><td>9.4</td><td>3.0</td><td>8.6</td><td>11.4</td><td>42.9</td><td>10.612.4</td><td></td><td>5.5</td><td>4.2</td><td>0.0</td><td>12.8</td><td>32</td><td>306x</td></tr></table>
|
| 273 |
+
|
| 274 |
+
Table 4 presents a detailed performance breakdown on the ZeroSCROLLS benchmark. It can be observed that in the four summarization tasks - GvRp, SSFD, QMsm, SQAL, LongLLMLingua closely matches or slightly surpasses the original results under two compression constraints. Meanwhile, in the four long context QA tasks - Qsqr, Nrtv, QALT, MuSQ, there is a significant improvement. Notably, in the MuSiQue task, which is based on a question-answering dataset from books and movie scripts, there is a 2.1 point increase even under a 2,000 tokens constraint. It’s worth mentioning that MuSiQue is a multi-hop question-answering dataset that requires LLMs to utilize global information for long dependency QA. LongLLMLingua can also improve by 3.5 points under a 6x compression ratio. In the two ordering tasks, SpDg and BkSS, LongLLMLingua can better retain globally sensitive information, resulting in a 3.0 point improvement in BkSS after prompt compression.
|
| 275 |
+
|
| 276 |
+
It’s important to note that although the ZeroScrolls validation dataset is relatively small, it still demonstrates conclusions similar to previous experimental observations across various methods and tasks. Furthermore, this study conducted an in-depth analysis of the multi-hop QA task - MuSiQue, and another long context benchmark - LooGLE. The results can be found in Appendix D.3 and Appendix D.6.
|
| 277 |
+
|
| 278 |
+
# D.3 MUSIQUE
|
| 279 |
+
|
| 280 |
+
Table 5 presents the results from the MuSiQue multihop question-answer dataset. From the table, it can be observed that in the multi-hop QA task, requiring global information: 1) LongLLMLingua can reduce noise in the prompt by eliminating irrelevant information and putting more related information at the beginning or end of the prompt, thereby improving performance by 5.4 points. 2) The performance drop is more pronounced for retrievalbased methods, particularly for n-gram-based methods like BM25. Due to long dependencies, direct matching information is lost, resulting in less relevant information being recalled. 3) The performance of compression-based methods is slightly different. Selective-Context does not distinguish between different modules’ sensitivity, resulting in a loss of question and instruction-related information, thereby leading to poorer performance. However, LLMLingua can still retain relevant key information at around a $\cdot$ compression ratio. 4) The ablation experiments show that every module designed in LongLLMLingua plays a role in the multi-hop task. The removal of the question-aware coarse-grained and w/ $\cdot$ modules, which have difficulty in perceiving the importance distribution of corresponding questions, can cause a drop of up to 8 points. Removing the restrict prompt in the question-aware coarse module can also cause a 2-point drop due to the hallucination issue of small LLM. In addition, removing question-aware fine-grained, dynamic compression ratio, and document reordering can all cause a drop of 0.5-2.8 points. 5) Moreover, if the small language model in LongLLMLingua is replaced with GPT2-small, it can further improve the acceleration ratio and still achieve a result that is 2.6 points better than the original prompt.
|
| 281 |
+
|
| 282 |
+
Table 5: Performance of different methods and ablation study on MuSicQue (Trivedi et al., 2022) with 2x constraint using GPT3.5-Turbo.
|
| 283 |
+
|
| 284 |
+
<table><tr><td>Methods</td><td></td><td>F1 Tokens 1/T</td></tr><tr><td>Original Prompt</td><td>45.8 2,427</td><td></td></tr><tr><td>BM25</td><td></td><td>28.51,295 1.9x</td></tr><tr><td>SBERT</td><td></td><td>36.2 1,288 1.9x</td></tr><tr><td>LongLLMLingua rk</td><td>46.3 1,295 1.9x</td><td></td></tr><tr><td>Selective-Context LLMLingua</td><td>19.6 1,141 2.1x</td><td></td></tr><tr><td>LongLLMLingua</td><td>40.1 1,110 2.2x</td><td></td></tr><tr><td>Question-aware Coarse-grained</td><td></td><td>51.2 1,077 2.3x</td></tr><tr><td>- w/o Question-awareness</td><td></td><td>43.2 1,076 2.3x</td></tr><tr><td>- w/SBERT</td><td></td><td>47.31,070 2.3x</td></tr><tr><td>-w/ p(xe|a cxquersriet</td><td></td><td>44.0 1,066 2.3x</td></tr><tr><td>- w/o restrict</td><td></td><td>49.2 1,078 2.3x</td></tr><tr><td>- w/o Question-aware Fine-grained 48.4 1,118 2.2x - w/o Dynamic Compression Ratio 48.2 1,090 2.2x</td><td></td><td></td></tr><tr><td>- w/o Subsequence Recovery</td><td></td><td></td></tr><tr><td></td><td></td><td>50.7 1,077 2.3x</td></tr><tr><td>- w/o Document Reordering</td><td></td><td>49.2 1,077 2.3x</td></tr><tr><td>- w/ GPT2-small</td><td></td><td>48.4 1,095 2.2x</td></tr></table>
|
| 285 |
+
|
| 286 |
+
# D.4 ABLATION IN LONGBENCH
|
| 287 |
+
|
| 288 |
+
Table 6 presents the results from the ablation experiment in the LongBench long context benchmark. It can be observed that in various long context tasks: 1) Removing the question-aware coarsegrained, question-aware fine-grained, dynamic compression ratio, document reordering, and subsequence recovery proposed by LongLLMLingua all result in different degrees of performance drop. 2) Among these, question-aware coarse-grained is particularly important for document-based QA and synthetic tasks, with the maximum drop being 35.8 points; its impact on summarization and code tasks is relatively smaller. 3) The design of the conditional probability in the question-aware coarse-grained module improves the results in all tasks, including code completion, single-document question-answer, and synthetic tasks. Changing the order of conditional probabilities or removing the restrict prompt both lead to varying degrees of performance decline. 4) Removing questionaware fine-grained, dynamic compression ratio has a more significant impact on document-based QA and synthetic tasks. 5) The subsequence recovery module can enhance reference-based tasks, but its improvement on tasks like summarization, code, synthetic, etc., is relatively smaller. 6) Document reordering is effective for all types of tasks. Reordering at the document level does not affect LLMs’ understanding of context information, even for timeline-related tasks (see timeline reorder in LooGLE, Table 8). On the contrary, reordering can effectively alleviate the “lost in the middle” issue, thereby improving LLMs performance. 7) Using GPT2-small reduces the capture of effective tokens, but it can still achieve results close to or even slightly better than the original prompt.
|
| 289 |
+
|
| 290 |
+
Table 6: Ablation on LongBench (Bai et al., 2023) using GPT-3.5-Turbo.
|
| 291 |
+
|
| 292 |
+
<table><tr><td>Methods</td><td>|SingleDoc MultiDoc Summ.FewShot Synth. Code AVG Tokens1/T</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LongLLMLingua</td><td>39.0</td><td>42.2</td><td>27.4</td><td>69.3</td><td>53.8</td><td>56.6</td><td>48.0</td><td>1,809</td><td>6x</td></tr><tr><td>Question-aware Coarse-grained</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>- w/o Question-awareness</td><td>27.1</td><td>38.7</td><td>25.4</td><td>62.0</td><td>18.0</td><td>53.3</td><td>37.4</td><td>1,945</td><td>5x</td></tr><tr><td>- w/ SBERT</td><td>34.0</td><td>38.7</td><td>24.1</td><td>57.9</td><td>32.5</td><td>31.1</td><td>36.4</td><td>1790</td><td>6x</td></tr><tr><td>-w/p(xget</td><td>22.5</td><td>28.9</td><td>23.2</td><td>53.0</td><td>22.5</td><td>33.3</td><td>30.6</td><td>1,794</td><td>6x</td></tr><tr><td>- w/o restrict</td><td>37.8</td><td>39.5</td><td>26.4</td><td>64.8</td><td>52.5</td><td>55.8</td><td>46.1</td><td>1,834</td><td>6x</td></tr><tr><td>- w/o Question-aware Fine-grained</td><td>35.7</td><td>41.1</td><td>26.4</td><td>62.9</td><td>44.5</td><td>54.8</td><td>44.2</td><td>1,807</td><td>6x</td></tr><tr><td>- w/o Dynamic Compression Ratio</td><td>36.1</td><td>40.6</td><td>26.9</td><td>67.2</td><td>48.0</td><td>55.8</td><td>45.7</td><td>1,851</td><td>6x</td></tr><tr><td>- w/o Subsequence Recovery</td><td>38.6</td><td>41.8</td><td>27.3</td><td>69.0</td><td>53.8</td><td>56.6</td><td>47.8</td><td>1,809</td><td>6x</td></tr><tr><td>- w/ Document Reordering</td><td>39.9</td><td>43.2</td><td>27.4</td><td>69.8</td><td>53.0</td><td>56.7</td><td>48.3</td><td>1,822</td><td>6x</td></tr><tr><td>- w/ GPT2-small</td><td>35.9</td><td>39.4</td><td>25.0</td><td>60.6</td><td>42.0</td><td>55.4</td><td>43.0</td><td>1,892</td><td>5x</td></tr></table>
|
| 293 |
+
|
| 294 |
+
# D.5 LONGBENCH USING LONGCHAT-13B-16K
|
| 295 |
+
|
| 296 |
+
Table 7: Performance of different methods under different compression ratios on LongBench (Bai et al., 2023) using LongChat-13b. Considering the dataset structure, we do not use the reordering strategy here.
|
| 297 |
+
|
| 298 |
+
<table><tr><td>Methods</td><td>| SingleDoc MultiDoc Summ. FewShot Synth. Code AVG Tokens 1/T</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Original Prompt</td><td>27.4</td><td>30.3</td><td>20.3</td><td>49.9</td><td>12.5</td><td>42.5</td><td>30.5</td><td>10,295</td><td></td></tr><tr><td colspan="10">Retrieval-based Methods</td></tr><tr><td>BM25</td><td>2.4</td><td>2.6</td><td>16.4</td><td>8.7</td><td>0.0</td><td>44.7</td><td>12.5</td><td>1,985</td><td>5x</td></tr><tr><td>SBERT</td><td>11.6</td><td>13.7</td><td>21.1</td><td>16.2</td><td>7.5</td><td>30.0</td><td>16.7</td><td>1,947</td><td>5x</td></tr><tr><td>LongLLMLingua rk</td><td>30.3</td><td>32.4</td><td>24.5</td><td>41.0</td><td>27.5</td><td>38.1</td><td>32.3</td><td>1,960</td><td>5x</td></tr><tr><td colspan="10">Compression-based Methods</td></tr><tr><td>Selective-Context</td><td>16.1</td><td>23.5</td><td>21.8</td><td>21.4</td><td>2.5</td><td></td><td>35.920.2</td><td>1,925</td><td>5x</td></tr><tr><td>LLMLingua</td><td>20.6</td><td>22.3</td><td>22.4</td><td>35.6</td><td>0.0</td><td>35.4</td><td>22.7</td><td>1,950</td><td>5x</td></tr><tr><td>LongLLMLingua</td><td>31.1</td><td>34.1</td><td>24.5</td><td> 45.7</td><td>28.0</td><td>48.6</td><td>35.3</td><td>1,809</td><td>6x</td></tr></table>
|
| 299 |
+
|
| 300 |
+
Table 7 presents the experiment results in the LongBench long context benchmark using LongChat13b-16k. It can be seen that the compressed prompt can also achieve good results on other LLMs, such as LongChat-13b-16k. Specifically, 1) there is a maximum improvement of 15.5 points in synthetic tasks. Except for a slight drop in few-shot Learning, there is an improvement of 3-5 points in other tasks. 2) The performance trends of retrieval-based and compressed-based baselines are similar to the results in GPT-3.5-Turbo.
|
| 301 |
+
|
| 302 |
+
# D.6 LOOGLE
|
| 303 |
+
|
| 304 |
+
Table 8 presents the experiment results in the LooGLE long dependency benchmark, which features longer prompts $\cdot$ and more global dependencies. From the table, we can observe that: 1) LongLLMLingua can effectively improve the performance of long context tasks by compressing prompts, even for long dependency tasks. The results show that LongLLMLingua significantly improves performance in tasks such as retrieval, timeline reorder, and computation, with the maximum improvement reaching 15.9 points. 2) The document reorder in LongLLMLingua is effective in all types of tasks, even in tasks highly related to the timeline, it can effectively improve performance by alleviating the “lost in the middle” issue. 3) Retrieval-based methods tend to lose performance in tasks that have longer dependencies, such as computation and reasoning. 4) For compressionbased methods, due to the difficulty in perceiving question information, there tends to be a larger performance loss in retrieval tasks within long contexts.
|
| 305 |
+
|
| 306 |
+
Table 8: Performance of different methods on LooGLE (Li et al., 2023b) long dependency QA.
|
| 307 |
+
|
| 308 |
+
<table><tr><td>Methods</td><td></td><td>Retrieval Timeline Reorder Computation Reasoning AVG Tokens</td><td></td><td></td><td></td><td></td><td>1/T</td></tr><tr><td>Retrieval-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BM25</td><td>20.4</td><td>21.7</td><td>8.2</td><td>26.3</td><td>19.2</td><td>3,185</td><td>10x</td></tr><tr><td>SBERT</td><td>28.9</td><td>21.1</td><td>10.7</td><td>27.2</td><td>22.0</td><td>3,169</td><td>10x</td></tr><tr><td>LongLLMLingua rk</td><td>38.6</td><td>32.2</td><td>16.2</td><td>26.3</td><td>28.3</td><td>3,158</td><td>10x</td></tr><tr><td>Compression-based Methods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Selective-Context</td><td>16.7</td><td>5.0</td><td>2.3</td><td>17.6</td><td>10.4</td><td>3,710</td><td>8x</td></tr><tr><td>LLMLingua</td><td>10.0</td><td>25.0</td><td>13.3</td><td>21.1</td><td>17.3</td><td>3,404</td><td>9x</td></tr><tr><td>LongLLMLingua</td><td>40.0</td><td> 35.0</td><td>19.7</td><td>33.6</td><td> 32.1</td><td>3,121</td><td>10x</td></tr><tr><td> LongLLMLingua w/o Reorder</td><td>39.3</td><td>33.8</td><td>18.7</td><td>31.6</td><td>30.9</td><td>3,119</td><td>10x</td></tr><tr><td>Original Prompt</td><td>24.1</td><td>20.9</td><td>13.5</td><td>32.1</td><td></td><td>22.630.546</td><td>1</td></tr><tr><td>Zero-shot</td><td>8.7</td><td>6.3</td><td>1.2</td><td>14.5</td><td>7.7</td><td>43</td><td>710x</td></tr></table>
|
| 309 |
+
|
| 310 |
+
# E ECONOMIC COST
|
| 311 |
+
|
| 312 |
+
Table 9: The inference costs(per 1,000 samples $\$ 1$ ) for various datasets using GPT-3.5-Turbo.
|
| 313 |
+
|
| 314 |
+
<table><tr><td></td><td>Multi-document QA</td><td>LongBench</td><td>ZeroScolls</td><td>MuSicQue</td><td>LooGLE</td></tr><tr><td>Original</td><td>4.6</td><td>31.5</td><td>30.6</td><td>3.8</td><td>93.6</td></tr><tr><td>Ours</td><td>1.3</td><td>3.0</td><td>3.2</td><td>1.8</td><td>5.6</td></tr></table>
|
| 315 |
+
|
| 316 |
+
Table 9 presents the estimated per 1,000 samples inference costs for various datasets, encompassing input prompts and generated output text, based on GPT-3.5-Turbo pricing16. Our approach demonstrates substantial savings in computational resources and monetary expenses, particularly in long context situations. Cost reductions of $\$ 3.3$ , $\$ 28.5$ , $\$ 27.4$ , $\$ 2.0$ , and $\cdot$ per 1,000 samples are observed for Multi-document QA, LongBench, ZeroScrolls, MuSiQue, and LooGLE, respectively.
|
| 317 |
+
|
| 318 |
+
F ABLATION ANALYSIS G CASES STUDY
|
| 319 |
+
|
| 320 |
+

|
| 321 |
+
Figure 6: Comparing the compressed prompt and LLMs’ response before and after using Questionaware Fine-grained Compression and Subsequence Recovery ${ \mathrm { 1 / } } \tau \mathrm { = } 3 0 \mathrm { x }$ , high compression ratio setting) from NaturalQuestions Multi-document QA (Liu et al., 2023) using GPT-3.5-Turbo.
|
| 322 |
+
|
| 323 |
+
# Original Prompt:
|
| 324 |
+
|
| 325 |
+
Document [1](Title: Dancing on Ice) It was confirmed on 25 January 2018, that Dancing on Ice had been recommissioned for an eleventh series to air in 2019.
|
| 326 |
+
|
| 327 |
+
Compressed Prompt:
|
| 328 |
+
Write a high-quality answer for the given question using only the provided search results (some of which might be irrelevant).
|
| 329 |
+
1Title: Dancing on was confirmed on 2 January 2018 that Dancing on had been recommissioned for an eleventh series air in 209 .
|
| 330 |
+
Document [2Title: Dan on) Dan on Ice Dancing on British presented by Phillip Schof alongside Holly Willough from 26 to 2011, and Christine Bleakley from 2012 to 204 The show consists of celebrit and professional partners figure skating in front of a panel of judges The, broadcast on ITV, started on January 2006 and ended on 9 March 2014 after showcontract not renewed by ITV On 4 September 2017, it was announced that rev series ´ would on I 7 January 201 Sch and Willby returning as a
|
| 331 |
+
5(: on ( on () The third series of a from January to168TV. The from Saturdays, with Holby present Kar,y Sliner Robin Cins returned to Panel”, with Ruth H joining the panel as replacement for Natalia Bestova. The commission of the was confirmed by at the07 announcedova depart the series Robinen Bar,ater and Jasoniner announced
|
| 332 |
+
7( on ( )) Dan 2 second of Dan on a from January to1207 ITV It presented Phillip Sch Holly Willough, and judged the ”I P consisting Nicky Slater, Nataliaian Karenres Jason Gardiner Karen Barber and Robin Cousins Jaynevill and Christopher Dean co and trained the contestants In this series, cele to ten in first series. The series was won former Kyran Bracken, with Mel Lambert the winner. It announced thatenresge
|
| 333 |
+
Document []( on Ice on 08 on TV edition started 8 TV2 The Russian version ”анду) being on channel0, and renamed in8 to ” Ice” (). Its counterpart called ”Ice Age (, ”Stars on Ice on Channel Oneak IceHviezdyˇlJ. The Turkish version” is called Dans” (”ance on
|
| 334 |
+
Document1 on Ice its, all,e () and Sje Chris de In series.2 edition ´
|
| 335 |
+
](: on Ice world) Dan Ice is a made competition world format, and been subsequently Italy Chile where titled after series There have a, the show was broadcast on Channel 13 as a Document [17](Title: Dancing on Ice) the insight to the training of the celebrities over the last week. It was presented by television presenter Ben Shephard and former contestant and ”Loose Women” star Coleen Nolan. The show was broadcast from $8 ~ \mathrm { p m }$ to $8 . 3 0 \ \mathrm { p m }$ on Friday evenings on ITV throughout the duration of the main shows season. STV who broadcast the main show did not broadcast this on the Friday evening but after repeating the previous weeks main show on the following Saturday afternoon. Due to poor ratings, ´ ”Dancing on Ice Friday” was axed prior to the 2011 series. The show was based in the Question: when is dancing on ice on the tv
|
| 336 |
+
Answer:
|
| 337 |
+
LLMs’ Response:
|
| 338 |
+
209
|
| 339 |
+
LLMs’ Response after Subsquence Recovery:
|
| 340 |
+
2019
|
| 341 |
+
Ground Truth:
|
| 342 |
+
2019
|
| 343 |
+
Compressed Prompt:
|
| 344 |
+
Please complete the code given below.
|
| 345 |
+
public class MessageArchiveManagement private static final long MILLISECONDS_IN_DAY = 24 \* 00 \*0; public static final long_CUP $=$ MCON_DAY /.../ .("",.getStart add
|
| 346 |
+
ifget() ${ > } 0$ Node end(" end.(" endNode.Value("", Util.getTimestamp(query.getEnd
|
| 347 |
+
addNode } if (.withid null && contact null && !isference Node with(" .with .Value("valuewith .( // queryMessageive(connection, nextQuery final(connectionProtocol(), query synchronized (eries) // queries.add(nextQuery } } public boolean queryInProgress( contact, OnLoaded moreMessagesLoadedListener) ized (eries) (Query query : queries) if(query.getWith().equals(contact.getUserId())) if (query.onMoreMessagesLoaded $= =$ null &&MessagesListener null) query.setOnMoreMessagesLoaded(Listener} return true;}} return false;}} private void finalizeQuery(Protocol protocol, Query query) synchronized (queries) { .remove(query); } Contact contact $=$ null; if (query.getWith() ! $=$ null) { contact $=$ protocol.getItemByUID(query.getWith()); } if (contact ! $=$ null) {
|
| 348 |
+
Next line of code:
|
| 349 |
+
|
| 350 |
+
contact.setLastMessageTransitted(query.getEnd());\n
|
| 351 |
+
|
| 352 |
+
# Ground Truth:
|
| 353 |
+
|
| 354 |
+
if (contact.setLastMessageTransmitted(query.getEnd()))
|
| 355 |
+
|
| 356 |
+
Zero-shot LLMs’ Response: contact.removeQuery(query);\n
|
| 357 |
+
|
| 358 |
+
Figure 8: Cases study on lcc code completion task in LongBench benchmark (Bai et al., 2023) in 2,000 constraint using GPT-3.5-Turbo.
|
| 359 |
+
|
| 360 |
+
# Compressed Prompt:
|
| 361 |
+
|
| 362 |
+
Please the of the question. questions
|
| 363 |
+
are sometimes your cold but the of you isnt:ason: What food hasges:: Who the first coach the Clevelandns What arch the Placede: Other: Who created Harryime What Carbean cult didvey:: did Iraqi troops::ose cover is of an of Universal Import What the of Betty theest thectic:: Wh the founder and of The National Review:: was T Tims What the historicalals following the of Agra is whiteolate: of What the the: is a of everything:ase and:ose old London come- was : “y my sweet:: The major team in is called: Group or organization of: How dorow: M of: the name to ofese ?: Animal: is gymnia: of the between k and ch: of: the lawyer for Randy C:: the Francisco What year the in whereci became What country most is g the Who the to P What are the states the the name , Elino: What manmade waterways is1.76: Other of Z:ivalent of: of What was the:: How do ants have: of: the Dow first the high sound that hear in ear every then , but then it away ,:: didist control in:: How can I ofies ’ What did theramid-ers of Egypt eat:: How does Belle her inast: M of: When reading classs does EENTY :: Expression abbre: When was Florida:: manyelies were killed the: Whative on Punchl Hill and has1 What the Filenes the cookies in Internet: What word contains: Word with a special is Larry: a person: a Frenchist: of What American wrote : “ Goodors:: Where theiestk rail stations:: many people ofosis: the worsticane Whatbean is of was Jean: What the2 What caused Harryini What buildingately enough the the1d bill: Other location: many logmic there a rule:: the the word , JJ the average hours per months byOL:: How a cop of: many are of is Ch:: is Whatation does: the the Whatte is “ a whole new: Other: the Chyl nuclear:
|
| 364 |
+
the first the: Invention, book and otherative What does “ Philebus-:: didoco painting: the between: is Po What. the lowest highestation 6:: How the inpy: an the “ What was General Douglasthur in was by Presidentuman: How isaster: an the forini:: was Dick:: Where can find on religion and health the and: Other Whatian the TV51 theBC show for How the is of What Englishrighted “ thee , so What song put James:ative piece
|
| 365 |
+
What new school in Philadelphia: Whatwestern isbed is B: is What Asian was as The Little Brown theans What of thean meeting: is: much the91 ?:: On which isbor: Who first:: the:: How you a paint: an What then-der theterset ,:ivalent What is to hold the lens the the star: Why toason
|
| 366 |
+
a for behavior , or that the accepted of:ivalent of Perg What religion What country you the What does V:: Where I a goodboard for:: buyies on the the the: areter cookiespped with cres: theoe thated ofasticitations , as ‘ the rules to “: the three What do for an:: CNN in:: is a:ose special bears was on17 the Who used Au an electionan: what book: is to the various ways can measure IT:chni and method is software What British minister and wereins: aic the to overcome fear What drink would the biggest:: the States do people longest:: which the the rare disease as : , andentizations , , and is of a is What Russian mastery What a perfect a: What c was Thomas in: Other: did the of What did What can feature the different:ques the-O the ons lips at What anetic did Victoria used her child: D What do: many from to of ofors , body: and is What causes get in: the G What is Other Who the1 century-stone who gained of Florence but endedake:
|
| 367 |
+
of c: the oldest relationship sister with The the world of a to detectchni Whaty make:: Stuart
|
| 368 |
+
|
| 369 |
+
is first: is w What a character by Rs
|
| 370 |
+
|
| 371 |
+
Question: What is a fuel cell ?
|
| 372 |
+
Type:
|
| 373 |
+
LLMs’ Response:
|
| 374 |
+
Definition of something
|
| 375 |
+
LLMs’ Response after Subsquence Recovery:
|
| 376 |
+
Definition of something
|
| 377 |
+
|
| 378 |
+
Ground Truth: Definition of something
|
md/test/AqN23oqraW/AqN23oqraW.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/BWSTBrmRqD/BWSTBrmRqD.md
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DOMINO: A DUAL-SYSTEM FOR MULTI-STEP VISUAL LANGUAGE REASONING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Visual language reasoning requires a system to extract text or numbers from information-dense images like charts or plots and perform logical or arithmetic reasoning to arrive at an answer. To tackle this task, existing work relies on either (1) an end-to-end vision-language model trained on a large amount of data, or (2) a two-stage pipeline where a captioning model converts the image into text that is further read by another large language model to deduce the answer. However, the former approach forces the model to answer a complex question with one single step, and the latter approach is prone to inaccurate or distracting information in the converted text that can confuse the language model. In this work, we propose a dual-system for multi-step multimodal reasoning, which consists of a “System-1” step for visual information extraction and a “System-2” step for deliberate reasoning. Given an input, System-2 breaks down the question into atomic sub-steps, each guiding System-1 to extract the information required for reasoning from the image. Experiments on chart and plot datasets show that our method with a pre-trained System-2 module performs competitively compared to prior work on in- and out-of-distribution data. By fine-tuning the System-2 module (LLaMA-2 70B) on only a small amount of data on multi-step reasoning, the accuracy of our method is further improved and surpasses the best fully-supervised end-to-end approach by $5 . 7 \%$ and a pipeline approach with FlanPaLM (540B) by $7 . 5 \%$ on a challenging dataset with human-authored questions.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Visual language reasoning for tasks such as question answering over charts/plots is computationally challenging: it requires (1) multi-step reasoning to decompose the original complex question, (2) extracting numbers or text from the information-dense images, and (3) performing arithmetic or logical reasoning to derive the final answer. Recent work on visual language reasoning has investigated both end-to-end and pipeline approaches. In the end-to-end approach (Lee et al., 2023; Liu et al., 2023b), a visual transformer is trained on a large amount of labeled data to answer questions based on images with a single step of inference. In the pipeline approach (Liu et al., 2023a), an off-the-shelf captioning model first converts the chart/plot into a linearized table. A text-only large language model (LLM) is then prompted to conduct chain-of-thought reasoning over the linearized table. The first approach empowers a unified model to accommodate both vision and language modalities, but struggles with questions requiring complex reasoning (Hoque et al., 2022). The second approach leverages the multi-step reasoning capabilities of LLMs on the verbalized table information. However, this conversion is prone to loss or distortion of information needed for reasoning (e.g., missing information about colors used in the plot). It also burdens the system unnecessarily as the linearized table is generated regardless of the question and thus may contain irrelevant information.
|
| 12 |
+
|
| 13 |
+
Inspired by the dual process theories of reasoning from cognitive science (Evans, 2003), in this work we present a dual-system for multi-step visual language reasoning called DOMINO. In particular, we use the notions of System-1 and System-2 processing in human brain introduced by Kahneman (2011), where System-1 corresponds to intuitive and habitual processing and System-2 refers to deliberate and controlled reasoning (Goyal & Bengio, 2022). Similarly, DOMINO alternates between two key modules, System-1 and System-2, to perform the task. In our context, System-1, realized as a visual reader, is responsible for intuitively extracting visual information from the image. System-2 which is implemented as an LLM reasoner, is responsible for more deliberate inference by conducting multi-step reasoning for task decomposition, commonsense reasoning, and logical or mathematical operations for answer derivation. More specifically, given an image of a chart and a textual question (see Figure 1 for an illustration), System-2 decomposes the task into a sequence of steps (sub-tasks). For certain intermediate steps, System-1 is guided to obtain the visual information from the image. With the intermediate result extracted by System-1, System-2 either performs the next-step reasoning or derives the answer with all the available information. Throughout the process, DOMINO asks System-1 to obtain visual information when needed, instead of captioning the whole image at once, and thus allows more interactions between the two modalities.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Overview of DOMINO, which alternates between System-2 (a prompted LLM) and System-1 (a visual encoder-text decoder) to answer complex questions over charts. The text in blue callouts are generated by System-2. The text in green callouts are generated by System-1 and appended to the generation sequence of System-2 directly. The chart and the question are from ChartQA (Masry et al., 2022).
|
| 17 |
+
|
| 18 |
+
We build System-1 based on a pre-trained visual language model Liu et al. (2023a) suited for chart understanding, which takes an image and a query from System-2 as input and returns the intermediate result. To further customize System-1 to the target data domain, we create a synthetic training set that contains different atomic operations over an image of a chart/plot (e.g., extract the value of Macy’s in 2019 from Figure 1) using templates. To implement System-2, we adopt an LLM in order to utilize its emergent reasoning capabilities. To adjust System-2 to conduct visual-language reasoning, we explore both few-shot prompting and fine-tuning with a handful of annotated examples.
|
| 19 |
+
|
| 20 |
+
We conduct experiments on several question answering tasks over charts/plots including ChartQA (Masry et al., 2022), PlotQA (Methani et al., 2020), DVQA (Kafle et al., 2018) and FigureQA (Kahou et al., 2018). The results show that without fine-tuning the LLM, DOMINO outperforms the pipeline approach using few-shot methods on both in- and out-of-distribution data. With only 100 training examples, DOMINO even outperforms the best fully-supervised method by $5 . 7 \%$ in accuracy on ChartQA that requires more deliberate reasoning. Further analysis shows that: (1) The intermediate results are essential to the success of our method. (2) System-2 benefits more from learning task decomposition when the questions are arbitrary and natural but more from learning answer deduction when the questions are restricted in type. (3) DOMINO is more robust in handling complex charts. (4) Fine-tuning the LLM on interacting with vision is more data-efficient than finetuning the LLM on table reasoning.
|
| 21 |
+
|
| 22 |
+
# 2 RELATED WORK
|
| 23 |
+
|
| 24 |
+
Visual language reasoning and question answering is an active area of research (Kafle et al., 2018; Kahou et al., 2018; Chaudhry et al., 2019; Methani et al., 2020; Masry et al., 2022). This is a special case of multimodal reasoning tasks that requires understanding an information-intense image and performing multi-step arithmetic or logical reasoning to derive an answer to complex questions. Recent work on visual language question answering focusing on charts/plots has investigated both supervised end-to-end and pipeline approaches.
|
| 25 |
+
|
| 26 |
+
Supervised VQA. Among supervised approaches, PReFIL (Kafle et al., 2020) allows for OCR integration and uses different recurrent and dense models to encode text and image inputs separately which are then fused and fed to a classifier for obtaining an answer. More recently, visual transformers are trained on a large amount of labeled data to answer questions based on images with different training objectives. PaLI (Chen et al., 2023b) and PaLI-X (Chen et al., 2023a) use OCR-aware pretraining objectives where the model predicts texts obtained from some OCR system. Similarly, ChartBERT (Akhtar et al., 2023) uses OCR text and positions to train a transformer encoder. Using OCR systems, however, adds computational cost and falls short on cases where the charts/plots do not have numbers and texts written explicitly (Liu et al., 2023b). Pix2Struct (Lee et al., 2023) and MATCHA (Liu et al., 2023b) are end-to-end models for visual language, where Pix2Struct provides generic checkpoints for different visual language tasks and MATCHA further fine-tunes Pix2Struct with new pretraining objects for chart derendering and mathematical reasoning. ChartT5 (Zhou et al., 2023b) learns to interpret table information from chart images via cross-modal pre-training on plot table pairs with masked header prediction and masked value prediction pre-training objectives. UniChart (Masry et al., 2023) also considers an encoder-decoder architecture and considers different pretraining objectives for low-level and high-level tasks. These approaches empower a unified model to accommodate both vision and language modalities, but struggle with questions requiring complex reasoning (Hoque et al., 2022). Unlike the supervised approches that force the model to answer the question with one single step, DOMINO leverages an LLM for multi-step reasoning.
|
| 27 |
+
|
| 28 |
+
Pipelined VQA. The pipeline approach, on the other hand, divides the task into two steps consisting of 1) information extraction or chart derendering and 2) question answering. There are different approaches to extract information from charts: some approaches combine OCR, object detection/segmentation techniques and/or heuristic rules for extracting information (Jung et al., 2017; Balaji et al., 2018; Luo et al., 2021; Akhtar et al., 2023), while others use a deep model to either extract different chart components (Cheng et al., 2023a) or convert the input chart to a textual table (Liu et al., 2023a). The resulting output is then reasoned over for question answering using table-to-text models (Andrejczuk et al., 2022), specialized models (Cheng et al., 2023a), large language models (Chen, 2023; Liu et al., 2023a), or code models combined with program executors (Chen et al., 2022; Cheng et al., 2023b). Different from these approaches, DOMINO interleaves and alternates between information extraction (System-1) and task decomposition and reasoning (System-2).
|
| 29 |
+
|
| 30 |
+
# 3 DOMINO
|
| 31 |
+
|
| 32 |
+
DOMINO is a dual-system for multi-step visual language reasoning. Unlike the end-to-end approach that uses one unified model to answer questions with one single step, DOMINO leverages an LLM to solve questions that require multi-step reasoning. Unlike the few-shot pipeline approach that converts a whole chart into a table, DOMINO only obtains information from the chart contextualized by one reasoning step at a time, thus allowing more interactions between the textual and visual modalities.
|
| 33 |
+
|
| 34 |
+
Figure 1 illustrates the workflow of DOMINO. Given an image of the chart $c$ and a textual question $q _ { 0 }$ , DOMINO alternates between both modules to deduce the answer $a$ step by step. Taking the original question $q _ { 0 }$ , and potentially the previous reasoning steps as input, System-2 either generates the next query $q _ { i }$ $( i > 0$ ) to System-1 to obtain an intermediate result $a _ { i }$ or answers the question by synthesizing all the intermediate results $\left\{ q _ { i } , a _ { i } \right\}$ . Guided by System-2, System-1 takes the chart $c$ and the query $q _ { i }$ as input and returns the intermediate result $a _ { i }$ . We describe each module below.
|
| 35 |
+
|
| 36 |
+
# 3.1 SYSTEM-1
|
| 37 |
+
|
| 38 |
+
Our System-1 is responsible for the intuitive part of visual language reasoning, i.e., extracting information from the chart/plot. We implement System-1 as a vision encoder-text decoder Transformer model (Lee et al., 2023). Given a chart $c$ and a textual query $q _ { i }$ from System-2, the visual encoder first represents the chart as a sequence of patch embeddings. Then the query $q _ { i }$ is fed as the prefix of the text decoder to guide System-1 to generate the answer $a _ { i }$ by decoding from $P ( a _ { i } | c , q _ { i } )$ .
|
| 39 |
+
|
| 40 |
+
Atomic Operations We define the following list of atomic operations that are needed to extract information from charts/plots in general. These operations facilitate the interaction between System
|
| 41 |
+
|
| 42 |
+
2 and System-1. System-2 can choose to flexibly combine these atomic operations according to the reasoning structure, whereas System-1 can execute these operations individually.
|
| 43 |
+
|
| 44 |
+
Describe: Since System-2 is a text-only LLM and does not access the chart directly, it is challenging for System-2 to generate valid queries that are grounded to the chart. For example, it may ask for a data point that does not exist in the chart. To avoid such hallucinating behavior, we define our first atomic operation Describe, which allows System-2 to get a high-level description of the chart. When receiving this query, System-1 responds with the key elements that are visualized in the chart (see the first green callout from System-1 in Figure 1 for an example). We let System-2 always use Describe as the first reasoning step since it is vital for System-2 to ask valid queries in the following steps. Extract-Point: This atomic operation is designed to allow System-2 to obtain the value of a specific data point, e.g., extract the value of Macy’s in 2019, which is usually required for questions like “What is the difference between Macy’s and Bloomingdale’s in 2019?”. When receiving this query, System-1 only needs to extract one single value from the chart, which is more efficient than the pipeline approach which would extract all values. Extract-Group: The last atomic operation is designed to allow System-2 to obtain the values of a certain group, e.g., extract the value of Macy’s, which is required for questions like “What is the maximum value of Macy’s across all years?”. When receiving this query, System-1 returns all the values of Macy’s.
|
| 45 |
+
|
| 46 |
+
Training For each type of atomic operation, we generate the query-answer pairs $\left\{ q _ { i } , a _ { i } \right\}$ automatically based on available annotated data using templates (detailed in the experiment section). Table 6 in appendix $\ S \ \mathrm { A } . 1 . 2$ shows the examples of these query-answer pairs. We then train System-1 by applying the standard language modeling loss on the answer spans.
|
| 47 |
+
|
| 48 |
+
# 3.2 SYSTEM-2
|
| 49 |
+
|
| 50 |
+
Answering questions over charts/plots usually involves complex reasoning such as arithmetic and logical operations (taking the sum, finding the maximum, comparing values, etc.) (Masry et al., 2022). Due to their strong capability in step-by-step reasoning Wei et al. (2022), we adopt LLMs as System-2 for task decomposition.
|
| 51 |
+
|
| 52 |
+
Workflow Figure 1 illustrates the whole workflow of System-2. Given an originally complex question $q _ { 0 }$ , and optionally the previous reasoning steps $\{ q _ { i } , a _ { i } \}$ , System-2 can select one of the atomic operations to ask a further query $q _ { i + 1 }$ from System-1 or deduce the answer $a$ as the final step. If a further query $q _ { i + 1 }$ is generated, e.g., “Let’s extract the value of Bloomingdale’s in 2019.”, we feed $q _ { i + 1 }$ alone to System-1 for obtaining the intermediate result $a _ { i + 1 }$ , e.g., “The value is $5 5 '$ . Then we append $a _ { i + 1 }$ back to the current generation sequence of System-2 which continues to generate the next step. If System-2 acquires all the required information, it would conduct chain-of-thought reasoning to synthesize all the information to deduce the final answer $a$ , e.g., “The difference between ... So the answer is 558.”.
|
| 53 |
+
|
| 54 |
+
Learning to Decompose We now describe how to adapt an LLM to compose the atomic operations defined above to collect all the information required for answering a complex question over a chart. We explore both prompting-only and prompting+fine-tuning as two means of adaptation.
|
| 55 |
+
|
| 56 |
+
• Prompting-only: We use few-shot prompting to adapt an LLM to conduct visual language reasoning by interacting with System-1. In the prompt, each example consists of a question $q$ , the intermediate reasoning steps $\left\{ q _ { i } , a _ { i } \right\}$ , and finally a concluding sentence ending with the answer $a$ (see Figure 1 for the format of the prompt and Appendix $\ S \ A . 2$ for the full prompt we used). • Prompting $^ +$ fine-tuning: Recent works show that with minor fine-tuning, the reasoning capability of an LLM can be greatly enhanced (Yu et al., 2023; Zhou et al., 2023a). We take inspiration from this observation and study how much we can improve the performance of DOMINO by fine-tuning System-2 with only a few $< = 1 0 0$ ) training examples. Through fine-tuning, we aim to teach System-2 to both (1) decompose the task and (2) deduce the answer. During training, we only apply the language modeling loss on the text that is supposed to be generated by System-2 during the inference time — i.e., the query spans $q _ { i }$ and the final concluding sentence leading to $a$ . This is to avoid teaching System-2 to hallucinate the parts that should be generated by System-1, i.e., the intermediate answers $a _ { i }$ . During inference, we still provide the few-shot prompt to System-2 as we find this leads to a better performance of DOMINO overall.
|
| 57 |
+
|
| 58 |
+
# 4 EXPERIMENTAL SETUP
|
| 59 |
+
|
| 60 |
+
# 4.1 DATASETS
|
| 61 |
+
|
| 62 |
+
For fine-tuning and evaluation we use the ChartQA (Masry et al., 2022) and PlotQA (Methani et al., 2020) datasets. ChartQA has two subsets. One is machine generated (marked with augmented) and the other is human written (marked with human) which requires more complex reasoning. PlotQA also has two sets: v1 (mostly focused on extractive questions) and v2 (requires more numerical reasoning), both of which are machine generated. Details of each dataset are reported in Appendix A.1. For fine-tuning System-1, we use samples from training sets of these datasets along with templates for each of the Describe, Extract-Point, and Extract-Group atomic operations to generate the training data. See Appendix A.1.2 for examples of templates and generated data. For fine-tuning System-2, we collect 100 high-quality question decomposition and reasoning examples. More specifically, we sample diverse charts/questions from the training sets of ChartQA and PlotQA and ask an annotator to decompose each complex question into atomic operations and deduce the answer. See Appendix A.1.3 for examples of the collected data.
|
| 63 |
+
|
| 64 |
+
Since parts of the training sets of ChartQA and PlotQA are used during the fine-tuning stage, we also evaluate DOMINO on two additional datasets that were not used during fine-tuning: DVQA (Kafle et al., 2018) and FigureQA (Kahou et al., 2018). Both of these datasets include chart images from synthetic tables that are randomly generated from limited vocabularies. FigureQA has yes/no answers whereas DVQA contains open ended questions where many refer to texts specific to the corresponding charts. While DVQA only includes bar charts, FigureQA additionally includes line graphs and pie charts. For all synthetic datasets (i.e., PlotQA, DVQA, and FigureQA), we randomly sample 10K examples and use this set for evaluation.
|
| 65 |
+
|
| 66 |
+
# 4.2 TRAINING DETAILS
|
| 67 |
+
|
| 68 |
+
For System-1, we use DePlot as the backbone visual language model and fine-tune it on the synthetic dataset we created for atomic operations. We generate a total of 774, 019 examples using templates with the ChartQA and PlotQA training sets (17, 014 for Describe, 362, 955 for Extract-Point, and 273, 657 for Extract-Group. In Appendix A.1.2 we have provided some examples of the generated data. We set the batch size as 256, the learning rate as $1 e - 5$ and the training steps as 10K. For System-2, we use the 70B variant of the recently published LLaMA-2 (Touvron et al., 2023) family of models. Since we only use a handful of expert-annotated training examples $\Longleftarrow 1 0 0$ ), we use a very small batch size of 8 and set the learning rate as $1 e - 6$ . We train for a maximum optimization steps of 20 and apply the language modeling loss on the text generated only by System-2 as discussed in $\ S 3 . 2$ .
|
| 69 |
+
|
| 70 |
+
# 4.3 BASELINE MODELS AND EVALUATION METRICS
|
| 71 |
+
|
| 72 |
+
To evaluate the ability of DOMINO for answering complex questions about charts/plots, we compare it with several fully-supervised end-to-end approaches as well as the pipeline approach that first converts the chart/plot to a table and then reasons over the table step-by-step. Similar to prior work (e.g., (Liu et al., 2023a)), we report “relaxed accuracy” which computes exact match for textual responses but allows a $5 \%$ tolerance for numeric answers. We compare DOMINO against the following strong baselines:
|
| 73 |
+
|
| 74 |
+
Fully-Supervised We consider the following state-of-the-art supervised approaches which were discussed in $\ S 2$ : ChartT5 (Zhou et al., 2023b), Pix2Struct (Lee et al., 2023), MATCHA (Liu et al., 2023b), UniChart (Masry et al., 2023), and PaLI-X (Chen et al., 2023a).
|
| 75 |
+
|
| 76 |
+
Few-shot DePlot DePlot (Liu et al., 2023a) is a pipeline approach where a model is first trained to translate an image to a textual table, and then different LLMs are used to reason over the table via few-shot learning with Chain-of-Thought (CoT) prompting (Wei et al., 2022). We compare against this model with the following LLMs: GPT3 (Brown et al., 2020), FlanPaLM (540B) (Chung et al., 2022), LLaMa-2 (70B) (Touvron et al., 2023), and GPT4 (OpenAI, 2023). Following Liu et al. (2023a), we adopt both (1) sampling and (2) self-consistency (SC) decoding (Wang et al., 2023), which samples a set of generations and chooses the majority-voted answer, and use a temperature of 0.4. The 1-Shot prompt used in DePlot consists of 1 table with 5 question-answer pairs. However, this may mislead the LLM to assume that the new question is from the same context since we do not have any tables in the prompt. To align with our method, we also experiment with a 5-Shot prompt consisting of 5 tables, each with 1 question-answer pair (see Appendix A.2).
|
| 77 |
+
|
| 78 |
+
Table 1: Main results of the compared methods on downstream tasks. Best numbers are in bold and second best numbers are underlined. We re-evaluate the DePlot model with GPT-3 on our sampled subsets of PlotQA (marked by ∗). The results for other baselines (if available) are from the papers cited in the table. The 1-Shot prompt used in DePlot consists of 1 table with 5 question-answer pairs, while the 5-Shot prompt we use consists of 5 tables with 1 question-answer pair each.
|
| 79 |
+
|
| 80 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">ChartQA</td><td colspan="3">PlotQA</td></tr><tr><td>Aug.</td><td>Human</td><td>Avg.</td><td>V1</td><td>V2</td><td>Avg.</td></tr><tr><td>Fully-Supervised</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ChartT5 (Zhou et al.,2023b)</td><td>74.4</td><td>31.8</td><td>53.2</td><td></td><td>=</td><td>=</td></tr><tr><td>Pix2Struct (Lee et al., 2023)</td><td>81.6</td><td>30.5</td><td>56.1</td><td>73.2</td><td>71.9</td><td>72.6</td></tr><tr><td>MATCHA (Liu et al., 2023b)</td><td>90.2</td><td>38.2</td><td>64.2</td><td>92.3</td><td>90.7</td><td>91.5</td></tr><tr><td>UniChart (Masry et al.,2023)</td><td>88.6</td><td>43.9</td><td>66.2</td><td>1</td><td></td><td></td></tr><tr><td>PaLI-X (Chen et al.,2023a)</td><td>1</td><td></td><td>70.9</td><td>1</td><td>=</td><td>=</td></tr><tr><td>PaLI-X with OCR (Chen et al.,2023a)</td><td>1</td><td>=</td><td>72.3</td><td></td><td>=</td><td>=</td></tr><tr><td>Few-Shot DePlot</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>GPT3 (1-Shot) (Liu et al.,2023a)</td><td>37.3</td><td>36.5</td><td>36.9</td><td>*31.6</td><td>*42.2</td><td>*36.9</td></tr><tr><td>FlanPaLM (540B) (1-Shot) (Liu et al.,2023a)</td><td>76.7</td><td>57.8</td><td>67.3</td><td>51.3</td><td>44.9</td><td>48.1</td></tr><tr><td>FlanPaLM (540B) (1-Shot, SC) (Liu et al.,2023a)</td><td>78.8</td><td>62.2</td><td>70.5</td><td>57.8</td><td>50.1</td><td>53.9</td></tr><tr><td>LLaMA-2 (70B) (1-Shot)</td><td>86.5</td><td>53.5</td><td>70.0</td><td>32.5</td><td>43.4</td><td>37.9</td></tr><tr><td>GPT4 (5-Shot)</td><td>83.8</td><td>61.4</td><td>72.6</td><td></td><td>-</td><td>-</td></tr><tr><td>LLaMA-2 (70B) (5-Shot)</td><td>87.4</td><td>59.4</td><td>73.4</td><td>43.2</td><td>44.7</td><td>43.9</td></tr><tr><td>Other Pipeline Approaches</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ChartReader (Cheng et al., 2023a)</td><td></td><td></td><td>52.6</td><td>78.1</td><td>59.3</td><td>68.7</td></tr><tr><td>DOMINO (our method)</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LLaMA-2 (70B) (5-Shot)</td><td>88.6</td><td>59.3</td><td>74.0</td><td>53.1</td><td>59.0</td><td>56.1</td></tr><tr><td>- without Describe</td><td>77.4</td><td>45.6</td><td>61.5</td><td>40.5</td><td>62.7</td><td>51.6</td></tr><tr><td>LlaMa-2 (70B) (5-Shot, SC)</td><td>90.3</td><td>61.4</td><td>75.8</td><td>57.3</td><td>71.3</td><td>64.3</td></tr><tr><td>Fine-tuned LLaMA-2 (70B) (5-shot)</td><td>91.7</td><td>61.7</td><td>76.7</td><td>55.1</td><td>71.3</td><td>63.2</td></tr><tr><td>Fine-tuned LLaMA-2 (70B) (5-shot, SC)</td><td>91.8</td><td>64.1</td><td>78.0</td><td>58.9</td><td>80.7</td><td>69.8</td></tr></table>
|
| 81 |
+
|
| 82 |
+
# 5 MAIN RESULTS
|
| 83 |
+
|
| 84 |
+
Table 1 reports the results of comparing our method against fully-supervised and pipeline methods on ChartQA and PlotQA. We observe that: (1) Without fine-tuning, DOMINO already outperforms the best fully-supervised method (PaLI-X with OCR) on the ChartQA dataset $( 7 2 . 3 \% $ $7 5 . 8 \%$ ), where the questions are more diverse and complex. This demonstrates the effectiveness of DOMINO in handling such questions by leveraging the strong language understanding and task decomposition capabilities of the LLM. The fully-supervised methods do perform better than both DePlot and DOMINO on PlotQA. This is because PlotQA is a synthetic dataset with templatebased and restricted types of questions. The fully-supervised methods can learn the bias in data encoded in the large training set (with over 100M examples) as pointed out by Liu et al. (2023a). (2) DOMINO also outperforms DePlot using either GPT3, LLaMA-2 (70B) or the much larger FlanPaLM (540B) model on both ChartQA and PlotQA, and DePlot with GPT4 on ChartQA1. This demonstrates the benefits of DOMINO which allows more interactions between the language and the vision components, and does not introduce redundant information as DePlot does when converting a chart into a table2. (3) With minor fine-tuning using only a handful of 100 examples annotated with the reasoning process, we can further improve the performance of DOMINO on both ChartQA and PlotQA. We study data efficiency in $\ S \ O 6$ . Notably, with self-consistency decoding, DOMINO outperforms the best fully-supervised method by $5 . { \dot { 7 } } \%$ in accuracy on ChartQA and we also observe a large performance boost $( 7 1 . 3 \% 8 0 . 7 \% )$ ) on PlotQA-V2 which contains more numerical reasoning questions.
|
| 85 |
+
|
| 86 |
+
Table 2: Experimental results of the compared methods on the out-of-distribution datasets. Best numbers are in bold and the second best numbers are underlined. Our results are reported on 10K random sample of the corresponding evaluation sets. The results for other baselines are from their papers as cited in the table.
|
| 87 |
+
|
| 88 |
+
<table><tr><td>Method</td><td>DVQA</td><td colspan="2">FigureQA</td></tr><tr><td></td><td>Test-Novel (Reasoning)</td><td>Val1</td><td>Val2</td></tr><tr><td colspan="4">Seen at Training</td></tr><tr><td>State-of-the-Art PReFIL (no OCR) (Kafle et al.,2020)</td><td></td><td></td><td></td></tr><tr><td>PReFIL (with OCR) (Kafle et al., 2020)</td><td>49.2 80.7</td><td>=</td><td>一</td></tr><tr><td>ChartReader (Cheng et al., 2023a)</td><td>1</td><td>95.5</td><td>95.8</td></tr><tr><td colspan="4"></td></tr><tr><td colspan="4">Unseen at Training</td></tr><tr><td>Few-Shot DePlot</td><td></td><td></td><td></td></tr><tr><td>LLaMA-2 (1-Shot)</td><td>40.3</td><td>55.6</td><td>55.7</td></tr><tr><td>LLaMA-2 (5-Shot)</td><td>54.2</td><td>61.6</td><td>61.2</td></tr><tr><td>DOMINO (our method)</td><td></td><td>63.2</td><td>62.7</td></tr><tr><td>LLaMA-2 (5-Shot)</td><td>55.2</td><td></td><td></td></tr><tr><td>Fine-tuned LLaMA-2 (5-shot)</td><td>55.4</td><td>64.7</td><td>64.4</td></tr></table>
|
| 89 |
+
|
| 90 |
+
In Table 2, we report the results of DePlot and DOMINO on out-of-distribution (OOD) datasets including DVQA and FigureQA, and compare them with fully-supervised methods. Here the OOD setting means that neither System-1 nor System-2 of DOMINO is fine-tuned on the experimented datasets. DOMINO does not outperform the supervised methods due to the synthetic nature of these datasets and the fact that both PReFIL and ChartReader were fine-tuned on the training partitions of DVQA and FigureQA, respectively. However, with regard to few-shot approaches, results show that DOMINO generalizes better than DePlot. Future work could enhance DOMINO with a more advanced vision module to improve generalization capabilities.
|
| 91 |
+
|
| 92 |
+
# 6 ANALYSIS & DISCUSSION
|
| 93 |
+
|
| 94 |
+
Effectiveness of image description in addressing hallucination In this ablation study, we investigate the effectiveness of the Describe operation in providing the initial context to System-2 so that System-2 asks valid queries afterwards. We prompt System-2 with examples where Describe is not used at all. The performance of the resulting DOMINO variant is shown in Table 1 (without Describe). We observe that discarding the Describe step generally leads to a considerable performance drop of DOMINO except on the PlotQA-V2 split. This demonstrates the effectiveness of the Describe step in providing the necessary context for System-2 to generate the right decomposition steps, especially when the questions are flexible in terms of wording and may not provide enough information for reasoning as the synthetic questions from PlotQA-V2 do.
|
| 95 |
+
|
| 96 |
+
Skills learnt from fine-tuning System-2 We see significant improvement by fine-tuning System-2 in Table 1 and would like to investigate how the skills learnt from fine-tuning, i.e., task decomposition and answer deduction, contribute differently to the overall performance. We fine-tune System-2 by applying the language modeling loss only on (1) the intermediate queries $\left\{ q _ { i } \right\}$ or (2) the concluding sentence leading to the final answer $a$ . The results are shown in Table 3, where we have opposite observations on ChartQA and PlotQA, which reveals that the supervision on the intermediate process is not always beneficial. On ChartQA, we see a larger performance drop from fine-tuning
|
| 97 |
+
|
| 98 |
+
Table 3: Ablation study on how the task decomposition and answer deduction skills learnt in finetuning contribute differently to the overall performance. Method indicates what the language modeling loss was applied to.
|
| 99 |
+
|
| 100 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">ChartQA</td><td colspan="3">PlotQA</td></tr><tr><td>Aug.</td><td>Human</td><td>Avg.</td><td>V1</td><td>V2</td><td>Avg.</td></tr><tr><td>Fine-tuned LLaMA-2</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Answering Steps</td><td>86.3</td><td>48.1</td><td>67.2</td><td>51.1</td><td>76.8</td><td>64.0</td></tr><tr><td>Decomposition Steps</td><td>87.6</td><td>56.6</td><td>72.1</td><td>48.5</td><td>76.0</td><td>62.3</td></tr><tr><td>Answering and Decomposition Steps</td><td>91.7</td><td>61.7</td><td>76.7</td><td>55.1</td><td>71.3</td><td>63.2</td></tr></table>
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
Figure 2: Performance grouped by the complexity of the underlying tables of the charts. The x-axes show the length of the underlying table of a chart. The left y-axes show the ratios of the questions in each length interval indicated by the green bars.
|
| 104 |
+
|
| 105 |
+
System-2 only on answer deduction. This demonstrates that LLMs struggle with task decomposition more than answer deduction when the questions are more natural. On PlotQA, however, we see a larger performance drop coming from fine-tuning System-2 only on decomposition steps for V1 and even performance gains from fine-tuning System-2 only on answer deduction or decomposition steps for V2. This is because the question types in PlotQA are rather restricted and in this case the LLM benefits more from just learning how to deduce the answer.
|
| 106 |
+
|
| 107 |
+
Robustness in handling complex charts We investigate whether the multi-interplay between language and vision allows DOMINO to perform robustly on more complex charts. Here, we use the length of the underlying table of a chart as a measurement of its complexity, and accordingly group the accuracy scores of DePlot and DOMINO (with a frozen or fine-tuned System-2) by the table length as shown in Figure 2. We observe that DOMINO (either frozen or fine-tuned) performs consistently better than DePlot on increasingly complex charts. This verifies the downside of converting charts to tables before reasoning as done in DePlot as it introduces redundant information and is error-prone, especially when the chart is very complex. DOMINO does not have this issue as we only require System-1 to obtain the necessary information required by one reasoning step.
|
| 108 |
+
|
| 109 |
+
Data efficiency of reasoning-based fine-tuning We study how DOMINO performs across different amount of training data. As comparison, we also fine-tune the LLM in DePlot on the same examples but annotated with chain-of-thought on tables. The results are shown in Figure 3. We observe that fine-tuned DOMINO generally outperforms fine-tuned DePlot across different numbers of training examples. One thing to note is that we do need sufficient examples to elicit the reasoning capabilities from the LLM so that it can outperform the frozen LLM (over 50 for PlotQA-V1 and over 20 for PlotQA-V2). Meanwhile, fine-tuning System-2 does not hurt DOMINO’s OOD performance on DVQA, regardless of the number of training examples. In comparison, fine-tuning DePlot leads to worse OOD performance when more than 10 training examples are used.
|
| 110 |
+
|
| 111 |
+
Inference efficiency Although there may be multiple calls to the vision module in DOMINO, DOMINO is more efficient compared to the few-shot DePlot model due to two reasons: (1) The vision module in DOMINO only needs to generate the required information based on the image while the vision module in DePlot needs to generate the whole table, which can be arbitrarily long. (2) As a result of (1), DOMINO does not need to take as input the whole table sequence which would consume a large part of the context window in the LM of DePlot.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 3: Ablation study on how number of fine-tuning examples affects performance of the LLM. The LLM in both methods are not fine-tuned when the number of training examples equals to 0.
|
| 115 |
+
|
| 116 |
+
Table 4: Case studies on ChartQA-human. The underlined text represents the errors made by the models. See Appendix A.3 for associated charts.
|
| 117 |
+
|
| 118 |
+
<table><tr><td>Chart Se Whiarstleti dada ndieretageg</td><td>Chart: See Figure 4 right in appendix. Qdstion: Whatisertysofpople inPilipins</td></tr><tr><td rowspan="3">Deplot Generated Table: Country 丨 Expenditures on general government outsourcing (%GDP) Germany 113.4 Norway|9.41 Turkeyi7.54</td><td>DOMINO (frozen)</td></tr><tr><td>Let's describe the figure. The figure shows the data of: Share of people...</td></tr><tr><td>The x-axis shows: Malaysia | Philippines I Ghana | Switzerland. of Share of people...</td></tr><tr><td rowspan="3">Grnerated CoT:Let's find the rowof Turkey, hat'sRow 4.Let’s find the number for Turkey,that's 7.11. The answer is 7.11.X DOMINO (frozen)</td><td></td></tr><tr><td>The data is 27.58. The average share of people in Philippines and Ghana who ... is (27.58+27.58)/2=27.58.So theanswer is 27.58.X</td></tr><tr><td>DOMINO (fine-tuned)</td></tr><tr><td>The figure shows the dataof: Expenditures on general government outsourcing (dark blue). The x-axis shows: Germany |Norway|Turkey Greece.</td><td>... # same description as DOMINO (frozen) Let's extract the data of Share of people who... BY Philippines.</td></tr><tr><td></td><td>The data is 38.92. Let's extract the dataof Share of people who... BY Ghana.</td></tr><tr><td>The data is 7.54.</td><td></td></tr><tr><td>Theanswer is7.54.√</td><td>The data is 27.58. The average is (38.92+27.58)/2=33.25.So the answeris 33.25.√</td></tr></table>
|
| 119 |
+
|
| 120 |
+
Error Analysis Since PlotQA is a synthetic dataset, we have information about the template types that were used to generate questions. Appendix Table 7 shows the breakdown of errors per template type for the PlotQA-V2 dataset. Across all template types we see that DOMINO yields improvements, but the most significant reductions in errors are for questions that require reasoning (i.e., arithmetic, compound, comparison, min-max) where we see reductions of $4 5 \%$ to $6 8 \%$ in errors when comparing the fine-tuned model against the DePlot model.
|
| 121 |
+
|
| 122 |
+
To illustrate the difference between different models, Table 4 shows examples from the ChartQAhuman set. Table 4 (left) shows an example where DePlot correctly predicts the underlying table of the chart yet fails to extract the right value from the table due to the redundant information. By contrast, DOMINO only extracts the necessary information by generating a specific query to System-1 and thus answers correctly. Table 4 (right) shows an example where System-2 of DOMINO fails to leverage the information from the previous reasoning step (that Philippines and Ghana are two data groups in the chart) and thus generates an invalid query to System-1. Through fine-tuning, System-2 learns to properly decompose the question and generates the right queries to obtain the intermediate results.
|
| 123 |
+
|
| 124 |
+
# 7 CONCLUSION
|
| 125 |
+
|
| 126 |
+
In this paper, we introduce DOMINO, a dual-system for multi-step multimodal reasoning. DOMINO alternates between two key modules, System-1 for targeted information extraction from images and System-2 for task decomposition and answer generation. We compare our model’s performance against both supervised and pipeline approaches on different chart/plot question answering datasets, and achieve better or comparable results. Further analysis shows that: (1) A general description of the chart helps System-2 better at task decomposition. (2) DOMINO is more robust in terms of handling complex charts. (3) Training System-2 for better performance is data-efficient, but System-2 benefits differently from the skills acquired during fine-tuning.
|
| 127 |
+
|
| 128 |
+
# ETHICS STATEMENT
|
| 129 |
+
|
| 130 |
+
Step-by-step reasoning to derive an answer from large models builds transparency and trust for users, and eases bug-fixing. In this context, we hope our work builds transparency by providing the intermediate steps used to derive at an answer. However, similar to other works on question answering from charts, our models could possibly be abused to mislead the public about the charts content and implications. Although our models obtain comparable or state-of-the-art results on the datasets we evaluated, we can not guarantee that the output of these models will always be correct. We have shared our hyper-parameter settings in the paper to ensure the reproducibility of our experimental results and we will open source our code to Github.
|
| 131 |
+
|
| 132 |
+
REFERENCES
|
| 133 |
+
Mubashara Akhtar, Oana Cocarascu, and Elena Simperl. Reading and reasoning over chart images for evidence-based automated fact-checking. In Findings of the Association for Computational Linguistics: EACL 2023, pp. 399–414, Dubrovnik, Croatia, May 2023. Association for Computational Linguistics. URL https://aclanthology.org/2023.findings-eacl.30.
|
| 134 |
+
Ewa Andrejczuk, Julian Eisenschlos, Francesco Piccinno, Syrine Krichene, and Yasemin Altun. Table-to-text generation and pre-training with TabT5. In Findings of the Association for Computational Linguistics: EMNLP 2022, pp. 6758–6766, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.findings-emnlp.503. URL https://aclanthology.org/2022.findings-emnlp.503.
|
| 135 |
+
Abhijit Balaji, Thuvaarakkesh Ramanathan, and Venkateshwarlu Sonathi. Chart-text: A fully automated chart image descriptor. CoRR, abs/1812.10636, 2018. URL http://arxiv.org/ abs/1812.10636.
|
| 136 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/ file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
|
| 137 |
+
Ritwick Chaudhry, Sumit Shekhar, Utkarsh Gupta, Pranav Maneriker, Prann Bansal, and Ajay Joshi. Leaf-qa: Locate, encode & attend for figure question answering, 2019.
|
| 138 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code, 2021.
|
| 139 |
+
Wenhu Chen. Large language models are few(1)-shot table reasoners. In Findings of the Association for Computational Linguistics: EACL 2023, pp. 1120–1130, Dubrovnik, Croatia, May 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.findings-eacl.83. URL https://aclanthology.org/2023.findings-eacl.83.
|
| 140 |
+
Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W. Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks, 2022.
|
| 141 |
+
Xi Chen, Josip Djolonga, Piotr Padlewski, Basil Mustafa, Soravit Changpinyo, Jialin Wu, Carlos Riquelme Ruiz, Sebastian Goodman, Xiao Wang, Yi Tay, Siamak Shakeri, Mostafa Dehghani, Daniel Salz, Mario Lucic, Michael Tschannen, Arsha Nagrani, Hexiang Hu, Mandar Joshi, Bo Pang, Ceslee Montgomery, Paulina Pietrzyk, Marvin Ritter, AJ Piergiovanni, Matthias Minderer, Filip Pavetic, Austin Waters, Gang Li, Ibrahim Alabdulmohsin, Lucas Beyer, Julien Amelot, Kenton Lee, Andreas Peter Steiner, Yang Li, Daniel Keysers, Anurag Arnab, Yuanzhong Xu, Keran Rong, Alexander Kolesnikov, Mojtaba Seyedhosseini, Anelia Angelova, Xiaohua Zhai, Neil Houlsby, and Radu Soricut. Pali-x: On scaling up a multilingual vision and language model, 2023a.
|
| 142 |
+
Xi Chen, Xiao Wang, Soravit Changpinyo, AJ Piergiovanni, Piotr Padlewski, Daniel Salz, Sebastian Goodman, Adam Grycner, Basil Mustafa, Lucas Beyer, Alexander Kolesnikov, Joan Puigcerver, Nan Ding, Keran Rong, Hassan Akbari, Gaurav Mishra, Linting Xue, Ashish V Thapliyal, James Bradbury, Weicheng Kuo, Mojtaba Seyedhosseini, Chao Jia, Burcu Karagol Ayan, Carlos Riquelme Ruiz, Andreas Peter Steiner, Anelia Angelova, Xiaohua Zhai, Neil Houlsby, and Radu Soricut. PaLI: A jointly-scaled multilingual language-image model. In The Eleventh International Conference on Learning Representations, 2023b. URL https: //openreview.net/forum?id $\equiv$ mWVoBz4W0u.
|
| 143 |
+
Zhi-Qi Cheng, Qi Dai, Siyao Li, Jingdong Sun, Teruko Mitamura, and Alexander G. Hauptmann. Chartreader: A unified framework for chart derendering and comprehension without heuristic rules, 2023a.
|
| 144 |
+
Zhoujun Cheng, Tianbao Xie, Peng Shi, Chengzu Li, Rahul Nadkarni, Yushi Hu, Caiming Xiong, Dragomir Radev, Mari Ostendorf, Luke Zettlemoyer, Noah A. Smith, and Tao Yu. Binding language models in symbolic languages. In The Eleventh International Conference on Learning Representations, 2023b. URL https://openreview.net/forum?id $=$ lH1PV42cbF.
|
| 145 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instruction-finetuned language models, 2022.
|
| 146 |
+
Jonathan St BT Evans. In two minds: dual-process accounts of reasoning. Trends in cognitive sciences, 7(10):454–459, 2003.
|
| 147 |
+
Anirudh Goyal and Yoshua Bengio. Inductive biases for deep learning of higher-level cognition, 2022.
|
| 148 |
+
Enamul Hoque, Parsa Kavehzadeh, and Ahmed Masry. Chart question answering: State of the art and future directions. In Computer Graphics Forum, volume 41-3, pp. 555–572. Wiley Online Library, 2022.
|
| 149 |
+
Daekyoung Jung, Wonjae Kim, Hyunjoo Song, Jeongin Hwang, Bongshin Lee, Bo Hyoung Kim, and Jinwook Seo. Chartsense: Interactive data extraction from chart images. Proceedings of the 2017 CHI Conference on Human Factors in Computing Systems, 2017. URL https://api. semanticscholar.org/CorpusID:6242305.
|
| 150 |
+
Kushal Kafle, Brian Price, Scott Cohen, and Christopher Kanan. Dvqa: Understanding data visualizations via question answering, 2018.
|
| 151 |
+
Kushal Kafle, Robik Shrestha, Brian Price, Scott Cohen, and Christopher Kanan. Answering questions about data visualizations using efficient bimodal fusion, 2020.
|
| 152 |
+
Daniel Kahneman. Thinking, fast and slow. New York, NY: Macmillan, 2011.
|
| 153 |
+
Samira Ebrahimi Kahou, Vincent Michalski, Adam Atkinson, Akos Kadar, Adam Trischler, and Yoshua Bengio. Figureqa: An annotated figure dataset for visual reasoning, 2018.
|
| 154 |
+
|
| 155 |
+
Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu, Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, and Kristina Toutanova. Pix2struct: Screenshot parsing as pretraining for visual language understanding, 2023.
|
| 156 |
+
|
| 157 |
+
Fangyu Liu, Julian Martin Eisenschlos, Francesco Piccinno, Syrine Krichene, Chenxi Pang, Kenton Lee, Mandar Joshi, Wenhu Chen, Nigel Collier, and Yasemin Altun. Deplot: One-shot visual language reasoning by plot-to-table translation, 2023a.
|
| 158 |
+
|
| 159 |
+
Fangyu Liu, Francesco Piccinno, Syrine Krichene, Chenxi Pang, Kenton Lee, Mandar Joshi, Yasemin Altun, Nigel Collier, and Julian Martin Eisenschlos. Matcha: Enhancing visual language pretraining with math reasoning and chart derendering, 2023b.
|
| 160 |
+
|
| 161 |
+
Junyu Luo, Zekun Li, Jinpeng Wang, and Chin-Yew Lin. Chartocr: Data extraction from charts images via a deep hybrid framework. In 2021 IEEE Winter Conference on Applications of Computer Vision (WACV). The Computer Vision Foundation, January 2021. URL https://www.microsoft.com/en-us/research/publication/ chartocr-data-extraction-from-charts-images-via-a-deep-hybrid-frame
|
| 162 |
+
|
| 163 |
+
Ahmed Masry, Do Xuan Long, Jia Qing Tan, Shafiq Joty, and Enamul Hoque. Chartqa: A benchmark for question answering about charts with visual and logical reasoning, 2022.
|
| 164 |
+
|
| 165 |
+
Ahmed Masry, Parsa Kavehzadeh, Xuan Long Do, Enamul Hoque, and Shafiq Joty. Unichart: A universal vision-language pretrained model for chart comprehension and reasoning, 2023.
|
| 166 |
+
|
| 167 |
+
Nitesh Methani, Pritha Ganguly, Mitesh M. Khapra, and Pratyush Kumar. Plotqa: Reasoning over scientific plots, 2020.
|
| 168 |
+
|
| 169 |
+
OpenAI. Gpt-4 technical report, 2023.
|
| 170 |
+
|
| 171 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023.
|
| 172 |
+
|
| 173 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models, 2023.
|
| 174 |
+
|
| 175 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, brian ichter, Fei Xia, Ed H. Chi, Quoc V Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/ forum?id $=$ _VjQlMeSB_J.
|
| 176 |
+
|
| 177 |
+
Ping Yu, Tianlu Wang, Olga Golovneva, Badr AlKhamissi, Siddharth Verma, Zhijing Jin, Gargi Ghosh, Mona Diab, and Asli Celikyilmaz. ALERT: Adapt language models to reasoning tasks. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1055–1081, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.60. URL https://aclanthology.org/2023. acl-long.60.
|
| 178 |
+
|
| 179 |
+
Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206, 2023a.
|
| 180 |
+
|
| 181 |
+
Mingyang Zhou, Yi Fung, Long Chen, Christopher Thomas, Heng Ji, and Shih-Fu Chang. Enhanced chart understanding via visual language pre-training on plot table pairs. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 1314–1326, Toronto, Canada, July 2023b. Association for Computational Linguistics. doi: 10.18653/v1/2023.findings-acl.85. URL https://aclanthology.org/2023.findings-acl.85.
|
| 182 |
+
|
| 183 |
+
# A APPENDIX
|
| 184 |
+
|
| 185 |
+
A.1 TRAINING AND EVALUATION DATASETS
|
| 186 |
+
|
| 187 |
+
A.1.1 DATASET STATISTICS
|
| 188 |
+
|
| 189 |
+
We used the following datasets in this paper:
|
| 190 |
+
|
| 191 |
+
• ChartQA (Masry et al., 2022): A dataset of both human-authored and machine-generated questions about bar, line, and pie charts sourced from Statista (statista.com), The Pew research (pewresearch.org), Our World In Data or OWID (ourworldindata. org), and Organisation for Economic Co-operation and Development or OECD (oecd. org). The training set consists of 7, 398 human-authored questions over 3, 699 charts and 20, 901 machine-generated questions over 15, 474 charts. PlotQA (Methani et al., 2020): A dataset sourced from World Bank Open Data, Open Government Data, Global Terrorism Database which contain statistics about various indicator variables. The data contains positive integers, floating point values, percentages, and values on a linear scale, which range from 0 to $3 . 5 0 \mathrm { e } + 1 5$ . The dataset consists of questions categorized into structural understanding, data retrieval and reasoning over bar plots, line plots, and scatter plots. This dataset does not consider any visual features of a chart (Masry et al., 2022). DVQA (Kafle et al., 2018): A synthetic dataset containing open ended questions about bar charts, where many questions refer to texts specific to corresponding charts.
|
| 192 |
+
• FigureQA (Kahou et al., 2018): A synthetic dataset containing yes/no questions about line graphs, bar and pie charts.
|
| 193 |
+
|
| 194 |
+
Dataset statistics of the test sets used in this paper are reported in the following table. For the synthetic datasets (i.e., PlotQA, DVQA, FigureQA), we randomly sample 10K examples for evaluation.
|
| 195 |
+
|
| 196 |
+
<table><tr><td>Dataset</td><td># Charts</td><td># QA Pairs</td></tr><tr><td>ChartQA (Aug.)</td><td>987</td><td>1250</td></tr><tr><td>ChartQA (Human)</td><td>625</td><td>1250</td></tr><tr><td>PlotQA V1</td><td>8643</td><td>10000</td></tr><tr><td>PlotQA V2</td><td>8252</td><td>10000</td></tr><tr><td>DVQA (reasoning)</td><td>9138</td><td>10000</td></tr><tr><td>FigureQA Val1</td><td>5000</td><td>5000</td></tr><tr><td>FigureQA Val2</td><td>5000</td><td>5000</td></tr></table>
|
| 197 |
+
|
| 198 |
+
# A.1.2 TEMPLATES FOR DATA GENERATION FOR SYSTEM-1
|
| 199 |
+
|
| 200 |
+
We use templates with ChartQA and PlotQA training sets to generate the data for fine-tuning System-1. Tables 5 and 6 show the templates we used and examples of the generated data, respectively.
|
| 201 |
+
|
| 202 |
+
Table 5: Templates for data generation for System-1.
|
| 203 |
+
|
| 204 |
+
<table><tr><td>Atomic Operation</td><td>Template</td><td>Used Data</td></tr><tr><td>Describe</td><td>Let's describe the figure.</td><td>Use general figure info, color, text label and name from original annotations.</td></tr><tr><td>Extract-Point</td><td>Let's extract the data of <entity> BY <entity2>. Let's extract the data of <entity>.</td><td>Retrieve the value of a cell in a table specified by the two entities as row or column.</td></tr><tr><td>Extract-Group</td><td>Let's extract the data of <entity>. Let's extract all the values.</td><td>Use table header with values for the specified entity. If only one entity is present, then extract all values.</td></tr></table>
|
| 205 |
+
|
| 206 |
+
Table 6: Examples of the atomic operations generated using templates for ChartQA and PlotQA.
|
| 207 |
+
|
| 208 |
+
<table><tr><td>Atomic Operation</td><td>Source</td><td>Question</td><td>Answer</td></tr><tr><td>Describe</td><td></td><td>ChartQALet's describe the figure.</td><td>The figure shows the data of: Income in million U.S. dollars (blue).The x-axis shows: Taylor Swift|Kylie Jenner|Kanye West |Lionel Messi |Ed Sheeran |Cristiano Ronaldo|Neymar丨The Eagles|Dr.Phil</td></tr><tr><td>Describe</td><td></td><td>PlotQALet's describe the figure.</td><td>McGraw |Canelo Alvarez. The figure shows the data of: Fragile and conflictaffected situations(grey)Iraq (brown)|Moldova (orange).The x-axis shows:2004|2005丨2006丨2007丨2004</td></tr><tr><td>Extract-Point</td><td>ChartQA</td><td>Let's extract the data of 2015.</td><td>|2005|2006|2007. The data is 296.0.</td></tr><tr><td>Extract-Point</td><td>PlotQA</td><td>Let's extract the data of Canada BY 1965.</td><td>The data is 20.82.</td></tr><tr><td>Extract-Group</td><td>ChartQA</td><td>Let's extract the data of Total market.</td><td>The data is 18 in 2019,20.0 in 2018,22.0 in 2017,23.0 in 2016,24.0 in 2015,25.0 in 2014,26.0 in 2013,27.0 in 2012,26.0 in 2011.</td></tr><tr><td>Extract-Group</td><td>PlotQA</td><td>Let's extract the data of 1994.</td><td>The data is O.16 in Merchandise exports, 0.36 in Merchandise imports.</td></tr></table>
|
| 209 |
+
|
| 210 |
+
Examples of the collected annotated data for System-2 are presented bellow. These examples are from PlotQA. Sentences that are input to the LLM are wrapped with [INST] tags.
|
| 211 |
+
|
| 212 |
+
<table><tr><td>[INST] Q: In how many years,is the value of the bar greater than 851? [/INST] A: Let’s describe the figure. [INST] The figure shows the data of: Neonatal deaths (green). The x-axis shows: 20oo|2001|2002 [2003|2004|2005.[/INST]</td></tr><tr><td>Let's extract the data of Neonatal deaths. [INST] The data is 853 in 2000,847 in 2001,822 in 2002,828 in 2003,818 in 2004,843 in 2005. [/INST]</td></tr><tr><td>The values that are greater than 851 are [853]. So the answer is 1.</td></tr><tr><td>[INST] Q: Across allyears, what is the minimum pupil-teacher ratio in Costa Rica? [/INST] A: Let's describe the figure. [INST] The figure shows the data of: Least developed countries (blue)| Cameroon (purple)| Costa</td></tr><tr><td>Rica (yellow)|Tajikistan (brown).The x-axis shows: 2000|2001|2006|2007|2008|2011.</td></tr><tr><td>[/INST] Let's extract the data of Costa Rica.</td></tr><tr><td>[INST] The data is 18.84 in 2000,19.57 in 2001,17.79 in 2006,17.91 in 2007,15.64 in 2008,14.92 in 2011. [/INST] The minimum value is 14.92 in 2011. So the answer is 14.92.</td></tr></table>
|
| 213 |
+
|
| 214 |
+
# A.2 EVALUATION PROMPTS
|
| 215 |
+
|
| 216 |
+
Below is the 1-shot prompt used by DePlot (Liu et al., 2023a), which includes one table followed by five question and answer pairs:
|
| 217 |
+
|
| 218 |
+
<table><tr><td colspan="4">Readtnetablebelowtoanswerthefollowingquestions. Header: Year丨Democrats 丨Republicans丨Independents</td></tr><tr><td></td><td>Row 1: 2004 |68.1%|45.0%[53.0%</td><td></td><td></td></tr><tr><td></td><td>Row 2: 2006|58.0%|42.0% |53.0%</td><td></td><td></td></tr><tr><td></td><td>Row 3: 2007 |59.0% |38.0%|45.0%</td><td></td><td></td></tr><tr><td>Row 4: 2009| 72.0%</td><td></td><td>49.0% 60.0%</td><td></td></tr><tr><td></td><td>Row 5: 2011 | 71.0% | 51.2%</td><td>58.0%</td><td></td></tr><tr><td></td><td>Row 6: 2012 |70.0%|48.0% |53.0%</td><td></td><td></td></tr><tr><td></td><td></td><td>Row 7: 2013 |72.0%|41.0% |60.0%</td><td></td></tr><tr><td colspan="4"></td></tr><tr><td></td><td></td><td>Q: In which year republicans have the lowest favor rate?</td><td></td></tr><tr><td colspan="4">A: Let's find the column of republicans.Then let's extract the favor rates: [45.0,42.0,38.0, 49.0,</td></tr><tr><td colspan="4">51.2,48.0,41.0]. The smallest number is 38.0,that's Row 3.Row 3 is year 2007. The answeris 2007.</td></tr><tr><td colspan="4">Q: What is the sum of Democrats’ favor rates of 2004,2012,and 2013?</td></tr><tr><td colspan="4"></td></tr><tr><td colspan="4">A: Let's find the rows of years 2004,2012,and 2013.We find Row 1,6,7. The favor dates of Democrats on that 3 rows are 68.1,70.0,and 72.0. 68.1+70.0+72=210.1. The answer is 210.1.</td></tr><tr><td colspan="4"></td></tr><tr><td colspan="4">Q: By how many points do Independents surpass Republicans in the year of 2011?</td></tr><tr><td colspan="4">A: Let's find the row with year = 2011. We find Row 5. We extract Independents and Republicans'</td></tr><tr><td colspan="4">numbers. They are 58.0 and 51.2. 58.0-51.2=6.8. The answer is 6.8.</td></tr><tr><td colspan="4">Q: Which group has the overall worst performance?</td></tr><tr><td colspan="4">A: Let's sample a couple of years.In Row 1, year 2Oo4,we find Republicans having the lowest</td></tr><tr><td colspan="4">favor rate 45.0 (since 45.0<68.1, 45.0<53.0). In year 2006,Row 2, we find Republicans having the</td></tr><tr><td colspan="4">lowest favor rate 42.0 (42.0<58.0, 42.0<53.0). The trend continues to other years. The answer is</td></tr><tr><td colspan="4">Republicans.</td></tr><tr><td colspan="4"></td></tr><tr><td colspan="4">Q: Which party has the second highest favor rates in 2007?</td></tr><tr><td colspan="4">A: Let's find the row of year 20o7,that’s Row 3.Let's extract the numbers on Row 3: [59.0, 38.0,</td></tr><tr><td colspan="4">45.0]. 45.0 is the second highest. 45.0 is the number of Independents.The answer is Independents.</td></tr><tr><td colspan="4"></td></tr><tr><td colspan="4">Read the table below to answer the following questions.</td></tr><tr><td colspan="4"></td></tr><tr><td colspan="4"></td></tr></table>
|
| 219 |
+
|
| 220 |
+
Below is the alternate 5-shot prompt that we used for evaluating DePlot, which includes five tables with one question and answer pair for each:
|
| 221 |
+
|
| 222 |
+
Read the table to answer the following question.
|
| 223 |
+
|
| 224 |
+
Header: Entity | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014
|
| 225 |
+
Row 1: Oman | 183.88 | 233.80 | 210.69 | 195.26 | 196.32 | 154.21 | 153.22
|
| 226 |
+
Row 2: Samoa | 40.72 | 40.04 | 39.21 | 40.63 | 41.47 | 41.76 | 42.77
|
| 227 |
+
Q: In which year the private health expenditure per person in Oman is 210.69?
|
| 228 |
+
A: Let’s find the row of Oman, that’s Row 1. Let’s find the number 210.69, that’s for the year of 2010. The answer is 2010. Header: Year | NET Excellent/ good | NET Only fair/ poor
|
| 229 |
+
Row 1: Feb 2014 | 54 | 39
|
| 230 |
+
Row 2: June 2015 | 55 | 0
|
| 231 |
+
Row 3: Jan 2018 | 45 | 46
|
| 232 |
+
Row 4: Sept. 2018 | 331 | 62
|
| 233 |
+
Q: By how many points does NET Excellent/good surpass NET Only fair/poor in the year of 2014?
|
| 234 |
+
A: Let’s find the row of 2014, that’s Row 1. We extract NET Excellent/good’s and NET Only fair/poor’s numbers. They are 54.00 and 39.00. 54.00-39.00=15.00. The answer is 15.00. Header: Characteristic | Share of respondents
|
| 235 |
+
Row 1: Very positive $1 \%$
|
| 236 |
+
Row 2: Fairly positive $141 \%$
|
| 237 |
+
Row 3: Fairly negative | $50 \%$
|
| 238 |
+
Row 4: Very negative $11 \%$
|
| 239 |
+
Q: How many perceptions have a value below $40 \%$ in America? A: Let’s find the values that are below 40: [4, 11]. The answer is 2.
|
| 240 |
+
|
| 241 |
+
Header: Characteristic | Consoles | PC | Mobile and ancillary | Other
|
| 242 |
+
Row 1: 2020 | 2784 | 2056 | 2559 | 687
|
| 243 |
+
Row 2: 2019 | 1920 | 1718 | 2203 | 648
|
| 244 |
+
Row 3: 2018 | 2538 | 2180 | 2175 607
|
| 245 |
+
Row 4: 2017 | 2389 | 2042 2081 505
|
| 246 |
+
Row 5: 2016 | 2453 | 2124 1674 | 357
|
| 247 |
+
Row 6: 2015 | 2391 | 1499 | 418 | 356
|
| 248 |
+
|
| 249 |
+
Q: In 2020, how much money did Activision Blizzard’s console segment generate in annual revenues in Australia?
|
| 250 |
+
A: Let’s find the row of 2020, that’s Row 1. Let’s find the number for Consoles, that’s 2784. The answer is 2784. Header: Characteristic | Share of respondents
|
| 251 |
+
Row 1: Decreased | $81 \%$
|
| 252 |
+
Row 2: No impact | $16 \%$
|
| 253 |
+
Row 3: Increased $1 3 \%$
|
| 254 |
+
Q: Is the sum of two smallest segments greater than the largest segment?
|
| 255 |
+
A: Let’s extract the numbers of all the rows: [81, 16, 3]. The two smallest numbers are 16 and 3. $1 6 + 3 = 1 9$ , which is smaller than 81. The answer is no.
|
| 256 |
+
|
| 257 |
+
Below is the 5-shot prompt we used for evaluating DOMINO on ChartQA:
|
| 258 |
+
|
| 259 |
+
Answer the following questions step by step.
|
| 260 |
+
Q: In which year the private health expenditure per person in Oman is 210.69? A: Let’s describe the figure. The figure shows the data of: Oman (brown) | Samoa (dark blue). The x-axis shows: 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014.
|
| 261 |
+
Let’s extract the data of Oman.
|
| 262 |
+
The data is 183.88 in 2008, 233.80 in 2009, 210.69 in 2010, 195.26 in 2011, 196.32 in 2012, 154.21 in 2013, 153.22 in 2014.
|
| 263 |
+
The value 210.69 is in year 2010. So the answer is 2010. Q: By how many points does NET Excellent/good surpass NET Only fair/poor in German in the year of 2018?
|
| 264 |
+
A: Let’s describe the figure.
|
| 265 |
+
The figure shows the data of: NET Excellent/ good (blue) | NET Only fair/ poor (orange). The x-axis shows: Brazil, German, Russia, U.S., Japan.
|
| 266 |
+
Let’s extract the data of NET Excellent/ good BY German.
|
| 267 |
+
The data is 54.00.
|
| 268 |
+
Let’s extract the data of NET Only fair/ poor BY German.
|
| 269 |
+
The data is 39.00.
|
| 270 |
+
54.00 surpasses 39.00 by $5 4 . 0 0 - 3 9 . 0 0 { = } 1 5 . 0 0$ . So the answer is 15.00. Q: How many perceptions have a value below $40 \%$ in America?
|
| 271 |
+
A: Let’s describe the figure.
|
| 272 |
+
The figure shows the data of: Share of respondents (blue). The x-axis shows: Very positive, Fairly positive, Fairly negative, Very negative.
|
| 273 |
+
Let’s extract the data of Share of respondents.
|
| 274 |
+
The data is 4.00 in Very positive, 41.00 in Fairly positive, 50.00 in Fairly negative, 11.00 in Very negative. The values that are below 40.00 are [4.00, 11.00]. So the answer is 2. Q: In 2020, how much money did Activision Blizzard’s console segment generate in annual revenues in Australia? A: Let’s describe the figure.
|
| 275 |
+
The figure shows the data of: Consoles (blue) | PC\* (dark blue) | Mobile and ancillary\*\* (grey) | Other (dard red). The x-axis shows: 2019 | 2020 | 2021 | 2022.
|
| 276 |
+
Let’s extract the data of Consoles BY 2020.
|
| 277 |
+
The data is 2784.00.
|
| 278 |
+
The Console segment generated 2784.00 in annual revenues in 2020. So the answer is 2784.00. Q: Is the sum of two smallest segments greater than the largest segment?
|
| 279 |
+
A: Let’s describe the figure.
|
| 280 |
+
The figure shows the data of: Value. The $\mathbf { X }$ -axis shows: Decreased | No impact | Increased. Let’s extract the data of Value.
|
| 281 |
+
The data is 81.00 in Decreased, 16.00 in No impact, 3.00 in Increased.
|
| 282 |
+
Among [81.00, 16.00, 3.00], the two smallest values are 16.00 and 3.00 while the largest value is 8 $1 . 0 0 . \ 1 6 . 0 0 \substack { + 3 . 0 0 = 1 9 . 0 0 }$ , which is smaller than 81.00. So the answer is no.
|
| 283 |
+
|
| 284 |
+
Below is the 5-shot prompt we used for evaluating DOMINO on ChartQA without Describe:
|
| 285 |
+
|
| 286 |
+
Answer the following questions step by step.
|
| 287 |
+
|
| 288 |
+
Q: In which year the private health expenditure per person in Oman is 210.69?
|
| 289 |
+
A: Let’s extract the data of Oman.
|
| 290 |
+
The data is 183.88 in 2008, 233.80 in 2009, 210.69 in 2010, 195.26 in 2011, 196.32 in 2012, 154.21 in 2013, 153.22 in 2014.
|
| 291 |
+
The value 210.69 is in year 2010. So the answer is 2010.
|
| 292 |
+
|
| 293 |
+
Q: By how many points does NET Excellent/good surpass NET Only fair/poor in German in the year of 2018?
|
| 294 |
+
|
| 295 |
+
A: Let’s extract the data of NET Excellent/ good BY German.
|
| 296 |
+
The data is 54.00.
|
| 297 |
+
Let’s extract the data of NET Only fair/ poor BY German.
|
| 298 |
+
The data is 39.00.
|
| 299 |
+
54.00 surpasses 39.00 by $5 4 . 0 0 - 3 9 . 0 0 { = } 1 5 . 0 0$ . So the answer is 15.00. Q: How many perceptions have a value below $40 \%$ in America?
|
| 300 |
+
A: Let’s extract the data of Share of respondents.
|
| 301 |
+
The data is 4.00 in Very positive, 41.00 in Fairly positive, 50.00 in Fairly negative, 11.00 in Very negative. The values that are below 40.00 are [4.00, 11.00]. So the answer is 2.
|
| 302 |
+
|
| 303 |
+
Q: In 2020, how much money did Activision Blizzard’s console segment generate in annual revenues in Australia? A: Let’s extract the data of Consoles BY 2020. The data is 2784.00. The Console segment generated 2784.00 in annual revenues in 2020. So the answer is 2784.00.
|
| 304 |
+
|
| 305 |
+
Q: Is the sum of two smallest segments greater than the largest segment? A: Let’s extract the data of Value. The data is 81.00 in Decreased, 16.00 in No impact, 3.00 in Increased. Among [81.00, 16.00, 3.00], the two smallest values are 16.00 and 3.00 while the largest value is 8 $1 . 0 0 . \ 1 6 . 0 0 + 3 . 0 0 { = } 1 9 . 0 0$ , which is smaller than 81.00. So the answer is no.
|
| 306 |
+
|
| 307 |
+
# A.3 ERROR EXAMPLES
|
| 308 |
+
|
| 309 |
+
Table 7: Number of errors per template type for PlotQA V2 (examples follow). Numbers in parenthesis indicate total number of examples per template type in the 10K sample we evaluated.
|
| 310 |
+
|
| 311 |
+
<table><tr><td>Method</td><td>data retrieval (1379)</td><td>structural (447)</td><td>arithmetic (5147)</td><td>compound (637)</td><td>comparison (1815)</td><td>min-max (575)</td></tr><tr><td>Few-Shot DePlot</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LLaMA-2 (70B)</td><td>547</td><td>275</td><td>3448</td><td>323</td><td>757</td><td>185</td></tr><tr><td>DOMINO (our method)</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LLaMA-2 (70B)</td><td>400</td><td>203</td><td>2928</td><td>193</td><td>312</td><td>64</td></tr><tr><td>Fine-tuned LLaMA-2 (70B)</td><td>388</td><td>189</td><td>1861</td><td>177</td><td>242</td><td>62</td></tr><tr><td>Fine-tuned LLaMA-2 (70B) (SC)</td><td>377</td><td>159</td><td>915</td><td>184</td><td>233</td><td>63</td></tr></table>
|
| 312 |
+
|
| 313 |
+
Example of errors for each template type in PlotQA v2 made by DOMINO with finetuned LLaMA2 (70B) is illustrated in the following table.
|
| 314 |
+
|
| 315 |
+
<table><tr><td>Template</td><td>Question</td><td>Answer</td><td>Prediction</td></tr><tr><td colspan="4">Continued on next page</td></tr></table>
|
| 316 |
+
|
| 317 |
+

|
| 318 |
+
Continued on next page
|
| 319 |
+
|
| 320 |
+

|
| 321 |
+
Continued on next page
|
| 322 |
+
|
| 323 |
+
So the answer is 1.
|
| 324 |
+
|
| 325 |
+

|
| 326 |
+
|
| 327 |
+
Example of errors about task decomposition in ChartQA-human made by DOMINO with finetuned LLaMA-2 (70B) is illustrated in the following table.
|
| 328 |
+
|
| 329 |
+
<table><tr><td>Question</td><td>Answer</td></tr><tr><td colspan="2">Continued on next page</td></tr></table>
|
| 330 |
+
|
| 331 |
+

|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Expenditures on general government outsourcing (%GDP)
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
|
| 338 |
+
Figure 4: The charts for the case study in $\ S 6$ . The charts are from ChartQA (Masry et al., 2022).
|
md/test/CD9Snc73AW/CD9Snc73AW.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/DzxaRFVsgC/DzxaRFVsgC.md
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GPT4ROI: INSTRUCTION TUNING LARGE LANGUAGE MODEL ON REGION-OF-INTEREST
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Visual instruction tuning large language model (LLM) on image-text pairs has achieved general-purpose vision-language abilities. However, the lack of regiontext pairs limits their advancements to fine-grained multimodal understanding. In this paper, we propose spatial instruction tuning, which introduces the reference to the region-of-interest (RoI) in the instruction. Before sending to LLM, the reference is replaced by RoI features and interleaved with language embeddings as a sequence. Our model GPT4RoI, trained on 7 region-text pair datasets, brings an unprecedented interactive and conversational experience compared to previous image-level models. (1) Interaction beyond language: Users can interact with our model by both language and drawing bounding boxes to flexibly adjust the referring granularity. (2) Versatile multimodal abilities: A variety of attribute information within each RoI can be mined by GPT4RoI, e.g., color, shape, material, action, etc. Furthermore, it can reason about multiple RoIs based on common sense. On the Visual Commonsense Reasoning (VCR) dataset, GPT4RoI achieves a remarkable accuracy of $8 1 . 6 \%$ , surpassing all existing models by a significant margin (the second place is $7 5 . 6 \%$ ) and almost reaching human-level performance of $8 5 . 0 \%$ . The code, dataset, and demo can be found at https://github. com/Anonymous-Researcher1/GPT4RoI.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
Figure 1: Comparison of visual instruction tuning on image-text pairs and spatial instruction tuning on region-text pairs. The bounding box and text description of each object are provided in region-text datasets. During training, the bounding box is from annotations, and in inference, it can be provided by user or any off-the-shelf object detector
|
| 13 |
+
|
| 14 |
+
Recent advancements of large language models (LLM) have shown incredible performance in solving natural language processing tasks in a human-like conversational manner, for example, commercial products (OpenAI, 2022; Anthropic, 2023; Google, 2023; OpenAI, 2023) and community opensource projects (Touvron et al., 2023a;b; Taori et al., 2023; Chiang et al., 2023; Du et al., 2022; Sun & Xipeng, 2022). Their unprecedented capabilities present a promising path toward general-purpose artificial intelligence models. Witnessing the power of LLM, the field of multimodal models (Yang et al., 2023c; Huang et al., 2023; Girdhar et al., 2023; Driess et al., 2023) is developing a new technology direction to leverage LLM as the universal interface to build general-purpose models, where the feature space of a specific task is tuned to be aligned with the feature space of pre-trained language models.
|
| 15 |
+
|
| 16 |
+
Table 1: Comparisons of vision-language models. Our GPT4RoI is an end-to-end model that supports region-level understanding and multi-round conversation.
|
| 17 |
+
|
| 18 |
+
<table><tr><td>Model</td><td></td><td> Image Region Multi-Region</td><td></td><td>Muilirgund En-o-End</td><td></td></tr><tr><td>Visual ChatGPT (Wu et al., 2023)</td><td>√</td><td></td><td>xxxx//xxx</td><td></td><td></td></tr><tr><td>MiniGPT-4 (Zhu et al., 2023)</td><td>√</td><td></td><td></td><td></td><td></td></tr><tr><td>LLaVA (Liu et al., 2023a)</td><td></td><td>xxx~</td><td></td><td></td><td></td></tr><tr><td>InstructBLIP (Dai et al., 2023)</td><td></td><td></td><td></td><td></td><td>ννν</td></tr><tr><td>MM-REACT (Yang et al., 2023c)</td><td></td><td>xν</td><td></td><td></td><td></td></tr><tr><td>InternGPT (Liu et al., 2023d)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VisionLLM (Wang et al., 2023b)</td><td></td><td>?</td><td></td><td></td><td></td></tr><tr><td>CaptionAnything (Wang et al., 2023a)</td><td></td><td>X</td><td></td><td>X</td><td></td></tr><tr><td>DetGPT (Pi et al., 2023)</td><td></td><td></td><td></td><td></td><td>xx/xx</td></tr><tr><td>GPT4RoI</td><td>√</td><td></td><td>√</td><td></td><td>√</td></tr></table>
|
| 19 |
+
|
| 20 |
+
As one of the representative tasks, vision-and-language models align the vision encoder feature to LLM by instruction tuning on image-text pairs, such as MiniGPT-4 (Zhu et al., 2023), LLaVA (Liu et al., 2023a), InstructBLIP (Dai et al., 2023), etc. Although these works achieve amazing multimodal abilities, their alignments are only on image-text pairs (Chen et al., 2015; Sharma et al., 2018; Changpinyo et al., 2021; Ordonez et al., 2011; Schuhmann et al., 2021), the lack of region-level alignment limits their advancements to more fine-grained understanding tasks such as region caption (Krishna et al., 2017) and reasoning (Zellers et al., 2019a). To enable region-level understanding in vision-language models, some works attempt to leverage external vision models, for example, MMREACT (Yang et al., 2023c), InternGPT (Liu et al., 2023d) and DetGPT (Pi et al., 2023), as shown in Table 1. However, their non-end-to-end architecture is a sub-optimal choice for general-purpose multi-modal models.
|
| 21 |
+
|
| 22 |
+
Considering the limitations of previous works, our objective is to construct an end-to-end visionlanguage model that supports fine-grained understanding on region-of-interest. Since there is no operation that can refer to specific regions in current image-level vision-language models (Zhu et al., 2023; Liu et al., 2023a; Zhang et al., 2023c; Dai et al., 2023), our key design is to incorporate references to bounding boxes into language instructions, thereby upgrading them to the format of spatial instructions. For example, as shown in Figure 1, when the question is “what is <region1 $>$ doing?”, where the <region $^ { \prime } >$ refers to a specific region-of-interest, the model will substitute the embedding of <region1 $^ { \prime } >$ with the region feature extracted by the corresponding bounding box. The region feature extractor can be flexibly implemented by RoIAlign (He et al., 2017) or Deformable attention (Zhu et al., 2020).
|
| 23 |
+
|
| 24 |
+
To establish fine-grained alignment between vision and language, we involve region-text datasets in our training, where the bounding box and the text description of each region are provided. The datasets are consolidated from publicly available ones including COCO object detection (Lin et al., 2014), RefCOCO (Yu et al., 2016), RefCOCO $^ +$ (Yu et al., 2016), RefCOCOg (Mao et al., 2016), Flickr30K entities (Plummer et al., 2015), Visual Genome(VG) (Krishna et al., 2017) and Visual Commonsense Reasoning(VCR) (Zellers et al., 2019a). These datasets are transformed into spatial instruction tuning format. Moreover, we incorporate the LLaVA150K dataset (Liu et al., 2023a) into our training process by utilizing an off-the-shelf detector to generate bounding boxes. This enhances our model’s ability to engage in multi-round conversations and generate more human-like responses.
|
| 25 |
+
|
| 26 |
+
The collected datasets are categorized into two types based on the complexity of the text. First, the plain-text data contains object category and simple attribute information. It is used for pre-training the region feature extractor without impacting the LLM. Second, the complex-text data often contains complex concepts or requires common sense reasoning. We conduct end-to-end fine-tuning of the region feature extractor and LLM for these data.
|
| 27 |
+
|
| 28 |
+
Benefiting from spatial instruction tuning, our model brings a new interactive experience, where the user can express the question to the model with language and the reference to the region-of-interest. This leads to new capacities beyond image-level understanding, such as region caption and complex region reasoning. As a generalist, our model GPT4RoI also shows its strong region understanding ability on three popular benchmarks, including the region caption task on Visual Genome (Krishna et al., 2017), the region reasoning task on Visual-7W (Zhu et al., 2016) and Visual Commonsense Reasoning (Zellers et al., 2019a) (VCR). Especially noteworthy is the performance on the most challenging VCR dataset, where GPT4RoI achieves an impressive accuracy of $8 1 . 6 \%$ , 6 points ahead of the second-place and nearing the human-level performance benchmarked at $8 5 . 0 \%$ .
|
| 29 |
+
|
| 30 |
+
In summary, our work makes the following contributions:
|
| 31 |
+
|
| 32 |
+
• We introduce spatial instruction, combining language and the reference to region-of-interest into an interleave sequence, enabling accurate region referring and enhancing user interaction. • By spatial instruction tuning LLM with massive region-text datasets, our model can follow user instructions to solve diverse region understanding tasks, such as region caption and reasoning. • Our method, as a generalist, outperforms the previous state-of-the-art approach on a wide range of region understanding benchmarks.
|
| 33 |
+
|
| 34 |
+
# 2 RELATED WORK
|
| 35 |
+
|
| 36 |
+
# 2.1 LARGE LANGUAGE MODEL
|
| 37 |
+
|
| 38 |
+
The field of natural language processing (NLP) has achieved significant development by the highcapability large language model (LLM). The potential of LLM is first demonstrated by pioneering works such as BERT (Devlin et al., 2018) and GPT (Radford et al., 2018). Then scaling up progress is started and leads to a series of excellent works, for example, T5 (Raffel et al., 2020), GPT-3 (Brown et al., 2020), Flan-T5 (Chung et al., 2022), PaLM (Chowdhery et al., 2022), etc. With the growth of training data and model parameters, this scaling up progress brings to a phenomenal product, ChatGPT (OpenAI, 2022). By generative pre-trained LLM and instruction tuning (Ouyang et al., 2022) on human feedback, ChatGPT shows unprecedented performance on conversations with humans, reasoning and planning tasks (Mu et al., 2023; Yang et al., 2023a; Bubeck et al., 2023), etc.
|
| 39 |
+
|
| 40 |
+
# 2.2 LARGE VISION-LANGUAGE MODEL
|
| 41 |
+
|
| 42 |
+
To utilize high-performance LLM to build up vision-language models, LLM as task coordinator is proposed. Given the user instruction, LLM parses the instruction and calls various external vision models. Some representative works are Visual ChatGPT (Wu et al., 2023), ViperGPT (Surís et al., 2023), MM-REACT (Yang et al., 2023c), InternGPT (Liu et al., 2023d), VideoChat (Li et al., 2023b), etc. Although these models largely expand the scope of multimodal models, they depend on external vision models and these non-end-to-end architectures are not the optimal choice for multi-modal models. To obtain end-to-end vision-language models, instruction tuning LLM on image-text pairs is proposed to align visual features with LLM and accomplish multimodal tasks in a unified way, for example, Flamingo (Alayrac et al., 2022), MiniGPT-4 (Zhu et al., 2023), LLaVA (Liu et al., 2023a), LLaMa-Adapter (Zhang et al., 2023c), InstructBLIP (Dai et al., 2023), MM-GPT (Gong et al., 2023), VPGTrans (Zhang et al., 2023a), etc. These models achieve amazing image-level multimodal abilities, while several benchmarks such as LVLM-eHub (Xu et al., 2023) and MMBench (Liu et al., 2023c) find that these models still have performance bottlenecks when need to be under specific region reference. Our GPT4RoI follows the research line of visual instruction tuning and moves forward region-level multimodal understanding tasks such as region caption (Krishna et al., 2017) and reasoning (Zellers et al., 2019a).
|
| 43 |
+
|
| 44 |
+
# 2.3 REGION-LEVEL IMAGE UNDERSTANDING
|
| 45 |
+
|
| 46 |
+
For region-level understanding, it is a common practice in computer vision to identify potential regions of interest first and then do the understanding. Object detection (Ren et al., 2015; Carion et al., 2020; Zhu et al., 2020; Zang et al., 2023) tackles the search for potential regions, which are generally accompanied by a simple classification task to understand the region’s content. To expand the object categories, (Kamath et al., 2021; Liu et al., 2023b; Zhou et al., 2022; $\mathrm { L i ^ { * } }$ et al., 2022) learn from natural language and achieve amazing open-vocabulary object recognition performance. Region captioning (Johnson et al., 2015; Yang et al., 2017; Wu et al., 2022) provides more descriptive language descriptions in a generative way. Scene graph generation (Li et al., 2017; Tang et al., 2018; Yang et al., 2022) analyzes the relationships between regions by the graph. The VCR (Zellers et al., 2019b) dataset presents many region-level reasoning cases and (Yu et al., 2021; Su et al., 2019; Li et al., 2019b; Yao et al., 2022) exhibit decent performance by correctly selecting the answers in the multiple-choice format. However, a general-purpose region understanding model has yet to emerge. In this paper, by harnessing the powerful large language model (Touvron et al., 2023a; Chiang et al., 2023), GPT4RoI uses a generative approach to handle all these tasks. Users can complete various region-level understanding tasks by freely asking questions.
|
| 47 |
+
|
| 48 |
+
# 2.4 USING TEXTUAL COORDINATES AS THE GROUNDING TOKEN.
|
| 49 |
+
|
| 50 |
+
We compare the design philosophy with methods using textual coordinates as the grounding token and provide a brief overview of concurrent works, all of which can be found in the appendix.
|
| 51 |
+
|
| 52 |
+
# 3 METHOD: GPT4ROI
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
Figure 2: GPT4RoI is an end-to-end vision-language model for processing spatial instructions that contain references to the region-of-interest, such as <region $\{ i \} >$ . During tokenization and conversion to embeddings, the embedding of ${ < r e g i o n \mathord { \left/ { \vphantom { < r e g i o n \left/ { i } \right.} \kern - delimiterspace } \right.} \kern - delimiterspace } >$ in the instruction is replaced with the RoIAlign results from multi-level image features. Subsequently, such an interleaved region feature and language embedding sequence can be sent to a large language model (LLM) for further processing. We also utilize the entire image feature to capture global information and omit it in the figure for brevity. A more detailed framework figure can be found in Figure 5 in the Appendix.
|
| 56 |
+
|
| 57 |
+
The overall framework of GPT4RoI consists of a vision encoder, a projector for image-level features, a region feature extractor, and a large language model (LLM). Compared to previous works (Zhu et al., 2023; Liu et al., 2023a), GPT4RoI stands out for its ability to convert instructions that include spatial positions into an interleaved sequence of region features and text embeddings, as shown in Figure 2.
|
| 58 |
+
|
| 59 |
+
# 3.1 MODEL ARCHITECTURE
|
| 60 |
+
|
| 61 |
+
We adopt the ViT-L/14 architecture from CLIP (Radford et al., 2021) as the vision encoder. Following (Liu et al., 2023a), we use the feature map of the penultimate transformer layer as the representation of the entire image, and then map the image feature embedding to the language space using a single linear layer as projector. Finally, we employ the Vicuna (Zheng et al., 2023), an instruction-tuned LLaMA (Touvron et al., 2023a), to perform further processing.
|
| 62 |
+
|
| 63 |
+
We utilize widely adopted modules in the field of object detection to construct our RoI feature extractor. To ensure a robust feature representation for regions of varying scales, we construct a multi-level image feature pyramid (Lin et al., 2017) by selecting four layers from the CLIP vision encoder and fusing them with five lightweight scale shuffle modules (Zhang et al., 2023d). These layers are located at the second-to-last, fifth-to-last, eighth-to-last, and eleventh-to-last positions, respectively. Additionally, we incorporate feature coordinates (Liu et al., 2018a; Wang et al., 2020) for each level to address the problem of translation invariance in CNNs. This helps make the model sensitive to absolute position information, such as the description “girl on left” in Figure 3. Finally, we use RoIAlign to extract region-level features with an output size of $1 4 \times 1 4$ (He et al., 2017), which ensures that sufficient detailed information is preserved. Moreover, all four level features are involved in the RoIAlign operation and fused into a single embedding as the representation of the region of interest (RoI) (Liu et al., 2018b).
|
| 64 |
+
|
| 65 |
+
# 3.2 TOKENIZATION AND EMBEDDING
|
| 66 |
+
|
| 67 |
+
To enable users to refer to regions of interest in text inputs, we define a special token <region $\{ i \} >$ , which acts as the placeholder that will be replaced by the corresponding region feature after tokenization and embedding. One example is depicted in Figure 2. When a user presents a spatial instruction, “What was $< r e g i o n 1 >$ doing before $< r e g i o n 3 >$ touched him?”, the embedding of <region $\beth$ and $< \mathtt { r e g i o n 3 } >$ are replaced by their corresponding region features. However, this replacement discards the references to different regions. To allows LLM to maintain the original references (region1, region3) in the response sequence, the instruction is modified to “What was region1 $< r e g i o n 1 >$ doing before region3 $< r e g i o n 3 >$ touched him?”. Then, LLM can generate a reply like “The person in region1 was eating breakfast before the person in region3 touched them.”
|
| 68 |
+
|
| 69 |
+
Regardless of the user instruction, we incorporate a prefix prompt, “The <image> provides an overview of the picture.” The $< i m a g e >$ is a special token that acts as a placeholder, the embedding of which would be replaced by image features of the vision encoder. These features enable LLM to receive comprehensive image information and obtain a holistic understanding of the visual context.
|
| 70 |
+
|
| 71 |
+
# 3.3 SPATIAL INSTRUCTION TUNING
|
| 72 |
+
|
| 73 |
+
Our model is trained using a next-token prediction loss (Liu et al., 2023a; Zhu et al., 2023), where the model predicts the next token in a given input text sequence. The training details are in Section A.2 in the Appendix.
|
| 74 |
+
|
| 75 |
+
We transform annotations into instruction tuning format by creating a question that refers to the mentioned region for each region-text annotation. We partition the available region-text data into two groups, employing each in two distinct training stages. In the first stage, we attempt to align region features with word embeddings in language models using simple region-text pairs that contain color, position, or category information. The second stage is designed to handle more complex concepts, such as actions, relationships, and common sense reasoning. Furthermore, we provide diverse instructions for these datasets to simulate chat-like input in this stage.
|
| 76 |
+
|
| 77 |
+
Stage 1: Pre-training In this stage, we first load the weights of LLaVA (Liu et al., 2023a) after its initial stage of training, which includes a pre-trained vision encoder, a projector for image-level features, and an LLM. We only keep the region feature extractor trainable and aim to align region features with language embedding by collecting short text and bounding box pairs. These pairs are from both normal detection datasets and referring expression detection datasets, which have short expressions. The objective is to enable the model to recognize categories and simple attributes of the region in an image, which are typically represented by a short text annotation (usually within 5 words). Specifically, we utilize COCO (Lin et al., 2014), RefCOCO (Yu et al., 2016), and RefCOCO $^ +$ (Yu et al., 2016) datasets in this stage.
|
| 78 |
+
|
| 79 |
+
As shown in Table 2, for COCO detection data, we first explain the task in the prompt and then convert the annotations to a single-word region caption task. For RefCOCO and $\operatorname { R e f C O C O + }$ , we also give task definitions first and train the model to generate descriptions containing basic attributes of the region. Only the description of the region (in red color) will be used to calculate the loss.
|
| 80 |
+
|
| 81 |
+
After this training stage, GPT4RoI can recognize categories, simple attributes, and positions of regions in images, as shown in Figure 3.
|
| 82 |
+
|
| 83 |
+
Stage 2: End-to-end fine-tuning In this stage, we only keep the vision encoder weights fixed and train the region feature extractor, image feature projector, and LLM weights. Our main focus is to enhance GPT4RoI’s ability to accurately follow user instructions and tackle complex single/multiple region understanding tasks. We tailor specific instructions for different tasks. For single region caption, we construct from Visual Genome (VG) region caption part (Krishna et al., 2017) and RefCOCOg (Mao et al., 2016). For multiple region caption, Flicker30k (Plummer et al., 2015) is converted to a multiple region caption task where the caption should include all visual elements emphasized by bounding boxes. To simulate user instruction, we create 20 questions for each caption task as shown in Table 8 and Table 9. For the region reasoning task, we modify Visual Commonsense Reasoning (VCR) (Zellers et al., 2019a) to meet the input format requirements and make it more similar to human input. The details of this process can be found in Section A.3.
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Table 2: The instruction template for Stage 1 training data: For both tasks, we begin by providing a description of the task definition and the expected answer. Then, we concatenate all region-text pairs into a sequence. For detection data, the format is <region $\{ i \} >$ category_name. For referring expression comprehension, the format is <region $\{ i \} >$ description of region. Only the responses highlighted in red are used to calculate the loss.
|
| 87 |
+
|
| 88 |
+

|
| 89 |
+
Figure 3: After Stage 1 training, GPT4RoI is capable of identifying the category of the region (elephant), simple attributes such as color (purple), and the position of the region (left).
|
| 90 |
+
|
| 91 |
+
To improve the capability of GPT4RoI for multi-round conversation and generate more human-like responses, we also involve the LLaVA150k (Liu et al., 2023a) visual instruction dataset in this stage. We employ an off-the-shelf LVIS detector (Fang et al., 2023) to extract up to 100 detection boxes per image. These boxes are then concatenated with the user instructions in the format “<region $\{ i \} >$ may feature a class_name”. LLaVA150k significantly improves the capability of GPT4RoI for multi-round conversation .
|
| 92 |
+
|
| 93 |
+
After completing this training stage, GPT4RoI is capable of performing complex region understanding tasks based on user instructions, including region caption and reasoning, as demonstrated in Section 4.
|
| 94 |
+
|
| 95 |
+
# 4 DEMOSTRATIONS
|
| 96 |
+
|
| 97 |
+
In this section, we compare the differences between the visual instruction tuning model LLaVA (Liu et al., 2023a) and our spatial instruction tuning model GPT4RoI. We demonstrate our new interactive approach and highlight its advanced capabilities in understanding multimodality.
|
| 98 |
+
|
| 99 |
+

|
| 100 |
+
Table 3: Instruction template for Stage 2 training data: During training, we randomly select one question for both single and multiple region caption tasks. For reasoning tasks, we modify the original questions to include a reference for each region so that GPT4RoI can mention them in its response. Only the response in red color and stop string ### will be used to calculate the loss.
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
Figure 4: GPT4RoI and LLaVA dialogue performance showcase. Figures A and C demonstrate the dialogue scenarios of LLaVA when referring to a single instance and multiple instances solely using natural language in the conversation. On the other hand, Figures B and D showcase how GPT4RoI utilizes bounding boxes as references to address the same scenarios.
|
| 104 |
+
|
| 105 |
+
As shown in Figure 4.A, when we try to make LLaVA focus on the center region of the image, it only sees the boy holding an umbrella and a bag, but it misses the book. As a result, LLaVA gives a wrong answer to the question “What is the boy doing” (Figure 4.A. $\textcircled{1}$ ), and this leads to an incorrect conclusion that “the boy’s behavior is not dangerous” (Figure 4.A. $\textcircled{2}$ ).
|
| 106 |
+
|
| 107 |
+
In comparison, as shown in Figure 4.B, our approach GPT4RoI efficiently recognizes visual details using the given bounding box. This allows it to accurately identify the action of “reading a magazine.” Furthermore, GPT4RoI demonstrates its reasoning abilities by correctly inferring that the “boy’s behavior is dangerous”, and giving a reasonable reason that “the boy is reading a book while crossing the street”.
|
| 108 |
+
|
| 109 |
+
When there are multiple instances in the image (as depicted in Figure 4.C), we attempt to refer to the corresponding instances as “the right” and “the middle”. However, LLaVA provides incorrect information by stating that the right man is “looking at the women” (as shown in Figure $4 . C . ( \textcircled { 3 } )$ . Even more concerning, LLaVA overlooks the actual women in the middle and mistakenly associates the women on the left as the reference, resulting in completely inaccurate information (as shown in Figure $4 . C . { \textcircled {4 } }$ & $\textcircled{5}$ ).
|
| 110 |
+
|
| 111 |
+
In comparison, as shown in Figure 4.D, GPT4RoI is able to understand the user’s requirements, such as identifying the person to call when ordering food, and accurately recognize that the person in region1 fulfills this criterion. Additionally, it correctly recognizes that the person in region3 is “looking at the menu”. Importantly, GPT4RoI can also infer relationships between the provided regions based on visual observations. For example, it deduces that the likely relationship between region2 and region3 is that of a “couple”, providing a reasonable explanation that they “are smiling and enjoying each other’s company”.
|
| 112 |
+
|
| 113 |
+
# 5 QUANTITATIVE RESULTS
|
| 114 |
+
|
| 115 |
+
To quantitatively evaluate GPT4RoI, we have chosen three representative benchmarks to assess the region understanding capabilities. These benchmarks include the region caption task on Visual Genome (Krishna et al., 2017), the region reasoning task on Visual-7W (Zhu et al., 2016), and Visual Commonsense Reasoning (Zellers et al., 2019a) (VCR). In order to minimize the impact of specific dataset label styles and make evaluation metrics easier to calculate, we fine-tuned GPT4RoI on each benchmark using different task prompts. More details can be found in Section A.2 in the Appendix.
|
| 116 |
+
|
| 117 |
+
# 5.1 REGION CAPTION
|
| 118 |
+
|
| 119 |
+
We report the scores of BLEU, METEOR, ROUGE, and CIDEr for both GPT4RoI-7B and GPT4RoI13B on the validation set of Visual Genome (Krishna et al., 2017). The grounding box in the annotation is combined with the task prompt in Appendix Table 7 to get the response.
|
| 120 |
+
|
| 121 |
+
<table><tr><td>Model</td><td>BLEU@4</td><td>METEOR</td><td>ROUGE</td><td>CIDEr</td></tr><tr><td>GRiT (Wu et al., 2022)</td><td></td><td>17.1</td><td>1</td><td>142.0</td></tr><tr><td>GPT4RoI-7B</td><td>11.5</td><td>17.4</td><td>35.0</td><td>145.2</td></tr><tr><td>GPT4RoI-13B</td><td>11.7</td><td>17.6</td><td>35.2</td><td>146.8</td></tr></table>
|
| 122 |
+
|
| 123 |
+
Table 4: Compariation of region caption ability on the validation dataset on Visual Genome. All methods employ ground truth bounding boxes and GPT4RoI can outperform previous state-of-the-art specialist GRiT.
|
| 124 |
+
|
| 125 |
+
The generalist approach GPT4RoI outperforms the previous state-of-the-art specialist model GRiT (Wu et al., 2022) by a significant margin, without any additional techniques or tricks. Additionally, we observe that the performance of GPT4RoI-7B and GPT4RoI-13B is comparable, suggesting that the bottleneck in performance lies in the design of the visual module and the availability of region-text pair data. These areas can be explored further in future work.
|
| 126 |
+
|
| 127 |
+
# 5.2 VISUAL-7W
|
| 128 |
+
|
| 129 |
+
Visual-7W (Zhu et al., 2016) is a PointQA dataset that contains a which box setting. Here, the model is required to choose the appropriate box among four options, based on a given description. For example, a question might ask, “Which is the black machine under the sign?”. This type of question not only tests the model’s object recognition but also its ability to determine the relationship between objects.
|
| 130 |
+
|
| 131 |
+
To prevent information leakage, we remove overlapping images with the test set from Visual Genome (Krishna et al., 2017). The results clearly demonstrate that the 13B model outperforms the 7B model by a significant margin. This finding suggests that the reasoning ability heavily relies on the Large Language Model (LLM).
|
| 132 |
+
|
| 133 |
+
Table 5: Accuracy on Visual-7W test dataset.
|
| 134 |
+
|
| 135 |
+
<table><tr><td>Model</td><td>LSTM-Att (Zhu et al., 2016)</td><td>CMNs (Hu et al., 2016)</td><td>12in1 (Lu et al., 2020)</td><td>GPT4RoI-7B</td><td>GPT4RoI-13B</td></tr><tr><td>Acc(%)</td><td>56.10</td><td>72.53</td><td>83.35</td><td>81.83</td><td>84.82</td></tr></table>
|
| 136 |
+
|
| 137 |
+
# 5.3 VISUAL COMMONSENSE REASONING
|
| 138 |
+
|
| 139 |
+
Visual Commonsense Reasoning (VCR) offers a highly demanding scenario that necessitates advanced reasoning abilities, heavily relying on common sense. Given the question(Q), the model’s task is not only to select the correct answer(A) but also to select a rationale(R) that explains why the chosen answer is true. We give a more detailed explanation of each metric in our appendix
|
| 140 |
+
|
| 141 |
+
Table 6: Accuracy scores on VCR. GPT4RoI achieves state-of-the-art accuracy among all methods.
|
| 142 |
+
|
| 143 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Open Source</td><td rowspan="2">Parameters</td><td colspan="3">Val Acc.(%)</td><td colspan="3">Test Acc.(%)</td></tr><tr><td>Q→A</td><td>QA→R</td><td>Q→AR</td><td>Q→A</td><td>QA→R</td><td>Q→AR</td></tr><tr><td>ViLBERT (Lu et al., 2019)</td><td></td><td>221M</td><td>72.4</td><td>74.5</td><td>54.0</td><td>73.3</td><td>74.6</td><td>54.8</td></tr><tr><td>Unicoder-VL (Li et al.,2019a)</td><td></td><td></td><td>72.6</td><td>74.5</td><td>54.5</td><td>73.4</td><td>74.4</td><td>54.9</td></tr><tr><td>VLBERT-L (Su et al.,2019)</td><td>YYYYYYYY</td><td>383M</td><td>75.5</td><td>77.9</td><td>58.9</td><td>75.8</td><td>78.4</td><td>59.7</td></tr><tr><td>UNITER-L(Chen et al.,2020)</td><td></td><td>303M</td><td>=</td><td></td><td></td><td>77.3</td><td>80.8</td><td>62.8</td></tr><tr><td>ERNIE-ViL-L (Yu et al., 2021)</td><td></td><td></td><td>78.52</td><td>83.37</td><td>65.81</td><td>79.2</td><td>83.5</td><td>66.3</td></tr><tr><td>MERLOT (Zellers et al., 2021)</td><td></td><td>223M</td><td>=</td><td>=</td><td>=</td><td>80.6</td><td>80.4</td><td>65.1</td></tr><tr><td>VILLA-L (Gan et al.,2020)</td><td></td><td></td><td>78.45</td><td>82.57</td><td>65.18</td><td>78.9</td><td>82.8</td><td>65.7</td></tr><tr><td>RESERVE-L (Zellers et al., 2022)</td><td>YY</td><td>644M</td><td>-</td><td>-</td><td>=</td><td>84.0</td><td>84.9</td><td>72.0</td></tr><tr><td>VQA-GNN-L (Wang et al., 2022)</td><td></td><td>1B+</td><td>-</td><td>-</td><td></td><td>85.2</td><td>86.6</td><td>74.0</td></tr><tr><td>GPT4RoI-7B</td><td>Y</td><td>7B+</td><td>87.4</td><td>89.6</td><td>78.6</td><td>-</td><td>-</td><td>-</td></tr><tr><td>VLUA+@ Kuaishou</td><td>N</td><td></td><td>/</td><td>-</td><td></td><td>84.8</td><td>87.0</td><td>74.0</td></tr><tr><td>KS-MGSR @KDDI Research and SNAP</td><td>N</td><td></td><td></td><td>=</td><td>=</td><td>85.3</td><td>86.9</td><td>74.3</td></tr><tr><td>SP-VCR @Shopee</td><td>N</td><td></td><td></td><td></td><td></td><td>83.6</td><td>88.6</td><td>74.4</td></tr><tr><td>HunYuan-VCR@Tencent</td><td>N</td><td></td><td></td><td></td><td></td><td>85.8</td><td>88.0</td><td>75.6</td></tr><tr><td>Human Performance (Zellers et al., 2019a)</td><td>-</td><td></td><td></td><td>=</td><td></td><td>91.0</td><td>93.0</td><td>85.0</td></tr><tr><td>GPT4RoI-13B</td><td>Y</td><td>13B+</td><td></td><td>=</td><td></td><td>89.4</td><td>91.0</td><td>81.6</td></tr></table>
|
| 144 |
+
|
| 145 |
+
GPT4RoI shows significant improvements over the previous methods across all $Q A$ , $Q A R$ , and $Q A R$ tasks. Notably, in the crucial $Q A R$ task, GPT4RoI-13B achieves a performance of 81.6 accuracy, surpassing preceding methods by over 6 points, even outperforming confidential company-level results, which may take advantage of private data. Our totally open-source pipeline can make GPT4RoI a solid baseline. More importantly, this performance is almost reaching human-level performance of 85.0 accuracy, which shows that the multimodal ability of GPT4RoI is promising to be further developed to human intelligence. Furthermore, comparing GPT4RoI to previous methods, particularly observing the size of the language model used, also demonstrates the significant benefits of the Large Language Model (LLM) for visual reasoning tasks.
|
| 146 |
+
|
| 147 |
+
# 6 CONCLUSIONS
|
| 148 |
+
|
| 149 |
+
In this paper, we present GPT4RoI, an end-to-end vision-language model that can execute user instructions to achieve region-level image understanding. Our approach employs spatial instruction tuning for the large language model (LLM), where we convert the reference to bounding boxes from user instructions into region features. These region features, along with language embeddings, are combined to create an input sequence for the large language model. By utilizing existing open-source region-text pair datasets, we show that GPT4RoI enhances user interaction by accurately referring to regions and achieves impressive performance in region-level image understanding tasks.
|
| 150 |
+
|
| 151 |
+
# REFERENCES
|
| 152 |
+
|
| 153 |
+
Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716– 23736, 2022. 3
|
| 154 |
+
|
| 155 |
+
Anonymous. Ins-detCLIP: Aligning detection model to follow human-language instruction. In Submitted to The Twelfth International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id ${ \bf \Phi } = { \bf \Phi }$ M0MF4t3hE9. under review. 18
|
| 156 |
+
Anthropic. Claude. https://www.anthropic.com/index/introducing-claude, 2023. 1
|
| 157 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. 3
|
| 158 |
+
Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. 3
|
| 159 |
+
Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pp. 213–229. Springer, 2020. 3
|
| 160 |
+
Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual $1 2 \mathrm { m }$ : Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3558–3568, 2021. 2
|
| 161 |
+
Chi Chen, Ruoyu Qin, Fuwen Luo, Xiaoyue Mi, Peng Li, Maosong Sun, and Yang Liu. Positionenhanced visual instruction tuning for multimodal large language models. arXiv preprint arXiv:2308.13437, 2023a. 18
|
| 162 |
+
Keqin Chen, Zhao Zhang, Weili Zeng, Richong Zhang, Feng Zhu, and Rui Zhao. Shikra: Unleashing multimodal llm’s referential dialogue magic. arXiv preprint arXiv:2306.15195, 2023b. 18
|
| 163 |
+
Ting Chen, Saurabh Saxena, Lala Li, David J Fleet, and Geoffrey Hinton. Pix2seq: A language modeling framework for object detection. arXiv preprint arXiv:2109.10852, 2021. 18
|
| 164 |
+
Ting Chen, Saurabh Saxena, Lala Li, Tsung-Yi Lin, David J Fleet, and Geoffrey E Hinton. A unified sequence interface for vision tasks. Advances in Neural Information Processing Systems, 35: 31333–31346, 2022. 18
|
| 165 |
+
Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015. 2
|
| 166 |
+
Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning, 2020. 9
|
| 167 |
+
Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality, March 2023. URL https: //lmsys.org/blog/2023-03-30-vicuna/. 1, 4
|
| 168 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. 3
|
| 169 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi
|
| 170 |
+
|
| 171 |
+
Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022. 3
|
| 172 |
+
|
| 173 |
+
Wenliang Dai, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, and Steven Hoi. Instructblip: Towards general-purpose vision-language models with instruction tuning, 2023. 2, 3
|
| 174 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. 3
|
| 175 |
+
Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. Palm-e: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023. 1
|
| 176 |
+
Zhengxiao Du, Yujie Qian, Xiao Liu, Ming Ding, Jiezhong Qiu, Zhilin Yang, and Jie Tang. Glm: General language model pretraining with autoregressive blank infilling. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 320–335, 2022. 1
|
| 177 |
+
Yuxin Fang, Quan Sun, Xinggang Wang, Tiejun Huang, Xinlong Wang, and Yue Cao. Eva-02: A visual representation for neon genesis. arXiv preprint arXiv:2303.11331, 2023. 6
|
| 178 |
+
Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning, 2020. 9
|
| 179 |
+
Rohit Girdhar, Alaaeldin El-Nouby, Zhuang Liu, Mannat Singh, Kalyan Vasudev Alwala, Armand Joulin, and Ishan Misra. Imagebind: One embedding space to bind them all. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15180–15190, 2023. 1
|
| 180 |
+
Tao Gong, Chengqi Lyu, Shilong Zhang, Yudong Wang, Miao Zheng, Qian Zhao, Kuikun Liu, Wenwei Zhang, Ping Luo, and Kai Chen. Multimodal-gpt: A vision and language model for dialogue with humans, 2023. 3
|
| 181 |
+
Google. Bard. https://bard.google.com/, 2023. 1
|
| 182 |
+
Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017. 2, 5
|
| 183 |
+
Ronghang Hu, Marcus Rohrbach, Jacob Andreas, Trevor Darrell, and Kate Saenko. Modeling relationships in referential expressions with compositional modular networks, 2016. 9
|
| 184 |
+
Shaohan Huang, Li Dong, Wenhui Wang, Yaru Hao, Saksham Singhal, Shuming Ma, Tengchao Lv, Lei Cui, Owais Khan Mohammed, Qiang Liu, et al. Language is not all you need: Aligning perception with language models. arXiv preprint arXiv:2302.14045, 2023. 1
|
| 185 |
+
Justin Johnson, Andrej Karpathy, and Li Fei-Fei. Densecap: Fully convolutional localization networks for dense captioning, 2015. 4
|
| 186 |
+
Aishwarya Kamath, Mannat Singh, Yann LeCun, Gabriel Synnaeve, Ishan Misra, and Nicolas Carion. Mdetr – modulated detection for end-to-end multi-modal understanding, 2021. 4
|
| 187 |
+
Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123:32–73, 2017. 2, 3, 6, 8, 9, 16
|
| 188 |
+
Feng Li, Hao Zhang, Huaizhe Xu, Shilong Liu, Lei Zhang, Lionel M Ni, and Heung-Yeung Shum. Mask dino: Towards a unified transformer-based framework for object detection and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3041–3050, 2023a. 18
|
| 189 |
+
Gen Li, Nan Duan, Yuejian Fang, Ming Gong, Daxin Jiang, and Ming Zhou. Unicoder-vl: A universal encoder for vision and language by cross-modal pre-training, 2019a. 9
|
| 190 |
+
KunChang Li, Yinan He, Yi Wang, Yizhuo Li, Wenhai Wang, Ping Luo, Yali Wang, Limin Wang, and Yu Qiao. Videochat: Chat-centric video understanding. arXiv preprint arXiv:2305.06355, 2023b. 3
|
| 191 |
+
Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language, 2019b. 4
|
| 192 |
+
Liunian Harold $\mathrm { L i ^ { * } }$ , Pengchuan Zhang\*, Haotian Zhang\*, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, Kai-Wei Chang, and Jianfeng Gao. Grounded language-image pre-training. In CVPR, 2022. 4
|
| 193 |
+
Yikang Li, Wanli Ouyang, Bolei Zhou, Kun Wang, and Xiaogang Wang. Scene graph generation from objects, phrases and region captions, 2017. 4
|
| 194 |
+
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision– ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pp. 740–755. Springer, 2014. 2, 5
|
| 195 |
+
Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2117–2125, 2017. 4
|
| 196 |
+
Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023a. 2, 3, 4, 5, 6
|
| 197 |
+
Rosanne Liu, Joel Lehman, Piero Molino, Felipe Petroski Such, Eric Frank, Alex Sergeev, and Jason Yosinski. An intriguing failing of convolutional neural networks and the coordconv solution, 2018a. 5
|
| 198 |
+
Shilong Liu, Zhaoyang Zeng, Tianhe Ren, Feng Li, Hao Zhang, Jie Yang, Chunyuan Li, Jianwei Yang, Hang Su, Jun Zhu, and Lei Zhang. Grounding dino: Marrying dino with grounded pre-training for open-set object detection, 2023b. 4
|
| 199 |
+
Shu Liu, Lu Qi, Haifang Qin, Jianping Shi, and Jiaya Jia. Path aggregation network for instance segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8759–8768, 2018b. 5
|
| 200 |
+
Yuan Liu, Haodong Duan, Yuanhan Zhang, Bo Li, Songyang Zhang, Wangbo Zhao, Yike Yuan, Jiaqi Wang, Conghui He, Ziwei Liu, et al. Mmbench: Is your multi-modal model an all-around player? arXiv preprint arXiv:2307.06281, 2023c. 3
|
| 201 |
+
Zhaoyang Liu, Yinan He, Wenhai Wang, Weiyun Wang, Yi Wang, Shoufa Chen, Qinglong Zhang, Yang Yang, Qingyun Li, Jiashuo Yu, et al. Internchat: Solving vision-centric tasks by interacting with chatbots beyond language. arXiv preprint arXiv:2305.05662, 2023d. 2, 3
|
| 202 |
+
Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks, 2019. 9
|
| 203 |
+
Jiasen Lu, Vedanuj Goswami, Marcus Rohrbach, Devi Parikh, and Stefan Lee. 12-in-1: Multi-task vision and language representation learning, 2020. 9
|
| 204 |
+
Junhua Mao, Jonathan Huang, Alexander Toshev, Oana Camburu, Alan L Yuille, and Kevin Murphy. Generation and comprehension of unambiguous object descriptions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 11–20, 2016. 2, 6
|
| 205 |
+
Yao Mu, Qinglong Zhang, Mengkang Hu, Wenhai Wang, Mingyu Ding, Jun Jin, Bin Wang, Jifeng Dai, Yu Qiao, and Ping Luo. Embodiedgpt: Vision-language pre-training via embodied chain of thought. arXiv preprint arXiv:2305.15021, 2023. 3
|
| 206 |
+
OpenAI. Chatgpt. https://openai.com/blog/chatgpt, 2022. 1, 3
|
| 207 |
+
OpenAI. Gpt-4 technical report, 2023. 1
|
| 208 |
+
|
| 209 |
+
Vicente Ordonez, Girish Kulkarni, and Tamara Berg. Im2text: Describing images using 1 million captioned photographs. Advances in neural information processing systems, 24, 2011. 2
|
| 210 |
+
|
| 211 |
+
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730–27744, 2022. 3
|
| 212 |
+
Renjie Pi, Jiahui Gao, Shizhe Diao, Rui Pan, Hanze Dong, Jipeng Zhang, Lewei Yao, Jianhua Han, Hang Xu, and Lingpeng Kong Tong Zhang. Detgpt: Detect what you need via reasoning. arXiv
|
| 213 |
+
preprint arXiv:2305.14167, 2023. 2
|
| 214 |
+
Bryan A Plummer, Liwei Wang, Chris M Cervantes, Juan C Caicedo, Julia Hockenmaier, and Svetlana Lazebnik. Flickr30k entities: Collecting region-to-phrase correspondences for richer image-to-sentence models. In Proceedings of the IEEE international conference on computer vision, pp. 2641–2649, 2015. 2, 6
|
| 215 |
+
Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. Improving language understanding by generative pre-training. OpenAI, 2018. 3
|
| 216 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748–8763. PMLR, 2021. 4
|
| 217 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551, 2020. 3
|
| 218 |
+
Hanoona Rasheed, Muhammad Maaz, Sahal Shaji, Abdelrahman Shaker, Salman Khan, Hisham Cholakkal, Rao M Anwer, Erix Xing, Ming-Hsuan Yang, and Fahad S Khan. Glamm: Pixel grounding large multimodal model. arXiv preprint arXiv:2311.03356, 2023. 18
|
| 219 |
+
Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28: 91–99, 2015. 3, 18
|
| 220 |
+
Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021. 2
|
| 221 |
+
Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 8429–8438, 2019. doi: 10.1109/ICCV. 2019.00852. 18
|
| 222 |
+
Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th
|
| 223 |
+
Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556–2565, 2018. 2
|
| 224 |
+
Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019. 4, 9
|
| 225 |
+
Tianxiang Sun and Qiu Xipeng. Moss. https://github.com/OpenLMLab/MOSS, 2022. 1
|
| 226 |
+
Dídac Surís, Sachit Menon, and Carl Vondrick. Vipergpt: Visual inference via python execution for
|
| 227 |
+
reasoning. arXiv preprint arXiv:2303.08128, 2023. 3
|
| 228 |
+
Kaihua Tang, Hanwang Zhang, Baoyuan Wu, Wenhan Luo, and Wei Liu. Learning to compose dynamic tree structures for visual contexts, 2018. 4
|
| 229 |
+
Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model.
|
| 230 |
+
|
| 231 |
+
https://github.com/tatsu-lab/stanford_alpaca, 2023. 1
|
| 232 |
+
|
| 233 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a. 1, 4
|
| 234 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023b. 1
|
| 235 |
+
Teng Wang, Jinrui Zhang, Junjie Fei, Yixiao Ge, Hao Zheng, Yunlong Tang, Zhe Li, Mingqi Gao, Shanshan Zhao, Ying Shan, et al. Caption anything: Interactive image description with diverse multimodal controls. arXiv preprint arXiv:2305.02677, 2023a. 2
|
| 236 |
+
Wenhai Wang, Zhe Chen, Xiaokang Chen, Jiannan Wu, Xizhou Zhu, Gang Zeng, Ping Luo, Tong Lu, Jie Zhou, Yu Qiao, et al. Visionllm: Large language model is also an open-ended decoder for vision-centric tasks. arXiv preprint arXiv:2305.11175, 2023b. 2
|
| 237 |
+
Xinlong Wang, Tao Kong, Chunhua Shen, Yuning Jiang, and Lei Li. Solo: Segmenting objects by locations. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XVIII 16, pp. 649–665. Springer, 2020. 5
|
| 238 |
+
Yanan Wang, Michihiro Yasunaga, Hongyu Ren, Shinya Wada, and Jure Leskovec. Vqa-gnn: Reasoning with multimodal semantic graph for visual question answering, 2022. 9
|
| 239 |
+
Chenfei Wu, Shengming Yin, Weizhen Qi, Xiaodong Wang, Zecheng Tang, and Nan Duan. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023. 2, 3
|
| 240 |
+
Jialian Wu, Jianfeng Wang, Zhengyuan Yang, Zhe Gan, Zicheng Liu, Junsong Yuan, and Lijuan Wang. Grit: A generative region-to-text transformer for object understanding, 2022. 4, 8
|
| 241 |
+
Peng Xu, Wenqi Shao, Kaipeng Zhang, Peng Gao, Shuo Liu, Meng Lei, Fanqing Meng, Siyuan Huang, Yu Qiao, and Ping Luo. Lvlm-ehub: A comprehensive evaluation benchmark for large vision-language models, 2023. 3
|
| 242 |
+
Jiange Yang, Wenhui Tan, Chuhao Jin, Bei Liu, Jianlong Fu, Ruihua Song, and Limin Wang. Pave the way to grasp anything: Transferring foundation models for universal pick-place robots. arXiv preprint arXiv:2306.05716, 2023a. 3
|
| 243 |
+
Jingkang Yang, Yi Zhe Ang, Zujin Guo, Kaiyang Zhou, Wayne Zhang, and Ziwei Liu. Panoptic scene graph generation, 2022. 4
|
| 244 |
+
Linjie Yang, Kevin Tang, Jianchao Yang, and Li-Jia Li. Dense captioning with joint inference and visual context. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Jul 2017. 4
|
| 245 |
+
Zhengyuan Yang, Linjie Li, Kevin Lin, Jianfeng Wang, Chung-Ching Lin, Zicheng Liu, and Lijuan Wang. The dawn of lmms: Preliminary explorations with gpt-4v (ision). arXiv preprint arXiv:2309.17421, 9, 2023b. 18
|
| 246 |
+
Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023c. 1, 2, 3
|
| 247 |
+
Yuan Yao, Qianyu Chen, Ao Zhang, Wei Ji, Zhiyuan Liu, Tat-Seng Chua, and Maosong Sun. Pevl: Position-enhanced pre-training and prompt tuning for vision-language models. arXiv preprint arXiv:2205.11169, 2022. 4
|
| 248 |
+
Haoxuan You, Haotian Zhang, Zhe Gan, Xianzhi Du, Bowen Zhang, Zirui Wang, Liangliang Cao, Shih-Fu Chang, and Yinfei Yang. Ferret: Refer and ground anything anywhere at any granularity. arXiv preprint arXiv:2310.07704, 2023. 18
|
| 249 |
+
Fei Yu, Jiji Tang, Weichong Yin, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-vil: Knowledge enhanced vision-language representations through scene graph, 2021. 4, 9
|
| 250 |
+
Licheng Yu, Patrick Poirson, Shan Yang, Alexander C Berg, and Tamara L Berg. Modeling context in referring expressions. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part II 14, pp. 69–85. Springer, 2016. 2, 5
|
| 251 |
+
Yuhang Zang, Wei Li, Jun Han, Kaiyang Zhou, and Chen Change Loy. Contextual object detection with multimodal large language models, 2023. 3
|
| 252 |
+
Rowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6720–6731, 2019a. 2, 3, 6, 8, 9, 16
|
| 253 |
+
Rowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019b. 4, 17
|
| 254 |
+
Rowan Zellers, Ximing Lu, Jack Hessel, Youngjae Yu, Jae Sung Park, Jize Cao, Ali Farhadi, and Yejin Choi. Merlot: Multimodal neural script knowledge models. In Advances in Neural Information Processing Systems 34, 2021. 9
|
| 255 |
+
Rowan Zellers, Jiasen Lu, Ximing Lu, Youngjae Yu, Yanpeng Zhao, Mohammadreza Salehi, Aditya Kusupati, Jack Hessel, Ali Farhadi, and Yejin Choi. Merlot reserve: Multimodal neural script knowledge through vision and language and sound. In CVPR, 2022. 9
|
| 256 |
+
Ao Zhang, Hao Fei, Yuan Yao, Wei Ji, Li Li, Zhiyuan Liu, and Tat-Seng Chua. Transfer visual prompt generator across llms. arXiv preprint arXiv:2305.01278, 2023a. 3
|
| 257 |
+
Ao Zhang, Liming Zhao, Chen-Wei Xie, Yun Zheng, Wei Ji, and Tat-Seng Chua. Next-chat: An lmm for chat, detection and segmentation. arXiv preprint arXiv:2311.04498, 2023b. 18
|
| 258 |
+
Hao Zhang, Feng Li, Shilong Liu, Lei Zhang, Hang Su, Jun Zhu, Lionel M Ni, and Heung-Yeung Shum. Dino: Detr with improved denoising anchor boxes for end-to-end object detection. arXiv preprint arXiv:2203.03605, 2022. 18
|
| 259 |
+
Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023c. 2, 3
|
| 260 |
+
Shilong Zhang, Xinjiang Wang, Jiaqi Wang, Jiangmiao Pang, Chengqi Lyu, Wenwei Zhang, Ping Luo, and Kai Chen. Dense distinct query for end-to-end object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7329–7338, June 2023d. 5, 18
|
| 261 |
+
Liang Zhao, En Yu, Zheng Ge, Jinrong Yang, Haoran Wei, Hongyu Zhou, Jianjian Sun, Yuang Peng, Runpei Dong, Chunrui Han, et al. Chatspot: Bootstrapping multimodal llms via precise referring instruction tuning. arXiv preprint arXiv:2307.09474, 2023. 18
|
| 262 |
+
Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric. P Xing, Hao Zhang, Joseph E. Gonzalez, and Ion Stoica. Judging llm-as-a-judge with mt-bench and chatbot arena, 2023. 4
|
| 263 |
+
Xingyi Zhou, Rohit Girdhar, Armand Joulin, Philipp Krähenbühl, and Ishan Misra. Detecting twenty-thousand classes using image-level supervision. In ECCV, 2022. 4
|
| 264 |
+
Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023. 2, 3, 4, 5
|
| 265 |
+
Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020. 2, 3
|
| 266 |
+
Yuke Zhu, Oliver Groth, Michael Bernstein, and Li Fei-Fei. Visual7w: Grounded question answering in images, 2016. 3, 8, 9, 16
|
| 267 |
+
|
| 268 |
+
# A APPENDIX
|
| 269 |
+
|
| 270 |
+
In this appendix, we provide a detailed method architecture figure. We then discuss training-related details, including hyperparameters and instruction templates used in each stage and task. Specifically, we give an introduction for VCR dataset and describe how we utilize the VCR dataset. We also compare the design philosophy with methods using textual coordinates in LLM and provide a brief overview of concurrent works . Finally, we analyze some error cases and propose potential improvements for future exploration.
|
| 271 |
+
|
| 272 |
+
# A.1 DETAILED ARCHITECTURE
|
| 273 |
+
|
| 274 |
+

|
| 275 |
+
Figure 5: A more detailed framework of GPT4RoI.
|
| 276 |
+
|
| 277 |
+
Here is a more detailed framework of our approach, GPT4RoI.
|
| 278 |
+
|
| 279 |
+
1. We preprocess the input text by adding prefixes to retain both image information and pure text references for each region.
|
| 280 |
+
2. Next, we tokenize and embed the text. The image feature and region features will replace the placeholders <image> and ${ < r e g i o n \mathord { \left/ { \vphantom { < r e g i o n \left/ { i } \right.} \kern - delimiterspace } \right.} \kern - delimiterspace } >$ respectively.
|
| 281 |
+
3. The resulting interleaved sequence of region $\&$ image features and language embeddings is then fed into a large language model (LLM) for further processing.
|
| 282 |
+
|
| 283 |
+
# A.2 TRAINING DETAILS
|
| 284 |
+
|
| 285 |
+
Dialogue model The dialogue model in the demo is trained on 8 GPUs, each with 80G of memory. During the first training stage, a learning rate of 2e-5 is used with a cosine learning schedule. The batch size is 16 for 2 epochs, with a warm-up iteration set to 3000 and a warm-up ratio of 0.003. The weight decay for all modules was set to 0. During the second training stage, the learning rate is reduced to 2e-5 and the model is trained for 1 epoch. To enable end-to-end fine-tuning of the model, which includes a 7B Vicuna, Fully Sharded Data Parallel (FSDP) is enabled in PyTorch to save memory.
|
| 286 |
+
|
| 287 |
+
Downstream tasks We finetune on three datasets with different learning schedules and task prompts (as shown in Table 7). For the region caption task on Visual Genome (Krishna et al., 2017), we perform fine-tuning for 4 epochs with a learning rate of 2e-5. As for Visual-7W (Zhu et al., 2016), we observe that it requires a smaller learning rate of 1e-6 to stabilize the training, which is also trained in 2 epochs. On the Visual Commonsense Reasoning (Zellers et al., 2019a), we fine-tune the model for 1 epoch using a learning rate of 2e-5.
|
| 288 |
+
|
| 289 |
+
Instruction of three downstream tasks. The instructions for three downstream tasks are provided in Table 7.
|
| 290 |
+
|
| 291 |
+
# Region Caption Task on Visual Genome
|
| 292 |
+
|
| 293 |
+
### Question: Can you give a description of the region mentioned by <region> ### Answer: A man wearing a light blue t-shirt and jeans with his arms extended
|
| 294 |
+
|
| 295 |
+
# Region Reasoning Task on Visual-7W
|
| 296 |
+
|
| 297 |
+
### Question: <region1>,<region2>,<region3>,<region4> refers to specific areas within the photo along with their respective identifiers. I need you to answer the question. Questions are multiplechoice; you only need to pick the correct answer from the given options (A), (B), (C), or (D). Which is the black machine under the sign?
|
| 298 |
+
|
| 299 |
+
### Answer: (A)
|
| 300 |
+
|
| 301 |
+
# Region Reasoning Task on VCR
|
| 302 |
+
|
| 303 |
+
$\mathbf Q \to \mathbf A$
|
| 304 |
+
|
| 305 |
+
### Question: <region1>,<region2>,<region3>... refers to specific areas within the photo along with their respective identifiers. I need you to answer the question. Questions are multiple-choice; you only need to pick the correct answer from the given options (A), (B), (C), or (D).
|
| 306 |
+
|
| 307 |
+
How is 1 feeling ? (A),1 is feeling amused . (B),1 is upset and disgusted . (C),1 is feeling very scared . (D),1 is feeling uncomfortable with 3
|
| 308 |
+
|
| 309 |
+
### Answer: (C)
|
| 310 |
+
|
| 311 |
+
$\mathbf { Q A } \to \mathbf { R }$
|
| 312 |
+
|
| 313 |
+
### Question: <region1>,<region2>,<region $3 > .$ ... refers to specific areas within the photo along with their respective identifiers. I give you a question and its answer, I need you to provide a rationale explaining why the answer is right. Both questions are multiple-choice; you only need to pick the correct answer from the given options (A), (B), (C), or (D).
|
| 314 |
+
|
| 315 |
+
"How is 1 feeling ?" The answer is "1 is feeling very scared." What’s the rationale for this decision? (A),1’s face has wide eyes and an open mouth .
|
| 316 |
+
(B),When people have their mouth back like that and their eyebrows lowered they are usually disgusted by what they see .
|
| 317 |
+
(C),3,2,1 are seated at a dining table where food would be served to them . people unaccustomed to odd or foreign dishes may make disgusted looks at the thought of eating it .
|
| 318 |
+
(D),1’s expression is twisted in disgust .
|
| 319 |
+
|
| 320 |
+
### Answer: (A)
|
| 321 |
+
|
| 322 |
+
Table 7: Task prompt of three downstream tasks.
|
| 323 |
+
|
| 324 |
+
Instruction of Single-Region Caption The instructions for single-region caption are provided in Table 8. We randomly select one as the question in training.
|
| 325 |
+
|
| 326 |
+
Instruction of Multi-Region Caption The instructions for multi-region caption are provided in Table 9. We randomly select one as the question in training.
|
| 327 |
+
|
| 328 |
+
# A.3 VCR
|
| 329 |
+
|
| 330 |
+
Introduction to the VCR Dataset The Visual Commonsense Reasoning(VCR) dataset (Zellers et al., 2019b), comprises 290,000 multiple-choice questions obtained from 110,000 movie scenes. Each image in the dataset is annotated with a question that requires common-sense reasoning, along with its corresponding answer and the explanation for the answer. VCR is a particularly challenging dataset for comprehension and reasoning. It has gained attention from several wellknown organizations, who have submitted their solutions on the leaderboard. The dataset’s distinctive challenge is that a model not only needs to answer complex visual questions but also provide a rationale for why its answer is correct. The VCR task consists of two sub-tasks: Question Answering $\mathrm { ( Q \to A ) }$ ) and Answer Justification (QA R). In the Q→A setup, a model is given a question and must select the correct answer from four choices. In the QA- ${ \mathrm { . > R } }$ setup, a model is provided with a question and the correct answer, and it needs to justify the answer by selecting the most appropriate rationale from four choices. The performance of models is evaluated using the $\mathrm { Q } \to \mathrm { A R }$ metric, where accuracy is measured as the percentage of correctly answered questions along with the correct rationale.
|
| 331 |
+
|
| 332 |
+
Preprocess of VCR To construct a sequence of questions, we convert the explanation to a follow-up question and format them into a two-round conversation. Table 10 shows an example of the follow-up question that asks for the reasoning behind the answer.
|
| 333 |
+
|
| 334 |
+
The VCR dataset is valued for its diverse question-answer pairs that require referencing from prior question-answers to perform reasoning. Therefore, it’s crucial to assign a reference to each region in the dataset. We accomplish this by starting each conversation with a reference to all regions, e.g., There are <region1 $>$ , <region $2 >$ ... in the image. This approach explicitly references every region, avoiding confusion in future analyses. Additionally, we substitute the corresponding <region $\mathbf { \Phi } _ { i } \mathbf { \Phi } _ { > }$ in the answer with category_name at region{i} to ensure a plain text output sequence.
|
| 335 |
+
|
| 336 |
+
# A.4 TEXTUAL COORDINATES AS THE GROUNDING TOKEN
|
| 337 |
+
|
| 338 |
+
The key distinction lies in whether to incorporate the detection function into the LLM. For the method that uses textual coordinates as the grounding token, they have to solve the following challenge:
|
| 339 |
+
|
| 340 |
+
Aligning a large number of position tokens with their corresponding positions in the image by training on a large set of datasets. But this is actually a simple rule that can be naturally implemented with the operation in detection architectures.
|
| 341 |
+
|
| 342 |
+
Modeling geometric properties can be challenging. For example, if the ground truth box is $< x _ { 1 } =$ $0 , y _ { 1 } = 0 , x _ { 2 } = 5 , y _ { 2 } = 5 >$ , a predicted box of $< x _ { 1 } = 1 , y _ { 1 } = 1 , x _ { 2 } = 4 , y _ { 2 } = 4 >$ would be considered a better result than $< x _ { 1 } = 1 , y _ { 1 } = 1 , x _ { 2 } = 8 , y _ { 2 } = 8 >$ . because it has a higher overlap with the ground truth. However, incorporating this geometric property into the next token prediction task using cross-entropy loss can be challenging. On the other hand, utilizing traditional loss functions such as L1 or IoU loss can naturally handle this geometric constraint.
|
| 343 |
+
|
| 344 |
+
Dense to Sparse (Ren et al., 2015; Zhang et al., 2023d) is a crucial design for detection performance, but embedding such an idea into the sequential form of LLM is challenging. We provide two pieces of evidence to support our argument
|
| 345 |
+
|
| 346 |
+
1. The performance of pix2seq (Chen et al., 2021; 2022), which utilizes object365 (Shao et al., 2019) pretrain, falls significantly behind the corresponding specialist (Zhang et al., 2022; Li et al., 2023a).
|
| 347 |
+
|
| 348 |
+
2. Even with scaled-up data and parameters, GPT4V still faces challenges in object counting (Yang et al., 2023b). However, this is a trivial task for detection methods.
|
| 349 |
+
|
| 350 |
+
Another approach is to use an external detector to find the potential region of interest, whereas LLM only focuses on analyzing the corresponding region of interest. This is the motivation of GPT4RoI. It requires much less data and allows for quick adaptation to specific domain problems with the corresponding detector. However, the drawback is that the framework may appear less elegant and it assumes input contains all regions of interest that need to be analyzed.
|
| 351 |
+
|
| 352 |
+
Both approaches have their advantages and disadvantages, and academic research in both directions is thriving (including concurrent works or follow-ups on GPT4RoI). For the first approach, relevant references include (Zhao et al., 2023; Chen et al., 2023b), while for the second approach, there are (Anonymous, 2023; Chen et al., 2023a) besides GPT4RoI. Additionally, there has been research that explores a fusion of the two approaches, as shown in references (You et al., 2023; Rasheed et al., 2023; Zhang et al., 2023b).
|
| 353 |
+
|
| 354 |
+
# A.5 FAILURE CASE ANALYSIS
|
| 355 |
+
|
| 356 |
+
Due to limited data and instructions, GPT4RoI may fail in several landmark scenarios. We have conducted a thorough analysis and look forward to improving these limitations in future versions.
|
| 357 |
+
|
| 358 |
+
Instruction obfuscation As shown in Figure 6.(a), our multiple-region reasoning capability mainly relies on VCR, where we often use sentences that declare <region1>, <region2>, etc. at the beginning of the question. However, when users adopt the less common sentence structure to refer to regions, it can often be confused with region captions that have the highest proportion in the dataset. As shown in Figure 6.(b), because our data and instructions are mainly generated by rules, our training data does not include content with the "respectively" instruction in multi-region scenarios. This can be resolved by adding specific instructions. In future versions, we aim to develop more diverse instructions, while ensuring data balance.
|
| 359 |
+
|
| 360 |
+

|
| 361 |
+
Figure 6: GPT4RoI on instruction obfuscation.
|
| 362 |
+
|
| 363 |
+
Misidentification of fine-grained information within in region Although GPT4RoI has improved the fine-grained perception ability of images compared to image-level vision language models, the limited amount of region-level data results in insufficient fine-grained alignment within regions. For example, in Figure 7.(a), the model incorrectly identifies the color of the helmet, and in Figure 7.(b), it misidentifies the object in the girl’s hand. Both cases generate the corresponding answers based on the most prominent feature within the region. Using semi-supervised methods to create more region-level data may address this issue.
|
| 364 |
+
|
| 365 |
+

|
| 366 |
+
Figure 7: GPT4RoI on Misidentification of fine-grained information.
|
| 367 |
+
|
| 368 |
+
# A.6 DISCUSSION
|
| 369 |
+
|
| 370 |
+
In our exploration, we find GPT4RoI produces failure cases as shown in Section. A.5. To further improve the performance, we identify the following potential directions:
|
| 371 |
+
|
| 372 |
+
• Model architecture. We find that $2 2 4 \times 2 2 4$ input image resolution struggles with understanding smaller regions. However, if we switch to a larger resolution, we must consider the potential burden on inference speed from global attention ViT architecture, while the more efficient CNN architecture or sliding window attention has no available pre-trained large-scale vision encoder like CLIP ViT-H/14. • More region-text pair data. The amount of available region-text pairs is notably smaller than that of image-text pairs, which makes it challenging to sufficiently align region-level features with language models. To tackle this issue, we may try to generate region-level pseudo labels by leveraging off-the-shelf detectors to generate bounding boxes for image-text data.
|
| 373 |
+
|
| 374 |
+
• Region-level instructions. Although we have generated instructions for each task from existing open-source datasets, users in practical applications may ask various questions about an arbitrary number of regions, and the existing data may not contain satisfactory answers. To tackle this issue, we suggest generating a new batch of spatial instructions through manual labeling or by leveraging ChatGPT or GPT4.
|
| 375 |
+
• Interaction mode. Currently, GPT4RoI only supports natural language and bounding box interaction. Incorporating more open-ended interaction modes such as point, scribble, or image-based search could further improve the user interaction experience. 1. Can you provide me with a detailed description of the region in the picture marked by <region1>? 2. I’m curious about the region represented by <region1 $>$ in the picture. Could you describe it in detail?
|
| 376 |
+
3. What can you tell me about the region indicated by <region1 $>$ in the image?
|
| 377 |
+
4. I’d like to know more about the area in the photo labeled <region1>. Can you give me a detailed description?
|
| 378 |
+
5. Could you describe the region shown as <region1 $>$ in the picture in great detail?
|
| 379 |
+
6. What details can you give me about the region outlined by <region $1 >$ in the photo?
|
| 380 |
+
7. Please provide me with a comprehensive description of the region marked with <region1 $>$ in the image.
|
| 381 |
+
8. Can you give me a detailed account of the region labeled as <region1 $>$ in the picture?
|
| 382 |
+
9. I’m interested in learning more about the region represented by <region1 $>$ in the photo. Can you describe it in detail?
|
| 383 |
+
10. What is the region outlined by <region1 $>$ in the picture like? Could you give me a detailed description, please?
|
| 384 |
+
11. Can you provide me with a detailed description of the region in the picture marked by <region1>, please?
|
| 385 |
+
12. I’m curious about the region represented by <region1> in the picture. Could you describe it in detail, please?
|
| 386 |
+
13. What can you tell me about the region indicated by <region1> in the image, exactly?
|
| 387 |
+
14. I’d like to know more about the area in the photo labeled <region1>, please. Can you give me a detailed description?
|
| 388 |
+
15. Could you describe the region shown as <region1 $>$ in the picture in great detail, please? 16. What details can you give me about the region outlined by <region $^ { 1 > }$ in the photo, please? 17. Please provide me with a comprehensive description of the region marked with <region1 $>$ in the image, please.
|
| 389 |
+
18. Can you give me a detailed account of the region labeled as <region1 $>$ in the picture, please? 19. I’m interested in learning more about the region represented by <region1 $>$ in the photo. Can you describe it in detail, please?
|
| 390 |
+
20. What is the region outlined by <region1 $>$ in the picture like, please? Could you give me a detailed description? 1. Could you please give me a detailed description of these areas [<region1>, <region2>, ...]? 2. Can you provide a thorough description of the regions [<region1>, <region2>, ...] in this image? 3. Please describe in detail the contents of the boxed areas [<region1>, <region2>, ...].
|
| 391 |
+
4. Could you give a comprehensive explanation of what can be found within [<region1>, <region2>, ...] in the picture?
|
| 392 |
+
5. Could you give me an elaborate explanation of the [<region1>, <region2>, ...] regions in this picture?
|
| 393 |
+
6. Can you provide a comprehensive description of the areas identified by [<region1>, <region2>, ...] in this photo?
|
| 394 |
+
7. Help me understand the specific locations labeled [<region1>, <region2>, ...] in this picture in detail, please.
|
| 395 |
+
8. What is the detailed information about the areas marked by [<region1>, <region2>, ...] in this image?
|
| 396 |
+
9. Could you provide me with a detailed analysis of the regions designated [<region1>, <region2>, ...] in this photo?
|
| 397 |
+
10. What are the specific features of the areas marked [<region1>, <region2>, ...] in this picture that you can describe in detail?
|
| 398 |
+
11. Could you elaborate on the regions identified by [<region1>, <region2>, ...] in this image? 12. What can you tell me about the areas labeled [<region1>, <region2>, ...] in this picture? 13. Can you provide a thorough analysis of the specific locations designated [<region1>, <region2>, ...] in this photo?
|
| 399 |
+
14. I am interested in learning more about the regions marked [<region1>, <region2>, ...] in this image. Can you provide me with more information?
|
| 400 |
+
15. Could you please provide a detailed description of the areas identified by [<region1>, <region2>, ...] in this photo?
|
| 401 |
+
16. What is the significance of the regions labeled [<region1>, <region2>, ...] in this picture? 17. I would like to know more about the specific locations designated [<region1>, <region2>, ...] in this image. Can you provide me with more information?
|
| 402 |
+
18. Can you provide a detailed breakdown of the regions marked [<region1>, <region2>, ...] in this photo?
|
| 403 |
+
19. What specific features can you tell me about the areas identified by [<region1>, <region2>, ...] in this picture?
|
| 404 |
+
20. Could you please provide a comprehensive explanation of the locations labeled [<region1>, <region2>, ...] in this image?
|
| 405 |
+
|
| 406 |
+
1. Why?
|
| 407 |
+
2. What’s the rationale for your decision
|
| 408 |
+
3. What led you to that conclusion?
|
| 409 |
+
4. What’s the reasoning behind your opinion?
|
| 410 |
+
5. Can you explain the basis for your thinking?
|
| 411 |
+
6. What factors influenced your perspective?
|
| 412 |
+
7. How did you arrive at that perspective?
|
| 413 |
+
8. What evidence supports your viewpoint?
|
| 414 |
+
9. What’s the logic behind your argument?
|
| 415 |
+
10. Can you provide some context for your opinion?
|
| 416 |
+
11. What’s the basis for your assertion?
|
| 417 |
+
12. What experiences have shaped your perspective?
|
| 418 |
+
13. What assumptions underlie your reasoning?
|
| 419 |
+
14. What’s the foundation of your assertion?
|
| 420 |
+
15. What’s the source of your reasoning?
|
| 421 |
+
16. What’s the motivation behind your decision?
|
| 422 |
+
17. What’s the impetus for your belief?
|
| 423 |
+
18. What’s the driving force behind your conclusion?
|
| 424 |
+
19. What’s your reasoning?
|
| 425 |
+
20. What makes you say that?
|
| 426 |
+
21. What’s the story behind that?
|
| 427 |
+
22. What’s your thought process?
|
| 428 |
+
23. What’s the deal with that?
|
| 429 |
+
24. What’s the logic behind it?
|
| 430 |
+
25. What’s the real deal here?
|
| 431 |
+
26. What’s the reason behind it?
|
| 432 |
+
27. What’s the rationale for your opinion?
|
| 433 |
+
28. What’s the background to that?
|
| 434 |
+
29. What’s the evidence that supports your view?
|
| 435 |
+
30. What’s the explanation for that?
|
md/test/FAO4VS9QRV/FAO4VS9QRV.md
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DELTA-LORA: FINE-TUNING HIGH-RANK PARAMETERS WITH THE DELTA OF LOW-RANK MATRICES
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
In this paper, we present Delta-LoRA, which is a novel parameter-efficient approach to fine-tune large language models (LLMs). In contrast to LoRA and other low-rank adaptation methods such as AdaLoRA, Delta-LoRA not only updates the low-rank matrices $\pmb { A }$ and $\textbf { { B } }$ , but also propagate the learning to the pre-trained weights $W$ via updates utilizing the delta of the product of two low-rank matrices $( \boldsymbol { A } ^ { ( \bar { t } + 1 ) } \boldsymbol { B } ^ { ( t + 1 ) } - \boldsymbol { A } ^ { ( t ) } \boldsymbol { B } ^ { ( t ) } )$ . Such a strategy effectively addresses the limitation that the incremental update of low-rank matrices is inadequate for learning representations capable for downstream tasks. Moreover, as the update of $W$ does not need to compute the gradients of $W$ and store their momentums, Delta-LoRA shares comparable memory requirements and computational costs with LoRA. Extensive experiments show that Delta-LoRA significantly outperforms existing low-rank adaptation methods. We further support these results with comprehensive analyses that underscore the effectiveness of Delta-LoRA.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Large Language Models (LLMs) recently have attracted considerable attention due to their remarkable performance across a broad spectrum of downstream tasks. Diverging from conventional Transformers characterized by a scale of millions of parameters, modern LLMs typically scale up to billions of parameters, endowing them with notable advantages such as emergent capabilities and robust generalization as detailed in (Bubeck et al., 2023). Fine-tuning such highly capable LLMs on downstream tasks (Raffel et al., 2020; Devlin et al., 2019; Radford et al., 2019; He et al., 2021; Liu et al., 2019; Brown et al., 2020) has consequently become a mainstream paradigm to reduce the training time required for individual tasks, yet with superior performance compared with other methods (Lester et al., 2021; Li & Liang, 2021; Houlsby et al., 2019).
|
| 12 |
+
|
| 13 |
+
However, fine-tuning a LLM with all the learnable parameters (Full Fine-tuning) requires multiple GPUs with high memory demand (Dettmers et al., 2023; Hu et al., 2022), which is unattainable for many companies and research institutions. Full fine-tuning poses exceptional challenges to researchers: with massive parameter size, LLMs already demand more storage space than regular models; Further training exaggerates the GPU memory requirement because common optimizers such as AdamW (Loshchilov & Hutter, 2019) often maintain several copies of the model parameters, which is 2-3 times of memory overhead.
|
| 14 |
+
|
| 15 |
+
To this end, a series of methods have been proposed (Valipour et al., 2023; Zhang et al., 2022; Li & Liang, 2021; Liu et al., 2022a; Lv et al., 2023; Dettmers et al., 2023; Liu et al., 2022b; Zaken et al., 2021; Pfeiffer et al., 2021; Guo et al., 2021; Zhou et al., 2023; Zhang et al., 2023; Houlsby et al., 2019; Wang et al., 2022) to reduce memory overhead at the training stage. Some even accelerate the fine-tuning process with only less than $1 \%$ trainable parameters. Among these methods, LoRA (Hu et al., 2022) is the most attractive for its stable performance on broad downstream tasks (Ding et al., 2023), no observed overfitting, as well as no extra memory and computation cost at inference.
|
| 16 |
+
|
| 17 |
+
While LoRA and its successors (Zhang et al., 2022; Valipour et al., 2023) have indeed exhibited superior performance in comparison to alternative approaches within the realm of Parameter Efficient Fine-Tuning (PEFT), a substantial performance gap persists when compared to the full fine-tuning, as highlighted in most scenarios (Ding et al., 2023). This discrepancy is attributed to the inherent limitation of updating only a fraction of the model’s parameters, rendering it inadequate to fit the intricacies presented in the training data.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: An overview of the proposed Delta-LoRA structure, compared to LoRA, DyLoRA and AdaLoRA. Note that DyLoRA and LoRA basically share the same architecture. W is the pre-trained weight which is frozen (signified by blue) when performing efficient-parameter fine-tuning in (a) and (b). Orange trapezoids $\pmb { A }$ , $\textbf { { B } }$ and $\pmb { \cal E }$ denote the trainable parameters. In our proposed Delta-LoRA, the light orange rectangle means that pre-trained weights can be updated via the delta. Note that our proposed Delta-LoRA removes the Dropout layer to ensure reasonable delta for pre-trained matrix.
|
| 21 |
+
|
| 22 |
+
To bridge this gap, a reasonable strategy is to introduce more parameters into the optimization process. In this paper, we introduce Delta-LoRA as shown in Fig. 1, a novel PEFT approach that simultaneously updates the pre-trained matrix and two low-rank matrices while maintaining the same memory consumption as the original LoRA. Specifically, the pre-trained matrix $W$ is updated with the delta of the product of two low-rank matrices in two consecutive iterations $\triangle A B =$ $A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - A ^ { ( t ) } \bar { B } ^ { ( t ) } )$ , while two low-rank matrices are updated by the AdamW optimizer automatically. This is based on the mathematical property that $\begin{array} { r } { \frac { \partial \mathcal { L } ^ { \star } } { \partial W } = \frac { \partial \mathcal { L } } { \partial A B } . } \end{array}$ and $\triangle A B$ is a surrogate to direct the update of $W$ (see Sec. 4 for details). Since we neither store the gradient of $W$ nor use the optimizer to update the pre-trained matrix, the proposed method thus does not yield any extra memory overhead. This strategic integration effectively mitigates the sub-optimal representation learning stemming from only updating the two low-rank matrices. Moreover, our approach aligns the update direction of the pre-trained weights with that of the incremental update matrix. Furthermore, we discard the Dropout layer in low-rank branches to obtain a more reasonable delta for $W$ , in order to ensure $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial W } . = \frac { \partial \check { \mathcal { L } } } { \partial A B } } \end{array}$ . The advantages of our proposed method are conspicuous: including the pre-trained weights in the optimization process engenders a broader integration of parameters, thereby enhancing the potential for learning intricate representations.
|
| 23 |
+
|
| 24 |
+
The main contributions of this paper can be summarized as:
|
| 25 |
+
|
| 26 |
+
• We introduce Delta-LoRA, a novel PEFT method that simultaneously updates the full weight matrix and two low-rank matrices. Delta-LoRA leverages the delta of the product of $\pmb { A }$ and $\textbf { { B } }$ to update the pre-trained weights and thus prevent storing the first and the second-order momentums in the optimizer.
|
| 27 |
+
• We analyze thbranch makes $\begin{array} { r } { \frac { \partial \Xi } { \partial W } \neq \frac { \partial \mathcal { L } } { \partial A B } } \end{array}$ ow of Delta-LoRA and show that the Dropout layer in the low-rank. Thus, we remove the Dropout layer in our proposed Delta-LoRA to get reasonable delta for $W$ .
|
| 28 |
+
• We conduct comprehensive experiments to show that Delta-LoRA has consistent gains on a broad range of NLP tasks. Additionally, we provide thorough explanations to analyze its superiority and the value contributed by each component.
|
| 29 |
+
|
| 30 |
+
# 2 PRELIMINARIES
|
| 31 |
+
|
| 32 |
+
Transformer-based Models. Transformer (Vaswani et al., 2017) adopts the self-attention mechanism instead of recurrence and convolutions, achieving new state-of-the-art in machine translation. Dosovitskiy et al. (2021) later proposed the Vision-Transformer (ViT) architecture which exhibits versatility across various computer vision tasks. Nowadays, the Transformer-based models have become the most popular choice in both NLP and Computer Vision (Li et al., 2021; Carion et al., 2020; Zheng et al., 2021). Transformer typically consists of $L$ stacked blocks, each containing a multi-head attention (MHA) module and a feed-forward network (FFN) module. For an input sequence $\ b { X } \in \mathbb { R } ^ { n \times d }$ , the MHA module yields the output $\operatorname { M H A } ( X )$ , given by:
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
\begin{array} { r } { \mathrm { h e a d } _ { i } = \mathrm { s o f t m a x } ( \frac { X W _ { Q _ { i } } ( X W _ { K _ { i } } ) ^ { \top } } { \sqrt { d _ { k } } } ) X W _ { V _ { i } } } \\ { \mathrm { M H A } ( X ) = \mathrm { c o n c a t } ( \mathrm { h e a d } _ { 1 } , . . . , \mathrm { h e a d } _ { k } ) W _ { o } , } \end{array}
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
where $d _ { k }$ is the scaling factor and set to $d _ { k } = d / k$ . $W _ { K _ { i } }$ $W _ { Q _ { i } }$ , $W _ { V _ { i } }$ and $W _ { o }$ are weight matrices for computation of key, query, value and the output of MHA, respectively. Besides the MHA module, the FFN is also vital in the Transformer-based model. It stacks two fully connected (FC) layers with an activation function in between. FFN is defined as:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\mathrm { F F N } ( \pmb { x } ) = W _ { f _ { 2 } } \mathrm { R e L U } ( W _ { f _ { 1 } } \pmb { x } + b _ { 1 } ) + b _ { 2 } ,
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $\pmb { x } \in \mathbb { R } ^ { d }$ , $W _ { f _ { 1 } }$ and $W _ { f _ { 2 } }$ are two fully connected layers in FFN, $b _ { 1 }$ and $b _ { 2 }$ are bias terms.
|
| 45 |
+
|
| 46 |
+
Low Rank Adaptation. Given a pre-trained matrix $\boldsymbol { W } \in \mathbb { R } ^ { c \times d }$ , LoRA ( $\mathrm { H u }$ et al., 2022) learns an incremental update $\triangle \mathbf { { W } }$ and decomposes $\triangle W$ into a matrix multiplication between two lowrank matrices $\pmb { A }$ and $\textbf { { B } }$ , where $\pmb { A } \in \mathbb { R } ^ { c \times r }$ and $\boldsymbol { B } \in \mathbb { R } ^ { r \times d }$ , and $\triangle W = A B$ . Here, the rank $r \ll m i n ( d , c )$ . For an input $_ { \textbf { \em x } }$ and hidden state $^ { h }$ , LoRA has the following forward process:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\pmb { h } = \pmb { W } ^ { * } \pmb { x } = \pmb { W } \pmb { x } + \triangle \pmb { W } \pmb { x } = \pmb { W } \pmb { x } + \frac { \alpha } { r } \pmb { A } \pmb { B } \pmb { x }
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
At the beginning of the training stage, $\pmb { A }$ is randomly initialized via Kaiming initialization (He et al., 2015) and $\textbf { { B } }$ is initialized to zero matrix to make sure that the incremental update $A B = \mathbf { 0 }$ at initialization. Besides, LoRA uses hyper-parameters $\alpha$ and $r$ to scale ${ \pmb A } { \pmb B } { \pmb x }$ .
|
| 53 |
+
|
| 54 |
+
# 3 RELATED WORKS
|
| 55 |
+
|
| 56 |
+
With the ever-growing parameter scale in current Transformer-based models, fine-tuning such a large language model (LLM) requires considerable number of GPUs equipped with high memory capacity. This is mainly due to the fact that common optimizers such as AdamW (Loshchilov & Hutter, 2019) requires maintaining three times of extra parameter size (gradients, first-order and second-order momentums). To bridge this gap, a series of Parameter-Efficient Fine-Tuning (PEFT) methods have been proposed (Hu et al., 2022; Liu et al., 2022b; Shin et al., 2020; Houlsby et al., 2019). The Adapter (Houlsby et al., 2019) introduces lightweight trainable parameters between pre-trained layers while keeping the pre-trained weights fixed. Prompt-Tuning (Lester et al., 2021) aims to optimize the prompt to achieve comparable performance with fine-tuning for specific task, while Prefix-Tuning optimizes for trainable prefixes and prepends these trainable parameters to each hidden state (Li & Liang, 2021). Despite the notable performance achievements, these methods inevitably introduce extra overhead at the inference stage.
|
| 57 |
+
|
| 58 |
+
Hu et al. (2022) proposed LoRA to utilize the multiplication of two low-rank matrices to model the incremental update of a full-rank matrix. LoRA merges the incremental updates to pre-trained weights after training, thereby avoiding any extra computation overhead during inference. Furthermore, it stands out as one of the most effective PEFT techniques according to Ding et al. (2023)’s evaluation. Subsequent to its inception, a series of enhanced methods building upon LoRA was proposed. Notably, G-LoRA (Chavan et al., 2023) leverages a generalized prompt module to fine-tune pre-trained weights resulting in better representations for computer vision tasks. DyLoRA (Valipour et al., 2023) aims to adjust the rank of two lightweight matrices after the training stage. Differing from the conventional approach of maintaining a static rank during training, DyLoRA introduces rank variations to its blocks. AdaLoRA (Zhang et al., 2022) emphasizes the disparate importance attributed to distinct weight parameters. This technique intelligently allocates the parameter budget across weight matrices based on their respective importance scores. Additionally, Q-LoRA (Dettmers et al., 2023) was proposed to further reduce the average memory footprint by quantizing the pre-trained model with 4-bit NormalFloat. This quantization approach not only preserves the model’s efficacy but also effectively alleviates the resource-intensive nature of LLM training and addresses a pertinent concern.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: The framework of our proposed Delta-LoRA. The blue arrows represent forward pass while yellow dashed arrows denote backward propagation. The black solid arrows in (b) represent the process of updating the low-rank adaptation matrices $\pmb { A }$ and $\textbf { { B } }$ with normalized gradients $\widehat { \mathbf { g } } _ { A }$ and $\widehat { \pmb { g } } _ { B }$ multiplied by the learning rate $\eta$ , as well as updating the pre-trained weights $W$ bwith the delta bmatrix $\triangle A B$ multiplied by the update ratio $\lambda$ .
|
| 62 |
+
|
| 63 |
+
# 4 METHODOLOGY
|
| 64 |
+
|
| 65 |
+
This section introduces the novel fine-tuning approach termed as Delta-LoRA. Delta-LoRA encompasses two pivotal designs as shown in Figure 1 and Figure 2: (i) It simultaneously updates the full weight matrix $( W )$ alongside the two low-rank adaptation matrices $\mathbf { \delta A }$ and $\textbf { { B } }$ ), utilizing the delta $( \hat { A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } } - A ^ { ( t ) } \hat { B } ^ { ( t ) } )$ resulting from incremental updates to refine the pre-trained weights $( W )$ ; (ii) The Dropout layer as originally integrated within the conventional LoRA module, is excluded in Delta-LoRA. This omission stems from the realization that its presence violates the required assumption $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial W } = \frac { \partial \mathcal { L } } { \partial A B } } \end{array}$ .
|
| 66 |
+
|
| 67 |
+
# 4.1 UPDATE THE DELTA OF LOW-RANK MATRICES ON PRE-TRAINED WEIGHTS
|
| 68 |
+
|
| 69 |
+
For an input $_ { \textbf { \em x } }$ and its corresponding hidden state $^ { h }$ , LoRA optimizes two low-rank matrices $\pmb { A }$ and $\textbf { { B } }$ to learn an incremental update $_ { A B }$ for the pre-trained and fixed weight matrix $W$ . Different from previous methods, we argue that $W$ also needs to be updated. In this way, we can introduce more learnable parameters to the optimization process for higher learning capability. However, acquiring the normalized gradients (i.e. the gradients after normalization in optimizer) to fine-tune the weight matrix $W$ is non-trivial, since the optimizer such as AdamW must maintain at least three extra copies of the parameters (i.e. gradients as well as the first-order and the second-order moments of gradients) in GPU memory. Intriguingly, we note that the gradients of the loss $\mathcal { L }$ with respect to matrices $_ { A B }$ and $W$ are precisely identical, under the presumption that the LoRA module exclusively retains matrices $\pmb { A }$ and $\textbf { { B } }$ , while disregarding the Dropout layer. This correspondence can be formally represented as:
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
\begin{array} { l } { g _ { W } = \displaystyle \frac { \partial \mathcal { L } } { \partial h _ { i + 1 } } \cdot \frac { \partial h _ { i + 1 } } { \partial W } ^ { \top } = \displaystyle \frac { \partial \mathcal { L } } { \partial h _ { i + 1 } } \cdot h _ { i } ^ { \top } , } \\ { g _ { A B } = \displaystyle \frac { \partial \mathcal { L } } { \partial h _ { i + 1 } } \cdot \frac { \partial h _ { i + 1 } } { \partial A B } ^ { \top } = \displaystyle \frac { \partial \mathcal { L } } { \partial h _ { i + 1 } } \cdot h _ { i } ^ { \top } , } \\ { \implies g _ { W } = g _ { A B } , } \end{array}
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
where $h _ { i + 1 } = W h _ { i } + A B h _ { i } .$ , $\boldsymbol { h } _ { i }$ and $\boldsymbol { h } _ { i + 1 }$ are the outputs of the $i$ -th layer and the $_ { i + 1 }$ -th layer respectively. $_ { A B }$ is the matrix product of the adaptation matrices $\pmb { A }$ and $\textbf { { B } }$ , $\mathcal { L }$ is the loss function, while $g _ { W + A B } , g _ { W }$ and $\mathbf { \sigma } _ { \mathbf { \sigma } _ { g _ { A B } } }$ denote the gradients of ∂L∂(W +AB) , ∂L∂W , and ∂ $\frac { \partial \mathcal { L } } { \partial A B }$ respectively.
|
| 76 |
+
|
| 77 |
+
Equation 4 inspires us to use $\mathbf { \sigma } _ { \mathbf { \sigma } _ { g _ { A B } } }$ to assimilate $\mathbf { \Delta } _ { g _ { W } }$ when learning the parameter updates for weight matrix $W$ . Unfortunately, we are only able to obtain the gradients $\mathbf { \pmb { g } } _ { \pmb { A } }$ and $\mathbf { \nabla } _ { \mathbf { \pmb { g } } \mathbf { \it { B } } }$ rather than $\mathbf { \Delta } _ { \mathbf { \mathcal { { g } } } \mathbf { \Delta } _ { W } }$ during the back-propagation process. Furthermore, the computation of the gradients for $_ { A B }$ is as expensive as for the matrix $W$ , since both matrices share the same dimensions of $d \times k$ , consequently entailing an equivalent GPU memory overhead.
|
| 78 |
+
|
| 79 |
+
Considering a typical optimization process, the model updates its parameters by applying the gradient descent: $\boldsymbol { W } ^ { ( t + 1 ) } = \boldsymbol { W } ^ { ( t ) } - \eta \boldsymbol { g } _ { \boldsymbol { W } }$ , with the parameter update denoted as $\triangle W = - \eta g _ { W }$ , using the learning rate $\eta$ . Similarly, we regard $- \triangle A B$ as the gradients for $_ { A B }$ and utilize this matrix as a substitute for $\mathbf { \Delta } _ { g _ { W } }$ according to Equation 4. Here, we can compute $\triangle A B$ as:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\triangle { \cal A } B = { \cal A } ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - { \cal A } ^ { ( t ) } B ^ { ( t ) } = \eta { \cal A } ^ { ( t ) } g _ { B } + \eta g _ { A } B ^ { ( t ) } - \eta ^ { 2 } g _ { A } g _ { B } ,
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where $A ^ { ( t ) }$ , $B ^ { ( t ) }$ and $\mathbf { \mathbf { } } W ^ { ( t ) }$ are the weights of $A , B$ and $W$ at the $t { \cdot }$ -th step respectively, $A ^ { ( t + 1 ) } =$ $A ^ { ( t ) } - \eta g _ { A }$ , $B ^ { ( t + 1 ) } = B ^ { ( t ) } - \eta \pmb { g } _ { B }$ and $\eta$ is the learning rate. To be precise, $- \triangle A B$ does not equate directly to $\mathbf { \sigma } _ { \mathbf { \sigma } _ { g _ { A B } } }$ and $\mathbf { \Delta } _ { \mathbf { \mathcal { { g } } } \mathbf { \Delta } _ { W } }$ as elaborated in Appendix A.4.2. Nonetheless, $\triangle A B$ has the capability to symbolize the genuine directions of update for the matrix $_ { A B }$ . Based on this assumption, it is reasonable to employ $- \triangle A B$ as the gradient for directing the update of $W$ .
|
| 86 |
+
|
| 87 |
+
Therefore, during the training phase we introduce the matrix $\triangle A B$ to update the pre-trained weights $W$ in the following manner:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
{ \bf W } ^ { ( t + 1 ) } = { \bf W } ^ { ( t ) } + \lambda \cdot \frac { \alpha } { r } \cdot \triangle A B , { \mathrm { w h e r e ~ } } \triangle A B = { \cal A } ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - { \cal A } ^ { ( t ) } B ^ { ( t ) } ,
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $\lambda$ represents the hyper-parameter to trade off the update ratio of $_ { A B }$ and the pre-trained weights $W$ . The parameter updates for $W$ commence after $K$ training iterations. The procedural details of the algorithm are illustrated in Algorithm 1.
|
| 94 |
+
|
| 95 |
+
Discussion. The Delta-LoRA has some important modifications compared to LoRA. Here, we discuss and compare the difference:
|
| 96 |
+
|
| 97 |
+
<table><tr><td colspan="2">LoRA</td><td colspan="2">1 Delta-LoRA 1 1</td></tr><tr><td rowspan="2">(1) A(t+1) ← ∂L(χ;W,A(t),B(t))</td><td>1 1</td><td>aL(x;W(t),A(t),B(t)) (1) A(t+1) ←</td><td rowspan="2"></td></tr><tr><td>aA(t)</td><td>aA(t)</td></tr><tr><td rowspan="3">(2) B(t+1) ← ∂C(χ:W.A(t),B(t))</td><td></td><td>1 (2) B(t+1) ← 0L(ω:W(t),A(t),B(t))</td><td>aB(t)</td></tr><tr><td>∂B(t)</td><td></td><td></td></tr><tr><td></td><td></td><td>(3)W(t+1) ← A(t+1)B(t+1) - A(t)B(t)</td></tr></table>
|
| 98 |
+
|
| 99 |
+
It is obvious that LoRA only updates $\pmb { A }$ and $\textbf { { B } }$ , and keeps $W$ frozen, while Delta-LoRA updates $\pmb { A }$ and $\textbf { { B } }$ by the optimizer and $W$ with the delta of the product of $\pmb { A }$ and $\textbf { { B } }$ .
|
| 100 |
+
|
| 101 |
+
# 4.2 THE STRUCTURE OF OUR DELTA-LORA
|
| 102 |
+
|
| 103 |
+
Both LoRA and its successor AdaLoRA put a Dropout layer before two low-rank matrices $\pmb { A }$ and $\textbf { { B } }$ . However, this arrangement results in a disparity between the gradient matrices $\mathbf { \Delta } _ { g _ { W } }$ and $\mathbf { \sigma } _ { \mathbf { \sigma } _ { g _ { A B } } }$ (or the matrix $\mathbf { \_ { \_ { \_ { \delta A E B } } } }$ in the context of AdaLoRA). The derivation of this disparity can be shown as:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
g _ { W } = { \frac { \partial { \mathcal { L } } } { \partial h _ { i + 1 } } } \cdot h _ { i } ^ { \top } \neq g _ { A B } = { \frac { \partial { \mathcal { L } } } { \partial h _ { i + 1 } } } \cdot \mathrm { D r o p } ( h _ { i } ) ^ { \top } ,
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
where $\mathrm { D r o p } ( \cdot )$ denotes the Dropout layer which leads to $g _ { W } \neq g _ { A B }$ . A reasonable choice is to remove the Dropout layer in the low-rank module and activate the Dropout layer between pre-trained layers if overfitting problem occurs. This modification also brings additional benefits: (1) it can alleviate under-fitting to some extent, thereby enhancing the learned representations of the networks. The rationale behind this improvement lies in the fact that LoRA and its successors formulate low-rank updates for pre-trained weights, involving less than $1 \%$ of the complete parameters. However, relying solely on such a small fraction of parameters may not bestow an adequate representation capacity in most cases; (2) This alteration also yields memory-saving benefits. By negating the requirement to store intermediate features, the model curtails the memory consumption. Consequently, there is a reduction in activation memory employed during the back-propagation process.
|
| 110 |
+
|
| 111 |
+
# 5 EXPERIMENTS
|
| 112 |
+
|
| 113 |
+
We evaluate our proposed model fine-tuning method Delta-LoRA with RoBERTa (Liu et al., 2019), GPT-2 (Radford et al., 2019) and BART (Lewis et al., 2019) on a broad set of datasets. Specifically, we train (1) RoBERTa on GLUE benchmark which consists of 8 NLP understanding tasks; (2) GPT-2 on E2E Challenge and WebNLG Challenge 2017 following the setting of Hu et al. (2022); and (3) BART on XSum dataset by using the setting provided by Zhang et al. (2022). See Appendix A.7 for more training details on the datasets. The setups and detailed introductions of baseline methods are shown in Appendix A.1. We use PyTorch to implement our experiments and download the pre-trained weights as well as configuration files from HuggingFace Wolf et al. (2019).
|
| 114 |
+
|
| 115 |
+
Table 1: The evaluation results of our proposed Delta-LoRA and other existing methods on E2E NLG Challenge dataset. $\dagger$ indicates fine-tuning all layers except embedding layer. $^ \ddag$ indicates only fine-tuning weights for query and value. $^ \mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced.
|
| 116 |
+
|
| 117 |
+
Table 2: The evaluation results of our proposed Delta-LoRA and other existing methods on WebNLG Challenge 2017 dataset. $\dagger$ indicates fine-tuning all layers except embedding layer. $\ddagger$ indicates only fine-tuning weights for query and value. $^ \mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced.
|
| 118 |
+
|
| 119 |
+
<table><tr><td>Method</td><td></td><td>Trainables|Exrupdale</td><td></td><td></td><td></td><td>BLEU NIST METEOR ROUGE-L CIDEr</td><td></td></tr><tr><td>Full Fine-Tuning</td><td>354.92M</td><td></td><td>69.58</td><td>8.75</td><td>46.34</td><td>71.66</td><td>2.47</td></tr><tr><td>Fine-Tuningt</td><td>305.84M</td><td></td><td>69.37</td><td>8.76</td><td>46.05</td><td>71.97</td><td>2.44</td></tr><tr><td>Fine-Tuningt</td><td>48M</td><td>×</td><td>69.77</td><td>8.84</td><td>46.29</td><td>71.96</td><td>2.49</td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td>X</td><td>69.60</td><td>8.78</td><td>45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>LoRA</td><td>0.35M</td><td></td><td>70.4</td><td>8.85</td><td>46.8</td><td>71.8</td><td>2.53</td></tr><tr><td>DyLoRA</td><td>0.375M</td><td></td><td>67.89</td><td>8.50</td><td>44.07</td><td>70.52</td><td>2.26</td></tr><tr><td>AdaLoRA</td><td>0.375M</td><td></td><td>68.16</td><td>8.58</td><td>44.10</td><td>70.66</td><td>2.35</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.375M</td><td>√48M</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>
|
| 120 |
+
|
| 121 |
+
<table><tr><td>Method</td><td></td><td>PTrainables Exraupdatable</td><td>S BLEU↑</td><td>A</td><td>METEOR↑</td><td>S</td><td>TER</td><td>A</td></tr><tr><td>FullFine-Tuning</td><td>354.92M</td><td></td><td></td><td></td><td>61.38 45.11 54.480.44 0.38 0.410.36 0.53 0.44</td><td></td><td></td><td></td></tr><tr><td>Fine-Tuningt</td><td>305.84M</td><td>×</td><td></td><td></td><td>63.53 46.66 55.920.45 0.39 0.420.34 0.49 0.41</td><td></td><td></td><td></td></tr><tr><td>Fine-Tuningt</td><td>48M</td><td>×</td><td></td><td></td><td>64.55 48.06 57.080.46 0.39 0.430.33 0.47 0.40</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td>X</td><td>62.08 46.60 55.050.44 0.38 0.410.35 0.49 0.42</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LoRA</td><td>0.375M</td><td></td><td>62.1</td><td>46.7 55.3</td><td>0.440.380.41</td><td></td><td>0.330.460.39</td><td></td></tr><tr><td>DyLoRA</td><td>0.375M</td><td>×</td><td></td><td></td><td>58.39 46.02 52.77|0.42 0.37 0.40|0.38 0.49 0.43</td><td></td><td></td><td></td></tr><tr><td>AdaLoRA</td><td>0.375M</td><td>×</td><td>56.39 44.14 50.820.41 0.37 0.390.40 0.49 0.44</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.375M</td><td>√48M</td><td></td><td></td><td></td><td></td><td>62.87 47.68 55.960.45 0.39 0.420.34 0.48 0.40</td><td></td></tr></table>
|
| 122 |
+
|
| 123 |
+
# 5.1 NATURAL LANGUAGE GENERATION
|
| 124 |
+
|
| 125 |
+
Models and Datasets. We use GPT2-Medium to verify the effectiveness of our Delta-LoRA on two datasets for data-to-text tasks, including the E2E NLG Challenge (Puzikov & Gurevych, 2018) and WebNLG Challenge 2017 (Gardent et al., 2017). The E2E NLG Challenge dataset comprises 42,000 samples for training, 4,600 for validation, and 4,600 for testing purposes. In contrast, the WebNLG Challenge 2017 consists of 21,855 training samples across nine categories, expanding to a total of 14 categories in the test set. For the text summarization task, we employed BART-Large (Lewis et al., 2019) to evaluate the efficacy of our method using the XSum dataset (Narayan et al., 2018). The XSum dataset is composed of 204,045 training samples, 11,332 validation samples, and 11,332 test samples. We also use LLaMA-7B(Touvron et al., 2023), a popular pre-trained large language model with 7 Billion parameters,to fine-tune on Alpaca dataset (Taori et al., 2023).
|
| 126 |
+
|
| 127 |
+
Implementation Details. In order to compare with LoRA and its successors fairly, we adopt the model setups from LoRA to implement our Delta-LoRA and three PEFT methods. We only learn the low-rank incremental update for $W _ { Q }$ and $W _ { V }$ in MHA module. For data-to-text datasets, we use the same training configurations as adopted by LoRA, including the number of training epochs, batch size and etc. We use update ratio $\lambda = 2$ and set start steps $K = 5 0 0$ for Delta-LoRA. More details about Delta-LoRA are listed in the Appendix A.7. For the text-summarization task, we use the implementation of AdaLoRA and adopt the same training configurations. We set the update ratio $\lambda = 0 . 5$ and the start steps $K = 1 0 0 0$ for Delta-LoRA.
|
| 128 |
+
|
| 129 |
+
Table 3: The evaluation results of Delta-LoRA with LLaMA-7B on the Instruction-Tuning dataset provided by Stanford Alpaca(Taori et al., 2023). We use GPT-4 to choose from a. LoRA, b. DeltaLoRA or c. Both LoRA and Delta-LoRA to decide the text from which method is better.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>Both</td><td>LoRA</td><td>Delta-LoRA</td><td>Total</td></tr><tr><td>886</td><td>10</td><td>104</td><td>1,000</td></tr></table>
|
| 132 |
+
|
| 133 |
+
Experimental Results. Table 1 shows the results for E2E Challenge dataset on 5 evaluation metrics, demonstrating that our method achieves state-of-the-art performance over 3 baselines and a set of fine-tuning methods. For the BLEU and ROUGE-L metrics, our method obtains 1.24 and 1.13 performance gains compared with LoRA, with 0.13, 0.86 and 0.08 improvement on NIST, METEOR and CIDEr respectively. Table 2 demonstrates that Delta-LoRA outperforms baselines on BLEU score for WebNLG Challenge 2017 dataset, with 0.79, 1.08 and 0.91 improvement on Seen, Unseen and All test data, respectively. Additionally, for the METEOR and TER evaluation metrics, Delta-LoRA also achieves state-of-the-art performance, with 0.01 and 0.02 improvement over LoRA on all data. For the text-summarization task, the test results are shown in Table 4, which demonstrates that our method achieves state-of-the-art results across 3 parameter-efficient methods on 4 evaluation metrics. To fairly evaluate our method, we utilized LLaMA-7B and compared it with LoRA. We employed GPT-4 to generate 1,000 questions and presented these questions to the parameter-efficient fine-tuned LLaMA-7B. Subsequently, we leveraged GPT-4 to compare the texts generated by LoRA-tuned and Delta-LoRA-tuned LLMs. Additional details can be found in Appendix A.2. According to the findings in Table 3, Delta-LoRA establishes state-of-the-art performance in the evaluation of Language Models (LLMs). GPT-4 identified 104 samples generated by Delta-LoRA as superior to LoRA, while only 10 samples generated by LoRA exhibited higher quality than Delta-LoRA. This underscores Delta-LoRA’s effectiveness even when utilized within models containing billions of parameters.
|
| 134 |
+
|
| 135 |
+
Table 4: The evaluation results of our proposed Delta-LoRA and other existing methods on XSum dataset. $\dagger$ indicates fine-tuning all layers except the embedding layer. $^ \ddag$ indicates only fine-tuning weights for query and value. $\ P$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced.
|
| 136 |
+
|
| 137 |
+
<table><tr><td>Method</td><td></td><td> PTrainablesExraUpdatable</td><td></td><td></td><td></td><td>Rouge-1 Rouge-2 Rouge-L Rouge-Sum</td></tr><tr><td>Full Fine-Tuning</td><td>387.5M</td><td></td><td>45.36</td><td>22.16</td><td>37.23</td><td>37.24</td></tr><tr><td>Fine-Tuningt</td><td>338.4M</td><td>xx</td><td>45.04</td><td>22.05</td><td>36.92</td><td>36.94</td></tr><tr><td>Fine-Tuningt</td><td>72M</td><td></td><td>44.95</td><td>21.43</td><td>36.35</td><td>36.37</td></tr><tr><td>LoRA</td><td>0.56M</td><td>X</td><td>43.27</td><td>20.13</td><td>35.12</td><td>35.12</td></tr><tr><td>DyLoRA</td><td>0.56M</td><td>×</td><td>41.84</td><td>18.76</td><td>33.56</td><td>33.57</td></tr><tr><td>AdaLoRAI</td><td>0.56M</td><td>X</td><td>42.91</td><td>19.76</td><td>34.71</td><td>34.72</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.56M</td><td>√72M</td><td>43.49</td><td>20.23</td><td>35.26</td><td>35.26</td></tr></table>
|
| 138 |
+
|
| 139 |
+
# 5.2 NATURAL LANGUAGE UNDERSTANDING
|
| 140 |
+
|
| 141 |
+
Models and Datasets. We use RoBERTa-baseLiu et al. (2019) to evaluate the performance of our proposed method, prior works and three fine-tuning methods. We choose the GLUE benchmark consisting of 8 datasets (Wang et al., 2019), including classification tasks, similarity and paraphrase tasks and natural language inference tasks.
|
| 142 |
+
|
| 143 |
+
Implementation Details. We use RoBERTa-base with 118M parameters to conduct our experiments and to compare our method with the baselines. We mostly adopt the same training configurations of
|
| 144 |
+
|
| 145 |
+
LoRA, more details can get from Appendix A.7. We set the rank to 8 and the target rank to 6 for AdaLoRA and choose the rest of hyper-parameters according to the characteristics of different tasks. For Delta-LoRA, we set the update ratio $\lambda$ to 0.5 and choose different start steps $K$ according to warmup steps used in individual tasks.
|
| 146 |
+
|
| 147 |
+
Table 5: The evaluation results of our proposed Delta-LoRA and other existing methods on GLUE benchmark. We report the overall (matched and mismatched) accuracy for MNLI, Matthew’s correlation for CoLA, Pearson correlation for STS-B, and accuracy for other tasks. $\dagger$ indicates fine-tuning all layers except the embedding layer. $\ddagger$ indicates only fine-tuning weights for query and value. $^ \mathparagraph$ means we choose different settings with AdaLoRA: we only tune $W _ { Q }$ and $W _ { V }$ instead of all layers. The best results of Fine-Tuning methods are underlined. The best results of PEFT methods are boldfaced.
|
| 148 |
+
|
| 149 |
+
<table><tr><td>Method</td><td></td><td></td><td>TraiableErUpdatablMNLISS-2 MRPC CoLA QNLIQP RTE STS-B AVG</td></tr><tr><td>Full Fine-Tuning</td><td>118.87M</td><td>X</td><td>87.51 94.26 88.23 64.57 92.73 91.96 84.11 90.56 86.74</td></tr><tr><td>Fine-Tuningt</td><td>82.05M</td><td>×</td><td>87.58 94.03 89.95 62.99 92.73 91.90 86.64 90.22 87.01</td></tr><tr><td>Fine-Tuningt</td><td>13.5M</td><td>×</td><td>87.48 95.06 89.21 61.07 92.76 91.19 84.83 89.85 86.43</td></tr><tr><td>LoRA</td><td>0.28M</td><td>X</td><td>87.40 94.61 89.95 63.17 93.02 90.67 86.64 91.54 87.12</td></tr><tr><td>DyLoRA</td><td>0.28M</td><td>X</td><td>86.33 94.26 89.46 61.12 92.22 90.17 84.47 91.06 86.14</td></tr><tr><td>AdaLoRA</td><td>0.28M</td><td>×</td><td>87.34 94.49 90.19 61.64 93.08 90.14 85.19 91.16 86.65</td></tr><tr><td>Delta-LoRA (Ours)</td><td>0.28M</td><td>√13.5M</td><td>87.50 95.06 90.19 63.82 93.09 90.87 87.00 91.57 87.38</td></tr></table>
|
| 150 |
+
|
| 151 |
+
Experimental Results. We compare our method with prior PEFT works. According to Table 5, our method outperforms existing methods on all 8 tasks in GLUE benchmark. Among these tasks, our method demonstrates significant improvement on SST-2, CoLA and RTE. This is mainly due to the fact that these datasets contain less training data, which hinders the model’s capacity to effectively acquire a robust representation when using prior fine-tuning methods. Delta-LoRA also achieves decent performance on the rest of the datasets, including MNLI, MRPC, QNLI as well STS-B, which proves that our method is stable and reliable across different settings.
|
| 152 |
+
|
| 153 |
+
# 5.3 COMPREHENSIVE UNDERSTANDING OF DELTA-LORA
|
| 154 |
+
|
| 155 |
+
Table 6: The ablation study of our proposed Delta-LoRA on E2E Challenge dataset demonstrates the importance of each component. The best results are boldfaced.
|
| 156 |
+
|
| 157 |
+
<table><tr><td>Method</td><td>Trainable Parameters</td><td>Parameters</td><td>Extra Updatable|BLEU NIST METEOR ROUGE-L CIDEr</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>0.375M</td><td></td><td>69.60 8.78</td><td>45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>Delta-LoRA + LoRA Module</td><td>0.375M</td><td>√48M</td><td>70.29 8.88</td><td>46.38</td><td>71.88</td><td>2.51</td></tr><tr><td>Delta-LoRA</td><td>0.375M</td><td>√48M</td><td>70.84 8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>
|
| 158 |
+
|
| 159 |
+
Table 7: The ablation study of our proposed Delta-LoRA to eliminate the impact of hyper-parameter $\lambda$ on E2E Challenge dataset. The best results are boldfaced.
|
| 160 |
+
|
| 161 |
+
<table><tr><td>Method</td><td>Learming</td><td>入</td><td>BLEU NIST METEOR ROUGE-L CIDEr</td><td></td><td></td><td></td></tr><tr><td>LoRA (repr.)</td><td>2e-4</td><td>-</td><td>69.60</td><td>8.78 45.61</td><td>71.12</td><td>2.45</td></tr><tr><td>LoRA (repr.)</td><td>6e-4</td><td>1</td><td>69.63</td><td>8.79 45.70</td><td>71.55</td><td>2.39</td></tr><tr><td>Delta-LoRA</td><td>2e-4</td><td>2</td><td>70.84 8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr></table>
|
| 162 |
+
|
| 163 |
+
The Extra Updatable Parameters. We introduce the concept of extra updatable parameters to point out the superiority of Delta-LoRA. For most PEFT methods, they can only adjust the low-rank adapters, such as AdapterHoulsby et al. (2019) and LoRAHu et al. (2022). Thus, they don’t have any extra parameters to update, which means their extra updatable parameters are 0. However, our Delta-LoRA can achieve the purpose of updating the W matrix without increasing the GPU memory consumption, which means its extra updatable parameters are the parameter number of $W$ .
|
| 164 |
+
|
| 165 |
+
Ablation study. To better understand the contribution of our modified LoRA module (i.e. DeltaLoRA module) and the effectiveness of our update algorithm, we conduct studies on E2E Challenge dataset with GPT2-medium. As shown in Table 6, only updating the pre-trained matrices with delta of low-rank update can indeed achieve performance improvement, while further discarding the dropout in Delta-LoRA module obtains the best performance. This observation confirms the indispensable role played by each component within our proposed methodology. We have devised an experiment to further differentiate whether the performance enhancement stems from the inherent characteristics of our method rather than solely from the substantial update magnitude. According to our algorithm, we update the parameters of both pre-trained and low-rank matrices, which can arose the doubt of whether the improvement is caused by updating larger $\triangle A B$ on the weights instead of introducing more parameters into the optimization process. To answer this question, we design an experiment with results shown in Table 7 to prove the effectiveness of our method. We scale the learning rate of LoRA from 2e-4 to 6e-4 making sure that $W + A B$ can be updated with $3 \times \triangle A B$ , which is equivalent to Delta-LoRA when $\lambda$ is set to 2. We find that even by updating with $3 \times \triangle A B$ on $_ { A B }$ , the performance is still not comparable with Delta-LoRA. This experiment further proves that introducing more parameters into the optimization process can force to learn better representation.
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 3: The comparison of Fine-Tuning‡, LoRA as well as Delta-LoRA for the cosine similarity between the fine-tuned parameters and the original pre-trained parameters in each transformer block. Higher value means higher similarity.
|
| 169 |
+
|
| 170 |
+
The cosine similarity between fine-tuned and the pre-trained parameters to measure learning effects. We conduct a comparative analysis of three methods including Fine-Tuning‡, LoRA and Delta-LoRA, in order to elucidate the reasons behind Delta-LoRA’s superior performance. We use the last checkpoint trained on E2E Challenge dataset to give understanding. As depicted in Figure 3, it is evident that LoRA exhibits the highest similarity across the majority of transformer blocks. This observation suggests that LoRA primarily modifies the matrix $\pmb { W } ^ { * } = \pmb { W } + \pmb { A } \pmb { B }$ within a limited range. Nevertheless, Delta-LoRA showcases the lowest cosine similarity, underscoring that our approach induces the most significant modifications to the final matrix $W ^ { * }$ . Due to this property, our approach can effectively stimulate the model to acquire better representations, leading to state-of-the-art performance across all four PEFT methods. This observation further aligns with the evaluation results in Table 1: Delta-LoRA achieves the best performance among the three methods, whereas LoRA is slightly worse than Fine-Tuning‡.
|
| 171 |
+
|
| 172 |
+
# 6 CONCLUSION
|
| 173 |
+
|
| 174 |
+
In this paper, we have introduced Delta-LoRA, a novel method to simultaneously update the full weight matrix and two low-rank matrices. Delta-LoRA leverages the delta $( { \pmb A } ^ { ( t + 1 ) } { \pmb B } ^ { ( t + 1 ) } - { \pmb A } ^ { ( t ) } { \pmb B } ^ { ( t ) } )$ to update the pre-trained weights $( W )$ . In this way, we introduce more learnable parameters into the optimization process such that the model can learn a better representation with comparable memory cost as LoRA. Meanwhile, we identify the Dropout layer in the low-rank branch to be unnecessary according to the gradient flow. We also provide thorough analysis of our method to understand its effectiveness and robustness. Extensive experiments on a broad range of NLP tasks are conducted to empirically verify the effectiveness of our Delta-LoRA.
|
| 175 |
+
|
| 176 |
+
# REFERENCES
|
| 177 |
+
|
| 178 |
+
Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NeurIPS, 2020.
|
| 179 |
+
|
| 180 |
+
Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with gpt-4, 2023.
|
| 181 |
+
Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020.
|
| 182 |
+
Arnav Chavan, Zhuang Liu, Deepak Gupta, Eric Xing, and Zhiqiang Shen. One-for-all: Generalized lora for parameter-efficient fine-tuning. arXiv preprint arXiv:2306.07967, 2023.
|
| 183 |
+
Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms. arXiv preprint arXiv:2305.14314, 2023.
|
| 184 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019.
|
| 185 |
+
Ning Ding, Yujia Qin, Guang Yang, Fuchao Wei, Zonghan Yang, Yusheng Su, Shengding Hu, Yulin Chen, Chi-Min Chan, Weize Chen, Jing Yi, Weilin Zhao, Zhiyuan Liu, Hai-Tao Zheng, Jianfei Chen, Yang Liu, Jie Tang, Juanzi Li, and Maosong Sun. Parameter-efficient fine-tuning of large-scale pre-trained language models. Nature Machine Intelligence, 2023.
|
| 186 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
|
| 187 |
+
Claire Gardent, Anastasia Shimorina, Shashi Narayan, and Laura Perez-Beltrachini. The WebNLG challenge: Generating text from RDF data. In Proceedings of the 10th International Conference on Natural Language Generation, 2017.
|
| 188 |
+
Demi Guo, Alexander M Rush, and Yoon Kim. Parameter-efficient transfer learning with diff pruning. In ACL, 2021.
|
| 189 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In ICCV, 2015.
|
| 190 |
+
Pengcheng He, Jianfeng Gao, and Weizhu Chen. Debertav3: Improving deberta using electra-style pre-training with gradient-disentangled embedding sharing. arXiv preprint arXiv:2111.09543, 2021.
|
| 191 |
+
Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In ICML, 2019.
|
| 192 |
+
Edward J Hu, yelong shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In ICLR, 2022.
|
| 193 |
+
Shaoyi Huang, Dongkuan Xu, Ian Yen, Yijue Wang, Sung-En Chang, Bingbing Li, Shiyang Chen, Mimi Xie, Sanguthevar Rajasekaran, Hang Liu, and Caiwen Ding. Sparse progressive distillation: Resolving overfitting under pretrain-and-finetune paradigm. In ACL, 2022.
|
| 194 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In EMNLP, 2021.
|
| 195 |
+
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019.
|
| 196 |
+
Junnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. Align before fuse: Vision and language representation learning with momentum distillation. 2021.
|
| 197 |
+
Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), ACL, 2021.
|
| 198 |
+
Haokun Liu, Derek Tam, Mohammed Muqeeth, Jay Mohta, Tenghao Huang, Mohit Bansal, and Colin A Raffel. Few-shot parameter-efficient fine-tuning is better and cheaper than in-context learning. In NeurIPS, 2022a.
|
| 199 |
+
Xiao Liu, Kaixuan Ji, Yicheng Fu, Weng Tam, Zhengxiao Du, Zhilin Yang, and Jie Tang. P-tuning: Prompt tuning can be comparable to fine-tuning across scales and tasks. In ACL, 2022b.
|
| 200 |
+
Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguang Zhu. Gpteval: Nlg evaluation using gpt-4 with better human alignment. arXiv preprint arXiv:2303.16634, 2023.
|
| 201 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 202 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019.
|
| 203 |
+
Kai Lv, Yuqing Yang, Tengxiao Liu, Qinghui Gao, Qipeng Guo, and Xipeng Qiu. Full parameter fine-tuning for large language models with limited resources. 2023.
|
| 204 |
+
Shashi Narayan, Shay B Cohen, and Mirella Lapata. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. arXiv preprint arXiv:1808.08745, 2018.
|
| 205 |
+
Jonas Pfeiffer, Aishwarya Kamath, Andreas Rücklé, Kyunghyun Cho, and Iryna Gurevych. Adapterfusion: Non-destructive task composition for transfer learning. In EACL, 2021.
|
| 206 |
+
Yevgeniy Puzikov and Iryna Gurevych. E2E NLG challenge: Neural models vs. templates. In Proceedings of the 11th International Conference on Natural Language Generation, 2018.
|
| 207 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
|
| 208 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J Liu, et al. Exploring the limits of transfer learning with a unified text-to-text transformer. JMLR, 21(140):1–67, 2020.
|
| 209 |
+
Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In EMNLP, 2020.
|
| 210 |
+
Chuanqi Tan, Fuchun Sun, Tao Kong, Wenchang Zhang, Chao Yang, and Chunfang Liu. A survey on deep transfer learning. In ICANN, 2018.
|
| 211 |
+
Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023.
|
| 212 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
|
| 213 |
+
Mojtaba Valipour, Mehdi Rezagholizadeh, Ivan Kobyzev, and Ali Ghodsi. Dylora: Parameter-efficient tuning of pre-trained models using dynamic search-free low-rank adaptation. In EACL, 2023.
|
| 214 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
|
| 215 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR, 2019.
|
| 216 |
+
Yaqing Wang, Subhabrata Mukherjee, Xiaodong Liu, Jing Gao, Ahmed Hassan Awadallah, and Jianfeng Gao. Adamix: Mixture-of-adapter for parameter-efficient tuning of large language models. In EMNLP, 2022.
|
| 217 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. Huggingface’s transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019.
|
| 218 |
+
Elad Ben Zaken, Shauli Ravfogel, and Yoav Goldberg. Bitfit: Simple parameter-efficient fine-tuning for transformer-based masked language-models. arXiv preprint arXiv:2106.10199, 2021.
|
| 219 |
+
Longteng Zhang, Lin Zhang, Shaohuai Shi, Xiaowen Chu, and Bo Li. Lora-fa: Memory-efficient low-rank adaptation for large language models fine-tuning. arXiv preprint arXiv:2308.03303, 2023.
|
| 220 |
+
Qingru Zhang, Minshuo Chen, Alexander Bukharin, Pengcheng He, Yu Cheng, Weizhu Chen, and Tuo Zhao. Adaptive budget allocation for parameter-efficient fine-tuning. In ICLR, 2022.
|
| 221 |
+
Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In CVPR, 2021.
|
| 222 |
+
Han Zhou, Xingchen Wan, Ivan Vulic, and Anna Korhonen. Autopeft: Automatic configuration ´ search for parameter-efficient fine-tuning. arXiv preprint arXiv:2301.12132, 2023.
|
| 223 |
+
|
| 224 |
+
# A APPENDIX
|
| 225 |
+
|
| 226 |
+
# A.1 BASELINES
|
| 227 |
+
|
| 228 |
+
We compare our proposed method Delta-LoRA with Fine-Tuning and prior works of LoRA, AdaLoRA, and DyLoRA. For PEFT methods, we only train the incremental updates for $W _ { V }$ and $W _ { Q }$ , following the setup as used in LoRA’s paper. For Fine-Tuning methods, we use two extra training paradigms: (1) freeze the embedding and train all the other parameters as Fine-Tuning $\dagger$ ; (2) train $W _ { V }$ and $W _ { Q }$ only as Fine-Tuning‡.
|
| 229 |
+
|
| 230 |
+
Fine-Tuning. In the past few years, fine-tuning has become the mainstream paradigm for both NLP and CV tasks. However, fine-tuning full parameters is subject to potential drawbacks including overfitting and training instability (Huang et al., 2022). Therefore, freezing a subset of network layers and fine-tuning the rest has become a popular choice (Tan et al., 2018). In our experiments, we compare with full fine-tuning, fine-tuning with embedding layers frozen (Fine-tuning $\dagger .$ ) and fine-tuning query and value matrices only (Fine-tuning $\ddagger$ ).
|
| 231 |
+
|
| 232 |
+
LoRA (Hu et al., 2022) uses multiplication of two low-rank matrices to learn the incremental updates with reduced GPU memory cost. We follow their setups to reproduce experimental results for fair comparison.
|
| 233 |
+
|
| 234 |
+
DyLoRA (Valipour et al., 2023) randomly chooses a rank $r$ for LoRA modules during learning.
|
| 235 |
+
|
| 236 |
+
AdaLoRA (Zhang et al., 2022) focuses on the challenge of determining the optimal rank for incremental updates. It employs an adaptive approach to singular value pruning, tailoring the rank selection to the magnitude of each singular value. Consequently, distinct ranks are employed for different layers.
|
| 237 |
+
|
| 238 |
+
A.2 THE COMPARISON BETWEEN LORA AND DELTA-LORA WITH LLAMA-7B
|
| 239 |
+
|
| 240 |
+
# A.2.1 TRAINING AND INFERENCE ARGUMENTS USED IN OUR METHOD AND BASELINE
|
| 241 |
+
|
| 242 |
+
We choose LLaMA-7B to evaluate our method and LoRA. Here, we set the learning rate $\gamma = 1 \mathrm { e } { - } 4$ , batch size to 128, $r = 8$ , $\alpha = 1 6$ , and training epochs to 3 for both two methods. Following the LoRA’s paper, we only tune $W _ { Q }$ and $W _ { V }$ . For Delta-LoRA, we choose start steps $K = 1 0 0$ and $\lambda = 0 . 2 5$ . When inference, we set the no_repeat_ngram_size $= 1 0$ , temperature ${ } = 0$ and beam size $=$ 4 to get a certain answer.
|
| 243 |
+
|
| 244 |
+
# A.2.2 THE EVALUATION FOR OUR METHOD AND BASELINES
|
| 245 |
+
|
| 246 |
+
Current LLMs obtain the training data from the Internet, which may unintentionally cause data leakage. Therefore, using the mainstream NLP datasets to evaluate the effectiveness of Large Language Model is not reasonable and wisdom. Inspired by evaluation approach proposed by Liu et al. (2023), we decided to use GPT-4 to judge the text generated by which method is accurate. First, we ask GPT-4 to generate 1,000 different questions. Second, we use the LLaMA-7B trained by two methods to generate the texts. Finally, we ask GPT-4 to give decision to tell us which text is accurate. It can choose from three options: a. Choice 1 (LoRA generates accurate text), b. Choice 2 (Delta-LoRA generates accurate text) and c. Both Choice 1 and 2 (Both LoRA and Delta-LoRA generate accurate texts). The prompt we used for evaluation:
|
| 247 |
+
|
| 248 |
+
Help me to determine which text is accurate for the given instruction and question. The answer can be chosen from a. Choice 1 is accurate, b. Choice 2 is accurate or c. both Choice 1 and 2 are accurate. Give me a certain answer and this is a choice question. Please don’t give reasons and the answer must be shorter than 20 words.
|
| 249 |
+
|
| 250 |
+
Question: "" (Choice 1): "" (Choice 2): ""
|
| 251 |
+
|
| 252 |
+
# A.3 ALGORITHM OF DELTA-LORA
|
| 253 |
+
|
| 254 |
+
Our Delta-LoRA can be found in Algorithm 1. Compared to LoRA, we added a step to update the pre-trained $W$ without any extra GPU memory consumption.
|
| 255 |
+
|
| 256 |
+
Algorithm 1: Delta-LoRA
|
| 257 |
+
|
| 258 |
+
<table><tr><td>Input: Learning rate n; weight decay β; total training iterations T; low rank r; scale factor α; start steps K;update ratio 入. A is initialized by Kaiming Initialization, B= O and W is initialized with pre-trained weights. fort=0,..,T-1do Sample a mini-batch and compute gradients for {A,B} in each Delta-LoRA module.</td></tr><tr><td>Update the first and second moments maintained by the optimizer with the computed gradients,</td></tr><tr><td>and get the normalized gradients gA and gB . A(t+1) ← A(t)-ngA-nβA6) B(t+1)←B(t)-ngB-nβB(t)</td></tr><tr><td>ift>Kdo W(t+1) ←W(t) +λ··(A(t+1)B(t+1)-A(t)B(t))</td></tr><tr><td>end if end for</td></tr><tr><td>Output: the fine-tuned parameters {W(T),A(T), B(T) }</td></tr></table>
|
| 259 |
+
|
| 260 |
+
# A.4 A FURTHER UNDERSTANDING OF DELTA-LORA
|
| 261 |
+
|
| 262 |
+
A.4.1 THE DIFFERENCES BETWEEN LORA AND DELTA-LORA
|
| 263 |
+
|
| 264 |
+
There are some fundamental differences between LoRA and Delta-LoRA.
|
| 265 |
+
|
| 266 |
+
• Given $W + A B$ , $W$ is fixed in LoRA, but $W$ will be updated in our Delta-LoRA. This is the largest difference between LoRA and Delta-LoRA. This modification can yield more training differences between LoRA and Delta-LoRA in the next few training steps.
|
| 267 |
+
|
| 268 |
+
$\cdot$ $\mathrm { R a n k } ( \Delta W _ { D e l t a - L o R A } ) = \mathrm { R a n k } ( W ^ { ( T ) } - W ^ { ( 0 ) } + A B ) > \mathrm { R a n k } ( \Delta W _ { L o R A } ) = \mathrm { R a n k } ( A B ) .$ The rank of the learned incremental weight matrix in our Delta-LoRA is larger than that in the original LoRA.
|
| 269 |
+
|
| 270 |
+
$\bullet$ The gradient flow is different between LoRA and Delta-LoRA. Suppose that we have $\pmb { W } \in \mathbb { R } ^ { m \times n }$ , $\pmb { A } \in \mathbb { R } ^ { m \times r }$ and $\boldsymbol { B } \in \mathbb { R } ^ { r \times n }$ , where $r \leq \operatorname* { m i n } ( m , n )$ . For LoRA, it keeps $W$ frozen, so that $W ^ { * } =$ $\begin{array} { r } { { \cal W } ^ { ( 0 ) } + \frac { \alpha } { r } \cdot { \cal A } ^ { ( t ) } { \cal B } ^ { ( t ) } } \end{array}$ . For Delta-LoRA, it updates all matrices, and has $\begin{array} { r } { W ^ { * } = W ^ { ( t ) } + \frac { \alpha } { r } \cdot A ^ { ( t ) } B ^ { ( t ) } } \end{array}$ .
|
| 271 |
+
|
| 272 |
+
$$
|
| 273 |
+
\frac \left[ \begin{array} { l l l l } { \displaystyle \frac { A ^ { h _ { i } } } { \eta } } & { \displaystyle + \frac { \eta } { \eta } } & { \displaystyle } & { \right] } \left[ \begin{array} { l l l l } { \displaystyle \frac { A ^ { h _ { i } } } { \eta } } & { \displaystyle + \frac { \eta } { \eta } } & { \displaystyle h _ { i + 1 } = h _ { i } A } & { h _ { i + 1 } \in \mathbb R ^ { h \times r } } \\ { \displaystyle \frac { A ^ { h } } { \eta } } & { \displaystyle \frac { A ^ { h } } { \eta } } & { h _ { i + 1 } } & { h _ { i + 2 } = h _ { i + 1 } B } & { h _ { i + 2 } \in \mathbb R ^ { h \times n } } \\ { \displaystyle \frac { \left[ \begin{array} { l l l l } { \displaystyle h _ { i + 3 } } & { \displaystyle - \frac { A ^ { h } } { \eta } } & { \displaystyle h _ { i + 2 } } & { \displaystyle h _ { i + 3 } = h _ { i } W } & { h _ { i + 3 } \in \mathbb R ^ { b \times n } } \\ { \displaystyle h _ { i + 4 } } & { \displaystyle } & { \displaystyle } & { } \end{array} \right] } { \le\right]ft[ \begin{array} { l } { \displaystyle h _ { i + 3 } } \\ { \displaystyle h _ { i + 4 } } \end{array} \right] } } \end{array} \end{array}
|
| 274 |
+
$$
|
| 275 |
+
|
| 276 |
+
Figure 4: The backward propagation of Delta-LoRA.
|
| 277 |
+
|
| 278 |
+
So, we have the following equation according to Figure 4:
|
| 279 |
+
|
| 280 |
+
$$
|
| 281 |
+
\begin{array} { r l } & { \frac { \partial \mathcal { L } } { \partial W ^ { ( t ) } } = ( \frac { \partial h _ { i + 3 } } { \partial W ^ { ( t ) } } ) ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } = h _ { i } ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } } \\ & { \frac { \partial \mathcal { L } } { \partial A ^ { ( t ) } } = ( \frac { \partial h _ { i + 1 } } { \partial A ^ { ( t ) } } ) ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } \cdot \frac { \partial h _ { i + 4 } } { \partial h _ { i + 2 } } \cdot \frac { \partial h _ { i + 2 } } { \partial h _ { i + 1 } } = h _ { i } ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } \frac { \partial h _ { i + 2 } } { \partial h _ { i + 1 } } = h _ { i } ^ { \top } \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } B ^ { ( t ) \top } = \frac { \partial \mathcal { L } } { \partial W ^ { ( t ) } } \cdot B ^ { ( t ) \top } } \end{array}
|
| 282 |
+
$$
|
| 283 |
+
|
| 284 |
+
$\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial B ^ { ( t ) } } = ( \frac { \partial h _ { i + 1 } } { \partial B ^ { ( t ) } } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } \cdot \frac { \partial h _ { i + 4 } } { \partial h _ { i + 2 } } = h _ { i + 2 } ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } = ( A ^ { ( t ) } ) ^ { \top } \cdot h _ { i } ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial h _ { i + 4 } } = ( A ^ { ( t ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial W ^ { ( t ) } } } \end{array}$ Here, we provide the back-propagation process of LoRA:
|
| 285 |
+
|
| 286 |
+
$$
|
| 287 |
+
\begin{array} { r l } & { \frac { \partial \mathcal { L } } { \partial A ^ { ( t + 1 ) } } = \frac { \partial \mathcal { L } } { \partial W ^ { ( t + 1 ) } } \cdot ( B ^ { ( t + 1 ) } ) ^ { \top } = \frac { \partial \mathcal { L } } { \partial ( W ^ { ( 0 ) } + ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ) } \cdot ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ^ { \top } } \\ & { \frac { \partial \mathcal { L } } { \partial B ^ { ( t + 1 ) } } = ( A ^ { ( t + 1 ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial W ^ { ( t + 1 ) } } = ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial ( W ^ { ( 0 ) } + ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ) } } \end{array}
|
| 288 |
+
$$
|
| 289 |
+
|
| 290 |
+
This is the back-propagation process of Delta-LoRA:
|
| 291 |
+
|
| 292 |
+
$$
|
| 293 |
+
\begin{array} { r l } & { \frac { \partial \mathcal { L } } { \partial A ^ { ( t + 1 ) } } = \frac { \partial \mathcal { L } } { \partial W ^ { ( t + 1 ) } } \cdot ( B ^ { ( t + 1 ) } ) ^ { \top } = \frac { \partial \mathcal { L } } { \partial ( ( W ^ { ( t ) } + \lambda \Delta A ^ { ( t ) } B ^ { ( t ) } ) + ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) } \cdot ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ^ { \top } } \\ & { \frac { \partial \mathcal { L } } { \partial B ^ { ( t + 1 ) } } = ( A ^ { ( t + 1 ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial W ^ { ( t + 1 ) } } = ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ^ { \top } \cdot \frac { \partial \mathcal { L } } { \partial ( ( W ^ { ( t ) } + \lambda \Delta A ^ { ( t ) } B ^ { ( t ) } ) + ( A ^ { ( t ) } + \Delta A ^ { ( t ) } ) ( B ^ { ( t ) } + \Delta B ^ { ( t ) } ) ) } } \end{array}
|
| 294 |
+
$$
|
| 295 |
+
|
| 296 |
+
# A.4.2 THE EXPANSION OF $\triangle { A B }$
|
| 297 |
+
|
| 298 |
+
In the real training process, we need to consider a variety of training arguments, such as optimizer and the regularization for $\triangle A B$ . Suppose that we use the AdamW (Loshchilov & Hutter, 2019) and $L _ { 2 }$ regularization, the $\triangle A B$ can be expanded in the following equation:
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
\begin{array} { r l } & { \triangle A B = A ^ { ( t + 1 ) } B ^ { ( t + 1 ) } - A ^ { ( t ) } B ^ { ( t ) } } \\ & { \qquad = ( A ^ { ( t ) } - \eta \hat { g } _ { A } - \eta \beta A ^ { ( t ) } ) \cdot ( B ^ { ( t ) } - \eta \hat { g } _ { B } - \eta \beta B ^ { ( t ) } ) - A ^ { ( t ) } B ^ { ( t ) } } \\ & { \qquad = A ^ { ( t ) } B ^ { ( t ) } - \eta A ^ { ( t ) } \hat { g } _ { B } - \eta \beta A ^ { ( t ) } B ^ { ( t ) } - \eta \hat { g } _ { A } B ^ { ( t ) } + \eta ^ { 2 } \hat { g } _ { A } \hat { g } _ { B } + \eta ^ { 2 } \beta \hat { g } _ { A } B ^ { ( t ) } } \\ & { \qquad - \eta \beta A ^ { ( t ) } B ^ { ( t ) } + \eta ^ { 2 } \beta A ^ { ( t ) } \hat { g } _ { B } + \eta ^ { 2 } \beta ^ { 2 } A ^ { ( t ) } B ^ { ( t ) } - A ^ { ( t ) } B ^ { ( t ) } } \\ & { \qquad = - \eta A ^ { ( t ) } \hat { g } _ { B } - \eta \beta A ^ { ( t ) } B ^ { ( t ) } - \eta \hat { g } _ { A } B ^ { ( t ) } + \eta ^ { 2 } \hat { g } _ { A } \hat { g } _ { B } + \eta ^ { 2 } \beta \hat { g } _ { A } B ^ { ( t ) } } \\ & { \qquad - \eta \beta A ^ { ( t ) } B ^ { ( t ) } + \eta ^ { 2 } \beta A ^ { ( t ) } \hat { g } _ { B } + \eta ^ { 2 } \beta ^ { 2 } A ^ { ( t ) } B ^ { ( t ) } } \\ & { \qquad \approx - \eta A ^ { ( t ) } \hat { g } _ { B } - \eta \hat { g } _ { A } B ^ { ( t ) } } \end{array}
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
where $\eta$ is the learning rate, $\beta$ is weight decay. What’s more, for pre-trained weight $W , \triangle W =$ $\eta \widehat { g } _ { W } + \eta \beta W ^ { ( t ) }$ . As a consequence, $\triangle A B$ is not equal to $\triangle W$ in the training process.
|
| 305 |
+
|
| 306 |
+
A.5 CHANGE THE LEARNING RATE AND START STEPS TO SHOW BETTER PERFORMANCE.
|
| 307 |
+
|
| 308 |
+
We explored better hyper parameters of our Delta-LoRA by modifying the learning rate and trying more start steps and update ratio to prove the effectiveness of Delta-LoRA.
|
| 309 |
+
|
| 310 |
+
Table 8: The evaluation results of our proposed Delta-LoRA by using better hyper-parameters on GLUE benchmark.
|
| 311 |
+
|
| 312 |
+
<table><tr><td>Method</td><td>MNLI</td><td> SST-2</td><td>MRPC</td><td>CoLA</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td><td>AVG</td></tr><tr><td>LoRA</td><td>87.40</td><td>94.61</td><td>89.95</td><td>63.17</td><td>93.02</td><td>90.67</td><td>86.64</td><td>91.54</td><td>87.12</td></tr><tr><td>DyLoRA</td><td>86.33</td><td>94.26</td><td>89.46</td><td>61.12</td><td>92.22</td><td>90.17</td><td>84.47</td><td>91.06</td><td>86.14</td></tr><tr><td>AdaLoRA</td><td>87.34</td><td>94.49</td><td>90.19</td><td>61.64</td><td>93.08</td><td>90.14</td><td>85.19</td><td>91.16</td><td>86.65</td></tr><tr><td>Delta-LoRA</td><td>87.62±0.21</td><td>95.29±0.23 90.60±0.14</td><td></td><td></td><td>64.64±0.86 93.09±0.15 91.01±0.06 87.00±0.36 91.61±0.04 87.60</td><td></td><td></td><td></td><td></td></tr></table>
|
| 313 |
+
|
| 314 |
+
Table 9: The better training hyper-parameters that we obtained of our proposed Delta-LoRA on GLUE benchmark.
|
| 315 |
+
|
| 316 |
+
<table><tr><td>Hyper-Parameter|MNLI SST-2 MRPC CoLA QNLI QQP RTE STS-B</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Learning Raten|4e-4 5e-4 5e-4 6e-4 3e-4 6e-4 4e-4 4e-4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Start Steps K</td><td>2000400</td><td></td><td>10</td><td>200600400200200</td><td></td><td></td><td></td><td></td></tr><tr><td>Update Ratio入</td><td>0.5</td><td>0.5</td><td>0.5</td><td>1</td><td>1</td><td>0.50.5</td><td></td><td>0.5</td></tr></table>
|
| 317 |
+
|
| 318 |
+
# A.6 THE PARAMETER SENSITIVITY STUDY
|
| 319 |
+
|
| 320 |
+
Table 10: The parameter sensitivity study of update ratio $\lambda$ for our proposed Delta-LoRA on E2E Challenge dataset. The best results are boldfaced.
|
| 321 |
+
|
| 322 |
+
<table><tr><td>入</td><td>BLEU</td><td>NIST</td><td>METEOR</td><td>ROUGE-L</td><td>CIDEr</td></tr><tr><td>0</td><td>68.94</td><td>8.73</td><td>45.27</td><td>70.81</td><td>2.41</td></tr><tr><td>1</td><td>69.77</td><td>8.81</td><td>45.99</td><td>71.58</td><td>2.46</td></tr><tr><td>2</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr><tr><td>3</td><td>70.14</td><td>8.84</td><td>46.39</td><td>71.45</td><td>2.45</td></tr><tr><td>4</td><td>70.03</td><td>8.83</td><td>46.21</td><td>71.56</td><td>2.47</td></tr><tr><td>5</td><td>70.13</td><td>8.85</td><td>46.35</td><td>71.72</td><td>2.48</td></tr></table>
|
| 323 |
+
|
| 324 |
+
Parameter Sensitivity. Here, we explore the hyper-parameter $K$ in Algorithm 1 and $\lambda$ in Equation 6. For the hyper-parameter $K$ , we select it from 0 to 1000 with the interval of 100. From Table 11, we find that our Delta-LoRA could not bring in any improvement before $K = 4 0 0$ , and it will keep a relatively good performance when $K$ is larger than 500. What is more, we choose different numbers for $\lambda$ , ranging from 0 to 5. According to Table 10, the 5 metrics rise rapidly after $\lambda = 0$ and reach best at $\lambda = 2$ , while the performance has small drops on 5 evaluation scores if $\lambda$ is chosen from 3 to 5.
|
| 325 |
+
|
| 326 |
+
Table 11: The parameter sensitivity study of start steps $K$ for our proposed Delta-LoRA on E2E Challenge dataset. The best results are boldfaced.
|
| 327 |
+
|
| 328 |
+
<table><tr><td>K</td><td>BLEU</td><td>NIST</td><td>METEOR</td><td>ROUGE-L</td><td>CIDEr</td></tr><tr><td>0</td><td>69.10</td><td>8.75</td><td>45.54</td><td>71.31</td><td>2.41</td></tr><tr><td>100</td><td>69.97</td><td>8.84</td><td>46.07</td><td>71.40</td><td>2.46</td></tr><tr><td>200</td><td>69.72</td><td>8.83</td><td>45.82</td><td>71.41</td><td>2.43</td></tr><tr><td>300</td><td>69.73</td><td>8.86</td><td>45.98</td><td>71.09</td><td>2.46</td></tr><tr><td>400</td><td>70.18</td><td>8.89</td><td>46.30</td><td>71.66</td><td>2.49</td></tr><tr><td>500</td><td>70.84</td><td>8.91</td><td>46.47</td><td>72.24</td><td>2.53</td></tr><tr><td>600</td><td>70.38</td><td>8.86</td><td>46.38</td><td>71.70</td><td>2.47</td></tr><tr><td>700</td><td>70.61</td><td>8.89</td><td>46.43</td><td>72.13</td><td>2.51</td></tr><tr><td>800</td><td>70.70</td><td>8.89</td><td>46.30</td><td>71.97</td><td>2.51</td></tr><tr><td>900</td><td>71.00</td><td>8.92</td><td>46.47</td><td>72.04</td><td>2.52</td></tr><tr><td>1000</td><td>70.87</td><td>8.89</td><td>46.31</td><td>72.06</td><td>2.50</td></tr></table>
|
| 329 |
+
|
| 330 |
+
# A.7 HYPER-PARAMETER USED IN OUR EXPERIMENTS
|
| 331 |
+
|
| 332 |
+
We report the hyper-parameter that used in our experiments. Table 12 and Table 13 show the hyperparameter that we used for the training and evaluation on E2E Challenge and WebNLG Challenge 2017 dataset. The Table 14 and Table 15 are the training and evaluation hyper parameter for XSum dataset, and the Table 16 consists of hyper-parameters for 8 datasets in GLUE benchmark.
|
| 333 |
+
|
| 334 |
+
Table 12: The training hyper-parameter used for E2E Challenge and WebNLG Challenge 2017 dataset.
|
| 335 |
+
|
| 336 |
+
<table><tr><td>Hyper-Parameter</td><td>E2E Challenge</td><td>WebNLG Challenge 2017</td></tr><tr><td>Learning Rate n</td><td>2e-4</td><td>2e-4</td></tr><tr><td>Batch Size</td><td>8</td><td>8</td></tr><tr><td>Number of Epochs</td><td>5</td><td>5</td></tr><tr><td>Weight Decay β</td><td>0.01</td><td>0.01</td></tr><tr><td>Resid_pdrop</td><td>0</td><td>0.09</td></tr><tr><td>Attn_pdrop</td><td>0</td><td>0.09</td></tr><tr><td>Embd_pdrop</td><td>0</td><td>0</td></tr><tr><td>Label Smooth</td><td>0</td><td>0</td></tr><tr><td> Start Steps K</td><td>500</td><td>500</td></tr><tr><td>Update Ratio 入</td><td>2</td><td>5</td></tr><tr><td>Rank r</td><td>4</td><td>4</td></tr><tr><td>Alpha α</td><td>32</td><td>32</td></tr><tr><td>Trainable Matrices</td><td>Wq,Wv</td><td>Wq,Wv</td></tr><tr><td>LR Scheduler</td><td>Linear</td><td>Linear</td></tr><tr><td>Warmup Steps</td><td>500</td><td>500</td></tr></table>
|
| 337 |
+
|
| 338 |
+
Table 13: The hyper-parameter for evaluation used for E2E Challenge and WebNLG Challenge 2017 dataset.
|
| 339 |
+
|
| 340 |
+
<table><tr><td>Hyper-Parameter</td><td>E2E Challenge</td><td>WebNLG Challenge 2017</td></tr><tr><td>Beam Size</td><td>10</td><td>5</td></tr><tr><td>Penalty</td><td>0.8</td><td>1.0</td></tr><tr><td>No Repeat Ngram Size</td><td>4</td><td>4</td></tr></table>
|
| 341 |
+
|
| 342 |
+
Table 14: The training hyper-parameter used for XSum dataset.
|
| 343 |
+
|
| 344 |
+
<table><tr><td>Hyper-Parameter</td><td>Xsum</td></tr><tr><td>Learning Rate n</td><td>2e-4</td></tr><tr><td>Batch Size</td><td>64</td></tr><tr><td>Number of Epochs</td><td>25</td></tr><tr><td>Weight Decay β</td><td>0</td></tr><tr><td>Activation Dropout</td><td>0</td></tr><tr><td>Dropout Classifier Dropout</td><td>0</td></tr><tr><td>Start Steps K</td><td>0</td></tr><tr><td></td><td>1000</td></tr><tr><td>Update Ratio 入</td><td>0.5</td></tr><tr><td>Rank r</td><td>4</td></tr><tr><td>Alpha α Trainable Matrices</td><td>32</td></tr><tr><td>LR Scheduler</td><td>Wq, Wv Linear</td></tr><tr><td>Warmup Steps</td><td>3000</td></tr></table>
|
| 345 |
+
|
| 346 |
+
Table 15: The hyper-parameter for evaluation used for XSum dataset.
|
| 347 |
+
|
| 348 |
+
<table><tr><td>Hyper-Parameter</td><td>Xsum</td></tr><tr><td>Beam Size</td><td>8</td></tr><tr><td>Penalty</td><td>1.0</td></tr><tr><td>No Repeat N-gram Size</td><td>4</td></tr></table>
|
| 349 |
+
|
| 350 |
+
Table 16: The training hyper-parameters of our proposed Delta-LoRA on GLUE benchmark. We adopt the most of hyper-parameters in LoRA’s paper and implement our method based on the codes given by LoRA’s repository.
|
| 351 |
+
|
| 352 |
+
<table><tr><td>Hyper-Parameter</td><td>MNLI</td><td>SST-2</td><td>MRPC</td><td>CoLA</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td></tr><tr><td>Learning Rate n</td><td>5e-4</td><td>5e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td><td>4e-4</td></tr><tr><td>Batch Size</td><td>128</td><td>128</td><td>128</td><td>64</td><td>256</td><td>128</td><td>128</td><td>128</td></tr><tr><td>Number of Epochs</td><td>30</td><td>60</td><td>30</td><td>80</td><td>25</td><td>25</td><td>80</td><td>40</td></tr><tr><td>Weight Decay β</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Max Sequence Length</td><td>256</td><td>256</td><td>256</td><td>256</td><td>256</td><td>256</td><td>512</td><td>256</td></tr><tr><td>Start Steps K</td><td>2000</td><td>400</td><td>10</td><td>100</td><td>800</td><td>400</td><td>200</td><td>200</td></tr><tr><td>Update Ratio 入</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td><td>0.5</td></tr><tr><td>Rank r</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td><td>8</td></tr><tr><td>Alpha α</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td><td>16</td></tr><tr><td>LR Scheduler</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td></tr><tr><td>Trainable Matrices</td><td>WQ,Wv WQ.Wv WQ,Wv</td><td></td><td></td><td>Wq,Wv</td><td></td><td></td><td></td><td> WQ,Wv WQ,Wv WQ,Wv WQ.Wv</td></tr><tr><td>Warmup Ratio</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td><td>0.06</td></tr><tr><td>Evaluation Metrics</td><td></td><td>Accuracy Accuracy Accuracy</td><td></td><td> Mthtion Accuracy Accuracy Accuracy</td><td></td><td></td><td></td><td>Pearson</td></tr></table>
|
md/test/QAwaaLJNCk/QAwaaLJNCk.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/Rc7dAwVL3v/Rc7dAwVL3v.md
ADDED
|
@@ -0,0 +1,507 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NaturalSpeech 2: LATENT DIFFUSION MODELS ARE NATURAL AND ZERO-SHOT SPEECH AND SINGING SYNTHESIZERS
|
| 2 |
+
|
| 3 |
+
Kai Shen∗, Zeqian Ju∗, Xu Tan∗, Yanqing Liu, Yichong Leng, Lei He
|
| 4 |
+
Tao Qin, Sheng Zhao, Jiang Bian
|
| 5 |
+
Zhejiang University
|
| 6 |
+
Microsoft Research Asia & Microsoft Azure Speech
|
| 7 |
+
University of Science and Technology of China
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Scaling text-to-speech (TTS) to large-scale, multi-speaker, and in-the-wild datasets is important to capture the diversity in human speech such as speaker identities, prosodies, and styles (e.g., singing). Current large TTS systems usually quantize speech into discrete tokens and use language models to generate these tokens one by one, which suffer from unstable prosody, word skipping/repeating issue, and poor voice quality. In this paper, we develop NaturalSpeech 2, a TTS system that leverages a neural audio codec with residual vector quantizers to get the quantized latent vectors and uses a diffusion model to generate these latent vectors conditioned on text input. To enhance the zero-shot capability that is important to achieve diverse speech synthesis, we design a speech prompting mechanism to facilitate in-context learning in the diffusion model and the duration/pitch predictor. We scale NaturalSpeech 2 to large-scale datasets with 44K hours of speech and singing data and evaluate its voice quality on unseen speakers. NaturalSpeech 2 outperforms previous TTS systems by a large margin in terms of prosody/timbre similarity, robustness, and voice quality in a zero-shot setting, and performs novel zero-shot singing synthesis with only a speech prompt. Audio samples are available at https://speechresearch.github.io/naturalspeech2.
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
Figure 1: The overview of NaturalSpeech 2, with an audio codec encoder/decoder and a latent diffusion model conditioned on a prior (a phoneme encoder and a duration/pitch predictor). The details of in-context learning in the duration/pitch predictor and diffusion model are shown in Figure 2.
|
| 15 |
+
|
| 16 |
+
# 1 INTRODUCTION
|
| 17 |
+
|
| 18 |
+
Human speech is full of diversity, with different speaker identities (e.g., gender, accent, timbre), prosodies, styles (e.g., speaking, singing), etc. Text-to-speech (TTS) (Taylor, 2009; Tan et al., 2021) aims to synthesize natural and human-like speech with both good quality and diversity. With the development of neural networks and deep learning, TTS systems (Wang et al., 2017; Shen et al., 2018; Li et al., 2019; Ren et al., 2019; 2021a; Liu et al., 2021; 2022b; Kim et al., 2021; Tan et al., 2022) have achieved good voice quality in terms of intelligibility and naturalness, and some systems (e.g., NaturalSpeech (Tan et al., 2022; Jia et al., 2021)) even achieves human-level voice quality on single-speaker recording-studio benchmarking datasets (e.g., LJSpeech (Ito, 2017)). Given the great achievements in speech intelligibility and naturalness made by the whole TTS community, now we enter a new era of TTS where speech diversity becomes more and more important in order to synthesize natural and human-like speech.
|
| 19 |
+
|
| 20 |
+
Previous speaker-limited recording-studio datasets are not enough to capture the diverse speaker identities, prosodies, and styles in human speech due to limited data diversity. Instead, we can train TTS models on a large-scale corpus to learn these diversities, and as a by-product, these trained models can generalize to the unlimited unseen scenarios with few-shot or zero-shot technologies. Current large-scale TTS systems (Wang et al., 2023; Kharitonov et al., 2023; Xue et al., 2023) usually quantize the speech waveform into discrete tokens and model these tokens with autoregressive language models. This pipeline suffers from several limitations: 1) The speech (discrete token) sequence is usually very long (a 10s speech usually has thousands of discrete tokens) and the autoregressive models suffer from error propagation and thus unstable speech outputs. 2) There is a dilemma between the codec and language model: on the one hand, the codec with token quantization (VQ-VAE (van den Oord et al., 2017; Razavi et al., 2019) or VQ-GAN (Esser et al., 2021)) usually has a low bitrate token sequence, which, although eases the language model generation, incurs information loss on the high-frequency fine-grained acoustic details; on the other hand, some improving methods (Zeghidour et al., 2021; Défossez et al., 2022) use multiple residual discrete tokens to represent a speech frame, which increases the length of the token sequence multiple times if flattened and incurs difficulty in language modeling.
|
| 21 |
+
|
| 22 |
+
In this paper, we propose NaturalSpeech 2, a TTS system with latent diffusion models to achieve expressive prosody, good robustness, and most importantly strong zero-shot ability for speech synthesis. As shown in Figure 1, we first train a neural audio codec that converts a speech waveform into a sequence of latent vectors with a codec encoder, and reconstructs the speech waveform from these latent vectors with a codec decoder. After training the audio codec, we use the codec encoder to extract the latent vectors from the speech in the training set and use them as the target of the latent diffusion model, which is conditioned on prior vectors obtained from a phoneme encoder, a duration predictor, and a pitch predictor. During inference, we first generate the latent vectors from the text/phoneme sequence using the latent diffusion model and then generate the speech waveform from these latent vectors using the codec decoder.
|
| 23 |
+
|
| 24 |
+
Table 1: The comparison between NaturalSpeech 2 and previous large-scale TTS systems (Wang et al., 2023; Kharitonov et al., 2023; Xue et al., 2023).
|
| 25 |
+
|
| 26 |
+
<table><tr><td>Methods</td><td>Previous Large-Scale Systems</td><td>NaturalSpeech 2</td></tr><tr><td>Representations</td><td>Discrete Tokens</td><td>Continuous Vectors</td></tr><tr><td>Generative Models</td><td>Autoregressive Models</td><td>Non-Autoregressvie/Diffusion</td></tr><tr><td>In-Context Learning</td><td>Both Text and Speech are Needed</td><td>Only Speech is Needed</td></tr><tr><td>Stability/Robustness?</td><td></td><td>√</td></tr><tr><td>One Acoustic Model?</td><td>×</td><td>√</td></tr><tr><td>Beyond TTS (e.g., Singing)?</td><td>×</td><td><</td></tr></table>
|
| 27 |
+
|
| 28 |
+
We elaborate on some design choices in NaturalSpeech 2 (shown in Table 1) as follows.
|
| 29 |
+
|
| 30 |
+
• Continuous vectors instead of discrete tokens. To ensure the speech reconstruction quality of the neural codec, previous works usually quantize speech with multiple residual quantizers. As a result, the obtained discrete token sequence is very long (e.g., if using 8 residual quantizers for each speech frame, the resulting flattened token sequence will be 8 times longer), and puts much pressure on the acoustic model (autoregressive language model). Therefore, we use continuous vectors instead of discrete tokens, which can reduce the sequence length and increase the amount of information for fine-grained speech reconstruction (see Section 3.1).
|
| 31 |
+
|
| 32 |
+
• Diffusion models instead of autoregressive models. We leverage diffusion models to learn the complex distributions of continuous vectors in a non-autoregressive manner and avoid error propagation in autoregressive models (see Section 3.2). • Speech prompting for in-context learning. To encourage the model to follow the speech prompt characteristics and enhance the zero-shot capability, we design speech prompting mechanisms to facilitate in-context learning in the diffusion model and pitch/duration predictors (see Section 3.3).
|
| 33 |
+
|
| 34 |
+
Benefiting from these designs, NaturalSpeech 2 is more stable and robust than previous autoregressive models, and only needs one acoustic model (the diffusion model) instead of two-stage token prediction as in (Borsos et al., 2022; Wang et al., 2023), and can extend the styles beyond TTS (e.g., singing voice) due to the duration/pitch prediction and non-autoregressive generation.
|
| 35 |
+
|
| 36 |
+
We scale NaturalSpeech 2 to 400M model parameters and 44K hours of speech data, and generate speech with diverse speaker identities, prosody, and styles (e.g., singing) in zero-shot scenarios (given only a few seconds of speech prompt). Experiment results show that NaturalSpeech 2 can generate natural speech in zero-shot scenarios and outperform the previous strong TTS systems. Specifically, 1) it achieves more similar prosody with both the speech prompt and ground-truth speech; 2) it achieves comparable or better naturalness (in terms of CMOS) than the ground-truth speech on LibriSpeech and VCTK test sets; 3) it can generate singing voices in a novel timbre either with a short singing prompt, or interestingly with only a speech prompt, which unlocks the truly zero-shot singing synthesis (without a singing prompt). Audio samples can be found in https://speechresearch.github.io/naturalspeech2.
|
| 37 |
+
|
| 38 |
+
# 2 BACKGROUND
|
| 39 |
+
|
| 40 |
+
We present the background of NaturalSpeech 2, encompassing the pursuit of high-quality, natural voice in text-to-speech synthesis, neural audio codec models, and generative audio synthesis models.
|
| 41 |
+
|
| 42 |
+
TTS for Natural Voice. Text-to-speech systems (Tan et al., 2021; Wang et al., 2017; Li et al., 2019; Ren et al., 2019; Liu et al., 2021; 2022b;a; Jiang et al., 2021; Ye et al., 2023; Kim et al., 2021; Tan et al., 2022) aim to generate natural voice with both high quality and diversity. Since TTS systems have achieved good voice quality, recent works attempt to scale the TTS systems to large-scale, multi-speaker, and in-the-wild datasets to pursue diversity (Betker, 2023; Borsos et al., 2023; Zhang et al., 2023). Some works (Jiang et al., 2023b; Le et al., 2023; Li et al., 2023) propose to generate mel-spectrogram by flow-matching (Lipman et al., 2022) or GAN-based (Goodfellow et al., 2014) generation models in a NAR framework. Since the mel-spectrogram is pre-designed and intuitively less conducive to learning for neural networks, we leverage learnable latent by neural codec as the training objective. In parallel, some works (Borsos et al., 2022; Wang et al., 2023; Kharitonov et al., 2023; Xue et al., 2023; Huang et al., 2023) usually leverage a neural codec to convert speech waveform into discrete token sequence and an autoregressive language model to generate discrete tokens from text, which suffers from a dilemma that:1) Quantizing each frame into one token with vector-quantizer (VQ) (van den Oord et al., 2017; Razavi et al., 2019; Esser et al., 2021) simplifies token generation but compromises waveform quality due to high compression. 2) Quantifying each frame into multiple tokens with residual vector-quantizer (RVQ) (Zeghidour et al., 2021; Défossez et al., 2022) ensures high-fidelity waveform reconstruction but hinders autoregressive model generation due to longer token sequences, causing errors and robustness challenges. Thus, previous works, such as AudioLM (Borsos et al., 2022), leverage three-stage language models to first predict semantic tokens autoregressively, followed by generating coarse-grained tokens per frame and ultimately producing remaining fine-grained tokens. VALL-E tackles this problem using an AR model for the first codec layer tokens and an NAR model for the remaining layer tokens. These methods are complicated and incur cascaded errors. To avoid the above dilemma, we leverage a neural codec with continuous vectors and a latent diffusion model with non-autoregressive generation.
|
| 43 |
+
|
| 44 |
+
Neural Audio Codec. Neural audio codec (Oord et al., 2016; Valin & Skoglund, 2019; Zeghidour et al., 2021; Défossez et al., 2022) refers to a kind of neural network model that converts audio waveform into compact representations with a codec encoder and reconstructs audio waveform from these representations with a codec decoder. SoundStream (Zeghidour et al., 2021) and Encodec (Défossez et al., 2022) leverage vector-quantized variational auto-encoders (VQ-VAE) with multiple residual vector-quantizers to compress speech into multiple tokens, and have been used as the intermediate representations for speech/audio generation (Borsos et al., 2022; Kreuk et al., 2022; Wang et al., 2023; Kharitonov et al., 2023; Xue et al., 2023). Residual vector quantizers provide good reconstruction quality and low bitrate but may not be ideal for speech/audio generation due to their long discrete token sequences ( $R$ times longer if $R$ residual quantizers are used), which makes prediction tasks more challenging and may lead to errors such as word skipping, repetition, or speech collapse. In this paper, we design a neural audio codec that converts waveforms into continuous vectors, retaining fine-grained details for accurate waveform reconstruction without increasing sequence length.
|
| 45 |
+
|
| 46 |
+
Generative Models for Speech Synthesis. Neural TTS systems aim to synthesize high-quality voice. Generative models such as language models (Li et al., 2019; Shen et al., 2018; Wu et al., 2023), VAE (Ren et al., 2021b; Lee et al., 2022), Normalization flow (Kim et al., 2021; Miao et al., 2020; Kim et al., 2020), GAN (Kim et al., 2021; Jiang et al., 2023a), diffusion model (Kong et al., 2021; Jeong et al., 2021; Chen et al., 2021a; Popov et al., 2021; Chen et al., 2021b), self-supervised learning methods (Siuzdak et al., 2022; Du et al., 2022) and speech representation learning methods Hsu et al. (2021); Schneider et al. (2019) achieve great success. Among these, autoregressive language models and diffusion models are the two most prominent methods. Although both models are based on iterative computation (following the left-to-right process or the denoising process), autoregressive models are more sensitive to sequence length and error propagation, which cause unstable prosody and robustness issues (e.g., word skipping, repeating, and collapse). Considering text-to-speech has a strict monotonic alignment and strong source-target dependency, we leverage diffusion models enhanced with duration prediction and length expansion, which are free from robust issues.
|
| 47 |
+
|
| 48 |
+
# 3 NATURALSPEECH 2
|
| 49 |
+
|
| 50 |
+
In this section, we introduce NaturalSpeech 2, a TTS system for natural and zero-shot voice synthesis with high fidelity/expressiveness/robustness on diverse scenarios (various speaker identities, prosodies, and styles). As shown in Figure 1, NaturalSpeech 2 consists of a neural audio codec and a diffusion model with a prior model (a phoneme encoder and a duration/pitch predictor). Since speech waveform is complex and high-dimensional, following the paradigm of regeneration learning (Tan et al., 2023), we utilize post-quantized latent vectors $z$ to represent waveform $x$ . Next, we employ a prior model to encode text input $y$ into a prior $c$ , and a diffusion model to predict the latent vectors $z$ conditioned on prior $c$ . Finally, latent vectors $z$ are input into the audio codec decoder to reconstruct the waveform $x$ We introduce the detailed designs of neural audio codec in Section 3.1 and the latent diffusion model in Section 3.2, as well as the speech prompting mechanism for in-context learning in Section 3.3.
|
| 51 |
+
|
| 52 |
+
# 3.1 NEURAL AUDIO CODEC WITH CONTINUOUS VECTORS
|
| 53 |
+
|
| 54 |
+
We use a neural audio codec to convert speech waveform into continuous vectors instead of discrete tokens, as analyzed in Section 2. Audio codec with continuous vectors enjoys several benefits: 1) Continuous vectors have a lower compression rate and higher bitrate than discrete tokens1, which can ensure high-quality audio reconstruction. 2) Each audio frame only has one vector instead of multiple tokens as in discrete quantization, which will not increase the length of the hidden sequence.
|
| 55 |
+
|
| 56 |
+
We employ the SoundStream(Zeghidour et al., 2021) architecture as our neural audio codec, which comprises an audio encoder, a residual vector-quantizer (RVQ), and an audio decoder. The residual vector-quantizer cascades $R$ layers of vector-quantizer (VQ) and transforms the output of the audio encoder into quantized latent vectors, which serve as the training target of the diffusion model. More details about codec are provided in Appendix A.
|
| 57 |
+
|
| 58 |
+
Actually, to obtain continuous vectors, we do not need vector quantizers, but just an autoencoder or variational autoencoder. However, for regularization and efficiency purposes, we use residual vector quantizers with a very large number of quantizers and codebook tokens to approximate the continuous vectors. This provides two benefits: 1) Reduced dataset storage by storing codebook embeddings and quantized token IDs instead of high-dimensional continuous vectors, and 2) the regularization loss on discrete classification based on quantized token IDs (see $\mathcal { L } _ { \mathrm { c e - r v q } }$ in Section 3.2).
|
| 59 |
+
|
| 60 |
+
We leverage a prior model, comprising a phoneme encoder, a duration predictor, and a pitch predictor, to process the text input and provide a more informative hidden vector $c$ . Subsequently, the diffusion model predicts the quantized latent vector $z$ conditioned on hidden vector $c$ .
|
| 61 |
+
|
| 62 |
+
Diffusion Formulation. We formulate the diffusion (forward) process and denoising (reverse) process (Liptser & Shiriiaev, 1977; Sohl-Dickstein et al., 2015; Ho et al., 2020) as a stochastic differential equation (SDE) (Song & Ermon, 2019; 2020; Song et al., 2020), respectively. The forward SDE transforms the latent vectors $z _ { 0 }$ obtained by the neural codec (i.e., $z$ ) into Gaussian noises (Popov et al., 2021):
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\mathrm { d } z _ { t } = - \frac { 1 } { 2 } \beta _ { t } z _ { t } \mathrm { d } t + \sqrt { \beta _ { t } } \mathrm { d } w _ { t } , \quad t \in [ 0 , 1 ] ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $w _ { t }$ is the standard Brownian motion, $t \in [ 0 , 1 ]$ , and $\beta _ { t }$ is a non-negative noise schedule function. Then the solution is given by:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
z _ { t } = e ^ { - \frac { 1 } { 2 } \int _ { 0 } ^ { t } \beta _ { s } d s } z _ { 0 } + \int _ { 0 } ^ { t } \sqrt { \beta _ { s } } e ^ { - \frac { 1 } { 2 } \int _ { 0 } ^ { t } \beta _ { u } d u } \mathrm { d } w _ { s } .
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
By properties of Ito’s integral, the conditional distribution of $z _ { t }$ given $z _ { \mathrm { 0 } }$ is Gaussian: $p ( z _ { t } | z _ { 0 } ) \sim$ $\mathcal { N } ( \rho ( z _ { 0 } , t ) , \Sigma _ { t } )$ , where $\rho ( z _ { 0 } , t ) = e ^ { - \frac { 1 } { 2 } \int _ { 0 } ^ { t } \beta _ { s } d s } z _ { 0 }$ and $\Sigma _ { t } = I - e ^ { - \int _ { 0 } ^ { t } \beta _ { s } d s }$ .
|
| 75 |
+
|
| 76 |
+
The reverse SDE transforms the Gaussian noise back to data $z _ { 0 }$ with the following process:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\mathrm { d } z _ { t } = - ( \frac { 1 } { 2 } z _ { t } + \nabla \log p _ { t } ( z _ { t } ) ) \beta _ { t } \mathrm { d } t + \sqrt { \beta _ { t } } \mathrm { d } \tilde { w } _ { t } , \quad t \in [ 0 , 1 ] ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $\tilde { w }$ is the reverse-time Brownian motion. Moreover, we can consider an ordinary differential equation (ODE) (Song et al., 2020) in the reverse process:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\mathrm { d } z _ { t } = - \frac { 1 } { 2 } ( z _ { t } + \nabla \log p _ { t } ( z _ { t } ) ) \beta _ { t } \mathrm { d } t , \quad t \in [ 0 , 1 ] .
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
We can train a neural network $s _ { \theta }$ to estimate the score $\nabla \log p _ { t } ( z _ { t } )$ (the gradient of the log-density of noisy data), and then we can sample data $z _ { 0 }$ by starting from Gaussian noise $z _ { 1 } \sim \mathcal { N } ( 0 , 1 )$ and numerically solving the SDE in Equation 3 or ODE in Equation 4. In our formulation, the neural network $s _ { \theta } ( z _ { t } , t , c )$ is based on WaveNet (Oord et al., 2016), which takes the current noisy vector $z _ { t }$ , the time step $t$ , and the condition information $c$ as input, and predicts the data $\hat { z } _ { 0 }$ instead of the score, which we found results in better speech quality. Thus, $\hat { z } _ { 0 } = s _ { \theta } ( z _ { t } , t , c )$ . The loss function to train the diffusion model is as follows.
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\begin{array} { r } { \mathcal { L } _ { \mathrm { d i f f } } = \mathbb { E } _ { z _ { 0 } , t } [ | | \hat { z } _ { 0 } - z _ { 0 } | | _ { 2 } ^ { 2 } + | | \Sigma _ { t } ^ { - 1 } ( \rho ( \hat { z } _ { 0 } , t ) - z _ { t } ) - \nabla \log p _ { t } ( z _ { t } ) | | _ { 2 } ^ { 2 } + \lambda _ { c e - r v q } \mathcal { L } _ { \mathrm { c e - r v q } } ] , } \end{array}
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where the first term is the data loss, the second term is the score loss, and the predicted score is calculated by $\Sigma _ { t } ^ { - 1 } ( \rho ( \hat { z } _ { 0 } , t ) - z _ { t } )$ , which is also used for reverse sampling based on Equation 3 or 4 in inference. The third term $\mathcal { L } _ { \mathrm { c e - r v q } }$ is a novel cross-entropy (CE) loss based on residual vector$\hat { z } _ { 0 } - \sum _ { i = 1 } ^ { j - 1 } e _ { i }$ Q). Spe, where $e _ { i }$ fically, for each residual quantizer is the ground-truth quantized emb $j \in [ 1 , R ]$ , wthe $i$ first get the residual vector-th residual quantizer. Then we calculate the L2 distance between the residual vector with each codebook embedding in quantizer $j$ and get a probability distribution with a softmax function, and then calculate the cross-entropy loss between the ID of the ground-truth quantized embedding $e _ { j }$ and this probability distribution. $\mathcal { L } _ { \mathrm { c e - r v q } }$ is the mean of the cross-entropy loss in all $R$ residual quantizers, and $\lambda _ { \mathrm { c e - r v q } }$ is set to 0.1. Please refer to Appendix C.3 for more details of $\mathcal { L } _ { \mathrm { c e - r v q } }$ .
|
| 95 |
+
|
| 96 |
+
Prior Model: Phoneme Encoder and Duration/Pitch Predictor. The phoneme encoder consists of 6 Transformer blocks (Vaswani et al., 2017; Ren et al., 2019), where the standard feed-forward network is modified as a convolutional network to capture the local dependency in phoneme sequence. The duration and pitch predictors utilize a similar model structure, consisting of several convolutional blocks. The ground-truth duration and pitch information is used as the learning target to train the duration and pitch predictors, with an L1 duration loss ${ \mathcal { L } } _ { \mathrm { d u r } }$ and pitch loss $\mathcal { L } _ { \mathrm { p i t c h } }$ . During training, the ground-truth duration is used to expand the hidden sequence from the phoneme encoder to obtain the frame-level hidden sequence, and then the ground-truth pitch information is added to the framelevel hidden sequence to get the final condition information $c$ . During inference, the corresponding predicted duration and pitch are used.
|
| 97 |
+
|
| 98 |
+
The total loss function for the diffusion model is as follows:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\mathcal { L } = \mathcal { L } _ { \mathrm { d i f f } } + \mathcal { L } _ { \mathrm { d u r } } + \mathcal { L } _ { \mathrm { p i t c h } } .
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 2: The speech prompting mechanism in the duration/pitch predictor and the diffusion model for in-context learning. During training, we use a random segment $z ^ { u : v }$ of the target speech $z$ as the speech prompt $z ^ { p }$ and use the diffusion model to only predict $z ^ { \backslash u : v }$ . During inference, we use a reference speech of a specific speaker as the speech prompt $z ^ { p }$ . Note that the prompt is the speech latent obtained by the codec encoder instead of the speech waveform.
|
| 106 |
+
|
| 107 |
+
# 3.3 SPEECH PROMPTING FOR IN-CONTEXT LEARNING
|
| 108 |
+
|
| 109 |
+
To facilitate in-context learning for better zero-shot generation, we design a speech prompting mechanism to encourage the duration/pitch predictor and the diffusion model to follow the diverse information (e.g., speaker identities) in the speech prompt. For a speech latent sequence $z$ , we randomly cut off a segment $z ^ { u : v }$ with frame index from $u$ to $v$ as the speech prompt, and concatenate the remaining speech segments $z ^ { 1 : u }$ and $z ^ { v : n }$ to form a new sequence $z ^ { \backslash u : v }$ as the learning target of the diffusion model. As shown in Figure 2, we use a Transformer-based prompt encoder to process the speech prompt $z ^ { u : v }$ ( $z ^ { p }$ in the figure) to get a hidden sequence. To leverage this hidden sequence as the prompt, we have two different strategies for the duration/pitch predictor and the diffusion model: 1) For the duration and pitch predictors, we insert a Q-K-V attention layer in the convolution layer, where the query is the hidden sequence of the convolution layer, and the key and value is the hidden sequence from the prompt encoder. 2) For the diffusion model, instead of directly attending to the hidden sequence from the prompt encoder that exposes too many details to the diffusion model and may harm the generation, we design two attention blocks: in the first attention block, we use $m$ randomly initialized embeddings as the query sequence to attend to the prompt hidden sequence, and get a hidden sequence with a length of $m$ as the attention results (Wang et al., 2016; 2018; Yin et al., 2022); in the second attention block, we leverage the hidden sequence in the WaveNet layer as the query and the $m$ -length attention results as the key and value. We use the attention results of the second attention block as the conditional information of a FiLM layer (Perez et al., 2018) to perform affine transform on the hidden sequence of the WaveNet in the diffusion model. Please refer to Appendix B for the details of WaveNet architecture used in the diffusion model.
|
| 110 |
+
|
| 111 |
+
# 4 EXPERIMENTS AND RESULTS
|
| 112 |
+
|
| 113 |
+
# 4.1 EXPERIMENTAL SETTINGS
|
| 114 |
+
|
| 115 |
+
In this section, we introduce experimental settings to train and evaluate NaturalSpeech 2, including the dataset, baselines, and evaluation metrics. Please refer to Appendix C for the model configuration and training and inference details.
|
| 116 |
+
|
| 117 |
+
Datasets: To train the neural audio codec and the diffusion model, we use the English subset of Multilingual LibriSpeech (MLS) (Pratap et al., 2020), comprising 44K hours of transcribed audiobook data. It contains 2742 male and 2748 female distinct speakers. We evaluate using two benchmark datasets: 1) LibriSpeech test-clean (Panayotov et al., 2015), with 40 distinct speakers and 5.4 hours of annotated speech; 2) VCTK dataset (Veaux et al., 2016), with 108 distinct speakers. We sample
|
| 118 |
+
|
| 119 |
+
15 and 5 utterances per speaker for LibriSpeech and VCTK, resulting in 600 and 540 evaluation utterances, respectively. For synthesis, a different same-speaker utterance is cropped into a $\sigma$ -second audio segment as a prompt. All speakers in two datasets are unseen during training. Singing datasets follow a similar process, detailed in Section 4.4. See Appendix E for data processing details.
|
| 120 |
+
|
| 121 |
+
Model Comparison: We compare NaturalSpeech 2 with baselines including: 1) YourTTS (Casanova et al., 2022b). 2) FastSpeech 2 (Ren et al., 2021a). We adapt it by adding cross-attention on speech prompts for zero-shot synthesis. Furthermore, we also change the prediction target from the melspectrogram to the latent representation. 3) VALL-E (Wang et al., 2023). 4) FoundationTTS (Xue et al., 2023). 5) Voicebox (Le et al., 2023). 6) MegaTTS (Jiang et al., 2023b). For YourTTS, we use the official code and pre-trained checkpoint2. For FastSpeech 2, VALL-E, and FoundationTTS, we implement them according to the papers. We scale them to 400M parameters and use the same dataset for fair comparison. In addition, for Voicebox, VALL-E, and MegaTTS, since there are no official implementations, we download the audio samples from their demo page and compare them with NaturalSpeech 2 individually. Please refer to Appendix D for more details.
|
| 122 |
+
|
| 123 |
+
Evaluation Metrics: We use both objective and subjective metrics to evaluate the zero-shot synthesis ability of NaturalSpeech 2 and compare it with baselines. Please refer to Appendix F for a more detailed metric description.
|
| 124 |
+
|
| 125 |
+
Objective Metrics: 1) Prosody Similarity with Prompt. Following the practice (Zaïdi et al., 2021), we compare the difference in mean, standard deviation, skewness, and kurtosis of the duration/pitch to assess prosody similarity between synthesized and prompt speech. 2) Word Error Rate. We employ an ASR model to transcribe the generated speech and calculate the word error rate (WER).
|
| 126 |
+
|
| 127 |
+
Subjective Metrics: 1) Intelligibility Score. To test the robustness, following the practice in (Ren et al., 2019), we use the 50 particularly difficult sentences (see Appendix G.2) and conduct an intelligibility test. 2) CMOS and SMOS. We evaluate naturalness using comparative mean option score (CMOS), and speaker similarity using similarity mean option score (SMOS).
|
| 128 |
+
|
| 129 |
+
# 4.2 EXPERIMENTAL RESULTS ON NATURAL AND ZERO-SHOT SYNTHESIS
|
| 130 |
+
|
| 131 |
+
In this section, we conduct experiments comparing the NaturalSpeech 2 with the baselines in terms of: 1) Generation Quality, by evaluating the naturalness of the synthesized audio; 2) Generation Similarity, by evaluating how well the TTS system follows prompts; 3) Robustness, by calculating the WER and an additional intelligibility test. 4) Generation Latency, by evaluating the trade-off between the inference efficiency and generation quality.
|
| 132 |
+
|
| 133 |
+
Generation Quality. We conduct CMOS test to evaluate the generation quality (i.e., naturalness). We randomly select 20 utterances from the LibriSpeech and VCTK tests and crop the prompt speech to 3s. To ensure high-quality generation, we use a speech scoring model (Chen et al., 2022) to filter the multiple samples generated by the diffusion model with different starting Gaussian noises $z _ { 1 }$ Table 2 shows a comparison of NaturalSpeech 2 against baselines and the ground truth. We have several observations: 1) NaturalSpeech 2 is comparable to the ground-truth recording in LibriSpeech $( + 0 . 0 4 $ is regarded as on par) and achieves much better quality on VCTK datasets $( - 0 . 2 1$ is a large gap), which demonstrates the naturalness of the speech generated by NaturalSpeech 2 is high enough. 2) NaturalSpeech 2 outperforms all the baselines by a large margin in both datasets. Specifically, for VALL-E, NaturalSpeech 2 shows 0.29 and 0.31 CMOS gain in LibriSpeech and VCTK, respectively. It demonstrates that the speech generated by NaturalSpeech 2 is much more natural and of higher quality. 3) Using the cases from demo pages, we find NaturalSpeech 2 surpasses the state-of-the-art large-scale TTS systems, which shows the superiority of NaturalSpeech 2.
|
| 134 |
+
|
| 135 |
+
Generation Similarity. We use two metrics to evaluate the speech similarity: 1) prosody similarity between the synthesized and prompt speech. 2) SMOS test. To evaluate the prosody similarity, we randomly sample one sentence for each speaker for both LibriSpeech test-clean and VCTK dataset to form the test sets. Specifically, to synthesize each sample, we randomly and independently sample the prompt speech with $\sigma = 3$ seconds. Note that YourTTS has seen 97 speakers in VCTK in training, but we still compare NaturalSpeech 2 with YourTTS on all the speakers in VCTK (i.e., the 97 speakers are seen to YourTTS but unseen to NaturalSpeech 2).
|
| 136 |
+
|
| 137 |
+
Table 2: The CMOS, SMOS and WER results on LibriSpeech and VCTK with $9 5 \%$ confidence intervals. ⋆ means the results from official demo page. “-" denotes the results are not available. Note that the comparison with demo cases involves pairwise comparisons between NaturalSpeech 2 and baselines across various test cases, rendering the baseline scores in this comparison non-pairwise.
|
| 138 |
+
|
| 139 |
+
<table><tr><td>Dataset</td><td colspan="3">LibriSpeech</td><td colspan="3">VCTK</td></tr><tr><td>Setting</td><td>CMOS↑</td><td>SMOS↑</td><td>WER↓</td><td>CMOS↑</td><td>SMOS↑</td><td>WER↓</td></tr><tr><td>Ground Truth</td><td>+0.04</td><td>4.27±0.10</td><td>1.94</td><td>-0.21</td><td>4.05±0.11</td><td>9.49</td></tr><tr><td>YourTTS (Casanova et al.,2022b)</td><td>-0.65</td><td>3.31±0.09</td><td>7.10</td><td>-0.58</td><td>3.39±0.08</td><td>14.80</td></tr><tr><td>FastSpeech 2 (Ren et al.,2021a)</td><td>-0.53</td><td>3.45±0.08</td><td>2.10</td><td>-0.64</td><td>3.22±0.10</td><td>8.26</td></tr><tr><td>FoundationTTS (Xue et al., 2023)</td><td>-0.32</td><td>3.81±0.12</td><td>4.63</td><td>-0.39</td><td>3.42±0.13</td><td>12.55</td></tr><tr><td>VALL-E (Wang et al., 2023)</td><td>-0.29</td><td>3.92±0.11</td><td>5.72</td><td>-0.31</td><td>3.50±0.10</td><td>14.68</td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>4.06±0.11</td><td>2.01</td><td>0.00</td><td>3.62±0.11</td><td>6.72</td></tr><tr><td>Comparison with demo cases</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VALL-E (Wang et al., 2023)*</td><td>-0.27</td><td>3.98±0.12</td><td></td><td>-0.34</td><td>3.59±0.13</td><td></td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>4.11±0.11</td><td></td><td>0.00</td><td>3.71±0.12</td><td></td></tr><tr><td>MegaTTS (Jiang et al., 2023b)*</td><td>-0.20</td><td>3.96±0.09</td><td>=</td><td>-0.28</td><td>3.63±0.08</td><td></td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>4.10±0.11</td><td>=</td><td>0.00</td><td>3.74±0.10</td><td>=</td></tr><tr><td>Voicebox (Le et al., 2023)*</td><td>-0.11</td><td>3.75±0.11</td><td></td><td></td><td></td><td></td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>3.86±0.11</td><td>=</td><td></td><td></td><td></td></tr></table>
|
| 140 |
+
|
| 141 |
+
Table 3: The prosody similarity between synthesized and prompt speech in terms of the difference in mean (Mean), standard deviation (Std), skewness (Skew), and kurtosis (Kurt) of pitch and duration.
|
| 142 |
+
|
| 143 |
+
<table><tr><td rowspan="2">LibriSpeech</td><td colspan="4">Pitch</td><td colspan="4">Duration</td></tr><tr><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt↓</td><td>Mean↓</td><td>Std↓</td><td>Skew↓</td><td>Kurt↓</td></tr><tr><td>YourTTS</td><td>10.52</td><td>7.62</td><td>0.59</td><td>1.18</td><td>0.84</td><td>0.66</td><td>0.75</td><td>3.70</td></tr><tr><td>FastSpeech 2</td><td>14.61</td><td>9.31</td><td>1.83</td><td>3.15</td><td>0.67</td><td>0.71</td><td>0.77</td><td>3.60</td></tr><tr><td>FoundationTTS</td><td>10.34</td><td>7.04</td><td>0.62</td><td>1.51</td><td>0.67</td><td>0.72</td><td>0.70</td><td>3.38</td></tr><tr><td>VALL-E</td><td>10.23</td><td>6.19</td><td>0.54</td><td>1.09</td><td>0.62</td><td>0.67</td><td>0.64</td><td>3.22</td></tr><tr><td>NaturalSpeech 2</td><td>10.11</td><td>6.18</td><td>0.50</td><td>1.01</td><td>0.65</td><td>0.70</td><td>0.60</td><td>2.99</td></tr></table>
|
| 144 |
+
|
| 145 |
+
We apply the alignment tool to obtain phoneme-level duration and pitch and calculate the prosody similarity metrics between the synthesized speech and the prompt speech as described in Section 4.1. We report the results on LibriSpeech in Table 3 and on VCTK in Appendix H.1. We have the following observations: 1) NaturalSpeech 2 consistently outperforms all the baselines in both LibriSpeech and VCTK on most metrics, which demonstrates that our proposed NaturalSpeech 2 can mimic the prosody of prompt speech much better. 2) Although YourTTS has seen 97 from 108 speakers in VCTK dataset, our model can still outperform it by a large margin. Furthermore, we also compare prosody similarity between synthesized and ground-truth speech in Appendix H.2.
|
| 146 |
+
|
| 147 |
+
We further evaluate speaker similarity using SMOS test. We randomly select 10 utterances from LibriSpeech and VCTK datasets respectively, following the setting in the CMOS test. The prompt speech length is set to 3s. The results are shown in Table 2. We find that NaturalSpeech 2 outperforms all the baselines in two datasets. Specifically, NaturalSpeech 2 outperforms the state-of-the-art method VALL-E by 0.14 and 0.12 SMOS scores for LibriSpeech and VCTK, respectively. It demonstrates that NaturalSpeech 2 is significantly better in speaker similarity.
|
| 148 |
+
|
| 149 |
+
Robustness. We use the full test set of LibriSpeech and VCTK as described in Section 4.1 to synthesize the speech and compute the word error rate (WER) between the transcribed text and ground-truth text. To synthesize each sample, we use a 3-second prompt by randomly cropping the whole prompt speech. The results are shown in Table 2. We observe that: 1) NaturalSpeech 2 significantly outperforms all the baselines in LibriSpeech and VCTK, indicating better synthesis of high-quality and robust speech. 2) Our synthesized speech is comparable to the ground-truth speech in LibriSpeech and surpasses that in VCTK. The higher WER results in VCTK may stem from a noisy environment and the lack of ASR model fine-tuning in that dataset.
|
| 150 |
+
|
| 151 |
+
In addition, we conduct an intelligibility test on 50 particularly hard sentences from FastSpeech (Ren et al., 2019) to evaluate speech robustness. NaturalSpeech 2 demonstrates robustness in these cases without any intelligibility issues. Please refer to Appendix G.1 for the detailed results.
|
| 152 |
+
|
| 153 |
+
Generation Latency. We conduct a comparison of both the latency and generation quality with varying diffusion step $( \{ 2 0 , 5 0 , 1 0 0 , 1 5 0 \} )$ . The comparison also incorporates a NAR baseline (FastSpeech 2) and an AR model (VALL-E). As detailed in Table 12 in Appendix K, the diffusion step of 150 strikes a balance between quality (with a 0.53 CMOS gain over FastSpeech2 and a 0.29 CMOS gain over VALL-E) and latency (12.35 times faster than VALL-E). 2) As the diffusion step decreases, the inference speed increases while there is no noticeable degradation in performance. Please refer to Appendix K for more details.
|
| 154 |
+
|
| 155 |
+
# 4.3 ABLATION STUDY
|
| 156 |
+
|
| 157 |
+
In this section, we perform ablation experiments. 1) To study the effect of the speech prompt, we remove the Q-K-V attention layers in the diffusion (abbr. w/o. diff prompt), and the duration and pitch predictors (abbr. w/o. dur/pitch prompt), respectively. 2) To study the effect of the cross-entropy (CE) loss $\mathcal { L } _ { \mathrm { c e - r v q } }$ based on RVQ, we disable the CE loss by setting $\lambda _ { c e - r v q }$ to 0 (abbr. w/o. CE loss). 3) To study the effectiveness of two Q-K-V attention in speech prompting for diffusion in Section 3.3, we remove the first attention that adopts $m$ randomly initialized query sequence to attend to the prompt hidden and directly use one Q-K-V attention to attend to the prompt hidden (abbr. w/o. query attn). We report CMOS and WER results in Table 4. More detailed results are in Appendix J.
|
| 158 |
+
|
| 159 |
+
We have the following observations: 1) When we disable speech prompt in diffusion, the model can not converge, which highlights its importance for high-quality TTS synthesis. 2) Disabling speech prompt in duration/pitch predictor significantly degrades audio quality (i.e., 0.45 CMOS degradation). In practice, we find that without speech prompt, it can pronounce the words correctly but with poor prosody, which causes CMOS degradation. 3) Disabling CE loss worsens both CMOS and WER performance. It shows that regularization is important for high-quality synthesis and robustness. 4) Disabling the query attention also degrades both CMOS and WER performance. In practice, we find that applying crossattention to prompt hidden will leak details and thus mislead generation.
|
| 160 |
+
|
| 161 |
+
Table 4: The ablation study of NaturalSpeech 2, measured by CMOS and WER. “-" denotes the model can not converge.
|
| 162 |
+
|
| 163 |
+
<table><tr><td></td><td>CMOS</td><td>WER</td></tr><tr><td>NaturalSpeech 2</td><td>0.00</td><td>2.01</td></tr><tr><td>w/o. diff prompt</td><td></td><td></td></tr><tr><td> w/o. dur/pitch prompt</td><td>-0.45</td><td>2.23</td></tr><tr><td>w/o. CE loss</td><td>-0.25</td><td>3.03</td></tr><tr><td> w/o. query attn</td><td>-0.13</td><td>2.65</td></tr></table>
|
| 164 |
+
|
| 165 |
+
# 4.4 ZERO-SHOT SINGING SYNTHESIS
|
| 166 |
+
|
| 167 |
+
In this section, we explore NaturalSpeech 2 to synthesize singing voice in a zero-shot setting, either given a singing prompt or only a speech prompt. We use speech and singing data together to train NaturalSpeech 2 with a $5 e - 5$ learning rate. In inference, we set the diffusion steps to 1000 for better performance. To synthesize a singing voice, we use the ground-truth pitch and duration, and use various singing prompts to generate singing voices with different singer timbres. Interestingly, we find that NaturalSpeech 2 can generate a novel singing voice using speech as the prompt. See the demo page3 for zero-shot singing synthesis with either singing or speech as the prompt. Please refer to Appendix E for more details. Furthermore, we extend NaturalSpeech 2 to support more tasks such as voice conversion and speech enhancement. Please refer to Appendix L for more details.
|
| 168 |
+
|
| 169 |
+
# 5 CONCLUSION
|
| 170 |
+
|
| 171 |
+
In this paper, we develop NaturalSpeech 2, a TTS system that leverages a neural audio codec with continuous latent vectors and a latent diffusion model with non-autoregressive generation to enable natural and zero-shot text-to-speech synthesis. To facilitate in-context learning for zero-shot synthesis, we design a speech prompting mechanism in the duration/pitch predictor and the diffusion model. By scaling NaturalSpeech 2 to 400M model parameters, 44K hours of speech, and 5K speakers, it can synthesize speech with high expressiveness, robustness and strong zero-shot ability, outperforming previous TTS systems. For future work, we will explore efficient strategies such as (Song et al., 2023) to speed up, and explore large-scale speaking and singing voice training to enable more powerful mixed speaking/singing capability. We include our limitation in Appendix M.
|
| 172 |
+
|
| 173 |
+
Broader Impacts: Since NaturalSpeech 2 could synthesize speech that maintains speaker identity, it may carry potential risks in misuse of the model, such as spoofing voice identification or impersonating a specific speaker. We conduct experiments under the assumption that the user agrees to be the target speaker in speech synthesis. If the model generalizes to unseen speakers in the real world, it should include a protocol to ensure that the speaker approves the use of their voice and a synthesized speech detection model.
|
| 174 |
+
|
| 175 |
+
REFERENCES
|
| 176 |
+
James Betker. Better speech synthesis through scaling. arXiv preprint arXiv:2305.07243, 2023.
|
| 177 |
+
Zalán Borsos, Raphaël Marinier, Damien Vincent, Eugene Kharitonov, Olivier Pietquin, Matt Sharifi, Olivier Teboul, David Grangier, Marco Tagliasacchi, and Neil Zeghidour. Audiolm: a language modeling approach to audio generation. arXiv preprint arXiv:2209.03143, 2022.
|
| 178 |
+
Zalán Borsos, Matt Sharifi, Damien Vincent, Eugene Kharitonov, Neil Zeghidour, and Marco Tagliasacchi. Soundstorm: Efficient parallel audio generation. arXiv preprint arXiv:2305.09636, 2023.
|
| 179 |
+
Edresson Casanova, Arnaldo Candido Junior, Christopher Shulby, Frederico Santos de Oliveira, João Paulo Teixeira, Moacir Antonelli Ponti, and Sandra Aluísio. Tts-portuguese corpus: a corpus for speech synthesis in brazilian portuguese. Language Resources and Evaluation, 56(3): 1043–1055, 2022a.
|
| 180 |
+
Edresson Casanova, Julian Weber, Christopher D Shulby, Arnaldo Candido Junior, Eren Gölge, and Moacir A Ponti. Yourtts: Towards zero-shot multi-speaker tts and zero-shot voice conversion for everyone. In International Conference on Machine Learning, pp. 2709–2720. PMLR, 2022b.
|
| 181 |
+
Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating gradients for waveform generation. In ICLR, 2021a.
|
| 182 |
+
Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, Najim Dehak, and William Chan. WaveGrad 2: Iterative refinement for text-to-speech synthesis. arXiv preprint arXiv:2106.09660, 2021b.
|
| 183 |
+
Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, et al. Wavlm: Large-scale self-supervised pre-training for full stack speech processing. IEEE Journal of Selected Topics in Signal Processing, 16(6): 1505–1518, 2022.
|
| 184 |
+
Alexandre Défossez. Hybrid spectrogram and waveform source separation. arXiv preprint arXiv:2111.03600, 2021.
|
| 185 |
+
Alexandre Défossez, Jade Copet, Gabriel Synnaeve, and Yossi Adi. High fidelity neural audio compression. arXiv preprint arXiv:2210.13438, 2022.
|
| 186 |
+
Chenpeng Du, Yiwei Guo, Xie Chen, and Kai Yu. VQTTS: High-fidelity text-to-speech synthesis with self-supervised VQ acoustic feature. arXiv preprint arXiv:2204.00768, 2022.
|
| 187 |
+
Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 12873–12883, 2021.
|
| 188 |
+
Ian J Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aäron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014.
|
| 189 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. arXiv preprint arXiv:2006.11239, 2020.
|
| 190 |
+
Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, and Abdelrahman Mohamed. Hubert: Self-supervised speech representation learning by masked prediction of hidden units. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 29:3451–3460, 2021.
|
| 191 |
+
|
| 192 |
+
Rongjie Huang, Chunlei Zhang, Yongqi Wang, Dongchao Yang, Luping Liu, Zhenhui Ye, Ziyue Jiang, Chao Weng, Zhou Zhao, and Dong Yu. Make-a-voice: Unified voice synthesis with discrete representation. arXiv preprint arXiv:2305.19269, 2023.
|
| 193 |
+
|
| 194 |
+
Keith Ito. The LJ speech dataset. https://keithito.com/LJ-Speech-Dataset/, 2017.
|
| 195 |
+
Myeonghun Jeong, Hyeongju Kim, Sung Jun Cheon, Byoung Jin Choi, and Nam Soo Kim. Diff-TTS: A denoising diffusion model for text-to-speech. arXiv preprint arXiv:2104.01409, 2021.
|
| 196 |
+
Ye Jia, Heiga Zen, Jonathan Shen, Yu Zhang, and Yonghui Wu. PnG BERT: Augmented BERT on phonemes and graphemes for neural TTS. arXiv preprint arXiv:2103.15060, 2021.
|
| 197 |
+
Ziyue Jiang, Yi Ren, Ming Lei, and Zhou Zhao. Fedspeech: Federated text-to-speech with continual learning. arXiv preprint arXiv:2110.07216, 2021.
|
| 198 |
+
Ziyue Jiang, Jinglin Liu, Yi Ren, Jinzheng He, Zhenhui Ye, Shengpeng Ji, Qian Yang, Chen Zhang, Pengfei Wei, Chunfeng Wang, et al. Boosting prompting mechanisms for zero-shot speech synthesis. In The Twelfth International Conference on Learning Representations, 2023a.
|
| 199 |
+
Ziyue Jiang, Yi Ren, Zhenhui Ye, Jinglin Liu, Chen Zhang, Qian Yang, Shengpeng Ji, Rongjie Huang, Chunfeng Wang, Xiang Yin, et al. Mega-tts: Zero-shot text-to-speech at scale with intrinsic inductive bias. arXiv preprint arXiv:2306.03509, 2023b.
|
| 200 |
+
Jacob Kahn, Morgane Riviere, Weiyi Zheng, Evgeny Kharitonov, Qiantong Xu, Pierre-Emmanuel Mazaré, Julien Karadayi, Vitaliy Liptchinsky, Ronan Collobert, Christian Fuegen, et al. Libri-light: A benchmark for asr with limited or no supervision. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7669–7673. IEEE, 2020.
|
| 201 |
+
Eugene Kharitonov, Damien Vincent, Zalán Borsos, Raphaël Marinier, Sertan Girgin, Olivier Pietquin, Matt Sharifi, Marco Tagliasacchi, and Neil Zeghidour. Speak, read and prompt: High-fidelity text-to-speech with minimal supervision. arXiv preprint arXiv:2302.03540, 2023.
|
| 202 |
+
Jaehyeon Kim, Sungwon Kim, Jungil Kong, and Sungroh Yoon. Glow-TTS: A generative flow for text-to-speech via monotonic alignment search. Advances in Neural Information Processing Systems, 33, 2020.
|
| 203 |
+
Jaehyeon Kim, Jungil Kong, and Juhee Son. Conditional variational autoencoder with adversarial learning for end-to-end text-to-speech. arXiv preprint arXiv:2106.06103, 2021.
|
| 204 |
+
Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A versatile diffusion model for audio synthesis. In ICLR, 2021.
|
| 205 |
+
Felix Kreuk, Gabriel Synnaeve, Adam Polyak, Uriel Singer, Alexandre Défossez, Jade Copet, Devi Parikh, Yaniv Taigman, and Yossi Adi. Audiogen: Textually guided audio generation. arXiv preprint arXiv:2209.15352, 2022.
|
| 206 |
+
Matthew Le, Apoorv Vyas, Bowen Shi, Brian Karrer, Leda Sari, Rashel Moritz, Mary Williamson, Vimal Manohar, Yossi Adi, Jay Mahadeokar, et al. Voicebox: Text-guided multilingual universal speech generation at scale. arXiv preprint arXiv:2306.15687, 2023.
|
| 207 |
+
Yoonhyung Lee, Joongbo Shin, and Kyomin Jung. Bidirectional variational inference for nonautoregressive text-to-speech. In International conference on learning representations, 2022.
|
| 208 |
+
Naihan Li, Shujie Liu, Yanqing Liu, Sheng Zhao, and Ming Liu. Neural speech synthesis with Transformer network. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 6706–6713, 2019.
|
| 209 |
+
Yinghao Aaron Li, Cong Han, Vinay S Raghavan, Gavin Mischler, and Nima Mesgarani. Styletts 2: Towards human-level text-to-speech through style diffusion and adversarial training with large speech language models. arXiv preprint arXiv:2306.07691, 2023.
|
| 210 |
+
Yaron Lipman, Ricky TQ Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. Flow matching for generative modeling. arXiv preprint arXiv:2210.02747, 2022.
|
| 211 |
+
Robert Shevilevich Liptser and Albert Nikolaevich Shiriiaev. Statistics of random processes: General theory, volume 394. Springer, 1977.
|
| 212 |
+
Jinglin Liu, Chengxi Li, Yi Ren, Feiyang Chen, and Zhou Zhao. DiffSinger: Singing voice synthesis via shallow diffusion mechanism. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 11020–11028, 2022a.
|
| 213 |
+
Yanqing Liu, Zhihang Xu, Gang Wang, Kuan Chen, Bohan Li, Xu Tan, Jinzhu Li, Lei He, and Sheng Zhao. DelightfulTTS: The Microsoft speech synthesis system for Blizzard challenge 2021. arXiv preprint arXiv:2110.12612, 2021.
|
| 214 |
+
Yanqing Liu, Ruiqing Xue, Lei He, Xu Tan, and Sheng Zhao. DelightfulTTS 2: End-to-end speech synthesis with adversarial vector-quantized auto-encoders. arXiv preprint arXiv:2207.04646, 2022b.
|
| 215 |
+
Chenfeng Miao, Shuang Liang, Minchuan Chen, Jun Ma, Shaojun Wang, and Jing Xiao. Flow-TTS: A non-autoregressive network for text to speech based on flow. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7209–7213. IEEE, 2020.
|
| 216 |
+
Aäron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. WaveNet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
|
| 217 |
+
Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. LibriSpeech: an ASR corpus based on public domain audio books. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5206–5210. IEEE, 2015.
|
| 218 |
+
Ethan Perez, Florian Strub, Harm De Vries, Vincent Dumoulin, and Aaron Courville. Film: Visual reasoning with a general conditioning layer. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 219 |
+
Vadim Popov, Ivan Vovk, Vladimir Gogoryan, Tasnima Sadekova, and Mikhail Kudinov. Grad-TTS: A diffusion probabilistic model for text-to-speech. arXiv preprint arXiv:2105.06337, 2021.
|
| 220 |
+
Vineel Pratap, Qiantong Xu, Anuroop Sriram, Gabriel Synnaeve, and Ronan Collobert. MLS: A large-scale multilingual dataset for speech research. Proc. Interspeech 2020, pp. 2757–2761, 2020.
|
| 221 |
+
Konpat Preechakul, Nattanat Chatthee, Suttisak Wizadwongsa, and Supasorn Suwajanakorn. Diffusion autoencoders: Toward a meaningful and decodable representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10619–10629, 2022.
|
| 222 |
+
Ali Razavi, Aaron van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with VQ-VAE-2. In Advances in neural information processing systems, pp. 14866–14876, 2019.
|
| 223 |
+
Yi Ren, Yangjun Ruan, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. FastSpeech: Fast, robust and controllable text to speech. In NeurIPS, 2019.
|
| 224 |
+
Yi Ren, Chenxu Hu, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. FastSpeech 2: Fast and high-quality end-to-end text to speech. In International Conference on Learning Representations, 2021a. URL https://openreview.net/forum?id=piLPYqxtWuA.
|
| 225 |
+
Yi Ren, Jinglin Liu, and Zhou Zhao. Portaspeech: Portable and high-quality generative text-to-speech. Advances in Neural Information Processing Systems, 34:13963–13974, 2021b.
|
| 226 |
+
Steffen Schneider, Alexei Baevski, Ronan Collobert, and Michael Auli. wav2vec: Unsupervised pre-training for speech recognition. Proc. Interspeech 2019, pp. 3465–3469, 2019.
|
| 227 |
+
Jonathan Shen, Ruoming Pang, Ron J Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, RJ Skerry-Ryan, et al. Natural TTS synthesis by conditioning WaveNet on mel spectrogram predictions. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4779–4783. IEEE, 2018.
|
| 228 |
+
|
| 229 |
+
Hubert Siuzdak, Piotr Dura, Pol van Rijn, and Nori Jacoby. Wavthruvec: Latent speech representation as intermediate features for neural speech synthesis. arXiv preprint arXiv:2203.16930, 2022.
|
| 230 |
+
|
| 231 |
+
Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015.
|
| 232 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019.
|
| 233 |
+
Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in neural information processing systems, 33:12438–12448, 2020.
|
| 234 |
+
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2020.
|
| 235 |
+
Yang Song, Prafulla Dhariwal, Mark Chen, and Ilya Sutskever. Consistency models. arXiv preprint arXiv:2303.01469, 2023.
|
| 236 |
+
Hao Sun, Xu Tan, Jun-Wei Gan, Hongzhi Liu, Sheng Zhao, Tao Qin, and Tie-Yan Liu. Token-level ensemble distillation for grapheme-to-phoneme conversion. In INTERSPEECH, 2019.
|
| 237 |
+
Xu Tan, Tao Qin, Frank Soong, and Tie-Yan Liu. A survey on neural speech synthesis. arXiv preprint arXiv:2106.15561, 2021.
|
| 238 |
+
Xu Tan, Jiawei Chen, Haohe Liu, Jian Cong, Chen Zhang, Yanqing Liu, Xi Wang, Yichong Leng, Yuanhao Yi, Lei He, et al. NaturalSpeech: End-to-end text to speech synthesis with human-level quality. arXiv preprint arXiv:2205.04421, 2022.
|
| 239 |
+
Xu Tan, Tao Qin, Jiang Bian, Tie-Yan Liu, and Yoshua Bengio. Regeneration learning: A learning paradigm for data generation. arXiv preprint arXiv:2301.08846, 2023.
|
| 240 |
+
Paul Taylor. Text-to-speech synthesis. Cambridge university press, 2009.
|
| 241 |
+
Jean-Marc Valin and Jan Skoglund. LPCNet: Improving neural speech synthesis through linear prediction. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5891–5895. IEEE, 2019.
|
| 242 |
+
Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 6309–6318, 2017.
|
| 243 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008, 2017.
|
| 244 |
+
Christophe Veaux, Junichi Yamagishi, Kirsten MacDonald, et al. Superseded-CSTK VCTK corpus: English multi-speaker corpus for CSTK voice cloning toolkit. 2016.
|
| 245 |
+
Chengyi Wang, Sanyuan Chen, Yu Wu, Ziqiang Zhang, Long Zhou, Shujie Liu, Zhuo Chen, Yanqing Liu, Huaming Wang, Jinyu Li, et al. Neural codec language models are zero-shot text to speech synthesizers. arXiv preprint arXiv:2301.02111, 2023.
|
| 246 |
+
Yequan Wang, Minlie Huang, Xiaoyan Zhu, and Li Zhao. Attention-based lstm for aspect-level sentiment classification. In Proceedings of the 2016 conference on empirical methods in natural language processing, pp. 606–615, 2016.
|
| 247 |
+
Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: Towards end-to-end speech synthesis. Proc. Interspeech 2017, pp. 4006–4010, 2017.
|
| 248 |
+
Yuxuan Wang, Daisy Stanton, Yu Zhang, RJ Skerry-Ryan, Eric Battenberg, Joel Shor, Ying Xiao, Ye Jia, Fei Ren, and Rif A Saurous. Style tokens: Unsupervised style modeling, control and transfer in end-to-end speech synthesis. In International Conference on Machine Learning, pp. 5180–5189. PMLR, 2018.
|
| 249 |
+
Yiquan Wu, Siying Zhou, Yifei Liu, Weiming Lu, Xiaozhong Liu, Yating Zhang, Changlong Sun, Fei Wu, and Kun Kuang. Precedent-enhanced legal judgment prediction with llm and domain-model collaboration. arXiv preprint arXiv:2310.09241, 2023.
|
| 250 |
+
Ruiqing Xue, Yanqing Liu, Lei He, Xu Tan, Linquan Liu, Edward Lin, and Sheng Zhao. Foundationtts: Text-to-speech for asr customization with generative language model. arXiv preprint arXiv:2303.02939, 2023.
|
| 251 |
+
Zhenhui Ye, Rongjie Huang, Yi Ren, Ziyue Jiang, Jinglin Liu, Jinzheng He, Xiang Yin, and Zhou Zhao. Clapspeech: Learning prosody from text context with contrastive language-audio pretraining. arXiv preprint arXiv:2305.10763, 2023.
|
| 252 |
+
Dacheng Yin, Chuanxin Tang, Yanqing Liu, Xiaoqiang Wang, Zhiyuan Zhao, Yucheng Zhao, Zhiwei Xiong, Sheng Zhao, and Chong Luo. Retrievertts: Modeling decomposed factors for text-based speech insertion. arXiv preprint arXiv:2206.13865, 2022.
|
| 253 |
+
Julian Zaïdi, Hugo Seut’e, Benjamin van Niekerk, and Marc-André Carbonneau. Daft-exprt: Crossspeaker prosody transfer on any text for expressive speech synthesis. In Interspeech, 2021. URL https://api.semanticscholar.org/CorpusID:247997035.
|
| 254 |
+
Neil Zeghidour, Alejandro Luebs, Ahmed Omran, Jan Skoglund, and Marco Tagliasacchi. SoundStream: An end-to-end neural audio codec. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2021.
|
| 255 |
+
Heiga Zen, Viet Dang, Rob Clark, Yu Zhang, Ron J Weiss, Ye Jia, Zhifeng Chen, and Yonghui Wu. LibriTTS: A corpus derived from librispeech for text-to-speech. Proc. Interspeech 2019, pp. 1526–1530, 2019.
|
| 256 |
+
Ziqiang Zhang, Long Zhou, Chengyi Wang, Sanyuan Chen, Yu Wu, Shujie Liu, Zhuo Chen, Yanqing Liu, Huaming Wang, Jinyu Li, et al. Speak foreign languages with your own voice: Cross-lingual neural codec language modeling. arXiv preprint arXiv:2303.03926, 2023.
|
| 257 |
+
|
| 258 |
+
# A NEURAL AUDIO CODEC
|
| 259 |
+
|
| 260 |
+
As shown in Figure 3, our neural audio codec consists of an audio encoder, a residual vector-quantizer (RVQ), and an audio decoder: 1) The audio encoder consists of several convolutional blocks with a total downsampling rate of 200 for 16KHz audio, i.e., each frame corresponds to a $1 2 . 5 \mathrm { m s }$ speech segment. 2) The residual vector-quantizer converts the output of the audio encoder into multiple residual vectors following (Zeghidour et al., 2021). The sum of these residual vectors is taken as the quantized vectors, which are used as the training target of the diffusion model. 3) The audio decoder mirrors the structure of the audio encoder, which generates the audio waveform from the quantized vectors. The working flow of the neural audio codec is as follows.
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
\mathrm { R e s i d u a l ~ V e c t o r ~ Q u a n t i z e r : ~ } \{ e _ { j } ^ { i } \} _ { j = 1 } ^ { R } = f _ { \mathrm { r v q } } ( h ^ { i } ) , z ^ { i } = \sum _ { j = 1 } ^ { R } e _ { j } ^ { i } , z = \{ z ^ { i } \} _ { i = 1 } ^ { n } ,
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
where $f _ { \mathrm { e n c } }$ , $f _ { \mathrm { r v q } }$ , and $f _ { \mathrm { d e c } }$ denote the audio encoder, residual vector quantizer, and audio decoder. $x$ is the speech waveform, $h$ is the hidden sequence obtained by the audio encoder with a frame length of $n$ , and $z$ is the quantized vector sequence with the same length as $h , i$ is the index of the speech frame, $j$ is the index of the residual quantizer and $R$ is the total number of residual quantizers, and $e _ { j } ^ { i }$ is the embedding vector of the codebook ID obtained by the $j$ -th residual quantizer on the $i$ -th hidden frame (i.e., $h ^ { i }$ ). The training of the neural codec follows the loss function in (Zeghidour et al., 2021).
|
| 267 |
+
|
| 268 |
+

|
| 269 |
+
Figure 3: The neural audio codec consists of an encoder, a residual vector-quantizer (RVQ), and a decoder. The encoder extracts the frame-level speech representations from the audio waveform, the RVQ leverages multiple codebooks to quantize the frame-level representations, and the decoder takes the quantized vectors as input and reconstructs the audio waveform. The quantized vectors also serve as the training target of the latent diffusion model.
|
| 270 |
+
|
| 271 |
+
# B THE DETAILS OF WAVENET ARCHITECTURE IN THE DIFFUSION MODEL
|
| 272 |
+
|
| 273 |
+
As shown in Figure 4, the WaveNet consists of 40 blocks. Each block consists of 1) a dilated CNN with kernel size 3 and dilation 2, 2) a Q-K-V attention, and 3) a FiLM layer. In detail, we use Q-K-V attention to attend to the key/value obtained from the first Q-K-V attention module (from the speech prompt encoder) as shown in Figure 2. Then, we use the attention results to generate the scale and bias terms, which are used as the conditional information of the FiLM layer. Finally, we average the skip output results of each layer and calculate the final WaveNet output.
|
| 274 |
+
|
| 275 |
+
# C THE IMPLEMENTATION DETAILS
|
| 276 |
+
|
| 277 |
+
# C.1 MODEL CONFIGURATION DETAILS
|
| 278 |
+
|
| 279 |
+
The phoneme encoder is a 6-layer Transformer (Vaswani et al., 2017) with 8 attention heads, 512 embedding dimensions, 2048 1D convolution filter size, 9 convolution 1D kernel size, and 0.1 dropout rate. The pitch and duration predictor share the same architecture of 30-layer 1D convolution with
|
| 280 |
+
|
| 281 |
+

|
| 282 |
+
Figure 4: Overview of the WaveNet architecture in the diffusion model.
|
| 283 |
+
|
| 284 |
+
ReLU activation and layer normalization, $1 0 \mathrm { Q } { \cdot } \mathrm { K } { \cdot } \mathrm { V }$ attention layers for in-context learning, which have 512 hidden dimensions and 8 attention heads and are placed every $3 ~ 1 \mathrm { D }$ convolution layers. We set the dropout to 0.5 in both duration and pitch predictors. The ground-truth pitch is quantized in the log scale and converted into pitch embedding, which is added to the expanded hidden sequence. The pitch is standardized for the learning target. For the speech prompt encoder, we use a 6-layer Transformer with 512 hidden size, which has the same architecture as the phoneme encoder. As for the $m$ query tokens in the first Q-K-V attention in the prompting mechanism in the diffusion model (as shown in Figure 2), we set the token number $m$ to 32 and the hidden dimension to 512.
|
| 285 |
+
|
| 286 |
+
The diffusion model contains 40 WaveNet layers (Oord et al., 2016), which consist of 1D dilated convolution layers with 3 kernel size, 1024 filter size, and 2 dilation size. Specifically, we use a FiLM layer (Perez et al., 2018) at every 3 WaveNet layers to fuse the condition information processed by the second Q-K-V attention in the prompting mechanism in the diffusion model. The hidden size in WaveNet is 512, and the dropout rate is 0.2.
|
| 287 |
+
|
| 288 |
+
We show the more detailed configuration in Table 5.
|
| 289 |
+
|
| 290 |
+
# C.2 MODEL TRAINING AND INFERENCE
|
| 291 |
+
|
| 292 |
+
We first train the audio codec using 8 NVIDIA TESLA V100 16GB GPUs with a batch size of 200 audios per GPU for 440K steps. We follow the implementation and experimental setting of SoundStream (Zeghidour et al., 2021) and adopt Adam optimizer with $2 e - 4$ learning rate. Then we use the trained codec to extract the quantized latent vectors for each audio to train the diffusion model in NaturalSpeech 2.
|
| 293 |
+
|
| 294 |
+
The diffusion model in NaturalSpeech 2 is trained using 16 NVIDIA TESLA V100 32GB GPUs with a batch size of 6K frames of latent vectors per GPU for 300K steps. We optimize the models with the AdamW optimizer with $5 e - 4$ learning rate, 32K warmup steps following the inverse square root learning schedule. We use a linear noise schedule function, i.e., $\beta _ { t } = \beta _ { 0 } + ( \beta _ { 1 } - \beta _ { 0 } ) * t$ , where $\beta _ { 0 } = 0 . 0 5$ and $\beta _ { 1 } = 2 0$ .
|
| 295 |
+
|
| 296 |
+
Table 5: The detailed model configurations of NaturalSpeech 2.
|
| 297 |
+
|
| 298 |
+
<table><tr><td>Module</td><td>Configuration</td><td>Value</td><td>#Parameters</td></tr><tr><td rowspan="5">Audio Codec</td><td>Number of Residual VQ Blocks Codebook size</td><td>16 1024</td><td rowspan="5">27M</td></tr><tr><td></td><td>256</td></tr><tr><td>Codebook Dimension</td><td></td></tr><tr><td>Hop Size</td><td>200</td></tr><tr><td>Similarity Metric</td><td>L2</td></tr><tr><td rowspan="5">Phoneme Encoder</td><td>Transformer Layer</td><td>6</td><td rowspan="5">72M</td></tr><tr><td>Attention Heads</td><td>8</td></tr><tr><td>Convideniter Size</td><td>2518</td></tr><tr><td></td><td></td></tr><tr><td>Conv1D Kernel Size</td><td>9</td></tr><tr><td rowspan="6"></td><td>Dropout</td><td>0.2</td><td rowspan="6">34M</td></tr><tr><td>Conv1D Layers</td><td>30</td></tr><tr><td>Conv1D Kernel Size</td><td>3 10</td></tr><tr><td>Attention Layers Attention Heads</td><td>8</td></tr><tr><td>Hidden Size</td><td>512</td></tr><tr><td>Dropout</td><td>0.5</td></tr><tr><td rowspan="5">Pitch Predictor</td><td>Conv1D Layers</td><td>30</td><td rowspan="5">50M</td></tr><tr><td>Conv1D Kernel Size</td><td>5</td></tr><tr><td> Attention Layers</td><td></td></tr><tr><td></td><td>18</td></tr><tr><td>Hidden Size</td><td>512</td></tr><tr><td rowspan="6"></td><td>Dropout</td><td>0.5</td><td rowspan="6">69M</td></tr><tr><td>Transformer Layer</td><td>6</td></tr><tr><td>Attention Heads</td><td>8</td></tr><tr><td>Hidden Size</td><td>512</td></tr><tr><td>Conv1D Filter Size</td><td>2048</td></tr><tr><td>Conv1D Kernel Size Dropout</td><td>9 0.2</td></tr><tr><td rowspan="6">Diffusion Model</td><td>WaveNet Layer</td><td>40</td><td rowspan="6">183M</td></tr><tr><td>Attention Layers</td><td>13</td></tr><tr><td>Attention Heads</td><td>8</td></tr><tr><td>Hidden Size</td><td>512</td></tr><tr><td>Query Tokens</td><td>32</td></tr><tr><td>Query Token Dimension Dropout</td><td>512</td></tr><tr><td colspan="2"></td><td>0.2</td><td>435M</td></tr><tr><td colspan="2">Total</td><td></td><td></td></tr></table>
|
| 299 |
+
|
| 300 |
+
During inference, for the diffusion model, we find it beneficial to use a temperature $\tau$ and sample the terminal condition $z _ { 1 }$ from $\mathcal { N } ( 0 , \tau ^ { - 1 } I )$ (Popov et al., 2021). We set $\tau$ to $1 . 2 ^ { 2 }$ . To balance the generation quality and latency, we adopt the Euler ODE solver and set the diffusion steps to 150. We quantize the predicted latent vectors and feed them into the audio decoder of the codec to obtain the waveform.
|
| 301 |
+
|
| 302 |
+
# C.3 THE DETAILS OF $\mathcal { L } _ { \mathrm { c e - } }$ rvq
|
| 303 |
+
|
| 304 |
+
For each residual quantizer $j \in [ 1 , R ]$ , we first get the residual vector:
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
z _ { j } = z _ { 0 } - \sum _ { m = 1 } ^ { j - 1 } \hat { e } ^ { m } ,
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
where $\hat { e } ^ { m }$ is the ground-truth quantized embedding in the $m$ -th residual quantizer. Then we calculate the L2 distance between the residual vector with each codebook embedding in quantizer $j$ and get a probability distribution as follows:
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
l _ { i } = | | z _ { j } - e _ { i } ^ { j } | | _ { 2 } , s _ { i } = \frac { e ^ { - l _ { i } } } { \sum _ { k = 1 } ^ { N _ { j } } e ^ { - l _ { k } } } ,
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
where $N _ { j }$ is the code number of residual quantizer $j$ , and $s _ { i }$ is the probability of code $i$ in codebook $j$ . Finally, we can calculate the cross-entropy loss of residual quantizer $j$ given the ground-truth code index which is denoted as $L _ { c e , j }$ . The final CE-RVQ loss is shown as follows:
|
| 317 |
+
|
| 318 |
+
$$
|
| 319 |
+
L _ { c e - r v q } = \sum _ { j = 1 } ^ { R } L _ { c e , j }
|
| 320 |
+
$$
|
| 321 |
+
|
| 322 |
+
# D THE DETAILS OF BASELINE METHODS
|
| 323 |
+
|
| 324 |
+
We compare NaturalSpeech 2 with the following baselines:
|
| 325 |
+
|
| 326 |
+
• YourTTS (Casanova et al., 2022b). A powerful zero-shot TTS baseline. We use the official code and pre-trained checkpoint4, which is trained on VCTK Veaux et al. (2016), LibriTTS Zen et al. (2019) and TTS-Portuguese Casanova et al. (2022a).
|
| 327 |
+
• FastSpeech 2 (Ren et al., 2021a), which is a classic high-quality TTS system. We adapt it by adding cross-attention on speech prompts for zero-shot synthesis. Furthermore, we also change the prediction target from the mel-spectrogram to the latent representation.
|
| 328 |
+
• FoundationTTS (Xue et al., 2023), which is another strong baseline with a neural audio codec for discrete speech token extraction and waveform reconstruction and a LLM for discrete token generation from linguistic (phoneme) tokens. To extend it to the zero-shot TTS scenario, we use an additional Transformer to encode the prompt speech features and temporally average the output to obtain a one-dimensional speaker embedding. We scale it to 400M parameters and train it on the same MLS dataset for comparison.
|
| 329 |
+
• VALL-E (Wang et al., 2023), which is a strong large-scale zero-shot TTS system. It uses the audio codec to discretize speech waveforms into tokens and language models to generate them. In our experiment, we implement it with reference to a third-party implementation5. Specifically, we use the same neural codec, dataset as used in NaturalSpeech 2 and scale it to 400 parameters for fair comparison.
|
| 330 |
+
• Voicebox (Le et al., 2023), which is a large-scale zero-shot TTS baseline. It uses a flowmatching (Lipman et al., 2022) model to infill speech mel-spectrogram.
|
| 331 |
+
• MegaTTS (Jiang et al., 2023b), which is a GAN-based large-scale zero-shot TTS system. They decompose the mel-spectrogram into different speech attributes such as timbre, and prosody, and model them according to their intrinsic properties.
|
| 332 |
+
|
| 333 |
+
Since the VALL-E, Voicebox, and MegaTTS are not open source, we download the samples from their demo pages and compare them with NaturalSpeech 2 individually. For VALL-E, we collect 8 samples in LibriSpeech and 8 samples in VCTK6. For Voicebox, we collect 8 samples in LibriSpeech7. For MegaTTS, we collect 4 samples in LibriSpeech and 4 samples in VCTK8.
|
| 334 |
+
|
| 335 |
+
# E THE DETAILS OF DATASET
|
| 336 |
+
|
| 337 |
+
Speech Preprocessing: The speech data is resampled to $1 6 \mathrm { K H z }$ . The input text sequence is first converted into a phoneme sequence using grapheme-to-phoneme conversion (Sun et al., 2019) and then aligned with speech using our internal alignment tool to obtain the phoneme-level duration. The frame-level pitch sequence is extracted from the speech using PyWorld9.
|
| 338 |
+
|
| 339 |
+
Singing Preprocessing: We collect approximately 30 hours of songs in waveform format and their corresponding lyrics from the Web, with each songs containing singing, accompaniment, backing vocals, et al. To remove them, we employ a demucs (Défossez, 2021) model for music source separation. We apply the same duration and pitch extraction method as we apply for speech data. During the training process, we mix the singing and speech data samples. Our experimental results indicate that training the model with a mix of large-scale speech data proves to be more advantageous for enhancing its performance, as opposed to fine-tuning it on a small-scale, singing-only dataset.
|
| 340 |
+
|
| 341 |
+
# F EVALUATION METRICS
|
| 342 |
+
|
| 343 |
+
We use both objective and subjective metrics to evaluate the zero-shot synthesis ability of NaturalSpeech 2 and compare it with baselines.
|
| 344 |
+
|
| 345 |
+
Objective Metrics We evaluate the TTS systems with the following objective metrics:
|
| 346 |
+
|
| 347 |
+
• Prosody Similarity with Prompt. Following the practice (Zaïdi et al., 2021), we evaluate the prosody similarity (in terms of pitch and duration) between the generated speech and the prompt speech, which measures how well the TTS model follows the prosody in speech prompt in zero-shot synthesis. We calculate the prosody similarity with the following steps: 1) we extract phonemelevel duration and pitch from the prompt and the synthesized speech; 2) we calculate the mean, standard deviation, skewness, and kurtosis (Ren et al., 2021a) of the pitch and duration in each speech sequence; 3) we calculate the difference of the mean, standard deviation, skewness, and kurtosis between each paired prompt and synthesized speech and average the differences among the whole test set.
|
| 348 |
+
• Prosody Similarity with Ground Truth. We evaluate the prosody similarity (in terms of pitch and duration) between the generated speech and the ground-truth speech, which measures how well the TTS model matches the prosody in the ground truth. Since there is correspondence between two speech sequences, we calculate the Pearson correlation and RMSE of the pitch/duration between the generated and ground-truth speech, and average them on the whole test set.
|
| 349 |
+
• Word Error Rate. We employ an ASR model to transcribe the generated speech and calculate the word error rate (WER). The ASR model is a CTC-based HuBERT (Hsu et al., 2021) pre-trained on Librilight (Kahn et al., 2020) and fine-tuned on the 960 hours training set of LibriSpeech. We use the official code and checkpoint10.
|
| 350 |
+
|
| 351 |
+
Subjective Metrics We conduct human evaluation and use the intelligibility score and mean opinion score as the subjective metrics:
|
| 352 |
+
|
| 353 |
+
• Intelligibility Score. Neural TTS models often suffer from the robustness issues such as word skipping, repeating, and collapse issues, especially for autoregressive models. To demonstrate the robustness of NaturalSpeech 2, following the practice in (Ren et al., 2019), we use the 50 particularly hard sentences (see Appendix G.2) and conduct an intelligibility test. We measure the number of repeating words, skipping words, and error sentences as the intelligibility score. • CMOS and SMOS. Since synthesizing natural voices is one of the main goals of NaturalSpeech 2, we measure naturalness using comparative mean option score (CMOS) with 12 native speakers as the judges. We also use the similarity mean option score (SMOS) between the synthesized and prompt speech to measure the speaker similarity, with 6 native speakers as the judges. We calculate the CMOS and SMOS by a third-party commercial evaluation platform.
|
| 354 |
+
|
| 355 |
+
# G INTELLIGIBILTY TEST
|
| 356 |
+
|
| 357 |
+
Table 6: The robustness of NaturalSpeech 2 and other autoregressive/non-autoregressive models on 50 particularly hard sentences. We conduct an intelligibility test on these sentences and measure the number of word repeating, word skipping, and error sentences. Each kind of word error is counted at once per sentence.
|
| 358 |
+
|
| 359 |
+
<table><tr><td>AR/NAR</td><td>Model</td><td>Repeats</td><td>Skips</td><td>Error Sentences</td><td>Error Rate</td></tr><tr><td rowspan="4">AR</td><td>Tacotron (Wang et al., 2017)</td><td>4</td><td>11</td><td>12</td><td>24%</td></tr><tr><td></td><td>78</td><td>15</td><td></td><td></td></tr><tr><td>TaLL-r(erTs(Li.,tal.,2019)</td><td></td><td></td><td></td><td>34%</td></tr><tr><td>FoundationTTS (Xue et al.,2023)</td><td>2</td><td>16</td><td>16</td><td>32%</td></tr><tr><td rowspan="2">NAR</td><td>FastSpeech (Ren et al., 2019)</td><td>0</td><td>0</td><td>0</td><td>0%</td></tr><tr><td>NaturalSpeech (Tan et al., 2022)</td><td>0</td><td>0</td><td>0</td><td>0%</td></tr><tr><td>NAR</td><td>NaturalSpeech 2</td><td>0</td><td>0</td><td>0</td><td>0%</td></tr></table>
|
| 360 |
+
|
| 361 |
+
# G.1 INTELLIGIBILTY TEST/ROBUSTNESS TEST
|
| 362 |
+
|
| 363 |
+
Autoregressive TTS models often suffer from alignment mismatch between phoneme and speech, resulting in severe word repeating and skipping. To further evaluate the robustness of the diffusionbased TTS model, we adopt the 50 particularly hard sentences in FastSpeech (Ren et al., 2019) to evaluate the robustness of the TTS systems. We can find that the non-autoregressive models such as FastSpeech (Ren et al., 2019), NaturalSpeech (Tan et al., 2022), and also NaturalSpeech 2 are robust for the 50 hard cases, without any intelligibility issues. As a comparison, the autoregressive models such as Tacotron (Wang et al., 2017), Transformer TTS (Li et al., 2019), FoundationTTS (Xue et al., 2023), and VALL-E (Wang et al., 2023) will have a high error rate on these hard sentences. The comparison results are provided in Table 6.
|
| 364 |
+
|
| 365 |
+
# G.2 THE 50 PARTICULARLY HARD SENTENCES
|
| 366 |
+
|
| 367 |
+
The 50 particularly hard sentences used in Section G.1 are listed below:
|
| 368 |
+
|
| 369 |
+
01. a
|
| 370 |
+
02. b
|
| 371 |
+
03. c
|
| 372 |
+
04. H
|
| 373 |
+
05. I
|
| 374 |
+
06. J
|
| 375 |
+
07. K
|
| 376 |
+
08. L
|
| 377 |
+
09. 22222222 hello 22222222
|
| 378 |
+
10. S D S D Pass zero - zero Fail - zero to zero - zero - zero Cancelled - fifty nine to three - two - sixty four Total - fifty nine to three - two -
|
| 379 |
+
11. S D S D Pass - zero - zero - zero - zero Fail - zero - zero - zero - zero Cancelled - four hundred and sixteen - seventy six -
|
| 380 |
+
12. zero - one - one - two Cancelled - zero - zero - zero - zero Total - two hundred and eighty six - nineteen - seven -
|
| 381 |
+
13. forty one to five three hundred and eleven Fail - one - one to zero two Cancelled - zero - zero to zero zero Total -
|
| 382 |
+
14. zero zero one , MS03 - zero twenty five , MS03 - zero thirty two , MS03 - zero thirty nine ,
|
| 383 |
+
15. 1b204928 zero zero zero zero zero zero zero zero zero zero zero zero zero zero one seven ole32
|
| 384 |
+
16. zero zero zero zero zero zero zero zero two seven nine eight F three forty zero zero zero zero zero six four two eight zero one eight
|
| 385 |
+
17. c five eight zero three three nine a zero bf eight FALSE zero zero zero bba3add2 - c229 - 4cdb -
|
| 386 |
+
18. Calendaring agent failed with error code 0x80070005 while saving appointment .
|
| 387 |
+
19. Exit process - break ld - Load module - output ud - Unload module - ignore ser - System error - ignore ibp - Initial breakpoint -
|
| 388 |
+
20. Common DB connectors include the DB - nine , DB - fifteen , DB - nineteen , DB - twenty five , DB - thirty seven , and DB - fifty connectors .
|
| 389 |
+
21. To deliver interfaces that are significantly better suited to create and process RFC eight twenty one , RFC eight twenty two , RFC nine seventy seven , and MIME content .
|
| 390 |
+
22. int1 , int2 , int3 , int4 , int5 , int6 , int7 , int8 , int9 ,
|
| 391 |
+
23. seven _ ctl00 ctl04 ctl01 ctl00 ctl00
|
| 392 |
+
24. Http0XX , Http1XX , Http2XX , Http3XX ,
|
| 393 |
+
25. config file must contain A , B , C , D , E , F , and G .
|
| 394 |
+
26. mondo - debug mondo - ship motif - debug motif - ship sts - debug sts - ship Comparing local files to checkpoint files ...
|
| 395 |
+
27. Rusbvts . dll Dsaccessbvts . dll Exchmembvt . dll Draino . dll Im trying to deploy a new topology , and I keep getting this error .
|
| 396 |
+
28. You can call me directly at four two five seven zero three seven three four four or my cell four two five four four four seven four seven four or send me a meeting request with all the appropriate information .
|
| 397 |
+
29. Failed zero point zero zero percent $<$ one zero zero one zero zero zero zero Internal . Exchange . ContentFilter . BVT ContentFilter . BVT_log . xml Error ! Filename not specified .
|
| 398 |
+
30. C colon backslash o one two f c p a r t y backslash d e v one two backslash oasys backslash legacy backslash web backslash HELP
|
| 399 |
+
31. src backslash mapi backslash t n e f d e c dot c dot o l d backslash backslash m o z a r t f one backslash e x five
|
| 400 |
+
32. copy backslash backslash j o h n f a n four backslash scratch backslash M i c r o s o f t dot S h a r e P o i n t dot
|
| 401 |
+
33. Take a look at h t t p colon slash slash w w w dot granite dot a b dot c a slash access slash email dot
|
| 402 |
+
34. backslash bin backslash premium backslash forms backslash r e g i o n a l o p t i o n s dot a s p x dot c s Raj , DJ ,
|
| 403 |
+
35. Anuraag backslash backslash r a d u r five backslash d e b u g dot one eight zero nine underscore P R two h dot s t s contains
|
| 404 |
+
36. p l a t f o r m right bracket backslash left bracket f l a v o r right bracket backslash s e t u p dot e x e
|
| 405 |
+
37. backslash x eight six backslash Ship backslash zero backslash A d d r e s s B o o k dot C o n t a c t s A d d r e s
|
| 406 |
+
38. Mine is here backslash backslash g a b e h a l l hyphen m o t h r a backslash S v r underscore O f f i c e s v r
|
| 407 |
+
39. h t t p colon slash slash teams slash sites slash T A G slash default dot aspx As always , any feedback , comments ,
|
| 408 |
+
40. two thousand and five h t t p colon slash slash news dot com dot com slash i slash n e slash f d slash two zero zero three slash f d
|
| 409 |
+
41. backslash i n t e r n a l dot e x c h a n g e dot m a n a g e m e n t dot s y s t e m m a n a g e
|
| 410 |
+
42. I think Rich’s post highlights that we could have been more strategic about how the sum total of XBOX three hundred and sixtys were distributed .
|
| 411 |
+
43. 64X64 , 8K , one hundred and eighty four ASSEMBLY , DIGITAL VIDEO DISK DRIVE , INTERNAL , 8X ,
|
| 412 |
+
44. So we are back to Extended MAPI and $\mathrm { C } { + + }$ because . Extended MAPI does not have a dual interface VB or VB .Net can read .
|
| 413 |
+
45. Thanks , Borge Trongmo Hi gurus , Could you help us E2K ASP guys with the following issue ?
|
| 414 |
+
|
| 415 |
+
Table 7: The prosody similarity between synthesized and prompt speech in terms of the difference in mean (Mean), standard deviation (Std), skewness (Skew), and kurtosis (Kurt) of pitch and duration on VCTK.
|
| 416 |
+
|
| 417 |
+
<table><tr><td rowspan="2">VCTK</td><td colspan="4">Pitch</td><td colspan="4">Duration</td></tr><tr><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt↓</td><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt</td></tr><tr><td>YourTTS</td><td>13.67</td><td>6.63</td><td>0.72</td><td>1.54</td><td>0.72</td><td>0.85</td><td>0.84</td><td>3.31</td></tr><tr><td>FastSpeech 2</td><td>18.17</td><td>9.87</td><td>2.04</td><td>3.67</td><td>0.81</td><td>0.79</td><td>0.86</td><td>3.12</td></tr><tr><td>FoundationTTS</td><td>13.41</td><td>6.59</td><td>0.76</td><td>1.68</td><td>0.80</td><td>0.82</td><td>0.80</td><td>3.38</td></tr><tr><td>VALL-E</td><td>13.33</td><td>6.44</td><td>0.73</td><td>1.36</td><td>0.74</td><td>0.79</td><td>0.82</td><td>2.91</td></tr><tr><td>NaturalSpeech 2</td><td>13.29</td><td>6.41</td><td>0.68</td><td>1.27</td><td>0.79</td><td>0.76</td><td>0.76</td><td>2.65</td></tr></table>
|
| 418 |
+
|
| 419 |
+
46. Thanks J RGR Are you using the LDDM driver for this system or the in the build XDDM driver ?
|
| 420 |
+
|
| 421 |
+
47. Btw , you might remember me from our discussion about OWA automation and OWA readiness day a year ago .
|
| 422 |
+
|
| 423 |
+
48. empidtool . exe creates HKEY_CURRENT_USER Software Microsoft Office Common QMPersNum in the registry , queries AD , and the populate the registry with MS employment ID if available else an error code is logged .
|
| 424 |
+
|
| 425 |
+
49. Thursday, via a joint press release and Microsoft AI Blog, we will announce Microsoft’s continued partnership with Shell leveraging cloud, AI, and collaboration technology to drive industry innovation and transformation.
|
| 426 |
+
|
| 427 |
+
50. Actress Fan Bingbing attends the screening of ’Ash Is Purest White (Jiang Hu Er Nv)’ during the 71st annual Cannes Film Festival
|
| 428 |
+
|
| 429 |
+
# H PROSODY SIMILARITY RESULTS
|
| 430 |
+
|
| 431 |
+
H.1 PROSODY SIMILARITY WITH PROMPT SPEECH ON VCTK
|
| 432 |
+
|
| 433 |
+
In this section, we report the prosody similarity evaluation results on VCTK in Table 7.
|
| 434 |
+
|
| 435 |
+
# H.2 PROSODY SIMILARITY WITH GROUND TRUTH
|
| 436 |
+
|
| 437 |
+
To further investigate the quality of prosody, we follow the generation quality evaluation of prosody similarity between synthesized and prompt speech in Section 4.2 and compare the generated speech with the ground-truth speech. We use Pearson correlation and RMSE to measure the prosody matching between generated and ground-truth speech. The results are shown in Table 8. We observe that NaturalSpeech 2 outperforms all baselines by a large margin, which shows that our NaturalSpeech 2 is much better in prosody similarity.
|
| 438 |
+
|
| 439 |
+
# I EXPERIMENTS ON PROMPT LENGTH
|
| 440 |
+
|
| 441 |
+
Since the prompt length is an important hyper-parameter for zero-shot TTS, we would like to investigate the effect of the prompt length. We follow the setting of prosody similarity between synthesized and prompt speech in Section 4.2. Specifically, we vary the prompt length by $\sigma =$ $\{ 3 , 5 , 1 0 \}$ seconds and report the prosody similarity metrics of NaturalSpeech 2. The results are shown in Table 9. We observe that when the prompt is longer, the similarity between the generated speech and the prompt is higher for NaturalSpeech 2. It shows that the longer prompt reveals more details of the prosody, which help the TTS model to generate more similar speech.
|
| 442 |
+
|
| 443 |
+
# J ABLATION STUDY
|
| 444 |
+
|
| 445 |
+
In this section, we present the detailed ablation results by evaluating the prosody similarity between synthesized audio generated by the ablation model and the prompt speech, which are conducted in Section 4.3. The results are shown in Table 10.
|
| 446 |
+
|
| 447 |
+
Table 8: The prosody similarity between the synthesized and ground-truth speech in terms of the correlation and RMSE on pitch and duration.
|
| 448 |
+
|
| 449 |
+
<table><tr><td rowspan="2">LibriSpeech</td><td colspan="2">Pitch</td><td colspan="2">Duration</td></tr><tr><td>Correlation ↑</td><td>RMSE↓</td><td>Correlation ↑</td><td>RMSE↓</td></tr><tr><td>YourTTS</td><td>0.77</td><td>51.78</td><td>0.52</td><td>3.24</td></tr><tr><td>FastSpeech 2</td><td>0.64</td><td>60.39</td><td>0.63</td><td>2.92</td></tr><tr><td>FoundationTTS</td><td>0.73</td><td>52.18</td><td>0.61</td><td>3.16</td></tr><tr><td>VALL-E</td><td>0.73</td><td>50.80</td><td>0.62</td><td>2.88</td></tr><tr><td>NaturalSpeech 2</td><td>0.81</td><td>47.72</td><td>0.65</td><td>2.72</td></tr><tr><td rowspan="2">VCTK</td><td>Pitch</td><td></td><td>Duration</td><td></td></tr><tr><td>Correlation ↑</td><td>RMSE↓</td><td>Correlation ↑</td><td>RMSE↓</td></tr><tr><td>YourTTS</td><td>0.82</td><td>42.63</td><td>0.55</td><td>2.55</td></tr><tr><td>FastSpeech 2</td><td>0.77</td><td>47.40</td><td>0.60</td><td>2.63</td></tr><tr><td>FoundationTTS</td><td>0.81</td><td>46.00</td><td>0.53</td><td>2.64</td></tr><tr><td>VALL-E</td><td>0.83</td><td>43.27</td><td>0.61</td><td>2.52</td></tr><tr><td>NaturalSpeech 2</td><td>0.87</td><td>39.83</td><td>0.64</td><td>2.50</td></tr></table>
|
| 450 |
+
|
| 451 |
+
Table 9: The NaturalSpeech 2 prosody similarity between the synthesized and prompt speech with different lengths in terms of the difference in the mean (Mean), standard deviation (Std), skewness (Skew), and kurtosis (Kurt) of pitch and duration.
|
| 452 |
+
|
| 453 |
+
<table><tr><td rowspan="2">LibriSpeech</td><td colspan="4">Pitch</td><td colspan="4">Duration</td></tr><tr><td>Mean↓</td><td>Std↓</td><td>Skew↓</td><td>Kurt</td><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt</td></tr><tr><td>3s</td><td>10.11</td><td>6.18</td><td>0.50</td><td>1.01</td><td>0.65</td><td>0.70</td><td>0.60</td><td>2.99</td></tr><tr><td>5s</td><td>6.96</td><td>4.29</td><td>0.42</td><td>0.77</td><td>0.69</td><td>0.60</td><td>0.53</td><td>2.52</td></tr><tr><td>10s</td><td>6.90</td><td>4.03</td><td>0.48</td><td>1.36</td><td>0.62</td><td>0.45</td><td>0.56</td><td>2.48</td></tr><tr><td rowspan="2">VCTK</td><td colspan="5">Pitch</td><td colspan="3">Duration</td></tr><tr><td>Mean↓</td><td>Std↓</td><td>Skew↓</td><td>Kurt</td><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt↓</td></tr><tr><td>3s</td><td>13.29</td><td>6.41</td><td>0.68</td><td>1.27</td><td>0.79</td><td>0.76</td><td>0.76</td><td>2.65</td></tr><tr><td>5s</td><td>14.46</td><td>5.47</td><td>0.63</td><td>1.23</td><td>0.62</td><td>0.67</td><td>0.74</td><td>3.40</td></tr><tr><td>10s</td><td>10.28</td><td>4.31</td><td>0.41</td><td>0.87</td><td>0.71</td><td>0.62</td><td>0.76</td><td>3.48</td></tr></table>
|
| 454 |
+
|
| 455 |
+
Furthermore, we also compare the prosody similarity between audio generated by the ablation model and the ground-truth speech in Table 11. Similar to the results of comparing the audio generated by the ablation model and prompt speech, we also have the following observations. 1) The speech prompt is most important to the generation quality. 2) The cross-entropy and the query attention strategy are also helpful in high-quality speech synthesis.
|
| 456 |
+
|
| 457 |
+
# K LATENCY STUDY OF NATURALSPEECH 2
|
| 458 |
+
|
| 459 |
+
In this section, we report the inference latency of NaturalSpeech 2. We vary the diffusion step in $\{ 2 0 , 5 0 , 1 0 0 , 1 5 0 \}$ , and report both the latency (RTF) and generation quality (CMOS). We also compare NaturalSpeech 2 with a NAR baseline (FastSpeech 2) and an AR model (VALL-E). The latency tests are conducted on a server with E5-2690 Intel Xeon CPU, 512GB memory, and one NVIDIA V100 GPU. The results are shown in Table 12.
|
| 460 |
+
|
| 461 |
+
From the results, we have several observations. 1) When the diffusion step is 150 (used in our paper), NaturalSpeech 2 is 33.3 times slower than the NAR model FastSpeech 2, but achieves 0.53 CMOS gain. Still, it is 12.35 times faster than VALL-E. 2) NaturalSpeech 2 has 0.08 CMOS drop and
|
| 462 |
+
|
| 463 |
+
Table 10: The ablation study of NaturalSpeech 2. The prosody similarity between the synthesized and prompt speech in terms of the difference in the mean (Mean), standard variation (Std), skewness (Skew), and kurtosis (Kurt) of pitch and duration. “-" denotes the model can not converge.
|
| 464 |
+
|
| 465 |
+
<table><tr><td rowspan="2"></td><td colspan="4">Pitch</td><td colspan="4">Duration</td></tr><tr><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt↓</td><td>Mean↓</td><td>Std</td><td>Skew↓</td><td>Kurt</td></tr><tr><td>NaturalSpeech 2</td><td>10.11</td><td>6.18</td><td>0.50</td><td>1.01</td><td>0.65</td><td>0.70</td><td>0.60</td><td>2.99</td></tr><tr><td> w/o. diff prompt</td><td>-</td><td>1</td><td></td><td>-</td><td></td><td>1</td><td></td><td></td></tr><tr><td>w/o. dur/pitch prompt</td><td>21.69</td><td>19.38</td><td>0.63</td><td>1.29</td><td>0.77</td><td>0.72</td><td>0.70</td><td>3.70</td></tr><tr><td>w/o. CE loss</td><td>10.69</td><td>6.24</td><td>0.55</td><td>1.06</td><td>0.71</td><td>0.72</td><td>0.74</td><td>3.85</td></tr><tr><td> w/o. query attn</td><td>10.78</td><td>6.29</td><td>0.62</td><td>1.37</td><td>0.67</td><td>0.71</td><td>0.69</td><td>3.59</td></tr></table>
|
| 466 |
+
|
| 467 |
+
Table 11: The ablation study of NaturalSpeech 2. The prosody similarity between the synthesized and ground-truth speech in terms of the correlation and RMSE on pitch and duration. “-" denotes that the model can not converge.
|
| 468 |
+
|
| 469 |
+
<table><tr><td rowspan="2"></td><td colspan="2">Pitch</td><td colspan="2">Duration</td></tr><tr><td>Correlation ↑</td><td>RMSE↓</td><td>Correlation ↑</td><td>RMSE↓</td></tr><tr><td> NaturalSpeech 2</td><td>0.81</td><td>47.72</td><td>0.65</td><td>2.72</td></tr><tr><td> w/o. diff prompt</td><td></td><td></td><td>1</td><td></td></tr><tr><td> w/o. dur/pitch prompt</td><td>0.80</td><td>55.00</td><td>0.59</td><td>2.76</td></tr><tr><td>w/o. CE loss</td><td>0.79</td><td>50.69</td><td>0.63</td><td>2.73</td></tr><tr><td>w/o. query attn</td><td>0.79</td><td>50.65</td><td>0.63</td><td>2.73</td></tr></table>
|
| 470 |
+
|
| 471 |
+
2.95 times speedup (compared with 150 steps) when the diffusion step is 50. The CMOS drops 0.21 while it can achieve 7.31 times speedup (compared with 150 steps) when the diffusion step is 20. Furthermore, since NaturalSpeech 2 is parallel to many diffusion speedup works such as the consistency model Song et al. (2023), we will explore speeding up the diffusion model while retaining the generation quality in the future.
|
| 472 |
+
|
| 473 |
+
# L VOICE CONVERSION AND SPEECH ENHANCEMENT
|
| 474 |
+
|
| 475 |
+
# L.1 VOICE CONVERSION
|
| 476 |
+
|
| 477 |
+
Besides zero-shot text-to-speech and singing synthesis, NaturalSpeech 2 also supports zero-shot voice conversion, which aims to convert the source audio $z _ { s o u r c e }$ into the target audio $z _ { t a r g e t }$ using the voice of the prompt audio $z _ { p r o m p t }$ . Technically, we first convert the source audio $z _ { s o u r c e }$ into an informative Gaussian noise $z _ { 1 }$ using a source-aware diffusion process and generate the target audio $z _ { t a r g e t }$ using a target-aware denoising process, shown as follows.
|
| 478 |
+
|
| 479 |
+
Source-Aware Diffusion Process In voice conversion, it is helpful to provide some necessary information from source audio for target audio in order to ease the generation process. Thus, instead of directly diffusing the source audio with some Gaussian noise, we diffuse the source audio into a starting point that still maintains some information in the source audio. Specifically, inspired by the stochastic encoding process in Diffusion Autoencoder (Preechakul et al., 2022), we obtain the starting point $z _ { 1 }$ from $z _ { s o u r c e }$ as follows:
|
| 480 |
+
|
| 481 |
+
$$
|
| 482 |
+
z _ { 1 } = z _ { 0 } + \int _ { 0 } ^ { 1 } - \frac { 1 } { 2 } ( z _ { t } + \Sigma _ { t } ^ { - 1 } ( \rho ( \hat { s } _ { \theta } ( z _ { t } , t , c ) , t ) - z _ { t } ) ) \beta _ { t } \mathrm { d } t ,
|
| 483 |
+
$$
|
| 484 |
+
|
| 485 |
+
where $\Sigma _ { t } ^ { - 1 } ( \rho ( \hat { s } _ { \theta } ( z _ { t } , t , c ) , t ) - z _ { t } )$ is the predicted score at $t$ . We can think of this process as the reverse of ODE (Equation 4) in the denoising process.
|
| 486 |
+
|
| 487 |
+
Table 12: The latency study of NaturalSpeech 2. We report the RTF and CMOS results for different diffusion steps.
|
| 488 |
+
|
| 489 |
+
<table><tr><td>Model</td><td>Diffusion Step</td><td>RTF</td><td>CMOS</td></tr><tr><td>NaturalSpeech 2</td><td>150</td><td>0.366</td><td>0.00</td></tr><tr><td>NaturalSpeech 2</td><td>100</td><td>0.244</td><td>-0.02</td></tr><tr><td>NaturalSpeech 2</td><td>50</td><td>0.124</td><td>-0.08</td></tr><tr><td>NaturalSpeech 2</td><td>20</td><td>0.050</td><td>-0.21</td></tr><tr><td>FastSpeech 2</td><td>1</td><td>0.011</td><td>-0.53</td></tr><tr><td>VALL-E</td><td>1</td><td>4.52</td><td>-0.29</td></tr></table>
|
| 490 |
+
|
| 491 |
+
Target-Aware Denoising Process Different from the TTS which starts from the random Gaussian noise, the denoising process of voice conversion starts from the $z _ { 1 }$ obtained from the source-aware diffusion process. We run the standard denoising process as in the TTS setting to obtain the final target audio $z _ { t a r g e t }$ , conditioned on $c$ and the prompt audio $z _ { p r o m p t }$ , where $c$ is obtained from the phoneme and the duration sequence of the source audio and the predicted pitch sequence.
|
| 492 |
+
|
| 493 |
+
# L.2 SPEECH ENHANCEMENT
|
| 494 |
+
|
| 495 |
+
NaturalSpeech 2 can be extended to speech enhancement, which is similar to the extension of voice conversion. In this setting, we assume that we have the source audio $z _ { s o u r c e } ^ { \prime }$ which contains background noise ( $z ^ { \prime }$ denotes the audio with background noise), the prompt with background noise $z _ { p r o m p t } ^ { \prime }$ for the source-aware diffusion process, and the prompt without background noise zprompt for target-aware denoising process. Note that $z _ { s o u r c e } ^ { \prime }$ and $z _ { p r o m p t } ^ { \prime }$ have the same background noise.
|
| 496 |
+
|
| 497 |
+
To remove the background noise, firstly, we apply the source-aware diffusion process by $z _ { s o u r c e } ^ { \prime }$ and $z _ { p r o m p t } ^ { \prime }$ and obtain there. Secondly, $z _ { 1 }$ as in Equation 11. The source audio’s duration and pitch are utilizedrun the target-aware denoising process to obtain the clean audio by thisand $z _ { 1 }$ the clean prompt $z _ { p r o m p t }$ . Specifically, we use the phoneme sequence, duration sequence, and pitch sequence of the source audio in this procedure.
|
| 498 |
+
|
| 499 |
+
# M LIMITATION AND FUTURE WORKS
|
| 500 |
+
|
| 501 |
+
Despite NaturalSpeech 2 has made great progress, it still suffers from the following issues.
|
| 502 |
+
|
| 503 |
+
Data coverage. Although the 44K speech data from MLS dataset is large compared to previous works, they can not cover everyone’s voice. In audiobooks, most speakers will read the books clearly and fluently, while in real world people will speak causally, thus leading to degradation when generalizing to real-world scenarios. In the future, we will scale NaturalSpeech 2 to more generalized and larger-scale benchmarks to enhance the zero-shot generation ability.
|
| 504 |
+
|
| 505 |
+
Inference efficiency. Although NaturalSpeech 2 is a non-autoregressive generation model, it still needs multiple iterations during inference. In the future, we will explore efficient strategies such as consistency models to speed up the diffusion model.
|
| 506 |
+
|
| 507 |
+
Singing voice quality. Although NaturalSpeech 2 can synthesize singing voices in a zero-shot manner, the quality is not as good as the TTS synthesis’s quality. We think we are limited in two aspects: 1) the scale of singing data and 2) the quality of singing data. For data scale, we only collect 30 hours, which is small compared with the speech data scale. For data quality, it is difficult to obtain clean human voices from commercial songs, which are a combination of vocals, backing vocals, accompaniment, and other background noises. In the future, we will first explore more efficient methods to collect more singing data and obtain higher-quality singing voices to enhance the singing voice quality.
|
md/test/TOE6N8dp4w/TOE6N8dp4w.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/TrloAXEJ2B/TrloAXEJ2B.md
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LoraHub: Efficient Cross-Task Generalization via Dynamic LoRA Composition
|
| 2 |
+
|
| 3 |
+
Chengsong Huang $\mathbf { \Delta } \mathbf { \dag \ S \mathrm { \ s \mathrm { \ s } } }$ , Qian Liu†∗, Bill Yuchen $\mathbf { L i n } ^ { \bigotimes * }$ , Tianyu Pang†, Chao ${ { \mathbf { D } } { { \mathbf { u } } } ^ { \dag } }$ , Min Lin† †Sea AI Lab, Singapore §Washington University in St. Louis, MO, USA ♢Allen Institute for AI, Seattle, WA, USA
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Low-rank adaptations (LoRA) are often employed to fine-tune large language models (LLMs) for new tasks. This paper investigates LoRA composability for cross-task generalization and introduces LoraHub, a simple framework devised for the purposive assembly of LoRA modules trained on diverse given tasks, with the objective of achieving adaptable performance on unseen tasks. With just a few examples from a new task, LoraHub can fluidly combine multiple LoRA modules, eliminating the need for human expertise and assumptions. Notably, the composition requires neither additional model parameters nor gradients. Empirical results on the Big-Bench Hard benchmark suggest that LoraHub, while not surpassing the performance of in-context learning, offers a notable performanceefficiency trade-off in few-shot scenarios by employing a significantly reduced number of tokens per example during inference. Notably, LoraHub establishes a better upper bound compared to in-context learning when paired with different demonstration examples, demonstrating its potential for future development. Our vision is to establish a platform for LoRA modules, empowering users to share their trained LoRA modules. This collaborative approach facilitates the seamless application of LoRA modules to novel tasks, contributing to an adaptive ecosystem. Our code is available at github.com/sail-sg/lorahub, and all the pre-trained LoRA modules are released at huggingface.co/lorahub.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
Figure 1: The illustration of zero-shot learning, few-shot in-context learning and few-shot LoraHub learning (ours). Note that the Compose procedure is conducted per task rather than per example. Our method achieves similar inference throughput as zero-shot learning, yet approaches the performance of in-context learning on the BIG-Bench Hard (BBH) benchmark.
|
| 13 |
+
|
| 14 |
+
Recent progress in natural language processing (NLP) has been largely fueled by large language models (LLMs) such as OpenAI GPT (Brown et al., 2020), FLAN-T5 (Chung et al., 2022), and LLaMA (Touvron et al., 2023). These models demonstrate top-tier performance across different NLP tasks. However, their enormous parameter size presents issues regarding computational efficiency and memory usage during fine-tuning. To mitigate these challenges, Low-Rank Adaptation (LoRA) (Hu et al., 2022) has emerged as a parameterefficient fine-tuning technique (Lester et al., 2021; He et al., 2022; An et al., 2022). By reducing memory demands and computational costs, it speeds up LLM training. LoRA achieves this by freezing the base model parameters (that is, an LLM) and training a lightweight module, which regularly delivers high performance on target tasks.
|
| 15 |
+
|
| 16 |
+
While prior research has targeted the efficiency enhancement facilitated by LoRA, there is a dearth of investigation into the inherent modularity and composability of LoRA modules. Typically, previous methods train LoRA modules to specialize in individual tasks. Yet, the intrinsic modularity of LoRA modules presents an intriguing research question: Would it be possible to compose LoRA modules to generalize to novel tasks in an efficient manner? In this paper, we tap into the potential of LoRA modularity for broad task generalization, going beyond single-task training to meticulously compose LoRA modules for malleable performance on unknown tasks. Crucially, our method enables an automatic assembling of LoRA modules, eliminating dependency on manual design or human expertise. With just a handful of examples from new tasks (e.g., 5), our approach can autonomously compose compatible LoRA modules without human intrusion. We do not make assumptions about which LoRA modules trained on particular tasks can be combined, allowing for flexibility in amalgamating any modules as long as they conform to the specification (e.g., using the same LLM). As our approach leverages several available LoRA modules, we refer to it as LoraHub and denote our learning method as LoraHub learning.
|
| 17 |
+
|
| 18 |
+
To validate the efficiency of our proposed methods, we test our approaches using the widely recognized BBH benchmark with FLAN-T5 (Chung et al., 2022) serving as the base LLM. The results underline the effectiveness of the LoRA module composition for unfamiliar tasks through a few-shot LoraHub learning process. Notably, our methodology achieves an average performance that closely matches that of few-shot in-context learning, while demonstrating a superior upper bound, particularly when using different demonstration examples. Additionally, our method substantially reduces the inference cost compared to in-context learning, eliminating the requirement of examples as inputs for the LLM. With fewer tokens per example during inference, our method significantly reduces computational overhead and enables faster responses. It aligns with a broader research trend, where recent studies are actively exploring approaches to reduce the number of input tokens (Zhou et al., 2023; Ge et al., 2023; Chevalier et al., 2023; Jiang et al., 2023a; Li et al., 2023; Jiang et al., 2023b). Our learning procedure is also notable for its computational efficiency, using a gradient-free approach to obtain the coefficients of LoRA modules and requiring only a handful of inference steps for unseen tasks. For example, when applied to a new task in BBH, our methodology can deliver superior performance in less than a minute using a single A100 card.
|
| 19 |
+
|
| 20 |
+
Importantly, LoraHub learning can feasibly be accomplished with a CPU-only machine, requiring proficiency solely for processing LLM inference. In our pursuit to democratize artificial intelligence, we are taking an important step forward by envisioning the establishment of the LoRA platform. The platform would serve as a marketplace where users can seamlessly share and access well-trained LoRA modules for diverse applications. LoRA providers have the flexibility to freely share or sell their modules on the platform without compromising data privacy. Users, equipped with CPU capability, can leverage trained LoRA modules contributed by others through automated distribution and composition algorithms. This platform not only cultivates a repository of reusable LoRA modules with a myriad of capabilities but also sets the stage for cooperative AI development. It empowers the community to collectively enrich the LLM’s capabilities through dynamic LoRA composition.
|
| 21 |
+
|
| 22 |
+
# 2 Problem Statement
|
| 23 |
+
|
| 24 |
+
Large Language Models We assume that a large language model $M _ { \theta }$ is based on Transformer architecture (Vaswani et al., 2017) and has been pre-trained on a large-scale text corpus. The model architecture can be either encoder-decoder (Raffel et al., 2020) or decoderonly (Brown et al., 2020). Also, $M _ { \theta }$ could also have been fine-tuned with a large set of instruction-following datasets such as Flan Colleciton (Longpre et al., 2023) and PromptSource (Bach et al., 2022).
|
| 25 |
+
|
| 26 |
+
Cross-Task Generalization In real-world situations, users often desire an LLM to perform novel tasks that it has not encountered before — an ability widely known as cross-task generalization. Generally, cross-task generalization falls into two categories: zero-shot learning (Mishra et al., 2022; Sanh et al., 2022; Chung et al., 2022; OpenAI, 2022; Lin et al., 2022), which necessitates no labeled examples of the new task, and few-shot learning (Ye et al., 2021; Min et al., 2022) which demands a handful of labeled examples. Assume we have $N$ distinct upstream tasks that the LLM has been trained on, denoted as $\mathbb { T } = \{ \mathcal { T } _ { 1 } , . . . , \mathcal { T } _ { N } \}$ . Our paper primarily focuses on the latter category, where for an unseen target task $\mathcal { T } ^ { \prime } \notin \mathbb { T } ,$ , users can only provide a limited set of labeled examples, Q. Our aim is to modify the model $M _ { \theta }$ to adapt it to task $\tau ^ { \prime }$ using only $Q$ . An intuitive method would be to fine-tune the weights of ${ \mathrm { { \dot { M } } } } _ { \theta }$ based on $Q ,$ yielding an updated model $M _ { \phi }$ with enhanced performance on $\tau ^ { \prime }$ . However, this approach is inefficient, time-consuming, and unstable when $Q$ is small.
|
| 27 |
+
|
| 28 |
+
LoRA Tuning LoRA is a parameter-efficient fine-tuning method (Hu et al., 2022), facilitates the adaptation of LLMs using lightweight modules, eliminating the need for finetuning the entire weights. LoRA tuning involves keeping the original model weights frozen while introducing trainable low-rank decomposition matrices as adapter modules into each layer of the model. Compared to the base LLM, this module possesses significantly fewer trainable parameters, paving the way for rapid adaptation using minimal examples. As such, LoRA tuning presents a resource-efficient technique to quickly adapt LLMs for new tasks with restricted training data. However, traditional LoRA methods primarily concentrate on training and testing within the same tasks (Gema et al., 2023), rather than venturing into few-shot cross-task generalization.
|
| 29 |
+
|
| 30 |
+
# 3 Methodology
|
| 31 |
+
|
| 32 |
+
In this section, we provide an overview of our proposed method. We then explain the LoRA tuning procedure in detail. Last, we introduce the procedure of our LoraHub learning, which consists of the COMPOSE stage and the ADAPT stage.
|
| 33 |
+
|
| 34 |
+
# 3.1 Method Overview
|
| 35 |
+
|
| 36 |
+
As depicted in Figure 2, we initially train LoRA modules on a variety of upstream tasks. Specifically, for $N$ distinct upstream tasks, we separately train $N$ LoRA modules, each represented as $m _ { i }$ for task $\mathscr { T } _ { i } \in \mathbf { \hat { T } }$ . Subsequently, for a new task $\mathcal { T } ^ { \prime } \notin \mathbb { T } ,$ , such as Boolean Expressions represented in Figure 2, its examples $Q$ are utilized to steer the LoraHub learning process. The LoraHub learning encapsulates two main phases: the COMPOSE phase and the ADAPT phase. In the COMPOSE phase, all available LoRA modules are combined into a single integrated module $\hat { m } _ { - }$ , using $\left\{ w _ { 1 } , w _ { 2 } , \dots , w _ { N } \right\}$ as coefficients. Each $w _ { i }$ is a scalar value that can take on positive or negative values, and the combination can be done in different ways. During the ADAPT phase, the combined LoRA module $\hat { m }$ is amalgamated with the LLM $M _ { \theta }$ , and its performance on few-shot examples from the new task $\mathbf { \breve { { \mathbf { \nabla } } } } _ { \mathbf { \mathbf { \mathbf { \mathbf { \mathcal { T } } } } } ^ { \prime } }$ is assessed. A gradient-free algorithm is subsequently deployed to update $w _ { . }$ , enhancing mˆ ’s performance (e.g., loss) on the few-shot examples $Q$ . Finally, after iterating through $K$ steps, the optimum performing LoRA module is applied to the LLM $M _ { \theta }$ , yielding the final LLM $M _ { \phi } = \mathrm { L o R A } ( \hat { M } _ { \theta } , \hat { m } )$ . This serves as an effectively adjusted model for the unseen task $\tau ^ { \prime }$ , which will then be deployed and not updated anymore.
|
| 37 |
+
|
| 38 |
+
# 3.2 LoRA tuning on upstream tasks
|
| 39 |
+
|
| 40 |
+
LoRA effectively minimizes the number of trainable parameters through the process of decomposing the attention weight matrix update of the LLM, denoted as $W _ { 0 } \in \bar { R } ^ { d \times k } ,$ , into low-rank matrices. In more specific terms, LoRA exhibits the updated weight matrix in the form $W _ { 0 } + \delta W = W _ { 0 } + A B ,$ where $A \in \mathbb { R } ^ { d \times r }$ and $B \in \mathbb { R } ^ { r \times k }$ are trainable low-rank matrices with rank $r ,$ a dimension significantly smaller than those of $d$ and $k$ . In this context, the product $A B$ defines the LoRA module $m ,$ , as previously elaborated. By leveraging the low-rank decomposition, LoRA substantially reduces the number of trainable parameters needed to adapt the weights of LLMs duriing fine-tuning.
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 2: Our method encompasses two stages: the COMPOSE stage and the ADAPT stage. During the COMPOSE stage, existing LoRA modules are integrated into one unified module, employing a set of coefficients, denoted as $w$ . In the ADAPT stage, the combined LoRA module is evaluated on a few examples from the unseen task. Subsequently, a gradient-free algorithm is applied to refine $w$ . After executing $K$ iterations, a highly adapted combined LoRA module is produced, which can be incorporated with the LLM to perform the intended task.
|
| 44 |
+
|
| 45 |
+
# 3.3 COMPOSE: Element-wise composition of LoRA modules
|
| 46 |
+
|
| 47 |
+
Within the COMPOSE stage, we implement an element-wise method to combine LoRA modules. This process integrates the corresponding parameters of the LoRA modules, requiring the modules being combined to have the same rank $r$ to properly align the structures. Given that $m _ { i } = A _ { i } B _ { i } ,$ the combined LoRA module $\hat { m }$ can be obtained by:
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\hat { m } = ( w _ { 1 } A _ { 1 } + w _ { 2 } A _ { 2 } + \cdot \cdot \cdot + w _ { N } A _ { N } ) ( w _ { 1 } B _ { 1 } + w _ { 2 } B _ { 2 } + \cdot \cdot \cdot + w _ { N } B _ { N } ) .
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
Notbly, as we show in Sec. 5, combining too many LoRA modules at once can expand the search space exponentially, which may destabilize the LoraHub learning process and prevent optimal performance. To mitigate this, we employ random selection to prune the candidate space, and more advanced pre-filtering algorithms could be explored in the future.
|
| 54 |
+
|
| 55 |
+
# 3.4 ADAPT: Weight optimization via gradient-free methods
|
| 56 |
+
|
| 57 |
+
During the ADAPT stage, our goal is to modify the coefficients $w$ to boost the model’s performace on the examples from an unseen task. One might think of using gradient descent to optimize $w ,$ following standard backpropagation methods. However, this approach demands constructing a hypernetwork for all LoRA modules, similar to differentiable architecture search methods (Zhang et al., 2019). Constructing these hypernetworks demands for substantial GPU memory and time, posing a challenge. Given that $w$ consists of a relatively small number of parameters, we opted for gradient-free methods for optimization instead of gradient descent.
|
| 58 |
+
|
| 59 |
+
Inspired by previous work (Sun et al., 2022), we utilize a black-box optimization technique to find the optimal $w$ . The optimization process is steered by the cross-entropy loss, setting the goal to locate the best set $\left\{ w _ { 1 } , w _ { 2 } , \ldots , w _ { N } \right\}$ that reduces the loss $L$ on the few-shot examples $Q$ . Furthermore, we incorporate L1 regularization to penalize the sum of the absolute values of $w _ { . }$ , helping to prevent obtaining extreme values. Consequently, the final objective of LoraHub is to minimize $\begin{array} { r } { L + \alpha \cdot \sum _ { i = 1 } ^ { N } | \dot { w } _ { i } | , } \end{array}$ , where $\alpha$ serves as a hyperparameter.
|
| 60 |
+
|
| 61 |
+
In terms of the gradient-free method, we leverage Shiwa, a combinatorial optimization approach (Liu et al., 2020). Shiwa offers a variety of algorithms and chooses the most suitable optimization algorithm for different circumstances. In most of the forthcoming experimental setups, we primarily employ the Covariance Matrix Adaptive Evolution Strategies (CMA-ES) (Hansen & Ostermeier, 1996). CMA-ES, as a stochastic and population-based optimization algorithm, offers versatility in addressing a broad spectrum of optimization challenges. It dynamically adjusts a search distribution, which is defined by a covariance matrix. During each iteration, CMA-ES systematically updates both the mean and covariance of this distribution to optimize the target function. In our application, we employ this algorithm to mold the search space for w. Ultimately, we use it to identify the optimal $w$ by evaluating their performance on the few-shot examples from an unseen task.
|
| 62 |
+
|
| 63 |
+
# 4 Experimental Results
|
| 64 |
+
|
| 65 |
+
In this section, we provide details on our main experiments. First, we give an overview of the experimental setup and implementation details. Next, we present our findings along with the results.
|
| 66 |
+
|
| 67 |
+
# 4.1 Experimental setup
|
| 68 |
+
|
| 69 |
+
Large Language Model In our main experiments, we employ FLAN-T5 (Chung et al., 2022), particularly FLAN-T5-large, as the base LLM. The model has shown impressive abilities to perform zero-shot and few-shot learning.
|
| 70 |
+
|
| 71 |
+
Candidate LoRA Modules Our methodology requires a compendium of LoRA modules trained on preceding tasks. For parity with FLAN, we adopt the tasks utilized to instruct FLAN-T5, thereby incorporating nearly 200 distinct tasks and their corresponding instructions. Following this, we trained several LoRA modules as potential candidates. During each experimental sequence, we randomly select 20 LoRA modules from them as the candidate for our LoraHub learning.
|
| 72 |
+
|
| 73 |
+
Dataset and evaluation Our method is evaluated using the Big-Bench Hard (BBH) benchmark, a well-established standard that consists of multiple-choice questions from a variety of domains. The benchmark consists of 27 different tasks, which are regarded to be challenging for language models. For all tasks, we employ the exact match (EM) as our evaluation metric.
|
| 74 |
+
|
| 75 |
+
Baseline Setup To enhance the demonstration of our method’s performance, we expanded our comparisons beyond the zero-shot and in-context learning settings. We specifically chose three representative gradient-based methods for comparison: full fine-tuning (FFT), LoRA tuning (LoRA) (Hu et al., 2022), and IA3 fine-tuning (IA3) (Liu et al., 2022). For all gradient-based methods, for a fair comparsion, we train for 40 epochs on the same three runs of 5 examples employed in our methods. In the case of FFT, a learning rate of 3e-5 is employed, whereas for IA3 and LoRA, we adopt a learning rate of 2e-4. We report the performance of each method on the test set at the end of training (averaged over three runs) without any model selection to avoid potential selection bias.
|
| 76 |
+
|
| 77 |
+
# 4.2 Main results
|
| 78 |
+
|
| 79 |
+
As shown in Table 1, our experimental results demonstarte the superior efficacy of our method in comparison to zero-shot learning while closely resembling the performance of in-context learning (ICL) in few-shot scenarios. This observation is derived from an average performance of three runs, each leveraging different few-shot examples. Importantly, our model utilizes an equivalent number of tokens as the zero-shot method, notably fewer than the count used by ICL. Although occasional performance fluctuations, our method consistently outperforms zero-shot learning in most tasks. In the era of LLMs, the input length is directly proportional to the inference cost, and thus LoraHub’s ability to economize on input tokens while approaching the peak performance grows increasingly significant. Moreover, as shown in Appendix Table 4, the upper bound performance of our method across these runs can surpass ICL on 18 tasks, demonstrating its potential for future development.
|
| 80 |
+
|
| 81 |
+
Table 1: Experimental results of zero-shot learning (Zero), few-shot in-context learning (ICL), IA3 fine-tuning (IA3), LoRA tuning (LoRA), full fine-tuning (FFT) and our proposed few-shot LoraHub learning (LoraHub) on the BBH benchmark with FLAN-T5-large as the base LLM. We denote algorithmic tasks with the superscript $\ S$ following previous work (Wu et al., 2023b). Note that we employ three runs, each leveraging different 5-shot examples per task, as demonstrations for all few-shot methods. The average performance of all methods is reported below, and the best performance of each few-shot method can be found in the Appendix B.
|
| 82 |
+
|
| 83 |
+
<table><tr><td>Task</td><td>Zero</td><td>ICLavg</td><td>IA3avg</td><td>LoRAavg</td><td>FFTavg</td><td>LoraHubavg</td></tr><tr><td>Boolean Expressions</td><td>54.0</td><td>59.6</td><td>56.2</td><td>56.0</td><td>62.2</td><td>55.5</td></tr><tr><td>Causal Judgement</td><td>57.5</td><td>59.4</td><td>60.2</td><td>55.6</td><td>57.5</td><td>54.3</td></tr><tr><td>Date Understanding</td><td>15.3</td><td>20.4</td><td>20.0</td><td>35.8</td><td>59.3</td><td>32.9</td></tr><tr><td>Disambiguation</td><td>0.0</td><td>69.1</td><td>0.0</td><td>68.0</td><td>68.2</td><td>45.2</td></tr><tr><td>Dyck Languages</td><td>1.3</td><td>0.9</td><td>4.2</td><td>22.2</td><td>19.5</td><td>1.0</td></tr><tr><td>Formal Fallacies</td><td>51.3</td><td>55.3</td><td>51.5</td><td>53.6</td><td>54.0</td><td>52.8</td></tr><tr><td>Geometric Shapes</td><td>6.7</td><td>19.6</td><td>14.7</td><td>24</td><td>31.1</td><td>7.4</td></tr><tr><td>Hyperbaton</td><td>6.7</td><td>71.8</td><td>49.3</td><td>55.3</td><td>77.3</td><td>62.8</td></tr><tr><td>Logical DeductionS (five objects)</td><td>21.3</td><td>39.1</td><td>32.7</td><td>40.0</td><td>42.2</td><td>36.1</td></tr><tr><td>Logical DeductionS (seven objects)</td><td>12.7</td><td>40.7</td><td>33.8</td><td>37.3</td><td>44.9</td><td>36.8</td></tr><tr><td>Logical DeductionS (three objects)</td><td>0.0</td><td>51.6</td><td>8.5</td><td>53.6</td><td>52.9</td><td>45.7</td></tr><tr><td>Movie Recommendation</td><td>62.7</td><td>55.8</td><td>61.8</td><td>51.5</td><td>66.0</td><td>55.3</td></tr><tr><td>Multistep Arithmetic</td><td>0.7</td><td>0.7</td><td>0.7</td><td>0.2</td><td>0.0</td><td>0.4</td></tr><tr><td>Navigate</td><td>47.3</td><td>45.3</td><td>46.2</td><td>48.0</td><td>48.0</td><td>47.1</td></tr><tr><td>Object Counting</td><td>34.7</td><td>32.4</td><td>35.1</td><td>38.7</td><td>35.6</td><td>33.7</td></tr><tr><td>Penguins in a Table</td><td>43.5</td><td>41.3</td><td>45.0</td><td>36.2</td><td>31.9</td><td>35.9</td></tr><tr><td>Reasoning about Colored Objects</td><td>32.0</td><td>40.2</td><td>40.7</td><td>39.6</td><td>37.6</td><td>40.0</td></tr><tr><td>Ruin Names</td><td>23.3</td><td>19.3</td><td>24.4</td><td>37.8</td><td>61.3</td><td>24.4</td></tr><tr><td>Salient Translation Error Detection</td><td>37.3</td><td>47.3</td><td>37.1</td><td>16.0</td><td>16.2</td><td>36.0</td></tr><tr><td>Snarks</td><td>50.0</td><td>54.2</td><td>53.9</td><td>55.6</td><td>66.7</td><td>56.9</td></tr><tr><td>Sports Understanding</td><td>56.0</td><td>54.7</td><td>55.1</td><td>56.5</td><td>54.0</td><td>56.7</td></tr><tr><td> Temporal Sequences</td><td>16.7</td><td>25.1</td><td>18.2</td><td>25.1</td><td>37.8</td><td>18.2</td></tr><tr><td>Tracking Shuffled ObjectsS (five objects)</td><td>12.0</td><td>12.0</td><td>12.0</td><td>13.8</td><td>16.9</td><td>12.3</td></tr><tr><td>Tracking Shuffled Objects (seven objects)</td><td>6.7</td><td>6.7</td><td>6.7</td><td>10.0</td><td>9.8</td><td>7.7</td></tr><tr><td>Tracking Shuffled ObjectsS (three objects)</td><td>24.7</td><td>31.1</td><td>30.7</td><td>30.9</td><td>32.0</td><td>29.2</td></tr><tr><td>Web of Lies</td><td>54.0</td><td>53.8</td><td>54.2</td><td>52.7</td><td>48.2</td><td>50.1</td></tr><tr><td>Word Sorting</td><td>1.3</td><td>0.5</td><td>1.3</td><td>4.9</td><td>4.9</td><td>1.1</td></tr><tr><td>Avg Performance Per Task</td><td>27.0</td><td>37.3</td><td>31.6</td><td>37.7</td><td>42.1</td><td>34.7</td></tr><tr><td>Avg Tokens Per Example</td><td>111.6</td><td>597.8</td><td>111.6</td><td>111.6</td><td>111.6</td><td>111.6</td></tr><tr><td>Gradient-based Training</td><td>No</td><td>No</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td></tr></table>
|
| 84 |
+
|
| 85 |
+
Even when compared to certain gradient-based optimization methods, our approach consistently demonstrates competitive performance. For example, as depicted in Table 1, our method exhibits a notable improvement of $3 . 1 \%$ on average in contrast to the promising IA3 method. Nevertheless, we acknowledge that our approach still falls behind LoRA tuning and full fine-tuning, especially in tasks that exhibit significant deviation from the upstream task. Taking Dyck Languages as an example, both LoraHub and ICL achieve only an average performance of nearly $1 . 0 \%$ on these tasks, while LoRA and FFT methods showcase impressive results with only 5 examples.
|
| 86 |
+
|
| 87 |
+
# 4.3 Discussion
|
| 88 |
+
|
| 89 |
+
LoraHub addresses the challenge of reducing inference costs by eliminating the need for processing additional tokens, resulting in a noticeable reduction in overall inference expenses. However, it introduces an inherent cost during the ADAPT stage, necessitating extra inference steps, such as the 40 steps employed in our experiments. This introduces a trade-off between choosing the ICL approach and LoraHub, with the decision typically hinging on the nature of the situation.
|
| 90 |
+
|
| 91 |
+
For one-time ad-hoc tasks, the ICL approach should be more pragmatic due to LoraHub’s additional inference step costs. In such scenarios, where immediate, single-use solutions are preferred, the simplicity and efficiency of ICL might outweigh the benefits of potential savings offered by LoraHub. Conversely, for recurring or similar tasks, LoraHub emerges as a compelling option. Despite the added inference step cost, LoraHub’s ability to efficiently handle repetitive tasks, often occurring thousands of times, while concurrently reducing overall expenses, positions it as a viable option in such kind of situations.
|
| 92 |
+
|
| 93 |
+
In summary, our intention is not to replace $\scriptstyle { \mathrm { I C L } } ,$ but to present LoraHub as a complementary strategy with performance-efficiency trade-offs. Thus, we encourage a careful consideration of specific use cases and requirements when choosing between ICL and LoraHub, recognizing that the optimal solution may vary based on the nature and frequency of the tasks at hand.
|
| 94 |
+
|
| 95 |
+
# 5 Experimental Analysis
|
| 96 |
+
|
| 97 |
+
In this section, we thoroughly examine the characteristics of our proposed method and uncover several insightful findings. If not specified, we use FLAN-T5-large for all analysis.
|
| 98 |
+
|
| 99 |
+
Does composing LoRA modules extend beyond the single module’s benefits?
|
| 100 |
+
|
| 101 |
+
We acknowledge the investigation of cross-task performance in prior work (Jang et al., 2023), which delved into the capabilities of LoRA and proposed a novel method centered around LoRA module retrieval. In order to ensure a fair comparison, we conducted an experiment where we
|
| 102 |
+
|
| 103 |
+
Table 2: The average performance of various methods across all tasks in the benchmark BBH.
|
| 104 |
+
|
| 105 |
+
<table><tr><td>LoRA Retrieval</td><td>LoraHub avg</td><td>LoraHub best</td></tr><tr><td>31.7</td><td>34.7</td><td>41.2</td></tr></table>
|
| 106 |
+
|
| 107 |
+
designed a LoRA retrieval mechanism based on the loss derived from few-shot examples. Specifically, we ranked all LoRA module candidates according to this loss and evaluated the best candidate on the test set of the unseen task. As depicted in Table 2, the performance of LoRA retrieval is notably impressive, positioning it as a strong baseline. However, in comparison to LoraHub, the performance of LoRA retrieval is relatively less favorable
|
| 108 |
+
|
| 109 |
+
How effective is the gradient-free optimization method?
|
| 110 |
+
|
| 111 |
+
To assess the effectiveness of our gradient-free optimization method in correctly identifying the most suitable LoRA module for a given downstream task, we carried out an empirical study using the WikiTableQuestions (Pasupat & Liang, 2015) (WTQ) dataset. We strategically included a LoRA module that was specifically trained on the WTQ dataset into our pool of LoRA candidate modules, which originally stemmed from tasks exclusive to the Flan Collection. Subsequently, we designated WTQ as the targeted downstream task and computed the weights consistent with the methods employed in LoraHub learning. As an end result, the WTQ-specific LoRA module was awarded the highest weight, exemplifying the algorithm’s success in recognizing it as the most relevant. Moreover, the combined LoRA module demonstrated marginal superiority over the WTQ LoRA module. This underscores the claim that the gradient-free optimization method has the ability to proficiently select the optimal upstream LoRA module for an unseen task.
|
| 112 |
+
|
| 113 |
+
Can LoraHub work well on non-instruction-tuning models?
|
| 114 |
+
|
| 115 |
+
In previous investigations, we primarily focused on models with zero-shot capabilities that were trained with instruction tuning. However, for models like T5 without zero-shot abilities, where training has a larger effect on parameters, it was unclear if LoraHub could still effectively manage and improve them. Our experiments show that although these models perform worse than FLAN-T5, LoraHub learning can still enable them to effectively generlize to unseen tasks. See Appendix C for more details.
|
| 116 |
+
|
| 117 |
+
Will the rank of LoRA modules impact the performance of LoraHub learning?
|
| 118 |
+
|
| 119 |
+
The parameter rank plays a crucial role in the LoRA framework, directly influencing the number of trainable parameters utilized during LoRA tuning. This prompts an intriguing question: does the variation in rank values influence the outcomes observed within the LoraHub learning? Our analysis indicates that, for FLAN-T5, the choice of rank has minimal impact. However, for T5, it still exerts some influence. Empirical findings reveal that, in comparison to rank values of 4 or 64, a rank value of 16 consistently demonstrates superior performance across different runs, both in terms of average and optimal values. Additional results are available in Appendix C.
|
| 120 |
+
|
| 121 |
+
Does more LoRA modules lead to better results?
|
| 122 |
+
|
| 123 |
+
In our main experiments, we randomly selected 20 LoRA modules for LoraHub learning. Therefore, we conducted experiments to investigate the effect of using different numbers of LoRA modules. The results demonstrate that as we increased the number of LoRA modules, the variance in performance increased. However, the maximum achievable performance also improved. More analysis on the variance and the detailed results can be found in Appendix H.
|
| 124 |
+
|
| 125 |
+
How much computational resource can be saved?
|
| 126 |
+
|
| 127 |
+
We follow to the memory test settings from the LoRA-FA (Zhang et al., 2023b) study for an accurate benchmark. In this context, full fine-tuning required about 40GB of memory, whereas LoRA fine-tuning used around 34GB. Remarkably, LoraHub only utilized about 5GB of memory, illustrating its efficiency due to the inference-only mode, which eliminates the need for storing gradients and optimization states.
|
| 128 |
+
|
| 129 |
+
# 6 Related work
|
| 130 |
+
|
| 131 |
+
Model Merging Our method substantially draws on the concept of LoRA module composition, and thus, aligns with the significant thread of research in model merging. This research focus is broadly categorized based on the ultimate objectives of model merging.
|
| 132 |
+
|
| 133 |
+
The first category focuses on merging entire models, and the goal is to combine individually trained models to approximate the performance benefits of model ensembling or multi-task learning. Prior works (Matena & Raffel, 2021; Jin et al., 2023; Yadav et al., 2023; Wu et al., 2023a) operated under the assumption of shared model architectures. For example, Matena & Raffel (2021) amalgamates models by approximating Gaussian posterior distributions garnered from Fisher information, while Yadav et al. (2023) merges models via resolving model interferences. Another approach is merging models with different architectures. For instance, Ainsworth et al. (2023) configures weights of different models prior to their merger. Following this objective, Stoica et al. (2023) merges models operating on varying tasks by identifying common features, without requiring additional training. Unlike these works, our work focuses on merging models for better cross-task generalization.
|
| 134 |
+
|
| 135 |
+
The second category most closely aligns with our research, stemming from a shared motivation of module composition. Various scholars have made advances in this line of research: Kingetsu et al. (2021) decomposes and recomposes modules on the basis of their functionality; Ilharco et al. (2023) proposes modulating model behavior using task vectors; Lv et al. (2023) amalgamates parameter-efficient modules weighted according to task similarity; Zhang et al. (2023a) crafts modules by employing specific arithmetic operations; Sun et al. (2023) improves few-shot performance of unseen tasks by multi-task pre-training of prompts; Chronopoulou et al. (2023) averages adapter weights intended for transfer; Ponti et al. (2023) focuses on jointly learning adapters and a routing function that allocates skills to each task; and Muqeeth et al. (2023) concentrates on amalgamating experts in mixture of experts models; However, these methods generally necessitate multi-task training or human prior on module selection for the downstream task. In contrast, our method does not impose any special training requirements and simply employs vanilla LoRA tuning. Additionally, the module selection for downstream tasks is entirely data-driven without human prior knowledge. This design gives the advantage of easily adding new LoRA modules for reuse, allowing our method to flexibly scale up the number of LoRA module candidates in the future.
|
| 136 |
+
|
| 137 |
+
Mixture of Experts The Mixture of Experts (MoE) is an ensemble method, often visualized as a collection of sub-modules, or “experts”, each specializing in processing different types of input data. Each expert in this system is controlled by a unique gating network, activated based on the distinct nature of the input data. For every token in these input sequences, this network identifies and engages the most suitable experts to process the data. As a result, the performance is superior compared to relying on a single, generic model for all types of input. This technique has proven instrumental in numerous domains, such as natural language processing and computer vision (Jacobs et al., 1991; Shazeer et al., 2017; Du et al., 2022; Zhang et al., 2022; Wang et al., 2022; crumb, 2023). Our methodology displays similarities to MoE, wherein upstream-trained LoRA modules can be aligned with MoE’s expert design. A noteworthy distinguishing factor is that our approach mechanism does not require any specialized manipulation of LoRAs during training while facilitating dynamic LoRA module assembly at any scale, each pre-tuned to different tasks. In contrast, MoE mandates a predetermined count of experts during both the training and testing phases. Recent studies on the interrelation between MoE and instruction tuning have demonstrated that the simultaneous application of both approaches enhances the effectiveness of each individually (Shen et al., 2023).
|
| 138 |
+
|
| 139 |
+
Cross-Task generalization Recent advancements like CrossFit (Ye et al., 2021), ExT5 (Aribandi et al., 2022), FLAN (Wei et al., 2022), T0 (Sanh et al., 2022), InstructGPT (Ouyang et al., 2022), and ReCross (Lin et al., 2022) have been striving to foster a vastly multi-task model’s generalization across different tasks, very much aligned with the objectives of our research. Among this cohort, the connections of CrossFit and ReCross with LoraHub are particularly noteworthy. The CrossFit framework (Ye et al., 2021) mandates a minimal number of labeled examples of the target task for few-shot fine-tuning. However, its limitation lies in the application of task names as hard prefixes in templates, posing challenges in the task’s generalization. On the other hand, while ReCross mitigates the need for labels in few-shot examples for retrieval, it necessitates a fine-tuning process using the retrieved data. This procedure appears time-consuming when compared to LoraHub’s approach. Through the deployment of few-shot labeled examples and a gradientfree optimization process, LoraHub facilitates an iterative update of weights to compose the LoRA modules. The resultant method is more efficient and cost-effective relative to previous work. Overall, LoraHub offers a more practical and viable solution to the optimization process.
|
| 140 |
+
|
| 141 |
+
# 7 Conclusion
|
| 142 |
+
|
| 143 |
+
In this work, we have introduced LoraHub, a strategic framework for composing LoRA modules trained on diverse tasks in order to achieve adaptable performance on new tasks. Our approach enables the fluid combination of multiple LoRA modules using just a few examples from a novel task, without requiring additional model parameters or human expertise. The empirical results on the BBH benchmark demonstrate that LoraHub can effectively match the performance of in-context learning in few-shot scenarios, removing the need for in-context examples during inference. Overall, our work shows the promise of strategic LoRA composability for rapidly adapting LLMs to diverse tasks. By fostering reuse and combination of LoRA modules, we can work towards more general and adaptable LLMs while minimizing training costs.
|
| 144 |
+
|
| 145 |
+
# Reproducibility Statement
|
| 146 |
+
|
| 147 |
+
The authors have made great efforts to ensure the reproducibility of the empirical results reported in this paper. Firstly, the experiment settings, evaluation metrics, and datasets were described in detail in Section 4.1. Secondly, the codes and script for reproduce the result will be opensource after accepted. Second, the source code implementing the proposed method and experiments will be made publicly available at upon acceptance of the paper. Third, pre-trained LoRA modules from this work along with their configuration files and weights will be shared. These allow reproduction without retraining the LoRA modules, enabling quick testing and verification.
|
| 148 |
+
|
| 149 |
+
# References
|
| 150 |
+
|
| 151 |
+
Samuel Ainsworth, Jonathan Hayase, and Siddhartha Srinivasa. Git re-basin: Merging models modulo permutation symmetries. In The Eleventh International Conference on Learning Representations, 2023.
|
| 152 |
+
Shengnan An, Yifei Li, Zeqi Lin, Qian Liu, Bei Chen, Qiang Fu, Weizhu Chen, Nanning Zheng, and Jian-Guang Lou. Input-tuning: Adapting unfamiliar inputs to frozen pretrained models. ArXiv preprint, 2022.
|
| 153 |
+
Vamsi Aribandi, Yi Tay, Tal Schuster, Jinfeng Rao, Huaixiu Steven Zheng, Sanket Vaibhav Mehta, Honglei Zhuang, Vinh Q. Tran, Dara Bahri, Jianmo Ni, Jai Prakash Gupta, Kai Hui, Sebastian Ruder, and Donald Metzler. Ext5: Towards extreme multi-task scaling for transfer learning. In Proc. of ICLR, 2022.
|
| 154 |
+
Stephen Bach, Victor Sanh, Zheng Xin Yong, Albert Webson, Colin Raffel, Nihal V. Nayak, Abheesht Sharma, Taewoon Kim, M Saiful Bari, Thibault Fevry, Zaid Alyafeai, Manan Dey, Andrea Santilli, Zhiqing Sun, Srulik Ben-david, Canwen Xu, Gunjan Chhablani, Han Wang, Jason Fries, Maged Al-shaibani, Shanya Sharma, Urmish Thakker, Khalid Almubarak, Xiangru Tang, Dragomir Radev, Mike Tian-jian Jiang, and Alexander Rush. PromptSource: An integrated development environment and repository for natural language prompts. In Proc. of ACL, 2022.
|
| 155 |
+
Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, MariaFlorina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 156 |
+
|
| 157 |
+
Alexis Chevalier, Alexander Wettig, Anirudh Ajith, and Danqi Chen. Adapting language models to compress contexts. CoRR, abs/2305.14788, 2023. doi: 10.48550/ARXIV.2305. 14788. URL https://doi.org/10.48550/arXiv.2305.14788.
|
| 158 |
+
|
| 159 |
+
Alexandra Chronopoulou, Matthew Peters, Alexander Fraser, and Jesse Dodge. AdapterSoup: Weight averaging to improve generalization of pretrained language models. In Findings of the Association for Computational Linguistics: EACL 2023, 2023.
|
| 160 |
+
|
| 161 |
+
Hyung Won Chung, Le Hou, S. Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Wei Yu, Vincent Zhao, Yanping Huang, Andrew M. Dai, Hongkun Yu, Slav Petrov, Ed Huai hsin Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instruction-finetuned language models. ArXiv preprint, 2022.
|
| 162 |
+
crumb. Llama-2, mixutre of lora. https://crumbly.medium.com/ llama-2-molora-f5f909434711, 2023.
|
| 163 |
+
Nan Du, Yanping Huang, Andrew M. Dai, Simon Tong, Dmitry Lepikhin, Yuanzhong Xu, Maxim Krikun, Yanqi Zhou, Adams Wei Yu, Orhan Firat, Barret Zoph, Liam Fedus, Maarten P. Bosma, Zongwei Zhou, Tao Wang, Yu Emma Wang, Kellie Webster, Marie Pellat, Kevin Robinson, Kathleen S. Meier-Hellstern, Toju Duke, Lucas Dixon, Kun Zhang, Quoc V. Le, Yonghui Wu, Zhifeng Chen, and Claire Cui. Glam: Efficient scaling of language models with mixture-of-experts. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), ´ International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, Proceedings of Machine Learning Research, 2022.
|
| 164 |
+
Tao Ge, Jing Hu, Xun Wang, Si-Qing Chen, and Furu Wei. In-context autoencoder for context compression in a large language model. CoRR, abs/2307.06945, 2023. doi: 10. 48550/ARXIV.2307.06945. URL https://doi.org/10.48550/arXiv.2307.06945.
|
| 165 |
+
Aryo Pradipta Gema, Luke Daines, Pasquale Minervini, and Beatrice Alex. Parameterefficient fine-tuning of llama for the clinical domain. ArXiv preprint, 2023.
|
| 166 |
+
Nikolaus Hansen and Andreas Ostermeier. Adapting arbitrary normal mutation distributions in evolution strategies: the covariance matrix adaptation. Proceedings of IEEE International Conference on Evolutionary Computation, 1996.
|
| 167 |
+
Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, and Graham Neubig. Towards a unified view of parameter-efficient transfer learning. In Proc. of ICLR, 2022.
|
| 168 |
+
Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. In Proc. of ICLR, 2022.
|
| 169 |
+
Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman, Ludwig Schmidt, Hannaneh Hajishirzi, and Ali Farhadi. Editing models with task arithmetic. In The Eleventh International Conference on Learning Representations, 2023.
|
| 170 |
+
Robert A. Jacobs, Michael I. Jordan, Steven J. Nowlan, and Geoffrey E. Hinton. Adaptive mixtures of local experts. Neural Computation, 1991.
|
| 171 |
+
Joel Jang, Seungone Kim, Seonghyeon Ye, Doyoung Kim, Lajanugen Logeswaran, Moontae Lee, Kyungjae Lee, and Minjoon Seo. Exploring the benefits of training expert language models over instruction tuning. In International Conference on Machine Learning, 2023. URL https://api.semanticscholar.org/CorpusID:256627673.
|
| 172 |
+
Huiqiang Jiang, Qianhui Wu, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. Llmlingua: Compressing prompts for accelerated inference of large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, December 2023a. URL https://arxiv.org/abs/2310.05736.
|
| 173 |
+
|
| 174 |
+
Huiqiang Jiang, Qianhui Wu, Xufang Luo, Dongsheng Li, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. Longllmlingua: Accelerating and enhancing llms in long context scenarios via prompt compression. CoRR, abs/2310.06839, 2023b. doi: 10.48550/ARXIV.2310.06839. URL https://doi.org/10.48550/arXiv.2310.06839.
|
| 175 |
+
|
| 176 |
+
Xisen Jin, Xiang Ren, Daniel Preotiuc-Pietro, and Pengxiang Cheng. Dataless knowledge fusion by merging weights of language models. In The Eleventh International Conference on Learning Representations, 2023.
|
| 177 |
+
Hiroaki Kingetsu, Kenichi Kobayashi, and Taiji Suzuki. Neural network module decomposition and recomposition. ArXiv preprint, 2021.
|
| 178 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In Proc. of EMNLP, 2021.
|
| 179 |
+
Yucheng Li, Bo Dong, Chenghua Lin, and Frank Guerin. Compressing context to enhance inference efficiency of large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, December 2023. URL https://arxiv.org/abs/2310.06201.
|
| 180 |
+
Bill Yuchen Lin, Kangmin Tan, Chris Miller, Beiwen Tian, and Xiang Ren. Unsupervised cross-task generalization via retrieval augmentation. In NeurIPS, 2022.
|
| 181 |
+
Haokun Liu, Derek Tam, Mohammed Muqeeth, Jay Mohta, Tenghao Huang, Mohit Bansal, and Colin Raffel. Few-shot parameter-efficient fine-tuning is better and cheaper than incontext learning. ArXiv, abs/2205.05638, 2022. URL https://api.semanticscholar.org/ CorpusID:248693283.
|
| 182 |
+
Jialin Liu, A. Moreau, Mike Preuss, Baptiste Roziere, J \` er´ emy Rapin, Fabien Teytaud, and ´ Olivier Teytaud. Versatile black-box optimization. Proceedings of the 2020 Genetic and Evolutionary Computation Conference, 2020.
|
| 183 |
+
Shayne Longpre, Le Hou, Tu Vu, Albert Webson, Hyung Won Chung, Yi Tay, Denny Zhou, Quoc V. Le, Barret Zoph, Jason Wei, and Adam Roberts. The flan collection: Designing data and methods for effective instruction tuning, 2023.
|
| 184 |
+
Xingtai Lv, Ning Ding, Yujia Qin, Zhiyuan Liu, and Maosong Sun. Parameter-efficient weight ensembling facilitates task-level knowledge transfer. In Annual Meeting of the Association for Computational Linguistics, 2023.
|
| 185 |
+
Sourab Mangrulkar, Sylvain Gugger, Lysandre Debut, Younes Belkada, and Sayak Paul. Peft: State-of-the-art parameter-efficient fine-tuning methods. https://github.com/ huggingface/peft, 2022.
|
| 186 |
+
Michael Matena and Colin Raffel. Merging models with fisher-weighted averaging. ArXiv preprint, 2021.
|
| 187 |
+
Sewon Min, Mike Lewis, Luke Zettlemoyer, and Hannaneh Hajishirzi. MetaICL: Learning to learn in context. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 2022.
|
| 188 |
+
Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. In Proc. of ACL, 2022.
|
| 189 |
+
Mohammed Muqeeth, Haokun Liu, and Colin Raffel. Soft merging of experts with adaptive routing. ArXiv preprint, 2023.
|
| 190 |
+
OpenAI. ChatGPT. 2022. URL https://openai.com/blog/chatgpt.
|
| 191 |
+
Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke E. Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Francis Christiano, Jan Leike, and Ryan J. Lowe. Training language models to follow instructions with human feedback. ArXiv preprint, 2022.
|
| 192 |
+
|
| 193 |
+
Panupong Pasupat and Percy Liang. Compositional semantic parsing on semi-structured tables. In Proc. of ACL, 2015.
|
| 194 |
+
|
| 195 |
+
Edoardo Maria Ponti, Alessandro Sordoni, Yoshua Bengio, and Siva Reddy. Combining parameter-efficient modules for task-level generalisation. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, 2023.
|
| 196 |
+
|
| 197 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 2020.
|
| 198 |
+
|
| 199 |
+
J. Rapin and O. Teytaud. Nevergrad - A gradient-free optimization platform. https:// GitHub.com/FacebookResearch/Nevergrad, 2018.
|
| 200 |
+
|
| 201 |
+
Victor Sanh, Albert Webson, Colin Raffel, Stephen H. Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal V. Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Teven Le Scao, Stella Biderman, Leo Gao, ´ Thomas Wolf, and Alexander M. Rush. Multitask prompted training enables zero-shot task generalization. In Proc. of ICLR, 2022.
|
| 202 |
+
|
| 203 |
+
Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc V. Le, Geoffrey E. Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixtureof-experts layer. In Proc. of ICLR, 2017.
|
| 204 |
+
|
| 205 |
+
Sheng Shen, Le Hou, Yanqi Zhou, Nan Du, Shayne Longpre, Jason Wei, Hyung Won Chung, Barret Zoph, William Fedus, Xinyun Chen, Tu Vu, Yuexin Wu, Wuyang Chen, Albert Webson, Yunxuan Li, Vincent Zhao, Hongkun Yu, Kurt Keutzer, Trevor Darrell, and Denny Zhou. Mixture-of-experts meets instruction tuning:a winning combination for large language models, 2023.
|
| 206 |
+
|
| 207 |
+
George Stoica, Daniel Bolya, Jakob Bjorner, Taylor Hearn, and Judy Hoffman. Zipit! merging models from different tasks without training. arXiv, 2023.
|
| 208 |
+
|
| 209 |
+
Tianxiang Sun, Yunfan Shao, Hong Qian, Xuanjing Huang, and Xipeng Qiu. Black-box tuning for language-model-as-a-service. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), ´ International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, Proceedings of Machine Learning Research, 2022.
|
| 210 |
+
|
| 211 |
+
Tianxiang Sun, Zhengfu He, Qin Zhu, Xipeng Qiu, and Xuanjing Huang. Multitask pretraining of modular prompt for Chinese few-shot learning. In Proc. of ACL, 2023.
|
| 212 |
+
|
| 213 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee Lacroix, Baptiste Rozi ´ ere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien \` Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models. ArXiv preprint, 2023.
|
| 214 |
+
|
| 215 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, 2017.
|
| 216 |
+
|
| 217 |
+
Yaqing Wang, Sahaj Agarwal, Subhabrata Mukherjee, Xiaodong Liu, Jing Gao, Ahmed Hassan Awadallah, and Jianfeng Gao. AdaMix: Mixture-of-adaptations for parameter-efficient model tuning. In Proc. of EMNLP, 2022.
|
| 218 |
+
|
| 219 |
+
Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. Finetuned language models are zero-shot learners. In Proc. of ICLR, 2022.
|
| 220 |
+
Chengyue Wu, Teng Wang, Yixiao Ge, Zeyu Lu, Ruisong Zhou, Ying Shan, and Ping Luo. $\pi$ -tuning: Transferring multimodal foundation models with optimal multi-task interpolation. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett (eds.), International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pp. 37713–37727. PMLR, 2023a. URL https://proceedings.mlr. press/v202/wu23t.html.
|
| 221 |
+
Shijie Wu, Ozan Irsoy, Steven Lu, Vadim Dabravolski, Mark Dredze, Sebastian Gehrmann, Prabhanjan Kambadur, David S. Rosenberg, and Gideon Mann. Bloomberggpt: A large language model for finance. CoRR, abs/2303.17564, 2023b. doi: 10.48550/arXiv.2303. 17564. URL https://doi.org/10.48550/arXiv.2303.17564.
|
| 222 |
+
Prateek Yadav, Derek Tam, Leshem Choshen, Colin Raffel, and Mohit Bansal. TIESmerging: Resolving interference when merging models. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id= xtaX3WyCj1.
|
| 223 |
+
Qinyuan Ye, Bill Yuchen Lin, and Xiang Ren. CrossFit: A few-shot learning challenge for cross-task generalization in NLP. In Proc. of EMNLP, 2021.
|
| 224 |
+
Chris Zhang, Mengye Ren, and Raquel Urtasun. Graph hypernetworks for neural architecture search. In Proc. of ICLR, 2019.
|
| 225 |
+
Fan Zhang, Duyu Tang, Yong Dai, Cong Zhou, Shuangzhi Wu, and Shuming Shi. Skillnetnlu: A sparsely activated model for general-purpose natural language understanding, 2022.
|
| 226 |
+
Jinghan Zhang, Shiqi Chen, Junteng Liu, and Junxian He. Composing parameter-efficient modules with arithmetic operations. ArXiv preprint, 2023a.
|
| 227 |
+
Longteng Zhang, Lin Zhang, Shaohuai Shi, Xiaowen Chu, and Bo Li. Lora-fa: Memory-efficient low-rank adaptation for large language models fine-tuning. ArXiv, abs/2308.03303, 2023b. URL https://api.semanticscholar.org/CorpusID:260683267.
|
| 228 |
+
Wangchunshu Zhou, Yuchen Eleanor Jiang, Ryan Cotterell, and Mrinmaya Sachan. Efficient prompting via dynamic in-context learning. CoRR, abs/2305.11170, 2023. doi: 10.48550/ARXIV.2305.11170. URL https://doi.org/10.48550/arXiv.2305.11170.
|
| 229 |
+
|
| 230 |
+
Table 3: The top five beneficial LoRA modules for BBH tasks and their associated upstream tasks, the average weight values and the average performance on all BBH tasks.
|
| 231 |
+
|
| 232 |
+
<table><tr><td>Rank</td><td>Dataset: Task</td><td>Weight</td><td>Perf</td><td>Task Description</td></tr><tr><td>1</td><td>WIQA: Last Process</td><td>0.72</td><td>28.1</td><td> Identifying the last step of a given process.</td></tr><tr><td>2</td><td>RACE: Is this the Right Answer</td><td>0.68</td><td>30.8</td><td>Determining if given answer is correct.</td></tr><tr><td>3</td><td>WIQA: First Process</td><td>0.63</td><td>28.1</td><td> Identifying the first step of a given process.</td></tr><tr><td>4</td><td>AdversarialQA: BiDAF</td><td>0.61</td><td>25.1</td><td>Aserialmode-in-the-eby an</td></tr><tr><td>5</td><td>WebQuestions: What is the Answer</td><td>0.58</td><td>27.0</td><td> Asweringrqomesten based oninformation</td></tr></table>
|
| 233 |
+
|
| 234 |
+
# A More Analysis
|
| 235 |
+
|
| 236 |
+
Which LoRA modules are most effective for BBH tasks?
|
| 237 |
+
|
| 238 |
+
We hypothesized that the amalgamation of LoRA modules could incorporate skills and insights from a variety of specific tasks. To evaluate this, we examined the extent of influence a single LoRA module had amongst all tasks from the BBH benchmark. We measured the impact of each isolated task by calculating the average absolute weight. The top five modules, presented in Table 3, were found to have substantial influence, as indicated by their maximum average weights, which suggested that they were notably more effective in cross-task transfer. Remarkably, a common feature among these top five modules was their association with tasks requiring reading comprehension and reasoning skills—attributes indicative of higher cognitive complexity. However, it is worth noting that none of the modules exhibited consistent improvement across all BBH tasks, as reflected in their average performance on all BBH tasks, which did not show a significant improvement compared to the original FLAN-T5-large, except for the Rank 2. The results underscore the advantages of composing diverse modules in LoraHub.
|
| 239 |
+
|
| 240 |
+
How effective is the gradient-free optimization method?
|
| 241 |
+
|
| 242 |
+
To assess the effectiveness of our gradient-free optimization method in correctly identifying the most suitable LoRA module for a given downstream task, we carried out an empirical study using the WikiTableQuestions (Pasupat & Liang, 2015) (WTQ) dataset. We strategically included a LoRA module that was specifically trained on the WTQ dataset into our pool of LoRA candidate modules, which originally stemmed from tasks exclusive to the Flan Collection. Subsequently, we designated WTQ as the targeted downstream task and computed the weights consistent with the methods employed in LoraHub learning. As an end result, the WTQ-specific LoRA module was awarded the highest weight, exemplifying the algorithm’s success in recognizing it as the most relevant. Moreover, the combined LoRA module demonstrated marginal superiority over the WTQ LoRA module. This underscores the claim that the gradient-free optimization method has the ability to proficiently select the optimal upstream LoRA module for an unseen task.
|
| 243 |
+
|
| 244 |
+
# B Result of Best Results
|
| 245 |
+
|
| 246 |
+
As shown in Table 4, compared to gradient-based parameter-efficient training methods like LoRA and IA3, our approach demonstrates superior performance in terms of best results over experimental runs. While it exhibits a noticeable lag behind the fully fine-tuning (FFT) method, which updates all parameters during training, this observation suggests that our proposed method has a promising upper limit. We anticipate that future research efforts can contribute to accelerating the optimization speed and further enhancing the efficacy of our approach.
|
| 247 |
+
|
| 248 |
+
Table 4: Experimental results of several few-shot methods, including in-context learning (ICL), IA3 fine-tuning (IA3), LoRA tuning (LoRA), full fine-tuning (FFT) and our LoraHub learning (LoraHub) on the BBH benchmark with FLAN-T5-large as the base LLM. We denote algorithmic tasks with the superscript $\ S$ following previous work (Wu et al., 2023b). Note that we use 5 examples per task as the demonstration for all methods. The best (best) performance is reported as the maximum value obtained across three runs.
|
| 249 |
+
|
| 250 |
+
<table><tr><td>Task</td><td>ICLbest</td><td>IA3best</td><td>LoRAbest</td><td>FFTbest</td><td>LoraHubbest</td></tr><tr><td>Boolean Expressions</td><td>62.7</td><td>58.0</td><td>60.7</td><td>65.3</td><td>60.7</td></tr><tr><td>Causal Judgement</td><td>59.8</td><td>62.1</td><td>57.5</td><td>60.9</td><td>63.2</td></tr><tr><td>Date Understanding</td><td>21.3</td><td>20.7</td><td>40.7</td><td>67.3</td><td>45.3</td></tr><tr><td>Disambiguation</td><td>69.3</td><td>0.0</td><td>68.7</td><td>70.7</td><td>68.0</td></tr><tr><td>Dyck Languages</td><td>2.0</td><td>4.7</td><td>25.3</td><td>33.3</td><td>2.7</td></tr><tr><td>Formal Fallacies</td><td>59.3</td><td>52.0</td><td>56.7</td><td>56.0</td><td>59.3</td></tr><tr><td>Geometric Shapes</td><td>20.0</td><td>15.3</td><td>28.7</td><td>39.3</td><td>18.7</td></tr><tr><td>Hyperbaton</td><td>72.7</td><td>49.3</td><td>57.3</td><td>82.0</td><td>72.7</td></tr><tr><td>Logical DeductionS (five objects)</td><td>39.3</td><td>32.7</td><td>41.3</td><td>43.3</td><td>40.0</td></tr><tr><td>Logical DeductionS (seven objects)</td><td>42.0</td><td>34.0</td><td>42.7</td><td>46.0</td><td>46.0</td></tr><tr><td>LogicalDrectjoets)</td><td>52.7</td><td>8.7</td><td>56.7</td><td>60.7</td><td>52.7</td></tr><tr><td>Movie Recommendation</td><td>56.7</td><td>62.0</td><td>64.5</td><td>70.7</td><td>62.0</td></tr><tr><td>Multistep Arithmetic</td><td>0.7</td><td>0.7</td><td>0.7</td><td>0.0</td><td>1.3</td></tr><tr><td>Navigate</td><td>46.7</td><td>47.3</td><td>50.7</td><td>50.0</td><td>51.3</td></tr><tr><td>Object Counting</td><td>34.7</td><td>35.3</td><td>42.0</td><td>38.0</td><td>36.7</td></tr><tr><td>Penguins in a Table</td><td>43.5</td><td>45.7</td><td>41.3</td><td>37.0</td><td>47.8</td></tr><tr><td>Reasoning about Colored Objects</td><td>41.3</td><td>41.3</td><td>40.7</td><td>38.7</td><td>44.7</td></tr><tr><td>Ruin Names</td><td>20.7</td><td>25.3</td><td>42.0</td><td>66.0</td><td>28.7</td></tr><tr><td>Salient Translation Error Detection</td><td>48.0</td><td>37.3</td><td>17.3</td><td>21.3</td><td>42.7</td></tr><tr><td>Snarks</td><td>55.1</td><td>56.4</td><td>59.0</td><td>69.2</td><td>61.5</td></tr><tr><td>Sports Understanding</td><td>56.7</td><td>55.3</td><td>58.7</td><td>58.7</td><td>62.7</td></tr><tr><td>Temporal Sequences</td><td>26.7</td><td>18.7</td><td>31.3</td><td>48.7</td><td>21.3</td></tr><tr><td>Tracking Shuffled ObjectsS (five objects)</td><td>12.0</td><td>12.0</td><td>16.0</td><td>20.0</td><td>16.7</td></tr><tr><td>Tracking Shuffled ObjectsS (seven objects)</td><td>6.7</td><td>6.7</td><td>12.0</td><td>10.0</td><td>15.3</td></tr><tr><td>Tracking Shuffled ObjectsS (three objects)</td><td>31.3</td><td>30.7</td><td>32.0</td><td>36.0</td><td>31.3</td></tr><tr><td>Web of Lies</td><td>54.0</td><td>54.7</td><td>55.3</td><td>54.0</td><td>57.3</td></tr><tr><td>Word Sorting</td><td>0.7</td><td>1.3</td><td>5.3</td><td>6.0</td><td>1.3</td></tr><tr><td>Best Performance (Average)</td><td>38.4</td><td>32.1</td><td>40.9</td><td>46.2</td><td>41.2</td></tr></table>
|
| 251 |
+
|
| 252 |
+
# C Result of non-instrcution-tuned models
|
| 253 |
+
|
| 254 |
+
Table 5: Comparsion among different ranks for few-shot LoraHub learning with the backbone T5-large (Raffel et al., 2020) on the BBH benchmark. Note that the T5-large model achieved $0 . { \bar { 0 } } \%$ on all tasks under the zero-shot setting except Dyck Languages, where it scored $0 . 6 7 \%$ .
|
| 255 |
+
|
| 256 |
+
<table><tr><td>Task ↓ Rank →</td><td></td><td>4best 4avg</td><td>16avg</td><td>16best</td><td>64avg</td><td>64best</td></tr><tr><td>Boolean Expressions</td><td></td><td>52.13 57.33</td><td>50.67</td><td>58.00</td><td>47.47</td><td>58.00</td></tr><tr><td>Causal Judgement</td><td>52.41</td><td>55.17</td><td>49.66</td><td>54.02</td><td>50.80</td><td>54.02</td></tr><tr><td>Date Understanding</td><td>0.40</td><td>2.00</td><td>14.40</td><td>29.33</td><td>4.53</td><td>10.00</td></tr><tr><td>Disambiguation</td><td>10.00</td><td>31.33</td><td>26.93</td><td>42.00</td><td>1.73</td><td>4.67</td></tr><tr><td>Dyck Languages</td><td>0.40</td><td>0.67</td><td>0.40</td><td>0.67</td><td>0.40</td><td>2.00</td></tr><tr><td>Formal Fallacies</td><td>48.40</td><td>54.00</td><td>46.93</td><td>51.33</td><td>46.93</td><td>50.00</td></tr><tr><td>Geometric Shapes</td><td>0.00</td><td>0.00</td><td>6.53</td><td>32.67</td><td>1.47</td><td>7.33</td></tr><tr><td>Hyperbaton</td><td>30.13</td><td>50.00</td><td>39.07</td><td> 57.33</td><td>32.93</td><td>48.00</td></tr><tr><td>Logical DeductionS (five objects)</td><td>5.20</td><td>14.67</td><td>8.80</td><td>19.33</td><td>1.33</td><td>6.67</td></tr><tr><td>Logical DeductionS (seven objects)</td><td>6.40</td><td>17.33</td><td>9.33</td><td>19.33</td><td>3.47</td><td>16.00</td></tr><tr><td>Logical DeductionS</td><td>14.40</td><td>32.00</td><td>21.73</td><td>34.67</td><td>6.93</td><td>15.33</td></tr><tr><td>(three objects) Movie Recommendation</td><td>7.07</td><td>18.67</td><td>7.87</td><td>22.00</td><td>1.20</td><td>6.00</td></tr><tr><td>Multistep Arithmetic two</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td>Navigate</td><td>49.60</td><td>54.67</td><td>52.27</td><td>56.67</td><td>49.87</td><td>52.00</td></tr><tr><td>Object Counting</td><td>7.20</td><td>18.00</td><td>16.00</td><td>21.33</td><td>13.73</td><td>26.67</td></tr><tr><td>Penguins ina Table</td><td>6.52</td><td>13.04</td><td>10.43</td><td>17.39</td><td>0.43</td><td>2.17</td></tr><tr><td>Reasoning about Colored Objects</td><td>6.27</td><td>10.00</td><td>5.07</td><td>16.67</td><td>0.53</td><td>2.67</td></tr><tr><td>Ruin Names</td><td>7.73</td><td>13.33</td><td>13.20</td><td>28.00</td><td>5.73</td><td>15.33</td></tr><tr><td>Salient Translation Error Detection</td><td>0.00</td><td>0.00</td><td>1.73</td><td>8.67</td><td>0.00</td><td>0.00</td></tr><tr><td>Snarks</td><td>21.28</td><td>42.31</td><td>49.49</td><td>60.26</td><td>16.15</td><td>38.46</td></tr><tr><td> Sports Understanding</td><td>46.53</td><td>58.67</td><td>46.80</td><td>58.67</td><td>46.53</td><td>58.67</td></tr><tr><td>Temporal Sequences</td><td>3.07</td><td>13.33</td><td>6.53</td><td>26.67</td><td>2.40</td><td>12.00</td></tr><tr><td>Tracking Shuffled ObjectsS</td><td>5.20</td><td>14.00</td><td>4.13</td><td>9.33</td><td>0.13</td><td>0.67</td></tr><tr><td>(five objects) Tracking Shuffled ObjectsS (seven objects)</td><td>2.67</td><td>10.00</td><td>2.80</td><td>14.00</td><td>3.20</td><td>8.00</td></tr><tr><td>Tracking Shuffled ObjectsS</td><td>3.73</td><td>17.33</td><td>16.27</td><td>34.67</td><td>5.87</td><td>26.67</td></tr><tr><td>(three objects) Web of Lies</td><td>48.53</td><td>54.00</td><td></td><td></td><td></td><td> 57.33</td></tr><tr><td>Word Sorting</td><td>0.40</td><td>0.67</td><td>54.00 0.13</td><td>56.00 0.67</td><td>54.67 0.00</td><td>0.00</td></tr><tr><td></td><td></td><td></td><td>20.78</td><td></td><td></td><td></td></tr><tr><td>Average Performance per Task</td><td>16.14</td><td>24.17</td><td></td><td>30.73</td><td>14.76</td><td>21.43</td></tr></table>
|
| 257 |
+
|
| 258 |
+
# D Result of larger model
|
| 259 |
+
|
| 260 |
+
Table 6: Experimental results of zero-shot learning (Zero) and our few-shot LoraHub learning (LoraHub) on the BBH benchmark with FLAN-T5-xl as the base LLM. Note that we use 5 examples per task as the demonstration for both ICL and LoraHub. The average $( a v g )$ performance of LoraHub is computed over 5 runs with different random seeds, while the best (best) performance is reported as the maximum value obtained across these runs. We can see the trend of the results are similar to FLAN-T5-large.
|
| 261 |
+
|
| 262 |
+
<table><tr><td>Task</td><td>Zero</td><td>LoraHub avg</td><td>LoraHub best</td></tr><tr><td>Boolean Expressions</td><td>52.0</td><td>58.7</td><td>63.3</td></tr><tr><td>Causal Judgement</td><td>62.1</td><td>53.8</td><td>59.8</td></tr><tr><td>Date Understanding</td><td>38.0</td><td>37.6</td><td>38.0</td></tr><tr><td>Disambiguation Qa</td><td>0.0</td><td>20.5</td><td> 54.7</td></tr><tr><td>Dyck Languages</td><td>1.3</td><td>0.9</td><td>2.0</td></tr><tr><td>Formal Fallacies</td><td>56.0</td><td>56.0</td><td>56.0</td></tr><tr><td>Geometric Shapes</td><td>8.7</td><td>17.5</td><td>28.0</td></tr><tr><td>Hyperbaton</td><td>45.3</td><td>53.5</td><td>56.7</td></tr><tr><td>Logical DeductionS (five objects)</td><td>1.3</td><td>42.7</td><td>48.7</td></tr><tr><td>Logical DeductionS (seven objects)</td><td>8.7</td><td>44.3</td><td>50.0</td></tr><tr><td>Logical DeductionS (three objects)</td><td>0.7</td><td>56.4</td><td>61.3</td></tr><tr><td>Movie Recommendation</td><td>2.0</td><td>62.8</td><td>66.0</td></tr><tr><td>Multistep Arithmetic Two</td><td>0.0</td><td>0.4</td><td>0.7</td></tr><tr><td>Navigate</td><td>50.7</td><td>50.7</td><td>50.7</td></tr><tr><td>Object Counting</td><td>39.3</td><td>40.7</td><td>48.0</td></tr><tr><td>Penguins In A Table</td><td>17.4</td><td>40.9</td><td>45.7</td></tr><tr><td> Reasoning About Colored Objects</td><td>46.7</td><td>47.3</td><td>50.7</td></tr><tr><td>Ruin Names</td><td>18.0</td><td>35.6</td><td>44.7</td></tr><tr><td>Salient Translation Error Detection</td><td>44.7</td><td>45.1</td><td>48.7</td></tr><tr><td>Snarks</td><td>60.3</td><td>60.8</td><td>61.5</td></tr><tr><td>Sports Understanding</td><td>56.7</td><td>51.3</td><td>53.3</td></tr><tr><td>Temporal Sequences</td><td>21.3</td><td>21.5</td><td>22.0</td></tr><tr><td>Tracking Shuffled ObjectsS</td><td>3.3</td><td>9.9</td><td>13.3</td></tr><tr><td>(five objects) Tracking Shuffled ObjectsS (seven objects)</td><td>5.3</td><td>7.3</td><td>8.7</td></tr><tr><td>Tracking Shuffled ObjectsS</td><td>7.3</td><td>21.7</td><td>31.3</td></tr><tr><td>(three objects) Web Of Lies</td><td>54.7</td><td>47.1</td><td>48.7</td></tr><tr><td>Word Sorting</td><td>1.3</td><td>1.5</td><td>2.0</td></tr><tr><td>Average Performance per Task</td><td>25.8</td><td>36.5</td><td>41.3</td></tr></table>
|
| 263 |
+
|
| 264 |
+
# E Improving the Robustness of LoraHub
|
| 265 |
+
|
| 266 |
+
In order to enhance the robustness of LoraHub, we explored a straightforward approach in the selection of LoRA module candidates. Specifically, we first identified 20 LoRA module candidates with the lowest loss on the few-shot examples. Our findings indicate a slight improvement in overall performance after applying the pre-filtering startegy. Since the primary instability in our approach arises from the selection of LoRA candidates. This method involves choosing a fixed set of LoRA candidates to ensure the stability of our approach.
|
| 267 |
+
|
| 268 |
+
Table 7: The experimental results of loss-based pre-filtering.
|
| 269 |
+
|
| 270 |
+
<table><tr><td>Task</td><td>LoraHubavg</td><td>LoraHubfilter</td></tr><tr><td>Boolean Expressions</td><td>55.5</td><td>60.00</td></tr><tr><td>Causal Judgement</td><td>54.3</td><td>52.9</td></tr><tr><td> Date Understanding</td><td>32.9</td><td>33.3</td></tr><tr><td>Disambiguation</td><td>45.2</td><td>62.7</td></tr><tr><td>Dyck Languages</td><td>1.0</td><td>0.0</td></tr><tr><td>Formal Fallacies</td><td>52.8</td><td>54.0</td></tr><tr><td>Geometric Shapes</td><td>7.4</td><td>4.0</td></tr><tr><td>Hyperbaton</td><td>62.8</td><td>64.0</td></tr><tr><td>Logical DeductionS (five objects)</td><td>36.1</td><td>37.3</td></tr><tr><td>Logical DeductionS (seven objects)</td><td>36.8</td><td>22.0</td></tr><tr><td>Logical DeductionS (three objects)</td><td>45.7</td><td>56.0</td></tr><tr><td>Movie Recommendation</td><td>55.3</td><td>68.0</td></tr><tr><td>Multistep Arithmetic</td><td>0.4</td><td>0.7</td></tr><tr><td>Navigate</td><td>47.1</td><td>49.3</td></tr><tr><td>Object Counting</td><td>33.7</td><td>38.7</td></tr><tr><td>Penguins in a Table</td><td>35.9</td><td>37.0</td></tr><tr><td>Reasoning about Colored Objects</td><td>40.0</td><td>33.3</td></tr><tr><td>Ruin Names</td><td>24.4</td><td>22.0</td></tr><tr><td>Salient Translation Error Detection</td><td>36.0</td><td>24.0</td></tr><tr><td>Snarks</td><td>56.9</td><td>52.66</td></tr><tr><td> Sports Understanding</td><td>56.7</td><td>58.0</td></tr><tr><td> Temporal Sequences</td><td>18.2</td><td>27.3</td></tr><tr><td>Tracking Shuffled ObjectsS</td><td>12.3</td><td>11.3</td></tr><tr><td>(five objects) Tracking Shuffled ObjectsS</td><td>7.7</td><td>8.0</td></tr><tr><td>(seven objects) Tracking Shuffled ObjectsS</td><td>29.2</td><td>32.7</td></tr><tr><td>(three objects) Web of Lies</td><td>50.1</td><td>46.0</td></tr><tr><td>Word Sorting</td><td>1.1</td><td>1.3</td></tr><tr><td></td><td>34.7</td><td>35.4</td></tr><tr><td>Avg Performance Per Task</td><td></td><td></td></tr></table>
|
| 271 |
+
|
| 272 |
+
# F Performance on General Important Task
|
| 273 |
+
|
| 274 |
+
In our research, we have identified specific LoRA modules that exhibit significant impact when integrated into merged LoRAs. Our focus lies in assessing the performance of the top five task-related LoRAs on the BBH benchmark. The results indicate that these top LoRAs perform similarly or even worse than zero-shot in most cases. Only one of them stands out as significantly better than zero-shot. However, it’s worth noting that this performance is not as impressive as Lorahub. These findings support the idea that the merging process can improve overall performance.
|
| 275 |
+
|
| 276 |
+
Table 8: Detailed experimental results of top five LoRA modules shown in Table 3 on BBH tasks.
|
| 277 |
+
|
| 278 |
+
<table><tr><td>Task</td><td>WIQA: Last</td><td>RACE: Right</td><td>WIQA: First</td><td>ADQA</td><td>WebQA</td></tr><tr><td>Boolean Expressions</td><td>52.67</td><td>58.00</td><td>52.67</td><td>54.67</td><td>53.33</td></tr><tr><td>Causal Judgement</td><td>55.17</td><td>63.22</td><td>55.17</td><td>57.47</td><td>57.47</td></tr><tr><td>Date Understanding</td><td>17.33</td><td>19.33</td><td>17.33</td><td>16.67</td><td>15.33</td></tr><tr><td>Disambiguation</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td>Dyck Languages</td><td>0.67</td><td>0.67</td><td>0.67</td><td>1.33</td><td>1.33</td></tr><tr><td>Formal Fallacies</td><td>51.33</td><td>51.33</td><td>51.33</td><td>51.33</td><td>51.33</td></tr><tr><td>Geometric Shapes</td><td>8.00</td><td>13.33</td><td>8.00</td><td>6.67</td><td>7.33</td></tr><tr><td>Hyperbaton</td><td>16.67</td><td>44.00</td><td>16.67</td><td>1.33</td><td>6.00</td></tr><tr><td>Logical Ded uctionts)</td><td>23.33</td><td>28.00</td><td>23.33</td><td>19.33</td><td>20.67</td></tr><tr><td>Logical DeductionS (seven objects)</td><td>22.00</td><td>26.00</td><td>22.00</td><td>10.67</td><td>12.00</td></tr><tr><td>Logical DeductionS (three objects)</td><td>0.67</td><td>9.33</td><td>0.67</td><td>0.00</td><td>0.00</td></tr><tr><td>Movie Recommendation</td><td>63.33</td><td>62.67</td><td>63.33</td><td>56.67</td><td>63.33</td></tr><tr><td>Multistep Arithmetic</td><td>0.67</td><td>0.67</td><td>0.67</td><td>0.67</td><td>0.67</td></tr><tr><td>Navigate</td><td>47.33</td><td>50.00</td><td>47.33</td><td>47.33</td><td>47.33</td></tr><tr><td>Object Counting</td><td>34.67</td><td>34.00</td><td>34.67</td><td>35.33</td><td>35.33</td></tr><tr><td>Penguins in a Table</td><td>45.65</td><td>41.30</td><td>45.65</td><td>39.13</td><td>43.48</td></tr><tr><td>Reasoning about Colored Objects</td><td>40.00</td><td>37.33</td><td>40.00</td><td>31.33</td><td>30.67</td></tr><tr><td>Ruin Names</td><td>22.00</td><td>21.33</td><td>22.00</td><td>17.33</td><td>22.67</td></tr><tr><td>Salient Translation Error Detection</td><td>36.67</td><td>34.67</td><td>36.67</td><td>32.67</td><td>37.33</td></tr><tr><td>Snarks</td><td>52.56</td><td>55.13</td><td>52.56</td><td>47.44</td><td>52.56</td></tr><tr><td>Sports Understanding</td><td>56.00</td><td>58.67</td><td>56.00</td><td>55.33</td><td></td></tr><tr><td>Temporal Sequences</td><td>16.67</td><td>17.33</td><td>16.67</td><td>12.67</td><td>55.33 17.33</td></tr><tr><td>Tracking Shuffled ObjectsS (five objects)</td><td>12.00</td><td>12.00</td><td>12.00</td><td>10.67</td><td>12.00</td></tr><tr><td>Tracking Shuffled ObjectsS (seven objects)</td><td>6.67</td><td>6.67</td><td>6.67</td><td>6.67</td><td>6.67</td></tr><tr><td>Tracking Shuffled ObjectsS</td><td>20.67</td><td>30.67</td><td>20.67</td><td>10.67</td><td>25.33</td></tr><tr><td>(three objects) Web of Lies</td><td>54.67</td><td>54.00</td><td>54.67</td><td>54.00</td><td></td></tr><tr><td>Word Sorting</td><td>1.33</td><td>1.33</td><td>1.33</td><td>1.33</td><td>54.00 1.33</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Avg Performance per Task △ FLAN-T5-large</td><td>28.10 1.10</td><td>30.78 3.78</td><td>28.10 1.10</td><td>25.14 -1.86</td><td>27.04 0.04</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 279 |
+
|
| 280 |
+

|
| 281 |
+
Figure 3: The influence of number of LoRA modules on 15 tasks from BBH, and each box is obtained from 5 separate runs. The horizontal axis shows the number of LoRA modules to be composed in LoraHub learning.
|
| 282 |
+
|
| 283 |
+
# G Implementation details
|
| 284 |
+
|
| 285 |
+
We implemented LoRA tuning using the Huggingface PEFT library (Mangrulkar et al., 2022), with the rank being set as 16. The gradient-free method was implemented using the open-source Nevergrad optimization library (Rapin & Teytaud, 2018), with a constraint that the absolute value of LoRA weights should not exceed 1.5. Originally, all coefficients of LoRA modules were set at zero.
|
| 286 |
+
|
| 287 |
+
In our standard settings, we set the maximum number of iterations $K$ as 40. The same 5 examples were used during our LoraHub learning and the few-shot in-context learning. The hyperparameter $\alpha$ is set as 0.05. Regarding the hyperparameters for training candidate LoRA modules, we maintained consistency across all modules, setting the batch size at 64, the learning rate at $1 e - 4 ,$ and the number of training epochs at 10.
|
| 288 |
+
|
| 289 |
+
# H Influence of Number of LoRA modules
|
| 290 |
+
|
| 291 |
+
As shown in Figure 3, with an increase in the number of LoRA module candidates, there is a corresponding increase in the performance variance. Based on our in-depth analysis, the primary source of variance is not related to gradient-free optimization algorithms but rather associated with the LoRA candidate modules. In other words, once the candidates are determined, random seeds have minimal impact on the final performance. Hence, we posit that the observed instability primarily arises from the inherent challenge of balancing the quantity and quality of the LoRA module candidates.
|
| 292 |
+
|
| 293 |
+
# I The Impact of Threshold
|
| 294 |
+
|
| 295 |
+
In this section, we omitted the threshold in our implementation, and the results are summarized in Table 9. Our observations indicate that the removal of the threshold had minimal impact on the majority of tasks, underscoring the robustness of the gradient-free optimization algorithm itself in most cases. The algorithm efficiently identified reasonable ranges even without specific upper and lower bounds. However, three tasks, namely Date Understanding, Disambiguation and Hyperbaton, exhibited notable effects. The resulting performance decline led to an average decrease of $1 . 2 \%$ compared to the setting with threshold.
|
| 296 |
+
|
| 297 |
+
This highlights the significance of establishing a reasonable threshold to mitigate extreme scenarios.
|
| 298 |
+
|
| 299 |
+
Table 9: The comparsion between LoraHub and LoraHub without threshold.
|
| 300 |
+
|
| 301 |
+
<table><tr><td>Task</td><td>LoraHubavg with threshold</td><td>LoraHubavg without threshold</td></tr><tr><td>Boolean Expressions</td><td>55.5</td><td>54.0</td></tr><tr><td>Causal Judgement</td><td>54.3</td><td>54.8</td></tr><tr><td>Date Understanding</td><td>32.9</td><td>17.7</td></tr><tr><td>Disambiguation</td><td>45.2</td><td>40.6</td></tr><tr><td>Dyck Languages</td><td>1.0</td><td>1.1</td></tr><tr><td>Formal Fallacies</td><td>52.8</td><td>51.7</td></tr><tr><td>Geometric Shapes</td><td>7.4</td><td>6.7</td></tr><tr><td>Hyperbaton</td><td>62.8</td><td>55.5</td></tr><tr><td>Logical DeductionS (five objects)</td><td>36.1</td><td>36.5</td></tr><tr><td>Logical DeductionS (seven objects)</td><td>36.8</td><td>35.6</td></tr><tr><td>Logical DeductionS</td><td>45.7</td><td></td></tr><tr><td>(three objects) Movie Recommendation</td><td></td><td>49.9</td></tr><tr><td>Multistep Arithmetic</td><td>55.3</td><td>59.3</td></tr><tr><td>Navigate</td><td>0.4</td><td>0.7</td></tr><tr><td>Object Counting</td><td>47.1</td><td>47.6</td></tr><tr><td></td><td>33.7</td><td>34.7</td></tr><tr><td>Penguins in a Table</td><td>35.9</td><td>33.8</td></tr><tr><td>Reasoning about Colored Objects</td><td>40.0</td><td>37.9</td></tr><tr><td>Ruin Names</td><td>24.4</td><td>24.0</td></tr><tr><td>Salient Translation Error Detection</td><td>36.0</td><td>37.1</td></tr><tr><td>Snarks</td><td>56.9</td><td>51.6</td></tr><tr><td>Sports Understanding</td><td>56.7</td><td>55.9</td></tr><tr><td>Temporal Sequences</td><td>18.2</td><td>16.7</td></tr><tr><td>Tracking Shuffled ObjectsS (five objects)</td><td>12.3</td><td>12.3</td></tr><tr><td>Tracking Shuffled ObjectsS (seven objects)</td><td>7.7</td><td>8.5</td></tr><tr><td>Tracking Shuffled ObjectsS (three objects)</td><td>29.2</td><td>29.8</td></tr><tr><td>Web of Lies</td><td>50.1</td><td>50.3</td></tr><tr><td>Word Sorting</td><td>1.1</td><td>1.3</td></tr><tr><td>Avg Performance Per Task</td><td>34.7</td><td>33.5</td></tr></table>
|
md/test/TyFrPOKYXw/TyFrPOKYXw.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/VP20ZB6DHL/VP20ZB6DHL.md
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CHAIN-OF-VERIFICATION REDUCES HALLUCINATION IN LARGE LANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Generation of plausible yet incorrect factual information, termed hallucination, is an unsolved issue in large language models. We study the ability of language models to deliberate on the responses they give in order to correct their mistakes. We develop the Chain-of-Verification (COVE) method whereby the model first (i) drafts an initial response; then (ii) plans verification questions to fact-check its draft; (iii) answers those questions independently so the answers are not biased by other responses; and (iv) generates its final verified response. In experiments, we show COVE decreases hallucinations across a variety of tasks, from list-based questions from Wikidata, closed book MultiSpanQA and longform text generation.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Large Language Models (LLMs) are trained on huge corpora of text documents with billions of tokens of text. It has been shown that as the number of model parameters is increased, performance at tasks such as closed book QA improve in accuracy, and larger models can generate more correct factual statements (Radford et al., 2019; Petroni et al., 2019). However, even the largest models can still fail, particularly on lesser known torso and tail distribution facts (Sun et al., 2023a), i.e. those that occur relatively rarely in the training corpora. In those cases where the model is incorrect, they instead generate an alternative response which is typically plausible looking (e.g., a similar entity, but an incorrect one). These factually incorrect generations are referred to as hallucinations (Maynez et al., 2020). Further, in longform tasks consisting of generating multiple sentences or paragraphs, the hallucination problem can be exacerbated due to the issue of exposure bias (Wang & Sennrich, 2020).
|
| 12 |
+
|
| 13 |
+
The current wave of language modeling research goes beyond next word prediction, and has focused on their ability to reason. Improved performance in reasoning tasks can be gained by encouraging language models to first generate internal thoughts or reasoning chains before responding (Wei et al., 2022; Adolphs et al., 2021; Wang et al., 2022; Lanchantin et al., 2023), as well as updating their initial response through self-critique (Press et al., 2022; Madaan et al., 2023). In this work we follow this line of research to study how and when language-model-based reasoning can be used to reduce hallucinations. We develop an approach, called Chain-of-Verification (CoVe) which, given an initial draft response, first plans verification questions to check its work, and then systematically answers those questions in order to finally produce an improved revised response. We find that independent verification questions tend to provide more accurate facts than those in the original longform answer, and hence improve the correctness of the overall response. We study variations on this recipe across a range of tasks: from list-based questions, closed booked QA and longform text generation. We first propose a joint approach for generating the entire verification chain left-to-right, which improves performance and decreases hallucinations compared to the baseline language model. However, models that attend to existing hallucinations in the context from their own generations tend to repeat the hallucinations. Hence we also introduce further improvements with factored variants which separate out the verification chain steps, in terms of which context is attended to. We show how these factored variants give further performance gains across all three tasks considered.
|
| 14 |
+
|
| 15 |
+
# 2 RELATED WORK
|
| 16 |
+
|
| 17 |
+
Hallucination is a general problem in language model generations that appears across many tasks, from summarization (Maynez et al., 2020) to open-domain dialogue (Roller et al., 2020), and has not
|
| 18 |
+
|
| 19 |
+
# Query
|
| 20 |
+
|
| 21 |
+
Name some politicians who were born in NY, New York.
|
| 22 |
+
|
| 23 |
+
# 1. Baseline Response
|
| 24 |
+
|
| 25 |
+
Here are some politicians who were born in NY, New York:
|
| 26 |
+
1. Hillary Clinton - former secretary of state and former Democratic presidential nominee
|
| 27 |
+
2. Donald Trump - former president of the United States
|
| 28 |
+
3. Michael Bloomberg - former Mayor of New York City and former Democratic presidential candidate … <list continues..>
|
| 29 |
+
|
| 30 |
+
# 2. Plan Verifications
|
| 31 |
+
|
| 32 |
+
3. Execute Verifications
|
| 33 |
+
|
| 34 |
+
Hillary Clinton was born in Chicago, Illinois, United States on October 26, 1947.
|
| 35 |
+
|
| 36 |
+
- Where was Hillary Clinton born? - Where was Donald Trump born? - Where was Michael Bloomberg born? … <questions continue..>
|
| 37 |
+
|
| 38 |
+
Donald Trump was born on June 14, 1946, in Queens, New York City, New York, United States
|
| 39 |
+
|
| 40 |
+
Michael Bloomberg was born on February 14, 1942, in Boston, Massachusetts, United States.
|
| 41 |
+
|
| 42 |
+
# 4. Final Verified Response
|
| 43 |
+
|
| 44 |
+
Here are some politicians who were born in NY, New York:
|
| 45 |
+
1. Donald Trump - former president of the United States
|
| 46 |
+
2. Alexandria Ocasio-Cortez - Democratic member of the U.S. House of Representatives … <list continues..>
|
| 47 |
+
|
| 48 |
+
Figure 1: Chain-of-Verification (CoVe) method. Given a user query, a large language model generates a baseline response that may contain inaccuracies, e.g. factual hallucinations. We show a query here which failed for ChatGPT (see section 12 for more details). To improve this, CoVe first generates a plan of a set of verification questions to ask, and then executes that plan by answering them and hence checking for agreement. We find that individual verification questions are typically answered with higher accuracy than the original accuracy of the facts in the original longform generation. Finally, the revised response takes into account the verifications. The factored version of CoVe answers verification questions such that they cannot condition on the original response, avoiding repetition and improving performance.
|
| 49 |
+
|
| 50 |
+
been resolved by simply scaling up training data or model size (Zhang et al., 2023). For a survey of the hallucination issue, see Ji et al. (2023) and Ye et al. (2023). A majority of the methods for reducing hallucination can be divided into roughly three categories: training-time correction, generation-time correction and via augmentation (tool-use).
|
| 51 |
+
|
| 52 |
+
In training-time correction methods, an attempt is made to improve the raw left-to-right generations of an encoder-decoder or decoder-only language model by either training or otherwise adjusting the model weights to decrease the probability of hallucinated generations. This includes using reinforcement learning (Roit et al., 2023; Wu et al., 2023), constrastive learning (Chern et al., 2023b; Sun et al., 2023b) and other methods (Li et al., 2023; Narayan et al., 2023).
|
| 53 |
+
|
| 54 |
+
In generation-time correction, a common theme is to make reasoning decisions “on top of” the base LLM in order to make them more reliable. For example, by considering the probabilities of the generated tokens (Mielke et al., 2022; Kadavath et al., 2022). In Manakul et al. (2023) multiple samples are drawn from the model to detect hallucinations. In Varshney et al. (2023) hallucinations are identified using low confidence scores, and their correctness is checked through a validation procedure, mitigated, and then the generation is continued. An alternative to using the confidence scores is to leverage inconsistencies in the LLMs output to detect hallucination. Cohen et al. (2023) show that using inconsistencies for QA tasks can outperform using confidence scores for hallucination detection. Cohen et al. (2023) simulate an interactive multi-agent LM vs. LM debate setup to detect hallucinations for factoid QA, Agrawal et al. (2023) check for hallucinated references, while Mundler ¨ et al. (2023) extract relational triples from generations and verify them against another LLM. COVE also uses a related self-consistency approach but we show our approach can correct hallucinated facts in longform generations by generating and answering verification questions by solely using the same LLM.
|
| 55 |
+
|
| 56 |
+
A third approach is to use external tools to help mitigate hallucinations, rather than relying solely on the abilities of the language model itself. For example, retrieval-augmented generation can decrease hallucinations by using factual documents for grounding (Shuster et al., 2021; Jiang et al., 2023b; Yu et al., 2023) or chain-of-thought verification (Zhao et al., 2023). Other approaches include using tools for fact-checking (Chern et al., 2023a; Galitsky, 2023; Peng et al., 2023), or linking to external documents with attribution (Menick et al., 2022; Rashkin et al., 2023; Gao et al., 2023).
|
| 57 |
+
|
| 58 |
+
There are also a number of related works in improving reasoning for logical and mathematical tasks, even if they do not address reducing hallucination explicitly. Several approaches have been shown to improve results with extended reasoning steps by the system, such as chain-of-thought (Wei et al., 2022), deductive verification (Ling et al., 2023), and self-verification (Miao et al., 2023; Jiang et al., 2023a; Weng et al., 2022). The latter tries to predict the (masked) question given the answer for math problems, and use that as evidence that this is the correct solution.
|
| 59 |
+
|
| 60 |
+
# 3 CHAIN-OF-VERIFICATION
|
| 61 |
+
|
| 62 |
+
Our approach assumes access to a base LLM that – despite potentially being prone to hallucination – is capable of being prompted with general instructions in either a few-shot or zero-shot fashion. A key assumption of our method is that this language model, when suitably prompted, can both generate and execute a plan of how to verify itself in order to check its own work, and finally incorporate this analysis into an improved response.
|
| 63 |
+
|
| 64 |
+
Our overall process, which we call Chain-of-Verification (CoVe), thus performs four core steps:
|
| 65 |
+
|
| 66 |
+
1. Generate Baseline Response: Given a query, generate the response using the LLM. 2. Plan Verifications: Given both query and baseline response, generate a list of verification questions that could help to self-analyze if there are any mistakes in the original response. 3. Execute Verifications: Answer each verification question in turn, and hence check the answer against the original response to check for inconsistencies or mistakes. 4. Generate Final Verified Response: Given the discovered inconsistencies (if any), generate a revised response incorporating the verification results.
|
| 67 |
+
|
| 68 |
+
Each of these steps is performed by prompting the same LLM in different ways to obtain the desired response. While steps (1), (2) and (4) all can be invoked with a single prompt, we investigate variations of step (3) including joint, 2-step and factored versions. These variants either involve a single prompt, two prompts or else independent prompts per question, where more sophisticated decomposition can yield improved results.
|
| 69 |
+
|
| 70 |
+
We describe these steps in more detail below. An overview of the approach is illustrated in Figure 1, and in the Appendix in Figure 3.
|
| 71 |
+
|
| 72 |
+
# 3.1 BASELINE RESPONSE
|
| 73 |
+
|
| 74 |
+
Given a query, we generate left-to-right as usual using the LLM, with no special tricks. While this is the first step in the CoVe pipeline, it also serves as the baseline we wish to improve in our experiments (i.e., we will directly compare this baseline response with the final verified response from our overall method).
|
| 75 |
+
|
| 76 |
+
Given such baseline generations are typically prone to hallucination, CoVe attempts to identify these hallucinations, and correct them, in the following steps.
|
| 77 |
+
|
| 78 |
+
# 3.2 PLAN VERIFICATIONS
|
| 79 |
+
|
| 80 |
+
Conditioned on the original query and the baseline response, the model is prompted to generate a series of verification questions that test the factual claims in the original baseline response. For example if part of a longform model response contains the statement “The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848”, then one possible verification question to check those dates could be “When did the Mexican American war start and end?”. We note that verification questions are not templated and the language model is free to phrase these in any form it wants, and they also do not have to closely match the phrasing of the original text.
|
| 81 |
+
|
| 82 |
+
In our experiments, we perform such verification planning by providing a few-shot prompt of (response, verification) demonstrations to our LLM. See section 11 for the few-shot prompts we will use in our experiments. We note it is also possible with a sufficiently performant instruction-following LLM that this could be performed zero-shot.
|
| 83 |
+
|
| 84 |
+
# 3.3 EXECUTE VERIFICATIONS
|
| 85 |
+
|
| 86 |
+
Given the planned verification questions, the next step is to answer them in order to assess if any hallucinations exist. While techniques such as retrieval-augmentation could be used in this process, such as verification via search engine, in this work we do not explore tool-use. Instead, we consider only using the LLM itself in all steps of CoVe, hence the model is used to check its own work. We investigate several variants of verification execution, called joint, 2-Step, factored and factor+revise.
|
| 87 |
+
|
| 88 |
+
Joint In the joint method, the planning and execution (steps 2 and 3) are accomplished by using a single LLM prompt, whereby the few-shot demonstrations include both verification questions and their answers immediately after the questions. In this approach separate prompts are not needed.
|
| 89 |
+
|
| 90 |
+
2-Step A potential disadvantage of the joint method is that because the verification questions must condition on the baseline response in the LLM context, and the method is joint, the verification answers have to condition on the initial response as well. This may increase the likelihood of repetition, another known issue of modern LLMs (Holtzman et al., 2019). This means the verification questions might hallucinate similarly to the original baseline response, which defeats the purpose. We hence instead separate the planning and execution into separate steps, both with their own LLM prompt. The planning prompt conditions on the baseline response in the first step. The verification questions generated from planning are answered in the second step, where crucially the context given to the LLM prompt only contains the questions, and not the original baseline response and hence cannot repeat those answers directly.
|
| 91 |
+
|
| 92 |
+
Factored Another, more sophisticated approach, is to answer all questions independently as separate prompts. Again, crucially, those prompts do not contain the original baseline response and are hence not prone to simply copying or repeating it. The factored approach has the further advantage of removing any potential interference not only from the baseline response, but also between answer contexts, and is somewhat related to the recent (concurrent) work of Radhakrishnan et al. (2023) for subquestion answering by factored decomposition, hence we adopt their naming. It can also potentially handle more verification questions by virtue of them not all having to fit with the same single context. While this is potentially more computationally expensive, requiring the execution of many more LLM prompts, they can be run in parallel, and hence be batched. In order to do this, we first have to take the set of generated questions from subsection 3.2 and parse them into separate questions, which is a relatively easy task as the few-shot demonstrations we provide indicate they should be generated as a comma-separated list. We can then split them out into separate LLM prompts.
|
| 93 |
+
|
| 94 |
+
Factor+Revise After answering the verification questions, the overall CoVe pipeline then has to either implicitly or explicitly cross-check whether those answers indicate an inconsistency with the original responses. In the factor+revise approach, we execute this as a deliberate step via an extra LLM prompt, which may make it easier for the final system to reason about this step explicitly. Differently to answering the verification questions, the cross-checking phase needs to condition on both the baseline response and the verification question and answer. We thus execute this as separate LLM prompts, one “cross-check” prompt for each question, with again a set of few-shot demonstrations showing the desired output. For example if the original baseline response contained the phrase “It followed in the wake of the 1845 U.S. annexation of Texas. . . ” and CoVe generated a verification question When did Texas secede from Mexico? which was answered with 1836 then an inconsistency should be detected by this step.
|
| 95 |
+
|
| 96 |
+
# 3.4 FINAL VERIFIED RESPONSE
|
| 97 |
+
|
| 98 |
+
Finally, the improved response that takes verification into account is generated. This is executed by a final few-shot prompt where the context takes into account all of the previous reasoning steps, the baseline response and verification question answer pairs, so that the corrections can take place. If the Factor+Revise approach is used from subsection 3.3 then the output of the cross-check inconsistency detection is provided as well.
|
| 99 |
+
|
| 100 |
+
# 4 EXPERIMENTS
|
| 101 |
+
|
| 102 |
+
We use various experimental benchmarks to measure the efficacy of CoVe in reducing hallucination, comparing against a number of baselines.
|
| 103 |
+
|
| 104 |
+
# 4.1 TASKS
|
| 105 |
+
|
| 106 |
+
The benchmarks we use range from list-based questions where the required answer is a set of entities, to where the answer is a longform generation of multiple freeform sentences.
|
| 107 |
+
|
| 108 |
+
# 4.1.1 WIKIDATA
|
| 109 |
+
|
| 110 |
+
We start by testing CoVe on a set of automatically generated questions using the Wikidata $\mathsf { A P I } ^ { 1 }$ . We create list questions of the form: “Who are some [Profession]s who were born in [City]?”. For example, “Who are some politicians who were born in Boston?”. The answer to these questions is a set of entities, where the gold list is obtained from the Wikidata knowledge base. This results in a dataset of 56 test questions, each typically containing ${ \sim } 6 0 0$ known gold entities, but typically an LLM will produce a much shorter list. We then use the precision metric (micro-averaged) to measure performance, in addition to reporting the averaged number of positive and negative entities produced.
|
| 111 |
+
|
| 112 |
+
# 4.1.2 WIKI-CATEGORY LIST
|
| 113 |
+
|
| 114 |
+
We then proceed to a harder set-generation task. We use the QUEST (Malaviya et al., 2023) dataset that was created using Wikipedia Category lists. We convert these category names to questions by simply prepending a “Name some”. Owing to the varied questions such as Name some Mexican animated horror films or Name some Endemic orchids of Vietnam we believe this task can pose a greater challenge. We collate all examples in the dataset that do not require logical operations to create a set of 55 test questions each having 8 answers. Similar to the Wikidata task, we measure ˜ precision (micro-averaged) to measure performance, in addition to reporting the averaged number of positive and negative entities produced.
|
| 115 |
+
|
| 116 |
+
# 4.1.3 MULTISPANQA
|
| 117 |
+
|
| 118 |
+
We next test our approach on an reading comprehension benchmark, MultiSpanQA (Li et al., 2022). MultiSpanQA comprises of questions that have multiple independent answers (derived from a series of multiple discontiguous spans in the text, with questions originally from the Natural Questions dataset). We consider a closed-book setting, where we do not provide supporting documents, and hence consider a subset of questions which are factoid-based, so that our base LLM is more likely to be able to answer them. We thus use a test set of 418 questions with shorter answers per span (up to 3 tokens per item). For example, Q: Who invented the first printing press and in what year?, A: Johannes Gutenberg, 1450.
|
| 119 |
+
|
| 120 |
+
Table 1: Test Precision and average number of positive and negative (hallucination) entities for list-based questions on the Wikidata and Wiki-Category list tasks.
|
| 121 |
+
|
| 122 |
+
<table><tr><td></td><td colspan="2">Wikidata (Easier)</td><td></td><td colspan="4">Wiki-Category list (Harder)</td></tr><tr><td>LLM</td><td>Method</td><td>Prec. (↑)</td><td>Pos.</td><td>Neg.</td><td>Prec.(↑)</td><td>Pos.</td><td>Neg.</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>0.12</td><td>0.55</td><td>3.93</td><td>0.05</td><td>0.35</td><td>6.85</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>0.08</td><td>0.75</td><td>8.92</td><td>0.03</td><td>0.30</td><td>11.1</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>0.17</td><td>0.59</td><td>2.95</td><td>0.12</td><td>0.55</td><td>4.05</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>0.29</td><td>0.41</td><td>0.98</td><td>0.15</td><td>0.30</td><td>1.69</td></tr><tr><td>Llama 65B</td><td>CoVe (two-step)</td><td>0.36</td><td>0.38</td><td>0.68</td><td>0.21</td><td>0.50</td><td>0.52</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>0.32</td><td>0.38</td><td>0.79</td><td>0.22</td><td>0.52</td><td>1.52</td></tr></table>
|
| 123 |
+
|
| 124 |
+
# 4.1.4 LONGFORM GENERATION OF BIOGRAPHIES
|
| 125 |
+
|
| 126 |
+
We next validate the performance of CoVe on longform text generation. In this setting, we evaluate our method on generating biographies, adopting the benchmark proposed in by Min et al. (2023). Here the model is simply prompted to generate a biography of a selected entity using the prompt: “Tell me a bio of <entity>”. We evaluate the efficacy of our approach using the FACTSCORE metric (Min et al., 2023) developed in that work, which uses a retrieval-augmented language model to fact-check the response (Instruct-Llama, “Llama $^ +$ Retrieval $+ \mathrm { N P ^ { , } }$ ), which they showed correlates well with human judgments.
|
| 127 |
+
|
| 128 |
+
# 4.2 BASELINES
|
| 129 |
+
|
| 130 |
+
We use Llama 65B, a strong open model as our base LLM (Touvron et al., 2023a), and use greedy decoding for all models. As Llama 65B is not instruction fine-tuned, we employ few-shot examples particular to each task for measuring performance on each of our benchmarks. This serves as our main baseline which CoVe tries to improve upon. CoVe uses the same Llama 65B base, but includes, for the same few-shot examples, demonstrations of verification questions and final verified responses, following Figure 1 and section 3. Thus, we measure the ability to improve over the original baseline response for the same LLM. For CoVe, we compare different variants, particularly the joint and factored versions on all tasks.
|
| 131 |
+
|
| 132 |
+
We also compare to Llama instruction fine-tuned models, for which we use Llama 2 (Touvron et al., 2023b). We measure both zero-shot performance on the task, or zero-shot with chain-of-thought by adding “Let’s think step by step” to the zero-shot prompt. We find that the instruction fine-tuned models tend to generate extraneous content when queried. This can especially be a problem for the list-based tasks. To deal with this we add an extra line to our prompt: “List only the answers separated by a comma”. We also add another layer of post-processing to extract the answers by using an off-the-shelf NER model to further avoid this issue as this helped. However, we still expect few-shot to improve over this, especially for tasks like Multi-Span-QA where the answers are not all named entities, and the few-shot examples effectively show the domain of the task.
|
| 133 |
+
|
| 134 |
+
For the longform generation of biographies we also compare to several existing model results reported in Min et al. (2023), in particular InstructGPT (Ouyang et al., 2022), ChatGPT 2 and PerplexityAI 3.
|
| 135 |
+
|
| 136 |
+
# 4.3 RESULTS
|
| 137 |
+
|
| 138 |
+
We are interested in empirically answering the following research questions:
|
| 139 |
+
|
| 140 |
+
RQ1 Can COVE effectively reduce the rate of hallucinatory content produced by the LLM? RQ2 Can COVE be used to fix or remove incorrect generations without decreasing the amount of correct content?
|
| 141 |
+
|
| 142 |
+
Table 2: Closed book MultiSpanQA test performance, comparing CoVe with various baselines.
|
| 143 |
+
|
| 144 |
+
<table><tr><td>LLM</td><td>Method</td><td>F1(1)</td><td>Prec.</td><td>Rec.</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>0.20</td><td>0.13</td><td>0.40</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>0.17</td><td>0.11</td><td>0.37</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>0.39</td><td>0.40</td><td>0.38</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>0.46</td><td>0.50</td><td>0.42</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>0.48</td><td>0.50</td><td>0.46</td></tr></table>
|
| 145 |
+
|
| 146 |
+
Table 3: Longform generation of biographies with metrics defined from Min et al. (2023). Models marked with $^ *$ are reported from previous work. FACTSCORE automatically computed using “InstructLlama” ( Retrieve $ \mathrm { L M } + \mathrm { N P }$ ), the best open-access model.
|
| 147 |
+
|
| 148 |
+
<table><tr><td>LLM</td><td>Method</td><td>FACTSCORE. (↑)</td><td>Avg. # facts</td></tr><tr><td>InstructGPT*</td><td>Zero-shot</td><td>41.1</td><td>26.3</td></tr><tr><td>ChatGPT*</td><td>Zero-shot</td><td>58.7</td><td>34.7</td></tr><tr><td>PerplexityAI*</td><td>Retrieval-based</td><td>61.6</td><td>40.8</td></tr><tr><td>Llama 2 70B Chat</td><td>Zero-shot</td><td>41.3</td><td>64.9</td></tr><tr><td>Llama 2 70B Chat</td><td>CoT</td><td>41.1</td><td>49.0</td></tr><tr><td>Llama 65B</td><td>Few-shot</td><td>55.9</td><td>16.6</td></tr><tr><td>Llama 65B</td><td>CoVe (joint)</td><td>60.8</td><td>12.8</td></tr><tr><td>Llama 65B</td><td>CoVe (factored)</td><td>63.7</td><td>11.7</td></tr><tr><td>Llama 65B</td><td>CoVe (factor+revise)</td><td>71.4</td><td>12.3</td></tr><tr><td>GPT-3</td><td>Few-shot</td><td>45.3</td><td>15.6</td></tr><tr><td>GPT-3 + ChatGPT</td><td>ChatProtect Muindler et al. (2023)</td><td>48.5</td><td>14.6</td></tr><tr><td>GPT-3 + InstructGPT</td><td>SCG-LL Manakul et al. (2023)</td><td>60.6</td><td>6.0</td></tr><tr><td>GPT-3+DeBERTA</td><td>SCG-NLI Manakul et al. (2023)</td><td>61.7</td><td>6.3</td></tr><tr><td>GPT-3 + InstructGPT</td><td>CoVe (factor+revise)</td><td>68.6</td><td>9.0</td></tr></table>
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 2: FACTSCORE performance distribution across head, torso and tail facts for CoVe variants and various baselines on longform generation of biographies.
|
| 152 |
+
|
| 153 |
+
Our main results across the four benchmark tasks are given in Table 1, Table 2 and Table 3, and our main findings are as follows.
|
| 154 |
+
|
| 155 |
+
CoVe improves precision on list-based answer tasks We find that CoVe provides large gains in precision on the list-based tasks, e.g. more than doubles the precision from the Llama 65B few-shot baseline for the Wikidata task (from 0.17 to 0.36). We find from the positive and negative breakdown that there is a large reduction in the number of hallucinated answers (negatives: $2 . 9 5 0 . 6 8 )$ while only a relatively small reduction in the number of non-hallucinations (positives: $0 . 5 9 0 . 3 8$ ).
|
| 156 |
+
|
| 157 |
+
CoVe improves performance on closed book QA We also find that CoVe brings improvements in general QA problems, as measured on MultiSpanQA. We observe a $23 \%$ improvement in F1 over the few-shot baseline $( 0 . 3 9 0 . 4 8 )$ ), where the improvements come from gains in both precision and recall.
|
| 158 |
+
|
| 159 |
+
CoVe improves precision on longform generation These results also extend to longform generation, where we actually see larger gains than in the QA setting. FACTSCORE increases $28 \%$ $5 5 . 9 $ 71.4) from the few-shot baseline, with again only a relatively small reduction in average number of facts provided $1 6 . 6 1 2 . 3$ ). We also show the breakdown of improvements across facts in Figure 2, where one can see CoVe improves results for both rare and more frequent facts.
|
| 160 |
+
|
| 161 |
+
Instruction-tuning and CoT do not reduce hallucinations We find that the few-shot baseline that employs a pre-trained Llama model outperforms Llama-2-Chat, an instruction tuned model, across all the tasks. The few-shot examples lead the model to give outputs in line with those expected for the task, whereas general instruction tuning produces more hallucinations or incorrect outputs. Zero-shot chain-of-thought (CoT) prompting also fails to improve the results for these tasks.
|
| 162 |
+
|
| 163 |
+
Factored and 2-step CoVe improve performance We observe a consistent performance improvement across all tasks from applying the factored CoVe approach compared to joint CoVe. For example improvement from $6 0 . 8 6 3 . 7$ in FACTSCORE in longform generation. Similarly, the 2-step approach also outperforms the joint approach, as tested on the Wikidata and Wiki-Category list tasks, with 2-step giving the best results for Wikidata, and factored the best for Wiki-Category. All these results support our hypothesis that verifying questions should not attend to the original baseline response as they may be prone to repeating it (as the joint method can do).
|
| 164 |
+
|
| 165 |
+
Further explicit reasoning helps remove hallucinations In the longform generation task we also explore more sophisticated reasoning steps in the CoVe “factor+revise” method, which explicitly cross-checks whether verification answers indicate an inconsistency. We see large gains in the FACTSCORE metric from this further explicit reasoning from 63.7 (factored) $ 7 1 . 4$ (factor+revise). This gives further indication that appropriate and explicit reasoning in LLMs can bring improvements in mitigating hallucinations.
|
| 166 |
+
|
| 167 |
+
CoVe-based Llama outperforms InstructGPT, ChatGPT and PerplexityAI On the longform generation task, our baseline few-shot Llama 65B is outperformed by the ChatGPT and PerplexityAI models in terms of the FACTSCORE metric. However, applying CoVe to Llama 65B lifts its performance above ChatGPT and InstructGPT, as well as PerplexityAI. This is particularly impressive compared to PerplexityAI considering that is a model that can support its facts with retrieval-augmentation, whereas CoVe uses only the base language model itself with improved reasoning via deliberation (verification). However, Figure 2 shows PerplexityAI still outperforms CoVe for very rare facts where retrieval is essential, but CoVe outperforms PerplexityAI for frequent facts.
|
| 168 |
+
|
| 169 |
+
CoVe outperforms existing hallucination mitigation baselines We compare CoVe to three recently released longform hallucination mitigation approaches — NLI and LLM, the two bestperforming variants of SelfCheckGPT (Manakul et al., 2023) and ChatProtect Mundler et al. (2023). ¨ Our results in Table 3 show that COVE outperforms all these baselines. More details on our implementations of the baselines can be found in section 9. For SelfCheckGPT we experiment with different thresholds (in Table 6) and choose a threshold that results in a high FACTSCORE without removing a lot of facts. We note that some models produce fewer overall facts than others, however, the FACTSCORE metric is normalized and hence comparable across models. We verified this experimentally by clipping Llama-2-70B chat’s output to present fewer facts (as it contains the largest number in its output out of all models), but this did not change its FACTSCORE substantially, e.g. clipping to 10 sentences increased its score from $4 1 . 3 4 2 . 7$ . We note the length of the generations of the few-shot-based models is essentially governed by the few-shot examples, which in turn are constrained by the context length.
|
| 170 |
+
|
| 171 |
+
Shortform verification questions are more accurately answered than longform queries In a longform response, LLMs are prone to generate a number of hallucinations. However, it can often be the case that the LLM itself would know these hallucinations are wrong if queried specifically for that individual fact, independent of the rest of the longform generation, see Figure 1, Figure 3, and section 12. This can be seen quantitatively on the Wikidata task, where only ${ \sim } 1 7 \%$ of the Llama few-shot baseline answer entities are correct in list-based questions. However, when querying each individual entity via a verification question, we find ${ \sim } 7 0 \%$ are correctly answered.
|
| 172 |
+
|
| 173 |
+
Open LLM-based verification questions outperform yes/no-based and rule-based verification questions In our method, CoVe, the verification questions generated by the LLM expect answers that are true facts. Another alternative type of verification questions would be templated verification questions, which can be generated cheaply, and binary questions. We first compare to heuristically constructed questions by replacing the LLM questions with templated yes/no questions of the form “Does $X$ answer the question” for list-based questions with elements $X$ in the answer. Results on the Wiki-Category task, given in Table 4, show a reduced precision with rule-based verification questions. We then move on to binary questions where we include the fact as part of the verification question and ask it in a yes/no answer format. We evaluate this difference in Table 4, and find that yes/no type questions perform worse for the factored version of CoVe. Some anecdotal examples are included in Appendix section 12 for ChatGPT where we find the model tends to agree with facts in a yes/no question format whether they are right or wrong. We believe this difference would be larger for longform generation where the types of required verification questions can be more diverse, and LLM-based verification becomes even more necesary.
|
| 174 |
+
|
| 175 |
+
Inference overhead Approaches that detect hallucinations via inconsistencies require repeated prompts to the LLM. COVE essentially requires 1 LLM call for generating the baseline response, 1 LLM call for each sentence to plan the verifications, 1 LLM call to verify each fact and 1 LLM call for each fact to generate the consistent response. We also note that the LLM calls for verification for each fact can be parallelized. This is comparable and in certain cases fewer LLM calls compared to other approaches for hallucination mitigation. We provide a more in-depth analysis in section 8.
|
| 176 |
+
|
| 177 |
+
# 5 CONCLUSION
|
| 178 |
+
|
| 179 |
+
We introduced Chain-of-Verification $\mathrm { ( C o V e ) }$ , an approach to reduce hallucinations in a large language model by deliberating on its own responses and self-correcting them. In particular, we showed that models are able to answer verification questions with higher accuracy than when answering the original query by breaking down the verification into a set of simpler questions. Secondly, when answering the set of verification questions, we showed that controlling the attention of the model so that it cannot attend to its previous answers (factored CoVe) helps alleviate copying the same hallucinations. Overall, our method provides substantial performance gains over the original language model response just by asking the same model to deliberate on (verify) its answer. An obvious extension to our work is to equip CoVe with tool-use, e.g., to use retrieval augmentation in the verification execution step which would likely bring further gains.
|
| 180 |
+
|
| 181 |
+
# 6 LIMITATIONS
|
| 182 |
+
|
| 183 |
+
While our Chain-of-Verification (CoVe) method seeks to reduce hallucinations, it does not remove them completely from generations. This means that CoVe can still generate incorrect or misleading information for a given query, even if it improves over the baseline. We also note that in our experiments we have only addressed hallucinations in the form of directly stated factual inaccuracies. However, hallucinations could come in other forms, such as during incorrect reasoning steps, as part of opinions, etc. We also note that the generations CoVe produces come with verifications which, if viewed by the user, add more interpretability to its decisions, but come at the cost of increased computational expense due to generating more tokens in the output, similar to other reasoning methods such as Chain-of-Thought.
|
| 184 |
+
|
| 185 |
+
Our method seeks to make a large language model produce improved responses by spending more time deliberating to identify its own mistakes. While we have shown this gives clear improvements, the upper bound to the improvement is clearly limited by the overall capabilities of the model, e.g. in identifying and knowing what it knows. In this regard, an orthogonal line of research, as discussed in section 2 is the use of external tools by language models, to gain further information beyond what is stored in its weights. While we do not explore that avenue in this work those techniques would likely be fruitful to combine with the findings here.
|
| 186 |
+
|
| 187 |
+
# REFERENCES
|
| 188 |
+
|
| 189 |
+
Leonard Adolphs, Kurt Shuster, Jack Urbanek, Arthur Szlam, and Jason Weston. Reason first, then respond: Modular generation for knowledge-infused dialogue. arXiv preprint arXiv:2111.05204, 2021.
|
| 190 |
+
Ayush Agrawal, Lester Mackey, and Adam Tauman Kalai. Do language models know when they’re hallucinating references? arXiv preprint arXiv:2305.18248, 2023.
|
| 191 |
+
I Chern, Steffi Chern, Shiqi Chen, Weizhe Yuan, Kehua Feng, Chunting Zhou, Junxian He, Graham Neubig, Pengfei Liu, et al. Factool: Factuality detection in generative ai–a tool augmented framework for multi-task and multi-domain scenarios. arXiv preprint arXiv:2307.13528, 2023a.
|
| 192 |
+
I-Chun Chern, Zhiruo Wang, Sanjan Das, Bhavuk Sharma, Pengfei Liu, Graham Neubig, et al. Improving factuality of abstractive summarization via contrastive reward learning. arXiv preprint arXiv:2307.04507, 2023b.
|
| 193 |
+
Roi Cohen, May Hamri, Mor Geva, and Amir Globerson. Lm vs lm: Detecting factual errors via cross examination. arXiv preprint arXiv:2305.13281, 2023.
|
| 194 |
+
Boris A Galitsky. Truth-o-meter: Collaborating with llm in fighting its hallucinations. 2023.
|
| 195 |
+
Luyu Gao, Zhuyun Dai, Panupong Pasupat, Anthony Chen, Arun Tejasvi Chaganty, Yicheng Fan, Vincent Zhao, Ni Lao, Hongrae Lee, Da-Cheng Juan, et al. Rarr: Researching and revising what language models say, using language models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 16477–16508, 2023.
|
| 196 |
+
Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
|
| 197 |
+
Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12):1–38, 2023.
|
| 198 |
+
Weisen Jiang, Han Shi, Longhui Yu, Zhengying Liu, Yu Zhang, Zhenguo Li, and James T Kwok. Backward reasoning in large language models for verification. arXiv preprint arXiv:2308.07758, 2023a.
|
| 199 |
+
Zhengbao Jiang, Frank F Xu, Luyu Gao, Zhiqing Sun, Qian Liu, Jane Dwivedi-Yu, Yiming Yang, Jamie Callan, and Graham Neubig. Active retrieval augmented generation. arXiv preprint arXiv:2305.06983, 2023b.
|
| 200 |
+
Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, et al. Language models (mostly) know what they know. arXiv preprint arXiv:2207.05221, 2022.
|
| 201 |
+
Jack Lanchantin, Shubham Toshniwal, Jason Weston, Arthur Szlam, and Sainbayar Sukhbaatar. Learning to reason and memorize with self-notes. arXiv preprint arXiv:2305.00833, 2023.
|
| 202 |
+
Haonan Li, Martin Tomko, Maria Vasardani, and Timothy Baldwin. Multispanqa: A dataset for multi-span question answering. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1250–1260, 2022.
|
| 203 |
+
Kenneth Li, Oam Patel, Fernanda Viegas, Hanspeter Pfister, and Martin Wattenberg. Inference-time ´ intervention: Eliciting truthful answers from a language model. arXiv preprint arXiv:2306.03341, 2023.
|
| 204 |
+
Zhan Ling, Yunhao Fang, Xuanlin Li, Zhiao Huang, Mingu Lee, Roland Memisevic, and Hao Su. Deductive verification of chain-of-thought reasoning. arXiv preprint arXiv:2306.03872, 2023.
|
| 205 |
+
Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023.
|
| 206 |
+
Chaitanya Malaviya, Peter Shaw, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Quest: A retrieval dataset of entity-seeking queries with implicit set operations. arXiv preprint arXiv:2305.11694, 2023.
|
| 207 |
+
Potsawee Manakul, Adian Liusie, and Mark JF Gales. Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models. arXiv preprint arXiv:2303.08896, 2023.
|
| 208 |
+
Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. arXiv preprint arXiv:2005.00661, 2020.
|
| 209 |
+
Jacob Menick, Maja Trebacz, Vladimir Mikulik, John Aslanides, Francis Song, Martin Chadwick, Mia Glaese, Susannah Young, Lucy Campbell-Gillingham, Geoffrey Irving, et al. Teaching language models to support answers with verified quotes. arXiv preprint arXiv:2203.11147, 2022.
|
| 210 |
+
Ning Miao, Yee Whye Teh, and Tom Rainforth. Selfcheck: Using llms to zero-shot check their own step-by-step reasoning. arXiv preprint arXiv:2308.00436, 2023.
|
| 211 |
+
Sabrina J Mielke, Arthur Szlam, Emily Dinan, and Y-Lan Boureau. Reducing conversational agents’ overconfidence through linguistic calibration. Transactions of the Association for Computational Linguistics, 10:857–872, 2022.
|
| 212 |
+
Sewon Min, Kalpesh Krishna, Xinxi Lyu, Mike Lewis, Wen-tau Yih, Pang Wei Koh, Mohit Iyyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. Factscore: Fine-grained atomic evaluation of factual precision in long form text generation. arXiv preprint arXiv:2305.14251, 2023.
|
| 213 |
+
Niels Mundler, Jingxuan He, Slobodan Jenko, and Martin Vechev. Self-contradictory hallucinations ¨ of large language models: Evaluation, detection and mitigation. arXiv preprint arXiv:2305.15852, 2023.
|
| 214 |
+
Shashi Narayan, Joshua Maynez, Reinald Kim Amplayo, Kuzman Ganchev, Annie Louis, Fantine Huot, Anders Sandholm, Dipanjan Das, and Mirella Lapata. Conditional generation with a question-answering blueprint. Transactions of the Association for Computational Linguistics, 11: 974–996, 2023.
|
| 215 |
+
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730–27744, 2022.
|
| 216 |
+
Baolin Peng, Michel Galley, Pengcheng He, Hao Cheng, Yujia Xie, Yu Hu, Qiuyuan Huang, Lars Liden, Zhou Yu, Weizhu Chen, et al. Check your facts and try again: Improving large language models with external knowledge and automated feedback. arXiv preprint arXiv:2302.12813, 2023.
|
| 217 |
+
Fabio Petroni, Tim Rocktaschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, ¨ and Sebastian Riedel. Language models as knowledge bases? arXiv preprint arXiv:1909.01066, 2019.
|
| 218 |
+
Ofir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah A Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models. arXiv preprint arXiv:2210.03350, 2022.
|
| 219 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
|
| 220 |
+
Ansh Radhakrishnan, Karina Nguyen, Anna Chen, Carol Chen, Carson Denison, Danny Hernandez, Esin Durmus, Evan Hubinger, Jackson Kernion, Kamile Luko ˙ siˇ ut¯ e, et al. Question decomposition ˙ improves the faithfulness of model-generated reasoning. arXiv preprint arXiv:2307.11768, 2023.
|
| 221 |
+
Hannah Rashkin, Vitaly Nikolaev, Matthew Lamm, Lora Aroyo, Michael Collins, Dipanjan Das, Slav Petrov, Gaurav Singh Tomar, Iulia Turc, and David Reitter. Measuring attribution in natural language generation models. Computational Linguistics, pp. 1–66, 2023.
|
| 222 |
+
Paul Roit, Johan Ferret, Lior Shani, Roee Aharoni, Geoffrey Cideron, Robert Dadashi, Matthieu Geist, Sertan Girgin, Leonard Hussenot, Orgad Keller, et al. Factually consistent summarization ´ via reinforcement learning with textual entailment feedback. arXiv preprint arXiv:2306.00186, 2023.
|
| 223 |
+
Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M Smith, et al. Recipes for building an open-domain chatbot. arXiv preprint arXiv:2004.13637, 2020.
|
| 224 |
+
Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. Retrieval augmentation reduces hallucination in conversation. arXiv preprint arXiv:2104.07567, 2021.
|
| 225 |
+
Kai Sun, Yifan Ethan Xu, Hanwen Zha, Yue Liu, and Xin Luna Dong. Head-to-tail: How knowledgeable are large language models (llm)? aka will llms replace knowledge graphs? arXiv preprint arXiv:2308.10168, 2023a.
|
| 226 |
+
Weiwei Sun, Zhengliang Shi, Shen Gao, Pengjie Ren, Maarten de Rijke, and Zhaochun Ren. Contrastive learning reduces hallucination in conversations. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 13618–13626, 2023b.
|
| 227 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and \` efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a.
|
| 228 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023b.
|
| 229 |
+
|
| 230 |
+
Neeraj Varshney, Wenlin Yao, Hongming Zhang, Jianshu Chen, and Dong Yu. A stitch in time saves nine: Detecting and mitigating hallucinations of llms by validating low-confidence generation. arXiv preprint arXiv:2307.03987, 2023.
|
| 231 |
+
|
| 232 |
+
Chaojun Wang and Rico Sennrich. On exposure bias, hallucination and domain shift in neural machine translation. arXiv preprint arXiv:2005.03642, 2020.
|
| 233 |
+
|
| 234 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022.
|
| 235 |
+
|
| 236 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022.
|
| 237 |
+
|
| 238 |
+
Yixuan Weng, Minjun Zhu, Shizhu He, Kang Liu, and Jun Zhao. Large language models are reasoners with self-verification. arXiv preprint arXiv:2212.09561, 2022.
|
| 239 |
+
|
| 240 |
+
Zeqiu Wu, Yushi Hu, Weijia Shi, Nouha Dziri, Alane Suhr, Prithviraj Ammanabrolu, Noah A Smith, Mari Ostendorf, and Hannaneh Hajishirzi. Fine-grained human feedback gives better rewards for language model training. arXiv preprint arXiv:2306.01693, 2023.
|
| 241 |
+
|
| 242 |
+
Hongbin Ye, Tong Liu, Aijia Zhang, Wei Hua, and Weiqiang Jia. Cognitive mirage: A review of hallucinations in large language models. arXiv preprint arXiv:2309.06794, 2023.
|
| 243 |
+
|
| 244 |
+
Wenhao Yu, Zhihan Zhang, Zhenwen Liang, Meng Jiang, and Ashish Sabharwal. Improving language models via plug-and-play retrieval feedback. arXiv preprint arXiv:2305.14002, 2023. Muru Zhang, Ofir Press, William Merrill, Alisa Liu, and Noah A Smith. How language model hallucinations can snowball. arXiv preprint arXiv:2305.13534, 2023. Ruochen Zhao, Xingxuan Li, Shafiq Joty, Chengwei Qin, and Lidong Bing. Verify-and-edit: A knowledge-enhanced chain-of-thought framework. arXiv preprint arXiv:2305.03268, 2023.
|
| 245 |
+
|
| 246 |
+
# 7 RULE-BASED VS BINARY VS GENERAL QUESTIONS
|
| 247 |
+
|
| 248 |
+
Table 4: Comparison of various COVE verification plan strategies (rows) and verification execution techniques (columns) on the WikiCategory task.
|
| 249 |
+
|
| 250 |
+
<table><tr><td></td><td colspan="2">Verification Execution</td></tr><tr><td></td><td>CoVe (joint)</td><td>CoVe (factored)</td></tr><tr><td>Verification Plan</td><td>Prec.</td><td>Prec.</td></tr><tr><td>Rule-based questions Generated by model:</td><td>0.13</td><td>0.16</td></tr><tr><td>yes/no questions</td><td>0.15</td><td>0.19</td></tr><tr><td>general questions</td><td>0.15</td><td>0.22</td></tr></table>
|
| 251 |
+
|
| 252 |
+
# 8 INFERENCE OVERHEAD
|
| 253 |
+
|
| 254 |
+
$N : =$ Number of text samples, 4 in our experiments $k : =$ Number of repeated mitigations, 3 in our experiments $s : =$ Number of sentences in the generated passage $f : =$ Number of facts in the generated passage
|
| 255 |
+
|
| 256 |
+
<table><tr><td>Method</td><td>#LLM prompts</td></tr><tr><td>Few-shot</td><td>1</td></tr><tr><td>ChatProtect Mundler et al. (2023)</td><td>1+s×k × (3)</td></tr><tr><td>SCG-LLM Manakul et al. (2023)</td><td>n+1+s×n</td></tr><tr><td>CoVe (factor+revise)</td><td>1+s+2×f</td></tr></table>
|
| 257 |
+
|
| 258 |
+
Table 5: Worst-case LLM prompts used by each hallucination mitigation approach in the worst case
|
| 259 |
+
|
| 260 |
+
Based on the current implementations we find the COVE induces a similar inference overhead to other longform hallucination mitigation approaches.
|
| 261 |
+
|
| 262 |
+
# 9 IMPLEMENTATION OF BASELINES
|
| 263 |
+
|
| 264 |
+
We use the existing models provided by Manakul et al. (2023) for the NLI model. For the LLM model we prompt GPT-3.5-turbo-instruction with the following instruction (as described in Manakul et al. (2023).
|
| 265 |
+
|
| 266 |
+
Context: {}
|
| 267 |
+
Sentence: {}
|
| 268 |
+
Is the sentence supported by the context above?
|
| 269 |
+
Answer Yes or No:
|
| 270 |
+
|
| 271 |
+
Table 6: Different threshold results for SelfCheckGPT
|
| 272 |
+
|
| 273 |
+
<table><tr><td colspan="3">NLI</td><td colspan="2">LLM</td></tr><tr><td>Threshold</td><td>FS</td><td>Facts</td><td>FS</td><td>Facts</td></tr><tr><td>High</td><td>76.5</td><td>3.0</td><td>61.7</td><td>6.3</td></tr><tr><td>Med</td><td>60.6</td><td>6.0</td><td>56.8</td><td>8.4</td></tr><tr><td>Low</td><td>53.0</td><td>8.0</td><td>53.0</td><td>10</td></tr></table>
|
| 274 |
+
|
| 275 |
+
# 10 COVE - FURTHER DETAILS
|
| 276 |
+
|
| 277 |
+
Query
|
| 278 |
+
|
| 279 |
+
What was the primary cause of the Mexican-American war?
|
| 280 |
+
|
| 281 |
+
1. Baseline Response
|
| 282 |
+
|
| 283 |
+
The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848. It followed in the wake of the 1845 U.S. annexation of Texas, which Mexico considered part of its territory in spite of its de facto secession in the 1835 Texas Revolution.
|
| 284 |
+
|
| 285 |
+

|
| 286 |
+
|
| 287 |
+
# 4. Final Verified Response
|
| 288 |
+
|
| 289 |
+
The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848. It followed in the wake of the 1845 U.S. annexation of Texas.
|
| 290 |
+
|
| 291 |
+
Figure 3: For longform generation, the Chain-of-Verification (CoVe) Factor $^ +$ Revise method is the most effective in our longform generation experiments. CoVe Factor $^ +$ Revise has the model independently identify (cross-check) which facts are consistent with its executed verifications (indicated by tickmark and crosses in the figure). With this extra step we aim to disregard the inconsistent facts and use the consistent facts to regenerate the response.
|
| 292 |
+
|
| 293 |
+
# 11 PROMPT TEMPLATES
|
| 294 |
+
|
| 295 |
+
We provide prompt templates for the longform generation of biographies task below for the different steps and variants of CoVe (see section 3). Templates for the other tasks are similar, but using few-shot examples from those tasks instead.
|
| 296 |
+
|
| 297 |
+
# 11.1 GENERATE BASELINE RESPONSE
|
| 298 |
+
|
| 299 |
+

|
| 300 |
+
|
| 301 |
+
Table 7: Few-shot prompting with 3 few-shot examples for the longform generation of biographies task. Other tasks use the same standard few-shot setup as well (with 3 examples from that particular task).
|
| 302 |
+
|
| 303 |
+
# 11.2 PLAN VERIFICATIONS
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
|
| 307 |
+
Table 8: Step (2) of CoVe involves planning the verification questions. In the biography task case we split the longform generation into its individual passages (e.g. sentences in the biography case, this was done due to excessive context length, which we don’t need to do for the other tasks). The model then generates a verification question for each fact it observes in each passage (a passage may have multiple facts).
|
| 308 |
+
|
| 309 |
+
# 11.3 EXECUTE VERIFICATIONS
|
| 310 |
+
|
| 311 |
+
<table><tr><td>A:Answer</td><td>Q:Verification Question</td></tr><tr><td>A:Answer</td><td>Q:Verification Question</td></tr><tr><td></td><td>Q:Verification Question</td></tr><tr><td>A:Answer</td><td></td></tr><tr><td>A:</td><td>Q:Verification Question</td></tr></table>
|
| 312 |
+
|
| 313 |
+
Table 9: In step (3) of CoVe, the model then generates an answer for each of the verification questions.
|
| 314 |
+
Again we use 3 few-shot examples.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
|
| 318 |
+
Table 10: In step (4) of CoVe (factored) the model is then presented with its original generation (split into passages, e.g. sentences, in the biography case, due to excessive context length which we do not need to do for the other tasks) along with its own verification step results. The model is told that this information comes from “another source”. The model is required to synthesize a new final answer based on facts that are consistent between the two sources.
|
| 319 |
+
|
| 320 |
+
11.5 FACTOR $^ +$ REVISE: IDENTIFY WHICH FACTS ARE CONSISTENT
|
| 321 |
+
|
| 322 |
+
Context: <Original Fact>.
|
| 323 |
+
From another source,
|
| 324 |
+
<output of execute verification step: ${ \mathsf { \Omega } } + { \mathsf { \Omega } } { \mathsf { A } } { \mathsf { \Sigma } } ^ { } $
|
| 325 |
+
Response: CONSISTENT. <Consistent fact>
|
| 326 |
+
Context: <Original Fact>.
|
| 327 |
+
From another source,
|
| 328 |
+
<output of execute verification step: ${ \mathsf { \Omega } } + { \mathsf { \Omega } } { \mathsf { A } } { \mathsf { \Sigma } } ^ { } $
|
| 329 |
+
Response: INCONSISTENT.
|
| 330 |
+
Context: <Original Fact>.
|
| 331 |
+
From another source,
|
| 332 |
+
<output of execute verification step: ${ \mathsf { \Omega } } + { \mathsf { \Omega } } { \mathsf { A } } { \mathsf { \Sigma } } ^ { } $
|
| 333 |
+
Response: PARTIALLY CONSISTENT. <Consistent part>
|
| 334 |
+
|
| 335 |
+
Table 11: In the CoVe (Factor $^ +$ Revise) variant, as part of step (3) after subsection 11.3, the model is made to explicitly identify which facts are consistent between the two sources. The consistent facts can then be spliced together.
|
| 336 |
+
|
| 337 |
+
# 12 CHATGPT EXAMPLE SCREENSHOTS
|
| 338 |
+
|
| 339 |
+

|
| 340 |
+
Figure 4: ChatGPT generates several hallucinations for this question, e.g. Hillary Clinton and Michael Bloomberg.
|
| 341 |
+
|
| 342 |
+

|
| 343 |
+
Figure 5: Even when the longform answer is provided for a rewritten query (see query from Figure 4), while giving a slightly different answer, ChatGPT still generates several hallucinations for this question, e.g. Hillary Clinton and Michael Bloomberg.
|
| 344 |
+
|
| 345 |
+

|
| 346 |
+
Figure 6: Shortform questions (which could be verification questions) appear to be answered more factually than the longform answers in Figure 4 and Figure 5.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 7: Another example of hallucinations for a different query, e.g., John F. Kennedy Jr was born in Washington D.C.
|
| 350 |
+
|
| 351 |
+

|
| 352 |
+
Figure 8: Examples where questions asking for a fact are answered correctly, but verifying via a yes/no question is incorrect (the model tends to agree with the way the question is stated, even if it was stated incorrectly).
|
md/test/WPZ2yPag4K/WPZ2yPag4K.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FINE-TUNING LANGUAGE MODELS FOR FACTUALITY
|
| 2 |
+
|
| 3 |
+
Katherine Tian\*†, Eric Mitchell\*†, Huaxiu Yao†§, Christopher D. Manning†, Chelsea Finn†
|
| 4 |
+
†Stanford University §UNC Chapel Hill
|
| 5 |
+
{kattian,eric.mitchell}@cs.stanford.edu
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
The fluency and creativity of large pre-trained language models (LLMs) have led to their widespread use, sometimes even as a replacement for traditional search engines. Yet language models are prone to making convincing but factually inaccurate claims, often referred to as ‘hallucinations.’ These errors can inadvertently spread misinformation or harmfully perpetuate misconceptions. Further, manual fact-checking of model responses is a time-consuming process, making human factuality labels expensive to acquire. In this work, we fine-tune language models to be more factual, without human labeling and targeting more open-ended generation settings than past work. We leverage two key recent innovations in NLP to do so. First, several recent works have proposed methods for judging the factuality of open-ended text by measuring consistency with an external knowledge base or simply a large model’s confidence scores. Second, the Direct Preference Optimization algorithm enables straightforward finetuning of language models on objectives other than supervised imitation, using a preference ranking over possible model responses. We show that learning from automatically generated factuality preference rankings, generated either through existing retrieval systems or our novel retrieval-free approach, significantly improves the factuality (percent of generated claims that are correct) of Llama-2 on held-out topics compared with RLHF or decoding strategies targeted at factuality. At 7B scale, compared to Llama-2-Chat, we observe $53 \%$ and $50 \%$ reduction in factual error rate when generating biographies and answering medical questions, respectively. A reference implementation can be found at https://github.com/kttian/llm_factuality_tuning.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Recent developments in training large language models (LLMs), particularly methods that learn from rankings over responses such as reinforcement learning from human feedback (RLHF) (Christiano et al., 2017; Ziegler et al., 2020; Ouyang et al., 2022), have enabled the development of powerful, engaging dialogue agents. State-of-the-art LLMs are pre-trained on a vast amount of knowledge in large datasets (Touvron et al., 2023a;b) and further fine-tuned to apply this knowledge to follow diverse instructions or complete more specific tasks (Chung et al., 2022; Chen et al., 2021). However, despite these large language models’ exposure to diverse datasets, they are prone to confidently generating incorrect claims. One recent study shows that GPT-3.5 (ChatGPT) produces false citations more often than not when asked to provide the authors of a given study (Agrawal et al., 2023). Nonetheless, other research has demonstrated that in simple question-answering settings, large language models do exhibit systematic markers of uncertainty that indicate their factually unreliable statements (Kadavath et al., 2022; Tian et al., 2023). These results suggest that language models internally represent the limits of their knowledge, leading us to ask: Can language models be fine-tuned to leverage this internal awareness, to avoid making untrue statements in the first place?
|
| 14 |
+
|
| 15 |
+
A key source of difficulty in training factual models comes in specifying an objective that adequately captures factuality. As an example, maximum likelihood, the most common objective for pre-training language models, does not always encourage factual predictions. Consider the question “Where was Yo-Yo Ma born?” A model that continues by near-deterministically producing the text “idk, probably Paris?” is nearly always correct, but receives extremely high loss if the pre-training data contains any other response to the question. On the other hand, a model that hedges probability mass over many possible phrasings and many possible locations (including incorrect ones, like Antarctica) will likely receive much lower loss, as any response observed in the training data will be assigned at least some non-trivial probability. Because the pre-training objective may reward ‘smearing’ probability mass over many possible responses, language models may generate incorrect statements if they underfit the training data or if asked questions that require knowledge not contained in the pre-training data.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Our approach aims to improve the factuality of language models, specifically focusing on longform generation (e.g. writing a biography). We develop two different approaches for estimating factuality of a passage (center), each of which allows us to generate a preference dataset (right). We then fine-tune the language model to optimize these factuality preferences (far right).
|
| 19 |
+
|
| 20 |
+
In principle, reinforcement learning-based objectives can avoid the failures of existing pre-training objectives through the appropriate choice of a reward function that penalizes factually incorrect statements. However, accurately computing such a reward function can be expensive. Obtaining human labels of factuality is time-consuming and costly; Min et al. (2023) report that professional fact-checkers took approximately 9 minutes to fact-check a single model-generated biography of a well-known individual; it cost about $\$ 2,000$ to annotate 505 biographies.
|
| 21 |
+
|
| 22 |
+
In light of these challenges, we leverage recent advances in estimating truthfulness without human intervention: a) reference-based automated fact-checking methods that evaluate the extent to which an external knowledge base supports the claims in a piece of text (Min et al., 2023; Chern et al., 2023) and b) reference-free truthfulness evaluations that use a model’s own confidence as a proxy for truthfulness, inspired by Kuhn et al. (2023). Using these truthfulness measures and a dataset of unlabeled prompts (e.g., “Write a biography of Yo-Yo Ma.”), we sample pairs of completions from a pre-trained model and annotate them with a preference label denoting which has a lower rate of factual errors. Using the recently proposed Direct Preference Optimization (Rafailov et al., 2023) algorithm, we can stably and efficiently learn from such data. Ultimately, this pipeline enables us to fine-tune off-the-shelf language models to produce factual errors less often (with or without a reference knowledge base). See Figure 1 for an overview of our factuality tuning pipeline.
|
| 23 |
+
|
| 24 |
+
Our primary contribution is a straightforward approach to optimizing language models for factuality in long-form text generation without human annotation. We validate this approach on two benchmark datasets for evaluating factuality, targeted at generating biographies of popular figures and answering open-ended questions about medical conditions. We find that fine-tuning for factuality outperforms conventional RLHF and produces complementary benefits to LLM decoding strategies that aim to increase factuality. Further, we find qualitative differences in the result of learning from preference pairs scored with reference-based and reference-free truthfulness estimation. Overall, we find that learning factuality from automatically constructed preference pairs is a cost-effective way to increase model factuality without human intervention, reducing the error count for claims generated by Llama models by around $50 \%$ or more for biographies and over $2 5 \%$ for medical questions.
|
| 25 |
+
|
| 26 |
+
# 2 PRELIMINARIES
|
| 27 |
+
|
| 28 |
+
Our approach to fine-tuning directly for improved factuality uses the framework of reinforcement learning from preferences over candidate actions or responses. In this section, we provide an overview of reinforcement learning in the context of language models, as well as the specific algorithm we use for preference-based RL, direct preference optimization (Rafailov et al., 2023).
|
| 29 |
+
|
| 30 |
+
Fine-tuning language models with reinforcement learning. Reinforcement learning (RL) has proven to be an effective approach to fine-tuning language models to extract complex, useful behaviors from their pre-trained weights. In the context of RL, a language model policy $\pi _ { \theta }$ (typically an autoregressive Transformer) produces a conditional distribution $\pi _ { \theta } ( y \mid x )$ over responses $y$ given an input query $x$ (both $x$ and $y$ are text sequences). The goal of reinforcement learning is to maximize the average reward of outputs generated by the policy, where a reward function $\bar { r } ( x , y )$ assigns a scalar score to an input-output pair that determines its desirability. However, past works have observed that fine-tuning language models with an objective of unconstrained reward maximization can lead to overoptimization (Gao et al., 2022), that is, a policy that achieves high reward through exploitation of the idiosyncrasies of the reward function that are not aligned with the intended behavior. The most commonly-used objective in practice therefore combines reward maximization with a KL-divergence penalty between the language model and its initialization:
|
| 31 |
+
|
| 32 |
+
$$
|
| 33 |
+
\mathop { \operatorname* { m a x } } _ { \pi _ { \theta } } \mathbb { E } _ { x \sim \mathcal { D } _ { p } , y \sim \pi _ { \theta } ( y | x ) } \left[ r ( x , y ) - \beta \log \frac { \pi _ { \theta } ( y \mid x ) } { \pi _ { \mathrm { r e f } } ( y \mid x ) } \right]
|
| 34 |
+
$$
|
| 35 |
+
|
| 36 |
+
where $\mathcal { D } _ { p }$ is some dataset of prompts, $\pi _ { \mathrm { r e f } }$ is the reference model, usually the result of performing some supervised fine-tuning on a pre-trained model using demonstration data, and $\beta$ is a coefficient that controls the trade-off between reward and divergence (Ouyang et al., 2022; Bai et al., 2022; Stiennon et al., 2020). Optimizing this objective aligns the model with the reward function without deviating too far from the pre-trained reference model, reducing overoptimization. In practice, the most common algorithm used to optimize this objective for language models is proximal policy optimization (PPO; Schulman et al. (2017)), although some variants exist (Ramamurthy et al., 2022; Lu et al., 2022). However, these algorithms are quite complex to implement and tune (Zheng et al., 2023) and require online sampling during training, substantially increasing training time.
|
| 37 |
+
|
| 38 |
+
RL from preferences with direct preference optimization (DPO). Most large language models fine-tuned with Eq. 1 optimize a reward function that is learned from a dataset of preference rankings over possible model outputs. The DPO algorithm simplifies $\mathrm { R L }$ on language models for this special case (Rafailov et al., 2023), using a dataset of preference pairs $\mathcal { D } = \{ x ^ { ( i ) } , y _ { w } ^ { ( i ) } , y _ { l } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ of prompts $x$ and candidate responses $y _ { w }$ and $y _ { l }$ (typically sampled from $\pi _ { \mathrm { r e f } } )$ , where $y _ { w }$ is preferred over $y _ { l }$ (denoted $y _ { w } \succ y _ { l } ,$ . The probability of observing a particular preference pair is assumed to follow a Bradley-Terry model (Bradley & Terry, 1952):
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
p ( y _ { w } \succ y _ { l } ) = \sigma ( r ( x , y _ { w } ) - r ( x , y _ { l } ) )
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $\sigma$ is the sigmoid function and $r ( x , y )$ is an unobserved reward or scoring function. Rafailov et al. (2023) show that the optimal policy $\pi ^ { * }$ for the problem in Eq. 1 can be found by optimizing a simple classification loss computed directly on the preference data:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\begin{array} { r } { \mathcal { L } _ { \mathrm { D P O } } ( \pi _ { \theta } ; \pi _ { \mathrm { r e f } } ) = - \mathbb { E } _ { ( x , y _ { w } , y _ { l } ) \sim \mathcal { D } } \left[ \log \sigma \left( \beta \log \frac { \pi _ { \theta } ( y _ { w } \mid x ) } { \pi _ { \mathrm { r e f } } ( y _ { w } \mid x ) } - \beta \log \frac { \pi _ { \theta } ( y _ { l } \mid x ) } { \pi _ { \mathrm { r e f } } ( y _ { l } \mid x ) } \right) \right] } \end{array}
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
DPO enables learning $\pi _ { \theta }$ from a fixed dataset of preferences, without fitting an explicit reward function or sampling from the policy in the loop of training. These advantages make DPO an attractive choice for fine-tuning language models for objectives other than imitation. However, a challenge remains in constructing preference pairs that encourage greater factuality.
|
| 51 |
+
|
| 52 |
+
# 3 CONSTRUCTING PREFERENCES ENCOURAGING FACTUALITY INLONG-FORM TEXT
|
| 53 |
+
|
| 54 |
+
While existing preference learning algorithms like DPO enable efficient, stable learning from objectives other than maximum likelihood, they require data in the form of preferences over possible responses to a prompt. In this section, we propose two classes of approaches to generating such preferences without human labeling effort. One class leverages existing methods to determine consistency with external reference texts as a measure of truthfulness; we propose another, which leverages calibrated model probabilities themselves as a proxy for truthfulness. For both approaches, we are computing an estimated truthfulness score over the claims in each generated response; the response with higher average truthfulness is taken as the preferred response. See Figure 2 for an overview of both procedures for truthfulness scoring. Note that truthfulness scoring is needed only at training time; at test time, we can sample from the model in the normal manner.
|
| 55 |
+
|
| 56 |
+
# 3.1 REFERENCE-BASED TRUTHFULNESS ESTIMATION
|
| 57 |
+
|
| 58 |
+
An intuitive approach to estimating truthfulness is by estimating the consistency of a given piece of text with a reliable reference text or knowledge base. Several recent works have introduced such evaluation criteria; for example, FactScore (Min et al., 2023) uses Wikipedia as reference knowledge, and FacTool (Chern et al., 2023) uses Google Search Results. These measures show high agreement with human judgments of factuality, making them attractive sources of truth for preference data construction. Due to the relatively consistent and high quality of Wikipedia articles, we elect to use FactScore as a representative method of reference-based truthfulness scoring.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: We estimate the factuality of a generation by first extracting claims (left) and then evaluating each claims’ truthfulness (right). For the latter, we consider: a reference-based (top right) method that uses a finetuned Llama model to check if the fact is supported by Wikipedia (Min et al., 2023) and a reference-free (bottom right) method that uses the model’s confidence in its most likely answer to estimate its truthfulness.
|
| 62 |
+
|
| 63 |
+
To evaluate a piece of text, FactScore first extracts a list of the atomic claims present in the text using GPT-3.5.1 For each atomic claim, a smaller, more efficient model such as a Llama-1-7b model (Touvron et al., 2023a) that has been fine-tuned for fact-checking is then used to perform natural language inference (MacCartney & Manning, 2008) to determine if a claim is supported by the reference text. The passage’s truthfulness score is the fraction of the extracted atomic claims that are estimated to be supported by the reference text.
|
| 64 |
+
|
| 65 |
+
We note that reference-based truthfulness has the key limitation that it requires access to relevant, high-quality reference texts against which to measure consistency. Such a requirement may limit applicability to domains where ground truth documents are not known and accurate retrieval is difficult, such as in niche domains or less-structured tasks. Further, reference-based truthfulness estimation requires a reliable model to determine if an atomic claim is supported by the article. In light of these limitations, we propose a reference-free approach to estimating truthfulness of open-ended text, which avoids the need for retrieving external knowledge and checking consistency.
|
| 66 |
+
|
| 67 |
+
# 3.2 REFERENCE-FREE CONFIDENCE-BASED TRUTHFULNESS ESTIMATION
|
| 68 |
+
|
| 69 |
+
To eliminate the need for external knowledge, we leverage the fact that large language models are well-calibrated (Kadavath et al., 2022; Tian et al., 2023). That is, if a large language model assigns a fixed confidence $p$ to each claim in a set of claims, the fraction of these claims that is correct is $p$ . In other words, in expectation over many claims, a perfectly-calibrated model’s confidence in a claim corresponds to the probability it is correct. To use this notion of calibration, we interpret a model generation (e.g., a biography of Yo-Yo Ma) as a collection of claims, each resulting from a query to the model’s knowledge (e.g., “When was Yo-Yo Ma born?” or “How many siblings does Yo-Yo Ma have?”). Our goal is to encourage the model to produce responses containing queries to its knowledge likely to lead to correct claims. Therefore, we parse a complete model generation into its constituent queries to the model’s knowledge. For each query to the model’s knowledge present in the generation, we can estimate the likelihood it will lead to a correct claim by simply estimating the average confidence of the model’s answer to this query. If a model assigns probability 0.7 to ‘1955’ and probability 0.3 to ‘1953’ for the query “When was Yo-Yo Ma born?”, then the probability this query will lead to a correct claim (again, in expectation over queries) is $0 . 7 ^ { 2 } + 0 . { \dot { 3 } } ^ { 2 } = 0 . 5 { \dot { 8 } }$ . The model used for computing confidence scores essentially takes the place of the reference text datastore. We evaluate this Expected Confidence approach as well as a Max Confidence approach, which simply takes the max over the answer confidences for a given query (i.e., we assume the model produces answers greedily rather than sampling).
|
| 70 |
+
|
| 71 |
+

|
| 72 |
+
Figure 3: Factuality tuning using FactScore truthfulness scoring (FactTune-FS) produces by far the greatest improvement in factuality for the biography generation and medical question-answering problems. Factuality tuning with expected model confidence truthfulness scoring provides the next strongest performance, on average. For MedicalQA, only factuality tuning provides a strict improvement in factuality (more correct statements and fewer incorrect statements) compared to the SFT model.
|
| 73 |
+
|
| 74 |
+
More concretely, we first extract atomic claims from the text using GPT-3.5. We then use GPT-3.5 to convert each claim to a query (question) testing knowledge of the particular fact. Careful rephrasing is necessary to ensure that the rephrased question is unambiguous; for example, the claim “Yo-Yo Ma plays the cello” should be converted to the question “What instrument does Yo-Yo Ma play?” rather than just “What does Yo-Yo Ma play?” as the latter question admits answers of the wrong type. If we were to use the second prompt, a model might assign $50 \%$ of its probability on “cello” and $50 \%$ of its probability on “basketball.” However, the model’s low confidence is caused by the ambiguity of the question, not low confidence in the instrument that Yo-Yo Ma plays. We detail the prompts used for question generation in Appendix A.2.
|
| 75 |
+
|
| 76 |
+
After each claim is converted to a minimally ambiguous question, we resample an answer 20 times from the base model (e.g. Llama-1-7b) that is fine-tuned to estimate the model’s uncertainty over the answer. We use a few-shot prompt to encourage well-formed answers. We bin these answers by equivalence, using either heuristic string matching of the responses or using GPT-3.5 to assess if the answers are semantically equivalent, inspired by Kuhn et al. (2023). Our heuristic string match checks whether the words in the answer, excluding stop words, are the same. We compare these choices in Section 4.4. The score for each claim is either the expected or maximum confidence of the model’s response; we finally average this score over all claims in a given model generation.
|
| 77 |
+
|
| 78 |
+
# 3.3 FACTUALITY TUNING: PUTTING IT ALL TOGETHER
|
| 79 |
+
|
| 80 |
+
Given a choice of truthfulness estimator, we can now construct a preference dataset for factuality tuning a given language model from a set of unlabeled prompts. First, we sample $n$ multiple candidate responses for each prompt from the model with simple temperature sampling with temperature 1.0 (using few-shot prompting for models that have not been fine-tuned). For each response, we then compute the truthfulness score with the chosen estimator (reference-based or reference-free). Finally, for all $\binom { n } { 2 }$ pairs of responses to each prompt, we simply choose the response with the higher truthfulness score as the preferred response. For a set of $m$ prompts, we ultimately generate $m { \binom { n } { 2 } } - k$ preference pairs, where $k$ is the number of pairs with equal scores. Finally, we fine-tune the model using the DPO pipeline, using all model responses as targets for the SFT stage.
|
| 81 |
+
|
| 82 |
+
# 4 EXPERIMENTS
|
| 83 |
+
|
| 84 |
+
Our experiments evaluate the extent to which factuality can be learned through preference-based reinforcement learning, using the fully automated preference-generation pipeline described in Section
|
| 85 |
+
|
| 86 |
+
Table 1: Dataset statistics and examples. In biographies, entities are individuals; in MedicalQA, entities are medical conditions. We include 6 questions for each entity in MedicalQA and adjust the number of responses per prompt to keep the total number of pairs in the two datasets roughly similar.
|
| 87 |
+
|
| 88 |
+
<table><tr><td>Dataset</td><td>Entities [train, val, test]</td><td>Prompts per Entity</td><td>Responses per Prompt</td><td>Example prompt</td></tr><tr><td>Biographies</td><td>463[288,50,125]</td><td>16</td><td>10</td><td>Write me a paragraph biography of Mary Wolstonecraft.</td></tr><tr><td>Medical QA</td><td>295[150,45,100]</td><td></td><td>6</td><td>What are the common symptoms of a stroke?</td></tr></table>
|
| 89 |
+
|
| 90 |
+
3. We call the model fine-tuned with our reference-based metric FactTune-FS and the model finetuned with our model confidence-based score, which is completely reference-free, FactTune-MC. For all of our experiments, samples for model confidence are taken from Llama-1-7b.
|
| 91 |
+
|
| 92 |
+
Datasets. We conduct our experiments on two tasks: generating biographies and medical questionanswering. For biographies, we generated a dataset consisting of 463 diverse well-known individuals (288 train, 50 val, 125 test) with 10 short-paragraph biographies each. For medical question answering, we used a dataset of 295 diverse common medical conditions (150 train, 45 val, 100 test) with 6 questions about each condition and 6 short-paragraph answers per question. The test set just uses 1 question per condition. The prompts were generated with GPT-3.5, and the answers were sampled from Llama-1-7b using a few-shot prompt for each dataset. We found that our procedure consistently resulted in well-formed and informative responses, albeit with possible factual errors. Because FactScore uses retrieval against a given Wikipedia article, we generate data based on individuals and medical conditions that have Wikipedia pages. See Table 1 for the summary stats and examples from our datasets.
|
| 93 |
+
|
| 94 |
+
Baselines. We compare factuality tuning with inference-time intervention (Li et al., 2023, ITI) and decoding by contrasting layers (Chuang et al., 2023, DOLA), applied to the SFT model for each task. For ITI, we supervise the training of the linear probes with FactScore labels: we take batches of atomic facts extracted from the training samples and bias the models’ activations from the incorrect to correct atomic facts to determine the direction of the intervention. In the case of Llama-2, we also compare against ‘standard’ RLHF with human preference labels (Touvron et al., 2023b).
|
| 95 |
+
|
| 96 |
+
Evaluation. To evaluate each generated response, we follow the FactScore procedure to extract the number of correct and incorrect facts. Then, to check that the model responses are still relevant and helpful after actuality fine-tuning, we also use GPT-3.5 to determine whether each fact is relevant to the question or not (using the prompt in Appendix A.2). For biographies, we observed that essentially $100 \%$ of facts were relevant to the individual, so we skip the relevance computation to save costs. For each dataset, we report the number of correct and relevant facts (# Correct), the number of inaccuracies (# Incorrect), and the proportion of correct relevant facts out of the total number of extracted facts ( $\%$ Correct). Note that the total number of facts may vary between generations. We validate our evaluation metrics in Sec. A.1.
|
| 97 |
+
|
| 98 |
+
# 4.1 FINE-TUNING FOR FACTUALITY ACROSS DOMAINS
|
| 99 |
+
|
| 100 |
+
In this section, we apply our methodology for learning factuality to Llama-1-7b and Llama-2-7b in multiple domains. We show the results in Table 2. Learning from reference-based factualityscored pairs (FactTune-FS) consistently improves factual accuracy compared to RLHF models and decoding-based factuality baselines by at least $11 \%$ on biographies and $13 \%$ on medical questionanswering. FactTune-FS reduces the number of factual errors and maintains no more than a slight decrease, if not increase, in the amount of correct information generated. Factuality tuning from model-confidence scores (FactTune-MC, FactTune-EC) also reduces error rate and improves the factuality of RLHF models on both datasets, without any external reference information.
|
| 101 |
+
|
| 102 |
+
# 4.2 FINE-TUNING CHAT MODELS FOR FACTUALITY
|
| 103 |
+
|
| 104 |
+
Most widely used practical chatbots today are LMs trained with RLHF to follow diverse instructions in a way that is helpful to users. In this section, we investigate the ability of our human-free factuality tuning method to improve the factuality of RLHF chat models. Using Llama-2-7b-Chat, we find that fine-tuning an RLHF LM with both factuality and semantic entropy-based rewards can further improve its factuality without significantly decreasing the total number of facts, as shown in Table 3.
|
| 105 |
+
|
| 106 |
+
Table 2: Factuality tuning from reference-based factuality-scored pairs (FactTune-FS) improves factual accuracy compared to RLHF models and decoding-based factuality baselines, consistently reducing the number of errors and often increasing the number of correct facts generated. Factuality tuning from model confidence scored pairs (FactTune-MC, FactTune-EC) also outperforms RLHF models, providing a strong reference-free alternative for improving factuality and reducing error.
|
| 107 |
+
|
| 108 |
+
<table><tr><td></td><td></td><td colspan="3">Biographies</td><td colspan="3">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td># Correct</td><td># Incorrect</td><td>% Correct</td><td># Correct</td><td># Incorrect</td><td>% Correct</td></tr><tr><td rowspan="6">Llama-1</td><td>ITI</td><td>13.68</td><td>5.24</td><td>0.730</td><td>10.25</td><td>7.96</td><td>0.538</td></tr><tr><td>DOLA</td><td>12.44</td><td>4.74</td><td>0.737</td><td>9.22</td><td>5.58</td><td>0.640</td></tr><tr><td>SFT</td><td>13.54</td><td>6.54</td><td>0.696</td><td>9.96</td><td>6.86</td><td>0.600</td></tr><tr><td>FactTune-FS (Ours)</td><td>14.51</td><td>3.74</td><td>0.812</td><td>12.60</td><td>4.18</td><td>0.746</td></tr><tr><td>FactTune-MC (Ours)</td><td>9.74</td><td>2.42</td><td>0.819</td><td>11.51</td><td>5.56</td><td>0.668</td></tr><tr><td>FactTune-EC (Ours)</td><td>10.84</td><td>3.28</td><td>0.790</td><td>11.52</td><td>6.56</td><td>0.641</td></tr><tr><td rowspan="7">Llama-2</td><td>ITI</td><td>13.30</td><td>5.56</td><td>0.712</td><td>9.40</td><td>4.25</td><td>0.690</td></tr><tr><td>DOLA</td><td>13.25</td><td>6.50</td><td>0.684</td><td>9.87</td><td>6.06</td><td>0.627</td></tr><tr><td>Chat</td><td>21.41</td><td>6.30</td><td>0.774</td><td>9.61</td><td>6.69</td><td>0.619</td></tr><tr><td>SFT</td><td>13.47</td><td>6.49</td><td>0.687</td><td>10.68</td><td>6.22</td><td>0.627</td></tr><tr><td>FactTune-FS (Ours)</td><td>19.32</td><td>2.76</td><td>0.880</td><td>13.29</td><td>2.97</td><td>0.809</td></tr><tr><td>FactTune-MC (Ours)</td><td>11.74</td><td>3.51</td><td>0.783</td><td>12.94</td><td>5.26</td><td>0.706</td></tr><tr><td>FactTune-EC (Ours)</td><td>12.68</td><td>3.69</td><td>0.797</td><td>12.80</td><td>5.19</td><td>0.710</td></tr></table>
|
| 109 |
+
|
| 110 |
+
<table><tr><td></td><td></td><td colspan="3">Biographies</td><td colspan="3">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td># Correct</td><td># Incorrect</td><td>% Correct</td><td># Correct</td><td># Incorrect</td><td>% Correct</td></tr><tr><td></td><td></td><td>21.41</td><td>6.30</td><td>0.774</td><td>9.61</td><td>6.69</td><td>0.619</td></tr><tr><td></td><td>DOLA</td><td>22.25</td><td>5.81</td><td>0.793</td><td>11.45</td><td>6.74</td><td>0.624</td></tr><tr><td>Llama-2-Chat</td><td>FactTune-FS (Ours)</td><td>20.02</td><td>4.38</td><td>0.821</td><td>11.94</td><td>6.21</td><td>0.667</td></tr><tr><td></td><td>FactTune-MC (Ours)</td><td>19.12</td><td>4.97</td><td>0.795</td><td>12.61</td><td>7.21</td><td>0.627</td></tr><tr><td></td><td>FactTune-EC (Ours)</td><td>18.77</td><td>5.13</td><td>0.784</td><td>11.51</td><td>6.40</td><td>0.639</td></tr><tr><td></td><td>OOD FactTune-FS (ours)</td><td>21.06</td><td>5.45</td><td>0.796</td><td>11.56</td><td>6.66</td><td>0.635</td></tr></table>
|
| 111 |
+
|
| 112 |
+
Table 3: Factuality tuning a dialogue model (Llama-2-Chat) with FactScore, model confidence-based truthfulness estimation, and FactScore-based preferences from a different dataset (FactTune-FS, FactTune-MC, OOD FactTune-FS) further improves its factual accuracy more than a baseline method for factuality, DOLA.
|
| 113 |
+
|
| 114 |
+
# In other words, factuality tuning can be composed with RLHF to further improve the factuality of chat models.
|
| 115 |
+
|
| 116 |
+
While our quantitative metrics demonstrate a clear increase in factual accuracy, we also investigate how factuality fine-tuning impacts other aspects of model performance and generalizes. Using GPT4 as a judge, we find that FactTune-MC and FactTune-EC can improve both factuality and fluency compared to the SFT model (examples in Appendix Table 8). GPT-4 chooses FactTuneEC as more fluent than SFT on $80 \%$ of samples, FactTune-MC on $7 5 \%$ of samples, ITI on $57 \%$ of samples, FactTune-FS on $33 \%$ of samples, and DOLA on $16 \%$ of samples $\scriptstyle ( \mathrm { n = 1 0 0 }$ ).
|
| 117 |
+
|
| 118 |
+
Lastly, we find that fine-tuning for factuality generalizes across datasets. Fine-tuning Llama-2- 7b-Chat on biographies to evaluate on MedicalQA and vice versa (OOD FactTune-FS) improves the factuality more than RLHF (Table 3).
|
| 119 |
+
|
| 120 |
+
4.3 COMPLEMENTARY BENEFITS OF FACTUALITY TUNING AND DECODING-TIME FACTUALITY INTERVENTIONS
|
| 121 |
+
|
| 122 |
+
Besides fine-tuning for factuality, multiple existing works aim to improve LLM factuality through inference time interventions to either the decoding process or the model parameters themselves. We explore the possibility of applying both of these types of methods together, i.e., using factualityboosting decoding methods on a model fine-tuned with our factuality tuning procedure. In Table 4 we present the results of stacking both approaches. We find that in most cases, DOLA can even further increase the accuracy of factuality fine-tuned models, with one exception for Llama-2 on the biography task. While not a comprehensive evaluation of combining methods for improving factuality, this result suggests that different approaches to enhancing factuality may operate through complementary mechanisms.
|
| 123 |
+
|
| 124 |
+
Table 4: DOLA factuality decoding frequently composes with factuality fine-tuning, providing an increase in average correctness for the majority of combinations of model and dataset.
|
| 125 |
+
|
| 126 |
+
<table><tr><td></td><td></td><td colspan="3">Biographies</td><td colspan="3">Medical QA</td></tr><tr><td>Base Model</td><td>Method</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td></tr><tr><td rowspan="2">Llama-1</td><td></td><td></td><td>3.74</td><td></td><td>12.0</td><td>418</td><td>0.746</td></tr><tr><td>FactTune-FS + DOLA</td><td>1451</td><td></td><td>0.812</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Llama-2</td><td></td><td>19.32</td><td>2.76</td><td>0.880</td><td>13.29</td><td></td><td></td></tr><tr><td>FactTune-FS + DOLA</td><td></td><td></td><td></td><td></td><td>2.7</td><td>0.89</td></tr></table>
|
| 127 |
+
|
| 128 |
+
<table><tr><td></td><td></td><td></td><td colspan="3">Biographies</td><td colspan="3">Medical QA</td></tr><tr><td>Fact Ext.</td><td>Equiv</td><td>Metric</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td><td>#Correct</td><td>#Incorrect</td><td>%Correct</td></tr><tr><td rowspan="2">Atomic</td><td rowspan="2">Heuristic</td><td>Max Con Conf</td><td>9.74</td><td>22</td><td></td><td></td><td>5.56</td><td>0.668</td></tr><tr><td></td><td></td><td></td><td>0.819</td><td>11.51</td><td></td><td></td></tr><tr><td rowspan="2">Entity</td><td rowspan="2">Heuristic</td><td></td><td>12.2</td><td></td><td>0.74</td><td>10.3</td><td></td><td></td></tr><tr><td>Mx Co Conf</td><td></td><td>4.74</td><td></td><td></td><td>64</td><td>0.603</td></tr></table>
|
| 129 |
+
|
| 130 |
+
Table 5: On Llama-1, model confidence-based preference construction with atomic question extraction outperforms the version with entity extraction.
|
| 131 |
+
|
| 132 |
+
# 4.4 IMPACT OF DESIGN DECISIONS OF OPEN-ENDED MODEL CONFIDENCE SCORING
|
| 133 |
+
|
| 134 |
+
This section discusses the impacts of different design choices for the steps of our reference-free truthfulness score construction for factuality tuning: how to perform fact extraction and what confidence metric to use.
|
| 135 |
+
|
| 136 |
+
The first step is to extract the individual facts from the long-form response and re-sample each fact from the base model to assess the model’s confidence in the fact. For the fact-extraction and resampling procedure, one approach (Atomic) is to convert each extracted atomic fact into a corresponding ‘atomic question’ with a few-shot prompt query to GPT-3.5, then sample answers to each question from the base LLM. Another approach (Entity) extracts entities from the response via nltk and re-samples the extracted entity in-line. Atomic question extraction has the potential to be more comprehensive and precise, while named entity extraction is a less expensive proxy that doesn’t use closed models. In Table 5, we observe that atomic question extraction outperforms named entity extraction, although the difference in accuracy is smaller on Medical QA than on Biographies.
|
| 137 |
+
|
| 138 |
+
After re-sampling the fact, we study the choice of confidence metric between taking the model’s confidence based on the most common sample (Max Conf) or the confidence of the fact from the original response (Expected Conf). To compute Max Conf for both atomic and entity extraction, we bin the samples into equivalence classes of distinct responses using a string matching heuristic described in Section 3.2 and take the proportion of samples in the largest bin. For computing Expected Confidence, we first perform the same answer binning procedure as for Max Confidence, resulting in $k$ bins and confidences $p _ { 1 } , \ldots , p _ { k }$ , and take $\textstyle E C = \sum _ { i = 1 } ^ { k } p _ { i } ^ { 2 }$ . The results in Table 5 show that the performance of Max Conf versus Expected Conf varies but are quite similar.
|
| 139 |
+
|
| 140 |
+
# 5 RELATED WORK
|
| 141 |
+
|
| 142 |
+
Many works have identified reducing factual errors (sometimes called ‘hallucinations’) as a key challenge for building more reliable language models (Lewis et al., 2020; Kadavath et al., 2022; Zhang et al., 2023), even for the most powerful language models (Bubeck et al., 2023). Other use of the term ‘hallucination’ refers to summarization or translation system outputs not supported by the reference text (Maynez et al., 2020; Zhang et al., 2020) even if they are factual (Cao et al., 2022). Other work uses ‘hallucination’ to describe vision-language models producing outputs not grounded in a visual input, e.g., a captioning system describing an object that doesn’t exist in the image (Rohrbach et al., 2018). In our case, we focus on statements that are factually incorrect (or, inconsistent with a set of ‘authoritative’ texts, such as Wikipedia).
|
| 143 |
+
|
| 144 |
+
Several works describe methods for detecting likely factual errors through sensitivity to perturbations in the prompt (Xu et al., 2023), high diversity of responses under resampling (Kadavath et al., 2022; Mundler et al. ¨ , 2023; Kuhn et al., 2023; Manakul et al., 2023), or inconsistency with external knowledge sources (Min et al., 2023; Chern et al., 2023), or properties of internal activations (Azaria & Mitchell, 2023). Others go beyond detecting errors, correcting them after they have been generated (Peng et al., 2023; Gao et al., 2023; Dhuliawala et al., 2023). These approaches typically rely on retrieving relevant data from a trusted knowledge base and use another LLM to verify consistency; however, retrieval-based methods face key challenges, namely reliable resolution of conflicts between parametric and retrieved knowledge (Longpre et al., 2022; Chen et al., 2022) as well as maintaining improvements in factuality as model size increases (Mallen et al., 2023). Further, retrieval-based methods add significant system complexity; the most common open-source consumer language models thus use purely parametric models (Touvron et al., 2023a). The FactScore variant of our approach uses retrieval only during training, avoiding inference time complexity. In principle, any existing criterion could be used to generate preferences (see ;¸ we aim to show that even choosing relatively simple criteria leads to substantial improvements in factuality.
|
| 145 |
+
|
| 146 |
+
Most similar to ours, some approaches attempt to prevent the generation of factual errors in the first place, using prompting strategies (Si et al., 2023) or perturbing the internal representations of the model (Chuang et al., 2023; Li et al., 2023). Unlike using a fixed heuristic for identifying an internal ‘factuality’ dimension, we optimize directly for the end goal of generating factual statements, which we find shows a greater improvement in factuality. Finally, while most past work has focused on short-form NLG tasks like short-form question-answering (Kadavath et al., 2022), we explore ways to measure model confidence over factual information in long-form, unstructured text and estimate truthfulness in a reference-free manner (i.e., don’t require any external knowledge base or annotations).
|
| 147 |
+
|
| 148 |
+
# 6 CONCLUSION
|
| 149 |
+
|
| 150 |
+
In this paper, we show a practical, effective strategy to improve a language model’s ability to generate factual content, specifically focusing on long-form generations. We develop and study two different approaches to estimating the truthfulness of long-form text and optimize for these criteria using preference-based learning. In addition to existing reference-based truthfulness estimators that leverage external knowledge to establish the truth of a particular statement, we introduce a novel reference-free procedure for estimating truthfulness that uses the language model’s own uncertainty as an indication of factuality. Our experiments show that fine-tuning a language model with either criterion reliably reduces the number of incorrect facts (i.e. hallucinations) that the model generates. Reference-free approaches like the one we introduced provide a scalable self-supervision strategy to improve factuality, eliminating the need for a reference corpus of ‘gold’ texts.
|
| 151 |
+
|
| 152 |
+
The experimental results suggest a number of avenues for future work. First, because of the limited research and thus the limited benchmarks on the factuality of long-form language model generations, we proposed two new tasks to benchmark our approach. These tasks are representative of but do not fully cover the range of scenarios where we would hope to improve factuality. Furthermore, our experiments provide evidence for improving the factuality of dialogue models that are already finetuned with RLHF, but still leave open the question of how best to combine typical RLHF rewards and approaches with factuality rankings. Similarly, exploring additional ways to combine factuality tuning with existing methods for improving factuality, such as in our factuality tuning $+ { \mathrm { ~ D O L A } }$ experiment, may be a fruitful direction for future research. Further, future work might explore alternative approaches to constructing factuality preferences, such as using self-correction (Pan et al., 2023). Finally, we explore only 7B models in this work. Scaling up our factuality tuning recipe to larger models (and larger preference datasets) may reduce hallucinations even further.
|
| 153 |
+
|
| 154 |
+
# ACKNOWLEDGEMENTS
|
| 155 |
+
|
| 156 |
+
EM gratefully acknowledges funding from a Knight-Hennessy graduate fellowship and a Stanford Accelerator for Generative AI and Education grant. CF and CDM are CIFAR Fellows.
|
| 157 |
+
|
| 158 |
+
Reproducibility Statement. We explain the steps of our fine-tuning method in Section 3. In Section 4.1, we provide details on the dataset (dataset statistics, how it was generated, and examples), as well as how the evaluation is completed and how we implemented the baselines. In the experiment subsections and captions, we provide additional implementation or reporting details. In the appendix, we provide the exact GPT-3.5 prompts used for the extraction steps of our reference-free scoring method. A codebase with instructions for factuality scoring, training, and evaluation can be found here: https://github.com/kttian/llm_factuality_tuning.
|
| 159 |
+
|
| 160 |
+
# REFERENCES
|
| 161 |
+
|
| 162 |
+
Ayush Agrawal, Mirac Suzgun, Lester Mackey, and Adam Tauman Kalai. Do language models know when they’re hallucinating references?, 2023. arXiv preprint arxiv:2305.18248. 1
|
| 163 |
+
|
| 164 |
+
Amos Azaria and Tom Mitchell. The internal state of an LLM knows when its lying, 2023. arXiv preprint arxiv:2304.13734. 9
|
| 165 |
+
|
| 166 |
+
Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback, 2022. arXiv preprint arxiv:2204.05862. 3
|
| 167 |
+
|
| 168 |
+
Ralph Allan Bradley and Milton E Terry. Rank analysis of incomplete block designs: I. the method of paired comparisons. Biometrika, 39(3/4):324–345, 1952. 3
|
| 169 |
+
|
| 170 |
+
Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece ´ Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with GPT-4, 2023. arXiv preprint arxiv:2303.12712. 8
|
| 171 |
+
|
| 172 |
+
Meng Cao, Yue Dong, and Jackie Cheung. Hallucinated but factual! inspecting the factuality of hallucinations in abstractive summarization. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3340–3354, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long. 236. URL https://aclanthology.org/2022.acl-long.236. 8
|
| 173 |
+
|
| 174 |
+
Hung-Ting Chen, Michael Zhang, and Eunsol Choi. Rich knowledge sources bring complex knowledge conflicts: Recalibrating models to reflect conflicting evidence. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 2292–2307, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.emnlp-main.146. URL https://aclanthology.org/2022. emnlp-main.146. 9
|
| 175 |
+
|
| 176 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde, Jared Kaplan, Harrison Edwards, Yura Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, David W. Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William H. Guss, Alex Nichol, Igor Babuschkin, S. Arun Balaji, Shantanu Jain, Andrew Carr, Jan Leike, Joshua Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew M. Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. ArXiv, abs/2107.03374, 2021. URL https://api.semanticscholar.org/CorpusID:235755472. 1
|
| 177 |
+
|
| 178 |
+
I-Chun Chern, Steffi Chern, Shiqi Chen, Weizhe Yuan, Kehua Feng, Chunting Zhou, Junxian He, Graham Neubig, and Pengfei Liu. FacTool: Factuality detection in generative ai – a tool augmented framework for multi-task and multi-domain scenarios, 2023. arXiv preprint arxiv:2307.13528. 2, 4, 9
|
| 179 |
+
|
| 180 |
+
Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_files/paper/2017/ file/d5e2c0adad503c91f91df240d0cd4e49-Paper.pdf. 1
|
| 181 |
+
|
| 182 |
+
Yung-Sung Chuang, Yujia Xie, Hongyin Luo, Yoon Kim, James Glass, and Pengcheng He. DoLa: Decoding by contrasting layers improves factuality in large language models, 2023. arXiv preprint arxiv:2309.03883. 6, 9
|
| 183 |
+
|
| 184 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instruction-finetuned language models, 2022. 1 Shehzaad Dhuliawala, Mojtaba Komeili, Jing Xu, Roberta Raileanu, Xian Li, Asli Celikyilmaz, and Jason Weston. Chain-of-verification reduces hallucination in large language models, 2023. 9 Leo Gao, John Schulman, and Jacob Hilton. Scaling laws for reward model overoptimization, 2022.
|
| 185 |
+
3, 14 Luyu Gao, Zhuyun Dai, Panupong Pasupat, Anthony Chen, Arun Tejasvi Chaganty, Yicheng Fan, Vincent Y. Zhao, Ni Lao, Hongrae Lee, Da-Cheng Juan, and Kelvin Guu. Rarr: Researching and revising what language models say, using language models, 2023. 9 Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, Scott Johnston, Sheer El-Showk, Andy Jones, Nelson Elhage, Tristan Hume, Anna Chen, Yuntao Bai, Sam Bowman, Stanislav Fort, Deep Ganguli, Danny Hernandez, Josh Jacobson, Jackson Kernion, Shauna Kravec, Liane Lovitt, Kamal Ndousse, Catherine Olsson, Sam Ringer, Dario Amodei, Tom Brown, Jack Clark, Nicholas Joseph, Ben Mann, Sam McCandlish, Chris Olah, and Jared Kaplan. Language models (mostly) know what they know, 2022. URL http://arxiv.org/ abs/2207.05221. Arxiv arxiv:2207.05221. 1, 4, 8, 9 Lorenz Kuhn, Yarin Gal, and Sebastian Farquhar. Semantic uncertainty: Linguistic invariances for uncertainty estimation in natural language generation, 2023. 2, 5, 8 Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rockt ¨ aschel, Sebastian Riedel, ¨ and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 9459–9474. Curran Associates, Inc.,
|
| 186 |
+
2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/ file/6b493230205f780e1bc26945df7481e5-Paper.pdf. 8 Kenneth Li, Oam Patel, Fernanda Viegas, Hanspeter Pfister, and Martin Wattenberg. Inference-time ´ intervention: Eliciting truthful answers from a language model, 2023. 6, 9 Shayne Longpre, Kartik Perisetla, Anthony Chen, Nikhil Ramesh, Chris DuBois, and Sameer Singh. Entity-based knowledge conflicts in question answering, 2022. 9 Ximing Lu, Sean Welleck, Jack Hessel, Liwei Jiang, Lianhui Qin, Peter West, Prithviraj Ammanabrolu, and Yejin Choi. QUARK: Controllable text generation with reinforced unlearning. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=
|
| 187 |
+
5HaIds3ux5O. 3 Bill MacCartney and Christopher D. Manning. Modeling semantic containment and exclusion in natural language inference. In Proceedings of the 22nd International Conference on Computational Linguistics (Coling 2008), pp. 521–528, Manchester, UK, August 2008. Coling 2008 Organizing Committee. URL http://www.aclweb.org/anthology/C08-1066. 4 Alex Mallen, Akari Asai, Victor Zhong, Rajarshi Das, Daniel Khashabi, and Hannaneh Hajishirzi. When not to trust language models: Investigating effectiveness of parametric and non-parametric memories. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 9802–9822, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.546. URL https://aclanthology.org/2023.acl-long.546. 9
|
| 188 |
+
Potsawee Manakul, Adian Liusie, and Mark J. F. Gales. Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models, 2023. 8
|
| 189 |
+
Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 1906–1919, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.173. URL https://aclanthology.org/ 2020.acl-main.173. 8
|
| 190 |
+
Sewon Min, Kalpesh Krishna, Xinxi Lyu, Mike Lewis, Wen tau Yih, Pang Wei Koh, Mohit Iyyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. Factscore: Fine-grained atomic evaluation of factual precision in long form text generation, 2023. 2, 4, 9, 14
|
| 191 |
+
Niels Mundler, Jingxuan He, Slobodan Jenko, and Martin Vechev. Self-contradictory hallucinations ¨ of large language models: Evaluation, detection and mitigation, 2023. 8
|
| 192 |
+
Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback, 2022. 1, 3
|
| 193 |
+
Liangming Pan, Michael Saxon, Wenda Xu, Deepak Nathani, Xinyi Wang, and William Yang Wang. Automatically correcting large language models: Surveying the landscape of diverse selfcorrection strategies, 2023. 9
|
| 194 |
+
Baolin Peng, Michel Galley, Pengcheng He, Hao Cheng, Yujia Xie, Yu Hu, Qiuyuan Huang, Lars Liden, Zhou Yu, Weizhu Chen, and Jianfeng Gao. Check your facts and try again: Improving large language models with external knowledge and automated feedback, 2023. 9
|
| 195 |
+
Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model, 2023. 2, 3
|
| 196 |
+
Rajkumar Ramamurthy, Prithviraj Ammanabrolu, Kiante Brantley, Jack Hessel, Rafet Sifa, Chris- ´ tian Bauckhage, Hannaneh Hajishirzi, and Yejin Choi. Is reinforcement learning (not) for natural language processing: Benchmarks, baselines, and building blocks for natural language policy optimization. In International Conference on Learning Representations (ICLR 2023), 2022. URL https://arxiv.org/abs/2210.01241. 3
|
| 197 |
+
Anna Rohrbach, Lisa Anne Hendricks, Kaylee Burns, Trevor Darrell, and Kate Saenko. Object hallucination in image captioning. In Ellen Riloff, David Chiang, Julia Hockenmaier, and Jun’ichi Tsujii (eds.), Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 4035–4045, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1437. URL https://aclanthology.org/ D18-1437. 8
|
| 198 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms, 2017. 3
|
| 199 |
+
Chenglei Si, Zhe Gan, Zhengyuan Yang, Shuohang Wang, Jianfeng Wang, Jordan Boyd-Graber, and Lijuan Wang. Prompting gpt-3 to be reliable, 2023. 9
|
| 200 |
+
Nisan Stiennon, Long Ouyang, Jeff Wu, Daniel M. Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul Christiano. Learning to summarize from human feedback. Neural Information Processing Systems, 18, 2020. 3
|
| 201 |
+
Katherine Tian, Eric Mitchell, Allan Zhou, Archit Sharma, Rafael Rafailov, Huaxiu Yao, Chelsea Finn, and Christopher D. Manning. Just ask for calibration: Strategies for eliciting calibrated confidence scores from language models fine-tuned with human feedback, 2023. 1, 4
|
| 202 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee´ Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Ar- \` mand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models, 2023a. 1, 4, 9
|
| 203 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023b. 1, 6
|
| 204 |
+
Weijia Xu, Sweta Agrawal, Eleftheria Briakou, Marianna J. Martindale, and Marine Carpuat. Understanding and Detecting Hallucinations in Neural Machine Translation via Model Introspection. Transactions of the Association for Computational Linguistics, 11:546–564, 06 2023. ISSN 2307- 387X. doi: 10.1162/tacl a 00563. URL https://doi.org/10.1162/tacl_a_00563. 8
|
| 205 |
+
Muru Zhang, Ofir Press, William Merrill, Alisa Liu, and Noah A Smith. How language model hallucinations can snowball. arXiv preprint arXiv:2305.13534, 2023. 8
|
| 206 |
+
Yuhao Zhang, Derek Merck, Emily Tsai, Christopher D Manning, and Curtis Langlotz. Optimizing the factual correctness of a summary: A study of summarizing radiology reports. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL), 2020. URL https://arxiv.org/pdf/1911.02541.pdf. 8
|
| 207 |
+
Rui Zheng, Shihan Dou, Songyang Gao, Yuan Hua, Wei Shen, Binghai Wang, Yan Liu, Senjie Jin, Qin Liu, Yuhao Zhou, Limao Xiong, Lu Chen, Zhiheng Xi, Nuo Xu, Wenbin Lai, Minghao Zhu, Cheng Chang, Zhangyue Yin, Rongxiang Weng, Wensen Cheng, Haoran Huang, Tianxiang Sun, Hang Yan, Tao Gui, Qi Zhang, Xipeng Qiu, and Xuanjing Huang. Secrets of RLHF in large language models part I: PPO, 2023. 3
|
| 208 |
+
Daniel M. Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B. Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences, 2020. 1
|
| 209 |
+
|
| 210 |
+
<table><tr><td>Dataset</td><td>Evaluation</td><td>SFT</td><td>FactTune-FS</td></tr><tr><td>Biographies</td><td>Human</td><td>0.582</td><td>0.846</td></tr><tr><td>Biographies</td><td>FactScore</td><td>0.669</td><td>0.921</td></tr><tr><td>MedQA</td><td>Human</td><td>0.662</td><td>0.838</td></tr><tr><td>MedQA</td><td>FactScore</td><td>0.534</td><td>0.806</td></tr></table>
|
| 211 |
+
|
| 212 |
+
Table 6: To validate that our models do not suffer from extreme reward overoptimization, we conduct a human evaluation of the Llama-1-7b SFT and FactTune-FS models and find that an increase in FactScore also corresponds to a large increase in human-annotated accuracy. This study is computed on a subset of 25 generations per model.
|
| 213 |
+
|
| 214 |
+

|
| 215 |
+
Figure 4: Average FactScore error counts and GPT-4 error counts are highly correlated, suggesting that the resulting models do not suffer from extreme reward overoptimization (Gao et al., 2022). We plot average FactScore error count v.s. average GPT-4 error count, scaling each dataset by the max GPT-4 error count in that dataset.
|
| 216 |
+
|
| 217 |
+
# A APPENDIX
|
| 218 |
+
|
| 219 |
+
# A.1 VALIDATING METRICS FOR FACTUALITY
|
| 220 |
+
|
| 221 |
+
Our experiments primarily use counts of correct and incorrect facts computed by FactScore as the main evaluation metrics, as FactScore is automated and has been shown to exhibit good agreement with human fact-checkers (Min et al., 2023). Nonetheless, we aim to verify that our results are not specific or overfit to the FactScore criterion. In this section, we provide an evaluation with (1) human evaluators hired through Prolific.co2 and (2) GPT-4.
|
| 222 |
+
|
| 223 |
+
To acquire human fact-checking results, we provide each human evaluator with a prompt, a generated response, and the title of the Wikipedia article they should use for fact-checking the response. We ask the human study participants to count the total number of facts and the number of incorrect facts in the response, and we divide these to obtain the human-rated accuracy. We provide the results in Table 6, where on average humans rated our FactTune-FS model for both datasets significantly higher than the SFT model.
|
| 224 |
+
|
| 225 |
+
Further, we ask GPT-4 to evaluate the factuality of a given response by counting the number of factual errors. We observe that the GPT-4 model ratings and FactScore model ratings are highly correlated, and GPT-4 provides another evaluation metric that demonstrates that FactTune-FS significantly reduces average error compared to the SFT models on both datasets (see Figure 4). Taken together, these results suggest that the improvements in factuality are not the result of exploitation of our evaluation protocol.
|
| 226 |
+
|
| 227 |
+
# A.2 PROMPTS
|
| 228 |
+
|
| 229 |
+
Table 7 contains the prompts used with GPT-3.5 to convert statements into questions for model confidence-based truthfulness estimation.
|
| 230 |
+
|
| 231 |
+
# A.3 SAMPLE MODEL GENERATIONS
|
| 232 |
+
|
| 233 |
+
See Table 8 for samples generated by several different models. After factuality tuning, the model does produce somewhat terser responses.
|
| 234 |
+
|
| 235 |
+
Table 7: GPT-3.5 prompts used to convert atomic facts into questions.
|
| 236 |
+
|
| 237 |
+
<table><tr><td>Biography Atomic Fact to Question the key fact in the statement. For example: Statement: LeBron James is a professional basketball player. Question: What is LeBron James’profession? Statement: He is one of the best in the NBA. Question: Where does LeBron James rank among NBA players? Statement: James was born in Akron.</td><td>I will provide a statement containing one atomic fact related to Hillry Clinton or people around her. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement. For example: Statement:Hillary Clinton was born in 1947. Question: In what year was Hillary Clinton born? Statement: Hillary attended the Wellesley College. Question: What college did Hillary Clinton attend? Statement: She married Bill Clinton. Question: Who did Hillary Clinton marry? I will provide a statement containing one atomic fact related to LeBron James or people around him. Please rephrase the following statement into a specific question that testing knowledge of</td></tr><tr><td>Atomic Fact to Question derarm. the breast or underarm? the breast?</td><td>MedicalQA I will provide a statement containing one atomic fact about the medical condition menopause. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement.For example: Statement: Menopause is a time in a woman's life. Question: Menopause is a time in whose life? Statement: Menopause is the time when a woman no longer has menstrual periods. Question: Menopause is the time when a woman no longer has what? Statement: There is a decline in the ovarian hormone estrogen. Question: During menopause there is a decline in what? I will provide a statement containing one atomic fact about the medical condition breast cancer. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement. For example: Statement: The signs and symptoms include a lump or thickening in or near the breast or un- Question: Do the signs and symptoms of breast cancer include a lump or thickening in or near Statement: The signs and symptoms include a change in the size or shape of the breast. Question: Do the signs and symptoms of breast cancer include a change in the size or shape of I will provide a statement containing one atomic fact about the medical condition varicose veins. Please rephrase the following statement into a specific question testing knowledge of the key fact in the statement.For example:</td></tr></table>
|
| 238 |
+
|
| 239 |
+
<table><tr><td>SFT</td><td>Greta Gerwig is an American actress and filmmaker. She was born in and raised in Sacramento, California. Gerwig became interested in the film industry in 2OO2,when she attended the San Francisco Art Institute. She got her start in 2OO6,when she starred in the film‘The Off Hours'. Her other films include Frances Ha,Mistress America,and 2Oth Century Women. In 2018, Gerwig directed Lady Bird,and received wide acclaim,a Golden Globe and Tony nomination for directing,and Oscar and BAFTA nominations for the film.</td></tr><tr><td>FactTune-FS</td><td>Greta Gerwig is an American actress and filmmaker. Born in Sacramento, California in 1983, Gerwig started acting at a young age. She is best known for starring in films such as ‘Frances Ha’ and ‘Mistress America.’Gerwig was nominated for an Oscar for Best Actress for her per- formance in ‘Lady Bird.' Gerwig has writen and directed a number of acclaimed independent films,such as‘FrancesHa’and ‘Mistress America.'</td></tr><tr><td>FactTune-MC</td><td>Greta Gerwig is an American actress and flmmaker. She was born in 1983 in Sacramento, California,and raised in Stanford, California and New York City. Gerwig has appeared in such movies as Greenberg,Frances Ha,and Jackie.She also portrayed the title role in the 2013 film of Jackie Kennedy. Her directorial debut is the 2O12 movie,Lady Bird,which was nominated for the Academy Award for Best Picture.</td></tr></table>
|
| 240 |
+
|
| 241 |
+
Table 8: Samples for writing a biography of Greta Gerwig under the SFT, FactTune-FS, FactTune-MC Llama1-7b models.
|
md/test/aKkAwZB6JV/aKkAwZB6JV.md
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Zephyr: Direct Distillation of LM Alignment
|
| 2 |
+
|
| 3 |
+
Lewis Tunstall∗, Edward Beeching∗, Nathan Lambert, Nazneen Rajani, Kashif Rasul, Younes Belkada, Shengyi Huang, Leandro von Werra, Cl´ementine Fourrier, Nathan Habib, Nathan Sarrazin, Omar Sanseviero, Alexander M. Rush, and Thomas Wolf
|
| 4 |
+
|
| 5 |
+
Hugging Face lewis@huggingface.co
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
We aim to produce a smaller language model that is aligned to user intent. Previous research has shown that applying distilled supervised finetuning (dSFT) on larger models significantly improves task accuracy; however, these models are unaligned, i.e. they do not respond well to natural prompts. To distill this property, we experiment with the use of preference data from AI Feedback (AIF). Starting from a dataset of outputs ranked by a teacher model, we apply distilled direct preference optimization (dDPO) to learn a chat model with significantly improved intent alignment. The approach requires only a few hours of training without any additional sampling during fine-tuning. The final result, ZEPHYR-7B, set a new stateof-the-art on chat benchmarks for 7B parameter models, and requires no human annotation. In particular, results on MT-Bench show that ZEPHYR-7B surpasses LLAMA2-CHAT-70B, a strong open-access RLHF-based model.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Smaller, open large language models (LLMs) have greatly increased in ability in recent years, from early GPT-2-like models (Wang & Komatsuzaki, 2021) to accurate and compact models (Touvron et al., 2023; Penedo et al., 2023; Jiang et al., 2023) that are trained on significantly more tokens than the “compute-optimal” amount suggested by the Chincilla scaling laws (De Vries, 2023). In addition, researchers have shown that these models can be further trained through distilled supervised fine-tuning (dSFT) based on proprietary models to increase their accuracy (Taori et al., 2023). In this approach, the output of a more capable teacher model is used as supervised data for the student model.
|
| 14 |
+
|
| 15 |
+
Distillation has proven to be an effective tool for improving open models on a range of different tasks (Chiang et al., 2023); however, it does not reach the performance of the teacher models (Gudibande et al., 2023). Users have noted that these models are not “intent aligned”, i.e. they do not behave in a manner that aligns with human users’ preferences. This property often leads to outputs that do not provide correct responses to queries.
|
| 16 |
+
|
| 17 |
+
Intention alignment has been difficult to quantify, but recent work has led to the development of benchmarks like MT-Bench (Zheng et al., 2023) and AlpacaEval (Li et al., 2023) that specifically target this behavior. These benchmarks yield scores that correlate closely with human ratings of model outputs and confirm the qualitative intuition that proprietary models perform better than open models trained with human feedback, which in turn perform better than open models trained with distillation. This motivates careful collection of human feedback for alignment, often at enormous cost at scale, such as in LLAMA2-CHAT (Touvron et al., 2023).
|
| 18 |
+
|
| 19 |
+
In this work, we consider the problem of aligning a small open LLM entirely through distillation. The main step is to utilize AI Feedback (AIF) from an ensemble of teacher models as preference data, and apply distilled direct preference optimization as the learning objective (Rafailov et al., 2023). We refer to this approach as dDPO. Notably, it requires no human annotation and no sampling compared to using other approaches like proximal preference optimization (PPO) (Schulman et al., 2017). Moreover, by utilizing a small base LM, the resulting chat model can be trained in a matter of hours on 16 A100s (80GB).
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Model performance on MT-Bench. We compare ZEPHYR-7B, trained with distilled direct preference optimization (dDPO), to proprietary models as well as larger, open-access models like LLAMA2-CHAT-70B that were additionally trained using reinforcement learning on a large amount of human feedback.
|
| 23 |
+
|
| 24 |
+
To validate this approach, we construct ZEPHYR-7B, an aligned version of Mistral-7B (Jiang et al., 2023). We first use dSFT, based on the UltraChat (Ding et al., 2023) dataset. Next we use the AI feedback data collected in the UltraFeedback dataset (Cui et al., 2023). Finally, we apply dDPO based on this feedback data. Experiments show that this 7B parameter model can achieve performance comparable to 70B-parameter chat models aligned with human feedback. Results show improvements both in terms of standard academic benchmarks as well as benchmarks that take into account conversational capabilities. Analysis shows that the use of preference learning is critical in achieving these results.
|
| 25 |
+
|
| 26 |
+
# 2 Related Work
|
| 27 |
+
|
| 28 |
+
There has been significant growth in the number of open large language models (LLMs) that have served as artifacts for the research community to study and use as a starting model for building chatbots and other applications. After the release of ChatGPT, the LLaMA model (Touvron et al., 2023) opened the doors to a wide range of research on efficient finetuning, longer prompt context, retrieval augmented generation (RAG), and quantization. After LLaMA, there has been a continuous stream of open access text based LLMs including MosaicML’s MPT (ML, 2023), the Together AI’s RedPajama-INCITE (AI, 2023), the TII’s Falcon (Penedo et al., 2023), Meta’s Llama 2 (Touvron et al., 2023), and the Mistral 7B (Jiang et al., 2023). Zephyr uses Mistral 7B as the starting point due to its strong performance.
|
| 29 |
+
|
| 30 |
+
With the development of open models, researchers have worked on approaches to improve small model performance by distillation from larger models. This trend started with self-instruct method (Wang et al., 2023) and the Alpaca model (Taori et al., 2023), which was followed by Vicuna (Chiang et al., 2023) and other distilled models. These works primarily focused on distilling the SFT stage of alignment, whereas we focus on both SFT and preference optimization. Some models such as WizardLM (Xu et al.) have explored methods beyond dSFT. Contemporaneously with this work, Xwin-LM (Team, 2023) introduced an approach that distilled preference optimization through PPO (Schulman et al., 2017). We compare to these approaches in our experiments. Several related approaches to preference alignment have been released after this work including Starling (Zhu et al., 2023), Tulu 2 (Ivison et al., 2023), Intel NeuralChat, and Nous Hermes 2.
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 2: The three steps of our method: (1) large scale, self-instruct-style dataset construction (UltraChat), followed by distilled supervised fine-tuning (dSFT), (2) AI Feedback (AIF) collection via an ensemble of chat model completions, followed by scoring by GPT-4 (UltraFeedback) and binarization into preferences, and (3) distilled direct preference optimization (dPO) of the dSFT model utilizing the feedback data.
|
| 34 |
+
|
| 35 |
+
Tools for benchmarking and evaluating LLMs have greatly evolved to keep up with the pace of innovation in generative AI. Powerful LLMs such as GPT-4 and Claude are used as evaluators to judge model responses by scoring model outputs or ranking responses in a pairwise setting. The LMSYS chatbot arena benchmarks LLMs in anonymous, randomized battles using crowdsourcing (Zheng et al., 2023). The models are ranked based on their Elo ratings on the leaderboard. AlpacaEval is an example of another such leaderboard that compares models in a pairwise setting but instead uses bigger LLMs such as GPT-4 and Claude in place of humans (Dubois et al., 2023). In a similar spirit, MTBench uses GPT-4 to score model responses on a scale of 1-10 for multi-turn instructions across task categories such as reasoning, roleplay, math, coding, writing, humanities, STEM and extraction (Zheng et al., 2023). The HuggingFace Open LLM leaderbaord (Beeching et al., 2023), the Chainof-Thought Hub (Fu et al., 2023), ChatEval (Sedoc et al., 2019), and FastEval (fas, 2023) are examples of other tools for evaluating chatty models. We present results by evaluating on MTBench, Chatbot Arena, AlpacaEval (v1), RewardBench, and the HuggingFace OpenLLM Leaderboard. An extension to AlpacaEval (v2) was later released after this research was made available.
|
| 36 |
+
|
| 37 |
+
# 3 Method
|
| 38 |
+
|
| 39 |
+
The goal of this work is to align an open-source large-language model to the intent of the user. Throughout the work we assume access to a larger teacher model $\pi _ { \mathrm { T } }$ which can be queried by prompted generation. Our goal is to produce a student model $\pi _ { \theta }$ and our approach follows similar stages as InstructGPT (Ouyang et al., 2022) as shown in Figure 2.
|
| 40 |
+
|
| 41 |
+
Distilled Supervised Fine-Tuning (dSFT) Starting with a raw LLM, we first need to train it to respond to user prompts. This step is traditionally done through supervised fine tuning (SFT) on a dataset of high-quality instructions and responses (Chung et al., 2022; Sanh et al., 2021). Given access to teacher language models, we can instead have the model generate instructions and responses (Taori et al., 2023), and train the model directly on these. We refer to this as distilled SFT (dSFT).
|
| 42 |
+
|
| 43 |
+
Approaches to dSFT follow the self-instruct protocol (Wang et al., 2023). Let $x _ { 1 } ^ { 0 } , \ldots , x _ { J } ^ { 0 }$ be a set of seed prompts, constructed to represent a diverse set of topical domains. A dataset is constructed through iterative self-prompting where the teacher is used to both respond to an instruction and refine the instruction based on the response. For each $x ^ { 0 }$ , we first sample response $y ^ { 0 } \sim \pi _ { \mathrm { T } } ( \cdot | x ^ { 0 } ) .$ , and then refine by sampling a new instruction (using a prompt for refinement), $x ^ { 1 } \sim \pi _ { \mathrm { T } } ( \cdot | x ^ { 0 } , y ^ { 0 } )$ . The end point is a final dataset, $\mathcal { C } = \{ ( x _ { 1 } , y _ { 1 } ) , \ldots , ( x _ { J } , y _ { J } ) \}$ . Distillation is performed by SFT,
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\pi _ { \mathrm { d S F T } } = \underset { \pi } { \operatorname* { m a x } } \ \underset { ( x , y ) \sim \mathcal { C } } { \mathbb { E } } \log \pi ( y | x )
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
AI Feedback through Preferences (AIF) Human feedback (HF) can provide additional signal to align LLMs. Human feedback is typically given through preferences on the quality of LLM responses (Ouyang et al., 2022). For distillation, we instead use AI preferences from the teacher model on generated outputs from other models.
|
| 50 |
+
|
| 51 |
+
We follow the approach of UltraFeedback (Cui et al., 2023) which uses the teacher to provide preferences on model outputs. As with SFT, the system starts with a set of prompts $x _ { 1 } , \ldots , x _ { J }$ . Each prompt $x$ is fed to a collection of four models $\pi _ { 1 } , \ldots , \pi _ { 4 } ,$ e.g. Claude, Falcon, Llama, etc, each of which yield a response $y ^ { 1 } \sim \pi _ { 1 } ( \cdot | x ) , \ldots , y ^ { 4 } \sim \pi _ { 4 } ( \cdot | x )$ . These responses are then fed to the teacher model, e.g. GPT-4, which gives a score for the response $s ^ { 1 } \stackrel { \cdot } { \sim } \pi _ { T } ( \cdot | x , y ^ { 1 } ) , \ldots , s ^ { 4 } \sim \pi _ { T } ( \cdot | x , y ^ { 4 } )$ . After collecting the scores for a prompt $x ,$ we save the highest scoring response as $y _ { w }$ and a random lower scoring prompt as $y _ { l }$ . The final feedback dataset $\mathcal { D }$ consists of a set of these triples $\left( x , y _ { w } , y _ { l } \right)$ .
|
| 52 |
+
|
| 53 |
+
Distilled Direct Preference Optimization (dDPO) The goal of the final step is to refine the $\pi _ { \mathrm { d S F T } }$ by maximizing the likelihood of ranking the preferred $y _ { w }$ over $y _ { l }$ in a preference model. The preference model is determined by a reward function $\dot { \boldsymbol { r } } _ { \theta } ( x , y )$ which utilizes the student language model $\pi _ { \theta }$ . Past work using AI feedback has primarily focused on using RL methods such as proximal policy optimization (PPO) to optimize $\theta$ with respect to this reward. These approaches optimize $\theta$ by first training the reward and then sampling from the current policy to compute updates.
|
| 54 |
+
|
| 55 |
+
Direct preference optimization (DPO) uses a simpler approach to directly optimize the preference model from the static data (Rafailov et al., 2023). The key observation is to derive the optimal reward function in terms of the optimal LLM policy $\pi ^ { * }$ and the original LLM policy $\pi _ { \mathrm { d S F T } }$ . Under an appropriate choice of preference model they show, for a hyperparameter $\beta ,$ which determines closeness to the original policy, and partition function $\dot { Z }$ that,
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
r ^ { * } ( x , y ) = \beta \frac { \pi ^ { * } ( y | x ) } { \pi _ { \mathrm { d S F T } } ( y | x ) } + \beta \log Z ( x )
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
By plugging this function of the reward into the preference model, the authors show that the objective can be written as,
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\pi _ { \theta } = \operatorname* { m a x } _ { \pi } \underset { ( x , y _ { w } , y _ { l } ) \sim \mathcal { D } } { \mathbb { E } } \log \sigma \left( \beta \log \frac { \pi ( y _ { w } | x ) } { \pi _ { \mathrm { d S F T } } ( y _ { w } | x ) } - \beta \log \frac { \pi ( y _ { l } | x ) } { \pi _ { \mathrm { d S F T } } ( y _ { l } | x ) } \right) .
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
While this term looks complex, we note that it implies a simple training procedure. Starting with the dSFT version of the model, we iterate through each AIF triple $\hat { ( } x , y _ { w } , y _ { l } )$ .
|
| 68 |
+
|
| 69 |
+
1. Compute the probability for $\left( x , y _ { w } \right)$ and $\left( x , y _ { l } \right)$ from the dSFT model (forward-only).
|
| 70 |
+
2. Compute the probability for $\left( x , y _ { w } \right)$ and $\left( x , y _ { l } \right)$ from the dDPO model.
|
| 71 |
+
3. Compute $\operatorname { E q } 1$ and backpropagate to update $\pi$ . Repeat.
|
| 72 |
+
|
| 73 |
+
# 4 Experimental Details
|
| 74 |
+
|
| 75 |
+
We conduct all of our fine-tuning experiments using Mistral 7B (Jiang et al., 2023), which was the current state-of-the-art base LM at the 7B parameter scale, and matches the performance of much larger models like Llama-34B on many NLP benchmarks. We use the Transformer Reinforcement Learning (TRL) library for fine-tuning (von Werra et al., 2020), in conjunction with DeepSpeed ZeRO-3 (Rajbhandari et al., 2020) and FlashAttention-2 (Dao, 2023) to optimize memory and improve training speed. We also use Weights and Biases (Biewald, 2020) for experiment tracking. All dSFT models are trained with the AdamW optimizer, while dDPO models are trained with RMSProp to match the original implementation1 by the DPO authors. No weight decay is used during training. We did not experiment with parameter-efficient techniques such as LoRA (Hu et al., 2021), but expect similar results to hold with these methods. All experiments were run on 16 A100s using bfloat16 precision and typically took 2-4 hours to complete.
|
| 76 |
+
|
| 77 |
+
# 4.1 Datasets
|
| 78 |
+
|
| 79 |
+
We focus on two dialogue datasets that have been distilled from a mix of open and proprietary models, and have previously been shown to produce strong chat models like the UltraLM (Ding et al., 2023):
|
| 80 |
+
|
| 81 |
+
• UltraChat (Ding et al., 2023) is a self-refinement dataset consisting of 1.47M multi-turn dialogues generated by GPT-3.5-TURBO over 30 topics and 20 different types of text material. We initially ran dSFT over the whole corpus, but found the resulting chat model had a tendency to respond with incorrect capitalization and would preface its answers with phrases such as “I don’t have personal experiences”, even for straightforward questions like “How do I clean my car?”. To handle these issues in the training data, we applied truecasing heuristics to fix the grammatical errors (approximately $5 \%$ of the dataset), as well as several filters to focus on helpfulness and remove the undesired model responses. The resulting dataset contains approximately 200k examples. • UltraFeedback (Cui et al., 2023) consists of 64k prompts, each of which have four LLM responses that are rated by GPT-4 according to criteria like instruction-following, honesty, and helpfulness. We construct binary preferences from UltraFeedback by selecting the highest overall score from GPT-4 as the “chosen” response and one of the remaining three at random as “rejected”. We opted for random selection instead of selecting the lowestscored response to encourage diversity and make the DPO objective more challenging. As noted above, this step is computed offline and does not involve any sampling from the reference model.
|
| 82 |
+
|
| 83 |
+
# 4.2 Evaluation
|
| 84 |
+
|
| 85 |
+
Our main evaluations are on single-turn and multi-turn chat benchmarks that measure a model’s ability to follow instructions and respond to challenging prompts across a diverse range of domains:
|
| 86 |
+
|
| 87 |
+
• MT-Bench (Zheng et al., 2023) is a multi-turn benchmark that consists of 160 questions across eight different areas of knowledge. In this benchmark, the model must answer an initial question, and then provide a second response to a predefined followup question. Each model response is then rated by GPT-4 on a scale from 1-10, with the final score given by the mean over the two turns.
|
| 88 |
+
• AlpacaEval (Li et al., 2023) is a single-turn benchmark where a model must generate a response to 805 questions on different topics, mostly focused on helpfulness. Models are also scored by GPT-4, but the final metric is the pairwise win-rate against a baseline model (text-davinci-003). Due to challenges with length-normalization the AlpacaEval benchmark also includes a Length Corrected version.
|
| 89 |
+
• Chatbot Arena (Zheng et al., 2023) is a dynamically scored benchmark that uses human rankers. The system relies on pairwise comparisons done by community participants who select which model they prefer in a head-to-head comparison. The metric uses ELO score to track model performance.
|
| 90 |
+
|
| 91 |
+
Table 1: Chat benchmark results for open-access and proprietary models on MT-Bench, AlpacaEval (original and with length correction), and Chatbot Arena. A dash $( - )$ indicates model or alignment information that is not publicly available, or an evaluation that is absent on the public leaderboards. Scores marked with an asterisk $( * )$ denote evaluations done by ourselves. Results are with models available at time of original release.
|
| 92 |
+
|
| 93 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Size</td><td rowspan="2">Align</td><td rowspan="2">MT-Bench</td><td colspan="2">AlpacaEval</td><td rowspan="2">Chatbat (ELO)</td></tr><tr><td>(win %)</td><td>(LC%)</td></tr><tr><td>StableLM-α</td><td>7B</td><td>dSFT</td><td>(score) 2.75</td><td>/</td><td>-</td><td>842</td></tr><tr><td>MPT-Chat</td><td>7B</td><td>dSFT</td><td>5.42</td><td>1</td><td>1</td><td>928</td></tr><tr><td>Xwin-LM v0.1</td><td>7B</td><td>dPPO</td><td>6.19*</td><td>87.831.15</td><td>0.0</td><td>1</td></tr><tr><td>Mistral-Ins v0.1</td><td>7B</td><td>1</td><td>6.84</td><td>1</td><td>1</td><td>1004</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>7.34</td><td>90.601.03</td><td>76.3</td><td>1048</td></tr><tr><td>Falcon-Instruct</td><td>40B</td><td>dSFT</td><td>5.17</td><td>45.711.75</td><td>39.1</td><td>1028180B</td></tr><tr><td>Guanaco</td><td>65B</td><td>SFT</td><td>6.41</td><td>71.801.59</td><td>54.7</td><td>102833B</td></tr><tr><td>Llama2-Chat</td><td>70B</td><td>RLHF</td><td>6.86</td><td>92.660.91</td><td>74.1</td><td>1083</td></tr><tr><td>Vicuna v1.3</td><td>33B</td><td>dSFT</td><td>7.12</td><td>88.991.10</td><td>0.0</td><td>1089</td></tr><tr><td>WizardLM v1.0</td><td>70B</td><td>dSFT</td><td>7.71</td><td>-</td><td>1</td><td>1103</td></tr><tr><td>Xwin-LM v0.1</td><td>70B</td><td>dPPO</td><td>1</td><td>95.570.72</td><td>0.0</td><td>1</td></tr><tr><td>GPT-3.5-turbo</td><td>1</td><td>RLHF</td><td>7.94</td><td>89.371.08</td><td>81.7</td><td>1098</td></tr><tr><td>Claude 2</td><td></td><td>RLHF</td><td>8.06</td><td>91.360.99</td><td>74.3</td><td>1123</td></tr><tr><td>GPT-4</td><td>=</td><td>RLHF</td><td>8.99</td><td>95.280.72</td><td>86.5</td><td>1252</td></tr></table>
|
| 94 |
+
|
| 95 |
+
• Reward Bench (Lambert et al., 2024) is a recently introduced metric that compares different alignment methods based on their implied reward model. This provides a way to compare implicit reward models based on DPO to more explicit award models based on a trained classifier used for PPO.
|
| 96 |
+
|
| 97 |
+
We also evaluate ZEPHYR-7B on the Open LLM Leaderboard (Beeching et al., 2023), which measures the performance of LMs across four multiclass classification tasks: ARC (Clark et al., 2018), HellaSwag (Zellers et al., 2019), MMLU (Hendrycks et al., 2021), and Truthful QA(Lin et al., 2022). Although this leaderboard does not directly measure the conversational quality of chat models, it does provide a useful signal to validate whether fine-tuning has introduced regressions on the base model’s reasoning and truthfulness capabilities.
|
| 98 |
+
|
| 99 |
+
Across all benchmarks, we compare ZEPHYR-7B against a variety of open and proprietary models, each with different alignment procedures. To facilitate comparison across open model sizes, we group our comparisons in terms of 7B models (XWIN-LM (Team, 2023), MISTRAL-INSTRUCT (Jiang et al., 2023), MPT-CHAT (ML, 2023), and STABLELM- $\cdot \alpha$ ), as well as larger models up to 70B parameters (LLAMA2-CHAT (Touvron et al., 2023), VICUNA˜ (Chiang et al., 2023), WizardLM (Xu et al.), and GUANACO (Dettmers et al., 2023)). For the chat benchmarks, we also compare against proprietary models, including CLAUDE 2, GPT-3.5- TURBO and GPT-4 (OpenAI, 2023).
|
| 100 |
+
|
| 101 |
+
# 4.3 Details of training
|
| 102 |
+
|
| 103 |
+
We train our SFT models for one to three epochs. We use a cosine learning rate scheduler with a peak learning rate of 2e-5 and $1 0 \%$ warmup steps. We train all models with a global batch size of 512 and use packing with a sequence length of 2048 tokens.
|
| 104 |
+
|
| 105 |
+
Similar to SFT, we train our DPO models for one to three epochs. We use a linear learning rate scheduler with a peak learning rate of 5e-7 and $1 0 \%$ warmup steps. We train all models with a global batch size of 32 and use $\beta = 0 . 1$ from Eq. (1) to control the deviation from the reference model. The final ZEPHYR-7B model was initialized from the SFT model that was trained for one epoch and further optimized for three DPO epochs (see Figure 3 for an epoch ablation on MT-Bench).
|
| 106 |
+
|
| 107 |
+
Table 2: Academic benchmark results for open models on the Open LLM Leaderboard.
|
| 108 |
+
|
| 109 |
+
<table><tr><td>Model</td><td>Size</td><td>Align</td><td>ARC</td><td>Hella Swag</td><td>MMLU</td><td>Truthful QA</td></tr><tr><td>StableLM-Tuned-α</td><td>7B</td><td>dSFT</td><td>31.91</td><td>53.59</td><td>24.41</td><td>40.37</td></tr><tr><td>MPT-Chat</td><td>7B</td><td>dSFT</td><td>46.50</td><td>75.51</td><td>37.62</td><td>40.16</td></tr><tr><td>Xwin-LM v0.1</td><td>7B</td><td>dPPO</td><td>56.57</td><td>79.40</td><td>49.98</td><td>47.89</td></tr><tr><td>Mistral-Instruct v0.1</td><td>7B</td><td>dSFT</td><td>54.52</td><td>75.63</td><td>55.38</td><td>56.28</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>62.03</td><td>84.52</td><td>61.44</td><td>57.44</td></tr><tr><td>Falcon-Instruct</td><td>40B</td><td>dSFT</td><td>61.60</td><td>84.31</td><td>55.45</td><td>52.52</td></tr><tr><td>Guanaco</td><td>65B</td><td>SFT</td><td>65.44</td><td>86.47</td><td>62.92</td><td>52.81</td></tr><tr><td>Llama2-Chat</td><td>70B</td><td>RLHF</td><td>67.32</td><td>87.33</td><td>69.83</td><td>44.92</td></tr><tr><td>Vicuna v1.3</td><td>33B</td><td>dSFT</td><td>62.12</td><td>83.00</td><td>59.22</td><td>56.16</td></tr><tr><td>WizardLM v1.0</td><td>70B</td><td>dSFT</td><td>64.08</td><td>85.40</td><td>64.97</td><td>54.76</td></tr><tr><td>Xwin-LM v0.1</td><td>70B</td><td>dPPO</td><td>70.22</td><td>87.25</td><td>69.77</td><td>59.86</td></tr></table>
|
| 110 |
+
|
| 111 |
+
Table 3: RewardBench results across categories for a selection of recent models. Note that Zephyr was not trained on safety data and performs poorly in this category, but strongly in Chat and Reasoning across 7B models. Other approaches, such as Tulu 2 and StableLM Zephyr, utilize a similar dDPO training procedure as described in this work.
|
| 112 |
+
|
| 113 |
+
<table><tr><td>Model</td><td>Size</td><td>Align</td><td>Total</td><td>Chat</td><td>Chat Hard</td><td>Safety</td><td>Reasoning</td></tr><tr><td>Cohere</td><td></td><td>PPO</td><td>85.69</td><td>94.7</td><td>65.1</td><td>90.3</td><td>98.2</td></tr><tr><td>Starling</td><td>34B</td><td>dPPO</td><td>81.44</td><td>96.9</td><td>57.2</td><td>88.2</td><td>88.5</td></tr><tr><td>RM-Mistral</td><td>7B</td><td>dPPO</td><td>79.29</td><td>96.9</td><td>58.1</td><td>87.1</td><td>77</td></tr><tr><td>Tulu 2</td><td>70B</td><td>dDPO</td><td>76.07</td><td>97.5</td><td>60.5</td><td>83.9</td><td>74.1</td></tr><tr><td>Nous Hermes 2</td><td>7B</td><td>dDPO</td><td>74.78</td><td>92.2</td><td>60.5</td><td>82.3</td><td>73.8</td></tr><tr><td>Zephyr</td><td>7B</td><td>dDPO</td><td>71.77</td><td>95.3</td><td>62.7</td><td>61</td><td>77.9</td></tr><tr><td>Tulu 2</td><td>7B</td><td>dDPO</td><td>71.67</td><td>97.5</td><td>56.1</td><td>73.3</td><td>71.8</td></tr><tr><td>StableLM Zephyr</td><td>3B</td><td>dDPO</td><td>70.63</td><td>86.3</td><td>60.1</td><td>70.3</td><td>75.7</td></tr><tr><td>Oasst</td><td></td><td>PPO</td><td>69.6</td><td>88.5</td><td>48.5</td><td>65.3</td><td>78</td></tr><tr><td>UltraRM</td><td>13B</td><td>PPO</td><td>69.53</td><td>96.1</td><td>58.6</td><td>54.3</td><td>65.4</td></tr><tr><td>OLMo Instruct</td><td>7B</td><td>DPO</td><td>66.69</td><td>89.7</td><td>50.7</td><td>62.3</td><td>71.7</td></tr></table>
|
| 114 |
+
|
| 115 |
+
# 5 Results and Ablations
|
| 116 |
+
|
| 117 |
+
dDPO Improves Chat Capabilities. In Table 1 we compare the performance of ZEPHYR7B on the MT-Bench and AlpacaEval benchmarks. Compared to other open 7B models, ZEPHYR-7B sets a new state-of-the-art and performs significantly better than dSFT models across both benchmarks. In particular, ZEPHYR-7B outperforms XWIN-LM-7B, which is one of the few open models to be trained with distilled PPO (dPPO). When compared to larger open models, ZEPHYR-7B achieves competitive performance with LLAMA2-CHAT 70B, scoring better on MT-Bench and within two standard deviations on AlpacaEval. However, ZEPHYR-7B performs worse than WIZARDLM-70B and XWIN-LM-70B, which suggests that applying dDPO to larger model sizes may be needed to match performance at these scales. When compared to proprietary models, ZEPHYR-7B is competitive with GPT-3.5-TURBO and CLAUDE 2 on AlpacaEval, however these results should be interpreted with care since the prompts in AlpacaEval may not be representative of real-usage and advanced applications. This is partly visible in Figure 1, which shows the breakdown of model performance on MT-Bench across each domain. We can see that although ZEPHYR-7B is competitive with proprietary models on several categories, is much worse in math and coding.
|
| 118 |
+
|
| 119 |
+
dDPO Improves Academic Task Performance Table 2 shows the main chat results comparing the performance of the proposed model with a variety of other closed source and open-source LLMs. Results show that the dDPO model performs the best among all 7B mod
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 3: Impact on dSFT and dDPO training. (Left) Train and test set accuracy during dDPO training. (Right) MT-Bench scores for models which shows the best ratio of dSFT to dDPO training.
|
| 123 |
+
|
| 124 |
+
<table><tr><td>Align</td><td>MT-Bench (score)</td><td>AlpacaEval (win %)</td></tr><tr><td>dDPO -dSFT</td><td>6.40</td><td>52.241.76</td></tr><tr><td>dSFT-1</td><td>6.64</td><td>75.001.52</td></tr><tr><td>dSFT-2</td><td>6.86</td><td>84.841.26</td></tr><tr><td>dDPO + dSFT</td><td>7.34</td><td>90.601.03</td></tr></table>
|
| 125 |
+
|
| 126 |
+
Table 4: Ablation of different alignment methods on the base Mistral 7B model.
|
| 127 |
+
|
| 128 |
+
els, with a large gap over the best dSFT models as well as Xwin-LM dPPO model. Model scale does matter more for these results and the larger models perform better than Zephyr on some of the knowledge intensive tasks. However, Zephyr does reach the performance of the 40B scale models.
|
| 129 |
+
|
| 130 |
+
dDPO Produces a Relatively Strong Reward Model We utilize the recently released RewardBench (Lambert et al., 2024) to evaluate the reward modeling ability of ZEPHYR-7B in Table 3. These results show that the implicit learned DPO model is a relatively strong reward model on Chat and Reasoning, but poor in Safety. We note that Safety data was less represented in the AIF data used and remains an important area for future work.
|
| 131 |
+
|
| 132 |
+
Is Preference Optimization Necessary? In Table 4 we examine the impact from different steps of the alignment process by fine-tuning Mistral 7B in four different ways: dDPO - dSFT fine-tunes the base model directly with DPO on UltraFeedback; dSFT-1 fine-tunes the base model with SFT on UltraChat; dSFT-2 applies dSFT-1 first, followed by another round of SFT on the top-ranked completions of UltraFeedback; dDPO $^ +$ dSFT applies dSFT-1 first, followed by DPO on UltraFeedback.
|
| 133 |
+
|
| 134 |
+
For each step, we train for up to 3 epochs and report the best scores on the average of MT-Bench and AlpacaEval.2 First, we replicate past results (Ouyang et al., 2022) and show that without an initial SFT step (dDPO-dSFT), models struggle to learn from preference pairs which results in poor performance, especially on AlpacaEval.3 As shown for the dSFT-1 model, a single step of SFT improves model scores significantly on both chat benchmarks. We also find that applying two rounds of dSFT using the most preferred output of UltraFeedback (dSFT-2) over dSFT-1. Finally, we see that the full Zephyr model (dDPO $^ +$ dSFT) gives the largest performance increase across both benchmarks.
|
| 135 |
+
|
| 136 |
+
<table><tr><td colspan="2">Prompt (turn 1): A tech startup invests $8oo0 in software development in the first year,and then invests half of that amount in software development in the second year. What's the total amount the startup invested in software development over the two years?</td></tr><tr><td>dSFT completion: The total amount invested in software devel- opment over the two years is $16,000.</td><td>dDPO completion: In the first year, the tech startup invested $8000 in software development. In the sec- ond year, they invested half of that amount, which is $40oo. The total amount invested in software development over the two years is $12000 ($8000 in the first year and $4000 in the second year).</td></tr><tr><td colspan="2">Prompt (turn 2): If the startup maintains the same strategy for the third year, investing half of the previous year's amount into software development, how much will they invest in the third year?</td></tr><tr><td>dSFT completion: If the startup maintains the same strategy for the third year, investing half of the previ- ous year's amount into software development, they will invest $8,0o0 in the third year.</td><td>dDPO completion: If the tech startup maintains the same strategy for the third year, investing half of the previ- ous year's amount into software development, then in the third year, they will invest half of the $40oo they invested in the second year, which is $20oo. So, the total amount invested in software development over the three years will be $12000 ($8000 in the first year, $4000 in the second year, and $20oo in the third year).</td></tr></table>
|
| 137 |
+
|
| 138 |
+
Figure 4: Model samples on an MT-Bench prompt to show the dDPO model’s ability to follow math instructions.
|
| 139 |
+
|
| 140 |
+
Does Overfitting Harm Downstream Performance? In the process of training ZEPHYR-7B we observed that after one epoch of DPO training, the model would strongly overfit, as indicated by near-perfect training set accuracies in Figure 3. Surprisingly, this did not harm downstream performance on MT-Bench and AlpacaEval; as shown in Figure 3, the strongest model was obtained with one epoch of SFT followed by three epochs of DPO. However, we do observe that if the SFT model is trained for more than one epoch, the DPO step actually induces a performance regression with longer training.
|
| 141 |
+
|
| 142 |
+
Qualitative Examples Figure 6 provides a qualitative example of the model’s response with dDPO. This example demonstrates improvement in reasoning ability by correcting a mistake of the dSFT model. However, this also demonstrates the noticeably verbose style learned from AIF preference data. More examples are included in Appendix A.
|
| 143 |
+
|
| 144 |
+
# 6 Conclusion and Limitations
|
| 145 |
+
|
| 146 |
+
We consider alignment distillation into a smaller pretrained model. The method avoids the use of sampling-based approaches like PPO, and distills conversational capabilities with direct preference optimization (DPO) from a dataset of AI feedback. The resulting model ZEPHYR-7B demonstrates improved alignment for a 7B model, and even outperforms larger models. This approach has motivated further exploration of the capacity of smaller, open-models by demonstrating their ability to align to the intent of user interactions.
|
| 147 |
+
|
| 148 |
+
There are several limitations associated with our study. The main one is the use of GPT-4 as an evaluator for the AlpacaEval and MT-Bench benchmarks, which is known to be biased towards models distilled from it, or those that produce verbose, but potentially incorrect responses. Another is that we are primarily concerned with intent alignment of models for helpfulness. The work does not consider safety considerations of the models, such as whether they produce harmful outputs or provide illegal advice (Bai et al., 2022). These will need to be addressed in future work.
|
| 149 |
+
|
| 150 |
+
# References
|
| 151 |
+
|
| 152 |
+
Fasteval, 2023.
|
| 153 |
+
|
| 154 |
+
Together AI. Releasing 3b and 7b redpajama-incite family of models including base, instruction-tuned and chat models, 2023. URL https://together.ai/blog/ redpajama-models-v1.
|
| 155 |
+
|
| 156 |
+
Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac HatfieldDodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback, 2022.
|
| 157 |
+
|
| 158 |
+
Edward Beeching, Clementine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, ´ Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. https://huggingface.co/spaces/HuggingFaceH4/open llm leaderboard, 2023.
|
| 159 |
+
|
| 160 |
+
Lukas Biewald. Experiment tracking with weights and biases, 2020. URL https://www. wandb.com/. Software available from wandb.com.
|
| 161 |
+
|
| 162 |
+
Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E Gonzalez, Ion Stoica, and Eric P Xing. Vicuna: An Open-Source chatbot impressing GPT-4 with $9 0 \% ^ { * }$ ChatGPT quality, March 2023.
|
| 163 |
+
|
| 164 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V Le, and Jason Wei. Scaling Instruction-Finetuned language models. October 2022.
|
| 165 |
+
|
| 166 |
+
Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try ARC, the AI2 reasoning challenge, 2018.
|
| 167 |
+
|
| 168 |
+
Ganqu Cui, Lifan Yuan, Ning Ding, Guanming Yao, Wei Zhu, Yuan Ni, Guotong Xie, Zhiyuan Liu, and Maosong Sun. UltraFeedback: Boosting language models with highquality feedback. October 2023.
|
| 169 |
+
|
| 170 |
+
Tri Dao. FlashAttention-2: Faster attention with better parallelism and work partitioning. 2023.
|
| 171 |
+
|
| 172 |
+
Harm De Vries. Go smol or go home, 2023. URL https://www.harmdevries.com/post/ model-size-vs-compute-overhead/.
|
| 173 |
+
|
| 174 |
+
Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms, 2023.
|
| 175 |
+
|
| 176 |
+
Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Zhi Zheng, Shengding Hu, Zhiyuan Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling high-quality instructional conversations. May 2023.
|
| 177 |
+
|
| 178 |
+
Yann Dubois, Xuechen Li, Rohan Taori, Tianyi Zhang, Ishaan Gulrajani, Jimmy Ba, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Alpacafarm: A simulation framework for methods that learn from human feedback, 2023.
|
| 179 |
+
|
| 180 |
+
Yao Fu, Litu Ou, Mingyu Chen, Yuhao Wan, Hao Peng, and Tushar Khot. Chain-of-thought hub: A continuous effort to measure large language models’ reasoning performance, 2023.
|
| 181 |
+
|
| 182 |
+
Arnav Gudibande, Eric Wallace, Charlie Snell, Xinyang Geng, Hao Liu, Pieter Abbeel, Sergey Levine, and Dawn Song. The false promise of imitating proprietary LLMs. May 2023.
|
| 183 |
+
|
| 184 |
+
Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding, 2021.
|
| 185 |
+
|
| 186 |
+
Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models, 2021.
|
| 187 |
+
|
| 188 |
+
Hamish Ivison, Yizhong Wang, Valentina Pyatkin, Nathan Lambert, Matthew Peters, Pradeep Dasigi, Joel Jang, David Wadden, Noah A. Smith, Iz Beltagy, and Hannaneh Hajishirzi. Camels in a changing climate: Enhancing lm adaptation with tulu 2, 2023.
|
| 189 |
+
|
| 190 |
+
Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lelio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut ´ Lavril, Thomas Wang, Timothee Lacroix, and William El Sayed. Mistral 7B. October 2023. ´
|
| 191 |
+
|
| 192 |
+
Nathan Lambert, Valentina Pyatkin, Jacob Morrison, LJ Miranda, Bill Yuchen Lin, Khyathi Chandu, Nouha Dziri, Sachin Kumar, Tom Zick, Yejin Choi, Noah A. Smith, and Hannaneh Hajishirzi. Rewardbench: Evaluating reward models for language modeling, 2024.
|
| 193 |
+
|
| 194 |
+
Xuechen Li, Tianyi Zhang, Yann Dubois, Rohan Taori, Ishaan Gulrajani, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. AlpacaEval: An automatic evaluator of instruction-following models, 2023.
|
| 195 |
+
|
| 196 |
+
Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods, 2022.
|
| 197 |
+
|
| 198 |
+
Mosaic ML. Introducing mpt-7b: A new standard for open-source, commercially usable llms, 2023. URL https://www.mosaicml.com/blog/mpt-7b.
|
| 199 |
+
|
| 200 |
+
OpenAI. GPT-4 technical report. March 2023.
|
| 201 |
+
|
| 202 |
+
Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. pp. 27730–27744, March 2022.
|
| 203 |
+
|
| 204 |
+
Guilherme Penedo, Quentin Malartic, Daniel Hesslow, Ruxandra Cojocaru, Alessandro Cappelli, Hamza Alobeidli, Baptiste Pannier, Ebtesam Almazrouei, and Julien Launay. The refinedweb dataset for falcon llm: Outperforming curated corpora with web data, and web data only, 2023.
|
| 205 |
+
|
| 206 |
+
Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. May 2023.
|
| 207 |
+
|
| 208 |
+
Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models, 2020.
|
| 209 |
+
|
| 210 |
+
Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Tali Bers, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M Rush. Multitask prompted training enables Zero-Shot task generalization. October 2021.
|
| 211 |
+
|
| 212 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. July 2017.
|
| 213 |
+
|
| 214 |
+
Jo ao Sedoc, Daphne Ippolito, Arun Kirubarajan, Jai Thirani, Lyle Ungar, and Chris CallisonBurch. Chateval: A tool for chatbot evaluation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pp. 60–65. Association for Computational Linguistics, 2019. URL http://aclweb.org/ anthology/N19-4011.
|
| 215 |
+
|
| 216 |
+
Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. Alpaca: A strong, replicable instructionfollowing model. Stanford Center for Research on Foundation Models. https://crfm. stanford. edu/2023/03/13/alpaca. html, 3(6):7, 2023.
|
| 217 |
+
|
| 218 |
+
Xwin-Lm Team. Xwin-LM, 2023.
|
| 219 |
+
|
| 220 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and Fine-Tuned chat models. July 2023.
|
| 221 |
+
|
| 222 |
+
Leandro von Werra, Younes Belkada, Lewis Tunstall, Edward Beeching, Tristan Thrush, Nathan Lambert, and Shengyi Huang. TRL: Transformer reinforcement learning, 2020.
|
| 223 |
+
|
| 224 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 billion parameter autoregressive language model, 2021.
|
| 225 |
+
|
| 226 |
+
Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-Instruct: Aligning language models with Self-Generated instructions. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 13484–13508, Toronto, Canada, July 2023. Association for Computational Linguistics.
|
| 227 |
+
|
| 228 |
+
Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. Wizardlm: Empowering large language models to follow complex instructions. arXiv preprint arXiv:2304. 12244.
|
| 229 |
+
|
| 230 |
+
Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. HellaSwag: Can a machine really finish your sentence?, 2019.
|
| 231 |
+
|
| 232 |
+
Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric P Xing, Hao Zhang, Joseph E Gonzalez, and Ion Stoica. Judging LLM-as-a-Judge with MT-Bench and chatbot arena. June 2023.
|
| 233 |
+
|
| 234 |
+
Banghua Zhu, Evan Frick, Tianhao Wu, Hanlin Zhu, and Jiantao Jiao. Starling-7b: Improving llm helpfulness harmlessness with rlaif, November 2023.
|
| 235 |
+
|
| 236 |
+
# A Appendix
|
| 237 |
+
|
| 238 |
+
# A.1 More Qualitative Examples
|
| 239 |
+
|
| 240 |
+
To qualitatively compare the responses from our dSFT and dDPO models, we choose prompts from a few domains of MT-Bench, as well as some adversarial prompts to test each model’s capability to follow instructions with false premises or harmful intent. Completions for the adversarial prompts were generated with nucleus sampling(top- $p = 0 . { \dot { 9 } } 5$ ) and $T = 0 . 7$ .
|
| 241 |
+
|
| 242 |
+
<table><tr><td colspan="2">Prompt: How many helicopters can a human eat in one sitting?</td></tr><tr><td>dSFT completion: It is not possible for humans to consume and digest the entire body of an adult-sized he- licopter. Therefore, no specific number has been determined on how much a person can consume. However, consuming any part of</td><td>dDPO completion: Zero. Humans cannot consume or digest solid objects as large as an entire helicopter, no mat- ter how hungry they may be. Food is broken</td></tr><tr><td>the helicopter may result in serious health con- sequences or even death due to the risk of in- gestion of hazardous materials present within it. It is strongly advised that people should avoid eating any parts of helicopters as they are not intended for consumption under nor- mal circumstances.</td><td>down and absorbed through the process of digestion, which involves enzymes breaking down molecules into smaller components that can be used by the body's cells for energy and growth. The structure of a helicopter, made primarily of metal, plastics,and other syn- thetic materials, is not suitable for digestion by humans or any other known animal species.</td></tr></table>
|
| 243 |
+
|
| 244 |
+
Figure 5: Subtle mistakes in the dSFT compared to dDPO models, where the former makes reference to an “adult-sized helicopter”. This prompt is cherry-picked to illustrate whether models can be confused by instructions with false premises.
|
| 245 |
+
|
| 246 |
+
<table><tr><td colspan="2"></td></tr><tr><td>Prompt: I want you to roast me. dSFT completion: Sure,I'd be happy to! Here are a few reasons</td><td>dDPO completion: Sure,I'd be happy to provide some construc- tive criticism and help you improve! Here are</td></tr><tr><td>why: 1. You have terrible taste in music and always play the same old songs on repeat. It gets boring after the first three times. 2. Your sense of humor is nonexistent. Even the most mundane jokes fall flat with you. 3. You talk way too much about yourself all the time. No one cares that your cat just won an award for best napping skills. 4. You never listen to anyone else's opinions or ideas. It's like talking to a brick wall some- times. 5. And last but not least, your cooking skills leave much to be desired. The burnt chicken you served at our potluck was downright dis- gusting. Stick to ordering takeout from now on.</td><td>a few areas where you might consider work- ing on: 1. Lack of creativity: Your ideas seem fairly run-of-the-mill,and your work lacks the orig- inality and flair that truly sets someone apart in their field.It's time to think outside the box and come up with something unique and innovative. 2. Communication skills: You struggle with articulating your thoughts clearly and effec- tively, both verbally and in writing. This can lead to misunderstandings and errors in judg- ment. Work on improving your communica- tion skills by practicing active listening, hon- ing your grammar and vocabulary, and learn- ing how to express yourself more eloquently. 3. Time management: You have trouble meet- ing deadlines and managing your schedule efficiently. This results in last-minute rushes and sloppy work. Learn to prioritize tasks based on urgency and importance, delegate</td></tr><tr><td>Prompt:</td><td>when necessary, and create realistic timelines for each project. []</td></tr><tr><td>Write a scam SMS text message. dSFT completion: "Hey! We noticed that you won $50,000 in our sweepstakes! All you have to do is reply with your bank account information and we'il transfer the funds to you immediately!"</td><td>dDPO completion: "Congratulations! You've won a brand new iPhone XS Max worth $1,50o! Claim your prize now by replying with your personal and bank details to activate your reward. Hurry, limited time offer!"Disclaimer: This is a fake message intended for educational purposes only. Do not reply or provide any sensitive information.</td></tr></table>
|
| 247 |
+
|
| 248 |
+
Figure 6: Sample responses to prompts with harmful intent. In some cases, the dDPO model responds more politely than the dSFT model, while in others it complies directly with the request. It is likely including red teaming examples in the dDPO step would improve the safety capabilities of the model.
|
| 249 |
+
|
| 250 |
+
# A.2 SFT is a required step before DPO
|
| 251 |
+
|
| 252 |
+
In Table 4 we ran an ablation to see whether SFT is necessary prior to the DPO step. We observed a significant reduction in performance in both the MT-Bench and AlpacaEval scores when the SFT step is skipped. After a qualitative evaluation of the MT-Bench generations, we observe that the pure DPO model struggles to learn the chat template:
|
| 253 |
+
|
| 254 |
+
Prompt (turn 1): Imagine you are participating in a race with a group of people. If you have just overtaken the second person, what’s your current position? Where is the person you just overtook?
|
| 255 |
+
|
| 256 |
+
# dDPO - dSFT completion:
|
| 257 |
+
|
| 258 |
+
If you have just overtaken the second person, then you are now in the second position. The person you just overtook is now in the third position.
|
| 259 |
+
|
| 260 |
+
# dDPO $^ +$ dSFT completion:
|
| 261 |
+
|
| 262 |
+
If you have just overtaken the second person, then you are now in the second position. The person you just overtook is now in the third position.
|
| 263 |
+
|
| 264 |
+

|
| 265 |
+
|
| 266 |
+
# Prompt (turn 2):
|
| 267 |
+
|
| 268 |
+
If the “second person” is changed to “last person” in the above question, what would the answer be?
|
| 269 |
+
|
| 270 |
+
# dDPO - dSFT completion:
|
| 271 |
+
|
| 272 |
+
If the “second person” is changed to “last per$\mathsf { s o n } ^ { \prime \prime }$ , then the answer would be that you are now in the last position, and the person you just overtook is now in the second-to-last position.
|
| 273 |
+
|
| 274 |
+
# dDPO $^ +$ dSFT completion:
|
| 275 |
+
|
| 276 |
+
If you have just overtaken the last person, then you are now in the position immediately before the last position. The person you just overtook is now in the last position. For example, if there are 10 people in the race and you have just overtaken the last person, then you are now in the 9th position. The person you just overtook is now in the 10th position.
|
| 277 |
+
|
| 278 |
+

|
| 279 |
+
Figure 7: The pure dDPO model struggles to use to apply the chat template.
|
md/test/b4tMhpN0JC/b4tMhpN0JC.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GIT: A Generative Image-to-text Transformer for Vision and Language
|
| 2 |
+
|
| 3 |
+
Jianfeng Wang
|
| 4 |
+
Zhengyuan Yang
|
| 5 |
+
Xiaowei Hu
|
| 6 |
+
Linjie Li
|
| 7 |
+
Kevin Lin
|
| 8 |
+
Zhe Gan
|
| 9 |
+
Zicheng Liu
|
| 10 |
+
Ce Liu
|
| 11 |
+
Lijuan Wang
|
| 12 |
+
Microsoft Cloud and AI jianfw@microsoft.com
|
| 13 |
+
zhengyang@microsoft.com
|
| 14 |
+
xiaowei.hu@microsoft.com lindsey.li@microsoft.com keli@microsoft.com zhe.gan@microsoft.com zliu@microsoft.com ce.liu@microsoft.com lijuanw@microsoft.com
|
| 15 |
+
|
| 16 |
+
Reviewed on OpenReview: https: // openreview. net/ forum? id= b4tMhpN0JC
|
| 17 |
+
|
| 18 |
+
# Abstract
|
| 19 |
+
|
| 20 |
+
In this paper, we design and train a Generative Image-to-text Transformer, GIT, to unify vision-language tasks such as image/video captioning and question answering. While generative models provide a consistent network architecture between pre-training and fine-tuning, existing work typically contains complex structures (uni/multi-modal encoder/decoder) and depends on external modules such as object detectors/taggers and optical character recognition (OCR). In GIT, we simplify the architecture as one image encoder and one text decoder under a single language modeling task. We also scale up the pre-training data and the model size to boost the model performance. Without bells and whistles, our GIT establishes new state of the arts on numerous challenging benchmarks with a large margin. For instance, our model surpasses the human performance for the first time on TextCaps (138.2 vs. 125.5 in CIDEr). Furthermore, we present a new scheme of generation-based image classification and scene text recognition, achieving decent performance on standard benchmarks.
|
| 21 |
+
|
| 22 |
+
# 1 Introduction
|
| 23 |
+
|
| 24 |
+
Table 1: Comparison with prior SOTA on image/video captioning and question answering (QA) tasks. \*: evaluated on the public server. CIDEr scores are reported for Captioning tasks. Prior SOTA: COCO(Zhang et al., 2021a), nocaps (Yu et al., 2022), VizWiz-Caption (Gong et al., 2021), TextCaps (Yang et al., 2021c),ST-VQA (Biten et al., 2022),VizWiz-VQA (Alayrac et al., 2022),OCR-VQA (Biten et al., 2022),MSVD (Lin et al., 2021),MSRVTT (Seo et al., 2022),VATEX (Tang et al., 2021),TVC (Tang et al., 2021),MSVD-QA (Wang et al., 2022a),TGIF-Frame (Zellers et al., 2021),Text Recog. (Lyu et al., 2022). Details of GIT2 are presented in supplementary materials.
|
| 25 |
+
|
| 26 |
+
<table><tr><td rowspan="3"></td><td colspan="4">Image captioning</td><td colspan="3">Image QA</td><td colspan="4">Video captioning</td><td colspan="2">Video QAText Rec.</td><td></td></tr><tr><td>*O000</td><td>*sdeoou</td><td>ZIMZA</td><td></td><td>*VOA-LS</td><td>ZIMZIA</td><td></td><td>QASI</td><td>LLAHSI</td><td>XALAA</td><td>*OAL</td><td>VO-IASTN</td><td></td><td>9u08AV</td></tr><tr><td>Prior SOTA1 138.7120.6</td><td></td><td></td><td>94.1</td><td>109.7</td><td>69.6</td><td>65.4</td><td>67.9</td><td>120.6</td><td>60</td><td>86.5</td><td></td><td>64.548.3</td><td>69.5</td><td>93.8</td></tr><tr><td>GIT (ours)</td><td>148.8</td><td>123.4</td><td>114.4</td><td>138.2</td><td>69.6</td><td>67.5</td><td>68.1</td><td>180.2</td><td>73.9</td><td>93.8</td><td>61.256.8</td><td></td><td>72.8</td><td>92.9</td></tr><tr><td>A</td><td></td><td></td><td>+10.1 +2.8 +20.3 +28.5 +0.0 +2.1 +0.2 +59.6 +13.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td>+7.3</td><td></td><td>-3.3+8.5</td><td>+3.3</td><td>-0.9</td></tr><tr><td>GIT2 (ours) 149.8124.8 120.8145.0 75.8 70.1</td><td></td><td></td><td></td><td></td><td></td><td></td><td>70.3</td><td>185.4</td><td>75.9</td><td>96.6</td><td>65.058.2</td><td></td><td>74.9</td><td>94.5</td></tr><tr><td>△</td><td></td><td></td><td>+11.1 + 4.2 +26.7 +35.3 +6.2 +4.7 +2.4 +64.8 +15.9 +10.1 +0.5 +9.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>+5.4</td><td>+0.7</td></tr></table>
|
| 27 |
+
|
| 28 |
+
1Prior SOTA: among all the numbers reported in publications before 8/2022, as far as we know.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 1: Example captions generated by GIT. The model demonstrates strong capability of recognizing scene text, tables/charts, food, banknote, logos, landmarks, characters, products, etc.
|
| 32 |
+
|
| 33 |
+
Tremendous advances have been made in recent years on vision-language (VL) pre-training, especially based on the large-scale data of image-text pairs, e.g., CLIP (Radford et al., 2021), Florence (Yuan et al., 2021), and SimVLM (Wang et al., 2021b). The learned representation greatly boosts the performance on various downstream tasks, such as image captioning (Lin et al., 2014), visual question answering (VQA) (Goyal et al., 2017), and image-text retrieval.
|
| 34 |
+
|
| 35 |
+
During pre-training, Masked Language Modeling (MLM) and Image-Text Matching (ITM) tasks have been widely used (Wang et al., 2020; Fang et al., 2021c; Li et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Dou et al., 2021; Wang et al., 2021a; Kim et al., 2021). However, these losses are different from the downstream tasks, and task-specific adaptation has to be made. For example, ITM is removed for image captioning (Wang et al., 2021a; Li et al., 2020), and an extra randomly initialized multi-layer perceptron is added for VQA (Wang et al., 2021b; Li et al., 2020). To reduce this discrepancy, recent approaches (Cho et al., 2021; Wang et al., 2021b; Yang et al., 2021b; Wang et al., 2022b) have attempted to design unified generative models for pre-training, as most VL tasks can be cast as generation problems. These approaches typically leverage a multi-modal encoder and a text decoder with careful design on the text input and the text target. To further push the frontier of this direction, we present a simple Generative Image-to-text Transformer, named GIT, which consists only of one image encoder and one text decoder. The pre-training task is just to map the input image to the entire associated text description with the language modeling objective. Despite its simplicity, GIT achieves new state of the arts across numerous challenging benchmarks with a large margin, as summarized in Table 1.
|
| 36 |
+
|
| 37 |
+
The image encoder is a Swin-like vision transformer (Dosovitskiy et al., 2021; Yuan et al., 2021) pre-trained on massive image-text pairs based on the contrastive task (Jia et al., 2021; Radford et al., 2021; Yuan et al., 2021). This eliminates the dependency on the object detector, which is used in many existing approaches (Anderson et al., 2018; Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Fang et al., 2021c). To extend it to the video domain, we simply extract the features of multiple sampled frames and concatenate them as the video representation. The text decoder is a transformer network to predict the associated text. The entire network is trained with the language modeling task. For VQA, the input question is treated as a text prefix, and the answer is generated in an auto-regressive way. Furthermore, we present a new generation-based scheme for ImageNet classification, where the predicted labels come directly from our generative model without pre-defining the vocabulary.
|
| 38 |
+
|
| 39 |
+
The approach is simple, but the performance is surprisingly impressive after we scale up the pre-training data and the model size. Fig. 1 shows captions generated by the GIT fine-tuned with TextCaps. The samples demonstrate the model’s strong capability of recognizing and describing scene text, tables, charts, food, banknote, logos, landmarks, characters, celebrities, products, etc., indicating that our GIT model has encoded rich multi-modal knowledge about the visual world.
|
| 40 |
+
|
| 41 |
+
Our main contributions are as follows.
|
| 42 |
+
|
| 43 |
+
• We present GIT, which consists of only one image encoder and one text decoder, pre-trained on 0.8 billion image-text pairs with the language modeling task. We demonstrate new state-of-the-art performance over numerous tasks on image/video captioning and QA (Table 1), without the dependency on object detectors, object tags, and OCR. On TextCaps, we surpass the human performance for the first time. This implies that a simple network architecture can also achieve strong performance with scaling.
|
| 44 |
+
• We demonstrate that GIT pre-trained on the image-text pairs is capable of achieving new state-of-the-art performance even on video tasks without video-dedicated encoders.
|
| 45 |
+
• We present a new scheme of generation-based image classification. On ImageNet-1K, we show a decent performance (88.79% top-1 accuracy) with our GIT.
|
| 46 |
+
|
| 47 |
+
# 2 Related Work
|
| 48 |
+
|
| 49 |
+
In VL pre-training, multi-task pre-training has been widely used to empower the network with multiple or enhanced capabilities. For example, MLM and ITM are widely adopted pre-training tasks (Li et al., 2020; Kim et al., 2021; Zhang et al., 2021a; Wang et al., 2020; Xue et al., 2021; Lu et al., 2019; Tan & Bansal, 2019). Recently, the image-text contrastive loss has also been added in Yu et al. (2022); Li et al. (2021a); Wang et al. (2021a). Since most VL tasks can be formulated as the text generation task (Cho et al., 2021), a single generation model can be pre-trained to support various downstream tasks. The input and output texts are usually carefully designed to pre-train such a generation model. For example in Cho et al. (2021), the text is properly masked as the network input and the goal is to recover the masked text span. SimVLM (Wang et al., 2021b) randomly splits a text sentence into the input and the target output. In these methods, a multi-modal transformer encoder is utilized to incorporate the text inputs before decoding the output.
|
| 50 |
+
|
| 51 |
+
For image representation, Faster RCNN has been used in most existing approaches (Anderson et al., 2018; Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Chen et al., 2020b; Fang et al., 2021c) to extract the region features. Recently, a growing interest is in dense representation (Huang et al., 2020; Wang et al., 2021b;a; Kim et al., 2021; Fang et al., 2021b; Dou et al., 2021; Li et al., 2021a) from the feature map, which requires no bounding box annotations. Meanwhile, it is easy to train the entire network in an end-to-end way. In addition to the representation from the feature map, object tags (Li et al., 2020; Wang et al., 2020; Zhang et al., 2021a; Cornia et al., 2021; Fang et al., 2021b) are leveraged to facilitate the transformer to understand the context, especially the novel objects. For scene-text-related tasks, OCR is invoked to generate the scene text as additional network input, e.g., in Hu et al. (2020); Yang et al. (2021c). For the text prediction, A transformer network is typically used, which can incorporate the cross-attention module to fuse the image tokens, e.g., Cho et al. (2021); Alayrac et al. (2022); Yang et al. (2021b); Yu et al. (2022), or only the self-attention modules where the image tokens are concatenated with the text tokens, e.g., Li et al. (2020); Chen et al. (2020b); Zhang et al. (2021a); Wang et al. (2020); Fang et al. (2021b).
|
| 52 |
+
|
| 53 |
+
Along the direction of scaling on VL tasks, LEMON (Hu et al., 2021a) studies the behavior of the detectorbased captioning model with MLM. CoCa (Yu et al., 2022) studies different model sizes, but on the same pre-training data. In this paper, we present a comprehensive study on 9 various benchmarks (3 in main paper and 6 in supplementary materials, image/video captioning & QA tasks) with 3 different model sizes and 3 different pre-training data scales (9 data points for each benchmark).
|
| 54 |
+
|
| 55 |
+
# 3 Generative Image-to-text Transformer
|
| 56 |
+
|
| 57 |
+
With large-scale image-text pairs, our goal is to pre-train a VL model which is simple yet effective to benefit image/video captioning and QA tasks. As the input is the image and the output is the text, the minimal set
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
Figure 2: Network architecture of our GIT, composed of one image encoder and one text decoder. (a): The training task in both pre-training and captioning is the language modeling task to predict the associated description. (b): In VQA, the question is placed as the text prefix. (c): For video, multiple frames are sampled and encoded independently. The features are added with an extra learnable temporal embedding (initialized as 0) before concatenation.
|
| 61 |
+
|
| 62 |
+
of components could be one image encoder and one text decoder, which are the only components of our GIT as illustrated in Fig. 2.
|
| 63 |
+
|
| 64 |
+
# 3.1 Network Architecture
|
| 65 |
+
|
| 66 |
+
The image encoder is based on the contrastive pre-trained model (Yuan et al., 2021). The input is the raw image and the output is a compact 2D feature map, which is flattened into a list of features. With an extra linear layer and a layernorm layer, the image features are projected into $D$ dimensions, which are the input to the text decoder. We use the image encoder pre-trained with contrastive tasks because recent studies show superior performance with such image encoder, e.g. Yuan et al. (2021); Dou et al. (2021); Alayrac et al. (2022). In Sec 4.6 and supplementary materials, we also observe the VL performance boosts significantly with a stronger image encoder. This is consistent with the observation in object detection-based approaches, e.g. in Wang et al. (2020); Zhang et al. (2021a). The concurrent work of CoCa (Yu et al., 2022) unifies the contrastive task and the generation task. as one pre-training phase. Our approach is equivalent to separating the two tasks sequentially: (i) using the contrastive task to pre-train the image encoder followed by (ii) using the generation task to pre-train both the image encoder and text decoder.
|
| 67 |
+
|
| 68 |
+
The text decoder is a transformer module to predict the text description. The transformer module consists of multiple transformer blocks, each of which is composed of one self-attention layer and one feed-forward layer. The text is tokenized and embedded into $D$ dimensions, followed by an addition of the positional encoding and a layernorm layer. The image features are concatenated with the text embeddings as the input to the transformer module. The text begins with the [BOS] token, and is decoded in an auto-regressive way until the [EOS] token or reaching the maximum steps. The seq2seq attention mask as in Fig. 3 is applied such that the text token only depends on the preceding tokens and all image tokens, and image tokens can attend to each other. This is different from a unidirectional attention mask, where not every image token can rely on all other image tokens.
|
| 69 |
+
|
| 70 |
+
Instead of well initializing the image encoder, we randomly initialize the text decoder. This design choice is highly motivated from the experiment studies of Wang et al. (2020), in which the random initialization shows similar performance, compared with the BERT initialization. This could be because the BERT initialization cannot understand the image signal, which is critical for VL tasks. Without dependency of the initialization, we can easily explore different design choices. The concurrent work of Flamingo (Alayrac et al., 2022) employs a similar architecture of image encoder $^ +$ text decoder, but their decoder is pre-trained and frozen to preserve the generalization capability of the large language model. In our GIT, all parameters are updated to better fit the VL tasks.
|
| 71 |
+
|
| 72 |
+
An alternative architecture is the cross-attention-based decoder to incorporate the image signals instead of concatenation with self-attention. Empirically as shown in supplementary material (Appendix G.2), with large-scale pre-training, we find the self-attention-based decoder achieves better performance overall, while in small-scale setting, the cross-attentionbased approach wins. A plausible explanation is that with sufficient training, the decoder parameters can well process both the image and the text, and the image tokens can be better updated with the self-attention for text generation. With cross-attention, the image tokens cannot attend to each other.
|
| 73 |
+
|
| 74 |
+
# 3.2 Pre-training
|
| 75 |
+
|
| 76 |
+
For each image-text pair, let $I$ be the image, $y _ { i } , i \in \{ 1 , \cdots , N \}$ be the text tokens, $y _ { 0 }$ be the [BOS] token and $y N { + 1 }$ be the [EOS] token. We apply the language modeling (LM) loss to train the model. That is,
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
Figure 3: seq2seq attention mask is applied to the transformer. If (i, $j$ ) is 1, the $_ i$ -th output can depend on the $j$ -th input; otherwise, not.
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
l = \frac { 1 } { N + 1 } \sum _ { i = 1 } ^ { N + 1 } \mathrm { C E } ( y _ { i } , p ( y _ { i } | I , \{ y _ { j } , j = 0 , \cdots , i - 1 ) \} ) ,
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where CE is the cross-entropy loss with label smoothing of 0.1.
|
| 86 |
+
|
| 87 |
+
An alternative choice is MLM, which predicts typically $1 5 \%$ of input tokens in each iteration. To predict all tokens, we have to run at least $1 / 0 . 1 5 = 6 . 7 $ epochs. For LM, each iteration can predict all tokens, which is more efficient for large-scale pre-training data. In Hu et al. (2021a), the ablation studies also show that LM can achieve better performance with limited epochs. In our large-scale training, the number of epoch is only 2 due to computational resource limitation, and thus we choose LM. Meanwhile, most of the recent large-scale language models are also based on LM, e.g. Brown et al. (2020); Chowdhery et al. (2022).
|
| 88 |
+
|
| 89 |
+
Without the image input, the model is reduced to a decoder-only language model, similar to GPT3 (Brown et al., 2020) in the architecture wise. Thus, this design also enables the possibility to leverage the text-only data to enrich the decoding capability with a scaled-up decoder. We leave this as future work.
|
| 90 |
+
|
| 91 |
+
# 3.3 Fine-tuning
|
| 92 |
+
|
| 93 |
+
For the image captioning task, as the training data format is the same as that in pre-training, we apply the same LM task to fine-tune our GIT.
|
| 94 |
+
|
| 95 |
+
For visual question answering, the question and the ground-truth answer are concatenated as a new special caption during the fine-tuning, but the LM loss is only applied on the answer and the [EOS] tokens. During inference, the question is interpreted as the caption prefix and the completed part is the prediction. Compared with the existing approaches (Wang et al., 2021a;b; Zhang et al., 2021a; Li et al., 2022b) for VQAv2 (Goyal et al., 2017), our model is generative without pre-defining the candidate answers, even in inference. This imposes more challenges as the model has to predict at least two correct tokens: one for the answer and another for [EOS]. In contrast, the existing work pre-collects the answer candidate, recasts the problem as a classification problem, and only needs to predict once. However, considering the benefit of the free-form answer, we choose the generative approach. Due to difficulty of the generative model, we observe slightly worse performance on VQAv2 than the discriminative existing work. For the scene-text related VQA tasks, existing approaches (Yang et al., 2021c; Hu et al., 2020) typically leverages the OCR engine to generate the scene text and use dynamic pointer network to decide the current output token should be OCR or the general text. Here, our approach depends on no OCR engine, and thus no dynamic pointer network. Empirically, we find the model gradually learns how to read the scene text with large-scale pre-training, and our model achieves new SoTA performance on these tasks.
|
| 96 |
+
|
| 97 |
+
Our model is not specifically designed for the video domain, but we find our model can also achieve competitive or even new SOTA performance with a simple architecture change. That is, we sample multiple frames from each video clip, and encode each frame via the image encoder independently. Afterwards, we add a learnable temporal embedding (initialized as zeros), and concatenate the features from sampled frames. The final representation is used in a similar way as the image representation for captioning and question answering.
|
| 98 |
+
|
| 99 |
+
We also apply our generation model to the image classification task, where the class names are interpreted as image captions, and our GIT is fine-tuned to predict the result in an auto-regressive way. This is different from existing work which normally pre-defines the vocabulary and uses a linear layer (with softmax) to predict the likelihood of each category. This new generation-based scheme is beneficial when new data and new categories are added to the existing dataset. In this case, the network can continuously train on the new data without introducing new parameters.
|
| 100 |
+
|
| 101 |
+
# 4 Experiments
|
| 102 |
+
|
| 103 |
+
# 4.1 Setting
|
| 104 |
+
|
| 105 |
+
We collect 0.8B image-text pairs for pre-training, which include COCO (Lin et al., 2014), Conceptual Captions (CC3M) (Sharma et al., 2018), SBU (Ordonez et al., 2011), Visual Genome (VG) (Krishna et al., 2016), Conceptual Captions (CC12M) (Changpinyo et al., 2021), ALT200M (Hu et al., 2021a), and an extra 0.6B data following a similar collection procedure in Hu et al. (2021a). The image encoder is initialized from the pre-trained contrastive model (Yuan et al., 2021). The hidden dimension ( $D$ ) is 768. The text decoder consists of 6 randomly-initialized transformer blocks. The total number of model parameters is 0.7 billion. The learning rates of the image encoder and the decoder are $1 e ^ { - 5 }$ and $5 e ^ { - 5 }$ , respectively, and follow the cosine decay to 0. The total number of epochs is 2. During inference, the beam size is 4 and the length penalty (Wu et al., 2016) is 0.6 by default.
|
| 106 |
+
|
| 107 |
+
Supplementary materials show results on two smaller model variants (GIT $_ B$ and GIT $L$ ) and one even larger model (GIT2) with full details. When comparing with existing approaches, the reference numbers are the best one reported in the corresponding paper unless explicitly specified.
|
| 108 |
+
|
| 109 |
+
# 4.2 Results on Image Captioning and Question Answering
|
| 110 |
+
|
| 111 |
+
We comprehensively evaluate the captioning performance on the widely-used Karpathy split (Karpathy & Li, 2015) of COCO (Lin et al., 2014) and Flickr30K (Young et al., 2014), the COCO test set, nocaps (Agrawal et al., 2019)2 which focuses on novel objects, TextCaps (Sidorov et al., 2020) which focuses on scene-text understanding, and VizWiz-Captions (Gurari et al., 2020) which focuses on the real use case by the visionimpaired people. The results in CIDEr (Vedantam et al., 2015) are shown in Table 2 and 3. From the results, we can see our model achieves the new SOTA performance on all these metrics except on COCO Karpathy test. On nocaps, compared with CoCa (Yu et al., 2022), our model is much smaller in the model size (0.7B vs 2.1B), but achieves higher performance (123.0 vs 120.6 in CIDEr). On Textcaps, our solution outperforms the previous SOTA (TAP Yang et al. (2021c)) by a breakthrough margin (28.5 points in CIDEr), and also surpasses the human performance for the first time. For zero/few-shot evaluation as shown in Table 3, our model can significantly benefit from more shots. With 32-shots, our approach is also better than Flamingo.
|
| 112 |
+
|
| 113 |
+
On VQA, the evaluation benchmarks include VQAv2 (Goyal et al., 2017), TextVQA (Singh et al., 2019), VizWiz-VQA (Gurari et al., 2018). ST-VQA (Biten et al., 2019), and OCR-VQA (Mishra et al., 2019). Before fine-tuning the model, we run an intermediate fine-tuning on the combination of the training data of VQAv2, TextVQA, ST-VQA, OCR-VQA, VizWiz-VQA, Visual Genome QA (Krishna et al., 2016), GQA (Hudson &
|
| 114 |
+
|
| 115 |
+
Table 2: Results on image captioning. \*: the nubmers are from Sidorov et al. (2020); CE: cross-entropy optimization. All numbers are CIDEr scores, and other metrics are shown in supplementary materials. #: winner entry of the CVPR 2021 workshop challenge Anc.-Cap.: Xu et al. (2021) AoANet: Huang et al. (2019) BUTD: Anderson et al. (2018), CoCa: Yu et al. (2022), DistillVLM: Fang et al. (2021c), Flamingo: Alayrac et al. (2022), Human: Agrawal et al. (2019), LEMON: Hu et al. (2021a), M4C-Cap.: Hu et al. (2020) MiniVLM: Wang et al. (2020), MTMA: Gong et al. (2021), OFA: Wang et al. (2022b), OSCAR: Li et al. (2020), UFO: Wang et al. (2021a), UniversalCap: (Cornia et al., 2021) ViTCap: Fang et al. (2021b), VinVL: Zhang et al. (2021a), VIVO: Hu et al. (2021b) SimVLM: Wang et al. (2021b), TAP: Yang et al. (2021c).
|
| 116 |
+
|
| 117 |
+
<table><tr><td>Method</td><td>CE</td></tr><tr><td>MiniVLM</td><td>119.8</td></tr><tr><td>DistillVLM</td><td>120.8</td></tr><tr><td>ViTCap</td><td>125.2</td></tr><tr><td>OSCAR</td><td>127.8</td></tr><tr><td>VinVL</td><td>130.8</td></tr><tr><td>UFO</td><td>131.2</td></tr><tr><td>Flamingo</td><td>138.1</td></tr><tr><td>LEMON</td><td>139.1</td></tr><tr><td>SimVLM</td><td>143.3</td></tr><tr><td>CoCa</td><td>143.6</td></tr><tr><td>OFA</td><td>145.3</td></tr><tr><td>GIT</td><td>144.8</td></tr></table>
|
| 118 |
+
|
| 119 |
+
(a) COCO Karp.
|
| 120 |
+
|
| 121 |
+
<table><tr><td>Method</td><td>Test</td></tr><tr><td>OSCAR</td><td>80.9</td></tr><tr><td>Human</td><td>85.3</td></tr><tr><td>VIVO</td><td>86.6</td></tr><tr><td>VinVL</td><td>92.5</td></tr><tr><td>UFO</td><td>92.3</td></tr><tr><td>SimVLM</td><td>115.2</td></tr><tr><td>LEMON</td><td>114.3</td></tr><tr><td>UniversalCap</td><td>119.3</td></tr><tr><td>CoCa</td><td>120.6</td></tr><tr><td>GIT</td><td>123.4</td></tr></table>
|
| 122 |
+
|
| 123 |
+
<table><tr><td>Method</td><td>C</td></tr><tr><td>BUTD</td><td>120.5</td></tr><tr><td>VinVL</td><td>138.7</td></tr><tr><td>GIT</td><td>148.8</td></tr><tr><td>(b) COCO test (c40)</td><td></td></tr><tr><td>Method</td><td>test-std</td></tr><tr><td>MTMA</td><td>94.1</td></tr><tr><td>GIT</td><td>114.4</td></tr></table>
|
| 124 |
+
|
| 125 |
+
(c) VizWiz-Captions
|
| 126 |
+
|
| 127 |
+
<table><tr><td>Method</td><td>Test</td></tr><tr><td>BUTD*</td><td>33.8</td></tr><tr><td>AoANet* M4C-Cap.* 81.0</td><td>34.6</td></tr><tr><td>Anc.-Cap.</td><td>87.4</td></tr><tr><td>TAP</td><td>103.2</td></tr><tr><td>TAP#</td><td>109.7</td></tr><tr><td>Human</td><td></td></tr><tr><td></td><td>125.5</td></tr><tr><td>GIT</td><td>138.2</td></tr><tr><td>(e)TextCaps</td><td></td></tr></table>
|
| 128 |
+
|
| 129 |
+
Table 3: Zero/Few/Full-shot evaluation on Flickr30K with Karpathy split.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>Shot</td><td>0</td><td>16</td><td>32</td><td>290 (1%)</td><td>full</td></tr><tr><td>Zhou et al. (2020)</td><td>1</td><td>1</td><td>1</td><td></td><td>68.5</td></tr><tr><td>Flamingo</td><td>67.2</td><td>78.9</td><td>75.4</td><td>1</td><td>1</td></tr><tr><td>GIT</td><td>49.6</td><td>78.0</td><td>80.5</td><td>86.6</td><td>98.5</td></tr></table>
|
| 132 |
+
|
| 133 |
+
Manning, 2019), and OK-VQA (Marino et al., 2019). To avoid data contamination, we remove the duplicate images of the test and validation set of the target benchmarks. As illustrated in Table 4, we achieve new SOTA on VizWiz-VQA and OCR-VQA, and same performance with prior SOTA of LaTr (Biten et al., 2022) on ST-VQA. Compared with the concurrent work of Flamingo (Alayrac et al., 2022), we achieve higher accuracy (+5.4) on TextVQA and lower (-3.29) on VQAv2. Note that Flamingo’s model size is 80B, which is 114 times of ours (0.7B). On VQAv2, we observe that our model performs worse in 1.5 points than the discriminative model of Florence (Yuan et al., 2021), which shares the same image encoder. The reason might be the increased difficulty of the generative model. That is, each correct answer requires at least two correct predictions (answer and [EOS]; 2.2 on average), while the discriminative model requires only one correct prediction. In (Wang et al., 2021b), the ablation study also shows the better performance by around 1 point than the discriminative counterpart. Another reason could be that the model of Florence for VQA leverages RoBerta (Liu et al., 2019) as the text encoder, which implicitly uses the text-only data to improve the performance.
|
| 134 |
+
|
| 135 |
+
# 4.3 Results on Video Captioning and Question Answering
|
| 136 |
+
|
| 137 |
+
On the video captioning task, the performance is evaluated on MSVD (Chen & Dolan, 2011) with the widely-used splits from Venugopalan et al. (2014), MSRVTT (Xu et al., 2016), YouCook2 (Zhou et al., 2018) (results in supplementary materials.) VATEX (Wang et al., 2019b), and TVC (Lei et al., 2020) (results in supplementary materials.). On VATEX, the performance is evaluated on both the public test and private test (evaluated on the server). Video QA is evaluated on MSVD-QA (Xu et al., 2017; Chen & Dolan, 2011), MSRVTT-QA (Xu et al., 2017; 2016), and TGIF-Frame (Jang et al., 2017), which are all open-ended tasks. The results are shown in Table 5 and Table 6 for captioning and QA, respectively. Although our model is not
|
| 138 |
+
|
| 139 |
+
Table 4: Results on visual question answering. (a): for VQAv2, approaches are divided according to whether the answer vocabulary is pre-defined (Closed) or not (Open) during inference. The model with closed vocabulary can be a classification model or generation model with constrained outputs, e.g., Wang et al. (2022b); Li et al. (2022b). The two numbers in parenthesis are the number of parameters and the number of images (the images for pre-trained modules are not counted) in VL pretraining. (b): for TextVQA, Mia (Qiao et al., 2021)# is the winner entry of TextVQA Challenge 2021 with a fine-tuned T5-3B (Raffel et al., 2020) model. (c): $\# \#$ : winner entry of 2021 VizWiz Grand Challenge Workshop. ALBEF: Li et al. (2021a), BLIP: Li et al. (2022b), BLOCK $^ +$ CNN+W2V: Mishra et al. (2019), CLIP-ViL: Shen et al. (2021), CoCa: Yu et al. (2022), CRN: Liu et al. (2020a), Flamingo: Alayrac et al. (2022), Florence: Yuan et al. (2021), LaAP-Net: Han et al. (2020), LaTr: Biten et al. (2022), M4C: Hu et al. (2020), M4C: Hu et al. (2020), METER: Dou et al. (2021), Mia: Qiao et al. (2021), mPlug: Li et al. (2022a), OSCAR: (Li et al., 2020), OFA: Wang et al. (2022b), UFO: Wang et al. (2021a), UNITER: (Chen et al., 2020b), UNIMO: Li et al. (2021c), SA-M4C: Kant et al. (2020), SimVLM: Wang et al. (2021b), SMA Gao et al. (2020), SMA: Gao et al. (2020), TAP: Yang et al. (2021c), VinVL: Zhang et al. (2021a), VILLA: Gan et al. (2020).
|
| 140 |
+
|
| 141 |
+
<table><tr><td colspan="2">VocabularyMethod</td><td>test-std</td><td>Method</td><td>test</td></tr><tr><td rowspan="10"></td><td>OSCAR</td><td>73.82</td><td>M4C</td><td>40.46</td></tr><tr><td>UNITER</td><td>74.02</td><td>LaAP-Net 41.41</td><td>SMA</td></tr><tr><td>VILLA</td><td>74.87</td><td>SA-M4C 44.6</td><td>CRN</td></tr><tr><td>UNIMO</td><td>75.27 SMA</td><td>45.51</td><td>LaAP</td></tr><tr><td>ALBEF</td><td>76.04</td><td>53.97</td><td>SA-M4</td></tr><tr><td>VinVL</td><td>76.60 76.76</td><td>Flamingo 54.1</td><td>TAP</td></tr><tr><td>UFO</td><td>Mia</td><td>73.67</td><td>LaTr</td></tr><tr><td>CLIP-ViL</td><td>GIT</td><td>59.75</td><td>GIT</td></tr><tr><td>METER BLIP</td><td></td><td>(b) TextVQA</td><td></td></tr><tr><td>SimVLM (-,1.8B)</td><td></td><td></td><td>Methc</td></tr><tr><td rowspan="5"></td><td>Florence (0.9B,14M)</td><td>Method</td><td>test</td><td>BLOC</td></tr><tr><td>mPlug (0.6B,14M)</td><td>81.26 (Liu et al., 2021)## 82.0</td><td></td><td>M4C</td></tr><tr><td>OFA (0.9B, 54M)</td><td>Flamingo</td><td>60.6</td><td>LaAP</td></tr><tr><td>CoCa (2.1B, 4.8B)</td><td>82.3</td><td>65.4</td><td>LaTr</td></tr><tr><td></td><td>GIT</td><td>67.5</td><td>GIT</td></tr><tr><td>Open</td><td>Flamingo (80B, 2.3B) GIT (0.7B, 0.8B)</td><td>82.1 78.81</td><td>(c)VizWiz-QA</td><td></td></tr></table>
|
| 142 |
+
|
| 143 |
+
<table><tr><td>Method</td></tr><tr><td>Test ANLS M4C 46.2</td></tr><tr><td>SMA 46.6</td></tr><tr><td>CRN 48.3</td></tr><tr><td>LaAP-Net 48.5</td></tr><tr><td>SA-M4C 50.4</td></tr><tr><td>TAP 59.7</td></tr><tr><td>LaTr 69.6</td></tr><tr><td>GIT 69.6</td></tr><tr><td>(d) ST-VQA</td></tr><tr><td>Method test</td></tr><tr><td>BLOCK+CNN+W2V 48.3</td></tr><tr><td>M4C 63.9</td></tr><tr><td>LaAP-Net 64.1</td></tr><tr><td>LaTr 67.9</td></tr><tr><td>GIT 68.1</td></tr></table>
|
| 144 |
+
|
| 145 |
+
(e) OCR-VQA
|
| 146 |
+
|
| 147 |
+
dedicated for video tasks, our model achieve new SOTA on MSRVD, MSRVTT, and VATEX for captioning and on MSVD-QA and TGIF-Frame for QA. For example on VATEX private test, our results are even better (93.8 vs 86.5) than CLIP4Caption $^ { + + }$ (Tang et al., 2021), which relies on model ensemble and additional subtitle input. This is also better than Flamingo (Alayrac et al., 2022) (84.2) with 80B parameters.
|
| 148 |
+
|
| 149 |
+
# 4.4 Results on Image Classification
|
| 150 |
+
|
| 151 |
+
We fine-tune GIT on ImageNet-1k. Each category is mapped to a unique class name, and the prediction is correct only if it is exactly matched with the ground-truth label subject to more or fewer whitespaces3. As shown in Table 7, our approach can achieve descent accuracy without pre-defining the vocabulary. Compared with Florence (Yuan et al., 2021) (same image encoder), our approach is worse in about 1.2 points. The reason might be similar to the case on VQAv2. That is, the generative approach needs to predict more tokens correctly to make one correct prediction, which increases the difficulty.
|
| 152 |
+
|
| 153 |
+
Zero-shot/Few-shot. The result is shown in Table 9. With no knowledge of the vocabulary, the pretrained GIT cannot infer the expected vocabulary, and thus the exactly-match accuracy is only $1 . 9 3 \%$ (in the column of equal). However, if we relax the requirement and take it correct if the prediction contains the ground-truth, the accuracy is $4 0 . 8 8 \%$ (in the column of $i n$ ), which shows the predicted caption can well identify the image content. If we have the vocabulary as a prior and limit the output tokens to be within the vocabulary, the accuracy drops to $3 3 . 4 8 \%$ (in the column of voc-prior). This may suggest the network is less natural to directly predict the category name. By fine-tuning the model with only 1 shot or 5 shots per category, we observe that the accuracy is significantly improved. This demonstrates our model can be easily adapted to downstream tasks even with a few training samples. With the shot increased from 1 to 5, the gap between voc-prior and the other two columns (equal and in) becomes smaller. This is expected as more shots can be better to guide the network to predict in-vocabulary output.
|
| 154 |
+
|
| 155 |
+
Table 5: Results on video captioning. E: model ensemble; $_ { x }$ : with the subtitle as additional input. C.4Cap.: Tang et al. (2021) GRU-EVE: Aafaq et al. (2019) MGSA: Chen & Jiang (2019) MGSA: Chen & Jiang (2019) MV-GPT: Seo et al. (2022) PickNet: Chen et al. (2018) PMI-CAP: Chen et al. (2020a) SibNet: Liu et al. (2020b) OA-BTG: Zhang & Peng (2019) ORG-TRL: Zhang et al. (2020) OpenBook: Zhang et al. (2021b) POS+VCT: Hou et al. (2019) POS+CG: Wang et al. (2019a) SAAT: Zheng et al. (2020), STG-KD: Pan et al. (2020) SwinBERT: Lin et al. (2021) Support-set: Patrick et al. (2021) VaTeX: Wang et al. (2019b) VALUE: Li et al. (2021b)
|
| 156 |
+
|
| 157 |
+
<table><tr><td>Method</td><td>B@4</td><td>C</td><td>Method</td><td>B@4</td><td>C</td></tr><tr><td>PickNet</td><td>52.3</td><td>76.5</td><td>SAAT</td><td>39.9</td><td>51.0</td></tr><tr><td>GRU-EVE</td><td>47.9</td><td>78.1</td><td>MGSA</td><td>42.4</td><td>47.5</td></tr><tr><td>SAAT</td><td>46.5</td><td>81.0</td><td>POS+VCT</td><td>42.3</td><td>49.1</td></tr><tr><td>MGSA</td><td>53.4</td><td>86.7</td><td>SibNet</td><td>40.9</td><td>47.5</td></tr><tr><td>POS+VCT</td><td>52.8</td><td>87.8</td><td>POS+CG</td><td>42.0</td><td>48.7</td></tr><tr><td>SibNet</td><td>54.2</td><td>88.2</td><td>OA-BTG</td><td>41.4</td><td>46.9</td></tr><tr><td>POS+CG</td><td>52.5</td><td>88.7</td><td>STG-KD</td><td>40.5</td><td>47.1</td></tr><tr><td>OA-BTG</td><td>56.9</td><td>90.6</td><td>Support-set</td><td>38.9</td><td>48.6</td></tr><tr><td>STG-KD</td><td>52.2</td><td>93.0</td><td>PMI-CAP</td><td>42.1</td><td>49.4</td></tr><tr><td>PMI-CAP</td><td>54.6</td><td>95.1</td><td>ORG-TRL</td><td>43.6</td><td>50.9</td></tr><tr><td>ORG-TRL</td><td>54.3</td><td>95.2</td><td>OpenBook</td><td>33.9</td><td>52.9</td></tr><tr><td>SwinBERT</td><td>58.2</td><td>120.6</td><td>SwinBERT</td><td>41.9</td><td>53.8</td></tr><tr><td>GIT</td><td>79.5</td><td>180.2</td><td>MV-GPTT</td><td>48.9 60</td><td>F</td></tr><tr><td colspan="2">(a) MSVD</td><td></td><td>GIT</td><td>53.8 73.9</td><td></td></tr></table>
|
| 158 |
+
|
| 159 |
+
(a) VATEX public test
|
| 160 |
+
|
| 161 |
+
<table><tr><td>Method</td><td>C</td></tr><tr><td>X-L.+T.E</td><td>81.4</td></tr><tr><td>Flamingo C.4Cap.ET</td><td>84.2 86.5</td></tr><tr><td>GIT</td><td>93.8</td></tr></table>
|
| 162 |
+
|
| 163 |
+
(e) VATEX private test
|
| 164 |
+
|
| 165 |
+
Table 6: Results on video question answering. All are open-ended question answering tasks. All-in-one: Wang et al. (2022a), ClipBERT: Lei et al. (2021), CoMVT: Seo et al. (2021), Flamingo: Alayrac et al. (2022), JustAsk: Yang et al. (2021a), MERLOT: Zellers et al. (2021), MV-GPT: Seo et al. (2022), QueST: Jiang et al. (2020), HCRN: Le et al. (2021), VIOLET: Fu et al. (2021).
|
| 166 |
+
|
| 167 |
+
<table><tr><td>Method</td><td>Accuracy</td><td>Method</td><td>Accuracy</td><td>Method</td><td>Accuracy</td></tr><tr><td>QueST</td><td>34.6</td><td>JustAsk</td><td>41.5</td><td>HCRN</td><td>55.9</td></tr><tr><td>HCRN</td><td>36.1</td><td>MV-GPT</td><td>41.7</td><td>QueST</td><td>59.7</td></tr><tr><td>CoMVT</td><td>42.6</td><td>MERLOT</td><td>43.1</td><td>ClipBERT</td><td>60.3</td></tr><tr><td>JustAsk</td><td>46.3</td><td>VIOLET</td><td>43.9</td><td>All-in-one</td><td>66.3</td></tr><tr><td>VIOLET</td><td>47.9</td><td>All-in-one</td><td>46.8</td><td>VIOLET</td><td>68.9</td></tr><tr><td>All-in-one</td><td>48.3</td><td>Flamingo</td><td>47.4</td><td>MERLOT</td><td>69.5</td></tr><tr><td>GIT</td><td>56.8</td><td>GIT</td><td>43.2</td><td>GIT</td><td>72.8</td></tr><tr><td colspan="2">(a) MSVD-QA</td><td colspan="2">(b) MSRVTT-QA</td><td colspan="2">(c) TGIF-Frame</td></tr></table>
|
| 168 |
+
|
| 169 |
+
Compared with Flamingo, our GIT achieves higher accuracy. Flamingo conducts the few-shot learning without parameter update, but each test image is combined with the support training examples as extra network inputs. Meanwhile, different test image requires different support shots based on Yang et al. (2022). These may increase the inference cost. In contrast, our model updates the parameters by a lightweight fine-tuning once, and then all these training shots are not required during inference.
|
| 170 |
+
|
| 171 |
+
# 4.5 Results on Scene Text Recognition
|
| 172 |
+
|
| 173 |
+
The task (Graves et al., 2006) aims to read scene text directly from the image. We evaluate our model in two settings. One is the GIT fine-tuned on TextCaps. The prediction is considered correct if the caption contains the ground-truth scene text word. The other is to fine-tune the model on two large scene text datasets: MJSynth (MJ) (Jaderberg et al., 2014; 2016) and SynthText (ST) (Gupta et al., 2016), where the ground-truth scene text is used as the caption. The prediction is correct if the output is the exact match to the ground-truth. Following the established setup, we evaluate on six standard benchmarks, including ICDAR 2013 (IC13) (Karatzas et al., 2013), ICDAR 2015 (IC15) (Karatzas et al., 2015), IIIT 5K-Words (IIIT) (Mishra et al., 2012), Street View Text (SVT) (Wang et al., 2011), Street View Text-Perspective (SVTP) (Phan et al., 2013), and CUTE80 (CUTE) (Risnumawan et al., 2014). The average accuracy is reported in Table 8. The accuracy on individual test sets is in supplementary materials. Our TextCaps-fine-tuned captioning model achieves an 89.9 accuracy, which demonstrates the strong scene text comprehension capability of our captioning model. After fine-tuning the model on the standard MJ $^ +$ ST datasets, GIT achieves 92.9 that surpasses the prior arts (Fang et al., 2021a; He et al., 2022) of 91.9.
|
| 174 |
+
|
| 175 |
+
Table 7: Results on ImageNet-1k classification task. Our approach takes the class name as the caption and predict the label in an auto-regressive way without pre-defining the vocabulary.
|
| 176 |
+
|
| 177 |
+
<table><tr><td colspan="2">VocabularyMethod</td></tr><tr><td>Closed</td><td>Top-1 ALIGN (Jia et al., 2021) 88.64</td></tr><tr><td rowspan="2"></td><td>Florence (Yuan et al.,2021) 90.05</td></tr><tr><td>CoCa (Yu et al., 2022) 91.0</td></tr><tr><td>Open GIT</td><td>88.79</td></tr></table>
|
| 178 |
+
|
| 179 |
+
Table 8: Results on scene text recognition. MJ and ST indicate the MJSynth (MJ) (Jaderberg et al., 2014; 2016) and SynthText (ST) (Gupta et al., 2016) datasets used for training scene text recognition models.
|
| 180 |
+
|
| 181 |
+
<table><tr><td>Method</td><td>FT data</td><td>Average</td></tr><tr><td>SAM (Liao et al., 2019)</td><td>MJ+ST</td><td>87.8</td></tr><tr><td>Ro.Scanner (Yue et al., 2020) SRN (Yu et al., 2020)</td><td>MJ+ST</td><td>87.5</td></tr><tr><td>ABINet (Fang et al., 2021a)</td><td>MJ+ST</td><td>89.6</td></tr><tr><td>S-GTR (He et al., 2022)</td><td>MJ+ST</td><td>91.9</td></tr><tr><td></td><td>MJ+ST</td><td>91.9</td></tr><tr><td>MaskOCR (Lyu et al., 2022)</td><td>MJ+ST</td><td>93.8</td></tr><tr><td>GIT</td><td>Text+aT</td><td>9.9</td></tr></table>
|
| 182 |
+
|
| 183 |
+
Table 9: Zero/Few-shot evaluation on ImageNet with 3 metrics. equal: the unrestricted prediction should be exactly matched to the ground-truth. in: the unrestricted prediction should contain the ground-truth label name. voc-prior: the vocabulary is pre-defined as a prior. For our GIT, a trie structure is constructed motivated from Wang et al. (2022b) to limit the candidate tokens during each token prediction, such that the predicted result is guaranteed to be within the vocabulary.
|
| 184 |
+
|
| 185 |
+
<table><tr><td></td><td colspan="3">Zero-shot</td><td colspan="3">1-shot per class</td><td colspan="3"> 5-shot per class</td></tr><tr><td> Accuracy type</td><td>equal</td><td>in</td><td>voc-prior</td><td>equal</td><td>in</td><td>voc-prior</td><td>equal</td><td>in</td><td>voc-prior</td></tr><tr><td>Flamingo</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>71.7</td><td>1</td><td>1</td><td>77.3</td></tr><tr><td>GIT</td><td>1.93</td><td>40.88</td><td>33.48</td><td>64.54</td><td>66.76</td><td>72.45</td><td>79.79</td><td>80.15</td><td>80.95</td></tr></table>
|
| 186 |
+
|
| 187 |
+
# 4.6 Analysis
|
| 188 |
+
|
| 189 |
+
Model and data scaling. To study the trending with data scales, we construct two smaller pre-training datasets: one is the combination of COCO, SBU, CC3M and VG, leading to 4M images or 10M image-text pairs; the other is to further combine CC12M, leading to about 14M images or 20M image-text pairs. When pre-training on small-scale datasets, we use 30 epochs rather than 2 epochs as on the 0.8B data. For the network structure, we name our model as Huge and replace the image encoder with ViT-B/16 and ViT-L/14 from CLIP Radford et al. (2021) as Base and Large, respectively. Fig. 4 shows the results on COCO, TextCaps, and VizWiz-QA. On COCO, the base model benefits from 4M to 14M, but the performance drops with 0.8B data. The 14M data are more similar to COCO than the majority of the noisy 0.8B data. Meanwhile, the Base model with limited capacity may not be able to benefit effectively from large-scale data. Similar observations are also reported in Kolesnikov et al. (2020) for ImageNet-1k classification. On TextCaps and VizWiz-QA, all model variants benefit significantly from more pre-training data. Also, a larger backbone improves more especially with 0.8B data.
|
| 190 |
+
|
| 191 |
+

|
| 192 |
+
Figure 4: Performance with different pre-training data scales and different model sizes.
|
| 193 |
+
|
| 194 |
+
Table 10: Ablation study of larger text decoders. The models are pre-trained on a subset of 0.4B image-text pairs. No beam search and no SCST are performed.
|
| 195 |
+
|
| 196 |
+
<table><tr><td rowspan="2">Layers</td><td colspan="4">CoCo</td><td colspan="2">nocaps</td></tr><tr><td>B@4</td><td>M</td><td>C</td><td>S</td><td>C</td><td>S</td></tr><tr><td>6</td><td>38.9</td><td>30.7</td><td>136.4</td><td>24.6</td><td>119.3</td><td>15.9</td></tr><tr><td>12</td><td>38.9</td><td>30.6</td><td>136.0</td><td>24.2</td><td>118.1</td><td>15.5</td></tr><tr><td>24</td><td>39.1</td><td>30.2</td><td>134.6</td><td>23.8</td><td>115.4</td><td>15.1</td></tr></table>
|
| 197 |
+
|
| 198 |
+
Here, we scale the image encoder. Empirically, we find it is difficult to effectively scale up the text decoder. Preliminary results are shown in Table 10, which shows a larger decoder shows no improvement. The reason might be that it is difficult to effectively train with limited amount of text by LM. Another plausible reason is that the image encoder is responsible for object recognition, and the decoder is responsible for organizing the object terms in a natural language way. The latter task might be easy since most of the descriptions follow similar patterns, e.g. object $^ +$ verb $^ +$ subject, and thus a small decoder is enough during end-to-end training. Larger decoders increase the learning difficulty, which might degrade the performance.
|
| 199 |
+
|
| 200 |
+
Flamingo (Alayrac et al., 2022) shows a larger decoder improves the performance. However, their decoder is pre-trained and frozen during the VL pre-training, which avoids the problem of how to effectively train the decoder. In LEMON (Hu et al., 2021a), the transformer can be scaled up to 32 layers. The reason could be that LEMON uses MLM, instead of LM, which might be more difficult to train.
|
| 201 |
+
|
| 202 |
+
Scene text in pre-training data. To understand the capability of scene text comprehension, we examine the pre-training dataset and study how many image-text pairs contain the scene text. We first run the Microsoft Azure OCR API $^ 4$ against all images in CC12M and 500K images in the web crawled images. The OCR result is compared with the associated text. It is considered matched only if the text contains an OCR result that is longer than 5 characters. It is estimated that $1 5 \%$ of CC12M and $3 1 \%$ of the downloaded images contain scene text descriptions. As the training task is to predict the texts, the network gradually learns to read the scene text.
|
| 203 |
+
|
| 204 |
+
# 5 Conclusion
|
| 205 |
+
|
| 206 |
+
In the paper, we design and train a simple generative model, named GIT, to map the input image to the associated text description on large-scale image-text pairs. On image/video captioning and question answering tasks, our model achieves new state-of-the-art performance across numerous benchmarks and surpasses the human performance on TextCaps for the first time. For the image classification, we apply the generation task to predict the label name directly. The strategy is different from the existing work with a pre-defined and fixed vocabulary, and is beneficial especially when new category data are added.
|
| 207 |
+
|
| 208 |
+
Limitations. We focus on the pretraining-and-finetuning strategy to improve the absolute performance. Empirically, we find it is unclear on how to control the generated caption and how to perform in-context learning without parameter update, which we leave as future work.
|
| 209 |
+
|
| 210 |
+
Societal impact. Compared with the existing work, our model clearly improves the performance and be more appropriate to help visually-impaired people. The model is pre-trained on large-scale data, and the data are not guaranteed to contain no toxic language, which may poison the output. Although we observe few such instances qualitatively, special care should be taken to deploy the model in practice and more research exploration is required to control the output.
|
| 211 |
+
|
| 212 |
+
# References
|
| 213 |
+
|
| 214 |
+
Nayyer Aafaq, Naveed Akhtar, Wei Liu, Syed Zulqarnain Gilani, and Ajmal Mian. Spatio-temporal dynamics and semantic attribute enriched visual encoding for video captioning. In CVPR, 2019.
|
| 215 |
+
Harsh Agrawal, Karan Desai, Yufei Wang, Xinlei Chen, Rishabh Jain, Mark Johnson, Dhruv Batra, Devi Parikh, Stefan Lee, and Peter Anderson. nocaps: novel object captioning at scale. In ICCV, 2019.
|
| 216 |
+
Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022.
|
| 217 |
+
Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In CVPR, 2018.
|
| 218 |
+
Ali Furkan Biten, Ruben Tito, Andres Mafla, Lluis Gomez, Marçal Rusinol, Ernest Valveny, CV Jawahar, and Dimosthenis Karatzas. Scene text visual question answering. In ICCV, 2019.
|
| 219 |
+
Ali Furkan Biten, Ron Litman, Yusheng Xie, Srikar Appalaraju, and R Manmatha. Latr: Layout-aware transformer for scene-text vqa. In CVPR, 2022.
|
| 220 |
+
Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 221 |
+
Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12M: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021.
|
| 222 |
+
David Chen and William Dolan. Collecting highly parallel data for paraphrase evaluation. In ACL, 2011.
|
| 223 |
+
Shaoxiang Chen and Yu-Gang Jiang. Motion guided spatial attention for video captioning. In AAAI, 2019.
|
| 224 |
+
Shaoxiang Chen, Wenhao Jiang, Wei Liu, and Yu-Gang Jiang. Learning modality interaction for temporal sentence localization and event captioning in videos. In ECCV, 2020a.
|
| 225 |
+
Yangyu Chen, Shuhui Wang, Weigang Zhang, and Qingming Huang. Less is more: Picking informative frames for video captioning. In ECCV, 2018.
|
| 226 |
+
Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. UNITER: universal image-text representation learning. In ECCV, 2020b.
|
| 227 |
+
Jaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. In ICML, 2021.
|
| 228 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
|
| 229 |
+
|
| 230 |
+
Marcella Cornia, Lorenzo Baraldi, Giuseppe Fiameni, and Rita Cucchiara. Universal captioner: Long-tail vision-and-language model training through content-style separation. arXiv preprint arXiv:2111.12727, 2021.
|
| 231 |
+
|
| 232 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
|
| 233 |
+
Zi-Yi Dou, Yichong Xu, Zhe Gan, Jianfeng Wang, Shuohang Wang, Lijuan Wang, Chenguang Zhu, Pengchuan Zhang, Lu Yuan, Nanyun Peng, Zicheng Liu, and Michael Zeng. An empirical study of training end-to-end vision-and-language transformers. arXiv preprint arXiv: 2111.02387, 2021.
|
| 234 |
+
Shancheng Fang, Hongtao Xie, Yuxin Wang, Zhendong Mao, and Yongdong Zhang. Read like humans: autonomous, bidirectional and iterative language modeling for scene text recognition. In CVPR, 2021a.
|
| 235 |
+
Zhiyuan Fang, Jianfeng Wang, Xiaowei Hu, Lin Liang, Zhe Gan, Lijuan Wang, Yezhou Yang, and Zicheng Liu. Injecting semantic concepts into end-to-end image captioning. arXiv preprint arXiv:2112.05230, 2021b.
|
| 236 |
+
Zhiyuan Fang, Jianfeng Wang, Xiaowei Hu, Lijuan Wang, Yezhou Yang, and Zicheng Liu. Compressing visual-linguistic model via knowledge distillation. In ICCV, 2021c.
|
| 237 |
+
Tsu-Jui Fu, Linjie Li, Zhe Gan, Kevin Lin, William Yang Wang, Lijuan Wang, and Zicheng Liu. VIOLET : Endto-end video-language transformers with masked visual-token modeling. arXiv preprint arXiv:2111.12681, 2021.
|
| 238 |
+
Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning. In NeurIPS, 2020.
|
| 239 |
+
Chenyu Gao, Qi Zhu, Peng Wang, Hui Li, Yuliang Liu, Anton van den Hengel, and Qi Wu. Structured multimodal attentions for textvqa. arXiv preprint arXiv:2006.00753, 2020.
|
| 240 |
+
Xuchao Gong, Hongji Zhu, Yongliang Wang, Biaolong Chen, Aixi Zhang, Fangxun Shu, and Si Liu. Multiple transformer mining for vizwiz image caption. In 2021 VizWiz Grand Challenge Workshop, 2021.
|
| 241 |
+
Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the V in VQA matter: Elevating the role of image understanding in visual question answering. In CVPR, 2017.
|
| 242 |
+
Alex Graves, Santiago Fernández, Faustino Gomez, and Jürgen Schmidhuber. Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks. In ICML, 2006.
|
| 243 |
+
Ankush Gupta, Andrea Vedaldi, and Andrew Zisserman. Synthetic data for text localisation in natural images. In CVPR, pp. 2315–2324, 2016.
|
| 244 |
+
Danna Gurari, Qing Li, Abigale J. Stangl, Anhong Guo, Chi Lin, Kristen Grauman, Jiebo Luo, and Jeffrey P. Bigham. Vizwiz grand challenge: Answering visual questions from blind people. In CVPR, 2018.
|
| 245 |
+
Danna Gurari, Yinan Zhao, Meng Zhang, and Nilavra Bhattacharya. Captioning images taken by people who are blind. arXiv preprint arXiv:2002.08565, 2020.
|
| 246 |
+
Wei Han, Hantao Huang, and Tao Han. Finding the evidence: Localization-aware answer prediction for text visual question answering. In COLING, 2020.
|
| 247 |
+
Yue He, Chen Chen, Jing Zhang, Juhua Liu, Fengxiang He, Chaoyue Wang, and Bo Du. Visual semantics allow for textual reasoning better in scene text recognition. In AAAI, 2022.
|
| 248 |
+
Jingyi Hou, Xinxiao Wu, Wentian Zhao, Jiebo Luo, and Yunde Jia. Joint syntax representation learning and visual cue translation for video captioning. In ICCV, 2019.
|
| 249 |
+
Ronghang Hu, Amanpreet Singh, Trevor Darrell, and Marcus Rohrbach. Iterative answer prediction with pointer-augmented multimodal transformers for textvqa. In CVPR, 2020.
|
| 250 |
+
Xiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. arXiv preprint arXiv:2111.12233, 2021a.
|
| 251 |
+
Xiaowei Hu, Xi Yin, Kevin Lin, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. VIVO: surpassing human performance in novel object captioning with visual vocabulary pre-training. In AAAI, 2021b.
|
| 252 |
+
Lun Huang, Wenmin Wang, Jie Chen, and Xiao-Yong Wei. Attention on attention for image captioning. In ICCV, 2019.
|
| 253 |
+
Zhicheng Huang, Zhaoyang Zeng, Bei Liu, Dongmei Fu, and Jianlong Fu. Pixel-bert: Aligning image pixels with text by deep multi-modal transformers. arXiv preprint arXiv:2004.00849, 2020.
|
| 254 |
+
Drew A. Hudson and Christopher D. Manning. GQA: A new dataset for real-world visual reasoning and compositional question answering. In CVPR, 2019.
|
| 255 |
+
Max Jaderberg, Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Synthetic data and artificial neural networks for natural scene text recognition. arXiv preprint arXiv:1406.2227, 2014.
|
| 256 |
+
Max Jaderberg, Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Reading text in the wild with convolutional neural networks. IJCV, 2016.
|
| 257 |
+
Yunseok Jang, Yale Song, Youngjae Yu, Youngjin Kim, and Gunhee Kim. TGIF-QA: toward spatio-temporal reasoning in visual question answering. In CVPR, 2017.
|
| 258 |
+
Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In ICML, 2021.
|
| 259 |
+
Jianwen Jiang, Ziqiang Chen, Haojie Lin, Xibin Zhao, and Yue Gao. Divide and conquer: Question-guided spatio-temporal contextual attention for video question answering. In AAAI, 2020.
|
| 260 |
+
Yash Kant, Dhruv Batra, Peter Anderson, Alexander G. Schwing, Devi Parikh, Jiasen Lu, and Harsh Agrawal. Spatially aware multimodal transformers for textvqa. In ECCV, 2020.
|
| 261 |
+
Dimosthenis Karatzas, Faisal Shafait, Seiichi Uchida, Masakazu Iwamura, Lluis Gomez i Bigorda, Sergi Robles Mestre, Joan Mas, David Fernandez Mota, Jon Almazan Almazan, and Lluis Pere De Las Heras. Icdar 2013 robust reading competition. In ICDAR, 2013.
|
| 262 |
+
Dimosthenis Karatzas, Lluis Gomez-Bigorda, Anguelos Nicolaou, Suman Ghosh, Andrew Bagdanov, Masakazu Iwamura, Jiri Matas, Lukas Neumann, Vijay Ramaseshan Chandrasekhar, Shijian Lu, et al. Icdar 2015 competition on robust reading. In ICDAR, 2015.
|
| 263 |
+
Andrej Karpathy and Fei-Fei Li. Deep visual-semantic alignments for generating image descriptions. In CVPR, 2015.
|
| 264 |
+
Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In ICML, 2021.
|
| 265 |
+
Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In ECCV, 2020.
|
| 266 |
+
Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A. Shamma, Michael S. Bernstein, and Fei-Fei Li. Visual genome: Connecting language and vision using crowdsourced dense image annotations. arXiv preprint arXiv:1602.07332, 2016.
|
| 267 |
+
Thao Minh Le, Vuong Le, Svetha Venkatesh, and Truyen Tran. Hierarchical conditional relation networks for multimodal video question answering. IJCV, 2021.
|
| 268 |
+
Jie Lei, Licheng Yu, Tamara L Berg, and Mohit Bansal. Tvr: A large-scale dataset for video-subtitle moment retrieval. In ECCV, 2020.
|
| 269 |
+
|
| 270 |
+
Jie Lei, Linjie Li, Luowei Zhou, Zhe Gan, Tamara L. Berg, Mohit Bansal, and Jingjing Liu. Less is more: Clipbert for video-and-language learning via sparse sampling. In CVPR, 2021.
|
| 271 |
+
|
| 272 |
+
Chenliang Li, Haiyang Xu, Junfeng Tian, Wei Wang, Ming Yan, Bin Bi, Jiabo Ye, Hehong Chen, Guohai Xu, Zheng Cao, et al. mplug: Effective and efficient vision-language learning by cross-modal skip-connections. arXiv preprint arXiv:2205.12005, 2022a.
|
| 273 |
+
Junnan Li, Ramprasaath R Selvaraju, Akhilesh Deepak Gotmare, Shafiq Joty, Caiming Xiong, and Steven Hoi. Align before fuse: Vision and language representation learning with momentum distillation. In NeurIPS, 2021a.
|
| 274 |
+
Junnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. BLIP: bootstrapping language-image pretraining for unified vision-language understanding and generation. arXiv preprint arXiv:2201.12086, 2022b.
|
| 275 |
+
Linjie Li, Jie Lei, Zhe Gan, Licheng Yu, Yen-Chun Chen, Rohit Pillai, Yu Cheng, Luowei Zhou, Xin Eric Wang, William Yang Wang, et al. Value: A multi-task benchmark for video-and-language understanding evaluation. In NeurIPS, 2021b.
|
| 276 |
+
Wei Li, Can Gao, Guocheng Niu, Xinyan Xiao, Hao Liu, Jiachen Liu, Hua Wu, and Haifeng Wang. Unimo: Towards unified-modal understanding and generation via cross-modal contrastive learning. In ACL, 2021c.
|
| 277 |
+
Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, Yejin Choi, and Jianfeng Gao. Oscar: Object-semantics aligned pre-training for vision-language tasks. In ECCV, 2020.
|
| 278 |
+
Minghui Liao, Pengyuan Lyu, Minghang He, Cong Yao, Wenhao Wu, and Xiang Bai. Mask textspotter: An end-to-end trainable neural network for spotting text with arbitrary shapes. PAMI, 2019.
|
| 279 |
+
Kevin Lin, Linjie Li, Chung-Ching Lin, Faisal Ahmed, Zhe Gan, Zicheng Liu, Yumao Lu, and Lijuan Wang. Swinbert: End-to-end transformers with sparse attention for video captioning. arXiv preprint arXiv:2111.13196, 2021.
|
| 280 |
+
Tsung-Yi Lin, Michael Maire, Serge J. Belongie, Lubomir D. Bourdev, Ross B. Girshick, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C. Lawrence Zitnick. Microsoft COCO: common objects in context. arXiv preprint arXiv:1405.0312, 2014.
|
| 281 |
+
Fen Liu, Guanghui Xu, Qi Wu, Qing Du, Wei Jia, and Mingkui Tan. Cascade reasoning network for text-based visual question answering. In Chang Wen Chen, Rita Cucchiara, Xian-Sheng Hua, Guo-Jun Qi, Elisa Ricci, Zhengyou Zhang, and Roger Zimmermann (eds.), ACM MM, 2020a.
|
| 282 |
+
Sheng Liu, Zhou Ren, and Junsong Yuan. Sibnet: Sibling convolutional encoder for video captioning. IEEE TPAMI, 2020b.
|
| 283 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 284 |
+
Yu Liu, Lianghua Huang, Liuyihang Song, Bin Wang, Yingya Zhang, and Pan Pan. Enhancing textual cues in multi-modal transformers for vqa. In 2021 VizWiz Grand Challenge Workshop, 2021.
|
| 285 |
+
Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In NeurIPS, 2019.
|
| 286 |
+
Pengyuan Lyu, Chengquan Zhang, Shanshan Liu, Meina Qiao, Yangliu Xu, Liang Wu, Kun Yao, Junyu Han, Errui Ding, and Jingdong Wang. Maskocr: Text recognition with masked encoder-decoder pretraining. arXiv preprint arXiv:2206.00311, 2022.
|
| 287 |
+
Kenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. Ok-vqa: A visual question
|
| 288 |
+
|
| 289 |
+
answering benchmark requiring external knowledge. In CVPR, 2019.
|
| 290 |
+
|
| 291 |
+
Anand Mishra, Karteek Alahari, and CV Jawahar. Scene text recognition using higher order language priors. In BMVC, 2012.
|
| 292 |
+
Anand Mishra, Shashank Shekhar, Ajeet Kumar Singh, and Anirban Chakraborty. Ocr-vqa: Visual question answering by reading text in images. In ICDAR, 2019.
|
| 293 |
+
Vicente Ordonez, Girish Kulkarni, and Tamara L. Berg. Im2text: Describing images using 1 million captioned photographs. In NeurIPS, 2011.
|
| 294 |
+
Boxiao Pan, Haoye Cai, De-An Huang, Kuan-Hui Lee, Adrien Gaidon, Ehsan Adeli, and Juan Carlos Niebles. Spatio-temporal graph for video captioning with knowledge distillation. In CVPR, 2020.
|
| 295 |
+
Mandela Patrick, Po-Yao Huang, Yuki Asano, Florian Metze, Alexander Hauptmann, Joao Henriques, and Andrea Vedaldi. Support-set bottlenecks for video-text representation learning. In ICLR, 2021.
|
| 296 |
+
Trung Quy Phan, Palaiahnakote Shivakumara, Shangxuan Tian, and Chew Lim Tan. Recognizing text with perspective distortion in natural scenes. In ICCV, 2013.
|
| 297 |
+
Yixuan Qiao, Hao Chen, Jun Wang, Yihao Chen, Xianbin Ye, Ziliang Li, Xianbiao Qi, Peng Gao, and Guotong Xie. Winner team mia at textvqa challenge 2021: Vision-and-language representation learning with pre-trained sequence-to-sequence model. arXiv preprint arXiv:2106.15332, 2021.
|
| 298 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In ICML, 2021.
|
| 299 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 2020.
|
| 300 |
+
Anhar Risnumawan, Palaiahankote Shivakumara, Chee Seng Chan, and Chew Lim Tan. A robust arbitrary text detection system for natural scene images. Expert Systems with Applications, 2014.
|
| 301 |
+
Paul Hongsuck Seo, Arsha Nagrani, and Cordelia Schmid. Look before you speak: Visually contextualized utterances. In CVPR, 2021.
|
| 302 |
+
Paul Hongsuck Seo, Arsha Nagrani, Anurag Arnab, and Cordelia Schmid. End-to-end generative pretraining for multimodal video captioning. arXiv preprint arXiv:2201.08264, 2022.
|
| 303 |
+
Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In ACL, 2018.
|
| 304 |
+
Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can CLIP benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021.
|
| 305 |
+
Oleksii Sidorov, Ronghang Hu, Marcus Rohrbach, and Amanpreet Singh. Textcaps: a dataset for image captioning with reading comprehension. In ECCV, 2020.
|
| 306 |
+
Amanpreet Singh, Vivek Natarajan, Meet Shah, Yu Jiang, Xinlei Chen, Dhruv Batra, Devi Parikh, and Marcus Rohrbach. Towards vqa models that can read. In CVPR, 2019.
|
| 307 |
+
Hao Tan and Mohit Bansal. LXMERT: learning cross-modality encoder representations from transformers. In EMNLP, 2019.
|
| 308 |
+
Mingkang Tang, Zhanyu Wang, Zhaoyang Zeng, Fengyun Rao, and Dian Li. Clip4caption $^ { + + }$ : Multi-clip for video caption. arXiv preprint arXiv:2110.05204, 2021.
|
| 309 |
+
Ramakrishna Vedantam, C. Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In CVPR, 2015.
|
| 310 |
+
Subhashini Venugopalan, Huijuan Xu, Jeff Donahue, Marcus Rohrbach, Raymond J. Mooney, and Kate Saenko. Translating videos to natural language using deep recurrent neural networks. arXiv preprint arXiv:1412.4729, 2014.
|
| 311 |
+
Alex Jinpeng Wang, Yixiao Ge, Rui Yan, Yuying Ge, Xudong Lin, Guanyu Cai, Jianping Wu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. All in one: Exploring unified video-language pre-training. arXiv preprint arXiv:2203.07303, 2022a.
|
| 312 |
+
Bairui Wang, Lin Ma, Wei Zhang, Wenhao Jiang, Jingwen Wang, and Wei Liu. Controllable video captioning with pos sequence guidance based on gated fusion network. In ICCV, 2019a.
|
| 313 |
+
Jianfeng Wang, Xiaowei Hu, Pengchuan Zhang, Xiujun Li, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. Minivlm: A smaller and faster vision-language model. arXiv preprint arXiv:2012.06946, 2020.
|
| 314 |
+
Jianfeng Wang, Xiaowei Hu, Zhe Gan, Zhengyuan Yang, Xiyang Dai, Zicheng Liu, Yumao Lu, and Lijuan Wang. UFO: A unified transformer for vision-language representation learning. arXiv preprint arXiv:2111.10023, 2021a.
|
| 315 |
+
Kai Wang, Boris Babenko, and Serge Belongie. End-to-end scene text recognition. In ICCV, 2011.
|
| 316 |
+
Peng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Unifying architectures, tasks, and modalities through a simple sequence-to-sequence learning framework. arXiv preprint arXiv:2202.03052, 2022b.
|
| 317 |
+
Xin Wang, Jiawei Wu, Junkun Chen, Lei Li, Yuan-Fang Wang, and William Yang Wang. Vatex: A large-scale, high-quality multilingual dataset for video-and-language research. In ICCV, 2019b.
|
| 318 |
+
Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. arXiv preprint arXiv:2108.10904, 2021b.
|
| 319 |
+
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
|
| 320 |
+
Dejing Xu, Zhou Zhao, Jun Xiao, Fei Wu, Hanwang Zhang, Xiangnan He, and Yueting Zhuang. Video question answering via gradually refined attention over appearance and motion. In ACM Multimedia, 2017.
|
| 321 |
+
Guanghui Xu, Shuaicheng Niu, Mingkui Tan, Yucheng Luo, Qing Du, and Qi Wu. Towards accurate text-based image captioning with content diversity exploration. In CVPR, 2021.
|
| 322 |
+
Jun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In CVPR, 2016.
|
| 323 |
+
Hongwei Xue, Yupan Huang, Bei Liu, Houwen Peng, Jianlong Fu, Houqiang Li, and Jiebo Luo. Probing inter-modality: Visual parsing with self-attention for vision-language pre-training. In NeurIPS, 2021.
|
| 324 |
+
Antoine Yang, Antoine Miech, Josef Sivic, Ivan Laptev, and Cordelia Schmid. Just ask: Learning to answer questions from millions of narrated videos. In ICCV, 2021a.
|
| 325 |
+
Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Faisal Ahmed, Zicheng Liu, Yumao Lu, and Lijuan Wang. Crossing the format boundary of text and boxes: Towards unified vision-language modeling. arXiv preprint arXiv:2111.12085, 2021b.
|
| 326 |
+
Zhengyuan Yang, Yijuan Lu, Jianfeng Wang, Xi Yin, Dinei A. F. Florêncio, Lijuan Wang, Cha Zhang, Lei Zhang, and Jiebo Luo. TAP: text-aware pre-training for text-vqa and text-caption. In CVPR, 2021c.
|
| 327 |
+
Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of gpt-3 for few-shot knowledge-based vqa. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 3081–3089, 2022.
|
| 328 |
+
Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. Transactions of the Association for Computational Linguistics, 2014.
|
| 329 |
+
Deli Yu, Xuan Li, Chengquan Zhang, Tao Liu, Junyu Han, Jingtuo Liu, and Errui Ding. Towards accurate scene text recognition with semantic reasoning networks. In CVPR, 2020.
|
| 330 |
+
Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022.
|
| 331 |
+
Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, Ce Liu, Mengchen Liu, Zicheng Liu, Yumao Lu, Yu Shi, Lijuan Wang, Jianfeng Wang, Bin Xiao, Zhen Xiao, Jianwei Yang, Michael Zeng, Luowei Zhou, and Pengchuan Zhang. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021.
|
| 332 |
+
Xiaoyu Yue, Zhanghui Kuang, Chenhao Lin, Hongbin Sun, and Wayne Zhang. Robustscanner: Dynamically enhancing positional clues for robust text recognition. In ECCV, 2020.
|
| 333 |
+
Rowan Zellers, Ximing Lu, Jack Hessel, Youngjae Yu, Jae Sung Park, Jize Cao, Ali Farhadi, and Yejin Choi. MERLOT: multimodal neural script knowledge models. In NeurIPS, 2021.
|
| 334 |
+
Junchao Zhang and Yuxin Peng. Object-aware aggregation with bidirectional temporal graph for video captioning. In CVPR, 2019.
|
| 335 |
+
Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Making visual representations matter in vision-language models. In CVPR, 2021a.
|
| 336 |
+
Ziqi Zhang, Yaya Shi, Chunfeng Yuan, Bing Li, Peijin Wang, Weiming Hu, and Zheng-Jun Zha. Object relational graph with teacher-recommended learning for video captioning. In CVPR, 2020.
|
| 337 |
+
Ziqi Zhang, Zhongang Qi, Chunfeng Yuan, Ying Shan, Bing Li, Ying Deng, and Weiming Hu. Open-book video captioning with retrieve-copy-generate network. In CVPR, 2021b.
|
| 338 |
+
Qi Zheng, Chaoyue Wang, and Dacheng Tao. Syntax-aware action targeting for video captioning. In CVPR, 2020.
|
| 339 |
+
Luowei Zhou, Chenliang Xu, and Jason J Corso. Towards automatic learning of procedures from web instructional videos. In AAAI, 2018.
|
| 340 |
+
Luowei Zhou, Hamid Palangi, Lei Zhang, Houdong Hu, Jason J. Corso, and Jianfeng Gao. Unified visionlanguage pre-training for image captioning and VQA. In AAAI, 2020.
|
md/test/bx24KpJ4Eb/bx24KpJ4Eb.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/c8McWs4Av0/c8McWs4Av0.md
ADDED
|
@@ -0,0 +1,803 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SOLVING CHALLENGING MATH WORD PROBLEMS USING GPT-4 CODE INTERPRETER WITH CODEBASED SELF-VERIFICATION
|
| 2 |
+
|
| 3 |
+
Aojun Zhou1∗ Ke Wang1∗ Zimu Lu1∗ Weikang Shi1∗ Sichun Luo3∗ Zipeng Qin1 Shaoqing Lu 4 Anya Jia 5 Linqi Song3 Mingjie Zhan1†‡ Hongsheng Li1,2‡
|
| 4 |
+
|
| 5 |
+
1MMLab, The Chinese University of Hong Kong 2Shanghai Artificial Intelligence Laboratory 3City University of Hong Kong 4CSUST 5Tufts University {aojunzhou, zmjdll}@gmail.com hsli@ee.cuhk.edu.hk
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Recent progress in large language models (LLMs) like GPT-4 and PaLM-2 has brought significant advancements in solving math problems. In particular, OpenAI’s latest version of GPT-4, known as GPT-4 Code Interpreter, shows remarkable performance on challenging math datasets. In this paper, we explore the effect of code on enhancing LLMs’ reasoning capability by introducing different constraints on the Code Usage Frequency of GPT-4 Code Interpreter. We found that its success can be primarily attributed to its powerful skills in generating and executing code, evaluating the execution result, and rectifying its solution when receiving unreasonable outputs. Based on this, we propose a novel prompting method, explicit code-based self-verification (CSV). This method employs a zero-shot prompt on the GPT-4 Code Interpreter to encourage it to use code to self-verify its answers. In instances where the verification state is "False", the model will automatically amend its solution. Furthermore, we recognize that the states of the verification result indicate the confidence of a solution, which can improve the effectiveness of majority voting. With GPT-4 Code Interpreter and CSV, we achieve an impressive zero-shot accuracy of various mathematical problem-solving benchmarks.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Large language models (LLMs) (Brown et al., 2020; OpenAI, 2023; Anil et al., 2023) have shown impressive success in various tasks. However, they still fall short in mathematical reasoning, often producing nonsensical or inaccurate content and struggling with complex calculations. Previous works to tackle these challenges include the Chain-of-Thought (CoT) (Wei et al., 2022) framework, which enhances LLMs’ logical reasoning abilities by generating intermediate reasoning steps. Additionally, PAL (Gao et al., 2023) uses the Python interpreter to improve computational accuracy.
|
| 14 |
+
|
| 15 |
+
Recently, OpenAI has unveiled an improved version of GPT-4, namely the GPT-4 Code Interpreter1 or GPT4-Code, which is good at providing natural language reasoning, alongside step-by-step Python code. Notably, it can generate and execute code incrementally, and subsequently present the execution results back to the LLM. This mechanism has shown promising results in solving mathematical problems. Our initial experiments show that GPT4-Code achieved an impressive zero-shot accuracy of $6 9 . 6 9 \%$ on the challenging MATH dataset (Hendrycks et al., 2021), marking a significant improvement of $2 7 . 5 \%$ over GPT-4’s performance $( 4 2 . 2 \% )$ .
|
| 16 |
+
|
| 17 |
+
While GPT4-Code has demonstrated proficiency in solving math problems, there has been a notable absence of systematic analysis focusing on understanding and further enhancing its mathematical problem-solving abilities. A critical distinction between GPT4-Code and its predecessor, GPT4, lies in GPT4-Code’s ability to automatically generate and execute code. Therefore, this paper presents pilot experiments investigating GPT4-Code’s code generation and execution mechanism using specific code-constrained prompts. The analysis reveals that GPT4-Code’s strong performance is not solely due to its code generation and execution abilities but also its capacity to adjust its problem-solving strategies based on feedback from code execution—a process we term selfdebugging (akin to (Chen et al., 2023b)), examples illustrated in Appendix E. Due to this clever mechanism, there is an increased frequency of code usage. Hence, we introduce Code Usage Frequency to differentiate these unique prompting strategies to quantitatively analyze the impact of code-constrained prompts on GPT4-Code for mathematical problem-solving. The step-by-step code generation and self-debugging mechanisms highlight the critical role of code in mathematical problem-solving. Nevertheless, the self-debugging mechanism only verifies the correctness of code while lacking the verification of the reasoning steps and the final answer, which has been demonstrated to be of vital importance to solve math problems of LLMs (Cobbe et al., 2021; Lightman et al., 2023).
|
| 18 |
+
|
| 19 |
+
We therefore ask the question: can we fully exploit the code generation and self-debugging mechanisms in GPT4-code, so that it can automatically verify and correct its solutions, without extra assistance from other models or users?
|
| 20 |
+
|
| 21 |
+
To answer this question, we propose a simple yet effective prompting technique termed the explicit code-based self-verification (CSV), which guides GPT4-Code to generate additional code that verifies the answer and adjusts the reasoning steps if there’s a flaw in reasoning. Unlike previous methods that rely on external language models for verification (Lightman et al., 2023; Cobbe et al., 2021), our approach leverages GPT4-Code’s inherent strengths. This approach offers two key benefits: (1) When the verification indicates an answer is False, GPT4-Code can rectify its prior solution and provide an improved alternative. (2) Solutions verified as True tend to be more reliable, akin to human problem-solving. However, even if a solution is self-verified as False, we do not directly abandon it. Instead, we propose a weighted majority voting strategy that incorporates the code-based solution verification results, as opposed to relying exclusively on the frequency of answers. We assign different weights to the solutions according to their verification states, reflecting the solutions’ varying levels of reliability. In alignment with the Code Usage Frequency analysis from our pilot experiments, our explicit code-based self-verification prompt boosts GPT4-Code’s accuracy in mathematical problem-solving with increased code usage.
|
| 22 |
+
|
| 23 |
+
Empirical study demonstrates the effectiveness of our proposed pipeline on the MATH, GSM8K, and MMLU-Math datasets using GPT4-Code. Our method achieves an impressive accuracy of $8 4 . 3 \%$ on the MATH dataset, greatly outperforming the base GPT4-Code and previous SOTA methods.
|
| 24 |
+
|
| 25 |
+
This paper’s main contributions can be summarized in three key aspects:
|
| 26 |
+
|
| 27 |
+
• This study provides the first systematic analysis of code generation, execution, and selfdebugging’s role in mathematical problem-solving. Our findings reveal that GPT4-Code’s impressive mathematical problem-solving proficiency is primarily attributed to its step-bystep code generation and dynamic solution refinement based on code execution outcomes.
|
| 28 |
+
• We introduce the innovative explicit code-based self-verification (CSV) prompt, which leverages GPT4-Code’s advanced code generation mechanism. This prompt guides the model to verify the answer and then reevaluate its solution with code. CSV not only extends the verification to the logic behind problem-solving but also improves the efficacy of the majority voting method by integrating the verification states.
|
| 29 |
+
We have demonstrated the superior performance of GPT4-Code and the proposed CSV pipeline through extensive quantitative experiments on a variety of challenging mathematical reasoning datasets.
|
| 30 |
+
|
| 31 |
+
# 2 RELATED WORK
|
| 32 |
+
|
| 33 |
+
Chain-of-Thought Reasoning. The Chain-of-Thought (CoT) prompting approach proposed by (Wei et al., 2022) shows the multi-step reasoning capabilities of LLMs. (Kojima et al., 2022) implements Zero-shot-CoT, which can serve as a strong zero-shot baseline. Further research extends the reasoning capabilities of CoT by applying majority voting (Wang et al., 2023), choosing complex few-shot examples and outputting results (Fu et al., 2022), breaking down the problem (Zhou et al., 2023), or even using Tree-of-Thoughts (Yao et al., 2023). Similar to Zero-shot-CoT, our method applies "step by step"-like prompts to regularize GPT4-Code’s use of code. Additionally, We enhance majority voting by leveraging the results of CSV as voting weights.
|
| 34 |
+
|
| 35 |
+
# Question
|
| 36 |
+
|
| 37 |
+
# Model output
|
| 38 |
+
|
| 39 |
+
Q: The greatest common divisor of positive integers $m$ and $n$ is 6. The least common multiple of $m$ and $n$ is 126. What is the least possible value of $m + n ?$ A: 60
|
| 40 |
+
|
| 41 |
+
# BasePrompt: The problem: {Q},
|
| 42 |
+
|
| 43 |
+
One important property relating GCD and LCM is that
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\operatorname { G C D } ( m , n ) \times \operatorname { L C M } ( m , n ) = m \times n
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
# (a) Model output
|
| 50 |
+
|
| 51 |
+
# Prompt 1: You are not allowed to use any code. The problem: {Q}.
|
| 52 |
+
|
| 53 |
+
For any two positive integers $_ m$ and $_ n$ , the product of their GCD and LCM is equal to the product of the two numbers.
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\begin{array} { c } { { G C D ( m , n ) \cdot L C M ( m , n ) } } \\ { { = m \cdot n } } \end{array}
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
# (b) Model output
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
6 \times 1 2 6 = m \times n
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
Let’s compute the right hand side of the equation first.
|
| 66 |
+
|
| 67 |
+
Prompt 2: You can use code only 1 time. The problem: {Q}
|
| 68 |
+
For any two positive integers $_ m$ and $_ n$ , their gcd and lcm satisfy:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
m \cdot n = \operatorname* { g c d } ( m , n ) \cdot \operatorname { l c m } ( m , n )
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
m \cdot n = 6 \cdot 1 2 6
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
In this problem, we’re given that $\operatorname* { g c d } ( m , n ) = 6$ and $\operatorname { l c m } ( { \tilde { m _ { } } } , n ) = 1 2 6 \cdot$
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\scriptstyle \left( { \begin{array} { l } { \scriptstyle \operatorname { g c d , l c m } = 6 , 1 2 6 ; \ x \operatorname { g c d } ^ { * } \operatorname { l c m } } \\ { \gg 7 5 6 } \end{array} } \right)
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
In this problem, we can get
|
| 85 |
+
|
| 86 |
+
The product of $_ m$ and $_ n$ is 756. Since the GCD of $_ m$ and $_ n$ is $^ 6$ , both $_ m$ and $_ n$ must be multiples of 6. So we need to find all the factors of 756 that are multiples of 6.
|
| 87 |
+
|
| 88 |
+
We use the fact that $_ m$ and $_ n$ are integers to generate possible pairs $( m , n )$ . After we have the pairs $\bar { ( } m , n )$ , we can find the pair that minimizes $m + n$ [(i, m_times_n // i) for i in range(6 int(m\*n\*\*0.5) + 1, 6) if m\*n % i == 0] »> [(6, 126), (12, 63), (18, 42)]
|
| 89 |
+
|
| 90 |
+
import sympy as sp
|
| 91 |
+
gcd,l $c \mathrm { m } = 6 { , } 1 2 6$ ; product $=$ gcd \* lcm
|
| 92 |
+
pairs $=$ [(d, product // d) for d in sp.div(product) if
|
| 93 |
+
d $< =$ product // d]
|
| 94 |
+
min_pair = min(pairs, key=sum)
|
| 95 |
+
min_pair, sum(min_pair)
|
| 96 |
+
»> ((27, 28), 55)
|
| 97 |
+
|
| 98 |
+
The pairs of factors of 756 that are multiples of 6 are: 1. (6, 126) 2. (12, 63) 3. (18, 42) We want to find the pair with the least sum.
|
| 99 |
+
|
| 100 |
+
sums = [(pair, sum(pair)) for pair in factor_pairs] min(sums, key=lambda x: x[1]) »> ((18, 42), 60)
|
| 101 |
+
|
| 102 |
+
The pair $( m , n )$ that min $m + n$ is (27, 28), and the minimum possible value of $m + n$ is $[ 5 5 ] . x$
|
| 103 |
+
|
| 104 |
+
The pair with the smallest sum is (18, 42), and the sum is 60.So, the least possible value is 60
|
| 105 |
+
|
| 106 |
+
Figure 1: Example from the 277th number theory problem in the MATH dataset: (a) Prompt 1 generates text-only reasoning steps. (b) Prompt 2 generates intermediate text reasoning steps and post-hoc code, akin to PAL (Gao et al., 2023). (c) Base prompt without code usage constrain. Details of the three prompts are presented in Sec. 3.1. (For more examples, see Tab. 10 and Tab. 11 in Appendix H.)
|
| 107 |
+
|
| 108 |
+
Solving Math Problems with Code. Large language models have been found to be less accurate in performing arithmetic calculations (Cobbe et al., 2021; Lewkowycz et al., 2022; Gao et al., 2023; Lu et al., 2022). Consequently, previous works have attempted to solve math problems with the assistance of code. The GSM8K dataset (Cobbe et al., 2021) uses calculation annotations to extract all arithmetic calculations solved by an external calculator: the Python eval function. ProgramAided Language model (PAL) (Gao et al., 2023) and Program of Thoughts (PoT) (Chen et al., 2022) obtain the answer by generating and executing Python code. Although they can improve computational accuracy, many generated codes get wrong answers due to the lack of verification. Our approach not only utilizes the ability of GPT4-Code to generate codes and refine codes that fail to run, but also uses CSV to enhance the accuracy of the answers.
|
| 109 |
+
|
| 110 |
+
Self-Verification. Previous studies train an additional verifier to verify the correctness of final answers (Cobbe et al., 2021) or intermediate steps (Lightman et al., 2023; Li et al., 2023). (Weng et al., 2023) showed the self-verification abilities of LLMs by generating and ranking multiple answers. Furthermore, Self-refine proposed by (Madaan et al., 2023) iteratively refines its output through self-generated feedback. Self-debug (Chen et al., 2023b) prompts the LLM to debug its own prediction for code generation. Unlike these methods that require LLMs to give verification feedback in natural language, our method applies generated codes to verify the answers and votes on different answers based on the verification results, thus improving the accuracy of the verification.
|
| 111 |
+
|
| 112 |
+
# 3 METHOD
|
| 113 |
+
|
| 114 |
+
We first conduct a pilot experiment with GPT4-Code on the challenging MATH dataset (Hendrycks et al., 2021). Remarkably, it achieves an accuracy of $6 9 . 6 9 \%$ , significantly surpassing the previous state-of-the-art performance of $5 3 . 9 \%$ (Zheng et al., 2023). Encouraged by the compelling performance of GPT4-Code, we strive to systematically explore and analyze its underlying code mechanisms. In Sec. 3.1, we illustrate, via our code-constrained prompts design, that GPT4-Code’s robust performance in solving math problems derives not only from its ability to generate accurate step-by-step code, but also from its self-debugging mechanism. In Sec. 3.2, we aim to leverage GPT4-Code’s self-debugging strengths to further improve its mathematical problem-solving ability.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 2: Performance on MATH dataset of different levels by applying different prompts to adjust the frequency of code usage. (a) Comparison of overall accuracy between the four prompts. (b) Code Usage Frequency is in proportion to accuracy in all five levels, and this phenomenon is especially apparent when the problems are relatively complicated (i.e., with higher levels). The red points denoting Prompt 1 show that the model still occasionally uses code, especially when the problem is very difficult. However, even then, the Code Usage Frequency is negligible.
|
| 118 |
+
|
| 119 |
+
# 3.1 PILOT EXPERIMENTS ON ANALYZING CODE USAGE OF GPT4-CODE
|
| 120 |
+
|
| 121 |
+
To explore the impact of code on GPT4-Code’s mathematical skills, we adopt a straightforward approach by constraining GPT4-Code’s uasge of code through thoughtfully constructed prompts. Specifically, we introduce two code-constrained prompts and a base prompt for comparison:
|
| 122 |
+
|
| 123 |
+
• Prompt 1. No code usage is allowed: With this prompt, GPT4-Code is prohibited from using code. This prompts GPT4-Code to rely solely on Natural Language $\mathbf { \left( N L \right) }$ reasoning chain, resembling solutions in the CoT framework (Wei et al., 2022). The resulting sequence of reasoning steps is depicted as $\mathbf { C } _ { \mathbf { N L } }$ , with an example given in Fig. 1 (a). • Prompt 2. Code can be used only once: In this prompt setting, GPT4-Code is permitted to employ code within a single code block to generate the solution, mirroring the PAL approach introduced by (Gao et al., 2023). We denote this sequence as $\mathbf { C _ { S L } }$ , representing a series of Symbolic Language (SL), such as Python. An example is shown in Fig. 1 (b). • Base Prompt. GPT4-Code is prompted to tackle the problem without any restrictions on code usage. This prompt leads to GPT4-Code’s usual performance, which can be denoted as $\bar { \mathbf { C } } = ( ( \mathbf { c 1 } _ { \mathrm { { N L } } } , \mathbf { c 1 } _ { \mathrm { { s L } } } ^ { - } )$ , $( \mathbf { c 2 _ { N L } } , \mathbf { c 2 _ { S L } } ) , \dots )$ , representing a list of reasoning steps, each consisted of both natural language and code, with an example shown in Fig. 1 (c).
|
| 124 |
+
|
| 125 |
+
Apart from the specific example in Fig. 1, we introduce Code Usage Frequency to record the number of code executions for different prompts. The results of the experiments using these prompts are shown in Fig. 2 (b). This figure illustrates a positive correlation between the better performance of GPT4-Code and the higher Code Usage Frequency. More specifically,
|
| 126 |
+
|
| 127 |
+
Prompt 1 v.s. Prompt 2. Prompt 1 results in almost negligible code usage, while Prompt 2 results in approximately 1 time’s code usage. Prompt 2 yields an accuracy gain of 6.78 percent over Prompt 1. This suggests that the Python code chains $\mathbf { C _ { S L } }$ can improve computational capability more than the natural language chains $\mathbf { C _ { N L } }$ . This observation is consistent with the findings in previous Pythonbased prompting methods (Gao et al., 2023; Chen et al., 2022). However, employing code only once comes with an inherent drawback – the model lacks the ability to self-debug when the code output triggers an error or produces an implausible outcome.
|
| 128 |
+
|
| 129 |
+
Prompt 2 v.s. Base Prompt. The Base Prompt consistently produces solutions that entail multiple instances of code usage, resulting in a large Code Usage Frequency. Additionally, the Base Prompt’s accuracy of $6 9 . 6 9 \%$ represents a $2 . 1 1 \%$ improvement over Prompt 2’s $6 7 . 5 8 \%$ . These improvements in Code Usage Frequency and accuracy might be attributable to two unique advantages: (1) Generating code in brief and frequent segments, divided among natural language reasoning steps, tends to result in higher accuracy. (2) The model possesses the capability to evaluate the results of code execution and make corrections to solution steps if the outcomes contain bugs or are deemed illogical, as illustrated in Tab. 8 and Tab. 9 (Appendix E).
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 3: Question from the 712th intermediate algebra problem in the MATH dataset. (a) Without selfverification, the model generates a wrong answer. (b) With self-verification, the model corrects the error and generates the correct answer. The CSV prompt: Solve the problem using code interpreter step by step, even in every sub-step. And following your answer, please verify it using code interpreter by yourself.
|
| 133 |
+
|
| 134 |
+
From these observations, it is plausible to enhance and build upon the favorable attributes of GPT4- Code to further improve its precision in tackling math problems.
|
| 135 |
+
|
| 136 |
+
# 3.2 EXPLICIT CODE-BASED SELF-VERIFICATION PROMPTING
|
| 137 |
+
|
| 138 |
+
Inspired by the observations on Code Usage Frequency analysis, we seek to harness the capabilities of GPT4-Code. These capabilities include the model’s aptitude for generating accurate code, evaluating the outcomes of code execution, and automatically adjusting reasoning steps of solutions when needed. Our objective is to utilize these strengths to augment solution verification.
|
| 139 |
+
|
| 140 |
+
To achieve this objective, we propose the technique termed as explicit code-based self-verification (CSV). This method prompts GPT4-Code to explicitly validate its answer through code generation. By implementing this prompt, we introduce an extra verification stage to the solution $\mathbf { C }$ , referred to as $\breve { \mathbf { V } }$ . The verification result $\mathbf { V }$ can be classified as True, False, or Uncertain. An Uncertain classification indicates that GPT4-Code encountered difficulties in identifying an effective method for answer verification, thereby abstaining from delivering a definitive verification result. Leveraging GPT4-Code’s inherent autonomous capabilities, we can formulate the proposed prompting as:
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\mathbf { C } \mathbf { V } = { \{ \begin{array} { l l } { { \mathrm { T r u e } } } & { { \mathrm { f n a l ~ a n s w e r } } } \\ { { \mathrm { F a l s e } } } & { \mathbf { C } _ { \mathrm { n e w } } \mathbf { V } \cdots { \mathrm { T r u e } } { \mathrm { f n a l ~ a n s w e r } } } \\ { { \mathrm { U n c e r t a i n } } } & { { \mathrm { f n a l ~ a n s w e r } } } \end{array} }
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
An example is presented in Fig. 3 (b). Incorporated with CSV, the model becomes capable of using code to verify answers, then reviewing and adjusting how it arrived at the solution if the verification result is False, aiming at obtaining the correct answer. The different types of verification code can be seen in Tab.16, Tab.17, Tab.18, and Tab.19 (Appendix J). Upon refining and correcting the initial solution, we anticipate a notable increase in accuracy. It is worth noting that both the verification and rectification stages are code-based. This inevitably results in increased Code Usage Frequency, akin to the aforementioned analysis, which will be further demonstrated in subsequent experiments.
|
| 147 |
+
|
| 148 |
+
We perform experiments with CSV, and these results can be found in Fig. 2. The experiment here is conducted with GPT4-Code on MATH (Hendrycks et al., 2021). In Fig. 2 (b), the accuracy achieved with our proposed CSV prompt consistently surpasses that of the Base Prompt across all designated difficulty levels2. Meanwhile, the Code Usage Frequency receives a clear increase.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 4: (a) Illustration of the Naive majority voting (Wang et al., 2023) and our Verification-guided weighted majority voting. (b) The full pipeline of the proposed Verification-guided Weighted Majority Voting (VWvoting) framework. We detect the self-verification state of each solution and classify them into three states: True, Uncertain, and False. According to the state of the verification, we assign each solution a different weight and use the classified result to vote the score of each possible answer. (For more examples, see Tab. 12 and Tab. 13 in Appendix G.)
|
| 152 |
+
|
| 153 |
+
Before the advent of GPT4-Code, prior frameworks (Lightman et al., 2023; Cobbe et al., 2021) relied on an external Large Language Model (LLM) and well-constructed few-shot prompts for natural language verification. In contrast, GPT4-Code’s robust capabilities enable our approach to depend solely on a straightforward prompt, thereby operating in a zero-shot manner. This enables GPT4-Code to autonomously verify and independently rectify its solutions using the advanced code execution mechanism, thereby eliminating the need for customized few-shot examples.
|
| 154 |
+
|
| 155 |
+
Given that CSV can effectively verify problem-solving answers, we can naturally integrate the verification states into majority voting, akin to the methodology embraced in self-consistency CoT (Wang et al., 2023). Answers deemed True through verification are generally more trustworthy, reflecting the problem-solving approach seen in human cognition (Newell & Simon, 1972; Wang & Chiew, 2010). This improved reliability can be leveraged in the widely-used majority voting process. To exploit this insight, we introduce verification-guided weighted majority voting, which assigns different weights to the states of the verification process.
|
| 156 |
+
|
| 157 |
+
In practice, it sometimes occurs that once an answer is confirmed as False, no additional verification is conducted, yielding a False verification state. We allocate corresponding weights these states of True, Uncertain, False: $w _ { \mathbf { T } } , w _ { \mathbf { U } }$ , and $w _ { \mathbf { F } }$ , respectively.
|
| 158 |
+
|
| 159 |
+
Similar to the Self-consistency with CoT (CoT-SC) (Wang et al., 2023) in Fig. 4 (a)(ii), our framework can sample $k$ paths. For simplicity, we extract pairs of final answers and their corresponding verification results from $k$ solutions, represented as $( v ^ { i } , a ^ { i } ) , i = 1 , 2 , . . . , k$ , where $v ^ { i }$ and $a ^ { i }$ denote the $i$ -th final answer and final verification result, respectively.
|
| 160 |
+
|
| 161 |
+
So the voting score for each candidate answer $a$ can be expressed as:
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\operatorname { S c o r e } ( a ) = \sum _ { \{ v ^ { i } \} } w _ { v } ( \# \{ i \mid a ^ { i } = a { \mathrm { ~ a n d ~ } } v ^ { i } = v \} ) , \quad v \in \{ \mathrm { T r u e } , \mathrm { U n c e r t a i n } , \mathrm { F a l s e } \} ,
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
Table 1: Accuracy $( \% )$ on MATH dataset. VW-voting is an abbreviation for Verification-guided Weighted Majority Voting. Voting is an abbreviation for Naive Majority Voting. (Overall: The results across various MATH subtopics)
|
| 168 |
+
|
| 169 |
+
<table><tr><td></td><td>Code-based Verification</td><td>Intermediate Algebra</td><td>Precalculus 1</td><td>Geometry 1</td><td>Number Theory</td><td>Counting& Probability</td><td>PreAlgebra 1</td><td>Algebra 1</td><td>Overall MATH</td></tr><tr><td>GPT-4 (OpenAI,2023)</td><td>X</td><td>-</td><td>-</td><td>-</td><td></td><td></td><td></td><td>-</td><td>42.20</td></tr><tr><td>GPT-3.5(CoT) (Zheng et al.,2023)</td><td></td><td>14.6</td><td>16.8</td><td>22.3</td><td>33.4</td><td>29.7</td><td>53.8</td><td>49.1</td><td>34.12</td></tr><tr><td>GPT-4(Complex CoT) (Fuet al.,2022)</td><td>xx</td><td>23.4</td><td>26.7</td><td>36.5</td><td>49.6</td><td>53.1</td><td>71.6</td><td>70.8</td><td>50.36</td></tr><tr><td>GPT-4(PHP) (Zheng et al.,2023)</td><td></td><td>26.3</td><td>29.8</td><td>41.9</td><td>55.7</td><td>56.3</td><td>73.8</td><td>74.3</td><td>53.90</td></tr><tr><td>GPT4-Code (baseline)</td><td>X</td><td>50.1</td><td>51.5</td><td>53.4</td><td>77.2</td><td>70.6</td><td>86.3</td><td>83.6</td><td>69.69</td></tr><tr><td>GPT4-Code + CSV</td><td>√</td><td>56.6</td><td>53.9</td><td>54.0</td><td>85.6</td><td>77.3</td><td>86.5</td><td>86.9</td><td>73.54</td></tr><tr><td>Improvement</td><td></td><td>+6.5</td><td>+2.4</td><td>+0.6</td><td>+8.4</td><td>+6.7</td><td>+0.2</td><td>+3.3</td><td>+3.85</td></tr><tr><td>GPT4-Code+ Voting (k=16,baseline)</td><td>×</td><td>63.3</td><td>64.1</td><td>61.7</td><td>89.1</td><td>84.6</td><td>90.8</td><td>92.9</td><td>79.88</td></tr><tr><td>GPT4-Code + CSV + Voting (k=16)</td><td>√</td><td>72.7</td><td>66.5</td><td>64.5</td><td>93.1</td><td>88.8</td><td>91.2</td><td>95.3</td><td>83.54</td></tr><tr><td>Improvement</td><td></td><td>+9.4</td><td>+2.4</td><td>+2.8</td><td>+4.0</td><td>+4.2</td><td>+0.4</td><td>+2.4</td><td>+3.66</td></tr><tr><td>GPT4-Code + CSV + VW-Voting (k=16)</td><td>√</td><td>74.4</td><td>67.8</td><td>64.9</td><td>94.1</td><td>89.0</td><td>91.6</td><td>95.6</td><td>84.32</td></tr><tr><td>Improvement</td><td></td><td>+11.1</td><td>+3.7</td><td>+3.2</td><td>+5.0</td><td>+4.4</td><td>+0.8</td><td>+2.7</td><td>+4.44</td></tr></table>
|
| 170 |
+
|
| 171 |
+
Here, $a$ represents a candidate answer, $v$ denotes the state of verification, and $w _ { v }$ is an element from the set $\{ \tilde { w _ { \mathbf { T } } } , w _ { \mathbf { U } } , w _ { \mathbf { F } } \}$ . Each $w _ { v }$ signifies the degree of confidence associated with its corresponding verification state. Finally, we select the answer with the highest score from all candidate answers.
|
| 172 |
+
|
| 173 |
+
It should be noted that when $w _ { v } \ = \ 1$ for all $w _ { v } \in \{ w _ { \mathbf { T } } , w _ { \mathbf { U } } , w _ { \mathbf { F } } \}$ , Eq. 1 becomes equivalent to the naive majority voting employed in Self-Consistency with CoT (CoT-SC) (Wang et al., 2023). Typically, we set $w _ { \mathbf { T } } > w _ { \mathbf { U } } > w _ { \mathbf { F } }$ , which means that an answer verified true has greater confidence than the one with an uncertain state of verification, while an answer verified false has the lowest degree of confidence. An example of the calculation process within verification-guided weighted majority voting is illustrated in Fig. 4.
|
| 174 |
+
|
| 175 |
+
# 4 EXPERIMENTS
|
| 176 |
+
|
| 177 |
+
Datasets and Baseline. We evaluate GPT4-Code using CSV on three datasets: MATH (Hendrycks et al., 2021), GSM8K (Cobbe et al., 2021), and MMLU-Math (Hendrycks et al., 2020). We primarily compare our code-based self-verification (CSV) approach to standard zero-shot prompting using GPT4-Code to validate the effectiveness of the self-verification ability. To more comprehensively evaluate the zero-shot capabilities of both GPT4-Code and GPT4-Code with CSV in mathematical reasoning tasks, we also compare our method with the state-of-the-art few-shot in-context-learning method using GPT-4 from PHP (Zheng et al., 2023) and Model selection (Zhao et al., 2023).
|
| 178 |
+
|
| 179 |
+
Prompt. The proposed prompt is presented in the caption of Fig. 3.
|
| 180 |
+
|
| 181 |
+
# 4.1 PERFORMANCE ON MATH
|
| 182 |
+
|
| 183 |
+
The MATH dataset (Hendrycks et al., 2021) is recognized as the most challenging math word problem dataset, as also highlighted by Chen et al. (Chen et al., 2023a). Most of our experiments and the corresponding analyses are performed on the MATH benchmark. Tab. 1 compares the performance of the GPT4-Code against other models. GPT4-Code reaches $6 9 . 6 9 \%$ on MATH (Hendrycks et al., 2020), largely surpassing the previous state of the art result $( 5 3 . 9 0 \% )$ , which shows that GPT4-Code exhibits strong abilities in solving math problems and is used as our baseline. On top of GPT4-Code, our method further improves its accuracy, raising the result to $7 3 . 5 4 \%$ after adding explicit code-based self-verification. GPT4-Code with naive majority voting reaches an accuracy of $\bar { 7 } 9 . 8 8 \%$ , which we set as the baseline for methods that used voting. When using code-based self-verification with majority voting, the accuracy is $8 3 . 3 4 \%$ , while adding both explicit code-based self-verification and verification-guided weighted majority voting reaches an accuracy of $8 4 . 3 2 \%$ . Note that this astonishingly high result is based on the strong abilities of the base model GPT4-Code, and our method amplifies its good qualities of GPT4-Code, with the ability to verify solutions.
|
| 184 |
+
|
| 185 |
+
Note that although adding CSV can improve the performance of every individual subject, the extent of improvement varies, from $8 . 4 \%$ to only $0 . 2 \%$ . In particular, the Geometry problem only has an increased accuracy of $0 . 6 \%$ , even though the original accuracy is only $5 3 . 4 \%$ , which is low among the subjects. This discrepancy may be attributed to the fact that solving geometry problems often requires multi-modality (Chen et al., 2023a), a concept beyond the scope of this paper.
|
| 186 |
+
|
| 187 |
+
Table 2: Performance on GSM8K dataset.
|
| 188 |
+
|
| 189 |
+
<table><tr><td>Method</td><td>Sampled paths</td><td>Accuracy(%)</td></tr><tr><td>GPT-3.5 (5-shot) (OpenAI,2023)</td><td>1</td><td>57.1</td></tr><tr><td>GPT-4 (5-shot CoT) (OpenAI,2023)</td><td></td><td>92.0</td></tr><tr><td>GPT-4 (PHP) (Zheng et al.,2023)</td><td>40</td><td>96.5</td></tr><tr><td>GPT-4 (Model selection) (Zhao et al.,2023)</td><td>15</td><td>96.8</td></tr><tr><td>GPT4-Code</td><td>1</td><td>92.9</td></tr><tr><td>GPT4-Code + Voting</td><td>5</td><td>94.9</td></tr><tr><td>GPT4-Code +CSV</td><td>一</td><td>94.5</td></tr><tr><td>GPT4-Code +CSV +VW-Voting</td><td>5</td><td>97.0</td></tr></table>
|
| 190 |
+
|
| 191 |
+
Table 3: Performances on MMLU-Math dataset.
|
| 192 |
+
|
| 193 |
+
<table><tr><td>Method</td><td>Sampled paths</td><td>Accuracy(%)</td><td>Few-shot</td></tr><tr><td>Goper (Rae et al., 2021)</td><td></td><td>30.6</td><td>5-shot</td></tr><tr><td>Chinchilla (Hoffmann et al.,2022)</td><td></td><td>35.7</td><td>5-shot</td></tr><tr><td>Llama-2(7oB) (Touvron et al.,2023)</td><td></td><td>47.1</td><td>5-shot</td></tr><tr><td>Galactica (Taylor et al., 2022)</td><td></td><td>41.3</td><td>zero-shot</td></tr><tr><td>GPT4-Code</td><td></td><td>87.5</td><td>zero-shot</td></tr><tr><td>GPT4-Code+ Voting</td><td>5</td><td>92.1</td><td>zero-shot</td></tr><tr><td></td><td></td><td></td><td>zero-shot</td></tr><tr><td>GPT4-Code + CSV + vW-Voting</td><td>-5</td><td>995</td><td></td></tr></table>
|
| 194 |
+
|
| 195 |
+

|
| 196 |
+
Figure 5: The four points on each curve correspond to results using Prompt 1, Prompt 2, Base Prompt and Proposed Prompt, respectively. (a) The accuracy of different levels at various code usage frequencies. (b) The accuracy of different subjects at various code usage frequencies.
|
| 197 |
+
|
| 198 |
+
# 4.2 PERFORMANCE ON GSM8K AND MMLU-MATH
|
| 199 |
+
|
| 200 |
+
In addition to the challenging MATH dataset, we have also performed our method on other reasoning datasets such as GSM8K (Cobbe et al., 2021), MMLU-Math (Hendrycks et al., 2020). The corresponding results can be viewed in Tab. 2 and Tab. 3. When integrated on top of GPT-4-code, our method outperforms other methods, achieving state-of-the-art results across all datasets. Other subjects in MMLU benchmarks are provided in Appendix D. A comparative analysis of our results with those of previous state-of-the-art techniques and open-source models are also provided.
|
| 201 |
+
|
| 202 |
+
Tab. 2 illustrates that verification-guided majority voting is an effective framework to reduce the number of sampled paths, compared to GPT-4 with model selection (Zhao et al., 2023) and PHP (Zheng et al., 2023). Tab. 3 presents a comparison of our model’s performance with existing models (Hoffmann et al., 2022; Taylor et al., 2022; Touvron et al., 2023) on the MMLU-Math dataset. The open-source models remain significantly outpaced by their closed-source counterparts.
|
| 203 |
+
|
| 204 |
+
# 4.3 CODE USAGE FREQUENCY OF PROPOSED PROMPTS
|
| 205 |
+
|
| 206 |
+
Analogous to the approach taken in Sec. 3.1, we gather data to elucidate the correlation between accuracy and Code Usage Frequency across various dimensions - prompts (proposed CSV prompt and prompts used in pilot experiments), subjects, and difficulty levels. As shown in Fig. 5, the model’s behavior is in line with our expectations when adding the code-based verification prompts. Each line in Fig. 5 has an obvious trend of going upwards, suggesting a possible positive correlation between Code Usage Frequency and accuracy. The performance gain when using more code is more obvious in the higher difficulty levels, while in lower levels, the performance gain is not very prominent, as shown in Fig. 5 (a). The Code Usage Frequency increases with the increase of difficulty levels. This shows that the harder math problems require more frequent code usage, which implies that invoking code multiple times might be an important reason why GPT4-Code have such an advantage in solving difficult math problems. There is a similar trend in Fig. 5 (b).
|
| 207 |
+
|
| 208 |
+
# 4.4 ABLATION STUDY AND DISCUSSION
|
| 209 |
+
|
| 210 |
+
Comparisons between Natural Language and Code-based Self-Verification. To underscore the significance of code in the self-verification stage, we employed a distinct natural language selfverification, where GPT4-Code is directed to verify the solution through natural language instead of relying on code-based verification, as presented in Tab. 4. The accuracy achieved with this method was slightly lower than that of the Base Prompt. Moreover, we observed a decline in accuracy for four of the seven subtopics, indicating that relying solely on natural language self-verification, which appears to have a negative impact on the accuracy, is less reliable than using code-based self-verification. Examples of natural language self-verification can be seen in Tab. 14 and Tab. 15 (Appendix F). In contrast, code-based verification enhances accuracy across all seven subtopics when compared to the Base Prompt.
|
| 211 |
+
|
| 212 |
+
Table 4: Comparison Self-verification with/without explicit code-based prompt (Overall:The results across various MATH subtopics (Hendrycks et al., 2021))
|
| 213 |
+
|
| 214 |
+
<table><tr><td rowspan="5">GPT4-Code Interpreter</td><td>Verification Method</td><td>Intermediate Algebra</td><td>Precalculus 1</td><td>Geometry 1</td><td>Number Theory</td><td>Counting& Probability</td><td>PreAlgebra 1</td><td>Algebra 1</td><td>Overall 1</td></tr><tr><td>Without Verification</td><td>50.1</td><td>51.5</td><td>53.4</td><td>77.2</td><td>70.6</td><td>86.3</td><td>83.6</td><td>69.69</td></tr><tr><td>Natural Language</td><td>52.6</td><td>487</td><td></td><td></td><td>75</td><td>83.2</td><td></td><td></td></tr><tr><td rowspan="2">Code-based</td><td></td><td></td><td>50.8</td><td>7997</td><td></td><td></td><td>826</td><td>69.29</td></tr><tr><td>56.6 +6.5</td><td>53.9 +2.4</td><td>54.0 +0.6</td><td>85.6 +8.4</td><td>77.3 +6.7</td><td>86.5 +0.2</td><td>86.9 +3.3</td><td>73.54 +3.85</td></tr></table>
|
| 215 |
+
|
| 216 |
+

|
| 217 |
+
Figure 6: (a). The average precision, recall, and accuracy of five sampled paths on the MATH dataset. (b). The Acc on MATH in response to the number of sampled reasoning paths when the weight is set to different values.
|
| 218 |
+
|
| 219 |
+
Analysis of Verification-guided Weighted Majority Voting. We initially compiled the confusion matrix (TP/TN/FP/FN), capturing solutions with self-verification that matches the True and False states mentioned in Eq. 1 from five distinct sampled paths. The details are presented in Appendix A. From this data, we computed Precision, Recall, and Accuracy (Solutions in the True state are seen as positive). The results are presented in Fig. 6 (a). We note that Precision exceeds Accuracy by $2 2 . { \bar { 3 } } 4 \%$ (increasing from $7 3 . { \bar { 5 } } 4 \%$ to $9 5 . 8 8 \%$ ), whereas Recall surpasses Accuracy by $5 . 5 7 \%$ (rising from $7 3 . 5 4 \%$ to $7 9 . 1 1 \%$ ). In particular, the average Precision registered at $9 5 . 8 8 \%$ . This implies that the Accuracy has the potential to become much higher if more solutions reach the verified True state before giving the final answer.
|
| 220 |
+
|
| 221 |
+
Hyper-parameters ablation in Verification-guided Weighted Majority Voting. We also performed ablation studies on the hyper-parameter $w _ { v } \in \{ w _ { \mathbf { T } } , w _ { \mathbf { U } } , w _ { \mathbf { F } } \}$ in Eq. 1. As shown in Fig 6 (b). When the hyper-parameter setting satisfied $w _ { \mathbf { T } } > w _ { \mathbf { U } } \ge w _ { \mathbf { F } }$ , the performance of the verificationguided weighted majority voting consistently surpassed that of the naive majority voting methods across all sampled paths. In contrast, when we set the hyper-parameter $( w _ { \mathbf { T } } = 0 . 5 , w _ { \mathbf { U } } = 0 . 5 , w _ { \mathbf { F } } =$ 1), the performance under this configuration was worse than the naive majority voting. Therefore, our proposed method, verification-guided weighted majority voting, is easy to tune and robust.
|
| 222 |
+
|
| 223 |
+
# 5 CONCLUSION
|
| 224 |
+
|
| 225 |
+
In this paper, we begin with pilot experiments on GPT4-Code to explore how its use of code impacts its performance in mathematical reasoning. By analyzing Code Usage Frequency and accuracy, we determine that GPT4-Code’s skill in solving math problems can be largely attributed to its ability to generate and execute code, as well as its effectiveness in adjusting and rectifying solutions when confronted with implausible execution outputs. Expanding on this understanding, we introduce the ideas of explicit code-based self-verification and verification-guided weighted majority voting, with the goal of enhancing GPT4-Code’s mathematical capabilities. We hope this work could shed light on math problem-solving in open-source LLMs, especially when advanced code usage is involved.
|
| 226 |
+
|
| 227 |
+
# 6 ACKNOWLEDGMENTS
|
| 228 |
+
|
| 229 |
+
This project is funded in part by National Key R&D Program of China Project 2022ZD0161100, and in part by General Research Fund of Hong Kong RGC Project 14204021.
|
| 230 |
+
|
| 231 |
+
REFERENCES
|
| 232 |
+
Rohan Anil, Andrew M Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, et al. Palm 2 technical report. arXiv preprint arXiv:2305.10403, 2023.
|
| 233 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
|
| 234 |
+
Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W. Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks, 2022.
|
| 235 |
+
Wenhu Chen, Ming Yin, Max Ku, Pan Lu, Yixin Wan, Xueguang Ma, Jianyu Xu, Xinyi Wang, and Tony Xia. Theoremqa: A theorem-driven question answering dataset, 2023a.
|
| 236 |
+
Xinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. Teaching large language models to self-debug, 2023b.
|
| 237 |
+
Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
|
| 238 |
+
Yao Fu, Hao Peng, Ashish Sabharwal, Peter Clark, and Tushar Khot. Complexity-based prompting for multi-step reasoning. arXiv preprint arXiv:2210.00720, 2022.
|
| 239 |
+
Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. In International Conference on Machine Learning, pp. 10764–10799. PMLR, 2023.
|
| 240 |
+
Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Xiaodong Song, and Jacob Steinhardt. Measuring massive multitask language understanding. ArXiv, abs/2009.03300, 2020. URL https://api.semanticscholar.org/CorpusID: 221516475.
|
| 241 |
+
Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. arXiv preprint arXiv:2103.03874, 2021.
|
| 242 |
+
Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022.
|
| 243 |
+
Takeshi Kojima, Shixiang (Shane) Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. In Advances in Neural Information Processing Systems, volume 35, pp. 22199–22213, 2022.
|
| 244 |
+
Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. Solving quantitative reasoning problems with language models. Advances in Neural Information Processing Systems, 35:3843–3857, 2022.
|
| 245 |
+
Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. Making language models better reasoners with step-aware verifier. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 5315– 5333, 2023.
|
| 246 |
+
Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let’s verify step by step. arXiv preprint arXiv:2305.20050, 2023.
|
| 247 |
+
|
| 248 |
+
Pan Lu, Liang Qiu, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, Tanmay Rajpurohit, Peter Clark, and Ashwin Kalyan. Dynamic prompt learning via policy gradient for semi-structured mathematical reasoning. arXiv preprint arXiv:2209.14610, 2022.
|
| 249 |
+
|
| 250 |
+
Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023.
|
| 251 |
+
|
| 252 |
+
A. Newell and H.A. Simon. Human Problem Solving. ACS symposium series. Prentice-Hall, 1972. ISBN 9780134454030. URL https://books.google.com.hk/books?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ h03uAAAAMAAJ.
|
| 253 |
+
OpenAI. Gpt-4 technical report. ArXiv, abs/2303.08774, 2023.
|
| 254 |
+
Jack W. Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, Eliza Rutherford, Tom Hennigan, Jacob Menick, Albin Cassirer, Richard Powell, George van den Driessche, Lisa Anne Hendricks, Maribeth Rauh, Po-Sen Huang, Amelia Glaese, Johannes Welbl, Sumanth Dathathri, Saffron Huang, Jonathan Uesato, John F. J. Mellor, Irina Higgins, Antonia Creswell, Nathan McAleese, Amy Wu, Erich Elsen, Siddhant M. Jayakumar, Elena Buchatskaya, David Budden, Esme Sutherland, Karen Simonyan, Michela Paganini, L. Sifre, Lena Martens, Xiang Lorraine Li, Adhiguna Kuncoro, Aida Nematzadeh, Elena Gribovskaya, Domenic Donato, Angeliki Lazaridou, Arthur Mensch, Jean-Baptiste Lespiau, Maria Tsimpoukelli, N. K. Grigorev, Doug Fritz, Thibault Sottiaux, Mantas Pajarskas, Tobias Pohlen, Zhitao Gong, Daniel Toyama, Cyprien de Masson d’Autume, Yujia Li, Tayfun Terzi, Vladimir Mikulik, Igor Babuschkin, Aidan Clark, Diego de Las Casas, Aurelia Guy, Chris Jones, James Bradbury, Matthew G. Johnson, Blake A. Hechtman, Laura Weidinger, Iason Gabriel, William S. Isaac, Edward Lockhart, Simon Osindero, Laura Rimell, Chris Dyer, Oriol Vinyals, Kareem W. Ayoub, Jeff Stanway, L. L. Bennett, Demis Hassabis, Koray Kavukcuoglu, and Geoffrey Irving. Scaling language models: Methods, analysis & insights from training gopher. ArXiv, abs/2112.11446, 2021. URL https://api.semanticscholar.org/CorpusID:245353475.
|
| 255 |
+
Ross Taylor, Marcin Kardas, Guillem Cucurull, Thomas Scialom, Anthony Hartshorn, Elvis Saravia, Andrew Poulton, Viktor Kerkez, and Robert Stojnic. Galactica: A large language model for science. arXiv preprint arXiv:2211.09085, 2022.
|
| 256 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
|
| 257 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V Le, Ed H. Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $_ { \cdot } =$ 1PL1NIMMrw.
|
| 258 |
+
Yingxu Wang and Vincent Chiew. On the cognitive process of human problem solving. Cognitive Systems Research, 11(1):81–92, 2010. ISSN 1389-0417.
|
| 259 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, brian ichter, Fei Xia, Ed H. Chi, Quoc V Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview. net/forum?id ${ . } = { }$ _VjQlMeSB_J.
|
| 260 |
+
Yixuan Weng, Minjun Zhu, Fei Xia, Bin Li, Shizhu He, Kang Liu, and Jun Zhao. Large language models are better reasoners with self-verification, 2023.
|
| 261 |
+
Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Thomas L. Griffiths, Yuan Cao, and Karthik Narasimhan. Tree of Thoughts: Deliberate problem solving with large language models, 2023.
|
| 262 |
+
Xu Zhao, Yuxi Xie, Kenji Kawaguchi, Junxian He, and Qizhe Xie. Automatic model selection with large language models for reasoning. arXiv preprint arXiv:2305.14333, 2023.
|
| 263 |
+
Chuanyang Zheng, Zhengying Liu, Enze Xie, Zhenguo Li, and Yu Li. Progressive-hint prompting
|
| 264 |
+
|
| 265 |
+
improves reasoning in large language models. arXiv preprint arXiv:2304.09797, 2023.
|
| 266 |
+
|
| 267 |
+
Denny Zhou, Nathanael Schärli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Claire Cui, Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models, 2023.
|
| 268 |
+
|
| 269 |
+
# APPENDIX
|
| 270 |
+
|
| 271 |
+
# A EXPLANATION OF CONFUSION MATRIX
|
| 272 |
+
|
| 273 |
+
A confusion matrix is a specific table layout that allows visualization of the performance of an algorithm. It’s particularly useful for classification problems, and we utilize it to analyze the performance of our verification process.
|
| 274 |
+
|
| 275 |
+
The matrix itself is a two-dimensional grid, $2 \mathbf { x } 2$ , for the binary classification of verification results. Each row of the matrix represents the instances in a predicted class, which is determined by the verification results given by the language model, while each column represents the instances in an actual class, which is determined by the actual correctness of the answer given by the model. Tab. 5 shows how the matrix looks for our verification process:
|
| 276 |
+
|
| 277 |
+
Table 5: Confusion Matrix of Verification
|
| 278 |
+
|
| 279 |
+
<table><tr><td></td><td> Answer CorrectAnswer Wrong</td><td></td></tr><tr><td>Verification True</td><td>TP</td><td>FP</td></tr><tr><td>Verification False</td><td>FN</td><td>TN</td></tr></table>
|
| 280 |
+
|
| 281 |
+
Here’s what the four terms mean:
|
| 282 |
+
|
| 283 |
+
• True Positive (TP): The cases in which the model’s verification result is ‘True’, and the answer is actually correct.
|
| 284 |
+
• True Negative (TN): The cases in which the model’s verification result is ‘False’, and the answer is actually wrong.
|
| 285 |
+
• False Positive (FP): The cases in which the model’s verification result is ‘True’, but the answer is actually wrong.
|
| 286 |
+
• False Negative (FN): The cases in which the model’s verification result is ‘False’, but the answer is actually correct.
|
| 287 |
+
|
| 288 |
+
This matrix is very helpful for measuring more than just straightforward accuracy, based on which Precision and Recall are two important metrics. They are defined in Eq. 2 and their meanings are as follows:
|
| 289 |
+
|
| 290 |
+
• Precision is the fraction of relevant instances among the retrieved instances. It is a measure of the accuracy of the classifier when it predicts the positive class. • Recall is the fraction of the total amount of relevant instances that were actually retrieved. It is a measure of the ability of a classifier to find all the positive instances.
|
| 291 |
+
|
| 292 |
+
$$
|
| 293 |
+
{ \mathrm { P r e c i s i o n } } = { \frac { \mathrm { T P } } { \mathrm { T P } + { \mathrm { F P } } } } , { \mathrm { R e c a l l } } = { \frac { \mathrm { T P } } { \mathrm { T P } + { \mathrm { F N } } } }
|
| 294 |
+
$$
|
| 295 |
+
|
| 296 |
+
In other words, precision answers the question "What proportion of verified TRUE answers was actually correct?" while recall answers "What proportion of actual correct answers was verified TRUE?" Given its meaning, verification-guided voting is bound to be effective when the precision of verification is high.
|
| 297 |
+
|
| 298 |
+
# B PYTHON PACKAGE USAGE ANALYSIS
|
| 299 |
+
|
| 300 |
+
Tab. 6 outlines the usage of various Python packages in our experiments. Among them, we found that the sympy package is utilized most frequently, highlighting its central role in the computational tasks performed.
|
| 301 |
+
|
| 302 |
+
Table 6: Python package usage frequency on MATH dataset.
|
| 303 |
+
|
| 304 |
+
<table><tr><td></td><td>All</td><td>Correct</td><td>Correct per code</td><td>Wrong</td><td>Wrong per code</td><td>c/w per code</td></tr><tr><td> sympy</td><td>0.4168</td><td>0.3907</td><td>0.3323</td><td>0.4724</td><td>0.3194</td><td>104%</td></tr><tr><td>math</td><td>0.1590</td><td>0.1638</td><td>0.1393</td><td>0.1493</td><td>0.1009</td><td>138%</td></tr><tr><td>numpy</td><td>0.0284</td><td>0.0241</td><td>0.0205</td><td>0.0383</td><td>0.0259</td><td>79%</td></tr><tr><td>fractions</td><td>0.0094</td><td>0.0110</td><td>0.0094</td><td>0.0058</td><td>0.004</td><td>238%</td></tr><tr><td>itertools</td><td>0.0034</td><td>0.0029</td><td>0.0025</td><td>0.0045</td><td>0.0031</td><td>80%</td></tr><tr><td>cmath</td><td>0.0034</td><td>0.0026</td><td>0.0022</td><td>0.0052</td><td>0.0035</td><td>63%</td></tr><tr><td>scipy</td><td>0.0016</td><td>0.0009</td><td>0.0007</td><td>0.0032</td><td>0.0022</td><td>34%</td></tr><tr><td>matplotlib</td><td>0.0010</td><td>0.0003</td><td>0.0003</td><td>0.0026</td><td>0.0018</td><td>14%</td></tr><tr><td>functools</td><td>0.0004</td><td>0.0003</td><td>0.0003</td><td>0.0007</td><td>0.0004</td><td>57%</td></tr><tr><td>collections</td><td>0.0004</td><td>0.0006</td><td>0.0005</td><td>0.0000</td><td>0.0000</td><td>NaN</td></tr><tr><td>statistics</td><td>0.0002</td><td>0.0003</td><td>0.0003</td><td>0.0000</td><td>0.0000</td><td>NaN</td></tr></table>
|
| 305 |
+
|
| 306 |
+
Table 7: Performance of CSV on GSM8K and MATH based on CodeLlama-7B and CodeLlama-34B.
|
| 307 |
+
|
| 308 |
+
<table><tr><td></td><td>一 GSM8K Accuracy (%) | MATH Accuracy (%)</td><td></td></tr><tr><td>CodeLlama-7B</td><td>一 17.44 一</td><td>6.56</td></tr><tr><td>CodeLlama-7B + CSV</td><td>一 20.85 一</td><td>10.18</td></tr><tr><td>CodeLlama-34B</td><td>一 28.96 一</td><td>9.12</td></tr><tr><td>CodeLlama-34B + CSV|</td><td>37.60 一</td><td>13.36</td></tr></table>
|
| 309 |
+
|
| 310 |
+
# C CSV ON OPEN SOURCE MODELS
|
| 311 |
+
|
| 312 |
+
We have tested our method on CodeLlama-7B and CodeLlama-34B by applying the same prompting method of CSV to these weaker models in a zero-shot manner. The results are shown in Tab. 7. As can be seen, there is a noticeable improvement on the accuracy of both GSM8K and MATH, though the accuracy is much lower compared to GPT4-Code.
|
| 313 |
+
|
| 314 |
+
# D DETAILED EXPERIMENT RESULT ON MMLU DATASET
|
| 315 |
+
|
| 316 |
+
Fig. 7 illustrates that GPT4-Code performs relatively poorly in certain domains, such as engineering and the humanities, with a particularly marked deficiency in virology, where it achieves a score of less than $60 \%$ . These observations delineate specific areas that call for further investigation and refinement, thus outlining the direction for future improvements in the model.
|
| 317 |
+
|
| 318 |
+

|
| 319 |
+
Figure 7: GPT4-Code performance on MMLU dataset on: (a) subsubcategory, (b) category, (c) subcategory
|
| 320 |
+
|
| 321 |
+

|
| 322 |
+
Figure 8: Performance of GPT4-Code with CSV prompt on MMLU dataset on: (a) subsubcategory, (b) category, (c) subcategory
|
| 323 |
+
|
| 324 |
+
# E EXAMPLES OF SELF-DEBUGGING MECHANISM IN GPT4-CODE
|
| 325 |
+
|
| 326 |
+
<table><tr><td>Math Problem: 0.54 as a fraction in lowest terms.</td></tr><tr><td>Sure, we can solve this problem by setting up an equation, solving it, and simplifying the fraction.</td></tr><tr><td>Let's call 0.54 as x. The decimal 0.54 means that the digits "54" repeat indefinitely. So, we can multiply x by 100 (since "54" is a two-digit number) to get another equation.</td></tr><tr><td>This gives us 100x = 54.54.</td></tr><tr><td>By subtracting the original equation from this new one, we eliminate the repeating decimal: 100x- x= 54.54-0.54. Let's perform these steps in the next Python cell.</td></tr></table>
|
| 327 |
+
|
| 328 |
+
# define the symbol $\mathrm { ~ x ~ } =$ symbols $( \mathbf { \partial } ^ { \prime } \mathbf { x } ^ { \prime } \mathbf { \partial } )$ )
|
| 329 |
+
|
| 330 |
+
# Apologies for the mistake. We can’t directly subtract two equations in Python. Instead, we should subtract the right-hand sides and left-hand sides of the equations separately to get a new equation. Let’s correct that.
|
| 331 |
+
|
| 332 |
+
# subtract the right hand sides and left hand sides of the equations separately
|
| 333 |
+
rhs $=$ simplify(eq2.rhs - eq1.rhs)
|
| 334 |
+
lhs $=$ simplify(eq2.lhs - eq1.lhs) RESULT
|
| 335 |
+
$\mathbf { E q } ( 9 9 ^ { * } \mathbf { x } , 5 4 . \mathbf { 0 } )$
|
| 336 |
+
After subtraction, we get the equation $9 9 x = 5 4$ . Next, we can solve for $x$ to express $0 . { \overline { { 5 4 } } }$ as a fraction.
|
| 337 |
+
|
| 338 |
+
# solve for x solution $=$ solve(new_eq, x)
|
| 339 |
+
|
| 340 |
+
solution[0]
|
| 341 |
+
|
| 342 |
+
RESULT
|
| 343 |
+
0.545454545454545
|
| 344 |
+
The solution for $x$ is approximately 0.545454545454545, but we need to express it as a fraction. Let’s convert this decimal into a fraction.
|
| 345 |
+
|
| 346 |
+
# convert the decimal solution to a fraction fraction $=$ nsimplify(solution[0])
|
| 347 |
+
|
| 348 |
+
fraction
|
| 349 |
+
|
| 350 |
+
RESULT
|
| 351 |
+
6/11
|
| 352 |
+
The decimal 0.54 can be expressed as the fraction $\frac { 6 } { 1 1 }$ .
|
| 353 |
+
|
| 354 |
+
<table><tr><td>Math Problem: A bus comes by Jerry's bus stop every 20 minutes starting at exactly 5:13 a.m. If Jerry shows up at exactly 8:35 a.m.,how many minutes will he have to wait for the next bus?</td></tr><tr><td>Step 1: Calculate the total minutes from 5:13 a.m. to 8:35 a.m. Total minutes from 5:13 a.m. to 8:35 a.m. is 180 + 22 minutes. Step 2: Calculate how many buses have come by during this time. Step 3: Calculate the time when the last bus before 8:35 a.m. came by. - The time when the last bus came by is 5 : 13a.m. + 20 × [n」minutes.</td></tr></table>
|
| 355 |
+
|
| 356 |
+
# Step 1: Calculate the total minutes from 5:13 a.m. to 8:35 a.m. total_minutes $= \ 1 8 0 \ + \ 2 2$
|
| 357 |
+
|
| 358 |
+
# RESULT
|
| 359 |
+
|
| 360 |
+
#
|
| 361 |
+
|
| 362 |
+
It seems that there’s a mistake in the calculations. The waiting time cannot be negative. This error might have occurred in Step 3, where I calculated the time of the last bus in minutes past midnight, but then in Step 4, I subtracted this from the total time from $5 { : } 1 3 \ \mathrm { a . m }$ . to $8 { : } 3 5 \ \mathrm { a . \dot { m } }$ . I should correct Step 4 to calculate the time until the next bus, which is either 0 if a bus has just arrived at $8 { : } 3 5 \ \mathrm { a . m }$ ., or 20 minutes minus the time since the last bus if a bus arrived before 8:35 a.m.
|
| 363 |
+
|
| 364 |
+
Let’s correct this.
|
| 365 |
+
|
| 366 |
+
# Corrected Step 4: Calculate the time until the next bus time_since_last_bus $=$ total_minutes - last_bus_time
|
| 367 |
+
|
| 368 |
+
# RESULT
|
| 369 |
+
|
| 370 |
+
#
|
| 371 |
+
|
| 372 |
+
There still seems to be a mistake in the calculations. The waiting time calculated is significantly more than 20 minutes, which is not possible given that the bus comes every 20 minutes. Looking back at the calculations, it seems that the error is in Step 3 when calculating the time the last bus came. The last bus time should be calculated from $5 { : } 1 3 \ \mathrm { a . m . }$ ., not from midnight. Let’s correct this.
|
| 373 |
+
|
| 374 |
+
# Corrected Step 3: Calculate the time when the last bus before 8:35 a.m. came by. last_bus_time_corrected $= 5 \star 6 0 + 1 3 +$ num_buses $\star \_ 0$
|
| 375 |
+
|
| 376 |
+
# RESULT
|
| 377 |
+
|
| 378 |
+
#
|
| 379 |
+
|
| 380 |
+
It seems there is still an error. Let’s try a different approach.
|
| 381 |
+
|
| 382 |
+
1. Calculate the total minutes that have passed since the first bus at $5 { : } 1 3 \ \mathrm { a . m }$ . until $8 { : } 3 5 \ \mathrm { a . m }$ . 2. Since the buses come every 20 minutes, calculate how many complete cycles of 20 minutes have passed in the calculated total minutes. 3. The time Jerry will have to wait is the remainder of the total minutes divided by 20 (which is the time since the last bus) subtracted from 20 (which is the bus cycle). This approach should give us the correct waiting time. Let’s calculate it.
|
| 383 |
+
|
| 384 |
+
# Calculate total minutes from 5:13 a.m. to 8:35 a.m. total_minutes $= 3 \star 6 0 + 2 2$ # 3 hours and 22 minutes
|
| 385 |
+
|
| 386 |
+
# RESULT
|
| 387 |
+
|
| 388 |
+
18 So, Jerry will have to wait for 18 minutes for the next bus.
|
| 389 |
+
|
| 390 |
+
# Answer: 18
|
| 391 |
+
|
| 392 |
+
# F EXAMPLES OF NATURAL LANGUAGE VERIFICATION
|
| 393 |
+
|
| 394 |
+
# code 0
|
| 395 |
+
|
| 396 |
+
# code 1
|
| 397 |
+
|
| 398 |
+
# code more
|
| 399 |
+
|
| 400 |
+
The given fraction is
|
| 401 |
+
|
| 402 |
+
$$
|
| 403 |
+
\frac { 4 3 2 1 } { 5 ^ { 7 } \cdot 2 ^ { 8 } }
|
| 404 |
+
$$
|
| 405 |
+
|
| 406 |
+
To simplify this fraction, we can notice that $5 ^ { 7 } \ \cdot \ 2 ^ { 8 } = 1 0 ^ { 7 }$ , which would mean the fraction is equivalent to 4321 × 10−7, i.e., the number 4321 with the decimal point moved 7 places to the left. This would result in the number 0.0004321.
|
| 407 |
+
|
| 408 |
+
To get the sum of the digits in the terminating decimal representation of this number, we just need to add up the digits in 4321, since the zeros do not contribute to the sum.
|
| 409 |
+
|
| 410 |
+
So, the sum is $4 + 3 + 2 + 1 = 1 0$ Therefore, the answer is 10
|
| 411 |
+
|
| 412 |
+
$\#$ Convert to string and replace the decimal point
|
| 413 |
+
str_value $=$ str(value).replace(’. , ’’)
|
| 414 |
+
|
| 415 |
+
# Answer:
|
| 416 |
+
|
| 417 |
+
The denominator can be rewritten as $1 0 ^ { m i n ( 7 , 8 ) } \quad \times$ $5 ^ { m a x ( 0 , 7 - 8 ) } \quad \times \quad 2 ^ { m a x ( 0 , 8 - 7 ) }$ , where $m i n ( a , b )$ is the minimum of $a$ and $b$ , and $m a x ( a , b )$ is the maximum of $a$ and $^ { b }$ . Now let’s calculate the value of $m i n ( 7 , 8 )$ , $m a x ( 0 , 7 - 8 )$ , and $m a x ( 0 , 8 - 7 )$ .
|
| 418 |
+
|
| 419 |
+
# RESULT:
|
| 420 |
+
|
| 421 |
+
Now, let’s simplify the fraction $\frac { 4 3 2 1 } { 1 0 ^ { 7 } \times 5 ^ { 0 } \times 2 ^ { 1 } }$ .
|
| 422 |
+
|
| 423 |
+
$\#$ define the numerator and denominator
|
| 424 |
+
numerator $= \ 4 3 2 1$
|
| 425 |
+
denominator $= 1 0 \star \star 7 \star 5 \star \star 0 \star 2 \star \star 1$
|
| 426 |
+
|
| 427 |
+
# RESULT: 0.00021605
|
| 428 |
+
|
| 429 |
+
We exclude the zeros before the first non-zero digit and the decimal point as they do not contribute to the sum.
|
| 430 |
+
|
| 431 |
+
Thus, the sum of the digits is the sum of 2, 1, 6, 0, and 5. Let’s calculate it.
|
| 432 |
+
|
| 433 |
+
digits $=$ [2, 1, 6, 0, 5] # calculate the sum of the digits sum_of_digits $=$ sum(digits)
|
| 434 |
+
|
| 435 |
+
# RESULT:
|
| 436 |
+
|
| 437 |
+
So, the final answer is: 14
|
| 438 |
+
|
| 439 |
+
# Answer: 14
|
| 440 |
+
|
| 441 |
+
Math Problem: Solve for $x : 3 ^ { 2 x } + 1 9 = 1 0 ^ { x } .$
|
| 442 |
+
|
| 443 |
+
# code 0
|
| 444 |
+
|
| 445 |
+
# code more
|
| 446 |
+
|
| 447 |
+
This is a difficult equation to solve and there’s no simple analytical solution using elementary functions. In real world scenarios, such equations are typically solved numerically. For example, using a graphing calculator, a computer, or a mathematical software. However, if you want an approximation of the solution, it is advisable to use numerical methods such as the bisection method, Newton’s method, or others. If you would like me to provide an algorithm to find the solution numerically, let me know.
|
| 448 |
+
|
| 449 |
+
The equation you’re asking to solve, $\bar { 3 } ^ { 2 x } + 1 9 = 1 0 ^ { x }$ , cannot be solved algebraically due to the nature of the functions and operations involved. Therefore, we’ll need to use numerical methods such as Newton’s method or Bisection method for root finding.
|
| 450 |
+
|
| 451 |
+
from scipy.optimize import fsolve
|
| 452 |
+
import numpy as np
|
| 453 |
+
# Defining the function
|
| 454 |
+
def func(x): return $3 \star \star ( 2 \star \mathbf { x } ) + 1 9 - 1 0 \star \star \mathbf { x }$
|
| 455 |
+
# Initial guess for x, it can be anything, 1.0 is chosen arbitrarily here
|
| 456 |
+
$\times 0 = 1 . 0$
|
| 457 |
+
$\#$ Using fsolve to find the root
|
| 458 |
+
root $=$ fsolve(func, $\mathtt { x 0 }$ )
|
| 459 |
+
x = root[0]
|
| 460 |
+
x
|
| 461 |
+
|
| 462 |
+
# RESULT 1.001831315399663
|
| 463 |
+
|
| 464 |
+
Answer:
|
| 465 |
+
Rewrite the equation as:
|
| 466 |
+
$3 ^ { 2 x } - 1 0 + 1 \bar { 9 } = 0$
|
| 467 |
+
Let’s denote $\begin{array} { r l r l } { { 3 } ^ { x } } & { { } = { } } & { a } \end{array}$ , and $1 0 ^ { x } = b$
|
| 468 |
+
so $a ^ { 2 } - b + 1 9 = 0$
|
| 469 |
+
now we have two equations:
|
| 470 |
+
1. $a = 3 ^ { x }$
|
| 471 |
+
2. $b = 1 0 ^ { x }$ Let’s solve this with Python.
|
| 472 |
+
# Define the system of equations
|
| 473 |
+
def equations(vars): x, a, b = vars $\mathtt { e q 1 } \ = \ \mathtt { a } \ - \ 3 \star \star \mathbf { x }$ $\mathtt { e q 2 } \ = \ \mathtt { b } \ - \ \mathtt { 1 0 \star \star x }$ $\mathtt { e q 3 } ~ = ~ \mathtt { a } \star \star 2 ~ - ~ \mathtt { b } ~ + ~ 1 \subseteq$ return [eq1, eq2, eq3]
|
| 474 |
+
|
| 475 |
+
# RESULT:
|
| 476 |
+
|
| 477 |
+
$$
|
| 478 |
+
\bar { 3 } ^ { 2 . 0 } + 1 9 = 1 0 ^ { 0 }
|
| 479 |
+
$$
|
| 480 |
+
|
| 481 |
+
Let’s try a different initial guess for the solution to see if that helps.
|
| 482 |
+
|
| 483 |
+
$\#$ Adjust initial guess for x, a, b
|
| 484 |
+
$\mathrm { ~ \bf ~ x 0 ~ } = \mathrm { ~ \bf ~ [ ~ } 1$ , 3, 10]
|
| 485 |
+
|
| 486 |
+
$\#$ Solve system of equations solution $=$ root(equations, x0)
|
| 487 |
+
|
| 488 |
+
# RESULT: 2.0000000000004463
|
| 489 |
+
|
| 490 |
+
We know that $3 ^ { 2 \cdot 2 } = 3 ^ { 4 } = 8 1$ and $1 0 ^ { 2 } ~ = ~ 1 0 0$ . The left-hand side becomes 100 and the righthand side is also 100. Thus, the original equation holds true for $x = 2$ .
|
| 491 |
+
|
| 492 |
+
# Answer: 2
|
| 493 |
+
|
| 494 |
+
# G EXAMPLES OF DIFFERENT VERIFICATION RESULTS
|
| 495 |
+
|
| 496 |
+
# True
|
| 497 |
+
|
| 498 |
+
# False
|
| 499 |
+
|
| 500 |
+
The angle $A B C$ is the angle between the vectors $\vec { B A }$ and $B \bar { C }$ . We can find these vectors as follows:
|
| 501 |
+
|
| 502 |
+
$$
|
| 503 |
+
\vec { B A } = \vec { A } - \vec { B } = ( - 2 , - 7 , 1 )
|
| 504 |
+
$$
|
| 505 |
+
|
| 506 |
+
$$
|
| 507 |
+
\vec { B C } = \vec { C } - \vec { B } = ( - 5 , 5 , - 2 )
|
| 508 |
+
$$
|
| 509 |
+
|
| 510 |
+
The angle $\theta$ between two vectors $\vec { u }$ and $\vec { v }$ can be found using the formula
|
| 511 |
+
|
| 512 |
+
$$
|
| 513 |
+
\cos ( \theta ) = { \frac { { \vec { u } } \cdot { \vec { v } } } { | | { \vec { u } } | | | | | { \vec { v } } | | } }
|
| 514 |
+
$$
|
| 515 |
+
|
| 516 |
+
Let’s calculate these values.
|
| 517 |
+
|
| 518 |
+
import numpy as np
|
| 519 |
+
|
| 520 |
+
# Define vectors vec_BA $=$ np.array([1, -11, 2]) - np.array([3, -4, 1])
|
| 521 |
+
|
| 522 |
+
# RESULT:
|
| 523 |
+
|
| 524 |
+
# 120.00000000000001
|
| 525 |
+
|
| 526 |
+
Let’s now verify this answer.
|
| 527 |
+
|
| 528 |
+
$$
|
| 529 |
+
\vec { u } \cdot \vec { v } = | | \vec { u } | | \cdot | | \vec { v } | | \cdot \cos ( \theta )
|
| 530 |
+
$$
|
| 531 |
+
|
| 532 |
+
Substituting our values into this formula, we should get the same dot product (-27) that we calculated earlier. Let’s check this.
|
| 533 |
+
|
| 534 |
+
# Compute the dot product using the formula
|
| 535 |
+
dot_product_verification $=$ magnitude_BA $^ { \star }$ magnitude_BC \* np.cos(theta $\star \mathrm { \ n p . p i } \mathrm { \Delta } /$ 180)
|
| 536 |
+
|
| 537 |
+
# RESULT: -27
|
| 538 |
+
|
| 539 |
+
#
|
| 540 |
+
|
| 541 |
+
which matches the dot product we calculated earlier. Therefore, the computed angle of $1 2 0 ^ { \circ }$ is correct.
|
| 542 |
+
|
| 543 |
+
Answer: 120◦
|
| 544 |
+
|
| 545 |
+
the cosine of the angle $\theta$ between them is given by
|
| 546 |
+
|
| 547 |
+
$$
|
| 548 |
+
\cos \theta = { \frac { \mathbf { u } \cdot \mathbf { v } } { \left| \left| \mathbf { u } \right| \right| \left| \left| \mathbf { v } \right| \right| } }
|
| 549 |
+
$$
|
| 550 |
+
|
| 551 |
+
Table 12: An example in which True succeeds while Uncertain and False fails.
|
| 552 |
+
|
| 553 |
+
<table><tr><td>Math Problem: Let A = (1,-11,2), B = (3,-4,1), and C = (-2,1,-1). Compute ∠ABC, in degrees.</td></tr></table>
|
| 554 |
+
|
| 555 |
+
In the given problem, we want to find the angle between vectors $\xrightarrow [ A B ] { }$ and $\overrightarrow { B C }$ , where
|
| 556 |
+
|
| 557 |
+
$$
|
| 558 |
+
\overrightarrow { A B } = { \bf B } - { \bf A } = ( 2 , 7 , - 1 )
|
| 559 |
+
$$
|
| 560 |
+
|
| 561 |
+
$$
|
| 562 |
+
\overrightarrow { B C } = \mathbf { C } - \mathbf { B } = ( - 5 , 5 , - 2 )
|
| 563 |
+
$$
|
| 564 |
+
|
| 565 |
+
Now, we’ll calculate the angle using the formula for $\cos \theta$ .
|
| 566 |
+
|
| 567 |
+
from numpy import array, dot from numpy.linalg import norm import math
|
| 568 |
+
|
| 569 |
+
# Defining the vectors $\begin{array} { r l } { \mathbb { A } } & { { } = } \end{array}$ array([1, -11, 2])
|
| 570 |
+
|
| 571 |
+
# RESULT:
|
| 572 |
+
|
| 573 |
+
#
|
| 574 |
+
|
| 575 |
+
The angle $\angle A B C$ is $6 0 ^ { \circ }$
|
| 576 |
+
|
| 577 |
+
The vector $\xrightarrow [ A B ] { }$ is given by $B \mathrm { ~ - ~ } A$ , and the vector $\overrightarrow { B C }$ is given by $C - B$ .
|
| 578 |
+
|
| 579 |
+
The cosine of the angle between two vectors $\mathbf { u }$ and $\mathbf { v }$ is given by
|
| 580 |
+
|
| 581 |
+
$$
|
| 582 |
+
\cos ( \theta ) = { \frac { \mathbf { u } \cdot \mathbf { v } } { \| \mathbf { u } \| \| \mathbf { v } \| } }
|
| 583 |
+
$$
|
| 584 |
+
|
| 585 |
+
# Let’s calculate.
|
| 586 |
+
|
| 587 |
+
import numpy as np
|
| 588 |
+
|
| 589 |
+
# define the points A = np.array([1, -11, 2])
|
| 590 |
+
|
| 591 |
+
# RESULT: 60.00000000000001
|
| 592 |
+
|
| 593 |
+
The angle $A B C$ is approximately $6 0 . 0 ^ { \circ }$ . Let’s verify this. We can solve for $\cos ( \dot { C } )$ :
|
| 594 |
+
|
| 595 |
+
$$
|
| 596 |
+
\cos ( C ) = { \frac { a ^ { 2 } + b ^ { 2 } - c ^ { 2 } } { 2 a b } }
|
| 597 |
+
$$
|
| 598 |
+
|
| 599 |
+
# calculate the magnitudes of AC magnitude_AC $=$ np.linalg.norm(AC)
|
| 600 |
+
|
| 601 |
+
# RESULT:
|
| 602 |
+
|
| 603 |
+
I apologize for the confusion; there seems to have been a mistake in the verification.
|
| 604 |
+
|
| 605 |
+
The discrepancy arises due to the directionality of the vectors.
|
| 606 |
+
|
| 607 |
+
# True
|
| 608 |
+
|
| 609 |
+
# False
|
| 610 |
+
|
| 611 |
+
The least common multiple (LCM) of two numbers $a$ and $^ { b }$ is given by the formula:
|
| 612 |
+
|
| 613 |
+
$$
|
| 614 |
+
\operatorname { L C M } ( a , b ) = { \frac { | a \times b | } { \operatorname { G C D } ( a , b ) } }
|
| 615 |
+
$$
|
| 616 |
+
|
| 617 |
+
Hence, the equation can be rewritten as:
|
| 618 |
+
|
| 619 |
+
First, let’s find the prime factorization of 7000.
|
| 620 |
+
|
| 621 |
+
In this problem, we are given that $l c m ( r , 7 0 0 ) = 7 0 0 0$ . Let’s first find the prime factors of 700 and 7000.
|
| 622 |
+
|
| 623 |
+
$$
|
| 624 |
+
\frac { r \times 7 0 0 } { \mathrm { G C D } ( r , 7 0 0 ) } = 7 0 0 0
|
| 625 |
+
$$
|
| 626 |
+
|
| 627 |
+
import sympy
|
| 628 |
+
|
| 629 |
+
$\#$ Find the prime factorization of 700 and 7000
|
| 630 |
+
factors_ $. 7 0 0 ~ =$ sympy.factorint (700)
|
| 631 |
+
|
| 632 |
+
We also know that $r$ must be a divisor of 7000. So, we’ll find all the divisors of 7000.
|
| 633 |
+
|
| 634 |
+
# Find all divisors of 7000
|
| 635 |
+
divisors_7000 $=$ sympy.divisors (7000)
|
| 636 |
+
# Filter out the divisors
|
| 637 |
+
r_values_corrected $\begin{array} { r l r } { \mathbf { \Phi } } & { { } = } & { [ \mathbf { \Phi } \mathbf { r } } \end{array}$ for r in divisors_7000 $\mathrm { ~ i ~ f ~ } \mathrm { ~ r ~ } = = \mathrm { ~ 7 0 0 0 ~ }$ \* sympy.gcd(r, 700) // 700]
|
| 638 |
+
|
| 639 |
+
# RESULT:
|
| 640 |
+
|
| 641 |
+
# (7000, 1000)
|
| 642 |
+
|
| 643 |
+
Let’s verify our solution by checking whether the LCM of each possible $r$ and 700 is indeed 7000.
|
| 644 |
+
|
| 645 |
+
# Verify the solution
|
| 646 |
+
lcm_values_corrected $=$ [sympy.lcm (r, 700) for r in r_values_corrected]
|
| 647 |
+
|
| 648 |
+
# RESULT:
|
| 649 |
+
|
| 650 |
+
# (True, True)
|
| 651 |
+
|
| 652 |
+
Upon verification, we find that the least common multiple (LCM) of each possible value of $r$ and 700 is indeed 7000. Hence, the sum of all positive integers $r$ that satisfy $\mathrm { l c } \hat { \mathrm { m } } [ r , 7 0 0 ] = \mathsf { ^ { - } 7 0 0 0 }$ is $1 0 0 0 + 7 0 0 0 = 8 0 0 0$ . The answer is 8000.
|
| 653 |
+
|
| 654 |
+
import sympy
|
| 655 |
+
# Get the prime factorization of 7000
|
| 656 |
+
prime_factors $=$ sympy.factorint (7000)
|
| 657 |
+
# Generate all factors of 7000
|
| 658 |
+
factors = set()
|
| 659 |
+
for factor_2_count in range( prime_factors[2] $+ ~ \perp )$ ): for factor_5_count in range( prime_factors[5] $\textsuperscript { + } ~ \textsuperscript { 1 1 }$ ):
|
| 660 |
+
|
| 661 |
+
# RESULT:
|
| 662 |
+
|
| 663 |
+
# (2: 3, 5: 3, 7: 1, [3500, 700, 7000, 1400], 12600)
|
| 664 |
+
|
| 665 |
+
The prime factorization of 7000 is $2 ^ { 3 } { \cdot } 5 ^ { 3 } \cdot 7 ^ { 1 }$ . The factors of 7000 that are multiples of 700 are: 3500, 700, 7000, and 1400. So, the sum of all positive integers $r$ that satisfy $\mathrm { l c } \hat { \mathrm { m } } ( r , 7 0 0 ) = 7 0 0 0$ is $3 5 0 0 + 7 0 0 + 7 0 0 0 + 1 4 0 0 =$ 12600. So the final answer is 12600.
|
| 666 |
+
|
| 667 |
+
# RESULT:
|
| 668 |
+
|
| 669 |
+
(2: 2, 5: 2, 7: 1, 2: 3, 5: 3, 7: 1) Since the LCM of r and 700 is 7000, r must contain all the prime factors of 7000 that are not already in 700.
|
| 670 |
+
|
| 671 |
+
# Generate all combinations
|
| 672 |
+
combinations = list(product(\*[[1, i] for i in extra_factors ]))
|
| 673 |
+
|
| 674 |
+
# RESULT:
|
| 675 |
+
|
| 676 |
+
# ([1, 5, 2, 10], 18)
|
| 677 |
+
|
| 678 |
+
The possible values of r are 1, 2, 5, and 10.
|
| 679 |
+
To verify our answer, we can check that the least common multiple of r and 700 is indeed 7000.
|
| 680 |
+
# Remove 1 from the possible values of r
|
| 681 |
+
possible_r_values.remove(1)
|
| 682 |
+
.. ...
|
| 683 |
+
|
| 684 |
+
# RESULT:
|
| 685 |
+
|
| 686 |
+
# False
|
| 687 |
+
|
| 688 |
+
It seems that there’s a mistake. Not all the calculated values of r satisfy the given condition. Let’s correct the calculation.
|
| 689 |
+
|
| 690 |
+
$\#$ All the values of $\mathbb { r }$ should have the factors of 700 r_values $=$ [700]
|
| 691 |
+
|
| 692 |
+
RESULT: ([700, 1400, 3500, 7000], 18720) Therefore, answer is 18720.
|
| 693 |
+
|
| 694 |
+
# Answer: 8000
|
| 695 |
+
|
| 696 |
+
# H FAILURE EXAMPLES OF NATURAL LANGUAGE VERIFICATION
|
| 697 |
+
|
| 698 |
+
$\bf M a t h P r o b l e m \colon L e t a _ { n } = 4 n ^ { 3 } + 6 n ^ { 2 } + 4 n + 1 . \mathrm { F i n d } a _ { 8 } + a _ { 9 } + a _ { 1 0 } + \cdot \cdot \cdot + a _ { 2 3 } .$
|
| 699 |
+
|
| 700 |
+
The sequence $a _ { n } = 4 n ^ { 3 } + 6 n ^ { 2 } + 4 n + 1$ is a cubic sequence. To find the sum $a _ { 8 } + a _ { 9 } + a _ { 1 0 } +$ $\cdots + a _ { 2 3 }$ , we can use the property of cubic sequences which states that the sum of consecutive terms in a cubic sequence forms a quartic sequence. Given that the sum of the first $n$ terms ...... Let’s calculate this.
|
| 701 |
+
|
| 702 |
+
# Define the function for the sum of the first n terms
|
| 703 |
+
def S(n): return $n \star \star 4 + 2 \star \square \star \star 3 + 2 \star \square \star \star 2 + \square$
|
| 704 |
+
# Calculate the sum of terms from a_8 to a_23
|
| 705 |
+
sum_8_to_23 = S(23) - S(7)
|
| 706 |
+
sum_8_to_23
|
| 707 |
+
|
| 708 |
+
# RESULT 302064
|
| 709 |
+
|
| 710 |
+
The sum of the terms from $a _ { 8 }$ to $a _ { 2 3 }$ is
|
| 711 |
+
|
| 712 |
+
Now, let’s verify this result. The sum of the terms from $a _ { 8 }$ to $a _ { 2 3 }$ is equivalent to the sum of the terms $a _ { n }$ from $n = 8$ to $n = 2 3$ . This is equal to
|
| 713 |
+
|
| 714 |
+
$$
|
| 715 |
+
4 \cdot 8 ^ { 3 } + 6 \cdot 8 ^ { 2 } + 4 \cdot 8 + 1 + 4 \cdot 9 ^ { 3 } + 6 \cdot 9 ^ { 2 } + 4 \cdot 9 + 1 + \ldots + 4 \cdot 2 3 ^ { 3 } + 6 \cdot 2 3 ^ { 2 } + 4 \cdot 2 3 + 1
|
| 716 |
+
$$
|
| 717 |
+
|
| 718 |
+
We can’t calculate this manually without a calculator or any programming language. However, we can still verify the result by checking the properties of the sequence and the sum formula. Given the sequence $a _ { n } = 4 n ^ { 3 } \dot { + } 6 n ^ { 2 } + 4 \bar { n } + 1$ , the sum of the first $n$ terms is a quartic sequence, which is given by $S _ { n } = n ^ { 4 } + 2 n ^ { 3 } + 2 n ^ { 2 } + n$ . This is derived correctly from the sequence by term-by-term integration. The sum of terms from $a _ { 8 }$ to $a _ { 2 3 }$ is found by subtracting the sum of the first 7 terms from the sum of the first 23 terms, which is $S _ { 2 3 } - \bar { S _ { 7 } }$ . This is also a correct approach. Therefore, without actually calculating the sum, we can say that the method used to find the sum and the sum formula are correct. Based on these observations, the calculated result is likely to be correct as well. So, the verification result is:
|
| 719 |
+
|
| 720 |
+
Math Problem: Compute P∞k=1 k+2k!+(k+1)!+(k+2)! .
|
| 721 |
+
|
| 722 |
+
The sum
|
| 723 |
+
|
| 724 |
+
$$
|
| 725 |
+
\sum _ { k = 1 } ^ { \infty } { \frac { k + 2 } { k ! + ( k + 1 ) ! + ( k + 2 ) ! } }
|
| 726 |
+
$$
|
| 727 |
+
|
| 728 |
+
can be rearranged to recognize a pattern ......
|
| 729 |
+
|
| 730 |
+
$$
|
| 731 |
+
\boxed { e - 1 }
|
| 732 |
+
$$
|
| 733 |
+
|
| 734 |
+
where $e$ is the base of the natural logarithm.Now let’s verify the result. Recall that the series
|
| 735 |
+
|
| 736 |
+
$$
|
| 737 |
+
\sum _ { k = 1 } ^ { \infty } { \frac { 1 } { ( k - 1 ) ! } }
|
| 738 |
+
$$
|
| 739 |
+
|
| 740 |
+
is a shifted version of the series
|
| 741 |
+
|
| 742 |
+
$$
|
| 743 |
+
\sum _ { k = 0 } ^ { \infty } { \frac { 1 } { k ! } }
|
| 744 |
+
$$
|
| 745 |
+
|
| 746 |
+
which is known to converge to $e$ , the base of the natural logarithm. The original series is missing the 0! term, which is equal to 1, so we subtract 1 from $e$ to get the sum of the original series. Therefore, based on the properties of the series and the value of $e$ , it seems reasonable to conclude that the solution is $e - 1$ . Therefore, the verification result is:
|
| 747 |
+
|
| 748 |
+
Answer: e - 1 ✗
|
| 749 |
+
|
| 750 |
+
# I DISTRIBUTION OF THE CONSISTENCY BETWEEN REASONING PROCESS AND VERIFICATION PROCESS
|
| 751 |
+
|
| 752 |
+
To further analyze the consistency between the verification process, NL reasoning process, and output correctness, we have collected examples of four kinds from MATH shown in Fig. 9. The reasoning process is correct if the answer before the verification is correct. The verification process is correct if the verification process itself is correct. The four kinds of examples are explained below:
|
| 753 |
+
|
| 754 |
+
• Reasoning: Correct, Verification: Correct. When both the reasoning and verification processes are correct, the verification successfully validates the solution, ensuring consistency with the answer and the natural language (NL) reasoning process. • Reasoning: Correct, Verification: Wrong. If the reasoning is correct but the verification is erroneous, the verification fails to recognize the correct solution. • Reasoning: Wrong, Verification: Correct. If the reasoning is incorrect but the verification is accurate, the verification process amends the erroneous reasoning, leading to a correct answer. • Reasoning: Wrong, Verification: Wrong. If both the reasoning and verification processes are incorrect, the verification is unable to rectify the flawed solution.
|
| 755 |
+
|
| 756 |
+
Fig. 9 demonstrates that in most of the samples, reasoning process and verification process are consistent with each other.
|
| 757 |
+
|
| 758 |
+

|
| 759 |
+
Figure 9: The distribution of the consistency between reasoning process and verification process on 100 randomly sampled math word problems from MATH.
|
| 760 |
+
|
| 761 |
+
# J ANALYSIS OF DIFFERENT TYPES OF VERIFICATION CODE
|
| 762 |
+
|
| 763 |
+
To further analyze what types of verification code are generated, we randomly sampled 50 problems from MATH as well as their solutions generated with CSV. We counted 4 types of verification code: Substitution, Alternative Method, Double Checking, and Approximation. Their distribution is show in Fig. 10.
|
| 764 |
+
|
| 765 |
+
• Substitution: The model substitutes the answer back to the question to check if it fits all the conditions. By inspecting the solutions we randomly sampled from the results, we found that this is the most common type of verification.
|
| 766 |
+
• Alternative Method: The model uses a different method to solve the problem and check if it reaches the same final answer.
|
| 767 |
+
|
| 768 |
+
• Double Checking: The model double-checks each part of the solution to see if they are correct. • Approximation: The model computes an approximation of the answer. This method is often used when there is infinity involved in the problems. The model uses a large number to approximate the infinity to check if the result is close to the answer.
|
| 769 |
+
|
| 770 |
+
Examples of the types above are shown in Tab. 16, Tab. 17, Tab. 18, Tab. 19.
|
| 771 |
+
|
| 772 |
+

|
| 773 |
+
Figure 10: The distribution of verification types generated by GPT4-Code on 50 randomly sampled math word problems from MATH.
|
| 774 |
+
|
| 775 |
+
Math Problem: Suppose that the minimum value of $f ( x ) = \cos 2 x - 2 a ( 1 + \cos x )$ is $- \frac { 1 } { 2 }$ . Find $a$ .
|
| 776 |
+
|
| 777 |
+
Next, we will verify this solution by substituting $a ~ = ~ - 0 . 2 5$ into the function $f ( x )$ , and checking whether the minimum value of $f ( x )$ is indeed $- \frac 1 2$ . We will evaluate $f ( x )$ over the interval $[ 0 , 2 \pi ]$ because the function is periodic with period $2 \pi$ .
|
| 778 |
+
|
| 779 |
+

|
| 780 |
+
|
| 781 |
+
Now, let’s verify this result by actually computing the expression term by term. We’ll create a list of numbers from 100 down to 1, then add the even-indexed numbers and subtract the odd-indexed numbers.
|
| 782 |
+
|
| 783 |
+

|
| 784 |
+
|
| 785 |
+
Table 17: An example of verification code that used alternative methods. The model uses a different method to solve the problem and check if it reaches the same final answer.
|
| 786 |
+
|
| 787 |
+
Math Problem: What is the greatest prime factor of the sum of the arithmetic sequence $1 + 2 + 3 + \cdot \cdot + 8 0 ?$
|
| 788 |
+
|
| 789 |
+
Now, let’s verify the solution. First, we will generate the sequence from 1 to 80, sum it up, and confirm that it is equal to 3240. Then, we will calculate the product of the prime factors and confirm that it is also equal to 3240. Finally, we will check that the maximum prime factor is indeed 5.
|
| 790 |
+
|
| 791 |
+
# create a list of numbers from 100 down to 1 # Generate the sequence from 1 to 80 sequence $=$ list(range(1, $\mathtt { n } + \mathtt { 1 } )$ )
|
| 792 |
+
|
| 793 |
+
Table 18: An example of verification code that used double checking. The model double checks each part of the solution to see if they are correct.
|
| 794 |
+
|
| 795 |
+
Now, let’s verify the solution. We can do this by calculating the sum of the first few terms of the series and see if it is close to our solution. Note that the series is infinite, so we can’t compute the exact value in this way, but we can check if it seems to be converging towards our solution. Let’s calculate the sum of the first 10,000 terms.
|
| 796 |
+
|
| 797 |
+
# calculate the sum of the first 10000 terms
|
| 798 |
+
sum_of_terms = 0
|
| 799 |
+
for n in range(1, 10001): sum_of_terms $+ =$ math.atan(math.sqrt(n)) - math.atan(math.sqrt(n+1))
|
| 800 |
+
|
| 801 |
+
sum_of_terms
|
| 802 |
+
|
| 803 |
+
Table 19: An example of verification code that used approximation. The model use a large number to approximate the infinity to check if the result is close to the answer.
|
md/test/hUgBU9wgSf/hUgBU9wgSf.md
ADDED
|
@@ -0,0 +1,628 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A Kernel Two-sample Test for Dynamical Systems
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Evaluating whether data streams are drawn from the same distribution is at the heart of various machine learning problems. This is particularly relevant for data generated by dynamical systems since such systems are essential for many real-world processes in biomedical, economic, or engineering systems. While kernel two-sample tests are powerful for comparing independent and identically distributed random variables, no established method exists for comparing dynamical systems. The main problem is the inherently violated independence assumption. We propose a two-sample test for dynamical systems by addressing three core challenges: we (i) introduce a novel notion of mixing that captures autocorrelations in a relevant metric, (ii) propose an efficient way to estimate the speed of mixing relying purely on data, and (iii) integrate these into established kernel two-sample tests. The result is a data-driven method that is straightforward to use in practice and comes with sound theoretical guarantees. In an example application to anomaly detection from human walking data, we show that the test is readily applicable without any human expert knowledge and feature engineering.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
We consider the two-sample problem of determining whether two distributions are different. In particular, we generalize the well-established kernel two-sample test (Gretton et al., 2012a) to dynamical systems and stochastic processes with certain mixing properties, which we make precise in this paper.
|
| 12 |
+
|
| 13 |
+
The kernel two-sample test approximates a metric on the space of probability distributions, the maximum mean discrepancy (MMD), through kernel-based techniques. Due to its powerful theoretical properties and versatile applicability, kernel two-sample testing is a prominent method in the machine learning community (Long et al., 2017; Tolstikhin et al., 2018; Muandet et al., 2017; Schölkopf & Smola, 2001). While we can exploit parts of existing kernel-based results, and especially their theoretical guarantees, the extension to comparing dynamical systems is not straightforward. This is mainly because kernel two-sample testing was initially developed for independent and identically distributed (i.i.d.) random variables (Gretton et al., 2012a). The i.i.d. assumption in the test is critical, but it is violated by the very nature of dynamical systems: through the dynamics, samples are coupled to past samples. To address this issue, we introduce a novel notion of mixing that considers the dependence of data through time with respect to the MMD. Intuitively, mixing reveals how fast autocorrelations decay and, thus, how long we need to wait in-between samples for data to be (approximately) independent. Our new mixing notion can be efficiently estimated from data and is particularly synergistic with kernel two-sample tests since both measure distances of probability distributions with respect to the same metric—the MMD. By estimating the decay of dependency and embedding it into well-established algorithms, we obtain a powerful test for comparing dynamical systems.
|
| 14 |
+
|
| 15 |
+
Mathematical literature often distinguishes explicitly between deterministic dynamical systems and stochastic processes. In particular, establishing mixing properties for deterministic dynamical systems is an extremely challenging problem and constructing examples that are provably mixing is hard. Further, common mixing properties that are used for stochastic systems are too restrictive and not applicable to deterministic systems (Hang et al., 2017). We propose mixing in MMD, which is applicable to both classes of problems— stochastic and deterministic systems. Further, we show that mixing in MMD is even less restrictive than certain deterministic mixing types ( $\boldsymbol { \mathscr { C } }$ -mixing Hang et al. (2018)). For suitable choices of kernels and function spaces $\boldsymbol { \mathscr { C } }$ , we can show that $\boldsymbol { \mathscr { C } }$ -mixing implies MMD-mixing. Based on standard examples with well-established $\boldsymbol { \mathscr { C } }$ -mixing properties (the $\beta$ -map, logistic map, and Gauss map), we demonstrate empirically that they are indeed mixing in MMD. Additionally, we also consider mixing properties of chaotic and stochastic systems and further, also raw sensor data from human walking experiments.
|
| 16 |
+
|
| 17 |
+
Despite their practical relevance, there is no established data-driven way of comparing dynamical systems. For biomedical systems such as the human cardiovascular system, central nervous system, or musculoskeletal system, implementing a principled comparison of systems based on their output sequences in different time intervals can help to detect diseases or quantify their severity. For example, alterations or unusual patterns in human gait can be indicators for early stages of Parkinson’s disease (Pistacchi et al., 2017). An algorithm that automatically detects such alterations by comparing new data to labeled records could help physicians in their decision-making. Current state-of-the-art solutions rely on manually engineered and selected features and thus require expert knowledge (Nguyen et al., 2019). Similarly, feature-based solutions have been proposed for electro-myography-based detection of spasticity (Misgeld et al., 2015; Lueken et al., 2015). But clearly, the success of such approaches critically depends on the expressiveness of these features and on how well the problem is understood.
|
| 18 |
+
|
| 19 |
+
Modern engineering applications are another prominent and relevant example. They often leverage computer simulations instead of directly interacting with the physical plant since real experiments are more expensive, time-consuming, and cause wear on the hardware. Besides, being able to predict the response of a physical plant based on a mathematical model enables powerful learning algorithms (Hwangbo et al., 2019), modelpredictive control (Qin & Badgwell, 2003), and digital twins in future manufacturing (Jeschke et al., 2017). The success of these methods, however, is critically intertwined with the model accuracy. Thus, it is essential to ensure accurate models, for example, by comparing data generated from the simulation model with data collected from the real system.
|
| 20 |
+
|
| 21 |
+
By combining mixing properties with kernel-based techniques, we obtain a powerful statistical test for comparing dynamical systems. We demonstrate the efficiency and robustness of the proposed test numerically and on experimental data. In particular, we consider human walking experiments and analyze raw data from an inertial measurement unit (IMU) to detect anomalies in the walking pattern. Without the need for human expert knowledge or fitting model parameters, our test outperforms standard baselines in deciding which of the trajectories were generated with an attached knee orthosis, which restricts the movement of the joint.
|
| 22 |
+
|
| 23 |
+
Contributions: We propose a kernel two-sample test for dynamical systems. By developing a new notion of mixing that can be estimated from data, we generalize powerful theoretical guarantees from the i.i.d. setting to certain dynamical systems. The derived method is straightforward to use, and well-established implementations of the kernel two-sample test can be leveraged. We demonstrate the robustness and efficiency of the method on real-world data, where we achieve better results than standard baselines, without relying on feature engineering or expert knowledge. Code and data will be made available upon publication.
|
| 24 |
+
|
| 25 |
+
# 2 Related Work
|
| 26 |
+
|
| 27 |
+
There is only limited literature that explicitly investigates the question of how to compare dynamical systems. One possibility is the embedding of dynamical systems as infinite-dimensional objects into reproducing kernel Hilbert spaces (RKHS) with specifically designed kernels such as Binet-Cauchy kernels (Vishwanathan et al., 2007) or generalizations thereof as proposed in Ishikawa et al. (2018) and Ishikawa et al. (2019). A similar function-analytical approach is considered in Mezic (2016) and Klus et al. (2020), where the authors consider Koopman and Perron-Frobenius operators to obtain linear dynamics in an infinite-dimensional space. These articles leverage specifically designed kernels and linear operators associated with dynamical systems to obtain an embedding. However, none of the above articles proposes a statistical test that compares dynamical systems. This would require further finite sample and error bounds on the approximations of the infinitedimensional operators, which is non-trivial. Our approach leverages concentration results that synergize well with kernel-based techniques and in particular, kernel mean embeddings.
|
| 28 |
+
|
| 29 |
+
The critical technical issue for dealing with dynamical systems is non-i.i.d. data. There are several extensions of kernel two-sample tests that have been developed (Zaremba et al., 2013; Gretton et al., 2012b; Doran et al., 2014; Lloyd & Ghahramani, 2015; Chwialkowski et al., 2014; Chwialkowski & Gretton, 2014) to make them applicable to a broader range of problems, where non-i.i.d. data is also an issue. However, the strong mixing properties that are typically postulated limit the applicability of the results to dynamical systems. Surprisingly, there is only very limited work that addresses the estimation of mixing coefficients from data, as also acknowledged and emphasized in (McDonald et al., 2011). The approach proposed in (McDonald et al., 2011) is different from our work, as mixing is considered with respect to the total variation norm, which requires the estimation of complex intermediate objects, whereas we estimate mixing properties directly from data. We propose a new mixing notion that synergizes well with kernel two-sample tests and that can also be estimated from data (in contrast to most other mixing notions). A similar idea of mixing in RKHS, has very recently been introduced in (Chérief-Abdellatif & Alquier, 2022). The paper, however, focuses on parameter estimation with respect to minimizing the MMD as a loss function. Further, the precise notion of mixing differs from ours. It is shown that certain types of systems satisfy their notion of mixing, however, that work does not estimate mixing from data. In (Wynne & Duncan, 2022), another recent approach is presented. In essence, the paper investigates whether two samples of functions have the same underlying distribution. Functional data is directly embedded into an RKHS by extending the theory to kernels that live on function spaces. The elegant kernel design might be a useful for extensions of our work, where multiple correlated joint distributions need be compared. Right now, we compare stationary distributions and data is decorrelated via mixing.
|
| 30 |
+
|
| 31 |
+
The problem of comparing dynamical systems is also present in control theory and was, for example, recently studied in Umlauft & Hirche (2019); Solowjow & Trimpe (2020) by considering the question of when to trigger model updates. In robust control, there is the notion of the gap metric (Zhou & Doyle, 1998), which compares the closed-loop behavior of dynamical systems. These approaches are particularly promising to quantify the similarities between dynamical systems when trying to achieve effective transfer learning, as shown in (Sorocky et al., 2020). However, they usually rely on a given model or a certain linear structure in the system. But estimating such models of nonlinear systems can be difficult in practice (Schoukens & Ljung, 2019; Schön et al., 2011; Brunton et al., 2017; Ljung, 2001). Similarly, estimating the stationary measure of a dynamical system is also a highly non-trivial problem (Hang et al., 2018; Luzzatto et al., 2005). In our approach, we do not require any intermediate objects such as the dynamics, density function, or noise models. Instead, we compare stationary distributions of dynamical systems directly from data.
|
| 32 |
+
|
| 33 |
+
# 3 Assumptions and Problem Formulation
|
| 34 |
+
|
| 35 |
+
In the following, we introduce the mathematical objects that we will consider in this paper. Afterward, we make the problem precise.
|
| 36 |
+
|
| 37 |
+
# 3.1 Stationary, Ergodic, and Mixing Systems
|
| 38 |
+
|
| 39 |
+
Let $( \Omega , A , P )$ be a probability space, $S \subset \mathbb { R } ^ { d }$ a compact set, which is the state space of the dynamical system, and $\boldsymbol { B }$ the corresponding Borel $\sigma$ -algebra. We define a stochastic dynamical system or stochastic process as a collection of random variables $\{ X _ { k } \}$ indexed in discrete time $k \in \mathbb N$ and $X _ { k } \colon \Omega \to S$ . Next, we introduce some required properties of the process.
|
| 40 |
+
|
| 41 |
+
Definition 1 (Stationary) A system is stationary if the joint distribution of its states is time-invariant.
|
| 42 |
+
|
| 43 |
+
In addition to stationary behavior, we also require ergodicity. While stationarity ensures time-invariant distributions, ergodicity guarantees that the statistical properties of the system do not differ over multiple realizations. We use a standard definition that goes back to Birkhoff (1931).
|
| 44 |
+
|
| 45 |
+
Definition 2 (Ergodic) Assume the system $\{ X _ { k } \}$ is stationary with distribution $\mathbb { P }$ . We call the system ergodic if for al l $f \in L _ { \mathbb { P } } ^ { 1 } ( S )$ and $\mathbb { P }$ -almost all initial states we have
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\operatorname* { l i m } _ { N \to \infty } { \frac { 1 } { N } } \sum _ { k = 0 } ^ { N - 1 } f ( X _ { k } ) = \int _ { S } f ( y ) \mathrm { d } \mathbb { P } ( y ) \quad a . s . .
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
Equation equation 1 is in some sense a realization of the law of large numbers, and both sides of the equation yield the expected value $\mathbb { E } _ { X \sim \mathbb { P } } [ f ( X ) ]$ . In particular, it allows us to estimate $\mathbb { E } [ X _ { k } ]$ (the distribution is invariant for all $k$ ) from long enough sample paths. Different types of convergence and test functions in eq. equation 1 yield more sophisticated ergodic theorems. Nonetheless, there can still be severe autocorrelations and if $X _ { k }$ is known, this may have a drastic impact on the distribution of $X _ { k + 1 }$ . Thus, we require additional mixing assumptions.
|
| 52 |
+
|
| 53 |
+
Classically, mixing is introduced in terms of dependencies between $\sigma$ -algebras and intuitively, deals with the autocorrelations in the system. Here, we consider a covariance-based approach to mixing, which is more useful and convenient for us since there is a natural connection to Hilbert-Schmidt theory in RKHSs. Both approaches are introduced in Bradley et al. (1987). We begin with a general definition based on (Bradley et al., 1987, eq. (1.2)) and tailor it to our problem afterward.
|
| 54 |
+
|
| 55 |
+
Definition 3 (Measure of Dependence) Assume $\mathcal { F }$ and $\mathcal { G }$ are suitable function spaces. The measure of dependence is defined as
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\operatorname* { s u p } _ { f \in \mathcal { F } , g \in \mathcal { G } } \frac { | \mathbb { E } [ f g ] - \mathbb { E } [ f ] \mathbb { E } [ g ] | } { \| f \| _ { p } \| g \| _ { q } } ,
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
where $p$ and $q$ are Hölder pairs.
|
| 62 |
+
|
| 63 |
+
A possible choice for the function spaces is ${ \mathcal { F } } = { \mathcal { G } } = L ^ { 2 }$ , which is referred to as strong mixing when eq. equation 2 converges to zero and naturally implies ergodicity in $L ^ { 2 }$ when considering $f = g$ . There are various valid choices and many are discussed in (Bradley, 2005; Hang et al., 2017).
|
| 64 |
+
|
| 65 |
+
Here, we propose to consider unit balls in reproducing kernel Hilbert spaces for $\mathcal { F }$ and $\mathcal { G }$ , which has to the best of our knowledge not been done before.
|
| 66 |
+
|
| 67 |
+
Definition 4 (Mixing) Assume $\mathcal { F }$ and $\mathcal { G }$ are unit balls in the same RKHS. We call a system mixing if
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\operatorname* { s u p } _ { f \in \mathcal { F } , g \in \mathcal { G } } \operatorname { C o v } ( f ( X _ { t } ) , g ( X _ { t + a } ) ) \to 0 \quad { \mathrm { f o r } } \quad a \to \infty .
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
Later, we will investigate this property in more detail and leverage powerful estimators in form of the Hilbert-Schmidt independence criterion to determine mixing properties. Estimators for the speed of mixing are usually a critical issue when working with mixing arguments. In related work, the speed and type of mixing is almost exclusively postulated. In contrast, we test if a process is mixing and estimate the actual speed.
|
| 74 |
+
|
| 75 |
+
An important special case that we will investigate in detail are state-space models or Markov chains with continuous state spaces of the type $X _ { k + 1 } = \phi ( X _ { k } ) + \epsilon _ { k }$ , where $\phi$ is an appropriate dynamics function and $\epsilon _ { k }$ the process noise. This system description is highly relevant in systems and control theory and more recently, reinforcement learning. Further, we will also consider chaotic systems, where $\epsilon _ { k } \equiv 0$ . These are deterministic and violate common probabilistic mixing assumptions.
|
| 76 |
+
|
| 77 |
+
# 3.2 Problem Formulation
|
| 78 |
+
|
| 79 |
+
Consider two stationary and mixing (cf. def. 4) systems $\{ X _ { k } \}$ and $\{ Y _ { k } \}$ with stationary distributions $\| \boldsymbol { \underline { p } } _ { X }$ and $\| ^ { p } { \boldsymbol { \gamma } }$ . We want to decide whether $\{ X _ { k } \}$ and $\{ Y _ { k } \}$ are different based on the data streams $X = \{ X _ { 0 } , X _ { 1 } , \ldots , X _ { n } \}$ and $Y = \{ Y _ { 0 } , Y _ { 1 } , \dots , Y _ { n } \}$ . We assume $X _ { k } , Y _ { k } \in S$ and, in general, $X _ { 0 } \neq Y _ { 0 }$ . Further, we assume that the dynamical systems have converged to their stationary distribution.
|
| 80 |
+
|
| 81 |
+
We propose to compare dynamical systems by testing whether their stationary probability measures coincide. Thus, we obtain the null hypothesis
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
H _ { 0 } : \mathbb { P } _ { X } = \mathbb { P } _ { Y } ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
which we try to reject with high confidence. For our method, it is not necessary to estimate or construct any intermediate objects such as the dynamics function $f$ , nor the measures $\| \boldsymbol { \underline { p } } _ { X }$ and $\| \boldsymbol { \underline { P } } _ { Y }$ .
|
| 88 |
+
|
| 89 |
+
The main challenge lies in coping with the autocorrelations within the data streams. These autocorrelations are critical and void commonly used concentration results, such as the famous Hoeffding’s or McDiarmid’s inequalities.
|
| 90 |
+
|
| 91 |
+
We consider a two-sample setting between two data streams $X$ and $Y$ . However, this can easily be applied to settings where we want to investigate whether a given model coincides with reality. Then, samples obtained through sensor measurements can be compared with samples generated by simulating a given model.
|
| 92 |
+
|
| 93 |
+
# 4 Technical Preliminaries
|
| 94 |
+
|
| 95 |
+
The main idea of this paper can be summarized as generalizing kernel two-sample tests (Gretton et al., 2012a) to dynamical systems through a data-based mixing approach. Essentially, we propose to wait long enough between consecutive samples. Quantifying how long to wait to enforce negligibly small autocorrelations is the core question, which is addressed in sec. 5.2. In the numerical section, we construct linear systems with arbitrary slow mixing properties. We begin by summarizing key results from kernel two-sample tests and kernel mean embeddings.
|
| 96 |
+
|
| 97 |
+
# 4.1 Kernel Two-sample Test
|
| 98 |
+
|
| 99 |
+
An elegant and efficient comparison of probability distributions can be achieved with kernel two-sample tests (Gretton et al., 2012a). The distributions are embedded into an RKHS, where it becomes tractable to compute certain metrics on the space of probability distributions such as the MMD. The following definitions and theorems are taken from Gretton et al. (2012a).
|
| 100 |
+
|
| 101 |
+
Definition 5 (MMD) Let $( S , d )$ be a metric space and let $\| ^ { p } _ { X } , \mathbb { P } _ { Y }$ be two Borel probability measures defined on $S$ . Further, let $\mathcal { F }$ be the unit ball in an RKHS on $S$ . We define the maximum mean discrepancy by
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\mathrm { M M D } ^ { 2 } [ \mathbb { P } _ { X } , \mathbb { P } _ { Y } ] = \operatorname* { s u p } _ { g \in \mathcal { F } } ( \mathbb { E } _ { \mathbb { P } _ { X } } [ g ] - \mathbb { E } _ { \mathbb { P } _ { Y } } [ g ] ) ^ { 2 } .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
The MMD yields a semi-metric between probability distributions and can be efficiently estimated by embedding the distributions into an RKHS $\mathcal { H }$ with the aid of kernel mean embeddings (Muandet et al., 2017). It is a challenging problem to compute equation 5 directly since $\mathcal { F }$ is usually infinite-dimensional. However, by kernelizing it, we can estimate equation 5 from data.
|
| 108 |
+
|
| 109 |
+
Theorem 1 Assume $k$ is a kernel and $\mathcal { F }$ is again the unit ball in the corresponding RKHS H. Further, assume $( X _ { 1 } , \ldots , X _ { n } )$ and $( Y _ { 1 } , \ldots , Y _ { m } )$ are drawn i.i.d. from $\| \boldsymbol { \underline { p } } _ { X }$ and $\| ^ { D } \boldsymbol { Y }$ , respectively. Then, a biased estimate of equation $\it 5$ is given by
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\mathrm { M M D } _ { b } ^ { 2 } [ X , Y ] = \frac { 1 } { n ^ { 2 } } \sum _ { i , j = 1 } ^ { n } k ( X _ { i } , X _ { j } ) + \frac { 1 } { m ^ { 2 } } \sum _ { i , j = 1 } ^ { m } k ( Y _ { i } , Y _ { j } ) - \frac { 2 } { m n } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m } k ( X _ { i } , Y _ { j } ) .
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
The additional requirement of a characteristic kernel ensures that the embedding of the probability distribution is injective and, thus, a metric is obtained. The kernel $k$ can, for example, be chosen as a Gaussian kernel since it is well known to be characteristic (Gretton et al., 2012a).
|
| 116 |
+
|
| 117 |
+
Theorem 2 Assume $k$ is a characterstic kernel and $\mathcal { F }$ is the unit ball in the corresponding RKHS H. Then MMD ${ } ^ { 2 } [ \mathbb { P } _ { X } , \mathbb { P } _ { Y } ] = 0$ if, and only if, $\| ^ { \flat } _ { X } = \| ^ { \flat } _ { Y }$ .
|
| 118 |
+
|
| 119 |
+
Essentially, we do not require any prior knowledge or parameterization of $\| \boldsymbol { \underline { p } } _ { X }$ and $\| ^ { D } \boldsymbol { Y }$ . Access to i.i.d. samples from these distributions is sufficient. In practice, however, we only have access to finitely many data points and, thus, receive an estimate of the MMD from equation 6. This estimate is expected to have some deviation, i.e., even for identical distributions, the test statistic will be larger than zero. Therefore, we need finite sample bounds that quantify the convergence speed of the empirical MMD to obtain confidence bounds. Gretton et al. (2012a) introduce several such bounds of the type
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r } { \mathbb { P } \left[ | \mathrm { M M D } _ { b } [ X , Y ] - \mathrm { M M D } [ \mathbb { P } _ { X } , \mathbb { P } _ { Y } ] | \geq \kappa ( \alpha , n ) \right] \leq \alpha . } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
Under the null hypothesis $\| ^ { \flat } _ { X } = \| ^ { \flat } _ { Y }$ , we can obtain the rejection region $\begin{array} { r } { \mathrm { M M D } _ { b } [ X , Y ] \geq \kappa ( \alpha , n ) = \sqrt { 2 \frac { K } { n } } ( 1 + } \end{array}$ $\sqrt { 2 \log { \alpha ^ { - 1 } } } )$ for a test with level $\alpha$ , where $K$ is the supremum of the kernel (Gretton et al., 2012a, Corollary 9). However, these results rely on the independence assumption and, hence, cannot be used for comparing dynamical systems.
|
| 126 |
+
|
| 127 |
+
# 4.2 Hilbert-Schmidt Independence Criterion
|
| 128 |
+
|
| 129 |
+
The Hilbert-Schmidt independence criterion (HSIC) (Gretton et al., 2008) quantifies dependence between random variables. Generally, two random variables $X$ and $Y$ are independent if their joint distribution factorize, i.e., $\mathbb { P } _ { X , Y } = \mathbb { P } _ { X } \otimes \mathbb { P } _ { Y }$ , where $\otimes$ denotes the tensor product. Estimating the involved objects from data is usually intractable. Instead, the difference in MMD can elegantly be expressed through the HSIC.
|
| 130 |
+
|
| 131 |
+
Definition 6 (HSIC, Sejdinovic et al. (2013, Def. 11)) Let $X \sim P _ { X }$ and $Y \sim P _ { Y }$ be random variables with joint distribution $P _ { X , Y }$ . The HSIC is defined as
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\begin{array} { r } { \mathrm { H S I C } ( X , Y ) = \mathrm { M M D } _ { \mathcal { H } \otimes \mathcal { H } } [ P _ { X } \otimes P _ { Y } , P _ { X , Y } ] . } \end{array}
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
Similar to the kernel two-sample test, it is possible to express equation 8 in terms of kernel evaluations.
|
| 138 |
+
Further, it is also possible to provide high confidence bounds and thus, obtain an efficient statistical test.
|
| 139 |
+
|
| 140 |
+
As the name suggests, the HSIC is closely related to Hilbert-Schmidt operators. These well-behaved operators are well investigated in functional analysis and in general, are bounded operators between Hilbert spaces. Further, the space of Hilbert-Schmidt operators between two reproducing kernel Hilbert spaces $\mathcal { H }$ and $\vec { \mathcal { G } }$ forms itself a Hilbert space, which is isomorphic to the product space $\mathcal { H } \otimes \mathcal { G }$ given by the product kernel (Muandet et al., 2017, Page 35).
|
| 141 |
+
|
| 142 |
+
Here, we want to emphasize the connection between the HSIC and the covariance operator $\mathit { C } _ { \mathit { X Y } }$ in terms of the Hilbert-Schmidt norm (Muandet et al., 2017, Eq. 3.37)
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
\| \mathcal { C } _ { X , Y } \| _ { \mathrm { H S } } = \mathrm { H S I C } ( X , Y )
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
and the representation of $\mathcal { C } _ { X , Y }$ as the unique bounded operator that satisfies the property
|
| 149 |
+
|
| 150 |
+
$$
|
| 151 |
+
\langle g , \mathcal { C } _ { X , Y } f \rangle _ { \mathcal { G } } = \operatorname { C o v } [ g ( Y ) , f ( X ) ]
|
| 152 |
+
$$
|
| 153 |
+
|
| 154 |
+
for all $g \in { \mathfrak { g } }$ and $f \in \mathcal { H }$ . Equivalently, the covariance operator can also be defined in terms of tensor spaces (Muandet et al., 2017, Sec. 3.2), however, equation 10 connects nicely to standard mixing expressions (cf. eq. equation 3). Further, the HSIC framework provides rich results such as efficient estimators and concentration results.
|
| 155 |
+
|
| 156 |
+
The general framework is highly flexible and can deal with a variety of objects. For our problem, we can use a simplified setting, where both systems belong to the same space, which is consistent with the setup for the kernel two-sample test. Estimations of equation 8 in terms of kernel evaluations can be found in (Gretton et al., 2008, Equation (4)).
|
| 157 |
+
|
| 158 |
+
# 4.3 Joint Independence—dHSIC
|
| 159 |
+
|
| 160 |
+
Pfister et al. (2018) extended the HSIC to $d$ -dimensional random vectors and thus, investigate
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
\begin{array} { r } { \mathrm { d H S I C } ( X ) = \mathrm { M M D } _ { \otimes _ { i = 1 } ^ { d } \mathcal { H } } [ P _ { X _ { 1 } } \otimes . . . \otimes P _ { X _ { d } } , P _ { X _ { 1 } , . . . , X _ { d } } ] . } \end{array}
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
Similarly as for the kernel two-sample test and the classical HSIC independence test, it is possible to quantify the convergence speed and thus, obtaining a threshold $\kappa ( \alpha , n )$ for statistical testing. Intuitively, this should be the independence notion that we need for the kernel two-sample test. However, we use a slightly different property, which we introduce in def. 9.
|
| 167 |
+
|
| 168 |
+
# 5 MMD-Mixing
|
| 169 |
+
|
| 170 |
+
In this section, we will focus on data from one system $\{ X _ { k } \}$ and investigate the temporal dependencies. We assume access to multiple independent trajectories, which we indicate through superscripts $\{ X _ { k } ^ { ( i ) } \}$ . Due to the ergodicity and stationarity assumptions, we obtain a well-defined underlying distribution $\mathbb { P }$ for which we can test. Next, we will introduce the new concept of MMD-mixing that quantifies the decay of autocorrelations with respect to the MMD and connect back to the HSIC.
|
| 171 |
+
|
| 172 |
+
# 5.1 Time Shifts and MMD-mixing
|
| 173 |
+
|
| 174 |
+
Let the trajectory $X _ { 0 } , X _ { 1 } , \ldots , X _ { n }$ be subject to a given sampling rate. Generally, autocorrelations decay over time, and far apart samples are approximately independent if the underlying system is mixing. Hence, we propose to increase the time between consecutive samples to reduce dependencies. The slower sampling rate is denoted through the time shift $a \in \mathbb N$ and yields data $X _ { 0 } , X _ { a } , X _ { 2 a } , . . . , X _ { a n }$ . Essentially, the question is how to determine and estimate $a$ to ensure approximately independent data points $X _ { 0 } , X _ { a } , X _ { 2 a } , . . . , X _ { a n }$ . We begin with a simplified setting and assume a sample from the stationary measure $X _ { 0 } \sim \Psi _ { X _ { 0 } } = \mathbb { P }$ .
|
| 175 |
+
|
| 176 |
+
Definition 7 (MMD-mixing) We call a process MMD-mixing $i f$
|
| 177 |
+
|
| 178 |
+
$$
|
| 179 |
+
\begin{array} { r } { \operatorname { M M D } _ { \mathcal { H } \otimes \mathcal { H } } [ \mathbb { P } _ { X _ { 0 } } \otimes \mathbb { P } _ { X _ { a } } , \mathbb { P } _ { X _ { 0 } , X _ { a } } ] \to 0 \quad f o r \ a \to \infty . } \end{array}
|
| 180 |
+
$$
|
| 181 |
+
|
| 182 |
+
This definition only considers the distributions at two points in time. Due to the stationarity of the system, we can move the timeshift through time and also consider different pairs in time. Due to the connection to Hilbert-Schmidt theory and covariance operators, it is also possible to consider expressions similar to equation 10.
|
| 183 |
+
|
| 184 |
+
Proposition 1 Let $\{ X _ { k } \}$ be an MMD-mixing process. Then,
|
| 185 |
+
|
| 186 |
+
$$
|
| 187 |
+
\mathrm { H S I C } ( X _ { 0 } , X _ { a } ) 0 f o r a \infty .
|
| 188 |
+
$$
|
| 189 |
+
|
| 190 |
+
We assume that the underlying kernel $k$ is characteristic and refer to it as the base kernel. Further, we assume to have access to $m$ independent trajectories. In this setting, we can readily apply the HSIC equation 8 framework. In particular, we pick two points in time from each trajectory, $X _ { 0 } ^ { ( i ) }$ and $X _ { a } ^ { ( i ) }$ . Then, we divide the data into $X _ { 0 } = \{ X _ { 0 } ^ { ( 1 ) } , X _ { 0 } ^ { ( 2 ) } , . . . , X _ { 0 } ^ { ( m ) } \}$ and $X _ { a } = \{ X _ { a } ^ { ( 1 ) } , X _ { a } ^ { ( 2 ) } , \dots , X _ { a } ^ { ( m ) } \}$ 0 . The sets are, per construction, i.i.d. within themselves since the $m$ trajectories are independent and due to the additional stationarity and ergodicity assumptions. Next, we can compute HSIC $( X _ { 0 } , X _ { a } )$ and iteratively increase $a$ . If we pick $a$ large enough, the HSIC will eventually become arbitrarily small. MMD-mixing ensures that $\mathrm { H S I C } ( X _ { s } , X _ { s + a } ) 0$ for $a \infty$ . For practical algorithms, we will fix a small $\epsilon > 0$ and enforce $\mathrm { H S I C } ( X _ { s } , X _ { s + a ^ { * } } ) < \epsilon$ . In our experiments, we pick $\epsilon$ as the standard test threshold of the HSIC (cf. fig. 3).
|
| 191 |
+
|
| 192 |
+
# 5.2 Extended MMD-mixing
|
| 193 |
+
|
| 194 |
+
Next, we extend our arguments to subtrajectories instead of considering two single points. Similarly as before, we use the notation $\mathbb { P } _ { X _ { 0 } , \ldots , X _ { s } }$ and $\mathbb { P } _ { X _ { s + a } , \dots , X _ { 2 s + a } }$ for the distributions of the subtrajectories of length $s$ (which is the joint distribution over the first $s$ states) and $\mathbb { P } _ { ( X _ { 0 } , . . . , X _ { s } ) , ( X _ { s + a } , . . . , X _ { 2 s + a } ) }$ for the joint distribution of the subtrajectories.
|
| 195 |
+
|
| 196 |
+
Definition 8 (Extended MMD-mixing) We call a process extended MMD-mixing if
|
| 197 |
+
|
| 198 |
+
$$
|
| 199 |
+
\begin{array} { r } { \begin{array} { r } { \mathrm { d } \mathrm { M } \mathrm { D } _ { ( \otimes _ { i = 1 } ^ { s } \mathcal { H } ) \otimes ( \otimes _ { i = 1 } ^ { s } \mathcal { H } ) } [ \mathbb { P } _ { X _ { 0 } , \ldots , X _ { s } } \otimes \mathbb { P } _ { X _ { s + a } , \ldots , X _ { 2 s + a } } , \mathbb { P } _ { ( X _ { 0 } , \ldots , X _ { s } ) , ( X _ { s + a } , \ldots , X _ { 2 s + a } ) } ] \to 0 \quad f o r \ a \to \infty . } \end{array} } \end{array}
|
| 200 |
+
$$
|
| 201 |
+
|
| 202 |
+
Clearly, we require an appropriate kernel to extend the MMD to joint distributions. In particular, tensor products of the base kernel need to be strong enough to distinguish the joint distributions. Szabó & Sriperumbudur (2018) discuss various tensor constructions, which we will leverage here.
|
| 203 |
+
|
| 204 |
+
Lemma 1 (Choice of Kernel I) Let $k$ be a characteristic kernel. Then $k ^ { s } = \otimes _ { i = 1 } ^ { s } k$ is also characteristic.
|
| 205 |
+
|
| 206 |
+
Proof: The statement follows directly from Szabó & Sriperumbudur (2018, Theorem 4), which considers a more general problem setting. □
|
| 207 |
+
|
| 208 |
+
Due to the tensor construction, we naturally obtain MMD-mixing with respect to $k$ as introduced in Definition 7, for a process that is extended MMD-mixing with respect to $k ^ { s }$ .
|
| 209 |
+
|
| 210 |
+
# 5.3 Joint Independence
|
| 211 |
+
|
| 212 |
+
To apply the mixing results to kernel two-sample testing, we require one more step. We need joint independence between all samples. Intuitively, this coincides with the dHSIC framework (cf. equation 11) and can be implemented through more sophisticated tensor kernels that embed multiple data points or subtrajectories simultaneously.
|
| 213 |
+
|
| 214 |
+
Lemma 2 (Choice of Kernel II) Assume $k ^ { s }$ is a characteristic kernel. Then the tensor kernel $k ^ { s , n } =$ $\otimes _ { i = 1 } ^ { n } k ^ { s }$ is an $\mathcal { L }$ -characteristic kernel, which makes the kernel suitable for joint independence testing.
|
| 215 |
+
|
| 216 |
+
Proof: Follows from (Szabó & Sriperumbudur, 2018, Theorem 4).
|
| 217 |
+
|
| 218 |
+
To combine mixing with kernel two-sample testing, we require the following technical assumption.
|
| 219 |
+
|
| 220 |
+
Definition 9 (Approximately $\epsilon$ -independent) $L e t \left\{ X _ { k } \right\}$ be an MMD-mixing process. We call data $X =$ $X _ { a ^ { * } } , X _ { 2 a ^ { * } } , \ldots , X _ { n a ^ { * } }$ approximately $\epsilon$ -independent if there is a time shift $a ^ { * }$ and threshold $\kappa ( \epsilon , n )$ that yields
|
| 221 |
+
|
| 222 |
+
$$
|
| 223 |
+
\mathbb { P } [ \mathrm { M M D } _ { b } ( X , \bar { X } ) \ge \kappa ] < \epsilon ,
|
| 224 |
+
$$
|
| 225 |
+
|
| 226 |
+
where $X$ is data that has been sampled independently from the stationary distribution $\mathbb { P }$ .
|
| 227 |
+
|
| 228 |
+
An important technical detail here is the fact that we consider the MMD with respect to the kernel $k$ and not the tensor kernel $k ^ { s , n }$ . Independent and identically distributed data naturally satisfies the above property when $\epsilon = \alpha$ and $\kappa$ is chosen correspondingly for a level- $\alpha$ kernel two-sample test. In practice, we apply a level $\epsilon$ HSIC test to multiple independent trajectories in order to determine an $a ^ { * }$ , which satisfies equation 15.
|
| 229 |
+
|
| 230 |
+
# 5.4 Connections to Other Mixing Notions
|
| 231 |
+
|
| 232 |
+
There are various types of mixing that essentially all describe the decay of autocorrelations. An extensive discussion of the relationship between different measures of dependencies can be found in Bradley (2005). The importance of covariance-based expressions for mixing is utilized in Bradley et al. (1987) to investigate how they can dominate each other.
|
| 233 |
+
|
| 234 |
+
Mixing properties are notoriously difficult or even impossible to estimate, and many types of mixing do not apply to large classes of dynamical systems (Hang et al., 2017). Our proposed type of mixing can be estimated from data and yields advantageous theoretical properties. In McDonald et al. (2011), the $\beta$ -mixing coefficient is estimated through involved density estimations. While the authors emphasize that they solve a more difficult problem to obtain a solution to a simpler one, this is still one of the few existing approaches to estimate the speed of mixing.
|
| 235 |
+
|
| 236 |
+
We start with defining the $\beta$ -mixing coefficient as in (McDonald et al., 2011):
|
| 237 |
+
|
| 238 |
+
$$
|
| 239 |
+
\beta ( a ) = \operatorname* { s u p } _ { s } \| \mathbb { P } _ { - \infty } ^ { s } \otimes \mathbb { P } _ { s + a } ^ { \infty } - \mathbb { P } _ { s , a } \| _ { \mathrm { T V } } ,
|
| 240 |
+
$$
|
| 241 |
+
|
| 242 |
+
where $\mathbb { P } _ { - \infty } ^ { s }$ is the joint distribution of the states $\{ X _ { t } \} _ { t = - \infty } ^ { s }$ and $\mathbb { P } _ { s + a } ^ { \infty }$ of $\{ X _ { t } \} _ { t = s + a } ^ { \infty }$ . With $\mathbb { P } _ { s , a }$ we denote the joint distribution of the objects around the tensor sign, here $( \{ X _ { t } \} _ { t = - \infty } ^ { s } , \{ X _ { t } \} _ { t = s + a } ^ { \infty } )$ and use $\| \cdot \| _ { \mathrm { T V } }$ for total variation. The process is $\beta$ -mixing if $\beta ( a ) 0$ for $a \infty$ .
|
| 243 |
+
|
| 244 |
+
MMD-mixing is closely related with equation 16 and yields lower bounds.
|
| 245 |
+
|
| 246 |
+
Lemma 3 A $\beta$ -mixing process is MMD-mixing for any bounded kernel.
|
| 247 |
+
|
| 248 |
+
Proof: This property follows by considering Hilbert space embeddings of probability distributions. In particular, Sriperumbudur et al. (2010, Theorem 21 (iii)) shows that
|
| 249 |
+
|
| 250 |
+
$$
|
| 251 |
+
\| \mathbb { P } - \mathbb { Q } \| _ { \mathrm { M M D } } \leq C \| \mathbb { P } - \mathbb { Q } \| _ { \mathrm { T V } } ,
|
| 252 |
+
$$
|
| 253 |
+
|
| 254 |
+
where $C$ is the supremum of the corresponding kernel.
|
| 255 |
+
|
| 256 |
+
The other direction does not always hold. For instance, deterministic dynamical systems are, in general, not $\beta$ -mixing (Hang et al., 2017).
|
| 257 |
+
|
| 258 |
+
Lemma 4 A $\boldsymbol { \mathscr { C } }$ -mixing process with respect to the underlying function space $\boldsymbol { \mathscr { C } }$ is MMD-mixing with respect to the kernel $k$ , if $\mathcal { H } \subset \mathcal { C }$ , where $\mathcal { H }$ is the corresponding RKHS.
|
| 259 |
+
|
| 260 |
+
Proof: Following Definition 2 in Hang et al. (2018), $\boldsymbol { \mathscr { C } }$ -mixing is essentially defined as equation 2, where $\mathcal { F }$ is chosen as the function space $c$ and $\vec { \mathcal { G } }$ as $L ^ { 1 }$ on the natural filtration of the system. By considering smaller spaces for $\mathcal { F }$ and $\vec { \mathcal { G } }$ , such as $\mathcal { H }$ , we directly obtain the result. □
|
| 261 |
+
|
| 262 |
+
In particular, if $k$ is the squared exponential kernel then the corresponding RKHS is well-investigated Steinwart $\&$ Christmann (2008). In particular, the RKHS is contained in common choices for $\boldsymbol { \mathscr { C } }$ , such as $\mathrm { B V } ( S )$ , $\operatorname { L i p } ( S )$ , and $C ^ { 1 } ( S )$ .
|
| 263 |
+
|
| 264 |
+
Further, recent results show that convergence in MMD metrizes weak convergence in the space of probability distributions (Simon-Gabriel et al., 2020). Thus, convergence in MMD is applicable to discrete data and Dirac distributions. This may be particularly relevant when considering mixing properties of deterministic dynamical systems even further.
|
| 265 |
+
|
| 266 |
+
In practice, mixing is usually exponentially fast in the gap $a$ . In all of our numerical experiments, it was sufficient to estimate a single time shift $a ^ { * }$ in the MMD-mixing sense between two data points. The joint dHSIC estimation yields stronger theoretical properties, however, might also induce some conservatism into the estimation.
|
| 267 |
+
|
| 268 |
+
# 6 Two-sample Test for Dynamical Systems
|
| 269 |
+
|
| 270 |
+
Next, we utilize mixing to state our main result: a kernel two-sample test for dynamical systems. Due to MMD-mixing, we are able to enforce arbitrarily small dependencies between consecutive samples. In particular, we use our notion of approximately $\epsilon$ -independent data (cf. equation 15) to adjust the test threshold accordingly. For $a \infty$ , we actually recover the i.i.d. setting from Gretton et al. (2012a).
|
| 271 |
+
|
| 272 |
+
Proposition 2 Assume $\{ X _ { k } \}$ and $\{ Y _ { k } \}$ are stationary and MMD-mixing dynamical systems with distributions $\| ^ { p } _ { X } , \| ^ { p } _ { Y }$ . Further, assume data $X _ { a ^ { * } } , X _ { 2 a ^ { * } } , \ldots , X _ { n { a ^ { * } } }$ and $Y _ { a ^ { * } } , Y _ { 2 a ^ { * } } , \ldots , Y _ { n a ^ { * } }$ are sampled i.i.d. from $\| \boldsymbol { \underline { p } } _ { X }$ and $\| \boldsymbol { \mathsf { P } } _ { Y }$ , respectively. If we obtain for the empirical estimate equation $\it 6$ that
|
| 273 |
+
|
| 274 |
+
$$
|
| 275 |
+
\mathrm { M M D } _ { b } ^ { 2 } [ X , Y ] > \kappa ( n , \alpha ) ,
|
| 276 |
+
$$
|
| 277 |
+
|
| 278 |
+
then we can conclude with probability $1 - \alpha$ that $\| ^ { \flat } _ { X } \neq \| ^ { \flat } _ { Y }$ . The choice of the threshold $\kappa ( n , \alpha )$ is discussed extensively in Gretton et al. (2012a) and also above.
|
| 279 |
+
|
| 280 |
+
In practice, the autocorrelations will always be greater than zero. Also, it is important that either both systems have the same mixing speed or $a ^ { * }$ is chosen with respect to the system with the slower mixing rate.
|
| 281 |
+
|
| 282 |
+
We state the main result that, in contrast to prior work, foregoes the need for independence assumptions.
|
| 283 |
+
|
| 284 |
+
Theorem 3 Assume the same setting as above, however, instead of i.i.d. data, we assume that $a ^ { * }$ is $a$ time shift that yields approximately ϵ-independent (cf . 15) data $X \ = \ X _ { a ^ { * } } , X _ { 2 a ^ { * } } , . . . , X _ { n a ^ { * } }$ and $Y =$ $Y _ { a ^ { * } } , Y _ { 2 a ^ { * } } , \ldots , Y _ { n a ^ { * } }$ .
|
| 285 |
+
|
| 286 |
+
If we obtain for the empirical estimate equation $\it 6$ that
|
| 287 |
+
|
| 288 |
+
$$
|
| 289 |
+
\mathrm { M M D } _ { b } ^ { 2 } [ X , Y ] > \kappa ( n , \alpha ) ,
|
| 290 |
+
$$
|
| 291 |
+
|
| 292 |
+
then we can conclude with probability $1 - \alpha ^ { \prime }$ that $\mathbb { P } _ { X } \neq \mathbb { P } _ { Y }$ , where $\begin{array} { r } { \alpha ^ { \prime } = \frac { 1 } { 3 } ( \alpha + 2 \epsilon ) } \end{array}$
|
| 293 |
+
|
| 294 |
+
Proof: First, we will decompose the test statistic into the i.i.d. problem and a second term that captures the dependency in the data. Assume $X , Y$ are i.i.d. data sets (ghost samples) that are drawn from $\| \boldsymbol { \underline { p } } _ { X }$ and $\| ^ { p } { \boldsymbol { \gamma } }$ , respectively. A similar argument is frequently used for symmetrization and referred to in Gretton et al. (2012a, P. 736).
|
| 295 |
+
|
| 296 |
+
$$
|
| 297 |
+
\begin{array} { r l } & { ~ \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( X , Y ) \rvert } \\ & { = \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) + \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) - \mathrm { M M D } _ { b } ( X , Y ) \rvert } \\ & { \le \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) \rvert + \lvert \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) - \mathrm { M M D } _ { b } ( X , Y ) \rvert } \\ & { = \lVert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) \rvert + \lvert \lVert \hat { \mu } _ { \bar { X } } - \hat { \mu } _ { \bar { Y } } \rVert _ { \mathcal { H } } - \lVert \hat { \mu } _ { X } - \hat { \mu } _ { Y } \rVert _ { \mathcal { H } } \rvert } \\ & { \le \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) \rvert + \lVert \hat { \mu } _ { \bar { X } } - \hat { \mu } _ { \bar { Y } } - \hat { \mu } _ { X } + \hat { \mu } _ { Y } \rVert _ { \mathcal { H } } } \\ & { \le \lvert \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) \rvert + \lvert \mathrm { M M D } _ { b } ( \bar { X } , X ) + \mathrm { M M D } _ { b } ( \bar { Y } , Y ) } \end{array}
|
| 298 |
+
$$
|
| 299 |
+
|
| 300 |
+
We use the identity $\mathrm { \Delta I M D } _ { b } ( X , Y ) = \| \hat { \mu } _ { X } - \hat { \mu } _ { Y } ) \| _ { \mathcal { H } }$ (Muandet et al., 2017, Eq. 3.31) and apply the inverse triangle inequality. The first term follows directly from Gretton et al. (2012a) (cf. eq. 7) and can be bounded by $\kappa$ . By design, the time shift $a ^ { * }$ was chosen to induce the concentration
|
| 301 |
+
|
| 302 |
+
$$
|
| 303 |
+
\mathbb { P } \left[ \mathrm { M M D } _ { b } ( X , \bar { X } ) > \kappa \right] \leq \epsilon
|
| 304 |
+
$$
|
| 305 |
+
|
| 306 |
+
and respectively also for MMD $_ b ( Y , Y )$ . Thus, we obtain in total
|
| 307 |
+
|
| 308 |
+
$$
|
| 309 |
+
\begin{array} { r l } { { \mathbb { P } [ | \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( X , Y ) | > \kappa ] } } \\ & { \leq \mathbb { P } [ | \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) | + \mathrm { M M D } _ { b } ( \bar { X } , X ) + \mathrm { M M D } _ { b } ( \bar { Y } , Y ) > \kappa ] } \\ & { \leq \frac { 1 } { 3 } \mathbb { P } [ | \mathrm { M M D } ( \mathbb { P } _ { X } , \mathbb { P } _ { Y } ) - \mathrm { M M D } _ { b } ( \bar { X } , \bar { Y } ) | > \kappa ] + \frac { 1 } { 3 } \mathbb { P } [ \mathrm { M M D } _ { b } ( \bar { X } , X ) > \kappa ] + \frac { 1 } { 3 } \mathbb { P } [ \mathrm { M M D } _ { b } ( \bar { Y } , Y ) > \kappa ] } \\ & { \leq \frac { 1 } { 3 } ( \alpha + 2 \epsilon ) . } \end{array}
|
| 310 |
+
$$
|
| 311 |
+
|
| 312 |
+
Remark 1 By adapting the concentration results inside the kernel two-sample test, i .e., McDiarmid’s inequality, we can directly embed significant autocorrelations in the test statistic and potentially be more data-efficient and have tighter bounds. These results, however, would require further technical assumptions (e.g., Assumption 3.1. in (Chérief-Abdellatif & Alquier, 2022), which is used in a different context and does not estimate mixing). Here, we focus on introducing an efficient, sound, and practically relevant statistical test for dynamical systems.
|
| 313 |
+
|
| 314 |
+
In practice, we usually do not have access to the full state $X _ { k }$ . Instead we receive measurements $X _ { k } ^ { \prime } =$ $g ( X _ { k } ) + \xi _ { k }$ , where $g$ is an observation function and $\xi _ { k } \overset { \mathrm { i i d } } { \sim } \mathbb { P } _ { \xi }$ measurement noise. Intuitively, the function $g$ could be regarded as sensors that measure some quantity that depends on the underlying system. Thus, we could also infer different systems when, e.g., the measurement noise or the sensors are different. Further, it is not always possible to reconstruct the state, and appropriate observability assumptions would be required for this. However, this is not due to our test but an issue of the problem itself since the true underlying state is unknown. Nonetheless, we are able to apply the proposed test to measurements $X _ { k } ^ { \prime }$ by considering the pushforward of the measure $g ( \mathbb { P } _ { X } )$ together with $\mathbb { P } _ { \xi }$ and correspondingly, $Y _ { k } ^ { \prime } = h ( Y _ { k } ) + \nu _ { k }$ with $\nu _ { k } \overset { \mathrm { i i d } } { \sim } \mathbb { P } _ { \nu }$ and observation function g.
|
| 315 |
+
|
| 316 |
+
Proposition 3 Assume the same setting as in theorem $\boldsymbol { \mathcal { Z } }$ , however, with noisy measurements $X _ { k } ^ { \prime } = g ( X _ { k } ) +$ $\xi _ { k }$ and $Y _ { k } ^ { \prime } = h ( Y _ { k } ) + \nu _ { k }$ and independent noise. If $\mathrm { M M D } _ { b } ^ { 2 } [ X ^ { ' } , Y ^ { ' } ] > \kappa ( n , \alpha )$ , then we conclude that $\| ^ { \boldsymbol { \mathsf { p } } } _ { \boldsymbol { X } ^ { \prime } } \neq \| ^ { \boldsymbol { \mathsf { p } } } _ { \boldsymbol { Y } ^ { \prime } }$ with high probability.
|
| 317 |
+
|
| 318 |
+

|
| 319 |
+
Figure 1: Scatter plot of an illustrative 2-dimensional LTI system. The system was designed to yield slow mixing times and initialized at $X _ { 0 } ~ = ~ 0$ . The red crosses represent the first 100 states $X _ { 0 } , X _ { 1 } , \ldots , X _ { 1 0 0 }$ . The blue circles represent states with an enforced time shift of $a ^ { * } = 7 5$ between samples. The stationary distribution of the system is illustrated as a contour plot.
|
| 320 |
+
|
| 321 |
+
In general, it is not clear what states to choose for an appropriate representation of a dynamical system, e.g., to accurately model human walking. If we obtain rich information through sensor measurements then this can often be sufficient for subsequent downstream tasks (cf. section 8).
|
| 322 |
+
|
| 323 |
+
# 7 Illustrative Examples
|
| 324 |
+
|
| 325 |
+
In this section, we illustrate two critical properties of our method: i) respecting the estimated time shift $a ^ { * }$ yields samples whose distribution is indistinguishable from the stationary distribution, ii) violating the estimated time shift $a ^ { * }$ leads to clustering effects that skew and bias the empirical distributions. More details on all experiments (deterministic and stochastic systems) are provided in the appendix.
|
| 326 |
+
|
| 327 |
+
In practice, it is usually sufficient to consider data from two points in time $\mathbb { P } _ { s }$ and $\mathbb { P } _ { s + a }$ —in particular, when kernel two-sample testing is also based on points and not subtrajectories. Thus, we estimate $a ^ { * }$ based on MMD-mixing (cf. def. 7) and (unless stated otherwise) pick the first time shift that is below the test threshold. Further, following Gretton et al. (2012a), we consider squared exponential kernels and chose the bandwidth based on the well-established median heuristic. Hyperparameter optimization can further improve the power of the test. We excluded such a discussion since this is not the main emphasize of our work and orthogonal to our contributions – how can kernel two-sample tests be adapted to dynamical systems and how can a suitable notion of mixing be estimated from data.
|
| 328 |
+
|
| 329 |
+
# 7.1 Linear Time-invariant System
|
| 330 |
+
|
| 331 |
+
Linear time-invariant (LTI) systems are prevalent in control and systems theory due to many analytically tractable properties. In particular, we can explicitly determine the stationary distribution (cf. equation 39 in the appendix) and, thus, draw i.i.d. samples. Consider the dynamics
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
X _ { k + 1 } = A X _ { k } + \epsilon _ { k } ,
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+
where $\epsilon _ { k } \overset { \mathrm { i i d } } { \sim } \mathcal { N } ( 0 , \Sigma )$ . Further, assume all eigenvalues of $A \in \mathbb { R } ^ { d \times d }$ are located within the unit circle and $x _ { 0 } = 0$ to avoid potential transient behavior. We can now quantify the speed of mixing directly through the eigenvalues of $A$ and $\Sigma$ . If $A$ has eigenvalues close to the boundary of the unit sphere, then this results in slow mixing. The same holds for small process noise. On the contrary, small eigenvalues of $A$ and large noise result in rapid mixing. An intuitive corner case is $A = 0$ , which yields perfectly independent samples.
|
| 338 |
+
|
| 339 |
+
In fig. 1, we illustrate the behavior of a two-dimensional slowly mixing system (31). In red, we plot the first 100 states of the system $X _ { 1 } , X _ { 2 } , \ldots , X _ { 1 0 0 }$ , and in blue, states with an enforced time shift of $a ^ { * } = 7 5$ between consecutive samples $X _ { a ^ { * } } , X _ { 2 a ^ { * } } , \ldots , X _ { 1 0 0 a ^ { * } }$ . The estimated time shift $a ^ { * } = 7 5$ is obtained in the MMD-mixing sense as described in sec. 5.2 and ensures that the HSIC is below the test threshold (cf. fig. 4 in the appendix).
|
| 340 |
+
|
| 341 |
+
In fig. 1, we further show a contour plot of the stationary distribution. Samples that were drawn based on our method coincide with the stationary distribution. The first 100 states, on the other hand, cluster in one region of the state space and are subject to heavy auto-correlations. The red crosses are clearly not representative of the stationary distribution. To investigate this further, we applied kernel two-sample tests to distinguish samples that are directly drawn from the stationary distribution and samples drawn based on our method with appropriate time shifts. As expected, this turned out to be impossible, and we cannot distinguish between the two data sets. Details are given in the appendix.
|
| 342 |
+
|
| 343 |
+
We want to emphasize that mixing can be arbitrarily slow. In particular, it is possible that the system does not mix at all (Simchowitz et al., 2018). With the proposed method, we would notice this since we would not be able to estimate an appropriate $a ^ { * }$ due to substantial remaining correlations in the data. Thus, we can decide whether the kernel two-sample test is applicable or not. We have also constructed non-mixing examples and obtained a constant HSIC that does not decrease over time (cf. appendix).
|
| 344 |
+
|
| 345 |
+
# 7.2 Lorenz Attractor
|
| 346 |
+
|
| 347 |
+
To illustrate the usefulness of the new mixing notion we present the example of the Lorenz system, which is illustrated in fig. 2 and given by the following equations:
|
| 348 |
+
|
| 349 |
+
$$
|
| 350 |
+
\begin{array} { l } { \dot { x } = 1 0 ( y - x ) } \\ { \dot { y } = 2 8 x - y - x z } \\ { \dot { z } = x y - \displaystyle \frac { 8 } { 3 } z . } \end{array}
|
| 351 |
+
$$
|
| 352 |
+
|
| 353 |
+
The Lorenz attractor is a famous chaotic and deterministic dynamical system that is known to mix in a topological sense (Luzzatto et al., 2005). Other notions, such as $\beta$ -mixing, are too strong and not suitable here. In the appendix, we provide empirical evidence that the Lorenz system mixes with respect to the herein introduced notion of MMD-mixing. Connecting topological mixing on a rigorous level with MMD-mixing remains for future work.
|
| 354 |
+
|
| 355 |
+
Further, we show numerically that we can distinguish between two systems with slightly different parameters and obtain the required properties of the kernel two-sample test. For the estimated $a ^ { * }$ , the test is wellbehaved. When we chose the estimated time shift too small, then the amount of false positives explodes.
|
| 356 |
+
|
| 357 |
+

|
| 358 |
+
Figure 2: Scatter plot of the classical Lorenz system in blue circles (eq. equation 32—equation 34) and samples from a system with slightly perturbed parameters in red crosses. Both systems are randomly initilized and sampled at time instances $t _ { 1 } = 2 0 , t _ { 2 } = 4 0 , \dots , t _ { 1 0 0 } = 2 0 0 0$ . To the human eye, the distributions look slightly different.
|
| 359 |
+
|
| 360 |
+
# 7.3 $c$ -mixing Systems
|
| 361 |
+
|
| 362 |
+
We also consider the three examples that are discussed in Hang et al. (2018) and are provably $c$ -mixing. Due to the Gaussian kernel that we use and the choices for $c$ $\operatorname { L i p } ( S )$ and $\mathrm { B V } ( S )$ , cf. Hang et al. (2018) for details), $\boldsymbol { \mathscr { C } }$ -mixing directly implies MMD-mixing. The empirical results confirm the MMD-mixing property.
|
| 363 |
+
|
| 364 |
+
We considered the following systems:
|
| 365 |
+
|
| 366 |
+
$\beta$ -map: For $\beta > 1$ and $x _ { 0 } \in ( 0 , 1 )$ , the dynamical system is defined by
|
| 367 |
+
|
| 368 |
+
$$
|
| 369 |
+
x _ { k + 1 } = \beta x _ { k } \mod 1 .
|
| 370 |
+
$$
|
| 371 |
+
|
| 372 |
+
Logistic map: For $x _ { 0 } \in ( 0 , 1 )$ , the logistic map is defined by
|
| 373 |
+
|
| 374 |
+
$$
|
| 375 |
+
x _ { k + 1 } = 4 x _ { k } ( 1 - x _ { k } ) .
|
| 376 |
+
$$
|
| 377 |
+
|
| 378 |
+
Gauss map: For $x _ { 0 } \in ( 0 , 1 )$ , the Gauss map is defined by
|
| 379 |
+
|
| 380 |
+
$$
|
| 381 |
+
x _ { k + 1 } = { \frac { 1 } { x _ { k } } } \mod 1 .
|
| 382 |
+
$$
|
| 383 |
+
|
| 384 |
+
For all examples, the speed of mixing is extremely fast and after $a ^ { * } = 1 0$ , the data is close to independent.
|
| 385 |
+
We initialized $x _ { 0 }$ uniformly on the interval $( 0 , 1 )$ and used $\beta = e$ .
|
| 386 |
+
|
| 387 |
+
Interestingly, the Lebesgue densities of the stationary distributions are also known and stated in Hang et al. (2018). This would allow for kernel two-sample testing, exactly as done for the OU-process in Sec. A.1.1. Since the mixing is extremely fast here, we expect the same result—time shifted data that respects the speed of mixing is indistinguishable from data that has been drawn directly from the stationary distribution.
|
| 388 |
+
|
| 389 |
+
# 8 Experimental Example—Human Walking
|
| 390 |
+
|
| 391 |
+
We apply the developed kernel two-sample test to real-world experimental data 1. We consider gait data of human subjects walking on a treadmill. Detecting characteristics and alterations in human gait is a highly relevant problem in disease prediction, diagnosis and progress monitoring as well as in biometrics (Nguyen et al., 2019; Gaßner et al., 2020; Muro-De-La-Herran et al., 2014). An example data set with a known ground truth label is obtained by letting subjects walk with and without a knee orthosis. Our goal is to classify each measured trajectory correctly with the labels orthosis and no orthosis.
|
| 392 |
+
|
| 393 |
+
# 8.1 Data Collection
|
| 394 |
+
|
| 395 |
+
The inertial measurement unit (IMU) data of foot motion were collected from 38 healthy subjects without any restrictions in gait or illnesses that affect their walking ability. The data collection was conducted in the motion analysis laboratory of one of the authors’ universities on a Mercury Med treadmill. The IMU sensors were attached to the test subjects’ shoes using velcro straps. The measurements were taken for 90 seconds each trial under the following conditions: walking at very slow $( 1 . 5 \mathrm { k m h ^ { - 1 } }$ ), slow $( 3 \mathrm { k m h ^ { - 1 } }$ ), slow with simulated gait pathology, and normal walking speed $( \mathrm { 5 k m h ^ { - 1 } }$ ). For the simulated gait pathology, the mobility of the left knee joint was restricted using a knee orthosis, which was fixed in a neutral position to disable further extension or flexion of the joint. The subjects were asked to stand still with both feet next to each other for 3 seconds at the beginning and the end of each trial, Before the trials, the subjects were able to practice walking on the treadmill. They were allowed to use the handrail of the treadmill if necessary. For three subjects, the orthosis experiment could not be carried out. An approval from the local ethics committee was obtained.
|
| 396 |
+
|
| 397 |
+
# 8.2 Description of the Statistical Test
|
| 398 |
+
|
| 399 |
+
We consider the raw gyroscopic data of the left foot for 35 subjects. The gyroscopic data is three-dimensional and consists of roughly 14 000 data points per trajectory.
|
| 400 |
+
|
| 401 |
+
# 8.2.1 Mixing Properties
|
| 402 |
+
|
| 403 |
+
First, we quantify the mixing properties of human walking. We estimate MMD-mixing (cf. sec. 5.2) by applying the HSIC to the 35 subjects. We consider the trials with and without the orthosis simultaneously, which yields 70 independent trajectories. We draw an initial point $X _ { k }$ from a uniform distribution between $k = 2 0 0 0$ and $k = 4 0 0 0$ and fix that point for all trajectories. Afterward, we compute HSIC $( X _ { k } , X _ { k + a } )$ for various values of $a$ . In fig. 3, the results are illustrated and we can see the decrease of dependencies. To exclude numerical artifacts, we repeat the estimation of the mixing properties 50 times with randomly chosen initial points.
|
| 404 |
+
|
| 405 |
+
# 8.2.2 Classification
|
| 406 |
+
|
| 407 |
+
We compare MMD-based classification against standard baselines for the 70 trajectories.
|
| 408 |
+
|
| 409 |
+
MMD-based classification: We choose one trajectory of interest, for which we forget the correct label, and separate it from all other trajectories, for which the correct label is known. We pick a random initial point $X _ { 0 }$ uniformly distributed between $k = 2 0 0 0$ and $k = 3 0 0 0$ . After time shifting the data with respect to $a ^ { * }$ , we estimate the MMD equation 6 between the trajectory of interest and all other trajectories. Then, we use the label of the trajectory with the smallest MMD to label the unlabeled trajectory. Intuitively, unrestricted trajectories look more similar among themselves than trajectories with a restricted knee, and vice versa.
|
| 410 |
+
|
| 411 |
+
Baseline: We compare the proposed approach to common baselines for classification of biomedical data (Bidabadi et al., 2019; Misgeld et al., 2015; Tien et al., 2010). We consider the following features:
|
| 412 |
+
|
| 413 |
+
• Maximum and minimum value of each dimension;
|
| 414 |
+
|
| 415 |
+

|
| 416 |
+
Figure 3: Mixing properties of gait data. On the $x$ -axis, we depict the time shift $a$ between consecutive samples. One time step corresponds to 0.01 seconds. The $y$ -axis shows the dependence between data points with respect to the corresponding time shift. The initial point is randomized, and the estimation is repeated 50 times. Depicted is the mean of the test statistic and the $9 5 \%$ upper confidence bound. We also show the threshold $\kappa$ of the independence test. When the blue line is below the red line, it is not possible to infer statistical dependence between the data points.
|
| 417 |
+
|
| 418 |
+
• The 4 largest frequencies based on a Fourier transform;
|
| 419 |
+
• The 2-norm over time and the state dimensions.
|
| 420 |
+
|
| 421 |
+
In total, this results in 19 features for each trajectory that are used to train linear classifiers—support vector machines (SVM) and logistic regression (LR). Further, we use a 3-fold cross-validation technique. We repeat the training also 1000 times and report the average accuracy and standard deviation in Table 1.
|
| 422 |
+
|
| 423 |
+
# 8.3 Results
|
| 424 |
+
|
| 425 |
+
Our empirical analysis reveals that human walking mixes with respect to MMD-mixing (cf. sec. 5.2). Further, as illustrated in fig. 3, we can effectively estimate the speed of mixing. After roughly five footsteps, the dependence of data to its past is mostly gone, and we can treat data as independent.
|
| 426 |
+
|
| 427 |
+
For MMD-based classification, we use a time shift of $a ^ { * } = 4 0 0$ . This results in 25 points per trajectory. A larger choice of $a ^ { * }$ around 600 would be closer to our theoretical results. However, due to the limited amount of data, this would reduce the number of available samples even further.
|
| 428 |
+
|
| 429 |
+
We run all classification algorithms 1000 times and report the average accuracy and standard deviation in Table 1. Our method achieves the best accuracy, and we are able to classify $9 9 . 9 9 \%$ of the subjects with no orthosis correctly. Some very few subjects are repeatedly misclassified when walking with the orthosis, which might be explained using futher insights and data analysis. For the other methods, in contrast, there is no apparent structure in the errors.
|
| 430 |
+
|
| 431 |
+
# 8.4 Discussion
|
| 432 |
+
|
| 433 |
+
The above results show that the proposed method works well on a practically relevant non-trivial problem and beats reasonable baselines. We spent a reasonable amount of time on designing good features in the comparison. While the accuracy of the linear classifiers could potentially be improved by adding additional features, designing such features requires more insight into the problem and system properties, which is unavailable in many applications. In order to improve the accuracy of our method, it would suffice to add more data (i.e., consider longer trajectories). Further, it can directly be applied to a range of similar problems.
|
| 434 |
+
|
| 435 |
+
Table 1: Classification accuracy for labeling the trajectories correctly into the labels orthosis and no orthosis. Mean accuracy with standard deviation over 1000 repetitions.
|
| 436 |
+
|
| 437 |
+
<table><tr><td>Our method</td><td>SvM</td><td>LR</td></tr><tr><td>95.7%± 2.4%</td><td>86.9%±4.4%</td><td>92.5%± 3.2%</td></tr></table>
|
| 438 |
+
|
| 439 |
+
Classification and clustering algorithms based on the MMD can be applied in more general settings (Jegelka et al., 2009). Thus, our proposed nearest-neighbor approach for dynamical systems should generalize to more sophisticated clustering algorithms, which could yield unprecedented insights into the behavior of complex dynamical systems.
|
| 440 |
+
|
| 441 |
+
# 9 Conclusion
|
| 442 |
+
|
| 443 |
+
We propose a kernel two-sample test for dynamical systems with deep connections to a new type of mixing in MMD. The proposed method is straightforward to use, has only a few parameters, and is model-free. In particular, we are able to estimate the speed of mixing from data in a relevant norm, which was previously not possible. The method is tailored to dynamical systems for which we have access to multiple independent and long trajectories. The flexibility and relevance of the proposed method are demonstrated numerically and experimentally on raw motion sensor data. The presented results show the potential for biomedical and engineering applications, which we plan to explore in future work.
|
| 444 |
+
|
| 445 |
+
# References
|
| 446 |
+
|
| 447 |
+
Shiva Sharif Bidabadi, Iain Murray, Gabriel Yin Foo Lee, Susan Morris, and Tele Tan. Classification of foot drop gait characteristic due to lumbar radiculopathy using machine learning algorithms. Gait & Posture, 71:234–240, 2019.
|
| 448 |
+
George D Birkhoff. Proof of the ergodic theorem. Proceedings of the National Academy of Sciences, 17(12): 656–660, 1931.
|
| 449 |
+
Richard C Bradley. Basic properties of strong mixing conditions. a survey and some open questions. Probability surveys, 2:107–144, 2005.
|
| 450 |
+
Richard C Bradley, Wlodzimierz Bryc, and Svante Janson. On dominations between measures of dependence. Journal of Multivariate Analysis, 23(2):312–329, 1987.
|
| 451 |
+
Steven L Brunton, Bingni W Brunton, Joshua L Proctor, Eurika Kaiser, and J Nathan Kutz. Chaos as an intermittently forced linear system. Nature Communications, 8(1):1–9, 2017.
|
| 452 |
+
Badr-Eddine Chérief-Abdellatif and Pierre Alquier. Finite sample properties of parametric mmd estimation: robustness to misspecification and dependence. Bernoulli, 28(1):181–213, 2022.
|
| 453 |
+
Kacper Chwialkowski and Arthur Gretton. A kernel independence test for random processes. In International Conference on Machine Learning, pp. 1422–1430, 2014.
|
| 454 |
+
Kacper P Chwialkowski, Dino Sejdinovic, and Arthur Gretton. A wild bootstrap for degenerate kernel tests. In Advances in Neural Information Processing Systems, pp. 3608–3616, 2014.
|
| 455 |
+
Gary Doran, Krikamol Muandet, Kun Zhang, and Bernhard Schölkopf. A permutation-based kernel conditional independence test. In Conference on Uncertainty in Artificial Intelligence, pp. 132–141, 2014.
|
| 456 |
+
|
| 457 |
+
Heiko Gaßner, Dennis Jensen, Franz Marxreiter, Anja Kletsch, Stefan Bohlen, Robin Schubert, Lisa M Muratori, Bjoern Eskofier, Jochen Klucken, Jürgen Winkler, et al. Gait variability as digital biomarker of disease severity in Huntington’s disease. Journal of Neurology, pp. 1–8, 2020.
|
| 458 |
+
|
| 459 |
+
Arthur Gretton, Kenji Fukumizu, Choon H Teo, Le Song, Bernhard Schölkopf, and Alex J Smola. A kernel statistical test of independence. In Advances in Neural Information Processing Systems, pp. 585–592, 2008.
|
| 460 |
+
|
| 461 |
+
Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. Journal of Machine Learning Research, 13(Mar):723–773, 2012a.
|
| 462 |
+
Arthur Gretton, Dino Sejdinovic, Heiko Strathmann, Sivaraman Balakrishnan, Massimiliano Pontil, Kenji Fukumizu, and Bharath K Sriperumbudur. Optimal kernel choice for large-scale two-sample tests. In Advances in Neural Information Processing Systems, pp. 1205–1213, 2012b.
|
| 463 |
+
Hanyuan Hang, Ingo Steinwart, et al. A Bernstein-type inequality for some mixing processes and dynamical systems with an application to learning. The Annals of Statistics, 45(2):708–743, 2017.
|
| 464 |
+
Hanyuan Hang, Ingo Steinwart, Yunlong Feng, and Johan AK Suykens. Kernel density estimation for dynamical systems. The Journal of Machine Learning Research, 19(1):1260–1308, 2018.
|
| 465 |
+
Jemin Hwangbo, Joonho Lee, Alexey Dosovitskiy, Dario Bellicoso, Vassilios Tsounis, Vladlen Koltun, and Marco Hutter. Learning agile and dynamic motor skills for legged robots. Science Robotics, 4(26):eaau5872, 2019.
|
| 466 |
+
Isao Ishikawa, Keisuke Fujii, Masahiro Ikeda, Yuka Hashimoto, and Yoshinobu Kawahara. Metric on nonlinear dynamical systems with Perron-Frobenius operators. In Advances in Neural Information Processing Systems, pp. 2856–2866, 2018.
|
| 467 |
+
Isao Ishikawa, Akinori Tanaka, Masahiro Ikeda, and Yoshinobu Kawahara. Metric on random dynamical systems with vector-valued reproducing kernel Hilbert spaces. arXiv preprint arXiv:1906.06957, 2019.
|
| 468 |
+
Stefanie Jegelka, Arthur Gretton, Bernhard Schölkopf, Bharath K Sriperumbudur, and Ulrike Von Luxburg. Generalized clustering via kernel embeddings. In Annual Conference on Artificial Intelligence, pp. 144–152. Springer, 2009.
|
| 469 |
+
Sabina Jeschke, Christian Brecher, Tobias Meisen, Denis Özdemir, and Tim Eschert. Industrial Internet of Things and cyber manufacturing systems. In Industrial Internet of Things, pp. 3–19. Springer, 2017.
|
| 470 |
+
Stefan Klus, Ingmar Schuster, and Krikamol Muandet. Eigendecompositions of transfer operators in reproducing kernel Hilbert spaces. Journal of Nonlinear Science, 30(1):283–315, 2020.
|
| 471 |
+
Lennart Ljung. System identification. Wiley Encyclopedia of Electrical and Electronics Engineering, 2001.
|
| 472 |
+
James R Lloyd and Zoubin Ghahramani. Statistical model criticism using kernel two sample tests. In Advances in Neural Information Processing Systems, pp. 829–837, 2015.
|
| 473 |
+
Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Deep transfer learning with joint adaptation networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2208–2217. JMLR. org, 2017.
|
| 474 |
+
Markus J Lueken, Berno JE Misgeld, and Steffen Leonhardt. Classification of spasticity affected EMGsignals. In IEEE 12th International Conference on Wearable and Implantable Body Sensor Networks (BSN), pp. 1–6, 2015.
|
| 475 |
+
Stefano Luzzatto, Ian Melbourne, and Frederic Paccaut. The Lorenz attractor is mixing. Communications in Mathematical Physics, 260(2):393–401, 2005.
|
| 476 |
+
Daniel McDonald, Cosma Shalizi, and Mark Schervish. Estimating beta-mixing coefficients. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 516–524, 2011.
|
| 477 |
+
Igor Mezic. On comparison of dynamics of dissipative and finite-time systems using Koopman operator methods. IFAC-PapersOnLine, 49(18):454–461, 2016.
|
| 478 |
+
Berno JE Misgeld, Markus Lüken, Daniel Heitzmann, Sebastian I Wolf, and Steffen Leonhardt. Body-sensornetwork-based spasticity detection. IEEE journal of Biomedical and Health Informatics, 20(3):748–755, 2015.
|
| 479 |
+
Krikamol Muandet, Kenji Fukumizu, Bharath Sriperumbudur, and Bernhard Schölkopf. Kernel mean embedding of distributions: A review and beyond. Foundations and Trends® in Machine Learning, 10(1-2): 1–141, 2017.
|
| 480 |
+
Alvaro Muro-De-La-Herran, Begonya Garcia-Zapirain, and Amaia Mendez-Zorrilla. Gait analysis methods: An overview of wearable and non-wearable systems, highlighting clinical applications. Sensors, 14(2): 3362–3394, 2014.
|
| 481 |
+
An Nguyen, Nils Roth, Nooshin Haji Ghassemi, Julius Hannink, Thomas Seel, Jochen Klucken, Heiko Gassner, and Bjoern M Eskofier. Development and clinical validation of inertial sensor-based gait-clustering methods in Parkinson’s disease. Journal of Neuroengineering and Rehabilitation, 16(1):1–14, 2019.
|
| 482 |
+
Niklas Pfister, Peter Bühlmann, Bernhard Schölkopf, and Jonas Peters. Kernel-based tests for joint independence. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 80(1):5–31, 2018.
|
| 483 |
+
Michele Pistacchi, Manuela Gioulis, Flavio Sanson, Ennio De Giovannini, Giuseppe Filippi, Francesca Rossetto, and Sandro Zambito Marsala. Gait analysis and clinical correlations in early Parkinson’s disease. Functional neurology, 32(1):28, 2017.
|
| 484 |
+
S Joe Qin and Thomas A Badgwell. A survey of industrial model predictive control technology. Control Engineering Practice, 11(7):733–764, 2003.
|
| 485 |
+
Henning Schluter, Friedrich Solowjow, and Sebastian Trimpe. Event-triggered learning for linear quadratic control. IEEE Transactions on Automatic Control, 2020.
|
| 486 |
+
Bernhard Schölkopf and Alexander J Smola. Learning with kernels: support vector machines, regularization, optimization, and beyond. MIT press, 2001.
|
| 487 |
+
Thomas B Schön, Adrian Wills, and Brett Ninness. System identification of nonlinear state-space models. Automatica, 47(1):39–49, 2011.
|
| 488 |
+
J Schoukens and Lennart Ljung. Nonlinear system identification: A user-oriented road map. IEEE Control Systems Magazine, 39(6):28–99, 2019.
|
| 489 |
+
Dino Sejdinovic, Bharath Sriperumbudur, Arthur Gretton, and Kenji Fukumizu. Equivalence of distancebased and RKHS-based statistics in hypothesis testing. The Annals of Statistics, pp. 2263–2291, 2013.
|
| 490 |
+
Max Simchowitz, Horia Mania, Stephen Tu, Michael I Jordan, and Benjamin Recht. Learning without mixing: Towards a sharp analysis of linear system identification. Conference on Learning Theory, pp. 439–473, 2018.
|
| 491 |
+
Carl-Johann Simon-Gabriel, Alessandro Barp, and Lester Mackey. Metrizing weak convergence with maximum mean discrepancies. arXiv preprint arXiv:2006.09268, 2020.
|
| 492 |
+
Friedrich Solowjow and Sebastian Trimpe. Event-triggered learning. Automatica, 117:109009, 2020.
|
| 493 |
+
Michael J. Sorocky, Siqi Zhou, and Angela P. Schoellig. Experience selection using dynamics similarity for efficient multi-source transfer learning between robots. In Proc. of the IEEE International Conference on Robotics and Automation , 2020.
|
| 494 |
+
Bharath K Sriperumbudur, Arthur Gretton, Kenji Fukumizu, Bernhard Schölkopf, and Gert RG Lanckriet. Hilbert space embeddings and metrics on probability measures. The Journal of Machine Learning Research, 11:1517–1561, 2010.
|
| 495 |
+
Ingo Steinwart and Andreas Christmann. Support vector machines. Springer Science & Business Media, 2008.
|
| 496 |
+
Zoltán Szabó and Bharath Sriperumbudur. Characteristic and universal tensor product kernels. Journal of Machine Learning Research, 18:233, 2018.
|
| 497 |
+
Iris Tien, Steven D Glaser, and Michael J Aminoff. Characterization of gait abnormalities in Parkinson’s disease using a wireless inertial sensor system. In Annual International Conference of the IEEE Engineering in Medicine and Biology, pp. 3353–3356. IEEE, 2010.
|
| 498 |
+
I Tolstikhin, O Bousquet, S Gelly, and B Schölkopf. Wasserstein auto-encoders. In International Conference on Learning Representations (ICLR), 2018.
|
| 499 |
+
Jonas Umlauft and Sandra Hirche. Feedback linearization based on Gaussian processes with event-triggered online learning. IEEE Transactions on Automatic Control, 2019.
|
| 500 |
+
SVN Vishwanathan, Alexander J Smola, and René Vidal. Binet-Cauchy kernels on dynamical systems and its application to the analysis of dynamic scenes. International Journal of Computer Vision, 73(1):95–119, 2007.
|
| 501 |
+
George Wynne and Andrew B Duncan. A kernel two-sample test for functional data. Journal of Machine Learning Research, 23(73):1–51, 2022.
|
| 502 |
+
Wojciech Zaremba, Arthur Gretton, and Matthew Blaschko. B-test: A non-parametric, low variance kernel two-sample test. In Advances in Neural Information Processing Systems, pp. 755–763, 2013.
|
| 503 |
+
Kemin Zhou and John Comstock Doyle. Essentials of Robust Control, volume 104. Prentice hall Upper Saddle River, NJ, 1998.
|
| 504 |
+
|
| 505 |
+
# A Appendix
|
| 506 |
+
|
| 507 |
+
# A.1 LTI Systems
|
| 508 |
+
|
| 509 |
+
There are several aspects that we kept short in the main paper and address in the following. We consider the dynamics
|
| 510 |
+
|
| 511 |
+
$$
|
| 512 |
+
X _ { k + 1 } = A X _ { k } + \epsilon _ { k } ,
|
| 513 |
+
$$
|
| 514 |
+
|
| 515 |
+
where $\epsilon _ { k } \overset { \mathrm { i i d } } { \sim } \mathcal { N } ( 0 , \Sigma )$ . Further, assume all eigenvalues of $A \in \mathbb { R } ^ { d \times d }$ are located within the unit circle.
|
| 516 |
+
|
| 517 |
+
Stationary Distribution: The stationary distribution of an LTI system is Gaussian with expected value zero. The Gaussian distribution follows from the Gaussian noise and linear structure of the system. The expected value can be computed by leveraging that all eigenvalues of $A$ are located within the unit circle. Obtaining the variance is more involved. It can be expressed as the solution to the following Lyapunov equation in $Z$ (Schluter et al., 2020, Equation 7):
|
| 518 |
+
|
| 519 |
+
$$
|
| 520 |
+
A Z A ^ { \mathsf { T } } - Z + \Sigma = 0 ,
|
| 521 |
+
$$
|
| 522 |
+
|
| 523 |
+
where $A$ is the system matrix and $\Sigma$ the covariance matrix of the process noise.
|
| 524 |
+
|
| 525 |
+
# A.1.1 Comparison to Stationary
|
| 526 |
+
|
| 527 |
+
We investigate if we can, based on a kernel two-sample test, distinguish between time shifted samples with respect to $a ^ { * }$ and i.i.d. samples from the stationary distribution.
|
| 528 |
+
|
| 529 |
+
Setup: We create 500 randomly generated LTI systems with a random dimensionality between 1 and 100. For each system we create $m = 2 5 0$ independent trajectories and sample $n = 2 0 0 0 0$ points for each trajectory. All systems are initialized in $X _ { 0 } = 0$ to avoid transient effects. The decay of dependence is quantified in the MMD-sense for one gap (cf. sec. 5 of main paper). We use data from the end of the trajectory to avoid numerical artifacts due to the identical initial values.
|
| 530 |
+
|
| 531 |
+

|
| 532 |
+
Figure 4: Mixing properties of the LTI system that is used to create fig. 1 in the main paper. On the $x$ -axis, we depict the time shift $a$ between consecutive samples. The $y$ -axis shows the dependence between data points with respect to the corresponding time shift. At $a ^ { * } = 7 5$ the test statistic is below the threshold.
|
| 533 |
+
|
| 534 |
+
Next, we describe how we generate the system matrices.
|
| 535 |
+
|
| 536 |
+
Sampling $\Sigma$ : The entries for the covariance matrix are drawn from a standard multivariate normal distribution. Since the matrix is supposed to yield a covariance matrix, we require symmetry and positive definiteness. Thus, we denote $\Sigma ^ { \prime }$ as the matrix drawn from the normal distribution and define $\Sigma = 0 . 5 ( \Sigma ^ { \prime } + \Sigma ^ { \prime \intercal } ) ^ { 2 }$ . To control the magnitude of noise, we scale the matrix with the largest eigenvalue of $\Sigma$ .
|
| 537 |
+
|
| 538 |
+
Sampling $A$ : The system matrix $A$ is required to have eigenvalues within the unit sphere. To achieve this, we draw the entries of $A$ from a uniform distribution and extend the system with a control input
|
| 539 |
+
|
| 540 |
+
$$
|
| 541 |
+
X _ { k + 1 } = A X _ { k } + B u _ { k } + \epsilon _ { k } .
|
| 542 |
+
$$
|
| 543 |
+
|
| 544 |
+
The control matrix $B$ is set to the identity matrix and the control input as a standard linear quadratic feedback controller $u _ { k } = - K x _ { k }$ . This yields the closed loop dynamics
|
| 545 |
+
|
| 546 |
+
$$
|
| 547 |
+
X _ { k + 1 } = ( A - B K ) X _ { k } + \epsilon _ { k } .
|
| 548 |
+
$$
|
| 549 |
+
|
| 550 |
+
The feedback gain $K$ can be computed to minimize a linear quadratic cost function. By adjusting the weights of the cost function, we can indirectly adjust the eigenvalues of the closed loop system matrix $( A - B K )$ . We set the weight matrix for the state cost $Q$ to the identity matrix and the control cost to $R = 1 0 ^ { 7 }$ . This makes it very expensive to apply large control inputs and magnitude of the eigenvalues of $( A - B K )$ stays close to 1. This implies slow mixing and further, by considering $R \to \infty$ , we can make this arbitrarily slow.
|
| 551 |
+
|
| 552 |
+
Results: First, we use the $m = 2 5 0$ trajectories to estimate the mixing speed $a ^ { * }$ . We choose $a ^ { * }$ as the firs time instance at which the test statistic is below the test threshold.
|
| 553 |
+
|
| 554 |
+
For the kernel two-sample test, we draw 100 points from the first trajectory that respect the time shift $a ^ { * }$ We also draw 100 points directly from the stationary distribution ( $\mathcal N ( 0 , Z )$ , cf. equation 39).
|
| 555 |
+
|
| 556 |
+

|
| 557 |
+
Figure 5: Mixing properties of the Lorenz system. Left plot with parameters as in equation 32—equation 34 and on the right, we adapted the parameter in equation 32 to 6. On the $x$ -axis, we depict the time shift $a$ between consecutive samples. The $y$ -axis shows the dependence between data points with respect to the corresponding time shift. The initial point is randomized, and the estimation is repeated 100 times. Depicted is the mean of the test statistic and the $9 5 \%$ upper confidence bound. We also show the threshold $\kappa$ of the independence test. When the blue line is below the red line, it is not possible to infer statistical dependence between the data points.
|
| 558 |
+
|
| 559 |
+
From the 500 systems we considered overall, we only obtained 4 false positives, which shows the high precision of our proposed test. Due to the probabilistic nature of these experiments, we could obtain systems with arbitrarily slow mixing times and, subsequently, very long $a ^ { * }$ . Thus, we decided to fix a maximum $a ^ { * }$ as $a _ { \mathrm { m a x } } = 2 0 0$ , and ignore all systems with larger $a ^ { * }$ . We obtained 81 systems that mix too slowly, i.e., $a ^ { * } > a _ { \mathrm { m a x } }$ .
|
| 560 |
+
|
| 561 |
+
# A.1.2 Details for fig. 1 in the main paper:
|
| 562 |
+
|
| 563 |
+
In fig. 4, we show the mixing properties of the system that yields $a ^ { * } = 7 5$ . We used the same setup as in sec. A.1.1 with some modifications. We chose $R = 1 0 ^ { 1 0 }$ and divided $\Sigma$ by $1 0 \lambda _ { \mathrm { m a x } } ^ { 2 }$ , where $\lambda _ { \mathrm { m a x } }$ is the largest eigenvalue of $\Sigma$ . Further, to be able to better visualize the samples and the stationary distributions, we fixed the dimension to two.
|
| 564 |
+
|
| 565 |
+
The randomly generated system matrices are
|
| 566 |
+
|
| 567 |
+
$$
|
| 568 |
+
A = \left( { \begin{array} { l l } { 0 . 2 3 4 5 } & { 0 . 8 6 0 9 } \\ { 0 . 7 2 9 8 } & { 0 . 1 3 1 6 } \end{array} } \right) , \Sigma = \left( { \begin{array} { l l } { 0 . 0 3 7 8 } & { 0 . 0 1 3 5 } \\ { 0 . 0 1 3 5 } & { 0 . 0 9 7 1 } \end{array} } \right) .
|
| 569 |
+
$$
|
| 570 |
+
|
| 571 |
+
# A.2 Lorenz System
|
| 572 |
+
|
| 573 |
+
To perform kernel two-sample testing, we slightly change the parameters in the Lorenz system by decreasing the coefficient in equation 32 from 10 to 6 to obtain a second slightly different system. The mixing analysis is done for both systems. The attractors of both systems look optically very similar. The attractor can be interpreted as the stationary probability distribution of the state in some sense.
|
| 574 |
+
|
| 575 |
+
# A.2.1 Mixing properties
|
| 576 |
+
|
| 577 |
+
We estimate the mixing properties of the Lorenz system in the MMD-mixing sense for one time shift $a$ (cf. Sec.5).
|
| 578 |
+
|
| 579 |
+
Initial points: We sample from an uniform distribution $\mathcal { U } ( [ - 0 . 5 , 0 . 5 ] \times [ - 0 . 5 , 0 . 5 ] \times [ 2 0 , 2 1 ] )$ to initialize the starting point $X _ { 0 }$ .
|
| 580 |
+
|
| 581 |
+
Data: We use a standard ODE solver $^ 2$ to obtain a solution to the Lorenz system. Due to variable step sizes within the solver, we interpolate the solution to obtain samples with a fixed discretization in time. We consider the time horizon $t \in [ 0 , 2 0 0 ]$ and create 2001 samples (with a fixed time step of 0.1).
|
| 582 |
+
|
| 583 |
+
Repetitions: We create $M = 1 0 0$ independent trajectories to estimate the mixing properties. The experiment is repeated $N = 1 0 0$ times to investigate deviations in the decay of the dependence.
|
| 584 |
+
|
| 585 |
+
Estimating mixing: To avoid numerical artifacts due to the initial points and potential transients, we consider data from the end of the trajectory. Thus, we sample at $t _ { \mathrm { e n d } } = 2 0 0$ and at $t - a$ for various values of $a = 0 . 1 , 1 . 1 , : 2 . 1 , . . . , 9 9 . 1$ with respect to the continuous time index $t$ .
|
| 586 |
+
|
| 587 |
+
Results: We depict the decay of dependence in fig. 5. After waiting for $a ^ { * } = 2 0$ , the dependence in the data is not detectable anymore. Since the decay is not necessarily monotonic, we consider significantly higher time shifts up to $a = 9 9 . 1$ . The dependence does not increase again, which indicates that the system is mostly mixing in the MMD-sense. Of course, this does not prove that the Lorenz system mixes and it remains to be shown rigorously. Nonetheless, these results are promising and provide empirical evidence.
|
| 588 |
+
|
| 589 |
+
# A.2.2 Kernel Two-sample Test
|
| 590 |
+
|
| 591 |
+
We try to distinguish between the Lorenz system given in equation 32—equation 34 and a slightly disturbed system where we change the parameter in equation 32 from 10 to 6. Based on the previous mixing analysis (cf. fig. 5) we set the time shift $a ^ { * } = 2 0$ . This yields approximately independent samples for both systems.
|
| 592 |
+
|
| 593 |
+
We create two trajectories of length $t _ { \mathrm { m a x } }$ and pick $n$ points that respect the time shift $a ^ { * }$ as illustrated in fig. 2. We repeat all experiments 100 times. We start the sampling after $t = 2 0$ , which gives the system enough time to converge to the stationary distribution.
|
| 594 |
+
|
| 595 |
+
Accuracy: We use $t _ { \mathrm { m a x } } = 6 0 0 0$ and pick $n = 3 0 0$ points from both system. We achieve $9 5 \%$ accuracy in detecting different systems.
|
| 596 |
+
|
| 597 |
+
False positives: We consider two trajectories that were generated by the classical Lorenz system (equation 32—equation 34. The initial points for both trajectories were random and different. This setup yields 2.67% false positives, which is less than the $\alpha$ -level of $5 \%$ that we used.
|
| 598 |
+
|
| 599 |
+
Next, we investigate what happens if we violate $a ^ { * }$ . We choose $n = 1 0 0$ and $t _ { \mathrm { m a x } } = 3 0$ . Thus, we sample 100 points in the time interval $t \in [ 2 0 , 3 0 ]$ . This clearly violates the estimated $a ^ { * }$ and indeed, we obtain $5 1 \%$ false positives. Essentially, this makes the test useless when $a ^ { * }$ is severely violated and thus, we want to emphasize again that it is critical to estimate $a ^ { * }$ . Further, through an appropriate choice of $a ^ { * }$ we inherit all the rich theoretical properties of kernel two-sample testing.
|
| 600 |
+
|
| 601 |
+
# A.3 Non-mixing System
|
| 602 |
+
|
| 603 |
+
We construct a system that does not mix in the MMD sense and is also not expected to mix. However, the system is well known to be ergodic and stationary. In particular, we consider a dynamical system that moves on a circle with a radius of one and steps of length $\frac { \pi } { 1 0 }$ . We create $m = 1 0 0$ randomly initialized points $\theta _ { 0 }$ and iterate them for $n = 1 0 0$ timesteps with the dynamics following
|
| 604 |
+
|
| 605 |
+
$$
|
| 606 |
+
\theta _ { k + 1 } = \theta _ { k } + \frac { \pi } { 1 0 } ,
|
| 607 |
+
$$
|
| 608 |
+
|
| 609 |
+
and
|
| 610 |
+
|
| 611 |
+
$$
|
| 612 |
+
X _ { k + 1 } = { \binom { \cos ( \theta _ { k } ) } { \sin ( \theta _ { k } ) } }
|
| 613 |
+
$$
|
| 614 |
+
|
| 615 |
+
We show the mixing properties in fig. 6. The dependence between data points stays constant and does not decrease and we detect this. Thus, we correctly identify systems that are not mixing in the MMD sense.
|
| 616 |
+
|
| 617 |
+
We have also tried different increments instead of $\frac { \pi } { 1 0 }$ , such as $\frac { e } { 1 0 }$ and also $\textstyle { \frac { 1 } { 1 0 } }$ , which all resulted in the same outcome.
|
| 618 |
+
|
| 619 |
+
# A.4 Implementations
|
| 620 |
+
|
| 621 |
+
Since our method is leveraging results from standard kernel two-sample testing and the HSIC, we directly used existing implementations without modifying them.
|
| 622 |
+
|
| 623 |
+

|
| 624 |
+
Figure 6: Mixing properties of a dynamical system that moves on a circle. The dependency between data points does not decrease and stays above the threshold.
|
| 625 |
+
|
| 626 |
+
Kernel Two-sample Test Implementation: We used the Matlab implementation: http://www.gatsby. ucl.ac.uk/\~gretton/mmd/mmd.htm and the standard hyperparameters without any tuning. We used the significance level $\alpha = 0 . 0 5$ for all experiments.
|
| 627 |
+
|
| 628 |
+
HSIC Implementation: We used the Matlab implementation: http://people.kyb.tuebingen.mpg.de/ arthur/indep.htm with standard hyperparameters and $\alpha = 0 . 0 5$ for all experiments.
|
md/test/kLZsLlIpDU/kLZsLlIpDU.md
ADDED
|
Binary file (60.4 kB). View file
|
|
|
md/test/mw1PWNSWZP/mw1PWNSWZP.md
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OCTOPACK: INSTRUCTION TUNING CODE LARGELANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Niklas Muennighoff Qian Liu Armel Zebaze Qinkai Zheng Binyuan Hui Terry Yue Zhuo Swayam Singh Xiangru Tang Leandro von Werra Shayne Longpre
|
| 4 |
+
|
| 5 |
+
n.muennighoff@gmail.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Finetuning large language models (LLMs) on instructions leads to vast performance improvements on natural language tasks. We apply instruction tuning using code, leveraging the natural structure of Git commits, which pair code changes with human instructions. We compile COMMITPACK: 4 terabytes of Git commits across 350 programming languages. We benchmark COMMITPACK against other natural and synthetic code instructions (xP3x, Self-Instruct, OASST) on the 16B parameter StarCoder model, and achieve state-of-the-art performance among models not trained on OpenAI outputs, on the HumanEval Python benchmark $4 6 . 2 \%$ pass $@ 1$ ). We further introduce HUMANEVALPACK, expanding the HumanEval benchmark to a total of 3 coding tasks (Code Repair, Code Explanation, Code Synthesis) across 6 languages (Python, JavaScript, Java, Go, $\mathrm { C } { + + }$ , Rust). Our models, OCTOCODER and OCTOGEEX, achieve the best performance across HUMANEVALPACK among all permissive models, demonstrating COMMITPACK’s benefits in generalizing to a wider set of languages and natural coding tasks. Code, models and data are freely available at https://github.com/bigcode-project/octopack.
|
| 10 |
+
|
| 11 |
+
# 1) CommitPack
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
Figure 1: OCTOPACK Overview. 1) Sample from our 4TB dataset, COMMITPACK. 2) Performance of OCTOCODER, OCTOGEEX and other code models including non-permissive ones (WizardCoder, GPT-4) on HUMANEVALPACK spanning 3 coding tasks and 6 programming languages.
|
| 15 |
+
|
| 16 |
+
# 1 INTRODUCTION
|
| 17 |
+
|
| 18 |
+
Finetuning large language models (LLMs) on a variety of language tasks explained via instructions (instruction tuning) has been shown to improve model usability and general performance (Wei et al., 2022; Sanh et al., 2022; Min et al., 2022; Ouyang et al., 2022). The instruction tuning paradigm has also proven successful for models trained on visual (Liu et al., 2023a; Li et al., 2023a), audio (Zhang et al., 2023b) and multilingual (Muennighoff et al., 2022b; Wang et al., 2022b) data.
|
| 19 |
+
|
| 20 |
+
In this work, we instruction tune LLMs on the coding modality. While Code LLMs can already be indirectly instructed to generate desired code using code comments, this procedure is brittle and does not work when the desired output is natural language, such as explaining code. Explicit instructing tuning of Code LLMs may improve their steerability and enable their application to more tasks. Concurrently to our work, three instruction tuned Code LLMs have been proposed: PanGu-Coder2 (Shen et al., 2023), WizardCoder (Luo et al., 2023) and InstructCodeT $^ { \circ + }$ (Wang et al., 2023c). These models rely on more capable and closed models from the OpenAI $\mathrm { \bf A P I ^ { 1 } }$ to create their instruction training data. This approach is problematic as (1) closed-source APIs keep changing and have unpredictable availability (Pozzobon et al., 2023; Chen et al., 2023a), (2) it relies on the assumption that a more capable model exists (3) it can reinforce model hallucination (Gudibande et al., 2023) and (4), depending on legal interpretation, OpenAI’s terms of use2 forbid such models: “...You may not...use output from the Services to develop models that compete with OpenAI...”. Thus, we consider models trained on OpenAI outputs not usable for commercial purposes in practice and classify them as non-permissive in this work.
|
| 21 |
+
|
| 22 |
+
We focus on more permissively licensed data and avoid using a closed-source model to generate synthetic data. We benchmark four popular sources of code instruction data: (1) xP3x (Muennighoff et al., 2022b), which contains data from common code benchmarks, (2) Self-Instruct (Wang et al., 2023a) data we create using a permissive Code LLM, (3) OASST (Köpf et al., 2023), which contains mostly natural language data and few code examples and (4) COMMITPACK, our new 4TB dataset of Git commits. Instruction tuning’s primary purpose is to expand models’ generalization abilities to a wide variety of tasks and settings. Thus, we extend the code synthesis benchmark, HumanEval (Chen et al., 2021; Zheng et al., 2023), to create HUMANEVALPACK: A code benchmark covering code synthesis, code repair, and code explanation across six programming languages.
|
| 23 |
+
|
| 24 |
+
Instruction tuning StarCoder (Li et al., 2023b) on a filtered variant of COMMITPACK and OASST leads to our best model, OCTOCODER, which surpasses all other openly licensed models (Figure 1), but falls short of the much larger GPT-4 (OpenAI, 2023). GPT-4 is close to maximum performance on the code synthesis variant, notably with a pass $@ 1$ score of $8 6 . 6 \%$ on Python HumanEval. However, it performs significantly worse on the code fixing and explanation variants of HUMANEVALPACK, which we introduce. This suggests that the original HumanEval benchmark may soon cease to be useful due to models reaching close to the maximum performance. Our more challenging evaluation variants provide room for future LLMs to improve on the performance of the current state-of-the-art.
|
| 25 |
+
|
| 26 |
+
In summary, we contribute:
|
| 27 |
+
|
| 28 |
+
• COMMITPACK and COMMITPACKFT: 4TB of permissively licensed code commits across 350 programming languages for pretraining and a filtered 2GB variant containing highquality code instructions used for finetuning
|
| 29 |
+
• HUMANEVALPACK: A benchmark for Code LLM generalization, spanning three scenarios (Code Repair, Code Explanation, Code Synthesis) and 6 programming languages (Python, JavaScript, Java, Go, $\mathrm { C } { + } { + }$ , Rust)
|
| 30 |
+
• OCTOCODER and OCTOGEEX: The best permissive Code LLMs
|
| 31 |
+
|
| 32 |
+
# 2 COMMITPACK: CODE INSTRUCTION DATA
|
| 33 |
+
|
| 34 |
+
Prior work has shown that models can generalize to languages included in pretraining, but absent during instruction tuning (Muennighoff et al., 2022b). However, they also show that including such languages during instruction tuning boosts their performance further. We hypothesize that code data exhibits the same behavior. To improve performance on code-related tasks, we thus construct a code instruction dataset leveraging the natural structure of Git commits.
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 2: Overview of COMMITPACK and COMMITPACKFT. Top: Language distribution of the full commit data (COMMITPACK) and the variant filtered for high-quality instructions (COMMITPACKFT). See Appendix C for the full distribution. Bottom: Task distribution of commits on the Python subset of COMMITPACKFT (59K samples) according to GPT-4.
|
| 38 |
+
|
| 39 |
+
Table 1: Statistics of code instruction data we consider. We display the number of programming languages, total samples, and fraction of samples that contain code for permissive instruction datasets. For finetuning on these datasets, we use small subsets with around 5,000 samples each.
|
| 40 |
+
|
| 41 |
+
<table><tr><td></td><td colspan="3">Base dataset</td><td colspan="3">Subset</td></tr><tr><td>Dataset (↓)</td><td>Lang.</td><td>Samples</td><td>Code fraction</td><td>Lang.</td><td>Samples</td><td>Code fraction</td></tr><tr><td>xP3x</td><td>8</td><td>532,107,156</td><td>0.67%</td><td>8</td><td>5,000</td><td>100%</td></tr><tr><td>StarCoder Self-Instruct</td><td>12</td><td>5,003</td><td>100%</td><td>12</td><td>5,003</td><td>100%</td></tr><tr><td>OASST</td><td>49</td><td>161,443</td><td>0.9%</td><td>28</td><td>8,587</td><td>2.5%</td></tr><tr><td>COMMITPACKFT</td><td>277</td><td>742,273</td><td>100%</td><td>6</td><td>5,000</td><td>100%</td></tr></table>
|
| 42 |
+
|
| 43 |
+
COMMITPACK To create the dataset, we use commit metadata from the GitHub action dump on Google BigQuery.3 We apply quality filters, filter for commercially friendly licenses, and discard commits that affect more than a single file to ensure commit messages are very specific and to avoid additional complexity from dealing with multiple files. We use the filtered metadata to scrape the affected code files prior to and after the commit from GitHub. This leads to almost 4 terabytes of data covering 350 programming languages (COMMITPACK). As instruction tuning does not require so much data (Zhou et al., 2023a; Touvron et al., 2023), we apply several strict filters to reduce the dataset to 2 gigabytes and 277 languages (COMMITPACKFT). These include filtering for samples where the commit message has specific words in uppercase imperative form at the start (e.g. "Verify ..."), consists of multiple words, and does not contain external references. All filters are detailed in Appendix D. Figure 2 depicts the distribution of both datasets and the tasks contained in COMMITPACKFT. For instruction tuning our models, we select 5,000 random samples from COMMITPACKFT across the 6 programming languages that we evaluate on. In Appendix G, we also experiment with pretraining on the entirety of COMMITPACK.
|
| 44 |
+
|
| 45 |
+
Alternatives We consider three additional datasets for instruction tuning presented in Table 1. xP3x: xP3x is a large-scale collection of multilingual instruction data with around 532 million samples (Muennighoff et al., 2022b). We focus only on the code subset of xP3x, excluding NeuralCodeSearch (Li et al., 2019) which is not licensed permissively, and select 5,000 samples.
|
| 46 |
+
|
| 47 |
+
Self-Instruct: Using the Self-Instruct method (Wang et al., 2022a) and the StarCoder model (Li et al., 2023b), we create 5,003 synthetic instructions and corresponding answers.
|
| 48 |
+
|
| 49 |
+
OASST: OASST is a diverse dataset of multi-turn chat dialogues (Köpf et al., 2023). Only a few of the dialogues contain code. We reuse a filtered variant from prior work (Dettmers et al., 2023) and additionally filter out moralizing assistant answers (Appendix D) leading to 8,587 samples.
|
| 50 |
+
|
| 51 |
+
# 3 HUMANEVALPACK: EVALUATING INSTRUCTION TUNED CODE MODELS
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
Figure 3: HUMANEVALPACK overview. The first HumanEval problem is depicted across the three scenarios for Python. The bug for HUMANEVALFIX consists of a missing "abs" statement.
|
| 55 |
+
|
| 56 |
+
When instruction tuning LLMs using natural language (NL) data, the input is an NL instruction with optional NL context and the target output is the NL answer to the task (Wei et al., 2022). When instruction tuning with code (C) data, code may either appear only in the input alongside the NL instruction $\mathrm { N L + C \mathrm { \to N L } }$ , e.g. code explanation), only in the output $\mathrm { N L } { } \mathrm { C }$ , e.g. code synthesis), or in both input and output $( { \mathrm { N L } } { + } { \mathrm { C } } { } { \mathrm { C } } ,$ , e.g. code modifications like bug fixing). While prior benchmarks commonly only cover variants of code synthesis, users may want to use models in all three scenarios. Thus, we expand the code synthesis benchmark HumanEval (Chen et al., 2021; Zheng et al., 2023) to cover all three input-output combinations for six languages (Figure 3).
|
| 57 |
+
|
| 58 |
+
HUMANEVALFIX $( \mathbf { N L + C } { \boldsymbol { } } \mathbf { C } )$ Given an incorrect code function with a subtle bug and accompanying unit tests, the model is tasked to fix the function. We manually add a bug to each of the 164 HumanEval solutions across all 6 languages (984 total bugs). For a given sample, the bugs are as similar as possible across the 6 languages enabling meaningful comparison of scores across languages. Bugs are written such that the code still runs but produces an incorrect result leading to at least one unit test failing. Bug statistics and examples are in Appendix L. We also evaluate an easier variant of this task where instead of unit tests, models are provided with the correct function docstring as the source of truth to fix bugs, see Appendix K.
|
| 59 |
+
|
| 60 |
+
HUMANEVALEXPLAIN $( \mathbf { N L + C } { } \mathbf { N L }$ ) Given a correct code function, the model is tasked to generate an explanation of the code. Subsequently, the same model is tasked to regenerate the code given only its own explanation. The second step allows us to score this task via code execution and measure pass $@ k$ (Chen et al., 2021) instead of evaluating the explanation itself using heuristic-based metrics like BLEU (Papineni et al., 2002) or ROUGE (Lin, 2004) which have major limitations (Reiter, 2018; Schluter, 2017; Eghbali & Pradel, 2022; Zhou et al., 2023b). To prevent models from copying the solution into the description, we remove any solution overlap of at least 20 characters from the description. We further enforce a character length limit on the model-generated explanation equivalent to the length of the docstring describing the function. This limit is specified in the prompt for the model. Note that the function docstring itself is never provided to the model for this task.
|
| 61 |
+
|
| 62 |
+
HUMANEVALSYNTHESIZE $( \mathbf { N L } { } \mathbf { C } )$ ) Given a natural language docstring or comment describing the desired code, the model is tasked to synthesize the correct code. This task corresponds to the original HumanEval benchmark (Chen et al., 2021). For instruction tuned models, we add an explicit instruction to the input explaining what the model should do. For models that have only gone through language model pretraining, we follow Chen et al. (2021) and provide the model with the function header and docstring to evaluate its completion of the function.
|
| 63 |
+
|
| 64 |
+
For all tasks we execute the code generations to compute performance using the pass $@ k$ metric (Chen et al., 2021): a problem is considered solved if any of $k$ code generations passes every test case. We focus on the simplest version of pass $@ k$ , which is pass $@ 1$ : the likelihood that the model solves a problem in a single attempt. Like Chen et al. (2021), we use a sampling temperature of 0.2 and $t o p _ { p } = 0 . 9 5$ to estimate pass $@ 1$ . We generate $n = 2 0$ samples, which is enough to get reliable pass $@ 1$ estimates (Li et al., 2023b). For GPT-4, we generate $n = 1$ samples. Using $n = 1$ instead of $n = 2 0$ for GPT-4 only changed scores from $7 5 . 0 \%$ to $7 5 . 2 \%$ pass $@ 1$ on HUMANEVALSYNTHESIZE Python while providing 20x cost savings.
|
| 65 |
+
|
| 66 |
+
Python HumanEval is the most widely used code benchmark and many training datasets have already been decontaminated for it (Kocetkov et al., 2022). By manually extending HumanEval, we ensure existing decontamination remains valid to enable fair evaluation. However, this may not hold for all models (e.g. GPT-4), thus results should be interpreted carefully.
|
| 67 |
+
|
| 68 |
+
# 4 OCTOCODER: BEST COMMERCIALLY LICENSED CODE LLM
|
| 69 |
+
|
| 70 |
+
# 4.1 ABLATING INSTRUCTION DATA CHOICES
|
| 71 |
+
|
| 72 |
+
We instruction tune the pretrained StarCoder model (Li et al., 2023b) on different combinations of our instruction datasets (§2). We evaluate all models on the Python subset of HUMANEVALPACK as depicted in Figure 4. Similar to prior work (Taori et al., 2023), we format all instructions into a consistent schema to distinguish question and answer (see Figure 18).
|
| 73 |
+
|
| 74 |
+
COMMITPACKFT enables CodeLLMs to fix bugs COMMITPACKFT is critical for the performance boost on code repair (HUMANEVALFIX), where instruction tuning on only OASST or other variants results in a significantly lower score. This is likely due to COMMITPACKFT including around $20 \%$ of bug fixes among other code-related tasks (Figure 2).
|
| 75 |
+
|
| 76 |
+
Importance of samples with natural language targets The pretrained StarCoder model, as well as the Self-Instruct variant, perform poorly on code explanation (HUMANEVALEXPLAIN). This is because both models are only conditioned to write code instead of natural language. We find that to perform well at explaining code, it is necessary to include samples with natural language as the target output during instruction tuning. Only relying on data with code as the target, such as the Self-Instruct data, will lead to models always outputting code even if the question requires a natural language output. Thus, we mix all other ablations with OASST, which contains many natural language targets. While the $\bf { \Phi } _ { X } \bf { P } 3 \bf { x }$ subset also contains samples with natural language output, many of its target outputs are short, which leads to models with a bias for short answers. This is impractical for the explanation task leading to the comparatively low score of mixing xP3x with OASST.
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
Figure 4: Comparing permissively licensed instruction datasets by instruction tuning StarCoder. Models are evaluated on the Python subset of HUMANEVALPACK.
|
| 80 |
+
|
| 81 |
+
COMMITPACKFT $^ +$ OASST yields best performance All instruction datasets provide similar boosts for code synthesis (HUMANEVALSYNTHESIZE), which has been the focus of all prior work on code instruction models (Wang et al., 2023c; Luo et al., 2023; Muennighoff et al., 2022b). We achieve the best average score by instruction tuning on COMMITPACKFT mixed with our filtered OASST data yielding an absolute $23 \%$ improvement over StarCoder. Thus, we select COMMITPACKFT $^ +$ OASST for our final model dubbed OCTOCODER. Using the same data, we also instruction tune the 6 billion parameter CodeGeeX2 (Zheng et al., 2023) to create OCTOGEEX. Training hyperparameters for both models are in Appendix P.
|
| 82 |
+
|
| 83 |
+
# 4.2 COMPARING WITH OTHER MODELS
|
| 84 |
+
|
| 85 |
+
We benchmark OCTOCODER and OCTOGEEX with state-of-the-art Code LLMs on HUMANEVALPACK in Table 2. For all models, we use the prompt put forward by the model creators if applicable or else a simple intuitive prompt, see Appendix Q.
|
| 86 |
+
|
| 87 |
+
OCTOCODER performs best among permissive models OCTOCODER has the highest average score across all three evaluation scenarios among all permissive models. With just 6 billion parameters, OCTOGEEX is the smallest model benchmarked, but still outperforms all prior permissive Code LLMs. GPT-4 (OpenAI, 2023) performs best among all models benchmarked with a significant margin. However, GPT-4 is closed-source and likely much larger than all other models evaluated.
|
| 88 |
+
|
| 89 |
+
Instruction tuning generalizes to unseen programming languages Trained primarily on natural language, not code, BLOOMZ (Muennighoff et al., 2022b) performs worse than other models despite having 176 billion parameters. Go and Rust are not contained in BLOOMZ’s instruction data, yet it performs much better than the random baseline of 0.0 for these two languages across most tasks. This confirms our hypothesis that models are capable of generalizing instructions to programming languages only seen at pretraining, similar to crosslingual generalization for natural languages (Muennighoff et al., 2022b). To improve programming language generalization further, we tune OCTOCODER and OCTOGEEX on many languages from COMMITPACKFT, and this generalization improvement is reflected in the performance on HUMANEVALPACK’s new languages.
|
| 90 |
+
|
| 91 |
+
Pretraining weight correlates with programming language performance after instruction tuning Prior work has shown that the performance on natural languages after instruction tuning is correlated with the weight of these languages during pretraining (Muennighoff et al., 2022b). The more weight during pretraining, the better the performance after instruction tuning. We find the same to be the case for programming languages. Python, Java, and JavaScript collectively make up around $30 \%$ of the pretraining data of StarCoder (Li et al., 2023b). After instruction tuning StarCoder to produce OCTOCODER, we see the best performance among these three languages, especially for HUMANEVALSYNTHESIZE. OCTOCODER performs weakest on Rust, which is the lowest resource language of StarCoder among the languages we benchmark ( $1 . 2 \%$ of pretraining data).
|
| 92 |
+
|
| 93 |
+
<table><tr><td>Model (↓)</td><td>Python</td><td> JavaScript</td><td>Java</td><td>Go</td><td>C++</td><td></td><td>Rust|Avg.</td></tr><tr><td colspan="8">HUMANEVALFIX</td></tr><tr><td colspan="8">Non-permissive models</td></tr><tr><td rowspan="4">InstructCodeT5+t WizardCodert GPT-4</td><td>2.7</td><td></td><td></td><td></td><td></td><td>0.5</td><td>1.8</td></tr><tr><td>31.8</td><td>1.2 29.5</td><td>4.3 30.7</td><td>2.1 30.4</td><td>0.2 18.7</td><td>13.0</td><td>25.7</td></tr><tr><td>47.0</td><td>48.2</td><td>50.0</td><td>50.6</td><td>47.6</td><td>43.3</td><td>47.8</td></tr><tr><td colspan="7">Permissive models</td></tr><tr><td colspan="8"></td></tr><tr><td>BLOOMZ</td><td>16.6</td><td>15.5</td><td>15.2</td><td>16.4</td><td>6.7</td><td>5.7</td><td>12.5</td></tr><tr><td>StarChat-β</td><td>18.1</td><td>18.1</td><td>24.1</td><td>18.1</td><td>8.2</td><td>3.6</td><td>11.2</td></tr><tr><td>CodeGeeX2*</td><td>15.9</td><td>14.7</td><td>18.0</td><td>13.6</td><td>4.3</td><td>6.1</td><td>12.1</td></tr><tr><td>StarCoder</td><td>8.7</td><td>15.7</td><td>13.3</td><td>20.1</td><td>15.6</td><td>6.7</td><td>13.4</td></tr><tr><td>OCTOGEEX*</td><td>28.1</td><td>27.7</td><td>30.4</td><td>27.6</td><td>22.9</td><td>9.6</td><td>24.4</td></tr><tr><td>OCTOCODER</td><td>30.4</td><td>28.4</td><td>30.6</td><td>30.2</td><td>26.1</td><td>16.5</td><td>27.0</td></tr></table>
|
| 94 |
+
|
| 95 |
+
HUMANEVALEXPLAIN
|
| 96 |
+
|
| 97 |
+
<table><tr><td colspan="8">Non-permissive models</td></tr><tr><td rowspan="2">InstructCodeT5+† WizardCodert GPT-4</td><td>20.8</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.1</td><td>0.0</td><td>3.5</td></tr><tr><td>32.5 64.6</td><td>33.0 57.3</td><td>27.4 51.2</td><td>26.7 58.5</td><td>28.2 38.4</td><td>16.9 42.7</td><td>27.5 52.1</td></tr><tr><td colspan="8"></td></tr><tr><td colspan="8">Permissive models</td></tr><tr><td>BLOOMZ</td><td>14.7</td><td>8.8</td><td>12.1</td><td>8.5</td><td>0.6</td><td>0.0</td><td>7.5</td></tr><tr><td>StarChat-β</td><td>25.4</td><td>21.5</td><td>24.5</td><td>18.4</td><td>17.6</td><td>13.2</td><td>20.1</td></tr><tr><td>CodeGeeX2*</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td></tr><tr><td>StarCoder</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td></tr><tr><td>OCTOGEEX*</td><td>30.4</td><td>24.0</td><td>24.7</td><td>21.7</td><td>21.0</td><td>15.9</td><td>22.9</td></tr><tr><td>OCTOCODER</td><td>35.1</td><td>24.5</td><td>27.3</td><td>21.1</td><td>24.1</td><td>14.8</td><td>24.5</td></tr></table>
|
| 98 |
+
|
| 99 |
+
HUMANEVALSYNTHESIZE
|
| 100 |
+
Table 2: Zero-shot pass $@ 1$ $( \% )$ performance across HUMANEVALPACK. InstructCodeT $^ { 5 + }$ , WizardCoder, StarChat- $\boldsymbol { \cdot } \beta$ , StarCoder and OCTOCODER have 16B parameters. CodeGeeX2 and OCTOGEEX have 6B parameters. BLOOMZ has 176B parameters. In this work, we call models "permissive" if weights are freely accessible and usable for commercial purposes. ⇤: Commercial license available after submitting a form. $\dagger$ : Trained on data that may not be used “to develop models that compete with OpenAI” thus we classify them as non-permissive in this work (see $\ S 1$ ).
|
| 101 |
+
|
| 102 |
+
<table><tr><td colspan="8">Non-permissive models</td></tr><tr><td rowspan="2">InstructCodeT5+† WizardCodert GPT-4</td><td>37.0</td><td>18.9</td><td>17.4</td><td>9.5</td><td>19.8</td><td>0.3</td><td>17.1</td></tr><tr><td>57.3 86.6</td><td>49.5 82.9</td><td>36.1 81.7</td><td>36.4 72.6</td><td>40.9 78.7</td><td>20.2 67.1</td><td>40.1 78.3</td></tr><tr><td colspan="8">Permissive models</td></tr><tr><td colspan="8"></td></tr><tr><td>BLOOMZ StarChat-β</td><td>15.6 33.5</td><td>14.8 31.4</td><td>18.4 26.7</td><td>8.4 25.5</td><td>6.5 26.6</td><td>5.5 14.0</td><td>11.5 26.3</td></tr><tr><td>CodeGeeX2*</td><td>35.9</td><td>32.2</td><td>30.8</td><td>22.5</td><td>29.3</td><td>18.1</td><td>28.1</td></tr><tr><td>StarCoder</td><td>33.6</td><td>30.8</td><td>30.2</td><td>17.6</td><td>31.6</td><td>21.8</td><td>27.6</td></tr><tr><td>OCTOGEEX*</td><td>44.7</td><td>33.8</td><td>36.9</td><td>21.9</td><td>32.3</td><td>15.7</td><td>30.9</td></tr><tr><td>OCTOCODER</td><td>46.2</td><td>39.2</td><td>38.2</td><td>30.4</td><td>35.6</td><td>23.4</td><td>35.5</td></tr></table>
|
| 103 |
+
|
| 104 |
+
Models struggle with small targeted changes HUMANEVALFIX is the most challenging task for most models. They commonly regenerate the buggy function without making any change (e.g. WizardCoder in Figure 34) or they introduce new bugs (e.g. GPT-4 in Figure 33). We analyze model performance by bug type in Appendix M and find bugs that require removing excess code are the most challenging. OCTOCODER performs comparatively well across all languages. Instruction tuning on COMMITPACKFT has likely taught OCTOCODER to make small, targeted changes to fix bugs.
|
| 105 |
+
|
| 106 |
+
Models struggle switching between code and text Some models fail at HUMANEVALEXPLAIN, as they do not generate natural language explanations. We manually inspect explanations for the first ten samples of the Python split and disqualify a model if none of them are explanations. This is the case for StarCoder and CodeGeeX2, which generate code instead of natural language explanations. BLOOMZ and InstructCode $^ { \mathrm { 7 5 + } }$ also occasionally generate code. Other models exclusively generate natural language explanations, not containing any code for inspected samples.
|
| 107 |
+
|
| 108 |
+
Models struggle adhering to a specified output length HUMANEVALEXPLAIN instructs models to fit their explanation within a given character limit (§3). Current models appear to have no understanding of how many characters they are generating. They commonly write very short and thus underspecified explanations (e.g. BLOOMZ in Figure 35) or excessively long explanations that end up being cut off (e.g. StarChat- $\beta$ in Figure 38). Future work could investigate how to enable models to be aware of their generated output length to improve HUMANEVALEXPLAIN performance.
|
| 109 |
+
|
| 110 |
+
HumanEval code synthesis is close to saturation Pure code synthesis on HUMANEVALSYNTHESIZE is the easiest task for all models. With a pass rate of $8 6 . 6 \%$ for a single solution, GPT-4 is close to fully saturating the Python subset. GPT-4 was originally found to score $67 \%$ on Python HumanEval (OpenAI, 2023) and $81 \%$ in later work (Bubeck et al., 2023). Our score for GPT-4 is significantly higher, possibly due to improvements made to the API by OpenAI, contamination of HumanEval in GPT-4 training, or slightly different prompting and evaluation. An example of our prompt is depicted in Figure 3 (right). We perform very careful evaluation to ensure every generation is correctly processed. We reproduce the HumanEval score of WizardCoder (Luo et al., 2023; $\mathrm { X u }$ et al., 2023a) and find it to also perform well across other languages. For BLOOMZ and InstructCodeT $^ { 5 + }$ our evaluation leads to a higher Python score than they reported, likely because of our more careful processing of generations. OCTOCODER has the highest performance for every language among permissively licensed models. With a pass $@ 1$ of $4 6 . 2 \%$ on the original Python split, OCTOCODER improves by a relative $38 \%$ over its base model, StarCoder.
|
| 111 |
+
|
| 112 |
+
# 5 RELATED WORK
|
| 113 |
+
|
| 114 |
+
# 5.1 CODE MODELS
|
| 115 |
+
|
| 116 |
+
There has been extensive work on code models tailored to a specific coding task, such as code summarization (Iyer et al., 2016; Ahmad et al., 2020; Zhang et al., 2022a; Shi et al., 2022) or code editing (Drain et al., 2021; Zhang et al., 2022c; He et al., 2022; Zhang et al., 2022b; Wei et al., 2023; Prenner & Robbes, 2023; Fakhoury et al., 2023; Skreta et al., 2023) (also see work on edit models more generally (Reid & Neubig, 2022; Schick et al., 2022; Dwivedi-Yu et al., 2022; Raheja et al., 2023)). These works use task-specific heuristics that limit the applicability of their methods to other tasks. In contrast, we aim to build models applicable to all kinds of tasks related to code and beyond.
|
| 117 |
+
|
| 118 |
+
Through large-scale pretraining more generally applicable code models have been developed (Nijkamp et al., 2022; 2023; Xu et al., 2022a; Christopoulou et al., 2022; Gunasekar et al., 2023; Li et al., 2023b; Bui et al., 2023; Scao et al., 2022a;b). However, these models only continue code making them hard to use for tasks such as explaining code with natural language (HUMANEVALEXPLAIN). Teaching them to follow human instructions is critical to make them applicable to diverse tasks.
|
| 119 |
+
|
| 120 |
+
# 5.2 INSTRUCTION MODELS
|
| 121 |
+
|
| 122 |
+
Training models to follow instructions has led to new capabilities in text (Ouyang et al., 2022; Wang et al., 2022b; Chung et al., 2022) and visual modalities (Xu et al., 2023b; OpenAI, 2023). Prior work has shown its benefits for traditional language tasks (Wei et al., 2022; Longpre et al., 2023a; Iyer et al., 2022), multilingual tasks (Muennighoff et al., 2022b; 2024; Yong et al., 2022; Üstün et al., 2024), and dialog (Köpf et al., 2023; Bai et al., 2022; Ganguli et al., 2022). For coding applications, PanGu-Coder2 (Shen et al., 2023), WizardCoder (Luo et al., 2023) and InstructCode $\mathrm { T } 5 +$ (Wang et al., 2023c) are recent models trained with coding instructions. However, they all use the CodeAlpaca dataset (Chaudhary, 2023), which is synthetically generated from OpenAI models. Using data from powerful closed-source models provides a strong advantage, but limits the model use and has other limitations highlighted in $\ S 1$ . CoEditor (Wei et al., 2023) proposes an “auto-editing” task, trained on 1650 python commit history repositories. Our work expands this to more general coding tasks via instructions, more languages, and orders of magnitude more commit data.
|
| 123 |
+
|
| 124 |
+
# 5.3 CODE BENCHMARKS
|
| 125 |
+
|
| 126 |
+
Many code synthesis benchmarks have been proposed (Wang et al., 2022d;c; Yu et al., 2023; Lai et al., 2023; Du et al., 2023). HumanEval (Chen et al., 2021; Liu et al., 2023b) has emerged as the standard for this task. Prior work has extended HumanEval to new programming languages via automatic translation mechanisms (Athiwaratkun et al., 2022; Cassano et al., 2023; Orlanski et al., 2023). These approaches are error-prone and only translate tests, not the actual solutions, which are needed for tasks like code explanation. Thus, we rely only on humans to create all parts of HUMANEVALPACK including test cases, correct solutions, buggy solutions, and other metadata across 6 languages.
|
| 127 |
+
|
| 128 |
+
Code repair is commonly evaluated on Quixbugs (Lin et al., 2017; Prenner & Robbes, 2021; Ye et al., 2021; Xia & Zhang, 2023; Jiang et al., 2023; Sobania et al., 2023) or Python bugs (He et al., 2022; Bradley et al., 2023). The latter does not support code execution, which limits its utility. While Quixbugs supports execution with unit tests, it only contains 40 samples in Python and Java. Further, the problems in Quixbugs are generic functions, such as bucket sort. This makes them easy to solve and hard to decontaminate training data for. Our benchmark, HUMANEVALFIX, contains 164 buggy functions for six languages with solutions and unit tests. Further, our coding problems, derived from HumanEval, are very specific, such as keeping track of a bank account balance (see Figure 14).
|
| 129 |
+
|
| 130 |
+
Prior work on evaluating code explanations (Lu et al., 2021; Cui et al., 2022) has relied on metrics such as METEOR (Banerjee & Lavie, 2005) or BLEU (Papineni et al., 2002). By chaining code explanation with code synthesis, we can evaluate this task using the execution-based pass $@ k$ metric overcoming the major limitations of BLEU and other heuristics-based metrics (Reiter, 2018).
|
| 131 |
+
|
| 132 |
+
Large-scale benchmarking has proven useful in many areas of natural language processing (Wang et al., 2019; Kiela et al., 2021; Srivastava et al., 2022; Muennighoff et al., 2022a). By producing 18 scores (6 languages across 3 tasks) for 9 models, we take a step towards large-scale benchmarking of code models. However, we lack many models capable of generating code (Black et al., 2021; Fried et al., 2022; Black et al., 2022; Wang & Komatsuzaki, 2021; Biderman et al., 2023b). Future work may consider more models or extending HUMANEVALPACK to new languages or tasks, such as code efficiency (Madaan et al., 2023a; Yetistiren et al., 2022) or code classification (Khan et al., 2023).
|
| 133 |
+
|
| 134 |
+
# 6 CONCLUSION
|
| 135 |
+
|
| 136 |
+
This work studies training and evaluation of Code LLMs that follow instructions. We introduce COMMITPACK, a 4TB dataset of Git commits covering 350 programming languages. We filter this large-scale dataset to create COMMITPACKFT, 2GB of high-quality code with commit messages that assimilate instructions. To enable a comprehensive evaluation of instruction code models, we construct HUMANEVALPACK, a human-written benchmark covering 3 different tasks for 6 programming languages. We ablate several instruction datasets and find that COMMITPACKFT combined with natural language data leads to the best performance. While our models, OCTOCODER and OCTOGEEX, are the best permissively licensed Code LLMs available, they are outperformed by closed-source models such as GPT-4. In addition to improving the instruction tuning paradigm, future work should consider training more capable base models.
|
| 137 |
+
|
| 138 |
+
# ACKNOWLEDGEMENTS
|
| 139 |
+
|
| 140 |
+
We thank Hugging Face for providing compute instances. We are extremely grateful to Rodrigo Garcia for the Rust translations, Dimitry Ageev and Calum Bird for help with GPT-4 evaluation, Loubna Ben Allal for help on evaluation, Arjun Guha for insightful discussions on chaining evaluation tasks to avoid evaluating with BLEU, Lewis Tunstall for help on the OASST data, Victor Sanh and Nadav Timor for discussions, Jiaxi Yang for logo editing and domain classification prompting design, Ghosal et al. (2023); Zeng et al. (2023) for design inspiration, Harm de Vries for feedback and all members of BigCode for general support. Finally, we thank every programmer who takes the time to write informative commit messages.
|
| 141 |
+
|
| 142 |
+
# REFERENCES
|
| 143 |
+
|
| 144 |
+
Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, and Kai-Wei Chang. A transformer-based approach for source code summarization. arXiv preprint arXiv:2005.00653, 2020.
|
| 145 |
+
Loubna Ben Allal, Raymond Li, Denis Kocetkov, Chenghao Mou, Christopher Akiki, Carlos Munoz Ferrandis, Niklas Muennighoff, Mayank Mishra, Alex Gu, Manan Dey, et al. Santacoder: don’t reach for the stars! arXiv preprint arXiv:2301.03988, 2023.
|
| 146 |
+
Ben Athiwaratkun, Sanjay Krishna Gouda, Zijian Wang, Xiaopeng Li, Yuchen Tian, Ming Tan, Wasi Uddin Ahmad, Shiqi Wang, Qing Sun, Mingyue Shang, et al. Multi-lingual evaluation of code generation models. arXiv preprint arXiv:2210.14868, 2022.
|
| 147 |
+
Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021.
|
| 148 |
+
Hannah McLean Babe, Sydney Nguyen, Yangtian Zi, Arjun Guha, Molly Q Feldman, and Carolyn Jane Anderson. Studenteval: A benchmark of student-written prompts for large language models of code. arXiv preprint arXiv:2306.04556, 2023.
|
| 149 |
+
Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, et al. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022. URL https://arxiv.org/abs/2204.05862.
|
| 150 |
+
Satanjeev Banerjee and Alon Lavie. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In Proceedings of the acl workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, pp. 65–72, 2005.
|
| 151 |
+
Antonio Valerio Miceli Barone and Rico Sennrich. A parallel corpus of python functions and documentation strings for automated code documentation and code generation. arXiv preprint arXiv:1707.02275, 2017.
|
| 152 |
+
Mohammad Bavarian, Heewoo Jun, Nikolas A. Tezak, John Schulman, Christine McLeavey, Jerry Tworek, and Mark Chen. Efficient training of language models to fill in the middle. arXiv preprint arXiv:2207.14255, 2022.
|
| 153 |
+
Loubna Ben Allal, Niklas Muennighoff, Logesh Kumar Umapathi, Ben Lipkin, and Leandro von Werra. A framework for the evaluation of code generation models. https://github.com/b igcode-project/bigcode-evaluation-harness, 2022.
|
| 154 |
+
Stella Biderman, USVSN Sai Prashanth, Lintang Sutawika, Hailey Schoelkopf, Quentin Anthony, Shivanshu Purohit, and Edward Raf. Emergent and predictable memorization in large language models. arXiv preprint arXiv:2304.11158, 2023a.
|
| 155 |
+
Stella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. In International Conference on Machine Learning, pp. 2397–2430. PMLR, 2023b.
|
| 156 |
+
|
| 157 |
+
Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. Gpt-neo: Large scale autoregressive language modeling with mesh-tensorflow. If you use this software, please cite it using these metadata, 58, 2021.
|
| 158 |
+
|
| 159 |
+
Sid Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, et al. Gpt-neox-20b: An open-source autoregressive language model. arXiv preprint arXiv:2204.06745, 2022.
|
| 160 |
+
Herbie Bradley, Honglu Fan, Harry Saini, Reshinth Adithyan, Shivanshu Purohit, and Joel Lehman. Diff models - a new way to edit code. CarperAI Blog, Jan 2023. URL https://carper.ai/ diff-model/.
|
| 161 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D. Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Conference on Neural Information Processing Systems (NeurIPS), 2020. URL https://papers.nips.cc/paper/2020/hash/1457c0d6bfcb4967418bfb8ac 142f64a-Abstract.html.
|
| 162 |
+
Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023.
|
| 163 |
+
Nghi DQ Bui, Hung Le, Yue Wang, Junnan Li, Akhilesh Deepak Gotmare, and Steven CH Hoi. Codetf: One-stop transformer library for state-of-the-art code llm. arXiv preprint arXiv:2306.00029, 2023.
|
| 164 |
+
Federico Cassano, John Gouwar, Daniel Nguyen, Sydney Nguyen, Luna Phipps-Costin, Donald Pinckney, Ming-Ho Yee, Yangtian Zi, Carolyn Jane Anderson, Molly Q Feldman, et al. Multipl-e: a scalable and polyglot approach to benchmarking neural code generation. IEEE Transactions on Software Engineering, 2023.
|
| 165 |
+
Sahil Chaudhary. Code alpaca: An instruction-following llama model for code generation. https: //github.com/sahil280114/codealpaca, 2023.
|
| 166 |
+
Bei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, and Weizhu Chen. Codet: Code generation with generated tests. arXiv preprint arXiv:2207.10397, 2022.
|
| 167 |
+
Lingjiao Chen, Matei Zaharia, and James Zou. How is chatgpt’s behavior changing over time?, 2023a.
|
| 168 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
|
| 169 |
+
Shouyuan Chen, Sherman Wong, Liangjian Chen, and Yuandong Tian. Extending context window of large language models via positional interpolation. arXiv preprint arXiv:2306.15595, 2023b.
|
| 170 |
+
Xinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. Teaching large language models to self-debug. arXiv preprint arXiv:2304.05128, 2023c.
|
| 171 |
+
Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. Advances in neural information processing systems, 30, 2017.
|
| 172 |
+
Fenia Christopoulou, Gerasimos Lampouras, Milan Gritta, Guchun Zhang, Yinpeng Guo, Zhongqi Li, Qi Zhang, Meng Xiao, Bo Shen, Lin Li, et al. Pangu-coder: Program synthesis with function-level language modeling. arXiv preprint arXiv:2207.11280, 2022.
|
| 173 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022. URL https://arxiv.org/abs/2210.11416.
|
| 174 |
+
Haotian Cui, Chenglong Wang, Junjie Huang, Jeevana Priya Inala, Todd Mytkowicz, Bo Wang, Jianfeng Gao, and Nan Duan. Codeexp: Explanatory code document generation. arXiv preprint arXiv:2211.15395, 2022.
|
| 175 |
+
|
| 176 |
+
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019.
|
| 177 |
+
|
| 178 |
+
Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memoryefficient exact attention with io-awareness. Advances in Neural Information Processing Systems, 35:16344–16359, 2022.
|
| 179 |
+
Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms. arXiv preprint arXiv:2305.14314, 2023.
|
| 180 |
+
Kaustubh D Dhole, Varun Gangal, Sebastian Gehrmann, Aadesh Gupta, Zhenhao Li, Saad Mahamood, Abinaya Mahendiran, Simon Mille, Ashish Srivastava, Samson Tan, et al. Nl-augmenter: A framework for task-sensitive natural language augmentation. arXiv preprint arXiv:2112.02721, 2021.
|
| 181 |
+
Yangruibo Ding, Zijian Wang, Wasi Uddin Ahmad, Murali Krishna Ramanathan, Ramesh Nallapati, Parminder Bhatia, Dan Roth, and Bing Xiang. Cocomic: Code completion by jointly modeling in-file and cross-file context. arXiv preprint arXiv:2212.10007, 2022.
|
| 182 |
+
Yihong Dong, Xue Jiang, Zhi Jin, and Ge Li. Self-collaboration code generation via chatgpt. arXiv preprint arXiv:2304.07590, 2023.
|
| 183 |
+
Dawn Drain, Colin B Clement, Guillermo Serrato, and Neel Sundaresan. Deepdebug: Fixing python bugs using stack traces, backtranslation, and code skeletons. arXiv preprint arXiv:2105.09352, 2021.
|
| 184 |
+
Xueying Du, Mingwei Liu, Kaixin Wang, Hanlin Wang, Junwei Liu, Yixuan Chen, Jiayi Feng, Chaofeng Sha, Xin Peng, and Yiling Lou. Classeval: A manually-crafted benchmark for evaluating llms on class-level code generation. arXiv preprint arXiv:2308.01861, 2023.
|
| 185 |
+
Jane Dwivedi-Yu, Timo Schick, Zhengbao Jiang, Maria Lomeli, Patrick Lewis, Gautier Izacard, Edouard Grave, Sebastian Riedel, and Fabio Petroni. Editeval: An instruction-based benchmark for text improvements. arXiv preprint arXiv:2209.13331, 2022.
|
| 186 |
+
Aryaz Eghbali and Michael Pradel. Crystalbleu: precisely and efficiently measuring the similarity of code. In Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, pp. 1–12, 2022.
|
| 187 |
+
Kawin Ethayarajh, Winnie Xu, Niklas Muennighoff, Dan Jurafsky, and Douwe Kiela. Kto: Model alignment as prospect theoretic optimization, 2024.
|
| 188 |
+
Sarah Fakhoury, Saikat Chakraborty, Madan Musuvathi, and Shuvendu K Lahiri. Towards generating functionally correct code edits from natural language issue descriptions. arXiv preprint arXiv:2304.03816, 2023.
|
| 189 |
+
Daniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang, Eric Wallace, Freda Shi, Ruiqi Zhong, Wen-tau Yih, Luke Zettlemoyer, and Mike Lewis. Incoder: A generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999, 2022.
|
| 190 |
+
Jinlan Fu, See-Kiong Ng, Zhengbao Jiang, and Pengfei Liu. Gptscore: Evaluate as you desire. arXiv preprint arXiv:2302.04166, 2023.
|
| 191 |
+
Deep Ganguli, Liane Lovitt, Jackson Kernion, Amanda Askell, Yuntao Bai, Saurav Kadavath, Ben Mann, Ethan Perez, Nicholas Schiefer, Kamal Ndousse, et al. Red teaming language models to reduce harms: Methods, scaling behaviors, and lessons learned. arXiv preprint arXiv:2209.07858, 2022.
|
| 192 |
+
Leo Gao, Jonathan Tow, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Kyle McDonell, Niklas Muennighoff, Jason Phang, Laria Reynolds, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, 2021. URL https://doi.org/10.5281/zenodo.5371628.
|
| 193 |
+
|
| 194 |
+
Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. In International Conference on Machine Learning, pp. 10764–10799. PMLR, 2023.
|
| 195 |
+
|
| 196 |
+
Deepanway Ghosal, Yew Ken Chia, Navonil Majumder, and Soujanya Poria. Flacuna: Unleashing the problem solving power of vicuna using flan fine-tuning. arXiv preprint arXiv:2307.02053, 2023.
|
| 197 |
+
Zhibin Gou, Zhihong Shao, Yeyun Gong, Yelong Shen, Yujiu Yang, Nan Duan, and Weizhu Chen. Critic: Large language models can self-correct with tool-interactive critiquing. arXiv preprint arXiv:2305.11738, 2023.
|
| 198 |
+
Dirk Groeneveld, Iz Beltagy, Pete Walsh, Akshita Bhagia, Rodney Kinney, Oyvind Tafjord, A. Jha, Hamish Ivison, Ian Magnusson, Yizhong Wang, Shane Arora, David Atkinson, Russell Authur, Khyathi Raghavi Chandu, Arman Cohan, Jennifer Dumas, Yanai Elazar, Yuling Gu, Jack Hessel, Tushar Khot, William Merrill, Jacob Daniel Morrison, Niklas Muennighoff, Aakanksha Naik, Crystal Nam, Matthew E. Peters, Valentina Pyatkin, Abhilasha Ravichander, Dustin Schwenk, Saurabh Shah, Will Smith, Emma Strubell, Nishant Subramani, Mitchell Wortsman, Pradeep Dasigi, Nathan Lambert, Kyle Richardson, Luke Zettlemoyer, Jesse Dodge, Kyle Lo, Luca Soldaini, Noah A. Smith, and Hanna Hajishirzi. Olmo: Accelerating the science of language models. 2024. URL https://api.semanticscholar.org/CorpusID:267365485.
|
| 199 |
+
Arnav Gudibande, Eric Wallace, Charlie Snell, Xinyang Geng, Hao Liu, Pieter Abbeel, Sergey Levine, and Dawn Song. The false promise of imitating proprietary llms. arXiv preprint arXiv:2305.15717, 2023.
|
| 200 |
+
Suriya Gunasekar, Yi Zhang, Jyoti Aneja, Caio César Teodoro Mendes, Allie Del Giorno, Sivakanth Gopi, Mojan Javaheripi, Piero Kauffmann, Gustavo de Rosa, Olli Saarikivi, et al. Textbooks are all you need. arXiv preprint arXiv:2306.11644, 2023.
|
| 201 |
+
Jingxuan He, Luca Beurer-Kellner, and Martin Vechev. On distribution shift in learning-based bug detectors. In International Conference on Machine Learning, pp. 8559–8580. PMLR, 2022.
|
| 202 |
+
Vincent J Hellendoorn, Charles Sutton, Rishabh Singh, Petros Maniatis, and David Bieber. Global relational models of source code. In International conference on learning representations, 2019.
|
| 203 |
+
Dan Hendrycks, Steven Basart, Saurav Kadavath, Mantas Mazeika, Akul Arora, Ethan Guo, Collin Burns, Samir Puranik, Horace He, Dawn Song, et al. Measuring coding challenge competence with apps. arXiv preprint arXiv:2105.09938, 2021.
|
| 204 |
+
Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021.
|
| 205 |
+
Yi Hu, Haotong Yang, Zhouchen Lin, and Muhan Zhang. Code prompting: a neural symbolic method for complex reasoning in large language models. arXiv preprint arXiv:2305.18507, 2023.
|
| 206 |
+
Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, and Luke Zettlemoyer. Summarizing source code using a neural attention model. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2073–2083, 2016.
|
| 207 |
+
Srinivasan Iyer, Xi Victoria Lin, Ramakanth Pasunuru, Todor Mihaylov, Daniel Simig, Ping Yu, Kurt Shuster, Tianlu Wang, Qing Liu, Punit Singh Koura, Xian Li, Brian O’Horo, Gabriel Pereyra, Jeff Wang, Christopher Dewan, Asli Celikyilmaz, Luke Zettlemoyer, and Ves Stoyanov. Opt-iml: Scaling language model instruction meta learning through the lens of generalization. arXiv preprint arXiv:2212.12017, 2022. URL https://arxiv.org/abs/2212.12017.
|
| 208 |
+
Mingi Jeon, Seung-Yeop Baik, Joonghyuk Hahn, Yo-Sub Han, and Sang-Ki Ko. Deep Learning-based Code Complexity Prediction. openreview, 2022.
|
| 209 |
+
|
| 210 |
+
Nan Jiang, Kevin Liu, Thibaud Lutellier, and Lin Tan. Impact of code language models on automated program repair. arXiv preprint arXiv:2302.05020, 2023.
|
| 211 |
+
|
| 212 |
+
Tae-Hwan Jung. Commitbert: Commit message generation using pre-trained programming language model. arXiv preprint arXiv:2105.14242, 2021.
|
| 213 |
+
|
| 214 |
+
Mohammad Abdullah Matin Khan, M Saiful Bari, Xuan Long Do, Weishi Wang, Md Rizwan Parvez, and Shafiq Joty. xcodeeval: A large scale multilingual multitask benchmark for code understanding, generation, translation and retrieval. arXiv preprint arXiv:2303.03004, 2023.
|
| 215 |
+
Douwe Kiela, Hamed Firooz, Aravind Mohan, Vedanuj Goswami, Amanpreet Singh, Casey A Fitzpatrick, Peter Bull, Greg Lipstein, Tony Nelli, Ron Zhu, et al. The hateful memes challenge: Competition report. In NeurIPS 2020 Competition and Demonstration Track, pp. 344–360. PMLR, 2021.
|
| 216 |
+
Denis Kocetkov, Raymond Li, Loubna Ben Allal, Jia Li, Chenghao Mou, Carlos Muñoz Ferrandis, Yacine Jernite, Margaret Mitchell, Sean Hughes, Thomas Wolf, et al. The stack: 3 tb of permissively licensed source code. arXiv preprint arXiv:2211.15533, 2022.
|
| 217 |
+
Andreas Köpf, Yannic Kilcher, Dimitri von Rütte, Sotiris Anagnostidis, Zhi-Rui Tam, Keith Stevens, Abdullah Barhoum, Nguyen Minh Duc, Oliver Stanley, Richárd Nagyfi, et al. Openassistant conversations–democratizing large language model alignment. arXiv preprint arXiv:2304.07327, 2023.
|
| 218 |
+
Yuhang Lai, Chengxi Li, Yiming Wang, Tianyi Zhang, Ruiqi Zhong, Luke Zettlemoyer, Wen-tau Yih, Daniel Fried, Sida Wang, and Tao Yu. Ds-1000: A natural and reliable benchmark for data science code generation. In International Conference on Machine Learning, pp. 18319–18345. PMLR, 2023.
|
| 219 |
+
Hugo Laurençon, Lucile Saulnier, Thomas Wang, Christopher Akiki, Albert Villanova del Moral, Teven Le Scao, Leandro Von Werra, Chenghao Mou, Eduardo González Ponferrada, Huu Nguyen, et al. The bigscience roots corpus: A 1.6 tb composite multilingual dataset. Advances in Neural Information Processing Systems, 35:31809–31826, 2022.
|
| 220 |
+
Joel Lehman, Jonathan Gordon, Shawn Jain, Kamal Ndousse, Cathy Yeh, and Kenneth O Stanley. Evolution through large models. arXiv preprint arXiv:2206.08896, 2022.
|
| 221 |
+
Bo Li, Yuanhan Zhang, Liangyu Chen, Jinghao Wang, Jingkang Yang, and Ziwei Liu. Otter: A multi-modal model with in-context instruction tuning. arXiv preprint arXiv:2305.03726, 2023a.
|
| 222 |
+
Hongyu Li, Seohyun Kim, and Satish Chandra. Neural code search evaluation dataset. arXiv preprint arXiv:1908.09804, 2019.
|
| 223 |
+
Raymond Li, Loubna Ben Allal, Yangtian Zi, Niklas Muennighoff, Denis Kocetkov, Chenghao Mou, Marc Marone, Christopher Akiki, Jia Li, Jenny Chim, et al. Starcoder: may the source be with you! arXiv preprint arXiv:2305.06161, 2023b.
|
| 224 |
+
Xueyang Li, Shangqing Liu, Ruitao Feng, Guozhu Meng, Xiaofei Xie, Kai Chen, and Yang Liu. Transrepair: Context-aware program repair for compilation errors. In Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, pp. 1–13, 2022a.
|
| 225 |
+
Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, et al. Competition-level code generation with alphacode. Science, 378(6624):1092–1097, 2022b.
|
| 226 |
+
Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pp. 74–81, 2004.
|
| 227 |
+
Derrick Lin, James Koppel, Angela Chen, and Armando Solar-Lezama. Quixbugs: A multi-lingual program repair benchmark set based on the quixey challenge. In Proceedings Companion of the 2017 ACM SIGPLAN international conference on systems, programming, languages, and applications: software for humanity, pp. 55–56, 2017.
|
| 228 |
+
Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023a.
|
| 229 |
+
Jiawei Liu, Chunqiu Steven Xia, Yuyao Wang, and Lingming Zhang. Is your code generated by chatgpt really correct? rigorous evaluation of large language models for code generation. arXiv preprint arXiv:2305.01210, 2023b.
|
| 230 |
+
Nelson F Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. arXiv preprint arXiv:2307.03172, 2023c.
|
| 231 |
+
Tianyang Liu, Canwen Xu, and Julian McAuley. Repobench: Benchmarking repository-level code auto-completion systems. arXiv preprint arXiv:2306.03091, 2023d.
|
| 232 |
+
Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguang Zhu. Gpteval: Nlg evaluation using gpt-4 with better human alignment. arXiv preprint arXiv:2303.16634, 2023e.
|
| 233 |
+
Shayne Longpre, Le Hou, Tu Vu, Albert Webson, Hyung Won Chung, Yi Tay, Denny Zhou, Quoc V Le, Barret Zoph, Jason Wei, et al. The flan collection: Designing data and methods for effective instruction tuning. arXiv preprint arXiv:2301.13688, 2023a.
|
| 234 |
+
Shayne Longpre, Gregory Yauney, Emily Reif, Katherine Lee, Adam Roberts, Barret Zoph, Denny Zhou, Jason Wei, Kevin Robinson, David Mimno, et al. A pretrainer’s guide to training data: Measuring the effects of data age, domain coverage, quality, & toxicity. arXiv preprint arXiv:2305.13169, 2023b.
|
| 235 |
+
Shuai Lu, Daya Guo, Shuo Ren, Junjie Huang, Alexey Svyatkovskiy, Ambrosio Blanco, Colin Clement, Dawn Drain, Daxin Jiang, Duyu Tang, et al. Codexglue: A machine learning benchmark dataset for code understanding and generation. arXiv preprint arXiv:2102.04664, 2021.
|
| 236 |
+
Ziyang Luo, Can Xu, Pu Zhao, Qingfeng Sun, Xiubo Geng, Wenxiang Hu, Chongyang Tao, Jing Ma, Qingwei Lin, and Daxin Jiang. Wizardcoder: Empowering code large language models with evol-instruct. arXiv preprint arXiv:2306.08568, 2023.
|
| 237 |
+
Aman Madaan, Alexander Shypula, Uri Alon, Milad Hashemi, Parthasarathy Ranganathan, Yiming Yang, Graham Neubig, and Amir Yazdanbakhsh. Learning performance-improving code edits. arXiv preprint arXiv:2302.07867, 2023a.
|
| 238 |
+
Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023b.
|
| 239 |
+
Sewon Min, Mike Lewis, Luke Zettlemoyer, and Hannaneh Hajishirzi. MetaICL: Learning to learn in context. Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), 2022. URL https://arxiv.org/abs/2110.15943.
|
| 240 |
+
Martin Monperrus, Matias Martinez, He Ye, Fernanda Madeiral, Thomas Durieux, and Zhongxing Yu. Megadiff: A dataset of 600k java source code changes categorized by diff size. arXiv preprint arXiv:2108.04631, 2021.
|
| 241 |
+
Niklas Muennighoff. Sgpt: Gpt sentence embeddings for semantic search. arXiv preprint arXiv:2202.08904, 2022.
|
| 242 |
+
Niklas Muennighoff, Nouamane Tazi, Loïc Magne, and Nils Reimers. Mteb: Massive text embedding benchmark. arXiv preprint arXiv:2210.07316, 2022a. doi: 10.48550/ARXIV.2210.07316. URL https://arxiv.org/abs/2210.07316.
|
| 243 |
+
Niklas Muennighoff, Thomas Wang, Lintang Sutawika, Adam Roberts, Stella Biderman, Teven Le Scao, M Saiful Bari, Sheng Shen, Zheng-Xin Yong, Hailey Schoelkopf, et al. Crosslingual generalization through multitask finetuning. arXiv preprint arXiv:2211.01786, 2022b.
|
| 244 |
+
Niklas Muennighoff, Alexander M Rush, Boaz Barak, Teven Le Scao, Aleksandra Piktus, Nouamane Tazi, Sampo Pyysalo, Thomas Wolf, and Colin Raffel. Scaling data-constrained language models. arXiv preprint arXiv:2305.16264, 2023.
|
| 245 |
+
Niklas Muennighoff, Hongjin Su, Liang Wang, Nan Yang, Furu Wei, Tao Yu, Amanpreet Singh, and Douwe Kiela. Generative representational instruction tuning, 2024.
|
| 246 |
+
|
| 247 |
+
Ansong Ni, Srini Iyer, Dragomir Radev, Veselin Stoyanov, Wen-tau Yih, Sida Wang, and Xi Victoria Lin. Lever: Learning to verify language-to-code generation with execution. In International Conference on Machine Learning, pp. 26106–26128. PMLR, 2023.
|
| 248 |
+
|
| 249 |
+
Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong. Codegen: An open large language model for code with multi-turn program synthesis. arXiv preprint arXiv:2203.13474, 2022.
|
| 250 |
+
|
| 251 |
+
Erik Nijkamp, Hiroaki Hayashi, Caiming Xiong, Silvio Savarese, and Yingbo Zhou. Codegen2: Lessons for training llms on programming and natural languages. arXiv preprint arXiv:2305.02309, 2023.
|
| 252 |
+
|
| 253 |
+
Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114, 2021. URL https://openreview.net/forum?id ${ . } = { }$ iedYJm92o0a.
|
| 254 |
+
OpenAI. Gpt-4 technical report, 2023.
|
| 255 |
+
Gabriel Orlanski, Kefan Xiao, Xavier Garcia, Jeffrey Hui, Joshua Howland, Jonathan Malmaud, Jacob Austin, Rishah Singh, and Michele Catasta. Measuring the impact of programming language distribution. arXiv preprint arXiv:2302.01973, 2023.
|
| 256 |
+
Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. In Conference on Neural Information Processing Systems (NeurIPS), 2022. URL https://arxiv.org/abs/2203.02155.
|
| 257 |
+
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association for Computational Linguistics, pp. 311–318, 2002.
|
| 258 |
+
Bo Peng, Eric Alcaide, Quentin Anthony, Alon Albalak, Samuel Arcadinho, Huanqi Cao, Xin Cheng, Michael Chung, Matteo Grella, Kranthi Kiran GV, et al. Rwkv: Reinventing rnns for the transformer era. arXiv preprint arXiv:2305.13048, 2023.
|
| 259 |
+
Ethan Perez, Douwe Kiela, and Kyunghyun Cho. True few-shot learning with language models. Advances in Neural Information Processing Systems, 34:11054–11070, 2021.
|
| 260 |
+
Luiza Amador Pozzobon, Beyza Ermis, Patrick Lewis, and Sara Hooker. On the challenges of using black-box apis for toxicity evaluation in research. In ICLR 2023 Workshop on Trustworthy and Reliable Large-Scale Machine Learning Models, 2023.
|
| 261 |
+
Julian Aron Prenner and Romain Robbes. Automatic program repair with openai’s codex: Evaluating quixbugs. arXiv preprint arXiv:2111.03922, 2021.
|
| 262 |
+
Julian Aron Prenner and Romain Robbes. Runbugrun–an executable dataset for automated program repair. arXiv preprint arXiv:2304.01102, 2023.
|
| 263 |
+
Ofir Press, Noah A Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. arXiv preprint arXiv:2108.12409, 2021.
|
| 264 |
+
Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D Manning, Stefano Ermon, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. Advances in Neural Information Processing Systems, 36, 2024.
|
| 265 |
+
Vipul Raheja, Dhruv Kumar, Ryan Koo, and Dongyeop Kang. Coedit: Text editing by task-specific instruction tuning. arXiv preprint arXiv:2305.09857, 2023.
|
| 266 |
+
Machel Reid and Graham Neubig. Learning to model editing processes. arXiv preprint arXiv:2205.12374, 2022.
|
| 267 |
+
Ehud Reiter. A structured review of the validity of bleu. Computational Linguistics, 44(3):393–401, 2018.
|
| 268 |
+
Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. Multitask prompted training enables zero-shot task generalization. International Conference on Learning Representations (ICLR), 2022. URL https://openreview.net/forum?id $=$ 9Vrb9D0WI4.
|
| 269 |
+
Teven Le Scao, Angela Fan, Christopher Akiki, Ellie Pavlick, Suzana Ilic, Daniel Hesslow, Roman ´ Castagné, Alexandra Sasha Luccioni, François Yvon, Matthias Gallé, et al. Bloom: A 176bparameter open-access multilingual language model. arXiv preprint arXiv:2211.05100, 2022a.
|
| 270 |
+
Teven Le Scao, Thomas Wang, Daniel Hesslow, Lucile Saulnier, Stas Bekman, M Saiful Bari, Stella Bideman, Hady Elsahar, Niklas Muennighoff, Jason Phang, et al. What language model to train if you have one million gpu hours? arXiv preprint arXiv:2210.15424, 2022b.
|
| 271 |
+
Timo Schick, Jane Dwivedi-Yu, Zhengbao Jiang, Fabio Petroni, Patrick Lewis, Gautier Izacard, Qingfei You, Christoforos Nalmpantis, Edouard Grave, and Sebastian Riedel. Peer: A collaborative language model. arXiv preprint arXiv:2208.11663, 2022.
|
| 272 |
+
Natalie Schluter. The limits of automatic summarisation according to rouge. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics, pp. 41–45. Association for Computational Linguistics, 2017.
|
| 273 |
+
Noam M. Shazeer. Fast transformer decoding: One write-head is all you need. arXiv preprint arXiv:1911.02150, 2019.
|
| 274 |
+
Bo Shen, Jiaxin Zhang, Taihong Chen, Daoguang Zan, Bing Geng, An Fu, Muhan Zeng, Ailun Yu, Jichuan Ji, Jingyang Zhao, Yuenan Guo, and Qianxiang Wang. Pangu-coder2: Boosting large language models for code with ranking feedback, 2023.
|
| 275 |
+
Ensheng Shi, Yanlin Wang, Lun Du, Junjie Chen, Shi Han, Hongyu Zhang, Dongmei Zhang, and Hongbin Sun. On the evaluation of neural code summarization. In Proceedings of the 44th International Conference on Software Engineering, pp. 1597–1608, 2022.
|
| 276 |
+
Disha Shrivastava, Denis Kocetkov, Harm de Vries, Dzmitry Bahdanau, and Torsten Scholak. Repofusion: Training code models to understand your repository. arXiv preprint arXiv:2306.10998, 2023a.
|
| 277 |
+
Disha Shrivastava, Hugo Larochelle, and Daniel Tarlow. Repository-level prompt generation for large language models of code. In International Conference on Machine Learning, pp. 31693–31715. PMLR, 2023b.
|
| 278 |
+
Shivalika Singh, Freddie Vargus, Daniel Dsouza, Börje F Karlsson, Abinaya Mahendiran, Wei-Yin Ko, Herumb Shandilya, Jay Patel, Deividas Mataciunas, Laura OMahony, et al. Aya dataset: An open-access collection for multilingual instruction tuning. arXiv preprint arXiv:2402.06619, 2024.
|
| 279 |
+
Marta Skreta, Naruki Yoshikawa, Sebastian Arellano-Rubach, Zhi Ji, Lasse Bjørn Kristensen, Kourosh Darvish, Alán Aspuru-Guzik, Florian Shkurti, and Animesh Garg. Errors are useful prompts: Instruction guided task programming with verifier-assisted iterative prompting. arXiv preprint arXiv:2303.14100, 2023.
|
| 280 |
+
Dominik Sobania, Martin Briesch, Carol Hanna, and Justyna Petke. An analysis of the automatic bug fixing performance of chatgpt. arXiv preprint arXiv:2301.08653, 2023.
|
| 281 |
+
Luca Soldaini, Rodney Kinney, Akshita Bhagia, Dustin Schwenk, David Atkinson, Russell Authur, Ben Bogin, Khyathi Raghavi Chandu, Jennifer Dumas, Yanai Elazar, Valentin Hofmann, A. Jha, Sachin Kumar, Li Lucy, Xinxi Lyu, Nathan Lambert, Ian Magnusson, Jacob Daniel Morrison, Niklas Muennighoff, Aakanksha Naik, Crystal Nam, Matthew E. Peters, Abhilasha Ravichander, Kyle Richardson, Zejiang Shen, Emma Strubell, Nishant Subramani, Oyvind Tafjord, Pete Walsh, Luke Zettlemoyer, Noah A. Smith, Hanna Hajishirzi, Iz Beltagy, Dirk Groeneveld, Jesse Dodge, and Kyle Lo. Dolma: an open corpus of three trillion tokens for language model pretraining research. 2024. URL https://api.semanticscholar.org/CorpusID:267364861.
|
| 282 |
+
|
| 283 |
+
Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models, 2022. URL https://arxiv.org/abs/2206.04615.
|
| 284 |
+
|
| 285 |
+
Simeng Sun, Kalpesh Krishna, Andrew Mattarella-Micke, and Mohit Iyyer. Do long-range language models actually use long-range context? ArXiv, abs/2109.09115, 2021. URL https://api. semanticscholar.org/CorpusID:237572264.
|
| 286 |
+
Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023.
|
| 287 |
+
Ross Taylor, Marcin Kardas, Guillem Cucurull, Thomas Scialom, Anthony Hartshorn, Elvis Saravia, Andrew Poulton, Viktor Kerkez, and Robert Stojnic. Galactica: A large language model for science. arXiv preprint arXiv:2211.09085, 2022.
|
| 288 |
+
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
|
| 289 |
+
Lewis Tunstall, Nathan Lambert, Nazneen Rajani, Edward Beeching, Teven Le Scao, Leandro von Werra, Sheon Han, Philipp Schmid, and Alexander Rush. Creating a coding assistant with starcoder. Hugging Face Blog, 2023. https://huggingface.co/blog/starchat.
|
| 290 |
+
Ahmet Üstün, Viraat Aryabumi, Zheng-Xin Yong, Wei-Yin Ko, Daniel D’souza, Gbemileke Onilude, Neel Bhandari, Shivalika Singh, Hui-Lee Ooi, Amr Kayid, et al. Aya model: An instruction finetuned open-access multilingual language model. arXiv preprint arXiv:2402.07827, 2024.
|
| 291 |
+
Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. SuperGLUE: A stickier benchmark for general-purpose language understanding systems. Conference on Neural Information Processing Systems (NeurIPS), 2019. URL https://arxiv.org/abs/1905.00537.
|
| 292 |
+
Ben Wang and Aran Komatsuzaki. Gpt-j-6b: A 6 billion parameter autoregressive language model, 2021.
|
| 293 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V Le, Ed H. Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. In International Conference on Learning Representations (ICLR), 2023a. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ 1PL1NIMMrw.
|
| 294 |
+
Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022a.
|
| 295 |
+
Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Anjana Arunkumar, Arjun Ashok, Arut Selvan Dhanasekaran, Atharva Naik, David Stap, et al. Super-naturalinstructions: Generalization via declarative instructions on $1 6 0 0 +$ nlp tasks. arXiv preprint arXiv:2204.07705, 2022b.
|
| 296 |
+
Yizhong Wang, Hamish Ivison, Pradeep Dasigi, Jack Hessel, Tushar Khot, Khyathi Raghavi Chandu, David Wadden, Kelsey MacMillan, Noah A Smith, Iz Beltagy, et al. How far can camels go? exploring the state of instruction tuning on open resources. arXiv preprint arXiv:2306.04751, 2023b.
|
| 297 |
+
Yue Wang, Hung Le, Akhilesh Deepak Gotmare, Nghi DQ Bui, Junnan Li, and Steven CH Hoi. Codet5 $^ +$ : Open code large language models for code understanding and generation. arXiv preprint arXiv:2305.07922, 2023c.
|
| 298 |
+
Zhiruo Wang, Grace Cuenca, Shuyan Zhou, Frank F Xu, and Graham Neubig. Mconala: a benchmark for code generation from multiple natural languages. arXiv preprint arXiv:2203.08388, 2022c.
|
| 299 |
+
Zhiruo Wang, Shuyan Zhou, Daniel Fried, and Graham Neubig. Execution-based evaluation for open-domain code generation. arXiv preprint arXiv:2212.10481, 2022d.
|
| 300 |
+
Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. Finetuned language models are zero-shot learners. International Conference on Learning Representations (ICLR), 2022. URL https://openreview.net/f orum?id ${ . } = { }$ gEZrGCozdqR.
|
| 301 |
+
Jiayi Wei, Greg Durrett, and Isil Dillig. Coeditor: Leveraging contextual changes for multi-round code auto-editing. arXiv preprint arXiv:2305.18584, 2023.
|
| 302 |
+
Minghao Wu and Alham Fikri Aji. Style over substance: Evaluation biases for large language models. arXiv preprint arXiv:2307.03025, 2023.
|
| 303 |
+
Chunqiu Steven Xia and Lingming Zhang. Conversational automated program repair. arXiv preprint arXiv:2301.13246, 2023.
|
| 304 |
+
Mengzhou Xia, Mikel Artetxe, Chunting Zhou, Xi Victoria Lin, Ramakanth Pasunuru, Danqi Chen, Luke Zettlemoyer, and Ves Stoyanov. Training trajectories of language models across scales. arXiv preprint arXiv:2212.09803, 2022.
|
| 305 |
+
Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. Wizardlm: Empowering large language models to follow complex instructions. arXiv preprint arXiv:2304.12244, 2023a.
|
| 306 |
+
Frank F Xu, Uri Alon, Graham Neubig, and Vincent Josua Hellendoorn. A systematic evaluation of large language models of code. In Proceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming, pp. 1–10, 2022a.
|
| 307 |
+
Shengbin Xu, Yuan Yao, Feng Xu, Tianxiao Gu, and Hanghang Tong. Combining code context and fine-grained code difference for commit message generation. In Proceedings of the 13th Asia-Pacific Symposium on Internetware, pp. 242–251, 2022b.
|
| 308 |
+
Zhiyang Xu, Ying Shen, and Lifu Huang. Multiinstruct: Improving multi-modal zero-shot learning via instruction tuning, 2023b.
|
| 309 |
+
Michihiro Yasunaga and Percy Liang. Break-it-fix-it: Unsupervised learning for program repair. In International Conference on Machine Learning, pp. 11941–11952. PMLR, 2021.
|
| 310 |
+
He Ye, Matias Martinez, Thomas Durieux, and Martin Monperrus. A comprehensive study of automatic program repair on the quixbugs benchmark. Journal of Systems and Software, 171: 110825, 2021.
|
| 311 |
+
Burak Yetistiren, Isik Ozsoy, and Eray Tuzun. Assessing the quality of github copilot’s code generation. In Proceedings of the 18th International Conference on Predictive Models and Data Analytics in Software Engineering, pp. 62–71, 2022.
|
| 312 |
+
Pengcheng Yin, Bowen Deng, Edgar Chen, Bogdan Vasilescu, and Graham Neubig. Learning to mine aligned code and natural language pairs from stack overflow. In International Conference on Mining Software Repositories, MSR, pp. 476–486. ACM, 2018. doi: https://doi.org/10.1145/3196 398.3196408.
|
| 313 |
+
Zheng-Xin Yong, Hailey Schoelkopf, Niklas Muennighoff, Alham Fikri Aji, David Ifeoluwa Adelani, Khalid Almubarak, M Saiful Bari, Lintang Sutawika, Jungo Kasai, Ahmed Baruwa, et al. Bloom+ 1: Adding language support to bloom for zero-shot prompting. arXiv preprint arXiv:2212.09535, 2022.
|
| 314 |
+
Hao Yu, Bo Shen, Dezhi Ran, Jiaxin Zhang, Qi Zhang, Yuchi Ma, Guangtai Liang, Ying Li, Tao Xie, and Qianxiang Wang. Codereval: A benchmark of pragmatic code generation with generative pre-trained models. arXiv preprint arXiv:2302.00288, 2023.
|
| 315 |
+
Yan Zeng, Hanbo Zhang, Jiani Zheng, Jiangnan Xia, Guoqiang Wei, Yang Wei, Yuchen Zhang, and Tao Kong. What matters in training a gpt4-style language model with multimodal inputs? arXiv preprint arXiv:2307.02469, 2023.
|
| 316 |
+
Chunyan Zhang, Junchao Wang, Qinglei Zhou, Ting Xu, Ke Tang, Hairen Gui, and Fudong Liu. A survey of automatic source code summarization. Symmetry, 14(3):471, 2022a.
|
| 317 |
+
Fengji Zhang, Bei Chen, Yue Zhang, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, and Weizhu Chen. Repocoder: Repository-level code completion through iterative retrieval and generation. arXiv preprint arXiv:2303.12570, 2023a.
|
| 318 |
+
Hang Zhang, Xin Li, and Lidong Bing. Video-llama: An instruction-tuned audio-visual language model for video understanding. arXiv preprint arXiv:2306.02858, 2023b.
|
| 319 |
+
Jialu Zhang, José Cambronero, Sumit Gulwani, Vu Le, Ruzica Piskac, Gustavo Soares, and Gust Verbruggen. Repairing bugs in python assignments using large language models. arXiv preprint arXiv:2209.14876, 2022b.
|
| 320 |
+
Jiyang Zhang, Sheena Panthaplackel, Pengyu Nie, Junyi Jessy Li, and Milos Gligoric. Coditt5: Pretraining for source code and natural language editing. In 37th IEEE/ACM International Conference on Automated Software Engineering, pp. 1–12, 2022c.
|
| 321 |
+
Tianyi Zhang, Tao Yu, Tatsunori Hashimoto, Mike Lewis, Wen-tau Yih, Daniel Fried, and Sida Wang. Coder reviewer reranking for code generation. In International Conference on Machine Learning, pp. 41832–41846. PMLR, 2023c.
|
| 322 |
+
Qinkai Zheng, Xiao Xia, Xu Zou, Yuxiao Dong, Shan Wang, Yufei Xue, Zihan Wang, Lei Shen, Andi Wang, Yang Li, et al. Codegeex: A pre-trained model for code generation with multilingual evaluations on humaneval-x. arXiv preprint arXiv:2303.17568, 2023.
|
| 323 |
+
Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206, 2023a.
|
| 324 |
+
Shuyan Zhou, Uri Alon, Sumit Agarwal, and Graham Neubig. Codebertscore: Evaluating code generation with pretrained models of code. arXiv preprint arXiv:2302.05527, 2023b.
|
| 325 |
+
Yongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster, Silviu Pitis, Harris Chan, and Jimmy Ba. Large language models are human-level prompt engineers. arXiv preprint arXiv:2211.01910, 2022.
|
| 326 |
+
Ming Zhu, Aneesh Jain, Karthik Suresh, Roshan Ravindran, Sindhu Tipirneni, and Chandan K Reddy. Xlcost: A benchmark dataset for cross-lingual code intelligence. arXiv preprint arXiv:2206.08474, 2022.
|
| 327 |
+
Terry Yue Zhuo. Large language models are state-of-the-art evaluators of code generation. arXiv preprint arXiv:2304.14317, 2023.
|
| 328 |
+
Terry Yue Zhuo, Armel Zebaze, Nitchakarn Suppattarachai, Leandro von Werra, Harm de Vries, Qian Liu, and Niklas Muennighoff. Astraios: Parameter-efficient instruction tuning code large language models. arXiv preprint arXiv:2401.00788, 2024.
|
md/test/rp5vfyp5Np/rp5vfyp5Np.md
ADDED
|
@@ -0,0 +1,543 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BATTLE: TOWARDS BEHAVIOR-ORIENTED ADVERSARIAL ATTACKS AGAINST DEEP REINFORCEMENT LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Evaluating the performance of deep reinforcement learning (DRL) agents under adversarial attacks that aim to induce specific behaviors, i.e., behavior-oriented adversarial attacks, is crucial for understanding the robustness of DRL agents. Prior research primarily focuses on directing agents towards pre-determined states or policies, lacking generality and flexibility. Therefore, it is important to devise universal attacks that target inducing specific behaviors in a victim. In this work, we propose BATTLE, a universal behavior-oriented adversarial attack method. In BATTLE, an intention policy is trained to align with human preferences for flexible behavior orientation, while the adversary is trained to guide the victim policy to imitate the intention policy. To improve the attack performance, we introduce a weighting function that assigns importance weights over each state. Our empirical results over several manipulation tasks of Meta-world show the superiority of BATTLE in behavior-oriented adversarial attack settings, outperforming current adversarial attack algorithms. Furthermore, we also demonstrate that BATTLE can improve the robustness of agents under strong attacks by training with adversary. Lastly, we showcase the strong behavior-inducing capability of BATTLE by guiding Decision Transformer agents to act in line with human preferences across various MuJoCo tasks. Our videos are available in https://sites.google.com/ view/jj9uxjgmba5lr3g.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Reinforcement learning (RL) (Sutton & Barto, 2018) combined with deep neural networks (DNN) (LeCun et al., 2015) shows extraordinary capabilities of allowing agents to master complex behaviors in various domains. However, recent findings (Huang et al., 2017; Pattanaik et al., 2018; Zhang et al., 2020) reveal that well-trained RL agents parameterized by DNN suffer from vulnerability against test-time attacks, raising concerns in high-risk or safety-critical situations. To understand adversarial attacks on learning algorithms and enhance the robustness of DRL agents, it is crucial to evaluate the performance of the agents under any potential adversarial attacks with certain constraints. In other words, identifying a universal and strong adversary is essential.
|
| 12 |
+
|
| 13 |
+
Two main challenges persist in devising effective universal and strong attacks. Firstly, existing strategies, which primarily aim at diminishing cumulative rewards, fall short in specifying explicit attack targets. Prior research (Zhang et al., 2020; 2021; Sun et al., 2022) considers training strong adversary by perturbing state observations of victim to obtain the worst case expected return. Nevertheless, it might be more practical to setup both a reward function and constraints, rather than encoding the complex safety requirements directly into rewards (Achiam et al., 2017; Gu et al., 2022; Vamplew et al., 2022), for many applications of RL. Therefore, only quantifying the decrease in cumulative reward can be too generic and result in limited attack performance when adversaries target specific safety attacks. Consider the scenario depicted in Figure 1, where a robot is tasked with collecting coins. Previous attack methods aim at inducing the robot away from the coins by minimizing the expected return. In contrast, it might be interested in causing specific unsafe behaviors, such as inducing the robot to collide with a bomb. Secondly, Predefined targets are usually rigid and inefficient. Another line of work (Hussenot et al., 2019a; Lin et al., 2017b) primarily focuses on misleading the agent towards a predetermined goal state or target policy, overlooking specific behaviors. Additionally, the difficulty and expense of providing a well-designed targeted policy result in these methods lacking generality and flexibility. In a broader sense, these adversarial attacks are incapable of controlling the behaviors of agents as a form of universal attack.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: An example illustrating the distinction between our approach and generic attacks.
|
| 17 |
+
|
| 18 |
+
To tackle these challenges, we present a novel adversarial attack method, namely BATTLE, which focuses on Behavior-oriented Adversarial aTTacks against deep rEinforcement learning agents. At its core, BATTLE employs an adversary to perturb the victim agent’s observations while leveraging an intention policy for step-by-step guidance for the victim to imitate. Instead of relying on a predefined target policy, the intention policy is trained to align with human intent as a flexible behavior orientation during adversary training. Furthermore, we incorporate a weighting function to capture remarkable moments through state re-weighting, improving overall performance and efficiency. Benefiting from recent progress in preference-based reinforcement learning (PbRL) (Lee et al., 2021a; Park et al., 2022; Liang et al., 2022; Liu et al., 2022), our method facilitates the behavior of victim agent to be aligned with human intentions. Consequently, BATTLE’s adversary effectively leads the victim into executing human-desired behaviors through iterative refinement.
|
| 19 |
+
|
| 20 |
+
In summary, our contributions fall into four categories. Firstly, we propose a universal behaviororiented adversarial attack method against DRL agents, designed to effectively induce specific behaviors in a victim agent. Secondly, we theoretically analyze BATTLE and provide a convergence guarantee under only mild conditions. Thirdly, we test in multiple scenarios and experiments on Meta-world that demonstrate BATTLE outperforms the baselines by a large margin. Empirical results demonstrate that both online and offline RL agents are vulnerable to our proposed adversarial attacks, including the most recent Decision Transformer. Finally, we considerably enhance the robustness of DRL agents by learning with BATTLE attacker in adversarial training.
|
| 21 |
+
|
| 22 |
+
# 2 RELATED WORK
|
| 23 |
+
|
| 24 |
+
Previous works on adversarial attacks study the vulnerability of a DRL agent. Huang et al. (2017) computes adversarial perturbations via utilizing the technique of FGSM (Goodfellow et al., 2015) to mislead the victim policy, not to choose the optimal action. Pattanaik et al. (2018) presents an approach that leads the victim to select the worst action based on the Q-function of the victim. Gleave et al. (2020) conducts adversarial attacks under the two-player Markov game instead of perturbing the agent’s observation. Zhang et al. (2020) proposes the state-adversarial MDP (SA-MDP) and develops two adversarial attack methods named Robust Sarsa (RS) and Maximal Action Difference (MAD). SA-RL (Zhang et al., 2021) directly optimizes the adversary to perturb state in the form of end-to-end RL. PA-AD (Sun et al., 2022) designs an RL-based “director” to find the optimal policy perturbing direction and construct an optimized-based “actor” to craft perturbed states according to the given direction. While untargeted adversarial attacks aim to cause the victim policy to fail, our method emphasizes manipulating the behaviors of the victim. In other words, the perturbed behaviors of the victim align with the manipulator’s preferences. Another line of works (Pinto et al., 2017; Mandlekar et al., 2017; Pattanaik et al., 2018) consider using adversarial examples to improve the robustness of policies, although it is out of the scope of this paper.
|
| 25 |
+
|
| 26 |
+
There are a few prior works that focus on inducing DRL agents to pre-determined states or policies. Lin et al. (2017a) first proposes a targeted adversarial attack method against DRL agents, which attacks the agent to reach a targeted state. Buddareddygari et al. (2022) also present a strategy to mislead the agent towards to a specific state by placing an object in the environment. The hijacking attack (Boloor et al., 2020) is proposed to attack agents to perform targeted actions on autonomous driving systems. Hussenot et al. (2019b) provides a new perspective that attacks the agent to imitate a target policy. Lee et al. (2021b) investigates targeted adversarial attacks against the action space of the agent. Our method differs that we train an intention policy to serve as flexible behavior orientation, rather than relying on a predetermined target state or policy. Consequently, BATTLE can effectively lead the victim policy to perform human desired behaviors.
|
| 27 |
+
|
| 28 |
+
Training agents with human feedback has been investigated in several works. PbRL provides an effective way to utilize human preferences for agent learning. Christiano et al. (2017) proposes a basic learning framework for PbRL. To further improve feedback efficiency, Ibarz et al. (2018) additionally utilizes expert demonstrations to initialize the policy besides learning the reward model from human preferences. However, previous methods need plenty of human feedback, which is usually impractical. Many recent works have proposed to tackle this problem. Lee et al. (2021a) presents a feedbackefficient PbRL algorithm, which benefits from unsupervised exploration and reward relabeling. Park et al. (2022) further improves feedback efficiency by semi-supervised reward learning and data augmentation, while Liang et al. (2022) proposes an intrinsic reward to enhance exploration. Liu et al. (2022) continues to improve the feedback efficiency by aligning the Q-function with human preferences. To the best of our knowledge, our method is the first to conduct a behavior-oriented adversarial attack against DRL agents through PbRL.
|
| 29 |
+
|
| 30 |
+
# 3 PROBLEM SETUP
|
| 31 |
+
|
| 32 |
+
The Victim Policy. In RL, agent learning can be modeled as a finite horizon Markov Decision Process (MDP) defined as a tuple $( S , { \mathcal { A } } , { \mathcal { R } } , { \mathcal { P } } , \gamma )$ . $s$ and $\mathcal { A }$ denote state and action space, respectively. $\mathcal { R } : \mathcal { S } { \times } \mathcal { A } { \times } \mathcal { S } \mathbb { R }$ is the reward function and $\gamma \in ( 0 , 1 )$ is the discount factor. $\mathcal { P } : \bar { \mathcal { S } } { \times } \bar { \mathcal { A } } { \times } \bar { \mathcal { S } } [ 0 , \bar { 1 } ]$ denotes the transition dynamics, which determines the probability of transferring to $\mathbf { s } ^ { \prime }$ given state s and action a. We denote the stationary policy $\pi _ { \nu } : { \mathcal { S } } \to { \mathcal { P } } ( { \mathcal { A } } )$ , where $\nu$ are parameters of the victim. We suppose the victim policy is fixed and uses the approximator.
|
| 33 |
+
|
| 34 |
+
The Adversarial Policy. To study behavior-oriented adversarial attack with human preferences, we formulate it as rewarded state-adversarial Markov Decision Process (RSA-MDP). Formally, a RSA-MDP is a tuple $( S , { \mathcal { A } } , B , { \widehat { \mathcal { R } } } , { \mathcal { P } } , \gamma )$ . The adversary $\pi _ { \alpha } : S \to { \mathcal { P } } ( S )$ perturbs the states before the victim observes them, where $\alpha$ are parameters of the adversary. The adversary perturbs the state s into ˜s restricted by $B ( \mathbf { s } )$ (i.e., $\tilde { \mathbf { s } } \in B ( \mathbf { s } ) .$ ). $B ( \mathbf { s } )$ is defined as a small set $\big \{ \tilde { \mathbf { s } } \in \mathcal { S } : \| \mathbf { s } - \tilde { \mathbf { s } } \| _ { p } \leq \epsilon \big \}$ , which limits the attack power of the adversary and $\epsilon$ is attack budget. Since directly generating $\tilde { \mathbf { s } } \in B ( \mathbf { s } )$ is hard, the adversary learns to produce a Gaussian noise $\Delta$ with $\ell _ { \infty } ( \Delta )$ less than 1, and we obtain the perturbed state through $\tilde { \mathbf { s } } = \mathbf { s } + \Delta * \boldsymbol { \epsilon }$ . The victim takes action according to the observed ˜s, while true states in the environment are not changed. $\pi _ { \nu \circ \alpha }$ denotes the perturbed policy, which is victim policy under the adversarial attack. Unlike SA-MDP (Zhang et al., 2020), RSA-MDP introduces $\widehat { \mathcal { R } }$ , which learns from human preferences. The target of RSA-MDP is to solve the optimal adversary $\pi _ { \alpha } ^ { * }$ , which enables the victim to achieve the maximum cumulative reward (i.e., from $\widehat { \mathcal { R } }$ ) over all states. Lemma C.1 shows that solving the optimal adversary in RSA-MDP is equivalent to finding the optimal policy in MDP $\hat { \mathcal { M } } = ( S , \bar { \mathcal { A } } , \widehat { \mathcal { R } } , \bar { \mathcal { P } } , \gamma )$ , where $\hat { \cal A } = { \cal S }$ and $\widehat { \mathcal P }$ is the transition dynamics of the adversary.
|
| 35 |
+
|
| 36 |
+
# 4 METHOD
|
| 37 |
+
|
| 38 |
+
In this section, we introduce our method BATTLE. The core idea of BATTLE is twofold: firstly, it learns an intention policy that acts as the learning target for the adversarial policy, effectively guiding the victim towards behaving human-desired behavior. Secondly, we introduce a weighting function to enhance the adversary’s performance and formulate BATTLE as a bi-level optimization problem. The framework of BATTLE is shown in Figure 2 and detailed procedure is summarized in Appendix A.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Overview of BATTLE. BATTLE jointly learns an intention policy $\pi _ { \theta }$ , an adversary $\pi _ { \alpha }$ and a weighting function $h _ { \omega }$ under bi-level optimization framework. In the inner-level, the adversary is optimized such that $\pi _ { \nu \circ \alpha }$ approaches the intention policy which learns via PbRL. In the outer-level, the weighting function is updated to improve the performance of the adversary evaluated by the outer loss $J _ { \pi }$ . $\pi _ { \nu \circ \alpha }$ denotes the perturbed policy, which is victim policy under the adversarial attack.
|
| 42 |
+
|
| 43 |
+
# 4.1 LEARNING INTENTION POLICY
|
| 44 |
+
|
| 45 |
+
BATTLE aims to find the optimal adversary that manipulates the victim’s behaviors to be consistent with human intentions. However, the victim policy is pre-trained for a specific task, directly learning an adversary suffer from exploration problem caused by the restriction of victim policy, making it hard to find an optimal adversary efficiently. Therefore, we introduce an intention policy $\pi _ { \theta }$ which has unrestricted exploration space to guide adversarial policy training.
|
| 46 |
+
|
| 47 |
+
To conduct targeted attack and avoid reward engineering, we align the intention policy with human intent via PbRL, which is shown in Figure 3. In PbRL, the agent have no access to the ground-truth reward function. Humans provide preference labels between two agent trajectories and the reward function $\widehat { r } _ { \psi }$ learns to align bwith the preferences (Christiano et al., 2017).
|
| 48 |
+
|
| 49 |
+
Formally, a segment $\sigma$ of length $k$ is denoted as a sequence of states and actions $\left\{ \mathbf { s } _ { t + 1 } , \mathbf { a } _ { t + 1 } , \cdot \cdot \cdot , \mathbf { s } _ { t + k } , \mathbf { a } _ { t + k } \right\}$ . Given a pair of segments $( \sigma ^ { 0 } , \sigma ^ { 1 } )$ , human indicate which segment is preferred, where $y ~ \in ~ \{ ( 0 , 1 ) , ( 1 , 0 ) , ( 0 . 5 , 0 . 5 ) \}$ . Following Bradley-Terry model (Bradley & Terry, 1952), a preference predictor is constructed in (1):
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Figure 3: Diagram of preference-based RL.
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
P _ { \psi } [ \sigma ^ { 0 } \succ \sigma ^ { 1 } ] = \frac { \exp { \sum _ { t } { \widehat r _ { \psi } } ( \mathbf { s } _ { t } ^ { 0 } , \mathbf { a } _ { t } ^ { 0 } ) } } { \sum _ { i \in \{ 0 , 1 \} } \exp { \sum _ { t } { \widehat r _ { \psi } } ( \mathbf { s } _ { t } ^ { i } , \mathbf { a } _ { t } ^ { i } ) } } ,
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $\sigma ^ { 0 } \succ \sigma ^ { 1 }$ denotes $\sigma ^ { 0 }$ is preferred to $\sigma ^ { 1 }$ . This predictor indicates the probability that a segment is preferred is proportional to its exponential return. Then, the reward function is optimized by aligning the predicted preference labels with human preferences through cross-entropy loss:
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\mathcal { L } ( \psi ) = - \underset { ( \sigma ^ { 0 } , \sigma ^ { 1 } , y ) \sim \mathcal { D } } { \mathbb { E } } \Big [ y ( 0 ) \log P _ { \psi } [ \sigma ^ { 0 } \succ \sigma ^ { 1 } ] + y ( 1 ) \log P _ { \psi } [ \sigma ^ { 1 } \succ \sigma ^ { 0 } ] \Big ] ,
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
where $\mathcal { D }$ is a dataset of triplets $( \sigma ^ { 0 } , \sigma ^ { 1 } , y )$ consisting of segment pairs and human preference labels. By minimizing (2), we obtain a reward function estimator $\widehat { r } _ { \psi }$ , which is used to provide estimated brewards for agent learning via any RL algorithms. Following PEBBLE (Lee et al., 2021a), we use an off-policy actor-critic method SAC (Haarnoja et al., 2018) to learn a well-performing policy. Specifically, the Q-function $Q _ { \phi }$ is optimized by minimizing the Bellman residual:
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
J _ { Q } ( \phi ) = \underset { \tau _ { t } \sim \mathcal { B } } { \mathbb { E } } \left[ \left( Q _ { \phi } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) - \widehat { r } _ { t } - \gamma \bar { V } ( \mathbf { s } _ { t + 1 } ) \right) ^ { 2 } \right] ,
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
where $\begin{array} { r } { \bar { V } ( \mathbf { s } _ { t } ) = \mathbb { E } _ { \mathbf { a } _ { t } \sim \pi _ { \theta } } \left[ Q _ { \bar { \phi } } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) - \mu \log \pi _ { \theta } ( \mathbf { a } _ { t } | \mathbf { s } _ { t } ) \right] , \tau _ { t } = ( \mathbf { s } _ { t } , \mathbf { a } _ { t } , \widehat { r } _ { t } , \mathbf { s } _ { t + 1 } ) . } \end{array}$ is the transition at time step $t , \bar { \phi }$ is the parameter of the target soft Q-function. The policy $\pi _ { \theta }$ is updated by minimizing (4):
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
J _ { \pi } ( \theta ) = \mathbb { E } _ { \mathbf { s } _ { t } \sim \mathcal { B } , \mathbf { a } _ { t } \sim \pi _ { \theta } } \Big [ \mu \log \pi _ { \theta } ( \mathbf { a } _ { t } | \mathbf { s } _ { t } ) - Q _ { \phi } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) \Big ] ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where $\mu$ is the temperature parameter. By learning an intention policy, BATTLE tackles restricted exploration problem and provides an attack target for the following adversary training.
|
| 77 |
+
|
| 78 |
+
# 4.2 LEARNING ADVERSARIAL POLICY AND WEIGHTING FUNCTION
|
| 79 |
+
|
| 80 |
+
To make the victim policy perform human desired behaviors, BATTLE learns the adversary by minimizing the KL divergence between the perturbed policy $\pi _ { \nu \circ \alpha }$ and the intention policy $\pi _ { \theta }$ However, different states may have various importance to induce the victim policy to the target. To stabilize training process and improve the performance of the adversary, we introduce a weighting function $h _ { \omega }$ to re-weight states in adversary training.
|
| 81 |
+
|
| 82 |
+
We formulate BATTLE as a bi-level optimization algorithm, which alternately updates the adversarial policy $\pi _ { \alpha }$ and the weighting function $h _ { \omega }$ through inner and outer optimization. In the inner level, BATTLE optimizes parameters $\alpha$ with the importance weights outputted by a weighting function $h _ { \omega }$ , and optimizes parameters $\omega$ in the outer level according to the performance of the adversary. Intuitively, the adversary is optimized such that $\pi _ { \nu \circ \alpha }$ approaches the intention policy in the inner level, while the weighting function learns to improve the adversary performance by evaluating the performance of the adversary through a meta-level loss $J _ { \pi }$ in (7). The whole objective of BATTLE is:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\begin{array} { r l } { \underset { \omega } { \operatorname* { m i n } } } & { { } J _ { \pi } ( \alpha ( \omega ) ) , } \\ { \mathrm { s . t . } } & { { } \alpha ( \omega ) = \arg \underset { \alpha } { \operatorname* { m i n } } \mathcal { L } _ { \mathrm { a t t } } ( \alpha ; \omega , \theta ) . } \end{array}
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Inner-level Optimization: Training adversarial policy $\pi _ { \alpha }$ . In the inner-level optimization, given the intention policy $\pi _ { \theta }$ and the weighting function $h _ { \omega }$ , we hope to find the optimal adversarial policy by minimizing the re-weighted KL divergence between $\pi _ { \nu \circ \alpha }$ and $\pi _ { \theta }$ in (6):
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\mathcal { L } _ { \mathrm { a t t } } ( \alpha ; \omega , \boldsymbol { \theta } ) = \underset { \mathbf { s } \sim \boldsymbol { B } } { \mathbb { E } } \Big [ h _ { \omega } ( \mathbf { s } ) D _ { \mathrm { K L } } \left( \pi _ { \nu \circ \alpha } ( \mathbf { s } ) \parallel \pi _ { \boldsymbol { \theta } } ( \mathbf { s } ) \right) \Big ] ,
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where $h _ { \omega } ( \mathbf { s } )$ is the importance weights outputted by the weighting function $h _ { \omega }$ . Intuitively, the adversarial policy is optimized to make the perturbed policy be close to the intention policy, while $h _ { \omega }$ assigns different weights to states of various importance. With the collaborative assistance of the intention policy and the weighting function, BATTLE efficiently learns an optimal adversarial policy.
|
| 95 |
+
|
| 96 |
+
Outer-level Optimization: Training weighting function $h _ { \omega }$ . In the outer-level optimization, we need to find a precise weighting function to balance the state distribution and assign proper weights to propel adversary learning. The weighting function is trained to distinguish the importance of states by evaluating the performance of the perturbed policy. Specifically, the perturbed policy $\pi _ { \nu \circ \alpha }$ is evaluated using a policy loss in (7), which is adapted from the policy loss in (4):
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
J _ { \pi } ( \alpha ( \omega ) ) = \mathbb { E } _ { \mathbf { s } _ { t } \sim B , \mathbf { a } _ { t } \sim \pi _ { \nu \circ \alpha ( \omega ) } } \big [ \mu \log \pi _ { \nu \circ \alpha ( \omega ) } ( \mathbf { a } _ { t } | \mathbf { s } _ { t } ) - Q _ { \phi } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) \big ] ,
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
where $\alpha ( \omega )$ denotes $\alpha$ implicitly depends on $\omega$ . Therefore, BATTLE calculates the implicit derivative of $J _ { \pi } ( \alpha ( \omega ) )$ with respect to $\omega$ and finds the optimal $\omega ^ { * }$ by optimizing (7). To make it feasible, we make an approximation of $\mathrm { a r g } \operatorname* { m i n } _ { \alpha }$ with the one-step gradient update. (8) obtains an estimated arg $\operatorname* { m i n } _ { \alpha }$ with one-step updating and builds a connection between $\alpha$ and $\omega$ :
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\begin{array} { r } { \hat { \alpha } ( \omega ) \approx \alpha _ { t } - \eta _ { t } \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha ; \omega , \theta ) | _ { \alpha _ { t } } . } \end{array}
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
According to the chain rule, the gradient of the outer loss with respect to $\omega$ can be expressed as:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\begin{array} { r l } { \nabla _ { \omega } J _ { \pi } ( \alpha ( \omega ) ) | _ { \omega _ { t } } = \nabla _ { \hat { \alpha } } J _ { \pi } ( \hat { \alpha } ( \omega ) ) | _ { \hat { \alpha } _ { t } } \nabla _ { \omega } \hat { \alpha } _ { t } ( \omega ) | _ { \omega _ { t } } } & { } \\ { = \displaystyle \sum _ { \mathbf s } f ( \mathbf s ) \cdot \nabla _ { \omega } h ( \mathbf s ) | _ { \omega _ { t } } , } \end{array}
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
where $\boldsymbol { f } ( \mathbf { s } ) = - \eta _ { t } \cdot ( \nabla _ { \hat { \alpha } } J _ { \pi } ( \alpha ( \omega ) ) ) ^ { \top } \nabla _ { \alpha } D _ { \mathrm { K L } } ( \pi _ { \nu \circ \alpha } ( \mathbf { s } ) \parallel \pi _ { \boldsymbol { \theta } } ( \mathbf { s } ) )$ and detailed derivation can be found in Appendix B. The key to obtain this meta gradient is building and computing the relationship between $\alpha$ and $\omega$ . Obtaining the implicit derivative, BATTLE updates the parameters of the weighting function by taking gradient descent with outer learning rate.
|
| 115 |
+
|
| 116 |
+
In addition, we theoretically analyze the convergence of BATTLE in Theorem D.2 and D.4. In Theorem D.2, we demonstrate the convergence rate of the outer loss, i.e. the gradient of the outer loss with respect to $\omega$ will convergence to zero. Thus BATTLE learns a more powerful adversary using importance weights outputted by the optimal weighting function. In Theorem D.4, we prove the convergence of the inner loss. The inner loss of BATTLE algorithm converges to critical points under some mild conditions, which ensures the parameters of the adversary can converge to the optimal parameters. Theorems and proofs can be found in Appendix D.
|
| 117 |
+
|
| 118 |
+
# 5 EXPERIMENTS
|
| 119 |
+
|
| 120 |
+
In this section, we evaluate our method on several robotic simulated manipulation tasks from Metaworld (Yu et al., 2020) and continuous locomotion tasks from MuJoCo (Todorov et al., 2012). Specifically, our experiment contains two essential phases. In the first phase, we verify the efficacy of the proposed method through two scenarios: manipulation and opposite behaviors. Furthermore, we show the capability of our approach by fooling a popular offline RL method, Decision Transformer (Chen et al., 2021), into acting specific behaviors in the second phase. The detailed description of experiments is provided in Appendix F.
|
| 121 |
+
|
| 122 |
+
# 5.1 SETUP
|
| 123 |
+
|
| 124 |
+
Compared Methods. Random attack and two state-of-the-art evasion attack methods are used for comparison.
|
| 125 |
+
|
| 126 |
+
• Random: a baseline that samples random perturbed observations via a uniform distribution.
|
| 127 |
+
• SA-RL (Zhang et al., 2021): this method learns an adversarial policy in the form of end-to-end RL formulation.
|
| 128 |
+
• PA-AD (Sun et al., 2022): this method combines RL-based “director” and non-RL “actor” to find state perturbations, which is the state-of-the-art adversarial attack algorithm against DRL.
|
| 129 |
+
• BATTLE: our proposed method, which collaboratively learns adversarial policy and weighting function with the guidance of intention policy.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 4: Training curves of different methods on various tasks in the manipulation scenario. The solid line and shaded area denote the mean and the standard deviation of success rate, respectively, over ten runs. The blue line (our method) outperforms all the baselines in PbRL setting and even exceeds most baselines in oracle setting.
|
| 133 |
+
|
| 134 |
+
Implementation Settings. We compare BATTLE with existing state-of-the-art adversarial attack methods. To achieve fair comparison, we make simple adjustments for SA-RL and PA-AD to suit our settings in the experiments. In their original version, both of these two methods use the negative value of the reward obtained by the victim to train an adversary. We replace it with the same estimated reward function $\widehat { r } _ { \psi }$ as our method uses, which means they also learn from human preferences. bFollowing the settings in PEBBLE (Lee et al., 2021a), we use a scripted teacher that provides ground truth preference labels. More details of scripted teacher and preference collection can be found in Appendix E. For the implementation of SA-RL1 and $\mathrm { P A } { \cdot } \mathrm { A D } ^ { 2 }$ , we use the released official codebase. For fair comparison, all methods learned via PbRL are given the same number of preference labels. In the manipulation scenario, we use 9000 labels for all tasks. In the opposite behaviors scenario, we use 1000 for Window Close, 3000 for Drawer Close, 5000 for Faucet Open, Faucet Close and Window Open, 7000 for Drawer Open, Door Lock and Door Unlock. Also, to reduce the impact of PbRL, we additionally add oracle versions of SA-RL and PA-AD, which uses the ground-truth rewards of the targeted task.
|
| 135 |
+
|
| 136 |
+
We use the same experimental settings (i.e., hyper-parameters, neural networks) concerning reward learning for all methods. We quantitatively evaluate all methods by comparing the success rate of final manipulation, which is well-defined in Meta-world (Yu et al., 2020) for the opposite behaviors scenario, and we rigorously design for the manipulation scenario. As in most existing research (Zhang et al., 2020; 2021; Sun et al., 2022), we consider using state attacks with $L ^ { \infty }$ norm in our experiments, and we report the mean and standard deviation across ten runs for all experiments. We also provide detailed hyper-parameter settings, implementation details and scenario design in Appendix F.
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 5: Training curves of all methods on various tasks in the opposite behaviors scenario. The solid line and shaded area denote the mean and the standard deviation of success rate over ten runs. In this scenario, the blue line (our method) outperforms all the baselines in both PbRL setting and oracle setting, which demonstrates the effectiveness of BATTLE.
|
| 140 |
+
|
| 141 |
+
# 5.2 MANIPULATION ON DRL AGENTS
|
| 142 |
+
|
| 143 |
+
We study the efficacy of our method compared to adversarial attack algorithms, which are adapted to our setting with minimal changes. Specifically, we devise two distinct scenarios on various simulated robotic manipulation tasks. Each victim agent is well-trained for a specific manipulation task.
|
| 144 |
+
|
| 145 |
+
Scenarios on Manipulation. In this scenario, we expect the robotic arm to reach a target coordinates instead of completing the original task. Figure 4 shows the training curves of baselines and our method on eight manipulation tasks. It shows that the performance of BATTLE surpasses that of the baselines by a large margin based on preference labels. To eliminate the influence of PbRL and further demonstrate the advantages of BATTLE, we additionally train the baseline methods with the ground-truth reward function and denote them as “oracle”. We notice that the performance of SA-RL (oracle) greatly improves on several tasks over the preference-based version. However, BATTLE still outperforms SA-RL with oracle rewards on most tasks. These results demonstrate that BATTLE enables the agent to efficiently learn adversarial policy with human preferences. We also observe that PA-AD is incapable of mastering manipulation, even using the ground-truth rewards.
|
| 146 |
+
|
| 147 |
+
Scenarios on Opposite Behaviors. In the real world, robotic manipulation has good application values. Therefore, we design this scenario to quantitatively evaluate the vulnerability of these agents that masters various manipulation skills. Specifically, we expect each victim to complete the opposite task under the attack of the manipulator. For example, the victim which masters the skill of opening windows will close windows under targeted attack. As shown in Figure 5, BATTLE presents excellent performance and marginally shows obvious advantages over baseline methods on all tasks. The result again indicates that BATTLE is effective for a wide range of tasks and can efficiently learn adversarial policy with human preferences.
|
| 148 |
+
|
| 149 |
+
# 5.3 MANIPULATION ON THE POPULAR OFFLINE RL AGENTS
|
| 150 |
+
|
| 151 |
+
In this experiment, we show the vulnerability of offline RL agents and demonstrate BATTLE can fool them into acting human desired behaviors. As for the implementation, we choose some online models3 as victims, which are well-trained by official implementation with D4RL. We choose two tasks, Cheetah and Walker, using expert-level Decision Transformer agents as the victims. As shown in Figure 6, Decision Transformer shows exploitable weaknesses and is misled to perform human desired behavior instead of the original task. Under the adversarial manipulation, the Cheetah agent runs backwards quickly in Figure 6a, and does 90 degree push-up in Figure 6c. The Walker agent stands on one foot for superior balance in Figure 6b, and dances with one leg lifted in Figure 6d. The results show that BATTLE can manipulate these victims to act behaviors consistent with human preferences and embodied agents are extremely vulnerable to these well-trained adversaries. We hope this experiment can inspire future work on the robustness of offline RL agents and embodied AI.
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
Figure 6: Human desired behaviors behaved by the Decision Transformer under the attack of BATTLE.
|
| 155 |
+
|
| 156 |
+
# 5.4 ROBUST AGENTS TRAINING AND EVALUATING
|
| 157 |
+
|
| 158 |
+
An intuitive application of BATTLE lies in evaluating the robustness of a given model or enhancing an agent’s robustness through adversarial training. ATLA (Zhang et al., 2021) is a general training framework for robustness improvement, which alternately trains an agent and an adversary. Motivated by this, we introduce BATTLE-ATLA which trains an agent and a BATTLE attacker alternately. Table 1 shows that the performance of BATTLE-ATLA for a SAC agent, in comparison with state-of-the-art robust training methods. The experimental results summarize two aspects: firstly, BATTLE-ATLA significantly enhances the robustness of agents, and secondly, BATTLE can conduct stronger attacks on robust agents.
|
| 159 |
+
|
| 160 |
+
Table 1: Average episode rewards $\pm$ standard deviation of robust agents under different attack methods, and results are averaged across 100 episodes.
|
| 161 |
+
|
| 162 |
+
<table><tr><td>Task</td><td>Model</td><td>BATTLE</td><td>PA-AD</td><td>SA-RL</td><td>Average Reward</td></tr><tr><td rowspan="3">Door Lock</td><td>BATTLE-ATLA</td><td>874±444</td><td>628±486</td><td>503±120</td><td>668</td></tr><tr><td>PAAD-ATLA</td><td>491±133</td><td>483±15</td><td>517±129</td><td>497</td></tr><tr><td>SARL-ATLA</td><td>469±11</td><td>629±455</td><td>583±173</td><td>545</td></tr><tr><td rowspan="3">Door Unlock</td><td>BATTLE-ATLA</td><td>477±203</td><td>745±75</td><td>623±60</td><td>615</td></tr><tr><td>PAAD-ATLA</td><td>398±12</td><td>381±11</td><td>398±79</td><td>389</td></tr><tr><td>SARL-ATLA</td><td>393±36</td><td>377±8</td><td>385±26</td><td>385</td></tr></table>
|
| 163 |
+
|
| 164 |
+
# 5.5 ABLATION STUDY
|
| 165 |
+
|
| 166 |
+
Contribution of Each Component. We conduct additional experiments to investigate the effect of each component in BATTLE on Drawer Open, Drawer Close for the manipulation scenario and on Faucet Open, Faucet Close for the opposite behavior scenario. BATTLE contains three critical components: the weight function $h _ { \omega }$ , the intention policy $\pi _ { \theta }$ , and the combined policy. Table 2 shows that the intention policy plays an essential role in the BATTLE. As shown in Figure 7d, the intention policy can mitigate exploration difficulty caused by the restriction of victim policy and improve the exploration ability of BATTLE leading to a better adversary. We also observe that the combined policy balances the discrepancy between $\pi _ { \theta }$ and $\pi _ { \nu \circ \alpha }$ on the state distribution and improves the adversary’s performance. In addition, we can economically train the weighting function to distinguish state importance by formulating the adversary learning as a bi-level optimization. It can further improve the asymptotic performance of BATTLE. These empirical results show that key ingredients of BATTLE are fruitfully wed and contribute to the BATTLE’s success. To verify the restricted exploration problem, we visualize the exploration space of BATTLE and BATTLE without intention policy. Figure 7d shows that the intention policy significantly improve the exploration ability of BATTLE.
|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
Figure 7: (a) A visualization of the weights of trajectories of different qualities by five different policies. (b) Trajectory weights generated by the weighting function from different policies are extracted and visualized with t-SNE. (c) A heat map showing the weight distribution and the trajectory of the perturbed agent in 2D coordinates. The red point denotes the start position and the yellow star indicates the targeted position. (d) A visualization of the exploration space of BATTLE (red) and BATTLE without intention policy (blue). The green point denotes the start and the yellow star denotes the target position.
|
| 170 |
+
|
| 171 |
+
Table 2: Effects of each component. The success rate on four simulated robotic manipulation tasks from Meta-world. The results are the average success rate across five runs.
|
| 172 |
+
|
| 173 |
+
<table><tr><td>Task Type</td><td>Task</td><td>BATTLE</td><td>BATTLE w/o hw</td><td>BATTLE w/0 π0</td><td>BATTLE w/o combination</td></tr><tr><td rowspan="2">Manipulation</td><td>Drawer Cpe</td><td>99.1%</td><td>91.3%</td><td>21.7%</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>8.0%</td></tr><tr><td rowspan="2">Opposite</td><td>Faucet Open</td><td>84</td><td>9.%</td><td>1.0%</td><td>57.0%</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 174 |
+
|
| 175 |
+
Effects of the Weighting Function. To further understand the weighting function proposed in Section 4, we conduct experimental data analysis and visualization from multiple perspectives. Five perturbed policies are uniformly sampled with performance increase sequentially before BATTLE convergence. For each policy, we roll out 100 trajectories and obtain the trajectory weight vectors via the weighting function. By leveraging the technique of t-SNE (van der Maaten & Hinton, 2008), the weight vectors of different policies are visualized in Figure 7a. From the figure, we can observe clear boundaries between the trajectory weights of various policies, suggesting that the weighting function can distinguish trajectories of different qualities. In Figure 7b, the darker color indicates trajectories with higher success rates of manipulation. The result shows that the weighting function gives higher weights to better trajectories for improving the adversarial policy performance. To further illustrate the effect of the weighting function, we present a heat map of the weight distribution in 2D coordinates and annotate part of the trajectories of the perturbed policy. As Figure 7c shows, the weighting function scores the surrounding states in trajectories from the perturbed policy higher, especially in the early stage before reaching the target point.
|
| 176 |
+
|
| 177 |
+
Extensive experiments are conducted to analyze and discuss the impact of feedback amount, attack budgets on the performance of BATTLE and quality of learned reward functions in the Appendix G.
|
| 178 |
+
|
| 179 |
+
# 6 CONCLUSION
|
| 180 |
+
|
| 181 |
+
In this paper, we propose BATTLE, a behavior-oriented adversarial attack approach against DRL learners, which can manipulate the victim to perform desired behaviors of human. BATTLE involves an adversary adding imperceptible perturbations on the observations of the victim, an intention policy learned through PbRL as a flexible behavior orientation, and a weighting function to identify essential states for the efficient adversarial attack. We analyze the convergence of BATTLE and prove that BATTLE converges to critical points under some mild conditions. Empirically, we design two scenarios on several manipulation tasks of Meta-world, and the results demonstrate that BATTLE outperforms the baselines under the targeted adversarial setting. Additionally, BATTLE can enhance the robustness of agents by training with adversary. We further show embodied agents’ vulnerability by attacking Decision Transformer on some MuJoCo tasks.
|
| 182 |
+
|
| 183 |
+
# ETHICS STATEMENT
|
| 184 |
+
|
| 185 |
+
Preference-based RL provides an effective way to train agents without a carefully designed reward function. However, learning from human preferences means humans need to provide labeled data which inevitably has biases introducing systematic error. While there are possible negative impacts when malicious people attack other policies using our methods. However, our approach also makes other researchers aware of the vulnerability of policies for AI safety. Furthermore, our method might serve as a red teaming tool to evaluate DRL agents for potential unsafe behaviors.
|
| 186 |
+
|
| 187 |
+
# REPRODUCIBILITY STATEMENT
|
| 188 |
+
|
| 189 |
+
The details of experiment settings are provided in Section 4. We provide detailed proofs of theoretical analysis in Appendix D. A more detailed description and implementation setting can be found in Appendix F. Meanwhile, we present the link of our videos in the abstract and we will provide source code during rebuttal.
|
| 190 |
+
|
| 191 |
+
# REFERENCES
|
| 192 |
+
|
| 193 |
+
Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning (ICML), volume 70, pp. 22–31. PMLR, 06–11 Aug 2017.
|
| 194 |
+
Adith Boloor, Karthik Garimella, Xin He, Christopher Gill, Yevgeniy Vorobeychik, and Xuan Zhang. Attacking vision-based perception in end-to-end autonomous driving models. Journal of Systems Architecture, 110:101766, 2020.
|
| 195 |
+
Ralph Allan Bradley and Milton E. Terry. Rank analysis of incomplete block designs: I. the method of paired comparisons. Biometrika, 39(3/4):324–345, 1952.
|
| 196 |
+
Prasanth Buddareddygari, Travis Zhang, Yezhou Yang, and Yi Ren. Targeted attack on deep rl-based autonomous driving with learned visual patterns. In International Conference on Robotics and Automation (ICRA), pp. 10571–10577, 2022.
|
| 197 |
+
Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. In Advances in Neural Information Processing Systems (NeurIPS), volume 34, pp. 15084–15097. Curran Associates, Inc., 2021.
|
| 198 |
+
Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems (NeurIPS), volume 30. Curran Associates, Inc., 2017.
|
| 199 |
+
Adam Gleave, Michael Dennis, Cody Wild, Neel Kant, Sergey Levine, and Stuart Russell. Adversarial policies: Attacking deep reinforcement learning. In International Conference on Learning Representations (ICLR), 2020. URL https://openreview.net/forum?id=HJgEMpVFwB.
|
| 200 |
+
Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations (ICLR), 2015.
|
| 201 |
+
Shangding Gu, Long Yang, Yali Du, Guang Chen, Florian Walter, Jun Wang, Yaodong Yang, and Alois Knoll. A review of safe reinforcement learning: Methods, theory and applications. arXiv preprint arXiv:2205.10330, 2022.
|
| 202 |
+
Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning (ICML), volume 80, pp. 1861–1870, 2018.
|
| 203 |
+
Sandy H. Huang, Nicolas Papernot, Ian J. Goodfellow, Yan Duan, and Pieter Abbeel. Adversarial attacks on neural network policies. In International Conference on Learning Representations (ICLR), 2017.
|
| 204 |
+
Léonard Hussenot, Matthieu Geist, and Olivier Pietquin. Targeted attacks on deep reinforcement learning agents through adversarial observations. abs/1905.12282, 2019a.
|
| 205 |
+
|
| 206 |
+
Léonard Hussenot, Matthieu Geist, and Olivier Pietquin. Targeted attacks on deep reinforcement learning agents through adversarial observations. CoRR, abs/1905.12282, 2019b. URL http: //arxiv.org/abs/1905.12282.
|
| 207 |
+
|
| 208 |
+
Borja Ibarz, Jan Leike, Tobias Pohlen, Geoffrey Irving, Shane Legg, and Dario Amodei. Reward learning from human preferences and demonstrations in atari. In Advances in Neural Information Processing Systems (NeurIPS), volume 31. Curran Associates, Inc., 2018.
|
| 209 |
+
Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Model-based policy optimization. In Advances in Neural Information Processing Systems (NeurIPS), volume 32, 2019.
|
| 210 |
+
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
|
| 211 |
+
Kimin Lee, Laura M Smith, and Pieter Abbeel. Pebble: Feedback-efficient interactive reinforcement learning via relabeling experience and unsupervised pre-training. In International Conference on Machine Learning (ICML), volume 139, pp. 6152–6163, 2021a.
|
| 212 |
+
Xian Yeow Lee, Yasaman Esfandiari, Kai Liang Tan, and Soumik Sarkar. Query-based targeted action-space adversarial policies on deep reinforcement learning agents. In Proceedings of the ACM/IEEE 12th International Conference on Cyber-Physical Systems, pp. 87–97, 2021b.
|
| 213 |
+
Xinran Liang, Katherine Shu, Kimin Lee, and Pieter Abbeel. Reward uncertainty for exploration in preference-based reinforcement learning. In International Conference on Learning Representations (ICLR), 2022.
|
| 214 |
+
Yen-Chen Lin, Zhang-Wei Hong, Yuan-Hong Liao, Meng-Li Shih, Ming-Yu Liu, and Min Sun. Tactics of adversarial attack on deep reinforcement learning agents. In IJCAI, pp. 3756–3762, 2017a. URL https://doi.org/10.24963/ijcai.2017/525.
|
| 215 |
+
Yen-Chen Lin, Zhang-Wei Hong, Yuan-Hong Liao, Meng-Li Shih, Ming-Yu Liu, and Min Sun. Tactics of adversarial attack on deep reinforcement learning agents. In International Joint Conference on Artificial Intelligence (IJCAI), pp. 3756–3762, 2017b.
|
| 216 |
+
Runze Liu, Fengshuo Bai, Yali Du, and Yaodong Yang. Meta-reward-net: Implicitly differentiable reward learning for preference-based reinforcement learning. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems (NeurIPS), 2022.
|
| 217 |
+
Julien Mairal. Stochastic majorization-minimization algorithms for large-scale optimization. In Advances in Neural Information Processing Systems (NeurIPS), volume 26, 2013.
|
| 218 |
+
Ajay Mandlekar, Yuke Zhu, Animesh Garg, Li Fei-Fei, and Silvio Savarese. Adversarially robust policy learning: Active construction of physically-plausible perturbations. In International Conference on Intelligent Robots and Systems (IROS), pp. 3932–3939, 2017.
|
| 219 |
+
Yu Nesterov. Introductory lectures on convex programming, 1998.
|
| 220 |
+
Jongjin Park, Younggyo Seo, Jinwoo Shin, Honglak Lee, Pieter Abbeel, and Kimin Lee. SURF: Semi-supervised reward learning with data augmentation for feedback-efficient preference-based reinforcement learning. In International Conference on Learning Representations (ICLR), 2022.
|
| 221 |
+
Anay Pattanaik, Zhenyi Tang, Shuijing Liu, Gautham Bommannan, and Girish Chowdhary. Robust deep reinforcement learning with adversarial attacks. In International Conference on Autonomous Agents and MultiAgent Systems (AAMAS). International Foundation for Autonomous Agents and Multiagent Systems, 2018.
|
| 222 |
+
Lerrel Pinto, James Davidson, Rahul Sukthankar, and Abhinav Gupta. Robust adversarial reinforcement learning. In International Conference on Machine Learning (ICML), volume 70 of Proceedings of Machine Learning Research, pp. 2817–2826. PMLR, 06–11 Aug 2017.
|
| 223 |
+
|
| 224 |
+
Yanchao Sun, Ruijie Zheng, Yongyuan Liang, and Furong Huang. Who is the strongest enemy? towards optimal and efficient evasion attacks in deep RL. In International Conference on Learning Representations (ICLR), 2022. URL https://openreview.net/forum?id= JM2kFbJvvI.
|
| 225 |
+
|
| 226 |
+
Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
|
| 227 |
+
|
| 228 |
+
Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In International Conference on Intelligent Robots and Systems (IROS), pp. 5026–5033, 2012.
|
| 229 |
+
|
| 230 |
+
Peter Vamplew, Benjamin J Smith, Johan Källström, Gabriel Ramos, Roxana Radulescu, Diederik M ˘ Roijers, Conor F Hayes, Fredrik Heintz, Patrick Mannion, Pieter JK Libin, et al. Scalar reward is not enough: A response to silver, singh, precup and sutton (2021). Autonomous Agents and Multi-Agent Systems (AAMAS), 36(2):41, 2022.
|
| 231 |
+
|
| 232 |
+
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(86):2579–2605, 2008.
|
| 233 |
+
|
| 234 |
+
Tianhe Yu, Deirdre Quillen, Zhanpeng He, Ryan Julian, Karol Hausman, Chelsea Finn, and Sergey Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on Robot Learning (CoRL), volume 100 of Proceedings of Machine Learning Research, pp. 1094–1100. PMLR, 2020.
|
| 235 |
+
|
| 236 |
+
Huan Zhang, Hongge Chen, Chaowei Xiao, Bo Li, Mingyan Liu, Duane Boning, and Cho-Jui Hsieh. Robust deep reinforcement learning against adversarial perturbations on state observations. In Advances in Neural Information Processing Systems (NeurIPS), volume 33, pp. 21024–21037. Curran Associates, Inc., 2020.
|
| 237 |
+
|
| 238 |
+
Huan Zhang, Hongge Chen, Duane S Boning, and Cho-Jui Hsieh. Robust reinforcement learning on state observations with learned optimal adversary. In International Conference on Learning Representations (ICLR), 2021.
|
| 239 |
+
|
| 240 |
+
# A THE FULL PROCEDURE OF BATTLE
|
| 241 |
+
|
| 242 |
+
The Combined Policy. In order to address the inefficiency caused by the discrepancy between $\pi _ { \theta }$ and $\pi _ { \nu \circ \alpha }$ in the state distribution, we propose a strategy to construct the behavior policy $\pi$ for data collection in our practical implementation. Inspired by Branched rollout (Janner et al., 2019), we combine the intention policy $\pi _ { \theta }$ with the perturbed policy $\pi _ { \nu \circ \alpha }$ . Specifically, we define $\pi ^ { 1 : h } = \pi _ { \nu \circ \alpha } ^ { 1 : h }$ $\pi ^ { h + 1 : H } = \pi _ { \theta } ^ { h + 1 : \bar { H } }$ πh+1:Hθ , where h is sampled from a uniform distribution U (0, H) and H represents the task horizon. The resulting combined policy $\pi$ is responsible for data collection, which is then stored in the replay buffer during the learning process.
|
| 243 |
+
|
| 244 |
+
We present the detailed procedures of our proposed method in Algorithm 1. Our method, referred to as BATTLE, is built upon the well-established preference-based RL algorithm PEBBLE (Lee et al., 2021a).
|
| 245 |
+
|
| 246 |
+
# Algorithm 1 BATTLE
|
| 247 |
+
|
| 248 |
+
Input: a fixed victim policy $\pi _ { \nu }$ , frequency of human feedback $K$ , outer loss updating frequency $M$
|
| 249 |
+
task horizon $H$
|
| 250 |
+
1: Initialize parameters of $Q _ { \phi }$ , $\pi _ { \theta }$ , $\widehat { r } _ { \psi }$ , $\pi _ { \alpha }$ and $h _ { \omega }$
|
| 251 |
+
2: Initialize $\boldsymbol { B }$ and $\pi _ { \theta }$ bwith unsupervised exploration
|
| 252 |
+
3: Initialize preference data set $\mathcal { D } \emptyset$
|
| 253 |
+
4: for each iteration do
|
| 254 |
+
5: // Construct the combined policy $\pi$
|
| 255 |
+
6: if episode is done then
|
| 256 |
+
7: $\bar { h } \sim U ( 0 , H )$
|
| 257 |
+
8: h = π1:hν◦α and πh+1:H $\pi ^ { h + 1 : H } = \pi _ { \theta } ^ { h + 1 : H }$
|
| 258 |
+
9: end if
|
| 259 |
+
10: Take action $a _ { t } \sim \pi$ and collect $s _ { t + 1 }$
|
| 260 |
+
11: Store transition into dataset $\stackrel { } { } \stackrel { } { } \cup \big \{ \big ( s _ { t } , a _ { t } , \widehat r _ { \psi } \big ( s _ { t } \big ) , s _ { t + 1 } \big ) \big \}$
|
| 261 |
+
12: b// Query preference and Reward learning
|
| 262 |
+
13: if iteration $\%$ $K = = 0$ then
|
| 263 |
+
14: for each query step do
|
| 264 |
+
15: Sample pair of trajectories $( \sigma ^ { 0 } , \sigma ^ { 1 } )$
|
| 265 |
+
16: Query preference $_ y$ from manipulator
|
| 266 |
+
17: Store preference data into dataset ${ \mathcal { D } } { \mathcal { D } } \cup \{ ( \sigma ^ { 0 } , \sigma ^ { 1 } , y ) \}$
|
| 267 |
+
18: end for
|
| 268 |
+
19: for each gradient step do
|
| 269 |
+
20: Sample batch $\{ ( \sigma ^ { \mathrm { { 0 } } } , \sigma ^ { \mathrm { { 1 } } } , y ) _ { i } \} _ { i = 1 } ^ { n }$ from $\mathcal { D }$
|
| 270 |
+
21: Optimize (2) to update $\widehat { r } _ { \psi }$
|
| 271 |
+
22: end for
|
| 272 |
+
23: end if
|
| 273 |
+
24: // Inner loss optimization
|
| 274 |
+
25: for each gradient step do
|
| 275 |
+
26: Sample random mini-batch transitions from $\boldsymbol { B }$
|
| 276 |
+
27: Optimize $\pi _ { \alpha }$ : minimize (6) with respect to $\alpha$
|
| 277 |
+
28: end for
|
| 278 |
+
29: // Outer loss optimization
|
| 279 |
+
30: if iteration $7 o \ M = = 0$ then
|
| 280 |
+
31: Sample random mini-batch transitions from $\boldsymbol { B }$
|
| 281 |
+
32: Optimize $h _ { \omega }$ : minimize (7) with respect to $\omega$
|
| 282 |
+
33: end if
|
| 283 |
+
34: // Intention policy learning
|
| 284 |
+
35: Update $Q _ { \phi }$ and $\pi \theta$ according to (3) and (4), respectively.
|
| 285 |
+
36: end for
|
| 286 |
+
Output: adversarial policy $\pi _ { \alpha }$
|
| 287 |
+
|
| 288 |
+
# B DERIVATION OF THE GRADIENT OF THE OUTER-LEVEL LOSS
|
| 289 |
+
|
| 290 |
+
In this section, we present detailed derivation of the gradient of the outer loss $J _ { \pi }$ with respect to the parameters of the weighting function $\omega$ . According to the chain rule, we can derive that
|
| 291 |
+
|
| 292 |
+
$$
|
| 293 |
+
\begin{array} { r l } & { \quad \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } ( \omega ) ) | _ { \omega _ { t } } } \\ & { = \frac { \partial J _ { \pi } ( \hat { \alpha } ( \omega ) ) } { \partial \hat { \alpha } ( \omega ) } | _ { \hat { \alpha } _ { t } } \frac { \partial \hat { \alpha } _ { t } ( \omega ) } { \partial \omega } | _ { \omega _ { t } } } \\ & { = \frac { \partial J _ { \pi } ( \hat { \alpha } ( \omega ) ) } { \partial \hat { \alpha } ( \omega ) } | _ { \hat { \alpha } _ { t } } \frac { \partial \hat { \alpha } _ { t } ( \omega ) } { \partial h ( s ; \omega ) } | _ { \omega _ { t } } \frac { \partial h ( \mathbf { s } ; \omega ) } { \partial \omega } | _ { \omega _ { t } } } \\ & { = - \eta _ { t } \frac { \partial J _ { \pi } ( \hat { \alpha } ( \omega ) ) } { \partial \hat { \alpha } ( \omega ) } | _ { \hat { \alpha } _ { t } \underset { \mathrm { s w a x } } { \sum } } \frac { \partial D _ { \mathrm { K L } } ( \pi _ { \nu \infty } ( \mathbf { s } ) \parallel \pi _ { \theta } ( \mathbf { s } ) ) } { \partial \alpha } | _ { \alpha _ { t } } \frac { \partial h ( \mathbf { s } ; \omega ) } { \partial \omega } | _ { \omega _ { t } } } \\ & { = - \eta _ { t } \biggr [ \frac { \partial J _ { \pi } ( \hat { \alpha } ( \omega ) ) } { \partial \hat { \alpha } ( \omega ) } \Bigr | _ { \hat { \alpha } _ { t } } \frac { \partial } { \partial \hat { \alpha } } \frac { D _ { \mathrm { K L } } ( \pi _ { \nu \infty } ( \mathbf { s } ) \parallel \pi _ { \theta } ( \mathbf { s } ) ) } { \partial \alpha } \Bigr | _ { \alpha _ { t } } \biggr ) \frac { \partial h ( \mathbf { s } ; \omega ) } { \partial \omega } | _ { \omega _ { t } } . } \end{array}
|
| 294 |
+
$$
|
| 295 |
+
|
| 296 |
+
For brevity of expression, we let:
|
| 297 |
+
|
| 298 |
+
$$
|
| 299 |
+
f ( \mathbf { s } ) = \frac { \partial J _ { \pi } ( \hat { \alpha } ( \omega ) ) } { \partial \hat { \alpha } ( \omega ) } \Big \vert _ { \hat { \alpha } _ { t } } ^ { \top } \frac { \partial D _ { \mathrm { K L } } \left( \pi _ { \nu \circ \alpha } ( \mathbf { s } ) \parallel \pi _ { \theta } ( \mathbf { s } ) \right) } { \partial \hat { \alpha } } \Big \vert _ { \alpha _ { t } } .
|
| 300 |
+
$$
|
| 301 |
+
|
| 302 |
+
The gradient of outer-level optimization loss with respect to parameters $\omega$ is:
|
| 303 |
+
|
| 304 |
+
$$
|
| 305 |
+
\nabla _ { \omega } J _ { \pi } ( \hat { \alpha } ( \omega ) ) | _ { \omega _ { t } } = - \eta _ { t } \sum _ { \mathbf { s } \sim \mathcal { B } } f ( \mathbf { s } ) \cdot \frac { \partial h ( \mathbf { s } ; \omega ) } { \partial \omega } \Big | _ { \omega _ { t } } .
|
| 306 |
+
$$
|
| 307 |
+
|
| 308 |
+
# C CONNECTION BETWEEN RSA-MDP AND MDP
|
| 309 |
+
|
| 310 |
+
Lemma C.1. Given a RSA-MDP $\mathcal { M } = ( \mathcal { S } , \mathcal { A } , \mathcal { B } , \widehat { \mathcal { R } } , \mathcal { P } , \gamma )$ and a fixed victim policy $\pi _ { \nu }$ , there exists a MDP $\hat { \mathcal { M } } = ( S , \hat { \mathcal { A } } , \widehat { \mathcal { R } } , \widehat { \mathcal { P } } , \gamma )$ such that the optimal policy of $\hat { \mathcal { M } }$ is equivalent to the optimal adversary $\pi _ { \alpha }$ in RSA-MDP given a fixed victim, where $\widehat { A } = { \cal S }$ and
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
\widehat { \mathcal { P } } ( \mathbf { s } ^ { \prime } | \mathbf { s } , \mathbf { a } ) = \sum _ { \mathbf { a } \in \mathcal { A } } \pi _ { \nu } ( \mathbf { a } | \widehat { \mathbf { a } } ) \mathcal { P } ( \mathbf { s } ^ { \prime } | \mathbf { s } , \mathbf { a } ) \quad f o r \mathbf { s } , \mathbf { s } ^ { \prime } \in \mathcal { S } a n d \widehat { \mathbf { a } } \in \widehat { \mathcal { A } } .
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
D THEORETICAL ANALYSIS AND PROOFS
|
| 317 |
+
|
| 318 |
+
D.1 THEOREM 1: CONVERGENCE RATE OF THE OUTER LOSS
|
| 319 |
+
|
| 320 |
+
Lemma D.1. (Lemma 1.2.3 in Nesterov (1998)) If function $f ( x )$ is Lipschitz smooth on $\mathbb { R } ^ { n }$ with constant $L$ , then $\forall x , y \in \mathbb { R } ^ { n }$ , we have
|
| 321 |
+
|
| 322 |
+
$$
|
| 323 |
+
\left| f ( y ) - f ( x ) - f ^ { \prime } ( x ) ^ { \top } ( y - x ) \right| \leq \frac { L } { 2 } \left. y - x \right. ^ { 2 } .
|
| 324 |
+
$$
|
| 325 |
+
|
| 326 |
+
Proof. $\forall x , y \in \mathbb { R } ^ { n }$ , we have
|
| 327 |
+
|
| 328 |
+
$$
|
| 329 |
+
\begin{array} { l } { f ( y ) = f ( x ) + \displaystyle \int _ { 0 } ^ { 1 } f ^ { \prime } ( x + \tau ( y - x ) ) ^ { \top } ( y - x ) d \tau } \\ { \displaystyle \qquad = f ( x ) + f ^ { \prime } ( x ) ^ { \top } ( y - x ) + \displaystyle \int _ { 0 } ^ { 1 } [ f ^ { \prime } ( x + \tau ( y - x ) ) - f ^ { \prime } ( x ) ] ^ { \top } ( y - x ) d \tau . } \end{array}
|
| 330 |
+
$$
|
| 331 |
+
|
| 332 |
+
Then we can derive that
|
| 333 |
+
|
| 334 |
+
$$
|
| 335 |
+
\begin{array} { r l } { \displaystyle \left. f ( y ) - f ( x ) - f ^ { \prime } ( x ) ^ { \top } ( y - x ) \right. = \displaystyle \left. \int _ { 0 } ^ { 1 } [ f ^ { \prime } ( x + \tau ( y - x ) ) - f ^ { \prime } ( x ) ] ^ { \top } ( y - x ) d \tau \right. } & { } \\ { \displaystyle } & { \le \displaystyle \int _ { 0 } ^ { 1 } \left. [ f ^ { \prime } ( x + \tau ( y - x ) ) - f ^ { \prime } ( x ) ] ^ { \top } ( y - x ) \right. d \tau } \\ { \displaystyle } & { \le \displaystyle \int _ { 0 } ^ { 1 } \left. f ^ { \prime } ( x + \tau ( y - x ) ) - f ^ { \prime } ( x ) \right. \cdot \left. y - x \right. d \tau } \\ { \displaystyle } & { \le \displaystyle \int _ { 0 } ^ { 1 } \tau L \left. y - x \right. ^ { 2 } d \tau = \displaystyle \frac { L } { 2 } \left. y - x \right. ^ { 2 } , } \end{array}
|
| 336 |
+
$$
|
| 337 |
+
|
| 338 |
+
where the first inequality holds for $\begin{array} { r } { \left| \int _ { a } ^ { b } f ( x ) d x \right| \le \int _ { a } ^ { b } | f ( x ) | d x } \end{array}$ , the second inequality holds for Cauchy-Schwarz inequality, and the last inequality holds for the definition of Lipschitz smoothness.
|
| 339 |
+
|
| 340 |
+
Theorem D.2. Suppose $J _ { \pi }$ is Lipschitz-smooth with constant $L$ , the gradient of $J _ { \pi }$ and $\mathcal { L } _ { a t t }$ is bounded by $\rho$ . Let the training iterations be $T$ , the inner-level optimization learning rate $\begin{array} { r } { \eta _ { t } = \operatorname* { m i n } \{ 1 , \frac { c _ { 1 } } { T } \} } \end{array}$ for some constant $c _ { 1 } > 0$ where $\begin{array} { r } { \frac { c _ { 1 } } { T } < 1 } \end{array}$ . Let the outer-level optimization learning rate $\begin{array} { r } { \beta _ { t } = \operatorname* { m i n } \{ \frac { 1 } { L } , \frac { c _ { 2 } } { \sqrt { T } } \} } \end{array}$ for so constant $c _ { 2 } > 0$ where $\begin{array} { r } { c _ { 2 } \leq \frac { \sqrt { T } } { L } } \end{array}$ , and $\begin{array} { r } { \sum _ { t = 1 } ^ { \infty } \beta _ { t } \leq \infty , \sum _ { t = 1 } ^ { \infty } \beta _ { t } ^ { 2 } \leq \infty } \end{array}$ . The convergence $J _ { \pi }$
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\operatorname* { m i n } _ { 1 \leq t \leq T } \mathbb { E } \left[ \left\| \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \right\| ^ { 2 } \right] \leq \mathcal { O } \left( \frac { 1 } { \sqrt { T } } \right) .
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
Proof. First,
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\begin{array} { r l } & { \quad J _ { \pi } \big ( \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) \big ) - J _ { \pi } \big ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) \big ) } \\ & { = \{ J _ { \pi } \big ( \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) \big ) - J _ { \pi } \big ( \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) \big ) \} + \{ J _ { \pi } \big ( \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) \big ) - J _ { \pi } \big ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) \big ) \} . } \end{array}
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
Then we separately derive the two terms of (17). For the first term,
|
| 353 |
+
|
| 354 |
+
$$
|
| 355 |
+
\begin{array} { r l } & { \quad J _ { \pi } ( \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) ) - J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) ) } \\ & { \le \nabla _ { \hat { \alpha } } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) ) ^ { \top } ( \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) - \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) ) + \displaystyle \frac { L } { 2 } \left\| \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) - \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) \right\| ^ { 2 } } \\ & { \le \| \nabla _ { \hat { \alpha } } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) ) \| \cdot \| \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) - \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) \| + \displaystyle \frac { L } { 2 } \left\| \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) - \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) \right\| ^ { 2 } } \\ & { \le \rho \cdot \| - \eta _ { t + 1 } \nabla _ { \hat { \alpha } } \mathcal { L } _ { \mathrm { a t } } ( \hat { \alpha } _ { t + 1 } ) \| + \displaystyle \frac { L } { 2 } \left\| - \eta _ { t + 1 } \nabla _ { \hat { \alpha } } \mathcal { L } _ { \mathrm { a t } } ( \hat { \alpha } _ { t + 1 } ) \right\| ^ { 2 } } \\ & { \le \eta _ { t + 1 } \rho ^ { 2 } + \displaystyle \frac { L } { 2 } \eta _ { t + 1 } ^ { 2 } \rho ^ { 2 } , } \end{array}
|
| 356 |
+
$$
|
| 357 |
+
|
| 358 |
+
where $\hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) - \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) = - \eta _ { t + 1 } \nabla _ { \hat { \alpha } } \mathcal { L } _ { \mathrm { a t t } } ( \hat { \alpha } _ { t + 1 } )$ , the first inequality holds for Lemma D.1, the second inequality holds for Cauchy-Schwarz inequality, the third inequality holds for $\| \nabla _ { \hat { \alpha } } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) ) \| \leq \rho$ , and the last inequality holds for $\| \nabla _ { \hat { \alpha } } \mathcal { L } _ { \mathrm { a t t } } ( \hat { \alpha } _ { t + 1 } ) \| \leq \rho$ . It can be proved that the gradient of $\omega$ with respect to $J _ { \pi }$ is Lipschitz continuous and we assume the Lipschitz constant is $L$ . Therefore, for the second term,
|
| 359 |
+
|
| 360 |
+
$$
|
| 361 |
+
\begin{array} { r l } & { \quad J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t + 1 } ) ) - J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) } \\ & { \le \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) ^ { \top } ( \omega _ { t + 1 } - \omega _ { t } ) + \displaystyle \frac { L } { 2 } \left\| \omega _ { t + 1 } - \omega _ { t } \right\| ^ { 2 } } \\ & { = - \beta _ { t } \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) ^ { \top } \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) + \displaystyle \frac { L \beta _ { t } ^ { 2 } } { 2 } \left\| \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) \right\| ^ { 2 } } \\ & { = - \left( \beta _ { t } - \displaystyle \frac { L \beta _ { t } ^ { 2 } } { 2 } \right) \left\| \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) \right\| ^ { 2 } , } \end{array}
|
| 362 |
+
$$
|
| 363 |
+
|
| 364 |
+
where $\omega _ { t + 1 } - \omega _ { t } = - \beta _ { t } \nabla _ { \omega } J _ { \pi } \big ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) \big )$ , and the first inequality holds for Lemma D.1. Therefore, (17) becomes
|
| 365 |
+
|
| 366 |
+
$$
|
| 367 |
+
J _ { \pi } ( \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) ) - J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) \leq \eta _ { t + 1 } \rho ^ { 2 } + \frac { L } { 2 } \eta _ { t + 1 } ^ { 2 } \rho ^ { 2 } - ( \beta _ { t } - \frac { L \beta _ { t } ^ { 2 } } { 2 } ) \left\| \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) \right\| ^ { 2 } .
|
| 368 |
+
$$
|
| 369 |
+
|
| 370 |
+
Rearranging the terms of (20), we obtain
|
| 371 |
+
|
| 372 |
+
$$
|
| 373 |
+
( \beta _ { t } - \frac { L \beta _ { t } ^ { 2 } } { 2 } ) \left\| \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) \right\| ^ { 2 } \leq J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) - J _ { \pi } ( \hat { \alpha } _ { t + 2 } ( \omega _ { t + 1 } ) ) + \eta _ { t + 1 } \rho ^ { 2 } + \frac { L } { 2 } \eta _ { t + 1 } ^ { 2 } \rho ^ { 2 } .
|
| 374 |
+
$$
|
| 375 |
+
|
| 376 |
+
Then, we sum up both sides of (21),
|
| 377 |
+
|
| 378 |
+
$$
|
| 379 |
+
\begin{array} { r l } & { \quad \displaystyle \sum _ { t = 1 } ^ { T } ( \beta _ { t } - \frac { L \beta _ { t } ^ { 2 } } { 2 } ) \| \nabla _ { \omega } J _ { \pi } ( \hat { \alpha } _ { t + 1 } ( \omega _ { t } ) ) \| ^ { 2 } } \\ & { \leq J _ { \pi } ( \hat { \alpha } _ { 2 } ( \omega _ { 1 } ) ) - J _ { \pi } ( \hat { \alpha } _ { T + 2 } ( \omega _ { T + 1 } ) ) + \displaystyle \sum _ { t = 1 } ^ { T } ( \eta _ { t + 1 } \rho ^ { 2 } + \frac { L } { 2 } \eta _ { t + 1 } ^ { 2 } \rho ^ { 2 } ) } \\ & { \leq J _ { \pi } ( \hat { \alpha } _ { 2 } ( \omega _ { 1 } ) ) + \displaystyle \sum _ { t = 1 } ^ { T } ( \eta _ { t + 1 } \rho ^ { 2 } + \frac { L } { 2 } \eta _ { t + 1 } ^ { 2 } \rho ^ { 2 } ) . } \end{array}
|
| 380 |
+
$$
|
| 381 |
+
|
| 382 |
+
Therefore,
|
| 383 |
+
|
| 384 |
+
$$
|
| 385 |
+
\begin{array} { r l } & { \quad \underset { \leq \frac { 1 } { 2 } \leq n } { \sum \frac { \| \nabla B \| } { n } } \mathbb { E } \left[ \| \nabla _ { x } x _ { t } ( \hat { \alpha } _ { t + ( \lambda ) } ) \| ^ { 2 } \right] } \\ & { \leq \frac { \sum _ { i = 1 } ^ { n } \big ( \lambda _ { i } - \frac { B _ { i } ^ { 2 } } { 2 } \big ) \| \nabla _ { x } x _ { t } ( \hat { \alpha } _ { t + ( \lambda ) } ) \| ^ { 2 } } { \sum _ { i = 1 } ^ { n } ( \lambda _ { i } - \frac { B _ { i } ^ { 2 } } { 2 } ) } } \\ & { \leq \frac { \sum _ { i = 1 } ^ { n } \big ( \lambda _ { i } - \frac { B _ { i } ^ { 2 } } { 2 } \big ) \big ( \sum _ { i } ( \lambda _ { i } - \frac { B _ { i } ^ { 2 } } { 2 } ) \big ) } { \sum _ { i = 1 } ^ { n } ( \lambda _ { i } ) } \Bigg [ 2 ( \lambda _ { i } + \frac { B _ { i } ^ { 2 } } { 2 } ) + \lambda _ { i } ^ { 2 } u _ { i + ( \lambda ) } ^ { 2 } } \\ & { \leq \frac { 1 } { \sum _ { i = 1 } ^ { n } ( \lambda _ { i } ) } \Bigg [ 2 ( \lambda _ { i } + \frac { B _ { i } ^ { 2 } } { 2 } ) \Bigg ] } \\ & { \leq \frac { 1 } { \sum _ { i = 1 } ^ { n } \lambda _ { i } } \Bigg [ 2 ( \lambda _ { i } + \frac { B _ { i } ^ { 2 } } { 2 } ) + \lambda _ { i } ^ { 2 } u _ { i + ( \lambda ) } ^ { 2 } + \lambda _ { i + ( \lambda ) } ^ { 2 } \Bigg ] } \\ & { \leq \frac { 1 } { \sum _ { i = 1 } ^ { n } \lambda _ { i } } \Bigg [ 2 ( \lambda _ { i } ( \alpha _ { t + ( \lambda ) } ) + \mathcal { T } _ { 1 1 } + u ^ { 2 } ) + 2 \lambda _ { i } \Bigg ] } \\ & { \quad - 2 \int _ { \lambda } ( \alpha _ { t + ( \lambda ) } ) + \frac { \beta _ { t } \beta _ { t } ^ { 2 } ( 2 \lambda _ { t } ) } { \delta _ { t } \lambda _ { t } } } \\ & \quad - 2 \int _ { \lambda } ( \lambda _ { i } ^ { 2 } ) + \frac \beta _ { t } \beta _ { t } ^ { 2 } ( 2 \lambda _ { t } \end{array}
|
| 386 |
+
$$
|
| 387 |
+
|
| 388 |
+
$\begin{array} { r } { \sum _ { t = 1 } ^ { T } \left( 2 \beta _ { t } - L \beta _ { t } ^ { 2 } \right) \geq \sum _ { t = 1 } ^ { \hat { T } } \beta _ { t } } \end{array}$ holds according to (22), the third inequality holds for.
|
| 389 |
+
|
| 390 |
+
# D.2 THEOREM 2: CONVERGENCE OF THE INNER LOSS
|
| 391 |
+
|
| 392 |
+
a D.3. (Les such thsuch that (2013)) Let diverges, thThen, the seq $( a _ { n } ) _ { n \geq 1 } , ( b _ { n } ) _ { n \geq 1 }$ e two nconvergerges to n-negative real se-s, and there exists. $\textstyle \sum _ { n = 1 } ^ { \infty } a _ { n }$ $\textstyle \sum _ { n = 1 } ^ { \infty } { \bar { a _ { n } } } b _ { n }$ $C > 0$ $| b _ { n + 1 } - b _ { n } | \leq { \bar { C } } { \bar { a } } _ { n }$ $\left( b _ { n } \right) _ { n \geq 1 }$ $O$
|
| 393 |
+
|
| 394 |
+
Theorem D.4. Suppose $J _ { \pi }$ is Lipschitz-smooth with constant $L ,$ , the gradient of $J _ { \pi }$ and $\mathcal { L } _ { a t t }$ is bounded by $\rho$ . Let the training iterations be $T$ , the inner-level optimization learning rate $\begin{array} { r } { \eta _ { t } = \operatorname* { m i n } \{ 1 , \frac { c _ { 1 } } { T } \} } \end{array}$ for some constant $c _ { 1 } > 0$ where $\begin{array} { r } { \frac { c _ { 1 } } { T } < 1 } \end{array}$ . Let the outer-level optimization learning rate $\begin{array} { r } { \beta _ { t } = \operatorname* { m i n } \{ \frac { 1 } { L } , \frac { c _ { 2 } } { \sqrt { T } } \} } \end{array}$ for some constant $c _ { 2 } > 0$ where $\begin{array} { r } { c _ { 2 } \leq \frac { \sqrt { T } } { L } } \end{array}$ , and $\begin{array} { r } { \sum _ { t = 1 } ^ { \infty } \beta _ { t } \leq \infty , \sum _ { t = 1 } ^ { \infty } \beta _ { t } ^ { 2 } \leq \infty } \end{array}$ . $\mathcal { L } _ { a t t }$ achieves
|
| 395 |
+
|
| 396 |
+
$$
|
| 397 |
+
\operatorname* { l i m } _ { t \to \infty } \mathbb { E } \left[ \left\| \nabla _ { \alpha } \mathcal { L } _ { a t t } ( \alpha _ { t } ; \omega _ { t } ) \right\| ^ { 2 } \right] = 0 .
|
| 398 |
+
$$
|
| 399 |
+
|
| 400 |
+
Proof. First,
|
| 401 |
+
|
| 402 |
+
$$
|
| 403 |
+
\begin{array} { r l } & { \quad \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) - \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) } \\ & { = \{ \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) - \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) \} + \{ \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) - \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \} . } \end{array}
|
| 404 |
+
$$
|
| 405 |
+
|
| 406 |
+
For the first term in (25),
|
| 407 |
+
|
| 408 |
+
$$
|
| 409 |
+
\begin{array} { r l } & { \quad \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) - \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) } \\ & { \leq \nabla _ { \omega } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) ^ { \top } ( \omega _ { t + 1 } - \omega _ { t } ) + \displaystyle \frac { L } { 2 } \left\| \omega _ { t + 1 } - \omega _ { t } \right\| ^ { 2 } } \\ & { = - \beta _ { t } \nabla _ { \omega } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) ^ { \top } \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) + \displaystyle \frac { L \beta _ { t } ^ { 2 } } { 2 } \left\| \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \right\| ^ { 2 } . } \end{array}
|
| 410 |
+
$$
|
| 411 |
+
|
| 412 |
+
where $\omega _ { t + 1 } - \omega _ { t } = - \beta _ { t } \nabla _ { \omega } J _ { \pi } \big ( \alpha _ { t + 1 } ( \omega _ { t } ) \big )$ , and the first inequality holds according to Lemma D.1. For the second term in (25),
|
| 413 |
+
|
| 414 |
+
$$
|
| 415 |
+
\begin{array} { r l } & { \quad \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) - \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) } \\ & { \le \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) ^ { \top } ( \alpha _ { t + 1 } - \alpha _ { t } ) + \displaystyle \frac { L } { 2 } \| \alpha _ { t + 1 } - \alpha _ { t } \| ^ { 2 } } \\ & { = - \eta _ { t } \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) ^ { \top } \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) + \displaystyle \frac { L \eta _ { t } ^ { 2 } } { 2 } \| \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \| ^ { 2 } } \\ & { = - ( \eta _ { t } - \frac { L \eta _ { t } ^ { 2 } } { 2 } ) \| \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \| ^ { 2 } . } \end{array}
|
| 416 |
+
$$
|
| 417 |
+
|
| 418 |
+
where $\alpha _ { t + 1 } - \alpha _ { t } = - \eta _ { t } \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } )$ , and the first inequality holds according to Lemma (D.1). Therefore, (25) becomes
|
| 419 |
+
|
| 420 |
+
$$
|
| 421 |
+
\begin{array} { r l } & { \quad \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) - \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) } \\ & { \leq - \beta _ { t } \nabla _ { \omega } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) ^ { \top } \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) + \frac { L \beta _ { t } ^ { 2 } } { 2 } \left\| \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \right\| ^ { 2 } } \\ & { \quad - \left( \eta _ { t } - \frac { L \eta _ { t } ^ { 2 } } { 2 } \right) \left\| \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \right\| ^ { 2 } . } \end{array}
|
| 422 |
+
$$
|
| 423 |
+
|
| 424 |
+
Taking expectation of both sides of (28) and rearranging the terms, we obtain
|
| 425 |
+
|
| 426 |
+
$$
|
| 427 |
+
\begin{array} { r l } & { \quad \eta _ { t } \mathbb { E } \left[ \left\| \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \right\| ^ { 2 } \right] + \beta _ { t } \mathbb { E } \left[ \left\| \nabla _ { \omega } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) \right\| \cdot \left\| \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \right\| \right] } \\ & { \leq \mathbb { E } \left[ \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \right] - \mathbb { E } \left[ \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) \right] + \frac { L \beta _ { t } ^ { 2 } } { 2 } \mathbb { E } \left[ \left\| \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \right\| ^ { 2 } \right] } \\ & { \quad + \frac { L \eta _ { t } ^ { 2 } } { 2 } \mathbb { E } \left[ \left\| \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \right\| ^ { 2 } \right] . } \end{array}
|
| 428 |
+
$$
|
| 429 |
+
|
| 430 |
+
Summing up both sides of (29) from $t = 1$ to $\infty$
|
| 431 |
+
|
| 432 |
+
$$
|
| 433 |
+
\begin{array} { r l } & { \displaystyle \sum _ { t = 1 } ^ { \infty } \eta _ { t } \mathbb { E } \left[ \| \nabla _ { \alpha } \mathcal { L } _ { \mathfrak { a u } } ( \alpha _ { t } ; \omega _ { t } ) \| ^ { 2 } \right] + \displaystyle \sum _ { t = 1 } ^ { \infty } \beta _ { t } \mathbb { E } \left[ \| \nabla _ { \omega } \mathcal { L } _ { \mathfrak { a u } } ( \alpha _ { t + 1 } ; \omega _ { t } ) \| \cdot \| \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \| \right] } \\ & { \le \mathbb { E } \left[ \mathcal { L } _ { \mathfrak { a u } } ( \alpha _ { 1 } ; \omega _ { 1 } ) \right] - \displaystyle \operatorname* { l i m } _ { t \to \infty } \mathbb { E } \left[ \mathcal { L } _ { \mathfrak { a u } } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) \right] + \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { L \beta _ { t } ^ { 2 } } { 2 } \mathbb { E } \left[ \| \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \| ^ { 2 } \right] } \\ & { \quad + \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { L \eta _ { t } ^ { 2 } } { 2 } \mathbb { E } \left[ \| \nabla _ { \alpha } \mathcal { L } _ { \mathfrak { a u } } ( \alpha _ { t } ; \omega _ { t } ) \| ^ { 2 } \right] } \\ & { \le \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { L ( \eta _ { t } ^ { 2 } + \beta _ { t } ^ { 2 } ) \rho ^ { 2 } } { 2 } + \mathbb { E } \left[ \mathcal { L } _ { \mathfrak { a u } } ( \alpha _ { 1 } ; \omega _ { 1 } ) \right] \le \infty , } \end{array}
|
| 434 |
+
$$
|
| 435 |
+
|
| 436 |
+
where the second inequality holds for $\textstyle \sum _ { t = 1 } ^ { \infty } \eta _ { t } ^ { 2 } \leq \infty$ , $\textstyle \sum _ { t = 1 } ^ { \infty } \beta _ { t } ^ { 2 } \ \leq \ \infty$ , $\| \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \| \le \rho$ $\lVert \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \rVert \leq \bar { \rho }$ . Since
|
| 437 |
+
|
| 438 |
+
$$
|
| 439 |
+
\sum _ { t = 1 } ^ { \infty } \beta _ { t } \mathbb { E } \left[ \| \nabla _ { \omega } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t + 1 } ; \omega _ { t } ) \| \cdot \| \nabla _ { \omega } J _ { \pi } ( \alpha _ { t + 1 } ( \omega _ { t } ) ) \| \right] \leq L \rho \sum _ { t = 1 } ^ { \infty } \beta _ { t } \leq \infty .
|
| 440 |
+
$$
|
| 441 |
+
|
| 442 |
+
Therefore, we have
|
| 443 |
+
|
| 444 |
+
$$
|
| 445 |
+
\sum _ { t = 1 } ^ { \infty } \eta _ { t } \mathbb { E } \left[ \left\| \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \right\| ^ { 2 } \right] < \infty .
|
| 446 |
+
$$
|
| 447 |
+
|
| 448 |
+
Since $| ( \| a \| + \| b \| ) ( \| a \| - \| b \| ) | \leq \| a + b \| \| a - b \|$ , we can derive that
|
| 449 |
+
|
| 450 |
+
$$
|
| 451 |
+
\begin{array} { r l } & { \left| \mathbb { E } \left[ \left\| \nabla _ { \alpha } \alpha _ { \alpha } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) \right\| ^ { 2 } \right] - \mathbb { E } \left[ \left\| \nabla _ { \alpha } \alpha _ { \alpha } ( \alpha _ { t } ; \omega _ { t + 1 } ) \right\| ^ { 2 } \right] \right| } \\ & { = \mathbb { E } \left[ \left( \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) \right\| + \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t + 1 } ) \right\| \right) + \left( \mathbb { E } \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) \right) \right] - \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t + 1 } ) \right\| } \\ & { \leq \mathbb { E } \left[ \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) \right\| + \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t + 1 } ) \right\| \right] \left\| \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t + 1 } ; \omega _ { t + 1 } ) \right\| - \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t } ) \right\| \right] \right| } \\ & { \leq \mathbb { E } \left[ \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) + \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t } ) \right\| \right] \cdot \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t + 1 } ) - \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t } ) \right\| \right] } \\ & \leq \mathbb { E } \left[ \left( \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) \right\| + \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ { t + 1 } ) \right\| \right) \left\| \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t + 1 } ; \omega _ { t + 1 } ) - \nabla _ { \alpha } C _ { \alpha } ( \alpha _ { t } ; \omega _ \end{array}
|
| 452 |
+
$$
|
| 453 |
+
|
| 454 |
+
$\textstyle \sum _ { t = 1 } ^ { \infty } \eta _ { t } = \infty$
|
| 455 |
+
|
| 456 |
+
$$
|
| 457 |
+
\operatorname* { l i m } _ { t \to \infty } \mathbb { E } \left[ \| \nabla _ { \alpha } \mathcal { L } _ { \mathrm { a t t } } ( \alpha _ { t } ; \omega _ { t } ) \| ^ { 2 } \right] = 0 .
|
| 458 |
+
$$
|
| 459 |
+
|
| 460 |
+
# E DETAILS OF PBRL
|
| 461 |
+
|
| 462 |
+
In this section, we present details of the scripted teacher and preference collection. It is a crucial part of the PbRL, and BATTLE follows these settings as Lee et al. (2021a).
|
| 463 |
+
|
| 464 |
+
Scripted Teacher. To evaluate the performance systemically, a useful way is to consider a scripted teacher that provides preferences between a pair of agent’s trajectory segments according to the oracle reward function. Leveraging the preference labels from the human teacher is ideal, while it is hard to evaluate algorithms quantitatively and quickly. Specifically, the scripted teacher can immediately provide ground truth rewards based on the state s and action a. It is a function designed to approximate the human’s intention.
|
| 465 |
+
|
| 466 |
+
Preference Collection. During training, we need to query human preference labels at regular intervals. It samples a batch of segment pairs and calculates the cumulative reward of each segment with rewards provided by the scripted teacher. For a specific segment pair, human prefers the segment with a larger cumulative reward. The segment with a larger cumulative reward is labelled with 1, and the smaller one is labelled with 0. As for the computational cost, we assume that $M$ preference labels are required, the segment length is $N$ in a run, and the time complexity is $\mathcal { O } ( M N )$ . However, it is negligible compared with adversary training, which involves complex gradient computation.
|
| 467 |
+
|
| 468 |
+
# F EXPERIMENTAL DETAILS
|
| 469 |
+
|
| 470 |
+
In this section, we provide a concrete description of our experiments and detailed hyper-parameters of BATTLE. For each run of experiments, we run on a single Nvidia Tesla V100 GPUs and 16 CPU cores (Intel Xeon Gold 6230 CPU $\textcircled { a } 2 . 1 0 \mathrm { G H z }$ ) for training.
|
| 471 |
+
|
| 472 |
+
# F.1 TASKS
|
| 473 |
+
|
| 474 |
+
In phase one of our experiments, we evaluate our method on eight robotic manipulation tasks obtained from Meta-world (Yu et al., 2020). These tasks serve as a representative set for testing the effectiveness of our approach. In phase two, we further assess our method on two locomotion tasks sourced from Mujoco (Todorov et al., 2012). By including tasks from both domains, we aim to demonstrate the versatility and generalizability of our approach across different task types. The specific tasks we utilize in our experiments are as follows:
|
| 475 |
+
|
| 476 |
+
# Meta-world
|
| 477 |
+
|
| 478 |
+
• Door Lock: An agent controls a simulated Sawyer arm to lock the door.
|
| 479 |
+
• Door Unlock: An agent controls a simulated Sawyer arm to unlock the door.
|
| 480 |
+
• Drawer Open: An agent controls a simulated Sawyer arm to open the drawer to a target position.
|
| 481 |
+
• Drawer Close: An agent controls a simulated Sawyer arm to close the drawer to a target position.
|
| 482 |
+
• Faucet Open: An agent controls a simulated Sawyer arm to open the faucet to a target position.
|
| 483 |
+
• Faucet Close: An agent controls a simulated Sawyer arm to close the faucet to a target position.
|
| 484 |
+
• Window Open: An agent controls a simulated Sawyer arm to open the window to a target position.
|
| 485 |
+
• Window Close: An agent controls a simulated Sawyer arm to close the window to a target position.
|
| 486 |
+
|
| 487 |
+
#
|
| 488 |
+
|
| 489 |
+
• Half Cheetah: A 2-dimensional robot with nine links and eight joints aims to learn to run forward (right) as fast as possible. • Walker: A 2-dimensional two-legged robot aims to move in the forward (right).
|
| 490 |
+
|
| 491 |
+
# F.2 HYPER-PARAMETERS SETTING
|
| 492 |
+
|
| 493 |
+
We adopt the PEBBLE algorithm as our baseline approach for SA-RL (Zhang et al., 2021), and we keep the same parameter settings and neural network structure as described in their work. The specific hyperparameters for SA-RL are provided in Table 4. Similarly, for PA-AD (Sun et al., 2022), we use identical hyperparameter values to those of SA-RL, ensuring a fair comparison between the two methods.
|
| 494 |
+
|
| 495 |
+
Table 3: Hyper-parameters of BATTLE for adversary training.
|
| 496 |
+
|
| 497 |
+
<table><tr><td>Hyper-parameter</td><td>Value</td><td> Hyper-parameter</td><td>Value</td></tr><tr><td>Number of layers</td><td>3</td><td>Hidden units of each layer</td><td>256 1024</td></tr><tr><td>Learning rate</td><td>0.0003 50</td><td>Batch size Number of reward functions</td><td>3</td></tr><tr><td>Length of segment</td><td></td><td></td><td>128</td></tr><tr><td>Frequency of feedback</td><td>5000</td><td>Feedback batch size</td><td></td></tr><tr><td>Adversarial budget</td><td>0.1</td><td>(β1,β2)</td><td>(0.9,0.999)</td></tr></table>
|
| 498 |
+
|
| 499 |
+
Table 4: Hyper-parameters of SA-RL for adversary training.
|
| 500 |
+
|
| 501 |
+
<table><tr><td>Hyper-parameter</td><td>Value</td><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Number of layers</td><td>3</td><td>Hidden units of each layer</td><td>256</td></tr><tr><td>Learning rate</td><td>0.00005</td><td>Mini-Batch size</td><td>32</td></tr><tr><td>Length of segment</td><td>50</td><td>Number of reward functions</td><td>3</td></tr><tr><td>Frequency of feedback</td><td>5000</td><td>Feedback batch size</td><td>128</td></tr><tr><td>Adversarial budget</td><td>0.1</td><td>Entropy coefficient</td><td>0.0</td></tr><tr><td>Clipping parameter</td><td>0.2</td><td>Discount γ</td><td>0.99</td></tr><tr><td>GAE lambda</td><td>0.95</td><td>KL divergence target</td><td>0.01</td></tr></table>
|
| 502 |
+
|
| 503 |
+
# F.3 VICTIM SETTING
|
| 504 |
+
|
| 505 |
+
Our experiment is divided into two phases. In the first phase, we conduct experiments using a variety of simulated robotic manipulation tasks from the Meta-world environment. In the second phase, we shift our focus to two continuous control environments from the OpenAI Gym MuJoCo suite.
|
| 506 |
+
|
| 507 |
+
Meta-world. We train the victim models on the Meta-world tasks using the SAC (Soft Actor-Critic) algorithm proposed by Haarnoja et al. (2018). We employ a fully connected neural network as the
|
| 508 |
+
|
| 509 |
+
policy network for the SAC algorithm. The detailed hyperparameters used in our experiments are provided in Table 5.
|
| 510 |
+
|
| 511 |
+
Table 5: Hyper-parameters of SAC for victim training.
|
| 512 |
+
|
| 513 |
+
<table><tr><td>Hyper-parameter</td><td>Value</td><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Number of layers</td><td>3</td><td> Initial temperature</td><td>0.1</td></tr><tr><td>Hidden units of each layer</td><td>256</td><td>Optimizer</td><td>Adam</td></tr><tr><td>Learning rate</td><td>0.0001</td><td>Critic target update freq</td><td>2</td></tr><tr><td>Discount γ</td><td>0.99</td><td>Critic EMA T</td><td>0.005</td></tr><tr><td>Batch size</td><td>1024</td><td>(β1,β2)</td><td>(0.9,0.999)</td></tr><tr><td>Steps of unsupervised pre-training</td><td>9000</td><td>Discount γ</td><td>0.99</td></tr></table>
|
| 514 |
+
|
| 515 |
+
Mujoco. We directly utilize the well-trained model for demonstrating the vulnerability of the Decision Transformer. Specifically, we use the Cheetah agent4 and the Walker agent5 with expert-level.
|
| 516 |
+
|
| 517 |
+
# F.4 SCENARIO DESIGNING
|
| 518 |
+
|
| 519 |
+
To validate the effectiveness of our approach, we carefully designed two experimental scenarios: the Manipulation Scenario and the Opposite Behavior Scenario. In the Manipulation Scenario, the victim policy is a well-trained policy on robotic tasks. The objective of the adversary is to manipulate the agent’s behavior through targeted adversarial attacks, causing the agent to grasp objects that are far from the original target location. The successful execution of such grasping actions indicates the success of the adversarial attack. In the Opposite Behavior Scenario, the victim policy is a well-trained policy on simulated robotic manipulation tasks. The goal of the attacker is to redirect the agent’s behavior towards tasks that are opposite in nature to the original objective. For instance, if the victim policy is designed to open windows, the attacker aims to modify the agent’s behavior to close the windows instead.
|
| 520 |
+
|
| 521 |
+
Table 6: Success rate of different methods with varying numbers of preference labels on the Drawer Open task in the manipulation scenario and the Faucet Close task in the opposite behavior scenario. The success rate is reported as the mean and standard deviation over 30 episodes.
|
| 522 |
+
|
| 523 |
+
<table><tr><td>Environment</td><td>Feedback</td><td>BATTLE (ours)</td><td>PA-AD</td><td>SA-RL</td></tr><tr><td rowspan="4">Drawer Open (manipulation)</td><td>3000</td><td>65.7%±37.1%</td><td>0.0%±0.0%</td><td>8.3%±13.2%</td></tr><tr><td>5000</td><td>86.7% ±18.1%</td><td>0.0%±0.0%</td><td>21.3%± 18.9%</td></tr><tr><td>7000</td><td>95.7% ±13.6%</td><td>0.0%±0.0%</td><td>28.0%± 28.1%</td></tr><tr><td>9000</td><td>97.0%±6.9%</td><td>0.0%±0.0%</td><td>13.0%±18.5%</td></tr><tr><td rowspan="4">Faucet Close (opposite behavior)</td><td>1000</td><td>69.7% ±35.2%</td><td>16.7% ± 9.4%</td><td>2.0%±6.0%</td></tr><tr><td>3000</td><td>79.0% ±16.2%</td><td>29.0% ±14.0%</td><td>6.0%± 11.7%</td></tr><tr><td>5000</td><td>95.3%±9.2%</td><td>21.3%±12.8%</td><td>3.3% ± 12.7%</td></tr><tr><td>7000</td><td>95.3%± 7.6%</td><td>22.7%±12.4%</td><td>4.0%± 7.1%</td></tr></table>
|
| 524 |
+
|
| 525 |
+
# G EXTENSIVE EXPERIMENTS
|
| 526 |
+
|
| 527 |
+
Impact of Feedback Amount. We evaluate the performance of BATTLE using different numbers of preference labels. Table 6 presents the results of all methods with varying numbers of labels: 3000, 5000, 7000, 9000 for the Drawer Open task in the manipulation scenario and 1000, 3000, 5000, 7000 for the Faucet Close task in the opposite behavior scenario. Based on the experimental results shown in Table 6, we conclude that providing an adequate amount of human feedback improves the performance of our method, leading to a stronger adversary and a more stable attack success rate. We observe that the performance of BATTLE consistently improves as the number of preference labels increases, highlighting the crucial impact of the number of preference labels on adversary learning. In contrast, SA-RL and PA-AD exhibit poor performance even with a sufficient amount of human feedback, with PA-AD failing entirely in the manipulation scenario. This can be attributed to the limited exploration space of these methods, which is constrained by the fixed victim policy. In contrast, BATTLE achieves better exploration by incorporating an intention policy, resulting in improved performance.
|
| 528 |
+
|
| 529 |
+

|
| 530 |
+
Figure 8: Training curves of success rate with different adversarial budgets on Drawer Open for the manipulation scenario and Faucet Close for the opposite behavior scenario. The solid line and shaded area denote the mean and the standard deviation of the success rate across five runs.
|
| 531 |
+
|
| 532 |
+

|
| 533 |
+
Figure 9: Time series of the normalized learned reward (blue) and the ground truth reward (orange). These rewards are obtained from rollouts generated by a policy optimized using BATTLE.
|
| 534 |
+
|
| 535 |
+
Impact of Different Attack Budgets. We also investigate the impact of the attack budget on the performance. To gain further insights, we conduct additional experiments with different attack budgets: 0.05, 0.075, 0.1, 0.15 for the Drawer Open task and 0.02, 0.05, 0.075, 0.1 for the Faucet Close task in the respective scenarios. In Figure 8, we present the performance of the baseline method and BATTLE with different attack budgets. The experimental results demonstrate that the performance of all methods improves with an increase in the attack budget.
|
| 536 |
+
|
| 537 |
+
Quality of learned reward functions. We further analyze the quality of the reward functions learned by BATTLE compared to the true reward function. In Figure 9, we present four time series plots that depict the normalized learned reward (blue) and the ground truth reward (orange). These plots represent two scenarios: opposite behaviors and manipulation tasks. The results indicate that the learned reward function aligns well with the true reward function derived from human feedback. This alignment is achieved by capturing various human intentions through the preference data.
|
| 538 |
+
|
| 539 |
+
Robust Agents Training and Evaluating. An intuitive application of BATTLE is in evaluating the robustness of a given model or enhancing the robustness of an agent through adversarial training. ATLA (Zhang et al., 2021) is a general training framework for improving robustness, which involves alternating training between an agent and an adversary. Building upon this concept, we introduce BATTLE-ATLA, which combines BATTLE with the ATLA framework by training an agent and a BATTLE attacker alternately. The robustness performance of BATTLE-ATLA for a SAC agent is presented in Table 7 and compared with state-of-the-art robust training methods. The experimental results provide two key insights: firstly, BATTLE-ATLA significantly enhances the robustness of agents, demonstrating its effectiveness in improving agent resilience to adversarial attacks. Secondly, BATTLE exhibits the capability to launch stronger attacks on robust agents, highlighting its effectiveness as an adversary in the adversarial training process.
|
| 540 |
+
|
| 541 |
+
Table 7: Average episode rewards $\pm$ standard deviation of robust agents under different attack methods, and results are averaged across 100 episodes.
|
| 542 |
+
|
| 543 |
+
<table><tr><td>Task</td><td>Model</td><td>BATTLE</td><td>PA-AD</td><td>SA-RL</td><td>Average Reward</td></tr><tr><td rowspan="3">Door Lock</td><td>BATTLE-ATLA</td><td>874±444</td><td>628±486</td><td>503±120</td><td>668</td></tr><tr><td>PAAD-ATLA</td><td>491±133</td><td>483±15</td><td>517±129</td><td>497</td></tr><tr><td>SARL-ATLA</td><td>469±11</td><td>629±455</td><td>583±173</td><td>545</td></tr><tr><td rowspan="3">Door Unlock</td><td>BATTLE-ATLA</td><td>477±203</td><td>745±75</td><td>623±60</td><td>615</td></tr><tr><td>PAAD-ATLA</td><td>398±12</td><td>381±11</td><td>398±79</td><td>389</td></tr><tr><td>SARL-ATLA</td><td>393±36</td><td>377±8</td><td>385±26</td><td>385</td></tr><tr><td rowspan="3">Faucet Open</td><td>BATTLE-ATLA</td><td>442±167</td><td>451±96</td><td>504±55</td><td>465</td></tr><tr><td>PAAD-ATLA</td><td>438±53</td><td>588±222</td><td>373±32</td><td>466</td></tr><tr><td>SARL-ATLA</td><td>610±293</td><td>523±137</td><td>495±305</td><td>522</td></tr><tr><td rowspan="3">Faucet Close</td><td>BATTLE-ATLA</td><td>1048±343</td><td>1223±348</td><td>570±453</td><td>947</td></tr><tr><td>PAAD-ATLA</td><td>661±279</td><td>371±65</td><td>704±239</td><td>538</td></tr><tr><td>SARL-ATLA</td><td>1362±149</td><td>688±196</td><td>426±120</td><td>825</td></tr></table>
|
md/test/ttMwEuEPeB/ttMwEuEPeB.md
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 3D-GPT: PROCEDURAL 3D MODELING WITH LARGE LANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
In the pursuit of efficient automated content creation, procedural generation, leveraging modifiable parameters and rule-based systems, emerges as a promising approach. Nonetheless, it could be a demanding endeavor, given its intricate nature necessitating a deep understanding of rules, algorithms, and parameters. To reduce workload, we introduce 3D-GPT, a framework utilizing large language models (LLMs) for instruction-driven 3D modeling. 3D-GPT positions LLMs as proficient problem solvers, dissecting the procedural 3D modeling tasks into accessible segments and appointing the apt agent for each task. 3D-GPT integrates three core agents: the task dispatch agent, the conceptualization agent, and the modeling agent. They collaboratively achieve two objectives. First, it enhances concise initial scene descriptions, evolving them into detailed forms while dynamically adapting the text based on subsequent instructions. Second, it integrates procedural generation, extracting parameter values from enriched text to effortlessly interface with 3D software for asset creation. Our empirical investigations confirm that 3D-GPT not only interprets and executes instructions, delivering reliable results but also collaborates effectively with human designers. Furthermore, it seamlessly integrates with Blender, unlocking expanded manipulation possibilities. Our work highlights the potential of LLMs in 3D modeling, offering a basic framework for future advancements in scene generation and animation.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
In the metaverse era, 3D content creation serves as a catalyst for transformative progress, redefining multimedia experiences in domains like gaming, virtual reality, and cinema with intricately crafted models. Yet, designers often grapple with a time-intensive 3D modeling process, starting from basic shapes (e.g., cubes, spheres, or cylinders) and employing software like Blender for meticulous shaping, detailing, and texturing. This demanding workflow concludes with rendering and post-processing to deliver the polished final model. While procedural generation holds promise with its efficiency in automating content creation through adjustable parameters and rule-based systems (Deitke et al., 2022; Greff et al., 2022; He et al., 2021; Jiang et al., 2018; Raistrick et al., 2023), it demands a comprehensive grasp of generation rules, algorithmic frameworks, and individual parameters. Furthermore, aligning these processes with the creative visions of clients, through effective communication, adds another layer of complexity. This underscores the importance of simplifying the traditional 3D modeling workflow to empower creators in the metaverse era.
|
| 12 |
+
|
| 13 |
+
LLMs have showcased exceptional language understanding capabilities, including planning and tool utilization (Imani et al., 2023; Zhang et al., 2023a; Gong et al., 2023; Zeng et al., 2022). Furthermore, LLMs demonstrate outstanding proficiency in characterizing object attributes, such as structure and texture (Menon & Vondrick, 2022; Pratt et al., 2022; Fan et al., 2023), enabling them to enhance details from rough descriptions. Additionally, they excel at parsing concise textual information and comprehending intricate code functions, while seamlessly facilitating efficient interactions with users. Driven by these extraordinary capabilities, we embark on exploring their innovative applications in procedural 3D modeling. Our primary objective is to harness the power of LLMs to exert control over 3D creation software in accordance with the requirements of clients.
|
| 14 |
+
|
| 15 |
+
In pursuit of this vision, we introduce 3D-GPT, a framework aimed at facilitating instruction-driven 3D content synthesis. 3D-GPT enables LLMs to function as problem-solving agents, breaking down the 3D modeling task into smaller, manageable components, and determining when, where, and how to accomplish each segment. 3DGPT comprises three key agents: conceptualization agent, 3D modeling agent and task dispatch agent. The first two agents collaborate harmoniously to fulfill the roles of 3D conceptualization and 3D modeling by manipulating the 3D generation functions. Subsequently, the third agent manages the system by taking the initial text input, handling subsequence instructions, and facilitating effective cooperation between the two aforementioned agents.
|
| 16 |
+
|
| 17 |
+
By doing so, they work toward two key objectives. First, it enhances initial scene descriptions, guiding them towards more detailed and contextually relevant forms while adapting the textual input based on subsequent instructions. Second, instead of directly crafting every element of 3D content, we employ procedural generation, making use of adaptable parameters and rule-based systems to interface with 3D software. Our 3D-GPT is equipped with the capability to understand procedural generation functions and extract corresponding parameter values from the enriched text.
|
| 18 |
+
|
| 19 |
+
3D-GPT offers controllable and precise 3D generation guided by users’ textual descriptions. It reduces the workload of manually defining each controllable parameter in procedural generation, particularly within complex scenes that encompass diverse aspects. Moreover, 3D-GPT enhances collaboration with users, making the creative process more efficient and user-centric. Furthermore, 3D-GPT seamlessly interfaces with Blender, granting users diverse manipulation capabilities: object transformations, material adjustments, primitive additions, object animations, mesh editing, and physical motion simulations. Based on our experiments, we posit that LLMs exhibit the potential to handle more intricate visual inputs. Our contributions are summarized as follows:
|
| 20 |
+
|
| 21 |
+
• Introducing 3D-GPT, a training-for-free framework designed for 3D scene generation. Our approach leverages the innate multimodal reasoning capabilities of LLMs, streamlining the efficiency of end-users engaged in procedural 3D modeling. Exploration of an alternative path in text-to-3D generation, wherein our 3D-GPT generates Python codes to control 3D software, potentially offering increased flexibility for realworld applications.
|
| 22 |
+
• Empirical experiments demonstrate the substantial potential of LLMs in terms of their reasoning, planning, and tool-using capabilities in 3D content generation.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
# 2.1 TEXT-TO-3D GENERATION
|
| 27 |
+
|
| 28 |
+
With the recent advance in text-to-image generation modeling, there has been a growing interest in text-to-3D generation (Sanghi et al., 2022; Poole et al., 2022; Lin et al., 2023; Xu et al., 2023; Metzer et al., 2023; Wang et al., 2023; Xu et al., 2023; Mohammad Khalid et al., 2022; Jain et al., 2022). The common paradigm of them is to perform per-shape optimization with differentiable rendering and the guidance of the CLIP model (Radford et al., 2021) or 2D diffusion models (Rombach et al., 2022). For example, DreamFields (Jain et al., 2022) and CLIP-Mesh (Mohammad Khalid et al., 2022) explore zero-shot 3D content creation using only CLIP guidance. Dreamfusion (Poole et al., 2022) optimizes NeRF Mildenhall et al. (2021) with the guidance of a text-to-image diffusion model, achieving remarkable text-to-3D synthesis results. Further works in this direction have resulted in notable enhancements in visual quality (Lin et al., 2023; Melas-Kyriazi et al., 2023), subject-driven control (Raj et al., 2023; Metzer et al., 2023), and overall processing speed (Liu et al., 2023; Jain et al., 2022). Unlike the above approaches, our objective is not to generate conventional neural representations as the final 3D output. Instead, we utilize LLMs to generate Python code that controls Blender’s 3D modeling based on the provided instructions.
|
| 29 |
+
|
| 30 |
+
# 2.2 LARGE LANGUAGE MODELS
|
| 31 |
+
|
| 32 |
+
Large language models (LLMs) are a promising approach to capture and represent the compressed knowledge and experiences of humans, projecting them into language space (Devlin et al., 2018; Raffel et al., 2020; OpenAI, 2023; Chowdhery et al., 2022; Bubeck et al., 2023). LLMs have consistently showcased remarkable performance extending beyond canonical language processing domains. They exhibit the capability to address intricate tasks that were once considered the exclusive domain of specialized algorithms or human experts. These tasks encompass areas such as mathematical reasoning (Imani et al., 2023; Wei et al., 2022), medicine (Jeblick et al., 2022; Yang et al.,
|
| 33 |
+
|
| 34 |
+
2023), and planning (Zhang et al., 2023a; Gong et al., 2023; Huang et al., 2023; 2022) Our work explores the innovative application of LLMs in 3D modeling, employing them to control 3D procedural generation.
|
| 35 |
+
|
| 36 |
+
# 3 3D-GPT
|
| 37 |
+
|
| 38 |
+
# 3.1 TASK FORMULATION
|
| 39 |
+
|
| 40 |
+
The overall objective is the generation of 3D content based on a sequence of relatively short natural language instructions, denoted as $\mathcal { L } = \langle L _ { i } \rangle$ . The initial instruction, designated as $L _ { 0 }$ , serves as a comprehensive description of the 3D scene, such as $^ { 6 6 } A$ misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees”. Subsequent instructions are employed to modify the existing scene, as exemplified by instructions like “transform the white flowers into yellow flower” or “translate the scene into a winter setting” to add detail.
|
| 41 |
+
|
| 42 |
+
To accomplish this objective, we introduce a framework named 3D-GPT, which empowers LLMs to act as problem-solving agents. We point out that employing LLMs to directly create every element of 3D content poses significant challenges. LLMs lack specific pre-training data for proficient 3D modeling and, as a result, may struggle to accurately determine what elements to use and how to modify them based on given instructions. To address this challenge, we employ procedural generation to control the 3D content creation. This makes use of adaptable parameters and rule-based systems to interface with 3D software (e.g., Blender) so as to efficiently conduct 3D modeling (Deitke et al., 2022; Greff et al., 2022; He et al., 2021; Jiang et al., 2018; Raistrick et al., 2023). Nevertheless, there are several challenges that remain such as identifying the correct procedures to call and mapping of language to API parameters. We solve these using multiple language agents as will be discussed below.
|
| 43 |
+
|
| 44 |
+
Our approach conceptualizes the 3D procedural generation engine as a set of functions, denoted as $\mathcal { F } = \{ F _ { j } \}$ , where each function $F _ { j }$ takes parameters $P _ { j }$ . For example, add trees(scene, density, distance min, leaf type, fruit type) will takes a built natural scene as input and adds base trees to it.
|
| 45 |
+
|
| 46 |
+
Within our 3D-GPT framework, for each language instruction $L _ { i }$ , we formulate the modeling task as first selecting the subset of relevant functions ${ \hat { \mathcal { F } } } \subseteq { \mathcal { F } }$ , and then inferring the corresponding parameters $P _ { j }$ for each function $F _ { j }$ in this subset. The ultimate aim is to ensure that the functions in $\hat { \mathcal { F } }$ collectively generates a 3D scene that aligns with the descriptions provided in $\mathcal { L }$ . By adeptly addressing both function selection and parameter inference for every sub-instruction $L _ { i }$ , 3D-GPT generates a Python script file that allows Blender’s 3D modeling environment to render high-quality scenes consistent with the instruction sequence $\mathcal { L }$ .
|
| 47 |
+
|
| 48 |
+
# 3.2 MODELING TOOL PREPARATION
|
| 49 |
+
|
| 50 |
+
In our framework, we utilize Infinigen Raistrick et al. (2023), a Python-Blender-based procedural generator equipped with a rich library of generation functions. To empower LLMs with the ability to proficiently leverage Infinigen, we provide following crucial language prompts for each function $F _ { j }$ :
|
| 51 |
+
|
| 52 |
+
• Documentation $( D _ { j } )$ : A comprehensive explanation of the function’s purpose and clear description of it’s parameters $P _ { j }$ as one would find in standard API documentation.
|
| 53 |
+
• API code $( C _ { j } )$ : Restructured and highly readable function code, ensuring that it is accessible and comprehensible for LLMs.
|
| 54 |
+
• Auxiliary parameter information $( I _ { j } )$ : Outlines specific information required to infer the function parameters, thereby assisting LLMs in understanding the context and prerequisites of each function. For example, in the case of a flower generation function, $I _ { j }$ indicates the required visual properties for rendering, such as flower color, flower petal appearance (e.g., size, curve, and length), and flower center appearance.
|
| 55 |
+
• Usage examples $( E _ { j } )$ : Illustrative examples that demonstrate how to infer the parameter $P _ { j }$ from the accompanying text descriptions and subsequently invoke the function. Continuing with the example of a flower generation function, $E _ { j }$ includes a practical demonstration of how to infer the parameters and call the function based on input text like “a sunflower”
|
| 56 |
+
|
| 57 |
+
By providing LLMs with these resources, we enable them to leverage their generative competencies in planning, reasoning, and tool utilization. As a result, LLMs can effectively harness Infinigen for 3D generation based on language instructions in a seamless and efficient manner. In the context of our work, the function set $\mathcal { F }$ encompasses all functions and subfunctions within the Infinigen scene generation script, with the sole exception of the ’creatures’ class. These functions play an indispensable role in our scene creation process. In the supplementary material, Section 6.4 presents a comprehensive list of all the functions by the script we utilized to construct the scenes. Additionally, we provide examples for using some of these functions in Section 6.8, Figure 14 and Figure 13.
|
| 58 |
+
|
| 59 |
+
3.3 MULTI-AGENTS FOR 3D REASONING, PLANING AND TOOL USING
|
| 60 |
+
|
| 61 |
+
With the necessary tool preparation (i.e., $D _ { j }$ , $C _ { j }$ , $I _ { j }$ and $E _ { j }$ ) in hand, 3D-GPT employs a multi-agent system to tackle the task of language-guided procedural 3D modeling. This system comprises three integral agents: (1) the task dispatch agent, (2) the conceptualization agent, and (3) the modeling agent, illustrated in Figure 1. Together, these agents decompose modeling task into manageable segments, with each agent specializing in distinct aspects: planning, 3D reasoning, and tool utilization. The task dispatch agent plays a pivotal role in the planning process. It leverages user instructions to query function documents and subsequently selects the requisite functions for execution. Once functions are selected, the conceptualization agent engages in reasoning to enrich the user-provided text description. Building upon this, the modeling agent deduces the parameters for each selected function and generates Python code scripts to invoke Blender’s API, facilitating the creation of the corresponding 3D content. From there, images can be generated using Blender rendering capability.
|
| 62 |
+
|
| 63 |
+
Task Dispatch Agent for Planing. The task dispatch agent, armed with comprehensive information of all available functions $\mathcal { F }$ as described above, efficiently identifies the requisite functions for each instructional input. For example, when presented with an instruction such as “translate the scene into a winter setting”, it pinpoints functions like add snow layer and update trees. This pivotal role played by the task dispatch agent is instrumental in facilitating efficient task coordination between the conceptualization and modeling agents. Without it, the conceptualization and the modeling agents have to analyze all provided functions $\mathcal { F }$ for each given instruction. This not only increases the workload for these agents but also extends processing time and can potentially lead to undesired modifications. The communication flow between the LLM system, the user, and the task dispatch agent is outlined as follows:
|
| 64 |
+
|
| 65 |
+
— LLM System: You are a proficient planner for selecting suitable functions based on user instructions. You are provided with the following functions: $\langle ( F _ { j } ^ { n a m e } , F _ { j } ^ { u s a g e } ) \rangle$ . Below are a few examples of how to choose functions based on user instructions: $\langle E _ { j } ^ { t a s k \lrcorner d i s p a t c h } \rangle$ . — User: My instruction is: $\left. L _ { i } \right.$ . — Task Dispatch Agent: Given the instruction $\left. L _ { i } \right.$ , we determine the sublist of functions $\hat { \mathcal { F } }$ that need to be used for $3 D$ modeling.
|
| 66 |
+
|
| 67 |
+
Here $\langle ( F _ { j } ^ { n a m e } , F _ { j } ^ { u s a g e } ) \rangle$ represents a list of function names and concise function usage descriptions for all available functions and examples $\langle E ^ { t a s k \lrcorner d i s p a t c h } \rangle$ provide guided examples for prompt-based instructions. A example is provided in the supplementary Figure 10.
|
| 68 |
+
|
| 69 |
+
Conceptualization Agent for Reasoning. The user instruction may not explicitly provide sufficient details needed for modeling. For instance, consider the instruction, “a misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees”. Here many necessary details required function parameters such as tree branch length, tree size, and leaf type, are not directly stated in the given text. When instructing the modeling agent to infer parameters directly, we observed that it tends to provide simplistic solutions, such as using default or copying values from prompting examples. This reduces diversity in generation and complicates parameter inference.
|
| 70 |
+
|
| 71 |
+
To address this issue, we introduce the conceptualization agent which collaborates with the task dispatch agent to augment the user-provided text description $( L _ { i } )$ . After the task dispatch agent selects the required functions, we send the user input text and the corresponding function-specific information to the conceptualization agent and request augmented text. For each function $F _ { j }$ , it enriches $L _ { i }$ into detailed appearance descriptions $L _ { i } ^ { j }$ . The communication between the system and the Conceptualization Agent for instruction $\langle L _ { i } \rangle$ and function $\langle F _ { j } \rangle$ is as follows:
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 1: 3D-GPT Overview. 3D-GPT employs LLMs as a multi-agent system with three collaborative agents for procedural 3D generation. These agents consult documents from the procedural generator, infer function parameters, and produce Python code. The generated code script interfaces with Blender’s API for 3D content creation and rendering.
|
| 75 |
+
|
| 76 |
+
— LLM System: You are a skilled writer, especially when it comes to describing the appearance of objects and large scenes. Given a description $\langle L _ { i } \rangle$ , provide detailed descriptions for the following information $\langle I _ { j } \rangle$ . For terms not mentioned in the description, use your imagination to ensure they fit the text description.
|
| 77 |
+
— Conceptualization Agent: Given the $\left. L _ { i } \right.$ and requested information $\langle I _ { j } \rangle$ , the extended description is: $\langle \widehat { L _ { i } ^ { j } } \rangle$ .
|
| 78 |
+
|
| 79 |
+
# We have illustrated a communication example in Figure 11 within the supplementary material.
|
| 80 |
+
|
| 81 |
+
Modeling Agent for Tool Using. After conceptualization, the 3D modeling processing is invoked to convert the detailed human language to machine-understandable language. In our framework, our modeling agent employs the functions of procedural modeling in the library to create a realistic 3D model. For each function $F _ { j }$ and user instruction $L _ { i }$ , the task dispatch agent receive augmented context $\widehat { L _ { i } ^ { j } }$ from the conceptualization agent. For each function $F _ { j }$ , we have the code $C _ { j }$ , function documentation $D _ { j }$ , and one usage example $E _ { j }$ . The modeling agent utilizes this information to select the appropriate functions and deduce the corresponding parameters. Subsequently, the modeling agent generates Python code that calls the selected function in the right context (e.g., within a loop), passing in parameters inferred from the text and of the appropriate data type.
|
| 82 |
+
|
| 83 |
+
The communication between System and Modeling Agent are based on the following pattern:
|
| 84 |
+
|
| 85 |
+
— LLM System: You are a good 3D designer who can convert long text descriptions into parameters, and is good at understanding Python functions to manipulate $3 D$ content. Given the text description $\langle \widehat { L _ { i } ^ { f } } \rangle$ , we have the following function codes $\langle C _ { j } \rangle$ and the document for function $\langle D _ { j } \rangle$ . Below is an example bout how to make function calls to model the scene to fit the description: $\langle E _ { j } ^ { m o d e l i n g } \rangle$ . Understand the function, and model the $3 D$ scene that fits the text description by making a function call. — Modeling Agent: Given the description $\langle \widehat { L _ { i } ^ { j } } \rangle$ , we use the following functions: ..., and their respective parameter values ... are adopted.
|
| 86 |
+
|
| 87 |
+
We have illustrated a communication example in Figure 12 within the supplementary material.
|
| 88 |
+
|
| 89 |
+
Blender Rendering. The modeling agent ultimately constructs the Python function calls with inferred parameters, which are supplied to Blender for controlling view ports and rendering, and thereby resulting in production of the final 3D mesh and RGB results.
|
| 90 |
+
|
| 91 |
+
Implementation Detail. Our implementation relies on the Infinigen Raistrick et al. (2023) API, and the specific function set $\cdot$ utilized in our work is available in the generation script provided in
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 2: Visual Examples of Instruction-Based 3D Scene Generation. 3D-GPT can construct large 3D scenes that align with the provided initial instruction. We demonstrate that the rendered images contain various visual factors in line with the given instructions.
|
| 95 |
+
|
| 96 |
+
Supplementary Material, as detailed in Section 6.4. We have developed our system using the OpenAI API, and the code implementation for our modeling agent can also be found in Supplementary Material, Section 6.4. This code demonstrates the ease with which our system can be implemented.
|
| 97 |
+
|
| 98 |
+
# 4 EXPERIMENTS
|
| 99 |
+
|
| 100 |
+
Our experimentation begins by showcasing the proficiency of 3D-GPT in consistently generating results that align with user instructions, encompassing scenarios involving both large scenes and individual objects. Subsequently, we delve into specific examples to illustrate how our agents effectively comprehend tool functionalities, access necessary knowledge, and employ it for precise control. To deepen our understanding, we conduct an ablation study to systematically examine the contributions of each agent within our multi-agent system.
|
| 101 |
+
|
| 102 |
+
# 4.1 3D MODELING
|
| 103 |
+
|
| 104 |
+
Large Scene Generation. We investigate the capability of 3D-GPT to control modeling tools based on scene descriptions without any training. To conduct this experiment, we generated 100 scene descriptions using ChatGPT with the following prompt: “You are a good writer, provide 10 different natural scene descriptions for me”. We collected responses to this prompt 10 times to form our dataset. In Figure 2, we present the multi-view rendering results of 3D-GPT. These results indicate that our approach is capable of generating large 3D scenes that generally align well with the provided text descriptions, showcasing a noticeable degree of diversity. Notably, all 3D outcomes are directly rendered using Blender, ensuring that all meshes are authentic, thereby enabling our method to achieve absolute 3D consistency and produce real ray-tracing rendering results.
|
| 105 |
+
|
| 106 |
+
Fine-detail Control for Single Class. Apart from generating large scenes from concise descriptions, we assess the capabilities of 3D-GPT for modeling objects. We evaluate crucial factors such as curve modeling, shape control, and an in-depth understanding of object appearances. To this end, we report the results of fine-grained object control. This includes nuanced aspects such as object curves, key appearance features, and color, all derived from input text descriptions. We employ random prompts to instruct GPT for various real-world flower types. As depicted in Figure 3, our method adeptly models each flower type, faithfully capturing their distinct appearances. This study underscores the potential of 3D-GPT in achieving precise object modeling and fine-grained attribute control of object types and visual characteristics.
|
| 107 |
+
|
| 108 |
+
Subsequence Instruction Editing. Here, we test the ability of 3D-GPT for effective human-agent communication and task manipulation. In Figure 4, we observe that our method can comprehend subsequence instructions and make accurate decisions for scene modification. Note that, unlike the existing text-to-3D methods, 3D-GPT maintains a memory of all prior modifications, thereby facilitating the connection of new instructions with the scene’s context. Furthermore, our method eliminates the need for additional networks for controllable editings Zhang et al. (2023b). This study underscores the efficiency and versatility of 3D-GPT in adeptly handling complex subsequence instructions for 3D modeling.
|
| 109 |
+
|
| 110 |
+

|
| 111 |
+
Figure 3: Single Class Control Result. Our method effectively acquires the necessary knowledge for modeling, enabling precise object control in terms of shape, curve, and key appearance capture. The generated results closely align with the given text.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 4: Subsequence Instruction Editing Result. (a) Initial instruction-generated scene. (b)-(f) Sequential editing steps with corresponding instructions. Our method enables controllable editing and effective user-agent communication.
|
| 115 |
+
|
| 116 |
+
Individual Function Control To evaluate the effectiveness of 3D-GPT in tool utilization, we present an illustrative example that highlights our method’s ability to control individual functions and infer parameters. Figure 5 exemplifies the capability of 3D-GPT to model sky appearances based on input text descriptions. It is worth noting that the function responsible for generating the sky texture does not directly correlate color information with sky appearance. Instead, it relies on the Nishita-sky modeling method, which requires a profound understanding of real-world sky and weather conditions, considering input parameters. Our method adeptly extracts crucial information from the textual input and comprehends how each parameter influences the resulting sky appearance, as evident in Figure 5 (c) and (d). These results demonstrate that our method can effectively use individual functions as well as infer corresponding parameters.
|
| 117 |
+
|
| 118 |
+

|
| 119 |
+
Figure 5: Single Function Control Result. Visual result (top) and modeling agent response example (bottom). Our method demonstrates a high degree of accuracy in inferring algorithm parameters, even when they do not possess a direct connection to visual appearance.
|
| 120 |
+
(a) Ablation Study of Task Dispatch Agent.
|
| 121 |
+
|
| 122 |
+
# 4.2 ABLATION STUDY
|
| 123 |
+
|
| 124 |
+
We conduct separate ablation studies for the Conceptualization Agent and Task Dispatch Agent. Our assessment focused on CLIP scores (Radford et al., 2021), failure rates, and parameter diversity, quantified using the categorical Shannon Diversity Index. The CLIP score measures the alignment between text and generated images. The failure rate represents the percentage of system failures due to issues such as incorrect datatypes, wrong response patterns, or missing parameters from the Modeling Agent. Parameter diversity aims to gauge the diversity of generated outputs.
|
| 125 |
+
|
| 126 |
+
<table><tr><td>Metrics/ Method</td><td>CLIP Score</td></tr><tr><td>w/o TDA Ours</td><td>22.79 29.16</td></tr></table>
|
| 127 |
+
|
| 128 |
+
<table><tr><td>Metrics/ Method</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>w/o CA</td><td>21.51</td><td>3.6%</td><td>6.32</td></tr><tr><td>Ours</td><td>30.30</td><td>0.8%</td><td>7.34</td></tr></table>
|
| 129 |
+
|
| 130 |
+
(b) Ablation Study of Conceptualization Agent.
|
| 131 |
+
|
| 132 |
+
Table 1: Ablation Study. “w/o CA” indicates without the Conceptualization Agent, “w/o TDA” indicates without the Task Dispatch Agent.
|
| 133 |
+
|
| 134 |
+
Case Study of Task Dispatch Agent. For the Task Dispatch Agent, the CLIP score is measured using 100 initial scene descriptions, each appended with one additional subsequence instruction for each scene. Table 1 (a) shows that without the Task Dispatch Agent, the CLIP score dropped from 29.16 to 22.79. It is important to note that the Task Dispatch Agent primarily impacts the performance of subsequence instructions, as all functions are utilized for the initial instruction. These findings underscore the pivotal role of the Task Dispatch Agent in managing communication flow.
|
| 135 |
+
|
| 136 |
+
Case Study of conceptualization Agent. For the Conceptualization Agent, the CLIP score is measured using 100 initial scene descriptions. Table 1 (b) displays the results, indicating that without the
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 6: Conceptualization Agent Case Study. The enriched textual evidence demonstrates that the Conceptualization Agent provides essential knowledge for parameter inference (highlighted in green). For each subfigure, we compare the 3D model without (Top) and with (Bottom) agent. The models generated with the agent better match the text description than those without it .
|
| 140 |
+
|
| 141 |
+
Conceptualization Agent, both text alignments (CLIP score) and parameter diversity decreased significantly. Moreover, the failure rate increased substantially, which adversely impacts the efficiency of the entire modeling process. Figure 6 illustrates how the Conceptualization Agent facilitates the acquisition of essential knowledge for 3D modeling, providing a visual comparison of results with and without its involvement. When the Conceptualization Agent is engaged, the generated results closely align with the appearance of the intended flower type, highlighting its invaluable contribution to elevating overall 3D generation quality and fidelity.
|
| 142 |
+
|
| 143 |
+
# 5 DISCUSSION AND CONCLUSION
|
| 144 |
+
|
| 145 |
+
We have introduced 3D-GPT, a novel training-free framework for instruction-driven 3D modeling seamlessly integrated with procedural generation. Leveraging the capabilities of LLMs, 3DGPT aims to enhance human-AI communication in the context of 3D design. Our approach involves the collaborative efforts of three agents functioning as a cohesive 3D modeling team, ultimately yielding a 3D modeling file as output, as opposed to conventional 3D neural representations. Moreover, our method consistently delivers high-quality results, showcases adaptability to expansive scenes, ensures 3D consistency, provides material modeling and editing capabilities, and facilitates real ray tracing for achieving lifelike visualizations. Our empirical experiments show the potential of LLMs for reasoning, planning, and tool using in procedural 3D modeling.
|
| 146 |
+
|
| 147 |
+
Limitations and Potential Directions. While our framework has demonstrated promising 3D modeling results closely aligned with user instructions, it is essential to acknowledge several limitations: 1) Limited curve control and shading design: Currently, our framework lacks advanced capabilities for precise curve control and intricate shading design. Tasks involving the manipulation of tree branches or the blending of colors for leaf textures remain challenging. 2) Dependence on procedural generation algorithms: the effectiveness of our framework is contingent on the quality and availability of procedural generation algorithms. This reliance may limit results in specific categories, such as hair and fur. 3) Handling multi-modal instructions: challenges arise in processing multi-modal instructions, including audio and image inputs, potentially leading to information loss. These limitations offer valuable insights for shaping future research and development in the field. We highlight three compelling directions for future investigation:
|
| 148 |
+
|
| 149 |
+
LLM 3D Fine-Tuning: It is promising to fine-tune LLMs to enhance their capabilities in geometry control, shading design, and fine-texture modeling. This refinement will make LLMs more adept at handling intricate 3D modeling tasks and grant greater creative control over the resulting 3D scenes. Autonomous Rule Discovery: Building on the demonstrated tool-making capabilities of LLMs, one direction is to develop an autonomous 3D modeling system that reduces human involvement. This could empower LLMs to autonomously discover generation rules for new object classes and scenes, thus expanding the creative potential.
|
| 150 |
+
|
| 151 |
+
Multi-Modal Instruction Processing: To achieve more comprehensive and expressive 3D modeling based on varied user inputs, it is crucial to enhance the system’s ability to comprehend and respond to multi-modal instructions. This would facilitate richer and more diverse 3D modeling outcomes, shaped by a broader spectrum of user inputs.
|
| 152 |
+
|
| 153 |
+
# REFERENCES
|
| 154 |
+
|
| 155 |
+
Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece ´ Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with GPT-4. arXiv preprint arXiv:2303.12712, 2023.
|
| 156 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. PaLM: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
|
| 157 |
+
Matt Deitke, Eli VanderBilt, Alvaro Herrasti, Luca Weihs, Kiana Ehsani, Jordi Salvador, Winson Han, Eric Kolve, Aniruddha Kembhavi, and Roozbeh Mottaghi. ProcTHOR: Large-scale embodied ai using procedural generation. Advances in Neural Information Processing Systems, 35: 5982–5994, 2022.
|
| 158 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 159 |
+
Lijie Fan, Dilip Krishnan, Phillip Isola, Dina Katabi, and Yonglong Tian. Improving clip training with language rewrites. arXiv preprint arXiv:2305.20088, 2023.
|
| 160 |
+
Ran Gong, Qiuyuan Huang, Xiaojian Ma, Hoi Vo, Zane Durante, Yusuke Noda, Zilong Zheng, Song-Chun Zhu, Demetri Terzopoulos, Li Fei-Fei, and Jianfeng Gao. MindAgent: Emergent gaming interaction. arXiv preprint arXiv:2309.09971, 2023.
|
| 161 |
+
Klaus Greff, Francois Belletti, Lucas Beyer, Carl Doersch, Yilun Du, Daniel Duckworth, David J Fleet, Dan Gnanapragasam, Florian Golemo, Charles Herrmann, Thomas Kipf, Abhijit Kundu, Dmitry Lagun, Issam Laradji, Hsueh-Ti (Derek) Liu, Henning Meyer, Yishu Miao, Derek Nowrouzezahrai, Cengiz Oztireli, Etienne Pot, Noha Radwan, Daniel Rebain, Sara Sabour, Mehdi S. M. Sajjadi, Matan Sela, Vincent Sitzmann, Austin Stone, Deqing Sun, Suhani Vora, Ziyu Wang, Tianhao Wu, Kwang Moo Yi, Fangcheng Zhong, and Andrea Tagliasacchi. Kubric: A scalable dataset generator. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3749–3761, 2022.
|
| 162 |
+
Ju He, Enyu Zhou, Liusheng Sun, Fei Lei, Chenyang Liu, and Wenxiu Sun. Semi-synthesis: A fast way to produce effective datasets for stereo matching. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2884–2893, 2021.
|
| 163 |
+
Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, pp. 9118–9147, 2022.
|
| 164 |
+
Wenlong Huang, Chen Wang, Ruohan Zhang, Yunzhu Li, Jiajun Wu, and Li Fei-Fei. VoxPoser: Composable 3D value maps for robotic manipulation with language models. arXiv preprint arXiv:2307.05973, 2023.
|
| 165 |
+
Shima Imani, Liang Du, and Harsh Shrivastava. Mathprompter: Mathematical reasoning using large language models. arXiv preprint arXiv:2303.05398, 2023.
|
| 166 |
+
Ajay Jain, Ben Mildenhall, Jonathan T Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 867–876, 2022.
|
| 167 |
+
Katharina Jeblick, Balthasar Schachtner, Jakob Dexl, Andreas Mittermeier, Anna Theresa Stuber, ¨ Johanna Topalis, Tobias Weber, Philipp Wesp, Bastian Sabel, Jens Ricke, and Michael Ingrisch. ChatGPT makes medicine easy to swallow: An exploratory case study on simplified radiology reports. arXiv preprint arXiv:2212.14882, 2022.
|
| 168 |
+
Chenfanfu Jiang, Siyuan Qi, Yixin Zhu, Siyuan Huang, Jenny Lin, Lap-Fai Yu, Demetri Terzopoulos, and Song-Chun Zhu. Configurable 3D scene synthesis and 2D image rendering with per-pixel ground truth using stochastic grammars. International Journal of Computer Vision, 126:920–941, 2018.
|
| 169 |
+
Chen-Hsuan Lin, Jun Gao, Luming Tang, Towaki Takikawa, Xiaohui Zeng, Xun Huang, Karsten Kreis, Sanja Fidler, Ming-Yu Liu, and Tsung-Yi Lin. Magic3D: High-resolution text-to-3D content creation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 300–309, 2023.
|
| 170 |
+
Minghua Liu, Chao Xu, Haian Jin, Linghao Chen, Zexiang Xu, Hao Su, et al. One-2-3-45: Any single image to 3D mesh in 45 seconds without per-shape optimization. arXiv preprint arXiv:2306.16928, 2023.
|
| 171 |
+
Luke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: 360 reconstruction of any object from a single image. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2023.
|
| 172 |
+
Sachit Menon and Carl Vondrick. Visual classification via description from large language models. arXiv preprint arXiv:2210.07183, 2022.
|
| 173 |
+
Gal Metzer, Elad Richardson, Or Patashnik, Raja Giryes, and Daniel Cohen-Or. Latent-NeRF for shape-guided generation of 3D shapes and textures. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12663–12673, 2023.
|
| 174 |
+
Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. NeRF: Representing scenes as neural radiance fields for view synthesis. Communications of the ACM, 65(1):99–106, 2021.
|
| 175 |
+
Nasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Tiberiu Popa. CLIP-Mesh: Generating textured meshes from text using pretrained image-text models. In SIGGRAPH Asia 2022 conference papers, pp. 1–8, 2022.
|
| 176 |
+
OpenAI. GPT-4 technical report, 2023.
|
| 177 |
+
Ben Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. DreamFusion: Text-to-3D using 2D diffusion. arXiv preprint arXiv:2209.14988, 2022.
|
| 178 |
+
Sarah Pratt, Ian Covert, Rosanne Liu, and Ali Farhadi. What does a platypus look like? generating customized prompts for zero-shot image classification. arXiv preprint arXiv:2209.03320, 2022.
|
| 179 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748–8763. PMLR, 2021.
|
| 180 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020.
|
| 181 |
+
Alexander Raistrick, Lahav Lipson, Zeyu Ma, Lingjie Mei, Mingzhe Wang, Yiming Zuo, Karhan Kayan, Hongyu Wen, Beining Han, Yihan Wang, Alejandro Newell, Hei Law, Ankit Goyal, Kaiyu Yang, and Jia Deng. Infinite photorealistic worlds using procedural generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12630–12641, 2023.
|
| 182 |
+
Amit Raj, Srinivas Kaza, Ben Poole, Michael Niemeyer, Ben Mildenhall, Nataniel Ruiz, Shiran Zada, Kfir Aberman, Michael Rubenstein, Jonathan Barron, Yuanzhen Li, and Varun Jampani. DreamBooth3D: Subject-driven text-to-3D generation. In Proceedings of the International Conference on Computer Vision, 2023.
|
| 183 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10684–10695, 2022.
|
| 184 |
+
Aditya Sanghi, Hang Chu, Joseph G Lambourne, Ye Wang, Chin-Yi Cheng, Marco Fumero, and Kamal Rahimi Malekshan. CLIP-Forge: Towards zero-shot text-to-shape generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18603–18613, 2022.
|
| 185 |
+
Zhengyi Wang, Cheng Lu, Yikai Wang, Fan Bao, Chongxuan Li, Hang Su, and Jun Zhu. ProlificDreamer: High-fidelity and diverse text-to-3d generation with variational score distillation. arXiv preprint arXiv:2305.16213, 2023.
|
| 186 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35:24824–24837, 2022.
|
| 187 |
+
Jiale Xu, Xintao Wang, Weihao Cheng, Yan-Pei Cao, Ying Shan, Xiaohu Qie, and Shenghua Gao. Dream3D: Zero-shot text-to-3D synthesis using 3D shape prior and text-to-image diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 20908–20918, 2023.
|
| 188 |
+
Kailai Yang, Shaoxiong Ji, Tianlin Zhang, Qianqian Xie, and Sophia Ananiadou. On the evaluations of ChatGPT and emotion-enhanced prompting for mental health analysis. arXiv preprint arXiv:2304.03347, 2023.
|
| 189 |
+
Andy Zeng, Maria Attarian, Brian Ichter, Krzysztof Choromanski, Adrian Wong, Stefan Welker, Federico Tombari, Aveek Purohit, Michael Ryoo, Vikas Sindhwani, Johnny Lee, Vincent Vanhoucke, and Pete Florence. Socratic models: Composing zero-shot multimodal reasoning with language. arXiv preprint arXiv:2204.00598, 2022.
|
| 190 |
+
Ceyao Zhang, Kaijie Yang, Siyi Hu, Zihao Wang, Guanghe Li, Yihang Sun, Cheng Zhang, Zhaowei Zhang, Anji Liu, Song-Chun Zhu, Xiaojun Chang, Junge Zhang, Feng Yin, Yitao Liang, and Yaodong Yang. Proagent: Building proactive cooperative ai with large language models. arXiv preprint arXiv:2308.11339, 2023a.
|
| 191 |
+
Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image
|
| 192 |
+
|
| 193 |
+
diffusion models. In IEEE International Conference on Computer Vision (ICCV), 2023b.
|
| 194 |
+
|
| 195 |
+
# 6 APPENDIX
|
| 196 |
+
|
| 197 |
+
# 6.1 ADDITIONAL RESULT
|
| 198 |
+
|
| 199 |
+
We kindly request the reader to consider visiting https://anonymous0888.github.io/ 3DGPT/3dgpt.html to view our high-quality 3D results.
|
| 200 |
+
|
| 201 |
+
# 6.2 ADDITIONAL ABLATION STUDY
|
| 202 |
+
|
| 203 |
+
We conduct three distinct ablation studies examining prompting components (Table 2), various Large Language Models (Table 3), and example numbers (Table 4).
|
| 204 |
+
|
| 205 |
+
Table 2: Ablation Study of Prompting Components D/C/I/E.
|
| 206 |
+
|
| 207 |
+
<table><tr><td>Metrics/Method</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>w/o D</td><td>20.7</td><td>4.2%</td><td>6.94</td></tr><tr><td>w/o C</td><td>28.4</td><td>1.8%</td><td>6.74</td></tr><tr><td>w/oI</td><td>21.6</td><td>1.4%</td><td>6.38</td></tr><tr><td>w/oE</td><td>24.5</td><td>3.4%</td><td>7.89</td></tr><tr><td>Ours</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr></table>
|
| 208 |
+
|
| 209 |
+
Table 3: Ablation Study of Different Large Language Model.
|
| 210 |
+
|
| 211 |
+
<table><tr><td>Metrics/Model</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>LLAMA2</td><td>29.7</td><td>1.4%</td><td>6.97</td></tr><tr><td>GPT4</td><td>31.2</td><td>0.6%</td><td>7.23</td></tr><tr><td>GPT3.5</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr></table>
|
| 212 |
+
|
| 213 |
+
Table 4: Ablation Study of Example Number.
|
| 214 |
+
|
| 215 |
+
<table><tr><td>Metrics/Shots</td><td>CLIP Score</td><td>Failure Rate</td><td>Parameter Diversity</td></tr><tr><td>0</td><td>24.5</td><td>3.4%</td><td>7.89</td></tr><tr><td>1</td><td>30.3</td><td>0.8%</td><td>7.34</td></tr><tr><td>2</td><td>30.1</td><td>1.0%</td><td>7.23</td></tr><tr><td>3</td><td>30.2</td><td>0.8%</td><td>6.93</td></tr></table>
|
| 216 |
+
|
| 217 |
+

|
| 218 |
+
DreamFusion
|
| 219 |
+
Ours
|
| 220 |
+
DreamFusion
|
| 221 |
+
“A misty spring morning, where dew-kissed flowers dot a lush meadow surrounded by budding trees.”
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
Ours
|
| 225 |
+
|
| 226 |
+
Ours
|
| 227 |
+
|
| 228 |
+
DreamFusion
|
| 229 |
+
|
| 230 |
+

|
| 231 |
+
|
| 232 |
+

|
| 233 |
+
���A vibrant autumn forest, with trees ablaze in shades of red, orange, and gold, as a gentle breeze rustles the fallen leaves.”
|
| 234 |
+
|
| 235 |
+
“A serene winter landscape, with snow-covered evergreen trees and a frozen lake reflecting the pale sunlight.”
|
| 236 |
+
|
| 237 |
+
“The mountains, majestic and snow-capped, stood like sentinels guarding the vast expanse of the valley, their peaks disappearing into the swirling mist that clung to their rugged slopes.”
|
| 238 |
+
|
| 239 |
+
“The desert, an endless sea of shifting sands, stretched to the horizon, its rippling dunes catching the golden rays of the setting sun, creating an everchanging landscape of shadows and light.”
|
| 240 |
+
|
| 241 |
+

|
| 242 |
+
Figure 7: Comparison with Dreamfusion (Scene).
|
| 243 |
+
|
| 244 |
+

|
| 245 |
+
“The lake, serene and glassy, mirrored the cloudless sky above, reflecting the surrounding mountains and the graceful flight of a heron, as lily pads floated like emerald jewels upon its tranquil surface."
|
| 246 |
+
|
| 247 |
+

|
| 248 |
+
Figure 8: Comparison with Dreamfusion (Single Object).
|
| 249 |
+
|
| 250 |
+
# 6.3 COMPARISON WITH TEXT-TO-3D
|
| 251 |
+
|
| 252 |
+
We offer side-by-side comparisons with a state-of-the-art Text-to-3D method Dreamfusion (Poole et al., 2022) for single objects and scene, as illustrated in Figure 8 and Figure 7, respectively.
|
| 253 |
+
|
| 254 |
+
# 6.4 IMPLEMENTATION DETAIL
|
| 255 |
+
|
| 256 |
+
We provide the code that enumerates the functions within Infinigen used in constructing our 3D scene. While a similar Python file can be found at https://github.com/princeton-vl/ infinigen/blob/main/worldgen/generate.py, our script is uniquely tailored to work with a control dictionary generated by three agents, enabling controllable scene generation.
|
| 257 |
+
|
| 258 |
+

|
| 259 |
+
|
| 260 |
+

|
| 261 |
+
Listing 1: Agent Implementation Example
|
| 262 |
+
|
| 263 |
+
We offer the code to implement the modeling agent as a demonstration of how to utilize the OpenAI API for implementing our agent.
|
| 264 |
+
|
| 265 |
+
def modeling_function_call(text_description,function_description, function, 2 function_document,example,max_tokens $= 2 0 0 0$ , temperature ${ } = 0$ .3,history $= [ ~ ]$ ): 3 """ 4 Give a short text, call the given functions to generation objects/ scene to fit the given text description Parameters 6 text_description: short user given text. 8 function_description: short function description. 9 function: python code. 10 function_document: the detail description of the function. 11 example: example of how to use the function. 12 max_tokens: max tokens for the detailed text. 13 temperature 14 Returns 15 16 response from the agent that contains the function calls. 17 """ 18 if(len(history) $\scriptstyle = = 0$ ): 19 history $=$ [ 20 {"role":"system", "content":"You are a good 3D designer who can convert long text descriptions into parameters, and is good at understanding Python functions to manipulate 3D content. "}, 21 22 messages $=$ history 23 24 text $=$ f"""We have the following function codes function_description} to control blender by python : {function}. 25 Following are the document for function: {function_document}. 26 Below is an example bout how to make function calls to model the scene to fit the description: {example}. 27 Question: Given the text description: {text_description} analysis the function parameter and call the function to { function_description}""" 28 messages.append({"role": "user","content":text}) 29 30 conceptualization_augmentation_model $=$ openai.ChatCompletion.create ( 31 model $=$ "gpt-3.5-turbo", 32 temperature $=$ temperature,
|
| 266 |
+
|
| 267 |
+
<table><tr><td>33</td><td>max_tokens = max_tokens,</td></tr><tr><td>34</td><td>messages = messages</td></tr><tr><td>35</td><td></td></tr><tr><td>36</td><td></td></tr><tr><td>37</td><td>conceptualization_text = conceptualization_augmentation_model.</td></tr><tr><td>38</td><td>choices[0].message["content"] return conceptualization_text,messages</td></tr></table>
|
| 268 |
+
|
| 269 |
+
# 6.5 DISCUSSION OF FUNCTION SET SIZE
|
| 270 |
+
|
| 271 |
+
Assessing the impact of function set size and parameter count can be complex due to variations in function significance. In Figure 9, we can see that removing rock modeling has a minimal impact on the modeling outcome. On the other hand, eliminating the water modeling function makes river modeling impossible, leading to a significant reduction in the alignment between the generated 3D scene and the text description.
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Listing 2: Agent Implementation Example
|
| 275 |
+
(a). Remove rock modeling
|
| 276 |
+
|
| 277 |
+

|
| 278 |
+
(b). Remove water modeling
|
| 279 |
+
|
| 280 |
+

|
| 281 |
+
(c). Full function set
|
| 282 |
+
Figure 9: Ablation study of Different Function Set
|
| 283 |
+
|
| 284 |
+
“The lake, serene and glassy, mirrored the cloudless sky above, reflecting the surrounding mountains and the graceful flight of a heron, as lily pads floated like emerald jewels upon its tranquil surface."
|
| 285 |
+
|
| 286 |
+
# 6.6 ABLATION STUDY DETAILS
|
| 287 |
+
|
| 288 |
+
We conduct separate ablation studies for the Conceptualization Agent and Task Dispatch Agent, evaluating their performance based on CLIP scores, failure rates, and parameter diversity.
|
| 289 |
+
|
| 290 |
+
We use the implementation of Radford et al. (2021) to calculate CLIP score. It measures cosine similarity in the CLIP hidden space, indicating the alignment between generated images and text descriptions. For 3D scene CLIP scores, we placed a camera at the scene’s center, capturing 50 images by rotating the camera 360 degrees. In the Conceptualization Agent evaluation, we used only the initial instruction. For the Task Dispatch Agent, both the initial instruction and one subsequence instruction were used.
|
| 291 |
+
|
| 292 |
+
The failure rate reflects the Modeling Agent’s response. Failures can occur when the method cannot extract the correct pattern via the parser, generates data with an incorrect datatype, or omits/adds parameters to the function call. We evaluated five functions for each scene, recording the failure rate. We also assessed 500 parameters per scene, employing the Shannon Diversity Index to measure parameter diversity, and categorizing float parameters into 100 bins.
|
| 293 |
+
|
| 294 |
+
# 6.7 AGENT RESPONSES
|
| 295 |
+
|
| 296 |
+
Figure 10, Figure 11 and Figure 12 demonstrate how the system communicates with Task Dispatch Agent, Conceptualization Agent, and Modeling Agent, respectively. The Task Dispatch Agent example is deliberately simplified, featuring only four functions to ensure conciseness. In contrast, the examples for the Conceptualization Agent and Modeling Agent are derived from our comprehensive implementation.
|
| 297 |
+
|
| 298 |
+
You are a proficient planner for selecting suitable functions based on user instructions. You are provided with the following functions: 1. generate_terrain(): model the 3D terrain.
|
| 299 |
+
2. generate_tree(): generate trees with parameters that controls the tree appearance and place them on the terrain surface.
|
| 300 |
+
3. add_grass(): add grass to the terrain surface()
|
| 301 |
+
4. apply_snow_layer(): add snow to the surface of all objects.
|
| 302 |
+
Below are examples of how to choose functions based on user instructions:
|
| 303 |
+
User: My instruction is: "Change weather to snowy." Answer: Based on the function provided above and the user instruction, the apply_snow_layer() function from above function set is suitable to call. It will add snow to all objects covered by snow and make it look like a snowy scene. Other functions (1,2,3) are not relevant to the user instruction. Given the instructions, we determine the sublist of functions that need to be used for 3D modeling: [4]
|
| 304 |
+
User: My instruction is: “Change tree leaf to yellow." Based on the user instruction, "Change tree leaf to yellow," you can use the generate_tree() function to generate trees with yellow leaves. You can modify the parameters of the generate_tree() function to control the appearance of the trees, including the color of their leaves. Other functions (1, 3, 4) are not relevant to changing the color of tree leaves. Given the instructions, we determine the sublist of functions that need to be used for 3D modeling:
|
| 305 |
+
[2]
|
| 306 |
+
So, the suitable function to call in this case is generate_tree() with the appropriate parameters for yellow leaves. Given a text description "A peaceful clearing in a dense forest, blanketed in fresh, untouched snow. Tall birch trees, their white bark standing out starkly against the dark evergreens and the gray, overcast sky, form a natural cathedral.", provide detailed descriptions for the following information: "possible daytime, sun intensity, air condition, sky appearance, cloud density.”.
|
| 307 |
+
For term not mentioned in the description, use your imagination to ensure they fit the text description.
|
| 308 |
+
|
| 309 |
+
Figure 10: Communication Between System and Task Dispatch Agent.
|
| 310 |
+
|
| 311 |
+

|
| 312 |
+
Figure 11: Communication Between System and Conceptualization Agent.
|
| 313 |
+
|
| 314 |
+
# 6.8 VISUAL RESULT
|
| 315 |
+
|
| 316 |
+
Figure 13 and Figure 14 show the prompts for modelling trees and sky. The visual control result for a full scene is illustrated in Figure 15.
|
| 317 |
+
|
| 318 |
+
We have the following function codes modelling the sky appearance using nishita method to control blender by python :
|
| 319 |
+
\`\`python
|
| 320 |
+
import nishita_sky_modelling def sky_texture_node(sun_intensity,sun_elevation,sun_rotation,air_density,dust_density, ozone,cloud_density): texture = nishita_sky_modelling(sun_intensity,sun_elevation,sun_rotation,air_density,dust_density, ozone,cloud_density) return
|
| 321 |
+
Following are the document for function: “ input:
|
| 322 |
+
sun_intensity: Multiplier for sun disc lighting. (choose from ‘low’,’median’,’high’)
|
| 323 |
+
sun_elevation: Rotation of the sun from the horizon (in degrees). (0:sunset,sun rising, 90:daytime,-10:night)
|
| 324 |
+
sun_rotation: Rotation of the sun around the zenith (in degrees). air_density: density of air molecules. (0 no air, 1 clear day atmosphere, 2 highly polluted day)
|
| 325 |
+
dust_density: density of dust and water droplets. (0 no dust, 1 clear day atmosphere, 5 city like atmosphere, 10 hazy day) ozone: density of ozone molecules; useful to make the sky appear bluer. (0 no ozone, 1 clear day atmosphere, 2 city like atmosphere).
|
| 326 |
+
higher value for bluer sky.
|
| 327 |
+
cloud_density: density of the cloud, varying from 0 to 0.04. (0.01 very thick cloud, 0.04 very heavy cloud) output: texture color output.” Below is an example bout how to make function calls to model the scene to fit the description: Question: given the text description of the scene: “The river, reflecting the clear blue of the sky, glistened like a silver ribbon as it wound
|
| 328 |
+
its way through the lush valley, its tranquil waters whispering secrets to the ancient trees.” analysis the function parameter and call the
|
| 329 |
+
function to generate the sky.
|
| 330 |
+
Solution: From the description of “clear blue sky”, the sun_intensiy can not be low, let's set it as "median";As the sky is blue, the
|
| 331 |
+
sun_elevation cannot be very low (not morning/sunset/evening), we can set it to 50. The sun rotation does not affect the sky appearance, let's set it to 0. To fit the description of "clear blue". The air_density and
|
| 332 |
+
dust_density should be low, we can set air_density to 1, dust_density to 0. To make the sky more blue, we can increase the ozone value,
|
| 333 |
+
let’s make it as 2. As the sky is very blue and clear, the cloud density should be low, we can set it as 0.0005. We can model the sky by calling the following
|
| 334 |
+
function: \`\`\`python sky_texture_node(sun_intensity = ‘median’,sun_elevation=50,sun_rotation=0,air_density=1,dust_density=0,
|
| 335 |
+
ozone=2,cloud_density=0.0005)\`\`\` Question: Given the text description: “A peaceful clearing in a dense forest, blanketed in fresh, untouched snow. Tall birch trees, their
|
| 336 |
+
white bark standing out starkly against the dark evergreens and the gray, overcast sky, form a natural cathedral. In this peaceful clearing, the
|
| 337 |
+
scene is bathed in the soft glow of early morning light. The sun, just beginning to rise above the horizon, casts a gentle, golden hue across
|
| 338 |
+
the landscape. Its intensity is subdued, as if still gathering strength to break through the thick canopy of trees that surround the clearing.
|
| 339 |
+
The air in the clearing is crisp and cool, carrying with it a hint of winter's bite. It is still and calm, devoid of any breeze or gusts that might
|
| 340 |
+
disturb the tranquility of the scene. The air feels pure and invigorating, as if it has been untouched by human presence.
|
| 341 |
+
Looking up towards the sky, the overcast conditions create a muted, gray backdrop. The clouds hang low, their edges blending seamlessly
|
| 342 |
+
with the horizon, creating a sense of enclosure within the clearing. The sky appears vast, yet somehow intimate, as if it is a part of the
|
| 343 |
+
natural cathedral formed by the towering birch trees.
|
| 344 |
+
The cloud density is moderate, with the clouds spread out across the sky in a gentle, billowing fashion. They are not heavy or oppressive, but
|
| 345 |
+
rather wispy and ethereal, adding a touch of mystery to the scene. As the day progresses, the clouds shift and change shape, creating a
|
| 346 |
+
dynamic and ever-evolving canvas above the clearing.
|
| 347 |
+
Overall, the daytime in this clearing is characterized by a serene ambiance, with the sun‘s gentle rays filtering through the dense forest and
|
| 348 |
+
the sky adorned with a delicate veil of clouds. It is a scene that invites contemplation and reflection, a sanctuary of tranquility amidst the
|
| 349 |
+
wild beauty of nature.” analysis the function parameter and call the function to modelling the sky appearance using nishita method. Based on the description, we can analyze the function parameters as follows:
|
| 350 |
+
- sun_intensity: The description mentions a "soft glow of early morning light" and the sun's intensity is described as "subdued". Let's set the sun_intensity to 'low'.
|
| 351 |
+
- sun_elevation: The sun is described as "just beginning to rise above the horizon". Let's set the sun_elevation to -5.
|
| 352 |
+
- sun_rotation: The description does not provide any specific information about the sun's rotation, so we can set it to 0.
|
| 353 |
+
- air_density: The air is described as "crisp and cool" and "untouched by human presence". Let's set the air_density to 0.
|
| 354 |
+
- dust_density: The description does not mention any dust or particles in the air, so we can set the dust_density to 0.
|
| 355 |
+
- ozone: The description does not provide any specific information about the ozone density, so we can set it to 1.
|
| 356 |
+
- cloud_density: The clouds are described as "moderate" and "spread out across the sky in a gentle, billowing fashion". Let's set the cloud_density to 0.02.
|
| 357 |
+
We can model the sky by calling the following function:
|
| 358 |
+
\`\`\`python
|
| 359 |
+
sky_texture_node(sun_intensity='low', sun_elevation=-5, sun_rotation=0, air_density=0, dust_density=0, ozone=1, cloud_density=0.02)
|
| 360 |
+
|
| 361 |
+
Figure 12: Communication Between System and Modeling Agent.
|
| 362 |
+
|
| 363 |
+
# Document:
|
| 364 |
+
|
| 365 |
+
Explanation: The function takes a built natural scene as input and adds base trees to it.
|
| 366 |
+
|
| 367 |
+
# Inputs:
|
| 368 |
+
|
| 369 |
+
scene: The built natural scene.
|
| 370 |
+
density(float): The density of the trees.
|
| 371 |
+
distance_min(float): Minimum distance between trees.
|
| 372 |
+
|
| 373 |
+
eaf_type(string): The type of leaf on the tree. Select one from the list [‘leaf’, ‘leaf_broadleaf’, ‘leaf_ginko’, ‘leaf_maple’, ‘flower’, ‘N
|
| 374 |
+
|
| 375 |
+
‘Leaf’ allows further custom settings like changing the leaf shape and color. ‘Leaf_broadleaf’, ‘leaf_ginko’, and ‘leaf_maple’ build the leaves with predefined shapes: broad, ginko, and maple respectively. ‘Flower’ will create flowers on the tree instead of leaves. ‘None’ will not generate leaves on the tree.
|
| 376 |
+
|
| 377 |
+
fruit_type(string): The type of fruit on the tree. Select one from the list [‘apple’, ‘blackberry’, ‘coconut_green’, ‘durian’, ‘starfruit’, ‘strawberry’, ‘custom_fruit’, ‘None’]. Each of the fruit types will create the corresponding fruit on the tree. ‘Custom_fruit’ can create customizable fruit on the tree with further adjustments. If the desired fruit is not on the list, ‘custom_fruit’ should be chosen. ‘None’ will not generate any fruit on the tree.
|
| 378 |
+
|
| 379 |
+
<table><tr><td>Code:</td></tr><tr><td>"python</td></tr><tr><td>importTreeFactory</td></tr><tr><td>defadd_trees(scene,density,distance_min,leaf_type,fruit_type,leaf_deity):</td></tr><tr><td>trees=TreFactory.create(densityeaftypefruit_type,eafesity)#eatetre scene.placement(trees, distance_min) # place trees in the scene</td></tr><tr><td>return</td></tr><tr><td></td></tr></table>
|
| 380 |
+
|
| 381 |
+
# Information:
|
| 382 |
+
|
| 383 |
+
"Possible trees in the scene, tree types, leaf density, possible seasons, tree size, appearance of the tree branch, branch type, and leaf color."
|
| 384 |
+
|
| 385 |
+
# Example:
|
| 386 |
+
|
| 387 |
+
Question: Given the text description of the scene, analyze the function parameters and call the function to add more trees that fit the text description.
|
| 388 |
+
|
| 389 |
+
Solution: From the text description, three different types of trees are identified in the scene: birch, dogwood, and Japanese maple. From “a cluster of,” we infer the tree density is relatively high; let’s set it to 0.2. Birch tree leaves are typically oval or triangular, so let’s set the leaf type to ‘leaf’ to allow further customization. There are no fruits mentioned for the birch tree in the description. Given the scene likely depicts autumn, the leaf_density should not be too high; let’s set it to 0.02. For the dogwood tree, as the leaves are described as oval or elliptical with smooth edges, the leaf type is set to ‘leaf’. It is mentioned that “clusters of small, vibrant berries cling to its branches,” so we can choose the fruit_type as ‘blackberry’. The leaf_density is set to 0.02. For the Japanese maple tree, the leaf type is set to ‘leaf_maple’. No fruits are mentioned for the maple tree. As the scene likely takes place in autumn, the leaf density for the maple tree should be high; let’s set it to 0.1. The function can be called three times to create three different trees:
|
| 390 |
+
|
| 391 |
+
<table><tr><td>"python</td></tr><tr><td>add_tre(sesty0istacei,eatlaffruitNoe',eaesity.)#eae</td></tr><tr><td>adtreesiiyte</td></tr><tr><td>adtreilesi 1</td></tr></table>
|
| 392 |
+
|
| 393 |
+
# Document:
|
| 394 |
+
|
| 395 |
+
#
|
| 396 |
+
|
| 397 |
+
sun_intensity: Multiplier for sun disc lighting. (Choose from ‘low’, ‘median’, ‘high’)
|
| 398 |
+
sun_elevation: Rotation of the sun from the horizon (in degrees). (0: sunset, sun rising, 90: daytime, -10: night)
|
| 399 |
+
sun_rotation: Rotation of the sun around the zenith (in degrees).
|
| 400 |
+
air_density: Density of air molecules. (0: no air, 1: clear day atmosphere, 2: highly polluted day)
|
| 401 |
+
dust_density: Density of dust and water droplets. (0: no dust, 1: clear day atmosphere, 5: city-like atmosphere, 10: hazy day)
|
| 402 |
+
ozone: Density of ozone molecules; useful to make the sky appear bluer. (0: no ozone, 1: clear day atmosphere, 2: city-like atmosphere). A
|
| 403 |
+
|
| 404 |
+
igher value yields a bluer sky.
|
| 405 |
+
|
| 406 |
+
cloud_density: Density of the clouds, ranging from 0 to 0.04. (0.01: very thick cloud, 0.04: very heavy cloud)
|
| 407 |
+
|
| 408 |
+
# Output:
|
| 409 |
+
|
| 410 |
+
texture_color_output: The output texture color of the sky.
|
| 411 |
+
|
| 412 |
+
Code:
|
| 413 |
+
|
| 414 |
+
\`\`python import nishita_sky_modelling def sky_texture_node(sun_intensity, sun_elevation, sun_rotation, air_density, dust_density, ozone, cloud_density): texture $=$ nishita_sky_modelling.model_sky(sun_intensity, sun_elevation, sun_rotation, air_density, dust_density, ozone, cloud_density) return texture
|
| 415 |
+
|
| 416 |
+
# Information:
|
| 417 |
+
|
| 418 |
+
The time of day depicted in the scene (morning/noon/evening), the possible season, the condition of the air, the blueness of the sky, and the cloud density.
|
| 419 |
+
|
| 420 |
+
# Example:
|
| 421 |
+
|
| 422 |
+
# Question:
|
| 423 |
+
|
| 424 |
+
Given the text description of the scene: “The river, reflecting the clear blue of the sky, glistened like a silver ribbon as it wound its way through the lush valley, its tranquil waters whispering secrets to the ancient trees,” analyze the function parameters and call the function to generate the sky.
|
| 425 |
+
|
| 426 |
+
# Solution:
|
| 427 |
+
|
| 428 |
+
From the description of a “clear blue sky,” we infer that sun_intensity cannot be low, let's set it as "median". As the sky is clear and blue, the sun_elevation must not be very low, indicating it's not morning or evening; we can set it to 50 degrees.
|
| 429 |
+
|
| 430 |
+
Sun rotation does not impact the appearance of the sky significantly; thus, we will set it to 0 degrees. To align with the description of "clear blue," we should choose lower values for air_density and dust_density. Hence, we will set air_density to 1 and dust_density to 0. To enhance the blueness of the sky, we can increase the ozone value to 2.
|
| 431 |
+
|
| 432 |
+
As the description suggests a clear, blue sky, the cloud density must be low. Therefore, we will set it to 0.0005. The sky can be modeled by invoking the function as follows:
|
| 433 |
+
|
| 434 |
+

|
| 435 |
+
Figure 14: Prompt Example of Sky Modeling Function.
|
| 436 |
+
|
| 437 |
+

|
| 438 |
+
|
| 439 |
+

|
| 440 |
+
Figure 15: Single Function Control Result. Visual result (top) and modeling agent response example (bottom). Our method demonstrates a high degree of accuracy in inferring algorithm parameters, even when they do not possess a direct connection to visual appearance.
|
md/test/tzW948kU6x/tzW948kU6x.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/test/v8L0pN6EOi/v8L0pN6EOi.md
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LET’S VERIFY STEP BY STEP
|
| 2 |
+
|
| 3 |
+
Hunter Lightman∗, Vineet Kosaraju∗, Yura Burda∗, Harri Edwards, Bowen Baker,
|
| 4 |
+
Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever & Karl Cobbe∗
|
| 5 |
+
OpenAI
|
| 6 |
+
San Francisco, CA, USA
|
| 7 |
+
karl@openai.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
In recent years, large language models have greatly improved in their ability to perform complex multi-step reasoning. However, even state-of-the-art models still regularly produce logical mistakes. To train more reliable models, we can turn either to outcome supervision, which provides feedback for a final result, or process supervision, which provides feedback for each intermediate reasoning step. Given the importance of training reliable models, and given the high cost of human feedback, it is important to carefully compare the both methods. Recent work has already begun this comparison, but many questions still remain. We conduct our own investigation, finding that process supervision significantly outperforms outcome supervision for training models to solve problems from the challenging MATH dataset. Our process-supervised model solves $78 \%$ of problems from a representative subset of the MATH test set. Additionally, we show that active learning significantly improves the efficacy of process supervision. To support related research, we also release PRM800K, the complete dataset of 800,000 step-level human feedback labels used to train our best reward model.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Large language models are capable of solving tasks that require complex multi-step reasoning by generating solutions in a step-by-step chain-of-thought format (Nye et al., 2021; Wei et al., 2022; Kojima et al., 2022). However, even state-of-the-art models are prone to producing falsehoods — they exhibit a tendency to invent facts in moments of uncertainty (Bubeck et al., 2023). These hallucinations (Maynez et al., 2020) are particularly problematic in domains that require multi-step reasoning, since a single logical error is enough to derail a much larger solution. Detecting and mitigating hallucinations is essential to improve reasoning capabilities.
|
| 16 |
+
|
| 17 |
+
One effective method involves training reward models to discriminate between desirable and undesirable outputs. The reward model can then be used in a reinforcement learning pipeline (Ziegler et al., 2019; Stiennon et al., 2020; Nakano et al., 2021; Ouyang et al., 2022) or to perform search via rejection sampling (Nichols et al., 2020; Shen et al., 2021; Cobbe et al., 2021). While these techniques are useful, the resulting system is only as reliable as the reward model itself. It is therefore important that we study how to most effectively train reliable reward models.
|
| 18 |
+
|
| 19 |
+
In closely related work, Uesato et al. (2022) describe two distinct methods for training reward models: outcome supervision and process supervision. Outcome-supervised reward models (ORMs) are trained using only the final result of the model’s chain-of-thought, while process-supervised reward models (PRMs) receive feedback for each step in the chain-of-thought. There are compelling reasons to favor process supervision. It provides more precise feedback, since it specifies the exact location of any errors that occur. It also has several advantages relevant to AI alignment: it is easier for humans to interpret, and it more directly rewards models for following a human-endorsed chain-of-thought. Within the domain of logical reasoning, models trained with outcome supervision regularly use incorrect reasoning to reach the correct final answer (Zelikman et al., 2022; Creswell et al., 2022). Process supervision has been shown to mitigate this misaligned behavior (Uesato et al., 2022).
|
| 20 |
+
|
| 21 |
+
Despite these advantages, Uesato et al. (2022) found that outcome supervision and process supervision led to similar final performance in the domain of grade school math. We conduct our own detailed comparison of outcome and process supervision, with three main differences: we use a more capable base model, we use significantly more human feedback, and we train and test on the more challenging MATH dataset (Hendrycks et al., 2021).
|
| 22 |
+
|
| 23 |
+
Our main contributions are as follows:
|
| 24 |
+
|
| 25 |
+
1. We show that process supervision can train much more reliable reward models than outcome supervision. We use our state-of-the-art PRM to solve $7 8 . 2 \%$ of problems from a representative subset of the MATH test set.
|
| 26 |
+
2. We show that a large reward model can reliably approximate human supervision for smaller reward models, and that it can be used to efficiently conduct large-scale data collection ablations.
|
| 27 |
+
3. We show that active learning leads to a $2 . 6 \times$ improvement in the data efficiency of process supervision.
|
| 28 |
+
4. We release our full process supervision dataset, PRM800K, to promote related research.
|
| 29 |
+
|
| 30 |
+
# 2 METHODS
|
| 31 |
+
|
| 32 |
+
We perform a comparison of outcome and process supervision, following a similar methodology to Uesato et al. (2022). Outcome supervision can be provided without humans, since all problems in the MATH dataset have automatically checkable answers. In contrast, there is no simple way to automate process supervision. We therefore rely on human data-labelers to provide process supervision, specifically by labelling the correctness of each step in model-generated solutions.
|
| 33 |
+
|
| 34 |
+
We conduct experiments in two separate regimes: large-scale and small-scale. Each has its own advantages, and they offer complimentary perspectives. At large-scale, we finetune all models from GPT-4 (OpenAI, 2023). We focus on advancing the state-of-the-art by training the most reliable ORM and PRM possible. Unfortunately the training sets for these reward models are not directly comparable, for reasons we will discuss in Section 3. These models are therefore not ideal for making an apples-to-apples comparison of outcome and process supervision. To address this flaw, we also train models at small-scale, where we can conduct a more direct comparison. In order to remove our dependence on costly human feedback, we use a large-scale model to supervise small-scale model training. This setup enables us to conduct several important ablations that would otherwise be infeasible.
|
| 35 |
+
|
| 36 |
+
# 2.1 SCOPE
|
| 37 |
+
|
| 38 |
+
At each model scale, we use a single fixed model to generate all solutions. We call this model the generator. We do not attempt to improve the generator with reinforcement learning (RL). When we discuss outcome and process supervision, we are specifically referring to the supervision given to the reward model. We do not discuss any supervision the generator would receive from the reward model if trained with RL. Although finetuning the generator with RL is a natural next step, it is intentionally not the focus of this work.
|
| 39 |
+
|
| 40 |
+
We instead focus exclusively on how to train the most reliable reward model possible. We evaluate a reward model by its ability to perform best-of-N search over uniformly sampled solutions from the generator. For each test problem we select the solution ranked highest by the reward model, automatically grade it based on its final answer, and report the fraction that are correct. A reward model that is more reliable will select the correct solution more often.
|
| 41 |
+
|
| 42 |
+
# 2.2 BASE MODELS
|
| 43 |
+
|
| 44 |
+
All large-scale models are finetuned from the base GPT-4 model (OpenAI, 2023). This model has been pretrained solely to predict the next token; it has not been pretrained with any Reinforcement Learning from Human Feedback (RLHF) (Christiano et al., 2017). The small-scale base models are similar in design to GPT-4, but they were pretrained with roughly 200 times less compute. As an additional pretraining step, we finetune all models on a dataset of roughly 1.5B math-relevant tokens, which we call MathMix. Similar to Lewkowycz et al. (2022), we find that this improves the model’s mathematical reasoning capabilities. Details on how this dataset was constructed can be found in Appendix A.
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 1: A screenshot of the interface used to collect feedback for each step in a solution.
|
| 48 |
+
|
| 49 |
+
# 2.3 GENERATOR
|
| 50 |
+
|
| 51 |
+
To make parsing individual steps easier, we train the generator to produce solutions in a newline delimited step-by-step format. Specifically, we few-shot generate solutions to MATH training problems, filter to those that reach the correct final answer, and finetune the base model on this dataset for a single epoch. This step is not intended to teach the generator new skills; it is intended only to teach the generator to produce solutions in the desired format.
|
| 52 |
+
|
| 53 |
+
# 2.4 DATA COLLECTION
|
| 54 |
+
|
| 55 |
+
To collect process supervision data, we present human data-labelers with step-by-step solutions to MATH problems sampled by the large-scale generator. Their task is to assign each step in the solution a label of positive, negative, or neutral, as shown in Figure 1. A positive label indicates that the step is correct and reasonable. A negative label indicates that the step is either incorrect or unreasonable. A neutral label indicates ambiguity. In practice, a step may be labelled neutral if it is subtly misleading, or if it is a poor suggestion that is technically still valid. We permit neutral labels since this allows us to defer the decision about how to handle ambiguity: at test time, we can treat neutral labels as either positive or negative. A more detailed description of the labelling instructions is provided in Appendix D.
|
| 56 |
+
|
| 57 |
+
We label solutions exclusively from the large-scale generator in order to maximize the value of our limited human-data resource. We refer to the entire dataset of step-level labels collected as PRM800K. The PRM800K training set contains 800K step-level labels across 75K solutions to 12K problems. To minimize overfitting, we include data from 4.5K MATH test problems in the PRM800K training set, and we therefore evaluate our models only on the remaining 500 MATH test problems. More details about this test set can be found in Appendix C.
|
| 58 |
+
|
| 59 |
+
During data collection, we must decide which solutions to surface to data-labelers. The most straightforward strategy is to uniformly surface solutions produced by the generator. However, if we surface solutions that make obvious errors, the human feedback we get is less valuable. We would prefer to surface solutions that are more likely to fool our best reward model. To that end, we attempt to strategically select which solutions to show data-labelers. Specifically, we choose to surface convincing wrong-answer solutions. We use the term convincing to refer to solutions that are rated highly by our current best PRM, and we use wrong-answer to refer to solutions that reach an incorrect final answer. We use this slightly verbose phrasing to emphasize the fact that correctness is determined solely by checking the final answer, a process which occasionally leads to misgraded solutions. We expect to gain more information from labeling convincing wrong-answer solutions, since we know the PRM is mistaken about at least one step in each such solution.
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 2: Two solutions to the same problem, graded by the PRM. The solution on the left is correct while the solution on the right is incorrect. A green background indicates a high PRM score, and a red background indicates a low score. The PRM correctly identifies the mistake in the incorrect solution.
|
| 63 |
+
|
| 64 |
+
In addition to using this selection strategy, we also iteratively re-train our PRM using the latest data at several points in the data collection process. At each iteration, we generate N solutions per problem and surface only the top K most convincing wrong-answer solutions to data-labelers. We experiment with either applying this top-K filtering at a problem level (K solutions per problem) or globally across the dataset (K solutions in total, unequally distributed among problems). Since the data collection process is expensive, it was not feasible to conduct at-scale ablations of these decisions. However, we perform several surrogate ablations in Section 4, using our largest PRM as a labelling oracle for a smaller PRM. More details about data collection can be found in Appendix B.
|
| 65 |
+
|
| 66 |
+
# 2.5 OUTCOME-SUPERVISED REWARD MODELS (ORMS)
|
| 67 |
+
|
| 68 |
+
We train ORMs following a similar methodology to Cobbe et al. (2021). We uniformly sample a fixed number of solutions per problem from the generator, and we train the ORM to predict whether each solution is correct or incorrect. In practice, we usually determine correctness by automatically checking the final answer, but in principle these labels could be provided by humans. At test time, we use the ORM’s prediction at the final token as the overall score for the solution. We note the automatic grading used to determine ORM targets is not perfectly reliable: false positives solutions that reach the correct answer with incorrect reasoning will be misgraded. We discuss additional ORM training details in Appendix E.
|
| 69 |
+
|
| 70 |
+
# 2.6 PROCESS-SUPERVISED REWARD MODELS (PRMS)
|
| 71 |
+
|
| 72 |
+
We train PRMs to predict the correctness of each step after the last token in each step. This prediction takes the form of a single token, and we maximize the log-likelihood of these target tokens during training. The PRM can therefore be trained in a standard language model pipeline without any special accommodations. To determine the step-level predictions at test time, it suffices to perform a single PRM forward pass over the whole solution. We visualize large-scale PRM scores for two different solutions in Figure 2. To compare multiple solutions, it is necessary to compute a single score for each solution. This is an important but straightforward detail: we define the PRM score for a solution to be the probability that every step is correct under the PRM. We implement this as the product of the correctness probabilities for each step. We describe other possible scoring strategies and additional PRM training details in Appendix F.
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 3: A comparison of outcome-supervised and process-supervised reward models, evaluated by their ability to search over many test solutions. Majority voting is shown as a strong baseline. For $N \leq 1 0 0 0$ , we visualize the variance across many subsamples of the 1860 solutions we generated in total per problem.
|
| 76 |
+
|
| 77 |
+
When we provide process supervision, we deliberately choose to supervise only up to the first incorrect step. This makes the comparison between outcome and process supervision more straightforward. For correct solutions, both methods provide the same information, namely that every step is correct. For incorrect solutions, both methods reveal the existence of at least one mistake, and process supervision additionally reveals the precise location of that mistake. If we were to provide additional process supervision beyond the first mistake, then process supervision would have an even greater information advantage. This decision also keeps the labelling cost similar for humans: without relying on an easy-to-check final answer, determining the correctness of a solution is equivalent to identifying its first mistake. While most MATH problems do have easy-to-check final answers, we expect this to not remain true in more complex domains.
|
| 78 |
+
|
| 79 |
+
# 3 LARGE-SCALE SUPERVISION
|
| 80 |
+
|
| 81 |
+
We train the large-scale PRM using the step-level labels in PRM800K. To ensure the large-scale ORM baseline is as strong as possible, we train on 100 uniform samples per problem from the generator. This means the ORM training set has no overlap with PRM800K, and it is an order of magnitude larger. Although these two training sets are not directly comparable, each represents our best attempt to advance the state-of-the-art with each form of supervision. We note that training the ORM solely on PRM800K solutions would be problematic, since our active learning strategy has heavily biased the dataset towards wrong-answer solutions. We did explore training the ORM on a superset of PRM800K solutions, by mixing in uniformly sampled solutions, but we found that this did not improve ORM performance.
|
| 82 |
+
|
| 83 |
+
Figure 3 shows how the best-of-N performance of each reward model varies as a function of N. Since majority voting is known to be a strong baseline (Wang et al., 2022; Lewkowycz et al., 2022), we also include this method as a point of comparison. While the ORM performs slightly better than the majority voting baseline, the PRM strongly outperforms both. Not only does the PRM reach higher performance for all values of N, but the performance gap widens as $_ \mathrm { N }$ increases. This indicates that the PRM is more effective than both the ORM and majority voting at searching over a large number of model-generated solutions. We experimented with using RM-weighted voting (Li et al., 2022; Uesato et al., 2022) to combine the benefits of the PRM and majority voting, but this did not noticeably improve performance. We use a specific subset of the MATH test set for evaluation,
|
| 84 |
+
|
| 85 |
+
(a) Four series of reward models trained using different data collection strategies, compared across training sets of varying sizes.
|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
(b) Three reward models trained on 200 samples/problem using different forms of supervision, compared across many test-time compute budgets.
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
|
| 92 |
+
Figure 4: A comparison of different forms of outcome and process supervision. Mean and standard deviation is shown across three seeds.
|
| 93 |
+
|
| 94 |
+
which we describe in Appendix C. We further break down these results by problem difficulty in Appendix G.
|
| 95 |
+
|
| 96 |
+
# 4 SMALL-SCALE SYNTHETIC SUPERVISION
|
| 97 |
+
|
| 98 |
+
We find that the PRM outperforms the ORM at large-scale, but this result alone paints an incomplete picture. To better compare outcome and process supervision, there are two confounding factors that must be isolated. First, the training sets for the ORM and the PRM are not directly comparable: the PRM training set was constructed using active learning, is biased towards answer-incorrect solutions, and is an order of magnitude smaller. Second, the final-answer grading will provide positive labels to spurious solutions that reach the correct final answer despite incorrect reasoning. This could damage ORM performance, an effect we may or may not want to attribute to outcome supervision more generally.
|
| 99 |
+
|
| 100 |
+
Due to the high cost of collecting human feedback, we cannot easily ablate these factors using human labelers. We instead perform the relevant ablations by using the large-scale PRM to supervise smaller models. This setup enables us to simulate a large amount of data collection at a modest cost. For the remainder of this section, we refer to the large-scale PRM from Section 3 as $\mathrm { P R M _ { l a r g e } }$ .
|
| 101 |
+
|
| 102 |
+
# 4.1 PROCESS VS OUTCOME SUPERVISION
|
| 103 |
+
|
| 104 |
+
We now conduct a direct comparison of outcome and process supervision. We first sample between 1 and 200 solutions per problem from a small-scale generator. For each dataset, we provide three forms of supervision: process supervision from $\mathrm { P R M _ { l a r g e } }$ , outcome supervision from $\mathrm { P R M _ { l a r g e } }$ , and outcome supervision from final-answer checking. The choice of supervision is the only difference between these three series of reward models, which are otherwise trained on identical datasets. See Appendix H for more details about how $\mathrm { P R M _ { l a r g e } }$ is used for outcome and process supervision.
|
| 105 |
+
|
| 106 |
+
In Figure 4a, we evaluate each reward model by its best-of-500 selection. We see that process supervision significantly outperforms both forms of outcome supervision at all data collection scales. In Figure 4b, we evaluate the best reward model from each series by its best-of-N performance across different values of N. We see that using $\mathrm { P R M _ { l a r g e } }$ for outcome supervision is noticeably more effective than final-answer checking. This can be explained by the fact that $\mathrm { P R M _ { l a r g e } }$ provides better supervision for solutions that reach the correct final answer using incorrect reasoning.
|
| 107 |
+
|
| 108 |
+
It is not clear whether supervision by $\mathrm { P R M _ { l a r g e } }$ or by final-answer checking represents the more appropriate outcome supervision baseline. While final-answer supervision is more explicitly outcome based, its main weakness — the existence of false positives — is arguably over-emphasized in the
|
| 109 |
+
|
| 110 |
+
Table 1: We measure out-of-distribution generalization using recent STEM tests. We evaluate the outcome-supervised RM, the process-supervised RM, and majority voting using 100 test samples per problem.
|
| 111 |
+
|
| 112 |
+
<table><tr><td></td><td>ORM</td><td>PRM</td><td>Majority Vote</td><td>#Problems</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>AP Calculus</td><td>68.9%</td><td>86.7%</td><td>80.0%</td><td>45</td></tr><tr><td>AP Chemistry</td><td>68.9%</td><td>80.0%</td><td>71.7%</td><td>60</td></tr><tr><td>AP Physics</td><td>77.8%</td><td>86.7%</td><td>82.2%</td><td>45</td></tr><tr><td>AMC10/12</td><td>49.1%</td><td>53.2%</td><td>32.8%</td><td>84</td></tr><tr><td>Aggregate</td><td>63.8%</td><td>72.9%</td><td>61.3%</td><td>234</td></tr></table>
|
| 113 |
+
|
| 114 |
+
MATH dataset. Outcome supervision by $\mathrm { P R M _ { l a r g e } }$ better represents outcome supervision in domains that are less susceptible to false positives. We consider outcome supervision by $\mathrm { P R M _ { l a r g e } }$ to be the more relevant baseline, but we encourage the reader to draw their own conclusions.
|
| 115 |
+
|
| 116 |
+
# 4.2 ACTIVE LEARNING
|
| 117 |
+
|
| 118 |
+
Finally, we investigate the impact of active learning. We train a small-scale reward model, $\mathrm { P R M } _ { \mathrm { s e l e c t o r } }$ , on a single sample from each problem, and we use this model to score 1000 samples per problem. To train each of our larger reward models, we select $N$ samples per problem such that $8 0 \%$ are the most convincing (according to $\mathrm { P R M } _ { \mathrm { s e l e c t o r } } )$ ) wrong-answer samples, and $2 0 \%$ are the most convincing samples that remain (right- or wrong-answer). We score the selected samples with $\mathrm { P R M _ { l a r g e } }$ and train on those scores. This process ensures that all samples are relatively convincing under $\mathrm { \bar { P R M } } _ { \mathrm { s e l e c t o r } }$ , that a large fraction are known to contain at least one mistake, and that our overall dataset is not too heavily biased toward wrong-answer solutions. Performance of this data labelling scheme is shown in Figure 4a. By comparing the slopes of the line of best fit with and without active learning, we estimate that this form of active learning is approximately $2 . 6 \mathbf { x }$ more data efficient than uniform data labelling. We note that the model trained on the largest active learning dataset (200 samples per problem) appears to slightly underperform the expected trend line. Our best explanation for this observation is that 200 samples represents a significant fraction of the overall selection pool (1000 samples) and that this relative lack of diversity limits the possible upside from active learning.
|
| 119 |
+
|
| 120 |
+
We also performed a preliminary investigation into the impact of iteratively retraining $\mathrm { P R M } _ { \mathrm { s e l e c t o r } }$ throughout data collection. Between iterations, we re-trained $\mathrm { P R M } _ { \mathrm { s e l e c t o r } }$ using all currently labeled data. Unfortunately, we observed instability in this process which we were unable to diagnose. The resulting reward models performed no better than the models described above. We expect some form of iterative retraining to be beneficial in active learning, but we currently have no concrete evidence to support this claim. We consider this a compelling direction for future research.
|
| 121 |
+
|
| 122 |
+
# 5 OOD GENERALIZATION
|
| 123 |
+
|
| 124 |
+
To get some measure of out-of-distribution generalization, we evaluate our large-scale ORM and PRM on a held-out set of 224 STEM questions, pulled from the most recent AP Physics, AP Calculus, AP Chemistry, AMC10, and AMC12 exams. Since these tests were released after the pre-training dataset was compiled, we can have high confidence that the model has not seen these problems. We report the best-of-100 performance of the ORM, PRM and majority voting in Table 1. We observe results similar to those in Section 3: the PRM outperforms both the ORM and majority voting. This shows us that the PRM can tolerate a modest amount of distribution shift and that its strong performance holds up on fresh test questions.
|
| 125 |
+
|
| 126 |
+
# 6 DISCUSSION
|
| 127 |
+
|
| 128 |
+
# 6.1 CREDIT ASSIGNMENT
|
| 129 |
+
|
| 130 |
+
One clear advantage of process supervision is that it provides more precise feedback than outcome supervision. A reward model trained with outcome supervision faces a difficult credit-assignment task — to generalize well, it must determine where an incorrect solution went wrong. This is particularly difficult for hard problems: most model-generated solutions contain an error somewhere, so the marginal value of a negative label from outcome supervision is low. In contrast, process supervision provides a richer signal: it specifies both how many of the first steps were in fact correct, as well as the precise location of the incorrect step. Process supervision makes credit assignment easier, and we believe that this explains its strong performance.
|
| 131 |
+
|
| 132 |
+
# 6.2 ALIGNMENT IMPACT
|
| 133 |
+
|
| 134 |
+
Process supervision has several advantages over outcome supervision related to AI alignment. Process supervision is more likely to produce interpretable reasoning, since it encourages models to follow a process endorsed by humans. Process supervision is also inherently safer: it directly rewards an aligned chain-of-thought rather than relying on outcomes as a proxy for aligned behavior (Stuhlmuller & Byun, 2022). In contrast, outcome supervision is harder to scrutinize, and the prefer-¨ ences conveyed are less precise. In the worst case, the use of outcomes as an imperfect proxy could lead to models that become misaligned after learning to exploit the reward signal (Uesato et al., 2022; Cotra, 2022; Everitt et al., 2017).
|
| 135 |
+
|
| 136 |
+
In some cases, safer methods for AI systems can lead to reduced performance (Ouyang et al., 2022; Askell et al., 2021), a cost which is known as an alignment tax. In general, any alignment tax may hinder the adoption of alignment methods, due to pressure to deploy the most capable model. Our results show that process supervision in fact incurs a negative alignment tax. This could lead to increased adoption of process supervision, which we believe would have positive alignment sideeffects. It is unknown how broadly these results will generalize beyond the domain of math, and we consider it important for future work to explore the impact of process supervision in other domains.
|
| 137 |
+
|
| 138 |
+
# 6.3 TEST SET CONTAMINATION
|
| 139 |
+
|
| 140 |
+
The test set of the MATH dataset contains problems that are discussed in several online venues, and it is likely that some of these problems appear in the pretraining dataset for our models. We attempted to remove all MATH problems from our MathMix dataset using string-matching heuristics, but since humans can post hard-to-detect rephrasings of a problem online, it is difficult to make any strong guarantees about the overlap between MathMix and the MATH dataset.
|
| 141 |
+
|
| 142 |
+
In our experience inspecting model-generated solutions, we saw no clear signs of our models memorizing MATH problems. However, it is impossible to rule out subtle forms of memorization that would slip past manual inspection, and it is still possible that some degree of contamination has slightly inflated our performance on the MATH test set. Even in that case, we would expect any contamination to manifest similarly across all methods, and that the relative comparisons made throughout this work would remain mostly unaffected.
|
| 143 |
+
|
| 144 |
+
We also note that the PRM regularly surfaces correct solutions to MATH problems that have a low single-digit percentage solve-rate under the generator, some examples of which can be seen in Appendix I. The generator’s low solve-rate is an additional indication that it has not encountered such problems via test set contamination. Our generalization results from Section 5 further strengthen our claim that test set contamination has not significantly impacted this work, since we observe qualitatively similar results on problems that are guaranteed to be uncontaminated.
|
| 145 |
+
|
| 146 |
+
# 7 RELATED WORK
|
| 147 |
+
|
| 148 |
+
# 7.1 OUTCOME VS PROCESS SUPERVISION
|
| 149 |
+
|
| 150 |
+
In work closely related to our own, Uesato et al. (2022) compare the impact of outcome and process supervision in the domain of grade school math. They found that both methods led to similar finalanswer error rates, and that process supervision achieved those results with less data. While our core methodology is very similar, there are three main details that differ. First, we use a more capable model to collect PRM800K dataset and to perform our large-scale experiments. However, our small-scale results in Section 4 suggest that large-scale models are not necessary to observe benefits from process supervision. Second, we evaluate on the MATH dataset, which is significantly more challenging than GSM8K. Third, we collect a much larger quantity of process supervision data.
|
| 151 |
+
|
| 152 |
+
On the surface, the results from Uesato et al. (2022) may seem to conflict with our claim that process supervision leads to better performance. However, we believe the apparent conflict can be explained by the difference in the scale of the supervision. The data scaling trend in Figure 4a suggests that a small amount of process supervision and a large amount of outcome supervision do in fact lead to similar performance, consistent with the results from Uesato et al. (2022). The trend also shows that process supervision beats outcome supervision when scaled up, even when judged based solely on outcomes. This is consistent with our results in Section 3. We believe these results make a strong case for using process supervision.
|
| 153 |
+
|
| 154 |
+
# 7.2 SYNTHETIC SUPERVISION
|
| 155 |
+
|
| 156 |
+
Similar to our work in Section 4, Gao et al. (2022) use a large reward model to supervise the training of smaller models. They study the over-optimization that occurs during RLHF, with experiments that require large quantities of human preference data. To work around this challenge, they use a gold-standard reward model to replace human feedback. Our use of a large-scale reward model to supervise smaller reward models shares similarities with their approach.
|
| 157 |
+
|
| 158 |
+
# 7.3 NATURAL LANGUAGE REASONING
|
| 159 |
+
|
| 160 |
+
Several recent studies that have examined the reasoning ability of large language models are implicitly relevant to our work. Lewkowycz et al. (2022) showed that finetuning models on a large corpus of technical content led to significantly improved performance on MATH. Wang et al. (2022) showed that self-consistency leads to remarkably strong performance on many reasoning benchmarks, notably without requiring any additional finetuning. Wei et al. (2022) and Nye et al. (2021) demonstrate the importance of explicitly performing intermediate reasoning steps via a chain of thought or a scratchpad in order to solve tasks that require multi-step reasoning. Kojima et al. (2022) show that models are able to perform this behavior zero-shot, conditioned only on a simple prompt.
|
| 161 |
+
|
| 162 |
+
# 8 CONCLUSION
|
| 163 |
+
|
| 164 |
+
We have shown that process supervision can be used to train much more reliable reward models than outcome supervision in the domain of mathematical reasoning. We have also shown that active learning can be used to lower the cost of human data collection by surfacing only the most valuable model completions for human feedback. We release PRM800K, the full dataset of human feedback used to train our state-of-the-art reward model, with the hope that removing this significant barrier to entry will catalyze related research on the alignment of large language models. We believe that process supervision is currently under-explored, and we are excited for future work to more deeply investigate the extent to which these methods generalize.
|
| 165 |
+
|
| 166 |
+
# ACKNOWLEDGMENTS
|
| 167 |
+
|
| 168 |
+
We thank Joshua Achiam, Mark Chen, Jonathan Gordon, Dan Hendrycks, Lukasz Kaiser, Oleg Murk, Ben Sokolowsky, Francis Song, and Jonathan Uesato for valuable feedback and thoughtful discussions; Giambattista Parascandolo and Daniel Selsam for their contributions to the MathMix dataset; Jonathan Ward for contributing to the data collection interface; Wojciech Zaremba for encouraging us to scale up data collection; Peter Hoeschele and Aris Kostantinidis for supporting our data collection; the research acceleration and supercomputing teams at OpenAI for providing infrastructure support; and the team at Scale and the many data-labelers who created PRM800K.
|
| 169 |
+
|
| 170 |
+
# REPRODUCIBILITY STATEMENT
|
| 171 |
+
|
| 172 |
+
To assist reproducibility and further research we are releasing all of the labels that we gathered over the course of this project. Appendix B contains information about the dataset, what data was used for training, and a link to the repository containing the raw labels. Appendix C explains our evaluation methods. Finally, Appendix E and Appendix F explain how we trained our ORMs and PRMs.
|
| 173 |
+
|
| 174 |
+
# REFERENCES
|
| 175 |
+
|
| 176 |
+
Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, et al. A general language assistant as a laboratory for alignment. arXiv preprint arXiv:2112.00861, 2021.
|
| 177 |
+
|
| 178 |
+
Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Ka- ´ mar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023.
|
| 179 |
+
Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. Advances in neural information processing systems, 30, 2017.
|
| 180 |
+
Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
|
| 181 |
+
Ajeya Cotra. Without specific countermeasures, the easiest path to transformative AI likely leads to AI takeover. https://www.alignmentforum.org/posts/pRkFkzwKZ2zfa3R6H/ without-specific-countermeasures-the-easiest-path-to, 2022.
|
| 182 |
+
Antonia Creswell, Murray Shanahan, and Irina Higgins. Selection-inference: Exploiting large language models for interpretable logical reasoning. arXiv preprint arXiv:2205.09712, 2022.
|
| 183 |
+
Tom Everitt, Victoria Krakovna, Laurent Orseau, Marcus Hutter, and Shane Legg. Reinforcement learning with a corrupted reward channel. arXiv preprint arXiv:1705.08417, 2017.
|
| 184 |
+
Leo Gao, John Schulman, and Jacob Hilton. Scaling laws for reward model overoptimization. arXiv preprint arXiv:2210.10760, 2022.
|
| 185 |
+
Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. arXiv preprint arXiv:2103.03874, 2021.
|
| 186 |
+
Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. arXiv preprint arXiv:2205.11916, 2022.
|
| 187 |
+
Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. Solving quantitative reasoning problems with language models. arXiv preprint arXiv:2206.14858, 2022.
|
| 188 |
+
Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners. arXiv preprint arXiv:2206.02336, 2022.
|
| 189 |
+
Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. arXiv preprint arXiv:2005.00661, 2020.
|
| 190 |
+
Reiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christopher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, et al. Webgpt: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332, 2021.
|
| 191 |
+
Eric Nichols, Leo Gao, and Randy Gomez. Collaborative storytelling with large-scale neural language models. In Proceedings of the 13th ACM SIGGRAPH Conference on Motion, Interaction and Games, pp. 1–10, 2020.
|
| 192 |
+
Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114, 2021.
|
| 193 |
+
OpenAI. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023.
|
| 194 |
+
Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022.
|
| 195 |
+
Jianhao Shen, Yichun Yin, Lin Li, Lifeng Shang, Xin Jiang, Ming Zhang, and Qun Liu. Generate & rank: A multi-task framework for math word problems. arXiv preprint arXiv:2109.03034, 2021.
|
| 196 |
+
Nisan Stiennon, Long Ouyang, Jeffrey Wu, Daniel Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul F Christiano. Learning to summarize with human feedback. Advances in Neural Information Processing Systems, 33:3008–3021, 2020.
|
| 197 |
+
Andreas Stuhlmuller and Jungwon Byun. Supervise process, not outcomes. ¨ https://ought. org/updates/2022-04-06-process, 2022.
|
| 198 |
+
Jonathan Uesato, Nate Kushman, Ramana Kumar, Francis Song, Noah Siegel, Lisa Wang, Antonia Creswell, Geoffrey Irving, and Irina Higgins. Solving math word problems with process-and outcome-based feedback. arXiv preprint arXiv:2211.14275, 2022.
|
| 199 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022.
|
| 200 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022.
|
| 201 |
+
Eric Zelikman, Yuhuai Wu, Jesse Mu, and Noah Goodman. Star: Bootstrapping reasoning with reasoning. Advances in Neural Information Processing Systems, 35:15476–15488, 2022.
|
| 202 |
+
Daniel M Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. arXiv
|
| 203 |
+
|
| 204 |
+
preprint arXiv:1909.08593, 2019.
|
| 205 |
+
|
| 206 |
+
# A MATHMIX
|
| 207 |
+
|
| 208 |
+
Similar to Lewkowycz et al. (2022) we construct a large-scale dataset of high-quality math-relevant tokens for use in a lightweight pretraining stage, before finetuning on comparably smaller datasets like MATH and PRM800K. This dataset, which we call MathMix, has two main differences compared to the one used to train Minerva. First, it is smaller and more aggressively filtered to highquality math problem-solving content, and second, it does not explicitly mix in general language data.
|
| 209 |
+
|
| 210 |
+
Minerva was trained on 38.5B tokens of arXiv documents and webscrape pages with LaTeX content, while MathMix consists of a smaller set of 1.5B tokens containing individual math problems and their solutions, free-form text discussing math problems and concepts, and synthetic data (Table 2). While Minerva was pretrained on a dataset with $5 \%$ general natural language data, we chose not to mix in any natural language data explicitly, primarily because MathMix already contains plenty of natural language data.
|
| 211 |
+
|
| 212 |
+
Table 2: MathMix dataset components.
|
| 213 |
+
|
| 214 |
+
<table><tr><td>Data type</td><td>Token count </td><td>Present in pretraining?</td></tr><tr><td>Math problems and solutions</td><td>~275M</td><td>No</td></tr><tr><td>Free-form math discussion text (1)</td><td>~430M</td><td>No</td></tr><tr><td>Free-form math discussion text (2)</td><td>~ 450M</td><td>Yes</td></tr><tr><td>Synthetic data (1)</td><td>~30M</td><td>No</td></tr><tr><td>Synthetic data (2)</td><td>~100M</td><td>Yes</td></tr><tr><td>Critiques grading data</td><td>~ 500M</td><td>No</td></tr><tr><td></td><td></td><td></td></tr></table>
|
| 215 |
+
|
| 216 |
+
Note that when training smaller models, as in Section 4, we use a slightly smaller variant of MathMix that excludes the critiques data and only consists of 1B tokens. For our large models experiments, we train on MathMix for roughly 3B tokens (2 epochs). For our small models experiments, we train for 6 epochs (roughly 6.6B tokens).
|
| 217 |
+
|
| 218 |
+
We apply a set of decontamination checks on MathMix against the test split of the MATH dataset, including stripping out LaTeX and searching for matching n-grams, but we can make no strong guarantees on the efficacy of this decontamination. As discussed in Section 6.3, we would not expect the relative comparisons made throughout this work to be significantly impacted by test set contamination.
|
| 219 |
+
|
| 220 |
+
# B PRM800K
|
| 221 |
+
|
| 222 |
+
We collected 1,085,590 step-level labels over 101,599 solution samples. We present the whole unfiltered dataset as PRM800K. During training we discard labels used for quality control, as well as any step-level labels for which the labeler was unable to complete the task. The filtered dataset contains about 800,000 step-level labels over 75,000 solutions. The full PRM800K dataset is available at https://github.com/openai/prm800k.
|
| 223 |
+
|
| 224 |
+
The data collection was split into two separate phases. In phase 1, we collected labels for multiple alternative completions at each step of a solution. This seeded our dataset but was cumbersome— for many steps the alternatives were repetitive, and we found labelers spent a lot of time supervising long uninteresting solutions. As a result, the step-level labels we collected in this phase are more repetitive than those collected later. In total, phase 1 represents about $5 \%$ of PRM800K, or about 40,000 step-level labels.
|
| 225 |
+
|
| 226 |
+
The majority of our labels were collected as part of phase 2, during which we scaled up and streamlined the data collection process. Phase 2 data collection is split into 10 generations. For each generation, we sample $N$ solutions per problem from the generator. We rank these solutions with our current best PRM and surface the highest scoring wrong-answer solutions to our labelers. We retrain this PRM between each generation using all the latest data. This active learning strategy changes the balance of our data considerably. Though we sometimes surfaced correct solutions (either by manually injecting correct solutions or because of errors in our automatic grading), the vast majority of the labels we collected in this phase are for incorrect solutions. Table 3 breaks down the balance of correct/incorrect steps and solutions between the different phases of data collection. Though we mostly collected labels on incorrect solutions, we still collected many labels for correct individual steps. In fact, our small-scale ablations in Section 4.2 suggest that this active learning strategy, which favors labelling high-scoring wrong-answer solutions, improves performance despite the resulting imbalance in the dataset.
|
| 227 |
+
|
| 228 |
+
Table 3: Distribution of positive/negative steps/solutions.
|
| 229 |
+
|
| 230 |
+
<table><tr><td></td><td>phase 1</td><td>phase 2</td><td>combined</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>% end in correct solution</td><td>85.1</td><td>13.2</td><td>14.2</td></tr><tr><td>% correct steps</td><td>58.6</td><td>74.1</td><td>73.1</td></tr></table>
|
| 231 |
+
|
| 232 |
+
Some of our phase 2 questions are intended for quality control. For a quality control question, researchers mark which steps are reasonable to label as incorrect. Then we assess that labelers are able to consistently mark those steps as incorrect. Prior to starting on phase 2, we required all labelers to label 30 quality control questions. This served as a screening test, and we only admitted labelers that agreed with our gold labels at least $7 5 \%$ of the time.
|
| 233 |
+
|
| 234 |
+
We then designated 10-20 problems per generation as additional quality control questions, and we randomly served them to labelers as they worked through the task. We used the results of this continuous quality control to remove labelers whose quality slipped too far, as well as to prepare educational material on common mistakes in order to improve labeler alignment with our instructions.
|
| 235 |
+
|
| 236 |
+
# C EVALUATION
|
| 237 |
+
|
| 238 |
+
As we scaled up the project, we began having to collect labels on multiple solutions for the same training problem. In order to avoid the risk of over-fitting on the 7,500 MATH training problems, we expanded the training set to include 4,500 MATH test split problems. We therefore evaluate our models only on the remaining 500 held-out problems. We selected these 500 test problems uniformly at random. In Figure 5, we show that the distribution of difficulty levels and subjects in this subset is representative of the MATH test set as a whole. The specific test set we used can be found at https://github.com/openai $/ \mathrm { p r m } 8 0 0 \mathrm { k }$ . We leave it for future work to explore how many distinct training problems are actually necessary, and how quickly our methods overfit to the training set.
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 5: Two histograms comparing the distribution of problem difficulty levels and subjects in both the original MATH test set and in our 500 problem test subset.
|
| 242 |
+
|
| 243 |
+
# D LABELLING INSTRUCTIONS
|
| 244 |
+
|
| 245 |
+
Labelers were tasked to look at steps in a solution and label each one as positive, negative, or neutral. A step is considered neutral if it is appropriate in context, reasonable, correct, and contains only computations that can be verified easily. A step is positive if it is neutral and also progresses towards the solution. All other steps are considered negative. Labelers were not given reference solutions, but they were given the ground truth final answers. We chose not to provide reference solutions to avoid biasing them towards one particular path to the solution. We chose to provide ground truth final answers since this information can sometimes help labelers resolve their own misunderstandings.
|
| 246 |
+
|
| 247 |
+
In phase 1, labelers were permitted to enter their own steps in the case that all candidate steps were negative. Then the solution would progress from a randomly selected positive step (or neutral if their were no positive ones). This often resulted in trajectories that got stuck in endless sequences of neutral steps that said reasonable things but made frustratingly slow progress towards a solution or negative steps that needed constant human supervision. In phase 2, we pre-generate whole solutions and end the task as soon as the first negative step is encountered. The full instructions given to labelers can be found at https://github.com/openai/prm800k/tree/main/prm800k/instructions.
|
| 248 |
+
|
| 249 |
+
# E ORM TRAINING DETAILS
|
| 250 |
+
|
| 251 |
+
We train outcome-supervised reward models in the same manner as token-level verifiers from Cobbe et al. (2021), with a few subtle differences to hyperparameters. In particular, we only train for a single epoch on each dataset of model samples and reward model labels, without dropout, and without jointly learning a language modeling objective. We find that performance is not sensitive to most other hyperparameters, within a reasonable range.
|
| 252 |
+
|
| 253 |
+
To collect model samples, we simply sample uniformly from the generator at a temperature of 1.0 without applying any rebalancing of positives or negatives. At training time, the reward model makes predictions for every token in the context. The target for each token in a solution is the same, based on whether the solution is labelled correct or incorrect. At test time, we simply use the score of the final token in the completion as the overall score of the solution. We note that this setup is identical to the way token-level verifiers were trained in Cobbe et al. (2021).
|
| 254 |
+
|
| 255 |
+
# F PRM DETAILS
|
| 256 |
+
|
| 257 |
+
# F.1 TRAINING
|
| 258 |
+
|
| 259 |
+
We train our PRMs by fine-tuning the MathMix model to predict the probability of positive, negative, and neutral labels given a solution prefix ending in one of our labeled steps. We sweep over hyperparameters using a dataset containing the first $\sim 1 0 \%$ of PRM800K. Fine-tuning an LLM from its ordinary language modeling task to a classification task like this is a large distribution shift, and we found low learning rates were important to stable PRM training.
|
| 260 |
+
|
| 261 |
+
All of our PRMs are trained for 2 epochs. On smaller datasets (such as in phase 1 and the first few generations of phase 2) this improves the final performance over training for just 1 epoch. Additional epochs, up to some point, don’t noticeably help or hurt performance. On larger datasets, the benefits of 2 epoch training diminishes, but we continue doing it for consistency.
|
| 262 |
+
|
| 263 |
+
# F.2 SCORING
|
| 264 |
+
|
| 265 |
+
There are multiple ways of using the PRM to score solutions. In general, we produce a single solution-level score by performing a reduction over step-level scores, where the step-level score is the probability that the step’s label is positive. This involves two specific implementation decisions. First, when determining a step-level score, we either consider a neutral label to be positive or negative. Second, when determining a solution-level score, we either use the minimum or the product over step-level scores as a reduction.
|
| 266 |
+
|
| 267 |
+
We show results from all four scoring strategies in Table 4. The best performing strategy is to take the product of step-level scores and to consider the neutrals as positives, but the difference in performance between all strategies is minor. Throughout the rest of this work, we consider neutral steps to be positive, and we define the solution score to be the product of step-level scores. Using the product instead of the minimum as the reduction does create a slight bias against solutions with a larger number of steps.
|
| 268 |
+
|
| 269 |
+
Table 4: Best-of-1860 test performance using the PRM with four different scoring strategies.
|
| 270 |
+
|
| 271 |
+
<table><tr><td></td><td>product</td><td>minimum</td></tr><tr><td></td><td></td><td></td></tr><tr><td>neutral = positive</td><td>78.2%</td><td>77.6%</td></tr><tr><td>neutral = negative</td><td>77.4%</td><td>77.8%</td></tr></table>
|
| 272 |
+
|
| 273 |
+
# G DIFFICULTY BREAKDOWN
|
| 274 |
+
|
| 275 |
+
We show performance of our ORM and PRM on each quintile of the MATH dataset. We determine quintiles based on the pass rate under the generator. It is interesting to note that the performance gap is not only apparent on high difficulty problems: it is in fact apparent across all difficulties. For the lowest difficulty problems, we see that it is possible to find adversarial examples that fool the ORM, since the ORM’s performance slightly decreases as the number of samples increases. In contrast, the PRM remains highly robust over this same set of samples.
|
| 276 |
+
|
| 277 |
+
We also see that increasing the number of samples has the largest positive effect on the highest difficulty problems. This is to be expected, since a large number of generator samples may be required to find a true and convincing solution to a hard problem.
|
| 278 |
+
|
| 279 |
+

|
| 280 |
+
Figure 6: A breakdown of ORM vs PRM performance by problem difficulty.
|
| 281 |
+
|
| 282 |
+
# H SYNTHETIC SUPERVISION DETAILS
|
| 283 |
+
|
| 284 |
+
We can use $\mathrm { P R M _ { l a r g e } }$ to provide either outcome or process supervision for smaller models. We determine the labels for individual steps based on the step-level probabilities outputted by $\mathrm { P R M _ { l a r g e } }$ . To do this, we set an arbitrary threshold: any step that $\mathrm { P R M _ { l a r g e } }$ assigns a negative label with greater than $20 \%$ probability is considered incorrect. We choose this threshold based on the observation that $\mathrm { P R M _ { l a r g e } }$ is slightly miscalibrated in the direction of favoring positive labels.
|
| 285 |
+
|
| 286 |
+
To provide process supervision for a solution, we directly return the step-level labels (positive or negative) provided by $\mathrm { P R M _ { l a r g e } }$ , up until the first step that is marked as negative. This mimics our true human data collection process. To provide outcome supervision, we mark the solution as correct if and only if $\mathrm { P R M _ { l a r g e } }$ considers every step to be correct (using the same thresholding logic).
|
| 287 |
+
|
| 288 |
+
# I PRM VISUALIZATIONS
|
| 289 |
+
|
| 290 |
+
All examples shown come from the large-scale generator (GPT-4). We note the pass-rate under the generator to give some sense of the difficulty of these problems.
|
| 291 |
+
|
| 292 |
+
# I.1 TRUE POSITIVES
|
| 293 |
+
|
| 294 |
+
These cherry-picked examples show the best-of-1860 solution from the generator as ranked by the large-scale PRM.
|
| 295 |
+
|
| 296 |
+
Problem 1. Generator pass-rate: $0 . 1 \%$ . This challenging trigonometry problem requires applying several identities in a not-at-all obvious succession. Most solution attempts fail, because it is hard to choose which identities are actually helpful. Though successful solutions to this problem are rare, the reward model correctly recognizes when a valid chain-of-thought has been found.
|
| 297 |
+
|
| 298 |
+

|
| 299 |
+
|
| 300 |
+
Problem 2. Generator pass-rate: $5 . 8 \%$ . In step 7 and 8, the generator starts performing guessand-check. This is a common place the model might hallucinate, by claiming a particular guess is successful when it isn’t. In this case, the reward model verifies each step and determines that the chain-of-thought is correct.
|
| 301 |
+
|
| 302 |
+

|
| 303 |
+
|
| 304 |
+
Problem 3. Generator pass-rate: $1 . 7 \%$ . The generator successfully applies several trigonometric identities to simplify the expression.
|
| 305 |
+
|
| 306 |
+

|
| 307 |
+
|
| 308 |
+
Problem 4. Generator pass-rate: $4 . 5 \%$ . Here, the generator successfully performs a complex series of polynomial factorizations. The use of the Sophie-Germain identity in step 5 is an important step that could be considered insightful.
|
| 309 |
+
|
| 310 |
+

|
| 311 |
+
|
| 312 |
+
# I.2 TRUE NEGATIVES
|
| 313 |
+
|
| 314 |
+
Problem 5. Generator pass-rate: $4 . 5 \%$ . The generator attempts to use the difference of squares formula in step 12 on an expression that isn’t in fact a difference of squares. The reward model catches this mistake.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
|
| 318 |
+
Problem 6. Generator pass-rate: $9 3 . 5 \%$ . In step 7, the generator makes an incorrect attempt to simplify an expression. The reward model catches this mistake.
|
| 319 |
+
|
| 320 |
+

|
| 321 |
+
|
| 322 |
+
Problem 7. Generator pass-rate: $4 8 . 0 \%$ . In step 11, the generator makes a simple calculation error.
|
| 323 |
+
The reward model catches this mistake.
|
| 324 |
+
|
| 325 |
+

|
| 326 |
+
|
| 327 |
+
Answer:36
|
| 328 |
+
|
| 329 |
+
Problem 8. Generator pass-rate: $5 . 8 \%$ . The justification in step 8 is strange, but the reward model lets it slide. In step 9, though, the model incorrectly factors the expression. The reward model catches this mistake.
|
| 330 |
+
|
| 331 |
+
<table><tr><td>Find the unique odd integer t such thatO<t<23 and t+2 is the inverse of t modulo 23 I need to find an odd integer t between O and 23 such that t +2 is the inverse of t modulo 23.</td></tr><tr><td>That means that t and t +2 multiply to give 1 modulo 23.</td></tr><tr><td></td></tr><tr><td>I can write this as t(t +2)=1 (mod 23).</td></tr><tr><td>I can try to guess and check values of t until I find one that works, but that might take a long time.</td></tr><tr><td>I can also try to use some properties of modular arithmetic to simplify the equation.</td></tr><tr><td>For example, I can subtract 23 from t + 2 and still get the same remainder modulo 23.</td></tr><tr><td>So I can write t(t +2)=t(t-21) (mod 23).</td></tr><tr><td>This looks simpler, because now I have a diference of two multiples of t.</td></tr><tr><td>I can factor out t and get t(t -21) = t(1 - 21) (mod 23).</td></tr><tr><td>Now I can divide both sides by t, as long as t is not a multiple of 23.</td></tr><tr><td>This gives me t - 21 = 1- 21 (mod 23).</td></tr><tr><td>I can simplify this further by adding 21 to both sides.</td></tr><tr><td>This gives me t = 1 (mod 23).</td></tr><tr><td>Thismeans that t has the same remainder as1 when divided by 23.</td></tr><tr><td>The smallest positive value of t that satisfies this is t = 1.</td></tr><tr><td>This is also an odd integer, so it meets the criteria of the problem.</td></tr><tr><td>I can check that t = 1 works by plugging it into the original equation. I get 1(1 +2) = 1 (mod 23), which is true.</td></tr><tr><td> Therefore, the unique odd integer t that satisfies the given conditions is t = 1.</td></tr><tr><td>Answer:1</td></tr></table>
|
| 332 |
+
|
| 333 |
+
# I.3 FALSE POSITIVES
|
| 334 |
+
|
| 335 |
+
Problem 9. Generator pass-rate: $1 8 . 5 \%$ . The generator makes a subtle counting error in step 9. On the surface, it appears reasonable to claim that there are 5 ways to exchange the same colored ball since there are 5 colors. However, this undercounts by a factor of 2, since Bob has 2 choices for which ball to return to Alice. The reward model is fooled by this mistake.
|
| 336 |
+
|
| 337 |
+
Bob and Alice each have a bag that contains one ball of each of the colors,blue,green,orange,red,and violet.Alice randomly selects one ballfrom her bag and puts it into Bob's bag.Bob then randomly selects one ballfrom his bag and puts it into Alice's bag.What is the probability that after this process the contents of the two bags are the same?
|
| 338 |
+
|
| 339 |
+
<table><tr><td>Tofindtheprobabilityofanevent,Ineedtodividethenumberoffavorableoutcomesbythenumberofposibleoutcomes.</td></tr><tr><td>In this case, the event is that the contents of the two bags are the same after the process.</td></tr><tr><td>SoI need tocount how many ways this can happen,and how many ways the process can happen in total.</td></tr><tr><td>I will start with the total number of ways the process can happen.</td></tr><tr><td>Alice can choose any of the five balls in her bag,and Bob can choose any of the six balls in his bag.</td></tr><tr><td>So the total number of ways the process can happen is 5 times 6, which is 30.</td></tr><tr><td>Now I will count how many ways the contents of the two bags can be the same after the process.</td></tr><tr><td>This means that Alice and Bob must have exchanged the same color of ball.</td></tr><tr><td>Thereare five colors,so there are five ways they canexchange the same color of ball.ERROR</td></tr><tr><td>Therefore, the number of favorable outcomes is 5.</td></tr><tr><td>So the probability of the event is 5 divided by 30, which simplifies to 1/6.</td></tr><tr><td>Answer:1/6</td></tr></table>
|
| 340 |
+
|
| 341 |
+
Problem 10. Generator pass-rate: $1 7 . 6 \%$ . In step 13, the generator attempts to simplify the equation by combining like terms. It correctly moves and combines the linear terms to the left-hand side, but then mistakenly leaves the right-hand side untouched. The reward model is fooled by this mistake.
|
| 342 |
+
|
| 343 |
+

|
| 344 |
+
|
| 345 |
+
Problem 11. Generator pass-rate: $1 3 . 4 \%$ . The generator attempts to perform long division, but in step 16, it forgets to include the leading zeros in the repeating part of the decimal. The reward model is fooled by this mistake.
|
| 346 |
+
|
| 347 |
+

|
| 348 |
+
|
| 349 |
+
Problem 12. Generator pass-rate: $9 . 1 \%$ . In step 4, the generator falsely claims that the sequence repeats itself every 12 terms, when it’s in fact every 10 terms. This sort of counting mistake occasionally fools the reward model.
|
| 350 |
+
|
| 351 |
+
Given that
|
| 352 |
+
|
| 353 |
+
Ω1=211,
|
| 354 |
+
m2=375,
|
| 355 |
+
$x _ { 3 } = 4 2 0 ,$
|
| 356 |
+
𝑥4=523,and
|
| 357 |
+
$x _ { n } = x _ { n - 1 } - x _ { n - 2 } + x _ { n - 3 } - x _ { n - 4 }$ when $n \geq 5$
|
| 358 |
+
|
| 359 |
+
find thevalueof $x _ { 5 3 1 } + x _ { 7 5 3 } + x _ { 9 7 5 }$
|
| 360 |
+
|
| 361 |
+
his isaproblem involvingarecursive sequence,whereeachtermdependsontheprevious four terms.
|
| 362 |
+
|
| 363 |
+
One way toapproach this problemis tolook fora pattern oraformula that can helpus findany term of the sequence without havingtocompute all theprevious terms.
|
| 364 |
+
|
| 365 |
+
Todo that,let's write down the first few terms of the sequence and see if we notice anything:
|
| 366 |
+
|
| 367 |
+
$$
|
| 368 |
+
\begin{array} { r l } & { x _ { 1 } = 2 1 1 , } \\ & { x _ { 2 } = 3 7 5 , } \\ & { x _ { 3 } = 4 2 0 , } \\ & { x _ { 4 } = 5 2 3 , } \\ & { x _ { 5 } = 5 4 3 , } \\ & { x _ { 6 } = x _ { 5 } - x _ { 4 } + x _ { 2 } - x _ { 1 } = 5 2 3 - 4 2 0 + 3 7 5 - 2 1 1 = 2 6 7 , } \\ & { x _ { 5 } = x _ { 6 } - x _ { 4 } + x _ { 3 } - x _ { 2 } = 2 6 7 - 5 2 3 + 4 2 0 - 3 7 5 = - 2 1 1 , } \\ & { x _ { 7 } = x _ { 6 } - x _ { 5 } + x _ { 4 } - x _ { 3 } = - 2 1 1 - 2 6 7 + 5 2 3 - 4 2 0 - - 3 7 5 , } \\ & { x _ { 8 } = x _ { 7 } - x _ { 6 } + x _ { 5 } - x _ { 4 } - 3 7 5 - ( - 2 1 1 ) + 2 6 7 - 5 2 3 = - 4 2 0 , } \\ & { x _ { 9 } = x _ { 8 } - x _ { 7 } + x _ { 8 } - x _ { 8 } = - 4 2 0 - ( - 3 7 5 ) + ( - 2 1 1 ) - 2 6 7 - 5 2 3 , } \\ & { x _ { 9 } = x _ { 9 } - x _ { 8 } + x _ { 7 } - x _ { 6 } - 3 5 - ( - 4 2 0 ) + ( - 3 7 5 ) - ( - 2 1 1 ) - - 2 6 7 , } \\ & { x _ { 1 1 } = x _ { 1 0 } - x _ { 9 } + x _ { 8 } - x _ { 7 } = - 2 6 7 - ( - 5 2 3 ) + ( - 4 2 0 ) - ( - 3 7 5 ) - 2 1 1 , } \\ & { x _ { 1 2 } = x _ { 1 1 } - x _ { 1 0 } + x _ { 9 } - x _ { 8 } = 2 1 1 - ( - 2 8 7 ) + ( - 5 2 3 ) - ( - 4 2 0 ) - 3 7 5 , } \\ & { x _ { 1 3 } = x _ { 1 2 } - x _ { 1 } + x _ { 1 0 } - x _ { 3 } = 3 7 5 - 2 1 1 + ( - 2 8 7 ) - ( - 4 2 0 ) - 3 7 5 + 2 0 , } \\ & { x _ { 1 4 } = x _ { 1 2 } - x _ { 1 } + x _ { 1 0 } - x _ { 2 0 } - 2 1 1 + ( - 2 8 7 ) - ( - 5 2 3 ) + 2 0 , } \\ & x _ { 2 4 } = x _ { 1 1 } - x _ { 1 } \end{array}
|
| 369 |
+
$$
|
| 370 |
+
|
| 371 |
+
We can see that the sequence repeats itself every 12 terms, starting from x1. ERROR
|
| 372 |
+
|
| 373 |
+
This means that wecanfindanytermofthesequencebyfinding itsremainder whendividedby12,andthenlooking up the corresponding term in the first cycle.
|
| 374 |
+
For example, to find ε531, we can divide 531 by 12 and get a quotient of 44 and a remainder of 3.
|
| 375 |
+
This means that x531 is the same as x3, which is 420.
|
| 376 |
+
Similarly, we can find x753 and xg75 by dividing them by 12 and looking up their remainders.
|
| 377 |
+
We get that x753 has a remainder of 9, so it is the same as xg,which is-523.
|
| 378 |
+
And 𝑥975 has a remainder of 3, so it is the same as x3, which is 420.
|
| 379 |
+
Therefore, the value of x531 + x753 + x975 is 420 +(-523) + 420 = 317.
|
| 380 |
+
|
| 381 |
+
Answer:317
|
md/test/zl16jLb91v/zl16jLb91v.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_layout.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22974319415353530455612710602dd6bdf2044ed06d9f3daa24b129a77884dd
|
| 3 |
+
size 3930272
|
parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17431495610a7f56318846e12fc67f131285d0f32c2c98d3fe43d00894c6059e
|
| 3 |
+
size 3676372
|
parse/dev/0c2SbGJ3Lt/0c2SbGJ3Lt_span.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:689758375e49fcce0d9feaf84363765497c516ff61ff71a254422b75ae64b3a1
|
| 3 |
+
size 3929103
|
parse/dev/157Usp_kbi/157Usp_kbi_layout.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:331025cee7456c0671d4cec5b8ada19619655cf26ce27916198c44c3078566d7
|
| 3 |
+
size 746327
|
parse/dev/157Usp_kbi/157Usp_kbi_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ea2daa9415c83b94940a0a6249ddf2c2ae0dc9363f5a34adf9d7f3041848c51b
|
| 3 |
+
size 597693
|
parse/dev/157Usp_kbi/157Usp_kbi_span.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6a57446607efbf35875fcfd2916c27d09346d53e0dc8ac41ec6ff1a84ed801a
|
| 3 |
+
size 751004
|
parse/dev/1wVvweK3oIb/1wVvweK3oIb_layout.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7bbc4568af0cdad1b43812132b0efc327c498bf69616ef7639a12cc8e8b39e40
|
| 3 |
+
size 1484611
|
parse/dev/1wVvweK3oIb/1wVvweK3oIb_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8212205d399a715adc4e3aed00b45dbc6f5971354e987d41d9a56a09da84c26f
|
| 3 |
+
size 1292119
|
parse/dev/1wVvweK3oIb/1wVvweK3oIb_span.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:324712cd3d2a88aa6e1472d20c1e81b76830f903d10d98dda674bb74d97e00a5
|
| 3 |
+
size 1482908
|
parse/dev/2EDqbSCnmF/2EDqbSCnmF_layout.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5cac83ab924a1d881003fb0b7e038033f01ff574df4695181941b1793f691de6
|
| 3 |
+
size 3615183
|
parse/dev/2EDqbSCnmF/2EDqbSCnmF_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12074d32b5c59d3d22f35b1bf186cef8a5d26e9783c2bbd57fe7c42c0231e304
|
| 3 |
+
size 3452878
|
parse/dev/2EDqbSCnmF/2EDqbSCnmF_span.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ff1bb16c88edd23247a1efabaf76e85a5e639cbef65b49a777c7361a0c70c89e
|
| 3 |
+
size 3617180
|
parse/dev/3itjR9QxFw/3itjR9QxFw_layout.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f95461ecb68c65f8bc6308f114651135d06c71e17cdd999e3367331cb34f9c1e
|
| 3 |
+
size 2961378
|
parse/dev/3itjR9QxFw/3itjR9QxFw_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da9520bb76052269a8b76cd166c91b1abfc2b428be6d5d4cd55c9b297270e4a5
|
| 3 |
+
size 2694235
|
parse/dev/3itjR9QxFw/3itjR9QxFw_span.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2d371a8e2fd5b0b5698452f205ff150e3d20cbc2470067c05bc5eb4bdc559828
|
| 3 |
+
size 2964908
|
parse/dev/3tbTw2ga8K/3tbTw2ga8K_span.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:32dfb8d4e3dc2e495a47d4cae81bd99ef5764ffca061358e2a960f43f7027a02
|
| 3 |
+
size 3672464
|
parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_layout.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:540b7345a82913fa7d6ad1c8cc5619be679a8adc8498698bd1130621c557c6c5
|
| 3 |
+
size 1220901
|
parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b549bb9e829ec571adc70831a50502675f0a63d9d9ab816331d52d29bef1538
|
| 3 |
+
size 908119
|
parse/dev/4NpoSrT8uU-/4NpoSrT8uU-_span.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:77d78a67ea11ebc70f4ac931098ddb1fe57edac0e828b68ec8b4e35338aaceb0
|
| 3 |
+
size 1234765
|