{"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/topic-modeling-in-embedding-spaces","title":"Topic Modeling in Embedding Spaces","arxiv_id":"1907.04907","date":"2019-07-08","proceeding":"TACL 2020 1","authors":["Adji B. Dieng","Francisco J. R. Ruiz","David M. Blei"],"abstract":"Topic modeling analyzes documents to learn meaningful patterns of words. However, existing topic models fail to learn interpretable topics when working with large and heavy-tailed vocabularies. To this end, we develop the Embedded Topic Model (ETM), a generative model of documents that marries traditional topic models with word embeddings. In particular, it models each word with a categorical distribution whose natural parameter is the inner product between a word embedding and an embedding of its assigned topic. To fit the ETM, we develop an efficient amortized variational inference algorithm. The ETM discovers interpretable topics even with large vocabularies that include rare words and stop words. It outperforms existing document models, such as latent Dirichlet allocation (LDA), in terms of both topic quality and predictive performance.","url_abs":"https://arxiv.org/abs/1907.04907v1","url_pdf":"https://arxiv.org/pdf/1907.04907v1.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":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/adjidieng/ETM","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/adjidieng/DETM","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/bahareharandizade/keyetm","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/bnosac/ETM","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/cran/topicmodels.etm","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/fumiyo0607/ETM","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/hjzzang/ETM","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/lffloyd/embedded-topic-model","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/lfmatosm/embedded-topic-model","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/migrationsKB/MGKB","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/yukisea/ETM","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"topic-modeling-in-embedding-spaces","repo_url":"https://github.com/zll17/Neural_Topic_Models","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}}],"tasks":[{"task_slug":"topic-models","task_name":"Topic Models"},{"task_slug":"variational-inference","task_name":"Variational Inference"},{"task_slug":"word-embeddings","task_name":"Word Embeddings"}],"methods":[{"method_slug":"skip-gram-word2vec","method_name":"Skip-gram Word2Vec"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/topic-models-on-20newsgroups","task":"Topic Models","dataset":"20NewsGroups","model":"ETM","rank_in_archive_order":4,"of":6,"metrics":{"C_v":"0.51"},"uses_additional_data":false},{"leaderboard":"/sota/topic-models-on-ag-news","task":"Topic Models","dataset":"AG News","model":"ETM","rank_in_archive_order":4,"of":6,"metrics":{"C_v":"0.41","NPMI":"0.02"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1907.04907","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1907.04907"}},"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/adjidieng/ETM","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/cran/topicmodels.etm","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lffloyd/embedded-topic-model","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hjzzang/ETM","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/adjidieng/DETM","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/bnosac/ETM","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yukisea/ETM","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/migrationsKB/MGKB","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zll17/Neural_Topic_Models","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/fumiyo0607/ETM","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/bahareharandizade/keyetm","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lfmatosm/embedded-topic-model","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_violates":2,"ran_draft_wrong":1,"unverified":10},"by_repo_kind":{"official":{"samples":3,"ran":3,"repositories":1},"listed":{"samples":10,"ran":0,"repositories":2}},"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":"4a1ddf649b3c6fca","entry":"contains_numeric","repo":"adjidieng/ETM","repo_kind":"official","path":"scripts/data_20ng.py","file_url":"https://github.com/adjidieng/ETM/blob/HEAD/scripts/data_20ng.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4a1ddf649b3c6fca"}},{"code_sha256_prefix":"41dabfe9feb53af6","entry":"contains_punctuation","repo":"adjidieng/ETM","repo_kind":"official","path":"scripts/data_20ng.py","file_url":"https://github.com/adjidieng/ETM/blob/HEAD/scripts/data_20ng.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"41dabfe9feb53af6"}},{"code_sha256_prefix":"b3318b8a57645f16","entry":"remove_empty","repo":"adjidieng/ETM","repo_kind":"official","path":"scripts/data_20ng.py","file_url":"https://github.com/adjidieng/ETM/blob/HEAD/scripts/data_20ng.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b3318b8a57645f16"}},{"code_sha256_prefix":"f251c5fc43302f37","entry":"create_bow_dataset","repo":"lffloyd/embedded-topic-model","repo_kind":"listed","path":"embedded_topic_model/utils/preprocessing.py","file_url":"https://github.com/lffloyd/embedded-topic-model/blob/HEAD/embedded_topic_model/utils/preprocessing.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":"f251c5fc43302f37"}},{"code_sha256_prefix":"a692c1d9b72b7a4e","entry":"create_etm_datasets","repo":"lffloyd/embedded-topic-model","repo_kind":"listed","path":"embedded_topic_model/utils/preprocessing.py","file_url":"https://github.com/lffloyd/embedded-topic-model/blob/HEAD/embedded_topic_model/utils/preprocessing.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":"a692c1d9b72b7a4e"}},{"code_sha256_prefix":"979dc555a8df7690","entry":"get_batch","repo":"fumiyo0607/ETM","repo_kind":"listed","path":"data.py","file_url":"https://github.com/fumiyo0607/ETM/blob/HEAD/data.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":"979dc555a8df7690"}},{"code_sha256_prefix":"d0bc25d4fe5b2259","entry":"get_batch","repo":"lffloyd/embedded-topic-model","repo_kind":"listed","path":"embedded_topic_model/utils/data.py","file_url":"https://github.com/lffloyd/embedded-topic-model/blob/HEAD/embedded_topic_model/utils/data.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":"d0bc25d4fe5b2259"}},{"code_sha256_prefix":"cb6924aa7a38f376","entry":"get_data","repo":"fumiyo0607/ETM","repo_kind":"listed","path":"data.py","file_url":"https://github.com/fumiyo0607/ETM/blob/HEAD/data.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":"cb6924aa7a38f376"}},{"code_sha256_prefix":"bf0882a49ad15968","entry":"get_document_frequency","repo":"fumiyo0607/ETM","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/fumiyo0607/ETM/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":"bf0882a49ad15968"}},{"code_sha256_prefix":"5c806f2fc9361a06","entry":"get_document_frequency","repo":"lffloyd/embedded-topic-model","repo_kind":"listed","path":"embedded_topic_model/utils/metrics.py","file_url":"https://github.com/lffloyd/embedded-topic-model/blob/HEAD/embedded_topic_model/utils/metrics.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":"5c806f2fc9361a06"}},{"code_sha256_prefix":"285be6a543ea1959","entry":"get_topic_coherence","repo":"lffloyd/embedded-topic-model","repo_kind":"listed","path":"embedded_topic_model/utils/metrics.py","file_url":"https://github.com/lffloyd/embedded-topic-model/blob/HEAD/embedded_topic_model/utils/metrics.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":"285be6a543ea1959"}},{"code_sha256_prefix":"8158ac38282924d6","entry":"get_topic_diversity","repo":"lffloyd/embedded-topic-model","repo_kind":"listed","path":"embedded_topic_model/utils/metrics.py","file_url":"https://github.com/lffloyd/embedded-topic-model/blob/HEAD/embedded_topic_model/utils/metrics.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":"8158ac38282924d6"}},{"code_sha256_prefix":"012ab4b07ace5799","entry":"nearest_neighbors","repo":"fumiyo0607/ETM","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/fumiyo0607/ETM/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":"012ab4b07ace5799"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}