ZHANGYUXUAN-zR commited on
Commit
94a37e3
·
verified ·
1 Parent(s): 8c48814

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +240 -0
  2. parse/dev/-H48S9ePSUC/-H48S9ePSUC.md +424 -0
  3. parse/dev/-H48S9ePSUC/-H48S9ePSUC_content_list.json +0 -0
  4. parse/dev/-H48S9ePSUC/-H48S9ePSUC_middle.json +0 -0
  5. parse/dev/-H48S9ePSUC/-H48S9ePSUC_model.json +0 -0
  6. parse/dev/0IywQ8uxJx/0IywQ8uxJx_layout.pdf +3 -0
  7. parse/dev/0IywQ8uxJx/0IywQ8uxJx_origin.pdf +3 -0
  8. parse/dev/0IywQ8uxJx/0IywQ8uxJx_span.pdf +3 -0
  9. parse/dev/17RDXeF-skZ/17RDXeF-skZ_layout.pdf +3 -0
  10. parse/dev/17RDXeF-skZ/17RDXeF-skZ_origin.pdf +3 -0
  11. parse/dev/17RDXeF-skZ/17RDXeF-skZ_span.pdf +3 -0
  12. parse/dev/1W8UwXAQubL/1W8UwXAQubL_layout.pdf +3 -0
  13. parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_layout.pdf +3 -0
  14. parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_origin.pdf +3 -0
  15. parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_span.pdf +3 -0
  16. parse/dev/3IyL2XWDkG/3IyL2XWDkG_layout.pdf +3 -0
  17. parse/dev/3IyL2XWDkG/3IyL2XWDkG_span.pdf +3 -0
  18. parse/dev/3JvRnAzw_0/3JvRnAzw_0_layout.pdf +3 -0
  19. parse/dev/3JvRnAzw_0/3JvRnAzw_0_origin.pdf +3 -0
  20. parse/dev/3JvRnAzw_0/3JvRnAzw_0_span.pdf +3 -0
  21. parse/dev/3KWnuT-R1bh/3KWnuT-R1bh.md +419 -0
  22. parse/dev/3KWnuT-R1bh/3KWnuT-R1bh_content_list.json +0 -0
  23. parse/dev/3KWnuT-R1bh/3KWnuT-R1bh_middle.json +0 -0
  24. parse/dev/3KWnuT-R1bh/3KWnuT-R1bh_model.json +0 -0
  25. parse/dev/3Pbra-_u76D/3Pbra-_u76D_layout.pdf +3 -0
  26. parse/dev/3Pbra-_u76D/3Pbra-_u76D_origin.pdf +3 -0
  27. parse/dev/3Pbra-_u76D/3Pbra-_u76D_span.pdf +3 -0
  28. parse/dev/3ly9cG9Ql9h/3ly9cG9Ql9h.md +899 -0
  29. parse/dev/3ly9cG9Ql9h/3ly9cG9Ql9h_content_list.json +0 -0
  30. parse/dev/3ly9cG9Ql9h/3ly9cG9Ql9h_middle.json +0 -0
  31. parse/dev/3ly9cG9Ql9h/3ly9cG9Ql9h_model.json +0 -0
  32. parse/dev/4G1Sfp_1sz7/4G1Sfp_1sz7.md +367 -0
  33. parse/dev/4G1Sfp_1sz7/4G1Sfp_1sz7_middle.json +0 -0
  34. parse/dev/4R7YrAGhnve/4R7YrAGhnve_content_list.json +1067 -0
  35. parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_layout.pdf +3 -0
  36. parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_origin.pdf +3 -0
  37. parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_span.pdf +3 -0
  38. parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_layout.pdf +3 -0
  39. parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_origin.pdf +3 -0
  40. parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_span.pdf +3 -0
  41. parse/dev/5btWTw1vcw1/5btWTw1vcw1_layout.pdf +3 -0
  42. parse/dev/5btWTw1vcw1/5btWTw1vcw1_origin.pdf +3 -0
  43. parse/dev/5btWTw1vcw1/5btWTw1vcw1_span.pdf +3 -0
  44. parse/dev/5haAJAcofjc/5haAJAcofjc_layout.pdf +3 -0
  45. parse/dev/5haAJAcofjc/5haAJAcofjc_origin.pdf +3 -0
  46. parse/dev/5haAJAcofjc/5haAJAcofjc_span.pdf +3 -0
  47. parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_layout.pdf +3 -0
  48. parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_origin.pdf +3 -0
  49. parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_span.pdf +3 -0
  50. parse/dev/6MmiS0HUJHR/6MmiS0HUJHR.md +0 -0
.gitattributes CHANGED
@@ -847,3 +847,243 @@ parse/dev/YPpSngE-ZU/YPpSngE-ZU_layout.pdf filter=lfs diff=lfs merge=lfs -text
847
  parse/dev/qQuzhbU3Gto/qQuzhbU3Gto_origin.pdf filter=lfs diff=lfs merge=lfs -text
848
  parse/dev/R9KnuFlvnU/R9KnuFlvnU_span.pdf filter=lfs diff=lfs merge=lfs -text
849
  parse/dev/YPpSngE-ZU/YPpSngE-ZU_origin.pdf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
847
  parse/dev/qQuzhbU3Gto/qQuzhbU3Gto_origin.pdf filter=lfs diff=lfs merge=lfs -text
848
  parse/dev/R9KnuFlvnU/R9KnuFlvnU_span.pdf filter=lfs diff=lfs merge=lfs -text
849
  parse/dev/YPpSngE-ZU/YPpSngE-ZU_origin.pdf filter=lfs diff=lfs merge=lfs -text
850
+ parse/dev/qQuzhbU3Gto/qQuzhbU3Gto_layout.pdf filter=lfs diff=lfs merge=lfs -text
851
+ parse/dev/qQuzhbU3Gto/qQuzhbU3Gto_span.pdf filter=lfs diff=lfs merge=lfs -text
852
+ parse/dev/RhB1AdoFfGE/RhB1AdoFfGE_span.pdf filter=lfs diff=lfs merge=lfs -text
853
+ parse/dev/6NT1a56mNim/6NT1a56mNim_span.pdf filter=lfs diff=lfs merge=lfs -text
854
+ parse/dev/Bct2f8fRd8S/Bct2f8fRd8S_origin.pdf filter=lfs diff=lfs merge=lfs -text
855
+ parse/dev/6NT1a56mNim/6NT1a56mNim_origin.pdf filter=lfs diff=lfs merge=lfs -text
856
+ parse/dev/cBu4ElJfneV/cBu4ElJfneV_layout.pdf filter=lfs diff=lfs merge=lfs -text
857
+ parse/dev/6NT1a56mNim/6NT1a56mNim_layout.pdf filter=lfs diff=lfs merge=lfs -text
858
+ parse/dev/plKu2GByCNW/plKu2GByCNW_origin.pdf filter=lfs diff=lfs merge=lfs -text
859
+ parse/dev/fT9W53lLxNS/fT9W53lLxNS_layout.pdf filter=lfs diff=lfs merge=lfs -text
860
+ parse/dev/3IyL2XWDkG/3IyL2XWDkG_layout.pdf filter=lfs diff=lfs merge=lfs -text
861
+ parse/dev/OQQoD8Vc3B/OQQoD8Vc3B_layout.pdf filter=lfs diff=lfs merge=lfs -text
862
+ parse/dev/siCt4xZn5Ve/siCt4xZn5Ve_span.pdf filter=lfs diff=lfs merge=lfs -text
863
+ parse/dev/KVYq2Ea90PC/KVYq2Ea90PC_layout.pdf filter=lfs diff=lfs merge=lfs -text
864
+ parse/dev/3IyL2XWDkG/3IyL2XWDkG_span.pdf filter=lfs diff=lfs merge=lfs -text
865
+ parse/dev/OQQoD8Vc3B/OQQoD8Vc3B_span.pdf filter=lfs diff=lfs merge=lfs -text
866
+ parse/dev/KVYq2Ea90PC/KVYq2Ea90PC_origin.pdf filter=lfs diff=lfs merge=lfs -text
867
+ parse/dev/siCt4xZn5Ve/siCt4xZn5Ve_origin.pdf filter=lfs diff=lfs merge=lfs -text
868
+ parse/dev/VB75Pi89p7/VB75Pi89p7_layout.pdf filter=lfs diff=lfs merge=lfs -text
869
+ parse/dev/siCt4xZn5Ve/siCt4xZn5Ve_layout.pdf filter=lfs diff=lfs merge=lfs -text
870
+ parse/dev/cGDAkQo1C0p/cGDAkQo1C0p_span.pdf filter=lfs diff=lfs merge=lfs -text
871
+ parse/dev/q0nmYciuuZN/q0nmYciuuZN_origin.pdf filter=lfs diff=lfs merge=lfs -text
872
+ parse/dev/cGDAkQo1C0p/cGDAkQo1C0p_origin.pdf filter=lfs diff=lfs merge=lfs -text
873
+ parse/dev/q0nmYciuuZN/q0nmYciuuZN_layout.pdf filter=lfs diff=lfs merge=lfs -text
874
+ parse/dev/cGDAkQo1C0p/cGDAkQo1C0p_layout.pdf filter=lfs diff=lfs merge=lfs -text
875
+ parse/dev/OQQoD8Vc3B/OQQoD8Vc3B_origin.pdf filter=lfs diff=lfs merge=lfs -text
876
+ parse/dev/VB75Pi89p7/VB75Pi89p7_origin.pdf filter=lfs diff=lfs merge=lfs -text
877
+ parse/dev/q0nmYciuuZN/q0nmYciuuZN_span.pdf filter=lfs diff=lfs merge=lfs -text
878
+ parse/dev/VB75Pi89p7/VB75Pi89p7_span.pdf filter=lfs diff=lfs merge=lfs -text
879
+ parse/dev/Yo0s4qp_UMR/Yo0s4qp_UMR_origin.pdf filter=lfs diff=lfs merge=lfs -text
880
+ parse/dev/Yo0s4qp_UMR/Yo0s4qp_UMR_span.pdf filter=lfs diff=lfs merge=lfs -text
881
+ parse/dev/OkQD6RMUK5/OkQD6RMUK5_layout.pdf filter=lfs diff=lfs merge=lfs -text
882
+ parse/dev/Yo0s4qp_UMR/Yo0s4qp_UMR_layout.pdf filter=lfs diff=lfs merge=lfs -text
883
+ parse/dev/JprM0p-q0Co/JprM0p-q0Co_layout.pdf filter=lfs diff=lfs merge=lfs -text
884
+ parse/dev/ptbePrczhRt/ptbePrczhRt_origin.pdf filter=lfs diff=lfs merge=lfs -text
885
+ parse/dev/OkQD6RMUK5/OkQD6RMUK5_span.pdf filter=lfs diff=lfs merge=lfs -text
886
+ parse/dev/OkQD6RMUK5/OkQD6RMUK5_origin.pdf filter=lfs diff=lfs merge=lfs -text
887
+ parse/dev/JprM0p-q0Co/JprM0p-q0Co_origin.pdf filter=lfs diff=lfs merge=lfs -text
888
+ parse/dev/0IywQ8uxJx/0IywQ8uxJx_origin.pdf filter=lfs diff=lfs merge=lfs -text
889
+ parse/dev/ptbePrczhRt/ptbePrczhRt_span.pdf filter=lfs diff=lfs merge=lfs -text
890
+ parse/dev/ptbePrczhRt/ptbePrczhRt_layout.pdf filter=lfs diff=lfs merge=lfs -text
891
+ parse/dev/0IywQ8uxJx/0IywQ8uxJx_span.pdf filter=lfs diff=lfs merge=lfs -text
892
+ parse/dev/xozJw0kZXF/xozJw0kZXF_origin.pdf filter=lfs diff=lfs merge=lfs -text
893
+ parse/dev/0IywQ8uxJx/0IywQ8uxJx_layout.pdf filter=lfs diff=lfs merge=lfs -text
894
+ parse/dev/xozJw0kZXF/xozJw0kZXF_span.pdf filter=lfs diff=lfs merge=lfs -text
895
+ parse/dev/I9xE1Jsjfx/I9xE1Jsjfx_origin.pdf filter=lfs diff=lfs merge=lfs -text
896
+ parse/dev/EZZsnke1kt/EZZsnke1kt_origin.pdf filter=lfs diff=lfs merge=lfs -text
897
+ parse/dev/SVjDiiVySh/SVjDiiVySh_layout.pdf filter=lfs diff=lfs merge=lfs -text
898
+ parse/dev/xozJw0kZXF/xozJw0kZXF_layout.pdf filter=lfs diff=lfs merge=lfs -text
899
+ parse/dev/I9xE1Jsjfx/I9xE1Jsjfx_layout.pdf filter=lfs diff=lfs merge=lfs -text
900
+ parse/dev/EZZsnke1kt/EZZsnke1kt_span.pdf filter=lfs diff=lfs merge=lfs -text
901
+ parse/dev/EZZsnke1kt/EZZsnke1kt_layout.pdf filter=lfs diff=lfs merge=lfs -text
902
+ parse/dev/NbkjMn7X8H/NbkjMn7X8H_origin.pdf filter=lfs diff=lfs merge=lfs -text
903
+ parse/dev/AIqC7F7xV-d/AIqC7F7xV-d_span.pdf filter=lfs diff=lfs merge=lfs -text
904
+ parse/dev/_SJ-_yyes8/_SJ-_yyes8_origin.pdf filter=lfs diff=lfs merge=lfs -text
905
+ parse/dev/zkk_7sV6gm8/zkk_7sV6gm8_span.pdf filter=lfs diff=lfs merge=lfs -text
906
+ parse/dev/NbkjMn7X8H/NbkjMn7X8H_layout.pdf filter=lfs diff=lfs merge=lfs -text
907
+ parse/dev/_SJ-_yyes8/_SJ-_yyes8_span.pdf filter=lfs diff=lfs merge=lfs -text
908
+ parse/dev/_SJ-_yyes8/_SJ-_yyes8_layout.pdf filter=lfs diff=lfs merge=lfs -text
909
+ parse/dev/Rg1LG7wtd2D/Rg1LG7wtd2D_origin.pdf filter=lfs diff=lfs merge=lfs -text
910
+ parse/dev/bZjxxYURKT/bZjxxYURKT_span.pdf filter=lfs diff=lfs merge=lfs -text
911
+ parse/dev/Rg1LG7wtd2D/Rg1LG7wtd2D_layout.pdf filter=lfs diff=lfs merge=lfs -text
912
+ parse/dev/NbkjMn7X8H/NbkjMn7X8H_span.pdf filter=lfs diff=lfs merge=lfs -text
913
+ parse/dev/Rg1LG7wtd2D/Rg1LG7wtd2D_span.pdf filter=lfs diff=lfs merge=lfs -text
914
+ parse/dev/bZjxxYURKT/bZjxxYURKT_layout.pdf filter=lfs diff=lfs merge=lfs -text
915
+ parse/dev/bZjxxYURKT/bZjxxYURKT_origin.pdf filter=lfs diff=lfs merge=lfs -text
916
+ parse/dev/uloenYmLCAo/uloenYmLCAo_layout.pdf filter=lfs diff=lfs merge=lfs -text
917
+ parse/dev/ZumkmSpY9G4/ZumkmSpY9G4_origin.pdf filter=lfs diff=lfs merge=lfs -text
918
+ parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_layout.pdf filter=lfs diff=lfs merge=lfs -text
919
+ parse/dev/uloenYmLCAo/uloenYmLCAo_origin.pdf filter=lfs diff=lfs merge=lfs -text
920
+ parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_origin.pdf filter=lfs diff=lfs merge=lfs -text
921
+ parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_span.pdf filter=lfs diff=lfs merge=lfs -text
922
+ parse/dev/ZumkmSpY9G4/ZumkmSpY9G4_layout.pdf filter=lfs diff=lfs merge=lfs -text
923
+ parse/dev/ZumkmSpY9G4/ZumkmSpY9G4_span.pdf filter=lfs diff=lfs merge=lfs -text
924
+ parse/dev/ldRb12nMfLQ/ldRb12nMfLQ_layout.pdf filter=lfs diff=lfs merge=lfs -text
925
+ parse/dev/ldRb12nMfLQ/ldRb12nMfLQ_origin.pdf filter=lfs diff=lfs merge=lfs -text
926
+ parse/dev/uloenYmLCAo/uloenYmLCAo_span.pdf filter=lfs diff=lfs merge=lfs -text
927
+ parse/dev/ldRb12nMfLQ/ldRb12nMfLQ_span.pdf filter=lfs diff=lfs merge=lfs -text
928
+ parse/dev/G5ADoRKiTyJ/G5ADoRKiTyJ_layout.pdf filter=lfs diff=lfs merge=lfs -text
929
+ parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_origin.pdf filter=lfs diff=lfs merge=lfs -text
930
+ parse/dev/G5ADoRKiTyJ/G5ADoRKiTyJ_span.pdf filter=lfs diff=lfs merge=lfs -text
931
+ parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_layout.pdf filter=lfs diff=lfs merge=lfs -text
932
+ parse/dev/G5ADoRKiTyJ/G5ADoRKiTyJ_origin.pdf filter=lfs diff=lfs merge=lfs -text
933
+ parse/dev/17RDXeF-skZ/17RDXeF-skZ_layout.pdf filter=lfs diff=lfs merge=lfs -text
934
+ parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_span.pdf filter=lfs diff=lfs merge=lfs -text
935
+ parse/dev/_3ELRdg2sgI/_3ELRdg2sgI_span.pdf filter=lfs diff=lfs merge=lfs -text
936
+ parse/dev/S874XAIpkR-/S874XAIpkR-_origin.pdf filter=lfs diff=lfs merge=lfs -text
937
+ parse/dev/_3ELRdg2sgI/_3ELRdg2sgI_layout.pdf filter=lfs diff=lfs merge=lfs -text
938
+ parse/dev/_3ELRdg2sgI/_3ELRdg2sgI_origin.pdf filter=lfs diff=lfs merge=lfs -text
939
+ parse/dev/nXmU89Rfmgg/nXmU89Rfmgg_span.pdf filter=lfs diff=lfs merge=lfs -text
940
+ parse/dev/nXmU89Rfmgg/nXmU89Rfmgg_origin.pdf filter=lfs diff=lfs merge=lfs -text
941
+ parse/dev/PqvMRDCJT9t/PqvMRDCJT9t_layout.pdf filter=lfs diff=lfs merge=lfs -text
942
+ parse/dev/17RDXeF-skZ/17RDXeF-skZ_span.pdf filter=lfs diff=lfs merge=lfs -text
943
+ parse/dev/PqvMRDCJT9t/PqvMRDCJT9t_origin.pdf filter=lfs diff=lfs merge=lfs -text
944
+ parse/dev/PqvMRDCJT9t/PqvMRDCJT9t_span.pdf filter=lfs diff=lfs merge=lfs -text
945
+ parse/dev/17RDXeF-skZ/17RDXeF-skZ_origin.pdf filter=lfs diff=lfs merge=lfs -text
946
+ parse/dev/J4iSIR9fhY0/J4iSIR9fhY0_span.pdf filter=lfs diff=lfs merge=lfs -text
947
+ parse/dev/JprM0p-q0Co/JprM0p-q0Co_span.pdf filter=lfs diff=lfs merge=lfs -text
948
+ parse/dev/SVjDiiVySh/SVjDiiVySh_span.pdf filter=lfs diff=lfs merge=lfs -text
949
+ parse/dev/SVjDiiVySh/SVjDiiVySh_origin.pdf filter=lfs diff=lfs merge=lfs -text
950
+ parse/dev/J4iSIR9fhY0/J4iSIR9fhY0_origin.pdf filter=lfs diff=lfs merge=lfs -text
951
+ parse/dev/gzeruP-0J29/gzeruP-0J29_layout.pdf filter=lfs diff=lfs merge=lfs -text
952
+ parse/dev/I9xE1Jsjfx/I9xE1Jsjfx_span.pdf filter=lfs diff=lfs merge=lfs -text
953
+ parse/dev/OtxyysUdBE/OtxyysUdBE_origin.pdf filter=lfs diff=lfs merge=lfs -text
954
+ parse/dev/gzeruP-0J29/gzeruP-0J29_span.pdf filter=lfs diff=lfs merge=lfs -text
955
+ parse/dev/J4iSIR9fhY0/J4iSIR9fhY0_layout.pdf filter=lfs diff=lfs merge=lfs -text
956
+ parse/dev/9jsZiUgkCZP/9jsZiUgkCZP_span.pdf filter=lfs diff=lfs merge=lfs -text
957
+ parse/dev/gzeruP-0J29/gzeruP-0J29_origin.pdf filter=lfs diff=lfs merge=lfs -text
958
+ parse/dev/OtxyysUdBE/OtxyysUdBE_span.pdf filter=lfs diff=lfs merge=lfs -text
959
+ parse/dev/9jsZiUgkCZP/9jsZiUgkCZP_layout.pdf filter=lfs diff=lfs merge=lfs -text
960
+ parse/dev/OtxyysUdBE/OtxyysUdBE_layout.pdf filter=lfs diff=lfs merge=lfs -text
961
+ parse/dev/uYLFoz1vlAC/uYLFoz1vlAC_origin.pdf filter=lfs diff=lfs merge=lfs -text
962
+ parse/dev/q-LMlivZrV/q-LMlivZrV_layout.pdf filter=lfs diff=lfs merge=lfs -text
963
+ parse/dev/q-LMlivZrV/q-LMlivZrV_span.pdf filter=lfs diff=lfs merge=lfs -text
964
+ parse/dev/9jsZiUgkCZP/9jsZiUgkCZP_origin.pdf filter=lfs diff=lfs merge=lfs -text
965
+ parse/dev/q-LMlivZrV/q-LMlivZrV_origin.pdf filter=lfs diff=lfs merge=lfs -text
966
+ parse/dev/3Pbra-_u76D/3Pbra-_u76D_span.pdf filter=lfs diff=lfs merge=lfs -text
967
+ parse/dev/nwKXyFvaUm/nwKXyFvaUm_span.pdf filter=lfs diff=lfs merge=lfs -text
968
+ parse/dev/uYLFoz1vlAC/uYLFoz1vlAC_span.pdf filter=lfs diff=lfs merge=lfs -text
969
+ parse/dev/nwKXyFvaUm/nwKXyFvaUm_origin.pdf filter=lfs diff=lfs merge=lfs -text
970
+ parse/dev/3Pbra-_u76D/3Pbra-_u76D_origin.pdf filter=lfs diff=lfs merge=lfs -text
971
+ parse/dev/Q-HOv_zn6G/Q-HOv_zn6G_layout.pdf filter=lfs diff=lfs merge=lfs -text
972
+ parse/dev/nwKXyFvaUm/nwKXyFvaUm_layout.pdf filter=lfs diff=lfs merge=lfs -text
973
+ parse/dev/Q-HOv_zn6G/Q-HOv_zn6G_origin.pdf filter=lfs diff=lfs merge=lfs -text
974
+ parse/dev/bwq6O4Cwdl/bwq6O4Cwdl_span.pdf filter=lfs diff=lfs merge=lfs -text
975
+ parse/dev/3Pbra-_u76D/3Pbra-_u76D_layout.pdf filter=lfs diff=lfs merge=lfs -text
976
+ parse/dev/Q-HOv_zn6G/Q-HOv_zn6G_span.pdf filter=lfs diff=lfs merge=lfs -text
977
+ parse/dev/uYLFoz1vlAC/uYLFoz1vlAC_layout.pdf filter=lfs diff=lfs merge=lfs -text
978
+ parse/dev/tDw7Mmat8co/tDw7Mmat8co_layout.pdf filter=lfs diff=lfs merge=lfs -text
979
+ parse/dev/bwq6O4Cwdl/bwq6O4Cwdl_layout.pdf filter=lfs diff=lfs merge=lfs -text
980
+ parse/dev/tDw7Mmat8co/tDw7Mmat8co_span.pdf filter=lfs diff=lfs merge=lfs -text
981
+ parse/dev/tDw7Mmat8co/tDw7Mmat8co_origin.pdf filter=lfs diff=lfs merge=lfs -text
982
+ parse/dev/5haAJAcofjc/5haAJAcofjc_origin.pdf filter=lfs diff=lfs merge=lfs -text
983
+ parse/dev/5haAJAcofjc/5haAJAcofjc_layout.pdf filter=lfs diff=lfs merge=lfs -text
984
+ parse/dev/bwq6O4Cwdl/bwq6O4Cwdl_origin.pdf filter=lfs diff=lfs merge=lfs -text
985
+ parse/dev/ubzNoJjOKj/ubzNoJjOKj_origin.pdf filter=lfs diff=lfs merge=lfs -text
986
+ parse/dev/5haAJAcofjc/5haAJAcofjc_span.pdf filter=lfs diff=lfs merge=lfs -text
987
+ parse/dev/LI2bhrE_2A/LI2bhrE_2A_span.pdf filter=lfs diff=lfs merge=lfs -text
988
+ parse/dev/LI2bhrE_2A/LI2bhrE_2A_layout.pdf filter=lfs diff=lfs merge=lfs -text
989
+ parse/dev/lCYrsdHb5SQ/lCYrsdHb5SQ_origin.pdf filter=lfs diff=lfs merge=lfs -text
990
+ parse/dev/ubzNoJjOKj/ubzNoJjOKj_span.pdf filter=lfs diff=lfs merge=lfs -text
991
+ parse/dev/lCYrsdHb5SQ/lCYrsdHb5SQ_span.pdf filter=lfs diff=lfs merge=lfs -text
992
+ parse/dev/APuPRxjHvZ/APuPRxjHvZ_layout.pdf filter=lfs diff=lfs merge=lfs -text
993
+ parse/dev/ubzNoJjOKj/ubzNoJjOKj_layout.pdf filter=lfs diff=lfs merge=lfs -text
994
+ parse/dev/LI2bhrE_2A/LI2bhrE_2A_origin.pdf filter=lfs diff=lfs merge=lfs -text
995
+ parse/dev/lCYrsdHb5SQ/lCYrsdHb5SQ_layout.pdf filter=lfs diff=lfs merge=lfs -text
996
+ parse/dev/SHMi1b7sjXk/SHMi1b7sjXk_layout.pdf filter=lfs diff=lfs merge=lfs -text
997
+ parse/dev/APuPRxjHvZ/APuPRxjHvZ_span.pdf filter=lfs diff=lfs merge=lfs -text
998
+ parse/dev/APuPRxjHvZ/APuPRxjHvZ_origin.pdf filter=lfs diff=lfs merge=lfs -text
999
+ parse/dev/SHMi1b7sjXk/SHMi1b7sjXk_origin.pdf filter=lfs diff=lfs merge=lfs -text
1000
+ parse/dev/wKhUPzqVap6/wKhUPzqVap6_origin.pdf filter=lfs diff=lfs merge=lfs -text
1001
+ parse/dev/wKhUPzqVap6/wKhUPzqVap6_layout.pdf filter=lfs diff=lfs merge=lfs -text
1002
+ parse/dev/muFvu66v7u/muFvu66v7u_origin.pdf filter=lfs diff=lfs merge=lfs -text
1003
+ parse/dev/wKhUPzqVap6/wKhUPzqVap6_span.pdf filter=lfs diff=lfs merge=lfs -text
1004
+ parse/dev/SHMi1b7sjXk/SHMi1b7sjXk_span.pdf filter=lfs diff=lfs merge=lfs -text
1005
+ parse/dev/muFvu66v7u/muFvu66v7u_layout.pdf filter=lfs diff=lfs merge=lfs -text
1006
+ parse/dev/9Hrka5PA7LW/9Hrka5PA7LW_origin.pdf filter=lfs diff=lfs merge=lfs -text
1007
+ parse/dev/3JvRnAzw_0/3JvRnAzw_0_span.pdf filter=lfs diff=lfs merge=lfs -text
1008
+ parse/dev/5btWTw1vcw1/5btWTw1vcw1_layout.pdf filter=lfs diff=lfs merge=lfs -text
1009
+ parse/dev/9Hrka5PA7LW/9Hrka5PA7LW_span.pdf filter=lfs diff=lfs merge=lfs -text
1010
+ parse/dev/9Hrka5PA7LW/9Hrka5PA7LW_layout.pdf filter=lfs diff=lfs merge=lfs -text
1011
+ parse/dev/5btWTw1vcw1/5btWTw1vcw1_origin.pdf filter=lfs diff=lfs merge=lfs -text
1012
+ parse/dev/3JvRnAzw_0/3JvRnAzw_0_layout.pdf filter=lfs diff=lfs merge=lfs -text
1013
+ parse/dev/muFvu66v7u/muFvu66v7u_span.pdf filter=lfs diff=lfs merge=lfs -text
1014
+ parse/dev/Pu-QtT0h2E/Pu-QtT0h2E_span.pdf filter=lfs diff=lfs merge=lfs -text
1015
+ parse/dev/Pu-QtT0h2E/Pu-QtT0h2E_origin.pdf filter=lfs diff=lfs merge=lfs -text
1016
+ parse/dev/Pu-QtT0h2E/Pu-QtT0h2E_layout.pdf filter=lfs diff=lfs merge=lfs -text
1017
+ parse/dev/5btWTw1vcw1/5btWTw1vcw1_span.pdf filter=lfs diff=lfs merge=lfs -text
1018
+ parse/dev/Zk1SbbdZwS/Zk1SbbdZwS_origin.pdf filter=lfs diff=lfs merge=lfs -text
1019
+ parse/dev/fvLLcIYmXb/fvLLcIYmXb_origin.pdf filter=lfs diff=lfs merge=lfs -text
1020
+ parse/dev/Zk1SbbdZwS/Zk1SbbdZwS_layout.pdf filter=lfs diff=lfs merge=lfs -text
1021
+ parse/dev/CEjuyeZj1jz/CEjuyeZj1jz_origin.pdf filter=lfs diff=lfs merge=lfs -text
1022
+ parse/dev/CEjuyeZj1jz/CEjuyeZj1jz_layout.pdf filter=lfs diff=lfs merge=lfs -text
1023
+ parse/dev/3JvRnAzw_0/3JvRnAzw_0_origin.pdf filter=lfs diff=lfs merge=lfs -text
1024
+ parse/dev/fvLLcIYmXb/fvLLcIYmXb_layout.pdf filter=lfs diff=lfs merge=lfs -text
1025
+ parse/dev/V3C8p78sDa/V3C8p78sDa_origin.pdf filter=lfs diff=lfs merge=lfs -text
1026
+ parse/dev/fvLLcIYmXb/fvLLcIYmXb_span.pdf filter=lfs diff=lfs merge=lfs -text
1027
+ parse/dev/CEjuyeZj1jz/CEjuyeZj1jz_span.pdf filter=lfs diff=lfs merge=lfs -text
1028
+ parse/dev/Zk1SbbdZwS/Zk1SbbdZwS_span.pdf filter=lfs diff=lfs merge=lfs -text
1029
+ parse/dev/gE_vt-w4LhL/gE_vt-w4LhL_layout.pdf filter=lfs diff=lfs merge=lfs -text
1030
+ parse/dev/1W8UwXAQubL/1W8UwXAQubL_layout.pdf filter=lfs diff=lfs merge=lfs -text
1031
+ parse/dev/gE_vt-w4LhL/gE_vt-w4LhL_span.pdf filter=lfs diff=lfs merge=lfs -text
1032
+ parse/dev/V3C8p78sDa/V3C8p78sDa_span.pdf filter=lfs diff=lfs merge=lfs -text
1033
+ parse/dev/FZCFlj2_c7z/FZCFlj2_c7z_layout.pdf filter=lfs diff=lfs merge=lfs -text
1034
+ parse/dev/eLgK35G3A5d/eLgK35G3A5d_layout.pdf filter=lfs diff=lfs merge=lfs -text
1035
+ parse/dev/FZCFlj2_c7z/FZCFlj2_c7z_origin.pdf filter=lfs diff=lfs merge=lfs -text
1036
+ parse/dev/UjynxfqnGWG/UjynxfqnGWG_origin.pdf filter=lfs diff=lfs merge=lfs -text
1037
+ parse/dev/UjynxfqnGWG/UjynxfqnGWG_layout.pdf filter=lfs diff=lfs merge=lfs -text
1038
+ parse/dev/FZCFlj2_c7z/FZCFlj2_c7z_span.pdf filter=lfs diff=lfs merge=lfs -text
1039
+ parse/dev/UjynxfqnGWG/UjynxfqnGWG_span.pdf filter=lfs diff=lfs merge=lfs -text
1040
+ parse/dev/hGXij5rfiHw/hGXij5rfiHw_span.pdf filter=lfs diff=lfs merge=lfs -text
1041
+ parse/dev/eLgK35G3A5d/eLgK35G3A5d_span.pdf filter=lfs diff=lfs merge=lfs -text
1042
+ parse/dev/Vota6rFhBQ/Vota6rFhBQ_origin.pdf filter=lfs diff=lfs merge=lfs -text
1043
+ parse/dev/TBWA6PLJZQm/TBWA6PLJZQm_origin.pdf filter=lfs diff=lfs merge=lfs -text
1044
+ parse/dev/eLgK35G3A5d/eLgK35G3A5d_origin.pdf filter=lfs diff=lfs merge=lfs -text
1045
+ parse/dev/Vota6rFhBQ/Vota6rFhBQ_layout.pdf filter=lfs diff=lfs merge=lfs -text
1046
+ parse/dev/TBWA6PLJZQm/TBWA6PLJZQm_layout.pdf filter=lfs diff=lfs merge=lfs -text
1047
+ parse/dev/hGXij5rfiHw/hGXij5rfiHw_origin.pdf filter=lfs diff=lfs merge=lfs -text
1048
+ parse/dev/hGXij5rfiHw/hGXij5rfiHw_layout.pdf filter=lfs diff=lfs merge=lfs -text
1049
+ parse/dev/a0SRWViFYW/a0SRWViFYW_origin.pdf filter=lfs diff=lfs merge=lfs -text
1050
+ parse/dev/a0SRWViFYW/a0SRWViFYW_span.pdf filter=lfs diff=lfs merge=lfs -text
1051
+ parse/dev/TBWA6PLJZQm/TBWA6PLJZQm_span.pdf filter=lfs diff=lfs merge=lfs -text
1052
+ parse/dev/a0SRWViFYW/a0SRWViFYW_layout.pdf filter=lfs diff=lfs merge=lfs -text
1053
+ parse/dev/d00kbjbYv2/d00kbjbYv2_origin.pdf filter=lfs diff=lfs merge=lfs -text
1054
+ parse/dev/d00kbjbYv2/d00kbjbYv2_layout.pdf filter=lfs diff=lfs merge=lfs -text
1055
+ parse/dev/d00kbjbYv2/d00kbjbYv2_span.pdf filter=lfs diff=lfs merge=lfs -text
1056
+ parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_origin.pdf filter=lfs diff=lfs merge=lfs -text
1057
+ parse/dev/OJ4mMfGKLN/OJ4mMfGKLN_origin.pdf filter=lfs diff=lfs merge=lfs -text
1058
+ parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_layout.pdf filter=lfs diff=lfs merge=lfs -text
1059
+ parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_span.pdf filter=lfs diff=lfs merge=lfs -text
1060
+ parse/dev/e95i1IHcWj/e95i1IHcWj_layout.pdf filter=lfs diff=lfs merge=lfs -text
1061
+ parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_layout.pdf filter=lfs diff=lfs merge=lfs -text
1062
+ parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_span.pdf filter=lfs diff=lfs merge=lfs -text
1063
+ parse/dev/OJ4mMfGKLN/OJ4mMfGKLN_span.pdf filter=lfs diff=lfs merge=lfs -text
1064
+ parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_origin.pdf filter=lfs diff=lfs merge=lfs -text
1065
+ parse/dev/OJ4mMfGKLN/OJ4mMfGKLN_layout.pdf filter=lfs diff=lfs merge=lfs -text
1066
+ parse/dev/vfsRB5MImo9/vfsRB5MImo9_origin.pdf filter=lfs diff=lfs merge=lfs -text
1067
+ parse/dev/vfsRB5MImo9/vfsRB5MImo9_layout.pdf filter=lfs diff=lfs merge=lfs -text
1068
+ parse/dev/IfFZr1gl0b/IfFZr1gl0b_layout.pdf filter=lfs diff=lfs merge=lfs -text
1069
+ parse/dev/IfFZr1gl0b/IfFZr1gl0b_origin.pdf filter=lfs diff=lfs merge=lfs -text
1070
+ parse/dev/s_PJMEGIUfa/s_PJMEGIUfa_origin.pdf filter=lfs diff=lfs merge=lfs -text
1071
+ parse/dev/e95i1IHcWj/e95i1IHcWj_origin.pdf filter=lfs diff=lfs merge=lfs -text
1072
+ parse/dev/vfsRB5MImo9/vfsRB5MImo9_span.pdf filter=lfs diff=lfs merge=lfs -text
1073
+ parse/dev/e95i1IHcWj/e95i1IHcWj_span.pdf filter=lfs diff=lfs merge=lfs -text
1074
+ parse/dev/UROBiQEOLP/UROBiQEOLP_origin.pdf filter=lfs diff=lfs merge=lfs -text
1075
+ parse/dev/UROBiQEOLP/UROBiQEOLP_span.pdf filter=lfs diff=lfs merge=lfs -text
1076
+ parse/dev/s_PJMEGIUfa/s_PJMEGIUfa_layout.pdf filter=lfs diff=lfs merge=lfs -text
1077
+ parse/dev/fCbTxKYJovs/fCbTxKYJovs_origin.pdf filter=lfs diff=lfs merge=lfs -text
1078
+ parse/dev/KVljrqehulG/KVljrqehulG_origin.pdf filter=lfs diff=lfs merge=lfs -text
1079
+ parse/dev/IfFZr1gl0b/IfFZr1gl0b_span.pdf filter=lfs diff=lfs merge=lfs -text
1080
+ parse/dev/KVljrqehulG/KVljrqehulG_span.pdf filter=lfs diff=lfs merge=lfs -text
1081
+ parse/dev/fCbTxKYJovs/fCbTxKYJovs_span.pdf filter=lfs diff=lfs merge=lfs -text
1082
+ parse/dev/s_PJMEGIUfa/s_PJMEGIUfa_span.pdf filter=lfs diff=lfs merge=lfs -text
1083
+ parse/dev/UROBiQEOLP/UROBiQEOLP_layout.pdf filter=lfs diff=lfs merge=lfs -text
1084
+ parse/dev/KVljrqehulG/KVljrqehulG_layout.pdf filter=lfs diff=lfs merge=lfs -text
1085
+ parse/dev/mWVoBz4W0u/mWVoBz4W0u_layout.pdf filter=lfs diff=lfs merge=lfs -text
1086
+ parse/dev/uuUQraD4XX/uuUQraD4XX_layout.pdf filter=lfs diff=lfs merge=lfs -text
1087
+ parse/dev/fCbTxKYJovs/fCbTxKYJovs_layout.pdf filter=lfs diff=lfs merge=lfs -text
1088
+ parse/dev/mWVoBz4W0u/mWVoBz4W0u_origin.pdf filter=lfs diff=lfs merge=lfs -text
1089
+ parse/dev/uuUQraD4XX/uuUQraD4XX_span.pdf filter=lfs diff=lfs merge=lfs -text
parse/dev/-H48S9ePSUC/-H48S9ePSUC.md ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FUNDAMENTAL LIMITS OF TRANSFER LEARNING IN BINARY CLASSIFICATIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ A critical performance barrier in modern machine learning is scarcity of labeled data required for training state of the art massive models, especially in quickly emerging problems with lack of extensive data sets or scenarios where data collection and labeling is expensive/time consuming. Transfer learning is gaining traction as a promising technique to alleviate this barrier by utilizing the data of a related but different source task to compensate for the lack of data in a target task where there are few labeled training data. While there has been many recent algorithmic advances in this domain, a fundamental understanding of when and how much one can transfer knowledge from a related domain to reduce the amount of labeled training data is far from understood. We provide a precise answer to this question for binary classification problems by deriving a novel lower bound on the generalization error that can be achieved by any transfer learning algorithm (regardless of its computational complexity) as a function of the amount of source and target samples. Our lower bound depends on a natural notion of distance that can be easily computed on real world data sets. Other key features of our lower bound are that it applies to any arbitrary source/target data distributions and requires minimal assumptions that enables it application to a broad range of problems. We also consider a more general setting where there are more than one source domains for knowledge transfer to the target task and develop new bounds on generalization error in this setting. We also corroborate our theoretical findings on real image classification and action recognition data sets. These experiments demonstrate that our natural notion of distance is indicative of the difficulty of knowledge transfer between different pairs of source/target tasks, allowing us to investigate the effect of different sources on the target generalization error. Furthermore, to evaluate the sharpness of our bounds we compare our developed lower bounds with upper-bounds achieved by transfer learning base-lines that utilize weighted empirical risk minimization on the combination of source(s) and target data sets.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Modern machine learning models such as deep neural networks have enjoyed wide success in many domains Krizhevsky et al. (2012). The success of such deep models critically relies on an enormous amount of data required for training these massive models. For instance, GPT3 which is the state of the art model for natural language process has 175 billion parameters and requires a data set of size 45 terabytes for training. However, in new or emerging application domains it is often extremely difficult or costly to gather such large labeled training data.
12
+
13
+ A promising approach to this problem has been via transfer learning which aims at leveraging abundant available labeled data from a related source task to reduce the amount of labeled data required for the target task Pan & Yang (2009); Weiss et al. (2016). From a practical perspective transfer learning has been rather successful empirically. In particular, state of the art transfer learning approaches based on pretrained models and fine tuning has led to significant improvements on various benchmark datasets. Despite this empirical success however there is a huge gap between theory and practice in transfer learning and the fundamental limits and benefits of transfer learning are not well understood. Key challenging questions include: What is an appropriate notion of similarity between different tasks and how can it be quantitatively defined and computed on real data? What is the best achievable accuracy of any transfer learning algorithm with only a limited number of source and target samples? How does this accuracy depend on the number of samples and the similarity between the source and target tasks?
14
+
15
+ While the answer to these challenging questions are still not fully understood, they have indeed attracted a lot of interesting theoretical work in this area Galanti et al. (2016). We will discuss this literature in thorough detail in Section 2. In this paper, we take a step towards answering the aforementioned key questions enabling a better understanding of the fundamental limits of transfer learning. We focus on binary classifications where the goal is to learn a classifier from a hypothesis class with a finite VC-dimension. This covers most contemporary classification models including the training deep neural networks for binary classification. In this setting, we first define a natural notion of similarity between source and target tasks via the performance of the best source hypothesis on the target task. Then equipped with this notion of similarity, we derive a statistical minimax lower bound on the target generalization error in terms of the number of labeled data from source and target tasks as well as the VC dimension of the hypothesis class and the similarity between source and target tasks. Furthermore, we extend this result to the case where there are multiple sources with different similarity to the target. Our results demonstrate that sources with high similarity to the target are more effective at reducing the target generalization error. Towards bridging the theory-practice gap in transfer learning we also demonstrate the utility of our theoretical result in concrete applications. Indeed, a key feature of our result is that our lower bounds can be easily and efficiently computed on real data sets and apply to a broad class of practical settings.
16
+
17
+ In summary our key contributions are as follows:
18
+
19
+ • We develop a novel statistical minimax lower bound on the generalization error that can be achieved by any transfer learning algorithm as a function of the amount of source and target samples and a natural notion of similarity between source and target tasks.
20
+ • A key features of our lower bound (including our notion of similarity) is that it can be easily computed on real world data sets. Furthermore, our lower bound holds for any source/target distribution and applies with minimal assumptions to a wide variety of contemporary learning models including deep neural networks.
21
+ • We investigate the sharpness of our lower bounds and demonstrate their utility via experiments on action recognition and image classification.
22
+
23
+ # 2 PRIOR WORKS
24
+
25
+ A closely related literature to transfer learning is domain adaptation where there is no or very few labeled target data and the goal is to adapt the hypothesis learned on the source domain to achieve a low target generalization error Chen et al. (2019); Blitzer et al. (2007); Azizzadenesheli et al. (2018); Long et al. (2016); Shen et al. (2018). Most of this literature assume that source and target share a common labeling rule but there is a shift in the marginal distributions. There are many upper bounds for the target generalization error in this setting this setting. For instance, Ben-David et al. (2007; 2010) gives an upper bound for the target generalization error in terms of source generalization error and a divergence measure between the domains that can be estimated by finitely many unlabeled data from the source and target. In another work Mansour et al. (2009) introduces a new discrepancy distance and generalizes the results of Ben-David et al. (2007) for a wide family of loss functions using Rademacher complexity. Similar to this setting, but for multiple source domain adaption scheme, Mansour et al. (2021) proposes a family of algorithms based on the idea of model selection under the assumption that target distribution is close to some convex combination of sources. A more recent work Lei et al. (2021) studies linear regression under shift distribution including covariate shift (i.e. conditional distributions of source and target are the same) as well as model shift (i.e. only distributions of the features of the source and target are the same) and develops algorithms achieving near optimal minimax risk in this setting.
26
+
27
+ In addition to upper bounds, there are also a few results which provide lower bounds for target generalization error. David et al. (2010) provides impossibility results under the assumption of covariate shift and small discrepancy of unlabeled distributions. Mousavi Kalan et al. (2020) studies transfer learning with one hidden layer neural networks for regression problems. This result defines a notion of similarity between the source and target tasks based on a distance between the ground truth parameters of the source and target networks. Using this distance this paper develops a statistical minimax lower bound for the target generalization error in terms of the number of source and target samples as well as the defined similarity of the source and target under the distribution shift with the assumption that the features are generated by Gaussian distributions. Compared to Mousavi Kalan et al. (2020) our result has quite a few unique advantages: (1) We do not assume that the source and target data are generated according to a planted (teacher) network and our results now even hold in the agnostic setting. (2) Mousavi Kalan et al. (2020) applies to regression problems but this result covers classification (3) Mousavi Kalan et al. (2020) only considered one-hidden layer neural networks for predicting the labels of extracted features. In this result we can handle arbitrary deep neural networks. (4) Our notion of similarity between the source and target distributions can be much more easily estimated by using only a few target data without the need for estimating the ground truth target parameters which requires lots of labeled target data.
28
+
29
+ More closely related to this work Hanneke & Kpotufe (2019) derives a minimax lower bound for target generalization error in binary classification under the assumption of a relaxed version of covariate shift and small transfer exponent parameter which is defined to measure the discrepancy of the source and target distributions. Our work differs from this previous work as except for assuming the VC dimension of the model is finite we do not make any further assumptions. This makes our results applicable in a much broader set of classifications or decision making problems. Furthermore, our lower bound can be evaluated on real data sets and serve as a guideline to practitioners helping them decide when utilizing additional knowledge from a source domain is useful for a given target task.
30
+
31
+ Most of the literature in transfer learning try to provide sufficiency and necessity results by deriving upper and lower bounds for target generalization error in a relatively general setting. However, these papers often require a variety of assumptions to find the optimal classifier in a target domain in closed form. For instance, Karbalayghareh et al. (2019; 2018) defines a joint prior distribution of source and target domains using a Wishart distribution which relate the source and target tasks and then makes it possible to study and understand the transferability between domains. Furthermore, in this setting, the authors develop a closed form optimal Bayesian transfer learning and demonstrate its advantage over a classifier obtained by only target data. Related to this setting but for regressions, Karbalayghareh et al. (2018) obtains the optimal Bayesian transfer learning under setting of joint Gaussian feature/label distribution. In contrast with the above in our paper we do not make any assumptions about the distribution of the data.
32
+
33
+ # 3 PROBLEM FORMULATION
34
+
35
+ We consider a transfer learning problem where there are some labeled training data from a source task and a target task with the goal of inferring a hypothesis function with small generalization error in the target task. More specifically, we assume have $n _ { S }$ and $n _ { T }$ source and target labeled data where each training data consists of an input/feature as well as an output/label. We denote the source and training data by $( \pmb { x } _ { S } , y _ { S } ) \sim \mathbb { P }$ and $\bar { \mathbf { \Omega } } ( \mathbf { x } _ { T } , y _ { T } ) \sim \mathbb { Q }$ , respectively, where $y _ { S } , y _ { T } \in \{ 0 , 1 \}$ and $\mathbb { P } , \mathbb { Q }$ are the joint feature-label distributions of source and target data. Additionally, we assume that source and target features/inputs share a same domain, ${ \pmb x } _ { S } , { \pmb x } _ { T } \in { \chi }$ , and $\mathcal { H } \subset 2 ^ { \chi }$ denotes a fixed hypothesis class with $d _ { \mathcal { H } }$ VC-dimension.
36
+
37
+ In transfer learning the goal is to find a hypothesis from $\mathcal { H }$ that minimizing the target excess risk defined below based on a combination of source and target data.
38
+
39
+ Definition 1 (Excess risk) For a hypothesis function $h \in \mathcal H$ and source and target label-feature data generated according to distributions $\mathbb { P }$ and $\mathbb { Q }$ $( ( \pmb { x } _ { S } , y _ { S } ) \sim \mathbb { P }$ and $( \pmb { x } _ { T } , \pmb { y } _ { T } ) \sim \mathbb { Q } )$ , we define the source and target excess risks as follows
40
+
41
+ $$
42
+ \mathcal { E } _ { T } ( h ) = \mathbb { Q } [ h ( \mathbf { x } _ { T } ) \neq y _ { T } ] - \mathbb { Q } [ h _ { T } ^ { * } ( \mathbf { x } _ { T } ) \neq y _ { T } ]
43
+ $$
44
+
45
+ and
46
+
47
+ $$
48
+ \begin{array} { c } { \displaystyle \varepsilon _ { S } ( h ) = \mathbb { P } [ h ( \pmb { x } _ { S } ) \neq y _ { S } ] - \mathbb { P } [ h _ { S } ^ { \ast } ( \pmb { x } _ { S } ) \neq y _ { S } ] } \\ { \displaystyle h _ { T } ^ { \ast } = \arg \operatorname* { m i n } _ { h \in \mathcal { H } } \mathbb { Q } [ h ( \pmb { x } _ { T } ) \neq y _ { T } ] a n d h _ { S } ^ { \ast } = \arg \operatorname* { m i n } _ { h \in \mathcal { H } } \mathbb { P } [ h ( \pmb { x } _ { S } ) \neq y _ { S } ] } \end{array}
49
+ $$
50
+
51
+ Next, we need to define an appropriate notion of distance between the source and target. In the literature of domain adaptation, where the conditional expectation remains unchanged and there is
52
+
53
+ only a shift in input distributions, it is common to define the distance as the error of performance of the best source hypothesis in the target task. We also define the distance between source and target as the target excess risk of the best source hypothesis.
54
+
55
+ Definition 2 (Transfer distance) We define the transfer distance between a source and a target with distributions $\mathbb { P }$ and $\mathbb { Q }$ as follows
56
+
57
+ $$
58
+ \rho ( \mathbb { P } , \mathbb { Q } ) : = \mathbb { Q } [ h _ { S } ^ { \ast } ( \pmb { x } _ { T } ) \neq y _ { T } ] - \mathbb { Q } [ h _ { T } ^ { \ast } ( \pmb { x } _ { T } ) \neq y _ { T } ]
59
+ $$
60
+
61
+ Since we aim to derive a minimax lower bound for transfer learning in binary classifications, we consider the class of pairs of distributions whose transfer distance is within a fixed number $\Delta$ . As we will elaborate further in Remark 7 below this notion of distance can be easily estimated/computed in practice.
62
+
63
+ # 4 MAIN RESULTS
64
+
65
+ In this section we characterize the fundamental limits of transfer learning in binary classifications by deriving a minimax lower bound via information-theoretic arguments.
66
+
67
+ Theorem 1 Consider a transfer learning problem where there are $n _ { S }$ and $n _ { T }$ number of source as well as target data and the hypothesis class $\mathcal { H }$ has $V C$ dimension $d _ { \mathcal { H } }$ obeying $d _ { \mathcal { H } } \geq 1 0$ . Furthermore, suppose that $\hat { h } = \hat { h } ( S _ { \mathbb { P } } , S _ { \mathbb { Q } } )$ is an estimated hypothesis for the target task using source and target data in which $S _ { \mathbb { P } }$ and $S _ { \mathbb { Q } }$ denote i.i.d. feature-label data p rs $\{ ( \pmb { x } _ { S } ^ { ( i ) } , \pmb { y } _ { S } ^ { ( i ) } ) \} _ { i = 1 } ^ { n _ { S } }$ and $\{ ( \pmb { x } _ { T } ^ { ( i ) } , \pmb { y } _ { T } ^ { ( i ) } ) \} _ { i = 1 } ^ { n _ { T } }$ generated according to the source and target distributions $\mathbb { P }$ and $\mathbb { Q }$ . Fix a transfer distance $\Delta < 0 . 9 9$ . Then for any $\hat { h }$ there exists $( \mathbb { P } , \mathbb { Q } )$ with $\rho ( \mathbb { P } , \mathbb { Q } ) \leq \Delta$ and a universal constant $c$ such that
68
+
69
+ $$
70
+ P _ { \mathit { P } , \mathit { S } _ { \mathbb { Q } } } \bigg ( \mathcal { E } _ { T } ( \hat { h } ) > c \cdot \epsilon ( n _ { S } , n _ { T } , d _ { \mathcal { H } } , \Delta ) \bigg ) \geq \frac { 3 - 2 \sqrt { 2 } } { 8 } ,
71
+ $$
72
+
73
+ where
74
+
75
+ $$
76
+ \epsilon ( n _ { S } , n _ { T } , d _ { \mathcal { H } } , \Delta ) = \sqrt { \frac { 1 } { \frac { n _ { T } } { d _ { \mathcal { H } } } + \frac { n _ { S } } { d _ { \mathcal { H } } + n _ { S } \Delta } } } .
77
+ $$
78
+
79
+ This also implies that
80
+
81
+ $$
82
+ \operatorname* { i n f } _ { \hat { h } } \operatorname* { s u p } _ { \rho ( \mathbb { P } , \mathbb { Q } ) \leq \Delta } \operatorname* { \mathbb { E } } _ { S _ { \mathbb { P } } , S _ { \mathbb { Q } } } \Big [ \mathcal E _ { T } ( \hat { h } ) \Big ] \geq c \cdot \epsilon ( n _ { S } , n _ { T } , d _ { \mathcal H } , \Delta ) .
83
+ $$
84
+
85
+ Remark 1 The bound above characterizes the fundamental limits of transfer learning by providing a lower bound on the excess risk of any algorithm (regardless of computational tractability) as a function of the number of source and target training data, the similarity/distance between the source and target tasks and the dimension of the hypothesis class used.
86
+
87
+ Remark 2 The assumption $\Delta < 0 . 9 9$ in the statement of Theorem 1 is just made for simplifying the analysis and the upper bound of 0.99 can be replaced by any constant in the interval $( 0 , 1 )$ .
88
+
89
+ Remark 3 One can show that the numerical constant c in equation 4.1 obeys c > 3−2 248 .
90
+
91
+ Remark 4 (Connection to PAC learning) We note that the well-known agnostic PAC learning result for a single task gives a lower bound of $c \cdot \sqrt { \frac { d _ { \mathscr { H } } } { n } }$ where $n$ is the number of samples of the task. Theorem 1 recovers this result when there is not any source task, namely $n _ { S } = 0$ , and the transfer learning problem reduces to learning a task without any prior knowledge from the source.
92
+
93
+ Remark 5 (Identical source and target) When the source and target tasks are identical, then the transfer learning problem reduces to learning a single task with $n _ { S } + n _ { T }$ training data. Theorem 1, also leads to the same conclusion in this special case as when the source and target data are identical ∆ = 0 and thus  = q $\begin{array} { r } { \epsilon = \sqrt { \frac { d _ { \mathcal { H } } } { n _ { S } + n _ { T } } } } \end{array}$ which states that the lower bound is proportional to reciprocal of combination of source and target samples as expected.
94
+
95
+ Remark 6 (Sharpness in a special case) We note that the above lower bound is known to be tight in special cases. For instance when there is a small amount of source data and $\Delta$ is rather large, the lower bound reduces to dHn which is known to be tight based on known agnostic PAC learning bounds.
96
+
97
+ Remark 7 (How to apply Theorem 1 in practical settings.) In this remark we explain how Theorem 1 can be applied when using contemporary machine learning models involving artificial neural networks. In this case, the hypothesis class corresponds to all neural networks with a fixed architecture but different parameters. It is known that the class of neural networks with a fixed architecture has finite VC dimension and Harvey et al. (2017) gives upper and lower bounds for VC dimension of neural networks with ReLU activation functions. Thus, to apply Theorem 1, one only needs to have an estimate of the transfer distance per Definition 2. We note that the transfer distance 3.1 consists of two terms: To estimate the first term, we note that $h _ { S } ^ { * }$ can be easily estimated due to the abundance of source data in most applications. Also with an estimate of $h _ { S } ^ { * }$ in hand one can estimate $\mathbb { Q } [ h _ { S } ^ { * } ( { \pmb x } _ { T } ) \neq { \ - { \boldsymbol y } _ { T } } ]$ rather accurately using a simple empirical average with a few target test data as well-known concentration of bounded functions imply that this empirical average is well concentrated around $\mathbb { Q } [ h _ { S } ^ { * } ( { \pmb x } _ { T } ) \neq { \ - { \boldsymbol y } _ { T } } ]$ . Up on first glance it seems that estimating the second term which corresponds to the lowest possible error in the target domain among the hypothesis class, requires a large amount of labeled target data which is not available in a practical problem. However, in an overparametrized setting, it is typical to assume that there exists a network which achieves very small target generalization error so we can ignore the second term in most practical problems. Finally we note that as stated earlier the lower bound on the target excess risk gives an estimate of what generalization performance we can expect with a certain number of source and target samples. Furthermore, by comparing the estimated transfer distance of different pairs of tasks, we can find the pairs that are more suitable for transfer learning. This knowledge can in turn significantly reduce the required number of target samples to achieve a certain accuracy.
98
+
99
+ Next, we extend our result to a multiple source transfer learning setup where instead of only one source task there are several source tasks available and the goal is to transfer knowledge from multiple sources to a given target task to achieve a small target generalization error.
100
+
101
+ Theorem 2 Suppose that there are $n _ { S _ { 1 } } , n _ { S _ { 2 } } , . . . , n _ { S _ { N } }$ number of samples from $N$ source tasks as well as $n _ { T }$ number of samples from a target task and the hypothesis class $\mathcal { H }$ has VC dimension $d _ { \mathcal { H } }$ obeying $d _ { \mathcal { H } } \ge \operatorname* { m a x } { ( N + 9 , N / 2 ) }$ . Furthermore, suppose that $\hat { h } = \hat { h } ( S _ { \mathbb { P } _ { 1 } } , S _ { \mathbb { P } _ { 2 } } , . . . , S _ { \mathbb { P } _ { N } } , S _ { \mathbb { Q } } )$ is an estimated e tarand $N$ sources and target data where generated according to souce a $S _ { \mathbb { P } _ { j } }$ and targe $S _ { \mathbb { Q } }$ denstrib e i.i.ions dataand {(x(i)Sj , y(i)Sj )} ji=1 $\{ ( \pmb { x } _ { T } ^ { ( i ) } , \pmb { y } _ { T } ^ { ( i ) } ) \} _ { i = 1 } ^ { n _ { T } }$ $\mathbb { P } _ { j }$ $\mathbb { Q }$ for $j = 1 , . . . , N$ . Fix transfer distances $\{ \Delta _ { j } \} _ { j = 1 } ^ { N }$ where $0 \leq \Delta _ { j } \leq 1$ . Then for any $\hat { h }$ there exists $( \mathbb { P } _ { 1 } , . . . , \mathbb { P } _ { M } , \mathbb { Q } )$ with $\rho ( \mathbb { P } _ { j } , \mathbb { Q } ) \leq \Delta _ { j }$ and a universal constant c such that
102
+
103
+ $$
104
+ \operatorname* { P r o b } _ { S _ { \mathrm { P } _ { 1 } } , \dots , S _ { \mathrm { P } _ { N } } , S _ { \mathrm { Q } } } \Bigg ( \mathcal { E } _ { T } ( \hat { h } ) > c \cdot \epsilon ( n _ { S _ { 1 } } , \dots , n _ { S _ { N } } , n _ { T } , d _ { \mathcal { H } } , \Delta _ { 1 } , . . . , \Delta _ { N } ) \Bigg ) \geq \frac { 3 - 2 \sqrt { 2 } } { 8 } ,
105
+ $$
106
+
107
+ where
108
+
109
+ $$
110
+ \epsilon ( n _ { S _ { 1 } } , . . . , n _ { S _ { N } } , n _ { T } , d _ { \mathcal { H } } , \Delta _ { 1 } , . . . , \Delta _ { N } ) = \sqrt { \frac { 1 } { \frac { n _ { T } } { d _ { \mathcal { H } } } + \frac { n _ { S _ { 1 } } } { d _ { \mathcal { H } } + n _ { S _ { 1 } } \Delta _ { 1 } } + . . . + \frac { n _ { S _ { N } } } { d _ { \mathcal { H } } + n _ { S _ { N } } \Delta _ { N } } } } .
111
+ $$
112
+
113
+ This in turn implies that
114
+
115
+ $$
116
+ \operatorname* { i n f } _ { \hat { h } } \operatorname* { s u p } _ { \rho ( \mathbb { P } _ { j } , \mathbb { Q } ) \leq \Delta _ { j } } S _ { \mathbb { P } _ { 1 } , \ldots , \mathbb { P } _ { N } , S _ { \mathbb { Q } } } \Big [ \mathcal { E } _ { T } ( \hat { h } ) \Big ] \geq c \cdot \epsilon ( n _ { S _ { 1 } } , . . . , n _ { S _ { N } } , n _ { T } , d _ { \mathcal { H } } , \Delta _ { 1 } , . . . , \Delta _ { N } ) .
117
+ $$
118
+
119
+ Remark 8 Similar to the previous theorem, Theorem 2 provides a minimax lower bound for target excess risk with the key distinction that now it applies in the setting where there are multiple source with different transfer distances to the target. This theorem characterizes the exces risk achievable by any algorithm as a function of these transfer distances as well as the number of samples from the different sources and the target data. Theorem 2 indicates that the more sources we have, the better performance we can achieve in the target domain. However, this performance gain maybe marginal for source tasks that have a large transfer distance to the target or where there are very few training data. In these cases of course it may be more computationally efficient to discard these sources given the marginal improvement in the generalization performance suggested by this theorem.
120
+
121
+ Remark 9 (Identical sources) if all the source tasks are identical, then there are effectively $n _ { S _ { 1 } } ~ + ~ . . . ~ + ~ n _ { S _ { N } }$ number of source samples and by Theorem 1 the lower bound would be 1PNj=1 nSj . Theorem 2 also gives the same order wise lower bound as nT + dH dH+∆ PNj=1 nSj
122
+
123
+ $$
124
+ \begin{array} { r } { \sqrt { \frac { 1 } { \frac { n _ { T } } { d _ { \mathcal { H } } } + \sum _ { j = 1 } ^ { N } \frac { n _ { j } } { d _ { \mathcal { H } } + \Delta n _ { j } } } } \le \sqrt { \frac { 1 } { \frac { n _ { T } } { d _ { \mathcal { H } } } + \frac { \sum _ { j = 1 } ^ { N } n _ { S _ { j } } } { d _ { \mathcal { H } } + \Delta \sum _ { j = 1 } ^ { N } n _ { S _ { j } } } } } \le \sqrt { N } \cdot \sqrt { \frac { 1 } { \frac { n _ { T } } { d _ { \mathcal { H } } } + \sum _ { j = 1 } ^ { N } \frac { n _ { j } } { d _ { \mathcal { H } } + \Delta n _ { j } } } } } \end{array}
125
+ $$
126
+
127
+ Remark 10 (Infinitely many source samples) When ∆i > 0 and nSi → ∞, the fraction nSidH+nS ∆i saturates at $\frac { 1 } { \Delta _ { i } }$ which shows that when the source and target have positive distance, the source can never compensate for the target samples.
128
+
129
+ Remark 11 In the lower bound, the product terms $\Delta _ { i } n _ { S _ { i } }$ appear which indicate that a source with large transfer distance can sometimes be as useful as a source with small transfer distance when there is a large amount of training data available from that source.
130
+
131
+ # 5 EXPERIMENTAL RESULTS
132
+
133
+ In this section we evaluate our theoretical results on real data sets for action recognition and image classification tasks. By estimating the parameters appearing in Theorem 1 for different pairs of tasks, we first plot the lower bounds and then by running weighted empirical risk minimization investigate the sharpness of the bounds. We also investigate the effectiveness of different source tasks with different transfer distances on the target generalization error.
134
+
135
+ # 5.1 ACTION RECOGNITION
136
+
137
+ Experimental setup. We first perform experiments on the UCF101 action recognition data set. We pick CricketBowling and TableTennis videos from UCF101 as the target task as well as three different pairs of classes as the source tasks: 1- CricketBowling and BaseballPitch, 2- Cricketshot and Archery, 3- BasketballDunk and Basketball. We pass the videos through an i3d network pretrained on kinetics400 Carreira & Zisserman (2017) with the fully connected top classifier removed and extract the corresponding features of dimension 2048 from the raw videos. We then work with the extracted features instead of the raw videos.
138
+
139
+ Training. We train a one hidden layer neural network with 15 number of hidden units and ReLU activation functions for each pair of data sets. Table 3 consists of test accuracy on CricketBowling vs. TableTennis, when using the network trained on each source task. We use these accuracies for deriving the corresponding lower bounds. Furthermore, we run weighted empirical risk minimization as a simple transfer learning approach to find some upper bounds on the target generalization error. Given $n _ { S }$ and $n _ { T }$ number of source and target samples, for estimating the corresponding one hidden layer neural network parameters we minimize the following weighted empirical risk
140
+
141
+ $$
142
+ \operatorname* { m i n } _ { W _ { 1 } , W _ { 2 } } \frac { 1 - \lambda } { n _ { T } } \sum _ { i = 1 } ^ { n _ { T } } \mathbf { C o s t } ( W _ { 2 } \mathbf { R e L U } ( W _ { 1 } \pmb { x } _ { T } ^ { ( i ) } ) , y _ { T } ^ { ( i ) } ) + \frac { \lambda } { n _ { S } } \sum _ { i = 1 } ^ { n _ { S } } \mathbf { C o s t } ( W _ { 2 } \mathbf { R e L U } ( W _ { 1 } \pmb { x } _ { S } ^ { ( i ) } ) , y _ { S } ^ { ( i ) } )
143
+ $$
144
+
145
+ where the function Cost denotes the logistic regression cost and $\lambda \in \{ 0 , 0 . 2 , 0 . 4 , 0 . 6 , 0 . 8 , 1 \}$ . We then pick the lambda which minimizes the target test error.
146
+
147
+ Results. First we calculate the transfer distance by Definition 2 for each source/target pairs using Table 1. To this end, we assume that best target generalization error is zero and using the Table 1 we obtain the transfer distance for each pair which is demonstrated in Table 2. As it can be observed by Table 2, the pair of Source1 and Target has the lowest transfer distance among other pairs since both of the source and target tasks share a same class which is CricketBowling. Furthermore, Table 2 determines which pairs are more suitable for transferring the source knowledge to the target.
148
+
149
+ Table 1
150
+
151
+ <table><tr><td>Task</td><td>Test accuracy of Target us- ing the source network</td></tr><tr><td>Target:CricketBowlingvs.TableTennis Source1: CricketBowling vs.Baseball Pitch Source2: Cricketshot vs.Archery Source3:BasketballDunk vs.Basketball</td><td>1 0.946 0.61 0.52</td></tr></table>
152
+
153
+ <table><tr><td>pair of tasks</td><td>p(Source,Target)</td></tr><tr><td>(Source1, Target)</td><td>0.053</td></tr><tr><td>(Source2, Target)</td><td>0.39</td></tr><tr><td>(Source3,Target)</td><td>0.48</td></tr></table>
154
+
155
+ Table 2: Transfer distance of pairs of source and target on UCF101 action recognition.
156
+
157
+ ![](images/2c241193221490f096d20c1db5bb3ebe4553c3e1b29a5f9a4c43fa4d3551c9e2.jpg)
158
+ Figure 1: (a) depicts our lower bounds for three pairs of source and target tasks on action classification. (b) depicts the lower bounds along with the upper bounds obtained via weighted empirical risk minimization.
159
+
160
+ Next, we draw the lower bound curves for each pair in Fig 1a. To this end, we need to find the VC dimension of the hypothesis class which consists of neural networks with the architecture of $2 0 4 8 * 1 5 * 1$ with ReLU activation functions. Theorem 1 in Harvey et al. (2017) gives a lower bound for VC dimension of neural networks with ReLU activation functions by $\begin{array} { r } { \frac { 1 } { 6 4 0 } \dot { W } \dot { L } \log _ { 2 } \frac { W } { L } } \end{array}$ where $W$ and are the number of parameters and layers, respectively. Then in Figure 1b we plot the lower bounds along with the upper bounds obtained via Formula 5.1 for three different pairs of source and target as well as using only target samples. We obtained these upper bounds by running Formula 5.1 five times and then averaging the results. Fig 1b shows that when the distance of a source from the target is small it would be more effective in achieving small target generalization error. We would like to mention that in all of these plots we choose the same number of source samples for each pair.
161
+
162
+ Figure 2 shows the average $\lambda$ , the weight appearing in Formula 5.1, when the number of target samples is 100 to 150. It shows that in the pair Source1 and Target the average $\lambda$ is high which demonstrate the usefulness of the source in the target task. Furthermore, the small value of $\lambda$ in the pair Source3 and Target suggests that when the transfer distance is high, source samples are no longer usefull.
163
+
164
+ # 5.2 IMAGE CLASSIFICATION
165
+
166
+ Experimental setup. In this section we focus on image classification tasks and utilize Theorem 1 to recognize appropriate pairs of tasks that are suitable for transfer learning. We choose some classes of the DomainNet data set Peng et al. (2019) as source and target tasks. We pick Clock and Ambulance from DomainNet Clipart for the target task and three different pairs of classes as the source tasks: 1- Clock and Ambulance, 2- Cricketshot and TableTennis, 3- TableTennis and FrontCraw. Here we
167
+
168
+ ![](images/1df4f1137b5f43be56ef563df21cd603dfe5643d8bffa4d7a5b2e8b91d2fa116.jpg)
169
+ Figure 2: Average $\lambda$ in weighted empirical risk minimization for three different pairs of source and target tasks for action recognition.
170
+
171
+ Table 3
172
+
173
+ <table><tr><td>Task</td><td>Test Accuracy of Target using the source network</td></tr><tr><td>Target: Clock vs. Ambulance (Clipart) Source1: Clock vs.Ambulance (Sketch) Source2: Clock vs. Crow(Sketch)</td><td>0.916 0.697</td></tr></table>
174
+
175
+ ![](images/13e028571da16adec8995d8d638a4e0ce066f5cf2190ce602d12a912311c3bd1.jpg)
176
+ Figure 3: (a) depicts our lower bounds for three pairs of source and target tasks on image classification. (b) depicts the lower bounds along with the upper bounds obtained via weighted empirical risk minimization.
177
+
178
+ <table><tr><td>pair of tasks</td><td>p(Source, Target)</td></tr><tr><td>(Source1, Target)</td><td>0.083</td></tr><tr><td>(Source2, Target)</td><td>0.3</td></tr><tr><td>(Source3, Target)</td><td>0.35</td></tr></table>
179
+
180
+ Table 4: Transfer distance of pairs of source and target on DomainNet image classifications].
181
+
182
+ use ResNet50 network pretrained on Imagenet for extracting features of dimension 2048 and in the sequel we work with the extracted features rather than the raw image data.
183
+
184
+ Training. We train a one hidden layer neural network with 15 number of hidden units and ReLU activation functions for each of pairs of the tasks. Table 3 includes the test accuracy on the target task when using the networks trained on different sources, which is necessary for estimating/calculating the transfer distance as demonstrated in Table 4. Similar to the subsection 5.1, we also run weighted empirical risk minimization for finding upper bounds for the pairs of the source and target tasks.
185
+
186
+ Results. Similar to the previous section on action recognition, using Table 3 we can obtain the transfer distances and based on this distance we can identify suitable pairs of source and target tasks for transfer learning. In the pair1 Source and target tasks share the same objects which are Clock and Ambulance which results in low transfer distance. In pair2, still one of the objects which is Clock is the same in the source and target and we can see that the transfer distance for pair2 is lower than that for pair3. Then we plot the lower bounds in Fig 3a and the corresponding upper bounds obtained by weighted empirical risk minimization in Fig 3b. One can see that sources that are closer to the target according to our notion of distance are more effective in achieving small target generalization error.
187
+
188
+ ![](images/7a303c3706559f7a90ce3dfe420c8b7330324be99f6ba51d8e74ec5e3805fcc7.jpg)
189
+ Figure 4: Average $\lambda$ in weighted empirical risk minimization for three different pairs of source and target tasks for image classification.
190
+
191
+ CricketBowling is common both in the source and Target1. This suggests that these tasks are similar to each other and the estimated transfer distance conforms with this intuition. Furthermore, CricketBowling and Cricketshot are intuitively similar to one another and this is also reflected in the lower transfer distance between source and Target2.
192
+
193
+ In Fig 4 we plot the average $\lambda$ , the weight appearing in Formula 5.1 when the number of target samples varies from 150 to 200. 4 demonstrates that when a source is close to the target the weight of source risk in weighted empirical risk becomes high which shows the effectiveness of source samples in achieving small target generalization error.
194
+
195
+ # 6 PROOF OUTLINE
196
+
197
+ The main idea of proof is based on the following proposition proved in Tsybakov (2009)
198
+
199
+ Proposition 1 [Theorem 2.5 of Tsybakov (2009)] Assume that $M \geq 2$ and the function $d ( \cdot , \cdot )$ is a semi-distance. Also suppose that $\{ P _ { \theta _ { j } } \} _ { \theta _ { j } \in \Theta }$ is a family of distributions indexed over a parameter space, $\Theta$ , and $\Theta$ contains elements $\theta _ { 0 } , \bar { \theta } _ { 1 } , . . . , \theta _ { M }$ such that:
200
+
201
+ $$
202
+ d ( \theta _ { i } , \theta _ { j } ) \geq 2 s > 0 , \ \forall 0 \leq j < k \leq M
203
+ $$
204
+
205
+ (ii) $P _ { j } \ll P _ { 0 } , \ \forall \ j = 1 , . . . , M .$ , and
206
+
207
+ $$
208
+ \frac { 1 } { M } \sum _ { j = 1 } ^ { M } { \mathcal { D } } _ { k l } ( P _ { j } | P _ { 0 } ) \leq \alpha \log M
209
+ $$
210
+
211
+ with $0 < \alpha < 1 / 8$ and $P _ { j } = P _ { \theta _ { j } }$ , $j = 0 , 1 , . . . , M$ and $\mathcal { D } _ { k l }$ denotes the KL-divergence. Then
212
+
213
+ $$
214
+ \operatorname* { i n f } _ { \hat { \theta } } \operatorname* { s u p } _ { \theta \in \Theta } P _ { \theta } ( d ( \hat { \theta } , \theta ) \geq s ) \geq \frac { \sqrt { M } } { 1 + \sqrt { M } } \big ( 1 - 2 \alpha - \sqrt { \frac { 2 \alpha } { \log M } } \big )
215
+ $$
216
+
217
+ Based on Proposition 1 we construct a family of pairs of distributions, namely source and target distributions, whose transfer distances satisfy the $\Delta$ -constraint. To do so we pick some points from the domain $\chi$ shattered by the hypothesis class and define appropriate distributions on this set of points. Furthermore, this family of distributions are indexed in the space of $\{ - 1 , 1 \} ^ { d }$ which can be a metric space using Hamming distance. In order to satisfy the condition (i) in Proposition 1, the indexes have to be well separated which can be achieved using the well-known Gilbert-Varshamov’s bound. Finally we show that estimating a parameter with small hamming distance is equivalent to estimating an appropriate hypothesis with small excess risk error.
218
+
219
+ # REFERENCES
220
+
221
+ Kamyar Azizzadenesheli, Anqi Liu, Fanny Yang, and Animashree Anandkumar. Regularized learning for domain adaptation under label shifts. In International Conference on Learning Representations, 2018.
222
+
223
+ Shai Ben-David, John Blitzer, Koby Crammer, Fernando Pereira, et al. Analysis of representations for domain adaptation. Advances in neural information processing systems, 19:137, 2007.
224
+
225
+ Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1):151–175, 2010.
226
+
227
+ John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman. Learning bounds for domain adaptation. In NIPS, 2007.
228
+
229
+ Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6299–6308, 2017.
230
+
231
+ Xinyang Chen, Sinan Wang, Mingsheng Long, and Jianmin Wang. Transferability vs. discriminability: Batch spectral penalization for adversarial domain adaptation. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research. PMLR, 2019.
232
+
233
+ Shai Ben David, Tyler Lu, Teresa Luu, and David P ´ al. Impossibility theorems for domain adaptation. ´ In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 129–136. JMLR Workshop and Conference Proceedings, 2010.
234
+
235
+ Tomer Galanti, Lior Wolf, and Tamir Hazan. A theoretical framework for deep transfer learning. Information and Inference: A Journal of the IMA, 5(2):159–209, 2016.
236
+
237
+ Steve Hanneke and Samory Kpotufe. On the value of target data in transfer learning. In NeurIPS, 2019.
238
+
239
+ Nick Harvey, Christopher Liaw, and Abbas Mehrabian. Nearly-tight vc-dimension bounds for piecewise linear neural networks. In Conference on learning theory, pp. 1064–1068. PMLR, 2017.
240
+
241
+ Alireza Karbalayghareh, Xiaoning Qian, and Edward R Dougherty. Optimal bayesian transfer regression. IEEE Signal Processing Letters, 25(11):1655–1659, 2018.
242
+
243
+ Alireza Karbalayghareh, Xiaoning Qian, and Edward Russell Dougherty. Optimal bayesian transfer learning for count data. IEEE/ACM transactions on computational biology and bioinformatics, 2019.
244
+
245
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097–1105, 2012.
246
+
247
+ Qi Lei, Wei Hu, and Jason Lee. Near-optimal linear regression under distribution shift. In International Conference on Machine Learning, pp. 6164–6174. PMLR, 2021.
248
+
249
+ Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Unsupervised domain adaptation with residual transfer networks. Advances in Neural Information Processing Systems, 2016.
250
+
251
+ Yishay Mansour, Mehryar Mohri, and Afshin Rostamizadeh. Domain adaptation: Learning bounds and algorithms. In 22nd Conference on Learning Theory, COLT 2009, 2009.
252
+
253
+ Yishay Mansour, Mehryar Mohri, Jae Ro, Ananda Theertha Suresh, and Ke Wu. A theory of multiplesource adaptation with limited target labeled data. In International Conference on Artificial Intelligence and Statistics, pp. 2332–2340. PMLR, 2021.
254
+
255
+ Seyed Mohammadreza Mousavi Kalan, Zalan Fabian, Salman Avestimehr, and Mahdi Soltanolkotabi. Minimax lower bounds for transfer learning with linear and one-hidden layer neural networks. In Advances in Neural Information Processing Systems, 2020.
256
+
257
+ Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2009.
258
+
259
+ Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang. Moment matching for multi-source domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1406–1415, 2019.
260
+
261
+ Jian Shen, Yanru Qu, Weinan Zhang, and Yong Yu. Wasserstein distance guided representation learning for domain adaptation. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
262
+
263
+ Alexandre B Tsybakov. Introduction to Nonparametric Estimation. Springer series in statistics. Springer, Dordrecht, 2009. doi: 10.1007/b13794.
264
+
265
+ Karl Weiss, Taghi M Khoshgoftaar, and DingDing Wang. A survey of transfer learning. Journal of Big data, 3(1):1–40, 2016.
266
+
267
+ # 7 APPENDIX
268
+
269
+ # 7.1 PROOF OF THEOREM 1
270
+
271
+ We also use the following famous result in information theory known as Gilbert-Varhsamov’s bound for packing argument.
272
+
273
+ Proposition 2 (Lemma 2.9 of Tsybakov (2009)) Let $d \_ 8$ . Then there exists a subset $\{ w ^ { ( 0 ) } , . . . , w ^ { ( M ) } \}$ of $\Omega = \{ - 1 , \mathrm { \bar { 1 } } \} ^ { d }$ such that $w ^ { ( 0 ) } = ( 1 , 1 , . . . , 1 )$ ,
274
+
275
+ $$
276
+ d i s t ( w ^ { ( j ) } , w ^ { ( k ) } ) \geq \frac { d } { 8 } , \ \forall 0 \leq j < k \leq M a n d M \geq 2 ^ { d / 8 } ,
277
+ $$
278
+
279
+ where $\begin{array} { r } { d i s t ( w , w ^ { \prime } ) = \sum _ { k = 1 } ^ { d } I ( w _ { k } \ne w _ { k } ^ { \prime } ) } \end{array}$ is the Hamming distance between binary sequences $w = ( w _ { 1 } , . . . , w _ { d } )$ and $\boldsymbol { w } ^ { \prime } = \bar { ( } w _ { 1 } ^ { \prime } , . . . , w _ { d } ^ { \prime } )$ .
280
+
281
+ We will also use the following lemma proved in Hanneke & Kpotufe (2019). We would like to mention that some ideas of the proof are similar to those in Hanneke & Kpotufe (2019). However, as discussed in section 2, the problem setting of Hanneke & Kpotufe (2019) is different from that of this work which results in constructing a different set of distributions.
282
+
283
+ Lemma 1 Let $0 < \epsilon < 1 / 2$ and $z \in \{ - 1 , 1 \}$ . Then
284
+
285
+ $$
286
+ \mathcal { D } _ { k l } \bigg ( B e r \big ( 1 / 2 + ( z / 2 ) \cdot \epsilon \big ) , B e r \big ( 1 / 2 - ( z / 2 ) \cdot \epsilon \big ) \bigg ) \le c _ { 0 } \cdot \epsilon ^ { 2 } f o r s o m e c _ { 0 } \le 4 i n d e p ,
287
+ $$
288
+
289
+ Now we are in place to provide the proof of Theorem 1. Let $d = d _ { \mathcal { H } } - 2$ and pick $\pmb { x } _ { - 1 } , \pmb { x } _ { 0 } , . . . , \pmb { x } _ { d }$ from $\chi$ shattered by $\mathcal { H }$ .
290
+
291
+ Next, we construct a family of pairs of distributions $\left( \mathbb { P } _ { w } , \mathbb { Q } _ { w } \right)$ indexed by $w \in \{ - 1 , 1 \} ^ { d }$ where $\{ - 1 , 1 \} ^ { d }$ is the parameter space playing the role of $\Theta$ in Proposition 1. For the following, fix $\epsilon =$ $\begin{array} { r } { \dot { c } _ { 1 } \cdot \epsilon ( \dot { n _ { S } } , n _ { T } , d _ { \mathcal { H } } ^ { \cdot } , \Delta ) \leq \frac { 1 } { 2 } } \end{array}$ for some constant $c _ { 1 }$ to be determined later in proof and $\epsilon ( n _ { S } , n _ { T } , d _ { \mathcal { H } } , \Delta )$ is defined in Theorem 1.
292
+
293
+ Distribution $\mathbb { Q } _ { w } \colon \mathbb { Q } _ { w }$ is composed of a marginal and a conditional distribution, namely $\mathbb { Q } _ { w } =$ $\mathbb { Q } _ { x } ^ { w } \times \mathbb { Q } _ { y | x } ^ { w }$ . We define the marginaldistributions as follows:
294
+
295
+ $$
296
+ \begin{array} { l l l } { \mathbb { Q } _ { x } ^ { w } ( { \pmb x } = { \pmb x } _ { - 1 } ) = \Delta } \\ { \mathbb { Q } _ { x } ^ { w } ( { \pmb x } = { \pmb x } _ { 0 } ) = 0 . 9 9 - \Delta } \\ { \mathbb { Q } _ { \pmb x } ^ { w } ( { \pmb x } = { \pmb x } _ { i } ) = \displaystyle \frac { 1 } { 1 0 0 d } \mathrm { f o r } i = 1 , . . , d } \end{array}
297
+ $$
298
+
299
+ For the conditional distributions:
300
+
301
+ $$
302
+ \begin{array} { r l } & { \mathbb { Q } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { - 1 } ) = \mathbb { Q } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { 0 } ) = 1 } \\ & { \mathbb { Q } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { i } ) = 1 / 2 + ( w _ { i } ) \epsilon \mathrm { ~ f o r ~ } i = 1 , . . , d } \end{array}
303
+ $$
304
+
305
+ Distribution $\mathbb { P } _ { w }$ : $\mathbb { P } _ { w }$ is composed of a marginal and a conditional distribution, namely $\mathbb { P } _ { w } =$ $\mathbb { P } _ { x } ^ { w } \times \mathbb { P } _ { y | x } ^ { w }$ . We define the marginal distributions as follows:
306
+
307
+ $$
308
+ \begin{array} { l l l } { \displaystyle \mathbb { P } _ { \pmb { x } } ^ { w } ( \pmb { x } = \pmb { x } _ { - 1 } ) = \mathbb { P } _ { \pmb { x } } ^ { w } ( \pmb { x } = \pmb { x } _ { 0 } ) = 1 / 2 \big ( 1 - \frac { d } { d + n _ { S } \Delta } \big ) } \\ { \displaystyle \mathbb { P } _ { \pmb { x } } ^ { w } ( \pmb { x } = \pmb { x } _ { i } ) = \frac { 1 } { d + n _ { S } \Delta } \mathrm { ~ f o r ~ } i = 1 , . . , d } \end{array}
309
+ $$
310
+
311
+ For the conditional distributions:
312
+
313
+ $$
314
+ \begin{array} { r l } & { \mathbb { P } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { - 1 } ) = 0 } \\ & { \mathbb { P } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { 0 } ) = 1 } \\ & { \mathbb { P } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { i } ) = 1 / 2 + ( w _ { i } ) \epsilon \mathrm { ~ f o r ~ } i = 1 , . . , d } \end{array}
315
+ $$
316
+
317
+ Verifying $\rho ( \mathbb { P } _ { w } , \mathbb { Q } _ { w } ) \leq \Delta$ : Bayes classifier of the domain generated by $\mathbb { P } _ { w }$ is as follows:
318
+
319
+ $$
320
+ \begin{array} { r l } & { h _ { S } ^ { * } ( { \pmb x } _ { - 1 } ) = 0 } \\ & { h _ { S } ^ { * } ( { \pmb x } _ { 0 } ) = 1 } \\ & { h _ { S } ^ { * } ( { \pmb x } _ { i } ) = 1 \mathrm { i f } w _ { i } = 1 \mathrm { , , o t h e r w i s e } h _ { S } ^ { * } ( { \pmb x } _ { i } ) = 0 \mathrm { f o r } i = 1 , . . , d } \end{array}
321
+ $$
322
+
323
+ Similarly for the domain generated by $\mathbb { Q } _ { w }$ , we have
324
+
325
+ $$
326
+ \begin{array} { r l } & { h _ { T } ^ { * } ( { \pmb x } _ { - 1 } ) = h _ { T } ^ { * } ( { \pmb x } _ { 0 } ) = 1 } \\ & { h _ { T } ^ { * } ( { \pmb x } _ { i } ) = 1 \mathrm { i f } w _ { i } = 1 \mathrm { , o t h e r w i s e } h _ { T } ^ { * } ( { \pmb x } _ { i } ) = 0 \mathrm { f o r } i = 1 , . . , d } \end{array}
327
+ $$
328
+
329
+ So $h _ { S } ^ { * }$ and $h _ { T } ^ { * }$ disagree only on ${ \pmb x } _ { - 1 }$ which implies that
330
+
331
+ $$
332
+ \rho ( \mathbb { P } _ { w } , \mathbb { Q } _ { w } ) = \mathbb { Q } [ h _ { S } ^ { \ast } ( { \pmb x } _ { T } ) \neq y _ { T } ] - \mathbb { Q } [ h _ { T } ^ { \ast } ( { \pmb x } _ { T } ) \neq y _ { T } ] = \Delta
333
+ $$
334
+
335
+ Since we want to derive a lower bound for the minimax risk stated in Theorem 1, among the hypotheses that they agree on $\mathbf { \boldsymbol { x } } _ { i }$ for $i = 1 , . . . , d$ , the hypothesis that outputs ${ \pmb x } _ { - 1 }$ and $\scriptstyle { \pmb x } _ { 0 }$ as 1 results in a smaller target error. Hence, we can restrict ourselves to $\tilde { \mathcal { H } }$ which is the projection of $\mathcal { H }$ onto $\{ - 1 , 1 \} ^ { d }$ with the constraint that $h ( \pmb { x } _ { - 1 } ) = h ( \pmb { x } _ { 0 } ) = 1$ for all $h \in \tilde { \mathcal { H } }$ . Furthermor, for any $w , w ^ { \prime } \in \{ - 1 , 1 \} ^ { d }$ we have
336
+
337
+ $$
338
+ \mathcal { E } _ { T } ( h _ { w ^ { \prime } } ) = \frac { \mathrm { d i s t } ( w , w ^ { \prime } ) } { 1 0 0 d } \cdot \epsilon , ~ \forall ~ h _ { w ^ { \prime } } \in \tilde { \mathcal { H } }
339
+ $$
340
+
341
+ when the target domain is generated by $\mathbb { Q } _ { w }$
342
+
343
+ Reduction to a packing: By using Proposition 2, we can get a subset $\Sigma$ of $\{ - 1 , 1 \} ^ { d }$ whose cardinality is $M \geq 2 ^ { d / 8 }$ and for any $w , w ^ { \prime }$ belonging to $\Sigma$ we have $\operatorname* { l i s t } ( w , w ^ { \prime } ) \geq d / 8$ . Furthermore, for any $w , w ^ { \prime } \in \Sigma$ we have
344
+
345
+ $$
346
+ \mathcal { E } _ { T } ( h _ { w ^ { \prime } } ) \geq \frac { d } { 8 } \cdot \frac { \epsilon } { 1 0 0 d } = \frac { \epsilon } { 8 0 0 }
347
+ $$
348
+
349
+ On the other hand, there is a bijective map between $\{ - 1 , 1 \} ^ { d }$ and elements of $\tilde { \mathcal { H } }$ and any classifier $\hat { h } : \{ { \pmb x } _ { i } \} \{ 0 , 1 \}$ with $\hat { h } ( { \pmb x } _ { - 1 } ) = \hat { h } ( { \pmb x } _ { 0 } ) = 1$ can be reduced to a $w \in \{ - 1 , 1 \} ^ { d }$ . So we can choose $\Sigma$ as the set of indices in Proposition 1 with Hamming distance as the semi-metric and the expression $P _ { w } ( \mathrm { d i s t } ( \hat { w } , w ) > d / 8 )$ translates into $P _ { w } ( \mathcal { E } _ { T } ( h _ { \hat { w } } ) > c \cdot \epsilon )$ .
350
+
351
+ KL divergence bound (part (ii) of Proposition 1): Define $P _ { w } = \mathbb { P } _ { w } ^ { n _ { S } } \times \mathbb { Q } _ { w } ^ { n _ { T } }$ . For any $w , w ^ { \prime } \in \Sigma$ we have
352
+
353
+ $$
354
+ \begin{array} { l } { \mathcal { D } _ { k l } ( P _ { w } | P _ { w ^ { \prime } } ) = n _ { S } \cdot \mathcal { D } _ { k l } ( \mathbb { P } _ { w } | \mathbb { P } _ { w } ^ { \prime } ) + n _ { T } \cdot \mathcal { D } _ { k l } ( \mathbb { Q } _ { w } | \mathbb { Q } _ { w ^ { \prime } } ) } \\ { \displaystyle \quad = n _ { S } \cdot \frac { \mathbb { E } } { \mathbb { P } _ { \alpha } } \mathcal { D } _ { k l } ( \mathbb { P } _ { y | \alpha } ^ { w } | \mathbb { P } _ { y | \alpha } ^ { w ^ { \prime } } ) + n _ { T } \cdot \mathbb { E } \mathcal { D } _ { k l } ( \mathbb { Q } _ { y | x } ^ { w } | \mathbb { Q } _ { y | x } ^ { w ^ { \prime } } ) } \\ { \displaystyle \quad = n _ { S } \cdot \sum _ { i = 1 } ^ { d } \frac { 1 } { d + n _ { S } \Delta } \mathcal { D } _ { k l } ( \mathbb { P } _ { y | x _ { i } } ^ { w } | \mathbb { P } _ { y | x _ { i } } ^ { w ^ { \prime } } ) + n _ { T } \cdot \sum _ { i = 1 } ^ { d } \frac { 1 } { 1 0 0 d } \mathcal { D } _ { k l } ( \mathbb { Q } _ { y | x _ { i } } ^ { w } | \mathbb { Q } _ { y | x _ { i } } ^ { w ^ { \prime } } ) } \\ { \displaystyle \quad \leq n _ { S } \cdot \frac { d } { d + n _ { S } \Delta } c _ { 0 } \epsilon ^ { 2 } + n _ { T } \cdot \frac { 1 } { 1 0 0 } c _ { 0 } \epsilon ^ { 2 } } \\ { \displaystyle \quad \leq c _ { 0 } c _ { 1 } ^ { 2 } . } \end{array}
355
+ $$
356
+
357
+ if $\begin{array} { r } { c _ { 1 } < \frac { 1 } { 6 } } \end{array}$ then $c _ { 0 } c _ { 1 } ^ { 2 } < \frac { 1 } { 8 }$ and we can apply Proposition 1.
358
+
359
+ Proof of Theorem 2 is similar to that of Theorem 1. However, we construct different target and source probability distributions.
360
+
361
+ Let $d \ = \ d _ { \mathcal { H } } \ - \ N - \ 1$ and pick $x _ { - M } , . . . , x _ { 0 } , x _ { 1 } , . . . , x _ { d }$ from $\chi$ shattered by $\mathcal { H }$ . Then we construct a family of distributions $( \mathbb { P } _ { w } ^ { ( 1 ) } , . . . , \mathbb { P } _ { w } ^ { ( N ) } , \mathbb { Q } _ { w } )$ indexed by $w ~ \in ~ \{ - 1 , 1 \} ^ { d }$ . Let $\epsilon =$ $c _ { 1 } \cdot \epsilon ( n _ { S _ { 1 } } , . . . , n _ { S _ { N } } , n _ { T } , d _ { \mathcal { H } } , \Delta _ { 1 } , . . . , \Delta _ { N } )$ for some constant $c _ { 1 } < 1$ to be determined later in proof. Furthermore, without loss of generality assume that $1 \ge \Delta _ { 1 } \ge \Delta _ { 2 } \ge . . . \ge \Delta _ { N } \ge 0$ .
362
+
363
+ Distribution $\mathbb { Q } _ { w } \colon \mathbb { Q } _ { w }$ is composed of a marginal and a conditional distribution, namely $\mathbb { Q } _ { w } =$ $\mathbb { Q } _ { x } ^ { w } \times \mathbb { Q } _ { y | x } ^ { w }$ . We define the marginal distributions as follows:
364
+
365
+ $$
366
+ \begin{array} { l } { { \mathbb Q } _ { x } ^ { w } ( { \pmb x } = { \pmb x } _ { - i } ) = \Delta _ { i } - \Delta _ { i + 1 } \mathrm { ~ f o r ~ } i = 1 , . . . , N - 1 \mathrm { ~ a n d ~ } \mathbb Q _ { { \pmb x } } ^ { w } ( { \pmb x } = { \pmb x } _ { - N } ) = \Delta _ { N } } \\ { { \mathbb Q } _ { { \pmb x } } ^ { w } ( { \pmb x } = { \pmb x } _ { 0 } ) = 0 . 9 9 - \Delta _ { 1 } } \\ { { \mathbb Q } _ { { \pmb x } } ^ { w } ( { \pmb x } = { \pmb x } _ { i } ) = \displaystyle \frac 1 { 1 0 0 d } \mathrm { ~ f o r ~ } i = 1 , . . , d } \end{array}
367
+ $$
368
+
369
+ For the conditional distributions:
370
+
371
+ $$
372
+ \begin{array} { r l } & { \mathbb { Q } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { - i } ) = 1 \mathrm { f o r } i = 1 , . . . , N } \\ & { \mathbb { Q } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { 0 } ) = 1 } \\ & { \mathbb { Q } _ { y | \pmb { x } } ^ { w } ( y = 1 | \pmb { x } = \pmb { x } _ { i } ) = 1 / 2 + ( w _ { i } ) \epsilon \mathrm { f o r } i = 1 , . . . , d } \end{array}
373
+ $$
374
+
375
+ Distribution $\mathbb { P } _ { w } ^ { ( i ) } \colon \mathbb { P } _ { w } ^ { ( i ) }$ is composed of a marginal and a conditional distribution, namely $\mathbb { P } _ { w } ^ { ( i ) } =$ $\mathbb { P } _ { \pmb { x } } ^ { w ( i ) } \times \mathbb { P } _ { \pmb { y } | \pmb { x } } ^ { w ( i ) }$ x(i). We define the marginal distributions as follows:
376
+
377
+ $$
378
+ \begin{array} { l l } { \displaystyle \mathbb { P } _ { \pmb { x } } ^ { w ( i ) } ( \pmb { x } = \pmb { x } _ { - j } ) = \frac { 1 } { N + 1 } \big ( 1 - \frac { d } { d + n _ { S _ { i } } \Delta _ { i } } \big ) \mathrm { ~ f o r ~ } j = 1 , . . . , N } \\ { \displaystyle \mathbb { P } _ { \pmb { x } } ^ { w ( i ) } ( \pmb { x } = \pmb { x } _ { 0 } ) = \frac { 1 } { N + 1 } \big ( 1 - \frac { d } { d + n _ { S _ { i } } \Delta _ { i } } \big ) } \\ { \displaystyle \mathbb { P } _ { \pmb { x } } ^ { w ( i ) } ( \pmb { x } = \pmb { x } _ { j } ) = \frac { 1 } { d + n _ { S _ { i } } \Delta _ { i } } \mathrm { ~ f o r ~ } j = 1 , . . , d } \end{array}
379
+ $$
380
+
381
+ For the conditional distributions:
382
+
383
+ $$
384
+ \begin{array} { r l } & { \mathbb { P } _ { y | x } ^ { w } ( y = 1 | x = x _ { - j } ) = 0 \mathrm { i f } j \geq i , \mathrm { o t h e r w i s e } \mathbb { P } _ { y | x } ^ { w } ( y = 1 | x = x _ { - j } ) = 1 \mathrm { f o r } j = 1 , . . . } \\ & { \mathbb { P } _ { y | x } ^ { w } ( y = 1 | x = x _ { 0 } ) = 1 } \\ & { \mathbb { P } _ { y | x } ^ { w } ( y = 1 | x = x _ { j } ) = 1 / 2 + ( w _ { j } ) \epsilon \mathrm { f o r } j = 1 , . . . , d } \end{array}
385
+ $$
386
+
387
+ Verifying $\rho ( \mathbb { P } _ { w } ^ { ( i ) } , \mathbb { Q } _ { w } ) \leq \Delta _ { i }$
388
+
389
+ Bayes classifier of the domain generated by $\mathbb { P } _ { w } ^ { ( i ) }$ is as follows:
390
+
391
+ $$
392
+ \begin{array} { r l } & { h _ { S _ { i } } ^ { * } ( \boldsymbol { x } _ { - j } ) = 0 \mathrm { i f } j \geq i , \mathrm { o t h e r w i s e } h _ { S _ { i } } ^ { * } ( \boldsymbol { x } _ { - j } ) = 1 \mathrm { f o r } j = 1 , . . . , N } \\ & { h _ { S _ { i } } ^ { * } ( \boldsymbol { x } _ { 0 } ) = 1 } \\ & { h _ { S _ { i } } ^ { * } ( \boldsymbol { x } _ { j } ) = 1 \mathrm { i f } w _ { j } = 1 , \mathrm { o t h e r w i s e } h _ { S _ { i } } ^ { * } ( \boldsymbol { x } _ { j } ) = 0 \mathrm { f o r } j = 1 , . . , d } \end{array}
393
+ $$
394
+
395
+ Similarly for the domain generated by $\mathbb { Q } _ { w }$ , we have
396
+
397
+ $$
398
+ \begin{array} { r l } & { h _ { T } ^ { * } ( \pmb { x } _ { - j } ) = 1 \mathrm { f o r } j = 1 , . . . , N } \\ & { h _ { T } ^ { * } ( \pmb { x } _ { 0 } ) = 1 } \\ & { h _ { T } ^ { * } ( \pmb { x } _ { j } ) = 1 \mathrm { i f } w _ { j } = 1 , \mathrm { o t h e r w i s e } h _ { T } ^ { * } ( \pmb { x } _ { j } ) = 0 \mathrm { f o r } j = 1 , . . , d } \end{array}
399
+ $$
400
+
401
+ So $h _ { S _ { i } } ^ { * }$ and $h _ { T } ^ { * }$ disagree on $\pmb { x } _ { - i } , . . , \pmb { x } _ { - N }$ which implies that
402
+
403
+ $$
404
+ \rho ( \mathbb { P } _ { w } ^ { ( i ) } , \mathbb { Q } _ { w } ) = \mathbb { Q } [ h _ { S _ { i } } ^ { \ast } ( \pmb { x } _ { T } ) \neq y _ { T } ] - \mathbb { Q } [ h _ { T } ^ { \ast } ( \pmb { x } _ { T } ) \neq y _ { T } ] = \Delta _ { i }
405
+ $$
406
+
407
+ With the same argument we used in the proof of Theorem 1 we can restrict ourselves to $\tilde { \mathcal { H } }$ which is the projection of $\mathcal { H }$ with the constraint that $h ( \pmb { x } _ { - N } ) = \ldots = h ( \pmb { x } _ { - 1 } ) = h ( \pmb { x } _ { 0 } ) = 1$ for all $h \in \tilde { \mathcal { H } }$ .
408
+
409
+ The rest of the proof is exactly the same except the part regarding the KL divergence bound.
410
+
411
+ KL divergence bound: Define $P _ { w } = \mathbb { P } _ { w } ^ { ( 1 ) ^ { n _ { S _ { 1 } } } } \times \ldots \times \mathbb { P } _ { w } ^ { ( N ) ^ { n _ { S _ { N } } } } \times \mathbb { Q } _ { w } ^ { n _ { T } } .$ 1 × ... × P(N )w nSN ×
412
+
413
+ $$
414
+ \begin{array} { r l } { { \operatorname* { P } _ { k l } ( P _ { w } | P _ { w ^ { \prime } } ) = \sum _ { j = 1 } ^ { N } n _ { S _ { j } } \cdot P _ { k l } ( \mathbb { P } _ { w } ^ { ( j ) } | \mathbb { P } _ { w ^ { \prime } } ^ { ( j ) } ) + n _ { I } \cdot \mathcal { P } _ { k l } ( \mathbb { Q } _ { w } | \mathbb { Q } _ { w ^ { \prime } } ) } } \\ & { = \sum _ { j = 1 } ^ { N } n _ { S _ { j } } \cdot \mathbb { E } _ { \mathbb { P } } \mathbb { P } _ { k l } ( \mathbb { P } _ { y | z } ^ { w } ) | \mathbb { P } _ { y | z } ^ { w ^ { \prime } ( j ) } ) + n _ { T } \cdot \mathbb { E } _ { \mathbb { P } } \mathcal { P } _ { k l } ( \mathbb { Q } _ { y | z } ^ { w } | \mathbb { Q } _ { y | z } ^ { n ^ { \prime } } ) } \\ & { = \sum _ { j = 1 } ^ { N } n _ { S _ { j } } \cdot \displaystyle \sum _ { \mathrm { i } = 1 } ^ { G } \frac { 1 } { d + n _ { S _ { j } } \Delta _ { j } } \mathcal { D } _ { k l } ( | \mathbb { P } _ { y | z } ^ { w } ( \cdot ) ( i ) | \mathbb { P } _ { y | z _ { h } } ^ { n ^ { \prime } } ( \cdot ) + n _ { T } \cdot \displaystyle \sum _ { \mathrm { i } = 1 } ^ { d } \frac { 1 } { 1 0 0 d } \mathcal { D } _ { k l } ( \mathbb { Q } _ { y | z _ { h } } ^ { w } | \mathbb { Q } _ { y | z _ { h } } ^ { n ^ { \prime } } ) } \\ & { \leq \displaystyle \sum _ { j = 1 } ^ { N } n _ { S _ { j } } \cdot \frac { d } { d + n _ { S _ { j } } \Delta _ { j } } c _ { 0 } e ^ { 2 } + n _ { T } \cdot \frac { 1 } { 1 0 0 } c _ { 0 } e ^ { 2 } } \\ & { \leq \displaystyle \sum _ { j = 1 } ^ { N } n _ { S _ { j } } \cdot \frac { d } { d + n _ { S _ { j } } \Delta _ { j } } c _ { 0 } e ^ { 2 } + n _ { T } \cdot \frac { 1 } { 1 0 0 } c _ { 0 } e ^ { 2 } } \\ & { \leq c _ { 0 } c _ { j } ^ { 2 } . d } \end{array}
415
+ $$
416
+
417
+ for small enough $c _ { 1 }$ we can apply Proposition 1.
418
+
419
+ # 7.3 ADDITIONAL EXPERIMENTAL RESULTS
420
+
421
+ In section 5 we fix number of source samples and vary the number of target samples. Here in order to investigate the effect of source samples on the target generalization error, we fix the number of target samples at $\cdot$ and vary the number of source samples. Fig 5 depicts the theoretical lower bounds along with the upper bounds obtained by empirical risk minimization for image classifications. We use the same source/target pairs as used in section 5.2. Fig 5 demonstrates that Source1 is more helpful in reducing the target generalization error because it has a low distance from the target. Furthermore, it shows that increasing the number of source samples is useful up to a point and beyond that point the error saturates and does not decrease further as discussed in Remark 10.
422
+
423
+ ![](images/68afa0a6eca3c2060650667d2fbccf678290c955da93e7e8eaee731207bf9f06.jpg)
424
+ Figure 5: Depicts the lower bounds along with the upper bounds obtained via weighted empirical risk minimization. In this setting the number of target samples is fixed at $n _ { T } = 3$
parse/dev/-H48S9ePSUC/-H48S9ePSUC_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/-H48S9ePSUC/-H48S9ePSUC_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/-H48S9ePSUC/-H48S9ePSUC_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/0IywQ8uxJx/0IywQ8uxJx_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2743e01b5908e1cefa4d1d4681c857e4c9b2ac1f40e40348581d00220d29932
3
+ size 1512917
parse/dev/0IywQ8uxJx/0IywQ8uxJx_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:392a326a4f6db38d3491c34cf1f967434fe2a2ca4ffa8f6d1234f35da73981cf
3
+ size 708569
parse/dev/0IywQ8uxJx/0IywQ8uxJx_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8e0107ca5297e52576c18cd3dc3745cb6b56a24abd155487c6f50424b8c6872
3
+ size 1547647
parse/dev/17RDXeF-skZ/17RDXeF-skZ_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0eef0c1189c26b791c671df7bc60a847aac4ae80fdfdf946b28aa43a6e0fad5e
3
+ size 460369
parse/dev/17RDXeF-skZ/17RDXeF-skZ_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:523be7a8777a9447b6e3438fc58be754df34d5957c317cf30274adc6a1cda74b
3
+ size 295620
parse/dev/17RDXeF-skZ/17RDXeF-skZ_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44319d0688ea9886918c1721b5d275039a98e1e3a32c2f4ffb32e5f867f6c1b4
3
+ size 467334
parse/dev/1W8UwXAQubL/1W8UwXAQubL_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc92cb53ffcf38460d55715233a029f45e9845d3344b2589f2d3030ff1ec58f6
3
+ size 3417598
parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b82d5731a80449b3634609680a0f6e97055f94b71cc85be59798d867b43c3e6
3
+ size 2466253
parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4505eee8f79cab0abc2fcc0e2106039a6201183db55b5015a6d41fa88eb00db
3
+ size 2205588
parse/dev/1sx0Drq4jfT/1sx0Drq4jfT_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18a6089452a009ba433305edfa21d69170fac6a36e51b80d91a41a0e94243cce
3
+ size 2490745
parse/dev/3IyL2XWDkG/3IyL2XWDkG_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9eb424054f87ecc29f3c9444575848fe04aade2061864db02e9e6c2c05aa035b
3
+ size 929820
parse/dev/3IyL2XWDkG/3IyL2XWDkG_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e80bddac3bed91a44d2f22395a7206f5a22b7e9b641d7ca193f02df6b5c9a702
3
+ size 935536
parse/dev/3JvRnAzw_0/3JvRnAzw_0_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07a0db4bddb5fd6ea55a551a6c990e5d7a8e2f2ef3a82e863ef1a66e63ed8ffc
3
+ size 8008878
parse/dev/3JvRnAzw_0/3JvRnAzw_0_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a196b94156095383f7722e012b357a64cd75b6f9af687867fde575a9bf3c15c
3
+ size 7867757
parse/dev/3JvRnAzw_0/3JvRnAzw_0_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05a8545c5b3d9775cecd713707a78a7a01e506106042f799193af5a8a8dfc294
3
+ size 8011871
parse/dev/3KWnuT-R1bh/3KWnuT-R1bh.md ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONDITIONAL POSITIONAL ENCODINGS FOR VISION TRANSFORMERS
2
+
3
+ Xiangxiang $\mathbf { C h u ^ { 1 } }$ , Zhi Tian1, Bo Zhang1, Xinlong Wang2, Chunhua Shen3∗ 1 Meituan Inc. 2 Beijing Academy of AI 3 Zhejiang University, China {chuxiangxiang, tianzhi02, zhangbo97}@meituan.com, xinlong.wang96@gmail.com, chunhua@me.com
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a conditional positional encoding (CPE) scheme for vision Transformers (Dosovitskiy et al., 2021; Touvron et al., 2020). Unlike previous fixed or learnable positional encodings that are predefined and independent of input tokens, CPE is dynamically generated and conditioned on the local neighborhood of the input tokens. As a result, CPE can easily generalize to the input sequences that are longer than what the model has ever seen during the training. Besides, CPE can keep the desired translation equivalence in vision tasks, resulting in improved performance. We implement CPE with a simple Position Encoding Generator (PEG) to get seamlessly incorporated into the current Transformer framework. Built on PEG, we present Conditional Position encoding Vision Transformer (CPVT). We demonstrate that CPVT has visually similar attention maps compared to those with learned positional encodings and delivers outperforming results. Our Code is available at: https://git.io/CPVT.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recently, Transformers (Vaswani et al., 2017) have been viewed as a strong alternative to Convolutional Neural Networks (CNNs) in visual recognition tasks such as classification (Dosovitskiy et al., 2021) and detection (Carion et al., 2020; Zhu et al., 2021). Unlike the convolution operation in CNNs, which has a limited receptive field, the self-attention mechanism in the Transformers can capture the long-distance information and dynamically adapt the receptive field according to the image content. Consequently, Transformers are considered more flexible and powerful than CNNs, being promising to achieve more progress in visual recognition.
12
+
13
+ However, the self-attention operation in Transformers is permutation-invariant, which discards the order of the tokens in an input sequence. To mitigate this issue, previous works (Vaswani et al., 2017; Dosovitskiy et al., 2021) add the absolute positional encodings to each input token (see Figure 1a), which enables order-awareness. The positional encoding can either be learnable or fixed with sinusoidal functions of different frequencies. Despite being effective, these positional encodings seriously harm the flexibility of the Transformers, hampering their broader applications. Taking the learnable version as an example, the encodings are often a vector of equal length to the input sequence, which are jointly updated with the network weights during training. As a result, the length and the value of the positional encodings are fixed once trained. During testing, it causes difficulties of handling the sequences longer than the ones in the training data.
14
+
15
+ The inability to adapt to longer input sequences during testing greatly limits the range of generalization. For instance, in vision tasks like object detection, we expect the model can be applied to the images of any size during inference, which might be much larger than the training images. A possible remedy is to use bicubic interpolation to upsample the positional encodings to the target length, but it degrades the performance without fine-tuning as later shown in our experiments. For vision in general, we expect that the models be translation-equivariant. For example, the output feature maps of CNNs shift accordingly as the target objects are moved in the input images. However, the absolute positional encoding scheme might break the translation equivalence because it adds unique positional encodings to each token (or each image patch). One may overcome the issue with relative positional encodings as in (Shaw et al., 2018). However, relative positional encodings not only come with extra computational costs, but also require modifying the implementation of the standard Transformers. Last but not least, the relative positional encodings cannot work equally well as the absolute ones, because the image recognition task still requires absolute position information (Islam et al., 2020), which the relative positional encodings fail to provide.
16
+
17
+ ![](images/0c4b2513e8c89ba2d4113b63f9bdb7b99d31471e828098a2ee34f19b9c920289.jpg)
18
+ Figure 1. Vision Transformers: (a) ViT (Dosovitskiy et al., 2021) with explicit 1D learnable positional encodings (PE) (b) CPVT with conditional positional encoding from the proposed Position Encoding Generator (PEG) plugin, which is the default choice. (c) CPVT-GAP without class token (cls), but with global average pooling (GAP) over all items in the sequence. Note that GAP is a bonus version which has boosted performance.
19
+
20
+ In this work, we advocate a novel positional encoding (PE) scheme to incorporate the position information into Transformers. Unlike the predefined and input-agnostic positional encodings used in previous works (Dosovitskiy et al., 2021; Vaswani et al., 2017; Shaw et al., 2018), the proposed PE is dynamically generated and conditioned on the local neighborhood of input tokens. Thus, our positional encodings can change along with the input size and try to keep translation equivalence. We demonstrate that the vision transformers (Dosovitskiy et al., 2021; Touvron et al., 2020) with our new PE (i.e. CPVT, see Figure 1c) achieve even better performance. We summarize our contributions as, • We propose a novel positional encoding (PE) scheme, termed conditional position encodings (CPE). CPE is dynamically generated with Positional Encoding Generators (PEG) and can be effortlessly implemented by the modern deep learning frameworks (Paszke et al., 2019; Abadi et al., 2016; Chen et al., 2015), requiring no changes to the current Transformer APIs. Through an in-depth analysis and thorough experimentations, we unveil that this design affords both absolute and relative encoding yet it goes above and beyond.
21
+
22
+ • As opposed to widely-used absolute positional encodings, CPE can provide a kind of stronger explicit bias towards the translation equivalence which is important to improve the performance of Transformers.
23
+
24
+ • Built on CPE, we propose Conditional Position encoding Vision Transformer (CPVT). It achieves better performance than previous vison transformers (Dosovitskiy et al., 2021; Touvron et al., 2020).
25
+
26
+ • CPE can well generalize to arbitrary input resolutions, which are required in many important downstream tasks such as segmentation and detection. Through experiments we show that CPE can boost the segmentation and detection performance for pyramid transformers like (Wang et al., 2021) by a clear margin.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Since self-attention itself is permutation-equivariant (see A), positional encodings are commonly employed to incorporate the order of sequences (Vaswani et al., 2017). The positional encodings can either be fixed or learnable, while either being absolute or relative. Vision transformers follow the same fashion to imbue the network with positional information.
31
+
32
+ Absolute Positional Encoding. The absolute positional encoding is the most widely used. In the original transformer (Vaswani et al., 2017), the encodings are generated with the sinusoidal functions of different frequencies and then they are added to the inputs. Alternatively, the positional encodings can be learnable, where they are implemented with a fixed-dimension matrix/tensor and jointly updated with the model’s parameters with SGD.
33
+
34
+ Relative Positional Encoding. The relative position encoding (Shaw et al., 2018) considers distances between the tokens in the input sequence. Compared to the absolute ones, the relative positional encodings can be translation-equivariant and can naturally handle the sequences longer than the longest sequences during training (i.e., being inductive). A 2-D relative position encoding is proposed for image classification in (Bello et al., 2019), showing superiority to 2D sinusoidal embeddings. The relative positional encoding is further improved in XLNet (Yang et al., 2019b) and DeBERTa (He et al., 2020), showing better performance.
35
+
36
+ Other forms. Complex-value embeddings (Wang et al., 2019) are an extension to model global absolute encodings and show improvement. RoFormer (Su et al., 2021) utilizes a rotary position embedding to encode both absolute and relative position information for text classification. FLOATER (Liu et al., 2020) proposes a novel continuous dynamical model to capture position encodings. It is not limited by the maximum sequence length during training, meanwhile being parameter-efficient.
37
+
38
+ Similar designs to CPE. Convolutions are used to model local relations in ASR and machine translation (Gulati et al., 2020; Mohamed et al., 2019; Yang et al., 2019a; Yu et al., 2018). However, they are mainly limited to 1D signals. We instead process 2D vision images.
39
+
40
+ # 3 VISION TRANSFORMER WITH CONDITIONAL POSITION ENCODINGS
41
+
42
+ # 3.1 MOTIVATION
43
+
44
+ In vision transformers, an input image of size $H \times W$ is split into patches with size $S \times S$ , the number of patches is $\begin{array} { r } { \dot { N } = \frac { H \dot { W } \mathbb { 1 } } { S ^ { 2 } } } \end{array}$ . The patches are added with the same number of learnable absolute positional encoding vectors. In this work, we argue that the positional encodings used here have two issues. First, it prevents the model from handling the sequences longer than the learnable PE. Second, it makes the model not translation-equivariant because a unique positional encoding vector is added to every one patch. The translation equivalence plays an important role in classification because we hope the networks’ responses changes accordingly as the object moves in the image.
45
+
46
+ One may note that the first issue can be remedied by removing the positional encodings since except for the positional encodings, all other components (e.g., MHSA and FFN) of the vision transformer can directly be applied to longer sequences. However, this solution severely deteriorates the performance. This is understandable because the order of the input sequence is an important clue and the model has no way to extract the order without the positional encodings. The experiment results on ImageNet are shown in Table 1. By removing the positional encodings, DeiT-tiny’s performance on ImageNet dramatically degrades from $7 2 . 2 \%$ to $6 8 . 2 \%$ .
47
+
48
+ Second, in DeiT (Touvron et al., 2020), they show that we can interpolate the position encodings to make them have the same length of the longer sequences. However, this method requires finetuning the model a few more epochs, otherwise the performance will remarkably drop, as shown in Table 1. This goes contrary to what we would expect. With the higher-resolution inputs, we often expect a remarkable performance improvement without any fine-tuning. Finally, the relative position encodings (Shaw et al., 2018; Bello et al., 2019) can cope with both the aforementioned issues. However, the relative positional encoding cannot provide absolute position information, which is also important to the classification performance (Islam et al., 2020). As shown in Table 1, the model with relative position encodings has inferior performance ( $7 0 . 5 \%$ vs. $7 2 . 2 \%$ ).
49
+
50
+ Table 1. Comparison of various positional encoding (PE) strategies tested on ImageNet validation set in terms of the top-1 accuracy. Removing the positional encodings greatly damages the performance. The relative positional encodings have inferior performance to the absolute ones
51
+
52
+ <table><tr><td>Model</td><td>Encoding</td><td>Top-1@224(%)</td><td>Top-1@384(%)</td></tr><tr><td>DeiT-tiny (Touvron et al., 2020)</td><td>X</td><td>68.2</td><td>68.6</td></tr><tr><td>DeiT-tiny (Touvron et al., 2020)</td><td>learnable</td><td>72.2</td><td>71.2</td></tr><tr><td>DeiT-tiny (Touvron et al., 2020)</td><td>sin-cos</td><td>72.3</td><td>70.8</td></tr><tr><td>DeiT-tiny</td><td>2D RPE (Shaw et al., 2018)</td><td>70.5</td><td>69.8</td></tr></table>
53
+
54
+ # 3.2 CONDITIONAL POSITIONAL ENCODINGS
55
+
56
+ We argue that a successful positional encoding for vision tasks should meet these requirements,
57
+
58
+ (1) Making the input sequence permutation-variant and providing stronger explicit bias towards translation-equivariance.
59
+ (2) Being inductive and able to handle the sequences longer than the ones during training.
60
+ (3) Having the ability to provide the absolute position to a certain degree. This is important to the performance as shown in (Islam et al., 2020).
61
+
62
+ In this work, we find that characterizing the local relationship by positional encodings is sufficient to meet all of the above. First, it is permutation-variant because the permutation of input sequences also affects the order in some local neighborhoods. However, translation of an object in an input image does not change the order in its local neighborhood, i.e., translation-equivariant (see Section A). Second, the model can easily generalize to longer sequences since only the local neighborhoods of a token are involved. Besides, if the absolute position of any input token is known, the absolute position of all the other tokens can be inferred by the mutual relation between input tokens. We will show that the tokens on the borders can be aware of their absolute positions due to the commonly-used zero paddings.
63
+
64
+ Therefore, we propose positional encoding generators (PEG) to dynamically produce the positional encodings conditioned on the local neighborhood of an input token.
65
+
66
+ Positional Encoding Generator. PEG is illustrated in Figure 2. To condition on the local neighbors, we first
67
+
68
+ ![](images/e12ed07e330e1cbad3fc807996e87af006eec2275384ddc7e13bc09ba9a2aac7.jpg)
69
+ Figure 2. Schematic illustration of Positional Encoding Generator (PEG). Note $d$ is the embedding size, $N$ is the number of tokens.
70
+
71
+ reshape the flattened input sequence $X \in \mathbb { R } ^ { B \times N \times C }$ of DeiT back to $X ^ { \prime } \in \mathbb { R } ^ { B \times H \times W \times C }$ in the 2-D image space. Then, a function (denoted by $\mathcal { F }$ in Figure 2) is repeatedly applied to the local patch in $X ^ { \prime }$ to produce the conditional positional encodings $E ^ { \tilde { B } \times H \times \tilde { W } \times C }$ . PEG can be efficiently implemented with a 2-D convolution with kernel zero paddings here are important to make the mo $k$ l $( k \geq 3 )$ and re of $\frac { k - 1 } { 2 }$ zero paddings. Note tabsolute positions, and thecan $\mathcal { F }$ be of various forms such as various types of convolutions and many others.
72
+
73
+ # 3.3 CONDITIONAL POSITIONAL ENCODING VISION TRANSFORMERS
74
+
75
+ Built on the conditional positional encodings, we propose our Conditional Positional Encoding Vision Transformers (CPVT). Except that our positional encodings are conditional, we exactly follow
76
+
77
+ ViT and DeiT to design our vision transformers and we also have three sizes CPVT-Ti, CPVT-S and CPVT-B. Similar to the original positional encodings in DeiT, the conditional positional encodings are also added to the input sequence, as shown in Figure 1 (b). In CPVT, the position where PEG is applied is also important to the performance, which will be studied in the experiments.
78
+
79
+ In addition, both DeiT and ViT utilize an extra learnable class token to perform classification (i.e., cls token shown in Figure 1 (a) and (b)). By design, the class token is not translation-invariant, although it can learn to be so. A simple alternative is to directly replace it with a global average pooling (GAP), which is inherently translation-invariant, resulting in our CVPT-GAP. Together with CPE, CVPT-GAP achieves much better image classification performance.
80
+
81
+ # 4 EXPERIMENTS
82
+
83
+ # 4.1 SETUP
84
+
85
+ Datasets. Following DeiT (Touvron et al., 2020), we use ILSVRC-2012 ImageNet dataset (Deng et al., 2009) with 1K classes and 1.3M images to train all our models. We report the results on the validation set with 50K images. Unlike ViT (Dosovitskiy et al., 2021), we do not use the much larger undisclosed JFT-300M dataset (Sun et al., 2017).
86
+
87
+ Model variants. We have three models with various sizes to adapt to various computing scenarios. The detailed settings are shown in Table 9 (see B.1). All experiments in this paper are performed on Tesla V100 machines. Training the tiny model for 300 epochs takes about 1.3 days on a single node with 8 V100 GPU cards. CPVT-S and CPVT-B take about 1.6 and 2.5 days, respectively.
88
+
89
+ Training details All the models (except for CPVT-B) are trained for 300 epochs with a global batch size of 2048 on Tesla V100 machines using AdamW optimizer (Loshchilov & Hutter, 2019). We do not tune the hyper-parameters and strictly comply with the settings in DeiT (Touvron et al., 2020). The learning rate is scaled with this formula $l r _ { \mathrm { s c a l e } } = 0 . 0 0 0 5 { \cdot } \mathrm { B a t c h S i z e } _ { \mathrm { g l o b a l } } / { \scriptstyle 5 1 2 }$ . The detailed hyperparameters are in the B.2.
90
+
91
+ # 4.2 GENERALIZATION TO HIGHER RESOLUTIONS
92
+
93
+ As mentioned before, our proposed PEG can directly generalize to larger image sizes without any fine-tuning. We confirm this here by evaluating the models trained with $2 2 4 \times 2 2 4$ images on the $3 8 4 \times 3 8 4$ , $4 4 8 \times 4 4 8$ , $5 1 2 \times 5 1 2$ images, respectively. The results are shown in Table 2. With the $3 8 4 \times 3 8 4$ input images, the DeiT-tiny with learnable positional encodings degrades from $7 2 . 2 \%$ to $7 1 . 2 \%$ . When equipped with sine encoding, the tiny model degrades from $7 2 . 2 \%$ to $7 0 . 8 \%$ . In constrat, our CPVT model with the proposed PEG can directly process the larger input images, and CPVT-Ti’s performance is boosted from $7 3 . 4 \%$ to $7 4 . 2 \%$ when applied to $3 8 4 \times 3 8 4$ images. Our CPVT-Ti outperforms DeiT-tiny by $3 . 0 \%$ . This gap continues to increase as the input resolution enlarges.
94
+
95
+ Table 2. Direct evaluation on other resolutions without fine-tuning. The models are trained on $2 2 4 \times 2 2 4$ . A simple PEG of a single layer of $3 \times 3$ depth-wise convolution is used here
96
+
97
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Params</td><td rowspan=1 colspan=1>160(%)</td><td rowspan=1 colspan=1>224(%)</td><td rowspan=1 colspan=1>384(%)</td><td rowspan=1 colspan=1>448(%)</td><td rowspan=1 colspan=1>512(%)</td></tr><tr><td rowspan=1 colspan=1>DeiT-tinyDeiT-tiny (sin)DeiT-tiny (no pos)CPVT-TiCPVT-Ti ‡</td><td rowspan=1 colspan=1>6M6M6M6M6M</td><td rowspan=1 colspan=1>65.665.262.166.8(+1.2)67.7 (+2.1)</td><td rowspan=1 colspan=1>72.272.368.272.4(+0.2)73.4(+1.2)</td><td rowspan=1 colspan=1>71.270.868.673.2(+2.0)74.2(+3.0)</td><td rowspan=1 colspan=1>68.868.268.471.8(+3.0)72.6(+3.8)</td><td rowspan=1 colspan=1>65.965.165.070.3(+4.4)70.8(+4.9)</td></tr><tr><td rowspan=1 colspan=1>DeiT-smallCPVT-S</td><td rowspan=1 colspan=1>22M22M</td><td rowspan=1 colspan=1>75.676.1(+0.5)</td><td rowspan=1 colspan=1>79.979.9</td><td rowspan=1 colspan=1>78.180.4(+1.5)</td><td rowspan=1 colspan=1>75.978.6(+2.7)</td><td rowspan=1 colspan=1>72.676.8(+4.2)</td></tr><tr><td rowspan=1 colspan=1>DeiT-baseCPVT-B</td><td rowspan=1 colspan=1>86M86M</td><td rowspan=1 colspan=1>79.180.5(+1.4)</td><td rowspan=1 colspan=1>81.881.9(+0.1)</td><td rowspan=1 colspan=1>79.782.3(+2.6)</td><td rowspan=1 colspan=1>79.882.4(+2.6)</td><td rowspan=1 colspan=1>78.281.0(+2.8)</td></tr></table>
98
+
99
+ ‡: Insert one PEG each after the first encoder till the fifth encoder
100
+
101
+ # 4.3 CPVT WITH GLOBAL AVERAGE POOLING
102
+
103
+ By design, the proposed PEG is translation-equivariant (ignore paddings). Thus, if we further use the translation-invariant global average pooling (GAP) instead of the cls token before the final classification layer of CPVT. CPVT can be translation-invariant, which should be beneficial to the ImageNet classification task. Note the using GAP here results in even less computation complexity because we do not need to compute the attention interaction between the class token and the image patches. As shown in Table 3, using GAP here can boost CPVT by more than $1 \%$ . For example, equipping CPVT-Ti with GAP obtains $7 4 . 9 \%$ top-1 accuracy on the ImageNet validation dataset, which outperforms DeiT-tiny by a large margin $( + 2 . 7 \% )$ . Moreover, it even exceeds DeiT-tiny model with distillation $( 7 4 . 5 \% )$ . In contrast, DeiT with GAP cannot gain so much improvement (only $0 . 4 \%$ as shown in Table 3) because the original learnable absolute PE is not translation-equivariant and thus GAP with the PE is not translation-invariant. Given the superior performance, we hope our model can be a strong PE alternative in vision transformers.
104
+
105
+ Table 3. Performance comparison of Class Token (CLT) and global average pooling (GAP) on ImageNet. CPVT’s can be further boosted with GAP
106
+
107
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Head</td><td rowspan=1 colspan=1>Params</td><td rowspan=1 colspan=1>Top-1 Acc(%)</td><td rowspan=1 colspan=1>Top-5 Acc(%)</td></tr><tr><td rowspan=1 colspan=1>DeiT-tiny (Touvron et al., 2020)DeiT-tinyCPVT-Ti tCPVT-Ti t</td><td rowspan=1 colspan=1>CLTGAPCLTGAP</td><td rowspan=1 colspan=1>6M6M6M6M</td><td rowspan=1 colspan=1>72.272.673.474.9</td><td rowspan=1 colspan=1>91.091.291.892.6</td></tr><tr><td rowspan=3 colspan=1>DeiT-small (Touvron et al.,2020)DeiT-smallCPVT-S ‡CPVT-S t</td><td rowspan=1 colspan=1>CLTGAP</td><td rowspan=2 colspan=1>22M22M23M</td><td rowspan=2 colspan=1>79.980.280.5</td><td rowspan=3 colspan=1>95.095.295.295.7</td></tr><tr><td rowspan=1 colspan=1>CLT</td></tr><tr><td rowspan=1 colspan=1>GAP</td><td rowspan=1 colspan=1>23M</td><td rowspan=1 colspan=1>81.5</td></tr></table>
108
+
109
+ ‡: Insert one PEG each after the first encoder till the fifth encoder
110
+
111
+ # 4.4 COMPLEXITY OF PEG
112
+
113
+ Few Parameters. Given the model dimension $d$ , the extra number of parameters introduced by PEG is $d \times l \times k ^ { 2 }$ if we choose $l$ depth-wise convolutions with kernel $k$ . If we use $l$ separable convolutions, this value becomes $l ( d ^ { 2 } + k ^ { 2 } d )$ . When $k = 3$ and $l = 1$ , CPVT-Ti $d = 1 9 2 ,$ ) brings about 1, 728 parameters. Note that DeiT-tiny utilizes learnable position encodings with $1 9 2 \times 1 4 \times 1 4 = 3 7 6 3 2$ parameters. Therefore, CPVT-Ti has 35, 904 fewer number of parameters than DeiT-tiny. Even using 4 layers of separable convolutions, CPVT-Ti introduces only $3 8 9 5 2 - 3 7 6 3 2 = 9 6 0$ more parameters, which is negelectable compared to the $5 . 7 \mathbf { M }$ model parameters of DeiT-tiny.
114
+
115
+ FLOPs. As for FLOPs, $l$ layers of $k \times k$ depth-wise convolutions possesses $1 4 \times 1 4 \times d \times l \times k ^ { 2 }$ FLOPS. Taking the tiny model for example, it involves $1 9 6 \times 1 9 2 \times 9 = 0 . 3 4 M$ FLOPS for the simple case $k = 3$ and $l = 1$ , which is neglectable because the model has 2.1G FLOPs in total.
116
+
117
+ # 4.5 PERFORMANCE COMPARISON
118
+
119
+ We evaluate the performance of CPVT models on the ImageNet validation dataset and report the results in Table 4. Compared with DeiT, CPVT models have much better top-1 accuracy with similar throughputs. Our models can enjoy performance improvement when inputs are upscaled without fine-tuning, while DeiT degrades as discussed in Table 2, see also Figure 3 for a clear comparison. Noticeably, Our model with GAP marked a new state-of-the-art for vision Transformers.
120
+
121
+ ![](images/c53aeceb62b3945f870e2289f3bd7dc81107062bd6e3b4e704ad90e2320543d6.jpg)
122
+ Figure 3. Comparison of CPVT and DeiT models under various configurations. Note CPVT $@ 3 8 4$ has improved performance. More PEGs can result in better performance. CPVT-GAP is the best.
123
+
124
+ Table 4. Comparison with ConvNets and Transformers on ImageNet and ImageNet Real (Beyer et al., 2020). CPVT have much better performance compared with prior Transformers
125
+
126
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Params(M) Input</td><td rowspan=1 colspan=1>Input</td><td rowspan=1 colspan=2>|throughput*</td><td rowspan=1 colspan=1>ImNettop-1 %</td><td rowspan=1 colspan=1>Realtop-1 %</td></tr><tr><td rowspan=7 colspan=1>ResNet-50 (He et al., 2016)ResNet-101 (He et al., 2016)ResNet-152 (He et al.,2016)RegNetY-4GF (Radosavovic et al.,2020)EfficientNet-BO (Tan &amp;Le,2019)EfficientNet-B1 (Tan&amp;Le,2019)EfficientNet-B2 (Tan &amp;Le,2019)EfficientNet-B3(Tan&amp;Le,2019)EfficientNet-B4 (Tan&amp; Le,2019)</td><td rowspan=3 colspan=2>25456021</td><td rowspan=1 colspan=1>2242</td><td rowspan=1 colspan=2>1226.1</td><td rowspan=1 colspan=1>76.2</td><td rowspan=1 colspan=1>82.5</td></tr><tr><td rowspan=2 colspan=1>224222422242</td><td rowspan=2 colspan=2>753.6526.41156.7</td><td rowspan=1 colspan=1>753.6</td><td rowspan=1 colspan=1>77.4</td><td rowspan=1 colspan=1>83.7</td></tr><tr><td rowspan=1 colspan=1>78.380.0</td><td rowspan=1 colspan=1>84.186.4</td></tr><tr><td rowspan=4 colspan=2>5891219</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>2242</td><td rowspan=1 colspan=2>2694.3</td><td rowspan=1 colspan=1>77.1</td><td rowspan=1 colspan=1>83.5</td></tr><tr><td rowspan=1 colspan=1>240²</td><td rowspan=2 colspan=2>1662.51255.7732.1</td><td rowspan=1 colspan=1>79.1</td><td rowspan=1 colspan=1>84.9</td></tr><tr><td rowspan=1 colspan=1>260²3002</td><td rowspan=1 colspan=1>80.181.6</td><td rowspan=1 colspan=1>85.986.8</td></tr><tr><td rowspan=1 colspan=1>3802</td><td rowspan=1 colspan=2>349.4</td><td rowspan=1 colspan=1>82.9</td><td rowspan=1 colspan=1>88.0</td></tr><tr><td rowspan=2 colspan=1>ViT-B/16 (Dosovitskiy et al., 2021)ViT-L/16</td><td rowspan=2 colspan=2>86307</td><td rowspan=1 colspan=1>3842</td><td rowspan=2 colspan=2>85.927.3</td><td rowspan=2 colspan=1>77.976.5</td><td rowspan=2 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>3842</td></tr><tr><td rowspan=1 colspan=1>DeiT-tiny w/o PE (Touvron et al., 2020)DeiT-tiny (Touvron et al.,2020)DeiT-tiny (sine)CPVT-Ti tCPVT-Ti-GAP‡</td><td rowspan=1 colspan=2>66666</td><td rowspan=1 colspan=1>224222422242224²2242</td><td rowspan=1 colspan=2>2536.52536.52536.52500.72520.1</td><td rowspan=1 colspan=1>68.272.272.373.474.9</td><td rowspan=1 colspan=1>180.180.381.382.5</td></tr><tr><td rowspan=1 colspan=1>DeiT-tiny (Touvron et al., 2020)CPVT-Tim</td><td rowspan=1 colspan=2>66</td><td rowspan=1 colspan=1>22422242</td><td rowspan=1 colspan=2>2536.52500.7</td><td rowspan=1 colspan=1>74.575.9</td><td rowspan=1 colspan=1>82.183.0</td></tr><tr><td rowspan=2 colspan=1>DeiT-small (Touvron et al., 2020)CPVT-S $CPVT-S-GAP‡</td><td rowspan=2 colspan=2>222323</td><td rowspan=2 colspan=1>22422242224²</td><td rowspan=2 colspan=2>940.4930.5942.3</td><td rowspan=1 colspan=1>79.980.5</td><td rowspan=2 colspan=1>85.786.086.6</td></tr><tr><td rowspan=1 colspan=1>81.5</td></tr><tr><td rowspan=3 colspan=1>DeiT-base (Touvron et al.,2020)CPVT-B ‡CPVT-B-GAP‡</td><td rowspan=1 colspan=2>86</td><td rowspan=1 colspan=1>2242</td><td rowspan=1 colspan=2>292.3</td><td rowspan=1 colspan=1>81.8</td><td rowspan=1 colspan=1>86.7</td></tr><tr><td rowspan=2 colspan=2>8888</td><td rowspan=2 colspan=1>22422242</td><td rowspan=2 colspan=2>285.5290.2</td><td rowspan=1 colspan=1>82.3</td><td rowspan=2 colspan=1>87.087.7</td></tr><tr><td rowspan=1 colspan=1>82.7</td></tr></table>
127
+
128
+ ?: Measured in img/s on a 16GB V100 GPU as in (Touvron et al., 2020). ‡: Insert one PEG each after the first encoder till the fifth encoder ⚗ : trained with hard distillation using RegNetY-160 as the teacher.
129
+
130
+ We further train CPVT-Ti and DeiT-tiny using the aforementioned training settings plus the hard distillation proposed in (Touvron et al., 2020). Specifically, we use RegNetY-160 (Radosavovic et al., 2020) as the teacher. CPVT obtains $7 5 . 9 \%$ , exceeding DeiT-tiny by $1 . 4 \%$ .
131
+
132
+ # 4.6 PEG ON PYRAMID TRANSFORMER ARCHITECTURES
133
+
134
+ PVT (Wang et al., 2021) is a vision transformer with the multi-stage design like ResNet (He et al., 2016). Swin (Liu et al., 2021) is a follow-up work and comes with higher performance. We apply our method on both to demonstrate its generalization ability.
135
+
136
+ ImageNet classification. Specifically, we remove its learnable PE and apply our PEG in position 0 of each stage with a GAP head. We use the same training settings to make a fair comparison and show the results in Table 13. Our method can significantly boost PVT-tiny by $3 . 1 \%$ and Swin-tiny by $1 . 1 5 \%$ on ImageNet (c.f. B.5). We also evaluate the performance of PEG on some downstream semantic segmentation and object detection tasks (see B.6). Note these tasks usually handle the various input resolutions as the training because multi-scale data augmentation is extensively used.
137
+
138
+ # 5 ABLATION STUDY
139
+
140
+ # 5.1 POSITIONAL ENCODING OR MERELY A HYBRID?
141
+
142
+ One might suspect that the PEG’s improvement comes from the extra learnable parameters introduced by the convolutional layers in PEG, instead of the local relationship retained by PEG. One way to test the function of PEG is only adding it when calculating Q and K in the attention layer, so that only the positional information of PEG is passed through. We can achieve $7 1 . 3 \%$ top-1 accuracy on ImageNet with DeiT-tiny. This is significantly better than DeiT-tiny w/o PE $( 6 8 . 2 \% )$ and is similar to the one with PEG on Q, K and V $( 7 2 . 4 \% )$ , which suggests that PEG mainly serves as a positional encoding scheme.
143
+
144
+ We also design another experiment to remove this concern. By randomly-initializing a $3 \times 3$ PEG and fixing its weights during the training, we can obtain $7 1 . 3 \%$ accuracy (Table 5), which is much higher $( 3 . 1 \% \uparrow )$ than DeiT without any PE $( 6 8 . 2 \% )$ . Since the weights of PEG are fixed and the performance improvement can only be due to the introduced position information. On the contrary, when we exhaustively use 12 convolutional layers (kernel size being 1, i.e., not producing local relationship) to replace the PEG, these layers have much more
145
+
146
+ Table 5. Positional encoding rather than added parameters gives the most improvement
147
+
148
+ <table><tr><td>Kernel</td><td>Style</td><td>Params (M)</td><td>Top-1 Acc (%)</td></tr><tr><td>none 3</td><td></td><td>5.68</td><td>68.2</td></tr><tr><td>3</td><td>fixed (random init)</td><td>5.68</td><td>71.3</td></tr><tr><td>1(12 ×)</td><td>fixed (learned init)</td><td>5.68</td><td>72.3</td></tr><tr><td></td><td>learnable</td><td>6.13</td><td>68.6</td></tr><tr><td>3</td><td>learnable</td><td>5.68</td><td>72.4</td></tr></table>
149
+
150
+ learnable parameters than PEG. However, it only boosts the performance by $0 . 4 \%$ to $6 8 . 6 \%$
151
+
152
+ Another interesting finding is that fixing a learned PEG also helps training. When we initialize with a learned PEG instead of the random values and train the tiny version of the model from scratch while keeping the PEG fixed, the model can also achieve $7 2 . 3 \%$ top-1 accuracy on ImageNet. This is very close to the learnable PEG $( 7 2 . 4 \% )$ .
153
+
154
+ # 5.2 PEG POSITION IN CPVT
155
+
156
+ We also experiment by varying the position of the PEG in the model. Table 6 (left) presents the ablations for variable positions (denoted as PosIdx) based on the tiny model. We consider the input of the first encoder by index -1. Therefore, position 0 is the output of the first encoder block. PEG shows strong performance $( \sim 7 2 . 4 \% )$ when it is placed at [0, 3].
157
+
158
+ Note that positioning the PEG at 0 can have much better performance than positioning it at -1 (i.e., before the first encoder), as shown in Table 6 (left). We observe that the difference between the two situations is they have different receptive fields. Specifically, the former has a global field while the latter can only see a local area. Hence, they are supposed to work similarly well if we enlarge the convolution’s kernel size. To verify our hypothesis, we use a quite large kernel size 27 with a padding size 13 at position -1, whose result is reported in Table 6 (right). It achieves similar performance to the one positioning the PEG at 0 $( 7 2 . 5 \% )$ , which verifies our assumption.
159
+
160
+ Table 6. Comparison of different plugin positions (left) and kernels (right) using DeiT-tiny
161
+
162
+ <table><tr><td>PosIdx</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>none -1</td><td>68.2</td><td>88.7</td></tr><tr><td rowspan="4">0 3</td><td>70.6</td><td>90.2</td></tr><tr><td>72.4</td><td>91.2</td></tr><tr><td>72.3</td><td>91.1</td></tr><tr><td>71.7</td><td>90.8</td></tr><tr><td>6 10</td><td>69.0</td><td>89.1</td></tr></table>
163
+
164
+ <table><tr><td>PosIdx</td><td>kernel</td><td>Params</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>-1</td><td>3×3</td><td>5.7M</td><td>70.6</td><td>90.2</td></tr><tr><td>-1</td><td>27×27</td><td>5.8M</td><td>72.5</td><td>91.3</td></tr></table>
165
+
166
+ # 5.3 COMPARISONS WITH OTHER POSITIONAL ENCODINGS
167
+
168
+ We compare PEG with other commonly used encodings: absolute positional encoding (e.g. sinusoidal (Vaswani et al., 2017)), relative positional encoding (RPE) (Shaw et al., 2018) and learnable encoding (LE) (Devlin et al., 2019; Radford et al., 2018), as shown in Table 7.
169
+
170
+ DeiT-tiny obtains $7 2 . 2 \%$ with the learnable absolute PE. We experiment with the 2-D sinusoidal encodings and it achieves on-par performance. For RPE, we follow (Shaw et al., 2018) and set the local range hyper-parameter $K$ as 8, with which we obtain $70 . 5 \%$ . RPE here does not encode any absolute position information, see discussion in D.1 and B.3.
171
+
172
+ Table 7. Comparison of various positional encoding strategies. LE: learnable positional encoding. RPE: relative positional encoding
173
+
174
+ <table><tr><td>Model</td><td>PEG Pos</td><td>Encoding</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>DeiT-tiny (2020)</td><td></td><td>LE</td><td>72.2 72.3</td><td>91.0 91.0</td></tr><tr><td>DeiT-tiny DeiT-tiny</td><td></td><td>2D sin-cos 2DRPE</td><td>70.5</td><td>90.0</td></tr><tr><td>CPVT-Ti</td><td>= 0-1</td><td>PEG</td><td>72.4</td><td>91.2</td></tr><tr><td>CPVT-Ti</td><td>0-1</td><td>PEG+LE</td><td>72.9</td><td>91.4</td></tr><tr><td>CPVT-Ti</td><td>0-1</td><td>4×PEG+LE</td><td>72.9</td><td></td></tr><tr><td></td><td>0-5</td><td></td><td></td><td>91.4</td></tr><tr><td>CPVT-Ti</td><td></td><td>PEG</td><td>73.4</td><td>91.8</td></tr></table>
175
+
176
+ Moreover, we combine the learnable absolute PE with a single-layer PEG. This boosts the baseline CPVT-Ti (0-1) by $0 . 5 \%$ . If we use 4-layer PEG, it can achieve $7 2 . 9 \%$ . If we add a PEG to each of the first five blocks, we can obtain $7 3 . 4 \%$ , which is better than stacking them within one block.
177
+
178
+ CPE is not a simple combination of APE and RPE. We further compare our method with a baseline with combination of APE and RPE. Specifically, we use learnable positional encoding (LE) as DeiT at the beginning of the model and supply 2D RPE for every transformer block. This setting achieves $7 2 . 4 \%$ top-1 accuracy on ImageNet, which is comparable to a single PEG $( 7 2 . 4 \% )$ . Nevertheless, this experiment does not necessarily indicate that our CPE is a simple combination of APE and RPE. When tested on different resolutions, this baseline cannot scale well compared to ours (Table 8). RPE is not able to adequately mitigate the performance degradation on top of LE. This shall be seen as a major difference.
179
+
180
+ Table 8. Direct evaluation on other resolutions without fine-tuning. The models are trained on $2 2 4 \times 2 2 4$ . CPE outperforms $\mathrm { L E + R P E }$ combination on untrained resolutions.
181
+
182
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>PositionalParams</td><td rowspan=1 colspan=1>160(%)</td><td rowspan=1 colspan=1>224(%)</td><td rowspan=1 colspan=1>384(%)</td><td rowspan=1 colspan=1>448(%)</td><td rowspan=1 colspan=1>512(%)</td></tr><tr><td rowspan=1 colspan=1>DeiT-tiny (LE+RPE)DeiT-tiny (PEG at Pos 0)</td><td rowspan=1 colspan=1>400111920</td><td rowspan=1 colspan=1>65.666.8</td><td rowspan=1 colspan=1>72.472.4</td><td rowspan=1 colspan=1>70.873.2</td><td rowspan=1 colspan=1>68.471.8</td><td rowspan=1 colspan=1>65.670.3</td></tr></table>
183
+
184
+ PEG can continuously improve the performance if stacked more. We use LE not only at the beginning but also in the next 5 layers to have a similar thing as 0-5 PEG configuration.This setting achieves $7 2 . 7 \%$ top-1 accuracy on ImageNet, which is $0 . 7 \%$ lower than PEG (0-5). This setting suggests that it is also beneficial to have more of LEs, but not as good as ours. It is expected since we exploit relative information via PEGs at the same time.
185
+
186
+ # 6 CONCLUSION
187
+
188
+ We introduced CPVT, a novel method to provide the position information in vision transformers, which dynamically generates the position encodings based on the local neighbors of each input token. Through extensive experimental studies, we demonstrate that our proposed positional encodings can achieve stronger performance than the previous positional encodings. The transformer models with our positional encodings can naturally process longer input sequences and keep the desired translation equivalence in vision tasks. Moreover, our positional encodings are easy to implement and come with negligible cost. We look forward to a broader application of our method in transformer-driven vision tasks like segmentation and video processing.
189
+
190
+ # REFERENCES
191
+
192
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for largescale machine learning. In 12th {USENIX} symposium on operating systems design and implementation ({OSDI} 16), pp. 265–283, 2016.
193
+
194
+ Irwan Bello. Lambdanetworks: Modeling long-range interactions without attention. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id=xTJEN-ggl1b.
195
+
196
+ Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoc V Le. Attention augmented convolutional networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3286–3295, 2019.
197
+
198
+ Lucas Beyer, Olivier J Henaff, Alexander Kolesnikov, Xiaohua Zhai, and A ´ aron van den Oord. Are ¨ we done with imagenet? arXiv preprint arXiv:2006.07159, 2020.
199
+
200
+ Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
201
+
202
+ 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.
203
+
204
+ Hanting Chen, Yunhe Wang, Tianyu Guo, Chang Xu, Yiping Deng, Zhenhua Liu, Siwei Ma, Chunjing Xu, Chao Xu, and Wen Gao. Pre-trained image processing transformer. arXiv preprint arXiv:2012.00364, 2020.
205
+
206
+ Tianqi Chen, Mu Li, Yutian Li, Min Lin, Naiyan Wang, Minjie Wang, Tianjun Xiao, Bing Xu, Chiyuan Zhang, and Zheng Zhang. Mxnet: A flexible and efficient machine learning library for heterogeneous distributed systems. arXiv preprint arXiv:1512.01274, 2015.
207
+
208
+ Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Twins: Revisiting the design of spatial attention in vision transformers. In NeurIPS 2021, 2021.
209
+
210
+ Jean-Baptiste Cordonnier, Andreas Loukas, and Martin Jaggi. On the relationship between selfattention and convolutional layers. In International Conference on Learning Representations, 2020.
211
+
212
+ Ekin Dogus Cubuk, Barret Zoph, Jon Shlens, and Quoc Le. Randaugment: Practical automated data augmentation with a reduced search space. Advances in Neural Information Processing Systems, 33, 2020.
213
+
214
+ Zihang Dai, Hanxiao Liu, Quoc Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. Advances in Neural Information Processing Systems, 34, 2021.
215
+
216
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
217
+
218
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, 2019.
219
+
220
+ 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 International Conference on Learning Representations, 2021. URL https: //openreview.net/forum?id $=$ YicbFdNTTy.
221
+
222
+ Stephane d’Ascoli, Hugo Touvron, Matthew L Leavitt, Ari S Morcos, Giulio Biroli, and Levent ´ Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. In International Conference on Machine Learning, pp. 2286–2296. PMLR, 2021.
223
+
224
+ Anmol Gulati, James Qin, Chung-Cheng Chiu, Niki Parmar, Yu Zhang, Jiahui Yu, Wei Han, Shibo Wang, Zhengdong Zhang, Yonghui Wu, et al. Conformer: Convolution-augmented transformer for speech recognition. arXiv preprint arXiv:2005.08100, 2020.
225
+
226
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
227
+
228
+ Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. Deberta: Decoding-enhanced bert with disentangled attention. arXiv preprint arXiv:2006.03654, 2020.
229
+
230
+ Elad Hoffer, Tal Ben-Nun, Itay Hubara, Niv Giladi, Torsten Hoefler, and Daniel Soudry. Augment your batch: Improving generalization through instance repetition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8129–8138, 2020.
231
+
232
+ Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Noam Shazeer, Ian Simon, Curtis Hawthorne, Andrew M Dai, Matthew D Hoffman, Monica Dinculescu, and Douglas Eck. Music transformer. In Advances in Neural Processing Systems, 2018.
233
+
234
+ Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European conference on computer vision, pp. 646–661. Springer, 2016.
235
+
236
+ Md Amirul Islam, Sen Jia, and Neil DB Bruce. How much position information do convolutional neural networks encode? In International Conference on Learning Representations, 2020.
237
+
238
+ Alexander Kirillov, Ross Girshick, Kaiming He, and Piotr Dollar. Panoptic feature pyramid net- ´ works. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6399–6408, 2019.
239
+
240
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense´ object detection. In Proceedings of the IEEE international conference on computer vision, pp. 2980–2988, 2017.
241
+
242
+ Xuanqing Liu, Hsiang-Fu Yu, Inderjit Dhillon, and Cho-Jui Hsieh. Learning to encode position for transformer with continuous dynamical model. In International Conference on Machine Learning, pp. 6327–6335. PMLR, 2020.
243
+
244
+ Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021.
245
+
246
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Bkg6RiCqY7.
247
+
248
+ Abdelrahman Mohamed, Dmytro Okhonko, and Luke Zettlemoyer. Transformers with convolutional context for asr. arXiv preprint arXiv:1904.11660, 2019.
249
+
250
+ Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 4055–4064, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. ¨ PMLR.
251
+
252
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in Neural Information Processing Systems, 32: 8026–8037, 2019.
253
+
254
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018.
255
+
256
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
257
+
258
+ Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollar. Designing ´ network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10428–10436, 2020.
259
+
260
+ Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jon Shlens. Stand-alone self-attention in vision models. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and R. Garnett (eds.), ´ Advances in Neural Information Processing Systems, volume 32, pp. 68–80. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/ 3416a75f4cea9109507cacd8e2f2aefc-Paper.pdf.
261
+
262
+ Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2, pp. 464–468, 2018.
263
+
264
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
265
+
266
+ Jianlin Su, Yu Lu, Shengfeng Pan, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021.
267
+
268
+ Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In Proceedings of the IEEE international conference on computer vision, pp. 843–852, 2017.
269
+
270
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016.
271
+
272
+ Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pp. 6105–6114. PMLR, 2019.
273
+
274
+ Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve J ´ egou. Training data-efficient image transformers & distillation through attention. ´ arXiv preprint arXiv:2012.12877, 2020.
275
+
276
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 6000–6010, 2017.
277
+
278
+ Benyou Wang, Donghao Zhao, Christina Lioma, Qiuchi Li, Peng Zhang, and Jakob Grue Simonsen. Encoding word order in complex embeddings. arXiv preprint arXiv:1912.12333, 2019.
279
+
280
+ Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021.
281
+
282
+ Yuqing Wang, Zhaoliang Xu, Xinlong Wang, Chunhua Shen, Baoshan Cheng, Hao Shen, and Huaxia Xia. End-to-end video instance segmentation with transformers. arXiv preprint arXiv:2011.14503, 2020.
283
+
284
+ Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv preprint arXiv:2103.15808, 2021.
285
+
286
+ Baosong Yang, Longyue Wang, Derek Wong, Lidia S Chao, and Zhaopeng Tu. Convolutional selfattention networks. arXiv preprint arXiv:1904.03107, 2019a.
287
+
288
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. arXiv preprint arXiv:1906.08237, 2019b.
289
+
290
+ Adams Wei Yu, David Dohan, Minh-Thang Luong, Rui Zhao, Kai Chen, Mohammad Norouzi, and Quoc V Le. Qanet: Combining local convolution with global self-attention for reading comprehension. arXiv preprint arXiv:1804.09541, 2018.
291
+
292
+ Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6023–6032, 2019.
293
+
294
+ Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ r1Ddp1-Rb.
295
+
296
+ 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. arXiv preprint arXiv:2012.15840, 2020.
297
+
298
+ Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 13001–13008, 2020.
299
+
300
+ Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 633–641, 2017.
301
+
302
+ Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id ${ . } =$ gZ9hCDWe6ke.
303
+
304
+ # A TRANSLATION EQUIVARIANCE
305
+
306
+ The term translation-equivariance means the output feature maps can be equally translated with the input signal. Imagine there is a person in the left-top of an image, if the person is moved to the right-bottom, the output feature maps will change accordingly. This property is very important to the success of convolution network. Convolution (ignoring paddings), RPE, and self-attention are all translation-equivariant operations (regardless of their receptive field). It’s nontrivial to make absolute positional encodings like DeiT (using learnable positional encoding) translation-equivariant since different absolute positions will be added if the input signal is translated. Note that our method is not strictly translation-equivariant because of the zero padding. Instead, it provides a kind of stronger explicit bias towards the translation-equivariant property.
307
+
308
+ # B EXPERIMENT DETAILS
309
+
310
+ # B.1 ARCHITECTURE VARIANTS OF CPVT
311
+
312
+ Table 9. CPVT architecture variants. The larger model, CPVT-B, has the same architecture as ViTB (Dosovitskiy et al., 2021) and DeiT-B (Touvron et al., 2020). CPVT-S and CPVT-Ti have the same architecture as DeiT-small and DeiT-tiny respectively
313
+
314
+ <table><tr><td>Model</td><td>#channels</td><td>#heads</td><td>#layers</td><td>#params</td></tr><tr><td>CPVT-Ti</td><td>192</td><td>3</td><td>12</td><td>6M</td></tr><tr><td>CPVT-S</td><td>384</td><td>6</td><td>12</td><td>22M</td></tr><tr><td>CPVT-B</td><td>768</td><td>12</td><td>12</td><td>86M</td></tr></table>
315
+
316
+ # B.2 THE HYPERPARAMETERS OF CPVT
317
+
318
+ As for the ImageNet classification task, we use exactly the same hyperparameters as DeiT except for the base model because it is not always stably trained using AdamW. The detailed setting is shown in Table 10.
319
+
320
+ Table 10. Hyper-parameters for ViT, DeiT and CPVT
321
+
322
+ <table><tr><td>Methods</td><td>ViT</td><td>DeiT</td><td>CPVT</td></tr><tr><td>Epochs Batch size</td><td>300 4096</td><td>300 1024</td><td>300 1024</td></tr><tr><td>Optimizer</td><td>AdamW</td><td>AdamW</td><td>LAMB</td></tr><tr><td>Learning rate decay</td><td>cosine</td><td>cosine</td><td>cosine</td></tr><tr><td>Weight decay</td><td>0.3</td><td>0.05</td><td>0.05</td></tr><tr><td>Warmup epochs</td><td>3.4</td><td>5</td><td>5</td></tr><tr><td>Label smoothing ε (Szegedy et al., 2016)</td><td>X</td><td>0.1 X</td><td>0.1</td></tr><tr><td>Dropout (Srivastava et al.,2014)</td><td>0.1</td><td></td><td>X</td></tr><tr><td>Stoch.Depth (Huang et al., 2016)</td><td>X</td><td>0.1 √</td><td>0.1</td></tr><tr><td>Repeated Aug (Hoffer et al., 2020)</td><td>X</td><td>X</td><td>√</td></tr><tr><td>Gradient Clip.</td><td>√</td><td>9/0.5</td><td>X</td></tr><tr><td>Rand Augment (Cubuk et al., 2020)</td><td>X</td><td></td><td>9/0.5</td></tr><tr><td>Mixup prob. (Zhang et al.,2018)</td><td>X</td><td>0.8</td><td>0.8</td></tr><tr><td>Cutmix prob. (Yun et al., 2019)</td><td>X</td><td>1.0</td><td>1.0</td></tr><tr><td>Erasing prob. (Zhong et al.,2020)</td><td>X</td><td>0.25</td><td>0.25</td></tr></table>
323
+
324
+ # B.3 IMPORTANCE OF ZERO PADDINGS
325
+
326
+ We design an experiment to verify the importance of the zero paddings, which can help the model infer the absolute positional information. Specifically, we use CPVT-S and simply remove the zero paddings from CPVT while keeping all other settings unchanged. Table 11 shows that this can only obtain $7 0 . 5 \%$ , which indicates that the zero paddings and absolute positional information play important roles in classifying objects.
327
+
328
+ Table 11. Ablation study on ImageNet performance w/ or w/o zero paddings
329
+
330
+ <table><tr><td>Model</td><td>Padding</td><td>Top-1 Acc(%)</td><td>Top-5 Acc(%)</td></tr><tr><td rowspan="2">CPVT-Ti</td><td>√</td><td>72.4</td><td>91.2</td></tr><tr><td>X</td><td>70.5</td><td>89.8</td></tr></table>
331
+
332
+ # B.4 SINGLE PEG VS. MULTIPLE PEGS
333
+
334
+ We further evaluate whether or not using multi-position encodings can benefit the performance in Table 12. Notice we denote by $i \mathrm { - } j$ the inserted positions of PEG which start from the $i$ -th encoder and end at the $j - 1$ -th one (inclusion). By inserting PEGs to five positions, the top-1 accuracy of the tiny model can achieve $7 3 . 4 \%$ , which surpasses DeiT-tiny by $1 . 2 \%$ . Similarly, CPVT-S can achieve $8 0 . 5 \%$ . It turns out more PEGs do help, but up to a level where more PEGs become incremental (0-5 vs. 0-11).
335
+
336
+ Table 12. CPVT’s sensitivity to number of plugin positions
337
+
338
+ <table><tr><td>Positions</td><td>Model</td><td>Params (M)</td><td>Top-1 Acc (%)</td><td>Top-5 Acc (%)</td></tr><tr><td>0-1</td><td>tiny</td><td>5.7</td><td>72.4</td><td>91.2</td></tr><tr><td>0-5</td><td>tiny</td><td>5.9</td><td>73.4</td><td>91.8</td></tr><tr><td>0-11</td><td>tiny</td><td>6.1</td><td>73.4</td><td>91.8</td></tr><tr><td>0-1 0-5</td><td>small small</td><td>22.0 22.9</td><td>79.9 80.5</td><td>95.0 95.2</td></tr></table>
339
+
340
+ # B.5 CLASSFICATION EVALUATION OF SWIN WITH PEG
341
+
342
+ We show the validation curves when training Swin (Liu et al., 2021) equipped with PEG in Figure 4.
343
+ It can boost Swin-tiny from $8 1 . 1 0 \%$ to $8 2 . 2 5 \%$ $( + 1 . 1 5 \% \uparrow )$ on ImageNet.
344
+
345
+ ![](images/37115738de8c41b823e0aa8bb65e1c60638e6d07fe274cb734b5b2f7bcc4fd09.jpg)
346
+ Figure 4. CPE boosts Swin Tiny on ImageNet by $1 . 1 5 \%$ top-1 Acc.
347
+
348
+ # B.6 EVALUATION ON SEGMENTATION AND DETECTION
349
+
350
+ Semantic segmentation on ADE20K. We evaluate the performance of PEG on the ADE20K (Zhou et al., 2017) segmentation task. Based on the Semantic FPN framework (Kirillov et al., 2019), PVT achieves much better results than ResNet (He et al., 2016) baselines. Under carefully controlled settings, PEG further boosts PVT-tiny by $3 . 1 \%$ mIoU.
351
+
352
+ Object detection on COCO. We also perform controlled experiments with the RetinaNet (Lin et al., 2017) framework on the COCO detection task. The results are shown in Table 13. In the standard $1 \times$ schedule, PEG improves PVT-tiny by $2 . 0 \%$ mAP. PEG brings $2 . 4 \%$ higher mAP under the $3 \times$ schedule.
353
+
354
+ Table 13. Our method boosts the performance of PVT on ImageNet classification, ADE20K segmentation and COCO detection
355
+
356
+ <table><tr><td rowspan="2">Backbone</td><td colspan="2">ImageNet</td><td colspan="2">Semantic FPN on ADE20K</td><td colspan="3">RetinaNet on COCO</td></tr><tr><td>Params (M)</td><td>Top-1 (%)</td><td>Params (M)</td><td>mIoU (%)</td><td>Params (M)</td><td>mAP (%,1x)</td><td>mAP (%,3×,+MS)</td></tr><tr><td>ResNet-18 (He et al.,2016)</td><td>12</td><td>69.8</td><td>16</td><td>32.9</td><td>21</td><td>31.8</td><td>35.4</td></tr><tr><td>PVT-tiny (Wang et al., 2021)</td><td>13</td><td>75.0</td><td>17</td><td>35.7</td><td>23</td><td>36.7</td><td>39.4</td></tr><tr><td>PVT-tiny+PEG</td><td>13</td><td>77.3</td><td>17</td><td>38.0</td><td>23</td><td>38.0</td><td>41.8</td></tr><tr><td>PVT-tiny+GAP</td><td>13</td><td>75.9</td><td>17</td><td>36.0</td><td>23</td><td>36.9</td><td>39.7</td></tr><tr><td>PVT-tiny+PEG+GAP</td><td>13</td><td>78.1</td><td>17</td><td>38.8</td><td>23</td><td>38.7</td><td>41.8</td></tr><tr><td>PVT-small (Wang et al., 2021)</td><td>25</td><td>79.8</td><td>28</td><td>39.8</td><td>34</td><td>40.4</td><td>42.2</td></tr><tr><td>PVT-small+PEG+GAP</td><td>25</td><td>81.2</td><td>28</td><td>44.3</td><td>34</td><td>43.0</td><td>45.2</td></tr><tr><td>PVT-Medium (Wang et al.,2021)</td><td>44</td><td>81.2</td><td>48</td><td>41.6</td><td>54</td><td>41.9</td><td>43.2</td></tr><tr><td>PVT-Medium+PEG+GAP</td><td>44</td><td>82.7</td><td>48</td><td>44.9</td><td>54</td><td>44.3</td><td>46.4</td></tr></table>
357
+
358
+ # B.7 ABLATION ON OTHER FORMS OF PEG
359
+
360
+ We explore several forms of PEG based on the tiny model, which change the type of convolution, kernel size and layers. The inserted position is 0. The result is shown in Table 14. When we use large kernel of $7 \times 7$ or dense convolution, the performance improvement is limited. Stacking more layers of depth-wise convolution doesn’t bring significant improvement. Therefore, we use the simplest form as our default implementation. It indicates that this design is enough to provide good position information.
361
+
362
+ Table 14. Other forms of PEG. The simple form of a single depth-wise $3 \times 3$ is good enough.
363
+
364
+ <table><tr><td>Variants</td><td>Model</td><td>Top-1 Acc (%)</td></tr><tr><td>1 Depthwise Conv 3×3</td><td>tiny</td><td>72.4</td></tr><tr><td>1 Depthwise Conv 7×7</td><td>tiny</td><td>72.5</td></tr><tr><td>4 *(Depthwise Conv 3×3+BN+ReLU)</td><td>tiny</td><td>72.4</td></tr><tr><td>1 Dense Conv 3×3</td><td>tiny</td><td>72.3</td></tr><tr><td>4 * (Dense Conv 3×3+BN+ReLU)</td><td>tiny</td><td>72.5</td></tr></table>
365
+
366
+ # C EXAMPLE CODE
367
+
368
+ # C.1 PEG
369
+
370
+ In the simplest form, we use a single depth-wise convolution and show its usage in Transformer by the following PyTorch snippet. Through experiments, we find that such a simple design (i.e., depthwise $3 \times 3$ ) readily achieves on par or even better performance than the recent SOTAs. We give the torch implementation example in Alg. 1.
371
+
372
+ # D MORE DISCUSSIONS
373
+
374
+ # D.1 WHY RPE WORKS LESS WELL THAN ABSOLUTE PE?
375
+
376
+ As mentioned in Section 5.3 (main text), RPE is inferior to the absolute positional encoding. It is because RPE does not encode any absolute position information. Also discussed in Section B.3 (main text), absolute position information is also important even for ImageNet classification as it is needed to determine which object is at the center of the image. Note that there might be multiple objects in an image, and the label of an image is the category of the object at the center.
377
+
378
+ Additionally, although RPE becomes popular recently, it is often jointly used with absolute positional encodings (e.g., in ConViT (d’Ascoli et al., 2021)), or the absolute position information is leaked in other ways (e.g., convolution paddings in CoAtNet (Dai et al., 2021)). This further suggests absolute position information is crucial.
379
+
380
+ # Algorithm 1 PyTorch snippet of PEG.
381
+
382
+ import torch
383
+ import torch.nn as nn
384
+ class VisionTransformer: def __init__(layer $_ { \mathrm { S } } = 1 2$ , ${ \mathrm { d i m } } { = } 1 9 2$ , nhead $^ { \underline { { { \textstyle \dag } } } } = 3$ , img_size $_ { : = 2 2 4 }$ , patch_size=16): self.pos_block $=$ PEG(dim) self.blocks $=$ nn.ModuleList([TransformerEncoderLayer(dim, nhead, dim $\mathbf { \nabla } _ { \cdot } \star \mathbf { \nabla } _ { \cdot }$ 4) for _ in range( layers)]) self.patch_embed $=$ PatchEmbed(img_size, patch_size, dim\*4) def forward_features(self, $\mathbf { x } )$ ): B, C, H, $W ~ = ~ \mathrm { ~ x ~ }$ .shape x, patch_size $=$ self.patch_embed(x) _H, $\_ \mathrm { ~ \tt ~ H ~ } = \mathrm { ~ \tt ~ H ~ }$ // patch_size, W // patch_size $\qquad \times \quad =$ torch.cat((self.cls_tokens, x), dim $^ { = 1 }$ ) for i, blk in enumerate(self.blocks): x = blk $( \times )$ if i $\quad . = = 0$ : $\times \quad =$ self.pos_block(x, _H, _W) return x[:, 0]
385
+ class PEG(nn.Module): def _init__(self, dim $^ { 1 = 2 }$ \textsc{56}, $\mathrm { k } = 3$ ): self.pos $=$ nn.Conv2d(dim, dim, k, 1, k//2, groups $=$ dim) # Only for demo use, more complicated functions are effective too. def forward(self, x, H, W): B, N, ${ \mathrm { ~ \small ~ \mathscr ~ { ~ C ~ } ~ } } = { \mathrm { ~ \small ~ x ~ } }$ .shape cls_token, feat_tokens $=$ x[:, 0], x[:, 1:] feat_tokens $=$ feat_tokens.transpose(1, 2).view(B, C, H, W) $\qquad \times \quad =$ self.pos(feat_tokens) $^ +$ feat_tokens $\qquad \times \quad =$ x.flatten(2).transpose(1, 2) $\qquad \times \quad =$ torch.cat((cls_token.unsqueeze(1), x), dim=1) return x
386
+
387
+ # D.2 COMPARISON TO LAMBDA NETWORKS
388
+
389
+ Our work is also related to Lambda Networks (Bello, 2021) which uses 2D relative positional encodings. We evaluate its lambda module with an embedding size of 128, where we denote its encoding scheme as RPE2D-d128. Noticeably, this configuration has about 5.9M parameters (comparable to DeiT-tiny) but only obtains $6 8 . 7 \%$ . We attribute its failure to the limited ability in capturing the correct positional information. After all, lambda layers are designed with the help of many CNN backbones components such as down-sampling to form various stages, to replace ordinary convolutions in ResNet (He et al., 2016). In contrast, CPVT is transformer-based.
390
+
391
+ # D.3 QUALITATIVE ANALYSIS OF CPVT
392
+
393
+ Thus far, we have shown that PEG can have better performance than the original positional encodings. However, because PEG provides the position in an implicit way, it is interesting to see if PEG can indeed provide the position information as the original positional encodings. Here we investigate this by visualizing the attention weights of the transformers. Specifically, given a $2 2 4 \times 2 2 4$ image (i.e. $1 4 \times 1 4$ patches), the score matrix within a single head is $1 9 6 \times 1 9 6$ . We visualize the normalized self-attention score matrix of the second encoder block.
394
+
395
+ We first visualize the attention weights of DeiT with the original positional encodings. As shown in Figure 5 (middle), the diagonal element interacts strongly with its local neighbors but weakly with those far-away elements, which suggests that DeiT with the original positional encodings learn to attend the local neighbors of each patch. After the positional encodings are removed (denoted by DeiT w/o PE), all the patches produce similar attention weights and fail to attend to the patches near themselves, see Figure 5 (left).
396
+
397
+ Finally, we show the attention weights of our CPVT model with PEG. As shown in Figure 5 (right), like the original positional encodings, the model with PEG can also learn a similar attention pattern, which indicates that the proposed PEG can provide the position information as well.
398
+
399
+ We illustrate the attention scores in several encoder blocks of DeiT (Touvron et al., 2020) and CPVT in the Fig. 6. It shows both methods learn similar locality patterns. As attention scores are computed over the tokens projected in different subspaces (Q and K), they do not necessarily show a strict diagonal pattern, where some may have slight shift, see DeiT in Fig. 6c and CPVT of Fig. 5 right.
400
+
401
+ ![](images/19c1477edf28cf26db81ecd53fd8947ea0edbe4a9868e6368aab289ef778d7ce.jpg)
402
+ Figure 5. Normalized attention scores (first head) of the second encoder block of DeiT without position encoding (DeiT w/o PE), DeiT (Touvron et al., 2020), and CPVT on the same input sequence. Position encodings are key to developing a schema of locality in lower layers of DeiT. Meantime, CPVT profits from conditional encodings and follows a similar locality pattern.
403
+
404
+ ![](images/0a11531d79480ac414e128993ffaedb8cbf0d456688b90d3ed26f02be66c7b97.jpg)
405
+ Figure 6. Normalized attention scores (the second and third head) of the second and third encoder block of DeiT (Touvron et al., 2020), and CPVT on the same input sequence. DeiT and CPVT share similar locality patterns that are aligned diagonally (some might shift).
406
+
407
+ # D.4 COMPARISON WITH OTHER APPROACHES
408
+
409
+ We further compare our method with other approaches such as CvT (Wu et al., 2021), ConViT (d’Ascoli et al., 2021) and CoAtNet (Dai et al., 2021) on ImageNet validation set in Table 15. To make fair comparisons, we categorize these methods into two groups: plain and pyramid models. Since our models are primarily for plain models, we adapt our methods on two popular pyramid frameworks PVT and Swin. Our CPVT-S-GAP slightly outperforms ConViT-S by $0 . 2 \%$ with 4M fewer parameters and 0.8G fewer FLOPs. When equipped with pyramid designs, our methods are still comparable to CvT and CoAtNet.
410
+
411
+ Comparison with DeiT w/ Convolutional Projection. Note CvT uses a depth-wise convolution in $\scriptstyle q - k - v$ projection which they call it Convolutional Projection. Instead of using it in all layers, we put only one of such design into DeiT-tiny and train such a model from scratch under strictly controlled settings. We insert it in the position 0 as in our method. The result is shown in Table 16. This CvT-flavored DeiT achieves $7 0 . 6 \%$ top-1 accuracy on ImageNet validation set, which is lower than ours $( 7 2 . 4 \% )$ . Note that $q$ -k-v projections in CvT utilize three depthwise convolutions, therefore, this setting has more parameters than ours. This attests the difference of CvT and CPVT, verifying our advantage by learning better position encodings other than inserting them in all layers to have the ability to capture local context and to remove ambiguity in attention.
412
+
413
+ Table 15. Performance comparison with other approaches such as CvT (Wu et al., 2021), ConViT (d’Ascoli et al., 2021) and CoAtNet (Dai et al., 2021) on ImageNet validation set. All the models are trained on ImageNet-1k dataset and tested on the validation set using $2 2 4 \times 2 2 4$ resolution.
414
+
415
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Type</td><td rowspan=1 colspan=1>Params</td><td rowspan=1 colspan=1>FLOPs</td><td rowspan=1 colspan=1>Top-1 Acc(%)</td></tr><tr><td rowspan=1 colspan=1>DeiT-small (Touvron et al., 2020)ConViT-S (d&#x27;Ascoli et al.,2021)CPVT-S-GAP (ours)</td><td rowspan=1 colspan=1>PlainPlainPlain</td><td rowspan=1 colspan=1>22M27M23M</td><td rowspan=1 colspan=1>4.6G5.4G4.6G</td><td rowspan=1 colspan=1>79.981.381.5</td></tr><tr><td rowspan=2 colspan=1>CoAtNet-0 (Dai et al., 2021)CvT-13 (Wu et al., 2021)PVT-small (Wang et al., 2021)PVT-small+PEG+GAPSwin-tiny (Liu et al.,2021)Swin-tiny+PEG+GAP</td><td rowspan=2 colspan=1>PyramidPyramidPyramidPyramidPyramidPyramid</td><td rowspan=1 colspan=1>25M20M25M25M29M</td><td rowspan=1 colspan=1>4.2G4.5G3.8G3.8G4.5G</td><td rowspan=2 colspan=1>81.681.679.881.281.382.3</td></tr><tr><td rowspan=1 colspan=1>29M</td><td rowspan=1 colspan=1>4.5G</td></tr></table>
416
+
417
+ Table 16. Comparison with positional encoding in CvT (Wu et al., 2021) on ImageNet validation set. All the models are trained on ImageNet-1k dataset and tested on the validation set using $2 2 4 \times 2 2 4$ resolution.
418
+
419
+ <table><tr><td>Model</td><td>Params</td><td>Insert Position</td><td>Top-1 Acc (%)</td></tr><tr><td>CPVT-Ti DeiT+ Convolutional Projection</td><td>5681320 5685352</td><td>0 0</td><td>72.4 70.6</td></tr></table>
parse/dev/3KWnuT-R1bh/3KWnuT-R1bh_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3KWnuT-R1bh/3KWnuT-R1bh_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3KWnuT-R1bh/3KWnuT-R1bh_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3Pbra-_u76D/3Pbra-_u76D_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b84c4a05228b388ed68b94623635de98e5c5005a8cedbab0f4b7cf38b766bcc6
3
+ size 3911748
parse/dev/3Pbra-_u76D/3Pbra-_u76D_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2779392ffd769eac556498a630e81b2eafb9b669b5ab83051e5fdfab582b280
3
+ size 3751525
parse/dev/3Pbra-_u76D/3Pbra-_u76D_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dda36de2ee6cfbada5d787c2b0104b79d55295680788a9eea3532b8de44c37e4
3
+ size 3915096
parse/dev/3ly9cG9Ql9h/3ly9cG9Ql9h.md ADDED
@@ -0,0 +1,899 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WHAT DOES A PLATYPUS LOOK LIKE? GENERATING CUSTOMIZED PROMPTS FOR ZERO-SHOT IMAGE CLASSIFICATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Open vocabulary models are a promising new paradigm for image classification. Unlike traditional classification models, open vocabulary models classify among any arbitrary set of categories specified with natural language during inference. This natural language, called “prompts”, typically consists of a set of hand-written templates (e.g., “a photo of a $\{ \} ^ { \ast } )$ which are completed with each of the category names. This work introduces a simple method to generate higher accuracy prompts, without relying on any explicit knowledge of the task domain and with far fewer hand-constructed sentences. To achieve this, we combine open vocabulary models with large language models (LLMs) to create Customized Prompts via Language models $\mathrm { C u P L }$ , pronounced “couple”). In particular, we leverage the knowledge contained in LLMs in order to generate many descriptive sentences that are customized for each object category. We find that this straightforward and general approach improves accuracy on a range of zero-shot image classification benchmarks, including over one percentage point gain on ImageNet. Finally, this simple baseline requires no additional training and remains completely zero-shot.
8
+
9
+ ![](images/207af72be1be806a825dfae0cb16b9568232e896028ef4212770a11f27d035ec.jpg)
10
+ Figure 1: Schematic of the method. (Left) The standard method of a zero-shot open vocabulary image classification model (e.g., CLIP (Radford et al., 2021)). (Right) Our method of CuPL. First, an LLM generates descriptive captions for given class categories. Next, an open vocabulary model uses these captions as prompts for performing classification.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Open vocabulary models (Pham et al., 2021; Jia et al., 2021; Radford et al., 2021; Yu et al., 2022a) achieve high classification accuracy across a large number of datasets without labeled training data for those tasks. To accomplish this, these models leverage the massive amounts of image-text pairs available on the internet by learning to associate the images with their correct caption, leading to greater flexibility during inference. Unlike standard models, these models classify images by providing a similarity score between an image and a caption. To perform inference, one can generate a caption or “prompt” associated with each of the desired categories, and match each image to the best prompt. This means that categories can be selected ad hoc and adjusted without additional training.
15
+
16
+ However, this new paradigm poses a challenge:
17
+
18
+ How can we best represent an image category through natural language prompts?
19
+
20
+ The standard approach is to hand write a number of prompts templates (Radford et al., 2021) (e.g.,“a photo of a $\{ \} ^ { \ast } )$ , compile a natural language label for each category in the dataset, and create a set of prompts for each category by filling in each of these templates with the natural language labels. Then, image embeddings are matched to the nearest set of prompt embeddings and labelled with the category associated with that set of prompts (more details in Section 2).
21
+
22
+ This method has three major drawbacks. Firstly, each prompt template has to be hand-written, so having twice as many prompts for a category requires twice as much human effort. This can become costly as each new dataset typically has a different set of prompt templates (Radford et al., 2021). Secondly, the prompt templates must be general enough to apply to all image categories. For example, a prompt for the ImageNet (Deng et al., 2009) category “platypus” could only be as specific as “a photo of a $\{ \mathrm { p l a t y p u s } \} ^ { \cdot }$ , and could not be something like “a photo of a $\{ { \mathrm { p l a t y p u s } } \}$ , a type of aquatic mammal” as that template would no longer be relevant for other image categories. Lastly, writing high performing prompt templates currently requires prior information about the contents of the dataset. For example, the list of hand-written ImageNet prompts (Radford et al., 2021) includes “a black and white photo of the $\{ \}$ .”, “a low resolution photo of a $\{ \}$ .”, and “a toy $\{ \}$ .” all of which demonstrate prior knowledge about the type of representations present in the dataset. This information is not generalizable to other datasets, as ImageNet contains “black and white” and “toy” representations of its categories, but other datasets do not (e.g., FVGC Aircraft (Maji et al., 2013)).
23
+
24
+ To overcome these challenges, we propose Customized Prompts via Language models $\mathrm { ( C u P L ) }$ . In this algorithm, we couple a large language model (LLM) with a zero-shot open vocabulary image classification model. We use the LLM to generate prompts for each of the image categories in a dataset. Using an LLM allows us to generate an arbitrary number of prompts with a fixed number of hand-written sentences. Additionally, these prompts are now customized to each category and can contain rich visual descriptions while still remaining zero-shot (e.g., “A platypus looks like a beaver with a duck’s bill” – a sentence generated by an LLM).
25
+
26
+ We find these customized prompts outperform the hand-written templates on 15 zero-shot image classification benchmarks, including a greater than 1 percentage point gain on ImageNet (Deng et al., 2009) Top-1 accuracy and a greater than 6 percentage point gain on Describable Textures Dataset (Cimpoi et al., 2014), with fewer hand-written prompts when compared to the standard method used in Radford et al. (2021). Finally, this method requires no additional training or labeled data for either model.
27
+
28
+ # 2 METHODS
29
+
30
+ The CuPL algorithm consists of two steps: (1) generating customized prompts for each of the categories in a given dataset and (2) using these prompts to perform zero-shot image classification.
31
+
32
+ # 2.1 GENERATING CUSTOMIZED PROMPTS
33
+
34
+ This step consists of generating prompts using an LLM. For clarity, we distinguish between two different kind of prompts. The first are the prompts which cue the LLM to generate the descriptions of the dataset categories. These prompts do not describe an object, but rather prompt the description of an object (e.g., “What does a platypus look like?”). We will refer to these as “LLM-prompts”.
35
+
36
+ Secondly, there are the prompts to be matched with images in the zero-shot image classification model. These are the prompts that describe a category (e.g., “A platypus looks like ...”). We call them “image-prompts.” These are the output of the LLM, as examplified in Figure 2.
37
+
38
+ In this work, we use GPT-3 (Brown et al., 2020) as our LLM. To generate our image-prompts, we must first construct a number of LLM-prompt templates. While this does require some engineering by hand, it is significantly less than the amount of hand-engineered sentences used in the standard method of creating image-prompt templates for CLIP. For example, in our ImageNet experiments, we construct 5 LLM-prompt templates compared to the 80 image-prompts used by CLIP for zeroshot ImageNet classification.
39
+
40
+ ![](images/94599b7e4d40c35d0489d8e2ef6be722491d18fe350b748d1afd73f9e7bb8418.jpg)
41
+ Figure 2: Example CuPL LLM-prompts and Image-prompts. LLM-prompts are filled in with a class name and then used as input to GPT-3, which then outputs image-prompts. Example LLM generated image-prompts and associated images from ImageNet are shown. Only image-prompts are used for the downstream image classification.
42
+
43
+ After constructing these LLM-prompts, we generate 10 different image-prompts for each of the LLM-prompts. This means for ImageNet we use an LLM to generate a total of 50 customized image-prompts for each image category. For each of these, we generate a maximum of 50 tokens, but halt a generation early if it produces a period. Additionally, we generate with a high temperature of 0.99, which encourages more diversity among the 10 generated image-prompts. We also clean each generated sentences by deleting any blank lines and adding a period at the end.
44
+
45
+ # 2.2 UTILIZING CUSTOMIZED PROMPTS
46
+
47
+ After generating image-prompts for each of the categories, we then perform zero-shot image classification. While there are a number of open vocabulary models (Pham et al., 2021; Jia et al., 2021; Radford et al., 2021; Yu et al., 2022a), we report our results using CLIP (Radford et al., 2021) as this is the most popular publicly available open vocabulary model.
48
+
49
+ CLIP consists of a text encoder and and image encoder (schematic on the left side of Figure 1). In the standard setting, there are a number of hand-written templates which can be completed with the relevant category names (e.g. “A photo of a $\{ \} ^ { \ast }$ , “A photo of many $\{ \} ^ { \ast } )$ . To classify the images in a dataset, each of these templates is filled in with a given category name. Then each of these sentences is embedded via the text encoder, and all sentences completed with the same category name are averaged and normalized. This results in $n$ embeddings where $n$ is the number of categories in the dataset. Each of these $n$ embeddings is the mean of many different sentence embeddings. Then each image in the dataset is embedded using the image encoder. This embedding is compared to each of the $n$ text embeddings using cosine similarity and is labeled with the most similar one.
50
+
51
+ CuPL requires only a small adjustment from this standard practice. Instead of filling in the handwritten templates for each category, we simply replace these altogether with the sentences output by GPT-3. This means for CuPL, hand-written templates are only used as input for the LLM, while the prompts for CLIP are entirely generated text. We present 2 different setting of CuPL (as shown in Table 1), each representing a different trade-off between accuracy and hand-engineering.
52
+
53
+ 1. CuPL (base). This setting uses three hand-written sentence across all 15 examined datasets. We do this by constructing general LLM-prompt templates which are filled in with the category names for each dataset. Our three general templates are as follows:
54
+
55
+ Describe what a/the looks like: Describe a/the : What are the identifying characteristics of a/the ?
56
+
57
+ The blank portion of this template is either filled in with the category type plus the category name (e.g. “pet” $+ \left\{ \right\}$ for the Oxford Pets dataset (Parkhi et al., 2012) or “aircraft” $+ \left\{ \right\}$ for FGVC Aircraft (Maji et al., 2013)) or just the category name for more general datasets like ImageNet (Deng et al., 2009). Type specification is necessary because of words that have multiple meanings. For example “boxer” from the Oxford Pets dataset can also mean a person who boxes, as opposed to a dog breed, so it is necessary to specify “Describe a pet boxer:”. Similarly, “Tornado” from the FGVC Aircraft dataset can be a type of aircraft or a type of weather.
58
+
59
+ 2. CuPL (full). In this setting we use different LLM-prompt templates for each dataset, just as Radford et al. (2021) uses different image-prompt templates for each dataset. However, we use fewer hand-written templates overall and also contain less specific information about each dataset in the templates. For this work, each dataset has between 2 and 9 LLM-prompts which generate between 20 and 90 image-prompt per category (10 generated sentences per LLM-prompt). For ImageNet, we use the following 5 LLM-prompts: (1) “Describe what a(n) $\bar { \{ \} }$ looks like”, (2) “How can you identify a(n) $\{ \} ? ^ { \prime \prime }$ , (3) “What does a(n) $\{ \}$ look like?”, (4) “A caption of an image of a(n) {}”, (5) “Describe an image from the internet of a(n) $\{ \} ^ { \ast }$ . Example generations for each of these LLM-prompts are given for two ImageNet categories in Figure 3. Full LLM-prompts for all datasets as well as example image-prompts are given in Sections A and K of the Appendix.
60
+
61
+ # 3 EXPERIMENTS AND RESULTS
62
+
63
+ We first discuss the details of our experimental setup. We next show improvements on a wide range of image classification benchmarks. We then examine the scaling behavior with respect to the model size and report observations regarding hyperparameters such as the LLM sampling temperature. Finally, we consider and compare with other methods of obtaining descriptive captions, and provide analysis of CuPl’s improvements over the standard method.
64
+
65
+ # 3.1 SETUP
66
+
67
+ Unless specified otherwise, we use CLIP with a backbone of ViT-L/14 (Dosovitskiy et al., 2020) and the GPT-3 DaVinci-002 model. Additionally, in order to perform open vocabulary image classification, each image category needs a natural language label. This is sometimes provided by the dataset, but not always (e.g. ImageNet categories are described by an id number which can map to multiple synonyms). For this work, we use the same natural language labels specified in Radford et al. (2021).
68
+
69
+ We report our findings on 15 zero-shot image recognition benchmarks: ImageNet (Deng et al., 2009), Describable Textures Dataset (DTD) (Cimpoi et al., 2014), Stanford Cars (Krause et al., 2013), Scene UNderstanding (SUN397) (Xiao et al., 2010), Food101 (Bossard et al., 2014), FGVC Aircraft (Maji et al., 2013), Oxford Pets (Parkhi et al., 2012), Caltech101 (Fei-Fei et al., 2004),
70
+
71
+ ![](images/c244cd77f35daae89804f631443e697dbdef5cbf87a124bd967b690b5c34a523.jpg)
72
+ Figure 3: Example image-prompts for each of the 5 LLM-prompts. For three ImageNet classes (moped, platypus, and slide rule), we give an example image-prompt for each of the 5 LLM-prompts used in CuPL (full) for ImageNet.
73
+
74
+ Table 1: Performance of CuPL prompts compared to the standard, hand-written prompts in CLIP (Radford et al., 2021) on 15 zero-shot image classification benchmarks. “∆std” stands for the difference; green shows improvement. In addition to accuracy, we show number of prompt templates (“# hw”) that are hand-written for each dataset using each method, as well as the total and unique number of hand-written templates for each method (unique number only counts templates once even if used for multiple datasets). Note that CuPL (base) uses just three hand-constructed sentence across all datasets compared to 175 in the standard method.
75
+
76
+ <table><tr><td></td><td>eee</td><td>0</td><td>ssrr rlrts</td><td>163308</td><td>[oPooI</td><td>Fraielelr</td><td>od prirt</td><td>CErreael</td><td>Bir SiemiIG</td><td>DECEII</td><td>Erregisg0</td><td>PPSSSSS</td><td>CIPAIII1</td><td>CEIAAIIIO</td><td>Trrsppg</td><td>weea</td><td>u</td><td>anbrun</td></tr><tr><td>std #hw</td><td>75.54</td><td>55.20 8</td><td>77.53 8</td><td>69.31 2</td><td>93.08 1</td><td>32.88 2</td><td>93.33 1</td><td>93.24 34</td><td>78.53 1</td><td>77.45 48</td><td>60.07 28</td><td>71.10 18</td><td>95.59 18</td><td>78.26 18</td><td>50.43 1</td><td>|73.43</td><td>268|175</td><td></td></tr><tr><td>CuPL (base)</td><td>80</td><td>58.90</td><td>76.49</td><td>72.74</td><td></td><td>93.3336.69</td><td>93.37</td><td>93.45</td><td>78.83</td><td>77.74</td><td>60.24</td><td>68.96</td><td>95.81</td><td>78.47</td><td>51.11</td><td>|74.15</td><td></td><td></td></tr><tr><td>△std</td><td>76.19 +0.65</td><td>+3.70</td><td>-1.04</td><td>+3.43</td><td>+0.25</td><td>+3.81</td><td>+0.04</td><td>+0.21</td><td>+0.30</td><td>+0.29</td><td>+0.17</td><td>-2.14</td><td>+0.22</td><td>+0.21</td><td>+0.63</td><td></td><td></td><td></td></tr><tr><td>#hw</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td></td><td>453</td><td></td></tr><tr><td>CuPL (full)</td><td>76.69</td><td>61.70</td><td>77.63</td><td>73.31</td><td></td><td>93.36 36.11</td><td>93.81</td><td>93.45</td><td>79.67</td><td>78.36</td><td>60.63</td><td>71.69</td><td>95.84</td><td>78.57</td><td>51.11</td><td>74.80</td><td></td><td></td></tr><tr><td>△std</td><td>+1.15</td><td>+6.50</td><td>+0.10</td><td>+4.00</td><td>+0.28</td><td>+3.23</td><td>+0.48</td><td>+0.21</td><td>+1.14</td><td>+0.91</td><td>+0.56</td><td>+0.59</td><td>+0.25</td><td>+0.31</td><td>+0.63</td><td></td><td></td><td>5945</td></tr><tr><td>#hw</td><td>5</td><td>6</td><td>9</td><td>3</td><td>3</td><td>2</td><td>2</td><td>3</td><td>2</td><td>5</td><td>4</td><td>5</td><td>3</td><td>4</td><td>3</td><td></td><td></td><td></td></tr></table>
77
+
78
+ Flowers 102 (Nilsback & Zisserman, 2008), UCF101 (Soomro et al., 2012), Kinetics-700 (Carreira et al., 2019), Remote Sensing Image Scene Classification (RESISC45) (Cheng et al., 2017), CIFAR10 (Krizhevsky et al., 2009), CIFAR-100 (Krizhevsky et al., 2009), and Birdsnap (Berg et al., 2014). For the two video datasets, we extract the middle frame of the video, as is done in Radford et al. (2021).
79
+
80
+ # 3.2 RESULTS
81
+
82
+ Our results for the base prompts setting and the full prompts setting are in Table 1. We present our method’s performance on 15 different image classification benchmarks, comparing both the classification accuracy and the number of hand-written sentence templates needed for each method. Note that for the standard method (Radford et al., 2021), the hand-written sentences refer to the image-prompts, while for CuPL the hand-written sentences refer to the LLM-prompts, with which image-prompts are generated.
83
+
84
+ 1. CuPL (base). In this setting, we see performance gains in 13 out of the 15 examined datasets. Note this setting uses just three hand-constructed sentence across all datasets. This is in comparison to the nearly 175 unique image-prompt templates that are hand-written across all of these datasets in the standard setting. Additionally, in the standard setting these hand-constructed prompts must be very specific to the dataset (e.g., “a black and white photo of a $\{ \}$ .”, “a plastic $\{ \} . \ ' )$ . In comparison, CuPL (base) requires only the category type of the overall dataset and still outperforms the handwritten, domain specified baseline in almost all cases. Thus, we present this base prompt setting as a simple standard that matches or exceeds prompt engineering open vocabulary models.
85
+
86
+ 2. CuPL (full prompts). Here we see improvements on all examined datasets. This includes large (over 1 percentage point) gains on ImageNet Top-1, DTD (texture classification), SUN397 (scene classification), FGVC Aircraft (fine-grained aircraft classification), and Flowers 102 (flower classification). While this setting requires more hand-written prompts than setting (1), it still requires significantly fewer than the baseline method (5 sentences versus 80 sentence for ImageNet), and does not include knowledge about the image domain. The full list of hand-constructed sentences for CuPL (full prompts) and the baseline method (Radford et al., 2021) can be found in Section A of the Appendix.
87
+
88
+ # 3.3 ANALYSIS AND ABLATIONS
89
+
90
+ Model Size. In Figure 4, we show CuPL (full prompts) at different model scales. As there are two different zero-shot models in the CuPL algorithm, we show the effects of varying each model individually. On the left hand side, we vary the CLIP model used while holding the LLM constant. We see consistent gains across all model sizes. On the right hand side, we vary the size of the LLM. We plot the accuracy of the baseline as well, which does not vary as it does not utilize an LLM. We find larger models lead to higher accuracy, though the 2nd and 3rd largest models perform similarly.
91
+
92
+ ![](images/351179f81d6228fdb143732fd2a363036bdcae430a3f38c626aa3176dbb472d7.jpg)
93
+ Figure 4: Performance of $\mathbf { C u P L }$ as models scale. (Left) ImageNet Top-1 accuracy for various scales of CLIP. CuPL prompts remain consistently better than standard prompts even we adjust CLIP model size (ViT-B/32, ViT-B/16, ViT-L/14). GPT-3 model set as DaVinci-002. (Right) ImageNet Top-1 accuracy for various scales of GPT-3 (ada, babbage, curie, davinci-002). Larger models produce higher accuracy. CLIP model set as ViT-L/14.
94
+
95
+ Number of Prompts. In Figure 6, we present ablations on the number of LLM-prompts and image-prompts for CuPL (full prompts). On the left side, we show ImageNet accuracy as we increase the number of LLM-prompts. This also corresponds to the number of sentences that have to be hand-written. Notably, this methods outperforms the baseline even when using prompts generated from a single handwritten sentence. On the right hand side, we hold the number of LLM-prompts constant at 5 and adjust how many image-prompts we generate per LLM-prompt. We plot the accuracy given the total number of image-prompts (so 10 generated image-prompt per LLM-prompt corresponds to 50 total image-prompts). We see
96
+
97
+ that $\mathrm { { C u P L } }$ begins to outperform the baseline at just 25 image-prompts, well below the 80 imageprompts used in the baseline.
98
+
99
+ ![](images/51232e3355f62f445d6fb060f714a79c2fe5dac53a8b65db8ea8f54267fa9bf1.jpg)
100
+ Figure 5: Effect of LLM temperature. More prompt diversity leads to higher performance.
101
+
102
+ Diversity of Prompts. We also examine the impact of the diversity of image-prompts on ImageNet accuracy. We adjust this parameter by changing the temperature of the GPT-3 model. This value changes the likelihood of selecting lower probability tokens and makes sentences more diverse from each other. As demonstrated in Figure 5, more diverse prompts lead to higher ImageNet accuracy. Note these comparisons are done with a single LLM-prompt to save computational cost.
103
+
104
+ WordNet Definitions and Wikipedia Descriptions. We also consider two additional methods of obtaining descriptive sentences for each ImageNet category, other than using an LLM. Firstly, we compare CuPL (full) image-prompts with image-prompts generated using definitions of each ImageNet category. Because each ImageNet category is derived from the WordNet database (Miller, 1995), we can use the WordNet definition of each word.
105
+
106
+ We preprocess these definitions so they are of the form “A(n) $\{ \}$ is a ...” as not all WordNet definitions contain the name of the word itself. We also add a period to the end of each definition, as we find this increases performance. As shown in Table 2, ImageNet Top-1 accuracy with WordNet definition prompts is below that of CuPL or standard prompts. In addition to lower accuracy, this method uses significantly more hand-constructed sentences as it requires 1000 unique hand-written definitions compared to 175 unique hand-written image-prompt templates for the standard method and 45 unique hand-written LLM-prompt templates for CuPL (full).
107
+
108
+ ![](images/dc357d96ea3b897f119d11c1086b962a15b2a4e985b1ac6d6b76091f7014871e.jpg)
109
+ Figure 6: Ablation on number of LLM-prompts (left) and image-prompts (right). (Left) As number of hand-written LLM-prompts increases, so does accuracy. 10 image-prompts are generated for each LLM-prompt. Note that $\mathrm { { C u P L } }$ outperforms the baseline even with just one hand-written sentence. We add the prompts in a greedy manner, at each step adding the 10 prompts which lead to the largest performance gain. (Right) We adjust the number of image-prompts generated by a fixed number (5) of LLM-prompts. Even at 5 Image-prompts per LLM-prompt (25 prompts total), we outperform the baseline which uses 80 image-prompts.
110
+
111
+ Secondly, we compare against prompts generated from Wikipedia articles corresponding to each ImageNet category, as collected in Bujwid & Sullivan (2021b). Note that the Wikipedia article does not always exactly match the natural language name of the class used by Radford et al. (2021). Additionally, 80 categories map to more than one Wikipedia article (e.g. the category associated with the natural language word “patio” is mapped to the articles for “patio” and “terrace”). In this case, we select the first associated article. We preprocess these by removing the first line (the name of the article), and then extracting the first sentence, including the final period. We find both of these preprocessing steps lead to increase in accuracy. We also truncate this sentence to the maximum allowed input length of CLIP. For the 24 ImageNet categories that do not have an associated Wikipedia page, we use the name of the category as the image-prompts. As shown in Table 2, we find Wikipedia to be less effective than standard prompts, CuPL prompts, or WordNet definitions.
112
+
113
+ Table 2: ImageNet Top-1 accuracy for different methods of generating imageprompts.
114
+
115
+ <table><tr><td rowspan=1 colspan=1> Standard</td><td rowspan=1 colspan=1>CuPL</td><td rowspan=1 colspan=1>WordNet</td><td rowspan=1 colspan=1>Wiki</td></tr><tr><td rowspan=1 colspan=1>75.54</td><td rowspan=1 colspan=1>76.69</td><td rowspan=1 colspan=1>73.44</td><td rowspan=1 colspan=1>68.20</td></tr></table>
116
+
117
+ Ensembling with Standard Prompts. We also consider using LLM generated prompts from CuPL (full) in addition to hand-written prompts. We do this by averaging together all the text embeddings of the CuPL prompts and hand-written prompts. As shown in Table 3, we find that for some datasets, ensembling both types of prompts outperforms CuPL prompts on their own, while for others CuPL prompts perform better. For all datasets, this ensemble performs better than standard prompts alone. However, this ensembling method requires all the hand-written effort and domain knowledge of the standard approach.
118
+
119
+ Analysis of Accuracy Gains. In addition to total accuracy gains, we present the per class accuracy shift between the image-prompts used in Radford et al. (2021) and CuPL, shown in Figure 7. As demonstrated, the accuracy gains seen in $\mathrm { C u P L }$ are not distributed uniformly through the ImageNet classes, with some classes seeing ${ \sim } 4 0$ percentage point accuracy gains, and others seeing ${ \sim } 4 0$ percentage point accuracy losses when compared against class accuracy with standard prompts. In other words, while CuPL sees a higher accuracy overall when compared to the standard method, the images which are correctly predicted by the standard prompts are not a subset of the images which are correctly predicted by $\mathrm { C u P L }$ . In fact $\mathrm { { C u P L } }$ sees just over a 1 percentage point gain when compared to standard prompts, but differs in it’s predictions from the standard method for $1 1 . 5 0 \%$ of predictions (with CuPL correct for $4 . 4 8 \%$ of these, standard correct for $3 . 3 2 \%$ , and neither correct for $3 . 7 0 \%$ ).
120
+
121
+ Table 3: Performance of the ensemble of CuPL (full) and the standard, hand-written prompts in CLIP (Radford et al., 2021). This ensemble outperforms the standard hand-written prompts for all examined datasets (difference shown with $\Delta$ std), and outperforms CuPL (full) for 11 datasets (difference shown with $\Delta$ CuPL)
122
+
123
+ <table><tr><td></td><td colspan="5">eeee </td><td>Teirierr</td><td>PPd Ppirit</td><td>Grleaar</td><td>Bi eiEG</td><td>UUIIII</td><td>Errresiso0</td><td>PPSSSSSS</td><td>CIATII1</td><td></td><td>CEIPAIIIO</td><td>Trrsppg</td><td>naea</td></tr><tr><td>Ensemble</td><td>76.51</td><td>61.60</td><td>77.66</td><td>73.51</td><td></td><td>93.42</td><td>36.47</td><td>93.71</td><td>93.87</td><td>79.73</td><td>78.16</td><td>61.50</td><td>73.03</td><td>95.88</td><td>79.33</td><td>51.09</td><td>75.03</td></tr><tr><td>△std</td><td>+0.97</td><td>+6.40</td><td>+0.13</td><td>+4.20</td><td>+0.34</td><td>+3.59</td><td></td><td>+0.38</td><td>+0.63</td><td>+1.20</td><td>+0.71</td><td>+1.43</td><td>+1.93</td><td>+0.29</td><td>+1.07</td><td>+0.66</td><td></td></tr><tr><td>△ CuPL</td><td>-0.18</td><td>-0.1</td><td>+0.03</td><td>+0.20</td><td>+0.06</td><td></td><td>+0.36</td><td>-0.10</td><td>+0.42</td><td>+0.06</td><td>+0.20</td><td>+0.87</td><td>+1.34</td><td>+0.04</td><td>+0.76</td><td>-0.02</td><td></td></tr></table>
124
+
125
+ Figure 7 also shows the classes with the 20 greatest accuracy gains and losses when comparing class accuracy with standard image-prompts (Radford et al., 2021) versus with $\mathrm { C u P L }$ image-prompts. Interestingly, for many of the classes which see a large accuracy gain, we see a corresponding class with a large accuracy loss that is either similar to the initial class or likely to co-occur with it (e.g. agaric/mushroom, academic gown/graduation cap, military uniform/Pickelhaube, desk/monitor).
126
+
127
+ # 4 RELATED WORK
128
+
129
+ # 4.1 NATURAL LANGUAGE DESCRIPTIONS FOR IMAGE CLASSIFICATION
130
+
131
+ Several prior works use text-based knowledge of image categories to improve classification accuracy. Elhoseiny et al. (2017) extract visual information from unstructured text descriptions collected from the internet to recognize parts of object and classify them in a zero-shot way. Reed et al. (2016) and He & Peng (2017) use natural language descriptions of bird types to train a multimodal classification model. Huang et al. (2021) use hand-collected attribute tags to attend over relevant features in images. Paz-Argaman et al. (2020) extract visual information from Wikipedia descriptions to enable zero-shot bird classification. Additional works (Shen et al., 2022; Bujwid & Sullivan, 2021a) show improvements on large datasets (e.g., ImageNet) using external information from external databases such as Imagenet-wiki and Wordnet. While these works show the effectiveness of augmenting zero-shot models with descriptive text, all of these prior works rely on external natural language databases for descriptions. This often limits the possible categories that can be classified and can require extensive preprocessing to extract visual descriptions from noisy natural language.
132
+
133
+ # 4.2 GENERATED TEXT FOR DOWNSTREAM TASKS
134
+
135
+ Recent work has utilized text generated from LLMs in a number of ways. Santurkar et al. (2022) use an LLM to paraphrase existing image captions to use as data augmentation for CLIP. Liu et al. (2022) use GPT-3 to generate knowledge on a topic when given a number of demonstrations, which is then used to improve accuracy on common sense reasoning questions. Hu et al. (2022) use a LLM to add labels to text to improve text classification accuracy. In Yu et al. (2022b), the outputs of a GPT-2 model are used to train an encoder on top of a vision model to generate multimodal image representations for a variety of tasks. Su et al. (2022) utilize a language model to perform image captioning by iteritively generating candidate image captions with a LLM and then using feedback from an open vocabulary model to align it to a given image. Similarly, Yang et al. (2022) use GPT-3 along with text descriptions of images for the Visual Question Answering (VQA) task. However, unlike CuPL these prior works are either purely language tasks (common sense reasoning, text classification) or multimodal with some language component (image captioning, VQA). In our work, we demonstrate how LLM generated text can be used to improve purely visual image classification tasks across a number of benchmarks.
136
+
137
+ ![](images/3105f1cca8a0d1b0fcc9c992507a786dc459f1f78af82d59265bf760d6a1b731.jpg)
138
+ per class accuracy difference of CuPL vs Standard image-prompts
139
+ Figure 7: Distribution of ImageNet per class accuracy difference of CuPL image-prompts versus standard image-prompts. As shown, the accuracy gains of $\mathrm { C u P L }$ are not uniform across all classes. Rather, we see large gains for some classes, and losses for others. In addition, we list the classes which see the largest accuracy gains when switching to $\mathrm { C u P L }$ prompts (with “mushroom” having the largest gain), and the 20 classes with the largest accuracy losses (with “canoe” having the largest loss.)
140
+
141
+ # 4.3 PROMPT ENGINEERING
142
+
143
+ Previous efforts have explored methods for obtaining successful natural language prompts. For both open vocabulary image classification models as well as LLMs, the format of prompts is known to highly affect accuracy (Schick & Schutze, 2021; Radford et al., 2021; Brown et al., 2020; Gao et al., ¨ 2020). This has led to a large effort to find optimal prompt formats. Proposed methods include crowd-sourcing high performing prompts (Bach et al., 2022) as well as framing prompts to induce models to give explanations as well as answers (Wei et al., 2022; Kojima et al., 2022; Nye et al., 2021). Additional works have proposed learning prompts via gradient based methods (Zhang et al., 2021; Qin & Eisner, 2021; Li & Liang, 2021; Lester et al., 2021; Shin et al., 2020), retrieval from a database (Rubin et al., 2022), or reformatting/rephrasing existing prompts (Jiang et al., 2020; Rubin et al., 2022).
144
+
145
+ Most relevant to this work are a number of methods for designing optimal prompts for zero-shot image classification with open vocabulary models. These methods learn prompts formats which yield high accuracy for image classification using either supervised (Zhou et al., 2022; Rao et al., 2022) or unsupervised (Huang et al., 2022) methods. However, unlike these prior works this work requires no additional training or labeled data.
146
+
147
+ # 5 CONCLUSION
148
+
149
+ We demonstrate that leveraging knowledge from an LLM can immediately improve zero-shot accuracy on a variety of image classification tasks, with much less hand-engineering efforts to craft natural language prompts. Furthermore, prompts can be customized to the desired categories, rather than a general template that applies to all existing image categories. Finally, using prompts generated by LLMs lowers the barrier of prior knowledge about the dataset, which is often required when crafting prompt templates.
150
+
151
+ Querying an LLM for prompt construction is simple, straightforward and as our results suggested, immediately beneficial. The hypothesis that a joint force of LLMs and open vocabulary models would improve zero-shot image classification is thoroughly tested in this work. We hope these findings serve as a useful tool towards understanding and improving zero-shot image classification, and more generally, the consolidation of model capacities and modalities through natural language.
152
+
153
+ # 6 REPRODUCIBILITY
154
+
155
+ We have a number of measures to ensure the reproducibility of this work. First, in the supplementary material we include the code to generate image-prompts for ImageNet and evaluate the accuracy of these prompts. In Section 2, we note all hyperparameters used for the LLM. Additionally, in the appendix we include all LLM-prompts used to generate image-prompts for each of the 15 datasets. In the supplementary material, we include all generated image-prompts for all dataset, for both CuPL (base) and CuPL (full).
156
+
157
+ # REFERENCES
158
+
159
+ Stephen H. 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 Alan Fries, Maged S. Al-shaibani, Shanya Sharma, Urmish Thakker, Khalid Almubarak, Xiangru Tang, Mike Tian-Jian Jiang, and Alexander M. Rush. Promptsource: An integrated development environment and repository for natural language prompts. ArXiv, abs/2202.01279, 2022.
160
+
161
+ Thomas Berg, Jiongxin Liu, Seung Woo Lee, Michelle L Alexander, David W Jacobs, and Peter N Belhumeur. Birdsnap: Large-scale fine-grained visual categorization of birds. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2011–2018, 2014.
162
+
163
+ Lucas Beyer, Olivier J Henaff, Alexander Kolesnikov, Xiaohua Zhai, and A ´ aron van den Oord. Are ¨ we done with imagenet? arXiv preprint arXiv:2006.07159, 2020.
164
+
165
+ Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101 – mining discriminative components with random forests. In European Conference on Computer Vision, 2014.
166
+
167
+ 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.
168
+
169
+ Sebastian Bujwid and Josephine Sullivan. Large-scale zero-shot image classification from rich and diverse textual descriptions. ArXiv, abs/2103.09669, 2021a.
170
+
171
+ Sebastian Bujwid and Josephine Sullivan. Large-scale zero-shot image classification from rich and diverse textual descriptions. arXiv preprint arXiv:2103.09669, 2021b.
172
+
173
+ Joao Carreira, Eric Noland, Chloe Hillier, and Andrew Zisserman. A short note on the kinetics-700 human action dataset. arXiv preprint arXiv:1907.06987, 2019.
174
+
175
+ Gong Cheng, Junwei Han, and Xiaoqiang Lu. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 105(10):1865–1883, 2017.
176
+
177
+ M. Cimpoi, S. Maji, I. Kokkinos, S. Mohamed, , and A. Vedaldi. Describing textures in the wild. In Proceedings of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2014.
178
+
179
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
180
+
181
+ 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. arXiv preprint arXiv:2010.11929, 2020.
182
+
183
+ Mohamed Elhoseiny, Yizhe Zhu, Han Zhang, and A. Elgammal. Link the head to the ”beak”: Zero shot learning from noisy text description at part precision. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6288–6297, 2017.
184
+
185
+ Li Fei-Fei, Rob Fergus, and Pietro Perona. Learning generative visual models from few training examples: An incremental bayesian approach tested on 101 object categories. In 2004 conference on computer vision and pattern recognition workshop, pp. 178–178. IEEE, 2004.
186
+
187
+ Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. arXiv preprint arXiv:2012.15723, 2020.
188
+
189
+ Xiangteng He and Yuxin Peng. Fine-grained image classification via combining vision and language. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7332– 7340, 2017.
190
+
191
+ Shengding Hu, Ning Ding, Huadong Wang, Zhiyuan Liu, Juan-Zi Li, and Maosong Sun. Knowledgeable prompt-tuning: Incorporating knowledge into prompt verbalizer for text classification. In ACL, 2022.
192
+
193
+ Siteng Huang, Min Zhang, Yachen Kang, and Donglin Wang. Attributes-guided and pure-visual attention alignment for few-shot recognition. In AAAI, 2021.
194
+
195
+ Tony Huang, Jack Chu, and Fangyun Wei. Unsupervised prompt learning for vision-language models. arXiv preprint arXiv:2204.03649, 2022.
196
+
197
+ Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, pp. 4904–4916. PMLR, 2021.
198
+
199
+ Zhengbao Jiang, Frank F. Xu, J. Araki, and Graham Neubig. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438, 2020.
200
+
201
+ Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. ArXiv, abs/2205.11916, 2022.
202
+
203
+ Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), Sydney, Australia, 2013.
204
+
205
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
206
+
207
+ Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. ArXiv, abs/2104.08691, 2021.
208
+
209
+ Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. 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), abs/2101.00190, 2021.
210
+
211
+ Jiacheng Liu, Alisa Liu, Ximing Lu, Sean Welleck, Peter West, Ronan Le Bras, Yejin Choi, and Hannaneh Hajishirzi. Generated knowledge prompting for commonsense reasoning. In ACL, 2022.
212
+
213
+ S. Maji, J. Kannala, E. Rahtu, M. Blaschko, and A. Vedaldi. Fine-grained visual classification of aircraft. Technical report, 2013.
214
+
215
+ George A Miller. Wordnet: a lexical database for english. Communications of the ACM, 38(11): 39–41, 1995.
216
+
217
+ Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics & Image Processing, pp. 722–729. IEEE, 2008.
218
+
219
+ Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, Charles Sutton, and Augustus Odena. Show your work: Scratchpads for intermediate computation with language models. ArXiv, abs/2112.00114, 2021.
220
+
221
+ Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and CV Jawahar. Cats and dogs. In 2012 IEEE conference on computer vision and pattern recognition, pp. 3498–3505. IEEE, 2012.
222
+
223
+ Tzuf Paz-Argaman, Yuval Atzmon, Gal Chechik, and Reut Tsarfaty. Zest: Zero-shot learning from text descriptions using textual similarity and visual summarization. In FINDINGS, 2020.
224
+
225
+ Hieu Pham, Zihang Dai, Golnaz Ghiasi, Kenji Kawaguchi, Hanxiao Liu, Adams Wei Yu, Jiahui Yu, Yi-Ting Chen, Minh-Thang Luong, Yonghui Wu, et al. Combined scaling for open-vocabulary image classification. arXiv preprint arXiv:2111.10050, 2021.
226
+
227
+ Guanghui Qin and Jas’ Eisner. Learning how to ask: Querying lms with mixtures of soft prompts. ArXiv, abs/2104.06599, 2021.
228
+
229
+ 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.
230
+
231
+ Yongming Rao, Wenliang Zhao, Guangyi Chen, Yansong Tang, Zheng Zhu, Guan Huang, Jie Zhou, and Jiwen Lu. Denseclip: Language-guided dense prediction with context-aware prompting. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18082–18091, 2022.
232
+
233
+ Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning, pp. 5389–5400. PMLR, 2019.
234
+
235
+ Scott E. Reed, Zeynep Akata, Honglak Lee, and Bernt Schiele. Learning deep representations of fine-grained visual descriptions. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 49–58, 2016.
236
+
237
+ Ohad Rubin, Jonathan Herzig, and Jonathan Berant. Learning to retrieve prompts for in-context learning. In NAACL, 2022.
238
+
239
+ Shibani Santurkar, Yann Dubois, Rohan Taori, Percy Liang, and Tatsunori Hashimoto. Is a caption worth a thousand images? a controlled study for representation learning. arXiv preprint arXiv:2207.07635, 2022.
240
+
241
+ Timo Schick and Hinrich Schutze. Exploiting cloze-questions for few-shot text classification and ¨ natural language inference. In EACL, 2021.
242
+
243
+ Sheng Shen, Chunyuan Li, Xiaowei Hu, Yujia Xie, Jianwei Yang, Pengchuan Zhang, Anna Rohrbach, Zhe Gan, Lijuan Wang, Lu Yuan, Ce Liu, Kurt Keutzer, Trevor Darrell, and Jianfeng Gao. K-lite: Learning transferable visual models with external knowledge. ArXiv, abs/2204.09222, 2022.
244
+
245
+ Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Eliciting knowledge from language models using automatically generated prompts. ArXiv, abs/2010.15980, 2020.
246
+
247
+ Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
248
+
249
+ Yixuan Su, Tian Lan, Yahui Liu, Fangyu Liu, Dani Yogatama, Yan Wang, Lingpeng Kong, and Nigel Collier. Language models can see: Plugging visual controls in text generation. ArXiv, abs/2205.02655, 2022.
250
+
251
+ Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008.
252
+
253
+ Ben Wang and Aran Komatsuzaki. Gpt-j-6b: A 6 billion parameter autoregressive language model, 2021.
254
+
255
+ Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. In Advances in Neural Information Processing Systems, pp. 10506–10518, 2019.
256
+
257
+ 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, abs/2201.11903, 2022.
258
+
259
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, et al. Huggingface’s transformers: ´ State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019.
260
+
261
+ Mitchell Wortsman, Gabriel Ilharco, Jong Wook Kim, Mike Li, Simon Kornblith, Rebecca Roelofs, Raphael Gontijo Lopes, Hannaneh Hajishirzi, Ali Farhadi, Hongseok Namkoong, et al. Robust fine-tuning of zero-shot models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7959–7971, 2022.
262
+
263
+ Jianxiong Xiao, James Hays, Krista A Ehinger, Aude Oliva, and Antonio Torralba. Sun database: Large-scale scene recognition from abbey to zoo. In 2010 IEEE computer society conference on computer vision and pattern recognition, pp. 3485–3492. IEEE, 2010.
264
+
265
+ 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 AAAI, 2022.
266
+
267
+ 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, 2022a.
268
+
269
+ Youngjae Yu, Jiwan Chung, Heeseung Yun, Jack Hessel, Jae Sung Park, Ximing Lu, Prithviraj Ammanabrolu, Rowan Zellers, Ronan Le Bras, Gunhee Kim, and Yejin Choi. Multimodal knowledge alignment with reinforcement learning. ArXiv, abs/2205.12630, 2022b.
270
+
271
+ Ningyu Zhang, Luoqiu Li, Xiang Chen, Shumin Deng, Zhen Bi, Chuanqi Tan, Fei Huang, and Huajun Chen. Differentiable prompt makes pre-trained language models better few-shot learners. ArXiv, abs/2108.13161, 2021.
272
+
273
+ Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Learning to prompt for visionlanguage models. International Journal of Computer Vision, pp. 1–12, 2022.
274
+
275
+ APPENDIX: What does a platypus look like? Generating customized prompts for zero-shot image classification
276
+
277
+ OVERVIEW
278
+
279
+ A. CuPL (Full Prompts) vs Standard Prompts
280
+ B. CuPL Base Prompts
281
+ C. Evaluation Metric
282
+ D. Open-Source LLM
283
+ E. Single Sentence Baseline
284
+ F. Robustness
285
+ G. CuPL Improvement Analysis
286
+ H. Error Analysis
287
+ I. Image-Prompt Distribution
288
+ J. Tempurature Analysis
289
+ K. Example Generated image-prompts
290
+
291
+ A CUPL (FULL PROMPTS) VS STANDARD PROMPTS
292
+
293
+ We detail the hand-written prompt templates used for $\mathrm { { C u P L } }$ (full prompts) versus standard CLIP Radford et al. (2021) prompt templates. For $\mathrm { C u P L }$ , hand-written prompt templates are needed for the LLM-prompts, while for the standard method hand-written prompt templates are needed for the image-prompts.
294
+
295
+ Note that many of the hand-written templates for the standard method encode information about the datasets. For example, ”a toy $\{ \} ^ { \ast }$ demonstrates knowledge that objects are sometimes represented as a toy version of an object rather than as the literal object. CuPL prompts remain much more general (e.g. ”Describe what a $\{ \}$ looks like”).
296
+
297
+ <table><tr><td>Caltech101</td><td colspan="2"></td></tr><tr><td>CuPL hand-written</td><td colspan="2">Standard hand-written</td></tr><tr><td>Describe what a(n) {} looks like: Describe a(n) {}: What are the identifying characteristics of a(n) {}?</td><td>a photo of a {}. a painting of a{. a plastic {. a sculpture of a {}. a sketch of a {}. a tattoo of a {}. a toy {. a rendition of a {}. a embroidered {}. a cartoon {}. a {} in a video game. a plushie {}. a origami{. art of a{. graffiti of a {}. a drawing of a {}. a doodle of a {}.</td><td>a photo of the {}. a painting of the {. the plastic {}. a sculpture of the {}. a sketch of the {}. a tattoo of the {}. the toy {. a rendition of the {}. the embroidered{}. the cartoon {}. the {} ina video game. the plushie {}. the origami {. art of the {}. graffiti of the {}. a drawing of the {}.</td></tr></table>
298
+
299
+ <table><tr><td rowspan=1 colspan=1>Food101</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>CuPL hand-written</td><td rowspan=1 colspan=1>Standard hand-written</td></tr><tr><td rowspan=1 colspan=1>Describe what {} looks likeVisually describe {}How can you tell that the food in this photo is {}?</td><td rowspan=1 colspan=1>a photo of {},a type of food.</td></tr></table>
300
+
301
+ # Stanford Cars
302
+
303
+ <table><tr><td>CuPL hand-written</td><td>Standard hand-written</td></tr><tr><td></td><td></td></tr></table>
304
+
305
+ <table><tr><td>How can you identify a(n) {}? Description of a(n) {},a type of car. A caption of a photo of a(n) {: What are the primary characteristics of a(n) {}? Description of the exterior of a(n) {} What are the identifying characteristics of a(n) {},a type of car? Describe an image from the internet of a(n) {</td><td>a photo of a {}. a photo of the {}. a photo of my {. i love my {}! a photo of my dirty {. a photo of my clean {}. a photo of my new {}. a photo of my old {}.</td></tr></table>
306
+
307
+ <table><tr><td rowspan=1 colspan=1>Oxford Pets</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>CuPL hand-written</td><td rowspan=1 colspan=1>Standard hand-writen</td></tr><tr><td rowspan=1 colspan=1>Describe what a pet {} looks likeVisually describe a(n)‘{}&#x27;,a type of pet.</td><td rowspan=1 colspan=1>a photo of a , a type of pet.</td></tr></table>
308
+
309
+ #
310
+
311
+ <table><tr><td>ImageNet</td><td colspan="2"></td></tr><tr><td>CuPL hand-written</td><td colspan="2">Standard hand-written</td></tr><tr><td>Describe what a(n){} looks like How can you identify a(n) {}? What does a(n) look like? Describe an image from the internet of a(n) {} A caption of an image of a(n) {}:</td><td>a bad photo of a {}. a photo of many {}. a sculpture of a {}. a photo of the hard to see {}. a low resolution photo of the {}. a rendering of a {}. graffiti of a {}. a bad photo of the {}. a cropped photo of the {}. a tattoo of a {}. the embroidered{}. a photo of a hard to see {}. a bright photo of a {}. a photo of a clean {}. a photo of a dirty {. a dark photo of the {}. a drawing of a{}. a photo of my {}. the plastic {}. a photo of the cool {}. a close-up photo of a{}. a black and white photo of the {}. a painting of the {}. a painting of a{}. a pixelated photo of the {}. a sculpture of the {}. a bright photo of the {}. a cropped photo of a {}. a plastic {}. a photo of the dirty {. a jpeg corrupted photo of a{}. a blurry photo of the {}. a photo of the {}.</td><td>the origami{}. the{} in a video game. a sketch of a {}. a doodle of the {}. a origami{}. a low resolution photo of a {}. the toy{}. a rendition of the {}. a photo of the clean {}. a photo of a large {}. a rendition of a{} a photo of a nice{}. a photo of a weird {}. a blurry photo of a {}. a cartoon{}. art of a{. a sketch of the {}. aembroidered{}. a pixelated photo of a {}. itap of the {}. a jpeg corrupted photo of the {}. a good photo of a {}. a plushie {}. a photo of the nice {}. a photo of the small {}. a photo of the weird {}. the cartoon {}. art of the {}. a drawing of the {}. a photo of the large {}. a black and white photo of a {}. the plushie {}. a dark photo of a {}.</td></tr></table>
312
+
313
+ <table><tr><td rowspan=1 colspan=1>FGVC Aircraft</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>CuPL hand-written</td><td rowspan=1 colspan=1>Standard hand-written</td></tr><tr><td rowspan=1 colspan=1>Describe a(n) {}aircraftDescribe the{}aircraft</td><td rowspan=1 colspan=1>a photo of a {},a type of aircraft.a photo of the {,a type of aircraft.</td></tr></table>
314
+
315
+ <table><tr><td>DTD</td><td></td></tr><tr><td>CuPL hand-written</td><td>Standard hand-written</td></tr><tr><td>What does“{}” material look like? What does a “{}” surface look like? What does a “{}” texture look like? What does a “{}” object look like? What does a“{}” thing look like? What does a “{}” pattern look like?</td><td>a photo of a {} texture. a photo of a { pattern. a photo of a {} thing. a photo of a {} object. a photo of the{} texture. a photo of the {} pattern. a photo of the { thing. a photo of the {} object.</td></tr></table>
316
+
317
+ <table><tr><td rowspan=1 colspan=1>SUN397</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>CuPL hand-written</td><td rowspan=1 colspan=1>Standard hand-written</td></tr><tr><td rowspan=1 colspan=1>Describe what a(n) {}looks likeHow can you identify a(n) {}?Describe a photo of a(n) {}</td><td rowspan=1 colspan=1>a photo of a {}.a photo of the {}.</td></tr></table>
318
+
319
+ # Kinetics-700
320
+
321
+ Describe the action ”{}” What does a person $\{ \}$ look like? What does the act of $\{ \}$ look like? Describe ”{}”
322
+
323
+ <table><tr><td rowspan=3 colspan=2>UCT101CuPL hand-writtenDescribe the action of {}What does the act of {} look like?What does a person doing {} look like?Describe“}&quot;Describe the action “{}&quot;</td><td rowspan=1 colspan=1>UCT101</td></tr><tr><td rowspan=1 colspan=1>CuPL hand-written</td><td rowspan=1 colspan=1>Standard hand-written</td></tr><tr><td rowspan=1 colspan=1>a photo of a person {}.a video of a person {.a example of a person {}.a demonstration of a person {.a photo of the person {.a video of the person {}.a example of the person {}.a demonstration of the person {}.a photo of a person using {.a video of a person using {. a example of a person using {}.a demonstration of a person using {}.a photo of the person using {.a video of the person using {.a example of the person using {.a demonstration of the person using {}.a photo of a person doing {.a video of a person doing {}.a example of a person doing {.a demonstration of a person doing {.a photo of the person doing {.a video of the person doing {.a example of the person doing {}. a demonstration of the person doing {.a photo of a person during {.a video of a person during {}.a example of a person during {.a demonstration of a person during {.a photo of the person during {}.a video of the person during {.a example of the person during {.a demonstration of the person during {}.a photo of a person performing {}.a video of a person performing {.a example of a person performing {}.a demonstration of a person performing {}.a photo of the person performing {.a video of the person performing {.a example of the person performing {.a demonstration of the person performing {}.a photo of a person practicing {}.a video of a person practicing {. a example of a person practicing {.a demonstration of a person practicing {.a photo of the person practicing {.a video of the person practicing {.a example of the person practicing {}.a demonstration of the person practicing {.</td></tr></table>
324
+
325
+ <table><tr><td>RESISC 45</td><td></td></tr><tr><td>CuPL hand-written</td><td>Standard hand-written</td></tr><tr><td>Describe a satellite photo of a(n) {} Describe a(n) {} as it would appear in an aerial image How can you identify a(n) {} in an aerial photo? Describe the satellite photo of a(n) { Describe an aerial photo of a(n) {}</td><td>satellite imagery of {}. aerial imagery of {}. satellite photo of {}. aerial photo of {}. satellite view of {}. aerial view of {}. satellite imagery of a {}. aerial imagery of a {}. satellite photo of a {. aerial photo of a {}. satellite view of a {}. aerial view of a {. satellite imagery of the {}. aerial imagery of the {. satellite photo of the {. aerial photo of the {. satellite view of the {}. aerial view of the {}.</td></tr></table>
326
+
327
+ <table><tr><td colspan="2"></td></tr><tr><td colspan="2">Birdsnap CuPL hand-writen</td></tr><tr><td colspan="2">Describe what the bird {} looks like: a photo of a {},a type of bird. Describe the bird {}:</td></tr><tr><td colspan="2">What are the identifying characteristics of the bird {}?</td></tr><tr><td>Flowers 102 CuPL hand-written</td><td>Standard hand-written</td></tr><tr><td>Describe how to identify a(n) {},a type of flower What does a(n) { flower look like?</td><td>a photo of a {},a type of flower."</td></tr><tr><td>CIFAR-10 CuPL hand-written</td><td>Standard hand-written</td></tr><tr><td>Describe what a(n) {} looks like Describe a(n) {}: What are the identifying characteristics of a(n) {}?</td><td>a photo of a {}. a blurry photo of a {. a black and white photo of a {}. a low contrast photo of a {}. a high contrast photo of a {}. a bad photo of a {. a good photo of a {}. a photo of a small {}. a photo of a big {. a photo of the {}. a blurry photo of the {}. a black and white photo of the {}. a low contrast photo of the {}. a high contrast photo of the {}. a bad photo of the {}. a good photo of the {}. a photo of the small {}.</td></tr><tr><td colspan="1" rowspan="1">CIFAR-100</td><td colspan="1" rowspan="1"></td></tr><tr><td colspan="1" rowspan="1">CuPL hand-written</td><td colspan="1" rowspan="1">Standard hand-written</td></tr><tr><td colspan="1" rowspan="2">Describe a photo of a(n) {:What are the identifying characteristics of a(n) {}?Describe what a(n) {} looks like:Describe a(n) {}:</td><td colspan="1" rowspan="2">a photo of a {}.a blurry photo of a {}.a black and white photo of a {.a low contrast photo of a {}.a high contrast photo of a {}.a bad photo of a {}.a good photo of a {}.a photo of a small {.a photo of a big {.a photo of the {}.a blurry photo of the {}.a black and white photo of the {}.a low contrast photo of the {}.a high contrast photo of the {}.a bad photo of the {}.a good photo of the {}.a photo of the small {}.a photo of the big {.</td></tr><tr><td colspan="1" rowspan="1"></td></tr></table>
328
+
329
+ # B CUPL BASE PROMPTS
330
+
331
+ The three general sentences used in the base prompt setting are:
332
+
333
+ Describe what a/the looks like: Describe a/the : What are the identifying characteristics of a/the ?
334
+
335
+ Here we specify the type filled in for each of the examined datasets, as well as the article used for that dataset $\mathbf { \dot { a } } ( \mathbf { n } ) ^ { \prime }$ or ‘the’):
336
+
337
+ <table><tr><td>Dataset</td><td>Base LLM-prompt type specification</td></tr><tr><td>ImageNet</td><td>a(n) {}</td></tr><tr><td>DTD</td><td>the texture {}</td></tr><tr><td>StanfordCars SUN397</td><td>the car {}</td></tr><tr><td>Food 101</td><td>a(n)0</td></tr><tr><td></td><td>the food {</td></tr><tr><td>FGVC Aircraft</td><td>the aircraft {}</td></tr><tr><td>Oxford Pets</td><td>a pet </td></tr><tr><td>Caltech101</td><td>a(n){</td></tr><tr><td>CIFAR-10</td><td>a(n)</td></tr><tr><td>CIFAR-100</td><td>a(n)</td></tr><tr><td>Flowers 102</td><td>the flower {}</td></tr><tr><td>Kinetics-700</td><td></td></tr><tr><td></td><td>the action of {}</td></tr><tr><td>UCF101</td><td>the action of {}</td></tr><tr><td>RESISC45</td><td>a satellite photo of {}</td></tr><tr><td>Birdsnap</td><td>the bird {}</td></tr></table>
338
+
339
+ # C EVALUATION METRIC
340
+
341
+ <table><tr><td rowspan=1 colspan=1>1eegee</td><td rowspan=1 colspan=1>DLI</td><td rowspan=1 colspan=1>srsrr prlrers</td><td rowspan=1 colspan=1>L30300</td><td rowspan=1 colspan=1>Toopoon</td><td rowspan=1 colspan=1>FAVTileer</td><td rowspan=1 colspan=1>sod porrt</td><td rowspan=1 colspan=1>Crreeaer</td><td rowspan=1 colspan=1>TirsionIS</td><td rowspan=1 colspan=1>UUUIII</td><td rowspan=1 colspan=1>Trrreeisieon</td><td rowspan=1 colspan=1>PPSSSSS</td><td rowspan=1 colspan=1>CIPAIII1</td><td rowspan=1 colspan=1>CIIPPPPI0</td><td rowspan=1 colspan=1>Prrspg</td></tr></table>
342
+
343
+ <table><tr><td rowspan=1 colspan=1>Acc.|Acc.</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Meanperclass</td><td rowspan=1 colspan=1>Meanperclass</td><td rowspan=1 colspan=1>Meanperclass</td><td rowspan=1 colspan=1>Meanperclass</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Mean(top1,top5)</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Acc.</td></tr></table>
344
+
345
+ # D OPEN-SOURCE LLM
346
+
347
+ While GPT-3 (Brown et al., 2020) demonstrates higher performance on a number of tasks compared to smaller open-source models, open-source models are sometime more accessible. We therefore show improvement using GPT-J-6B (Wang & Komatsuzaki, 2021), a small open-source model available on HuggingFace (Wolf et al., 2019). We find that we are able to surpass human written prompts with prompts generated by this model as shown in Table, though we still fall short of those generated by GPT-3. Additionally, we employ a number of strategies to increase the accuracy of the lower quality GPT-J-6B generations. First, we generate at a lower temperature (0.3) to prevent irrelevant or nonsensical generations, which we find occur more frequently in smaller models. Additionally, we generate 5 times more Image-prompts per LLM-prompt than we do when using GPT-3 (Brown et al., 2020). We also add punctuation to the end of all LLM-prompts to encourage the LLM to begin new sentences. Finally, we filter out any Image-prompts which do not contain the name of the ImageNet category they are meant to describe, as well as remove a number of unicode characters from the generations (e.g. $\mathbf { \dot { u } } _ { \mathbf { \lambda } } ( 0 1 9 ^ { \cdot }$ ). We present these findings as a way to make $\mathrm { { C u P L } }$ a more accessible options until large high performance models become available to the public.
348
+
349
+ Table 4: CuPL with an open-source model. CuPL is able to improve over hand-written baselines even for smaller open-source models.
350
+
351
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ImageNet</td></tr><tr><td rowspan=1 colspan=1>standard</td><td rowspan=1 colspan=1>75.54</td></tr><tr><td rowspan=1 colspan=1>CuPL(GPT-J-6B)</td><td rowspan=1 colspan=1>75.62</td></tr><tr><td rowspan=1 colspan=1>CuPL (GPT-3)</td><td rowspan=1 colspan=1>76.69</td></tr></table>
352
+
353
+ # E SINGLE SENTENCE BASELINE
354
+
355
+ Table 5: Single sentence baselines. Comparison of a single hand-written Imageprompt template with a single handle written LLM-prompt as well as a single CuPL generated Image-prompt.
356
+
357
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ImageNet</td></tr><tr><td rowspan=1 colspan=1>a photo of a{</td><td rowspan=1 colspan=1>73.46</td></tr><tr><td rowspan=1 colspan=1>CuPL(1 hand-written)</td><td rowspan=1 colspan=1>75.71</td></tr><tr><td rowspan=1 colspan=1>CuPL (1 generated)</td><td rowspan=1 colspan=1>74.24</td></tr></table>
358
+
359
+ One of the primary benefits of $\mathrm { { C u P L } }$ is that it decreases the amount of necessary hand-engineering. However, this could also be done by decreasing the number of total hand-written templates used, which comes at a loss in performance. We present this as a ‘low effort’ baseline, where we use only the hand constructed template of ‘a photo of a $\{ \} ^ { \ast }$ . We compare this with two CuPL baselines. The first is the baseline in which we also only construct one hand written template: ‘Describe what a $\{ \}$ looks like’. We then use this to generate 10 Image-prompts. The second baseline is a single CuPL generated sentence, generated with the prompt ‘Describe what a $\{ \}$ looks like’. For this experiment, we generate at a temperature of 0.3 as we find that higher tempuratures are only helpful when we are able to ensemble many diverse prompts, not when we are limited to one. We find that $\mathrm { { C u P L } }$ outperforms a single hand-written template under both of these settings, as shown in Table 5.
360
+
361
+ # F ROBUSTNESS
362
+
363
+ In addition to the previously mentioned benefits of open vocabulary models, one of the important advances made by CLIP (Radford et al., 2021) is an increased robustness on out-of-distribution data. Fine-tuning has been shown to degrade performance on out-of-distribution tasks (Wortsman et al., 2022), however zero-shot CLIP is robust to these distribution shifts. We show improvement on two common distribution shifts in Table 6, demonstrating that CuPL maintains the robustness of CLIP.
364
+
365
+ Table 6: Robustness of CuPL. CuPL accuracy on two common ImageNet variants, using CuPL ImageNet Image-prompts. CuPL improves performance on both of these variants, demonstrating that CuPL improves accuracy on in-distribution tasks, while maintaining robustness to distribution shifts.
366
+
367
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ImageNet(Deng et al., 2009)</td><td rowspan=1 colspan=1>ImageNet-V2(Recht et al., 2019)</td><td rowspan=1 colspan=1>ImageNet-Sketch(Wang et al., 2019)</td></tr><tr><td rowspan=1 colspan=1>Standard</td><td rowspan=1 colspan=1>75.54</td><td rowspan=1 colspan=1>69.86</td><td rowspan=1 colspan=1>59.60</td></tr><tr><td rowspan=1 colspan=1>CuPL</td><td rowspan=1 colspan=1>76.69</td><td rowspan=1 colspan=1>70.85</td><td rowspan=1 colspan=1>60.05</td></tr></table>
368
+
369
+ # G CUPL IMPROVEMENT ANALYSIS
370
+
371
+ # G.1 VISUAL SIMILARITY ANALYSIS
372
+
373
+ In Figure 7, we provide initial analysis on the categories where the $\mathrm { { C u P L } }$ algorithm improves the most over standard hand-written prompts. We find that the improvement is not uniformly distributed, but rather some classes see a large improvement, while others see a decrease in per class accuracy. Interestingly, there are often two similar categories where one sees a large increase in accuracy and the other sees a decrease. For example, the ‘mushroom’ class has an approximately $4 0 \mathrm { p p }$ increase, while ‘agaric’ (a subclass of mushroom) is one of the classes with the largest drop in accuracy.
374
+
375
+ In order to better understand this phenomenon, we examine the change in accuracy between $\mathrm { C u P L }$ and the standard method of prompting in the image embedding space. Thus we are able to visualize the close relationship between categories like ‘agaric’ and ‘mushroom’. In order to be able to visualize the high dimensional CLIP image embedding in two dimensions, we utilize the t-distributed stochastic neighbor embedding algorithm (Van der Maaten & Hinton, 2008). Figure 8 visualizes image features (reduced into two dimensions) in relation to CuPL improvement.
376
+
377
+ As was suggested by Figure 7, we see in Figure 8 that when there is a class that has a large increase in accuracy with CuPL prompts (‘mushroom’, ‘graduation cap’, ‘monitor’) there is often a decrease in class accuracy for a visually related class. This means that when choosing between two similar or co-occuring classes, CuPL has a different distribution of classification than the standard method (e.g. the standard method prefers ‘canoe’ over ‘paddle’ much more strongly than CuPL). This suggests that the overall accuracy improvement of CuPL over the standard method may come (at least in part) from better distinguishing between two visually similar classes. While it may be over-correcting from the mistakes of the standard method (as demonstrated by the drop in accuracy in one of the two similar classes), the CuPL predictions appear to be overall more accurate, as demonstrated by the overall higher accuracy.
378
+
379
+ # G.2 CO-OCCURRENCES BETWEEN OBJECTS
380
+
381
+ Many of the frequently confused pairs in Figure 8 are objects that are likely to occur in an image (i.e. ‘canoe’-‘paddle’ or ’graduation cap’-‘academic gown’ or ’monitor’-‘desk’). One potential benefit of CuPL captions is that they are able to capture co-occurrences as well. For example, one CuPL prompt for the ‘canoe’ class is A canoe is typically a narrow boat with pointed ends that is propelled with a paddle. This caption contains the word ‘paddle’ which is frequently confused with ‘canoe’ and likely to be present in images, even where the correct label is ‘canoe’. We therefore investigate the effectiveness of CuPL captions on images which contain more than one ImageNet object.
382
+
383
+ We attain this by using the ImageNet-ReaL dataset (Beyer et al., 2020) which relabels ImageNet images with all applicable labels, so an image with both a ‘canoe’ and a ‘paddle’ would have both
384
+
385
+ # Image Embedding vs CuPL improvement
386
+
387
+ ![](images/a7df4c5d1fadec3e954f095e0a30de9ec48244c47ceb9633e46e7db060ce85a2.jpg)
388
+ Figure 8: Visualizing of image embedding of ImageNet classes compared to $\mathbf { C u P L }$ improvement on that class. Each point on this figure represents the average image embedding of an ImageNet class, which has been reduced to two dimentions using t-sne (Van der Maaten & Hinton, 2008). We see that when there is a class with a large improvement compared to the baseline, it is often visually similar to a class which has a decrease in accuracy. This suggests that CuPL’s improved accuracy may be due in part to an increased ability to distinguish similar classes compared to the baseline.
389
+
390
+ labels. We then tag images as having multiple ImageNet objects or only one ImageNet object based on the ReaL dataset. Finally, we compute ImageNet accuracy across each of these two sets (using standard ImageNet labels). Results are given in Table 7.
391
+
392
+ Table 7: Standard versus CuPL accuracy based on number of ImageNet classes present in image. We use the ImageNet-ReaL dataset (Beyer et al., 2020) to find images which have more than one applicable ImageNet label. We then present the accuracy for standard prompts and $\mathrm { C u P L }$ prompts using standard ImageNet labels, split by images which contain only one possible ImageNet class and images which may contain multiple classes.
393
+
394
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>One class present (85.1% of ims)</td><td rowspan=1 colspan=1>Multiple classes present (14.9% of ims)</td></tr><tr><td rowspan=1 colspan=1>Standard</td><td rowspan=1 colspan=1>79.89</td><td rowspan=1 colspan=1>51.59</td></tr><tr><td rowspan=1 colspan=1>CuPL</td><td rowspan=1 colspan=1>80.79</td><td rowspan=1 colspan=1>53.58</td></tr></table>
395
+
396
+ # H ERROR ANALYSIS
397
+
398
+ In Figure 9, we present an error analysis of our model using two different metrics. The first is an analysis between the model prediction and the correct class using the visual similarity of these labels. To capture this, we first attain an average visual embedding of each class by taking the mean of each image in that class and then normalizing that mean. Then for each class we rank how similar each of the other 999 classes are by the distance between these embeddings. If the models makes an incorrect prediction, but it predicts the class with the closest embedding to the correct label, then we refer to this as an image offset of 1.
399
+
400
+ Additionally, we examine the prediction errors in terms of the linguistic similarity of the labels. We do this with the WordNet (Miller, 1995) similarity of two labels. For example, if the label of the prediction and the ground-truth label share the same parent in the WordNet tree, that is a WordNet offset of 2.
401
+
402
+ While slight, there is a difference in the errors made by CuPL compared to the errors made by the baseline as shown in Figure 9. CuPL is more likely to have an error that has an image offset of 1 than the baseline. However, the baseline is more likely to have an error that has a WordNet offset of 1 than CuPL. This implies that CuPL may be taking advantage of the visually descriptive language of the captions, as even when the model makes errors, they tend to favor categories that are visually similar to the ground truth. However, the baseline method does not have visual descriptions in its Image-prompts which may lead to its errors aligning more linguistically with the ground-truth.
403
+
404
+ ![](images/474bd93d7d1cb89c6d066da6d8426ed282d9fffb3d39648a95712ea72a19b243.jpg)
405
+ Figure 9: Error analysis of $\mathbf { C u P L }$ and baseline comparing models errors visually and linguistically to ground truth labels. We compare the errors made by $\mathrm { { C u P L } }$ to the errors made by the baseline methods. We find that the errors made by $\mathrm { C u P L }$ are more likely to be the most visually similar class to the ground truth label when compared to the errors made by the baseline. However, the errors made by the baseline are more likely to be the most linguistically similar class according to the WordNet (Miller, 1995) heirarchy. This suggests that visual information is being extracted from the CuPL descriptions to make visually consistent predictions.
406
+
407
+ ![](images/09c49d31d88d74d0ab0121cdb7742d5d17e3fb0ce1da41f588c9a2bd52fd4e5c.jpg)
408
+ TSNE of text embeddings of Image-prompts generated by different LLM-prompts
409
+ Figure 10: Visualization of embeddings of Image-prompts generated with various LLMprompts. Each point represents the image embedding of one Image-prompts for the stated category with has been reduced to two dimensions using t-sne (Van der Maaten & Hinton, 2008). Imageprompts with the same color are generated by the same LLM-prompts.
410
+
411
+ # I IMAGE-PROMPT DISTRIBUTION
412
+
413
+ When generating Image-prompts, we use an ensemble of prompts generated by different LLMprompts (e.g. ‘What does a $\{ \}$ look like?). As we find that the diversity of Image-prompts is correlated with accuracy, it is valuable to understand how different LLM-prompts affect the diversity of Image-prompts. To accomplish this, we visualize the text embedding of Image-prompts for a selection of classes using t-sne (Van der Maaten & Hinton, 2008) dimension reduction. We then color Image-prompts that were generated by the same LLM-prompt. As shown in Figure 10, we find that while there is a slight clustering of Image-prompts by LLM-prompts, there is also a large amount of overlap.
414
+
415
+ # J TEMPERATURE ANALYSIS
416
+
417
+ We provide several further analyses of the effect of temperature in prompt generation. First, we visualize the distribution of Image-prompts that have been generated with a variety of different temperatures. We do this by selecting prompts for 3 different ImageNet classes at 3 different temperatures. We then perform dimentionality reduction on the text embeddings of these prompts in order to visualize their distribution. As shown in Figure 11, Image-prompts generated with a temperature of 0.1 are clustered in a few different locations. Image-prompts generated with a temperature of 0.5 are more widely, and Image-prompts generated with a temperature of 0.9 have a similar, but even wider distribution.
418
+
419
+ Additionally in Section K, we give all generated prompts for the ImageNet class ‘Tench’ at three different temperatures. At the lowest temperature, the generated Image-prompts are nearly identical when generated with the same LLM-prompts. As the temperature increases, so does the difference in the generated prompts.
420
+
421
+ ![](images/0a4a77925f37cfa3fa317cb1c6b2610abbe2c1378129efb22ba9ed7728f489c0.jpg)
422
+ Figure 11: Visualization of embeddings of Image-prompts generated with various temperatures. Each point represents the image embedding of one Image-prompts for the stated category with has been reduced to two dimensions using t-sne (Van der Maaten & Hinton, 2008). Prompts generated with a higher temperature cover a wider distribution.
423
+
424
+ # K EXAMPLE GENERATED IMAGE-PROMPTS
425
+
426
+ A selection of LLM-generated image-prompts for a subset of ImageNet categories. We give all 50 image-prompts for the first ImageNet category of “Tench” and then 10 randomly selected prompts for a number of randomly selected ImageNet categories.
427
+
428
+ # K.1 ALL GENERATED IMAGE-PROMPTS FOR “TENCH” CATEGORY
429
+
430
+ # Temperature $\mathbf { \mu = 0 . 9 9 }$
431
+
432
+ "A tench is a freshwater fish of the carp family.",
433
+ "A tench is a freshwater fish that is typically brown or olive in
434
+ color.",
435
+ "A tench is a fresh water fish that can grow up to 2 feet in length.",
436
+ "A tench is a freshwater fish of the family Cyprinidae.",
437
+ "A tench is a freshwater fish of the carp family.",
438
+ "A tench is a freshwater fish with a dark green back and light-colored
439
+ sides.",
440
+ "Tench are a freshwater fish found in Europe.",
441
+ "A tench is a small freshwater fish in the carp family.",
442
+ "A tench is a heavyset freshwater fish with a mottled brown body and a
443
+ small, flat head.",
444
+ "A tench is a freshwater fish that looks similar to a carp.",
445
+ "A tench is a freshwater fish in the carp family.",
446
+ "A tench is a freshwater fish of the Cyprinidae family.",
447
+ "The tench is a freshwater fish of the Cyprinidae family.",
448
+ "The tench is a fresh-water fish in the family Cyprinidae.",
449
+ "The easiest way to identify a tench is by its herringbone-patterned
450
+ scales.",
451
+ "A tench is a freshwater fish of the carp family.",
452
+ "Tench are a freshwater fish found in Europe.",
453
+ "Tench have a large, slimy body with scales that have a green hue.",
454
+ "The tench is a freshwater fish belonging to the carp family.",
455
+ "A tench is a freshwater fish of the Cynoglossidae family.",
456
+ "A tench is a freshwater fish in the carp family.",
457
+ "Tensch are freshwater fish with Olive Green backs, shading to Yellowish
458
+ on the sides.",
459
+ "A tench looks like a green freshwater fish with a brownish hue.",
460
+ "A tench looks like a freshwater fish with a dark olive-green back,
461
+ fading to yellowish-brown on the sides.",
462
+ "A tench usually has olive-green skin with dark spots, and a
463
+ orange-yellow underbelly.",
464
+ "Tench are a freshwater fish that can grow up to $7 0 \mathrm { c m }$ long! They have
465
+ olive-brown skin with dark spots, and their meat is white and firm.",
466
+ "A tench is a freshwater fish with a sturdy body and a greenish-brown
467
+ coloration.",
468
+ "A tench is a freshwater fish that can grow up to about two feet long.",
469
+ "A tench is a freshwater fish in the carp family.",
470
+ "A tench is a large, freshwater fish with a thick body and large head.",
471
+ "The image is of a tench fish swimming in water.",
472
+ "The image is of a tench fish swimming in a pond.",
473
+ "The tench is a freshwater fish native to Europe.",
474
+ "This image shows a large, dark green tench swimming in a pond.",
475
+ "An image of a tench from the internet would likely show a dark green
476
+ fish with a lighter underside.",
477
+ "The image is of a tench fish.",
478
+ "The image is of a tench fish on a white background.",
479
+ "A tench is a freshwater fish of the Cyprinidae family.",
480
+ "The image is of a tench swimming in a murky pond.",
481
+ "In the image, a tench swims in a pond with lily pads.",
482
+ " A tench in a river.",
483
+ "A tench (Tinca tinca) is a freshwater fish in the carp family that is
484
+ found throughout Europe.",
485
+ " Tench (Tinca tinca), a member of the carp family (Cyprinidae), native
486
+ to Eurasia.",
487
+ " A tench, a freshwater fish in the family Cyprinidae.",
488
+ " The tench (Tinca tinca) is a freshwater fish of the cyprinid family
489
+ found throughout Eurasia.",
490
+ " A tench in a Finnish lake.",
491
+ "A tench (Tinca tinca) is a freshwater fish belonging to the carp family
492
+ (Cyprinidae).",
493
+ "A tench in a fishpond.",
494
+ " The common tench is a freshwater fish of the cyprinid family found
495
+ throughout Eurasia.",
496
+ "Tench (Tinca tinca) in a pond."
497
+
498
+ # Temperature $\mathbf { \tau } = \mathbf { 0 . 5 }$
499
+
500
+ "A tench is a freshwater fish that is typically greenish-brown in color with a brassy sheen.",
501
+
502
+ "A tench is a freshwater fish that typically has a dark green back, light brown sides, and a white belly.",
503
+
504
+ "A tench is a freshwater fish that can grow up to two feet long.", "Tench are a freshwater fish found in Europe.",
505
+
506
+ "A tench is a freshwater fish that is typically olive green in color with
507
+ dark spots.",
508
+ "A tench is a freshwater fish that is typically olive green in color with
509
+ a brownish tint.",
510
+ "A tench is a freshwater fish of the Cyprinidae family.",
511
+ "Tench are a freshwater fish found in Europe.",
512
+ "A tench is a freshwater fish that has a dark green back, light brown
513
+ sides, and a white belly.",
514
+ "A tench is a freshwater fish that is typically olive-green in color with
515
+ a brownish dorsal fin.",
516
+ "A tench is a freshwater fish of the cyprinid family.",
517
+ "A tench is a freshwater fish of the carp family.",
518
+ "A tench is a freshwater fish that is typically olive green in color with
519
+ a brownish back.",
520
+ "The tench is a freshwater fish of the carp family Cyprinidae.",
521
+ "A tench is a freshwater fish that is typically greenish-brown in
522
+ color.",
523
+ "A tench is a freshwater fish of the carp family.",
524
+ "A tench is a freshwater fish of the carp family.",
525
+ "Tench have olive green backs and flanks, with yellowish bellies.",
526
+ "A tench is a freshwater fish of the carp family.",
527
+ "A tench is a freshwater fish of the cyprinid family.",
528
+ "A tench is a freshwater fish that can grow up to 30 inches long.",
529
+ "A tench is a freshwater fish that is typically greenish-brown in
530
+ color.",
531
+ "A tench is a freshwater fish that can grow up to about two feet long.",
532
+ "A tench is a freshwater fish with a brownish-green back and sides, and a
533
+ yellowish-brown belly.",
534
+ "A tench is a freshwater fish that can grow up to two feet long.",
535
+ "A tench is a freshwater fish that looks similar to a carp.",
536
+ "A tench is a freshwater fish that is typically greenish-brown in
537
+ color.",
538
+ "A tench is a freshwater fish that is part of the carp family.",
539
+ "A tench is a freshwater fish of the cyprinid family.",
540
+ "A tench is a freshwater fish that can grow up to two feet long.",
541
+ "The image is of a tench fish swimming in water.",
542
+ "The image is of a tench fish swimming in a pond.",
543
+ "The image is of a tench fish swimming in a pond.",
544
+ "The image is of a tench fish swimming in a pond.",
545
+ "The image is of a tench fish swimming in a pond.",
546
+ "In the image, a tench is swimming in a pond with lily pads.",
547
+ "The image is of a tench fish swimming in a pond.",
548
+ "The image is of a tench fish swimming in a pond.",
549
+ "The image is of a tench fish swimming in a pond.",
550
+ "The image is of a tench fish swimming in a pond.",
551
+ "A tench fish, native to Europe, characterized by its greenish-brown
552
+ color and spots.",
553
+ " A tench (Tinca tinca) in a pond.",
554
+ "A tench (Tinca tinca) is a freshwater fish belonging to the carp family
555
+ (Cyprinidae).",
556
+ "A tench (Tinca tinca) is a freshwater fish in the carp family.",
557
+ "A tench (Tinca tinca) is a freshwater fish in the carp family
558
+ (Cyprinidae).",
559
+ " A tench in a river.",
560
+ "A tench (Tinca tinca) is a freshwater fish in the carp family
561
+ (Cyprinidae).",
562
+ "A tench (Tinca tinca) in a pond.",
563
+ " A tench (Tinca tinca) in a garden pond.",
564
+ " A tench in a river."
565
+
566
+ # Temperature $\mathbf { \mu } = \mathbf { 0 . 1 }$
567
+
568
+ "A tench is a freshwater fish that is typically olive green in color with dark spots.",
569
+
570
+ "A tench is a freshwater fish that can grow up to 30 inches long.",
571
+ "A tench is a freshwater fish that can grow to a length of over two
572
+ feet.",
573
+ "A tench is a freshwater fish that can grow up to two feet long.",
574
+ "A tench is a freshwater fish that can grow up to two feet long.",
575
+ "A tench is a freshwater fish that is typically olive green in color with
576
+ dark spots.",
577
+ "A tench is a freshwater fish that can grow up to two feet long.",
578
+ "A tench is a freshwater fish that can grow up to two feet long.",
579
+ "A tench is a freshwater fish that can grow up to two feet long.",
580
+ "A tench is a freshwater fish that is typically olive green in color with
581
+ dark spots.",
582
+ "A tench is a freshwater fish of the carp family.",
583
+ "A tench is a freshwater fish of the carp family.",
584
+ "A tench is a freshwater fish of the carp family.",
585
+ "A tench is a freshwater fish of the carp family.",
586
+ "A tench is a freshwater fish of the carp family.",
587
+ "A tench is a freshwater fish of the carp family.",
588
+ "Tench have a dark green back, light olive sides, and a yellowish
589
+ belly.",
590
+ "A tench is a freshwater fish of the carp family.",
591
+ "A tench is a freshwater fish of the carp family.",
592
+ "A tench is a freshwater fish of the carp family.",
593
+ "A tench is a freshwater fish that can grow up to two feet long.",
594
+ "A tench is a freshwater fish that can grow up to two feet long.",
595
+ "A tench is a freshwater fish that can grow up to two feet long.",
596
+ "A tench is a freshwater fish that can grow up to two feet long.",
597
+ "A tench is a freshwater fish that is typically olive green in color with
598
+ a brownish dorsal side.",
599
+ "A tench is a freshwater fish that can grow up to two feet long.",
600
+ "A tench is a freshwater fish that can grow up to two feet long.",
601
+ "A tench is a freshwater fish that is typically olive green in color with
602
+ a brownish dorsal side.",
603
+ "A tench is a freshwater fish that can grow up to two feet long.",
604
+ "A tench is a freshwater fish that can grow up to two feet long.",
605
+ "The image is of a tench fish swimming in a pond.",
606
+ "The image is of a tench fish swimming in a pond.",
607
+ "The image is of a tench fish swimming in a pond.",
608
+ "The image is of a tench fish swimming in a pond.",
609
+ "The image is of a tench fish swimming in a pond.",
610
+ "The image is of a tench fish swimming in a pond.",
611
+ "The image is of a tench fish swimming in a pond.",
612
+ "The image is of a tench fish swimming in a pond.",
613
+ "The image is of a tench fish swimming in a pond.",
614
+ "The image is of a tench fish swimming in a pond.",
615
+ "A tench (Tinca tinca) is a freshwater fish in the carp family.",
616
+ "A tench (Tinca tinca) is a freshwater fish of the carp family
617
+ (Cyprinidae).",
618
+ "A tench (Tinca tinca) is a freshwater fish in the carp family.",
619
+ "A tench (Tinca tinca) is a freshwater fish in the carp family.",
620
+ "A tench (Tinca tinca) is a freshwater fish in the carp family.",
621
+ "A tench (Tinca tinca) is a freshwater fish in the carp family.",
622
+ "A tench (Tinca tinca) is a freshwater fish in the carp family.",
623
+ " A tench (Tinca tinca) in a garden pond.",
624
+ " A tench (Tinca tinca) in a garden pond.",
625
+ "A tench (Tinca tinca) is a freshwater fish of the carp family
626
+ (Cyprinidae)."
627
+
628
+ # K.2 SAMPLE GENERATED IMAGE-PROMPTS FOR RANDOMLY SELECTED IMAGENET CATEGORIES
629
+
630
+ "bubble":
631
+
632
+ "A bubble is a sustained period of inflated asset prices.",
633
+
634
+ "A bubble looks like a sphere of air.",
635
+ "A bubble is often characterized by rapidly increasing prices in an asset
636
+ or security, followed by a sharp decrease in prices.",
637
+ "A bubble looks like a small, round, thin film of soap filled with air.",
638
+ "A bubble looks like a round sphere of soap film.",
639
+ " \"A bubble being blown in the park.",
640
+ "A close-up of a soap bubble with a thin film of water in between two
641
+ layers of air.",
642
+ "A bubble is a spherical shape made up of a thin film of soap water.",
643
+ "A bubble is a circle of air surrounded by water.",
644
+ "A bubble looks like a round, thin layer of soap surrounding a pocket of
645
+ air."
646
+
647
+ # "kit fox":
648
+
649
+ "A kit fox is a small species of fox, about the size of a domestic cat.",
650
+ "You can identify a kit fox by its small size, its big ears, and its
651
+ long, bushy tail.",
652
+ " A kit fox laying on the ground in a desert habitat.",
653
+ "A kit fox is a small fox found in North America.",
654
+ "A kit fox is a small fox with a sleek coat of fur.",
655
+ "A kit fox is a small fox with large ears, a long, black-tipped tail, and
656
+ pale fur.",
657
+ "A kit fox has a reddish coat, with white patches on its chest and
658
+ throat.",
659
+ "This kit fox has a reddish coat and large ears.",
660
+ "A kit fox looks like a small fox with a pointed nose, large ears, and a
661
+ long, bushy tail.",
662
+ "A kit fox is a small species of fox."
663
+ "toy terrier":
664
+ "A toy terrier looks like a very small version of a terrier.",
665
+ "The image is of a toy terrier that is mostly white with brown spots.",
666
+ "You can identify a toy terrier by looking for a compact, short-legged
667
+ dog with a short muzzle.",
668
+ " Cute little guy.",
669
+ "Toy terriers are miniature versions of terriers, such as the Jack
670
+ Russell Terrier.",
671
+ "A toy terrier is a small, lightweight breed of dog.",
672
+ "The image is of a small, brown toy terrier.",
673
+ "A toy terrier typically has a long, narrow head with pointy ears, and a
674
+ small, compact body.",
675
+ "A toy terrier is a small, short-legged dog with a long body, pointy
676
+ nose, and large ears.",
677
+ "A small, brown and white toy terrier is sitting on a beige couch,
678
+ looking at the camera."
679
+
680
+ "mousetrap":
681
+
682
+ "In the image, there is a mousetrap made of wood and metal.",
683
+ "An image of a mousetrap from the internet would most likely show a
684
+ traditional wooden mousetrap with a metal spring.",
685
+ "A mousetrap is a device made to catch and kill mice.",
686
+ "A mousetrap is a small device that is used to catch mice.",
687
+ "The classic mousetrap consists of a wooden base with a metal spring
688
+ mounted on one end.",
689
+ "The mousetrap is a small wooden box with a metal spring inside.",
690
+ "The mousetrap is a simple device that has been used for centuries to
691
+ catch mice.",
692
+ "The classic mousetrap - simple, effective, and deadly.",
693
+ "The most common way to identify a mousetrap is by its small size and
694
+ rectangular shape.",
695
+ "A mousetrap typically has a wire or wooden frame that is baited with
696
+ food and springs open quickly to snap shut on the mouse when it attempts
697
+ to steal the bait."
698
+ "A dog sled is a vehicle on runners, typically with a thin frame and
699
+ a flat bottom, that is used to convey goods or passengers over snow or
700
+ ice.",
701
+ "A dog sled is a toboggan pulled by dogs, typically over snow.",
702
+ "A dog sled looks like a bed on runners that is pulled by dogs.",
703
+ "A dog sled is typically a heavy frame on runners that is pulled by one
704
+ or more dogs.",
705
+ "A dog sled is traditionally a sled pulled by dogs, used for
706
+ transportation, racing, or other purposes.",
707
+ " teamA dog sled team is a group of dogs that are harnessed together to
708
+ pull a sled.",
709
+ "A dog sled looks like a small, open vehicle that is pulled by one or
710
+ more dogs.",
711
+ "Dog sledding in winter.",
712
+ " pulled by huskiesThe image is of a dog sled pulled by huskies.",
713
+ "A dog sled looks like a large cart that is pulled by a team of dogs."
714
+
715
+ # "geyser":
716
+
717
+ "A geyser is a hot spring that periodically erupts, shooting a column of
718
+ water and steam into the air.",
719
+ "A geyser looks like a hole in the ground that sometimes spurts hot water
720
+ and steam into the air.",
721
+ "Geysers are hot springs that periodically spout water and steam into the
722
+ air.",
723
+ "The image is of a geyser erupting.",
724
+ "A geyser is a hot spring that periodically erupts, spraying water into
725
+ the air.",
726
+ "A geyser typically looks like a cone of rocks with a small hole at the
727
+ top.",
728
+ "A geyser is a hot spring where water intermittently boils, sending a jet
729
+ of hot water and steam into the air.",
730
+ "A geyser is a hot spring that periodically shoots a stream of hot water
731
+ and steam into the air.",
732
+ "The image is of a geyser shooting water high into the air.",
733
+ "A geyser looks like a column of water that shoots into the air and then
734
+ falls back down."
735
+
736
+ "Schipperke":
737
+
738
+ "A Schipperke is a small, Belgian breed of dog.",
739
+ "A Schipperke is a small black Belgian dog with a rat-like tail.",
740
+ "The image is of a black and white dog with pointy ears and a long
741
+ body.",
742
+ "A Schipperke is a small, black, Belgian breed of dog.",
743
+ "A Schipperke is a small, black, Belgian breed of dog that closely
744
+ resembles a fox.",
745
+ "A Schipperke is a small Belgian breed of dog that resembles a fox.",
746
+ "Schipperkes have a long, black coat and a pointed muzzle.",
747
+ "A Schipperke is a small dog breed with a fox-like appearance.","It’s a photo of a black and tan Schipperke dog standing in front of a
748
+ brick wall.",
749
+ "Black, small, spitz-type dog with a long, fox-like snout, large erect
750
+ ears, and a long, high-set tail."
751
+
752
+ "go-kart":
753
+
754
+ "A go-kart typically looks like a small car or buggy with a small engine
755
+ in the back.",
756
+ "A go-kart is a small vehicle with four wheels, a steering wheel, and a
757
+ gas pedal.",
758
+ "A go-kart is a small vehicle with a steering wheel, pedals, and an
759
+ engine.",
760
+ "Two young girls in go-karts race down a path in a park.",
761
+ "A go-kart is a small, lightweight vehicle with four wheels and a simple,
762
+ open frame.",
763
+ "A go-kart is a small, open-wheeled vehicle used for racing.",
764
+ "Two kids racing go-karts on a dirt track.",
765
+ "A go-kart is a small, racing car.",
766
+ "A go-kart typically looks like a small, open-wheeled car.",
767
+ "A go-kart is a small, lightweight vehicle with four wheels that is
768
+ propelled by a small engine."
769
+
770
+ "black-and-white colobus":
771
+
772
+ "The Black-and-White Colobus is a type of Old World monkey, found in
773
+ Africa.",
774
+ "A black-and-white colobus has long black fur, and a white face with a
775
+ black triangle around the eyes.",
776
+ "Colobus Monkey in the TreesThis elegant colobus monkey is swinging
777
+ through the trees in search of food.",
778
+ " monkeyIn this image, a black-and-white colobus monkey is shown perched
779
+ atop a tree branch.",
780
+ "The black-and-white colobus monkey is one of the most beautiful and
781
+ distinctive of all the colobus monkeys.",
782
+ "The black-and-white colobus monkey is a species of primate in the
783
+ Colobidae family.",
784
+ "Colobus monkeys are generally black with white patches on their face,
785
+ back, and sides.",
786
+ "The black-and-white colobus is a species of Old World monkey.",
787
+ " monkeyThe image is of a black-and-white colobus monkey sitting on a
788
+ tree branch.",
789
+ " monkeyIn the image, the black-and-white colobus monkey is sitting in a
790
+ tree."
791
+
792
+ # "sock":
793
+
794
+ "A sock usually has a cuff at the top, and a heel at the bottom.",
795
+ " A black sock with a white line running down the middle.",
796
+ "A sock is typically a garment worn on the feet and made from a soft
797
+ material, such as cotton.",
798
+ "A sock normally has a heel, toe and a cuff at the top.",
799
+ "A sock is a small amount of money that is given to someone without them
800
+ knowing.",
801
+ "A sock is an article of clothing worn on the feet.",
802
+ "A sock is a piece of clothing that is worn on the feet.",
803
+ "A sock is a tubular garment that covers the foot and ankle.",
804
+ "This image is of a blue and white striped sock.",
805
+ "There are many ways that you can identify a sock."
806
+
807
+ "Cocker Spaniel":
808
+
809
+ "A Cocker Spaniel is a medium sized dog with long, floppy ears, and a
810
+ silky coat that is usually either brown or black.",
811
+ "The Cocker Spaniel has a long floppy ears, a silky coat, and a bushy
812
+ tail.",
813
+ "A Cocker Spaniel has a long, black muzzle and big, brown eyes.",
814
+ "The Cocker Spaniel is a breed of dog.",
815
+ "An image of a Cocker Spaniel from the internet shows a small brown and
816
+ white dog with long floppy ears.",
817
+ "The image is of a Cocker Spaniel with short, brown fur and long, floppy
818
+ ears.",
819
+ "Cocker spaniels have long, floppy ears and a long, silky coat.",
820
+ "A Cocker Spaniel is a small to medium sized dog.",
821
+ "The image is of a light brown and white Cocker Spaniel standing on a
822
+ green grassy field with its head turned to the side.",
823
+ "A Cocker Spaniel has a long, silky coat that is usually either black,
824
+ brown, or golden."
825
+
826
+ "southern black widow":
827
+
828
+ "A southern black widow spider perched atop a web.",
829
+ "Female southern black widows have a black body with a red hourglass
830
+ shape on their abdomen.",
831
+ "The southern black widow is black with a red hourglass shape on its
832
+ belly.",
833
+ "Female southern black widow spiders are black with a characteristic red
834
+ hourglass-shaped mark on their ventral abdomen.",
835
+ " spiderThe image is of a large, black spider with a red hourglass shape
836
+ on its abdomen.",
837
+ "A southern black widow is a spider that is black with a red hourglass
838
+ shape on its abdomen.",
839
+ "A southern black widow spider is a small, black spider with a red
840
+ hourglass-shaped mark on its underside.",
841
+ "There’s an image on the internet of a southern black widow that’s really
842
+ cool.",
843
+ "A southern black widow can be identified by its black coloration with a
844
+ red hourglass shape on its abdomen.",
845
+ "A Southern black widow is a type of spider that is black with a red
846
+ hourglass shape on its belly."
847
+
848
+ # "catamaran":
849
+
850
+ "A catamaran is a sailboat that has two hulls, or wide bodies, that are
851
+ connected by beams.",
852
+ "The easiest way to identify a catamaran is by its two hulls.",
853
+ "A catamaran is a type of boat that has two parallel hulls.",
854
+ "A catamaran is a multi-hulled vessel with two parallel hulls of equal
855
+ size.",
856
+ "My dream boat! A sleek catamaran that can zip through the waves.",
857
+ "A catamaran is a multi-hulled vessel with two parallel hulls of equal
858
+ size.",
859
+ "The image is of a white catamaran with blue trim.",
860
+ "A catamaran is a type of boat that has two hulls, or platforms, that are
861
+ parallel to each other.",
862
+ "The image is of a yellow catamaran with white trim, sitting in calm
863
+ water.",
864
+ "A catamaran is a type of sailing vessel that consists of two parallel
865
+ hulls of equal size."
866
+
867
+ "beach":
868
+
869
+ ".",
870
+ "Blue skies, white sands, and clear turquoise waters make this beach a
871
+ paradise.",
872
+ "A beach usually has sand and water.",
873
+ "Beach identification can be accomplished through the identification of
874
+ physical characteristics.",
875
+ "A beach is a naturally occurring feature of the landscape.",
876
+ "The sun sets over the ocean, casting a beautiful orange hue in the
877
+ sky.",
878
+ "A beach is a large body of water with sand or small rocks at the
879
+ shore.",
880
+ "In the image, the beach is Brilliant white with crystal blue waters.",
881
+ "The beach looks like a long strip of land next to the ocean.",
882
+ "A beach typically looks like a large, flat expanse of sand with some
883
+ rocks or other natural features nearby."
884
+
885
+ "rotary dial telephone":
886
+
887
+ "A rotary dial is a device used to dial telephone numbers.",
888
+ "Rotary dial telephone from the mid-20th century.",
889
+ "A rotary dial telephone is a phone with a circular dial on the front
890
+ face.",
891
+ "When looking at a rotary telephone, you can tell it is a rotary phone by
892
+ the Place the phone’s receiver on your ear and listen for a dial tone.",
893
+ "A rotary dial phone is an older model phone that has a circular device
894
+ with numbers on it that you rotate with your finger to dial a number.",
895
+ "A rotary dial telephone is a type of telephone that uses a mechanical
896
+ dial to select the telephone number that a user wishes to call.",
897
+ "History of the Rotary Dial Telephone.",
898
+ "A rotary dial telephone is an old-fashioned telephone that has a round
899
+ dial on the front of it.",
parse/dev/3ly9cG9Ql9h/3ly9cG9Ql9h_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3ly9cG9Ql9h/3ly9cG9Ql9h_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3ly9cG9Ql9h/3ly9cG9Ql9h_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/4G1Sfp_1sz7/4G1Sfp_1sz7.md ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generating Training Data with Language Models: Towards Zero-Shot Language Understanding
2
+
3
+ Yu Meng, Jiaxin Huang, Yu Zhang, Jiawei Han Department of Computer Science, University of Illinois at Urbana-Champaign {yumeng5,jiaxinh3,yuz9,hanj}@illinois.edu
4
+
5
+ # Abstract
6
+
7
+ Pretrained language models (PLMs) have demonstrated remarkable performance in various natural language processing tasks: Unidirectional PLMs (e.g., GPT) are well known for their superior text generation capabilities; bidirectional PLMs (e.g., BERT) have been the prominent choice for natural language understanding (NLU) tasks. While both types of models have achieved promising few-shot learning performance, their potential for zero-shot learning has been underexplored. In this paper, we present a simple approach that uses both types of PLMs for fully zero-shot learning of NLU tasks without requiring any task-specific data: A unidirectional PLM generates class-conditioned texts guided by prompts, which are used as the training data for fine-tuning a bidirectional PLM. With quality training data selected based on the generation probability and regularization techniques (label smoothing and temporal ensembling) applied to the fine-tuning stage for better generalization and stability, our approach demonstrates strong performance across seven classification tasks of the GLUE benchmark (e.g., 72.3/73.8 on MNLI- $. \mathrm { m } / \mathrm { m m }$ and 92.8 on SST-2), significantly outperforming zero-shot prompting methods and achieving even comparable results to strong few-shot approaches using 32 training samples per class1.
8
+
9
+ # 1 Introduction
10
+
11
+ Pretrained language models (PLMs) [5, 8, 11, 19, 34, 40, 41] have achieved human-level performance on natural language understanding (NLU) tasks [66, 67] when fine-tuned on a large amount of task-specific training data. However, such a supervised fine-tuning paradigm is drastically different from how humans perform these tasks: We barely need to see many task-specific training samples to perform well. Recently, many studies have revealed the intriguing few-shot learning potential of PLMs: By converting task descriptions to natural language prompts and injecting them into PLMs, prompt-based approaches [5, 13, 55, 56, 59] leverage task-specific information for better training data efficiency and have achieved remarkable few-shot results.
12
+
13
+ When prompt-based methods are applied to the zero-shot setting, however, the PLMs’ predictions are much less accurate. For example, GPT-3’s zero-shot performance is much degraded relative to its few-shot performance [5], especially on challenging tasks like natural language inference (NLI). Without any task-specific samples, it is indeed challenging for PLMs to effectively interpret the prompts that come in different formats and are unseen in the pretraining data. To familiarize PLMs with various prompts for zero-shot generalization to unseen tasks, a recent study proposes instruction tuning [70], which fine-tunes PLMs on a large collection of different tasks described by instructions. Despite its strong performance, its success is grounded in the large number of cross-task annotated datasets (e.g., train on many non-NLI tasks and transfer to NLI tasks) and the gigantic model size (e.g., hundreds of billions of parameters), posing great challenges for training and using them.
14
+
15
+ In this work, we study zero-shot learning of PLMs on NLU tasks without any task-specific or crosstask data. Motivated by the strong text generation power of recent PLMs [5, 23, 30, 52], we propose SuperGen, a Supervision Generation approach, wherein training data are created via a unidirectional PLM (i.e., the generator) which generates class-conditioned texts guided by label-descriptive prompts. A bidirectional PLM (i.e., the classifier) is then fine-tuned on the generated texts to perform the corresponding task. Both PLMs can be of moderate size to fit in typical research hardware (e.g., a GPT-2-sized [51] generator and a RoBERTaLarge-sized [34] classifier). With supervision automatically created by the generator, SuperGen eliminates the need for task-specific annotations and provides the classifier PLM with a larger amount of training data than in few-shot scenarios. We call such a setting zero-shot because the entire process does not need any human annotated data, either from the target task or other tasks. The major difference from previous methods is that we synthesize training data for the target task, whereas existing zeros-shot methods do not use any form of training data from the test domain (but may train on other domains) and directly perform inference on the target task.
16
+
17
+ Across seven classification tasks of the GLUE benchmark [66], SuperGen significantly outperforms the prompt-based zero-shot method and even achieves an overall better result in both average performance and stability than strong few-shot approaches that use 32 annotated samples per class. We identify several key factors to the strong performance of SuperGen through ablation studies: (1) selecting quality training data based on their generated probability, and (2) using label smoothing and temporal ensembling to regularize fine-tuning on generated data.
18
+
19
+ # 2 Related Work
20
+
21
+ # 2.1 Few-Shot and Zero-Shot Learning with PLMs
22
+
23
+ Instead of using a large amount of annotated training data for fine-tuning PLMs on downstream tasks, few-shot learning studies how to better leverage only a small amount of task-specific training data, a more realistic scenario in many applications. The most strict few-shot learning setting does not assume access to any unlabeled data or large validation sets for hyperparameter tuning [48], where prompt-based methods [5, 13, 33, 35, 55–57, 59, 63, 84] are prominently deployed to inject task descriptions into PLMs and make effective use of their language modeling capability for improved training data efficiency in low-data regimes. More broadly, semi-supervised learning additionally leverages unlabeled task-specific data, where data augmentation [7, 73], regularization [43] and bootstrapping [56] methods are commonly used.
24
+
25
+ Zero-shot learning, on the other hand, is a much more challenging setting with absolutely no access to any task-specific data. When prompt-based methods are directly used to obtain predictions from PLMs without any training, their zero-shot performance can be much worse [5, 13]—difficult NLU tasks can be barely formulated as prompts that resemble the format of pretraining data, posing great challenges for PLMs to accurately interpret and leverage the prompts without given any training samples. The current mainstream of zero-shot learning is based on transfer learning: By converting a set of tasks with abundant annotations into instruction templates [42, 54, 70, 74], entailment pairs [79, 80] or question-answer formats [50, 86] and fine-tuning PLMs on them, the PLMs acquire the cross-task transfer ability [78] to execute unseen tasks when they are formulated in a similar format. Our work proposes a different approach from these studies: We use a unidirectional PLM to generate training data for fine-tuning another PLM on the target task. This not only removes the need for a large amount of cross-task annotations, but also eliminates the task difference in training and inference. Moreover, different from previous studies [1, 76] that rely on labeled data to fine-tune the generative PLM, we directly use prompts to guide data generation without fine-tuning.
26
+
27
+ # 2.2 Controlled Text Generation with PLMs
28
+
29
+ Controlled text generation [22] aims to steer the generated texts of language models towards desired contents, styles or domains. Through fine-tuning PLMs on attribute-specific data, high-level control (e.g., generating certain topics or sentiments [88]), fine-grained control (e.g., generating specific words or phrases [6]) or both [24] can be achieved. Adapting PLMs to generate texts of specific attributes can also be realized at inference time without any further training of the PLMs [10, 26, 27, 32, 47, 75]. Different text attributes can also be represented during pretraining time as control codes [23] which later can serve as explicit guidance for generating domain/attribute-specific texts.
30
+
31
+ The idea of generating category-conditioned texts as training data has been explored for topic classification with bag-of-words or LSTM-based language models [38, 39], which may not have enough capacity to generate quality training data for challenging NLU tasks. With more powerful PLMs, the idea of using prompts as guidance has emerged recently: Since natural language generation is largely based on contexts, using certain prompts to start a sequence can effectively steer the subsequent texts to be generated. The prompts can be either in natural language [57] or as learnable parameters [31]. In this work, we also guide text generation via prompts, but for the novel purpose of creating training data for NLU tasks. There have been studies with similar goals, such as generating similar/dissimilar sentences for training sentence embeddings [58] and using labeled samples as demonstrations to prompt large PLMs [81] for creating novel training data. In this work, we explore generating training data without using any labeled samples for a wide range of different NLU tasks. The similar setting is also explored in a concurrent study [77]. Compared to annotated task-specific data, the generated texts may contain noise and have domain difference from the downstream task. We introduce several important strategies for effective fine-tuning on generated data.
32
+
33
+ ![](images/801aec59c9633f7891b483be336be9aeac6c924769ec046dea1586f20d530364.jpg)
34
+ Figure 1: Overview of SuperGen for zero-shot learning of NLU tasks. A unidirectional PLM generates training data guided by label-descriptive prompts. Quality training samples are selected based on average log generation probability. A bidirectional PLM is fine-tuned on the selected training set with label smoothing and temporal ensembling as regularization to perform the classification task.
35
+
36
+ # 3 Method
37
+
38
+ # 3.1 Preliminaries
39
+
40
+ Problem Formulation. We consider solving a classification problem2 where we are only given the label space $\mathcal { V }$ and a mapping $\mathcal { M } : \mathcal { V } \to \mathcal { W }$ that converts each label $y \in \mathcal { V }$ into a label-descriptive prompt (i.e., a short phrase) $\pmb { w } _ { y } \in \mathcal { W }$ . We assume access to a unidirectional PLM $G _ { \theta }$ as the generator and a bidirectional PLM $C _ { \phi }$ which will be fine-tuned as the classifier3. We also assume the pretraining corpus $\mathcal { D }$ (e.g., Wikipedia) is available. Fig. 1 shows an overview of our proposed SuperGen method.
41
+
42
+ Text Generation with Unidirectional PLMs. A unidirectional PLM $G _ { \theta }$ is pretrained to maximize the generation probability of each token in a sequence $\pmb { x } = [ x _ { 1 } , x _ { 2 } , \dots , x _ { n } ]$ conditioned on previous tokens:
43
+
44
+ $$
45
+ \operatorname* { m a x } _ { \theta } \prod _ { i = 1 } ^ { n } p _ { \theta } ( x _ { i } | \pmb { x } _ { < i } ) , \quad \mathrm { w h e r e } \quad p _ { \theta } ( x _ { i } | \pmb { x } _ { < i } ) = \frac { \exp ( e _ { i } ^ { \top } h _ { i } ) } { \sum _ { j = 1 } ^ { | V | } \exp ( e _ { j } ^ { \top } h _ { i } ) } .
46
+ $$
47
+
48
+ Here, $p _ { \theta } ( \cdot )$ is usually parameterized using token embeddings $e$ and contextualized embeddings $^ { h }$ given by a Transformer [65] encoder.
49
+
50
+ After pretraining, $G _ { \theta }$ can be directly used to generate new texts by recursively sampling tokens from its output probability distribution. Typically, a temperature hyperparameter $\tau > 0$ is introduced during sampling [20] to adjust the sharpness of the probability distribution:
51
+
52
+ $$
53
+ p _ { \theta } ( x _ { i } | \pmb { x } _ { < i } ) = \frac { \exp ( \pmb { e } _ { i } ^ { \top } \pmb { h } _ { i } / \tau ) } { \sum _ { j = 1 } ^ { | V | } \exp ( \pmb { e } _ { j } ^ { \top } \pmb { h } _ { i } / \tau ) } ,
54
+ $$
55
+
56
+ where $\tau 0$ approximates greedily picking the most probable next token; $\tau \infty$ induces a uniform distribution. Additionally, sampled tokens can be confined to the top- $k$ most probable ones to avoid low-quality tokens. In this work, we find such top- $k$ sampling with temperature is sufficient to produce coherent and meaningful texts as training data for NLU tasks. Exploring more sophisticated sampling strategies [21] is left for future work.
57
+
58
+ # 3.2 Training Data Generation
59
+
60
+ When given a label-descriptive prompt such as “Write a negative review:”, humans are able to produce texts pertaining to the corresponding class. We aim to leverage the strong text generation power of a unidirectional PLM $G _ { \theta }$ for the same purpose of creating class-conditioned training data. We note that $G _ { \theta }$ is directly used for generation without any parameter updates. The prompts used for different NLU tasks in GLUE are summarized in Table 1.
61
+
62
+ Table 1: Prompts used to generate class-conditioned texts for different GLUE tasks. SST-2 is a singlesequence classification task and the rest are sequencepair classification tasks. Generation for CoLA does not use prompts but by varying sampling temperatures. $\pmb { x } ^ { s }$ denotes a sequence randomly sampled from the pretraining corpus; $\pmb { x } ^ { g }$ denotes the sequence to be generated by $G _ { \theta }$ ; . . . denotes skipping at least one sequence. See Appendix A for more details.
63
+
64
+ Generating Single Sequences. For singlesequence NLU tasks such as sentiment classification (e.g., SST-2), we simply use a prompt ${ \pmb w } _ { y }$ corresponding to label $y$ as the beginning of the sequence and let $G _ { \theta }$ generate the remaining sequence:
65
+
66
+ $$
67
+ \pmb { x } ^ { g } G _ { \theta } ( \pmb { w } _ { y } ) ,
68
+ $$
69
+
70
+ <table><tr><td>Task</td><td>Label</td><td>Prompt</td></tr><tr><td>SST-2</td><td>positive negative</td><td>Rating:5.0xg Rating: 1.0 xg</td></tr><tr><td rowspan="4">MNLI</td><td>entailment</td><td>x.In other words,xg</td></tr><tr><td>neutral</td><td>x.Furthermore,xg</td></tr><tr><td></td><td>There is a rumor that x.</td></tr><tr><td>contradiction</td><td>However, the truth is:x9</td></tr><tr><td rowspan="2">QNLI</td><td>entailment</td><td>x?xg</td></tr><tr><td>not entailment</td><td>x?...g</td></tr><tr><td rowspan="2">RTE</td><td>entailment</td><td>x.In other words,xg</td></tr><tr><td>not entailment</td><td>x.Furthermore,xg</td></tr><tr><td rowspan="2">MRPC</td><td>equivalent</td><td>x.In other words,xg</td></tr><tr><td>not equivalent</td><td>x.Furthermore,xg</td></tr><tr><td rowspan="2">QQP</td><td>equivalent</td><td>x ?In other words,xg</td></tr><tr><td>not equivalent</td><td>x&quot;?Furthermore,xg</td></tr></table>
71
+
72
+ where $G _ { \theta } ( \pmb { w } _ { y } )$ denotes using ${ \pmb w } _ { y }$ as the input to $G _ { \theta }$ and recursively sampling tokens from the distribution in Eq. (1) until a full sequence is generated; $\pmb { x } ^ { g }$ denotes the generated sequence (i.e., excluding the prompt), which will be paired with $y$ to form one training sample $( \bar { \pmb { x } ^ { g } } , y )$ .
73
+
74
+ For syntactic tasks like linguistic acceptabil
75
+ ity classification (e.g., CoLA) which requires generating both linguistically acceptable and unacceptable sequences, we start the sequence with random stop words and use varying sampling temperatures for generating different sequences. A smaller temperature (e.g., $\tau = 0 . 1$ in Equation (1)) sharpens the sampling probability distribution towards the most probable tokens, thus the resulting sequence is more likely to be linguistically acceptable. Using a larger temperature (e.g., $\tau = 1 0$ in Equation (1)) flattens the sampling probability distribution to be more uniform, and the generated tokens will be nearly random, which can create linguistically incorrect sequences.
76
+
77
+ Generating Sequence Pairs. Sequence-pair classification tasks require generating two sequences of specific relationships (e.g., entailment, contradiction). We sample4 the first sequence $\pmb { x } ^ { s }$ from the pretraining corpus $\mathcal { D }$ , concatenate the prompt ${ \pmb w } _ { y }$ with $\pmb { x } ^ { s }$ , and generate the second sequence $\pmb { x } ^ { g }$ :
78
+
79
+ $$
80
+ \pmb { x } ^ { g } G _ { \theta } ( [ \pmb { x } ^ { s } ; \pmb { w } _ { y } ] ) , \pmb { x } ^ { s } \sim \mathcal { D } .
81
+ $$
82
+
83
+ The sequence pair training sample will then be formed as $( \pmb { x } ^ { s } , \pmb { x } ^ { g } , y )$ .
84
+
85
+ Rewarding and Penalizing Repetitions for Sequence Pair Generation. A common issue in text generation is degenerate repetition [21, 23, 51, 71] where generated texts get stuck in repetition loops. To address this issue, one approach is to discourage repetition by reducing the logits of tokens that are already in the sequence before performing sampling [23]. In sequence pair generation, however, it is sometimes desirable to encourage the second sequence to repeat some words in the first sentence (e.g., for generating an entailment or a paraphrase). Therefore, we propose a simple modification of
86
+
87
+ Eq. (1) that rewards/penalizes repetition based on whether the token has appeared in ${ \pmb x } ^ { s } / { \pmb x } ^ { g }$ :
88
+
89
+ $$
90
+ p _ { \theta } ( x _ { i } | \boldsymbol x _ { < i } ) = \frac { \exp ( e _ { i } ^ { \top } h _ { i } / \omega ) } { \sum _ { j = 1 } ^ { | V | } \exp ( e _ { j } ^ { \top } h _ { i } / \omega ) } , \quad \mathrm { w h e r e } \quad \omega = \left\{ \begin{array} { l l } { \tau \alpha } & { x _ { i } \in \boldsymbol x ^ { s } \wedge x _ { i } \not \in \boldsymbol x ^ { g } } \\ { \tau \beta } & { x _ { i } \in \boldsymbol x ^ { g } } \\ { \tau } & { \mathrm { e l s e } } \end{array} \right. ,
91
+ $$
92
+
93
+ and $\alpha > 0 , \beta > 0$ are hyperparameters. By setting $\alpha < 1$ and $\beta > 1$ , we can promote tokens in $\mathbf { \Delta } \mathbf { \mathbf { x } } ^ { s }$ that have not appeared in $\pmb { x } ^ { g }$ to have a higher chance of being generated, and discourage the generation of repetitive tokens in $\pmb { x } ^ { g }$ to mitigate degenerate repetition. The parameters used for different tasks are listed in Appendix B Table 9.
94
+
95
+ # 3.3 Effective Fine-Tuning on Generated Texts
96
+
97
+ With the generated training data, one can fine-tune a bidirectional PLM $C _ { \phi }$ as the classifier to perform the NLU task. However, training $C _ { \phi }$ via standard supervised training on all generated texts is likely to yield suboptimal performance on downstream tasks because (1) the generated texts may contain noise as $G _ { \theta }$ may not always produce texts pertaining to the desired class, especially for challenging sequence pair tasks with subtle semantic relationships; and (2) the generated texts can be considered as originated from the domain of $G _ { \theta }$ ’s pretraining data, with a potentially different distribution from the downstream task; straightforward application of supervised training will result in overfitting to the pretraining domain and diminishing generalization ability, a common challenge in transfer learning [64, 87]. To address these challenges, we next introduce several simple and important strategies for more effective and stable fine-tuning on generated texts.
98
+
99
+ Selecting Quality Training Data. We aim to select generated texts $\pmb { x } ^ { g }$ that are most likely to pertain to the desired label $y$ (i.e., with the highest $p ( \boldsymbol { x } ^ { g } | \boldsymbol { y } ) )$ . The true probability $p ( \pmb { x } ^ { g } | y )$ is unknown and we estimate it via the generation probability given by $G _ { \theta }$ conditioned on the prompt ${ \pmb w } _ { y }$ :
100
+
101
+ $$
102
+ p ( \pmb { x } ^ { g } | y ) \approx p _ { \theta } ( \pmb { x } ^ { g } | \pmb { w } _ { y } ) = \prod _ { i = 1 } ^ { n } p _ { \theta } \left( x _ { i } \big | [ \pmb { w } _ { y } ; \pmb { x } _ { < i } ^ { g } ] \right) .
103
+ $$
104
+
105
+ Since the above measure is biased towards shorter sequences, we instead use the geometric mean of the above conditional generation probability (or equivalently, the average log probability) of all tokens in $\pmb { x } ^ { g }$ as the ranking score, following [82]:
106
+
107
+ $$
108
+ r = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \log p _ { \theta } \left( x _ { i } \middle | [ \pmb { w } _ { y } ; \pmb { x } _ { < i } ^ { g } ] \right) .
109
+ $$
110
+
111
+ To construct a training set consisting of $N$ samples per class, we will generate more samples (e.g., $1 0 N )$ ), and select training data based on the score $r$ in Eq. (3): For all tasks except CoLA, the top- $N$ ones of each class are selected; for CoLA, the top- $N$ ones are used as linguistically acceptable training samples, and the bottom- $N$ ones as linguistically unacceptable sequences.
112
+
113
+ Regularization for Better Generalization and Stability. Even with the above training data selection procedure, the resulting training set may still contain noise and there exists domain difference from the downstream tasks. We apply two regularization techniques, label smoothing [62] and temporal ensembling [28] for better fine-tuning stability and generalization.
114
+
115
+ Given a training sample $( \boldsymbol { x } ^ { g } , \boldsymbol { y } )$ , label smoothing trains the classifier $C _ { \phi }$ to minimize the standard cross-entropy loss between the label and the classifier’s prediction $p _ { \phi } ( \pmb { x } ^ { g } )$ , except that the label is a weighted average of the one-hot vector and a uniform distribution over all labels:
116
+
117
+ $$
118
+ \operatorname* { m i n } _ { \phi } - \sum _ { j = 1 } ^ { | \mathcal { V } | } q _ { j } \log ( p _ { \phi } ( \pmb { x } ^ { g } ) _ { j } ) ,
119
+ $$
120
+
121
+ where $q _ { j } = \mathbb { 1 } ( j = y ) ( 1 - \epsilon ) + \epsilon / | y |$ and $\epsilon$ is the smoothing weight. By forcing the classifier to be less confident on training data, label smoothing improves robustness to label noise [36] and prevents overfitting to the training set [44], thus improving generalization to different domains.
122
+
123
+ The motivation for temporal ensembling is that neural networks usually first pick up easy and general patterns in the data before learning more sophisticated and dataset-specific features [83], and thus the earlier states of the network offer better generalizability to different domains. We therefore record the predictions $\pmb { p } _ { \phi } = p _ { \phi } ( \pmb { x } ^ { g } )$ of $C _ { \phi }$ on each training sample $( \boldsymbol { x } ^ { g } , \boldsymbol { y } )$ at different training steps, and use the accumulated moving-average predictions $\bar { z }$ to regularize the latest model training. This also helps suppress the fluctuation in model predictions due to data noise, offering better noise-robustness [45]. We update ensembled predictions $\bar { z }$ once every $B$ batches:
124
+
125
+ $$
126
+ \hat { z } \gamma \hat { z } + ( 1 - \gamma ) p _ { \phi } , \bar { z } \hat { z } / ( 1 - \gamma ^ { t } ) ,
127
+ $$
128
+
129
+ where $\hat { z }$ has a zero initialization; $\gamma$ is the momentum parameter; $t$ is the number of updates $\bar { z }$ has received; the division $( 1 - \gamma ^ { t } )$ is for bias correction [28]. We also use the ensembled prediction $\bar { z }$ as a reliable signal to filter out noisy training samples: Only those samples on which $\bar { z }$ strongly agrees with the label $y$ (i.e., $\bar { z } _ { y } > \delta$ where $\delta > 0$ is a threshold parameter) will be used for training.
130
+
131
+ We regularize model training by extending Eq. (4) to add a KL divergence regularization term from the model prediction to the ensembled prediction weighed by $\lambda$ :
132
+
133
+ $$
134
+ \operatorname* { m i n } _ { \phi } - \sum _ { j = 1 } ^ { | \mathcal { V } | } q _ { j } \log ( p _ { \phi } ( \pmb { x } ^ { g } ) _ { j } ) - \lambda \sum _ { j = 1 } ^ { | \mathcal { V } | } \bar { z } _ { j } \log \frac { p _ { \phi } ( \pmb { x } ^ { g } ) _ { j } } { \bar { z } _ { j } } .
135
+ $$
136
+
137
+ We follow [28] to slowly ramp-up $\lambda$ during training.
138
+
139
+ # 3.4 Overall Algorithm
140
+
141
+ We summarize SuperGen for singlesequence NLU tasks in Algorithm 1. Solving sequence-pair problems follows the same algorithm except the pretraining corpus $\mathcal { D }$ is needed for sampling the first sequence $\pmb { x } ^ { s }$ .
142
+
143
+ # Algorithm 1: SuperGen for Zero-Shot Learning.
144
+
145
+ Input: $\mathcal { V }$ : Label space; $\mathcal { P }$ : Label-descriptive prompts; $G _ { \theta }$ : Unidirectional PLM; $C _ { \phi }$ : Bidirectional PLM.
146
+
147
+ # 4 Experimental Setup
148
+
149
+ Downstream Tasks and Metrics. We use all the tasks included in GLUE [66] except STS-B which is a regression task. Please refer to Appendix C for more details about GLUE tasks. We follow the evaluation protocol of [13]: We use F1 score as the metric for QQP and MRPC, Matthews correlation for CoLA, and accuracy for the rest of the tasks. The original development sets of these tasks are used for testing. For all reported results, we include the average and standard deviation over 5 different random seeds.
150
+
151
+ Parameter: $N$ : Number of training samples per class to generate; $M ( \gg N )$ : Number of total training samples to generate; $T$ : Number of training steps; $B$ : Ensemble prediction update interval; $\delta$ : Threshold parameter.
152
+ Output: $C _ { \phi } ^ { * }$ : Classifier that classifies input texts into $\mathcal { V }$ .
153
+ for $y \in \mathcal { V }$ do $\overline { { \mathcal { T } _ { y } } } \gets \{ \}$ Class $_ y$ train set init. for $i \in [ 1 , 2 , \ldots , M ]$ do $\pmb { x } ^ { g } G _ { \theta } ( \pmb { w } _ { y } )$ Ty ← Ty S{(xg, y)} end
154
+ end
155
+ $\tau \{ \}$
156
+ // Selected train set.
157
+ for $y \in \mathcal { V }$ do Sort $\mathcal { T } _ { y }$ in descending order by Eq. (3) $\tau \tau \cup \mathcal { T } _ { y } [ : N ]$
158
+ end
159
+ $\hat { z } \gets \mathbf { 0 }$
160
+ // Ensembled prediction init.
161
+ $\tau ^ { * } \tau$
162
+ // Filtered train set.
163
+ for $i \in [ 1 , 2 , \dots , T ]$ do Fine-tune $C _ { \phi }$ via Eq. (6) on a minibatch of $\tau ^ { * }$ if $i \% B = 0$ then Update $\hat { z } , \bar { z }$ via Eq. (5) $\mathcal { T } ^ { * } \{ ( \pmb { x } ^ { g } , y ) | \bar { z } _ { y } > \delta , ( \pmb { x } ^ { g } , y ) \in \mathcal { T } \}$ end
164
+ end
165
+ return $C _ { \phi } ^ { * } = C _ { \phi }$
166
+
167
+ Models. Unless specified otherwise, we use CTRL (1.63B parameters) [23] as the generator $G _ { \theta }$ and $\mathrm { C O C O - L M _ { L a r g e } }$ (367M parameters) [40] as the classifier $C _ { \phi }$ . We also show the results using similar-sized PLMs (GPT-2 [51]/RoBERTa [34]) as the generator/classifier in Section 5.6.
168
+
169
+ Fine-Tuning Settings and Hyperparameters. We note that SuperGen is compatible with any fine-tuning method; while using more sophisticated methods may grant
170
+
171
+ further performance improvement, we use the basic prompt-based fine-tuning with manual templates approach for simplicity and clarity. For all tasks, we use the same templates and label words as in [13]. Under the zero-shot learning setting, it is not possible to tune hyperparameters due to the lack of validation sets. Therefore, we keep all fine-tuning hyperparameters (e.g., learning rate, batch size, training epochs, number of generated training samples, label smoothing and temporal ensembling hyperparameters) the same across all tasks. See Appendix B Table 10 for details.
172
+
173
+ Table 2: Results on seven GLUE classification tasks. We report average and standard deviation (as subscripts) performance over 5 different random seeds. †: Results from LM-BFF [13].
174
+
175
+ <table><tr><td>Method</td><td>MNLI-(m/mm) (Acc.)</td><td>QQP (F1)</td><td>QNLI (Acc.)</td><td>SST-2 (Acc.)</td><td>CoLA (Matt.)</td><td>RTE (Acc.)</td><td>MRPC (F1)</td><td>AVG</td></tr><tr><td colspan="9">Zero-Shot Setting: No task-specific data (neither labeled nor unlabeled).</td></tr><tr><td>Promptingt</td><td>50.80.0/51.70.0</td><td>49.70.0</td><td>50.80.0</td><td>83.60.0</td><td>2.00.0</td><td>51.30.0</td><td>61.90.0</td><td>50.1</td></tr><tr><td>SuperGen</td><td>72.30.5/73.80.5</td><td>66.1.1</td><td>73.31.9</td><td>92.80.6</td><td>32.75.5</td><td>65.31.2</td><td>82.20.5</td><td>69.4</td></tr><tr><td>- data selection</td><td>63.71.5/64.21.6</td><td>62.32.2</td><td>63.93.2</td><td>91.32.0</td><td>30.58.8</td><td>62.41.5</td><td>81.60.2</td><td>65.1</td></tr><tr><td>- label smooth</td><td>70.70.8/72.10.7</td><td>65.10.9</td><td>71.42.5</td><td>91.00.9</td><td>9.51.0</td><td>64.81.1</td><td>83.00.7</td><td>65.2</td></tr><tr><td>- temporal ensemble</td><td>62.04.6/63.64.8</td><td>63.90.3</td><td>72.42.0</td><td>92.50.9</td><td>23.57.0</td><td>63.51.0</td><td>78.82.2</td><td>65.3</td></tr><tr><td colspan="9">Few-Shot Seting: Use 32 labeled samples/class (half for training and half for development).</td></tr><tr><td>Fine-tuning†</td><td>45.86.4/47.86.8</td><td>60.74.3</td><td>60.26.5</td><td>81.43.8</td><td>33.914.3</td><td>54.43.9</td><td>76.62.5</td><td>59.1</td></tr><tr><td>Manual prompt†</td><td>68.32.3/70.51.9</td><td>65.55.3</td><td>64.54.2</td><td>92.70.9</td><td>9.37.3</td><td>69.13.6</td><td>74.55.3</td><td>63.6</td></tr><tr><td>+ demonstrationt</td><td>70.71.3/72.01.2</td><td>69.81.8</td><td>69.21.9</td><td>92.60.5</td><td>18.78.8</td><td>68.72.3</td><td>77.82.0</td><td>66.9</td></tr><tr><td>Auto prompt</td><td>68.32.5/70.12.6</td><td>67.03.0</td><td>68.37.4</td><td>92.31.0</td><td>14.014.1</td><td>73.92.2</td><td>76.22.3</td><td>65.8</td></tr><tr><td>+ demonstration†</td><td>70.03.6/72.03.1</td><td>67.75.8</td><td>68.55.4</td><td>93.00.6</td><td>21.815.9</td><td>71.15.3</td><td>78.13.4</td><td>67.3</td></tr><tr><td>Fully supervisedt</td><td>89.8/89.5</td><td>81.7</td><td>93.3</td><td>95.0</td><td>62.6</td><td>80.9</td><td>91.4</td><td>84.9</td></tr></table>
176
+
177
+ Table 3: Results with different groups of prompts. CoLA does not use prompts for generation. The number of prompt groups is equal to the number of the task labels.
178
+
179
+ <table><tr><td>Prompt Group</td><td>MNLI-(m/mm)</td><td>QQP</td><td>QNLI</td><td>SST-2</td><td>RTE</td><td>MRPC</td></tr><tr><td>#0 (Original)</td><td>72.30.5/73.80.5</td><td>66.1.1</td><td>73.31.9</td><td>92.80.6</td><td>65.31.2</td><td>82.20.5</td></tr><tr><td>#1</td><td>70.71.4/72.41.2</td><td>65.51.4</td><td>71.91.7</td><td>92.20.9</td><td>64.41.6</td><td>81.90.4</td></tr><tr><td>#2</td><td>70.80.6/72.10.8</td><td>65.61.1</td><td>72.22.2</td><td>92.40.8</td><td>64.71.8</td><td>81.80.8</td></tr><tr><td>#3</td><td>70.91.4/72.21.4</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Mixed</td><td>72.20.7/73.40.6</td><td>66.91.5</td><td>73.01.7</td><td>92.80.9</td><td>66.31.0</td><td>81.32.0</td></tr></table>
180
+
181
+ Compared Methods and Ablations. We include the results of zero-shot prompting, standard few-shot fine-tuning and the four few-shot prompt-based fine-tuning methods proposed in [13]. We also conduct ablation studies by removing the following three techniques from SuperGen one at a time: (1) not using Eq. (3) for training data selection but randomly selecting the same amount of training data ( $\_$ data selection); (2) not using label smoothing $\underline { { \underline { { \mathbf { \Pi } } } } }$ label smooth) but using one-hot labels; and (3) not using temporal ensembling (i.e., using Eq. (4) instead of Eq. (6) as the training objective) ( $-$ temporal ensemble). Lastly, we include the fully supervised fine-tuning results trained on the entire training sets.
182
+
183
+ # 5 Evaluation
184
+
185
+ # 5.1 Main Results
186
+
187
+ We present the results of SuperGen, its ablations and compared methods in Table 2. Overall, SuperGen significantly outperforms zero-shot prompting and achieves an overall better result than all few-shot methods. Notably, SuperGen results in much smaller variance over different random seeds than few-shot approaches on most tasks—with access to more training data, fine-tuning of PLMs becomes much more stable. The ablation results demonstrate that all three strategies (i.e., quality training data selection, label smoothing and temporal ensembling) play important roles in improving and stabilizing the final performance, especially on challenging tasks like MNLI.
188
+
189
+ # 5.2 Using Different Prompts
190
+
191
+ One important factor of SuperGen is the choice of label-descriptive prompts as they directly influence the quality of generated training samples. To study the impact of different prompt choices on the final model performance, we create different groups of prompts other than the original ones. We replace the prompt for one label used in Table 1 with a synonymous one and keep other prompts unchanged when forming a different prompt group (Please refer to Appendix A Table 8 for details). We also experiment with mixing the generated data by different prompt groups (mixed). The results are shown in Table 3. Overall, the model performance under different prompts is quite close, except on RTE whose test set is very small, potentially resulting in the higher variance. In this work, we manually choose simple prompts that make intuitive sense, and we leave the automatic searching of optimal prompts as future work.
192
+
193
+ ![](images/69e5c74206bf221048ac17346d9f4ccd6da2f7b8626c7e65c64dc66d8d607e07.jpg)
194
+ Figure 2: Classifier accuracy fine-tuned on different amount of generated training data (after data selection). Dots and error bars are the average performance and the standard deviation over 5 seeds, respectively.
195
+
196
+ ![](images/86bad6e8a307687f725a2dde6b8fe1da692480e94a43dd09f20030092b822a1f.jpg)
197
+ Figure 3: Classifier accuracy on MNLI-m fine-tuned on the fewshot samples only vs. on the fewshot and SuperGen generated set with varying few-shot set sizes.
198
+
199
+ # 5.3 Results with Different Amount of Generated Data
200
+
201
+ With training data automatically created by the generator, we can have a virtually infinite amount of training samples. We show the results of using different amount of generated data (after quality data selection) for fine-tuning the classifier $C _ { \phi }$ in Fig. 2 on MNLI-m and SST-2. When the number of training data is small (e.g., 100), the fine-tuning variance is high, resulting in the similar instability issue with few-shot settings. With more generated data used, both average performance and training stability improve, yielding comparable results (with smaller variance) to fine-tuning using few-shot task-specific data. However, when too many generated data (e.g., 10, 000) are used, the classifier’s performance slightly drops, probably due to increased label noise—recall that the training data are selected based on the ranking score in Eq. (3), so using more data results in the inclusion of more lower-ranking texts in the training set and reduced data quality. One way to address this issue is to use a fixed selection ratio and increase the total number of generated texts to obtain a larger number of high-quality training data. However, this comes at a greater computation cost in the generation step. An important future direction is thus to develop better data selection strategies.
202
+
203
+ # 5.4 Using SuperGen in Few-Shot Settings
204
+
205
+ We present a simple extension of SuperGen to few-shot settings and show that the generated data of SuperGen may also improve the few-shot performance. When few-shot samples are available, we first fine-tune the classifier on the few-shot training set (standard prompt-based fine-tuning without regularization), and then continue fine-tuning the classifier on the generated data by SuperGen as described in Section 3.3. This allows the classifier to effectively leverage the knowledge from the few-shot training set to filter out noisy samples in the generated data, as temporal ensembling regularizes the classifier to remember the predictions learned previously and only keeps samples on which the model predictions agree with the label. We show the benefits of incorporating generated data for different few-shot sample sizes on MNLI in Fig. 3 (we use half labeled samples for classifier training and half for development): When the few-shot training and validation sets are rather small $( 3 2 - { \bar { 6 } } 4 $ samples per label in total), fine-tuning the classifier on the SuperGen generated set further (after fine-tuning on the few-shot samples) brings notable performance improvements. However, such benefits diminish with more few-shot training samples: The generated data fail to improve the few-shot performance when there are 128 samples per label, and even worsen the classifier performance with 256 samples per label. This is probably because our synthetic data generation process is zero-shot and does not leverage any few-shot samples; the resulting generated samples may not be of high enough quality to boost the few-shot performance when there are relatively abundant annotated samples. Possible ways to use few-shot samples for generation include using them as demonstrations [5], for creating augmentations [29] and for tuning the generators. We leave the explorations of generating higher quality data by leveraging few-shot samples for future work.
206
+
207
+ Table 4: Comparisons with using CTRL for zeroshot prompting and for knowledge distillation. †: The entire training set is used as unlabeled data.
208
+
209
+ <table><tr><td>Method</td><td>MNLI-(m/mm)</td><td>SST-2</td></tr><tr><td>SuperGen</td><td>72.30.5/73.80.5</td><td>92.80.6</td></tr><tr><td>CTRL Prompting</td><td>38.50.0/39.20.0</td><td>72.50.0</td></tr><tr><td>Knowledge Distillt</td><td>40.80.5/41.50.6</td><td>73.60.8</td></tr></table>
210
+
211
+ Table 5: Results with different generator/classifier PLMs.
212
+
213
+ <table><tr><td>PLMs (Ge/CΦ)</td><td>MNLI-(m/mm)</td><td>SST-2</td></tr><tr><td>CTRL/COCO-LM</td><td>72.30.5/73.80.5</td><td>92.80.6</td></tr><tr><td>CTRL/RoBERTa</td><td>69.00.8/70.60.9</td><td>93.01.5</td></tr><tr><td>GPT-2/COCO-LM</td><td>69.51.2/71.31.3</td><td>88.21.8</td></tr><tr><td>GPT-2/RoBERTa</td><td>68.30.9/69.70.7</td><td>88.60.8</td></tr></table>
214
+
215
+ # 5.5 Using Generators for Knowledge Distillation
216
+
217
+ Apart from using unidirectional PLMs $G _ { \theta }$ for training data generation, one could also directly apply them to unlabeled data formulated as prompts to obtain zero-shot predictions (i.e., prompting [5, 13]), which can then be used as soft labels to train the classifier $C _ { \phi }$ . In Table 4, we show (1) the zero-shot prediction accuracy of CTRL (the best out of three different prompts, details in Appendix D) and (2) the classifier performance trained from CTRL’s predictions on the entire unlabeled training set as soft labels (i.e., knowledge distillation). Similar to the observations in previous studies [5, 70, 85], the zero-shot predictions of unidirectional PLMs are quite inaccurate and directly using them as soft labels to train classifiers does not yield good results. We hypothesize that the advantages of using unidirectional PLMs for training data generation over using them for zero-shot predictions are twofold: (1) Better flexibility in prompt formats. When unidirectional PLMs are used for zero-shot predictions, the prompts have to be designed so that the label word is the last token in the sequence to be predicted, as unidirectional PLMs cannot attend to subsequent tokens. Such constraints may result in the prompt being dissimilar to the pretraining data distribution and worsen the prediction quality of the PLMs. On the contrary, using unidirectional PLMs for generation is not subject to any prompt format constraints. (2) More direct uses of PLMs’ language modeling ability. Using unidirectional PLMs for training data generation directly leverages the PLMs’ output token probability. Applying PLMs for zero-shot prediction, however, requires an additional step to convert token predictions to label predictions (i.e., the verbalizer [56]), and such a mapping process usually necessitates manual curation and can hardly be optimal [13] especially without abundant task-specific data.
218
+
219
+ # 5.6 Using Different PLMs
220
+
221
+ The final performance of SuperGen is relevant to the choice of PLMs as the generator/classifier. Apart from the default PLM choice, we report the results of using GPT-2XLarge (1.54B parameters) [51] as the generator and RoBERTaLarge (356M parameters) [34] as the classifier in Table 5 with everything else unchanged. When using GPT-2, we change the prompt used for SST-2 to “The film is bad/terrible/awful.” for the negative label and “The film is good/great/excellent.” for the positive label, since the original prompts used for SST-2 in Table 1 are a part of the control codes of CTRL and cannot be effectively leveraged by GPT-2. Overall, both CTRL and GPT-2 are able to generate quality training data for good fine-tuned classifier performance; CTRL consistently yields better results than GPT-2 regardless of the choice of the classifier PLM, probably because CTRL is pretrained with control codes which provide explicit guidance for generating texts of certain domains and attributes. We also observe that the generated text quality is strongly correlated to the generator’s model size—using a smaller version of GPT-2 (e.g., with 117M parameters) results in significantly less coherent texts and can hardly serve as training data. An interesting future direction is to try larger generator PLMs (e.g., GPT-3) which may create training data of better quality.
222
+
223
+ # 5.7 Case Studies
224
+
225
+ We present concrete examples of generated texts guided by prompts of different labels in Table 6. The generated sequences are not only coherent, but also pertain to the corresponding labels. For easier tasks like SST-2, the generated texts almost always correctly reflect the desired sentiment polarity specified by the prompt. For more difficult tasks like MNLI, sometimes the generated texts are not of the correct label (Appendix E Table 13 shows some negative results). The existence of such label noise motivates our use of the regularization techniques in the fine-tuning stage. In the future, it will be interesting to develop new methods to better control text generation towards the desired label.
226
+
227
+ Table 6: Example generated texts for SST-2, MNLI and QQP. Sampled sequences from pretraining corpus $( { \pmb x } ^ { s } )$ are italicized; generated sequences $( \pmb { x } ^ { g } )$ are underlined; prompts $( \boldsymbol { w } ^ { y } )$ are in bold.
228
+
229
+ <table><tr><td>Task</td><td>Label</td><td>Generated Text</td></tr><tr><td rowspan="2">SST-2</td><td>positive</td><td>Rating:5.0 The film is a great example of the kind of movie that you can watch over and over.</td></tr><tr><td>negative</td><td>Rating:1.0 The film was a total waste of time.I would not recommend this movie to anyone.</td></tr><tr><td rowspan="4">MNLI</td><td>entailment</td><td>The construction of the station began in 2Ol6,when the opening date was estimated to mid-2020. In other words,the station was to open in 2020.</td></tr><tr><td rowspan="2">neutral</td><td>Theconstruction of the station began in 2O16,when the opening date was estimated to mid-2020.</td></tr><tr><td>Furthermore,it is expected that a new bus terminal will be built at this station.</td></tr><tr><td rowspan="2">contradiction</td><td>There sarumor thatTheconstructionofthe station beganin 2ol6,when theopeningdate was estimated to mid-2020. However,the truth is:The construction started in 2O17,andthe ofcialopening date was setfor March 31,2018.</td></tr><tr><td></td></tr><tr><td>QQP</td><td>equivalent not equivalent</td><td>What are the most wear resistant steels?In other words,what are the most durable steels? What are the most wear resistant steels?Furthermore,what is the best way to clean them?</td></tr></table>
230
+
231
+ # 6 Discussions and Conclusions
232
+
233
+ Ethical Considerations. While PLMs have demonstrated remarkable text generation and understanding capability, they can come with potential risks or harms [2, 3, 5] such as generating misinformation [46] or amplifying harmful biases [49]. The focus of our work is on utilizing existing PLMs to generate training data for NLU tasks instead of developing new PLMs or generation methods. Therefore, our method can be used in company with any bias reduction and correction techniques [15, 37] to mitigate the risks of PLMs.
234
+
235
+ Limitations. One inherent limitation with zero-shot learning is the lack of access to task-specific samples for hyperparameter tuning, whereas the performance of neural networks is usually heavily dependent on the choice of hyperparameters even when the training algorithm and training set are fixed [48]. Also, without access to any labeled data, the generated training data quality may not be high enough to achieve good performance on challenging tasks, especially when the task distribution is significantly different from the pretraining data distribution (e.g., the “linguistically incorrect” label of CoLA requires generating sequences with grammar mistakes – a different distribution from the one used to train PLMs). A promising direction to address the above limitations is extending SuperGen to few-shot settings (e.g., the setting studied in Section 5.4) and leveraging a small amount of labeled data for generating better quality data and for hyperparameter tuning.
236
+
237
+ Conclusions. We propose SuperGen, an automatic supervision generation approach for zero-shot learning of NLU tasks. By providing label-descriptive prompts as guidance to a unidirectional PLM, training data can be automatically created for fine-tuning a bidirectional PLM. Our framework differs from previous transfer-learning-based zero-shot methods in that SuperGen does not rely on cross-task annotations and eliminates the task difference in training and inference. We show that several strategies are important for effective and stable fine-tuning on generated data, including quality training data selection, label smoothing and temporal ensembling. SuperGen achieves strong performance on seven classification tasks of the GLUE benchmark, even yielding comparable or better results than sophisticated few-shot learning methods and offering better stability. There is large room for future work, including but not limited to: Extension to few-shot learning settings, exploring larger generator models [25, 68], better fine-tuning techniques to leverage generated data and better strategies for selecting quality training data.
238
+
239
+ # Acknowledgments
240
+
241
+ Research was supported in part by US DARPA KAIROS Program No. FA8750-19-2-1004 and INCAS Program No. HR001121C0165, National Science Foundation IIS-19-56151, IIS-17-41317, and IIS 17-04532, and the Molecule Maker Lab Institute: An AI Research Institutes program supported by NSF under Award No. 2019897, and the Institute for Geospatial Understanding through an Integrative Discovery Environment (I-GUIDE) by NSF under Award No. 2118329. Any opinions, findings, and conclusions or recommendations expressed herein are those of the authors and do not necessarily represent the views, either expressed or implied, of DARPA or the U.S. Government. Yu Meng is supported by the Google PhD Fellowship. We thank anonymous reviewers for valuable and insightful feedback.
242
+
243
+ # References
244
+
245
+ [1] Ateret Anaby-Tavor, Boaz Carmeli, Esther Goldbraich, Amir Kantor, George Kour, Segev Shlomov, Naama Tepper, and Naama Zwerdling. Do not have enough data? deep learning to the rescue! In AAAI, 2020.
246
+ [2] Emily M. Bender and Alexander Koller. Climbing towards NLU: On meaning, form, and understanding in the age of data. In ACL, 2020.
247
+ [3] Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. On the dangers of stochastic parrots: Can language models be too big? In ACM Conference on Fairness, Accountability, and Transparency, 2021.
248
+ [4] Luisa Bentivogli, Peter Clark, Ido Dagan, and Danilo Giampiccolo. The fifth pascal recognizing textual entailment challenge. In TAC, 2009.
249
+ [5] 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. In NeurIPS, 2020.
250
+ [6] Alvin Chan, Y. Ong, Bill Tuck Weng Pung, Aston Zhang, and Jie Fu. CoCon: A self-supervised approach for controlled text generation. In ICLR, 2021.
251
+ [7] Jiaao Chen, Zichao Yang, and Diyi Yang. Mixtext: Linguistically-informed interpolation of hidden space for semi-supervised text classification. In ACL, 2020.
252
+ [8] Kevin Clark, Minh-Thang Luong, Quoc V Le, and Christopher D Manning. ELECTRA: Pre-training text encoders as discriminators rather than generators. In ICLR, 2020.
253
+ [9] Ido Dagan, Oren Glickman, and Bernardo Magnini. The pascal recognising textual entailment challenge. In Machine Learning Challenges Workshop, 2005.
254
+ [10] Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. Plug and play language models: A simple approach to controlled text generation. In ICLR, 2020.
255
+ [11] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019.
256
+ [12] William B Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In International Workshop on Paraphrasing (IWP), 2005.
257
+ [13] Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. In ACL, 2021.
258
+ [14] Tianyu Gao, Xingcheng Yao, and Danqi Chen. SimCSE: Simple contrastive learning of sentence embeddings. In EMNLP, 2021.
259
+ [15] Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A. Smith. RealToxicityPrompts: Evaluating neural toxic degeneration in language models. In Findings of EMNLP, 2020.
260
+ [16] Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. The third pascal recognizing textual entailment challenge. In ACL-PASCAL workshop on textual entailment and paraphrasing, 2007.
261
+ [17] Aaron Gokaslan and Vanya Cohen. OpenWebText corpus. http://Skylion007.github. io/OpenWebTextCorpus, 2019.
262
+ [18] R Bar Haim, Ido Dagan, Bill Dolan, Lisa Ferro, Danilo Giampiccolo, Bernardo Magnini, and Idan Szpektor. The second pascal recognising textual entailment challenge. In PASCAL Challenges Workshop on Recognising Textual Entailment, 2006.
263
+ [19] Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. DeBERTa: Decoding-enhanced BERT with disentangled attention. In ICLR, 2021.
264
+ [20] Geoffrey E. Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. ArXiv, abs/1503.02531, 2015.
265
+ [21] Ari Holtzman, Jan Buys, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In ICLR, 2020.
266
+ [22] Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P. Xing. Toward controlled generation of text. In ICML, 2017.
267
+ [23] Nitish Shirish Keskar, Bryan McCann, Lav R. Varshney, Caiming Xiong, and Richard Socher. CTRL: A conditional transformer language model for controllable generation. ArXiv, abs/1909.05858, 2019.
268
+ [24] Muhammad Khalifa, Hady ElSahar, and Marc Dymetman. A distributional approach to controlled text generation. In ICLR, 2021.
269
+ [25] Boseop Kim, HyoungSeok Kim, Sang-Woo Lee, Gichang Lee, Donghyun Kwak, Dong Hyeon Jeon, Sunghyun Park, Sungju Kim, Seonhoon Kim, Dongpil Seo, et al. What changes can largescale language models bring? intensive study on hyperclova: Billions-scale korean generative pretrained transformers. In EMNLP, 2021.
270
+ [26] Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq R. Joty, Richard Socher, and Nazneen Rajani. GeDi: Generative discriminator guided sequence generation. In EMNLP, 2021.
271
+ [27] Sachin Kumar, Eric Malmi, Aliaksei Severyn, and Yulia Tsvetkov. Controlled text generation as continuous optimization with multiple constraints. In NeurIPS, 2021.
272
+ [28] Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In ICLR, 2017.
273
+ [29] Kenton Lee, Kelvin Guu, Luheng He, Tim Dozat, and Hyung Won Chung. Neural data augmentation via example extrapolation. arXiv preprint arXiv:2102.01335, 2021.
274
+ [30] Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In ACL, 2020.
275
+ [31] Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In ACL, 2021.
276
+ [32] Alisa Liu, Maarten Sap, Ximing Lu, Swabha Swayamdipta, Chandra Bhagavatula, Noah A. Smith, and Yejin Choi. DExperts: Decoding-time controlled text generation with experts and anti-experts. In ACL, 2021.
277
+ [33] Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. GPT understands, too. ArXiv, abs/2103.10385, 2021.
278
+ [34] 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.
279
+ [35] Robert L Logan IV, Ivana Balazevi ˇ c, Eric Wallace, Fabio Petroni, Sameer Singh, and Sebastian ´ Riedel. Cutting down on prompts and parameters: Simple few-shot learning with language models. arXiv preprint arXiv:2106.13353, 2021.
280
+ [36] Michal Lukasik, Srinadh Bhojanapalli, Aditya Krishna Menon, and Surinder Kumar. Does label smoothing mitigate label noise? In ICML, 2020.
281
+ [37] Xinyao Ma, Maarten Sap, Hannah Rashkin, and Yejin Choi. PowerTransformer: Unsupervised controllable revision for biased language correction. In EMNLP, 2020.
282
+ [38] Yu Meng, Jiaming Shen, Chao Zhang, and Jiawei Han. Weakly-supervised neural text classification. In CIKM, 2018.
283
+ [39] Yu Meng, Jiaming Shen, Chao Zhang, and Jiawei Han. Weakly-supervised hierarchical text classification. In AAAI, 2019.
284
+ [40] Yu Meng, Chenyan Xiong, Payal Bajaj, Saurabh Tiwary, Paul Bennett, Jiawei Han, and Xia Song. COCO-LM: Correcting and contrasting text sequences for language model pretraining. In NeurIPS, 2021.
285
+ [41] Yu Meng, Chenyan Xiong, Payal Bajaj, Saurabh Tiwary, Paul Bennett, Jiawei Han, and Xia Song. Pretraining text encoders with adversarial mixture of training signal generators. In ICLR, 2022.
286
+ [42] Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. arXiv preprint arXiv:2104.08773, 2021.
287
+ [43] Takeru Miyato, Andrew M. Dai, and Ian J. Goodfellow. Adversarial training methods for semi-supervised text classification. In ICLR, 2017.
288
+ [44] Rafael Muller, Simon Kornblith, and Geoffrey E. Hinton. When does label smoothing help? In ¨ NeurIPS, 2019.
289
+ [45] Duc Tam Nguyen, Chaithanya Kumar Mummadi, Thi-Phuong-Nhung Ngo, Thi Hoai Phuong Nguyen, Laura Beggel, and Thomas Brox. SELF: Learning to filter noisy labels with selfensembling. In ICLR, 2020.
290
+ [46] Artidoro Pagnoni, Vidhisha Balachandran, and Yulia Tsvetkov. Understanding factuality in abstractive summarization with FRANK: A benchmark for factuality metrics. In NAACL, 2021.
291
+ [47] Damian Pascual, Beni Egressy, Clara Meister, Ryan Cotterell, and Roger Wattenhofer. A ´ plug-and-play method for controlled text generation. In Findings of EMNLP, 2021.
292
+ [48] Ethan Perez, Douwe Kiela, and Kyunghyun Cho. True few-shot learning with language models. In NeurIPS, 2021.
293
+ [49] Shrimai Prabhumoye, Yulia Tsvetkov, Ruslan Salakhutdinov, and Alan W. Black. Style transfer through back-translation. In ACL, 2018.
294
+ [50] Raul Puri and Bryan Catanzaro. Zero-shot text classification with generative language models. ArXiv, abs/1912.10165, 2019.
295
+ [51] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
296
+ [52] 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, 2019.
297
+ [53] Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using siamese BERT-networks. In EMNLP, 2019.
298
+ [54] Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. Multitask prompted training enables zero-shot task generalization. In ICLR, 2022.
299
+ [55] Teven Le Scao and Alexander M. Rush. How many data points is a prompt worth? In NAACL, 2021.
300
+ [56] Timo Schick and Hinrich Schutze. Exploiting cloze-questions for few-shot text classification ¨ and natural language inference. In EACL, 2021.
301
+ [57] Timo Schick and Hinrich Schutze. Few-shot text generation with natural language instructions. ¨ In EMNLP, 2021.
302
+ [58] Timo Schick and Hinrich Schutze. Generating datasets with pretrained language models. In ¨ EMNLP, 2021.
303
+ [59] Timo Schick and Hinrich Schutze. It’s not just size that matters: Small language models are ¨ also few-shot learners. In NAACL, 2021.
304
+ [60] Iyer Shankar, Dandekar Nikhil, and Csernai Kornel.´ First Quora dataset release: Question pairs, 2017. URL https://www.quora.com/q/quoradata/ First-Quora-Dataset-Release-Question-Pairs.
305
+ [61] Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In EMNLP, 2013.
306
+ [62] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
307
+ [63] Derek Tam, Rakesh R Menon, Mohit Bansal, Shashank Srivastava, and Colin Raffel. Improving and simplifying pattern exploiting training. In EMNLP, 2021.
308
+ [64] Lisa Torrey and Jude Shavlik. Transfer learning. In Handbook of research on machine learning applications and trends: algorithms, methods, and techniques. 2010.
309
+ [65] 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.
310
+ [66] 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 EMNLP Workshop BlackboxNLP, 2018.
311
+ [67] Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. SuperGLUE: A stickier benchmark for general-purpose language understanding systems. In NeurIPS, 2019.
312
+ [68] Zirui Wang, Adams Wei Yu, Orhan Firat, and Yuan Cao. Towards zero-label language learning. arXiv preprint arXiv:2109.09193, 2021.
313
+ [69] Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. Neural network acceptability judgments. In TACL, 2019.
314
+ [70] 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 ICLR, 2022.
315
+ [71] Sean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan, Kyunghyun Cho, and Jason Weston. Neural text generation with unlikelihood training. In ICLR, 2020.
316
+ [72] Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL-HLT, 2018.
317
+ [73] Qizhe Xie, Zihang Dai, Eduard H. Hovy, Minh-Thang Luong, and Quoc V. Le. Unsupervised data augmentation for consistency training. In NeurIPS, 2020.
318
+ [74] Hanwei Xu, Yujun Chen, Yulun Du, Nan Shao, Yanggang Wang, Haiyu Li, and Zhilin Yang. ZeroPrompt: Scaling prompt-based pretraining to 1, 000 tasks improves zero-shot generalization. ArXiv, abs/2201.06910, 2022.
319
+ [75] Kevin Yang and Dan Klein. FUDGE: Controlled text generation with future discriminators. In NAACL, 2021.
320
+ [76] Yiben Yang, Chaitanya Malaviya, Jared Fernandez, Swabha Swayamdipta, Ronan Le Bras, Ji Ping Wang, Chandra Bhagavatula, Yejin Choi, and Doug Downey. Generative data augmentation for commonsense reasoning. In Findings of EMNLP, 2020.
321
+ [77] Jiacheng Ye, Jiahui Gao, Qintong Li, Hang Xu, Jiangtao Feng, Zhiyong Wu, Tao Yu, and Lingpeng Kong. ZeroGen: Efficient zero-shot learning via dataset generation. ArXiv, abs/2202.07922, 2022.
322
+ [78] Qinyuan Ye, Bill Yuchen Lin, and Xiang Ren. Crossfit: A few-shot learning challenge for cross-task generalization in nlp. In EMNLP, 2021.
323
+ [79] Wenpeng Yin, Jamaal Hay, and Dan Roth. Benchmarking zero-shot text classification: Datasets, evaluation and entailment approach. In EMNLP, 2019.
324
+ [80] Wenpeng Yin, Nazneen Rajani, Dragomir Radev, Richard Socher, and Caiming Xiong. Universal natural language processing with limited annotations: Try few-shot textual entailment as a start. In EMNLP, 2020.
325
+ [81] Kang Min Yoo, Dongju Park, Jaewook Kang, Sang-Woo Lee, and Woomyeong Park. GPT3Mix: Leveraging large-scale language models for text augmentation. In EMNLP Findings, 2021.
326
+ [82] Weizhe Yuan, Graham Neubig, and Pengfei Liu. BARTScore: Evaluating generated text as text generation. In NeurIPS, 2021.
327
+ [83] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017.
328
+ [84] Ningyu Zhang, Luoqiu Li, Xiang Chen, Shumin Deng, Zhen Bi, Chuanqi Tan, Fei Huang, and Huajun Chen. Differentiable prompt makes pre-trained language models better few-shot learners. In ICLR, 2022.
329
+ [85] Tony Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. Calibrate before use: Improving few-shot performance of language models. In ICML, 2021.
330
+ [86] Ruiqi Zhong, Kristy Lee, Zheng Zhang, and Dan Klein. Adapting language models for zero-shot learning by meta-tuning on dataset and prompt collections. In Findings of EMNLP, 2021.
331
+ [87] Fuzhen Zhuang, Zhiyuan Qi, Keyu Duan, Dongbo Xi, Yongchun Zhu, Hengshu Zhu, Hui Xiong, and Qing He. A comprehensive survey on transfer learning. Proceedings of the IEEE, 2020.
332
+ [88] Daniel M. Ziegler, Nisan Stiennon, Jeff Wu, Tom B. Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. ArXiv, abs/1909.08593, 2019.
333
+
334
+ # Checklist
335
+
336
+ 1. For all authors...
337
+
338
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
339
+ (b) Did you describe the limitations of your work? [Yes]
340
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes]
341
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
342
+
343
+ 2. If you are including theoretical results...
344
+
345
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
346
+
347
+ 3. If you ran experiments...
348
+
349
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
350
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
351
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
352
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
353
+
354
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
355
+
356
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
357
+ (b) Did you mention the license of the assets? [Yes]
358
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
359
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
360
+
361
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
362
+
363
+ 5. If you used crowdsourcing or conducted research with human subjects...
364
+
365
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
366
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
367
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
parse/dev/4G1Sfp_1sz7/4G1Sfp_1sz7_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/4R7YrAGhnve/4R7YrAGhnve_content_list.json ADDED
@@ -0,0 +1,1067 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "SegViT: Semantic Segmentation with Plain Vision Transformers ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 197,
8
+ 122,
9
+ 800,
10
+ 171
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Bowen Zhang1∗, Zhi Tian2∗, Quan Tang4, Xiangxiang $\\mathbf { C h u ^ { 2 } }$ , Xiaolin Wei2, Chunhua Shen3, Yifan Liu1 ",
17
+ "bbox": [
18
+ 279,
19
+ 219,
20
+ 720,
21
+ 252
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "1 The University of Adelaide, Australia 2 Meituan Inc. 3 Zhejiang University, China 4 South China University of Technology, China ",
28
+ "bbox": [
29
+ 230,
30
+ 261,
31
+ 767,
32
+ 291
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Abstract ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 462,
42
+ 327,
43
+ 535,
44
+ 343
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "We explore the capability of plain Vision Transformers (ViTs) for semantic segmentation and propose the SegViT. Previous ViT-based segmentation networks usually learn a pixel-level representation from the output of the ViT. Differently, we make use of the fundamental component—attention mechanism, to generate masks for semantic segmentation. Specifically, we propose the Attention-to-Mask (ATM) module, in which the similarity maps between a set of learnable class tokens and the spatial feature maps are transferred to the segmentation masks. Experiments show that our proposed $\\mathrm { S e g V i T }$ using the ATM module outperforms its counterparts using the plain ViT backbone on the ADE20K dataset and achieves new state-of-the-art performance on COCO-Stuff-10K and PASCAL-Context datasets. Furthermore, to reduce the computational cost of the ViT backbone, we propose query-based down-sampling (QD) and query-based up-sampling (QU) to build a Shrunk structure. With the proposed Shrunk structure, the model can save up to $4 0 \\%$ computations while maintaining competitive performance. ",
51
+ "bbox": [
52
+ 233,
53
+ 359,
54
+ 766,
55
+ 553
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "1 Introduction ",
62
+ "text_level": 1,
63
+ "bbox": [
64
+ 174,
65
+ 579,
66
+ 310,
67
+ 597
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Semantic segmentation is a dense prediction task in computer vision that requires pixel-level classification of an input image. Fully Convolutional Networks (FCN) [1] are widely used in recent state-of-the-art methods. This paradigm includes a deep convolutional neural network as the encoder/backbone and a segmentation-oriented decoder to provide dense predictions. A $1 \\times 1$ convolutional layer is usually applied to a representative feature map to obtain the pixel level predictions. To achieve higher performance, previous works [2–4] focus on enriching the context information or fusing multi-scale information. However, the correlations among spatial locations are hard to model explicitly in FCNs due to the limited receptive field. ",
74
+ "bbox": [
75
+ 174,
76
+ 612,
77
+ 825,
78
+ 723
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "Recently, Vision Transformers (ViT) [5], which make use of the spatial attention mechanism are introduced to the field of computer vision. Unlike typical convolution-based backbones, the ViT has a plain and non-hierarchical architecture that keeps the resolution of the feature maps all the way through. The lack of the down-sampling process (excluding tokenizing the image) brings differences to the architecture to do the semantic segmentation task using ViT backbone. Various semantic segmentation methods [6–8] based on ViT backbones have achieved promising performance due to the powerful representation learned from the pre-trained backbones. However, the potential of the attention mechanism is not fully explored. ",
85
+ "bbox": [
86
+ 174,
87
+ 728,
88
+ 825,
89
+ 840
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "Different from previous per-pixel classification paradigm [6–8], we consider learning a meaningful class token and then finding local patches with higher similarity to it. To achieve this goal, we propose the Attention-to-Mask (ATM) module. More specifically, we employ a transformer block that takes the learnable class tokens as queries and transfers the spatial feature maps as keys and values. A dot-product operator calculates the similarity maps between queries and keys. We encourage regions belonging to the same category to generate larger similarity values for the corresponding category (i.e. a specific class token). Fig. 1 visualizes the similarity maps between the features and the ‘Table’ and ‘Chair’ tokens. By simply applying a Sigmoid operation, we can transfer the similarity maps to the masks. Meanwhile, following the design of a typical transformer block, a Softmax operation is also applied to the similarity maps to get the cross attention maps. The ‘Table’ and ‘Chair’ tokens are then updated as in any regular transformer decoders, by a weighted sum of the values with the cross attention maps as the weights. Since the mask is a byproduct of the regular attentive calculations, negligible computation is involved during the operation. ",
96
+ "bbox": [
97
+ 176,
98
+ 847,
99
+ 821,
100
+ 875
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "",
107
+ "bbox": [
108
+ 174,
109
+ 90,
110
+ 825,
111
+ 243
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "Building upon this efficient ATM module, we propose a new semantic segmentation paradigm with the plain ViT structure, dubbed $\\mathrm { { S e g V i T } }$ . In the paradigm, several ATM modules are employed on different layers, and we get the final segmentation mask by adding the outputs from different layers together. $\\mathrm { S e g V i T }$ outperforms its ViT-based counterparts with less computational cost. However, compared with previous encoder-decoder structures that use hierarchical networks as encoders, ViT backbones as encoders are generally heavier. To further reduce the computational cost, we employ a Shrunk structure consisting of query-based down-sampling (QD) and query-based up-sampling (QU). The QD can be inserted into the ViT backbone to reduce the resolution by half and QU is used parallel to the backbone to recover the resolution. The Shrunk structure together with the ATM module as the decoder can reduce up to $4 0 \\%$ computations while maintaining competitive performance. ",
118
+ "bbox": [
119
+ 174,
120
+ 250,
121
+ 825,
122
+ 388
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "We summarize our main contributions as follows: ",
129
+ "bbox": [
130
+ 174,
131
+ 395,
132
+ 498,
133
+ 409
134
+ ],
135
+ "page_idx": 1
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "• We propose an Attention-to-Mask (ATM) decoder module that is effective and efficient for semantic segmentation. For the first time, we utilize the spatial information in attention maps to generate mask predictions for each category, which can work as a new paradigm for semantic segmentation. \n• We managed to apply our ATM decoder module to the plain, non-hierarchical ViT backbones in a cascade manner and designed a structure namely $\\mathrm { S e g V i T }$ that achieves mIoU $5 5 . 2 \\%$ on the competitive ADE20K dataset which is the best and lightest among methods that use ViT backbones. We also benchmark our method on the PASCAL-Context dataset $( 6 5 . 3 \\%$ mIoU) and COCO-Stuff-10K dataset $( 5 0 . 3 \\%$ mIoU) and achieve new state-of-the-art performance. \nWe further explore the architecture of ViT backbones and work out a Shrunk structure to apply to the backbone to reduce the overall computational cost while still maintaining competitive performance. This alleviates the disadvantage of ViT backbones that are usually more computationally intensive compared to their hierarchical counterparts. Our Shrunk version of $\\mathrm { S e g V i T }$ on the ADE20K dataset reaches mIoU $5 5 . 1 \\%$ with the computational cost of 373.5 GFLOPs which is about $4 0 \\%$ off compared to the original SegViT (637.9 GFLOPs). ",
140
+ "bbox": [
141
+ 217,
142
+ 420,
143
+ 825,
144
+ 652
145
+ ],
146
+ "page_idx": 1
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "2 Related Work ",
151
+ "text_level": 1,
152
+ "bbox": [
153
+ 174,
154
+ 679,
155
+ 321,
156
+ 695
157
+ ],
158
+ "page_idx": 1
159
+ },
160
+ {
161
+ "type": "text",
162
+ "text": "Semantic segmentation. Semantic segmentation which requires pixel-level classification on an input image is a fundamental task in computer vision. Fully Convolutional Networks (FCN) used to be the dominant approach to this task. Initial per-pixel approaches such as [9, 10] attribute the class label to each pixel based on the per-pixel probability. To enlarge the receptive field, several approaches [11, 12] have proposed dilated convolutions or apply spatial pyramid pooling to capture contextual information of multiple scales. With the introduction of attention mechanisms, [13, 14, 6] replace the feature merge conducted by convolutions and pooling with attention to better capture long-range dependencies. ",
163
+ "bbox": [
164
+ 173,
165
+ 710,
166
+ 825,
167
+ 821
168
+ ],
169
+ "page_idx": 1
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "Recent works [15, 8, 16] decouple the per-pixel classification process. They reconstruct the structure by using a fixed number of learnable tokens and use them as weights for the transformation to apply on feature maps. Binary matching rather than cross-entropy is used to allow overlaps between feature maps and learnable tokens are used to dynamically generate classification probabilities. This paradigm enables the classification process to be conducted globally and alleviates the burden for the decoder to do per-pixel classification, which as a result, is more precise and the performance is generally better. However, for those methods, the feature map is still calculated in a static manner, usually requiring feature merge modules such as FPN [4]. ",
174
+ "bbox": [
175
+ 174,
176
+ 828,
177
+ 823,
178
+ 911
179
+ ],
180
+ "page_idx": 1
181
+ },
182
+ {
183
+ "type": "image",
184
+ "img_path": "images/d4684106657fd91e50f1ae4dbfc23811e0a8d9bf529682b3f8d4363fdb795cf5.jpg",
185
+ "image_caption": [
186
+ "Figure 1: The overall concept of our Attention-to-Mask decoder. In a typical attentive process, the dot-product is first calculated between queries and keys to measure the similarity (as illustrated on the left). If the similarity map is applied with Softmax operation on the spatial dimension, the output is the typical attention map (multiple heads are summed together). However, if the same similarity map is applied with a per-pixel operation Sigmoid, it produces a mask that indicates the area with certain similarity. Based on the assumption that the tokens within the same category have higher similarity, we can train a token vector to have high similarity within tokens of the specific category and low similarity elsewhere. In the meantime, this process does not violate the attention mechanism. Thus, it can process alongside the original transformer layers. "
187
+ ],
188
+ "image_footnote": [],
189
+ "bbox": [
190
+ 240,
191
+ 90,
192
+ 754,
193
+ 220
194
+ ],
195
+ "page_idx": 2
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "",
200
+ "bbox": [
201
+ 174,
202
+ 387,
203
+ 823,
204
+ 415
205
+ ],
206
+ "page_idx": 2
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "Transformers for vision. Attention-based transformer backbones have become powerful alternatives to standard convolution based networks for image classification tasks. The original ViT [5] is a plain, non-hierarchical architecture. Various hierarchical transformers such as [17–21] have been presented afterwards. These methods inherit some designs from convolution based networks such as hierarchical structures, pooling and down-sampling with convolutions. As a result, they can be used as a straightforward replacement for convolutional based networks and applied with previous decoder heads for tasks such as semantic segmentation. ",
211
+ "bbox": [
212
+ 174,
213
+ 438,
214
+ 825,
215
+ 535
216
+ ],
217
+ "page_idx": 2
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "Plain-backbone decoders. High-resolution feature maps generated by backbones are important for dense prediction tasks such as semantic segmentation. Typical hierarchical transformers use feature merge techniques such as FPN [4] or dilated backbones to generate high-resolution feature maps. However, for plain, non-hierarchical transformer backbones, the resolution remains the same for all layers. SETR [6] proposed a simple strategy to treat transformer outputs in a sequence-to-sequence perspective to solve segmentation tasks. Segmenter [8] joints random initialized class embeddings and the transformer patch embeddings together and applies several self-attention layers to the joint token sequence to obtain updated class embeddings and patch embeddings semantic prediction. In our study, we consider learning a class token and then finding local patches with higher similarities with the help of the attention map, making the inference process more direct and efficient. ",
222
+ "bbox": [
223
+ 174,
224
+ 558,
225
+ 825,
226
+ 696
227
+ ],
228
+ "page_idx": 2
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "3 Method ",
233
+ "text_level": 1,
234
+ "bbox": [
235
+ 174,
236
+ 723,
237
+ 269,
238
+ 739
239
+ ],
240
+ "page_idx": 2
241
+ },
242
+ {
243
+ "type": "text",
244
+ "text": "3.1 Encoder ",
245
+ "text_level": 1,
246
+ "bbox": [
247
+ 174,
248
+ 758,
249
+ 271,
250
+ 773
251
+ ],
252
+ "page_idx": 2
253
+ },
254
+ {
255
+ "type": "text",
256
+ "text": "Given an input image $I \\in \\mathbb { R } ^ { H \\times W \\times 3 }$ , a plain vision transformer backbone reshapes it into a sequence of tokens $\\dot { \\mathcal { F } } _ { 0 } \\in \\mathbb { R } ^ { \\tilde { L } \\times C }$ where ${ \\cal L } = { \\cal H } \\bar { W } / P ^ { 2 }$ , $P$ is the patch size and $C$ is the number of channels. Learnable position embeddings of the same size of $\\mathcal { F } _ { 0 }$ are added to capture the positional information. Then, the token sequence $\\mathcal { F } _ { 0 }$ is applied with $m$ transformer layers to get the output. We define the output tokens for each layer as $[ \\mathcal { F } _ { 1 } , \\mathcal { F } _ { 2 } , \\ldots , \\mathcal { F } _ { m } ] \\in \\mathbb { R } ^ { L \\times C }$ . Typically, a transformer layer consists of a multi-head self-attention block followed by a point-wise multilayer perceptron block with layer norm in between and then a residual connection is added afterward. The transformer layers are stacked repetitively several times. For a plain vision transformer like ViT, there are no other modules involved and for each layer, the number of the tokens is not changed. ",
257
+ "bbox": [
258
+ 174,
259
+ 785,
260
+ 825,
261
+ 911
262
+ ],
263
+ "page_idx": 2
264
+ },
265
+ {
266
+ "type": "image",
267
+ "img_path": "images/34cbf2f58eed90953a49e4ee13e4b168073eba542e2899120d61dd93c2b7b2f1.jpg",
268
+ "image_caption": [
269
+ "Figure 2: The overall SegViT structure with the ATM module. The Attention-to-Mask (ATM) module inherits the typical transformer decoder structure. It takes in randomly initialized class embeddings as queries and the feature maps from the ViT backbone to generate keys and values. The outputs of the ATM module are used as the input queries for the next layer. The ATM module is carried out sequentially with inputs from different layers of the backbone as keys and values in a cascade manner. A linear transform is then applied to the output of the ATM module to produce the class predictions for each token. The mask for the corresponding class is transferred from the similarities between queries and keys in the ATM module. "
270
+ ],
271
+ "image_footnote": [],
272
+ "bbox": [
273
+ 235,
274
+ 87,
275
+ 759,
276
+ 313
277
+ ],
278
+ "page_idx": 3
279
+ },
280
+ {
281
+ "type": "text",
282
+ "text": "3.2 Decoder ",
283
+ "text_level": 1,
284
+ "bbox": [
285
+ 173,
286
+ 457,
287
+ 271,
288
+ 472
289
+ ],
290
+ "page_idx": 3
291
+ },
292
+ {
293
+ "type": "text",
294
+ "text": "Mask-to-Attention (ATM). Cross attention can be described as the mapping between two sequences of tokens. We define two token sequences as $\\mathcal { G } \\in \\mathbb { R } ^ { N \\times C }$ with the length $N$ equals to the number of classes and $\\mathcal { F } _ { i } \\in \\mathbb { R } ^ { L \\times C }$ . First, linear transformations are applied to each of them to form query (Q), key (K) and values (V), as presented by Eq. (1). ",
295
+ "bbox": [
296
+ 173,
297
+ 482,
298
+ 825,
299
+ 539
300
+ ],
301
+ "page_idx": 3
302
+ },
303
+ {
304
+ "type": "equation",
305
+ "img_path": "images/53ddb1f1fac7b88d33966b0b7897fea0fcfededbcf22380c304f54131aec710b.jpg",
306
+ "text": "$$\nQ = \\phi _ { q } ( \\mathcal { G } ) \\in \\mathbb { R } ^ { N \\times C } , K = \\phi _ { k } ( \\mathcal { F } _ { i } ) \\in \\mathbb { R } ^ { L \\times C } , V = \\phi _ { v } ( \\mathcal { F } _ { i } ) \\in \\mathbb { R } ^ { L \\times C } ,\n$$",
307
+ "text_format": "latex",
308
+ "bbox": [
309
+ 269,
310
+ 544,
311
+ 728,
312
+ 563
313
+ ],
314
+ "page_idx": 3
315
+ },
316
+ {
317
+ "type": "text",
318
+ "text": "The similarity map is calculated between the query and the key. Following the scaled dot-product attention mechanism, the similarity map and attention map are calculated by: ",
319
+ "bbox": [
320
+ 173,
321
+ 568,
322
+ 823,
323
+ 597
324
+ ],
325
+ "page_idx": 3
326
+ },
327
+ {
328
+ "type": "equation",
329
+ "img_path": "images/31643edae4d42ee8541e954fdb7cfd2a3f991bb2f29ce7fc7b07c0cf0f6bb8a4.jpg",
330
+ "text": "$$\n\\begin{array} { c } { S ( Q , K ) = \\displaystyle \\frac { Q K ^ { T } } { \\sqrt { d _ { k } } } \\in \\mathbb { R } ^ { N \\times L } , } \\\\ { A t t e n t i o n ( \\mathcal { G } , \\mathcal { F } _ { i } ) = \\displaystyle \\mathtt { S o f t m a x } ( S ( Q , K ) ) V \\in \\mathbb { R } ^ { N \\times C } , } \\end{array}\n$$",
331
+ "text_format": "latex",
332
+ "bbox": [
333
+ 320,
334
+ 602,
335
+ 678,
336
+ 659
337
+ ],
338
+ "page_idx": 3
339
+ },
340
+ {
341
+ "type": "text",
342
+ "text": "where $\\sqrt { d _ { k } }$ is a scaling factor with $d _ { k }$ equals to the dimension of the keys. The shape of the similarity map $S ( Q , K )$ is determined by the length of the two token sequences $N$ and $L$ . The attention mechanism is then to update $\\mathcal { G }$ by a weighted sum of $V$ , where the weight assigned to the summation is the similarity map applied with Softmax along the dimension $L$ . ",
343
+ "bbox": [
344
+ 173,
345
+ 665,
346
+ 825,
347
+ 722
348
+ ],
349
+ "page_idx": 3
350
+ },
351
+ {
352
+ "type": "text",
353
+ "text": "Dot-product attention uses the Softmax function to exclusively concentrate the attention on the token that has the most similarity. However, we suppose that the tokens other than ones that yield maximum similarities are also meaningful. Based on this intuition, we design a lightweight module that generates semantic predictions more directly. To be more specific, we assign $\\mathcal { G }$ as the class embeddings for the segmentation task and ${ \\mathcal { F } } _ { i }$ as the output of layer $i$ of the ViT backbone. We pair a semantic mask to each token in $\\mathcal { G }$ to represent the semantic prediction for each class. The calculation for the mask is: ",
354
+ "bbox": [
355
+ 173,
356
+ 727,
357
+ 825,
358
+ 823
359
+ ],
360
+ "page_idx": 3
361
+ },
362
+ {
363
+ "type": "equation",
364
+ "img_path": "images/a8396ec582b83ddee4e7abf2bab613b767146b856206c803bf4d0d6232902f6e.jpg",
365
+ "text": "$$\nM a s k ( \\mathcal { G } , \\mathcal { F } _ { i } ) = \\operatorname { S i g m o i d } ( S ( Q , K ) ) \\in \\mathbb { R } ^ { N \\times L }\n$$",
366
+ "text_format": "latex",
367
+ "bbox": [
368
+ 343,
369
+ 820,
370
+ 653,
371
+ 839
372
+ ],
373
+ "page_idx": 3
374
+ },
375
+ {
376
+ "type": "text",
377
+ "text": "The shape of the masks is $N \\times L$ , which can be further reshaped to $N \\times H / P \\times W / P$ . The structure of the ATM mechanism is illustrated in the right part in Fig. 2. Masks are the middle output of the cross attention. The final output tokens from the ATM module are used for classification. We apply a linear transformation followed by a Softmax activation to the output class tokens to get class probability predictions. Note that we follow [15] to add a ‘no object’ category $( \\varnothing )$ in case the image doesn’t contain certain classes. During inference, the output is produced by the dot-product between the class probability and the mask groups. ",
378
+ "bbox": [
379
+ 173,
380
+ 842,
381
+ 825,
382
+ 911
383
+ ],
384
+ "page_idx": 3
385
+ },
386
+ {
387
+ "type": "image",
388
+ "img_path": "images/937a25918d13b9bb305644659197a9d1f00fc926dfb7e1a6dcf30600feacaa80.jpg",
389
+ "image_caption": [
390
+ "Figure 3: The structure comparison between $\\mathbf { S e g V i T }$ with a single layer and the Shrunk version. (a) illustrates the $\\mathrm { S e g V i T }$ structure with ATM module used once with the last layer of the ViT backbone as the input to generate predictions. (b) uses the query-based down-sampling (QD) module to implement a naive way to shrink the resolution of the features of the backbone from $^ { 1 / 1 6 }$ to $^ { 1 / 3 2 }$ and thus reduces the overall computational cost. (c) is the proposed (shrunk) version which applies the additional query-based up-sampling module. The Shrunk version can save up to $40 \\%$ of computational cost when using the ViT-Large backbone without much sacrifice to the performance. "
391
+ ],
392
+ "image_footnote": [],
393
+ "bbox": [
394
+ 236,
395
+ 87,
396
+ 761,
397
+ 217
398
+ ],
399
+ "page_idx": 4
400
+ },
401
+ {
402
+ "type": "text",
403
+ "text": "",
404
+ "bbox": [
405
+ 174,
406
+ 347,
407
+ 823,
408
+ 376
409
+ ],
410
+ "page_idx": 4
411
+ },
412
+ {
413
+ "type": "text",
414
+ "text": "Plain backbones such as ViT does not have multiple stages with features of different scale. Thus, structures such as FPN to merge features with multiple scales are not applicable. However, features other than the last layer contain rich low-level semantic information and are beneficial to the performance. We designed a structure that can make use of the feature maps from different layers of ViT to compact with our ATM decoder namely $\\mathrm { S e g V i T }$ . In this study, we also found a way to compact the computational cost for the ViT backbone without sacrificing performance. This proposed Shrunk version of $\\mathrm { S e g V i T }$ uses query-based down-sampling (QD) module together with a query-based up-sampling (QU) module to compress the ViT backbone and bring an overall reduction to the computational cost. ",
415
+ "bbox": [
416
+ 174,
417
+ 382,
418
+ 825,
419
+ 507
420
+ ],
421
+ "page_idx": 4
422
+ },
423
+ {
424
+ "type": "text",
425
+ "text": "The SegViT structure. As illustrated in Fig. 2, an ATM decoder takes in $N$ tokens as the class embeddings and another sequence of tokens as the base to calculate keys and values for the ATM module to generate masks. The output of the ATM is $N$ updated tokens and $N$ masks corresponding to each class token. We use random initialized learnable tokens as the class embeddings and the output of the last layer of the ViT backbone as the base first. To make use of multi-layer information, the output of the first ATM decoder is then used as the class embeddings for the next ATM decoder with the output of another layer of the ViT backbone as the base. This process is repeated another time so that we can get three groups of tokens and masks. Formally, the loss function of each layer can be formulated as, ",
426
+ "bbox": [
427
+ 173,
428
+ 516,
429
+ 825,
430
+ 641
431
+ ],
432
+ "page_idx": 4
433
+ },
434
+ {
435
+ "type": "equation",
436
+ "img_path": "images/04953a59bff946d6bc7095afd64065e9f5755278c0cc86bff05b5c04aaa0f3e6.jpg",
437
+ "text": "$$\n\\mathcal { L } _ { o v e r a l l } = \\mathcal { L } _ { c l s } + \\mathcal { L } _ { m a s k } = \\mathcal { L } _ { c l s } + \\lambda _ { f o c a l } \\mathcal { L } _ { I o U } + \\lambda _ { d i c e } \\mathcal { L } _ { d i c e }\n$$",
438
+ "text_format": "latex",
439
+ "bbox": [
440
+ 295,
441
+ 648,
442
+ 700,
443
+ 666
444
+ ],
445
+ "page_idx": 4
446
+ },
447
+ {
448
+ "type": "text",
449
+ "text": "In each group, the output tokens are supervised by the classification loss $( \\mathcal { L } _ { c l s } )$ which is mentioned above and the masks are summed orderly and supervised by the mask loss $( \\mathcal { L } _ { m a s k } )$ which is a linear combination of a focal loss [22] and a dice loss [23] multiplied by hyper-parameters $\\lambda _ { f o c a l }$ and $\\lambda _ { d i c e }$ respectively as in DETR [24]. The loss of all three groups are then summed together. We have further experiments to show that this design is beneficial and efficient. ",
450
+ "bbox": [
451
+ 174,
452
+ 679,
453
+ 825,
454
+ 750
455
+ ],
456
+ "page_idx": 4
457
+ },
458
+ {
459
+ "type": "text",
460
+ "text": "The Shrunk structure. Plain transformer backbones such as ViT is known to have larger computational cost than their counterparts with similar performance. We propose a Shrunk structure using query-based down-sampling (QD) and up-sampling (QU). Since the shape of the output of the attention module is determined by the shape of the query, we can apply down-sampling before the query transformation to realize the QD or insert new query tokens during the cross attention to realize the QU. By changing the resolution with the number of query tokens, the spatial size is changed according to the cross attention, providing more flexibility to preserve (recover) important regions. To be more specific, in the QD layer, we use the nearest sampling to reduce the number of the query tokens while keep the size of the key and value tokens. When passing through a transformer layer, the values are weighted and summed by the attention map between query tokens and the key tokens. This is non-linear downsampling that will pay more attention to the important regions. In the QU layer, we employ a transformer decoder structure [25] and initialize new learnable tokens as queries based on the desired output resolution. ",
461
+ "bbox": [
462
+ 174,
463
+ 758,
464
+ 825,
465
+ 911
466
+ ],
467
+ "page_idx": 4
468
+ },
469
+ {
470
+ "type": "text",
471
+ "text": "",
472
+ "bbox": [
473
+ 174,
474
+ 92,
475
+ 823,
476
+ 119
477
+ ],
478
+ "page_idx": 5
479
+ },
480
+ {
481
+ "type": "text",
482
+ "text": "As shown in Fig. 3, we design the $\\mathrm { S e g V i T }$ structure with one single layer as the baseline (a). We first try a naive approach (b), which is to apply the QD once at the $^ 1 / 3$ depth of the backbone (e.g., the 8th layer of a backbone with 24 layers) to down-sample the resolution of the layer output from $^ { 1 / 1 6 }$ to $1 / \\bar { 3 } 2$ so as to reduce the overall computational cost. The performance drops as expected since the QD process involves information lose. ",
483
+ "bbox": [
484
+ 174,
485
+ 126,
486
+ 823,
487
+ 194
488
+ ],
489
+ "page_idx": 5
490
+ },
491
+ {
492
+ "type": "text",
493
+ "text": "To compensate for the information loss in the naive ‘shrunk’ version, we further apply two QU layers in parallel with the backbone. This is our proposed Shrunk version (c). The first QU layer takes in features with $^ { 1 / 1 6 }$ resolution from the low level of the backbone. Its output is then used as the query to make cross attention with the down-sampled features with $^ { 1 / 3 2 }$ resolution from the last layer of the backbone. The shape of the output of this QU structure is of $^ { 1 / 1 6 }$ resolution. ",
494
+ "bbox": [
495
+ 174,
496
+ 202,
497
+ 823,
498
+ 271
499
+ ],
500
+ "page_idx": 5
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "Directly reducing the number of the query tokens inevitably harms the final performance. However, with our designed QU layer and the ATM module, the Shrunk structure is able to reduce $4 0 \\%$ of overall computational cost while still being competitive in performance. ",
505
+ "bbox": [
506
+ 176,
507
+ 277,
508
+ 823,
509
+ 319
510
+ ],
511
+ "page_idx": 5
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "4 Experiments ",
516
+ "text_level": 1,
517
+ "bbox": [
518
+ 174,
519
+ 339,
520
+ 312,
521
+ 357
522
+ ],
523
+ "page_idx": 5
524
+ },
525
+ {
526
+ "type": "text",
527
+ "text": "4.1 Datasets ",
528
+ "text_level": 1,
529
+ "bbox": [
530
+ 174,
531
+ 371,
532
+ 271,
533
+ 386
534
+ ],
535
+ "page_idx": 5
536
+ },
537
+ {
538
+ "type": "text",
539
+ "text": "ADE20K [26] is a challenging scene parsing dataset which contains 20, 210 images as the training set and 2, 000 images as the validation set with 150 semantic classes. ",
540
+ "bbox": [
541
+ 174,
542
+ 397,
543
+ 823,
544
+ 425
545
+ ],
546
+ "page_idx": 5
547
+ },
548
+ {
549
+ "type": "text",
550
+ "text": "COCO-Stuff-10K [27] is a scene parsing benchmark with 9, 000 training images and 1, 000 test images. Even though the dataset contains 182 categories, not all categories exist in the test split. We follow the implementation of mmsegmentation [28] with 171 categories to conduct the experiments. ",
551
+ "bbox": [
552
+ 174,
553
+ 431,
554
+ 826,
555
+ 474
556
+ ],
557
+ "page_idx": 5
558
+ },
559
+ {
560
+ "type": "text",
561
+ "text": "PASCAL-Context [29] is a dataset with 4, 996 images in training set and 5, 104 images in the validation set. There are 60 semantic classes in total, including a class representing ‘background’. ",
562
+ "bbox": [
563
+ 173,
564
+ 479,
565
+ 823,
566
+ 508
567
+ ],
568
+ "page_idx": 5
569
+ },
570
+ {
571
+ "type": "text",
572
+ "text": "4.2 Implementation details ",
573
+ "text_level": 1,
574
+ "bbox": [
575
+ 176,
576
+ 526,
577
+ 374,
578
+ 540
579
+ ],
580
+ "page_idx": 5
581
+ },
582
+ {
583
+ "type": "text",
584
+ "text": "Transformer backbone. We use the naive ViT [5] as the backbone. In particular, we use its ‘Base’ variation for most ablation studies and provide results on the ‘Large’ variation. Since there can be a huge difference with different pre-trained weights, as suggested by Segmenter [8], we use the weights provided by Augreg [30] following the counterparts [8, 31] for a fair comparison. The weights are obtained by training on ImageNet-21k with strong data augmentation and regularization. For a simple reference, we report that for pre-trained weights provided by ViT [5] and Augreg [30], the mIoU scores using the same training recipe on ADE20K dataset are $5 1 . 7 \\%$ and $5 4 . 6 \\%$ , respectively. Training settings. We use MMSegmentation [28] and follow the commonly used training settings. During training, we applied data augmentation sequentially via random horizontal flipping, random resize with the ration between 0.5 and 2.0 and random cropping $5 1 2 \\times 5 1 2$ for all except that we use $4 8 0 \\times 4 8 0$ for PASCAL-Context and $6 4 0 \\times 6 4 0$ for ViT-large on ADE20K). The batch size is 16 for all datasets with a total iteration of $1 6 0 k$ , $8 0 k$ and $8 0 k$ for ADE20k, COCO-Stuff-10k and PASCAL-Context respectively. Evaluation metric. We use the mean Intersection over Union (mIoU) as the metric to evaluate the performance. ‘ss’ means single-scale testing and ‘ms’ test time augmentation with multi-scaled (0.5, 0.75, 1.0, 1.25, 1.5, 1.75) inputs. All reported mIoU scores are in a percentage format. All reported computational costs in GFLOPs are measured using the fvcore 2 library. ",
585
+ "bbox": [
586
+ 173,
587
+ 551,
588
+ 826,
589
+ 786
590
+ ],
591
+ "page_idx": 5
592
+ },
593
+ {
594
+ "type": "text",
595
+ "text": "4.3 Comparisons with the State-of-the-art Methods ",
596
+ "text_level": 1,
597
+ "bbox": [
598
+ 173,
599
+ 803,
600
+ 542,
601
+ 818
602
+ ],
603
+ "page_idx": 5
604
+ },
605
+ {
606
+ "type": "text",
607
+ "text": "Results on ADE20K. Table 1 reports the comparison with the state-of-the-art methods on ADE20K validation set using ViT backbone. The SegViT uses the ATM module with multi-layer inputs from the original ViT backbone, while the Shrunk is the one that conducts QD to the ViT backbone and saves $4 0 \\%$ of the computational cost without sacrificing too much performance. Our method achieves ",
608
+ "bbox": [
609
+ 174,
610
+ 829,
611
+ 825,
612
+ 886
613
+ ],
614
+ "page_idx": 5
615
+ },
616
+ {
617
+ "type": "table",
618
+ "img_path": "images/9c21daaf99193c185b9caecbd1326c0cebf7e5546b709e0fd715acafd72e4256.jpg",
619
+ "table_caption": [
620
+ "Table 1: Experiment results on the ADE20K val. split. ‘ms’ means that mIoU is calculated using multi-scale inference. ‘†’ means the models use the backbone weights pre-trained by AugReg [30]. ‘\\*’ represents the model is reproduced under the same settings as the official repo. The GFLOPs is measured at single-scale inference with the given crop size. "
621
+ ],
622
+ "table_footnote": [],
623
+ "table_body": "<table><tr><td>Method</td><td>Backbone</td><td>Crop Size</td><td>GFLOPs</td><td>mIoU (ss)</td><td>mIoU (ms)</td></tr><tr><td>UperNet* [32]</td><td>ViT-Base</td><td>512 × 512</td><td>&gt;250</td><td>46.6</td><td>47.5</td></tr><tr><td>DPT*[7]</td><td>ViT-Base</td><td>512 × 512</td><td>219.8</td><td>47.2</td><td>47.9</td></tr><tr><td>SETR-MLA* [6]</td><td>ViT-Base</td><td>512 × 512</td><td>113.5</td><td>48.2</td><td>49.3</td></tr><tr><td>Segmenter* [8]</td><td>ViT-Base</td><td>512 × 512</td><td>129.6</td><td>49.0</td><td>50.0</td></tr><tr><td>StructToken [31]</td><td>ViT-Base</td><td>512 × 512</td><td>&gt;150</td><td>50.9</td><td>51.8</td></tr><tr><td>SegViT (Ours)</td><td>ViT-Base</td><td>512 × 512</td><td>120.9</td><td>51.3</td><td>53.0</td></tr><tr><td>DPT* [7]</td><td>ViT-Large†</td><td>640 × 640</td><td>479.0</td><td>49.2</td><td>49.5</td></tr><tr><td>UperNet* [32]</td><td>ViT-Larget</td><td>640 × 640</td><td>&gt;700</td><td>48.6</td><td>50.0</td></tr><tr><td>SETR-MLA [6]</td><td>ViT-Large</td><td>512 × 512</td><td>368.6</td><td>48.6</td><td>50.3</td></tr><tr><td>MCIBI [33]</td><td>ViT-Large</td><td>512 × 512</td><td>&gt;400</td><td>1</td><td>50.8</td></tr><tr><td>Segmenter [8]</td><td>ViT-Large†</td><td>640 × 640</td><td>671.8</td><td>51.8</td><td>53.6</td></tr><tr><td>StructToken [31]</td><td>ViT-Larget</td><td>640 × 640</td><td>&gt;700</td><td>52.8</td><td>54.2</td></tr><tr><td>SegViT (Shrunk, ours)</td><td>ViT-Large†</td><td>640 × 640</td><td>373.5</td><td>53.9</td><td>55.1</td></tr><tr><td>SegViT (ours)</td><td>ViT-Larget</td><td>640 × 640</td><td>637.9</td><td>54.6</td><td>55.2</td></tr></table>",
624
+ "bbox": [
625
+ 196,
626
+ 159,
627
+ 802,
628
+ 410
629
+ ],
630
+ "page_idx": 6
631
+ },
632
+ {
633
+ "type": "text",
634
+ "text": "$5 5 . 2 \\%$ in terms of mIoU with the ViT-Large backbone. It is $1 . 0 \\%$ better than the recent StructToken [31] using the same backbone. Besides, our Shrunk version can also achieve a similar performance $5 5 . 1 \\%$ with computational cost 373.5 GFLOPs which is much less than the ViT-Large backbone alone (612.3 GFLOPs). ",
635
+ "bbox": [
636
+ 174,
637
+ 434,
638
+ 823,
639
+ 489
640
+ ],
641
+ "page_idx": 6
642
+ },
643
+ {
644
+ "type": "text",
645
+ "text": "Results on COCO-Stuff-10K. Table 2 shows the result on the COCO-Stuff-10K dataset. Our method achieves $5 0 . 3 \\%$ which is higher than the previous state-to-the-art StrucToken by $1 . 2 \\%$ with less computational cost. Our Shrunk version achieves $4 9 . 4 \\%$ with 224.8 GFLOPs, which is similar to the computational cost of a dilated ResNet-101 backbone but with much higher performance. ",
646
+ "bbox": [
647
+ 173,
648
+ 498,
649
+ 825,
650
+ 554
651
+ ],
652
+ "page_idx": 6
653
+ },
654
+ {
655
+ "type": "table",
656
+ "img_path": "images/0b583c52df848c23cfc6ddc73f497b0eea84afbcff224c85f8c18ea7d41e244f.jpg",
657
+ "table_caption": [
658
+ "Table 2: Experiment results on the COCO-Stuff-10K test. split. Following published methods, we report the results with multi-scale inference (denoted by ‘ms’). The GFLOPs is measured at single scale inference with a crop size of $5 1 2 \\times 5 1 2$ . "
659
+ ],
660
+ "table_footnote": [],
661
+ "table_body": "<table><tr><td>Method</td><td>Backbone</td><td>GFLOPs</td><td>mIoU (ms)</td></tr><tr><td>DANet [34]</td><td>Dilated-ResNet-101</td><td>289.3</td><td>39.7</td></tr><tr><td>MaskFormer[15]</td><td>ResNet-101-fpn</td><td>81.7</td><td>39.8</td></tr><tr><td>EMANet [35]</td><td>Dilated-ResNet-101</td><td>247.4</td><td>39.9</td></tr><tr><td>SpyGR [36]</td><td>ResNet-101-fpn</td><td>v80</td><td>39.9</td></tr><tr><td>OCRNet [3]</td><td>HRNetV2-W48</td><td>167.9</td><td>40.5</td></tr><tr><td>GINet [37]</td><td>JPU-ResNet-101</td><td>&gt;200</td><td>40.6</td></tr><tr><td>RecoNet [38]</td><td>Dilated-ResNet-101</td><td>&gt;200</td><td>41.5</td></tr><tr><td>ISNet [39]</td><td>Dilated-ResNeSt-101</td><td>228.3</td><td>42.1</td></tr><tr><td>MCIBI [33]</td><td>ViT-Large</td><td>&gt;380</td><td>44.9</td></tr><tr><td>StructToken [31]</td><td>ViT-Large</td><td>&gt;400</td><td>49.1</td></tr><tr><td>SegViT (Shrunk, ours)</td><td>ViT-Large</td><td>224.8</td><td>49.4</td></tr><tr><td>SegViT (ours)</td><td>ViT-Large</td><td>383.9</td><td>50.3</td></tr></table>",
662
+ "bbox": [
663
+ 248,
664
+ 623,
665
+ 748,
666
+ 825
667
+ ],
668
+ "page_idx": 6
669
+ },
670
+ {
671
+ "type": "text",
672
+ "text": "Results on PASCAL-Context. Table 3 shows the results on the PASCAL-Context dataset. We follow HRNet [40] to evaluate our method and report the results under 59 classes (without background) and 60 classes (with background). $\\mathrm { S e g V i T }$ reaches mIoU $6 5 . 3 \\%$ and $5 9 . 3 \\%$ respectively for those two metrics that outperform the state-of-the-art methods using the ViT backbones with less computational cost. ",
673
+ "bbox": [
674
+ 173,
675
+ 842,
676
+ 825,
677
+ 911
678
+ ],
679
+ "page_idx": 6
680
+ },
681
+ {
682
+ "type": "table",
683
+ "img_path": "images/729ab20c4ff5ade5825d1fcfeb4332c2e4feac4a6721756dbbc357d28b3f6978.jpg",
684
+ "table_caption": [
685
+ "Table 3: Expperiment results on the PASCAL-Context val. split. Following published methods, we report the results with multi-scale inference (denoted by ‘ms’). $\\mathrm { m I o U _ { 5 9 } }$ : mIoU averaged over 59 classes (without background). $\\mathrm { m I o U _ { 6 0 } }$ : mIoU averaged over 60 classes (59 classes plus background). Both metrics were used in the literature; and we report for the 60 classes. The GFLOPs is measured at single scale inference with a crop size of $4 8 0 \\times 4 8 0$ . "
686
+ ],
687
+ "table_footnote": [],
688
+ "table_body": "<table><tr><td>Method</td><td>Backbone</td><td>GFLOPs</td><td>mIoU59 (ms)</td><td>mIoU60 (ms)</td></tr><tr><td>RefineNet [41]</td><td>ResNet-152</td><td></td><td>=</td><td>47.3</td></tr><tr><td>UNet++ [42]</td><td>ResNet-101</td><td>=</td><td>47.7</td><td>1</td></tr><tr><td>PSPNet [11]</td><td>Dilated-ResNet-101</td><td>157.0</td><td>47.8</td><td></td></tr><tr><td>Ding et al. [43]</td><td>ResNet-101</td><td>=</td><td>51.6</td><td></td></tr><tr><td>EncNet [44]</td><td>Dilated-ResNet-101</td><td>192.1</td><td>52.6</td><td>=</td></tr><tr><td>HRNet [40]</td><td>HRNetV2-W48</td><td>82.7</td><td>54.0</td><td>48.3</td></tr><tr><td>NRD [45]</td><td>ResNet-101</td><td>42.9</td><td>54.1</td><td>49.0</td></tr><tr><td>GFFNet [46]</td><td>Dilated-ResNet-101</td><td>=</td><td>54.3</td><td>1</td></tr><tr><td>EfficientFCN [47]</td><td>ResNet-101</td><td>52.8</td><td>55.3</td><td></td></tr><tr><td>OCRNet [3]</td><td>HRNetV2-W48</td><td>143.9</td><td>56.2</td><td>=</td></tr><tr><td>SETR-MLA [6]</td><td>ViT-Large</td><td>318.5</td><td>1</td><td>55.8</td></tr><tr><td>Segmenter [8]</td><td>ViT-Large</td><td>346.2</td><td>1</td><td>59.0</td></tr><tr><td>SegViT (Shrunk, ours)</td><td>ViT-Large</td><td>186.9</td><td>63.7</td><td>57.4</td></tr><tr><td>SegViT (ours)</td><td>ViT-Large</td><td>321.6</td><td>65.3</td><td>59.3</td></tr></table>",
689
+ "bbox": [
690
+ 194,
691
+ 172,
692
+ 803,
693
+ 402
694
+ ],
695
+ "page_idx": 7
696
+ },
697
+ {
698
+ "type": "text",
699
+ "text": "4.4 Ablation Study ",
700
+ "text_level": 1,
701
+ "bbox": [
702
+ 174,
703
+ 428,
704
+ 318,
705
+ 444
706
+ ],
707
+ "page_idx": 7
708
+ },
709
+ {
710
+ "type": "text",
711
+ "text": "In this section, we conduct the ablation study to show the effectiveness of our proposed methods. ",
712
+ "bbox": [
713
+ 171,
714
+ 454,
715
+ 808,
716
+ 469
717
+ ],
718
+ "page_idx": 7
719
+ },
720
+ {
721
+ "type": "text",
722
+ "text": "Effect of the ATM module. Table 4 shows the effect of the ATM module. We set the SETR-naive as the baseline, which uses two $1 \\times 1$ convolutions to get per-pixel classifications directly from the last layer of the ViT-Base transformer output. We can see that by applying the ATM module and supervise with a regular cross-entropy loss, ATM is capable of providing $0 . 5 \\%$ of performance boost. However, it is more beneficial to decouple the classification and mask prediction process and use the mask and classification supervision separately ( $3 . 1 \\%$ increase). ",
723
+ "bbox": [
724
+ 173,
725
+ 478,
726
+ 825,
727
+ 563
728
+ ],
729
+ "page_idx": 7
730
+ },
731
+ {
732
+ "type": "text",
733
+ "text": "Ablation of using different layers as input for SegViT. Table 5 shows the performance boost that multiple layers input can provide. We can see that the performance boost of feature maps from additional lower layers is obvious $( + 1 . 3 \\% )$ . We then involved more layers of features and see further performance gains. We empirically choose to use three layers for its best performance. ",
734
+ "bbox": [
735
+ 173,
736
+ 573,
737
+ 825,
738
+ 628
739
+ ],
740
+ "page_idx": 7
741
+ },
742
+ {
743
+ "type": "table",
744
+ "img_path": "images/ac5b061d71ad9f28fce0e869aa08b32787302bd4ee61a4793ecb7ecd49dbed4d.jpg",
745
+ "table_caption": [
746
+ "Table 4: Comparison between our proposed ATM module with other methods. ‘CE loss’ indicates the cross-entropy loss that is commonly used in semantic segmentation. The experiments are carried out on the ViT-Base backbone using ADE20K dataset. "
747
+ ],
748
+ "table_footnote": [],
749
+ "table_body": "<table><tr><td>Decoder</td><td>Loss</td><td>mIoU (ss)</td></tr><tr><td>SETR</td><td>CE loss</td><td>46.5</td></tr><tr><td>ATM</td><td>CE loss</td><td>47.0 (+0.5)</td></tr><tr><td>ATM</td><td>Lmask loss</td><td>49.6 (+3.1)</td></tr></table>",
750
+ "bbox": [
751
+ 200,
752
+ 739,
753
+ 465,
754
+ 813
755
+ ],
756
+ "page_idx": 7
757
+ },
758
+ {
759
+ "type": "table",
760
+ "img_path": "images/bc6fbb7293f2ba28f395e2e5d6491090dd3037b38f9188ca735c81880b86d51f.jpg",
761
+ "table_caption": [
762
+ "Table 5: Ablation results of using different layer inputs to the $\\mathrm { S e g V i T }$ structure on ADE20K dataset using ViT-Base as the backbone. Involving multi-layer features can bring obvious performance gain. "
763
+ ],
764
+ "table_footnote": [],
765
+ "table_body": "<table><tr><td></td><td>Used layers</td><td>mIoU (ss)</td></tr><tr><td>Single</td><td>[12]</td><td>49.6</td></tr><tr><td>Cascade</td><td>[6,12]</td><td>50.9 (+1.3)</td></tr><tr><td>Cascade</td><td>[6,8,12]</td><td>51.3 (+1.7)</td></tr><tr><td>Cascade</td><td>[3,6,9,12]</td><td>51.2 (+1.6)</td></tr></table>",
766
+ "bbox": [
767
+ 535,
768
+ 726,
769
+ 805,
770
+ 813
771
+ ],
772
+ "page_idx": 7
773
+ },
774
+ {
775
+ "type": "text",
776
+ "text": "Ablation for the ATM Decoder. We conduct experiments to show the effectiveness of the proposed ATM decoder ",
777
+ "bbox": [
778
+ 173,
779
+ 830,
780
+ 823,
781
+ 859
782
+ ],
783
+ "page_idx": 7
784
+ },
785
+ {
786
+ "type": "text",
787
+ "text": "$\\mathbf { S e g V i T }$ on hierarchical backbones. Shown in Table 6, the $\\mathrm { S e g V i T }$ structure is also able to apply to hierarchical backbones. We choose the most competitive methods Maskformer [15] and Mask2former [48] for comparison. Results indicate that even though our method is not designed for hierarchical backbones, we can still achieve competitive performance while being efficient in terms of computational cost. ",
788
+ "bbox": [
789
+ 174,
790
+ 868,
791
+ 825,
792
+ 911
793
+ ],
794
+ "page_idx": 7
795
+ },
796
+ {
797
+ "type": "table",
798
+ "img_path": "images/84d87f08605aed65b1eb108427f3441a9120c896572a734c3f0f2ca4e188a09d.jpg",
799
+ "table_caption": [
800
+ "Table 6: The experiments use the Swin-Tiny [18] backbone and are carried out on the ADE20K dataset. The GFLOPs are measured at single scale inference with a crop size of $5 1 2 \\times 5 1 2$ . QD: query-based down-saumping. QU: query-based upsampling. "
801
+ ],
802
+ "table_footnote": [],
803
+ "table_body": "<table><tr><td>Method</td><td>mIoU (ss)</td><td>GFLOPs</td></tr><tr><td>Maskformer [15]</td><td>46.7</td><td>57.3</td></tr><tr><td>Mask2former [48]</td><td>47.7</td><td>73.7</td></tr><tr><td>SegViT (Ours)</td><td>47.1</td><td>48.0</td></tr></table>",
804
+ "bbox": [
805
+ 179,
806
+ 185,
807
+ 488,
808
+ 258
809
+ ],
810
+ "page_idx": 8
811
+ },
812
+ {
813
+ "type": "table",
814
+ "img_path": "images/dd2f8f1ef13234c2c51fb56775012722a1694576ce975fda479599b3d19151cd.jpg",
815
+ "table_caption": [
816
+ "Table 7: Ablation of the QD module in terms of the targets and methods to down-sample. The experiments are carried out on the ViT-Large backbone of ADE20K dataset. "
817
+ ],
818
+ "table_footnote": [],
819
+ "table_body": "<table><tr><td>Applied to</td><td>Methods</td><td>mIoU (ss)</td></tr><tr><td>Q</td><td>Conv</td><td>44.5</td></tr><tr><td>Q,K,V</td><td>Nearest</td><td>52.6</td></tr><tr><td>Q</td><td>Nearest</td><td>53.9</td></tr></table>",
820
+ "bbox": [
821
+ 542,
822
+ 171,
823
+ 797,
824
+ 244
825
+ ],
826
+ "page_idx": 8
827
+ },
828
+ {
829
+ "type": "text",
830
+ "text": "",
831
+ "bbox": [
832
+ 173,
833
+ 280,
834
+ 825,
835
+ 309
836
+ ],
837
+ "page_idx": 8
838
+ },
839
+ {
840
+ "type": "text",
841
+ "text": "Ablation for the QD module. The motivation to use QD is to make use of the pre-train weights of the backbone. As in Table 7, if we use a stride 2 convolution with learnable parameters to downsample the query, it will destroy the pre-train weights and dramatically decrease the performance. If the down-sampling is applied to both Q and (K, V), there will be an inevitable loss in information during the down-sampling process which is reflected in the weaker performance. We found that applying $2 \\times 2$ nearest down-sampling on query only for the QD module is the better option. ",
842
+ "bbox": [
843
+ 173,
844
+ 318,
845
+ 825,
846
+ 401
847
+ ],
848
+ "page_idx": 8
849
+ },
850
+ {
851
+ "type": "text",
852
+ "text": "Ablation of the components in Shrunk structure. Shown in Table 8, we studied the effect of each component (QD and QU) in the Shrunk structure. The results presented matches the structures illustrated in Fig. 3. When QD is applied, the performance decreases by $2 . 7 \\%$ from the ‘Single’ ATM head. However, by applying QU, the performance is recovered. QD learns a non-linear downsampling by the attention mechanism between key and query. One query will attend to several keys. QU is used to preserve the resolution and at the same time provide low-level feature information. We can see that by using QD and QU jointly, the performance can be retained and the computational cost is reduced. ATM module can also be used as the decoder to form our Shrunk structure to further boost performance. ",
853
+ "bbox": [
854
+ 174,
855
+ 409,
856
+ 825,
857
+ 534
858
+ ],
859
+ "page_idx": 8
860
+ },
861
+ {
862
+ "type": "table",
863
+ "img_path": "images/cd394096c31085022cbbf856decfbe6de1c08d96a54e91751e80bdd4e34901a0.jpg",
864
+ "table_caption": [
865
+ "Table 8: Ablation results of Shrunk version on the ADE20K dataset. The GFLOPs are measured at single scale inference with a crop size of $5 1 2 \\times 5 1 2$ on ViT-Base backbone. "
866
+ ],
867
+ "table_footnote": [],
868
+ "table_body": "<table><tr><td> Structure</td><td>QD</td><td>QU</td><td>Head</td><td>mIoU (ss)</td><td>GFLOPs</td></tr><tr><td>Single</td><td></td><td></td><td>SETR</td><td>46.5</td><td>107.3</td></tr><tr><td>Single</td><td></td><td></td><td>ATM</td><td>49.6 (+3.1)</td><td>115.8</td></tr><tr><td>Naive Shrunk</td><td>&lt;</td><td></td><td>ATM</td><td>46.9 (+0.4)</td><td>74.1</td></tr><tr><td>Shrunk</td><td></td><td>√</td><td>ATM</td><td>50.0 (+3.5)</td><td>97.1</td></tr></table>",
869
+ "bbox": [
870
+ 284,
871
+ 570,
872
+ 714,
873
+ 656
874
+ ],
875
+ "page_idx": 8
876
+ },
877
+ {
878
+ "type": "text",
879
+ "text": "5 Conclusion ",
880
+ "text_level": 1,
881
+ "bbox": [
882
+ 173,
883
+ 680,
884
+ 299,
885
+ 696
886
+ ],
887
+ "page_idx": 8
888
+ },
889
+ {
890
+ "type": "text",
891
+ "text": "We proposed an effective structure using plain ViT transformer backbones termed $\\mathrm { S e g V i T }$ for the semantic segmentation task. For the first time, we utilize spatial information in attention maps for semantic segmentation. To implement this idea, we proposed an Attention-to-mask (ATM) module that can derive mask predictions during the attention calculation process. We show on a number of semantic segmentation benchmarks that our method is efficient and achieves state-of-the-art performance. We also proposed a Shrunk structure which is applied to the backbone and capable of reducing $4 0 \\%$ of the computational cost while still maintaining competitive performance. We believe both structures can be strong paradigms, especially for semantic segmentation using ViT backbones. Last but not the least, our method still has some limitations. One of the limitations is that the large amount of GPU memory consumed by the global attention mechanism might not be supported by some devices, which might restrict the applicability of our structures. ",
892
+ "bbox": [
893
+ 173,
894
+ 710,
895
+ 825,
896
+ 863
897
+ ],
898
+ "page_idx": 8
899
+ },
900
+ {
901
+ "type": "text",
902
+ "text": "Acknowledgments C. Shen’s participation was in part supported by a major grant from Zhejiang Provincial Government. This work was also supported by the start-up funding of the University of Adelaide. [grant number 15130411]. This research was supported by Meituan. ",
903
+ "bbox": [
904
+ 176,
905
+ 869,
906
+ 825,
907
+ 911
908
+ ],
909
+ "page_idx": 8
910
+ },
911
+ {
912
+ "type": "text",
913
+ "text": "References ",
914
+ "text_level": 1,
915
+ "bbox": [
916
+ 174,
917
+ 89,
918
+ 267,
919
+ 106
920
+ ],
921
+ "page_idx": 9
922
+ },
923
+ {
924
+ "type": "text",
925
+ "text": "IEEE Conf. Comp. Vis. Patt. Recogn., pp. 3431–3440, 2015. \n[2] L.-C. Chen, G. Papandreou, I. Kokkinos, K. Murphy, and A. Yuille, “Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 40, no. 4, pp. 834–848, 2017. \n[3] Y. Yuan, X. Chen, and J. Wang, “Object-contextual representations for semantic segmentation,” in Proc. Eur. Conf. Comp. Vis., pp. 173–190, Springer, 2020. \n[4] T.-Y. Lin, P. Dollár, R. Girshick, K. He, B. Hariharan, and S. Belongie, “Feature pyramid networks for object detection,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 2117–2125, 2017. \n[5] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, et al., “An image is worth 16x16 words: Transformers for image recognition at scale,” Proc. Int. Conf. Learn. Representations, 2021. \n[6] S. Zheng, J. Lu, H. Zhao, X. Zhu, Z. Luo, Y. Wang, Y. Fu, J. Feng, T. Xiang, P. H. Torr, et al., “Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 6881–6890, 2021. \n[7] R. Ranftl, A. Bochkovskiy, and V. Koltun, “Vision transformers for dense prediction,” in Proc. IEEE Int. Conf. Comp. Vis., pp. 12179–12188, 2021. \n[8] R. Strudel, R. Garcia, I. Laptev, and C. Schmid, “Segmenter: Transformer for semantic segmentation,” in Proc. IEEE Int. Conf. Comp. Vis., pp. 7262–7272, 2021. \n[9] C. Farabet, C. Couprie, L. Najman, and Y. LeCun, “Learning hierarchical features for scene labeling,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 35, no. 8, pp. 1915–1929, 2012. \n[10] J. Long, E. Shelhamer, and T. Darrell, “Fully convolutional networks for semantic segmentation,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 3431–3440, 2015. \n[11] H. Zhao, J. Shi, X. Qi, X. Wang, and J. Jia, “Pyramid scene parsing network,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2017. \n[12] L.-C. Chen, Y. Zhu, G. Papandreou, F. Schroff, and H. Adam, “Encoder-decoder with atrous separable convolution for semantic image segmentation,” in Proc. Eur. Conf. Comp. Vis., pp. 801–818, 2018. \n[13] J. Fu, J. Liu, J. Jiang, Y. Li, Y. Bao, and H. Lu, “Scene segmentation with dual relation-aware attention network,” IEEE Trans. Neural Netw. & Learn. Syst., vol. 32, no. 6, pp. 2547–2560, 2020. \n[14] C. Yu, J. Wang, C. Gao, G. Yu, C. Shen, and N. Sang, “Context prior for scene segmentation,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 12416–12425, 2020. \n[15] B. Cheng, A. Schwing, and A. Kirillov, “Per-pixel classification is not all you need for semantic segmentation,” Proc. Advances in Neural Inf. Process. Syst., vol. 34, 2021. \n[16] W. Zhang, J. Pang, K. Chen, and C. C. Loy, “K-net: Towards unified image segmentation,” Proc. Advances in Neural Inf. Process. Syst., vol. 34, 2021. \n[17] W. Wang, E. Xie, X. Li, D.-P. Fan, K. Song, D. Liang, T. Lu, P. Luo, and L. Shao, “Pyramid vision transformer: A versatile backbone for dense prediction without convolutions,” in Proc. IEEE Int. Conf. Comp. Vis., pp. 568–578, 2021. \n[18] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo, “Swin transformer: Hierarchical vision transformer using shifted windows,” in Proc. IEEE Int. Conf. Comp. Vis., pp. 10012–10022, 2021. \n[19] X. Chu, Z. Tian, Y. Wang, B. Zhang, H. Ren, X. Wei, H. Xia, and C. Shen, “Twins: Revisiting the design of spatial attention in vision transformers,” Proc. Advances in Neural Inf. Process. Syst., vol. 34, 2021. \n[20] E. Xie, W. Wang, Z. Yu, A. Anandkumar, J. M. Alvarez, and P. Luo, “Segformer: Simple and efficient design for semantic segmentation with transformers,” Proc. Advances in Neural Inf. Process. Syst., vol. 34, 2021. \n[21] Y.-H. Wu, Y. Liu, X. Zhan, and M.-M. Cheng, “P2t: Pyramid pooling transformer for scene understanding,” IEEE Trans. Pattern Anal. Mach. Intell., 2022. \n[22] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár, “Focal loss for dense object detection,” in Proc. IEEE Int. Conf. Comp. Vis., pp. 2980–2988, 2017. \n[23] F. Milletari, N. Navab, and S.-A. Ahmadi, “V-net: Fully convolutional neural networks for volumetric medical image segmentation,” in 3DV, pp. 565–571, IEEE, 2016. \n[24] N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, and S. Zagoruyko, “End-to-end object detection with transformers,” in Proc. Eur. Conf. Comp. Vis., pp. 213–229, Springer, 2020. \n[25] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, “Attention is all you need,” Proc. Advances in Neural Inf. Process. Syst., vol. 30, 2017. \n[26] B. Zhou, H. Zhao, X. Puig, S. Fidler, A. Barriuso, and A. Torralba, “Scene parsing through ade20k dataset,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 633–641, 2017. \n[27] H. Caesar, J. Uijlings, and V. Ferrari, “Coco-stuff: Thing and stuff classes in context,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 1209–1218, 2018. \n[28] MMSegmentation, “MMSegmentation: OpenMMLab semantic segmentation toolbox and benchmark.” https://github.com/open-mmlab/mmsegmentation, 2020. \n[29] R. Mottaghi, X. Chen, X. Liu, N.-G. Cho, S.-W. Lee, S. Fidler, R. Urtasun, and A. Yuille, “The role of context for object detection and semantic segmentation in the wild,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 891–898, 2014. \n[30] A. Steiner, A. Kolesnikov, X. Zhai, R. Wightman, J. Uszkoreit, and L. Beyer, “How to train your vit? data, augmentation, and regularization in vision transformers,” arXiv: Comp. Res. Repository, 2021. \n[31] F. Lin, Z. Liang, J. He, M. Zheng, S. Tian, and K. Chen, “Structtoken: Rethinking semantic segmentation with structural prior,” arXiv: Comp. Res. Repository, 2022. \n[32] T. Xiao, Y. Liu, B. Zhou, Y. Jiang, and J. Sun, “Unified perceptual parsing for scene understanding,” in Proc. Eur. Conf. Comp. Vis., pp. 418–434, 2018. \n[33] Z. Jin, T. Gong, D. Yu, Q. Chu, J. Wang, C. Wang, and J. Shao, “Mining contextual information beyond image for semantic segmentation,” in Proc. IEEE Int. Conf. Comp. Vis., pp. 7231–7241, 2021. \n[34] J. Fu, J. Liu, H. Tian, Y. Li, Y. Bao, Z. Fang, and H. Lu, “Dual attention network for scene segmentation,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 3146–3154, 2019. \n[35] X. Li, Z. Zhong, J. Wu, Y. Yang, Z. Lin, and H. Liu, “Expectation-maximization attention networks for semantic segmentation,” in Proc. IEEE Int. Conf. Comp. Vis., pp. 9167–9176, 2019. \n[36] X. Li, Y. Yang, Q. Zhao, T. Shen, Z. Lin, and H. Liu, “Spatial pyramid based graph reasoning for semantic segmentation,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 8950–8959, 2020. \n[37] T. Wu, Y. Lu, Y. Zhu, C. Zhang, M. Wu, Z. Ma, and G. Guo, “Ginet: Graph interaction network for scene parsing,” in Proc. Eur. Conf. Comp. Vis., pp. 34–51, Springer, 2020. \n[38] W. Chen, X. Zhu, R. Sun, J. He, R. Li, X. Shen, and B. Yu, “Tensor low-rank reconstruction for semantic segmentation,” in Proc. Eur. Conf. Comp. Vis., pp. 52–69, Springer, 2020. \n[39] Z. Jin, B. Liu, Q. Chu, and N. Yu, “Isnet: Integrate image-level and semantic-level context for semantic segmentation,” in Proc. IEEE Int. Conf. Comp. Vis., pp. 7189–7198, 2021. \n[40] K. Sun, Y. Zhao, B. Jiang, T. Cheng, B. Xiao, D. Liu, Y. Mu, X. Wang, W. Liu, and J. Wang, “Highresolution representations for labeling pixels and regions,” arXiv: Comp. Res. Repository, 2019. \n[41] G. Lin, A. Milan, C. Shen, and I. Reid, “RefineNet: Multi-path refinement networks for high-resolution semantic segmentation,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 1925–1934, 2017. \n[42] Z. Zhou, M. M. R. Siddiquee, N. Tajbakhsh, and J. Liang, “Unet++: A nested U-net architecture for medical image segmentation,” in Proc. Deep Learning in Medical Image Analysis Workshop, pp. 3–11, 2018. \n[43] H. Ding, X. Jiang, B. Shuai, A. Q. Liu, and G. Wang, “Context contrasted feature and gated multi-scale aggregation for scene segmentation,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 2393–2402, 2018. \n[44] H. Zhang, K. Dana, J. Shi, Z. Zhang, X. Wang, A. Tyagi, and A. Agrawal, “Context encoding for semantic segmentation,” in Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pp. 7151–7160, 2018. \n[45] B. Zhang, Z. Tian, C. Shen, et al., “Dynamic neural representational decoders for high-resolution semantic segmentation,” Proc. Advances in Neural Inf. Process. Syst., vol. 34, 2021. \n[46] X. Li, H. Zhao, L. Han, Y. Tong, S. Tan, and K. Yang, “Gated fully fusion for semantic segmentation,” in Proc. AAAI Conf. Artificial Intell., vol. 34, pp. 11418–11425, 2020. \n[47] J. Liu, J. He, J. Zhang, J. Ren, and H. Li, “EfficientFCN: Holistically-guided decoding for semantic segmentation,” in Proc. Eur. Conf. Comp. Vis., 2020. \n[48] B. Cheng, I. Misra, A. G. Schwing, A. Kirillov, and R. Girdhar, “Masked-attention mask transformer for universal image segmentation,” 2022. ",
926
+ "bbox": [
927
+ 171,
928
+ 131,
929
+ 828,
930
+ 912
931
+ ],
932
+ "page_idx": 9
933
+ },
934
+ {
935
+ "type": "text",
936
+ "text": "",
937
+ "bbox": [
938
+ 171,
939
+ 92,
940
+ 826,
941
+ 727
942
+ ],
943
+ "page_idx": 10
944
+ },
945
+ {
946
+ "type": "text",
947
+ "text": "Checklist ",
948
+ "text_level": 1,
949
+ "bbox": [
950
+ 174,
951
+ 755,
952
+ 254,
953
+ 770
954
+ ],
955
+ "page_idx": 10
956
+ },
957
+ {
958
+ "type": "text",
959
+ "text": "1. For all authors... ",
960
+ "bbox": [
961
+ 214,
962
+ 780,
963
+ 330,
964
+ 792
965
+ ],
966
+ "page_idx": 10
967
+ },
968
+ {
969
+ "type": "text",
970
+ "text": "(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] \n(b) Did you describe the limitations of your work? [Yes] \n(c) Did you discuss any potential negative societal impacts of your work? [No] We conduct experiments on a fundamental task of semantic segmentation. This technique may be used for editing fake images to mislead the public if being used by someone who has ulterior motives. \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
971
+ "bbox": [
972
+ 230,
973
+ 797,
974
+ 825,
975
+ 893
976
+ ],
977
+ "page_idx": 10
978
+ },
979
+ {
980
+ "type": "text",
981
+ "text": "2. If you are including theoretical results... ",
982
+ "bbox": [
983
+ 214,
984
+ 898,
985
+ 467,
986
+ 911
987
+ ],
988
+ "page_idx": 10
989
+ },
990
+ {
991
+ "type": "text",
992
+ "text": "(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A] ",
993
+ "bbox": [
994
+ 238,
995
+ 92,
996
+ 691,
997
+ 121
998
+ ],
999
+ "page_idx": 11
1000
+ },
1001
+ {
1002
+ "type": "text",
1003
+ "text": "3. If you ran experiments... ",
1004
+ "bbox": [
1005
+ 214,
1006
+ 126,
1007
+ 377,
1008
+ 138
1009
+ ],
1010
+ "page_idx": 11
1011
+ },
1012
+ {
1013
+ "type": "text",
1014
+ "text": "(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We included the code for the main experiments in the supplemental materials. All the code will be released upon acceptance. \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See implementation details. \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We fix the random seed and other random operators \n(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See the implementation details and GFLOPs in tables. ",
1015
+ "bbox": [
1016
+ 240,
1017
+ 142,
1018
+ 825,
1019
+ 265
1020
+ ],
1021
+ "page_idx": 11
1022
+ },
1023
+ {
1024
+ "type": "text",
1025
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1026
+ "bbox": [
1027
+ 214,
1028
+ 268,
1029
+ 767,
1030
+ 281
1031
+ ],
1032
+ "page_idx": 11
1033
+ },
1034
+ {
1035
+ "type": "text",
1036
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] \n(b) Did you mention the license of the assets? [No] The license can be found in their own homepages. \n(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We include our trained model in the supplemental material. \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] All the data are public benchmarks. \n(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] All the data are public benchmarks. ",
1037
+ "bbox": [
1038
+ 240,
1039
+ 286,
1040
+ 825,
1041
+ 397
1042
+ ],
1043
+ "page_idx": 11
1044
+ },
1045
+ {
1046
+ "type": "text",
1047
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1048
+ "bbox": [
1049
+ 212,
1050
+ 401,
1051
+ 658,
1052
+ 415
1053
+ ],
1054
+ "page_idx": 11
1055
+ },
1056
+ {
1057
+ "type": "text",
1058
+ "text": "(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] \n(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] \n(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] ",
1059
+ "bbox": [
1060
+ 240,
1061
+ 419,
1062
+ 825,
1063
+ 501
1064
+ ],
1065
+ "page_idx": 11
1066
+ }
1067
+ ]
parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c815020b9bec650cf4b9b075ef11edb989316936a6cb0180794008cbde96273b
3
+ size 1646615
parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d1348acd33c3e8baee6a1b48c7ebe4ec6b6fb44876c0fbb54a144961fe2fb24
3
+ size 1260981
parse/dev/5NTt8GFjUHkr/5NTt8GFjUHkr_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f970e20bcda45325b1c8261c700e198c1e9c3d152526a48d771b5bed00d6b0f3
3
+ size 1641334
parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9fa95fd6b9bc5caaca1aa475249ce48689ad19ce8705c70cf8dccbbb18cb2204
3
+ size 893815
parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb481b47b7b37a05f609816a8a1dc0938d22335dbcd816d198bd33e7bbba0734
3
+ size 757583
parse/dev/5Xc1ecxO1h/5Xc1ecxO1h_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95e8c2e2b93a5b02f51a9d8ec26c8b402de22cea38fd143c3b46cda0733bbd9b
3
+ size 902110
parse/dev/5btWTw1vcw1/5btWTw1vcw1_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8b8e3101de0085cce23367ff670b0266ff63c2a93fcbb01600be4cfb25dc603
3
+ size 1583608
parse/dev/5btWTw1vcw1/5btWTw1vcw1_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a412783a9a13c4bafe6014d12b79bd704539e0f93528a78123ef65177738eb7d
3
+ size 1374946
parse/dev/5btWTw1vcw1/5btWTw1vcw1_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6c00c60cd575c5dc7b979ed179b07b798d9e3f2d58cbc61cca7ac00333d6108
3
+ size 1600133
parse/dev/5haAJAcofjc/5haAJAcofjc_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:484b3593c740d73deb75b5fd8f10a5c20f2eb46af2f3da40ca43031f7badd8ed
3
+ size 817569
parse/dev/5haAJAcofjc/5haAJAcofjc_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccee87f0809d091a5bf28db46653e6f61027814f73728bb122049b43923631df
3
+ size 599800
parse/dev/5haAJAcofjc/5haAJAcofjc_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdec4fc5f9e1335c57fa4541eeb91a3f362fcf4704023d1e96199bb8e85160fe
3
+ size 826705
parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e86434c8e480aba68abca4fdfcb26492bd4dbc8bb45230407e4dfb2589a22914
3
+ size 5499921
parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57f25626f4c5ebc463d858517ac2db6cb1a1a98b344ac14b564356099d6dc543
3
+ size 5346541
parse/dev/6Dz7RiRiMFd/6Dz7RiRiMFd_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e46fa6ced2aa48e4922178ebc987594b01e21a1c33a1f731ea06cd27a2edff9e
3
+ size 5500375
parse/dev/6MmiS0HUJHR/6MmiS0HUJHR.md ADDED
The diff for this file is too large to render. See raw diff