{"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/reflect-rl-two-player-online-rl-fine-tuning","title":"Reflect-RL: Two-Player Online RL Fine-Tuning for LMs","arxiv_id":"2402.12621","date":"2024-02-20","proceeding":null,"authors":["Runlong Zhou","Simon S. Du","Beibin Li"],"abstract":"As language models (LMs) demonstrate their capabilities in various fields, their application to tasks requiring multi-round interactions has become increasingly popular. These tasks usually have complex dynamics, so supervised fine-tuning (SFT) on a limited offline dataset does not yield good performance. However, only a few works attempted to directly train the LMs within interactive decision-making environments. We aim to create an effective approach to fine-tune LMs with online reinforcement learning (RL) in these environments. We propose Reflect-RL, a two-player system to fine-tune an LM using SFT and online RL, where a frozen reflection model (player) assists the policy model (player). To generate data for the warm-up SFT stage, we use negative example generation to enhance the error-correction ability of the reflection model. Furthermore, we designed single-prompt action enumeration and applied curriculum learning to allow the policy model to learn more efficiently. Empirically, we verify that Reflect-RL outperforms SFT and online RL without reflection. Testing results indicate GPT-2 XL 1.56B fine-tuned with Reflect-RL outperforms larger open-source LMs, such as Mistral 7B. The benchmarks, dataset, and code involved in this work are publicly available: https://github.com/zhourunlong/Reflect-RL.","url_abs":"https://arxiv.org/abs/2402.12621v2","url_pdf":"https://arxiv.org/pdf/2402.12621v2.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":"reflect-rl-two-player-online-rl-fine-tuning","repo_url":"https://github.com/zhourunlong/reflect-rl","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":null}],"tasks":[{"task_slug":"decision-making","task_name":"Decision Making"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"discriminative-fine-tuning","method_name":"Discriminative Fine-Tuning"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-2","method_name":"GPT-2"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-cosine-annealing","method_name":"Linear Warmup With Cosine Annealing"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"sft","method_name":"SFT"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2402.12621","atlas_url":"https://app.syntology.ai/?focus=2402.12621","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.12621"}},"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":"deterministic:regex_extraction","url":"https://github.com/zhourunlong/Reflect-RL","reach":null}],"summary":{"ran":1,"ran_draft_wrong":1,"unverified":4},"by_repo_kind":{"official":{"samples":6,"ran":2,"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":"9917f19d5da4578d","entry":"PolicyTrainer","repo":"zhourunlong/Reflect-RL","repo_kind":"official","path":"trainers/ppotrainer.py","file_url":"https://github.com/zhourunlong/Reflect-RL/blob/HEAD/trainers/ppotrainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9917f19d5da4578d"}},{"code_sha256_prefix":"2e00d68051c3a593","entry":"compile_from_log","repo":"zhourunlong/Reflect-RL","repo_kind":"official","path":"trainers/ppotrainer.py","file_url":"https://github.com/zhourunlong/Reflect-RL/blob/HEAD/trainers/ppotrainer.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2e00d68051c3a593"}},{"code_sha256_prefix":"67efdf6ed6ca2dca","entry":"PPOTrainer","repo":"zhourunlong/Reflect-RL","repo_kind":"official","path":"trainers/ppotrainer.py","file_url":"https://github.com/zhourunlong/Reflect-RL/blob/HEAD/trainers/ppotrainer.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":"67efdf6ed6ca2dca"}},{"code_sha256_prefix":"634c2c825e2d9f24","entry":"calc_probs_log_probs","repo":"zhourunlong/Reflect-RL","repo_kind":"official","path":"trainers/ppotrainer.py","file_url":"https://github.com/zhourunlong/Reflect-RL/blob/HEAD/trainers/ppotrainer.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":"634c2c825e2d9f24"}},{"code_sha256_prefix":"39a497facb3b1a48","entry":"compute_advantage","repo":"zhourunlong/Reflect-RL","repo_kind":"official","path":"trainers/ppotrainer.py","file_url":"https://github.com/zhourunlong/Reflect-RL/blob/HEAD/trainers/ppotrainer.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":"39a497facb3b1a48"}},{"code_sha256_prefix":"0d7d3c331692259a","entry":"update_critic","repo":"zhourunlong/Reflect-RL","repo_kind":"official","path":"trainers/ppotrainer.py","file_url":"https://github.com/zhourunlong/Reflect-RL/blob/HEAD/trainers/ppotrainer.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":"0d7d3c331692259a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}