Add Batch d379f5d3-e377-4caf-bff2-db7ea4c32ea5 data
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +64 -0
- 2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/905bde55-39fe-419b-a64b-8787e4104502_content_list.json +0 -0
- 2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/905bde55-39fe-419b-a64b-8787e4104502_model.json +0 -0
- 2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/905bde55-39fe-419b-a64b-8787e4104502_origin.pdf +3 -0
- 2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/full.md +485 -0
- 2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/images.zip +3 -0
- 2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/layout.json +0 -0
- 2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/d4333f3a-de2a-4e20-88e3-332909cc80b5_content_list.json +0 -0
- 2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/d4333f3a-de2a-4e20-88e3-332909cc80b5_model.json +0 -0
- 2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/d4333f3a-de2a-4e20-88e3-332909cc80b5_origin.pdf +3 -0
- 2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/full.md +0 -0
- 2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/images.zip +3 -0
- 2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/layout.json +0 -0
- 2023/Local Vertex Colouring Graph Neural Networks/b276e029-3d94-4a87-a17e-00ceccdbf061_content_list.json +0 -0
- 2023/Local Vertex Colouring Graph Neural Networks/b276e029-3d94-4a87-a17e-00ceccdbf061_model.json +0 -0
- 2023/Local Vertex Colouring Graph Neural Networks/b276e029-3d94-4a87-a17e-00ceccdbf061_origin.pdf +3 -0
- 2023/Local Vertex Colouring Graph Neural Networks/full.md +0 -0
- 2023/Local Vertex Colouring Graph Neural Networks/images.zip +3 -0
- 2023/Local Vertex Colouring Graph Neural Networks/layout.json +0 -0
- 2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/9e0d9a67-2038-4371-8bb5-ee98ea285471_content_list.json +1929 -0
- 2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/9e0d9a67-2038-4371-8bb5-ee98ea285471_model.json +0 -0
- 2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/9e0d9a67-2038-4371-8bb5-ee98ea285471_origin.pdf +3 -0
- 2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/full.md +373 -0
- 2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/images.zip +3 -0
- 2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/layout.json +0 -0
- 2023/Long Horizon Temperature Scaling/47128e75-9f58-40d7-abc3-eec59da61be5_content_list.json +2244 -0
- 2023/Long Horizon Temperature Scaling/47128e75-9f58-40d7-abc3-eec59da61be5_model.json +0 -0
- 2023/Long Horizon Temperature Scaling/47128e75-9f58-40d7-abc3-eec59da61be5_origin.pdf +3 -0
- 2023/Long Horizon Temperature Scaling/full.md +431 -0
- 2023/Long Horizon Temperature Scaling/images.zip +3 -0
- 2023/Long Horizon Temperature Scaling/layout.json +0 -0
- 2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/0329bb0a-5594-4b52-b3f1-8587b4d92ea9_content_list.json +2256 -0
- 2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/0329bb0a-5594-4b52-b3f1-8587b4d92ea9_model.json +0 -0
- 2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/0329bb0a-5594-4b52-b3f1-8587b4d92ea9_origin.pdf +3 -0
- 2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/full.md +439 -0
- 2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/images.zip +3 -0
- 2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/layout.json +0 -0
- 2023/Long-Term Rhythmic Video Soundtracker/aff3b3bc-3329-4910-aa7c-87e775bbaa9c_content_list.json +0 -0
- 2023/Long-Term Rhythmic Video Soundtracker/aff3b3bc-3329-4910-aa7c-87e775bbaa9c_model.json +0 -0
- 2023/Long-Term Rhythmic Video Soundtracker/aff3b3bc-3329-4910-aa7c-87e775bbaa9c_origin.pdf +3 -0
- 2023/Long-Term Rhythmic Video Soundtracker/full.md +418 -0
- 2023/Long-Term Rhythmic Video Soundtracker/images.zip +3 -0
- 2023/Long-Term Rhythmic Video Soundtracker/layout.json +0 -0
- 2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/764c4fd6-5564-414d-aed4-faf9cde1cc97_content_list.json +1550 -0
- 2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/764c4fd6-5564-414d-aed4-faf9cde1cc97_model.json +1969 -0
- 2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/764c4fd6-5564-414d-aed4-faf9cde1cc97_origin.pdf +3 -0
- 2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/full.md +299 -0
- 2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/images.zip +3 -0
- 2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/layout.json +0 -0
- 2023/Lookahead When It Matters_ Adaptive Non-causal Transformers for Streaming Neural Transducers/e256c32f-c091-4c4a-80dd-0f1c5fd51afb_content_list.json +0 -0
.gitattributes
CHANGED
|
@@ -6920,3 +6920,67 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 6920 |
2023/Linkless[[:space:]]Link[[:space:]]Prediction[[:space:]]via[[:space:]]Relational[[:space:]]Distillation/2d46e3f3-f25d-4b61-9e88-17fc83c89069_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6921 |
2023/LipsNet_[[:space:]]A[[:space:]]Smooth[[:space:]]and[[:space:]]Robust[[:space:]]Neural[[:space:]]Network[[:space:]]with[[:space:]]Adaptive[[:space:]]Lipschitz[[:space:]]Constant[[:space:]]for[[:space:]]High[[:space:]]Accuracy[[:space:]]Optimal[[:space:]]Control/2bc3f552-3b60-484a-8138-03e7e118e29d_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6922 |
2023/Live[[:space:]]in[[:space:]]the[[:space:]]Moment_[[:space:]]Learning[[:space:]]Dynamics[[:space:]]Model[[:space:]]Adapted[[:space:]]to[[:space:]]Evolving[[:space:]]Policy/442c9d92-29a2-4950-b91e-baf56c11d290_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6920 |
2023/Linkless[[:space:]]Link[[:space:]]Prediction[[:space:]]via[[:space:]]Relational[[:space:]]Distillation/2d46e3f3-f25d-4b61-9e88-17fc83c89069_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6921 |
2023/LipsNet_[[:space:]]A[[:space:]]Smooth[[:space:]]and[[:space:]]Robust[[:space:]]Neural[[:space:]]Network[[:space:]]with[[:space:]]Adaptive[[:space:]]Lipschitz[[:space:]]Constant[[:space:]]for[[:space:]]High[[:space:]]Accuracy[[:space:]]Optimal[[:space:]]Control/2bc3f552-3b60-484a-8138-03e7e118e29d_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6922 |
2023/Live[[:space:]]in[[:space:]]the[[:space:]]Moment_[[:space:]]Learning[[:space:]]Dynamics[[:space:]]Model[[:space:]]Adapted[[:space:]]to[[:space:]]Evolving[[:space:]]Policy/442c9d92-29a2-4950-b91e-baf56c11d290_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6923 |
+
2023/LoSparse_[[:space:]]Structured[[:space:]]Compression[[:space:]]of[[:space:]]Large[[:space:]]Language[[:space:]]Models[[:space:]]based[[:space:]]on[[:space:]]Low-Rank[[:space:]]and[[:space:]]Sparse[[:space:]]Approximation/905bde55-39fe-419b-a64b-8787e4104502_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6924 |
+
2023/Local[[:space:]]Optimization[[:space:]]Achieves[[:space:]]Global[[:space:]]Optimality[[:space:]]in[[:space:]]Multi-Agent[[:space:]]Reinforcement[[:space:]]Learning/d4333f3a-de2a-4e20-88e3-332909cc80b5_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6925 |
+
2023/Local[[:space:]]Vertex[[:space:]]Colouring[[:space:]]Graph[[:space:]]Neural[[:space:]]Networks/b276e029-3d94-4a87-a17e-00ceccdbf061_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6926 |
+
2023/Locally[[:space:]]Regularized[[:space:]]Neural[[:space:]]Differential[[:space:]]Equations_[[:space:]]Some[[:space:]]Black[[:space:]]Boxes[[:space:]]were[[:space:]]meant[[:space:]]to[[:space:]]remain[[:space:]]closed!/9e0d9a67-2038-4371-8bb5-ee98ea285471_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6927 |
+
2023/Long[[:space:]]Horizon[[:space:]]Temperature[[:space:]]Scaling/47128e75-9f58-40d7-abc3-eec59da61be5_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6928 |
+
2023/Long-Tailed[[:space:]]Recognition[[:space:]]by[[:space:]]Mutual[[:space:]]Information[[:space:]]Maximization[[:space:]]between[[:space:]]Latent[[:space:]]Features[[:space:]]and[[:space:]]Ground-Truth[[:space:]]Labels/0329bb0a-5594-4b52-b3f1-8587b4d92ea9_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6929 |
+
2023/Long-Term[[:space:]]Rhythmic[[:space:]]Video[[:space:]]Soundtracker/aff3b3bc-3329-4910-aa7c-87e775bbaa9c_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6930 |
+
2023/LongCoder_[[:space:]]A[[:space:]]Long-Range[[:space:]]Pre-trained[[:space:]]Language[[:space:]]Model[[:space:]]for[[:space:]]Code[[:space:]]Completion/764c4fd6-5564-414d-aed4-faf9cde1cc97_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6931 |
+
2023/Lookahead[[:space:]]When[[:space:]]It[[:space:]]Matters_[[:space:]]Adaptive[[:space:]]Non-causal[[:space:]]Transformers[[:space:]]for[[:space:]]Streaming[[:space:]]Neural[[:space:]]Transducers/e256c32f-c091-4c4a-80dd-0f1c5fd51afb_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6932 |
+
2023/LookupFFN_[[:space:]]Making[[:space:]]Transformers[[:space:]]Compute-lite[[:space:]]for[[:space:]]CPU[[:space:]]inference/a634be50-0c58-4baa-b183-44bea1e29cca_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6933 |
+
2023/Looped[[:space:]]Transformers[[:space:]]as[[:space:]]Programmable[[:space:]]Computers/539625f5-755e-443a-aa51-4c613ce4a234_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6934 |
+
2023/Loss[[:space:]]Balancing[[:space:]]for[[:space:]]Fair[[:space:]]Supervised[[:space:]]Learning/569b296f-e929-44f8-9625-9e322ca260bd_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6935 |
+
2023/Loss-Guided[[:space:]]Diffusion[[:space:]]Models[[:space:]]for[[:space:]]Plug-and-Play[[:space:]]Controllable[[:space:]]Generation/28244915-c8fe-4a76-96e1-079058a790aa_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6936 |
+
2023/Lottery[[:space:]]Tickets[[:space:]]in[[:space:]]Evolutionary[[:space:]]Optimization_[[:space:]]On[[:space:]]Sparse[[:space:]]Backpropagation-Free[[:space:]]Trainability/8d3c43be-de2e-4252-a67a-52e1f7c70ff5_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6937 |
+
2023/Low[[:space:]]Complexity[[:space:]]Homeomorphic[[:space:]]Projection[[:space:]]to[[:space:]]Ensure[[:space:]]Neural-Network[[:space:]]Solution[[:space:]]Feasibility[[:space:]]for[[:space:]]Optimization[[:space:]]over[[:space:]](Non-)Convex[[:space:]]Set/530ec401-24e3-459b-bf80-40b5cd88e863_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6938 |
+
2023/Low-Switching[[:space:]]Policy[[:space:]]Gradient[[:space:]]with[[:space:]]Exploration[[:space:]]via[[:space:]]Online[[:space:]]Sensitivity[[:space:]]Sampling/afb18857-ea7e-41d8-ab8a-27284bb95417_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6939 |
+
2023/Low-Variance[[:space:]]Gradient[[:space:]]Estimation[[:space:]]in[[:space:]]Unrolled[[:space:]]Computation[[:space:]]Graphs[[:space:]]with[[:space:]]ES-Single/6005c2e9-2e3c-4cee-96bc-acbe3e8702f0_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6940 |
+
2023/Lower[[:space:]]Bounds[[:space:]]for[[:space:]]Learning[[:space:]]in[[:space:]]Revealing[[:space:]]POMDPs/e804d4dc-790a-41ce-911a-ab7193cb37bb_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6941 |
+
2023/Lowering[[:space:]]the[[:space:]]Pre-training[[:space:]]Tax[[:space:]]for[[:space:]]Gradient-based[[:space:]]Subset[[:space:]]Training_[[:space:]]A[[:space:]]Lightweight[[:space:]]Distributed[[:space:]]Pre-Training[[:space:]]Toolkit/3fabe640-d0c9-49e7-9955-4c8d0246f833_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6942 |
+
2023/MABe22_[[:space:]]A[[:space:]]Multi-Species[[:space:]]Multi-Task[[:space:]]Benchmark[[:space:]]for[[:space:]]Learned[[:space:]]Representations[[:space:]]of[[:space:]]Behavior/0fe14e64-26a6-43f4-8355-d1591d9eb3f7_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6943 |
+
2023/MAGANet_[[:space:]]Achieving[[:space:]]Combinatorial[[:space:]]Generalization[[:space:]]by[[:space:]]Modeling[[:space:]]a[[:space:]]Group[[:space:]]Action/3dde84e7-41e6-4c00-bab4-0f197deffe0b_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6944 |
+
2023/MAHALO_[[:space:]]Unifying[[:space:]]Offline[[:space:]]Reinforcement[[:space:]]Learning[[:space:]]and[[:space:]]Imitation[[:space:]]Learning[[:space:]]from[[:space:]]Observations/11038139-92f9-4c4e-9977-e7ab3c494dde_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6945 |
+
2023/MANSA_[[:space:]]Learning[[:space:]]Fast[[:space:]]and[[:space:]]Slow[[:space:]]in[[:space:]]Multi-Agent[[:space:]]Systems/79ab0d62-81f6-4422-bcf2-7283817e2e29_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6946 |
+
2023/MEWL_[[:space:]]Few-shot[[:space:]]multimodal[[:space:]]word[[:space:]]learning[[:space:]]with[[:space:]]referential[[:space:]]uncertainty/ba738fcf-a85f-4790-baa8-bb748b35b678_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6947 |
+
2023/MG-GNN_[[:space:]]Multigrid[[:space:]]Graph[[:space:]]Neural[[:space:]]Networks[[:space:]]for[[:space:]]Learning[[:space:]]Multilevel[[:space:]]Domain[[:space:]]Decomposition[[:space:]]Methods/6bab95f2-f3e2-4e7e-b22b-31b4bc01ad71_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6948 |
+
2023/MODeL_[[:space:]]Memory[[:space:]]Optimizations[[:space:]]for[[:space:]]Deep[[:space:]]Learning/8798c950-3da4-4eab-b341-312d50794bf9_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6949 |
+
2023/Machine[[:space:]]Learning[[:space:]]Force[[:space:]]Fields[[:space:]]with[[:space:]]Data[[:space:]]Cost[[:space:]]Aware[[:space:]]Training/aecf3632-6d9b-4b29-9f78-c826cbe6a1af_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6950 |
+
2023/Magneto_[[:space:]]A[[:space:]]Foundation[[:space:]]Transformer/7e91a36f-61f5-471b-a98e-be2a8ede4c04_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6951 |
+
2023/Make-An-Audio_[[:space:]]Text-To-Audio[[:space:]]Generation[[:space:]]with[[:space:]]Prompt-Enhanced[[:space:]]Diffusion[[:space:]]Models/7b02c321-f996-4509-8480-214b9db1c07e_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6952 |
+
2023/Margin-based[[:space:]]Neural[[:space:]]Network[[:space:]]Watermarking/34eda31f-07ed-408b-a96c-2ad7811f409c_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6953 |
+
2023/Margin-based[[:space:]]sampling[[:space:]]in[[:space:]]high[[:space:]]dimensions_[[:space:]]When[[:space:]]being[[:space:]]active[[:space:]]is[[:space:]]less[[:space:]]efficient[[:space:]]than[[:space:]]staying[[:space:]]passive/a27ec96b-4d89-41e1-9ccd-e0d1fdbfaf42_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6954 |
+
2023/Marginalization[[:space:]]is[[:space:]]not[[:space:]]Marginal_[[:space:]]No[[:space:]]Bad[[:space:]]VAE[[:space:]]Local[[:space:]]Minima[[:space:]]when[[:space:]]Learning[[:space:]]Optimal[[:space:]]Sparse[[:space:]]Representations/e54b664b-6170-4189-930c-58cf859f2f77_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6955 |
+
2023/Markovian[[:space:]]Gaussian[[:space:]]Process[[:space:]]Variational[[:space:]]Autoencoders/8b0ef77c-184e-4a16-bf9b-4582a63e14cd_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6956 |
+
2023/Masked[[:space:]]Bayesian[[:space:]]Neural[[:space:]]Networks[[:space:]]_[[:space:]]Theoretical[[:space:]]Guarantee[[:space:]]and[[:space:]]its[[:space:]]Posterior[[:space:]]Inference/47febcbf-4867-4b1d-b414-d5d67e621a60_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6957 |
+
2023/Masked[[:space:]]Trajectory[[:space:]]Models[[:space:]]for[[:space:]]Prediction,[[:space:]]Representation,[[:space:]]and[[:space:]]Control/c603881f-faea-415c-b497-b114040bd6d9_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6958 |
+
2023/Master-ASR_[[:space:]]Achieving[[:space:]]Multilingual[[:space:]]Scalability[[:space:]]and[[:space:]]Low-Resource[[:space:]]Adaptation[[:space:]]in[[:space:]]ASR[[:space:]]with[[:space:]]Modular[[:space:]]Learning/600bebc8-7be1-4ab6-8497-81dd35dd7c78_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6959 |
+
2023/Mastering[[:space:]]the[[:space:]]Unsupervised[[:space:]]Reinforcement[[:space:]]Learning[[:space:]]Benchmark[[:space:]]from[[:space:]]Pixels/b19a08d9-cd47-4e73-932f-6453b572cc7f_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6960 |
+
2023/Matrix[[:space:]]Estimation[[:space:]]for[[:space:]]Individual[[:space:]]Fairness/e217aade-3687-4447-98cd-3c424a1eb728_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6961 |
+
2023/Maximal[[:space:]]Initial[[:space:]]Learning[[:space:]]Rates[[:space:]]in[[:space:]]Deep[[:space:]]ReLU[[:space:]]Networks/46a43702-5b1e-4557-b725-93141c30b237_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6962 |
+
2023/Maximum[[:space:]]Optimality[[:space:]]Margin_[[:space:]]A[[:space:]]Unified[[:space:]]Approach[[:space:]]for[[:space:]]Contextual[[:space:]]Linear[[:space:]]Programming[[:space:]]and[[:space:]]Inverse[[:space:]]Linear[[:space:]]Programming/d0c81a9f-1a4e-4291-87be-6e7d9a7fe8b7_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6963 |
+
2023/Measuring[[:space:]]the[[:space:]]Impact[[:space:]]of[[:space:]]Programming[[:space:]]Language[[:space:]]Distribution/f74198b2-2696-444a-9719-ca1bd7a400f7_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6964 |
+
2023/Mechanistic[[:space:]]Mode[[:space:]]Connectivity/10735995-62d4-42a2-a7b6-38bc59493ac8_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6965 |
+
2023/Memory-Based[[:space:]]Dual[[:space:]]Gaussian[[:space:]]Processes[[:space:]]for[[:space:]]Sequential[[:space:]]Learning/2e027da9-7c8e-457c-b9e3-1c23fa9a31ff_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6966 |
+
2023/Memory-Based[[:space:]]Meta-Learning[[:space:]]on[[:space:]]Non-Stationary[[:space:]]Distributions/dbf02931-df7f-4b74-81c1-e46a8dc9edd8_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6967 |
+
2023/Men[[:space:]]Also[[:space:]]Do[[:space:]]Laundry_[[:space:]]Multi-Attribute[[:space:]]Bias[[:space:]]Amplification/7656ec3d-1c36-4143-b27f-5f6ebcd14f76_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6968 |
+
2023/Meta[[:space:]]Learning[[:space:]]of[[:space:]]Interface[[:space:]]Conditions[[:space:]]for[[:space:]]Multi-Domain[[:space:]]Physics-Informed[[:space:]]Neural[[:space:]]Networks/53b89d14-933d-4f45-aecb-be872e9b87d1_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6969 |
+
2023/Meta[[:space:]]Optimal[[:space:]]Transport/e9211ac5-1144-4902-99f5-454329d68610_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6970 |
+
2023/Meta-Learning[[:space:]]the[[:space:]]Inductive[[:space:]]Bias[[:space:]]of[[:space:]]Simple[[:space:]]Neural[[:space:]]Circuits/a68ad2c5-5e34-4635-a2fa-a6ac839d09e7_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6971 |
+
2023/Meta-SAGE_[[:space:]]Scale[[:space:]]Meta-Learning[[:space:]]Scheduled[[:space:]]Adaptation[[:space:]]with[[:space:]]Guided[[:space:]]Exploration[[:space:]]for[[:space:]]Mitigating[[:space:]]Scale[[:space:]]Shift[[:space:]]on[[:space:]]Combinatorial[[:space:]]Optimization/43edfc50-d64c-47ae-8131-6820c6af7892_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6972 |
+
2023/Meta-learning[[:space:]]Parameterized[[:space:]]Skills/7620794b-99e4-4357-840d-92fde0f9c8a4_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6973 |
+
2023/MetaDiffuser_[[:space:]]Diffusion[[:space:]]Model[[:space:]]as[[:space:]]Conditional[[:space:]]Planner[[:space:]]for[[:space:]]Offline[[:space:]]Meta-RL/68faff0e-1332-4711-92ba-f46442bc4bb1_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6974 |
+
2023/MetaModulation_[[:space:]]Learning[[:space:]]Variational[[:space:]]Feature[[:space:]]Hierarchies[[:space:]]for[[:space:]]Few-Shot[[:space:]]Learning[[:space:]]with[[:space:]]Fewer[[:space:]]Tasks/2e52c691-90ce-4566-909d-55b64987addc_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6975 |
+
2023/Metagenomic[[:space:]]Binning[[:space:]]using[[:space:]]Connectivity-constrained[[:space:]]Variational[[:space:]]Autoencoders/1fb2c35e-526e-4763-9865-1d6d893aa75c_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6976 |
+
2023/MetricGAN-OKD_[[:space:]]Multi-Metric[[:space:]]Optimization[[:space:]]of[[:space:]]MetricGAN[[:space:]]via[[:space:]]Online[[:space:]]Knowledge[[:space:]]Distillation[[:space:]]for[[:space:]]Speech[[:space:]]Enhancement/68a2fd74-3571-4ffc-adb2-57f0ac169adc_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6977 |
+
2023/Mimetic[[:space:]]Initialization[[:space:]]of[[:space:]]Self-Attention[[:space:]]Layers/b0ba35b8-4e01-48a6-8bd7-ac52b2ef2638_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6978 |
+
2023/Minimalistic[[:space:]]Predictions[[:space:]]to[[:space:]]Schedule[[:space:]]Jobs[[:space:]]with[[:space:]]Online[[:space:]]Precedence[[:space:]]Constraints/34e56662-cd20-443e-89b9-f1309b8fbdf2_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6979 |
+
2023/Minimax[[:space:]]estimation[[:space:]]of[[:space:]]discontinuous[[:space:]]optimal[[:space:]]transport[[:space:]]maps_[[:space:]]The[[:space:]]semi-discrete[[:space:]]case/020fa5b3-8e62-4734-862b-576b05ac37f9_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6980 |
+
2023/Minimizing[[:space:]]Trajectory[[:space:]]Curvature[[:space:]]of[[:space:]]ODE-based[[:space:]]Generative[[:space:]]Models/2405ac0a-e097-42d0-b535-0e992d67ccee_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6981 |
+
2023/Minimum[[:space:]]Width[[:space:]]of[[:space:]]Leaky-ReLU[[:space:]]Neural[[:space:]]Networks[[:space:]]for[[:space:]]Uniform[[:space:]]Universal[[:space:]]Approximation/3136c44c-b3a1-4225-82fe-81a0f49ea292_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6982 |
+
2023/Mirror[[:space:]]Sinkhorn_[[:space:]]Fast[[:space:]]Online[[:space:]]Optimization[[:space:]]on[[:space:]]Transport[[:space:]]Polytopes/88b4657c-73d4-49cf-99a0-305925376fe4_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6983 |
+
2023/Mitigating[[:space:]]Memorization[[:space:]]of[[:space:]]Noisy[[:space:]]Labels[[:space:]]by[[:space:]]Clipping[[:space:]]the[[:space:]]Model[[:space:]]Prediction/fc90a60f-d354-4687-a132-cc1e9add75a6_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6984 |
+
2023/Mitigating[[:space:]]Propagation[[:space:]]Failures[[:space:]]in[[:space:]]Physics-informed[[:space:]]Neural[[:space:]]Networks[[:space:]]using[[:space:]]Retain-Resample-Release[[:space:]](R3)[[:space:]]Sampling/0d8cc48b-0fe6-4139-a089-5c1e0501068d_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6985 |
+
2023/Mitigating[[:space:]]Spurious[[:space:]]Correlations[[:space:]]in[[:space:]]Multi-modal[[:space:]]Models[[:space:]]during[[:space:]]Fine-tuning/a27a98de-e443-4622-80a8-7a41f3214e78_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
| 6986 |
+
2023/MixFlows_[[:space:]]principled[[:space:]]variational[[:space:]]inference[[:space:]]via[[:space:]]mixed[[:space:]]flows/4b28a695-a28c-465a-b660-6eaaf5d7ed4f_origin.pdf filter=lfs diff=lfs merge=lfs -text
|
2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/905bde55-39fe-419b-a64b-8787e4104502_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/905bde55-39fe-419b-a64b-8787e4104502_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/905bde55-39fe-419b-a64b-8787e4104502_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c4e36596d0e2e05ccbb06842427229fee417c7d5887d31c19814de64a2e6fe8
|
| 3 |
+
size 516899
|
2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/full.md
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
| 1 |
+
# LoSparse: Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation
|
| 2 |
+
|
| 3 |
+
Yixiao Li\* Yifan Yu\*1 Qingru Zhang' Chen Liang' Pengcheng He2 Weizhu Chen2 Tuo Zhao
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Transformer models have achieved remarkable results in various natural language tasks, but they are often prohibitively large, requiring massive memories and computational resources. To reduce the size and complexity of these models, we propose LoSparse (Low-Rank and Sparse approximation), a novel model compression technique that approximates a weight matrix by the sum of a low-rank matrix and a sparse matrix. Our method combines the advantages of both low-rank approximations and pruning, while avoiding their limitations. Low-rank approximation compresses the coherent and expressive parts in neurons, while pruning removes the incoherent and non-expressive parts in neurons. Pruning enhances the diversity of low-rank approximations, and low-rank approximation prevents pruning from losing too many expressive neurons. We evaluate our method on natural language understanding, question answering, and natural language generation tasks. We show that it significantly outperforms existing compression methods. Our code is publicly available at https://github.com/yyxli2123/LoSparse
|
| 8 |
+
|
| 9 |
+
# 1. Introduction
|
| 10 |
+
|
| 11 |
+
Large transformer models have exhibited superior performance in various natural language tasks, such as natural language understanding, question answering, and natural language generation (Devlin et al., 2018; Liu et al., 2019; He et al., 2020; Radford et al., 2019; Brown et al., 2020). However, these models contain billions of parameters. For example, T5 (Radford et al., 2019) consists of up to 11 bil
|
| 12 |
+
|
| 13 |
+
*Equal contribution †Georgia Institute of Technology, Atlanta, USA 2Microsoft Azure AI, Bellevue, USA. Correspondence to: Yixiao Li <yixiaoli@gatech.edu>, Yifan Yu <yyu429@gatech.edu>, Tuo Zhao <tourzhao@gatech.edu>.
|
| 14 |
+
|
| 15 |
+
Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).
|
| 16 |
+
|
| 17 |
+
lion parameters, and GPT-3 (Brown et al., 2020) comprises up to 175 billion parameters. Their extreme sizes bring challenges in deploying the models to practical applications due to memory and computational requirements.
|
| 18 |
+
|
| 19 |
+
To circumvent aforementioned challenges, model compression methods are widely applied to reduce model size at only a small expense of model performance. One common compression technique is pruning (Zhu & Gupta, 2017; Louizos et al., 2017), which removes parameters according to their importance scores (Han et al., 2015; Molchanov et al., 2016; Zhang et al., 2022). Pruning methods can be divided into two categories: structured and unstructured pruning. In structured pruning (McCarley et al., 2019; Fan et al., 2019; Lagunas et al., 2021), weight matrices are pruned neuron/column-wise. This enables us to store pruned models by directly deleting neurons/columns in memory. As for unstructured pruning (Han et al., 2015; Sanh et al., 2020), however, weight matrices are pruned entry-wise, which makes it challenging to store and manipulate. For this reason, we focus on structured pruning. One popular structured pruning method is iterative pruning (ITP), which conducts training and pruning simultaneously. That is, after parameters are updated every iteration, it evaluates the importance score of each neuron. Neurons that have low importance scores are considered non-expressive and should be pruned. Beside the ITP, Movement pruning (Sanh et al., 2020) and CoFi (Xia et al., 2022) are also popular pruning methods.
|
| 20 |
+
|
| 21 |
+
Unfortunately, pruning is not necessarily effective. It will inevitably remove expressive neurons given a high sparsity level. Liang et al. (2021) found heavy pruning hurts the performance severely, although light pruning can enhance the generalization of pre-trained language models. As an example, Figure 1 illustrates this phenomenon. Ideally (Figure 1b), most of the neurons should be redundant and have low importance scores so that we can remove these neurons without hurting the performance too much. However, in reality (Figure 1a), even if a significant portion of neurons are non-expressive, the majority of neurons are still expressive and are likely to be pruned if the sparsity level is high.
|
| 22 |
+
|
| 23 |
+
Another popular compression technique is low-rank approximation (Hsu et al., 2022a; Hajimolahoseini et al.; Tahaei et al., 2021), which is designed to compress the expressive
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
(a) Query of decoder layer 9
|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
(b) Ideal
|
| 30 |
+
Figure 1. Histogram of neuron importance scores. (a) The practical neuron importance scores of a linear layer when pruning BART-large on XSum. (d) The ideal histogram of the neuron importance scores where most of the neuron should be redundant, otherwise pruning is not the best choice.
|
| 31 |
+
|
| 32 |
+
neurons. It approximates a weight matrix by a low-rank matrix that is computed by singular value thresholding. Such a low-rank approximation is particularly effective to compress coherent parts in neurons. For example, the majority of neuron weights often share one coherent subspace that can be well approximated by singular vectors of top singular values. The low-rank approximation is inherently capable of extracting the common bases of this coherent subspace.
|
| 33 |
+
|
| 34 |
+
Matrices in transformer models, however, are often high-rank. It can hurt the model performance when merely applying the low-rank approximation to compress these matrices. This is because the diversity of neurons has been ignored. Although low-rank approximation extracts the common bases shared by neuron weights, it cannot accurately approximate their incoherent parts, which can be expressive and crucial to the model performance. We explain the reason more in Section 3.1.
|
| 35 |
+
|
| 36 |
+
To overcome the drawbacks of both pruning and low-rank approximations, we propose LoSparse (Low-Rank and Sparse approximation), which approximates a weight matrix by the sum of a low-rank matrix and a sparse matrix. Such a composite approximation decouples the coherent parts from incoherent parts of neurons. It inherits the benefits of both low-rank and sparse approximation: the low-rank approximation aims to compress expressive bases of the coherent subspace shared by neurons while the sparse approximation focuses on removing non-expressive information in incoherent parts of neurons. In that sense, the low-rank approximation prevents the pruning from excessively removing expressive neurons while sparse approximation enhances the diversity of low-rank approximation.
|
| 37 |
+
|
| 38 |
+
We draw inspiration from multi-task learning (Jalali et al., 2010), where linear models are used for multi-task regression. In out settings, every linear layer in transformer models can be naturally viewed as a linear multi-task model that learns different latent features. In that case, low-rank approximations are designed to store shared features across all coherent parts of neurons, and sparse approximations aim to
|
| 39 |
+
|
| 40 |
+
learn distinct features from incoherent parts of neurons. Besides, previous work (Yu et al., 2017; Hawkins et al., 2021) applied a similar method to Convolutional Neural Networks (CNN), but we will discuss the limitation of their methods on CNN-based models in Section 5.
|
| 41 |
+
|
| 42 |
+
We conduct extensive experiments on natural language understanding, question answering, and natural language generation tasks to demonstrate the effectiveness and efficiency of LoSparse. On the natural language understanding tasks in GLUE (Wang et al., 2019), our method significantly outperforms existing pruning methods. For example, on the MNLI dataset, LoSparse achieves more than $2.0\%$ higher accuracy than existing baseline methods. On the question answering tasks in SQuADv1.1 (Rajpurkar et al., 2016b), our method surpasses other pruning methods by 3.3 points in F1 score under the extreme low remaining ratio<sup>1</sup>. On the natural language generation tasks in XSum (Narayan et al., 2018), our method exceeds the current methods by 2.99 points in Rouge-1 score. Moreover, our method is orthogonal to the current knowledge distillation methods, and could be readily integrated with them to improve the performance.
|
| 43 |
+
|
| 44 |
+
# 2. Background
|
| 45 |
+
|
| 46 |
+
We briefly review the transformer language models and pruning methods.
|
| 47 |
+
|
| 48 |
+
# 2.1. Transformer Models
|
| 49 |
+
|
| 50 |
+
A typical transformer architecture comprises several sequential layers, where each layer contains two sub-layers: a multi-head self-attention (MHA) and a fully connected feed forward network (FFN). Given the input $X \in \mathbb{R}^{n \times d}$ , MHA computes the attention in parallel $h$ heads:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\operatorname {M H A} (X) = \operatorname {C o n c a t} \left(\operatorname {h e a d} _ {1},..., \operatorname {h e a d} _ {h}\right) W _ {o},
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\operatorname {h e a d} _ {i} = \operatorname {S o f t m a x} \left(X W _ {q _ {i}} \left(X W _ {k _ {i}}\right) ^ {T} / \sqrt {d _ {h}}\right) X W _ {v _ {i}},
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $W_{q_i}, W_{k_i}, W_{v_i} \in \mathbb{R}^{d \times d_h}$ are query, key, and value projection matrices, $W_o \in \mathbb{R}^{d \times d}$ is an output projection matrix, and $d_h$ is typically set as $d / h$ . FFN comprises two linear transformations and an activation: $\mathrm{FFN}(X) = \sigma(XW_{f_1} + b_1)W_{f_2} + b_2$ , where $W_{f_1} \in \mathbb{R}^{d \times d_m}$ , $W_{f_2} \in \mathbb{R}^{d_m \times d}$ , and $\sigma(\cdot)$ is the activate function. A residual connection is used and followed by a layer normalization.
|
| 61 |
+
|
| 62 |
+
Generally, we denote all the matrix multiplication in a transformer model as
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
y = W x, \tag {1}
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $W\in \mathbb{R}^{d_1\times d_2}$ denotes any weight matrix in the model.
|
| 69 |
+
|
| 70 |
+
We further denote the parameter set consisting of all trainable weight matrix by $\mathcal{W} = \{W_m\}_{m=1}^M$ . Unless specified
|
| 71 |
+
|
| 72 |
+
otherwise, we use $W$ to represent any weight matrix and $W^{(0)}$ is its pre-trained value. We use $i,j$ to index the entry of matrices and denote $w_{ij}$ as $ij$ -th entry of $W$ , $W_{i*}$ as the $i$ -th row of $W$ , and $W_{*i}$ as the $i$ -th column of $W$ .
|
| 73 |
+
|
| 74 |
+
# 2.2. Importance Scores for Pruning
|
| 75 |
+
|
| 76 |
+
Pruning methods zero out redundant parameters according to their importance estimation. Parameters with high importance scores are retrained for fine-tuning while the others with low importance are zeroed out. Popular importance metrics include magnitude (Han et al., 2015), sensitivity (Sanh et al., 2020; Molchanov et al., 2019) and uncertainty (Zhang et al., 2022). Sensitivity of parameters is essentially designed to approximate the change of training loss $\mathcal{L}$ when a parameter is zeroed out. If the removal of a parameter causes a large variation on the loss, then the model is sensitive to this parameter and we should retain it. Specifically, for a weight $w_{ij}$ , its sensitivity score is defined by the gradient-weight product:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
I \left(w _ {i j}\right) = \left| w _ {i j} \cdot \nabla_ {w _ {i j}} \mathcal {L} \right|. \tag {2}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
Note that the calculation of $I^{(t)}$ is conditioned on the sampled mini-batch at the $t$ -th iteration. It can induce high uncertainty due to stochastic sampling. To reduce the variability in (2), Zhang et al. (2022) propose to smooth $I$ by:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\bar {I} ^ {(t)} \left(w _ {i j}\right) = \beta \bar {I} ^ {(t - 1)} \left(w _ {i j}\right) + (1 - \beta) \left| w _ {i j} ^ {(t)} \nabla_ {w _ {i j}} \mathcal {L} ^ {(t)} \right| \tag {3}
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
using exponential moving of average.
|
| 89 |
+
|
| 90 |
+
# 2.3. Structured Pruning
|
| 91 |
+
|
| 92 |
+
As mentioned in Section 1, there are two types of pruning methods: unstructured and structured pruning. Sensitivity in (2), however, targets on unstructured pruning. We extend it to structured pruning and introduce neuron importance scores. For a linear projection represented as a weight matrix $W \in \mathbb{R}^{d_1 \times d_2}$ , we define the importance score of its $i$ -th neuron $W_{*i}$ as
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\Gamma \left(W _ {* i}\right) = \frac {1}{d _ {1}} \sum_ {j = 1} ^ {d _ {1}} \bar {I} \left(w _ {j i}\right). \tag {4}
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
We further define $\Gamma(W) = [\Gamma(W_{*1}), \dots, \Gamma(W_{*d_2})]^\top \in \mathbb{R}^{d_2}$ .
|
| 99 |
+
|
| 100 |
+
# 3. Method
|
| 101 |
+
|
| 102 |
+
We propose a compression method for transformer models. Specifically, we approximate a weight matrix by the sum of a low-rank matrix and a sparse matrix (as illustrated by Figure 2). The combination of these two approximations makes our compression method more efficient and stable.
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 2. Illustration of one linear projection in a transformer neural network. We use $UV + S$ , a low-rank approximation plus a sparse matrix, to approximate the weight matrix $W$ . $UV$ and $S$ indicate the coherent and incoherent parts of neurons in $W$ respectively. We conduct the forward pass of two terms in parallel.
|
| 106 |
+
|
| 107 |
+
# 3.1. Approximation by Low-rank and Sparse Matrices
|
| 108 |
+
|
| 109 |
+
Given a weight matrix $W \in \mathbb{R}^{d_1 \times d_2}$ , a structured-pruned sparse matrix $S \in \mathbb{R}^{d_1 \times d_2}$ is commonly applied to approximate $W$ for compression (Han et al., 2015; Lagunas et al., 2021). The sparse matrix approximation, however, results in poor performance especially when the remaining ratio is low (See experiments in Section 4). Therefore, we introduce a low-rank matrix to improve the approximation. Specifically, the weight matrix can be represented as
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
W = U V + S, \tag {5}
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
where the product of $U \in \mathbb{R}^{d_1 \times r}$ and $V \in \mathbb{R}^{r \times d_2}$ represents the low-rank matrix of rank $r$ .
|
| 116 |
+
|
| 117 |
+
Why low-rank matrices? First, they can approximate the coherent parts of neurons effectively, even if the rank is small. As shown in Figure 3, we observe that the spectrum of weight matrices in language models drops rapidly at the beginning. This indicates neurons in a weight matrix share a common subspace, which can be viewed as the coherent parts of these neurons. In addition, the common subspace can be recovered by the singular vectors of top singular values. Therefore, the coherent parts of neurons can be well approximated by the low-rank matrix computed by singular value thresholding.
|
| 118 |
+
|
| 119 |
+

|
| 120 |
+
(a) BART-large
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
(b) DeBERTaV3-large
|
| 124 |
+
Figure 3. Singular values in language models. (a) Singular values of weight matrices of the $10^{\text{th}}$ decoder layer in BART-large; (b) Singular values of weight matrices of the $14^{\text{th}}$ encoder layer in DeBERTaV3-large.
|
| 125 |
+
|
| 126 |
+
Second, the decoupling of low-rank and sparse matrices makes it easy to prune. The heavy-tailed spectrum in Figure 3 indicates each neuron $W_{*i}$ spans their individual subspaces, which can represent the incoherent parts of these neurons. Since these subspaces are not shared, the incoherent parts cannot be captured by the low-rank approximation. Fortunately, the low-rank matrix is able to decouple the coherent parts from the incoherent parts of neurons. This enables us to approximate the remaining incoherent parts by adding a new matrix $S$ and then prune it to remove the non-expressive incoherent parts. As an example, Figure 4 demonstrates that most of the incoherent parts have low importance scores after decoupling, motivating us to remove these redundant parameters.
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
(a) $W_{q}$ of Layer 3
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
(b) $W_{k}$ of Layer 3
|
| 133 |
+
Figure 4. Neuron importance scores of selected linear projections when compressing DeBERTaV3-base on SST-2 with ITP (blue) and LoSparse (orange). It shows LoSparse successfully separates incoherent parts of neurons and make it easy to prune the non-expressive components.
|
| 134 |
+
|
| 135 |
+
# 3.2. Algorithm
|
| 136 |
+
|
| 137 |
+
We then present our proposed algorithm. Given a pre-trained weight matrix $W^{(0)}$ , we first initialize the low-rank matrix of rank $r$ based on the singular value decomposition (SVD) of $W^{(0)}$ . Specifically, we choose
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
U ^ {(0)} = \left[ \sqrt {\sigma_ {1}} u _ {1}; \sqrt {\sigma_ {2}} u _ {2}; \dots ; \sqrt {\sigma_ {r}} u _ {r} \right], \tag {6}
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
V ^ {(0)} = \left[ \sqrt {\sigma_ {1}} v _ {1}; \sqrt {\sigma_ {2}} v _ {2}; \dots ; \sqrt {\sigma_ {r}} v _ {r} \right] ^ {\top}, \tag {7}
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
where $u_{1}, u_{2}, \ldots, u_{r} \in \mathbb{R}^{d_{1}}$ are left-singular vectors and $v_{1}, v_{2}, \ldots, v_{r} \in \mathbb{R}^{d_{2}}$ are right-singular vectors, with respect to the top $r$ singular values $\sigma_{1} \geq \sigma_{2} \geq \ldots \geq \sigma_{r}$ in the SVD of $W^{(0)}$ . Then, we initialize $S^{(0)}$ by
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
S ^ {(0)} = W ^ {(0)} - U ^ {(0)} V ^ {(0)}. \tag {8}
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
Notably, we replace the forward pass involving $W$ (e.g. $Y = XW$ ) with (9) to improve computational efficiency:
|
| 154 |
+
|
| 155 |
+
$$
|
| 156 |
+
Y = (X U) V + X S.
|
| 157 |
+
$$
|
| 158 |
+
|
| 159 |
+
We apply such a decomposition to every weight matrix of the model and denote $S = \{S_m\}_{m=1}^M$ as the set of all sparse matrices. After the initialization, we conduct the
|
| 160 |
+
|
| 161 |
+
iterative structured pruning for $S$ . Specifically, at $t$ -th iteration, we first take a stochastic gradient decent step to update $U^{(t)}, V^{(t)}$ , and $S^{(t)}$ . In particular, for $S^{(t)}$
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\widetilde {S} ^ {(t)} = S ^ {(t)} - \alpha \nabla_ {S ^ {(t)}} \mathcal {L}.
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
Then we evaluate the neuron importance scores of $S^{(t)}$ based on (4). Given the importance scores, $\widetilde{S}^{(t)}$ is pruned following:
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
S ^ {(t + 1)} = \mathcal {T} (\widetilde {S} ^ {(t)}, \Gamma (S ^ {(t)})) \tag {9}
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
with the $i$ -th column of $\mathcal{T}(\widetilde{S}^{(t)},\Gamma (S^{(t)}))$ defined as
|
| 174 |
+
|
| 175 |
+
$$
|
| 176 |
+
\mathcal{T}(\widetilde{S}^{(t)},\Gamma (S^{(t)}))_{*i} = \left\{ \begin{array}{cl}\widetilde{S}_{*i}^{(t)} & \text{if}\Gamma (S_{*i}^{(t)})\text{in}\operatorname {top}p_{t}\% ,\\ 0 & \text{o.w.} \end{array} \right.
|
| 177 |
+
$$
|
| 178 |
+
|
| 179 |
+
Here we retain $\widetilde{S}_{*i}^{(t)}$ only if its importance score is in top $p_t\%$ among all neurons in $\mathcal{S}^{(t)}$ . $p_t$ is the percentage of remaining neurons at $t$ -th iteration. We gradually decay $p_t$ following a cubic schedule:
|
| 180 |
+
|
| 181 |
+
$$
|
| 182 |
+
p _ {t} = \left\{ \begin{array}{l l} 1 & 0 \leq t < t _ {i}, \\ p _ {T} + (1 - p _ {T}) \left(1 - \frac {t - t _ {i} - t _ {f}}{T - t _ {i} - t _ {f}}\right) ^ {3} & t _ {i} \leq t < T - t _ {f}, \\ p _ {T} & \text {o . w .} \end{array} \right.
|
| 183 |
+
$$
|
| 184 |
+
|
| 185 |
+
where $T$ is the total training steps. $t_i$ is the number of initial warm-up steps. $t_f$ is the number of final fine-tuning steps. Finally, we summarize our algorithm in Algorithm 1.
|
| 186 |
+
|
| 187 |
+
# Algorithm 1 LoSparse
|
| 188 |
+
|
| 189 |
+
1: Input: Pre-trained weights $\mathcal{W}^{(0)}$ ; total training iterations $T$ ; the rank $r$ ; learning rate $\alpha$ .
|
| 190 |
+
2: for all $W^{(0)} \in \mathcal{W}^{(0)}$ do
|
| 191 |
+
3: Compute the SVD of $W^{(0)}$
|
| 192 |
+
4: Initialize $U^{(0)}$ and $V^{(0)}$ by (6) and (7);
|
| 193 |
+
5: Initialize $S^{(0)} = W^{(0)} - U^{(0)}V^{(0)}$
|
| 194 |
+
6: Replace $W^{(0)}$ by $U^{(0)}V^{(0)} + S^{(0)}$ ;
|
| 195 |
+
7: end for
|
| 196 |
+
8: for $t = 1, \dots, T$ do
|
| 197 |
+
9: Compute the gradient $\nabla \mathcal{L}$
|
| 198 |
+
10: Compute $I^{(t)}$ for each parameter in $\mathcal{S}^{(t)}$ by (2);
|
| 199 |
+
11: Compute $\overline{I}^{(t)}$ for each parameter in $S^{(t)}$ by (3);
|
| 200 |
+
12: Compute $\Gamma(S_{*j}^{(t)})$ for each $S_{*j}^{(t)}$ in $S^{(t)}$ by (4);
|
| 201 |
+
13: Update $S^{(t + 1)} = \mathcal{T}\left(S^{(t)} - \alpha \nabla_{S^{(t)}}\mathcal{L},\Gamma (S^{(t)})\right)$
|
| 202 |
+
14: Update $U^{(t + 1)} = U^{(t)} - \alpha \nabla_{U^{(t)}}\mathcal{L}$
|
| 203 |
+
15: Update $V^{(t + 1)} = V^{(t)} - \alpha \nabla_{\tilde{V}^{(t)}}\mathcal{L}$
|
| 204 |
+
16: end for
|
| 205 |
+
17: Output: the compressed model.
|
| 206 |
+
|
| 207 |
+
# 4. Experiments
|
| 208 |
+
|
| 209 |
+
We evaluate our method on natural language understanding (NLU), question answering (QA), and natural language generation (NLG) tasks. We apply LoSparse for compressing
|
| 210 |
+
|
| 211 |
+
Table 1. Results of pruned DeBERTaV3-base models on GLUE development set. Here Ratio is the proportion of total remaining weights. Results with N.A. indicate the model does not converge. The best results on each dataset are shown in bold.
|
| 212 |
+
|
| 213 |
+
<table><tr><td>Ratio</td><td>Method</td><td>MNLI m / mm</td><td>RTE Acc</td><td>QNLI Acc</td><td>MRPC Acc / F1</td><td>QQP Acc / F1</td><td>SST-2 Acc</td><td>CoLA Mcc</td><td>STS-B P/S Corr</td></tr><tr><td>100%</td><td>DeBERTaV3base</td><td>90.5 / 90.6</td><td>82.0</td><td>94.0</td><td>89.5 / 93.3</td><td>92.4 / 89.8</td><td>95.3</td><td>69.2</td><td>91.6 / 91.1</td></tr><tr><td rowspan="3">20%</td><td>Movement</td><td>N.A</td><td>61.2</td><td>86.0</td><td>79.2 / 85.0</td><td>N.A.</td><td>89.4</td><td>N.A.</td><td>84.3 / 84.3</td></tr><tr><td>ITP</td><td>82.8 / 82.5</td><td>N.A.</td><td>87.8</td><td>82.0 / 87.0</td><td>90.0 / 86.4</td><td>90.8</td><td>49.0</td><td>87.4 / 87.0</td></tr><tr><td>LoSparse</td><td>84.5 / 83.8</td><td>68.0</td><td>88.6</td><td>85.0 / 89.4</td><td>90.6 / 87.2</td><td>91.7</td><td>50.0</td><td>88.8 / 88.5</td></tr><tr><td rowspan="3">15%</td><td>Movement</td><td>N.A.</td><td>59.0</td><td>N.A</td><td>78.5 / 84.3</td><td>N.A.</td><td>89.0</td><td>N.A.</td><td>83.9 / 83.9</td></tr><tr><td>ITP</td><td>81.7 / 81.3</td><td>N.A.</td><td>85.4</td><td>80.5 / 86.3</td><td>89.1 / 85.2</td><td>89.3</td><td>45.8</td><td>86.8 / 86.3</td></tr><tr><td>LoSparse</td><td>83.3 / 82.9</td><td>66.9</td><td>87.6</td><td>83.6 / 88.0</td><td>90.3 / 87.0</td><td>90.4</td><td>46.8</td><td>87.7 / 87.3</td></tr><tr><td rowspan="3">10%</td><td>Movement</td><td>N.A.</td><td>N.A.</td><td>N.A</td><td>77.0 / 83.4</td><td>N.A.</td><td>88.0</td><td>N.A.</td><td>N.A.</td></tr><tr><td>ITP</td><td>79.7 / 79.6</td><td>N.A.</td><td>82.3</td><td>78.5 / 84.3</td><td>88.3 / 84.4</td><td>88.3</td><td>38.0</td><td>86.3 / 86.0</td></tr><tr><td>LoSparse</td><td>81.7 / 81.8</td><td>66.0</td><td>86.1</td><td>82.3 / 87.4</td><td>89.5 / 86.0</td><td>89.2</td><td>40.0</td><td>87.2 / 87.0</td></tr></table>
|
| 214 |
+
|
| 215 |
+
DeBERTaV3-base (He et al., 2021), BERT-base (Devlin et al., 2018), and BART-large models (Lewis et al., 2020).
|
| 216 |
+
|
| 217 |
+
Implementation Details. Following the prior work (Louizos et al., 2017; Sanh et al., 2020; Zhang et al., 2022), we compress all the backbone weight matrices, except LayerNorm and final prediction head. Our implementation is based on publicly available Huggingface Transformers code-base (Paszke et al., 2019). All the experiments are conducted on NVIDIA V100 GPUs.
|
| 218 |
+
|
| 219 |
+
Baselines. We compare LoSparse with the following baseline methods:
|
| 220 |
+
|
| 221 |
+
- Full fine-tuning is the most common approach for adapting pre-trained model to down-stream tasks. The model is initialized with pre-trained weights and all model parameters are updated through a stochastic gradient decent.
|
| 222 |
+
- Movement pruning is an effective pruning method (Sanh et al., 2020). It multiplies a trainable mask to each neuron during the training. When the mask is smaller than a threshold, the corresponding neuron is pruned.
|
| 223 |
+
- Iterative pruning (ITP) removes neurons directly when their importance scores are lower than a hard threshold at each iteration (Molchanov et al., 2019).
|
| 224 |
+
|
| 225 |
+
# 4.1. Natural Language Understanding
|
| 226 |
+
|
| 227 |
+
Models and Datasets. We evaluate the performance of LoSparse when pruning DeBERTaV3-base models on the General Language Understanding Evaluation (GLUE) benchmark (Wang et al., 2019). GLUE includes two single-sentence classification tasks: SST-2 (Socher et al., 2013) and CoLA (Warstadt et al., 2019), and three similarity and paraphrase tasks: MRPC (Dolan & Brockett, 2005), STS-B (Cer et al., 2017), and QQP. There are also four natural language inference tasks in GLUE: MNLI (Williams et al., 2018), QNLI (Rajpurkar et al., 2016a), RTE (Dagan et al., 2007;
|
| 228 |
+
|
| 229 |
+
Bar-Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009), and WNLI (Levesque et al., 2012). Following previous works, we exclude WNLI in the experiments.
|
| 230 |
+
|
| 231 |
+
Implementation Details. We select the learning rates from $\{1 \times 10^{-5}, 3 \times 10^{-5}, 5 \times 10^{-5}, 8 \times 10^{-5}, 9 \times 10^{-5}, 1 \times 10^{-4}\}$ . We select the proportion of the parameters of all low-rank matrices over all pre-trained parameters from $\{1\%, 2\%, 3\%, 5\% \}$ . We discuss the influence of different proportion later in Section 4.4. More implementation details, such as the training epochs and batch sizes, are presented in the Appendix B.
|
| 232 |
+
|
| 233 |
+
Table 2. Results of pruned BERT-base models on some of GLUE development sets. Here Ratio is the proportion of total remaining weights. Results with N.A. indicate the model does not converge. The best results on each dataset are shown in bold.
|
| 234 |
+
|
| 235 |
+
<table><tr><td>Ratio</td><td>Method</td><td>MNLI m / mm</td><td>RTE Acc</td><td>QNLI Acc</td></tr><tr><td>100%</td><td>Bertbase</td><td>84.5 / 84.6</td><td>70.5</td><td>91.3</td></tr><tr><td rowspan="3">20%</td><td>Movement</td><td>77.0 / 76.9</td><td>N.A.</td><td>84.7</td></tr><tr><td>ITP</td><td>80.1 / 79.8</td><td>64.4</td><td>86.5</td></tr><tr><td>LoSparse</td><td>80.4 / 80.3</td><td>65.2</td><td>86.9</td></tr><tr><td rowspan="3">15%</td><td>Movement</td><td>76.1 / 76.5</td><td>N.A.</td><td>83.9</td></tr><tr><td>ITP</td><td>79.1 / 79.0</td><td>63.2</td><td>85.0</td></tr><tr><td>LoSparse</td><td>79.4 / 79.2</td><td>64.3</td><td>85.9</td></tr><tr><td rowspan="3">10%</td><td>Movement</td><td>73.6 / 74.1</td><td>N.A.</td><td>82.2</td></tr><tr><td>ITP</td><td>77.7 / 78.3</td><td>61.8</td><td>83.9</td></tr><tr><td>LoSparse</td><td>78.3 / 77.8</td><td>63.0</td><td>84.8</td></tr></table>
|
| 236 |
+
|
| 237 |
+
Main Results. We compare our method with the baseline methods under different remaining ratios. The results are shown in Table 1. We see that LoSparse achieves better or on par performance compared with existing approaches on all the datasets of GLUE under all remaining ratios. For example, when the remaining ratio is $10\%$ , LoSparse achieves $81.7\%$ accuracy on MNLI-m dataset, which surpasses the
|
| 238 |
+
|
| 239 |
+
Table 3. Results with DeBERTaV3-base and BERT-base on SQuAD v1.1. Here Ratio is the proportion of remaining weights. The best results on each dataset are shown in bold.
|
| 240 |
+
|
| 241 |
+
<table><tr><td>Ratio</td><td>5%</td><td>10%</td><td>20%</td><td>30%</td><td>40%</td><td>50%</td></tr><tr><td>DeBERTaV3base</td><td></td><td></td><td>87.7 / 93.5</td><td></td><td></td><td></td></tr><tr><td>- ITP</td><td>65.2 / 76.1</td><td>70.9 / 80.3</td><td>75.0 / 83.9</td><td>78.2 / 86.2</td><td>80.5 / 87.5</td><td>81.5 / 89.6</td></tr><tr><td>- LoSparse</td><td>69.3 / 79.1</td><td>72.9 / 82.8</td><td>76.8 / 85.8</td><td>80.2 / 88.0</td><td>82.1 / 89.4</td><td>82.3 / 90.3</td></tr><tr><td>BERTbase</td><td></td><td></td><td>80.9 / 88.2</td><td></td><td></td><td></td></tr><tr><td>- Movement</td><td>N.A.</td><td>51.4 / 64.6</td><td>63.3 / 74.5</td><td>68.8 / 79.0</td><td>73.0 / 82.4</td><td>76.2 / 84.1</td></tr><tr><td>- ITP</td><td>54.0 / 67.3</td><td>62.5 / 74.2</td><td>66.8 / 78.0</td><td>72.3 / 82.4</td><td>74.5 / 84.2</td><td>76.0 / 85.1</td></tr><tr><td>- LoSparse</td><td>57.6 / 70.6</td><td>65.2 / 76.8</td><td>69.7 / 80.4</td><td>73.0 / 82.9</td><td>74.6 / 84.2</td><td>75.8 / 85.1</td></tr></table>
|
| 242 |
+
|
| 243 |
+
best-performing baseline (ITP) by $2\%$ . In addition to the superior performance, our method is more stable than the baselines (e.g. ITP and Movement). This is because each weight matrix in LoSparse at least maintains a low-rank matrix $S$ and always updates it along training horizon. It prevents the dramatic variation of weight matrices from nonzero to zero. By contrast, weight matrices are possibly pruned to zero by other iterative pruning methods. The expressive parts in these weight matrices can alternate between being pruned and updated and finally leads to divergence.
|
| 244 |
+
|
| 245 |
+
Table 2 summarizes the results of pruning BERT-base on MNLI, RTE, and QNLI. Similar to Table 1, our methods outperforms all baselines under all sparsity level for all three datasets. For example, when the remaining ratio is $20\%$ , LoSparse achieves $65.2\%$ accuracy on RTE dataset, while ITP only achieves $64.4\%$ accuracy. We remark that LoSparse is even more effective under high sparsity level. For instance, given the $10\%$ remaining ratio, LoSparse outperforms ITP by $0.6\%$ on MNLI-m dataset (78.3 v.s. 77.7), $1.2\%$ on RTE (63.0 v.s. 61.8), and $0.9\%$ on QNLI (84.8 v.s. 83.9).
|
| 246 |
+
|
| 247 |
+
# 4.2. Question Answering
|
| 248 |
+
|
| 249 |
+
Models and Datasets. We evaluate the performance of our method on the question-answering task (SQuADv1.1, Rajpurkar et al. (2016a)). In the SQuADv1.1, question answering is treated as a sequence labeling problem, where we predict the probability of each token being the start and end of the answer span. We compress DeBERTaV3-base and BERT-base on the SQuADv1.1.
|
| 250 |
+
|
| 251 |
+
Implementation Details. We compress all the backbone weight matrices in DeBERTaV3-base model and BERT-base except layernorm and final classification head. We use learning rates from $\{1 \times 10^{-5}, 3 \times 10^{-5}, 5 \times 10^{-5}, 8 \times 10^{-5}\}$ and pick the learning rate that performs the best. We also select the proportion of parameters of low-rank approximation from $\{1\%, 2\%, 3\%, 5\% \}$ . We choose AdamW as the optimizer and set the batch size as 16. Please refer to the
|
| 252 |
+
|
| 253 |
+
Appendix C for more details.
|
| 254 |
+
|
| 255 |
+
Main Results. We compare our method with the baseline methods under different sparsity levels. The experimental results are shown in Table 3. We can see that LoSparse consistently surpasses baseline methods under all remaining ratios in terms of the two evaluation metrics: exact match (EM) and F1. Similar to our result in GLUE tasks, our method is especially effective with low remaining ratios. For example, LoSparse outperforms ITP by $3.0\%$ in terms of F1 if removing $95\%$ of parameters. Even for high remaining levels, our method still achieves considerable performance gain. For example, LoSparse outperforms ITP by $1.9\%$ in terms of F1 if removing $60\%$ of parameters.
|
| 256 |
+
|
| 257 |
+
Table 3 also summarizes pruning BERT-base with different methods on SQuADv1.1. Our method achieves substantial improvements compared to all baseline methods. For example, our method outperforms the best baseline ITP by $2.6\%$ on F1 given $10\%$ remaining ratio. We remark that ITP is also effective under low sparsity levels. For example, ITP achieves the best result over LoSparse and movement pruning given the remaining ratio as $50\%$ . Our method, however, still behaves on par with ITP with high remaining ratios: both ITP and LoSparse achieve 84.2 on F1 under $40\%$ remaining ratios.
|
| 258 |
+
|
| 259 |
+
# 4.3. Natural Language Generation
|
| 260 |
+
|
| 261 |
+
Models and Datasets. In natural language generation (NLG) tasks, we compress BART-large model (Lewis et al., 2020) to compare LoSparse with baseline methods. We evaluate the performance on the XSum (Narayan et al., 2018) and CNN/DailyMail(Hermann et al., 2015) datasets.
|
| 262 |
+
|
| 263 |
+
Implementation Details. We apply our method to all weight matrices of both encoder and decoder layers. We report ROUGE 1/2/L scores, which are the metrics for summarization tasks (Lin, 2004). Given a fixed total remaining ratio, we try different allocations between the low-rank matrices and the sparse matrices. The best allocation of sparse matrices is $10\%$ . We choose the learning rate from
|
| 264 |
+
|
| 265 |
+
$\{6 \times 10^{-6}, 1 \times 10^{-5}, 2 \times 10^{-5}, 4 \times 10^{-5}, 6 \times 10^{-5}, 1 \times 10^{-4}\}$ . The training epochs and batch sizes are set to 12 and 32 respectively. The beam search length is 8. Please see Appendix D for the detailed configuration.
|
| 266 |
+
|
| 267 |
+
Table 4. Results with BART-large on XSum. Here Ratio is the proportion of remaining weights. We report R-1/2/L. The best results on each dataset are shown in bold. Lead-3 means choosing the first 3 sentences as the summarization.
|
| 268 |
+
|
| 269 |
+
<table><tr><td>Ratio</td><td>Method</td><td>XSum</td><td>CNN/DailyMail</td></tr><tr><td>-100%</td><td>Lead-3BARTlarge</td><td>16.30/1.60/11.9545.14/22.27/37.25</td><td>40.42/17.62/36.6744.16/21.28/40.90</td></tr><tr><td>50%</td><td>ITPLoSparse</td><td>38.42/16.32/31.4339.18/16.91/31.62</td><td>40.76/18.30/37.6541.54/19.04/38.58</td></tr><tr><td>40%</td><td>ITPLoSparse</td><td>36.71/14.96/29.8638.30/16.02/30.72</td><td>40.52/18.10/37.3141.42/19.00/38.47</td></tr><tr><td>30%</td><td>ITPLoSparse</td><td>34.42/13.15/27.9937.41/15.42/30.02</td><td>40.35/17.98/37.1541.21/18.84/38.21</td></tr></table>
|
| 270 |
+
|
| 271 |
+
Main Results. We compare LoSparse with baseline methods under $30\%$ , $40\%$ , and $50\%$ remaining ratios. We do not report results on lower remaining ratios because the baseline methods fail to surpass the Lead-3 baseline. Table 4 summarizes experiment results on the XSum and CNN/DailyMail test datasets. Note that LoSparse consistently surpasses the baseline methods under all remaining ratios in terms of ROUGE scores. For instance, LoSparse outperforms ITP on XSum dataset by 2.99 in terms of ROUGE-1 score. We also remark that LoSparse is more efficient under extremely low remaining ratios. For example, the gain on ROUGE-1 increases from 0.76 to 2.99 when the ratio drops from $50\%$ to $30\%$ . Note that LoSparse is particularly effective on more difficult summarization tasks. For example, XSum is more abstract and hence more difficult than CNN/DailyMail, and LoSparse yields 2.99 gain on XSum compared to 0.86 on CNN/DailyMail.
|
| 272 |
+
|
| 273 |
+
# 4.4. Analysis
|
| 274 |
+
|
| 275 |
+
Effectiveness of Sparse Approximations. We experiment the model compression without sparse approximation to study its effectiveness. Specifically, we compare LoSparse with two variants: (i) we discard the sparse matrices and only fine-tune the low-rank matrices $UV$ (Low-rank 1); (ii) we follow the initialization as (8) but gradually prune the initialized $S$ into zero (Low-rank 2). Figure 5 summarizes the performance of these two variants on MNLI, SQuAD, and XSum. The results show that our method outperforms two low-rank variants, which verifies the effectiveness of the sparse approximation. Moreover, we find Low-rank 2 is better than Low-rank 1. We discuss it in Section 5.
|
| 276 |
+
|
| 277 |
+
Sparsity Allocation. We study how low-rank and sparse approximations cooperate with each other. Specifically, given a fixed remaining ratio, we change the proportion of low-rank matrices and accordingly the ratio of sparse matrices. Figure 6 summarizes the result under different allocations. We see low-rank and sparse approximations exhibit the nearly equal contribution to the performance on NLU tasks as the performance stays stable when changing the allocation.
|
| 278 |
+
|
| 279 |
+
# 4.5. Combination with Knowledge Distillation
|
| 280 |
+
|
| 281 |
+
Knowledge distillation is a popular technique to improve the performance of small models (Romero et al., 2014; Hinton et al., 2015). In knowledge distillation, the small model (student) is trained to mimic the output of a larger finetuned model (teacher) such that the performance of the small model can be improved.
|
| 282 |
+
|
| 283 |
+
We remark that compression methods are complementary to knowledge distillation. We show it by integrating knowledge distillation into LoSparse and other pruning methods. Specifically, we choose a DeBERTaV3-base model that is fine-tuned on specific tasks as the teacher model and a compressed DeBERTaV3-base model as the student model. Then we conduct layer-wise distillation for them. Please see Appendix E for more training details. Table 5 shows the results. We find that distillation can further improve the performance of LoSparse and other compression methods. It shows that compression and knowledge distillation are complementary to each other. Besides, LoSparse still achieves better performance than ITP when integrated with distillation. It demonstrates the effectiveness of LoSparse in the setting of distillation.
|
| 284 |
+
|
| 285 |
+
Table 5. Results of distilling the fined-tuned DeBERTaV3-base to the compressed DeBERTaV3-base on MNLI, SQuAD, SST-2, and RTE. We compress the model to $20\%$ of its original size by LoSparse and ITP, and then conduct layer-wise distillation.
|
| 286 |
+
|
| 287 |
+
<table><tr><td>Method</td><td>MNLI</td><td>SQuAD</td><td>SST-2</td><td>RTE</td></tr><tr><td>DeBERTabase</td><td>90.5</td><td>87.6 / 93.5</td><td>96.1</td><td>82.0</td></tr><tr><td>ITP</td><td>85.9</td><td>77.9 / 87.2</td><td>92.0</td><td>58.1</td></tr><tr><td>LoSparse</td><td>84.6 / 84.7</td><td>81.0 / 89.8</td><td>93.2</td><td>71.1</td></tr></table>
|
| 288 |
+
|
| 289 |
+
We conduct further investigation on the performance of combining LoSparse and knowledge distillation on BERT-base models. Similarly, we choose a BERT-base model that is fine-tuned on specific tasks as the teacher model and a compressed BERT-base model as the student model. We find out combining LoSparse and knowledge distillation can achieve a comparable or even better performance than popular compression method, such as PKD (Sun et al., 2019),
|
| 290 |
+
|
| 291 |
+

|
| 292 |
+
(a) SQuAD v1.1
|
| 293 |
+
|
| 294 |
+

|
| 295 |
+
(b) MNLI-m
|
| 296 |
+
|
| 297 |
+

|
| 298 |
+
(c) XSum
|
| 299 |
+
|
| 300 |
+

|
| 301 |
+
Figure 5. Comparison between LoSparse and two variants of low-rank approximation on different tasks. The $x$ -axis represents the remaining ratios. LoSparse outperforms all other low-rank approximation variants. It indicates adding sparse approximation can promote the performance low-rank approximation.
|
| 302 |
+
(a) SST-2
|
| 303 |
+
Figure 6. Results about sparsity allocations. The $x$ -axis represents the proportion of low-rank matrices over total pre-trained weights. The performance stays stable as changing the low-rank ratio. It suggests that our method is not sensitive to low-rank ratio.
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
(b) SQuAD v1.1
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
(c)QNLI
|
| 310 |
+
|
| 311 |
+
MixKD (Liang et al., 2020), CoDIR (Sun et al., 2020), BERT-of-Theseus (Xu et al., 2020), Low-Rank BERT Feature Distillation + KD (Noach & Goldberg, 2020), Path2: BERT+FWSVD(Hsu et al., 2022b). Please see Appendix E for more training details.
|
| 312 |
+
|
| 313 |
+
Table 6 shows the comparison of the aforementioned methods. From the table, we can see that LoSparse combined with knowledge distillation can achieve an on-par or better result than most distillation methods, such as PKD, under different remaining ratio. Our method also excels the combination of low-rank approximation methods and knowledge distillation such as Low-Rank BERT Feature Distillation + KD.
|
| 314 |
+
|
| 315 |
+
# 4.6. Embed with Other Compression Method
|
| 316 |
+
|
| 317 |
+
LoSparse is a generic compression method. It can be embedded into other popular methods, such as CoFi (Xia et al., 2022). CoFi is a coarse to fine-grained compression approach. It uses 3-level masks to determine which layer, heads, and neurons should be pruned. In the first level, it adds masks to MHA sub-layers and FFN sub-layers as a coarse compression. In the second level, it adds masks to the attention heads inside the MHA. In the final level, it adds masks to every neuron as the third level compression.
|
| 318 |
+
|
| 319 |
+
In addition, it utilizes knowledge distillation to enhance the performance.
|
| 320 |
+
|
| 321 |
+
To embed our method into CoFi, we replace the third level masks as our method and keep the first and second level masks. Specifically, we first decompose the pre-trained weight matrices into low-rank and sparse matrices. Then, we follow the same training approach as CoFi. As for distillation, since CoFi has not released the teacher models, we download all the teacher models from Text Attack $^{2}$ (Morris et al., 2020) except teachers for the MNLI task. To obtain the MNLI teacher, we fine-tune BERT-base using following hyperparameters: learning rate is $3 \times 10^{-5}$ , batch size is 32, number of training epochs is 3. See Appendix F for more experiment details.
|
| 322 |
+
|
| 323 |
+
Experiment results are listed in Table 7. We see that LoSparse can improve the performance of CoFi on all datasets. For example, our method improves the accuracy by around $1\%$ on MRPC, RTE, and SST-2. This notable improvement shows LoSparse is complementary to existing compression methods.
|
| 324 |
+
|
| 325 |
+
Table 6. Results of distilling the fined-tuned BERT-base to the compressed BERT-base on MNLI, RTE, QNLI, and SST-2. We compress the model to $25\%$ and $50\%$ of its original size by LoSparse, and then conduct layer-wise distillation.
|
| 326 |
+
|
| 327 |
+
<table><tr><td>Ratio</td><td>Method</td><td>MNLI</td><td>RTE</td><td>QNLI</td><td>SST-2</td></tr><tr><td rowspan="7">50%</td><td>PKD</td><td>81.5 / 81.0</td><td>65.5</td><td>89.0</td><td>92.0</td></tr><tr><td>MixKD</td><td>82.2 / 81.2</td><td>68.3</td><td>88.2</td><td>92.5</td></tr><tr><td>CoDIR-Fine</td><td>83.6 / 82.8</td><td>65.6</td><td>90.4</td><td>93.6</td></tr><tr><td>BERT-of-Theseus</td><td>82.3 / N.A.</td><td>68.2</td><td>89.5</td><td>91.5</td></tr><tr><td>Low Rank BERT Feature Distillation + KD</td><td>84.8 / 83.7</td><td>71.1</td><td>91.4</td><td>92.4</td></tr><tr><td>Path2: BERT+FWSVD</td><td>83.0 / N.A.</td><td>N.A.</td><td>89.5</td><td>91.2</td></tr><tr><td>LoSparse + distillation</td><td>85.1 / 85.3</td><td>75.8</td><td>92.2</td><td>93.2</td></tr><tr><td rowspan="4">25%</td><td>PKD</td><td>76.7 / 76.3</td><td>58.2</td><td>84.7</td><td>87.5</td></tr><tr><td>MixKD</td><td>77.2 / 76.8</td><td>62.0</td><td>84.4</td><td>89.5</td></tr><tr><td>BERT-of-Theseus</td><td>78.8 / N.A.</td><td>59.5</td><td>82.1</td><td>87.2</td></tr><tr><td>LoSparse + distillation</td><td>84.6 / 84.7</td><td>72.2</td><td>91.4</td><td>92.3</td></tr></table>
|
| 328 |
+
|
| 329 |
+
Table 7. Embed LoSparse into CoFi. The compression ratio is $10\%$ . $\mathrm{BERT}_{\mathrm{base}}$ indicates the fine-tuning results and is also the teacher model for knowledge distillation. CoFi and LoSparse are all applied in $\mathrm{BERT}_{\mathrm{base}}$ . The best performances are in bold.
|
| 330 |
+
|
| 331 |
+
<table><tr><td>Ratio</td><td>MNLI Acc</td><td>MRPC Acc / F1</td><td>RTE Acc</td><td>QNLI Acc</td><td>SST-2 Acc</td></tr><tr><td>BERTbase</td><td>84.41</td><td>87.74 / 91.35</td><td>72.56</td><td>91.54</td><td>92.43</td></tr><tr><td>CoFi</td><td>80.00</td><td>84.07 / 88.50</td><td>67.51</td><td>86.67</td><td>90.60</td></tr><tr><td>CoFi+LoSparse</td><td>82.56</td><td>85.54 / 89.45</td><td>68.23</td><td>89.66</td><td>91.51</td></tr></table>
|
| 332 |
+
|
| 333 |
+
# 5. Discussion
|
| 334 |
+
|
| 335 |
+
In Section 4.4, we find Low-rank 2 performs much better than Low-rank 1. That is, pruning out all sparse matrices is more effective than fine-tuning a low-rank matrix that is obtained from singular value thresholding. This result suggests that our method is capable of enhancing the low-rank approximation. This is because the initialization of Low-rank 1 is different from the pre-trained weights such that it may lose too much knowledge from the pre-trained weights. As a result, the performance drops severely on downstream tasks. Our method, on the other hand, bridges the gap between low-rank initialization and the pre-trained weight so as to retain the original knowledge stored in the pre-trained weights. This suggests that, although the low-rank approximation alone is more efficient and concise, we should leverage the sparse approximation to guide its training process. Beside the improvement brought by our method, low-rank approximation, however, still have an intrinsic drawback. They ignore the diversity of neurons. Therefore, our method is crucial to remedy this drawback.
|
| 336 |
+
|
| 337 |
+
Yu et al. (2017); Hawkins et al. (2021) have applied the low-rank and sparse compression to CNN. They mask out some kernels in a convolution layer as the sparse approximation and add two sequential convolutional layers that are parallel
|
| 338 |
+
|
| 339 |
+
to the sparse convolutional layer as the low-rank approximation. This approach, however, does not directly approximate any matrix, which makes the low-rank and sparse approximation unrelated. In addition, the kernels in CNN do not have as many dimensions as the matrices in transformer-based models. Therefore, the CNN kernels inherently have fewer ranks, thereby diminishing their efficacy when high compression rates are wanted.
|
| 340 |
+
|
| 341 |
+
# 6. Conclusion
|
| 342 |
+
|
| 343 |
+
We propose LoSparse, a compression method for transformer models, which combines the low-rank approximation and the structured sparse approximation. Experiments on natural language understanding, question answering, and natural language generation show that our method significantly surpasses previous compression approaches. Moreover, our method is particularly effective in natural language generation tasks and the setting of extremely high sparsity level. We show that our method is generic and complementary with other popular compression methods. Experiments show LoSparse can improve the performance of CoFi and conventional iterative pruning with knowledge distillation.
|
| 344 |
+
|
| 345 |
+
# References
|
| 346 |
+
|
| 347 |
+
Bar-Haim, R., Dagan, I., Dolan, B., Ferro, L., Giampiccolo, D., Magnini, B., and Szpektor, I. The second pascal recognising textual entailment challenge. 2006.
|
| 348 |
+
Bentivogli, L., Clark, P., Dagan, I., and Giampiccolo, D. The fifth pascal recognizing textual entailment challenge. In TAC, 2009.
|
| 349 |
+
Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems, 33: 1877-1901, 2020.
|
| 350 |
+
Cer, D., Diab, M., Agirre, E., Lopez-Gazpio, I., and Specia, L. SemEval-2017 task 1: Semantic textual similarity multilingual and crosslingual focused evaluation. In Proceedings of the 11th International Workshop on Semantic Evaluation (SemEval-2017), pp. 1-14, Vancouver, Canada, August 2017. Association for Computational Linguistics. doi: 10.18653/v1/S17-2001.
|
| 351 |
+
Dagan, I., Glickman, O., and Magnini, B. The Pascal recognising textual entailment challenge. In Machine Learning Challenges Workshop, 2007.
|
| 352 |
+
Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 353 |
+
Dolan, W. B. and Brockett, C. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 354 |
+
Fan, A., Grave, E., and Joulin, A. Reducing transformer depth on demand with structured dropout. arXiv preprint arXiv:1909.11556, 2019.
|
| 355 |
+
Giampiccolo, D., Magnini, B., Dagan, I., and Dolan, B. The third PASCAL recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL Workshop on Textual Entailment and Paraphrasing, pp. 1-9, Prague, June 2007. Association for Computational Linguistics.
|
| 356 |
+
Hajimolahoseini, H., Rezagholizadeh, M., Partovinia, V., Tahaei, M., Awad, O. M., and Liu, Y. Compressing pre-trained language models using progressive low rank decomposition.
|
| 357 |
+
Han, S., Pool, J., Tran, J., and Dally, W. Learning both weights and connections for efficient neural network. Advances in neural information processing systems, 28, 2015.
|
| 358 |
+
|
| 359 |
+
Hawkins, C., Yang, H., Li, M., Lai, L., and Chandra, V. Low-rank+ sparse tensor compression for neural networks. arXiv preprint arXiv:2111.01697, 2021.
|
| 360 |
+
He, P., Liu, X., Gao, J., and Chen, W. Deberta: Decoding-enhanced bert with disentangled attention. arXiv preprint arXiv:2006.03654, 2020.
|
| 361 |
+
He, P., Gao, J., and Chen, W. Debertav3: Improving deberta using electra-style pre-training with gradient-disentangled embedding sharing, 2021.
|
| 362 |
+
Hermann, K. M., Kocisky, T., Grefenstette, E., Espeholt, L., Kay, W., Suleyman, M., and Blunsom, P. Teaching machines to read and comprehend. Advances in neural information processing systems, 28, 2015.
|
| 363 |
+
Hinton, G., Vinyals, O., Dean, J., et al. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2(7), 2015.
|
| 364 |
+
Hsu, Y.-C., Hua, T., Chang, S., Lou, Q., Shen, Y., and Jin, H. Language model compression with weighted low-rank factorization. arXiv preprint arXiv:2207.00112, 2022a.
|
| 365 |
+
Hsu, Y.-C., Hua, T., Chang, S.-E., Lou, Q., Shen, Y., and Jin, H. Language model compression with weighted low-rank factorization. ArXiv, abs/2207.00112, 2022b.
|
| 366 |
+
Jalali, A., Sanghavi, S., Ruan, C., and Ravikumar, P. A dirty model for multi-task learning. Advances in neural information processing systems, 23, 2010.
|
| 367 |
+
Lagunas, F., Charlaix, E., Sanh, V., and Rush, A. M. Block pruning for faster transformers. arXiv preprint arXiv:2109.04838, 2021.
|
| 368 |
+
Levesque, H., Davis, E., and Morgenstern, L. The winograd schema challenge. In Thirteenth international conference on the principles of knowledge representation and reasoning, 2012.
|
| 369 |
+
Lewis, M., Liu, Y., Goyal, N., Ghazvininejad, M., Mohamed, A., Levy, O., Stoyanov, V., and Zettlemoyer, L. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871-7880, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.703.
|
| 370 |
+
Liang, C., Zuo, S., Chen, M., Jiang, H., Liu, X., He, P., Zhao, T., and Chen, W. Super tickets in pre-trained language models: From model compression to improving generalization. arXiv preprint arXiv:2105.12002, 2021.
|
| 371 |
+
Liang, K. J., Hao, W., Shen, D., Zhou, Y., Chen, W., Chen, C., and Carin, L. Mixkd: Towards efficient distillation
|
| 372 |
+
|
| 373 |
+
of large-scale language models. ArXiv, abs/2011.00593, 2020.
|
| 374 |
+
Lin, C.-Y. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, pp. 74-81, Barcelona, Spain, July 2004. Association for Computational Linguistics.
|
| 375 |
+
Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., and Stoyanov, V. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 376 |
+
Louizos, C., Welling, M., and Kingma, D. P. Learning sparse neural networks through $l\_0$ regularization. arXiv preprint arXiv:1712.01312, 2017.
|
| 377 |
+
McCarley, J., Chakravarti, R., and Sil, A. Structured pruning of a bert-based question answering model. arXiv preprint arXiv:1910.06360, 2019.
|
| 378 |
+
Molchanov, P., Tyree, S., Karras, T., Aila, T., and Kautz, J. Pruning convolutional neural networks for resource efficient inference. arXiv preprint arXiv:1611.06440, 2016.
|
| 379 |
+
Molchanov, P., Mallya, A., Tyree, S., Frosio, I., and Kautz, J. Importance estimation for neural network pruning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11264-11272, 2019.
|
| 380 |
+
Morris, J., Lifland, E., Yoo, J. Y., Grigsby, J., Jin, D., and Qi, Y. Textattack: A framework for adversarial attacks, data augmentation, and adversarial training in nlp. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 119-126, 2020.
|
| 381 |
+
Narayan, S., Cohen, S. B., and Lapata, M. Don't give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. ArXiv, abs/1808.08745, 2018.
|
| 382 |
+
Noach, M. B. and Goldberg, Y. Compressing pre-trained language models by matrix decomposition. In AACL, 2020.
|
| 383 |
+
Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Kopf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L., Bai, J., and Chintala, S. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32, pp. 8024-8035. Curran Associates, Inc., 2019.
|
| 384 |
+
Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
|
| 385 |
+
|
| 386 |
+
Rajpurkar, P., Zhang, J., Lopyrev, K., and Liang, P. SQuAD: 100,000+ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2383-2392, Austin, Texas, November 2016a. Association for Computational Linguistics. doi: 10.18653/v1/D16-1264.
|
| 387 |
+
Rajpurkar, P., Zhang, J., Lopyrev, K., and Liang, P. Squad: 100,000+ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016b.
|
| 388 |
+
Romero, A., Ballas, N., Kahou, S. E., Chassang, A., Gatta, C., and Bengio, Y. Fitnets: Hints for thin deep nets. arXiv preprint arXiv:1412.6550, 2014.
|
| 389 |
+
Sanh, V., Wolf, T., and Rush, A. Movement pruning: Adaptive sparsity by fine-tuning. Advances in Neural Information Processing Systems, 33:20378-20389, 2020.
|
| 390 |
+
Socher, R., Perelygin, A., Wu, J., Chuang, J., Manning, C. D., Ng, A., and Potts, C. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 1631-1642, Seattle, Washington, USA, October 2013. Association for Computational Linguistics.
|
| 391 |
+
Sun, S., Cheng, Y., Gan, Z., and Liu, J. Patient knowledge distillation for bert model compression. In Conference on Empirical Methods in Natural Language Processing, 2019.
|
| 392 |
+
Sun, S., Gan, Z., Cheng, Y., Fang, Y., Wang, S., and Liu, J. Contrastive distillation on intermediate representations for language model compression. In Conference on Empirical Methods in Natural Language Processing, 2020.
|
| 393 |
+
Tahaei, M. S., Charlaix, E., Nia, V. P., Ghodsi, A., and Rezagholizadeh, M. Kroneckerbert: Learning kronecker decomposition for pre-trained language models via knowledge distillation. arXiv preprint arXiv:2109.06243, 2021.
|
| 394 |
+
Wang, A., Singh, A., Michael, J., Hill, F., Levy, O., and Bowman, S. R. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In International Conference on Learning Representations, 2019.
|
| 395 |
+
Warstadt, A., Singh, A., and Bowman, S. R. Neural network acceptability judgments. Transactions of the Association for Computational Linguistics, 7:625-641, 2019. doi: 10.1162/tacl_a_00290.
|
| 396 |
+
Williams, A., Nangia, N., and Bowman, S. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association
|
| 397 |
+
|
| 398 |
+
for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 1112-1122, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1101.
|
| 399 |
+
Xia, M., Zhong, Z., and Chen, D. Structured pruning learns compact and accurate models. arXiv preprint arXiv:2204.00408, 2022.
|
| 400 |
+
Xu, C., Zhou, W., Ge, T., Wei, F., and Zhou, M. Bert-of-theseus: Compressing bert by progressive module replacing. In Conference on Empirical Methods in Natural Language Processing, 2020.
|
| 401 |
+
Yu, X., Liu, T., Wang, X., and Tao, D. On compressing deep models by low rank and sparse decomposition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7370-7379, 2017.
|
| 402 |
+
Zhang, Q., Zuo, S., Liang, C., Bukharin, A., He, P., Chen, W., and Zhao, T. Platon: Pruning large transformer models with upper confidence bound of weight importance. In International Conference on Machine Learning, pp. 26809-26823. PMLR, 2022.
|
| 403 |
+
Zhu, M. and Gupta, S. To prune, or not to prune: exploring the efficacy of pruning for model compression. arXiv preprint arXiv:1710.01878, 2017.
|
| 404 |
+
|
| 405 |
+
# A. GLUE Dataset Statistics
|
| 406 |
+
|
| 407 |
+
We present the dataset statistics of GLUE (Wang et al., 2019) in the following table.
|
| 408 |
+
|
| 409 |
+
<table><tr><td>Corpus</td><td>Task</td><td>#Train</td><td>#Dev</td><td>#Test</td><td>#Label</td><td>Metrics</td></tr><tr><td colspan="7">Single-Sentence Classification (GLUE)</td></tr><tr><td>CoLA</td><td>Acceptability</td><td>8.5k</td><td>1k</td><td>1k</td><td>2</td><td>Matthews corr</td></tr><tr><td>SST</td><td>Sentiment</td><td>67k</td><td>872</td><td>1.8k</td><td>2</td><td>Accuracy</td></tr><tr><td colspan="7">Pairwise Text Classification (GLUE)</td></tr><tr><td>MNLI</td><td>NLI</td><td>393k</td><td>20k</td><td>20k</td><td>3</td><td>Accuracy</td></tr><tr><td>RTE</td><td>NLI</td><td>2.5k</td><td>276</td><td>3k</td><td>2</td><td>Accuracy</td></tr><tr><td>QQP</td><td>Paraphrase</td><td>364k</td><td>40k</td><td>391k</td><td>2</td><td>Accuracy/F1</td></tr><tr><td>MRPC</td><td>Paraphrase</td><td>3.7k</td><td>408</td><td>1.7k</td><td>2</td><td>Accuracy/F1</td></tr><tr><td>QNLI</td><td>QA/NLI</td><td>108k</td><td>5.7k</td><td>5.7k</td><td>2</td><td>Accuracy</td></tr><tr><td colspan="7">Text Similarity (GLUE)</td></tr><tr><td>STS-B</td><td>Similarity</td><td>7k</td><td>1.5k</td><td>1.4k</td><td>1</td><td>Pearson/Spearman corr</td></tr></table>
|
| 410 |
+
|
| 411 |
+
Table 8. Summary of the GLUE benchmark.
|
| 412 |
+
|
| 413 |
+
# B. Natural Language Understanding
|
| 414 |
+
|
| 415 |
+
# B.1. Training Details
|
| 416 |
+
|
| 417 |
+
Implementation Details. The implementation of LoSparse is based on publicly available Huggingface (Paszke et al., 2019) code-base $^{3}$ .
|
| 418 |
+
|
| 419 |
+
# Hyper-parameter Details.
|
| 420 |
+
|
| 421 |
+
We select the proportion of the parameters $r$ of all low-rank matrices over all pre-trained parameters from $\{1\%, 2\%, 3\%, 5\% \}$ and present the best final ratio we choose as below. Neuron importance scores are often unstable during training due to the variance between different data from different batches and different training dynamics between iterations (e.g. dropout) (Zhang et al., 2022). In addition to involving exponential moving of average in calculating the neuron importance score, we attempt large batch sizes to calculate a more smooth and accurate importance score. We find out large batch sizes are profoundly helpful in most GLUE tasks. Therefore, we apply a large batch size on most tasks in GLUE.
|
| 422 |
+
|
| 423 |
+
For the choice of pruning hyperparameters, we follow the pruning schedule of Zhang et al. (2022), i.e. the training epochs, initial warm up, and final warm up. We only change the warm up steps to accommodate the change in batch sizes as the total training steps will change when batch size changes. We also use the same $\beta$ as Zhang et al. (2022) except for some minor changes in CoLA and RTE task.
|
| 424 |
+
|
| 425 |
+
Table 9 summarizes the detailed hyperparameters for each task used in pruning DeBERTaV3-base. Table 10 summarizes the detailed hyperparameters for each task used in pruning BERT-base.
|
| 426 |
+
|
| 427 |
+
# C. Question Answering
|
| 428 |
+
|
| 429 |
+
# C.1. Dataset
|
| 430 |
+
|
| 431 |
+
Following Sanh et al. (2020), we also choose SQuAD v1.1 (Rajpurkar et al., 2016b) to evaluate the performance of LoSparse on question answering task.
|
| 432 |
+
|
| 433 |
+
Table 9. Hyper-parameter setup of LoSparse for GLUE benchmark for pruning DeBERTaV3-base.
|
| 434 |
+
|
| 435 |
+
<table><tr><td>Ratio</td><td>Hyper-parameter</td><td>MNLI</td><td>RTE</td><td>QNLI</td><td>MRPC</td><td>QQP</td><td>SST-2</td><td>CoLA</td><td>STS-B</td></tr><tr><td></td><td># epochs</td><td>8</td><td>20</td><td>10</td><td>10</td><td>10</td><td>6</td><td>15</td><td>15</td></tr><tr><td></td><td>Batch size</td><td>256</td><td>128</td><td>256</td><td>64</td><td>256</td><td>256</td><td>256</td><td>16</td></tr><tr><td></td><td>Learning rate</td><td>9 × 10-5</td><td>1 × 10-4</td><td>5 × 10-5</td><td>1 × 10-4</td><td>5 × 10-5</td><td>8 × 10-5</td><td>3 × 10-4</td><td>1 × 10-4</td></tr><tr><td></td><td>ti</td><td>675</td><td>25</td><td>250</td><td>38</td><td>675</td><td>125</td><td>62</td><td>500</td></tr><tr><td></td><td>tf</td><td>3375</td><td>150</td><td>1500</td><td>112</td><td>2750</td><td>1250</td><td>187</td><td>2500</td></tr><tr><td rowspan="2">20%</td><td>β</td><td>0.85</td><td>0.75</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.7</td><td>0.85</td></tr><tr><td>r</td><td>5%</td><td>2%</td><td>3%</td><td>5%</td><td>2%</td><td>1%</td><td>2%</td><td>2%</td></tr><tr><td rowspan="2">15%</td><td>β</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.75</td><td>0.85</td></tr><tr><td>r</td><td>3%</td><td>2%</td><td>1%</td><td>1%</td><td>3%</td><td>3%</td><td>2%</td><td>2%</td></tr><tr><td rowspan="2">10%</td><td>β</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.85</td><td>0.8</td><td>0.85</td></tr><tr><td>r</td><td>3%</td><td>2%</td><td>5%</td><td>3%</td><td>5%</td><td>1%</td><td>2%</td><td>2%</td></tr></table>
|
| 436 |
+
|
| 437 |
+
Table 10. Hyper-parameter setup of LoSparse for GLUE benchmark for pruning BERT-base.
|
| 438 |
+
|
| 439 |
+
<table><tr><td>Ratio</td><td>Hyper-parameter</td><td>MNLI</td><td>RTE</td><td>QNLI</td></tr><tr><td></td><td># epochs</td><td>8</td><td>20</td><td>10</td></tr><tr><td></td><td>Batch size</td><td>256</td><td>128</td><td>256</td></tr><tr><td></td><td>Learning rate</td><td>5 × 10-5</td><td>5 × 10-5</td><td>5 × 10-5</td></tr><tr><td></td><td>ti</td><td>675</td><td>25</td><td>250</td></tr><tr><td></td><td>tf</td><td>3375</td><td>150</td><td>1500</td></tr><tr><td rowspan="2">20%</td><td>β</td><td>0.85</td><td>0.60</td><td>0.85</td></tr><tr><td>r</td><td>5%</td><td>2%</td><td>2%</td></tr><tr><td rowspan="2">15%</td><td>β</td><td>0.85</td><td>0.7</td><td>0.85</td></tr><tr><td>r</td><td>5%</td><td>2%</td><td>3%</td></tr><tr><td rowspan="2">10%</td><td>β</td><td>0.85</td><td>0.50</td><td>0.85</td></tr><tr><td>r</td><td>5%</td><td>2%</td><td>3%</td></tr></table>
|
| 440 |
+
|
| 441 |
+
# C.2. Training Details
|
| 442 |
+
|
| 443 |
+
We set the batch size as 16, the number of epochs for fine-tuning as 10, the optimizer as AdamW and the learning rate as $5 \times 10^{-5}$ for all experiments. Similarly, we follow the pruning schedule of Zhang et al. (2022), i.e. we take the same initial warm up steps and final warm up steps. We use the same settings for all sparsities. The hyperparameters are summarized specifically in Table 11. We use the hyperparameters in Table 11 for pruning both DeBERTaV3-base and BERT-base.
|
| 444 |
+
|
| 445 |
+
Table 11. Hyper-parameter setup of LoSparse on question answering tasks (SQuAD v1.1, Rajpurkar et al. (2016b)).
|
| 446 |
+
|
| 447 |
+
<table><tr><td>Task</td><td># epochs</td><td>Batch size</td><td>Learning rate</td><td>ti</td><td>tf</td><td>r</td><td>β</td></tr><tr><td>SQuAD</td><td>10</td><td>16</td><td>5 × 10-5</td><td>5400</td><td>22000</td><td>5%</td><td>0.85</td></tr></table>
|
| 448 |
+
|
| 449 |
+
# D. Natural Language Generation
|
| 450 |
+
|
| 451 |
+
# D.1. Training Details
|
| 452 |
+
|
| 453 |
+
We set the batch size as 32, the number of training epoch as 10. We choose Adam as the optimizer and try learning rate from $\{6 \times 10^{-6}, 1 \times 10^{-5}, 2 \times 10^{-5}, 4 \times 10^{-5}, 6 \times 10^{-5}, 1 \times 10^{-4}\}$ . We find the optimal learning rate is $4 \times 10^{-5}$ . We also adjust the sparse approximation ratio, choosing from $5\%$ , $10\%$ , $15\%$ , $20\%$ . We find the best sparse ratio is $10\%$ . We also fix the initial warm up steps $t_i$ as 12800, final warm up steps $t_f$ as 51200, and $\beta$ as 0.85.
|
| 454 |
+
|
| 455 |
+
# E. Combination with Knowledge Distillation
|
| 456 |
+
|
| 457 |
+
# E.1. Teacher Models
|
| 458 |
+
|
| 459 |
+
For DeBERTaV3-base teacher models, We trained the teacher models following the hyperparameters of in He et al. (2021)'s official repository ${}^{4}$ . The performance of the teacher model are shown in Table 5.
|
| 460 |
+
|
| 461 |
+
For BERT-base teacher models, we used the teacher models released on Huggingface by textattack $^{5}$ .
|
| 462 |
+
|
| 463 |
+
# E.2. Training Details
|
| 464 |
+
|
| 465 |
+
We first prune the model following the details Table 9. Then, we conduct layerwise distillation with distillation coefficient $\alpha$ as 15. The other training hyperparameters are listed as below.
|
| 466 |
+
|
| 467 |
+
Table 12. Hyper-parameter setup of LoSparse on knowledge distillation with DeBERTaV3-base.
|
| 468 |
+
|
| 469 |
+
<table><tr><td>Task</td><td># epochs</td><td>Batch size</td><td>Learning rate</td><td>alpha_output</td><td>alpha_layer</td></tr><tr><td>MNLI</td><td>50</td><td>32</td><td>9 × 10-5</td><td>0</td><td>15</td></tr><tr><td>SQuAD</td><td>50</td><td>16</td><td>5 × 10-5</td><td>0</td><td>15</td></tr><tr><td>SST-2</td><td>50</td><td>32</td><td>8 × 10-5</td><td>0</td><td>15</td></tr><tr><td>RTE</td><td>50</td><td>16</td><td>1 × 10-4</td><td>0</td><td>15</td></tr></table>
|
| 470 |
+
|
| 471 |
+
Table 13. Hyper-parameter setup of LoSparse on knowledge distillation with BERT-base.
|
| 472 |
+
|
| 473 |
+
<table><tr><td>Task</td><td># epochs</td><td>Batch size</td><td>Learning rate</td><td>alpha_output</td><td>alpha_layer</td></tr><tr><td>MNLI</td><td>50</td><td>32</td><td>9 × 10-5</td><td>0</td><td>15</td></tr><tr><td>RTE</td><td>50</td><td>16</td><td>5 × 10-5</td><td>0</td><td>15</td></tr><tr><td>QNLI</td><td>50</td><td>32</td><td>5 × 10-5</td><td>5</td><td>5</td></tr><tr><td>SST-2</td><td>50</td><td>32</td><td>3 × 10-4</td><td>1</td><td>1</td></tr></table>
|
| 474 |
+
|
| 475 |
+
# F. Combination with CoFi
|
| 476 |
+
|
| 477 |
+
# F.1. Teacher Models
|
| 478 |
+
|
| 479 |
+
As CoFi has not released the teacher models, we download all the teacher models from Text Attack $^{6}$ (Morris et al., 2020) except teachers for the MNLI task. To obtain the MNLI teacher, we fine-tune BERT-base using following hyperparameters: learning rate: $3 \times 10^{-5}$ , batch size: 32, training epochs: 3.
|
| 480 |
+
|
| 481 |
+
# F.2. Training Details
|
| 482 |
+
|
| 483 |
+
CoFi masks out hidden states to control the remaining parameters while our method compress matrices directly, so the total compression ratio is easily calculated as ratio $= \text{ratio}_{\text{CoFi}} \times \text{ratio}_{\text{LoSparse}}$ . We choose ratio $\text{ratio}_{\text{LoSparse}} = 0.5$ and ratio $\text{ratio}_{\text{CoFi}} = 0.2$ for $10\%$ total compression ratio.
|
| 484 |
+
|
| 485 |
+
For LoSparse part, we use the same hyperparameters in Appendix B. As for CoFi, please refer the training schedule and the rest hyperparameters to its official repository $^{7}$ .
|
2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c1d0dfabdec1d24c79f9089a663773d52b524fbd4cf805fb52a6c71e1b7e8e99
|
| 3 |
+
size 757783
|
2023/LoSparse_ Structured Compression of Large Language Models based on Low-Rank and Sparse Approximation/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/d4333f3a-de2a-4e20-88e3-332909cc80b5_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/d4333f3a-de2a-4e20-88e3-332909cc80b5_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/d4333f3a-de2a-4e20-88e3-332909cc80b5_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:88965e382530237e177ecc81ccff13419af371d54d36eaabe3af502f913ef69e
|
| 3 |
+
size 977533
|
2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/full.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b9e201597d0daf365f503ad826b32a14a5f5a1b20fe1ed193221229645031f4
|
| 3 |
+
size 1456313
|
2023/Local Optimization Achieves Global Optimality in Multi-Agent Reinforcement Learning/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Local Vertex Colouring Graph Neural Networks/b276e029-3d94-4a87-a17e-00ceccdbf061_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Local Vertex Colouring Graph Neural Networks/b276e029-3d94-4a87-a17e-00ceccdbf061_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Local Vertex Colouring Graph Neural Networks/b276e029-3d94-4a87-a17e-00ceccdbf061_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2c566184cf71500322cf4791826805139d386508edb99f59b48b133de7fd9c21
|
| 3 |
+
size 1914882
|
2023/Local Vertex Colouring Graph Neural Networks/full.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Local Vertex Colouring Graph Neural Networks/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c0f99c33ddba9dbff02768d6a13047e12b442e460d1dd7338629db1037e14821
|
| 3 |
+
size 720167
|
2023/Local Vertex Colouring Graph Neural Networks/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/9e0d9a67-2038-4371-8bb5-ee98ea285471_content_list.json
ADDED
|
@@ -0,0 +1,1929 @@
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "Locally Regularized Neural Differential Equations: Some Black Boxes Were Meant to Remain Closed!",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
228,
|
| 8 |
+
109,
|
| 9 |
+
746,
|
| 10 |
+
154
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Avik Pal $^{12}$ Alan Edelman $^{13}$ Christopher Rackauckas",
|
| 17 |
+
"bbox": [
|
| 18 |
+
285,
|
| 19 |
+
195,
|
| 20 |
+
684,
|
| 21 |
+
212
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "Abstract",
|
| 28 |
+
"text_level": 1,
|
| 29 |
+
"bbox": [
|
| 30 |
+
241,
|
| 31 |
+
239,
|
| 32 |
+
320,
|
| 33 |
+
255
|
| 34 |
+
],
|
| 35 |
+
"page_idx": 0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"type": "text",
|
| 39 |
+
"text": "Implicit layer deep learning techniques, like Neural Differential Equations, have become an important modeling framework due to their ability to adapt to new problems automatically. Training a neural differential equation is effectively a search over a space of plausible dynamical systems. However, controlling the computational cost for these models is difficult since it relies on the number of steps the adaptive solver takes. Most prior works have used higher-order methods to reduce prediction timings while greatly increasing training time or reducing both training and prediction timings by relying on specific training algorithms, which are harder to use as a drop-in replacement due to strict requirements on automatic differentiation. In this manuscript, we use internal cost heuristics of adaptive differential equation solvers at stochastic time-points to guide the training towards learning a dynamical system that is easier to integrate. We \"close the black-box\" and allow the use of our method with any adjoint technique for gradient calculations of the differential equation solution. We perform experimental studies to compare our method to global regularization to show that we attain similar performance numbers without compromising on the flexibility of implementation on ordinary differential equations (ODEs) and stochastic differential equations (SDEs). We develop two sampling strategies to trade-off between performance and training time. Our method reduces the number of function evaluations to $0.556 \\times -0.733 \\times$ and accelerates predictions by $1.3 \\times -2 \\times$ .",
|
| 40 |
+
"bbox": [
|
| 41 |
+
117,
|
| 42 |
+
273,
|
| 43 |
+
444,
|
| 44 |
+
773
|
| 45 |
+
],
|
| 46 |
+
"page_idx": 0
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": "<sup>1</sup>CSAIL MIT <sup>2</sup>Department of Electrical Engineering and Computer Science MIT <sup>3</sup>Department of Mathematics MIT. Correspondence to: Avik Pal <sup>4</sup}@mit.edu>.",
|
| 51 |
+
"bbox": [
|
| 52 |
+
84,
|
| 53 |
+
815,
|
| 54 |
+
475,
|
| 55 |
+
856
|
| 56 |
+
],
|
| 57 |
+
"page_idx": 0
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"type": "text",
|
| 61 |
+
"text": "Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).",
|
| 62 |
+
"bbox": [
|
| 63 |
+
84,
|
| 64 |
+
864,
|
| 65 |
+
475,
|
| 66 |
+
905
|
| 67 |
+
],
|
| 68 |
+
"page_idx": 0
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"type": "text",
|
| 72 |
+
"text": "1. Introduction",
|
| 73 |
+
"text_level": 1,
|
| 74 |
+
"bbox": [
|
| 75 |
+
498,
|
| 76 |
+
239,
|
| 77 |
+
629,
|
| 78 |
+
255
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "Implicit Models, such as Neural Ordinary Differential Equations (Chen et al., 2018) and Deep Equilibrium Models (Bai et al., 2019; Pal et al., 2022), have emerged as a promising technique to determine the depth of neural networks automatically. To maximize performance on a dataset, explicit models are tuned to the \"hardest\" training sample, which hurts the inference timings for \"easier\" – more abundant – samples. Using adaptive differential equation solvers allow these implicit models to choose the number of steps they need effectively. This idea of representing neural networks as ODEs has since been generalized to Stochastic Differential Equations (Liu et al., 2019; Rackauckas et al., 2020) and other architectures to improve robustness.",
|
| 85 |
+
"bbox": [
|
| 86 |
+
496,
|
| 87 |
+
265,
|
| 88 |
+
888,
|
| 89 |
+
462
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "Despite the rapid progress in these methods, the core problem of the scalability of these models is still persistent. Several solutions to these have been proposed:",
|
| 96 |
+
"bbox": [
|
| 97 |
+
496,
|
| 98 |
+
469,
|
| 99 |
+
888,
|
| 100 |
+
515
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "list",
|
| 106 |
+
"sub_type": "text",
|
| 107 |
+
"list_items": [
|
| 108 |
+
"- Kelly et al. (2020); Finlay et al. (2020) use higher order derivatives for regularization.",
|
| 109 |
+
"- Poli et al. (2020) learn neural solvers to solve Neural ODEs faster.",
|
| 110 |
+
"- Pal et al. (2021) proposed a \"zero-cost\" global regularization scheme.",
|
| 111 |
+
"- Behl et al. (2020) randomize the integration stop time to \"smoothen\" the dynamics."
|
| 112 |
+
],
|
| 113 |
+
"bbox": [
|
| 114 |
+
516,
|
| 115 |
+
534,
|
| 116 |
+
887,
|
| 117 |
+
705
|
| 118 |
+
],
|
| 119 |
+
"page_idx": 0
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"type": "text",
|
| 123 |
+
"text": "All these methods have definite tradeoffs (See Section 5 for more details).",
|
| 124 |
+
"bbox": [
|
| 125 |
+
496,
|
| 126 |
+
724,
|
| 127 |
+
885,
|
| 128 |
+
755
|
| 129 |
+
],
|
| 130 |
+
"page_idx": 0
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"type": "text",
|
| 134 |
+
"text": "This paper presents a generally applicable method to force the neural differential equation training process to choose the least expensive option. We build upon the global regularization scheme proposed in Pal et al. (2021) and \"close\" the blackbox allowing our method to work across various sensitivity algorithms. Our main contributions include the following<sup>1</sup>:",
|
| 135 |
+
"bbox": [
|
| 136 |
+
496,
|
| 137 |
+
763,
|
| 138 |
+
885,
|
| 139 |
+
869
|
| 140 |
+
],
|
| 141 |
+
"page_idx": 0
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
"type": "page_footnote",
|
| 145 |
+
"text": "1Our code is publicly available at https://github.com/avik-pal/LocalRegNeuralDE.jl",
|
| 146 |
+
"bbox": [
|
| 147 |
+
496,
|
| 148 |
+
878,
|
| 149 |
+
885,
|
| 150 |
+
905
|
| 151 |
+
],
|
| 152 |
+
"page_idx": 0
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"type": "page_number",
|
| 156 |
+
"text": "1",
|
| 157 |
+
"bbox": [
|
| 158 |
+
480,
|
| 159 |
+
922,
|
| 160 |
+
491,
|
| 161 |
+
934
|
| 162 |
+
],
|
| 163 |
+
"page_idx": 0
|
| 164 |
+
},
|
| 165 |
+
{
|
| 166 |
+
"type": "table",
|
| 167 |
+
"img_path": "images/e6095d19dc6a608e4f57671a57c678df68c3f685692f95f5d0114a99d4e87f58.jpg",
|
| 168 |
+
"table_caption": [],
|
| 169 |
+
"table_footnote": [],
|
| 170 |
+
"table_body": "<table><tr><td>Sensitivity Algorithm</td><td>Memory Requirement</td><td>Memory Requirement with Local Regularization</td></tr><tr><td>Backsolve Adjoint (Chen et al., 2018)</td><td>O(s)</td><td>O(s × (1 + stages))</td></tr><tr><td>Backsolve Adjoint with Checkpointing (Chen et al., 2018)</td><td>O(s × c)</td><td>O(s × (c + stages))</td></tr><tr><td>Interpolating Adjoint (Hindmarsh et al., 2005)</td><td>O(s × t)</td><td>O(s × (t + stages))</td></tr><tr><td>Interpolating Adjoint with Checkpointing (Hindmarsh et al., 2005)</td><td>O(s × c)</td><td>O(s × (c + ×stages))</td></tr><tr><td>Quadrature Adjoint (Kim et al., 2021)</td><td>O((s + p) × t)</td><td>O((s + p) × t + s × stages)</td></tr><tr><td>Direct Reverse Mode Differentiation</td><td>O(s × t × stages)</td><td>O(s × (t + 1) × stages)</td></tr></table>",
|
| 171 |
+
"bbox": [
|
| 172 |
+
89,
|
| 173 |
+
71,
|
| 174 |
+
883,
|
| 175 |
+
194
|
| 176 |
+
],
|
| 177 |
+
"page_idx": 1
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"type": "text",
|
| 181 |
+
"text": "Table 1: Memory Requirements for various Sensitivity Algorithms for ODEs with Local Regularization: Local Regularization requires $\\mathcal{O}\\left(s\\times (c + \\text{stages})\\right)$ memory in the best case, while Global Regularization (Pal et al., 2021) always requires $\\mathcal{O}\\left(s\\times t\\times \\text{stages}\\right)$ memory.",
|
| 182 |
+
"bbox": [
|
| 183 |
+
83,
|
| 184 |
+
203,
|
| 185 |
+
883,
|
| 186 |
+
250
|
| 187 |
+
],
|
| 188 |
+
"page_idx": 1
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"type": "image",
|
| 192 |
+
"img_path": "images/0f8902d08e470c158e76f64428ecee65cec1bf8ae5070a14ff9e526ad36d9bae.jpg",
|
| 193 |
+
"image_caption": [
|
| 194 |
+
"Figure 1: Locally Regularized NDE leads to faster predictions and faster training compared to vanilla NDE."
|
| 195 |
+
],
|
| 196 |
+
"image_footnote": [],
|
| 197 |
+
"bbox": [
|
| 198 |
+
94,
|
| 199 |
+
268,
|
| 200 |
+
359,
|
| 201 |
+
428
|
| 202 |
+
],
|
| 203 |
+
"page_idx": 1
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"type": "image",
|
| 207 |
+
"img_path": "images/60d6475659727ea630e59aa6401b6edf63b6620d0603805fa4c6a0e1dc4c2543.jpg",
|
| 208 |
+
"image_caption": [],
|
| 209 |
+
"image_footnote": [],
|
| 210 |
+
"bbox": [
|
| 211 |
+
364,
|
| 212 |
+
268,
|
| 213 |
+
620,
|
| 214 |
+
426
|
| 215 |
+
],
|
| 216 |
+
"page_idx": 1
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"type": "image",
|
| 220 |
+
"img_path": "images/151a782d053085b122de92dd70000c78e646e184ab87db6e140d7df30653a564.jpg",
|
| 221 |
+
"image_caption": [],
|
| 222 |
+
"image_footnote": [],
|
| 223 |
+
"bbox": [
|
| 224 |
+
624,
|
| 225 |
+
268,
|
| 226 |
+
879,
|
| 227 |
+
428
|
| 228 |
+
],
|
| 229 |
+
"page_idx": 1
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"type": "list",
|
| 233 |
+
"sub_type": "text",
|
| 234 |
+
"list_items": [
|
| 235 |
+
"1. We show that our local regularization method – building upon the primitives proposed in Pal et al. (2021) – performs at par with global regularization (See Section 4).",
|
| 236 |
+
"2. We present two sampling methods that trade-off small computational costs for consistently better performance (See Section 3).",
|
| 237 |
+
"3. Using local regularization allows our models to leverage optimize-then-discretize in the backward pass (in addition to discretize-then-optimize methods). Our method works around the several engineering limitations of automatic differentiation (AD) systems (Rackauckas, 2022) that are needed to make global regularization work.",
|
| 238 |
+
"4. We empirically show that regularizing solver heuristics with biased sampling stabilizes the training of larger neural ODEs (See Section 4.3)."
|
| 239 |
+
],
|
| 240 |
+
"bbox": [
|
| 241 |
+
98,
|
| 242 |
+
484,
|
| 243 |
+
475,
|
| 244 |
+
806
|
| 245 |
+
],
|
| 246 |
+
"page_idx": 1
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"type": "text",
|
| 250 |
+
"text": "2. Background",
|
| 251 |
+
"text_level": 1,
|
| 252 |
+
"bbox": [
|
| 253 |
+
84,
|
| 254 |
+
825,
|
| 255 |
+
212,
|
| 256 |
+
842
|
| 257 |
+
],
|
| 258 |
+
"page_idx": 1
|
| 259 |
+
},
|
| 260 |
+
{
|
| 261 |
+
"type": "text",
|
| 262 |
+
"text": "2.1. Neural Ordinary Differential Equations",
|
| 263 |
+
"text_level": 1,
|
| 264 |
+
"bbox": [
|
| 265 |
+
84,
|
| 266 |
+
851,
|
| 267 |
+
397,
|
| 268 |
+
867
|
| 269 |
+
],
|
| 270 |
+
"page_idx": 1
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"type": "text",
|
| 274 |
+
"text": "Neural ODEs use an explicit neural network to parameterize the dynamical system. These involve finding the state at a",
|
| 275 |
+
"bbox": [
|
| 276 |
+
84,
|
| 277 |
+
875,
|
| 278 |
+
473,
|
| 279 |
+
905
|
| 280 |
+
],
|
| 281 |
+
"page_idx": 1
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"type": "text",
|
| 285 |
+
"text": "later time $t_1$ , given the value $z_0$ at time $t_0$ . The final state:",
|
| 286 |
+
"bbox": [
|
| 287 |
+
496,
|
| 288 |
+
484,
|
| 289 |
+
879,
|
| 290 |
+
501
|
| 291 |
+
],
|
| 292 |
+
"page_idx": 1
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"type": "equation",
|
| 296 |
+
"text": "\n$$\nz \\left(t _ {1}\\right) = z _ {0} + \\int_ {t _ {0}} ^ {t _ {1}} f _ {\\theta} (z (t), t) d t\n$$\n",
|
| 297 |
+
"text_format": "latex",
|
| 298 |
+
"bbox": [
|
| 299 |
+
583,
|
| 300 |
+
511,
|
| 301 |
+
800,
|
| 302 |
+
547
|
| 303 |
+
],
|
| 304 |
+
"page_idx": 1
|
| 305 |
+
},
|
| 306 |
+
{
|
| 307 |
+
"type": "text",
|
| 308 |
+
"text": "generally cannot be computed analytically and requires numerical solvers. Prior works had observed the similarity between fixed time-step discretization of ODEs and Residual Neural Networks Lu et al. (2018), which was later extended in the Neural ODE framework by Chen et al. (2018).",
|
| 309 |
+
"bbox": [
|
| 310 |
+
496,
|
| 311 |
+
556,
|
| 312 |
+
887,
|
| 313 |
+
633
|
| 314 |
+
],
|
| 315 |
+
"page_idx": 1
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
"type": "equation",
|
| 319 |
+
"text": "\n$$\n\\frac {d z (t)}{d t} = f _ {\\theta} (z (t), t)\n$$\n",
|
| 320 |
+
"text_format": "latex",
|
| 321 |
+
"bbox": [
|
| 322 |
+
622,
|
| 323 |
+
643,
|
| 324 |
+
759,
|
| 325 |
+
674
|
| 326 |
+
],
|
| 327 |
+
"page_idx": 1
|
| 328 |
+
},
|
| 329 |
+
{
|
| 330 |
+
"type": "text",
|
| 331 |
+
"text": "Using adaptive time stepping allows the model to operate at a variable continuous depth depending on the inputs. Removal of the fixed depth constraint of Residual Networks provides a more expressive framework and offers several advantages in problems like density estimation (Grathwohl et al., 2018), irregularly spaced time series problems (Rubanova et al., 2019), etc.",
|
| 332 |
+
"bbox": [
|
| 333 |
+
495,
|
| 334 |
+
684,
|
| 335 |
+
888,
|
| 336 |
+
790
|
| 337 |
+
],
|
| 338 |
+
"page_idx": 1
|
| 339 |
+
},
|
| 340 |
+
{
|
| 341 |
+
"type": "text",
|
| 342 |
+
"text": "2.2. Neural Stochastic Differential Equations",
|
| 343 |
+
"text_level": 1,
|
| 344 |
+
"bbox": [
|
| 345 |
+
496,
|
| 346 |
+
806,
|
| 347 |
+
813,
|
| 348 |
+
821
|
| 349 |
+
],
|
| 350 |
+
"page_idx": 1
|
| 351 |
+
},
|
| 352 |
+
{
|
| 353 |
+
"type": "text",
|
| 354 |
+
"text": "Stochastic Differential Equations (SDEs) couple the effect of noise to a deterministic system of equations. SDE noise can have different variations; however, we exclusively focus on diagonal multiplicative noise for this paper. Liu et al. (2019) modified Neural ODEs by stochastic noise injection",
|
| 355 |
+
"bbox": [
|
| 356 |
+
495,
|
| 357 |
+
829,
|
| 358 |
+
885,
|
| 359 |
+
905
|
| 360 |
+
],
|
| 361 |
+
"page_idx": 1
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"type": "header",
|
| 365 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 366 |
+
"bbox": [
|
| 367 |
+
325,
|
| 368 |
+
56,
|
| 369 |
+
643,
|
| 370 |
+
70
|
| 371 |
+
],
|
| 372 |
+
"page_idx": 1
|
| 373 |
+
},
|
| 374 |
+
{
|
| 375 |
+
"type": "page_number",
|
| 376 |
+
"text": "2",
|
| 377 |
+
"bbox": [
|
| 378 |
+
480,
|
| 379 |
+
922,
|
| 380 |
+
491,
|
| 381 |
+
934
|
| 382 |
+
],
|
| 383 |
+
"page_idx": 1
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"type": "text",
|
| 387 |
+
"text": "in the form of Neural SDEs. Liu et al. (2019) empirically showed that stochastic noise injection improves the robustness and generalization performance of neural ODEs. In Neural SDEs, we simultaneously train two explicit neural networks - drift $f_{\\theta}(z(t),t)$ and diffusion $g_{\\phi}(z(t),t)$ s.t.:",
|
| 388 |
+
"bbox": [
|
| 389 |
+
84,
|
| 390 |
+
84,
|
| 391 |
+
475,
|
| 392 |
+
161
|
| 393 |
+
],
|
| 394 |
+
"page_idx": 2
|
| 395 |
+
},
|
| 396 |
+
{
|
| 397 |
+
"type": "equation",
|
| 398 |
+
"text": "\n$$\nd z (t) = f _ {\\theta} (z (t), t) d t + g _ {\\phi} (z (t), t)) d W\n$$\n",
|
| 399 |
+
"text_format": "latex",
|
| 400 |
+
"bbox": [
|
| 401 |
+
145,
|
| 402 |
+
167,
|
| 403 |
+
413,
|
| 404 |
+
185
|
| 405 |
+
],
|
| 406 |
+
"page_idx": 2
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
"type": "text",
|
| 410 |
+
"text": "2.3. Adaptive Time Stepping for Differential Equations",
|
| 411 |
+
"text_level": 1,
|
| 412 |
+
"bbox": [
|
| 413 |
+
84,
|
| 414 |
+
200,
|
| 415 |
+
472,
|
| 416 |
+
217
|
| 417 |
+
],
|
| 418 |
+
"page_idx": 2
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
"type": "text",
|
| 422 |
+
"text": "Runge-Kutta (RK) Methods (Runge, 1895; Kutta, 1901) are widely used to approximate the solutions of ordinary differential equations numerically. Given a tableau of coefficients $\\{A, c, b\\}$ , these methods combine $s$ stages to obtain the estimate at $t + dt$ .",
|
| 423 |
+
"bbox": [
|
| 424 |
+
84,
|
| 425 |
+
223,
|
| 426 |
+
475,
|
| 427 |
+
297
|
| 428 |
+
],
|
| 429 |
+
"page_idx": 2
|
| 430 |
+
},
|
| 431 |
+
{
|
| 432 |
+
"type": "equation",
|
| 433 |
+
"text": "\n$$\nk _ {s} = f \\left(t + c _ {s} \\cdot d t, z (t) + \\sum_ {i = 1} ^ {s - 1} a _ {s i} \\cdot k _ {i}\\right)\n$$\n",
|
| 434 |
+
"text_format": "latex",
|
| 435 |
+
"bbox": [
|
| 436 |
+
140,
|
| 437 |
+
304,
|
| 438 |
+
413,
|
| 439 |
+
345
|
| 440 |
+
],
|
| 441 |
+
"page_idx": 2
|
| 442 |
+
},
|
| 443 |
+
{
|
| 444 |
+
"type": "equation",
|
| 445 |
+
"text": "\n$$\nz (t + d t) = z (t) + d t \\cdot \\left(\\sum_ {i = 1} ^ {s} b _ {i} \\cdot k _ {i}\\right)\n$$\n",
|
| 446 |
+
"text_format": "latex",
|
| 447 |
+
"bbox": [
|
| 448 |
+
142,
|
| 449 |
+
348,
|
| 450 |
+
392,
|
| 451 |
+
390
|
| 452 |
+
],
|
| 453 |
+
"page_idx": 2
|
| 454 |
+
},
|
| 455 |
+
{
|
| 456 |
+
"type": "text",
|
| 457 |
+
"text": "Adaptive solvers need to maximize the step size $(dt)$ while keeping the error estimate below the user-specified tolerances, i.e., they need to satisfy:",
|
| 458 |
+
"bbox": [
|
| 459 |
+
84,
|
| 460 |
+
395,
|
| 461 |
+
475,
|
| 462 |
+
441
|
| 463 |
+
],
|
| 464 |
+
"page_idx": 2
|
| 465 |
+
},
|
| 466 |
+
{
|
| 467 |
+
"type": "equation",
|
| 468 |
+
"text": "\n$$\n\\mathrm {E} _ {\\text {E s t}} \\leq \\operatorname {a t o l} + \\max (| z (t) |, | z (t + d t) |) \\cdot \\operatorname {r t o l}\n$$\n",
|
| 469 |
+
"text_format": "latex",
|
| 470 |
+
"bbox": [
|
| 471 |
+
116,
|
| 472 |
+
449,
|
| 473 |
+
442,
|
| 474 |
+
465
|
| 475 |
+
],
|
| 476 |
+
"page_idx": 2
|
| 477 |
+
},
|
| 478 |
+
{
|
| 479 |
+
"type": "text",
|
| 480 |
+
"text": "where $\\mathsf{E}_{\\mathrm{Est}}$ is the local error estimate. Adaptive solvers utilize an additional linear combiner $\\tilde{b}_i$ to get an alternate solution, typically with one order less convergence (Wanner & Hairer, 1996; Fehlberg, 1968; Dormand & Prince, 1980; Tsitouras, 2011).",
|
| 481 |
+
"bbox": [
|
| 482 |
+
84,
|
| 483 |
+
473,
|
| 484 |
+
475,
|
| 485 |
+
547
|
| 486 |
+
],
|
| 487 |
+
"page_idx": 2
|
| 488 |
+
},
|
| 489 |
+
{
|
| 490 |
+
"type": "equation",
|
| 491 |
+
"text": "\n$$\n\\tilde {z} (t + d t) = z (t) + d t \\cdot \\left(\\sum_ {i = 1} ^ {s} \\tilde {b} _ {i} \\cdot k _ {i}\\right)\n$$\n",
|
| 492 |
+
"text_format": "latex",
|
| 493 |
+
"bbox": [
|
| 494 |
+
153,
|
| 495 |
+
555,
|
| 496 |
+
403,
|
| 497 |
+
595
|
| 498 |
+
],
|
| 499 |
+
"page_idx": 2
|
| 500 |
+
},
|
| 501 |
+
{
|
| 502 |
+
"type": "text",
|
| 503 |
+
"text": "A classic result from Richardson extrapolation shows that $\\mathbb{E}_{\\mathrm{Est}} = \\| \\tilde{z}(t + dt) - z(t + dt)\\|$ is an estimate of the local truncation error (Hairer et al., 1993; Ascher & Petzold, 1998). The new step size is determined using the following:",
|
| 504 |
+
"bbox": [
|
| 505 |
+
84,
|
| 506 |
+
602,
|
| 507 |
+
475,
|
| 508 |
+
662
|
| 509 |
+
],
|
| 510 |
+
"page_idx": 2
|
| 511 |
+
},
|
| 512 |
+
{
|
| 513 |
+
"type": "equation",
|
| 514 |
+
"text": "\n$$\nq = \\left\\| \\frac {\\mathsf {E} _ {\\mathrm {E s t}}}{\\mathrm {a t o l} + \\operatorname * {m a x} \\left(| z (t) | , | z (t + d t) |\\right) \\cdot \\mathrm {r t o l}} \\right\\|\n$$\n",
|
| 515 |
+
"text_format": "latex",
|
| 516 |
+
"bbox": [
|
| 517 |
+
116,
|
| 518 |
+
667,
|
| 519 |
+
442,
|
| 520 |
+
704
|
| 521 |
+
],
|
| 522 |
+
"page_idx": 2
|
| 523 |
+
},
|
| 524 |
+
{
|
| 525 |
+
"type": "list",
|
| 526 |
+
"sub_type": "text",
|
| 527 |
+
"list_items": [
|
| 528 |
+
"- If $q < 1$ , $dt$ is accepted.",
|
| 529 |
+
"- Otherwise, it is rejected and reduced. A standard PI controller proposes the new step size to be:"
|
| 530 |
+
],
|
| 531 |
+
"bbox": [
|
| 532 |
+
104,
|
| 533 |
+
714,
|
| 534 |
+
472,
|
| 535 |
+
767
|
| 536 |
+
],
|
| 537 |
+
"page_idx": 2
|
| 538 |
+
},
|
| 539 |
+
{
|
| 540 |
+
"type": "equation",
|
| 541 |
+
"text": "\n$$\nd t _ {n e w} = \\eta \\cdot q _ {n - 1} ^ {\\alpha} \\cdot q _ {n} ^ {\\beta} \\cdot d t\n$$\n",
|
| 542 |
+
"text_format": "latex",
|
| 543 |
+
"bbox": [
|
| 544 |
+
207,
|
| 545 |
+
775,
|
| 546 |
+
383,
|
| 547 |
+
792
|
| 548 |
+
],
|
| 549 |
+
"page_idx": 2
|
| 550 |
+
},
|
| 551 |
+
{
|
| 552 |
+
"type": "text",
|
| 553 |
+
"text": "where $\\eta$ is the safety factor, $q_{n - 1}$ is the error proportion of the previous step, and $(\\alpha ,\\beta)$ are tunable PI-gain hyperparameters (Wanner & Hairer, 1996).",
|
| 554 |
+
"bbox": [
|
| 555 |
+
116,
|
| 556 |
+
801,
|
| 557 |
+
473,
|
| 558 |
+
845
|
| 559 |
+
],
|
| 560 |
+
"page_idx": 2
|
| 561 |
+
},
|
| 562 |
+
{
|
| 563 |
+
"type": "text",
|
| 564 |
+
"text": "We defer the discussion of error estimation schemes for stochastic RK integrators to Rackauckas & Nie (2017; 2020).",
|
| 565 |
+
"bbox": [
|
| 566 |
+
84,
|
| 567 |
+
859,
|
| 568 |
+
475,
|
| 569 |
+
905
|
| 570 |
+
],
|
| 571 |
+
"page_idx": 2
|
| 572 |
+
},
|
| 573 |
+
{
|
| 574 |
+
"type": "text",
|
| 575 |
+
"text": "2.4. Global Regularization using Local Error Estimates",
|
| 576 |
+
"text_level": 1,
|
| 577 |
+
"bbox": [
|
| 578 |
+
496,
|
| 579 |
+
84,
|
| 580 |
+
885,
|
| 581 |
+
99
|
| 582 |
+
],
|
| 583 |
+
"page_idx": 2
|
| 584 |
+
},
|
| 585 |
+
{
|
| 586 |
+
"type": "text",
|
| 587 |
+
"text": "In Section 2.3, we observe how larger local error estimates $\\mathsf{E}_{\\mathrm{Est}}$ contribute to reduced step sizes and, in turn, higher training and prediction times for Neural Differential Equations. Pal et al. (2021) proposed a regularization scheme to minimize the \"total local error in order to learn Neural ODEs with as large step sizes as possible.\" They compute the regularization term $(\\mathcal{R}_E)_g$ as:",
|
| 588 |
+
"bbox": [
|
| 589 |
+
496,
|
| 590 |
+
108,
|
| 591 |
+
885,
|
| 592 |
+
215
|
| 593 |
+
],
|
| 594 |
+
"page_idx": 2
|
| 595 |
+
},
|
| 596 |
+
{
|
| 597 |
+
"type": "equation",
|
| 598 |
+
"text": "\n$$\n\\left(\\mathcal {R} _ {E}\\right) _ {g} = \\sum_ {j} \\left(\\mathrm {E} _ {\\mathrm {E s t}}\\right) _ {j} \\cdot | d t _ {j} |\n$$\n",
|
| 599 |
+
"text_format": "latex",
|
| 600 |
+
"bbox": [
|
| 601 |
+
596,
|
| 602 |
+
223,
|
| 603 |
+
785,
|
| 604 |
+
256
|
| 605 |
+
],
|
| 606 |
+
"page_idx": 2
|
| 607 |
+
},
|
| 608 |
+
{
|
| 609 |
+
"type": "text",
|
| 610 |
+
"text": "where the summation is over the $j$ time steps of the solution. All the local error estimates $\\mathbb{E}_{\\mathrm{Est}}$ are precomputed by adaptive differential equation solvers, which makes the forward pass effectively have zero additional overhead.",
|
| 611 |
+
"bbox": [
|
| 612 |
+
496,
|
| 613 |
+
262,
|
| 614 |
+
887,
|
| 615 |
+
321
|
| 616 |
+
],
|
| 617 |
+
"page_idx": 2
|
| 618 |
+
},
|
| 619 |
+
{
|
| 620 |
+
"type": "text",
|
| 621 |
+
"text": "Continuous adjoint methods (Chen et al., 2018) define the derivatives in terms of the ODE quantities. The terms $(\\mathbb{E}_{\\mathrm{Est}})_j = \\sum_{i=1}^s (b_i - \\tilde{b}_i) \\cdot k_i$ cannot be constructed directly from the trajectory of the ODE solution, since $k_i$ terms are defined by the solver method (and not by the continuous ODE solution). As a result Pal et al. (2021) performs discrete sensitivity analysis to compute the derivatives w.r.t. the regularization terms.",
|
| 622 |
+
"bbox": [
|
| 623 |
+
496,
|
| 624 |
+
329,
|
| 625 |
+
887,
|
| 626 |
+
450
|
| 627 |
+
],
|
| 628 |
+
"page_idx": 2
|
| 629 |
+
},
|
| 630 |
+
{
|
| 631 |
+
"type": "text",
|
| 632 |
+
"text": "Discrete Sensitivity analysis is more stable than continuous adjoints (Zhang & Sandu, 2014) and stabilizes the training process of Neural ODEs (Onken & Ruthotto, 2020). However, these methods are more memory intensive than continuous adjoints. Another shortcoming is the advanced tooling mechanism needed to differentiate through differential equation solvers (Rackauckas, 2022), making this method hard to adopt. Since adaptive ODE solvers change the number of steps based on the values in the differential equation, discrete sensitivity analysis requires dynamic AD tooling which is generally less optimized than those built for static graph cases. We note that there are checkpointing methods to reduce the memory overhead (Dauvergne & Hascoet, 2006), though these generally have focused on static graph AD systems.",
|
| 633 |
+
"bbox": [
|
| 634 |
+
496,
|
| 635 |
+
457,
|
| 636 |
+
888,
|
| 637 |
+
684
|
| 638 |
+
],
|
| 639 |
+
"page_idx": 2
|
| 640 |
+
},
|
| 641 |
+
{
|
| 642 |
+
"type": "text",
|
| 643 |
+
"text": "2.5. Multiscale Neural ODE with Input Injection",
|
| 644 |
+
"text_level": 1,
|
| 645 |
+
"bbox": [
|
| 646 |
+
496,
|
| 647 |
+
700,
|
| 648 |
+
839,
|
| 649 |
+
715
|
| 650 |
+
],
|
| 651 |
+
"page_idx": 2
|
| 652 |
+
},
|
| 653 |
+
{
|
| 654 |
+
"type": "text",
|
| 655 |
+
"text": "Multiscale modeling (Burt & Adelson, 1987) has been the central theme for several deep computer vision applications (Farabet et al., 2012; Yu & Koltun, 2015; Chen et al., 2016; 2017). Standard Neural ODEs set the initial condition as input $x$ from the previous layer. Multiscale Neural ODE with Input Injection is based on the Multiscale Deep Equilibrium Models (DEQs) (Bai et al., 2019; 2020; Pal et al., 2022). If our model operates at $n$ scales, the initial condition $\\{(z_0)_i\\}_{i \\in [n-1]}$ is defined as $(z_0)_0 = x$ and $(z_0)_{i \\in \\{1, \\dots, n-1\\}} = 0$ . Every feature set is upsampled or downsampled and fed into the other scales using a neural network. In line with Multiscale DEQs, we also repeatedly",
|
| 656 |
+
"bbox": [
|
| 657 |
+
495,
|
| 658 |
+
724,
|
| 659 |
+
887,
|
| 660 |
+
905
|
| 661 |
+
],
|
| 662 |
+
"page_idx": 2
|
| 663 |
+
},
|
| 664 |
+
{
|
| 665 |
+
"type": "header",
|
| 666 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 667 |
+
"bbox": [
|
| 668 |
+
325,
|
| 669 |
+
56,
|
| 670 |
+
647,
|
| 671 |
+
71
|
| 672 |
+
],
|
| 673 |
+
"page_idx": 2
|
| 674 |
+
},
|
| 675 |
+
{
|
| 676 |
+
"type": "page_number",
|
| 677 |
+
"text": "3",
|
| 678 |
+
"bbox": [
|
| 679 |
+
480,
|
| 680 |
+
922,
|
| 681 |
+
491,
|
| 682 |
+
934
|
| 683 |
+
],
|
| 684 |
+
"page_idx": 2
|
| 685 |
+
},
|
| 686 |
+
{
|
| 687 |
+
"type": "code",
|
| 688 |
+
"sub_type": "algorithm",
|
| 689 |
+
"code_caption": [
|
| 690 |
+
"Algorithm 1 Unbiased Sampling: Training Phase"
|
| 691 |
+
],
|
| 692 |
+
"code_body": "Data: x, $f_{\\theta},t_{span}$ \nResult: sol, r \nDefine $\\frac{du}{dt} = f_{\\theta}(u,t)$ $t_0,t_1\\gets t_{span}$ $\\mathsf{t}_{\\mathrm{reg}}\\sim \\mathbb{U}[t_0,t_1]$ \nsol $\\leftarrow$ solve(du/dt, DE Solver, $t_{span}$ ) \n $u_{\\mathrm{t_{reg}}}\\gets \\mathrm{sol}(t_{\\mathrm{reg}})$ \nRun single step for the solver with time-span $(t_{reg},t_1)$ \nr $\\leftarrow$ Local Error Estimate $@t = t_{reg}$",
|
| 693 |
+
"bbox": [
|
| 694 |
+
86,
|
| 695 |
+
116,
|
| 696 |
+
450,
|
| 697 |
+
253
|
| 698 |
+
],
|
| 699 |
+
"page_idx": 3
|
| 700 |
+
},
|
| 701 |
+
{
|
| 702 |
+
"type": "text",
|
| 703 |
+
"text": "inject the original input $x$ at every step of the dynamical system.",
|
| 704 |
+
"bbox": [
|
| 705 |
+
84,
|
| 706 |
+
281,
|
| 707 |
+
473,
|
| 708 |
+
311
|
| 709 |
+
],
|
| 710 |
+
"page_idx": 3
|
| 711 |
+
},
|
| 712 |
+
{
|
| 713 |
+
"type": "text",
|
| 714 |
+
"text": "3. Methods",
|
| 715 |
+
"text_level": 1,
|
| 716 |
+
"bbox": [
|
| 717 |
+
86,
|
| 718 |
+
330,
|
| 719 |
+
184,
|
| 720 |
+
345
|
| 721 |
+
],
|
| 722 |
+
"page_idx": 3
|
| 723 |
+
},
|
| 724 |
+
{
|
| 725 |
+
"type": "text",
|
| 726 |
+
"text": "In Section 2.4, we discussed the downsides of using global regularization with local error estimates. To summarize:",
|
| 727 |
+
"bbox": [
|
| 728 |
+
84,
|
| 729 |
+
357,
|
| 730 |
+
473,
|
| 731 |
+
387
|
| 732 |
+
],
|
| 733 |
+
"page_idx": 3
|
| 734 |
+
},
|
| 735 |
+
{
|
| 736 |
+
"type": "list",
|
| 737 |
+
"sub_type": "text",
|
| 738 |
+
"list_items": [
|
| 739 |
+
"1. Global Regularization relies on discrete sensitivity analysis, which is more memory intensive.",
|
| 740 |
+
"2. Global Regularization depends on AD tooling to support dynamic compute graphs in an efficient way, making it hard to incorporate into existing codebases."
|
| 741 |
+
],
|
| 742 |
+
"bbox": [
|
| 743 |
+
96,
|
| 744 |
+
402,
|
| 745 |
+
475,
|
| 746 |
+
489
|
| 747 |
+
],
|
| 748 |
+
"page_idx": 3
|
| 749 |
+
},
|
| 750 |
+
{
|
| 751 |
+
"type": "text",
|
| 752 |
+
"text": "To get around these limitations, we developed a new technique using local sampling of error estimates at specific time points, rather than globally over the full interval. We deal with sampling the \"appropriate\" time point for regularization by two strategies:",
|
| 753 |
+
"bbox": [
|
| 754 |
+
84,
|
| 755 |
+
506,
|
| 756 |
+
475,
|
| 757 |
+
580
|
| 758 |
+
],
|
| 759 |
+
"page_idx": 3
|
| 760 |
+
},
|
| 761 |
+
{
|
| 762 |
+
"type": "list",
|
| 763 |
+
"sub_type": "text",
|
| 764 |
+
"list_items": [
|
| 765 |
+
"- Algorithm 1 Unbiased Sampling: We random uniformly sample the time-point in the integration time span. Intuitively, since we will perform the training for \"a large number of steps,\" the learned dynamical system would end up being faster to solve \"everywhere\" over the time span.",
|
| 766 |
+
"- Algorithm 2 Biased Sampling: Adaptive Time-Stepping Differential Equation Solvers naturally take more steps around the area, which is harder to integrate. We can bias the regularization to operate around parts of the dynamical system which are \"harder\" by sampling a time-point from the solution time points."
|
| 767 |
+
],
|
| 768 |
+
"bbox": [
|
| 769 |
+
104,
|
| 770 |
+
598,
|
| 771 |
+
475,
|
| 772 |
+
789
|
| 773 |
+
],
|
| 774 |
+
"page_idx": 3
|
| 775 |
+
},
|
| 776 |
+
{
|
| 777 |
+
"type": "text",
|
| 778 |
+
"text": "3.1. Unbiased Sampling",
|
| 779 |
+
"text_level": 1,
|
| 780 |
+
"bbox": [
|
| 781 |
+
84,
|
| 782 |
+
806,
|
| 783 |
+
256,
|
| 784 |
+
821
|
| 785 |
+
],
|
| 786 |
+
"page_idx": 3
|
| 787 |
+
},
|
| 788 |
+
{
|
| 789 |
+
"type": "text",
|
| 790 |
+
"text": "When training a Neural ODE, the integration timespan is fixed. Training any deep learning model involves several thousand steps. We compute the total local error estimate over the entire timespan when performing global regularization. For unbiased sampling, we hypothesize that if we regu",
|
| 791 |
+
"bbox": [
|
| 792 |
+
84,
|
| 793 |
+
829,
|
| 794 |
+
475,
|
| 795 |
+
906
|
| 796 |
+
],
|
| 797 |
+
"page_idx": 3
|
| 798 |
+
},
|
| 799 |
+
{
|
| 800 |
+
"type": "code",
|
| 801 |
+
"sub_type": "algorithm",
|
| 802 |
+
"code_caption": [
|
| 803 |
+
"Algorithm 2 Biased Sampling: Training Phase"
|
| 804 |
+
],
|
| 805 |
+
"code_body": "Data: x, $f_{\\theta},t_{span}$ \nResult: sol, r \nDefine $\\frac{du}{dt} = f_{\\theta}(u,t)$ $t_0,t_1\\gets t_{span}$ \nsol $\\leftarrow$ solve $(\\frac{du}{dt}$ DE Solver, $t_{span}$ $\\mathsf{t}_{\\mathrm{reg}}\\sim \\mathbb{U}(\\mathsf{sol}.t)$ $u_{\\mathrm{treg}}\\gets \\mathrm{sol}(\\mathrm{t}_{\\mathrm{reg}})$ \nRun single step for the solver with time-span $(t_{reg},t_1)$ \nr $\\leftarrow$ Local Error Estimate $@t = t_{reg}$",
|
| 806 |
+
"bbox": [
|
| 807 |
+
500,
|
| 808 |
+
116,
|
| 809 |
+
862,
|
| 810 |
+
253
|
| 811 |
+
],
|
| 812 |
+
"page_idx": 3
|
| 813 |
+
},
|
| 814 |
+
{
|
| 815 |
+
"type": "image",
|
| 816 |
+
"img_path": "images/871c685f2c891e495671157d223647d8ec4b3eecc9cd5d2db97e06fe7f37c258.jpg",
|
| 817 |
+
"image_caption": [
|
| 818 |
+
"Figure 2: Robertson Stiff ODE System: Solving stiff systems like Robertson (Robertson, 1966) (using Rodas5 (Piche, 1995)) involves spending around $75\\%$ of the time in $t < 5000$ (i.e. $5\\%$ of the timespan). The vertical lines denote the timepoints at which the ODE System was solved."
|
| 819 |
+
],
|
| 820 |
+
"image_footnote": [],
|
| 821 |
+
"bbox": [
|
| 822 |
+
522,
|
| 823 |
+
281,
|
| 824 |
+
859,
|
| 825 |
+
460
|
| 826 |
+
],
|
| 827 |
+
"page_idx": 3
|
| 828 |
+
},
|
| 829 |
+
{
|
| 830 |
+
"type": "text",
|
| 831 |
+
"text": "larize at random uniformly sampled time points in the timespan, the learned dynamical system will demonstrate similar properties in terms of NFE compared to global regularization. Our new regularization term becomes $(\\mathcal{R}_E)_{\\mathrm{unbiased}}$ as:",
|
| 832 |
+
"bbox": [
|
| 833 |
+
496,
|
| 834 |
+
569,
|
| 835 |
+
887,
|
| 836 |
+
643
|
| 837 |
+
],
|
| 838 |
+
"page_idx": 3
|
| 839 |
+
},
|
| 840 |
+
{
|
| 841 |
+
"type": "equation",
|
| 842 |
+
"text": "\n$$\n\\left(\\mathcal {R} _ {E}\\right) _ {\\mathrm {u n b i a s e d}} = \\left(\\mathrm {E} _ {\\mathrm {E s t}}\\right) _ {\\mathrm {t} _ {\\mathrm {r e g}}} \\cdot \\left| d t _ {\\mathrm {t} _ {\\mathrm {r e g}}} \\right| \\quad \\mathrm {t} _ {\\mathrm {r e g}} \\sim \\mathbb {U} [ \\mathrm {t} \\mathrm {s p a n} ]\n$$\n",
|
| 843 |
+
"text_format": "latex",
|
| 844 |
+
"bbox": [
|
| 845 |
+
500,
|
| 846 |
+
652,
|
| 847 |
+
883,
|
| 848 |
+
672
|
| 849 |
+
],
|
| 850 |
+
"page_idx": 3
|
| 851 |
+
},
|
| 852 |
+
{
|
| 853 |
+
"type": "text",
|
| 854 |
+
"text": "3.2. Biased Sampling",
|
| 855 |
+
"text_level": 1,
|
| 856 |
+
"bbox": [
|
| 857 |
+
496,
|
| 858 |
+
700,
|
| 859 |
+
648,
|
| 860 |
+
715
|
| 861 |
+
],
|
| 862 |
+
"page_idx": 3
|
| 863 |
+
},
|
| 864 |
+
{
|
| 865 |
+
"type": "text",
|
| 866 |
+
"text": "Consider a simple scenario where the learned dynamics of the DE is harder to solve in $[0.25, 0.35]$ , and we are solving the DE from $t_0 = 0$ to $t_1 = 1$ . Our primary aim is to modify the learned system s.t. it becomes simpler to solve in $[0.25, 0.35]$ . If we use unbiased sampling, the probability that we regularize at $\\mathsf{t}_{\\mathrm{reg}} \\in [0.25, 0.35]$ is 0.1 (which is low). The problem gets even more severe if the range is lowered. An extreme version of this problem is observed for stiff systems like Robertson's Equations (See Figure 2) where $75\\%$ of the time is spent in solving $5\\%$ of the problem. We note that these extreme scenarios rarely occur for traditional deep learning tasks since Pal et al. (2021) observed",
|
| 867 |
+
"bbox": [
|
| 868 |
+
495,
|
| 869 |
+
724,
|
| 870 |
+
887,
|
| 871 |
+
905
|
| 872 |
+
],
|
| 873 |
+
"page_idx": 3
|
| 874 |
+
},
|
| 875 |
+
{
|
| 876 |
+
"type": "header",
|
| 877 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 878 |
+
"bbox": [
|
| 879 |
+
325,
|
| 880 |
+
56,
|
| 881 |
+
647,
|
| 882 |
+
71
|
| 883 |
+
],
|
| 884 |
+
"page_idx": 3
|
| 885 |
+
},
|
| 886 |
+
{
|
| 887 |
+
"type": "page_number",
|
| 888 |
+
"text": "4",
|
| 889 |
+
"bbox": [
|
| 890 |
+
480,
|
| 891 |
+
922,
|
| 892 |
+
491,
|
| 893 |
+
934
|
| 894 |
+
],
|
| 895 |
+
"page_idx": 3
|
| 896 |
+
},
|
| 897 |
+
{
|
| 898 |
+
"type": "text",
|
| 899 |
+
"text": "minor speedups using stiffness regularization. However, the problem that some parts of the dynamical system are harder to integrate persists, and designing a regularization scheme targeting those parts is highly desirable.",
|
| 900 |
+
"bbox": [
|
| 901 |
+
84,
|
| 902 |
+
85,
|
| 903 |
+
473,
|
| 904 |
+
147
|
| 905 |
+
],
|
| 906 |
+
"page_idx": 4
|
| 907 |
+
},
|
| 908 |
+
{
|
| 909 |
+
"type": "text",
|
| 910 |
+
"text": "We considered a simple scenario where the learned dynamical system was fixed. However, while training NDEs, this system evolves with training, and apriori predicting the more difficult portions to integrate is not feasible. Adaptive solvers take more frequent steps in the parts of the DE where it is harder to integrate. Anantharaman et al. (2020) leveraged this property of adaptive solvers to learn surrogates for stiff systems. Since these solvers adapt to concentrate around the most numerically difficult time points, we automatically obtain the time points where we want to regularize the model. Hence, for our biased sampling regularize, we uniformly sample the regularization timepoint $t_{\\text{reg}}$ from the time points at which the solver solved the differential equation.",
|
| 911 |
+
"bbox": [
|
| 912 |
+
84,
|
| 913 |
+
152,
|
| 914 |
+
475,
|
| 915 |
+
364
|
| 916 |
+
],
|
| 917 |
+
"page_idx": 4
|
| 918 |
+
},
|
| 919 |
+
{
|
| 920 |
+
"type": "text",
|
| 921 |
+
"text": "4. Experiments",
|
| 922 |
+
"text_level": 1,
|
| 923 |
+
"bbox": [
|
| 924 |
+
84,
|
| 925 |
+
383,
|
| 926 |
+
217,
|
| 927 |
+
400
|
| 928 |
+
],
|
| 929 |
+
"page_idx": 4
|
| 930 |
+
},
|
| 931 |
+
{
|
| 932 |
+
"type": "text",
|
| 933 |
+
"text": "In this section, we compare the effectiveness of unbiased and biased local regularization's effectiveness on the training and prediction timings of NDEs. We choose image classification and time series prediction problems in line with prior works on accelerating NDEs. We consider the following baselines:",
|
| 934 |
+
"bbox": [
|
| 935 |
+
84,
|
| 936 |
+
409,
|
| 937 |
+
475,
|
| 938 |
+
500
|
| 939 |
+
],
|
| 940 |
+
"page_idx": 4
|
| 941 |
+
},
|
| 942 |
+
{
|
| 943 |
+
"type": "list",
|
| 944 |
+
"sub_type": "text",
|
| 945 |
+
"list_items": [
|
| 946 |
+
"1. Vanilla Neural ODE with Continuous Interpolating Adjoint.",
|
| 947 |
+
"2. Vanilla Neural SDE with discrete sensitivities.",
|
| 948 |
+
"3. Global Regularization of Neural Differential Equations using discrete sensitivity analysis (Pal et al., 2021).",
|
| 949 |
+
"4. TayNODE (Kelly et al., 2020) and STEER (Behl et al., 2020) for models reported in Pal et al. (2021)."
|
| 950 |
+
],
|
| 951 |
+
"bbox": [
|
| 952 |
+
98,
|
| 953 |
+
513,
|
| 954 |
+
473,
|
| 955 |
+
646
|
| 956 |
+
],
|
| 957 |
+
"page_idx": 4
|
| 958 |
+
},
|
| 959 |
+
{
|
| 960 |
+
"type": "text",
|
| 961 |
+
"text": "We use the DifferentialEquations.jl (Rackauckas et al., 2019) and Lux.jl (Pal, 2022) software stack written in the Julia Programming Language (Bezanson et al., 2017) for all our experiments.",
|
| 962 |
+
"bbox": [
|
| 963 |
+
84,
|
| 964 |
+
660,
|
| 965 |
+
475,
|
| 966 |
+
720
|
| 967 |
+
],
|
| 968 |
+
"page_idx": 4
|
| 969 |
+
},
|
| 970 |
+
{
|
| 971 |
+
"type": "text",
|
| 972 |
+
"text": "Some details about the data presented in the tables:",
|
| 973 |
+
"bbox": [
|
| 974 |
+
84,
|
| 975 |
+
728,
|
| 976 |
+
423,
|
| 977 |
+
744
|
| 978 |
+
],
|
| 979 |
+
"page_idx": 4
|
| 980 |
+
},
|
| 981 |
+
{
|
| 982 |
+
"type": "list",
|
| 983 |
+
"sub_type": "text",
|
| 984 |
+
"list_items": [
|
| 985 |
+
"- All experimental results in the tables marked with $\\mathbb{F}$ were taken directly from Pal et al. (2021).",
|
| 986 |
+
"- We have tried to match the hardware details presented in the paper and the corresponding GitHub repository for Pal et al. (2021), but we note that differences in wall clock timings can be partially attributed to hardware.",
|
| 987 |
+
"- TayNODE (Kelly et al., 2020) uses a different ODE integrator. Hence the NFEs are not directly comparable."
|
| 988 |
+
],
|
| 989 |
+
"bbox": [
|
| 990 |
+
104,
|
| 991 |
+
758,
|
| 992 |
+
475,
|
| 993 |
+
896
|
| 994 |
+
],
|
| 995 |
+
"page_idx": 4
|
| 996 |
+
},
|
| 997 |
+
{
|
| 998 |
+
"type": "image",
|
| 999 |
+
"img_path": "images/9f0d7c61d7e32820b8f1508c43a58d4b3c55e884d8b02ab34d1fff059f012bea.jpg",
|
| 1000 |
+
"image_caption": [],
|
| 1001 |
+
"image_footnote": [],
|
| 1002 |
+
"bbox": [
|
| 1003 |
+
544,
|
| 1004 |
+
85,
|
| 1005 |
+
841,
|
| 1006 |
+
237
|
| 1007 |
+
],
|
| 1008 |
+
"page_idx": 4
|
| 1009 |
+
},
|
| 1010 |
+
{
|
| 1011 |
+
"type": "image",
|
| 1012 |
+
"img_path": "images/da4d88298ba2908011a33e03c3ce12c226689f083d5ee058bda25c101bd3bfb4.jpg",
|
| 1013 |
+
"image_caption": [
|
| 1014 |
+
"Figure 3: MNIST Classification using Neural ODE"
|
| 1015 |
+
],
|
| 1016 |
+
"image_footnote": [],
|
| 1017 |
+
"bbox": [
|
| 1018 |
+
540,
|
| 1019 |
+
241,
|
| 1020 |
+
841,
|
| 1021 |
+
401
|
| 1022 |
+
],
|
| 1023 |
+
"page_idx": 4
|
| 1024 |
+
},
|
| 1025 |
+
{
|
| 1026 |
+
"type": "text",
|
| 1027 |
+
"text": "4.1. MNIST Image Classification",
|
| 1028 |
+
"text_level": 1,
|
| 1029 |
+
"bbox": [
|
| 1030 |
+
496,
|
| 1031 |
+
476,
|
| 1032 |
+
730,
|
| 1033 |
+
491
|
| 1034 |
+
],
|
| 1035 |
+
"page_idx": 4
|
| 1036 |
+
},
|
| 1037 |
+
{
|
| 1038 |
+
"type": "text",
|
| 1039 |
+
"text": "We train a neural differential equation classifier to map flattened MNIST (LeCun et al., 1998) images to their corresponding labels.",
|
| 1040 |
+
"bbox": [
|
| 1041 |
+
496,
|
| 1042 |
+
500,
|
| 1043 |
+
887,
|
| 1044 |
+
546
|
| 1045 |
+
],
|
| 1046 |
+
"page_idx": 4
|
| 1047 |
+
},
|
| 1048 |
+
{
|
| 1049 |
+
"type": "text",
|
| 1050 |
+
"text": "4.1.1. NEURAL ORDINARY DIFFERENTIAL EQUATION",
|
| 1051 |
+
"text_level": 1,
|
| 1052 |
+
"bbox": [
|
| 1053 |
+
496,
|
| 1054 |
+
560,
|
| 1055 |
+
872,
|
| 1056 |
+
574
|
| 1057 |
+
],
|
| 1058 |
+
"page_idx": 4
|
| 1059 |
+
},
|
| 1060 |
+
{
|
| 1061 |
+
"type": "text",
|
| 1062 |
+
"text": "Training Details: We use the same model architecture as described in Kelly et al. (2020). Our model comprises of single hidden layered explicit model $f_{\\theta}$ modeling the ODE dynamics followed by a linear classifier $g_{\\phi}$ . The hidden layer is 100-dimensional. We train with a batch size of 512 for a total of 7500 steps. We use Adam (Kingma & Ba, 2014) with a constant learning rate of 0.001. For error estimate regularization, we exponentially decrease the regularization coefficient from 2.5 to 1.0. We use Tsim5 (Tsitouras, 2011) as the ODE integrator with an absolute and relative tolerance of $10^{-8.2}$ .",
|
| 1063 |
+
"bbox": [
|
| 1064 |
+
495,
|
| 1065 |
+
583,
|
| 1066 |
+
885,
|
| 1067 |
+
748
|
| 1068 |
+
],
|
| 1069 |
+
"page_idx": 4
|
| 1070 |
+
},
|
| 1071 |
+
{
|
| 1072 |
+
"type": "text",
|
| 1073 |
+
"text": "Baselines: We consider a Vanilla Neural ODE trained with the exact aforementioned specifications. All other baselines are directly taken from Pal et al. (2021).",
|
| 1074 |
+
"bbox": [
|
| 1075 |
+
496,
|
| 1076 |
+
757,
|
| 1077 |
+
885,
|
| 1078 |
+
801
|
| 1079 |
+
],
|
| 1080 |
+
"page_idx": 4
|
| 1081 |
+
},
|
| 1082 |
+
{
|
| 1083 |
+
"type": "text",
|
| 1084 |
+
"text": "Results: We summarize the results in Table 2 and Figure 3. Using local regularization speeds up prediction in all cases while it leads to a minor slowdown during training for biased sampling.",
|
| 1085 |
+
"bbox": [
|
| 1086 |
+
496,
|
| 1087 |
+
809,
|
| 1088 |
+
885,
|
| 1089 |
+
868
|
| 1090 |
+
],
|
| 1091 |
+
"page_idx": 4
|
| 1092 |
+
},
|
| 1093 |
+
{
|
| 1094 |
+
"type": "text",
|
| 1095 |
+
"text": "We note that this is not a realistic tolerance at which image classification models are trained. We use this tolerance to allow a direct comparison to prior works.",
|
| 1096 |
+
"bbox": [
|
| 1097 |
+
496,
|
| 1098 |
+
867,
|
| 1099 |
+
885,
|
| 1100 |
+
905
|
| 1101 |
+
],
|
| 1102 |
+
"page_idx": 4
|
| 1103 |
+
},
|
| 1104 |
+
{
|
| 1105 |
+
"type": "header",
|
| 1106 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 1107 |
+
"bbox": [
|
| 1108 |
+
325,
|
| 1109 |
+
56,
|
| 1110 |
+
647,
|
| 1111 |
+
70
|
| 1112 |
+
],
|
| 1113 |
+
"page_idx": 4
|
| 1114 |
+
},
|
| 1115 |
+
{
|
| 1116 |
+
"type": "page_number",
|
| 1117 |
+
"text": "5",
|
| 1118 |
+
"bbox": [
|
| 1119 |
+
480,
|
| 1120 |
+
922,
|
| 1121 |
+
491,
|
| 1122 |
+
934
|
| 1123 |
+
],
|
| 1124 |
+
"page_idx": 4
|
| 1125 |
+
},
|
| 1126 |
+
{
|
| 1127 |
+
"type": "table",
|
| 1128 |
+
"img_path": "images/7b692d56f6e85e25c1287dae53502f1cc2176d1a1ab4e1703ed89be2d8f49700.jpg",
|
| 1129 |
+
"table_caption": [],
|
| 1130 |
+
"table_footnote": [],
|
| 1131 |
+
"table_body": "<table><tr><td>Method</td><td>Train Accuracy (%)</td><td>Test Accuracy (%)</td><td>Training Time (hr)</td><td>Prediction Time (s / batch)</td><td>Testing NFE</td></tr><tr><td>Vanilla NODE</td><td>99.898 ± 0.066</td><td>97.612 ± 0.163</td><td>0.54 ± 0.001</td><td>0.088 ± 0.020</td><td>303.559 ± 3.194</td></tr><tr><td>STEER¶</td><td>100.00 ± 0.000</td><td>97.94 ± 0.03</td><td>1.31 ± 0.07</td><td>0.092 ± 0.002</td><td>265.0 ± 3.46</td></tr><tr><td>TayNODE¶</td><td>98.98 ± 0.06</td><td>97.89 ± 0.00</td><td>1.19 ± 0.07</td><td>0.079 ± 0.007</td><td>80.3 ± 0.43</td></tr><tr><td>ERNODE¶</td><td>99.71 ± 0.28</td><td>97.32 ± 0.06</td><td>0.82 ± 0.02</td><td>0.060 ± 0.001</td><td>177.0 ± 0.00</td></tr><tr><td>SRNODE¶</td><td>100.00 ± 0.000</td><td>98.08 ± 0.15</td><td>1.24 ± 0.06</td><td>0.094 ± 0.003</td><td>259.0 ± 3.46</td></tr><tr><td>Local Unbiased ERNODE</td><td>99.447 ± 0.039</td><td>97.526 ± 0.131</td><td>0.49 ± 0.002</td><td>0.046 ± 0.002</td><td>187.961 ± 1.812</td></tr><tr><td>Local Biased ERNODE</td><td>99.477 ± 0.051</td><td>97.488 ± 0.016</td><td>1.12 ± 0.065</td><td>0.044 ± 0.002</td><td>182.849 ± 1.578</td></tr><tr><td>Vanilla NSDE</td><td>98.27 ± 0.11</td><td>96.66 ± 0.16</td><td>2.70 ± 0.00</td><td>0.51 ± 0.07</td><td>313.86 ± 2.94</td></tr><tr><td>ERNSDE¶</td><td>98.16 ± 0.11</td><td>96.27 ± 0.35</td><td>4.19 ± 0.04</td><td>7.23 ± 0.14</td><td>184.67 ± 2.31</td></tr><tr><td>SRNSDE¶</td><td>98.79 ± 0.12</td><td>96.80 ± 0.07</td><td>8.54 ± 0.37</td><td>14.50 ± 0.40</td><td>382.00 ± 4.00</td></tr><tr><td>Local Unbiased ERNSDE</td><td>98.05 ± 0.09</td><td>96.57 ± 0.13</td><td>2.10 ± 0.01</td><td>0.39 ± 0.10</td><td>228.93 ± 1.77</td></tr><tr><td>Local Biased ERNSDE</td><td>98.02 ± 0.07</td><td>96.44 ± 0.16</td><td>1.90 ± 0.00</td><td>0.36 ± 0.03</td><td>230.10 ± 0.71</td></tr></table>",
|
| 1132 |
+
"bbox": [
|
| 1133 |
+
130,
|
| 1134 |
+
80,
|
| 1135 |
+
841,
|
| 1136 |
+
289
|
| 1137 |
+
],
|
| 1138 |
+
"page_idx": 5
|
| 1139 |
+
},
|
| 1140 |
+
{
|
| 1141 |
+
"type": "table",
|
| 1142 |
+
"img_path": "images/b4cb30db1c7e1d4fb151f35676025a3978af05d14ec356ea7a59866953cc7b01.jpg",
|
| 1143 |
+
"table_caption": [
|
| 1144 |
+
"Table 2: MNIST Image Classification using Neural DE: Using local unbiased regularization on neural ODE speeds up training by $1.1 \\times$ and predictions by $1.9 \\times$ while reducing the total NFEs to $0.619 \\times$ . Local Biased Regularization tends to slow down training for smaller models on GPU while it further reduces the NFEs by $0.602 \\times$ . For Neural SDE, we observe a similar reduction of NFEs by $0.729 \\times -0.733 \\times$ and a training time improvement of $1.28 \\times -1.42 \\times$ . The best global regularization method gets lower NFEs but overall takes more wall clock than the best performing local regularization method."
|
| 1145 |
+
],
|
| 1146 |
+
"table_footnote": [],
|
| 1147 |
+
"table_body": "<table><tr><td>Method</td><td>Test Loss (×10-3)</td><td>Training Time (hr)</td><td>Prediction Time (s / batch)</td><td>Testing NFE</td></tr><tr><td>Vanilla NODE</td><td>3.41 ± 0.10</td><td>2.48 ± 0.22</td><td>0.16 ± 0.01</td><td>758.0 ± 25.87</td></tr><tr><td>STEER¶</td><td>3.48 ± 0.01</td><td>1.62 ± 0.26</td><td>0.54 ± 0.06</td><td>699.0 ± 141.1</td></tr><tr><td>TayNODE¶</td><td>4.21 ± 0.01</td><td>12.3 ± 0.32</td><td>0.22 ± 0.02</td><td>167.3 ± 11.93</td></tr><tr><td>ERNODE¶</td><td>3.57 ± 0.00</td><td>0.94 ± 0.13</td><td>0.21 ± 0.02</td><td>287.0 ± 17.32</td></tr><tr><td>SRNODE¶</td><td>3.58 ± 0.05</td><td>0.87 ± 0.09</td><td>0.20 ± 0.01</td><td>273.0 ± 0.000</td></tr><tr><td>Local Unbiased ERNODE</td><td>3.64 ± 0.07</td><td>2.31 ± 0.02</td><td>0.09 ± 0.00</td><td>422.0 ± 4.580</td></tr><tr><td>Local Biased ERNODE</td><td>3.63 ± 0.08</td><td>2.12 ± 0.24</td><td>0.10 ± 0.01</td><td>463.0 ± 63.02</td></tr></table>",
|
| 1148 |
+
"bbox": [
|
| 1149 |
+
161,
|
| 1150 |
+
393,
|
| 1151 |
+
810,
|
| 1152 |
+
547
|
| 1153 |
+
],
|
| 1154 |
+
"page_idx": 5
|
| 1155 |
+
},
|
| 1156 |
+
{
|
| 1157 |
+
"type": "text",
|
| 1158 |
+
"text": "Table 3: Physionet Time Series Interpolation: Local Regularization reduces NFEs by $0.556 \\times -0.610 \\times$ reducing the prediction timings by $1.6 \\times -1.78 \\times$ . Our methods additionally improve training timings by $1.073 \\times -1.167 \\times$ . We note that the difference in training time compared to (E/S)RNODE methods is due to change in the sensitivity algorithm.",
|
| 1159 |
+
"bbox": [
|
| 1160 |
+
86,
|
| 1161 |
+
559,
|
| 1162 |
+
885,
|
| 1163 |
+
604
|
| 1164 |
+
],
|
| 1165 |
+
"page_idx": 5
|
| 1166 |
+
},
|
| 1167 |
+
{
|
| 1168 |
+
"type": "text",
|
| 1169 |
+
"text": "4.1.2. NEURAL STOCHASTIC DIFFERENTIAL EQUATION",
|
| 1170 |
+
"text_level": 1,
|
| 1171 |
+
"bbox": [
|
| 1172 |
+
88,
|
| 1173 |
+
632,
|
| 1174 |
+
472,
|
| 1175 |
+
646
|
| 1176 |
+
],
|
| 1177 |
+
"page_idx": 5
|
| 1178 |
+
},
|
| 1179 |
+
{
|
| 1180 |
+
"type": "text",
|
| 1181 |
+
"text": "Training Details: We downsample the flattened images to a 32-dimensional vector before feeding it into the Neural SDE which uses a diffusion model $(f_{\\theta})$ having a 64-dimensional hidden layer and a linear drift model $(g_{\\phi})$ . Finally, a linear classifier $(h_{\\gamma})$ predicts the label. We train our models on CPU with a batch size of 512 for a total of 4000 steps. We optimize the weights using Adam (Kingma & Ba, 2014) with a constant learning rate of 0.01. We use SOSRI2 SDE solver (Rackauckas & Nie, 2017) with a tolerance of 0.14. We fix our regularization coefficient to be $10^{3}$ . For this experiment, we rely on discrete sensitivity analysis.",
|
| 1182 |
+
"bbox": [
|
| 1183 |
+
86,
|
| 1184 |
+
655,
|
| 1185 |
+
473,
|
| 1186 |
+
821
|
| 1187 |
+
],
|
| 1188 |
+
"page_idx": 5
|
| 1189 |
+
},
|
| 1190 |
+
{
|
| 1191 |
+
"type": "text",
|
| 1192 |
+
"text": "Baselines: ERNSDE and SRNSDE results were taken from Pal et al. (2021). These were trained for 40 epochs, nearly equivalent to training for 4000 iterations.",
|
| 1193 |
+
"bbox": [
|
| 1194 |
+
86,
|
| 1195 |
+
829,
|
| 1196 |
+
472,
|
| 1197 |
+
873
|
| 1198 |
+
],
|
| 1199 |
+
"page_idx": 5
|
| 1200 |
+
},
|
| 1201 |
+
{
|
| 1202 |
+
"type": "text",
|
| 1203 |
+
"text": "Results: We summarize the results in Table 2 and Figure 4.",
|
| 1204 |
+
"bbox": [
|
| 1205 |
+
88,
|
| 1206 |
+
881,
|
| 1207 |
+
473,
|
| 1208 |
+
896
|
| 1209 |
+
],
|
| 1210 |
+
"page_idx": 5
|
| 1211 |
+
},
|
| 1212 |
+
{
|
| 1213 |
+
"type": "text",
|
| 1214 |
+
"text": "Local regularization improves training and prediction performance while keeping the test accuracy nearly constant.",
|
| 1215 |
+
"bbox": [
|
| 1216 |
+
500,
|
| 1217 |
+
632,
|
| 1218 |
+
885,
|
| 1219 |
+
662
|
| 1220 |
+
],
|
| 1221 |
+
"page_idx": 5
|
| 1222 |
+
},
|
| 1223 |
+
{
|
| 1224 |
+
"type": "text",
|
| 1225 |
+
"text": "4.2. Physionet Time Series Interpolation",
|
| 1226 |
+
"text_level": 1,
|
| 1227 |
+
"bbox": [
|
| 1228 |
+
500,
|
| 1229 |
+
678,
|
| 1230 |
+
779,
|
| 1231 |
+
694
|
| 1232 |
+
],
|
| 1233 |
+
"page_idx": 5
|
| 1234 |
+
},
|
| 1235 |
+
{
|
| 1236 |
+
"type": "text",
|
| 1237 |
+
"text": "Training Details: We use the experimental setup for Physionet 2012 Challenge Dataset (Citi & Barbieri, 2012) from Kelly et al. (2020). We use a Latent Neural ODE (Rubanova et al., 2019) to perform time series interpolation on the dataset. We use the preprocessed dataset from Kelly et al. (2020) to ensure a fair comparison and independent runs are performed using an 80:20 split of the dataset.",
|
| 1238 |
+
"bbox": [
|
| 1239 |
+
500,
|
| 1240 |
+
702,
|
| 1241 |
+
885,
|
| 1242 |
+
808
|
| 1243 |
+
],
|
| 1244 |
+
"page_idx": 5
|
| 1245 |
+
},
|
| 1246 |
+
{
|
| 1247 |
+
"type": "text",
|
| 1248 |
+
"text": "For specific model architecture details, we refer the readers to Pal et al. (2021). We train the model for a total of 3000 iterations using Adamax (Kingma & Ba, 2014) with a learning rate of 0.01 with $10^{-5}$ inverse decay per step. We use a batch size of 512. We diverge from Pal et al. (2021), in using",
|
| 1249 |
+
"bbox": [
|
| 1250 |
+
500,
|
| 1251 |
+
815,
|
| 1252 |
+
885,
|
| 1253 |
+
891
|
| 1254 |
+
],
|
| 1255 |
+
"page_idx": 5
|
| 1256 |
+
},
|
| 1257 |
+
{
|
| 1258 |
+
"type": "header",
|
| 1259 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 1260 |
+
"bbox": [
|
| 1261 |
+
326,
|
| 1262 |
+
56,
|
| 1263 |
+
643,
|
| 1264 |
+
70
|
| 1265 |
+
],
|
| 1266 |
+
"page_idx": 5
|
| 1267 |
+
},
|
| 1268 |
+
{
|
| 1269 |
+
"type": "page_number",
|
| 1270 |
+
"text": "6",
|
| 1271 |
+
"bbox": [
|
| 1272 |
+
480,
|
| 1273 |
+
924,
|
| 1274 |
+
491,
|
| 1275 |
+
934
|
| 1276 |
+
],
|
| 1277 |
+
"page_idx": 5
|
| 1278 |
+
},
|
| 1279 |
+
{
|
| 1280 |
+
"type": "table",
|
| 1281 |
+
"img_path": "images/17d72e8925498a3502a6cf410159c9963fd43a76cbdcabac468e82ceb2278061.jpg",
|
| 1282 |
+
"table_caption": [],
|
| 1283 |
+
"table_footnote": [],
|
| 1284 |
+
"table_body": "<table><tr><td>Configuration</td><td>Method</td><td>Train Accuracy (%)</td><td>Test Accuracy (%)</td><td>Training Time (s / batch)</td><td>Prediction Time (s / batch)</td><td>Testing NFE</td></tr><tr><td rowspan=\"3\">Standard</td><td>Vanilla</td><td>83.683 ± 1.450</td><td>67.394 ± 0.849</td><td>0.457 ± 0.018</td><td>0.130 ± 0.013</td><td>115.315 ± 12.136</td></tr><tr><td>Local Unbiased ER</td><td>83.665 ± 0.805</td><td>67.678 ± 0.874</td><td>0.399 ± 0.014</td><td>0.096 ± 0.007</td><td>89.048 ± 7.335</td></tr><tr><td>Local Biased ER</td><td>83.958 ± 1.032</td><td>67.745 ± 0.824</td><td>0.555 ± 0.008</td><td>0.088 ± 0.003</td><td>81.301 ± 1.255</td></tr><tr><td rowspan=\"3\">Multi-Scale</td><td>Vanilla</td><td>92.807 ± 12.458</td><td>80.048 ± 6.740</td><td>0.572 ± 0.012</td><td>0.170 ± 0.005</td><td>27.616 ± 0.905</td></tr><tr><td>Local Unbiased ER</td><td>94.159 ± 9.694</td><td>80.432 ± 5.548</td><td>0.641 ± 0.025</td><td>0.175 ± 0.019</td><td>27.760 ± 0.177</td></tr><tr><td>Local Biased ER</td><td>99.987 ± 0.023</td><td>83.460 ± 0.727</td><td>0.774 ± 0.293</td><td>0.163 ± 0.015</td><td>26.334 ± 0.992</td></tr></table>",
|
| 1285 |
+
"bbox": [
|
| 1286 |
+
130,
|
| 1287 |
+
80,
|
| 1288 |
+
844,
|
| 1289 |
+
208
|
| 1290 |
+
],
|
| 1291 |
+
"page_idx": 6
|
| 1292 |
+
},
|
| 1293 |
+
{
|
| 1294 |
+
"type": "text",
|
| 1295 |
+
"text": "Table 4: CIFAR10 Image Classification using Neural DE: For the standard Neural ODE, local regularization reduces the NFE by $0.705 \\times -0.772 \\times$ , thereby improving prediction timings by $1.35 \\times -1.477 \\times$ . However, unregularized model training takes $0.823 \\times$ the time for the biased model. For multi-scale models, the NFE and prediction time improvements are marginal and come at the cost of higher training time.",
|
| 1296 |
+
"bbox": [
|
| 1297 |
+
83,
|
| 1298 |
+
218,
|
| 1299 |
+
883,
|
| 1300 |
+
279
|
| 1301 |
+
],
|
| 1302 |
+
"page_idx": 6
|
| 1303 |
+
},
|
| 1304 |
+
{
|
| 1305 |
+
"type": "image",
|
| 1306 |
+
"img_path": "images/8d0cc2fda2e9b55cbcd7dc80757b8a60c51a0d675fef39445e62763c2ffc9c39.jpg",
|
| 1307 |
+
"image_caption": [],
|
| 1308 |
+
"image_footnote": [],
|
| 1309 |
+
"bbox": [
|
| 1310 |
+
133,
|
| 1311 |
+
306,
|
| 1312 |
+
431,
|
| 1313 |
+
459
|
| 1314 |
+
],
|
| 1315 |
+
"page_idx": 6
|
| 1316 |
+
},
|
| 1317 |
+
{
|
| 1318 |
+
"type": "image",
|
| 1319 |
+
"img_path": "images/343cd79ed540ae39c518c412361234b37db022b7f23de764a98f6225e9528f22.jpg",
|
| 1320 |
+
"image_caption": [
|
| 1321 |
+
"Figure 4: MNIST Classification using Neural SDE"
|
| 1322 |
+
],
|
| 1323 |
+
"image_footnote": [],
|
| 1324 |
+
"bbox": [
|
| 1325 |
+
133,
|
| 1326 |
+
463,
|
| 1327 |
+
431,
|
| 1328 |
+
621
|
| 1329 |
+
],
|
| 1330 |
+
"page_idx": 6
|
| 1331 |
+
},
|
| 1332 |
+
{
|
| 1333 |
+
"type": "image",
|
| 1334 |
+
"img_path": "images/bc101c526338ba4222e14614f4d6944f227fd723888151d0c374398ab9ae820f.jpg",
|
| 1335 |
+
"image_caption": [],
|
| 1336 |
+
"image_footnote": [],
|
| 1337 |
+
"bbox": [
|
| 1338 |
+
545,
|
| 1339 |
+
308,
|
| 1340 |
+
839,
|
| 1341 |
+
458
|
| 1342 |
+
],
|
| 1343 |
+
"page_idx": 6
|
| 1344 |
+
},
|
| 1345 |
+
{
|
| 1346 |
+
"type": "image",
|
| 1347 |
+
"img_path": "images/f09c3b5680fca07c80c5a92578a03dfe5af3a466cbbfeb801d656d51f955b052.jpg",
|
| 1348 |
+
"image_caption": [
|
| 1349 |
+
"Figure 5: Physionet Time Series Interpolation using Latent ODE"
|
| 1350 |
+
],
|
| 1351 |
+
"image_footnote": [],
|
| 1352 |
+
"bbox": [
|
| 1353 |
+
552,
|
| 1354 |
+
463,
|
| 1355 |
+
839,
|
| 1356 |
+
621
|
| 1357 |
+
],
|
| 1358 |
+
"page_idx": 6
|
| 1359 |
+
},
|
| 1360 |
+
{
|
| 1361 |
+
"type": "text",
|
| 1362 |
+
"text": "the regularization term as $\\left(\\mathrm{E}_{\\mathrm{Est}}\\right)_{t_{\\mathrm{reg}}} \\cdot \\left|dt\\right|_{t_{\\mathrm{reg}}}$ instead of the squared regularization term $\\sum_{j} \\left(\\mathrm{E}_{\\mathrm{Est}}\\right)_j^2$ . Additionally, we decay the regularization coefficient exponentially from 100 to 10 over the 3000 training iterations.",
|
| 1363 |
+
"bbox": [
|
| 1364 |
+
84,
|
| 1365 |
+
750,
|
| 1366 |
+
473,
|
| 1367 |
+
815
|
| 1368 |
+
],
|
| 1369 |
+
"page_idx": 6
|
| 1370 |
+
},
|
| 1371 |
+
{
|
| 1372 |
+
"type": "text",
|
| 1373 |
+
"text": "Baselines: Vanilla NODE was trained with the exact aforementioned configuration. All the other baselines were trained using discrete sensitivity analysis, and the exact details are present in Pal et al. (2021).",
|
| 1374 |
+
"bbox": [
|
| 1375 |
+
84,
|
| 1376 |
+
821,
|
| 1377 |
+
475,
|
| 1378 |
+
882
|
| 1379 |
+
],
|
| 1380 |
+
"page_idx": 6
|
| 1381 |
+
},
|
| 1382 |
+
{
|
| 1383 |
+
"type": "text",
|
| 1384 |
+
"text": "Results: We summarize the results in Figure 5 and Table 3.",
|
| 1385 |
+
"bbox": [
|
| 1386 |
+
84,
|
| 1387 |
+
890,
|
| 1388 |
+
475,
|
| 1389 |
+
905
|
| 1390 |
+
],
|
| 1391 |
+
"page_idx": 6
|
| 1392 |
+
},
|
| 1393 |
+
{
|
| 1394 |
+
"type": "text",
|
| 1395 |
+
"text": "4.3. CIFAR10 Image Classification",
|
| 1396 |
+
"text_level": 1,
|
| 1397 |
+
"bbox": [
|
| 1398 |
+
496,
|
| 1399 |
+
729,
|
| 1400 |
+
741,
|
| 1401 |
+
744
|
| 1402 |
+
],
|
| 1403 |
+
"page_idx": 6
|
| 1404 |
+
},
|
| 1405 |
+
{
|
| 1406 |
+
"type": "text",
|
| 1407 |
+
"text": "4.3.1. NEURAL ORDINARY DIFFERENTIAL EQUATION",
|
| 1408 |
+
"text_level": 1,
|
| 1409 |
+
"bbox": [
|
| 1410 |
+
496,
|
| 1411 |
+
753,
|
| 1412 |
+
872,
|
| 1413 |
+
768
|
| 1414 |
+
],
|
| 1415 |
+
"page_idx": 6
|
| 1416 |
+
},
|
| 1417 |
+
{
|
| 1418 |
+
"type": "text",
|
| 1419 |
+
"text": "Training Details: We use the CNN architecture for CIFAR10 as described in Poli et al. (2020). We train the models for 31250 steps with Adam (Kingma & Ba, 2014) using a cosine-annealing learning rate scheduler from 0.003 to 0.0001. We train the models with a batch size of 32 and keep the regularization coefficient fixed at 2.5. We use Tsit5 (Tsitouras, 2011) with a tolerance of $10^{-4}$ .",
|
| 1420 |
+
"bbox": [
|
| 1421 |
+
495,
|
| 1422 |
+
776,
|
| 1423 |
+
887,
|
| 1424 |
+
882
|
| 1425 |
+
],
|
| 1426 |
+
"page_idx": 6
|
| 1427 |
+
},
|
| 1428 |
+
{
|
| 1429 |
+
"type": "text",
|
| 1430 |
+
"text": "Results: We summarize the results in Figure 6 and Table 4.",
|
| 1431 |
+
"bbox": [
|
| 1432 |
+
496,
|
| 1433 |
+
890,
|
| 1434 |
+
887,
|
| 1435 |
+
905
|
| 1436 |
+
],
|
| 1437 |
+
"page_idx": 6
|
| 1438 |
+
},
|
| 1439 |
+
{
|
| 1440 |
+
"type": "header",
|
| 1441 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 1442 |
+
"bbox": [
|
| 1443 |
+
325,
|
| 1444 |
+
56,
|
| 1445 |
+
643,
|
| 1446 |
+
70
|
| 1447 |
+
],
|
| 1448 |
+
"page_idx": 6
|
| 1449 |
+
},
|
| 1450 |
+
{
|
| 1451 |
+
"type": "page_number",
|
| 1452 |
+
"text": "7",
|
| 1453 |
+
"bbox": [
|
| 1454 |
+
480,
|
| 1455 |
+
922,
|
| 1456 |
+
491,
|
| 1457 |
+
934
|
| 1458 |
+
],
|
| 1459 |
+
"page_idx": 6
|
| 1460 |
+
},
|
| 1461 |
+
{
|
| 1462 |
+
"type": "image",
|
| 1463 |
+
"img_path": "images/8f1b4b1a11df4d55e919c1755a5d1b90214eab2810ffb9b45e05f99573568409.jpg",
|
| 1464 |
+
"image_caption": [
|
| 1465 |
+
"Figure 6: CIFAR10 Image Classification using Standard Neural ODE"
|
| 1466 |
+
],
|
| 1467 |
+
"image_footnote": [],
|
| 1468 |
+
"bbox": [
|
| 1469 |
+
174,
|
| 1470 |
+
84,
|
| 1471 |
+
379,
|
| 1472 |
+
246
|
| 1473 |
+
],
|
| 1474 |
+
"page_idx": 7
|
| 1475 |
+
},
|
| 1476 |
+
{
|
| 1477 |
+
"type": "image",
|
| 1478 |
+
"img_path": "images/898763d3bc97223ec1301cde62f5a3675364d7e53a9fb0542e14bc8fc52199f4.jpg",
|
| 1479 |
+
"image_caption": [],
|
| 1480 |
+
"image_footnote": [],
|
| 1481 |
+
"bbox": [
|
| 1482 |
+
383,
|
| 1483 |
+
85,
|
| 1484 |
+
586,
|
| 1485 |
+
246
|
| 1486 |
+
],
|
| 1487 |
+
"page_idx": 7
|
| 1488 |
+
},
|
| 1489 |
+
{
|
| 1490 |
+
"type": "image",
|
| 1491 |
+
"img_path": "images/3cf90c5597417af3008988c53085b5e99922da7f703d90f7028622a19dff52ee.jpg",
|
| 1492 |
+
"image_caption": [],
|
| 1493 |
+
"image_footnote": [],
|
| 1494 |
+
"bbox": [
|
| 1495 |
+
591,
|
| 1496 |
+
85,
|
| 1497 |
+
800,
|
| 1498 |
+
244
|
| 1499 |
+
],
|
| 1500 |
+
"page_idx": 7
|
| 1501 |
+
},
|
| 1502 |
+
{
|
| 1503 |
+
"type": "image",
|
| 1504 |
+
"img_path": "images/364ecff500fd232249985dd85601e1c049d5e381eaef05707fb66e676b466bb2.jpg",
|
| 1505 |
+
"image_caption": [
|
| 1506 |
+
"Figure 7: CIFAR10 Image Classification using Multi-Scale Neural ODE"
|
| 1507 |
+
],
|
| 1508 |
+
"image_footnote": [],
|
| 1509 |
+
"bbox": [
|
| 1510 |
+
174,
|
| 1511 |
+
295,
|
| 1512 |
+
385,
|
| 1513 |
+
455
|
| 1514 |
+
],
|
| 1515 |
+
"page_idx": 7
|
| 1516 |
+
},
|
| 1517 |
+
{
|
| 1518 |
+
"type": "image",
|
| 1519 |
+
"img_path": "images/f7416be69c8d4dfc752a8d4e4d613477c4ee1ece7eca235777fff27b6498c8a2.jpg",
|
| 1520 |
+
"image_caption": [],
|
| 1521 |
+
"image_footnote": [],
|
| 1522 |
+
"bbox": [
|
| 1523 |
+
385,
|
| 1524 |
+
296,
|
| 1525 |
+
594,
|
| 1526 |
+
455
|
| 1527 |
+
],
|
| 1528 |
+
"page_idx": 7
|
| 1529 |
+
},
|
| 1530 |
+
{
|
| 1531 |
+
"type": "image",
|
| 1532 |
+
"img_path": "images/262cf0a8bad9b471532a489511fc182e1bdf24800d0add7516834023606f725e.jpg",
|
| 1533 |
+
"image_caption": [],
|
| 1534 |
+
"image_footnote": [],
|
| 1535 |
+
"bbox": [
|
| 1536 |
+
596,
|
| 1537 |
+
296,
|
| 1538 |
+
805,
|
| 1539 |
+
455
|
| 1540 |
+
],
|
| 1541 |
+
"page_idx": 7
|
| 1542 |
+
},
|
| 1543 |
+
{
|
| 1544 |
+
"type": "text",
|
| 1545 |
+
"text": "4.3.2. MULTISCALE NEURAL ODE",
|
| 1546 |
+
"text_level": 1,
|
| 1547 |
+
"bbox": [
|
| 1548 |
+
84,
|
| 1549 |
+
513,
|
| 1550 |
+
333,
|
| 1551 |
+
527
|
| 1552 |
+
],
|
| 1553 |
+
"page_idx": 7
|
| 1554 |
+
},
|
| 1555 |
+
{
|
| 1556 |
+
"type": "text",
|
| 1557 |
+
"text": "Training Details: We modify the Tiny Multiscale DEQ architecture for CIFAR10 from Bai et al. (2020) as Multiscale Neural ODE with Input Injection (See Section 2.5). To stabilize the training for larger models, we exponentially increase the regularization coefficient from 0.1 to 5.0. We train with a batch size of 128 using VCAB3 (Wanner & Hairer, 1996) with a tolerance of 0.05.",
|
| 1558 |
+
"bbox": [
|
| 1559 |
+
84,
|
| 1560 |
+
537,
|
| 1561 |
+
475,
|
| 1562 |
+
643
|
| 1563 |
+
],
|
| 1564 |
+
"page_idx": 7
|
| 1565 |
+
},
|
| 1566 |
+
{
|
| 1567 |
+
"type": "text",
|
| 1568 |
+
"text": "Results: We summarize the results in Figure 7 and Table 4. The benefits from regularization for NFEs and prediction timings seem marginal. However, regularization using biased sampling makes the training dynamics stable as observed in Figure 7.",
|
| 1569 |
+
"bbox": [
|
| 1570 |
+
84,
|
| 1571 |
+
651,
|
| 1572 |
+
477,
|
| 1573 |
+
726
|
| 1574 |
+
],
|
| 1575 |
+
"page_idx": 7
|
| 1576 |
+
},
|
| 1577 |
+
{
|
| 1578 |
+
"type": "text",
|
| 1579 |
+
"text": "5. Related Works",
|
| 1580 |
+
"text_level": 1,
|
| 1581 |
+
"bbox": [
|
| 1582 |
+
84,
|
| 1583 |
+
746,
|
| 1584 |
+
235,
|
| 1585 |
+
762
|
| 1586 |
+
],
|
| 1587 |
+
"page_idx": 7
|
| 1588 |
+
},
|
| 1589 |
+
{
|
| 1590 |
+
"type": "text",
|
| 1591 |
+
"text": "Neural Differential Equations (and by extension most Implicit Neural Networks) are mostly constrained by expensive training and prediction timings (Dupont et al., 2019; Kelly et al., 2020; Finlay et al., 2020; Behl et al., 2020; Pal et al., 2021). Traditionally accelerating these models have relied on using higher-order regularization terms to constrain the space of learnable dynamics (Finlay et al., 2020; Kelly et al., 2020). These models speed up predictions, but their benefits",
|
| 1592 |
+
"bbox": [
|
| 1593 |
+
84,
|
| 1594 |
+
771,
|
| 1595 |
+
475,
|
| 1596 |
+
892
|
| 1597 |
+
],
|
| 1598 |
+
"page_idx": 7
|
| 1599 |
+
},
|
| 1600 |
+
{
|
| 1601 |
+
"type": "text",
|
| 1602 |
+
"text": "are often overshadowed by a massive training slowdown (Pal et al., 2021).",
|
| 1603 |
+
"bbox": [
|
| 1604 |
+
496,
|
| 1605 |
+
513,
|
| 1606 |
+
885,
|
| 1607 |
+
544
|
| 1608 |
+
],
|
| 1609 |
+
"page_idx": 7
|
| 1610 |
+
},
|
| 1611 |
+
{
|
| 1612 |
+
"type": "text",
|
| 1613 |
+
"text": "More recently, quite a few first-order schemes have been proposed. Behl et al. (2020) randomized the endpoint of Neural ODEs to incentivize simpler dynamics. However, Pal et al. (2021) didn't find significant benefits of using STEER in their experiments. Pal et al. (2021) used internal solver heuristics – local error and stiffness estimates – to control the learned dynamics in a way that decreased both prediction and training time. We discuss their work in detail in Section 2.4. Xia et al. (2021) rewrite Neural ODEs as heavy ball ODEs to accelerate both forward and backward passes. Djeumou et al. (2022) replace ODE solvers in the forward with a Taylor-Lagrange expansion and report significantly better training and prediction times.",
|
| 1614 |
+
"bbox": [
|
| 1615 |
+
495,
|
| 1616 |
+
551,
|
| 1617 |
+
887,
|
| 1618 |
+
750
|
| 1619 |
+
],
|
| 1620 |
+
"page_idx": 7
|
| 1621 |
+
},
|
| 1622 |
+
{
|
| 1623 |
+
"type": "text",
|
| 1624 |
+
"text": "6. Discussion",
|
| 1625 |
+
"text_level": 1,
|
| 1626 |
+
"bbox": [
|
| 1627 |
+
496,
|
| 1628 |
+
768,
|
| 1629 |
+
609,
|
| 1630 |
+
782
|
| 1631 |
+
],
|
| 1632 |
+
"page_idx": 7
|
| 1633 |
+
},
|
| 1634 |
+
{
|
| 1635 |
+
"type": "text",
|
| 1636 |
+
"text": "In this manuscript, we have shown that we can obtain similar properties to global regularization by regularizing dynamical systems at randomly sampled time points. Additionally, this comes with the benefit of not being forced into a specific sensitivity analysis method. We have taken every experiment in Pal et al. (2021) and empirically showed that our local regularization works at par with global regularization.",
|
| 1637 |
+
"bbox": [
|
| 1638 |
+
495,
|
| 1639 |
+
792,
|
| 1640 |
+
888,
|
| 1641 |
+
900
|
| 1642 |
+
],
|
| 1643 |
+
"page_idx": 7
|
| 1644 |
+
},
|
| 1645 |
+
{
|
| 1646 |
+
"type": "header",
|
| 1647 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 1648 |
+
"bbox": [
|
| 1649 |
+
326,
|
| 1650 |
+
56,
|
| 1651 |
+
645,
|
| 1652 |
+
70
|
| 1653 |
+
],
|
| 1654 |
+
"page_idx": 7
|
| 1655 |
+
},
|
| 1656 |
+
{
|
| 1657 |
+
"type": "page_number",
|
| 1658 |
+
"text": "8",
|
| 1659 |
+
"bbox": [
|
| 1660 |
+
480,
|
| 1661 |
+
922,
|
| 1662 |
+
491,
|
| 1663 |
+
934
|
| 1664 |
+
],
|
| 1665 |
+
"page_idx": 7
|
| 1666 |
+
},
|
| 1667 |
+
{
|
| 1668 |
+
"type": "text",
|
| 1669 |
+
"text": "However, our experiments using stiffness estimate for local regularization did not yield positive results and were not presented in this manuscript. Thus, we have demonstrated that we can \"close the blackbox\" and still leverage all the benefits of internal solver heuristics to improve training and predictions of neural differential equations.",
|
| 1670 |
+
"bbox": [
|
| 1671 |
+
84,
|
| 1672 |
+
85,
|
| 1673 |
+
473,
|
| 1674 |
+
176
|
| 1675 |
+
],
|
| 1676 |
+
"page_idx": 8
|
| 1677 |
+
},
|
| 1678 |
+
{
|
| 1679 |
+
"type": "text",
|
| 1680 |
+
"text": "6.1. Limitations",
|
| 1681 |
+
"text_level": 1,
|
| 1682 |
+
"bbox": [
|
| 1683 |
+
84,
|
| 1684 |
+
191,
|
| 1685 |
+
200,
|
| 1686 |
+
205
|
| 1687 |
+
],
|
| 1688 |
+
"page_idx": 8
|
| 1689 |
+
},
|
| 1690 |
+
{
|
| 1691 |
+
"type": "text",
|
| 1692 |
+
"text": "We note the following limitations of our work:",
|
| 1693 |
+
"bbox": [
|
| 1694 |
+
84,
|
| 1695 |
+
215,
|
| 1696 |
+
393,
|
| 1697 |
+
231
|
| 1698 |
+
],
|
| 1699 |
+
"page_idx": 8
|
| 1700 |
+
},
|
| 1701 |
+
{
|
| 1702 |
+
"type": "list",
|
| 1703 |
+
"sub_type": "text",
|
| 1704 |
+
"list_items": [
|
| 1705 |
+
"- Similar to Pal et al. (2021), if the objective is to learn the actual dynamical system, our method will not yield proper results. Our method is applicable only when the final state is relevant, i.e., in most classical deep learning tasks.",
|
| 1706 |
+
"- Regularization introduces a new regularization coefficient hyperparameter which, if not tuned correctly, can lead to unstable dynamics or might negate the scheme's usefulness."
|
| 1707 |
+
],
|
| 1708 |
+
"bbox": [
|
| 1709 |
+
104,
|
| 1710 |
+
247,
|
| 1711 |
+
475,
|
| 1712 |
+
391
|
| 1713 |
+
],
|
| 1714 |
+
"page_idx": 8
|
| 1715 |
+
},
|
| 1716 |
+
{
|
| 1717 |
+
"type": "text",
|
| 1718 |
+
"text": "7. Acknowledgement",
|
| 1719 |
+
"text_level": 1,
|
| 1720 |
+
"bbox": [
|
| 1721 |
+
84,
|
| 1722 |
+
411,
|
| 1723 |
+
264,
|
| 1724 |
+
429
|
| 1725 |
+
],
|
| 1726 |
+
"page_idx": 8
|
| 1727 |
+
},
|
| 1728 |
+
{
|
| 1729 |
+
"type": "text",
|
| 1730 |
+
"text": "The authors acknowledge the MIT SuperCloud and Lincoln Laboratory Supercomputing Center for providing HPC resources that have contributed to the research results reported within this paper. This material is based upon work supported by the National Science Foundation under grant no. OAC-1835443, grant no. SII-2029670, grant no. ECCS-2029670, grant no. OAC-2103804, and grant no. PHY-2021825. We also gratefully acknowledge the U.S. Agency for International Development through Penn State for grant no. S002283-USAID. The information, data, or work presented herein was funded in part by the Advanced Research Projects Agency-Energy (ARPA-E), U.S. Department of Energy, under Award Number DE-AR0001211 and DE-AR0001222. We also gratefully acknowledge the U.S. Agency for International Development through Penn State for grant no. S002283-USAID. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof. This material was supported by The Research Council of Norway and Equinor ASA through Research Council project “308817 - Digital wells for optimal production and drainage”. Research was sponsored by the United States Air Force Research Laboratory and the United States Air Force Artificial Intelligence Accelerator and was accomplished under Cooperative Agreement Number FA8750-19-2-1000. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the United States Air Force or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding",
|
| 1731 |
+
"bbox": [
|
| 1732 |
+
84,
|
| 1733 |
+
436,
|
| 1734 |
+
478,
|
| 1735 |
+
906
|
| 1736 |
+
],
|
| 1737 |
+
"page_idx": 8
|
| 1738 |
+
},
|
| 1739 |
+
{
|
| 1740 |
+
"type": "text",
|
| 1741 |
+
"text": "any copyright notation herein.",
|
| 1742 |
+
"bbox": [
|
| 1743 |
+
498,
|
| 1744 |
+
85,
|
| 1745 |
+
699,
|
| 1746 |
+
99
|
| 1747 |
+
],
|
| 1748 |
+
"page_idx": 8
|
| 1749 |
+
},
|
| 1750 |
+
{
|
| 1751 |
+
"type": "text",
|
| 1752 |
+
"text": "References",
|
| 1753 |
+
"text_level": 1,
|
| 1754 |
+
"bbox": [
|
| 1755 |
+
498,
|
| 1756 |
+
119,
|
| 1757 |
+
594,
|
| 1758 |
+
135
|
| 1759 |
+
],
|
| 1760 |
+
"page_idx": 8
|
| 1761 |
+
},
|
| 1762 |
+
{
|
| 1763 |
+
"type": "list",
|
| 1764 |
+
"sub_type": "ref_text",
|
| 1765 |
+
"list_items": [
|
| 1766 |
+
"Anantharaman, R., Ma, Y., Gowda, S., Laughman, C., Shah, V., Edelman, A., and Rackauckas, C. Accelerating simulation of stiff nonlinear systems using continuous-time echo state networks. arXiv preprint arXiv:2010.04004, 2020.",
|
| 1767 |
+
"Ascher, U. M. and Petzold, L. R. Computer methods for ordinary differential equations and differential-algebraic equations, volume 61. Siam, 1998.",
|
| 1768 |
+
"Bai, S., Kolter, J. Z., and Koltun, V. Deep equilibrium models. arXiv preprint arXiv:1909.01377, 2019.",
|
| 1769 |
+
"Bai, S., Koltun, V., and Kolter, J. Z. Multiscale Deep Equilibrium Models. arXiv:2006.08656 [cs, stat], November 2020. URL http://arxiv.org/abs/2006.08656.arXiv:2006.08656.",
|
| 1770 |
+
"Behl, H., Ghosh, A., Dupont, E., Torr, P., and Namboodiri, V. Steer: simple temporal regularization for neural odes. pp. 1-13. Neural Information Processing Systems Foundation, Inc., 2020.",
|
| 1771 |
+
"Bezanson, J., Edelman, A., Karpinski, S., and Shah, V. B. Julia: A fresh approach to numerical computing. SIAM Review, 59(1):65-98, 2017. doi: 10.1137/141000671.",
|
| 1772 |
+
"Burt, P. J. and Adelson, E. H. The laplacian pyramid as a compact image code. In Readings in computer vision, pp. 671-679. Elsevier, 1987.",
|
| 1773 |
+
"Chen, L.-C., Yang, Y., Wang, J., Xu, W., and Yuille, A. L. Attention to scale: Scale-aware semantic image segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3640-3649, 2016.",
|
| 1774 |
+
"Chen, L.-C., Papandreou, G., Kokkinos, I., Murphy, K., and Yuille, A. L. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE transactions on pattern analysis and machine intelligence, 40(4):834-848, 2017.",
|
| 1775 |
+
"Chen, R. T., Rubanova, Y., Bettencourt, J., and Duvenaud, D. K. Neural ordinary differential equations. In Advances in neural information processing systems, pp. 6571-6583, 2018.",
|
| 1776 |
+
"Citi, L. and Barbieri, R. Physionet 2012 challenge: Predicting mortality of icu patients using a cascadedsvm-glm paradigm. In 2012 Computing in Cardiology, pp. 257- 260.IEEE,2012.",
|
| 1777 |
+
"Dauvergne, B. and Hascoet, L. The data-flow equations of checkpointing in reverse automatic differentiation. In"
|
| 1778 |
+
],
|
| 1779 |
+
"bbox": [
|
| 1780 |
+
500,
|
| 1781 |
+
143,
|
| 1782 |
+
888,
|
| 1783 |
+
905
|
| 1784 |
+
],
|
| 1785 |
+
"page_idx": 8
|
| 1786 |
+
},
|
| 1787 |
+
{
|
| 1788 |
+
"type": "header",
|
| 1789 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 1790 |
+
"bbox": [
|
| 1791 |
+
325,
|
| 1792 |
+
56,
|
| 1793 |
+
647,
|
| 1794 |
+
71
|
| 1795 |
+
],
|
| 1796 |
+
"page_idx": 8
|
| 1797 |
+
},
|
| 1798 |
+
{
|
| 1799 |
+
"type": "page_number",
|
| 1800 |
+
"text": "9",
|
| 1801 |
+
"bbox": [
|
| 1802 |
+
480,
|
| 1803 |
+
922,
|
| 1804 |
+
491,
|
| 1805 |
+
934
|
| 1806 |
+
],
|
| 1807 |
+
"page_idx": 8
|
| 1808 |
+
},
|
| 1809 |
+
{
|
| 1810 |
+
"type": "list",
|
| 1811 |
+
"sub_type": "ref_text",
|
| 1812 |
+
"list_items": [
|
| 1813 |
+
"International Conference on Computational Science, pp. 566-573. Springer, 2006.",
|
| 1814 |
+
"Djeumou, F., Neary, C., Goubault, E., Putot, S., and Topcu, U. Taylor-lagrange neural ordinary differential equations: Toward fast training and evaluation of neural odes, 2022.",
|
| 1815 |
+
"Dormand, J. R. and Prince, P. J. A family of embedded runge-kutta formulae. Journal of computational and applied mathematics, 6(1):19-26, 1980.",
|
| 1816 |
+
"Dupont, E., Doucet, A., and Teh, Y. W. Augmented neural odes. Advances in Neural Information Processing Systems, 32, 2019.",
|
| 1817 |
+
"Farabet, C., Couprie, C., Najman, L., and LeCun, Y. Learning hierarchical features for scene labeling. IEEE transactions on pattern analysis and machine intelligence, 35 (8):1915-1929, 2012.",
|
| 1818 |
+
"Fehlberg, E. Classical fifth-, sixth-, seventh-, and eighth-order Runge-Kutta formulas with stepsize control. National Aeronautics and Space Administration, 1968.",
|
| 1819 |
+
"Finlay, C., Jacobsen, J.-H., Nurbekyan, L., and Oberman, A. M. How to train your neural ode. arXiv preprint arXiv:2002.02798, 2020.",
|
| 1820 |
+
"Grathwohl, W., Chen, R. T., Bettencourt, J., Sutskever, I., and Duvenaud, D. Ffjord: Free-form continuous dynamics for scalable reversible generative models. arXiv preprint arXiv:1810.01367, 2018.",
|
| 1821 |
+
"Hairer, E., Norsett, S., and Wanner, G. Solving Ordinary Differential Equations I: Nonstiff Problems, volume 8. 01 1993. ISBN 978-3-540-56670-0. doi: 10.1007/978-3-540-78862-1.",
|
| 1822 |
+
"Hindmarsh, A. C., Brown, P. N., Grant, K. E., Lee, S. L., Serban, R., Shumaker, D. E., and Woodward, C. S. Sundials: Suite of nonlinear and differential/algebraic equation solvers. ACM Trans. Math. Softw., 31(3): 363-396, sep 2005. ISSN 0098-3500. doi: 10.1145/1089014.1089020. URL https://doi.org/10.1145/1089014.1089020.",
|
| 1823 |
+
"Kelly, J., Bettencourt, J., Johnson, M. J., and Duvenaud, D. Learning differential equations that are easy to solve. arXiv preprint arXiv:2007.04504, 2020.",
|
| 1824 |
+
"Kim, S., Ji, W., Deng, S., Ma, Y., and Rackauckas, C. Stiff neural ordinary differential equations. Chaos: An Interdisciplinary Journal of Nonlinear Science, 31(9):093122, 2021.",
|
| 1825 |
+
"Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization, 2014. URL http://arxiv.org/abs/1412.6980. cite arxiv:1412.6980Comment: Published"
|
| 1826 |
+
],
|
| 1827 |
+
"bbox": [
|
| 1828 |
+
86,
|
| 1829 |
+
85,
|
| 1830 |
+
475,
|
| 1831 |
+
904
|
| 1832 |
+
],
|
| 1833 |
+
"page_idx": 9
|
| 1834 |
+
},
|
| 1835 |
+
{
|
| 1836 |
+
"type": "list",
|
| 1837 |
+
"sub_type": "ref_text",
|
| 1838 |
+
"list_items": [
|
| 1839 |
+
"as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015.",
|
| 1840 |
+
"Kutta, W. Beitrag zur nacherungsweisen integration totaler differentialgleichungen. Z. Math. Phys., 46:435-453, 1901.",
|
| 1841 |
+
"LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278-2324, 1998.",
|
| 1842 |
+
"Liu, X., Xiao, T., Si, S., Cao, Q., Kumar, S., and Hsieh, C.-J. Neural sde: Stabilizing neural ode networks with stochastic noise, 2019.",
|
| 1843 |
+
"Lu, Y., Zhong, A., Li, Q., and Dong, B. Beyond finite layer neural networks: Bridging deep architectures and numerical differential equations. In International Conference on Machine Learning, pp. 3276-3285. PMLR, 2018.",
|
| 1844 |
+
"Onken, D. and Ruthotto, L. Discretize-optimize vs. optimize-discretize for time-series regression and continuous normalizing flows. arXiv preprint arXiv:2005.13420, 2020.",
|
| 1845 |
+
"Pal, A. Lux: Explicit parameterization of deep neural networks in julia. https://github.com/avik-pal/Lux.j1/, 2022.",
|
| 1846 |
+
"Pal, A., Ma, Y., Shah, V., and Rackauckas, C. V. Opening the blackbox: Accelerating neural differential equations by regularizing internal solver heuristics. In International Conference on Machine Learning, pp. 8325-8335. PMLR, 2021.",
|
| 1847 |
+
"Pal, A., Edelman, A., and Rackauckas, C. Mixing implicit and explicit deep learning with skip deqs and infinite time neural odes (continuous deqs). arXiv preprint arXiv:2201.12240, 2022.",
|
| 1848 |
+
"Piche, R. An 1-stable rosenbrock method for step-by-step time integration in structural dynamics. Computer Methods in Applied Mechanics and Engineering, 126(3-4): 343-354, 1995.",
|
| 1849 |
+
"Poli, M., Massaroli, S., Yamashita, A., Asama, H., and Park, J. Hypersolvers: Toward fast continuous-depth models. arXiv preprint arXiv:2007.09601, 2020.",
|
| 1850 |
+
"Rackauckas, C. Engineering trade-offs in automatic differentiation: From tensorflow and pytorch to jax and julia, Jan 2022. URL https://tinyurl.com/2j94bhc9.",
|
| 1851 |
+
"Rackauckas, C. and Nie, Q. Adaptive methods for stochastic differential equations via natural embeddings and rejection sampling with memory. Discrete and continuous dynamical systems. Series B, 22(7):2731, 2017."
|
| 1852 |
+
],
|
| 1853 |
+
"bbox": [
|
| 1854 |
+
500,
|
| 1855 |
+
85,
|
| 1856 |
+
885,
|
| 1857 |
+
904
|
| 1858 |
+
],
|
| 1859 |
+
"page_idx": 9
|
| 1860 |
+
},
|
| 1861 |
+
{
|
| 1862 |
+
"type": "header",
|
| 1863 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 1864 |
+
"bbox": [
|
| 1865 |
+
325,
|
| 1866 |
+
56,
|
| 1867 |
+
647,
|
| 1868 |
+
71
|
| 1869 |
+
],
|
| 1870 |
+
"page_idx": 9
|
| 1871 |
+
},
|
| 1872 |
+
{
|
| 1873 |
+
"type": "page_number",
|
| 1874 |
+
"text": "10",
|
| 1875 |
+
"bbox": [
|
| 1876 |
+
477,
|
| 1877 |
+
922,
|
| 1878 |
+
495,
|
| 1879 |
+
934
|
| 1880 |
+
],
|
| 1881 |
+
"page_idx": 9
|
| 1882 |
+
},
|
| 1883 |
+
{
|
| 1884 |
+
"type": "list",
|
| 1885 |
+
"sub_type": "ref_text",
|
| 1886 |
+
"list_items": [
|
| 1887 |
+
"Rackauckas, C. and Nie, Q. Stability-optimized high order methods and stiffness detection for pathwise stiff stochastic differential equations. In 2020 IEEE High Performance Extreme Computing Conference (HPEC), pp. 1-8. IEEE, 2020.",
|
| 1888 |
+
"Rackauckas, C., Innes, M., Ma, Y., Bettencourt, J., White, L., and Dixit, V. Diffeqflux.jl - A julia library for neural differential equations. CoRR, abs/1902.02376, 2019. URL http://arxiv.org/abs/1902.02376.",
|
| 1889 |
+
"Rackauckas, C., Ma, Y., Martensen, J., Warner, C., Zubov, K., Supekar, R., Skinner, D., Ramadhan, A., and Edelman, A. Universal differential equations for scientific machine learning, 2020.",
|
| 1890 |
+
"Robertson, H. The solution of a set of reaction rate equations. Numerical analysis: an introduction, 178182, 1966.",
|
| 1891 |
+
"Rubanova, Y., Chen, R. T., and Duvenaud, D. Latent odes for irregularly-sampled time series. arXiv preprint arXiv:1907.03907, 2019.",
|
| 1892 |
+
"Runge, C. Über die numerische auflösung von differentialgleichungen. Mathematische Annalen, 46(2):167-178, 1895.",
|
| 1893 |
+
"Tsitouras, C. Runge-kutta pairs of order 5(4) satisfying only the first column simplifying assumption. Computers Mathematics with Applications, 62(2):770 - 775, 2011. ISSN 0898-1221. doi: https://doi.org/10.1016/j.camwa.2011.06.002. URL http://www.sciencedirect.com/science/article/pii/S0898122111004706.",
|
| 1894 |
+
"Wanner, G. and Hairer, E. Solving ordinary differential equations II. Springer Berlin Heidelberg, 1996.",
|
| 1895 |
+
"Xia, H., Suliafu, V., Ji, H., Nguyen, T., Bertozzi, A., Osher, S., and Wang, B. Heavy ball neural ordinary differential equations. Advances in Neural Information Processing Systems, 34, 2021.",
|
| 1896 |
+
"Yu, F. and Koltun, V. Multi-scale context aggregation by dilated convolutions. arXiv preprint arXiv:1511.07122, 2015.",
|
| 1897 |
+
"Zhang, H. and Sandu, A. Fatode: a library for forward, adjoint, and tangent linear integration of odes. SIAM Journal on Scientific Computing, 36(5):C504-C523, 2014."
|
| 1898 |
+
],
|
| 1899 |
+
"bbox": [
|
| 1900 |
+
86,
|
| 1901 |
+
84,
|
| 1902 |
+
478,
|
| 1903 |
+
789
|
| 1904 |
+
],
|
| 1905 |
+
"page_idx": 10
|
| 1906 |
+
},
|
| 1907 |
+
{
|
| 1908 |
+
"type": "header",
|
| 1909 |
+
"text": "Locally Regularized Neural Differential Equations",
|
| 1910 |
+
"bbox": [
|
| 1911 |
+
325,
|
| 1912 |
+
56,
|
| 1913 |
+
647,
|
| 1914 |
+
71
|
| 1915 |
+
],
|
| 1916 |
+
"page_idx": 10
|
| 1917 |
+
},
|
| 1918 |
+
{
|
| 1919 |
+
"type": "page_number",
|
| 1920 |
+
"text": "11",
|
| 1921 |
+
"bbox": [
|
| 1922 |
+
477,
|
| 1923 |
+
922,
|
| 1924 |
+
495,
|
| 1925 |
+
934
|
| 1926 |
+
],
|
| 1927 |
+
"page_idx": 10
|
| 1928 |
+
}
|
| 1929 |
+
]
|
2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/9e0d9a67-2038-4371-8bb5-ee98ea285471_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/9e0d9a67-2038-4371-8bb5-ee98ea285471_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f7106c34952d6705773a5a33bd3d9b983525dfa522a20badeb2cc9b15d4f629
|
| 3 |
+
size 473233
|
2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/full.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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12}$ Alan Edelman $^{13}$ Christopher Rackauckas
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Implicit layer deep learning techniques, like Neural Differential Equations, have become an important modeling framework due to their ability to adapt to new problems automatically. Training a neural differential equation is effectively a search over a space of plausible dynamical systems. However, controlling the computational cost for these models is difficult since it relies on the number of steps the adaptive solver takes. Most prior works have used higher-order methods to reduce prediction timings while greatly increasing training time or reducing both training and prediction timings by relying on specific training algorithms, which are harder to use as a drop-in replacement due to strict requirements on automatic differentiation. In this manuscript, we use internal cost heuristics of adaptive differential equation solvers at stochastic time-points to guide the training towards learning a dynamical system that is easier to integrate. We "close the black-box" and allow the use of our method with any adjoint technique for gradient calculations of the differential equation solution. We perform experimental studies to compare our method to global regularization to show that we attain similar performance numbers without compromising on the flexibility of implementation on ordinary differential equations (ODEs) and stochastic differential equations (SDEs). We develop two sampling strategies to trade-off between performance and training time. Our method reduces the number of function evaluations to $0.556 \times -0.733 \times$ and accelerates predictions by $1.3 \times -2 \times$ .
|
| 8 |
+
|
| 9 |
+
<sup>1</sup>CSAIL MIT <sup>2</sup>Department of Electrical Engineering and Computer Science MIT <sup>3</sup>Department of Mathematics MIT. Correspondence to: Avik Pal <sup>4</sup}@mit.edu>.
|
| 10 |
+
|
| 11 |
+
Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).
|
| 12 |
+
|
| 13 |
+
# 1. Introduction
|
| 14 |
+
|
| 15 |
+
Implicit Models, such as Neural Ordinary Differential Equations (Chen et al., 2018) and Deep Equilibrium Models (Bai et al., 2019; Pal et al., 2022), have emerged as a promising technique to determine the depth of neural networks automatically. To maximize performance on a dataset, explicit models are tuned to the "hardest" training sample, which hurts the inference timings for "easier" – more abundant – samples. Using adaptive differential equation solvers allow these implicit models to choose the number of steps they need effectively. This idea of representing neural networks as ODEs has since been generalized to Stochastic Differential Equations (Liu et al., 2019; Rackauckas et al., 2020) and other architectures to improve robustness.
|
| 16 |
+
|
| 17 |
+
Despite the rapid progress in these methods, the core problem of the scalability of these models is still persistent. Several solutions to these have been proposed:
|
| 18 |
+
|
| 19 |
+
- Kelly et al. (2020); Finlay et al. (2020) use higher order derivatives for regularization.
|
| 20 |
+
- Poli et al. (2020) learn neural solvers to solve Neural ODEs faster.
|
| 21 |
+
- Pal et al. (2021) proposed a "zero-cost" global regularization scheme.
|
| 22 |
+
- Behl et al. (2020) randomize the integration stop time to "smoothen" the dynamics.
|
| 23 |
+
|
| 24 |
+
All these methods have definite tradeoffs (See Section 5 for more details).
|
| 25 |
+
|
| 26 |
+
This paper presents a generally applicable method to force the neural differential equation training process to choose the least expensive option. We build upon the global regularization scheme proposed in Pal et al. (2021) and "close" the blackbox allowing our method to work across various sensitivity algorithms. Our main contributions include the following<sup>1</sup>:
|
| 27 |
+
|
| 28 |
+
<table><tr><td>Sensitivity Algorithm</td><td>Memory Requirement</td><td>Memory Requirement with Local Regularization</td></tr><tr><td>Backsolve Adjoint (Chen et al., 2018)</td><td>O(s)</td><td>O(s × (1 + stages))</td></tr><tr><td>Backsolve Adjoint with Checkpointing (Chen et al., 2018)</td><td>O(s × c)</td><td>O(s × (c + stages))</td></tr><tr><td>Interpolating Adjoint (Hindmarsh et al., 2005)</td><td>O(s × t)</td><td>O(s × (t + stages))</td></tr><tr><td>Interpolating Adjoint with Checkpointing (Hindmarsh et al., 2005)</td><td>O(s × c)</td><td>O(s × (c + ×stages))</td></tr><tr><td>Quadrature Adjoint (Kim et al., 2021)</td><td>O((s + p) × t)</td><td>O((s + p) × t + s × stages)</td></tr><tr><td>Direct Reverse Mode Differentiation</td><td>O(s × t × stages)</td><td>O(s × (t + 1) × stages)</td></tr></table>
|
| 29 |
+
|
| 30 |
+
Table 1: Memory Requirements for various Sensitivity Algorithms for ODEs with Local Regularization: Local Regularization requires $\mathcal{O}\left(s\times (c + \text{stages})\right)$ memory in the best case, while Global Regularization (Pal et al., 2021) always requires $\mathcal{O}\left(s\times t\times \text{stages}\right)$ memory.
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 1: Locally Regularized NDE leads to faster predictions and faster training compared to vanilla NDE.
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
|
| 39 |
+
1. We show that our local regularization method – building upon the primitives proposed in Pal et al. (2021) – performs at par with global regularization (See Section 4).
|
| 40 |
+
2. We present two sampling methods that trade-off small computational costs for consistently better performance (See Section 3).
|
| 41 |
+
3. Using local regularization allows our models to leverage optimize-then-discretize in the backward pass (in addition to discretize-then-optimize methods). Our method works around the several engineering limitations of automatic differentiation (AD) systems (Rackauckas, 2022) that are needed to make global regularization work.
|
| 42 |
+
4. We empirically show that regularizing solver heuristics with biased sampling stabilizes the training of larger neural ODEs (See Section 4.3).
|
| 43 |
+
|
| 44 |
+
# 2. Background
|
| 45 |
+
|
| 46 |
+
# 2.1. Neural Ordinary Differential Equations
|
| 47 |
+
|
| 48 |
+
Neural ODEs use an explicit neural network to parameterize the dynamical system. These involve finding the state at a
|
| 49 |
+
|
| 50 |
+
later time $t_1$ , given the value $z_0$ at time $t_0$ . The final state:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
z \left(t _ {1}\right) = z _ {0} + \int_ {t _ {0}} ^ {t _ {1}} f _ {\theta} (z (t), t) d t
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
generally cannot be computed analytically and requires numerical solvers. Prior works had observed the similarity between fixed time-step discretization of ODEs and Residual Neural Networks Lu et al. (2018), which was later extended in the Neural ODE framework by Chen et al. (2018).
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\frac {d z (t)}{d t} = f _ {\theta} (z (t), t)
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
Using adaptive time stepping allows the model to operate at a variable continuous depth depending on the inputs. Removal of the fixed depth constraint of Residual Networks provides a more expressive framework and offers several advantages in problems like density estimation (Grathwohl et al., 2018), irregularly spaced time series problems (Rubanova et al., 2019), etc.
|
| 63 |
+
|
| 64 |
+
# 2.2. Neural Stochastic Differential Equations
|
| 65 |
+
|
| 66 |
+
Stochastic Differential Equations (SDEs) couple the effect of noise to a deterministic system of equations. SDE noise can have different variations; however, we exclusively focus on diagonal multiplicative noise for this paper. Liu et al. (2019) modified Neural ODEs by stochastic noise injection
|
| 67 |
+
|
| 68 |
+
in the form of Neural SDEs. Liu et al. (2019) empirically showed that stochastic noise injection improves the robustness and generalization performance of neural ODEs. In Neural SDEs, we simultaneously train two explicit neural networks - drift $f_{\theta}(z(t),t)$ and diffusion $g_{\phi}(z(t),t)$ s.t.:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
d z (t) = f _ {\theta} (z (t), t) d t + g _ {\phi} (z (t), t)) d W
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
# 2.3. Adaptive Time Stepping for Differential Equations
|
| 75 |
+
|
| 76 |
+
Runge-Kutta (RK) Methods (Runge, 1895; Kutta, 1901) are widely used to approximate the solutions of ordinary differential equations numerically. Given a tableau of coefficients $\{A, c, b\}$ , these methods combine $s$ stages to obtain the estimate at $t + dt$ .
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
k _ {s} = f \left(t + c _ {s} \cdot d t, z (t) + \sum_ {i = 1} ^ {s - 1} a _ {s i} \cdot k _ {i}\right)
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
z (t + d t) = z (t) + d t \cdot \left(\sum_ {i = 1} ^ {s} b _ {i} \cdot k _ {i}\right)
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
Adaptive solvers need to maximize the step size $(dt)$ while keeping the error estimate below the user-specified tolerances, i.e., they need to satisfy:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\mathrm {E} _ {\text {E s t}} \leq \operatorname {a t o l} + \max (| z (t) |, | z (t + d t) |) \cdot \operatorname {r t o l}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $\mathsf{E}_{\mathrm{Est}}$ is the local error estimate. Adaptive solvers utilize an additional linear combiner $\tilde{b}_i$ to get an alternate solution, typically with one order less convergence (Wanner & Hairer, 1996; Fehlberg, 1968; Dormand & Prince, 1980; Tsitouras, 2011).
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\tilde {z} (t + d t) = z (t) + d t \cdot \left(\sum_ {i = 1} ^ {s} \tilde {b} _ {i} \cdot k _ {i}\right)
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
A classic result from Richardson extrapolation shows that $\mathbb{E}_{\mathrm{Est}} = \| \tilde{z}(t + dt) - z(t + dt)\|$ is an estimate of the local truncation error (Hairer et al., 1993; Ascher & Petzold, 1998). The new step size is determined using the following:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
q = \left\| \frac {\mathsf {E} _ {\mathrm {E s t}}}{\mathrm {a t o l} + \operatorname * {m a x} \left(| z (t) | , | z (t + d t) |\right) \cdot \mathrm {r t o l}} \right\|
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
- If $q < 1$ , $dt$ is accepted.
|
| 105 |
+
- Otherwise, it is rejected and reduced. A standard PI controller proposes the new step size to be:
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
d t _ {n e w} = \eta \cdot q _ {n - 1} ^ {\alpha} \cdot q _ {n} ^ {\beta} \cdot d t
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
where $\eta$ is the safety factor, $q_{n - 1}$ is the error proportion of the previous step, and $(\alpha ,\beta)$ are tunable PI-gain hyperparameters (Wanner & Hairer, 1996).
|
| 112 |
+
|
| 113 |
+
We defer the discussion of error estimation schemes for stochastic RK integrators to Rackauckas & Nie (2017; 2020).
|
| 114 |
+
|
| 115 |
+
# 2.4. Global Regularization using Local Error Estimates
|
| 116 |
+
|
| 117 |
+
In Section 2.3, we observe how larger local error estimates $\mathsf{E}_{\mathrm{Est}}$ contribute to reduced step sizes and, in turn, higher training and prediction times for Neural Differential Equations. Pal et al. (2021) proposed a regularization scheme to minimize the "total local error in order to learn Neural ODEs with as large step sizes as possible." They compute the regularization term $(\mathcal{R}_E)_g$ as:
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\left(\mathcal {R} _ {E}\right) _ {g} = \sum_ {j} \left(\mathrm {E} _ {\mathrm {E s t}}\right) _ {j} \cdot | d t _ {j} |
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
where the summation is over the $j$ time steps of the solution. All the local error estimates $\mathbb{E}_{\mathrm{Est}}$ are precomputed by adaptive differential equation solvers, which makes the forward pass effectively have zero additional overhead.
|
| 124 |
+
|
| 125 |
+
Continuous adjoint methods (Chen et al., 2018) define the derivatives in terms of the ODE quantities. The terms $(\mathbb{E}_{\mathrm{Est}})_j = \sum_{i=1}^s (b_i - \tilde{b}_i) \cdot k_i$ cannot be constructed directly from the trajectory of the ODE solution, since $k_i$ terms are defined by the solver method (and not by the continuous ODE solution). As a result Pal et al. (2021) performs discrete sensitivity analysis to compute the derivatives w.r.t. the regularization terms.
|
| 126 |
+
|
| 127 |
+
Discrete Sensitivity analysis is more stable than continuous adjoints (Zhang & Sandu, 2014) and stabilizes the training process of Neural ODEs (Onken & Ruthotto, 2020). However, these methods are more memory intensive than continuous adjoints. Another shortcoming is the advanced tooling mechanism needed to differentiate through differential equation solvers (Rackauckas, 2022), making this method hard to adopt. Since adaptive ODE solvers change the number of steps based on the values in the differential equation, discrete sensitivity analysis requires dynamic AD tooling which is generally less optimized than those built for static graph cases. We note that there are checkpointing methods to reduce the memory overhead (Dauvergne & Hascoet, 2006), though these generally have focused on static graph AD systems.
|
| 128 |
+
|
| 129 |
+
# 2.5. Multiscale Neural ODE with Input Injection
|
| 130 |
+
|
| 131 |
+
Multiscale modeling (Burt & Adelson, 1987) has been the central theme for several deep computer vision applications (Farabet et al., 2012; Yu & Koltun, 2015; Chen et al., 2016; 2017). Standard Neural ODEs set the initial condition as input $x$ from the previous layer. Multiscale Neural ODE with Input Injection is based on the Multiscale Deep Equilibrium Models (DEQs) (Bai et al., 2019; 2020; Pal et al., 2022). If our model operates at $n$ scales, the initial condition $\{(z_0)_i\}_{i \in [n-1]}$ is defined as $(z_0)_0 = x$ and $(z_0)_{i \in \{1, \dots, n-1\}} = 0$ . Every feature set is upsampled or downsampled and fed into the other scales using a neural network. In line with Multiscale DEQs, we also repeatedly
|
| 132 |
+
|
| 133 |
+
Algorithm 1 Unbiased Sampling: Training Phase
|
| 134 |
+
Data: x, $f_{\theta},t_{span}$
|
| 135 |
+
Result: sol, r
|
| 136 |
+
Define $\frac{du}{dt} = f_{\theta}(u,t)$ $t_0,t_1\gets t_{span}$ $\mathsf{t}_{\mathrm{reg}}\sim \mathbb{U}[t_0,t_1]$
|
| 137 |
+
sol $\leftarrow$ solve(du/dt, DE Solver, $t_{span}$ )
|
| 138 |
+
$u_{\mathrm{t_{reg}}}\gets \mathrm{sol}(t_{\mathrm{reg}})$
|
| 139 |
+
Run single step for the solver with time-span $(t_{reg},t_1)$
|
| 140 |
+
r $\leftarrow$ Local Error Estimate $@t = t_{reg}$
|
| 141 |
+
|
| 142 |
+
inject the original input $x$ at every step of the dynamical system.
|
| 143 |
+
|
| 144 |
+
# 3. Methods
|
| 145 |
+
|
| 146 |
+
In Section 2.4, we discussed the downsides of using global regularization with local error estimates. To summarize:
|
| 147 |
+
|
| 148 |
+
1. Global Regularization relies on discrete sensitivity analysis, which is more memory intensive.
|
| 149 |
+
2. Global Regularization depends on AD tooling to support dynamic compute graphs in an efficient way, making it hard to incorporate into existing codebases.
|
| 150 |
+
|
| 151 |
+
To get around these limitations, we developed a new technique using local sampling of error estimates at specific time points, rather than globally over the full interval. We deal with sampling the "appropriate" time point for regularization by two strategies:
|
| 152 |
+
|
| 153 |
+
- Algorithm 1 Unbiased Sampling: We random uniformly sample the time-point in the integration time span. Intuitively, since we will perform the training for "a large number of steps," the learned dynamical system would end up being faster to solve "everywhere" over the time span.
|
| 154 |
+
- Algorithm 2 Biased Sampling: Adaptive Time-Stepping Differential Equation Solvers naturally take more steps around the area, which is harder to integrate. We can bias the regularization to operate around parts of the dynamical system which are "harder" by sampling a time-point from the solution time points.
|
| 155 |
+
|
| 156 |
+
# 3.1. Unbiased Sampling
|
| 157 |
+
|
| 158 |
+
When training a Neural ODE, the integration timespan is fixed. Training any deep learning model involves several thousand steps. We compute the total local error estimate over the entire timespan when performing global regularization. For unbiased sampling, we hypothesize that if we regu
|
| 159 |
+
|
| 160 |
+
Algorithm 2 Biased Sampling: Training Phase
|
| 161 |
+
Data: x, $f_{\theta},t_{span}$
|
| 162 |
+
Result: sol, r
|
| 163 |
+
Define $\frac{du}{dt} = f_{\theta}(u,t)$ $t_0,t_1\gets t_{span}$
|
| 164 |
+
sol $\leftarrow$ solve $(\frac{du}{dt}$ DE Solver, $t_{span}$ $\mathsf{t}_{\mathrm{reg}}\sim \mathbb{U}(\mathsf{sol}.t)$ $u_{\mathrm{treg}}\gets \mathrm{sol}(\mathrm{t}_{\mathrm{reg}})$
|
| 165 |
+
Run single step for the solver with time-span $(t_{reg},t_1)$
|
| 166 |
+
r $\leftarrow$ Local Error Estimate $@t = t_{reg}$
|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
Figure 2: Robertson Stiff ODE System: Solving stiff systems like Robertson (Robertson, 1966) (using Rodas5 (Piche, 1995)) involves spending around $75\%$ of the time in $t < 5000$ (i.e. $5\%$ of the timespan). The vertical lines denote the timepoints at which the ODE System was solved.
|
| 170 |
+
|
| 171 |
+
larize at random uniformly sampled time points in the timespan, the learned dynamical system will demonstrate similar properties in terms of NFE compared to global regularization. Our new regularization term becomes $(\mathcal{R}_E)_{\mathrm{unbiased}}$ as:
|
| 172 |
+
|
| 173 |
+
$$
|
| 174 |
+
\left(\mathcal {R} _ {E}\right) _ {\mathrm {u n b i a s e d}} = \left(\mathrm {E} _ {\mathrm {E s t}}\right) _ {\mathrm {t} _ {\mathrm {r e g}}} \cdot \left| d t _ {\mathrm {t} _ {\mathrm {r e g}}} \right| \quad \mathrm {t} _ {\mathrm {r e g}} \sim \mathbb {U} [ \mathrm {t} \mathrm {s p a n} ]
|
| 175 |
+
$$
|
| 176 |
+
|
| 177 |
+
# 3.2. Biased Sampling
|
| 178 |
+
|
| 179 |
+
Consider a simple scenario where the learned dynamics of the DE is harder to solve in $[0.25, 0.35]$ , and we are solving the DE from $t_0 = 0$ to $t_1 = 1$ . Our primary aim is to modify the learned system s.t. it becomes simpler to solve in $[0.25, 0.35]$ . If we use unbiased sampling, the probability that we regularize at $\mathsf{t}_{\mathrm{reg}} \in [0.25, 0.35]$ is 0.1 (which is low). The problem gets even more severe if the range is lowered. An extreme version of this problem is observed for stiff systems like Robertson's Equations (See Figure 2) where $75\%$ of the time is spent in solving $5\%$ of the problem. We note that these extreme scenarios rarely occur for traditional deep learning tasks since Pal et al. (2021) observed
|
| 180 |
+
|
| 181 |
+
minor speedups using stiffness regularization. However, the problem that some parts of the dynamical system are harder to integrate persists, and designing a regularization scheme targeting those parts is highly desirable.
|
| 182 |
+
|
| 183 |
+
We considered a simple scenario where the learned dynamical system was fixed. However, while training NDEs, this system evolves with training, and apriori predicting the more difficult portions to integrate is not feasible. Adaptive solvers take more frequent steps in the parts of the DE where it is harder to integrate. Anantharaman et al. (2020) leveraged this property of adaptive solvers to learn surrogates for stiff systems. Since these solvers adapt to concentrate around the most numerically difficult time points, we automatically obtain the time points where we want to regularize the model. Hence, for our biased sampling regularize, we uniformly sample the regularization timepoint $t_{\text{reg}}$ from the time points at which the solver solved the differential equation.
|
| 184 |
+
|
| 185 |
+
# 4. Experiments
|
| 186 |
+
|
| 187 |
+
In this section, we compare the effectiveness of unbiased and biased local regularization's effectiveness on the training and prediction timings of NDEs. We choose image classification and time series prediction problems in line with prior works on accelerating NDEs. We consider the following baselines:
|
| 188 |
+
|
| 189 |
+
1. Vanilla Neural ODE with Continuous Interpolating Adjoint.
|
| 190 |
+
2. Vanilla Neural SDE with discrete sensitivities.
|
| 191 |
+
3. Global Regularization of Neural Differential Equations using discrete sensitivity analysis (Pal et al., 2021).
|
| 192 |
+
4. TayNODE (Kelly et al., 2020) and STEER (Behl et al., 2020) for models reported in Pal et al. (2021).
|
| 193 |
+
|
| 194 |
+
We use the DifferentialEquations.jl (Rackauckas et al., 2019) and Lux.jl (Pal, 2022) software stack written in the Julia Programming Language (Bezanson et al., 2017) for all our experiments.
|
| 195 |
+
|
| 196 |
+
Some details about the data presented in the tables:
|
| 197 |
+
|
| 198 |
+
- All experimental results in the tables marked with $\mathbb{F}$ were taken directly from Pal et al. (2021).
|
| 199 |
+
- We have tried to match the hardware details presented in the paper and the corresponding GitHub repository for Pal et al. (2021), but we note that differences in wall clock timings can be partially attributed to hardware.
|
| 200 |
+
- TayNODE (Kelly et al., 2020) uses a different ODE integrator. Hence the NFEs are not directly comparable.
|
| 201 |
+
|
| 202 |
+

|
| 203 |
+
|
| 204 |
+

|
| 205 |
+
Figure 3: MNIST Classification using Neural ODE
|
| 206 |
+
|
| 207 |
+
# 4.1. MNIST Image Classification
|
| 208 |
+
|
| 209 |
+
We train a neural differential equation classifier to map flattened MNIST (LeCun et al., 1998) images to their corresponding labels.
|
| 210 |
+
|
| 211 |
+
# 4.1.1. NEURAL ORDINARY DIFFERENTIAL EQUATION
|
| 212 |
+
|
| 213 |
+
Training Details: We use the same model architecture as described in Kelly et al. (2020). Our model comprises of single hidden layered explicit model $f_{\theta}$ modeling the ODE dynamics followed by a linear classifier $g_{\phi}$ . The hidden layer is 100-dimensional. We train with a batch size of 512 for a total of 7500 steps. We use Adam (Kingma & Ba, 2014) with a constant learning rate of 0.001. For error estimate regularization, we exponentially decrease the regularization coefficient from 2.5 to 1.0. We use Tsim5 (Tsitouras, 2011) as the ODE integrator with an absolute and relative tolerance of $10^{-8.2}$ .
|
| 214 |
+
|
| 215 |
+
Baselines: We consider a Vanilla Neural ODE trained with the exact aforementioned specifications. All other baselines are directly taken from Pal et al. (2021).
|
| 216 |
+
|
| 217 |
+
Results: We summarize the results in Table 2 and Figure 3. Using local regularization speeds up prediction in all cases while it leads to a minor slowdown during training for biased sampling.
|
| 218 |
+
|
| 219 |
+
We note that this is not a realistic tolerance at which image classification models are trained. We use this tolerance to allow a direct comparison to prior works.
|
| 220 |
+
|
| 221 |
+
<table><tr><td>Method</td><td>Train Accuracy (%)</td><td>Test Accuracy (%)</td><td>Training Time (hr)</td><td>Prediction Time (s / batch)</td><td>Testing NFE</td></tr><tr><td>Vanilla NODE</td><td>99.898 ± 0.066</td><td>97.612 ± 0.163</td><td>0.54 ± 0.001</td><td>0.088 ± 0.020</td><td>303.559 ± 3.194</td></tr><tr><td>STEER¶</td><td>100.00 ± 0.000</td><td>97.94 ± 0.03</td><td>1.31 ± 0.07</td><td>0.092 ± 0.002</td><td>265.0 ± 3.46</td></tr><tr><td>TayNODE¶</td><td>98.98 ± 0.06</td><td>97.89 ± 0.00</td><td>1.19 ± 0.07</td><td>0.079 ± 0.007</td><td>80.3 ± 0.43</td></tr><tr><td>ERNODE¶</td><td>99.71 ± 0.28</td><td>97.32 ± 0.06</td><td>0.82 ± 0.02</td><td>0.060 ± 0.001</td><td>177.0 ± 0.00</td></tr><tr><td>SRNODE¶</td><td>100.00 ± 0.000</td><td>98.08 ± 0.15</td><td>1.24 ± 0.06</td><td>0.094 ± 0.003</td><td>259.0 ± 3.46</td></tr><tr><td>Local Unbiased ERNODE</td><td>99.447 ± 0.039</td><td>97.526 ± 0.131</td><td>0.49 ± 0.002</td><td>0.046 ± 0.002</td><td>187.961 ± 1.812</td></tr><tr><td>Local Biased ERNODE</td><td>99.477 ± 0.051</td><td>97.488 ± 0.016</td><td>1.12 ± 0.065</td><td>0.044 ± 0.002</td><td>182.849 ± 1.578</td></tr><tr><td>Vanilla NSDE</td><td>98.27 ± 0.11</td><td>96.66 ± 0.16</td><td>2.70 ± 0.00</td><td>0.51 ± 0.07</td><td>313.86 ± 2.94</td></tr><tr><td>ERNSDE¶</td><td>98.16 ± 0.11</td><td>96.27 ± 0.35</td><td>4.19 ± 0.04</td><td>7.23 ± 0.14</td><td>184.67 ± 2.31</td></tr><tr><td>SRNSDE¶</td><td>98.79 ± 0.12</td><td>96.80 ± 0.07</td><td>8.54 ± 0.37</td><td>14.50 ± 0.40</td><td>382.00 ± 4.00</td></tr><tr><td>Local Unbiased ERNSDE</td><td>98.05 ± 0.09</td><td>96.57 ± 0.13</td><td>2.10 ± 0.01</td><td>0.39 ± 0.10</td><td>228.93 ± 1.77</td></tr><tr><td>Local Biased ERNSDE</td><td>98.02 ± 0.07</td><td>96.44 ± 0.16</td><td>1.90 ± 0.00</td><td>0.36 ± 0.03</td><td>230.10 ± 0.71</td></tr></table>
|
| 222 |
+
|
| 223 |
+
Table 2: MNIST Image Classification using Neural DE: Using local unbiased regularization on neural ODE speeds up training by $1.1 \times$ and predictions by $1.9 \times$ while reducing the total NFEs to $0.619 \times$ . Local Biased Regularization tends to slow down training for smaller models on GPU while it further reduces the NFEs by $0.602 \times$ . For Neural SDE, we observe a similar reduction of NFEs by $0.729 \times -0.733 \times$ and a training time improvement of $1.28 \times -1.42 \times$ . The best global regularization method gets lower NFEs but overall takes more wall clock than the best performing local regularization method.
|
| 224 |
+
|
| 225 |
+
<table><tr><td>Method</td><td>Test Loss (×10-3)</td><td>Training Time (hr)</td><td>Prediction Time (s / batch)</td><td>Testing NFE</td></tr><tr><td>Vanilla NODE</td><td>3.41 ± 0.10</td><td>2.48 ± 0.22</td><td>0.16 ± 0.01</td><td>758.0 ± 25.87</td></tr><tr><td>STEER¶</td><td>3.48 ± 0.01</td><td>1.62 ± 0.26</td><td>0.54 ± 0.06</td><td>699.0 ± 141.1</td></tr><tr><td>TayNODE¶</td><td>4.21 ± 0.01</td><td>12.3 ± 0.32</td><td>0.22 ± 0.02</td><td>167.3 ± 11.93</td></tr><tr><td>ERNODE¶</td><td>3.57 ± 0.00</td><td>0.94 ± 0.13</td><td>0.21 ± 0.02</td><td>287.0 ± 17.32</td></tr><tr><td>SRNODE¶</td><td>3.58 ± 0.05</td><td>0.87 ± 0.09</td><td>0.20 ± 0.01</td><td>273.0 ± 0.000</td></tr><tr><td>Local Unbiased ERNODE</td><td>3.64 ± 0.07</td><td>2.31 ± 0.02</td><td>0.09 ± 0.00</td><td>422.0 ± 4.580</td></tr><tr><td>Local Biased ERNODE</td><td>3.63 ± 0.08</td><td>2.12 ± 0.24</td><td>0.10 ± 0.01</td><td>463.0 ± 63.02</td></tr></table>
|
| 226 |
+
|
| 227 |
+
Table 3: Physionet Time Series Interpolation: Local Regularization reduces NFEs by $0.556 \times -0.610 \times$ reducing the prediction timings by $1.6 \times -1.78 \times$ . Our methods additionally improve training timings by $1.073 \times -1.167 \times$ . We note that the difference in training time compared to (E/S)RNODE methods is due to change in the sensitivity algorithm.
|
| 228 |
+
|
| 229 |
+
# 4.1.2. NEURAL STOCHASTIC DIFFERENTIAL EQUATION
|
| 230 |
+
|
| 231 |
+
Training Details: We downsample the flattened images to a 32-dimensional vector before feeding it into the Neural SDE which uses a diffusion model $(f_{\theta})$ having a 64-dimensional hidden layer and a linear drift model $(g_{\phi})$ . Finally, a linear classifier $(h_{\gamma})$ predicts the label. We train our models on CPU with a batch size of 512 for a total of 4000 steps. We optimize the weights using Adam (Kingma & Ba, 2014) with a constant learning rate of 0.01. We use SOSRI2 SDE solver (Rackauckas & Nie, 2017) with a tolerance of 0.14. We fix our regularization coefficient to be $10^{3}$ . For this experiment, we rely on discrete sensitivity analysis.
|
| 232 |
+
|
| 233 |
+
Baselines: ERNSDE and SRNSDE results were taken from Pal et al. (2021). These were trained for 40 epochs, nearly equivalent to training for 4000 iterations.
|
| 234 |
+
|
| 235 |
+
Results: We summarize the results in Table 2 and Figure 4.
|
| 236 |
+
|
| 237 |
+
Local regularization improves training and prediction performance while keeping the test accuracy nearly constant.
|
| 238 |
+
|
| 239 |
+
# 4.2. Physionet Time Series Interpolation
|
| 240 |
+
|
| 241 |
+
Training Details: We use the experimental setup for Physionet 2012 Challenge Dataset (Citi & Barbieri, 2012) from Kelly et al. (2020). We use a Latent Neural ODE (Rubanova et al., 2019) to perform time series interpolation on the dataset. We use the preprocessed dataset from Kelly et al. (2020) to ensure a fair comparison and independent runs are performed using an 80:20 split of the dataset.
|
| 242 |
+
|
| 243 |
+
For specific model architecture details, we refer the readers to Pal et al. (2021). We train the model for a total of 3000 iterations using Adamax (Kingma & Ba, 2014) with a learning rate of 0.01 with $10^{-5}$ inverse decay per step. We use a batch size of 512. We diverge from Pal et al. (2021), in using
|
| 244 |
+
|
| 245 |
+
<table><tr><td>Configuration</td><td>Method</td><td>Train Accuracy (%)</td><td>Test Accuracy (%)</td><td>Training Time (s / batch)</td><td>Prediction Time (s / batch)</td><td>Testing NFE</td></tr><tr><td rowspan="3">Standard</td><td>Vanilla</td><td>83.683 ± 1.450</td><td>67.394 ± 0.849</td><td>0.457 ± 0.018</td><td>0.130 ± 0.013</td><td>115.315 ± 12.136</td></tr><tr><td>Local Unbiased ER</td><td>83.665 ± 0.805</td><td>67.678 ± 0.874</td><td>0.399 ± 0.014</td><td>0.096 ± 0.007</td><td>89.048 ± 7.335</td></tr><tr><td>Local Biased ER</td><td>83.958 ± 1.032</td><td>67.745 ± 0.824</td><td>0.555 ± 0.008</td><td>0.088 ± 0.003</td><td>81.301 ± 1.255</td></tr><tr><td rowspan="3">Multi-Scale</td><td>Vanilla</td><td>92.807 ± 12.458</td><td>80.048 ± 6.740</td><td>0.572 ± 0.012</td><td>0.170 ± 0.005</td><td>27.616 ± 0.905</td></tr><tr><td>Local Unbiased ER</td><td>94.159 ± 9.694</td><td>80.432 ± 5.548</td><td>0.641 ± 0.025</td><td>0.175 ± 0.019</td><td>27.760 ± 0.177</td></tr><tr><td>Local Biased ER</td><td>99.987 ± 0.023</td><td>83.460 ± 0.727</td><td>0.774 ± 0.293</td><td>0.163 ± 0.015</td><td>26.334 ± 0.992</td></tr></table>
|
| 246 |
+
|
| 247 |
+
Table 4: CIFAR10 Image Classification using Neural DE: For the standard Neural ODE, local regularization reduces the NFE by $0.705 \times -0.772 \times$ , thereby improving prediction timings by $1.35 \times -1.477 \times$ . However, unregularized model training takes $0.823 \times$ the time for the biased model. For multi-scale models, the NFE and prediction time improvements are marginal and come at the cost of higher training time.
|
| 248 |
+
|
| 249 |
+

|
| 250 |
+
|
| 251 |
+

|
| 252 |
+
Figure 4: MNIST Classification using Neural SDE
|
| 253 |
+
|
| 254 |
+

|
| 255 |
+
|
| 256 |
+

|
| 257 |
+
Figure 5: Physionet Time Series Interpolation using Latent ODE
|
| 258 |
+
|
| 259 |
+
the regularization term as $\left(\mathrm{E}_{\mathrm{Est}}\right)_{t_{\mathrm{reg}}} \cdot \left|dt\right|_{t_{\mathrm{reg}}}$ instead of the squared regularization term $\sum_{j} \left(\mathrm{E}_{\mathrm{Est}}\right)_j^2$ . Additionally, we decay the regularization coefficient exponentially from 100 to 10 over the 3000 training iterations.
|
| 260 |
+
|
| 261 |
+
Baselines: Vanilla NODE was trained with the exact aforementioned configuration. All the other baselines were trained using discrete sensitivity analysis, and the exact details are present in Pal et al. (2021).
|
| 262 |
+
|
| 263 |
+
Results: We summarize the results in Figure 5 and Table 3.
|
| 264 |
+
|
| 265 |
+
# 4.3. CIFAR10 Image Classification
|
| 266 |
+
|
| 267 |
+
# 4.3.1. NEURAL ORDINARY DIFFERENTIAL EQUATION
|
| 268 |
+
|
| 269 |
+
Training Details: We use the CNN architecture for CIFAR10 as described in Poli et al. (2020). We train the models for 31250 steps with Adam (Kingma & Ba, 2014) using a cosine-annealing learning rate scheduler from 0.003 to 0.0001. We train the models with a batch size of 32 and keep the regularization coefficient fixed at 2.5. We use Tsit5 (Tsitouras, 2011) with a tolerance of $10^{-4}$ .
|
| 270 |
+
|
| 271 |
+
Results: We summarize the results in Figure 6 and Table 4.
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Figure 6: CIFAR10 Image Classification using Standard Neural ODE
|
| 275 |
+
|
| 276 |
+

|
| 277 |
+
|
| 278 |
+

|
| 279 |
+
|
| 280 |
+

|
| 281 |
+
Figure 7: CIFAR10 Image Classification using Multi-Scale Neural ODE
|
| 282 |
+
|
| 283 |
+

|
| 284 |
+
|
| 285 |
+

|
| 286 |
+
|
| 287 |
+
# 4.3.2. MULTISCALE NEURAL ODE
|
| 288 |
+
|
| 289 |
+
Training Details: We modify the Tiny Multiscale DEQ architecture for CIFAR10 from Bai et al. (2020) as Multiscale Neural ODE with Input Injection (See Section 2.5). To stabilize the training for larger models, we exponentially increase the regularization coefficient from 0.1 to 5.0. We train with a batch size of 128 using VCAB3 (Wanner & Hairer, 1996) with a tolerance of 0.05.
|
| 290 |
+
|
| 291 |
+
Results: We summarize the results in Figure 7 and Table 4. The benefits from regularization for NFEs and prediction timings seem marginal. However, regularization using biased sampling makes the training dynamics stable as observed in Figure 7.
|
| 292 |
+
|
| 293 |
+
# 5. Related Works
|
| 294 |
+
|
| 295 |
+
Neural Differential Equations (and by extension most Implicit Neural Networks) are mostly constrained by expensive training and prediction timings (Dupont et al., 2019; Kelly et al., 2020; Finlay et al., 2020; Behl et al., 2020; Pal et al., 2021). Traditionally accelerating these models have relied on using higher-order regularization terms to constrain the space of learnable dynamics (Finlay et al., 2020; Kelly et al., 2020). These models speed up predictions, but their benefits
|
| 296 |
+
|
| 297 |
+
are often overshadowed by a massive training slowdown (Pal et al., 2021).
|
| 298 |
+
|
| 299 |
+
More recently, quite a few first-order schemes have been proposed. Behl et al. (2020) randomized the endpoint of Neural ODEs to incentivize simpler dynamics. However, Pal et al. (2021) didn't find significant benefits of using STEER in their experiments. Pal et al. (2021) used internal solver heuristics – local error and stiffness estimates – to control the learned dynamics in a way that decreased both prediction and training time. We discuss their work in detail in Section 2.4. Xia et al. (2021) rewrite Neural ODEs as heavy ball ODEs to accelerate both forward and backward passes. Djeumou et al. (2022) replace ODE solvers in the forward with a Taylor-Lagrange expansion and report significantly better training and prediction times.
|
| 300 |
+
|
| 301 |
+
# 6. Discussion
|
| 302 |
+
|
| 303 |
+
In this manuscript, we have shown that we can obtain similar properties to global regularization by regularizing dynamical systems at randomly sampled time points. Additionally, this comes with the benefit of not being forced into a specific sensitivity analysis method. We have taken every experiment in Pal et al. (2021) and empirically showed that our local regularization works at par with global regularization.
|
| 304 |
+
|
| 305 |
+
However, our experiments using stiffness estimate for local regularization did not yield positive results and were not presented in this manuscript. Thus, we have demonstrated that we can "close the blackbox" and still leverage all the benefits of internal solver heuristics to improve training and predictions of neural differential equations.
|
| 306 |
+
|
| 307 |
+
# 6.1. Limitations
|
| 308 |
+
|
| 309 |
+
We note the following limitations of our work:
|
| 310 |
+
|
| 311 |
+
- Similar to Pal et al. (2021), if the objective is to learn the actual dynamical system, our method will not yield proper results. Our method is applicable only when the final state is relevant, i.e., in most classical deep learning tasks.
|
| 312 |
+
- Regularization introduces a new regularization coefficient hyperparameter which, if not tuned correctly, can lead to unstable dynamics or might negate the scheme's usefulness.
|
| 313 |
+
|
| 314 |
+
# 7. Acknowledgement
|
| 315 |
+
|
| 316 |
+
The authors acknowledge the MIT SuperCloud and Lincoln Laboratory Supercomputing Center for providing HPC resources that have contributed to the research results reported within this paper. This material is based upon work supported by the National Science Foundation under grant no. OAC-1835443, grant no. SII-2029670, grant no. ECCS-2029670, grant no. OAC-2103804, and grant no. PHY-2021825. We also gratefully acknowledge the U.S. Agency for International Development through Penn State for grant no. S002283-USAID. The information, data, or work presented herein was funded in part by the Advanced Research Projects Agency-Energy (ARPA-E), U.S. Department of Energy, under Award Number DE-AR0001211 and DE-AR0001222. We also gratefully acknowledge the U.S. Agency for International Development through Penn State for grant no. S002283-USAID. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof. This material was supported by The Research Council of Norway and Equinor ASA through Research Council project “308817 - Digital wells for optimal production and drainage”. Research was sponsored by the United States Air Force Research Laboratory and the United States Air Force Artificial Intelligence Accelerator and was accomplished under Cooperative Agreement Number FA8750-19-2-1000. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the United States Air Force or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding
|
| 317 |
+
|
| 318 |
+
any copyright notation herein.
|
| 319 |
+
|
| 320 |
+
# References
|
| 321 |
+
|
| 322 |
+
Anantharaman, R., Ma, Y., Gowda, S., Laughman, C., Shah, V., Edelman, A., and Rackauckas, C. Accelerating simulation of stiff nonlinear systems using continuous-time echo state networks. arXiv preprint arXiv:2010.04004, 2020.
|
| 323 |
+
Ascher, U. M. and Petzold, L. R. Computer methods for ordinary differential equations and differential-algebraic equations, volume 61. Siam, 1998.
|
| 324 |
+
Bai, S., Kolter, J. Z., and Koltun, V. Deep equilibrium models. arXiv preprint arXiv:1909.01377, 2019.
|
| 325 |
+
Bai, S., Koltun, V., and Kolter, J. Z. Multiscale Deep Equilibrium Models. arXiv:2006.08656 [cs, stat], November 2020. URL http://arxiv.org/abs/2006.08656.arXiv:2006.08656.
|
| 326 |
+
Behl, H., Ghosh, A., Dupont, E., Torr, P., and Namboodiri, V. Steer: simple temporal regularization for neural odes. pp. 1-13. Neural Information Processing Systems Foundation, Inc., 2020.
|
| 327 |
+
Bezanson, J., Edelman, A., Karpinski, S., and Shah, V. B. Julia: A fresh approach to numerical computing. SIAM Review, 59(1):65-98, 2017. doi: 10.1137/141000671.
|
| 328 |
+
Burt, P. J. and Adelson, E. H. The laplacian pyramid as a compact image code. In Readings in computer vision, pp. 671-679. Elsevier, 1987.
|
| 329 |
+
Chen, L.-C., Yang, Y., Wang, J., Xu, W., and Yuille, A. L. Attention to scale: Scale-aware semantic image segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3640-3649, 2016.
|
| 330 |
+
Chen, L.-C., Papandreou, G., Kokkinos, I., Murphy, K., and Yuille, A. L. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE transactions on pattern analysis and machine intelligence, 40(4):834-848, 2017.
|
| 331 |
+
Chen, R. T., Rubanova, Y., Bettencourt, J., and Duvenaud, D. K. Neural ordinary differential equations. In Advances in neural information processing systems, pp. 6571-6583, 2018.
|
| 332 |
+
Citi, L. and Barbieri, R. Physionet 2012 challenge: Predicting mortality of icu patients using a cascadedsvm-glm paradigm. In 2012 Computing in Cardiology, pp. 257- 260.IEEE,2012.
|
| 333 |
+
Dauvergne, B. and Hascoet, L. The data-flow equations of checkpointing in reverse automatic differentiation. In
|
| 334 |
+
|
| 335 |
+
International Conference on Computational Science, pp. 566-573. Springer, 2006.
|
| 336 |
+
Djeumou, F., Neary, C., Goubault, E., Putot, S., and Topcu, U. Taylor-lagrange neural ordinary differential equations: Toward fast training and evaluation of neural odes, 2022.
|
| 337 |
+
Dormand, J. R. and Prince, P. J. A family of embedded runge-kutta formulae. Journal of computational and applied mathematics, 6(1):19-26, 1980.
|
| 338 |
+
Dupont, E., Doucet, A., and Teh, Y. W. Augmented neural odes. Advances in Neural Information Processing Systems, 32, 2019.
|
| 339 |
+
Farabet, C., Couprie, C., Najman, L., and LeCun, Y. Learning hierarchical features for scene labeling. IEEE transactions on pattern analysis and machine intelligence, 35 (8):1915-1929, 2012.
|
| 340 |
+
Fehlberg, E. Classical fifth-, sixth-, seventh-, and eighth-order Runge-Kutta formulas with stepsize control. National Aeronautics and Space Administration, 1968.
|
| 341 |
+
Finlay, C., Jacobsen, J.-H., Nurbekyan, L., and Oberman, A. M. How to train your neural ode. arXiv preprint arXiv:2002.02798, 2020.
|
| 342 |
+
Grathwohl, W., Chen, R. T., Bettencourt, J., Sutskever, I., and Duvenaud, D. Ffjord: Free-form continuous dynamics for scalable reversible generative models. arXiv preprint arXiv:1810.01367, 2018.
|
| 343 |
+
Hairer, E., Norsett, S., and Wanner, G. Solving Ordinary Differential Equations I: Nonstiff Problems, volume 8. 01 1993. ISBN 978-3-540-56670-0. doi: 10.1007/978-3-540-78862-1.
|
| 344 |
+
Hindmarsh, A. C., Brown, P. N., Grant, K. E., Lee, S. L., Serban, R., Shumaker, D. E., and Woodward, C. S. Sundials: Suite of nonlinear and differential/algebraic equation solvers. ACM Trans. Math. Softw., 31(3): 363-396, sep 2005. ISSN 0098-3500. doi: 10.1145/1089014.1089020. URL https://doi.org/10.1145/1089014.1089020.
|
| 345 |
+
Kelly, J., Bettencourt, J., Johnson, M. J., and Duvenaud, D. Learning differential equations that are easy to solve. arXiv preprint arXiv:2007.04504, 2020.
|
| 346 |
+
Kim, S., Ji, W., Deng, S., Ma, Y., and Rackauckas, C. Stiff neural ordinary differential equations. Chaos: An Interdisciplinary Journal of Nonlinear Science, 31(9):093122, 2021.
|
| 347 |
+
Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization, 2014. URL http://arxiv.org/abs/1412.6980. cite arxiv:1412.6980Comment: Published
|
| 348 |
+
|
| 349 |
+
as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015.
|
| 350 |
+
Kutta, W. Beitrag zur nacherungsweisen integration totaler differentialgleichungen. Z. Math. Phys., 46:435-453, 1901.
|
| 351 |
+
LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278-2324, 1998.
|
| 352 |
+
Liu, X., Xiao, T., Si, S., Cao, Q., Kumar, S., and Hsieh, C.-J. Neural sde: Stabilizing neural ode networks with stochastic noise, 2019.
|
| 353 |
+
Lu, Y., Zhong, A., Li, Q., and Dong, B. Beyond finite layer neural networks: Bridging deep architectures and numerical differential equations. In International Conference on Machine Learning, pp. 3276-3285. PMLR, 2018.
|
| 354 |
+
Onken, D. and Ruthotto, L. Discretize-optimize vs. optimize-discretize for time-series regression and continuous normalizing flows. arXiv preprint arXiv:2005.13420, 2020.
|
| 355 |
+
Pal, A. Lux: Explicit parameterization of deep neural networks in julia. https://github.com/avik-pal/Lux.j1/, 2022.
|
| 356 |
+
Pal, A., Ma, Y., Shah, V., and Rackauckas, C. V. Opening the blackbox: Accelerating neural differential equations by regularizing internal solver heuristics. In International Conference on Machine Learning, pp. 8325-8335. PMLR, 2021.
|
| 357 |
+
Pal, A., Edelman, A., and Rackauckas, C. Mixing implicit and explicit deep learning with skip deqs and infinite time neural odes (continuous deqs). arXiv preprint arXiv:2201.12240, 2022.
|
| 358 |
+
Piche, R. An 1-stable rosenbrock method for step-by-step time integration in structural dynamics. Computer Methods in Applied Mechanics and Engineering, 126(3-4): 343-354, 1995.
|
| 359 |
+
Poli, M., Massaroli, S., Yamashita, A., Asama, H., and Park, J. Hypersolvers: Toward fast continuous-depth models. arXiv preprint arXiv:2007.09601, 2020.
|
| 360 |
+
Rackauckas, C. Engineering trade-offs in automatic differentiation: From tensorflow and pytorch to jax and julia, Jan 2022. URL https://tinyurl.com/2j94bhc9.
|
| 361 |
+
Rackauckas, C. and Nie, Q. Adaptive methods for stochastic differential equations via natural embeddings and rejection sampling with memory. Discrete and continuous dynamical systems. Series B, 22(7):2731, 2017.
|
| 362 |
+
|
| 363 |
+
Rackauckas, C. and Nie, Q. Stability-optimized high order methods and stiffness detection for pathwise stiff stochastic differential equations. In 2020 IEEE High Performance Extreme Computing Conference (HPEC), pp. 1-8. IEEE, 2020.
|
| 364 |
+
Rackauckas, C., Innes, M., Ma, Y., Bettencourt, J., White, L., and Dixit, V. Diffeqflux.jl - A julia library for neural differential equations. CoRR, abs/1902.02376, 2019. URL http://arxiv.org/abs/1902.02376.
|
| 365 |
+
Rackauckas, C., Ma, Y., Martensen, J., Warner, C., Zubov, K., Supekar, R., Skinner, D., Ramadhan, A., and Edelman, A. Universal differential equations for scientific machine learning, 2020.
|
| 366 |
+
Robertson, H. The solution of a set of reaction rate equations. Numerical analysis: an introduction, 178182, 1966.
|
| 367 |
+
Rubanova, Y., Chen, R. T., and Duvenaud, D. Latent odes for irregularly-sampled time series. arXiv preprint arXiv:1907.03907, 2019.
|
| 368 |
+
Runge, C. Über die numerische auflösung von differentialgleichungen. Mathematische Annalen, 46(2):167-178, 1895.
|
| 369 |
+
Tsitouras, C. Runge-kutta pairs of order 5(4) satisfying only the first column simplifying assumption. Computers Mathematics with Applications, 62(2):770 - 775, 2011. ISSN 0898-1221. doi: https://doi.org/10.1016/j.camwa.2011.06.002. URL http://www.sciencedirect.com/science/article/pii/S0898122111004706.
|
| 370 |
+
Wanner, G. and Hairer, E. Solving ordinary differential equations II. Springer Berlin Heidelberg, 1996.
|
| 371 |
+
Xia, H., Suliafu, V., Ji, H., Nguyen, T., Bertozzi, A., Osher, S., and Wang, B. Heavy ball neural ordinary differential equations. Advances in Neural Information Processing Systems, 34, 2021.
|
| 372 |
+
Yu, F. and Koltun, V. Multi-scale context aggregation by dilated convolutions. arXiv preprint arXiv:1511.07122, 2015.
|
| 373 |
+
Zhang, H. and Sandu, A. Fatode: a library for forward, adjoint, and tangent linear integration of odes. SIAM Journal on Scientific Computing, 36(5):C504-C523, 2014.
|
2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e278ecebdb9887d380e96ed87c868ac188184c033411423dbe22862f85fee711
|
| 3 |
+
size 549574
|
2023/Locally Regularized Neural Differential Equations_ Some Black Boxes were meant to remain closed!/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Long Horizon Temperature Scaling/47128e75-9f58-40d7-abc3-eec59da61be5_content_list.json
ADDED
|
@@ -0,0 +1,2244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Andy Shih<sup>1</sup> Dorsa Sadigh<sup>1</sup> Stefano Ermon<sup>1</sup>",
|
| 17 |
+
"bbox": [
|
| 18 |
+
321,
|
| 19 |
+
176,
|
| 20 |
+
645,
|
| 21 |
+
193
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "Abstract",
|
| 28 |
+
"text_level": 1,
|
| 29 |
+
"bbox": [
|
| 30 |
+
241,
|
| 31 |
+
220,
|
| 32 |
+
320,
|
| 33 |
+
236
|
| 34 |
+
],
|
| 35 |
+
"page_idx": 0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"type": "text",
|
| 39 |
+
"text": "Temperature scaling is a popular technique for tuning the sharpness of a model distribution. It is used extensively for sampling likely generations and calibrating model uncertainty, and even features as a controllable parameter to many large language models in deployment. However, autoregressive models rely on myopic temperature scaling that greedily optimizes the next token. To address this, we propose Long Horizon Temperature Scaling (LHTS), a novel approach for sampling from temperature-scaled joint distributions. LHTS is compatible with all likelihood-based models, and optimizes for the long horizon likelihood of samples. We derive a temperature-dependent LHTS objective, and show that finetuning a model on a range of temperatures produces a single model capable of generation with a controllable long horizon temperature parameter. We experiment with LHTS on image diffusion models and character/language autoregressive models, demonstrating advantages over myopic temperature scaling in likelihood and sample quality, and showing improvements in accuracy on a multiple choice analogy task by $10\\%$ . Our code is available at https://github.com/AndyShih12/LongHorizonTemperatureScaling.",
|
| 40 |
+
"bbox": [
|
| 41 |
+
117,
|
| 42 |
+
247,
|
| 43 |
+
444,
|
| 44 |
+
640
|
| 45 |
+
],
|
| 46 |
+
"page_idx": 0
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": "1. Introduction",
|
| 51 |
+
"text_level": 1,
|
| 52 |
+
"bbox": [
|
| 53 |
+
86,
|
| 54 |
+
674,
|
| 55 |
+
217,
|
| 56 |
+
690
|
| 57 |
+
],
|
| 58 |
+
"page_idx": 0
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"type": "text",
|
| 62 |
+
"text": "Temperature scaling is a simple yet effective technique for rescaling model outputs: lowering the temperature to increase the probability of high-likelihood outcomes, or vice versa. In discriminative settings, tuning the temperature has shown success as a calibration method (Guo et al., 2017; Nixon et al., 2019; Desai & Durrett, 2020). The model outputs a small set of class probabilities, which can be tractably rescaled to match the desired calibration metric.",
|
| 63 |
+
"bbox": [
|
| 64 |
+
84,
|
| 65 |
+
700,
|
| 66 |
+
475,
|
| 67 |
+
821
|
| 68 |
+
],
|
| 69 |
+
"page_idx": 0
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"type": "text",
|
| 73 |
+
"text": "$^{1}$ Department of Computer Science, Stanford University. Correspondence to: Andy Shih <andyshih@cs.stanford.edu>.",
|
| 74 |
+
"bbox": [
|
| 75 |
+
84,
|
| 76 |
+
828,
|
| 77 |
+
477,
|
| 78 |
+
856
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).",
|
| 85 |
+
"bbox": [
|
| 86 |
+
84,
|
| 87 |
+
864,
|
| 88 |
+
475,
|
| 89 |
+
906
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "In generative tasks, temperature scaling also serves as a method for controlling the randomness of model outputs, and has shown to be useful for many natural language generation tasks such as summarization and question answering (Liang et al., 2022). Many current models in deployment (Brown et al., 2020; Bommasani et al., 2021) even expose the model temperature as a user-controllable parameter in their API. These autoregressive language models execute temperature scaling one token at a time, rescaling the probability of the next token to be proportional to $\\log p(x_i|x_{< i}) / T$ . However, this mechanism is myopic, optimizing for the next token instead of the full sequence.",
|
| 96 |
+
"bbox": [
|
| 97 |
+
495,
|
| 98 |
+
220,
|
| 99 |
+
887,
|
| 100 |
+
404
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "We reexamine the current practice of temperature scaling for generative models. Unlike discriminative tasks, generative tasks produce high-dimensional outputs. In other words, rescaling the model outputs should, in principle, rescale joint probabilities according to $\\log p(x) / T$ . Lowering the temperature of a language model should ideally bias the model towards generation of full text sequences with high joint likelihood, not just greedy generation of the next likely tokens. However, due to the intractability of joint temperature scaling, existing model families rely on various ad-hoc approximations such as myopic temperature scaling. This perspective highlights the following concerns.",
|
| 107 |
+
"bbox": [
|
| 108 |
+
495,
|
| 109 |
+
410,
|
| 110 |
+
888,
|
| 111 |
+
592
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 0
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "text",
|
| 117 |
+
"text": "A) Current temperature scaling for autoregressive models is a myopic approximation to temperature scaling of joint probabilities.",
|
| 118 |
+
"bbox": [
|
| 119 |
+
504,
|
| 120 |
+
609,
|
| 121 |
+
885,
|
| 122 |
+
655
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 0
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "text",
|
| 128 |
+
"text": "Many other model families do not support myopic approximations, and are left with the intractable problem of joint temperature scaling. Some sidestep the problem by defining various notions of pseudo-temperatures (Kingma & Dhariwal, 2018; Vahdat & Kautz, 2020).",
|
| 129 |
+
"bbox": [
|
| 130 |
+
495,
|
| 131 |
+
672,
|
| 132 |
+
888,
|
| 133 |
+
750
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 0
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "text",
|
| 139 |
+
"text": "B) Many non-autoregressive generative models either rely on pseudo-temperatures or do not use temperature scaling altogether.",
|
| 140 |
+
"bbox": [
|
| 141 |
+
504,
|
| 142 |
+
766,
|
| 143 |
+
887,
|
| 144 |
+
811
|
| 145 |
+
],
|
| 146 |
+
"page_idx": 0
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"type": "text",
|
| 150 |
+
"text": "To address these concerns, we aim head-on for the goal of joint temperature scaling. Instead of handling various model-specific temperature scaling techniques, we set out to develop a practical and general mechanism for sampling from temperature-scaled joint distributions. We propose",
|
| 151 |
+
"bbox": [
|
| 152 |
+
495,
|
| 153 |
+
829,
|
| 154 |
+
888,
|
| 155 |
+
906
|
| 156 |
+
],
|
| 157 |
+
"page_idx": 0
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"type": "page_number",
|
| 161 |
+
"text": "1",
|
| 162 |
+
"bbox": [
|
| 163 |
+
480,
|
| 164 |
+
922,
|
| 165 |
+
491,
|
| 166 |
+
934
|
| 167 |
+
],
|
| 168 |
+
"page_idx": 0
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"type": "image",
|
| 172 |
+
"img_path": "images/38869c3214d81d1540d5113edc6a1938b4bd462e256c1fc6adf57171b851f9a8.jpg",
|
| 173 |
+
"image_caption": [
|
| 174 |
+
"Figure 1. Pitfalls of myopic temperature scaling. At the top of the diagram, we depict prompting a language model for a choice of three actions. The language model may respond with each choice with a probability of 0.3 (shown in green), and a remaining probability of 0.1 of outputting irrelevant answers. To reduce the probability of irrelevant answers, we can lower the temperature of the model. In blue, we show that myopic temperature scaling will unintuitively lump the probabilities for the two actions \"tap cabinet\" and \"tap door\", because they share the same first token \"tap\". Therefore, lowering the myopic temperature will emphasize the probability on these two choices, and diminish the probability of choosing \"close door\". On the other hand, in orange we show that long horizon temperature scaling correctly scales the joint probability of the full sequence, equally distributing a probability of one-third among the three choices."
|
| 175 |
+
],
|
| 176 |
+
"image_footnote": [],
|
| 177 |
+
"bbox": [
|
| 178 |
+
89,
|
| 179 |
+
82,
|
| 180 |
+
883,
|
| 181 |
+
324
|
| 182 |
+
],
|
| 183 |
+
"page_idx": 1
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"type": "text",
|
| 187 |
+
"text": "Long Horizon Temperature Scaling (LHTS), a novel and tractable approach for sampling from a temperature-scaled joint distribution that is A) non-myopic and B) compatible with all likelihood-based generative models. LHTS requires finetuning a likelihood-based model on a temperature-dependent objective, after which the model can sample long horizon temperature-scaled outputs without any additional cost over standard sampling. By finetuning over a range of temperatures, we can learn a single model capable of generation with a controllable parameter, extrapolating even to temperatures unseen during finetuning.",
|
| 188 |
+
"bbox": [
|
| 189 |
+
83,
|
| 190 |
+
460,
|
| 191 |
+
475,
|
| 192 |
+
628
|
| 193 |
+
],
|
| 194 |
+
"page_idx": 1
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
"type": "text",
|
| 198 |
+
"text": "LHTS enables autoregressive models to optimize for high likelihood outputs over a long horizon instead of a single token (Figure 1). For other likelihood-based models (e.g. VAEs, normalizing flows, diffusion models), LHTS presents a unified model-agnostic temperature scaling mechanism. We experiment with LHTS in three settings: a diffusion image model, an autoregressive character model, and autoregressive large language models. Our experiments show that LHTS can achieve a better tradeoff between likelihood and diversity compared to pseudo-temperature scaling for diffusion models, and compared to myopic temperature scaling for autoregressive models. On a downstream analogy multiple-choice task, LHTS improves the accuracy of GPT-2 by $10\\%$ over myopic temperature scaling.",
|
| 199 |
+
"bbox": [
|
| 200 |
+
83,
|
| 201 |
+
635,
|
| 202 |
+
477,
|
| 203 |
+
848
|
| 204 |
+
],
|
| 205 |
+
"page_idx": 1
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"type": "text",
|
| 209 |
+
"text": "2. Background",
|
| 210 |
+
"text_level": 1,
|
| 211 |
+
"bbox": [
|
| 212 |
+
496,
|
| 213 |
+
460,
|
| 214 |
+
625,
|
| 215 |
+
477
|
| 216 |
+
],
|
| 217 |
+
"page_idx": 1
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"type": "text",
|
| 221 |
+
"text": "For generative tasks, we have access to a data distribution $p_{\\mathrm{data}}(x)$ in the form of a training set $\\mathcal{D}$ of i.i.d. samples, from which we aim to learn a faithful model $p(x)$ of the data distribution. In principle, having learned the ideal model $p(x)$ for our downstream task, we would be satisfied with drawing conditional/unconditional samples from $p(x)$ .",
|
| 222 |
+
"bbox": [
|
| 223 |
+
495,
|
| 224 |
+
486,
|
| 225 |
+
888,
|
| 226 |
+
578
|
| 227 |
+
],
|
| 228 |
+
"page_idx": 1
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"type": "text",
|
| 232 |
+
"text": "However, in practice, biasing samples towards higher likelihood regions of the model distribution is often beneficial. For example, we often choose to calibrate the entropy of a suboptimal model (Holtzman et al., 2019), generate less noisy behavior by taking the argmax action, or simply sample from a sharper distribution. The most prominent technique for biasing towards high likelihood regions is temperature scaling with a scalar $T$ .",
|
| 233 |
+
"bbox": [
|
| 234 |
+
495,
|
| 235 |
+
584,
|
| 236 |
+
888,
|
| 237 |
+
705
|
| 238 |
+
],
|
| 239 |
+
"page_idx": 1
|
| 240 |
+
},
|
| 241 |
+
{
|
| 242 |
+
"type": "equation",
|
| 243 |
+
"text": "\n$$\n\\log p _ {T} (x) = \\log p (x) / T - \\log Z _ {p _ {T}} \\tag {1}\n$$\n",
|
| 244 |
+
"text_format": "latex",
|
| 245 |
+
"bbox": [
|
| 246 |
+
571,
|
| 247 |
+
713,
|
| 248 |
+
885,
|
| 249 |
+
729
|
| 250 |
+
],
|
| 251 |
+
"page_idx": 1
|
| 252 |
+
},
|
| 253 |
+
{
|
| 254 |
+
"type": "text",
|
| 255 |
+
"text": "where $Z_{p_T}$ is the partition function. For temperatures $T < 1$ , the scaled model $p_T(x)$ defines a sharper distribution, which is useful for a variety of applications mentioned above.",
|
| 256 |
+
"bbox": [
|
| 257 |
+
495,
|
| 258 |
+
744,
|
| 259 |
+
887,
|
| 260 |
+
790
|
| 261 |
+
],
|
| 262 |
+
"page_idx": 1
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"type": "text",
|
| 266 |
+
"text": "2.1. Myopic temperature scaling",
|
| 267 |
+
"text_level": 1,
|
| 268 |
+
"bbox": [
|
| 269 |
+
496,
|
| 270 |
+
806,
|
| 271 |
+
725,
|
| 272 |
+
821
|
| 273 |
+
],
|
| 274 |
+
"page_idx": 1
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"type": "text",
|
| 278 |
+
"text": "Autoregressive models, such as GPT (Radford et al., 2019; Brown et al., 2020), implement a myopic approximation to temperature scaling. Autoregressive models learn a set of univariate conditional distributions $\\log p(x_{i}|x_{< i})$ and rely on the factorization of the joint distribution via chain rule",
|
| 279 |
+
"bbox": [
|
| 280 |
+
495,
|
| 281 |
+
830,
|
| 282 |
+
887,
|
| 283 |
+
905
|
| 284 |
+
],
|
| 285 |
+
"page_idx": 1
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"type": "header",
|
| 289 |
+
"text": "Long Horizon Temperature Scaling",
|
| 290 |
+
"bbox": [
|
| 291 |
+
372,
|
| 292 |
+
56,
|
| 293 |
+
599,
|
| 294 |
+
70
|
| 295 |
+
],
|
| 296 |
+
"page_idx": 1
|
| 297 |
+
},
|
| 298 |
+
{
|
| 299 |
+
"type": "page_number",
|
| 300 |
+
"text": "2",
|
| 301 |
+
"bbox": [
|
| 302 |
+
480,
|
| 303 |
+
922,
|
| 304 |
+
491,
|
| 305 |
+
934
|
| 306 |
+
],
|
| 307 |
+
"page_idx": 1
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"type": "text",
|
| 311 |
+
"text": "$\\log p(x) = \\sum_{i}\\log p(x_i|x_{< i})$ . When sampling with a temperature $T$ , they rescale each univariate conditional by $T$",
|
| 312 |
+
"bbox": [
|
| 313 |
+
84,
|
| 314 |
+
84,
|
| 315 |
+
475,
|
| 316 |
+
116
|
| 317 |
+
],
|
| 318 |
+
"page_idx": 2
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"type": "equation",
|
| 322 |
+
"text": "\n$$\n\\log p _ {T} ^ {\\text {m y o p i c}} \\left(x _ {i} \\mid x _ {< i}\\right) = \\log \\frac {e ^ {\\log p \\left(x _ {i} \\mid x _ {< i}\\right) / T}}{\\sum_ {k} e ^ {\\log p \\left(x _ {i} = k \\mid x _ {< i}\\right) / T}} \\tag {2}\n$$\n",
|
| 323 |
+
"text_format": "latex",
|
| 324 |
+
"bbox": [
|
| 325 |
+
109,
|
| 326 |
+
123,
|
| 327 |
+
473,
|
| 328 |
+
161
|
| 329 |
+
],
|
| 330 |
+
"page_idx": 2
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"type": "text",
|
| 334 |
+
"text": "This approach is efficient since it handles one dimension at a time and only requires rescaling the output logits. However, since the scaling is myopic, the chain rule factorization does not preserve the scaled joint distribution in Eq 1.",
|
| 335 |
+
"bbox": [
|
| 336 |
+
84,
|
| 337 |
+
167,
|
| 338 |
+
475,
|
| 339 |
+
228
|
| 340 |
+
],
|
| 341 |
+
"page_idx": 2
|
| 342 |
+
},
|
| 343 |
+
{
|
| 344 |
+
"type": "equation",
|
| 345 |
+
"text": "\n$$\n\\log p _ {T} (x) \\neq \\sum_ {i} \\log p _ {T} ^ {\\text {m y o p i c}} \\left(x _ {i} \\mid x _ {< i}\\right) \\tag {3}\n$$\n",
|
| 346 |
+
"text_format": "latex",
|
| 347 |
+
"bbox": [
|
| 348 |
+
158,
|
| 349 |
+
237,
|
| 350 |
+
473,
|
| 351 |
+
267
|
| 352 |
+
],
|
| 353 |
+
"page_idx": 2
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"type": "text",
|
| 357 |
+
"text": "It is easy to see that in the extreme case, myopic scaling of an autoregressive model with $T \\to 0$ will not necessarily produce the argmax sample of the joint distribution.",
|
| 358 |
+
"bbox": [
|
| 359 |
+
84,
|
| 360 |
+
284,
|
| 361 |
+
475,
|
| 362 |
+
330
|
| 363 |
+
],
|
| 364 |
+
"page_idx": 2
|
| 365 |
+
},
|
| 366 |
+
{
|
| 367 |
+
"type": "text",
|
| 368 |
+
"text": "2.2. Pseudo-temperature scaling",
|
| 369 |
+
"text_level": 1,
|
| 370 |
+
"bbox": [
|
| 371 |
+
84,
|
| 372 |
+
345,
|
| 373 |
+
313,
|
| 374 |
+
361
|
| 375 |
+
],
|
| 376 |
+
"page_idx": 2
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"type": "text",
|
| 380 |
+
"text": "Non-autoregressive models are often associated with various ad-hoc notions of pseudo-temperature scaling. For example, some latent variable models (Kingma & Dhariwal, 2018; Vahdat & Kautz, 2020) rescale the variance of the prior of the latent variable. However, these notions of pseudotemperature are often model-specific, and have an unclear relationship to temperature scaling of the data likelihood.",
|
| 381 |
+
"bbox": [
|
| 382 |
+
84,
|
| 383 |
+
369,
|
| 384 |
+
475,
|
| 385 |
+
476
|
| 386 |
+
],
|
| 387 |
+
"page_idx": 2
|
| 388 |
+
},
|
| 389 |
+
{
|
| 390 |
+
"type": "text",
|
| 391 |
+
"text": "3. Related Work",
|
| 392 |
+
"text_level": 1,
|
| 393 |
+
"bbox": [
|
| 394 |
+
84,
|
| 395 |
+
494,
|
| 396 |
+
227,
|
| 397 |
+
508
|
| 398 |
+
],
|
| 399 |
+
"page_idx": 2
|
| 400 |
+
},
|
| 401 |
+
{
|
| 402 |
+
"type": "text",
|
| 403 |
+
"text": "Temperature scaling is an effective method for calibration in discriminative settings (Guo et al., 2017; Nixon et al., 2019; Desai & Durrett, 2020), where the output predictions of a model can be rescaled post-hoc. In generative settings, such as natural language generation, myopic temperature scaling serves as an important knob for controlling the randomness of autoregressive models, often featuring as a user-controllable parameter in deployment (Brown et al., 2020; Bommasani et al., 2021). For latent variable models, such as normalizing flows or VAEs, reducing the variance of the prior during sampling has been explored as a pseudotemperature mechanism (Kingma & Dhariwal, 2018; Vahdat & Kautz, 2020). Due to the high-dimensional output space of generative tasks, however, these above methods are approximations that do not directly scale the temperature of the joint distribution, and are typically model-specific. Compared to these methods, LHTS presents a unified and tractable mechanism for temperature scaling of the joint distribution.",
|
| 404 |
+
"bbox": [
|
| 405 |
+
84,
|
| 406 |
+
520,
|
| 407 |
+
475,
|
| 408 |
+
806
|
| 409 |
+
],
|
| 410 |
+
"page_idx": 2
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"type": "text",
|
| 414 |
+
"text": "Other techniques for post-hoc manipulation of autoregressive model generation include top-k (Fan et al., 2018) or nucleus sampling (Holtzman et al., 2019). More intensive search-based alternatives are also popular, such as beam search (Li et al., 2016; Vijayakumar et al., 2018) for pick out high-likelihood generations. In terms of computational",
|
| 415 |
+
"bbox": [
|
| 416 |
+
84,
|
| 417 |
+
814,
|
| 418 |
+
475,
|
| 419 |
+
906
|
| 420 |
+
],
|
| 421 |
+
"page_idx": 2
|
| 422 |
+
},
|
| 423 |
+
{
|
| 424 |
+
"type": "text",
|
| 425 |
+
"text": "cost, LHTS only requires a one-time finetuning of the model, after which long horizon temperature-scaled outputs can be generated directly without search.",
|
| 426 |
+
"bbox": [
|
| 427 |
+
496,
|
| 428 |
+
84,
|
| 429 |
+
885,
|
| 430 |
+
130
|
| 431 |
+
],
|
| 432 |
+
"page_idx": 2
|
| 433 |
+
},
|
| 434 |
+
{
|
| 435 |
+
"type": "text",
|
| 436 |
+
"text": "Biasing the model towards higher-likelihood samples can also be viewed as controllable generation. Some relevant works include Quark (Lu et al., 2022), which partitions the dataset based on a control signal of interest (e.g. toxicity), and reinforces the model with its own generations. Other works on controllable generation include class-conditional generation, for example with diffusion models for images (Nichol & Dhariwal, 2021).",
|
| 437 |
+
"bbox": [
|
| 438 |
+
496,
|
| 439 |
+
137,
|
| 440 |
+
885,
|
| 441 |
+
258
|
| 442 |
+
],
|
| 443 |
+
"page_idx": 2
|
| 444 |
+
},
|
| 445 |
+
{
|
| 446 |
+
"type": "text",
|
| 447 |
+
"text": "Finally, LHTS relates closely to amortized inference (Gershman & Goodman, 2014), since we learn a model to predict intractable temperature-scaled joint distributions. As the temperature approaches zero, LHTC approximates MAP inference (Koller & Friedman, 2009).",
|
| 448 |
+
"bbox": [
|
| 449 |
+
496,
|
| 450 |
+
266,
|
| 451 |
+
885,
|
| 452 |
+
340
|
| 453 |
+
],
|
| 454 |
+
"page_idx": 2
|
| 455 |
+
},
|
| 456 |
+
{
|
| 457 |
+
"type": "text",
|
| 458 |
+
"text": "4. Long Horizon Temperature Scaling",
|
| 459 |
+
"text_level": 1,
|
| 460 |
+
"bbox": [
|
| 461 |
+
496,
|
| 462 |
+
361,
|
| 463 |
+
818,
|
| 464 |
+
378
|
| 465 |
+
],
|
| 466 |
+
"page_idx": 2
|
| 467 |
+
},
|
| 468 |
+
{
|
| 469 |
+
"type": "text",
|
| 470 |
+
"text": "We propose long horizon temperature scaling (LHTS), a general method to temperature scale the joint distribution of likelihood based models. LHTS proceeds by directly learning a model $q_{T}$ to match the temperature scaled distribution in Eq. 1. The model $q_{T}$ should have tractable likelihood and sampling, but typically this is satisfied by choosing the same model family as $p$ , or even finetuning from $p$ .",
|
| 471 |
+
"bbox": [
|
| 472 |
+
496,
|
| 473 |
+
386,
|
| 474 |
+
885,
|
| 475 |
+
493
|
| 476 |
+
],
|
| 477 |
+
"page_idx": 2
|
| 478 |
+
},
|
| 479 |
+
{
|
| 480 |
+
"type": "equation",
|
| 481 |
+
"text": "\n$$\n\\begin{array}{l} \\min _ {q _ {T}} K L (p _ {T} \\| q _ {T}) = \\min _ {q _ {T}} \\mathbb {E} _ {x \\sim p _ {T}} [ \\log p _ {T} (x) - \\log q _ {T} (x) ] \\\\ = \\min _ {q _ {T}} \\mathbb {E} _ {x \\sim p _ {T}} [ - \\log q _ {T} (x) ] \\\\ \\end{array}\n$$\n",
|
| 482 |
+
"text_format": "latex",
|
| 483 |
+
"bbox": [
|
| 484 |
+
504,
|
| 485 |
+
508,
|
| 486 |
+
877,
|
| 487 |
+
559
|
| 488 |
+
],
|
| 489 |
+
"page_idx": 2
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
"type": "text",
|
| 493 |
+
"text": "Although we don't have sample access to $p_T$ , we can appeal to importance sampling from $p$ .",
|
| 494 |
+
"bbox": [
|
| 495 |
+
496,
|
| 496 |
+
583,
|
| 497 |
+
885,
|
| 498 |
+
613
|
| 499 |
+
],
|
| 500 |
+
"page_idx": 2
|
| 501 |
+
},
|
| 502 |
+
{
|
| 503 |
+
"type": "equation",
|
| 504 |
+
"text": "\n$$\n\\begin{array}{l} \\mathbb {E} _ {x \\sim p _ {T}} [ - \\log q _ {T} (x) ] \\\\ = \\mathbb {E} _ {x \\sim p} \\frac {e ^ {(\\log p (x) / T) - \\log Z _ {p _ {T}}}}{p (x)} [ - \\log q _ {T} (x) ] \\\\ = \\mathbb {E} _ {x \\sim p} e ^ {\\frac {1 - T}{T} \\log p (x) - \\log Z _ {p T}} [ - \\log q _ {T} (x) ] \\tag {4} \\\\ \\end{array}\n$$\n",
|
| 505 |
+
"text_format": "latex",
|
| 506 |
+
"bbox": [
|
| 507 |
+
555,
|
| 508 |
+
632,
|
| 509 |
+
885,
|
| 510 |
+
708
|
| 511 |
+
],
|
| 512 |
+
"page_idx": 2
|
| 513 |
+
},
|
| 514 |
+
{
|
| 515 |
+
"type": "text",
|
| 516 |
+
"text": "Optimizing $q_{T}$ with Eq. 4 will give us the desired temperature scaled distribution from Eq. 1, although the variance of the loss can be high due to the importance weights.",
|
| 517 |
+
"bbox": [
|
| 518 |
+
496,
|
| 519 |
+
732,
|
| 520 |
+
885,
|
| 521 |
+
777
|
| 522 |
+
],
|
| 523 |
+
"page_idx": 2
|
| 524 |
+
},
|
| 525 |
+
{
|
| 526 |
+
"type": "text",
|
| 527 |
+
"text": "We note that the intractable constant $\\log Z_{p_T}$ can be ignored since it evaluates as a constant multiplicative factor of the entire expression. More importantly, though, the same insight allows us to subtract an arbitrary data-independent baseline $b$ for variance reduction. Since the importance weights are not in log-space, we need to carefully choose a baseline to keep the weights within a manageable range. We opt for keeping the weights close to 1 by matching the empirical",
|
| 528 |
+
"bbox": [
|
| 529 |
+
496,
|
| 530 |
+
785,
|
| 531 |
+
885,
|
| 532 |
+
906
|
| 533 |
+
],
|
| 534 |
+
"page_idx": 2
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"type": "header",
|
| 538 |
+
"text": "Long Horizon Temperature Scaling",
|
| 539 |
+
"bbox": [
|
| 540 |
+
372,
|
| 541 |
+
56,
|
| 542 |
+
599,
|
| 543 |
+
71
|
| 544 |
+
],
|
| 545 |
+
"page_idx": 2
|
| 546 |
+
},
|
| 547 |
+
{
|
| 548 |
+
"type": "page_number",
|
| 549 |
+
"text": "3",
|
| 550 |
+
"bbox": [
|
| 551 |
+
480,
|
| 552 |
+
922,
|
| 553 |
+
491,
|
| 554 |
+
934
|
| 555 |
+
],
|
| 556 |
+
"page_idx": 2
|
| 557 |
+
},
|
| 558 |
+
{
|
| 559 |
+
"type": "text",
|
| 560 |
+
"text": "mean of the exponent.",
|
| 561 |
+
"bbox": [
|
| 562 |
+
84,
|
| 563 |
+
85,
|
| 564 |
+
235,
|
| 565 |
+
99
|
| 566 |
+
],
|
| 567 |
+
"page_idx": 3
|
| 568 |
+
},
|
| 569 |
+
{
|
| 570 |
+
"type": "equation",
|
| 571 |
+
"text": "\n$$\nb = \\frac {1}{| \\mathcal {D} |} \\sum_ {x \\in \\mathcal {D}} \\frac {1 - T}{T} \\log p (x) \\tag {5}\n$$\n",
|
| 572 |
+
"text_format": "latex",
|
| 573 |
+
"bbox": [
|
| 574 |
+
181,
|
| 575 |
+
108,
|
| 576 |
+
473,
|
| 577 |
+
143
|
| 578 |
+
],
|
| 579 |
+
"page_idx": 3
|
| 580 |
+
},
|
| 581 |
+
{
|
| 582 |
+
"type": "text",
|
| 583 |
+
"text": "Put together, the loss for training $q_{T}$ can be understood as a reweighing of data by a factor $w_{T}(x)$ based on the temperature-scaled joint probabilities.",
|
| 584 |
+
"bbox": [
|
| 585 |
+
84,
|
| 586 |
+
162,
|
| 587 |
+
473,
|
| 588 |
+
205
|
| 589 |
+
],
|
| 590 |
+
"page_idx": 3
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"type": "equation",
|
| 594 |
+
"text": "\n$$\nw _ {T} (x) = \\exp \\left(\\frac {1 - T}{T} \\log p (x) - b\\right) \\tag {6}\n$$\n",
|
| 595 |
+
"text_format": "latex",
|
| 596 |
+
"bbox": [
|
| 597 |
+
158,
|
| 598 |
+
215,
|
| 599 |
+
473,
|
| 600 |
+
244
|
| 601 |
+
],
|
| 602 |
+
"page_idx": 3
|
| 603 |
+
},
|
| 604 |
+
{
|
| 605 |
+
"type": "equation",
|
| 606 |
+
"text": "\n$$\n\\mathcal {L} \\left(q _ {T}\\right) = - \\mathbb {E} _ {x \\sim p} \\left[ w _ {T} (x) \\log q _ {T} (x) \\right] \\tag {7}\n$$\n",
|
| 607 |
+
"text_format": "latex",
|
| 608 |
+
"bbox": [
|
| 609 |
+
163,
|
| 610 |
+
247,
|
| 611 |
+
473,
|
| 612 |
+
265
|
| 613 |
+
],
|
| 614 |
+
"page_idx": 3
|
| 615 |
+
},
|
| 616 |
+
{
|
| 617 |
+
"type": "text",
|
| 618 |
+
"text": "Corollary 4.1. $\\frac{e^b}{Z_{p_T}}\\mathcal{L}(q_T) = KL(p_T||q_T) + H(p_T)$ .",
|
| 619 |
+
"bbox": [
|
| 620 |
+
84,
|
| 621 |
+
273,
|
| 622 |
+
439,
|
| 623 |
+
297
|
| 624 |
+
],
|
| 625 |
+
"page_idx": 3
|
| 626 |
+
},
|
| 627 |
+
{
|
| 628 |
+
"type": "text",
|
| 629 |
+
"text": "Proof. Evaluating $\\frac{e^b}{Z_{p_T}}\\mathcal{L}(q_T)$ gives Eq. 4, which is equal to $KL(p_T||q_T) + H(p_T)$ .",
|
| 630 |
+
"bbox": [
|
| 631 |
+
84,
|
| 632 |
+
313,
|
| 633 |
+
473,
|
| 634 |
+
351
|
| 635 |
+
],
|
| 636 |
+
"page_idx": 3
|
| 637 |
+
},
|
| 638 |
+
{
|
| 639 |
+
"type": "text",
|
| 640 |
+
"text": "The idea of LHTS is to train a model $q_{T}$ with tractable sampling on the objective in Eq. 7, so that we can sample from $q_{T} \\approx p_{T}$ efficiently after training. In this sense, LHTS can be considered an amortized inference method for accessing otherwise intractable temperature-scaled joint distributions. Compared to myopic temperature scaling, LHTS is not a pure post-hoc transformation since it requires model learning. Nevertheless, we can avoid learning completely from scratch, by finetuning $q_{T}$ from $p$ (which can be thought of as $q_{T=1}$ ). In return for the cost of finetuning, LHTS improves upon myopic temperature scaling in two ways. First, the temperature operates on the joint (long horizon) distribution, instead of greedily on one dimension at a time. Second, LHTS can be readily applied to any likelihood-based generative model, beyond just autoregressive models.",
|
| 641 |
+
"bbox": [
|
| 642 |
+
84,
|
| 643 |
+
364,
|
| 644 |
+
475,
|
| 645 |
+
592
|
| 646 |
+
],
|
| 647 |
+
"page_idx": 3
|
| 648 |
+
},
|
| 649 |
+
{
|
| 650 |
+
"type": "text",
|
| 651 |
+
"text": "In the rest of this section, we examine LHTS on hierarchical latent variable models and autoregressive models.",
|
| 652 |
+
"bbox": [
|
| 653 |
+
84,
|
| 654 |
+
599,
|
| 655 |
+
473,
|
| 656 |
+
628
|
| 657 |
+
],
|
| 658 |
+
"page_idx": 3
|
| 659 |
+
},
|
| 660 |
+
{
|
| 661 |
+
"type": "text",
|
| 662 |
+
"text": "4.1. LHTS on Hierarchical Latent Variable Models",
|
| 663 |
+
"text_level": 1,
|
| 664 |
+
"bbox": [
|
| 665 |
+
84,
|
| 666 |
+
646,
|
| 667 |
+
444,
|
| 668 |
+
659
|
| 669 |
+
],
|
| 670 |
+
"page_idx": 3
|
| 671 |
+
},
|
| 672 |
+
{
|
| 673 |
+
"type": "text",
|
| 674 |
+
"text": "Applying LHTS on hierarchical latent variable models is straightforward, by using their variational lower bound estimates of the data likelihood.",
|
| 675 |
+
"bbox": [
|
| 676 |
+
84,
|
| 677 |
+
670,
|
| 678 |
+
475,
|
| 679 |
+
714
|
| 680 |
+
],
|
| 681 |
+
"page_idx": 3
|
| 682 |
+
},
|
| 683 |
+
{
|
| 684 |
+
"type": "equation",
|
| 685 |
+
"text": "\n$$\n\\begin{array}{l} \\log p (x _ {0}) \\geq \\mathbb {E} _ {h} \\left[ D _ {K L} \\left(h \\left(x _ {K} \\mid x _ {0}\\right) \\mid \\mid p \\left(x _ {K}\\right)\\right) - \\log p \\left(x _ {0} \\mid x _ {1}\\right) \\right. \\\\ \\left. + \\sum_ {k > 1} D _ {K L} \\left(h \\left(x _ {k - 1} \\mid x _ {k}, x _ {0}\\right) \\mid \\mid p \\left(x _ {k - 1} \\mid x _ {k}\\right)\\right) \\right] \\end{array} \\tag {8}\n$$\n",
|
| 686 |
+
"text_format": "latex",
|
| 687 |
+
"bbox": [
|
| 688 |
+
86,
|
| 689 |
+
719,
|
| 690 |
+
468,
|
| 691 |
+
797
|
| 692 |
+
],
|
| 693 |
+
"page_idx": 3
|
| 694 |
+
},
|
| 695 |
+
{
|
| 696 |
+
"type": "text",
|
| 697 |
+
"text": "We can then plug in this likelihood lower bound to LHTS to compute the importance weights for each data point, and finetune $q_{T}$ with Eq. 7, where the inner likelihood is again evaluated with the lower-bound in Eq. 8.",
|
| 698 |
+
"bbox": [
|
| 699 |
+
84,
|
| 700 |
+
806,
|
| 701 |
+
473,
|
| 702 |
+
868
|
| 703 |
+
],
|
| 704 |
+
"page_idx": 3
|
| 705 |
+
},
|
| 706 |
+
{
|
| 707 |
+
"type": "text",
|
| 708 |
+
"text": "Diffusion Models Although diffusion models can also be formulated as a hierarchical latent variable model, they are",
|
| 709 |
+
"bbox": [
|
| 710 |
+
84,
|
| 711 |
+
875,
|
| 712 |
+
473,
|
| 713 |
+
905
|
| 714 |
+
],
|
| 715 |
+
"page_idx": 3
|
| 716 |
+
},
|
| 717 |
+
{
|
| 718 |
+
"type": "text",
|
| 719 |
+
"text": "often trained using a simpler MSE loss on the noise (Ho et al., 2020). Nevertheless, LHTS is still directly applicable by scaling the loss for each point by the importance weight.",
|
| 720 |
+
"bbox": [
|
| 721 |
+
496,
|
| 722 |
+
84,
|
| 723 |
+
885,
|
| 724 |
+
131
|
| 725 |
+
],
|
| 726 |
+
"page_idx": 3
|
| 727 |
+
},
|
| 728 |
+
{
|
| 729 |
+
"type": "equation",
|
| 730 |
+
"text": "\n$$\n\\mathcal {L} \\left(q _ {T}\\right) = \\tag {9}\n$$\n",
|
| 731 |
+
"text_format": "latex",
|
| 732 |
+
"bbox": [
|
| 733 |
+
506,
|
| 734 |
+
145,
|
| 735 |
+
885,
|
| 736 |
+
162
|
| 737 |
+
],
|
| 738 |
+
"page_idx": 3
|
| 739 |
+
},
|
| 740 |
+
{
|
| 741 |
+
"type": "equation",
|
| 742 |
+
"text": "\n$$\n\\mathbb {E} _ {k, x _ {0}, \\epsilon} \\Big [ w _ {T} (x _ {0}) | | \\epsilon - \\epsilon_ {q _ {T}} (\\sqrt {\\bar {\\alpha} _ {k}} x _ {0} + \\sqrt {1 - \\bar {\\alpha} _ {k}} \\epsilon , k) | | ^ {2} \\Big ]\n$$\n",
|
| 743 |
+
"text_format": "latex",
|
| 744 |
+
"bbox": [
|
| 745 |
+
519,
|
| 746 |
+
164,
|
| 747 |
+
874,
|
| 748 |
+
191
|
| 749 |
+
],
|
| 750 |
+
"page_idx": 3
|
| 751 |
+
},
|
| 752 |
+
{
|
| 753 |
+
"type": "text",
|
| 754 |
+
"text": "We can apply LHTS in exactly the same way for other likelihood-based models by scaling the log-likelihood loss of each datapoint by its importance weight. For autoregressive models, however, we can take advantage of the autoregressive factorization to derive a variance-reduced formulation of LHTS, which we describe next.",
|
| 755 |
+
"bbox": [
|
| 756 |
+
496,
|
| 757 |
+
210,
|
| 758 |
+
885,
|
| 759 |
+
301
|
| 760 |
+
],
|
| 761 |
+
"page_idx": 3
|
| 762 |
+
},
|
| 763 |
+
{
|
| 764 |
+
"type": "text",
|
| 765 |
+
"text": "4.2. Variance-Reduced LHTS on Autoregressive Models",
|
| 766 |
+
"text_level": 1,
|
| 767 |
+
"bbox": [
|
| 768 |
+
496,
|
| 769 |
+
318,
|
| 770 |
+
885,
|
| 771 |
+
333
|
| 772 |
+
],
|
| 773 |
+
"page_idx": 3
|
| 774 |
+
},
|
| 775 |
+
{
|
| 776 |
+
"type": "text",
|
| 777 |
+
"text": "To apply LHTS to autoregressive models, we first rewrite the LHTS objective from Eq. 7 into a form that is amenable to autoregressive architectures by first sampling the index $i$ uniformly, then the prefix $x_{< i}$ , and then the suffix $x_{\\geq i}$ .",
|
| 778 |
+
"bbox": [
|
| 779 |
+
496,
|
| 780 |
+
340,
|
| 781 |
+
885,
|
| 782 |
+
402
|
| 783 |
+
],
|
| 784 |
+
"page_idx": 3
|
| 785 |
+
},
|
| 786 |
+
{
|
| 787 |
+
"type": "equation",
|
| 788 |
+
"text": "\n$$\n\\begin{array}{l} - \\mathbb {E} _ {x \\sim p} [ w _ {T} (x) \\log q _ {T} (x) ] \\\\ = - \\mathbb {E} _ {x \\sim p} [ \\sum_ {i} w _ {T} (x) \\log q _ {T} (x _ {i} | x _ {< i}) ] \\\\ = - \\mathbb {E} _ {i, x _ {< i} \\sim p} \\mathbb {E} _ {x _ {\\geq i} \\sim p (\\cdot | x _ {< i})} [ w _ {T} (x) \\log q _ {T} (x _ {i} | x _ {< i}) ] \\\\ \\end{array}\n$$\n",
|
| 789 |
+
"text_format": "latex",
|
| 790 |
+
"bbox": [
|
| 791 |
+
524,
|
| 792 |
+
417,
|
| 793 |
+
859,
|
| 794 |
+
489
|
| 795 |
+
],
|
| 796 |
+
"page_idx": 3
|
| 797 |
+
},
|
| 798 |
+
{
|
| 799 |
+
"type": "text",
|
| 800 |
+
"text": "The purpose of this roundabout rewriting of the expectation is to illustrate that the autoregressive objective is composed of many univariate conditional losses, for each index $i$ and prefix $x_{< i}$ . This derivation allows us to design the baseline more carefully, since we can choose a different baseline for each univariate conditional loss while still trivially preserving the strict properness of the overall loss function.",
|
| 801 |
+
"bbox": [
|
| 802 |
+
496,
|
| 803 |
+
511,
|
| 804 |
+
885,
|
| 805 |
+
616
|
| 806 |
+
],
|
| 807 |
+
"page_idx": 3
|
| 808 |
+
},
|
| 809 |
+
{
|
| 810 |
+
"type": "text",
|
| 811 |
+
"text": "Proposition 4.2. Let $\\mathcal{L}^{AR}(q_T) =$",
|
| 812 |
+
"bbox": [
|
| 813 |
+
496,
|
| 814 |
+
622,
|
| 815 |
+
718,
|
| 816 |
+
638
|
| 817 |
+
],
|
| 818 |
+
"page_idx": 3
|
| 819 |
+
},
|
| 820 |
+
{
|
| 821 |
+
"type": "equation",
|
| 822 |
+
"text": "\n$$\n- \\mathbb {E} _ {i, x < i} \\sim p e ^ {- b (x < i)} \\mathbb {E} _ {x \\geq i} \\sim p (\\cdot | x < i) [ w _ {T} (x) \\log q _ {T} (x _ {i} | x < i) ]\n$$\n",
|
| 823 |
+
"text_format": "latex",
|
| 824 |
+
"bbox": [
|
| 825 |
+
504,
|
| 826 |
+
651,
|
| 827 |
+
877,
|
| 828 |
+
671
|
| 829 |
+
],
|
| 830 |
+
"page_idx": 3
|
| 831 |
+
},
|
| 832 |
+
{
|
| 833 |
+
"type": "text",
|
| 834 |
+
"text": "If $b(x_{<i})$ is finite for all $x_{<i}$ , then $\\mathcal{L}_{q_T}^{AR}$ is a strictly proper loss function, i.e. the unique global optimum is $q_T = p_T$ .",
|
| 835 |
+
"bbox": [
|
| 836 |
+
496,
|
| 837 |
+
686,
|
| 838 |
+
885,
|
| 839 |
+
717
|
| 840 |
+
],
|
| 841 |
+
"page_idx": 3
|
| 842 |
+
},
|
| 843 |
+
{
|
| 844 |
+
"type": "text",
|
| 845 |
+
"text": "Proof. Each inner expectation takes on an importance-weighted log loss of the univariate conditional, corresponding to optimizing $KL(p_{T}(\\cdot |x_{<i})||q_{T}(\\cdot |x_{<i}))$ . Since an autoregressive model fits all the univariate conditionals separately, these are independent optimization problems each with strictly proper losses. Any positive combination $(b(x_{<i})$ is finite) preserves strict properness of the loss. $\\square$",
|
| 846 |
+
"bbox": [
|
| 847 |
+
496,
|
| 848 |
+
743,
|
| 849 |
+
885,
|
| 850 |
+
849
|
| 851 |
+
],
|
| 852 |
+
"page_idx": 3
|
| 853 |
+
},
|
| 854 |
+
{
|
| 855 |
+
"type": "text",
|
| 856 |
+
"text": "In particular, we can set $b(x_{<i}) = \\frac{1 - T}{T} \\log p(x_{<i}) + b(i) - b$ to be the temperature scaled joint distribution of the prefix,",
|
| 857 |
+
"bbox": [
|
| 858 |
+
496,
|
| 859 |
+
875,
|
| 860 |
+
885,
|
| 861 |
+
906
|
| 862 |
+
],
|
| 863 |
+
"page_idx": 3
|
| 864 |
+
},
|
| 865 |
+
{
|
| 866 |
+
"type": "header",
|
| 867 |
+
"text": "Long Horizon Temperature Scaling",
|
| 868 |
+
"bbox": [
|
| 869 |
+
372,
|
| 870 |
+
56,
|
| 871 |
+
599,
|
| 872 |
+
71
|
| 873 |
+
],
|
| 874 |
+
"page_idx": 3
|
| 875 |
+
},
|
| 876 |
+
{
|
| 877 |
+
"type": "page_number",
|
| 878 |
+
"text": "4",
|
| 879 |
+
"bbox": [
|
| 880 |
+
480,
|
| 881 |
+
922,
|
| 882 |
+
491,
|
| 883 |
+
934
|
| 884 |
+
],
|
| 885 |
+
"page_idx": 3
|
| 886 |
+
},
|
| 887 |
+
{
|
| 888 |
+
"type": "text",
|
| 889 |
+
"text": "giving us a variance-reduced importance weight.",
|
| 890 |
+
"bbox": [
|
| 891 |
+
84,
|
| 892 |
+
85,
|
| 893 |
+
406,
|
| 894 |
+
99
|
| 895 |
+
],
|
| 896 |
+
"page_idx": 4
|
| 897 |
+
},
|
| 898 |
+
{
|
| 899 |
+
"type": "equation",
|
| 900 |
+
"text": "\n$$\n\\begin{array}{l} - \\mathbb {E} _ {i, x < i} \\sim p e ^ {- b (x < i)} \\mathbb {E} _ {x \\geq i} \\sim p (\\cdot | x < i) [ w _ {T} (x) \\log q _ {T} (x _ {i} | x < i) ] \\\\ = - \\mathbb {E} _ {i, x < i \\sim p} e ^ {\\frac {1 - T}{T} \\log p (x < i) - b (x < i)} \\\\ \\mathbb {E} _ {x \\geq i \\sim p (\\cdot | x < i)} \\left[ e ^ {\\frac {1 - T}{T} \\log p (x _ {\\geq i} | x < i) - b} \\log q _ {T} \\left(x _ {i} \\mid x < i\\right) \\right] \\\\ = - \\mathbb {E} _ {i, x \\sim p} \\left[ e ^ {\\frac {1 - T}{T}} \\log p \\left(x _ {\\geq i} \\mid x < i\\right) - b (i) \\log q _ {T} \\left(x _ {i} \\mid x < i\\right) \\right] \\tag {10} \\\\ \\end{array}\n$$\n",
|
| 901 |
+
"text_format": "latex",
|
| 902 |
+
"bbox": [
|
| 903 |
+
99,
|
| 904 |
+
113,
|
| 905 |
+
488,
|
| 906 |
+
200
|
| 907 |
+
],
|
| 908 |
+
"page_idx": 4
|
| 909 |
+
},
|
| 910 |
+
{
|
| 911 |
+
"type": "text",
|
| 912 |
+
"text": "Compared to Eq. 7, in Eq. 10 we modified the expression in the exponent of the importance weight from $\\log p(x)$ to $\\log p(x_{\\geq i}|x_{< i})$ . This makes sense intuitively: once we have fixed a prefix $x_{< i}$ of the sequence, we only need to learn how likely a suffix should be relative to other suffixes, so we can ignore the probability of the prefix $p(x_{< i})$ . Moreover, appealing to Proposition 4.2, we transformed the term $b$ to an index-dependent term $b(i)$ . In a similar spirit to Eq. 5, we will set $b(i)$ to keep the weights close to 1 by matching the empirical mean of the suffix log-likelihoods.",
|
| 913 |
+
"bbox": [
|
| 914 |
+
84,
|
| 915 |
+
223,
|
| 916 |
+
475,
|
| 917 |
+
375
|
| 918 |
+
],
|
| 919 |
+
"page_idx": 4
|
| 920 |
+
},
|
| 921 |
+
{
|
| 922 |
+
"type": "equation",
|
| 923 |
+
"text": "\n$$\nb (i) = \\frac {1}{| \\mathcal {D} |} \\sum_ {x \\in \\mathcal {D}} \\frac {1 - T}{T} \\log p \\left(x _ {\\geq i} \\mid x _ {< i}\\right) \\tag {11}\n$$\n",
|
| 924 |
+
"text_format": "latex",
|
| 925 |
+
"bbox": [
|
| 926 |
+
150,
|
| 927 |
+
386,
|
| 928 |
+
473,
|
| 929 |
+
424
|
| 930 |
+
],
|
| 931 |
+
"page_idx": 4
|
| 932 |
+
},
|
| 933 |
+
{
|
| 934 |
+
"type": "text",
|
| 935 |
+
"text": "Computing Suffix Likelihoods One important consideration is the efficient implementation of variance-reduced LHTS on modern causal architectures of autoregressive models. Conveniently, we can vectorize the computation of suffix log-likelihoods $v_{i}(x) = \\log p(x_{\\geq i}|x_{< i})$ via a reverse cumulative sum on the vector of univariate conditionals $u_{i} = \\log p(x_{i}|x_{< i})$ .",
|
| 936 |
+
"bbox": [
|
| 937 |
+
84,
|
| 938 |
+
444,
|
| 939 |
+
475,
|
| 940 |
+
551
|
| 941 |
+
],
|
| 942 |
+
"page_idx": 4
|
| 943 |
+
},
|
| 944 |
+
{
|
| 945 |
+
"type": "text",
|
| 946 |
+
"text": "Suffix Horizon Length Even with the above baseline, the variance of joint likelihoods can still grow quickly when the sequence length is long, e.g. 1024. A practical approach to reducing the variance even more is by limiting the horizon to some length $h$ . This means replacing all the suffix log-likelihoods $\\log p(x_{\\geq i}|x_{<i})$ with a horizon-bounded suffix log-likelihood $\\log p(x_{i:k}|x_{<i})$ where $k = \\min (i + h, \\text{context length})$ .",
|
| 947 |
+
"bbox": [
|
| 948 |
+
84,
|
| 949 |
+
569,
|
| 950 |
+
475,
|
| 951 |
+
690
|
| 952 |
+
],
|
| 953 |
+
"page_idx": 4
|
| 954 |
+
},
|
| 955 |
+
{
|
| 956 |
+
"type": "text",
|
| 957 |
+
"text": "5. Implementation",
|
| 958 |
+
"text_level": 1,
|
| 959 |
+
"bbox": [
|
| 960 |
+
84,
|
| 961 |
+
709,
|
| 962 |
+
243,
|
| 963 |
+
726
|
| 964 |
+
],
|
| 965 |
+
"page_idx": 4
|
| 966 |
+
},
|
| 967 |
+
{
|
| 968 |
+
"type": "text",
|
| 969 |
+
"text": "In this section, we describe a list of practical considerations for implementing LHTS, and include concrete pseudocode for our implementation.",
|
| 970 |
+
"bbox": [
|
| 971 |
+
84,
|
| 972 |
+
734,
|
| 973 |
+
473,
|
| 974 |
+
781
|
| 975 |
+
],
|
| 976 |
+
"page_idx": 4
|
| 977 |
+
},
|
| 978 |
+
{
|
| 979 |
+
"type": "text",
|
| 980 |
+
"text": "**Clipping** Even with a baseline to keep the exponents small, the importance weights still involve exponentiation. Therefore, the weights can become unstable when the log probabilities are much higher than the baseline or when the long horizon temperature is small. Therefore, we clip the log of the importance weights, introducing bias but reducing variance to help stabilize training.",
|
| 981 |
+
"bbox": [
|
| 982 |
+
84,
|
| 983 |
+
800,
|
| 984 |
+
475,
|
| 985 |
+
905
|
| 986 |
+
],
|
| 987 |
+
"page_idx": 4
|
| 988 |
+
},
|
| 989 |
+
{
|
| 990 |
+
"type": "text",
|
| 991 |
+
"text": "Data Sampling The LHTS objective is written as an expectation over samples from $p$ . We can indeed sample from $p$ in the training loop, although this empirically slowed down training by around a factor of 3 for autoregressive language models. In practice, we can assume that $p$ is close to the data distribution $p_{\\mathrm{data}}$ , and evaluate the LHTS objective using the training set $\\mathcal{D}$ . The weights of samples from $\\mathcal{D}$ are then computed using $p$ , which is faster than sampling from $p$ .",
|
| 992 |
+
"bbox": [
|
| 993 |
+
496,
|
| 994 |
+
84,
|
| 995 |
+
885,
|
| 996 |
+
205
|
| 997 |
+
],
|
| 998 |
+
"page_idx": 4
|
| 999 |
+
},
|
| 1000 |
+
{
|
| 1001 |
+
"type": "text",
|
| 1002 |
+
"text": "Multi-Temperature Finetuning In some of the experiments, we finetune a single weight-tied model on a set of discrete temperatures $T_{1} \\ldots T_{k}$ . Due to the differences in importance weights, more extreme temperatures incurred higher loss and hindered the training of other temperatures. Hence, we normalize the loss of each temperature to help with balanced training across the different temperatures.",
|
| 1003 |
+
"bbox": [
|
| 1004 |
+
496,
|
| 1005 |
+
224,
|
| 1006 |
+
885,
|
| 1007 |
+
330
|
| 1008 |
+
],
|
| 1009 |
+
"page_idx": 4
|
| 1010 |
+
},
|
| 1011 |
+
{
|
| 1012 |
+
"type": "text",
|
| 1013 |
+
"text": "KL Loss Following design choices of Quark (Lu et al., 2022), we include a KL loss to avoid diverging from the base model $p$ too much. However, empirically we did not observe differences from the inclusion of this auxiliary loss.",
|
| 1014 |
+
"bbox": [
|
| 1015 |
+
496,
|
| 1016 |
+
348,
|
| 1017 |
+
885,
|
| 1018 |
+
409
|
| 1019 |
+
],
|
| 1020 |
+
"page_idx": 4
|
| 1021 |
+
},
|
| 1022 |
+
{
|
| 1023 |
+
"type": "text",
|
| 1024 |
+
"text": "Streaming Statistics As written in Eq. 5 and Eq. 11, we choose the baseline to be the empirical mean of the data (suffix) log-likelihood. In practice, since the dataset could be very large (e.g. OpenWebText), we instead use the running mean of the data statistics as the baseline.",
|
| 1025 |
+
"bbox": [
|
| 1026 |
+
496,
|
| 1027 |
+
426,
|
| 1028 |
+
885,
|
| 1029 |
+
502
|
| 1030 |
+
],
|
| 1031 |
+
"page_idx": 4
|
| 1032 |
+
},
|
| 1033 |
+
{
|
| 1034 |
+
"type": "text",
|
| 1035 |
+
"text": "5.1. Pseudocode",
|
| 1036 |
+
"text_level": 1,
|
| 1037 |
+
"bbox": [
|
| 1038 |
+
496,
|
| 1039 |
+
518,
|
| 1040 |
+
612,
|
| 1041 |
+
534
|
| 1042 |
+
],
|
| 1043 |
+
"page_idx": 4
|
| 1044 |
+
},
|
| 1045 |
+
{
|
| 1046 |
+
"type": "text",
|
| 1047 |
+
"text": "Putting all the implementation details together, we present the pseudocode for LHTS finetuning in Alg. 1. We only present the variance-reduced LHTS for autoregressive models, since LHTS for diffusion models takes on a simpler form. The horizon likelihood is computed in lines 4&5, where $\\mathrm{RevCumSum}$ computes reverse cumulative sum, and $\\mathrm{pad}(\\mathbf{s}_{h:},\\mathbf{0}_{:h})$ appends a vector of $h$ zeros to the end of $\\mathbf{s}_h$ . Importantly, the weight in line 8 is tailored to each index of the context window, using the formulation derived from Section 4.2. On line 10, StopGradient prevents the loss normalization calculations from affecting the gradient computation. The algorithm outputs parameters for a weight-tied model for sampling from multiple long horizon temperatures. In practice, designing the temperature embeddings to be linearly constrained (Section 6.2) even allows extrapolation to temperatures unseen during training.",
|
| 1048 |
+
"bbox": [
|
| 1049 |
+
495,
|
| 1050 |
+
542,
|
| 1051 |
+
887,
|
| 1052 |
+
785
|
| 1053 |
+
],
|
| 1054 |
+
"page_idx": 4
|
| 1055 |
+
},
|
| 1056 |
+
{
|
| 1057 |
+
"type": "text",
|
| 1058 |
+
"text": "6. Experiments",
|
| 1059 |
+
"text_level": 1,
|
| 1060 |
+
"bbox": [
|
| 1061 |
+
496,
|
| 1062 |
+
804,
|
| 1063 |
+
629,
|
| 1064 |
+
821
|
| 1065 |
+
],
|
| 1066 |
+
"page_idx": 4
|
| 1067 |
+
},
|
| 1068 |
+
{
|
| 1069 |
+
"type": "text",
|
| 1070 |
+
"text": "We examine LHTS on three types of models: a diffusion-based image model (DDPM), an autoregressive character model, and an autoregressive language model (GPT-2 (Radford et al., 2019)). For diffusion models, we compare against a pseudo-temperature baseline that reduces the variance of",
|
| 1071 |
+
"bbox": [
|
| 1072 |
+
495,
|
| 1073 |
+
829,
|
| 1074 |
+
885,
|
| 1075 |
+
905
|
| 1076 |
+
],
|
| 1077 |
+
"page_idx": 4
|
| 1078 |
+
},
|
| 1079 |
+
{
|
| 1080 |
+
"type": "header",
|
| 1081 |
+
"text": "Long Horizon Temperature Scaling",
|
| 1082 |
+
"bbox": [
|
| 1083 |
+
372,
|
| 1084 |
+
56,
|
| 1085 |
+
599,
|
| 1086 |
+
71
|
| 1087 |
+
],
|
| 1088 |
+
"page_idx": 4
|
| 1089 |
+
},
|
| 1090 |
+
{
|
| 1091 |
+
"type": "page_number",
|
| 1092 |
+
"text": "5",
|
| 1093 |
+
"bbox": [
|
| 1094 |
+
480,
|
| 1095 |
+
922,
|
| 1096 |
+
491,
|
| 1097 |
+
934
|
| 1098 |
+
],
|
| 1099 |
+
"page_idx": 4
|
| 1100 |
+
},
|
| 1101 |
+
{
|
| 1102 |
+
"type": "text",
|
| 1103 |
+
"text": "Algorithm 1: LHTS Finetuning",
|
| 1104 |
+
"text_level": 1,
|
| 1105 |
+
"bbox": [
|
| 1106 |
+
98,
|
| 1107 |
+
88,
|
| 1108 |
+
310,
|
| 1109 |
+
103
|
| 1110 |
+
],
|
| 1111 |
+
"page_idx": 5
|
| 1112 |
+
},
|
| 1113 |
+
{
|
| 1114 |
+
"type": "text",
|
| 1115 |
+
"text": "Input: Training data $\\mathcal{D}$ , model $p_{\\phi}$ , temperatures $\\{T_1,\\dots ,T_k\\}$ , clip $c$ , suffix horizon $h$",
|
| 1116 |
+
"bbox": [
|
| 1117 |
+
109,
|
| 1118 |
+
106,
|
| 1119 |
+
429,
|
| 1120 |
+
136
|
| 1121 |
+
],
|
| 1122 |
+
"page_idx": 5
|
| 1123 |
+
},
|
| 1124 |
+
{
|
| 1125 |
+
"type": "text",
|
| 1126 |
+
"text": "Output: Parameters $\\theta$ for LHTS weight-tied models $q_{T_1}\\ldots q_{T_k}$",
|
| 1127 |
+
"bbox": [
|
| 1128 |
+
109,
|
| 1129 |
+
136,
|
| 1130 |
+
406,
|
| 1131 |
+
166
|
| 1132 |
+
],
|
| 1133 |
+
"page_idx": 5
|
| 1134 |
+
},
|
| 1135 |
+
{
|
| 1136 |
+
"type": "list",
|
| 1137 |
+
"sub_type": "text",
|
| 1138 |
+
"list_items": [
|
| 1139 |
+
"1 $\\mathbf{b},\\mathbf{m},n,\\theta \\leftarrow \\mathbf{0},\\mathbf{0},0,\\phi$",
|
| 1140 |
+
"2 while training do"
|
| 1141 |
+
],
|
| 1142 |
+
"bbox": [
|
| 1143 |
+
122,
|
| 1144 |
+
167,
|
| 1145 |
+
289,
|
| 1146 |
+
195
|
| 1147 |
+
],
|
| 1148 |
+
"page_idx": 5
|
| 1149 |
+
},
|
| 1150 |
+
{
|
| 1151 |
+
"type": "list",
|
| 1152 |
+
"sub_type": "text",
|
| 1153 |
+
"list_items": [
|
| 1154 |
+
"/* Sample training data and temperature $T_{j}$ */ 3 $x\\sim \\mathcal{D}\\qquad j\\sim \\mathcal{U}(1,k)$",
|
| 1155 |
+
"/* Compute suffix log likelihood */",
|
| 1156 |
+
"4 s← RevCumSum(logp(xi|x<))",
|
| 1157 |
+
"/* Limit suffix horizon */",
|
| 1158 |
+
"s s←s- pad(sh.:0:h)",
|
| 1159 |
+
"/* Update streaming statistics */",
|
| 1160 |
+
"6 $n\\gets n + 1$ $\\mathbf{b}\\leftarrow \\mathbf{b} + \\mathbf{s}$"
|
| 1161 |
+
],
|
| 1162 |
+
"bbox": [
|
| 1163 |
+
122,
|
| 1164 |
+
196,
|
| 1165 |
+
450,
|
| 1166 |
+
314
|
| 1167 |
+
],
|
| 1168 |
+
"page_idx": 5
|
| 1169 |
+
},
|
| 1170 |
+
{
|
| 1171 |
+
"type": "list",
|
| 1172 |
+
"sub_type": "text",
|
| 1173 |
+
"list_items": [
|
| 1174 |
+
"/* Compute LHTS importance weights */",
|
| 1175 |
+
"7 $\\mathbf{w}\\gets \\exp (\\min (\\frac{1 - T_j}{T_j} (\\mathbf{s} - \\frac{\\mathbf{b}}{n}),c))$",
|
| 1176 |
+
"/* Compute index-weighted log loss */",
|
| 1177 |
+
"8 $\\mathcal{L}\\gets -\\sum_{i}\\mathbf{w}_{i}\\log q_{T_{j},\\theta}(x_{i}|x_{< i})$",
|
| 1178 |
+
"/* Compute KL Loss */",
|
| 1179 |
+
"9 $\\kappa \\gets \\sum_{i}D_{KL}(p_{\\phi}(\\cdot |x_{< i})||q_{T_j,\\theta}(\\cdot |x_{< i}))$",
|
| 1180 |
+
"/*Normalize loss for each temperature */",
|
| 1181 |
+
"10 | $\\mathbf{m}_j \\gets \\mathbf{m}_j + \\text{StopGradient}(\\mathcal{L} + \\beta \\mathcal{K})$",
|
| 1182 |
+
"/* Update model parameters */",
|
| 1183 |
+
"$\\mathbf{u} \\mid \\theta \\gets \\theta - \\nabla_{\\theta}(\\mathbf{m}_j / n)^{-1}(\\mathcal{L} + \\beta \\mathcal{K})$"
|
| 1184 |
+
],
|
| 1185 |
+
"bbox": [
|
| 1186 |
+
122,
|
| 1187 |
+
316,
|
| 1188 |
+
450,
|
| 1189 |
+
470
|
| 1190 |
+
],
|
| 1191 |
+
"page_idx": 5
|
| 1192 |
+
},
|
| 1193 |
+
{
|
| 1194 |
+
"type": "text",
|
| 1195 |
+
"text": "Return: $\\theta$",
|
| 1196 |
+
"bbox": [
|
| 1197 |
+
112,
|
| 1198 |
+
470,
|
| 1199 |
+
186,
|
| 1200 |
+
483
|
| 1201 |
+
],
|
| 1202 |
+
"page_idx": 5
|
| 1203 |
+
},
|
| 1204 |
+
{
|
| 1205 |
+
"type": "text",
|
| 1206 |
+
"text": "the diffusion noise. For autoregressive models, we compare against myopic temperature scaling. We aim to show that LHTS can generate samples with higher likelihood and more diversity, compared to the baseline temperature scaling methods. Finally, we test the practical benefits of the LHTS language model on a multiple choice task.",
|
| 1207 |
+
"bbox": [
|
| 1208 |
+
84,
|
| 1209 |
+
525,
|
| 1210 |
+
475,
|
| 1211 |
+
617
|
| 1212 |
+
],
|
| 1213 |
+
"page_idx": 5
|
| 1214 |
+
},
|
| 1215 |
+
{
|
| 1216 |
+
"type": "text",
|
| 1217 |
+
"text": "6.1. Diffusion Image Model",
|
| 1218 |
+
"text_level": 1,
|
| 1219 |
+
"bbox": [
|
| 1220 |
+
84,
|
| 1221 |
+
633,
|
| 1222 |
+
279,
|
| 1223 |
+
648
|
| 1224 |
+
],
|
| 1225 |
+
"page_idx": 5
|
| 1226 |
+
},
|
| 1227 |
+
{
|
| 1228 |
+
"type": "text",
|
| 1229 |
+
"text": "First, we apply LHTS on diffusion image models. Training diffusion models from scratch can be compute intensive, so we instead take a pretrained DDPM (Ho et al., 2020) and finetune with the LHTS objective. We compute the ELBO of each image in the CIFAR-10 (Krizhevsky et al., 2009) training set with respect to the pretrained DDPM in joint space (i.e., without dividing by the number of dimensions) and compute the LHTS importance weight of each image. Then, we finetune for 50000 steps using the DDPM objective in Eq. 9 scaled by the computed importance weights.",
|
| 1230 |
+
"bbox": [
|
| 1231 |
+
84,
|
| 1232 |
+
656,
|
| 1233 |
+
473,
|
| 1234 |
+
808
|
| 1235 |
+
],
|
| 1236 |
+
"page_idx": 5
|
| 1237 |
+
},
|
| 1238 |
+
{
|
| 1239 |
+
"type": "text",
|
| 1240 |
+
"text": "Since there is no natural temperature scaling baseline for diffusion models, we compare against a pseudo-temperature scaling of the diffusion model by reducing the noise variance. At each step of the reverse diffusion process, we sample a noise vector from a Gaussian $\\mathcal{N}(0,t)$ , where the pseudo-temperature $t$ is controls the standard deviation of",
|
| 1241 |
+
"bbox": [
|
| 1242 |
+
84,
|
| 1243 |
+
814,
|
| 1244 |
+
475,
|
| 1245 |
+
906
|
| 1246 |
+
],
|
| 1247 |
+
"page_idx": 5
|
| 1248 |
+
},
|
| 1249 |
+
{
|
| 1250 |
+
"type": "image",
|
| 1251 |
+
"img_path": "images/9535e7f919d644a24b7b9439bae49aff3fd97d0575a7e8a3cff3aa06bbbaaea0.jpg",
|
| 1252 |
+
"image_caption": [
|
| 1253 |
+
"Figure 2. Temperature scaling on diffusion models for CIFAR-10. The black dots form the Pareto frontier of pseudo-temperature scaling on DDPM (with pseudo-temperatures 0.99, 0.985, and 0.98), and the orange shows long horizon temperature scaling via finetuning (with long horizon temperatures 0.999, 0.995, 0.99). The x-axis plots log likelihood and y-axis plots negative FID score using 50k samples. Towards the top right of the chart is better."
|
| 1254 |
+
],
|
| 1255 |
+
"image_footnote": [],
|
| 1256 |
+
"bbox": [
|
| 1257 |
+
498,
|
| 1258 |
+
82,
|
| 1259 |
+
883,
|
| 1260 |
+
219
|
| 1261 |
+
],
|
| 1262 |
+
"page_idx": 5
|
| 1263 |
+
},
|
| 1264 |
+
{
|
| 1265 |
+
"type": "image",
|
| 1266 |
+
"img_path": "images/05302ef1e0b01eea66889f69a788a9b3807e35399f2fd3ad0042adac7bd31863.jpg",
|
| 1267 |
+
"image_caption": [
|
| 1268 |
+
"Figure 3. Generated image samples from temperature scaled DDPM. Left: pseudo-temperature scaling, with worse FID score 3.94 and lower sample likelihood $-3.09$ . Right: LHTS, with better FID score 3.66 and higher sample likelihood $-3.07$ ."
|
| 1269 |
+
],
|
| 1270 |
+
"image_footnote": [],
|
| 1271 |
+
"bbox": [
|
| 1272 |
+
500,
|
| 1273 |
+
351,
|
| 1274 |
+
687,
|
| 1275 |
+
390
|
| 1276 |
+
],
|
| 1277 |
+
"page_idx": 5
|
| 1278 |
+
},
|
| 1279 |
+
{
|
| 1280 |
+
"type": "image",
|
| 1281 |
+
"img_path": "images/2d1fae65a96303638185027eed5073e452167c6189c37ed4e2b42db38721b800.jpg",
|
| 1282 |
+
"image_caption": [],
|
| 1283 |
+
"image_footnote": [],
|
| 1284 |
+
"bbox": [
|
| 1285 |
+
697,
|
| 1286 |
+
351,
|
| 1287 |
+
885,
|
| 1288 |
+
390
|
| 1289 |
+
],
|
| 1290 |
+
"page_idx": 5
|
| 1291 |
+
},
|
| 1292 |
+
{
|
| 1293 |
+
"type": "text",
|
| 1294 |
+
"text": "the noise. By using a smaller noise variance, we hope to push the Langevin sampling process to converge to images with higher likelihood, though at the cost of distorting the marginal distribution at each timestep.",
|
| 1295 |
+
"bbox": [
|
| 1296 |
+
495,
|
| 1297 |
+
494,
|
| 1298 |
+
885,
|
| 1299 |
+
556
|
| 1300 |
+
],
|
| 1301 |
+
"page_idx": 5
|
| 1302 |
+
},
|
| 1303 |
+
{
|
| 1304 |
+
"type": "text",
|
| 1305 |
+
"text": "To compare LHTS and pseudo-temperature, we plot the log-likelihood of samples and the FID score of the temperature-scaled models. Ideally, a temperature-scaled model should output samples that evaluate as more likely under the pretrained model distribution, without sacrificing too much diversity. In Figure 2, we see that the LHTS model is able to beat the Pareto frontier of pseudo-temperature scaled models, where diversity is measured with the negative FID score. We plot uncurated samples in Figure 3. Even though both pseudo-temperature scaling and LHTS can push the model into sampling images with higher likelihood (with respect to the pretrained model), LHTS is able to do so while sacrificing less of generation quality and diversity.",
|
| 1306 |
+
"bbox": [
|
| 1307 |
+
495,
|
| 1308 |
+
563,
|
| 1309 |
+
885,
|
| 1310 |
+
760
|
| 1311 |
+
],
|
| 1312 |
+
"page_idx": 5
|
| 1313 |
+
},
|
| 1314 |
+
{
|
| 1315 |
+
"type": "text",
|
| 1316 |
+
"text": "6.2. Autoregressive Character Model",
|
| 1317 |
+
"text_level": 1,
|
| 1318 |
+
"bbox": [
|
| 1319 |
+
496,
|
| 1320 |
+
776,
|
| 1321 |
+
758,
|
| 1322 |
+
791
|
| 1323 |
+
],
|
| 1324 |
+
"page_idx": 5
|
| 1325 |
+
},
|
| 1326 |
+
{
|
| 1327 |
+
"type": "text",
|
| 1328 |
+
"text": "Next, we experiment with a transformer-based autoregressive character model on the Text8 dataset (Mahoney, 2011). Though character modeling is an easier task than language modeling, it provides useful insights on the differences between LHTS and myopic temperature scaling. In particular, it allows us to experiment with training a weight-tied model for a continuous range of long horizon temperatures.",
|
| 1329 |
+
"bbox": [
|
| 1330 |
+
495,
|
| 1331 |
+
799,
|
| 1332 |
+
888,
|
| 1333 |
+
906
|
| 1334 |
+
],
|
| 1335 |
+
"page_idx": 5
|
| 1336 |
+
},
|
| 1337 |
+
{
|
| 1338 |
+
"type": "header",
|
| 1339 |
+
"text": "Long Horizon Temperature Scaling",
|
| 1340 |
+
"bbox": [
|
| 1341 |
+
372,
|
| 1342 |
+
56,
|
| 1343 |
+
599,
|
| 1344 |
+
70
|
| 1345 |
+
],
|
| 1346 |
+
"page_idx": 5
|
| 1347 |
+
},
|
| 1348 |
+
{
|
| 1349 |
+
"type": "page_number",
|
| 1350 |
+
"text": "6",
|
| 1351 |
+
"bbox": [
|
| 1352 |
+
480,
|
| 1353 |
+
922,
|
| 1354 |
+
491,
|
| 1355 |
+
934
|
| 1356 |
+
],
|
| 1357 |
+
"page_idx": 5
|
| 1358 |
+
},
|
| 1359 |
+
{
|
| 1360 |
+
"type": "image",
|
| 1361 |
+
"img_path": "images/a617bc21d6fa4329c9385b1ee09b37dee3d57c395e11f27781697a43fb08d4b3.jpg",
|
| 1362 |
+
"image_caption": [
|
| 1363 |
+
"Figure 4. Autoregressive character model with a tunable long horizon temperature parameter. The heatmap shows log-likelihood of samples over various settings of long horizon and myopic temperature. Tuning both temperatures (orange) allows us to increase the likelihood more than just tuning the myopic temperature (blue). More importantly, we achieve a better trade-off between likelihood and diversity. The orange setting gives a higher likelihood with noticeably diverse chunks of text, whereas the blue setting gives lower likelihood yet gives many repetitive generations."
|
| 1364 |
+
],
|
| 1365 |
+
"image_footnote": [],
|
| 1366 |
+
"bbox": [
|
| 1367 |
+
91,
|
| 1368 |
+
80,
|
| 1369 |
+
472,
|
| 1370 |
+
281
|
| 1371 |
+
],
|
| 1372 |
+
"page_idx": 6
|
| 1373 |
+
},
|
| 1374 |
+
{
|
| 1375 |
+
"type": "text",
|
| 1376 |
+
"text": "Continuous Temperature LHTS Our goal is to train a model that can be deployed with a \"knob\" for controlling the long horizon temperature, similar to how existing autoregressive models in deployment (e.g. GPT) give users control over the myopic temperature.",
|
| 1377 |
+
"bbox": [
|
| 1378 |
+
84,
|
| 1379 |
+
445,
|
| 1380 |
+
475,
|
| 1381 |
+
521
|
| 1382 |
+
],
|
| 1383 |
+
"page_idx": 6
|
| 1384 |
+
},
|
| 1385 |
+
{
|
| 1386 |
+
"type": "text",
|
| 1387 |
+
"text": "We first train a base 12-layer Transformer model from scratch, and store this model $p$ to use for computing LHTS importance weights. Then, we finetune a copy $q_{T}$ of this model with the LHTS objective on a continuous range of long horizon temperatures. To do so, we place the long horizon temperature (a scalar) as a special token at the beginning of the transformer's context window. We then learn a linear embedding $r$ to map this prefix temperature token into the transformer's embedding space. Finally, we place the training data into the remaining context positions, and train with the LHTS objective. In other words, the prefix token of the long horizon temperature informs the transformer how \"sharp\" the predicted distribution should be.",
|
| 1388 |
+
"bbox": [
|
| 1389 |
+
84,
|
| 1390 |
+
527,
|
| 1391 |
+
475,
|
| 1392 |
+
724
|
| 1393 |
+
],
|
| 1394 |
+
"page_idx": 6
|
| 1395 |
+
},
|
| 1396 |
+
{
|
| 1397 |
+
"type": "text",
|
| 1398 |
+
"text": "Since choosing small temperatures can lead to large importance weights, we only vary the training temperature from 0.9 to 1.1. Nevertheless, at deployment time we can still feed temperatures beyond the training range into the learned linear embedding $r$ , and push the model to extrapolate to unseen long horizon temperatures. Surprisingly, we find that the model extrapolates smoothly (Figure 4), with the sample likelihood steadily improving when feeding in long horizon temperatures much less than 0.9 (leftward on the x-axis) into the prefix temperature token.",
|
| 1399 |
+
"bbox": [
|
| 1400 |
+
84,
|
| 1401 |
+
732,
|
| 1402 |
+
475,
|
| 1403 |
+
883
|
| 1404 |
+
],
|
| 1405 |
+
"page_idx": 6
|
| 1406 |
+
},
|
| 1407 |
+
{
|
| 1408 |
+
"type": "text",
|
| 1409 |
+
"text": "With a knob for the long horizon temperature, we can tweak",
|
| 1410 |
+
"bbox": [
|
| 1411 |
+
84,
|
| 1412 |
+
890,
|
| 1413 |
+
473,
|
| 1414 |
+
905
|
| 1415 |
+
],
|
| 1416 |
+
"page_idx": 6
|
| 1417 |
+
},
|
| 1418 |
+
{
|
| 1419 |
+
"type": "text",
|
| 1420 |
+
"text": "both the long horizon and the myopic temperature in unison. For example, in Figure 4 we consider two settings of tuning the long horizon temperature to 0.1 and myopic temperature to 0.3 (orange), versus tuning just the myopic temperature to 0.1 (blue). The orange setting gives an average sample likelihood of $-0.97$ w.r.t. $p$ , which is better than $-1.05$ w.r.t. $p$ for the blue setting. On top of that, the orange setting generates much more diverse character chunks<sup>1</sup>, whereas the blue setting repeatedly outputs the same few character chunks. This aligns with the intuition that LHTS can \"look ahead\" to find many diverse sequences of high likelihood, whereas myopic temperature scaling can only greedily choose the next token, leading to low diversity.",
|
| 1421 |
+
"bbox": [
|
| 1422 |
+
496,
|
| 1423 |
+
84,
|
| 1424 |
+
888,
|
| 1425 |
+
282
|
| 1426 |
+
],
|
| 1427 |
+
"page_idx": 6
|
| 1428 |
+
},
|
| 1429 |
+
{
|
| 1430 |
+
"type": "text",
|
| 1431 |
+
"text": "6.3. Autoregressive Language Model",
|
| 1432 |
+
"text_level": 1,
|
| 1433 |
+
"bbox": [
|
| 1434 |
+
496,
|
| 1435 |
+
297,
|
| 1436 |
+
756,
|
| 1437 |
+
313
|
| 1438 |
+
],
|
| 1439 |
+
"page_idx": 6
|
| 1440 |
+
},
|
| 1441 |
+
{
|
| 1442 |
+
"type": "text",
|
| 1443 |
+
"text": "Lastly, we demonstrate the scalability of LHTS on various sizes of the GPT-2 (small, medium, large) language model. As before, we take a pretrained model to compute LHTS importance weights, and finetune a copy of it using the LHTS objective. We use the standard GPT-2 architecture and context window of 1024, with pretrained weights from HuggingFace (Wolf et al., 2020), and finetune on the OpenWebText (Gokaslan & Cohen, 2019) corpus.",
|
| 1444 |
+
"bbox": [
|
| 1445 |
+
495,
|
| 1446 |
+
321,
|
| 1447 |
+
887,
|
| 1448 |
+
443
|
| 1449 |
+
],
|
| 1450 |
+
"page_idx": 6
|
| 1451 |
+
},
|
| 1452 |
+
{
|
| 1453 |
+
"type": "text",
|
| 1454 |
+
"text": "We compare with two baselines: myopic temperature scaling, and a partition-based controllable generation approach (Quark) (Lu et al., 2022). Quark was introduced as a conditional generation approach for controlling the level of toxicity of the language model, but can be similarly applied for controlling sample likelihood of the model.",
|
| 1455 |
+
"bbox": [
|
| 1456 |
+
495,
|
| 1457 |
+
449,
|
| 1458 |
+
888,
|
| 1459 |
+
540
|
| 1460 |
+
],
|
| 1461 |
+
"page_idx": 6
|
| 1462 |
+
},
|
| 1463 |
+
{
|
| 1464 |
+
"type": "text",
|
| 1465 |
+
"text": "When comparing different approaches for temperature scaling, we consider both the likelihood and the quality of the generated samples. We can measure the likelihood of the generated samples by directly evaluating them on the pretrained model. For sample quality, and we rely on quantitative evaluation using diversity metrics (Welleck et al., 2019; Liang et al., 2022) and a multiple-choice task (Mikolov et al., 2013), where temperature scaling is commonly used to reduce the randomness of the model's answers.",
|
| 1466 |
+
"bbox": [
|
| 1467 |
+
495,
|
| 1468 |
+
547,
|
| 1469 |
+
888,
|
| 1470 |
+
683
|
| 1471 |
+
],
|
| 1472 |
+
"page_idx": 6
|
| 1473 |
+
},
|
| 1474 |
+
{
|
| 1475 |
+
"type": "text",
|
| 1476 |
+
"text": "In Figure 5a, we plot the sample diversity (measured by token-level repetition) and the log-likelihood over 1k sequences of context 1024 for each temperature scale. In each of the three charts (for GPT2 small/medium/large), we see the Pareto frontier of circles formed by the myopic temperature scaling baseline with temperature ranging from 0.75 to 0.8. Using LHTS, plotted by triangles, we can achieve a better trade-off between diversity and likelihood, especially for GPT2-medium and GPT2-large. The partition (Quark) baseline is not visible since the repetition values are worse and do not reside within the bounds of the chart.",
|
| 1477 |
+
"bbox": [
|
| 1478 |
+
495,
|
| 1479 |
+
691,
|
| 1480 |
+
887,
|
| 1481 |
+
857
|
| 1482 |
+
],
|
| 1483 |
+
"page_idx": 6
|
| 1484 |
+
},
|
| 1485 |
+
{
|
| 1486 |
+
"type": "header",
|
| 1487 |
+
"text": "Long Horizon Temperature Scaling",
|
| 1488 |
+
"bbox": [
|
| 1489 |
+
372,
|
| 1490 |
+
56,
|
| 1491 |
+
599,
|
| 1492 |
+
70
|
| 1493 |
+
],
|
| 1494 |
+
"page_idx": 6
|
| 1495 |
+
},
|
| 1496 |
+
{
|
| 1497 |
+
"type": "page_footnote",
|
| 1498 |
+
"text": "<sup>1</sup>The model is trained on randomly cropped chunks of character, hence the samples appear to be cropped.",
|
| 1499 |
+
"bbox": [
|
| 1500 |
+
496,
|
| 1501 |
+
864,
|
| 1502 |
+
887,
|
| 1503 |
+
892
|
| 1504 |
+
],
|
| 1505 |
+
"page_idx": 6
|
| 1506 |
+
},
|
| 1507 |
+
{
|
| 1508 |
+
"type": "page_number",
|
| 1509 |
+
"text": "7",
|
| 1510 |
+
"bbox": [
|
| 1511 |
+
480,
|
| 1512 |
+
922,
|
| 1513 |
+
491,
|
| 1514 |
+
934
|
| 1515 |
+
],
|
| 1516 |
+
"page_idx": 6
|
| 1517 |
+
},
|
| 1518 |
+
{
|
| 1519 |
+
"type": "image",
|
| 1520 |
+
"img_path": "images/0db59c978f05fdcbeb23c2a0b494361c3c5c37b7b97310239d38b246193c0b9f.jpg",
|
| 1521 |
+
"image_caption": [
|
| 1522 |
+
"Figure 5. Likelihood and sample quality metrics for temperature-scaled GPT-2."
|
| 1523 |
+
],
|
| 1524 |
+
"image_footnote": [
|
| 1525 |
+
"(a) Plot of the Pareto frontier between repetitiveness of text and log-likelihood of text for GPT-2 models: small (pink), medium (red), large (maroon). Circles show myopic temperatures of 0.8, 0.775, 0.75. Triangles show LHTS temperature of 0.95. Towards the top right of the charts is better."
|
| 1526 |
+
],
|
| 1527 |
+
"bbox": [
|
| 1528 |
+
84,
|
| 1529 |
+
80,
|
| 1530 |
+
277,
|
| 1531 |
+
210
|
| 1532 |
+
],
|
| 1533 |
+
"page_idx": 7
|
| 1534 |
+
},
|
| 1535 |
+
{
|
| 1536 |
+
"type": "image",
|
| 1537 |
+
"img_path": "images/9a70e7e3c6af696c7abb13e8df4a090f286d77a2e2719f7d33862ea3f2feae1c.jpg",
|
| 1538 |
+
"image_caption": [],
|
| 1539 |
+
"image_footnote": [],
|
| 1540 |
+
"bbox": [
|
| 1541 |
+
282,
|
| 1542 |
+
80,
|
| 1543 |
+
473,
|
| 1544 |
+
210
|
| 1545 |
+
],
|
| 1546 |
+
"page_idx": 7
|
| 1547 |
+
},
|
| 1548 |
+
{
|
| 1549 |
+
"type": "image",
|
| 1550 |
+
"img_path": "images/fc48949c6dfb654a5ecbd5151b885dfd1c3f1e1b16fe9005dda1197d9727232d.jpg",
|
| 1551 |
+
"image_caption": [],
|
| 1552 |
+
"image_footnote": [],
|
| 1553 |
+
"bbox": [
|
| 1554 |
+
480,
|
| 1555 |
+
80,
|
| 1556 |
+
669,
|
| 1557 |
+
210
|
| 1558 |
+
],
|
| 1559 |
+
"page_idx": 7
|
| 1560 |
+
},
|
| 1561 |
+
{
|
| 1562 |
+
"type": "image",
|
| 1563 |
+
"img_path": "images/aee81a128d1b71cccd2f794aaf0926bbdf1ac8ee95f83060378bb44c5d60f442.jpg",
|
| 1564 |
+
"image_caption": [],
|
| 1565 |
+
"image_footnote": [
|
| 1566 |
+
"(b) Visualizing the best settings from Table 1. Circle: myopic, Cross:Quark, Triangle:LHTS"
|
| 1567 |
+
],
|
| 1568 |
+
"bbox": [
|
| 1569 |
+
691,
|
| 1570 |
+
80,
|
| 1571 |
+
883,
|
| 1572 |
+
209
|
| 1573 |
+
],
|
| 1574 |
+
"page_idx": 7
|
| 1575 |
+
},
|
| 1576 |
+
{
|
| 1577 |
+
"type": "table",
|
| 1578 |
+
"img_path": "images/2d37ef798aafcbb03c07b982a9ea44f74fdd3549ded9f36a9181413ec8cba76f.jpg",
|
| 1579 |
+
"table_caption": [
|
| 1580 |
+
"Table 1. Accuracy of temperature-scaled GPT-2 on a multiple choice analogy task. Turning the myopic temperature down decreases the chance of irrelevant answers. At the lowest myopic temperature, LHTS generally improves upon the accuracy of the pretrained model."
|
| 1581 |
+
],
|
| 1582 |
+
"table_footnote": [],
|
| 1583 |
+
"table_body": "<table><tr><td rowspan=\"2\"></td><td rowspan=\"2\">model myopic T</td><td colspan=\"3\">gpt2 small</td><td colspan=\"3\">gpt2 medium</td><td colspan=\"3\">gpt2 large</td></tr><tr><td>1.0</td><td>0.5</td><td>0.0</td><td>1.0</td><td>0.5</td><td>0.0</td><td>1.0</td><td>0.5</td><td>0.0</td></tr><tr><td rowspan=\"3\">distinct</td><td>LHTST=0.95</td><td>0.172</td><td>0.238</td><td>0.255</td><td>0.185</td><td>0.242</td><td>0.252</td><td>0.179</td><td>0.225</td><td>0.232</td></tr><tr><td>pretrained</td><td>0.143</td><td>0.231</td><td>0.254</td><td>0.156</td><td>0.220</td><td>0.233</td><td>0.142</td><td>0.218</td><td>0.228</td></tr><tr><td>partition (Quark)</td><td>0.111</td><td>0.201</td><td>0.233</td><td>0.155</td><td>0.219</td><td>0.232</td><td>0.158</td><td>0.229</td><td>0.250</td></tr><tr><td rowspan=\"3\">duplicale</td><td>LHTST=0.95</td><td>0.177</td><td>0.224</td><td>0.230</td><td>0.225</td><td>0.270</td><td>0.275</td><td>0.249</td><td>0.310</td><td>0.317</td></tr><tr><td>pretrained</td><td>0.189</td><td>0.267</td><td>0.275</td><td>0.200</td><td>0.262</td><td>0.264</td><td>0.203</td><td>0.279</td><td>0.290</td></tr><tr><td>partition (Quark)</td><td>0.137</td><td>0.221</td><td>0.233</td><td>0.197</td><td>0.264</td><td>0.270</td><td>0.213</td><td>0.279</td><td>0.285</td></tr></table>",
|
| 1584 |
+
"bbox": [
|
| 1585 |
+
125,
|
| 1586 |
+
335,
|
| 1587 |
+
846,
|
| 1588 |
+
477
|
| 1589 |
+
],
|
| 1590 |
+
"page_idx": 7
|
| 1591 |
+
},
|
| 1592 |
+
{
|
| 1593 |
+
"type": "text",
|
| 1594 |
+
"text": "Analogy Multiple Choice We evaluate the generation quality of LHTS on a downstream multiple-choice task that tests the model's ability to choose correct analogies. We create a set of 1400 questions from a bank of analogies (Mikolov et al., 2013) with relationships such as country:capital, present-tense:past-tense, male:female. We prompt GPT-2 using the following format, including three similar examples in-context:",
|
| 1595 |
+
"bbox": [
|
| 1596 |
+
84,
|
| 1597 |
+
503,
|
| 1598 |
+
475,
|
| 1599 |
+
622
|
| 1600 |
+
],
|
| 1601 |
+
"page_idx": 7
|
| 1602 |
+
},
|
| 1603 |
+
{
|
| 1604 |
+
"type": "text",
|
| 1605 |
+
"text": "Question: Please choose the word pair that is most analogous to \"Algeria dinar\".",
|
| 1606 |
+
"bbox": [
|
| 1607 |
+
84,
|
| 1608 |
+
625,
|
| 1609 |
+
467,
|
| 1610 |
+
638
|
| 1611 |
+
],
|
| 1612 |
+
"page_idx": 7
|
| 1613 |
+
},
|
| 1614 |
+
{
|
| 1615 |
+
"type": "text",
|
| 1616 |
+
"text": "Choices: \"Macedonia dollar\", \"Vietnam baht\", \"Bulgaria lev\", \"Armenia naira\" \nAnswer:",
|
| 1617 |
+
"bbox": [
|
| 1618 |
+
84,
|
| 1619 |
+
640,
|
| 1620 |
+
468,
|
| 1621 |
+
667
|
| 1622 |
+
],
|
| 1623 |
+
"page_idx": 7
|
| 1624 |
+
},
|
| 1625 |
+
{
|
| 1626 |
+
"type": "text",
|
| 1627 |
+
"text": "To measure correctness, we check the next 8 generated tokens for a unique match with the correct choice, ignoring double matches. We also create a variant of questions where three of the choices share the first word, inspired by the example in Figure 1. The three duplicates are chosen independently from (and can include) the correct choice.",
|
| 1628 |
+
"bbox": [
|
| 1629 |
+
84,
|
| 1630 |
+
676,
|
| 1631 |
+
473,
|
| 1632 |
+
766
|
| 1633 |
+
],
|
| 1634 |
+
"page_idx": 7
|
| 1635 |
+
},
|
| 1636 |
+
{
|
| 1637 |
+
"type": "text",
|
| 1638 |
+
"text": "Question: Please choose the word pair that is most analogous to \"Athens Greece\".",
|
| 1639 |
+
"bbox": [
|
| 1640 |
+
84,
|
| 1641 |
+
768,
|
| 1642 |
+
470,
|
| 1643 |
+
782
|
| 1644 |
+
],
|
| 1645 |
+
"page_idx": 7
|
| 1646 |
+
},
|
| 1647 |
+
{
|
| 1648 |
+
"type": "text",
|
| 1649 |
+
"text": "Choices: \"Moscow Japan\", \"Rome Italy\", \"Moscow Pakistan\", \"Moscow Australia\" \nAnswer:",
|
| 1650 |
+
"bbox": [
|
| 1651 |
+
84,
|
| 1652 |
+
784,
|
| 1653 |
+
472,
|
| 1654 |
+
810
|
| 1655 |
+
],
|
| 1656 |
+
"page_idx": 7
|
| 1657 |
+
},
|
| 1658 |
+
{
|
| 1659 |
+
"type": "text",
|
| 1660 |
+
"text": "In Table 1 we present the accuracy of GPT-2 on this analogy multiple-choice task. The row distinct refers to the first set of questions, and the row duplicate refers to the second set of questions with common first words. For each question we sample the model 50 times. The accuracy improves across",
|
| 1661 |
+
"bbox": [
|
| 1662 |
+
84,
|
| 1663 |
+
819,
|
| 1664 |
+
473,
|
| 1665 |
+
895
|
| 1666 |
+
],
|
| 1667 |
+
"page_idx": 7
|
| 1668 |
+
},
|
| 1669 |
+
{
|
| 1670 |
+
"type": "text",
|
| 1671 |
+
"text": "the board as we scale down the myopic temperature from 1.0 to 0.0, since all models reduce the chance of outputting irrelevant answers. At the best myopic temperature of 0.0, LHTS gives the highest accuracy in 4/6 settings, with $10\\%$ improvement to give $31\\%$ accuracy on the most competitive setting with the duplicate question set and GPT2 large. We also see that using Quark to condition on joint likelihood is less effective on average, possibly because partitioning full sequences based on joint likelihood is more crude than a suffix-dependent rescaling (Section 4.2), and reinforcing based on likelihood was noticeably unstable during training.",
|
| 1672 |
+
"bbox": [
|
| 1673 |
+
495,
|
| 1674 |
+
503,
|
| 1675 |
+
885,
|
| 1676 |
+
669
|
| 1677 |
+
],
|
| 1678 |
+
"page_idx": 7
|
| 1679 |
+
},
|
| 1680 |
+
{
|
| 1681 |
+
"type": "text",
|
| 1682 |
+
"text": "7. Conclusion",
|
| 1683 |
+
"text_level": 1,
|
| 1684 |
+
"bbox": [
|
| 1685 |
+
496,
|
| 1686 |
+
688,
|
| 1687 |
+
614,
|
| 1688 |
+
704
|
| 1689 |
+
],
|
| 1690 |
+
"page_idx": 7
|
| 1691 |
+
},
|
| 1692 |
+
{
|
| 1693 |
+
"type": "text",
|
| 1694 |
+
"text": "We present Long Horizon Temperature Scaling, a novel and tractable approach to sampling from temperature-scaled joint distributions. Compared to previous methods, LHTS is non-myopic and compatible with all likelihood-based generative models. To reduce the variance of the LHTS objective, we introduce important techniques such as fitting baselines and limiting suffix horizon lengths. In some settings, LHTS even shows smooth extrapolation to unseen temperatures, enabling low-variance training on mild temperatures and sampling on extreme temperatures. We demonstrate the applicability of LHTS on diffusion and autoregressive models in image and language domains. LHTS shows improve",
|
| 1695 |
+
"bbox": [
|
| 1696 |
+
495,
|
| 1697 |
+
714,
|
| 1698 |
+
887,
|
| 1699 |
+
895
|
| 1700 |
+
],
|
| 1701 |
+
"page_idx": 7
|
| 1702 |
+
},
|
| 1703 |
+
{
|
| 1704 |
+
"type": "header",
|
| 1705 |
+
"text": "Long Horizon Temperature Scaling",
|
| 1706 |
+
"bbox": [
|
| 1707 |
+
372,
|
| 1708 |
+
56,
|
| 1709 |
+
599,
|
| 1710 |
+
70
|
| 1711 |
+
],
|
| 1712 |
+
"page_idx": 7
|
| 1713 |
+
},
|
| 1714 |
+
{
|
| 1715 |
+
"type": "page_number",
|
| 1716 |
+
"text": "8",
|
| 1717 |
+
"bbox": [
|
| 1718 |
+
480,
|
| 1719 |
+
922,
|
| 1720 |
+
491,
|
| 1721 |
+
934
|
| 1722 |
+
],
|
| 1723 |
+
"page_idx": 7
|
| 1724 |
+
},
|
| 1725 |
+
{
|
| 1726 |
+
"type": "text",
|
| 1727 |
+
"text": "ments over pseudo and myopic temperature scaling in the trade-off between likelihood and sample diversity, and in the accuracy of a multiple-choice analogy task.",
|
| 1728 |
+
"bbox": [
|
| 1729 |
+
84,
|
| 1730 |
+
85,
|
| 1731 |
+
473,
|
| 1732 |
+
131
|
| 1733 |
+
],
|
| 1734 |
+
"page_idx": 8
|
| 1735 |
+
},
|
| 1736 |
+
{
|
| 1737 |
+
"type": "text",
|
| 1738 |
+
"text": "Limitations and Future Work Temperature scaling the joint distribution is inherently intractable (scaling the temperature to 0 gives the argmax of the joint distribution), and LHTS only aims to learn an approximation to the solution. In addition, LHTS involves finetuning the model, as opposed to pure post-hoc alternatives such as myopic or pseudo temperature scaling. Future work can look into exploring multi-temperature finetuning further, or other divergences besides forward-KL for the LHTS objective.",
|
| 1739 |
+
"bbox": [
|
| 1740 |
+
84,
|
| 1741 |
+
137,
|
| 1742 |
+
475,
|
| 1743 |
+
273
|
| 1744 |
+
],
|
| 1745 |
+
"page_idx": 8
|
| 1746 |
+
},
|
| 1747 |
+
{
|
| 1748 |
+
"type": "text",
|
| 1749 |
+
"text": "8. Acknowledgments",
|
| 1750 |
+
"text_level": 1,
|
| 1751 |
+
"bbox": [
|
| 1752 |
+
84,
|
| 1753 |
+
292,
|
| 1754 |
+
264,
|
| 1755 |
+
310
|
| 1756 |
+
],
|
| 1757 |
+
"page_idx": 8
|
| 1758 |
+
},
|
| 1759 |
+
{
|
| 1760 |
+
"type": "text",
|
| 1761 |
+
"text": "We thank anonymous reviewers for their constructive feedback. This research was supported in part by NSF (#1651565), ARO (W911NF-21-1-0125), ONR (N00014-23-1-2159, N00014-22-1-2293), CZ Biohub, HAI.",
|
| 1762 |
+
"bbox": [
|
| 1763 |
+
84,
|
| 1764 |
+
319,
|
| 1765 |
+
475,
|
| 1766 |
+
380
|
| 1767 |
+
],
|
| 1768 |
+
"page_idx": 8
|
| 1769 |
+
},
|
| 1770 |
+
{
|
| 1771 |
+
"type": "text",
|
| 1772 |
+
"text": "References",
|
| 1773 |
+
"text_level": 1,
|
| 1774 |
+
"bbox": [
|
| 1775 |
+
86,
|
| 1776 |
+
398,
|
| 1777 |
+
181,
|
| 1778 |
+
414
|
| 1779 |
+
],
|
| 1780 |
+
"page_idx": 8
|
| 1781 |
+
},
|
| 1782 |
+
{
|
| 1783 |
+
"type": "list",
|
| 1784 |
+
"sub_type": "ref_text",
|
| 1785 |
+
"list_items": [
|
| 1786 |
+
"Bommasani, R., Hudson, D. A., Adeli, E., Altman, R., Arora, S., von Arx, S., Bernstein, M. S., Bohg, J., Bosse-lut, A., Brunskill, E., et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.",
|
| 1787 |
+
"Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems, 33: 1877-1901, 2020.",
|
| 1788 |
+
"Clark, C., Lee, K., Chang, M.-W., Kwiatkowski, T., Collins, M., and Toutanova, K. Boolq: Exploring the surprising difficulty of natural yes/no questions. arXiv preprint arXiv:1905.10044, 2019.",
|
| 1789 |
+
"Desai, S. and Durrett, G. Calibration of pre-trained transformers. arXiv preprint arXiv:2003.07892, 2020.",
|
| 1790 |
+
"Fan, A., Lewis, M., and Dauphin, Y. Hierarchical neural story generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 889-898, 2018.",
|
| 1791 |
+
"Gershman, S. and Goodman, N. Amortized inference in probabilistic reasoning. In Proceedings of the annual meeting of the cognitive science society, volume 36, 2014.",
|
| 1792 |
+
"Gokaslan, A. and Cohen, V. Openwebtext corpus, 2019.",
|
| 1793 |
+
"Guo, C., Pleiss, G., Sun, Y., and Weinberger, K. Q. On calibration of modern neural networks. In International conference on machine learning. PMLR, 2017."
|
| 1794 |
+
],
|
| 1795 |
+
"bbox": [
|
| 1796 |
+
86,
|
| 1797 |
+
422,
|
| 1798 |
+
475,
|
| 1799 |
+
905
|
| 1800 |
+
],
|
| 1801 |
+
"page_idx": 8
|
| 1802 |
+
},
|
| 1803 |
+
{
|
| 1804 |
+
"type": "list",
|
| 1805 |
+
"sub_type": "ref_text",
|
| 1806 |
+
"list_items": [
|
| 1807 |
+
"Ho, J., Jain, A., and Abbeel, P. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6851, 2020.",
|
| 1808 |
+
"Holtzman, A., Buys, J., Du, L., Forbes, M., and Choi, Y. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.",
|
| 1809 |
+
"Kingma, D. P. and Dhariwal, P. Glow: Generative flow with invertible 1x1 convolutions. Advances in neural information processing systems, 31, 2018.",
|
| 1810 |
+
"Koller, D. and Friedman, N. Probabilistic graphical models: principles and techniques. MIT press, 2009.",
|
| 1811 |
+
"Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images, 2009.",
|
| 1812 |
+
"Kwiatkowski, T., Palomaki, J., Redfield, O., Collins, M., Parikh, A., Alberti, C., Epstein, D., Polosukhin, I., Devlin, J., Lee, K., et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453-466, 2019.",
|
| 1813 |
+
"Li, J., Monroe, W., and Jurafsky, D. A simple, fast diverse decoding algorithm for neural generation. arXiv preprint arXiv:1611.08562, 2016.",
|
| 1814 |
+
"Liang, P., Bommasani, R., Lee, T., Tsipras, D., Soylu, D., Yasunaga, M., Zhang, Y., Narayanan, D., Wu, Y., et al. Holistic evaluation of language models. arXiv preprint arXiv:2211.09110, 2022.",
|
| 1815 |
+
"Lu, X., Welleck, S., Jiang, L., Hessel, J., Qin, L., West, P., Ammanabrolu, P., and Choi, Y. Quark: Controllable text generation with reinforced unlearning. arXiv preprint arXiv:2205.13636, 2022.",
|
| 1816 |
+
"Mahoney, M. Large text compression benchmark, 2011.",
|
| 1817 |
+
"Mikolov, T., Chen, K., Corrado, G., and Dean, J. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.",
|
| 1818 |
+
"Narayan, S., Cohen, S. B., and Lapata, M. Don't give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. arXiv preprint arXiv:1808.08745, 2018.",
|
| 1819 |
+
"Nichol, A. Q. and Dhariwal, P. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162-8171. PMLR, 2021.",
|
| 1820 |
+
"Nixon, J., Dusenberry, M. W., Zhang, L., Jerfel, G., and Tran, D. Measuring calibration in deep learning. In CVPR Workshops, volume 2, 2019."
|
| 1821 |
+
],
|
| 1822 |
+
"bbox": [
|
| 1823 |
+
500,
|
| 1824 |
+
84,
|
| 1825 |
+
887,
|
| 1826 |
+
905
|
| 1827 |
+
],
|
| 1828 |
+
"page_idx": 8
|
| 1829 |
+
},
|
| 1830 |
+
{
|
| 1831 |
+
"type": "header",
|
| 1832 |
+
"text": "Long Horizon Temperature Scaling",
|
| 1833 |
+
"bbox": [
|
| 1834 |
+
372,
|
| 1835 |
+
56,
|
| 1836 |
+
599,
|
| 1837 |
+
71
|
| 1838 |
+
],
|
| 1839 |
+
"page_idx": 8
|
| 1840 |
+
},
|
| 1841 |
+
{
|
| 1842 |
+
"type": "page_number",
|
| 1843 |
+
"text": "9",
|
| 1844 |
+
"bbox": [
|
| 1845 |
+
480,
|
| 1846 |
+
922,
|
| 1847 |
+
491,
|
| 1848 |
+
934
|
| 1849 |
+
],
|
| 1850 |
+
"page_idx": 8
|
| 1851 |
+
},
|
| 1852 |
+
{
|
| 1853 |
+
"type": "list",
|
| 1854 |
+
"sub_type": "ref_text",
|
| 1855 |
+
"list_items": [
|
| 1856 |
+
"Pillutla, K., Swayamdipta, S., Zellers, R., Thickstun, J., Welleck, S., Choi, Y., and Harchaoui, Z. Mauve: Measuring the gap between neural text and human text using divergence frontiers. Advances in Neural Information Processing Systems, 34:4816-4828, 2021.",
|
| 1857 |
+
"Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.",
|
| 1858 |
+
"Vahdat, A. and Kautz, J. Nvae: A deep hierarchical variational autoencoder. Advances in Neural Information Processing Systems, 33:19667-19679, 2020.",
|
| 1859 |
+
"Vijayakumar, A., Cogswell, M., Selvaraju, R., Sun, Q., Lee, S., Crandall, D., and Batra, D. Diverse beam search for improved description of complex scenes. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.",
|
| 1860 |
+
"Welleck, S., Kulikov, I., Roller, S., Dinan, E., Cho, K., and Weston, J. Neural text generation with unlikelihood training. arXiv preprint arXiv:1908.04319, 2019.",
|
| 1861 |
+
"Wolf, T., Debut, L., Sanh, V., Chaumont, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., Davison, J., Shleifer, S., von Platen, P., Ma, C., Jernite, Y., Plu, J., Xu, C., Scao, T. L., Gugger, S., Drame, M., Lhoest, Q., and Rush, A. M. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, October 2020."
|
| 1862 |
+
],
|
| 1863 |
+
"bbox": [
|
| 1864 |
+
86,
|
| 1865 |
+
84,
|
| 1866 |
+
475,
|
| 1867 |
+
556
|
| 1868 |
+
],
|
| 1869 |
+
"page_idx": 9
|
| 1870 |
+
},
|
| 1871 |
+
{
|
| 1872 |
+
"type": "header",
|
| 1873 |
+
"text": "Long Horizon Temperature Scaling",
|
| 1874 |
+
"bbox": [
|
| 1875 |
+
372,
|
| 1876 |
+
56,
|
| 1877 |
+
599,
|
| 1878 |
+
71
|
| 1879 |
+
],
|
| 1880 |
+
"page_idx": 9
|
| 1881 |
+
},
|
| 1882 |
+
{
|
| 1883 |
+
"type": "page_number",
|
| 1884 |
+
"text": "10",
|
| 1885 |
+
"bbox": [
|
| 1886 |
+
477,
|
| 1887 |
+
922,
|
| 1888 |
+
495,
|
| 1889 |
+
934
|
| 1890 |
+
],
|
| 1891 |
+
"page_idx": 9
|
| 1892 |
+
},
|
| 1893 |
+
{
|
| 1894 |
+
"type": "text",
|
| 1895 |
+
"text": "A. Experimental Settings",
|
| 1896 |
+
"text_level": 1,
|
| 1897 |
+
"bbox": [
|
| 1898 |
+
86,
|
| 1899 |
+
83,
|
| 1900 |
+
299,
|
| 1901 |
+
99
|
| 1902 |
+
],
|
| 1903 |
+
"page_idx": 10
|
| 1904 |
+
},
|
| 1905 |
+
{
|
| 1906 |
+
"type": "text",
|
| 1907 |
+
"text": "Diffusion Model",
|
| 1908 |
+
"text_level": 1,
|
| 1909 |
+
"bbox": [
|
| 1910 |
+
86,
|
| 1911 |
+
109,
|
| 1912 |
+
204,
|
| 1913 |
+
123
|
| 1914 |
+
],
|
| 1915 |
+
"page_idx": 10
|
| 1916 |
+
},
|
| 1917 |
+
{
|
| 1918 |
+
"type": "list",
|
| 1919 |
+
"sub_type": "text",
|
| 1920 |
+
"list_items": [
|
| 1921 |
+
"- Architecture: DDPM",
|
| 1922 |
+
"- Learning Rate: 2e-4",
|
| 1923 |
+
"- Batch Size: 128",
|
| 1924 |
+
"EMA decay: 0.9999",
|
| 1925 |
+
"GradClip:1",
|
| 1926 |
+
"Steps: 50000",
|
| 1927 |
+
"Warmup Steps: 5000",
|
| 1928 |
+
"LHTS Clip: 0.5"
|
| 1929 |
+
],
|
| 1930 |
+
"bbox": [
|
| 1931 |
+
104,
|
| 1932 |
+
143,
|
| 1933 |
+
261,
|
| 1934 |
+
352
|
| 1935 |
+
],
|
| 1936 |
+
"page_idx": 10
|
| 1937 |
+
},
|
| 1938 |
+
{
|
| 1939 |
+
"type": "text",
|
| 1940 |
+
"text": "Character Model",
|
| 1941 |
+
"text_level": 1,
|
| 1942 |
+
"bbox": [
|
| 1943 |
+
86,
|
| 1944 |
+
371,
|
| 1945 |
+
210,
|
| 1946 |
+
386
|
| 1947 |
+
],
|
| 1948 |
+
"page_idx": 10
|
| 1949 |
+
},
|
| 1950 |
+
{
|
| 1951 |
+
"type": "list",
|
| 1952 |
+
"sub_type": "text",
|
| 1953 |
+
"list_items": [
|
| 1954 |
+
"- Architecture: 12-layer Transformer, embedding 768, hidden size 3072, num heads 12, num layers 12",
|
| 1955 |
+
"- Learning Rate: 5e-4",
|
| 1956 |
+
"- Batch Size: 512",
|
| 1957 |
+
"Weight Decay: 0.001",
|
| 1958 |
+
"GradClip:0.25",
|
| 1959 |
+
"- Epochs: 200",
|
| 1960 |
+
"LHTS Clip: 3",
|
| 1961 |
+
"LHTS Suffix Horizon: 25"
|
| 1962 |
+
],
|
| 1963 |
+
"bbox": [
|
| 1964 |
+
104,
|
| 1965 |
+
405,
|
| 1966 |
+
777,
|
| 1967 |
+
614
|
| 1968 |
+
],
|
| 1969 |
+
"page_idx": 10
|
| 1970 |
+
},
|
| 1971 |
+
{
|
| 1972 |
+
"type": "text",
|
| 1973 |
+
"text": "Language Model",
|
| 1974 |
+
"text_level": 1,
|
| 1975 |
+
"bbox": [
|
| 1976 |
+
86,
|
| 1977 |
+
633,
|
| 1978 |
+
209,
|
| 1979 |
+
648
|
| 1980 |
+
],
|
| 1981 |
+
"page_idx": 10
|
| 1982 |
+
},
|
| 1983 |
+
{
|
| 1984 |
+
"type": "list",
|
| 1985 |
+
"sub_type": "text",
|
| 1986 |
+
"list_items": [
|
| 1987 |
+
"- Architecture: GPT-2 (small, medium, large), context 1024",
|
| 1988 |
+
"- Learning Rate: 1e-4",
|
| 1989 |
+
"- Batch Size: 512",
|
| 1990 |
+
"Weight Decay: 0.01",
|
| 1991 |
+
"Grad Clip: 0.25",
|
| 1992 |
+
"Steps: 1000",
|
| 1993 |
+
"LHTS KL beta: 0.05",
|
| 1994 |
+
"LHTS Clip: 3",
|
| 1995 |
+
"LHTS Suffix Horizon: 8"
|
| 1996 |
+
],
|
| 1997 |
+
"bbox": [
|
| 1998 |
+
104,
|
| 1999 |
+
667,
|
| 2000 |
+
500,
|
| 2001 |
+
904
|
| 2002 |
+
],
|
| 2003 |
+
"page_idx": 10
|
| 2004 |
+
},
|
| 2005 |
+
{
|
| 2006 |
+
"type": "header",
|
| 2007 |
+
"text": "Long Horizon Temperature Scaling",
|
| 2008 |
+
"bbox": [
|
| 2009 |
+
372,
|
| 2010 |
+
56,
|
| 2011 |
+
599,
|
| 2012 |
+
71
|
| 2013 |
+
],
|
| 2014 |
+
"page_idx": 10
|
| 2015 |
+
},
|
| 2016 |
+
{
|
| 2017 |
+
"type": "page_number",
|
| 2018 |
+
"text": "11",
|
| 2019 |
+
"bbox": [
|
| 2020 |
+
477,
|
| 2021 |
+
922,
|
| 2022 |
+
493,
|
| 2023 |
+
934
|
| 2024 |
+
],
|
| 2025 |
+
"page_idx": 10
|
| 2026 |
+
},
|
| 2027 |
+
{
|
| 2028 |
+
"type": "text",
|
| 2029 |
+
"text": "B. Example Sample from GPT-2 Large with LHTS",
|
| 2030 |
+
"text_level": 1,
|
| 2031 |
+
"bbox": [
|
| 2032 |
+
84,
|
| 2033 |
+
83,
|
| 2034 |
+
514,
|
| 2035 |
+
99
|
| 2036 |
+
],
|
| 2037 |
+
"page_idx": 11
|
| 2038 |
+
},
|
| 2039 |
+
{
|
| 2040 |
+
"type": "text",
|
| 2041 |
+
"text": "It is always great when you get a chance to get the inside scoop as to why a franchise is so popular, and today I have learned that one of the reasons is the players they play them against. When I joined the St Louis Cardinals, one of my first observations of Albert Pujols was that he was a little tough to hit. Now, having played him a ton of baseball, there's no doubt in my mind that he's just as tough, if not tougher, than anybody else on the field. Pujols, like most power hitters before him, is known best for running his bat out all over the field. The one thing he has in his favor, though, is that when he does come back to the field, he always finds his way to hitting lefties.",
|
| 2042 |
+
"bbox": [
|
| 2043 |
+
84,
|
| 2044 |
+
109,
|
| 2045 |
+
887,
|
| 2046 |
+
200
|
| 2047 |
+
],
|
| 2048 |
+
"page_idx": 11
|
| 2049 |
+
},
|
| 2050 |
+
{
|
| 2051 |
+
"type": "text",
|
| 2052 |
+
"text": "C. Additional Experiments",
|
| 2053 |
+
"text_level": 1,
|
| 2054 |
+
"bbox": [
|
| 2055 |
+
84,
|
| 2056 |
+
219,
|
| 2057 |
+
316,
|
| 2058 |
+
237
|
| 2059 |
+
],
|
| 2060 |
+
"page_idx": 11
|
| 2061 |
+
},
|
| 2062 |
+
{
|
| 2063 |
+
"type": "text",
|
| 2064 |
+
"text": "We evaluate the diffusion models and language models on additional metrics such as SSIM, MAUVE score, and HELM benchmarks.",
|
| 2065 |
+
"bbox": [
|
| 2066 |
+
84,
|
| 2067 |
+
244,
|
| 2068 |
+
885,
|
| 2069 |
+
275
|
| 2070 |
+
],
|
| 2071 |
+
"page_idx": 11
|
| 2072 |
+
},
|
| 2073 |
+
{
|
| 2074 |
+
"type": "text",
|
| 2075 |
+
"text": "C.1. Diffusion Model",
|
| 2076 |
+
"text_level": 1,
|
| 2077 |
+
"bbox": [
|
| 2078 |
+
84,
|
| 2079 |
+
292,
|
| 2080 |
+
235,
|
| 2081 |
+
306
|
| 2082 |
+
],
|
| 2083 |
+
"page_idx": 11
|
| 2084 |
+
},
|
| 2085 |
+
{
|
| 2086 |
+
"type": "text",
|
| 2087 |
+
"text": "We use the same DDPM diffusion model from Figure 2, finetuned with LHTS, and report the Structural Similarity Index (SSIM). Unlike FID, SSIM does not consider diversity, but rather closeness to a ground-truth image. Therefore, we see that the SSIM scores in Table 2 align roughly with the log-likelihood scores of Figure 2.",
|
| 2088 |
+
"bbox": [
|
| 2089 |
+
84,
|
| 2090 |
+
315,
|
| 2091 |
+
887,
|
| 2092 |
+
361
|
| 2093 |
+
],
|
| 2094 |
+
"page_idx": 11
|
| 2095 |
+
},
|
| 2096 |
+
{
|
| 2097 |
+
"type": "table",
|
| 2098 |
+
"img_path": "images/2a1928c25eeaeed08c177ad2b92d308510e3d42d2c54f7ca38a96d9467074490.jpg",
|
| 2099 |
+
"table_caption": [
|
| 2100 |
+
"Table 2. SSIM of diffusion model with pseudo-temperature scaling and long horizon temperature scaling on CIFAR-10."
|
| 2101 |
+
],
|
| 2102 |
+
"table_footnote": [],
|
| 2103 |
+
"table_body": "<table><tr><td rowspan=\"2\">Temperature</td><td colspan=\"3\">PseudoTemp</td><td colspan=\"3\">LHTS</td></tr><tr><td>0.98</td><td>0.985</td><td>0.99</td><td>0.99</td><td>0.995</td><td>0.999</td></tr><tr><td>SSIM</td><td>0.915</td><td>0.913</td><td>0.913</td><td>0.913</td><td>0.913</td><td>0.911</td></tr></table>",
|
| 2104 |
+
"bbox": [
|
| 2105 |
+
264,
|
| 2106 |
+
400,
|
| 2107 |
+
709,
|
| 2108 |
+
460
|
| 2109 |
+
],
|
| 2110 |
+
"page_idx": 11
|
| 2111 |
+
},
|
| 2112 |
+
{
|
| 2113 |
+
"type": "text",
|
| 2114 |
+
"text": "C.2. Language Model",
|
| 2115 |
+
"text_level": 1,
|
| 2116 |
+
"bbox": [
|
| 2117 |
+
84,
|
| 2118 |
+
483,
|
| 2119 |
+
240,
|
| 2120 |
+
498
|
| 2121 |
+
],
|
| 2122 |
+
"page_idx": 11
|
| 2123 |
+
},
|
| 2124 |
+
{
|
| 2125 |
+
"type": "text",
|
| 2126 |
+
"text": "We examine the same GPT-2 language model from Figure 5a and Table 1, using the gpt2-large size. We compare the use of standard myopic temperature scaling versus LHTS finetuning on MAUVE score (Pillutla et al., 2021) and a number of metrics from HELM (Liang et al., 2022).",
|
| 2127 |
+
"bbox": [
|
| 2128 |
+
84,
|
| 2129 |
+
507,
|
| 2130 |
+
887,
|
| 2131 |
+
551
|
| 2132 |
+
],
|
| 2133 |
+
"page_idx": 11
|
| 2134 |
+
},
|
| 2135 |
+
{
|
| 2136 |
+
"type": "text",
|
| 2137 |
+
"text": "MAUVE score We evaluate MAUVE score on OpenWebText (Gokaslan & Cohen, 2019) using the setup in the MAUVE paper (Pillutla et al., 2021), with 1000 generations and a prompt length of 30 tokens. We find that LHTS does not improve MAUVE score, and that both forms of temperature scaling (myopic and LHTS) in general decrease MAUVE score.",
|
| 2138 |
+
"bbox": [
|
| 2139 |
+
84,
|
| 2140 |
+
568,
|
| 2141 |
+
887,
|
| 2142 |
+
614
|
| 2143 |
+
],
|
| 2144 |
+
"page_idx": 11
|
| 2145 |
+
},
|
| 2146 |
+
{
|
| 2147 |
+
"type": "table",
|
| 2148 |
+
"img_path": "images/1a368a595fb15c5b4f3102a68731d6e24811b3070e0f7a648ba7dc9d90b5232b.jpg",
|
| 2149 |
+
"table_caption": [
|
| 2150 |
+
"Table 3. MAUVE score of GPT-2 (gpt2-large) with myopic temperature scaling and long horizon temperature scaling on OpenWebText."
|
| 2151 |
+
],
|
| 2152 |
+
"table_footnote": [],
|
| 2153 |
+
"table_body": "<table><tr><td></td><td>No Scaling</td><td colspan=\"2\">Myopic Only</td><td colspan=\"2\">LHTS</td></tr><tr><td>Myopic Temperature</td><td>1.0</td><td>0.8</td><td>0.0</td><td>1.0</td><td>0.0</td></tr><tr><td>Long Horizon Temperature</td><td>1.0</td><td>1.0</td><td>1.0</td><td>0.9</td><td>0.9</td></tr><tr><td>MAUVE</td><td>0.76</td><td>0.57</td><td>0.00</td><td>0.41</td><td>0.00</td></tr></table>",
|
| 2154 |
+
"bbox": [
|
| 2155 |
+
236,
|
| 2156 |
+
652,
|
| 2157 |
+
736,
|
| 2158 |
+
728
|
| 2159 |
+
],
|
| 2160 |
+
"page_idx": 11
|
| 2161 |
+
},
|
| 2162 |
+
{
|
| 2163 |
+
"type": "header",
|
| 2164 |
+
"text": "Long Horizon Temperature Scaling",
|
| 2165 |
+
"bbox": [
|
| 2166 |
+
372,
|
| 2167 |
+
56,
|
| 2168 |
+
599,
|
| 2169 |
+
70
|
| 2170 |
+
],
|
| 2171 |
+
"page_idx": 11
|
| 2172 |
+
},
|
| 2173 |
+
{
|
| 2174 |
+
"type": "page_number",
|
| 2175 |
+
"text": "12",
|
| 2176 |
+
"bbox": [
|
| 2177 |
+
477,
|
| 2178 |
+
922,
|
| 2179 |
+
495,
|
| 2180 |
+
934
|
| 2181 |
+
],
|
| 2182 |
+
"page_idx": 11
|
| 2183 |
+
},
|
| 2184 |
+
{
|
| 2185 |
+
"type": "text",
|
| 2186 |
+
"text": "HELM We evaluate on some metrics from the HELM benchmark such as XSUM (Narayan et al., 2018), BoolQ (Clark et al., 2019), and NaturalQA open book (Kwiatkowski et al., 2019), which respectively test for summarization, classification, and reading comprehension with multiple choice.",
|
| 2187 |
+
"bbox": [
|
| 2188 |
+
84,
|
| 2189 |
+
84,
|
| 2190 |
+
887,
|
| 2191 |
+
130
|
| 2192 |
+
],
|
| 2193 |
+
"page_idx": 12
|
| 2194 |
+
},
|
| 2195 |
+
{
|
| 2196 |
+
"type": "table",
|
| 2197 |
+
"img_path": "images/53b119d267711159f5f19b55eb211c01b75b2e133ffb15e6a5691feaf6924d0f.jpg",
|
| 2198 |
+
"table_caption": [
|
| 2199 |
+
"Table 4. Evaluation of GPT-2 (gpt2-large) on various metrics from HELM."
|
| 2200 |
+
],
|
| 2201 |
+
"table_footnote": [],
|
| 2202 |
+
"table_body": "<table><tr><td rowspan=\"2\">Myopic Temperature</td><td colspan=\"2\">Myopic Only</td><td colspan=\"2\">LHTS</td></tr><tr><td>0.8</td><td>0.0</td><td>1.0</td><td>0.0</td></tr><tr><td>Long Horizon Temperature</td><td>1.0</td><td>1.0</td><td>0.9</td><td>0.9</td></tr><tr><td>xsum_test_rouge2</td><td>0.016</td><td>0.019</td><td>0.013</td><td>0.02</td></tr><tr><td>xsum_test_perp (lower)</td><td>6.72</td><td>2.305</td><td>5.137</td><td>1.725</td></tr><tr><td>boolq_exact_MATCH</td><td>0.383</td><td>0.583</td><td>0.417</td><td>0.603</td></tr><tr><td>boolqExact_MATCH_fairness</td><td>0.167</td><td>0.483</td><td>0.173</td><td>0.507</td></tr><tr><td>boolqExact_MATCH_robustness</td><td>0.087</td><td>0.35</td><td>0.113</td><td>0.43</td></tr><tr><td>boolq_ece_10_bin (lower)</td><td>0.112</td><td>0.164</td><td>0.124</td><td>0.174</td></tr><tr><td>naturalqa_open_f1_score</td><td>0.157</td><td>0.257</td><td>0.146</td><td>0.248</td></tr><tr><td>naturalqa_open_f1_score_fairness</td><td>0.058</td><td>0.153</td><td>0.041</td><td>0.164</td></tr><tr><td>naturalqa_open_f1_score_robustness</td><td>0.026</td><td>0.074</td><td>0.031</td><td>0.055</td></tr><tr><td>naturalqa_open_ece_10_bin (lower)</td><td>0.109</td><td>0.134</td><td>0.086</td><td>0.14</td></tr></table>",
|
| 2203 |
+
"bbox": [
|
| 2204 |
+
245,
|
| 2205 |
+
167,
|
| 2206 |
+
727,
|
| 2207 |
+
392
|
| 2208 |
+
],
|
| 2209 |
+
"page_idx": 12
|
| 2210 |
+
},
|
| 2211 |
+
{
|
| 2212 |
+
"type": "text",
|
| 2213 |
+
"text": "In Table 4, we can see that LHTS shows some improvements in perplexity and accuracy, and less so for calibration and F1-score. LHTS can also help with fairness or robustness perturbations on both accuracy and F1-score. However, we note that these scores are generally low due to the relatively small size of GPT-2, so evaluations on larger models are needed for more conclusive results.",
|
| 2214 |
+
"bbox": [
|
| 2215 |
+
84,
|
| 2216 |
+
407,
|
| 2217 |
+
888,
|
| 2218 |
+
467
|
| 2219 |
+
],
|
| 2220 |
+
"page_idx": 12
|
| 2221 |
+
},
|
| 2222 |
+
{
|
| 2223 |
+
"type": "header",
|
| 2224 |
+
"text": "Long Horizon Temperature Scaling",
|
| 2225 |
+
"bbox": [
|
| 2226 |
+
372,
|
| 2227 |
+
56,
|
| 2228 |
+
599,
|
| 2229 |
+
70
|
| 2230 |
+
],
|
| 2231 |
+
"page_idx": 12
|
| 2232 |
+
},
|
| 2233 |
+
{
|
| 2234 |
+
"type": "page_number",
|
| 2235 |
+
"text": "13",
|
| 2236 |
+
"bbox": [
|
| 2237 |
+
477,
|
| 2238 |
+
922,
|
| 2239 |
+
495,
|
| 2240 |
+
934
|
| 2241 |
+
],
|
| 2242 |
+
"page_idx": 12
|
| 2243 |
+
}
|
| 2244 |
+
]
|
2023/Long Horizon Temperature Scaling/47128e75-9f58-40d7-abc3-eec59da61be5_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Long Horizon Temperature Scaling/47128e75-9f58-40d7-abc3-eec59da61be5_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:82457d6d254bbafc15e2799728b460ec0b151eb381ce21518e82fece13f643ec
|
| 3 |
+
size 1061497
|
2023/Long Horizon Temperature Scaling/full.md
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Long Horizon Temperature Scaling
|
| 2 |
+
|
| 3 |
+
Andy Shih<sup>1</sup> Dorsa Sadigh<sup>1</sup> Stefano Ermon<sup>1</sup>
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Temperature scaling is a popular technique for tuning the sharpness of a model distribution. It is used extensively for sampling likely generations and calibrating model uncertainty, and even features as a controllable parameter to many large language models in deployment. However, autoregressive models rely on myopic temperature scaling that greedily optimizes the next token. To address this, we propose Long Horizon Temperature Scaling (LHTS), a novel approach for sampling from temperature-scaled joint distributions. LHTS is compatible with all likelihood-based models, and optimizes for the long horizon likelihood of samples. We derive a temperature-dependent LHTS objective, and show that finetuning a model on a range of temperatures produces a single model capable of generation with a controllable long horizon temperature parameter. We experiment with LHTS on image diffusion models and character/language autoregressive models, demonstrating advantages over myopic temperature scaling in likelihood and sample quality, and showing improvements in accuracy on a multiple choice analogy task by $10\%$ . Our code is available at https://github.com/AndyShih12/LongHorizonTemperatureScaling.
|
| 8 |
+
|
| 9 |
+
# 1. Introduction
|
| 10 |
+
|
| 11 |
+
Temperature scaling is a simple yet effective technique for rescaling model outputs: lowering the temperature to increase the probability of high-likelihood outcomes, or vice versa. In discriminative settings, tuning the temperature has shown success as a calibration method (Guo et al., 2017; Nixon et al., 2019; Desai & Durrett, 2020). The model outputs a small set of class probabilities, which can be tractably rescaled to match the desired calibration metric.
|
| 12 |
+
|
| 13 |
+
$^{1}$ Department of Computer Science, Stanford University. Correspondence to: Andy Shih <andyshih@cs.stanford.edu>.
|
| 14 |
+
|
| 15 |
+
Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).
|
| 16 |
+
|
| 17 |
+
In generative tasks, temperature scaling also serves as a method for controlling the randomness of model outputs, and has shown to be useful for many natural language generation tasks such as summarization and question answering (Liang et al., 2022). Many current models in deployment (Brown et al., 2020; Bommasani et al., 2021) even expose the model temperature as a user-controllable parameter in their API. These autoregressive language models execute temperature scaling one token at a time, rescaling the probability of the next token to be proportional to $\log p(x_i|x_{< i}) / T$ . However, this mechanism is myopic, optimizing for the next token instead of the full sequence.
|
| 18 |
+
|
| 19 |
+
We reexamine the current practice of temperature scaling for generative models. Unlike discriminative tasks, generative tasks produce high-dimensional outputs. In other words, rescaling the model outputs should, in principle, rescale joint probabilities according to $\log p(x) / T$ . Lowering the temperature of a language model should ideally bias the model towards generation of full text sequences with high joint likelihood, not just greedy generation of the next likely tokens. However, due to the intractability of joint temperature scaling, existing model families rely on various ad-hoc approximations such as myopic temperature scaling. This perspective highlights the following concerns.
|
| 20 |
+
|
| 21 |
+
A) Current temperature scaling for autoregressive models is a myopic approximation to temperature scaling of joint probabilities.
|
| 22 |
+
|
| 23 |
+
Many other model families do not support myopic approximations, and are left with the intractable problem of joint temperature scaling. Some sidestep the problem by defining various notions of pseudo-temperatures (Kingma & Dhariwal, 2018; Vahdat & Kautz, 2020).
|
| 24 |
+
|
| 25 |
+
B) Many non-autoregressive generative models either rely on pseudo-temperatures or do not use temperature scaling altogether.
|
| 26 |
+
|
| 27 |
+
To address these concerns, we aim head-on for the goal of joint temperature scaling. Instead of handling various model-specific temperature scaling techniques, we set out to develop a practical and general mechanism for sampling from temperature-scaled joint distributions. We propose
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
Figure 1. Pitfalls of myopic temperature scaling. At the top of the diagram, we depict prompting a language model for a choice of three actions. The language model may respond with each choice with a probability of 0.3 (shown in green), and a remaining probability of 0.1 of outputting irrelevant answers. To reduce the probability of irrelevant answers, we can lower the temperature of the model. In blue, we show that myopic temperature scaling will unintuitively lump the probabilities for the two actions "tap cabinet" and "tap door", because they share the same first token "tap". Therefore, lowering the myopic temperature will emphasize the probability on these two choices, and diminish the probability of choosing "close door". On the other hand, in orange we show that long horizon temperature scaling correctly scales the joint probability of the full sequence, equally distributing a probability of one-third among the three choices.
|
| 31 |
+
|
| 32 |
+
Long Horizon Temperature Scaling (LHTS), a novel and tractable approach for sampling from a temperature-scaled joint distribution that is A) non-myopic and B) compatible with all likelihood-based generative models. LHTS requires finetuning a likelihood-based model on a temperature-dependent objective, after which the model can sample long horizon temperature-scaled outputs without any additional cost over standard sampling. By finetuning over a range of temperatures, we can learn a single model capable of generation with a controllable parameter, extrapolating even to temperatures unseen during finetuning.
|
| 33 |
+
|
| 34 |
+
LHTS enables autoregressive models to optimize for high likelihood outputs over a long horizon instead of a single token (Figure 1). For other likelihood-based models (e.g. VAEs, normalizing flows, diffusion models), LHTS presents a unified model-agnostic temperature scaling mechanism. We experiment with LHTS in three settings: a diffusion image model, an autoregressive character model, and autoregressive large language models. Our experiments show that LHTS can achieve a better tradeoff between likelihood and diversity compared to pseudo-temperature scaling for diffusion models, and compared to myopic temperature scaling for autoregressive models. On a downstream analogy multiple-choice task, LHTS improves the accuracy of GPT-2 by $10\%$ over myopic temperature scaling.
|
| 35 |
+
|
| 36 |
+
# 2. Background
|
| 37 |
+
|
| 38 |
+
For generative tasks, we have access to a data distribution $p_{\mathrm{data}}(x)$ in the form of a training set $\mathcal{D}$ of i.i.d. samples, from which we aim to learn a faithful model $p(x)$ of the data distribution. In principle, having learned the ideal model $p(x)$ for our downstream task, we would be satisfied with drawing conditional/unconditional samples from $p(x)$ .
|
| 39 |
+
|
| 40 |
+
However, in practice, biasing samples towards higher likelihood regions of the model distribution is often beneficial. For example, we often choose to calibrate the entropy of a suboptimal model (Holtzman et al., 2019), generate less noisy behavior by taking the argmax action, or simply sample from a sharper distribution. The most prominent technique for biasing towards high likelihood regions is temperature scaling with a scalar $T$ .
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\log p _ {T} (x) = \log p (x) / T - \log Z _ {p _ {T}} \tag {1}
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $Z_{p_T}$ is the partition function. For temperatures $T < 1$ , the scaled model $p_T(x)$ defines a sharper distribution, which is useful for a variety of applications mentioned above.
|
| 47 |
+
|
| 48 |
+
# 2.1. Myopic temperature scaling
|
| 49 |
+
|
| 50 |
+
Autoregressive models, such as GPT (Radford et al., 2019; Brown et al., 2020), implement a myopic approximation to temperature scaling. Autoregressive models learn a set of univariate conditional distributions $\log p(x_{i}|x_{< i})$ and rely on the factorization of the joint distribution via chain rule
|
| 51 |
+
|
| 52 |
+
$\log p(x) = \sum_{i}\log p(x_i|x_{< i})$ . When sampling with a temperature $T$ , they rescale each univariate conditional by $T$
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\log p _ {T} ^ {\text {m y o p i c}} \left(x _ {i} \mid x _ {< i}\right) = \log \frac {e ^ {\log p \left(x _ {i} \mid x _ {< i}\right) / T}}{\sum_ {k} e ^ {\log p \left(x _ {i} = k \mid x _ {< i}\right) / T}} \tag {2}
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
This approach is efficient since it handles one dimension at a time and only requires rescaling the output logits. However, since the scaling is myopic, the chain rule factorization does not preserve the scaled joint distribution in Eq 1.
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\log p _ {T} (x) \neq \sum_ {i} \log p _ {T} ^ {\text {m y o p i c}} \left(x _ {i} \mid x _ {< i}\right) \tag {3}
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
It is easy to see that in the extreme case, myopic scaling of an autoregressive model with $T \to 0$ will not necessarily produce the argmax sample of the joint distribution.
|
| 65 |
+
|
| 66 |
+
# 2.2. Pseudo-temperature scaling
|
| 67 |
+
|
| 68 |
+
Non-autoregressive models are often associated with various ad-hoc notions of pseudo-temperature scaling. For example, some latent variable models (Kingma & Dhariwal, 2018; Vahdat & Kautz, 2020) rescale the variance of the prior of the latent variable. However, these notions of pseudotemperature are often model-specific, and have an unclear relationship to temperature scaling of the data likelihood.
|
| 69 |
+
|
| 70 |
+
# 3. Related Work
|
| 71 |
+
|
| 72 |
+
Temperature scaling is an effective method for calibration in discriminative settings (Guo et al., 2017; Nixon et al., 2019; Desai & Durrett, 2020), where the output predictions of a model can be rescaled post-hoc. In generative settings, such as natural language generation, myopic temperature scaling serves as an important knob for controlling the randomness of autoregressive models, often featuring as a user-controllable parameter in deployment (Brown et al., 2020; Bommasani et al., 2021). For latent variable models, such as normalizing flows or VAEs, reducing the variance of the prior during sampling has been explored as a pseudotemperature mechanism (Kingma & Dhariwal, 2018; Vahdat & Kautz, 2020). Due to the high-dimensional output space of generative tasks, however, these above methods are approximations that do not directly scale the temperature of the joint distribution, and are typically model-specific. Compared to these methods, LHTS presents a unified and tractable mechanism for temperature scaling of the joint distribution.
|
| 73 |
+
|
| 74 |
+
Other techniques for post-hoc manipulation of autoregressive model generation include top-k (Fan et al., 2018) or nucleus sampling (Holtzman et al., 2019). More intensive search-based alternatives are also popular, such as beam search (Li et al., 2016; Vijayakumar et al., 2018) for pick out high-likelihood generations. In terms of computational
|
| 75 |
+
|
| 76 |
+
cost, LHTS only requires a one-time finetuning of the model, after which long horizon temperature-scaled outputs can be generated directly without search.
|
| 77 |
+
|
| 78 |
+
Biasing the model towards higher-likelihood samples can also be viewed as controllable generation. Some relevant works include Quark (Lu et al., 2022), which partitions the dataset based on a control signal of interest (e.g. toxicity), and reinforces the model with its own generations. Other works on controllable generation include class-conditional generation, for example with diffusion models for images (Nichol & Dhariwal, 2021).
|
| 79 |
+
|
| 80 |
+
Finally, LHTS relates closely to amortized inference (Gershman & Goodman, 2014), since we learn a model to predict intractable temperature-scaled joint distributions. As the temperature approaches zero, LHTC approximates MAP inference (Koller & Friedman, 2009).
|
| 81 |
+
|
| 82 |
+
# 4. Long Horizon Temperature Scaling
|
| 83 |
+
|
| 84 |
+
We propose long horizon temperature scaling (LHTS), a general method to temperature scale the joint distribution of likelihood based models. LHTS proceeds by directly learning a model $q_{T}$ to match the temperature scaled distribution in Eq. 1. The model $q_{T}$ should have tractable likelihood and sampling, but typically this is satisfied by choosing the same model family as $p$ , or even finetuning from $p$ .
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\begin{array}{l} \min _ {q _ {T}} K L (p _ {T} \| q _ {T}) = \min _ {q _ {T}} \mathbb {E} _ {x \sim p _ {T}} [ \log p _ {T} (x) - \log q _ {T} (x) ] \\ = \min _ {q _ {T}} \mathbb {E} _ {x \sim p _ {T}} [ - \log q _ {T} (x) ] \\ \end{array}
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
Although we don't have sample access to $p_T$ , we can appeal to importance sampling from $p$ .
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\begin{array}{l} \mathbb {E} _ {x \sim p _ {T}} [ - \log q _ {T} (x) ] \\ = \mathbb {E} _ {x \sim p} \frac {e ^ {(\log p (x) / T) - \log Z _ {p _ {T}}}}{p (x)} [ - \log q _ {T} (x) ] \\ = \mathbb {E} _ {x \sim p} e ^ {\frac {1 - T}{T} \log p (x) - \log Z _ {p T}} [ - \log q _ {T} (x) ] \tag {4} \\ \end{array}
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
Optimizing $q_{T}$ with Eq. 4 will give us the desired temperature scaled distribution from Eq. 1, although the variance of the loss can be high due to the importance weights.
|
| 97 |
+
|
| 98 |
+
We note that the intractable constant $\log Z_{p_T}$ can be ignored since it evaluates as a constant multiplicative factor of the entire expression. More importantly, though, the same insight allows us to subtract an arbitrary data-independent baseline $b$ for variance reduction. Since the importance weights are not in log-space, we need to carefully choose a baseline to keep the weights within a manageable range. We opt for keeping the weights close to 1 by matching the empirical
|
| 99 |
+
|
| 100 |
+
mean of the exponent.
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
b = \frac {1}{| \mathcal {D} |} \sum_ {x \in \mathcal {D}} \frac {1 - T}{T} \log p (x) \tag {5}
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
Put together, the loss for training $q_{T}$ can be understood as a reweighing of data by a factor $w_{T}(x)$ based on the temperature-scaled joint probabilities.
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
w _ {T} (x) = \exp \left(\frac {1 - T}{T} \log p (x) - b\right) \tag {6}
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\mathcal {L} \left(q _ {T}\right) = - \mathbb {E} _ {x \sim p} \left[ w _ {T} (x) \log q _ {T} (x) \right] \tag {7}
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
Corollary 4.1. $\frac{e^b}{Z_{p_T}}\mathcal{L}(q_T) = KL(p_T||q_T) + H(p_T)$ .
|
| 117 |
+
|
| 118 |
+
Proof. Evaluating $\frac{e^b}{Z_{p_T}}\mathcal{L}(q_T)$ gives Eq. 4, which is equal to $KL(p_T||q_T) + H(p_T)$ .
|
| 119 |
+
|
| 120 |
+
The idea of LHTS is to train a model $q_{T}$ with tractable sampling on the objective in Eq. 7, so that we can sample from $q_{T} \approx p_{T}$ efficiently after training. In this sense, LHTS can be considered an amortized inference method for accessing otherwise intractable temperature-scaled joint distributions. Compared to myopic temperature scaling, LHTS is not a pure post-hoc transformation since it requires model learning. Nevertheless, we can avoid learning completely from scratch, by finetuning $q_{T}$ from $p$ (which can be thought of as $q_{T=1}$ ). In return for the cost of finetuning, LHTS improves upon myopic temperature scaling in two ways. First, the temperature operates on the joint (long horizon) distribution, instead of greedily on one dimension at a time. Second, LHTS can be readily applied to any likelihood-based generative model, beyond just autoregressive models.
|
| 121 |
+
|
| 122 |
+
In the rest of this section, we examine LHTS on hierarchical latent variable models and autoregressive models.
|
| 123 |
+
|
| 124 |
+
# 4.1. LHTS on Hierarchical Latent Variable Models
|
| 125 |
+
|
| 126 |
+
Applying LHTS on hierarchical latent variable models is straightforward, by using their variational lower bound estimates of the data likelihood.
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
\begin{array}{l} \log p (x _ {0}) \geq \mathbb {E} _ {h} \left[ D _ {K L} \left(h \left(x _ {K} \mid x _ {0}\right) \mid \mid p \left(x _ {K}\right)\right) - \log p \left(x _ {0} \mid x _ {1}\right) \right. \\ \left. + \sum_ {k > 1} D _ {K L} \left(h \left(x _ {k - 1} \mid x _ {k}, x _ {0}\right) \mid \mid p \left(x _ {k - 1} \mid x _ {k}\right)\right) \right] \end{array} \tag {8}
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
We can then plug in this likelihood lower bound to LHTS to compute the importance weights for each data point, and finetune $q_{T}$ with Eq. 7, where the inner likelihood is again evaluated with the lower-bound in Eq. 8.
|
| 133 |
+
|
| 134 |
+
Diffusion Models Although diffusion models can also be formulated as a hierarchical latent variable model, they are
|
| 135 |
+
|
| 136 |
+
often trained using a simpler MSE loss on the noise (Ho et al., 2020). Nevertheless, LHTS is still directly applicable by scaling the loss for each point by the importance weight.
|
| 137 |
+
|
| 138 |
+
$$
|
| 139 |
+
\mathcal {L} \left(q _ {T}\right) = \tag {9}
|
| 140 |
+
$$
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\mathbb {E} _ {k, x _ {0}, \epsilon} \Big [ w _ {T} (x _ {0}) | | \epsilon - \epsilon_ {q _ {T}} (\sqrt {\bar {\alpha} _ {k}} x _ {0} + \sqrt {1 - \bar {\alpha} _ {k}} \epsilon , k) | | ^ {2} \Big ]
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
We can apply LHTS in exactly the same way for other likelihood-based models by scaling the log-likelihood loss of each datapoint by its importance weight. For autoregressive models, however, we can take advantage of the autoregressive factorization to derive a variance-reduced formulation of LHTS, which we describe next.
|
| 147 |
+
|
| 148 |
+
# 4.2. Variance-Reduced LHTS on Autoregressive Models
|
| 149 |
+
|
| 150 |
+
To apply LHTS to autoregressive models, we first rewrite the LHTS objective from Eq. 7 into a form that is amenable to autoregressive architectures by first sampling the index $i$ uniformly, then the prefix $x_{< i}$ , and then the suffix $x_{\geq i}$ .
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
\begin{array}{l} - \mathbb {E} _ {x \sim p} [ w _ {T} (x) \log q _ {T} (x) ] \\ = - \mathbb {E} _ {x \sim p} [ \sum_ {i} w _ {T} (x) \log q _ {T} (x _ {i} | x _ {< i}) ] \\ = - \mathbb {E} _ {i, x _ {< i} \sim p} \mathbb {E} _ {x _ {\geq i} \sim p (\cdot | x _ {< i})} [ w _ {T} (x) \log q _ {T} (x _ {i} | x _ {< i}) ] \\ \end{array}
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+
The purpose of this roundabout rewriting of the expectation is to illustrate that the autoregressive objective is composed of many univariate conditional losses, for each index $i$ and prefix $x_{< i}$ . This derivation allows us to design the baseline more carefully, since we can choose a different baseline for each univariate conditional loss while still trivially preserving the strict properness of the overall loss function.
|
| 157 |
+
|
| 158 |
+
Proposition 4.2. Let $\mathcal{L}^{AR}(q_T) =$
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
- \mathbb {E} _ {i, x < i} \sim p e ^ {- b (x < i)} \mathbb {E} _ {x \geq i} \sim p (\cdot | x < i) [ w _ {T} (x) \log q _ {T} (x _ {i} | x < i) ]
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
If $b(x_{<i})$ is finite for all $x_{<i}$ , then $\mathcal{L}_{q_T}^{AR}$ is a strictly proper loss function, i.e. the unique global optimum is $q_T = p_T$ .
|
| 165 |
+
|
| 166 |
+
Proof. Each inner expectation takes on an importance-weighted log loss of the univariate conditional, corresponding to optimizing $KL(p_{T}(\cdot |x_{<i})||q_{T}(\cdot |x_{<i}))$ . Since an autoregressive model fits all the univariate conditionals separately, these are independent optimization problems each with strictly proper losses. Any positive combination $(b(x_{<i})$ is finite) preserves strict properness of the loss. $\square$
|
| 167 |
+
|
| 168 |
+
In particular, we can set $b(x_{<i}) = \frac{1 - T}{T} \log p(x_{<i}) + b(i) - b$ to be the temperature scaled joint distribution of the prefix,
|
| 169 |
+
|
| 170 |
+
giving us a variance-reduced importance weight.
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
\begin{array}{l} - \mathbb {E} _ {i, x < i} \sim p e ^ {- b (x < i)} \mathbb {E} _ {x \geq i} \sim p (\cdot | x < i) [ w _ {T} (x) \log q _ {T} (x _ {i} | x < i) ] \\ = - \mathbb {E} _ {i, x < i \sim p} e ^ {\frac {1 - T}{T} \log p (x < i) - b (x < i)} \\ \mathbb {E} _ {x \geq i \sim p (\cdot | x < i)} \left[ e ^ {\frac {1 - T}{T} \log p (x _ {\geq i} | x < i) - b} \log q _ {T} \left(x _ {i} \mid x < i\right) \right] \\ = - \mathbb {E} _ {i, x \sim p} \left[ e ^ {\frac {1 - T}{T}} \log p \left(x _ {\geq i} \mid x < i\right) - b (i) \log q _ {T} \left(x _ {i} \mid x < i\right) \right] \tag {10} \\ \end{array}
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
Compared to Eq. 7, in Eq. 10 we modified the expression in the exponent of the importance weight from $\log p(x)$ to $\log p(x_{\geq i}|x_{< i})$ . This makes sense intuitively: once we have fixed a prefix $x_{< i}$ of the sequence, we only need to learn how likely a suffix should be relative to other suffixes, so we can ignore the probability of the prefix $p(x_{< i})$ . Moreover, appealing to Proposition 4.2, we transformed the term $b$ to an index-dependent term $b(i)$ . In a similar spirit to Eq. 5, we will set $b(i)$ to keep the weights close to 1 by matching the empirical mean of the suffix log-likelihoods.
|
| 177 |
+
|
| 178 |
+
$$
|
| 179 |
+
b (i) = \frac {1}{| \mathcal {D} |} \sum_ {x \in \mathcal {D}} \frac {1 - T}{T} \log p \left(x _ {\geq i} \mid x _ {< i}\right) \tag {11}
|
| 180 |
+
$$
|
| 181 |
+
|
| 182 |
+
Computing Suffix Likelihoods One important consideration is the efficient implementation of variance-reduced LHTS on modern causal architectures of autoregressive models. Conveniently, we can vectorize the computation of suffix log-likelihoods $v_{i}(x) = \log p(x_{\geq i}|x_{< i})$ via a reverse cumulative sum on the vector of univariate conditionals $u_{i} = \log p(x_{i}|x_{< i})$ .
|
| 183 |
+
|
| 184 |
+
Suffix Horizon Length Even with the above baseline, the variance of joint likelihoods can still grow quickly when the sequence length is long, e.g. 1024. A practical approach to reducing the variance even more is by limiting the horizon to some length $h$ . This means replacing all the suffix log-likelihoods $\log p(x_{\geq i}|x_{<i})$ with a horizon-bounded suffix log-likelihood $\log p(x_{i:k}|x_{<i})$ where $k = \min (i + h, \text{context length})$ .
|
| 185 |
+
|
| 186 |
+
# 5. Implementation
|
| 187 |
+
|
| 188 |
+
In this section, we describe a list of practical considerations for implementing LHTS, and include concrete pseudocode for our implementation.
|
| 189 |
+
|
| 190 |
+
**Clipping** Even with a baseline to keep the exponents small, the importance weights still involve exponentiation. Therefore, the weights can become unstable when the log probabilities are much higher than the baseline or when the long horizon temperature is small. Therefore, we clip the log of the importance weights, introducing bias but reducing variance to help stabilize training.
|
| 191 |
+
|
| 192 |
+
Data Sampling The LHTS objective is written as an expectation over samples from $p$ . We can indeed sample from $p$ in the training loop, although this empirically slowed down training by around a factor of 3 for autoregressive language models. In practice, we can assume that $p$ is close to the data distribution $p_{\mathrm{data}}$ , and evaluate the LHTS objective using the training set $\mathcal{D}$ . The weights of samples from $\mathcal{D}$ are then computed using $p$ , which is faster than sampling from $p$ .
|
| 193 |
+
|
| 194 |
+
Multi-Temperature Finetuning In some of the experiments, we finetune a single weight-tied model on a set of discrete temperatures $T_{1} \ldots T_{k}$ . Due to the differences in importance weights, more extreme temperatures incurred higher loss and hindered the training of other temperatures. Hence, we normalize the loss of each temperature to help with balanced training across the different temperatures.
|
| 195 |
+
|
| 196 |
+
KL Loss Following design choices of Quark (Lu et al., 2022), we include a KL loss to avoid diverging from the base model $p$ too much. However, empirically we did not observe differences from the inclusion of this auxiliary loss.
|
| 197 |
+
|
| 198 |
+
Streaming Statistics As written in Eq. 5 and Eq. 11, we choose the baseline to be the empirical mean of the data (suffix) log-likelihood. In practice, since the dataset could be very large (e.g. OpenWebText), we instead use the running mean of the data statistics as the baseline.
|
| 199 |
+
|
| 200 |
+
# 5.1. Pseudocode
|
| 201 |
+
|
| 202 |
+
Putting all the implementation details together, we present the pseudocode for LHTS finetuning in Alg. 1. We only present the variance-reduced LHTS for autoregressive models, since LHTS for diffusion models takes on a simpler form. The horizon likelihood is computed in lines 4&5, where $\mathrm{RevCumSum}$ computes reverse cumulative sum, and $\mathrm{pad}(\mathbf{s}_{h:},\mathbf{0}_{:h})$ appends a vector of $h$ zeros to the end of $\mathbf{s}_h$ . Importantly, the weight in line 8 is tailored to each index of the context window, using the formulation derived from Section 4.2. On line 10, StopGradient prevents the loss normalization calculations from affecting the gradient computation. The algorithm outputs parameters for a weight-tied model for sampling from multiple long horizon temperatures. In practice, designing the temperature embeddings to be linearly constrained (Section 6.2) even allows extrapolation to temperatures unseen during training.
|
| 203 |
+
|
| 204 |
+
# 6. Experiments
|
| 205 |
+
|
| 206 |
+
We examine LHTS on three types of models: a diffusion-based image model (DDPM), an autoregressive character model, and an autoregressive language model (GPT-2 (Radford et al., 2019)). For diffusion models, we compare against a pseudo-temperature baseline that reduces the variance of
|
| 207 |
+
|
| 208 |
+
# Algorithm 1: LHTS Finetuning
|
| 209 |
+
|
| 210 |
+
Input: Training data $\mathcal{D}$ , model $p_{\phi}$ , temperatures $\{T_1,\dots ,T_k\}$ , clip $c$ , suffix horizon $h$
|
| 211 |
+
|
| 212 |
+
Output: Parameters $\theta$ for LHTS weight-tied models $q_{T_1}\ldots q_{T_k}$
|
| 213 |
+
|
| 214 |
+
1 $\mathbf{b},\mathbf{m},n,\theta \leftarrow \mathbf{0},\mathbf{0},0,\phi$
|
| 215 |
+
2 while training do
|
| 216 |
+
|
| 217 |
+
/* Sample training data and temperature $T_{j}$ */ 3 $x\sim \mathcal{D}\qquad j\sim \mathcal{U}(1,k)$
|
| 218 |
+
/* Compute suffix log likelihood */
|
| 219 |
+
4 s← RevCumSum(logp(xi|x<))
|
| 220 |
+
/* Limit suffix horizon */
|
| 221 |
+
s s←s- pad(sh.:0:h)
|
| 222 |
+
/* Update streaming statistics */
|
| 223 |
+
6 $n\gets n + 1$ $\mathbf{b}\leftarrow \mathbf{b} + \mathbf{s}$
|
| 224 |
+
|
| 225 |
+
/* Compute LHTS importance weights */
|
| 226 |
+
7 $\mathbf{w}\gets \exp (\min (\frac{1 - T_j}{T_j} (\mathbf{s} - \frac{\mathbf{b}}{n}),c))$
|
| 227 |
+
/* Compute index-weighted log loss */
|
| 228 |
+
8 $\mathcal{L}\gets -\sum_{i}\mathbf{w}_{i}\log q_{T_{j},\theta}(x_{i}|x_{< i})$
|
| 229 |
+
/* Compute KL Loss */
|
| 230 |
+
9 $\kappa \gets \sum_{i}D_{KL}(p_{\phi}(\cdot |x_{< i})||q_{T_j,\theta}(\cdot |x_{< i}))$
|
| 231 |
+
/*Normalize loss for each temperature */
|
| 232 |
+
10 | $\mathbf{m}_j \gets \mathbf{m}_j + \text{StopGradient}(\mathcal{L} + \beta \mathcal{K})$
|
| 233 |
+
/* Update model parameters */
|
| 234 |
+
$\mathbf{u} \mid \theta \gets \theta - \nabla_{\theta}(\mathbf{m}_j / n)^{-1}(\mathcal{L} + \beta \mathcal{K})$
|
| 235 |
+
|
| 236 |
+
Return: $\theta$
|
| 237 |
+
|
| 238 |
+
the diffusion noise. For autoregressive models, we compare against myopic temperature scaling. We aim to show that LHTS can generate samples with higher likelihood and more diversity, compared to the baseline temperature scaling methods. Finally, we test the practical benefits of the LHTS language model on a multiple choice task.
|
| 239 |
+
|
| 240 |
+
# 6.1. Diffusion Image Model
|
| 241 |
+
|
| 242 |
+
First, we apply LHTS on diffusion image models. Training diffusion models from scratch can be compute intensive, so we instead take a pretrained DDPM (Ho et al., 2020) and finetune with the LHTS objective. We compute the ELBO of each image in the CIFAR-10 (Krizhevsky et al., 2009) training set with respect to the pretrained DDPM in joint space (i.e., without dividing by the number of dimensions) and compute the LHTS importance weight of each image. Then, we finetune for 50000 steps using the DDPM objective in Eq. 9 scaled by the computed importance weights.
|
| 243 |
+
|
| 244 |
+
Since there is no natural temperature scaling baseline for diffusion models, we compare against a pseudo-temperature scaling of the diffusion model by reducing the noise variance. At each step of the reverse diffusion process, we sample a noise vector from a Gaussian $\mathcal{N}(0,t)$ , where the pseudo-temperature $t$ is controls the standard deviation of
|
| 245 |
+
|
| 246 |
+

|
| 247 |
+
Figure 2. Temperature scaling on diffusion models for CIFAR-10. The black dots form the Pareto frontier of pseudo-temperature scaling on DDPM (with pseudo-temperatures 0.99, 0.985, and 0.98), and the orange shows long horizon temperature scaling via finetuning (with long horizon temperatures 0.999, 0.995, 0.99). The x-axis plots log likelihood and y-axis plots negative FID score using 50k samples. Towards the top right of the chart is better.
|
| 248 |
+
|
| 249 |
+

|
| 250 |
+
Figure 3. Generated image samples from temperature scaled DDPM. Left: pseudo-temperature scaling, with worse FID score 3.94 and lower sample likelihood $-3.09$ . Right: LHTS, with better FID score 3.66 and higher sample likelihood $-3.07$ .
|
| 251 |
+
|
| 252 |
+

|
| 253 |
+
|
| 254 |
+
the noise. By using a smaller noise variance, we hope to push the Langevin sampling process to converge to images with higher likelihood, though at the cost of distorting the marginal distribution at each timestep.
|
| 255 |
+
|
| 256 |
+
To compare LHTS and pseudo-temperature, we plot the log-likelihood of samples and the FID score of the temperature-scaled models. Ideally, a temperature-scaled model should output samples that evaluate as more likely under the pretrained model distribution, without sacrificing too much diversity. In Figure 2, we see that the LHTS model is able to beat the Pareto frontier of pseudo-temperature scaled models, where diversity is measured with the negative FID score. We plot uncurated samples in Figure 3. Even though both pseudo-temperature scaling and LHTS can push the model into sampling images with higher likelihood (with respect to the pretrained model), LHTS is able to do so while sacrificing less of generation quality and diversity.
|
| 257 |
+
|
| 258 |
+
# 6.2. Autoregressive Character Model
|
| 259 |
+
|
| 260 |
+
Next, we experiment with a transformer-based autoregressive character model on the Text8 dataset (Mahoney, 2011). Though character modeling is an easier task than language modeling, it provides useful insights on the differences between LHTS and myopic temperature scaling. In particular, it allows us to experiment with training a weight-tied model for a continuous range of long horizon temperatures.
|
| 261 |
+
|
| 262 |
+

|
| 263 |
+
Figure 4. Autoregressive character model with a tunable long horizon temperature parameter. The heatmap shows log-likelihood of samples over various settings of long horizon and myopic temperature. Tuning both temperatures (orange) allows us to increase the likelihood more than just tuning the myopic temperature (blue). More importantly, we achieve a better trade-off between likelihood and diversity. The orange setting gives a higher likelihood with noticeably diverse chunks of text, whereas the blue setting gives lower likelihood yet gives many repetitive generations.
|
| 264 |
+
|
| 265 |
+
Continuous Temperature LHTS Our goal is to train a model that can be deployed with a "knob" for controlling the long horizon temperature, similar to how existing autoregressive models in deployment (e.g. GPT) give users control over the myopic temperature.
|
| 266 |
+
|
| 267 |
+
We first train a base 12-layer Transformer model from scratch, and store this model $p$ to use for computing LHTS importance weights. Then, we finetune a copy $q_{T}$ of this model with the LHTS objective on a continuous range of long horizon temperatures. To do so, we place the long horizon temperature (a scalar) as a special token at the beginning of the transformer's context window. We then learn a linear embedding $r$ to map this prefix temperature token into the transformer's embedding space. Finally, we place the training data into the remaining context positions, and train with the LHTS objective. In other words, the prefix token of the long horizon temperature informs the transformer how "sharp" the predicted distribution should be.
|
| 268 |
+
|
| 269 |
+
Since choosing small temperatures can lead to large importance weights, we only vary the training temperature from 0.9 to 1.1. Nevertheless, at deployment time we can still feed temperatures beyond the training range into the learned linear embedding $r$ , and push the model to extrapolate to unseen long horizon temperatures. Surprisingly, we find that the model extrapolates smoothly (Figure 4), with the sample likelihood steadily improving when feeding in long horizon temperatures much less than 0.9 (leftward on the x-axis) into the prefix temperature token.
|
| 270 |
+
|
| 271 |
+
With a knob for the long horizon temperature, we can tweak
|
| 272 |
+
|
| 273 |
+
both the long horizon and the myopic temperature in unison. For example, in Figure 4 we consider two settings of tuning the long horizon temperature to 0.1 and myopic temperature to 0.3 (orange), versus tuning just the myopic temperature to 0.1 (blue). The orange setting gives an average sample likelihood of $-0.97$ w.r.t. $p$ , which is better than $-1.05$ w.r.t. $p$ for the blue setting. On top of that, the orange setting generates much more diverse character chunks<sup>1</sup>, whereas the blue setting repeatedly outputs the same few character chunks. This aligns with the intuition that LHTS can "look ahead" to find many diverse sequences of high likelihood, whereas myopic temperature scaling can only greedily choose the next token, leading to low diversity.
|
| 274 |
+
|
| 275 |
+
# 6.3. Autoregressive Language Model
|
| 276 |
+
|
| 277 |
+
Lastly, we demonstrate the scalability of LHTS on various sizes of the GPT-2 (small, medium, large) language model. As before, we take a pretrained model to compute LHTS importance weights, and finetune a copy of it using the LHTS objective. We use the standard GPT-2 architecture and context window of 1024, with pretrained weights from HuggingFace (Wolf et al., 2020), and finetune on the OpenWebText (Gokaslan & Cohen, 2019) corpus.
|
| 278 |
+
|
| 279 |
+
We compare with two baselines: myopic temperature scaling, and a partition-based controllable generation approach (Quark) (Lu et al., 2022). Quark was introduced as a conditional generation approach for controlling the level of toxicity of the language model, but can be similarly applied for controlling sample likelihood of the model.
|
| 280 |
+
|
| 281 |
+
When comparing different approaches for temperature scaling, we consider both the likelihood and the quality of the generated samples. We can measure the likelihood of the generated samples by directly evaluating them on the pretrained model. For sample quality, and we rely on quantitative evaluation using diversity metrics (Welleck et al., 2019; Liang et al., 2022) and a multiple-choice task (Mikolov et al., 2013), where temperature scaling is commonly used to reduce the randomness of the model's answers.
|
| 282 |
+
|
| 283 |
+
In Figure 5a, we plot the sample diversity (measured by token-level repetition) and the log-likelihood over 1k sequences of context 1024 for each temperature scale. In each of the three charts (for GPT2 small/medium/large), we see the Pareto frontier of circles formed by the myopic temperature scaling baseline with temperature ranging from 0.75 to 0.8. Using LHTS, plotted by triangles, we can achieve a better trade-off between diversity and likelihood, especially for GPT2-medium and GPT2-large. The partition (Quark) baseline is not visible since the repetition values are worse and do not reside within the bounds of the chart.
|
| 284 |
+
|
| 285 |
+
Figure 5. Likelihood and sample quality metrics for temperature-scaled GPT-2.
|
| 286 |
+

|
| 287 |
+
(a) Plot of the Pareto frontier between repetitiveness of text and log-likelihood of text for GPT-2 models: small (pink), medium (red), large (maroon). Circles show myopic temperatures of 0.8, 0.775, 0.75. Triangles show LHTS temperature of 0.95. Towards the top right of the charts is better.
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
|
| 291 |
+

|
| 292 |
+
|
| 293 |
+

|
| 294 |
+
(b) Visualizing the best settings from Table 1. Circle: myopic, Cross:Quark, Triangle:LHTS
|
| 295 |
+
|
| 296 |
+
Table 1. Accuracy of temperature-scaled GPT-2 on a multiple choice analogy task. Turning the myopic temperature down decreases the chance of irrelevant answers. At the lowest myopic temperature, LHTS generally improves upon the accuracy of the pretrained model.
|
| 297 |
+
|
| 298 |
+
<table><tr><td rowspan="2"></td><td rowspan="2">model myopic T</td><td colspan="3">gpt2 small</td><td colspan="3">gpt2 medium</td><td colspan="3">gpt2 large</td></tr><tr><td>1.0</td><td>0.5</td><td>0.0</td><td>1.0</td><td>0.5</td><td>0.0</td><td>1.0</td><td>0.5</td><td>0.0</td></tr><tr><td rowspan="3">distinct</td><td>LHTST=0.95</td><td>0.172</td><td>0.238</td><td>0.255</td><td>0.185</td><td>0.242</td><td>0.252</td><td>0.179</td><td>0.225</td><td>0.232</td></tr><tr><td>pretrained</td><td>0.143</td><td>0.231</td><td>0.254</td><td>0.156</td><td>0.220</td><td>0.233</td><td>0.142</td><td>0.218</td><td>0.228</td></tr><tr><td>partition (Quark)</td><td>0.111</td><td>0.201</td><td>0.233</td><td>0.155</td><td>0.219</td><td>0.232</td><td>0.158</td><td>0.229</td><td>0.250</td></tr><tr><td rowspan="3">duplicale</td><td>LHTST=0.95</td><td>0.177</td><td>0.224</td><td>0.230</td><td>0.225</td><td>0.270</td><td>0.275</td><td>0.249</td><td>0.310</td><td>0.317</td></tr><tr><td>pretrained</td><td>0.189</td><td>0.267</td><td>0.275</td><td>0.200</td><td>0.262</td><td>0.264</td><td>0.203</td><td>0.279</td><td>0.290</td></tr><tr><td>partition (Quark)</td><td>0.137</td><td>0.221</td><td>0.233</td><td>0.197</td><td>0.264</td><td>0.270</td><td>0.213</td><td>0.279</td><td>0.285</td></tr></table>
|
| 299 |
+
|
| 300 |
+
Analogy Multiple Choice We evaluate the generation quality of LHTS on a downstream multiple-choice task that tests the model's ability to choose correct analogies. We create a set of 1400 questions from a bank of analogies (Mikolov et al., 2013) with relationships such as country:capital, present-tense:past-tense, male:female. We prompt GPT-2 using the following format, including three similar examples in-context:
|
| 301 |
+
|
| 302 |
+
Question: Please choose the word pair that is most analogous to "Algeria dinar".
|
| 303 |
+
|
| 304 |
+
Choices: "Macedonia dollar", "Vietnam baht", "Bulgaria lev", "Armenia naira"
|
| 305 |
+
Answer:
|
| 306 |
+
|
| 307 |
+
To measure correctness, we check the next 8 generated tokens for a unique match with the correct choice, ignoring double matches. We also create a variant of questions where three of the choices share the first word, inspired by the example in Figure 1. The three duplicates are chosen independently from (and can include) the correct choice.
|
| 308 |
+
|
| 309 |
+
Question: Please choose the word pair that is most analogous to "Athens Greece".
|
| 310 |
+
|
| 311 |
+
Choices: "Moscow Japan", "Rome Italy", "Moscow Pakistan", "Moscow Australia"
|
| 312 |
+
Answer:
|
| 313 |
+
|
| 314 |
+
In Table 1 we present the accuracy of GPT-2 on this analogy multiple-choice task. The row distinct refers to the first set of questions, and the row duplicate refers to the second set of questions with common first words. For each question we sample the model 50 times. The accuracy improves across
|
| 315 |
+
|
| 316 |
+
the board as we scale down the myopic temperature from 1.0 to 0.0, since all models reduce the chance of outputting irrelevant answers. At the best myopic temperature of 0.0, LHTS gives the highest accuracy in 4/6 settings, with $10\%$ improvement to give $31\%$ accuracy on the most competitive setting with the duplicate question set and GPT2 large. We also see that using Quark to condition on joint likelihood is less effective on average, possibly because partitioning full sequences based on joint likelihood is more crude than a suffix-dependent rescaling (Section 4.2), and reinforcing based on likelihood was noticeably unstable during training.
|
| 317 |
+
|
| 318 |
+
# 7. Conclusion
|
| 319 |
+
|
| 320 |
+
We present Long Horizon Temperature Scaling, a novel and tractable approach to sampling from temperature-scaled joint distributions. Compared to previous methods, LHTS is non-myopic and compatible with all likelihood-based generative models. To reduce the variance of the LHTS objective, we introduce important techniques such as fitting baselines and limiting suffix horizon lengths. In some settings, LHTS even shows smooth extrapolation to unseen temperatures, enabling low-variance training on mild temperatures and sampling on extreme temperatures. We demonstrate the applicability of LHTS on diffusion and autoregressive models in image and language domains. LHTS shows improve
|
| 321 |
+
|
| 322 |
+
ments over pseudo and myopic temperature scaling in the trade-off between likelihood and sample diversity, and in the accuracy of a multiple-choice analogy task.
|
| 323 |
+
|
| 324 |
+
Limitations and Future Work Temperature scaling the joint distribution is inherently intractable (scaling the temperature to 0 gives the argmax of the joint distribution), and LHTS only aims to learn an approximation to the solution. In addition, LHTS involves finetuning the model, as opposed to pure post-hoc alternatives such as myopic or pseudo temperature scaling. Future work can look into exploring multi-temperature finetuning further, or other divergences besides forward-KL for the LHTS objective.
|
| 325 |
+
|
| 326 |
+
# 8. Acknowledgments
|
| 327 |
+
|
| 328 |
+
We thank anonymous reviewers for their constructive feedback. This research was supported in part by NSF (#1651565), ARO (W911NF-21-1-0125), ONR (N00014-23-1-2159, N00014-22-1-2293), CZ Biohub, HAI.
|
| 329 |
+
|
| 330 |
+
# References
|
| 331 |
+
|
| 332 |
+
Bommasani, R., Hudson, D. A., Adeli, E., Altman, R., Arora, S., von Arx, S., Bernstein, M. S., Bohg, J., Bosse-lut, A., Brunskill, E., et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.
|
| 333 |
+
Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems, 33: 1877-1901, 2020.
|
| 334 |
+
Clark, C., Lee, K., Chang, M.-W., Kwiatkowski, T., Collins, M., and Toutanova, K. Boolq: Exploring the surprising difficulty of natural yes/no questions. arXiv preprint arXiv:1905.10044, 2019.
|
| 335 |
+
Desai, S. and Durrett, G. Calibration of pre-trained transformers. arXiv preprint arXiv:2003.07892, 2020.
|
| 336 |
+
Fan, A., Lewis, M., and Dauphin, Y. Hierarchical neural story generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 889-898, 2018.
|
| 337 |
+
Gershman, S. and Goodman, N. Amortized inference in probabilistic reasoning. In Proceedings of the annual meeting of the cognitive science society, volume 36, 2014.
|
| 338 |
+
Gokaslan, A. and Cohen, V. Openwebtext corpus, 2019.
|
| 339 |
+
Guo, C., Pleiss, G., Sun, Y., and Weinberger, K. Q. On calibration of modern neural networks. In International conference on machine learning. PMLR, 2017.
|
| 340 |
+
|
| 341 |
+
Ho, J., Jain, A., and Abbeel, P. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6851, 2020.
|
| 342 |
+
Holtzman, A., Buys, J., Du, L., Forbes, M., and Choi, Y. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
|
| 343 |
+
Kingma, D. P. and Dhariwal, P. Glow: Generative flow with invertible 1x1 convolutions. Advances in neural information processing systems, 31, 2018.
|
| 344 |
+
Koller, D. and Friedman, N. Probabilistic graphical models: principles and techniques. MIT press, 2009.
|
| 345 |
+
Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images, 2009.
|
| 346 |
+
Kwiatkowski, T., Palomaki, J., Redfield, O., Collins, M., Parikh, A., Alberti, C., Epstein, D., Polosukhin, I., Devlin, J., Lee, K., et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453-466, 2019.
|
| 347 |
+
Li, J., Monroe, W., and Jurafsky, D. A simple, fast diverse decoding algorithm for neural generation. arXiv preprint arXiv:1611.08562, 2016.
|
| 348 |
+
Liang, P., Bommasani, R., Lee, T., Tsipras, D., Soylu, D., Yasunaga, M., Zhang, Y., Narayanan, D., Wu, Y., et al. Holistic evaluation of language models. arXiv preprint arXiv:2211.09110, 2022.
|
| 349 |
+
Lu, X., Welleck, S., Jiang, L., Hessel, J., Qin, L., West, P., Ammanabrolu, P., and Choi, Y. Quark: Controllable text generation with reinforced unlearning. arXiv preprint arXiv:2205.13636, 2022.
|
| 350 |
+
Mahoney, M. Large text compression benchmark, 2011.
|
| 351 |
+
Mikolov, T., Chen, K., Corrado, G., and Dean, J. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
|
| 352 |
+
Narayan, S., Cohen, S. B., and Lapata, M. Don't give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. arXiv preprint arXiv:1808.08745, 2018.
|
| 353 |
+
Nichol, A. Q. and Dhariwal, P. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162-8171. PMLR, 2021.
|
| 354 |
+
Nixon, J., Dusenberry, M. W., Zhang, L., Jerfel, G., and Tran, D. Measuring calibration in deep learning. In CVPR Workshops, volume 2, 2019.
|
| 355 |
+
|
| 356 |
+
Pillutla, K., Swayamdipta, S., Zellers, R., Thickstun, J., Welleck, S., Choi, Y., and Harchaoui, Z. Mauve: Measuring the gap between neural text and human text using divergence frontiers. Advances in Neural Information Processing Systems, 34:4816-4828, 2021.
|
| 357 |
+
Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
|
| 358 |
+
Vahdat, A. and Kautz, J. Nvae: A deep hierarchical variational autoencoder. Advances in Neural Information Processing Systems, 33:19667-19679, 2020.
|
| 359 |
+
Vijayakumar, A., Cogswell, M., Selvaraju, R., Sun, Q., Lee, S., Crandall, D., and Batra, D. Diverse beam search for improved description of complex scenes. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 360 |
+
Welleck, S., Kulikov, I., Roller, S., Dinan, E., Cho, K., and Weston, J. Neural text generation with unlikelihood training. arXiv preprint arXiv:1908.04319, 2019.
|
| 361 |
+
Wolf, T., Debut, L., Sanh, V., Chaumont, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., Davison, J., Shleifer, S., von Platen, P., Ma, C., Jernite, Y., Plu, J., Xu, C., Scao, T. L., Gugger, S., Drame, M., Lhoest, Q., and Rush, A. M. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, October 2020.
|
| 362 |
+
|
| 363 |
+
# A. Experimental Settings
|
| 364 |
+
|
| 365 |
+
# Diffusion Model
|
| 366 |
+
|
| 367 |
+
- Architecture: DDPM
|
| 368 |
+
- Learning Rate: 2e-4
|
| 369 |
+
- Batch Size: 128
|
| 370 |
+
EMA decay: 0.9999
|
| 371 |
+
GradClip:1
|
| 372 |
+
Steps: 50000
|
| 373 |
+
Warmup Steps: 5000
|
| 374 |
+
LHTS Clip: 0.5
|
| 375 |
+
|
| 376 |
+
# Character Model
|
| 377 |
+
|
| 378 |
+
- Architecture: 12-layer Transformer, embedding 768, hidden size 3072, num heads 12, num layers 12
|
| 379 |
+
- Learning Rate: 5e-4
|
| 380 |
+
- Batch Size: 512
|
| 381 |
+
Weight Decay: 0.001
|
| 382 |
+
GradClip:0.25
|
| 383 |
+
- Epochs: 200
|
| 384 |
+
LHTS Clip: 3
|
| 385 |
+
LHTS Suffix Horizon: 25
|
| 386 |
+
|
| 387 |
+
# Language Model
|
| 388 |
+
|
| 389 |
+
- Architecture: GPT-2 (small, medium, large), context 1024
|
| 390 |
+
- Learning Rate: 1e-4
|
| 391 |
+
- Batch Size: 512
|
| 392 |
+
Weight Decay: 0.01
|
| 393 |
+
Grad Clip: 0.25
|
| 394 |
+
Steps: 1000
|
| 395 |
+
LHTS KL beta: 0.05
|
| 396 |
+
LHTS Clip: 3
|
| 397 |
+
LHTS Suffix Horizon: 8
|
| 398 |
+
|
| 399 |
+
# B. Example Sample from GPT-2 Large with LHTS
|
| 400 |
+
|
| 401 |
+
It is always great when you get a chance to get the inside scoop as to why a franchise is so popular, and today I have learned that one of the reasons is the players they play them against. When I joined the St Louis Cardinals, one of my first observations of Albert Pujols was that he was a little tough to hit. Now, having played him a ton of baseball, there's no doubt in my mind that he's just as tough, if not tougher, than anybody else on the field. Pujols, like most power hitters before him, is known best for running his bat out all over the field. The one thing he has in his favor, though, is that when he does come back to the field, he always finds his way to hitting lefties.
|
| 402 |
+
|
| 403 |
+
# C. Additional Experiments
|
| 404 |
+
|
| 405 |
+
We evaluate the diffusion models and language models on additional metrics such as SSIM, MAUVE score, and HELM benchmarks.
|
| 406 |
+
|
| 407 |
+
# C.1. Diffusion Model
|
| 408 |
+
|
| 409 |
+
We use the same DDPM diffusion model from Figure 2, finetuned with LHTS, and report the Structural Similarity Index (SSIM). Unlike FID, SSIM does not consider diversity, but rather closeness to a ground-truth image. Therefore, we see that the SSIM scores in Table 2 align roughly with the log-likelihood scores of Figure 2.
|
| 410 |
+
|
| 411 |
+
Table 2. SSIM of diffusion model with pseudo-temperature scaling and long horizon temperature scaling on CIFAR-10.
|
| 412 |
+
|
| 413 |
+
<table><tr><td rowspan="2">Temperature</td><td colspan="3">PseudoTemp</td><td colspan="3">LHTS</td></tr><tr><td>0.98</td><td>0.985</td><td>0.99</td><td>0.99</td><td>0.995</td><td>0.999</td></tr><tr><td>SSIM</td><td>0.915</td><td>0.913</td><td>0.913</td><td>0.913</td><td>0.913</td><td>0.911</td></tr></table>
|
| 414 |
+
|
| 415 |
+
# C.2. Language Model
|
| 416 |
+
|
| 417 |
+
We examine the same GPT-2 language model from Figure 5a and Table 1, using the gpt2-large size. We compare the use of standard myopic temperature scaling versus LHTS finetuning on MAUVE score (Pillutla et al., 2021) and a number of metrics from HELM (Liang et al., 2022).
|
| 418 |
+
|
| 419 |
+
MAUVE score We evaluate MAUVE score on OpenWebText (Gokaslan & Cohen, 2019) using the setup in the MAUVE paper (Pillutla et al., 2021), with 1000 generations and a prompt length of 30 tokens. We find that LHTS does not improve MAUVE score, and that both forms of temperature scaling (myopic and LHTS) in general decrease MAUVE score.
|
| 420 |
+
|
| 421 |
+
Table 3. MAUVE score of GPT-2 (gpt2-large) with myopic temperature scaling and long horizon temperature scaling on OpenWebText.
|
| 422 |
+
|
| 423 |
+
<table><tr><td></td><td>No Scaling</td><td colspan="2">Myopic Only</td><td colspan="2">LHTS</td></tr><tr><td>Myopic Temperature</td><td>1.0</td><td>0.8</td><td>0.0</td><td>1.0</td><td>0.0</td></tr><tr><td>Long Horizon Temperature</td><td>1.0</td><td>1.0</td><td>1.0</td><td>0.9</td><td>0.9</td></tr><tr><td>MAUVE</td><td>0.76</td><td>0.57</td><td>0.00</td><td>0.41</td><td>0.00</td></tr></table>
|
| 424 |
+
|
| 425 |
+
HELM We evaluate on some metrics from the HELM benchmark such as XSUM (Narayan et al., 2018), BoolQ (Clark et al., 2019), and NaturalQA open book (Kwiatkowski et al., 2019), which respectively test for summarization, classification, and reading comprehension with multiple choice.
|
| 426 |
+
|
| 427 |
+
Table 4. Evaluation of GPT-2 (gpt2-large) on various metrics from HELM.
|
| 428 |
+
|
| 429 |
+
<table><tr><td rowspan="2">Myopic Temperature</td><td colspan="2">Myopic Only</td><td colspan="2">LHTS</td></tr><tr><td>0.8</td><td>0.0</td><td>1.0</td><td>0.0</td></tr><tr><td>Long Horizon Temperature</td><td>1.0</td><td>1.0</td><td>0.9</td><td>0.9</td></tr><tr><td>xsum_test_rouge2</td><td>0.016</td><td>0.019</td><td>0.013</td><td>0.02</td></tr><tr><td>xsum_test_perp (lower)</td><td>6.72</td><td>2.305</td><td>5.137</td><td>1.725</td></tr><tr><td>boolq_exact_MATCH</td><td>0.383</td><td>0.583</td><td>0.417</td><td>0.603</td></tr><tr><td>boolqExact_MATCH_fairness</td><td>0.167</td><td>0.483</td><td>0.173</td><td>0.507</td></tr><tr><td>boolqExact_MATCH_robustness</td><td>0.087</td><td>0.35</td><td>0.113</td><td>0.43</td></tr><tr><td>boolq_ece_10_bin (lower)</td><td>0.112</td><td>0.164</td><td>0.124</td><td>0.174</td></tr><tr><td>naturalqa_open_f1_score</td><td>0.157</td><td>0.257</td><td>0.146</td><td>0.248</td></tr><tr><td>naturalqa_open_f1_score_fairness</td><td>0.058</td><td>0.153</td><td>0.041</td><td>0.164</td></tr><tr><td>naturalqa_open_f1_score_robustness</td><td>0.026</td><td>0.074</td><td>0.031</td><td>0.055</td></tr><tr><td>naturalqa_open_ece_10_bin (lower)</td><td>0.109</td><td>0.134</td><td>0.086</td><td>0.14</td></tr></table>
|
| 430 |
+
|
| 431 |
+
In Table 4, we can see that LHTS shows some improvements in perplexity and accuracy, and less so for calibration and F1-score. LHTS can also help with fairness or robustness perturbations on both accuracy and F1-score. However, we note that these scores are generally low due to the relatively small size of GPT-2, so evaluations on larger models are needed for more conclusive results.
|
2023/Long Horizon Temperature Scaling/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d2590069e7f9a4bdb6434aa6b64e06d0aa523a07bee8b807a2baedcb1e025426
|
| 3 |
+
size 470480
|
2023/Long Horizon Temperature Scaling/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/0329bb0a-5594-4b52-b3f1-8587b4d92ea9_content_list.json
ADDED
|
@@ -0,0 +1,2256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
169,
|
| 8 |
+
109,
|
| 9 |
+
803,
|
| 10 |
+
152
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Min-Kook Suh<sup>1</sup> Seung-Woo Seo<sup>1</sup>",
|
| 17 |
+
"bbox": [
|
| 18 |
+
362,
|
| 19 |
+
196,
|
| 20 |
+
604,
|
| 21 |
+
212
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "Abstract",
|
| 28 |
+
"text_level": 1,
|
| 29 |
+
"bbox": [
|
| 30 |
+
241,
|
| 31 |
+
239,
|
| 32 |
+
320,
|
| 33 |
+
255
|
| 34 |
+
],
|
| 35 |
+
"page_idx": 0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"type": "text",
|
| 39 |
+
"text": "Although contrastive learning methods have shown prevailing performance on a variety of representation learning tasks, they encounter difficulty when the training dataset is long-tailed. Many researchers have combined contrastive learning and a logit adjustment technique to address this problem, but the combinations are done ad-hoc and a theoretical background has not yet been provided. The goal of this paper is to provide the background and further improve the performance. First, we show that the fundamental reason contrastive learning methods struggle with long-tailed tasks is that they try to maximize the mutual information between latent features and input data. As ground-truth labels are not considered in the maximization, they are not able to address imbalances between classes. Rather, we interpret the long-tailed recognition task as a mutual information maximization between latent features and ground-truth labels. This approach integrates contrastive learning and logit adjustment seamlessly to derive a loss function that shows state-of-the-art performance on long-tailed recognition benchmarks. It also demonstrates its efficacy in image segmentation tasks, verifying its versatility beyond image classification. Code is available at https://github.com/blueecdm/Long-tailed-recognition.",
|
| 40 |
+
"bbox": [
|
| 41 |
+
117,
|
| 42 |
+
265,
|
| 43 |
+
444,
|
| 44 |
+
686
|
| 45 |
+
],
|
| 46 |
+
"page_idx": 0
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": "1. Introduction",
|
| 51 |
+
"text_level": 1,
|
| 52 |
+
"bbox": [
|
| 53 |
+
86,
|
| 54 |
+
719,
|
| 55 |
+
217,
|
| 56 |
+
734
|
| 57 |
+
],
|
| 58 |
+
"page_idx": 0
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"type": "text",
|
| 62 |
+
"text": "A supervised classification task has been an active research topic for decades. However, its performance is still unsatisfactory when the dataset shows a long-tailed distribution, where a few classes, i.e., head classes, contain a major num",
|
| 63 |
+
"bbox": [
|
| 64 |
+
84,
|
| 65 |
+
746,
|
| 66 |
+
475,
|
| 67 |
+
806
|
| 68 |
+
],
|
| 69 |
+
"page_idx": 0
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"type": "text",
|
| 73 |
+
"text": "$^{1}$ Department of Electrical and Computer Engineering, Seoul National University, Seoul, South Korea. Correspondence to: MinKook Suh <bluecdm@snu.ac.kr>.",
|
| 74 |
+
"bbox": [
|
| 75 |
+
84,
|
| 76 |
+
815,
|
| 77 |
+
475,
|
| 78 |
+
854
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).",
|
| 85 |
+
"bbox": [
|
| 86 |
+
84,
|
| 87 |
+
864,
|
| 88 |
+
473,
|
| 89 |
+
905
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "ber of samples while the remaining classes, i.e., tail classes, have only a small number of samples. The most straightforward remedy to this problem is to rebalance the training dataset through weighted sampling. However, it is a suboptimal strategy that may be detrimental to the accuracy of the head classes (Wang et al., 2017).",
|
| 96 |
+
"bbox": [
|
| 97 |
+
495,
|
| 98 |
+
239,
|
| 99 |
+
887,
|
| 100 |
+
330
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "Recently, contrastive learning (Oord et al., 2018; Chen et al., 2020a; Khosla et al., 2020) is widely used in representation learning and showing state-of-the-art performance on various tasks. The contrastive learning framework learns representations by pushing latent features from the same sample closer and separating them from different samples. However, its performance degrades on long-tailed datasets as the samples are imbalanced (Cui et al., 2021). Therefore, several works have been conducted to adapt it to the long-tailed recognition tasks (Cui et al., 2021; Zhu et al., 2022) by combining it with logit adjustment techniques (Ren et al., 2020; Menon et al., 2021), which is another method to solve the long-tailed recognition task that modulates the prediction score of networks based on the appearance frequency of classes. Although previous methods empirically show that combining contrastive learning and logit adjustment boosts performance, they do not provide the theoretical meaning of the combination.",
|
| 107 |
+
"bbox": [
|
| 108 |
+
495,
|
| 109 |
+
338,
|
| 110 |
+
888,
|
| 111 |
+
609
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 0
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "text",
|
| 117 |
+
"text": "In this paper, we describe the theoretical meaning of the combination and provide an improved method for combining contrastive learning and logit adjustment. We find that the performance of previous contrastive learning methods degrade on long-tailed datasets because they aim to maximize the mutual information (MI) between the latent features and input data. These approaches do not consider the imbalance of label distribution, as the ground-truth label is not involved in the maximization. Instead, we propose maximizing the MI between latent features and ground-truth labels, allowing the consideration of label distribution.",
|
| 118 |
+
"bbox": [
|
| 119 |
+
495,
|
| 120 |
+
618,
|
| 121 |
+
888,
|
| 122 |
+
784
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 0
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "text",
|
| 128 |
+
"text": "By replacing the input data term with the ground-truth label term, we derive a general loss function that encompasses various other methods. The derived loss function includes a likelihood of latent feature term and a prior of classes term, and different ways of modeling these terms lead to different previous methods. For example, the softmax cross-entropy loss for a balanced dataset and the logit adjustment",
|
| 129 |
+
"bbox": [
|
| 130 |
+
495,
|
| 131 |
+
791,
|
| 132 |
+
888,
|
| 133 |
+
897
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 0
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "page_number",
|
| 139 |
+
"text": "1",
|
| 140 |
+
"bbox": [
|
| 141 |
+
480,
|
| 142 |
+
922,
|
| 143 |
+
491,
|
| 144 |
+
934
|
| 145 |
+
],
|
| 146 |
+
"page_idx": 0
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"type": "image",
|
| 150 |
+
"img_path": "images/4f37586867479774c452701693711ad692e663fd7fe328156ca91fa96c30277e.jpg",
|
| 151 |
+
"image_caption": [
|
| 152 |
+
"Figure 1. We address the long-tailed recognition by maximizing the mutual information of latent features, $x$ , and ground-truth labels, $y$ . We solve the maximization problem by dividing it into two terms: an unnormalized likelihood term, $s(x|y)$ , and a logit-adjustment term to compensate for label frequency, $\\eta_y$ . $\\eta_y$ is a value that depends on the frequency of the label, and $s(x|y)$ is estimated using a neural network. The proposed loss is achieved by estimating $s(x|y)$ with Gaussian kernels using latent features of other samples."
|
| 153 |
+
],
|
| 154 |
+
"image_footnote": [],
|
| 155 |
+
"bbox": [
|
| 156 |
+
119,
|
| 157 |
+
80,
|
| 158 |
+
851,
|
| 159 |
+
253
|
| 160 |
+
],
|
| 161 |
+
"page_idx": 1
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"type": "text",
|
| 165 |
+
"text": "term for an imbalanced dataset (Ren et al., 2020) can be derived by modeling the likelihood as an isotropic Gaussian. Supervised contrastive loss (Khosla et al., 2020) can be derived under the assumption of a balanced training dataset by estimating the likelihood using a sampling-based kernel density estimation with Gaussian kernels.",
|
| 166 |
+
"bbox": [
|
| 167 |
+
84,
|
| 168 |
+
345,
|
| 169 |
+
475,
|
| 170 |
+
436
|
| 171 |
+
],
|
| 172 |
+
"page_idx": 1
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"type": "text",
|
| 176 |
+
"text": "By removing the assumption of a balanced dataset, we derive the proposed loss function that seamlessly integrates the contrastive learning and logit adjustment. Since the kernel density estimation results in a Gaussian mixture likelihood, we refer to the loss as Gaussian Mixture Likelihood (GML) loss. We also provide an efficient method for modeling the Gaussian mixture likelihood, as shown in Fig. 1. We use contrast samples to estimate the likelihood. Similar to Momentum Contrast (MoCo) (He et al., 2020), we use queues to store contrast samples. However, because a long-tailed dataset is being handled, tail classes do not have sufficient samples to create the Gaussian mixture. To resolve this problem, we use multiple class-wise queues rather than a single queue of MoCo. However, in the case of tail classes, the update frequencies of contrast samples are significantly longer. As a result, old samples of tail classes' queues are generated by highly outdated encoders. Therefore, we use class-wise queues along with a teacher-student strategy. Unlike a momentum encoder used in MoCo, we use a pre-trained teacher to generate contrast samples.",
|
| 177 |
+
"bbox": [
|
| 178 |
+
86,
|
| 179 |
+
444,
|
| 180 |
+
477,
|
| 181 |
+
748
|
| 182 |
+
],
|
| 183 |
+
"page_idx": 1
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"type": "text",
|
| 187 |
+
"text": "We evaluate the proposed method on various long-tailed recognition datasets: ImageNet-LT (Liu et al., 2019), iNaturalist 2018 (Van Horn et al., 2018), and CIFAR-LT (Cui et al., 2019); the proposed method surpasses all previous long-tailed recognition methods. In addition, as the proposed method is related to supervised contrastive learning and knowledge distillation, we compare our method with them on both balanced and imbalanced datasets. Unsurprisingly, our method shows superior performance to them on imbalanced datasets, exhibiting comparable performance on",
|
| 188 |
+
"bbox": [
|
| 189 |
+
84,
|
| 190 |
+
753,
|
| 191 |
+
475,
|
| 192 |
+
905
|
| 193 |
+
],
|
| 194 |
+
"page_idx": 1
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
"type": "text",
|
| 198 |
+
"text": "balanced datasets. Finally, we evaluate our method on a commonly used semantic segmentation dataset ADE20K (Zhou et al., 2017), which also contains imbalanced pixel labels. Simply replacing the cross-entropy loss with the proposed loss also boosts the performance, indicating the proposed framework can be extended beyond a classification task.",
|
| 199 |
+
"bbox": [
|
| 200 |
+
496,
|
| 201 |
+
345,
|
| 202 |
+
887,
|
| 203 |
+
436
|
| 204 |
+
],
|
| 205 |
+
"page_idx": 1
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"type": "text",
|
| 209 |
+
"text": "Our main contributions are summarized as follows.",
|
| 210 |
+
"bbox": [
|
| 211 |
+
496,
|
| 212 |
+
445,
|
| 213 |
+
836,
|
| 214 |
+
459
|
| 215 |
+
],
|
| 216 |
+
"page_idx": 1
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"type": "list",
|
| 220 |
+
"sub_type": "text",
|
| 221 |
+
"list_items": [
|
| 222 |
+
"- We show that the fundamental limitation of contrastive learning methods on long-tailed tasks comes from directly maximizing the MI between latent features and input data. Instead, we propose to tackle the long-tailed recognition by MI maximization between latent features and ground-truth labels.",
|
| 223 |
+
"- While previous methods have combined contrastive learning and the logit adjustment without investigating a theoretical background, we find that contrastive learning implies a Gaussian mixture likelihood and the logit adjustment is derived from the prior of classes.",
|
| 224 |
+
"- We propose an efficient way to model the Gaussian mixture likelihood using a teacher-student framework that demonstrates its superiority in various long-tailed recognition tasks."
|
| 225 |
+
],
|
| 226 |
+
"bbox": [
|
| 227 |
+
516,
|
| 228 |
+
467,
|
| 229 |
+
885,
|
| 230 |
+
694
|
| 231 |
+
],
|
| 232 |
+
"page_idx": 1
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"type": "text",
|
| 236 |
+
"text": "2. Related Work",
|
| 237 |
+
"text_level": 1,
|
| 238 |
+
"bbox": [
|
| 239 |
+
496,
|
| 240 |
+
713,
|
| 241 |
+
638,
|
| 242 |
+
728
|
| 243 |
+
],
|
| 244 |
+
"page_idx": 1
|
| 245 |
+
},
|
| 246 |
+
{
|
| 247 |
+
"type": "text",
|
| 248 |
+
"text": "2.1. Long-Tailed Recognition",
|
| 249 |
+
"text_level": 1,
|
| 250 |
+
"bbox": [
|
| 251 |
+
496,
|
| 252 |
+
739,
|
| 253 |
+
702,
|
| 254 |
+
753
|
| 255 |
+
],
|
| 256 |
+
"page_idx": 1
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
"type": "text",
|
| 260 |
+
"text": "Rebalancing Datasets. Since the most straightforward approach to the long-tailed recognition problem is rebalancing the dataset during training, several early works (Chawla et al., 2002; Japkowicz & Stephen, 2002; Drummond et al., 2003; Han et al., 2005; He & Garcia, 2009; Mikolov et al., 2013) have focused on rebalancing approaches. However, Byrd & Lipton (2019) found that the effect of rebalancing diminishes on overparameterized deep neural networks given sufficiently long training epochs.",
|
| 261 |
+
"bbox": [
|
| 262 |
+
495,
|
| 263 |
+
762,
|
| 264 |
+
888,
|
| 265 |
+
900
|
| 266 |
+
],
|
| 267 |
+
"page_idx": 1
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"type": "header",
|
| 271 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 272 |
+
"bbox": [
|
| 273 |
+
124,
|
| 274 |
+
56,
|
| 275 |
+
846,
|
| 276 |
+
70
|
| 277 |
+
],
|
| 278 |
+
"page_idx": 1
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"type": "page_number",
|
| 282 |
+
"text": "2",
|
| 283 |
+
"bbox": [
|
| 284 |
+
480,
|
| 285 |
+
922,
|
| 286 |
+
491,
|
| 287 |
+
934
|
| 288 |
+
],
|
| 289 |
+
"page_idx": 1
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"type": "text",
|
| 293 |
+
"text": "Normalized Classifier. Networks trained on long-tailed datasets tend to have biased classifier weights (Alshammari et al., 2022); this problem can be alleviated by normalizing the weights of the classification layer. Kang et al. (2020) proposed to normalize the weights by decoupling the representation learning and classification. They first trained the network jointly using an instance-based sampling strategy. Then, they retrained the classifier only using a class-balanced sampling strategy. Gidaris & Komodakis (2018) proposed the use of a cosine similarity classifier instead of a dot-product classifier. It bypasses the biased weights problem by only considering the relative angle. Accordingly, we adopt the cosine similarity as the classifier of our network.",
|
| 294 |
+
"bbox": [
|
| 295 |
+
84,
|
| 296 |
+
84,
|
| 297 |
+
475,
|
| 298 |
+
282
|
| 299 |
+
],
|
| 300 |
+
"page_idx": 2
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"type": "text",
|
| 304 |
+
"text": "Logit Adjustment. Another approach to the long-tailed recognition problem is to modulate the logit values. Interestingly, Ren et al. (2020) and Menon et al. (2021) derived similar results using different approaches. Ren et al. (2020) showed that the softmax loss is a biased estimator and proposed a Balanced Softmax loss; Menon et al. (2021) proposed a post-hoc logit adjustment and a logit-adjusted softmax cross-entropy loss. Both works show that adding a logit-adjustment term proportional to the logarithm of label frequency is essential to the long-tailed recognition. In accordance with their results, many studies (Cui et al., 2021; Feng et al., 2021; Hong et al., 2021; Zhu et al., 2022) have included logit adjustment as a part of their methods.",
|
| 305 |
+
"bbox": [
|
| 306 |
+
84,
|
| 307 |
+
287,
|
| 308 |
+
477,
|
| 309 |
+
484
|
| 310 |
+
],
|
| 311 |
+
"page_idx": 2
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"type": "text",
|
| 315 |
+
"text": "2.2. Contrastive Learning",
|
| 316 |
+
"text_level": 1,
|
| 317 |
+
"bbox": [
|
| 318 |
+
84,
|
| 319 |
+
501,
|
| 320 |
+
269,
|
| 321 |
+
517
|
| 322 |
+
],
|
| 323 |
+
"page_idx": 2
|
| 324 |
+
},
|
| 325 |
+
{
|
| 326 |
+
"type": "text",
|
| 327 |
+
"text": "Cui et al. (2021) found that the performance of supervised contrastive loss (Khosla et al., 2020) significantly degrades when it is applied to a long-tailed dataset. Therefore, they proposed Parametric Contrastive learning (PaCo), which rebalances the contrast samples by adding parametric class-wise learnable centers in the samples. To integrate the logit-adjustment technique into their method, the authors added the adjustment term to the center learning. Further, Zhu et al. (2022) proposed Balanced Contrastive Learning (BCL), which utilizes the number of contrasts of each class in a mini-batch to balance the gradient contribution of classes. To integrate the logit-adjustment technique, they used a weighted sum of the logit-adjustment loss and their loss.",
|
| 328 |
+
"bbox": [
|
| 329 |
+
84,
|
| 330 |
+
523,
|
| 331 |
+
475,
|
| 332 |
+
734
|
| 333 |
+
],
|
| 334 |
+
"page_idx": 2
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"type": "text",
|
| 338 |
+
"text": "3. Proposed Method",
|
| 339 |
+
"text_level": 1,
|
| 340 |
+
"bbox": [
|
| 341 |
+
84,
|
| 342 |
+
755,
|
| 343 |
+
259,
|
| 344 |
+
772
|
| 345 |
+
],
|
| 346 |
+
"page_idx": 2
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"type": "text",
|
| 350 |
+
"text": "In this section, we describe our approach to handle long-tailed recognition based on MI. Because the MI is intractable, we use InfoNCE loss (Oord et al., 2018) to maximize its lower bound. We adopt the notations of Poole et al. (2019) to express InfoNCE loss.",
|
| 351 |
+
"bbox": [
|
| 352 |
+
84,
|
| 353 |
+
781,
|
| 354 |
+
475,
|
| 355 |
+
857
|
| 356 |
+
],
|
| 357 |
+
"page_idx": 2
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"type": "equation",
|
| 361 |
+
"text": "\n$$\nI (X; Y) \\geq \\mathbb {E} \\left[ \\frac {1}{K} \\sum_ {i = 1} ^ {K} \\log \\frac {\\exp f \\left(x _ {i} , y _ {i}\\right)}{\\frac {1}{K} \\sum_ {j = 1} ^ {K} \\exp f \\left(x _ {i} , y _ {j}\\right)} \\right] \\tag {1}\n$$\n",
|
| 362 |
+
"text_format": "latex",
|
| 363 |
+
"bbox": [
|
| 364 |
+
99,
|
| 365 |
+
867,
|
| 366 |
+
475,
|
| 367 |
+
909
|
| 368 |
+
],
|
| 369 |
+
"page_idx": 2
|
| 370 |
+
},
|
| 371 |
+
{
|
| 372 |
+
"type": "text",
|
| 373 |
+
"text": "where the expectation is taken over subsets of a dataset and $K$ denotes the size of the subset. Equality holds when $f(x,y) = \\log p(x|y) + c(x)$ and $K\\to \\infty$ where $c(x)$ is a function that only depends on $x$ .",
|
| 374 |
+
"bbox": [
|
| 375 |
+
496,
|
| 376 |
+
84,
|
| 377 |
+
885,
|
| 378 |
+
148
|
| 379 |
+
],
|
| 380 |
+
"page_idx": 2
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"type": "text",
|
| 384 |
+
"text": "3.1. Contrastive Learning as MI Maximization between Latent Features and Input Data",
|
| 385 |
+
"text_level": 1,
|
| 386 |
+
"bbox": [
|
| 387 |
+
496,
|
| 388 |
+
161,
|
| 389 |
+
885,
|
| 390 |
+
191
|
| 391 |
+
],
|
| 392 |
+
"page_idx": 2
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"type": "text",
|
| 396 |
+
"text": "From Eq. 1, we can recover the loss functions of contrastive learning methods (Chen et al., 2020b; He et al., 2020) by substituting $x_{i}$ with the query feature, $f_{q}(t_{q}(x_{i}),w)$ , and $y_{j}$ with the input image, $x_{j}$ ; it shows that contrastive learning methods maximize the MI between latent features and input data. Detailed proof is shown in Appendix A.1.",
|
| 397 |
+
"bbox": [
|
| 398 |
+
495,
|
| 399 |
+
199,
|
| 400 |
+
885,
|
| 401 |
+
291
|
| 402 |
+
],
|
| 403 |
+
"page_idx": 2
|
| 404 |
+
},
|
| 405 |
+
{
|
| 406 |
+
"type": "text",
|
| 407 |
+
"text": "Since ground-truth label term is not included in the maximization, they are prone to the imbalance of label frequency. Supervised contrastive learning (Khosla et al., 2020) tries to modify the loss function to include the ground-truth label term, but it is still based on the MI maximization between latent features and input data.",
|
| 408 |
+
"bbox": [
|
| 409 |
+
495,
|
| 410 |
+
297,
|
| 411 |
+
887,
|
| 412 |
+
388
|
| 413 |
+
],
|
| 414 |
+
"page_idx": 2
|
| 415 |
+
},
|
| 416 |
+
{
|
| 417 |
+
"type": "text",
|
| 418 |
+
"text": "3.2. Long-Tailed Recognition by MI Maximization between Latent Features and Ground-Truth Labels",
|
| 419 |
+
"text_level": 1,
|
| 420 |
+
"bbox": [
|
| 421 |
+
496,
|
| 422 |
+
405,
|
| 423 |
+
885,
|
| 424 |
+
435
|
| 425 |
+
],
|
| 426 |
+
"page_idx": 2
|
| 427 |
+
},
|
| 428 |
+
{
|
| 429 |
+
"type": "text",
|
| 430 |
+
"text": "To enable the label frequency considered in the MI maximization process, we formulate the long-tailed recognition problem as a maximum MI problem of latent features and ground-truth labels. However, replacing the input data term with the ground-truth label term results in a loss function that is not contrastive learning. In this section, we describe procedures to recover the contrastive loss.",
|
| 431 |
+
"bbox": [
|
| 432 |
+
495,
|
| 433 |
+
444,
|
| 434 |
+
885,
|
| 435 |
+
549
|
| 436 |
+
],
|
| 437 |
+
"page_idx": 2
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"type": "text",
|
| 441 |
+
"text": "Logit Adjustment. First, we substitute $X$ in Eq. 1 with the set of latent features and $Y$ with the set of ground-truth labels to represent the MI maximization between latent features and ground-truth labels.",
|
| 442 |
+
"bbox": [
|
| 443 |
+
495,
|
| 444 |
+
556,
|
| 445 |
+
887,
|
| 446 |
+
618
|
| 447 |
+
],
|
| 448 |
+
"page_idx": 2
|
| 449 |
+
},
|
| 450 |
+
{
|
| 451 |
+
"type": "equation",
|
| 452 |
+
"text": "\n$$\n\\begin{array}{l} \\mathbb {E} _ {i} \\log \\frac {\\exp f (x _ {i} , y _ {i})}{\\mathbb {E} _ {j} \\exp f (x _ {i} , y _ {j})} = \\mathbb {E} _ {i} \\log \\frac {\\exp f (x _ {i} , y _ {i})}{\\sum_ {c \\in C} \\exp f (x _ {i} , c) p (c)} \\\\ = \\mathbb {E} _ {i} \\log \\frac {\\exp \\left(f \\left(x _ {i} , y _ {i}\\right) + \\eta_ {y _ {i}}\\right)}{\\sum_ {c \\in C} \\exp \\left(f \\left(x _ {i} , c\\right) + \\eta_ {c}\\right)} - \\eta_ {y _ {i}} \\tag {2} \\\\ \\end{array}\n$$\n",
|
| 453 |
+
"text_format": "latex",
|
| 454 |
+
"bbox": [
|
| 455 |
+
506,
|
| 456 |
+
625,
|
| 457 |
+
885,
|
| 458 |
+
696
|
| 459 |
+
],
|
| 460 |
+
"page_idx": 2
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"type": "text",
|
| 464 |
+
"text": "We realize the above term by increasing $K$ to the size of the entire training dataset. Here, $x_{i}$ and $y_{i}$ denote the latent feature and ground-truth label of the $i$ -th sample, respectively. $C$ denotes the set of all classes and $\\eta_c = \\log p(c)$ denotes the logit-adjustment term, which is the logarithm of the appearance frequency of a class.",
|
| 465 |
+
"bbox": [
|
| 466 |
+
495,
|
| 467 |
+
700,
|
| 468 |
+
887,
|
| 469 |
+
792
|
| 470 |
+
],
|
| 471 |
+
"page_idx": 2
|
| 472 |
+
},
|
| 473 |
+
{
|
| 474 |
+
"type": "text",
|
| 475 |
+
"text": "Eq. 2 is a general template and various previous methods can be derived by different modeling of the likelihood and prior. For simplicity, we define $s(x|y) = \\exp f(x,y)$ and use $s$ to denote the unnormalized likelihood of latent features. As an example, we derive a softmax cross-entropy loss with the logit-adjustment term by defining $s(x|y) = \\exp (w_y\\cdot x + b_y)$ , a dot-product classifier.",
|
| 476 |
+
"bbox": [
|
| 477 |
+
495,
|
| 478 |
+
799,
|
| 479 |
+
888,
|
| 480 |
+
905
|
| 481 |
+
],
|
| 482 |
+
"page_idx": 2
|
| 483 |
+
},
|
| 484 |
+
{
|
| 485 |
+
"type": "header",
|
| 486 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 487 |
+
"bbox": [
|
| 488 |
+
122,
|
| 489 |
+
56,
|
| 490 |
+
848,
|
| 491 |
+
70
|
| 492 |
+
],
|
| 493 |
+
"page_idx": 2
|
| 494 |
+
},
|
| 495 |
+
{
|
| 496 |
+
"type": "page_number",
|
| 497 |
+
"text": "3",
|
| 498 |
+
"bbox": [
|
| 499 |
+
480,
|
| 500 |
+
922,
|
| 501 |
+
491,
|
| 502 |
+
934
|
| 503 |
+
],
|
| 504 |
+
"page_idx": 2
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"type": "text",
|
| 508 |
+
"text": "Gaussian Mixture Likelihood Loss. The inequality on Eq. 1 becomes tighter as $f$ approaches $\\log p(x|y)$ , hence, we choose to estimate $s$ using sampling-based kernel density estimation with Gaussian kernels. This estimation leads to a Gaussian mixture likelihood, where the centers of the Gaussian mixtures are the contrast samples.",
|
| 509 |
+
"bbox": [
|
| 510 |
+
84,
|
| 511 |
+
84,
|
| 512 |
+
473,
|
| 513 |
+
175
|
| 514 |
+
],
|
| 515 |
+
"page_idx": 3
|
| 516 |
+
},
|
| 517 |
+
{
|
| 518 |
+
"type": "equation",
|
| 519 |
+
"text": "\n$$\ns (x \\mid y) = \\exp f (x, y) = \\frac {1}{\\| Z _ {y} \\|} \\sum_ {z _ {y} \\in Z _ {y}} \\exp \\left(z _ {x} \\cdot z _ {y} / \\tau_ {g}\\right) \\tag {3}\n$$\n",
|
| 520 |
+
"text_format": "latex",
|
| 521 |
+
"bbox": [
|
| 522 |
+
94,
|
| 523 |
+
183,
|
| 524 |
+
475,
|
| 525 |
+
222
|
| 526 |
+
],
|
| 527 |
+
"page_idx": 3
|
| 528 |
+
},
|
| 529 |
+
{
|
| 530 |
+
"type": "text",
|
| 531 |
+
"text": "where $z_{x}$ denotes the L2 normalized query feature of $x$ , $Z_{y}$ denotes a set of L2 normalized contrast features of class $y$ , and $\\tau_{g}$ denotes a temperature parameter for GML loss, which is quadratically proportional to the variance of the Gaussian mixture. The subscript $i$ of $x_{i}$ and $y_{i}$ is omitted for simplicity. Gaussian mixture is represented using dot product instead of a quadratic term to maintain consistency with previous contrastive losses. It does not modify the meaning of Gaussian mixture, as L2 normalization is applied to both the query and contrast features. Specifically,",
|
| 532 |
+
"bbox": [
|
| 533 |
+
84,
|
| 534 |
+
229,
|
| 535 |
+
475,
|
| 536 |
+
380
|
| 537 |
+
],
|
| 538 |
+
"page_idx": 3
|
| 539 |
+
},
|
| 540 |
+
{
|
| 541 |
+
"type": "equation",
|
| 542 |
+
"text": "\n$$\n- \\left\\| z _ {x} - z _ {y} \\right\\| _ {2} ^ {2} / \\left(2 \\tau_ {g}\\right) = z _ {x} \\cdot z _ {y} / \\tau_ {g} - 1 / \\tau_ {g} \\tag {4}\n$$\n",
|
| 543 |
+
"text_format": "latex",
|
| 544 |
+
"bbox": [
|
| 545 |
+
142,
|
| 546 |
+
390,
|
| 547 |
+
473,
|
| 548 |
+
409
|
| 549 |
+
],
|
| 550 |
+
"page_idx": 3
|
| 551 |
+
},
|
| 552 |
+
{
|
| 553 |
+
"type": "text",
|
| 554 |
+
"text": "and the last constant term cancels out in the following equation.",
|
| 555 |
+
"bbox": [
|
| 556 |
+
84,
|
| 557 |
+
417,
|
| 558 |
+
475,
|
| 559 |
+
445
|
| 560 |
+
],
|
| 561 |
+
"page_idx": 3
|
| 562 |
+
},
|
| 563 |
+
{
|
| 564 |
+
"type": "text",
|
| 565 |
+
"text": "Note that we do not estimate the centers of Gaussian mixtures, but simply use the latent features of the contrast encoder as centers. Therefore, the training burden is not increased by this procedure and remains almost the same as that of previous contrastive learning methods.",
|
| 566 |
+
"bbox": [
|
| 567 |
+
84,
|
| 568 |
+
455,
|
| 569 |
+
475,
|
| 570 |
+
530
|
| 571 |
+
],
|
| 572 |
+
"page_idx": 3
|
| 573 |
+
},
|
| 574 |
+
{
|
| 575 |
+
"type": "text",
|
| 576 |
+
"text": "By modeling $s$ using the Gaussian mixture, we derive the GML loss which seamlessly integrates the contrastive learning and the logit compensation. Substituting $f$ of Eq. 2 using Eq. 3 derives the proposed loss $L_{GML}$ .",
|
| 577 |
+
"bbox": [
|
| 578 |
+
84,
|
| 579 |
+
537,
|
| 580 |
+
475,
|
| 581 |
+
599
|
| 582 |
+
],
|
| 583 |
+
"page_idx": 3
|
| 584 |
+
},
|
| 585 |
+
{
|
| 586 |
+
"type": "equation",
|
| 587 |
+
"text": "\n$$\n- L _ {G M L} = \\tag {5}\n$$\n",
|
| 588 |
+
"text_format": "latex",
|
| 589 |
+
"bbox": [
|
| 590 |
+
96,
|
| 591 |
+
609,
|
| 592 |
+
473,
|
| 593 |
+
625
|
| 594 |
+
],
|
| 595 |
+
"page_idx": 3
|
| 596 |
+
},
|
| 597 |
+
{
|
| 598 |
+
"type": "equation",
|
| 599 |
+
"text": "\n$$\n\\log \\frac {\\exp \\left[ \\log \\frac {1}{\\| Z _ {y} \\|} \\sum_ {z _ {y} \\in Z _ {y}} \\exp (z _ {x} \\cdot z _ {y} / \\tau_ {g}) + \\eta_ {y} \\right]}{\\sum_ {c \\in C} \\exp \\left[ \\log \\frac {1}{\\| Z _ {c} \\|} \\sum_ {z _ {c} \\in Z _ {c}} \\exp (z _ {x} \\cdot z _ {c} / \\tau_ {g}) + \\eta_ {c} \\right]}\n$$\n",
|
| 600 |
+
"text_format": "latex",
|
| 601 |
+
"bbox": [
|
| 602 |
+
94,
|
| 603 |
+
628,
|
| 604 |
+
465,
|
| 605 |
+
680
|
| 606 |
+
],
|
| 607 |
+
"page_idx": 3
|
| 608 |
+
},
|
| 609 |
+
{
|
| 610 |
+
"type": "text",
|
| 611 |
+
"text": "3.3. Training with GML Loss",
|
| 612 |
+
"text_level": 1,
|
| 613 |
+
"bbox": [
|
| 614 |
+
84,
|
| 615 |
+
695,
|
| 616 |
+
294,
|
| 617 |
+
709
|
| 618 |
+
],
|
| 619 |
+
"page_idx": 3
|
| 620 |
+
},
|
| 621 |
+
{
|
| 622 |
+
"type": "text",
|
| 623 |
+
"text": "Class-wise Queues for Contrast Samples. The denominator of $L_{GML}$ requires at least one contrast sample for each class. However, the strategy of MoCo (He et al., 2020) does not guarantee any minimum number of samples, because it uses a queue of randomly sampled contrast samples. Therefore, we use multiple queues with different lengths. Each class has one assigned queue, and its length is proportional to the frequency of the class plus a predefined constant.",
|
| 624 |
+
"bbox": [
|
| 625 |
+
84,
|
| 626 |
+
718,
|
| 627 |
+
475,
|
| 628 |
+
839
|
| 629 |
+
],
|
| 630 |
+
"page_idx": 3
|
| 631 |
+
},
|
| 632 |
+
{
|
| 633 |
+
"type": "equation",
|
| 634 |
+
"text": "\n$$\n\\left\\| Z _ {c} \\right\\| = k _ {m} + \\left(k - k _ {m} \\times \\| C \\|\\right) \\times p (c) \\tag {6}\n$$\n",
|
| 635 |
+
"text_format": "latex",
|
| 636 |
+
"bbox": [
|
| 637 |
+
148,
|
| 638 |
+
849,
|
| 639 |
+
473,
|
| 640 |
+
866
|
| 641 |
+
],
|
| 642 |
+
"page_idx": 3
|
| 643 |
+
},
|
| 644 |
+
{
|
| 645 |
+
"type": "text",
|
| 646 |
+
"text": "where $k_{m}$ denotes the minimum length of the queue and $k$ denotes the total number of contrast samples.",
|
| 647 |
+
"bbox": [
|
| 648 |
+
84,
|
| 649 |
+
875,
|
| 650 |
+
473,
|
| 651 |
+
905
|
| 652 |
+
],
|
| 653 |
+
"page_idx": 3
|
| 654 |
+
},
|
| 655 |
+
{
|
| 656 |
+
"type": "text",
|
| 657 |
+
"text": "Teacher-Student Strategy. Maintaining class-wise queues causes another problem. MoCo (He et al., 2020) uses a momentum encoder to generate contrast samples, and they are stored in a queue. Therefore, old samples generated using an outdated encoder are replaced with new samples. On the other hand, we use multiple class-wise queues and their update frequency is proportional to the ratio of the classes in the training dataset. Therefore, queues of tail classes have excessively long update frequencies and old samples of their queues are generated by highly outdated encoders. To overcome this problem, we adopt a teacher-student strategy and use a pre-trained teacher encoder to generate contrast samples.",
|
| 658 |
+
"bbox": [
|
| 659 |
+
496,
|
| 660 |
+
84,
|
| 661 |
+
885,
|
| 662 |
+
281
|
| 663 |
+
],
|
| 664 |
+
"page_idx": 3
|
| 665 |
+
},
|
| 666 |
+
{
|
| 667 |
+
"type": "text",
|
| 668 |
+
"text": "Training Procedure. Usually, a contrastive loss is used to train a backbone network, and a classifier layer is trained separately after training the backbone network. However, in the supervised setting, the classifier layer can be trained simultaneously with the backbone network. Therefore, we attach a cosine similarity classifier to the network and train them simultaneously. The classifier is trained without contrastive loss using the following loss function.",
|
| 669 |
+
"bbox": [
|
| 670 |
+
496,
|
| 671 |
+
287,
|
| 672 |
+
885,
|
| 673 |
+
409
|
| 674 |
+
],
|
| 675 |
+
"page_idx": 3
|
| 676 |
+
},
|
| 677 |
+
{
|
| 678 |
+
"type": "equation",
|
| 679 |
+
"text": "\n$$\n- L _ {c l s} = \\log \\frac {\\exp \\left(m _ {x} \\cdot m _ {y} / \\tau_ {s} + \\eta_ {y}\\right)}{\\sum_ {c \\in C} \\exp \\left(m _ {x} \\cdot m _ {c} / \\tau_ {s} + \\eta_ {c}\\right)} \\tag {7}\n$$\n",
|
| 680 |
+
"text_format": "latex",
|
| 681 |
+
"bbox": [
|
| 682 |
+
545,
|
| 683 |
+
417,
|
| 684 |
+
885,
|
| 685 |
+
452
|
| 686 |
+
],
|
| 687 |
+
"page_idx": 3
|
| 688 |
+
},
|
| 689 |
+
{
|
| 690 |
+
"type": "text",
|
| 691 |
+
"text": "where $m_{x}$ denotes L2 normalized $x$ , $m_{c}$ denotes L2 normalized weight at class $c$ of the classifier, and $\\tau_{s}$ denotes a temperature hyperparameter for softmax cross-entropy loss. In contrast to the Gaussian mixture setting, $m_{c}$ is a parameter that needs to be trained.",
|
| 692 |
+
"bbox": [
|
| 693 |
+
496,
|
| 694 |
+
458,
|
| 695 |
+
885,
|
| 696 |
+
532
|
| 697 |
+
],
|
| 698 |
+
"page_idx": 3
|
| 699 |
+
},
|
| 700 |
+
{
|
| 701 |
+
"type": "text",
|
| 702 |
+
"text": "In addition, we use MLP encoders followed by L2 normalization for contrast samples $z_{x}$ and $z_{y}$ , similar to previous contrastive losses (Chen et al., 2020a;c), while a simple L2 normalization is used for the cosine similarity classifier.",
|
| 703 |
+
"bbox": [
|
| 704 |
+
496,
|
| 705 |
+
541,
|
| 706 |
+
885,
|
| 707 |
+
601
|
| 708 |
+
],
|
| 709 |
+
"page_idx": 3
|
| 710 |
+
},
|
| 711 |
+
{
|
| 712 |
+
"type": "equation",
|
| 713 |
+
"text": "\n$$\nz _ {x} = \\frac {\\operatorname {M L P} (x)}{\\| \\operatorname {M L P} (x) \\|}, m _ {x} = \\frac {x}{\\| x \\|} \\tag {8}\n$$\n",
|
| 714 |
+
"text_format": "latex",
|
| 715 |
+
"bbox": [
|
| 716 |
+
589,
|
| 717 |
+
609,
|
| 718 |
+
885,
|
| 719 |
+
643
|
| 720 |
+
],
|
| 721 |
+
"page_idx": 3
|
| 722 |
+
},
|
| 723 |
+
{
|
| 724 |
+
"type": "text",
|
| 725 |
+
"text": "In summary, our training procedure is as follows. First, we estimate the ratio of classes in the training dataset to calculate $\\eta_c$ . Then, we train a teacher network with a cosine similarity classifier with $L_{cls}$ without contrastive loss. Finally, we train a student network and a cosine similarity classifier simultaneously with $L_{GML}$ and $L_{cls}$ .",
|
| 726 |
+
"bbox": [
|
| 727 |
+
496,
|
| 728 |
+
656,
|
| 729 |
+
885,
|
| 730 |
+
747
|
| 731 |
+
],
|
| 732 |
+
"page_idx": 3
|
| 733 |
+
},
|
| 734 |
+
{
|
| 735 |
+
"type": "text",
|
| 736 |
+
"text": "Trainable Temperature. Unlike previous contrastive learning methods (Chen et al., 2020a; He et al., 2020; Khosla et al., 2020; Tian et al., 2020; Cui et al., 2021; Zhu et al., 2022), we train $\\tau_{g}$ along with the network parameters to reduce the burden of hyperparameter tuning. However, $L_{GML}$ is not suitable for training $\\tau_{g}$ . If we estimate the variance of the Gaussian mixture when the contrast centers include the query feature, the optimal variance is too small, and the Gaussian mixture becomes spiky. Therefore, we exclude contrast features extracted from the same sample to",
|
| 737 |
+
"bbox": [
|
| 738 |
+
495,
|
| 739 |
+
753,
|
| 740 |
+
885,
|
| 741 |
+
905
|
| 742 |
+
],
|
| 743 |
+
"page_idx": 3
|
| 744 |
+
},
|
| 745 |
+
{
|
| 746 |
+
"type": "header",
|
| 747 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 748 |
+
"bbox": [
|
| 749 |
+
122,
|
| 750 |
+
56,
|
| 751 |
+
846,
|
| 752 |
+
70
|
| 753 |
+
],
|
| 754 |
+
"page_idx": 3
|
| 755 |
+
},
|
| 756 |
+
{
|
| 757 |
+
"type": "page_number",
|
| 758 |
+
"text": "4",
|
| 759 |
+
"bbox": [
|
| 760 |
+
480,
|
| 761 |
+
922,
|
| 762 |
+
491,
|
| 763 |
+
934
|
| 764 |
+
],
|
| 765 |
+
"page_idx": 3
|
| 766 |
+
},
|
| 767 |
+
{
|
| 768 |
+
"type": "text",
|
| 769 |
+
"text": "the query when training $\\tau_{g}$ . For simplicity, we use a fixed $\\tau_{g}$ throughout most of the experiments in this work. However, we show in Sec. 4.9 that $\\tau_{g}$ can be trained, and it boosts the network performance.",
|
| 770 |
+
"bbox": [
|
| 771 |
+
84,
|
| 772 |
+
85,
|
| 773 |
+
473,
|
| 774 |
+
145
|
| 775 |
+
],
|
| 776 |
+
"page_idx": 4
|
| 777 |
+
},
|
| 778 |
+
{
|
| 779 |
+
"type": "text",
|
| 780 |
+
"text": "By contrast, we find training $\\tau_{s}$ results in a very low optimal value, which causes two negative effects. First, it makes $L_{cls}$ dominate the training procedure, and second, it significantly degrades the accuracy of tail classes. Therefore, we leave $\\tau_{s}$ as a hyperparameter.",
|
| 781 |
+
"bbox": [
|
| 782 |
+
84,
|
| 783 |
+
152,
|
| 784 |
+
473,
|
| 785 |
+
229
|
| 786 |
+
],
|
| 787 |
+
"page_idx": 4
|
| 788 |
+
},
|
| 789 |
+
{
|
| 790 |
+
"type": "text",
|
| 791 |
+
"text": "3.4. Relation with Other Methods",
|
| 792 |
+
"text_level": 1,
|
| 793 |
+
"bbox": [
|
| 794 |
+
84,
|
| 795 |
+
244,
|
| 796 |
+
323,
|
| 797 |
+
258
|
| 798 |
+
],
|
| 799 |
+
"page_idx": 4
|
| 800 |
+
},
|
| 801 |
+
{
|
| 802 |
+
"type": "text",
|
| 803 |
+
"text": "As mentioned in Sec. 3.2, we can derive previous methods by adopting different likelihood and prior models.",
|
| 804 |
+
"bbox": [
|
| 805 |
+
84,
|
| 806 |
+
268,
|
| 807 |
+
473,
|
| 808 |
+
299
|
| 809 |
+
],
|
| 810 |
+
"page_idx": 4
|
| 811 |
+
},
|
| 812 |
+
{
|
| 813 |
+
"type": "text",
|
| 814 |
+
"text": "Balanced Softmax. By modeling $s(x|y)$ as an isotropic Gaussian instead of a Gaussian mixture, we can derive the balanced softmax with a cosine similarity classifier.",
|
| 815 |
+
"bbox": [
|
| 816 |
+
84,
|
| 817 |
+
306,
|
| 818 |
+
473,
|
| 819 |
+
351
|
| 820 |
+
],
|
| 821 |
+
"page_idx": 4
|
| 822 |
+
},
|
| 823 |
+
{
|
| 824 |
+
"type": "equation",
|
| 825 |
+
"text": "\n$$\ns (x \\mid y) = \\exp f (x, y) = \\exp \\left(\\frac {- \\left(m _ {x} - m _ {y}\\right) ^ {2}}{2 \\sigma^ {2}}\\right) \\tag {9}\n$$\n",
|
| 826 |
+
"text_format": "latex",
|
| 827 |
+
"bbox": [
|
| 828 |
+
107,
|
| 829 |
+
369,
|
| 830 |
+
473,
|
| 831 |
+
404
|
| 832 |
+
],
|
| 833 |
+
"page_idx": 4
|
| 834 |
+
},
|
| 835 |
+
{
|
| 836 |
+
"type": "text",
|
| 837 |
+
"text": "where $m_y$ and $\\sigma$ denote the center and variance of the Gaussian model, respectively.",
|
| 838 |
+
"bbox": [
|
| 839 |
+
84,
|
| 840 |
+
421,
|
| 841 |
+
475,
|
| 842 |
+
452
|
| 843 |
+
],
|
| 844 |
+
"page_idx": 4
|
| 845 |
+
},
|
| 846 |
+
{
|
| 847 |
+
"type": "text",
|
| 848 |
+
"text": "Because we apply L2 normalization to $x$ and $y$ , substituting $f$ in Eq. 2 results in $L_{cls}$ , which is the cosine similarity classifier with logit adjustment.",
|
| 849 |
+
"bbox": [
|
| 850 |
+
84,
|
| 851 |
+
459,
|
| 852 |
+
473,
|
| 853 |
+
505
|
| 854 |
+
],
|
| 855 |
+
"page_idx": 4
|
| 856 |
+
},
|
| 857 |
+
{
|
| 858 |
+
"type": "text",
|
| 859 |
+
"text": "Supervised Contrastive Loss for Balanced Dataset. Supervised contrastive loss (Khosla et al., 2020) can be derived by assuming the training dataset is balanced. A balanced training dataset gives all $\\eta_c$ s and $\\| Z_c\\|$ s equal. Therefore, the proposed GML loss for balanced datasets becomes as follows:",
|
| 860 |
+
"bbox": [
|
| 861 |
+
84,
|
| 862 |
+
512,
|
| 863 |
+
475,
|
| 864 |
+
602
|
| 865 |
+
],
|
| 866 |
+
"page_idx": 4
|
| 867 |
+
},
|
| 868 |
+
{
|
| 869 |
+
"type": "equation",
|
| 870 |
+
"text": "\n$$\n\\begin{array}{l} - L _ {G M L} ^ {(b a l a n c e d)} = \\log \\frac {\\sum_ {z _ {y} \\in Z _ {y}} \\exp \\left(z _ {x} \\cdot z _ {y} / \\tau_ {g}\\right)}{\\sum_ {c \\in C} \\sum_ {z _ {c} \\in Z _ {c}} \\exp \\left(z _ {x} \\cdot z _ {c} / \\tau_ {g}\\right)} \\tag {10} \\\\ \\geq \\sum_ {z _ {y} \\in Z _ {y}} \\log \\frac {\\exp \\left(z _ {x} \\cdot z _ {y} / \\tau_ {g}\\right)}{\\sum_ {z \\in Z} \\exp \\left(z _ {x} \\cdot z / \\tau_ {g}\\right)} \\\\ \\end{array}\n$$\n",
|
| 871 |
+
"text_format": "latex",
|
| 872 |
+
"bbox": [
|
| 873 |
+
96,
|
| 874 |
+
618,
|
| 875 |
+
473,
|
| 876 |
+
696
|
| 877 |
+
],
|
| 878 |
+
"page_idx": 4
|
| 879 |
+
},
|
| 880 |
+
{
|
| 881 |
+
"type": "text",
|
| 882 |
+
"text": "where $Z = \\bigcup_{c}Z_{c}$ denotes the set of all contrast samples. By applying Jensen's inequality, we achieve supervised contrastive loss.",
|
| 883 |
+
"bbox": [
|
| 884 |
+
84,
|
| 885 |
+
715,
|
| 886 |
+
475,
|
| 887 |
+
761
|
| 888 |
+
],
|
| 889 |
+
"page_idx": 4
|
| 890 |
+
},
|
| 891 |
+
{
|
| 892 |
+
"type": "text",
|
| 893 |
+
"text": "Visual-Linguistic Representation Learning. Visual-Linguistic Long-Tailed Recognition (VL-LTR) (Tian et al., 2021) utilizes a text sentences dataset and a pre-trained visual-linguistic model to address the problem of insufficient training samples of tail classes. Similarly, our method can be used to connect visual and text representations. In particular, we use text features as centers of the Gaussian mixture instead of contrast features and the pre-trained visual-linguistic model to extract the text features.",
|
| 894 |
+
"bbox": [
|
| 895 |
+
84,
|
| 896 |
+
768,
|
| 897 |
+
475,
|
| 898 |
+
905
|
| 899 |
+
],
|
| 900 |
+
"page_idx": 4
|
| 901 |
+
},
|
| 902 |
+
{
|
| 903 |
+
"type": "text",
|
| 904 |
+
"text": "4. Experiments",
|
| 905 |
+
"text_level": 1,
|
| 906 |
+
"bbox": [
|
| 907 |
+
496,
|
| 908 |
+
83,
|
| 909 |
+
629,
|
| 910 |
+
99
|
| 911 |
+
],
|
| 912 |
+
"page_idx": 4
|
| 913 |
+
},
|
| 914 |
+
{
|
| 915 |
+
"type": "text",
|
| 916 |
+
"text": "4.1. Datasets",
|
| 917 |
+
"text_level": 1,
|
| 918 |
+
"bbox": [
|
| 919 |
+
496,
|
| 920 |
+
109,
|
| 921 |
+
589,
|
| 922 |
+
123
|
| 923 |
+
],
|
| 924 |
+
"page_idx": 4
|
| 925 |
+
},
|
| 926 |
+
{
|
| 927 |
+
"type": "text",
|
| 928 |
+
"text": "ImageNet-LT. Liu et al. (2019) constructed ImageNet-LT by sampling ImageNet-2012 (Russakovsky et al., 2015) following a Pareto distribution with $\\alpha = 6$ . The training set of ImageNet-LT contains $115.8k$ images of 1000 classes, ranging from a maximum of 1280 images to a minimum of 5 images per class. Meanwhile, the test set is balanced such that head classes and tail classes have the same impact on the accuracy evaluation. The test set of ImageNet-LT contains $50k$ images, with 50 images per class.",
|
| 929 |
+
"bbox": [
|
| 930 |
+
495,
|
| 931 |
+
132,
|
| 932 |
+
885,
|
| 933 |
+
268
|
| 934 |
+
],
|
| 935 |
+
"page_idx": 4
|
| 936 |
+
},
|
| 937 |
+
{
|
| 938 |
+
"type": "text",
|
| 939 |
+
"text": "iNaturalist 2018. iNaturalist 2018 (Van Horn et al., 2018) is a large-scale image classification dataset containing 8142 classes. The goal of iNaturalist 2018 is to push state-of-the-art image recognition for \"in the wild\" data of highly imbalanced and fine-grained categories. The training set of iNaturalist 2018 contains $437.5k$ images of 8142 classes, ranging from a maximum of 1000 images to a minimum of 2 images per class. The test set of iNaturalist 2018 is also balanced, similar to ImageNet-LT.",
|
| 940 |
+
"bbox": [
|
| 941 |
+
495,
|
| 942 |
+
275,
|
| 943 |
+
887,
|
| 944 |
+
412
|
| 945 |
+
],
|
| 946 |
+
"page_idx": 4
|
| 947 |
+
},
|
| 948 |
+
{
|
| 949 |
+
"type": "text",
|
| 950 |
+
"text": "CIFAR-10-LT and CIFAR-100-LT. Cui et al. (2019) constructed long-tailed versions of CIFAR (Krizhevsky, 2009) by reducing the number of training samples according to an exponential function. CIFAR-LT is categorized by its imbalance factor, which is the ratio of training samples for the largest class to that for the smallest.",
|
| 951 |
+
"bbox": [
|
| 952 |
+
495,
|
| 953 |
+
419,
|
| 954 |
+
887,
|
| 955 |
+
510
|
| 956 |
+
],
|
| 957 |
+
"page_idx": 4
|
| 958 |
+
},
|
| 959 |
+
{
|
| 960 |
+
"type": "text",
|
| 961 |
+
"text": "ADE20K. ADE20K (Zhou et al., 2017) is a widely used image semantic segmentation dataset. The evaluation is conducted on 150 classes, where the most common class comprises more than $15\\%$ of total training pixels, while the rarest one comprises only $0.02\\%$ .",
|
| 962 |
+
"bbox": [
|
| 963 |
+
495,
|
| 964 |
+
517,
|
| 965 |
+
885,
|
| 966 |
+
594
|
| 967 |
+
],
|
| 968 |
+
"page_idx": 4
|
| 969 |
+
},
|
| 970 |
+
{
|
| 971 |
+
"type": "text",
|
| 972 |
+
"text": "4.2. Implementation Details",
|
| 973 |
+
"text_level": 1,
|
| 974 |
+
"bbox": [
|
| 975 |
+
496,
|
| 976 |
+
609,
|
| 977 |
+
694,
|
| 978 |
+
625
|
| 979 |
+
],
|
| 980 |
+
"page_idx": 4
|
| 981 |
+
},
|
| 982 |
+
{
|
| 983 |
+
"type": "text",
|
| 984 |
+
"text": "We adopt training hyperparameter settings from previous long-tailed recognition papers (Cui et al., 2021; Tian et al., 2021; Zhu et al., 2022) with some modifications. For ImageNet-LT, we train the proposed method using an SGD optimizer whose learning rate is initially set to 0.05 and decays by a cosine scheduler. Input images are resized to $224 \\times 224$ , and a batch size of 128 is used. The weight decay and momentum are set to $5 \\times 10^{-4}$ and 0.9, respectively. The MLP of the contrast encoder has one hidden layer of 2048 channels and its output layer has 1024 channels. The total number of contrast samples $(k)$ is 16384, and the minimum number of contrast samples per class $(k_{m})$ is 2. Randaugment (Cubuk et al., 2020) is applied for the classifier training and Simaugment (Chen et al., 2020a) for the contrastive learning. Finally, $\\tau_{s} = 1 / 30$ is used throughout all experiments.",
|
| 985 |
+
"bbox": [
|
| 986 |
+
495,
|
| 987 |
+
633,
|
| 988 |
+
887,
|
| 989 |
+
875
|
| 990 |
+
],
|
| 991 |
+
"page_idx": 4
|
| 992 |
+
},
|
| 993 |
+
{
|
| 994 |
+
"type": "text",
|
| 995 |
+
"text": "For iNaturalist 2018, we use a batch size of 128, input",
|
| 996 |
+
"bbox": [
|
| 997 |
+
496,
|
| 998 |
+
882,
|
| 999 |
+
885,
|
| 1000 |
+
897
|
| 1001 |
+
],
|
| 1002 |
+
"page_idx": 4
|
| 1003 |
+
},
|
| 1004 |
+
{
|
| 1005 |
+
"type": "header",
|
| 1006 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 1007 |
+
"bbox": [
|
| 1008 |
+
122,
|
| 1009 |
+
56,
|
| 1010 |
+
848,
|
| 1011 |
+
70
|
| 1012 |
+
],
|
| 1013 |
+
"page_idx": 4
|
| 1014 |
+
},
|
| 1015 |
+
{
|
| 1016 |
+
"type": "page_number",
|
| 1017 |
+
"text": "5",
|
| 1018 |
+
"bbox": [
|
| 1019 |
+
480,
|
| 1020 |
+
922,
|
| 1021 |
+
491,
|
| 1022 |
+
934
|
| 1023 |
+
],
|
| 1024 |
+
"page_idx": 4
|
| 1025 |
+
},
|
| 1026 |
+
{
|
| 1027 |
+
"type": "table",
|
| 1028 |
+
"img_path": "images/be58dc7a17162ef4d59be0778b983a059e4de572d2d3b66ea312e5feab1c78a5.jpg",
|
| 1029 |
+
"table_caption": [
|
| 1030 |
+
"Table 1. Performance comparison on the ImageNet-LT dataset."
|
| 1031 |
+
],
|
| 1032 |
+
"table_footnote": [],
|
| 1033 |
+
"table_body": "<table><tr><td rowspan=\"2\">Method</td><td rowspan=\"2\">Epochs</td><td colspan=\"4\">Class frequency</td></tr><tr><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>Focal Loss</td><td>90</td><td>43.7</td><td>64.3</td><td>37.1</td><td>8.2</td></tr><tr><td>τ-norm</td><td>90</td><td>49.4</td><td>59.1</td><td>46.9</td><td>30.7</td></tr><tr><td>LWS</td><td>90</td><td>49.9</td><td>60.2</td><td>47.2</td><td>30.3</td></tr><tr><td>BALMS</td><td>90</td><td>51.4</td><td>62.2</td><td>48.8</td><td>29.8</td></tr><tr><td>LADE</td><td>90</td><td>51.9</td><td>62.3</td><td>49.3</td><td>31.2</td></tr><tr><td>DisAlign</td><td>90</td><td>53.4</td><td>62.7</td><td>52.1</td><td>31.4</td></tr><tr><td>BCL</td><td>90</td><td>56.7</td><td>67.2</td><td>53.9</td><td>36.5</td></tr><tr><td>Proposed</td><td>90</td><td>58.3</td><td>68.7</td><td>55.7</td><td>38.6</td></tr><tr><td>PaCo</td><td>400</td><td>58.2</td><td>68.0</td><td>56.4</td><td>37.2</td></tr><tr><td>Proposed</td><td>400</td><td>58.8</td><td>68.2</td><td>56.7</td><td>39.5</td></tr></table>",
|
| 1034 |
+
"bbox": [
|
| 1035 |
+
91,
|
| 1036 |
+
107,
|
| 1037 |
+
465,
|
| 1038 |
+
292
|
| 1039 |
+
],
|
| 1040 |
+
"page_idx": 5
|
| 1041 |
+
},
|
| 1042 |
+
{
|
| 1043 |
+
"type": "table",
|
| 1044 |
+
"img_path": "images/a9acf292cb4aaf4298be2c835564aba1161a761c7404652d5e792507a0d65855.jpg",
|
| 1045 |
+
"table_caption": [
|
| 1046 |
+
"Table 2. Performance comparison on the iNaturalist 2018 dataset."
|
| 1047 |
+
],
|
| 1048 |
+
"table_footnote": [],
|
| 1049 |
+
"table_body": "<table><tr><td>Method</td><td>Epochs</td><td>Accuracy</td></tr><tr><td>τ-norm</td><td>100</td><td>65.6</td></tr><tr><td>Hybrid-SC</td><td>100</td><td>66.7</td></tr><tr><td>SSP</td><td>100</td><td>68.1</td></tr><tr><td>KCL</td><td>100</td><td>68.6</td></tr><tr><td>DisAlign</td><td>100</td><td>69.5</td></tr><tr><td>RIDE (2 experts)</td><td>100</td><td>71.4</td></tr><tr><td>BCL</td><td>100</td><td>71.8</td></tr><tr><td>Proposed</td><td>100</td><td>73.1</td></tr><tr><td>RIDE (2 experts)</td><td>400</td><td>69.5</td></tr><tr><td>τ-norm</td><td>400</td><td>71.5</td></tr><tr><td>Balanced Softmax</td><td>400</td><td>71.8</td></tr><tr><td>PaCo</td><td>400</td><td>73.2</td></tr><tr><td>Proposed</td><td>400</td><td>74.5</td></tr></table>",
|
| 1050 |
+
"bbox": [
|
| 1051 |
+
135,
|
| 1052 |
+
330,
|
| 1053 |
+
426,
|
| 1054 |
+
545
|
| 1055 |
+
],
|
| 1056 |
+
"page_idx": 5
|
| 1057 |
+
},
|
| 1058 |
+
{
|
| 1059 |
+
"type": "text",
|
| 1060 |
+
"text": "image size of $224 \\times 224$ , and weight decay of $2 \\times 10^{-4}$ . The learning rate is set to 0.02 with the cosine scheduler. $k$ and $k_{m}$ are set to 65536 and 2, respectively. For CIFAR-LT, we use the training epochs of 200 and 400, a batch size of 64, and a weight decay of $5 \\times 10^{-4}$ . $k$ and $k_{m}$ are set to 4096 and 2, respectively. The learning rate is set to 0.05 and decays by a factor of 10 at 160 and 180 epochs (320 and 360 epochs if the training epochs is 400). We describe more about implementation details in Appendix A.2.",
|
| 1061 |
+
"bbox": [
|
| 1062 |
+
84,
|
| 1063 |
+
570,
|
| 1064 |
+
475,
|
| 1065 |
+
707
|
| 1066 |
+
],
|
| 1067 |
+
"page_idx": 5
|
| 1068 |
+
},
|
| 1069 |
+
{
|
| 1070 |
+
"type": "text",
|
| 1071 |
+
"text": "4.3. Long-Tailed Recognition",
|
| 1072 |
+
"text_level": 1,
|
| 1073 |
+
"bbox": [
|
| 1074 |
+
84,
|
| 1075 |
+
723,
|
| 1076 |
+
290,
|
| 1077 |
+
739
|
| 1078 |
+
],
|
| 1079 |
+
"page_idx": 5
|
| 1080 |
+
},
|
| 1081 |
+
{
|
| 1082 |
+
"type": "text",
|
| 1083 |
+
"text": "Comparison on ImageNet-LT. We first compare the performance of the proposed method with existing state-of-the-art long-tailed recognition methods on the ImageNet-LT dataset. We compare performances of the same backbone ResNeXt-50 and same number of training epochs for a fair comparison. Following the previous categorization of classes (Liu et al., 2019), we also evaluate the accuracy on subsets: many-shot (over 100 training samples), medium-shot (20-100 training samples), and few-shot (under 20 training samples).",
|
| 1084 |
+
"bbox": [
|
| 1085 |
+
84,
|
| 1086 |
+
747,
|
| 1087 |
+
475,
|
| 1088 |
+
883
|
| 1089 |
+
],
|
| 1090 |
+
"page_idx": 5
|
| 1091 |
+
},
|
| 1092 |
+
{
|
| 1093 |
+
"type": "text",
|
| 1094 |
+
"text": "Table 1 presents the experimental results on the ImageNet",
|
| 1095 |
+
"bbox": [
|
| 1096 |
+
84,
|
| 1097 |
+
890,
|
| 1098 |
+
475,
|
| 1099 |
+
905
|
| 1100 |
+
],
|
| 1101 |
+
"page_idx": 5
|
| 1102 |
+
},
|
| 1103 |
+
{
|
| 1104 |
+
"type": "table",
|
| 1105 |
+
"img_path": "images/2fad102bf951b0717eb6ddb90757176d5907468d271641bb7eec01840fd727c7.jpg",
|
| 1106 |
+
"table_caption": [
|
| 1107 |
+
"Table 3. Performance comparison on the CIFAR-100-LT dataset with different imbalance factors."
|
| 1108 |
+
],
|
| 1109 |
+
"table_footnote": [],
|
| 1110 |
+
"table_body": "<table><tr><td rowspan=\"2\">Method</td><td rowspan=\"2\">Epochs</td><td colspan=\"3\">Imbalance factor</td></tr><tr><td>100</td><td>50</td><td>10</td></tr><tr><td>Focal loss</td><td>200</td><td>38.4</td><td>44.3</td><td>55.8</td></tr><tr><td>CB-Focal</td><td>200</td><td>39.6</td><td>45.2</td><td>58.0</td></tr><tr><td>LDAM-DRW</td><td>200</td><td>42.0</td><td>46.6</td><td>58.7</td></tr><tr><td>BBN</td><td>200</td><td>42.6</td><td>47.0</td><td>59.1</td></tr><tr><td>SSP</td><td>200</td><td>43.4</td><td>47.1</td><td>58.9</td></tr><tr><td>Casual model</td><td>200</td><td>44.1</td><td>50.3</td><td>59.6</td></tr><tr><td>Hybrid-SC</td><td>200</td><td>46.7</td><td>51.8</td><td>63.1</td></tr><tr><td>MetaSAug-LDAM</td><td>200</td><td>48.0</td><td>52.3</td><td>61.3</td></tr><tr><td>ResLT</td><td>200</td><td>48.2</td><td>52.7</td><td>62.0</td></tr><tr><td>BCL</td><td>200</td><td>51.9</td><td>56.6</td><td>64.9</td></tr><tr><td>Proposed</td><td>200</td><td>53.0</td><td>57.6</td><td>65.7</td></tr><tr><td>MiSLAS</td><td>400</td><td>47.0</td><td>52.3</td><td>63.2</td></tr><tr><td>Balanced Softmax</td><td>400</td><td>50.8</td><td>54.2</td><td>63.0</td></tr><tr><td>PaCo</td><td>400</td><td>52.0</td><td>56.0</td><td>64.2</td></tr><tr><td>Proposed</td><td>400</td><td>54.0</td><td>58.1</td><td>67.0</td></tr></table>",
|
| 1111 |
+
"bbox": [
|
| 1112 |
+
511,
|
| 1113 |
+
119,
|
| 1114 |
+
874,
|
| 1115 |
+
378
|
| 1116 |
+
],
|
| 1117 |
+
"page_idx": 5
|
| 1118 |
+
},
|
| 1119 |
+
{
|
| 1120 |
+
"type": "text",
|
| 1121 |
+
"text": "LT dataset. The proposed method shows the best overall performance, outperforming previous state-of-the-art methods significantly. The gain is maximized on tail classes proving the efficacy of the proposed method on the long-tailed recognition task.",
|
| 1122 |
+
"bbox": [
|
| 1123 |
+
495,
|
| 1124 |
+
407,
|
| 1125 |
+
887,
|
| 1126 |
+
482
|
| 1127 |
+
],
|
| 1128 |
+
"page_idx": 5
|
| 1129 |
+
},
|
| 1130 |
+
{
|
| 1131 |
+
"type": "text",
|
| 1132 |
+
"text": "Comparison on iNaturalist 2018 dataset. We also evaluate the performance of the proposed method on the iNaturalist 2018, which is a large-scale highly imbalanced image classification dataset. For a fair comparison with previous methods, we use ResNet-50 as backbone. Table 2 shows the corresponding experimental result. The proposed method show significant performance improvements over all previous methods, including contrastive learning-based methods.",
|
| 1133 |
+
"bbox": [
|
| 1134 |
+
495,
|
| 1135 |
+
489,
|
| 1136 |
+
887,
|
| 1137 |
+
611
|
| 1138 |
+
],
|
| 1139 |
+
"page_idx": 5
|
| 1140 |
+
},
|
| 1141 |
+
{
|
| 1142 |
+
"type": "text",
|
| 1143 |
+
"text": "Comparison on CIFAR-100-LT dataset. Subsequently, we conduct extensive experiments on the CIFAR-100-LT dataset with different imbalance factors. We adopt imbalance factors of 100, 50, and 10, which are commonly used imbalance factors for evaluating the performance on CIFAR-LT dataset. A large imbalance factor implies a highly imbalanced dataset. In this experiment, we compare the performances of ResNet-32 backbones.",
|
| 1144 |
+
"bbox": [
|
| 1145 |
+
495,
|
| 1146 |
+
619,
|
| 1147 |
+
887,
|
| 1148 |
+
739
|
| 1149 |
+
],
|
| 1150 |
+
"page_idx": 5
|
| 1151 |
+
},
|
| 1152 |
+
{
|
| 1153 |
+
"type": "text",
|
| 1154 |
+
"text": "Table 3 presents the comparison results on the CIFAR-100-LT dataset. The proposed method is robust to imbalance factors and consistently outperform previous long-tailed recognition methods on various imbalance factors by significant margins. Indeed, the robustness is also verified in experiments that compare our method with the supervised contrastive learning and knowledge distillation methods on balanced datasets. The comparisons are shown in Secs. 4.6 and 4.7.",
|
| 1155 |
+
"bbox": [
|
| 1156 |
+
495,
|
| 1157 |
+
747,
|
| 1158 |
+
887,
|
| 1159 |
+
881
|
| 1160 |
+
],
|
| 1161 |
+
"page_idx": 5
|
| 1162 |
+
},
|
| 1163 |
+
{
|
| 1164 |
+
"type": "text",
|
| 1165 |
+
"text": "Comparison with Visual-Linguistic Models. Visual-",
|
| 1166 |
+
"bbox": [
|
| 1167 |
+
496,
|
| 1168 |
+
890,
|
| 1169 |
+
887,
|
| 1170 |
+
905
|
| 1171 |
+
],
|
| 1172 |
+
"page_idx": 5
|
| 1173 |
+
},
|
| 1174 |
+
{
|
| 1175 |
+
"type": "header",
|
| 1176 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 1177 |
+
"bbox": [
|
| 1178 |
+
124,
|
| 1179 |
+
56,
|
| 1180 |
+
846,
|
| 1181 |
+
70
|
| 1182 |
+
],
|
| 1183 |
+
"page_idx": 5
|
| 1184 |
+
},
|
| 1185 |
+
{
|
| 1186 |
+
"type": "page_number",
|
| 1187 |
+
"text": "6",
|
| 1188 |
+
"bbox": [
|
| 1189 |
+
480,
|
| 1190 |
+
922,
|
| 1191 |
+
491,
|
| 1192 |
+
934
|
| 1193 |
+
],
|
| 1194 |
+
"page_idx": 5
|
| 1195 |
+
},
|
| 1196 |
+
{
|
| 1197 |
+
"type": "table",
|
| 1198 |
+
"img_path": "images/1ac8ace2e0ab4b33dfd84def65211863d6650aae87a3e70c04d9052b32a92e3c.jpg",
|
| 1199 |
+
"table_caption": [
|
| 1200 |
+
"Table 4. Performance comparison with visual-linguistic models. In this experiment, the backbone networks are initialized with CLIP (Radford et al., 2021) pre-trained weights.",
|
| 1201 |
+
"ImageNet-LT dataset:"
|
| 1202 |
+
],
|
| 1203 |
+
"table_footnote": [],
|
| 1204 |
+
"table_body": "<table><tr><td>Method</td><td>Backbone</td><td>Accuracy</td></tr><tr><td>NCM</td><td>ResNet-50</td><td>49.2</td></tr><tr><td>cRT</td><td>ResNet-50</td><td>50.8</td></tr><tr><td>τ-norm</td><td>ResNet-50</td><td>51.2</td></tr><tr><td>LWS</td><td>ResNet-50</td><td>51.5</td></tr><tr><td>Zero-Shot CLIP</td><td>ResNet-50</td><td>59.8</td></tr><tr><td>VL-LTR</td><td>ResNet-50</td><td>70.1</td></tr><tr><td>Proposed</td><td>ResNet-50</td><td>70.9</td></tr><tr><td>VL-LTR</td><td>ViT-B</td><td>77.2</td></tr><tr><td>Proposed</td><td>ViT-B</td><td>78.0</td></tr></table>",
|
| 1205 |
+
"bbox": [
|
| 1206 |
+
129,
|
| 1207 |
+
148,
|
| 1208 |
+
431,
|
| 1209 |
+
304
|
| 1210 |
+
],
|
| 1211 |
+
"page_idx": 6
|
| 1212 |
+
},
|
| 1213 |
+
{
|
| 1214 |
+
"type": "table",
|
| 1215 |
+
"img_path": "images/f3777d107a7f23b75fe45b060c50e59e2b6e05b7e7734a09abed08e06f1a01eb.jpg",
|
| 1216 |
+
"table_caption": [
|
| 1217 |
+
"iNaturalist 2018 dataset:"
|
| 1218 |
+
],
|
| 1219 |
+
"table_footnote": [],
|
| 1220 |
+
"table_body": "<table><tr><td>Method</td><td>Backbone</td><td>Accuracy</td></tr><tr><td>VL-LTR</td><td>ViT-B</td><td>81.0</td></tr><tr><td>Proposed</td><td>ViT-B</td><td>82.1</td></tr></table>",
|
| 1221 |
+
"bbox": [
|
| 1222 |
+
129,
|
| 1223 |
+
332,
|
| 1224 |
+
431,
|
| 1225 |
+
381
|
| 1226 |
+
],
|
| 1227 |
+
"page_idx": 6
|
| 1228 |
+
},
|
| 1229 |
+
{
|
| 1230 |
+
"type": "table",
|
| 1231 |
+
"img_path": "images/0228771dc897db354f6e5b2cccdba24d5ea2df31df9aabc7cfa76f65514b78a9.jpg",
|
| 1232 |
+
"table_caption": [
|
| 1233 |
+
"Table 5. Ablation study on the effect of each component."
|
| 1234 |
+
],
|
| 1235 |
+
"table_footnote": [],
|
| 1236 |
+
"table_body": "<table><tr><td>Loss type</td><td>Teacher-student</td><td>Accuracy</td></tr><tr><td>Cross-entropy</td><td>X</td><td>55.4</td></tr><tr><td>BCL</td><td>X</td><td>56.7</td></tr><tr><td>BCL</td><td>✓</td><td>57.1 (+0.4)</td></tr><tr><td>Proposed</td><td>X</td><td>56.0</td></tr><tr><td>Proposed</td><td>✓</td><td>58.3 (+2.3)</td></tr></table>",
|
| 1237 |
+
"bbox": [
|
| 1238 |
+
109,
|
| 1239 |
+
419,
|
| 1240 |
+
442,
|
| 1241 |
+
513
|
| 1242 |
+
],
|
| 1243 |
+
"page_idx": 6
|
| 1244 |
+
},
|
| 1245 |
+
{
|
| 1246 |
+
"type": "text",
|
| 1247 |
+
"text": "linguistic models utilize training samples from text modality to enhance the performance of long-tailed image classification tasks. We compare our method with visual-linguistic models by extending it to learn the visual-linguistic representation as described in Section 3.4.",
|
| 1248 |
+
"bbox": [
|
| 1249 |
+
84,
|
| 1250 |
+
540,
|
| 1251 |
+
475,
|
| 1252 |
+
614
|
| 1253 |
+
],
|
| 1254 |
+
"page_idx": 6
|
| 1255 |
+
},
|
| 1256 |
+
{
|
| 1257 |
+
"type": "text",
|
| 1258 |
+
"text": "Table 4 presents the comparison results with visual-linguistic models. We follow the training settings of VL-LTR (Tian et al., 2021) and use a larger input size for the iNaturalist 2018 dataset. An input image size of $384 \\times 384$ is used only for the iNaturalist 2018 dataset in this experiment. The proposed method successfully connects two different modalities, even when the dataset is imbalanced. Thus, it exhibits the best performance regardless of network architecture or dataset.",
|
| 1259 |
+
"bbox": [
|
| 1260 |
+
84,
|
| 1261 |
+
623,
|
| 1262 |
+
475,
|
| 1263 |
+
758
|
| 1264 |
+
],
|
| 1265 |
+
"page_idx": 6
|
| 1266 |
+
},
|
| 1267 |
+
{
|
| 1268 |
+
"type": "text",
|
| 1269 |
+
"text": "4.4. Ablation Study",
|
| 1270 |
+
"text_level": 1,
|
| 1271 |
+
"bbox": [
|
| 1272 |
+
84,
|
| 1273 |
+
776,
|
| 1274 |
+
225,
|
| 1275 |
+
791
|
| 1276 |
+
],
|
| 1277 |
+
"page_idx": 6
|
| 1278 |
+
},
|
| 1279 |
+
{
|
| 1280 |
+
"type": "text",
|
| 1281 |
+
"text": "An ablation study is conducted on the ImageNet-LT dataset to investigate the effect of the components of the proposed method. Table 5 reveals that there is a performance gain when the proposed loss is used. However, the gain is insufficient because the contrast samples of tail classes are generated by highly outdated encoders as described in Sec. 3.3. Adopting a teacher-student framework solves the aforementioned problem.",
|
| 1282 |
+
"bbox": [
|
| 1283 |
+
84,
|
| 1284 |
+
800,
|
| 1285 |
+
475,
|
| 1286 |
+
905
|
| 1287 |
+
],
|
| 1288 |
+
"page_idx": 6
|
| 1289 |
+
},
|
| 1290 |
+
{
|
| 1291 |
+
"type": "table",
|
| 1292 |
+
"img_path": "images/5da0ef3e4bf0539ca7537f9d15b16c3ce1c0265f8a0908da9561eadc7f5070b1.jpg",
|
| 1293 |
+
"table_caption": [
|
| 1294 |
+
"Table 6. Effect of Teacher's Performance on Student."
|
| 1295 |
+
],
|
| 1296 |
+
"table_footnote": [],
|
| 1297 |
+
"table_body": "<table><tr><td colspan=\"2\">Teacher</td><td colspan=\"2\">Student</td></tr><tr><td>Backbone</td><td>Accuracy</td><td>Backbone</td><td>Accuracy</td></tr><tr><td>ResNet-34</td><td>50.3</td><td>ResNeXt-50</td><td>58.0</td></tr><tr><td>ResNet-50</td><td>55.2</td><td>ResNeXt-50</td><td>58.1</td></tr><tr><td>ResNeXt-50</td><td>56.4</td><td>ResNeXt-50</td><td>58.1</td></tr><tr><td>ResNeXt-101</td><td>57.9</td><td>ResNeXt-50</td><td>58.3</td></tr></table>",
|
| 1298 |
+
"bbox": [
|
| 1299 |
+
503,
|
| 1300 |
+
104,
|
| 1301 |
+
880,
|
| 1302 |
+
200
|
| 1303 |
+
],
|
| 1304 |
+
"page_idx": 6
|
| 1305 |
+
},
|
| 1306 |
+
{
|
| 1307 |
+
"type": "text",
|
| 1308 |
+
"text": "tioned problem, resulting in a significant gain in accuracy. To separate the effect of teacher-student framework from that of the proposed loss function, we measure the effect of teacher-student on BCL (Zhu et al., 2022), which is another contrastive learning-based method for long-tailed recognition. Since BCL does not employ queues to store contrast samples, it does not suffer from the outdated encoder problem. The teacher-student framework does not significantly improve the performance on BCL, proving that the impact of knowledge distillation is not significant. Meanwhile, it resolves the outdated encoder problem of the proposed method and leads to significant performance improvement.",
|
| 1309 |
+
"bbox": [
|
| 1310 |
+
496,
|
| 1311 |
+
236,
|
| 1312 |
+
887,
|
| 1313 |
+
417
|
| 1314 |
+
],
|
| 1315 |
+
"page_idx": 6
|
| 1316 |
+
},
|
| 1317 |
+
{
|
| 1318 |
+
"type": "text",
|
| 1319 |
+
"text": "4.5. Relation with Accuracy of Teacher",
|
| 1320 |
+
"text_level": 1,
|
| 1321 |
+
"bbox": [
|
| 1322 |
+
496,
|
| 1323 |
+
434,
|
| 1324 |
+
772,
|
| 1325 |
+
450
|
| 1326 |
+
],
|
| 1327 |
+
"page_idx": 6
|
| 1328 |
+
},
|
| 1329 |
+
{
|
| 1330 |
+
"type": "text",
|
| 1331 |
+
"text": "To measure the effect of the accuracy of teacher and find the best one, we modulate the performance of teachers by adopting different sizes of backbone architecture. The chosen backbone architectures are ResNet-34, ResNet-50, ResNeXt-50, and ResNeXt-101, and they are trained on ImageNet-LT dataset for 90 epochs. All students use the same backbone architecture ResNeXt-50 and are also trained for 90 epochs. Table 6 shows the effect of the performance of the teacher on the student. It is observed that the accuracy teacher dramatically decreases as the backbone is changed to ResNet-34, but the accuracy of the student remains stable. Moreover, the accuracy of the student surpasses that of the teacher. We find that a teacher with better performance leads to a better student, but the impact is marginal; a sufficient result can be achieved by using the same backbone architecture for both teacher and student. This result coincides with the finding of the ablation study, which indicates that the impact of knowledge distillation is not significant. Since a low-accuracy teacher can still successfully resolve the outdated encoder problem, the proposed method shows outstanding performance regardless teacher's accuracy.",
|
| 1332 |
+
"bbox": [
|
| 1333 |
+
495,
|
| 1334 |
+
457,
|
| 1335 |
+
887,
|
| 1336 |
+
790
|
| 1337 |
+
],
|
| 1338 |
+
"page_idx": 6
|
| 1339 |
+
},
|
| 1340 |
+
{
|
| 1341 |
+
"type": "text",
|
| 1342 |
+
"text": "4.6. Comparison with Supervised Contrastive Learning",
|
| 1343 |
+
"text_level": 1,
|
| 1344 |
+
"bbox": [
|
| 1345 |
+
496,
|
| 1346 |
+
806,
|
| 1347 |
+
885,
|
| 1348 |
+
821
|
| 1349 |
+
],
|
| 1350 |
+
"page_idx": 6
|
| 1351 |
+
},
|
| 1352 |
+
{
|
| 1353 |
+
"type": "text",
|
| 1354 |
+
"text": "Table 7 presents the performance comparison of the proposed method with supervised contrastive learning (Khosla et al., 2020). Experiments are conducted using networks with ResNet-50 backbone on CIFAR-10-LT dataset with different imbalance factors. The proposed method shows",
|
| 1355 |
+
"bbox": [
|
| 1356 |
+
495,
|
| 1357 |
+
829,
|
| 1358 |
+
885,
|
| 1359 |
+
905
|
| 1360 |
+
],
|
| 1361 |
+
"page_idx": 6
|
| 1362 |
+
},
|
| 1363 |
+
{
|
| 1364 |
+
"type": "header",
|
| 1365 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 1366 |
+
"bbox": [
|
| 1367 |
+
124,
|
| 1368 |
+
56,
|
| 1369 |
+
846,
|
| 1370 |
+
70
|
| 1371 |
+
],
|
| 1372 |
+
"page_idx": 6
|
| 1373 |
+
},
|
| 1374 |
+
{
|
| 1375 |
+
"type": "page_number",
|
| 1376 |
+
"text": "7",
|
| 1377 |
+
"bbox": [
|
| 1378 |
+
480,
|
| 1379 |
+
922,
|
| 1380 |
+
491,
|
| 1381 |
+
934
|
| 1382 |
+
],
|
| 1383 |
+
"page_idx": 6
|
| 1384 |
+
},
|
| 1385 |
+
{
|
| 1386 |
+
"type": "table",
|
| 1387 |
+
"img_path": "images/d7b65f913672e65d7cfe1885627550b3b7b496e737e1308e1b26c893669055c6.jpg",
|
| 1388 |
+
"table_caption": [
|
| 1389 |
+
"Table 7. Performance comparison with supervised contrastive learning on the CIFAR-10-LT dataset with different imbalance factors."
|
| 1390 |
+
],
|
| 1391 |
+
"table_footnote": [],
|
| 1392 |
+
"table_body": "<table><tr><td>Imb. factor</td><td>Cross-Entropy</td><td>SupCon</td><td>Proposed</td></tr><tr><td>1</td><td>94.8</td><td>96.0</td><td>95.9</td></tr><tr><td>10</td><td>88.4</td><td>94.0</td><td>94.5</td></tr><tr><td>50</td><td>69.1</td><td>88.1</td><td>90.6</td></tr><tr><td>100</td><td>64.1</td><td>82.7</td><td>86.7</td></tr></table>",
|
| 1393 |
+
"bbox": [
|
| 1394 |
+
91,
|
| 1395 |
+
131,
|
| 1396 |
+
460,
|
| 1397 |
+
210
|
| 1398 |
+
],
|
| 1399 |
+
"page_idx": 7
|
| 1400 |
+
},
|
| 1401 |
+
{
|
| 1402 |
+
"type": "table",
|
| 1403 |
+
"img_path": "images/3ae6a5c6f8d6488d69a7a56a20587ac93a7af3e9f3961d0befc4fe408d68b275.jpg",
|
| 1404 |
+
"table_caption": [
|
| 1405 |
+
"Table 8. Performance comparison with knowledge distillation methods.",
|
| 1406 |
+
"Balanced dataset:"
|
| 1407 |
+
],
|
| 1408 |
+
"table_footnote": [],
|
| 1409 |
+
"table_body": "<table><tr><td>Method</td><td>CIFAR-100</td><td>ImageNet</td></tr><tr><td>None</td><td>69.1</td><td>69.8</td></tr><tr><td>KD</td><td>70.7</td><td>70.7</td></tr><tr><td>CRD</td><td>71.2</td><td>71.2</td></tr><tr><td>Proposed</td><td>71.4</td><td>71.1</td></tr></table>",
|
| 1410 |
+
"bbox": [
|
| 1411 |
+
122,
|
| 1412 |
+
277,
|
| 1413 |
+
437,
|
| 1414 |
+
358
|
| 1415 |
+
],
|
| 1416 |
+
"page_idx": 7
|
| 1417 |
+
},
|
| 1418 |
+
{
|
| 1419 |
+
"type": "table",
|
| 1420 |
+
"img_path": "images/444af15dcd0900e78e612fde108f3477435cf8f380e6d5fa9441d7c289b2112e.jpg",
|
| 1421 |
+
"table_caption": [
|
| 1422 |
+
"Imbalanced dataset:"
|
| 1423 |
+
],
|
| 1424 |
+
"table_footnote": [],
|
| 1425 |
+
"table_body": "<table><tr><td>Method</td><td>CIFAR-100-LT</td><td>ImageNet-LT</td></tr><tr><td>None</td><td>48.6</td><td>56.3</td></tr><tr><td>KD</td><td>49.9</td><td>56.5</td></tr><tr><td>CRD</td><td>50.6</td><td>57.2</td></tr><tr><td>Proposed</td><td>51.2</td><td>58.3</td></tr></table>",
|
| 1426 |
+
"bbox": [
|
| 1427 |
+
122,
|
| 1428 |
+
385,
|
| 1429 |
+
437,
|
| 1430 |
+
465
|
| 1431 |
+
],
|
| 1432 |
+
"page_idx": 7
|
| 1433 |
+
},
|
| 1434 |
+
{
|
| 1435 |
+
"type": "text",
|
| 1436 |
+
"text": "the best accuracy with different imbalance factors, and the gap between previous methods increases as the imbalance factor increased. In addition, the proposed method shows a performance comparable with that of supervised contrastive learning when the dataset is balanced.",
|
| 1437 |
+
"bbox": [
|
| 1438 |
+
84,
|
| 1439 |
+
494,
|
| 1440 |
+
473,
|
| 1441 |
+
571
|
| 1442 |
+
],
|
| 1443 |
+
"page_idx": 7
|
| 1444 |
+
},
|
| 1445 |
+
{
|
| 1446 |
+
"type": "text",
|
| 1447 |
+
"text": "4.7. Comparison with Knowledge Distillation",
|
| 1448 |
+
"text_level": 1,
|
| 1449 |
+
"bbox": [
|
| 1450 |
+
84,
|
| 1451 |
+
587,
|
| 1452 |
+
403,
|
| 1453 |
+
603
|
| 1454 |
+
],
|
| 1455 |
+
"page_idx": 7
|
| 1456 |
+
},
|
| 1457 |
+
{
|
| 1458 |
+
"type": "text",
|
| 1459 |
+
"text": "Because we adopt a teacher-student framework to train the proposed method, comparing it with previous knowledge distillation methods is relevant. We select two knowledge distillation methods for the comparison: KD (Hinton et al.), which does not utilize contrastive learning, and CRD (Tian et al., 2020), which utilizes contrastive learning. For the CIFAR-100 and CIFAR-100-LT datasets, we train a student network with ResNet-20 backbone using a teacher network with ResNet-56 backbone for 240 epochs. We use a ResNet-18 student and a ResNet-34 teacher for ImageNet experiments, and a ResNeXt-50 student and a ResNeXt-101 teacher for ImageNet-LT experiments. For both ImageNet experiments, the networks are trained for 90 epochs.",
|
| 1460 |
+
"bbox": [
|
| 1461 |
+
84,
|
| 1462 |
+
611,
|
| 1463 |
+
475,
|
| 1464 |
+
808
|
| 1465 |
+
],
|
| 1466 |
+
"page_idx": 7
|
| 1467 |
+
},
|
| 1468 |
+
{
|
| 1469 |
+
"type": "text",
|
| 1470 |
+
"text": "Table 8 presents the performance comparison with knowledge distillation methods. The proposed method achieves the best performance on both balanced and imbalanced datasets. Knowledge distillation methods designed for balanced datasets show better accuracy than vanilla training on imbalanced datasets as well. This is because they pro",
|
| 1471 |
+
"bbox": [
|
| 1472 |
+
84,
|
| 1473 |
+
814,
|
| 1474 |
+
478,
|
| 1475 |
+
906
|
| 1476 |
+
],
|
| 1477 |
+
"page_idx": 7
|
| 1478 |
+
},
|
| 1479 |
+
{
|
| 1480 |
+
"type": "table",
|
| 1481 |
+
"img_path": "images/61fdddf2d401340d722efc62d96f8ddd806bbb50fde02d4ee4a86ca06aad8a3b.jpg",
|
| 1482 |
+
"table_caption": [
|
| 1483 |
+
"Table 9. Performance comparison on the ADE20K semantic segmentation dataset."
|
| 1484 |
+
],
|
| 1485 |
+
"table_footnote": [],
|
| 1486 |
+
"table_body": "<table><tr><td>Method</td><td>mIoU</td><td>mAcc</td></tr><tr><td>Cross-Entropy</td><td>36.1</td><td>45.4</td></tr><tr><td>Proposed (α = 0.2)</td><td>38.1</td><td>51.4</td></tr><tr><td>Proposed (α = 1.0)</td><td>31.7</td><td>59.8</td></tr></table>",
|
| 1487 |
+
"bbox": [
|
| 1488 |
+
547,
|
| 1489 |
+
118,
|
| 1490 |
+
828,
|
| 1491 |
+
181
|
| 1492 |
+
],
|
| 1493 |
+
"page_idx": 7
|
| 1494 |
+
},
|
| 1495 |
+
{
|
| 1496 |
+
"type": "text",
|
| 1497 |
+
"text": "vide measures to transfer the knowledge learned from head classes to tail classes, mitigating the lack of training samples. However, their gains are not the best because they do not consider the frequency of classes.",
|
| 1498 |
+
"bbox": [
|
| 1499 |
+
496,
|
| 1500 |
+
205,
|
| 1501 |
+
885,
|
| 1502 |
+
267
|
| 1503 |
+
],
|
| 1504 |
+
"page_idx": 7
|
| 1505 |
+
},
|
| 1506 |
+
{
|
| 1507 |
+
"type": "text",
|
| 1508 |
+
"text": "4.8. Semantic Segmentation Task",
|
| 1509 |
+
"text_level": 1,
|
| 1510 |
+
"bbox": [
|
| 1511 |
+
496,
|
| 1512 |
+
282,
|
| 1513 |
+
732,
|
| 1514 |
+
299
|
| 1515 |
+
],
|
| 1516 |
+
"page_idx": 7
|
| 1517 |
+
},
|
| 1518 |
+
{
|
| 1519 |
+
"type": "text",
|
| 1520 |
+
"text": "To prove the robustness of the proposed method, we replace the cross-entropy loss of semantic segmentation with the proposed method and measure the performance change. In this experiment, we measure the effect of the loss functions, not that of networks. Therefore, we perform the comparison using a widely used network FCN (Long et al., 2015) with ResNet-50 backbone. The evaluation is conducted on ADE20K (Zhou et al., 2017) using $160k$ training steps.",
|
| 1521 |
+
"bbox": [
|
| 1522 |
+
495,
|
| 1523 |
+
306,
|
| 1524 |
+
885,
|
| 1525 |
+
429
|
| 1526 |
+
],
|
| 1527 |
+
"page_idx": 7
|
| 1528 |
+
},
|
| 1529 |
+
{
|
| 1530 |
+
"type": "text",
|
| 1531 |
+
"text": "Table 9 presents the performance comparison of losses. mIoU refers to the mean intersection-over-union (IoU) and mAcc refers to the mean accuracy (Acc), where the mean is taken over classes. The proposed method achieves the best mIoU or mAcc depending on the hyperparameter $\\alpha$ , which modulates the level of logit adjustment as given by Eq. 11.",
|
| 1532 |
+
"bbox": [
|
| 1533 |
+
495,
|
| 1534 |
+
435,
|
| 1535 |
+
885,
|
| 1536 |
+
527
|
| 1537 |
+
],
|
| 1538 |
+
"page_idx": 7
|
| 1539 |
+
},
|
| 1540 |
+
{
|
| 1541 |
+
"type": "equation",
|
| 1542 |
+
"text": "\n$$\n- L _ {G M L} ^ {(\\alpha)} = \\tag {11}\n$$\n",
|
| 1543 |
+
"text_format": "latex",
|
| 1544 |
+
"bbox": [
|
| 1545 |
+
501,
|
| 1546 |
+
535,
|
| 1547 |
+
885,
|
| 1548 |
+
555
|
| 1549 |
+
],
|
| 1550 |
+
"page_idx": 7
|
| 1551 |
+
},
|
| 1552 |
+
{
|
| 1553 |
+
"type": "equation",
|
| 1554 |
+
"text": "\n$$\n\\log \\frac {\\exp \\left[ \\log \\frac {1}{\\| Z _ {y} \\|} \\sum_ {z _ {y} \\in Z _ {y}} \\exp \\left(z _ {x} \\cdot z _ {y} / \\tau_ {g}\\right) + \\alpha \\eta_ {y} \\right]}{\\sum_ {c \\in C} \\exp \\left[ \\log \\frac {1}{\\| Z _ {c} \\|} \\sum_ {z _ {c} \\in Z _ {c}} \\exp \\left(z _ {x} \\cdot z _ {c} / \\tau_ {g}\\right) + \\alpha \\eta_ {c} \\right]}\n$$\n",
|
| 1555 |
+
"text_format": "latex",
|
| 1556 |
+
"bbox": [
|
| 1557 |
+
501,
|
| 1558 |
+
558,
|
| 1559 |
+
880,
|
| 1560 |
+
609
|
| 1561 |
+
],
|
| 1562 |
+
"page_idx": 7
|
| 1563 |
+
},
|
| 1564 |
+
{
|
| 1565 |
+
"type": "equation",
|
| 1566 |
+
"text": "\n$$\n\\mathrm {I o U} = \\mathrm {T P} / (\\mathrm {T P} + \\mathrm {F N} + \\mathrm {F P}) \\tag {12}\n$$\n",
|
| 1567 |
+
"text_format": "latex",
|
| 1568 |
+
"bbox": [
|
| 1569 |
+
596,
|
| 1570 |
+
631,
|
| 1571 |
+
885,
|
| 1572 |
+
647
|
| 1573 |
+
],
|
| 1574 |
+
"page_idx": 7
|
| 1575 |
+
},
|
| 1576 |
+
{
|
| 1577 |
+
"type": "equation",
|
| 1578 |
+
"text": "\n$$\n\\mathrm {A c c} = \\mathrm {T P} / (\\mathrm {T P} + \\mathrm {F N}) \\tag {13}\n$$\n",
|
| 1579 |
+
"text_format": "latex",
|
| 1580 |
+
"bbox": [
|
| 1581 |
+
596,
|
| 1582 |
+
650,
|
| 1583 |
+
885,
|
| 1584 |
+
666
|
| 1585 |
+
],
|
| 1586 |
+
"page_idx": 7
|
| 1587 |
+
},
|
| 1588 |
+
{
|
| 1589 |
+
"type": "text",
|
| 1590 |
+
"text": "Eqs. 12-13 give the definitions of IoU and Acc, where TP, FN, and FP denote true positive, false negative, and false positive, respectively. mAcc is the same metric as the balanced evaluation setting used in classification tasks, and $\\alpha = 1.0$ gives the best mAcc. However, as FPs arise from other classes, mIoU is less sensitive to the accuracy of tail classes than mAcc. Therefore, the best mIoU is achieved by boosting the accuracy of head classes at the expense of tail classes, which is achieved by decreasing $\\alpha$ . The effect of $\\alpha$ on mIoU and mAcc is shown in Fig. 2.",
|
| 1591 |
+
"bbox": [
|
| 1592 |
+
495,
|
| 1593 |
+
684,
|
| 1594 |
+
885,
|
| 1595 |
+
835
|
| 1596 |
+
],
|
| 1597 |
+
"page_idx": 7
|
| 1598 |
+
},
|
| 1599 |
+
{
|
| 1600 |
+
"type": "text",
|
| 1601 |
+
"text": "4.9. Trainable Temperature Analysis",
|
| 1602 |
+
"text_level": 1,
|
| 1603 |
+
"bbox": [
|
| 1604 |
+
496,
|
| 1605 |
+
851,
|
| 1606 |
+
756,
|
| 1607 |
+
867
|
| 1608 |
+
],
|
| 1609 |
+
"page_idx": 7
|
| 1610 |
+
},
|
| 1611 |
+
{
|
| 1612 |
+
"type": "text",
|
| 1613 |
+
"text": "We examine the difference between a trainable $\\tau_{g}$ and a fixed one. Fig. 3 shows the change in $\\tau_{g}$ during training. $\\tau_{g}$",
|
| 1614 |
+
"bbox": [
|
| 1615 |
+
495,
|
| 1616 |
+
875,
|
| 1617 |
+
885,
|
| 1618 |
+
906
|
| 1619 |
+
],
|
| 1620 |
+
"page_idx": 7
|
| 1621 |
+
},
|
| 1622 |
+
{
|
| 1623 |
+
"type": "header",
|
| 1624 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 1625 |
+
"bbox": [
|
| 1626 |
+
122,
|
| 1627 |
+
56,
|
| 1628 |
+
846,
|
| 1629 |
+
70
|
| 1630 |
+
],
|
| 1631 |
+
"page_idx": 7
|
| 1632 |
+
},
|
| 1633 |
+
{
|
| 1634 |
+
"type": "page_number",
|
| 1635 |
+
"text": "8",
|
| 1636 |
+
"bbox": [
|
| 1637 |
+
480,
|
| 1638 |
+
922,
|
| 1639 |
+
491,
|
| 1640 |
+
934
|
| 1641 |
+
],
|
| 1642 |
+
"page_idx": 7
|
| 1643 |
+
},
|
| 1644 |
+
{
|
| 1645 |
+
"type": "image",
|
| 1646 |
+
"img_path": "images/1069204b3f7ece6effa26de3ca85eda536e33cd0eb8e074b1ebd9b42a9d1a60b.jpg",
|
| 1647 |
+
"image_caption": [
|
| 1648 |
+
"Figure 2. Effect of $\\alpha$ on semantic segmentation performance."
|
| 1649 |
+
],
|
| 1650 |
+
"image_footnote": [],
|
| 1651 |
+
"bbox": [
|
| 1652 |
+
88,
|
| 1653 |
+
79,
|
| 1654 |
+
470,
|
| 1655 |
+
186
|
| 1656 |
+
],
|
| 1657 |
+
"page_idx": 8
|
| 1658 |
+
},
|
| 1659 |
+
{
|
| 1660 |
+
"type": "image",
|
| 1661 |
+
"img_path": "images/d418e42c02c0d5edcdf9725aa594a32c68a8e24b5be7b2f30f965adc9a9405ba.jpg",
|
| 1662 |
+
"image_caption": [
|
| 1663 |
+
"Figure 3. Change in $\\tau_{g}$ during training."
|
| 1664 |
+
],
|
| 1665 |
+
"image_footnote": [],
|
| 1666 |
+
"bbox": [
|
| 1667 |
+
89,
|
| 1668 |
+
238,
|
| 1669 |
+
472,
|
| 1670 |
+
348
|
| 1671 |
+
],
|
| 1672 |
+
"page_idx": 8
|
| 1673 |
+
},
|
| 1674 |
+
{
|
| 1675 |
+
"type": "text",
|
| 1676 |
+
"text": "becomes smaller as the encoder network converges. The final value is approximately 0.05, which is similar to the hyperparameter choice of other methods (He et al., 2020; Tian et al., 2020; Zhu et al., 2022), i.e., 0.07. Furthermore, training $\\tau_{g}$ results in slightly better performance, boosting the accuracy from 58.2 to 58.3.",
|
| 1677 |
+
"bbox": [
|
| 1678 |
+
84,
|
| 1679 |
+
414,
|
| 1680 |
+
475,
|
| 1681 |
+
506
|
| 1682 |
+
],
|
| 1683 |
+
"page_idx": 8
|
| 1684 |
+
},
|
| 1685 |
+
{
|
| 1686 |
+
"type": "text",
|
| 1687 |
+
"text": "5. Conclusion",
|
| 1688 |
+
"text_level": 1,
|
| 1689 |
+
"bbox": [
|
| 1690 |
+
84,
|
| 1691 |
+
523,
|
| 1692 |
+
205,
|
| 1693 |
+
540
|
| 1694 |
+
],
|
| 1695 |
+
"page_idx": 8
|
| 1696 |
+
},
|
| 1697 |
+
{
|
| 1698 |
+
"type": "text",
|
| 1699 |
+
"text": "In this paper, we show that the fundamental problem of contrastive learning methods on long-tailed recognition comes from maximizing the mutual information between latent features and input data. To overcome this limitation, we interpret the long-tailed recognition as the mutual information maximization between latent features and ground-truth labels. This approach seamlessly integrates contrastive learning and the logit adjustment technique. It also verifies that contrastive learning implies the use of a Gaussian mixture likelihood and the logit adjustment is derived from the prior, while previous methods have combined them without understanding the theoretical background. Further, we propose an efficient way of modeling the Gaussian mixture likelihood using a teacher-student framework.",
|
| 1700 |
+
"bbox": [
|
| 1701 |
+
84,
|
| 1702 |
+
550,
|
| 1703 |
+
475,
|
| 1704 |
+
762
|
| 1705 |
+
],
|
| 1706 |
+
"page_idx": 8
|
| 1707 |
+
},
|
| 1708 |
+
{
|
| 1709 |
+
"type": "text",
|
| 1710 |
+
"text": "Extensive experiments on both long-tailed datasets and balanced datasets verify the superiority of the proposed method, which marks state-of-the-art performance on various benchmarks. Finally, as real-world data often show a long-tailed distribution, the proposed method can be applied to other tasks as well. As an example, we conduct experiments on a semantic segmentation dataset. The proposed method also showed a large performance gain on semantic segmentation, demonstrating its versatility.",
|
| 1711 |
+
"bbox": [
|
| 1712 |
+
84,
|
| 1713 |
+
768,
|
| 1714 |
+
475,
|
| 1715 |
+
906
|
| 1716 |
+
],
|
| 1717 |
+
"page_idx": 8
|
| 1718 |
+
},
|
| 1719 |
+
{
|
| 1720 |
+
"type": "text",
|
| 1721 |
+
"text": "Acknowledgements",
|
| 1722 |
+
"text_level": 1,
|
| 1723 |
+
"bbox": [
|
| 1724 |
+
498,
|
| 1725 |
+
83,
|
| 1726 |
+
665,
|
| 1727 |
+
99
|
| 1728 |
+
],
|
| 1729 |
+
"page_idx": 8
|
| 1730 |
+
},
|
| 1731 |
+
{
|
| 1732 |
+
"type": "text",
|
| 1733 |
+
"text": "This research was supported by the Challengable Future Defense Technology Research and Development Program through the Agency For Defense Development(ADD) funded by the Defense Acquisition Program Administration(DAPA) in 2023(No.915027201), the Institute of New Media and Communications, the Institute of Engineering Research, and the Automation and Systems Research Institute at Seoul National University.",
|
| 1734 |
+
"bbox": [
|
| 1735 |
+
496,
|
| 1736 |
+
109,
|
| 1737 |
+
888,
|
| 1738 |
+
229
|
| 1739 |
+
],
|
| 1740 |
+
"page_idx": 8
|
| 1741 |
+
},
|
| 1742 |
+
{
|
| 1743 |
+
"type": "text",
|
| 1744 |
+
"text": "References",
|
| 1745 |
+
"text_level": 1,
|
| 1746 |
+
"bbox": [
|
| 1747 |
+
498,
|
| 1748 |
+
250,
|
| 1749 |
+
594,
|
| 1750 |
+
265
|
| 1751 |
+
],
|
| 1752 |
+
"page_idx": 8
|
| 1753 |
+
},
|
| 1754 |
+
{
|
| 1755 |
+
"type": "list",
|
| 1756 |
+
"sub_type": "ref_text",
|
| 1757 |
+
"list_items": [
|
| 1758 |
+
"Alshammari, S., Wang, Y.-X., Ramanan, D., and Kong, S. Long-tailed recognition via weight balancing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6897-6907, 2022.",
|
| 1759 |
+
"Byrd, J. and Lipton, Z. What is the effect of importance weighting in deep learning? In International Conference on Machine Learning, pp. 872-881. PMLR, 2019.",
|
| 1760 |
+
"Chawla, N. V., Bowyer, K. W., Hall, L. O., and Kegelmeyer, W. P. Smote: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16:321-357, 2002.",
|
| 1761 |
+
"Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pp. 1597-1607. PMLR, 2020a.",
|
| 1762 |
+
"Chen, T., Kornblith, S., Swersky, K., Norouzi, M., and Hinton, G. E. Big self-supervised models are strong semi-supervised learners. Advances in neural information processing systems, 33:22243-22255, 2020b.",
|
| 1763 |
+
"Chen, X., Fan, H., Girshick, R., and He, K. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020c.",
|
| 1764 |
+
"Contributors, M. MMSegmentation: Openmmlab semantic segmentation toolbox and benchmark. https://github.com/open-mmlab/mmsegmentation, 2020.",
|
| 1765 |
+
"Cubuk, E. D., Zoph, B., Shlens, J., and Le, Q. V. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition workshops, pp. 702-703, 2020.",
|
| 1766 |
+
"Cui, J., Zhong, Z., Liu, S., Yu, B., and Jia, J. Parametric contrastive learning. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 715-724, 2021."
|
| 1767 |
+
],
|
| 1768 |
+
"bbox": [
|
| 1769 |
+
498,
|
| 1770 |
+
273,
|
| 1771 |
+
887,
|
| 1772 |
+
904
|
| 1773 |
+
],
|
| 1774 |
+
"page_idx": 8
|
| 1775 |
+
},
|
| 1776 |
+
{
|
| 1777 |
+
"type": "header",
|
| 1778 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 1779 |
+
"bbox": [
|
| 1780 |
+
124,
|
| 1781 |
+
56,
|
| 1782 |
+
846,
|
| 1783 |
+
70
|
| 1784 |
+
],
|
| 1785 |
+
"page_idx": 8
|
| 1786 |
+
},
|
| 1787 |
+
{
|
| 1788 |
+
"type": "page_number",
|
| 1789 |
+
"text": "9",
|
| 1790 |
+
"bbox": [
|
| 1791 |
+
480,
|
| 1792 |
+
922,
|
| 1793 |
+
491,
|
| 1794 |
+
934
|
| 1795 |
+
],
|
| 1796 |
+
"page_idx": 8
|
| 1797 |
+
},
|
| 1798 |
+
{
|
| 1799 |
+
"type": "list",
|
| 1800 |
+
"sub_type": "ref_text",
|
| 1801 |
+
"list_items": [
|
| 1802 |
+
"Cui, Y., Jia, M., Lin, T.-Y., Song, Y., and Belongie, S. Class-balanced loss based on effective number of samples. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9268-9277, 2019.",
|
| 1803 |
+
"Drummond, C., Holte, R. C., et al. C4. 5, class imbalance, and cost sensitivity: why under-sampling beats over-sampling. In Workshop on learning from imbalanced datasets II, volume 11, pp. 1-8. CiteSeer, 2003.",
|
| 1804 |
+
"Feng, C., Zhong, Y., and Huang, W. Exploring classification equilibrium in long-tailed object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3417-3426, 2021.",
|
| 1805 |
+
"Gidaris, S. and Komodakis, N. Dynamic few-shot visual learning without forgetting. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4367-4375, 2018.",
|
| 1806 |
+
"Han, H., Wang, W.-Y., and Mao, B.-H. Borderline-smote: a new over-sampling method in imbalanced data sets learning. In International conference on intelligent computing, pp. 878-887. Springer, 2005.",
|
| 1807 |
+
"He, H. and Garcia, E. A. Learning from imbalanced data. IEEE Transactions on knowledge and data engineering, 21(9):1263-1284, 2009.",
|
| 1808 |
+
"He, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9729-9738, 2020.",
|
| 1809 |
+
"Hinton, G., Vinyals, O., Dean, J., et al. Distilling the knowledge in a neural network.",
|
| 1810 |
+
"Hong, Y., Han, S., Choi, K., Seo, S., Kim, B., and Chang, B. Disentangling label distribution for long-tailed visual recognition. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6626-6636, 2021.",
|
| 1811 |
+
"Japkowicz, N. and Stephen, S. The class imbalance problem: A systematic study. Intelligent data analysis, 6(5):429-449, 2002.",
|
| 1812 |
+
"Kang, B., Xie, S., Rohrbach, M., Yan, Z., Gordo, A., Feng, J., and Kalantidis, Y. Decoupling representation and classifier for long-tailed recognition. In International Conference on Learning Representations, 2020.",
|
| 1813 |
+
"Khosla, P., Teterwak, P., Wang, C., Sarna, A., Tian, Y., Isola, P., Maschinot, A., Liu, C., and Krishnan, D. Supervised contrastive learning. Advances in Neural Information Processing Systems, 33:18661-18673, 2020."
|
| 1814 |
+
],
|
| 1815 |
+
"bbox": [
|
| 1816 |
+
86,
|
| 1817 |
+
84,
|
| 1818 |
+
475,
|
| 1819 |
+
905
|
| 1820 |
+
],
|
| 1821 |
+
"page_idx": 9
|
| 1822 |
+
},
|
| 1823 |
+
{
|
| 1824 |
+
"type": "list",
|
| 1825 |
+
"sub_type": "ref_text",
|
| 1826 |
+
"list_items": [
|
| 1827 |
+
"Krizhevsky, A. Learning multiple layers of features from tiny images. 2009.",
|
| 1828 |
+
"Liu, Z., Miao, Z., Zhan, X., Wang, J., Gong, B., and Yu, S. X. Large-scale long-tailed recognition in an open world. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2537-2546, 2019.",
|
| 1829 |
+
"Long, J., Shelhamer, E., and Darrell, T. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431-3440, 2015.",
|
| 1830 |
+
"Menon, A. K., Jayasumana, S., Rawat, A. S., Jain, H., Veit, A., and Kumar, S. Long-tail learning via logit adjustment. In International Conference on Learning Representations, 2021.",
|
| 1831 |
+
"Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S., and Dean, J. Distributed representations of words and phrases and their compositionality. Advances in neural information processing systems, 26, 2013.",
|
| 1832 |
+
"Oord, A. v. d., Li, Y., and Vinyals, O. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.",
|
| 1833 |
+
"Poole, B., Ozair, S., Van Den Oord, A., Alemi, A., and Tucker, G. On variational bounds of mutual information. In International Conference on Machine Learning, pp. 5171-5180. PMLR, 2019.",
|
| 1834 |
+
"Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pp. 8748-8763. PMLR, 2021.",
|
| 1835 |
+
"Ren, J., Yu, C., Ma, X., Zhao, H., Yi, S., et al. Balanced meta-softmax for long-tailed visual recognition. Advances in neural information processing systems, 33: 4175-4186, 2020.",
|
| 1836 |
+
"Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3): 211-252, 2015.",
|
| 1837 |
+
"Tian, C., Wang, W., Zhu, X., Wang, X., Dai, J., and Qiao, Y. Vl-ltr: Learning class-wise visual-linguistic representation for long-tailed visual recognition. arXiv preprint arXiv:2111.13579, 2021.",
|
| 1838 |
+
"Tian, Y., Krishnan, D., and Isola, P. Contrastive representation distillation. In International Conference on Learning Representations, 2020."
|
| 1839 |
+
],
|
| 1840 |
+
"bbox": [
|
| 1841 |
+
500,
|
| 1842 |
+
84,
|
| 1843 |
+
885,
|
| 1844 |
+
905
|
| 1845 |
+
],
|
| 1846 |
+
"page_idx": 9
|
| 1847 |
+
},
|
| 1848 |
+
{
|
| 1849 |
+
"type": "header",
|
| 1850 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 1851 |
+
"bbox": [
|
| 1852 |
+
124,
|
| 1853 |
+
56,
|
| 1854 |
+
848,
|
| 1855 |
+
71
|
| 1856 |
+
],
|
| 1857 |
+
"page_idx": 9
|
| 1858 |
+
},
|
| 1859 |
+
{
|
| 1860 |
+
"type": "page_number",
|
| 1861 |
+
"text": "10",
|
| 1862 |
+
"bbox": [
|
| 1863 |
+
477,
|
| 1864 |
+
922,
|
| 1865 |
+
495,
|
| 1866 |
+
934
|
| 1867 |
+
],
|
| 1868 |
+
"page_idx": 9
|
| 1869 |
+
},
|
| 1870 |
+
{
|
| 1871 |
+
"type": "list",
|
| 1872 |
+
"sub_type": "ref_text",
|
| 1873 |
+
"list_items": [
|
| 1874 |
+
"Van Horn, G., Mac Aodha, O., Song, Y., Cui, Y., Sun, C., Shepard, A., Adam, H., Perona, P., and Belongie, S. The inaturalist species classification and detection dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8769-8778, 2018.",
|
| 1875 |
+
"Wang, Y.-X., Ramanan, D., and Hebert, M. Learning to model the tail. Advances in neural information processing systems, 30, 2017.",
|
| 1876 |
+
"Zhou, B., Zhao, H., Puig, X., Fidler, S., Barriuso, A., and Torralba, A. Scene parsing through ade20k dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 633-641, 2017.",
|
| 1877 |
+
"Zhu, J., Wang, Z., Chen, J., Chen, Y.-P. P., and Jiang, Y.-G. Balanced contrastive learning for long-tailed visual recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6908-6917, 2022."
|
| 1878 |
+
],
|
| 1879 |
+
"bbox": [
|
| 1880 |
+
86,
|
| 1881 |
+
84,
|
| 1882 |
+
475,
|
| 1883 |
+
371
|
| 1884 |
+
],
|
| 1885 |
+
"page_idx": 10
|
| 1886 |
+
},
|
| 1887 |
+
{
|
| 1888 |
+
"type": "header",
|
| 1889 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 1890 |
+
"bbox": [
|
| 1891 |
+
124,
|
| 1892 |
+
56,
|
| 1893 |
+
848,
|
| 1894 |
+
70
|
| 1895 |
+
],
|
| 1896 |
+
"page_idx": 10
|
| 1897 |
+
},
|
| 1898 |
+
{
|
| 1899 |
+
"type": "page_number",
|
| 1900 |
+
"text": "11",
|
| 1901 |
+
"bbox": [
|
| 1902 |
+
477,
|
| 1903 |
+
922,
|
| 1904 |
+
493,
|
| 1905 |
+
934
|
| 1906 |
+
],
|
| 1907 |
+
"page_idx": 10
|
| 1908 |
+
},
|
| 1909 |
+
{
|
| 1910 |
+
"type": "text",
|
| 1911 |
+
"text": "A. Appendix",
|
| 1912 |
+
"text_level": 1,
|
| 1913 |
+
"bbox": [
|
| 1914 |
+
86,
|
| 1915 |
+
83,
|
| 1916 |
+
197,
|
| 1917 |
+
101
|
| 1918 |
+
],
|
| 1919 |
+
"page_idx": 11
|
| 1920 |
+
},
|
| 1921 |
+
{
|
| 1922 |
+
"type": "text",
|
| 1923 |
+
"text": "A.1. Contrastive Learning as MI Maximization between Latent Features and Input Data",
|
| 1924 |
+
"text_level": 1,
|
| 1925 |
+
"bbox": [
|
| 1926 |
+
84,
|
| 1927 |
+
109,
|
| 1928 |
+
702,
|
| 1929 |
+
125
|
| 1930 |
+
],
|
| 1931 |
+
"page_idx": 11
|
| 1932 |
+
},
|
| 1933 |
+
{
|
| 1934 |
+
"type": "text",
|
| 1935 |
+
"text": "The loss function of MoCo (He et al., 2020) is written as follows.",
|
| 1936 |
+
"bbox": [
|
| 1937 |
+
84,
|
| 1938 |
+
133,
|
| 1939 |
+
516,
|
| 1940 |
+
148
|
| 1941 |
+
],
|
| 1942 |
+
"page_idx": 11
|
| 1943 |
+
},
|
| 1944 |
+
{
|
| 1945 |
+
"type": "equation",
|
| 1946 |
+
"text": "\n$$\nL _ {M o C o} = - \\log \\frac {\\exp \\left(q \\cdot k _ {+} / \\tau\\right)}{\\sum_ {i = 0} ^ {K} \\exp \\left(q \\cdot k _ {i} / \\tau\\right)} \\tag {A.1}\n$$\n",
|
| 1947 |
+
"text_format": "latex",
|
| 1948 |
+
"bbox": [
|
| 1949 |
+
359,
|
| 1950 |
+
157,
|
| 1951 |
+
885,
|
| 1952 |
+
193
|
| 1953 |
+
],
|
| 1954 |
+
"page_idx": 11
|
| 1955 |
+
},
|
| 1956 |
+
{
|
| 1957 |
+
"type": "text",
|
| 1958 |
+
"text": "where $q$ denotes an encoded query, $k_{i}$ denotes $i$ -th key, $k_{+}$ is a key in the dictionary that matches $q$ , and $\\tau$ is a temperature hyperparameter.",
|
| 1959 |
+
"bbox": [
|
| 1960 |
+
84,
|
| 1961 |
+
200,
|
| 1962 |
+
885,
|
| 1963 |
+
232
|
| 1964 |
+
],
|
| 1965 |
+
"page_idx": 11
|
| 1966 |
+
},
|
| 1967 |
+
{
|
| 1968 |
+
"type": "text",
|
| 1969 |
+
"text": "As MoCo uses separated data augmentations and encoders to extract query and keys, $q$ and $k$ can be rewrite as follows.",
|
| 1970 |
+
"bbox": [
|
| 1971 |
+
84,
|
| 1972 |
+
239,
|
| 1973 |
+
866,
|
| 1974 |
+
253
|
| 1975 |
+
],
|
| 1976 |
+
"page_idx": 11
|
| 1977 |
+
},
|
| 1978 |
+
{
|
| 1979 |
+
"type": "equation",
|
| 1980 |
+
"text": "\n$$\nq = f _ {q} \\left(t _ {q} \\left(x _ {j}\\right)\\right) \\tag {A.2}\n$$\n",
|
| 1981 |
+
"text_format": "latex",
|
| 1982 |
+
"bbox": [
|
| 1983 |
+
437,
|
| 1984 |
+
265,
|
| 1985 |
+
885,
|
| 1986 |
+
281
|
| 1987 |
+
],
|
| 1988 |
+
"page_idx": 11
|
| 1989 |
+
},
|
| 1990 |
+
{
|
| 1991 |
+
"type": "equation",
|
| 1992 |
+
"text": "\n$$\nk _ {+} = f _ {k} \\left(t _ {k} \\left(x _ {j}\\right)\\right) \\tag {A.3}\n$$\n",
|
| 1993 |
+
"text_format": "latex",
|
| 1994 |
+
"bbox": [
|
| 1995 |
+
426,
|
| 1996 |
+
284,
|
| 1997 |
+
885,
|
| 1998 |
+
299
|
| 1999 |
+
],
|
| 2000 |
+
"page_idx": 11
|
| 2001 |
+
},
|
| 2002 |
+
{
|
| 2003 |
+
"type": "equation",
|
| 2004 |
+
"text": "\n$$\nk _ {i} = f _ {k} \\left(t _ {k} \\left(x _ {i}\\right)\\right) \\tag {A.4}\n$$\n",
|
| 2005 |
+
"text_format": "latex",
|
| 2006 |
+
"bbox": [
|
| 2007 |
+
431,
|
| 2008 |
+
303,
|
| 2009 |
+
885,
|
| 2010 |
+
319
|
| 2011 |
+
],
|
| 2012 |
+
"page_idx": 11
|
| 2013 |
+
},
|
| 2014 |
+
{
|
| 2015 |
+
"type": "text",
|
| 2016 |
+
"text": "where $f_{q}$ and $f_{k}$ denotes the query encoder and the key encoder, and $t_{q}$ and $t_{k}$ denotes data augmentations for query and key, respectively.",
|
| 2017 |
+
"bbox": [
|
| 2018 |
+
84,
|
| 2019 |
+
329,
|
| 2020 |
+
885,
|
| 2021 |
+
359
|
| 2022 |
+
],
|
| 2023 |
+
"page_idx": 11
|
| 2024 |
+
},
|
| 2025 |
+
{
|
| 2026 |
+
"type": "text",
|
| 2027 |
+
"text": "Finally, the back-propagation is blocked at the key encoder and only the query encoder is updated by gradient. To represent this, we update Eq. A.2 to Eq. A.5.",
|
| 2028 |
+
"bbox": [
|
| 2029 |
+
84,
|
| 2030 |
+
367,
|
| 2031 |
+
885,
|
| 2032 |
+
397
|
| 2033 |
+
],
|
| 2034 |
+
"page_idx": 11
|
| 2035 |
+
},
|
| 2036 |
+
{
|
| 2037 |
+
"type": "equation",
|
| 2038 |
+
"text": "\n$$\nq = f _ {q} \\left(t _ {q} \\left(x _ {j}\\right); w\\right) \\tag {A.5}\n$$\n",
|
| 2039 |
+
"text_format": "latex",
|
| 2040 |
+
"bbox": [
|
| 2041 |
+
423,
|
| 2042 |
+
398,
|
| 2043 |
+
885,
|
| 2044 |
+
414
|
| 2045 |
+
],
|
| 2046 |
+
"page_idx": 11
|
| 2047 |
+
},
|
| 2048 |
+
{
|
| 2049 |
+
"type": "text",
|
| 2050 |
+
"text": "Summarizing above, Eq. A.1 becomes as the follow.",
|
| 2051 |
+
"bbox": [
|
| 2052 |
+
84,
|
| 2053 |
+
426,
|
| 2054 |
+
431,
|
| 2055 |
+
441
|
| 2056 |
+
],
|
| 2057 |
+
"page_idx": 11
|
| 2058 |
+
},
|
| 2059 |
+
{
|
| 2060 |
+
"type": "equation",
|
| 2061 |
+
"text": "\n$$\nL _ {M o C o} = - \\log \\frac {\\exp \\left(f _ {q} \\left(t _ {q} \\left(x _ {j}\\right) ; w\\right) \\cdot f _ {k} \\left(t _ {k} \\left(x _ {j}\\right)\\right) / \\tau\\right)}{\\sum_ {i = 0} ^ {K} \\exp \\left(f _ {q} \\left(t _ {q} \\left(x _ {j}\\right); w\\right) \\cdot f _ {k} \\left(t _ {k} \\left(x _ {i}\\right)\\right) / \\tau\\right)} \\tag {A.6}\n$$\n",
|
| 2062 |
+
"text_format": "latex",
|
| 2063 |
+
"bbox": [
|
| 2064 |
+
292,
|
| 2065 |
+
450,
|
| 2066 |
+
885,
|
| 2067 |
+
487
|
| 2068 |
+
],
|
| 2069 |
+
"page_idx": 11
|
| 2070 |
+
},
|
| 2071 |
+
{
|
| 2072 |
+
"type": "text",
|
| 2073 |
+
"text": "By substituting $x, y$ , and $f$ in Eq. 1 using the followings, we show that MoCo maximizes the mutual information between latent features and input data.",
|
| 2074 |
+
"bbox": [
|
| 2075 |
+
84,
|
| 2076 |
+
503,
|
| 2077 |
+
885,
|
| 2078 |
+
532
|
| 2079 |
+
],
|
| 2080 |
+
"page_idx": 11
|
| 2081 |
+
},
|
| 2082 |
+
{
|
| 2083 |
+
"type": "equation",
|
| 2084 |
+
"text": "\n$$\nx _ {i} \\leftarrow f _ {q} \\left(t _ {q} \\left(x _ {i}\\right); w\\right) \\tag {A.7}\n$$\n",
|
| 2085 |
+
"text_format": "latex",
|
| 2086 |
+
"bbox": [
|
| 2087 |
+
426,
|
| 2088 |
+
545,
|
| 2089 |
+
885,
|
| 2090 |
+
561
|
| 2091 |
+
],
|
| 2092 |
+
"page_idx": 11
|
| 2093 |
+
},
|
| 2094 |
+
{
|
| 2095 |
+
"type": "equation",
|
| 2096 |
+
"text": "\n$$\ny _ {j} \\leftarrow x _ {j} \\tag {A.8}\n$$\n",
|
| 2097 |
+
"text_format": "latex",
|
| 2098 |
+
"bbox": [
|
| 2099 |
+
428,
|
| 2100 |
+
565,
|
| 2101 |
+
885,
|
| 2102 |
+
579
|
| 2103 |
+
],
|
| 2104 |
+
"page_idx": 11
|
| 2105 |
+
},
|
| 2106 |
+
{
|
| 2107 |
+
"type": "equation",
|
| 2108 |
+
"text": "\n$$\nf (x, y) \\leftarrow x \\cdot f _ {k} \\left(t _ {k} (y)\\right) / \\tau \\tag {A.9}\n$$\n",
|
| 2109 |
+
"text_format": "latex",
|
| 2110 |
+
"bbox": [
|
| 2111 |
+
395,
|
| 2112 |
+
583,
|
| 2113 |
+
885,
|
| 2114 |
+
598
|
| 2115 |
+
],
|
| 2116 |
+
"page_idx": 11
|
| 2117 |
+
},
|
| 2118 |
+
{
|
| 2119 |
+
"type": "text",
|
| 2120 |
+
"text": "In other words, MoCo loss is identical to using a stochastic gradient descent to find the optimal parameter $w^{*}$ that maximizes a lower bound of mutual information between latent features, $f_{q}(t_{q}(x);w)$ and input data $x$ .",
|
| 2121 |
+
"bbox": [
|
| 2122 |
+
84,
|
| 2123 |
+
616,
|
| 2124 |
+
885,
|
| 2125 |
+
647
|
| 2126 |
+
],
|
| 2127 |
+
"page_idx": 11
|
| 2128 |
+
},
|
| 2129 |
+
{
|
| 2130 |
+
"type": "text",
|
| 2131 |
+
"text": "A.2. Implementation Details",
|
| 2132 |
+
"text_level": 1,
|
| 2133 |
+
"bbox": [
|
| 2134 |
+
86,
|
| 2135 |
+
662,
|
| 2136 |
+
287,
|
| 2137 |
+
678
|
| 2138 |
+
],
|
| 2139 |
+
"page_idx": 11
|
| 2140 |
+
},
|
| 2141 |
+
{
|
| 2142 |
+
"type": "text",
|
| 2143 |
+
"text": "Table A.1 shows the teacher architectures, training settings, augmentation strategies, and hyperparameter choices used in the experiments. $\\gamma$ , $\\beta$ , and $\\alpha$ denote the weights used for $L_{cls}$ , $L_{GML}$ , and $L_{KD}$ , respectively. We follow the settings of previous papers (Cui et al., 2021; Zhu et al., 2022) with some exceptions.",
|
| 2144 |
+
"bbox": [
|
| 2145 |
+
84,
|
| 2146 |
+
686,
|
| 2147 |
+
885,
|
| 2148 |
+
733
|
| 2149 |
+
],
|
| 2150 |
+
"page_idx": 11
|
| 2151 |
+
},
|
| 2152 |
+
{
|
| 2153 |
+
"type": "text",
|
| 2154 |
+
"text": "Training a network for 400 epochs on ImageNet-LT leads to overfitting when $\\gamma = 1$ is used; reducing $\\gamma$ while increasing $\\beta$ alleviates the problem to improve the performance. Further, $L_{KD}$ considerably enhances the accuracy of CIFAR-LT experiments, but its effect becomes marginal when applied to ImageNet-LT or iNatualist experiments.",
|
| 2155 |
+
"bbox": [
|
| 2156 |
+
84,
|
| 2157 |
+
739,
|
| 2158 |
+
885,
|
| 2159 |
+
786
|
| 2160 |
+
],
|
| 2161 |
+
"page_idx": 11
|
| 2162 |
+
},
|
| 2163 |
+
{
|
| 2164 |
+
"type": "text",
|
| 2165 |
+
"text": "For experiments in Tables 4, 6, and 7, we follow the training settings and hyperparameter choices of baseline methods (Khosla et al., 2020; Tian et al., 2020; 2021). In the experiments in Table 6, the encoder network and classifier are trained separately for a fair comparison with SupCon (Khosla et al., 2020), whereas they are trained simultaneously in other experiments. The encoder network is trained for 1000 epochs using $L_{GML}$ . Subsequently, the classifier is trained for 100 epochs using $L_{cls}$ with the encoder parameters fixed.",
|
| 2166 |
+
"bbox": [
|
| 2167 |
+
84,
|
| 2168 |
+
792,
|
| 2169 |
+
885,
|
| 2170 |
+
868
|
| 2171 |
+
],
|
| 2172 |
+
"page_idx": 11
|
| 2173 |
+
},
|
| 2174 |
+
{
|
| 2175 |
+
"type": "text",
|
| 2176 |
+
"text": "Semantic segmentation experiments in Table 8 are implemented based on open-source codebase mmsegmentation (Contributors, 2020) and follow the training hyperparameters and data augmentation settings provided in the codebase. The auxiliary",
|
| 2177 |
+
"bbox": [
|
| 2178 |
+
84,
|
| 2179 |
+
875,
|
| 2180 |
+
885,
|
| 2181 |
+
906
|
| 2182 |
+
],
|
| 2183 |
+
"page_idx": 11
|
| 2184 |
+
},
|
| 2185 |
+
{
|
| 2186 |
+
"type": "header",
|
| 2187 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 2188 |
+
"bbox": [
|
| 2189 |
+
122,
|
| 2190 |
+
56,
|
| 2191 |
+
848,
|
| 2192 |
+
70
|
| 2193 |
+
],
|
| 2194 |
+
"page_idx": 11
|
| 2195 |
+
},
|
| 2196 |
+
{
|
| 2197 |
+
"type": "page_number",
|
| 2198 |
+
"text": "12",
|
| 2199 |
+
"bbox": [
|
| 2200 |
+
477,
|
| 2201 |
+
922,
|
| 2202 |
+
495,
|
| 2203 |
+
934
|
| 2204 |
+
],
|
| 2205 |
+
"page_idx": 11
|
| 2206 |
+
},
|
| 2207 |
+
{
|
| 2208 |
+
"type": "table",
|
| 2209 |
+
"img_path": "images/8c32891e7c7c5cee5dc4c177d5c89a4491f36a3c789f541269b4860a7526f190.jpg",
|
| 2210 |
+
"table_caption": [
|
| 2211 |
+
"Table A.1. Hyperparameter choice of ImageNet-LT, iNaturalist, and CIFAR-100-LT experiments."
|
| 2212 |
+
],
|
| 2213 |
+
"table_footnote": [],
|
| 2214 |
+
"table_body": "<table><tr><td></td><td>Arch_s</td><td>Arch_t</td><td>Epochs</td><td>MLP</td><td>k</td><td>km</td><td>Aug_cls</td><td>Aug_GML</td><td>τg</td><td>τs</td><td>γ</td><td>β</td><td>α</td></tr><tr><td>Table 1. (a)</td><td>X50</td><td>X101</td><td>90</td><td>(2048, 2048, 1024)</td><td>16384</td><td>2</td><td>Randaug</td><td>Simaug</td><td>0.07</td><td>1/30</td><td>1</td><td>1</td><td>0</td></tr><tr><td>Table 1. (b)</td><td>X50</td><td>X101</td><td>400</td><td>(2048, 2048, 1024)</td><td>16384</td><td>2</td><td>Randaug</td><td>Simaug</td><td>0.07</td><td>1/30</td><td>0.5</td><td>2</td><td>0</td></tr><tr><td>Table 2. (a)</td><td>R50</td><td>R152</td><td>100</td><td>(2048, 2048, 1024)</td><td>65536</td><td>2</td><td>Simaug</td><td>Simaug</td><td>0.1</td><td>1/30</td><td>1</td><td>1</td><td>0</td></tr><tr><td>Table 2. (b)</td><td>R50</td><td>R152</td><td>400</td><td>(2048, 2048, 1024)</td><td>65536</td><td>2</td><td>Simaug</td><td>Simaug</td><td>0.1</td><td>1/30</td><td>1</td><td>1</td><td>0</td></tr><tr><td>Table 3. (a)</td><td>R32</td><td>R56</td><td>200</td><td>(64, 64, 32)</td><td>4096</td><td>2</td><td>Autoaug</td><td>Autoaug</td><td>0.1</td><td>1/30</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Table 3. (b)</td><td>R32</td><td>R56</td><td>400</td><td>(64, 64, 32)</td><td>4096</td><td>2</td><td>Autoaug</td><td>Autoaug</td><td>0.1</td><td>1/30</td><td>1</td><td>1</td><td>1</td></tr></table>",
|
| 2215 |
+
"bbox": [
|
| 2216 |
+
119,
|
| 2217 |
+
107,
|
| 2218 |
+
848,
|
| 2219 |
+
183
|
| 2220 |
+
],
|
| 2221 |
+
"page_idx": 12
|
| 2222 |
+
},
|
| 2223 |
+
{
|
| 2224 |
+
"type": "text",
|
| 2225 |
+
"text": "loss of FCN (Long et al., 2015) is replaced with the cosine similarity classifier and trained using $L_{cls}$ . The segmentation head also is replaced with the cosine similarity classifier and trained using $L_{cls} + L_{GML}$ . The hyperparameter choice is $(k, k_m, \\tau_s, \\tau_g) = (8192, 27, 0.05, 0.07)$ .",
|
| 2226 |
+
"bbox": [
|
| 2227 |
+
83,
|
| 2228 |
+
208,
|
| 2229 |
+
887,
|
| 2230 |
+
255
|
| 2231 |
+
],
|
| 2232 |
+
"page_idx": 12
|
| 2233 |
+
},
|
| 2234 |
+
{
|
| 2235 |
+
"type": "header",
|
| 2236 |
+
"text": "Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels",
|
| 2237 |
+
"bbox": [
|
| 2238 |
+
124,
|
| 2239 |
+
56,
|
| 2240 |
+
848,
|
| 2241 |
+
70
|
| 2242 |
+
],
|
| 2243 |
+
"page_idx": 12
|
| 2244 |
+
},
|
| 2245 |
+
{
|
| 2246 |
+
"type": "page_number",
|
| 2247 |
+
"text": "13",
|
| 2248 |
+
"bbox": [
|
| 2249 |
+
477,
|
| 2250 |
+
922,
|
| 2251 |
+
495,
|
| 2252 |
+
934
|
| 2253 |
+
],
|
| 2254 |
+
"page_idx": 12
|
| 2255 |
+
}
|
| 2256 |
+
]
|
2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/0329bb0a-5594-4b52-b3f1-8587b4d92ea9_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/0329bb0a-5594-4b52-b3f1-8587b4d92ea9_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a06a1b450186bb508e8c57f51f8db9b73d2192dd75bcfa87dfa1c61e6dd6bb6
|
| 3 |
+
size 473619
|
2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/full.md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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels
|
| 2 |
+
|
| 3 |
+
Min-Kook Suh<sup>1</sup> Seung-Woo Seo<sup>1</sup>
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Although contrastive learning methods have shown prevailing performance on a variety of representation learning tasks, they encounter difficulty when the training dataset is long-tailed. Many researchers have combined contrastive learning and a logit adjustment technique to address this problem, but the combinations are done ad-hoc and a theoretical background has not yet been provided. The goal of this paper is to provide the background and further improve the performance. First, we show that the fundamental reason contrastive learning methods struggle with long-tailed tasks is that they try to maximize the mutual information between latent features and input data. As ground-truth labels are not considered in the maximization, they are not able to address imbalances between classes. Rather, we interpret the long-tailed recognition task as a mutual information maximization between latent features and ground-truth labels. This approach integrates contrastive learning and logit adjustment seamlessly to derive a loss function that shows state-of-the-art performance on long-tailed recognition benchmarks. It also demonstrates its efficacy in image segmentation tasks, verifying its versatility beyond image classification. Code is available at https://github.com/blueecdm/Long-tailed-recognition.
|
| 8 |
+
|
| 9 |
+
# 1. Introduction
|
| 10 |
+
|
| 11 |
+
A supervised classification task has been an active research topic for decades. However, its performance is still unsatisfactory when the dataset shows a long-tailed distribution, where a few classes, i.e., head classes, contain a major num
|
| 12 |
+
|
| 13 |
+
$^{1}$ Department of Electrical and Computer Engineering, Seoul National University, Seoul, South Korea. Correspondence to: MinKook Suh <bluecdm@snu.ac.kr>.
|
| 14 |
+
|
| 15 |
+
Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).
|
| 16 |
+
|
| 17 |
+
ber of samples while the remaining classes, i.e., tail classes, have only a small number of samples. The most straightforward remedy to this problem is to rebalance the training dataset through weighted sampling. However, it is a suboptimal strategy that may be detrimental to the accuracy of the head classes (Wang et al., 2017).
|
| 18 |
+
|
| 19 |
+
Recently, contrastive learning (Oord et al., 2018; Chen et al., 2020a; Khosla et al., 2020) is widely used in representation learning and showing state-of-the-art performance on various tasks. The contrastive learning framework learns representations by pushing latent features from the same sample closer and separating them from different samples. However, its performance degrades on long-tailed datasets as the samples are imbalanced (Cui et al., 2021). Therefore, several works have been conducted to adapt it to the long-tailed recognition tasks (Cui et al., 2021; Zhu et al., 2022) by combining it with logit adjustment techniques (Ren et al., 2020; Menon et al., 2021), which is another method to solve the long-tailed recognition task that modulates the prediction score of networks based on the appearance frequency of classes. Although previous methods empirically show that combining contrastive learning and logit adjustment boosts performance, they do not provide the theoretical meaning of the combination.
|
| 20 |
+
|
| 21 |
+
In this paper, we describe the theoretical meaning of the combination and provide an improved method for combining contrastive learning and logit adjustment. We find that the performance of previous contrastive learning methods degrade on long-tailed datasets because they aim to maximize the mutual information (MI) between the latent features and input data. These approaches do not consider the imbalance of label distribution, as the ground-truth label is not involved in the maximization. Instead, we propose maximizing the MI between latent features and ground-truth labels, allowing the consideration of label distribution.
|
| 22 |
+
|
| 23 |
+
By replacing the input data term with the ground-truth label term, we derive a general loss function that encompasses various other methods. The derived loss function includes a likelihood of latent feature term and a prior of classes term, and different ways of modeling these terms lead to different previous methods. For example, the softmax cross-entropy loss for a balanced dataset and the logit adjustment
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1. We address the long-tailed recognition by maximizing the mutual information of latent features, $x$ , and ground-truth labels, $y$ . We solve the maximization problem by dividing it into two terms: an unnormalized likelihood term, $s(x|y)$ , and a logit-adjustment term to compensate for label frequency, $\eta_y$ . $\eta_y$ is a value that depends on the frequency of the label, and $s(x|y)$ is estimated using a neural network. The proposed loss is achieved by estimating $s(x|y)$ with Gaussian kernels using latent features of other samples.
|
| 27 |
+
|
| 28 |
+
term for an imbalanced dataset (Ren et al., 2020) can be derived by modeling the likelihood as an isotropic Gaussian. Supervised contrastive loss (Khosla et al., 2020) can be derived under the assumption of a balanced training dataset by estimating the likelihood using a sampling-based kernel density estimation with Gaussian kernels.
|
| 29 |
+
|
| 30 |
+
By removing the assumption of a balanced dataset, we derive the proposed loss function that seamlessly integrates the contrastive learning and logit adjustment. Since the kernel density estimation results in a Gaussian mixture likelihood, we refer to the loss as Gaussian Mixture Likelihood (GML) loss. We also provide an efficient method for modeling the Gaussian mixture likelihood, as shown in Fig. 1. We use contrast samples to estimate the likelihood. Similar to Momentum Contrast (MoCo) (He et al., 2020), we use queues to store contrast samples. However, because a long-tailed dataset is being handled, tail classes do not have sufficient samples to create the Gaussian mixture. To resolve this problem, we use multiple class-wise queues rather than a single queue of MoCo. However, in the case of tail classes, the update frequencies of contrast samples are significantly longer. As a result, old samples of tail classes' queues are generated by highly outdated encoders. Therefore, we use class-wise queues along with a teacher-student strategy. Unlike a momentum encoder used in MoCo, we use a pre-trained teacher to generate contrast samples.
|
| 31 |
+
|
| 32 |
+
We evaluate the proposed method on various long-tailed recognition datasets: ImageNet-LT (Liu et al., 2019), iNaturalist 2018 (Van Horn et al., 2018), and CIFAR-LT (Cui et al., 2019); the proposed method surpasses all previous long-tailed recognition methods. In addition, as the proposed method is related to supervised contrastive learning and knowledge distillation, we compare our method with them on both balanced and imbalanced datasets. Unsurprisingly, our method shows superior performance to them on imbalanced datasets, exhibiting comparable performance on
|
| 33 |
+
|
| 34 |
+
balanced datasets. Finally, we evaluate our method on a commonly used semantic segmentation dataset ADE20K (Zhou et al., 2017), which also contains imbalanced pixel labels. Simply replacing the cross-entropy loss with the proposed loss also boosts the performance, indicating the proposed framework can be extended beyond a classification task.
|
| 35 |
+
|
| 36 |
+
Our main contributions are summarized as follows.
|
| 37 |
+
|
| 38 |
+
- We show that the fundamental limitation of contrastive learning methods on long-tailed tasks comes from directly maximizing the MI between latent features and input data. Instead, we propose to tackle the long-tailed recognition by MI maximization between latent features and ground-truth labels.
|
| 39 |
+
- While previous methods have combined contrastive learning and the logit adjustment without investigating a theoretical background, we find that contrastive learning implies a Gaussian mixture likelihood and the logit adjustment is derived from the prior of classes.
|
| 40 |
+
- We propose an efficient way to model the Gaussian mixture likelihood using a teacher-student framework that demonstrates its superiority in various long-tailed recognition tasks.
|
| 41 |
+
|
| 42 |
+
# 2. Related Work
|
| 43 |
+
|
| 44 |
+
# 2.1. Long-Tailed Recognition
|
| 45 |
+
|
| 46 |
+
Rebalancing Datasets. Since the most straightforward approach to the long-tailed recognition problem is rebalancing the dataset during training, several early works (Chawla et al., 2002; Japkowicz & Stephen, 2002; Drummond et al., 2003; Han et al., 2005; He & Garcia, 2009; Mikolov et al., 2013) have focused on rebalancing approaches. However, Byrd & Lipton (2019) found that the effect of rebalancing diminishes on overparameterized deep neural networks given sufficiently long training epochs.
|
| 47 |
+
|
| 48 |
+
Normalized Classifier. Networks trained on long-tailed datasets tend to have biased classifier weights (Alshammari et al., 2022); this problem can be alleviated by normalizing the weights of the classification layer. Kang et al. (2020) proposed to normalize the weights by decoupling the representation learning and classification. They first trained the network jointly using an instance-based sampling strategy. Then, they retrained the classifier only using a class-balanced sampling strategy. Gidaris & Komodakis (2018) proposed the use of a cosine similarity classifier instead of a dot-product classifier. It bypasses the biased weights problem by only considering the relative angle. Accordingly, we adopt the cosine similarity as the classifier of our network.
|
| 49 |
+
|
| 50 |
+
Logit Adjustment. Another approach to the long-tailed recognition problem is to modulate the logit values. Interestingly, Ren et al. (2020) and Menon et al. (2021) derived similar results using different approaches. Ren et al. (2020) showed that the softmax loss is a biased estimator and proposed a Balanced Softmax loss; Menon et al. (2021) proposed a post-hoc logit adjustment and a logit-adjusted softmax cross-entropy loss. Both works show that adding a logit-adjustment term proportional to the logarithm of label frequency is essential to the long-tailed recognition. In accordance with their results, many studies (Cui et al., 2021; Feng et al., 2021; Hong et al., 2021; Zhu et al., 2022) have included logit adjustment as a part of their methods.
|
| 51 |
+
|
| 52 |
+
# 2.2. Contrastive Learning
|
| 53 |
+
|
| 54 |
+
Cui et al. (2021) found that the performance of supervised contrastive loss (Khosla et al., 2020) significantly degrades when it is applied to a long-tailed dataset. Therefore, they proposed Parametric Contrastive learning (PaCo), which rebalances the contrast samples by adding parametric class-wise learnable centers in the samples. To integrate the logit-adjustment technique into their method, the authors added the adjustment term to the center learning. Further, Zhu et al. (2022) proposed Balanced Contrastive Learning (BCL), which utilizes the number of contrasts of each class in a mini-batch to balance the gradient contribution of classes. To integrate the logit-adjustment technique, they used a weighted sum of the logit-adjustment loss and their loss.
|
| 55 |
+
|
| 56 |
+
# 3. Proposed Method
|
| 57 |
+
|
| 58 |
+
In this section, we describe our approach to handle long-tailed recognition based on MI. Because the MI is intractable, we use InfoNCE loss (Oord et al., 2018) to maximize its lower bound. We adopt the notations of Poole et al. (2019) to express InfoNCE loss.
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
I (X; Y) \geq \mathbb {E} \left[ \frac {1}{K} \sum_ {i = 1} ^ {K} \log \frac {\exp f \left(x _ {i} , y _ {i}\right)}{\frac {1}{K} \sum_ {j = 1} ^ {K} \exp f \left(x _ {i} , y _ {j}\right)} \right] \tag {1}
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
where the expectation is taken over subsets of a dataset and $K$ denotes the size of the subset. Equality holds when $f(x,y) = \log p(x|y) + c(x)$ and $K\to \infty$ where $c(x)$ is a function that only depends on $x$ .
|
| 65 |
+
|
| 66 |
+
# 3.1. Contrastive Learning as MI Maximization between Latent Features and Input Data
|
| 67 |
+
|
| 68 |
+
From Eq. 1, we can recover the loss functions of contrastive learning methods (Chen et al., 2020b; He et al., 2020) by substituting $x_{i}$ with the query feature, $f_{q}(t_{q}(x_{i}),w)$ , and $y_{j}$ with the input image, $x_{j}$ ; it shows that contrastive learning methods maximize the MI between latent features and input data. Detailed proof is shown in Appendix A.1.
|
| 69 |
+
|
| 70 |
+
Since ground-truth label term is not included in the maximization, they are prone to the imbalance of label frequency. Supervised contrastive learning (Khosla et al., 2020) tries to modify the loss function to include the ground-truth label term, but it is still based on the MI maximization between latent features and input data.
|
| 71 |
+
|
| 72 |
+
# 3.2. Long-Tailed Recognition by MI Maximization between Latent Features and Ground-Truth Labels
|
| 73 |
+
|
| 74 |
+
To enable the label frequency considered in the MI maximization process, we formulate the long-tailed recognition problem as a maximum MI problem of latent features and ground-truth labels. However, replacing the input data term with the ground-truth label term results in a loss function that is not contrastive learning. In this section, we describe procedures to recover the contrastive loss.
|
| 75 |
+
|
| 76 |
+
Logit Adjustment. First, we substitute $X$ in Eq. 1 with the set of latent features and $Y$ with the set of ground-truth labels to represent the MI maximization between latent features and ground-truth labels.
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\begin{array}{l} \mathbb {E} _ {i} \log \frac {\exp f (x _ {i} , y _ {i})}{\mathbb {E} _ {j} \exp f (x _ {i} , y _ {j})} = \mathbb {E} _ {i} \log \frac {\exp f (x _ {i} , y _ {i})}{\sum_ {c \in C} \exp f (x _ {i} , c) p (c)} \\ = \mathbb {E} _ {i} \log \frac {\exp \left(f \left(x _ {i} , y _ {i}\right) + \eta_ {y _ {i}}\right)}{\sum_ {c \in C} \exp \left(f \left(x _ {i} , c\right) + \eta_ {c}\right)} - \eta_ {y _ {i}} \tag {2} \\ \end{array}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
We realize the above term by increasing $K$ to the size of the entire training dataset. Here, $x_{i}$ and $y_{i}$ denote the latent feature and ground-truth label of the $i$ -th sample, respectively. $C$ denotes the set of all classes and $\eta_c = \log p(c)$ denotes the logit-adjustment term, which is the logarithm of the appearance frequency of a class.
|
| 83 |
+
|
| 84 |
+
Eq. 2 is a general template and various previous methods can be derived by different modeling of the likelihood and prior. For simplicity, we define $s(x|y) = \exp f(x,y)$ and use $s$ to denote the unnormalized likelihood of latent features. As an example, we derive a softmax cross-entropy loss with the logit-adjustment term by defining $s(x|y) = \exp (w_y\cdot x + b_y)$ , a dot-product classifier.
|
| 85 |
+
|
| 86 |
+
Gaussian Mixture Likelihood Loss. The inequality on Eq. 1 becomes tighter as $f$ approaches $\log p(x|y)$ , hence, we choose to estimate $s$ using sampling-based kernel density estimation with Gaussian kernels. This estimation leads to a Gaussian mixture likelihood, where the centers of the Gaussian mixtures are the contrast samples.
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
s (x \mid y) = \exp f (x, y) = \frac {1}{\| Z _ {y} \|} \sum_ {z _ {y} \in Z _ {y}} \exp \left(z _ {x} \cdot z _ {y} / \tau_ {g}\right) \tag {3}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $z_{x}$ denotes the L2 normalized query feature of $x$ , $Z_{y}$ denotes a set of L2 normalized contrast features of class $y$ , and $\tau_{g}$ denotes a temperature parameter for GML loss, which is quadratically proportional to the variance of the Gaussian mixture. The subscript $i$ of $x_{i}$ and $y_{i}$ is omitted for simplicity. Gaussian mixture is represented using dot product instead of a quadratic term to maintain consistency with previous contrastive losses. It does not modify the meaning of Gaussian mixture, as L2 normalization is applied to both the query and contrast features. Specifically,
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
- \left\| z _ {x} - z _ {y} \right\| _ {2} ^ {2} / \left(2 \tau_ {g}\right) = z _ {x} \cdot z _ {y} / \tau_ {g} - 1 / \tau_ {g} \tag {4}
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
and the last constant term cancels out in the following equation.
|
| 99 |
+
|
| 100 |
+
Note that we do not estimate the centers of Gaussian mixtures, but simply use the latent features of the contrast encoder as centers. Therefore, the training burden is not increased by this procedure and remains almost the same as that of previous contrastive learning methods.
|
| 101 |
+
|
| 102 |
+
By modeling $s$ using the Gaussian mixture, we derive the GML loss which seamlessly integrates the contrastive learning and the logit compensation. Substituting $f$ of Eq. 2 using Eq. 3 derives the proposed loss $L_{GML}$ .
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
- L _ {G M L} = \tag {5}
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\log \frac {\exp \left[ \log \frac {1}{\| Z _ {y} \|} \sum_ {z _ {y} \in Z _ {y}} \exp (z _ {x} \cdot z _ {y} / \tau_ {g}) + \eta_ {y} \right]}{\sum_ {c \in C} \exp \left[ \log \frac {1}{\| Z _ {c} \|} \sum_ {z _ {c} \in Z _ {c}} \exp (z _ {x} \cdot z _ {c} / \tau_ {g}) + \eta_ {c} \right]}
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
# 3.3. Training with GML Loss
|
| 113 |
+
|
| 114 |
+
Class-wise Queues for Contrast Samples. The denominator of $L_{GML}$ requires at least one contrast sample for each class. However, the strategy of MoCo (He et al., 2020) does not guarantee any minimum number of samples, because it uses a queue of randomly sampled contrast samples. Therefore, we use multiple queues with different lengths. Each class has one assigned queue, and its length is proportional to the frequency of the class plus a predefined constant.
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
\left\| Z _ {c} \right\| = k _ {m} + \left(k - k _ {m} \times \| C \|\right) \times p (c) \tag {6}
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
where $k_{m}$ denotes the minimum length of the queue and $k$ denotes the total number of contrast samples.
|
| 121 |
+
|
| 122 |
+
Teacher-Student Strategy. Maintaining class-wise queues causes another problem. MoCo (He et al., 2020) uses a momentum encoder to generate contrast samples, and they are stored in a queue. Therefore, old samples generated using an outdated encoder are replaced with new samples. On the other hand, we use multiple class-wise queues and their update frequency is proportional to the ratio of the classes in the training dataset. Therefore, queues of tail classes have excessively long update frequencies and old samples of their queues are generated by highly outdated encoders. To overcome this problem, we adopt a teacher-student strategy and use a pre-trained teacher encoder to generate contrast samples.
|
| 123 |
+
|
| 124 |
+
Training Procedure. Usually, a contrastive loss is used to train a backbone network, and a classifier layer is trained separately after training the backbone network. However, in the supervised setting, the classifier layer can be trained simultaneously with the backbone network. Therefore, we attach a cosine similarity classifier to the network and train them simultaneously. The classifier is trained without contrastive loss using the following loss function.
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
- L _ {c l s} = \log \frac {\exp \left(m _ {x} \cdot m _ {y} / \tau_ {s} + \eta_ {y}\right)}{\sum_ {c \in C} \exp \left(m _ {x} \cdot m _ {c} / \tau_ {s} + \eta_ {c}\right)} \tag {7}
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
where $m_{x}$ denotes L2 normalized $x$ , $m_{c}$ denotes L2 normalized weight at class $c$ of the classifier, and $\tau_{s}$ denotes a temperature hyperparameter for softmax cross-entropy loss. In contrast to the Gaussian mixture setting, $m_{c}$ is a parameter that needs to be trained.
|
| 131 |
+
|
| 132 |
+
In addition, we use MLP encoders followed by L2 normalization for contrast samples $z_{x}$ and $z_{y}$ , similar to previous contrastive losses (Chen et al., 2020a;c), while a simple L2 normalization is used for the cosine similarity classifier.
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
z _ {x} = \frac {\operatorname {M L P} (x)}{\| \operatorname {M L P} (x) \|}, m _ {x} = \frac {x}{\| x \|} \tag {8}
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
In summary, our training procedure is as follows. First, we estimate the ratio of classes in the training dataset to calculate $\eta_c$ . Then, we train a teacher network with a cosine similarity classifier with $L_{cls}$ without contrastive loss. Finally, we train a student network and a cosine similarity classifier simultaneously with $L_{GML}$ and $L_{cls}$ .
|
| 139 |
+
|
| 140 |
+
Trainable Temperature. Unlike previous contrastive learning methods (Chen et al., 2020a; He et al., 2020; Khosla et al., 2020; Tian et al., 2020; Cui et al., 2021; Zhu et al., 2022), we train $\tau_{g}$ along with the network parameters to reduce the burden of hyperparameter tuning. However, $L_{GML}$ is not suitable for training $\tau_{g}$ . If we estimate the variance of the Gaussian mixture when the contrast centers include the query feature, the optimal variance is too small, and the Gaussian mixture becomes spiky. Therefore, we exclude contrast features extracted from the same sample to
|
| 141 |
+
|
| 142 |
+
the query when training $\tau_{g}$ . For simplicity, we use a fixed $\tau_{g}$ throughout most of the experiments in this work. However, we show in Sec. 4.9 that $\tau_{g}$ can be trained, and it boosts the network performance.
|
| 143 |
+
|
| 144 |
+
By contrast, we find training $\tau_{s}$ results in a very low optimal value, which causes two negative effects. First, it makes $L_{cls}$ dominate the training procedure, and second, it significantly degrades the accuracy of tail classes. Therefore, we leave $\tau_{s}$ as a hyperparameter.
|
| 145 |
+
|
| 146 |
+
# 3.4. Relation with Other Methods
|
| 147 |
+
|
| 148 |
+
As mentioned in Sec. 3.2, we can derive previous methods by adopting different likelihood and prior models.
|
| 149 |
+
|
| 150 |
+
Balanced Softmax. By modeling $s(x|y)$ as an isotropic Gaussian instead of a Gaussian mixture, we can derive the balanced softmax with a cosine similarity classifier.
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
s (x \mid y) = \exp f (x, y) = \exp \left(\frac {- \left(m _ {x} - m _ {y}\right) ^ {2}}{2 \sigma^ {2}}\right) \tag {9}
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+
where $m_y$ and $\sigma$ denote the center and variance of the Gaussian model, respectively.
|
| 157 |
+
|
| 158 |
+
Because we apply L2 normalization to $x$ and $y$ , substituting $f$ in Eq. 2 results in $L_{cls}$ , which is the cosine similarity classifier with logit adjustment.
|
| 159 |
+
|
| 160 |
+
Supervised Contrastive Loss for Balanced Dataset. Supervised contrastive loss (Khosla et al., 2020) can be derived by assuming the training dataset is balanced. A balanced training dataset gives all $\eta_c$ s and $\| Z_c\|$ s equal. Therefore, the proposed GML loss for balanced datasets becomes as follows:
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
\begin{array}{l} - L _ {G M L} ^ {(b a l a n c e d)} = \log \frac {\sum_ {z _ {y} \in Z _ {y}} \exp \left(z _ {x} \cdot z _ {y} / \tau_ {g}\right)}{\sum_ {c \in C} \sum_ {z _ {c} \in Z _ {c}} \exp \left(z _ {x} \cdot z _ {c} / \tau_ {g}\right)} \tag {10} \\ \geq \sum_ {z _ {y} \in Z _ {y}} \log \frac {\exp \left(z _ {x} \cdot z _ {y} / \tau_ {g}\right)}{\sum_ {z \in Z} \exp \left(z _ {x} \cdot z / \tau_ {g}\right)} \\ \end{array}
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
where $Z = \bigcup_{c}Z_{c}$ denotes the set of all contrast samples. By applying Jensen's inequality, we achieve supervised contrastive loss.
|
| 167 |
+
|
| 168 |
+
Visual-Linguistic Representation Learning. Visual-Linguistic Long-Tailed Recognition (VL-LTR) (Tian et al., 2021) utilizes a text sentences dataset and a pre-trained visual-linguistic model to address the problem of insufficient training samples of tail classes. Similarly, our method can be used to connect visual and text representations. In particular, we use text features as centers of the Gaussian mixture instead of contrast features and the pre-trained visual-linguistic model to extract the text features.
|
| 169 |
+
|
| 170 |
+
# 4. Experiments
|
| 171 |
+
|
| 172 |
+
# 4.1. Datasets
|
| 173 |
+
|
| 174 |
+
ImageNet-LT. Liu et al. (2019) constructed ImageNet-LT by sampling ImageNet-2012 (Russakovsky et al., 2015) following a Pareto distribution with $\alpha = 6$ . The training set of ImageNet-LT contains $115.8k$ images of 1000 classes, ranging from a maximum of 1280 images to a minimum of 5 images per class. Meanwhile, the test set is balanced such that head classes and tail classes have the same impact on the accuracy evaluation. The test set of ImageNet-LT contains $50k$ images, with 50 images per class.
|
| 175 |
+
|
| 176 |
+
iNaturalist 2018. iNaturalist 2018 (Van Horn et al., 2018) is a large-scale image classification dataset containing 8142 classes. The goal of iNaturalist 2018 is to push state-of-the-art image recognition for "in the wild" data of highly imbalanced and fine-grained categories. The training set of iNaturalist 2018 contains $437.5k$ images of 8142 classes, ranging from a maximum of 1000 images to a minimum of 2 images per class. The test set of iNaturalist 2018 is also balanced, similar to ImageNet-LT.
|
| 177 |
+
|
| 178 |
+
CIFAR-10-LT and CIFAR-100-LT. Cui et al. (2019) constructed long-tailed versions of CIFAR (Krizhevsky, 2009) by reducing the number of training samples according to an exponential function. CIFAR-LT is categorized by its imbalance factor, which is the ratio of training samples for the largest class to that for the smallest.
|
| 179 |
+
|
| 180 |
+
ADE20K. ADE20K (Zhou et al., 2017) is a widely used image semantic segmentation dataset. The evaluation is conducted on 150 classes, where the most common class comprises more than $15\%$ of total training pixels, while the rarest one comprises only $0.02\%$ .
|
| 181 |
+
|
| 182 |
+
# 4.2. Implementation Details
|
| 183 |
+
|
| 184 |
+
We adopt training hyperparameter settings from previous long-tailed recognition papers (Cui et al., 2021; Tian et al., 2021; Zhu et al., 2022) with some modifications. For ImageNet-LT, we train the proposed method using an SGD optimizer whose learning rate is initially set to 0.05 and decays by a cosine scheduler. Input images are resized to $224 \times 224$ , and a batch size of 128 is used. The weight decay and momentum are set to $5 \times 10^{-4}$ and 0.9, respectively. The MLP of the contrast encoder has one hidden layer of 2048 channels and its output layer has 1024 channels. The total number of contrast samples $(k)$ is 16384, and the minimum number of contrast samples per class $(k_{m})$ is 2. Randaugment (Cubuk et al., 2020) is applied for the classifier training and Simaugment (Chen et al., 2020a) for the contrastive learning. Finally, $\tau_{s} = 1 / 30$ is used throughout all experiments.
|
| 185 |
+
|
| 186 |
+
For iNaturalist 2018, we use a batch size of 128, input
|
| 187 |
+
|
| 188 |
+
Table 1. Performance comparison on the ImageNet-LT dataset.
|
| 189 |
+
|
| 190 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Epochs</td><td colspan="4">Class frequency</td></tr><tr><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>Focal Loss</td><td>90</td><td>43.7</td><td>64.3</td><td>37.1</td><td>8.2</td></tr><tr><td>τ-norm</td><td>90</td><td>49.4</td><td>59.1</td><td>46.9</td><td>30.7</td></tr><tr><td>LWS</td><td>90</td><td>49.9</td><td>60.2</td><td>47.2</td><td>30.3</td></tr><tr><td>BALMS</td><td>90</td><td>51.4</td><td>62.2</td><td>48.8</td><td>29.8</td></tr><tr><td>LADE</td><td>90</td><td>51.9</td><td>62.3</td><td>49.3</td><td>31.2</td></tr><tr><td>DisAlign</td><td>90</td><td>53.4</td><td>62.7</td><td>52.1</td><td>31.4</td></tr><tr><td>BCL</td><td>90</td><td>56.7</td><td>67.2</td><td>53.9</td><td>36.5</td></tr><tr><td>Proposed</td><td>90</td><td>58.3</td><td>68.7</td><td>55.7</td><td>38.6</td></tr><tr><td>PaCo</td><td>400</td><td>58.2</td><td>68.0</td><td>56.4</td><td>37.2</td></tr><tr><td>Proposed</td><td>400</td><td>58.8</td><td>68.2</td><td>56.7</td><td>39.5</td></tr></table>
|
| 191 |
+
|
| 192 |
+
Table 2. Performance comparison on the iNaturalist 2018 dataset.
|
| 193 |
+
|
| 194 |
+
<table><tr><td>Method</td><td>Epochs</td><td>Accuracy</td></tr><tr><td>τ-norm</td><td>100</td><td>65.6</td></tr><tr><td>Hybrid-SC</td><td>100</td><td>66.7</td></tr><tr><td>SSP</td><td>100</td><td>68.1</td></tr><tr><td>KCL</td><td>100</td><td>68.6</td></tr><tr><td>DisAlign</td><td>100</td><td>69.5</td></tr><tr><td>RIDE (2 experts)</td><td>100</td><td>71.4</td></tr><tr><td>BCL</td><td>100</td><td>71.8</td></tr><tr><td>Proposed</td><td>100</td><td>73.1</td></tr><tr><td>RIDE (2 experts)</td><td>400</td><td>69.5</td></tr><tr><td>τ-norm</td><td>400</td><td>71.5</td></tr><tr><td>Balanced Softmax</td><td>400</td><td>71.8</td></tr><tr><td>PaCo</td><td>400</td><td>73.2</td></tr><tr><td>Proposed</td><td>400</td><td>74.5</td></tr></table>
|
| 195 |
+
|
| 196 |
+
image size of $224 \times 224$ , and weight decay of $2 \times 10^{-4}$ . The learning rate is set to 0.02 with the cosine scheduler. $k$ and $k_{m}$ are set to 65536 and 2, respectively. For CIFAR-LT, we use the training epochs of 200 and 400, a batch size of 64, and a weight decay of $5 \times 10^{-4}$ . $k$ and $k_{m}$ are set to 4096 and 2, respectively. The learning rate is set to 0.05 and decays by a factor of 10 at 160 and 180 epochs (320 and 360 epochs if the training epochs is 400). We describe more about implementation details in Appendix A.2.
|
| 197 |
+
|
| 198 |
+
# 4.3. Long-Tailed Recognition
|
| 199 |
+
|
| 200 |
+
Comparison on ImageNet-LT. We first compare the performance of the proposed method with existing state-of-the-art long-tailed recognition methods on the ImageNet-LT dataset. We compare performances of the same backbone ResNeXt-50 and same number of training epochs for a fair comparison. Following the previous categorization of classes (Liu et al., 2019), we also evaluate the accuracy on subsets: many-shot (over 100 training samples), medium-shot (20-100 training samples), and few-shot (under 20 training samples).
|
| 201 |
+
|
| 202 |
+
Table 1 presents the experimental results on the ImageNet
|
| 203 |
+
|
| 204 |
+
Table 3. Performance comparison on the CIFAR-100-LT dataset with different imbalance factors.
|
| 205 |
+
|
| 206 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Epochs</td><td colspan="3">Imbalance factor</td></tr><tr><td>100</td><td>50</td><td>10</td></tr><tr><td>Focal loss</td><td>200</td><td>38.4</td><td>44.3</td><td>55.8</td></tr><tr><td>CB-Focal</td><td>200</td><td>39.6</td><td>45.2</td><td>58.0</td></tr><tr><td>LDAM-DRW</td><td>200</td><td>42.0</td><td>46.6</td><td>58.7</td></tr><tr><td>BBN</td><td>200</td><td>42.6</td><td>47.0</td><td>59.1</td></tr><tr><td>SSP</td><td>200</td><td>43.4</td><td>47.1</td><td>58.9</td></tr><tr><td>Casual model</td><td>200</td><td>44.1</td><td>50.3</td><td>59.6</td></tr><tr><td>Hybrid-SC</td><td>200</td><td>46.7</td><td>51.8</td><td>63.1</td></tr><tr><td>MetaSAug-LDAM</td><td>200</td><td>48.0</td><td>52.3</td><td>61.3</td></tr><tr><td>ResLT</td><td>200</td><td>48.2</td><td>52.7</td><td>62.0</td></tr><tr><td>BCL</td><td>200</td><td>51.9</td><td>56.6</td><td>64.9</td></tr><tr><td>Proposed</td><td>200</td><td>53.0</td><td>57.6</td><td>65.7</td></tr><tr><td>MiSLAS</td><td>400</td><td>47.0</td><td>52.3</td><td>63.2</td></tr><tr><td>Balanced Softmax</td><td>400</td><td>50.8</td><td>54.2</td><td>63.0</td></tr><tr><td>PaCo</td><td>400</td><td>52.0</td><td>56.0</td><td>64.2</td></tr><tr><td>Proposed</td><td>400</td><td>54.0</td><td>58.1</td><td>67.0</td></tr></table>
|
| 207 |
+
|
| 208 |
+
LT dataset. The proposed method shows the best overall performance, outperforming previous state-of-the-art methods significantly. The gain is maximized on tail classes proving the efficacy of the proposed method on the long-tailed recognition task.
|
| 209 |
+
|
| 210 |
+
Comparison on iNaturalist 2018 dataset. We also evaluate the performance of the proposed method on the iNaturalist 2018, which is a large-scale highly imbalanced image classification dataset. For a fair comparison with previous methods, we use ResNet-50 as backbone. Table 2 shows the corresponding experimental result. The proposed method show significant performance improvements over all previous methods, including contrastive learning-based methods.
|
| 211 |
+
|
| 212 |
+
Comparison on CIFAR-100-LT dataset. Subsequently, we conduct extensive experiments on the CIFAR-100-LT dataset with different imbalance factors. We adopt imbalance factors of 100, 50, and 10, which are commonly used imbalance factors for evaluating the performance on CIFAR-LT dataset. A large imbalance factor implies a highly imbalanced dataset. In this experiment, we compare the performances of ResNet-32 backbones.
|
| 213 |
+
|
| 214 |
+
Table 3 presents the comparison results on the CIFAR-100-LT dataset. The proposed method is robust to imbalance factors and consistently outperform previous long-tailed recognition methods on various imbalance factors by significant margins. Indeed, the robustness is also verified in experiments that compare our method with the supervised contrastive learning and knowledge distillation methods on balanced datasets. The comparisons are shown in Secs. 4.6 and 4.7.
|
| 215 |
+
|
| 216 |
+
Comparison with Visual-Linguistic Models. Visual-
|
| 217 |
+
|
| 218 |
+
Table 4. Performance comparison with visual-linguistic models. In this experiment, the backbone networks are initialized with CLIP (Radford et al., 2021) pre-trained weights.
|
| 219 |
+
ImageNet-LT dataset:
|
| 220 |
+
|
| 221 |
+
<table><tr><td>Method</td><td>Backbone</td><td>Accuracy</td></tr><tr><td>NCM</td><td>ResNet-50</td><td>49.2</td></tr><tr><td>cRT</td><td>ResNet-50</td><td>50.8</td></tr><tr><td>τ-norm</td><td>ResNet-50</td><td>51.2</td></tr><tr><td>LWS</td><td>ResNet-50</td><td>51.5</td></tr><tr><td>Zero-Shot CLIP</td><td>ResNet-50</td><td>59.8</td></tr><tr><td>VL-LTR</td><td>ResNet-50</td><td>70.1</td></tr><tr><td>Proposed</td><td>ResNet-50</td><td>70.9</td></tr><tr><td>VL-LTR</td><td>ViT-B</td><td>77.2</td></tr><tr><td>Proposed</td><td>ViT-B</td><td>78.0</td></tr></table>
|
| 222 |
+
|
| 223 |
+
iNaturalist 2018 dataset:
|
| 224 |
+
|
| 225 |
+
<table><tr><td>Method</td><td>Backbone</td><td>Accuracy</td></tr><tr><td>VL-LTR</td><td>ViT-B</td><td>81.0</td></tr><tr><td>Proposed</td><td>ViT-B</td><td>82.1</td></tr></table>
|
| 226 |
+
|
| 227 |
+
Table 5. Ablation study on the effect of each component.
|
| 228 |
+
|
| 229 |
+
<table><tr><td>Loss type</td><td>Teacher-student</td><td>Accuracy</td></tr><tr><td>Cross-entropy</td><td>X</td><td>55.4</td></tr><tr><td>BCL</td><td>X</td><td>56.7</td></tr><tr><td>BCL</td><td>✓</td><td>57.1 (+0.4)</td></tr><tr><td>Proposed</td><td>X</td><td>56.0</td></tr><tr><td>Proposed</td><td>✓</td><td>58.3 (+2.3)</td></tr></table>
|
| 230 |
+
|
| 231 |
+
linguistic models utilize training samples from text modality to enhance the performance of long-tailed image classification tasks. We compare our method with visual-linguistic models by extending it to learn the visual-linguistic representation as described in Section 3.4.
|
| 232 |
+
|
| 233 |
+
Table 4 presents the comparison results with visual-linguistic models. We follow the training settings of VL-LTR (Tian et al., 2021) and use a larger input size for the iNaturalist 2018 dataset. An input image size of $384 \times 384$ is used only for the iNaturalist 2018 dataset in this experiment. The proposed method successfully connects two different modalities, even when the dataset is imbalanced. Thus, it exhibits the best performance regardless of network architecture or dataset.
|
| 234 |
+
|
| 235 |
+
# 4.4. Ablation Study
|
| 236 |
+
|
| 237 |
+
An ablation study is conducted on the ImageNet-LT dataset to investigate the effect of the components of the proposed method. Table 5 reveals that there is a performance gain when the proposed loss is used. However, the gain is insufficient because the contrast samples of tail classes are generated by highly outdated encoders as described in Sec. 3.3. Adopting a teacher-student framework solves the aforementioned problem.
|
| 238 |
+
|
| 239 |
+
Table 6. Effect of Teacher's Performance on Student.
|
| 240 |
+
|
| 241 |
+
<table><tr><td colspan="2">Teacher</td><td colspan="2">Student</td></tr><tr><td>Backbone</td><td>Accuracy</td><td>Backbone</td><td>Accuracy</td></tr><tr><td>ResNet-34</td><td>50.3</td><td>ResNeXt-50</td><td>58.0</td></tr><tr><td>ResNet-50</td><td>55.2</td><td>ResNeXt-50</td><td>58.1</td></tr><tr><td>ResNeXt-50</td><td>56.4</td><td>ResNeXt-50</td><td>58.1</td></tr><tr><td>ResNeXt-101</td><td>57.9</td><td>ResNeXt-50</td><td>58.3</td></tr></table>
|
| 242 |
+
|
| 243 |
+
tioned problem, resulting in a significant gain in accuracy. To separate the effect of teacher-student framework from that of the proposed loss function, we measure the effect of teacher-student on BCL (Zhu et al., 2022), which is another contrastive learning-based method for long-tailed recognition. Since BCL does not employ queues to store contrast samples, it does not suffer from the outdated encoder problem. The teacher-student framework does not significantly improve the performance on BCL, proving that the impact of knowledge distillation is not significant. Meanwhile, it resolves the outdated encoder problem of the proposed method and leads to significant performance improvement.
|
| 244 |
+
|
| 245 |
+
# 4.5. Relation with Accuracy of Teacher
|
| 246 |
+
|
| 247 |
+
To measure the effect of the accuracy of teacher and find the best one, we modulate the performance of teachers by adopting different sizes of backbone architecture. The chosen backbone architectures are ResNet-34, ResNet-50, ResNeXt-50, and ResNeXt-101, and they are trained on ImageNet-LT dataset for 90 epochs. All students use the same backbone architecture ResNeXt-50 and are also trained for 90 epochs. Table 6 shows the effect of the performance of the teacher on the student. It is observed that the accuracy teacher dramatically decreases as the backbone is changed to ResNet-34, but the accuracy of the student remains stable. Moreover, the accuracy of the student surpasses that of the teacher. We find that a teacher with better performance leads to a better student, but the impact is marginal; a sufficient result can be achieved by using the same backbone architecture for both teacher and student. This result coincides with the finding of the ablation study, which indicates that the impact of knowledge distillation is not significant. Since a low-accuracy teacher can still successfully resolve the outdated encoder problem, the proposed method shows outstanding performance regardless teacher's accuracy.
|
| 248 |
+
|
| 249 |
+
# 4.6. Comparison with Supervised Contrastive Learning
|
| 250 |
+
|
| 251 |
+
Table 7 presents the performance comparison of the proposed method with supervised contrastive learning (Khosla et al., 2020). Experiments are conducted using networks with ResNet-50 backbone on CIFAR-10-LT dataset with different imbalance factors. The proposed method shows
|
| 252 |
+
|
| 253 |
+
Table 7. Performance comparison with supervised contrastive learning on the CIFAR-10-LT dataset with different imbalance factors.
|
| 254 |
+
|
| 255 |
+
<table><tr><td>Imb. factor</td><td>Cross-Entropy</td><td>SupCon</td><td>Proposed</td></tr><tr><td>1</td><td>94.8</td><td>96.0</td><td>95.9</td></tr><tr><td>10</td><td>88.4</td><td>94.0</td><td>94.5</td></tr><tr><td>50</td><td>69.1</td><td>88.1</td><td>90.6</td></tr><tr><td>100</td><td>64.1</td><td>82.7</td><td>86.7</td></tr></table>
|
| 256 |
+
|
| 257 |
+
Table 8. Performance comparison with knowledge distillation methods.
|
| 258 |
+
Balanced dataset:
|
| 259 |
+
|
| 260 |
+
<table><tr><td>Method</td><td>CIFAR-100</td><td>ImageNet</td></tr><tr><td>None</td><td>69.1</td><td>69.8</td></tr><tr><td>KD</td><td>70.7</td><td>70.7</td></tr><tr><td>CRD</td><td>71.2</td><td>71.2</td></tr><tr><td>Proposed</td><td>71.4</td><td>71.1</td></tr></table>
|
| 261 |
+
|
| 262 |
+
Imbalanced dataset:
|
| 263 |
+
|
| 264 |
+
<table><tr><td>Method</td><td>CIFAR-100-LT</td><td>ImageNet-LT</td></tr><tr><td>None</td><td>48.6</td><td>56.3</td></tr><tr><td>KD</td><td>49.9</td><td>56.5</td></tr><tr><td>CRD</td><td>50.6</td><td>57.2</td></tr><tr><td>Proposed</td><td>51.2</td><td>58.3</td></tr></table>
|
| 265 |
+
|
| 266 |
+
the best accuracy with different imbalance factors, and the gap between previous methods increases as the imbalance factor increased. In addition, the proposed method shows a performance comparable with that of supervised contrastive learning when the dataset is balanced.
|
| 267 |
+
|
| 268 |
+
# 4.7. Comparison with Knowledge Distillation
|
| 269 |
+
|
| 270 |
+
Because we adopt a teacher-student framework to train the proposed method, comparing it with previous knowledge distillation methods is relevant. We select two knowledge distillation methods for the comparison: KD (Hinton et al.), which does not utilize contrastive learning, and CRD (Tian et al., 2020), which utilizes contrastive learning. For the CIFAR-100 and CIFAR-100-LT datasets, we train a student network with ResNet-20 backbone using a teacher network with ResNet-56 backbone for 240 epochs. We use a ResNet-18 student and a ResNet-34 teacher for ImageNet experiments, and a ResNeXt-50 student and a ResNeXt-101 teacher for ImageNet-LT experiments. For both ImageNet experiments, the networks are trained for 90 epochs.
|
| 271 |
+
|
| 272 |
+
Table 8 presents the performance comparison with knowledge distillation methods. The proposed method achieves the best performance on both balanced and imbalanced datasets. Knowledge distillation methods designed for balanced datasets show better accuracy than vanilla training on imbalanced datasets as well. This is because they pro
|
| 273 |
+
|
| 274 |
+
Table 9. Performance comparison on the ADE20K semantic segmentation dataset.
|
| 275 |
+
|
| 276 |
+
<table><tr><td>Method</td><td>mIoU</td><td>mAcc</td></tr><tr><td>Cross-Entropy</td><td>36.1</td><td>45.4</td></tr><tr><td>Proposed (α = 0.2)</td><td>38.1</td><td>51.4</td></tr><tr><td>Proposed (α = 1.0)</td><td>31.7</td><td>59.8</td></tr></table>
|
| 277 |
+
|
| 278 |
+
vide measures to transfer the knowledge learned from head classes to tail classes, mitigating the lack of training samples. However, their gains are not the best because they do not consider the frequency of classes.
|
| 279 |
+
|
| 280 |
+
# 4.8. Semantic Segmentation Task
|
| 281 |
+
|
| 282 |
+
To prove the robustness of the proposed method, we replace the cross-entropy loss of semantic segmentation with the proposed method and measure the performance change. In this experiment, we measure the effect of the loss functions, not that of networks. Therefore, we perform the comparison using a widely used network FCN (Long et al., 2015) with ResNet-50 backbone. The evaluation is conducted on ADE20K (Zhou et al., 2017) using $160k$ training steps.
|
| 283 |
+
|
| 284 |
+
Table 9 presents the performance comparison of losses. mIoU refers to the mean intersection-over-union (IoU) and mAcc refers to the mean accuracy (Acc), where the mean is taken over classes. The proposed method achieves the best mIoU or mAcc depending on the hyperparameter $\alpha$ , which modulates the level of logit adjustment as given by Eq. 11.
|
| 285 |
+
|
| 286 |
+
$$
|
| 287 |
+
- L _ {G M L} ^ {(\alpha)} = \tag {11}
|
| 288 |
+
$$
|
| 289 |
+
|
| 290 |
+
$$
|
| 291 |
+
\log \frac {\exp \left[ \log \frac {1}{\| Z _ {y} \|} \sum_ {z _ {y} \in Z _ {y}} \exp \left(z _ {x} \cdot z _ {y} / \tau_ {g}\right) + \alpha \eta_ {y} \right]}{\sum_ {c \in C} \exp \left[ \log \frac {1}{\| Z _ {c} \|} \sum_ {z _ {c} \in Z _ {c}} \exp \left(z _ {x} \cdot z _ {c} / \tau_ {g}\right) + \alpha \eta_ {c} \right]}
|
| 292 |
+
$$
|
| 293 |
+
|
| 294 |
+
$$
|
| 295 |
+
\mathrm {I o U} = \mathrm {T P} / (\mathrm {T P} + \mathrm {F N} + \mathrm {F P}) \tag {12}
|
| 296 |
+
$$
|
| 297 |
+
|
| 298 |
+
$$
|
| 299 |
+
\mathrm {A c c} = \mathrm {T P} / (\mathrm {T P} + \mathrm {F N}) \tag {13}
|
| 300 |
+
$$
|
| 301 |
+
|
| 302 |
+
Eqs. 12-13 give the definitions of IoU and Acc, where TP, FN, and FP denote true positive, false negative, and false positive, respectively. mAcc is the same metric as the balanced evaluation setting used in classification tasks, and $\alpha = 1.0$ gives the best mAcc. However, as FPs arise from other classes, mIoU is less sensitive to the accuracy of tail classes than mAcc. Therefore, the best mIoU is achieved by boosting the accuracy of head classes at the expense of tail classes, which is achieved by decreasing $\alpha$ . The effect of $\alpha$ on mIoU and mAcc is shown in Fig. 2.
|
| 303 |
+
|
| 304 |
+
# 4.9. Trainable Temperature Analysis
|
| 305 |
+
|
| 306 |
+
We examine the difference between a trainable $\tau_{g}$ and a fixed one. Fig. 3 shows the change in $\tau_{g}$ during training. $\tau_{g}$
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure 2. Effect of $\alpha$ on semantic segmentation performance.
|
| 310 |
+
|
| 311 |
+

|
| 312 |
+
Figure 3. Change in $\tau_{g}$ during training.
|
| 313 |
+
|
| 314 |
+
becomes smaller as the encoder network converges. The final value is approximately 0.05, which is similar to the hyperparameter choice of other methods (He et al., 2020; Tian et al., 2020; Zhu et al., 2022), i.e., 0.07. Furthermore, training $\tau_{g}$ results in slightly better performance, boosting the accuracy from 58.2 to 58.3.
|
| 315 |
+
|
| 316 |
+
# 5. Conclusion
|
| 317 |
+
|
| 318 |
+
In this paper, we show that the fundamental problem of contrastive learning methods on long-tailed recognition comes from maximizing the mutual information between latent features and input data. To overcome this limitation, we interpret the long-tailed recognition as the mutual information maximization between latent features and ground-truth labels. This approach seamlessly integrates contrastive learning and the logit adjustment technique. It also verifies that contrastive learning implies the use of a Gaussian mixture likelihood and the logit adjustment is derived from the prior, while previous methods have combined them without understanding the theoretical background. Further, we propose an efficient way of modeling the Gaussian mixture likelihood using a teacher-student framework.
|
| 319 |
+
|
| 320 |
+
Extensive experiments on both long-tailed datasets and balanced datasets verify the superiority of the proposed method, which marks state-of-the-art performance on various benchmarks. Finally, as real-world data often show a long-tailed distribution, the proposed method can be applied to other tasks as well. As an example, we conduct experiments on a semantic segmentation dataset. The proposed method also showed a large performance gain on semantic segmentation, demonstrating its versatility.
|
| 321 |
+
|
| 322 |
+
# Acknowledgements
|
| 323 |
+
|
| 324 |
+
This research was supported by the Challengable Future Defense Technology Research and Development Program through the Agency For Defense Development(ADD) funded by the Defense Acquisition Program Administration(DAPA) in 2023(No.915027201), the Institute of New Media and Communications, the Institute of Engineering Research, and the Automation and Systems Research Institute at Seoul National University.
|
| 325 |
+
|
| 326 |
+
# References
|
| 327 |
+
|
| 328 |
+
Alshammari, S., Wang, Y.-X., Ramanan, D., and Kong, S. Long-tailed recognition via weight balancing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6897-6907, 2022.
|
| 329 |
+
Byrd, J. and Lipton, Z. What is the effect of importance weighting in deep learning? In International Conference on Machine Learning, pp. 872-881. PMLR, 2019.
|
| 330 |
+
Chawla, N. V., Bowyer, K. W., Hall, L. O., and Kegelmeyer, W. P. Smote: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16:321-357, 2002.
|
| 331 |
+
Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pp. 1597-1607. PMLR, 2020a.
|
| 332 |
+
Chen, T., Kornblith, S., Swersky, K., Norouzi, M., and Hinton, G. E. Big self-supervised models are strong semi-supervised learners. Advances in neural information processing systems, 33:22243-22255, 2020b.
|
| 333 |
+
Chen, X., Fan, H., Girshick, R., and He, K. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020c.
|
| 334 |
+
Contributors, M. MMSegmentation: Openmmlab semantic segmentation toolbox and benchmark. https://github.com/open-mmlab/mmsegmentation, 2020.
|
| 335 |
+
Cubuk, E. D., Zoph, B., Shlens, J., and Le, Q. V. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition workshops, pp. 702-703, 2020.
|
| 336 |
+
Cui, J., Zhong, Z., Liu, S., Yu, B., and Jia, J. Parametric contrastive learning. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 715-724, 2021.
|
| 337 |
+
|
| 338 |
+
Cui, Y., Jia, M., Lin, T.-Y., Song, Y., and Belongie, S. Class-balanced loss based on effective number of samples. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9268-9277, 2019.
|
| 339 |
+
Drummond, C., Holte, R. C., et al. C4. 5, class imbalance, and cost sensitivity: why under-sampling beats over-sampling. In Workshop on learning from imbalanced datasets II, volume 11, pp. 1-8. CiteSeer, 2003.
|
| 340 |
+
Feng, C., Zhong, Y., and Huang, W. Exploring classification equilibrium in long-tailed object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3417-3426, 2021.
|
| 341 |
+
Gidaris, S. and Komodakis, N. Dynamic few-shot visual learning without forgetting. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4367-4375, 2018.
|
| 342 |
+
Han, H., Wang, W.-Y., and Mao, B.-H. Borderline-smote: a new over-sampling method in imbalanced data sets learning. In International conference on intelligent computing, pp. 878-887. Springer, 2005.
|
| 343 |
+
He, H. and Garcia, E. A. Learning from imbalanced data. IEEE Transactions on knowledge and data engineering, 21(9):1263-1284, 2009.
|
| 344 |
+
He, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9729-9738, 2020.
|
| 345 |
+
Hinton, G., Vinyals, O., Dean, J., et al. Distilling the knowledge in a neural network.
|
| 346 |
+
Hong, Y., Han, S., Choi, K., Seo, S., Kim, B., and Chang, B. Disentangling label distribution for long-tailed visual recognition. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6626-6636, 2021.
|
| 347 |
+
Japkowicz, N. and Stephen, S. The class imbalance problem: A systematic study. Intelligent data analysis, 6(5):429-449, 2002.
|
| 348 |
+
Kang, B., Xie, S., Rohrbach, M., Yan, Z., Gordo, A., Feng, J., and Kalantidis, Y. Decoupling representation and classifier for long-tailed recognition. In International Conference on Learning Representations, 2020.
|
| 349 |
+
Khosla, P., Teterwak, P., Wang, C., Sarna, A., Tian, Y., Isola, P., Maschinot, A., Liu, C., and Krishnan, D. Supervised contrastive learning. Advances in Neural Information Processing Systems, 33:18661-18673, 2020.
|
| 350 |
+
|
| 351 |
+
Krizhevsky, A. Learning multiple layers of features from tiny images. 2009.
|
| 352 |
+
Liu, Z., Miao, Z., Zhan, X., Wang, J., Gong, B., and Yu, S. X. Large-scale long-tailed recognition in an open world. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2537-2546, 2019.
|
| 353 |
+
Long, J., Shelhamer, E., and Darrell, T. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431-3440, 2015.
|
| 354 |
+
Menon, A. K., Jayasumana, S., Rawat, A. S., Jain, H., Veit, A., and Kumar, S. Long-tail learning via logit adjustment. In International Conference on Learning Representations, 2021.
|
| 355 |
+
Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S., and Dean, J. Distributed representations of words and phrases and their compositionality. Advances in neural information processing systems, 26, 2013.
|
| 356 |
+
Oord, A. v. d., Li, Y., and Vinyals, O. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 357 |
+
Poole, B., Ozair, S., Van Den Oord, A., Alemi, A., and Tucker, G. On variational bounds of mutual information. In International Conference on Machine Learning, pp. 5171-5180. PMLR, 2019.
|
| 358 |
+
Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pp. 8748-8763. PMLR, 2021.
|
| 359 |
+
Ren, J., Yu, C., Ma, X., Zhao, H., Yi, S., et al. Balanced meta-softmax for long-tailed visual recognition. Advances in neural information processing systems, 33: 4175-4186, 2020.
|
| 360 |
+
Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3): 211-252, 2015.
|
| 361 |
+
Tian, C., Wang, W., Zhu, X., Wang, X., Dai, J., and Qiao, Y. Vl-ltr: Learning class-wise visual-linguistic representation for long-tailed visual recognition. arXiv preprint arXiv:2111.13579, 2021.
|
| 362 |
+
Tian, Y., Krishnan, D., and Isola, P. Contrastive representation distillation. In International Conference on Learning Representations, 2020.
|
| 363 |
+
|
| 364 |
+
Van Horn, G., Mac Aodha, O., Song, Y., Cui, Y., Sun, C., Shepard, A., Adam, H., Perona, P., and Belongie, S. The inaturalist species classification and detection dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8769-8778, 2018.
|
| 365 |
+
Wang, Y.-X., Ramanan, D., and Hebert, M. Learning to model the tail. Advances in neural information processing systems, 30, 2017.
|
| 366 |
+
Zhou, B., Zhao, H., Puig, X., Fidler, S., Barriuso, A., and Torralba, A. Scene parsing through ade20k dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 633-641, 2017.
|
| 367 |
+
Zhu, J., Wang, Z., Chen, J., Chen, Y.-P. P., and Jiang, Y.-G. Balanced contrastive learning for long-tailed visual recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6908-6917, 2022.
|
| 368 |
+
|
| 369 |
+
# A. Appendix
|
| 370 |
+
|
| 371 |
+
# A.1. Contrastive Learning as MI Maximization between Latent Features and Input Data
|
| 372 |
+
|
| 373 |
+
The loss function of MoCo (He et al., 2020) is written as follows.
|
| 374 |
+
|
| 375 |
+
$$
|
| 376 |
+
L _ {M o C o} = - \log \frac {\exp \left(q \cdot k _ {+} / \tau\right)}{\sum_ {i = 0} ^ {K} \exp \left(q \cdot k _ {i} / \tau\right)} \tag {A.1}
|
| 377 |
+
$$
|
| 378 |
+
|
| 379 |
+
where $q$ denotes an encoded query, $k_{i}$ denotes $i$ -th key, $k_{+}$ is a key in the dictionary that matches $q$ , and $\tau$ is a temperature hyperparameter.
|
| 380 |
+
|
| 381 |
+
As MoCo uses separated data augmentations and encoders to extract query and keys, $q$ and $k$ can be rewrite as follows.
|
| 382 |
+
|
| 383 |
+
$$
|
| 384 |
+
q = f _ {q} \left(t _ {q} \left(x _ {j}\right)\right) \tag {A.2}
|
| 385 |
+
$$
|
| 386 |
+
|
| 387 |
+
$$
|
| 388 |
+
k _ {+} = f _ {k} \left(t _ {k} \left(x _ {j}\right)\right) \tag {A.3}
|
| 389 |
+
$$
|
| 390 |
+
|
| 391 |
+
$$
|
| 392 |
+
k _ {i} = f _ {k} \left(t _ {k} \left(x _ {i}\right)\right) \tag {A.4}
|
| 393 |
+
$$
|
| 394 |
+
|
| 395 |
+
where $f_{q}$ and $f_{k}$ denotes the query encoder and the key encoder, and $t_{q}$ and $t_{k}$ denotes data augmentations for query and key, respectively.
|
| 396 |
+
|
| 397 |
+
Finally, the back-propagation is blocked at the key encoder and only the query encoder is updated by gradient. To represent this, we update Eq. A.2 to Eq. A.5.
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
q = f _ {q} \left(t _ {q} \left(x _ {j}\right); w\right) \tag {A.5}
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
Summarizing above, Eq. A.1 becomes as the follow.
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
L _ {M o C o} = - \log \frac {\exp \left(f _ {q} \left(t _ {q} \left(x _ {j}\right) ; w\right) \cdot f _ {k} \left(t _ {k} \left(x _ {j}\right)\right) / \tau\right)}{\sum_ {i = 0} ^ {K} \exp \left(f _ {q} \left(t _ {q} \left(x _ {j}\right); w\right) \cdot f _ {k} \left(t _ {k} \left(x _ {i}\right)\right) / \tau\right)} \tag {A.6}
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
By substituting $x, y$ , and $f$ in Eq. 1 using the followings, we show that MoCo maximizes the mutual information between latent features and input data.
|
| 410 |
+
|
| 411 |
+
$$
|
| 412 |
+
x _ {i} \leftarrow f _ {q} \left(t _ {q} \left(x _ {i}\right); w\right) \tag {A.7}
|
| 413 |
+
$$
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
y _ {j} \leftarrow x _ {j} \tag {A.8}
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
$$
|
| 420 |
+
f (x, y) \leftarrow x \cdot f _ {k} \left(t _ {k} (y)\right) / \tau \tag {A.9}
|
| 421 |
+
$$
|
| 422 |
+
|
| 423 |
+
In other words, MoCo loss is identical to using a stochastic gradient descent to find the optimal parameter $w^{*}$ that maximizes a lower bound of mutual information between latent features, $f_{q}(t_{q}(x);w)$ and input data $x$ .
|
| 424 |
+
|
| 425 |
+
# A.2. Implementation Details
|
| 426 |
+
|
| 427 |
+
Table A.1 shows the teacher architectures, training settings, augmentation strategies, and hyperparameter choices used in the experiments. $\gamma$ , $\beta$ , and $\alpha$ denote the weights used for $L_{cls}$ , $L_{GML}$ , and $L_{KD}$ , respectively. We follow the settings of previous papers (Cui et al., 2021; Zhu et al., 2022) with some exceptions.
|
| 428 |
+
|
| 429 |
+
Training a network for 400 epochs on ImageNet-LT leads to overfitting when $\gamma = 1$ is used; reducing $\gamma$ while increasing $\beta$ alleviates the problem to improve the performance. Further, $L_{KD}$ considerably enhances the accuracy of CIFAR-LT experiments, but its effect becomes marginal when applied to ImageNet-LT or iNatualist experiments.
|
| 430 |
+
|
| 431 |
+
For experiments in Tables 4, 6, and 7, we follow the training settings and hyperparameter choices of baseline methods (Khosla et al., 2020; Tian et al., 2020; 2021). In the experiments in Table 6, the encoder network and classifier are trained separately for a fair comparison with SupCon (Khosla et al., 2020), whereas they are trained simultaneously in other experiments. The encoder network is trained for 1000 epochs using $L_{GML}$ . Subsequently, the classifier is trained for 100 epochs using $L_{cls}$ with the encoder parameters fixed.
|
| 432 |
+
|
| 433 |
+
Semantic segmentation experiments in Table 8 are implemented based on open-source codebase mmsegmentation (Contributors, 2020) and follow the training hyperparameters and data augmentation settings provided in the codebase. The auxiliary
|
| 434 |
+
|
| 435 |
+
Table A.1. Hyperparameter choice of ImageNet-LT, iNaturalist, and CIFAR-100-LT experiments.
|
| 436 |
+
|
| 437 |
+
<table><tr><td></td><td>Arch_s</td><td>Arch_t</td><td>Epochs</td><td>MLP</td><td>k</td><td>km</td><td>Aug_cls</td><td>Aug_GML</td><td>τg</td><td>τs</td><td>γ</td><td>β</td><td>α</td></tr><tr><td>Table 1. (a)</td><td>X50</td><td>X101</td><td>90</td><td>(2048, 2048, 1024)</td><td>16384</td><td>2</td><td>Randaug</td><td>Simaug</td><td>0.07</td><td>1/30</td><td>1</td><td>1</td><td>0</td></tr><tr><td>Table 1. (b)</td><td>X50</td><td>X101</td><td>400</td><td>(2048, 2048, 1024)</td><td>16384</td><td>2</td><td>Randaug</td><td>Simaug</td><td>0.07</td><td>1/30</td><td>0.5</td><td>2</td><td>0</td></tr><tr><td>Table 2. (a)</td><td>R50</td><td>R152</td><td>100</td><td>(2048, 2048, 1024)</td><td>65536</td><td>2</td><td>Simaug</td><td>Simaug</td><td>0.1</td><td>1/30</td><td>1</td><td>1</td><td>0</td></tr><tr><td>Table 2. (b)</td><td>R50</td><td>R152</td><td>400</td><td>(2048, 2048, 1024)</td><td>65536</td><td>2</td><td>Simaug</td><td>Simaug</td><td>0.1</td><td>1/30</td><td>1</td><td>1</td><td>0</td></tr><tr><td>Table 3. (a)</td><td>R32</td><td>R56</td><td>200</td><td>(64, 64, 32)</td><td>4096</td><td>2</td><td>Autoaug</td><td>Autoaug</td><td>0.1</td><td>1/30</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Table 3. (b)</td><td>R32</td><td>R56</td><td>400</td><td>(64, 64, 32)</td><td>4096</td><td>2</td><td>Autoaug</td><td>Autoaug</td><td>0.1</td><td>1/30</td><td>1</td><td>1</td><td>1</td></tr></table>
|
| 438 |
+
|
| 439 |
+
loss of FCN (Long et al., 2015) is replaced with the cosine similarity classifier and trained using $L_{cls}$ . The segmentation head also is replaced with the cosine similarity classifier and trained using $L_{cls} + L_{GML}$ . The hyperparameter choice is $(k, k_m, \tau_s, \tau_g) = (8192, 27, 0.05, 0.07)$ .
|
2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2eea346ce8f9a597951cb9b3d9785d4cf12b6acf9123d5e6ddcc54c44d49383
|
| 3 |
+
size 569390
|
2023/Long-Tailed Recognition by Mutual Information Maximization between Latent Features and Ground-Truth Labels/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Long-Term Rhythmic Video Soundtracker/aff3b3bc-3329-4910-aa7c-87e775bbaa9c_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Long-Term Rhythmic Video Soundtracker/aff3b3bc-3329-4910-aa7c-87e775bbaa9c_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Long-Term Rhythmic Video Soundtracker/aff3b3bc-3329-4910-aa7c-87e775bbaa9c_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f1a0be33f378313711ea23ecc8f88a19a7273523047526bd1f2e0658ddb58f4
|
| 3 |
+
size 3267851
|
2023/Long-Term Rhythmic Video Soundtracker/full.md
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Jiashuo Yu<sup>1</sup> Yaohui Wang<sup>1</sup> Xinyuan Chen<sup>1</sup> Xiao Sun<sup>1</sup> Yu Qiao<sup>1</sup>
|
| 2 |
+
|
| 3 |
+
# Abstract
|
| 4 |
+
|
| 5 |
+
We consider the problem of generating musical soundtracks in sync with rhythmic visual cues. Most existing works rely on pre-defined music representations, leading to the incompetence of generative flexibility and complexity. Other methods directly generating video-conditioned waveforms suffer from limited scenarios, short lengths, and unstable generation quality. To this end, we present Long-Term Rhythmic Video Soundtracker (LORIS), a novel framework to synthesize long-term conditional waveforms. Specifically, our framework consists of a latent conditional diffusion probabilistic model to perform waveform synthesis. Furthermore, a series of context-aware conditioning encoders are proposed to take temporal information into consideration for a long-term generation. Notably, we extend our model's applicability from dances to multiple sports scenarios such as floor exercise and figure skating. To perform comprehensive evaluations, we establish a benchmark for rhythmic video soundtracks including the pre-processed dataset, improved evaluation metrics, and robust generative baselines. Extensive experiments show that our model generates long-term soundtracks with state-of-the-art musical quality and rhythmic correspondence. Codes are available at https://github.com/OpenGVLab/LORIS.
|
| 6 |
+
|
| 7 |
+
# 1. Introduction
|
| 8 |
+
|
| 9 |
+
Automatic music generation has always been regarded as an iconic step towards a creative AI-generated content system. Continuous efforts (Dhariwal et al., 2020; Pasini & Schluter, 2022; Caillon & Esling, 2021; Kumar et al., 2019; Huang et al., 2018; von Rütte et al., 2022; Roberts et al., 2018; Ren et al., 2020; Dong et al., 2022; Mittal et al., 2021)
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
Figure 1. Overview of the approach. We tackle the task of generating long-term soundtracks based on given rhythmic videos. The LORIS framework is first proposed to generate long-term rhythm-correlated waveforms. We then establish a novel benchmark, including a large-scale dataset varying from dancing to sports and a set of improved metrics for long-term soundtracks.
|
| 13 |
+
|
| 14 |
+
have been made to drive machines interactively generating melodious music steered by given conditionings such as genre, tempo, and style. In this paper, we work on a tightly-coupled conditioning scenario, that is, video-conditioned music generation (a.k.a. video soundtracks) which is more challenging than other conditional music generation tasks due to its cross-modality and temporal-correlated nature.
|
| 15 |
+
|
| 16 |
+
Rhythmic video soundtracks require the model to consider the intrinsic correlations between human movements and music rhythms, and further leverage such temporal alignments as guidance for a conditional generation. To date in the literature, some works (Gan et al., 2020; Di et al., 2021; Su et al., 2020a;b; 2021) investigate cross-modality soundtracks by using pre-defined symbolic musical representations such as MIDI, REMI, and piano-roll that can be autoregressively generated. However, this kind of representation is not expressive enough to cover the diverse range of sounds we hear in typical soundtracks, which hinders the model from synthesizing complex and diverse music. Recently, some advances (Zhu et al., 2022a;b) directly generate waveforms in a non-autoregressive manner, yet these works heavily rely on the computationally-expensive pre-trained music encoder (Dhariwal et al., 2020), thereby resulting in the short-length $(2\sim 6s)$ and low-quality consequences. Moreover, owing to the insufficiency of paired music-video data, video soundtracks are limited to the dancing scenarios, which severely restrains the model's generalizability for
|
| 17 |
+
|
| 18 |
+
downstream applications.
|
| 19 |
+
|
| 20 |
+
In this paper, we introduce LORIS, the Long-Term Rhythmic Video Soundtracker to efficiently synthesize high-quality waveforms. At the heart of our model lies a latent conditional diffusion model where multiple conditionings (e.g., RGB, motions, genre) are hierarchically infused into the diffusion procedure. Specifically, we extract visual rhythms based on the cadent movement of human motions, then introduce the Hawkes Process (Hawkes, 1971; Mei & Eisner, 2017) on the visual rhythms to take temporal context into consideration. Besides, we also model the temporal relationship by adding a Bi-LSTM (Hochreiter & Schmidhuber, 1997) over the RGB embedding. These visual and motion features are conditioned via a cross-modal attention block. For the music generation part, we adopt a latent diffusion model (LDM) to encode the input waveforms into the latent feature spaces, then add and remove the Gaussian noise to/from the compressed features according to a discrete T-step schedule (Karras et al., 2022).
|
| 21 |
+
|
| 22 |
+
We also establish a comprehensive benchmark to facilitate the exploration of the rhythmic video soundtrack task. First, we build a large-scale dataset based on existing dancing and sports datasets to provide 86.43h long-term, high-quality raw videos with corresponding 2D poses, RGB features, and ameliorated audio waveforms. Next, we show the incapability of existing short-length music metrics in assessing long-term video soundtracks and propose an improved version. Finally, we conduct experiments on the established benchmark to fully evaluate LORIS on music quality and rhythmic correspondence. We show that our model, surpassing the existing methods on all metrics, can play the role of a strong baseline for the following works. In conclusion, our main contributions are three-fold:
|
| 23 |
+
|
| 24 |
+
- We are the first to propose a context-aware conditional diffusion framework to perform long-term video sound-track generation on complex rhythmic scenarios.
|
| 25 |
+
- We propose a robust benchmark, including a large-scale rhythmic video soundtrack dataset, a set of improved evaluation metrics, and a carefully-designed baseline for the subsequent research.
|
| 26 |
+
- Extensive experiments demonstrate that our framework is capable of generating long-term, visual-correlated musical waveforms, which benefits the creation of the musical art community.
|
| 27 |
+
|
| 28 |
+
# 2. Related Work
|
| 29 |
+
|
| 30 |
+
Uni-modal Music Generation. The family of uni-modal music generation embraces two branches. The first is in favor of using pre-defined music representations for editable music generation. Some methods (Huang et al., 2018;
|
| 31 |
+
|
| 32 |
+
Huang & Yang, 2020; Ren et al., 2020; Dong et al., 2022; von Rütte et al., 2022; Su et al., 2020a) focus on transformer-based (Vaswani et al., 2017) autoregressive models, while other advances utilize generative models such as VAE (Brunner et al., 2018; Roberts et al., 2018), GAN (Dong et al., 2018), and DDPM (Hawthorne et al., 2022) for the fast and conditional music synthesis. The other line of work tries to directly generate musical waveforms with less explicit constraints. WaveNet (Oord et al., 2016) first shows the feasibility of autoregressively generating audio waveforms. RAVE (Caillon & Esling, 2021) and Jukebox (Dhariwal et al., 2020) leverage the variational autoencoder to perform high-quality audio synthesis. Some GAN-based models (Kumar et al., 2019; Pasini & Schlüter, 2022) also manifest promising performance on conditional music generation.
|
| 33 |
+
|
| 34 |
+
Cross-Modal Music Generation. To create more flexible music compositions, cross-modality generation has been studied to synthesize music correlated with inter-modality conditionings, e.g. images-to-music generation (Zhang et al., 2022; Sheffer & Adi, 2022) and text-based music generation (Yang et al., 2022; Kreuk et al., 2022; Schneider et al., 2023; Agostinelli et al., 2023; Huang et al., 2023). These tasks usually rely on the correspondence of overall styles, while do not require fine-grained temporal alignments. More recently, several advances try to extend image-to-music generation to videos, the multi-frame scenario which needs the correlation of visual movements and musical melodies. Though some MIDI-based works (Gan et al., 2020; Su et al., 2020a;b) generate music in a non-regressive way, the synthesized results are highly formulated and usually mono-instrumental. More recently, D2M-GAN (Zhu et al., 2022a) and CDCD (Zhu et al., 2022b) directly generate video-conditioned musical waveforms. Though the results are diverse, frames are compressed into a single image as conditioning, thus temporal information is overlooked and synthesized results cannot reflect the alternation of visual movements. Besides, due to their reliance on a large music encoder (Dhariwal et al., 2020), the computation cost is extremely high, thus the music length is constrained to $2 \sim 6$ seconds. Unlike prior works, our framework generates long-term waveforms ( $25s \sim 50s$ ) with affordable costs, and our context-aware design learns the audio-visual rhythmic correlation to ensure inter-modality coherence.
|
| 35 |
+
|
| 36 |
+
Generalized Cross-Modal Generation. Remarkable advances also exist in other inter-modality generation tasks. Text-to-image synthesis has drawn increasing attention (Ramesh et al., 2022; Rombach et al., 2022; Gu et al., 2022; Tang et al., 2022) in pace with the gorgeous growth of contrastive language-image pre-training (Radford et al., 2021) and diffusion models (Ho et al., 2020), where the synthesized images exhibit high-resolution quality with great diversity and compute-efficiency. Some works (Singer et al., 2022; Hong et al., 2022) also extend text-to-image to
|
| 37 |
+
|
| 38 |
+

|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2. Illustration of our LORIS framework. We adopt a latent diffusion probabilistic model to perform conditional audio generation. Given an input of music-video pairs, a set of context-aware conditioning encoders first transform video frames, human poses, and categorical labels into visual embeddings, visual rhythm, and genre embeddings. Then a hierarchical conditional diffusion procedure is employed to serially attend these conditionings into the audio diffusion model, where visual rhythm is first embedded into rhythm conditioning via a Hawkes position encoding module. The entire LORIS framework is optimized jointly.
|
| 42 |
+
|
| 43 |
+
conditional video generation, while more recent pioneering methods investigate text-based pose sequences (Xie et al., 2022) and 3D scenes (Poole et al., 2022) generation. In this work, we refer to the latent conditional diffusion mechanism utilized by text-to-image approaches and attach more visual cues to stabilize long-term music synthesis.
|
| 44 |
+
|
| 45 |
+
# 3. Methodology
|
| 46 |
+
|
| 47 |
+
LORIS is depicted in Figure 2. Given a music-video pair, the latent diffusion model (Section 3.1) is used to synthesize auditory waveforms, and a set of conditioning encoders (Section 3.2) is designed to generate context-aware visual cues. Besides, a hierarchical conditional diffusion module (Section 3.3) is proposed to add cross-modality constraints.
|
| 48 |
+
|
| 49 |
+
# 3.1. Unconditional Latent Diffusion
|
| 50 |
+
|
| 51 |
+
Inspired by the recent image-to-text generation advance (Rombach et al., 2022), we use a similar open-source
|
| 52 |
+
|
| 53 |
+
architecture audio-diffusion-pytorch (Schneider, 2023) pretrained on a large-scale YouTube music dataset as our unimodal diffusion backbone. Due to the numerous amount of audio sampling points, we encode the input waveforms into a compressed latent representation $z \sim p_{data}$ to lower the computation cost. Unconditional latent diffusion consists of a forward diffusion process and a reverse denoising procedure. The forward process can be regarded as a Markov chain that progressively corrupts the initial latent codes $z_0$ into Gaussian noise $z_T \sim \mathcal{N}(0, \mathbf{I})$ with a sequence of $T$ steps. In contrast, the objective of the denoising process is to reverse the Gaussian distribution to the original vectors in identity steps. The denoising error can be optimized via the L2 objective. We seek to directly predict $z$ rather than utilizing the $\epsilon$ -prediction formulation (Ho et al., 2020):
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
L _ {L D} := \mathbb {E} _ {z \sim p _ {\text {d a t a}}, t \sim [ 1, T ]} \left[ \lambda (\sigma_ {t}) \| D _ {\theta} (z, \sigma_ {t}) - z \| \right] _ {2} ^ {2} ], \tag {1}
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
where $D_{\theta}$ is the denoising network parameterized by $\theta$ $\lambda (\sigma_t)$ denotes an optional weighting function.
|
| 60 |
+
|
| 61 |
+
In practice, EDM (Karras et al., 2022) is employed to improve the denoiser:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
D _ {\theta} (z, \sigma_ {t}) = c _ {s k i p} (\sigma_ {t}) z + c _ {o u t} (\sigma_ {t}) f _ {\theta} \left(c _ {i n} (\sigma_ {t}) z, \frac {1}{4} l n (\sigma_ {t})\right), \tag {2}
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where $c_{skip}(\sigma_t), c_{out}(\sigma_t)$ , and $c_{in}(\sigma_t)$ are scaling parameters and $\lambda(\sigma_t)$ is ameliorated as $1 / c_{out}(\sigma_t)^2$ . Details about scaling parameters are listed in Appendix A.2.
|
| 68 |
+
|
| 69 |
+
# 3.2. Context-Aware Conditioning Encoders
|
| 70 |
+
|
| 71 |
+
Previous waveform-based methods (Zhu et al., 2022a;b) share a common paradigm that compresses the temporal dimension and encodes frames into a global visual embedding $f_{e} \in \mathbb{R}^{1 \times C}$ , where $\mathbf{C}$ denotes the hidden dimension. Although these global features are flexible to act as conditional guidance, contextual information is overlooked, thence the model is incapable of synthesizing correlated music that responds to the change of visual contents. Such a phenomenon also elucidates why existing waveform-based methods can only tackle short-length videos. To this end, we model the temporal correspondence explicitly and construct visual conditioning $c_{v}$ , rhythm conditioning $c_{r}$ , and genre conditioning $c_{g}$ (if necessary) via different conditioning encoders.
|
| 72 |
+
|
| 73 |
+
Visual Conditioning. For the visual encoder, we follow previous methods (Zhu et al., 2022a;b) that use pre-trained I3D (Carreira & Zisserman, 2017) network as feature extractor. Differently, we do not perform feature aggregation across the temporal dimension and leverage a BiLSTM (Hochreiter & Schmidhuber, 1997) layer to capture long-range temporal dependencies:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
c _ {v}, (h, m c) = B i L S T M \left(E n c \left(i _ {1}, i _ {2}, \dots , i _ {T}\right), h _ {0}, m c _ {0}\right), \tag {3}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $Enc$ is the visual encoder, $I = \{i_1, i_2, \dots, i_T\}$ are input visual frames, $h$ and $mc$ denote hidden state and memory cell state vectors, $h_0, mc_0$ indicate their initial state. The parameters of I3D are frozen during training while the Bi-LSTM layer is involved in optimization.
|
| 80 |
+
|
| 81 |
+
Rhythm Conditioning. Several approaches have been proposed to extract dance rhythms, such as measuring the rapid changes of optical flows (Davis & Agrawala, 2018), performing Short-Time-Fourier Transform on human skeletons (Su et al., 2021), or merging neural networks with traditional graphic functions (Yu et al., 2022). Considering the commonality of rhythmic videos, we put forward an improved rule-based method to encode all frames of each video into a binary vector to represent visual rhythm points. Concretely, we first extract 2D poses $P(t,j,x,y)$ via pretrained models, where $t$ and $j$ denote the current temporal position and key joint, $x,y$ denotes the joint coordinate, then calculate the first-order difference of as 2D motions $M(t,j,x,y)$ . To comprehensively estimate the kinematic amplitude and strength, we utilize the directogram (Davis
|
| 82 |
+
|
| 83 |
+
& Agrawala, 2018), a 2D matrix $D$ analogous to the audio spectrogram to represent the change of motions. Motions in each timestamp are first divided into $K$ bins based on their angles with x-axis by $\tan^{-1}\frac{y}{x}$ , and the weighted summation is computed as the directogram:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
D (t, \theta) = \sum_ {j} \| M (t, j) \| _ {2} \mathbb {1} _ {\theta} (\angle M (t, j)), \tag {4}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\mathbb {1} _ {\theta} (\phi) := \left\{ \begin{array}{l l} 1, & \text {i f} | \theta - \phi | \leq \frac {2 \pi}{K}, \\ 0, & \text {o t h e r w i s e .} \end{array} \right. \tag {5}
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
Similar to audio onset envelopes, we calculate the bin-wise difference of the directogram, sum all positive values in each angular column, and normalize the resulting curves into the range of $[0, 1]$ as the visual onset envelopes $O$ :
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
O (t) = \eta \left(\sum_ {k = 1} ^ {K} \max (0, | D (t, k) | - | D (t - 1, k) |\right)), \tag {6}
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
where $D(t,k)$ denotes the directogram volume at $t$ -th time step and $k$ -th bin, $\eta$ is the normalized function.
|
| 100 |
+
|
| 101 |
+
Although $O(t)$ can already be regarded as the visual rhythmic conditioning, we further employ a peak-picking strategy (Böck et al., 2012) to simplify the continuous curves into discrete binary codes for the convenience of conditional generation. Specifically, the temporal point $t$ can be identified as the $i$ -th visual rhythmic point only when the following prerequisites are satisfied:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
c _ {r} \left(t _ {i}\right) = \max \left(O \left[ t _ {i} - p r e _ {m}: t _ {i} + p o s t _ {m} \right]\right),
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
c _ {r} \left(t _ {i}\right) \geq \operatorname {m e a n} \left(O \left[ t _ {i} - p r e _ {a}: t _ {i} + p o s t _ {a} \right]\right) + \delta , \tag {7}
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
t _ {i} - t _ {i - 1} > \omega
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
where $c_{r}(t_{i})$ is the $i$ -th rhythm peak in temporal position $t$ , $pre_{m}$ and $post_{m}$ denote the distance of finding local maxima before and after the current position; $pre_{a}$ and $post_{a}$ indicate the distance of computing the local average, $\delta$ is the threshold that the local maxima must be above the local average.
|
| 116 |
+
|
| 117 |
+
Finally, we get a binary vector $c_{r} \in \mathbb{R}^{T \times 1}$ that represents visual rhythm peaks, where 1 denotes that the current time step is one of the rhythm points. We also explain the rationale of our improved visual rhythm extraction method in Appendix C.
|
| 118 |
+
|
| 119 |
+
Genre Conditioning. Rhythmic videos can be categorized into different types based on their characteristics such as the choreography styles of dancing videos. Taking genre into consideration could facilitate some interesting applications like style transfer and music editing. We regard the musical genre as global conditioning and embed one-hot categorical labels $G$ into genre features via linear projection:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
c _ {g} = \operatorname {E m b e d} (G). \tag {8}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
It is noted that genre conditioning can only be utilized for datasets that include musical genre or category labels.
|
| 126 |
+
|
| 127 |
+
# 3.3. Hierarchical Conditional Diffusion
|
| 128 |
+
|
| 129 |
+
Considering the enormous success of cross-attention mechanism (Vaswani et al., 2017) in conditional generation (Ramesh et al., 2022; Rombach et al., 2022), we adopt such an approach to model the correlation between latent feature $z$ and conditioning $c$ . One obstacle for conditional diffusion is that rhythm peaks are binary vectors, which cannot perform feature interactions due to the low dimension. Therefore, we employ a trainable linear layer $W_{r}$ similar to the genre encoder to project the binary vector to a rhythm embedding matrix $c_{r}W_{r}\in \mathbb{R}^{T\times C}$ . We further argue that in a sequence of rhythm points, the mechanism of peak-picking determines the temporal point neighboring to rhythm peaks is unlikely to be another rhythm peak, thus we can explicitly add positional penalties to those temporal points adjacent to rhythm peaks. To this end, we introduce the Hawkes Process (Hawkes, 1971; Mei & Eisner, 2017; Zhang et al., 2020b), where additional temporal offsets are attached over the raw positional encoding in each dimension:
|
| 130 |
+
|
| 131 |
+
$$
|
| 132 |
+
H a w k e s ^ {k} \left(t _ {i}\right) = T r i \left(\omega_ {k} \times i + w _ {k} \times t _ {i}\right), \tag {9}
|
| 133 |
+
$$
|
| 134 |
+
|
| 135 |
+
where $Tri$ denotes $sin$ and $cos$ for the even and odd dimension, $\omega_{k}, w_{k}$ are the learnable parameters in the $k$ -th dimension for Hawkes encoding and positional encoding, respectively, $t_{i}$ denotes the temporal position of the $i$ -th rhythm peak. In practice, the shifted position can be computed as $i' = i + \frac{w_k}{\omega_k} t_i$ , where $\frac{w}{\omega}$ for all dimensions can be regarded as a learnable parameter matrix. In this way, our model takes contextual rhythm information into consideration for more accurate rhythmic control.
|
| 136 |
+
|
| 137 |
+
Then we add the shifted positional embeddings to the rhythm embedding $\hat{c}_r$ and use a Transformer (Vaswani et al., 2017) decoder block to perform feature integration:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
\hat {c} _ {r} = \operatorname {T r m D e c} \left(c _ {r} W _ {r} + \text {H a w k e s} \left(t _ {i}\right)\right), \tag {10}
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
After acquiring the conditional embeddings $\{c_v,\hat{c}_r,c_g\}$ , cross-modal attention is employed to interact conditional embeddings with intermediate layers of U-Net (Ronneberger et al., 2015) by computing feature similarity:
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
\operatorname {A t t} \left(c _ {\alpha}, \psi_ {i} (z)\right) = \operatorname {S o f t m a x} \left(\frac {W _ {Q} ^ {i} \psi_ {i} (z) \cdot \left(W _ {K} ^ {i} c _ {\alpha}\right) ^ {T}}{\sqrt {d}}\right) \cdot W _ {V} ^ {i} c _ {\alpha}, \tag {11}
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
where $c_{\alpha} \in \{c_v, \hat{c}_r, c_g\}$ denotes the conditional embeddings, $\psi_i(z)$ denotes the $i$ -th intermediate tensor of latent feature $z$ , $W_Q^i, W_K^i, W_V^i$ are learnable projection matrices.
|
| 150 |
+
|
| 151 |
+
Notably, we put conditionings serially to adapt the divergent temporal lengths of visual cues, by virtue of which we can use one cross-modal attention block to attend RGB, rhythm, and genre embeddings with far less computation cost.
|
| 152 |
+
|
| 153 |
+
Given the conditioning $C = \{c_v,\hat{c}_r,c_g\}$ , the objective for the latent conditional denoising can be formulated as:
|
| 154 |
+
|
| 155 |
+
$$
|
| 156 |
+
L _ {C L D} := \mathbb {E} _ {z \sim p _ {d a t a}, t \sim [ 1, T ]} \left[ \lambda \left(\sigma_ {t}\right) \| D _ {\theta} (z, \sigma_ {t}, C) - z \| \right] _ {2} ^ {2} ]. \tag {12}
|
| 157 |
+
$$
|
| 158 |
+
|
| 159 |
+
# 4. Benchmark
|
| 160 |
+
|
| 161 |
+
# 4.1. Dataset
|
| 162 |
+
|
| 163 |
+
Since prior waveform-based methods tackle short-length videos, the primary obstacle for long-term soundtrack generation is the shortage of paired audio-visual data. To this end, we curate the LORIS dataset based on existing datasets, which involves 86.43h paired videos varying from dances to multiple sports events. The comparison of our dataset with existing datasets is listed in Table 1. To be specific, our dataset incorporates three rhythmic categories: dance, figure skating, and floor exercise. The dancing videos are curated from AIST++ (Li et al., 2021) dataset, a fine-annotated subset of AIST (Tsuchida et al., 2019). We select all videos longer than 25 seconds and preserve their categorical labels to perform genre conditioning. Although 3D meshes and skeletons are available, we only curate the original videos. Figure skating videos are collected from FisV (Xu et al., 2019) dataset and FS1000 (Xia et al., 2022) dataset, and floor exercise videos are from Finegym (Shao et al., 2020) dataset. For the sports videos, we only use the raw videos and do not utilize any annotation or provided features.
|
| 164 |
+
|
| 165 |
+
After curating the raw videos, we make the following pre-processes: 1). We cut off the first and last 5 seconds of each sports video, and divide these videos into 25s and 50s segments. 2). We adopt the sound source-separated framework Spleeter (Hennequin et al., 2020) and employ its 2stem pre-trained model to remove vocals, commentaries, and cheers to acquire pure $16\mathrm{kHz}$ musical accompanies. 3). We manually filter video splits and remove the videos with noisy audio, unseparated vocals and cheers, absent background music, and overmuch missing frames. 4). We upsample the music sample rate to $22\mathrm{kHz}$ . 5). We extract the RGB features of visual frames using I3D (Carreira & Zisserman, 2017) pre-trained on Kinetics (Kay et al., 2017) and Charades (Zhang et al., 2020a) datasets, and employ mmPose (Contributors, 2020) to obtain 2D skeletons using HRNet (Sun et al., 2019) pre-trained on MS COCO (Lin et al., 2014) dataset. 6). Finally, we randomly split the dataset with a $90\% /5\% /5\%$ proportion. To sum up, we curate 12,446 25-second paired videos, including 1,881 dancing videos, 8,585 figure skating videos, and 1,950 floor exercise videos. For the 50-second versions, our dataset includes 4,147 figure skating videos and 660 floor exercise videos.
|
| 166 |
+
|
| 167 |
+
# 4.2. Evaluation Metrics
|
| 168 |
+
|
| 169 |
+
We follow the general paradigm of previous works (Zhu et al., 2022a;b) that measure musical quality and cross-modality correspondence. For the musical quality, the subjective metrics Mean Opinion Scores (MOS) for the general quality are reported. To investigate rhythm correspondence, we use the improved versions of beats coverage scores (BCS) and beats hit scores (BHS) for evaluation. To be
|
| 170 |
+
|
| 171 |
+
Long-Term Rhythmic Video Soundtracker
|
| 172 |
+
|
| 173 |
+
<table><tr><td>Dataset</td><td>Origin</td><td>Scenarios</td><td>Total length</td><td>Segment length</td></tr><tr><td>AIST++st(Li et al., 2021)</td><td>AIST++</td><td>Dance</td><td>3.78h</td><td>2s, 6s</td></tr><tr><td>Tiktok (Zhu et al., 2022a)</td><td>YouTube</td><td>Dance</td><td>1.55h</td><td>2s</td></tr><tr><td>Ours</td><td>AIST++, FineGym, FS1000, FisV</td><td>Dance, Floor Exercise, Figure Skating</td><td>86.43h</td><td>25s, 50s</td></tr></table>
|
| 174 |
+
|
| 175 |
+
Table 1. Comparison between our dataset and existing video soundtrack datasets. AIST++st means cutting raw AIST++ videos into 2s and 6s short-length segments. Statistical results show our dataset involves more video-music pairs with more categories and longer lengths.
|
| 176 |
+
|
| 177 |
+
specific, BCS and BHS are first proposed for music-guided dance generation (Davis & Agrawala, 2018; Lee et al., 2019) which measures the alignment of musical rhythms and dancing patterns. Similarly, prior dance-to-music methods (Zhu et al., 2022a;b) employ these metrics to count the aligned rhythm points of synthesized music and ground-truth music by computing the rhythm point number of generated music $B_{g}$ , the rhythm point number of ground-truth music $B_{t}$ , and the number of aligned rhythm points $B_{a}$ . Then, BCS is calculated as the fraction of generated musical beats by the ground truth musical beats $(B_{g} / B_{t})$ , and BHS measures the ratio of aligned beats to the ground truth beats $(B_{a} / B_{t})$ . However, we found that these metrics are only suitable for short-length (2~6s) music, and two main problems emerge when evaluating long-term soundtracks: 1). the second-wise rhythm detection algorithm results in an extremely sparse vector for any long music sequence, thus the constantly low BCS and BHS values are unable to reflect the real performance. 2). BHS can easily exceed 1 if generated music involves more rhythm points than ground truth. Considering a batch involves two samples with BHS of 0.5 and 1.5, the average BHS is 1, which seems to be perfect while each sample performs unsatisfactorily. Hence, the reported value cannot reflect the real quality under such metrics. Accordingly, we make two corresponding modifications: 1. We adjust the parameters of audio onset detection algorithms (Böck et al., 2012) (More details in Appendix B.3) to avoid sparse rhythm vectors. 2. We calculate BCS by dividing the aligned beats by the total beats from the generated music $(B_{a} / B_{g})$ , by which BCS and BHS play the roles of recall and precision, respectively. Besides, we calculate the F1 scores of BCS and BHS as an integrated assessment and report the standard deviations of BCS and BHS (termed CSD and HSD, respectively) to evaluate generative stability.
|
| 178 |
+
|
| 179 |
+
# 4.3. Baselines
|
| 180 |
+
|
| 181 |
+
To make an exhaustive evaluation, we choose several well-performed methods with available codes as baselines. Concretely, we re-implement MIDI-based methods Foley (Gan et al., 2020) and CMT (Di et al., 2021), waveform-based methods D2M-GAN (Zhu et al., 2022a) and CDCD (Zhu et al., 2022b) on our dataset. Experimental results of the baseline methods and our LORIS framework on the established benchmark are reported in Section 5.
|
| 182 |
+
|
| 183 |
+
5. Experiments
|
| 184 |
+
|
| 185 |
+
<table><tr><td>Metrics</td><td>BCS↑</td><td>CSD↓</td><td>BHS↑</td><td>HSD↓</td><td>F1↑</td><td>MOS↑</td></tr><tr><td>Foley</td><td>96.4</td><td>6.9</td><td>41.0</td><td>15.0</td><td>57.5</td><td>3.2</td></tr><tr><td>CMT</td><td>97.1</td><td>6.4</td><td>46.2</td><td>18.6</td><td>62.6</td><td>3.6</td></tr><tr><td>D2MGAN</td><td>95.6</td><td>9.4</td><td>88.7</td><td>19.0</td><td>93.1</td><td>2.8</td></tr><tr><td>CDCD</td><td>96.5</td><td>9.1</td><td>89.3</td><td>18.1</td><td>92.7</td><td>3.1</td></tr><tr><td>Ours</td><td>98.6</td><td>6.1</td><td>90.8</td><td>13.9</td><td>94.5</td><td>3.7</td></tr></table>
|
| 186 |
+
|
| 187 |
+
Table 2. Quantitative results on the ${\mathrm{{LORIS}}}_{DA25}$ dancing subset.
|
| 188 |
+
|
| 189 |
+
# 5.1. Implementation Details
|
| 190 |
+
|
| 191 |
+
We use audio-diffusion-pytorch-v0.0.43 (Schneider, 2023) as our basic backbone. The dimension of all hidden layers is set to 1024, and the embedding size of genre labels and RGB features is also 1024. For visual rhythm extraction, the bin number $K$ is set to 10 and hyperparameters of peak picking strategy are $pre_{m} = 3$ , $pre_{m} = 3$ , $post_{a} = 3$ , and $post_{a} = 3$ . We set the threshold offset $\delta$ as 0.2 multiples by the current local maxima, and peak wait number $\omega = 1$ . The audio sampling rate is set to $22050\mathrm{Hz}$ . We use AdamW (Loshchilov & Hutter, 2017) as the optimizer with $\beta_{1} = 0.9$ , $\beta_{2} = 0.96$ and weight decay of $4.5\mathrm{e - }2$ . A two-stage learning rate strategy is applied during training. Specifically, for layers in the unconditional diffusion model pre-trained by (Schneider, 2023), we set the learning rate as 3e-6 while the initial learning rate of all other layers is 3e-3. We set a warm-up learning rate of 2e-4 for all layers in the first 1,000 training iterations. We also apply the gradient clipping with the max norm of 0.5. The entire LORIS framework is optimized jointly and we use 8 NVIDIA A100 GPUs to train our model for 100 epochs on the dancing subset, 200 epochs on the floor exercise subset, and 250 epochs on the figure skating subset. For music sampling, we employ the classifier-free guidance (Ho & Salimans, 2022) to perform conditional generation with guidance scale $w = 20$ . The diffusion step number during inference is set to 50 as a trade-off of music quality and inference speed.
|
| 192 |
+
|
| 193 |
+
# 5.2. Main Results
|
| 194 |
+
|
| 195 |
+
Since visual appearances and musical patterns of dance and sports datasets vary widely, we separately evaluate each rhythmic type termed as $\mathrm{LORIS}_{DA25}$ subset for 25s dancing videos, $\mathrm{LORIS}_{FE25}$ and $\mathrm{LORIS}_{FE50}$ subsets for 25s and
|
| 196 |
+
|
| 197 |
+
<table><tr><td rowspan="2">Subset Metrics</td><td colspan="6">LORISFE25</td><td colspan="6">LORISFE50</td></tr><tr><td>BCS↑</td><td>CSD↓</td><td>BHS↑</td><td>HSD↓</td><td>F1↑</td><td>MOS↑</td><td>BCS↑</td><td>CSD↓</td><td>BHS↑</td><td>HSD↓</td><td>F1↑</td><td>MOS↑</td></tr><tr><td>Foley</td><td>36.0</td><td>36.2</td><td>32.3</td><td>30.7</td><td>34.1</td><td>3.2</td><td>32.6</td><td>38.0</td><td>28.4</td><td>32.5</td><td>30.4</td><td>3.1</td></tr><tr><td>CMT</td><td>46.4</td><td>30.1</td><td>57.4</td><td>29.8</td><td>51.3</td><td>3.8</td><td>42.3</td><td>32.0</td><td>53.8</td><td>31.7</td><td>47.4</td><td>3.5</td></tr><tr><td>D2MGAN</td><td>45.3</td><td>27.7</td><td>58.7</td><td>30.1</td><td>51.1</td><td>2.4</td><td>41.9</td><td>29.2</td><td>54.7</td><td>32.7</td><td>47.5</td><td>2.1</td></tr><tr><td>CDCD</td><td>49.0</td><td>21.1</td><td>61.0</td><td>27.0</td><td>54.3</td><td>2.7</td><td>45.9</td><td>23.8</td><td>57.5</td><td>29.3</td><td>51.0</td><td>2.5</td></tr><tr><td>Ours</td><td>58.8</td><td>19.4</td><td>67.1</td><td>21.1</td><td>62.7</td><td>3.8</td><td>54.7</td><td>21.6</td><td>63.8</td><td>24.5</td><td>58.9</td><td>3.4</td></tr></table>
|
| 198 |
+
|
| 199 |
+
Table 3. Comparison with state-of-the-art methods on the ${\mathrm{{LORIS}}}_{FE25}$ and ${\mathrm{{LORIS}}}_{FE50}$ floor exercise subsets.
|
| 200 |
+
|
| 201 |
+
<table><tr><td rowspan="2">Subset Metrics</td><td colspan="6">LORIS\( _{FS25} \)</td><td colspan="6">LORIS\( _{FS50} \)</td></tr><tr><td>BCS↑</td><td>CSD↓</td><td>BHS↑</td><td>HSD↓</td><td>F1↑</td><td>MOS↑</td><td>BCS↑</td><td>CSD↓</td><td>BHS↑</td><td>HSD↓</td><td>F1↑</td><td>MOS↑</td></tr><tr><td>Foley</td><td>36.1</td><td>25.4</td><td>21.1</td><td>16.2</td><td>26.7</td><td>3.0</td><td>33.8</td><td>27.8</td><td>18.5</td><td>18.2</td><td>24.0</td><td>3.2</td></tr><tr><td>CMT</td><td>37.2</td><td>24.9</td><td>73.8</td><td>29.2</td><td>49.4</td><td>3.9</td><td>34.6</td><td>26.4</td><td>70.7</td><td>31.1</td><td>46.5</td><td>3.6</td></tr><tr><td>D2MGAN</td><td>42.8</td><td>26.8</td><td>48.9</td><td>25.9</td><td>45.7</td><td>2.7</td><td>39.9</td><td>28.7</td><td>45.7</td><td>27.0</td><td>42.6</td><td>2.2</td></tr><tr><td>CDCD</td><td>45.6</td><td>27.3</td><td>44.6</td><td>22.6</td><td>45.1</td><td>2.8</td><td>42.1</td><td>29.5</td><td>41.6</td><td>24.6</td><td>41.8</td><td>2.4</td></tr><tr><td>Ours</td><td>52.2</td><td>18.5</td><td>57.0</td><td>19.8</td><td>54.5</td><td>3.8</td><td>49.3</td><td>20.8</td><td>54.9</td><td>21.4</td><td>52.0</td><td>3.6</td></tr></table>
|
| 202 |
+
|
| 203 |
+
50s floor exercise videos, and $\mathrm{LORIS}_{FS25}$ and $\mathrm{LORIS}_{FS50}$ subsets for 25s and 50s figure skating videos.
|
| 204 |
+
|
| 205 |
+
Results on the 25s dancing subset are shown in Table 2, where our model outperforms all previous methods both on rhythmic coherence and musical quality. In particular, All methods show satisfactory BCS and low CSD since dancing beats are periodic and easy to perceive, thereby the rhythm points of generated music $B_{g}$ and GT music $B_{t}$ are similar. However, waveform-based methods D2M-GAN (Zhu et al., 2022a) and CDCD (Zhu et al., 2022b) achieve higher BHS than MIDI-based methods Foley (Gan et al., 2020) and CMT (Di et al., 2021), which suggests that waveforms synthesized by generative models are more flexible to perform rhythm alignment. Performance on sports subsets is demonstrated in Table 3 and Table 4. We find that all methods perform worse in rhythmic coherence and musical quality on the sports datasets, indicating sports are more challenging rhythmic scenarios. Nevertheless, our model still achieves considerable boosts compared with CDCD (Zhu et al., 2022b) about $+8.4\%$ , $+8.2\%$ F1 scores for 25s and 50s floor exercise videos, and $+9.4\%$ , $+8.2\%$ F1 scores for figure skating videos. These numerical results verify that our LORIS framework is capable of generating high-quality musical soundtracks with accurate rhythmic alignment for both dances and sports.
|
| 206 |
+
|
| 207 |
+
# 5.3. Ablation Studies
|
| 208 |
+
|
| 209 |
+
Engaged Conditioning. We first investigate the role of data modalities that engage into conditional diffusion. We put forward three variants where 'LORIS w/o V' and 'LORIS w/o R' drop the visual and rhythm conditioning, respectively, and 'LORIS w/ $V_{m}$ ' denotes using a trainable ST-GCN (Yan et al., 2018) network to encode human poses and then con
|
| 210 |
+
|
| 211 |
+
Table 4. Comparison with state-of-the-art methods on the $\mathrm{{LORIS}}_{{FS25}}$ and ${\mathrm{{LORIS}}}_{FS50}$ figure skating subsets.
|
| 212 |
+
|
| 213 |
+
<table><tr><td>Method</td><td>BCS↑</td><td>CSD↓</td><td>BHS↑</td><td>HSD↓</td><td>F1↑</td></tr><tr><td>LORIS w/o V</td><td>53.2</td><td>28.2</td><td>46.4</td><td>21.5</td><td>49.6</td></tr><tr><td>LORIS w/o R</td><td>51.2</td><td>29.8</td><td>41.4</td><td>24.7</td><td>45.8</td></tr><tr><td>LORIS w/ Vm</td><td>51.7</td><td>23.5</td><td>74.4</td><td>19.0</td><td>61.0</td></tr><tr><td>LORIS (full)</td><td>58.8</td><td>19.4</td><td>67.1</td><td>21.1</td><td>62.7</td></tr></table>
|
| 214 |
+
|
| 215 |
+
catenate the extracted motion features with I3D features as the visual conditioning. Results are shown in Table 5, which witnesses significant performance drops both during the absence of the visual and rhythm conditionings. This suggests that visual and rhythm conditionings are indispensable due to their grants for visual appearance and motion cues. Though LORIS w/ $V_{m}$ outperforms our full model in BHS and HSD, simply using RGB embeddings as visual encoder results in higher coverage scores and better overall performance (F1 scores). We argue that motion clues have already been taken into account during the extraction of visual rhythms, thus the motion embeddings are duplicated and can be omitted to lower the computation.
|
| 216 |
+
|
| 217 |
+
Table 5. Ablation studies on the engaged conditions on the $\mathrm{LORIS}_{FE25}$ subset. M denotes rhythm conditioning, V indicates visual conditioning, and $V_{m}$ is a visual encoder that integrates RGB features and motion features.
|
| 218 |
+
|
| 219 |
+
<table><tr><td>Method</td><td>BCS</td><td>CSD</td><td>BHS</td><td>HSD</td><td>F1</td></tr><tr><td>LORIS w/o LSTM</td><td>53.2</td><td>25.3</td><td>68.9</td><td>21.2</td><td>60.0</td></tr><tr><td>LORIS w/o Hawkes</td><td>51.3</td><td>26.2</td><td>59.0</td><td>21.2</td><td>54.9</td></tr><tr><td>LORIS w/o PE</td><td>52.4</td><td>25.6</td><td>64.0</td><td>21.6</td><td>57.6</td></tr><tr><td>LORIS w/ rhymul</td><td>52.2</td><td>25.2</td><td>67.1</td><td>21.2</td><td>58.7</td></tr><tr><td>LORIS (full)</td><td>58.8</td><td>19.4</td><td>67.1</td><td>21.1</td><td>62.7</td></tr></table>
|
| 220 |
+
|
| 221 |
+
Table 6. Ablation studies on model architecture designs on the $\mathrm{LORIS}_{FE25}$ subset. PE denotes positional encoding of visual rhythm embedding and rhymul is a variant that directly multiplies the rhythm envelope curves by the latent audio features.
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
|
| 225 |
+

|
| 226 |
+
Figure 3. Visualizations of rhythms and musical log-melspectrograms. Exemplar in the upper of the picture shows the rhythm correspondence between audio and visual rhythms, where the green curve indicates visual rhythm peaks extracted via our rule-based strategy, and blue and yellow curves denote the ground truth and generated musical rhythm points. Results show that our model synthesizes music with satisfactory rhythm coherence. The lower part is the comparison of generated and ground-truth musical log-melspectrogram, where the synthesized results lie in an analogous crest distribution with ground-truth music.
|
| 227 |
+
|
| 228 |
+
Model Architecture. We further evaluate the necessity of each model component, and results are shown in Table 6. To investigate the effectiveness of temporal modeling, we first drop the Bi-LSTM layer termed 'LORIS w/o LSTM'. Results show that though the ablated model achieves comparable performance on BHS, the coverage scores decline significantly $(-5.6\%)$ , indicating that temporal modeling for visual features is essential. We then analyze the impact of the rhythm conditioning module by ablating several variants: 'LORIS w/o Hawkes' that removes the Hawkes process attached to the positional encoding, 'LORIS w/o PE' that abolishing the entire positional encoding module, and 'LORIS w/ rhymul' that adopting a simpler conditioning strategy to directly multiply the visual rhythm envelopes by the auditory latent embedding (rather than using the cross-modality block). We observe that both positional encoding and the Hawkes process contribute to the rhythmic alignment. Besides, embed and cross-attend the rhythm peaks is a better conditioning approach than plain multiplication.
|
| 229 |
+
|
| 230 |
+
# 5.4. Qualitative Results
|
| 231 |
+
|
| 232 |
+
As illustrated in Figure 3, we visualize music generated by LORIS together with the raw video-music pairs to illustrate rhythm correspondence and spectrogram analogousness. The upper part contrast visual rhythms with auditory rhythms extracted by ground-truth waveform and our generated music, where the synthesized contents reveal accurate alignment with visual appearances even when the ground-truth rhythms are mismatched (the 11th rhythm point). The lower part compares the log-melspectrograms of our gener
|
| 233 |
+
|
| 234 |
+
ated music and ground truths. We find that the synthesized prosody patterns are alien to the raw audio since we do not add explicit reconstruction regularization to the raw audio sampling points, and the scholastic sampling nature of the diffusion sampling strategy guarantees the diversity of synthesized results. However, the position of audio peaks is likely to share a similar distribution, which indicates LORIS models the audio-visual correspondence and leverages such prior to generating music with comparable rhythm distribution. Besides, to show our model's ability in generating superior long-term soundtracks, we provide complementary qualitative demos in the Supplementary Material.
|
| 235 |
+
|
| 236 |
+
# 6. Conclusion
|
| 237 |
+
|
| 238 |
+
We have presented LORIS, a long-term rhythmic video soundtrack that generates video-conditioned musical waveforms via a context-aware latent diffusion model. A comprehensive benchmark for video soundtracks is also established, which includes a large-scale rhythmic videomusic dataset varying from dancing to multiple sports events and a set of improved evaluation metrics. Experiments demonstrate that LORIS generates soundtracks with the best rhythm correspondence and satisfactory quality compared with existing methods. Nonetheless, LORIS only tackles fixed-length videos, thereby limiting its practicability, and the overall quality is still in need of improvement. In the future, we would seek different audio generation backbones for better musical quality and try context-aware modules to achieve unconstrained, even real-time generation purposes.
|
| 239 |
+
|
| 240 |
+
# Acknowledgements
|
| 241 |
+
|
| 242 |
+
This work is partially supported by the Shanghai Committee of Science and Technology (Grant No. 21DZ1100100). This work was supported in part by the National Natural Science Foundation of China under Grants 62102150.
|
| 243 |
+
|
| 244 |
+
# References
|
| 245 |
+
|
| 246 |
+
Agostinelli, A., Denk, T. I., Borsos, Z., Engel, J., Verzetti, M., Caillon, A., Huang, Q., Jansen, A., Roberts, A., Tagliasacchi, M., et al. Musicl: Generating music from text. arXiv preprint arXiv:2301.11325, 2023.
|
| 247 |
+
Böck, S., Krebs, F., and Schedl, M. Evaluating the online capabilities of onset detection methods. In ISMIR, pp. 49-54, 2012.
|
| 248 |
+
Brunner, G., Konrad, A., Wang, Y., and Wattenhofer, R. Midi-vae: Modeling dynamics and instrumentation of music with applications to style transfer. arXiv preprint arXiv:1809.07600, 2018.
|
| 249 |
+
Caillon, A. and Esling, P. Rave: A variational autoencoder for fast and high-quality neural audio synthesis. arXiv preprint arXiv:2111.05011, 2021.
|
| 250 |
+
Carreira, J. and Zisserman, A. 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.
|
| 251 |
+
Contributors, M. Openmmlab pose estimation toolbox and benchmark. https://github.com/open-mmlab/mmpose, 2020.
|
| 252 |
+
Davis, A. and Agrawala, M. Visual rhythm and beat. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 2532-2535, 2018.
|
| 253 |
+
Dhariwal, P., Jun, H., Payne, C., Kim, J. W., Radford, A., and Sutskever, I. Jukebox: A generative model for music. arXiv preprint arXiv:2005.00341, 2020.
|
| 254 |
+
Di, S., Jiang, Z., Liu, S., Wang, Z., Zhu, L., He, Z., Liu, H., and Yan, S. Video background music generation with controllable music transformer. In Proceedings of the 29th ACM International Conference on Multimedia, pp. 2037-2045, 2021.
|
| 255 |
+
Dong, H.-W., Hsiao, W.-Y., Yang, L.-C., and Yang, Y.-H. Musegan: Multi-track sequential generative adversarial networks for symbolic music generation and accompaniment. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 256 |
+
|
| 257 |
+
Dong, H.-W., Chen, K., Dubnov, S., McAuley, J., and Berg-Kirkpatrick, T. Multitrack music transformer: Learning long-term dependencies in music with diverse instruments. arXiv preprint arXiv:2207.06983, 2022.
|
| 258 |
+
Gan, C., Huang, D., Chen, P., Tenenbaum, J. B., and Torralba, A. Foley music: Learning to generate music from videos. In European Conference on Computer Vision, pp. 758-775. Springer, 2020.
|
| 259 |
+
Gu, S., Chen, D., Bao, J., Wen, F., Zhang, B., Chen, D., Yuan, L., and Guo, B. Vector quantized diffusion model for text-to-image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10696-10706, 2022.
|
| 260 |
+
Hawkes, A. G. Spectra of some self-exciting and mutually exciting point processes. Biometrika, 58(1):83-90, 1971.
|
| 261 |
+
Hawthorne, C., Simon, I., Roberts, A., Zeghidour, N., Gardner, J., Manilow, E., and Engel, J. Multi-instrument music synthesis with spectrogram diffusion. arXiv preprint arXiv:2206.05408, 2022.
|
| 262 |
+
Hennequin, R., Khlif, A., Voituret, F., and Moussallam, M. Spleeter: a fast and efficient music source separation tool with pre-trained models. Journal of Open Source Software, 5(50):2154, 2020. doi: 10.21105/joss.02154. URL https://doi.org/10.21105/joss.02154. Deezer Research.
|
| 263 |
+
Ho, J. and Salimans, T. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022.
|
| 264 |
+
Ho, J., Jain, A., and Abbeel, P. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6851, 2020.
|
| 265 |
+
Hochreiter, S. and Schmidhuber, J. Long short-term memory. Neural computation, 9(8):1735-1780, 1997.
|
| 266 |
+
Hong, W., Ding, M., Zheng, W., Liu, X., and Tang, J. Cogvideo: Large-scale pretraining for text-to-video generation via transformers. arXiv preprint arXiv:2205.15868, 2022.
|
| 267 |
+
Huang, C.-Z. A., Vaswani, A., Uszkoreit, J., Shazeer, N., Simon, I., Hawthorne, C., Dai, A. M., Hoffman, M. D., Dinculescu, M., and Eck, D. Music transformer. arXiv preprint arXiv:1809.04281, 2018.
|
| 268 |
+
Huang, Q., Park, D. S., Wang, T., Denk, T. I., Ly, A., Chen, N., Zhang, Z., Zhang, Z., Yu, J., Frank, C., et al. Noise2music: Text-conditioned music generation with diffusion models. arXiv preprint arXiv:2302.03917, 2023.
|
| 269 |
+
|
| 270 |
+
Huang, Y.-S. and Yang, Y.-H. Pop music transformer: Beat-based modeling and generation of expressive pop piano compositions. In Proceedings of the 28th ACM International Conference on Multimedia, pp. 1180-1188, 2020.
|
| 271 |
+
Karras, T., Aittala, M., Aila, T., and Laine, S. Elucidating the design space of diffusion-based generative models. arXiv preprint arXiv:2206.00364, 2022.
|
| 272 |
+
Kay, W., Carreira, J., Simonyan, K., Zhang, B., Hillier, C., Vijayanarasimhan, S., Viola, F., Green, T., Back, T., Natsev, P., et al. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017.
|
| 273 |
+
Kreuk, F., Synnaeve, G., Polyak, A., Singer, U., Defossez, A., Copet, J., Parikh, D., Taigman, Y., and Adi, Y. Audiogen: Textually guided audio generation. arXiv preprint arXiv:2209.15352, 2022.
|
| 274 |
+
Kumar, K., Kumar, R., de Boissiere, T., Gestin, L., Teoh, W. Z., Sotelo, J., de Brébisson, A., Bengio, Y., and Courville, A. C. Melgan: Generative adversarial networks for conditional waveform synthesis. Advances in neural information processing systems, 32, 2019.
|
| 275 |
+
Lee, H.-Y., Yang, X., Liu, M.-Y., Wang, T.-C., Lu, Y.-D., Yang, M.-H., and Kautz, J. Dancing to music. Advances in neural information processing systems, 32, 2019.
|
| 276 |
+
Li, R., Yang, S., Ross, D. A., and Kanazawa, A. Ai choreographer: Music conditioned 3d dance generation with aist++. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 13401-13412, 2021.
|
| 277 |
+
Lin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollar, P., and Zitnick, C. L. Microsoft coco: Common objects in context. In European conference on computer vision, pp. 740-755. Springer, 2014.
|
| 278 |
+
Loshchilov, I. and Hutter, F. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 279 |
+
Mei, H. and Eisner, J. M. The neural hawkes process: A neurally self-modulating multivariate point process. Advances in neural information processing systems, 30, 2017.
|
| 280 |
+
Mittal, G., Engel, J., Hawthorne, C., and Simon, I. Symbolic music generation with diffusion models. arXiv preprint arXiv:2103.16091, 2021.
|
| 281 |
+
Oord, A. v. d., Dieleman, S., Zen, H., Simonyan, K., Vinyals, O., Graves, A., Kalchbrenner, N., Senior, A., and Kavukcuoglu, K. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
|
| 282 |
+
Pasini, M. and Schlüter, J. Musika! fast infinite waveform music generation. arXiv preprint arXiv:2208.08706, 2022.
|
| 283 |
+
|
| 284 |
+
Pedersoli, F. and Goto, M. Dance beat tracking from visual information alone. In ISMIR, pp. 400-408, 2020.
|
| 285 |
+
Poole, B., Jain, A., Barron, J. T., and Mildenhall, B. Dreamfusion: Text-to-3d using 2d diffusion. arXiv preprint arXiv:2209.14988, 2022.
|
| 286 |
+
Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pp. 8748-8763. PMLR, 2021.
|
| 287 |
+
Ramesh, A., Dhariwal, P., Nichol, A., Chu, C., and Chen, M. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
|
| 288 |
+
Ren, Y., He, J., Tan, X., Qin, T., Zhao, Z., and Liu, T.-Y. Popmag: Pop music accompaniment generation. In Proceedings of the 28th ACM International Conference on Multimedia, pp. 1198-1206, 2020.
|
| 289 |
+
Roberts, A., Engel, J., Raffel, C., Hawthorne, C., and Eck, D. A hierarchical latent vector model for learning long-term structure in music. In International conference on machine learning, pp. 4364-4373. PMLR, 2018.
|
| 290 |
+
Rombach, R., Blattmann, A., Lorenz, D., Esser, P., and Ommer, B. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10684-10695, 2022.
|
| 291 |
+
Ronneberger, O., Fischer, P., and Brox, T. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pp. 234-241. Springer, 2015.
|
| 292 |
+
Schneider, F. Archisound: Audio generation with diffusion. arXiv preprint arXiv:2301.13267, 2023.
|
| 293 |
+
Schneider, F., Jin, Z., and Schölkopf, B. Mo\^ usai: Text-to-music generation with long-context latent diffusion. arXiv preprint arXiv:2301.11757, 2023.
|
| 294 |
+
Shao, D., Zhao, Y., Dai, B., and Lin, D. Finegym: A hierarchical video dataset for fine-grained action understanding. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2616-2625, 2020.
|
| 295 |
+
Sheffer, R. and Adi, Y. I hear your true colors: Image guided audio generation. arXiv preprint arXiv:2211.03089, 2022.
|
| 296 |
+
Singer, U., Polyak, A., Hayes, T., Yin, X., An, J., Zhang, S., Hu, Q., Yang, H., Ashual, O., Gafni, O., et al. Make-a-video: Text-to-video generation without text-video data. arXiv preprint arXiv:2209.14792, 2022.
|
| 297 |
+
|
| 298 |
+
Su, K., Liu, X., and Shlizerman, E. Audeo: Audio generation for a silent performance video. Advances in Neural Information Processing Systems, 33:3325-3337, 2020a.
|
| 299 |
+
Su, K., Liu, X., and Shlizerman, E. Multi-instrumentalist net: Unsupervised generation of music from body movements. arXiv preprint arXiv:2012.03478, 2020b.
|
| 300 |
+
Su, K., Liu, X., and Shlizerman, E. How does it sound? generation of rhythmic soundtracks for human movement videos. In Conf. Neural Inf. Process. Syst, volume 35, pp. 0-10, 2021.
|
| 301 |
+
Sun, K., Xiao, B., Liu, D., and Wang, J. Deep high-resolution representation learning for human pose estimation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 5693-5703, 2019.
|
| 302 |
+
Tang, Z., Gu, S., Bao, J., Chen, D., and Wen, F. Improved vector quantized diffusion models. arXiv preprint arXiv:2205.16007, 2022.
|
| 303 |
+
Tsuchida, S., Fukayama, S., Hamasaki, M., and Goto, M. Aist dance video database: Multi-genre, multi-dancer, and multi-camera database for dance information processing. In ISMIR, volume 1, pp. 6, 2019.
|
| 304 |
+
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. Advances in neural information processing systems, 30, 2017.
|
| 305 |
+
von Rütte, D., Biggio, L., Kilcher, Y., and Hoffman, T. Figaro: Generating symbolic music with fine-grained artistic control. arXiv preprint arXiv:2201.10936, 2022.
|
| 306 |
+
Wang, J., Fang, Z., and Zhao, H. Alignnet: A unifying approach to audio-visual alignment. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 3309-3317, 2020.
|
| 307 |
+
Xia, J., Zhuge, M., Geng, T., Fan, S., Wei, Y., He, Z., and Zheng, F. Skating-mixer: Multimodal mlp for scoring figure skating. arXiv preprint arXiv:2203.03990, 2022.
|
| 308 |
+
Xie, P., Zhang, Q., Li, Z., Tang, H., Du, Y., and Hu, X. Vector quantized diffusion model with codeunet for text-to-sign pose sequences generation. arXiv preprint arXiv:2208.09141, 2022.
|
| 309 |
+
Xie, Y., Wang, H., Hao, Y., and Xu, Z. Visual rhythm prediction with feature-aligning network. In 2019 16th International Conference on Machine Vision Applications (MVA), pp. 1-6. IEEE, 2019.
|
| 310 |
+
Xu, C., Fu, Y., Zhang, B., Chen, Z., Jiang, Y.-G., and Xue, X. Learning to score figure skating sport videos. IEEE
|
| 311 |
+
|
| 312 |
+
transactions on circuits and systems for video technology, 30(12):4578-4590, 2019.
|
| 313 |
+
Yan, S., Xiong, Y., and Lin, D. Spatial temporal graph convolutional networks for skeleton-based action recognition. In Thirty-second AAAI conference on artificial intelligence, 2018.
|
| 314 |
+
Yang, D., Yu, J., Wang, H., Wang, W., Weng, C., Zou, Y., and Yu, D. Diffsound: Discrete diffusion model for text-to-sound generation. arXiv preprint arXiv:2207.09983, 2022.
|
| 315 |
+
Yu, J., Pu, J., Cheng, Y., Feng, R., and Shan, Y. Self-supervised learning of music-dance representation through explicit-implicit rhythm synchronization. arXiv preprint arXiv:2207.03190, 2022.
|
| 316 |
+
Zhang, J., Shen, F., Xu, X., and Shen, H. T. Temporal reasoning graph for activity recognition. IEEE Transactions on Image Processing, 29:5491-5506, 2020a.
|
| 317 |
+
Zhang, Q., Lipani, A., Kirnap, O., and Yilmaz, E. Self-attentive hawkes process. In International conference on machine learning, pp. 11183-11193. PMLR, 2020b.
|
| 318 |
+
Zhang, R., Zhang, Y., Shao, K., Shan, Y., and Xia, G. Vis2mus: Exploring multimodal representation mapping for controllable music generation. arXiv preprint arXiv:2211.05543, 2022.
|
| 319 |
+
Zhu, Y., Olszewski, K., Wu, Y., Achlioptas, P., Chai, M., Yan, Y., and Tulyakov, S. Quantized gan for complex music generation from dance videos. arXiv preprint arXiv:2204.00604, 2022a.
|
| 320 |
+
Zhu, Y., Wu, Y., Olszewski, K., Ren, J., Tulyakov, S., and Yan, Y. Discrete contrastive diffusion for cross-modal and conditional generation. arXiv preprint arXiv:2206.07771, 2022b.
|
| 321 |
+
|
| 322 |
+
# A. Model Details
|
| 323 |
+
|
| 324 |
+
We here give a brief introduction of the model architecture, including the illustration of the backbone structure and detailed descriptions of the scaling parameters of the denoiser.
|
| 325 |
+
|
| 326 |
+
# A.1. Diffusion Model Architecture
|
| 327 |
+
|
| 328 |
+
Overview of the audio diffusion backbone (Schneider, 2023) is illustrated in the upper part of Figure 4, which mainly comprises the latent encoder, u-net (Ronneberger et al., 2015), and latent decoder. The detailed structure of each module is illustrated in the lower part, where all components involve a basic unit named ResnetBlock1d. To be specific, ResnetBlock1d includes three 1D convolutional blocks that perform feature integration. Furthermore, all conditional embeddings are introduced into the diffusion process via the cross-modal attention block (Vaswani et al., 2017) in all ResnetBlock1d modules of downsample block, upsample block, and bottleneck block, while the ResnetBlock1d modules in latent encoder and decoder do not involve any cross-modality interaction.
|
| 329 |
+
|
| 330 |
+
# A.2. Scaling Parameters
|
| 331 |
+
|
| 332 |
+
We adopt EDM (Karras et al., 2022) to ameliorate the denoiser $D_{\theta}(z,\sigma_t)$ via skip scaling $c_{skip}(\sigma_t)$ , output scaling $c_{out}(\sigma_t)$ , input scaling $c_{in}(\sigma_t)$ , and noise mapping $c_{noise}(\sigma_t)$ . The entire process can be formulated as:
|
| 333 |
+
|
| 334 |
+
$$
|
| 335 |
+
D _ {\theta} (z, \sigma_ {t}) = c _ {s k i p} (\sigma_ {t}) z + c _ {o u t} (\sigma_ {t}) f _ {\theta} \left(c _ {i n} (\sigma_ {t}) z, c _ {n o i s e} (\sigma_ {t})\right), \tag {13}
|
| 336 |
+
$$
|
| 337 |
+
|
| 338 |
+
$$
|
| 339 |
+
c _ {s k i p} \left(\sigma_ {t}\right) = \sigma_ {d a t a} ^ {2} / \left(\sigma_ {t} ^ {2} + \sigma_ {d a t a} ^ {2}\right) \tag {14}
|
| 340 |
+
$$
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
c _ {o u t} \left(\sigma_ {t}\right) = \sigma_ {t} \cdot \sigma_ {d a t a} / \sqrt {\sigma_ {d a t a} ^ {2} + \sigma_ {t} ^ {2}} \tag {15}
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
$$
|
| 347 |
+
c _ {i n} \left(\sigma_ {t}\right) = 1 / \sqrt {\sigma_ {t} ^ {2} + \sigma_ {d a t a} ^ {2}} \tag {16}
|
| 348 |
+
$$
|
| 349 |
+
|
| 350 |
+
$$
|
| 351 |
+
c _ {\text {n o i s e}} \left(\sigma_ {t}\right) = \frac {1}{4} \ln \left(\sigma_ {t}\right). \tag {17}
|
| 352 |
+
$$
|
| 353 |
+
|
| 354 |
+
In practice, the parameter $\sigma_{data}$ is set to 0.1, and the noise distribution is set as $ln(\sigma)\sim \mathcal{N}(P_{mean},P_{std}^2)$ , where the mean and standard deviation parameters are set as $P_{mean} = -3.0$ , $P_{std} = 1.0$ .
|
| 355 |
+
|
| 356 |
+
# B. Additional Details
|
| 357 |
+
|
| 358 |
+
In this section, we elaborate on additional experimental settings, dataset information, and details of the evaluation metrics.
|
| 359 |
+
|
| 360 |
+
# B.1. Experimental Settings
|
| 361 |
+
|
| 362 |
+
We here complement additional implementation details. During training, we set the batch size of dancing and floor exercise videos as 10, and each figure skating batch involves
|
| 363 |
+
|
| 364 |
+
8 samples. For the diffusion probabilistic model backbone, we set the patch block number as 1 and the patch factor as 32. The multipliers of ResnetBlock1d for each upsample block and downsample block are (1, 2, 4, 4, 4, 4, 4), the factors and num_blocks hyperparameter vectors for UNet1d module are (4, 4, 4, 2, 2, 2) and (2, 2, 2, 2, 2, 2), respectively. The head number for all attention blocks is set as 16, and we employ a 0.1 batch dropout probability for the conditional generation. We transform the monophonic input to binaural via duplicating the waveform data on the channel dimension to meet the prerequisite of the pre-trained audio-diffusion-pytorch (Schneider, 2023) model. Besides, we apply data augmentation during training by adding a uniformly-sampled acoustic amplitude to the raw audio sample points. We also normalize the input data and multiply it by a factor $f = 0.95$ to stabilize training. It is also noted that different from previous methods (Zhu et al., 2022b;a), we do not adopt any noise-reducing approach for soundtrack calibration.
|
| 365 |
+
|
| 366 |
+
# B.2. Dataset Information
|
| 367 |
+
|
| 368 |
+
Since all video-music pairs are curated from existing datasets (Zhu et al., 2022a; Li et al., 2021; Shao et al., 2020; Xia et al., 2022; Xu et al., 2019), we manually filter videos based on certain policies to guarantee analogous data distributions while maintaining adequate diversity. Concretely, we keep the character number as 1 and remove all videos with multiple persons, including group dances, pairs skating, and group gymnastics. Furthermore, all kinds of human voices (audience cheers, commentaries, song vocals, etc.) are removed by the sound source separation model Spleeter (Hennequin et al., 2020). For diversity, we try to involve more genders, races, and music types in all rhythmic scenarios. Furthermore, camera views in all video categories are diverse, where shot changes and scales exist in sports videos, and dances are captured via cameras from different angles.
|
| 369 |
+
|
| 370 |
+
# B.3. Evaluation Metrics
|
| 371 |
+
|
| 372 |
+
As we mentioned in the main manuscript, parameters of audio onset detection algorithms (Böck et al., 2012) are adaptively adjusted for the long-term scenario. To be specific, we modify the hyperparameters of the peak-picking strategy, where the previous and post distances of computing the local average are adjusted from 1, 1 to 2, 2, the previous and post distances of calculating local maximum are modified from 0, 1 to 3, 3, and the threshold $\delta$ of picking peaks is set to 0.2. We expand the window size of picking the local maximum, which is likely to have a higher value than the maximum in a smaller area. By this means, the selected local maximum has more opportunities to meet the requirements of the threshold $\delta$ , thus leading to a more compact vector that includes more visual rhythm points.
|
| 373 |
+
|
| 374 |
+

|
| 375 |
+
Figure 4. Illustration of the audio diffusion backbone that includes a latent encoder, u-net, and a latent decoder. The u-net consists of one bottleneck block and K stacking downsample and upsample blocks. The basic unit module name ResnetBlock1d involves several 1D convolutional layers, which form the main architecture of the u-net component.
|
| 376 |
+
|
| 377 |
+
The Mean Opinion Score (MOS) is a subjective metric obtained by computing the average scores of a user study regarding the overall musical quality. Concretely, 14 participants are required to listen to 25 musical waveforms generated by LORIS and four baseline methods (5 samples for each method), then give scores ranging from 1 to 5 to evaluate the overall musical quality. During the evaluation, participants are only provided with auditory samples while visual counterparts are unavailable. Hence, this subjective metric only measures the uni-modal musical quality, and the cross-modality rhythmic correspondence is evaluated by other objective metrics.
|
| 378 |
+
|
| 379 |
+
# C. Visual Rhythm Extractor
|
| 380 |
+
|
| 381 |
+
In this section, we analyze the discrepancy between previous visual rhythm extraction approaches and interpret the rationale of our improved rule-based method. In total, all existing methods, including our improved version, share a common paradigm that captures the magnitude of human cadent movements based on various features. To be spe
|
| 382 |
+
|
| 383 |
+
cific, (Davis & Agrawala, 2018) propose to utilize audio spectrogram and onset detection algorithms on optical flow features to extract visual rhythms, which first show the feasibility of monitoring the amplitude variety of visual cues. But two drawbacks emerge: 1. The extraction of optical flow is computationally-expensive when adopting a large sampling rate of video frames, which sets up an obstacle for the rhythm detection of high-quality videos. 2. The transformation among visual onset, tempograms, and visual beats is complicated, and leveraging the periodic visual beats for inter-modality rhythm alignment severely restrains flexibility. Therefore, it is more succinct to directly regard visual onset as visual rhythms to perform the subsequent cross-modal interaction. More recently, (Su et al., 2021) adopt human poses rather than optical flows to conduct analogous motion saliency detection. Directograms are first computed based on the angular positions and magnitudes of human poses, and Short-Time-Fourier Transform (STFT) is performed on the first-order difference of directograms (kinematic offsets) to locate the visual rhythm points. Two major differences lie between this approach and our rule-based method. One
|
| 384 |
+
|
| 385 |
+
is that we leverage the peak-picking strategy similar (yet different hyperparameters due to the modality discrepancy) to audio onset peak detection algorithm (Böck et al., 2012) instead of STFT to remain similar peak-picking principles. The other is that we prefer the human motions than human poses as input for directogram calculation, since angles of poses $P(t,j,x,y)$ with the x-axis only reflect its relative position with respect to the reference coordinate system, while the angular position of human motion $M(t,j,x,y)$ measures the changing direction and velocity of human poses. Besides, some recent works leverage deep-learning methods to implicitly model visual rhythms (Xie et al., 2019; Wang et al., 2020; Pedersoli & Goto, 2020), or combine traditional algorithms with trainable networks (Yu et al., 2022). Both of them are not employed in our framework in case that much more parameters are additionally introduced.
|
| 386 |
+
|
| 387 |
+
# D. Additional Ablation Studies
|
| 388 |
+
|
| 389 |
+
To fully probe the experimental settings of our proposed model, we conduct additional ablation studies on the sampling hyperparameters.
|
| 390 |
+
|
| 391 |
+
Sampling step. We first investigate the impact of different sampling steps $s$ during inference. Results are shown in Table 7, where the increase of sampling step number from 10 to 50 is accompanied by performance boosts. Furthermore, the performance of $s = 50$ and $s = 100$ is comparable, indicating that a much larger sampling step number cannot benefit generation quality. We hence set the sampling step number as 50 for computation simplicity.
|
| 392 |
+
|
| 393 |
+
<table><tr><td>Step Num</td><td>BCS</td><td>CSD</td><td>BHS</td><td>HSD</td><td>F1</td></tr><tr><td>s=10</td><td>52.5</td><td>26.4</td><td>59.5</td><td>17.9</td><td>55.8</td></tr><tr><td>s=20</td><td>51.1</td><td>25.6</td><td>61.2</td><td>20.6</td><td>55.7</td></tr><tr><td>s=30</td><td>51.4</td><td>26.3</td><td>65.0</td><td>20.2</td><td>57.4</td></tr><tr><td>s=100</td><td>58.3</td><td>20.0</td><td>68.2</td><td>20.5</td><td>62.9</td></tr><tr><td>s=50 (Ours)</td><td>58.8</td><td>19.4</td><td>67.1</td><td>21.1</td><td>62.7</td></tr></table>
|
| 394 |
+
|
| 395 |
+
Guidance scale. We further explore the influence of different guidance scales of the classifier-free diffusion guidance (Ho & Salimans, 2022). As shown in Table 8, we conduct ablation studies on a large range of guidance scale options, and results show that setting $s = 20$ brings optimal rhythmic correspondence performance. Such conclusions are also coherent with other cross-modality conditional scenarios such as text-to-image, where setting a larger guidance scale $w$ than uni-modal conditional generation witnesses a better generation quality.
|
| 396 |
+
|
| 397 |
+
Table 7. Ablation studies on the number of sampling steps $s$ on the ${\mathrm{{LORIS}}}_{FE25}$ subset.
|
| 398 |
+
|
| 399 |
+
<table><tr><td>Guidance Scale</td><td>BCS</td><td>CSD</td><td>BHS</td><td>HSD</td><td>F1</td></tr><tr><td>w=2</td><td>51.8</td><td>26.7</td><td>62.4</td><td>25.1</td><td>56.6</td></tr><tr><td>w=5</td><td>53.4</td><td>27.4</td><td>66.8</td><td>19.9</td><td>59.4</td></tr><tr><td>w=10</td><td>53.2</td><td>23.9</td><td>61.8</td><td>24.5</td><td>57.2</td></tr><tr><td>w=30</td><td>57.9</td><td>22.1</td><td>68.1</td><td>42.0</td><td>62.6</td></tr><tr><td>w=50</td><td>58.3</td><td>20.8</td><td>64.5</td><td>24.5</td><td>61.2</td></tr><tr><td>w=100</td><td>57.9</td><td>23.9</td><td>62.7</td><td>27.2</td><td>60.2</td></tr><tr><td>w=20 (Ours)</td><td>58.8</td><td>19.4</td><td>67.1</td><td>21.1</td><td>62.7</td></tr></table>
|
| 400 |
+
|
| 401 |
+
Table 8. Ablation studies on the guidance scale $w$ of classifier-free conditional generation on the ${\mathrm{{LORIS}}}_{FE25}$ subset.
|
| 402 |
+
|
| 403 |
+
# E. Failure Cases
|
| 404 |
+
|
| 405 |
+
As depicted in Figure 5, we show the log-melspectrograms of two failure examples as well as their ground-truth counterparts. The left part is the soundtrack of a figure skating video, where the skater moves smoothly in sync with the gentle music. Though the musical quality is satisfactory, the changing amplitude of human motions is not significant, thus our model fails to correctly pick visual rhythmic peaks. This instance shows our model's incapability in synthesizing rhythm correlated soundtrack under certain circumstances. We argue that additional samples under such scenarios are required to perform targeted training. The right part denotes the soundtrack of a floor exercise video, where our model generates a musical waveform with extremely low quality. This suggests that the stability and robustness of our model are still in need of progress despite the fact that having equipped with a pre-trained audio diffusion backbone. Demos of all failure cases are provided in the Supplementary Material.
|
| 406 |
+
|
| 407 |
+
# F. Further Discussion
|
| 408 |
+
|
| 409 |
+
# F.1. Limitation
|
| 410 |
+
|
| 411 |
+
LORIS has two main limitations. One is that LORIS only tackles trimmed videos with fixed lengths, which hinders the proposed model to tackle unconstrained data or real-time soundtrack scenarios. One possible solution is to attach a sliding window on the untrimmed video as a segment-wise generation. However, certain modifications are required to construct the global correlation across segments to make the entire auditory sequence continuous and harmonious. The other limitation lies in the dependence on the pre-trained encoder. Analogous with previous methods (Zhu et al., 2022b; a) that utilize a vector-quantized variational autoencoder (Dhariwal et al., 2020), our method relies on the pre-trained latent diffusion model (Schneider, 2023), resulting in the inflexibility of appending or replacing several particular components.
|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
Figure 5. Log-melspectrograms of two failure examples. The upper part denotes the synthesized music and the lower part indicates the ground-truth soundtracks.
|
| 415 |
+
|
| 416 |
+
# F.2. Potential Social Impact
|
| 417 |
+
|
| 418 |
+
Our generative model may be employed to produce fake videos with forgery soundtracks. Furthermore, equipped with DeepFake videos synthesized by video generative algorithms, a complete forgery audio-visual pair can be automatically fabricated, which may have potential negative impacts on the web environment. Hence, appropriate supervision is essential to guarantee a controllable and harmless generation.
|
2023/Long-Term Rhythmic Video Soundtracker/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19aa48485d78074589aa0dea93c5fdef09330f36c3578332f6591d463400fd56
|
| 3 |
+
size 785488
|
2023/Long-Term Rhythmic Video Soundtracker/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/764c4fd6-5564-414d-aed4-faf9cde1cc97_content_list.json
ADDED
|
@@ -0,0 +1,1550 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
89,
|
| 8 |
+
109,
|
| 9 |
+
883,
|
| 10 |
+
132
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Daya Guo $^{*1}$ Canwen Xu $^{*2}$ Nan Duan $^{3}$ Jian Yin $^{1}$ Julian McAuley $^{2}$",
|
| 17 |
+
"bbox": [
|
| 18 |
+
233,
|
| 19 |
+
176,
|
| 20 |
+
736,
|
| 21 |
+
194
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "Abstract",
|
| 28 |
+
"text_level": 1,
|
| 29 |
+
"bbox": [
|
| 30 |
+
241,
|
| 31 |
+
220,
|
| 32 |
+
320,
|
| 33 |
+
234
|
| 34 |
+
],
|
| 35 |
+
"page_idx": 0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"type": "text",
|
| 39 |
+
"text": "In this paper, we introduce a new task for code completion that focuses on handling long code input and propose a sparse Transformer model, called LongCoder, to address this task. LongCoder employs a sliding window mechanism for self-attention and introduces two types of globally accessible tokens — bridge tokens and memory tokens — to improve performance and efficiency. Bridge tokens are inserted throughout the input sequence to aggregate local information and facilitate global interaction, while memory tokens are included to highlight important statements that may be invoked later and need to be memorized, such as package imports and definitions of classes, functions, or structures. We conduct experiments on a newly constructed dataset that contains longer code context and the publicly available CodeXGLUE benchmark. Experimental results demonstrate that LongCoder achieves superior performance on code completion tasks compared to previous models while maintaining comparable efficiency in terms of computational resources during inference.",
|
| 40 |
+
"bbox": [
|
| 41 |
+
117,
|
| 42 |
+
239,
|
| 43 |
+
444,
|
| 44 |
+
588
|
| 45 |
+
],
|
| 46 |
+
"page_idx": 0
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": "1. Introduction",
|
| 51 |
+
"text_level": 1,
|
| 52 |
+
"bbox": [
|
| 53 |
+
86,
|
| 54 |
+
614,
|
| 55 |
+
217,
|
| 56 |
+
630
|
| 57 |
+
],
|
| 58 |
+
"page_idx": 0
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"type": "text",
|
| 62 |
+
"text": "Code completion is a crucial task in software development that helps developers save time and effort by suggesting and auto-completing code based on context. With the advancement of large language models, Transformer-based models (Vaswani et al., 2017) have demonstrated impressive results in code completion (Chen et al., 2021). However, the computational cost of these models grows quadratically with the length of input, making them less suitable for modeling long code context. On the other hand, modeling long code can potentially improve the accuracy of code completion and enable applications on a file and even project level.",
|
| 63 |
+
"bbox": [
|
| 64 |
+
84,
|
| 65 |
+
638,
|
| 66 |
+
475,
|
| 67 |
+
806
|
| 68 |
+
],
|
| 69 |
+
"page_idx": 0
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"type": "text",
|
| 73 |
+
"text": "*Equal contribution ${}^{1}$ Sun Yat-sen University ${}^{2}$ University of California, San Diego ${}^{3}$ Microsoft Research Asia. Correspondence to: Daya Guo <guody5@mail2.sysu.edu.cn>.",
|
| 74 |
+
"bbox": [
|
| 75 |
+
84,
|
| 76 |
+
815,
|
| 77 |
+
473,
|
| 78 |
+
854
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).",
|
| 85 |
+
"bbox": [
|
| 86 |
+
84,
|
| 87 |
+
864,
|
| 88 |
+
473,
|
| 89 |
+
905
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "An efficient model that can scale to such long input can be suitable for code completion that contains long context.",
|
| 96 |
+
"bbox": [
|
| 97 |
+
496,
|
| 98 |
+
220,
|
| 99 |
+
885,
|
| 100 |
+
252
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "In this paper, we propose a new pre-trained language model, named LongCoder, for long code modeling. As shown in Figure 1, LongCoder features a sparse attention mechanism that reduces the computational complexity (to linear). LongCoder exploits a sliding window mechanism for self-attention that attends only to local context. To allow LongCoder to maintain an understanding of the entire code file, we introduce bridge attention and global attention, with the corresponding two types of globally accessible tokens, bridge tokens and memory tokens. Bridge attention aggregates the information of a code snippet and allows it to be accessed from a long distance. Bridge tokens are inserted throughout the input sequence and can attend to a fixed length of context. Memory tokens provide global attention to statements that include a package import, definitions of classes, functions, or structures. The scope of these statements is often global and invoked later, which means they have a longer impact than other statements, making them worth memorizing. By referring to these statements, the model can exploit long context while maintaining linear complexity.",
|
| 107 |
+
"bbox": [
|
| 108 |
+
495,
|
| 109 |
+
258,
|
| 110 |
+
887,
|
| 111 |
+
575
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 0
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "text",
|
| 117 |
+
"text": "To evaluate the effectiveness of LongCoder and encourage future research on Long Code Completion, we construct a new dataset called LCC by filtering code from GitHub based on length, with the goal of focusing on longer code examples. On average, the examples in LCC are $5 \\times$ longer than those in existing datasets (Lu et al., 2021). We benchmark several baselines, LongCoder and OpenAI Codex (Chen et al., 2021) on LCC. Our experimental results demonstrate that code completion can benefit from taking longer context into consideration, and our LongCoder achieves superior performance compared to existing models with comparable computational costs.",
|
| 118 |
+
"bbox": [
|
| 119 |
+
495,
|
| 120 |
+
584,
|
| 121 |
+
885,
|
| 122 |
+
765
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 0
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "text",
|
| 128 |
+
"text": "Overall, our contributions are as follows:",
|
| 129 |
+
"bbox": [
|
| 130 |
+
496,
|
| 131 |
+
772,
|
| 132 |
+
769,
|
| 133 |
+
787
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 0
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "list",
|
| 139 |
+
"sub_type": "text",
|
| 140 |
+
"list_items": [
|
| 141 |
+
"- We construct a new dataset (LCC) for code completion tasks that requires long code modeling to encourage more research in such scenarios.",
|
| 142 |
+
"- We propose two types of sparse attention, motivated by observations on attention patterns of existing models and how human programmers write code."
|
| 143 |
+
],
|
| 144 |
+
"bbox": [
|
| 145 |
+
514,
|
| 146 |
+
805,
|
| 147 |
+
883,
|
| 148 |
+
904
|
| 149 |
+
],
|
| 150 |
+
"page_idx": 0
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"type": "page_number",
|
| 154 |
+
"text": "1",
|
| 155 |
+
"bbox": [
|
| 156 |
+
480,
|
| 157 |
+
922,
|
| 158 |
+
491,
|
| 159 |
+
934
|
| 160 |
+
],
|
| 161 |
+
"page_idx": 0
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"type": "text",
|
| 165 |
+
"text": "Out-of-Window Context",
|
| 166 |
+
"text_level": 1,
|
| 167 |
+
"bbox": [
|
| 168 |
+
116,
|
| 169 |
+
87,
|
| 170 |
+
267,
|
| 171 |
+
99
|
| 172 |
+
],
|
| 173 |
+
"page_idx": 1
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"type": "code",
|
| 177 |
+
"sub_type": "code",
|
| 178 |
+
"code_caption": [],
|
| 179 |
+
"code_body": "import torch\\n \nimport torch nn as nn\\n \nimport torch nnfunctional as F\\n \nclass ConvBlock(nnModule): \\n \n\"A block of convolutional and pooling layers.\" \n\"A\" \ndef __init__(self, in_channels, out_channels, kernel_size, stride, padding): \\nsuper(ConvBlock, self).__init() \nself.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding) \nself.pool = nn.MaxPool2d(kernel_size=2) \ndef forward(self, x): \\nx = self.pool(F.ReLU(self.conv(x))) \nreturn x",
|
| 180 |
+
"guess_lang": "python",
|
| 181 |
+
"bbox": [
|
| 182 |
+
112,
|
| 183 |
+
108,
|
| 184 |
+
651,
|
| 185 |
+
258
|
| 186 |
+
],
|
| 187 |
+
"page_idx": 1
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"type": "text",
|
| 191 |
+
"text": "In-Window Context",
|
| 192 |
+
"text_level": 1,
|
| 193 |
+
"bbox": [
|
| 194 |
+
116,
|
| 195 |
+
270,
|
| 196 |
+
238,
|
| 197 |
+
282
|
| 198 |
+
],
|
| 199 |
+
"page_idx": 1
|
| 200 |
+
},
|
| 201 |
+
{
|
| 202 |
+
"type": "code",
|
| 203 |
+
"sub_type": "code",
|
| 204 |
+
"code_caption": [],
|
| 205 |
+
"code_body": "class ConvNet(nnModule): \\n\n\"A convolutional neural network\n''\ndef __init__(self):\n super(ConvNet, self).__init()\n self.conv_block1 = ConvBlock(3, 32, 3, 1, 1) #first block\n self.conv_block2 = ConvBlock(32, 64, 3, 1, 1) #second block\n self/flatten = nn.Conv()\n self.fc1 = nn.Linear(\n in_features=64 * 8 * 8, out_features=128)\n self.fc2 = nn.Linear(\n in_features=128, out_features=10)",
|
| 206 |
+
"guess_lang": "python",
|
| 207 |
+
"bbox": [
|
| 208 |
+
112,
|
| 209 |
+
291,
|
| 210 |
+
658,
|
| 211 |
+
429
|
| 212 |
+
],
|
| 213 |
+
"page_idx": 1
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"type": "text",
|
| 217 |
+
"text": "Code to Complete",
|
| 218 |
+
"text_level": 1,
|
| 219 |
+
"bbox": [
|
| 220 |
+
112,
|
| 221 |
+
453,
|
| 222 |
+
228,
|
| 223 |
+
465
|
| 224 |
+
],
|
| 225 |
+
"page_idx": 1
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"type": "code",
|
| 229 |
+
"sub_type": "code",
|
| 230 |
+
"code_caption": [],
|
| 231 |
+
"code_body": "def forward(self, x):\n x = self.convert_block( x )\n x = self.convert_block( x )\n x = self.flatten( x )\n x = F.relu(self.fcl( x ))\n x = self.fc2( x )\n return x",
|
| 232 |
+
"guess_lang": "python",
|
| 233 |
+
"bbox": [
|
| 234 |
+
112,
|
| 235 |
+
473,
|
| 236 |
+
318,
|
| 237 |
+
540
|
| 238 |
+
],
|
| 239 |
+
"page_idx": 1
|
| 240 |
+
},
|
| 241 |
+
{
|
| 242 |
+
"type": "image",
|
| 243 |
+
"img_path": "images/a4f4e7291dd9cde2d4777b7d35dcb38e848482d470ae93583c56247416147822.jpg",
|
| 244 |
+
"image_caption": [
|
| 245 |
+
"Figure 1. (Left) An example of how LongCoder facilitates completion with longer context. The memory tokens save potentially useful information (including package imports, class and function definitions) for global access despite whether they are within the sliding window. The bridge tokens aggregate local information by attending to a fixed length of tokens. The information flow within the window is omitted for clarity. (Right) Attention patterns used in BigBird (Zaheer et al., 2020), Longformer (Beltagy et al., 2020) and LongCoder. Best viewed in color."
|
| 246 |
+
],
|
| 247 |
+
"image_footnote": [],
|
| 248 |
+
"bbox": [
|
| 249 |
+
403,
|
| 250 |
+
464,
|
| 251 |
+
580,
|
| 252 |
+
547
|
| 253 |
+
],
|
| 254 |
+
"page_idx": 1
|
| 255 |
+
},
|
| 256 |
+
{
|
| 257 |
+
"type": "text",
|
| 258 |
+
"text": "Attention Pattern",
|
| 259 |
+
"text_level": 1,
|
| 260 |
+
"bbox": [
|
| 261 |
+
692,
|
| 262 |
+
87,
|
| 263 |
+
802,
|
| 264 |
+
99
|
| 265 |
+
],
|
| 266 |
+
"page_idx": 1
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
"type": "image",
|
| 270 |
+
"img_path": "images/453ce0266f2ab59bf0f90786fe4a528b2fceaa57f29c0e29e1cae68d0e996acd.jpg",
|
| 271 |
+
"image_caption": [],
|
| 272 |
+
"image_footnote": [],
|
| 273 |
+
"bbox": [
|
| 274 |
+
723,
|
| 275 |
+
114,
|
| 276 |
+
833,
|
| 277 |
+
213
|
| 278 |
+
],
|
| 279 |
+
"page_idx": 1
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"type": "image",
|
| 283 |
+
"img_path": "images/46de972eeafbde7d42a7d16455a196027922d9cb566b9f520ffc21f8a19eb561.jpg",
|
| 284 |
+
"image_caption": [],
|
| 285 |
+
"image_footnote": [],
|
| 286 |
+
"bbox": [
|
| 287 |
+
723,
|
| 288 |
+
232,
|
| 289 |
+
833,
|
| 290 |
+
340
|
| 291 |
+
],
|
| 292 |
+
"page_idx": 1
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"type": "image",
|
| 296 |
+
"img_path": "images/2db0dd2bce4d5d38af19b5b61bd9aa1efc400a8b3f1c21d51c550d701901d00f.jpg",
|
| 297 |
+
"image_caption": [],
|
| 298 |
+
"image_footnote": [],
|
| 299 |
+
"bbox": [
|
| 300 |
+
723,
|
| 301 |
+
366,
|
| 302 |
+
833,
|
| 303 |
+
465
|
| 304 |
+
],
|
| 305 |
+
"page_idx": 1
|
| 306 |
+
},
|
| 307 |
+
{
|
| 308 |
+
"type": "image",
|
| 309 |
+
"img_path": "images/1a1fc18b0c3e72421c5e99296a0cdb9bde58960395ce53e72f17b0c620d42c00.jpg",
|
| 310 |
+
"image_caption": [],
|
| 311 |
+
"image_footnote": [],
|
| 312 |
+
"bbox": [
|
| 313 |
+
723,
|
| 314 |
+
477,
|
| 315 |
+
833,
|
| 316 |
+
526
|
| 317 |
+
],
|
| 318 |
+
"page_idx": 1
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"type": "text",
|
| 322 |
+
"text": "- We train and release LongCoder, a sparse and efficient pre-trained Transformer model for long code modeling, which achieves superior performance on both long and regular code completion with comparable computational resources.",
|
| 323 |
+
"bbox": [
|
| 324 |
+
104,
|
| 325 |
+
669,
|
| 326 |
+
475,
|
| 327 |
+
742
|
| 328 |
+
],
|
| 329 |
+
"page_idx": 1
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"type": "text",
|
| 333 |
+
"text": "2. Related Work",
|
| 334 |
+
"text_level": 1,
|
| 335 |
+
"bbox": [
|
| 336 |
+
84,
|
| 337 |
+
763,
|
| 338 |
+
227,
|
| 339 |
+
779
|
| 340 |
+
],
|
| 341 |
+
"page_idx": 1
|
| 342 |
+
},
|
| 343 |
+
{
|
| 344 |
+
"type": "text",
|
| 345 |
+
"text": "Code Completion Code completion is an essential task that helps programmers improve their efficiency by suggesting and automatically completing code based on context and previous inputs. Prior works have explored the use of statistical learning for the code completion task, such as the use of",
|
| 346 |
+
"bbox": [
|
| 347 |
+
84,
|
| 348 |
+
789,
|
| 349 |
+
475,
|
| 350 |
+
864
|
| 351 |
+
],
|
| 352 |
+
"page_idx": 1
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"type": "text",
|
| 356 |
+
"text": "n-gram techniques (Tu et al., 2014; Hindle et al., 2016) and probabilistic grammar-based methods (Allamanis & Sutton, 2014; Bielik et al., 2016; Raychev et al., 2016; Hellendoorn & Devanbu, 2017). With the success of pre-training in natural language processing (Devlin et al., 2019; Radford et al., 2019; Brown et al., 2020), decoder-only pre-trained models based on Transformer have been proposed to promote the development of code completion. Svyatkovskiy et al. (2020) and Lu et al. (2021) respectively propose GPT-C and CodeGPT, which are pre-trained by generating code from left to right in an auto-regressive manner on large amounts of code. Liu et al. (2020) and Guo et al. (2022) pre-train similar models CugLM and UniXcoder with multi-task learning by leveraging code structure for code completion. Codex (Chen et al., 2021), PolyCoder (Xu et al., 2022), CodeGen",
|
| 357 |
+
"bbox": [
|
| 358 |
+
495,
|
| 359 |
+
667,
|
| 360 |
+
887,
|
| 361 |
+
896
|
| 362 |
+
],
|
| 363 |
+
"page_idx": 1
|
| 364 |
+
},
|
| 365 |
+
{
|
| 366 |
+
"type": "header",
|
| 367 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 368 |
+
"bbox": [
|
| 369 |
+
236,
|
| 370 |
+
56,
|
| 371 |
+
733,
|
| 372 |
+
70
|
| 373 |
+
],
|
| 374 |
+
"page_idx": 1
|
| 375 |
+
},
|
| 376 |
+
{
|
| 377 |
+
"type": "page_footnote",
|
| 378 |
+
"text": "1All the codes and data are available at https://github. com/microsoft/CodeBERT.",
|
| 379 |
+
"bbox": [
|
| 380 |
+
84,
|
| 381 |
+
875,
|
| 382 |
+
477,
|
| 383 |
+
902
|
| 384 |
+
],
|
| 385 |
+
"page_idx": 1
|
| 386 |
+
},
|
| 387 |
+
{
|
| 388 |
+
"type": "page_number",
|
| 389 |
+
"text": "2",
|
| 390 |
+
"bbox": [
|
| 391 |
+
480,
|
| 392 |
+
922,
|
| 393 |
+
491,
|
| 394 |
+
934
|
| 395 |
+
],
|
| 396 |
+
"page_idx": 1
|
| 397 |
+
},
|
| 398 |
+
{
|
| 399 |
+
"type": "text",
|
| 400 |
+
"text": "(Nijkamp et al., 2022), InCoder (Fried et al., 2022), and AlphaCode (Li et al., 2022) build large language models with billions of parameters and achieve impressive performance on code generation by training on a large-scale and high-quality code corpus. For these pre-trained models, it is impractical to simply expand the context window to model long-range sequences, due to computational complexity of the attention mechanism increasing quadratically with the input length. Therefore, Clement et al. (2021) propose to extract the most important code fragments and integrate them into a fixed-length context window. However, due to the constraint of fixed window length, some high-priority code, such as class and function definitions, may be omitted. Additionally, increasing the window length would also introduce additional computational overhead. Different from these works, LongCoder is a sparse Transformer that can take advantage of the entire file-level code context while maintaining comparable efficiency in terms of computational resources during inference.",
|
| 401 |
+
"bbox": [
|
| 402 |
+
84,
|
| 403 |
+
84,
|
| 404 |
+
475,
|
| 405 |
+
371
|
| 406 |
+
],
|
| 407 |
+
"page_idx": 2
|
| 408 |
+
},
|
| 409 |
+
{
|
| 410 |
+
"type": "text",
|
| 411 |
+
"text": "Long-Range Transformer Models The original Transformer (Vaswani et al., 2017) is inefficient for modeling long sequences since its time and space complexity is $O(n^{2})$ , where $n$ is the length of the sequence. Prior studies focus on optimizing the complexity to enable processing of longer sequences. To name a few, Sparse Transformer (Child et al., 2019) reduces the quadratic complexity of standard selfattention by computing attention on sparse query-key pairs. Sparse Transformer uses a dilated sliding window to capture local context. Reformer (Kitaev et al., 2020) proposes locality sensitive hashing (LSH) attention to reduce the complexity and memory footprint. Longformer (Beltagy et al., 2020) uses dilated sliding windows to model longer sequences and adds global memory tokens to allow interaction with all tokens. Performer (Choromanski et al., 2021) generalizes attention calculation by introducing kernel functions. They then propose a random kernel function, namely orthogonal random features (ORF) to approximate the standard selfattention. Linformer (Wang et al., 2020) applies low-rank projection to the length dimension to reduce the complexity of self-attention. Linear Transformers (Katharopoulos et al., 2020) uses a kernel function that exploits the associativity property of matrix products to reduce complexity. BigBird (Zaheer et al., 2020) has an attention pattern comprised of random attention, window attention and global attention. CosFormer (Qin et al., 2022) proposes a linear operator and a cosine-based distance re-weighting mechanism as the substitute for softmax attention. We recommend Tay et al. (2022) as a more comprehensive survey on long-range efficient Transformer models. Different from these works, our LongCoder introduces code heuristics into the dynamic construction of global attention to imitate how human programmers code.",
|
| 412 |
+
"bbox": [
|
| 413 |
+
84,
|
| 414 |
+
407,
|
| 415 |
+
477,
|
| 416 |
+
906
|
| 417 |
+
],
|
| 418 |
+
"page_idx": 2
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
"type": "text",
|
| 422 |
+
"text": "3. Long Code Completion",
|
| 423 |
+
"text_level": 1,
|
| 424 |
+
"bbox": [
|
| 425 |
+
496,
|
| 426 |
+
83,
|
| 427 |
+
718,
|
| 428 |
+
101
|
| 429 |
+
],
|
| 430 |
+
"page_idx": 2
|
| 431 |
+
},
|
| 432 |
+
{
|
| 433 |
+
"type": "text",
|
| 434 |
+
"text": "Code completion is a fundamental and important task for code models, which can help programmers improve their efficiency while coding. Previous public benchmarks primarily focused on completion with short code context. For instance, CodeXGLUE (Lu et al., 2021) offers two code completion datasets from PY150 (Raychev et al., 2016) in Python and Github Java Corpus Allamanis & Sutton (2013) in Java, and also builds two test datasets to evaluate next-line prediction. The average length of the code context in the two test datasets is 478 tokens and 365 tokens, respectively. However, according to our statistics, the average length of a Python source file on GitHub is 1,305 tokens. After tokenization, the average length becomes 2,090 tokens while $41\\% / 24\\%$ of the files have a length longer than 1,024/2,048 tokens, which highlights the need for models that can handle longer code sequences in order to be more practical and useful in the real-world. Meanwhile, longer code sequences contain more complex structures and require models to consider more context and dependencies. This can be challenging for previously proposed code completion models that focus on short code and do not take into account the long context of the code. By evaluating models on longer code sequences, we can better understand their ability to handle more complex and realistic scenarios. Meanwhile, long code completion poses new challenges for efficiency of code models, as in vanilla Transformers (Vaswani et al., 2017), the computational resources grow quadratically with the input length.",
|
| 435 |
+
"bbox": [
|
| 436 |
+
495,
|
| 437 |
+
109,
|
| 438 |
+
888,
|
| 439 |
+
532
|
| 440 |
+
],
|
| 441 |
+
"page_idx": 2
|
| 442 |
+
},
|
| 443 |
+
{
|
| 444 |
+
"type": "text",
|
| 445 |
+
"text": "In this paper, we introduce the Long Code Completion Benchmark (LCC), a new benchmark that focuses on code completion with long code context for three programming languages: Python, Java, and C#. Specifically, we construct our datasets from the github-code $^2$ dataset, which contains a vast number of code files sourced from GitHub with an open-source license that permits research use. The steps to construct the datasets are as follows:",
|
| 446 |
+
"bbox": [
|
| 447 |
+
495,
|
| 448 |
+
539,
|
| 449 |
+
887,
|
| 450 |
+
659
|
| 451 |
+
],
|
| 452 |
+
"page_idx": 2
|
| 453 |
+
},
|
| 454 |
+
{
|
| 455 |
+
"type": "list",
|
| 456 |
+
"sub_type": "text",
|
| 457 |
+
"list_items": [
|
| 458 |
+
"- We first follow Allamanis (2019) to deduplicate examples with high similarity (Jacobi similarity $\\geq 0.9$ ) in order to eliminate forked files, and then remove code files that can't be parsed into an abstract syntax tree using a standard compiler tool called tree-sitter. $^3$",
|
| 459 |
+
"- Since the benchmark primarily focuses on the code completion task with long code context, we remove code files whose length of code tokens after tokenization is shorter than 512. Additionally, we also eliminate excessively long code files with a length greater than"
|
| 460 |
+
],
|
| 461 |
+
"bbox": [
|
| 462 |
+
514,
|
| 463 |
+
678,
|
| 464 |
+
887,
|
| 465 |
+
843
|
| 466 |
+
],
|
| 467 |
+
"page_idx": 2
|
| 468 |
+
},
|
| 469 |
+
{
|
| 470 |
+
"type": "header",
|
| 471 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 472 |
+
"bbox": [
|
| 473 |
+
236,
|
| 474 |
+
56,
|
| 475 |
+
736,
|
| 476 |
+
70
|
| 477 |
+
],
|
| 478 |
+
"page_idx": 2
|
| 479 |
+
},
|
| 480 |
+
{
|
| 481 |
+
"type": "page_footnote",
|
| 482 |
+
"text": "$^{2}$ https://huggingface.co/datasets/codeparrot.github-code",
|
| 483 |
+
"bbox": [
|
| 484 |
+
496,
|
| 485 |
+
851,
|
| 486 |
+
810,
|
| 487 |
+
877
|
| 488 |
+
],
|
| 489 |
+
"page_idx": 2
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
"type": "page_footnote",
|
| 493 |
+
"text": "3https://github.com/tree-sitter/ tree-sitter",
|
| 494 |
+
"bbox": [
|
| 495 |
+
496,
|
| 496 |
+
877,
|
| 497 |
+
800,
|
| 498 |
+
902
|
| 499 |
+
],
|
| 500 |
+
"page_idx": 2
|
| 501 |
+
},
|
| 502 |
+
{
|
| 503 |
+
"type": "page_number",
|
| 504 |
+
"text": "3",
|
| 505 |
+
"bbox": [
|
| 506 |
+
480,
|
| 507 |
+
922,
|
| 508 |
+
491,
|
| 509 |
+
934
|
| 510 |
+
],
|
| 511 |
+
"page_idx": 2
|
| 512 |
+
},
|
| 513 |
+
{
|
| 514 |
+
"type": "table",
|
| 515 |
+
"img_path": "images/ace8764af782bedf83eba834af75b24ef05bca08de8a1dc1372ce23bd11c754d.jpg",
|
| 516 |
+
"table_caption": [
|
| 517 |
+
"Table 1. Data statistics of the code context length in LCC test set. $25\\% /50\\% /75\\%$ refer to the first/second/third quartile."
|
| 518 |
+
],
|
| 519 |
+
"table_footnote": [],
|
| 520 |
+
"table_body": "<table><tr><td>Language</td><td>Average</td><td>25%</td><td>50%</td><td>75%</td></tr><tr><td>Python</td><td>1993.3</td><td>1056</td><td>1438</td><td>2211</td></tr><tr><td>Java</td><td>1841.4</td><td>1058</td><td>1307</td><td>2003</td></tr><tr><td>C#</td><td>1970.5</td><td>1023</td><td>1396</td><td>2143</td></tr></table>",
|
| 521 |
+
"bbox": [
|
| 522 |
+
120,
|
| 523 |
+
126,
|
| 524 |
+
439,
|
| 525 |
+
204
|
| 526 |
+
],
|
| 527 |
+
"page_idx": 3
|
| 528 |
+
},
|
| 529 |
+
{
|
| 530 |
+
"type": "text",
|
| 531 |
+
"text": "10,000 tokens.",
|
| 532 |
+
"bbox": [
|
| 533 |
+
117,
|
| 534 |
+
238,
|
| 535 |
+
217,
|
| 536 |
+
252
|
| 537 |
+
],
|
| 538 |
+
"page_idx": 3
|
| 539 |
+
},
|
| 540 |
+
{
|
| 541 |
+
"type": "text",
|
| 542 |
+
"text": "- For each programming language, we sample 100k examples for training, and 10k examples for development and 10k for testing. For each sample on development and test sets, we randomly sample an uncommented line of code not shorted than 3 tokens and ensure that there is sufficient context, i.e., a context larger than 512 code tokens. The data statistics of the context length in the LCC test sets are listed in Table 1.",
|
| 543 |
+
"bbox": [
|
| 544 |
+
104,
|
| 545 |
+
270,
|
| 546 |
+
475,
|
| 547 |
+
391
|
| 548 |
+
],
|
| 549 |
+
"page_idx": 3
|
| 550 |
+
},
|
| 551 |
+
{
|
| 552 |
+
"type": "text",
|
| 553 |
+
"text": "We follow Lu et al. (2021) to evaluate the performance of the models in terms of Exact Match (EM) and Edit Similarity (Edit Sim) on a per-line basis (Svyatkovskiy et al., 2020).",
|
| 554 |
+
"bbox": [
|
| 555 |
+
84,
|
| 556 |
+
412,
|
| 557 |
+
473,
|
| 558 |
+
459
|
| 559 |
+
],
|
| 560 |
+
"page_idx": 3
|
| 561 |
+
},
|
| 562 |
+
{
|
| 563 |
+
"type": "text",
|
| 564 |
+
"text": "4. LongCoder",
|
| 565 |
+
"text_level": 1,
|
| 566 |
+
"bbox": [
|
| 567 |
+
84,
|
| 568 |
+
477,
|
| 569 |
+
207,
|
| 570 |
+
494
|
| 571 |
+
],
|
| 572 |
+
"page_idx": 3
|
| 573 |
+
},
|
| 574 |
+
{
|
| 575 |
+
"type": "text",
|
| 576 |
+
"text": "LongCoder is an attempt to tackle the efficiency problem of modeling longer code. It applies sparse attention to reduce quadratic time and space complexity of self-attention to linear. There are three types of attention in LongCoder — window attention, bridge attention, and global attention. Each type is motivated by observations on previous models and focuses on one important aspect in modeling long code. The three types of attention are illustrated in Figure 1 and we will describe them individually.",
|
| 577 |
+
"bbox": [
|
| 578 |
+
81,
|
| 579 |
+
502,
|
| 580 |
+
475,
|
| 581 |
+
640
|
| 582 |
+
],
|
| 583 |
+
"page_idx": 3
|
| 584 |
+
},
|
| 585 |
+
{
|
| 586 |
+
"type": "text",
|
| 587 |
+
"text": "4.1. Window Attention",
|
| 588 |
+
"text_level": 1,
|
| 589 |
+
"bbox": [
|
| 590 |
+
84,
|
| 591 |
+
656,
|
| 592 |
+
248,
|
| 593 |
+
669
|
| 594 |
+
],
|
| 595 |
+
"page_idx": 3
|
| 596 |
+
},
|
| 597 |
+
{
|
| 598 |
+
"type": "text",
|
| 599 |
+
"text": "Code completion largely relies on local context while only a few instances of long-distance dependencies are present. For example, in Figure 1 (bottom left), generating assignment operators and parentheses only depend on the current statement, whereas to generate variables such as $x$ and conv_block, the model needs to look at neighboring statements. Intuitively, we can exploit such locality to sparsify the attention to achieve better efficiency. We further verify this observation by counting the distribution of average attention scores between two tokens within different distances. As shown in Figure 2, a large portion of attention is concentrated within a narrow window. Notably, a fixed window of 256 covers more than $90\\%$ of the attention weights. This sparsity enables us to apply a sliding window attention mechanism (Beltagy et al., 2020; Zaheer et al., 2020).",
|
| 600 |
+
"bbox": [
|
| 601 |
+
84,
|
| 602 |
+
678,
|
| 603 |
+
477,
|
| 604 |
+
905
|
| 605 |
+
],
|
| 606 |
+
"page_idx": 3
|
| 607 |
+
},
|
| 608 |
+
{
|
| 609 |
+
"type": "image",
|
| 610 |
+
"img_path": "images/adeb58c6a7d4d3ba3d4c608690512e0f941ce38cde51f8417dcf9e90ea7eb139.jpg",
|
| 611 |
+
"image_caption": [
|
| 612 |
+
"Figure 2. Distribution of average attention scores between two tokens within different distances in CodeGPT (Lu et al., 2021). The attention score is an average of 100 Python code examples across all Transformer layers."
|
| 613 |
+
],
|
| 614 |
+
"image_footnote": [],
|
| 615 |
+
"bbox": [
|
| 616 |
+
511,
|
| 617 |
+
85,
|
| 618 |
+
867,
|
| 619 |
+
252
|
| 620 |
+
],
|
| 621 |
+
"page_idx": 3
|
| 622 |
+
},
|
| 623 |
+
{
|
| 624 |
+
"type": "text",
|
| 625 |
+
"text": "Formally, given the linear projections $Q$ , $K$ , $V$ , the self-attention scores in Transformer are calculated as follows:",
|
| 626 |
+
"bbox": [
|
| 627 |
+
496,
|
| 628 |
+
351,
|
| 629 |
+
887,
|
| 630 |
+
380
|
| 631 |
+
],
|
| 632 |
+
"page_idx": 3
|
| 633 |
+
},
|
| 634 |
+
{
|
| 635 |
+
"type": "equation",
|
| 636 |
+
"text": "\n$$\n\\operatorname {A t t e n t i o n} (Q, K, V) = \\operatorname {s o f t m a x} \\left(\\frac {Q K ^ {T}}{\\sqrt {d _ {k}}} + M\\right) V \\tag {1}\n$$\n",
|
| 637 |
+
"text_format": "latex",
|
| 638 |
+
"bbox": [
|
| 639 |
+
519,
|
| 640 |
+
388,
|
| 641 |
+
885,
|
| 642 |
+
422
|
| 643 |
+
],
|
| 644 |
+
"page_idx": 3
|
| 645 |
+
},
|
| 646 |
+
{
|
| 647 |
+
"type": "text",
|
| 648 |
+
"text": "where $M$ is a mask matrix (to be completed in Equation 5) to control the context a token can attend to when computing its contextual representation. If the $i$ -th token is allowed to attend to the $j$ -th token, then $M_{ij}$ is set to 0, otherwise $-\\infty$ .",
|
| 649 |
+
"bbox": [
|
| 650 |
+
496,
|
| 651 |
+
431,
|
| 652 |
+
887,
|
| 653 |
+
492
|
| 654 |
+
],
|
| 655 |
+
"page_idx": 3
|
| 656 |
+
},
|
| 657 |
+
{
|
| 658 |
+
"type": "text",
|
| 659 |
+
"text": "For window attention, the mask attention matrix $M^{window}$ is calculated as follows:",
|
| 660 |
+
"bbox": [
|
| 661 |
+
496,
|
| 662 |
+
498,
|
| 663 |
+
885,
|
| 664 |
+
527
|
| 665 |
+
],
|
| 666 |
+
"page_idx": 3
|
| 667 |
+
},
|
| 668 |
+
{
|
| 669 |
+
"type": "equation",
|
| 670 |
+
"text": "\n$$\nM _ {i j} ^ {\\text {w i n d o w}} = \\left\\{ \\begin{array}{l l} 0 & \\text {i f} i - j \\leq w \\\\ - \\infty & \\text {o t h e r w i s e} \\end{array} \\right. \\tag {2}\n$$\n",
|
| 671 |
+
"text_format": "latex",
|
| 672 |
+
"bbox": [
|
| 673 |
+
575,
|
| 674 |
+
536,
|
| 675 |
+
885,
|
| 676 |
+
578
|
| 677 |
+
],
|
| 678 |
+
"page_idx": 3
|
| 679 |
+
},
|
| 680 |
+
{
|
| 681 |
+
"type": "text",
|
| 682 |
+
"text": "where $w$ is the window size. This window attention pattern reduces the complexity of the self-attention mechanism by limiting the receptive field size of each token to a small window of size $w$ at each layer. The computation complexity of this pattern is $O(n \\times w)$ , which scales linearly with input sequence length $n$ . After applying $N$ transformer layers of such sliding window attention, the receptive field size increases to $N \\times w$ at the top layer. Since each token only attends to $w$ tokens to its left rather than the entire preceding sequence, the model can achieve faster inference speed.",
|
| 683 |
+
"bbox": [
|
| 684 |
+
495,
|
| 685 |
+
593,
|
| 686 |
+
885,
|
| 687 |
+
744
|
| 688 |
+
],
|
| 689 |
+
"page_idx": 3
|
| 690 |
+
},
|
| 691 |
+
{
|
| 692 |
+
"type": "text",
|
| 693 |
+
"text": "4.2. Bridge Attention",
|
| 694 |
+
"text_level": 1,
|
| 695 |
+
"bbox": [
|
| 696 |
+
496,
|
| 697 |
+
761,
|
| 698 |
+
648,
|
| 699 |
+
776
|
| 700 |
+
],
|
| 701 |
+
"page_idx": 3
|
| 702 |
+
},
|
| 703 |
+
{
|
| 704 |
+
"type": "text",
|
| 705 |
+
"text": "Window attention is good at handling local dependencies and it also has a wide receptive field as discussed above. However, if a token needs to access tokens from a distance of $L$ tokens away, it would require $\\lceil \\frac{L}{w} \\rceil$ hops through window attention. This makes it challenging to access information from distant context as the attention score between them will be greatly reduced due to accumulation through multiplication. Thus, we introduce a new type of special",
|
| 706 |
+
"bbox": [
|
| 707 |
+
495,
|
| 708 |
+
784,
|
| 709 |
+
887,
|
| 710 |
+
906
|
| 711 |
+
],
|
| 712 |
+
"page_idx": 3
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"type": "header",
|
| 716 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 717 |
+
"bbox": [
|
| 718 |
+
236,
|
| 719 |
+
56,
|
| 720 |
+
736,
|
| 721 |
+
71
|
| 722 |
+
],
|
| 723 |
+
"page_idx": 3
|
| 724 |
+
},
|
| 725 |
+
{
|
| 726 |
+
"type": "page_number",
|
| 727 |
+
"text": "4",
|
| 728 |
+
"bbox": [
|
| 729 |
+
480,
|
| 730 |
+
922,
|
| 731 |
+
491,
|
| 732 |
+
934
|
| 733 |
+
],
|
| 734 |
+
"page_idx": 3
|
| 735 |
+
},
|
| 736 |
+
{
|
| 737 |
+
"type": "image",
|
| 738 |
+
"img_path": "images/6d4b6964fecaf3718dba68ffb09cd55a1236ca06689fd616ec706be36f76065f.jpg",
|
| 739 |
+
"image_caption": [
|
| 740 |
+
"Figure 3. Visualization of the attention matrix (partially shown for clarity) in CodeGPT (Lu et al., 2021). The attention matrix is averaged across all Transformer layers."
|
| 741 |
+
],
|
| 742 |
+
"image_footnote": [],
|
| 743 |
+
"bbox": [
|
| 744 |
+
119,
|
| 745 |
+
85,
|
| 746 |
+
441,
|
| 747 |
+
258
|
| 748 |
+
],
|
| 749 |
+
"page_idx": 4
|
| 750 |
+
},
|
| 751 |
+
{
|
| 752 |
+
"type": "text",
|
| 753 |
+
"text": "token, namely bridge tokens, to aggregate local information for global access. Bridge tokens can attend to a fixed length of tokens and be attended from all subsequent tokens. From the perspective of representation learning, a bridge token can be seen as a learned representation for the corresponding slice of code.",
|
| 754 |
+
"bbox": [
|
| 755 |
+
84,
|
| 756 |
+
342,
|
| 757 |
+
473,
|
| 758 |
+
434
|
| 759 |
+
],
|
| 760 |
+
"page_idx": 4
|
| 761 |
+
},
|
| 762 |
+
{
|
| 763 |
+
"type": "text",
|
| 764 |
+
"text": "Specifically, we insert $m$ bridge tokens $S_{b}$ every $\\left\\lceil \\frac{n}{m} \\right\\rceil$ tokens and use a separate set of projections, $Q_{b}, K_{b}, V_{b}$ to compute attention scores for the bridge attention. The bridge tokens do not involve next token prediction but they are used to aggregate information from the preceding $\\left\\lceil \\frac{n}{m} \\right\\rceil$ tokens. The use of additional projections allows for the ability to model different types of attention. Finally, the mask matrix for bridge attention is calculated as follows:",
|
| 765 |
+
"bbox": [
|
| 766 |
+
84,
|
| 767 |
+
439,
|
| 768 |
+
475,
|
| 769 |
+
561
|
| 770 |
+
],
|
| 771 |
+
"page_idx": 4
|
| 772 |
+
},
|
| 773 |
+
{
|
| 774 |
+
"type": "equation",
|
| 775 |
+
"text": "\n$$\nM _ {i j} ^ {\\text {b r i d g e}} = \\left\\{\\begin{array}{l l}0&\\text {i f} j \\in S _ {b} \\text {a n d} i \\geq j\\\\0&\\text {i f} i \\in S _ {b} \\text {a n d} i - j \\leq \\left\\lceil \\frac {n}{m} \\right\\rceil\\\\- \\infty&\\text {o t h e r w i s e}\\end{array}\\right. \\tag {3}\n$$\n",
|
| 776 |
+
"text_format": "latex",
|
| 777 |
+
"bbox": [
|
| 778 |
+
120,
|
| 779 |
+
571,
|
| 780 |
+
475,
|
| 781 |
+
628
|
| 782 |
+
],
|
| 783 |
+
"page_idx": 4
|
| 784 |
+
},
|
| 785 |
+
{
|
| 786 |
+
"type": "text",
|
| 787 |
+
"text": "The complexity of bridge attention is $O(m \\times n) \\approx O(n)$ where $m \\ll n$ . Compared to stacked window attention, bridge attention allows each token to attend to any preceding token with at most 2 hops, which enables the model to effectively access long-range context.",
|
| 788 |
+
"bbox": [
|
| 789 |
+
84,
|
| 790 |
+
638,
|
| 791 |
+
475,
|
| 792 |
+
715
|
| 793 |
+
],
|
| 794 |
+
"page_idx": 4
|
| 795 |
+
},
|
| 796 |
+
{
|
| 797 |
+
"type": "text",
|
| 798 |
+
"text": "4.3. Global Attention",
|
| 799 |
+
"text_level": 1,
|
| 800 |
+
"bbox": [
|
| 801 |
+
84,
|
| 802 |
+
731,
|
| 803 |
+
236,
|
| 804 |
+
744
|
| 805 |
+
],
|
| 806 |
+
"page_idx": 4
|
| 807 |
+
},
|
| 808 |
+
{
|
| 809 |
+
"type": "text",
|
| 810 |
+
"text": "Identifiers with the global scope, for example, package imports, global functions, classes and their member functions (i.e., methods), can be called from any location within a file. For long code, a local sliding window cannot capture such information that should be globally accessible. This is especially outstanding for package imports, which are usually located at the beginning of a file. For example, in Figure 1, without knowing the user has imported torch.nn.Functional as a new identifier F, the model cannot be sure whether to use F or the full",
|
| 811 |
+
"bbox": [
|
| 812 |
+
84,
|
| 813 |
+
753,
|
| 814 |
+
478,
|
| 815 |
+
905
|
| 816 |
+
],
|
| 817 |
+
"page_idx": 4
|
| 818 |
+
},
|
| 819 |
+
{
|
| 820 |
+
"type": "text",
|
| 821 |
+
"text": "package name. $^4$ Also, to call the forward function of conv_block1 and conv_block2, the model needs access to the original definition of the class ConvBlock, which also falls outside the current sliding window. Directly accessing these tokens is similar to how human programmers quickly refer to definitions in the code. This global effect can also be observed in the visualization of the attention matrix in CodeGPT (Lu et al., 2021). As shown in Figure 3, some tokens seem to have a global impact while others only matter locally.",
|
| 822 |
+
"bbox": [
|
| 823 |
+
496,
|
| 824 |
+
84,
|
| 825 |
+
887,
|
| 826 |
+
237
|
| 827 |
+
],
|
| 828 |
+
"page_idx": 4
|
| 829 |
+
},
|
| 830 |
+
{
|
| 831 |
+
"type": "text",
|
| 832 |
+
"text": "Therefore, in addition to bridge tokens, where the model automatically learns to aggregate globally useful information, we add another type of global token, namely memory tokens, to inject code heuristics to the attention. Specifically, we leverage the structure of code with tree-sitter to parse the code into an abstract syntax tree (AST). Then, we find all statements that include a package import, class or function definition and grant the line feeds (LF, $\\backslash \\mathfrak{n}$ ) of those statements global access. We denote the set of positions of these line feeds as $G$ , where $k = |G|$ . The mask matrix $M^{global}$ of global attention is calculated as follows:",
|
| 833 |
+
"bbox": [
|
| 834 |
+
496,
|
| 835 |
+
243,
|
| 836 |
+
888,
|
| 837 |
+
409
|
| 838 |
+
],
|
| 839 |
+
"page_idx": 4
|
| 840 |
+
},
|
| 841 |
+
{
|
| 842 |
+
"type": "equation",
|
| 843 |
+
"text": "\n$$\nM _ {i j} ^ {\\text {g l o b a l}} = \\left\\{ \\begin{array}{l l} 0 & \\text {i f} j \\in G \\text {a n d} i \\geq j \\\\ - \\infty & \\text {o t h e r w i s e} \\end{array} \\right. \\tag {4}\n$$\n",
|
| 844 |
+
"text_format": "latex",
|
| 845 |
+
"bbox": [
|
| 846 |
+
558,
|
| 847 |
+
419,
|
| 848 |
+
885,
|
| 849 |
+
460
|
| 850 |
+
],
|
| 851 |
+
"page_idx": 4
|
| 852 |
+
},
|
| 853 |
+
{
|
| 854 |
+
"type": "text",
|
| 855 |
+
"text": "The complexity of the global attention is $O(kn) \\approx O(n)$ , as we have $k \\ll n$ , where $n$ is the length of the sequence.",
|
| 856 |
+
"bbox": [
|
| 857 |
+
496,
|
| 858 |
+
470,
|
| 859 |
+
887,
|
| 860 |
+
502
|
| 861 |
+
],
|
| 862 |
+
"page_idx": 4
|
| 863 |
+
},
|
| 864 |
+
{
|
| 865 |
+
"type": "text",
|
| 866 |
+
"text": "Unlike previous work (Clement et al., 2021) which extracts the most significant statements and encode them in a fixed-length context window, our global attention requires less memory and can reuse previously encoded hidden states.",
|
| 867 |
+
"bbox": [
|
| 868 |
+
496,
|
| 869 |
+
508,
|
| 870 |
+
887,
|
| 871 |
+
570
|
| 872 |
+
],
|
| 873 |
+
"page_idx": 4
|
| 874 |
+
},
|
| 875 |
+
{
|
| 876 |
+
"type": "text",
|
| 877 |
+
"text": "Finally, considering all three types of attention together, $M$ in Equation 1 becomes:",
|
| 878 |
+
"bbox": [
|
| 879 |
+
496,
|
| 880 |
+
575,
|
| 881 |
+
885,
|
| 882 |
+
607
|
| 883 |
+
],
|
| 884 |
+
"page_idx": 4
|
| 885 |
+
},
|
| 886 |
+
{
|
| 887 |
+
"type": "equation",
|
| 888 |
+
"text": "\n$$\nM = \\max \\left(M ^ {\\text {w i n d o w}}, M ^ {\\text {b r i d g e}}, M ^ {\\text {g l o b a l}}\\right) \\tag {5}\n$$\n",
|
| 889 |
+
"text_format": "latex",
|
| 890 |
+
"bbox": [
|
| 891 |
+
565,
|
| 892 |
+
617,
|
| 893 |
+
885,
|
| 894 |
+
636
|
| 895 |
+
],
|
| 896 |
+
"page_idx": 4
|
| 897 |
+
},
|
| 898 |
+
{
|
| 899 |
+
"type": "text",
|
| 900 |
+
"text": "where max is the element-wise maximum function.",
|
| 901 |
+
"bbox": [
|
| 902 |
+
496,
|
| 903 |
+
647,
|
| 904 |
+
839,
|
| 905 |
+
661
|
| 906 |
+
],
|
| 907 |
+
"page_idx": 4
|
| 908 |
+
},
|
| 909 |
+
{
|
| 910 |
+
"type": "text",
|
| 911 |
+
"text": "5. Experiments",
|
| 912 |
+
"text_level": 1,
|
| 913 |
+
"bbox": [
|
| 914 |
+
496,
|
| 915 |
+
681,
|
| 916 |
+
630,
|
| 917 |
+
698
|
| 918 |
+
],
|
| 919 |
+
"page_idx": 4
|
| 920 |
+
},
|
| 921 |
+
{
|
| 922 |
+
"type": "text",
|
| 923 |
+
"text": "5.1. Experimental Settings",
|
| 924 |
+
"text_level": 1,
|
| 925 |
+
"bbox": [
|
| 926 |
+
496,
|
| 927 |
+
707,
|
| 928 |
+
687,
|
| 929 |
+
722
|
| 930 |
+
],
|
| 931 |
+
"page_idx": 4
|
| 932 |
+
},
|
| 933 |
+
{
|
| 934 |
+
"type": "text",
|
| 935 |
+
"text": "Baselines We evaluate LongCoder against several publicly available pre-trained code generation models, including GPT-2 (Radford et al., 2019), CodeGPT (Lu et al., 2021), and UniXcoder (Guo et al., 2022). GPT-2 is pre-trained on a text corpus and CodeGPT is pre-trained on the CodeSearchNet dataset (Husain et al., 2019) using next token prediction as the objective. UniXcoder based on UniLM (Dong et al., 2019) is pre-trained on a cross-modal dataset that includes code, text, and abstract syntax trees. Additionally, we also compare LongCoder with sparse Transformer models, such",
|
| 936 |
+
"bbox": [
|
| 937 |
+
495,
|
| 938 |
+
729,
|
| 939 |
+
887,
|
| 940 |
+
882
|
| 941 |
+
],
|
| 942 |
+
"page_idx": 4
|
| 943 |
+
},
|
| 944 |
+
{
|
| 945 |
+
"type": "header",
|
| 946 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 947 |
+
"bbox": [
|
| 948 |
+
236,
|
| 949 |
+
56,
|
| 950 |
+
736,
|
| 951 |
+
71
|
| 952 |
+
],
|
| 953 |
+
"page_idx": 4
|
| 954 |
+
},
|
| 955 |
+
{
|
| 956 |
+
"type": "page_footnote",
|
| 957 |
+
"text": "Both are common code styles in PyTorch.",
|
| 958 |
+
"bbox": [
|
| 959 |
+
517,
|
| 960 |
+
890,
|
| 961 |
+
774,
|
| 962 |
+
905
|
| 963 |
+
],
|
| 964 |
+
"page_idx": 4
|
| 965 |
+
},
|
| 966 |
+
{
|
| 967 |
+
"type": "page_number",
|
| 968 |
+
"text": "5",
|
| 969 |
+
"bbox": [
|
| 970 |
+
480,
|
| 971 |
+
922,
|
| 972 |
+
491,
|
| 973 |
+
934
|
| 974 |
+
],
|
| 975 |
+
"page_idx": 4
|
| 976 |
+
},
|
| 977 |
+
{
|
| 978 |
+
"type": "table",
|
| 979 |
+
"img_path": "images/b67782d0800bbe09094a28d42eac4c71328573f91bc054db8105321e250be808.jpg",
|
| 980 |
+
"table_caption": [
|
| 981 |
+
"Table 2. Experimental results on the Long Code Completion (LCC) dataset."
|
| 982 |
+
],
|
| 983 |
+
"table_footnote": [],
|
| 984 |
+
"table_body": "<table><tr><td rowspan=\"2\">Model</td><td rowspan=\"2\">#Param.</td><td rowspan=\"2\">Memory</td><td rowspan=\"2\">Runtime</td><td colspan=\"2\">Python</td><td colspan=\"2\">Java</td><td colspan=\"2\">C#</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>OpenAI Codex</td><td>12B</td><td>-</td><td>-</td><td>39.65</td><td>68.97</td><td>43.15</td><td>72.05</td><td>53.89</td><td>77.93</td></tr><tr><td>Transformer</td><td>124M</td><td>191M</td><td>750ms</td><td>10.64</td><td>43.64</td><td>15.32</td><td>47.52</td><td>19.16</td><td>48.87</td></tr><tr><td>GPT-2</td><td>124M</td><td>191M</td><td>750ms</td><td>11.20</td><td>42.62</td><td>17.09</td><td>47.18</td><td>20.27</td><td>48.27</td></tr><tr><td>CodeGPT</td><td>124M</td><td>191M</td><td>750ms</td><td>12.24</td><td>43.81</td><td>19.20</td><td>49.50</td><td>22.58</td><td>51.03</td></tr><tr><td>UniXcoder</td><td>126M</td><td>191M</td><td>750ms</td><td>16.55</td><td>50.22</td><td>23.93</td><td>55.38</td><td>27.97</td><td>57.29</td></tr><tr><td>LongFormer</td><td>150M</td><td>381M</td><td>781ms</td><td>16.79</td><td>51.07</td><td>24.80</td><td>56.03</td><td>29.75</td><td>58.23</td></tr><tr><td>BigBird</td><td>128M</td><td>205M</td><td>804ms</td><td>17.03</td><td>51.14</td><td>25.19</td><td>56.91</td><td>30.27</td><td>58.66</td></tr><tr><td>LongCoder</td><td>150M</td><td>211M</td><td>812ms</td><td>17.88</td><td>55.07</td><td>26.42</td><td>61.21</td><td>31.34</td><td>64.37</td></tr><tr><td>- w/o pretrain</td><td>150M</td><td>211M</td><td>812ms</td><td>17.61</td><td>54.82</td><td>25.96</td><td>60.81</td><td>31.22</td><td>64.18</td></tr></table>",
|
| 985 |
+
"bbox": [
|
| 986 |
+
112,
|
| 987 |
+
107,
|
| 988 |
+
861,
|
| 989 |
+
313
|
| 990 |
+
],
|
| 991 |
+
"page_idx": 5
|
| 992 |
+
},
|
| 993 |
+
{
|
| 994 |
+
"type": "table",
|
| 995 |
+
"img_path": "images/ddbb4dff8fbfc9db914d758dc8b3582dff7c9dd020b552edc59d26caa5b1393c.jpg",
|
| 996 |
+
"table_caption": [
|
| 997 |
+
"Table 3. Data statistics about the context length of CodeXGLUE test dataset. $25\\% /50\\% /75\\%$ refer to the first/second/third quartile."
|
| 998 |
+
],
|
| 999 |
+
"table_footnote": [],
|
| 1000 |
+
"table_body": "<table><tr><td>Language</td><td>Average</td><td>25%</td><td>50%</td><td>75%</td></tr><tr><td>Python</td><td>477.8</td><td>83</td><td>197</td><td>502</td></tr><tr><td>Java</td><td>365.0</td><td>74</td><td>171</td><td>397</td></tr></table>",
|
| 1001 |
+
"bbox": [
|
| 1002 |
+
125,
|
| 1003 |
+
386,
|
| 1004 |
+
434,
|
| 1005 |
+
449
|
| 1006 |
+
],
|
| 1007 |
+
"page_idx": 5
|
| 1008 |
+
},
|
| 1009 |
+
{
|
| 1010 |
+
"type": "text",
|
| 1011 |
+
"text": "as LongFormer (Beltagy et al., 2020) and BigBird (Zaheer et al., 2020). LongFormer uses a dilated sliding window to model long sequences in the generation task, while BigBird has an attention pattern that includes random, window, and global attention. In addition to these comparable baselines, we also report the performance of OpenAI Codex on LCC for reference. Note that Codex is $100 \\times$ larger than other models and is likely to have seen the test set of LCC in its pretraining thus is not directly comparable.",
|
| 1012 |
+
"bbox": [
|
| 1013 |
+
84,
|
| 1014 |
+
484,
|
| 1015 |
+
475,
|
| 1016 |
+
621
|
| 1017 |
+
],
|
| 1018 |
+
"page_idx": 5
|
| 1019 |
+
},
|
| 1020 |
+
{
|
| 1021 |
+
"type": "text",
|
| 1022 |
+
"text": "**Benchmarks** We evaluate the performance of LongCoder and the baselines on two benchmarks: LCC (introduced in Section 3), and the code completion task benchmark in CodeXGLUE (Lu et al., 2021). CodeXGLUE provides PY150 (Raychev et al., 2016) and JavaCorpus (Allamanis & Sutton, 2013) datasets in Python and Java for line-level code completion. The statistics for the context length of the CodeXGLUE test datasets are listed in Table 3. We can see that the context length of the input sequence is 5 times shorter than LCC, and only a small portion of the samples require modeling for long code sequences. The objective of evaluating the performance of sparse models on the CodeXGLUE dataset is to examine their effectiveness in scenarios where the code context is relatively short.",
|
| 1023 |
+
"bbox": [
|
| 1024 |
+
84,
|
| 1025 |
+
641,
|
| 1026 |
+
473,
|
| 1027 |
+
852
|
| 1028 |
+
],
|
| 1029 |
+
"page_idx": 5
|
| 1030 |
+
},
|
| 1031 |
+
{
|
| 1032 |
+
"type": "text",
|
| 1033 |
+
"text": "Moreover, longer context can benefit applications including cross-file code completion (Liu et al., 2023). We test the performance of LongCoder on the cross-file-random (XF-",
|
| 1034 |
+
"bbox": [
|
| 1035 |
+
84,
|
| 1036 |
+
859,
|
| 1037 |
+
475,
|
| 1038 |
+
905
|
| 1039 |
+
],
|
| 1040 |
+
"page_idx": 5
|
| 1041 |
+
},
|
| 1042 |
+
{
|
| 1043 |
+
"type": "table",
|
| 1044 |
+
"img_path": "images/f2d45f06aa7a3d3ae392e73106bad82911a997aa521dceed23446c30c8117194.jpg",
|
| 1045 |
+
"table_caption": [
|
| 1046 |
+
"Table 4. Results on CodeXGLUE code completion benchmark."
|
| 1047 |
+
],
|
| 1048 |
+
"table_footnote": [],
|
| 1049 |
+
"table_body": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"2\">PY150</td><td colspan=\"2\">JavaCorpus</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>Transformer</td><td>38.51</td><td>69.01</td><td>17.00</td><td>50.23</td></tr><tr><td>GPT-2</td><td>41.73</td><td>70.60</td><td>27.50</td><td>60.36</td></tr><tr><td>CodeGPT</td><td>42.37</td><td>71.59</td><td>30.60</td><td>63.45</td></tr><tr><td>UniXcoder</td><td>43.12</td><td>72.00</td><td>32.90</td><td>65.78</td></tr><tr><td>LongCoder</td><td>43.77</td><td>73.37</td><td>33.13</td><td>67.32</td></tr></table>",
|
| 1050 |
+
"bbox": [
|
| 1051 |
+
519,
|
| 1052 |
+
372,
|
| 1053 |
+
864,
|
| 1054 |
+
489
|
| 1055 |
+
],
|
| 1056 |
+
"page_idx": 5
|
| 1057 |
+
},
|
| 1058 |
+
{
|
| 1059 |
+
"type": "table",
|
| 1060 |
+
"img_path": "images/0390b17a43baed93e8d44ece1a463a3ece17263c268967d4a817a7fa31a1d308.jpg",
|
| 1061 |
+
"table_caption": [
|
| 1062 |
+
"Table 5. Cross-file code completion results on RepoBench XF-R (Liu et al., 2023)."
|
| 1063 |
+
],
|
| 1064 |
+
"table_footnote": [],
|
| 1065 |
+
"table_body": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"2\">Python</td><td colspan=\"2\">Java</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>Transformer</td><td>7.0</td><td>38.3</td><td>5.8</td><td>34.4</td></tr><tr><td>GPT-2</td><td>15.5</td><td>48.2</td><td>11.6</td><td>41.4</td></tr><tr><td>CodeGPT</td><td>16.6</td><td>49.1</td><td>13.3</td><td>44.2</td></tr><tr><td>UniXcoder</td><td>18.0</td><td>53.4</td><td>16.5</td><td>50.0</td></tr><tr><td>LongCoder</td><td>21.4</td><td>59.7</td><td>19.7</td><td>60.1</td></tr></table>",
|
| 1066 |
+
"bbox": [
|
| 1067 |
+
526,
|
| 1068 |
+
554,
|
| 1069 |
+
857,
|
| 1070 |
+
672
|
| 1071 |
+
],
|
| 1072 |
+
"page_idx": 5
|
| 1073 |
+
},
|
| 1074 |
+
{
|
| 1075 |
+
"type": "text",
|
| 1076 |
+
"text": "R) setting of RepoBench (Liu et al., 2023). The task is to predict the next line of code based on a given in-file context, consisting of import statements and preceding lines before the target line, as well as a cross-file context, comprising snippets from other files in the code repository, parsed by import statements.",
|
| 1077 |
+
"bbox": [
|
| 1078 |
+
495,
|
| 1079 |
+
705,
|
| 1080 |
+
885,
|
| 1081 |
+
796
|
| 1082 |
+
],
|
| 1083 |
+
"page_idx": 5
|
| 1084 |
+
},
|
| 1085 |
+
{
|
| 1086 |
+
"type": "text",
|
| 1087 |
+
"text": "Evaluation Metrics We report the number of parameters, inference memory consumption, runtime, Exact Match (EM) and Edit Similarity (Edit Sim) of the baselines. The inference memory consumption and runtime per example are calculated using a beam search with beam size of 5 and maximum generation length of 64 on a single V100 GPU.",
|
| 1088 |
+
"bbox": [
|
| 1089 |
+
495,
|
| 1090 |
+
814,
|
| 1091 |
+
885,
|
| 1092 |
+
905
|
| 1093 |
+
],
|
| 1094 |
+
"page_idx": 5
|
| 1095 |
+
},
|
| 1096 |
+
{
|
| 1097 |
+
"type": "header",
|
| 1098 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 1099 |
+
"bbox": [
|
| 1100 |
+
236,
|
| 1101 |
+
56,
|
| 1102 |
+
736,
|
| 1103 |
+
71
|
| 1104 |
+
],
|
| 1105 |
+
"page_idx": 5
|
| 1106 |
+
},
|
| 1107 |
+
{
|
| 1108 |
+
"type": "page_number",
|
| 1109 |
+
"text": "6",
|
| 1110 |
+
"bbox": [
|
| 1111 |
+
480,
|
| 1112 |
+
922,
|
| 1113 |
+
491,
|
| 1114 |
+
934
|
| 1115 |
+
],
|
| 1116 |
+
"page_idx": 5
|
| 1117 |
+
},
|
| 1118 |
+
{
|
| 1119 |
+
"type": "table",
|
| 1120 |
+
"img_path": "images/762df8f48622ca2dac43b708ece74618dc544b51f716b8220706967011c221ee.jpg",
|
| 1121 |
+
"table_caption": [
|
| 1122 |
+
"Table 6. Ablation study on LongCoder without pre-training."
|
| 1123 |
+
],
|
| 1124 |
+
"table_footnote": [],
|
| 1125 |
+
"table_body": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"2\">Python</td><td colspan=\"2\">Java</td><td colspan=\"2\">C#</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>LongCoder</td><td>17.61</td><td>54.82</td><td>25.96</td><td>60.81</td><td>31.22</td><td>64.18</td></tr><tr><td>w/o memory tokens</td><td>16.80</td><td>53.90</td><td>24.87</td><td>60.35</td><td>30.16</td><td>63.61</td></tr><tr><td>w/o bridge tokens</td><td>17.54</td><td>51.92</td><td>25.88</td><td>57.48</td><td>30.80</td><td>59.09</td></tr><tr><td>w/o out-of-window context</td><td>16.66</td><td>50.63</td><td>24.17</td><td>55.97</td><td>28.81</td><td>57.79</td></tr><tr><td>w/ equidistant memory tokens</td><td>17.16</td><td>54.25</td><td>24.96</td><td>60.42</td><td>30.31</td><td>63.65</td></tr></table>",
|
| 1126 |
+
"bbox": [
|
| 1127 |
+
174,
|
| 1128 |
+
107,
|
| 1129 |
+
799,
|
| 1130 |
+
234
|
| 1131 |
+
],
|
| 1132 |
+
"page_idx": 6
|
| 1133 |
+
},
|
| 1134 |
+
{
|
| 1135 |
+
"type": "text",
|
| 1136 |
+
"text": "5.2. Training Details",
|
| 1137 |
+
"text_level": 1,
|
| 1138 |
+
"bbox": [
|
| 1139 |
+
88,
|
| 1140 |
+
266,
|
| 1141 |
+
230,
|
| 1142 |
+
281
|
| 1143 |
+
],
|
| 1144 |
+
"page_idx": 6
|
| 1145 |
+
},
|
| 1146 |
+
{
|
| 1147 |
+
"type": "text",
|
| 1148 |
+
"text": "We set the maximum length of code context to 512 and 4096 for non-sparse and sparse models, respectively. In order to make a fair comparison between sparse models and non-sparse models, we set the window size $w$ to 512 so that both types of models maintain the same local context length during inference. Note that this setting is different from the original setting of RepoBench (Liu et al., 2023), thus the results are not directly comparable to those reported in Liu et al. (2023). For sparse models, we use the parameters of UniXcoder released by Guo et al. (2022) to initialize the models. For LongCoder, we set the maximum size of bridge tokens $n$ and global tokens $k$ as 16 and 64, respectively. To ensure fair comparison with other models, we pre-train LongCoder on the CodeSearchNet dataset using the same next token prediction objective and pre-training setting as baselines (Lu et al., 2021; Guo et al., 2022). During finetuning, we use the Adam optimizer with a batch size of 16 and a learning rate of 2e-4. We fine-tune the model for 10 epochs and perform early stopping on the development set. Note that although the maximum context sequence length is 4096, during inference, we only retain a cache of at most 592 tokens for past key and value hidden states to maintain efficiency in terms of computational resources.",
|
| 1149 |
+
"bbox": [
|
| 1150 |
+
88,
|
| 1151 |
+
289,
|
| 1152 |
+
473,
|
| 1153 |
+
635
|
| 1154 |
+
],
|
| 1155 |
+
"page_idx": 6
|
| 1156 |
+
},
|
| 1157 |
+
{
|
| 1158 |
+
"type": "text",
|
| 1159 |
+
"text": "5.3. Experimental Results",
|
| 1160 |
+
"text_level": 1,
|
| 1161 |
+
"bbox": [
|
| 1162 |
+
88,
|
| 1163 |
+
654,
|
| 1164 |
+
267,
|
| 1165 |
+
667
|
| 1166 |
+
],
|
| 1167 |
+
"page_idx": 6
|
| 1168 |
+
},
|
| 1169 |
+
{
|
| 1170 |
+
"type": "text",
|
| 1171 |
+
"text": "Table 2 illustrates the comparison results of LongCoder with other models on the LCC dataset. The results reveal that the sparse models (i.e., the last two groups) have superior performance compared to the non-sparse models (i.e., the second group) on both EM and Edit Sim metrics, and they also maintain a similar inference speed. LongFormer is initialized using the parameters of UniXcoder, with the sole difference being the use of a sliding window attention mechanism. This mechanism allows the model to maintain a consistent inference speed while having a larger receptive field, resulting in improved performance. This demonstrates the effectiveness of the sliding window attention mechanism in code completion tasks. Compared to other sparse models, LongCoder achieves an improvement of $0.8\\% -1.3\\%$ in Exact Match score and $4.0\\% -6.0\\%$ in Edit Similarity,",
|
| 1172 |
+
"bbox": [
|
| 1173 |
+
88,
|
| 1174 |
+
676,
|
| 1175 |
+
473,
|
| 1176 |
+
902
|
| 1177 |
+
],
|
| 1178 |
+
"page_idx": 6
|
| 1179 |
+
},
|
| 1180 |
+
{
|
| 1181 |
+
"type": "text",
|
| 1182 |
+
"text": "which reveal the effectiveness of our proposed bridge and global attention mechanisms. Table 4 shows the result of LongCoder on CodeXGLUE code completion benchmarks. It can be observed that LongCoder achieves state-of-the-art performance, which illustrates its effectiveness in scenarios where the code context is short. As shown in Table 5, LongCoder has an even larger advantage compared to UniXcoder, indicating its potential in more complex scenarios.",
|
| 1183 |
+
"bbox": [
|
| 1184 |
+
500,
|
| 1185 |
+
266,
|
| 1186 |
+
885,
|
| 1187 |
+
386
|
| 1188 |
+
],
|
| 1189 |
+
"page_idx": 6
|
| 1190 |
+
},
|
| 1191 |
+
{
|
| 1192 |
+
"type": "text",
|
| 1193 |
+
"text": "5.4. Ablation Study",
|
| 1194 |
+
"text_level": 1,
|
| 1195 |
+
"bbox": [
|
| 1196 |
+
500,
|
| 1197 |
+
404,
|
| 1198 |
+
635,
|
| 1199 |
+
417
|
| 1200 |
+
],
|
| 1201 |
+
"page_idx": 6
|
| 1202 |
+
},
|
| 1203 |
+
{
|
| 1204 |
+
"type": "text",
|
| 1205 |
+
"text": "To better understand the impact of different components on overall performance, we conduct an ablation study on LongCoder, and the results are shown in Table 6. We can see that the average score of Exact Match drops by approximately $1\\%$ when memory tokens are removed (w/o memory tokens), which demonstrates the importance of these tokens. On the other hand, when bridge tokens are removed (w/o bridge tokens), the average score drops by about $3\\%$ in terms of Edit Similarity. This is likely because bridge tokens assist LongCoder in understanding the semantics of the code context and generating more accurate patterns, while memory tokens enable it to access concrete identifiers with global scope, thus improving accuracy on libraries, classes, and functions invoked. Additionally, we observe that selecting one as a memory token every 64 tokens (equidistant memory tokens) results in worse performance than LongCoder, indicating that the advantage of the memory tokens is not solely due to increased context length. We also evaluate the performance of LongCoder by only using code context within the window size during inference to verify if the improvement is solely attributed to the use of long code context or whether other factors such as fine-tuning settings also contribute. By only keeping the last 512 tokens as code context (w/o out-of-window context), we can see that the performance is nearly the same as UniXcoder in Table 2, which shows the importance of modeling long code context.",
|
| 1206 |
+
"bbox": [
|
| 1207 |
+
500,
|
| 1208 |
+
426,
|
| 1209 |
+
885,
|
| 1210 |
+
818
|
| 1211 |
+
],
|
| 1212 |
+
"page_idx": 6
|
| 1213 |
+
},
|
| 1214 |
+
{
|
| 1215 |
+
"type": "text",
|
| 1216 |
+
"text": "5.5. Case Study",
|
| 1217 |
+
"text_level": 1,
|
| 1218 |
+
"bbox": [
|
| 1219 |
+
500,
|
| 1220 |
+
837,
|
| 1221 |
+
607,
|
| 1222 |
+
851
|
| 1223 |
+
],
|
| 1224 |
+
"page_idx": 6
|
| 1225 |
+
},
|
| 1226 |
+
{
|
| 1227 |
+
"type": "text",
|
| 1228 |
+
"text": "We also conduct a case study to demonstrate the effectiveness of LongCoder, as shown in Figure 4. We provide two examples in the Python and Java programming languages",
|
| 1229 |
+
"bbox": [
|
| 1230 |
+
500,
|
| 1231 |
+
859,
|
| 1232 |
+
883,
|
| 1233 |
+
904
|
| 1234 |
+
],
|
| 1235 |
+
"page_idx": 6
|
| 1236 |
+
},
|
| 1237 |
+
{
|
| 1238 |
+
"type": "header",
|
| 1239 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 1240 |
+
"bbox": [
|
| 1241 |
+
236,
|
| 1242 |
+
56,
|
| 1243 |
+
733,
|
| 1244 |
+
70
|
| 1245 |
+
],
|
| 1246 |
+
"page_idx": 6
|
| 1247 |
+
},
|
| 1248 |
+
{
|
| 1249 |
+
"type": "page_number",
|
| 1250 |
+
"text": "7",
|
| 1251 |
+
"bbox": [
|
| 1252 |
+
480,
|
| 1253 |
+
922,
|
| 1254 |
+
491,
|
| 1255 |
+
934
|
| 1256 |
+
],
|
| 1257 |
+
"page_idx": 6
|
| 1258 |
+
},
|
| 1259 |
+
{
|
| 1260 |
+
"type": "image",
|
| 1261 |
+
"img_path": "images/b34436a6f4e25d13b6f6c65d4ef5749cca53733bb5f35ce5503149988fb1bfc5.jpg",
|
| 1262 |
+
"image_caption": [
|
| 1263 |
+
"Figure 4. Two LCC examples of Python (top) and Java (bottom) code and predictions of different models. Codex-2048 refers to the original Codex model with the maximum context length of 2,048 while Codex-512 is the same model with a maximum context length set to 512. Key information is highlighted with arrows."
|
| 1264 |
+
],
|
| 1265 |
+
"image_footnote": [],
|
| 1266 |
+
"bbox": [
|
| 1267 |
+
91,
|
| 1268 |
+
82,
|
| 1269 |
+
880,
|
| 1270 |
+
448
|
| 1271 |
+
],
|
| 1272 |
+
"page_idx": 7
|
| 1273 |
+
},
|
| 1274 |
+
{
|
| 1275 |
+
"type": "text",
|
| 1276 |
+
"text": "and output predictions from different models. (1) From the Python example, we can see that all models infer the correct intended outcome, which is to assign the current timestamp to the timestamp variable. However, only LongCoder and Codex-2048 produce the correct result. This is primarily because these two models are able to refer to the import statement at the beginning of the file, which imports the timestamp_now function. Codex-2048 uses a long context window to cover the entire file, but this approach increases memory consumption and decreases inference speed as discussed above. Additionally, as the failure of Codex-512 shows, even a large powerful model can struggle to identify the correct function from other candidates if the required information exceeds the window size. In contrast, LongCoder utilizes a more efficient memory attention mechanism, storing information based on the scope of different statements. This method is more effective, allowing access to statements from the global scope while remaining efficient. (2) In the Java example, the function to be completed aims to convert a HashMap variable into an XML string. The function sequentially calls the getters functions of the GaitReEducation class and has already completed calling the getGaitAspect function. From the out-window context, it is clear that the next call should be made to the getDetails function. In order to correctly complete the",
|
| 1277 |
+
"bbox": [
|
| 1278 |
+
83,
|
| 1279 |
+
522,
|
| 1280 |
+
475,
|
| 1281 |
+
900
|
| 1282 |
+
],
|
| 1283 |
+
"page_idx": 7
|
| 1284 |
+
},
|
| 1285 |
+
{
|
| 1286 |
+
"type": "text",
|
| 1287 |
+
"text": "function, it is essential to keep track of all function definitions. As seen in the output results, only LongCoder and Codex-2048, which both make use of long code context, can predict the correct results. Additionally, it can be observed that Codex-512, due to its limited context, can only make a guess for a member function. We can see that LongCoder leverages the structure of the code to analyze the scope of statements and stores those that have potential long-term dependencies. This not only improves performance but also achieves comparable efficiency in terms of computational resources during inference.",
|
| 1288 |
+
"bbox": [
|
| 1289 |
+
495,
|
| 1290 |
+
522,
|
| 1291 |
+
888,
|
| 1292 |
+
689
|
| 1293 |
+
],
|
| 1294 |
+
"page_idx": 7
|
| 1295 |
+
},
|
| 1296 |
+
{
|
| 1297 |
+
"type": "text",
|
| 1298 |
+
"text": "6. Discussion",
|
| 1299 |
+
"text_level": 1,
|
| 1300 |
+
"bbox": [
|
| 1301 |
+
496,
|
| 1302 |
+
707,
|
| 1303 |
+
609,
|
| 1304 |
+
723
|
| 1305 |
+
],
|
| 1306 |
+
"page_idx": 7
|
| 1307 |
+
},
|
| 1308 |
+
{
|
| 1309 |
+
"type": "text",
|
| 1310 |
+
"text": "Limitations One limitation of LongCoder is its small size. Due to resource constraints, we are not able to train a large model that is comparable to Codex. Besides, to compare fairly with other baselines, we only pre-train LongCoder on a small-scale corpus (CodeSearchNet). It would be interesting to see how the idea of sparse attention scales with more data.",
|
| 1311 |
+
"bbox": [
|
| 1312 |
+
495,
|
| 1313 |
+
733,
|
| 1314 |
+
887,
|
| 1315 |
+
838
|
| 1316 |
+
],
|
| 1317 |
+
"page_idx": 7
|
| 1318 |
+
},
|
| 1319 |
+
{
|
| 1320 |
+
"type": "text",
|
| 1321 |
+
"text": "Another limitation of our work is the evaluation datasets. Many existing code datasets and LCC share the same source of data from GitHub. The same data can appear in the",
|
| 1322 |
+
"bbox": [
|
| 1323 |
+
495,
|
| 1324 |
+
847,
|
| 1325 |
+
887,
|
| 1326 |
+
892
|
| 1327 |
+
],
|
| 1328 |
+
"page_idx": 7
|
| 1329 |
+
},
|
| 1330 |
+
{
|
| 1331 |
+
"type": "header",
|
| 1332 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 1333 |
+
"bbox": [
|
| 1334 |
+
236,
|
| 1335 |
+
56,
|
| 1336 |
+
733,
|
| 1337 |
+
71
|
| 1338 |
+
],
|
| 1339 |
+
"page_idx": 7
|
| 1340 |
+
},
|
| 1341 |
+
{
|
| 1342 |
+
"type": "page_number",
|
| 1343 |
+
"text": "8",
|
| 1344 |
+
"bbox": [
|
| 1345 |
+
480,
|
| 1346 |
+
922,
|
| 1347 |
+
491,
|
| 1348 |
+
934
|
| 1349 |
+
],
|
| 1350 |
+
"page_idx": 7
|
| 1351 |
+
},
|
| 1352 |
+
{
|
| 1353 |
+
"type": "text",
|
| 1354 |
+
"text": "pretraining data, making the evaluation less reliable. Additionally, models with larger-scale pretraining are even more likely to have seen the test data before. For example, OpenAI Codex is trained on all GitHub repositories, that undoubtedly, include most (if not all) test data in PY150, JavaCorpus, and LCC. As the code completion models have seen wider adoption in software development, future evaluation can be \"self-fulfilling\". For example, GitHub CoPilot<sup>5</sup> is a popular commercial code completion tool powered by OpenAI Codex. A lot of code generated by Codex may have already been submitted to GitHub. This could give widely-used models like Codex an advantage if it is evaluated on a dataset with a data source of the latest GitHub repositories, as we could be evaluating Codex on its own input. To address these problems, we need the community to contribute new, clean, and high-quality datasets with code from private projects to support future research.",
|
| 1355 |
+
"bbox": [
|
| 1356 |
+
84,
|
| 1357 |
+
84,
|
| 1358 |
+
475,
|
| 1359 |
+
340
|
| 1360 |
+
],
|
| 1361 |
+
"page_idx": 8
|
| 1362 |
+
},
|
| 1363 |
+
{
|
| 1364 |
+
"type": "text",
|
| 1365 |
+
"text": "Future Work LongCoder opens up new research opportunities in code generation not only within a large file, but also across multiple files. For example, we could allow the model to look at other files in the project for even more accurate code completion. It could enable new applications including automatically extracting package requirements, generating build files, refactoring the project, etc.",
|
| 1366 |
+
"bbox": [
|
| 1367 |
+
84,
|
| 1368 |
+
358,
|
| 1369 |
+
477,
|
| 1370 |
+
465
|
| 1371 |
+
],
|
| 1372 |
+
"page_idx": 8
|
| 1373 |
+
},
|
| 1374 |
+
{
|
| 1375 |
+
"type": "text",
|
| 1376 |
+
"text": "ACKNOWLEDGMENTS",
|
| 1377 |
+
"text_level": 1,
|
| 1378 |
+
"bbox": [
|
| 1379 |
+
86,
|
| 1380 |
+
479,
|
| 1381 |
+
243,
|
| 1382 |
+
494
|
| 1383 |
+
],
|
| 1384 |
+
"page_idx": 8
|
| 1385 |
+
},
|
| 1386 |
+
{
|
| 1387 |
+
"type": "text",
|
| 1388 |
+
"text": "Jian Yin is the corresponding author. Daya Guo and Jian Yin are supported by the National Natural Science Foundation of China (U1911203, U2001211, U22B2060), Guangdong Basic and Applied Basic Research Foundation (2019B1515130001), Key-Area Research and Development Program of Guangdong Province (2020B0101100001). We would like to thank the anonymous reviewers and the meta-reviewer for their insightful comments.",
|
| 1389 |
+
"bbox": [
|
| 1390 |
+
84,
|
| 1391 |
+
501,
|
| 1392 |
+
475,
|
| 1393 |
+
623
|
| 1394 |
+
],
|
| 1395 |
+
"page_idx": 8
|
| 1396 |
+
},
|
| 1397 |
+
{
|
| 1398 |
+
"type": "text",
|
| 1399 |
+
"text": "References",
|
| 1400 |
+
"text_level": 1,
|
| 1401 |
+
"bbox": [
|
| 1402 |
+
86,
|
| 1403 |
+
642,
|
| 1404 |
+
184,
|
| 1405 |
+
657
|
| 1406 |
+
],
|
| 1407 |
+
"page_idx": 8
|
| 1408 |
+
},
|
| 1409 |
+
{
|
| 1410 |
+
"type": "list",
|
| 1411 |
+
"sub_type": "ref_text",
|
| 1412 |
+
"list_items": [
|
| 1413 |
+
"Allamanis, M. The adverse effects of code duplication in machine learning models of code. In Onward!, pp. 143-153. ACM, 2019.",
|
| 1414 |
+
"Allamanis, M. and Sutton, C. Mining source code repositories at massive scale using language modeling. In 2013 10th Working Conference on Mining Software Repositories (MSR), pp. 207-216. IEEE, 2013.",
|
| 1415 |
+
"Allamanis, M. and Sutton, C. Mining idioms from source code. In SIGSOFT FSE, pp. 472-483. ACM, 2014.",
|
| 1416 |
+
"Beltagy, I., Peters, M. E., and Cohan, A. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020."
|
| 1417 |
+
],
|
| 1418 |
+
"bbox": [
|
| 1419 |
+
86,
|
| 1420 |
+
666,
|
| 1421 |
+
477,
|
| 1422 |
+
882
|
| 1423 |
+
],
|
| 1424 |
+
"page_idx": 8
|
| 1425 |
+
},
|
| 1426 |
+
{
|
| 1427 |
+
"type": "list",
|
| 1428 |
+
"sub_type": "ref_text",
|
| 1429 |
+
"list_items": [
|
| 1430 |
+
"Bielik, P., Raychev, V., and Vechev, M. T. PHOG: probabilistic model for code. In ICML, volume 48 of JMLR Workshop and Conference Proceedings, pp. 2933-2942. JMLR.org, 2016.",
|
| 1431 |
+
"Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., and Amodei, D. Language models are few-shot learners. In NeurIPS, 2020.",
|
| 1432 |
+
"Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H. P. d. O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.",
|
| 1433 |
+
"Child, R., Gray, S., Radford, A., and Sutskever, I. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.",
|
| 1434 |
+
"Choromanski, K. M., Likhosherstov, V., Dohan, D., Song, X., Gane, A., Sarlos, T., Hawkins, P., Davis, J. Q., Mohiuddin, A., Kaiser, L., Belanger, D. B., Colwell, L. J., and Weller, A. Rethinking attention with performers. In ICLR. OpenReview.net, 2021.",
|
| 1435 |
+
"Clement, C. B., Lu, S., Liu, X., Tufano, M., Drain, D., Duan, N., Sundaresan, N., and Svyatkovskiy, A. Long-range modeling of source code files with ewash: Extended window access by syntax hierarchy. In EMNLP, pp. 4713-4722. Association for Computational Linguistics, 2021.",
|
| 1436 |
+
"Devlin, J., Chang, M., Lee, K., and Toutanova, K. BERT: pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT*, pp. 4171-4186. Association for Computational Linguistics, 2019.",
|
| 1437 |
+
"Dong, L., Yang, N., Wang, W., Wei, F., Liu, X., Wang, Y., Gao, J., Zhou, M., and Hon, H. Unified language model pre-training for natural language understanding and generation. In NeurIPS, pp. 13042-13054, 2019.",
|
| 1438 |
+
"Fried, D., Aghajanyan, A., Lin, J., Wang, S., Wallace, E., Shi, F., Zhong, R., Yih, W.-t., Zettlemoyer, L., and Lewis, M. Incoder: A generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999, 2022.",
|
| 1439 |
+
"Guo, D., Lu, S., Duan, N., Wang, Y., Zhou, M., and Yin, J. Unixcoder: Unified cross-modal pre-training for code representation. In ACL, pp. 7212-7225. Association for Computational Linguistics, 2022.",
|
| 1440 |
+
"Hellendoorn, V. J. and Devanbu, P. T. Are deep neural networks the best choice for modeling source code? In ESEC/SIGSOFT FSE, pp. 763-773. ACM, 2017."
|
| 1441 |
+
],
|
| 1442 |
+
"bbox": [
|
| 1443 |
+
498,
|
| 1444 |
+
84,
|
| 1445 |
+
888,
|
| 1446 |
+
905
|
| 1447 |
+
],
|
| 1448 |
+
"page_idx": 8
|
| 1449 |
+
},
|
| 1450 |
+
{
|
| 1451 |
+
"type": "header",
|
| 1452 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 1453 |
+
"bbox": [
|
| 1454 |
+
236,
|
| 1455 |
+
56,
|
| 1456 |
+
733,
|
| 1457 |
+
71
|
| 1458 |
+
],
|
| 1459 |
+
"page_idx": 8
|
| 1460 |
+
},
|
| 1461 |
+
{
|
| 1462 |
+
"type": "page_footnote",
|
| 1463 |
+
"text": "<sup>5</sup>https://github.com/features/copilot",
|
| 1464 |
+
"bbox": [
|
| 1465 |
+
104,
|
| 1466 |
+
888,
|
| 1467 |
+
423,
|
| 1468 |
+
905
|
| 1469 |
+
],
|
| 1470 |
+
"page_idx": 8
|
| 1471 |
+
},
|
| 1472 |
+
{
|
| 1473 |
+
"type": "page_number",
|
| 1474 |
+
"text": "9",
|
| 1475 |
+
"bbox": [
|
| 1476 |
+
480,
|
| 1477 |
+
922,
|
| 1478 |
+
491,
|
| 1479 |
+
934
|
| 1480 |
+
],
|
| 1481 |
+
"page_idx": 8
|
| 1482 |
+
},
|
| 1483 |
+
{
|
| 1484 |
+
"type": "list",
|
| 1485 |
+
"sub_type": "ref_text",
|
| 1486 |
+
"list_items": [
|
| 1487 |
+
"Hindle, A., Barr, E. T., Gabel, M., Su, Z., and Devanbu, P. T. On the naturalness of software. Commun. ACM, 59(5): 122-131, 2016.",
|
| 1488 |
+
"Husain, H., Wu, H.-H., Gazit, T., Allamanis, M., and Brockschmidt, M. Codesearchnet challenge: Evaluating the state of semantic code search. arXiv preprint arXiv:1909.09436, 2019.",
|
| 1489 |
+
"Katharopoulos, A., Vyas, A., Pappas, N., and Fleuret, F. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, volume 119 of Proceedings of Machine Learning Research, pp. 5156-5165. PMLR, 2020.",
|
| 1490 |
+
"Kitaev, N., Kaiser, L., and Levskaya, A. Reformer: The efficient transformer. In *ICLR*. OpenReview.net, 2020.",
|
| 1491 |
+
"Li, Y., Choi, D., Chung, J., Kushman, N., Schrittwieser, J., Leblond, R., Eccles, T., Keeling, J., Gimeno, F., Dal Lago, A., et al. Competition-level code generation with alphabet. Science, 378(6624):1092-1097, 2022.",
|
| 1492 |
+
"Liu, F., Li, G., Zhao, Y., and Jin, Z. Multi-task learning based pre-trained language model for code completion. In ASE, pp. 473-485. IEEE, 2020.",
|
| 1493 |
+
"Liu, T., Xu, C., and McAuley, J. Repobench: Benchmarking repository-level code auto-completion systems. arXiv preprint, 2023.",
|
| 1494 |
+
"Lu, S., Guo, D., Ren, S., Huang, J., Svyatkovskiy, A., Blanco, A., Clement, C. B., Drain, D., Jiang, D., Tang, D., Li, G., Zhou, L., Shou, L., Zhou, L., Tufano, M., Gong, M., Zhou, M., Duan, N., Sundaresan, N., Deng, S. K., Fu, S., and Liu, S. Codexglue: A machine learning benchmark dataset for code understanding and generation. In NeurIPS Datasets and Benchmarks, 2021.",
|
| 1495 |
+
"Nijkamp, E., Pang, B., Hayashi, H., Tu, L., Wang, H., Zhou, Y., Savarese, S., and Xiong, C. A conversational paradigm for program synthesis. arXiv preprint arXiv:2203.13474, 2022.",
|
| 1496 |
+
"Qin, Z., Sun, W., Deng, H., Li, D., Wei, Y., Lv, B., Yan, J., Kong, L., and Zhong, Y. cosformer: Rethinking softmax in attention. In ICLR. OpenReview.net, 2022.",
|
| 1497 |
+
"Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.",
|
| 1498 |
+
"Raychev, V., Bielik, P., and Vechev, M. T. Probabilistic model for code with decision trees. In OOPSLA, pp. 731-747. ACM, 2016.",
|
| 1499 |
+
"Svyatkovskiy, A., Deng, S. K., Fu, S., and Sundaresan, N. \nIntellicode compose: code generation using transformer. In ESEC/SIGSOFT FSE, pp. 1433-1443. ACM, 2020."
|
| 1500 |
+
],
|
| 1501 |
+
"bbox": [
|
| 1502 |
+
86,
|
| 1503 |
+
84,
|
| 1504 |
+
475,
|
| 1505 |
+
905
|
| 1506 |
+
],
|
| 1507 |
+
"page_idx": 9
|
| 1508 |
+
},
|
| 1509 |
+
{
|
| 1510 |
+
"type": "list",
|
| 1511 |
+
"sub_type": "ref_text",
|
| 1512 |
+
"list_items": [
|
| 1513 |
+
"Tay, Y., Dehghani, M., Bahri, D., and Metzler, D. Efficient transformers: A survey. ACM Computing Surveys, 55(6): 1-28, 2022.",
|
| 1514 |
+
"Tu, Z., Su, Z., and Devanbu, P. T. On the localness of software. In SIGSOFT FSE, pp. 269-280. ACM, 2014.",
|
| 1515 |
+
"Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In NIPS, pp. 5998-6008, 2017.",
|
| 1516 |
+
"Wang, S., Li, B. Z., Khabsa, M., Fang, H., and Ma, H. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.",
|
| 1517 |
+
"Xu, F. F., Alon, U., Neubig, G., and Hellendoorn, V. J. A systematic evaluation of large language models of code. In MAPS@PLDI, pp. 1-10. ACM, 2022.",
|
| 1518 |
+
"Zaheer, M., Guruganesh, G., Dubey, K. A., Ainslie, J., Alberti, C., Ontañón, S., Pham, P., Ravula, A., Wang, Q., Yang, L., and Ahmed, A. Big bird: Transformers for longer sequences. In NeurIPS, 2020."
|
| 1519 |
+
],
|
| 1520 |
+
"bbox": [
|
| 1521 |
+
500,
|
| 1522 |
+
84,
|
| 1523 |
+
885,
|
| 1524 |
+
406
|
| 1525 |
+
],
|
| 1526 |
+
"page_idx": 9
|
| 1527 |
+
},
|
| 1528 |
+
{
|
| 1529 |
+
"type": "header",
|
| 1530 |
+
"text": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion",
|
| 1531 |
+
"bbox": [
|
| 1532 |
+
236,
|
| 1533 |
+
56,
|
| 1534 |
+
733,
|
| 1535 |
+
71
|
| 1536 |
+
],
|
| 1537 |
+
"page_idx": 9
|
| 1538 |
+
},
|
| 1539 |
+
{
|
| 1540 |
+
"type": "page_number",
|
| 1541 |
+
"text": "10",
|
| 1542 |
+
"bbox": [
|
| 1543 |
+
477,
|
| 1544 |
+
922,
|
| 1545 |
+
495,
|
| 1546 |
+
934
|
| 1547 |
+
],
|
| 1548 |
+
"page_idx": 9
|
| 1549 |
+
}
|
| 1550 |
+
]
|
2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/764c4fd6-5564-414d-aed4-faf9cde1cc97_model.json
ADDED
|
@@ -0,0 +1,1969 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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5 |
+
"bbox": [
|
| 6 |
+
0.09,
|
| 7 |
+
0.11,
|
| 8 |
+
0.884,
|
| 9 |
+
0.133
|
| 10 |
+
],
|
| 11 |
+
"angle": 0,
|
| 12 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"bbox": [
|
| 17 |
+
0.235,
|
| 18 |
+
0.177,
|
| 19 |
+
0.737,
|
| 20 |
+
0.195
|
| 21 |
+
],
|
| 22 |
+
"angle": 0,
|
| 23 |
+
"content": "Daya Guo \\(^{*1}\\) Canwen Xu \\(^{*2}\\) Nan Duan \\(^{3}\\) Jian Yin \\(^{1}\\) Julian McAuley \\(^{2}\\)"
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "title",
|
| 27 |
+
"bbox": [
|
| 28 |
+
0.242,
|
| 29 |
+
0.221,
|
| 30 |
+
0.321,
|
| 31 |
+
0.236
|
| 32 |
+
],
|
| 33 |
+
"angle": 0,
|
| 34 |
+
"content": "Abstract"
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"type": "text",
|
| 38 |
+
"bbox": [
|
| 39 |
+
0.118,
|
| 40 |
+
0.241,
|
| 41 |
+
0.445,
|
| 42 |
+
0.589
|
| 43 |
+
],
|
| 44 |
+
"angle": 0,
|
| 45 |
+
"content": "In this paper, we introduce a new task for code completion that focuses on handling long code input and propose a sparse Transformer model, called LongCoder, to address this task. LongCoder employs a sliding window mechanism for self-attention and introduces two types of globally accessible tokens — bridge tokens and memory tokens — to improve performance and efficiency. Bridge tokens are inserted throughout the input sequence to aggregate local information and facilitate global interaction, while memory tokens are included to highlight important statements that may be invoked later and need to be memorized, such as package imports and definitions of classes, functions, or structures. We conduct experiments on a newly constructed dataset that contains longer code context and the publicly available CodeXGLUE benchmark. Experimental results demonstrate that LongCoder achieves superior performance on code completion tasks compared to previous models while maintaining comparable efficiency in terms of computational resources during inference."
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"type": "title",
|
| 49 |
+
"bbox": [
|
| 50 |
+
0.087,
|
| 51 |
+
0.615,
|
| 52 |
+
0.218,
|
| 53 |
+
0.631
|
| 54 |
+
],
|
| 55 |
+
"angle": 0,
|
| 56 |
+
"content": "1. Introduction"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"type": "text",
|
| 60 |
+
"bbox": [
|
| 61 |
+
0.085,
|
| 62 |
+
0.64,
|
| 63 |
+
0.477,
|
| 64 |
+
0.807
|
| 65 |
+
],
|
| 66 |
+
"angle": 0,
|
| 67 |
+
"content": "Code completion is a crucial task in software development that helps developers save time and effort by suggesting and auto-completing code based on context. With the advancement of large language models, Transformer-based models (Vaswani et al., 2017) have demonstrated impressive results in code completion (Chen et al., 2021). However, the computational cost of these models grows quadratically with the length of input, making them less suitable for modeling long code context. On the other hand, modeling long code can potentially improve the accuracy of code completion and enable applications on a file and even project level."
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"type": "text",
|
| 71 |
+
"bbox": [
|
| 72 |
+
0.085,
|
| 73 |
+
0.816,
|
| 74 |
+
0.475,
|
| 75 |
+
0.856
|
| 76 |
+
],
|
| 77 |
+
"angle": 0,
|
| 78 |
+
"content": "*Equal contribution \\( {}^{1} \\) Sun Yat-sen University \\( {}^{2} \\) University of California, San Diego \\( {}^{3} \\) Microsoft Research Asia. Correspondence to: Daya Guo <guody5@mail2.sysu.edu.cn>."
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"type": "text",
|
| 82 |
+
"bbox": [
|
| 83 |
+
0.085,
|
| 84 |
+
0.866,
|
| 85 |
+
0.475,
|
| 86 |
+
0.906
|
| 87 |
+
],
|
| 88 |
+
"angle": 0,
|
| 89 |
+
"content": "Proceedings of the \\(40^{th}\\) International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s)."
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"type": "text",
|
| 93 |
+
"bbox": [
|
| 94 |
+
0.497,
|
| 95 |
+
0.222,
|
| 96 |
+
0.886,
|
| 97 |
+
0.253
|
| 98 |
+
],
|
| 99 |
+
"angle": 0,
|
| 100 |
+
"content": "An efficient model that can scale to such long input can be suitable for code completion that contains long context."
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"type": "text",
|
| 104 |
+
"bbox": [
|
| 105 |
+
0.496,
|
| 106 |
+
0.259,
|
| 107 |
+
0.888,
|
| 108 |
+
0.577
|
| 109 |
+
],
|
| 110 |
+
"angle": 0,
|
| 111 |
+
"content": "In this paper, we propose a new pre-trained language model, named LongCoder, for long code modeling. As shown in Figure 1, LongCoder features a sparse attention mechanism that reduces the computational complexity (to linear). LongCoder exploits a sliding window mechanism for self-attention that attends only to local context. To allow LongCoder to maintain an understanding of the entire code file, we introduce bridge attention and global attention, with the corresponding two types of globally accessible tokens, bridge tokens and memory tokens. Bridge attention aggregates the information of a code snippet and allows it to be accessed from a long distance. Bridge tokens are inserted throughout the input sequence and can attend to a fixed length of context. Memory tokens provide global attention to statements that include a package import, definitions of classes, functions, or structures. The scope of these statements is often global and invoked later, which means they have a longer impact than other statements, making them worth memorizing. By referring to these statements, the model can exploit long context while maintaining linear complexity."
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"type": "text",
|
| 115 |
+
"bbox": [
|
| 116 |
+
0.496,
|
| 117 |
+
0.585,
|
| 118 |
+
0.887,
|
| 119 |
+
0.766
|
| 120 |
+
],
|
| 121 |
+
"angle": 0,
|
| 122 |
+
"content": "To evaluate the effectiveness of LongCoder and encourage future research on Long Code Completion, we construct a new dataset called LCC by filtering code from GitHub based on length, with the goal of focusing on longer code examples. On average, the examples in LCC are \\(5 \\times\\) longer than those in existing datasets (Lu et al., 2021). We benchmark several baselines, LongCoder and OpenAI Codex (Chen et al., 2021) on LCC. Our experimental results demonstrate that code completion can benefit from taking longer context into consideration, and our LongCoder achieves superior performance compared to existing models with comparable computational costs."
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"type": "text",
|
| 126 |
+
"bbox": [
|
| 127 |
+
0.497,
|
| 128 |
+
0.773,
|
| 129 |
+
0.771,
|
| 130 |
+
0.788
|
| 131 |
+
],
|
| 132 |
+
"angle": 0,
|
| 133 |
+
"content": "Overall, our contributions are as follows:"
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"type": "text",
|
| 137 |
+
"bbox": [
|
| 138 |
+
0.516,
|
| 139 |
+
0.806,
|
| 140 |
+
0.884,
|
| 141 |
+
0.849
|
| 142 |
+
],
|
| 143 |
+
"angle": 0,
|
| 144 |
+
"content": "- We construct a new dataset (LCC) for code completion tasks that requires long code modeling to encourage more research in such scenarios."
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"type": "text",
|
| 148 |
+
"bbox": [
|
| 149 |
+
0.517,
|
| 150 |
+
0.861,
|
| 151 |
+
0.885,
|
| 152 |
+
0.905
|
| 153 |
+
],
|
| 154 |
+
"angle": 0,
|
| 155 |
+
"content": "- We propose two types of sparse attention, motivated by observations on attention patterns of existing models and how human programmers write code."
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
"type": "list",
|
| 159 |
+
"bbox": [
|
| 160 |
+
0.516,
|
| 161 |
+
0.806,
|
| 162 |
+
0.885,
|
| 163 |
+
0.905
|
| 164 |
+
],
|
| 165 |
+
"angle": 0,
|
| 166 |
+
"content": null
|
| 167 |
+
},
|
| 168 |
+
{
|
| 169 |
+
"type": "page_number",
|
| 170 |
+
"bbox": [
|
| 171 |
+
0.482,
|
| 172 |
+
0.924,
|
| 173 |
+
0.492,
|
| 174 |
+
0.935
|
| 175 |
+
],
|
| 176 |
+
"angle": 0,
|
| 177 |
+
"content": "1"
|
| 178 |
+
}
|
| 179 |
+
],
|
| 180 |
+
[
|
| 181 |
+
{
|
| 182 |
+
"type": "header",
|
| 183 |
+
"bbox": [
|
| 184 |
+
0.237,
|
| 185 |
+
0.057,
|
| 186 |
+
0.735,
|
| 187 |
+
0.071
|
| 188 |
+
],
|
| 189 |
+
"angle": 0,
|
| 190 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"type": "title",
|
| 194 |
+
"bbox": [
|
| 195 |
+
0.117,
|
| 196 |
+
0.088,
|
| 197 |
+
0.269,
|
| 198 |
+
0.1
|
| 199 |
+
],
|
| 200 |
+
"angle": 0,
|
| 201 |
+
"content": "Out-of-Window Context"
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"type": "code",
|
| 205 |
+
"bbox": [
|
| 206 |
+
0.114,
|
| 207 |
+
0.109,
|
| 208 |
+
0.653,
|
| 209 |
+
0.259
|
| 210 |
+
],
|
| 211 |
+
"angle": 0,
|
| 212 |
+
"content": "import torch\\n \nimport torch nn as nn\\n \nimport torch nnfunctional as F\\n \nclass ConvBlock(nnModule): \\n \n\"A block of convolutional and pooling layers.\" \n\"A\" \ndef __init__(self, in_channels, out_channels, kernel_size, stride, padding): \\nsuper(ConvBlock, self).__init() \nself.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding) \nself.pool = nn.MaxPool2d(kernel_size=2) \ndef forward(self, x): \\nx = self.pool(F.ReLU(self.conv(x))) \nreturn x"
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"type": "title",
|
| 216 |
+
"bbox": [
|
| 217 |
+
0.117,
|
| 218 |
+
0.271,
|
| 219 |
+
0.24,
|
| 220 |
+
0.284
|
| 221 |
+
],
|
| 222 |
+
"angle": 0,
|
| 223 |
+
"content": "In-Window Context"
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"type": "code",
|
| 227 |
+
"bbox": [
|
| 228 |
+
0.114,
|
| 229 |
+
0.292,
|
| 230 |
+
0.659,
|
| 231 |
+
0.43
|
| 232 |
+
],
|
| 233 |
+
"angle": 0,
|
| 234 |
+
"content": "class ConvNet(nnModule): \\n\n\"A convolutional neural network\n''\ndef __init__(self):\n super(ConvNet, self).__init()\n self.conv_block1 = ConvBlock(3, 32, 3, 1, 1) #first block\n self.conv_block2 = ConvBlock(32, 64, 3, 1, 1) #second block\n self/flatten = nn.Conv()\n self.fc1 = nn.Linear(\n in_features=64 * 8 * 8, out_features=128)\n self.fc2 = nn.Linear(\n in_features=128, out_features=10)"
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"type": "title",
|
| 238 |
+
"bbox": [
|
| 239 |
+
0.114,
|
| 240 |
+
0.454,
|
| 241 |
+
0.23,
|
| 242 |
+
0.466
|
| 243 |
+
],
|
| 244 |
+
"angle": 0,
|
| 245 |
+
"content": "Code to Complete"
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"type": "code",
|
| 249 |
+
"bbox": [
|
| 250 |
+
0.114,
|
| 251 |
+
0.474,
|
| 252 |
+
0.32,
|
| 253 |
+
0.541
|
| 254 |
+
],
|
| 255 |
+
"angle": 0,
|
| 256 |
+
"content": "def forward(self, x):\n x = self.convert_block( x )\n x = self.convert_block( x )\n x = self.flatten( x )\n x = F.relu(self.fcl( x ))\n x = self.fc2( x )\n return x"
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
"type": "image",
|
| 260 |
+
"bbox": [
|
| 261 |
+
0.404,
|
| 262 |
+
0.465,
|
| 263 |
+
0.581,
|
| 264 |
+
0.549
|
| 265 |
+
],
|
| 266 |
+
"angle": 0,
|
| 267 |
+
"content": null
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"type": "title",
|
| 271 |
+
"bbox": [
|
| 272 |
+
0.693,
|
| 273 |
+
0.088,
|
| 274 |
+
0.803,
|
| 275 |
+
0.1
|
| 276 |
+
],
|
| 277 |
+
"angle": 0,
|
| 278 |
+
"content": "Attention Pattern"
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"type": "image",
|
| 282 |
+
"bbox": [
|
| 283 |
+
0.724,
|
| 284 |
+
0.115,
|
| 285 |
+
0.834,
|
| 286 |
+
0.214
|
| 287 |
+
],
|
| 288 |
+
"angle": 0,
|
| 289 |
+
"content": null
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"type": "image",
|
| 293 |
+
"bbox": [
|
| 294 |
+
0.725,
|
| 295 |
+
0.233,
|
| 296 |
+
0.834,
|
| 297 |
+
0.342
|
| 298 |
+
],
|
| 299 |
+
"angle": 0,
|
| 300 |
+
"content": null
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"type": "image",
|
| 304 |
+
"bbox": [
|
| 305 |
+
0.725,
|
| 306 |
+
0.367,
|
| 307 |
+
0.834,
|
| 308 |
+
0.466
|
| 309 |
+
],
|
| 310 |
+
"angle": 0,
|
| 311 |
+
"content": null
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"type": "image",
|
| 315 |
+
"bbox": [
|
| 316 |
+
0.725,
|
| 317 |
+
0.478,
|
| 318 |
+
0.834,
|
| 319 |
+
0.527
|
| 320 |
+
],
|
| 321 |
+
"angle": 0,
|
| 322 |
+
"content": null
|
| 323 |
+
},
|
| 324 |
+
{
|
| 325 |
+
"type": "image_caption",
|
| 326 |
+
"bbox": [
|
| 327 |
+
0.084,
|
| 328 |
+
0.577,
|
| 329 |
+
0.888,
|
| 330 |
+
0.646
|
| 331 |
+
],
|
| 332 |
+
"angle": 0,
|
| 333 |
+
"content": "Figure 1. (Left) An example of how LongCoder facilitates completion with longer context. The memory tokens save potentially useful information (including package imports, class and function definitions) for global access despite whether they are within the sliding window. The bridge tokens aggregate local information by attending to a fixed length of tokens. The information flow within the window is omitted for clarity. (Right) Attention patterns used in BigBird (Zaheer et al., 2020), Longformer (Beltagy et al., 2020) and LongCoder. Best viewed in color."
|
| 334 |
+
},
|
| 335 |
+
{
|
| 336 |
+
"type": "text",
|
| 337 |
+
"bbox": [
|
| 338 |
+
0.105,
|
| 339 |
+
0.67,
|
| 340 |
+
0.477,
|
| 341 |
+
0.743
|
| 342 |
+
],
|
| 343 |
+
"angle": 0,
|
| 344 |
+
"content": "- We train and release LongCoder, a sparse and efficient pre-trained Transformer model for long code modeling, which achieves superior performance on both long and regular code completion with comparable computational resources."
|
| 345 |
+
},
|
| 346 |
+
{
|
| 347 |
+
"type": "title",
|
| 348 |
+
"bbox": [
|
| 349 |
+
0.086,
|
| 350 |
+
0.764,
|
| 351 |
+
0.228,
|
| 352 |
+
0.78
|
| 353 |
+
],
|
| 354 |
+
"angle": 0,
|
| 355 |
+
"content": "2. Related Work"
|
| 356 |
+
},
|
| 357 |
+
{
|
| 358 |
+
"type": "text",
|
| 359 |
+
"bbox": [
|
| 360 |
+
0.085,
|
| 361 |
+
0.79,
|
| 362 |
+
0.476,
|
| 363 |
+
0.866
|
| 364 |
+
],
|
| 365 |
+
"angle": 0,
|
| 366 |
+
"content": "Code Completion Code completion is an essential task that helps programmers improve their efficiency by suggesting and automatically completing code based on context and previous inputs. Prior works have explored the use of statistical learning for the code completion task, such as the use of"
|
| 367 |
+
},
|
| 368 |
+
{
|
| 369 |
+
"type": "page_footnote",
|
| 370 |
+
"bbox": [
|
| 371 |
+
0.086,
|
| 372 |
+
0.875,
|
| 373 |
+
0.478,
|
| 374 |
+
0.903
|
| 375 |
+
],
|
| 376 |
+
"angle": 0,
|
| 377 |
+
"content": "1All the codes and data are available at https://github. com/microsoft/CodeBERT."
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"type": "text",
|
| 381 |
+
"bbox": [
|
| 382 |
+
0.496,
|
| 383 |
+
0.669,
|
| 384 |
+
0.888,
|
| 385 |
+
0.897
|
| 386 |
+
],
|
| 387 |
+
"angle": 0,
|
| 388 |
+
"content": "n-gram techniques (Tu et al., 2014; Hindle et al., 2016) and probabilistic grammar-based methods (Allamanis & Sutton, 2014; Bielik et al., 2016; Raychev et al., 2016; Hellendoorn & Devanbu, 2017). With the success of pre-training in natural language processing (Devlin et al., 2019; Radford et al., 2019; Brown et al., 2020), decoder-only pre-trained models based on Transformer have been proposed to promote the development of code completion. Svyatkovskiy et al. (2020) and Lu et al. (2021) respectively propose GPT-C and CodeGPT, which are pre-trained by generating code from left to right in an auto-regressive manner on large amounts of code. Liu et al. (2020) and Guo et al. (2022) pre-train similar models CugLM and UniXcoder with multi-task learning by leveraging code structure for code completion. Codex (Chen et al., 2021), PolyCoder (Xu et al., 2022), CodeGen"
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"type": "page_number",
|
| 392 |
+
"bbox": [
|
| 393 |
+
0.481,
|
| 394 |
+
0.923,
|
| 395 |
+
0.493,
|
| 396 |
+
0.935
|
| 397 |
+
],
|
| 398 |
+
"angle": 0,
|
| 399 |
+
"content": "2"
|
| 400 |
+
}
|
| 401 |
+
],
|
| 402 |
+
[
|
| 403 |
+
{
|
| 404 |
+
"type": "header",
|
| 405 |
+
"bbox": [
|
| 406 |
+
0.237,
|
| 407 |
+
0.057,
|
| 408 |
+
0.737,
|
| 409 |
+
0.071
|
| 410 |
+
],
|
| 411 |
+
"angle": 0,
|
| 412 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 413 |
+
},
|
| 414 |
+
{
|
| 415 |
+
"type": "text",
|
| 416 |
+
"bbox": [
|
| 417 |
+
0.085,
|
| 418 |
+
0.085,
|
| 419 |
+
0.477,
|
| 420 |
+
0.372
|
| 421 |
+
],
|
| 422 |
+
"angle": 0,
|
| 423 |
+
"content": "(Nijkamp et al., 2022), InCoder (Fried et al., 2022), and AlphaCode (Li et al., 2022) build large language models with billions of parameters and achieve impressive performance on code generation by training on a large-scale and high-quality code corpus. For these pre-trained models, it is impractical to simply expand the context window to model long-range sequences, due to computational complexity of the attention mechanism increasing quadratically with the input length. Therefore, Clement et al. (2021) propose to extract the most important code fragments and integrate them into a fixed-length context window. However, due to the constraint of fixed window length, some high-priority code, such as class and function definitions, may be omitted. Additionally, increasing the window length would also introduce additional computational overhead. Different from these works, LongCoder is a sparse Transformer that can take advantage of the entire file-level code context while maintaining comparable efficiency in terms of computational resources during inference."
|
| 424 |
+
},
|
| 425 |
+
{
|
| 426 |
+
"type": "text",
|
| 427 |
+
"bbox": [
|
| 428 |
+
0.085,
|
| 429 |
+
0.408,
|
| 430 |
+
0.478,
|
| 431 |
+
0.907
|
| 432 |
+
],
|
| 433 |
+
"angle": 0,
|
| 434 |
+
"content": "Long-Range Transformer Models The original Transformer (Vaswani et al., 2017) is inefficient for modeling long sequences since its time and space complexity is \\( O(n^{2}) \\), where \\( n \\) is the length of the sequence. Prior studies focus on optimizing the complexity to enable processing of longer sequences. To name a few, Sparse Transformer (Child et al., 2019) reduces the quadratic complexity of standard selfattention by computing attention on sparse query-key pairs. Sparse Transformer uses a dilated sliding window to capture local context. Reformer (Kitaev et al., 2020) proposes locality sensitive hashing (LSH) attention to reduce the complexity and memory footprint. Longformer (Beltagy et al., 2020) uses dilated sliding windows to model longer sequences and adds global memory tokens to allow interaction with all tokens. Performer (Choromanski et al., 2021) generalizes attention calculation by introducing kernel functions. They then propose a random kernel function, namely orthogonal random features (ORF) to approximate the standard selfattention. Linformer (Wang et al., 2020) applies low-rank projection to the length dimension to reduce the complexity of self-attention. Linear Transformers (Katharopoulos et al., 2020) uses a kernel function that exploits the associativity property of matrix products to reduce complexity. BigBird (Zaheer et al., 2020) has an attention pattern comprised of random attention, window attention and global attention. CosFormer (Qin et al., 2022) proposes a linear operator and a cosine-based distance re-weighting mechanism as the substitute for softmax attention. We recommend Tay et al. (2022) as a more comprehensive survey on long-range efficient Transformer models. Different from these works, our LongCoder introduces code heuristics into the dynamic construction of global attention to imitate how human programmers code."
|
| 435 |
+
},
|
| 436 |
+
{
|
| 437 |
+
"type": "title",
|
| 438 |
+
"bbox": [
|
| 439 |
+
0.498,
|
| 440 |
+
0.084,
|
| 441 |
+
0.719,
|
| 442 |
+
0.102
|
| 443 |
+
],
|
| 444 |
+
"angle": 0,
|
| 445 |
+
"content": "3. Long Code Completion"
|
| 446 |
+
},
|
| 447 |
+
{
|
| 448 |
+
"type": "text",
|
| 449 |
+
"bbox": [
|
| 450 |
+
0.496,
|
| 451 |
+
0.11,
|
| 452 |
+
0.889,
|
| 453 |
+
0.533
|
| 454 |
+
],
|
| 455 |
+
"angle": 0,
|
| 456 |
+
"content": "Code completion is a fundamental and important task for code models, which can help programmers improve their efficiency while coding. Previous public benchmarks primarily focused on completion with short code context. For instance, CodeXGLUE (Lu et al., 2021) offers two code completion datasets from PY150 (Raychev et al., 2016) in Python and Github Java Corpus Allamanis & Sutton (2013) in Java, and also builds two test datasets to evaluate next-line prediction. The average length of the code context in the two test datasets is 478 tokens and 365 tokens, respectively. However, according to our statistics, the average length of a Python source file on GitHub is 1,305 tokens. After tokenization, the average length becomes 2,090 tokens while \\(41\\% / 24\\%\\) of the files have a length longer than 1,024/2,048 tokens, which highlights the need for models that can handle longer code sequences in order to be more practical and useful in the real-world. Meanwhile, longer code sequences contain more complex structures and require models to consider more context and dependencies. This can be challenging for previously proposed code completion models that focus on short code and do not take into account the long context of the code. By evaluating models on longer code sequences, we can better understand their ability to handle more complex and realistic scenarios. Meanwhile, long code completion poses new challenges for efficiency of code models, as in vanilla Transformers (Vaswani et al., 2017), the computational resources grow quadratically with the input length."
|
| 457 |
+
},
|
| 458 |
+
{
|
| 459 |
+
"type": "text",
|
| 460 |
+
"bbox": [
|
| 461 |
+
0.496,
|
| 462 |
+
0.54,
|
| 463 |
+
0.888,
|
| 464 |
+
0.66
|
| 465 |
+
],
|
| 466 |
+
"angle": 0,
|
| 467 |
+
"content": "In this paper, we introduce the Long Code Completion Benchmark (LCC), a new benchmark that focuses on code completion with long code context for three programming languages: Python, Java, and C#. Specifically, we construct our datasets from the github-code\\(^2\\) dataset, which contains a vast number of code files sourced from GitHub with an open-source license that permits research use. The steps to construct the datasets are as follows:"
|
| 468 |
+
},
|
| 469 |
+
{
|
| 470 |
+
"type": "text",
|
| 471 |
+
"bbox": [
|
| 472 |
+
0.516,
|
| 473 |
+
0.679,
|
| 474 |
+
0.887,
|
| 475 |
+
0.756
|
| 476 |
+
],
|
| 477 |
+
"angle": 0,
|
| 478 |
+
"content": "- We first follow Allamanis (2019) to deduplicate examples with high similarity (Jacobi similarity \\(\\geq 0.9\\)) in order to eliminate forked files, and then remove code files that can't be parsed into an abstract syntax tree using a standard compiler tool called tree-sitter.\\(^3\\)"
|
| 479 |
+
},
|
| 480 |
+
{
|
| 481 |
+
"type": "text",
|
| 482 |
+
"bbox": [
|
| 483 |
+
0.516,
|
| 484 |
+
0.768,
|
| 485 |
+
0.888,
|
| 486 |
+
0.844
|
| 487 |
+
],
|
| 488 |
+
"angle": 0,
|
| 489 |
+
"content": "- Since the benchmark primarily focuses on the code completion task with long code context, we remove code files whose length of code tokens after tokenization is shorter than 512. Additionally, we also eliminate excessively long code files with a length greater than"
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
"type": "list",
|
| 493 |
+
"bbox": [
|
| 494 |
+
0.516,
|
| 495 |
+
0.679,
|
| 496 |
+
0.888,
|
| 497 |
+
0.844
|
| 498 |
+
],
|
| 499 |
+
"angle": 0,
|
| 500 |
+
"content": null
|
| 501 |
+
},
|
| 502 |
+
{
|
| 503 |
+
"type": "page_footnote",
|
| 504 |
+
"bbox": [
|
| 505 |
+
0.498,
|
| 506 |
+
0.852,
|
| 507 |
+
0.811,
|
| 508 |
+
0.878
|
| 509 |
+
],
|
| 510 |
+
"angle": 0,
|
| 511 |
+
"content": "\\(^{2}\\)https://huggingface.co/datasets/codeparrot.github-code"
|
| 512 |
+
},
|
| 513 |
+
{
|
| 514 |
+
"type": "page_footnote",
|
| 515 |
+
"bbox": [
|
| 516 |
+
0.498,
|
| 517 |
+
0.878,
|
| 518 |
+
0.802,
|
| 519 |
+
0.904
|
| 520 |
+
],
|
| 521 |
+
"angle": 0,
|
| 522 |
+
"content": "3https://github.com/tree-sitter/ tree-sitter"
|
| 523 |
+
},
|
| 524 |
+
{
|
| 525 |
+
"type": "list",
|
| 526 |
+
"bbox": [
|
| 527 |
+
0.498,
|
| 528 |
+
0.852,
|
| 529 |
+
0.811,
|
| 530 |
+
0.904
|
| 531 |
+
],
|
| 532 |
+
"angle": 0,
|
| 533 |
+
"content": null
|
| 534 |
+
},
|
| 535 |
+
{
|
| 536 |
+
"type": "page_number",
|
| 537 |
+
"bbox": [
|
| 538 |
+
0.481,
|
| 539 |
+
0.924,
|
| 540 |
+
0.492,
|
| 541 |
+
0.935
|
| 542 |
+
],
|
| 543 |
+
"angle": 0,
|
| 544 |
+
"content": "3"
|
| 545 |
+
}
|
| 546 |
+
],
|
| 547 |
+
[
|
| 548 |
+
{
|
| 549 |
+
"type": "header",
|
| 550 |
+
"bbox": [
|
| 551 |
+
0.237,
|
| 552 |
+
0.057,
|
| 553 |
+
0.737,
|
| 554 |
+
0.073
|
| 555 |
+
],
|
| 556 |
+
"angle": 0,
|
| 557 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 558 |
+
},
|
| 559 |
+
{
|
| 560 |
+
"type": "table_caption",
|
| 561 |
+
"bbox": [
|
| 562 |
+
0.086,
|
| 563 |
+
0.094,
|
| 564 |
+
0.477,
|
| 565 |
+
0.122
|
| 566 |
+
],
|
| 567 |
+
"angle": 0,
|
| 568 |
+
"content": "Table 1. Data statistics of the code context length in LCC test set. \\(25\\% /50\\% /75\\%\\) refer to the first/second/third quartile."
|
| 569 |
+
},
|
| 570 |
+
{
|
| 571 |
+
"type": "table",
|
| 572 |
+
"bbox": [
|
| 573 |
+
0.122,
|
| 574 |
+
0.127,
|
| 575 |
+
0.44,
|
| 576 |
+
0.205
|
| 577 |
+
],
|
| 578 |
+
"angle": 0,
|
| 579 |
+
"content": "<table><tr><td>Language</td><td>Average</td><td>25%</td><td>50%</td><td>75%</td></tr><tr><td>Python</td><td>1993.3</td><td>1056</td><td>1438</td><td>2211</td></tr><tr><td>Java</td><td>1841.4</td><td>1058</td><td>1307</td><td>2003</td></tr><tr><td>C#</td><td>1970.5</td><td>1023</td><td>1396</td><td>2143</td></tr></table>"
|
| 580 |
+
},
|
| 581 |
+
{
|
| 582 |
+
"type": "text",
|
| 583 |
+
"bbox": [
|
| 584 |
+
0.119,
|
| 585 |
+
0.239,
|
| 586 |
+
0.218,
|
| 587 |
+
0.253
|
| 588 |
+
],
|
| 589 |
+
"angle": 0,
|
| 590 |
+
"content": "10,000 tokens."
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"type": "text",
|
| 594 |
+
"bbox": [
|
| 595 |
+
0.105,
|
| 596 |
+
0.271,
|
| 597 |
+
0.477,
|
| 598 |
+
0.392
|
| 599 |
+
],
|
| 600 |
+
"angle": 0,
|
| 601 |
+
"content": "- For each programming language, we sample 100k examples for training, and 10k examples for development and 10k for testing. For each sample on development and test sets, we randomly sample an uncommented line of code not shorted than 3 tokens and ensure that there is sufficient context, i.e., a context larger than 512 code tokens. The data statistics of the context length in the LCC test sets are listed in Table 1."
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"type": "text",
|
| 605 |
+
"bbox": [
|
| 606 |
+
0.085,
|
| 607 |
+
0.413,
|
| 608 |
+
0.475,
|
| 609 |
+
0.46
|
| 610 |
+
],
|
| 611 |
+
"angle": 0,
|
| 612 |
+
"content": "We follow Lu et al. (2021) to evaluate the performance of the models in terms of Exact Match (EM) and Edit Similarity (Edit Sim) on a per-line basis (Svyatkovskiy et al., 2020)."
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
"type": "title",
|
| 616 |
+
"bbox": [
|
| 617 |
+
0.086,
|
| 618 |
+
0.478,
|
| 619 |
+
0.208,
|
| 620 |
+
0.495
|
| 621 |
+
],
|
| 622 |
+
"angle": 0,
|
| 623 |
+
"content": "4. LongCoder"
|
| 624 |
+
},
|
| 625 |
+
{
|
| 626 |
+
"type": "text",
|
| 627 |
+
"bbox": [
|
| 628 |
+
0.083,
|
| 629 |
+
0.503,
|
| 630 |
+
0.477,
|
| 631 |
+
0.641
|
| 632 |
+
],
|
| 633 |
+
"angle": 0,
|
| 634 |
+
"content": "LongCoder is an attempt to tackle the efficiency problem of modeling longer code. It applies sparse attention to reduce quadratic time and space complexity of self-attention to linear. There are three types of attention in LongCoder — window attention, bridge attention, and global attention. Each type is motivated by observations on previous models and focuses on one important aspect in modeling long code. The three types of attention are illustrated in Figure 1 and we will describe them individually."
|
| 635 |
+
},
|
| 636 |
+
{
|
| 637 |
+
"type": "title",
|
| 638 |
+
"bbox": [
|
| 639 |
+
0.086,
|
| 640 |
+
0.657,
|
| 641 |
+
0.249,
|
| 642 |
+
0.67
|
| 643 |
+
],
|
| 644 |
+
"angle": 0,
|
| 645 |
+
"content": "4.1. Window Attention"
|
| 646 |
+
},
|
| 647 |
+
{
|
| 648 |
+
"type": "text",
|
| 649 |
+
"bbox": [
|
| 650 |
+
0.085,
|
| 651 |
+
0.679,
|
| 652 |
+
0.478,
|
| 653 |
+
0.906
|
| 654 |
+
],
|
| 655 |
+
"angle": 0,
|
| 656 |
+
"content": "Code completion largely relies on local context while only a few instances of long-distance dependencies are present. For example, in Figure 1 (bottom left), generating assignment operators and parentheses only depend on the current statement, whereas to generate variables such as \\( x \\) and conv_block, the model needs to look at neighboring statements. Intuitively, we can exploit such locality to sparsify the attention to achieve better efficiency. We further verify this observation by counting the distribution of average attention scores between two tokens within different distances. As shown in Figure 2, a large portion of attention is concentrated within a narrow window. Notably, a fixed window of 256 covers more than \\( 90\\% \\) of the attention weights. This sparsity enables us to apply a sliding window attention mechanism (Beltagy et al., 2020; Zaheer et al., 2020)."
|
| 657 |
+
},
|
| 658 |
+
{
|
| 659 |
+
"type": "image",
|
| 660 |
+
"bbox": [
|
| 661 |
+
0.513,
|
| 662 |
+
0.086,
|
| 663 |
+
0.868,
|
| 664 |
+
0.253
|
| 665 |
+
],
|
| 666 |
+
"angle": 0,
|
| 667 |
+
"content": null
|
| 668 |
+
},
|
| 669 |
+
{
|
| 670 |
+
"type": "image_caption",
|
| 671 |
+
"bbox": [
|
| 672 |
+
0.497,
|
| 673 |
+
0.272,
|
| 674 |
+
0.888,
|
| 675 |
+
0.328
|
| 676 |
+
],
|
| 677 |
+
"angle": 0,
|
| 678 |
+
"content": "Figure 2. Distribution of average attention scores between two tokens within different distances in CodeGPT (Lu et al., 2021). The attention score is an average of 100 Python code examples across all Transformer layers."
|
| 679 |
+
},
|
| 680 |
+
{
|
| 681 |
+
"type": "text",
|
| 682 |
+
"bbox": [
|
| 683 |
+
0.497,
|
| 684 |
+
0.352,
|
| 685 |
+
0.888,
|
| 686 |
+
0.381
|
| 687 |
+
],
|
| 688 |
+
"angle": 0,
|
| 689 |
+
"content": "Formally, given the linear projections \\( Q \\), \\( K \\), \\( V \\), the self-attention scores in Transformer are calculated as follows:"
|
| 690 |
+
},
|
| 691 |
+
{
|
| 692 |
+
"type": "equation",
|
| 693 |
+
"bbox": [
|
| 694 |
+
0.521,
|
| 695 |
+
0.389,
|
| 696 |
+
0.887,
|
| 697 |
+
0.423
|
| 698 |
+
],
|
| 699 |
+
"angle": 0,
|
| 700 |
+
"content": "\\[\n\\operatorname {A t t e n t i o n} (Q, K, V) = \\operatorname {s o f t m a x} \\left(\\frac {Q K ^ {T}}{\\sqrt {d _ {k}}} + M\\right) V \\tag {1}\n\\]"
|
| 701 |
+
},
|
| 702 |
+
{
|
| 703 |
+
"type": "text",
|
| 704 |
+
"bbox": [
|
| 705 |
+
0.497,
|
| 706 |
+
0.432,
|
| 707 |
+
0.888,
|
| 708 |
+
0.493
|
| 709 |
+
],
|
| 710 |
+
"angle": 0,
|
| 711 |
+
"content": "where \\( M \\) is a mask matrix (to be completed in Equation 5) to control the context a token can attend to when computing its contextual representation. If the \\( i \\)-th token is allowed to attend to the \\( j \\)-th token, then \\( M_{ij} \\) is set to 0, otherwise \\( -\\infty \\)."
|
| 712 |
+
},
|
| 713 |
+
{
|
| 714 |
+
"type": "text",
|
| 715 |
+
"bbox": [
|
| 716 |
+
0.497,
|
| 717 |
+
0.499,
|
| 718 |
+
0.886,
|
| 719 |
+
0.528
|
| 720 |
+
],
|
| 721 |
+
"angle": 0,
|
| 722 |
+
"content": "For window attention, the mask attention matrix \\( M^{window} \\) is calculated as follows:"
|
| 723 |
+
},
|
| 724 |
+
{
|
| 725 |
+
"type": "equation",
|
| 726 |
+
"bbox": [
|
| 727 |
+
0.576,
|
| 728 |
+
0.537,
|
| 729 |
+
0.887,
|
| 730 |
+
0.579
|
| 731 |
+
],
|
| 732 |
+
"angle": 0,
|
| 733 |
+
"content": "\\[\nM _ {i j} ^ {\\text {w i n d o w}} = \\left\\{ \\begin{array}{l l} 0 & \\text {i f} i - j \\leq w \\\\ - \\infty & \\text {o t h e r w i s e} \\end{array} \\right. \\tag {2}\n\\]"
|
| 734 |
+
},
|
| 735 |
+
{
|
| 736 |
+
"type": "text",
|
| 737 |
+
"bbox": [
|
| 738 |
+
0.496,
|
| 739 |
+
0.594,
|
| 740 |
+
0.887,
|
| 741 |
+
0.746
|
| 742 |
+
],
|
| 743 |
+
"angle": 0,
|
| 744 |
+
"content": "where \\( w \\) is the window size. This window attention pattern reduces the complexity of the self-attention mechanism by limiting the receptive field size of each token to a small window of size \\( w \\) at each layer. The computation complexity of this pattern is \\( O(n \\times w) \\), which scales linearly with input sequence length \\( n \\). After applying \\( N \\) transformer layers of such sliding window attention, the receptive field size increases to \\( N \\times w \\) at the top layer. Since each token only attends to \\( w \\) tokens to its left rather than the entire preceding sequence, the model can achieve faster inference speed."
|
| 745 |
+
},
|
| 746 |
+
{
|
| 747 |
+
"type": "title",
|
| 748 |
+
"bbox": [
|
| 749 |
+
0.497,
|
| 750 |
+
0.762,
|
| 751 |
+
0.65,
|
| 752 |
+
0.777
|
| 753 |
+
],
|
| 754 |
+
"angle": 0,
|
| 755 |
+
"content": "4.2. Bridge Attention"
|
| 756 |
+
},
|
| 757 |
+
{
|
| 758 |
+
"type": "text",
|
| 759 |
+
"bbox": [
|
| 760 |
+
0.496,
|
| 761 |
+
0.785,
|
| 762 |
+
0.888,
|
| 763 |
+
0.907
|
| 764 |
+
],
|
| 765 |
+
"angle": 0,
|
| 766 |
+
"content": "Window attention is good at handling local dependencies and it also has a wide receptive field as discussed above. However, if a token needs to access tokens from a distance of \\( L \\) tokens away, it would require \\( \\lceil \\frac{L}{w} \\rceil \\) hops through window attention. This makes it challenging to access information from distant context as the attention score between them will be greatly reduced due to accumulation through multiplication. Thus, we introduce a new type of special"
|
| 767 |
+
},
|
| 768 |
+
{
|
| 769 |
+
"type": "page_number",
|
| 770 |
+
"bbox": [
|
| 771 |
+
0.481,
|
| 772 |
+
0.924,
|
| 773 |
+
0.492,
|
| 774 |
+
0.935
|
| 775 |
+
],
|
| 776 |
+
"angle": 0,
|
| 777 |
+
"content": "4"
|
| 778 |
+
}
|
| 779 |
+
],
|
| 780 |
+
[
|
| 781 |
+
{
|
| 782 |
+
"type": "header",
|
| 783 |
+
"bbox": [
|
| 784 |
+
0.237,
|
| 785 |
+
0.057,
|
| 786 |
+
0.737,
|
| 787 |
+
0.073
|
| 788 |
+
],
|
| 789 |
+
"angle": 0,
|
| 790 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 791 |
+
},
|
| 792 |
+
{
|
| 793 |
+
"type": "image",
|
| 794 |
+
"bbox": [
|
| 795 |
+
0.12,
|
| 796 |
+
0.086,
|
| 797 |
+
0.442,
|
| 798 |
+
0.259
|
| 799 |
+
],
|
| 800 |
+
"angle": 0,
|
| 801 |
+
"content": null
|
| 802 |
+
},
|
| 803 |
+
{
|
| 804 |
+
"type": "image_caption",
|
| 805 |
+
"bbox": [
|
| 806 |
+
0.085,
|
| 807 |
+
0.276,
|
| 808 |
+
0.479,
|
| 809 |
+
0.32
|
| 810 |
+
],
|
| 811 |
+
"angle": 0,
|
| 812 |
+
"content": "Figure 3. Visualization of the attention matrix (partially shown for clarity) in CodeGPT (Lu et al., 2021). The attention matrix is averaged across all Transformer layers."
|
| 813 |
+
},
|
| 814 |
+
{
|
| 815 |
+
"type": "text",
|
| 816 |
+
"bbox": [
|
| 817 |
+
0.085,
|
| 818 |
+
0.343,
|
| 819 |
+
0.475,
|
| 820 |
+
0.435
|
| 821 |
+
],
|
| 822 |
+
"angle": 0,
|
| 823 |
+
"content": "token, namely bridge tokens, to aggregate local information for global access. Bridge tokens can attend to a fixed length of tokens and be attended from all subsequent tokens. From the perspective of representation learning, a bridge token can be seen as a learned representation for the corresponding slice of code."
|
| 824 |
+
},
|
| 825 |
+
{
|
| 826 |
+
"type": "text",
|
| 827 |
+
"bbox": [
|
| 828 |
+
0.085,
|
| 829 |
+
0.44,
|
| 830 |
+
0.476,
|
| 831 |
+
0.562
|
| 832 |
+
],
|
| 833 |
+
"angle": 0,
|
| 834 |
+
"content": "Specifically, we insert \\( m \\) bridge tokens \\( S_{b} \\) every \\( \\left\\lceil \\frac{n}{m} \\right\\rceil \\) tokens and use a separate set of projections, \\( Q_{b}, K_{b}, V_{b} \\) to compute attention scores for the bridge attention. The bridge tokens do not involve next token prediction but they are used to aggregate information from the preceding \\( \\left\\lceil \\frac{n}{m} \\right\\rceil \\) tokens. The use of additional projections allows for the ability to model different types of attention. Finally, the mask matrix for bridge attention is calculated as follows:"
|
| 835 |
+
},
|
| 836 |
+
{
|
| 837 |
+
"type": "equation",
|
| 838 |
+
"bbox": [
|
| 839 |
+
0.122,
|
| 840 |
+
0.573,
|
| 841 |
+
0.476,
|
| 842 |
+
0.629
|
| 843 |
+
],
|
| 844 |
+
"angle": 0,
|
| 845 |
+
"content": "\\[\nM _ {i j} ^ {\\text {b r i d g e}} = \\left\\{\\begin{array}{l l}0&\\text {i f} j \\in S _ {b} \\text {a n d} i \\geq j\\\\0&\\text {i f} i \\in S _ {b} \\text {a n d} i - j \\leq \\left\\lceil \\frac {n}{m} \\right\\rceil\\\\- \\infty&\\text {o t h e r w i s e}\\end{array}\\right. \\tag {3}\n\\]"
|
| 846 |
+
},
|
| 847 |
+
{
|
| 848 |
+
"type": "text",
|
| 849 |
+
"bbox": [
|
| 850 |
+
0.085,
|
| 851 |
+
0.639,
|
| 852 |
+
0.476,
|
| 853 |
+
0.716
|
| 854 |
+
],
|
| 855 |
+
"angle": 0,
|
| 856 |
+
"content": "The complexity of bridge attention is \\( O(m \\times n) \\approx O(n) \\) where \\( m \\ll n \\). Compared to stacked window attention, bridge attention allows each token to attend to any preceding token with at most 2 hops, which enables the model to effectively access long-range context."
|
| 857 |
+
},
|
| 858 |
+
{
|
| 859 |
+
"type": "title",
|
| 860 |
+
"bbox": [
|
| 861 |
+
0.086,
|
| 862 |
+
0.732,
|
| 863 |
+
0.238,
|
| 864 |
+
0.746
|
| 865 |
+
],
|
| 866 |
+
"angle": 0,
|
| 867 |
+
"content": "4.3. Global Attention"
|
| 868 |
+
},
|
| 869 |
+
{
|
| 870 |
+
"type": "text",
|
| 871 |
+
"bbox": [
|
| 872 |
+
0.085,
|
| 873 |
+
0.755,
|
| 874 |
+
0.479,
|
| 875 |
+
0.906
|
| 876 |
+
],
|
| 877 |
+
"angle": 0,
|
| 878 |
+
"content": "Identifiers with the global scope, for example, package imports, global functions, classes and their member functions (i.e., methods), can be called from any location within a file. For long code, a local sliding window cannot capture such information that should be globally accessible. This is especially outstanding for package imports, which are usually located at the beginning of a file. For example, in Figure 1, without knowing the user has imported torch.nn.Functional as a new identifier F, the model cannot be sure whether to use F or the full"
|
| 879 |
+
},
|
| 880 |
+
{
|
| 881 |
+
"type": "text",
|
| 882 |
+
"bbox": [
|
| 883 |
+
0.497,
|
| 884 |
+
0.085,
|
| 885 |
+
0.888,
|
| 886 |
+
0.238
|
| 887 |
+
],
|
| 888 |
+
"angle": 0,
|
| 889 |
+
"content": "package name.\\(^4\\) Also, to call the forward function of conv_block1 and conv_block2, the model needs access to the original definition of the class ConvBlock, which also falls outside the current sliding window. Directly accessing these tokens is similar to how human programmers quickly refer to definitions in the code. This global effect can also be observed in the visualization of the attention matrix in CodeGPT (Lu et al., 2021). As shown in Figure 3, some tokens seem to have a global impact while others only matter locally."
|
| 890 |
+
},
|
| 891 |
+
{
|
| 892 |
+
"type": "text",
|
| 893 |
+
"bbox": [
|
| 894 |
+
0.497,
|
| 895 |
+
0.244,
|
| 896 |
+
0.889,
|
| 897 |
+
0.41
|
| 898 |
+
],
|
| 899 |
+
"angle": 0,
|
| 900 |
+
"content": "Therefore, in addition to bridge tokens, where the model automatically learns to aggregate globally useful information, we add another type of global token, namely memory tokens, to inject code heuristics to the attention. Specifically, we leverage the structure of code with tree-sitter to parse the code into an abstract syntax tree (AST). Then, we find all statements that include a package import, class or function definition and grant the line feeds (LF, \\(\\backslash \\mathfrak{n}\\)) of those statements global access. We denote the set of positions of these line feeds as \\(G\\), where \\(k = |G|\\). The mask matrix \\(M^{global}\\) of global attention is calculated as follows:"
|
| 901 |
+
},
|
| 902 |
+
{
|
| 903 |
+
"type": "equation",
|
| 904 |
+
"bbox": [
|
| 905 |
+
0.559,
|
| 906 |
+
0.42,
|
| 907 |
+
0.887,
|
| 908 |
+
0.462
|
| 909 |
+
],
|
| 910 |
+
"angle": 0,
|
| 911 |
+
"content": "\\[\nM _ {i j} ^ {\\text {g l o b a l}} = \\left\\{ \\begin{array}{l l} 0 & \\text {i f} j \\in G \\text {a n d} i \\geq j \\\\ - \\infty & \\text {o t h e r w i s e} \\end{array} \\right. \\tag {4}\n\\]"
|
| 912 |
+
},
|
| 913 |
+
{
|
| 914 |
+
"type": "text",
|
| 915 |
+
"bbox": [
|
| 916 |
+
0.497,
|
| 917 |
+
0.472,
|
| 918 |
+
0.888,
|
| 919 |
+
0.503
|
| 920 |
+
],
|
| 921 |
+
"angle": 0,
|
| 922 |
+
"content": "The complexity of the global attention is \\( O(kn) \\approx O(n) \\), as we have \\( k \\ll n \\), where \\( n \\) is the length of the sequence."
|
| 923 |
+
},
|
| 924 |
+
{
|
| 925 |
+
"type": "text",
|
| 926 |
+
"bbox": [
|
| 927 |
+
0.497,
|
| 928 |
+
0.51,
|
| 929 |
+
0.888,
|
| 930 |
+
0.571
|
| 931 |
+
],
|
| 932 |
+
"angle": 0,
|
| 933 |
+
"content": "Unlike previous work (Clement et al., 2021) which extracts the most significant statements and encode them in a fixed-length context window, our global attention requires less memory and can reuse previously encoded hidden states."
|
| 934 |
+
},
|
| 935 |
+
{
|
| 936 |
+
"type": "text",
|
| 937 |
+
"bbox": [
|
| 938 |
+
0.497,
|
| 939 |
+
0.577,
|
| 940 |
+
0.887,
|
| 941 |
+
0.608
|
| 942 |
+
],
|
| 943 |
+
"angle": 0,
|
| 944 |
+
"content": "Finally, considering all three types of attention together, \\(M\\) in Equation 1 becomes:"
|
| 945 |
+
},
|
| 946 |
+
{
|
| 947 |
+
"type": "equation",
|
| 948 |
+
"bbox": [
|
| 949 |
+
0.566,
|
| 950 |
+
0.618,
|
| 951 |
+
0.887,
|
| 952 |
+
0.637
|
| 953 |
+
],
|
| 954 |
+
"angle": 0,
|
| 955 |
+
"content": "\\[\nM = \\max \\left(M ^ {\\text {w i n d o w}}, M ^ {\\text {b r i d g e}}, M ^ {\\text {g l o b a l}}\\right) \\tag {5}\n\\]"
|
| 956 |
+
},
|
| 957 |
+
{
|
| 958 |
+
"type": "text",
|
| 959 |
+
"bbox": [
|
| 960 |
+
0.497,
|
| 961 |
+
0.648,
|
| 962 |
+
0.84,
|
| 963 |
+
0.662
|
| 964 |
+
],
|
| 965 |
+
"angle": 0,
|
| 966 |
+
"content": "where max is the element-wise maximum function."
|
| 967 |
+
},
|
| 968 |
+
{
|
| 969 |
+
"type": "title",
|
| 970 |
+
"bbox": [
|
| 971 |
+
0.497,
|
| 972 |
+
0.682,
|
| 973 |
+
0.631,
|
| 974 |
+
0.699
|
| 975 |
+
],
|
| 976 |
+
"angle": 0,
|
| 977 |
+
"content": "5. Experiments"
|
| 978 |
+
},
|
| 979 |
+
{
|
| 980 |
+
"type": "title",
|
| 981 |
+
"bbox": [
|
| 982 |
+
0.497,
|
| 983 |
+
0.708,
|
| 984 |
+
0.688,
|
| 985 |
+
0.723
|
| 986 |
+
],
|
| 987 |
+
"angle": 0,
|
| 988 |
+
"content": "5.1. Experimental Settings"
|
| 989 |
+
},
|
| 990 |
+
{
|
| 991 |
+
"type": "text",
|
| 992 |
+
"bbox": [
|
| 993 |
+
0.496,
|
| 994 |
+
0.731,
|
| 995 |
+
0.888,
|
| 996 |
+
0.883
|
| 997 |
+
],
|
| 998 |
+
"angle": 0,
|
| 999 |
+
"content": "Baselines We evaluate LongCoder against several publicly available pre-trained code generation models, including GPT-2 (Radford et al., 2019), CodeGPT (Lu et al., 2021), and UniXcoder (Guo et al., 2022). GPT-2 is pre-trained on a text corpus and CodeGPT is pre-trained on the CodeSearchNet dataset (Husain et al., 2019) using next token prediction as the objective. UniXcoder based on UniLM (Dong et al., 2019) is pre-trained on a cross-modal dataset that includes code, text, and abstract syntax trees. Additionally, we also compare LongCoder with sparse Transformer models, such"
|
| 1000 |
+
},
|
| 1001 |
+
{
|
| 1002 |
+
"type": "page_footnote",
|
| 1003 |
+
"bbox": [
|
| 1004 |
+
0.518,
|
| 1005 |
+
0.891,
|
| 1006 |
+
0.776,
|
| 1007 |
+
0.906
|
| 1008 |
+
],
|
| 1009 |
+
"angle": 0,
|
| 1010 |
+
"content": "Both are common code styles in PyTorch."
|
| 1011 |
+
},
|
| 1012 |
+
{
|
| 1013 |
+
"type": "page_number",
|
| 1014 |
+
"bbox": [
|
| 1015 |
+
0.482,
|
| 1016 |
+
0.924,
|
| 1017 |
+
0.492,
|
| 1018 |
+
0.935
|
| 1019 |
+
],
|
| 1020 |
+
"angle": 0,
|
| 1021 |
+
"content": "5"
|
| 1022 |
+
}
|
| 1023 |
+
],
|
| 1024 |
+
[
|
| 1025 |
+
{
|
| 1026 |
+
"type": "header",
|
| 1027 |
+
"bbox": [
|
| 1028 |
+
0.238,
|
| 1029 |
+
0.057,
|
| 1030 |
+
0.737,
|
| 1031 |
+
0.072
|
| 1032 |
+
],
|
| 1033 |
+
"angle": 0,
|
| 1034 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 1035 |
+
},
|
| 1036 |
+
{
|
| 1037 |
+
"type": "table_caption",
|
| 1038 |
+
"bbox": [
|
| 1039 |
+
0.262,
|
| 1040 |
+
0.094,
|
| 1041 |
+
0.711,
|
| 1042 |
+
0.108
|
| 1043 |
+
],
|
| 1044 |
+
"angle": 0,
|
| 1045 |
+
"content": "Table 2. Experimental results on the Long Code Completion (LCC) dataset."
|
| 1046 |
+
},
|
| 1047 |
+
{
|
| 1048 |
+
"type": "table",
|
| 1049 |
+
"bbox": [
|
| 1050 |
+
0.113,
|
| 1051 |
+
0.108,
|
| 1052 |
+
0.862,
|
| 1053 |
+
0.314
|
| 1054 |
+
],
|
| 1055 |
+
"angle": 0,
|
| 1056 |
+
"content": "<table><tr><td rowspan=\"2\">Model</td><td rowspan=\"2\">#Param.</td><td rowspan=\"2\">Memory</td><td rowspan=\"2\">Runtime</td><td colspan=\"2\">Python</td><td colspan=\"2\">Java</td><td colspan=\"2\">C#</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>OpenAI Codex</td><td>12B</td><td>-</td><td>-</td><td>39.65</td><td>68.97</td><td>43.15</td><td>72.05</td><td>53.89</td><td>77.93</td></tr><tr><td>Transformer</td><td>124M</td><td>191M</td><td>750ms</td><td>10.64</td><td>43.64</td><td>15.32</td><td>47.52</td><td>19.16</td><td>48.87</td></tr><tr><td>GPT-2</td><td>124M</td><td>191M</td><td>750ms</td><td>11.20</td><td>42.62</td><td>17.09</td><td>47.18</td><td>20.27</td><td>48.27</td></tr><tr><td>CodeGPT</td><td>124M</td><td>191M</td><td>750ms</td><td>12.24</td><td>43.81</td><td>19.20</td><td>49.50</td><td>22.58</td><td>51.03</td></tr><tr><td>UniXcoder</td><td>126M</td><td>191M</td><td>750ms</td><td>16.55</td><td>50.22</td><td>23.93</td><td>55.38</td><td>27.97</td><td>57.29</td></tr><tr><td>LongFormer</td><td>150M</td><td>381M</td><td>781ms</td><td>16.79</td><td>51.07</td><td>24.80</td><td>56.03</td><td>29.75</td><td>58.23</td></tr><tr><td>BigBird</td><td>128M</td><td>205M</td><td>804ms</td><td>17.03</td><td>51.14</td><td>25.19</td><td>56.91</td><td>30.27</td><td>58.66</td></tr><tr><td>LongCoder</td><td>150M</td><td>211M</td><td>812ms</td><td>17.88</td><td>55.07</td><td>26.42</td><td>61.21</td><td>31.34</td><td>64.37</td></tr><tr><td>- w/o pretrain</td><td>150M</td><td>211M</td><td>812ms</td><td>17.61</td><td>54.82</td><td>25.96</td><td>60.81</td><td>31.22</td><td>64.18</td></tr></table>"
|
| 1057 |
+
},
|
| 1058 |
+
{
|
| 1059 |
+
"type": "table_caption",
|
| 1060 |
+
"bbox": [
|
| 1061 |
+
0.085,
|
| 1062 |
+
0.354,
|
| 1063 |
+
0.477,
|
| 1064 |
+
0.383
|
| 1065 |
+
],
|
| 1066 |
+
"angle": 0,
|
| 1067 |
+
"content": "Table 3. Data statistics about the context length of CodeXGLUE test dataset. \\(25\\% /50\\% /75\\%\\) refer to the first/second/third quartile."
|
| 1068 |
+
},
|
| 1069 |
+
{
|
| 1070 |
+
"type": "table",
|
| 1071 |
+
"bbox": [
|
| 1072 |
+
0.126,
|
| 1073 |
+
0.387,
|
| 1074 |
+
0.436,
|
| 1075 |
+
0.45
|
| 1076 |
+
],
|
| 1077 |
+
"angle": 0,
|
| 1078 |
+
"content": "<table><tr><td>Language</td><td>Average</td><td>25%</td><td>50%</td><td>75%</td></tr><tr><td>Python</td><td>477.8</td><td>83</td><td>197</td><td>502</td></tr><tr><td>Java</td><td>365.0</td><td>74</td><td>171</td><td>397</td></tr></table>"
|
| 1079 |
+
},
|
| 1080 |
+
{
|
| 1081 |
+
"type": "text",
|
| 1082 |
+
"bbox": [
|
| 1083 |
+
0.085,
|
| 1084 |
+
0.485,
|
| 1085 |
+
0.477,
|
| 1086 |
+
0.622
|
| 1087 |
+
],
|
| 1088 |
+
"angle": 0,
|
| 1089 |
+
"content": "as LongFormer (Beltagy et al., 2020) and BigBird (Zaheer et al., 2020). LongFormer uses a dilated sliding window to model long sequences in the generation task, while BigBird has an attention pattern that includes random, window, and global attention. In addition to these comparable baselines, we also report the performance of OpenAI Codex on LCC for reference. Note that Codex is \\(100 \\times\\) larger than other models and is likely to have seen the test set of LCC in its pretraining thus is not directly comparable."
|
| 1090 |
+
},
|
| 1091 |
+
{
|
| 1092 |
+
"type": "text",
|
| 1093 |
+
"bbox": [
|
| 1094 |
+
0.085,
|
| 1095 |
+
0.642,
|
| 1096 |
+
0.475,
|
| 1097 |
+
0.853
|
| 1098 |
+
],
|
| 1099 |
+
"angle": 0,
|
| 1100 |
+
"content": "**Benchmarks** We evaluate the performance of LongCoder and the baselines on two benchmarks: LCC (introduced in Section 3), and the code completion task benchmark in CodeXGLUE (Lu et al., 2021). CodeXGLUE provides PY150 (Raychev et al., 2016) and JavaCorpus (Allamanis & Sutton, 2013) datasets in Python and Java for line-level code completion. The statistics for the context length of the CodeXGLUE test datasets are listed in Table 3. We can see that the context length of the input sequence is 5 times shorter than LCC, and only a small portion of the samples require modeling for long code sequences. The objective of evaluating the performance of sparse models on the CodeXGLUE dataset is to examine their effectiveness in scenarios where the code context is relatively short."
|
| 1101 |
+
},
|
| 1102 |
+
{
|
| 1103 |
+
"type": "text",
|
| 1104 |
+
"bbox": [
|
| 1105 |
+
0.085,
|
| 1106 |
+
0.861,
|
| 1107 |
+
0.476,
|
| 1108 |
+
0.906
|
| 1109 |
+
],
|
| 1110 |
+
"angle": 0,
|
| 1111 |
+
"content": "Moreover, longer context can benefit applications including cross-file code completion (Liu et al., 2023). We test the performance of LongCoder on the cross-file-random (XF-"
|
| 1112 |
+
},
|
| 1113 |
+
{
|
| 1114 |
+
"type": "table_caption",
|
| 1115 |
+
"bbox": [
|
| 1116 |
+
0.498,
|
| 1117 |
+
0.355,
|
| 1118 |
+
0.871,
|
| 1119 |
+
0.369
|
| 1120 |
+
],
|
| 1121 |
+
"angle": 0,
|
| 1122 |
+
"content": "Table 4. Results on CodeXGLUE code completion benchmark."
|
| 1123 |
+
},
|
| 1124 |
+
{
|
| 1125 |
+
"type": "table",
|
| 1126 |
+
"bbox": [
|
| 1127 |
+
0.521,
|
| 1128 |
+
0.373,
|
| 1129 |
+
0.865,
|
| 1130 |
+
0.491
|
| 1131 |
+
],
|
| 1132 |
+
"angle": 0,
|
| 1133 |
+
"content": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"2\">PY150</td><td colspan=\"2\">JavaCorpus</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>Transformer</td><td>38.51</td><td>69.01</td><td>17.00</td><td>50.23</td></tr><tr><td>GPT-2</td><td>41.73</td><td>70.60</td><td>27.50</td><td>60.36</td></tr><tr><td>CodeGPT</td><td>42.37</td><td>71.59</td><td>30.60</td><td>63.45</td></tr><tr><td>UniXcoder</td><td>43.12</td><td>72.00</td><td>32.90</td><td>65.78</td></tr><tr><td>LongCoder</td><td>43.77</td><td>73.37</td><td>33.13</td><td>67.32</td></tr></table>"
|
| 1134 |
+
},
|
| 1135 |
+
{
|
| 1136 |
+
"type": "table_caption",
|
| 1137 |
+
"bbox": [
|
| 1138 |
+
0.498,
|
| 1139 |
+
0.523,
|
| 1140 |
+
0.889,
|
| 1141 |
+
0.551
|
| 1142 |
+
],
|
| 1143 |
+
"angle": 0,
|
| 1144 |
+
"content": "Table 5. Cross-file code completion results on RepoBench XF-R (Liu et al., 2023)."
|
| 1145 |
+
},
|
| 1146 |
+
{
|
| 1147 |
+
"type": "table",
|
| 1148 |
+
"bbox": [
|
| 1149 |
+
0.527,
|
| 1150 |
+
0.555,
|
| 1151 |
+
0.858,
|
| 1152 |
+
0.673
|
| 1153 |
+
],
|
| 1154 |
+
"angle": 0,
|
| 1155 |
+
"content": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"2\">Python</td><td colspan=\"2\">Java</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>Transformer</td><td>7.0</td><td>38.3</td><td>5.8</td><td>34.4</td></tr><tr><td>GPT-2</td><td>15.5</td><td>48.2</td><td>11.6</td><td>41.4</td></tr><tr><td>CodeGPT</td><td>16.6</td><td>49.1</td><td>13.3</td><td>44.2</td></tr><tr><td>UniXcoder</td><td>18.0</td><td>53.4</td><td>16.5</td><td>50.0</td></tr><tr><td>LongCoder</td><td>21.4</td><td>59.7</td><td>19.7</td><td>60.1</td></tr></table>"
|
| 1156 |
+
},
|
| 1157 |
+
{
|
| 1158 |
+
"type": "text",
|
| 1159 |
+
"bbox": [
|
| 1160 |
+
0.496,
|
| 1161 |
+
0.706,
|
| 1162 |
+
0.887,
|
| 1163 |
+
0.797
|
| 1164 |
+
],
|
| 1165 |
+
"angle": 0,
|
| 1166 |
+
"content": "R) setting of RepoBench (Liu et al., 2023). The task is to predict the next line of code based on a given in-file context, consisting of import statements and preceding lines before the target line, as well as a cross-file context, comprising snippets from other files in the code repository, parsed by import statements."
|
| 1167 |
+
},
|
| 1168 |
+
{
|
| 1169 |
+
"type": "text",
|
| 1170 |
+
"bbox": [
|
| 1171 |
+
0.496,
|
| 1172 |
+
0.815,
|
| 1173 |
+
0.887,
|
| 1174 |
+
0.906
|
| 1175 |
+
],
|
| 1176 |
+
"angle": 0,
|
| 1177 |
+
"content": "Evaluation Metrics We report the number of parameters, inference memory consumption, runtime, Exact Match (EM) and Edit Similarity (Edit Sim) of the baselines. The inference memory consumption and runtime per example are calculated using a beam search with beam size of 5 and maximum generation length of 64 on a single V100 GPU."
|
| 1178 |
+
},
|
| 1179 |
+
{
|
| 1180 |
+
"type": "page_number",
|
| 1181 |
+
"bbox": [
|
| 1182 |
+
0.481,
|
| 1183 |
+
0.924,
|
| 1184 |
+
0.493,
|
| 1185 |
+
0.935
|
| 1186 |
+
],
|
| 1187 |
+
"angle": 0,
|
| 1188 |
+
"content": "6"
|
| 1189 |
+
}
|
| 1190 |
+
],
|
| 1191 |
+
[
|
| 1192 |
+
{
|
| 1193 |
+
"type": "header",
|
| 1194 |
+
"bbox": [
|
| 1195 |
+
0.238,
|
| 1196 |
+
0.058,
|
| 1197 |
+
0.735,
|
| 1198 |
+
0.071
|
| 1199 |
+
],
|
| 1200 |
+
"angle": 0,
|
| 1201 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 1202 |
+
},
|
| 1203 |
+
{
|
| 1204 |
+
"type": "table_caption",
|
| 1205 |
+
"bbox": [
|
| 1206 |
+
0.307,
|
| 1207 |
+
0.094,
|
| 1208 |
+
0.662,
|
| 1209 |
+
0.108
|
| 1210 |
+
],
|
| 1211 |
+
"angle": 0,
|
| 1212 |
+
"content": "Table 6. Ablation study on LongCoder without pre-training."
|
| 1213 |
+
},
|
| 1214 |
+
{
|
| 1215 |
+
"type": "table",
|
| 1216 |
+
"bbox": [
|
| 1217 |
+
0.175,
|
| 1218 |
+
0.108,
|
| 1219 |
+
0.8,
|
| 1220 |
+
0.235
|
| 1221 |
+
],
|
| 1222 |
+
"angle": 0,
|
| 1223 |
+
"content": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"2\">Python</td><td colspan=\"2\">Java</td><td colspan=\"2\">C#</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>LongCoder</td><td>17.61</td><td>54.82</td><td>25.96</td><td>60.81</td><td>31.22</td><td>64.18</td></tr><tr><td>w/o memory tokens</td><td>16.80</td><td>53.90</td><td>24.87</td><td>60.35</td><td>30.16</td><td>63.61</td></tr><tr><td>w/o bridge tokens</td><td>17.54</td><td>51.92</td><td>25.88</td><td>57.48</td><td>30.80</td><td>59.09</td></tr><tr><td>w/o out-of-window context</td><td>16.66</td><td>50.63</td><td>24.17</td><td>55.97</td><td>28.81</td><td>57.79</td></tr><tr><td>w/ equidistant memory tokens</td><td>17.16</td><td>54.25</td><td>24.96</td><td>60.42</td><td>30.31</td><td>63.65</td></tr></table>"
|
| 1224 |
+
},
|
| 1225 |
+
{
|
| 1226 |
+
"type": "title",
|
| 1227 |
+
"bbox": [
|
| 1228 |
+
0.089,
|
| 1229 |
+
0.267,
|
| 1230 |
+
0.231,
|
| 1231 |
+
0.282
|
| 1232 |
+
],
|
| 1233 |
+
"angle": 0,
|
| 1234 |
+
"content": "5.2. Training Details"
|
| 1235 |
+
},
|
| 1236 |
+
{
|
| 1237 |
+
"type": "text",
|
| 1238 |
+
"bbox": [
|
| 1239 |
+
0.089,
|
| 1240 |
+
0.29,
|
| 1241 |
+
0.474,
|
| 1242 |
+
0.636
|
| 1243 |
+
],
|
| 1244 |
+
"angle": 0,
|
| 1245 |
+
"content": "We set the maximum length of code context to 512 and 4096 for non-sparse and sparse models, respectively. In order to make a fair comparison between sparse models and non-sparse models, we set the window size \\( w \\) to 512 so that both types of models maintain the same local context length during inference. Note that this setting is different from the original setting of RepoBench (Liu et al., 2023), thus the results are not directly comparable to those reported in Liu et al. (2023). For sparse models, we use the parameters of UniXcoder released by Guo et al. (2022) to initialize the models. For LongCoder, we set the maximum size of bridge tokens \\( n \\) and global tokens \\( k \\) as 16 and 64, respectively. To ensure fair comparison with other models, we pre-train LongCoder on the CodeSearchNet dataset using the same next token prediction objective and pre-training setting as baselines (Lu et al., 2021; Guo et al., 2022). During finetuning, we use the Adam optimizer with a batch size of 16 and a learning rate of 2e-4. We fine-tune the model for 10 epochs and perform early stopping on the development set. Note that although the maximum context sequence length is 4096, during inference, we only retain a cache of at most 592 tokens for past key and value hidden states to maintain efficiency in terms of computational resources."
|
| 1246 |
+
},
|
| 1247 |
+
{
|
| 1248 |
+
"type": "title",
|
| 1249 |
+
"bbox": [
|
| 1250 |
+
0.089,
|
| 1251 |
+
0.655,
|
| 1252 |
+
0.268,
|
| 1253 |
+
0.669
|
| 1254 |
+
],
|
| 1255 |
+
"angle": 0,
|
| 1256 |
+
"content": "5.3. Experimental Results"
|
| 1257 |
+
},
|
| 1258 |
+
{
|
| 1259 |
+
"type": "text",
|
| 1260 |
+
"bbox": [
|
| 1261 |
+
0.089,
|
| 1262 |
+
0.678,
|
| 1263 |
+
0.474,
|
| 1264 |
+
0.904
|
| 1265 |
+
],
|
| 1266 |
+
"angle": 0,
|
| 1267 |
+
"content": "Table 2 illustrates the comparison results of LongCoder with other models on the LCC dataset. The results reveal that the sparse models (i.e., the last two groups) have superior performance compared to the non-sparse models (i.e., the second group) on both EM and Edit Sim metrics, and they also maintain a similar inference speed. LongFormer is initialized using the parameters of UniXcoder, with the sole difference being the use of a sliding window attention mechanism. This mechanism allows the model to maintain a consistent inference speed while having a larger receptive field, resulting in improved performance. This demonstrates the effectiveness of the sliding window attention mechanism in code completion tasks. Compared to other sparse models, LongCoder achieves an improvement of \\(0.8\\% -1.3\\%\\) in Exact Match score and \\(4.0\\% -6.0\\%\\) in Edit Similarity,"
|
| 1268 |
+
},
|
| 1269 |
+
{
|
| 1270 |
+
"type": "text",
|
| 1271 |
+
"bbox": [
|
| 1272 |
+
0.5,
|
| 1273 |
+
0.267,
|
| 1274 |
+
0.886,
|
| 1275 |
+
0.387
|
| 1276 |
+
],
|
| 1277 |
+
"angle": 0,
|
| 1278 |
+
"content": "which reveal the effectiveness of our proposed bridge and global attention mechanisms. Table 4 shows the result of LongCoder on CodeXGLUE code completion benchmarks. It can be observed that LongCoder achieves state-of-the-art performance, which illustrates its effectiveness in scenarios where the code context is short. As shown in Table 5, LongCoder has an even larger advantage compared to UniXcoder, indicating its potential in more complex scenarios."
|
| 1279 |
+
},
|
| 1280 |
+
{
|
| 1281 |
+
"type": "title",
|
| 1282 |
+
"bbox": [
|
| 1283 |
+
0.5,
|
| 1284 |
+
0.405,
|
| 1285 |
+
0.636,
|
| 1286 |
+
0.419
|
| 1287 |
+
],
|
| 1288 |
+
"angle": 0,
|
| 1289 |
+
"content": "5.4. Ablation Study"
|
| 1290 |
+
},
|
| 1291 |
+
{
|
| 1292 |
+
"type": "text",
|
| 1293 |
+
"bbox": [
|
| 1294 |
+
0.5,
|
| 1295 |
+
0.428,
|
| 1296 |
+
0.886,
|
| 1297 |
+
0.819
|
| 1298 |
+
],
|
| 1299 |
+
"angle": 0,
|
| 1300 |
+
"content": "To better understand the impact of different components on overall performance, we conduct an ablation study on LongCoder, and the results are shown in Table 6. We can see that the average score of Exact Match drops by approximately \\(1\\%\\) when memory tokens are removed (w/o memory tokens), which demonstrates the importance of these tokens. On the other hand, when bridge tokens are removed (w/o bridge tokens), the average score drops by about \\(3\\%\\) in terms of Edit Similarity. This is likely because bridge tokens assist LongCoder in understanding the semantics of the code context and generating more accurate patterns, while memory tokens enable it to access concrete identifiers with global scope, thus improving accuracy on libraries, classes, and functions invoked. Additionally, we observe that selecting one as a memory token every 64 tokens (equidistant memory tokens) results in worse performance than LongCoder, indicating that the advantage of the memory tokens is not solely due to increased context length. We also evaluate the performance of LongCoder by only using code context within the window size during inference to verify if the improvement is solely attributed to the use of long code context or whether other factors such as fine-tuning settings also contribute. By only keeping the last 512 tokens as code context (w/o out-of-window context), we can see that the performance is nearly the same as UniXcoder in Table 2, which shows the importance of modeling long code context."
|
| 1301 |
+
},
|
| 1302 |
+
{
|
| 1303 |
+
"type": "title",
|
| 1304 |
+
"bbox": [
|
| 1305 |
+
0.5,
|
| 1306 |
+
0.838,
|
| 1307 |
+
0.608,
|
| 1308 |
+
0.852
|
| 1309 |
+
],
|
| 1310 |
+
"angle": 0,
|
| 1311 |
+
"content": "5.5. Case Study"
|
| 1312 |
+
},
|
| 1313 |
+
{
|
| 1314 |
+
"type": "text",
|
| 1315 |
+
"bbox": [
|
| 1316 |
+
0.5,
|
| 1317 |
+
0.861,
|
| 1318 |
+
0.885,
|
| 1319 |
+
0.905
|
| 1320 |
+
],
|
| 1321 |
+
"angle": 0,
|
| 1322 |
+
"content": "We also conduct a case study to demonstrate the effectiveness of LongCoder, as shown in Figure 4. We provide two examples in the Python and Java programming languages"
|
| 1323 |
+
},
|
| 1324 |
+
{
|
| 1325 |
+
"type": "page_number",
|
| 1326 |
+
"bbox": [
|
| 1327 |
+
0.482,
|
| 1328 |
+
0.924,
|
| 1329 |
+
0.492,
|
| 1330 |
+
0.935
|
| 1331 |
+
],
|
| 1332 |
+
"angle": 0,
|
| 1333 |
+
"content": "7"
|
| 1334 |
+
}
|
| 1335 |
+
],
|
| 1336 |
+
[
|
| 1337 |
+
{
|
| 1338 |
+
"type": "header",
|
| 1339 |
+
"bbox": [
|
| 1340 |
+
0.237,
|
| 1341 |
+
0.058,
|
| 1342 |
+
0.735,
|
| 1343 |
+
0.072
|
| 1344 |
+
],
|
| 1345 |
+
"angle": 0,
|
| 1346 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 1347 |
+
},
|
| 1348 |
+
{
|
| 1349 |
+
"type": "image",
|
| 1350 |
+
"bbox": [
|
| 1351 |
+
0.092,
|
| 1352 |
+
0.083,
|
| 1353 |
+
0.882,
|
| 1354 |
+
0.449
|
| 1355 |
+
],
|
| 1356 |
+
"angle": 0,
|
| 1357 |
+
"content": null
|
| 1358 |
+
},
|
| 1359 |
+
{
|
| 1360 |
+
"type": "image_caption",
|
| 1361 |
+
"bbox": [
|
| 1362 |
+
0.084,
|
| 1363 |
+
0.455,
|
| 1364 |
+
0.889,
|
| 1365 |
+
0.498
|
| 1366 |
+
],
|
| 1367 |
+
"angle": 0,
|
| 1368 |
+
"content": "Figure 4. Two LCC examples of Python (top) and Java (bottom) code and predictions of different models. Codex-2048 refers to the original Codex model with the maximum context length of 2,048 while Codex-512 is the same model with a maximum context length set to 512. Key information is highlighted with arrows."
|
| 1369 |
+
},
|
| 1370 |
+
{
|
| 1371 |
+
"type": "text",
|
| 1372 |
+
"bbox": [
|
| 1373 |
+
0.084,
|
| 1374 |
+
0.523,
|
| 1375 |
+
0.477,
|
| 1376 |
+
0.901
|
| 1377 |
+
],
|
| 1378 |
+
"angle": 0,
|
| 1379 |
+
"content": "and output predictions from different models. (1) From the Python example, we can see that all models infer the correct intended outcome, which is to assign the current timestamp to the timestamp variable. However, only LongCoder and Codex-2048 produce the correct result. This is primarily because these two models are able to refer to the import statement at the beginning of the file, which imports the timestamp_now function. Codex-2048 uses a long context window to cover the entire file, but this approach increases memory consumption and decreases inference speed as discussed above. Additionally, as the failure of Codex-512 shows, even a large powerful model can struggle to identify the correct function from other candidates if the required information exceeds the window size. In contrast, LongCoder utilizes a more efficient memory attention mechanism, storing information based on the scope of different statements. This method is more effective, allowing access to statements from the global scope while remaining efficient. (2) In the Java example, the function to be completed aims to convert a HashMap variable into an XML string. The function sequentially calls the getters functions of the GaitReEducation class and has already completed calling the getGaitAspect function. From the out-window context, it is clear that the next call should be made to the getDetails function. In order to correctly complete the"
|
| 1380 |
+
},
|
| 1381 |
+
{
|
| 1382 |
+
"type": "text",
|
| 1383 |
+
"bbox": [
|
| 1384 |
+
0.496,
|
| 1385 |
+
0.523,
|
| 1386 |
+
0.889,
|
| 1387 |
+
0.69
|
| 1388 |
+
],
|
| 1389 |
+
"angle": 0,
|
| 1390 |
+
"content": "function, it is essential to keep track of all function definitions. As seen in the output results, only LongCoder and Codex-2048, which both make use of long code context, can predict the correct results. Additionally, it can be observed that Codex-512, due to its limited context, can only make a guess for a member function. We can see that LongCoder leverages the structure of the code to analyze the scope of statements and stores those that have potential long-term dependencies. This not only improves performance but also achieves comparable efficiency in terms of computational resources during inference."
|
| 1391 |
+
},
|
| 1392 |
+
{
|
| 1393 |
+
"type": "title",
|
| 1394 |
+
"bbox": [
|
| 1395 |
+
0.497,
|
| 1396 |
+
0.708,
|
| 1397 |
+
0.611,
|
| 1398 |
+
0.724
|
| 1399 |
+
],
|
| 1400 |
+
"angle": 0,
|
| 1401 |
+
"content": "6. Discussion"
|
| 1402 |
+
},
|
| 1403 |
+
{
|
| 1404 |
+
"type": "text",
|
| 1405 |
+
"bbox": [
|
| 1406 |
+
0.496,
|
| 1407 |
+
0.734,
|
| 1408 |
+
0.888,
|
| 1409 |
+
0.839
|
| 1410 |
+
],
|
| 1411 |
+
"angle": 0,
|
| 1412 |
+
"content": "Limitations One limitation of LongCoder is its small size. Due to resource constraints, we are not able to train a large model that is comparable to Codex. Besides, to compare fairly with other baselines, we only pre-train LongCoder on a small-scale corpus (CodeSearchNet). It would be interesting to see how the idea of sparse attention scales with more data."
|
| 1413 |
+
},
|
| 1414 |
+
{
|
| 1415 |
+
"type": "text",
|
| 1416 |
+
"bbox": [
|
| 1417 |
+
0.496,
|
| 1418 |
+
0.848,
|
| 1419 |
+
0.888,
|
| 1420 |
+
0.893
|
| 1421 |
+
],
|
| 1422 |
+
"angle": 0,
|
| 1423 |
+
"content": "Another limitation of our work is the evaluation datasets. Many existing code datasets and LCC share the same source of data from GitHub. The same data can appear in the"
|
| 1424 |
+
},
|
| 1425 |
+
{
|
| 1426 |
+
"type": "page_number",
|
| 1427 |
+
"bbox": [
|
| 1428 |
+
0.481,
|
| 1429 |
+
0.924,
|
| 1430 |
+
0.492,
|
| 1431 |
+
0.935
|
| 1432 |
+
],
|
| 1433 |
+
"angle": 0,
|
| 1434 |
+
"content": "8"
|
| 1435 |
+
}
|
| 1436 |
+
],
|
| 1437 |
+
[
|
| 1438 |
+
{
|
| 1439 |
+
"type": "header",
|
| 1440 |
+
"bbox": [
|
| 1441 |
+
0.237,
|
| 1442 |
+
0.057,
|
| 1443 |
+
0.735,
|
| 1444 |
+
0.072
|
| 1445 |
+
],
|
| 1446 |
+
"angle": 0,
|
| 1447 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 1448 |
+
},
|
| 1449 |
+
{
|
| 1450 |
+
"type": "text",
|
| 1451 |
+
"bbox": [
|
| 1452 |
+
0.085,
|
| 1453 |
+
0.085,
|
| 1454 |
+
0.477,
|
| 1455 |
+
0.342
|
| 1456 |
+
],
|
| 1457 |
+
"angle": 0,
|
| 1458 |
+
"content": "pretraining data, making the evaluation less reliable. Additionally, models with larger-scale pretraining are even more likely to have seen the test data before. For example, OpenAI Codex is trained on all GitHub repositories, that undoubtedly, include most (if not all) test data in PY150, JavaCorpus, and LCC. As the code completion models have seen wider adoption in software development, future evaluation can be \"self-fulfilling\". For example, GitHub CoPilot<sup>5</sup> is a popular commercial code completion tool powered by OpenAI Codex. A lot of code generated by Codex may have already been submitted to GitHub. This could give widely-used models like Codex an advantage if it is evaluated on a dataset with a data source of the latest GitHub repositories, as we could be evaluating Codex on its own input. To address these problems, we need the community to contribute new, clean, and high-quality datasets with code from private projects to support future research."
|
| 1459 |
+
},
|
| 1460 |
+
{
|
| 1461 |
+
"type": "text",
|
| 1462 |
+
"bbox": [
|
| 1463 |
+
0.085,
|
| 1464 |
+
0.359,
|
| 1465 |
+
0.478,
|
| 1466 |
+
0.466
|
| 1467 |
+
],
|
| 1468 |
+
"angle": 0,
|
| 1469 |
+
"content": "Future Work LongCoder opens up new research opportunities in code generation not only within a large file, but also across multiple files. For example, we could allow the model to look at other files in the project for even more accurate code completion. It could enable new applications including automatically extracting package requirements, generating build files, refactoring the project, etc."
|
| 1470 |
+
},
|
| 1471 |
+
{
|
| 1472 |
+
"type": "title",
|
| 1473 |
+
"bbox": [
|
| 1474 |
+
0.087,
|
| 1475 |
+
0.48,
|
| 1476 |
+
0.245,
|
| 1477 |
+
0.495
|
| 1478 |
+
],
|
| 1479 |
+
"angle": 0,
|
| 1480 |
+
"content": "ACKNOWLEDGMENTS"
|
| 1481 |
+
},
|
| 1482 |
+
{
|
| 1483 |
+
"type": "text",
|
| 1484 |
+
"bbox": [
|
| 1485 |
+
0.085,
|
| 1486 |
+
0.502,
|
| 1487 |
+
0.477,
|
| 1488 |
+
0.624
|
| 1489 |
+
],
|
| 1490 |
+
"angle": 0,
|
| 1491 |
+
"content": "Jian Yin is the corresponding author. Daya Guo and Jian Yin are supported by the National Natural Science Foundation of China (U1911203, U2001211, U22B2060), Guangdong Basic and Applied Basic Research Foundation (2019B1515130001), Key-Area Research and Development Program of Guangdong Province (2020B0101100001). We would like to thank the anonymous reviewers and the meta-reviewer for their insightful comments."
|
| 1492 |
+
},
|
| 1493 |
+
{
|
| 1494 |
+
"type": "title",
|
| 1495 |
+
"bbox": [
|
| 1496 |
+
0.087,
|
| 1497 |
+
0.643,
|
| 1498 |
+
0.185,
|
| 1499 |
+
0.659
|
| 1500 |
+
],
|
| 1501 |
+
"angle": 0,
|
| 1502 |
+
"content": "References"
|
| 1503 |
+
},
|
| 1504 |
+
{
|
| 1505 |
+
"type": "ref_text",
|
| 1506 |
+
"bbox": [
|
| 1507 |
+
0.087,
|
| 1508 |
+
0.667,
|
| 1509 |
+
0.478,
|
| 1510 |
+
0.713
|
| 1511 |
+
],
|
| 1512 |
+
"angle": 0,
|
| 1513 |
+
"content": "Allamanis, M. The adverse effects of code duplication in machine learning models of code. In Onward!, pp. 143-153. ACM, 2019."
|
| 1514 |
+
},
|
| 1515 |
+
{
|
| 1516 |
+
"type": "ref_text",
|
| 1517 |
+
"bbox": [
|
| 1518 |
+
0.087,
|
| 1519 |
+
0.724,
|
| 1520 |
+
0.478,
|
| 1521 |
+
0.785
|
| 1522 |
+
],
|
| 1523 |
+
"angle": 0,
|
| 1524 |
+
"content": "Allamanis, M. and Sutton, C. Mining source code repositories at massive scale using language modeling. In 2013 10th Working Conference on Mining Software Repositories (MSR), pp. 207-216. IEEE, 2013."
|
| 1525 |
+
},
|
| 1526 |
+
{
|
| 1527 |
+
"type": "ref_text",
|
| 1528 |
+
"bbox": [
|
| 1529 |
+
0.087,
|
| 1530 |
+
0.796,
|
| 1531 |
+
0.475,
|
| 1532 |
+
0.827
|
| 1533 |
+
],
|
| 1534 |
+
"angle": 0,
|
| 1535 |
+
"content": "Allamanis, M. and Sutton, C. Mining idioms from source code. In SIGSOFT FSE, pp. 472-483. ACM, 2014."
|
| 1536 |
+
},
|
| 1537 |
+
{
|
| 1538 |
+
"type": "ref_text",
|
| 1539 |
+
"bbox": [
|
| 1540 |
+
0.087,
|
| 1541 |
+
0.838,
|
| 1542 |
+
0.478,
|
| 1543 |
+
0.883
|
| 1544 |
+
],
|
| 1545 |
+
"angle": 0,
|
| 1546 |
+
"content": "Beltagy, I., Peters, M. E., and Cohan, A. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020."
|
| 1547 |
+
},
|
| 1548 |
+
{
|
| 1549 |
+
"type": "list",
|
| 1550 |
+
"bbox": [
|
| 1551 |
+
0.087,
|
| 1552 |
+
0.667,
|
| 1553 |
+
0.478,
|
| 1554 |
+
0.883
|
| 1555 |
+
],
|
| 1556 |
+
"angle": 0,
|
| 1557 |
+
"content": null
|
| 1558 |
+
},
|
| 1559 |
+
{
|
| 1560 |
+
"type": "page_footnote",
|
| 1561 |
+
"bbox": [
|
| 1562 |
+
0.106,
|
| 1563 |
+
0.89,
|
| 1564 |
+
0.424,
|
| 1565 |
+
0.906
|
| 1566 |
+
],
|
| 1567 |
+
"angle": 0,
|
| 1568 |
+
"content": "<sup>5</sup>https://github.com/features/copilot"
|
| 1569 |
+
},
|
| 1570 |
+
{
|
| 1571 |
+
"type": "ref_text",
|
| 1572 |
+
"bbox": [
|
| 1573 |
+
0.499,
|
| 1574 |
+
0.085,
|
| 1575 |
+
0.888,
|
| 1576 |
+
0.146
|
| 1577 |
+
],
|
| 1578 |
+
"angle": 0,
|
| 1579 |
+
"content": "Bielik, P., Raychev, V., and Vechev, M. T. PHOG: probabilistic model for code. In ICML, volume 48 of JMLR Workshop and Conference Proceedings, pp. 2933-2942. JMLR.org, 2016."
|
| 1580 |
+
},
|
| 1581 |
+
{
|
| 1582 |
+
"type": "ref_text",
|
| 1583 |
+
"bbox": [
|
| 1584 |
+
0.499,
|
| 1585 |
+
0.155,
|
| 1586 |
+
0.889,
|
| 1587 |
+
0.275
|
| 1588 |
+
],
|
| 1589 |
+
"angle": 0,
|
| 1590 |
+
"content": "Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., and Amodei, D. Language models are few-shot learners. In NeurIPS, 2020."
|
| 1591 |
+
},
|
| 1592 |
+
{
|
| 1593 |
+
"type": "ref_text",
|
| 1594 |
+
"bbox": [
|
| 1595 |
+
0.499,
|
| 1596 |
+
0.286,
|
| 1597 |
+
0.889,
|
| 1598 |
+
0.346
|
| 1599 |
+
],
|
| 1600 |
+
"angle": 0,
|
| 1601 |
+
"content": "Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H. P. d. O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021."
|
| 1602 |
+
},
|
| 1603 |
+
{
|
| 1604 |
+
"type": "ref_text",
|
| 1605 |
+
"bbox": [
|
| 1606 |
+
0.499,
|
| 1607 |
+
0.356,
|
| 1608 |
+
0.889,
|
| 1609 |
+
0.401
|
| 1610 |
+
],
|
| 1611 |
+
"angle": 0,
|
| 1612 |
+
"content": "Child, R., Gray, S., Radford, A., and Sutskever, I. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019."
|
| 1613 |
+
},
|
| 1614 |
+
{
|
| 1615 |
+
"type": "ref_text",
|
| 1616 |
+
"bbox": [
|
| 1617 |
+
0.499,
|
| 1618 |
+
0.411,
|
| 1619 |
+
0.889,
|
| 1620 |
+
0.485
|
| 1621 |
+
],
|
| 1622 |
+
"angle": 0,
|
| 1623 |
+
"content": "Choromanski, K. M., Likhosherstov, V., Dohan, D., Song, X., Gane, A., Sarlos, T., Hawkins, P., Davis, J. Q., Mohiuddin, A., Kaiser, L., Belanger, D. B., Colwell, L. J., and Weller, A. Rethinking attention with performers. In ICLR. OpenReview.net, 2021."
|
| 1624 |
+
},
|
| 1625 |
+
{
|
| 1626 |
+
"type": "ref_text",
|
| 1627 |
+
"bbox": [
|
| 1628 |
+
0.499,
|
| 1629 |
+
0.496,
|
| 1630 |
+
0.889,
|
| 1631 |
+
0.571
|
| 1632 |
+
],
|
| 1633 |
+
"angle": 0,
|
| 1634 |
+
"content": "Clement, C. B., Lu, S., Liu, X., Tufano, M., Drain, D., Duan, N., Sundaresan, N., and Svyatkovskiy, A. Long-range modeling of source code files with ewash: Extended window access by syntax hierarchy. In EMNLP, pp. 4713-4722. Association for Computational Linguistics, 2021."
|
| 1635 |
+
},
|
| 1636 |
+
{
|
| 1637 |
+
"type": "ref_text",
|
| 1638 |
+
"bbox": [
|
| 1639 |
+
0.499,
|
| 1640 |
+
0.581,
|
| 1641 |
+
0.889,
|
| 1642 |
+
0.641
|
| 1643 |
+
],
|
| 1644 |
+
"angle": 0,
|
| 1645 |
+
"content": "Devlin, J., Chang, M., Lee, K., and Toutanova, K. BERT: pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT*, pp. 4171-4186. Association for Computational Linguistics, 2019."
|
| 1646 |
+
},
|
| 1647 |
+
{
|
| 1648 |
+
"type": "ref_text",
|
| 1649 |
+
"bbox": [
|
| 1650 |
+
0.499,
|
| 1651 |
+
0.651,
|
| 1652 |
+
0.889,
|
| 1653 |
+
0.711
|
| 1654 |
+
],
|
| 1655 |
+
"angle": 0,
|
| 1656 |
+
"content": "Dong, L., Yang, N., Wang, W., Wei, F., Liu, X., Wang, Y., Gao, J., Zhou, M., and Hon, H. Unified language model pre-training for natural language understanding and generation. In NeurIPS, pp. 13042-13054, 2019."
|
| 1657 |
+
},
|
| 1658 |
+
{
|
| 1659 |
+
"type": "ref_text",
|
| 1660 |
+
"bbox": [
|
| 1661 |
+
0.499,
|
| 1662 |
+
0.721,
|
| 1663 |
+
0.889,
|
| 1664 |
+
0.781
|
| 1665 |
+
],
|
| 1666 |
+
"angle": 0,
|
| 1667 |
+
"content": "Fried, D., Aghajanyan, A., Lin, J., Wang, S., Wallace, E., Shi, F., Zhong, R., Yih, W.-t., Zettlemoyer, L., and Lewis, M. Incoder: A generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999, 2022."
|
| 1668 |
+
},
|
| 1669 |
+
{
|
| 1670 |
+
"type": "ref_text",
|
| 1671 |
+
"bbox": [
|
| 1672 |
+
0.499,
|
| 1673 |
+
0.791,
|
| 1674 |
+
0.889,
|
| 1675 |
+
0.851
|
| 1676 |
+
],
|
| 1677 |
+
"angle": 0,
|
| 1678 |
+
"content": "Guo, D., Lu, S., Duan, N., Wang, Y., Zhou, M., and Yin, J. Unixcoder: Unified cross-modal pre-training for code representation. In ACL, pp. 7212-7225. Association for Computational Linguistics, 2022."
|
| 1679 |
+
},
|
| 1680 |
+
{
|
| 1681 |
+
"type": "ref_text",
|
| 1682 |
+
"bbox": [
|
| 1683 |
+
0.499,
|
| 1684 |
+
0.861,
|
| 1685 |
+
0.889,
|
| 1686 |
+
0.906
|
| 1687 |
+
],
|
| 1688 |
+
"angle": 0,
|
| 1689 |
+
"content": "Hellendoorn, V. J. and Devanbu, P. T. Are deep neural networks the best choice for modeling source code? In ESEC/SIGSOFT FSE, pp. 763-773. ACM, 2017."
|
| 1690 |
+
},
|
| 1691 |
+
{
|
| 1692 |
+
"type": "list",
|
| 1693 |
+
"bbox": [
|
| 1694 |
+
0.499,
|
| 1695 |
+
0.085,
|
| 1696 |
+
0.889,
|
| 1697 |
+
0.906
|
| 1698 |
+
],
|
| 1699 |
+
"angle": 0,
|
| 1700 |
+
"content": null
|
| 1701 |
+
},
|
| 1702 |
+
{
|
| 1703 |
+
"type": "page_number",
|
| 1704 |
+
"bbox": [
|
| 1705 |
+
0.481,
|
| 1706 |
+
0.924,
|
| 1707 |
+
0.493,
|
| 1708 |
+
0.935
|
| 1709 |
+
],
|
| 1710 |
+
"angle": 0,
|
| 1711 |
+
"content": "9"
|
| 1712 |
+
}
|
| 1713 |
+
],
|
| 1714 |
+
[
|
| 1715 |
+
{
|
| 1716 |
+
"type": "header",
|
| 1717 |
+
"bbox": [
|
| 1718 |
+
0.237,
|
| 1719 |
+
0.057,
|
| 1720 |
+
0.735,
|
| 1721 |
+
0.072
|
| 1722 |
+
],
|
| 1723 |
+
"angle": 0,
|
| 1724 |
+
"content": "LongCoder: A Long-Range Pre-trained Language Model for Code Completion"
|
| 1725 |
+
},
|
| 1726 |
+
{
|
| 1727 |
+
"type": "ref_text",
|
| 1728 |
+
"bbox": [
|
| 1729 |
+
0.088,
|
| 1730 |
+
0.085,
|
| 1731 |
+
0.476,
|
| 1732 |
+
0.13
|
| 1733 |
+
],
|
| 1734 |
+
"angle": 0,
|
| 1735 |
+
"content": "Hindle, A., Barr, E. T., Gabel, M., Su, Z., and Devanbu, P. T. On the naturalness of software. Commun. ACM, 59(5): 122-131, 2016."
|
| 1736 |
+
},
|
| 1737 |
+
{
|
| 1738 |
+
"type": "ref_text",
|
| 1739 |
+
"bbox": [
|
| 1740 |
+
0.088,
|
| 1741 |
+
0.14,
|
| 1742 |
+
0.476,
|
| 1743 |
+
0.2
|
| 1744 |
+
],
|
| 1745 |
+
"angle": 0,
|
| 1746 |
+
"content": "Husain, H., Wu, H.-H., Gazit, T., Allamanis, M., and Brockschmidt, M. Codesearchnet challenge: Evaluating the state of semantic code search. arXiv preprint arXiv:1909.09436, 2019."
|
| 1747 |
+
},
|
| 1748 |
+
{
|
| 1749 |
+
"type": "ref_text",
|
| 1750 |
+
"bbox": [
|
| 1751 |
+
0.088,
|
| 1752 |
+
0.21,
|
| 1753 |
+
0.476,
|
| 1754 |
+
0.284
|
| 1755 |
+
],
|
| 1756 |
+
"angle": 0,
|
| 1757 |
+
"content": "Katharopoulos, A., Vyas, A., Pappas, N., and Fleuret, F. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, volume 119 of Proceedings of Machine Learning Research, pp. 5156-5165. PMLR, 2020."
|
| 1758 |
+
},
|
| 1759 |
+
{
|
| 1760 |
+
"type": "ref_text",
|
| 1761 |
+
"bbox": [
|
| 1762 |
+
0.088,
|
| 1763 |
+
0.295,
|
| 1764 |
+
0.476,
|
| 1765 |
+
0.325
|
| 1766 |
+
],
|
| 1767 |
+
"angle": 0,
|
| 1768 |
+
"content": "Kitaev, N., Kaiser, L., and Levskaya, A. Reformer: The efficient transformer. In *ICLR*. OpenReview.net, 2020."
|
| 1769 |
+
},
|
| 1770 |
+
{
|
| 1771 |
+
"type": "ref_text",
|
| 1772 |
+
"bbox": [
|
| 1773 |
+
0.088,
|
| 1774 |
+
0.334,
|
| 1775 |
+
0.476,
|
| 1776 |
+
0.394
|
| 1777 |
+
],
|
| 1778 |
+
"angle": 0,
|
| 1779 |
+
"content": "Li, Y., Choi, D., Chung, J., Kushman, N., Schrittwieser, J., Leblond, R., Eccles, T., Keeling, J., Gimeno, F., Dal Lago, A., et al. Competition-level code generation with alphabet. Science, 378(6624):1092-1097, 2022."
|
| 1780 |
+
},
|
| 1781 |
+
{
|
| 1782 |
+
"type": "ref_text",
|
| 1783 |
+
"bbox": [
|
| 1784 |
+
0.088,
|
| 1785 |
+
0.404,
|
| 1786 |
+
0.476,
|
| 1787 |
+
0.449
|
| 1788 |
+
],
|
| 1789 |
+
"angle": 0,
|
| 1790 |
+
"content": "Liu, F., Li, G., Zhao, Y., and Jin, Z. Multi-task learning based pre-trained language model for code completion. In ASE, pp. 473-485. IEEE, 2020."
|
| 1791 |
+
},
|
| 1792 |
+
{
|
| 1793 |
+
"type": "ref_text",
|
| 1794 |
+
"bbox": [
|
| 1795 |
+
0.088,
|
| 1796 |
+
0.459,
|
| 1797 |
+
0.476,
|
| 1798 |
+
0.504
|
| 1799 |
+
],
|
| 1800 |
+
"angle": 0,
|
| 1801 |
+
"content": "Liu, T., Xu, C., and McAuley, J. Repobench: Benchmarking repository-level code auto-completion systems. arXiv preprint, 2023."
|
| 1802 |
+
},
|
| 1803 |
+
{
|
| 1804 |
+
"type": "ref_text",
|
| 1805 |
+
"bbox": [
|
| 1806 |
+
0.088,
|
| 1807 |
+
0.513,
|
| 1808 |
+
0.476,
|
| 1809 |
+
0.618
|
| 1810 |
+
],
|
| 1811 |
+
"angle": 0,
|
| 1812 |
+
"content": "Lu, S., Guo, D., Ren, S., Huang, J., Svyatkovskiy, A., Blanco, A., Clement, C. B., Drain, D., Jiang, D., Tang, D., Li, G., Zhou, L., Shou, L., Zhou, L., Tufano, M., Gong, M., Zhou, M., Duan, N., Sundaresan, N., Deng, S. K., Fu, S., and Liu, S. Codexglue: A machine learning benchmark dataset for code understanding and generation. In NeurIPS Datasets and Benchmarks, 2021."
|
| 1813 |
+
},
|
| 1814 |
+
{
|
| 1815 |
+
"type": "ref_text",
|
| 1816 |
+
"bbox": [
|
| 1817 |
+
0.088,
|
| 1818 |
+
0.628,
|
| 1819 |
+
0.476,
|
| 1820 |
+
0.687
|
| 1821 |
+
],
|
| 1822 |
+
"angle": 0,
|
| 1823 |
+
"content": "Nijkamp, E., Pang, B., Hayashi, H., Tu, L., Wang, H., Zhou, Y., Savarese, S., and Xiong, C. A conversational paradigm for program synthesis. arXiv preprint arXiv:2203.13474, 2022."
|
| 1824 |
+
},
|
| 1825 |
+
{
|
| 1826 |
+
"type": "ref_text",
|
| 1827 |
+
"bbox": [
|
| 1828 |
+
0.088,
|
| 1829 |
+
0.697,
|
| 1830 |
+
0.476,
|
| 1831 |
+
0.743
|
| 1832 |
+
],
|
| 1833 |
+
"angle": 0,
|
| 1834 |
+
"content": "Qin, Z., Sun, W., Deng, H., Li, D., Wei, Y., Lv, B., Yan, J., Kong, L., and Zhong, Y. cosformer: Rethinking softmax in attention. In ICLR. OpenReview.net, 2022."
|
| 1835 |
+
},
|
| 1836 |
+
{
|
| 1837 |
+
"type": "ref_text",
|
| 1838 |
+
"bbox": [
|
| 1839 |
+
0.088,
|
| 1840 |
+
0.752,
|
| 1841 |
+
0.476,
|
| 1842 |
+
0.797
|
| 1843 |
+
],
|
| 1844 |
+
"angle": 0,
|
| 1845 |
+
"content": "Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019."
|
| 1846 |
+
},
|
| 1847 |
+
{
|
| 1848 |
+
"type": "ref_text",
|
| 1849 |
+
"bbox": [
|
| 1850 |
+
0.088,
|
| 1851 |
+
0.807,
|
| 1852 |
+
0.476,
|
| 1853 |
+
0.851
|
| 1854 |
+
],
|
| 1855 |
+
"angle": 0,
|
| 1856 |
+
"content": "Raychev, V., Bielik, P., and Vechev, M. T. Probabilistic model for code with decision trees. In OOPSLA, pp. 731-747. ACM, 2016."
|
| 1857 |
+
},
|
| 1858 |
+
{
|
| 1859 |
+
"type": "ref_text",
|
| 1860 |
+
"bbox": [
|
| 1861 |
+
0.088,
|
| 1862 |
+
0.861,
|
| 1863 |
+
0.476,
|
| 1864 |
+
0.906
|
| 1865 |
+
],
|
| 1866 |
+
"angle": 0,
|
| 1867 |
+
"content": "Svyatkovskiy, A., Deng, S. K., Fu, S., and Sundaresan, N. \nIntellicode compose: code generation using transformer. In ESEC/SIGSOFT FSE, pp. 1433-1443. ACM, 2020."
|
| 1868 |
+
},
|
| 1869 |
+
{
|
| 1870 |
+
"type": "list",
|
| 1871 |
+
"bbox": [
|
| 1872 |
+
0.088,
|
| 1873 |
+
0.085,
|
| 1874 |
+
0.476,
|
| 1875 |
+
0.906
|
| 1876 |
+
],
|
| 1877 |
+
"angle": 0,
|
| 1878 |
+
"content": null
|
| 1879 |
+
},
|
| 1880 |
+
{
|
| 1881 |
+
"type": "ref_text",
|
| 1882 |
+
"bbox": [
|
| 1883 |
+
0.5,
|
| 1884 |
+
0.085,
|
| 1885 |
+
0.886,
|
| 1886 |
+
0.13
|
| 1887 |
+
],
|
| 1888 |
+
"angle": 0,
|
| 1889 |
+
"content": "Tay, Y., Dehghani, M., Bahri, D., and Metzler, D. Efficient transformers: A survey. ACM Computing Surveys, 55(6): 1-28, 2022."
|
| 1890 |
+
},
|
| 1891 |
+
{
|
| 1892 |
+
"type": "ref_text",
|
| 1893 |
+
"bbox": [
|
| 1894 |
+
0.5,
|
| 1895 |
+
0.141,
|
| 1896 |
+
0.886,
|
| 1897 |
+
0.171
|
| 1898 |
+
],
|
| 1899 |
+
"angle": 0,
|
| 1900 |
+
"content": "Tu, Z., Su, Z., and Devanbu, P. T. On the localness of software. In SIGSOFT FSE, pp. 269-280. ACM, 2014."
|
| 1901 |
+
},
|
| 1902 |
+
{
|
| 1903 |
+
"type": "ref_text",
|
| 1904 |
+
"bbox": [
|
| 1905 |
+
0.5,
|
| 1906 |
+
0.181,
|
| 1907 |
+
0.886,
|
| 1908 |
+
0.227
|
| 1909 |
+
],
|
| 1910 |
+
"angle": 0,
|
| 1911 |
+
"content": "Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In NIPS, pp. 5998-6008, 2017."
|
| 1912 |
+
},
|
| 1913 |
+
{
|
| 1914 |
+
"type": "ref_text",
|
| 1915 |
+
"bbox": [
|
| 1916 |
+
0.5,
|
| 1917 |
+
0.236,
|
| 1918 |
+
0.886,
|
| 1919 |
+
0.281
|
| 1920 |
+
],
|
| 1921 |
+
"angle": 0,
|
| 1922 |
+
"content": "Wang, S., Li, B. Z., Khabsa, M., Fang, H., and Ma, H. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020."
|
| 1923 |
+
},
|
| 1924 |
+
{
|
| 1925 |
+
"type": "ref_text",
|
| 1926 |
+
"bbox": [
|
| 1927 |
+
0.5,
|
| 1928 |
+
0.292,
|
| 1929 |
+
0.886,
|
| 1930 |
+
0.337
|
| 1931 |
+
],
|
| 1932 |
+
"angle": 0,
|
| 1933 |
+
"content": "Xu, F. F., Alon, U., Neubig, G., and Hellendoorn, V. J. A systematic evaluation of large language models of code. In MAPS@PLDI, pp. 1-10. ACM, 2022."
|
| 1934 |
+
},
|
| 1935 |
+
{
|
| 1936 |
+
"type": "ref_text",
|
| 1937 |
+
"bbox": [
|
| 1938 |
+
0.5,
|
| 1939 |
+
0.347,
|
| 1940 |
+
0.886,
|
| 1941 |
+
0.407
|
| 1942 |
+
],
|
| 1943 |
+
"angle": 0,
|
| 1944 |
+
"content": "Zaheer, M., Guruganesh, G., Dubey, K. A., Ainslie, J., Alberti, C., Ontañón, S., Pham, P., Ravula, A., Wang, Q., Yang, L., and Ahmed, A. Big bird: Transformers for longer sequences. In NeurIPS, 2020."
|
| 1945 |
+
},
|
| 1946 |
+
{
|
| 1947 |
+
"type": "list",
|
| 1948 |
+
"bbox": [
|
| 1949 |
+
0.5,
|
| 1950 |
+
0.085,
|
| 1951 |
+
0.886,
|
| 1952 |
+
0.407
|
| 1953 |
+
],
|
| 1954 |
+
"angle": 0,
|
| 1955 |
+
"content": null
|
| 1956 |
+
},
|
| 1957 |
+
{
|
| 1958 |
+
"type": "page_number",
|
| 1959 |
+
"bbox": [
|
| 1960 |
+
0.478,
|
| 1961 |
+
0.924,
|
| 1962 |
+
0.496,
|
| 1963 |
+
0.935
|
| 1964 |
+
],
|
| 1965 |
+
"angle": 0,
|
| 1966 |
+
"content": "10"
|
| 1967 |
+
}
|
| 1968 |
+
]
|
| 1969 |
+
]
|
2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/764c4fd6-5564-414d-aed4-faf9cde1cc97_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d35cd27a2d8a48c5bd40570e8760f8df8ce1e109b3693a32393368096b90d39d
|
| 3 |
+
size 443819
|
2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/full.md
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LongCoder: A Long-Range Pre-trained Language Model for Code Completion
|
| 2 |
+
|
| 3 |
+
Daya Guo $^{*1}$ Canwen Xu $^{*2}$ Nan Duan $^{3}$ Jian Yin $^{1}$ Julian McAuley $^{2}$
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
In this paper, we introduce a new task for code completion that focuses on handling long code input and propose a sparse Transformer model, called LongCoder, to address this task. LongCoder employs a sliding window mechanism for self-attention and introduces two types of globally accessible tokens — bridge tokens and memory tokens — to improve performance and efficiency. Bridge tokens are inserted throughout the input sequence to aggregate local information and facilitate global interaction, while memory tokens are included to highlight important statements that may be invoked later and need to be memorized, such as package imports and definitions of classes, functions, or structures. We conduct experiments on a newly constructed dataset that contains longer code context and the publicly available CodeXGLUE benchmark. Experimental results demonstrate that LongCoder achieves superior performance on code completion tasks compared to previous models while maintaining comparable efficiency in terms of computational resources during inference.
|
| 8 |
+
|
| 9 |
+
# 1. Introduction
|
| 10 |
+
|
| 11 |
+
Code completion is a crucial task in software development that helps developers save time and effort by suggesting and auto-completing code based on context. With the advancement of large language models, Transformer-based models (Vaswani et al., 2017) have demonstrated impressive results in code completion (Chen et al., 2021). However, the computational cost of these models grows quadratically with the length of input, making them less suitable for modeling long code context. On the other hand, modeling long code can potentially improve the accuracy of code completion and enable applications on a file and even project level.
|
| 12 |
+
|
| 13 |
+
*Equal contribution ${}^{1}$ Sun Yat-sen University ${}^{2}$ University of California, San Diego ${}^{3}$ Microsoft Research Asia. Correspondence to: Daya Guo <guody5@mail2.sysu.edu.cn>.
|
| 14 |
+
|
| 15 |
+
Proceedings of the $40^{th}$ International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s).
|
| 16 |
+
|
| 17 |
+
An efficient model that can scale to such long input can be suitable for code completion that contains long context.
|
| 18 |
+
|
| 19 |
+
In this paper, we propose a new pre-trained language model, named LongCoder, for long code modeling. As shown in Figure 1, LongCoder features a sparse attention mechanism that reduces the computational complexity (to linear). LongCoder exploits a sliding window mechanism for self-attention that attends only to local context. To allow LongCoder to maintain an understanding of the entire code file, we introduce bridge attention and global attention, with the corresponding two types of globally accessible tokens, bridge tokens and memory tokens. Bridge attention aggregates the information of a code snippet and allows it to be accessed from a long distance. Bridge tokens are inserted throughout the input sequence and can attend to a fixed length of context. Memory tokens provide global attention to statements that include a package import, definitions of classes, functions, or structures. The scope of these statements is often global and invoked later, which means they have a longer impact than other statements, making them worth memorizing. By referring to these statements, the model can exploit long context while maintaining linear complexity.
|
| 20 |
+
|
| 21 |
+
To evaluate the effectiveness of LongCoder and encourage future research on Long Code Completion, we construct a new dataset called LCC by filtering code from GitHub based on length, with the goal of focusing on longer code examples. On average, the examples in LCC are $5 \times$ longer than those in existing datasets (Lu et al., 2021). We benchmark several baselines, LongCoder and OpenAI Codex (Chen et al., 2021) on LCC. Our experimental results demonstrate that code completion can benefit from taking longer context into consideration, and our LongCoder achieves superior performance compared to existing models with comparable computational costs.
|
| 22 |
+
|
| 23 |
+
Overall, our contributions are as follows:
|
| 24 |
+
|
| 25 |
+
- We construct a new dataset (LCC) for code completion tasks that requires long code modeling to encourage more research in such scenarios.
|
| 26 |
+
- We propose two types of sparse attention, motivated by observations on attention patterns of existing models and how human programmers write code.
|
| 27 |
+
|
| 28 |
+
# Out-of-Window Context
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
import torch\n
|
| 32 |
+
import torch nn as nn\n
|
| 33 |
+
import torch nnfunctional as F\n
|
| 34 |
+
class ConvBlock(nnModule): \n
|
| 35 |
+
"A block of convolutional and pooling layers."
|
| 36 |
+
"A"
|
| 37 |
+
def __init__(self, in_channels, out_channels, kernel_size, stride, padding): \nsuper(ConvBlock, self).__init()
|
| 38 |
+
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding)
|
| 39 |
+
self.pool = nn.MaxPool2d(kernel_size=2)
|
| 40 |
+
def forward(self, x): \nx = self.pool(F.ReLU(self.conv(x)))
|
| 41 |
+
return x
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
# In-Window Context
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
class ConvNet(nnModule): \n
|
| 48 |
+
"A convolutional neural network
|
| 49 |
+
''
|
| 50 |
+
def __init__(self):
|
| 51 |
+
super(ConvNet, self).__init()
|
| 52 |
+
self.conv_block1 = ConvBlock(3, 32, 3, 1, 1) #first block
|
| 53 |
+
self.conv_block2 = ConvBlock(32, 64, 3, 1, 1) #second block
|
| 54 |
+
self/flatten = nn.Conv()
|
| 55 |
+
self.fc1 = nn.Linear(
|
| 56 |
+
in_features=64 * 8 * 8, out_features=128)
|
| 57 |
+
self.fc2 = nn.Linear(
|
| 58 |
+
in_features=128, out_features=10)
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
# Code to Complete
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
def forward(self, x):
|
| 65 |
+
x = self.convert_block( x )
|
| 66 |
+
x = self.convert_block( x )
|
| 67 |
+
x = self.flatten( x )
|
| 68 |
+
x = F.relu(self.fcl( x ))
|
| 69 |
+
x = self.fc2( x )
|
| 70 |
+
return x
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 1. (Left) An example of how LongCoder facilitates completion with longer context. The memory tokens save potentially useful information (including package imports, class and function definitions) for global access despite whether they are within the sliding window. The bridge tokens aggregate local information by attending to a fixed length of tokens. The information flow within the window is omitted for clarity. (Right) Attention patterns used in BigBird (Zaheer et al., 2020), Longformer (Beltagy et al., 2020) and LongCoder. Best viewed in color.
|
| 75 |
+
|
| 76 |
+
# Attention Pattern
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
|
| 86 |
+
- We train and release LongCoder, a sparse and efficient pre-trained Transformer model for long code modeling, which achieves superior performance on both long and regular code completion with comparable computational resources.
|
| 87 |
+
|
| 88 |
+
# 2. Related Work
|
| 89 |
+
|
| 90 |
+
Code Completion Code completion is an essential task that helps programmers improve their efficiency by suggesting and automatically completing code based on context and previous inputs. Prior works have explored the use of statistical learning for the code completion task, such as the use of
|
| 91 |
+
|
| 92 |
+
n-gram techniques (Tu et al., 2014; Hindle et al., 2016) and probabilistic grammar-based methods (Allamanis & Sutton, 2014; Bielik et al., 2016; Raychev et al., 2016; Hellendoorn & Devanbu, 2017). With the success of pre-training in natural language processing (Devlin et al., 2019; Radford et al., 2019; Brown et al., 2020), decoder-only pre-trained models based on Transformer have been proposed to promote the development of code completion. Svyatkovskiy et al. (2020) and Lu et al. (2021) respectively propose GPT-C and CodeGPT, which are pre-trained by generating code from left to right in an auto-regressive manner on large amounts of code. Liu et al. (2020) and Guo et al. (2022) pre-train similar models CugLM and UniXcoder with multi-task learning by leveraging code structure for code completion. Codex (Chen et al., 2021), PolyCoder (Xu et al., 2022), CodeGen
|
| 93 |
+
|
| 94 |
+
(Nijkamp et al., 2022), InCoder (Fried et al., 2022), and AlphaCode (Li et al., 2022) build large language models with billions of parameters and achieve impressive performance on code generation by training on a large-scale and high-quality code corpus. For these pre-trained models, it is impractical to simply expand the context window to model long-range sequences, due to computational complexity of the attention mechanism increasing quadratically with the input length. Therefore, Clement et al. (2021) propose to extract the most important code fragments and integrate them into a fixed-length context window. However, due to the constraint of fixed window length, some high-priority code, such as class and function definitions, may be omitted. Additionally, increasing the window length would also introduce additional computational overhead. Different from these works, LongCoder is a sparse Transformer that can take advantage of the entire file-level code context while maintaining comparable efficiency in terms of computational resources during inference.
|
| 95 |
+
|
| 96 |
+
Long-Range Transformer Models The original Transformer (Vaswani et al., 2017) is inefficient for modeling long sequences since its time and space complexity is $O(n^{2})$ , where $n$ is the length of the sequence. Prior studies focus on optimizing the complexity to enable processing of longer sequences. To name a few, Sparse Transformer (Child et al., 2019) reduces the quadratic complexity of standard selfattention by computing attention on sparse query-key pairs. Sparse Transformer uses a dilated sliding window to capture local context. Reformer (Kitaev et al., 2020) proposes locality sensitive hashing (LSH) attention to reduce the complexity and memory footprint. Longformer (Beltagy et al., 2020) uses dilated sliding windows to model longer sequences and adds global memory tokens to allow interaction with all tokens. Performer (Choromanski et al., 2021) generalizes attention calculation by introducing kernel functions. They then propose a random kernel function, namely orthogonal random features (ORF) to approximate the standard selfattention. Linformer (Wang et al., 2020) applies low-rank projection to the length dimension to reduce the complexity of self-attention. Linear Transformers (Katharopoulos et al., 2020) uses a kernel function that exploits the associativity property of matrix products to reduce complexity. BigBird (Zaheer et al., 2020) has an attention pattern comprised of random attention, window attention and global attention. CosFormer (Qin et al., 2022) proposes a linear operator and a cosine-based distance re-weighting mechanism as the substitute for softmax attention. We recommend Tay et al. (2022) as a more comprehensive survey on long-range efficient Transformer models. Different from these works, our LongCoder introduces code heuristics into the dynamic construction of global attention to imitate how human programmers code.
|
| 97 |
+
|
| 98 |
+
# 3. Long Code Completion
|
| 99 |
+
|
| 100 |
+
Code completion is a fundamental and important task for code models, which can help programmers improve their efficiency while coding. Previous public benchmarks primarily focused on completion with short code context. For instance, CodeXGLUE (Lu et al., 2021) offers two code completion datasets from PY150 (Raychev et al., 2016) in Python and Github Java Corpus Allamanis & Sutton (2013) in Java, and also builds two test datasets to evaluate next-line prediction. The average length of the code context in the two test datasets is 478 tokens and 365 tokens, respectively. However, according to our statistics, the average length of a Python source file on GitHub is 1,305 tokens. After tokenization, the average length becomes 2,090 tokens while $41\% / 24\%$ of the files have a length longer than 1,024/2,048 tokens, which highlights the need for models that can handle longer code sequences in order to be more practical and useful in the real-world. Meanwhile, longer code sequences contain more complex structures and require models to consider more context and dependencies. This can be challenging for previously proposed code completion models that focus on short code and do not take into account the long context of the code. By evaluating models on longer code sequences, we can better understand their ability to handle more complex and realistic scenarios. Meanwhile, long code completion poses new challenges for efficiency of code models, as in vanilla Transformers (Vaswani et al., 2017), the computational resources grow quadratically with the input length.
|
| 101 |
+
|
| 102 |
+
In this paper, we introduce the Long Code Completion Benchmark (LCC), a new benchmark that focuses on code completion with long code context for three programming languages: Python, Java, and C#. Specifically, we construct our datasets from the github-code $^2$ dataset, which contains a vast number of code files sourced from GitHub with an open-source license that permits research use. The steps to construct the datasets are as follows:
|
| 103 |
+
|
| 104 |
+
- We first follow Allamanis (2019) to deduplicate examples with high similarity (Jacobi similarity $\geq 0.9$ ) in order to eliminate forked files, and then remove code files that can't be parsed into an abstract syntax tree using a standard compiler tool called tree-sitter. $^3$
|
| 105 |
+
- Since the benchmark primarily focuses on the code completion task with long code context, we remove code files whose length of code tokens after tokenization is shorter than 512. Additionally, we also eliminate excessively long code files with a length greater than
|
| 106 |
+
|
| 107 |
+
Table 1. Data statistics of the code context length in LCC test set. $25\% /50\% /75\%$ refer to the first/second/third quartile.
|
| 108 |
+
|
| 109 |
+
<table><tr><td>Language</td><td>Average</td><td>25%</td><td>50%</td><td>75%</td></tr><tr><td>Python</td><td>1993.3</td><td>1056</td><td>1438</td><td>2211</td></tr><tr><td>Java</td><td>1841.4</td><td>1058</td><td>1307</td><td>2003</td></tr><tr><td>C#</td><td>1970.5</td><td>1023</td><td>1396</td><td>2143</td></tr></table>
|
| 110 |
+
|
| 111 |
+
10,000 tokens.
|
| 112 |
+
|
| 113 |
+
- For each programming language, we sample 100k examples for training, and 10k examples for development and 10k for testing. For each sample on development and test sets, we randomly sample an uncommented line of code not shorted than 3 tokens and ensure that there is sufficient context, i.e., a context larger than 512 code tokens. The data statistics of the context length in the LCC test sets are listed in Table 1.
|
| 114 |
+
|
| 115 |
+
We follow Lu et al. (2021) to evaluate the performance of the models in terms of Exact Match (EM) and Edit Similarity (Edit Sim) on a per-line basis (Svyatkovskiy et al., 2020).
|
| 116 |
+
|
| 117 |
+
# 4. LongCoder
|
| 118 |
+
|
| 119 |
+
LongCoder is an attempt to tackle the efficiency problem of modeling longer code. It applies sparse attention to reduce quadratic time and space complexity of self-attention to linear. There are three types of attention in LongCoder — window attention, bridge attention, and global attention. Each type is motivated by observations on previous models and focuses on one important aspect in modeling long code. The three types of attention are illustrated in Figure 1 and we will describe them individually.
|
| 120 |
+
|
| 121 |
+
# 4.1. Window Attention
|
| 122 |
+
|
| 123 |
+
Code completion largely relies on local context while only a few instances of long-distance dependencies are present. For example, in Figure 1 (bottom left), generating assignment operators and parentheses only depend on the current statement, whereas to generate variables such as $x$ and conv_block, the model needs to look at neighboring statements. Intuitively, we can exploit such locality to sparsify the attention to achieve better efficiency. We further verify this observation by counting the distribution of average attention scores between two tokens within different distances. As shown in Figure 2, a large portion of attention is concentrated within a narrow window. Notably, a fixed window of 256 covers more than $90\%$ of the attention weights. This sparsity enables us to apply a sliding window attention mechanism (Beltagy et al., 2020; Zaheer et al., 2020).
|
| 124 |
+
|
| 125 |
+

|
| 126 |
+
Figure 2. Distribution of average attention scores between two tokens within different distances in CodeGPT (Lu et al., 2021). The attention score is an average of 100 Python code examples across all Transformer layers.
|
| 127 |
+
|
| 128 |
+
Formally, given the linear projections $Q$ , $K$ , $V$ , the self-attention scores in Transformer are calculated as follows:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\operatorname {A t t e n t i o n} (Q, K, V) = \operatorname {s o f t m a x} \left(\frac {Q K ^ {T}}{\sqrt {d _ {k}}} + M\right) V \tag {1}
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where $M$ is a mask matrix (to be completed in Equation 5) to control the context a token can attend to when computing its contextual representation. If the $i$ -th token is allowed to attend to the $j$ -th token, then $M_{ij}$ is set to 0, otherwise $-\infty$ .
|
| 135 |
+
|
| 136 |
+
For window attention, the mask attention matrix $M^{window}$ is calculated as follows:
|
| 137 |
+
|
| 138 |
+
$$
|
| 139 |
+
M _ {i j} ^ {\text {w i n d o w}} = \left\{ \begin{array}{l l} 0 & \text {i f} i - j \leq w \\ - \infty & \text {o t h e r w i s e} \end{array} \right. \tag {2}
|
| 140 |
+
$$
|
| 141 |
+
|
| 142 |
+
where $w$ is the window size. This window attention pattern reduces the complexity of the self-attention mechanism by limiting the receptive field size of each token to a small window of size $w$ at each layer. The computation complexity of this pattern is $O(n \times w)$ , which scales linearly with input sequence length $n$ . After applying $N$ transformer layers of such sliding window attention, the receptive field size increases to $N \times w$ at the top layer. Since each token only attends to $w$ tokens to its left rather than the entire preceding sequence, the model can achieve faster inference speed.
|
| 143 |
+
|
| 144 |
+
# 4.2. Bridge Attention
|
| 145 |
+
|
| 146 |
+
Window attention is good at handling local dependencies and it also has a wide receptive field as discussed above. However, if a token needs to access tokens from a distance of $L$ tokens away, it would require $\lceil \frac{L}{w} \rceil$ hops through window attention. This makes it challenging to access information from distant context as the attention score between them will be greatly reduced due to accumulation through multiplication. Thus, we introduce a new type of special
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 3. Visualization of the attention matrix (partially shown for clarity) in CodeGPT (Lu et al., 2021). The attention matrix is averaged across all Transformer layers.
|
| 150 |
+
|
| 151 |
+
token, namely bridge tokens, to aggregate local information for global access. Bridge tokens can attend to a fixed length of tokens and be attended from all subsequent tokens. From the perspective of representation learning, a bridge token can be seen as a learned representation for the corresponding slice of code.
|
| 152 |
+
|
| 153 |
+
Specifically, we insert $m$ bridge tokens $S_{b}$ every $\left\lceil \frac{n}{m} \right\rceil$ tokens and use a separate set of projections, $Q_{b}, K_{b}, V_{b}$ to compute attention scores for the bridge attention. The bridge tokens do not involve next token prediction but they are used to aggregate information from the preceding $\left\lceil \frac{n}{m} \right\rceil$ tokens. The use of additional projections allows for the ability to model different types of attention. Finally, the mask matrix for bridge attention is calculated as follows:
|
| 154 |
+
|
| 155 |
+
$$
|
| 156 |
+
M _ {i j} ^ {\text {b r i d g e}} = \left\{\begin{array}{l l}0&\text {i f} j \in S _ {b} \text {a n d} i \geq j\\0&\text {i f} i \in S _ {b} \text {a n d} i - j \leq \left\lceil \frac {n}{m} \right\rceil\\- \infty&\text {o t h e r w i s e}\end{array}\right. \tag {3}
|
| 157 |
+
$$
|
| 158 |
+
|
| 159 |
+
The complexity of bridge attention is $O(m \times n) \approx O(n)$ where $m \ll n$ . Compared to stacked window attention, bridge attention allows each token to attend to any preceding token with at most 2 hops, which enables the model to effectively access long-range context.
|
| 160 |
+
|
| 161 |
+
# 4.3. Global Attention
|
| 162 |
+
|
| 163 |
+
Identifiers with the global scope, for example, package imports, global functions, classes and their member functions (i.e., methods), can be called from any location within a file. For long code, a local sliding window cannot capture such information that should be globally accessible. This is especially outstanding for package imports, which are usually located at the beginning of a file. For example, in Figure 1, without knowing the user has imported torch.nn.Functional as a new identifier F, the model cannot be sure whether to use F or the full
|
| 164 |
+
|
| 165 |
+
package name. $^4$ Also, to call the forward function of conv_block1 and conv_block2, the model needs access to the original definition of the class ConvBlock, which also falls outside the current sliding window. Directly accessing these tokens is similar to how human programmers quickly refer to definitions in the code. This global effect can also be observed in the visualization of the attention matrix in CodeGPT (Lu et al., 2021). As shown in Figure 3, some tokens seem to have a global impact while others only matter locally.
|
| 166 |
+
|
| 167 |
+
Therefore, in addition to bridge tokens, where the model automatically learns to aggregate globally useful information, we add another type of global token, namely memory tokens, to inject code heuristics to the attention. Specifically, we leverage the structure of code with tree-sitter to parse the code into an abstract syntax tree (AST). Then, we find all statements that include a package import, class or function definition and grant the line feeds (LF, $\backslash \mathfrak{n}$ ) of those statements global access. We denote the set of positions of these line feeds as $G$ , where $k = |G|$ . The mask matrix $M^{global}$ of global attention is calculated as follows:
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
M _ {i j} ^ {\text {g l o b a l}} = \left\{ \begin{array}{l l} 0 & \text {i f} j \in G \text {a n d} i \geq j \\ - \infty & \text {o t h e r w i s e} \end{array} \right. \tag {4}
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
The complexity of the global attention is $O(kn) \approx O(n)$ , as we have $k \ll n$ , where $n$ is the length of the sequence.
|
| 174 |
+
|
| 175 |
+
Unlike previous work (Clement et al., 2021) which extracts the most significant statements and encode them in a fixed-length context window, our global attention requires less memory and can reuse previously encoded hidden states.
|
| 176 |
+
|
| 177 |
+
Finally, considering all three types of attention together, $M$ in Equation 1 becomes:
|
| 178 |
+
|
| 179 |
+
$$
|
| 180 |
+
M = \max \left(M ^ {\text {w i n d o w}}, M ^ {\text {b r i d g e}}, M ^ {\text {g l o b a l}}\right) \tag {5}
|
| 181 |
+
$$
|
| 182 |
+
|
| 183 |
+
where max is the element-wise maximum function.
|
| 184 |
+
|
| 185 |
+
# 5. Experiments
|
| 186 |
+
|
| 187 |
+
# 5.1. Experimental Settings
|
| 188 |
+
|
| 189 |
+
Baselines We evaluate LongCoder against several publicly available pre-trained code generation models, including GPT-2 (Radford et al., 2019), CodeGPT (Lu et al., 2021), and UniXcoder (Guo et al., 2022). GPT-2 is pre-trained on a text corpus and CodeGPT is pre-trained on the CodeSearchNet dataset (Husain et al., 2019) using next token prediction as the objective. UniXcoder based on UniLM (Dong et al., 2019) is pre-trained on a cross-modal dataset that includes code, text, and abstract syntax trees. Additionally, we also compare LongCoder with sparse Transformer models, such
|
| 190 |
+
|
| 191 |
+
Table 2. Experimental results on the Long Code Completion (LCC) dataset.
|
| 192 |
+
|
| 193 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">#Param.</td><td rowspan="2">Memory</td><td rowspan="2">Runtime</td><td colspan="2">Python</td><td colspan="2">Java</td><td colspan="2">C#</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>OpenAI Codex</td><td>12B</td><td>-</td><td>-</td><td>39.65</td><td>68.97</td><td>43.15</td><td>72.05</td><td>53.89</td><td>77.93</td></tr><tr><td>Transformer</td><td>124M</td><td>191M</td><td>750ms</td><td>10.64</td><td>43.64</td><td>15.32</td><td>47.52</td><td>19.16</td><td>48.87</td></tr><tr><td>GPT-2</td><td>124M</td><td>191M</td><td>750ms</td><td>11.20</td><td>42.62</td><td>17.09</td><td>47.18</td><td>20.27</td><td>48.27</td></tr><tr><td>CodeGPT</td><td>124M</td><td>191M</td><td>750ms</td><td>12.24</td><td>43.81</td><td>19.20</td><td>49.50</td><td>22.58</td><td>51.03</td></tr><tr><td>UniXcoder</td><td>126M</td><td>191M</td><td>750ms</td><td>16.55</td><td>50.22</td><td>23.93</td><td>55.38</td><td>27.97</td><td>57.29</td></tr><tr><td>LongFormer</td><td>150M</td><td>381M</td><td>781ms</td><td>16.79</td><td>51.07</td><td>24.80</td><td>56.03</td><td>29.75</td><td>58.23</td></tr><tr><td>BigBird</td><td>128M</td><td>205M</td><td>804ms</td><td>17.03</td><td>51.14</td><td>25.19</td><td>56.91</td><td>30.27</td><td>58.66</td></tr><tr><td>LongCoder</td><td>150M</td><td>211M</td><td>812ms</td><td>17.88</td><td>55.07</td><td>26.42</td><td>61.21</td><td>31.34</td><td>64.37</td></tr><tr><td>- w/o pretrain</td><td>150M</td><td>211M</td><td>812ms</td><td>17.61</td><td>54.82</td><td>25.96</td><td>60.81</td><td>31.22</td><td>64.18</td></tr></table>
|
| 194 |
+
|
| 195 |
+
Table 3. Data statistics about the context length of CodeXGLUE test dataset. $25\% /50\% /75\%$ refer to the first/second/third quartile.
|
| 196 |
+
|
| 197 |
+
<table><tr><td>Language</td><td>Average</td><td>25%</td><td>50%</td><td>75%</td></tr><tr><td>Python</td><td>477.8</td><td>83</td><td>197</td><td>502</td></tr><tr><td>Java</td><td>365.0</td><td>74</td><td>171</td><td>397</td></tr></table>
|
| 198 |
+
|
| 199 |
+
as LongFormer (Beltagy et al., 2020) and BigBird (Zaheer et al., 2020). LongFormer uses a dilated sliding window to model long sequences in the generation task, while BigBird has an attention pattern that includes random, window, and global attention. In addition to these comparable baselines, we also report the performance of OpenAI Codex on LCC for reference. Note that Codex is $100 \times$ larger than other models and is likely to have seen the test set of LCC in its pretraining thus is not directly comparable.
|
| 200 |
+
|
| 201 |
+
**Benchmarks** We evaluate the performance of LongCoder and the baselines on two benchmarks: LCC (introduced in Section 3), and the code completion task benchmark in CodeXGLUE (Lu et al., 2021). CodeXGLUE provides PY150 (Raychev et al., 2016) and JavaCorpus (Allamanis & Sutton, 2013) datasets in Python and Java for line-level code completion. The statistics for the context length of the CodeXGLUE test datasets are listed in Table 3. We can see that the context length of the input sequence is 5 times shorter than LCC, and only a small portion of the samples require modeling for long code sequences. The objective of evaluating the performance of sparse models on the CodeXGLUE dataset is to examine their effectiveness in scenarios where the code context is relatively short.
|
| 202 |
+
|
| 203 |
+
Moreover, longer context can benefit applications including cross-file code completion (Liu et al., 2023). We test the performance of LongCoder on the cross-file-random (XF-
|
| 204 |
+
|
| 205 |
+
Table 4. Results on CodeXGLUE code completion benchmark.
|
| 206 |
+
|
| 207 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">PY150</td><td colspan="2">JavaCorpus</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>Transformer</td><td>38.51</td><td>69.01</td><td>17.00</td><td>50.23</td></tr><tr><td>GPT-2</td><td>41.73</td><td>70.60</td><td>27.50</td><td>60.36</td></tr><tr><td>CodeGPT</td><td>42.37</td><td>71.59</td><td>30.60</td><td>63.45</td></tr><tr><td>UniXcoder</td><td>43.12</td><td>72.00</td><td>32.90</td><td>65.78</td></tr><tr><td>LongCoder</td><td>43.77</td><td>73.37</td><td>33.13</td><td>67.32</td></tr></table>
|
| 208 |
+
|
| 209 |
+
Table 5. Cross-file code completion results on RepoBench XF-R (Liu et al., 2023).
|
| 210 |
+
|
| 211 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">Python</td><td colspan="2">Java</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>Transformer</td><td>7.0</td><td>38.3</td><td>5.8</td><td>34.4</td></tr><tr><td>GPT-2</td><td>15.5</td><td>48.2</td><td>11.6</td><td>41.4</td></tr><tr><td>CodeGPT</td><td>16.6</td><td>49.1</td><td>13.3</td><td>44.2</td></tr><tr><td>UniXcoder</td><td>18.0</td><td>53.4</td><td>16.5</td><td>50.0</td></tr><tr><td>LongCoder</td><td>21.4</td><td>59.7</td><td>19.7</td><td>60.1</td></tr></table>
|
| 212 |
+
|
| 213 |
+
R) setting of RepoBench (Liu et al., 2023). The task is to predict the next line of code based on a given in-file context, consisting of import statements and preceding lines before the target line, as well as a cross-file context, comprising snippets from other files in the code repository, parsed by import statements.
|
| 214 |
+
|
| 215 |
+
Evaluation Metrics We report the number of parameters, inference memory consumption, runtime, Exact Match (EM) and Edit Similarity (Edit Sim) of the baselines. The inference memory consumption and runtime per example are calculated using a beam search with beam size of 5 and maximum generation length of 64 on a single V100 GPU.
|
| 216 |
+
|
| 217 |
+
Table 6. Ablation study on LongCoder without pre-training.
|
| 218 |
+
|
| 219 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">Python</td><td colspan="2">Java</td><td colspan="2">C#</td></tr><tr><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td><td>EM</td><td>Edit Sim</td></tr><tr><td>LongCoder</td><td>17.61</td><td>54.82</td><td>25.96</td><td>60.81</td><td>31.22</td><td>64.18</td></tr><tr><td>w/o memory tokens</td><td>16.80</td><td>53.90</td><td>24.87</td><td>60.35</td><td>30.16</td><td>63.61</td></tr><tr><td>w/o bridge tokens</td><td>17.54</td><td>51.92</td><td>25.88</td><td>57.48</td><td>30.80</td><td>59.09</td></tr><tr><td>w/o out-of-window context</td><td>16.66</td><td>50.63</td><td>24.17</td><td>55.97</td><td>28.81</td><td>57.79</td></tr><tr><td>w/ equidistant memory tokens</td><td>17.16</td><td>54.25</td><td>24.96</td><td>60.42</td><td>30.31</td><td>63.65</td></tr></table>
|
| 220 |
+
|
| 221 |
+
# 5.2. Training Details
|
| 222 |
+
|
| 223 |
+
We set the maximum length of code context to 512 and 4096 for non-sparse and sparse models, respectively. In order to make a fair comparison between sparse models and non-sparse models, we set the window size $w$ to 512 so that both types of models maintain the same local context length during inference. Note that this setting is different from the original setting of RepoBench (Liu et al., 2023), thus the results are not directly comparable to those reported in Liu et al. (2023). For sparse models, we use the parameters of UniXcoder released by Guo et al. (2022) to initialize the models. For LongCoder, we set the maximum size of bridge tokens $n$ and global tokens $k$ as 16 and 64, respectively. To ensure fair comparison with other models, we pre-train LongCoder on the CodeSearchNet dataset using the same next token prediction objective and pre-training setting as baselines (Lu et al., 2021; Guo et al., 2022). During finetuning, we use the Adam optimizer with a batch size of 16 and a learning rate of 2e-4. We fine-tune the model for 10 epochs and perform early stopping on the development set. Note that although the maximum context sequence length is 4096, during inference, we only retain a cache of at most 592 tokens for past key and value hidden states to maintain efficiency in terms of computational resources.
|
| 224 |
+
|
| 225 |
+
# 5.3. Experimental Results
|
| 226 |
+
|
| 227 |
+
Table 2 illustrates the comparison results of LongCoder with other models on the LCC dataset. The results reveal that the sparse models (i.e., the last two groups) have superior performance compared to the non-sparse models (i.e., the second group) on both EM and Edit Sim metrics, and they also maintain a similar inference speed. LongFormer is initialized using the parameters of UniXcoder, with the sole difference being the use of a sliding window attention mechanism. This mechanism allows the model to maintain a consistent inference speed while having a larger receptive field, resulting in improved performance. This demonstrates the effectiveness of the sliding window attention mechanism in code completion tasks. Compared to other sparse models, LongCoder achieves an improvement of $0.8\% -1.3\%$ in Exact Match score and $4.0\% -6.0\%$ in Edit Similarity,
|
| 228 |
+
|
| 229 |
+
which reveal the effectiveness of our proposed bridge and global attention mechanisms. Table 4 shows the result of LongCoder on CodeXGLUE code completion benchmarks. It can be observed that LongCoder achieves state-of-the-art performance, which illustrates its effectiveness in scenarios where the code context is short. As shown in Table 5, LongCoder has an even larger advantage compared to UniXcoder, indicating its potential in more complex scenarios.
|
| 230 |
+
|
| 231 |
+
# 5.4. Ablation Study
|
| 232 |
+
|
| 233 |
+
To better understand the impact of different components on overall performance, we conduct an ablation study on LongCoder, and the results are shown in Table 6. We can see that the average score of Exact Match drops by approximately $1\%$ when memory tokens are removed (w/o memory tokens), which demonstrates the importance of these tokens. On the other hand, when bridge tokens are removed (w/o bridge tokens), the average score drops by about $3\%$ in terms of Edit Similarity. This is likely because bridge tokens assist LongCoder in understanding the semantics of the code context and generating more accurate patterns, while memory tokens enable it to access concrete identifiers with global scope, thus improving accuracy on libraries, classes, and functions invoked. Additionally, we observe that selecting one as a memory token every 64 tokens (equidistant memory tokens) results in worse performance than LongCoder, indicating that the advantage of the memory tokens is not solely due to increased context length. We also evaluate the performance of LongCoder by only using code context within the window size during inference to verify if the improvement is solely attributed to the use of long code context or whether other factors such as fine-tuning settings also contribute. By only keeping the last 512 tokens as code context (w/o out-of-window context), we can see that the performance is nearly the same as UniXcoder in Table 2, which shows the importance of modeling long code context.
|
| 234 |
+
|
| 235 |
+
# 5.5. Case Study
|
| 236 |
+
|
| 237 |
+
We also conduct a case study to demonstrate the effectiveness of LongCoder, as shown in Figure 4. We provide two examples in the Python and Java programming languages
|
| 238 |
+
|
| 239 |
+

|
| 240 |
+
Figure 4. Two LCC examples of Python (top) and Java (bottom) code and predictions of different models. Codex-2048 refers to the original Codex model with the maximum context length of 2,048 while Codex-512 is the same model with a maximum context length set to 512. Key information is highlighted with arrows.
|
| 241 |
+
|
| 242 |
+
and output predictions from different models. (1) From the Python example, we can see that all models infer the correct intended outcome, which is to assign the current timestamp to the timestamp variable. However, only LongCoder and Codex-2048 produce the correct result. This is primarily because these two models are able to refer to the import statement at the beginning of the file, which imports the timestamp_now function. Codex-2048 uses a long context window to cover the entire file, but this approach increases memory consumption and decreases inference speed as discussed above. Additionally, as the failure of Codex-512 shows, even a large powerful model can struggle to identify the correct function from other candidates if the required information exceeds the window size. In contrast, LongCoder utilizes a more efficient memory attention mechanism, storing information based on the scope of different statements. This method is more effective, allowing access to statements from the global scope while remaining efficient. (2) In the Java example, the function to be completed aims to convert a HashMap variable into an XML string. The function sequentially calls the getters functions of the GaitReEducation class and has already completed calling the getGaitAspect function. From the out-window context, it is clear that the next call should be made to the getDetails function. In order to correctly complete the
|
| 243 |
+
|
| 244 |
+
function, it is essential to keep track of all function definitions. As seen in the output results, only LongCoder and Codex-2048, which both make use of long code context, can predict the correct results. Additionally, it can be observed that Codex-512, due to its limited context, can only make a guess for a member function. We can see that LongCoder leverages the structure of the code to analyze the scope of statements and stores those that have potential long-term dependencies. This not only improves performance but also achieves comparable efficiency in terms of computational resources during inference.
|
| 245 |
+
|
| 246 |
+
# 6. Discussion
|
| 247 |
+
|
| 248 |
+
Limitations One limitation of LongCoder is its small size. Due to resource constraints, we are not able to train a large model that is comparable to Codex. Besides, to compare fairly with other baselines, we only pre-train LongCoder on a small-scale corpus (CodeSearchNet). It would be interesting to see how the idea of sparse attention scales with more data.
|
| 249 |
+
|
| 250 |
+
Another limitation of our work is the evaluation datasets. Many existing code datasets and LCC share the same source of data from GitHub. The same data can appear in the
|
| 251 |
+
|
| 252 |
+
pretraining data, making the evaluation less reliable. Additionally, models with larger-scale pretraining are even more likely to have seen the test data before. For example, OpenAI Codex is trained on all GitHub repositories, that undoubtedly, include most (if not all) test data in PY150, JavaCorpus, and LCC. As the code completion models have seen wider adoption in software development, future evaluation can be "self-fulfilling". For example, GitHub CoPilot<sup>5</sup> is a popular commercial code completion tool powered by OpenAI Codex. A lot of code generated by Codex may have already been submitted to GitHub. This could give widely-used models like Codex an advantage if it is evaluated on a dataset with a data source of the latest GitHub repositories, as we could be evaluating Codex on its own input. To address these problems, we need the community to contribute new, clean, and high-quality datasets with code from private projects to support future research.
|
| 253 |
+
|
| 254 |
+
Future Work LongCoder opens up new research opportunities in code generation not only within a large file, but also across multiple files. For example, we could allow the model to look at other files in the project for even more accurate code completion. It could enable new applications including automatically extracting package requirements, generating build files, refactoring the project, etc.
|
| 255 |
+
|
| 256 |
+
# ACKNOWLEDGMENTS
|
| 257 |
+
|
| 258 |
+
Jian Yin is the corresponding author. Daya Guo and Jian Yin are supported by the National Natural Science Foundation of China (U1911203, U2001211, U22B2060), Guangdong Basic and Applied Basic Research Foundation (2019B1515130001), Key-Area Research and Development Program of Guangdong Province (2020B0101100001). We would like to thank the anonymous reviewers and the meta-reviewer for their insightful comments.
|
| 259 |
+
|
| 260 |
+
# References
|
| 261 |
+
|
| 262 |
+
Allamanis, M. The adverse effects of code duplication in machine learning models of code. In Onward!, pp. 143-153. ACM, 2019.
|
| 263 |
+
Allamanis, M. and Sutton, C. Mining source code repositories at massive scale using language modeling. In 2013 10th Working Conference on Mining Software Repositories (MSR), pp. 207-216. IEEE, 2013.
|
| 264 |
+
Allamanis, M. and Sutton, C. Mining idioms from source code. In SIGSOFT FSE, pp. 472-483. ACM, 2014.
|
| 265 |
+
Beltagy, I., Peters, M. E., and Cohan, A. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
|
| 266 |
+
|
| 267 |
+
Bielik, P., Raychev, V., and Vechev, M. T. PHOG: probabilistic model for code. In ICML, volume 48 of JMLR Workshop and Conference Proceedings, pp. 2933-2942. JMLR.org, 2016.
|
| 268 |
+
Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., and Amodei, D. Language models are few-shot learners. In NeurIPS, 2020.
|
| 269 |
+
Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H. P. d. O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
|
| 270 |
+
Child, R., Gray, S., Radford, A., and Sutskever, I. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
|
| 271 |
+
Choromanski, K. M., Likhosherstov, V., Dohan, D., Song, X., Gane, A., Sarlos, T., Hawkins, P., Davis, J. Q., Mohiuddin, A., Kaiser, L., Belanger, D. B., Colwell, L. J., and Weller, A. Rethinking attention with performers. In ICLR. OpenReview.net, 2021.
|
| 272 |
+
Clement, C. B., Lu, S., Liu, X., Tufano, M., Drain, D., Duan, N., Sundaresan, N., and Svyatkovskiy, A. Long-range modeling of source code files with ewash: Extended window access by syntax hierarchy. In EMNLP, pp. 4713-4722. Association for Computational Linguistics, 2021.
|
| 273 |
+
Devlin, J., Chang, M., Lee, K., and Toutanova, K. BERT: pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT*, pp. 4171-4186. Association for Computational Linguistics, 2019.
|
| 274 |
+
Dong, L., Yang, N., Wang, W., Wei, F., Liu, X., Wang, Y., Gao, J., Zhou, M., and Hon, H. Unified language model pre-training for natural language understanding and generation. In NeurIPS, pp. 13042-13054, 2019.
|
| 275 |
+
Fried, D., Aghajanyan, A., Lin, J., Wang, S., Wallace, E., Shi, F., Zhong, R., Yih, W.-t., Zettlemoyer, L., and Lewis, M. Incoder: A generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999, 2022.
|
| 276 |
+
Guo, D., Lu, S., Duan, N., Wang, Y., Zhou, M., and Yin, J. Unixcoder: Unified cross-modal pre-training for code representation. In ACL, pp. 7212-7225. Association for Computational Linguistics, 2022.
|
| 277 |
+
Hellendoorn, V. J. and Devanbu, P. T. Are deep neural networks the best choice for modeling source code? In ESEC/SIGSOFT FSE, pp. 763-773. ACM, 2017.
|
| 278 |
+
|
| 279 |
+
Hindle, A., Barr, E. T., Gabel, M., Su, Z., and Devanbu, P. T. On the naturalness of software. Commun. ACM, 59(5): 122-131, 2016.
|
| 280 |
+
Husain, H., Wu, H.-H., Gazit, T., Allamanis, M., and Brockschmidt, M. Codesearchnet challenge: Evaluating the state of semantic code search. arXiv preprint arXiv:1909.09436, 2019.
|
| 281 |
+
Katharopoulos, A., Vyas, A., Pappas, N., and Fleuret, F. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, volume 119 of Proceedings of Machine Learning Research, pp. 5156-5165. PMLR, 2020.
|
| 282 |
+
Kitaev, N., Kaiser, L., and Levskaya, A. Reformer: The efficient transformer. In *ICLR*. OpenReview.net, 2020.
|
| 283 |
+
Li, Y., Choi, D., Chung, J., Kushman, N., Schrittwieser, J., Leblond, R., Eccles, T., Keeling, J., Gimeno, F., Dal Lago, A., et al. Competition-level code generation with alphabet. Science, 378(6624):1092-1097, 2022.
|
| 284 |
+
Liu, F., Li, G., Zhao, Y., and Jin, Z. Multi-task learning based pre-trained language model for code completion. In ASE, pp. 473-485. IEEE, 2020.
|
| 285 |
+
Liu, T., Xu, C., and McAuley, J. Repobench: Benchmarking repository-level code auto-completion systems. arXiv preprint, 2023.
|
| 286 |
+
Lu, S., Guo, D., Ren, S., Huang, J., Svyatkovskiy, A., Blanco, A., Clement, C. B., Drain, D., Jiang, D., Tang, D., Li, G., Zhou, L., Shou, L., Zhou, L., Tufano, M., Gong, M., Zhou, M., Duan, N., Sundaresan, N., Deng, S. K., Fu, S., and Liu, S. Codexglue: A machine learning benchmark dataset for code understanding and generation. In NeurIPS Datasets and Benchmarks, 2021.
|
| 287 |
+
Nijkamp, E., Pang, B., Hayashi, H., Tu, L., Wang, H., Zhou, Y., Savarese, S., and Xiong, C. A conversational paradigm for program synthesis. arXiv preprint arXiv:2203.13474, 2022.
|
| 288 |
+
Qin, Z., Sun, W., Deng, H., Li, D., Wei, Y., Lv, B., Yan, J., Kong, L., and Zhong, Y. cosformer: Rethinking softmax in attention. In ICLR. OpenReview.net, 2022.
|
| 289 |
+
Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
|
| 290 |
+
Raychev, V., Bielik, P., and Vechev, M. T. Probabilistic model for code with decision trees. In OOPSLA, pp. 731-747. ACM, 2016.
|
| 291 |
+
Svyatkovskiy, A., Deng, S. K., Fu, S., and Sundaresan, N.
|
| 292 |
+
Intellicode compose: code generation using transformer. In ESEC/SIGSOFT FSE, pp. 1433-1443. ACM, 2020.
|
| 293 |
+
|
| 294 |
+
Tay, Y., Dehghani, M., Bahri, D., and Metzler, D. Efficient transformers: A survey. ACM Computing Surveys, 55(6): 1-28, 2022.
|
| 295 |
+
Tu, Z., Su, Z., and Devanbu, P. T. On the localness of software. In SIGSOFT FSE, pp. 269-280. ACM, 2014.
|
| 296 |
+
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In NIPS, pp. 5998-6008, 2017.
|
| 297 |
+
Wang, S., Li, B. Z., Khabsa, M., Fang, H., and Ma, H. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
|
| 298 |
+
Xu, F. F., Alon, U., Neubig, G., and Hellendoorn, V. J. A systematic evaluation of large language models of code. In MAPS@PLDI, pp. 1-10. ACM, 2022.
|
| 299 |
+
Zaheer, M., Guruganesh, G., Dubey, K. A., Ainslie, J., Alberti, C., Ontañón, S., Pham, P., Ravula, A., Wang, Q., Yang, L., and Ahmed, A. Big bird: Transformers for longer sequences. In NeurIPS, 2020.
|
2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5f8d001c55e516bcb54548f3d1fc605774ed59e98b52227f3afaf0d4520eaa8e
|
| 3 |
+
size 480451
|
2023/LongCoder_ A Long-Range Pre-trained Language Model for Code Completion/layout.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
2023/Lookahead When It Matters_ Adaptive Non-causal Transformers for Streaming Neural Transducers/e256c32f-c091-4c4a-80dd-0f1c5fd51afb_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|