{"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-space-and-time","title":"Language Models Represent Space and Time","arxiv_id":"2310.02207","date":"2023-10-03","proceeding":null,"authors":["Wes Gurnee","Max Tegmark"],"abstract":"The capabilities of large language models (LLMs) have sparked debate over whether such systems just learn an enormous collection of superficial statistics or a set of more coherent and grounded representations that reflect the real world. We find evidence for the latter by analyzing the learned representations of three spatial datasets (world, US, NYC places) and three temporal datasets (historical figures, artworks, news headlines) in the Llama-2 family of models. We discover that LLMs learn linear representations of space and time across multiple scales. These representations are robust to prompting variations and unified across different entity types (e.g. cities and landmarks). In addition, we identify individual \"space neurons\" and \"time neurons\" that reliably encode spatial and temporal coordinates. While further investigation is needed, our results suggest modern LLMs learn rich spatiotemporal representations of the real world and possess basic ingredients of a world model.","url_abs":"https://arxiv.org/abs/2310.02207v3","url_pdf":"https://arxiv.org/pdf/2310.02207v3.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-space-and-time","repo_url":"https://github.com/wesg52/world-models","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"language-models-represent-space-and-time","repo_url":"https://github.com/jettjaniak/chainscope","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2310.02207","atlas_url":"https://app.syntology.ai/?focus=2310.02207","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.02207"}},"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/jettjaniak/chainscope","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/wesg52/world-models","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":11,"unverified":13},"by_repo_kind":{"official":{"samples":24,"ran":11,"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":"c0e20198c0c90a86","entry":"adjust_precision","repo":"wesg52/world-models","repo_kind":"official","path":"utils.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/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":"c0e20198c0c90a86"}},{"code_sha256_prefix":"9931b4001e67bb95","entry":"get_model_family","repo":"wesg52/world-models","repo_kind":"official","path":"utils.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/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":"9931b4001e67bb95"}},{"code_sha256_prefix":"69dc982a438d4f48","entry":"get_top_neurons","repo":"wesg52/world-models","repo_kind":"official","path":"model_composition.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/model_composition.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":"69dc982a438d4f48"}},{"code_sha256_prefix":"80563515302e7660","entry":"load_activation_probing_dataset","repo":"wesg52/world-models","repo_kind":"official","path":"save_activations.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/save_activations.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":"80563515302e7660"}},{"code_sha256_prefix":"a7b32ab38a32b07a","entry":"load_activation_probing_dataset_args","repo":"wesg52/world-models","repo_kind":"official","path":"save_activations.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/save_activations.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":"a7b32ab38a32b07a"}},{"code_sha256_prefix":"e40d500a0bbcefbe","entry":"load_all_probe_evals","repo":"wesg52/world-models","repo_kind":"official","path":"evaluate_probes.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/evaluate_probes.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":"e40d500a0bbcefbe"}},{"code_sha256_prefix":"cd39e9fbf2e85bb4","entry":"load_evaluation","repo":"wesg52/world-models","repo_kind":"official","path":"evaluate_probes.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/evaluate_probes.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":"cd39e9fbf2e85bb4"}},{"code_sha256_prefix":"cd24389a9fa9621c","entry":"load_model","repo":"wesg52/world-models","repo_kind":"official","path":"load.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/load.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":"cd24389a9fa9621c"}},{"code_sha256_prefix":"3bf568dbe6a7fbb8","entry":"load_probe_results","repo":"wesg52/world-models","repo_kind":"official","path":"probe_experiment.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/probe_experiment.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":"3bf568dbe6a7fbb8"}},{"code_sha256_prefix":"c4e9a9eec8e92cc3","entry":"process_activation_batch","repo":"wesg52/world-models","repo_kind":"official","path":"save_activations.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/save_activations.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":"c4e9a9eec8e92cc3"}},{"code_sha256_prefix":"f13f4939cf537d87","entry":"remove_lower_specificity_duplicates","repo":"wesg52/world-models","repo_kind":"official","path":"feature_datasets/space_world.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/feature_datasets/space_world.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":"f13f4939cf537d87"}},{"code_sha256_prefix":"1be061eaded8779b","entry":"compute_prox_error","repo":"wesg52/world-models","repo_kind":"official","path":"generalization_experiment.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/generalization_experiment.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":"1be061eaded8779b"}},{"code_sha256_prefix":"7f131954ed6e43de","entry":"load_generalization_experiment","repo":"wesg52/world-models","repo_kind":"official","path":"generalization_experiment.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/generalization_experiment.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":"7f131954ed6e43de"}},{"code_sha256_prefix":"ec78e0b3d6261ed5","entry":"load_tokenizer","repo":"wesg52/world-models","repo_kind":"official","path":"make_prompt_datasets.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/make_prompt_datasets.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":"ec78e0b3d6261ed5"}},{"code_sha256_prefix":"4a1ed06862b5c9c0","entry":"make_correlation_df","repo":"wesg52/world-models","repo_kind":"official","path":"model_composition.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/model_composition.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":"4a1ed06862b5c9c0"}},{"code_sha256_prefix":"403d8927d15ed841","entry":"make_generalization_rdf","repo":"wesg52/world-models","repo_kind":"official","path":"analysis/generalization.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/analysis/generalization.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":"403d8927d15ed841"}},{"code_sha256_prefix":"c070305f38faca0e","entry":"make_natural_place_entity_df","repo":"wesg52/world-models","repo_kind":"official","path":"feature_datasets/space_world.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/feature_datasets/space_world.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":"c070305f38faca0e"}},{"code_sha256_prefix":"926cbc77347d1214","entry":"make_structure_entity_df","repo":"wesg52/world-models","repo_kind":"official","path":"feature_datasets/space_world.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/feature_datasets/space_world.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":"926cbc77347d1214"}},{"code_sha256_prefix":"5043e7864198f632","entry":"place_neuron_correlations","repo":"wesg52/world-models","repo_kind":"official","path":"model_composition.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/model_composition.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":"5043e7864198f632"}},{"code_sha256_prefix":"94dc1fb81c6a70d6","entry":"place_probe_experiment","repo":"wesg52/world-models","repo_kind":"official","path":"probe_experiment.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/probe_experiment.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":"94dc1fb81c6a70d6"}},{"code_sha256_prefix":"cd2f271c58a3f210","entry":"place_probe_generalization_experiment","repo":"wesg52/world-models","repo_kind":"official","path":"prompt_gen_experiment.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/prompt_gen_experiment.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":"cd2f271c58a3f210"}},{"code_sha256_prefix":"eeab6f68b890a0fb","entry":"run_experiment","repo":"wesg52/world-models","repo_kind":"official","path":"generalization_experiment.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/generalization_experiment.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":"eeab6f68b890a0fb"}},{"code_sha256_prefix":"af9c1c4eb6c780a6","entry":"time_probe_experiment","repo":"wesg52/world-models","repo_kind":"official","path":"probe_experiment.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/probe_experiment.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":"af9c1c4eb6c780a6"}},{"code_sha256_prefix":"88794b7e8476006e","entry":"time_probe_generalization_experiment","repo":"wesg52/world-models","repo_kind":"official","path":"prompt_gen_experiment.py","file_url":"https://github.com/wesg52/world-models/blob/HEAD/prompt_gen_experiment.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":"88794b7e8476006e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}