arXiv:2610.19323cs.CLOct 2026

Manuscript Offprint

arXiv:2610.19323

TopicMerge: A Divide and Conquer Approach to Topic Modeling

Matthew Raffel, Lizhong Chen, Sai Munikoti, Sameera Horawalavithana

Abstract

Recent advancements in topic modeling have split into two main paths: efficient embedding-based methods that offer scalability but are often outperformed on standard clustering metrics, and Large Language Model (LLM) approaches that achieve state-of-the-art clustering performance but at the cost of prohibitive computational expense and poor scalability. This paper introduces TopicMerge, a novel multistage pipeline that bridges these approaches to achieve both state-of-the-art clustering performance and computational efficiency. TopicMerge first employs an efficient clustering pipeline to deliberately over-segment a document corpus into a large set of fine-grained, semantically pure micro-clusters, which are then given initial semantic labels. It then introduces a novel, iterative merging algorithm where an LLM, guided by local neighborhood context, arbitrates on consolidating candidate pairs. These approved merges are then selectively executed and semantically relabeled by the LLM, hierarchically building broader, more coherent topics. Extensive experiments on the Bills and Wiki datasets show that TopicMerge achieves state-of-the-art clustering performance while reducing required LLM calls by over 92% compared to document-level methods, offering a practical and scalable solution.

1 Introduction

The ability to automatically discover thematic structures from large text corpora is a fundamental task in natural language processing (NLP). Topic modeling, the discipline dedicated to this task, has evolved significantly. Early methods such as Latent Dirichlet Allocation (LDA) (Blei et al., 2003) and Non-negative Matrix Factorization (NMF) (Lee and Seung, 1999; Févotte and Idier, 2011) established a strong foundation by treating documents as mixtures of topics. However, their reliance on a bag-of-words representation limited their ability to capture deeper semantic context. The advent of pre-trained language models (PLMs) led to a new paradigm of embedding-based topic models, such as BERTopic (Grootendorst, 2022), which cluster documents in a rich semantic space to produce more coherent topics. Most recently, the powerful reasoning capabilities of Large Language Models (LLMs) have been leveraged directly for topic discovery, with models like TopicGPT (Pham et al., 2024) and LiSA (Liu et al., 2025) setting a new state-of-the-art, achieving superior performance on standard clustering metrics.

Although LLM-based topic models offer a leap in clustering performance, they also introduce two fundamental challenges. First, they suffer from high computational costs and poor scalability. Each LLM inference consumes substantial resources, and this cost becomes prohibitive in models requiring per-document interactions, as the total expense scales with dataset size. Second, and more fundamentally, their processing is inherently local. Constrained by a fixed context window, an LLM evaluating a single document or a small batch lacks a global view of the corpus's thematic structure. It cannot natively perceive the relationships between all documents at once, a capability essential for comprehensive topic discovery. This creates a critical research gap: how to leverage the powerful local reasoning of LLMs without inheriting their prohibitive costs and their lack of a global perspective.

To bridge this gap, we introduce TopicMerge 1^{1}, a novel three-stage hybrid pipeline that combines the global structural awareness of clustering with the local semantic reasoning of an LLM. The process begins with an initial clustering stage, where an efficient clustering algorithm deliberately over-segments the corpus into fine-grained, pure micro-

1^{1}Our code is publicly available at https://github.com/pnnl/TopicMerge.

clusters, establishing a global structure. Following this, an initial labeling stage uses an LLM to assign a concise label and description to each microcluster. The core of our contribution is the third stage consisting of a hierarchical merging process where an LLM performs two key roles within a multi-phase algorithm. First, it acts as a context-aware semantic arbiter, evaluating individual candidate pairs to decide whether they should be consolidated. From this pool of approved candidates, the algorithm then prioritizes the most cohesive pairings for execution. It then acts as a summarizer, synthesizing the contents of the original clusters to generate a new, more abstract label for each emergent topic. This hierarchical approach, leveraging the LLM for both high-level arbitration and summarization, enables nuanced semantic decisions while efficiently operating at the cluster level.

To validate the effectiveness and efficiency of TopicMerge, we conduct extensive experiments on two widely-used benchmark datasets, Bills and Wiki (Hoyle et al., 2022). We benchmark our model against a comprehensive suite of baselines spanning traditional (LDA) (Blei et al., 2003), embedding-based (BERTopic) (Grootendorst, 2022), and state-of-the-art LLM-based (TopicGPT, LiSA) paradigms (Pham et al., 2024; Liu et al., 2025). Our evaluation focuses on two key dimensions: clustering quality, measured by standard metrics including P1 (Amigó et al., 2009), ARI (Vinh et al., 2009) and NMI (Strehl and Ghosh, 2002), and computational efficiency, measured by the total number of LLM prompts required. Furthermore, a detailed ablation study dissects our model's core components, empirically validating the strategic importance of contextual clusters and beginning merging with fine-grained, pure clusters.

Our main contributions are as follows:

  1. We propose TopicMerge, a novel three-stage pipeline that effectively integrates initial over-clustering with subsequent LLM-guided hierarchical consolidation.

  2. We introduce a context-aware LLM merging algorithm that operates efficiently at the cluster level, enabling nuanced semantic decisions without the cost of per-document analysis.

  3. We demonstrate through extensive experiments that TopicMerge achieves state-of-the-art clustering performance on widely-used benchmark datasets.

  4. We show that our method provides a practical path to leveraging LLMs by reducing the number of required prompts by over 92% compared to alternative document-level LLM-based approaches, drastically lowering overall computational cost and enabling high-quality topic modeling to scale.