{"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/adversarial-preference-optimization","title":"Adversarial Preference Optimization: Enhancing Your Alignment via RM-LLM Game","arxiv_id":"2311.08045","date":"2023-11-14","proceeding":null,"authors":["Pengyu Cheng","Yifan Yang","Jian Li","Yong Dai","Tianhao Hu","Peixin Cao","Nan Du","Xiaolong Li"],"abstract":"Human preference alignment is essential to improve the interaction quality of large language models (LLMs). Existing alignment methods depend on manually annotated preference data to guide the LLM optimization directions. However, continuously updating LLMs for alignment raises a distribution gap between model-generated samples and human-annotated responses, hindering training effectiveness. To mitigate this issue, previous methods require additional preference annotation on newly generated samples to adapt to the shifted distribution, which consumes a large amount of annotation resources. Targeting more efficient human preference optimization, we propose an Adversarial Preference Optimization (APO) framework, in which the LLM and the reward model update alternatively via a min-max game. Through adversarial training, the reward model can adapt to the shifted generation distribution of the LLM without any additional annotation. With comprehensive experiments, we find the proposed adversarial training framework further enhances existing alignment baselines in terms of LLM helpfulness and harmlessness. The code is at https://github.com/Linear95/APO.","url_abs":"https://arxiv.org/abs/2311.08045v4","url_pdf":"https://arxiv.org/pdf/2311.08045v4.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":"adversarial-preference-optimization","repo_url":"https://github.com/linear95/apo","is_official":1,"mentioned_in_paper":1,"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/2311.08045","atlas_url":"https://app.syntology.ai/?focus=2311.08045","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2311.08045"}},"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/linear95/apo","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":5},"by_repo_kind":{"official":{"samples":5,"ran":5,"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":"5390483acda4ac9e","entry":"batch_padding","repo":"linear95/apo","repo_kind":"official","path":"reward_datasets.py","file_url":"https://github.com/linear95/apo/blob/HEAD/reward_datasets.py","link_basis":"first_harvest_node","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":"5390483acda4ac9e"}},{"code_sha256_prefix":"132d73468979ab25","entry":"merge_json_or_jsonl_data","repo":"linear95/apo","repo_kind":"official","path":"utils.py","file_url":"https://github.com/linear95/apo/blob/HEAD/utils.py","link_basis":"first_harvest_node","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":"132d73468979ab25"}},{"code_sha256_prefix":"6132b74f7967bc2b","entry":"numpy_sigmoid","repo":"linear95/apo","repo_kind":"official","path":"utils.py","file_url":"https://github.com/linear95/apo/blob/HEAD/utils.py","link_basis":"first_harvest_node","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":"6132b74f7967bc2b"}},{"code_sha256_prefix":"88d37ef54976663d","entry":"read_json_or_jsonl_data","repo":"linear95/apo","repo_kind":"official","path":"utils.py","file_url":"https://github.com/linear95/apo/blob/HEAD/utils.py","link_basis":"plan_row","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":"88d37ef54976663d"}},{"code_sha256_prefix":"70dc36d9f98f63c3","entry":"reward_model_loss","repo":"linear95/apo","repo_kind":"official","path":"trainer.py","file_url":"https://github.com/linear95/apo/blob/HEAD/trainer.py","link_basis":"first_harvest_node","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":"70dc36d9f98f63c3"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}