{"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/preference-transformer-modeling-human","title":"Preference Transformer: Modeling Human Preferences using Transformers for RL","arxiv_id":"2303.00957","date":"2023-03-02","proceeding":null,"authors":["Changyeon Kim","Jongjin Park","Jinwoo Shin","Honglak Lee","Pieter Abbeel","Kimin Lee"],"abstract":"Preference-based reinforcement learning (RL) provides a framework to train agents using human preferences between two behaviors. However, preference-based RL has been challenging to scale since it requires a large amount of human feedback to learn a reward function aligned with human intent. In this paper, we present Preference Transformer, a neural architecture that models human preferences using transformers. Unlike prior approaches assuming human judgment is based on the Markovian rewards which contribute to the decision equally, we introduce a new preference model based on the weighted sum of non-Markovian rewards. We then design the proposed preference model using a transformer architecture that stacks causal and bidirectional self-attention layers. We demonstrate that Preference Transformer can solve a variety of control tasks using real human preferences, while prior approaches fail to work. We also show that Preference Transformer can induce a well-specified reward and attend to critical events in the trajectory by automatically capturing the temporal dependencies in human decision-making. Code is available on the project website: https://sites.google.com/view/preference-transformer.","url_abs":"https://arxiv.org/abs/2303.00957v1","url_pdf":"https://arxiv.org/pdf/2303.00957v1.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":"preference-transformer-modeling-human","repo_url":"https://github.com/csmile-1006/preferencetransformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"jax","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"decision-making","task_name":"Decision Making"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"},{"method_slug":"fail","method_name":"fail"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2303.00957","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2303.00957"}},"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/csmile-1006/preferencetransformer","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":2,"ran_violates":1,"unverified":4},"by_repo_kind":{"official":{"samples":7,"ran":3,"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":"718462716d78ea99","entry":"default_init","repo":"csmile-1006/preferencetransformer","repo_kind":"official","path":"common.py","file_url":"https://github.com/csmile-1006/preferencetransformer/blob/HEAD/common.py","link_basis":"harvester_set","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":"718462716d78ea99"}},{"code_sha256_prefix":"13df74f8d96dca61","entry":"loss","repo":"csmile-1006/preferencetransformer","repo_kind":"official","path":"critic.py","file_url":"https://github.com/csmile-1006/preferencetransformer/blob/HEAD/critic.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"13df74f8d96dca61"}},{"code_sha256_prefix":"18c566cc009ddb07","entry":"multiple_action_q_function","repo":"csmile-1006/preferencetransformer","repo_kind":"official","path":"JaxPref/model.py","file_url":"https://github.com/csmile-1006/preferencetransformer/blob/HEAD/JaxPref/model.py","link_basis":"harvester_set","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":"18c566cc009ddb07"}},{"code_sha256_prefix":"79158e16a5bf1c29","entry":"batch_to_jax","repo":"csmile-1006/preferencetransformer","repo_kind":"official","path":"dataset_utils.py","file_url":"https://github.com/csmile-1006/preferencetransformer/blob/HEAD/dataset_utils.py","link_basis":"harvester_set","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":"79158e16a5bf1c29"}},{"code_sha256_prefix":"46f37a79cc320105","entry":"evaluate","repo":"csmile-1006/preferencetransformer","repo_kind":"official","path":"evaluation.py","file_url":"https://github.com/csmile-1006/preferencetransformer/blob/HEAD/evaluation.py","link_basis":"harvester_set","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":"46f37a79cc320105"}},{"code_sha256_prefix":"0c3b9f06d1f100cd","entry":"merge_trajectories","repo":"csmile-1006/preferencetransformer","repo_kind":"official","path":"dataset_utils.py","file_url":"https://github.com/csmile-1006/preferencetransformer/blob/HEAD/dataset_utils.py","link_basis":"harvester_set","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":"0c3b9f06d1f100cd"}},{"code_sha256_prefix":"2101c5b4715a06ea","entry":"split_into_trajectories","repo":"csmile-1006/preferencetransformer","repo_kind":"official","path":"dataset_utils.py","file_url":"https://github.com/csmile-1006/preferencetransformer/blob/HEAD/dataset_utils.py","link_basis":"harvester_set","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":"2101c5b4715a06ea"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}