{"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/would-i-lie-to-you-inference-time-alignment","title":"Would I Lie To You? Inference Time Alignment of Language Models using Direct Preference Heads","arxiv_id":"2405.20053","date":"2024-05-30","proceeding":null,"authors":["Avelina Asada Hadji-Kyriacou","Ognjen Arandjelovic"],"abstract":"Pre-trained Language Models (LMs) exhibit strong zero-shot and in-context learning capabilities; however, their behaviors are often difficult to control. By utilizing Reinforcement Learning from Human Feedback (RLHF), it is possible to fine-tune unsupervised LMs to follow instructions and produce outputs that reflect human preferences. Despite its benefits, RLHF has been shown to potentially harm a language model's reasoning capabilities and introduce artifacts such as hallucinations where the model may fabricate facts. To address this issue we introduce Direct Preference Heads (DPH), a fine-tuning framework that enables LMs to learn human preference signals through an auxiliary reward head without directly affecting the output distribution of the language modeling head. We perform a theoretical analysis of our objective function and find strong ties to Conservative Direct Preference Optimization (cDPO). Finally we evaluate our models on GLUE, RACE, and the GPT4All evaluation suite and demonstrate that our method produces models which achieve higher scores than those fine-tuned with Supervised Fine-Tuning (SFT) or Direct Preference Optimization (DPO) alone.","url_abs":"https://arxiv.org/abs/2405.20053v1","url_pdf":"https://arxiv.org/pdf/2405.20053v1.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":"would-i-lie-to-you-inference-time-alignment","repo_url":"https://github.com/Avelina9X/direct-preference-heads","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"tasks":[{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2405.20053","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.20053"}},"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/Avelina9X/direct-preference-heads","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"summary":{"ran":7,"unverified":3},"by_repo_kind":{"official":{"samples":10,"ran":7,"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":"b89063b1be6c42f5","entry":"aggregate_glue_score","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/instruct_tune.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/instruct_tune.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"b89063b1be6c42f5"}},{"code_sha256_prefix":"8994a3870c745fda","entry":"aggregate_gpt4all_score","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/instruct_align.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/instruct_align.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"8994a3870c745fda"}},{"code_sha256_prefix":"f7e0930b997e4b1d","entry":"find_and_extract","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/train_utils.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/train_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"f7e0930b997e4b1d"}},{"code_sha256_prefix":"bf1ada0196c0d093","entry":"get_candidate","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/generate.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/generate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"bf1ada0196c0d093"}},{"code_sha256_prefix":"4ef815f16b596db0","entry":"get_checkpoint_path","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/train_utils.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/train_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"4ef815f16b596db0"}},{"code_sha256_prefix":"4fcf957d05ec4338","entry":"get_user_input","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/generate.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/generate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"4fcf957d05ec4338"}},{"code_sha256_prefix":"b03f8a7ca1b343ee","entry":"weighted_score","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/evaluation.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/evaluation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"b03f8a7ca1b343ee"}},{"code_sha256_prefix":"226dd34e79cd60d3","entry":"add_response","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/generate.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/generate.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"226dd34e79cd60d3"}},{"code_sha256_prefix":"2fe9a18e4cdecc06","entry":"aggregate_gpt4all_score","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/instruct_tune.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/instruct_tune.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"2fe9a18e4cdecc06"}},{"code_sha256_prefix":"f7c918ee79c006bf","entry":"apply_rope","repo":"Avelina9X/direct-preference-heads","repo_kind":"official","path":"src/model/layers.py","file_url":"https://github.com/Avelina9X/direct-preference-heads/blob/HEAD/src/model/layers.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"f7c918ee79c006bf"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}