{"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/towards-effective-context-for-meta","title":"Towards Effective Context for Meta-Reinforcement Learning: an Approach based on Contrastive Learning","arxiv_id":"2009.13891","date":"2020-09-29","proceeding":null,"authors":["Haotian Fu","Hongyao Tang","Jianye Hao","Chen Chen","Xidong Feng","Dong Li","Wulong Liu"],"abstract":"Context, the embedding of previous collected trajectories, is a powerful construct for Meta-Reinforcement Learning (Meta-RL) algorithms. By conditioning on an effective context, Meta-RL policies can easily generalize to new tasks within a few adaptation steps. We argue that improving the quality of context involves answering two questions: 1. How to train a compact and sufficient encoder that can embed the task-specific information contained in prior trajectories? 2. How to collect informative trajectories of which the corresponding context reflects the specification of tasks? To this end, we propose a novel Meta-RL framework called CCM (Contrastive learning augmented Context-based Meta-RL). We first focus on the contrastive nature behind different tasks and leverage it to train a compact and sufficient context encoder. Further, we train a separate exploration policy and theoretically derive a new information-gain-based objective which aims to collect informative trajectories in a few steps. Empirically, we evaluate our approaches on common benchmarks as well as several complex sparse-reward environments. The experimental results show that CCM outperforms state-of-the-art algorithms by addressing previously mentioned problems respectively.","url_abs":"https://arxiv.org/abs/2009.13891v3","url_pdf":"https://arxiv.org/pdf/2009.13891v3.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":"towards-effective-context-for-meta","repo_url":"https://github.com/TJU-DRL-LAB/self-supervised-rl/tree/ece95621b8c49f154f96cf7d395b95362a3b3d4e/RL_with_Environment_Representation/ccm","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"meta-reinforcement-learning","task_name":"Meta Reinforcement Learning"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"},{"task_slug":"reinforcement-learning-2","task_name":"reinforcement-learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2009.13891","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2009.13891"}},"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/TJU-DRL-LAB/self-supervised-rl/tree/ece95621b8c49f154f96cf7d395b95362a3b3d4e/RL_with_Environment_Representation/ccm","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_draft_wrong":1,"unverified":4},"by_repo_kind":{"official":{"samples":5,"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":0,"samples":[{"code_sha256_prefix":"e937b70b07bfc9d1","entry":"deep_update_dict","repo":"TJU-DRL-LAB/self-supervised-rl","repo_kind":"official","path":"RL_with_Environment_Representation/ccm/launch_experiment.py","file_url":"https://github.com/TJU-DRL-LAB/self-supervised-rl/blob/HEAD/RL_with_Environment_Representation/ccm/launch_experiment.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e937b70b07bfc9d1"}},{"code_sha256_prefix":"94587585389ef56a","entry":"make_one_hot","repo":"TJU-DRL-LAB/self-supervised-rl","repo_kind":"official","path":"RL_with_Environment_Representation/PAnDR/env_utils.py","file_url":"https://github.com/TJU-DRL-LAB/self-supervised-rl/blob/HEAD/RL_with_Environment_Representation/PAnDR/env_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":"94587585389ef56a"}},{"code_sha256_prefix":"a26c4433e3e83ea7","entry":"post_process","repo":"TJU-DRL-LAB/self-supervised-rl","repo_kind":"official","path":"RL_with_Environment_Representation/ccm/plot_csv.py","file_url":"https://github.com/TJU-DRL-LAB/self-supervised-rl/blob/HEAD/RL_with_Environment_Representation/ccm/plot_csv.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":"a26c4433e3e83ea7"}},{"code_sha256_prefix":"a89da1a0ff56ede9","entry":"save_model","repo":"TJU-DRL-LAB/self-supervised-rl","repo_kind":"official","path":"RL_with_Environment_Representation/PAnDR/pandr_utils.py","file_url":"https://github.com/TJU-DRL-LAB/self-supervised-rl/blob/HEAD/RL_with_Environment_Representation/PAnDR/pandr_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":"a89da1a0ff56ede9"}},{"code_sha256_prefix":"f500cf83b3947999","entry":"torch_load","repo":"TJU-DRL-LAB/self-supervised-rl","repo_kind":"official","path":"RL_with_Environment_Representation/PAnDR/pandr_utils.py","file_url":"https://github.com/TJU-DRL-LAB/self-supervised-rl/blob/HEAD/RL_with_Environment_Representation/PAnDR/pandr_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":"f500cf83b3947999"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}