{"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/the-geometry-of-categorical-and-hierarchical","title":"The Geometry of Categorical and Hierarchical Concepts in Large Language Models","arxiv_id":"2406.01506","date":"2024-06-03","proceeding":null,"authors":["Kiho Park","Yo Joong Choe","Yibo Jiang","Victor Veitch"],"abstract":"The linear representation hypothesis is the informal idea that semantic concepts are encoded as linear directions in the representation spaces of large language models (LLMs). Previous work has shown how to make this notion precise for representing binary concepts that have natural contrasts (e.g., {male, female}) as directions in representation space. However, many natural concepts do not have natural contrasts (e.g., whether the output is about an animal). In this work, we show how to extend the formalization of the linear representation hypothesis to represent features (e.g., is_animal) as vectors. This allows us to immediately formalize the representation of categorical concepts as polytopes in the representation space. Further, we use the formalization to prove a relationship between the hierarchical structure of concepts and the geometry of their representations. We validate these theoretical results on the Gemma and LLaMA-3 large language models, estimating representations for 900+ hierarchically related concepts using data from WordNet.","url_abs":"https://arxiv.org/abs/2406.01506v2","url_pdf":"https://arxiv.org/pdf/2406.01506v2.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":"the-geometry-of-categorical-and-hierarchical","repo_url":"https://github.com/kihopark/llm_categorical_hierarchical_representations","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"the-geometry-of-categorical-and-hierarchical","repo_url":"https://github.com/carmilea/carmilea","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"large-language-model","task_name":"Large Language Model"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2406.01506","atlas_url":"https://app.syntology.ai/?focus=2406.01506","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.01506"}},"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/carmilea/carmilea","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kihopark/llm_categorical_hierarchical_representations","reach":{"status":"ok"}}],"summary":{"ran":2,"unverified":4},"by_repo_kind":{"official":{"samples":6,"ran":2,"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":6,"samples":[{"code_sha256_prefix":"a5821ab4462e9c06","entry":"category_to_indices","repo":"kihopark/llm_categorical_hierarchical_representations","repo_kind":"official","path":"hierarchical/category.py","file_url":"https://github.com/kihopark/llm_categorical_hierarchical_representations/blob/HEAD/hierarchical/category.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a5821ab4462e9c06"}},{"code_sha256_prefix":"95565a0c35d70ea3","entry":"get_words_sim_to_vec","repo":"kihopark/llm_categorical_hierarchical_representations","repo_kind":"official","path":"hierarchical/category.py","file_url":"https://github.com/kihopark/llm_categorical_hierarchical_representations/blob/HEAD/hierarchical/category.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"95565a0c35d70ea3"}},{"code_sha256_prefix":"c0cefa4cb672ea6f","entry":"get_categories","repo":"kihopark/llm_categorical_hierarchical_representations","repo_kind":"official","path":"hierarchical/category.py","file_url":"https://github.com/kihopark/llm_categorical_hierarchical_representations/blob/HEAD/hierarchical/category.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c0cefa4cb672ea6f"}},{"code_sha256_prefix":"30d5d1f5b74cacb5","entry":"get_g","repo":"kihopark/llm_categorical_hierarchical_representations","repo_kind":"official","path":"hierarchical/from_models.py","file_url":"https://github.com/kihopark/llm_categorical_hierarchical_representations/blob/HEAD/hierarchical/from_models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"30d5d1f5b74cacb5"}},{"code_sha256_prefix":"afff6a16b3187362","entry":"get_gamma","repo":"kihopark/llm_categorical_hierarchical_representations","repo_kind":"official","path":"hierarchical/from_models.py","file_url":"https://github.com/kihopark/llm_categorical_hierarchical_representations/blob/HEAD/hierarchical/from_models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"afff6a16b3187362"}},{"code_sha256_prefix":"44eb460ae27cb634","entry":"get_vocab","repo":"kihopark/llm_categorical_hierarchical_representations","repo_kind":"official","path":"hierarchical/from_models.py","file_url":"https://github.com/kihopark/llm_categorical_hierarchical_representations/blob/HEAD/hierarchical/from_models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"44eb460ae27cb634"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}