{"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/regularized-best-of-n-sampling-to-mitigate","title":"Regularized Best-of-N Sampling with Minimum Bayes Risk Objective for Language Model Alignment","arxiv_id":"2404.01054","date":"2024-04-01","proceeding":null,"authors":["Yuu Jinnai","Tetsuro Morimura","Kaito Ariu","Kenshi Abe"],"abstract":"Best-of-N (BoN) sampling with a reward model has been shown to be an effective strategy for aligning Large Language Models (LLMs) to human preferences at the time of decoding. BoN sampling is susceptible to a problem known as reward hacking when the accuracy of the reward model is not high enough due to the quality or the quantity of the preference dataset. Because the reward model is an imperfect proxy for the true objective, over-optimizing its value can compromise its performance on the true objective. In this research, we propose MBR-BoN, a variant of BoN that aims to mitigate reward hacking at inference time by incorporating the Minimum Bayes Risk (MBR) objective as a proximity regularization term. We show empirically and analytically that the MBR objective quantifies the proximity of the response to the reference policy, serving as a proximity regularizer. We evaluate MBR-BoN on the AlpacaFarm and Anthropic's hh-rlhf datasets and show that it outperforms both BoN sampling and MBR decoding. We also evaluate MBR-BoN to generate a pairwise preference learning dataset for Direct Preference Optimization (DPO). Empirical results show that models trained on a dataset generated with MBR-BoN outperform those with vanilla BoN. Our code is available at https://github.com/CyberAgentAILab/regularized-bon","url_abs":"https://arxiv.org/abs/2404.01054v4","url_pdf":"https://arxiv.org/pdf/2404.01054v4.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":"regularized-best-of-n-sampling-to-mitigate","repo_url":"https://github.com/CyberAgentAILab/regularized-bon","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":"dpo","method_name":"DPO"},{"method_slug":"proximity-regularization","method_name":"Proximity Regularization"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2404.01054","atlas_url":"https://app.syntology.ai/?focus=2404.01054","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.01054"}},"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/CyberAgentAILab/regularized-bon","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":5,"unverified":5},"by_repo_kind":{"official":{"samples":10,"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":"2f471e4ae87cabfe","entry":"compute_probability_lm","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/sample.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/sample.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":"2f471e4ae87cabfe"}},{"code_sha256_prefix":"f2562be9fc8bf800","entry":"compute_score_matrix","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/policy/mbr.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/policy/mbr.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":"f2562be9fc8bf800"}},{"code_sha256_prefix":"a1a9d6bb45118d21","entry":"get_sample_file_pattern","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"experiments/get_sample_names.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/experiments/get_sample_names.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":"a1a9d6bb45118d21"}},{"code_sha256_prefix":"03305d741386ebfc","entry":"get_texts","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/sample.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/sample.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":"03305d741386ebfc"}},{"code_sha256_prefix":"b1c9862a514d30da","entry":"load_kwargs","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/utils.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/utils.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":"b1c9862a514d30da"}},{"code_sha256_prefix":"5f18d24b8f81d632","entry":"compute_logprob","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/compute_logprob.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/compute_logprob.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":"5f18d24b8f81d632"}},{"code_sha256_prefix":"de665fbeba8102ec","entry":"compute_mbr","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/policy/mbr.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/policy/mbr.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":"de665fbeba8102ec"}},{"code_sha256_prefix":"4e4c9f273c11c32a","entry":"compute_probability_s2s","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/sample.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/sample.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":"4e4c9f273c11c32a"}},{"code_sha256_prefix":"39372e4fabc574c3","entry":"load_dataset","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/utils.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/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":"39372e4fabc574c3"}},{"code_sha256_prefix":"6a28c6520702b745","entry":"load_model","repo":"CyberAgentAILab/regularized-bon","repo_kind":"official","path":"mbr/utils.py","file_url":"https://github.com/CyberAgentAILab/regularized-bon/blob/HEAD/mbr/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":"6a28c6520702b745"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}