{"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/f-po-generalizing-preference-optimization","title":"$f$-PO: Generalizing Preference Optimization with $f$-divergence Minimization","arxiv_id":"2410.21662","date":"2024-10-29","proceeding":null,"authors":["Jiaqi Han","Mingjian Jiang","Yuxuan Song","Jure Leskovec","Stefano Ermon","Minkai Xu"],"abstract":"Preference optimization has made significant progress recently, with numerous methods developed to align language models with human preferences. This paper introduces $f$-divergence Preference Optimization ($f$-PO), a novel framework that generalizes and extends existing approaches. $f$-PO minimizes $f$-divergences between the optimized policy and the optimal policy, encompassing a broad family of alignment methods using various divergences. Our approach unifies previous algorithms like DPO and EXO, while offering new variants through different choices of $f$-divergences. We provide theoretical analysis of $f$-PO's properties and conduct extensive experiments on state-of-the-art language models using benchmark datasets. Results demonstrate $f$-PO's effectiveness across various tasks, achieving superior performance compared to existing methods on popular benchmarks such as AlpacaEval 2, Arena-Hard, and MT-Bench. Additionally, we present ablation studies exploring the impact of different $f$-divergences, offering insights into the trade-offs between regularization and performance in offline preference optimization. Our work contributes both practical algorithms and theoretical understanding to the field of language model alignment. Code is available at https://github.com/MinkaiXu/fPO.","url_abs":"https://arxiv.org/abs/2410.21662v1","url_pdf":"https://arxiv.org/pdf/2410.21662v1.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":"f-po-generalizing-preference-optimization","repo_url":"https://github.com/minkaixu/fpo","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"align","method_name":"ALIGN"},{"method_slug":"dpo","method_name":"DPO"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.21662","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.21662"}},"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/minkaixu/fpo","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":14},"by_repo_kind":{"official":{"samples":14,"ran":0,"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":"069f56cb00324e10","entry":"calculate_flops","repo":"minkaixu/fpo","repo_kind":"official","path":"src/utils/perf.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/utils/perf.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":"069f56cb00324e10"}},{"code_sha256_prefix":"c0e274d4f6e1c499","entry":"causal_lm_model_to_fp32_loss","repo":"minkaixu/fpo","repo_kind":"official","path":"src/utils/model/model_utils.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/utils/model/model_utils.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":"c0e274d4f6e1c499"}},{"code_sha256_prefix":"f87ec21e6cc554fb","entry":"dpo_loss","repo":"minkaixu/fpo","repo_kind":"official","path":"src/align_stage/loss.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/align_stage/loss.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":"f87ec21e6cc554fb"}},{"code_sha256_prefix":"ca139c7b291fafb7","entry":"exact_loss","repo":"minkaixu/fpo","repo_kind":"official","path":"src/align_stage/loss.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/align_stage/loss.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":"ca139c7b291fafb7"}},{"code_sha256_prefix":"7ffcd72b9da5e2d2","entry":"fpo_loss","repo":"minkaixu/fpo","repo_kind":"official","path":"src/align_stage/loss.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/align_stage/loss.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":"7ffcd72b9da5e2d2"}},{"code_sha256_prefix":"af991fecf57a358d","entry":"get_data_path","repo":"minkaixu/fpo","repo_kind":"official","path":"src/align_stage/inference.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/align_stage/inference.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":"af991fecf57a358d"}},{"code_sha256_prefix":"792e87a1badc5642","entry":"get_eval_ds_config","repo":"minkaixu/fpo","repo_kind":"official","path":"src/utils/ds_utils.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/utils/ds_utils.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":"792e87a1badc5642"}},{"code_sha256_prefix":"df20c2f4083d17af","entry":"get_hf_configs","repo":"minkaixu/fpo","repo_kind":"official","path":"src/utils/perf.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/utils/perf.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":"df20c2f4083d17af"}},{"code_sha256_prefix":"018e3a683c8bc191","entry":"get_tokenizer","repo":"minkaixu/fpo","repo_kind":"official","path":"src/utils/utils.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/utils/utils.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":"018e3a683c8bc191"}},{"code_sha256_prefix":"998ed94665ef9d83","entry":"load_hf_tokenizer","repo":"minkaixu/fpo","repo_kind":"official","path":"src/utils/utils.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/utils/utils.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":"998ed94665ef9d83"}},{"code_sha256_prefix":"7d082cd1b7edc2aa","entry":"only_optimize_lora_parameters","repo":"minkaixu/fpo","repo_kind":"official","path":"src/utils/module/lora.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/utils/module/lora.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":"7d082cd1b7edc2aa"}},{"code_sha256_prefix":"f2912713a5377070","entry":"read_json","repo":"minkaixu/fpo","repo_kind":"official","path":"src/api.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/api.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":"f2912713a5377070"}},{"code_sha256_prefix":"c97333aaf3e9d25f","entry":"read_text","repo":"minkaixu/fpo","repo_kind":"official","path":"src/api.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/api.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":"c97333aaf3e9d25f"}},{"code_sha256_prefix":"387b9e6c4f21dd62","entry":"to_device","repo":"minkaixu/fpo","repo_kind":"official","path":"src/utils/utils.py","file_url":"https://github.com/minkaixu/fpo/blob/HEAD/src/utils/utils.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":"387b9e6c4f21dd62"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}