{"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/explaining-reinforcement-learning-policies","title":"Explaining Reinforcement Learning Policies through Counterfactual Trajectories","arxiv_id":"2201.12462","date":"2022-01-29","proceeding":null,"authors":["Julius Frost","Olivia Watkins","Eric Weiner","Pieter Abbeel","Trevor Darrell","Bryan Plummer","Kate Saenko"],"abstract":"In order for humans to confidently decide where to employ RL agents for real-world tasks, a human developer must validate that the agent will perform well at test-time. Some policy interpretability methods facilitate this by capturing the policy's decision making in a set of agent rollouts. However, even the most informative trajectories of training time behavior may give little insight into the agent's behavior out of distribution. In contrast, our method conveys how the agent performs under distribution shifts by showing the agent's behavior across a wider trajectory distribution. We generate these trajectories by guiding the agent to more diverse unseen states and showing the agent's behavior there. In a user study, we demonstrate that our method enables users to score better than baseline methods on one of two agent validation tasks.","url_abs":"https://arxiv.org/abs/2201.12462v2","url_pdf":"https://arxiv.org/pdf/2201.12462v2.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":"explaining-reinforcement-learning-policies","repo_url":"https://github.com/juliusfrost/cfrl-rllib","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":null}],"tasks":[{"task_slug":"decision-making","task_name":"Decision Making"},{"task_slug":"reinforcement-learning","task_name":"Reinforcement Learning"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"},{"task_slug":null,"task_name":"counterfactual"},{"task_slug":"reinforcement-learning-2","task_name":"reinforcement-learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2201.12462","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2201.12462"}},"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/juliusfrost/cfrl-rllib","reach":null}],"summary":{"ran_fixture":4,"unverified":7},"by_repo_kind":{"official":{"samples":11,"ran":4,"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":11,"samples":[{"code_sha256_prefix":"03f2ad4320935ae0","entry":"add_border","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"03f2ad4320935ae0"}},{"code_sha256_prefix":"3b5715bbe1ddd708","entry":"add_text","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3b5715bbe1ddd708"}},{"code_sha256_prefix":"92d0d0cbba8d1ad1","entry":"format_images","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"92d0d0cbba8d1ad1"}},{"code_sha256_prefix":"c0fd48116371f0cf","entry":"window_slice","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c0fd48116371f0cf"}},{"code_sha256_prefix":"a5cf1dfd7a8e2129","entry":"counterfactual_state","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/counterfactual.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/counterfactual.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a5cf1dfd7a8e2129"}},{"code_sha256_prefix":"824850595d2d17d4","entry":"counterfactual_trajectory","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/counterfactual.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/counterfactual.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"824850595d2d17d4"}},{"code_sha256_prefix":"5b71aa3ab9b41f09","entry":"generate_videos_cf","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5b71aa3ab9b41f09"}},{"code_sha256_prefix":"3bcb353f8056629b","entry":"generate_videos_counterfactual_method","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3bcb353f8056629b"}},{"code_sha256_prefix":"214f46068e072985","entry":"save_joint_video","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"214f46068e072985"}},{"code_sha256_prefix":"6ca54992198eb042","entry":"save_separate_videos","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6ca54992198eb042"}},{"code_sha256_prefix":"01d7ca16e0ad3ea4","entry":"write_video","repo":"juliusfrost/cfrl-rllib","repo_kind":"official","path":"explanations/generate_counterfactuals.py","file_url":"https://github.com/juliusfrost/cfrl-rllib/blob/HEAD/explanations/generate_counterfactuals.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"01d7ca16e0ad3ea4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}