{"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-network-based-generative-models-for-non","title":"Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation","arxiv_id":"2106.04399","date":"2021-06-08","proceeding":"NeurIPS 2021 12","authors":["Emmanuel Bengio","Moksh Jain","Maksym Korablyov","Doina Precup","Yoshua Bengio"],"abstract":"This paper is about the problem of learning a stochastic policy for generating an object (like a molecular graph) from a sequence of actions, such that the probability of generating an object is proportional to a given positive reward for that object. Whereas standard return maximization tends to converge to a single return-maximizing sequence, there are cases where we would like to sample a diverse set of high-return solutions. These arise, for example, in black-box function optimization when few rounds are possible, each with large batches of queries, where the batches should be diverse, e.g., in the design of new molecules. One can also see this as a problem of approximately converting an energy function to a generative distribution. While MCMC methods can achieve that, they are expensive and generally only perform local exploration. Instead, training a generative policy amortizes the cost of search during training and yields to fast generation. Using insights from Temporal Difference learning, we propose GFlowNet, based on a view of the generative process as a flow network, making it possible to handle the tricky case where different trajectories can yield the same final state, e.g., there are many ways to sequentially add atoms to generate some molecular graph. We cast the set of trajectories as a flow and convert the flow consistency equations into a learning objective, akin to the casting of the Bellman equations into Temporal Difference methods. We prove that any global minimum of the proposed objectives yields a policy which samples from the desired distribution, and demonstrate the improved performance and diversity of GFlowNet on a simple domain where there are many modes to the reward function, and on a molecule synthesis task.","url_abs":"https://arxiv.org/abs/2106.04399v2","url_pdf":"https://arxiv.org/pdf/2106.04399v2.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-network-based-generative-models-for-non","repo_url":"https://github.com/bengioe/gflownet","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"flow-network-based-generative-models-for-non","repo_url":"https://github.com/SeonghwanSeo/RxnFlow","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"flow-network-based-generative-models-for-non","repo_url":"https://github.com/gfnorg/gflownet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"flow-network-based-generative-models-for-non","repo_url":"https://github.com/lazaratan/gflownet-generalization","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"flow-network-based-generative-models-for-non","repo_url":"https://github.com/princetonlips/mam","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"flow-network-based-generative-models-for-non","repo_url":"https://github.com/recursionpharma/gflownet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2106.04399","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.04399"}},"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/bengioe/gflownet","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/SeonghwanSeo/RxnFlow","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lazaratan/gflownet-generalization","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/recursionpharma/gflownet","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/princetonlips/mam","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/gfnorg/gflownet","reach":null}],"summary":{"ran_violates":1,"ran":2,"ran_draft_wrong":8,"ran_honours":3,"ran_fixture":2,"unverified":15},"by_repo_kind":{"official":{"samples":15,"ran":3,"repositories":1},"listed":{"samples":8,"ran":7,"repositories":3},"community":{"samples":1,"ran":1,"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":10,"samples":[{"code_sha256_prefix":"1061c8464b631df1","entry":"safe","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_violates","verification_level":2,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"1061c8464b631df1"}},{"code_sha256_prefix":"ece02e732c2290ba","entry":"GraphAgent","repo":"gfnorg/gflownet","repo_kind":"listed","path":"mols/model_block.py","file_url":"https://github.com/gfnorg/gflownet/blob/HEAD/mols/model_block.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ece02e732c2290ba"}},{"code_sha256_prefix":"b78da7a4b43fba13","entry":"MAM","repo":"princetonlips/mam","repo_kind":"listed","path":"mam/models/mam.py","file_url":"https://github.com/princetonlips/mam/blob/HEAD/mam/models/mam.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":"b78da7a4b43fba13"}},{"code_sha256_prefix":"af9f0f910f9bbc52","entry":"array_may_17","repo":"GFNOrg/gflownet","repo_kind":"listed","path":"mols/mars.py","file_url":"https://github.com/GFNOrg/gflownet/blob/HEAD/mols/mars.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"af9f0f910f9bbc52"}},{"code_sha256_prefix":"4e16af7e5dbea818","entry":"binarize_static","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"4e16af7e5dbea818"}},{"code_sha256_prefix":"b8e02a8995424b4e","entry":"branin","repo":"bengioe/gflownet","repo_kind":"official","path":"grid/cond_grid_dag.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/grid/cond_grid_dag.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b8e02a8995424b4e"}},{"code_sha256_prefix":"2a8ed5bf472b7004","entry":"cross","repo":"recursionpharma/gflownet","repo_kind":"listed","path":"src/gflownet/algo/trajectory_balance.py","file_url":"https://github.com/recursionpharma/gflownet/blob/HEAD/src/gflownet/algo/trajectory_balance.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2a8ed5bf472b7004"}},{"code_sha256_prefix":"54dafc6a55c42deb","entry":"currin","repo":"bengioe/gflownet","repo_kind":"official","path":"grid/cond_grid_dag.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/grid/cond_grid_dag.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"54dafc6a55c42deb"}},{"code_sha256_prefix":"e9f231473aac8e22","entry":"gen_order","repo":"princetonlips/mam","repo_kind":"listed","path":"mam/models/mam.py","file_url":"https://github.com/princetonlips/mam/blob/HEAD/mam/models/mam.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e9f231473aac8e22"}},{"code_sha256_prefix":"c59313aa188e63c6","entry":"make_mlp","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"c59313aa188e63c6"}},{"code_sha256_prefix":"2b63a9198ca42b4e","entry":"make_mlp","repo":"bengioe/gflownet","repo_kind":"official","path":"grid/cond_grid_dag.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/grid/cond_grid_dag.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2b63a9198ca42b4e"}},{"code_sha256_prefix":"30d10fc001f71c75","entry":"make_opt","repo":"alexhernandezgarcia/gflownet","repo_kind":"community","path":"gflownet/gflownet.py","file_url":"https://github.com/alexhernandezgarcia/gflownet/blob/HEAD/gflownet/gflownet.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"30d10fc001f71c75"}},{"code_sha256_prefix":"bf574d554afe6839","entry":"sample","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"bf574d554afe6839"}},{"code_sha256_prefix":"afd6888b673d0c17","entry":"sample_order","repo":"princetonlips/mam","repo_kind":"listed","path":"mam/models/mam.py","file_url":"https://github.com/princetonlips/mam/blob/HEAD/mam/models/mam.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"afd6888b673d0c17"}},{"code_sha256_prefix":"a508d01ed77ced0b","entry":"shift_right","repo":"recursionpharma/gflownet","repo_kind":"listed","path":"src/gflownet/algo/trajectory_balance.py","file_url":"https://github.com/recursionpharma/gflownet/blob/HEAD/src/gflownet/algo/trajectory_balance.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a508d01ed77ced0b"}},{"code_sha256_prefix":"0461df5888f82edd","entry":"sleep_step","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"0461df5888f82edd"}},{"code_sha256_prefix":"c3caff85ecc30396","entry":"array_may_18","repo":"bengioe/gflownet","repo_kind":"official","path":"mols/ppo.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/mols/ppo.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":"c3caff85ecc30396"}},{"code_sha256_prefix":"e81128bd6b1cab12","entry":"branin","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"e81128bd6b1cab12"}},{"code_sha256_prefix":"9c972ac9b931bb9e","entry":"currin","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"9c972ac9b931bb9e"}},{"code_sha256_prefix":"bf7643eca4bc2a69","entry":"func_corners","repo":"bengioe/gflownet","repo_kind":"official","path":"grid/toy_grid_dag.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/grid/toy_grid_dag.py","link_basis":"plan_row","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":"bf7643eca4bc2a69"}},{"code_sha256_prefix":"58d90758e97a6d03","entry":"func_corners_floor_A","repo":"bengioe/gflownet","repo_kind":"official","path":"grid/toy_grid_dag.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/grid/toy_grid_dag.py","link_basis":"plan_row","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":"58d90758e97a6d03"}},{"code_sha256_prefix":"aa7a567324830eab","entry":"func_corners_floor_B","repo":"bengioe/gflownet","repo_kind":"official","path":"grid/toy_grid_dag.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/grid/toy_grid_dag.py","link_basis":"plan_row","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":"aa7a567324830eab"}},{"code_sha256_prefix":"f08d023272aa048c","entry":"generate_batch","repo":"bengioe/gflownet","repo_kind":"official","path":"grid/toy_grid_dag_al.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/grid/toy_grid_dag_al.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":"f08d023272aa048c"}},{"code_sha256_prefix":"7ff5d9aaf5641dd3","entry":"get_network_output","repo":"bengioe/gflownet","repo_kind":"official","path":"grid/toy_grid_dag_al.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/grid/toy_grid_dag_al.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":"7ff5d9aaf5641dd3"}},{"code_sha256_prefix":"f763f98f79152e0e","entry":"mol2graph","repo":"bengioe/gflownet","repo_kind":"official","path":"mols/model_block.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/mols/model_block.py","link_basis":"plan_row","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":"f763f98f79152e0e"}},{"code_sha256_prefix":"06477cbf36090384","entry":"mols2batch","repo":"bengioe/gflownet","repo_kind":"official","path":"mols/model_atom.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/mols/model_atom.py","link_basis":"plan_row","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":"06477cbf36090384"}},{"code_sha256_prefix":"e2f61d62c1a23b4e","entry":"mols2batch","repo":"bengioe/gflownet","repo_kind":"official","path":"mols/model_block.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/mols/model_block.py","link_basis":"plan_row","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":"e2f61d62c1a23b4e"}},{"code_sha256_prefix":"32208d4977dcb086","entry":"mols2batch","repo":"bengioe/gflownet","repo_kind":"official","path":"mols/model_fingerprint.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/mols/model_fingerprint.py","link_basis":"plan_row","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":"32208d4977dcb086"}},{"code_sha256_prefix":"d2e1d2a558b75603","entry":"subTB","repo":"recursionpharma/gflownet","repo_kind":"listed","path":"src/gflownet/algo/trajectory_balance.py","file_url":"https://github.com/recursionpharma/gflownet/blob/HEAD/src/gflownet/algo/trajectory_balance.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":"d2e1d2a558b75603"}},{"code_sha256_prefix":"c29d60fd9bc56a0c","entry":"train_generative_model","repo":"bengioe/gflownet","repo_kind":"official","path":"mols/gflownet_activelearning.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/mols/gflownet_activelearning.py","link_basis":"plan_row","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":"c29d60fd9bc56a0c"}},{"code_sha256_prefix":"df792b9c5dae7a48","entry":"train_model_with_proxy","repo":"bengioe/gflownet","repo_kind":"official","path":"mols/gflownet.py","file_url":"https://github.com/bengioe/gflownet/blob/HEAD/mols/gflownet.py","link_basis":"plan_row","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":"df792b9c5dae7a48"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}