{"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/topicgpt-a-prompt-based-topic-modeling","title":"TopicGPT: A Prompt-based Topic Modeling Framework","arxiv_id":"2311.01449","date":"2023-11-02","proceeding":null,"authors":["Chau Minh Pham","Alexander Hoyle","Simeng Sun","Philip Resnik","Mohit Iyyer"],"abstract":"Topic modeling is a well-established technique for exploring text corpora. Conventional topic models (e.g., LDA) represent topics as bags of words that often require \"reading the tea leaves\" to interpret; additionally, they offer users minimal control over the formatting and specificity of resulting topics. To tackle these issues, we introduce TopicGPT, a prompt-based framework that uses large language models (LLMs) to uncover latent topics in a text collection. TopicGPT produces topics that align better with human categorizations compared to competing methods: it achieves a harmonic mean purity of 0.74 against human-annotated Wikipedia topics compared to 0.64 for the strongest baseline. Its topics are also interpretable, dispensing with ambiguous bags of words in favor of topics with natural language labels and associated free-form descriptions. Moreover, the framework is highly adaptable, allowing users to specify constraints and modify topics without the need for model retraining. By streamlining access to high-quality and interpretable topics, TopicGPT represents a compelling, human-centered approach to topic modeling.","url_abs":"https://arxiv.org/abs/2311.01449v2","url_pdf":"https://arxiv.org/pdf/2311.01449v2.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":"topicgpt-a-prompt-based-topic-modeling","repo_url":"https://github.com/chtmp223/topicgpt","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"specificity","task_name":"Specificity"},{"task_slug":"topic-models","task_name":"Topic Models"}],"methods":[{"method_slug":"align","method_name":"ALIGN"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2311.01449","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2311.01449"}},"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/chtmp223/topicgpt","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":6,"unverified":2},"by_repo_kind":{"official":{"samples":8,"ran":6,"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":"0d8395537f4bf2da","entry":"calculate_metrics","repo":"chtmp223/topicgpt","repo_kind":"official","path":"topicgpt_python/utils.py","file_url":"https://github.com/chtmp223/topicgpt/blob/HEAD/topicgpt_python/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":"0d8395537f4bf2da"}},{"code_sha256_prefix":"f481d4c84485e414","entry":"calculate_purity","repo":"chtmp223/topicgpt","repo_kind":"official","path":"topicgpt_python/utils.py","file_url":"https://github.com/chtmp223/topicgpt/blob/HEAD/topicgpt_python/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":"f481d4c84485e414"}},{"code_sha256_prefix":"763ee147a3b9a342","entry":"construct_document","repo":"chtmp223/topicgpt","repo_kind":"official","path":"topicgpt_python/generation_2.py","file_url":"https://github.com/chtmp223/topicgpt/blob/HEAD/topicgpt_python/generation_2.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":"763ee147a3b9a342"}},{"code_sha256_prefix":"fad0d8ab6a03e768","entry":"filter_topics_by_count","repo":"chtmp223/topicgpt","repo_kind":"official","path":"topicgpt_python/generation_2.py","file_url":"https://github.com/chtmp223/topicgpt/blob/HEAD/topicgpt_python/generation_2.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":"fad0d8ab6a03e768"}},{"code_sha256_prefix":"f86a64a16a9ec389","entry":"remove_topics","repo":"chtmp223/topicgpt","repo_kind":"official","path":"topicgpt_python/refinement.py","file_url":"https://github.com/chtmp223/topicgpt/blob/HEAD/topicgpt_python/refinement.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":"f86a64a16a9ec389"}},{"code_sha256_prefix":"d66fe8cc3264e216","entry":"topic_parser","repo":"chtmp223/topicgpt","repo_kind":"official","path":"topicgpt_python/correction.py","file_url":"https://github.com/chtmp223/topicgpt/blob/HEAD/topicgpt_python/correction.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":"d66fe8cc3264e216"}},{"code_sha256_prefix":"1b7b70ef4c91a44b","entry":"metric_calc","repo":"chtmp223/topicgpt","repo_kind":"official","path":"topicgpt_python/metrics.py","file_url":"https://github.com/chtmp223/topicgpt/blob/HEAD/topicgpt_python/metrics.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":"1b7b70ef4c91a44b"}},{"code_sha256_prefix":"3610ddd84bb37b93","entry":"parse_document_topics","repo":"chtmp223/topicgpt","repo_kind":"official","path":"topicgpt_python/generation_2.py","file_url":"https://github.com/chtmp223/topicgpt/blob/HEAD/topicgpt_python/generation_2.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":"3610ddd84bb37b93"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}