{"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/llms-generate-structurally-realistic-social","title":"LLMs generate structurally realistic social networks but overestimate political homophily","arxiv_id":"2408.16629","date":"2024-08-29","proceeding":null,"authors":["Serina Chang","Alicja Chaszczewicz","Emma Wang","Maya Josifovska","Emma Pierson","Jure Leskovec"],"abstract":"Generating social networks is essential for many applications, such as epidemic modeling and social simulations. The emergence of generative AI, especially large language models (LLMs), offers new possibilities for social network generation: LLMs can generate networks without additional training or need to define network parameters, and users can flexibly define individuals in the network using natural language. However, this potential raises two critical questions: 1) are the social networks generated by LLMs realistic, and 2) what are risks of bias, given the importance of demographics in forming social ties? To answer these questions, we develop three prompting methods for network generation and compare the generated networks to a suite of real social networks. We find that more realistic networks are generated with \"local\" methods, where the LLM constructs relations for one persona at a time, compared to \"global\" methods that construct the entire network at once. We also find that the generated networks match real networks on many characteristics, including density, clustering, connectivity, and degree distribution. However, we find that LLMs emphasize political homophily over all other types of homophily and significantly overestimate political homophily compared to real social networks.","url_abs":"https://arxiv.org/abs/2408.16629v2","url_pdf":"https://arxiv.org/pdf/2408.16629v2.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":"llms-generate-structurally-realistic-social","repo_url":"https://github.com/snap-stanford/llm-social-network","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2408.16629","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2408.16629"}},"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/snap-stanford/llm-social-network","reach":{"status":"ok"}}],"summary":{"ran":15,"unverified":2},"by_repo_kind":{"official":{"samples":17,"ran":15,"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":17,"samples":[{"code_sha256_prefix":"55fb422341b84630","entry":"basic_sanitize","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"bias.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/bias.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"55fb422341b84630"}},{"code_sha256_prefix":"612f39df05963bc5","entry":"bayes_compare_language","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"bias.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/bias.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":"612f39df05963bc5"}},{"code_sha256_prefix":"172438fdb9a4ea48","entry":"convert_persona_to_string","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"generate_personas.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/generate_personas.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":"172438fdb9a4ea48"}},{"code_sha256_prefix":"df859c62e17451b0","entry":"define_color","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"plotting.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/plotting.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":"df859c62e17451b0"}},{"code_sha256_prefix":"562161f6a0035779","entry":"extract_gpt_output","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"constants_and_utils.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/constants_and_utils.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":"562161f6a0035779"}},{"code_sha256_prefix":"13e836662e2f08c4","entry":"get_node_from_string","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"constants_and_utils.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/constants_and_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"13e836662e2f08c4"}},{"code_sha256_prefix":"d497157741bc59d7","entry":"get_persona_format","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"generate_networks.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/generate_networks.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":"d497157741bc59d7"}},{"code_sha256_prefix":"a6a19ebad08cbb4e","entry":"get_short_name","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"plotting.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/plotting.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":"a6a19ebad08cbb4e"}},{"code_sha256_prefix":"0d15a8a4a2812268","entry":"get_system_prompt","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"generate_networks.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/generate_networks.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":"0d15a8a4a2812268"}},{"code_sha256_prefix":"7fd03899cd7eed64","entry":"load_personas_as_dict","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"generate_personas.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/generate_personas.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":"7fd03899cd7eed64"}},{"code_sha256_prefix":"0626acbc6915d7ac","entry":"make_graph_from_net_file","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"network_datasets.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/network_datasets.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":"0626acbc6915d7ac"}},{"code_sha256_prefix":"6cfeb489d8339a70","entry":"make_graphs_from_dynetml_file","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"network_datasets.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/network_datasets.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":"6cfeb489d8339a70"}},{"code_sha256_prefix":"60adc15c14c0c266","entry":"make_graphs_from_paj_file","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"network_datasets.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/network_datasets.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":"60adc15c14c0c266"}},{"code_sha256_prefix":"de721215ae5496df","entry":"parse_save_name","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"plotting.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/plotting.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":"de721215ae5496df"}},{"code_sha256_prefix":"db6f594f7abd00c6","entry":"prop_nodes_in_giant_component","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"constants_and_utils.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/constants_and_utils.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":"db6f594f7abd00c6"}},{"code_sha256_prefix":"0d02210460fd59f5","entry":"get_user_prompt","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"generate_networks.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/generate_networks.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":"0d02210460fd59f5"}},{"code_sha256_prefix":"51f8be307f590f08","entry":"us_population","repo":"snap-stanford/llm-social-network","repo_kind":"official","path":"generate_personas.py","file_url":"https://github.com/snap-stanford/llm-social-network/blob/HEAD/generate_personas.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":"51f8be307f590f08"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}