{"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/language-models-represent-beliefs-of-self-and","title":"Language Models Represent Beliefs of Self and Others","arxiv_id":"2402.18496","date":"2024-02-28","proceeding":null,"authors":["Wentao Zhu","Zhining Zhang","Yizhou Wang"],"abstract":"Understanding and attributing mental states, known as Theory of Mind (ToM), emerges as a fundamental capability for human social reasoning. While Large Language Models (LLMs) appear to possess certain ToM abilities, the mechanisms underlying these capabilities remain elusive. In this study, we discover that it is possible to linearly decode the belief status from the perspectives of various agents through neural activations of language models, indicating the existence of internal representations of self and others' beliefs. By manipulating these representations, we observe dramatic changes in the models' ToM performance, underscoring their pivotal role in the social reasoning process. Additionally, our findings extend to diverse social reasoning tasks that involve different causal inference patterns, suggesting the potential generalizability of these representations.","url_abs":"https://arxiv.org/abs/2402.18496v3","url_pdf":"https://arxiv.org/pdf/2402.18496v3.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":"language-models-represent-beliefs-of-self-and","repo_url":"https://github.com/walter0807/repbelief","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"causal-inference","task_name":"Causal Inference"}],"methods":[{"method_slug":"causal-inference","method_name":"Causal inference"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2402.18496","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.18496"}},"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/walter0807/repbelief","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":11},"by_repo_kind":{"listed":{"samples":11,"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":"d1d07f3aa39be431","entry":"ans2action","repo":"walter0807/repbelief","repo_kind":"listed","path":"save_reps.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/save_reps.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":"d1d07f3aa39be431"}},{"code_sha256_prefix":"3a4c9454f22b909b","entry":"ans2belief","repo":"walter0807/repbelief","repo_kind":"listed","path":"save_reps.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/save_reps.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":"3a4c9454f22b909b"}},{"code_sha256_prefix":"4a56cbd45a67e0de","entry":"blend_directions","repo":"walter0807/repbelief","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/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":"4a56cbd45a67e0de"}},{"code_sha256_prefix":"4191bb151ff8a860","entry":"colorize","repo":"walter0807/repbelief","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/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":"4191bb151ff8a860"}},{"code_sha256_prefix":"db57834450fc899b","entry":"get_interventions_dict","repo":"walter0807/repbelief","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/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":"db57834450fc899b"}},{"code_sha256_prefix":"64e0883b09157134","entry":"load_data","repo":"walter0807/repbelief","repo_kind":"listed","path":"probe.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/probe.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":"64e0883b09157134"}},{"code_sha256_prefix":"6b12dca756d315b0","entry":"parse_answer","repo":"walter0807/repbelief","repo_kind":"listed","path":"evaluate_conditions.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/evaluate_conditions.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":"6b12dca756d315b0"}},{"code_sha256_prefix":"af77b4a64d3c3cc9","entry":"parse_chat_response","repo":"walter0807/repbelief","repo_kind":"listed","path":"evaluate_llm.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/evaluate_llm.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":"af77b4a64d3c3cc9"}},{"code_sha256_prefix":"044944533a7c07ef","entry":"probe_all","repo":"walter0807/repbelief","repo_kind":"listed","path":"probe.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/probe.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":"044944533a7c07ef"}},{"code_sha256_prefix":"5755912ef40da6c2","entry":"probe_single_case","repo":"walter0807/repbelief","repo_kind":"listed","path":"probe.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/probe.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":"5755912ef40da6c2"}},{"code_sha256_prefix":"5193e64eec5858a2","entry":"probe_single_case_multinomial","repo":"walter0807/repbelief","repo_kind":"listed","path":"probe_multinomial.py","file_url":"https://github.com/walter0807/repbelief/blob/HEAD/probe_multinomial.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":"5193e64eec5858a2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}