Add Batch b7a96271-adee-42bf-9150-61d281b14bc7 data
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+64
- 2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/795a4722-1356-43bf-9bc5-73f2d6c9bfc9_content_list.jsonAdded+1716
- 2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/795a4722-1356-43bf-9bc5-73f2d6c9bfc9_model.jsonAdded
- 2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/795a4722-1356-43bf-9bc5-73f2d6c9bfc9_origin.pdfAdded+3
- 2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/full.mdAdded+300
- 2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/images.zipAdded+3
- 2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/layout.jsonAdded
- 2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/e8330e7b-b339-42f8-8535-2e9a5467aacf_content_list.jsonAdded
- 2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/e8330e7b-b339-42f8-8535-2e9a5467aacf_model.jsonAdded
- 2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/e8330e7b-b339-42f8-8535-2e9a5467aacf_origin.pdfAdded+3
- 2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/full.mdAdded+390
- 2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/images.zipAdded+3
- 2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/layout.jsonAdded
- 2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/0c7170d2-2e2c-48e4-871f-85aa7e222171_content_list.jsonAdded
- 2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/0c7170d2-2e2c-48e4-871f-85aa7e222171_model.jsonAdded
- 2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/0c7170d2-2e2c-48e4-871f-85aa7e222171_origin.pdfAdded+3
- 2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/full.mdAdded+452
- 2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/images.zipAdded+3
- 2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/layout.jsonAdded
- 2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/231c0ef8-547b-4db2-9bfd-58577e7da066_content_list.jsonAdded
- 2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/231c0ef8-547b-4db2-9bfd-58577e7da066_model.jsonAdded
- 2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/231c0ef8-547b-4db2-9bfd-58577e7da066_origin.pdfAdded+3
- 2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/full.mdAdded+573
- 2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/images.zipAdded+3
- 2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/layout.jsonAdded
- 2024/Making LLaMA SEE and Draw with SEED Tokenizer/a3c50e33-f06d-4644-9a30-93aaa31f674c_content_list.jsonAdded
- 2024/Making LLaMA SEE and Draw with SEED Tokenizer/a3c50e33-f06d-4644-9a30-93aaa31f674c_model.jsonAdded
- 2024/Making LLaMA SEE and Draw with SEED Tokenizer/a3c50e33-f06d-4644-9a30-93aaa31f674c_origin.pdfAdded+3
- 2024/Making LLaMA SEE and Draw with SEED Tokenizer/full.mdAdded+547
- 2024/Making LLaMA SEE and Draw with SEED Tokenizer/images.zipAdded+3
- 2024/Making LLaMA SEE and Draw with SEED Tokenizer/layout.jsonAdded
- 2024/Making RL with Preference-based Feedback Efficient via Randomization/d6b15260-3f18-4f65-9374-0b587e1b2de3_content_list.jsonAdded
- 2024/Making RL with Preference-based Feedback Efficient via Randomization/d6b15260-3f18-4f65-9374-0b587e1b2de3_model.jsonAdded
- 2024/Making RL with Preference-based Feedback Efficient via Randomization/d6b15260-3f18-4f65-9374-0b587e1b2de3_origin.pdfAdded+3
- 2024/Making RL with Preference-based Feedback Efficient via Randomization/full.mdAdded
- 2024/Making RL with Preference-based Feedback Efficient via Randomization/images.zipAdded+3
- 2024/Making RL with Preference-based Feedback Efficient via Randomization/layout.jsonAdded
- 2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/baf58e31-08ad-497e-aefd-f3dc751cd413_content_list.jsonAdded
- 2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/baf58e31-08ad-497e-aefd-f3dc751cd413_model.jsonAdded
- 2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/baf58e31-08ad-497e-aefd-f3dc751cd413_origin.pdfAdded+3
- 2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/full.mdAdded+350
- 2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/images.zipAdded+3
- 2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/layout.jsonAdded
- 2024/Manifold Diffusion Fields/c2335761-5480-4edc-9cf2-4abfdf1b9a8d_content_list.jsonAdded
- 2024/Manifold Diffusion Fields/c2335761-5480-4edc-9cf2-4abfdf1b9a8d_model.jsonAdded
- 2024/Manifold Diffusion Fields/c2335761-5480-4edc-9cf2-4abfdf1b9a8d_origin.pdfAdded+3
- 2024/Manifold Diffusion Fields/full.mdAdded+508
- 2024/Manifold Diffusion Fields/images.zipAdded+3
- 2024/Manifold Diffusion Fields/layout.jsonAdded
- 2024/Manifold Preserving Guided Diffusion/005afbd2-1de9-4a75-990f-ceac39c2e99c_content_list.jsonAdded
4838 unmodified lines4839484048414838 unmodified lines2024/MVSFormer++_[[:space:]]Revealing[[:space:]]the[[:space:]]Devil[[:space:]]in[[:space:]]Transformer's[[:space:]]Details[[:space:]]for[[:space:]]Multi-View[[:space:]]Stereo/ae03b8da-052c-4a1f-9c1b-4fc40bb29631_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MaGIC_[[:space:]]Multi-modality[[:space:]]Guided[[:space:]]Image[[:space:]]Completion/215d3d39-d599-4cb2-b5de-f2cbcd96aaaa_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Machine[[:space:]]Unlearning[[:space:]]for[[:space:]]Image-to-Image[[:space:]]Generative[[:space:]]Models/c8838d00-a23f-47a3-a72a-6b01844e2516_origin.pdf filter=lfs diff=lfs merge=lfs -text4838 unmodified lines48394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054838 unmodified lines2024/MVSFormer++_[[:space:]]Revealing[[:space:]]the[[:space:]]Devil[[:space:]]in[[:space:]]Transformer's[[:space:]]Details[[:space:]]for[[:space:]]Multi-View[[:space:]]Stereo/ae03b8da-052c-4a1f-9c1b-4fc40bb29631_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MaGIC_[[:space:]]Multi-modality[[:space:]]Guided[[:space:]]Image[[:space:]]Completion/215d3d39-d599-4cb2-b5de-f2cbcd96aaaa_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Machine[[:space:]]Unlearning[[:space:]]for[[:space:]]Image-to-Image[[:space:]]Generative[[:space:]]Models/c8838d00-a23f-47a3-a72a-6b01844e2516_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Magic123_[[:space:]]One[[:space:]]Image[[:space:]]to[[:space:]]High-Quality[[:space:]]3D[[:space:]]Object[[:space:]]Generation[[:space:]]Using[[:space:]]Both[[:space:]]2D[[:space:]]and[[:space:]]3D[[:space:]]Diffusion[[:space:]]Priors/795a4722-1356-43bf-9bc5-73f2d6c9bfc9_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MagicDrive_[[:space:]]Street[[:space:]]View[[:space:]]Generation[[:space:]]with[[:space:]]Diverse[[:space:]]3D[[:space:]]Geometry[[:space:]]Control/e8330e7b-b339-42f8-8535-2e9a5467aacf_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Magnitude[[:space:]]Invariant[[:space:]]Parametrizations[[:space:]]Improve[[:space:]]Hypernetwork[[:space:]]Learning/0c7170d2-2e2c-48e4-871f-85aa7e222171_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Magnushammer_[[:space:]]A[[:space:]]Transformer-Based[[:space:]]Approach[[:space:]]to[[:space:]]Premise[[:space:]]Selection/231c0ef8-547b-4db2-9bfd-58577e7da066_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Making[[:space:]]LLaMA[[:space:]]SEE[[:space:]]and[[:space:]]Draw[[:space:]]with[[:space:]]SEED[[:space:]]Tokenizer/a3c50e33-f06d-4644-9a30-93aaa31f674c_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Making[[:space:]]RL[[:space:]]with[[:space:]]Preference-based[[:space:]]Feedback[[:space:]]Efficient[[:space:]]via[[:space:]]Randomization/d6b15260-3f18-4f65-9374-0b587e1b2de3_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Making[[:space:]]Retrieval-Augmented[[:space:]]Language[[:space:]]Models[[:space:]]Robust[[:space:]]to[[:space:]]Irrelevant[[:space:]]Context/baf58e31-08ad-497e-aefd-f3dc751cd413_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Manifold[[:space:]]Diffusion[[:space:]]Fields/c2335761-5480-4edc-9cf2-4abfdf1b9a8d_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Manifold[[:space:]]Preserving[[:space:]]Guided[[:space:]]Diffusion/005afbd2-1de9-4a75-990f-ceac39c2e99c_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Manipulating[[:space:]]dropout[[:space:]]reveals[[:space:]]an[[:space:]]optimal[[:space:]]balance[[:space:]]of[[:space:]]efficiency[[:space:]]and[[:space:]]robustness[[:space:]]in[[:space:]]biological[[:space:]]and[[:space:]]machine[[:space:]]visual[[:space:]]systems/70c3f8c8-fd52-4b5f-ba16-55432de3e3fe_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Masked[[:space:]]Audio[[:space:]]Generation[[:space:]]using[[:space:]]a[[:space:]]Single[[:space:]]Non-Autoregressive[[:space:]]Transformer/0c28ef72-5950-40cf-91fe-f7c41d736b97_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Masked[[:space:]]Autoencoders[[:space:]]with[[:space:]]Multi-Window[[:space:]]Local-Global[[:space:]]Attention[[:space:]]Are[[:space:]]Better[[:space:]]Audio[[:space:]]Learners/1448b609-d727-41ec-8ae2-6a1c0a026ef2_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Masked[[:space:]]Completion[[:space:]]via[[:space:]]Structured[[:space:]]Diffusion[[:space:]]with[[:space:]]White-Box[[:space:]]Transformers/96096b4f-b6e1-473a-ad0b-fd9f2b5a3352_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Masked[[:space:]]Distillation[[:space:]]Advances[[:space:]]Self-Supervised[[:space:]]Transformer[[:space:]]Architecture[[:space:]]Search/4cd996fd-c0a0-4d85-b4b3-5836b14f4eac_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Masked[[:space:]]Structural[[:space:]]Growth[[:space:]]for[[:space:]]2x[[:space:]]Faster[[:space:]]Language[[:space:]]Model[[:space:]]Pre-training/9b5aea0e-1d23-4e99-b094-6fcfbe7962db_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Massive[[:space:]]Editing[[:space:]]for[[:space:]]Large[[:space:]]Language[[:space:]]Models[[:space:]]via[[:space:]]Meta[[:space:]]Learning/facbd551-d962-4308-88a4-ee6e88c99afb_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mastering[[:space:]]Symbolic[[:space:]]Operations_[[:space:]]Augmenting[[:space:]]Language[[:space:]]Models[[:space:]]with[[:space:]]Compiled[[:space:]]Neural[[:space:]]Networks/0cd5256f-36b3-468c-928f-1f73aabddcd9_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Matcher_[[:space:]]Segment[[:space:]]Anything[[:space:]]with[[:space:]]One[[:space:]]Shot[[:space:]]Using[[:space:]]All-Purpose[[:space:]]Feature[[:space:]]Matching/79f7ef16-eaad-4191-9897-9308876aeaca_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MathCoder_[[:space:]]Seamless[[:space:]]Code[[:space:]]Integration[[:space:]]in[[:space:]]LLMs[[:space:]]for[[:space:]]Enhanced[[:space:]]Mathematical[[:space:]]Reasoning/11f449a8-dbae-4c08-8fef-c4de5e369746_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mathematical[[:space:]]Justification[[:space:]]of[[:space:]]Hard[[:space:]]Negative[[:space:]]Mining[[:space:]]via[[:space:]]Isometric[[:space:]]Approximation[[:space:]]Theorem/f128c987-c8a9-4c76-9e43-344d16b7b981_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Matrix[[:space:]]Manifold[[:space:]]Neural[[:space:]]Networks++/d38051c4-0190-4d9d-b644-b99b5d8597a4_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Matryoshka[[:space:]]Diffusion[[:space:]]Models/8249ba9f-0e97-464f-abcb-a217f34bedb8_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Maximum[[:space:]]Entropy[[:space:]]Model[[:space:]]Correction[[:space:]]in[[:space:]]Reinforcement[[:space:]]Learning/031509a9-51b5-4eb7-b79d-bb1326a40425_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Maximum[[:space:]]Likelihood[[:space:]]Estimation[[:space:]]is[[:space:]]All[[:space:]]You[[:space:]]Need[[:space:]]for[[:space:]]Well-Specified[[:space:]]Covariate[[:space:]]Shift/6d047fea-c271-4bd4-9e7c-7e66da947e2a_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mean[[:space:]]Field[[:space:]]Theory[[:space:]]in[[:space:]]Deep[[:space:]]Metric[[:space:]]Learning/5ff8f208-5bdf-4351-b8a3-b30bafed3ff6_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Meaning[[:space:]]Representations[[:space:]]from[[:space:]]Trajectories[[:space:]]in[[:space:]]Autoregressive[[:space:]]Models/895e32d0-681e-4176-bb34-06b642f2103d_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Measuring[[:space:]]Vision-Language[[:space:]]STEM[[:space:]]Skills[[:space:]]of[[:space:]]Neural[[:space:]]Models/82d355b6-dac2-41b1-9c6e-68481d0a8b9d_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mechanistically[[:space:]]analyzing[[:space:]]the[[:space:]]effects[[:space:]]of[[:space:]]fine-tuning[[:space:]]on[[:space:]]procedurally[[:space:]]defined[[:space:]]tasks/413aee3d-7c15-4de4-8dd4-e9a40b93a7f1_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mediator[[:space:]]Interpretation[[:space:]]and[[:space:]]Faster[[:space:]]Learning[[:space:]]Algorithms[[:space:]]for[[:space:]]Linear[[:space:]]Correlated[[:space:]]Equilibria[[:space:]]in[[:space:]]General[[:space:]]Sequential[[:space:]]Games/46984955-6230-45a6-99c5-057e5cfdbe6a_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mega-TTS[[:space:]]2_[[:space:]]Boosting[[:space:]]Prompting[[:space:]]Mechanisms[[:space:]]for[[:space:]]Zero-Shot[[:space:]]Speech[[:space:]]Synthesis/8e0157ba-43e7-4e94-92e0-bd3f87253b27_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Memorization[[:space:]]in[[:space:]]Self-Supervised[[:space:]]Learning[[:space:]]Improves[[:space:]]Downstream[[:space:]]Generalization/47078a4c-e1ea-427b-b9c1-a8a9f214a288_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Memory-Assisted[[:space:]]Sub-Prototype[[:space:]]Mining[[:space:]]for[[:space:]]Universal[[:space:]]Domain[[:space:]]Adaptation/538daa1c-4171-4e69-9ebf-571b98222bd2_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Memory-Consistent[[:space:]]Neural[[:space:]]Networks[[:space:]]for[[:space:]]Imitation[[:space:]]Learning/cad750cc-1f46-4c4c-ba12-8ff061147a73_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Meta[[:space:]]Inverse[[:space:]]Constrained[[:space:]]Reinforcement[[:space:]]Learning_[[:space:]]Convergence[[:space:]]Guarantee[[:space:]]and[[:space:]]Generalization[[:space:]]Analysis/d5b7b9c9-750b-4249-97a4-b68afdba60d0_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Meta-Evolve_[[:space:]]Continuous[[:space:]]Robot[[:space:]]Evolution[[:space:]]for[[:space:]]One-to-many[[:space:]]Policy[[:space:]]Transfer/50cbb996-52fa-46db-8cae-fc9491fc6a52_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Meta-Learning[[:space:]]Priors[[:space:]]Using[[:space:]]Unrolled[[:space:]]Proximal[[:space:]]Networks/4466300d-dd1d-4505-b769-16e355574be8_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Meta-VBO_[[:space:]]Utilizing[[:space:]]Prior[[:space:]]Tasks[[:space:]]in[[:space:]]Optimizing[[:space:]]Risk[[:space:]]Measures[[:space:]]with[[:space:]]Gaussian[[:space:]]Processes/eb0ef516-4b2c-49bf-98a8-4b0563825575_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MetaCoCo_[[:space:]]A[[:space:]]New[[:space:]]Few-Shot[[:space:]]Classification[[:space:]]Benchmark[[:space:]]with[[:space:]]Spurious[[:space:]]Correlation/9059ec89-2a56-45d1-af90-8a3801bf5c38_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MetaTool[[:space:]]Benchmark[[:space:]]for[[:space:]]Large[[:space:]]Language[[:space:]]Models_[[:space:]]Deciding[[:space:]]Whether[[:space:]]to[[:space:]]Use[[:space:]]Tools[[:space:]]and[[:space:]]Which[[:space:]]to[[:space:]]Use/13ece2a7-7859-4860-88b3-becfaff02fae_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MgNO_[[:space:]]Efficient[[:space:]]Parameterization[[:space:]]of[[:space:]]Linear[[:space:]]Operators[[:space:]]via[[:space:]]Multigrid/29062414-3d4d-4bb9-93d4-377e5a4f8686_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mind[[:space:]]Your[[:space:]]Augmentation_[[:space:]]The[[:space:]]Key[[:space:]]to[[:space:]]Decoupling[[:space:]]Dense[[:space:]]Self-Supervised[[:space:]]Learning/51d49f4a-5de2-4622-8e56-d04927ac2532_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MiniGPT-4_[[:space:]]Enhancing[[:space:]]Vision-Language[[:space:]]Understanding[[:space:]]with[[:space:]]Advanced[[:space:]]Large[[:space:]]Language[[:space:]]Models/4c8bdab0-29e9-4ed7-a19e-989c4cb7df53_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MiniLLM_[[:space:]]Knowledge[[:space:]]Distillation[[:space:]]of[[:space:]]Large[[:space:]]Language[[:space:]]Models/b84a8391-80ad-498d-bab9-0615b211854b_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Minimax[[:space:]]optimality[[:space:]]of[[:space:]]convolutional[[:space:]]neural[[:space:]]networks[[:space:]]for[[:space:]]infinite[[:space:]]dimensional[[:space:]]input-output[[:space:]]problems[[:space:]]and[[:space:]]separation[[:space:]]from[[:space:]]kernel[[:space:]]methods/adc362f0-ea7c-4a56-9a7f-eedd4f268dea_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Minimum[[:space:]]width[[:space:]]for[[:space:]]universal[[:space:]]approximation[[:space:]]using[[:space:]]ReLU[[:space:]]networks[[:space:]]on[[:space:]]compact[[:space:]]domain/5288e1f4-9821-4b5d-aa98-a56f1df847d7_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mirage_[[:space:]]Model-agnostic[[:space:]]Graph[[:space:]]Distillation[[:space:]]for[[:space:]]Graph[[:space:]]Classification/fcc61ee3-3696-4c02-b368-ae62072eccc9_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mitigating[[:space:]]Emergent[[:space:]]Robustness[[:space:]]Degradation[[:space:]]while[[:space:]]Scaling[[:space:]]Graph[[:space:]]Learning/2cede5f1-4567-4393-b028-521a29afcaa1_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mitigating[[:space:]]Hallucination[[:space:]]in[[:space:]]Large[[:space:]]Multi-Modal[[:space:]]Models[[:space:]]via[[:space:]]Robust[[:space:]]Instruction[[:space:]]Tuning/03d13c2a-05bf-4fe6-910b-4956b0ef6495_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mitigating[[:space:]]the[[:space:]]Curse[[:space:]]of[[:space:]]Dimensionality[[:space:]]for[[:space:]]Certified[[:space:]]Robustness[[:space:]]via[[:space:]]Dual[[:space:]]Randomized[[:space:]]Smoothing/5a6ee4ba-4a9b-4d73-b288-e1e031b0720f_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MixSATGEN_[[:space:]]Learning[[:space:]]Graph[[:space:]]Mixing[[:space:]]for[[:space:]]SAT[[:space:]]Instance[[:space:]]Generation/d43df34b-8267-4457-a3dd-be1aa74543be_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MixSup_[[:space:]]Mixed-grained[[:space:]]Supervision[[:space:]]for[[:space:]]Label-efficient[[:space:]]LiDAR-based[[:space:]]3D[[:space:]]Object[[:space:]]Detection/a4603983-4fb9-4dee-8495-148f6fbe4622_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mixture[[:space:]]of[[:space:]]LoRA[[:space:]]Experts/873d633b-7863-49f9-a0f1-5224abf3b321_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mixture[[:space:]]of[[:space:]]Weak[[:space:]]and[[:space:]]Strong[[:space:]]Experts[[:space:]]on[[:space:]]Graphs/ce48e1f8-a707-4f30-b71c-6270368b7adf_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mixture-of-Experts[[:space:]]Meets[[:space:]]Instruction[[:space:]]Tuning_[[:space:]]A[[:space:]]Winning[[:space:]]Combination[[:space:]]for[[:space:]]Large[[:space:]]Language[[:space:]]Models/ebc877d7-d0cd-4525-a8be-82ae4ed9ed68_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Model[[:space:]]Merging[[:space:]]by[[:space:]]Uncertainty-Based[[:space:]]Gradient[[:space:]]Matching/c288b4ca-6bf0-4937-a835-da5f60a0ff33_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Modeling[[:space:]]Boundedly[[:space:]]Rational[[:space:]]Agents[[:space:]]with[[:space:]]Latent[[:space:]]Inference[[:space:]]Budgets/aa9e0bfe-eed4-48cb-9d4e-0b1918d532aa_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Modeling[[:space:]]state-dependent[[:space:]]communication[[:space:]]between[[:space:]]brain[[:space:]]regions[[:space:]]with[[:space:]]switching[[:space:]]nonlinear[[:space:]]dynamical[[:space:]]systems/abd4571c-8d77-42fb-9750-bf67c28026a5_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Modelling[[:space:]]complex[[:space:]]vector[[:space:]]drawings[[:space:]]with[[:space:]]stroke-clouds/5de9d44d-f459-49bd-8cc1-0b255ea08114_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Modulate[[:space:]]Your[[:space:]]Spectrum[[:space:]]in[[:space:]]Self-Supervised[[:space:]]Learning/3fc25f59-47a6-4f6f-ad4c-21a1bf764878_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Modulated[[:space:]]Phase[[:space:]]Diffusor_[[:space:]]Content-Oriented[[:space:]]Feature[[:space:]]Synthesis[[:space:]]for[[:space:]]Detecting[[:space:]]Unknown[[:space:]]Objects/aae102fe-9e9b-47a3-8244-882e51dd833b_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/MogaNet_[[:space:]]Multi-order[[:space:]]Gated[[:space:]]Aggregation[[:space:]]Network/5bf3c6e1-8611-49ff-afb0-188723ac18c8_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Mol-Instructions_[[:space:]]A[[:space:]]Large-Scale[[:space:]]Biomolecular[[:space:]]Instruction[[:space:]]Dataset[[:space:]]for[[:space:]]Large[[:space:]]Language[[:space:]]Models/3006dac3-b094-4894-a5af-e2888fcfd1f0_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/Momentum[[:space:]]Benefits[[:space:]]Non-iid[[:space:]]Federated[[:space:]]Learning[[:space:]]Simply[[:space:]]and[[:space:]]Provably/76b28c96-bc1b-44b4-98e3-283ec7c27801_origin.pdf filter=lfs diff=lfs merge=lfs -text2024/More[[:space:]]is[[:space:]]Better_[[:space:]]when[[:space:]]Infinite[[:space:]]Overparameterization[[:space:]]is[[:space:]]Optimal[[:space:]]and[[:space:]]Overfitting[[:space:]]is[[:space:]]Obligatory/f4ab8ec7-8e59-49b8-aaaf-a15fe5accf38_origin.pdf filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716[ { "type": "text", "text": "MAGIC123: ONE IMAGE TO HIGH-QUALITY 3D OBJECT GENERATION USING BOTH 2D AND 3D DIFFUSION PRIORS", "text_level": 1, "bbox": [ 169, 99, 831, 172 ], "page_idx": 0 }, { "type": "text", "text": "Guocheng Qian $^{1,2}$ , Jinjie Mai $^{1}$ , Abdullah Hamdi $^{3}$ , Jian Ren $^{2}$ , Aliaksandr Siarohin $^{2}$ , Bing Li $^{1}$ , Hsin-Ying Lee $^{2}$ , Ivan Skorokhodov $^{1}$ , Peter Wonka $^{1}$ , Sergey Tulyakov $^{2}$ , Bernard Ghanem $^{1}$", "bbox": [ 179, 193, 839, 223 ], "page_idx": 0 }, { "type": "text", "text": "$^{1}$ King Abdullah University of Science and Technology (KAUST), $^{2}$ Snap Inc.", "bbox": [ 181, 224, 704, 238 ], "page_idx": 0 }, { "type": "text", "text": "3Visual Geometry Group, University of Oxford", "bbox": [ 183, 238, 496, 252 ], "page_idx": 0 }, { "type": "text", "text": "{guocheng.qian,bernard.ghanem}@kaust.edu.sa", "bbox": [ 184, 253, 616, 267 ], "page_idx": 0 }, { "type": "image", "img_path": "images/700bb1421c655426745f8fb9ddf5f9dfb24090166ae81e83240ff968c3604da2.jpg", "image_caption": [ "Figure 1: Magic123 can reconstruct high-fidelity 3D content with detailed geometry and high-resolution renderings (1024 × 1024) from a single image in the wild. Visit https://guochengqian.github.io/project/magic123/ for immersive visualizations and code." ], "image_footnote": [], "bbox": [ 173, 285, 826, 527 ], "page_idx": 0 }, { "type": "text", "text": "ABSTRACT", "text_level": 1, "bbox": [ 450, 597, 547, 612 ], "page_idx": 0 }, { "type": "text", "text": "We present \"Magic123\", a two-stage coarse-to-fine approach for high-quality, textured 3D mesh generation from a single image in the wild using both 2D and 3D priors. In the first stage, we optimize a neural radiance field to produce a coarse geometry. In the second stage, we adopt a memory-efficient differentiable mesh representation to yield a high-resolution mesh with a visually appealing texture. In both stages, the 3D content is learned through reference-view supervision and novel-view guidance by a joint 2D and 3D diffusion prior. We introduce a trade-off parameter between the 2D and 3D priors to control the details and 3D consistencies of the generation. Magic123 demonstrates a significant improvement over previous image-to-3D techniques, as validated through extensive experiments on diverse synthetic and real-world images.", "bbox": [ 227, 628, 769, 782 ], "page_idx": 0 }, { "type": "text", "text": "1 INTRODUCTION", "text_level": 1, "bbox": [ 173, 808, 338, 823 ], "page_idx": 0 }, { "type": "text", "text": "3D reconstruction from a single image (image-to-3D) is challenging because it is an undetermined problem. A typical image-to-3D system optimizes a 3D representation such as neural radiance field (NeRF) (Mildenhall et al., 2020), where the reference view and random novel views are differentially rendered during training. While the reference view can be optimized to match the input, there is no available supervision for the novel views. Due to this ill-posed nature, the primary focus of image-to-3D is how to leverage priors to guide the novel view reconstruction.", "bbox": [ 169, 839, 826, 925 ], "page_idx": 0 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 0 }, { "type": "page_number", "text": "1", "bbox": [ 493, 948, 503, 959 ], "page_idx": 0 }, { "type": "image", "img_path": "images/100b7c73ffe313165f51732904d863a0411dd256af65451bc003c443e467f1b9.jpg", "image_caption": [ "Figure 2: The effects of the joint 2D and 3D priors. We compare image-to-3D in three cases: a teddy bear (common object), two stacked donuts (less common object), and a dragon statue (uncommon object). Magic123 with a sole 3D prior (on the left) yields consistent yet potentially simplified 3D with reduced shape and texture details due to its low generalizability. Magic123 with a sole 2D prior (on the right) shows a strong generalizability in producing content with high details while potentially lacking 3D consistency. Magic123 proposes to use a joint 2D and 3D prior that consistently offers identity-preserving 3D with fine-grained geometry and visually appealing texture." ], "image_footnote": [], "bbox": [ 176, 99, 823, 372 ], "page_idx": 1 }, { "type": "text", "text": "Current mainstream image-to-3D systems such as NeuralLift (Xu et al., 2023) and RealFusion (Melas-Kyriazi et al., 2023) employ 2D priors, e.g. text-to-image diffusion models (Rombach et al., 2022; Sahara et al., 2022), for 3D reconstruction. The novel views are guided by the 2D priors using text prompts associated with the input image by captioning (Li et al., 2022; 2023) or textual inversion (Gal et al., 2023). Without any 3D data, 2D prior-based solutions can distill 2D knowledge for 3D generation in a zero-shot fashion through score distillation sampling (SDS) (Poole et al., 2022). Thanks to the billion-scale training dataset (Schuhmann et al., 2021), 2D priors have been showing strong generalizability in 3D generation (Poole et al., 2022; Lin et al., 2023): successfully yielding detailed 3D content respecting various prompts. However, methods relying on 2D priors alone inevitably compromise on 3D consistency due to their restricted 3D knowledge. This leads to low-fidelity 3D generation, such as yielding multiple faces (Janus problems), mismatched sizes, and inconsistent texture. Fig.2 (right column) shows failure cases of using only 2D priors: the multiple faces of the teddy bear (top row) and the two donuts merged into one at the back (middle row).", "bbox": [ 169, 516, 826, 699 ], "page_idx": 1 }, { "type": "text", "text": "Another approach to image-to-3D is to employ 3D-aware priors<sup>1</sup>. Earlier attempts at 3D reconstruction leveraged geometric priors like topology constraints (Wang et al., 2018) and coarse 3D shapes (Michel et al., 2022) to assist in 3D generation. However, these manually crafted 3D priors fall short of generating high-quality 3D content for various prompts. Recently, approaches like 3Dim (Watson et al., 2023) and Zero-1-to-3 (Liu et al., 2023) trained/finetuned view-dependent diffusion models and utilized them as 3D priors for image-to-3D generation. Since trained in 3D data, these 3D priors are more effective in generating content with high 3D consistency. Unfortunately, (1) the scale of 3D datasets is small: the largest public dataset Objaverse-XL (Deitke et al., 2023a) only contains around 10M instances; (2) 3D datasets contain mostly limited-quality instances with simple shapes. Consequently, 3D priors are limited in generalizability and tend to generate simple geometry and texture. As illustrated in Fig.2, while a 3D prior-based solution effectively processes common objects (for instance, the teddy bear example in the top row), it struggles with less common ones, yielding oversimplified, sometimes even flat 3D geometry (e.g., dragon statue at bottom left).", "bbox": [ 169, 704, 826, 886 ], "page_idx": 1 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 173, 32, 478, 47 ], "page_idx": 1 }, { "type": "page_footnote", "text": "<sup>1</sup>We abbreviate 3D-aware prior as 3D prior throughout the paper.", "bbox": [ 192, 909, 578, 924 ], "page_idx": 1 }, { "type": "page_number", "text": "2", "bbox": [ 493, 948, 504, 959 ], "page_idx": 1 }, { "type": "text", "text": "In this paper, rather than solely relying on a 2D or a 3D prior, we advocate for the simultaneous use of both priors to guide novel views. By modulating the simple yet effective tradeoff parameter between the 2D and 3D priors, we can manage a balance between generalizability and 3D consistency in the generated 3D content. In many cases where both 2D prior and 3D prior fail due to low 3D consistency and low generalizability, the proposed joint 2D and 3D prior propose can produce 3D content with high fidelity. Refer to Fig.2 for comparisons. Contributions of this work is summarized as follows:", "bbox": [ 169, 103, 826, 188 ], "page_idx": 2 }, { "type": "list", "sub_type": "text", "list_items": [ "- We introduce Magic123, a novel coarse-to-fine pipeline for image-to-3D generation that uses a joint 2D and 3D prior to guide the novel views.", "- Using the exact same set of parameters for all examples without any additional reconfiguration, Magic123 achieves state-of-the-art image-to-3D results in both real-world and synthetic scenarios." ], "bbox": [ 173, 194, 825, 253 ], "page_idx": 2 }, { "type": "text", "text": "2 RELATED WORK", "text_level": 1, "bbox": [ 171, 273, 341, 289 ], "page_idx": 2 }, { "type": "text", "text": "Multi-view 3D reconstruction. The development of Neural Radiance Fields (NeRF) (Mildenhall et al., 2020; Lombardi et al., 2019) has prompted a shift towards reconstructing 3D as volume radiance (Tagliasacchi & Mildenhall, 2022), enabling the synthesis of photo-realistic novel views (Barron et al., 2022). NeRF requires as many as 100 images to reconstruct a scene. Subsequent works have explored the optimization of NeRF in few-shot (e.g. (Jain et al., 2021; Kim et al., 2022; Du et al., 2023)) and one-shot (e.g. (Yu et al., 2021; Chan et al., 2022)) settings. However, these methods fail to generate $360^{\\circ}$ 3D content due to the lack of strong priors for the missing novel-view information.", "bbox": [ 169, 303, 826, 402 ], "page_idx": 2 }, { "type": "text", "text": "In-domain single-view 3D reconstruction. 3D reconstruction from a single view requires strong priors on the object geometry. Direct supervision in the form of 3D shape priors is a robust way to impose such constraints for a particular domain, like human heads (Blanz & Vetter, 2003; Booth et al., 2016), hands (Pavlakos et al., 2019) or full bodies (Loper et al., 2015; Martinez et al., 2017). Such supervision requires expensive 3D annotations and manual 3D prior creation. Thus several works explore unsupervised learning of 3D geometry from object-centric datasets (e.g. (Kanazawa et al., 2018; Duggal & Pathak, 2022; Kemelmacher-Shlizerman, 2013; Siarohin et al., 2023)). These methods are typically structured as auto-encoders (Wu et al., 2020; Kar et al., 2015; Cheng et al., 2023) or generators (Cai et al., 2022; Sun et al., 2022) with explicit 3D decomposition under the hood. Due to the lack of large-scale 3D data, in-domain 3D reconstruction is limited to simple shapes (e.g. chairs and cars) and cannot generalize to more complex or uncommon objects (e.g. dragons and statues).", "bbox": [ 169, 409, 826, 575 ], "page_idx": 2 }, { "type": "text", "text": "Zero-shot single-view 3D reconstruction. Foundational multi-modal networks (Radford et al., 2021; Rombach et al., 2022) have enabled various zero-shot 3D synthesis tasks. Earlier works employed CLIP (Radford et al., 2021) guidance for 3D generation (Jain et al., 2022; Hong et al., 2022; Mohammad Khalid et al., 2022; Xu et al., 2022) and manipulation (Michel et al., 2022; Patashnik et al., 2021) from text prompts. Modern zero-shot text-to-image generators (Ramesh et al., 2021; Rombach et al., 2022; Sahara et al., 2022; Zhang et al., 2023) improve these results by providing stronger synthesis priors (Poole et al., 2022; Wang et al., 2023a; Metzer et al., 2022; Mikaeili et al., 2023). DreamFusion (Poole et al., 2022) is a seminal work that proposed to distill an off-the-shelf diffusion model into a NeRF for a given text query. It sparked numerous follow-up approaches to improve the quality (Lin et al., 2023; Chen et al., 2023b; Wang et al., 2023b; Chen et al., 2023a). image-to-3D reconstruction (Melas-Kyriazi et al., 2023; Tang et al., 2023b; Hollein et al., 2023; Richardson et al., 2023). Inspired by the success of text-to-3D, 2D diffusion priors were also applied to image-to-3D with additional reference view reconstruction loss (Melas-Kyriazi et al., 2023; Xu et al., 2023; Seo et al., 2023; Lin et al., 2023; Raj et al., 2023). Recently, (Watson et al., 2023; Liu et al., 2023) trained pose-dependent diffusion models that are 3D-aware and used them to improve the 3D consistency. However, they suffered from low generalizability and tended to generate oversimplified geometry due to the limited quality and the small scale of 3D datasets. Our work instead explores a joint 2D and 3D prior to balance the generalizability and 3D consistency.", "bbox": [ 169, 582, 826, 834 ], "page_idx": 2 }, { "type": "text", "text": "3 METHODOLOGY", "text_level": 1, "bbox": [ 171, 851, 344, 867 ], "page_idx": 2 }, { "type": "text", "text": "We propose Magic123, a coarse-to-fine pipeline for high-quality 3D object generation from a single reference image. Magic123 is supervised by the reference view reconstruction and guided by a joint 2D and 3D prior, as shown in Fig. 3.", "bbox": [ 169, 881, 825, 925 ], "page_idx": 2 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 2 }, { "type": "page_number", "text": "3", "bbox": [ 493, 948, 504, 959 ], "page_idx": 2 }, { "type": "image", "img_path": "images/98e9f5e92f981071dcdb33ead964cf9ac7ec2136962fd18fa0aa6e81bd8cb8ce.jpg", "image_caption": [ "Figure 3: Magic123 pipeline. Magic123 is a two-stage coarse-to-fine framework for high-quality 3D generation from a single reference image. Magic123 is supervised by the reference image reconstruction and guided by a joint 2D and 3D diffusion prior. At the coarse stage, we optimize an Instant-NGP NeRF for a coarse geometry. At the fine stage, we initialize a DMTet differentiable mesh from the NeRF output and optimize it with high-resolution rendering $(1024 \\times 1024)$ . Textural inversion is used in both stages to generate object-preserving geometry and view-consistent textures." ], "image_footnote": [], "bbox": [ 178, 103, 816, 296 ], "page_idx": 3 }, { "type": "text", "text": "3.1 MAGIC123 PIPELINE", "text_level": 1, "bbox": [ 171, 422, 359, 436 ], "page_idx": 3 }, { "type": "text", "text": "Image preprocessing. Magic123 is aimed at object-level image-to-3D generation. We leverage an off-the-shelf segmentation model, Dense Prediction Transformer (Ranftl et al., 2021), to segment the object. We denote the extracted binary segmentation mask M. To prevent flat geometry, we further extract the depth map by a pretrained depth estimator (Ranftl et al., 2020). The foreground image is used as the input, while the mask and the depth map are used in the optimization as regularization priors.", "bbox": [ 169, 449, 823, 532 ], "page_idx": 3 }, { "type": "text", "text": "Coarse-to-fine pipeline. Inspired by the text-to-3D work Magic3D (Lin et al., 2023), Magic123 adopts a coarse-to-fine pipeline for image-to-3D optimization. The coarse stage of Magic123 is targeted at learning underlying geometry that respects the reference image. Due to its strong ability to handle complex topological changes in a smooth and continuous fashion, we adopt Instant-NGP (Müller et al., 2022). It only offers low-resolution renderings $(128 \\times 128)$ during training because of memory-expensive volumetric rendering and possibly yields 3D shapes with noise due to its tendency to create high-frequency artifacts. Therefore, we introduce the fine stage that uses DMTet (Shen et al., 2021) to refine the coarse 3D model by the NeRF and to produce a high-resolution and disentangled geometry and texture. We use $1024 \\times 1024$ rendering resolution in the fine stage, which is found to have a similar memory consumption to the coarse stage. To reconstruct 3D faithfully from a single image, we optimize the pipeline through (i) novel view guidance; (ii) reference view reconstruction supervision; (iii) two standard regularizations: depth regularization and normal smoothness.", "bbox": [ 169, 539, 826, 708 ], "page_idx": 3 }, { "type": "text", "text": "Novel view guidance $\\mathcal{L}_g$ is necessary to dream up the missing information. As a significant difference from previous works, we do not rely solely on a 2D prior or a 3D prior, but we leverage a joint 2D and 3D prior to optimize the novel views. See §3.2 for details.", "bbox": [ 169, 713, 823, 756 ], "page_idx": 3 }, { "type": "text", "text": "Reference view reconstruction loss $\\mathcal{L}_{rec}$ is to ensure the reference image $\\mathbf{I}^r$ can be reconstructed from the reference viewpoint $(\\mathbf{v}^r)$ . Mean squared error is adopted on both $\\mathbf{I}^r$ and its mask as follows:", "bbox": [ 169, 762, 826, 792 ], "page_idx": 3 }, { "type": "equation", "text": "\n$$\n\\mathcal {L} _ {r e c} = \\lambda_ {r g b} \\| \\mathbf {M} \\odot \\left(\\mathbf {I} ^ {r} - G _ {\\theta} \\left(\\mathbf {v} ^ {r}\\right)\\right) \\| _ {2} ^ {2} + \\lambda_ {m a s k} \\| \\mathbf {M} - M \\left(G _ {\\theta} \\left(\\mathbf {v} ^ {r}\\right)\\right) \\| _ {2} ^ {2}, \\tag {1}\n$$\n", "text_format": "latex", "bbox": [ 267, 796, 823, 814 ], "page_idx": 3 }, { "type": "text", "text": "where $\\theta$ are the NeRF parameters to be optimized, $\\odot$ is the Hadamard product, $G_{\\theta}(\\mathbf{v}^r)$ is a NeRF rendered RGB image from the reference viewpoint, $M()$ is the foreground mask acquired by integrating the volume density along the ray of each pixel. Since the foreground object is extracted as input, we do not model any background and simply use pure white for the background rendering for all experiments. $\\lambda_{rgb}$ and $\\lambda_{mask}$ are the weights for the foreground RGB and the mask, respectively.", "bbox": [ 169, 818, 826, 891 ], "page_idx": 3 }, { "type": "text", "text": "Depth regularization $\\mathcal{L}_d$ is a standard tool to avoid overly-flat or caved-in 3D content (Xu et al., 2023; Tang et al., 2023b). We would like the depth $d$ from the reference viewpoint to be similar to", "bbox": [ 169, 895, 826, 925 ], "page_idx": 3 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 173, 32, 478, 47 ], "page_idx": 3 }, { "type": "page_number", "text": "4", "bbox": [ 493, 948, 503, 959 ], "page_idx": 3 }, { "type": "image", "img_path": "images/028284fa42074e9cb8698715791768ad73e9eb5da532f095f9b30866547e7ac5.jpg", "image_caption": [ "Figure 4: 2D v.s. 3D Diffusion priors. Magic123 uses Stable Diffusion (Rombach et al., 2022) as the 2D prior and viewpoint-conditioned diffusion model Zero-1-to-3 (Liu et al., 2023) as the 3D prior." ], "image_footnote": [], "bbox": [ 181, 102, 795, 195 ], "page_idx": 4 }, { "type": "text", "text": "the depth $d^r$ estimated by a pretrained depth estimator (Ranftl et al., 2020). Due to the mismatched values of $d$ and $d^r$ , we regularize them linearly through normalized negative Pearson correlation:", "bbox": [ 169, 258, 823, 289 ], "page_idx": 4 }, { "type": "equation", "text": "\n$$\n\\mathcal {L} _ {d} = \\frac {1}{2} \\left[ 1 - \\frac {\\operatorname {c o v} (\\mathbf {M} \\odot d ^ {r} , \\mathbf {M} \\odot d)}{\\sigma (\\mathbf {M} \\odot d ^ {r}) \\sigma (\\mathbf {M} \\odot d)} \\right], \\tag {2}\n$$\n", "text_format": "latex", "bbox": [ 366, 292, 825, 328 ], "page_idx": 4 }, { "type": "text", "text": "where $\\operatorname{cov}(\\cdot)$ denotes covariance and $\\sigma(\\cdot)$ measures standard deviation.", "bbox": [ 169, 333, 640, 348 ], "page_idx": 4 }, { "type": "text", "text": "Normal smoothness $\\mathcal{L}_n$ is a common idea to reduce high-frequency artifacts. Finite differences of depth are used to estimate the normal map. Gaussian smoothness with a $9\\times 9$ kernel is applied:", "bbox": [ 169, 354, 826, 383 ], "page_idx": 4 }, { "type": "equation", "text": "\n$$\n\\mathcal {L} _ {n} = \\left\\| \\mathbf {n} - \\tau (g (\\mathbf {n})) \\right\\|, \\tag {3}\n$$\n", "text_format": "latex", "bbox": [ 421, 388, 825, 406 ], "page_idx": 4 }, { "type": "text", "text": "where $\\tau (\\cdot)$ denotes the stopgradient operation and $g(\\cdot)$ is a Gaussian blur.", "bbox": [ 169, 410, 655, 426 ], "page_idx": 4 }, { "type": "text", "text": "Overall, both the coarse and fine stages are optimized by a combination of losses:", "bbox": [ 169, 431, 707, 446 ], "page_idx": 4 }, { "type": "equation", "text": "\n$$\n\\mathcal {L} _ {c} = \\mathcal {L} _ {g} + \\mathcal {L} _ {r e c} + \\lambda_ {d} \\mathcal {L} _ {d} + \\lambda_ {n} \\mathcal {L} _ {n}, \\tag {4}\n$$\n", "text_format": "latex", "bbox": [ 380, 453, 825, 469 ], "page_idx": 4 }, { "type": "text", "text": "We note here that we empirically find the depth and normal regularization only have marginal affects to the final performance. We keep here as a standard practice.", "bbox": [ 169, 474, 823, 502 ], "page_idx": 4 }, { "type": "text", "text": "3.2 NOVEL VIEW GUIDANCE: A JOINT 2D AND 3D PRIOR", "text_level": 1, "bbox": [ 171, 518, 589, 532 ], "page_idx": 4 }, { "type": "text", "text": "2D priors. Using a single reference image is insufficient to optimize 3D. DreamFusion (Poole et al., 2022) proposes to use a 2D text-to-image diffusion model as the prior to guide the novel views via the proposed score distillation sampling (SDS) loss. SDS encodes the rendered view as latent, adds noise to it, and guesses the clean novel view conditioned on the input text prompt. Roughly speaking, SDS translates the rendered view into an image that respects both the content from the rendered view and the text. The SDS loss is illustrated in the upper part of Fig. 4 and is formulated as:", "bbox": [ 169, 544, 826, 628 ], "page_idx": 4 }, { "type": "equation", "text": "\n$$\n\\nabla \\mathcal {L} _ {2 D} \\triangleq \\mathbb {E} _ {t, \\epsilon} \\left[ w (t) \\left(\\epsilon_ {\\phi} \\left(\\mathbf {z} _ {t}; \\mathbf {e}, t\\right) - \\epsilon\\right) \\frac {\\partial \\mathbf {z}}{\\partial \\mathbf {I}} \\frac {\\partial \\mathbf {I}}{\\partial \\theta} \\right], \\tag {5}\n$$\n", "text_format": "latex", "bbox": [ 343, 633, 825, 667 ], "page_idx": 4 }, { "type": "text", "text": "where $\\mathbf{I}$ is a rendered view, and $\\mathbf{z}_t$ is the noisy latent by adding a random Gaussian noise of a time step $t$ to the latent of $\\mathbf{I}$ . $\\epsilon, \\epsilon_{\\phi}, \\phi, \\theta$ are the added noise, predicted noise, parameters of the diffusion prior, and the parameters of the 3D model. $\\theta$ can be MLPs of NeRF for the coarse stage, or SDF, triangular deformations, and color field for the fine stage. DreamFusion points out that the Jacobian term of the image encoder $\\frac{\\partial \\mathbf{z}}{\\partial \\mathbf{I}}$ in Eq. equation 5 can be further eliminated, making the SDS loss much more efficient in terms of both speed and memory.", "bbox": [ 169, 672, 826, 756 ], "page_idx": 4 }, { "type": "text", "text": "Textural inversion. Note the prompt e we use for each reference image is not a pure text chosen from tedious prompt engineering. Using pure text for image-to-3D generation sometimes results in inconsistent texture due to the limited expressiveness of the human language. For example, using \"A high-resolution DSLR image of a colorful teapot\" will generate different colors that do not respect the reference image. We thus follow RealFusion (Melas-Kyriazi et al., 2023) to leverage the same textual inversion (Gal et al., 2023) technique to acquire a special token $<e>$ to represent the object in the reference image. We use the same prompt for all examples: \"A high-resolution DSLR image of $<e>$ \". We find that Stable Diffusion can generate an object with a more similar texture and style to the reference image with the textual inversion technique compared to the results without it.", "bbox": [ 169, 763, 826, 888 ], "page_idx": 4 }, { "type": "text", "text": "3D prior. Using only the 2D prior is not sufficient to capture consistent 3D geometry due to its lack of 3D knowledge. Zero-1-to-3 (Liu et al., 2023) thus proposes a 3D(-aware) prior solution.", "bbox": [ 169, 895, 826, 925 ], "page_idx": 4 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 4 }, { "type": "page_number", "text": "5", "bbox": [ 493, 948, 503, 959 ], "page_idx": 4 }, { "type": "text", "text": "Zero-1-to-3 finetunes Stable Diffusion into a view-dependent version on Objaverse (Deitke et al., 2023b). Zero-1-to-3 takes a reference image and a viewpoint as input and can generate a novel view from the given viewpoint. Zero-1-to-3 thereby can be used as a strong 3D prior for 3D reconstruction. The usage of Zero-1-to-3 in an image-to-3D generation pipeline using SDS is formulated as:", "bbox": [ 169, 103, 826, 160 ], "page_idx": 5 }, { "type": "equation", "text": "\n$$\n\\nabla \\mathcal {L} _ {3 D} \\triangleq \\mathbb {E} _ {t, \\epsilon} \\left[ w (t) \\left(\\epsilon_ {\\phi} \\left(\\mathbf {z} _ {t}; \\mathbf {I} ^ {r}, t, R, T\\right) - \\epsilon\\right) \\frac {\\partial \\mathbf {I}}{\\partial \\theta} \\right], \\tag {6}\n$$\n", "text_format": "latex", "bbox": [ 331, 167, 825, 200 ], "page_idx": 5 }, { "type": "text", "text": "where $R, T$ are the camera poses passed to Zero-1-to-3. The difference between using the 3D prior and the 2D prior is illustrated in Fig. 4, where we show that the 2D prior uses text embedding as a condition while the 3D prior uses the reference view $\\mathbf{I}^T$ with the novel view camera poses as conditions. The 3D prior utilizes camera poses to encourage 3D consistency and enable the usage of more 3D information compared to the 2D prior counterpart.", "bbox": [ 169, 207, 823, 277 ], "page_idx": 5 }, { "type": "text", "text": "A joint 2D and 3D prior. We find that the 2D and 3D priors are complementary to each other. The 2D prior favors high imagination thanks to its strong generalizability stemming from the large-scale training dataset of diffusion models, but might lead to inconsistent geometry due to the lack of 3D knowledge. On the other hand, the 3D prior tends to generate consistent geometry but with simple shapes and less generalizability due to the small scale and the simple geometry of the 3D dataset. In the case of uncommon objects, the 3D prior might result in over-simplified geometry and texture. Instead of relying solely on a 2D or a 3D prior, we propose to use a joint 2D and 3D prior:", "bbox": [ 169, 284, 826, 383 ], "page_idx": 5 }, { "type": "equation", "text": "\n$$\n\\nabla \\mathcal {L} _ {g} \\triangleq \\mathbb {E} _ {t _ {1}, t _ {2}, \\epsilon_ {1}, \\epsilon_ {2}} \\left[ w (t) \\left[ \\lambda_ {2 D} \\left(\\epsilon_ {\\phi_ {2 D}} \\left(\\mathbf {z} _ {t _ {1}}; \\mathbf {e}, t _ {1}\\right) - \\epsilon_ {1}\\right) + \\lambda_ {3 D} \\left(\\epsilon_ {\\phi_ {3 D}} \\left(\\mathbf {z} _ {t _ {2}}; \\mathbf {I} ^ {r}, t _ {2}, R, T\\right) - \\epsilon_ {2}\\right) \\right] \\frac {\\partial \\mathbf {I}}{\\partial \\theta} \\right] \\tag {7}\n$$\n", "text_format": "latex", "bbox": [ 181, 388, 825, 434 ], "page_idx": 5 }, { "type": "text", "text": "where $\\lambda_{2D}$ and $\\lambda_{3D}$ determine the strength of 2D and 3D prior, respectively. Increasing $\\lambda_{2D}$ leads to better generalizability, higher imagination, and more details, but less 3D consistencies. Increasing $\\lambda_{3D}$ results in more 3D consistencies, but worse generalizability and fewer details. However, tuning two parameters at the same time is not user-friendly. Interestingly, through both qualitative and quantitative experiments, we find that Zero-1-to-3, the 3D prior we use, is much more tolerant to $\\lambda_{3D}$ than Stable Diffusion to $\\lambda_{2D}$ (see §C.1 for details). When only the 3D prior is used, i.e. $\\lambda_{2D} = 0$ , Zero-1-to-3 generates consistent results for $\\lambda_{3D}$ ranging from 10 to 60. On the contrary, Stable Diffusion is rather sensitive to $\\lambda_{2D}$ . When setting $\\lambda_{3D}$ to 0 and using the 2D prior only, the generated geometry varies a lot when $\\lambda_{2D}$ is changed from 1 to 2. This observation leads us to fix $\\lambda_{3D} = 40$ and to rely on tuning the $\\lambda_{2D}$ to trade off the generalizability and 3D consistencies. We set $\\lambda_{2D} = 1.0$ for all experiments, but this value can be tuned according to the user's preference. More details and discussions on the choice of 2D and 3D priors weights are available in Sec.4.3.", "bbox": [ 169, 434, 826, 602 ], "page_idx": 5 }, { "type": "text", "text": "4 EXPERIMENTS", "text_level": 1, "bbox": [ 171, 622, 326, 636 ], "page_idx": 5 }, { "type": "text", "text": "4.1 SETUPS", "text_level": 1, "bbox": [ 171, 652, 269, 667 ], "page_idx": 5 }, { "type": "text", "text": "NeRF4. We use a NeRF4 dataset that we collect from 4 scenes, chair, drums, ficus, and microphone from the synthetic NeRF dataset (Mildenhall et al., 2020). These four scenes cover complex objects (drums and ficus), a hard case (the back view of the chair), and a simple case (the microphone).", "bbox": [ 169, 679, 826, 722 ], "page_idx": 5 }, { "type": "text", "text": "RealFusion15. We further use the 15 natural images released by RealFusion (Melas-Kyriazi et al., 2023) that consists of both synthetic and real images in a broad range for evaluation.", "bbox": [ 169, 728, 826, 757 ], "page_idx": 5 }, { "type": "text", "text": "Optimization details. We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Most training details and camera settings are set to the same as RealFusion (Melas-Kyriazi et al., 2023). See $\\S A$ and $\\S B$ for details, respectively.", "bbox": [ 169, 763, 823, 806 ], "page_idx": 5 }, { "type": "text", "text": "Evaluation metrics. Note that accurately evaluating 3D generation remains an open problem in the field. In this work, we eschew the use of a singular 3D ground truth due to the inherent ambiguity in deriving 3D structures from a single image. Instead, we adhere to the metrics employed in the most prior studies (Xu et al., 2023; Melas-Kyriazi et al., 2023), namely PSNR, LPIPS (Zhang et al., 2018), and CLIP-similarity (Radford et al., 2021). PSNR and LPIPS are gauged in the reference view to measure reconstruction quality and perceptual similarity. CLIP-similarity calculates an average CLIP distance between the 100 rendered image and the reference image to measure 3D consistency through appearance similarity across novel views and the reference view.", "bbox": [ 169, 811, 826, 925 ], "page_idx": 5 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 5 }, { "type": "page_number", "text": "6", "bbox": [ 493, 948, 504, 959 ], "page_idx": 5 }, { "type": "image", "img_path": "images/af45a21bc365492dd5b59bab68ac208f261259bcaf90269ef6c19593af6af960.jpg", "image_caption": [ "Figure 5: Qualitative comparisons on image-to-3D generation. We compare Magic123 to recent methods (Point-E (Nichol et al., 2022), ShapeE (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), RealFusion (Melas-Kyriazi et al., 2023), and Zero-1-to-3 (Liu et al., 2023)) for generating 3D objects from a single unposed image (the leftmost column). We show results on the RealFusion15 dataset at the top, while the NeRF4 dataset comparisons are shown at the bottom." ], "image_footnote": [], "bbox": [ 171, 99, 826, 743 ], "page_idx": 6 }, { "type": "text", "text": "4.2 RESULTS", "text_level": 1, "bbox": [ 171, 853, 279, 867 ], "page_idx": 6 }, { "type": "text", "text": "Quantitative and qualitative comparisons. We compare Magic123 against the state-of-the-art PointE (Nichol et al., 2022), Shap-E (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), NeuralLift (Xu et al., 2023), RealFusion (Melas-Kyriazi et al., 2023) and Zero-1-to-3 (Liu et al., 2023) in", "bbox": [ 169, 881, 825, 925 ], "page_idx": 6 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 173, 32, 478, 47 ], "page_idx": 6 }, { "type": "page_number", "text": "7", "bbox": [ 493, 948, 504, 959 ], "page_idx": 6 }, { "type": "table", "img_path": "images/8a8924cf27232412201322cff1514c1c56c18cb9bd27052050c4721ed00c03eb.jpg", "table_caption": [ "Table 1: Magic123 results. We show quantitative results in terms of CLIP-Similarity↑ / PSNR↑ / LPIPS↓. The results are shown on the NeRF4 and Realfusion15 datasets, while bold reflects the best." ], "table_footnote": [], "table_body": "<table><tr><td>Dataset</td><td>Metrics\\Methods</td><td>Point-E</td><td>Shap-E</td><td>3DFuse</td><td>NeuralLift</td><td>RealFusion</td><td>Zero-1-to-3</td><td>Magic123 (Ours)</td></tr><tr><td rowspan=\"3\">NeRF4</td><td>CLIP-Similarity↑</td><td>0.48</td><td>0.60</td><td>0.60</td><td>0.52</td><td>0.38</td><td>0.62</td><td>0.80</td></tr><tr><td>PSNR↑</td><td>0.70</td><td>0.99</td><td>11.64</td><td>12.55</td><td>15.37</td><td>23.96</td><td>24.62</td></tr><tr><td>LPIPS↓</td><td>0.80</td><td>0.76</td><td>0.29</td><td>0.40</td><td>0.20</td><td>0.05</td><td>0.03</td></tr><tr><td rowspan=\"3\">RealFusion15</td><td>CLIP-Similarity↑</td><td>0.53</td><td>0.59</td><td>0.67</td><td>0.65</td><td>0.67</td><td>0.75</td><td>0.82</td></tr><tr><td>PSNR↑</td><td>0.98</td><td>1.23</td><td>10.32</td><td>11.08</td><td>18.87</td><td>19.49</td><td>19.50</td></tr><tr><td>LPIPS↓</td><td>0.78</td><td>0.74</td><td>0.38</td><td>0.39</td><td>0.14</td><td>0.11</td><td>0.10</td></tr></table>", "bbox": [ 173, 141, 823, 233 ], "page_idx": 7 }, { "type": "text", "text": "both NeRF4 and RealFusion15 datasets. For Zero-1-to-3, we adopt the implementation from (Tang, 2022), which yields better performance than the original implementation. For other works, we use their officially released code. All baselines and Magic123 are run with their default settings. As shown in Table 1, Magic123 achieves Top-1 performance across all the metrics in both datasets when compared to previous approaches. It is worth noting that the PSNR and LPIPS results demonstrate significant improvements over the baselines, highlighting the exceptional reconstruction performance of Magic123. The improvement of CLIP-Similarity reflects the great 3D coherence regards to the reference view. Qualitative comparisons are available in Fig. 5. Magic123 achieves the best results in terms of both geometry and texture. Note how Magic123 greatly outperforms the 3D-based zero-1-to-3 (Liu et al., 2023) especially in complex objects like the dragon statue and the colorful teapot in the first two rows, while at the same time greatly outperforming 2D-based RealFusion (Melas-Kyriazi et al., 2023) in all examples. This performance demonstrates the superiority of Magic123 over the state-of-the-art and its ability to generate high-quality 3D content.", "bbox": [ 169, 258, 826, 441 ], "page_idx": 7 }, { "type": "text", "text": "4.3 ABLATION AND ANALYSIS", "text_level": 1, "bbox": [ 171, 457, 398, 470 ], "page_idx": 7 }, { "type": "text", "text": "Magic123 introduces a coarse-to-fine pipeline for single image reconstruction and a joint 2D and 3D prior for novel view guidance. We provide analysis and ablation studies to show their effectiveness.", "bbox": [ 169, 483, 823, 513 ], "page_idx": 7 }, { "type": "text", "text": "The effect of the coarse-to-fine pipeline is shown in Fig. 6. A consistent improvement in quantitative performance is observed throughout different setups when the fine stage is used. The use of a textured mesh DMTet representation enables higher quality 3D content that fits the objective and produces more compelling and higher resolution 3D visuals. Qualitative ablation for the coarse-to-fine pipeline is available in §C.2.", "bbox": [ 169, 518, 825, 589 ], "page_idx": 7 }, { "type": "text", "text": "Combining both 2D and 3D priors and the trade-off factor $\\lambda_{2D}$ . Fig. 6 demonstrates the effectiveness of the joint 2D and 3D prior quantitatively. In Fig. 7, we further ablate the joint prior qualitatively and analyze the effectiveness of the trade-off hyperparameter $\\lambda_{2D}$ in Eqn 7. We start from $\\lambda_{2D} = 0$ to use only the 3D prior and gradually increase $\\lambda_{2D}$ to $0.1, 0.5, 1.0, 2, 5$ , and finally to use only the 2D prior with $\\lambda_{2D} = 1$ and $\\lambda_{3D} = 0$ (we also denote this case as $\\lambda_{2D} = \\infty$ for coherence). The key observations include: (1) Relying on a sole 3D prior results in consistent geometry (e.g. teddy bear) but falters in generating complex and uncommon objects, often rendering oversimplified geometry with minimal details (e.g. dragon statue); (2) Relying on a sole 2D prior significantly", "bbox": [ 169, 595, 826, 708 ], "page_idx": 7 }, { "type": "image", "img_path": "images/65255b88c1ef187c17183a6350198a83fd16d7debe8ec1ff366d8bbf4e3e2a81.jpg", "image_caption": [ "Figure 6: Ablation study (quantitative). We quantitatively compare using the coarse and fine stages in Magic123. In both setups, we ablate utilizing only 2D prior $(\\lambda_{2D} = 1,\\lambda_{3D} = 0)$ , utilizing only 3D prior $(\\lambda_{2D} = 0,\\lambda_{3D} = 40)$ , and utilizing a joint 2D and 3D prior $(\\lambda_{2D} = 1,\\lambda_{3D} = 40)$ ." ], "image_footnote": [], "bbox": [ 176, 734, 496, 873 ], "page_idx": 7 }, { "type": "image", "img_path": "images/196179bdcdcb503b77851b2d05f2ab600a0bac48d111ab43f7f25dc9676381c0.jpg", "image_caption": [], "image_footnote": [], "bbox": [ 500, 734, 821, 873 ], "page_idx": 7 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 7 }, { "type": "page_number", "text": "8", "bbox": [ 493, 948, 503, 959 ], "page_idx": 7 }, { "type": "image", "img_path": "images/257d7fa784e97bb163db7b662f65e940aec46e63f5b03bac00ffc45c9fec64cb.jpg", "image_caption": [ "Figure 7: Setting $\\lambda_{2D}$ . We study the effects of $\\lambda_{2D}$ on Magic123. Increasing $\\lambda_{2D}$ leads to a 3D geometry with higher imagination and more details but less 3D consistencies and vice versa. $\\lambda_{2D} = 1$ provides a good balance and thus is used as default throughout all experiments." ], "image_footnote": [], "bbox": [ 204, 101, 787, 284 ], "page_idx": 8 }, { "type": "text", "text": "improves performance in conjuring complex scenes like the dragon statue but simultaneously triggers 3D inconsistencies such as the Janus problem in the bear; (3) As $\\lambda_{2D}$ escalates, the imaginative prowess of Magic123 is enhanced and more details become evident, but there is a tendency to compromise 3D consistency. We assign $\\lambda_{2D} = 1$ as the default value for all examples. $\\lambda_{2D}$ could also be fine-tuned for even better results on certain inputs.", "bbox": [ 169, 371, 823, 441 ], "page_idx": 8 }, { "type": "text", "text": "5 CONCLUSION AND DISCUSSION", "text_level": 1, "bbox": [ 171, 470, 468, 484 ], "page_idx": 8 }, { "type": "text", "text": "This work presents Magic123, a coarse-to-fine solution for generating high-quality, textured 3D meshes from a single image. By leveraging a joint 2D and 3D prior, Magic123 achieves a performance that is not reachable in a sole 2D or 3D prior-based solution and sets the new state of the art in image-to-3D generation. A trade-off parameter between the 2D and 3D priors allows for control over the generalizability and the 3D consistency. Magic123 outperforms previous techniques in terms of both realism and level of detail, as demonstrated through extensive experiments on real-world images and synthetic benchmarks. Our findings contribute to narrowing the gap between human abilities in 3D reasoning and those of machines, and pave the way for future advancements in single-image 3D reconstruction. The availability of our code, models, and generated 3D assets will further facilitate research and applications in this field.", "bbox": [ 169, 506, 823, 645 ], "page_idx": 8 }, { "type": "text", "text": "Limitation. One limitation is that Magic123 might suffer from inconsistent texture and inaccurate geometry due to incomplete information from a single image. Specially, a clear inconsistency appers in the boundary mostly because of blended foreground and background along the boundary segmentation errors. A texture consistency loss might be helpful. Similar to previous work, Magic123 also tends to generate over-saturated textures due to the usage of the SDS loss. The over-saturation issue becomes more severe for the second stage because of the higher resolution. See examples in Fig. 5 for these failure cases: the incomplete foot of the bear, the inconsistent texture between the front (pink color) and back views (less pink) of the donuts, the round shape of the drums, and the oversaturated color of the hoarse and the chair. Similar to other per-prompt optimization methods, Magic123 also takes around 1 hour to get a 3D model and with limited diversity. This time can be reduced through (1) replacing to Gaussian Splatting in stage 1 as shown in (Tang et al., 2023a), and (2) sampling from a small range of time steps in stage 2, following the suggestions of ICLR reviewers. The diversity issue might be possible to alleviate through VDS (Wang et al., 2023b) or training with prior guidance plus diverse 3D data.", "bbox": [ 169, 652, 826, 847 ], "page_idx": 8 }, { "type": "text", "text": "Acknowledgement. The authors would like to thank Xiaoyu Xiang for the insightful discussion and Dai-Jie Wu for sharing Point-E and Shap-E results. This work was supported by the KAUST Office of Sponsored Research through the Visual Computing Center funding, as well as, the SDAIA-KAUST Center of Excellence in Data Science and Artificial Intelligence (SDAIA-KAUST AI). Part of the support is also coming from KAUST Ibn Rushd Postdoc Fellowship program.", "bbox": [ 169, 854, 823, 925 ], "page_idx": 8 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 8 }, { "type": "page_number", "text": "9", "bbox": [ 493, 948, 503, 959 ], "page_idx": 8 }, { "type": "text", "text": "REFERENCES", "text_level": 1, "bbox": [ 174, 102, 287, 117 ], "page_idx": 9 }, { "type": "list", "sub_type": "ref_text", "list_items": [ "Jonathan T Barron, Ben Mildenhall, Matthew Tancik, Peter Hedman, Ricardo Martin-Brualla, and Pratul P Srinivasan. Mip-nerf: A multiscale representation for anti-aliasing neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5855-5864, 2021.", "Jonathan T Barron, Ben Mildenhall, Dor Verbin, Pratul P Srinivasan, and Peter Hedman. Mip-nerf 360: Unbounded anti-aliased neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5470-5479, 2022.", "Volker Blanz and Thomas Vetter. Face recognition based on fitting a 3d morphable model. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 25(9):1063-1074, 2003.", "James Booth, Anastasios Roussos, Stefanos Zafeiriou, Allan Ponniah, and David Dunaway. A 3d morphable model learnt from 10,000 faces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5543-5552, 2016.", "Shengqu Cai, Anton Obukhov, Dengxin Dai, and Luc Van Gool. Pix2nerf: Unsupervised conditional p-gan for single image to neural radiance fields translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3981-3990, June 2022.", "Eric R Chan, Connor Z Lin, Matthew A Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas J Guibas, Jonathan Tremblay, Sameh Khamis, et al. Efficient geometry-aware 3d generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16123-16133, 2022.", "Dave Zhenyu Chen, Yawar Siddiqui, Hsin-Ying Lee, Sergey Tulyakov, and Matthias Nießner. Text2tex: Text-driven texture synthesis via diffusion models. arXiv preprint arXiv:2303.11396, 2023a.", "Rui Chen, Yongwei Chen, Ningxin Jiao, and Kui Jia. *Fantasia3d: Disentangling geometry and appearance for high-quality text-to-3d content creation.* arXiv preprint arXiv:2303.13873, 2023b.", "Yen-Chi Cheng, Hsin-Ying Lee, Sergey Tulyakov, Alexander G Schwing, and Liang-Yan Gui. Sdfusion: Multimodal 3d shape completion, reconstruction, and generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.", "Matt Deitke, Ruoshi Liu, Matthew Wallingford, Huong Ngo, Oscar Michel, Aditya Kusupati, Alan Fan, Christian Laforte, Vikram Voleti, Samir Yitzhak Gadre, Eli VanderBilt, Aniruddha Kembhavi, Carl Vondrick, Georgia Gkioxari, Kiana Ehsani, Ludwig Schmidt, and Ali Farhadi. Objverse-xl: A universe of $10\\mathrm{m} + 3\\mathrm{d}$ objects. arXiv preprint arXiv:2307.05663, 2023a.", "Matt Deitke, Dustin Schwenk, Jordi Salvador, Luca Weihs, Oscar Michel, Eli VanderBilt, Ludwig Schmidt, Kiana Ehsani, Aniruddha Kembhavi, and Ali Farhadi. Objverse: A universe of annotated 3d objects. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13142-13153, 2023b.", "Yilun Du, Cameron Smith, Ayush Tewari, and Vincent Sitzmann. Learning to render novel views from wide-baseline stereo pairs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.", "Shivam Duggal and Deepak Pathak. Topologically-aware deformation fields for single-view 3d reconstruction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1536-1546, 2022.", "Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H. Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. In International Conference on Learning Representations (ICLR), 2023.", "Lukas Hollein, Ang Cao, Andrew Owens, Justin Johnson, and Matthias Nießner. Text2room: Extracting textured 3d meshes from 2d text-to-image models. arXiv preprint arXiv:2303.11989, 2023." ], "bbox": [ 171, 125, 828, 922 ], "page_idx": 9 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 9 }, { "type": "page_number", "text": "10", "bbox": [ 490, 946, 506, 959 ], "page_idx": 9 }, { "type": "list", "sub_type": "ref_text", "list_items": [ "Fangzhou Hong, Mingyuan Zhang, Liang Pan, Zhongang Cai, Lei Yang, and Ziwei Liu. Avatarclip: Zero-shot text-driven generation and animation of 3d avatars. arXiv preprint arXiv:2205.08535, 2022.", "Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5885-5894, 2021.", "Ajay Jain, Ben Mildenhall, Jonathan T Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 867-876, 2022.", "Heewoo Jun and Alex Nichol. Shap-e: Generating conditional 3d implicit functions. arXiv preprint arXiv:2305.02463, 2023.", "Angjoo Kanazawa, Shubham Tulsiani, Alexei A Efros, and Jitendra Malik. Learning category-specific mesh reconstruction from image collections. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 371-386, 2018.", "Abhishek Kar, Shubham Tulsiani, Joao Carreira, and Jitendra Malik. Category-specific object reconstruction from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1966-1974, 2015.", "Ira Kemelmacher-Shlizerman. Internet based morphable model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3256-3263, 2013.", "Mijeong Kim, Seonguk Seo, and Bohyung Han. Infonerf: Ray entropy minimization for few-shot neural volume rendering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12912-12921, 2022.", "Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pretraining for unified vision-language understanding and generation. In International Conference on Machine Learning, pp. 12888-12900. PMLR, 2022.", "Junnan Li, Dongxu Li, Silvio Savarese, and Steven C. H. Hoi. BLIP-2: bootstrapping language-image pre-training with frozen image encoders and large language models. In ICML, volume 202 of Proceedings of Machine Learning Research, pp. 19730-19742. PMLR, 2023.", "Chen-Hsuan Lin, Jun Gao, Luming Tang, Towaki Takikawa, Xiaohui Zeng, Xun Huang, Karsten Kreis, Sanja Fidler, Ming-Yu Liu, and Tsung-Yi Lin. Magic3d: High-resolution text-to-3d content creation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.", "Ruoshi Liu, Rundi Wu, Basile Van Hoorick, Pavel Tokmakov, Sergey Zakharov, and Carl Vondrick. Zero-1-to-3: Zero-shot one image to 3d object. arXiv preprint arXiv:2303.11328, 2023.", "Stephen Lombardi, Tomas Simon, Jason Saragih, Gabriel Schwartz, Andreas Lehrmann, and Yaser Sheikh. Neural volumes: Learning dynamic renderable volumes from images. arXiv preprint arXiv:1906.07751, 2019.", "Matthew Loper, Naureen Mahmood, Javier Romero, Gerard Pons-Moll, and Michael J Black. Smpl: A skinned multi-person linear model. ACM Transactions on Graphics (TOG), 34(6):1-16, 2015.", "Julieta Martinez, Rayat Hossain, Javier Romero, and James J Little. A simple yet effective baseline for 3d human pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2640-2649, 2017.", "Luke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: 360{\\deg} reconstruction of any object from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.", "Gal Metzer, Elad Richardson, Or Patashnik, Raja Giryes, and Daniel Cohen-Or. Latent-nerf for shape-guided generation of 3d shapes and textures. arXiv preprint arXiv:2211.07600, 2022." ], "bbox": [ 171, 102, 826, 925 ], "page_idx": 10 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 10 }, { "type": "page_number", "text": "11", "bbox": [ 488, 946, 506, 960 ], "page_idx": 10 }, { "type": "list", "sub_type": "ref_text", "list_items": [ "Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2mesh: Text-driven neural stylization for meshes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.", "Aryan Mikaeili, Or Perel, Daniel Cohen-Or, and Ali Mahdavi-Amiri. Sked: Sketch-guided text-based 3d editing. arXiv preprint arXiv:2303.10735, 2023.", "Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 405-421. Springer, 2020.", "Nasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Tiberiu Popa. Clip-mesh: Generating textured meshes from text using pretrained image-text models. In SIGGRAPH Asia 2022 Conference Papers, pp. 1-8, 2022.", "Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. In ACM Transactions on Graphics (SIGGRAPH), 2022.", "Alex Nichol, Heewoo Jun, Prafulla Dhariwal, Pamela Mishkin, and Mark Chen. Point-e: A system for generating 3d point clouds from complex prompts. arXiv preprint arXiv:2212.08751, 2022.", "Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Text-driven manipulation of stylegan imagery. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2085–2094, 2021.", "Georgios Pavlakos, Vasileios Choutas, Nima Ghorbani, Timo Bolkart, Ahmed AA Osman, Dimitrios Tzionas, and Michael J Black. Expressive body capture: 3d hands, face, and body from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10975-10985, 2019.", "Ben Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. International Conference on Learning Representations (ICLR), 2022.", "Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8748-8763. PMLR, 2021.", "Amit Raj, Srinivas Kaza, Ben Poole, Michael Niemeyer, Nataniel Ruiz, Ben Mildenhall, Shiran Zada, Kfir Aberman, Michael Rubinstein, Jonathan Barron, et al. Dreambooth3d: Subject-driven text-to-3d generation. arXiv preprint arXiv:2303.13508, 2023.", "Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8821-8831. PMLR, 2021.", "René Ranftl, Katrin Lasinger, David Hafner, Konrad Schindler, and Vladlen Koltun. Towards robust monocular depth estimation: Mixing datasets for zero-shot cross-dataset transfer. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 44(3):1623-1637, 2020.", "René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 12159-12168, 2021.", "Elad Richardson, Gal Metzer, Yuval Alaluf, Raja Giryes, and Daniel Cohen-Or. Texture: Text-guided texturing of 3d shapes. arXiv preprint arXiv:2302.01721, 2023.", "Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10684-10695, 2022." ], "bbox": [ 171, 102, 826, 924 ], "page_idx": 11 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 11 }, { "type": "page_number", "text": "12", "bbox": [ 488, 946, 506, 959 ], "page_idx": 11 }, { "type": "list", "sub_type": "ref_text", "list_items": [ "Chitwan Sahara, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Information Processing Systems (NeurIPS), 35:36479-36494, 2022.", "Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021.", "Junyoung Seo, Wooseok Jang, Min-Seop Kwak, Jaehoon Ko, Hyeonsu Kim, Junho Kim, Jin-Hwa Kim, Jiyoung Lee, and Seungryong Kim. Let 2d diffusion model know 3d-consistency for robust text-to-3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.", "Tianchang Shen, Jun Gao, Kangxue Yin, Ming-Yu Liu, and Sanja Fidler. Deep marching tetrahedra: a hybrid representation for high-resolution 3d shape synthesis. In Advances in Neural Information Processing Systems (NeurIPS), volume 34, pp. 6087-6101, 2021.", "Aliaksandr Siarohin, Willi Menapace, Ivan Skorokhodov, Kyle Olszewski, Hsin-Ying Lee, Jian Ren, Mengei Chai, and Sergey Tulyakov. Unsupervised volumetric animation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.", "Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proceedings of the International Conference on Machine Learning (ICML), pp. 2256-2265. PMLR, 2015.", "Jingxiang Sun, Xuan Wang, Yichun Shi, Lizhen Wang, Jue Wang, and Yebin Liu. Ide-3d: Interactive disentangled editing for high-resolution 3d-aware portrait synthesis. ACM Transactions on Graphics (TOG), 41(6):1-10, 2022. doi: 10.1145/3550454.3555506.", "Andrea Tagliausacchi and Ben Mildenhall. Volume rendering digest (for nerf). arXiv preprint arXiv:2209.02417, 2022.", "Jiaxiang Tang. Stable-dreamfusion: Text-to-3d with stable-diffusion, 2022. https://github.com/ashawkey/stable-dreamfusion.", "Jiaxiang Tang, Jiawei Ren, Hang Zhou, Ziwei Liu, and Gang Zeng. Dreamgaussian: Generative gaussian splatting for efficient 3d content creation. arXiv preprint arXiv:2309.16653, 2023a.", "Junshu Tang, Tengfei Wang, Bo Zhang, Ting Zhang, Ran Yi, Lizhuang Ma, and Dong Chen. Make-it-3d: High-fidelity 3d creation from a single image with diffusion prior. arXiv preprint arXiv:2303.14184, 2023b.", "Haochen Wang, Xiaodan Du, Jiahao Li, Raymond A Yeh, and Greg Shakhnarovich. Score jacobian chaining: Lifting pretrained 2d diffusion models for 3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023a.", "Nanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, and Yu-Gang Jiang. Pixel2mesh: Generating 3d mesh models from single rgb images. In Proceedings of the European conference on computer vision (ECCV), pp. 52-67, 2018.", "Zhengyi Wang, Cheng Lu, Yikai Wang, Fan Bao, Chongxuan Li, Hang Su, and Jun Zhu. Prolificdreamer: High-fidelity and diverse text-to-3d generation with variational score distillation. arXiv preprint arXiv:2305.16213, 2023b.", "Daniel Watson, William Chan, Ricardo Martin-Brualla, Jonathan Ho, Andrea Tagliasacchi, and Mohammad Norouzi. Novel view synthesis with diffusion models. In International Conference on Learning Representations (ICLR), 2023.", "Shangzhe Wu, Christian Rupprecht, and Andrea Vedaldi. Unsupervised learning of probably symmetric deformable 3d objects from images in the wild. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020." ], "bbox": [ 171, 102, 826, 925 ], "page_idx": 12 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 12 }, { "type": "page_number", "text": "13", "bbox": [ 488, 946, 506, 959 ], "page_idx": 12 }, { "type": "list", "sub_type": "ref_text", "list_items": [ "Dejia Xu, Yifan Jiang, Peihao Wang, Zhiwen Fan, Yi Wang, and Zhangyang Wang. Neurallift-360: Lifting an in-the-wild 2d photo to a 3d object with $360\\{\\backslash \\mathrm{deg}\\}$ views. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.", "Jiale Xu, Xintao Wang, Weihao Cheng, Yan-Pei Cao, Ying Shan, Xiaohu Qie, and Shenghua Gao. Dream3d: Zero-shot text-to-3d synthesis using 3d shape prior and text-to-image diffusion models. arXiv preprint arXiv:2212.14704, 2022.", "Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4578-4587, 2021.", "Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023.", "Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2018." ], "bbox": [ 171, 102, 826, 339 ], "page_idx": 13 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 13 }, { "type": "page_number", "text": "14", "bbox": [ 490, 946, 506, 959 ], "page_idx": 13 }, { "type": "text", "text": "A IMPLEMENTATION DETAILS", "text_level": 1, "bbox": [ 171, 102, 437, 118 ], "page_idx": 14 }, { "type": "text", "text": "We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Both coarse and fine stages are optimized using Adam with 0.001 learning rate and no weight decay for 5,000 iterations. $\\lambda_{rgb}$ , $\\lambda_{mask}$ are set to 5,0.5 for both stages. $\\lambda_{2D}$ and $\\lambda_{3D}$ are set to 1 and 40 for the first stage and are lowered to 0.001 and 0.01 in the second stage for refinement to alleviate oversaturated textures. We adopt the Stable Diffusion (Sohl-Dickstein et al., 2015) model of V1.5 as the 2D prior. The guidance scale of the 2D prior is set to 100 following (Poole et al., 2022). For the 3D prior, Zero-1-to-3 (Liu et al., 2023) (105,000 iterations finetuned version) is leveraged. The guidance scale of Zero-1-to-3 is set to 5 following (Liu et al., 2023). The NeRF backbone is implemented by three layers of multi-layer perceptrons with 64 hidden dims. Regarding lighting and shading, we keep nearly the same as (Poole et al., 2022). The difference is we set the first 1,000 iterations in the first stage to normals' shading to focus on learning geometry as inspired by (Chen et al., 2023b). For other iterations as well as the fine stage, we use diffuse shading with a probability 0.75 and textureless shading with a probability 0.25. The rendering resolutions are set to $128\\times 128$ and $1024\\times 1024$ for the coarse and the fine stage, respectively. For both stages, we use depth regularization and normal smoothness regularization with $\\lambda_d = 0.001$ and $\\lambda_n = 0.5$ . Following the standard practice (Barron et al., 2021; Poole et al., 2022; Melas-Kyriazi et al., 2023), we additionally add the 0.001 entropy regularization and 0.01 orientation regularization in the NeRF stage. Our implementation is based on the Stable DreamFusion repo (Tang, 2022). The training of Magic123 takes roughly 1 hour on a 32G V100 GPU, while the coarse stage and the fine stage take 40 and 20 minutes, respectively.", "bbox": [ 169, 133, 826, 412 ], "page_idx": 14 }, { "type": "text", "text": "B CAMERA SETTINGS", "text_level": 1, "bbox": [ 171, 431, 372, 446 ], "page_idx": 14 }, { "type": "text", "text": "Frontal view setting. Since the reference image is unposed, our model assumes a frontal reference view ( $90^{\\circ}$ elevation and $0^{\\circ}$ azimuth) for simplicity. However, in real-world applications, these angles can be adjusted according to the input, either through intuitive estimation or camera pose detection. A simple tuning of the elevation angle can improve the benchmark performance of Magic123. For instance, in the chair example shown in Fig. II, altering the elevation angle from $90^{\\circ}$ to $60^{\\circ}$ addresses squeezed reconstruction of the chair. For research purposes, we propose to exclude this camera estimation as it does not impact the comparison between different methods and only requires engineering efforts in application.", "bbox": [ 169, 462, 826, 575 ], "page_idx": 14 }, { "type": "text", "text": "Rendering camera setting. We set the camera parameters for the rendering as follows. The camera is placed 1.8 meters from the coordinate origin, i.e. the radial distance is 1.8. The field of view (FOV) of the camera is $40^{\\circ}$ . We highlight that the 3D reconstruction performance is not sensitive to camera parameters, as long as they are reasonable, e.g. FOV between 20 and 60, and radial distance between 1 to 4 meters. In Fig. II, we validate that using the same camera parameters as RealFusion (Melas-Kyriazi et al., 2023) that is different from ours, i.e. camera radius [1.0, 1.5] and FOV [40, 70], achieves results without obvious differences as ours.", "bbox": [ 169, 580, 826, 679 ], "page_idx": 14 }, { "type": "text", "text": "C MORE ANALYSIS AND ABLATION STUDIES", "text_level": 1, "bbox": [ 171, 698, 568, 714 ], "page_idx": 14 }, { "type": "text", "text": "C.1 ABLATION AND ANALYSIS ON THE USAGE OF 2D AND 3D PRIORS", "text_level": 1, "bbox": [ 171, 729, 671, 744 ], "page_idx": 14 }, { "type": "text", "text": "3D priors only. We first turn off the guidance of 2D prior by setting $\\lambda_{2D} = 0$ , such that we only use the 3D-aware diffusion prior Zero-1-to-3 Liu et al. (2023).", "bbox": [ 169, 756, 823, 785 ], "page_idx": 14 }, { "type": "text", "text": "Note that Zero-1-to-3 in our paper (results in Tab. 1, Fig. 5) denotes our improved reimplemented Zeo-1-to-3 using the same training configurations as Magic123. i.e. Zero-1-to-3 in our paper refers to the first stage results of Maigc123 3D prior only (Fig. 2, 6, 7), where both of them use second stage DMTet fine-tuning for fair comparison.", "bbox": [ 169, 790, 825, 848 ], "page_idx": 14 }, { "type": "text", "text": "Furthermore, we study the effects of $\\lambda_{3D}$ by performing a grid search and evaluate the image-to-3D reconstruction performance, where $\\lambda_{3D} = 5, 10, 20, 40, 60, 80$ . Interestingly, we find that Zero-1-to-3 is very robust to the change of $\\lambda_{3D}$ . Tab. I demonstrates that different $\\lambda_{3D}$ leads to a consistent quantitative result. We thus simply set $\\lambda_{3D} = 40$ throughout the experiments since it achieves a slightly better CLIP-similarity score than other values.", "bbox": [ 169, 854, 828, 925 ], "page_idx": 14 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 14 }, { "type": "page_number", "text": "15", "bbox": [ 488, 946, 508, 959 ], "page_idx": 14 }, { "type": "table", "img_path": "images/f1a5f6d5dfa383fc69c6c33bbc53412a6208345274c8fcf747716e870f7ecb65.jpg", "table_caption": [ "Table I: Effects of $\\lambda_{3D}$ and $\\lambda_{2D}$ in Magic123 using only 2D or 3D prior on NeRF4 dataset." ], "table_footnote": [], "table_body": "<table><tr><td></td><td colspan=\"5\">varying λ3D when λ2D=0</td><td colspan=\"3\">varying λ2D when λ3D=0</td></tr><tr><td></td><td>10</td><td>20</td><td>40</td><td>60</td><td>80</td><td>0.1</td><td>1</td><td>2</td></tr><tr><td>CLIP-similarity↑</td><td>0.58</td><td>0.61</td><td>0.62</td><td>0.61</td><td>0.58</td><td>0.54</td><td>0.60</td><td>0.72</td></tr><tr><td>PSNR↑</td><td>23.96</td><td>24.05</td><td>23.96</td><td>23.75</td><td>23.34</td><td>23.62</td><td>24.11</td><td>22.42</td></tr><tr><td>LPIPS↓</td><td>0.04</td><td>0.04</td><td>0.05</td><td>0.06</td><td>0.08</td><td>0.04</td><td>0.04</td><td>0.07</td></tr></table>", "bbox": [ 220, 127, 776, 205 ], "page_idx": 15 }, { "type": "image", "img_path": "images/9c36887f8e80242cdaa0c3f0489484aea94a3b4059dbff8e0877ccd03bb72e5f.jpg", "image_caption": [ "Figure I: Ablation study (qualitative). We qualitatively compare the novel view renderings from the coarse and fine stages in Magic123. We ablate utilizing only 2D prior $(\\lambda_{2D} = 1, \\lambda_{3D} = 0)$ , only 3D prior $(\\lambda_{2D} = 0, \\lambda_{3D} = 40)$ , and a joint 2D and 3D prior $(\\lambda_{2D} = 1, \\lambda_{3D} = 40)$ . We also ablate the effects of textual inversion at the right." ], "image_footnote": [], "bbox": [ 173, 220, 823, 348 ], "page_idx": 15 }, { "type": "text", "text": "2D priors only. We then turn off the 3D prior and study the effect of $\\lambda_{2D}$ . As shown in Tab. I, the image-to-3D system is sensitive to the weights of the 2D prior. With the increase of $\\lambda_{2D}$ , a sharp increase in CLIP similarity and a drop in PSNR are observed. This is because a larger 2D prior weight leads to more imagination, which unfortunately might result in 3D inconsistency. Due to the observation that the 3D prior is more robust than the 2D prior to the weight, we use $\\lambda_{2D}$ as the tradeoff parameter to control the imagination and 3D consistency.", "bbox": [ 169, 446, 823, 532 ], "page_idx": 15 }, { "type": "text", "text": "C.2 ABLATION ON THE COARSE-TO-FINE PIPELINE", "text_level": 1, "bbox": [ 171, 547, 545, 561 ], "page_idx": 15 }, { "type": "text", "text": "In §4.3 we ablate the effect of the coarse-to-fine pipeline quantitatively. Here we provide the visual comparisons in Fig. I. The fine stage consistently augments the sharpness of the rendering and the geometry and texture details. See the edge of the wings and claws of the dragon and the toppings of the donuts for examples.", "bbox": [ 169, 573, 823, 630 ], "page_idx": 15 }, { "type": "text", "text": "C.3 ABLATE THE REGULARIZATION", "text_level": 1, "bbox": [ 171, 646, 434, 659 ], "page_idx": 15 }, { "type": "text", "text": "Magic123 is optimized additionally by depth regularization, normal smoothness regularization, entropy regularization, and orientation regularization, with weights of 0.01, 0.5, 0.001, and 0.01, respectively. In Fig. II, we show that the depth, the entropy, and the orientation regularizations have minimal impact on the image-to-3D reconstruction performance. However, we keep them in our implementation as they are common practices in the NeRF family. The normal smoothness is more important in alleviating the high-frequency noise.", "bbox": [ 169, 671, 826, 756 ], "page_idx": 15 }, { "type": "text", "text": "C.4 ABLATE THE TEXTUAL INVERSION", "text_level": 1, "bbox": [ 171, 773, 457, 786 ], "page_idx": 15 }, { "type": "text", "text": "We use textual inversion in both stages for consistent geometry and texture with the input reference image. Fig. I we additionally ablate the effects of textural inversion by removing it and using pure texts in the guidance. In the two examples, we change the prompts from \"A high-resolution DSLR image of $<e>$ \" to \"A high-resolution DSLR image of a metal dragon statue\", and \"A high-resolution DSLR image of two donuts\", respectively. As observed, textual inversion has marginal effects on the image-to-3D reconstruction performance. However, it helps with keeping the consistency between the input image and the generated 3D content. Without textual inversion, the dragon with a different style of horns and golden textures appears that is not consistent with the input image. The donuts without textual inversion have distinct toppings from the input image.", "bbox": [ 169, 799, 823, 925 ], "page_idx": 15 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 171, 32, 478, 47 ], "page_idx": 15 }, { "type": "page_number", "text": "16", "bbox": [ 488, 948, 508, 959 ], "page_idx": 15 }, { "type": "image", "img_path": "images/4f43003bb5bf861ae9a57aba18463214057e79dea89c13805c462548236be8cb.jpg", "image_caption": [ "Figure II: Qualitative ablation study for the effects of depth regularization, normal smoothness, entropy and orientation regularization, camera parameters, and the front-view assumption (elevation angle). Normal smoothness reduces high-frequency noise. Other factors like depth, entropy, and orientation regularization exert minimal influence on image-to-3D reconstruction results but are maintained in Magic123, adhering to common practice. Using different camera parameters, including camera radius (1.8 meters v.s. [1.0, 1.5] in RealFusion) and field of view (40 v.s. [40, 70] in RealFusion), have a marginal impact on performance. Magic123 opts for a simple configuration, setting the camera radius to 1.8 meters and the FOV to 40. Setting the elevation angle from $90^{\\circ}$ to a reasonable value also improves reconstruction quality (see the chair example)." ], "image_footnote": [], "bbox": [ 173, 99, 823, 218 ], "page_idx": 16 }, { "type": "text", "text": "D MORE COMPARASIONS", "text_level": 1, "bbox": [ 171, 378, 403, 393 ], "page_idx": 16 }, { "type": "text", "text": "Here, we additionally compare Magic123 with most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b). Magic123 outperforms all of them in terms of both 3D geometry and texture quality by a large margin.", "bbox": [ 169, 410, 826, 453 ], "page_idx": 16 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 173, 32, 478, 47 ], "page_idx": 16 }, { "type": "page_number", "text": "17", "bbox": [ 488, 946, 506, 959 ], "page_idx": 16 }, { "type": "image", "img_path": "images/9faf50b3233253f8aa25dd8d13dacdf5745fb2aac0a68e07ed06744f81539a5f.jpg", "image_caption": [ "Figure III: Qualitative comparisons. We compare Magic123 to the most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b)." ], "image_footnote": [], "bbox": [ 196, 99, 799, 898 ], "page_idx": 17 }, { "type": "header", "text": "Published as a conference paper at ICLR 2024", "bbox": [ 173, 32, 478, 47 ], "page_idx": 17 }, { "type": "page_number", "text": "18", "bbox": [ 490, 946, 508, 960 ], "page_idx": 17 }]123version https://git-lfs.github.com/spec/v1oid sha256:0911036c129705988aa3ea3b31f2f8586a182a6ac8633de46f3a56af18c0a554size 26332754123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300# MAGIC123: ONE IMAGE TO HIGH-QUALITY 3D OBJECT GENERATION USING BOTH 2D AND 3D DIFFUSION PRIORS
Guocheng Qian $^{1,2}$ , Jinjie Mai $^{1}$ , Abdullah Hamdi $^{3}$ , Jian Ren $^{2}$ , Aliaksandr Siarohin $^{2}$ , Bing Li $^{1}$ , Hsin-Ying Lee $^{2}$ , Ivan Skorokhodov $^{1}$ , Peter Wonka $^{1}$ , Sergey Tulyakov $^{2}$ , Bernard Ghanem $^{1}$
$^{1}$ King Abdullah University of Science and Technology (KAUST), $^{2}$ Snap Inc.
3Visual Geometry Group, University of Oxford
{guocheng.qian,bernard.ghanem}@kaust.edu.sa
 Figure 1: Magic123 can reconstruct high-fidelity 3D content with detailed geometry and high-resolution renderings (1024 × 1024) from a single image in the wild. Visit https://guochengqian.github.io/project/magic123/ for immersive visualizations and code.
# ABSTRACT
We present "Magic123", a two-stage coarse-to-fine approach for high-quality, textured 3D mesh generation from a single image in the wild using both 2D and 3D priors. In the first stage, we optimize a neural radiance field to produce a coarse geometry. In the second stage, we adopt a memory-efficient differentiable mesh representation to yield a high-resolution mesh with a visually appealing texture. In both stages, the 3D content is learned through reference-view supervision and novel-view guidance by a joint 2D and 3D diffusion prior. We introduce a trade-off parameter between the 2D and 3D priors to control the details and 3D consistencies of the generation. Magic123 demonstrates a significant improvement over previous image-to-3D techniques, as validated through extensive experiments on diverse synthetic and real-world images.
# 1 INTRODUCTION
3D reconstruction from a single image (image-to-3D) is challenging because it is an undetermined problem. A typical image-to-3D system optimizes a 3D representation such as neural radiance field (NeRF) (Mildenhall et al., 2020), where the reference view and random novel views are differentially rendered during training. While the reference view can be optimized to match the input, there is no available supervision for the novel views. Due to this ill-posed nature, the primary focus of image-to-3D is how to leverage priors to guide the novel view reconstruction.
 Figure 2: The effects of the joint 2D and 3D priors. We compare image-to-3D in three cases: a teddy bear (common object), two stacked donuts (less common object), and a dragon statue (uncommon object). Magic123 with a sole 3D prior (on the left) yields consistent yet potentially simplified 3D with reduced shape and texture details due to its low generalizability. Magic123 with a sole 2D prior (on the right) shows a strong generalizability in producing content with high details while potentially lacking 3D consistency. Magic123 proposes to use a joint 2D and 3D prior that consistently offers identity-preserving 3D with fine-grained geometry and visually appealing texture.
Current mainstream image-to-3D systems such as NeuralLift (Xu et al., 2023) and RealFusion (Melas-Kyriazi et al., 2023) employ 2D priors, e.g. text-to-image diffusion models (Rombach et al., 2022; Sahara et al., 2022), for 3D reconstruction. The novel views are guided by the 2D priors using text prompts associated with the input image by captioning (Li et al., 2022; 2023) or textual inversion (Gal et al., 2023). Without any 3D data, 2D prior-based solutions can distill 2D knowledge for 3D generation in a zero-shot fashion through score distillation sampling (SDS) (Poole et al., 2022). Thanks to the billion-scale training dataset (Schuhmann et al., 2021), 2D priors have been showing strong generalizability in 3D generation (Poole et al., 2022; Lin et al., 2023): successfully yielding detailed 3D content respecting various prompts. However, methods relying on 2D priors alone inevitably compromise on 3D consistency due to their restricted 3D knowledge. This leads to low-fidelity 3D generation, such as yielding multiple faces (Janus problems), mismatched sizes, and inconsistent texture. Fig.2 (right column) shows failure cases of using only 2D priors: the multiple faces of the teddy bear (top row) and the two donuts merged into one at the back (middle row).
Another approach to image-to-3D is to employ 3D-aware priors<sup>1</sup>. Earlier attempts at 3D reconstruction leveraged geometric priors like topology constraints (Wang et al., 2018) and coarse 3D shapes (Michel et al., 2022) to assist in 3D generation. However, these manually crafted 3D priors fall short of generating high-quality 3D content for various prompts. Recently, approaches like 3Dim (Watson et al., 2023) and Zero-1-to-3 (Liu et al., 2023) trained/finetuned view-dependent diffusion models and utilized them as 3D priors for image-to-3D generation. Since trained in 3D data, these 3D priors are more effective in generating content with high 3D consistency. Unfortunately, (1) the scale of 3D datasets is small: the largest public dataset Objaverse-XL (Deitke et al., 2023a) only contains around 10M instances; (2) 3D datasets contain mostly limited-quality instances with simple shapes. Consequently, 3D priors are limited in generalizability and tend to generate simple geometry and texture. As illustrated in Fig.2, while a 3D prior-based solution effectively processes common objects (for instance, the teddy bear example in the top row), it struggles with less common ones, yielding oversimplified, sometimes even flat 3D geometry (e.g., dragon statue at bottom left).
In this paper, rather than solely relying on a 2D or a 3D prior, we advocate for the simultaneous use of both priors to guide novel views. By modulating the simple yet effective tradeoff parameter between the 2D and 3D priors, we can manage a balance between generalizability and 3D consistency in the generated 3D content. In many cases where both 2D prior and 3D prior fail due to low 3D consistency and low generalizability, the proposed joint 2D and 3D prior propose can produce 3D content with high fidelity. Refer to Fig.2 for comparisons. Contributions of this work is summarized as follows:
- We introduce Magic123, a novel coarse-to-fine pipeline for image-to-3D generation that uses a joint 2D and 3D prior to guide the novel views. - Using the exact same set of parameters for all examples without any additional reconfiguration, Magic123 achieves state-of-the-art image-to-3D results in both real-world and synthetic scenarios.
# 2 RELATED WORK
Multi-view 3D reconstruction. The development of Neural Radiance Fields (NeRF) (Mildenhall et al., 2020; Lombardi et al., 2019) has prompted a shift towards reconstructing 3D as volume radiance (Tagliasacchi & Mildenhall, 2022), enabling the synthesis of photo-realistic novel views (Barron et al., 2022). NeRF requires as many as 100 images to reconstruct a scene. Subsequent works have explored the optimization of NeRF in few-shot (e.g. (Jain et al., 2021; Kim et al., 2022; Du et al., 2023)) and one-shot (e.g. (Yu et al., 2021; Chan et al., 2022)) settings. However, these methods fail to generate $360^{\circ}$ 3D content due to the lack of strong priors for the missing novel-view information.
In-domain single-view 3D reconstruction. 3D reconstruction from a single view requires strong priors on the object geometry. Direct supervision in the form of 3D shape priors is a robust way to impose such constraints for a particular domain, like human heads (Blanz & Vetter, 2003; Booth et al., 2016), hands (Pavlakos et al., 2019) or full bodies (Loper et al., 2015; Martinez et al., 2017). Such supervision requires expensive 3D annotations and manual 3D prior creation. Thus several works explore unsupervised learning of 3D geometry from object-centric datasets (e.g. (Kanazawa et al., 2018; Duggal & Pathak, 2022; Kemelmacher-Shlizerman, 2013; Siarohin et al., 2023)). These methods are typically structured as auto-encoders (Wu et al., 2020; Kar et al., 2015; Cheng et al., 2023) or generators (Cai et al., 2022; Sun et al., 2022) with explicit 3D decomposition under the hood. Due to the lack of large-scale 3D data, in-domain 3D reconstruction is limited to simple shapes (e.g. chairs and cars) and cannot generalize to more complex or uncommon objects (e.g. dragons and statues).
Zero-shot single-view 3D reconstruction. Foundational multi-modal networks (Radford et al., 2021; Rombach et al., 2022) have enabled various zero-shot 3D synthesis tasks. Earlier works employed CLIP (Radford et al., 2021) guidance for 3D generation (Jain et al., 2022; Hong et al., 2022; Mohammad Khalid et al., 2022; Xu et al., 2022) and manipulation (Michel et al., 2022; Patashnik et al., 2021) from text prompts. Modern zero-shot text-to-image generators (Ramesh et al., 2021; Rombach et al., 2022; Sahara et al., 2022; Zhang et al., 2023) improve these results by providing stronger synthesis priors (Poole et al., 2022; Wang et al., 2023a; Metzer et al., 2022; Mikaeili et al., 2023). DreamFusion (Poole et al., 2022) is a seminal work that proposed to distill an off-the-shelf diffusion model into a NeRF for a given text query. It sparked numerous follow-up approaches to improve the quality (Lin et al., 2023; Chen et al., 2023b; Wang et al., 2023b; Chen et al., 2023a). image-to-3D reconstruction (Melas-Kyriazi et al., 2023; Tang et al., 2023b; Hollein et al., 2023; Richardson et al., 2023). Inspired by the success of text-to-3D, 2D diffusion priors were also applied to image-to-3D with additional reference view reconstruction loss (Melas-Kyriazi et al., 2023; Xu et al., 2023; Seo et al., 2023; Lin et al., 2023; Raj et al., 2023). Recently, (Watson et al., 2023; Liu et al., 2023) trained pose-dependent diffusion models that are 3D-aware and used them to improve the 3D consistency. However, they suffered from low generalizability and tended to generate oversimplified geometry due to the limited quality and the small scale of 3D datasets. Our work instead explores a joint 2D and 3D prior to balance the generalizability and 3D consistency.
# 3 METHODOLOGY
We propose Magic123, a coarse-to-fine pipeline for high-quality 3D object generation from a single reference image. Magic123 is supervised by the reference view reconstruction and guided by a joint 2D and 3D prior, as shown in Fig. 3.
 Figure 3: Magic123 pipeline. Magic123 is a two-stage coarse-to-fine framework for high-quality 3D generation from a single reference image. Magic123 is supervised by the reference image reconstruction and guided by a joint 2D and 3D diffusion prior. At the coarse stage, we optimize an Instant-NGP NeRF for a coarse geometry. At the fine stage, we initialize a DMTet differentiable mesh from the NeRF output and optimize it with high-resolution rendering $(1024 \times 1024)$ . Textural inversion is used in both stages to generate object-preserving geometry and view-consistent textures.
# 3.1 MAGIC123 PIPELINE
Image preprocessing. Magic123 is aimed at object-level image-to-3D generation. We leverage an off-the-shelf segmentation model, Dense Prediction Transformer (Ranftl et al., 2021), to segment the object. We denote the extracted binary segmentation mask M. To prevent flat geometry, we further extract the depth map by a pretrained depth estimator (Ranftl et al., 2020). The foreground image is used as the input, while the mask and the depth map are used in the optimization as regularization priors.
Coarse-to-fine pipeline. Inspired by the text-to-3D work Magic3D (Lin et al., 2023), Magic123 adopts a coarse-to-fine pipeline for image-to-3D optimization. The coarse stage of Magic123 is targeted at learning underlying geometry that respects the reference image. Due to its strong ability to handle complex topological changes in a smooth and continuous fashion, we adopt Instant-NGP (Müller et al., 2022). It only offers low-resolution renderings $(128 \times 128)$ during training because of memory-expensive volumetric rendering and possibly yields 3D shapes with noise due to its tendency to create high-frequency artifacts. Therefore, we introduce the fine stage that uses DMTet (Shen et al., 2021) to refine the coarse 3D model by the NeRF and to produce a high-resolution and disentangled geometry and texture. We use $1024 \times 1024$ rendering resolution in the fine stage, which is found to have a similar memory consumption to the coarse stage. To reconstruct 3D faithfully from a single image, we optimize the pipeline through (i) novel view guidance; (ii) reference view reconstruction supervision; (iii) two standard regularizations: depth regularization and normal smoothness.
Novel view guidance $\mathcal{L}_g$ is necessary to dream up the missing information. As a significant difference from previous works, we do not rely solely on a 2D prior or a 3D prior, but we leverage a joint 2D and 3D prior to optimize the novel views. See §3.2 for details.
Reference view reconstruction loss $\mathcal{L}_{rec}$ is to ensure the reference image $\mathbf{I}^r$ can be reconstructed from the reference viewpoint $(\mathbf{v}^r)$ . Mean squared error is adopted on both $\mathbf{I}^r$ and its mask as follows:
$$\mathcal {L} _ {r e c} = \lambda_ {r g b} \| \mathbf {M} \odot \left(\mathbf {I} ^ {r} - G _ {\theta} \left(\mathbf {v} ^ {r}\right)\right) \| _ {2} ^ {2} + \lambda_ {m a s k} \| \mathbf {M} - M \left(G _ {\theta} \left(\mathbf {v} ^ {r}\right)\right) \| _ {2} ^ {2}, \tag {1}$$
where $\theta$ are the NeRF parameters to be optimized, $\odot$ is the Hadamard product, $G_{\theta}(\mathbf{v}^r)$ is a NeRF rendered RGB image from the reference viewpoint, $M()$ is the foreground mask acquired by integrating the volume density along the ray of each pixel. Since the foreground object is extracted as input, we do not model any background and simply use pure white for the background rendering for all experiments. $\lambda_{rgb}$ and $\lambda_{mask}$ are the weights for the foreground RGB and the mask, respectively.
Depth regularization $\mathcal{L}_d$ is a standard tool to avoid overly-flat or caved-in 3D content (Xu et al., 2023; Tang et al., 2023b). We would like the depth $d$ from the reference viewpoint to be similar to
 Figure 4: 2D v.s. 3D Diffusion priors. Magic123 uses Stable Diffusion (Rombach et al., 2022) as the 2D prior and viewpoint-conditioned diffusion model Zero-1-to-3 (Liu et al., 2023) as the 3D prior.
the depth $d^r$ estimated by a pretrained depth estimator (Ranftl et al., 2020). Due to the mismatched values of $d$ and $d^r$ , we regularize them linearly through normalized negative Pearson correlation:
$$\mathcal {L} _ {d} = \frac {1}{2} \left[ 1 - \frac {\operatorname {c o v} (\mathbf {M} \odot d ^ {r} , \mathbf {M} \odot d)}{\sigma (\mathbf {M} \odot d ^ {r}) \sigma (\mathbf {M} \odot d)} \right], \tag {2}$$
where $\operatorname{cov}(\cdot)$ denotes covariance and $\sigma(\cdot)$ measures standard deviation.
Normal smoothness $\mathcal{L}_n$ is a common idea to reduce high-frequency artifacts. Finite differences of depth are used to estimate the normal map. Gaussian smoothness with a $9\times 9$ kernel is applied:
$$\mathcal {L} _ {n} = \left\| \mathbf {n} - \tau (g (\mathbf {n})) \right\|, \tag {3}$$
where $\tau (\cdot)$ denotes the stopgradient operation and $g(\cdot)$ is a Gaussian blur.
Overall, both the coarse and fine stages are optimized by a combination of losses:
$$\mathcal {L} _ {c} = \mathcal {L} _ {g} + \mathcal {L} _ {r e c} + \lambda_ {d} \mathcal {L} _ {d} + \lambda_ {n} \mathcal {L} _ {n}, \tag {4}$$
We note here that we empirically find the depth and normal regularization only have marginal affects to the final performance. We keep here as a standard practice.
# 3.2 NOVEL VIEW GUIDANCE: A JOINT 2D AND 3D PRIOR
2D priors. Using a single reference image is insufficient to optimize 3D. DreamFusion (Poole et al., 2022) proposes to use a 2D text-to-image diffusion model as the prior to guide the novel views via the proposed score distillation sampling (SDS) loss. SDS encodes the rendered view as latent, adds noise to it, and guesses the clean novel view conditioned on the input text prompt. Roughly speaking, SDS translates the rendered view into an image that respects both the content from the rendered view and the text. The SDS loss is illustrated in the upper part of Fig. 4 and is formulated as:
$$\nabla \mathcal {L} _ {2 D} \triangleq \mathbb {E} _ {t, \epsilon} \left[ w (t) \left(\epsilon_ {\phi} \left(\mathbf {z} _ {t}; \mathbf {e}, t\right) - \epsilon\right) \frac {\partial \mathbf {z}}{\partial \mathbf {I}} \frac {\partial \mathbf {I}}{\partial \theta} \right], \tag {5}$$
where $\mathbf{I}$ is a rendered view, and $\mathbf{z}_t$ is the noisy latent by adding a random Gaussian noise of a time step $t$ to the latent of $\mathbf{I}$ . $\epsilon, \epsilon_{\phi}, \phi, \theta$ are the added noise, predicted noise, parameters of the diffusion prior, and the parameters of the 3D model. $\theta$ can be MLPs of NeRF for the coarse stage, or SDF, triangular deformations, and color field for the fine stage. DreamFusion points out that the Jacobian term of the image encoder $\frac{\partial \mathbf{z}}{\partial \mathbf{I}}$ in Eq. equation 5 can be further eliminated, making the SDS loss much more efficient in terms of both speed and memory.
Textural inversion. Note the prompt e we use for each reference image is not a pure text chosen from tedious prompt engineering. Using pure text for image-to-3D generation sometimes results in inconsistent texture due to the limited expressiveness of the human language. For example, using "A high-resolution DSLR image of a colorful teapot" will generate different colors that do not respect the reference image. We thus follow RealFusion (Melas-Kyriazi et al., 2023) to leverage the same textual inversion (Gal et al., 2023) technique to acquire a special token $<e>$ to represent the object in the reference image. We use the same prompt for all examples: "A high-resolution DSLR image of $<e>$ ". We find that Stable Diffusion can generate an object with a more similar texture and style to the reference image with the textual inversion technique compared to the results without it.
3D prior. Using only the 2D prior is not sufficient to capture consistent 3D geometry due to its lack of 3D knowledge. Zero-1-to-3 (Liu et al., 2023) thus proposes a 3D(-aware) prior solution.
Zero-1-to-3 finetunes Stable Diffusion into a view-dependent version on Objaverse (Deitke et al., 2023b). Zero-1-to-3 takes a reference image and a viewpoint as input and can generate a novel view from the given viewpoint. Zero-1-to-3 thereby can be used as a strong 3D prior for 3D reconstruction. The usage of Zero-1-to-3 in an image-to-3D generation pipeline using SDS is formulated as:
$$\nabla \mathcal {L} _ {3 D} \triangleq \mathbb {E} _ {t, \epsilon} \left[ w (t) \left(\epsilon_ {\phi} \left(\mathbf {z} _ {t}; \mathbf {I} ^ {r}, t, R, T\right) - \epsilon\right) \frac {\partial \mathbf {I}}{\partial \theta} \right], \tag {6}$$
where $R, T$ are the camera poses passed to Zero-1-to-3. The difference between using the 3D prior and the 2D prior is illustrated in Fig. 4, where we show that the 2D prior uses text embedding as a condition while the 3D prior uses the reference view $\mathbf{I}^T$ with the novel view camera poses as conditions. The 3D prior utilizes camera poses to encourage 3D consistency and enable the usage of more 3D information compared to the 2D prior counterpart.
A joint 2D and 3D prior. We find that the 2D and 3D priors are complementary to each other. The 2D prior favors high imagination thanks to its strong generalizability stemming from the large-scale training dataset of diffusion models, but might lead to inconsistent geometry due to the lack of 3D knowledge. On the other hand, the 3D prior tends to generate consistent geometry but with simple shapes and less generalizability due to the small scale and the simple geometry of the 3D dataset. In the case of uncommon objects, the 3D prior might result in over-simplified geometry and texture. Instead of relying solely on a 2D or a 3D prior, we propose to use a joint 2D and 3D prior:
$$\nabla \mathcal {L} _ {g} \triangleq \mathbb {E} _ {t _ {1}, t _ {2}, \epsilon_ {1}, \epsilon_ {2}} \left[ w (t) \left[ \lambda_ {2 D} \left(\epsilon_ {\phi_ {2 D}} \left(\mathbf {z} _ {t _ {1}}; \mathbf {e}, t _ {1}\right) - \epsilon_ {1}\right) + \lambda_ {3 D} \left(\epsilon_ {\phi_ {3 D}} \left(\mathbf {z} _ {t _ {2}}; \mathbf {I} ^ {r}, t _ {2}, R, T\right) - \epsilon_ {2}\right) \right] \frac {\partial \mathbf {I}}{\partial \theta} \right] \tag {7}$$
where $\lambda_{2D}$ and $\lambda_{3D}$ determine the strength of 2D and 3D prior, respectively. Increasing $\lambda_{2D}$ leads to better generalizability, higher imagination, and more details, but less 3D consistencies. Increasing $\lambda_{3D}$ results in more 3D consistencies, but worse generalizability and fewer details. However, tuning two parameters at the same time is not user-friendly. Interestingly, through both qualitative and quantitative experiments, we find that Zero-1-to-3, the 3D prior we use, is much more tolerant to $\lambda_{3D}$ than Stable Diffusion to $\lambda_{2D}$ (see §C.1 for details). When only the 3D prior is used, i.e. $\lambda_{2D} = 0$ , Zero-1-to-3 generates consistent results for $\lambda_{3D}$ ranging from 10 to 60. On the contrary, Stable Diffusion is rather sensitive to $\lambda_{2D}$ . When setting $\lambda_{3D}$ to 0 and using the 2D prior only, the generated geometry varies a lot when $\lambda_{2D}$ is changed from 1 to 2. This observation leads us to fix $\lambda_{3D} = 40$ and to rely on tuning the $\lambda_{2D}$ to trade off the generalizability and 3D consistencies. We set $\lambda_{2D} = 1.0$ for all experiments, but this value can be tuned according to the user's preference. More details and discussions on the choice of 2D and 3D priors weights are available in Sec.4.3.
# 4 EXPERIMENTS
# 4.1 SETUPS
NeRF4. We use a NeRF4 dataset that we collect from 4 scenes, chair, drums, ficus, and microphone from the synthetic NeRF dataset (Mildenhall et al., 2020). These four scenes cover complex objects (drums and ficus), a hard case (the back view of the chair), and a simple case (the microphone).
RealFusion15. We further use the 15 natural images released by RealFusion (Melas-Kyriazi et al., 2023) that consists of both synthetic and real images in a broad range for evaluation.
Optimization details. We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Most training details and camera settings are set to the same as RealFusion (Melas-Kyriazi et al., 2023). See $\S A$ and $\S B$ for details, respectively.
Evaluation metrics. Note that accurately evaluating 3D generation remains an open problem in the field. In this work, we eschew the use of a singular 3D ground truth due to the inherent ambiguity in deriving 3D structures from a single image. Instead, we adhere to the metrics employed in the most prior studies (Xu et al., 2023; Melas-Kyriazi et al., 2023), namely PSNR, LPIPS (Zhang et al., 2018), and CLIP-similarity (Radford et al., 2021). PSNR and LPIPS are gauged in the reference view to measure reconstruction quality and perceptual similarity. CLIP-similarity calculates an average CLIP distance between the 100 rendered image and the reference image to measure 3D consistency through appearance similarity across novel views and the reference view.
 Figure 5: Qualitative comparisons on image-to-3D generation. We compare Magic123 to recent methods (Point-E (Nichol et al., 2022), ShapeE (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), RealFusion (Melas-Kyriazi et al., 2023), and Zero-1-to-3 (Liu et al., 2023)) for generating 3D objects from a single unposed image (the leftmost column). We show results on the RealFusion15 dataset at the top, while the NeRF4 dataset comparisons are shown at the bottom.
# 4.2 RESULTS
Quantitative and qualitative comparisons. We compare Magic123 against the state-of-the-art PointE (Nichol et al., 2022), Shap-E (Jun & Nichol, 2023), 3DFuse (Seo et al., 2023), NeuralLift (Xu et al., 2023), RealFusion (Melas-Kyriazi et al., 2023) and Zero-1-to-3 (Liu et al., 2023) in
Table 1: Magic123 results. We show quantitative results in terms of CLIP-Similarity↑ / PSNR↑ / LPIPS↓. The results are shown on the NeRF4 and Realfusion15 datasets, while bold reflects the best.
<table><tr><td>Dataset</td><td>Metrics\Methods</td><td>Point-E</td><td>Shap-E</td><td>3DFuse</td><td>NeuralLift</td><td>RealFusion</td><td>Zero-1-to-3</td><td>Magic123 (Ours)</td></tr><tr><td rowspan="3">NeRF4</td><td>CLIP-Similarity↑</td><td>0.48</td><td>0.60</td><td>0.60</td><td>0.52</td><td>0.38</td><td>0.62</td><td>0.80</td></tr><tr><td>PSNR↑</td><td>0.70</td><td>0.99</td><td>11.64</td><td>12.55</td><td>15.37</td><td>23.96</td><td>24.62</td></tr><tr><td>LPIPS↓</td><td>0.80</td><td>0.76</td><td>0.29</td><td>0.40</td><td>0.20</td><td>0.05</td><td>0.03</td></tr><tr><td rowspan="3">RealFusion15</td><td>CLIP-Similarity↑</td><td>0.53</td><td>0.59</td><td>0.67</td><td>0.65</td><td>0.67</td><td>0.75</td><td>0.82</td></tr><tr><td>PSNR↑</td><td>0.98</td><td>1.23</td><td>10.32</td><td>11.08</td><td>18.87</td><td>19.49</td><td>19.50</td></tr><tr><td>LPIPS↓</td><td>0.78</td><td>0.74</td><td>0.38</td><td>0.39</td><td>0.14</td><td>0.11</td><td>0.10</td></tr></table>
both NeRF4 and RealFusion15 datasets. For Zero-1-to-3, we adopt the implementation from (Tang, 2022), which yields better performance than the original implementation. For other works, we use their officially released code. All baselines and Magic123 are run with their default settings. As shown in Table 1, Magic123 achieves Top-1 performance across all the metrics in both datasets when compared to previous approaches. It is worth noting that the PSNR and LPIPS results demonstrate significant improvements over the baselines, highlighting the exceptional reconstruction performance of Magic123. The improvement of CLIP-Similarity reflects the great 3D coherence regards to the reference view. Qualitative comparisons are available in Fig. 5. Magic123 achieves the best results in terms of both geometry and texture. Note how Magic123 greatly outperforms the 3D-based zero-1-to-3 (Liu et al., 2023) especially in complex objects like the dragon statue and the colorful teapot in the first two rows, while at the same time greatly outperforming 2D-based RealFusion (Melas-Kyriazi et al., 2023) in all examples. This performance demonstrates the superiority of Magic123 over the state-of-the-art and its ability to generate high-quality 3D content.
# 4.3 ABLATION AND ANALYSIS
Magic123 introduces a coarse-to-fine pipeline for single image reconstruction and a joint 2D and 3D prior for novel view guidance. We provide analysis and ablation studies to show their effectiveness.
The effect of the coarse-to-fine pipeline is shown in Fig. 6. A consistent improvement in quantitative performance is observed throughout different setups when the fine stage is used. The use of a textured mesh DMTet representation enables higher quality 3D content that fits the objective and produces more compelling and higher resolution 3D visuals. Qualitative ablation for the coarse-to-fine pipeline is available in §C.2.
Combining both 2D and 3D priors and the trade-off factor $\lambda_{2D}$ . Fig. 6 demonstrates the effectiveness of the joint 2D and 3D prior quantitatively. In Fig. 7, we further ablate the joint prior qualitatively and analyze the effectiveness of the trade-off hyperparameter $\lambda_{2D}$ in Eqn 7. We start from $\lambda_{2D} = 0$ to use only the 3D prior and gradually increase $\lambda_{2D}$ to $0.1, 0.5, 1.0, 2, 5$ , and finally to use only the 2D prior with $\lambda_{2D} = 1$ and $\lambda_{3D} = 0$ (we also denote this case as $\lambda_{2D} = \infty$ for coherence). The key observations include: (1) Relying on a sole 3D prior results in consistent geometry (e.g. teddy bear) but falters in generating complex and uncommon objects, often rendering oversimplified geometry with minimal details (e.g. dragon statue); (2) Relying on a sole 2D prior significantly
 Figure 6: Ablation study (quantitative). We quantitatively compare using the coarse and fine stages in Magic123. In both setups, we ablate utilizing only 2D prior $(\lambda_{2D} = 1,\lambda_{3D} = 0)$ , utilizing only 3D prior $(\lambda_{2D} = 0,\lambda_{3D} = 40)$ , and utilizing a joint 2D and 3D prior $(\lambda_{2D} = 1,\lambda_{3D} = 40)$ .

 Figure 7: Setting $\lambda_{2D}$ . We study the effects of $\lambda_{2D}$ on Magic123. Increasing $\lambda_{2D}$ leads to a 3D geometry with higher imagination and more details but less 3D consistencies and vice versa. $\lambda_{2D} = 1$ provides a good balance and thus is used as default throughout all experiments.
improves performance in conjuring complex scenes like the dragon statue but simultaneously triggers 3D inconsistencies such as the Janus problem in the bear; (3) As $\lambda_{2D}$ escalates, the imaginative prowess of Magic123 is enhanced and more details become evident, but there is a tendency to compromise 3D consistency. We assign $\lambda_{2D} = 1$ as the default value for all examples. $\lambda_{2D}$ could also be fine-tuned for even better results on certain inputs.
# 5 CONCLUSION AND DISCUSSION
This work presents Magic123, a coarse-to-fine solution for generating high-quality, textured 3D meshes from a single image. By leveraging a joint 2D and 3D prior, Magic123 achieves a performance that is not reachable in a sole 2D or 3D prior-based solution and sets the new state of the art in image-to-3D generation. A trade-off parameter between the 2D and 3D priors allows for control over the generalizability and the 3D consistency. Magic123 outperforms previous techniques in terms of both realism and level of detail, as demonstrated through extensive experiments on real-world images and synthetic benchmarks. Our findings contribute to narrowing the gap between human abilities in 3D reasoning and those of machines, and pave the way for future advancements in single-image 3D reconstruction. The availability of our code, models, and generated 3D assets will further facilitate research and applications in this field.
Limitation. One limitation is that Magic123 might suffer from inconsistent texture and inaccurate geometry due to incomplete information from a single image. Specially, a clear inconsistency appers in the boundary mostly because of blended foreground and background along the boundary segmentation errors. A texture consistency loss might be helpful. Similar to previous work, Magic123 also tends to generate over-saturated textures due to the usage of the SDS loss. The over-saturation issue becomes more severe for the second stage because of the higher resolution. See examples in Fig. 5 for these failure cases: the incomplete foot of the bear, the inconsistent texture between the front (pink color) and back views (less pink) of the donuts, the round shape of the drums, and the oversaturated color of the hoarse and the chair. Similar to other per-prompt optimization methods, Magic123 also takes around 1 hour to get a 3D model and with limited diversity. This time can be reduced through (1) replacing to Gaussian Splatting in stage 1 as shown in (Tang et al., 2023a), and (2) sampling from a small range of time steps in stage 2, following the suggestions of ICLR reviewers. The diversity issue might be possible to alleviate through VDS (Wang et al., 2023b) or training with prior guidance plus diverse 3D data.
Acknowledgement. The authors would like to thank Xiaoyu Xiang for the insightful discussion and Dai-Jie Wu for sharing Point-E and Shap-E results. This work was supported by the KAUST Office of Sponsored Research through the Visual Computing Center funding, as well as, the SDAIA-KAUST Center of Excellence in Data Science and Artificial Intelligence (SDAIA-KAUST AI). Part of the support is also coming from KAUST Ibn Rushd Postdoc Fellowship program.
# REFERENCES
Jonathan T Barron, Ben Mildenhall, Matthew Tancik, Peter Hedman, Ricardo Martin-Brualla, and Pratul P Srinivasan. Mip-nerf: A multiscale representation for anti-aliasing neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5855-5864, 2021. Jonathan T Barron, Ben Mildenhall, Dor Verbin, Pratul P Srinivasan, and Peter Hedman. Mip-nerf 360: Unbounded anti-aliased neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5470-5479, 2022. Volker Blanz and Thomas Vetter. Face recognition based on fitting a 3d morphable model. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 25(9):1063-1074, 2003. James Booth, Anastasios Roussos, Stefanos Zafeiriou, Allan Ponniah, and David Dunaway. A 3d morphable model learnt from 10,000 faces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5543-5552, 2016. Shengqu Cai, Anton Obukhov, Dengxin Dai, and Luc Van Gool. Pix2nerf: Unsupervised conditional p-gan for single image to neural radiance fields translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3981-3990, June 2022. Eric R Chan, Connor Z Lin, Matthew A Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas J Guibas, Jonathan Tremblay, Sameh Khamis, et al. Efficient geometry-aware 3d generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16123-16133, 2022. Dave Zhenyu Chen, Yawar Siddiqui, Hsin-Ying Lee, Sergey Tulyakov, and Matthias Nießner. Text2tex: Text-driven texture synthesis via diffusion models. arXiv preprint arXiv:2303.11396, 2023a. Rui Chen, Yongwei Chen, Ningxin Jiao, and Kui Jia. *Fantasia3d: Disentangling geometry and appearance for high-quality text-to-3d content creation.* arXiv preprint arXiv:2303.13873, 2023b. Yen-Chi Cheng, Hsin-Ying Lee, Sergey Tulyakov, Alexander G Schwing, and Liang-Yan Gui. Sdfusion: Multimodal 3d shape completion, reconstruction, and generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. Matt Deitke, Ruoshi Liu, Matthew Wallingford, Huong Ngo, Oscar Michel, Aditya Kusupati, Alan Fan, Christian Laforte, Vikram Voleti, Samir Yitzhak Gadre, Eli VanderBilt, Aniruddha Kembhavi, Carl Vondrick, Georgia Gkioxari, Kiana Ehsani, Ludwig Schmidt, and Ali Farhadi. Objverse-xl: A universe of $10\mathrm{m} + 3\mathrm{d}$ objects. arXiv preprint arXiv:2307.05663, 2023a. Matt Deitke, Dustin Schwenk, Jordi Salvador, Luca Weihs, Oscar Michel, Eli VanderBilt, Ludwig Schmidt, Kiana Ehsani, Aniruddha Kembhavi, and Ali Farhadi. Objverse: A universe of annotated 3d objects. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13142-13153, 2023b. Yilun Du, Cameron Smith, Ayush Tewari, and Vincent Sitzmann. Learning to render novel views from wide-baseline stereo pairs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. Shivam Duggal and Deepak Pathak. Topologically-aware deformation fields for single-view 3d reconstruction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1536-1546, 2022. Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H. Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. In International Conference on Learning Representations (ICLR), 2023. Lukas Hollein, Ang Cao, Andrew Owens, Justin Johnson, and Matthias Nießner. Text2room: Extracting textured 3d meshes from 2d text-to-image models. arXiv preprint arXiv:2303.11989, 2023.
Fangzhou Hong, Mingyuan Zhang, Liang Pan, Zhongang Cai, Lei Yang, and Ziwei Liu. Avatarclip: Zero-shot text-driven generation and animation of 3d avatars. arXiv preprint arXiv:2205.08535, 2022. Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5885-5894, 2021. Ajay Jain, Ben Mildenhall, Jonathan T Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 867-876, 2022. Heewoo Jun and Alex Nichol. Shap-e: Generating conditional 3d implicit functions. arXiv preprint arXiv:2305.02463, 2023. Angjoo Kanazawa, Shubham Tulsiani, Alexei A Efros, and Jitendra Malik. Learning category-specific mesh reconstruction from image collections. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 371-386, 2018. Abhishek Kar, Shubham Tulsiani, Joao Carreira, and Jitendra Malik. Category-specific object reconstruction from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1966-1974, 2015. Ira Kemelmacher-Shlizerman. Internet based morphable model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3256-3263, 2013. Mijeong Kim, Seonguk Seo, and Bohyung Han. Infonerf: Ray entropy minimization for few-shot neural volume rendering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12912-12921, 2022. Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pretraining for unified vision-language understanding and generation. In International Conference on Machine Learning, pp. 12888-12900. PMLR, 2022. Junnan Li, Dongxu Li, Silvio Savarese, and Steven C. H. Hoi. BLIP-2: bootstrapping language-image pre-training with frozen image encoders and large language models. In ICML, volume 202 of Proceedings of Machine Learning Research, pp. 19730-19742. PMLR, 2023. Chen-Hsuan Lin, Jun Gao, Luming Tang, Towaki Takikawa, Xiaohui Zeng, Xun Huang, Karsten Kreis, Sanja Fidler, Ming-Yu Liu, and Tsung-Yi Lin. Magic3d: High-resolution text-to-3d content creation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. Ruoshi Liu, Rundi Wu, Basile Van Hoorick, Pavel Tokmakov, Sergey Zakharov, and Carl Vondrick. Zero-1-to-3: Zero-shot one image to 3d object. arXiv preprint arXiv:2303.11328, 2023. Stephen Lombardi, Tomas Simon, Jason Saragih, Gabriel Schwartz, Andreas Lehrmann, and Yaser Sheikh. Neural volumes: Learning dynamic renderable volumes from images. arXiv preprint arXiv:1906.07751, 2019. Matthew Loper, Naureen Mahmood, Javier Romero, Gerard Pons-Moll, and Michael J Black. Smpl: A skinned multi-person linear model. ACM Transactions on Graphics (TOG), 34(6):1-16, 2015. Julieta Martinez, Rayat Hossain, Javier Romero, and James J Little. A simple yet effective baseline for 3d human pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2640-2649, 2017. Luke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Realfusion: 360{\deg} reconstruction of any object from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. Gal Metzer, Elad Richardson, Or Patashnik, Raja Giryes, and Daniel Cohen-Or. Latent-nerf for shape-guided generation of 3d shapes and textures. arXiv preprint arXiv:2211.07600, 2022.
Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2mesh: Text-driven neural stylization for meshes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. Aryan Mikaeili, Or Perel, Daniel Cohen-Or, and Ali Mahdavi-Amiri. Sked: Sketch-guided text-based 3d editing. arXiv preprint arXiv:2303.10735, 2023. Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 405-421. Springer, 2020. Nasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Tiberiu Popa. Clip-mesh: Generating textured meshes from text using pretrained image-text models. In SIGGRAPH Asia 2022 Conference Papers, pp. 1-8, 2022. Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. In ACM Transactions on Graphics (SIGGRAPH), 2022. Alex Nichol, Heewoo Jun, Prafulla Dhariwal, Pamela Mishkin, and Mark Chen. Point-e: A system for generating 3d point clouds from complex prompts. arXiv preprint arXiv:2212.08751, 2022. Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Text-driven manipulation of stylegan imagery. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2085–2094, 2021. Georgios Pavlakos, Vasileios Choutas, Nima Ghorbani, Timo Bolkart, Ahmed AA Osman, Dimitrios Tzionas, and Michael J Black. Expressive body capture: 3d hands, face, and body from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10975-10985, 2019. Ben Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. International Conference on Learning Representations (ICLR), 2022. Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8748-8763. PMLR, 2021. Amit Raj, Srinivas Kaza, Ben Poole, Michael Niemeyer, Nataniel Ruiz, Ben Mildenhall, Shiran Zada, Kfir Aberman, Michael Rubinstein, Jonathan Barron, et al. Dreambooth3d: Subject-driven text-to-3d generation. arXiv preprint arXiv:2303.13508, 2023. Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8821-8831. PMLR, 2021. René Ranftl, Katrin Lasinger, David Hafner, Konrad Schindler, and Vladlen Koltun. Towards robust monocular depth estimation: Mixing datasets for zero-shot cross-dataset transfer. IEEE transactions on pattern analysis and machine intelligence (T-PAMI), 44(3):1623-1637, 2020. René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 12159-12168, 2021. Elad Richardson, Gal Metzer, Yuval Alaluf, Raja Giryes, and Daniel Cohen-Or. Texture: Text-guided texturing of 3d shapes. arXiv preprint arXiv:2302.01721, 2023. Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10684-10695, 2022.
Chitwan Sahara, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Information Processing Systems (NeurIPS), 35:36479-36494, 2022. Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021. Junyoung Seo, Wooseok Jang, Min-Seop Kwak, Jaehoon Ko, Hyeonsu Kim, Junho Kim, Jin-Hwa Kim, Jiyoung Lee, and Seungryong Kim. Let 2d diffusion model know 3d-consistency for robust text-to-3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. Tianchang Shen, Jun Gao, Kangxue Yin, Ming-Yu Liu, and Sanja Fidler. Deep marching tetrahedra: a hybrid representation for high-resolution 3d shape synthesis. In Advances in Neural Information Processing Systems (NeurIPS), volume 34, pp. 6087-6101, 2021. Aliaksandr Siarohin, Willi Menapace, Ivan Skorokhodov, Kyle Olszewski, Hsin-Ying Lee, Jian Ren, Mengei Chai, and Sergey Tulyakov. Unsupervised volumetric animation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proceedings of the International Conference on Machine Learning (ICML), pp. 2256-2265. PMLR, 2015. Jingxiang Sun, Xuan Wang, Yichun Shi, Lizhen Wang, Jue Wang, and Yebin Liu. Ide-3d: Interactive disentangled editing for high-resolution 3d-aware portrait synthesis. ACM Transactions on Graphics (TOG), 41(6):1-10, 2022. doi: 10.1145/3550454.3555506. Andrea Tagliausacchi and Ben Mildenhall. Volume rendering digest (for nerf). arXiv preprint arXiv:2209.02417, 2022. Jiaxiang Tang. Stable-dreamfusion: Text-to-3d with stable-diffusion, 2022. https://github.com/ashawkey/stable-dreamfusion. Jiaxiang Tang, Jiawei Ren, Hang Zhou, Ziwei Liu, and Gang Zeng. Dreamgaussian: Generative gaussian splatting for efficient 3d content creation. arXiv preprint arXiv:2309.16653, 2023a. Junshu Tang, Tengfei Wang, Bo Zhang, Ting Zhang, Ran Yi, Lizhuang Ma, and Dong Chen. Make-it-3d: High-fidelity 3d creation from a single image with diffusion prior. arXiv preprint arXiv:2303.14184, 2023b. Haochen Wang, Xiaodan Du, Jiahao Li, Raymond A Yeh, and Greg Shakhnarovich. Score jacobian chaining: Lifting pretrained 2d diffusion models for 3d generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023a. Nanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, and Yu-Gang Jiang. Pixel2mesh: Generating 3d mesh models from single rgb images. In Proceedings of the European conference on computer vision (ECCV), pp. 52-67, 2018. Zhengyi Wang, Cheng Lu, Yikai Wang, Fan Bao, Chongxuan Li, Hang Su, and Jun Zhu. Prolificdreamer: High-fidelity and diverse text-to-3d generation with variational score distillation. arXiv preprint arXiv:2305.16213, 2023b. Daniel Watson, William Chan, Ricardo Martin-Brualla, Jonathan Ho, Andrea Tagliasacchi, and Mohammad Norouzi. Novel view synthesis with diffusion models. In International Conference on Learning Representations (ICLR), 2023. Shangzhe Wu, Christian Rupprecht, and Andrea Vedaldi. Unsupervised learning of probably symmetric deformable 3d objects from images in the wild. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
Dejia Xu, Yifan Jiang, Peihao Wang, Zhiwen Fan, Yi Wang, and Zhangyang Wang. Neurallift-360: Lifting an in-the-wild 2d photo to a 3d object with $360\{\backslash \mathrm{deg}\}$ views. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. Jiale Xu, Xintao Wang, Weihao Cheng, Yan-Pei Cao, Ying Shan, Xiaohu Qie, and Shenghua Gao. Dream3d: Zero-shot text-to-3d synthesis using 3d shape prior and text-to-image diffusion models. arXiv preprint arXiv:2212.14704, 2022. Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4578-4587, 2021. Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023. Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
# A IMPLEMENTATION DETAILS
We use exactly the same set of hyperparameters for all experiments and do not perform any per-object hyperparameter optimization. Both coarse and fine stages are optimized using Adam with 0.001 learning rate and no weight decay for 5,000 iterations. $\lambda_{rgb}$ , $\lambda_{mask}$ are set to 5,0.5 for both stages. $\lambda_{2D}$ and $\lambda_{3D}$ are set to 1 and 40 for the first stage and are lowered to 0.001 and 0.01 in the second stage for refinement to alleviate oversaturated textures. We adopt the Stable Diffusion (Sohl-Dickstein et al., 2015) model of V1.5 as the 2D prior. The guidance scale of the 2D prior is set to 100 following (Poole et al., 2022). For the 3D prior, Zero-1-to-3 (Liu et al., 2023) (105,000 iterations finetuned version) is leveraged. The guidance scale of Zero-1-to-3 is set to 5 following (Liu et al., 2023). The NeRF backbone is implemented by three layers of multi-layer perceptrons with 64 hidden dims. Regarding lighting and shading, we keep nearly the same as (Poole et al., 2022). The difference is we set the first 1,000 iterations in the first stage to normals' shading to focus on learning geometry as inspired by (Chen et al., 2023b). For other iterations as well as the fine stage, we use diffuse shading with a probability 0.75 and textureless shading with a probability 0.25. The rendering resolutions are set to $128\times 128$ and $1024\times 1024$ for the coarse and the fine stage, respectively. For both stages, we use depth regularization and normal smoothness regularization with $\lambda_d = 0.001$ and $\lambda_n = 0.5$ . Following the standard practice (Barron et al., 2021; Poole et al., 2022; Melas-Kyriazi et al., 2023), we additionally add the 0.001 entropy regularization and 0.01 orientation regularization in the NeRF stage. Our implementation is based on the Stable DreamFusion repo (Tang, 2022). The training of Magic123 takes roughly 1 hour on a 32G V100 GPU, while the coarse stage and the fine stage take 40 and 20 minutes, respectively.
# B CAMERA SETTINGS
Frontal view setting. Since the reference image is unposed, our model assumes a frontal reference view ( $90^{\circ}$ elevation and $0^{\circ}$ azimuth) for simplicity. However, in real-world applications, these angles can be adjusted according to the input, either through intuitive estimation or camera pose detection. A simple tuning of the elevation angle can improve the benchmark performance of Magic123. For instance, in the chair example shown in Fig. II, altering the elevation angle from $90^{\circ}$ to $60^{\circ}$ addresses squeezed reconstruction of the chair. For research purposes, we propose to exclude this camera estimation as it does not impact the comparison between different methods and only requires engineering efforts in application.
Rendering camera setting. We set the camera parameters for the rendering as follows. The camera is placed 1.8 meters from the coordinate origin, i.e. the radial distance is 1.8. The field of view (FOV) of the camera is $40^{\circ}$ . We highlight that the 3D reconstruction performance is not sensitive to camera parameters, as long as they are reasonable, e.g. FOV between 20 and 60, and radial distance between 1 to 4 meters. In Fig. II, we validate that using the same camera parameters as RealFusion (Melas-Kyriazi et al., 2023) that is different from ours, i.e. camera radius [1.0, 1.5] and FOV [40, 70], achieves results without obvious differences as ours.
# C MORE ANALYSIS AND ABLATION STUDIES
# C.1 ABLATION AND ANALYSIS ON THE USAGE OF 2D AND 3D PRIORS
3D priors only. We first turn off the guidance of 2D prior by setting $\lambda_{2D} = 0$ , such that we only use the 3D-aware diffusion prior Zero-1-to-3 Liu et al. (2023).
Note that Zero-1-to-3 in our paper (results in Tab. 1, Fig. 5) denotes our improved reimplemented Zeo-1-to-3 using the same training configurations as Magic123. i.e. Zero-1-to-3 in our paper refers to the first stage results of Maigc123 3D prior only (Fig. 2, 6, 7), where both of them use second stage DMTet fine-tuning for fair comparison.
Furthermore, we study the effects of $\lambda_{3D}$ by performing a grid search and evaluate the image-to-3D reconstruction performance, where $\lambda_{3D} = 5, 10, 20, 40, 60, 80$ . Interestingly, we find that Zero-1-to-3 is very robust to the change of $\lambda_{3D}$ . Tab. I demonstrates that different $\lambda_{3D}$ leads to a consistent quantitative result. We thus simply set $\lambda_{3D} = 40$ throughout the experiments since it achieves a slightly better CLIP-similarity score than other values.
Table I: Effects of $\lambda_{3D}$ and $\lambda_{2D}$ in Magic123 using only 2D or 3D prior on NeRF4 dataset.
<table><tr><td></td><td colspan="5">varying λ3D when λ2D=0</td><td colspan="3">varying λ2D when λ3D=0</td></tr><tr><td></td><td>10</td><td>20</td><td>40</td><td>60</td><td>80</td><td>0.1</td><td>1</td><td>2</td></tr><tr><td>CLIP-similarity↑</td><td>0.58</td><td>0.61</td><td>0.62</td><td>0.61</td><td>0.58</td><td>0.54</td><td>0.60</td><td>0.72</td></tr><tr><td>PSNR↑</td><td>23.96</td><td>24.05</td><td>23.96</td><td>23.75</td><td>23.34</td><td>23.62</td><td>24.11</td><td>22.42</td></tr><tr><td>LPIPS↓</td><td>0.04</td><td>0.04</td><td>0.05</td><td>0.06</td><td>0.08</td><td>0.04</td><td>0.04</td><td>0.07</td></tr></table>
 Figure I: Ablation study (qualitative). We qualitatively compare the novel view renderings from the coarse and fine stages in Magic123. We ablate utilizing only 2D prior $(\lambda_{2D} = 1, \lambda_{3D} = 0)$ , only 3D prior $(\lambda_{2D} = 0, \lambda_{3D} = 40)$ , and a joint 2D and 3D prior $(\lambda_{2D} = 1, \lambda_{3D} = 40)$ . We also ablate the effects of textual inversion at the right.
2D priors only. We then turn off the 3D prior and study the effect of $\lambda_{2D}$ . As shown in Tab. I, the image-to-3D system is sensitive to the weights of the 2D prior. With the increase of $\lambda_{2D}$ , a sharp increase in CLIP similarity and a drop in PSNR are observed. This is because a larger 2D prior weight leads to more imagination, which unfortunately might result in 3D inconsistency. Due to the observation that the 3D prior is more robust than the 2D prior to the weight, we use $\lambda_{2D}$ as the tradeoff parameter to control the imagination and 3D consistency.
# C.2 ABLATION ON THE COARSE-TO-FINE PIPELINE
In §4.3 we ablate the effect of the coarse-to-fine pipeline quantitatively. Here we provide the visual comparisons in Fig. I. The fine stage consistently augments the sharpness of the rendering and the geometry and texture details. See the edge of the wings and claws of the dragon and the toppings of the donuts for examples.
# C.3 ABLATE THE REGULARIZATION
Magic123 is optimized additionally by depth regularization, normal smoothness regularization, entropy regularization, and orientation regularization, with weights of 0.01, 0.5, 0.001, and 0.01, respectively. In Fig. II, we show that the depth, the entropy, and the orientation regularizations have minimal impact on the image-to-3D reconstruction performance. However, we keep them in our implementation as they are common practices in the NeRF family. The normal smoothness is more important in alleviating the high-frequency noise.
# C.4 ABLATE THE TEXTUAL INVERSION
We use textual inversion in both stages for consistent geometry and texture with the input reference image. Fig. I we additionally ablate the effects of textural inversion by removing it and using pure texts in the guidance. In the two examples, we change the prompts from "A high-resolution DSLR image of $<e>$ " to "A high-resolution DSLR image of a metal dragon statue", and "A high-resolution DSLR image of two donuts", respectively. As observed, textual inversion has marginal effects on the image-to-3D reconstruction performance. However, it helps with keeping the consistency between the input image and the generated 3D content. Without textual inversion, the dragon with a different style of horns and golden textures appears that is not consistent with the input image. The donuts without textual inversion have distinct toppings from the input image.
 Figure II: Qualitative ablation study for the effects of depth regularization, normal smoothness, entropy and orientation regularization, camera parameters, and the front-view assumption (elevation angle). Normal smoothness reduces high-frequency noise. Other factors like depth, entropy, and orientation regularization exert minimal influence on image-to-3D reconstruction results but are maintained in Magic123, adhering to common practice. Using different camera parameters, including camera radius (1.8 meters v.s. [1.0, 1.5] in RealFusion) and field of view (40 v.s. [40, 70] in RealFusion), have a marginal impact on performance. Magic123 opts for a simple configuration, setting the camera radius to 1.8 meters and the FOV to 40. Setting the elevation angle from $90^{\circ}$ to a reasonable value also improves reconstruction quality (see the chair example).
# D MORE COMPARASIONS
Here, we additionally compare Magic123 with most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b). Magic123 outperforms all of them in terms of both 3D geometry and texture quality by a large margin.
 Figure III: Qualitative comparisons. We compare Magic123 to the most recent methods RealFusion (Melas-Kyriazi et al., 2023), Zero-1-to-3 (Liu et al., 2023), and Make-It-3D (Tang et al., 2023b).123version https://git-lfs.github.com/spec/v1oid sha256:3f8c2f6109cbb59b14ce17b890f101270e88d2d1536c56fa7e27e2a99fded536size 1074166123version https://git-lfs.github.com/spec/v1oid sha256:086cb62608a92b0cf6fbbfd48f279e3aaa983a853584830769e7d9eae7b97427size 21408084123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390# MAGICDRIVE: STREET VIEW GENERATION WITH DIVERSE 3D GEOMETRY CONTROL
Ruiyuan Gao $^{1*}$ , Kai Chen $^{2*}$ , Enze Xie $^{3\dagger}$ , Lanqing Hong $^{3}$ , Zhenguo Li $^{3}$ , Dit-Yan Yeung $^{2}$ , Qiang Xu $^{1\dagger}$
<sup>1</sup>The Chinese University of Hong Kong <sup>2</sup>Hong Kong University of Science and Technology
<sup>3</sup>Huawei Noah's Ark Lab
{rygao, qxu}@cse.cuhk.edu.hk, kai.chen@connect.ust.hk,
{xie.enze,honglanqing,li.zhenguo}@huawei.com,dyyeung@cse.ust.hk
# ABSTRACT
Recent advancements in diffusion models have significantly enhanced the data synthesis with 2D control. Yet, precise 3D control in street view generation, crucial for 3D perception tasks, remains elusive. Specifically, utilizing Bird's-Eye View (BEV) as the primary condition often leads to challenges in geometry control (e.g., height), affecting the representation of object shapes, occlusion patterns, and road surface elevations, all of which are essential to perception data synthesis, especially for 3D object detection tasks. In this paper, we introduce MAGICDRIVE, a novel street view generation framework, offering diverse 3D geometry controls including camera poses, road maps, and 3D bounding boxes, together with textual descriptions, achieved through tailored encoding strategies. Besides, our design incorporates a cross-view attention module, ensuring consistency across multiple camera views. With MAGICDRIVE, we achieve high-fidelity street-view image & video synthesis that captures nuanced 3D geometry and various scene descriptions, enhancing tasks like BEV segmentation and 3D object detection.
 Figure 1: Multi-camera street view generation from MAGICDRIVE. MAGICDRIVE can generate continuous camera views with controls from the road map, object boxes, and text (e.g., weather).
# 1 INTRODUCTION
The high costs associated with data collection and annotation often impede the effective training of deep learning models. Fortunately, cutting-edge generative models have illustrated that synthetic data can notably boost performance across various tasks, such as object detection (Chen et al., 2023c) and semantic segmentation (Wu et al., 2023b). Yet, the prevailing methodologies are largely tailored to 2D contexts, primarily relying on 2D bounding boxes (Lin et al., 2014; Han et al., 2021) or segmentation maps (Zhou et al., 2019) as layout conditions (Chen et al., 2023c; Li et al., 2023b).
In autonomous driving applications, a thorough grasp of the 3D environment is essential. This demands reliable techniques for tasks like Bird's-Eye View (BEV) map segmentation (Zhou & Krahenbuhl, 2022; Ji et al., 2023) and 3D object detection (Chen et al., 2020; Huang et al., 2021; Liu et al., 2023a; Ge et al., 2023). A genuine 3D geometry representation is crucial for capturing intricate details from 3D annotations, such as road elevations, object heights, and their occlusion pat
 (a) 3D bounding boxes show position relationships. Figure 2: 3D bounding boxes are crucial for street view synthesis. Two examples show that 2D boxes or BEV maps lost distance, height, and elevation. Images are generated from MAGICDRIVE.
 (b) Road surface elevation guided by 3D bounding boxes.
terns, as shown in Figure 2. Consequently, generating multi-camera street-view images according to 3D annotations becomes vital to boost downstream perception tasks.
For street-view data synthesis, two pivotal criteria are realism and controllability. Realism requires that the quality of the synthetic data should align with that of real data; and in a given scene, views from varying camera perspectives should remain consistent with one another (Mildenhall et al., 2020). On the other hand, controllability emphasizes the precision in generating street-view images that adhere to provided conditions: the BEV map, 3D object bounding boxes, and camera poses for views. Beyond these core requirements, effective data augmentation should also grant the flexibility to tweak finer scenario attributes, such as prevailing weather conditions or the time of day. Existing solutions like BEVGen (Swerdlow et al., 2023) approach street view generation by encapsulating all semantics within BEV. Conversely, BEVControl (Yang et al., 2023a) starts by projecting 3D coordinates to image views, subsequently using 2D geometric guidance. However, both methods compromise certain geometric dimensions—height is lost in BEVGen and depth in BEVControl.
The rise of diffusion models has significantly pushed the boundaries of controllable image generation quality. Specifically, ControlNet (Zhang et al., 2023a) proposes a flexible framework to incorporate 2D spatial controls based on pre-trained Text-to-Image (T2I) diffusion models (Rombach et al., 2022). However, 3D conditions are distinct from pixel-level conditions or text. The challenge of seamlessly integrating them with multi-camera view consistency in street view synthesis remains.
In this paper, we introduce MAGICDRIVE, a novel framework dedicated to street-view synthesis with diverse 3D geometry controls<sup>1</sup>. For realism, we harness the power of pre-trained stable diffusion (Rombach et al., 2022), further fine-tuning it for street view generation. One distinctive component of our framework is the cross-view attention module. This simple yet effective component provides multi-view consistency through interactions between adjacent views. In contrast to previous methods, MAGICDRIVE proposes a separate design for objects and road map encoding to improve controllability with 3D data. More specifically, given the sequence-like, variable-length nature of 3D bounding boxes, we employ cross-attention akin to text embeddings for their encoding. Besides, we propose that an addictive encoder branch like ControlNet (Zhang et al., 2023a) can encode maps in BEV and is capable of view transformation. Therefore, our design achieves geometric controls without resorting to any explicit geometric transformations or imposing geometric constraints on multi-camera consistency. Finally, MAGICDRIVE factors in textual descriptions, offering attribute control such as weather conditions and time of day.
Our MAGICDRIVE framework, despite its simplicity, excels in generating strikingly realistic images & videos that align with road maps, 3D bounding boxes, and varied camera perspectives. Besides, the images produced can enhance the training for both 3D object detection and BEV segmentation tasks. Furthermore, MAGICDRIVE offers comprehensive geometric controls at the scene, background, and foreground levels. This flexibility makes it possible to craft previously unseen street views suitable for simulation purposes. We summarize the main contributions of this work as:
- The introduction of MAGICDRIVE, an innovative framework that generates multi-perspective camera views & videos conditioned on BEV and 3D data tailored for autonomous driving. - The development of simple yet potent strategies to manage 3D geometric data, effectively addressing the challenges of multi-camera view consistency in street view generation. - Through rigorous experiments, we demonstrate that MAGICDRIVE outperforms prior street view generation techniques, notably for the multi-dimensional controllability. Additionally, our results reveal that synthetic data delivers considerable improvements in 3D perception tasks.
# 2 RELATED WORK
Diffusion Models for Conditional Generation. Diffusion models (Ho et al., 2020; Song et al., 2020; Zheng et al., 2023) generate images by learning a progressive denoising process from the Gaussian noise distribution to the image distribution. These models have proven exceptional across diverse tasks, such as text-to-image synthesis (Rombach et al., 2022; Nichol et al., 2022; Yang et al., 2023b), inpainting (Wang et al., 2023a), and instructional image editing (Zhang et al., 2023b; Brooks et al., 2023), due to their adaptability and competence in managing various forms of controls (Zhang et al., 2023a; Li et al., 2023b) and multiple conditions (Liu et al., 2022a; Gao et al., 2023). Besides, data synthesized from geometric annotations can aid downstream tasks such as 2D object detection (Chen et al., 2023c; Wu et al., 2023b). Thus, this paper explores the potential of T2I diffusion models in generating street-view images and benefiting downstream 3D perception models.
Street View Generation. Numerous street view generation models condition on 2D layouts, such as 2D bounding boxes (Li et al., 2023b) and semantic segmentation (Wang et al., 2022). These methods leverage 2D layout information corresponding directly to image scale, whereas the 3D information does not possess this property, thereby rendering such methods unsuitable for leveraging 3D information for generation. For street view synthesis with 3D geometry, BEVGen (Swerdlow et al., 2023) is the first to explore. It utilizes a BEV map as a condition for both roads and vehicles. However, the omission of height information limits its application in 3D object detection. BEVControl (Yang et al., 2023a) amends the loss of object's height by the height-lifting process. Similarly, Wang et al. (2023b) also projects 3D boxes to camera views to guide generation. However, the projection from 3D to 2D results in the loss of essential 3D geometric information, like depth and occlusion. In this paper, we propose to encode bounding boxes and road maps separately for more nuanced control and integrate scene descriptions, offering enhanced control over the generation of street views.
Multi-camera Image Generation of a 3D scene fundamentally requires viewpoint consistency. Several studies have addressed this issue within the context of indoor scenes. For instance, MVDiffusion (Tang et al., 2023) employs panoramic images and a cross-view attention module to maintain global consistency, while Tseng et al. (2023) leverage epipolar geometry as a constraining prior. These approaches, however, primarily rely on the continuity of image views, a condition not always met in street views due to limited camera overlap and different camera configurations (e.g., exposure, intrinsic). Our MAGICDRIVE introduces extra cross-view attention modules to UNet, which significantly enhances consistency across multi-camera views.
# 3 PRELIMINARY
Problem Formulation. In this paper, we consider the coordinate of the LiDAR system as the ego car's coordinate, and parameterize all geometric information according to it. Let $\mathbf{S} = \{\mathbf{M},\mathbf{B},\mathbf{L}\}$ be the description of a driving scene around the ego vehicle, where $\mathbf{M}\in \{0,1\}^{w\times h\times c}$ is the binary map representing a $w\times h$ meter road area in BEV with $c$ semantic classes, $\mathbf{B} = \{(c_i,b_i)\}_{i = 1}^N$ represents the 3D bounding box position $(b_{i} = \{(x_{j},y_{j},z_{j})\}_{j = 1}^{8}\in \mathbb{R}^{8\times 3})$ and class $(c_{i}\in \mathcal{C})$ for each object in the scene, and $\mathbf{L}$ is the text describing additional information about the scene (e.g., weather and time of day). Given a camera pose $\mathbf{P} = [\mathbf{K},\mathbf{R},\mathbf{T}]$ (i.e., intrinsics, rotation, and translation), the goal of street-view image generation is to learn a generator $\mathcal{G}(\cdot)$ which synthesizes realistic images $I\in \mathbb{R}^{H\times W\times 3}$ corresponding to the scene S and camera pose P as, $I = \mathcal{G}(\mathbf{S},\mathbf{P},z)$ where $z\sim \mathcal{N}(0,1)$ is a random noise from Gaussian distribution.
Conditional Diffusion Models. Diffusion models (Ho et al., 2020; Song et al., 2020) generate data $(\pmb{x}_0)$ by iteratively denoising a random Gaussian noise $(\pmb{x}_T)$ for $T$ steps. Typically, to learn the denoising process, the network is trained to predict the noise by minimizing the mean-square error:
$$\ell_ {s i m p l e} = \mathbb {E} _ {\boldsymbol {x} _ {0}, \boldsymbol {c}, \boldsymbol {\epsilon}, t} \left[ \left| \left| \boldsymbol {\epsilon} - \boldsymbol {\epsilon} _ {\theta} \left(\sqrt {\bar {\alpha} _ {t}} \boldsymbol {x} _ {0} + \sqrt {1 - \bar {\alpha} _ {t}} \boldsymbol {\epsilon}, t, \boldsymbol {c}\right) \right| \right| ^ {2} \right], \tag {1}$$
where $\epsilon_{\theta}$ is the network to train, with parameters $\theta$ , $c$ is optional conditions, which is used for the conditional generation, $t \in [0, T]$ is the time-step, $\epsilon \in \mathcal{N}(0, I)$ is the additive Gaussian noise, and $\bar{\alpha}_{t}$ is a scalar parameter. Latent diffusion models (LDM) (Rombach et al., 2022) is a special kind of diffusion model, where they utilize a pre-trained Vector Quantized Variational AutoEncoder (VQ-VAE) (Esser et al., 2021) and perform diffusion process in the latent space. Given the VQ-VAE encoder as $z = \mathcal{E}(x)$ , one can rewrite $\epsilon_{\theta}(\cdot)$ in Equation 1 as $\epsilon_{\theta}(\sqrt{\bar{\alpha}_{t}} \mathcal{E}(\boldsymbol{x}_{0}) + \sqrt{1 - \bar{\alpha}_{t}} \epsilon, t, c)$ for LDM. Besides, LDM considers text describing the image as condition $c$ .
 Figure 3: Overview of MAGICDRIVE for street-view image generation. MAGICDRIVE generates highly realistic images, exploiting geometric information from 3D annotations by independently encoding road maps, object boxes, and camera parameters for precise, geometry-guided synthesis. Additionally, MAGICDRIVE accommodates guidance from descriptive conditions (e.g., weather).
# 4 STREET VIEW GENERATION WITH 3D INFORMATION
The overview of MAGICDRIVE is depicted in Figure 3. Operating on the LDM pipeline, MAGICDRIVE generates street-view images conditioned on both scene annotations (S) and the camera pose (P) for each view. Given the 3D geometric information in scene annotations, projecting all to a BEV map, akin to BEVGen (Swerdlow et al., 2023) or BEVControl (Yang et al., 2023a), doesn't ensure precise guidance for street view generation, as exemplified in Figure 2. Consequently, MAGICDRIVE categorizes conditions into three levels: scene (text and camera pose), foreground (3D bounding boxes), and background (road map); and integrates them separately via cross-attention and an additive encoder branch, detailed in Section 4.1. Additionally, maintaining consistency across different cameras is crucial for synthesizing street views. Thus, we introduce a simple yet effective cross-view attention module in Section 4.2. Lastly, we elucidate our training strategies in Section 4.3, emphasizing Classifier-Free Guidance (CFG) in integrating various conditions.
# 4.1 GEOMETRIC CONDITIONS ENCODING
As illustrated in Figure 3, two strategies are employed for information injection into the UNet of diffusion models: cross-attention and additive encoder branch. Given that the attention mechanism (Vaswani et al., 2017) is tailored for sequential data, cross-attention is apt for managing variable length inputs like text tokens and bounding boxes. Conversely, for grid-like data, such as road maps, the additive encoder branch is effective in information injection (Zhang et al., 2023a). Therefore, MAGICDRIVE employs distinct encoding modules for various conditions.
Scene-level Encoding includes camera pose $\mathbf{P} = \{\mathbf{K}\in \mathbb{R}^{3\times 3},\mathbf{R}\in \mathbb{R}^{3\times 3},\mathbf{T}\in \mathbb{R}^{3\times 1}\}$ , and text sequence $\mathbf{L}$ . For text, we construct the prompt with a template as "A driving scene image at {location}. {description}" and leverage a pre-trained CLIP text encoder ( $E_{text}$ ) as LDM (Rombach et al., 2022), as shown by Equation 2, where $L$ is the token length of $\mathbf{L}$ . As for camera pose, we first concat each parameter by their column, resulting in $\bar{\mathbf{P}} = [\mathbf{K},\mathbf{R},\mathbf{T}]^T\in \mathbb{R}^{7\times 3}$ . Since $\bar{\mathbf{P}}$ contains values from $\sin/\cos$ functions and also 3D offsets, to have the model effectively interpret these high-frequency variations, we apply Fourier embedding (Mildenhall et al., 2020) to each 3-dim vector before leveraging a Multi-Layer Perception (MLP, $E_{cam}$ ) to embed the camera pose parameters, as in Equation 3. To maintain consistency, we set the dimension of $h^c$ the same as that of $h_i^t$ . Through the CLIP text encoder, each text embedding $h_i^t$ already contains positional information (Radford et al., 2021). Therefore, we prepend the camera pose embedding $h^c$ to text embeddings, resulting in scene-level embedding $h^s = [h^c,h^t]$ .
$$\boldsymbol {h} ^ {t} = \left[ h _ {1} ^ {t} \dots h _ {L} ^ {t} \right] = E _ {\text {t e x t}} (\mathbf {L}), \tag {2}$$
$$h ^ {c} = E _ {c a m} \left(\operatorname {F o u r i e r} (\bar {\mathbf {P}})\right) = E _ {c a m} \left(\operatorname {F o u r i e r} \left([ \mathbf {K}, \mathbf {R}, \mathbf {T} ] ^ {T}\right)\right). \tag {3}$$
3D Bounding Box Encoding. Since each driving scene has a variable length of bounding boxes, we inject them through the cross-attention mechanism similar to scene-level information. Specifically, we encode each box into a hidden vector $h^b$ , which has the same dimensions as that of $h^t$ . Each 3D bounding box $(c_i, b_i)$ contains two types of information: class label $c_i$ and box position $b_i$ . For
 Figure 4: Cross-view Attention. left: we introduce cross-view attention to the pre-trained UNet after the cross-attention module. right: we highlight some areas for comparison between without and with cross-view attention. Cross-view attention guarantees consistency across multiple views.
class labels, we utilize the method similar to Li et al. (2023b), where the pooled embeddings of class names $(L_{c_i})$ are considered as label embeddings. For box positions $b_{i}\in \mathbb{R}^{8\times 3}$ , represented by the coordinates of its 8 corner points, we utilize Fourier embedding to each point and pass through an MLP for encoding, as in Equation 4. Then, we use an MLP to compress both class and position embedding into one hidden vector, as in Equation 5. The final hidden states for all bounding boxes of each scene are represented as $\pmb{h}^{b} = [h_{1}^{b}\dots h_{N}^{b}]$ , where $N$ is the number of boxes.
$$e _ {c} ^ {b} (i) = \operatorname {A v g P o o l} \left(E _ {\text {t e x t}} \left(L _ {c _ {i}}\right)\right), e _ {p} ^ {b} (i) = \mathrm {M L P} _ {p} \left(\text {F o u r i e r} \left(b _ {i}\right)\right), \tag {4}$$
$$h _ {i} ^ {b} = E _ {b o x} \left(c _ {i}, b _ {i}\right) = \operatorname {M L P} _ {b} \left(e _ {c} ^ {b} (i), e _ {p} ^ {b} (i)\right). \tag {5}$$
Ideally, the model learns the geometric relationship between bounding boxes and camera pose through training. However, the distribution of the number of visible boxes to different views is long-tailed. Thus, we bootstrap learning by filtering visible objects to each view $(v_{i})$ , i.e., $f_{viz}$ in Equation 6. Besides, we also add invisible boxes for augmentation (more details in Section 4.3).
$$\boldsymbol {h} _ {v _ {i}} ^ {b} = \left\{h _ {i} ^ {b} \in \boldsymbol {h} ^ {b} \mid f _ {v i z} \left(b _ {i}, \mathbf {R} _ {v _ {i}}, \mathbf {T} _ {v _ {i}}\right) > 0 \right\}. \tag {6}$$
Road Map Encoding. The road map has a 2D-grid format. While Zhang et al. (2023a) shows the addictive encoder can incorporate this kind of data for 2D guidance, the inherent perspective differences between the road map's BEV and the camera's First-Person View (FPV) create discrepancies. BEVControl (Yang et al., 2023a) employs a back-projection to transform from BEV to FPV but complicates the situation with an ill-posed problem. In MAGICDRIVE, we propose that explicit view transformation is unnecessary, as sufficient 3D cues (e.g., height from object boxes and camera pose) allow the addictive encoder to accomplish view transformation. Specifically, we integrate scene-level and 3D bounding box embeddings into the map encoder (see Figure 3). Scene-level embeddings provide camera poses, and box embeddings offer road elevation cues. Additionally, incorporating text descriptions facilitates the generation of roads under varying conditions (e.g., weather and time of day). Thus, the map encoder can synergize with other conditions for generation.
# 4.2 CROSS-VIEW ATTENTION MODULE
In multi-camera view generation, it is crucial that image synthesis remains consistent across different perspectives. To maintain consistency, we introduce a cross-view attention module (Figure 4). Given the sparse arrangement of cameras in driving contexts, each cross-view attention allows the target view to access information from its immediate left and right views, as in Equation 7; here, $t$ , $l$ , and $r$ are the target, left, and right view respectively. Then, the target view aggregates such information with skip connection, as in Equation 8, where $\pmb{h}^v$ indicates the hidden state of the target view.
$$\operatorname {A t t e n t i o n} _ {c v} ^ {i} \left(Q _ {t}, K _ {i}, V _ {i}\right) = \operatorname {s o f t m a x} \left(\frac {Q _ {t} K _ {i} ^ {T}}{\sqrt {d}}\right) \cdot V _ {i}, i \in \{l, r \}, \tag {7}$$
$$\boldsymbol {h} _ {\text {o u t}} ^ {v} = \boldsymbol {h} _ {\text {i n}} ^ {v} + \text {A t t e n t i o n} _ {c v} ^ {l} + \text {A t t e n t i o n} _ {c v} ^ {r}. \tag {8}$$
We inject cross-view attention after the cross-attention module in the UNet and apply zero-initialization (Zhang et al., 2023a) to bootstrap the optimization. The efficacy of the cross-view attention module is demonstrated in Figure 4 right, Figure 5, and Figure 6. The multilayered structure of UNet enables aggregating information from long-range views after several stacked blocks. Therefore, using cross-view attention on adjacent views is enough for multi-view consistency, further evidenced by the ablation study in Appendix C.
# 4.3 MODEL TRAINING
Classifier-free Guidance reinforces the impact of conditional guidance (Ho & Salimans, 2021; Rombach et al., 2022). For effective CFG, models need to discard conditions during training occasionally. Given the unique nature of each condition, applying a drop strategy is complex for multiple conditions. Therefore, our MAGICDRIVE simplifies this for four conditions by concurrently dropping scene-level conditions (camera pose and text embeddings) at a rate of $\gamma^s$ . For boxes and maps, which have semantic representations for null (i.e., padding token in boxes and 0 in maps) in their encoding, we maintain them throughout training. At inference, we utilize null for all conditions, enabling meaningful amplification to guide generation.
Training Objective and Augmentation. With all the conditions injected as inputs, we adapt the training objective described in Section 3 to the multi-condition scenario, as in Equation 9.
$$\ell = \mathbb {E} _ {\boldsymbol {x} _ {0}, \epsilon , t, \{\boldsymbol {S}, \boldsymbol {P} \}} \left[ | | \epsilon - \epsilon_ {\theta} (\sqrt {\bar {\alpha} _ {t}} \mathcal {E} (\boldsymbol {x} _ {0}) + \sqrt {1 - \bar {\alpha} _ {t}} \epsilon , t, \{\boldsymbol {S}, \boldsymbol {P} \}) | | \right]. \tag {9}$$
Besides, we emphasize two essential strategies when training our MAGICDRIVE. First, to counteract our filtering of visible boxes, we randomly add $10\%$ invisible boxes as an augmentation, enhancing the model's geometric transformation capabilities. Second, to leverage cross-view attention, which facilitates information sharing across multiple views, we apply unique noises to different views in each training step, preventing trivial solutions to Equation 9 (e.g., outputting the shared component across different views). Identical random noise is reserved exclusively for inference.
# 5 EXPERIMENTS
# 5.1 EXPERIMENTAL SETUPS
Dataset and Baselines. We employ the nuScenes dataset (Caesar et al., 2020), a prevalent dataset in BEV segmentation and detection for driving, as the testing ground for MAGICDRIVE. We adhere to the official configuration, utilizing 700 street-view scenes for training and 150 for validation. Our baselines are BEVGen (Swerdlow et al., 2023) and BEVControl (Yang et al., 2023a), both recent propositions for street view generation. Our method considers 10 object classes and 8 road classes, surpassing the baseline models in diversity. Appendix B holds additional details.
Evaluation Metrics. We evaluate both realism and controllability for street view generation. Realism is mainly measured using Fréchet Inception Distance (FID), reflecting image synthesis quality. For controllability, MAGICDRIVE is evaluated through two perception tasks: BEV segmentation and 3D object detection, with CVT (Zhou & Krahenbuhl, 2022) and BEVFusion (Liu et al., 2023a) as perception models, respectively. Both of them are renowned for their performance in each task. Firstly, we generate images aligned with the validation set annotations and use perception models pre-trained with real data to assess image quality and control accuracy. Then, data is generated based on the training set to examine the support for training perception models as data augmentation.
Model Setup. Our MAGICDRIVE utilizes pre-trained weights from Stable Diffusion v1.5, training only newly added parameters. Per Zhang et al. (2023a), a trainable UNet encoder is created for $E_{map}$ . New parameters, except for the zero-init module and the class token, are randomly initialized. We adopt two resolutions to reconcile discrepancies in perception tasks and baselines: $224 \times 400$ ( $0.25 \times$ down-sample) following BEVGen and for CVT model support, and a higher $272 \times 736$ ( $0.5 \times$ down-sample) for BEVFusion support. Unless stated otherwise, images are sampled using the UniPC (Zhao et al., 2023) scheduler for 20 steps with CFG at 2.0.
# 5.2 MAIN RESULTS
Realism and Controllability Validation. We assess MAGICDRIVE's capability to create realistic street-view images with the annotations from the nuScenes validation set. As shown by Table 1, MAGICDRIVE outperforms others in image quality, yielding notably lower FID scores. Regarding controllability, assessed via BEV segmentation tasks, MAGICDRIVE equals or exceeds baseline results at $224 \times 400$ resolution due to the distinct encoding design that enhances vehicle generation precision. At $272 \times 736$ resolution, our encoding strategy advancements enhance vehicle mIoU performance. Cropping large areas negatively impacts road mIoU on CVT. However, our bounding box encoding efficacy is backed by BEVFusion's results in 3D object detection.
Table 1: Comparison of generation fidelity with driving-view generation methods. Conditions for data synthesis are from nuScenes validation set. For each task, we test the corresponding models trained on the nuScenes training set. MAGICDRIVE surpasses all baselines throughout the evaluation. $\uparrow/\downarrow$ indicates that a higher/ lower value is better. The best results are in bold, while the second best results are in underlined italic (when other methods are available).
<table><tr><td rowspan="2">Method</td><td rowspan="2">Synthesis resolution</td><td rowspan="2">FID↓</td><td colspan="2">BEV segmentation</td><td colspan="2">3D object detection</td></tr><tr><td>Road mIoU ↑</td><td>Vehicle mIoU ↑</td><td>mAP ↑</td><td>NDS ↑</td></tr><tr><td>Oracle</td><td>-</td><td>-</td><td>72.21</td><td>33.66</td><td>35.54</td><td>41.21</td></tr><tr><td>Oracle</td><td>224×400</td><td>-</td><td>72.19</td><td>33.61</td><td>23.54</td><td>31.08</td></tr><tr><td>BEVGen</td><td>224×400</td><td>25.54</td><td>50.20</td><td>5.89</td><td>-</td><td>-</td></tr><tr><td>BEVControl</td><td>-</td><td>24.85</td><td>60.80</td><td>26.80</td><td>-</td><td>-</td></tr><tr><td>MAGICDRIVE</td><td>224×400</td><td>16.20</td><td>61.05</td><td>27.01</td><td>12.30</td><td>23.32</td></tr><tr><td>MAGICDRIVE</td><td>272×736</td><td>16.59</td><td>54.24</td><td>31.05</td><td>20.85</td><td>30.26</td></tr></table>

 Ground Truth BEVCortrol
 Inconsistent Wrong place
 MAGICDRIVE Figure 5: Qualitative comparison with BEVControl on driving scene from nuScenes validation set. We highlight some areas with rectangles to ease comparison. Compared with BEVControl, generations from MAGICDRIVE appear more consistent in both background and foreground.
Training Support for BEV Segmentation and 3D Object Detection. MAGICDRIVE can produce augmented data with accurate annotation controls, enhancing the training for perception tasks. For BEV segmentation, we augment an equal number of images as in the original dataset, ensuring consistent training iterations and batch sizes for fair comparisons to the baseline. As shown in Table 3, MAGICDRIVE significantly enhances CVT in both settings, outperforming BEVGen, which only marginally improves vehicle segmentation. For 3D object detection, we train BEVFusion models with MAGICDRIVE's synthetic data as augmentation. To optimize data augmentation, we randomly exclude $50\%$ of bounding boxes in each generated scene. Table 2 shows the advantageous impact of MAGICDRIVE's data in both CAM-only (C) and CAM+LiDAR (C+L) settings. It's crucial to note that in CAM+LiDAR settings, BEVFusion utilizes both modalities for object detection, requiring more precise image generation due to LiDAR data incorporation. Nevertheless, MAGICDRIVE's synthetic data integrates seamlessly with LiDAR inputs, highlighting the data's high fidelity.
# 5.3 QUALITATIVE EVALUATION
Comparison with Baselines. We assessed MAGICDRIVE against two baselines, BEVGen and BEVControl, synthesizing multi-camera views for the same validation scenes (the comparison with BEVGen is in the Appendix D). Figure 5 illustrates that MAGICDRIVE generates images markedly superior in quality to BEVControl, particularly excelling in accurate object positioning and maintaining consistency in street views for backgrounds and objects. Such performance primarily stems from MAGICDRIVE's bounding box encoder and its cross-view attention module.
Multi-level Controls. The design of MAGICDRIVE introduces multi-level controls to street-view generation through separation encoding. This section demonstrates the capabilities of MAGICDRIVE by exploring three control signal levels: scene level (time of day and weather), background level (BEV map alterations and conditional views), and foreground level (object orientation and deletion). As illustrated in Figure 1, Figure 6, and Appendix E, MAGICDRIVE adeptly accommodates alterations at each level, maintaining multi-camera consistency and high realism in generation.
Table 2: Comparison about support for 3D object detection model (i.e., BEVFusion). MAGICDRIVE generates ${272} \times {736}$ images for augmentation. Results are reported on the nuScenes validation set.
<table><tr><td>Modality</td><td>Data</td><td>mAP ↑</td><td>NDS ↑</td></tr><tr><td rowspan="2">C</td><td>w/o synthetic data</td><td>32.88</td><td>37.81</td></tr><tr><td>w/ MAGICDRIVE</td><td>35.40 +2.52</td><td>39.76 +1.95</td></tr><tr><td rowspan="2">C+L</td><td>w/o synthetic data</td><td>65.40</td><td>69.59</td></tr><tr><td>w/ MAGICDRIVE</td><td>67.86 +2.46</td><td>70.72 +1.13</td></tr></table>
Table 3: Comparison about support for BEV segmentation model (i.e., CVT). Results are reported by testing on the nuScenes validation set.
<table><tr><td>Data</td><td>Vehicle mIoU ↑</td><td>Road mIoU ↑</td></tr><tr><td>w/o synthetic data</td><td>36.00</td><td>74.30</td></tr><tr><td>w/ BEVGen</td><td>36.60 +0.60</td><td>71.90 -2.40</td></tr><tr><td>w/ MAGICDRIVE</td><td>40.34 +4.34</td><td>79.56 +5.26</td></tr></table>
 Figure 6: Showcase for multi-level control with MAGICDRIVE. We show background-level and foreground-level control separately with different conditions. All scenes are based on the nuScenes validation set. More results are in Appendix E.
# 5.4 EXTENSION TO VIDEO GENERATION
We demonstrate the extensibility of MAGICDRIVE to video generation by fine-tuning it on nuScenes videos. This involves modifying self-attention to ST-Attn (Wu et al., 2023a), adding a temporal attention module to each transformer block (Figure 7 left), and tuning the model on 7-frame clips with only the first and the last frames having bounding boxes. We sample initial noise independently for each frame using the UniPC (Zhao et al., 2023) sampler for 20 steps and illustrate an example in Figure 7 right.
Furthermore, by utilizing the interpolated annotations from ASAP (Wang et al., 2023c) like DriveDreamer (Wang et al., 2023b), MagicDrive can be extended to 16-frame video generation at $12\mathrm{Hz}$ trained on Nvidia V100 GPUs. More results (e.g., video visualization) can be found on our website.
# 6 ABLATION STUDY
Bounding Box Encoding. MAGICDRIVE utilizes separate encoders for bounding boxes and road maps. To demonstrate the efficacy, we train a ControlNet (Zhang et al., 2023a) that takes the BEV map with both road and object semantics as a condition (like BEVGen), denoted as "w/o $E_{box}$ " in Table 4. Objects in BEV maps are relatively small, which require separate $E_{box}$ for accurate vehicle annotations, as shown by the vehicle mIoU performance gap. Applying visible object filter $f_{viz}$ significantly improves both road and vehicle mIoU by reducing the optimization burden. A MAGICDRIVE variant incorporating $E_{box}$ with BEV of road and object semantics didn't enhance performance, emphasizing the importance of integrating diverse information through different strategies.
Effect of Classifier-free Guidance. We focus on the two most crucial conditions, i.e. object boxes and road maps, and analyze how CFG affects the performance of generation. We change CFG from 1.5 to 4.0 and plot the change of validation results from CVT in Figure 8. Firstly, by increasing
 Figure 7: Extend MAGICDRIVE to video generation. Left: changes in transformer block for video generation. Right: result of video generation. Only keyframes have bounding box control.
Table 4: Ablation of the separate box encoder. Evaluation results are from CVT on the synthetic nuScenes validation set, without $M = \{0\}$ in CFG scale $= 2$ . MAGICDRIVE has better controllability and keeps image quality.
<table><tr><td>Method</td><td>FID ↓</td><td>Road mIoU ↑</td><td>Vehicle mIoU ↑</td></tr><tr><td>w/o Ebox</td><td>18.06</td><td>58.31</td><td>5.50</td></tr><tr><td>w/o fviz</td><td>14.67</td><td>56.46</td><td>24.73</td></tr><tr><td>w/ Ebox & mapobj</td><td>14.70</td><td>56.04</td><td>26.20</td></tr><tr><td>Ours</td><td>14.46</td><td>59.31</td><td>27.13</td></tr></table>
 Figure 8: Effect of CFG on different conditions to each metrics.
CFG scale, FID degrades due to notable changes in contrast and sharpness, as seen in previous studies (Chen et al., 2023c). Secondly, retaining the same map for both conditional and unconditional inference eliminates CFG's effect on the map condition. As shown by blue lines of Figure 8, increasing CFG scale results in the highest vehicle mIoU at CFG=2.5, but the road mIoU keeps decreasing. Thirdly, with $M = \{0\}$ for unconditional inference in CFG, road mIoU significantly increases. However, it slightly degrades the guidance on vehicle generation. As mentioned in Section 4.3, CFG complexity increases with more conditions. Despite simplifying training, various CFG choices exist during inference. We leave the in-depth investigation for this case as future work.
# 7 CONCLUSION
This paper presents MAGICDRIVE, a novel framework to encode multiple geometric controls for high-quality multi-camera street view generation. With the separation encoding design, MAGICDRIVE fully utilizes geometric information from 3D annotations and realizes accurate semantic control for street views. Besides, the proposed cross-view attention module is simple yet effective in guaranteeing consistency across multi-camera views. As evidenced by experiments, the generations from MAGICDRIVE show high realism and fidelity to 3D annotations. Multiple controls equipped MAGICDRIVE with improved generalizability for the generation of novel street views. Meanwhile, MAGICDRIVE can be used for data augmentation, facilitating the training for perception models on both BEV segmentation and 3D object detection tasks.
Limitation and Future Work. We show failure cases from MAGICDRIVE in Figure 9. Although MAGICDRIVE can generate night views, they are not as dark as real images (as in Figure 9a). This may be due to that diffusion models are hard to generate too dark images (Guttenberg, 2023). Figure 9b shows that MAGICDRIVE cannot generate unseen weathers for nuScenes. Future work may
 Figure 9: Failure cases of MAGICDRIVE.

focus on how to improve the cross-domain generalization ability of street view generation.
Acknowledgement. This work is supported in part by the General Research Fund (GRF) of Hong Kong Research Grants Council (RGC) under Grant No. 14203521, in part by the CUHK SSFCRS funding No. 3136023, and in part by the Research Matching Grant Scheme under Grant No. 7106937, 8601130, and 8601440. We gratefully acknowledge the support of MindSpore, CANN (Compute Architecture for Neural Networks) and Ascend AI Processor used for this research. This research has been made possible by funding support from the Research Grants Council of Hong Kong through the Research Impact Fund project R6003-21.
# REFERENCES
Tim Brooks, Aleksander Holynski, and Alexei A Efros. Instructpix2pix: Learning to follow image editing instructions. In CVPR, 2023. Holger Caesar, Varun Bankiti, Alex H Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. In CVPR, 2020. Kai Chen, Lanqing Hong, Hang Xu, Zhenguo Li, and Dit-Yan Yeung. Multisiam: Self-supervised multi-instance siamese representation learning for autonomous driving. In ICCV, 2021. Kai Chen, Zhili Liu, Lanqing Hong, Hang Xu, Zhenguo Li, and Dit-Yan Yeung. Mixed autoencoder for self-supervised visual representation learning. In CVPR, 2023a. Kai Chen, Chunwei Wang, Kuo Yang, Jianhua Han, Lanqing Hong, Fei Mi, Hang Xu, Zhengying Liu, Wenyong Huang, Zhenguo Li, Dit-Yan Yeung, Lifeng Shang, Xin Jiang, and Qun Liu. Gaining wisdom from setbacks: Aligning large language models via mistake analysis. arXiv preprint arXiv:2310.10477, 2023b. Kai Chen, Enze Xie, Zhe Chen, Lanqing Hong, Zhenguo Li, and Dit-Yan Yeung. Integrating geometric control into text-to-image diffusion models for high-quality detection data generation via text prompt. arXiv preprint arXiv:2306.04607, 2023c. Yaran Chen, Haoran Li, Ruiyuan Gao, and Dongbin Zhao. Boost 3-d object detection via point clouds segmentation and fused 3-d giou-11 loss. IEEE TNNLS, 2020. Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In CVPR, 2021. Ruiyuan Gao, Chenchen Zhao, Lanqing Hong, and Qiang Xu. DiffGuard: Semantic mismatch-guided out-of-distribution detection using pre-trained diffusion models. In ICCV, 2023. Chongjian Ge, Junsong Chen, Enze Xie, Zhongdao Wang, Lanqing Hong, Huchuan Lu, Zhenguo Li, and Ping Luo. MetaBEV: Solving sensor failures for bev detection and map segmentation. In ICCV, 2023. Yunhao Gou, Zhili Liu, Kai Chen, Lanqing Hong, Hang Xu, Aoxue Li, Dit-Yan Yeung, James T Kwok, and Yu Zhang. Mixture of cluster-conditional lora experts for vision-language instruction tuning. arXiv preprint arXiv:2312.12379, 2023. Nicholas Guttenberg. Diffusion with offset noise. https://www.crosslabs.org/blog/ diffusion-with-offset-noise, 2023. Jianhua Han, Xiwen Liang, Hang Xu, Kai Chen, Lanqing Hong, Chaoqiang Ye, Wei Zhang, Zhenguo Li, Xiaodan Liang, and Chunjing Xu. Soda10m: Towards large-scale object detection benchmark for autonomous driving. arXiv preprint arXiv:2106.11118, 2021. Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021. Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In NeurIPS, 2020. Junjie Huang, Guan Huang, Zheng Zhu, Ye Yun, and Dalong Du. Bevdet: High-performance multicamera 3d object detection in bird-eye-view. arXiv preprint arXiv:2112.11790, 2021.
Yuanfeng Ji, Zhe Chen, Enze Xie Xie, Lanqing Hong, Xihui Liu, Zhaoqiang Liu, Tong Lu, Zhenguo Li, and Ping Luo. DDP: Diffusion model for dense visual prediction. In ICCV, 2023. Kaican Li, Kai Chen, Haoyu Wang, Lanqing Hong, Chaoqiang Ye, Jianhua Han, Yukuai Chen, Wei Zhang, Chunjing Xu, Dit-Yan Yeung, et al. Coda: A real-world road corner case dataset for object detection in autonomous driving. arXiv preprint arXiv:2203.07724, 2022. Pengxiang Li, Zhili Liu, Kai Chen, Lanqing Hong, Yunzhi Zhuge, Dit-Yan Yeung, Huchuan Lu, and Xu Jia. Trackdiffusion: Multi-object tracking data generation via diffusion models. arXiv preprint arXiv:2312.00651, 2023a. Yuheng Li, Haotian Liu, Qingyang Wu, Fangzhou Mu, Jianwei Yang, Jianfeng Gao, Chunyuan Li, and Yong Jae Lee. Gligen: Open-set grounded text-to-image generation. In CVPR, 2023b. Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dóllár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014. Nan Liu, Shuang Li, Yilun Du, Antonio Torralba, and Joshua B Tenenbaum. Compositional visual generation with composable diffusion models. In ECCV, 2022a. Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, 2021. Zhijian Liu, Haotian Tang, Alexander Amini, Xingyu Yang, Huizi Mao, Daniela Rus, and Song Han. Bevfusion: Multi-task multi-sensor fusion with unified bird's-eye view representation. In ICRA, 2023a. Zhili Liu, Jianhua Han, Kai Chen, Lanqing Hong, Hang Xu, Chunjing Xu, and Zhenguo Li. Taskcustomized self-supervised pre-training with scalable dynamic routing. In AAAI, 2022b. Zhili Liu, Kai Chen, Yifan Zhang, Jianhua Han, Lanqing Hong, Hang Xu, Zhenguo Li, Dit-Yan Yeung, and James Kwok. Geom-erasing: Geometry-driven removal of implicit concept in diffusion models. arXiv preprint arXiv:2310.05873, 2023b. Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019. Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In ECCV, 2020. Alexander Quinn Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. In ICML, 2022. Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In ICML, 2021. Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In CVPR, 2022. Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In ICLR, 2020. Alexander Swerdlow, Runsheng Xu, and Bolei Zhou. Street-view image generation from a bird's-eye view layout. arXiv preprint arXiv:2301.04634, 2023. Shitao Tang, Fuyang Zhang, Jiacheng Chen, Peng Wang, and Yasutaka Furukawa. Mvdiffusion: Enabling holistic multi-view image generation with correspondence-aware diffusion. arXiv preprint arXiv:2307.01097, 2023. Hung-Yu Tseng, Qinbo Li, Changil Kim, Suhib Alsisan, Jia-Bin Huang, and Johannes Kopf. Consistent view synthesis with pose-guided diffusion models. In CVPR, 2023. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
Su Wang, Chitwan Sahara, Ceslee Montgomery, Jordi Pont-Tuset, Shai Noy, Stefano Pellegrini, Yasumasa Onoe, Sarah Laszlo, David J Fleet, Radu Soricut, et al. Imagen editor and editbench: Advancing and evaluating text-guided image inpainting. In CVPR, 2023a. Weilun Wang, Jianmin Bao, Wengang Zhou, Dongdong Chen, Dong Chen, Lu Yuan, and Houqiang Li. Semantic image synthesis via diffusion models. arXiv preprint arXiv:2207.00050, 2022. Xiaofeng Wang, Zheng Zhu, Guan Huang, Xinze Chen, Jiagang Zhu, and Jiwen Lu. Drive-dreamer: Towards real-world-driven world models for autonomous driving. arXiv preprint arXiv:2309.09777, 2023b. Xiaofeng Wang, Zheng Zhu, Yunpeng Zhang, Guan Huang, Yun Ye, Wenbo Xu, Ziwei Chen, and Xingang Wang. Are we ready for vision-centric driving streaming perception? the asap benchmark. In CVPR, 2023c. Jay Zhangjie Wu, Yixiao Ge, Xintao Wang, Stan Weixian Lei, Yuchao Gu, Yufei Shi, Wynne Hsu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. Tune-a-video: One-shot tuning of image diffusion models for text-to-video generation. In CVPR, 2023a. Weijia Wu, Yuzhong Zhao, Hao Chen, Yuchao Gu, Rui Zhao, Yefei He, Hong Zhou, Mike Zheng Shou, and Chunhua Shen. Datasetdm: Synthesizing data with perception annotations using diffusion models. arXiv preprint arXiv:2308.06160, 2023b. Kairui Yang, Enhui Ma, Jibin Peng, Qing Guo, Di Lin, and Kaicheng Yu. Bevcontrol: Accurately controlling street-view elements with multi-perspective consistency via bev sketch layout. arXiv preprint arXiv:2308.01661, 2023a. Yijun Yang, Ruiyuan Gao, Xiaosen Wang, Nan Xu, and Qiang Xu. Mma-diffusion: Multimodal attack on diffusion models. arXiv preprint arXiv:2311.17516, 2023b. Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. In ICCV, 2023a. Shu Zhang, Xinyi Yang, Yihao Feng, Can Qin, Chia-Chih Chen, Ning Yu, Zeyuan Chen, Huan Wang, Silvio Savarese, Stefano Ermon, et al. Hive: Harnessing human feedback for instructional visual editing. arXiv preprint arXiv:2303.09618, 2023b. Wenliang Zhao, Lujia Bai, Yongming Rao, Jie Zhou, and Jiwen Lu. Unipc: A unified predictor-corrector framework for fast sampling of diffusion models. arXiv preprint arXiv:2302.04867, 2023. Ziyang Zheng, Ruiyuan Gao, and Qiang Xu. Non-cross diffusion for semantic consistency. arXiv preprint arXiv:2312.00820, 2023. LIU Zhili, Kai Chen, Jianhua Han, HONG Lanqing, Hang Xu, Zhenguo Li, and James Kwok. Taskcustomized masked autoencoder via mixture of cluster-conditional experts. In ICLR, 2023. Bolei Zhou, Hang Zhao, Xavier Puig, Tete Xiao, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Semantic understanding of scenes through the ade20k dataset. In IJCV, 2019. Brady Zhou and Philipp Krahenbuhl. Cross-view transformers for real-time map-view semantic segmentation. In CVPR, 2022.
# APPENDIX
# A OBJECT FILTERING
 Figure 10: Bounding box filtering to each view. The dashed lines in (b-c) represent the $x$ -axis of the camera's coordinates. Boxes are retained only if they have at least a point in the positive half of the $z$ -axis in each camera's coordinate.
In Equation 6, we employ $f_{viz}$ for object filtering to facilitate bootstrap learning. We show more details of $f_{viz}$ here. Refer to Figure 10 for illustration. For the sake of simplicity, each camera's Field Of View (FOV) is not considered. Objects are defined as visible if any corner of their bounding boxes is located in front of the camera (i.e., $z^{v_i} > 0$ ) within each camera's coordinate system. The application of $f_{viz}$ significantly lightens the workload of the bounding box encoder, evidence for which can be found in Section 6.
# B MORE EXPERIMENTAL DETAILS
Semantic Classes for Generation. To support most perception models on nuScenes, we try to include semantics commonly used in most settings (Huang et al., 2021; Zhou & Krahenbuhl, 2022; Liu et al., 2023a; Ge et al., 2023). Specifically, for objects, ten categories include car, bus, truck, trailer, motorcycle, bicycle, construction vehicle, pedestrian, barrier, and traffic cone. For the road map, eight categories include drivable area, pedestrian crossing, walkway, stop line, car parking area, road divider, lane divider, and roadblock.
Optimization. We train all newly added parameters using AdamW (Loshchilov & Hutter, 2019) optimizer and a constant learning rate at $8e^{-5}$ and batch size 24 (total 144 images for 6 views) with a linear warm-up of 3000 iterations, and set $\gamma^s = 0.2$ .
# C ABLATION ON NUMBER OF ATTENDING VIEWS
Table 5: Ablation on number of attending views. Evaluation results are from CVT on the synthetic nuScenes validation set, without $M = \{0\}$ in CFG scale $= 2$ .
<table><tr><td>Attending Num.</td><td>FID ↓</td><td>Road mIoU ↑</td><td>Vehicle mIoU ↑</td></tr><tr><td>1</td><td>13.06</td><td>58.63</td><td>26.41</td></tr><tr><td>2 (ours)</td><td>14.46</td><td>59.31</td><td>27.13</td></tr><tr><td>5 (all)</td><td>14.76</td><td>58.35</td><td>25.41</td></tr></table>
In Table 5, we demonstrate the impact of varying the number of attended views on evaluation results. Attending to a single view yields superior FID results; the reduced influx of information from neighboring views simplifies optimization for that view. However, this approach compromises mIoU, also reflecting less consistent generation, as depicted in Figure 11. Conversely, incorporating all views deteriorates performance across all metrics, potentially due to excessive information causing interference in cross-attention. Since each view has an intersection with both left and right views, attending to one view cannot guarantee consistency, especially for foreground objects, while attending to more views requires more computation. Thus, we opt for 2 attended views in our main paper, striking a balance between consistency and computational efficiency.
 Attend to 2 views Figure 11: Comparison between different numbers of attending views. Only attending to one view results in worse multi-camera consistency.
 Attend to 1 view
# D QUALITATIVE COMPARISON WITH BEVGEN
 Figure 12 illustrates that MAGICDRIVE generates images with higher quality compared to BEV-Gen (Swerdlow et al., 2023), particularly excelling in objects. Such enhancement can be attributed to MAGICDRIVE's utilization of the diffusion model and the adoption of a customized condition injection strategy. Figure 12: Qualitative comparison with BEVGen on driving scene from nuScenes validation set. We highlight some areas with rectangles to ease comparison. Compared with BEVGen, image quality of objects from MAGICDRIVE is much better.
# E MORE RESULTS WITH CONTROL FROM DIFFERENT CONDITIONS
 Figure 13 shows scene level control (time of day) and background level control (BEV map alterations). MAGICDRIVE can effectively reflect these changes in control conditions through the generated camera views. Figure 13: Showcase for scene-level control with MAGICDRIVE. The scene is from the nuScenes validation set.
# F MORE EXPERIMENTS WITH 3D OBJECT DETECTION
Table 6: Comparison about support for 3D object detection model (i.e., BEVFusion). MAGICDRIVE generates $272\times 736$ images for augmentation. Results are from tests on the nuScenes validation set.
<table><tr><td rowspan="2">Epoch</td><td rowspan="2">Data</td><td colspan="2">CAM-Only</td><td colspan="2">CAM+LiDAR</td></tr><tr><td>mAP↑</td><td>NDS↑</td><td>mAP↑</td><td>NDS↑</td></tr><tr><td rowspan="2">0.5×</td><td>w/o synthetic data</td><td>30.21</td><td>32.76</td><td rowspan="2">too few epochs</td><td rowspan="2">too few epochs</td></tr><tr><td>w/ MAGICDRIVE</td><td>33.29 (+3.08)</td><td>36.69 (+3.93)</td></tr><tr><td rowspan="2">1×</td><td>w/o synthetic data</td><td>32.88</td><td>37.81</td><td>65.40</td><td>69.59</td></tr><tr><td>w/ MAGICDRIVE</td><td>35.40 (+2.52)</td><td>39.76 (+1.95)</td><td>67.86 (+2.46)</td><td>70.72 (+1.13)</td></tr><tr><td rowspan="2">2×</td><td>w/o synthetic data</td><td>35.49</td><td>40.66</td><td>68.33</td><td>71.31</td></tr><tr><td>w/ MAGICDRIVE</td><td>35.74 (+0.25)</td><td>41.40 (+0.74)</td><td>68.58 (+0.25)</td><td>71.34 (+0.03)</td></tr></table>
In Table 6, we show additional experimental results on training 3D object detection models using synthetic data produced by MAGICDRIVE. Given that BEVFusion utilizes a lightweight backbone (i.e., Swin-T (Liu et al., 2021)), model performance appears to plateau with training through $1-2 \times$ epochs ( $2 \times$ : 20 for CAM-Only and 6 for CAM+LiDAR). Reducing epochs can mitigate this saturation, allowing more varied data to enhance the model's perceptual capacity in both settings. This improvement is evident even when epochs for 3D object detection are further reduced to $0.5 \times$ . Our MAGICDRIVE accurately augments street-view images with the annotations. Future works may focus on annotation sampling and construction strategies for synthetic data augmentation.
# G MORE DISCUSSION
More future work. Note that MAGICDRIVE-generated street views can currently only perform as augmented samples to train with real data, and it is exciting to train detectors solely with generated data, which will be explored in the future. More flexible usage of the generated street views beyond data augmentation, especially incorporation with generative pre-training (Chen et al., 2023a; Zhili et al., 2023), contrastive learning (Chen et al., 2021; Liu et al., 2022b) and the large language models (LLMs) (Chen et al., 2023b; Gou et al., 2023), is an appealing future research direction. It is also interesting to utilize the geometric controls in different circumstances beyond 3D scenarios (e.g., multi-object tracking (Li et al., 2023a) and concept removal (Liu et al., 2023b)).
# H DETAILED ANALYSIS ON 3D OBJECT DETECTION WITH SYNTHETIC DATA
Table 7: Per-class performance comparison with BEVFusion for 3D object detection with $1\times$ setting. Results are tested on the nuScenes validation set.
<table><tr><td>Data</td><td>mAP</td><td>car</td><td>cone</td><td>barrier</td><td>bus</td><td>ped.</td><td>motor.</td><td>truck</td><td>bicycle</td><td>trailer</td><td>constr.</td></tr><tr><td>BEVFusion</td><td>32.88</td><td>50.67</td><td>50.46</td><td>48.62</td><td>37.73</td><td>35.74</td><td>30.40</td><td>27.54</td><td>24.85</td><td>15.56</td><td>7.28</td></tr><tr><td>+ MAGICDRIVE</td><td>35.40</td><td>51.86</td><td>53.56</td><td>51.15</td><td>40.43</td><td>38.10</td><td>33.11</td><td>29.35</td><td>27.85</td><td>18.74</td><td>9.83</td></tr><tr><td>Difference</td><td>+2.52</td><td>+1.20</td><td>+3.10</td><td>+2.53</td><td>+2.70</td><td>+2.36</td><td>+2.71</td><td>+1.81</td><td>+3.00</td><td>+3.19</td><td>+2.55</td></tr></table>
We provide per-class AP for 3D object detection from the nuScenes validation set using BEVFusion in Table 7. From the results, we observe that, firstly, the improvements for large objects are significant, for example, buses, trailers, and construction vehicles. Secondly, objects with less diverse appearances, such as traffic cones and barriers, show more improvement, especially compared to trucks. Thirdly, we note that the improvement is marginal for cars, while significant for pedestrians, motorcycles, and bicycles. This may be because the baseline already performs well for cars. For pedestrians, motorcycles, and bicycles, even though distant objects from the ego car are generated less faithfully, MAGICDRIVE can synthesize high-quality objects near the ego car, as shown in Figure 17-18. Therefore, more accurate detection of objects near the ego car contributes to improvements for these classes. Overall, mAP improvement comes with promotion in all classes' AP, indicating MAGICDRIVE can indeed help the training of perception models.
# I MORE RESULTS FOR BEV SEGMENTATION
BEVFusion is also capable of BEV segmentation and considers most of the classes we used in the BEV map condition. Due to the lack of baselines, we present the results in Table 8 to facilitate comparison for future works. As can be seen, the $272 \times 736$ resolution does not outperform the $224 \times 400$ resolution. This is consistent with the results from CVT in Table 1 on the Road segment. Such results confirm that better map controls rely on maintaining the original aspect ratio for generation training (i.e., avoiding cropping on each side).
Table 8: Generation fidelity to BEV map conditions. Results are tested with BEVFusion for BEV segmentation on the nuScenes validation set.
<table><tr><td rowspan="2">Methods</td><td rowspan="2">resolution</td><td colspan="2">mIOU for 6 classes</td></tr><tr><td>CAM-only</td><td>CAM+LiDAR</td></tr><tr><td>Oracle</td><td>-</td><td>57.09</td><td>62.94</td></tr><tr><td>Oracle</td><td>224×400</td><td>52.72</td><td>58.49</td></tr><tr><td>MAGICDRIVE</td><td>224×400</td><td>30.24</td><td>48.21</td></tr><tr><td>MAGICDRIVE</td><td>272×736</td><td>28.71</td><td>47.12</td></tr></table>
# J GENERALIZATION OF CAMERA PARAMETERS
To improve generalization ability, MAGICDRIVE encodes raw camera intrinsic and extrinsic parameters for different perspectives. However, the generalization ability is somewhat limited due to nuScenes fixing camera poses for different scenes. Nevertheless, we attempt to exchange the intrinsic and extrinsic parameters between the three front cameras and three back cameras. The comparison is shown in Figure 14. Since the positions of the nuScenes cameras are not symmetrical from front to back, and the back camera has a $120^{\circ}$ FOV compared to the $70^{\circ}$ FOV of the other cameras, clear differences between front and back views can be observed for the same 3D coordinates.
 Figure 14: To show the generalization ability of learned camera encoding, we exchange the camera parameters between 3 front cameras and 3 back cameras. The 3D position is the same for two generations. We highlight some areas (with box boxes)
# K MORE GENERATION RESULTS
We show some corner-case (Li et al., 2022) generations in Figure 15, and more generations in Figure 16-Figure 18.
 Figure 15: Generation from MAGICDRIVE with corner-case annotations.
 Figure 16: Generation from MAGICDRIVE with annotations from nuScenes validation set.








 Figure 17: Generation from MAGICDRIVE with annotations from nuScenes validation set.
 Figure 18: Generation from MAGICDRIVE with annotations from nuScenes validation set.123version https://git-lfs.github.com/spec/v1oid sha256:d4deec17dedd292c09c2bcb0dab66943862e78647534aa21829ed15367cc5cadsize 1728719123version https://git-lfs.github.com/spec/v1oid sha256:8cc600aaef5833b12e4bda5acb3b04075977436e49f7f4df59979d5244629982size 2451341123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452# MAGNITUDE INVARIANT PARAMETRIZATIONS IMPROVE HYPERNETWORK LEARNING
Jose Javier Gonzalez Ortiz MIT CSAIL
Cambridge, MA
josejg@mit.edu
John Guttag
MIT CSAIL
Cambridge, MA
guttag@mit.edu
Adrian V. Dalca
MIT CSAIL & MGH, HMS
Cambridge, MA
adalca@mit.edu
# ABSTRACT
Hypernetworks, neural networks that predict the parameters of another neural network, are powerful models that have been successfully used in diverse applications from image generation to multi-task learning. Unfortunately, existing hypernetworks are often challenging to train. Training typically converges far more slowly than for non-hypernetwork models, and the rate of convergence can be very sensitive to hyperparameter choices. In this work, we identify a fundamental and previously unidentified problem that contributes to the challenge of training hypernetworks: a magnitude proportionality between the inputs and outputs of the hypernetwork. We demonstrate both analytically and empirically that this can lead to unstable optimization, thereby slowing down convergence, and sometimes even preventing any learning. We present a simple solution to this problem using a revised hypernetwork formulation that we call Magnitude Invariant Parametrizations (MIP). We demonstrate the proposed solution on several hypernetwork tasks, where it consistently stabilizes training and achieves faster convergence. Furthermore, we perform a comprehensive ablation study including choices of activation function, normalization strategies, input dimensionality, and hypernetwork architecture; and find that MIP improves training in all scenarios. We also provide easy-to-use code that can turn existing networks into MIP-based hypernetworks.
# 1 INTRODUCTION
Hypernetworks, neural networks that predict the parameters of another neural network, are increasingly important models in a wide range of applications such as Bayesian optimization (Krueger et al., 2017; Pawlowski et al., 2017), generative models (Alaluf et al., 2022; Zhang & Agrawala, 2023), amortized model learning (Bae et al., 2022; Dosovitskiy & Djolonga, 2020; Hoopes et al., 2022), continual learning (Ehret et al., 2021; von Oswald et al., 2020), multi-task learning (Mahabadi et al., 2021; Serrà et al., 2019), and meta-learning (Bensadoun et al., 2021; Zhao et al., 2020). Despite their advantages and growing use, training hypernetworks is challenging. Compared to non-hypernetwork-based models, training existing hypernetworks is often unstable. At best this increases training time, and at worst it can prevent training from converging at all. This burden limits their adoption, negatively impacting many applications. Existing hypernetwork heuristics, like gradient clipping (Ha et al., 2016; Krueger et al., 2017), are most often insufficient, while existing techniques to improve standard neural network training often fail when applied to hypernetworks.
This work addresses a cause of training instability. We identify and characterize a previously unstudied hypernetwork design problem and provide a straightforward solution to address it. We demonstrate analytically and empirically that the typical choices of architecture and parameter initialization in hypernetworks cause a proportionality relationship between the scale of hypernetwork inputs and the scale of parameter outputs (Fig. 1a). The resulting fluctuations in predicted parameter scale lead to large variability in the scale of gradients during optimization, resulting in unstable training and slow convergence. In some cases, this phenomenon prevents any meaningful learning. To overcome the identified magnitude proportionality issue, we propose a revision to hypernetwork models: Magnitude Invariant Parametrizations (MIP). MIP effectively eliminates the influence of the scale of hypernetwork inputs on the scale of the predicted parameters, while retaining the representational power of existing formulations. We demonstrate the proposed solution across several hypernetwork
 (a) HyperNetwork Proportionality Issue
 (b) Convergence Improvements Figure 1: (a) Proportionality Issue. With default formulations, the scale of the predicted parameters $\theta$ (measured in standard deviation) is directly proportional to scale of the hypernetwork input $\gamma$ at initialization (initial), and even after training the model (final). Our proposed Magnitude Invariant Parametrizations (MIP) mitigates this proportionality issue with respect to $\gamma$ . (b) Convergence Improvements. Using MIP leads to faster convergence and results in more stable training than the default hypernetwork formulation. The latter experiences sporadic training instabilities (spikes in the training loss).
learning tasks, providing evidence that hypernetworks using MIP achieve faster convergence and more stable training than typical hypernetwork formulation (Fig. 1b).
Our main contributions are:
- We characterize a previously unidentified optimization problem in hypernetwork training, and show that it leads to large gradient variance and unstable training dynamics. - We propose a solution: Magnitude Invariant Parametrizations (MIP), a hypernetwork formulation that addresses the issue without introducing additional training or inference costs. - We rigorously study the proposed parametrization. We first compare it with the standard formulation and against popular normalization strategies, showing that it consistently leads to faster convergence and more stable training. We then extensively test it using various choices of optimizer, input dimensionality, hypernetwork architecture, and activation function, finding that it improves hypernetwork training in all evaluated settings. - We release our implementation as an open-source PyTorch library, HyperLight. HyperLight facilitates the development of hypernetwork models and provides principled choices for parametrizations and initializations, making hypernetwork adoption more accessible. We also provide code that enables using MIP seamlessly with existing models.
# 2 RELATED WORK
Parameter Initialization. Deep neural networks experience unstable training dynamics in the presence of exploding or vanishing gradients (Goodfellow et al., 2016). Weight initialization plays a critical role in the magnitude of gradients, particularly during the early stages of training. Commonly, weight initialization strategies focus on preserving the magnitude of activations during the forward pass and maintaining the magnitude of gradients during the backward pass (Glorot & Bengio, 2010; He et al., 2015). In the context of hypernetworks, early work made use of Glorot and Kaiming initialization (Balažević et al., 2019; Pawlowski et al., 2017), while more recent work proposes initializations that accounts for the architectural properties of the primary network (Beck et al., 2023; Chang et al., 2019; Knyazev et al., 2021; Zhmoginov et al., 2022). However, most of these works assume hypernetwork inputs to be categorical embeddings, which limits their applicability, and makes their formulations susceptible to the proportionality issue that we identify in this work.
Normalization Techniques. Normalization techniques control the distribution of weights and activations, often leading to improvements in convergence by smoothing the loss surface (BJORCK et al., 2018; Ioffe, 2017; Lubana et al., 2021; Santurkar et al., 2018). Batch normalization is widely used to normalize activations using minibatch statistics, and methods like layer or group normalization instead normalize across features (Ba et al., 2016; Ulyanov et al., 2016; Wu & He, 2018). Other methods reparametrize the weights using weight-normalization strategies to decompose direction
and magnitude (Qiao et al., 2019; Salimans & Kingma, 2016). As we show in our experiments, these strategies fail to resolve the proportionality issue we study. They either maintain the proportionality relationship, or eliminate proportionality by rendering the predicted weights independent of the hypernetwork input, eliminating the utility of the hypernetwork itself.
Adaptive Optimization. High gradient variance can be detrimental to model convergence in stochastic gradient methods (Johnson & Zhang, 2013; Roux et al., 2012). Solutions to mitigate this issue encompass adaptive optimization techniques, which aim to decouple the effect of gradient direction and magnitude by normalizing by a history of gradient magnitudes (Kingma & Ba, 2014; Zeiler, 2012). Similarly, applying momentum reduces the instantaneous impact of stochastic gradients by using parameter updates based on an exponentially decaying average of past gradients (Nesterov, 2013; Qian, 1999). These strategies are implemented by many widely-used optimizers, such as Adam (Balles & Hennig, 2018; Kingma & Ba, 2014). We show experimentally that although adaptive optimizers like Adam enhance hypernetwork optimization, they do not address the root cause of the identified proportionality issue.
Fourier Features. High-dimensional Fourier projections have been used in feature engineering (Rahimi et al., 2007) and for positional encodings in language modeling applications to account for both short and long range relationships (Su et al., 2021; Vaswani et al., 2017). Additionally, implicit neural representation models benefit from sinusoidal representations (Sitzmann et al., 2020; Tancik et al., 2020). Our work also uses low dimensional Fourier projections. We demonstrate their use as a means to project hypernetwork inputs to a vector space with constant Euclidean norm.
Residual Forms. Residual and skip connections are widely used in deep learning models and often improve model training, particularly with increasing network depth (He et al., 2016a;b; Li et al., 2018; Vaswani et al., 2017). Building on this intuition, instead of the hypernetworks predicting the network parameters directly, our proposed hypernetworks predict parameter changes, mitigating part of the proportionality problem at hand.
# 3 THE HYPERNETWORK PROPORTIONALITY PROBLEM
Preliminaries. Deep learning tasks generally involve a model $f(x; \theta) \to y$ , with learnable parameters $\theta$ . In hierarchical models using hypernetworks, the parameters $\theta$ of the primary network $f$ are predicted by a hypernetwork $h(\gamma; \omega) \to \theta$ based on a input vector $\gamma$ . Instead of learning parameters $\theta$ of the primary network $f$ , only the learnable parameters $\omega$ of the hypernetwork $h$ are optimized using backpropagation. The specific nature of the hypernetwork inputs $\gamma$ varies across applications, but regularly corresponds to a low dimensional quantity that models properties of the learning task, and is often a simple scalar or embedding vector (Dosovitskiy & Djolonga, 2020; Hoopes et al., 2022; Lorraine & Duvenaud, 2018; Ukai et al., 2018; Wang et al., 2021).
Assumptions. For analysis, we assume the following about the hypernetwork formulation: 1) The architecture is a series of fully connected layers $\phi(Wx + b)$ where $W$ are the parameters, $b$ the biases and $\phi(x)$ the non-linear activation function; 2) The nonlinear activation is a piece-wise linear function with a single switch at the origin. Namely, it satisfies $\phi(x) = \mathbb{1}_{[x \geq 0]}(\alpha x) + \mathbb{1}_{[x < 0]}(\beta x)$ , for $\alpha, \beta > 0$ (e.g., LeakyReLU) 3) Bias vectors $b$ are initialized to zero. Existing hypernetworks satisfy these properties for the large majority of applications (Dosovitskiy & Djolonga, 2020; Ha et al., 2016; Lorraine & Duvenaud, 2018; MacKay et al., 2019; Ortiz et al., 2023; Ukai et al., 2018; von Oswald et al., 2020; Wang et al., 2021).
Input-Output Proportionality. We demonstrate that under these widely-used settings, hypernetwork inputs and outputs involve a proportionality relationship, and describe how this can impede hypernetwork training. We show that 1) at initialization, any intermediate feature vector $x^{(k)}$ at layer $k$ will be proportional to hypernetwork input $\gamma$ , even under the presence of non-linear activation functions, and 2) this leads to large gradient magnitude fluctuations detrimental to optimization.
We first consider the case where $\gamma \in \mathbb{R}$ is a scalar value. Let $h(\gamma ;\omega)$ use a fully connected architecture composed of a series of fully connected layers
$$\begin{array}{l} h (\gamma ; \omega) = W ^ {(n)} x ^ {(n)} + b ^ {(n)} \\ x ^ {(k + 1)} = \phi \left(W ^ {(k)} x ^ {(k)} + b ^ {(k)}\right) \tag {1} \\ x ^ {(1)} = \gamma \\ \end{array}$$
where $x^{(k)}$ is the input vector of the $k^{\mathrm{th}}$ fully connected layer with learnable parameters $W^{(k)}$ and biases $b^{(k)}$ . To prevent gradients from exploding or vanishing when chaining several layers, it is common to initialize the parameters $W^{(i)}$ and biases $b^{(i)}$ so that either the magnitude of the activations is approximately constant across layers in the forward pass (known as fan in), or so that the magnitude of the gradients is constant across layers in the backward pass (known as fan out) (Glorot & Bengio, 2010; He et al., 2015). In both settings, the parameters $W^{(i)}$ are initialized using a zero mean Normal distribution and bias vectors $b^{(i)}$ are initialized to zero. If $\gamma > 0$ , and $\phi(x)$ has the common form specified above, at initialization the $i^{\mathrm{th}}$ entry of vector $x^{(2)}$ is
$$x _ {i} ^ {(2)} = \phi \left(W _ {i} ^ {(1)} \gamma + b ^ {(1)}\right) = \gamma \phi \left(W _ {i} ^ {(1)}\right) \propto \gamma , \tag {2}$$
since $b^{(1)} = 0$ and $\phi(W_i^{(1)})$ is independent of $\gamma$ . Using induction, we assume that for layer $k$ , $x_j^{(k)} \propto \gamma \forall j$ , and show this property for layer $k + 1$ . The value of the $i^{\text{th}}$ element of vector $x^{(k + 1)}$ is
$$x _ {i} ^ {(k + 1)} = \phi \left(b _ {i} ^ {(k)} + \sum_ {j} W _ {i j} ^ {(k)} x _ {j} ^ {(k)}\right) = \gamma \phi \left(\sum_ {j} W _ {i j} ^ {(k)} \alpha_ {j} ^ {(k)}\right) \propto \gamma , \tag {3}$$
since $b_{i}^{(k)} = 0$ , and the term inside $\phi$ is independent of $\gamma$ . If $\gamma$ is not strictly positive, we can reach the same proportionality result, but with separate constants for the positive and the negative range. This dependency holds regardless of the number of layers and the number of neurons per hidden layer, and also holds when residual connections are employed. When $\gamma$ is a vector input, we find a similar relationship with the overall magnitude of the input and the magnitude of the output. Given the absence of bias terms, and the lack of multiplicative interactions in the architecture, the fully connected network propagates magnitude changes in the input.
Training implications. Since $\theta = x^{(n + 1)}$ , this result leads to a proportionality relationship for the magnitude of the predicted parameters $||\theta ||_2\propto ||\gamma ||$ and their variance $\mathrm{Var}(\theta)\propto ||\gamma ||^2$ . As the scale of the primary network parameters $\theta$ will depend on $\gamma$ , this will affect the scale of the layer outputs and gradients of the primary network. In turn, these large gradient magnitude fluctuations lead to unstable training dynamics for stochastic gradient descent methods (Glorot & Bengio, 2010).
Further Considerations. Our analysis relies on biases being at zero, which only holds at initialization, and does not include normalization layers that are sometimes used. However, in our experiments, we find that biases remain near zero during early training, and hypernetworks with alternative choices of activation function, input dimensionality, or with normalization layers, still suffer from the identified issue and consistently benefit from our proposed parametrization (see Section 6).
# 4 MAGNITUDE INVARIANT PARAMETRIZATIONS
To address the proportionality dependency, we make two straightforward changes to the typical hypernetwork formulation: 1) We introduce an encoding function that maps inputs into a constant-norm vector space, and 2) we treat hypernetwork predictions as additive changes to the main network parameters, rather than as the parameters themselves. These changes make the primary network weight distribution non-proportional to the hypernetwork input and stable across the range of hypernetwork inputs. Figure 2 illustrates these changes to the hypernetwork.
Input Encoding. To address the proportionality problem, we map the inputs $\gamma \in [0,1]$ to a space with a constant Euclidean norm $||\mathrm{E}_{\mathrm{L2}}(\gamma)||_2 = 1$ using the function $\mathrm{E}_{\mathrm{L2}}(\gamma) = [\cos (\gamma \pi /2),\sin (\gamma \pi /2)]$ . With this change, the input magnitude to the hypernetwork is constant, so $||x^{(1)}||\neq \gamma$ . For higher-dimensional inputs, we apply this transformation to each input individually, leading to an output vector with double the number of dimensions. This transformation results in an input representation with a constant norm, thereby eliminating the proportionality effect.
For our input encoding, we first map each dimension of the input vector to the range [0, 1] to maximize output range of $\mathrm{E}_{\mathrm{L2}}$ . We use min-max scaling of the input: $\gamma' = (\gamma - \gamma_{\min}) / (\gamma_{\max} - \gamma_{\min})$ . For unconstrained inputs, such as Gaussian variables, we first apply the logistic function $\sigma(x) = 1 / (1 + \exp(-x))$ . If inputs span several orders of magnitude, we take the log before the min-max scaling as in (Bae et al., 2022; Dosovitskiy & Djolonga, 2020).
Output Encoding. Residual forms have become a cornerstone in contemporary deep learning architectures (He et al., 2016a; Li et al., 2018; Vaswani et al., 2017). Motivated by these methods, we
 Figure 2: Magnitude Invariant Parametrizations for Hypernetworks. MIP first projects the hypernetwork inputs $\gamma$ to a constant norm vector space. Then the outputs of the hypernetwork $\Delta \theta$ are treated as additive changes to a set of independent learnable parameters $\theta^0$ to generate the primary network weights $\theta$ . In blue we highlight the main components of MIP, the input encoding $\mathrm{E}_{\mathrm{L2}}$ and the residual formulation $\theta = \theta^0 + \Delta \theta$ .
replace the standard hypernetwork framework with one that learns both primary network $f$ parameters (as is typically learned in existing formulations) and hypernetwork predictions, which are used as additive changes to these primary parameters. We introduce a set of learnable parameters $\theta^0$ , and compute the primary network parameters as $\theta = \theta^0 + h(\mathrm{E}_{\mathrm{L2}}(\gamma); \omega)$ .
Parameter Initialization We initialize the hypernetwork weights $\omega$ using common initialization methods for fully connected layers that consider the number of input and output neurons to each layer, such as Kaiming or Glorot initialization. Then, we initialize the independent parameters $\theta^0$ in the same manner that we would initialize the parameters of an equivalent regular network. We provide further details and examples in section A of the supplement.
# 5 EXPERIMENTAL SETUP
# 5.1 TASKS
We evaluate our proposed parametrization on several tasks involving hypernetwork-based models.
Bayesian Neural Networks. Hypernetwork models have been used to learn families of functions conditioned on a prior distribution (Ukai et al., 2018). During training, the prior representation $\gamma \in \mathbb{R}^d$ is sampled from the prior distribution $\gamma \sim p(\gamma)$ and used to condition the hypernetwork $h(\gamma ;\omega)\to \theta$ to predict the parameters of the primary network model $f(x;\theta)$ . Once trained, the family of posterior networks is then used to estimate parameter uncertainty or to improve model calibration. For illustrative purposes we first evaluate a setting where $f(x;\theta)$ is a feed-forward neural network used to classify the MNIST dataset. Then, we tackle a more complex setting where $f(x;\theta)$ is a ResNet-like model trained the OxfordFlowers-102 dataset (Nilsback & Zisserman, 2006). In both settings, we use the prior $\mathcal{N}(0,1)$ for each input.
Hypermorphism. Learning-based medical image registration networks $f(x_{m},x_{f};\theta)\rightarrow \phi$ register a moving image $x_{m}$ to a fixed image $x_{f}$ by predicting a flow or deformation field $\phi$ between them. The common (unsupervised) loss balances an image alignment term $\mathcal{L}_{\mathrm{sim}}$ and a spatial regularization (smoothness) term $\mathcal{L}_{\mathrm{reg}}$ . The learning objective is then $\mathcal{L} = (1 - \gamma)\mathcal{L}_{\mathrm{sim}}(x_m\circ \phi ,x_f) + \gamma \mathcal{L}_{\mathrm{reg}}(\phi)$ , where $\gamma$ controls the trade-off. In Hypermorph (Hoopes et al., 2022), multiple regularization settings for medical image registration are learned jointly using hypernetworks. The hypernetwork is given the trade-off parameter $\gamma$ as input, sampled stochastically from $\mathcal{U}(0,1)$ during training. We follow the same experimental setup, using a U-Net architecture for the primary (registration) network and training with MSE for $\mathcal{L}_{\mathrm{sim}}$ and total variation for $\mathcal{L}_{\mathrm{reg}}$ . We train models on the OASIS dataset. For evaluation, we use the predicted flow field to warp anatomical segmentation label maps of the moving image, and measure the volume overlap to the fixed label maps (Balakrishnan et al., 2019).
Scale-Space Hypernetworks. We also use a hypernetwork to efficiently learn a family of models with varying internal rescaling factors in the downsampling and upsampling layers, as done in Ortiz et al. (2023). In this setting, $\gamma$ corresponds to the scale factor. Given hypernetwork input $\gamma$ , the
 Figure 3: Distributions of primary network parameters (a) and layer activations (b). Measurements are taken at initialization for a default hypernetwork, our proposed MIP hypernetwork, and a conventional neural network with the same primary architecture. Distributions are shown as kernel density estimates (KDE) of the values because of the high degree of overlap between the distributions. The MIP strategy leads to little change across input values and its distribution closely matches that of the non-hypernetwork model. Evolution of Gradients (c) Gradient magnitude with respect to hypernetwork outputs $||\nabla_{\theta}\mathcal{L}||$ during early training. Standard deviation is computed across minibatches in the same epoch. MIP leads to substantially smaller magnitude and standard deviation compared to the default parametrization.


hypernetwork $h(\gamma ;\omega)\to \theta$ predicts the parameters of the primary network, which performs the spatial rescaling operations according to the value of $\gamma$ . We study a setting where $f(x;\theta)$ is a convolutional network with variable resizing layers, the rescaling factor is sampled from $\mathcal{U}(0,0.5)$ , and evaluate using the OxfordFlowers-102 classification problem and the OASIS segmentation task.
# 5.2 EXPERIMENT DETAILS
Model. We implement the hypernetwork as a neural network with fully connected layers and LeakyReLU activations for all but the last layer, which has linear output. Hypernetwork weights are initialized using Kaiming initialization on fan out mode and biases are initialized to zero. Unless specified otherwise, the hypernetwork architecture has two hidden layers with 16 and 128 neurons respectively. We use this implementation for both the default (existing) hypernetworks, and our proposed (MIP) hypernetworks.
Training. We use two popular choices of optimizer: SGD with Nesterov momentum, and Adam. We search over a range of initial learning rates and report the best performing models; further details are included in section B of the supplement.
Implementation. An important contribution of our work is HyperLight, our PyTorch hypernetwork framework. HyperLight implements the proposed hypernetwork parametrization, but also provides a modular and composable API that facilitates the development of hypernetwork models. Using HyperLight, practitioners can employ existing non-hypernetwork model definitions and pretrained model weights, and can easily build models using hierarchical hypernetworks. Anonymized source code is available at https://github.com/annonresearcher8/hyperlight.
# 6 EXPERIMENTAL RESULTS
# 6.1 EFFECT OF PROPORTIONALITY ON PARAMETER AND GRADIENT DISTRIBUTIONS
First, we empirically show how the proportionality phenomenon affects the distribution of predicted weights $\theta$ and their corresponding gradients for the Bayesian neural networks on MNIST. Figures 3a
and 3b compare the distributions of the primary network weights and layer outputs for a range of values of hypernetwork input $\gamma$ . The default hypernetwork parametrization is highly sensitive to changes in the input, in contrast, MIP eliminates this dependency, with the resulting distribution closely matching that of the non-hypernetwork models. Figure 1a (in the introduction), shows that using the default formulation, the scale of the weights correlates linearly with the value of the hypernetwork input, and that, crucially, this correlation is still present after the training process ends. In contrast, MIP parametrizations lead to a weight distribution that is robust to the input $\gamma$ , both at the start and end of training.
We also analyze how the proportionality affects the early phase of hypernetwork optimization by studying the distribution of gradient norms during training. Figure 3c shows the norm of the predicted parameter gradients $||\nabla_{\theta}\mathcal{L}||$ as training progresses. Consistent with our analysis, hypernetworks with default parametrization experience large swings in gradient magnitude because of the proportionality relationship between inputs and predicted parameters. In contrast, the MIP strategy leads to a substantially smaller variance and more stable gradient magnitude.
# 6.2 MODEL TRAINING IMPROVEMENTS
In this experiment, we analyze how MIP affects model convergence for the considered tasks. For all experiments, we found that MIP hypernetworks did not introduce a measurable impact in training runtime, so we report per-epoch steps.
Figure 1b (in the introduction) shows the training loss for Bayesian networks trained on MNIST. We find that MIP parametrizations result in smaller loss sooner during training, and the default parametrization suffers from sporadic training instabilities (spikes in the training loss), while MIP leads to stable training. Similarly, Figure 4a shows the test accuracy for Bayesian networks trained on OxfordFlowers. In this task, MIP also achieves faster convergence and better final model accuracy for both choices of optimizer.
Figures 4b and 4c present convergence curves for the other two tasks. For Hypermorph, MIP parametrizations are crucial when using SGD with momentum since otherwise the model fails to meaningfully train. For all choices of learning rate the default hypernetwork failed to converge, whereas with MIP parametrization it converged for a large range of values. With Adam, networks train meaningfully, and MIP models consistently achieve similar Dice scores substantially faster. They are less sensitive to weight initializations. Though the Adam optimizer partially mitigates the gradient variance issue by normalizing by a history of previous gradients, the MIP parametrization leads to substantially faster convergence. Furthermore, for the Scale-Space segmentation, we find that for both optimizers MIP models achieve substantially faster convergence and better final accuracy compared to those with the default parametrization.
Comparison to normalization strategies. We compare the proposed parametrization to popular choices of normalization layers found in the deep learning literature. Using the default formulation, where the predicted weights start proportional to the hypernetwork input, we found that existing normalization strategies fall into two categories: they either keep the proportionality relationship present (such as batch normalization), or remove the proportionality by making the predicted weights independent of the hypernetwork input (such as layer or weight normalization). We provide further details in Section C of the supplemental material.
We test several of these normalization strategies. BatchNorm-P, adds batch normalization layers to the primary network. LayerNorm-P, adds feature normalization layers to the primary network. LayerNorm-H, adds feature normalization layers to the hypernetwork layers. WeightNorm, performs weight normalization, which decouples the gradient magnitude and direction, to weights predicted by the hypernetwork (Ba et al., 2016; Ioffe, 2017; Salimans & Kingma, 2016). Figure 5a shows the evolution of the test accuracy for the Scale-Space hypernetworks trained on OxfordFlowers. We report wall clock time, since some normalization strategies, such as BatchNorm, substantially increase the computation time required per iteration. For networks trained with SGD, these normalization strategies enable training, but do not significantly improve on default hypernetworks when trained with Adam. Models trained with SGD momentum and hypernetwork feature normalization (LayerNorm-H) diverged early into training for all considered hyperparameter settings. Models trained with the proposed MIP parametrization lead to substantially faster convergence and better final model accuracy.
 Figure 4: Models Convergence Improvements. Comparison between default hypernetworks and hypernetworks with MIP for the Bayesian networks on OxfordFlowers-102 (a), HyperMorph (b) and Scale-Space hypernetworks trained on OASIS (c). In all cases, we find that the MIP parametrization leads to faster model convergence without any sacrifice in final model accuracy compared to the default parametrization. In all cases we observe that MIP improves convergence and final model accuracy. We also find that for default hypernetworks using the Adam optimizer substantially helps the training process, however, incorporating MIP leads to even better training dynamics.


Initialization Schemes. We compare MIP and the default hypernetworks to hypernetworks that use the Hyperfan-in and Hyperfan-out initialization strategies from Chang et al. (2019). The Hyperfan initialization takes into account the hypernetwork and primary network architectures when initializing model weights, improving model convergence and training stability. However, Hyperfan initializations are not designed for magnitude-encoded inputs, so they are susceptible to the proportionality issue we identify.
Figure 5b presents convergence results for the Hypermorph task with SGD and Adam. We find that Hyperfan initializations do not resolve the training challenges when using SGD. For hypernetworks trained with Adam, MIP outperforms both Hyperfan variants.
Ablation Analysis. We study the contribution of each of the two main components of the MIP parametrizations: input encoding and additive output formulation. Figure 5c shows the effect on convergence for two tasks. We found that both components reduce the proportionality dependency between the hypernetwork inputs and outputs, and that each component independently achieves substantial improvements in model convergence. However, we find that best results (fastest convergence) are consistently achieved when both components are used jointly during training.
# 6.3 ROBUSTNESS ANALYSIS
Hypernetwork Input Dimensionality. We study the effect of the number of dimensions of the input to the hypernetwork model. We evaluate on the Bayesian neural network task, and we vary the number of dimensions of the input prior. We train models with geometrically increasing number of input dimensions, $\dim (\gamma) = 1,2,\ldots ,32$ . Figure 6 (in section C.1 of the supplement) shows that the proposed MIP strategy leads to improvements in model convergence and final model accuracy as we increase the dimension of the hypernetwork input $\gamma$ .
Choice of Hypernetwork Architecture. We assess model performance when varying the properties of the hypernetwork architecture. We vary the width (number of hidden neurons per layer) and depth (number of layers)– fully connected networks with 3, 4 and 5 layers and with 16 and 128 neurons per layer, as well as an exponentially growing number of neurons per layer $\mathrm{Dim}(x^n) = 16\cdot 2^n$ . Figures 7 and 8 (in section C.2 of the supplement) show that the MIP improvements generalize to the all tested hypernetwork architectures with analogous improvements in model training.
 (a) Normalization Techniques
 (b) Initialization Scheme
 (c) MIP Ablation
 Figure 5: (a) Normalization Strategies. Comparison of hypernetworks trained with various normalization strategies for Scale-Space hypernetworks trained of OxfordFlowers-102. MIP provides substantially better results than the considered normalization strategies, achieving faster model convergence and better final test accuracy. (b) Initialization Scheme. Comparison of hypernetworks with the default, MIP, Hyperfan-In and Hyperfan-Out initialization schemes on the Hypermorph task. Models with MIP train substantially better than models with Hyperfan initializations, especially when using the SGD optimizer. (c) Ablation Analysis. Convergence results for separate components of MIP on the Scale-Space Hypernetworks on OASIS using the Adam optimizer, and on the Bayesian networks trained with SGD on the OxfordFlowers-102 classification problem. Each component of the parametrization leads to improvements in final model accuracy as well as training convergence, and best results are achieved when using both components simultaneously.


Choice of Nonlinear Function Activation. While our method is motivated by the training instability present in hypernetworks with (Leaky)-ReLU nonlinear activation functions, we explored applying it to other common choices of activation functions found in the literature: Tanh, GELU and SiLU (Hendrycks & Gimpel, 2016; Ramachandran et al., 2017). Figure 9 (in section C.3 of the supplement) shows that MIP consistently helps for all choices of nonlinear activation function, and the improvements are similar to those of the LeakyReLU models.
# 7 LIMITATIONS
All hypernetwork models used in our experiments are composed of fully connected layers and use activation and initialization choices commonly recommended in the literature. Similarly, we focused on two optimizers in our experiments, SGD with momentum and Adam. We believe that we would see similar results for other less common architectures and optimizers, but this remains to be investigated. Furthermore, we focus on training models from scratch. As hypernetworks become popular in transfer learning, we believe this will be an interesting avenue for future analysis of MIP.
# 8 CONCLUSION
We showed through analysis and experimentation that traditional hypernetwork formulations are susceptible to training instability, caused by the effect of the magnitude of hypernetwork input values on primary network weights and gradients, and that standard methods such as batch and layer normalization do not solve the problem. We then proposed the use of a new method, Magnitude Invariant Parametrizations (MIP), for addressing this problem. Through extensive experiments, we demonstrated that MIP leads to substantial improvements in convergence times and model accuracy across multiple hypernetwork architectures, training scenarios, and tasks. Given that using MIP never reduces model performance and can dramatically improve training, we expect the method to be widely useful for training hypernetworks.
# ACKNOWLEDGEMENTS
This research is supported by Quanta Computer, Inc, and Wistron Coporation. Additionally, the project was supported by NIH R01AG064027 and R01AG070988.
# REFERENCES
Yuval Alaluf, Omer Tov, Ron Mokady, Rinon Gal, and Amit Bermano. Hyperstyle: Stylegan inversion with hypernetworks for real image editing. In Proceedings of the IEEE/CVF conference on computer Vision and pattern recognition, pp. 18511-18521, 2022. Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. Juhan Bae, Michael R Zhang, Michael Ruan, Eric Wang, So Hasegawa, Jimmy Ba, and Roger Grosse. Multi-rate vae: Train once, get the full rate-distortion curve. arXiv preprint arXiv:2212.03905, 2022. Guha Balakrishnan, Amy Zhao, Mert R Sabuncu, John Guttag, and Adrian V Dalca. Voxelmorph: a learning framework for deformable medical image registration. IEEE transactions on medical imaging, 38(8):1788-1800, 2019. Ivana Balačević, Carl Allen, and Timothy M Hospedales. Hypernetwork knowledge graph embeddings. In International Conference on Artificial Neural Networks, pp. 553-565. Springer, 2019. Lukas Balles and Philipp Hennig. Dissecting adam: The sign, magnitude and variance of stochastic gradients. In International Conference on Machine Learning, pp. 404-413. PMLR, 2018. Jacob Beck, Matthew Thomas Jackson, Risto Vuorio, and Shimon Whiteson. Hypernetworks in meta-reinforcement learning. In Conference on Robot Learning, pp. 1478-1487. PMLR, 2023. Raphael Bensadoun, Shir Gur, Tomer Galanti, and Lior Wolf. Meta internal learning. Advances in Neural Information Processing Systems, 34:20645-20656, 2021. Nils Bjorck, Carla P Gomes, Bart Selman, and Kilian Q Weinberger. Understanding batch normalization. Advances in neural information processing systems, 31, 2018. Oscar Chang, Lampros Flokas, and Hod Lipson. Principled weight initialization for hypernetworks. In International Conference on Learning Representations, 2019. Lee R Dice. Measures of the amount of ecologic association between species. Ecology, 26(3): 297-302, 1945. Alexey Dosovitskiy and Josip Djolonga. You only train once: Loss-conditional training of deep networks. In International conference on learning representations, 2020. Benjamin Ehret, Christian Henning, Maria R. Cervera, Alexander Meulemans, Johannes von Oswald, and Benjamin F. Grewe. Continual learning in recurrent neural networks. In International Conference on Learning Representations, 2021. URL https://arxiv.org/abs/2006.12109. Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pp. 249-256. JMLR Workshop and Conference Proceedings, 2010. Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016. David Ha, Andrew Dai, and Quoc V Le. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026-1034, 2015.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016a. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630-645. Springer, 2016b. Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. Andrew Hoopes, Malte Hoffman, Douglas N. Greve, Bruce Fischl, John Guttag, and Adrian V. Dalca. Learning the effect of registration hyperparameters with hypermorph. Machine Learning for Biomedical Imaging, 1:1-30, 2022. ISSN 2766-905X. URL https://melba-journal.org/2022:003. Sergey Ioffe. Batch renormalization: Towards reducing minibatch dependence in batch-normalized models. arXiv preprint arXiv:1702.03275, 2017. Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. Advances in neural information processing systems, 26:315-323, 2013. Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. Boris Knyazev, Michal Drozdzal, Graham W Taylor, and Adriana Romero Soriano. Parameter prediction for unseen deep architectures. Advances in Neural Information Processing Systems, 34:29433-29448, 2021. David Krueger, Chin-Wei Huang, Riashat Islam, Ryan Turner, Alexandre Lacoste, and Aaron Courville. Bayesian hypernetworks. arXiv preprint arXiv:1710.04759, 2017. Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. Advances in neural information processing systems, 31, 2018. Jonathan Lorraine and David Duvenaud. Stochastic hyperparameter optimization through hypernetworks. arXiv preprint arXiv:1802.09419, 2018. Ilya Loshchilov and Frank Hutter. Fixing weight decay regularization in adam. CoRR, abs/1711.05101, 2017. URL http://arxiv.org/abs/1711.05101. Ekdeep S Lubana, Robert Dick, and Hidenori Tanaka. Beyond batchnorm: Towards a unified understanding of normalization in deep learning. Advances in Neural Information Processing Systems, 34:4778-4791, 2021. Matthew MacKay, Paul Vicol, Jon Lorraine, David Duvenaud, and Roger Grosse. Self-tuning networks: Bilevel optimization of hyperparameters using structured best-response functions. arXiv preprint arXiv:1903.03088, 2019. Rabeeh Karimi Mahabadi, Sebastian Ruder, Mostafa Dehghani, and James Henderson. Parameter-efficient multi-task fine-tuning for transformers via shared hypernetworks. arXiv preprint arXiv:2106.04489, 2021. Daniel S Marcus, Tracy H Wang, Jamie Parker, John G Csernansky, John C Morris, and Randy L Buckner. Open access series of imaging studies (oasis): cross-sectional mri data in young, middle aged, nondemented, and demented older adults. Journal of cognitive neuroscience, 19(9):1498-1507, 2007. Yurii Nesterov. Introductory lectures on convex optimization: A basic course, volume 87. Springer Science & Business Media, 2013. M-E Nilsback and Andrew Zisserman. A visual vocabulary for flower classification. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06), volume 2, pp. 1447-1454. IEEE, 2006.
Jose Javier Gonzalez Ortiz, John Guttag, and Adrian V. Dalca. Amortized learning of dynamic feature scaling for image segmentation. arXiv preprint arXiv:2304.05448, 2023. Nick Pawlowski, Andrew Brock, Matthew CH Lee, Martin Rajchl, and Ben Glocker. Implicit weight uncertainty in neural networks. arXiv preprint arXiv:1711.01297, 2017. Ning Qian. On the momentum term in gradient descent learning algorithms. Neural networks, 12 (1):145-151, 1999. Siyuan Qiao, Huiyu Wang, Chenxi Liu, Wei Shen, and Alan Yuille. Micro-batch training with batch-channel normalization and weight standardization. arXiv preprint arXiv:1903.10520, 2019. Ali Rahimi, Benjamin Recht, et al. Random features for large-scale kernel machines. In NIPS, volume 3, pp. 5. Citeseer, 2007. Prajit Ramachandran, Barret Zoph, and Quoc V Le. Searching for activation functions. arXiv preprint arXiv:1710.05941, 2017. Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pp. 234-241. Springer, 2015. Nicolas Le Roux, Mark Schmidt, and Francis Bach. A stochastic gradient method with an exponential convergence rate for finite training sets. arXiv preprint arXiv:1202.6258, 2012. Tim Salimans and Durk P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. Advances in neural information processing systems, 29:901-909, 2016. Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas, and Aleksander Mądry. How does batch normalization help optimization? In Proceedings of the 32nd international conference on neural information processing systems, pp. 2488-2498, 2018. Joan Serra, Santiago Pascual, and Carlos Segura. Blow: a single-scale hyperconditioned flow for non-parallel raw audio voice conversion. arXiv preprint arXiv:1906.00794, 2019. Vincent Sitzmann, Julien Martel, Alexander Bergman, David Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. Advances in Neural Information Processing Systems, 33, 2020. Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021. Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818-2826, 2016. Matthew Tancik, Pratul P Srinivasan, Ben Mildenhall, Sara Fridovich-Keil, Nithin Raghavan, Utkarsh Singhal, Ravi Ramamoorthi, Jonathan T Barron, and Ren Ng. Fourier features let networks learn high frequency functions in low dimensional domains. arXiv preprint arXiv:2006.10739, 2020. Kenya Ukai, Takashi Matsubara, and Kuniaki Uehara. Hypernetwork-based implicit posterior estimation and model averaging of cnn. In *Asian Conference on Machine Learning*, pp. 176-191. PMLR, 2018. Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
Johannes von Oswald, Christian Henning, Benjamin F. Grewe, and João Sacramento. Continual learning with hypernetworks. In International Conference on Learning Representations, 2020. URL https://arxiv.org/abs/1906.00695. Alan Q Wang, Adrian V Dalca, and Mert R Sabuncu. Regularization-agnostic compressed sensing mri reconstruction with hypernetworks. arXiv preprint arXiv:2101.02194, 2021. Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European conference on computer vision (ECCV), pp. 3-19, 2018. Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012. Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023. Dominic Zhao, Johannes von Oswald, Seijin Kobayashi, João Sacramento, and Benjamin F Grewe. Meta-learning via hypernetworks. 2020. Andrey Zhmoginov, Mark Sandler, and Maksym Vlademyrov. Hypertransformer: Model generation for supervised and semi-supervised few-shot learning. In International Conference on Machine Learning, pp. 27075-27098. PMLR, 2022.
# APPENDIX
# A MIP PARAMETER INITIALIZATION
Parameter initialization strategies for regular neural networks have remained fairly stable over the past half decade. The prevalent method consists of using Glorot or He initializations that are designed to preserve the magnitude of activations during the forward pass and maintain the magnitude of gradients during the backward pass (Glorot & Bengio, 2010; He et al., 2015).
Typically, the assumptions of these initialization schemes do not hold when applied to hypernetwork settings. This has prompted the development of several specialized initialization schemes tailored for hypernetwork formulations (Beck et al., 2023; Chang et al., 2019; Knyazev et al., 2021). Crucially, these techniques require incorporating the knowledge of the primary network when performing the initialization, and are designed for categorical inputs represented as embedding vectors. The guarantees these schemes provide do not hold when using magnitude-encoded inputs such as scalars.
We propose a simple yet effective initialization scheme based on the recommendations from the neural network literature. First, the hypernetwork weights $\omega$ are initialized using common initialization methods for fully connected layers. Then, the independent parameters $\theta^0$ are initialized taking into consideration their role in the primary network.
We illustrate our initialization rules using examples with the Kaiming He fan-out scheme. Using He fan-out init, the weights and biases of a neural network layer with $n_{\mathrm{in}}$ input neurons and $n_{\mathrm{out}}$ output neurons are sampled
$$W \sim \mathcal {N} \left(0, \frac {G}{\sqrt {n _ {\mathrm {o u t}}}}\right) \quad b = 0, \tag {4}$$
where $G$ is the relative gain of the non-linearity function $\phi(x)$ . For ReLU, we have $G = 2$ whereas linear or sigmoid, we have $G = 1$ .
We differentiate the following cases:
- Intermediate Hypernetwork Layer - We initialize a $(n_{\mathrm{in}}, n_{\mathrm{out}})$ layer in the hypernetwork following the scheme we just outlined, i.e., $W \sim \mathcal{N}(0, G / (\sqrt{n_{\mathrm{out}}})$ and $b = 0$ . - Final Hypernetwork Layer - We consider two cases, but we do not consider biases because they are redundant with $\theta_0$ .
1. Layer predicting a primary network weight of shape $(n_{\mathrm{in}}, n_{\mathrm{out}})$ :
$$W \sim \mathcal {N} \left(0, \frac {1}{\sqrt {n _ {\mathrm {i n}} n _ {\mathrm {o u t}}}}\right) \tag {5}$$
2. Layer predicting a primary network bias: $W = 0$
- Independent Weights $\theta_0$ - For fully connected layer with $(n_{\mathrm{in}}, n_{\mathrm{out}})$ neurons, we initialize $W \sim \mathcal{N}(0, G / (\sqrt{n_{\mathrm{out}}})$ , and $b = 0$ .
From this initialization, we can observe that the set of independent weights $\theta_0$ is initialized as if they were the weights of a regular neural network. Alternatively, if the primary network corresponds to a pretrained model, the independent weights $\theta_0$ are initialized using the pretrained values, and can be optionally frozen during training.
# A.1 IMPLEMENTATION CONSIDERATIONS
Since the $\theta_0$ weights are redundant with the bias parameters of the final hypernetwork layer, we remove bias parameters from the final hypernetwork layer. In our implementation, we use a single final layer, but we initialize its weights as if it were the multiple smaller layers, since otherwise the initialization would not follow the recommendations outlined in the previous section.
Under some hypernetwork configurations, all the primary network parameters are predicted in a single forward pass of the hypernetwork. In this scenario, we implement the parameters $\theta^0$ as the
bias vector terms of the last layer $b^{(n)}$ , which proves to be as efficient as the default formulation. This is correct because we do not have $b^{(n)}$ in our formulation, and $b^{(n)}$ is equivalent to $\theta^0$ in the computational graph, receiving the same gradients. Hence, we initialize $b^{(n)}$ as a one-dimensional representation of the primary network parameters, subsequently reshaping it to construct $\theta$ .
# B ADDITIONAL EXPERIMENTAL DETAILS
# B.1 DATASETS
MNIST. We train models on the MNIST digit classification task. We use the official MNIST database of handwritten digits. The MNIST database of handwritten digits comprises a training set of 60,000 examples, and a test set of 10,000 examples. We use the official train-test split for training data, and further divide the training split into training and validation using a stratified $80\% - 20\%$ split. We use the digit labels and consider the 10-way classification problem.
OxfordFlowers-102. We use the OxfordFlowers-102 dataset, a fine-grained vision classification dataset with 8,189 examples from 102 flower categories (Nilsback & Zisserman, 2006). We utilize this dataset as it poses a non-trivial learning task that does not quickly converge, and allows us to better study learning dynamics. We use the official train-test split for training data, and further divide the training split into training and validation using a stratified $80\% - 20\%$ split. We perform data augmentation by considering random square crops of between $25\%$ and $100\%$ of the original image area and resizing images to 256 by 256 pixels. Additionally, we perform random horizontal flips and color jitter (brightness $25\%$ , contrast $50\%$ , saturation $50\%$ ). For evaluation we take the central square crop of each image and resize to 256 by 256 pixels.
OASIS We use a version of the open-access OASIS Brains dataset (Hoopes et al., 2022; Marcus et al., 2007), a medical imaging dataset containing 414 MRI scans from separate individuals, comprised of skull-stripped and bias-corrected images that are resampled into an affinely-aligned, common template space. For each scan, segmentation labels for 24 brain substructures in a 2D coronal slice are available. We use $64\%$ , $16\%$ and $20\%$ splits for training, validation and test.
# B.2 BAYESIAN NEURAL NETWORKS
Primary Network. For the MNIST task, we use a LeNet architecture variant that uses ReLU activations as they have become more prevalent in modern deep learning models. Moreover, we replace the first fully-connected layer with two convolutional layers of 32 and 64 features. We found this change did not impact test accuracy in non-hypernetwork models, but it lead to more stable initializations for the default hypernetworks.
For the OxfordFlowers-102 task, the primary network $f$ features a ResNet-like architecture with five downsampling stages with (16, 32, 64, 128, 128) feature channels respectively. For experiments including normalization layers, such as BatchNorm and LayerNorm, the learnable affine parameters of the normalization layers are not predicted by the hypernetworks and are optimized like in regular neural networks via backpropagation.
Training. We train using a categorical cross entropy loss. For both optimizers we use learning rate $\eta = 3\times 10^{-4}$ . Nevertheless, we found consistent results with the ones we report using learning rates in the range $\eta = [10^{-4},3\times 10^{-3}]$ . We sample $\gamma$ from the uniform distribution $\mathcal{U}[0,1]$ .
Evaluation. For evaluation we use top-1 accuracy on the classification labels. In order to get a more fine-grained evolution of the test accuracy, we evaluate on test set at 0.25 epoch increments during training. We report results with five model replicas with different random seeds.
# B.3 HYPERMORPH
HyperMorph, a learning based strategy for deformable image registration learns models with different loss functions in an amortized manner. In image registration, the $\gamma$ hypernetwork input controls the trade-off between the reconstruction and regularization terms of the loss.
Primary Network. For our primary network $f$ we use a U-Net architecture (Ronneberger et al., 2015) with a convolutional encoder with five downsampling stages with two convolutional layers
per stage of 32 channels each. Similarly, the convolutional decoder is composed of four stages with two convolutional layers per stage of 32 channels each. We found that models with more convolutional filters performed no better than the described architecture.
Training. We train using the setup described in HyperMorph (Hoopes et al., 2022) using mean squared error for the reconstruction loss and total variation for the regularization of the predicted flow field. For the Adam optimizer we use $\beta_{1} = 0.9$ and $\beta_{2} = 0.999$ with decoupled decay Loshchilov & Hutter (2017) and $\eta = 10^{-4}$ , but we found that learning rates $[10^{-4},3\times 10^{-3}]$ lead to similar convergence results. For SGD with momentum, we tested learning rates $\eta = \{3\times 10^{-2},10^{-2},3\times 10^{-3},10^{-3},3\times 10^{-4},10^{-4},3\times 10^{-5},10^{-5}\}$ . In all cases the default hypernetwork formulation failed to meaningfully train. We train for 3000 epochs, and sample $\gamma$ uniformly in the range [0, 1] like in the original work.
Evaluation. Like Hoopes et al. (2022), we use segmentation labels as the main means of evaluation and use the predicted flow field to warp the segmentation label maps and measure the overlap to the ground truth using the Dice score (Dice, 1945), a popular metric for measuring segmentation quality. Dice score quantifies the overlap between two regions, with a score of 1 indicating perfect overlap and 0 indicating no overlap. For multiple segmentation labels, we compute the overall Dice coefficient as the average of Dice coefficients for each label. We report results with five model replicas with different random seeds.
# B.4 SCALE-SPACE HYPERNETWORKS
We evaluate on a task where the hypernetwork input $\gamma$ controls architectural properties of the primary network. We use $\gamma$ to determine the amount of downsampling in the pooling layers. Instead of using pooling layers that rescale by a fixed factor of two, we replace these operations by a fractional bilinear sampling operation that rescales the input by a factor of $\gamma$ .
Primary Network. For classification tasks, our primary network $f$ features a ResNet-like architecture with five downsampling stages with (16, 32, 64, 128, 128) feature channels respectively. For experiments including normalization layers, such as BatchNorm and LayerNorm, the learnable affine parameters of the normalization layers are not predicted by the hypernetworks and are optimized like in regular neural networks via backpropagation.
For segmentation tasks, we model the primary network $f$ using a U-Net architecture (Ronneberger et al., 2015) with a convolutional encoder with five downsampling stages with two convolutional layers per stage of 32 channels each. Similarly, the convolutional decoder is composed of four stages with two convolutional layers per stage of 32 channels each.
Training. We sample the hypernetwork input $\gamma$ uniformly in the range $[0, 0.5]$ where $\gamma = 0.5$ corresponds to downsampling by 2. We train the multi-class classification task using a categorical cross-entropy loss, and train with a weight decay factor of $10^{-3}$ , and with label smoothing Goodfellow et al. (2016); Szegedy et al. (2016) the ground truth labels with a uniform distribution of amplitude $\epsilon = 0.1$ . For the segmentation tasks we train using a cross-entropy loss and then fine-tune using a soft-Dice loss term, as in Ortiz et al. (2023). For both optimizers we use learning rate $\eta = 1 \times 10^{-4}$ . Nevertheless, we found consistent results with the ones we report using learning rates in the range $\eta = [1 \times 10^{-4}, 3 \times 10^{-3}]$ .
# C ADDITIONAL EXPERIMENTAL RESULTS
# C.1 NUMBER OF INPUT DIMENSIONS
In this experiment, we study the effect of the number of dimensions of the input to the hypernetwork model on the hypernetwork training process, both for the default parametrization and for our MIP parametrization. We evaluate using the Bayesian Hypernetworks, since we can vary the number of dimensions of the input prior without having to define new tasks. We train models with geometrically increasing number of input dimensions, $\dim (\gamma) = 1,2,\ldots ,32$ . We apply the input encoding to each dimension independently. We study two types of input distribution: uniform $\mathcal{U}(0,1)$ and Gaussian $\mathcal{N}(0,1)$ . For MIP, we apply a sigmoid to the Gaussian inputs to constrain them to the [0,1] range as specified by our method. We evaluate on the Bayesian hypernetworks task on the OxfordFlowers-102 dataset with a primary convolutional network optimized with Adam.
Figure 6 shows the convergence curves during training. Results indicate that the proposed MIP parametrization leads to improvements in model convergence and final model accuracy for all number of input dimensions to the hypernetwork and for both choices of input distribution. Moreover, we observe that the gap between MIP and the default parametrization does not diminish as the number of input dimensions grows.
 (a) Uniform Inputs $(\Gamma_{i} = \mathcal{U}(0,1))$ (b) Gaussian Inputs $(\Gamma_{i} = \mathcal{N}(0,1))$
 Figure 6: Number of dimensions of hypernetwork input. Test loss (top row) and test accuracy (bottom row) for Bayesian hypernetworks trained on the OxfordFlowers classification task for increasing number of dimensions of the hypernetwork input $\gamma$ . We report results for different prior input distributions: Uniform (a) and Gaussian (b). For each setting, we train 3 independent replicas with different random initialization and report the mean (solid line) and the standard deviation (shaded region). We see significant improvements in model training convergence when the hypernetwork uses the proposed MIP parametrization.
# C.2 CHOICE OF HYPERNETWORK ARCHITECTURE
In this experiment we test whether increasing the choice of hypernetwork architecture size has an effect on the improvements achieved by incorporating Magnitude Invariant Parametrizations (MIP). We study varying the width (the number of neurons per hidden layer) and the depth (the number of hidden layers) independently as well as jointly. For the depth, we consider networks with 3, 4 and 5 layers. For width, we consider having 16 neurons per layer, 128 neurons per layer, or having an exponentially growing number of neurons per layer (exp), following the expression $\mathrm{Dim}(x^n) = 16 \cdot 2^n$ .
We compare training networks using the default hypernetwork parametrization and MIP for the HyperMorph task. Figure 7 shows convergence curves for the evaluated settings, for several random initializations. Additionally, Figure 8 shows the distribution of final model performances for the range of inputs $\gamma \in [0,1]$ . We find that MIP models converge faster without sacrificing final model accuracy.






 Figure 7: Model convergence for several configurations of depth and width of the hypernetwork architecture for default and MIP hypernetworks. Results are for HyperMorph on OASIS. Shaded regions measure standard deviation across hypernetwork initializations.


 Figure 8: Test dice score for several configurations of depth and width of the hypernetwork architecture for default and MIP hypernetworks. Results are for HyperMorph on OASIS. Box-plots are reported over the range of hypernetwork inputs $\gamma$ . For all hypernetwork architectures, MIP parametrizations consistently lead to more accurate models.
# C.3 CHOICE OF NONLINEAR ACTIVATION FUNCTION
While our method is motivated by the training instability present in hypernetworks with (Leaky)-ReLU nonlinear activation functions, we explored applying it to other popular choices of activation functions. We consider popular activation functions GELU and SiLU (also known as Swish) that are close to the ReLU formulation, as well as the Tanh nonlinear function Hendrycks & Gimpel (2016); Ramachandran et al. (2017).
We evaluate on the Bayesian hypernetworks task on the OxfordFlowers-102 dataset with a primary convolutional network trained optimized with Adam. Figure 9 shows the convergence curves for Bayesian hypernetworks with a primary convolutional network trained on the OxfordFlowers classification task optimized with Adam. We see that MIP consistently helps for all choices of nonlinear activation function, and the improvements are similar to those of the LeakyReLU models.


 Hypernet Default MIP (ours)
 Figure 9: MIP on alternative nonlinear activation functions Test loss (top row) and test accuracy (bottom row) for Bayesian hypernetworks trained on the OxfordFlowers classification task for various choices of nonlinear activation function in the hypernetwork architecture: GELU, SiLU and Tanh. For each setting, we train 3 independent replicas with different random initialization and report the mean (solid line) and the standard deviation (shaded region). We see significant improvements in model training convergence when the hypernetwork uses the proposed MIP parametrization.

 Hypernet Default MIP (ours)
# C.4 FINAL MODEL PERFORMANCE
Table 1: Final model results on the test set for the considered tasks and models. We report the average performance averaged across the range of $\gamma$ inputs. We find MIP does not decrease model performance in any setting, while providing substantial improvements in several of them, especially when using the SGD optimizer. Standard deviation across random initializations is included in parentheses.
<table><tr><td></td><td></td><td colspan="2">Adam</td><td colspan="2">SGD</td></tr><tr><td>Task</td><td>Data</td><td>Default</td><td>MIP</td><td>Default</td><td>MIP</td></tr><tr><td rowspan="2">Bayesian NN</td><td>MNIST</td><td>98.1 (1.1)</td><td>99.1 (0.3)</td><td>99.2 (0.2)</td><td>99.0 (0.2)</td></tr><tr><td>OxfordFlowers-102</td><td>78.1 (1.9)</td><td>83.2 (0.3)</td><td>1.4 (0.1)</td><td>75.4 (0.5)</td></tr><tr><td>HyperMorph</td><td>OASIS</td><td>71.0 (0.3)</td><td>72.1 (0.3)</td><td>54.3 (0.4)</td><td>70.5 (0.2)</td></tr><tr><td>Scale-Space HN</td><td>OASIS</td><td>81.4 (0.3)</td><td>84.4 (0.6)</td><td>75.3 (2.7)</td><td>78.8 (1.4)</td></tr></table>
# C.5 NORMALIZATION STRATEGIES
Before developing MIP parametrizations we tested the viability of existing normalization strategies (such as Layer or Weight normalization) to deal with the identified proportionality phenomenon. While normalizing inputs and activations is a common practice in neural network training, hypernetworks present different challenges, and applying these techniques can actually be detrimental to the training process. Hypernetworks predict network parameters, and many of the assumptions behind parameter initialization and activation distribution do not easily translate between classical networks and hypernetworks.
An important distinction is that the main goal of our formulation is to ensure that the hypernetwork input has constant magnitude, not that is normalized (i.e., zero mean, unit variance). A normalized variable $z \sim \mathcal{N}(0,1)$ does not have constant magnitude (i.e., L2 norm), over its support, so normalization techniques do not solve the identified magnitude dependency and can actually lead to undesirable formulations. To show this, let $x \in \mathbb{R}^k$ be a hypernetwork activation vector, and $\gamma \in [0,1]$ the hypernetwork input. Then, according to the identified proportionality in Section 3.2, we know that $x = \gamma z$ . Here $x$ is the activation when the input is $\gamma$ and $z$ is a vector independent of $\gamma$ . The normalization output will be
$$\operatorname {N o r m} (x) = \frac {x - \mathbb {E} [ x ]}{\operatorname {S t d e v} [ x ]} = \frac {\gamma z - \mathbb {E} [ \gamma z ]}{\operatorname {S t d e v} [ \gamma z ]} = \frac {\gamma z - \gamma \mathbb {E} [ z ]}{| \gamma | \operatorname {S t d e v} [ z ]} = \frac {z - \mathbb {E} [ z ]}{\operatorname {S t d e v} [ z ]},$$
making the output independent of the hypernetwork input $\gamma$ . Following this reasoning, strategies like layer norm, instance norm or group norm in the hypernetwork will make the output of the model independent of the hypernetwork input, rendering the hypernetwork unusable for scalar inputs. For batch normalization cases it depends upon whether different hypernetwork inputs are used for each element in the minibatch. If not, the same logic applies as in the feature normalization strategies. Otherwise, the proportionality will still hold as the batch mean and standard deviation will be the same for all entries in the minibatch. Our experimental results confirm this. Hypernetworks with layer normalization fail to train in most settings. In contrast, we found consistently that training substantially improves when using our MIP formulation. See Figure 5a in the main body which shows that none of the tested normalization strategies is competitive with MIP in terms of model convergence or final model accuracy.
Batch Normalization - Applying batch normalization fails to deal with the proportionality phenomenon because it normalizes statistics that are independent of the magnitude of $\gamma$ keeping the proportionality (Ioffe, 2017). In our experiments, batch normalization performed similar to the default formulation when included in either the hypernetwork or the primary network, failing to address the proportionality relationship. For instance, all of the results in Figure 6 use batch normalization layers, as recommended for ResNet-like architectures. In this case, MIP still provides a substantial improvement in terms of model convergence and training stability.
Feature Normalization - Feature normalization techniques such as layer normalization, instance normalization or group normalization do remove the proportionality phenomenon we identify (Ba et al., 2016; Ulyanov et al., 2016). However, by doing so they make the predicted weights independent of the input hyperparameter, limiting the modeling capacity of the hypernetwork architecture. Moreover, in our empirical analysis, networks with layer normalization in the hypernetwork layers failed to train entirely, with the loss diverging early in training.
Weight Normalization - We also considered techniques that decouple the gradient magnitude and direction such as weight normalization (Qiao et al., 2019). Performing weight normalization on the hypernetwork predictions effectively decouples the gradient magnitude and direction. We find that convergence is substantially lower compared to the default parametrization. Moreover, final model performance does not match the default parametrization.123version https://git-lfs.github.com/spec/v1oid sha256:43e296eaa69cb96a7cc1c44de7cee4d782353520e82978f79297d26b139f69a1size 601983123version https://git-lfs.github.com/spec/v1oid sha256:ce358df3e002d6a842b7e18e0e87459bda363cf54dab131b2ffe2b26bbff7e36size 1221564123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573# MAGNUSHAMMER: A TRANSFORMER-BASED APPROACH TO PREMISE SELECTION
Maciej Mikula*
Google DeepMind
Szymon Tworkowski*
xAI
Szymon Antoniak*
Mistral AI
Bartosz Piotrowski
IDEAS NCBR
Albert Qiaochu Jiang
University of Cambridge
Jin Peng Zhou
Cornell University
Christian Szegedy
xAI
Łukasz Kuciński
IDEAS NCBR,
IMPAN
Piotr Miłos
IDEAS NCBR,
IMPAN
Yuhuai Wu
xAI
# ABSTRACT
This paper presents a novel approach to premise selection, a crucial reasoning task in automated theorem proving. Traditionally, symbolic methods that rely on extensive domain knowledge and engineering effort are applied to this task. In contrast, this work demonstrates that contrastive training with the transformer architecture can achieve higher-quality retrieval of relevant premises, without the engineering overhead. Our method, Magnushammer, outperforms the most advanced and widely used automation tool in interactive theorem proving called Sledgehammer. On the PISA and miniF2F benchmarks Magnushammer achieves $59.5\%$ (against $38.3\%$ ) and $34.0\%$ (against $20.9\%$ ) success rates, respectively. By combining Magnushammer with a language-model-based automated theorem prover, we further improve the state-of-the-art proof success rate from $57.0\%$ to $71.0\%$ on the PISA benchmark using 4x fewer parameters. Moreover, we develop and open source a novel dataset for premise selection, containing textual representations of (proof state, relevant premise) pairs. To the best of our knowledge, this is the largest available premise selection dataset, and the first one for the Isabelle proof assistant.
# 1 INTRODUCTION
Automating mathematical reasoning has been a central theme of artificial intelligence since its earliest days (De Bruijn, 1970). Recently, machine learning has led to significant advancements in both informal (Lewkowycz et al., 2022) and formal mathematical reasoning (Kaliszyk and Urban, 2015b; Alemi et al., 2016; Polu and Sutskever, 2020; Han et al., 2022). The latter approach, adopted in this paper, allows mechanical verification of proofs by proof assistants.
Modern mathematics development is gradual: it feeds upon a huge body of already established knowledge and constantly adds to it. Proving a mathematical statement requires retrieval of facts from the knowledge base that can advance the proof. In automated reasoning literature, this retrieval process is known as premise selection.
 Figure 1: Proof success rate for varying computational budget for Magnushammer, Sledgehammer, and BM25. Magnushammer shows remarkable scalability. See Sections 5.1 for the definition of computational budget and Section 5.2.1 for configurations depicted in this figure.
Many tools have been developed to tackle premise selection (Alama et al., 2011; Kuhlwein et al., 2012; Kaliszyk et al., 2017; Bansal et al., 2019), including a broad class known as "hammers," which leverage powerful automated theorem provers (ATPs) to determine useful premises (Paulson and Blanchette, 2012; Gauthier and Kaliszyk, 2015; Kaliszyk and Urban, 2015a; Czajka and Kaliszyk, 2018). One such tool, Sledgehammer (SH) (Paulson and Blanchette, 2012), has gained prominence with Isabelle (Paulson, 1993), where it helped to create a significant portion of Isabelle's proof corpus. Hammers are not yet available in all proof assistants (Ebner, 2020): implementing them is challenging due to the complex techniques required for different logics and type systems. There is a need for an effective premise selection tool that requires less adaptation to work for different proof assistants.
In this study, we provide a generic, data-driven, transformer-based (Vaswani et al., 2017) premise selection tool: Magnushammer. It constitutes a novel way to tackle the premise selection task, effective while requiring little domain-specific knowledge. Magnushammer is trained contrastively to perform premise retrieval in two stages: in the SELECT stage, it retrieves the most relevant 1024 premises (measured by the cosine similarity of their embeddings to that of the current proof state) from tens of thousands (the database contains 433K premises in total and typically 30K-50K are available in each proof state); in the RERANK stage, the retrieved premises are re-ranked with proof-state-aware scores: tokens of the proof state directly attend to tokens of the premise, giving a more contextualized relevance score. An overview of Magnushammer's architecture is shown in Figure 2b.
Magnushammer can prove $59.5\%$ of the theorems on the PISA benchmark (Jiang et al., 2021), a substantial improvement over Sledgehammer's $38.3\%$ . We demonstrate that this dominance is consistent with varying controlled compute budgets, shown in Figure 1. Furthermore, we replace the premise selection component (Sledgehammer) in a neural-symbolic model Thor (Jiang et al., 2022a) with Magnushammer and improve the state-of-the-art proof success rate on PISA from $57\%$ to $71\%$ .
To train Magnushammer, we extracted a premise selection dataset from the Isabelle theorem prover and its human proof libraries. The dataset consists of 4.4M premise selection instances, with 433K unique premises. To the best of our knowledge, this is the largest open-sourced premise selection dataset, and the first one of this kind for Isabelle. We find Magnushammer to be data efficient, outperforming Sledgehammer with only 4K training examples (0.1% of the training data available). The main contributions of this work are the following:
- We propose the use of transformers trained contrastively as a novel way of addressing the premise selection problem. Our method, Magnushammer, achieves a $59.5\%$ proof rate on the PISA benchmark, significantly improving the $38.3\%$ proof rate of Sledgehammer, the most powerful general-purpose automation tool for Isabelle. - We extract and open source the largest, to the best of our knowledge, premise selection dataset. It consists of 4.4M premise selection examples and 433K unique premises. - We analyze how Magnushammer's performance depends on the model size, dataset size, and the inference-time compute budget. We show its superiority with moderate resources.
# 2 BACKGROUND: PROOF ASSISTANTS, ISABELLE, AND SLEDGEHAMMER
Proof assistants (aka interactive theorem provers, or ITPs) such as Isabelle (Paulson, 1993), Lean (de Moura et al., 2015), Coq (Bertot, 2008), HOL Light (Harrison, 1996), or Mizar (Grabowski et al., 2010), are software tools designed to assist the development of formal proofs. They provide expressive language for the formalization of mathematical statements and proofs while verifying them formally. In Isabelle, theorems are proved sequentially: an initial proof state is obtained after the theorem is stated, and the proof state changes when the user provides a valid proof step (see Appendix A.1 for an example). Proof states contain information about the already established facts and the remaining goals to prove. Proof steps consist of tactics, which are optionally parametrized by premises. Tactics are theorem-proving procedures and can complete some proofs in one step provided with relevant premises. However, finding these premises is difficult: one needs to select a handful of relevant facts from the current proof context, which typically contains tens of thousands of them.
Sledgehammer (Paulson and Blanchette, 2012; Blanchette et al., 2013) is a powerful automated reasoning tool for Isabelle. It belongs to a broader class of tools known as "hammers," which integrate automated theorem provers (ATPs) into proof assistants. The goal of these tools is to support the process of finding and applying proof methods. Sledgehammer has become an indispensable tool for Isabelle practitioners (Paulson and Blanchette, 2012). It allows for closing low-level gaps between subsequent high-level steps of proof without the need to memorize entire lemma libraries.
 (a) A call to Sledgehammer triggers the following sequence of steps: First, available facts are filtered based on their similarity to the conjecture. Then, the conjecture together with the selected facts (usually a few hundred in number) are translated to simpler logic used by the external provers (E, SPASS, etc.). Then, such problems are fed into each ATP separately. Finally, the premises used in the successful ATP proofs are used to reconstruct a proof inside Isabelle using its native methods.
 (b) Given a proof state, we first retrieve the most relevant premises according to the cosine similarity of their embeddings with the proof state embedding (SELECT). We then re-rank these with a model that encodes each proof state and premise pair, outputting a relevance score (RERANK). The bulk of the architecture is a shared transformer model, in orange. Figure 2: Overview of Sledgehammer (a) and Magnushammer (b).
Sledgehammer is designed to first pre-select a number of relevant facts heuristically, translate them together with a conjecture to simpler logic, and try to prove the conjecture using strong, external ATPs like E (Schulz, 2004), SPASS (Weidenbach, 2001), Vampire (Kovács and Voronkov, 2013), Z3 (de Moura and Björner, 2008), or cvc5 (Barbosa et al., 2022). If successful, these provers generate complete proofs. They are, however, not trusted by Isabelle. Instead, the facts used in the external proofs are extracted and used to produce a proof inside Isabelle using its native methods. Up to this last step, known as proof reconstruction, Sledgehammer is essentially used as a precise premise selection tool. See Figure 2a depicting the whole process.
While immensely useful, Sledgehammer comes with several limitations. First, increasing computational power for Sledgehammer brings quickly diminishing returns (Böhme and Nipkow, 2010). Second, the logic projection and proof reconstruction in a hammer are not straightforward for type systems other than higher-order logic (Czajka and Kaliszyk, 2018). Finally, Sledgehammer's performance hinges on the relevance filtering scheme, a suite of methods based on handcrafted heuristics (Meng and Paulson, 2009) or classical machine learning (Kuhlwein et al., 2013). Such approaches are unlikely to efficiently utilize the constantly growing body of proof data.
We argue that all these limitations can be overcome with deep-learning-based approaches. Neural networks have shown remarkable effectiveness in end-to-end problem solving with little or no feature engineering (Krizhevsky et al., 2012; Brown et al., 2020). Adopting textual representations with generic neural solutions removes the need for logic projection, ATP solving, and proof reconstruction. Moreover, large language models have recently displayed impressive scaling properties with respect to both model size (Kaplan et al., 2020) and data (Hoffmann et al., 2022).
# 3 MAGNUSHAMMER
The goal of premise selection is to find relevant mathematical facts for a given proof state. We focus on selecting premises with a neural model informed by their textual representations instead of relying on fact structures like Sledgehammer (see Section 2). The core idea of Magnushammer is to combine fast retrieval based on representational similarity (SELECT) with a more accurate re-ranking (RERANK), as outlined in Algorithm 1. Our method closely follows those of Nogueira and Cho (2019) and Izacard et al. (2021). This hierarchical approach is scalable to large formal libraries containing hundreds of thousands of facts. Below we describe the two-stage Magnushammer approach.
SELECT leverages representation similarity and is based on batch-contrastive learning similar to the methods of Alemi et al. (2016), Bansal et al. (2019), Han et al. (2021), or Radford et al. (2021). SELECT embeds premises and proof states into a common latent space and uses cosine similarity to determine their relevance. During inference, it requires only one pass of a neural network to compute the proof state embedding and dot product with cached premise embeddings. SELECT is hence fast and scalable to large sets of premises. In our experiments, there are between 30K and 50K premises in a typical proof state context, from which we select $K_{S} = 1024$ most relevant ones.
RERANK scores the relevance of the $K_{S}$ selected premises for the current proof state by analyzing the (proof_state, premise) pairs. RERANK is trained to output the probability of the premise being relevant to the proof_state. The $K_{S}$ premises retrieved by SELECT are re-ranked with respect to these probabilities, and the final list comprises of the top $K_{R}$ premises (we set $K_{R} = K_{S}$ ). Having both the premise and the proof state in a single input allows RERANK to be more accurate. However, at the same time, it is much slower, as each pair must be scored individually.
Algorithm 1 Premise selection with Magnushammer. Require: proof_state,premises $\triangleright$ proof state to retrieve premises for and database of available premises $K_{S},K_{R}$ number of premises to retrieve with SELECT and RERANK, respectively 1: state_embedding $\leftarrow$ get_embedding(prooef_state) SELECT stage starts 2: premises_embedding $\leftarrow$ get_embedding(premises) 3: Cache(premises_embedding) 4: sim Scores $=$ state_embedding $\cdot$ premises_embedding 5: selected $=$ premises[argsort(-sim Scores)[: $K_S$ ] 6: batch $= []$ RERANK stage starts 7: for premise in selected do 8: batch.append((proof_state,premise)) 9: rerank Scores $\leftarrow$ get_rerank Scores(batch) 10: top_premises $=$ selected[argsort(-rerank Scores)[: $K_R$ ] 11: return top_premises
Training We train Magnushammer using two alternating tasks: SELECT is trained with a modified InfoNCE loss (van den Oord et al., 2018), and RERANK is trained with the standard binary cross-entropy loss. The architecture of Magnushammer shares a transformer backbone with specialized linear projections on top (see Figure 2b). The backbone is pre-trained with a language modeling task on the GitHub and arXiv subsets of the Pile dataset (Gao et al., 2021). For training, we use datasets consisting of (proof_state, premise) pairs extracted with a procedure described in Section 4.
During SELECT's training, each batch consists of $N$ proof states, $N$ positive premises (one for each proof state), and additional $M$ negative premises sampled from available facts that are not ground truth premises for any of the selected proof states. This gives $N - 1 + M$ negatives per proof state in one batch. We typically use $M = 3N$ , which differs from standard batch-contrastive learning (Radford et al., 2021), in which $M = 0$ and negatives are only the other $N - 1$ premises in the batch RERANK is trained using a binary classification objective. For each positive (proof_state, premise) pair in the dataset, we construct 15 negatives from the most likely false positives returned by SELECT. Specifically, all the premises $\mathcal{M}$ that are facts that were never used as a premise for proof_state, are first chosen. Then, the top 1024 of $\mathcal{M}$ according to SELECT are selected, and 15 are sampled from them to construct negative training pairs. See Appendix B for complete training details.
Evaluation in Isabelle We outline how premises chosen by Magnushammer are used to prove theorems in Isabelle. Given a proof state, a list of the $k$ most relevant premises $P$ is retrieved. We construct proof steps consisting of a tactic $t$ and a subset of premises $S \subseteq P$ . Such proof steps are executed in parallel, with a timeout of 2 seconds. The evaluation is successful if any of these proof steps completes the proof. For $S$ , we pick the top $i$ of $P$ , where $i$ 's are consecutive powers of 2 up to $2^{10}$ , or 0 for tactics that do not accept premises. More details, including the set of tactics used, are presented in Appendix D. An example of a proof with tactics and premises is given in Appendix A.3.
Note that the procedure of trying multiple different subsets of premises is commonly applied in the context of automated theorem proving (Urban et al., 2008; Kuhlwein et al., 2012) and similar to the technique implemented in Sledgehammer (Paulson and Blanchette, 2012). The rationale behind this is that the proof procedures implemented in ATPs and high-level ITPs' tactics perform combinatorial search, and providing them with fewer premises to restrict their search space is beneficial.
# 4 DATASETS
We created and released<sup>1</sup> a comprehensive dataset of textual representations for Isabelle's proof states and premises. To the best of our knowledge, this is the first high-quality dataset of this kind for Isabelle, and also the largest premise selection dataset overall. We used the two largest collections of Isabelle theories to create the dataset: the Archive of Formal Proofs and the Isabelle Standard library.
For every proof step in every proof from these collections, we extracted the preceding proof state and the set of premises used in the proof step; this was turned into (proof_state, premise) pairs constituting training data points. We call this the HUMAN PROOFS LIBRARY (HPL) dataset. In addition, we used Sledgehammer to generate proofs that are different from the human ones by using potentially alternative premises. We refer to this as the SH partition, and its union with HPL constitutes the MACHINE-AUGMENTED PROOFS LIBRARY (MAPL) dataset. Statistics for all these datasets are given in Table 1. Note that MAPL grosses over 4M data points.
Below we describe in more detail how data points are extracted from a proof step. An Isabelle's proof is a sequence of (proof_state,proof_step) pairs:proof_state has the state information, and proof_step is a tactic application that advances the proof. A proof_step may use premises: theorems, lemmas, or definitions established previously. Suppose a proof_step contains $n$ premises: $p_1,p_2,\ldots ,p_n$ .We then extract $n$ data points: (proof_state, $p_1)$ ,..., (proof_state, $p_n$ ). Executing Sledgehammer on the proof_state may result in multiple different synthetic proof_steps, and data points can be extracted from each in the same way (see Appendix A.2 for details).
Table 1: Statistics of MAPL and both its partitions: HPL (coming from human-written proofs) and SH (coming from Sledgehammer-generated proofs). The data points are of the form of (proof_state,premise) pairs.
<table><tr><td>Dataset</td><td>HPL</td><td>SH</td><td>MAPL</td></tr><tr><td>Data points</td><td>1.1M</td><td>3.3M</td><td>4.4M</td></tr><tr><td>Unique proof states</td><td>570K</td><td>500K</td><td>570K</td></tr><tr><td>Unique premises</td><td>300K</td><td>306K</td><td>433K</td></tr></table>
Mining the HPL partition took 10K CPU hours, and mining the SH partition took 150K CPU hours (17 CPU years) on a distributed system.
Our datasets have 2 distinguishing features:
1. The human-originating dataset is augmented by alternatives generated with Sledgehammer, which results in a significantly larger and more diverse dataset. This also decreases the probability of sampling false negatives while training contrastively: a negative example (proof_state, premise) may in fact be positive, but we just have not seen an alternative proof using premise. Generating multiple alternative proofs partially remedies this problem. 2. Both proof_states and premises are represented as "high-level" Isabelle's text instead of "low-level" logical formalism like, e.g., TPTP (Sutcliffe, 2017) used by Alama et al. (2014). This makes the dataset more suitable for language models, decreases the need for feature engineering, and facilitates cross-proof-assistant pre-training (Conneau and Lample, 2019).
# 5 EXPERIMENTS
We evaluate Magnushammer on the PISA and miniF2F theorem proving benchmarks using proof success rate as a metric. Our main result is that Magnushammer outperforms Sledgehammer by a large margin and, combined with Thor (Jiang et al., 2022a), sets a new state of the art on the PISA benchmark (71.0% from 57.0%). Through ablations, we study the effectiveness of Magnushammer and the contribution of its components. Additional results and details can be found in Appendix E.
# 5.1 EXPERIMENTAL DETAILS
**Benchmarks** For evaluation, we use PISA (Jiang et al., 2021) and miniF2F (Zheng et al., 2022) benchmarks. PISA contains problems randomly selected from the Archive of Formal Proofs; we use the same 1000 problems as Jiang et al. (2022a) for our evaluations. miniF2F consists of 488 high-school competition-level problems, split into validation and test set, each with 244 problems.
Table 2: Proof rates on the PISA benchmark. On the single-step task, Magnushammer outperforms both Sledgehammer and BM25 by a wide margin. On the multi-step task, Magnushammer combined with Thor achieves the state-of-the-art proof rate of $71.0\%$ .
<table><tr><td>Task</td><td>Method</td><td>Proof rate (%)</td></tr><tr><td rowspan="5">Single-step</td><td>BM25</td><td>30.6</td></tr><tr><td>TF-IDF</td><td>31.8</td></tr><tr><td>OpenAI embed. (Neelakantan et al., 2022)</td><td>36.1</td></tr><tr><td>Sledgehammer</td><td>38.3</td></tr><tr><td>Magnushammer (ours)</td><td>59.5</td></tr><tr><td rowspan="3">Multi-step</td><td>LISA (Jiang et al., 2021)</td><td>33.2</td></tr><tr><td>Thor (Jiang et al., 2022a)</td><td>57.0</td></tr><tr><td>Thor + Magnushammer (ours)</td><td>71.0</td></tr></table>
Table 3: Proof rates on the miniF2F benchmark. On the single-step task, Magnushammer outperforms Sledgehammer and its variant with additional heuristics (Jiang et al., 2022b). On the multi-step task, Thor+Magnushammer obtains competitive results, significantly outperforming Thor+Sledgehammer.
<table><tr><td>Task</td><td>Method</td><td>Valid (%)</td><td>Test (%)</td></tr><tr><td rowspan="3">Single-step</td><td>Sledgehammer</td><td>9.9</td><td>10.4</td></tr><tr><td>Sledgehammer + heuristics</td><td>18.0</td><td>20.9</td></tr><tr><td>Magnushammer (ours)</td><td>33.6</td><td>34.0</td></tr><tr><td rowspan="4">Multi-step</td><td>Thor + Sledgehammer (Jiang et al., 2022a)</td><td>28.3</td><td>29.9</td></tr><tr><td>Thor + Sledgehammer + auto (Wu et al., 2022a)</td><td>37.3</td><td>35.2</td></tr><tr><td>Thor + Magnushammer (ours)</td><td>36.9</td><td>37.3</td></tr><tr><td>DSP (Jiang et al., 2022b)</td><td>43.9</td><td>39.3</td></tr></table>
Metric and evaluation setups To evaluate the performance, we measure proof success rate: the percentage of successful proofs. A proof is successful if it is formally verified by Isabelle. We distinguish single-step and multi-step settings. In the single-step setting, we check if the theorem can be proven in one step by applying premises retrieved by the evaluated premise selection method (e.g., Magnushammer). In the multi-step scenario, we perform a proof search using a language model following Thor (Jiang et al., 2022a). Thor + Magnushammer uses Magnushammer instead of Sledgehammer as the premise selection component. A further explanation is given in Section 5.2.
Evaluation protocol and computational budget Algorithm 3 (in Appendix D) details the evaluation of Magnushammer in the single-step setting. It generates $|\mathcal{T}| \times |K|$ proof steps by combining each tactic $t \in \mathcal{T}$ with top $k$ premises from a ranking provided by Magnushammer, where $\mathcal{T}$ is a prescribed set of tactics, $k \in K$ , and $K$ is a list of integers. Such constructed proof steps are then executed in Isabelle. We define the computational budget for such an evaluation as $C = |\mathcal{T}| \times |K| \times T$ , where $T$ is a timeout expressed in seconds (we use $T = 2$ s as we observed little benefit from increasing it). Estimating the computational budget for Sledgehammer is difficult due to its complex internal architecture. We approximate it by $C = S \times T$ , where $S$ is the 'number of CPU cores' (corresponding to steps executed in parallel) and $T$ is the timeout. We use $S = 10$ for our calculations. See Appendix A.4 for more details.
Architecture and training details For our main experiments, we pre-train standard decoder-only transformer models with 38M and 86M non-embedding parameters and fine-tune them for downstream tasks of premise selection or proof step generation. Full details are given in Appendix C. In our experiments, we use the Portal-to-ISAbelle API (Jiang et al., 2021) to interact with Isabelle.
# 5.2 RESULTS ON PISA AND MINIF2F BENCHMARKS
Our main empirical results, summarized in Table 2 and Table 3, were obtained with the 86M parameter model. Figure 1 and Section 5.2.1 deepen this study, showing that Magnushammer outperforms Sledgehammer across a broad spectrum of computational budgets.
Performance on the single-step task In the single-step setting, Magnushammer outperforms Sledgehammer by a wide margin on both PISA (59.5% vs. 38.3%) and miniF2F (34.0% vs. 20.9%). Additionally, on PISA, Magnushammer outperforms TF-IDF and BM25: text-based, non-trainable
retrieval methods (Robertson and Zaragoza, 2009) which are strong baselines in common retrieval benchmarks (Thakur et al., 2021). This suggests that Magnushammer is able to learn more than just superficial text similarity. In all these experiments we used the same evaluation protocol (following Algorithm 3) and computational budget of 1000 as detailed in Appendix D.1.
Interestingly, retrieval based on the generic OpenAI embeddings (Neelakantan et al., 2022) (specifically: text-embedding-ada-002) yields reasonable performance comparable to Sledgehammer. This confirms the potential of neural premise selection to replace traditional symbolic methods. There is, however, a large gap to match Magnushammer. This shows that contrastive fine-tuning on our dataset provides non-trivial gains and supports our hypothesis that Magnushammer learns more than just mere textual similarity exploited by the general purpose method.
Performance on the multi-step task Neural theorem provers utilize language models to generate proof steps, following the approach proposed by Polu and Sutskever (2020). This allows for the creation of more complex, multi-step proofs. The proof generation involves sampling a proof step from the language model, verifying it, and repeating this process until the proof is closed or the computational budget is exceeded. The best-first search algorithm is often used to explore the most promising proof steps.
Thor (Jiang et al., 2022a) augments neural theorem provers with premise-selection capabilities. To this end, Thor allows the model to generate proof steps using Sledgehammer, which we replace with Magnushammer (see Appendix D.2 for details). Thor + Magnushammer establishes a new state of the art on the PISA benchmark (71.0% vs. 57.0%). On miniF2F, our method also significantly outperforms Thor and achieves results competitive with the current state of the art. In these experiments, we give Magnushammer a computational budget of 200.
It is important to note that other theorem-proving approaches in the multi-step section of Table 3 require much larger language models: for Thor it is 700M non-embedding parameters; DSP (Draft, Sketch, and Prove) by Jiang et al. (2022b) uses Minerva model (Lewkowycz et al., 2022) with 62B parameters. Moreover, these other approaches rely on ideas orthogonal to premise selection. Specifically, Thor + auto (Wu et al., 2022a) proposes a variation of Thor, involving expert iteration on auto-formalized data. DSP involves creating a high-level outline of a proof and uses Sledgehammer to solve the low-level subproblems. We hypothesize that both methods would perform even better when combined with Magnushammer.
# 5.2.1 SCALING COMPUTATIONAL BUDGET
In this section, we discuss how the quality of premise selection methods varies with the computational budget available during evaluation. Figure 1 shows the results, and the definition of the compute budget is provided in Section 5.1. Notably, Magnushammer outperforms Sledgehammer even with very limited computational resources, and it scales well, particularly within the medium budget range.
For Magnushammer and BM25, we use Algorithm 3 (Appendix D) in various configurations (i.e., settings of $\mathcal{T}$ and $K$ ). We start with one tactic, $\mathcal{T} = \{\mathrm{smt}\}$ , and $K = [2^T]$ , which yields $C = 2$ (recall that $T = 2$ s). We then gradually add more tactics to $\mathcal{T}$ and more values to $K$ . The final setup uses $|\mathcal{T}| = 36$ and $K$ containing all powers of 2, from $2^0$ up to $2^{10}$ , which yields $C \approx 800$ . The details are provided in Appendix D. For Sledgehammer, we scale the timeout parameter $T$ up to $80$ s.
# 5.3 IMPACT OF TRAINING DATA
We study how the amount and type of data impact the proof success rate by comparing HPL and MAPL datasets. For this comparison, we used models with 38M non-embedding parameters and a computational budget of 800.
Dataset size Our method is data-efficient: see Figure 3a. We observe that Magnushammer fine-tuned on only $0.1\%$ of MAPL - equivalent to approximately 4K samples - is already able to outperform Sledgehammer. This indicates that when starting from a pre-trained model, Magnushammer is a promising approach for addressing premise selection in theorem-proving environments with limited training data. The effect of pre-training diminishes as the amount of training data increases.
Dataset type Fine-tuning on MAPL or HPL leads to subtle differences (56.3% vs. 54.0% when the whole datasets are used). This outcome may be attributed to the impact of model pre-training and the fact that the HPL dataset is rich enough to obtain good performance on the PISA benchmark (as observed in the previous paragraph). We speculate that the bigger MAPL dataset might be essential for future harder benchmarks and scaling up the model size.
Figure 3: Impacts of the training data quantity and the model parameters on the proof rate. The vertical axis is the proof rate in percentage. In Subfigure 3a, the horizontal axis is the fraction of training dataset used and in Subfigure 3b it is the number of parameters in the model.  (a) We randomly sample fractions of MAPL or HPL datasets and use them for training Magnushammer. Even $0.1\%$ of the MAPL dataset allows pre-trained Magnushammer to outperform the Sledgehammer and BM25 baselines. See Table 4 for numerical data.
 (b) We train Magnushammer of different sizes. Even with a one-layer transformer, Magnushammer outperforms Sledgehammer. We observe consistent performance gains with increasing model sizes. Pre-trained models perform better. See Table 5 for numerical data.
# 5.4 ABLATIONS
We use models trained on the MAPL dataset and evaluate them with a computational budget of 800. To study how the performance of our method depends on the model size, we vary the number of layers $L$ and embedding dimension $D$ . A positive correlation between the model size and the proof rate is shown in Figure 3b. We observe that even a tiny model with 920K parameters ( $L = 1$ , $D = 256$ ) outperforms Sledgehammer (40.7% vs. 38.3%). We also note the benefit of pre-training and that scaling the number of layers is more beneficial than scaling the embedding dimension. The details can be found in Appendix C.1. The impact of re-ranking is studied in Appendix C.5.
# 6 RELATED WORK
Premise selection becomes a crucial task whenever proving theorems automatically within a large formal library. Moreover, this task has several unique aspects that are challenging from the perspective of learning-based approaches. Therefore, there exist multiple works that tackle learning premise selection (either explicitly or implicitly) applying various methods focusing on different aspects.
Many works employ classical machine learning like Bayesian and kernel methods (Kuhlwein et al., 2012; Alama et al., 2014), $k$ -NN (Blanchette et al., 2016), or decision trees (Piotrowski and Urban, 2018; Nagashima and He, 2018; Piotrowski et al., 2023). The common weakness of these approaches is the necessity of using hand-engineered features, whereas faster, simpler training is an advantage.
Alemi et al. (2016) were the first to apply deep learning to premise selection, thus dispensing with the hand-designed features completely. Their approach was evaluated in an automated theorem proving setting and not in a proof assistant, as is Magnushammer. They also implicitly learn embeddings of conjectures and premises, which are concatenated and passed through a shallow network, whereas the training signal comes from the logistic loss. In contrast, Magnushammer demonstrated the strength of training with the contrastive loss, where the obtained embeddings just need to be passed through a simple cosine similarity measure to provide high-quality rankings.
Most of the methods explicitly targeting the premise selection problem (including this work) retrieve a ranking of independently treated premises. In contrast, Piotrowski and Urban (2020) aimed at modelling the implicit dependencies between the premises and used LSTM-based language models to produce structured sequences of premises. However, the premises were treated there as opaque tokens, not giving the neural model the ability to inspect the statements of the premises.
Effective deep learning approaches often leverage the explicit structure of mathematical expressions using graph neural networks (Wang et al., 2017; Paliwal et al., 2020; Goertzel et al., 2022). Our work uses the transformer architecture (Vaswani et al., 2017), which is highly scalable and capable of producing powerful representations of raw text data.
Pre-trained transformer language models have been applied to various aspects of theorem proving, including automodality (Wu et al., 2022a; Jiang et al., 2022b), conjecturing (Urban and Jakubuv, 2020), and tactic prediction / proof step search (Yang and Deng, 2019; Polu and Sutskever, 2020; Han et al., 2022; Lample et al., 2022; Polu et al., 2023). The works from the last category often implicitly deal with premise selection by treating premises as names / tokens to be generated and not inspecting their statements. The application of generative language models to statement-aware premise selection has been limited, as the length of the possible premises often greatly exceeds the context of several thousand tokens that the models are designed to handle. Thor (Jiang et al., 2022a) circumvents the difficulty of premise selection by invoking Sledgehammer. In contrast, Magnushammer retrieves rather than generates to overcome the context length limitation. Therefore it can be used in tandem with other models (its combination with Thor is demonstrated in Section 5).
Batch-contrastive learning is widely used in speech (van den Oord et al., 2018), text (Izacard et al., 2021), image (Chen et al., 2020) and image-text (Radford et al., 2021) representation learning. These methods have proven effective despite the possibility of false negatives occurring in contrastive batches (Robinson et al., 2021). The SELECT phase of our premise selection model relies on in-batch negative examples to train the retriever, similar to HOList (Bansal et al., 2019) and Contriever (Izacard et al., 2021). Like HOList, we mine additional negatives, which we found crucial for performance. The RERANK stage closely resembles (Nogueira and Cho, 2019), but instead of using BM25, we jointly train retrieval and re-ranking, utilizing premises retrieved by SELECT as hard negatives for RERANK training. Han et al. (2021) use contrastive learning in informal premise selection. Concurrently to our work, Yang et al. (2023) develop a premise selection method for Lean also using contrastive learning in a way similar to our SELECT method, but without the RERANK stage.
There are multiple lines of work considering datasets based on formal theorem proving. These include benchmarks like ProofNet (Azerbayev et al., 2022) for Lean, and miniF2F (Zheng et al., 2022) that supports multiple ITPs. These datasets only focus on evaluation, not providing data for training the models. Another line of research focuses on benchmarking machine learning models' reasoning capabilities while also providing training data (Bansal et al., 2019; Li et al., 2021; Han et al., 2022). Existing public datasets for premise selection include the ones introduced in (Alama et al., 2014; Piotrowski and Urban, 2020). In comparison to these works, we publish the data in high-level, textual format, as seen in Isabelle, instead of low-level, structured languages such as TPTP (Sutcliffe, 2017).
There exists a rich body of work developing complex hammers systems for different proof assistants (Paulson and Blanchette, 2012; Kaliszyk and Urban, 2015a; Gauthier and Kaliszyk, 2015; Czajka and Kaliszyk, 2018). Unlike the traditional hammers, our method does not depend on external ATPs and requires little domain-specific knowledge.
# 7 LIMITATIONS AND FUTURE WORK
Other proof assistants Magnushammer treats proof states and premises as text and makes no assumptions about their structure. As such, no feature engineering is needed to apply it to other proof assistants. We conjecture that Magnushammer can prove effective in other environments because it is agnostic to the logic or type system used. We plan to evaluate Magnushammer in Lean proof assistant on ProofNet (Azerbayev et al., 2022) and miniF2F (Zheng et al., 2022) benchmarks, using the recently published LeanDojo toolkit (Yang et al., 2023) that also provides baselines for comparison.
Richer proof and premise representations Magnushammer utilizes the textual representation of the proof state given by Isabelle. This representation, however, does not provide complete semantic information about the referenced objects. Including function definitions and object types in the proof state representation might further improve performance.
Modelling full proof steps Combining language models with external premise selection tools significantly improves their theorem-proving performance, as demonstrated by Jiang et al. (2022a) and our work. A natural step would be to further integrate premise selection with language models into a single model capable of generating proof steps containing relevant retrieved premises. A proof of concept of this idea was explored by Tworkowski et al. (2022). This would also allow to model existing implicit dependencies between returned premises, which was shown beneficial by Piotrowski and Urban (2020). We believe that recent advances in retrieval-augmented language models (Wu et al., 2022b; Borgeaud et al., 2022) could facilitate progress in this direction.
# ACKNOWLEDGEMENTS
We gratefully acknowledge that our research was supported with Cloud TPUs from Google's TPU Research Cloud (TRC). Moreover, Piotr Miłos was supported by the Polish National Science Centre grant 2019/35/O/ST6/03464.
# REPRODUCIBILITY STATEMENT
The data that were used for pre-training of the backbone transformer model of Magnushammer are freely available under this link: https://pile.eleuther.ai/
The Isabelle data used in training for the down-stream tasks are available under this link: https://huggingface.co/datasets/Simontwice/premise_selection_in_isabelle
The benchmarks used for evaluation of Magnushammer are freely available on GitHub:
- miniF2F: https://github.com/openai/miniF2F - PISA: https://github.com/albertqjiang/Portal-to-ISAbelle
PISA also implements the interface for interacting with Isabelle that we used in our experiments.
Appendix A.4 specifies the setup of Sledgehammer that we used in our comparisons. Appendices B and C detail the shape of the transformer architecture used, define the loss functions applied in the SELECT and RERANK stages, specify the hyperparameters used in pre-training and training for our down-stream tasks, and disclose the hardware used for training. Appendix D details the setup for evaluation of Magnushammer in Isabelle, in particular the list of tactics applied on top of the Magnushammer's premise selection.
# REFERENCES
Jesse Alama, Daniel Kuhlwein, Evgeni Tsivtsivadze, Josef Urban, and Tom Heskes. Premise selection for mathematics by corpus analysis and kernel methods. CoRR, abs/1108.3446, 2011. URL http://arxiv.org/abs/1108.3446. Jesse Alama, Tom Heskes, Daniel Kuhlwein, Evgeni Tsivtsivadze, and Josef Urban. Premise selection for mathematics by corpus analysis and kernel methods. J. Autom. Reason., 52(2): 191-213, 2014. doi: 10.1007/s10817-013-9286-5. URL https://doi.org/10.1007/s10817-013-9286-5. Alexander A. Alemi, François Chollet, Geoffrey Irving, Christian Szegedy, and Josef Urban. DeepMath - deep sequence models for premise selection. CoRR, abs/1606.04442, 2016. URL http://arxiv.org/abs/1606.04442. Zhangir Azerbayev, Bartosz Piotrowski, and Jeremy Avigad. ProofNet: A benchmark for autoformalizing and formally proving undergraduate-level mathematics problems. In Advances in Neural Information Processing Systems 35, 2nd MATH-AI Workshop at NeurIPS'22, 2022. URL https://mathai2022.github.io/papers/20.pdf. Kshitij Bansal, Sarah M. Loos, Markus N. Rabe, Christian Szegedy, and Stewart Wilcox. HOList: An environment for machine learning of higher order logic theorem proving. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pages 454-463. PMLR, 2019. URL http://proceedings.mlr.press/v97/bansal19a.html. Haniel Barbosa, Clark W. Barrett, Martin Brain, Gereon Kremer, Hanna Lachnitt, Makai Mann, Abdalrhman Mohamed, Mudathir Mohamed, Aina Niemetz, Andres Notzli, Alex Ozdemir, Mathias Preiner, Andrew Reynolds, Ying Sheng, Cesare Tinelli, and Yoni Zohar. cvc5: A versatile and industrial-strength SMT solver. In Dana Fisman and Grigore Rosu, editors, Tools and Algorithms for the Construction and Analysis of Systems - 28th International Conference, TACAS 2022, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS
2022, Munich, Germany, April 2-7, 2022, Proceedings, Part I, volume 13243 of Lecture Notes in Computer Science, pages 415-442. Springer, 2022. doi: 10.1007/978-3-030-99524-9\24. URL https://doi.org/10.1007/978-3-030-99524-9_24. Yves Bertot. A short presentation of coq. In Otmané Aït Mohamed, César A. Muñoz, and Sofiene Tahar, editors, Theorem Proving in Higher Order Logics, 21st International Conference, TPHOLs 2008, Montreal, Canada, August 18-21, 2008. Proceedings, volume 5170 of Lecture Notes in Computer Science, pages 12-16. Springer, 2008. doi: 10.1007/978-3-540-71067-7_3. URL https://doi.org/10.1007/978-3-540-71067-7_3. Jasmin Christian Blanchette, Sascha Böhme, and Lawrence C. Paulson. Extending Sledgehammer with SMT solvers. J. Autom. Reason., 51(1):109-128, 2013. doi: 10.1007/s10817-013-9278-5. URL https://doi.org/10.1007/s10817-013-9278-5. Jasmin Christian Blanchette, David Greenaway, Cezary Kaliszyk, Daniel Kuhlwein, and Josef Urban. A learning-based fact selector for Isabelle/HOL. J. Autom. Reason., 57(3):219-244, 2016. doi: 10. 1007/s10817-016-9362-8. URL https://doi.org/10.1007/s10817-016-9362-8. Sascha Böhme and Tobias Nipkow. Sledgehammer: Judgement day. In Jürgen Giesl and Reiner Hahnle, editors, Automated Reasoning, pages 107-121, Berlin, Heidelberg, 2010. Springer Berlin Heidelberg. ISBN 978-3-642-14203-1. Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, Diego de Las Casas, Aurelia Guy, Jacob Menick, Roman Ring, Tom Hennigan, Saffron Huang, Loren Maggiore, Chris Jones, Albin Cassirer, Andy Brock, Michela Paganini, Geoffrey Irving, Oriol Vinyals, Simon Osindero, Karen Simonyan, Jack W. Rae, Erich Elsen, and Laurent Sifre. Improving language models by retrieving from trillions of tokens. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesváři, Gang Niu, and Sivan Sabato, editors, International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pages 2206-2240. PMLR, 2022. URL https://proceedings.mlr.press/v162/borgeaud22a.html. Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. CoRR, abs/2005.14165, 2020. URL https://arxiv.org/abs/2005.14165. Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pages 1597-1607. PMLR, 2020. URL http://proceedings.mlr.press/v119/chen20j.html. Alexis Conneau and Guillaume Lample. Cross-lingual language model pretraining. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/c04c19c2c2474dbf5f7ac4372c5b9af1-Paper.pdf. Lukasz Czajka and Cezary Kaliszyk. Hammer for Coq: Automation for dependent type theory. J. Autom. Reason., 61(1-4):423-453, 2018. doi: 10.1007/s10817-018-9458-4. URL https://doi.org/10.1007/s10817-018-9458-4. Nicolaas Govert De Bruijn. The mathematical language AUTOMATH, its usage, and some of its extensions. In Symposium on automatic demonstration, pages 29-61. Springer, 1970. Leonardo de Moura and Nikolaj Björner. Z3: An efficient SMT solver. In C. R. Ramakrishnan and Jakob Rehof, editors, Tools and Algorithms for the Construction and Analysis of Systems, pages 337-340, Berlin, Heidelberg, 2008. Springer Berlin Heidelberg. ISBN 978-3-540-78800-3.
Leonardo Mendonça de Moura, Soonho Kong, Jeremy Avigad, Floris van Doorn, and Jakob von Raumer. The Lean theorem prover (system description). In Amy P. Felty and Aart Middeldorp, editors, Automated Deduction - CADE-25 - 25th International Conference on Automated Deduction, Berlin, Germany, August 1-7, 2015, Proceedings, volume 9195 of Lecture Notes in Computer Science, pages 378-388. Springer, 2015. doi: 10.1007/978-3-319-21401-6\26. URL https://doi.org/10.1007/978-3-319-21401-6_26. Gabriel Ebner. Integration of general-purpose automated theorem provers in Lean, 2020. https://www.andrew.cmu.edu/user/avigad/meetings/fomm2020/slides/fomm ebner.pdf. Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, Shawn Presser, and Connor Leahy. The Pile: An 800GB dataset of diverse text for language modeling. CoRR, abs/2101.00027, 2021. URL https://arxiv.org/abs/2101.00027. Thibault Gauthier and Cezary Kaliszyk. Premise selection and external provers for HOL4. In Xavier Leroy and Alwen Tiu, editors, Proceedings of the 2015 Conference on Certified Programs and Proofs, CPP 2015, Mumbai, India, January 15-17, 2015, pages 49-57. ACM, 2015. doi: 10.1145/2676724.2693173. URL https://doi.org/10.1145/2676724.2693173. Zarathustra Amadeus Goertzel, Jan Jakubuv, Cezary Kaliszyk, Miroslav Olsák, Jelle Piepenbrock, and Josef Urban. The Isabelle ENIGMA. In June Andronick and Leonardo de Moura, editors, 13th International Conference on Interactive Theorem Proving, ITP 2022, August 7-10, 2022, Haifa, Israel, volume 237 of LIPIcs, pages 16:1-16:21. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi: 10.4230/LIPIcs.ITP.2022.16. Adam Grabowski, Artur Kornilowicz, and Adam Naumowicz. Mizar in a nutshell. J. Formaliz. Reason., 3(2):153-245, 2010. doi: 10.6092/issn.1972-5787/1980. URL https://doi.org/10.6092/issn.1972-5787/1980. Jesse Michael Han, Tao Xu, Stanislas Polu, Arvind Neelakantan, and Alec Radford. Contrastive finetuning of generative language models for informal premise selection. 6th Conference on Artificial Intelligence and Theorem Proving, 2021. Jesse Michael Han, Jason Rute, Yuhuai Wu, Edward W. Ayers, and Stanislas Polu. Proof artifact co-training for theorem proving with language models. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. URL https://openreview.net/forum?id=rpxJc9j04U. John Harrison. HOL light: A tutorial introduction. In Mandayam K. Srivas and Albert John Camilleri, editors, Formal Methods in Computer-Aided Design, First International Conference, FMCAD '96, Palo Alto, California, USA, November 6-8, 1996, Proceedings, volume 1166 of Lecture Notes in Computer Science, pages 265-269. Springer, 1996. doi: 10.1007/BFb0031814. URL https://doi.org/10.1007/BFb0031814. Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and Laurent Sifre. Training compute-optimal large language models. CoRR, abs/2203.15556, 2022. doi: 10.48550/arXiv.2203.15556. URL https://doi.org/10.48550/arXiv.2203.15556. Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. In Iryna Gurevych and Yusuke Miyao, editors, Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 1: Long Papers, pages 328-339. Association for Computational Linguistics, 2018. doi: 10.18653/v1/P18-1031. URL https://aclanthology.org/P18-1031/. Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, and Edouard Grave. Towards unsupervised dense information retrieval with contrastive learning. CoRR, abs/2112.09118, 2021. URL https://arxiv.org/abs/2112.09118.
Albert Q. Jiang, Wenda Li, Jesse Michael Han, and Yuhuai Wu. LISA: Language models of ISAbelle proofs. 6th Conference on Artificial Intelligence and Theorem Proving, 2021. Albert Q. Jiang, Wenda Li, Szymon Tworkowski, Konrad Czechowski, Tomasz Odrzygoźdź, Piotr Miłos, Yuhuai Wu, and Mateja Jamnik. Thor: Wielding hammers to integrate language models and automated theorem provers. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022a. URL https://openreview.net/forum?id=fUeOyt-2EOp. Albert Q. Jiang, Sean Welleck, Jin Peng Zhou, Wenda Li, Jiacheng Liu, Mateja Jamnik, Timothée Lacroix, Yuhuai Wu, and Guillaume Lample. Draft, sketch, and prove: Guiding formal theorem provers with informal proofs. CoRR, abs/2210.12283, 2022b. doi: 10.48550/arXiv.2210.12283. Cezary Kaliszyk and Josef Urban. HOL(y)Hammer: Online ATP service for HOL Light. Math. Comput. Sci., 9(1):5-22, 2015a. doi: 10.1007/s11786-014-0182-0. URL https://doi.org/10.1007/s11786-014-0182-0. Cezary Kaliszyk and Josef Urban. MizAR 40 for Mizar 40. Journal of Automated Reasoning, 55(3): 245-256, 2015b. Cezary Kaliszyk, François Chollet, and Christian Szegedy. HolStep: A machine learning dataset for higher-order logic theorem proving. CoRR, abs/1703.00426, 2017. URL http://arxiv.org/abs/1703.00426. Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. CoRR, abs/2001.08361, 2020. URL https://arxiv.org/abs/2001.08361. Laura Kovács and Andrei Voronkov. First-order theorem proving and vampire. In Natasha Sharygina and Helmut Veith, editors, Computer Aided Verification - 25th International Conference, CAV 2013, Saint Petersburg, Russia, July 13-19, 2013. Proceedings, volume 8044 of Lecture Notes in Computer Science, pages 1-35. Springer, 2013. doi: 10.1007/978-3-642-39799-8\1. URL https://doi.org/10.1007/978-3-642-39799-8_1. Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. ImageNet classification with deep convolutional neural networks. In Peter L. Bartlett, Fernando C. N. Pereira, Christopher J. C. Burges, León Bottou, and Kilian Q. Weinberger, editors, Advances in Neural Information Processing Systems 25: 26th Annual Conference on Neural Information Processing Systems 2012. Proceedings of a meeting held December 3-6, 2012, Lake Tahoe, Nevada, United States, pages 1106-1114, 2012. URL https://proceedings.neurips.cc/paper/2012/bit/399862d3b9d6b76c8436e924a68c45b-Abstract.html. Daniel Kuhlwein, Twan van Laarhoven, Evgeni Tsivtsivadze, Josef Urban, and Tom Heskes. Overview and evaluation of premise selection techniques for large theory mathematics. In Bernhard Gramlich, Dale Miller, and Uli Sattler, editors, Automated Reasoning - 6th International Joint Conference, IJCAR 2012, Manchester, UK, June 26-29, 2012. Proceedings, volume 7364 of Lecture Notes in Computer Science, pages 378-392. Springer, 2012. doi: 10.1007/978-3-642-31365-3_30. URL https://doi.org/10.1007/978-3-642-31365-3_30. Daniel Kuhlwein, Jasmin Christian Blanchette, Cezary Kaliszyk, and Josef Urban. MaSh: Machine learning for Sledgehammer. In Sandrine Blazy, Christine Paulin-Mohring, and David Pichardie, editors, Interactive Theorem Proving - 4th International Conference, ITP 2013, Rennes, France, July 22-26, 2013. Proceedings, volume 7998 of Lecture Notes in Computer Science, pages 35-50. Springer, 2013. doi: 10.1007/978-3-642-39634-2\6. URL https://doi.org/10.1007/978-3-642-39634-2_6. Guillaume Lample, Timothee Lacroix, Marie Anne Lachaux, Aurelien Rodriguez, Amaury Hayat, Thibaut Lavril, Gabriel Ebner, and Xavier Martinet. HyperTree proof search for neural theorem proving. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=J4pX8Q8cxHH.
Aitor Lewkowycz, Anders Johan Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Venkatesh Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. Solving quantitative reasoning problems with language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=IFXTZERXdM7. Wenda Li, Lei Yu, Yuhuai Wu, and Lawrence C. Paulson. IsarStep: A benchmark for high-level mathematical reasoning. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=Pzj6fzU6wkj. Jia Meng and Lawrence C. Paulson. Lightweight relevance filtering for machine-generated resolution problems. J. Appl. Log., 7(1):41-57, 2009. doi: 10.1016/j.jal.2007.07.004. Yutaka Nagashima and Yilun He. PaMpeR: Proof Method Recommendation system for Isabelle/HOL, 2018. URL https://arxiv.org/abs/1806.07239. Arvind Neelakantan, Tao Xu, Raul Puri, Alec Radford, Jesse Michael Han, Jerry Tworek, Qiming Yuan, Nikolas Tezak, Jong Wook Kim, Chris Hallacy, Johannes Heidecke, Pranav Shyam, Boris Power, Tyna Eloundou Nekoul, Girish Sastry, Gretchen Krueger, David Schnurr, Felipe Petroski Such, Kenny Hsu, Madeleine Thompson, Tabarak Khan, Toki Sherbakov, Joanne Jang, Peter Welinder, and Lilian Weng. Text and code embeddings by contrastive pre-training, 2022. Tobias Nipkow. Fun with functions. Archive of Formal Proofs, August 2008. ISSN 2150-914x. https://isa-afp.org/entries/FunWithFunctions.html, Formal proof development. Rodrigo Frassetto Nogueira and Kyunghyun Cho. Passage re-ranking with BERT. CoRR, abs/1901.04085, 2019. URL http://arxiv.org/abs/1901.04085. Aditya Paliwal, Sarah M. Loos, Markus N. Rabe, Kshitij Bansal, and Christian Szegedy. Graph representations for higher-order logic and theorem proving. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 2967-2974. AAAI Press, 2020. URL https://ojs.aaai.org/index.php/AAAI/article/view/5689. Lawrence C. Paulson. Isabelle: The next 700 theorem provers. CoRR, cs.LO/9301106, 1993. URL https://arxiv.org/abs/cs/9301106. Lawrence Charles Paulson and Jasmin Christian Blanchette. Three years of experience with Sledgehammer, a practical link between automatic and interactive theorem provers. In IWIL@LPAR, 2012. Bartosz Piotrowski and Josef Urban. ATPboost: Learning premise selection in binary setting with ATP feedback. In Didier Galmiche, Stephan Schulz, and Roberto Sebastiani, editors, Automated Reasoning - 9th International Joint Conference, IJCAR 2018, Held as Part of the Federated Logic Conference, FloC 2018, Oxford, UK, July 14-17, 2018, Proceedings, volume 10900 of Lecture Notes in Computer Science, pages 566-574. Springer, 2018. doi: 10.1007/978-3-319-94205-6_37. URL https://doi.org/10.1007/978-3-319-94205-6_37. Bartosz Piotrowski and Josef Urban. Stateful premise selection by recurrent neural networks. In Elvira Albert and Laura Kovács, editors, LPAR 2020: 23rd International Conference on Logic for Programming, Artificial Intelligence and Reasoning, Alicante, Spain, May 22-27, 2020, volume 73 of EPiC Series in Computing, pages 409-422. EasyChair, 2020. doi: 10.29007/j5hd. URL https://doi.org/10.29007/j5hd. Bartosz Piotrowski, Ramon Fernandez Mir, and Edward W. Ayers. Machine-learned premise selection for Lean. In Revantha Ramanayake and Josef Urban, editors, Automated Reasoning with Analytic Tableaux and Related Methods - 32nd International Conference, TABLEAUX 2023, Prague, Czech Republic, September 18-21, 2023, Proceedings, volume 14278 of Lecture Notes in Computer Science, pages 175-186. Springer, 2023. doi: 10.1007/978-3-031-43513-3\10. URL https://doi.org/10.1007/978-3-031-43513-3_10.
Stanislas Polu and Ilya Sutskever. Generative language modeling for automated theorem proving. CoRR, abs/2009.03393, 2020. URL https://arxiv.org/abs/2009.03393. Stanislas Polu, Jesse Michael Han, Kunhao Zheng, Mantas Baksys, Igor Babuschkin, and Ilya Sutskever. Formal mathematics statement curriculum learning. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net, 2023. URL https://openreview.net/pdf?id=-P7G-8dmSh4. Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. CoRR, abs/2103.00020, 2021. URL https://arxiv.org/abs/2103.00020. Stephen E. Robertson and Hugo Zaragoza. The probabilistic relevance framework: BM25 and beyond. Found. Trends Inf. Retr., 3(4):333-389, 2009. doi: 10.1561/1500000019. Joshua David Robinson, Ching-Yao Chuang, Suvrit Sra, and Stefanie Jegelka. Contrastive learning with hard negative samples. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id=CR1XOQ0UTh-. Stephan Schulz. System description: E 0.81. In David Basin and Michael Rusinowitch, editors, Automated Reasoning, pages 223-228, Berlin, Heidelberg, 2004. Springer Berlin Heidelberg. ISBN 978-3-540-25984-8. Jianlin Su, Yu Lu, Shengfeng Pan, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. CoRR, abs/2104.09864, 2021. URL https://arxiv.org/abs/2104.09864. G. Sutcliffe. The TPTP Problem Library and Associated Infrastructure. From CNF to TH0, TPTP v6.4.0. Journal of Automated Reasoning, 59(4):483-502, 2017. Terence Tao. Solving mathematical problems: A personal perspective. Oxford University Press, 2010. Nandan Thakur, Nils Reimers, Andreas Rücklé, Abhishek Srivastava, and Iryna Gurevych. BEIR: A heterogenous benchmark for zero-shot evaluation of information retrieval models. CoRR, abs/2104.08663, 2021. URL https://arxiv.org/abs/2104.08663. Szymon Tworkowski, Maciej Mikula, Tomasz Odrzygoźdź, Konrad Czechowski, Szymon Antoniak, Albert Jiang, Christian Szegedy, Łukasz Kuciński, Piotr Miłos, and Yuhuai Wu. Formal premise selection with language models. AITP 2022, 2022. URL http://aitp-conference.org/2022/abstract/AITP_2022_paper_32.pdf. Josef Urban and Jan Jakubuv. First neural conjecturing datasets and experiments. In Christoph Benzmüller and Bruce R. Miller, editors, Intelligent Computer Mathematics - 13th International Conference, CICM 2020, Bertinoro, Italy, July 26-31, 2020, Proceedings, volume 12236 of Lecture Notes in Computer Science, pages 315-323. Springer, 2020. doi: 10.1007/978-3-030-53518-6\24. URL https://doi.org/10.1007/978-3-030-53518-6_24. Josef Urban, Geoff Sutcliffe, Petr Pudlák, and Jiri Vyskočil. MaLARea SG1 - machine learner for automated reasoning with semantic guidance. In Alessandro Armando, Peter Baumgartner, and Gilles Dowek, editors, Automated Reasoning, pages 441-456, Berlin, Heidelberg, 2008. Springer Berlin Heidelberg. ISBN 978-3-540-71070-7. Aäron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. CoRR, abs/1807.03748, 2018. URL http://arxiv.org/abs/1807.03748.
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. CoRR, abs/1706.03762, 2017. URL http://arxiv.org/abs/1706.03762. Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021. Mingzhe Wang, Yihe Tang, Jian Wang, and Jia Deng. Premise selection for theorem proving by deep graph embedding. CoRR, abs/1709.09994, 2017. URL http://arxiv.org/abs/1709.09994. Christoph Weidenbach. Combining superposition, sorts and splitting. In John Alan Robinson and Andrei Voronkov, editors, Handbook of Automated Reasoning, pages 1965-2013. Elsevier and MIT Press, 2001. doi: 10.1016/b978-044450813-3/50029-1. URL https://doi.org/10.1016/b978-044450813-3/50029-1. Yuhuai Wu, Albert Q. Jiang, Wenda Li, Markus Norman Rabe, Charles E Staats, Mateja Jamnik, and Christian Szegedy. Autoformalization with large language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022a. URL https://openreview.net/forum?id=IUikebJ1Bf0. Yuhuai Wu, Markus Norman Rabe, DeLesley Hutchins, and Christian Szegedy. Memorizing transformers. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022b. URL https://openreview.net/forum?id=TrjbxzRcnf-. Kaiyu Yang and Jia Deng. Learning to prove theorems via interacting with proof assistants. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pages 6984-6994. PMLR, 2019. URL http://proceedings.mlr.press/v97/yang19a.html. Kaiyu Yang, Aidan M. Swope, Alex Gu, Rahul Chalamala, Peiyang Song, Shixing Yu, Saad Godil, Ryan Prenger, and Anima Anandkumar. LeanDojo: Theorem proving with retrieval-augmented language models. CoRR, abs/2306.15626, 2023. doi: 10.48550/arXiv.2306.15626. URL https://doi.org/10.48550/arXiv.2306.15626. Kunhao Zheng, Jesse Michael Han, and Stanislas Polu. miniF2F: A cross-system benchmark for formal olympiad-level mathematics. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. URL https://openreview.net/forum?id=9ZPegFuFTfv.
# APPENDIX
# A ISABELLE ENVIRONMENT
This section contains visual examples of proofs in Isabelle and provides some configuration details of the environment.
# A.1 VISUALIZATION OF THE ISABELLE ENVIRONMENT
Figure A.1 shows an example theorem and its proof, as seen in Isabelle's most popular IDE, jEdit. The theorem comes from an entry to the Archive of Formal Proofs - Fun With Functions (Nipkow, 2008). It states that any mapping $f$ from the set of natural numbers to itself that satisfies $f(f(n)) < f(n + 1)$ must be the identity function. The proof starts with a simple induction and then refines the result to arrive at the thesis. This problem was included in Terence Tao's booklet Solving Mathematical Problems (Tao, 2010).
```txttheorem identity1: fixes f :: "nat $\Rightarrow$ nat" assumes fff: " $\backslash n$ . f(f(n)) < f(Suc(n))" shows "f(n) = n" proof - { fix mn have key: "n $\leq$ m $\Rightarrow$ n $\leq$ f(m)" proof(induct n arbitrary: m) case 0 show ?case by simp next case (Suc n) hence "m $\neq$ 0" by simp then obtain k where [simp]: "m = Suc k" by (metis not0_implies_Suc) have "n $\leq$ f(k)" using Suc by simp hence "n $\leq$ f(f(k))" using Suc by simp also have "... < f(m)" using fff by simp finally show ?case by simp qed} hence " $\backslash n$ . n $\leq$ f(n)" by simp hence " $\backslash n$ . f(n) < f(Suc n)" by (metis fff order le less trans) hence "f(n) < n+1" by (metis fff lift_Sucmono-less_iff[of f] Suc_eq_plus1) with <n $\leq$ f(n)> show "fn = n" by arith qed```
Figure A.1: An example theorem in Isabelle. The statement is highlighted in the orange frame and the body of the proof is in the green frame. In this proof, most of the lines contain two consecutive steps: the first formulates a new proposition, and the second proves it. See a detailed analysis of the line 8 of the proof in Figure A.2 below.

Figure A.2: The line is broken down into two steps: the first one (green frame) includes the proposition (since $m$ is natural and positive, it must have a predecessor $k$ ) and the second (blue frame) proves it using the tactic metis with premise not0_implies_Suc, that states that a nonnegative natural number is a successor of some other natural number. The used premise is a fact which is already defined in the lemma library. The proof state resulting from the first step is in the yellow frame. The full premise statement is highlighted in pink.
# A.2 ALTERNATIVE PROOF STEP GENERATION WITH SLEDEGHAMMER
This section describes how to generate alternative proof steps using Sledgehammer which we do to obtain datasets described in Section 4. First, we find all intermediate propositions within the proof (they can be nested) and try to replace the proof of the proposition with a Sledgehammer step. If successful, we record such a step in the dataset and proceed with both the original and the alternative proof. Figure A.3 provides a visual example of the aforementioned propositions.
```txtproof - {fix mn have key:"n≤m⇒n≤f(m)" proof(induct n arbitrary:m) case 0 show ?case by simp next case (Suc n) hence "m≠0" by simp then obtain k where [simp]: "m = Suc k" by (metis not0_implies_Suc) have "n≤f(k)" using Suc by simp hence "n≤f(f(k))" using Suc by simp also have "...<f(m)" using fff by simp finally show ?case by simp qed} hence " $\wedge$ n. n≤f(n)" by simp hence " $\wedge$ n. f(n)<f(Suc n)" by (metis fff order_le-less_trans) hence "f(n)<n+1" by (metis fff lift_Sucmono-less_iff[of f] Suc_eq_plus1) with <n≤f(n)> show "f n=n" by arith```
Figure A.3: Example intermediate propositions highlighted in red. Note: not all propositions were highlighted.
# A.3 EXAMPLE OF A PROOF WITH TACTICS REQUIRING PREMISES
Figure A.4 contains a multi-step proof of the irrationality of $\sqrt{2}$ written in Isabelle. The proof contains multiple usages of tactics that require premises.
```txtlemma "sqrt 2 $\notin \mathbb{Q}$ " proof assume "sqrt 2 $\in \mathbb{Q}$ " then obtain a b::int where "sqrt 2 = a/b" "coprime a b" "b ≠ 0" by (metis Rats_cases' less_irref1) then have c: "2 = a^2 / b^2" by (smt (z3) of_int_power_power_divide real_sqrt.pow2) then have "b^2 ≠ 0" by fastforce then have *: "2*b^2 = a^2" by (smt (verit, ccfvSIG) c comm_semiring_class.distrib eqDIVIDE_EQ_numeral(1) mult_cancel_right1 numeral_Bit0 numeral_plus_numeral of_int_add of_int_power of_int_power_eq_of_int_cancel_iff one_plus_numeral) then have "even a" by (smt (z3) even_power oddE) then obtain c::int where "a=2*c" by blast with * have "b^2 = 2*c^2" by auto then have "even b" by (smt (z3) even_power oddE) with {coprime a b} {even a} {even b} show False by fastforce qed```
Figure A.4: A proof of $\sqrt{2} \notin \mathbb{Q}$ (Jiang et al., 2022a, Figure 1). The steps containing metis, smt, fastforce, blast, auto, fastforce are examples of steps using premises. For instance, one such proof step is by (metis Rats Cases' less_irrefl). This step invokes metis and provides two premises as arguments, namely Rats Cases' and less_irrefl.
# A.4 SLEDEGEHAMMER SETUP
We set up Sledgehammer in Isabelle 2021-1, following the configuration used by Jiang et al. (2022a). We run Sledgehammer using different sets of settings and calculate the total proof rate by taking the union of problems solved by each run. The Sledgehammer timeout is set to default 30 seconds. We use only on-machine automated theorem provers (same as Isabelle environment), so external provers used by Sledgehammer are the following: Z3, SPASS, Vampire, CVC4, and E.
In our calculation of the Sledgehammer computation budget, see Section 5.1, we assume $S = 10$ 'CPU cores.' We run our experiments on machines with 96 CPU cores, making the assumption realistic. Moreover, we emphasize that the performance gap between Magnushammer and Sledgehammer is large enough that altering the value of $S$ , e.g., to an unrealistic level $S = 1$ , would not qualitatively change conclusions.
# B DETAILS OF MAGNUSHAMMER
# B.1 SELECT STAGE
SELECT stage is trained using the InfoNCE loss van den Oord et al. (2018) defined as:
$$\mathcal {L} \left(q, k _ {+}\right) = - \frac {\exp \left(s \left(q , k _ {+}\right) / \tau\right)}{\exp \left(s \left(q , k _ {+}\right) / \tau\right) + \sum_ {i = 1} ^ {K} \exp \left(s \left(q , k _ {i}\right) / \tau\right)},$$
where $q$ is a query (a proof state), $k_{+}$ is a positive premise (a ground truth from the dataset), $k_{i}$ are negative premises. We define $s$ as cosine similarity between proof state and premise embeddings; $\tau > 0$ is a non-trainable temperature parameter. We list our hyperparameter choices in section C.2.
# B.2 RERANK STAGE
Premise retrieval task can be cast as binary classification, trying to determine if a given pair (proof_state, premise) is relevant. Applying classification to each pair is computationally infeasible, however, it could be used to re-rank a small set of premises retrieved by SELECT. Namely, we use the following cross-entropy loss:
$$\mathcal {L} = - \sum_ {p \in \mathcal {P}} \log \operatorname {s c o r e} (p) - \sum_ {p \notin \mathcal {N}} \log (1 - \operatorname {s c o r e} (p)),$$
where $\mathrm{score}(p)$ is the output of the RERANK part of the model (see "Sigmoid" in Figure 2b) for a given $p = (\mathrm{proof\_state},\mathrm{premise})$ pair. Typically, we sample a batch of 16 positive pairs $\mathcal{P}$ from the dataset. For each such pair (proof_state, premise) 15 negatives are constructed from the most likely false positives returned by SELECT. Specifically, negative premises $\mathcal{M}$ , which are facts that were never used as a premise for proof_state, are first chosen. Then, the top 1024 of $\mathcal{M}$ according to SELECT are selected, and 15 are sampled from them to construct negative pairs, which are included in $\mathcal{N}$ .
# B.3 MAGNUSHAMMER
We train Magnushammer as two separate tasks alternating update steps as presented in Algorithm 2. Note that the backbone of the architecture is shared between SELECT and RERANK, thus such multi-task training is potentially more effective than having two separate models. Calculation of the negative premises for SELECT is costly, thus for efficiency reasons we recalculate the top 1024 premises, see Section B.2, every $T = 1000$ steps in the recompute negatives_for_rerank function, as outlined in the Algorithm 2.
# C TRAINING DETAILS
# C.1 MODEL ARCHITECTURE
We use a decoder-only transformer architecture, following the setup from Wang and Komatsuzaki (2021) and using rotary position embedding by Su et al. (2021), a variation of relative positional
Algorithm 2 Magnushammer training. Require: $\theta$ $\triangleright$ initial trainable parameters $D$ $\triangleright$ premise dataset $T$ $\triangleright$ interval for updating rerank dataset 1: $D_{\mathrm{rerank}}\gets$ recompute negatives_for_ $r e r a n k(\theta ,D)$ 2: step $= 0$ 3: while step $<$ num_train_steps do 4: batch_select $\leftarrow$ D.sample() 5: $\theta \gets$ train_step( $\theta$ ,batch_select) 6: batch_ $r e r a n k$ $\leftarrow$ $D_{\mathrm{rerank}}.$ sample() 7: $\theta \gets$ train_step( $\theta$ ,batch_ $r e r a n k$ ) 8: step $\leftarrow$ step +1 9: if step mod $T = 0$ then 10: $D_{\mathrm{rerank}}\gets$ recompute negatives_for_ $r e r a n k(\theta ,D)$
encoding. The feedforward dimension in the transformer block is set to $4 \times D$ where $D$ denotes embedding dimension, and the number of attention heads is $H = D / 64$ . Our 38M model has $L = 12$ layers and an embedding dimension of $D = 512$ . The larger 86M model consists of $L = 12$ layers and has $D = 768$ . For all the models, we use the original GPT-2 tokenizer (Radford et al., 2019).
In SELECT, we append a specialized token at the end of the sequence to compute the embedding for a proof state and linearly project its embedding. Premises are embedded analogously. Similarly to Radford et al. (2021) that train separate projections for images and captions, we train separate proof state and premise projections and share the transformer backbone (see Figure 2b). Analogously for RERANK, we compute the relevance score by taking the embedding of the last token and then projecting it to a scalar value.
# C.2 HYPERPARAMETER SETUP
We performed the following hyperparameter sweeps. We note that we have not observed significant differences between obtained results.
- Learning rate: $\{1\mathrm{e} - 4,2\mathrm{e} - 4,3\mathrm{e} - 4,5\mathrm{e} - 4\}$ , chosen: $2\mathrm{e} - 4$ - Dropout: $\{0.0, 0.05, 0.1, 0.2\}$ , chosen: 0.1 - Weight decay: $\{0.02, 0.05, 0.1\}$ , chosen: 0.02 - Batch size $N$ in SELECT: $\{128, 256, 512\}$ , chosen: 256 - Number of negatives $M$ in SELECT: $\{0,256,768,1536\}$ , chosen: 768 - Temperature for InfoNCE loss in SELECT: $\{0.05, 0.07, 0.2, 1\}$ , chosen: 0.07 - Batch size for RERANK: $\{16, 32, 64\}$ , chosen 64 - Number of negatives per proof state $\mathcal{M}$ in RERANK: $\{7,15\}$ , chosen: 15.
# C.3 PRE-TRAINING ON LANGUAGE MODELING
Pre-training has been shown to dramatically increase the capabilities and performance of decoder-only models on tasks other than language modeling (Howard and Ruder, 2018). Motivated by that, we pre-train our models on GitHub and arXiv subsets of the Pile (Gao et al., 2021). The models are trained for 1M steps, with a context length of 2048. Global batch size is set to 32 sequences giving a total number of 65536 tokens per batch. Dropout is disabled, and weight decay is set to 0.02. The learning rate increases linearly from 0 to 0.0003 for the first 10000 steps, and then the cosine schedule is applied to decrease its value gradually.
# C.4 FINE-TUNING FOR DOWNSSTREAM TASKS
We train Magnushammer by taking a pre-trained language model, removing its language modeling head, and attaching three linear projections heads - one projection for proof state embedding, another
one for premise embedding, and the last one for producing relevance score for RERANK, as depicted in Figure 2b and described in Section C.1. For the proof step generation task, we fine-tune our language models by applying the algorithm used to train Thor (Jiang et al., 2022a).
# C.5 IMPACT OF RE-RANKING
We find that the SELECT-only method, i.e., Magnushammer without the RERANK phase, already significantly outperforms Sledgehammer. Tested on the 38M model, it achieves a $54.2\%$ proof rate comparable to $56.3\%$ obtained by Magnushammer. SELECT-only mode is a computationally appealing alternative, as it only needs a single forward pass to embed the current proof state (the setting used recently by Yang et al. (2023).) Premise embeddings can be pre-computed and cached, allowing inference on the CPU without the need for GPU or TPU accelerators.
# C.6 HARDWARE
We gratefully acknowledge that our research was supported with Cloud TPUs from Google's TPU Research Cloud (TRC). We use TPU virtual machines from the Google Cloud Platform (GCP) for all stages: pre-training, fine-tuning, and evaluation. Each TPU virtual machine has 8 TPU v3 cores, 96 CPU cores, and over 300GB of RAM. TPU v3 cores have around 16GB of memory each. The Isabelle environment is set to have access to 32 CPU cores.
# D MAGNUSHAMMER EVALUATION
In Algorithm 3 we outline our evaluation method described in Section 5.1. To generate proof steps, we use the following tactics: smt, metis, auto, simp, blast, meson, force, eval, presburger, linarith. Algorithm 3 is also used to evaluate BM25, where we select top-premises with this retrieval method instead of Magnushammer.
# D.1 COMPUTATIONAL BUDGET
For our main result (Section 5.2), we allocate the computational budget of 1000 as follows: apart from the powers of two from $2^{0}$ to $2^{10}$ , we also try the following $k$ values: [48, 96, 192], which in total gives 14 values. With each of these $k$ values, 36 tactics are used with timeout $T = 2$ , yielding $C \approx 1000$ .
For the ablation studies, we only use powers of two from $2^{0}$ to $2^{10}$ , and the same set of 36 tactics, which gives $C \approx 800$ .
Algorithm 3 Magnushammer evaluation in ITP environment. Require: theorem $\triangleright$ theorem to prove premsel_model $\triangleright$ Magnushammer's premise selection model $K_{S}$ number of premises to retrieve with SELECT $K_{R}$ number of premises to retrieve with RERANK premises available premises top_k_premises_to_try list with the number of top premises to generate steps with tactics_to_try list of tactics to generate steps with env ITP environment (e.g., Isabelle) 1: proof_state $\leftarrow$ init problem(env,theorem) initialize problem 2: top-premises $\leftarrow$ premsel_model(prooef_state,premises, $K_{S},K_{R})$ get top premises 3: steps =[] generate proof steps combining of tactics and top k premises 4: for k in top_k_premises_to_try do 5: top_k_premises $\leftarrow$ top_premises[:k] 6: new_steps $\leftarrow$ generate_steps(tactics_to_try,top_k_premises) 7: steps extend(new_steps) 8: solved $\leftarrow$ try_steps(env,steps) evaluate generated proof steps in the ITP's environment 9: return solved
# D.2 THOR + MAGNUSHAMMER
To generate more complex proofs we combine Thor (Jiang et al., 2022a) with Magnushammer as introduced in multi-step setting in Section 5.2.
Firstly, we follow the procedure described in Jiang et al. (2022a) to pre-process training data and fine-tune our pre-trained language model for the proof generation task (pre-training details can be found in Appendix C.3). During the evaluation, when the language model generates the <hammer> token, we call our method instead of Sledgehammer. More specifically, we use an augmented Algorithm 3 that returns the proof states resulting from applying the steps (instead of returning binary information on whether any of the steps closed the proof). We then pick at most $s = 2$ states among these and add them to the BFS queue.
We assign the same computational budget as proposed in Thor, with the only difference being that each proof_step has a timeout limit of 2 s (instead of 10 s), which we found to perform better in our setup. The search is terminated if and only if one of the following scenarios happens: (1) a valid proof has been found for the theorem; (2) the language model is queried 300 times; (3) a wall-time timeout of 500 s has been reached (assuming parallel execution of Magnushammer steps); (4) the queue is empty but the theorem is not proved. We keep the same maximum length of the queue equal to 32.
# E ADDITIONAL EXPERIMENTAL RESULTS
# E.1 SUPPLEMENTAL DETAILS
We provide additional details for our main experiments and ablations.
Table 4: Relation between the training data and the proof rate discussed in Section 5.3 and Figure 3a.
<table><tr><td>Dataset</td><td>Fraction</td><td>Pre-trained</td><td>Proof rate (%)</td></tr><tr><td>MAPL</td><td>0.1%</td><td>Yes</td><td>39.2</td></tr><tr><td>HPL</td><td>0.1%</td><td>Yes</td><td>34.9</td></tr><tr><td>MAPL</td><td>0.1%</td><td>No</td><td>16.8</td></tr><tr><td>MAPL</td><td>1%</td><td>Yes</td><td>47.7</td></tr><tr><td>HPL</td><td>1%</td><td>Yes</td><td>42.7</td></tr><tr><td>MAPL</td><td>1%</td><td>No</td><td>29.0</td></tr><tr><td>MAPL</td><td>10%</td><td>Yes</td><td>53.2</td></tr><tr><td>HPL</td><td>10%</td><td>Yes</td><td>49.4</td></tr><tr><td>MAPL</td><td>10%</td><td>No</td><td>48.5</td></tr><tr><td>MAPL</td><td>100%</td><td>Yes</td><td>56.3</td></tr><tr><td>HPL</td><td>100%</td><td>Yes</td><td>54.0</td></tr><tr><td>MAPL</td><td>100%</td><td>No</td><td>53.0</td></tr></table>
# E.2 STEP TACTIC PROMPT
We observed that different tactics use different subsets of premises. This motivated us to extend the context given to our model with tactic prompt. Namely, provide the tactic name as an additional argument to the premise selection model, similarly to Bansal et al. (2019). Prompting model with the tactic name does not yield significant improvements. However, it allows the model for a more accurate premise selection. Namely, as presented in Figure A.5 and Table 6, we observe that premises necessary to close the proof are ranked higher. This motivates an alternative performance metric presented in the next section.
Table 5: Proof rate on PISA for different models discussed in Section 5.4 and Figure 3b. We vary the number of layers $L$ and the embedding dimension $D$ of the Transformer model.
<table><tr><td>Transformer (L, D)</td><td>#Parameters</td><td>Pre-trained</td><td>Proof rate (%)</td></tr><tr><td>(1, 256)</td><td>920K</td><td>No</td><td>40.7</td></tr><tr><td>(1, 512)</td><td>3.7M</td><td>No</td><td>43.9</td></tr><tr><td>(2, 256)</td><td>1.7M</td><td>No</td><td>47.0</td></tr><tr><td>(2, 512)</td><td>6.8M</td><td>No</td><td>48.4</td></tr><tr><td>(2, 768)</td><td>15.4M</td><td>No</td><td>49.9</td></tr><tr><td>(6, 512)</td><td>19.2M</td><td>No</td><td>52.5</td></tr><tr><td>(6, 512)</td><td>19.2M</td><td>Yes</td><td>53.3</td></tr><tr><td>(6, 768)</td><td>43.7M</td><td>No</td><td>52.1</td></tr><tr><td>(12, 512)</td><td>38.3M</td><td>No</td><td>52.6</td></tr><tr><td>(12, 512)</td><td>38.3M</td><td>Yes</td><td>56.3</td></tr><tr><td>(12, 768)</td><td>86.2M</td><td>Yes</td><td>57.0</td></tr></table>
 Figure A.5: We calculate accumulated proof rate in the following way: try 1 premise, count problems solved, then try 2 premises, count problems solved using 1 or 2 premises, then try 4 premises, count problems solved using 1, 2, or 4 premises etc. Following this, on the x-axis we have the number of premises used to generate steps in Algorithm 3. The y-axis presents the accumulative proof rate as we try more and more premises. The higher the proof rate for the smaller number of premises used the better. We observe that prompting the model with the tactic is not necessary to achieve the final high proof. However, it allows the model for a more accurate premise selection – all premises necessary to close the proof are ranked higher.
Table 6: Effect of the number of premises used for generating tactic steps on the proof rate. We fix a set of tactics and accumulate problems solved as we increase the number of premises used to generate steps in Algorithm 3. Namely, for each $k$ , we count the number of problems solved using at most $k$ premises. The "Tactic" column indicates whether the model was given a tactic prompt.
<table><tr><td>Model</td><td>Tactic</td><td>Dataset</td><td>k≤0</td><td>≤1</td><td>≤2</td><td>≤4</td><td>≤8</td><td>≤16</td><td>≤32</td><td>≤64</td><td>≤128</td><td>≤256</td></tr><tr><td>BM25</td><td>No</td><td>N/A</td><td>9.63</td><td>13.56</td><td>15.62</td><td>16.70</td><td>18.47</td><td>20.73</td><td>23.38</td><td>25.44</td><td>28.00</td><td>30.55</td></tr><tr><td>MH-86M</td><td>No</td><td>HPL</td><td>9.63</td><td>19.25</td><td>22.99</td><td>28.68</td><td>34.58</td><td>39.88</td><td>44.50</td><td>47.84</td><td>51.47</td><td>52.95</td></tr><tr><td>MH-86M</td><td>Yes</td><td>HPL</td><td>9.63</td><td>20.24</td><td>25.44</td><td>31.53</td><td>36.15</td><td>40.67</td><td>44.70</td><td>48.53</td><td>51.87</td><td>54.22</td></tr><tr><td>MH-86M</td><td>No</td><td>MAPL</td><td>9.63</td><td>18.27</td><td>22.00</td><td>27.70</td><td>35.07</td><td>39.78</td><td>44.99</td><td>49.31</td><td>52.65</td><td>55.60</td></tr><tr><td>MH-86M</td><td>Yes</td><td>MAPL</td><td>9.63</td><td>19.94</td><td>25.93</td><td>33.79</td><td>39.29</td><td>43.71</td><td>47.94</td><td>52.06</td><td>54.32</td><td>56.19</td></tr></table>
# E.3 NUMBER OF PREMISES USED AS A PERFORMANCE METRIC FOR PREMISE SELECTION.
Consider the number of premises used to generate steps in Algorithm 3 (parameter $k$ in the for-loop). Intuitively, the fewer premises needed the better, since it means that all the premises necessary to close the proof are ranked higher (high recall), thus the model does a more accurate premise selection. In other words, a better retrieval model should be able to score all the necessary facts higher and push unnecessary facts down the list.
To compare different models we fix a set of tactics and accumulate problems solved as we increase the number of premises used to generate steps in Algorithm 3. This is presented in Table 6 and Figure A.5. Namely, for each $k$ , we count the number of problems solved using at most $k$ premises. Effectively, each new value of $k$ adds one new step per tactic to try.
# E.4 SINGLE-STEP PROOF RATE BOUND
It is non-trivial to estimate the lower bound on how many problems can be closed directly from the root state in a single proof step. To answer this question, we use different models in Algorithm 3 and take the union of problems solved by them. Namely, we ensemble the results of the Magnushammer variations introduced in previous sections: Magnushammer-86M, Magnushammer-38M, Magnushammer-SELECT, Sledgehammer, BM25, and the models presented in Section 5.4. Such a combination successfully closes $65.5\%$ of the proofs.
# F EXAMPLES OF PROOFS FOUND BY MAGNUSHAMMER
In Sledgehammer, once one of the external provers found a proof, it is likely that it can be reproduced inside Isabelle (but not always, as reported by Paulson and Blanchette (2012)). The external provers significantly reduce the number of premises passed to the reproduction step, therefore the Isabelle's proof will be short. The major bottleneck of Sledgehammer, however, is the pre-selection step: the external provers often cannot find a proof because they are provided too few – or too many – premises.
In Magnushammer, on the other hand, we skip the external provers completely and input premises directly into the native Isabelle's tactics to produce a proof. This means that the prediction must be of high quality in order to obtain good results. The number of the premises will be typically larger – therefore the proofs will be longer, and of form of a combination of a strong tactic and a long list of premises as its arguments.
As an example demonstrating the difference between Magnushammer and Sledgehammer from the perspective of produced proofs, let's see two proofs of the algebraic theorem set_r_ar*cos_ker from the Archive of Formal Proofs:3
Sledgehammer's proof:
by (smt (z3) Ring.set_r_ar_cos ker_ideal)
Magnushammer's proof:
by (clarsimp simp add: set_ar_cos_def Ring.Ring Ring.set_r_ar_cos eq_prop Ring.I_in_set_ar_cos Set.bexE Ring.ring_is_ag ker_ideal)
Both Sledgehammer and Magnushammer were able to solve it, however, the latter used more premises. This is expected: whenever both methods find a proof, the Magnushammer's proof is often longer in the sense of the number of premises used. Yet, Sledgehammer's weaker pre-selection scheme causes it to find fewer proofs in comparison.
An example of a theorem that Sledgehammer was unable to prove (with a generous time limit of 60 s), but Magnushammer has proven, is lemma unit_disc_fix_moebius_uminus.4 The proof
produced by Magnushammer consists of the smt tactic and a list of premises. Thus, Magnushammer was able to retrieve the necessary premises in contrast to Sledgehammer:
```txtby (smt (z3) unit_disc_fix_unit_circle_fix Oriented_Circlines(unit_disc_def unit_circle_fix_moebius_uminus unit_disc_fix_moebius_comp Set(image_iff unit_disc_fix_iff Moebius.uminus_moebius_def Unitaryll_Matrices(unitaryll_unitaryll_gen unit_disc_fix.abs_eq Oriented_Circlines.inf.notin_unit_disc Moebius_plus_moebius_def unit_disc_fix_discI unit_disc_fix_moebius_add unit_disc_fix_id_moebius Set(imageE Set(imageI Oriented_Circlines.zero_in_unit_disc SMT.veritMinus_simplify(4) unit_circle_fix_moebius_comp```123version https://git-lfs.github.com/spec/v1oid sha256:bb50c3770879884ece7c94c6fdc8d7dcbb7039959feddb9e47d4e984ca94d44fsize 380299123version https://git-lfs.github.com/spec/v1oid sha256:aa08bb133dcb2b8fbcf7cd430d64d66cd883a4ce6530ce34590be07182dbd730size 25273662123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547# MAKING LLAMA SEE AND DRAW WITH SEEDTOKENIZER
Yuying Ge $^{1*}$ , Sijie Zhao $^{1*}$ , Ziyun Zeng $^{2}$ , Yixiao Ge $^{1,2\dagger}$ , Chen Li $^{2}$ , Xintao Wang $^{1,2}$ , Ying Shan $^{1,2}$
$^{1}$ Tencent AI Lab, $^{2}$ ARC Lab, Tencent PCG
 Figure 1: The introduced SEED-LLaMA, a multimodal AI assistant, demonstrates emergent ability in the multi-turn in-context image and text generation given multimodal instructions.


# ABSTRACT
The great success of Large Language Models (LLMs) has expanded the potential of multimodality, contributing to the gradual evolution of General Artificial Intelligence (AGI). A true AGI agent should not only possess the capability to perform predefined multi-tasks but also exhibit emergent abilities in an open-world context. However, despite the considerable advancements made by recent multimodal LLMs, they still fall short in effectively unifying comprehension and generation tasks, let alone open-world emergent abilities. We contend that the key to overcoming the present impasse lies in enabling text and images to be represented and processed interchangeably within a unified autoregressive Transformer. To this end, we introduce SEED, an elaborate image tokenizer that empowers LLMs with the ability to SEE and Draw at the same time. We identify two crucial design principles: (1) Image tokens should be independent of 2D physical patch positions and instead be produced with a 1D causal dependency, exhibiting intrinsic interdependence that aligns with the left-to-right autoregressive prediction mechanism in LLMs. (2) Image tokens should capture high-level semantics consistent with the degree of semantic abstraction in words, and be optimized for both discriminativeness and reconstruction during the tokenizer training phase. With SEED tokens, LLM is able to perform scalable multimodal autoregression under its original training recipe, i.e., next-word prediction. SEED-LLaMA is therefore produced by large-scale pretraining and instruction tuning on the interleaved textual and visual data, demonstrating impressive performance on a broad range of multimodal comprehension and generation tasks. More importantly, SEED-LLaMA has exhibited compositional emergent abilities such as multi-turn in-context multimodal generation, acting like your AI assistant. The code (training and inference) and models are released in https://github.com/AILab-CVC/SEED.
 Figure 2: (a) SEED is a discrete image tokenizer, producing quantized visual codes with 1D causal dependency and high-level semantics. (b) With SEED tokenizer, LLM is able to perform scalable multimodal autoregression on interleaved visual and textual data with next-word-prediction objective.

# 1 INTRODUCTION
In recent years, Large Language Models (Touvron et al., 2023; Brown et al., 2020; Chowdhery et al., 2022) (LLMs) pre-trained on massive text corpus with straightforward training objectives such as next-word prediction have exhibited remarkable abilities to understand, reason, and generate texts across a variety of open-ended tasks. Recent studies further exploit the strong generality of LLMs to improve visual understanding or generation tasks, collectively referred to as Multimodal LLM (MLLM). While these studies have contributed to technological advancements, MLLMs have yet to achieve the remarkable success of LLMs in terms of emergent capabilities. We have made a bold assumption that the premise for the emergence of multimodal capabilities is that text and images can be represented and processed interchangeably in a unified autoregressive Transformer.
We posit that a proper visual tokenizer is the key as it can facilitate the follow-up multimodal training by (i) easing the semantic alignment between visual and word tokens, and (ii) enabling LLM's original training recipe (i.e., next-word prediction) for multimodal data without specific adaptation for visual tokens. Representing images as a sequence of discrete IDs is naturally compatible with the autoregressive training objective of LLMs. But unfortunately, works (Ramesh et al., 2021; Ding et al., 2021) that utilize discretized visual tokens for multimodal tasks have receded from prominence, as such models generally rely on super-scale training to converge, leading to substantial training costs. Moreover, we empirically found that the dominant tokenizer VQ-VAE (Van Den Oord et al., 2017) in existing works captures too low-level information for LLMs to effectively perform multimodal comprehension tasks. Existing image tokenizers fail to meet the requirements of unifying the generation of images and texts and facilitating multimodal training.
To this end, we introduce SEED, a VQ-based image tokenizer that produces discrete visual codes with 1D causal dependency and necessary high-level semantics for both visual comprehension and generation tasks, as shown in Fig. 2 (a). The off-the-shelf LLMs can be readily equipped with SEED by treating discrete visual tokens as new words and updating the vocabulary. We would like to emphasize the design principles of SEED. (1) Why causal-dependent tokens? Existing visual tokens (e.g., from VQ-VAE or CLIP-ViT (Sun et al., 2023a)) are generated using 2D context, which is incompatible with the unidirectional attention in dominant LLMs and counterintuitive for text-to-image tasks requiring raster order prediction. Thus, we convert 2D raster-ordered embeddings into a sequence of semantic codes with 1D causal dependency. (2) Why high-level semantics? Since visual and textual tokens in LLMs are expected to be interoperable—sharing weights and training objectives—they should encompass the same degree of semantics to prevent misalignment, i.e., the high-level semantics inherently present in words.
Specifically, the SEED tokenizer is composed of a ViT encoder (Dosovitskiy et al., 2020), Causal Q-Former, VQ Codebook (Van Den Oord et al., 2017), multi-layer perceptron (MLP), and a UNet decoder (Ronneberger et al., 2015). The ViT encoder and UNet decoder are directly derived from the pre-trained BLIP-2 (Li et al., 2023c) and unCLIP-SD model (Rombach et al., 2022; Ramesh et al., 2022), respectively. (1) Tokenize: Causal Q-Former converts 2D raster-ordered features produced by the ViT encoder into a sequence of causal semantic embeddings, which are further discretized by the VQ Codebook. (2) De-Tokenize: The discrete visual codes are decoded into generation embedding
via MLP. The generation embedding is aligned with the latent space of unCLIP-SD so that realistic images with consistent semantics can be generated using the off-the-shelf SD-Unet.
We further present SEED-LLaMA by equipping the pre-trained LLM (Touvron et al., 2023) with SEED tokenizer. SEED-LLaMA is pretrained on multimodal data, including image-text pairs, video-text pairs, and interleaved image-text data, toward the training objective of next-word prediction as shown in Fig. 2 (b). Such an easy-to-implement and unified proxy task facilitates scalable multimodal pretraining. We further apply multimodal instruction tuning to align SEED-LLaMA with human instructions through supervised fine-tuning. Our model demonstrates extensive emergent abilities such as multi-turn in-context image and text generation given multimodal instructions as shown in Fig. 1. We also benchmark on a broad range of tasks including image captioning, image/video question answering, and text-to-image generation, receiving competitive performance.
In summary, our contributions are three-fold. (1) We introduce SEED, an advanced image tokenizer, designed based on the insights that visual tokens compatible with LLMs should capture high-level semantics while being generated with 1D causal dependency. The tailored SEED improves the scalability of subsequent multimodal training. (2) We present SEED-LLaMA, composed of a pretrained LLM and SEED tokenizer, through large-scale multimodal pretraining and instruction tuning under the next-word-prediction training objective. It successfully unified multimodal comprehension and generation tasks in one framework. (3) SEED-LLaMA shows competitive results on existing multimodal tasks (e.g., text-to-image, image-to-text) and further demonstrates emergent abilities in multi-turn in-context multimodal understanding, reasoning, and generation.
# 2 RELATED WORK
MLLMs for Comprehension and Generation. With the impressive success of Large language models (Touvron et al., 2023; Brown et al., 2020; Chowdhery et al., 2022) (LLMs), recent studies work on Multimodal LLM (MLLM) to improve visual comprehension through utilizing the strong generality of LLMs. Previous work (Ye et al., 2023; Li et al., 2023c; Zhu et al., 2023a; Zhang et al., 2023b; Gao et al., 2023; Liu et al., 2023b; Alayrac et al., 2022; Driess et al., 2023) align visual features of pre-trained image encoder with LLMs on image-text datasets. However, these work commonly use the prediction of the next text token as the objective, thus can only output texts.
To empower LLMs with the image generation ability, CogView (Ding et al., 2021) pre-trains a visual tokenizer by reconstructing image pixels, and fine-tunes GPT (Brown et al., 2020) with the objective of next-token prediction. GILL (Koh et al., 2023a) learns a mapping between the embeddings of a LLM and a frozen text-to-image generation model. Both work aim to generate images with LLMs, without being explicitly designed for unifying multimodal comprehension and generation.
Our concurrent works (Sun et al., 2023b; Lili et al., 2023) both perform multimodal autoregression including the generation of images and texts. CM3Leon (Lili et al., 2023) utilizes discrete visual codes from a image tokenizer (Gafni et al., 2022) pre-trained on image pixel reconstruction and performs image-to-text and text-to-image autoregression. However, it yields suboptimal performance in visual comprehension tasks (e.g., CIDEr 61.6 vs. ours 126.9 on COCO image captioning) because the image tokenizer captures too low-level information. Emu (Sun et al., 2023b) employs continuous visual representations and is pre-trained on interleaved multimodal sequences through classifying the next text token or regressing the next visual embedding. For image generation, Emu further fine-tunes a SD model to accommodate the output representations from the LLM. By contrast, we pre-train a discrete image tokenizer, where the visual codes can be decoded to realistic images using the off-the-shelf SD model, and perform multimodal autoregressive with a unified next-word-prediction objective, which facilitates scalable multimodal training.
Visual Tokenizer. Visual tokenizer aims to represent images as a sequence of discrete tokens. Previous work (Van Den Oord et al., 2017; Ramesh et al., 2021; Esser et al., 2021; Gu et al., 2022) trains a Vector Quantized Variational AutoEncoders (VQ-VAE) by reconstructing image pixels, which captures only low-level details such as color, texture and edge. Beit v2 (Peng et al., 2022) trains a visual tokenizer through reconstructing high-level features from the teacher model, but its visual codes from 2D features of a vision transformer (Dosovitskiy et al., 2020) are incompatible with the unidirectional attention in dominant LLMs for image generation. By contrast, we present SEED tokenizer, which produces discrete visual codes with 1D causal dependency and high-level semantics.
 Figure 3: Overview of SEED tokenizer, which produces discrete visual codes with causal dependency and high-level semantics. The generation embedding from visual codes can be decoded to realistic images with the frozen unCLIP (Ramesh et al., 2022) SD, which is conditioned on image embedding.
# 3 METHOD
# 3.1 SEEDTOKENIZER
As shown in Fig. 3, the SEED tokenizer consists of the following components for tokenization and de-tokenization:
(1) ViT encoder (Dosovitskiy et al., 2020), which is derived from the pre-trained BLIP-2 (Li et al., 2023c) and is frozen, providing visual features as the inputs of the Causal Q-Former. (2) Causal Q-Former, which is trained (Enq. 1) to convert 2D raster-ordered features $(16\times 16$ tokens) produced by the ViT encoder into a sequence of causal embeddings (32 tokens). (3) VQ Codebook (Van Den Oord et al., 2017), which is trained (Enq. 2) to discretize the causal embeddings from Causal Q-Former to quantized visual codes (32 tokens) with causal dependency. (4) Multi-layer perceptron (MLP), which is trained (Enq. 3) to decode the visual codes from VQ Codebook into generation embedding (1 token) for the alignment with the latent space of the pretrained unCLIP-SD (Ramesh et al., 2022) conditioned on image embedding. (5) UNet decoder (Ronneberger et al., 2015), which is derived from the unCLIP-SD to encode realistic images from the generation embedding, and is kept frozen.
We pre-train SEED tokenizer on image-text pairs including CC3M (Sharma et al., 2018), Unsplash (Luke Chesser, 2023), LAION-COCO (Christoph et al., 2022) and MS-COCO (Chen et al., 2015).
# 3.1.1 TRAINING STAGE I: CAUSAL Q-FORMER
As shown in Fig. 3, we first train Causal Q-former to extract a fixed number of output features with causal dependency from the image encoder through contrastive learning. Specifically, a set number of learnable query embeddings (32 tokens) and features of a pre-trained ViT encoder (Sun et al., 2023a) are fed into the Causal Q-former to encode a fixed number of causal embeddings (32 tokens) of the input image. The query embeddings can interact with only previous queries through self-attention layers with causal mask, and interact with frozen image features through cross-attention layers. We adopt contrastive learning to maximize the similarity between the final causal embedding $\hat{c}$ and text features $t$ of the corresponding caption, while minimizing the similarity between the final causal embedding and text features of other captions in a batch, using Noise-Contrastive Estimation Oord et al. (2018) as below,
$$\mathcal {L} _ {\mathrm {C Q}} = - \log \frac {\exp \left(\hat {c} _ {i} ^ {T} t _ {i} / \tau\right)}{\sum_ {j = 1} ^ {B} \exp \left(\hat {c} _ {i} ^ {T} t _ {j} / \tau\right)} - \log \frac {\exp \left(t _ {i} ^ {T} \hat {c} _ {i} / \tau\right)}{\sum_ {j = 1} ^ {B} \exp \left(t _ {i} ^ {T} \hat {c} _ {j} / \tau\right)} \tag {1}$$
where $B$ is the number of the batch size and $\tau$ is the learnable temperature parameter.
 Figure 4: Overview of the multimodal autoregressive pretraining on interleaved visual and textual data for SEED-LLaMA. Visual inputs are pre-processed into discrete tokens to conserve computational resources. Given the multimodal discrete sequence, a unified next-word-prediction objective is employed. During inference, visual codes are decoded into a realistic image by SEED De-Tokenization.
# 3.1.2 TRAINING STAGE II: VISUALTOKENIZE AND DE-TOKENIZE
As shown in Fig. 3, we train a VQ codebook to discretize the causal embeddings (32 tokens) into quantized visual codes (32 tokens) for visual tokenization, and a MLP to decode the visual codes into generation embedding (1 token) for visual de-tokenization. The vocabulary size of the VQ codebook is set as 8192. Specifically, causal embeddings $C$ from the frozen Causal Q-Former are first fed into a linear projection layer to reduce the dimensions as $C'$ for improving codebook utilization following previous work Peng et al. (2022). A quantizer looks up the nearest neighbor embeddings $Z$ in the codebook for $C'$ and obtains the corresponding codes. We employ a decoder, which is a multi-layer Transformer (Dosovitskiy et al., 2020), to reconstruct the continuous causal embeddings $C$ from discrete codes as $C^{\mathrm{recon}}$ . We employ a MLP to reconstruct the image embedding $I$ (1 token) of a frozen unCLIP-SD from discrete codes as generation embedding $G$ . As shown in Enq. 2, during training, besides the original VQ objective Van Den Oord et al. (2017) (the first and second term), we maximize the cosine similarity between reconstructed causal embeddings $C^{\mathrm{recon}}$ and causal embeddings $C$ (the third term), and minimize the MSE loss between generation embedding $G$ and image embedding $I$ of unCLIP-SD (the fourth term).
$$\mathcal {L} _ {\mathrm {V Q}} = \left| \left| \operatorname {s g} \left[ C ^ {\prime} \right] - Z \right| \right| _ {2} ^ {2} + \left| \left| C ^ {\prime} - \operatorname {s g} [ Z ] \right| \right| _ {2} ^ {2} - \cos \left(C ^ {\text {r e c o n}}, C\right) + \mathcal {L} _ {\mathrm {M L P}} \tag {2}$$
$$\mathcal {L} _ {\mathrm {M L P}} = \operatorname {M S E} (G, I) \tag {3}$$
where $\mathrm{sg}[\cdot ]$ denotes the stop-gradient operation. During inference, the generation embedding $G$ are fed into the off-the-shelf SD-UNet to decode realistic images.
# 3.2 SEED-LLAMA
# 3.2.1 TRAINING STAGE I: MULTIMODAL PRETRAINING
As shown in Fig. 4, SEED-LLaMA adopts a unified next-word-prediction training objective on interleaved visual and textual data. Specifically, visual inputs are first discretized into a sequence of causal codes by SEED tokenizer. Then the interleaved visual codes and text tokens are fed into the pretrained LLM for performing multimodal autoregression, where the visual codes are treated as new words and the vocabulary of the LLM is updated accordingly. We maximize the likelihood in a unified autoregressive manner as follows:
$$L (\mathcal {U}) = \sum_ {i} \log P (u _ {i} \mid u _ {i - k}, \dots , u _ {i - 1}; \Theta) \tag {4}$$
where $u_{i}$ represents visual code or text token, and $\Theta$ denotes the parameters of the transformer. We initialize SEED-LLaMA from a pre-trained LLM, and add 8192 visual codes to the vocabulary. The embedding layer and decoder head layer in the transformer are expanded and the parameters of added visual codes are randomly initialized.
For efficiency, we first train SEED-LLaMA using LoRA (Hu et al., 2021) tuning and together optimize the parameters of the embedding layer and decoder head layer due to the added visual codes. We
Table 1: Evaluation of Image-Text Retrieval. Causal codes are quantized causal embeddings.
<table><tr><td rowspan="3">Model</td><td colspan="7">Flickr30K (1K test set)</td><td colspan="7">COCO (5K test set)</td></tr><tr><td colspan="3">Image → Text</td><td colspan="4">Text → Image</td><td colspan="3">Image → Text</td><td colspan="4">Text → Image</td></tr><tr><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@m</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@m</td></tr><tr><td>BLIP-2 (Li et al., 2023c)</td><td>81.9</td><td>98.4</td><td>99.7</td><td>82.4</td><td>96.5</td><td>98.4</td><td>92.9</td><td>65.3</td><td>89.9</td><td>95.3</td><td>59.1</td><td>82.7</td><td>89.4</td><td>80.3</td></tr><tr><td>SEED (causal embedding)</td><td>91.0</td><td>99.5</td><td>100.0</td><td>79.3</td><td>94.8</td><td>97.1</td><td>93.6</td><td>74.2</td><td>93.1</td><td>96.7</td><td>59.0</td><td>82.8</td><td>89.2</td><td>82.5</td></tr><tr><td>SEED (causal code)</td><td>85.4</td><td>98.3</td><td>99.6</td><td>73.7</td><td>92.3</td><td>95.7</td><td>90.8</td><td>66.9</td><td>89.3</td><td>94.4</td><td>53.2</td><td>78.8</td><td>86.6</td><td>78.2</td></tr></table>
 nnnn







 Reonrnnnne
 Figure 5: Reconstruction images of SEED tokenizer (i.e., original image $\rightarrow$ SEED tokenizer $\rightarrow$ causal visual codes $\rightarrow$ SEED de-tokenize $\rightarrow$ reconstructed image).





then merge the parameters of LoRA onto the LLM backbone and fine-tune all parameters except for the embedding layer. We freeze the embedding layer since we observe that fine-tuning it together with other parameters can lead to unstable training loss, which is also reported in BLOOM (Scao et al., 2022) and GLM-130B (Zeng et al., 2022). We preprocess the images and videos into discrete tokens beforehand to conserve computational resources. We perform pretraining using two versions of LLM, Vicuna-7B and Llama2-chat-13B, with 64 A100-40G GPUs, and yield SEED-LLaMA-8B (144 hours) and SEED-LLaMA-14B (216 hours), respectively. See Appendix. B for details.
# 3.2.2 TRAINING STAGE II: MULTIMODAL INSTRUCTION TUNING
We perform multimodal instruction tuning on SEED-LLaMA to align it with human instructions through supervised finetuning on public datasets. The details of datasets can be found in Appendix. C. We fine-tune a LoRA module on the pre-trained SEED-LLaMA with the template as below,
$$\text {U S E R :} \quad < \text {I n s t r u c t i o n} > \quad \text {A S S I S T A N T :} \quad < \text {A n s w e r} > \tag {5}$$
Only the content of <Answer> is accounted for loss. The overall instruction tuning phase takes 16 hours for SEED-LLaMA-8B and 27 hours for SEED-LLaMA-14B with 32 A100-80G GPUs.
# 3.3 SEEDTOKENIZER
# 4 EXPERIMENT
Evaluation of Causal Embeddings. We evaluate the performance of Causal Q-Former on the image-text retrieval using COCO (Lin et al., 2014) and Flickr30K (Young et al., 2014). The performance is measured by $Recall@K$ ( $R@K$ ). Note that we adopt the dual-stream paradigm for inference and remove the image-text-matching (ITM) re-rank module in BLIP-2 for a fair comparison. As shown in Tab. 1, our Causal Q-former achieves better results than BLIP-2 in terms of an aggregated metric $Recall@mean$ . It demonstrates that the output query embeddings with causal dependency do not drop performance than the output embeddings with bi-directional attention in BLIP-2.
Evaluation of Causal Codes. We evaluate causal codes on the image-text retrieval, where the reconstructed embeddings from causal codes are used for retrieval. As shown in Tab. 1, discrete codes exhibit competitive performance compared to BLIP-2, which demonstrates that the discrete codes from SEED tokenizer capture high-level semantics, which are suitable for visual comprehension.
We visualize the reconstructed images of SEED tokenizer in Fig. 5. Through obtaining the generation embedding from the causal visual codes, realistic images can be generated using the frozen SD-UNet, which maintain consistent semantics with inputs. The above evaluation and visualization demonstrate the versatility of SEED visual tokens for both comprehension and generation tasks.
Table 2: Comparison for multimodal comprehension. "Image Gen" denotes whether the model can generate images besides texts, and "-I" denotes the instruction tuned model. The best results are bold and the second best are underlined.
<table><tr><td rowspan="2">Models</td><td rowspan="2">Size</td><td rowspan="2">Image Gen</td><td colspan="5">Image-Text Tasks</td><td colspan="3">Video-Text Tasks</td></tr><tr><td>COCO</td><td>VQAv2</td><td>OKVQA</td><td>VizWiz</td><td>SEED Bench</td><td>MSVDQA</td><td>MSRVTTQA</td><td>NExTQA</td></tr><tr><td>Flamingo (Alayrac et al., 2022)</td><td>9B</td><td>×</td><td>79.4</td><td>51.8</td><td>44.7</td><td>28.8</td><td>42.7</td><td>30.2</td><td>13.7</td><td>23.0</td></tr><tr><td>BLIP-2 (Li et al., 2022)</td><td>4.1B</td><td>×</td><td>144.5</td><td>63.0</td><td>40.7</td><td>29.8</td><td>49.7</td><td>33.7</td><td>16.2</td><td>-</td></tr><tr><td>InstructBLIP (Li et al., 2023c)</td><td>8.1B</td><td>×</td><td>-</td><td>-</td><td>-</td><td>34.5</td><td>58.8</td><td>41.8</td><td>22.1</td><td>-</td></tr><tr><td>Kosmos-1 (Huang et al., 2023)</td><td>1.6B</td><td>×</td><td>84.7</td><td>51.0</td><td>-</td><td>29.2</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Kosmos-2 (Peng et al., 2023)</td><td>1.6B</td><td>×</td><td>-</td><td>45.6</td><td>-</td><td>-</td><td>54.4</td><td>-</td><td>-</td><td>-</td></tr><tr><td>MetaLLM (Hao et al., 2022)</td><td>1.7B</td><td>×</td><td>82.2</td><td>41.1</td><td>11.4</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>IDEFICS (Laurençon et al., 2023)</td><td>80B</td><td>×</td><td>91.8</td><td>60.0</td><td>45.2</td><td>36.0</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>IDEFICS-I (Laurençon et al., 2023)</td><td>80B</td><td>×</td><td>117.2</td><td>37.4</td><td>36.9</td><td>26.2</td><td>53.2</td><td>-</td><td>-</td><td>-</td></tr><tr><td>CM3Leon (Lili et al., 2023)</td><td>7B</td><td>✓</td><td>61.6</td><td>47.6</td><td>23.8</td><td>37.6</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Emu (Sun et al., 2023b)</td><td>14B</td><td>✓</td><td>112.4</td><td>52.0</td><td>38.2</td><td>34.2</td><td>47.3</td><td>18.8</td><td>8.3</td><td>19.6</td></tr><tr><td>Emu-I (Sun et al., 2023b)</td><td>14B</td><td>×</td><td>117.7</td><td>40.0</td><td>34.7</td><td>35.4</td><td>58.0</td><td>32.4</td><td>14.0</td><td>6.8</td></tr><tr><td>SEED-LLaMA</td><td>8B</td><td>✓</td><td>123.6</td><td>44.2</td><td>29.2</td><td>21.5</td><td>42.2</td><td>11.5</td><td>5.0</td><td>14.3</td></tr><tr><td>SEED-LLaMA-I</td><td>8B</td><td>✓</td><td>124.5</td><td>66.2</td><td>45.9</td><td>55.1</td><td>51.5</td><td>40.9</td><td>30.8</td><td>24.9</td></tr><tr><td>SEED-LLaMA</td><td>14B</td><td>✓</td><td>125.0</td><td>48.1</td><td>27.1</td><td>23.3</td><td>46.0</td><td>13.9</td><td>3.7</td><td>11.3</td></tr><tr><td>SEED-LLaMA-I</td><td>14B</td><td>✓</td><td>126.9</td><td>63.4</td><td>43.2</td><td>49.4</td><td>53.7</td><td>45.2</td><td>35.3</td><td>24.7</td></tr></table>
 Figure 6: Qualitative examples of multi-turn in-context image and text generation by SEED-LLaMA given multimodal instructions.

# 4.1 SEED-LLAMA
# 4.1.1 QUANTITATIVE EVALUATION
Multimodal Comprehension. We evaluate SEED-LLaMA on a wide range of multimodal comprehension tasks including image captioning and image/video question answering. Details of these



 Figure 7: Qualitative examples of compositional image generation by SEED-LLaMA.
benchmarks and evaluation metrics are provided in Appendix. D. As shown in Tab. 2, our SEED-LLaMA achieves competitive performance in both the image and video understanding tasks compared with MLLMs that use continuous visual representations. The results demonstrate that our SEED tokenizer can generate discrete visual codes with high-level semantics, which facilities the visual comprehension. We can observe that pretraining from a LLM with larger model size improves performance on SEED-Bench and instruction tuning further contributes to enhanced results. Note that as pointed out by recent work (Liu et al., 2023c; Li et al., 2023b), previous VQA benchmarks listed in Tab. 2 are not tailored for evaluating MLLMs with open-from output, since they require an exact match between the model prediction and the target word or phrase. The qualitative examples of multimodal comprehension is provided in Appendix. F.
Text-to-image Generation. We evaluate the text-to-image generation on MS-COCO (Chen et al., 2015) and Flickr30K (Young et al., 2014) and compute the pair-wise CLIP similarity score as the evaluation metric following GILL (Koh et al., 2023b). As shown in Tab. 10, images generated by our SEED-LLaMA from textual descriptions show higher similarity with the ground-truth images. The results demonstrate that SEED-LLaMA generates images that are highly correlated with text prompts via a frozen SD-Unet. We show qualitative examples of text-to-image generation in Appendix. F.
# 4.1.2 EMERGENT ABILITY
Multi-turn In-context Multimodal Generation. As shown in Fig. 1 and Fig. 6, given multimodal instructions including images and open-form texts from a user, our SEED-LLaMA can respond with synthesized image (e.g., a dog in front of the Golden Gate Bridge), sequentially generated images (e.g., a cartoon cat in different scenes), instruction-followed image (e.g., a closer look-up of a cherry
blossom), various forms of texts via creation and real-world knowledge (e.g., a story, a poem and flower identification). The results illustrate the impressive capability of SEED-LLaMA in reasoning and generating long-context multimodal content.
Compositional Image Generation. As shown in Fig. 7, our SEED-LLaMA can realize a variety of zero-shot compositional image generation as below,
- Stylized Image Generation. SEED-LLaMA can take a text prompt and a style reference image as inputs and produce an output image that adheres to both the style and text prompt. - Image Blending. SEED-LLaMA can take two images as inputs and generate an image that blends the visual components of the input images. - Multimodal Composition. SEED-LLaMA can take an image prompt and a text prompt as inputs and generate a composite image that combines the multimodal inputs. - In-context Generation. SEED-LLaMA can take images, their textual references, and text prompts as inputs and generate context-related images.
# 4.2 ABLATION STUDY
Generation Embedding. The generation embedding of SEED is aligned with the image embedding of unCLIP-SD, and can be decoded to realistic images with the unCLIP-SD-UNet. We also train a visual tokenizer $\mathrm{SEED}^{\mathrm{text}}$ through aligning the generation embeddings with the text embeddings (77 tokens) of SD (Rombach et al., 2022) conditioned on texts. As shown in Tab. 10, the similarity between the reconstructed images of $\mathrm{SEED}^{\mathrm{text}}$ and original images drop heavily. The semantic representations of texts can not fully preserve the rich visual information of images. The visual comparison of the reconstructed images between $\mathrm{SEED}^{\mathrm{text}}$ and SEED are provided in Appendix. A.
Causal Visual Codes vs. Bilateral Visual Codes. We train a Causal Q-Former to convert 2D features produced by the ViT encoder into a sequence of causal semantic embeddings, which are further discretized as causal visual codes. To verify whether the causal visual codes are necessary for compatibility with LLM, we train a visual tokenizer $\mathrm{SEED^{Bi}}$ , which produces bilateral visual codes from a pre-trained Q-Former with bilateral self-attention. We then pre-train $\mathrm{SEED^{Bi}}$ -LLM* and $\mathrm{SEED-LLM}^*$ on image-text pairs and evaluate the text-to-image generation on COCO test set. Given 5000 captions of COCO, $\mathrm{SEED^{Bi}}$ -LLM only generates 2134 images successfully while SEED-LLM* generates 4997 images (Failure cases occur when the model predicts a number of visual tokens not equal to 32). The results demonstrate that the non-causal codes lead to highly unstable model performance since they contradict with the left-to-right autoregressive mechanism of LLM.
SEED-LLaMA Pretraining. We first train SEED-LLaMA using LoRA tuning, and then merge the parameters of LoRA with the original LLM and fine-tune all parameters except for the embedding layer.
To explore whether fully fine-tuning helps, we evaluate the performance of the model before and after fully fine-tuning on image captioning and text-to-image generation, with evaluation metric CIDEr and clip similarity score. Tab. 3 shows that fully fine-tuning the LoRA tuned model enhances model's capability for both image comprehension and generation.
Table 3: Evaluation of image captioning and text-to-image generation on COCO test set.
<table><tr><td>Pretraining</td><td>Captioning</td><td>Generation</td></tr><tr><td>LoRA</td><td>124.5</td><td>68.87</td></tr><tr><td>LoRA + Fully</td><td>125.0</td><td>69.07</td></tr></table>
# 5 CONCLUSION
We present SEED, a discrete image tokenizer, designed based on the premise that visual tokens compatible with LLMs should capture high-level semantics while being generated with 1D causal dependency. SEED enables LLMs to be trained with multimodal data following the original recipe of text (i.e., next-word prediction), which is mature and scalable. We further present SEED-LLaMA via multimodal pretraining and instruction tuning on the interleaved visual and textual data with SEED tokenizer. SEED-LLaMA not only exhibits remarkable performance across multimodal comprehension and image generation tasks, but also demonstrates extensive compositional emergent abilities. We hope that SEED would draw increased attention to visual tokenizers. A more rational visual tokenizer could substantially reduce the complexity of multimodal LLM training.
# REFERENCES
Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716-23736, 2022. Max Bain, Arsha Nagrani, Gül Varol, and Andrew Zisserman. Frozen in time: A joint video and image encoder for end-to-end retrieval. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1728-1738, 2021. Tim Brooks, Aleksander Holynski, and Alexei A Efros. Instructpix2pix: Learning to follow image editing instructions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18392-18402, 2023. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877-1901, 2020. Fabian Caba Heilbron, Victor Escorcia, Bernard Ghanem, and Juan Carlos Niebles. Activitynet: A large-scale video benchmark for human activity understanding. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 961-970, 2015. David Chen and William B Dolan. Collecting highly parallel data for paraphrase evaluation. In Proceedings of the 49th annual meeting of the association for computational linguistics: human language technologies, pp. 190-200, 2011. Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dólár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015. Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. Schuhmann Christoph, Köpf Andreas, Vencu Richard, Coombes Theo, and Beaumont Romain. Laion coco: 600m synthetic captions from laion2b-en. [EB/OL], 2022. https://laion.ai/blog/laion-coco/. Ming Ding, Zhuoyi Yang, Wenyi Hong, Wendi Zheng, Chang Zhou, Da Yin, Junyang Lin, Xu Zou, Zhou Shao, Hongxia Yang, et al. Cogview: Mastering text-to-image generation via transformers. Advances in Neural Information Processing Systems, 34:19822-19835, 2021. Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Thompson, Quan Vuong, Tianhe Yu, et al. Palm-e: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023. Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 12873-12883, 2021. Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv Taigman. Make-a-scene: Scene-based text-to-image generation with human priors. In European Conference on Computer Vision, pp. 89-106. Springer, 2022. Peng Gao, Jiaming Han, Renrui Zhang, Ziyi Lin, Shijie Geng, Aojun Zhou, Wei Zhang, Pan Lu, Conghui He, Xiangyu Yue, et al. Llama-adapter v2: Parameter-efficient visual instruction model. arXiv preprint arXiv:2304.15010, 2023.
Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6904-6913, 2017. Yuchao Gu, Xintao Wang, Yixiao Ge, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. Rethinking the objectives of vector-quantized tokenizers for image synthesis. arXiv preprint arXiv:2212.03185, 2022. Danna Gurari, Qing Li, Abigale J Stangl, Anhong Guo, Chi Lin, Kristen Grauman, Jiebo Luo, and Jeffrey P Bigham. Vizwiz grand challenge: Answering visual questions from blind people. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3608-3617, 2018. Yaru Hao, Haoyu Song, Li Dong, Shaohan Huang, Zewen Chi, Wenhui Wang, Shuming Ma, and Furu Wei. Language models are general-purpose interfaces. arXiv preprint arXiv:2206.06336, 2022. Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021. Shaohan Huang, Li Dong, Wenhui Wang, Yaru Hao, Saksham Singhal, Shuming Ma, Tengchao Lv, Lei Cui, Owais Khan Mohammed, Qiang Liu, et al. Language is not all you need: Aligning perception with language models. arXiv preprint arXiv:2302.14045, 2023. Ting-Hao Huang, Francis Ferraro, Nasrin Mostafazadeh, Ishan Misra, Aishwarya Agrawal, Jacob Devlin, Ross Girshick, Xiaodong He, Pushmeet Kohli, Dhruv Batra, et al. Visual storytelling. In Proceedings of the 2016 conference of the North American chapter of the association for computational linguistics: Human language technologies, pp. 1233-1239, 2016. Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6700-6709, 2019. Jing Yu Koh, Daniel Fried, and Ruslan Salakhutdinov. Generating images with multimodal language models. arXiv preprint arXiv:2305.17216, 2023a. Jing Yu Koh, Daniel Fried, and Ruslan Salakhutdinov. Generating images with multimodal language models. arXiv preprint arXiv:2305.17216, 2023b. Hugo Laurencon, Lucile Saulnier, Léo Tronchon, Stas Bekman, Amanpreet Singh, Anton Lozhkov, Thomas Wang, Siddharth Karamcheti, Alexander M. Rush, Douwe Kiela, Matthieu Cord, and Victor Sanh. Obelics: An open web-scale filtered dataset of interleaved image-text documents, 2023. Bo Li, Yuanhan Zhang, Liangyu Chen, Jinghao Wang, Fanyi Pu, Jingkang Yang, Chunyuan Li, and Ziwei Liu. Mimic-it: Multi-modal in-context instruction tuning. arXiv preprint arXiv:2306.05425, 2023a. Bohao Li, Rui Wang, Guangzhi Wang, Yuying Ge, Yixiao Ge, and Ying Shan. Seed-bench: Benchmarking multimodal llms with generative comprehension. arXiv preprint arXiv:2307.16125, 2023b. Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pretraining for unified vision-language understanding and generation. In International Conference on Machine Learning, pp. 12888-12900. PMLR, 2022. Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pretraining with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023c.
Yu Lili, Shi Bowen, Pasunuru Ram, Miller Benjamin, Golovneva Olga, Wang Tianlu, Babu Arun, Tang Binh, Karrer Brian, Sheynin Shelly, Ross Candace, Polyak Adam, Howes Russ, Sharma Vasu, Xu Jacob, Singer Uriel, Li (AI) Daniel, Ghosh Gargi, Taigman Yaniv, Fazel-Zarandi Maryam, Celikyilmaz Asli, Zettlemoyer Luke, and Aghajanyan Armen. Scaling autoregressive multi-modal models: Pretraining and instruction tuning. 2023. Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision-ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pp. 740-755. Springer, 2014. Fangyu Liu, Guy Emerson, and Nigel Collier. Visual spatial reasoning. Transactions of the Association for Computational Linguistics, 11:635-651, 2023a. Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023b. Yuan Liu, Haodong Duan, Yuanhan Zhang, Bo Li, Songyang Zhang, Wangbo Zhao, Yike Yuan, Jiaqi Wang, Conghui He, Ziwei Liu, et al. Mmbench: Is your multi-modal model an all-around player? arXiv preprint arXiv:2307.06281, 2023c. Ali Zahid Luke Chesser, Timothy Carbone. Unsplash. https://github.com/unsplash/datasets, 2023. Muhammad Maaz, Hanoona Rasheed, Salman Khan, and Fahad Shahbaz Khan. Video-chatgpt: Towards detailed video understanding via large vision and language models. arXiv preprint arXiv:2306.05424, 2023. Kenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. Ok-vqa: A visual question answering benchmark requiring external knowledge. In Proceedings of the IEEE/cvf conference on computer vision and pattern recognition, pp. 3195-3204, 2019. Anand Mishra, Shashank Shekhar, Ajeet Kumar Singh, and Anirban Chakraborty. Ocr-vqa: Visual question answering by reading text in images. In 2019 international conference on document analysis and recognition (ICDAR), pp. 947-952. IEEE, 2019. Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. Junting Pan, Keqiang Sun, Yuying Ge, Hao Li, Haodong Duan, Xiaoshi Wu, Renrui Zhang, Aojun Zhou, Zipeng Qin, Yi Wang, et al. Journeydb: A benchmark for generative image understanding. arXiv preprint arXiv:2307.00716, 2023. Zhiliang Peng, Li Dong, Hangbo Bao, Qixiang Ye, and Furu Wei. Beit v2: Masked image modeling with vector-quantized visual tokenizers. arXiv preprint arXiv:2208.06366, 2022. Zhiliang Peng, Wenhui Wang, Li Dong, Yaru Hao, Shaohan Huang, Shuming Ma, and Furu Wei. Kosmos-2: Grounding multimodal large language models to the world. arXiv preprint arXiv:2306.14824, 2023. Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pp. 8821-8831. PMLR, 2021. Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 1(2):3, 2022. Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10684-10695, 2022. Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In Medical Image Computing and Computer-Assisted Intervention-MICCAI 2015: 18th International Conference, Munich, Germany, October 5-9, 2015, Proceedings, Part III 18, pp. 234-241. Springer, 2015.
Teven Le Scao, Angela Fan, Christopher Akiki, Ellie Pavlick, Suzana Ilic, Daniel Hesslow, Roman Castagné, Alexandra Sasha Luccioni, François Yvon, Matthias Galle, et al. Bloom: A 176b-parameter open-access multilingual language model. arXiv preprint arXiv:2211.05100, 2022. Dustin Schwenk, Apoorv Khandelwal, Christopher Clark, Kenneth Marino, and Roozbeh Mottaghi. A-okvqa: A benchmark for visual question answering using world knowledge. In European Conference on Computer Vision, pp. 146-162. Springer, 2022. Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Socratic. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556-2565, 2018. Oleksii Sidorov, Ronghang Hu, Marcus Rohrbach, and Amanpreet Singh. Textcaps: a dataset for image captioning with reading comprehension. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part II 16, pp. 742-758. Springer, 2020. Amanpreet Singh, Vivek Natarajan, Meet Shah, Yu Jiang, Xinlei Chen, Dhruv Batra, Devi Parikh, and Marcus Rohrbach. Towards vqa models that can read. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8317-8326, 2019. Quan Sun, Yuxin Fang, Ledell Wu, Xinlong Wang, and Yue Cao. Eva-clip: Improved training techniques for clip at scale. arXiv preprint arXiv:2303.15389, 2023a. Quan Sun, Qiying Yu, Yufeng Cui, Fan Zhang, Xiaosong Zhang, Yueze Wang, Hongcheng Gao, Jingjing Liu, Tiejun Huang, and Xinlong Wang. Generative pretraining in multimodality. arXiv preprint arXiv:2307.05222, 2023b. Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in neural information processing systems, 30, 2017. Zijie J Wang, Evan Montoya, David Munechika, Haoyang Yang, Benjamin Hoover, and Duen Horng Chau. Diffusiondb: A large-scale prompt gallery dataset for text-to-image generative models. arXiv preprint arXiv:2210.14896, 2022. Shengqiong Wu, Hao Fei, Leigang Qu, Wei Ji, and Tat-Seng Chua. Next-gpt: Any-to-any multimodal llm. arXiv preprint arXiv:2309.05519, 2023. Junbin Xiao, Xindi Shang, Angela Yao, and Tat-Seng Chua. Next-qa: Next phase of question-answering to explaining temporal actions. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9777-9786, 2021. Jun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5288-5296, 2016. Antoine Yang, Antoine Miech, Josef Sivic, Ivan Laptev, and Cordelia Schmid. Just ask: Learning to answer questions from millions of narrated videos. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 1686-1697, 2021. Qinghao Ye, Haiyang Xu, Guohai Xu, Jiabo Ye, Ming Yan, Yiyang Zhou, Junyang Wang, Anwen Hu, Pengcheng Shi, Yaya Shi, et al. mplug-owl: Modularization empowers large language models with multimodality. arXiv preprint arXiv:2304.14178, 2023. Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. Transactions of the Association for Computational Linguistics, 2:67-78, 2014.
Aohan Zeng, Xiao Liu, Zhengxiao Du, Zihan Wang, Hanyu Lai, Ming Ding, Zhuoyi Yang, Yifan Xu, Wendi Zheng, Xiao Xia, et al. Glm-130b: An open bilingual pre-trained model. arXiv preprint arXiv:2210.02414, 2022. Kai Zhang, Lingbo Mo, Wenhu Chen, Huan Sun, and Yu Su. Magicbrush: A manually annotated dataset for instruction-guided image editing. arXiv preprint arXiv:2306.10012, 2023a. Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023b. Yanzhe Zhang, Ruiyi Zhang, Jiuxiang Gu, Yufan Zhou, Nedim Lipka, Diyi Yang, and Tong Sun. Llavar: Enhanced visual instruction tuning for text-rich image understanding. arXiv preprint arXiv:2306.17107, 2023c. Bo Zhao, Boya Wu, and Tiejun Huang. Svit: Scaling up visual instruction tuning. arXiv preprint arXiv:2307.04087, 2023. Deyao Zhu, Jun Chen, Xiaogian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023a. Wanrong Zhu, Jack Hessel, Anas Awadalla, Samir Yitzhak Gadre, Jesse Dodge, Alex Fang, Youngjae Yu, Ludwig Schmidt, William Yang Wang, and Yejin Choi. Multimodal c4: An open, billion-scale corpus of images interleaved with text. arXiv preprint arXiv:2304.06939, 2023b.
 (a)





 (b)





 (c)
 Figure 8: (a) Input image. (b) Reconstruction images of SEED $^{\text{text}}$ tokenizer, which is aligned with the feature space of a SD conditioned on text embeddings. (c) Reconstruction images of SEED tokenizer, which is aligned with the feature space of a SD conditioned on image embedding.




# A SEEDTOKENIZER
The generation embedding of SEED is aligned with the image embedding of unCLIP (Ramesh et al., 2022) SD, and can be decoded to realistic images with the unCLIP-SD-UNet. We also train a visual tokenizer $\mathrm{SEED}^{\mathrm{text}}$ through aligning the generation embeddings with the text embeddings (77 tokens) of SD (Rombach et al., 2022), and the generation embeddings can be decoded to images with the SD-UNet. The visual comparison of the reconstructed images between $\mathrm{SEED}^{\mathrm{text}}$ and SEED are shown in Fig. 8. We can observe that compared with $\mathrm{SEED}^{\mathrm{text}}$ , the images reconstructed by SEED can better preserve the visual information of the original images.
# B PRETRAINING
# B.1 PRETRAINING DATA
As shown in Tab. 4, we utilize diverse categories of datasets as pretraining data, which can be summarized as follows.
Image-text Pairs. We use the image-text pairs from CC3M (Sharma et al., 2018), Unsplash (Luke Chesser, 2023), LAION-COCO (Christoph et al., 2022) and MS-COCO (Chen et al., 2015). We filtered the samples in these datasets based on image resolution, aspect ratio, and visual-textual similarity. We randomly place images or text at the forefront, in order to achieve the generation of captions based on images and vice versa.
Video-text Pairs. We use a large-scale dataset WebVid-10M (Bain et al., 2021) containing videos and captions. We implemented heuristic rules to exclude extraneous metadata, such as the resolution of the original video and camera parameters. We sample four frames of each video for training. Each frame is discretized into 32 codes. The input sequence of a video is <IMG> the token of frame 1 </IMG> <IMG> the token of frame 2 </IMG> <IMG> the token of frame 3 </IMG> <IMG> the token of frame 4 </IMG>.
Interleaved Image and Text. We use publicly available MMC4 (Zhu et al., 2023b) and OBELISC (Laurençon et al., 2023) datasets, which were extracted and thoroughly filtered from Common Crawl. Specifically, we employ the MMC4-core split, consisting of 7.3 million samples, and the complete OBELISC dataset, containing 141 million samples. For documents in MMC4, we create a sequence of length 1024 and randomly shuffle the order of images and their corresponding texts (those with the
Table 4: Description of pretraining datasets of SEED-LLaMA.
<table><tr><td>Dataset Name</td><td>Dataset Description</td></tr><tr><td>COCO Caption (Chen et al., 2015)</td><td>0.5M image-text pairs with human-written captions. Specifically, Karpathy train split is used.</td></tr><tr><td>CC3M (Sharma et al., 2018)</td><td>3.3M image-text pairs from the web.</td></tr><tr><td>Unsplash (Luke Chesser, 2023)</td><td>4.8M image-text pairs, in which images are composed of high-quality Unsplash photos.</td></tr><tr><td>LAION-COCO (Christoph et al., 2022)</td><td>600M image-text pairs, where the caption is generated by the BLIP (Li et al., 2022).</td></tr><tr><td>MMC4 (Zhu et al., 2023b)</td><td>101M image-interleaved documents collected from Common Crawl. We use themmc4-core split which is consist of 7.3M documents. We randomly shuffle the order of images and their corresponding text (those with the highest CLIP score).</td></tr><tr><td>OBELISC (Laurençon et al., 2023)</td><td>141M image-interleaved documents collected from Common Crawl.</td></tr><tr><td>WebVid (Bain et al., 2021)</td><td>8M video-text pairs, we have implemented heuristic rules to exclude extraneous metadata,such as the resolution of the original video and camera parameters.</td></tr></table>
Table 5: Summary of pretraining hyperparameters of SEED-LLaMA.
<table><tr><td>Configuration</td><td>SEED 8B</td><td>SEED 14B</td></tr><tr><td>Vision encoder</td><td colspan="2">EVA-CLIP</td></tr><tr><td>LLM</td><td>Vicuna-7B</td><td>LLaMA2-Chat-13B</td></tr><tr><td>Training Strategy</td><td colspan="2">LoRA + Fully fine-tuning</td></tr><tr><td>Peak learning rate</td><td colspan="2">1.5e-4</td></tr><tr><td>Warmup ratio</td><td colspan="2">0.03</td></tr><tr><td>LR schedule</td><td colspan="2">Cosine decay</td></tr><tr><td>Optimizer</td><td colspan="2">AdamW</td></tr><tr><td>Optimizer hyper-parameters</td><td colspan="2">β1,β2, ε = 0.9, 0.98, le-6</td></tr><tr><td>Image resolution</td><td colspan="2">224 × 224</td></tr><tr><td>Weight decay</td><td colspan="2">0.05</td></tr><tr><td>Iterations</td><td colspan="2">30k + 10k</td></tr><tr><td>Data</td><td colspan="2">(MS-COCO, CC3M, Unsplash), LAION-COCO, OBELISC, MMC4, WebVid</td></tr><tr><td>Sequence length per dataset</td><td colspan="2">160, 128, 1024, 1024, 200</td></tr><tr><td>Batch size per dataset</td><td>146, 180, 26, 26, 116</td><td>46, 56, 8, 8, 36</td></tr><tr><td>Sample ratio per dataset</td><td colspan="2">4.5%, 54.5%, 9.1%, 27.3%, 4.5%</td></tr></table>
highest CLIP score). As for OBELISC, we generate a sequence of length 1024 based on the order of data in the dataset.
# B.2 PRETRAINING HYPERPARAMETERS
We report the detailed pretraining hyperparameters of SEED-LLaMA in Tab. 5.
# C INSTRUCTION TUNING
We summarize the datasets and their prompts for supervised instruction tuning of SEED-LLaMA in Tab. 6 and Tab. 7. Note that MagicBrush (Zhang et al., 2023a) contains both the single-turn and multi-turn scenarios, and we only use the single-turn for multimodal prompt image generation.
# D EVALUATION
# D.1 BENCHMARKS
In order to assess the multimodal comprehension and image generation ability of SEED-LLaMA, we evaluate SEED-LLaMA on 10 benchmarks as shown in Tab. 8. For the evaluation of image generation, we adopt the CLIP-ViT-L/14 to calculate the CLIP score between the ground-truth image and the generated image. When evaluating SEED-Bench, we adhere to the official guidelines, selecting the option with the highest log likelihood as the response for each multi-choice question (MCQ). For the evaluation on video tasks, we uniformly sample 4 frames for MSVDQA and MSRVTTQA, and 8 frames for NExTQA. For the other tasks, we follow the evaluation procedures in prior works (Li et al., 2023c; Sun et al., 2023b) and either submit the results to the official server (VQAv2, VizWiz) or assess them using the official code ourselves.
# D.2 PROMPTTEMPLATES
We summarize the prompt templates used for evaluating SEED-LLaMA in Tab. 9. As the pre-trained SEED-LLaMA with size of 8B and 14B adopt different LLM (Vicuna-7B and Llama2-chat-13B), their prompts differ accordingly.
# D.3 EVALUATION OF IMAGE RECONSTRUCTION
We further evaluate image reconstruction on COCO and Flickr30K dataset. SEED first discretizes input images into causal codes (32 tokens) and obtain generation embedding (1 token), which are fed into the unCLIP-SD-UNet for reconstruction. We follow GILL (Koh et al., 2023a) to compute the CLIP similarity score as the metric to evaluate the semantic consistency. As shown in Tab. 10, compared with the upper bound unCLIP-SD, SEED only slightly drops performance.
# E QUALITATIVE COMPARISON
For the qualitative comparison of multi-turn in-context image and text generation, as shown in Fig. 9, we can observe that our SEED-LLaMA exhibits exceptional emergent ability in generating long-context multimodal content, while Emu Sun et al. (2023b) and Next-GPT Wu et al. (2023) that employ continuous representations to unify comprehension and generation within a LLM show less competitive performance. They generate images with incorrect semantics or context, or can not follow instruction accurately in a multi-turn dialogue.
# F QUALITATIVE CASES
More examples of multi-turn in-context multimodal generation and compositional image generation are shown in Fig. 10 and Fig. 11. Note that generating images with multimodal prompt is not an emergent ability since SEED-LLaMA is fine-tuned on corresponding paired data such as InstructPix2Pix (Brooks et al., 2023). We showcase qualitative examples of text-to-image generation by SEED-LLaMA in Fig. 12. Given various textual descriptions, our SEED-LLaMA can generate realistic images that aligns with the text prompts. We further provide qualitative examples of multimodal comprehension by SEED-LLaMA in Fig. 13, Fig. 14 and Fig. 15. SEED-LLaMA can realize in-context multi-image understanding, real-world knowledge grounding, complex reasoning, story creation and video understanding.
Table 6: Description of datasets in the instruction tuning of SEED-LLaMA.
<table><tr><td>Task</td><td>Dataset Name</td><td>Dataset Description</td><td>Type</td></tr><tr><td rowspan="4">Text-to-Image Generation</td><td>JourneyDB (Pan et al., 2023)</td><td>It contains 4429K Midjourney images, with text prompt, image caption, and QA pairs.</td><td>Single-turn</td></tr><tr><td>DiffusionDB (Wang et al., 2022)</td><td>It contains 14 million images generated by Stable Diffusion using prompts by real users.</td><td>Single-turn</td></tr><tr><td>LAION-Aesthetics</td><td>It contains several collections of subsets from LAION 5B with high visual quality.</td><td>Single-turn</td></tr><tr><td>VIST (Huang et al., 2016)</td><td>It contains photos in 20K sequences, aligned to both caption and story language.</td><td>Multi-turn</td></tr><tr><td rowspan="2">Multimodal Prompt Image Generation</td><td>Instructpix2pix (Brooks et al., 2023)</td><td>It contains text editing instructions and the corresponding images, with 454K samples.</td><td>Single-turn</td></tr><tr><td>MagicBrush (Zhang et al., 2023a)</td><td>It contains 10K manually annotated triplets (source image, instruction, target image).</td><td>Single-turn</td></tr><tr><td rowspan="3">Image Conversation</td><td>LLaVA (Liu et al., 2023b)</td><td>We use 58K multi-turn conversations between an assistant and a person.</td><td>Multi-turn</td></tr><tr><td>SVIT (Zhao et al., 2023)</td><td>It contains conversations, complex reasoning, referring QA and detailed image description.</td><td>Multi-turn</td></tr><tr><td>LLaVAR (Zhang et al., 2023c)</td><td>It contains 16K multi-turn conversations, each with QA pairs for text-rich images.</td><td>Multi-turn</td></tr><tr><td>Multi-Image Understanding</td><td>GSD (Li et al., 2023a)</td><td>It contains 141K pairs of images with text describing the differences.</td><td>Single-turn</td></tr><tr><td rowspan="3">Image Captioning</td><td>VSR (Liu et al., 2023a)</td><td>It contains texts describing the spatial relations in the image, with 7K training samples.</td><td>Single-turn</td></tr><tr><td>COCO Caption (Chen et al., 2015)</td><td>It contains image-text pairs with human-written captions, with 82K training samples.</td><td>Single-turn</td></tr><tr><td>TextCaps (Sidorov et al., 2020)</td><td>It requires the model to comprehend and reason the text in images, with 21K training samples.</td><td>Single-turn</td></tr><tr><td rowspan="7">Image QA</td><td>VQAv2 (Goyal et al., 2017)</td><td>A dataset for open-ended image question answering, with 82K training samples.</td><td>Single-turn</td></tr><tr><td>OKVQA (Marino et al., 2019)</td><td>It contains questions that require outside knowledge to answer, with 9K training samples.</td><td>Single-turn</td></tr><tr><td>A-OKVQA (Schwenk et al., 2022)</td><td>It is a successor of OKVQA containing more challenging questions, with 17K training samples.</td><td>Single-turn</td></tr><tr><td>GQA (Hudson & Manning, 2019)</td><td>It contains questions for image understanding and reasoning, with 30K training samples.</td><td>Single-turn</td></tr><tr><td>VizWiz (Gurari et al., 2018)</td><td>It contains visual questions asked by people who are blind, with 20K training samples.</td><td>Single-turn</td></tr><tr><td>TextVQA (Singh et al., 2019)</td><td>It contains questions that require models to read text in the image, with 800K training samples.</td><td>Single-turn</td></tr><tr><td>OCR-VQA (Mishra et al., 2019)</td><td>It contains questions that requires reasoning about text to answer, with 173K training samples.</td><td>Single-turn</td></tr><tr><td>Video Conversation</td><td>Video-ChatGPT (Maaz et al., 2023)</td><td>It contains of 100K video-instruction pairs via manual and semi-automated pipeline.</td><td>Single-turn</td></tr><tr><td rowspan="5">Video QA</td><td>ActivityNet (Caba Heilbron et al., 2015)</td><td>It contains 200 different types of activities from YouTube, with 10K training videos.</td><td>Single-turn</td></tr><tr><td>Next-QA (Xiao et al., 2021)</td><td>It contains 52K QA pairs of videos grouped into causal, temporal and descriptive questions.</td><td>Single-turn</td></tr><tr><td>MSVD (Chen & Dolan, 2011)</td><td>It contains videos from YouTube with descriptions, containing 1.2K training samples.</td><td>Single-turn</td></tr><tr><td>MSR-VTT (Xu et al., 2016)</td><td>It contains videos from YouTube with descriptions, containing 19K training samples.</td><td>Single-turn</td></tr><tr><td>iVQA (Yang et al., 2021)</td><td>It is a video QA dataset with mitigated language biases, containing 6K training samples.</td><td>Single-turn</td></tr></table>
Table 7: Details of prompt templates used in supervised instruction tuning of SEED-LLaMA.
<table><tr><td>Type</td><td>Prompt</td></tr><tr><td>Text-to-Image Generation</td><td>USER: {caption} Please generation an image.\nASSISTANT: {image}</td></tr><tr><td>Multimodal Prompt</td><td>USER: {image1} {instruction} Please generation an image.</td></tr><tr><td>Image Generation</td><td>\nASSISTANT: {image2}</td></tr><tr><td>Image Conversation</td><td>USER: {image} {question}\nASSISTANT: {answer}</td></tr><tr><td>Multi-Image</td><td>USER: This is the first image. {image1} This is the second image.</td></tr><tr><td>Understanding</td><td>{image2} {question}\nASSISTANT: {answer}</td></tr><tr><td>Image Captioning</td><td>USER: {image} Please provide an accurate and concisedescription of the given image.\nASSISTANT: {caption}</td></tr><tr><td>Image QA</td><td>USER: {image} {question} Please provide an accurate answer consisting of only one word or phrase.\nASSISTANT: {answer}</td></tr><tr><td>Video Conversation</td><td>USER: {video} {question}\nASSISTANT: {answer}</td></tr><tr><td>Video QA</td><td>USER: {video} {question} Please provide an accurate answer consisting of only one word or phrase.\nASSISTANT: {answer}</td></tr></table>
 It looks great! Can you make Lucky wear sunglasses?

 Wrong semantics: No Golden Gate Bridge.
 Wrong semantics: No Lucky (the dog)

 Capable of context retention given the similar dog and its grass background. But show that it is not a source of sponges, there are no sunglasses.
 The model correctly generates sunglasses, but the model is not intended, given the wrong object and background.
 I love this painting. Can you create a story about Lucky's adventure for this painting?
 Not an oil painting style. X
 Not an oil painting style, and lack of context consistency. Next-GPT Once upon a time, there was a dog named Lucky. Lucky was a curious and adventurous dog, always eager to explore new places and meet new people. One day, Lucky's owner took him on a trip to the nearby town of New York, playing in the sand and chasing after seagulls. As he ran, he noticed a group of people sitting on a bench, watching him play. Lucky decided to approach them and introduce himself. The people were fascinated by Lucky's friendly demeanor and his warm and warm attitude. Lucky was grateful for the opportunity to make new friends and he knew that he would always have a special place in their hearts.
 Lucky looks cool in this image. Can you turn it into an oil painting? Figure 9: Comparison of multi-turn in-context image and text generation between SEED-LLaMA and MLLMs that unify comprehension and generation.
 Can you create a story about Lucky's adventure for this painting? Can you create a story about Lucky's adventure for this painting? Can you create a story about Lucky's adventure for this painting? Can you create a story about Lucky's adventure for this painting? Can you create a story about Lucky's Wrong context



 Figure 10: Qualitative examples of multi-turn in-context image and text generation by SEED-LLaMA given multimodal instructions.


 Figure 11: Qualitative examples of compositional image generation by SEED-LLaMA.
 A cybernatic locomotive on rainy day.
 A cat reading a book in the forest.
 A black shepherd wearing a red beret.
 A dog wearing a bike. Cyberpunk cityscape with towering skyscrapers, neon signs, and flying cars.
 Renaissance-style portrait of an astronaut in space, detailed starry background, reflective helmet.
 Food photo of a gourmet meal, with a shallow depth of field, elegant plating, and soft lighting.
 Aerial photography of a winding river through autumn forests, with vibrant red and orange foliage. Portrait of young nordic girl, age 25, freckled skin, neck tattoo, blue eyes $35\mathrm{mm}$ lens, photography, ultra details.

 A cybernetic soldier, enhanced with advanced weapons systems and tactical analysis software, on a mission.
 a couple on a beach, walking hand-in-hand, with the sun setting over the horizon and waves crashing at their feet.

 A captivating scene of a seed cracking open and sprouting under sunlight. Kingfisher bird, by Akihito Yoshida, Cool Color Palette.
 Two flamingos are in love in a sunset, concept art. high quality. Figure 12: Qualitative examples of text-to-image generation by SEED-LLaMA.
 A cozy and inviting library filled with books and reading nooks.
 A soaring hot air balloon floating over a scenic landscape.




 Figure 13: Qualitative examples of multimodal comprehension by SEED-LLaMA.


 Figure 14: Qualitative examples of multimodal comprehension by SEED-LLaMA.




 Figure 15: Qualitative examples of multimodal comprehension by SEED-LLaMA.
Table 8: Summary of the evaluation benchmarks.
<table><tr><td></td><td>Dataset</td><td>Task</td><td>Split</td><td>Metric</td></tr><tr><td rowspan="7">Image</td><td>COCO(Lin et al., 2014)</td><td>Text-to-Image Generation</td><td>Karpathy test</td><td>CLIP score (↑)</td></tr><tr><td>Flickr30K (Young et al., 2014)</td><td>Text-to-Image Generation</td><td>test</td><td>CLIP score (↑)</td></tr><tr><td>COCO Caption (Chen et al., 2015)</td><td>Scene Description</td><td>test</td><td>CIDEr (↑)</td></tr><tr><td>VQAv2 (Goyal et al., 2017)</td><td>Scene Understanding QA</td><td>test-dev</td><td>VQA acc. (↑)</td></tr><tr><td>OKVQA (Marino et al., 2019)</td><td>External Knowledge QA</td><td>val</td><td>VQA acc. (↑)</td></tr><tr><td>VizWiz (Gurari et al., 2018)</td><td>Scene Understanding QA</td><td>test-dev</td><td>VQA acc. (↑)</td></tr><tr><td>SEED-Bench (Li et al., 2023b)</td><td>Comprehensive QA</td><td>dim 1-9</td><td>MCQ acc. (↑)</td></tr><tr><td rowspan="3">Video</td><td>MSVDQA (Chen & Dolan, 2011)</td><td>Event Understanding QA</td><td>test</td><td>Top-1 acc. (↑)</td></tr><tr><td>MSRVTTQA (Xu et al., 2016)</td><td>Event Understanding QA</td><td>test</td><td>Top-1 acc. (↑)</td></tr><tr><td>NExTQA (Yang et al., 2021)</td><td>Temporal/Causal QA</td><td>test</td><td>WUPS (↑)</td></tr></table>
Table 9: Summary of the prompting template for evaluating SEED-LLaMA.
<table><tr><td>Model</td><td>Type</td><td>Template</td></tr><tr><td rowspan="3">SEED-LLaMA 8B</td><td>Image Captioning</td><td>{image}</td></tr><tr><td>Image QA</td><td>{image}\USER: {question} Please provide an accurate answer consisting of only one word or phrase.\nASSISTANT:</td></tr><tr><td>Video QA</td><td>{video}\USER: {question} Please provide an accurate answer consisting of only one word or phrase.\nASSISTANT:</td></tr><tr><td rowspan="3">SEED-LLaMA 14B</td><td>Image Caption</td><td>{image}</td></tr><tr><td>Image QA</td><td>{image} Please provide an accurate answer consisting of only one word or phrase based on the image.\nQuestion:{question} \n Answer:</td></tr><tr><td>Video QA</td><td>{video} Please provide an accurate answer consisting of only one word or phrase based on the video.\nQuestion:{question} \n Answer:</td></tr><tr><td rowspan="3">SEED-LLaMA-I 8B & 14B</td><td>Image Caption</td><td>USER: {image}\Please provide an accurate and concise description of the given image.\nASSISTANT:</td></tr><tr><td>Image QA</td><td>USER: {image}\{question} Please provide an accurate answer consisting of only one word or phrase.\nASSISTANT:</td></tr><tr><td>Video QA</td><td>USER: {video}\{question} Please provide an accurate answer consisting of only one word or phrase.\nASSISTANT:</td></tr></table>
Table 10: Evaluation of Image Generation.
<table><tr><td>Model</td><td>COCO</td><td>Flickr30K</td></tr><tr><td>Image-to-image</td><td></td><td></td></tr><tr><td>unCLIP (Ramesh et al., 2022) SD</td><td>79.30</td><td>79.55</td></tr><tr><td>SEEDtext</td><td>68.23</td><td>65.22</td></tr><tr><td>SEED</td><td>77.35</td><td>76.52</td></tr><tr><td>Text-to-image</td><td></td><td></td></tr><tr><td>GILL (Koh et al., 2023b)</td><td>67.45</td><td>65.16</td></tr><tr><td>Emu (Sun et al., 2023b)</td><td>66.46</td><td>64.82</td></tr><tr><td>SEED-LLaMA</td><td>69.07</td><td>65.54</td></tr><tr><td>SEED-LLaMA-I</td><td>70.68</td><td>66.55</td></tr></table>123version https://git-lfs.github.com/spec/v1oid sha256:a1da7eccd0358a5d47162bf7ead8b9f1c58e9ee3d81da696ae0efebbf77af55bsize 3087394123version https://git-lfs.github.com/spec/v1oid sha256:07d758cf22089d656e03359d3d033bed3dd57e8b83cfd5c9f8f07d16dac7ac4dsize 781447123version https://git-lfs.github.com/spec/v1oid sha256:4afc6fd3fe8f02c102f0da6f3bae4de5f095f8976e6b540e58bc9a8fd6ea1de9size 4145887123version https://git-lfs.github.com/spec/v1oid sha256:2431ee82cbfda9ed69a6182e3bc065f5688e3682334bb071999313239d09b668size 733113123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350# MAKING RETRIEVAL-AUGMENTED LANGUAGE MODELS ROBUST TO IRRELEVANT CONTEXT
Ori Yoran $^{1}$ Tomer Wolfson $^{1,2}$ Ori Ram $^{1}$ Jonathan Berant $^{1}$
$^{1}$ Tel Aviv University, $^{2}$ Allen Institute for AI
{ori.yoran, ori.ram,从业者}@cs.tau.ac.il tomerw@allenai.org
# ABSTRACT
Retrieval-augmented language models (RALMs) hold promise to produce language understanding systems that are factual, efficient, and up-to-date. An important desideratum of RALMs, is that retrieved information helps model performance when it is relevant, and does not harm performance when it is not. This is particularly important in multi-hop reasoning scenarios, where misuse of irrelevant evidence can lead to cascading errors. However, recent work has shown that retrieval augmentation can sometimes have a negative effect on performance. In this work, we present a thorough analysis on five open-domain question answering benchmarks, characterizing cases when retrieval reduces accuracy. We then propose two methods to mitigate this issue. First, a simple baseline that filters out retrieved passages that do not entail question-answer pairs according to a natural language inference (NLI) model. This is effective in preventing performance reduction, but at a cost of also discarding relevant passages. Thus, we propose a method for automatically generating data to fine-tune the language model to properly leverage retrieved passages, including for challenging multi-hop tasks, using a mix of relevant and irrelevant contexts at training time. We empirically show that even 1,000 examples suffice to train the model to be robust to irrelevant contexts while maintaining high performance on examples with relevant ones.
# 1 INTRODUCTION
Large Language Models (LLMs) (Brown et al., 2020; Chowdhery et al., 2022; Touvron et al., 2023) are the foundation on top of which modern language systems are built. However, open-domain question answering (ODQA; Chen et al. 2017) and other knowledge-intensive tasks (Thorne et al., 2018; Petroni et al., 2021) require vast amounts of up-to-date factual knowledge about rare entities that even very large models cannot memorize (Roberts et al., 2020; Dhingra et al., 2022). A dominant approach for combating this issue has been Retrieval Augmented Language Models (RALMs), which incorporate a retrieval mechanism to reduce the need for storing information in the LLM parameters (Guu et al., 2020; Lewis et al., 2020b; Izacard et al., 2023; Rubin & Berant, 2023). Furthermore, RALMs have also been shown to improve ODQA performance in an in-context setting (without any training), simply by preponding retrieved sentences to the input question (Ram et al., 2023). Nevertheless, retrievers are not perfect and past work has shown that noisy retrieval can negatively affect LLM performance (Petroni et al., 2020; Li et al., 2023). For example, in Fig. 1, when posed with the questions "Who is playing Jason on General Hospital?" a vanilla LLM (left) correctly answers the question while the RALM (right) is "distracted" by irrelevant context about the actor portraying Cooper, not Jason.
In this work, we analyze and improve the robustness of RALMs to noisy retrieved contexts. Our definition for retrieval-robust LLMs states that: (a) when relevant, the retrieved context should improve model performance; (b) when irrelevant, the retrieved context should not hurt model performance. To this end, we present two methods for retrieval-robustness in RALMs ( $\S 2$ ).
First, we consider a setting where we have black-box access to the LLM and cannot train it. Rather than solely relying on in-context prompting (Brown et al., 2020), we frame retrieval robustness as a natural language inference (NLI) problem (Dagan et al., 2006; Bowman et al., 2015). Namely, given a question and retrieved context, an NLI model can predict whether a question-answer pair
 Figure 1: An example from NQ where retrieval augmentation causes Llama-2-13B to err. Augmenting with irrelevant retrieved context leads to an error (right), although the model is able to answer the question without retrieval (left).
(hypothesis) is entailed by the context (premise). Building on the strong performance of recent NLI models (e.g., in detecting model hallucinations (Honovich et al., 2022) and attributed question answering (Bohnet et al., 2023)), we use such models to identify irrelevant contexts. When the context is labeled as irrelevant to the question-answer pair, we generate the answer using the LLM without retrieval as a "back-off strategy". Our results show that this natural baseline is highly effective at identifying irrelevant contexts, but is too strict and discards relevant ones as well ( $\S 4$ ).
We then propose a method for training RALMs to be retrieval-robust. Intuitively, LLMs are not trained with retrieved passages, and thus brittleness to noisy retrieval is somewhat expected. Therefore, we perform an additional finetuning step that teaches the LLM to be robust to noisy contexts. The core challenge is to generate data for finetuning, and we describe a procedure for automatically generating such data for both single-hop and multi-hop questions. In the single-hop setting, assuming access to gold QA pairs and a retriever, we create training examples using retrieved contexts, where we can use low-ranked or random passages as noisy contexts. In the multi-hop setting, training examples need to contain not only retrieved contexts, but also intermediate questions, answers and relevant contexts, which comprise the question decomposition (Fig. 3), shown to be necessary for high performance on multi-hop questions (Wolfson et al., 2020; Press et al., 2023). To generate decompositions to train on, we use a strong LLM, prompted for decomposition without any retrieval. Then, we can sample multiple decompositions, and use self-consistency (Wang et al., 2023) to identify high-quality training examples ( $\S 3.2.3$ ).
To test our methods, we evaluate retrieval robustness on five ODQA benchmarks, four of which contain multi-hop questions, where the retriever is called multiple times (Jiang et al., 2023). Fig. 2 shows that even with a strong retriever (top-1 Google search) incorporating the retrieved context actually hurts model performance on two of the benchmarks (STRATEGYQA and FERMI). Moreover, adding randomly-retrieved contexts dramatically decreases accuracy on all five datasets. Our analysis ( $\S 5$ ) shows that irrelevant context causes a wide range of errors, which include copying irrelevant answers from the retrieved sentences and hallucinating incorrect answers and decompositions.
Our results demonstrate that finetuning LLMs to be retrieval-robust enables them to ignore irrelevant context while improving their overall accuracy (§4). When using a strong retriever at test time, our finetuned models outperform both models that were finetuned without retrieval, as well as untrained models prompted using in-context learning. To test robustness to noisy context, we evaluate QA accuracy when models are given randomly-retrieved contexts. In this setting, our finetuned models perform on par with those that were finetuned without retrieval, demonstrating retrieval robustness. In addition, our ablation study shows that training models on a mixture of relevant and irrelevant contexts results in models that are much more robust to irrelevant context.
To summarize, our main contributions are:
- We conduct a thorough analysis on the robustness of RALMs to irrelevant retrieved contexts. - We show that small NLI models can be used to identify irrelevant context and improve robustness, without updating the model parameters. - We demonstrate that training LLMs when to use retrieval helps make models robust to irrelevant context and improve their overall performance, including in challenging multi-hop tasks.
 Figure 2: Accuracy for Llama-2-13B few-shot prompted on five QA tasks, in three settings: (a) without retrieval, (b) with top-1 retrieval from a strong search engine, and (c) with a randomly-retrieved passage. Retrieval augmentation can boost performance, but even strong retrieval hurts performance on StrategyQA and Fermi, and random contexts reduce performance dramatically.
# 2 MAKING RALMS ROBUST TO IRRELEVANT CONTEXTS
We now present our methods for building RALMs that are robust to irrelevant contexts. We begin by describing the common approach for incorporating evidence into RALMs. Next, we explore a natural baseline for using an NLI model to identify irrelevant contexts. Last, we describe our procedure for finetuning models to be robust to irrelevant context.
In-context RALMs Language models define a probability distribution over sequences of tokens, with auto-regressive models assigning a probability via next-token prediction: $p_{LM} = \Pi_{i=1}^{n} p_{\theta}(x_i | x_{<i})$ , where $x_{<i}$ is the sequence of tokens preceding $x_i$ at each step and $\theta$ denotes the parameters of the LM. For RALMs, we follow the definition of in-context RALMs from Ram et al. (2023), where context sentences are retrieved from a corpus $C$ , and generation is conditioned on the retrieved context. Given the retrieval operation $R_C$ , this can be formalized as $p_{\mathrm{RALM}} = \Pi_{i=1}^{n} p_{\theta}(x_i | R_C(x_{<i}); x_{<i})$ , where $[R_C(x_{<i}); x_{<i}]$ denotes the concatenation of the retrieved evidence with the generated sequence. Generation in LMs and RALMs can also be conditioned on additional input, which we omit for brevity.
In our setting, we focus on RALMs for ODQA. We follow recent approaches such as Self-Ask and IR-CoT (Press et al., 2023; Trivedi et al., 2023; Yoran et al., 2023), for interleaving retrieval with multi-hop question answering (see Fig. 3). Retrieval is performed for every intermediate question and each context is presupended to the question. In the single-hop setting, the model has to generate the answer given a question and retrieved context. In the multi-hop setting, the model has to generate intermediate questions and answers until arriving at the final answer and the retriever is called for the original question and after each intermediate question. Formally, $x$ in this case is the generated decomposition until an intermediate step and $R_{C}(x)$ are the retrieved contexts for all questions in $x$ .
# 2.1 IDENTIFYING IRRELEVANT CONTEXTS WITH NLI MODELS.
NLI models (Dagan et al., 2006; Bowman et al., 2015) classify whether a textual hypothesis is entailed, neutral, or contradicted given a textual premise. Recent work successfully used NLI models to automatically identify hallucinations (Honovich et al., 2022) and statement attribution (Bohnet et al., 2023) when presented with a context and generated text. Similarly, a natural baseline is to frame irrelevant context identification as an NLI problem, by using the retrieved context only when the hypothesis (i.e., final answer and intermediate question-answer pairs; Fig. 3) are classified as entailed by the premise (i.e., the retrieved context). We use a simple back-off strategy where we generate twice, once with $p_{LM}$ and once with $p_{RALM}$ , and only use the RALM if the NLI model classified all generated answers (and intermediate questions) as entailed by the retrieved evidence.
 Figure 3: Interleaving decomposition and retrieval in Self-Ask format (Press et al., 2023). The model generates intermediate questions and answers until generating the final answer (model generations are shown in pink). Retrieved evidence for intermediate questions is presupended at each step.
For example, in Fig. 1, the retrieved evidence "Jason Gerhardt... is an American actor... known for playing Cooper Barrett..." serves as the premise while the question and generated answer, "Q: Who is the actor playing Jason on general hospital? A: Steve Burton" are concatenated and serve as our hypothesis. As this context is irrelevant, we expect the NLI model to label the hypothesis as contradicting. Given a contradicting or neutral hypothesis, we will use the standard LLM without the (potentially distracting) retrieved context. For multi-hop questions (as in Fig. 3), we additionally verify that each intermediate-answer pair is entailed by the retrieved evidence using all retrieved evidence as our premise and the intermediate question-answer pair as the hypothesis. For example, "Q: Who is Colonel Walter Phelps? A: Colonel Walter Phelps was an officer in the Union Army throughout the American Civil War." for the first intermediate question in Fig. 3.
# 2.2 TRAINING ROBUST RALMS
As in-context RALMs are not trained to use retrieved passages, a more effective solution than post-hoc filtering (using NLI) may be to train RALMs to ignore irrelevant contexts. We are interested in testing whether training on a relatively small dataset (several hundreds of examples) would suffice.
Automatically Generating Training Data Our goal is to teach RALMs to be robust to irrelevant context in an ODQA setting. In the single-hop setting, generating training data is straightforward. Given access to a dataset of question-answer pairs $\{(q,a)\}$ (i.e., without contexts) and a retriever $R_{C}$ , we use the retriever to augment questions with retrieved context. To create training examples with relevant contexts, we return the top-1 context from $R_{C}$ , and for irrelevant contexts, we either return a low-ranked result from $R_{C}(q)$ or a random context (i.e., $R_{C}(q^{\prime})$ for another question $q^{\prime}$ ). We denote the chosen context by $r_q$ . Then, the training dataset is defined by $D = \{([r_q;q],a)\}$ .
Our main challenge is generating training examples for multi-hop questions. In these questions the model generates a decomposition, consisting of intermediate questions and answers, before arriving at the final answer, while the retriever is called multiple times (Fig. 3). Our goal is to automatically generate retrieval-augmented decomposition steps, $D = \{([r_x; x], y)\}$ , where: $y$ is the correct generation for each step (i.e., the correct intermediate question, intermediate answer, or final answer); $x$ consists of the previously generated steps up to $y$ ; $r_x$ is the retrieved contexts for all steps in $x$ . Our first step to automatically generate decompositions is to prompt a strong LLM without access to retrieval and to verify its answers. However, the LLM may arrive at the correct answer using an incorrect decomposition, for example in binary or comparison questions. Hence, we need to ensure the quality of generated decompositions. For multi-hop datasets which provide intermediate answers, we simply filter out generated decompositions that do not contain them. When intermediate answer annotations are unavailable, we sample from the LLM that generated the decomposition multiple times and verify self-consistency (Wang et al., 2023). Further details are given in §3.2.3.
<table><tr><td>Dataset</td><td>Type</td><td>Example</td></tr><tr><td>NQ</td><td>Single-hop</td><td>What episode of law and order svu is mike tyson in?</td></tr><tr><td>2WIKIMQA</td><td>Explicit</td><td>Where was the place of death of Isabella Of bourbon's father?</td></tr><tr><td>BAMBOOGLE</td><td>Explicit</td><td>What is the maximum airspeed (in km/h) of the third fastest bird?</td></tr><tr><td>STRATEGYQA</td><td>Implicit</td><td>Can Arnold Schwarzenegger deadlift an adult Black rhinoceros?</td></tr><tr><td>FERMI</td><td>Implicit</td><td>How many high fives has Lebron James given/received?</td></tr></table>
Table 1: The QA datasets in our experiments.
Training We use our automatically generated data $D$ to fine-tune models for generating $y$ conditioned on $[r_x; x]$ with standard maximum likelihood. Since we are mostly interested in the low-data regime, we limit the number of questions in $D$ to 1,000 in the single-hop setting and 500 in the multi-hop setting (splitting multi-hop questions to multiple examples for each step), and use parameter efficient fine-tuning (Dettmers et al., 2023). Thus, training all our models takes no more than a few hours. Additional experimental details are in §3 and §A.1.
# 3 EXPERIMENTAL SETTING
# 3.1 DATASETS
We experiment with both single- and multi-hop QA datasets. We list and give an example from each dataset in Tab. 1. Our QA benchmarks can be categorized based on their required reasoning skills:
- Single-hop: Information-seeking questions that do not require decomposition. We use the popular Natural Questions (NQ) dataset (Kwiatkowski et al., 2019). - Explicit Reasoning: Multi-hop questions where reasoning is explicitly expressed in the question. We include 2WIKIMQA (Welbl et al., 2018) and BAMBOOGLE (Press et al., 2023). - Implicit Reasoning: Mutli-hop questions where generating reasoning steps require commonsense (implicit reasoning, Geva et al. (2021)). Such questions may have multiple valid reasoning chains. We evaluate on STRATEGYQA (Geva et al., 2021) and FERMI (Kalyan et al., 2021).
For evaluation, we follow prior work and use EM for NQ and STRATEGYQA, and $\mathbf{F}_1$ for 2WIKIMQA and BAMBOOGLE. For FERMI, we use the official order-of-magnitude evaluation (Kalyan et al. 2021). Following prior work (Khattab et al., 2022; Trivedi et al., 2023; Yoran et al., 2023), we evaluate on 500 random examples from the development set of each dataset. We provide additional technical details on evaluation in §A.2.
# 3.2 MODELS
We next describe our retrievers (§3.2.1), prompted baselines (§3.2.2), and finetuned models (§3.2.3).
# 3.2.1 RETRIEVERS
Our models use a retriever based on Google SEARCH,² as well as the open-source COLBERTV2 (Khattab & Zaharia, 2020). Since the corpus for our datasets is Wikipedia, we format search queries as "en.wikipedia.org $q_i$ " when accessing Google SEARCH. For COLBERTV2 our corpus is the 2018 Wikipedia from Karpukhin et al. (2020). To simulate different types of noise, we return either the top-1, a low-ranked relevant evidence,³ or a random passage that is the top-1 evidence for a different question or intermediate question from the same dataset.
# 3.2.2 FEW-SHOT PROMPTED BASELINES
Our main baselines are Llama-2-13B models prompted for QA in the Self-Ask format through in-context learning (Brown et al., 2020) with 4-6 exemplars. We also evaluate with Llama-2-70B on NQ. Our baselines differ based on the retrieved contexts in the exemplars (Full prompts in §A.5):
- Self-Ask No Retrieval (SA-NR): Exemplars are gold decompositions without retrieved evidence. We use this prompt to evaluate the performance of models without retrieval, when relying solely on their parametric memory, i.e., the information encoded in the model's parameters. As an additional baseline, we use this non-retrieval prompt, but still apply retrieval during inference. - Self-Ask Retrieval@1 (SA-R@1): Exemplars are gold decompositions presupended with the most relevant evidence retrieved from GOOGLE SEARCH for each step. - Self-Ask Retrieval@10 (SA-R@10): Exemplars are gold decompositions presupended with the lowest rank passage from Google (which is rank 10 in most cases). - Self-Ask Random Retrieval (SA-RMix) Exemplars are gold decompositions presupended with either the top-1 or lowest-ranked evidence from GOOgLE SEARCH, interchangeably.
NLI-based Models We use a BART-Large model (Lewis et al., 2020a) with 407 million parameters trained on the MNLI dataset (Williams et al., 2018).<sup>4</sup> We consider a question-answer pair as entailed if the probability for the entailment label is $\geq 0.5$ . All few-shot prompted baselines have a variant with NLI, termed, SA- $*$ -NLI. When there is no entailment, we use the generation from the SA-NR model, which uses only the parametric memory as the back-off strategy.
# 3.2.3 FINE-TUNED MODELS
We finetune Llama-2-13B on 3 ODQA benchmarks, one single-hop (NQ, 1000 training examples), one explicit (2WIKIMQA, 500 questions, 1,539 examples), and one implicit (STRATEGYQA, 414 questions, 1,584 examples). Training hyperparameters are in §A.1.
Data Generation We use a LLM to verify questions are answerable and to generate decompositions. This is done with GPT-3, code-davinci-002 (Brown et al., 2020; Chen et al., 2021) with 175B parameters. We prompt the model to generate decompositions using the SA-NR prompt. 2WIKIMQA contains intermediate answers, and we use those to verify generated decompositions. For the implicit STRATEGYQA we utilize only the final answer, and thus use self-consistency, as explained in §2. We sample 5 decompositions per question (one with greedy decoding and four with temperature 0.7) and only keep the greedily-decoded decomposition when all decompositions lead to the same correct answer. To verify the quality of the generated decompositions, we manually examine 50 decompositions per dataset and find that the generated decompositions are correct in about $90\%$ of the time for STRATEGYQA and more than $95\%$ for 2WIKIMQA. As FERMI and BAMBOOGLE contain less than 300 examples, we use them exclusively for evaluation and do not include them in these experiments.
Incorporating Retrieved Evidence in Training Examples To make sure the model is exposed to relevant and irrelevant context, we use either the top-1, low-ranked, or random evidence with equal probability at each step. We term the trained model SA-RetRobust. We include ablations where training is without retrieved context (SA-NoRet) or only with the top-1 evidence (SA-Ret@1).
# 4 RESULTS
Fig. 4 presents our main results, evaluating the effect that retrieving top-1 result from Google SEARCH has on the following RALMs: (a) an In-Context RALM, prompted with the SA-RMix prompt (leftmost yellow), (b) the same model, but using NLI models to identify irrelevant context (center, green), and (c) our proposed SA-RetRobust, a RALM fine-tuned on a mixture of relevant
 Figure 4: Results for our models on all evaluation datasets when retrieving top-1 results from Google SEARCH. Bars show the difference in performance from a model with no retrieval (whose performance is given in parenthesis for each dataset). Prompting models to use retrieval in-context (leftmost bar) increases performance on single-hop and explicit datasets, but decreases performance on implicit ones (STRATEGYQA and FERMI). When using NLI models to identify irrelevant evidence (center bar), retrieval never hurts, at a cost to gains received when retrieval is helpful. Our trained RALMs (rightmost column) outperform all other models when applicable for NQ, 2WIKIMQA, and STRATEGYQA (see §3.2.3 for more details on data generation).
and irrelevant contexts (rightmost, orange). The bars show the difference in performance from our few-shot prompted model without retrieval (whose performance is shown in parenthesis for each dataset). For the In-Context RALM, we observe that retrieval helps on NQ, 2WIKIMQA and BAMBOOGLE but reduces performance on the implicit STRATEGYQA and FERMI. Adding NLI to identify irrelevant context ensures that retrieval does not hurt, but gains are limited. Training with retrieval leads to gains across the board. We observe similar trends with the COLBERTV2 retriever, albeit at an overall decrease in accuracy ( $\S$ A.3, Tab. 3.)
Exploring the Robustness of Models to Irrelevant Context Fig. 5 present results when simulating retrieval of irrelevant/noisy context, either by retrieving low-ranked passages (top) or random ones (bottom). When retrieving random passages, the performance of the In-Context RALM drops by more than 10 points on average, a phenomenon that can be mitigated by using NLI models. SA-RetRobust performs best across all settings. To verify that these improvements indeed stem from robustness to irrelevant context rather than task-specific training, we compare SA-RetRobust to an ablated variant trained and evaluated without retrieval (full results in Tab. 4, §A.3). SA-RetRobust is able to perform similarly to this model (within one standard deviation) when retrieving random contexts. Interestingly, when retrieving low-ranked results, SA-RetRobust outperforms the ablated model by 3.8 and 2.8 points on NQ and 2WIKIMQA, while performing only slightly worse (within a 1.2 point difference) on STRATEGYQA. Overall, our results suggest SA-RetRobust learned to both better utilize retrieval and ignore irrelevant context.
Adding Retrieval to In-context Exemplars can Hurt Performance Tab. 2 and Tab. 3 in §A.3 present full results with the Google SEARCH and COLBERTV2 retrievers. Interestingly, providing exemplars with retrieval performs worse than providing exemplars without retrieval, i.e., the SA-NR prompt leads to better performance even when retrieval is performed at inference time. This SA-NR prompt consistently outperforms the prompts with retrieval (SA-R@1, SA-R@10, and SA-RMix) when retrieving the top-1 result from COLBERTV2 or random contexts from Google SEARCH. In addition, the SA-R@1 model that contains top-1 results in the prompt is not the best performing even when retrieving top-1 results at inference time, losing to SA-NR by more than 2 points on average across datasets. When retrieving noisy contexts at inference time, SA-R@1 is outperformed by the other models, suggesting that showing examples for retrieval during in-context learning has a negative effect that causes over-utilization of irrelevant context. We observe a similar trend with Llama-2-70B in §A.3, Tab. 6.
Effect of NLI When retrieving random contexts or evaluating on the implicit STRATEGYQA and FERMI, NLI variants consistently perform best, suggesting small NLI models are sufficient to identify irrelevant evidence (Tab. 2 and Tab. 3 in §A.3). However, they reduce performance in cases
 Figure 5: Results with low-rank (top) and random retrieval (bottom). Models are similar to those in Fig.4. Performance significantly decreases for the prompted model in all settings, while it is maintained when using NLI models. Our finetuned SA-RetRobust is best performing in all settings. We show that SA-RetRobust learned to both ignore irrelevant context and better utilize relevant context by comparing to an ablated model without retrieval in §4.
retrieval is helpful, e.g., on the explicit 2WIKIMQA and BAMBOOGLE. We perform a detailed analysis for our NLI variants in §5.
Results with Finetuned Models Fig. 4 and Fig. 5 show SA-RetRobust consistently outperforms other models. In §A.3, Tab. 4, we present all results for all trained models, showing SA-RetRobust outperforms our ablated baselines. Specifically, it outperforms SA-NoRet (fine-tuned without retrieval) by 2.7, 2.4, and 2.4 points on average when using the top-1, a low-ranked, or a random context from GOoGLE SEARCH during inference, and SA- $@$ 1 by 0.2, 0.4, 3.2 points respectively. When retrieving top-1 results from COLBERTV2, SA-RetRobust outperforms SA-NoRet and SA- $@$ 1 by 2.7 and 0.3 points on average, respectively. Our results suggest that training on a mixture of relevant and irrelevant contexts is necessary for robustness and improved performance. We provide a study on the generalization of our trained models to other settings in §A.3.
Results with Llama-2-70B We compare SA-RetRobust with Llama-2-70B on the NQ dataset to assess whether larger models are more robust to irrelevant contexts. Without retrieval, the prompted Llama-2-70B outperforms the trained Llama-2-13B by 4.3 points (38.4 vs 34.1). However, when retrieving the top-1 results from Google SEARCH, SA-RetRobust outperforms all prompted Llama-2-70B variants by at least 3.3 points (45.7 vs 42.4), suggesting that increasing model size alone is not sufficient to make models better utilize retrieval. We provide the full results in §A.3, Tab. 6.
# 5 ANALYSIS
When Does Irrelevant Context Cause Errors? To assess errors caused by irrelevant context, we manually looked at examples from NQ, 2WIKIMQA and STRATEGYQA, where models succeed without retrieval, but fail with it. Specifically, we look at examples where the model is prompted with the SA-RMix prompt that includes both top-1 and low-ranked retrieved result and is presented with low-rank or random retrieved evidence during inference. We manually annotated 40 examples in each setting (240 overall), and find that automatic errors indeed correlate with cases in which retrieval augmentation caused the model to err in $73\%$ of the cases ( $65\% - 85\%$ in each setting). We provide additional details and statistical tests in $\S A.4$ .
We then take a deeper look at the errors. For NQ we find that when using low-ranked context, the wrong generated answer entity appears in the retrieved context in the majority (77%) of the cases, but only in 37% when retrieving random contexts. This suggests that irrelevant context can cause errors even when the generated entities are not retrieved, as shown in §A.4, Fig. 6. For multi-hop questions, we test whether irrelevant context leads to errors in question decomposition, or in answering intermediate questions. We find that when retrieving low-ranked passages, most of the errors
(68%) for the explicit 2WIKIMQA are in intermediate answers, contrary to the implicit STRATEGYQA were errors are more prevalent in intermediate questions (77% of the cases, we provide an example in §A.4, Fig. 7). Similarly, when retrieving random contexts, most errors (60%) for 2WIKIMQA are in intermediate questions. This suggests that irrelevant context can cause errors in generating both an answering strategy and the answer itself, depending on the task and the retrieved context.
When Do NLI Models Fail? As shown in §4, NLI models are efficient at identifying relevant context, at a cost to gains when retrieval is helpful. To better characterize NLI models, we look at the accuracy for our SA- $*$ -NLI models as a function of the probability that the NLI model assigns to the entailment label. Tab. 8 in §A.4 shows that there are many cases where the probability for entailment is low but retrieval helps for NQ and 2WIKIMQA.
To better identify the source for such errors, we manually analysed 25 examples for each dataset where entailment was low, but retrieval augmentation led the SA-RMix model to generate the correct answer. In about half of the cases the NLI model erred and the generated text is indeed entailed from the retrieved contexts. In the remaining examples, for at least a third of the cases the generated answer or decomposition is correct, but the retrieved context does not directly entail the generation. This can be partially explained by the ability of models to combine retrieval and their parametric knowledge (Talmor et al., 2020; Zhong et al., 2023; Cohen et al., 2023). We are hopeful that these results can inspire future work to focus on additional aspects of retrieval augmentation, such as the effect augmentation has on generation probability rather than on direct entailment.
# 6 RELATED WORK
Recent work has shown that the performance of LLMs can be affected by irrelevant context. Amongst others, Jia & Liang (2017); Petroni et al. (2020); Creswell et al. (2023) show that adding random or irrelevant context can decrease QA performance. This has been shown in many settings, including but not limited to factual reasoning (Kassner & Schütze, 2020; Pandia & Ettinger, 2021; Misra et al., 2023), text generation about new entities (Onoe et al., 2022), or even code generation (Jones & Steinhardt, 2022). In the context of arithmetic reasoning, Shi et al. (2023) showed that adding irrelevant context to exemplars or task specific instructions can help, suggesting the model may be equipped with such skills from pre-training. Other methods try to reduce the number of retrieval calls, by focusing on cases where confidence is low (Jiang et al., 2023) or retrieving information for rare entities (Mallen et al., 2023). Closest to our work is that of Li et al. (2023) that propose LLMs with a "controllable memory" that will enable them to ignore irrelevant context. However, their LLMs are finetuned on over 200K training examples, where our focus is on performance when training with 1,000 questions or less, and training data is automatically generated. In addition, we focus on a multi-hop QA setting, where the retriever is called multiple times ( $\S 2$ ).
A similar line of work focuses on when models should use parametric or retrieved knowledge, especially when there are conflicts (Longpre et al., 2021; Chen et al., 2022). It has been recently proposed to train models to generate from both parametric and retrieved knowledge (Neeman et al., 2023) or make better use of in-context exemplars (Zhou et al., 2023).
# 7 CONCLUSION
In this work, we provide a thorough analysis showing current RALMs are not robust to irrelevant retrieved context, causing them to perform worse on certain tasks. In cases where training is not possible, a simple NLI baseline is efficient to increase robustness, at a cost of discarding relevant passages. When training is possible, we introduce an automatic data generation framework for single and challenging multi-hop tasks, and show training on as few as 1,000 examples with intentionally varied quality suffice to make models robust to irrelevant context and improve overall performance. While our focus in this work is on in-domain settings, we are hopeful our work could inspire future research towards a general RALM that is robust to irrelevant context.
# ACKNOWLEDGEMENTS
We would like to our colleagues at TAU NLP for their insightful comments. We thank SerpAPI for their support by granting us an academic discount. This research was partially supported by the Yandex Initiative for Machine Learning and the European Research Council (ERC) under the European Union Horizons 2020 research and innovation programme (grant ERC DELPHI 802800). This work was completed in partial fulfillment of the Ph.D. of Ori Yoran.
# REFERENCES
Bernd Bohnet, Vinh Q. Tran, Pat Verga, Roee Aharoni, Daniel Andor, Livio Baldini Soares, Massimiliano Ciaramita, Jacob Eisenstein, Kuzman Ganchev, Jonathan Herzig, Kai Hui, Tom Kwiatkowski, Ji Ma, Jianmo Ni, Lierni Sestorain Saralegui, Tal Schuster, William W. Cohen, Michael Collins, Dipanjan Das, Donald Metzler, Slav Petrov, and Kellie Webster. Attributed question answering: Evaluation and modeling for attributed large language models, 2023. Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 632-642, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/D15-1075. URL https://aclanthology.org/D15-1075. Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips.cc/paper/2020/bit/1457c0d6bcbd4967418bf8ac142f64a-AAbstract.html. Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to answer open-domain questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1870-1879, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1171. URL https://aclanthology.org/P17-1171. Hung-Ting Chen, Michael Zhang, and Eunsol Choi. Rich knowledge sources bring complex knowledge conflicts: Recalibrating models to reflect conflicting evidence. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 2292-2307, Abu Dhabi, United Arab Emirates, 2022. Association for Computational Linguistics. URL https://aclanthology.org/2022.emnlp-main.146. Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidi Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fiotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code, 2021. Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh,
Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways, 2022. Roi Cohen, Eden Biran, Ori Yoran, Amir Globerson, and Mor Geva. Evaluating the ripple effects of knowledge editing in language models, 2023. Antonia Creswell, Murray Shanahan, and Irina Higgins. Selection-inference: Exploiting large language models for interpretable logical reasoning. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=3Pf3Wg6o-A4. Ido Dagan, Oren Glickman, and Bernardo Magnini. The Pascal recognising textual entailment challenge. In Joaquin Quinonero-Candela, Ido Dagan, Bernardo Magnini, and Florence d'Alché Buc (eds.), Machine Learning Challenges. Evaluating Predictive Uncertainty, Visual Object Classification, and Recognising Tectual Entailment, pp. 177-190, Berlin, Heidelberg, 2006. Springer Berlin Heidelberg. ISBN 978-3-540-33428-6. Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. QLoRA: Efficient finetuning of quantized LLMs. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=OUIFPHEGJU. Bhuwan Dhingra, Jeremy R. Cole, Julian Martin Eisenschlos, Daniel Gillick, Jacob Eisenstein, and William W. Cohen. Time-aware language models as temporal knowledge bases. Transactions of the Association for Computational Linguistics, 10:257-273, 2022. doi: 10.1162/tacl_a_00459. URL https://aclanthology.org/2022.tacl-1.15. Mor Geva, Daniel Khashabi, Elad Segal, Tushar Khot, Dan Roth, and Jonathan Berant. Did aristole use a laptop? a question answering benchmark with implicit reasoning strategies. Transactions of the Association for Computational Linguistics, 9:346-361, 2021. doi: 10.1162/tacl_a_00370. URL https://aclanthology.org/2021.tacl-1.21. Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. In Proceedings of the 37th International Conference on Machine Learning, ICML'20. JMLR.org, 2020. Or Honovich, Roee Aharoni, Jonathan Herzig, Hagai Taitelbaum, Doron Kukliansy, Vered Cohen, Thomas Scialom, Idan Szpektor, Avinatan Hassidim, and Yossi Matias. TRUE: Re-evaluating factual consistency evaluation. In Proceedings of the Second DialDoc Workshop on Document-grounded Dialogue and Conversational Question Answering, pp. 161-175, Dublin, Ireland, 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.dialdoc-1.19. URL https://aclanthology.org/2022.dialdoc-1.19. Gautier Izacard, Patrick Lewis, Maria Lomeli, Lucas Hosseini, Fabio Petroni, Timo Schick, Jane Dwivedi-Yu, Armand Joulin, Sebastian Riedel, and Edouard Grave. Atlas: Few-shot learning with retrieval augmented language models. Journal of Machine Learning Research, 24(251): 1-43, 2023. URL http://jmlr.org/papers/v24/23-0037.html. Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2021-2031, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/D17-1215. URL https://aclanthology.org/D17-1215.
Zhengbao Jiang, Frank Xu, Luyu Gao, Zhiqing Sun, Qian Liu, Jane Dwivedi-Yu, Yiming Yang, Jamie Callan, and Graham Neubig. Active retrieval augmented generation. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 7969-7992, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.emnlp-main.495. URL https://aclanthology.org/2023.emnlp-main.495. Erik Jones and Jacob Steinhardt. Capturing failures of large language models via human cognitive biases. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=fcO9Cgn-X-R. Ashwin Kalyan, Abhinav Kumar, Arjun Chandrasekaran, Ashish Sabharwal, and Peter Clark. How much coffee was consumed during EMNLP 2019? fermi problems: A new reasoning challenge for AI. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 7318-7328, Online and Punta Cana, Dominican Republic, 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.582. URL https://aclanthology.org/2021.emnlp-main.582. Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6769-6781, Online, 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.550. URL https://aclanthology.org/2020.emnlp-main.550. Nora Kassner and Hinrich Schütze. Negated and misprimed probes for pretrained language models: Birds can talk, but cannot fly. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7811-7818, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.698. URL https://aclanthology.org/2020.acl-main.698. O. Khattab, Keshav Santhanam, Xiang Lisa Li, David Leo Wright Hall, Percy Liang, Christopher Potts, and Matei A. Zaharia. Demonstrate-search-predict: Composing retrieval and language models for knowledge-intensive nlp. ArXiv preprint, abs/2212.14024, 2022. URL https:// arxiv.org/abs/2212.14024. Omar Khattab and Matei Zaharia. Colbert: Efficient and effective passage search via contextualized late interaction over BERT. In Jimmy Huang, Yi Chang, Xueqi Cheng, Jaap Kamps, Vanessa Murdock, Ji-Rong Wen, and Yiqun Liu (eds.), Proceedings of the 43rd International ACM SIGIR conference on research and development in Information Retrieval, SIGIR 2020, Virtual Event, China, July 25-30, 2020, pp. 39-48. ACM, 2020. doi: 10.1145/3397271.3401075. URL https://doi.org/10.1145/3397271.3401075. Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452–466, 2019. doi: 10.1162/tacl_a_00276. URL https://aclanthology.org/Q19-1026. Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871-7880, Online, 2020a. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.703. URL https://aclanthology.org/2020.acl-main.703. Patrick S. H. Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Roektaschel, Sebastian Riedel, and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In
Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and HsuanTien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020b. URL https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-AAbstract.html. Daliang Li, Ankit Singh Rawat, Manzil Zaheer, Xin Wang, Michal Lukasik, Andreas Veit, Felix Yu, and Sanjiv Kumar. Large language models with controllable working memory. In *Findings of the Association for Computational Linguistics: ACL 2023*, pp. 1774–1793, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023-findings-acl.112. URL https://aclanthology.org/2023-findings-acl.112. Shayne Longpre, Kartik Perisetla, Anthony Chen, Nikhil Ramesh, Chris DuBois, and Sameer Singh. Entity-based knowledge conflicts in question answering. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 7052-7063, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.565. URL https://aclanthology.org/2021.emnlp-main.565. Alex Mallen, Akari Asai, Victor Zhong, Rajarshi Das, Daniel Khashabi, and Hannaneh Hajishirzi. When not to trust language models: Investigating effectiveness of parametric and non-parametric memories. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 9802-9822, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.546. URL https://aclanthology.org/2023.acl-long.546. Kanishka Misra, Julia Rayz, and Allyson Ettinger. COMPS: Conceptual minimal pair sentences for testing robust property knowledge and its inheritance in pre-trained language models. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, pp. 2928-2949, Dubrovnik, Croatia, 2023. Association for Computational Linguistics. URL https://aclanthology.org/2023.eacl-main.213. Ella Neeman, Roee Aharoni, Or Honovich, Leshem Choshen, Idan Szpektor, and Omri Abend. DisentQA: Disentangling parametric and contextual knowledge with counterfactual question answering. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 10056-10070, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.559. URL https://aclanthology.org/2023.acl-long.559. Yasumasa Onoe, Michael Zhang, Eunsol Choi, and Greg Durrett. Entity cloze by date: What LMs know about unseen entities. In Findings of the Association for Computational Linguistics: NAACL 2022, pp. 693-702, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022-findings-naacl.52. URL https://aclanthology.org/2022-findings-naacl.52. Lalchand Pandia and Allyson Ettinger. Sorting through the noise: Testing robustness of information processing in pre-trained language models. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 1583-1596, Online and Punta Cana, Dominican Republic, 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.119. URL https://aclanthology.org/2021.emnlp-main.119. Fabio Petroni, Patrick Lewis, Aleksandra Piktus, Tim Roktaschel, Yuxiang Wu, Alexander H. Miller, and Sebastian Riedel. How context affects language models' factual predictions. In *Automated Knowledge Base Construction*, 2020. URL https://openreview.net/forum?id=025X0zPfn. Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vladimir Karpukhin, Jean Maillard, Vassilis Plachouras, Tim Roektaschel, and Sebastian Riedel. KILT: a benchmark for knowledge intensive language tasks. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2523-2544, Online,
June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main.200. URL https://aclanthology.org/2021.naacl-main.200. Ofir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 5687-5711, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023-findings-emnlp.378. URL https://aclanthology.org/2023-findings-emnlp.378. Ori Ram, Yoav Levine, Itay Dalmedigos, Dor Muhlgay, Amnon Shashua, Kevin Leyton-Brown, and Yoav Shoham. In-context retrieval-augmented language models. Transactions of the Association for Computational Linguistics, 11:1316-1331, 2023. doi: 10.1162/tacl_a_00605. URL https://aclanthology.org/2023.tacl-1.75. Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of a language model? In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 5418-5426, Online, 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.437. URL https://aclanthology.org/2020.emnlp-main.437. Ohad Rubin and Jonathan Berant. Long-range language modeling with self-retrieval, 2023. Freda Shi, Xinyun Chen, Kanishka Misra, Nathan Scales, David Dohan, Ed Chi, Nathanael Scharli, and Denny Zhou. Large language models can be easily distracted by irrelevant context. In Proceedings of the 40th International Conference on Machine Learning, ICML'23. JMLR.org, 2023. Alon Talmor, Oyvind Tafjord, Peter Clark, Yoav Goldberg, and Jonathan Berant. Leap-of-thought: Teaching pre-trained models to systematically reason over implicit knowledge. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and HsuanTien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips.cc/paper/2020/bit/ e992111e4ab9985366e806733383bd8c-AAbstract.html. James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. FEVER: a large-scale dataset for fact extraction and VERIFICATION. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 809-819, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1074. URL https://aclanthology.org/N18-1074. Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023. Harsh Trivedi, Niranjan Balasubramanian, Tushar Khot, and Ashish Sabharwal. Interleaving retrieval with chain-of-thought reasoning for knowledge-intensive multi-step questions. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 10014-10037, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.557. URL https://aclanthology.org/2023.acl-long.557.
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V Le, Ed H. Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=1PL1NIMMrw. Johannes Welbl, Pontus Stenetorp, and Sebastian Riedel. Constructing datasets for multi-hop reading comprehension across documents. Transactions of the Association for Computational Linguistics, 6:287-302, 2018. doi: 10.1162/tacl_a_00021. URL https://aclanthology.org/Q18-1021. Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 1112-1122, New Orleans, Louisiana, 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1101. URL https://aclanthology.org/N18-1101. Tomer Wolfson, Mor Geva, Ankit Gupta, Matt Gardner, Yoav Goldberg, Daniel Deutch, and Jonathan Berant. Break it down: A question understanding benchmark. Transactions of the Association for Computational Linguistics, 8:183-198, 2020. doi: 10.1162/tacl_a_00309. URL https://aclanthology.org/2020.tacl-1.13. Ori Yoran, Tomer Wolfson, Ben Bogin, Uri Katz, Daniel Deutch, and Jonathan Berant. Answering questions by meta-reasoning over multiple chains of thought. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 5942-5966, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.emnlp-main.364. URL https://aclanthology.org/2023.emnlp-main.364. Zexuan Zhong, Zhengxuan Wu, Christopher Manning, Christopher Potts, and Danqi Chen. MQuAKE: Assessing knowledge editing in language models via multi-hop questions. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 15686-15702, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.emnlp-main.971. URL https://aclanthology.org/2023.emnlp-main.971. Wenxuan Zhou, Sheng Zhang, Hoifung Poon, and Muhao Chen. Context-faithful prompting for large language models. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 14544-14556, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023-findings-emnlp.968. URL https://aclanthology.org/2023-findings-emnlp.968.
# A APPENDIX
# A.1 MODELS
Llama-2 In all cases, we use the vanilla variant of the Llama-2 models from https://huggingface.co/meta-llama, with half precision.
Decomposition Generation Questions in our multi-hop datasets require between 2-4 decomposition steps. Hence we limit the number of generation steps to 5. In Tab. 8 we show that the number of cases in which the model does not arrive at an answer in 5 steps, termed as failures, is very small when generating with top-1 results from Google SEARCH, at $0.4\%$ for 2WIKIMQA and $1.2\%$ for STRATEGYQA. Failures are much higher when retrieving random contexts, at $37.0\%$ for 2WIKIMQA and $34.4\%$ for STRATEGYQA. These are usually cases the model enters an infinite loop. Following recent work, (Wang et al., 2023; Yoran et al., 2023) we use greedy decoding when generating decompositions.
Training We fine-tune all our models with QLoRA (Dettmers et al., 2023) for parameter efficient fine-tuning. We use the default hyperparameters from https://github.com/daniel-furman/sft-demos/blob/main/src/sft/onegpu/llama-2/guanaco/sft-llama-2-13b-guanaco-peft.ipynb. We train all our models for 5 epochs, with a learning rate of $2e - 4$ and linear scheduling on a single GPU. The training time for each model was no longer than 3.5 hours.
# A.2 EVALUATION
In some cases, the models do not arrive at a final answer (§A.1). In such cases, we assign a score of 0.5 for STRATEGYQA and 0 for all other datasets. For FERMI, following past work (Yoran et al., 2023), we use all 286 "Real Fermi Problems" for evaluation and provide the gold answers measure units (meters, cubes, litres, etc...) as additional input to our models.
# A.3 FULL RESULTS
Tab. 2 and Tab. 3 presents the full results for our prompted models with Google SEARCH and COLBERTV2, respectively. Tab. 4 presents full results for all our trained models, averaged over three seeds. Tab. 6 presents results for Llama-2-70B on NQ with the Google SEARCH retriever.
Out of Distribution Generalization To test the generalization of our trained models in an out of distribution (OOD) setting, we trained a version of our models on a mixture of our STRATEGYQA and 2WIKIMQA data and evaluate on BAMBOOGLE and FERMI. Since the evaluation task can differ from the training data (for example in FERMI the model needs to generate an equation before the final answer), we provided the models with one exemplar during inference. We provide the full results for this experiment in Tab. 5. We note that the standard deviation in these experiments is larger than in Table 3, probably due to the small support size at 120 for BAMBOOGLE and 286 for FERMI. Still, when comparing between the trained models, SA-RetRobust is either the best performing model or within one standard deviation in all settings. However, we also observe some surprising trends that may be related to a failure of the model to generalize or to the effect of the in-context exemplar: (a) For BAMBOOGLE, when not using a retriever, the model prompted and evaluated without retrieval outperforms the model trained without retrieval (47.4 vs 40.8), and (b) For FERMI, we see a slight decrease in accuracy from the model trained and evaluated without retrieval to our trained SA-RetRobust model when evaluating with low-ranked or random retrieval (29.3 vs 27.9 and 27.6 respectively). Overall, we are hopeful that these results will help future research towards a general RALM that is robust to irrelevant context.
# A.4 ANALYSIS
For our study regarding cases irrelevant context caused SA-RMix to err, we annotate examples with the following categories (a) Valid: the prediction is a paraphrase of the correct answer or a plausible answer to an ambiguous question (b) Wrong: the prediction with retrieval is wrong and the prediction without retrieval is correct, (c) Both Wrong: the prediction with retrieval is wrong, but the prediction without retrieval was also wrong (due to bad decomposition that can spuriously lead to a correct answer in binary or comparison questions). We provide the full result in Tab. 7. We verify our results are statistical significant by running a binomial test for the hypothesis: "Most cases where automatic metrics decrease by the introduction of irrelevant context are not actual errors" which was rejected with p-value $< 0.01$ .
Fig. 6 presents an example where irrelevant context causes Llama-2-13B to err when the generated entity does not appear in the retrieved context. Fig. 7 shows an example where random retrieval caused the model to generate a bad strategy in STRATEGYQA and Tab. 8 presents the full results for our analysis of NLI models.
# A.5 PROMPTS
We provide our SA-NR, SA-R@1, and SA-R@10 prompts for NQ in Tab. 8, Tab. 9, Tab. 10, respectively. For the SA-RMix prompt, we use exemplars from the SA-R@1 and SA-R@10 prompts,
<table><tr><td>Dataset</td><td>Inference Retrieval</td><td>NR</td><td>NR -NLI</td><td>R@1</td><td>R@1 -NLI</td><td>R@10</td><td>R@10 -NLI</td><td>RMix</td><td>RMix -NLI</td></tr><tr><td rowspan="4">NQ</td><td>None</td><td>29.6</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>@1</td><td>41.0</td><td>38.4</td><td>39.0</td><td>36.4</td><td>41.0</td><td>36.8</td><td>40.6</td><td>37.0</td></tr><tr><td>@10</td><td>30.2</td><td>29.8</td><td>25.6</td><td>29.4</td><td>30.0</td><td>31.0</td><td>31.0</td><td>29.8</td></tr><tr><td>Random</td><td>28.2</td><td>29.6</td><td>17.2</td><td>29.4</td><td>22.2</td><td>29.4</td><td>22.0</td><td>29.4</td></tr><tr><td rowspan="4">2WIKIMQA</td><td>None</td><td>32.0</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>@1</td><td>56.0</td><td>39.9</td><td>51.6</td><td>38.3</td><td>51.6</td><td>39.2</td><td>53.1</td><td>39.0</td></tr><tr><td>@10</td><td>33.0</td><td>32.2</td><td>27.5</td><td>32.5</td><td>30.9</td><td>32.3</td><td>29.6</td><td>32.2</td></tr><tr><td>Random</td><td>27.0</td><td>32.0</td><td>13.7</td><td>32.0</td><td>21.3</td><td>32.2</td><td>17.5</td><td>32.0</td></tr><tr><td rowspan="4">STRATEGYQA</td><td>None</td><td>65.6</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>@1</td><td>62.1</td><td>65.6</td><td>63.8</td><td>66.7</td><td>61.4</td><td>65.8</td><td>59.6</td><td>66.2</td></tr><tr><td>@10</td><td>60.4</td><td>65.6</td><td>61.0</td><td>65.6</td><td>60.5</td><td>65.4</td><td>62.1</td><td>65.8</td></tr><tr><td>Random</td><td>58.4</td><td>65.6</td><td>53.4</td><td>65.6</td><td>57.0</td><td>65.6</td><td>52.7</td><td>65.6</td></tr><tr><td rowspan="4">BAMBOOGLE</td><td>None</td><td>47.4</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>@1</td><td>68.0</td><td>55.9</td><td>61.2</td><td>56.0</td><td>68.9</td><td>58.0</td><td>62.7</td><td>55.2</td></tr><tr><td>@10</td><td>41.4</td><td>47.4</td><td>32.1</td><td>45.9</td><td>44.5</td><td>45.9</td><td>38.1</td><td>47.0</td></tr><tr><td>Random</td><td>39.5</td><td>47.4</td><td>24.7</td><td>47.4</td><td>34.8</td><td>47.4</td><td>26.3</td><td>47.4</td></tr><tr><td rowspan="4">FERMI</td><td>None</td><td>27.7</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>@1</td><td>27.4</td><td>28.2</td><td>25.2</td><td>27.6</td><td>27.5</td><td>27.7</td><td>25.6</td><td>27.4</td></tr><tr><td>@10</td><td>24.0</td><td>27.7</td><td>27.1</td><td>27.6</td><td>25.1</td><td>27.7</td><td>23.6</td><td>28.0</td></tr><tr><td>Random</td><td>22.1</td><td>27.7</td><td>17.2</td><td>27.7</td><td>17.4</td><td>27.7</td><td>13.8</td><td>27.7</td></tr></table>
Table 2: Full results for our prompted Llama-2-13B models with the GOOgLE SEARCH retriever.
<table><tr><td>Dataset</td><td>Inference Retrieval</td><td>NR</td><td>NR -NLI</td><td>R@1</td><td>R@1 -NLI</td><td>R@10</td><td>R@10 -NLI</td><td>RMix</td><td>RMix -NLI</td></tr><tr><td rowspan="2">NQ</td><td rowspan="2">None @1</td><td>29.6</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>34.6</td><td>34.8</td><td>31.2</td><td>33.2</td><td>32.4</td><td>33.8</td><td>32.8</td><td>33.8</td></tr><tr><td rowspan="2">2WIKIMQA</td><td rowspan="2">None @1</td><td>32.0</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>42.2</td><td>36.2</td><td>37.3</td><td>34.9</td><td>36.7</td><td>35.0</td><td>39.6</td><td>35.3</td></tr><tr><td rowspan="2">STRATEGYQA</td><td rowspan="2">None @1</td><td>65.6</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>61.6</td><td>66.0</td><td>64.3</td><td>65.1</td><td>61.1</td><td>64.9</td><td>61.6</td><td>64.7</td></tr><tr><td rowspan="2">BAMBOOGLE</td><td rowspan="2">None @1</td><td>47.4</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>50.0</td><td>48.6</td><td>37.4</td><td>46.6</td><td>38.1</td><td>47.4</td><td>38.2</td><td>48.7</td></tr><tr><td rowspan="2">FERMI</td><td rowspan="2">None @1</td><td>27.7</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>25.9</td><td>27.3</td><td>23.2</td><td>27.8</td><td>21.2</td><td>28.0</td><td>24.4</td><td>28.0</td></tr></table>
Table 3: Full results for our prompted Llama-2-13B models with the COLBERTV2 retriever.
interchangeably. We add a small instruction for the QA task before the exemplars. Our prompts contain 6 exemplars for NQ, 2WIKIMQA, and STRATEGYQA, 5 for FERMI, and 4 for BAMBOOGLE. All our prompts are publicly available, together with our models, data, and code.
<table><tr><td>Dataset</td><td>Retriever</td><td>Inference</td><td>SA-NoRet</td><td>SA-Ret@1</td><td>SA-RetRobust</td></tr><tr><td rowspan="5">NQ</td><td>None</td><td>None</td><td>34.1±0.8</td><td>n/a</td><td>n/a</td></tr><tr><td>Google</td><td>@1</td><td>42.8±0.8</td><td>46.3±0.6</td><td>45.7±0.6</td></tr><tr><td>Google</td><td>@10</td><td>37.0±1.0</td><td>38.2±0.6</td><td>37.9±0.5</td></tr><tr><td>Google</td><td>@Random</td><td>31.1±0.1</td><td>31.4±0.5</td><td>33.8±0.2</td></tr><tr><td>ColBERTV2</td><td>@1</td><td>41.5±0.4</td><td>43.5±0.2</td><td>43.5±0.6</td></tr><tr><td rowspan="5">2WIKIMQA</td><td>None</td><td>None</td><td>42.2±0.6</td><td>n/a</td><td>n/a</td></tr><tr><td>Google</td><td>@1</td><td>64.6±0.7</td><td>66.7±1.0</td><td>66.9±1.0</td></tr><tr><td>Google</td><td>@10</td><td>40.8±0.5</td><td>43.9±0.3</td><td>45.0±0.4</td></tr><tr><td>Google</td><td>@Random</td><td>40.4±0.8</td><td>37.5±1.0</td><td>41.6±0.2</td></tr><tr><td>ColBERTV2</td><td>@1</td><td>54.4±0.7</td><td>57.0±0.5</td><td>57.6±0.5</td></tr><tr><td rowspan="5">STRATEGYQA</td><td>None</td><td>None</td><td>69.8±0.9</td><td>n/a</td><td>n/a</td></tr><tr><td>Google</td><td>@1</td><td>67.1±0.4</td><td>69.0±1.2</td><td>70.1±1.1</td></tr><tr><td>Google</td><td>@10</td><td>66.6±1.1</td><td>68.1±0.3</td><td>68.6±0.5</td></tr><tr><td>Google</td><td>@Random</td><td>66.6±0.7</td><td>66.9±1.2</td><td>69.9±1.8</td></tr><tr><td>ColBERTV2</td><td>@1</td><td>65.9±0.6</td><td>68.4±1.4</td><td>68.8±0.9</td></tr></table>
Table 4: Full results for our trained Llama-2-13B models. Results are averaged over three seeds. For our RALMs, we use either GOOGLE SEARCH or COLBERTV2 as our retrievers during inference.
<table><tr><td>Dataset</td><td>Retriever</td><td>Inference</td><td>SA-NoRet</td><td>SA-Ret@1</td><td>SA-RetRobust</td></tr><tr><td rowspan="5">BAMBOOGLE</td><td>None</td><td>None</td><td>40.8±2.0</td><td>n/a</td><td>n/a</td></tr><tr><td>Google</td><td>@1</td><td>57.4±2.0</td><td>61.3±1.4</td><td>64.7±1.5</td></tr><tr><td>Google</td><td>@10</td><td>33.1±1.9</td><td>39.2±2.0</td><td>42.0±2.2</td></tr><tr><td>Google</td><td>@Random</td><td>29.8±1.8</td><td>38.4±4.8</td><td>43.6±1.6</td></tr><tr><td>ColBERTV2</td><td>@1</td><td>37.1±1.5</td><td>48.2±0.7</td><td>49.6±1.8</td></tr><tr><td rowspan="5">FERMI</td><td>None</td><td>None</td><td>29.3±0.4</td><td>n/a</td><td>n/a</td></tr><tr><td>Google</td><td>@1</td><td>31.3±1.2</td><td>29.6±0.8</td><td>29.2±1.6</td></tr><tr><td>Google</td><td>@10</td><td>28.3±1.5</td><td>28.6±2.5</td><td>27.9±1.9</td></tr><tr><td>Google</td><td>@Random</td><td>25.3±1.3</td><td>27.9±2.4</td><td>27.6±0.6</td></tr><tr><td>ColBERTV2</td><td>@1</td><td>28.3±0.1</td><td>28.9±0.4</td><td>30.0±1.1</td></tr></table>
Table 5: Full results for our trained Llama-2-13B models in an out of distribution setting. In this setting, our models are trained on a mixture of STRATEGYQA and 2WIKIMQA and evaluated on BAMBOOGLE and FERMI. Results are averaged over three seeds. For our RALMs, we use either GOOGLE SEARCH or COLBERTV2 as our retrievers during inference.
 Figure 6: An example from NQ where retrieval caused Llama-2-13B to err, although the generated entity does not appear in the retrieved context.
<table><tr><td>Inference Retrieval</td><td>NR</td><td>NR -NLI</td><td>R@1</td><td>R@1 -NLI</td><td>R@10</td><td>R@10 -NLI</td><td>RMix</td><td>RMix -NLI</td><td>SA- No-Ret</td><td>SA- RetBust</td></tr><tr><td>#Params</td><td>70B</td><td>70B</td><td>70B</td><td>70B</td><td>70B</td><td>70B</td><td>70B</td><td>70B</td><td>13B</td><td>13B</td></tr><tr><td>None</td><td>38.4</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td><td>34.1</td><td>n/a</td></tr><tr><td>@1</td><td>41.4</td><td>41.8</td><td>41.2</td><td>42.4</td><td>41.6</td><td>42.4</td><td>41.2</td><td>42.0</td><td>42.8</td><td>45.7</td></tr><tr><td>@10</td><td>38.8</td><td>36.2</td><td>30.2</td><td>34.2</td><td>33.4</td><td>35.4</td><td>31.8</td><td>35.2</td><td>37.0</td><td>37.9</td></tr><tr><td>Random</td><td>33.6</td><td>38.2</td><td>28.8</td><td>36.8</td><td>35.2</td><td>38.2</td><td>31.0</td><td>38.0</td><td>31.1</td><td>33.8</td></tr></table>
Table 6: Results for NQ with GOOGLE SEARCH and Llama-2-70B.
<table><tr><td></td><td>Inference Retrieval</td><td>Valid</td><td>Wrong</td><td>Both Wrong</td></tr><tr><td rowspan="2">NQ</td><td>@10</td><td>34%</td><td>66%</td><td>0%</td></tr><tr><td>Random</td><td>22%</td><td>78%</td><td>0%</td></tr><tr><td rowspan="2">2WIKIMQA</td><td>@10</td><td>2%</td><td>72%</td><td>23%</td></tr><tr><td>Random</td><td>0%</td><td>85%</td><td>15%</td></tr><tr><td rowspan="2">STRATEGYQA</td><td>@10</td><td>3%</td><td>65%</td><td>32%</td></tr><tr><td>Random</td><td>0%</td><td>70%</td><td>30%</td></tr></table>
Table 7: Full results for our analysis regarding cases where augmenting retrieved contexts caused Llama-2-13B prompted with SA-RMix to err. Classes and additional details are provided in §5.
 Figure 7: An example from STRATEGYQA irrelevant context causes Llama-2-13B to generate a wrong strategy (right). Without retrieval (left), the model succeeds in generating the correct answer.
<table><tr><td></td><td>Inference Retrieval</td><td>Failures %</td><td colspan="2">Low-Entailment Δ</td><td colspan="2">Med-Entailment Δ</td><td colspan="2">High-Entailment Δ</td></tr><tr><td rowspan="3">NQ</td><td>@1</td><td>0.0%</td><td>32.6%</td><td>+0.11</td><td>12.8%</td><td>+0.09</td><td>54.6%</td><td>+0.11</td></tr><tr><td>@10</td><td>0.0%</td><td>69.4%</td><td>+0.01</td><td>9.4%</td><td>+0.06</td><td>21.2%</td><td>+0.01</td></tr><tr><td>Random</td><td>0.0%</td><td>97.2%</td><td>-0.07</td><td>2.2%</td><td>-0.2</td><td>0.6%</td><td>0.0</td></tr><tr><td rowspan="3">2WIKIMQA</td><td>@1</td><td>0.4%</td><td>83.0%</td><td>+0.12</td><td>5.6%</td><td>+0.34</td><td>11.0%</td><td>+0.55</td></tr><tr><td>@10</td><td>2.8%</td><td>93.8%</td><td>-0.02</td><td>2.6%</td><td>-0.11</td><td>0.8%</td><td>+0.08</td></tr><tr><td>Random</td><td>37.0%</td><td>63.0%</td><td>-0.06</td><td>0.0%</td><td>0.0</td><td>0.0%</td><td>0.0</td></tr><tr><td rowspan="3">STRATEGYQA</td><td>@1</td><td>1.2%</td><td>96.2%</td><td>-0.07</td><td>2.4%</td><td>+0.17</td><td>0.2%</td><td>0.0</td></tr><tr><td>@10</td><td>2.6%</td><td>95.8%</td><td>-0.04</td><td>1.4%</td><td>0.0</td><td>0.2%</td><td>0.0</td></tr><tr><td>Random</td><td>34.4%</td><td>56.6%</td><td>-0.13</td><td>0.0%</td><td>0.0</td><td>0.0%</td><td>0.0</td></tr></table>
Table 8: Results for our NLI analysis. 'Failures' indicates that the decomposition model was not able to arrive at the answer (see §A.1). Other examples are split based on their entailment probability: low probability is $< \frac{1}{3}$ , medium probability is in $\left[\frac{1}{3},\frac{2}{3}\right]$ , and high probability is $>\frac{2}{3}$ . $\Delta$ indicates the improvement in accuracy when using retrieval. For NQ and 2WIKIMQA, many cases where retrieval is helpful have low entailment probability. For the implicit STRATEGYQA most examples have low entailment, but retrieval helps in the few examples with medium entailment.
<table><tr><td>Given the following question, answer it by providing follow up questions and intermediate answers. If intermediate questions are not necessary, answer the question directly.</td></tr><tr><td>#</td></tr><tr><td>Question: how did the big red one get its name</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: its shoulder patch</td></tr><tr><td>#</td></tr><tr><td>Question: where are the cayman islands on the map</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: western Caribbean Sea</td></tr><tr><td>#</td></tr><tr><td>Question: who won the war between north korea and south korea</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: technically still at war</td></tr><tr><td>#</td></tr><tr><td>Question: when does it's always sunny in philadelphia season 13 start</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: September 5, 2018</td></tr><tr><td>#</td></tr><tr><td>Question: who sang you got a friend in me from toy story</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: Randy Newman</td></tr><tr><td>#</td></tr><tr><td>Question: when was the first person sent to space</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: 12 April 1961</td></tr><tr><td>#</td></tr><tr><td>Question:</td></tr></table>
Figure 8: The SA-NR prompt used in our NQ experiments.
Given the following question, answer it by providing follow up questions and intermediate answers. If intermediate questions are not necessary, answer the question directly. You are provided with evidence that can help you arrive at the answer before the question.
<table><tr><td>#</td></tr><tr><td>Context1: The Big Red One: Fuller was a World War II veteran and served with the 1st Infantry Division, which is nicknamed "The Big Red One" for the red numeral "1" on the division's shoulder patch. He received the Silver Star, Bronze Star, and Purple Heart during his service.</td></tr><tr><td>Question: how did the big red one get its name</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: its shoulder patch</td></tr><tr><td>#</td></tr><tr><td>Context1: Location Map of Cayman Islands: The given Cayman Islands location map shows that the Cayman Islands are located in the western Caribbean Sea. Location Map of Cayman Islands. Where is Cayman ...</td></tr><tr><td>Question: where are the cayman islands on the map</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: western Caribbean Sea</td></tr><tr><td>#</td></tr><tr><td>Context1: Korean War — Combatants, Summary, Years, Map ... - Britannica: After more than a million combat casualties had been suffered on both sides, the fighting ended in July 1953 with Korea still divided into two hostile states. Negotiations in 1954 produced no further agreement, and the front line has been accepted ever since as the de facto boundary between North and South Korea.</td></tr><tr><td>Question: who won the war between north korea and south korea</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: technically still at war</td></tr><tr><td>#</td></tr><tr><td>Context1: It's Always Sunny in Philadelphia (season 13): The thirteenth season of the American comedy television series It's Always Sunny in Philadelphia premiered on FXX on September 5, 2018. ... The season consists of ...</td></tr><tr><td>Question: when does it's always sunny in philadelphia season 13 start</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: September 5, 2018</td></tr><tr><td>#</td></tr><tr><td>Context1: You've Got a Friend in Me: "You've Got a Friend in Me" is a song by Randy Newman. Used as the theme song for the 1995 Disney/Pixel animated film Toy Story, it has since become a major ...</td></tr><tr><td>Question: who sang you got a friend in me from toy story</td></tr><tr><td>Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: Randy Newman</td></tr><tr><td>#</td></tr><tr><td>Context1: April 1961: Yuri Gagarin from the Soviet Union was the first human in space. His vehicle, Vostok 1 circled Earth at a speed of 27,400 kilometers per hour with the flight lasting 108 minutes.</td></tr><tr><td>Question: when was the first person sent to space Are follow up questions needed here: No.</td></tr><tr><td>So the final answer is: 12 April 1961</td></tr><tr><td>#</td></tr><tr><td>Question:</td></tr></table>
Figure 9: The SA-R@1 prompt used in our NQ experiments.
Given the following question, answer it by providing follow up questions and intermediate answers. If intermediate questions are not necessary, answer the question directly. You are provided with evidence that can help you arrive at the answer before the question.
#
Context1: 16th Infantry Regiment (United States): As part of the new 1st Expeditionary Division, soon to become known as the 'Big Red One', the 16th Infantry, commanded by William Herbert Allaire Jr., sailed Question: how did the big red one get its name
Are follow up questions needed here: No.
So the final answer is: its shoulder patch
#
Context1: Module:Location map/data/Cayman Islands: Module:Location map/data/Cayman Islands is a location map definition used to overlay markers and labels on an equirectangular projection map of Cayman Question: where are the cayman islands on the map
Are follow up questions needed here: No.
So the final answer is: western Caribbean Sea #
Context1: First Battle of Seoul: The First Battle of Seoul, known in North Korean historiography as the Liberation of Seoul, was the North Korean capture of the South Korean capital, Seoul,
Question: who won the war between north korea and south korea
Are follow up questions needed here: No.
So the final answer is: technically still at war #
Context1: It's Always Sunny in Philadelphia (season 13): The thirteenth season of the American comedy television series It's Always Sunny in Philadelphia premiered on FXX on September 5, 2018.
Question: when does it's always sunny in philadelphia season 13 start
Are follow up questions needed here: No.
So the final answer is: September 5, 2018
Context1: Randy Newman – You've Got a Friend in Me Lyrics: ‘You’ve Got A Friend In Me’ is the theme song of the Toy Story franchise, recurring throughout the series in different contexts. It’s first
Question: who sang you got a friend in me from toy story
Are follow up questions needed here: No.
So the final answer is: Randy Newman #
Context1: Timeline of space exploration: This is a timeline of space exploration which includes notable achievements, first accomplishments and milestones in humanity's exploration of outer space.
Question: when was the first person sent to space Are follow up questions needed here: No.
So the final answer is: 12 April 1961
Question:
Figure 10: The SA-R@10 prompt used in our NQ experiments.123version https://git-lfs.github.com/spec/v1oid sha256:a2d78e842bcd5e106497c90ecf001ffff0d0d6fe8dca3266639648625de2473esize 1190597123version https://git-lfs.github.com/spec/v1oid sha256:8b075b5be24756a8d06b9e07ff6b14dc3aa873c0f929660361e65c803626d91esize 22293392123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508# MANIFOLD DIFFUSION FIELDS
Ahmed A. Elhag *, Yuyang Wang, Joshua M. Susskind, Miguel Angel Bautista Apple
{aa_elhag, yuyang_wang4, jsusskind, mbautistamartin}@apple.com
# ABSTRACT
We present Manifold Diffusion Fields (MDF), an approach that unlocks learning of diffusion models of data in general non-Euclidean geometries. Leveraging insights from spectral geometry analysis, we define an intrinsic coordinate system on the manifold via the eigen-functions of the Laplace-Beltrami Operator. MDF represents functions using an explicit parametrization formed by a set of multiple input-output pairs. Our approach allows to sample continuous functions on manifolds and is invariant with respect to rigid and isometric transformations of the manifold. In addition, we show that MDF generalizes to the case where the training set contains functions on different manifolds. Empirical results on multiple datasets and manifolds including challenging scientific problems like weather prediction or molecular conformation show that MDF can capture distributions of such functions with better diversity and fidelity than previous approaches.
# 1 INTRODUCTION
Approximating probability distributions from finite observational datasets is a pivotal machine learning challenge, with recent strides made in areas like text (Brown et al., 2020), images (Nichol & Dhariwal, 2021), and video (Ho et al., 2022). The burgeoning interest in diffusion generative models (Ho et al., 2020; Nichol & Dhariwal, 2021; Song et al., 2021b) can be attributed to their stable optimization goals and fewer training anomalies (Kodali et al., 2017). However, fully utilizing the potential of these models across scientific and engineering disciplines remains an open problem. While diffusion generative models excel in domains with Euclidean (i.e. flat) spaces like 2D images or 3D geometry and video, many scientific problems involve reasoning about continuous functions on curved spaces (i.e. Riemannian manifolds). Examples include climate observations on the sphere (Hersbach et al., 2020; Lindgren et al., 2011) or solving PDEs on curved surfaces, which is a crucial problem in areas like quantum mechanics (Bhabha, 1945) and molecular conformation (Jing et al., 2022). Recent works have tackled the problem of learning generative models of continuous functions following either adversarial formulations (Dupont et al., 2022b), latent parametrizations (Dupont et al., 2022a; Du et al., 2021; Bauer et al., 2023), or diffusion models (Bond-Taylor & Willcocks, 2023; Zhuang et al., 2023). While these approaches have shown promise on functions within the Euclidean domain, the general case of learning generative models of functions on Riemannian manifolds remains unexplored.
In this paper, we introduce Manifold Diffusion Fields (MDF), extending generative models over functions to the Riemannian setting. We take the term function and field to have equivalent meaning throughout the paper. Note that these are not to be confused with gradient vector fields typically used on manifold. These fields $f: \mathcal{M} \to \mathcal{V}$ map points from a manifold $\mathcal{M}$ (that might be parametrized as a 3D mesh, graph or even a pointcloud, see Sect. 5.2) to corresponding values in signal space $\mathcal{V}$ . MDF is trained on collections of fields and learns a generative model that can sample different fields over a manifold. In Fig. 1 we show real samples of such functions for different manifolds, as well as samples generated by MDF.
Here are our main contributions:
- We borrow insights from spectral geometry analysis to define a coordinate system for points in manifolds using the eigen-functions of the Laplace-Beltrami Operator.
 Real samples Figure 1: MDF learns a distribution over a collection of fields $f:\mathcal{M}\to \mathbb{R}^d$ , where each field is defined on a manifold $\mathcal{M}$ . We show real samples and MDF's generations on different datasets of fields defined on different manifolds. First row: MNIST digits on the sine wave manifold. Second row Middle: ERA5 climate dataset (Hersbach et al., 2020) on the 2D sphere. Third row: GMM dataset on the bunny manifold. Fourth row: molecular conformations in GEOM-QM9 (Ruddigkeit et al., 2012) given the molecular graph.
 Samples generated by MDF
- We formulate an end-to-end generative model for functions defined on manifolds, allowing sampling different fields over a manifold. Focusing on practical settings, our extensive experimental evaluation covers graphs, meshes and pointclouds as approximations of manifolds. - Our model outperforms recent approaches like (Zhuang et al., 2023; Dupont et al., 2022b), yielding diverse and high fidelity samples, while being robust to rigid and isometric manifold transformations. Results on climate modeling datasets (Hersbach et al., 2020) and PDE problems show the practicality of MDF in scientific domains. - On the challenging problem of molecular conformer generation, MDF obtains state-of-the-art results on GEOM-QM9 (Ruddigkeit et al., 2012).
# 2 RELATED WORK
Our approach extends recent efforts in generative models for continuous functions in Euclidean space (Zhuang et al., 2023; Dupont et al., 2022b; a; Du et al., 2021), shown Fig. 2(a), to functions defined over manifolds, see Fig. 2(b). The term Implicit Neural Representation (INR) is used in these works to denote a parameterization of a single function (e.g. a single image in 2D) using a neural network that maps the function's inputs (i.e. pixel coordinates) to its outputs (i.e. RGB values). Different approaches have been proposed to learn distributions over fields in Euclidean space, GASP (Dupont et al., 2022b) leverages a GAN whose generator produces field data whereas a point cloud discriminator operates on discretized data and aims to differentiate real and generated functions. Two-stage approaches (Dupont et al., 2022a; Du et al., 2021) adopt a latent field parameterization (Park et al., 2019) where functions are parameterized via a hyper-network (Ha et al., 2017) and a generative model is learnt on the latent or INR representations. In addition, MDF also relates to recent work focusing on fitting a function (e.g. learning an INR) on a manifold using an intrinsic coordinate system (Koestler et al., 2022; Grattarola & Vandergheynst, 2022), and generalizes it to the problem of learning a probabilistic model over multiple functions defined on a manifold.
Intrinsic coordinate systems have also been recently used in the context of Graph Transformers (Maskey et al., 2022; Sharp et al., 2022; He et al., 2022; Dwivedi et al., 2020), where eigenvectors of the Graph Laplacian are used to replace standard positional embeddings (in addition to also
 (a) $f\sim q(f)|f:\mathbb{R}^2\to \mathcal{V}$ Figure 2: (a) Generative models of fields in Euclidean space (Zhuang et al., 2023; Dupont et al., 2022b;a; Du et al., 2021) learn a distribution $p_{\theta}$ over functions whose domain is $\mathbb{R}^n$ . We show an example where each function is the result of evaluating a Gaussian mixture with 3 random components in 2D. (b) MDF learns a distribution $p_{\theta}$ from a collection of fields whose domain is a general Riemannian manifold $f \sim q(f)|f : \mathcal{M} \to \mathcal{V}$ . Similarly, as an illustrative example each function is the result of evaluating a Gaussian mixture with 3 random components on $\mathcal{M}$ (i.e. the Stanford bunny). (c) Riemannian generative models (Bortoli et al., 2022; Gemici et al., 2016; Rozen et al., 2021; Chen & Lipman, 2023) learn a parametric distribution $p_{\theta}$ from an empirical observations $x \sim q(x)|x \in \mathcal{M}$ of points $x$ on a Riemannian manifold $\mathcal{M}$ , denoted by black dots on the manifold.
 $p_{\theta}(f)|f:\mathbb{R}^2\to \mathcal{V}$

 (b)
 $f\sim q(f)|f:\mathcal{M}\to \mathcal{V}$ $p_{\theta}(f)|f:\mathcal{M}\to \mathcal{V}$
 (c) $\mathbf{x}\sim q(\mathbf{x})|\mathbf{x}\in \mathcal{M}$ $p_{\theta}(\mathbf{x})|\mathbf{x}\in \mathcal{M}$
using edge features). In this setting, Graph Transformer architectures have been used for supervised learning problems like graph/node classification and regression, whereas we focus on generative modeling.
The learning problem we tackle with MDF can be interpreted as lifting the Riemannian generative modeling problem (Bortoli et al., 2022; Gemici et al., 2016; Rozen et al., 2021; Chen & Lipman, 2023) to function spaces. Fig. 2(b)(c) show the training setting for the two problems, which are related but not directly comparable. MDF learns a generative model over functions defined on manifolds, e.g. a probability density over functions $f: \mathcal{M} \to \mathcal{V}$ that map points in the manifold $\mathcal{M}$ to a signal space $\mathcal{V}$ . In contrast, the goal in Riemannian generative modeling is to learn a probability density from an observed set of points living in a Riemannian manifold $\mathcal{M}$ . For example, in the case of the bunny, shown in Fig. 2(c), a Riemannian generative model learns a distribution of points $x \in \mathcal{M}$ on the manifold.
MDF is also related to work on Neural Processes (Garnelo et al., 2018; Kim et al., 2019; Dutordoir et al., 2022), which also learn distributions over functions. As opposed to the formulation of Neural Processes which optimizes an ELBO (Kingma & Welling, 2014) we formulate MDF as a denoising diffusion process in function space, which results in a robust training objective and a powerful inference process. Moreover, our work relates to formulations of Gaussian Processes (GP) on Riemannian manifolds (Borovitskiy et al., 2020; Hutchinson et al., 2021). These approaches are GP formulations of Riemannian generative modeling (see Fig. 2), in the sense that they learn conditional distributions of points on the manifold, as opposed to distributions over functions on the manifold like MDF.
# 3 PRELIMINARIES
# 3.1 DENOISING DIFFUSION PROBABILISTIC MODELS
Denoising Diffusion Probabilistic Models (Ho et al., 2020) (DDPMs) belong to the broad family of latent variable models. We refer the reader to (Everett, 2013) for an in depth review. In short, to learn a parametric data distribution $p_{\theta}(\pmb{x}_0)$ from an empirical distribution of finite samples $q(\pmb{x}_0)$ , DDPMs reverse a diffusion Markov Chain that generates latents $\pmb{x}_{1:T}$ by gradually adding Gaussian noise to the data $\pmb{x}_0 \sim q(\pmb{x}_0)$ for $T$ time-steps as follows: $q(\pmb{x}_t|\pmb{x}_{t-1}) \coloneqq \mathcal{N}(\pmb{x}_{t-1}; \sqrt{\bar{\alpha}_t}\pmb{x}_0, (1 - \bar{\alpha}_t)\mathbf{I})$ . Here, $\bar{\alpha}_t$ is the cumulative product of fixed variances with a handcrafted scheduling up to time-step $t$ . (Ho et al., 2020) introduce an efficient training recipe in which: i) The forward process adopts sampling in closed form. ii) reversing the diffusion process is equivalent to learning a sequence of denoising (or score) networks $\epsilon_{\theta}$ , with tied weights. Reparameterizing the forward process as $\pmb{x}_t = \sqrt{\bar{\alpha}_t}\pmb{x}_0 + \sqrt{1 - \bar{\alpha}_t}\epsilon$ results in the "simple" DDPM loss: $\mathbb{E}_{t \sim [0,T],\pmb{x}_0 \sim q(\pmb{x}_0),\epsilon \sim \mathcal{N}(0,\mathbf{I})} \left[ \| \epsilon - \epsilon_{\theta}(\sqrt{\bar{\alpha}_t}\pmb{x}_0 + \sqrt{1 - \bar{\alpha}_t}\epsilon, t) \|^2 \right]$ , which makes learning of the data distribution $p_{\theta}(\pmb{x}_0)$ both efficient and scalable.
At inference time, we compute $\pmb{x}_0 \sim p_{\theta}(\pmb{x}_0)$ via ancestral sampling (Ho et al., 2020). Concretely, we start by sampling $\pmb{x}_T \sim \mathcal{N}(\mathbf{0}, \mathbf{I})$ and iteratively apply the score network $\epsilon_{\theta}$ to denoise $\pmb{x}_T$ , thus reversing the diffusion Markov Chain to obtain $\pmb{x}_0$ . Sampling $\pmb{x}_{t-1} \sim p_{\theta}(\pmb{x}_{t-1} | \pmb{x}_t)$ is equivalent to computing the update: $\pmb{x}_{t-1} = \frac{1}{\sqrt{\alpha_t}} \left( \pmb{x}_t - \frac{1 - \alpha_t}{\sqrt{1 - \alpha_t}} \epsilon_{\theta}(\pmb{x}_t, t) \right) + \mathbf{z}$ , where at each inference step a stochastic component $z \sim \mathcal{N}(\mathbf{0}, \mathbf{I})$ is injected, resembling sampling via Langevin dynamics (Welling & Teh, 2011). In practice, DDPMs have obtained amazing results for signals living in an Euclidean grid (Nichol & Dhariwal, 2021; Ho et al., 2022). However, the extension to functions defined on curved manifolds remains an open problem.
# 3.2 RIEMANNIAN MANIFOLDS
Previous work on Riemannian generative models (Bortoli et al., 2022; Gemici et al., 2016; Rozen et al., 2021; Chen & Lipman, 2023) develops machinery to learn distribution from a training set of points living on Riemannian manifolds. In this work, we assume manifolds are compact and connected Riemannian manifolds $\mathcal{M}$ equipped with a smooth metric $g: T_{\pmb{x}}\mathcal{M} \times T_{\pmb{x}}\mathcal{M} \to \mathbb{R}_{\geq 0}$ (e.g. a smoothly varying inner product from which a distance can be constructed on $\mathcal{M}$ ). A core tool in Riemannian manifolds is the tangent space, this space defines the tangent hyper-plane of a point $\pmb{x} \in \mathcal{M}$ and is denoted by $T_{\pmb{x}}\mathcal{M}$ . This tangent space $T_{\pmb{x}}\mathcal{M}$ is used to define inner products $\langle \pmb{u}, \pmb{v} \rangle_g, \pmb{u}, \pmb{v} \in T_{\pmb{x}}\mathcal{M}$ , which in turns defines $g$ . The tangent bundle $T\mathcal{M}$ is defined as the collection of tangent spaces for all points $T_{\pmb{x}}\mathcal{M} \forall \pmb{x} \in \mathcal{M}$ .
In practice we cannot assume that for general geometries (e.g. geometries for which we don't have access to a closed form and are commonly represented as graphs/meshes) one can efficiently compute $g$ . While it is possible to define an analytical form for the Riemannian metric $g$ on simple parametric manifolds (e.g. hyper-spheres, hyperbolic spaces, tori), general geometries (i.e. the Stanford bunny) are inherently discrete and irregular, which can make it expensive to even approximate $g$ . To mitigate these issues MDF is formulated from the ground up without relying on access to an analytical form for $g$ or the tangent bundle $T\mathcal{M}$ and allows for learning a distribution of functions defined on general geometries.
# 3.3 LAPLACE-BELTRAMI OPERATOR
The Laplace-Beltrami Operator (LBO) denoted by $\Delta_{\mathcal{M}}$ is one of the cornerstones of differential geometry and can be intuitively understood as a generalization of the Laplace operator to functions defined on Riemannian manifolds $\mathcal{M}$ . Intuitively, the LBO encodes information about the curvature of the manifold and how it bends and twists at every point, reflecting the intrinsic geometry. One of the basic uses of the Laplace-Beltrami operator is to define a functional basis on the manifold by solving the general eigenvalue problem associated with $\Delta_{\mathcal{M}}$ , which is a foundational technique in spectral geometry analysis (Levy, 2006). The eigen-decomposition of $\Delta_{\mathcal{M}}$ are the non-trivial solutions to the equation $\Delta_{\mathcal{M}}\varphi_i = \lambda_i\varphi_i$ . The eigen-functions $\varphi_i: \mathcal{M} \to \mathbb{R}$ represent an orthonormal functional basis for the space of square integrable functions (Levy, 2006; Minakshisundaram & Pleijel, 1949). Thus, one can express a square integrable function $f: \mathcal{M} \to \mathcal{V}$ , with $f \in L^2$ as a linear combination of the functional basis, as follows: $f = \sum_{i=1}^{\infty} \langle f, \varphi_i \rangle \varphi_i$ .
In practice, the infinite sum is truncated to the $k$ eigen-functions with lowest eigen-values, where the ordering of the eigen-values $\lambda_1 < \lambda_2 < \dots < \lambda_k$ enables a low-pass filter of the basis. Moreover, (Levy, 2006) shows that the eigen-functions of $\Delta_M$ can be interpreted as a Fourier-like function basis (Vallet & Levy, 2008) on the manifold, e.g. an intrinsic coordinate system for the manifold. In particular, if $\mathcal{M} = S^2$ this functional basis is equivalent to spherical harmonics, and in Euclidean space it becomes a Fourier basis which is typically used in implicit representations (Xie et al., 2022). MDF uses the eigen-functions of the LBO $\Delta_{\mathcal{M}}$ to define a Fourier-like positional embedding (PE) for points on $\mathcal{M}$ (see Fig. 3). Note that these eigen-functions are only defined for points that lie on the manifold, making MDF strictly operate on the manifold.
# 4 METHOD
MDF is a diffusion generative model that captures distributions over fields defined on a Riemannian manifold $\mathcal{M}$ . We are given observations in the form of an empirical distribution $f_0 \sim q(f_0)$ over
 Figure 3: Left: Fourier PE of a point $\pmb{x}$ in 2D Euclidean space. Generative models of functions in ambient space (Zhuang et al., 2023; Dupont et al., 2022b;a; Du et al., 2021) use this representation to encode a function's input. Right: MDF uses the eigen-functions $\varphi_{i}$ of the Laplace-Beltrami Operator (LBO) $\Delta_{\mathcal{M}}$ evaluated at a point $\pmb{x} \in \mathcal{M}$ .
fields where a field $f_0: \mathcal{M} \to \mathcal{V}$ maps points from a manifold $\mathcal{M}$ to a signal space $\mathcal{V}$ . As a result, latent variables $f_{1:T}$ are also fields on manifolds that can be continuously evaluated.
To tackle the problem of learning a diffusion generative model over fields we employ a similar recipe to (Zhuang et al., 2023), generalizing from fields defined on Euclidean domains to functions on Riemannian manifolds. In order to this we use the first $k$ eigen-functions $\varphi_{i=1:k}$ of $\Delta_M$ to define a Fourier-like representation on $\mathcal{M}$ . Note that our model is independent of the particular parametrization of the LBO, e.g. cotangent, point cloud (Sharp & Crane, 2020) or graph laplacians can be used depending on the available manifold parametrization (see Sect. 5.2 for experimental results). We use the term $\varphi(\boldsymbol{x}) = \sqrt{n}[\varphi_1(\boldsymbol{x}), \varphi_2(\boldsymbol{x}), \ldots, \varphi_k(\boldsymbol{x})] \in \mathbb{R}^k$ to denote the normalized eigen-function representation of a point $\boldsymbol{x} \in \mathcal{M}$ . In Fig. 3 we show a visual comparison of standard Fourier PE on Euclidean space and the eigen-functions of the LBO on a manifold.
We adopt an explicit field parametrization (Zhuang et al., 2023), where a field is characterized by a set of coordinate-signal pairs $\{(\varphi(\boldsymbol{x}_c), \boldsymbol{y}_{(c,0)})\}$ , $\boldsymbol{x}_c \in \mathcal{M}$ , $\boldsymbol{y}_{(c,0)} \in \mathcal{V}$ , which is denoted as context set. We row-wise stack the context set and refer to the resulting matrix via $\mathbf{C}_0 = [\varphi(\mathbf{X}_c), \mathbf{Y}_{(c,0)}]$ . Here, $\varphi(\mathbf{X}_c)$ denotes the eigen-function representation of the coordinate portion and $\mathbf{Y}_{(c,0)}$ denotes the signal portion of the context set at time $t = 0$ . We define the forward process for the context set by diffusing the signal and keeping the eigen-functions fixed:
$$\mathbf {C} _ {t} = \left[ \varphi \left(\mathbf {X} _ {c}\right), \mathbf {Y} _ {(c, t)} = \sqrt {\bar {\alpha} _ {t}} \mathbf {Y} _ {(c, 0)} + \sqrt {1 - \bar {\alpha} _ {t}} \epsilon_ {c} \right], \tag {1}$$
where $\epsilon_{c} \sim \mathcal{N}(\mathbf{0},\mathbf{I})$ is a noise vector of the appropriate size. We now turn to the task of formulating a score network for fields. Following (Zhuang et al., 2023), the score network needs to take as input the context set (i.e. the field parametrization), and needs to accept being evaluated continuously in $\mathcal{M}$ . We do this by employing a query set $\{\pmb{x}_q,\pmb{y}_{(q,0)}\}$ . Equivalently to the context set, we row-wise stack query pairs and denote the resulting matrix as $\mathbf{Q}_0 = [\varphi (\mathbf{X}_q),\mathbf{Y}_{(q,0)}]$ . Note that the forward diffusion process is equivalently defined for both context and query sets:
$$\mathbf {Q} _ {t} = \left[ \varphi \left(\mathbf {X} _ {q}\right), \mathbf {Y} _ {(q, t)} = \sqrt {\bar {\alpha} _ {t}} \mathbf {Y} _ {(q, 0)} + \sqrt {1 - \bar {\alpha} _ {t}} \epsilon_ {q} \right], \tag {2}$$
where $\epsilon_q\sim \mathcal{N}(\mathbf{0},\mathbf{I})$ is a noise vector of the appropriate size. The underlying field is solely defined by the context set, and the query set are the function evaluations to be de-noised. The resulting score field model is formulated as follows, $\hat{\epsilon_{q}} = \epsilon_{\theta}(\mathbf{C}_{t},t,\mathbf{Q}_{t})$
Using the explicit field characterization and the score field network, we obtain the training and inference procedures in Alg. 1 and Alg. 2, respectively, which are accompanied by illustrative examples of sampling a field encoding a Gaussian mixture model over the manifold (i.e. the bunny). For training, we uniformly sample context and query sets from $f_0 \sim \mathrm{Uniform}(q(f_0))$ and only corrupt their signal using the forward process in Eq. equation 1 and Eq. equation 2. We train the score field network $\epsilon_{\theta}$ to denoise the signal portion of the query set, given the context set. During sampling, to generate a field $f_0 \sim p_{\theta}(f_0)$ we first define a query set $\mathbf{Q}_T = [\varphi(\mathbf{X}_q), \mathbf{Y}_{(q,T)} \sim \mathcal{N}(\mathbf{0}, \mathbf{I})]$ of random values to be de-noised. Similar to (Zhuang et al., 2023) we set the context set to be a random subset of the query set. We use the context set to denoise the query set and follow ancestral sampling as in the vanilla DDPM (Ho et al., 2020). Note that during inference the eigen-function representation $\varphi(x)$ of the context and query sets does not change, only their corresponding signal value.
# Algorithm 1 Training
1: $\Delta_{\mathcal{M}}\varphi_i = \varphi_i\lambda_i / / \mathrm{LBO}$ eigen-decomposition 2: repeat 3: $(\mathbf{C}_0,\mathbf{Q}_0)\sim \mathrm{Uniform}(q(f_0))$ 4: $t\sim \mathrm{Uniform}(\{1,\ldots ,T\})$ 5: $\epsilon_{c}\sim \mathcal{N}(\mathbf{0},\mathbf{I}),\epsilon_{q}\sim \mathcal{N}(\mathbf{0},\mathbf{I})$ 6: $\mathbf{C}_t = [\varphi (\mathbf{X}_c),\sqrt{\bar{\alpha}_t}\mathbf{Y}_{(c,0)} + \sqrt{1 - \bar{\alpha}_t}\epsilon_c]$ 7: $\mathbf{Q}_t = [\varphi (\mathbf{X}_q),\sqrt{\bar{\alpha}_t}\mathbf{Y}_{(q,0)} + \sqrt{1 - \bar{\alpha}_t}\epsilon_q]$ 8: Take gradient descent step on
$$\nabla_ {\boldsymbol {\theta}} \left\| \epsilon_ {q} - \epsilon_ {\boldsymbol {\theta}} (\mathbf {C} _ {t}, t, \mathbf {Q} _ {t}) \right\| ^ {2}$$
9: until converged
 Figure 4: Left: MDF training algorithm. Right: Visual depiction of a training iteration for a field on the bunny manifold $\mathcal{M}$ . See Sect. 4 for definitions.
# Algorithm 2 Sampling
1: $\Delta_{\mathcal{M}}\varphi_{i} = \varphi_{i}\lambda_{i} / / \mathrm{LBO}$ eigen-decomposition 2: $\mathbf{Q}_T = [\varphi (\mathbf{X}_q),\mathbf{Y}_{(q,t)}\sim \mathcal{N}(\mathbf{0}_q,\mathbf{I}_q)]$ 3: $\mathbf{C}_T\subseteq \mathbf{Q}_T$ 4: for $t = T, \dots, 1$ do 5: $z\sim \mathcal{N}(\mathbf{0},\mathbf{I})$ if $t > 1$ , else $z = 0$ 6: $\mathbf{Y}_{(q,t - 1)} = \frac{1}{\sqrt{\alpha_t}}\left(\mathbf{Y}_{(q,t)} - \frac{1 - \alpha_t}{\sqrt{1 - \alpha_t}}\epsilon_\theta (\mathbf{C}_t,t,\mathbf{Q}_t)\right) + \sigma_t\mathbf{z}$ 7: $\mathbf{Q}_{t - 1} = [\mathbf{M}_q,\mathbf{Y}_{(q,t - 1)}]$ 8: $\mathbf{C}_{t - 1}\subseteq \mathbf{Q}_{t - 1}$ ▷ Same subset as in step 2 9: end for 0: return $f_{0}$ evaluated at coordinates $\varphi(\mathbf{X}_{q})$
 Figure 5: Left: MDF sampling algorithm. Right: Visual depiction of the sampling process for a field on the bunny manifold.
# 5 EXPERIMENTS
We validate the practicality of MDF via extensive experiments including synthetic and real-world problems. In Sect. 5.1 we provide results for learning distributions of functions on a fixed manifold (e.g. climate science), where functions change but manifolds are fixed across all functions. In addition, in Sect. 5.2 we show that MDF is robust to different manifold parametrizations. Finally, in Sect. 5.3 we also provide results on a generalized setting where manifolds are different for each function (e.g. molecule conformer generation). As opposed to generative models over images, we cannot rely on FID (Heusel et al., 2017) type metrics for evaluation since functions are defined on curved geometries. We borrow metrics from generative modeling of point cloud data (Achlioptas et al., 2018), namely Coverage (COV) and Minimum Matching Distance (MMD). We compute COV and MMD metrics based on the $l_{2}$ distance in signal space for corresponding vertices in the manifolds.
# 5.1 DISTRIBUTIONS OF FUNCTIONS ON A FIXED MANIFOLD
We evaluate MDF on 3 different manifolds that are fixed across functions: a sine wave, the Stanford bunny and a human mesh. These manifolds have an increasing average mean curvature $|K|$ (averaged over vertices), which serves as a measure for how distant they are from being globally Euclidean. On each manifold we define 3 function datasets: a Gaussian Mixture (GMM) with 3 components (where in each field the 3 components are randomly placed on the manifold), MNIST (LeCun et al., 1998) and CelebA-HQ (Karras et al., 2018) images. We use an off-the-shelf texture mapping approach (Sullivan & Kaszynski, 2019) to map images to manifolds, see Fig. 1. We compare MDF with Diffusion Probabilistic Fields (DPF) (Zhuang et al., 2023) a generative model for fields in ambient space, where points in the manifold are parametrized by the Fourier PE of its coordinates in 3D space. To provide a fair comparison we equate all the hyper-parameters in both MDF and DPF (Zhuang
<table><tr><td></td><td colspan="2">GMM</td><td colspan="2">MNIST</td><td colspan="2">CelebA-HQ</td></tr><tr><td></td><td>COV↑</td><td>MMD ↓</td><td>COV↑</td><td>MMD↓</td><td>COV↑</td><td>MMD ↓</td></tr><tr><td>MDF</td><td>0.444</td><td>0.01405</td><td>0.564</td><td>0.0954</td><td>0.354</td><td>0.11601</td></tr><tr><td>DPF</td><td>0.352</td><td>0.01339</td><td>0.552</td><td>0.09633</td><td>0.361</td><td>0.12288</td></tr></table>
<table><tr><td></td><td colspan="2">GMM</td><td colspan="2">MNIST</td><td colspan="2">CelebA-HQ</td></tr><tr><td></td><td>COV↑</td><td>MMD ↓</td><td>COV↑</td><td>MMD↓</td><td>COV↑</td><td>MMD ↓</td></tr><tr><td>MDF</td><td>0.551</td><td>0.00100</td><td>0.529</td><td>0.08895</td><td>0.346</td><td>0.14162</td></tr><tr><td>DPF</td><td>0.479</td><td>0.00112</td><td>0.472</td><td>0.09537</td><td>0.318</td><td>0.14502</td></tr></table>
Table 1: COV and MMD metrics for different datasets on the wave manifold (mean curvature $|K| = 0.004$ ).
<table><tr><td></td><td colspan="2">GMM</td><td colspan="2">MNIST</td><td colspan="2">CelebA-HQ</td></tr><tr><td></td><td>COV↑</td><td>MMD ↓</td><td>COV↑</td><td>MMD↓</td><td>COV↑</td><td>MMD ↓</td></tr><tr><td>MDF</td><td>0.575</td><td>0.00108</td><td>0.551</td><td>0.07205</td><td>0.346</td><td>0.11101</td></tr><tr><td>DPF</td><td>0.472</td><td>0.00120</td><td>0.454</td><td>0.11525</td><td>0.313</td><td>0.11530</td></tr></table>
Table 3: Human manifold (mean curvature $|K| =$ 25.966). At high mean curvatures MDF consistently outperforms DPF (Zhuang et al., 2023).
<table><tr><td></td><td colspan="2">M → M</td><td colspan="2">M → Miso</td><td colspan="2">Miso → Miso</td></tr><tr><td></td><td>COV↑</td><td>MMD↓</td><td>COV↑</td><td>MMD ↓</td><td>COV↑</td><td>MMD ↓</td></tr><tr><td>MDF</td><td>0.595</td><td>0.00177</td><td>0.595</td><td>0.00177</td><td>0.582</td><td>0.00191</td></tr><tr><td>DPF</td><td>0.547</td><td>0.00189</td><td>0.003</td><td>0.08813</td><td>0.306</td><td>0.00742</td></tr></table>
et al., 2023). Tab. 1-2-3 show results for the different approaches and tasks. We observe that MDF tends to outperform DPF (Zhuang et al., 2023), both in terms of covering the empirical distribution, resulting in higher COV, but also in the fidelity of the generated fields, obtaining a lower MMD. In particular, MDF outperforms DPF (Zhuang et al., 2023) across the board for manifolds of large mean curvature $|K|$ . We attribute this behaviour to our choice of using intrinsic functional basis (e.g. eigen-functions of the LBO) to represent a coordinate system for points in the manifold. Fig. 1 shows a side to side comparison of real and generated functions on different manifolds obtained from MDF.
We also compare MDF with GASP (Dupont et al., 2022b), a generative model for continuous functions using an adversarial formulation. We compare MDF and GASP performance on the CelebA-HQ dataset (Karras et al., 2018) mapped on the bunny manifold. Additionally, we report results on the ERA5 climate dataset (Dupont et al., 2022b), which is composed of functions defined on the sphere $f: S^2 \to \mathbb{R}^1$ (see Fig. 1). For the ERA5 dataset we use spherical harmonics to compute $\varphi$ , which are equivalent to the analytical eigen-functions of the LBO on the sphere (Levy, 2006). To compare with GASP we use their pre-trained models to generate samples. In the case of CelebA-HQ, we use GASP to generate 2D images and map them to the bunny manifold using (Sullivan & Kaszynski, 2019). Experimental results in Tab. 5 show that MDF outperforms GASP in both ERA5(Hersbach et al., 2020) and CelebA-HQ datasets, obtaining both higher coverage but also higher fidelity in generated functions. This can be observed in Fig. 6 where the samples generated by MDF are visually crisp than those generated by GASP.
Table 2: Results on the bunny manifold (mean curvature $|K| = 7.388$ ). As the mean curvature increases the boost of MDF over DPF (Zhuang et al., 2023) becomes larger across all datasets. Table 4: Training MDF on a manifold $\mathcal{M}$ and evaluating it on an isometric transformation $\mathcal{M}_{\mathrm{iso}}$ does not impact performance, while being on par with training directly on the transformed manifold.
<table><tr><td></td><td colspan="2">ERA5</td><td colspan="2">CelebA-HQ on M</td></tr><tr><td></td><td>COV↑</td><td>MMD ↓</td><td>COV↑</td><td>MMD ↓</td></tr><tr><td>MDF</td><td>0.347</td><td>0.00498</td><td>0.346</td><td>0.11101</td></tr><tr><td>GASP</td><td>0.114</td><td>0.00964</td><td>0.309</td><td>0.38979</td></tr></table>
Table 5: MDF outperforms GASP on ERA5(Hersbach et al., 2020) and CelebAHQ both in terms of fidelity and distribution coverage. For GASP, we generate CelebA-HQ images and texture map them to the bunny manifold using (Sullivan & Kaszynski, 2019).
 Figure 6: CelebA-HQ samples generated by MDF and GASP (Dupont et al., 2022b) on the bunny.
Furthermore, we ablate the performance of MDF as the number of eigen-functions used to compute the coordinate representation $\varphi$ increases (e.g. the eigen-decomposition of the LBO). For this task we use the bunny and the GMM dataset. Results in Fig. 7 show that performance initially increases with the number of eigen-functions up to a point where high frequency eigen-functions of the LBO are not needed to faithfully encode the distribution of functions.

 Figure 7: Performance of MDF as a function of the number of eigen-functions of the LBO, measured by COV and MMD metrics. As expected, performance increases initially as more eigen-functions are used, followed by a plateau phase for more than $k = 32$ eigen-functions.
# 5.2 MANIFOLD PARAMETRIZATION
MDF uses the eigen-functions of the LBO as positional embeddings. In practice, different real-world problems parametrize manifolds in different ways, and thus, have different ways of computing the LBO. For example, in computer graphics the usage of 3D meshes and cotangent Laplacians (Rustamov et al., 2007) is widespread. In computer vision, 3D geometry can also be represented as point clouds which enjoy sparsity benefits and for which Laplacians can also be computed (Sharp & Crane, 2020). Finally, in computational chemistry problems, molecules are represented as undirected graphs of atoms connected by bonds, in this case graph Laplacians are commonly used (Maskey et al., 2022). In Fig. 8 we show the top-2 eigenvectors of these different Laplacians on the bunny manifold. In Tab. 6 we show the performance of MDF on the bunny mesh on different datasets using different manifold parametrizations and their respective Laplacian computation. These results show that MDF is relatively robust to different Laplacians and can be readily applied to any of these different settings by simply computing eigenvectors of the appropriate Laplacian.
<table><tr><td></td><td colspan="2">GMM</td><td colspan="2">MNIST</td><td colspan="2">CelebA-HQ</td></tr><tr><td></td><td>COV↑</td><td>MMD ↓</td><td>COV↑</td><td>MMD↓</td><td>COV↑</td><td>MMD ↓</td></tr><tr><td>Graph</td><td>0.575</td><td>0.00108</td><td>0.551</td><td>0.07205</td><td>0.346</td><td>0.11101</td></tr><tr><td>Cotangent</td><td>0.581</td><td>0.00384</td><td>0.568</td><td>0.06890</td><td>0.374</td><td>0.12440</td></tr><tr><td>Pointcloud</td><td>0.588</td><td>0.00417</td><td>0.571</td><td>0.06909</td><td>0.337</td><td>0.12297</td></tr></table>
Table 6: Performance of MDF using different Laplacians for different datasets on the bunny manifold, where we see that MDF is relatively robust and can be readily deployed on different settings depending on the manifold parametrization.
 Figure 8: Visualizing top-2 eigenvectors on the bunny manifold for Graph, Cotangent and Pointcloud (Sharp & Crane, 2020) Laplacians.
# 5.3 GENERALIZING ACROSS MANIFOLDS
We now generalize the problem setting to learning distributions over functions where each function is defined on a different manifold. In this setting, the training set is defined as $\{f_i\}_{i = 0:N}$ with functions $f_{i}:\mathcal{M}_{i}\to \mathcal{V}$ mapping elements from different manifolds $\mathcal{M}_i$ to a shared signal space $\mathcal{V}$ . This is a generalization of the setting in Sect. 5.1 where functions are defined as $f_{i}:\mathcal{M}\rightarrow Y$ , with the manifold $\mathcal{M}$ being fixed across $f_{i}$ 's. This generalized setting is far more complex than the fixed setting since the model not only has to figure out the distribution of functions but also it needs to represent different manifolds in a consistent manner. To evaluate the performance of MDF in this setting we tackle the challenging problem of molecule conformer generation (Xu et al., 2021; 2022; Ganea et al., 2021; Jing et al., 2022) which is a fundamental task in computational chemistry and requires models to handle multiple manifolds. In this problem, manifolds $\mathcal{M}_i$ are parametrized as graphs that encode the connectivity structure between atoms of different types. From MDF's perspective a conformer is then a function $f_{i}:\mathcal{M}_{i}\to \mathbb{R}^{3}$ that maps elements in the graph (e.g. atoms) to a point in 3D space. Note that graphs are just one of different the manifold representations that are amenable for MDF as show in Sect. 5.2.
Following the standard setting for molecule conformer prediction we use the GEOM-QM9 dataset (Ruddigkeit et al., 2012; Ramakrishnan et al., 2014) which contains $\sim 130\mathrm{K}$ molecules ranging from $\sim 10$ to $\sim 40$ atoms. We report our results in Tab. 7 and compare with CGCF (Xu et al., 2021), GeoDiff (Xu et al., 2022), GeoMol (Ganea et al., 2021) and Torsional Diffusion (Jing et al., 2022). Note that both GeoMol (Ganea et al., 2021) and Torsional Diffusion (Jing et al., 2022) make strong assumptions about the geometric structure of molecules and model domain-specific characteristics like torsional angles of bonds. In contraposition, MDF simply models the distribution of 3D coordinates of atoms without making any assumptions about the underlying structure. We use the same train/val/test splits as Torsional Diffusion (Jing et al., 2022) and use the same metrics to compare the generated and ground truth conformer ensembles: Average Minimum RMSD (AMR) and Coverage. These metrics are reported both for precision, measuring the accuracy of the generated conformers, and recall, which measures how well the generated ensemble covers the ground-truth ensemble. We generate 2K conformers for a molecule with K ground truth conformers. Note that in this setting, models are evaluated on unseen molecules (e.g. unseen manifolds $\mathcal{M}_i$ ).
We report results on Tab. 7 where we see how MDF outperforms previous approaches. It is important to note that MDF is a general approach for learning functions on manifolds that does not make any assumptions about the intrinsic geometric factors important in conformers like torsional angles in Torsional Diffusion (Jing et al., 2022). This makes MDF simpler to implement and applicable to other settings in which intrinsic geometric factors are not known.
<table><tr><td></td><td colspan="4">Recall</td><td colspan="4">Precision</td></tr><tr><td></td><td colspan="2">Coverage ↑</td><td colspan="2">AMR ↓</td><td colspan="2">Coverage ↑</td><td colspan="2">AMR ↓</td></tr><tr><td></td><td>mean</td><td>median</td><td>mean</td><td>median</td><td>mean</td><td>median</td><td>mean</td><td>median</td></tr><tr><td>CGCF</td><td>69.47</td><td>96.15</td><td>0.425</td><td>0.374</td><td>38.20</td><td>33.33</td><td>0.711</td><td>0.695</td></tr><tr><td>GeoDiff</td><td>76.50</td><td>100.00</td><td>0.297</td><td>0.229</td><td>50.00</td><td>33.50</td><td>0.524</td><td>0.510</td></tr><tr><td>GeoMol</td><td>91.50</td><td>100.00</td><td>0.225</td><td>0.193</td><td>87.60</td><td>100.00</td><td>0.270</td><td>0.241</td></tr><tr><td>Torsional Diff.</td><td>92.80</td><td>100.00</td><td>0.178</td><td>0.147</td><td>92.70</td><td>100.00</td><td>0.221</td><td>0.195</td></tr><tr><td>MDF (ours)</td><td>95.30</td><td>100.00</td><td>0.124</td><td>0.074</td><td>91.50</td><td>100.00</td><td>0.169</td><td>0.101</td></tr><tr><td>MDF (k=16)</td><td>94.87</td><td>100.00</td><td>0.139</td><td>0.093</td><td>87.54</td><td>100.00</td><td>0.220</td><td>0.151</td></tr><tr><td>MDF (k=8)</td><td>94.28</td><td>100.00</td><td>0.162</td><td>0.109</td><td>84.27</td><td>100.00</td><td>0.261</td><td>0.208</td></tr><tr><td>MDF (k=4)</td><td>94.57</td><td>100.00</td><td>0.145</td><td>0.093</td><td>86.83</td><td>100.00</td><td>0.225</td><td>0.151</td></tr><tr><td>MDF (k=2)</td><td>93.15</td><td>100.00</td><td>0.152</td><td>0.088</td><td>86.97</td><td>100.00</td><td>0.211</td><td>0.138</td></tr></table>
Table 7: Molecule conformer generation results for GEOM-QM9 dataset. MDF obtains comparable or better results than the state-of-the-art Torsional Diffusion (Jing et al., 2022), without making any explicit assumptions about the geometric structure of molecules (i.e. without modeling torsional angles). In addition, we show how performance of MDF changes as a function of the number of eigen-functions $k$ . Interestingly, with as few as $k = 2$ eigen-functions MDF is able to generate consistent accurate conformations.
Finally, In the appendix we present additional results that carefully ablate different architectures for the score network $\epsilon_{\theta}$ in A.7.1. As well as an extensive study of the robustness of MDF to both rigid and isometric transformations of the manifold $\mathcal{M}$ A.7.2. Finally, we also show conditional inference results on the challenging problem of PDEs on manifolds A.7.3.
# 6 CONCLUSIONS
In this paper we introduced MDF a diffusion probabilistic model that is capable of capturing distributions of functions defined on general Riemannian manifolds. We leveraged tools from spectral geometry analysis and use the eigen-functions of the manifold Laplace-Beltrami Operator to define an intrinsic coordinate system on which functions are defined. This allows us to design an efficient recipe for training a diffusion probabilistic model of functions whose domain are arbitrary geometries. Our results show that we can capture distributions of functions on manifolds of increasing complexity outperforming previous approaches, while also enabling the applications of powerful generative priors to fundamental scientific problems like forward and inverse solutions to PDEs, climate modeling, and molecular chemistry.
# REFERENCES
P. Achlioptas, P. Diamanti, I. Mitliagkas, and L. Guibas. Learning representations and generative models for 3d point clouds. In ICML, 2018. Matthias Bauer, Emilien Dupont, Andy Brock, Dan Rosenbaum, Jonathan Schwarz, and Hyunjik Kim. Spatial functa: Scaling functa to imagenet classification and generation. arXiv preprint arXiv:2302.03130, 2023. Mikhail Belkin and Partha Niyogi. Laplacian eigenmaps and spectral techniques for embedding and clustering. Advances in neural information processing systems, 14, 2001. Yoshua Bengio, Jean-françois Paiement, Pascal Vincent, Olivier Delalleau, Nicolas Roux, and Marie Ouimet. Out-of-sample extensions for lle, isomap, mds, eigenmaps, and spectral clustering. Advances in neural information processing systems, 16, 2003a. Yoshua Bengio, Pascal Vincent, Jean-François Paiement, Olivier Delalleau, Marie Ouimet, and Nicolas Le Roux. Spectral clustering and kernel PCA are learning eigenfunctions, volume 1239. Citeseer, 2003b. HJ Bhabha. Relativistic wave equations for the elementary particles. Reviews of Modern Physics, 17 (2-3):200, 1945. Sam Bond-Taylor and Chris G Willcocks. -diff: Infinite resolution diffusion with subsampled mollified states. CoRR, 2023. Viacheslav Borovitskiy, Alexander Terenin, Peter Mostowsky, et al. Matérn gaussian processes on riemannian manifolds. Advances in Neural Information Processing Systems, 33:12426-12437, 2020. V. Bortoli, E. Mathieu, M. Hutchinson, J. Thornton, Y. Teh, and A. Doucet. Riemannian score-based generative modeling. arXiv, 2022. Alexander M Bronstein, Michael M Bronstein, and Ron Kimmel. Numerical geometry of non-rigid shapes. Springer Science & Business Media, 2008. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877-1901, 2020. Ricky TQ Chen and Yaron Lipman. Riemannian flow matching on general geometries. arXiv preprint arXiv:2302.03660, 2023. Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memory-efficient exact attention with io-awareness. Advances in Neural Information Processing Systems, 35:16344-16359, 2022. Y. Du, K. Collins, J. Tenenbaum, and V. Sitzmann. Learning signal-agnostic manifolds of neural fields. In NeurIPS, 2021. E. Dupont, H. Kim, S. Eslami, D. Rezende, and D. Rosenbaum. From data to functa: Your data point is a function and you should treat it like one. In ICML, 2022a. E. Dupont, Y. Teh, and A. Doucet. Generative models as distributions of functions. In AISTATS, 2022b. V. Dutordoir, A. Saul, Z. Ghahramani, and F. Simpson. Neural diffusion processes. arXiv, 2022. Vijay Prakash Dwivedi, Chaitanya K Joshi, Thomas Laurent, Yoshua Bengio, and Xavier Bresson. Benchmarking graph neural networks. 2020. B Everett. An introduction to latent variable models. Springer, 2013. Octavian Ganea, Lagnajit Pattanaik, Connor Coley, Regina Barzilay, Klavs Jensen, William Green, and Tommi Jaakkola. Geomol: Torsional geometric generation of molecular 3d conformer ensembles. Advances in Neural Information Processing Systems, 34:13757-13769, 2021.
M. Garnelo, J. Schwarz, D. Rosenbaum, F. Viola, D. Rezende, SM Eslami, and Y. Teh. Neural processes. ICML workshop, 2018. M. Gemici, D. Rezende, and S. Mohamed. Normalizing flows on riemannian manifolds. arXiv, 2016. Daniele Grattarola and Pierre Vandergheynst. Generalised implicit neural representations. arXiv preprint arXiv:2205.15674, 2022. D. Ha, A. Dai, and Q. Le. Hypernetworks. In ICLR, 2017. Xiaoxin He, Bryan Hooi, Thomas Laurent, Adam Perold, Yann LeCun, and Xavier Bresson. A generalization of vit/mlp-mixer to graphs. arXiv preprint arXiv:2212.13350, 2022. V Hernandez, JE Roman, A Tomas, and V Vidal. A survey of software for sparse eigenvalue problems. Universitat Politecnica De Valencia, SLEPs technical report STR-6, 2009. Hans Hersbach, Bill Bell, Paul Berrisford, Shoji Hirahara, András Horányi, Joaquín Muñoz-Sabater, Julien Nicolas, Carole Peubey, Raluca Radu, Dinand Schepers, et al. The era5 global reanalysis. Quarterly Journal of the Royal Meteorological Society, 146(730):1999-2049, 2020. M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In NeurIPS, 2017. J. Ho, A. Jain, and P. Abbeel. Denoising diffusion probabilistic models. In NeurIPS, 2020. J. Ho, T. Salimans, A. Gritsenko, W. Chan, M. Norouzi, and D. J Fleet. Video diffusion models. In ICLR, 2022. Michael Hutchinson, Alexander Terenin, Viacheslav Borovitskiy, So Takao, Yee Teh, and Marc Deisenroth. Vector-valued gaussian processes on riemannian manifolds via gauge independent projected kernels. Advances in Neural Information Processing Systems, 34:17160-17169, 2021. Victor Isakov. Inverse problems for partial differential equations, volume 127. Springer, 2006. A. Jaegle, S. Borgeaud, J. Alayrac, et al. Perceiver io: A general architecture for structured inputs & outputs. In ICLR, 2022. N. Jain, A. Olmo, S. Sengupta, L. Manikonda, and S. Kambhampati. Imperfect imaganation: Implications of gans exacerbating biases on facial data augmentation and snapchat selfie lenses. CORR, 2020. Bowen Jing, Gabriele Corso, Jeffrey Chang, Regina Barzilay, and Tommi Jaakkola. Torsional diffusion for molecular conformer generation. Advances in Neural Information Processing Systems, 35:24240-24253, 2022. T. Karras, T. Aila, S. Laine, and J. Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In *ICLR*, 2018. H. Kim, A. Mnih, J. Schwarz, M. Garnelo, A. Eslami, D. Rosenbaum, O. Vinyals, and Y. Teh. Attentive neural processes. *ICLR*, 2019. D. Kingma and J. Ba. Adam: A method for stochastic optimization. In ICLR, 2015. D. Kingma and M. Welling. Auto-encoding variational bayes. In NeurIPS, 2014. N. Kodali, J. Abernethy, J. Hays, and Z. Kira. On convergence and stability of gans. arXiv, 2017. Lukas Koestler, Daniel Grittner, Michael Moeller, Daniel Cremers, and Zorah Lahner. Intrinsic neural fields: Learning functions on manifolds. In Computer Vision-ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23-27, 2022, Proceedings, Part II, pp. 622-639. Springer, 2022. Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, 1998.
Bruno Lévy. Laplace-beltrami eigenfunctions towards an algorithm that "understands" geometry. In IEEE International Conference on Shape Modeling and Applications 2006 (SMI'06), pp. 13-13. IEEE, 2006. Finn Lindgren, Håvard Rue, and Johan Lindström. An explicit link between gaussian fields and gaussian markov random fields: the stochastic partial differential equation approach. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 73(4):423-498, 2011. C. Loop. Smooth Subdivision Surfaces based on triangles. 1987. Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. Repaint: Inpainting using denoising diffusion probabilistic models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11461-11471, 2022. Sohir Maskey, Ali Parviz, Maximilian Thiessen, Hannes Stärk, Ylli Sadikaj, and Haggai Maron. Generalized laplacian positional encoding for graph representation learning. arXiv preprint arXiv:2210.15956, 2022. Subbaramiah Minakshisundaram and Åke Pleijel. Some properties of the eigenfunctions of the laplace-operator on riemannian manifolds. Canadian Journal of Mathematics, 1(3):242-256, 1949. Y. Mirsky and W. Lee. The creation and detection of deepfakes: A survey. CSUR, 2021. A. Nichol and P. Dhariwal. Improved denoising diffusion probabilistic models. In ICML, 2021. J. Park, P. Florence, J. Straub, R. Newcombe, and S. Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In CVPR, 2019. Raghunathan Ramakrishnan, Pavlo O Dral, Matthias Rupp, and O Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. *Scientific data*, 1(1):1-7, 2014. Junuthula Narasimha Reddy. Introduction to the finite element method. McGraw-Hill Education, 2019. N. Rostamzadeh, E. Denton, and L. Petrini. Ethics and creativity in computer vision. arXiv, 2021. N. Rozen, A. Grover, M. Nickel, and Y. Lipman. Moser flow: Divergence-based generative modeling on manifolds. In NeurIPS, 2021. Lars Ruddigkeit, Ruud Van Deursen, Lorenz C Blum, and Jean-Louis Reymond. Enumeration of 166 billion organic small molecules in the chemical universe database gdb-17. Journal of chemical information and modeling, 52(11):2864-2875, 2012. Raif M Rustamov et al. Laplace-beltrami eigenfunctions for deformation invariant shape representation. In Symposium on geometry processing, volume 257, pp. 225-233, 2007. Nicholas Sharp and Keenan Crane. A laplacian for nonmanifold triangle meshes. In Computer Graphics Forum, volume 39, pp. 69-80. Wiley Online Library, 2020. Nicholas Sharp, Souhaib Attaiki, Keenan Crane, and Maks Ovsjanikov. Diffusionnet: Discretization agnostic learning on surfaces. ACM Transactions on Graphics (TOG), 41(3):1-16, 2022. J. Song, C. Meng, and S. Ermon. Denoising diffusion implicit models. In ICLR, 2021a. Y. Song, J. Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole. Score-based generative modeling through stochastic differential equations. In ICLR, 2021b. C Sullivan and Alexander Kaszynski. Pyvista: 3d plotting and mesh analysis through a streamlined interface for the visualization toolkit (vtk). Journal of Open Source Software, 4(37):1450, 2019. Robert W. Sumner and Jovan Popovic. Deformation Transfer for Triangle Meshes. In ACM Transactions on Graphics, 2004. P. Tinsley, A. Czajka, and P. Flynn. This face does not exist... but it might be yours! identity leakage in generative models. In WACV, 2021.
Ilya O Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, et al. Mlp-mixer: An all-mlp architecture for vision. Advances in Neural Information Processing Systems, 34: 24261-24272, 2021. Bruno Vallet and Bruno Lévy. Spectral geometry processing with manifold harmonics. In Computer Graphics Forum, volume 27, pp. 251-260. Wiley Online Library, 2008. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. M. Welling and Y. Teh. Bayesian learning via stochastic gradient Langevin dynamics. In ICML, 2011. Y. Xie, T. Takikawa, S. Saito, O. Litany, S. Yan, N. Khan, F. Tombari, J. Tompkin, V. Sitzmann, and S. Sridhar. Neural fields in visual computing and beyond. In Computer Graphics Forum, 2022. Minkai Xu, Shitong Luo, Yoshua Bengio, Jian Peng, and Jian Tang. Learning neural generative dynamics for molecular conformation generation. arXiv preprint arXiv:2102.10240, 2021. Minkai Xu, Lantao Yu, Yang Song, Chence Shi, Stefano Ermon, and Jian Tang. Geodiff: A geometric diffusion model for molecular conformation generation. arXiv preprint arXiv:2203.02923, 2022. S. Zhai, W. Talbott, N. Srivastava, C. Huang, H. Goh, R. Zhang, and J. Susskind. An attention free transformer. In ICML, 2022. Peiye Zhuang, Samira Abnar, Jiatao Gu, Alex Schwing, Josh Susskind, and Miguel Angel Bautista. Diffusion probabilistic fields. In ICLR, 2023.
# A APPENDIX
# A.1 BROADER IMPACT STATEMENT
When examining the societal implications of generative models, certain critical elements warrant close attention. These include the potential misuse of generative models to fabricate deceptive data, such as "DeepFakes" (Mirsky & Lee, 2021), the risk of training data leakage and associated privacy concerns (Tinsley et al., 2021), and the potential to amplify existing biases in the training data (Jain et al., 2020). For a comprehensive discussion on ethical aspects in the context of generative modeling, readers are directed to (Rostamzadeh et al., 2021).
# A.2 LIMITATIONS AND FUTURE WORK
As MDF advances in learning function distributions over Riemannian manifolds, it does encounter certain constraints and potential areas of future enhancement. One primary challenge is the computational demand of the transformer-based score network in its basic form, even at lower resolutions. This stems from the quadratic cost of calculating attention over context and query pairs. To mitigate this, the PerceiverIO architecture, which scales in a linear manner with the number of query and context points, is utilized (Jaegle et al., 2022) in our experiments. Further exploration of other efficient transformer architectures could be a promising direction for future work (Zhai et al., 2022; Dao et al., 2022). Furthermore, MDF, much like DDPM (Ho et al., 2020), iterates over all time steps during sampling to generate a field during inference, a process slower than that of GANs. Current studies have accelerated sampling (Song et al., 2021a), but at the expense of sample quality and diversity. However, it's worth noting that improved inference methods such as (Song et al., 2021a) can be seamlessly incorporated into MDF.
Since MDF has the capability to learn distributions over fields defined on various Riemannian manifolds within a single model, in future work we are poised to enhance its capacity for comprehending and adapting to a broader range of geometrical contexts. This adaptability will further pave the way towards the development of general foundation models to scientific and engineering challenges, which can better account for the intricate geometric intricacies inherent in real-world scenarios.
For example, we aim to extend the application of MDF to inverse problems in PDEs. A noteworthy attribute of our model is its inherent capability to model PDEs on Riemannian manifolds trivially. The intrinsic structure of MDF facilitates not only the understanding and solving of forward problems, where PDEs are known and solutions to the forward problem are needed, but also inverse problems, where certain outcome or boundary conditions are known and the task is to determine the underlying PDE. Expanding our application to handle inverse problems in PDEs on Riemannian manifolds can have profound implications for complex systems modeling, as it enhances our understanding of the manifold structures and the way systems governed by PDEs interact with them.
# A.3 DISCUSSION ON COMPUTING EMBEDDINGS
When considering how to compute embeddings for points in a manifold $\mathcal{M}$ there are several options to explore. The simplest one is to adopt the ambient space in which the manifold is embedded as a coordinate system to represent points (eg. a plain coordinate approach). For example, in the case of 3D meshes one can assign a coordinate in $\mathbb{R}^3$ to every point in the mesh. As shown in Tab. 1-2-3-4 this approach (used by DPF) is outperformed by MDF. In addition, in Sect. A.6.2 we show that this approach is not robust wrt rigid or isometric transformations of the manifold. Note that manifolds are not always embedded in an ambient space. For example, in molecular conformation, molecular graphs only represent connectivity structure between atoms but are not necessarily embedded in a higher dimensional space.
Another method that one can consider is to use a local chart approach. Local charts are interesting because they provide a way assigning a set of coordinates to points in a local region of the manifold. While the manifold may have arbitrary curvature, local charts are always Euclidean spaces. Each point in the manifold can be described by a unique set of coordinates in the chart, but different charts may overlap. However, this requires computing transformations (often complex to implement) to convert coordinates from one chart to another.
Finally, the eigen-functions of the LBO not only provide a way of assigning a coordinate to points on a manifold but also do this by defining an intrinsic coordinate system. This intrinsic coordinate system is global, and does not require transformations like local charts do. In addition, this intrinsic coordinate system is robust wrt rigid or isometric transformations of the manifold (ref A.6.2). Summarizing, this intrinsic coordinate system is a more fundamental way of describing the manifold, based on its own inherent properties, without reference to an external ambient space.
# A.4 IMPLEMENTATION DETAILS
In this section we describe implementation details for all our experiments. These include all details about the data: manifolds and functions, as well as details for computing the eigen-functions $\varphi$ . We also provide hyper-parameters and settings for the implementation of the score field network $\epsilon_{\theta}$ and compute used for each experiment in the paper.
# A.4.1 DATA
Unless explicitly described in the main paper, we report experiments on 5 different manifolds which we show in Fig. 9. This manifolds are: a parametric sine wave Fig. 9(a) computed using (Sullivan & Kaszynski, 2019) containing 1024 vertices. The Stanford bunny with 5299 vertices Fig. 9(b). A human body mesh from the Tosca dataset (Bronstein et al., 2008) containing 4823 vertices, show in Fig. 9(c). A cat mesh and its reposed version from (Sumner & Popovic, 2004), show in Fig. 9(d) and Fig. 9(e), respectively containing 7207 vertices. To compute the mean curvature values $|K|$ for each mesh reported in the main paper we compute the absolute value of the average mean curvature, which we obtain using (Sullivan & Kaszynski, 2019).
 (a)
 (b)
 (c) Figure 9: Manifolds used in the different experiments throughout the paper. (a) Wave. (b) Bunny. (c) Human (Bronstein et al., 2008). (d) Cat (Sumner & Popovic, 2004). (e) Cat (re-posed) (Sumner & Popovic, 2004).
 (d)
 (e)
In terms of datasets of functions on these manifolds we use the following:
- A Gaussian Mixture Model (GMM) dataset with 3 components, where in each field the 3 components are randomly placed on the specific manifold. We define a held out test set containing 10k samples. - MNIST (LeCun et al., 1998) and CelebA-HQ (Karras et al., 2018) datasets, where images are texture mapped into the meshes using (Sullivan & Kaszynski, 2019), models are evaluated on the standard tests sets for these datasets. - The ERA5 (Hersbach et al., 2020) dataset used to compare with GASP (Dupont et al., 2022b) is available at https://github.com/EmilienDupont/neural-function-distributions. This dataset contains a train set of 8510 samples and a test set of 2420 samples, which are the settings used in GASP (Dupont et al., 2022b). To compare with GASP we used their pretrained model available available at
 Figure 10: Interaction between context and query pairs in the PerceiverIO architecture. Context pairs $\mathbf{C}_t$ attend to a latent array of learnable parameters via cross attention. The latent array then goes through several self attention blocks. Finally, the query pairs $\mathbf{Q}_t$ cross-attend to the latent array to produce the final noise prediction $\hat{\epsilon}_q$ .
# A.5 COMPUTING THE LAPLACIAN AND $\varphi$
In practice, for general geometries (e.g. general 3D meshes with $n$ vertices) we compute eigenvectors of the symmetric normalized graph Laplacian $\mathbf{L}$ . We define $\mathbf{L}$ as follows:
$$\mathbf {L} = \mathbf {D} ^ {- \frac {1}{2}} (\mathbf {D} - \mathbf {A}) \mathbf {D} ^ {- \frac {1}{2}}, \tag {3}$$
where $\mathbf{A} \in \{0,1\}^{n \times n}$ is the discrete adjacency matrix and $\mathbf{D}$ is the diagonal degree matrix of the mesh graph. Note that eigenvectors of $\mathbf{L}$ converge to the eigen-functions of the LBO $\Delta_{\mathcal{M}}$ as $n \to \infty$ (Belkin & Niyogi, 2001; Bengio et al., 2003b;a). The eigen-decomposition of $\mathbf{L}$ can be computed efficiently using sparse eigen-problem solvers (Hernandez et al., 2009) and only needs to be computed once during training. Note that eigen-vectors of $\mathbf{L}$ are only defined for the mesh vertices. In MDF, we sample random points on the mesh during training and interpolate the eigenvector representation $\varphi$ of the vertices in the corresponding triangle using barycentric interpolation.
# A.5.1 SCORE FIELD NETWORK $\epsilon_{\theta}$
In MDF, the score field's design space covers all architectures that can process irregularly sampled data, such as Transformers (Vaswani et al., 2017) and MLPs (Tolstikhin et al., 2021). The model is primarily implemented using PerceiverIO (Jaegle et al., 2022), an effective transformer architecture that encodes and decodes. The PerceiverIO was chosen due to its efficiency in managing large numbers of elements in the context and query sets, as well as its natural ability to encode interactions between these sets using attention. Figure 10 demonstrates how these sets are used within the PerceiverIO architecture. To elaborate, the encoder maps the context set into latent arrays (i.e., a group of learnable vectors) through a cross-attention layer, while the decoder does the same for query set. For a more detailed analysis of the PerceiverIO architecture refer to (Jaegle et al., 2022).
The time-step $t$ is incorporated into the score computation by concatenating a positional embedding representation of $t$ to the context and query sets. The specific PerceiverIO settings used in all quantitatively evaluated experiments are presented in Tab.8. Practically, the MDF network consists of 12 transformer blocks, each containing 1 cross-attention layer and 2 self-attention layers, except for GEOM-QM9 we use smaller model with 6 blocks. Each of these layers has 4 attention heads. Fourier position embedding is used to represent time-steps $t$ with 64 frequencies. An Adam (Kingma & Ba, 2015) optimizer is employed during training with a learning rate of $1e - 4$ . We use EMA with a decay of 0.9999. A modified version of the publicly available repository is used for PerceiverIO<sup>2</sup>.
<table><tr><td>Hyper-parameter</td><td>Wave</td><td>Bunny</td><td>Human</td><td>GEOM-QM9</td></tr><tr><td>train res.</td><td>1024</td><td>5299</td><td>4823</td><td>variable</td></tr><tr><td>#context set</td><td>1024</td><td>5299</td><td>4823</td><td>variable</td></tr><tr><td>#query set</td><td>1024</td><td>5299</td><td>4823</td><td>variable</td></tr><tr><td>#eigenfuncs (k)</td><td>64</td><td>64</td><td>64</td><td>28</td></tr><tr><td>#freq pos. embed t</td><td>64</td><td>64</td><td>64</td><td>64</td></tr><tr><td>#latents</td><td>1024</td><td>1024</td><td>1024</td><td>512</td></tr><tr><td>#dim latents</td><td>512</td><td>512</td><td>512</td><td>256</td></tr><tr><td>#blocks</td><td>12</td><td>12</td><td>12</td><td>6</td></tr><tr><td>#dec blocks</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>#self attends per block</td><td>2</td><td>2</td><td>2</td><td>2</td></tr><tr><td>#self attention heads</td><td>4</td><td>4</td><td>4</td><td>4</td></tr><tr><td>#cross attention heads</td><td>4</td><td>4</td><td>4</td><td>4</td></tr><tr><td>batch size</td><td>96</td><td>96</td><td>96</td><td>96</td></tr><tr><td>lr</td><td>1e-4</td><td>1e-4</td><td>1e-4</td><td>1e-4</td></tr><tr><td>epochs</td><td>1000</td><td>1000</td><td>1000</td><td>250</td></tr></table>
Table 8: Hyperparameters and settings for MDF on different manifolds.
# A.5.2 COMPUTE
Each model was trained on an machine with 8 Nvidia A100 GPUs, we trained models for 3 days.
# A.6 METRICS
Instead of using FID type metrics commonly used for generative models over images (Heusel et al., 2017), we must take a different approach for evaluating functions on curved geometries. Our suggestion is to use metrics from the field of generative modeling of point cloud data (Achlioptas et al., 2018), specifically Coverage (COV) and Minimum Matching Distance (MMD).
- Coverage (COV) refers to how well the generated data set represents the test set. We first identify the closest neighbour in the generated set for each field in the test set. COV is then calculated as the proportion of fields in the generated set that have corresponding fields in the test set. The distance between fields is determined using the average $l_{2}$ distance in signal space on the vertices of the mesh, usually in either $\mathbb{R}^{1}$ or $\mathbb{R}^{3}$ space in our experiments. A high COV score implies that the generated samples adequately represent the real samples. - Minimum Matching Distance (MMD), on the other hand, provides a measure of how accurately the fields are represented in the test set. This measure is required because in the COV metric matches don't necessarily have to be close. To gauge the fidelity of the generated fields against the real ones, we pair each field in the generated set with its closes neighbour in the test set (MMD), averaging these distances for our final result. This process also utilizes the $l_{2}$ distance in signal space on the mesh vertices. MMD provides a good correlation with the authenticity of the generated set, as it directly depends on the matching distances.
As a summary, COV and MMD metrics are complementary to each other. A model captures the distribution of real fields with good fidelity when MMD is small and COV is large. In particular, at equivalent levels of MMD a higher COV is desired (Achlioptas et al., 2018), and vice-versa. This observation correlates well with our results shown in Tab. 1-2-3 on the main paper, where MDF obtains comparable or better MMD score that DPF (Zhuang et al., 2023) while greatly improving COV.
# A.7 ADDITIONAL EXPERIMENTS
In this section we provide additional empirical results using different network architectures to implement the score field network $\epsilon_{\theta}$ . Furthermore, we provide additional experiments on robustness to discretization.
# A.7.1 ARCHITECTURE ABLATION
The construction of MDF does not rely on a specific implementation of the score network $\epsilon_{\theta}$ . The score model's design space encompasses a broad range of options, including all architectures capable of handling irregular data like transformers or MLPs. To substantiate this, we conducted an evaluation on the GMM dataset and the Stanford bunny at a resolution of 602 vertices, comparing three distinct architectures: a PerceiverIO (Jaegle et al., 2022), a standard Transformer Encoder-Decoder (Vaswani et al., 2017), and an MLP-mixer (Tolstikhin et al., 2021). For a fair comparison, we approximated the same number of parameters (around 55M) and settings (such as the number of blocks, parameters per block, etc.) for each model and trained them over 500 epochs. Note that because of these reasons the numbers reported in this section are not directly comparable to those shown in the main paper. We simplified the evaluation by using an equal number of context and query pairs. Both the Transformer Encoder and MLP-mixer process context pairs using their respective architectures; the resulting latents are then merged with corresponding query pairs and fed into a linear projection layer for final prediction.
In Tab. 9 we show that the MDF formulation is compatible with different architectural implementations of the score field model. We observe relatively uniform performance across various architectures, ranging from transformer-based to MLPs. Similar patterns are noted when examining qualitative samples displayed in Fig. 11, corroborating our assertion that MDF's advantages stem from its formulation rather than the specific implementation of the score field model. Each architecture brings its own strengths—for instance, MLP-mixers enable high throughput, transformer encoders are easy to implement, and PerceiverIO facilitates the handling of large and variable numbers of context and query pairs. We posit that marrying the strengths of these diverse architectures promises substantial advancement for MDF. Please note, these empirical results aren't directly comparable to those reported elsewhere in the paper, as these models generally possess around $50\%$ of the parameters of the models used in other sections.
<table><tr><td></td><td>COV ↑</td><td>MMD ↓</td></tr><tr><td>PeceiverIO (Jaegle et al., 2022)</td><td>0.569</td><td>0.00843</td></tr><tr><td>Transf. Enc-Dec (Vaswani et al., 2017)</td><td>0.581</td><td>0.00286</td></tr><tr><td>MLP-mixer (Tolstikhin et al., 2021)</td><td>0.565</td><td>0.00309</td></tr></table>
Table 9: Quantitative evaluation of image generation on the GMM + Stanford Bunny dataset for different implementations of the score field $\epsilon_{\theta}$ .
Finally, to measure the effect of random training seed for weight initialization we ran the exact same model fixing all hyper-parameters and training settings. For this experiment we used the PerceiverIO architecture and the GMM dataset on the Stanford bunny geometry with 602 vertices. We ran the same experiment 3 times and measured performance using COV and MMD metrics. Our results show that across the different training runs MDF obtained $\mathrm{COV} = 0.569\pm 0.007$ and $\mathrm{MMD} = 0.00843\pm 0.00372$
# A.7.2 ROBUSTNESS OF MDF
We evaluate MDF's robustness to rigid and isometric transformations of the training manifold $\mathcal{M}$ . We use the cat category geometries from (Sumner & Popovic, 2004) and build a dataset of different fields on the manifold by generating 2 gaussians around the area of the tail and the right paw of the cat. Note that every field is different since the gaussians are centered at different points in the tail and right paw, see Fig. 13(a). During training, the model only has access to fields defined on a fixed manifold $\mathcal{M}$ (see Fig. 13(a)). We then evaluate the model on either a rigid $\mathcal{M}_{\mathrm{rigid}}$ (shown in Fig. 13(b)) or isometric $\mathcal{M}_{\mathrm{iso}}$ (Fig. 13(c)) transformation of $\mathcal{M}$ . Qualitatively comparing the transfer results of MDF with DPF (Zhuang et al., 2023) in Fig. 13(d)-(e), we see a marked difference in fidelity and coverage of the distribution.
In Fig. 13 we show how performance changes as the magnitude of a rigid transformation (e.g. a rotation about the $z$ -axis) of $\mathcal{M}$ increases. As expected, the performance of DPF (Zhuang et al., 2023) sharply declines as we move away from the training setting, denoted by a rotation of 0 radians. However, MDF obtains a stable performance across transformations, this is due to the eigen-function basis being intrinsic to $\mathcal{M}$ , and thus, invariant to rigid transformations. In addition, in Tab. 4 we show results under an isometric transformation of the manifold (e.g. changing the pose of the cat, see Fig.
 (a) Real samples.
 (b) Transf. Enc-Dec (Vaswani et al., 2017).

 (c) MLP-mixer (Tolstikhin et al., 2021). (d) PerceiverIO (Jaegle et al., 2022). Figure 11: Qualitative comparison of different architectures to implement the score field model $\epsilon_{\theta}$ .
13(c)). As in the rigid setting, the performance of DPF (Zhuang et al., 2023) sharply declines under an isometric transformation while MDF keeps performance constant. In addition, transferring to an isometric transformation $(\mathcal{M} \to \mathcal{M}_{\mathrm{iso}})$ performs comparably with directly training on the isometric transformation $(\mathcal{M}_{\mathrm{iso}} \to \mathcal{M}_{\mathrm{iso}})$ up to small differences due to random weight initialization.

 Figure 12: Robustness of MDF and DPF (Zhuang et al., 2023) with respect to rigid transformations of $\mathcal{M}$ . The distribution of fields learned by MDF is invariant with respect to rigid transformations, while DPF (Zhuang et al., 2023) collapses due to learning distributions in ambient space.
We also provide transfer results to different discretizations of $\mathcal{M}$ . To do so, we train MDF on a low resolution discretization of a manifold and evaluate transfer to a high resolution discretization. We use the GMM dataset and the bunny manifold at 2 different resolutions: 1394 and 5570 vertices, which we get by applying loop subdivision (Loop, 1987) to the lowest resolution mesh. Theoretically, the Laplacian eigenvectors $\varphi$ are only unique up to sign, which can result in ambiguity when transferring a pre-trained model to a different discretization. Empirically we did not find this to be an issue in our experiments. We hypothesize that transferring MDF from low to high resolution discretizations is largely a function of the number of eigen-functions used to compute $\varphi$ . This is because eigenfunctions of small eigenvalue represent low-frequency components of the manifold which are more stable across different discretizations. In Fig. 14 we report transfer performance as a function of the number of eigen-functions used to compute $\varphi$ . We observe an initial regime where more eigenfunctions aid in transferring (up to 64 eigen-functions) followed by a stage where high-frequency eigen-functions negatively impact transfer performance.
 (a) $f_0\sim q(f_0)|f:\mathcal{M}\to \mathbb{R}$
 (d) DPF $\mathcal{M}\rightarrow \mathcal{M}_{\mathrm{rigid}}$
 (e) DPF $\mathcal{M}\rightarrow \mathcal{M}_{\mathrm{iso}}$
 Figure 13: (a) Training set composed of different fields $f:\mathcal{M}\to \mathbb{R}$ where 2 gaussians are randomly placed in the tail and the right paw of the cat. Fields generated by transferring the MDF pre-trained on $\mathcal{M}$ to (b) a rigid and (c) an isometric transformation of $\mathcal{M}$ . Fields generated by transferring the DPF (Zhuang et al., 2023) pre-trained on $\mathcal{M}$ to (d) a rigid and (e) an isometric transformation of $\mathcal{M}$ .
 Figure 14: Transferring MDF from low to high resolution discretizations as a function of the number of eigenfunctions. We observe that eigen-functions of small eigenvalue transfer better since they encode coarse (i.e. low-frequency) information of the manifold.
We additionally run a transfer experiment between low resolution and high resolution discretizations of a different manifold (e.g. a mesh of the letter 'A', show in Fig. 15(b)). In this setting the low resolution mesh contains 1000 vertices and the high resolution mesh contains 4000 vertices. As show in Fig. 16 the results are consistent across manifolds, and a similar trend as in Fig. 14 can be observed. This trend further reinforces our hypothesis that low frequency eigen-functions transfer better across discretization than high frequency ones.
 (a)
 Figure 15: (a) Low and high resolution discretizations of the Stanford bunny manifold used for the transfer experiments in the main paper (Fig. 14). (b) Low and high resolution discretizations of the letter 'A' manifold, used for the experiments in Fig. 16.
 (b)


 Figure 16: Transferring MDF from a less detailed to a more detailed discretization depends on the number of eigen-functions. It's noteworthy that eigen-functions with small eigenvalues have better transferability as they represent the broad, or low-frequency, information of the manifold.
# A.7.3 CONDITIONAL INFERENCE ON PDES
In this section we evaluate MDF on conditional inference tasks. In particular, we create a dataset of different simulations of the heat diffusion PDE on a manifold. As a result, every sample in our training distribution $f_0 \sim q(f_0)$ is a temporal field $f: \mathcal{M} \times \mathbb{R} \to \mathbb{R}$ . We create a training set of 10k samples where each sample is a rollout of the PDE for 10 steps given initial conditions. We generate initial conditions by uniformly sampling 3 gaussian heat sources of equivalent magnitude on the manifold and use FEM (Reddy, 2019) to compute the rollout over time. For this experiment we use a version of the bunny mesh with 602 vertices as a manifold $\mathcal{M}$ and set the diffusivity term of the PDE to $D = 0.78$ . We then train MDF on this training set of temporal fields $f: \mathcal{M} \times \mathbb{R} \to \mathbb{R}$ , which in practice simply means concatenating a Fourier PE of the time step to the eigen-functions of the LBO.
We tackle the forward problem where we are given the initial conditions of the PDE and the model is tasked to predict the forward dynamics on a test set of 60 held out samples. To perform conditional inference with MDF we follow the recipe in (Lugmayr et al., 2022) which has been successful in the image domain. We show the forward dynamics predicted by FEM (Reddy, 2019) on Fig. 17(a) and MDF Fig. 17(b) for the same initial conditions in the held out set. We see how MDF successfully captures temporal dynamics, generating a temporal field consistent with observed initial conditions. Evaluating the full test set MDF obtains an mean squared error $\mathrm{MSE} = 4.77e10 - 3$ . In addition, MDF can directly be used for inverse problems (Isakov, 2006). Here we focus on inverting the full dynamics of the PDE, conditioned on sparse observations. Fig. 17(c) shows sparse observations of the FEM rollout, amounting to observing $10\%$ of the field. Fig. 17(d) shows a probabilistic solution to the inverse PDE problem generated by MDF which is consistent with the FEM dynamics in Fig. 17(a).
 Figure 17: (a) Forward prediction of the heat diffusion PDE computed with FEM (Reddy, 2019). (b) Conditionally sampled field generated by MDF. (c) Sparse observations of the FEM solution for inverse prediction. (d) Conditionally sampled inverse solution generated by MDF.
# A.8 ADDITIONAL VISUALIZATIONS
In this section we provide additional visualizations of experiments in the main paper. We show real and generated fields for the wave manifold (Fig. 18), ERA5 dataset (Hersbach et al., 2020) (Fig. 19) and GMM dataset on the bunny (Fig. 20) and human (Bronstein et al., 2008) manifolds (see Fig. 21). In summary, MDF captures the distribution of real fields for different datasets and manifolds, with high fidelity and coverage.
Finally, under ./videos we include two video visualizations:
- A visualization of training data as well as the sampling process for the MNIST dataset on the wave manifold. - A visualization of GT and temporal fields generated by MDF for the PDE dataset introduced in Sect. A.7.3. - A visualization of the sampling process for QM9 molecules for experiments Sect. 5.3.

 (a) Real samples (b) Generated samples Figure 18: Real and generated samples for MNIST (LeCun et al., 1998) digits on the wave manifold.

 (a) Real samples (b) Generated samples Figure 19: Real and generated samples for the ERA5 (Hersbach et al., 2020) climate dataset.

 (a) Real samples (b) Generated samples Figure 20: Real and generated samples for the GMM dataset on the Stanford bunny manifold.

 (a) Real samples (b) Generated samples Figure 21: Real and generated samples for the GMM dataset on the human manifold (Bronstein et al., 2008).123version https://git-lfs.github.com/spec/v1oid sha256:ae19efd40846fa76758823bc7f82d4237d7e5c048671ac40271933d6846a5c94size 1364791.gitattributes+64
2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/795a4722-1356-43bf-9bc5-73f2d6c9bfc9_content_list.jsonAdded+1716
2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/795a4722-1356-43bf-9bc5-73f2d6c9bfc9_model.jsonAdded
2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/795a4722-1356-43bf-9bc5-73f2d6c9bfc9_origin.pdfAdded+3
2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/full.mdAdded+300
2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/images.zipAdded+3
2024/Magic123_ One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors/layout.jsonAdded
2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/e8330e7b-b339-42f8-8535-2e9a5467aacf_content_list.jsonAdded
2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/e8330e7b-b339-42f8-8535-2e9a5467aacf_model.jsonAdded
2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/e8330e7b-b339-42f8-8535-2e9a5467aacf_origin.pdfAdded+3
2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/full.mdAdded+390
2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/images.zipAdded+3
2024/MagicDrive_ Street View Generation with Diverse 3D Geometry Control/layout.jsonAdded
2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/0c7170d2-2e2c-48e4-871f-85aa7e222171_content_list.jsonAdded
2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/0c7170d2-2e2c-48e4-871f-85aa7e222171_model.jsonAdded
2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/0c7170d2-2e2c-48e4-871f-85aa7e222171_origin.pdfAdded+3
2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/full.mdAdded+452
2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/images.zipAdded+3
2024/Magnitude Invariant Parametrizations Improve Hypernetwork Learning/layout.jsonAdded
2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/231c0ef8-547b-4db2-9bfd-58577e7da066_content_list.jsonAdded
2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/231c0ef8-547b-4db2-9bfd-58577e7da066_model.jsonAdded
2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/231c0ef8-547b-4db2-9bfd-58577e7da066_origin.pdfAdded+3
2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/full.mdAdded+573
2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/images.zipAdded+3
2024/Magnushammer_ A Transformer-Based Approach to Premise Selection/layout.jsonAdded
2024/Making LLaMA SEE and Draw with SEED Tokenizer/a3c50e33-f06d-4644-9a30-93aaa31f674c_content_list.jsonAdded
2024/Making LLaMA SEE and Draw with SEED Tokenizer/a3c50e33-f06d-4644-9a30-93aaa31f674c_model.jsonAdded
2024/Making LLaMA SEE and Draw with SEED Tokenizer/a3c50e33-f06d-4644-9a30-93aaa31f674c_origin.pdfAdded+3
2024/Making LLaMA SEE and Draw with SEED Tokenizer/full.mdAdded+547
2024/Making LLaMA SEE and Draw with SEED Tokenizer/images.zipAdded+3
2024/Making LLaMA SEE and Draw with SEED Tokenizer/layout.jsonAdded
2024/Making RL with Preference-based Feedback Efficient via Randomization/d6b15260-3f18-4f65-9374-0b587e1b2de3_content_list.jsonAdded
2024/Making RL with Preference-based Feedback Efficient via Randomization/d6b15260-3f18-4f65-9374-0b587e1b2de3_model.jsonAdded
2024/Making RL with Preference-based Feedback Efficient via Randomization/d6b15260-3f18-4f65-9374-0b587e1b2de3_origin.pdfAdded+3
2024/Making RL with Preference-based Feedback Efficient via Randomization/full.mdAdded
2024/Making RL with Preference-based Feedback Efficient via Randomization/images.zipAdded+3
2024/Making RL with Preference-based Feedback Efficient via Randomization/layout.jsonAdded
2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/baf58e31-08ad-497e-aefd-f3dc751cd413_content_list.jsonAdded
2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/baf58e31-08ad-497e-aefd-f3dc751cd413_model.jsonAdded
2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/baf58e31-08ad-497e-aefd-f3dc751cd413_origin.pdfAdded+3
2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/full.mdAdded+350
2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/images.zipAdded+3
2024/Making Retrieval-Augmented Language Models Robust to Irrelevant Context/layout.jsonAdded
2024/Manifold Diffusion Fields/c2335761-5480-4edc-9cf2-4abfdf1b9a8d_content_list.jsonAdded
2024/Manifold Diffusion Fields/c2335761-5480-4edc-9cf2-4abfdf1b9a8d_model.jsonAdded
2024/Manifold Diffusion Fields/c2335761-5480-4edc-9cf2-4abfdf1b9a8d_origin.pdfAdded+3
2024/Manifold Diffusion Fields/full.mdAdded+508
2024/Manifold Diffusion Fields/images.zipAdded+3
2024/Manifold Diffusion Fields/layout.jsonAdded
2024/Manifold Preserving Guided Diffusion/005afbd2-1de9-4a75-990f-ceac39c2e99c_content_list.jsonAdded