{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/switched-flow-matching-eliminating","title":"Switched Flow Matching: Eliminating Singularities via Switching ODEs","arxiv_id":"2405.11605","date":"2024-05-19","proceeding":null,"authors":["Qunxi Zhu","Wei Lin"],"abstract":"Continuous-time generative models, such as Flow Matching (FM), construct probability paths to transport between one distribution and another through the simulation-free learning of the neural ordinary differential equations (ODEs). During inference, however, the learned model often requires multiple neural network evaluations to accurately integrate the flow, resulting in a slow sampling speed. We attribute the reason to the inherent (joint) heterogeneity of source and/or target distributions, namely the singularity problem, which poses challenges for training the neural ODEs effectively. To address this issue, we propose a more general framework, termed Switched FM (SFM), that eliminates singularities via switching ODEs, as opposed to using a uniform ODE in FM. Importantly, we theoretically show that FM cannot transport between two simple distributions due to the existence and uniqueness of initial value problems of ODEs, while these limitations can be well tackled by SFM. From an orthogonal perspective, our framework can seamlessly integrate with the existing advanced techniques, such as minibatch optimal transport, to further enhance the straightness of the flow, yielding a more efficient sampling process with reduced costs. We demonstrate the effectiveness of the newly proposed SFM through several numerical examples.","url_abs":"https://arxiv.org/abs/2405.11605v2","url_pdf":"https://arxiv.org/pdf/2405.11605v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[],"tasks":[{"task_slug":"attribute","task_name":"Attribute"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.11605","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.11605"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/atong01/conditional-flow-matching","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/tensorflow/gan","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":12,"unverified":4},"by_repo_kind":{"found_in_text":{"samples":16,"ran":12,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"e00c96eaf4964fcf","entry":"args_to_gan_model","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/losses/tuple_losses.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/losses/tuple_losses.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e00c96eaf4964fcf"}},{"code_sha256_prefix":"49e2b0cc4b0c854f","entry":"get_trainable_variables","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/contrib_utils.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/contrib_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"49e2b0cc4b0c854f"}},{"code_sha256_prefix":"bfe05de19b4eb8d1","entry":"get_variables_by_name","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/contrib_utils.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/contrib_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bfe05de19b4eb8d1"}},{"code_sha256_prefix":"c2576a700c35ebba","entry":"image_grid","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/eval/eval_utils.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/eval/eval_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c2576a700c35ebba"}},{"code_sha256_prefix":"a3e29c3eb31126b7","entry":"kl_divergence","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/eval/classifier_metrics.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/eval/classifier_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a3e29c3eb31126b7"}},{"code_sha256_prefix":"3c1810a3f62b3156","entry":"python_image_grid","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/eval/eval_utils.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/eval/eval_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3c1810a3f62b3156"}},{"code_sha256_prefix":"c9b8371a08cafd98","entry":"run_classifier_fn","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/eval/classifier_metrics.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/eval/classifier_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c9b8371a08cafd98"}},{"code_sha256_prefix":"e56d29a30182c70a","entry":"sample_and_run_classifier_fn","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/eval/classifier_metrics.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/eval/classifier_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e56d29a30182c70a"}},{"code_sha256_prefix":"86ee4730f89c1466","entry":"stargan_prediction_input_fn_wrapper","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/estimator/stargan_estimator.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/estimator/stargan_estimator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"86ee4730f89c1466"}},{"code_sha256_prefix":"6dfacdb4f7f296a6","entry":"wasserstein_discriminator_loss","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/losses/losses_impl.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/losses/losses_impl.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6dfacdb4f7f296a6"}},{"code_sha256_prefix":"ef511aaa7c479fd0","entry":"wasserstein_generator_loss","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/losses/losses_impl.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/losses/losses_impl.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ef511aaa7c479fd0"}},{"code_sha256_prefix":"3160840ade588e25","entry":"wasserstein_hinge_discriminator_loss","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/losses/losses_impl.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/losses/losses_impl.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3160840ade588e25"}},{"code_sha256_prefix":"1341ccc8c51a764e","entry":"discriminator_fn","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/estimator/tpu_gan_estimator_test_lib.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/estimator/tpu_gan_estimator_test_lib.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1341ccc8c51a764e"}},{"code_sha256_prefix":"ace1970711646371","entry":"generator_fn","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/estimator/tpu_gan_estimator_test_lib.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/estimator/tpu_gan_estimator_test_lib.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ace1970711646371"}},{"code_sha256_prefix":"8257e435f9a8eec2","entry":"get_variables","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/contrib_utils.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/contrib_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8257e435f9a8eec2"}},{"code_sha256_prefix":"1ea274c92e014f1e","entry":"image_reshaper","repo":"tensorflow/gan","repo_kind":"found_in_text","path":"tensorflow_gan/python/eval/eval_utils.py","file_url":"https://github.com/tensorflow/gan/blob/HEAD/tensorflow_gan/python/eval/eval_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1ea274c92e014f1e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}