{"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/trafficgen-learning-to-generate-diverse-and","title":"TrafficGen: Learning to Generate Diverse and Realistic Traffic Scenarios","arxiv_id":"2210.06609","date":"2022-10-12","proceeding":null,"authors":["Lan Feng","Quanyi Li","Zhenghao Peng","Shuhan Tan","Bolei Zhou"],"abstract":"Diverse and realistic traffic scenarios are crucial for evaluating the AI safety of autonomous driving systems in simulation. This work introduces a data-driven method called TrafficGen for traffic scenario generation. It learns from the fragmented human driving data collected in the real world and then can generate realistic traffic scenarios. TrafficGen is an autoregressive generative model with an encoder-decoder architecture. In each autoregressive iteration, it first encodes the current traffic context with the attention mechanism and then decodes a vehicle's initial state followed by generating its long trajectory. We evaluate the trained model in terms of vehicle placement and trajectories and show substantial improvements over baselines. TrafficGen can be also used to augment existing traffic scenarios, by adding new vehicles and extending the fragmented trajectories. We further demonstrate that importing the generated scenarios into a simulator as interactive training environments improves the performance and the safety of driving policy learned from reinforcement learning. More project resource is available at https://metadriverse.github.io/trafficgen","url_abs":"https://arxiv.org/abs/2210.06609v2","url_pdf":"https://arxiv.org/pdf/2210.06609v2.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":"links_only","authors_date_abstract":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license), from the Kaggle arXiv metadata snapshot of 2026-09-12"},"code_links":[{"paper_slug":"trafficgen-learning-to-generate-diverse-and","repo_url":"https://github.com/metadriverse/trafficgen","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2210.06609","atlas_url":"https://app.syntology.ai/?focus=2210.06609","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2210.06609"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/metadriverse/trafficgen","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":7},"by_repo_kind":{"listed":{"samples":7,"ran":7,"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":"467cfdf8ba25d0dc","entry":"act_loss","repo":"metadriverse/trafficgen","repo_kind":"listed","path":"trafficgen/act/model/tg_act.py","file_url":"https://github.com/metadriverse/trafficgen/blob/HEAD/trafficgen/act/model/tg_act.py","link_basis":"harvester_set","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":"467cfdf8ba25d0dc"}},{"code_sha256_prefix":"b221aff3b6d88bb6","entry":"attention","repo":"metadriverse/trafficgen","repo_kind":"listed","path":"trafficgen/act/utils/model_utils.py","file_url":"https://github.com/metadriverse/trafficgen/blob/HEAD/trafficgen/act/utils/model_utils.py","link_basis":"harvester_set","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":"b221aff3b6d88bb6"}},{"code_sha256_prefix":"5b3a9f0588c19582","entry":"cal_rel_dir","repo":"metadriverse/trafficgen","repo_kind":"listed","path":"trafficgen/act_dataset.py","file_url":"https://github.com/metadriverse/trafficgen/blob/HEAD/trafficgen/act_dataset.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5b3a9f0588c19582"}},{"code_sha256_prefix":"3a8e240203d9f9a3","entry":"clones","repo":"metadriverse/trafficgen","repo_kind":"listed","path":"trafficgen/act/utils/model_utils.py","file_url":"https://github.com/metadriverse/trafficgen/blob/HEAD/trafficgen/act/utils/model_utils.py","link_basis":"harvester_set","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":"3a8e240203d9f9a3"}},{"code_sha256_prefix":"3d3484398ecd137e","entry":"process_lane","repo":"metadriverse/trafficgen","repo_kind":"listed","path":"trafficgen/act_dataset.py","file_url":"https://github.com/metadriverse/trafficgen/blob/HEAD/trafficgen/act_dataset.py","link_basis":"harvester_set","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":"3d3484398ecd137e"}},{"code_sha256_prefix":"a948ec19de381eb1","entry":"rotate","repo":"metadriverse/trafficgen","repo_kind":"listed","path":"trafficgen/act_dataset.py","file_url":"https://github.com/metadriverse/trafficgen/blob/HEAD/trafficgen/act_dataset.py","link_basis":"harvester_set","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":"a948ec19de381eb1"}},{"code_sha256_prefix":"7a726e7769eb7195","entry":"split_dim","repo":"metadriverse/trafficgen","repo_kind":"listed","path":"trafficgen/act/utils/model_utils.py","file_url":"https://github.com/metadriverse/trafficgen/blob/HEAD/trafficgen/act/utils/model_utils.py","link_basis":"harvester_set","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":"7a726e7769eb7195"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}