{"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/flow-straight-and-fast-learning-to-generate","title":"Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow","arxiv_id":"2209.03003","date":"2022-09-07","proceeding":null,"authors":["Xingchao Liu","Chengyue Gong","Qiang Liu"],"abstract":"We present rectified flow, a surprisingly simple approach to learning (neural) ordinary differential equation (ODE) models to transport between two empirically observed distributions \\pi_0 and \\pi_1, hence providing a unified solution to generative modeling and domain transfer, among various other tasks involving distribution transport. The idea of rectified flow is to learn the ODE to follow the straight paths connecting the points drawn from \\pi_0 and \\pi_1 as much as possible. This is achieved by solving a straightforward nonlinear least squares optimization problem, which can be easily scaled to large models without introducing extra parameters beyond standard supervised learning. The straight paths are special and preferred because they are the shortest paths between two points, and can be simulated exactly without time discretization and hence yield computationally efficient models. We show that the procedure of learning a rectified flow from data, called rectification, turns an arbitrary coupling of \\pi_0 and \\pi_1 to a new deterministic coupling with provably non-increasing convex transport costs. In addition, recursively applying rectification allows us to obtain a sequence of flows with increasingly straight paths, which can be simulated accurately with coarse time discretization in the inference phase. In empirical studies, we show that rectified flow performs superbly on image generation, image-to-image translation, and domain adaptation. In particular, on image generation and translation, our method yields nearly straight flows that give high quality results even with a single Euler discretization step.","url_abs":"https://arxiv.org/abs/2209.03003v1","url_pdf":"https://arxiv.org/pdf/2209.03003v1.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":[{"paper_slug":"flow-straight-and-fast-learning-to-generate","repo_url":"https://github.com/gnobitab/RectifiedFlow","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":null},{"paper_slug":"flow-straight-and-fast-learning-to-generate","repo_url":"https://github.com/sangyun884/fast-ode","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"flow-straight-and-fast-learning-to-generate","repo_url":"https://github.com/shivammehta25/Matcha-TTS","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"flow-straight-and-fast-learning-to-generate","repo_url":"https://github.com/MaximeVandegar/Papers-in-100-Lines-of-Code/tree/main/Flow_Straight_and_Fast_Learning_to_Generate_and_Transfer_Data_with_Rectified_Flow","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"flow-straight-and-fast-learning-to-generate","repo_url":"https://github.com/leffff/FlowModels","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"flow-straight-and-fast-learning-to-generate","repo_url":"https://github.com/leffff/flow-matching-experiments","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"domain-adaptation","task_name":"Domain Adaptation"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"image-to-image-translation","task_name":"Image-to-Image Translation"},{"task_slug":"translation","task_name":"Translation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2209.03003","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2209.03003"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sangyun884/fast-ode","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/gnobitab/RectifiedFlow","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/shivammehta25/Matcha-TTS","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/leffff/FlowModels","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/leffff/flow-matching-experiments","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MaximeVandegar/Papers-in-100-Lines-of-Code/tree/main/Flow_Straight_and_Fast_Learning_to_Generate_and_Transfer_Data_with_Rectified_Flow","reach":null}],"summary":{"ran":3,"ran_honours":3,"unverified":2},"by_repo_kind":{"official":{"samples":1,"ran":1,"repositories":1},"listed":{"samples":7,"ran":5,"repositories":3}},"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":6,"samples":[{"code_sha256_prefix":"b6254a5689d5af5a","entry":"BaseFlow","repo":"sangyun884/fast-ode","repo_kind":"listed","path":"flows.py","file_url":"https://github.com/sangyun884/fast-ode/blob/HEAD/flows.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b6254a5689d5af5a"}},{"code_sha256_prefix":"58ff86add41b30c1","entry":"RectifiedFlow","repo":"sangyun884/fast-ode","repo_kind":"listed","path":"flows.py","file_url":"https://github.com/sangyun884/fast-ode/blob/HEAD/flows.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"58ff86add41b30c1"}},{"code_sha256_prefix":"7fa3874fe6727844","entry":"RectifiedFlow","repo":"gnobitab/RectifiedFlow","repo_kind":"official","path":"ImageGeneration/sde_lib.py","file_url":"https://github.com/gnobitab/RectifiedFlow/blob/HEAD/ImageGeneration/sde_lib.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7fa3874fe6727844"}},{"code_sha256_prefix":"5d55915705d80ae7","entry":"alpha","repo":"sangyun884/fast-ode","repo_kind":"listed","path":"flows.py","file_url":"https://github.com/sangyun884/fast-ode/blob/HEAD/flows.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5d55915705d80ae7"}},{"code_sha256_prefix":"db9529b774b23cb2","entry":"d_1_minus_alpha_sq_dt","repo":"sangyun884/fast-ode","repo_kind":"listed","path":"flows.py","file_url":"https://github.com/sangyun884/fast-ode/blob/HEAD/flows.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"db9529b774b23cb2"}},{"code_sha256_prefix":"dc0efae5b0e9861f","entry":"dalpha_dt","repo":"sangyun884/fast-ode","repo_kind":"listed","path":"flows.py","file_url":"https://github.com/sangyun884/fast-ode/blob/HEAD/flows.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dc0efae5b0e9861f"}},{"code_sha256_prefix":"1ca3feb264ebba6f","entry":"flow_matching_loss","repo":"leffff/FlowModels","repo_kind":"listed","path":"flow_models/losses.py","file_url":"https://github.com/leffff/FlowModels/blob/HEAD/flow_models/losses.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1ca3feb264ebba6f"}},{"code_sha256_prefix":"4d0eea3b30504749","entry":"train_rectified_flow","repo":"MaximeVandegar/Papers-in-100-Lines-of-Code","repo_kind":"listed","path":"Flow_Straight_and_Fast_Learning_to_Generate_and_Transfer_Data_with_Rectified_Flow/flow_straight_and_fast.py","file_url":"https://github.com/MaximeVandegar/Papers-in-100-Lines-of-Code/blob/HEAD/Flow_Straight_and_Fast_Learning_to_Generate_and_Transfer_Data_with_Rectified_Flow/flow_straight_and_fast.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4d0eea3b30504749"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}