Manuscript Offprint
arXiv:2610.38605Efficient Group-Penalty k-means for Text Clustering with Noisy LLM-Generated Constraints
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
k-means provides a simple and efficient foundation for text clustering, but embedding alone can miss task-specific semantic boundaries. Must-link (ML) and cannot-link (CL) constraints can correct such errors, yet conventional constrained clustering assumes that these relations are already supplied. LLMs can generate them without task-specific labels, but exhaustive querying is costly and their judgments can be incorrect. We present GPKMEANS, an efficient Group-Penalty k-means method for text clustering with noisy LLM-generated constraints. GPKMEANS uses LLM as an offline local pairwise annotator, querying selected anchor-candidate pairs for sparse ML links and constructing set-valued CL evidence without all-pairs queries. It converts connected components of the ML-link graph and the generated CL sets into groups with normalized, bounded soft penalties, limiting each group's influence independently of its size. Cached coordinate descent is proposed to efficiently solve the constraints clustering problem. We prove finite-step convergence and derive deterministic and probabilistic oracle-referenced bounds that relate objective distortion to the penalty coefficients and to the group-level error probabilities of the generated constraints. Across nine datasets, GPKMEANS uses fewer LLM calls and yields more accurate constraints. It achieves the best average ACC, NMI, and ARI with an approximate 30× speedup over state-of-the-art constrained clustering methods.
1 INTRODUCTION
Text clustering is an important primitive for organizing and analyzing textual records in data management, with applications including topic discovery, recommendation, anomaly detection, and community analysis [16, 39, 51]. In a typical pipeline, pretrained encoders first map texts into a continuous embedding space, after which k-means partitions the resulting representations in a simple and scalable manner [7, 36, 37, 50, 55]. However, geometric proximity in the embedding space does not always coincide with task-specific semantic similarity. Texts expressing distinct intents may exhibit nearly identical lexical patterns and highly similar embeddings, whereas texts expressing the same intent may differ substantially in surface form, and k-means lacks the external evidence needed to identify and correct such errors.
Pairwise side information provides a natural source of such evidence. A must-link (ML) indicates that two samples should be assigned to the same cluster, whereas a cannot-link (CL) indicates that they should be separated. Constrained-clustering methods incorporate these relations to guide the clustering process [10, 11, 13, 18, 53]. Traditionally, pairwise relations are elicited from human annotators and domain experts [9, 11, 54], while benchmark evaluations often

Figure 1: An example from BANKING77 with two refund-related intents. k-means can misplace a text across the two intents, and LLM-generated pairwise constraints can include both useful and incorrect must-link constraints.
construct them from ground-truth labels [10, 13, 53]. However, existing methods assume predefined constraints and do not address how to acquire them without labels or human supervision.
LLMs have shown promise in data cleaning and integration [42], motivating their use to acquire semantic relations from text without task-specific gold labels [1, 14, 21]. Consider a small example containing two refund-related intents in Figure 1. Although the texts share similar refund vocabulary, the intended user actions differ, so embedding-based k-means can cross the local semantic boundary and assign a delayed-refund query to the refund-request cluster. Local LLM constraints can help reveal this boundary by linking semantically matched examples. However, the same lexical overlap can also induce an incorrect cross-intent ML constraint, pulling the assignment in the wrong direction. Thus, even k-means with generated ML and CL constraints can produce undesirable results when those constraints are treated as hard rules.
LLMs provide semantic guidance for text clustering through label generation, representation refinement, and textual cluster descriptions or centroids [22, 48, 52, 61, 62]. However, directly assigning clusters with LLMs can produce inconsistent labels and semantic boundaries across batches and iterations [40]. When the corpus exceeds the context window, no single call can observe all samples, making it difficult to enforce cross-batch consistency and making repeated inference costly [24]. Using an LLM as a local pairwise annotator offers a more focused alternative, but it shifts rather than eliminates the difficulty. Exhaustive pair querying remains prohibitively expensive, so a limited query budget can be allocated to a part of the selected data; the resulting relations are globally sparse yet may be locally redundant or erroneous [2]. The resulting data management challenge is to improve semantic grouping under a limited query budget while controlling the influence of noisy relations and the computational cost of clustering. LSCK uses LLM-generated ML and CL constraints to correct local errors in embedding-based clustering [30], while other methods use cluster descriptions, few-shot guidance, label inference, or summary centroids to assist clustering [22, 48, 52, 61, 62]. However, strong
*Sheng Wang is the corresponding author.
enforcement of noisy LLM-generated constraints can distort clustering, while computationally expensive constrained optimization can limit scalability.
Various algorithms have been proposed for clustering with hard or soft ML and CL constraints [10, 12, 13, 19, 29, 53]. COPKMEANS can fail to produce a valid partition when no feasible assignment is found [19, 53]. PCCC accommodates uncertain relations through soft penalties, but solves mixed-integer assignment problems that can incur substantial computational cost [12]. These limitations motivate a method that tolerates noisy constraints while retaining efficient local updates.
To address this challenge, we propose GPKMEANS, an efficient Group-Penalty k-means method for organizing text collections using sparse, noisy LLM-generated constraints. GPKMEANS follows three stages. First, it selects anchors within preliminary k-means clusters by favoring large centroid margins and proximity to their assigned centroids, queries their neighbors for sparse ML constraints, and constructs set-valued CL constraints without querying all text pairs. Second, it converts connected components of the generated ML-link graph and the generated CL sets into typed constraint groups and incorporates them into the k-means objective through normalized soft penalties. Third, GPKMEANS efficiently solves the resulting constraints k-means problem using cached coordinate descent. Cached cluster and group statistics allow candidate reassignments to be evaluated from only the affected objective terms, avoiding repeated global constrained optimization. Together with bounded penalties, GPKMEANS exploits reliable constraints while limiting the influence of noisy groups.
Our contributions are as follows:
- We propose GPKMEANS, an efficient Group-Penalty k-means method that incorporates noisy LLM-generated ML and CL constraints into the assignment objective through normalized, bounded soft penalties rather than hard rules.
- We develop an anchor-based querying strategy that constructs connected-component ML groups and uses cached coordinate descent to efficiently solve the constraints clustering problem.
- We establish finite-step convergence and derive bounds that quantify how noisy constraints affect the objective as the ML and CL penalty coefficients vary.
- We demonstrate the effectiveness and efficiency of GP-KMEANS over nine datasets in our experimental evaluations. Our experimental findings indicate that GPKMEANS achieves the highest averaged ACC, NMI, and ARI, while running approximately 30x faster than the fastest constrained-clustering baseline considered.
2.1 Text clustering.
k-means is a standard clustering primitive because it is simple, scalable, and tied to a clear squared-error objective [7, 27, 28, 37, 38, 44, 55, 59, 60]. Modern text clustering commonly applies these objectives after mapping documents into embedding spaces such as Sentence-BERT [47], INSTRUCTOR-large [50], instruction-tuned
embeddings, or neural topic representations [3, 4, 26, 41, 57]. However, embedding distance is only a proxy for the desired task partition: nearby texts may share entities or domains while requiring different intent labels, and distant texts may express the same intent with different wording. GPKMEANS keeps this efficient embedding-plus-k-means backbone, but adds a local semantic correction channel rather than learning a new representation.
2.2 Constrained clustering.
Constrained clustering augments an unsupervised objective with must-link and cannot-link side information [18]. COPKMEANS treats these constraints as hard feasibility requirements [32, 53], while probabilistic formulations, metric-learning methods, and confidence-based constrained clustering relax supervision into soft terms, learned distances, spectral objectives, or weighted ML and CL constraints [8–11, 13, 17, 31, 33, 49, 58]. PCCC employs integer programming to solve constrained clustering problems [12]. Hard constraints can become infeasible or brittle: one incorrect ML constraint can permanently bind points that should remain separable, and one incorrect CL constraint can force an unnecessary split [19]. Flexible constrained spectral clustering and related soft formulations treat constraints as preferences rather than absolute rules [56], which is closer to our setting. However, existing methods require computationally intensive machinery, such as integer programming, branch-and-bound, or semidefinite optimization, resulting in high computational complexity.
2.3 LLM-based clustering.
LLMs have been used as flexible semantic annotators [14, 25, 42], connecting LLM-guided clustering to weak supervision and learning with noisy labels [6, 43, 46]. Recent LLM-based clustering work asks LLMs to guide text clustering through pairwise preferences, few-shot cluster descriptions, boundary refinement, LLM-derived positive pairs, or summary centroids [22, 48, 52, 61, 62]. The closest line to our setting is LLM-generated constrained clustering, including LSCK, which uses LLM-produced ML and CL constraints as hard or high-strength guidance [30]. However, it depends on combinatorial optimization techniques, which limits its scalability to large problem instances.
Remarks. GPKMEANS uses the LLM in a narrower and more reproducible role: LLM calls are made offline to generate ML and CL constraints, and replayed as inputs to a k-means. The key distinction is that GPKMEANS treats these constraints as bounded ML-group and pairwise CL regularizers and optimizes them with cached exact local-delta updates, rather than using hard rules or direct LLM-generated labels.
3 PRELIMINARIES
This section introduces the assignment-matrix formulation of k-means used throughout the paper and its equivalent centroid-free objective. We then define pairwise ML and CL constraints and clarify how LLM-generated constraints enter the clustering problem as fixed inputs. Table 1 summarizes the main notation.
Table 1: Summary of notations.
| Notation | Description |
|---|---|
| The embedding matrix | |
| The indicator matrix | |
| The nonempty one-hot assignment space | |
| The induced cluster labels | |
| The k-means SSE | |
| The collection of ML constraint groups | |
| The collection of CL constraint groups | |
| A constraint group | |
| Normalized ML/CL-group penalties | |
| Global ML and CL penalty coefficients |
3.1 Problem Formulation of k-means
Consider a text collection and precomputed embeddings , where and . Let denote the embedding matrix, and assume that the number of clusters is given. We represent a clustering by a one-hot indicator matrix , where each row has exactly one nonzero entry and each column is nonempty. Let denote the set of such nonempty one-hot assignment matrices. The induced label is , and we use only as shorthand for the partition encoded by .
Let collect the centroids. The standard k-means SSE is
For a fixed assignment , the centroid variables have a closed-form minimizer. Since selects the samples assigned to cluster , is the cluster size and is the corresponding vector sum. Therefore the optimal centroid is the sample mean
Since each row of contains only one nonzero entry, is diagonal, and its -th diagonal entry is . Substituting the optimal centroids back into Eq. (1) removes the centroid variables and leaves an objective depending only on [45]. Therefore, Eq. (1) can be equivalently rewritten as
The constant does not depend on the clustering, so minimizing is equivalent to maximizing the centroid-free score
Therefore, solving Eq. (1) is equivalent to maximizing Eq. (4) over , whose only optimization variable is the assignment matrix .
3.2 ML and CL Constraints
In constrained clustering, side information is commonly expressed through must-link and cannot-link relations [10, 11, 13, 32, 53]. A must-link (ML) constraint on a pair indicates that the two samples should be co-clustered, while a cannot-link (CL) constraint indicates that they should be assigned to different clusters. The raw side information may be provided as individual pairs or as sets that jointly encode multiple pairwise relations. In either form, the constrained relations are sparse and need not cover all possible pairs.
In traditional constrained clustering, ML and CL constraints are usually treated as externally provided information [10, 13, 53]. Such constraints may come from human annotations, expert rules, or existing domain knowledge, and are therefore often assumed to be relatively reliable. In text clustering, however, manually annotating ML/CL constraints is expensive and difficult to scale. This makes LLMs an attractive option for generating ML and CL information from selected texts [30]. The LLM is only responsible for constraint generation; the constrained clustering problem below treats the resulting ML and CL constraints as fixed inputs. The next section describes how GPKMEANS organizes these inputs into group-level soft regularizers and incorporate them into the k-means assignment objective.
4 ALGORITHM DESIGN
4.1 Overview
Given text samples , precomputed embeddings , and a target cluster count , GPKMEANS efficiently returns a nonempty k-way assignment matrix , equivalently labels . The method is designed for the setting where LLM-generated constraints are useful but sparse, local, and potentially noisy. Accordingly, ML and CL constraints enter as soft terms in a regularized k-means objective rather than as hard feasibility rules.
As shown in Figure 2, GPKMEANS proceeds in three stages. First, offline constraint construction obtains sparse ML links and set-valued CL constraints without exhaustively querying all text pairs. Second, the ML links and CL sets are represented as constraint groups with type-specific normalized penalties, so each group's contribution is bounded by the applicable global penalty coefficient. Third, GPKMEANS solves the assignment matrix efficiently with cached coordinate descent, maintaining cluster statistics and group occupancy counts to evaluate each candidate move by an exact local delta without recomputing the full objective or expanding ML groups into implied pairs. For the main experiments, LLM calls are offline and the generated constraints are replayed.
4.2 Constraint Generation
The anchor-based ML querying procedure selects real data points as anchors and retrieves up to nearby candidates per anchor. We first run preliminary k-means on -normalized embeddings and rank points within each cluster by , where is the gap between the point's squared distances to its two nearest centroids and is the squared distance to the assigned centroid. We retain up to highest-scoring points per cluster, yielding anchors and favoring well-separated representatives near

Figure 2: Overview of GPKMEANS.
cluster centers. This distributes anchors across preliminary clusters without using gold labels or LLM calls. For each selected anchor, we query a small set of nearby candidates, excluding the anchor itself, and ask only about anchor-candidate pairs. This creates a star-shaped local query pattern centered at the anchor, avoiding all-pairs queries among the candidates and reducing the number of LLM pair queries from to . Using real text samples as anchors ensures the LLM receives grounded, self-contained prompts rather than abstract vector representations.
For each queried pair , the LLM identifies whether the candidate clearly matches the anchor; accepted pairs become ML links, while uncertain or nonmatching candidates are not converted into CL constraints. The anchor-based query pattern deliberately targets local ambiguity, because querying nearby candidates concentrates LLM effort on pairwise constraints that can change an assignment. The generated constraints are stored as files; the main experiments replay these files without new LLM calls. Algorithm 1 gives the full procedure.
For CL constraints, we adopt the set-valued construction of Jia et al. [30]. Starting from an uncovered sample, the procedure grows a separation set by uniformly sampling uncovered candidates whose distance from exceeds the threshold , where is the cost returned by the min-max -center procedure. The LLM adds a candidate only when it finds no semantic match among the current members; construction stops when or no eligible candidate remains, and then restarts to form another set. This produces a family of CL sets whose members are intended to occupy different clusters. We reuse these generated sets as fixed side information, but not the matching-based CL solver of Jia et al.; instead, each set is converted into the normalized group penalty defined below and optimized jointly with the SSE and ML terms.
4.3 Group Construction and Normalized Penalties
The two constraint sources are mapped into a common group representation: connected components of the generated ML-link graph form the must-link collection , while each generated CL set directly forms one group in the cannot-link collection , where . Members of an ML group are encouraged to be co-clustered, while members of a CL group are discouraged from colliding in the same cluster. This group view defines the objects
Algorithm 1: Anchor-Based ML-Link Generation
Input: Text samples , embeddings , target clusters , per-cluster anchor quota , candidate count , LLM model.
Output: ML groups .
1 Run preliminary -means on -normalized embeddings;
2 ;
3 Anchor selection: Rank points within each cluster by (Section 4.2);
4 Select up to highest-scoring points per cluster to form ; set ;
5 for each anchor do
6
7
8
9 Build and compute DSU components;
10 ;
11 return ;
used by the soft penalties below, without permanently merging samples or imposing graph-coloring constraints.
For component construction, each generated pairwise ML constraint is treated as an undirected link in a graph over samples. GPKMEANS converts this graph into connected components via a disjoint-set union (DSU) procedure, and each component with at least two samples becomes an ML group . A component with samples is represented as a single group rather than expanded into implied pairwise penalties. For a group with and cluster occupancy counts , we define
The numerator counts members outside the majority cluster; dividing by normalizes the penalty to . A perfectly co-clustered group incurs zero cost; the penalty is bounded by one and reaches one when every member occupies a distinct cluster, which is possible only when . Thus, componentization is not hard merging: samples remain individually movable, and an incorrectly included sample contributes a bounded penalty instead of forcing the entire component to be merged.
Each separation set becomes a CL group . Unlike independent pairwise penalties, one normalized group term represents the mutually different relations induced by the set. For a general CL group, we penalize the fraction of within-cluster pairs:
This is the fraction of pairs in that collide in the same cluster, normalized to . When , Eq. (6) reduces to the standard pairwise cannot-link penalty . Together with Eq. (5), this shows that the normalized group penalties recover classical pairwise ML and CL penalties as a special case.
If a group were expanded into all implied pairwise penalties without normalization, a group of size would produce terms and allow large groups to dominate the objective. With normalization, , so the maximum objective shift from any incorrect group is bounded by the corresponding penalty coefficient regardless of its size (Lemma 5.1). The coefficients and control the strength of the soft constraints.
The optimization variable is the one-hot assignment matrix introduced in Section 3; for readability, the optimizer is written in terms of the induced label vector . We write for the same centroid-free SSE in Eq. (3) evaluated at the assignment matrix induced by . The complete GPKMEANS objective is
The global coefficients and control how strongly the optimizer trades cluster compactness for semantic consistency. In experiments, we use fixed default coefficients and report separate sensitivity studies for these choices.
4.4 Solving the Assignment Matrix
Given the constructed groups and the objective in Eq. (7), the final stage solves for the assignment matrix . Equivalently, we optimize its induced label vector z, where each coordinate update moves one sample from its current cluster to a candidate cluster. GPKMEANS uses a cached coordinate-descent solver for this discrete assignment problem. Because the constraints are soft penalties, the solver only needs to test whether a candidate move decreases the regularized objective; it does not need to repair constraint violations or solve a separate global constrained subproblem. Algorithm 2 summarizes the procedure.
This locality comes from two parts of the objective. After centroids are eliminated, the k-means SSE term changes under a single-sample move only through the source and target cluster statistics. The group penalty term changes only through the constraint groups that contain the moved sample. Therefore, each candidate reassignment can be evaluated by an exact local delta rather than by recomputing the full objective. The solver uses two caches to realize this update efficiently: cluster sufficient statistics for the SSE
Algorithm 2: GPKMEANS Assignment Solver
Input: Embeddings , target clusters , groups , coefficients .
Output: Assignment .
1 Initialization: Initialize using a k-means++ seeded k-means run;
2 Compute cluster statistics for all by Eq. (8);
3 Build the group-count cache for all and ;
4 Coordinate descent: while not converged do
5 for do
6
7
8 Local move evaluation: for do
9 Compute by Eq. (9);
10 Compute by adding the incident-group ML/CL penalty deltas in Eq. (11);
11 if then
12
13 Strict descent update: if then
14
15 For all , decrement and increment ;
20 return z;
term and group occupancy counts for the ML and CL penalties. The cache affects only the cost of evaluating a move; accepted moves still strictly decrease the same objective in Eq. (7).
We first make the k-means part local. For fixed z, the optimal centroid of each cluster is its sample mean. We maintain two sufficient statistics per cluster,
where is the cluster size and is its vector sum. With these cached statistics, the centroid-free SSE in Eq. (3) can be evaluated as . Evaluating a candidate move therefore requires only the two affected clusters and does not require recomputing all centroids or the full SSE.
For a nontrivial move of sample from its current cluster to a target cluster , only the source and target statistics change: and for the source cluster, whereas and for the target cluster; all other cluster statistics remain unchanged. The choice preserves the current assignment and therefore has a zero objective delta, even though the cached statistics may already reflect earlier coordinate updates. We include this choice implicitly as the zero-delta baseline and apply the move formulas only to . Candidate moves that would empty the source cluster are skipped, so all moves remain in the legal nonempty-cluster assignment space. Using this cached form of Eq. (3), the resulting SSE delta is
We next make the constraint part local. For each constraint group , we maintain the occupancy vector , where records how many members of currently fall in cluster . A candidate move affects only groups , and for each such group it changes only two entries, namely and . Thus the penalty change can be computed from cached counts rather than by rescanning all group members or expanding a group into pairwise constraints. The penalty deltas follow from these changed entries: For an ML group, the move changes the penalty by
where “old” and “new” refer to before and after the hypothetical move.
For a CL group, moving i from r to q removes collisions in cluster r and adds collisions in cluster q, giving
Eq. (10) can be vectorized over all k target clusters simultaneously, evaluating the full move vector for one group in time without iterating over group members.
The total move cost combines Eq. (9) and the penalty deltas:
Defining , we select . In implementation, this comparison is performed by initializing with a zero delta and evaluating Eq. (11) only for . Because is exact, every accepted move strictly decreases the same objective in Eq. (7). Following standard incremental coordinate updates [45], once a move is accepted, the cached statistics are updated by
For sample , these updates take work, where is the number of groups containing ; averaged over samples, this is . Theorem 5.3 establishes the convergence of the proposed method in finite steps.
4.5 Complexity Analysis
We analyze the optimization cost after LLM constraints have been generated and stored. Let be the number of samples, be the embedding dimension, and be the number of clusters. Let be the set of all constraint groups, be the total group-membership size, and be the average number of incident groups per sample.
Initialization consists of cluster sufficient statistics and the group-count cache. Building the group-count cache costs . During one sweep, all SSE move deltas cost because each candidate move only touches the source and target cluster statistics. The constraint term visits only groups incident to the moved sample; with dense k-dimensional group counts, this costs per sweep. Thus one sweep costs , and T sweeps cost . Constraint processing contributes only the additive term, while the SSE computation remains dominant under sparse group incidence. The optimization cost therefore depends on the average number of incident constraint groups per sample, not on all possible text pairs or all implied pairwise relations inside an ML component.
The state-of-the-art constrained-clustering method PCCC [12] handles constrained assignments through mixed-integer linear programming, whose global solve becomes computationally expensive as the problem and constraint sets grow. GPKMEANS avoids global integer optimization by evaluating reassignments from cached cluster statistics and incident group counts, yielding a time complexity of . This linear dependence on n avoids the combinatorial growth of global constrained solvers and enables efficient constrained clustering.
5 CONVERGENCE AND PERTURBATION ANALYSIS
This section analyzes finite convergence of the cached coordinate descent optimizer and derives objective-level perturbation bounds for noisy LLM-generated constraints.
GPKMEANS optimizes the assignment matrix , but the analysis uses the equivalent label vector induced by . Let be the total number of typed constraint groups, and enumerate them as , where is the type of group . Write for the penalty of the -th constraint group. Let if and if . The aggregate penalty is . For the noise analysis, denotes a bounded oracle-reference penalty on the same index set , and denotes the LLM-generated, possibly noisy, penalty. Their aggregate counterparts are and .
5.1 Boundedness and Special Cases
The critical property enabling bounded regularization is that both penalty functions lie in [0, 1]. This limits the maximum objective shift caused by an incorrect LLM group, independent of the group size.
LEMMA 5.1 (BOUNDED INFLUENCE). For any constraint group with and any assignment ,
Consequently, the maximum objective shift caused by a single wrong group is
PROOF. For an ML group, let denote its occupancy count in cluster . The majority cluster count satisfies , so . Dividing by gives .
For a CL group, the numerator counts the number of within-cluster pairs among group members. This count is at least 0 (when all members are in distinct clusters) and at most (when all members are in the same cluster). Dividing by gives .
Since and are both in , their difference satisfies , and multiplying by yields (14).
Equation (14) is the formal counterpart of the key design claim: an incorrect LLM group changes the objective by at most its corresponding ML or CL penalty coefficient, not by an amount that grows with the number of implied pairs. By contrast, a hard ML merge or a pairwise penalty summed over all pairs has no such finite ceiling.
LEMMA 5.2 (PAIRWISE REDUCTION). When , the group penalties in Eqs. (5) and (6) reduce to standard pairwise indicators:
PROOF. Write for . For an ML pair, if then and the numerator ; if then and the numerator equals . For a CL pair, and iff , and it is 0 otherwise.
The group formulation therefore generalizes both ML and CL constraints while recovering their classical pairwise penalties as the special case m = 2. The reported experiments use group-valued constraints rather than expanded pairwise penalty terms.
5.2 Finite Convergence of GPKMEANS
We now show that the coordinate-descent optimizer in Algorithm 2 terminates in finite steps. This relies on the fact that the group-count cache computes the exact change in the reduced objective, not an approximation. Here J denotes the fixed generated-constraint objective in Eq. (7).
Let the legal assignment space be , where is the size of cluster . Expanding the centroid-free SSE term in Eq. (7) gives the equivalent form
where is a constant and is the cluster vector sum for .
Moving sample from its current cluster to a candidate cluster changes by
The SSE component depends only on the two affected cluster statistics via Eq. (9). The penalty component depends only on the constraint groups that contain ; all other groups are unaffected. This locality is what makes the group-count cache exact: for each group , the cached occupancy vector changes only in positions and , and the new penalty values can be evaluated directly from the updated counts without rescanning the group.
THEOREM 5.3 (FINITE CONVERGENCE). Suppose a move is accepted only when . Then: the sequence of objective values after each accepted move is strictly decreasing; the total number of accepted moves is finite; and the algorithm terminates after finitely many sweeps.
PROOF. When a move is accepted, the acceptance criterion gives
so the objective decreases strictly. When no move is accepted in a sweep, the assignment is unchanged and the objective does not change; the algorithm stops.
The set is finite (it has at most elements). Since is a deterministic real-valued function on the finite set , it takes only finitely many distinct values. A strictly decreasing sequence of objective values cannot repeat any value. Therefore, the number of accepted moves is bounded by , and the algorithm halts.
COROLLARY 5.4 (COORDINATE-WISE STATIONARITY). For every sample whose current cluster has , and every target , the terminal assignment satisfies
where is the assignment with sample i reassigned to cluster q. That is, no legal single-sample move that preserves nonempty clusters can decrease J.
Theorem 5.3 establishes optimization stability: the soft group penalties do not introduce cycling or an undefined descent direction. Importantly, it makes no claim about global optimality. Since the underlying problem is a discrete, non-convex combinatorial program, the terminal point is a local minimum in the coordinate sense but may be far from a global optimum.
5.3 LLM Constraint Noise Model
Having established bounded penalties and finite descent, we now model the error source that is specific to LLM-constrained clustering: the LLM output may disagree with what the true labels would prescribe.
Let denote the penalty function of the t-th final group constructed from the generated constraints, and let denote a fixed oracle-reference penalty on the same group index set. Both functions take values in [0,1]. We define the group-level error indicator and its probability as
An ML or CL group is clean when all of its induced pairwise relations agree with the label-induced oracle constraints; otherwise, it is treated as a noisy group. Groups present in only one collection can be represented by the zero function in the other collection, yielding a common index set for comparison. The bounds below require only these bounded group-level error indicators and do not assume independence unless explicitly stated for the high-probability result.
5.4 Bounded Penalty Perturbation
We now quantify how noisy constraints perturb the aggregate penalty. Define the penalty perturbation at assignment z as
The term captures how much the LLM-generated penalty deviates from the oracle penalty at a given assignment. Because the optimization uses while the oracle reference is , bounding bounds how much the LLM-generated constraints can distort the objective.
THEOREM 5.5 (BOUNDED PENALTY PERTURBATION). (i) Deterministic bound. For a fixed set of LLM errors, only the noisy constraints can change the oracle penalty. Each normalized group penalty can differ from its oracle counterpart by at most one. Thus the worst-case perturbation over all assignments is bounded by the total penalty coefficient of the erroneous constraints:
(ii) Expected bound. Taking expectation replaces each binary error indicator by its error probability. If , the expected perturbation is controlled by the coefficient-weighted sum of group-level error probabilities:
(iii) High-probability bound. For any , define
Under conditional independence of given the data, Hoeffding's inequality implies that, with probability at least ,
PROOF. (i) Consider a fixed assignment and a fixed realization of the error indicators . For each group index , if , then and the -th term in (18) is exactly 0. If , Lemma 5.1 gives . Summing over all and noting that the upper bound does not depend on yields
which is equivalent to (19).
(ii) Apply the tower property: .
(iii) By part (i), . Each is a bounded random variable in with mean . Under conditional independence, applying the Hoeffding inequality to gives
Setting the right-hand side equal to and solving for yields , from which with probability at least .
The bound consists of the expected coefficient-weighted error envelope and a Hoeffding deviation term controlling fluctuations above this mean. The latter scales with , so the bound grows with the penalty magnitudes and the required confidence level.
5.5 Oracle Objective Regret
To distinguish the generated constraints from their oracle reference in the noise analysis, define the oracle objective and write the generated-constraint objective as . Their relationship is
so a bound on translates directly into a bound on how much deviates from . Since coordinate descent guarantees only coordinate-wise stationarity, we present the following comparison with respect to an arbitrary candidate set and an explicit optimization error term .
THEOREM 5.6 (ORACLE OBJECTIVE REGRET). Let minimize over a candidate set . Suppose the output satisfies . If for all , then
PROOF. Using (23) and :
Subtracting from both sides gives (24).
Applying Theorem 5.5(iii), with probability at least ,
This decomposes the total oracle regret into two interpretable terms. The first, , is the optimization error: the gap between the coordinate-wise stationary point found by GPKMEANS and the best assignment in under the noisy objective. The second, , captures noise amplification. Because is monotone and positively homogeneous in the nonnegative penalty coefficients, stronger penalties enlarge the certified objective distortion caused by noisy groups. This bound isolates the noise cost of increasing the penalties; the corresponding benefit from clean constraints is data-dependent and is examined empirically in Section 6.2.
Remarks. Once the LLM-generated ML and CL constraints are organized into groups, GPKMEANS solves the constraints clustering problem using cached coordinate descent and Eq. (11). Overall, the analysis establishes finite-step convergence of this optimizer and quantifies how bounded group penalties control the objective distortion caused by erroneous LLM constraints.
Table 2: An overview of the datasets.
| Dataset | Samples | k | Dim. |
|---|---|---|---|
| BANKING77 [15] | 3080 | 77 | 768 |
| CLINC(I) [34] | 4500 | 150 | 768 |
| MASSIVE(I) [23] | 2974 | 59 | 768 |
| MTOP(I) [35] | 4386 | 102 | 768 |
| CLINC(D) [34] | 4500 | 10 | 768 |
| MASSIVE(D) [23] | 2974 | 18 | 768 |
| MTOP(D) [35] | 4386 | 11 | 768 |
| GoEMO [20] | 5940 | 27 | 768 |
| REDDIT [41] | 3217 | 50 | 768 |
6 EXPERIMENTS
The experiments are organized around four questions:
- Does GPKMEANS improve clustering quality over LLM-based clustering methods and constrained-clustering baselines?
- Are the generated constraints sufficiently reliable, and does a higher-quality constraint source improve downstream clustering when the optimizer is held fixed?
- Does GPKMEANS exhibit the intended behavior under noisy constraints, such that satisfying more generated constraints does not necessarily yield better clustering?
- How many LLM calls does the proposed pipeline require, and how much time does it take?
We answer these questions by evaluating clustering quality, analyzing constraint reliability and penalty robustness, and measuring LLM-call counts and running time. Our code is publicly available.¹
6.1 Experimental Setup
6.1.1 Datasets. We evaluate on nine datasets spanning intent discovery, domain classification, emotion recognition, and social-media topic clustering (Table 2). The evaluation includes BANKING77 [15], CLINC150 [34], MASSIVE [23], MTOP [35], GoEMOTIONS [20], and REDDIT clustering data from the MTEB benchmark [41]. These datasets cover both fine-grained intent spaces and coarser domain or topic spaces, allowing us to assess local semantic constraints across different clustering granularities. All methods use the same embedding file for each dataset, produced by INSTRUCTOR-large [50].
6.1.2 Compared methods. We organize the compared methods by the role of the LLM and the source of the constraints. LLOYD applies standard Lloyd iterations to the same input embeddings. SUMMARYCENTROIDS [48] periodically summarizes each current cluster with an LLM and re-embeds the resulting text as a centroid, whereas PPLL [61] uses LLM-generated mini-cluster labels to construct positive pairs, trains an embedder with BYOL, and then performs label-guided k-means. They represent alternative ways of injecting LLM knowledge into clustering. LSCK and LSCK-HC [30] generate set-valued ML and CL constraints with their own LLM pipeline and optimize them using penalty-based local search. LSCK-HC makes additional LLM calls to divide ML sets into hard and soft constraints: hard sets guide initialization and soft sets are handled through penalties. These methods therefore compare complete LLM-constraint-generation and clustering pipelines. We convert the ML and CL constraints generated by GPKMEANS
into the corresponding input formats required by PCCC [12] and COPKMEANS [53], replacing only the solver. PCCC uses an integer-programming-based constrained assignment procedure, whereas COPKMEANS treats the supplied relations as hard feasibility constraints. GPKMEANS-LSCKConstraints applies the GPKMEANS optimizer to the constraints generated by LSCK, thereby isolating the effect of the constraint source while holding the optimizer fixed. ORACLECLEAN applies the same GPKMEANS optimizer after using true labels to remove generated ML and CL relations that disagree with the label-induced oracle relation.
6.1.3 Parameter settings. Unless otherwise stated, GPKMEANS uses full constraint coverage, group penalties, at most 80 optimization iterations, and penalty coefficients and . These coefficients are fixed across datasets unless explicitly varied in the sensitivity study. For sensitivity and controlled studies, we vary only the tested parameter and keep all other settings fixed. Baseline methods use their corresponding constraints and the same embedding inputs as GPKMEANS.
6.1.4 Evaluation metrics. We report clustering accuracy (ACC), normalized mutual information (NMI), adjusted Rand index (ARI), constraint violation rates, LLM calls, and runtime. ACC is computed after Hungarian matching between predicted clusters and true labels. NMI and ARI evaluate label agreement without requiring a one-to-one cluster assignment. ACC, NMI, and ARI are reported as percentages. Constraint violation rates measure how often the final clustering disagrees with the generated ML or CL constraints. Runtime measures only downstream clustering time; offline LLM generation is reported separately through call counts.
6.1.5 Implementation. All methods use the same dataset and embedding files. Methods that accept externally supplied constraints use the constraint inputs specified above. We use five matched random seeds per dataset whenever a method is stochastic and report the mean and standard deviation; denotes cases with fewer completed runs. For methods with stored LLM outputs, including SUMMARYCENTROIDS and PPLL, we replay those outputs under the same dataset and embedding protocol. Runtime-heavy analyses and ablations use matched repeated runs per dataset. Each solver run has a one-hour timeout. All LLM constraints are generated offline with deepseek-v4-f-lash before clustering. We follow Section 4.2 to generate ML constraints. For CL constraints, we use the separation sets generated by the procedure of LSCK [30]. The archived ML sources use per-cluster anchor quotas of one, three, or five and evaluate up to 12 candidates per anchor. This fixed constraint set separates downstream optimizer behavior from the cost and variance of new LLM calls. All experiments were conducted on a CentOS Linux 7 server (kernel 3.10.0) equipped with two Intel Xeon Platinum 8352V processors and 512 GB of DDR4 ECC memory.
6.2 Experimental Results
6.2.1 Clustering Quality. Tables 3 to 5 report the main comparison on nine datasets. The tables report the mean and standard deviation over five runs, except for the incomplete COPKMEANS cases marked by . Following the final baseline setting, LSCK and LSCK-HC use penalty coefficient 0.001. SUMMARYCENTROIDS and PPLL use stored outputs from their own LLM-based pipelines for the main
¹https://github.com/NieFeiteng/GPKmeans.git
Table 3: ACC results (%). Dataset columns report mean ± standard deviation over five runs, and Avg is the unweighted mean across datasets. Bold and underline denote the best and second-best scores; † marks incomplete COPKMEANS runs.
| Method | BANKING77 | CLINC(I) | MASSIVE(I) | MTOP(I) | CLINC(D) | MASSIVE(D) | MTOP(D) | GoEMO | Avg | |
|---|---|---|---|---|---|---|---|---|---|---|
| LLOYD | 53.08 | |||||||||
| LSCK | 57.18 | |||||||||
| LSCK-HC | 53.33 | |||||||||
| SUMMARYCENTROIDS | 56.34 | |||||||||
| PPLL | 56.81 | |||||||||
| PCCC | 53.03 | |||||||||
| COPKMEANS | ||||||||||
| GPKMEANS | 58.75 |
Table 4: NMI results (%) under the same protocol as Table 3.
| Method | BANKING77 | CLINC(I) | MASSIVE(I) | MTOP(I) | CLINC(D) | MASSIVE(D) | MTOP(D) | GoEMO | Avg | |
|---|---|---|---|---|---|---|---|---|---|---|
| LLOYD | 63.72 | |||||||||
| LSCK | 64.99 | |||||||||
| LSCK-HC | 63.79 | |||||||||
| SUMMARYCENTROIDS | 64.88 | |||||||||
| PPLL | 65.37 | |||||||||
| PCCC | 63.42 | |||||||||
| COPKMEANS | ||||||||||
| GPKMEANS | 65.96 |
Table 5: ARI results (%) under the same protocol as Table 3.
| Method | BANKING77 | CLINC(I) | MASSIVE(I) | MTOP(I) | CLINC(D) | MASSIVE(D) | MTOP(D) | GoEMO | Avg | |
|---|---|---|---|---|---|---|---|---|---|---|
| LLOYD | 41.96 | |||||||||
| LSCK | 45.86 | |||||||||
| LSCK-HC | 42.24 | |||||||||
| SUMMARYCENTROIDS | 45.01 | |||||||||
| PPLL | 44.85 | |||||||||
| PCCC | 41.73 | |||||||||
| COPKMEANS | ||||||||||
| GPKMEANS | 46.39 |

Figure 3: Normalized SSE over 40 iterations on the nine evaluation datasets.
Table 6: Pair-weighted constraint accuracy (%).
| Source | ML Acc. (%) | CL Acc. (%) | Overall (%) | ML Pairs | CL Pairs |
|---|---|---|---|---|---|
| ORACLECLEAN | 100.00 | 100.00 | 100.00 | 8,360 | 34,459 |
| LSCK | 72.57 | 97.75 | 86.66 | 27,742 | 35,252 |
| GPKMEANS | 88.91 | 97.75 | 95.89 | 9,403 | 35,252 |
metric tables; their SSE traces are discussed in Figure 3. PCCC and COPKMEANS use the same ML and CL constraints as GPKMEANS, so they test downstream solver behavior under fixed constraints.
Overall, GPKMEANS achieves the best macro average on all three external clustering metrics. It obtains 58.75% ACC, 65.96% NMI, and 46.39% ARI, improving over the strongest non-GPKMEANS macro
average by 1.57%, 0.59%, and 0.53%, respectively. The gains are moderate rather than uniform across all datasets, as expected, because the embedding space is already strong and the generated constraints are sparse. The important trend is that the same bounded-penalty formulation improves the macro average across ACC, NMI, and ARI, rather than improving only one matching-sensitive metric. The LLOYD row shows that k-means is already a strong reference, but it remains below GPKMEANS by 5.67%, 2.24%, and 4.43% in ACC, NMI, and ARI, respectively.
Compared with LSCK and LSCK-HC, GPKMEANS gives a more favorable quality-robustness trade-off. LSCK remains competitive

Figure 4: Effect of constraint source with the GPKMEANS optimizer fixed.
and obtains the best scores on MTOP(D), showing that hard or high-strength constraints can help when the generated relations align well with the label structure. However, GPKMEANS is stronger on the macro average and performs especially well on CLINC(I), CLINC(D), GoEMO, and REDDIT. This validates treating LLM-generated constraints as semantic preferences rather than strict requirements, since residual noise or redundancy in local constraints can degrade clustering quality when enforced.
The comparison with SUMMARYCENTROIDS and PPLL shows that the advantage of GPKMEANS is not simply due to using an LLM somewhere in the clustering pipeline. Those methods use LLM-generated summaries or label-oriented guidance, whereas GPKMEANS keeps the LLM role narrow and reusable: it generates local pairwise constraints and leaves the assignment optimization to a regularized k-means objective. The results suggest that such local constraints can be effective when their influence is bounded and optimized jointly with the embedding-based SSE term.
The same-constraint solver baselines provide a more controlled comparison. Under identical generated ML and CL constraints, GPKMEANS outperforms PCCC by 5.72%, 2.54%, and 4.66% in ACC, NMI, and ARI, respectively. On the eight datasets with reported COPKMEANS results, the matched macro averages favor GPKMEANS by 7.19%, 3.13%, and 5.67%, respectively. Since the constraint input is fixed in this comparison, the difference is attributable to how the downstream solver uses the constraints. These results suggest that noisy LLM-generated constraints are better modeled as normalized soft penalties than as hard feasibility constraints.
Figure 3 reports normalized SSE from the intermediate assignments, with each run's initial value scaled to 1. For GPKMEANS, LLOYD, LSCK, and LSCK-HC, curves show the mean with shaded ±1 standard deviation across repeated runs. For SUMMARYC and PPLL, we compute SSE from their stored intermediate assignments. Because SSE is only one component of the GPKMEANS objective, the curves compare geometric compactness rather than convergence of a shared objective. GPKMEANS consistently reduces SSE in the first few iterations and usually achieves one of the lowest SSE values among the compared methods.
6.2.2 Constraint Reliability and Utility. Table 6 evaluates the generated constraints against true labels over the same nine datasets. This analysis is important because downstream clustering metrics start with strong embeddings and may show only moderate gains, even when the constraint source is substantially cleaner. The anchor-based constraint source used by GPKMEANS improves pair-weighted ML accuracy from 72.57% for LSCK constraints to 88.91%.


Figure 5: ACC and violation rates (%) measured against a common constraint set.
Table 7: Mean scores under increasing oracle constraints.
| Metric (%) | 0% | 10% | 20% | 30% | 40% | 50% | 60% | 70% | 80% |
|---|---|---|---|---|---|---|---|---|---|
| ACC | 62.65 | 67.17 | 70.03 | 73.09 | 76.99 | 79.58 | 87.27 | 94.65 | 100.00 |
| NMI | 84.38 | 86.03 | 86.79 | 88.10 | 89.50 | 90.65 | 94.30 | 97.56 | 100.00 |
| ARI | 45.02 | 51.45 | 54.44 | 59.63 | 64.40 | 68.85 | 80.44 | 91.64 | 100.00 |

Figure 6: Sensitivity of GPKMEANS under different values of .
Because GPKMEANS uses the same set of CL pairs as LSCK, both methods achieve the same 97.75% CL accuracy. The higher-quality ML source raises overall constraint accuracy from 86.66% to 95.89%.
This result clarifies the role of anchor-based querying. It is not a general active-selection method for finding globally optimal query pairs; rather, it provides a sparse, local, and reliable constraint source for the downstream optimizer. The remaining gap between GPKMEANS and the ORACLECLEAN shows why generated constraints should not be treated as oracle facts: even after improving the ML source, residual invalid constraints remain.
Figure 4 then keeps the optimizer fixed and changes only the constraint input. The ordering is consistent across ACC, NMI, and ARI: ORACLECLEAN is highest, the deployable GPKMEANS setting is next, and replacing our constraint source with LSCK constraints is lower. This comparison should not be read as a comparison against an additional usable baseline; instead, it measures how much of the potential benefit of clean constraints is already recovered by the proposed constraint source. The small gap between GPKMEANS and ORACLECLEAN suggests that the default constraints capture much of the useful semantic signal. Further gains may require more targeted boundary-aware selection rather than simply increasing the number of local constraints.
6.2.3 Robustness to Noisy Constraints. Figure 5 examines the relationship between clustering quality and constraint satisfaction by evaluating every method's output against the same generated constraint set. A lower violation rate is not necessarily better when the constraints are noisy. LSCK and LSCK-HC have lower violation rates on this common evaluation set, but their ACC is lower than that of GPKMEANS. In contrast, GPKMEANS has a higher residual violation rate while achieving the highest ACC in the comparison. This result is consistent with the proposed formulation: bounded
Table 8: Mean runtime per run (seconds), with a one-hour timeout per run. † marks incomplete COPKMEANS runs.
| Method | BANKING77 | CLINC(I) | MASSIVE(I) | MTOP(I) | CLINC(D) | MASSIVE(D) | MTOP(D) | GoEMO | Avg | |
|---|---|---|---|---|---|---|---|---|---|---|
| LSCK | 81.46 | 437.07 | 79.88 | 201.78 | 22.99 | 23.47 | 10.62 | 121.84 | 71.82 | 116.77 |
| LSCK-HC | 45.53 | 250.22 | 66.99 | 284.51 | 15.83 | 24.52 | 9.71 | 152.26 | 74.98 | 102.73 |
| PCCC | 168.92 | 338.93 | 186.37 | 202.34 | 11.35 | 26.47 | 15.39 | 33.11 | 172.94 | 128.42 |
| COPKMEANS | 501.14 | 1315.16† | 424.64† | 611.69 | 116.70 | 106.51 | 120.72 | 477.75 | N/A† | 459.29† |
| GPKMEANS | 2.29 | 6.04 | 3.17 | 3.53 | 1.97 | 2.19 | 1.21 | 7.52 | 2.97 | 3.43 |
Table 9: Offline LLM calls over nine datasets.
| Method | LLM stage | LLM calls |
|---|---|---|
| LSCK | ML and CL generation | 5,593 |
| LSCK-HC | ML/CL and confidence estimation | 6,430 |
| SUMMARYCENTROIDS | cluster summary updates | 1,512 |
| PPLL | PPLL label assignment | 5,400 |
| GPKMEANS | Anchor ML + CL generation | 1,435 |
soft penalties can use reliable constraints to correct ambiguous assignments without forcing every noisy relation to be satisfied.
To isolate the effect of constraint coverage, we conduct a controlled study on a balanced BANKING77 subset. The subset contains 77 intents with five examples per intent. We generate the full set of 73,920 oracle ML/CL pairs from gold labels and evaluate nested prefixes of one fixed random ordering from 10% to 80%. The 0% column in Table 7 reports embedding-only k-means++, while the remaining columns report GPKMEANS under increasing oracle-constraint coverage.
Table 7 shows a clear coverage-dependent trend. Without constraints, k-means++ obtains 62.65% ACC, 84.38% NMI, and 45.02% ARI. Using only 10% of the oracle constraints improves the three metrics to 67.17%, 86.03%, and 51.45%, respectively. As coverage increases, the gains become larger: at 60% coverage, GPKMEANS reaches 87.27% ACC and 80.44% ARI, and at 70% coverage it reaches 94.65% ACC and 91.64% ARI. At 80% coverage, the subset is recovered perfectly. The observed trend suggests that, as more reliable ML/CL constraints become available, the bounded group-penalty objective is increasingly effective at guiding the clustering structure toward the oracle partition.
Figure 6 reports score changes from when both penalty coefficients are set to the common value . Lines show macro-average changes over nine datasets; the shaded region adds and subtracts the mean within-dataset standard deviation. The sensitivity study complements the perturbation analysis in Section 5.4: larger penalties increase exposure to erroneous constraints, while their benefit from clean constraints remains data-dependent. For small and moderate penalty coefficients, the score changes are stable and can improve because reliable constraint relations provide useful semantic guidance. When the penalty becomes too large, however, clustering quality under the default noisy constraints begins to deteriorate.
The ORACLECLEAN curve is a diagnostic rather than a usable tuning target. When invalid ML constraints are removed using true labels, the optimizer tolerates stronger penalties better and reaches its best region at a larger coefficient. The cleaner constraints therefore remain useful over a wider penalty range than the default noisy constraints. This pattern shows that the useful penalty range depends on constraint reliability, not just on the optimizer.
6.2.4 LLM Calls and Runtime. Table 9 compares the number of LLM calls made by the LLM-based methods over the nine datasets.
We count successful prompt requests reconstructed from cached query logs. GPKMEANS uses 1,435 calls: 154 calls for anchor-based ML generation and 1,281 calls for CL construction. In comparison, LSCK uses 5,593 calls for ML and CL generation, while LSCK-HC adds 837 calls for confidence estimation, for a total of 6,430. All generated constraints are stored and reused by downstream runs, so this table measures LLM-call overhead rather than solver runtime.
Table 8 reports downstream clustering runtime on the same nine datasets used in Tables 3-5. As defined above, this comparison excludes offline prompting cost and focuses on optimization time. GPKMEANS takes 3.43 seconds per run on average, compared with 116.77 seconds for LSCK, 102.73 seconds for LSCK-HC, and 128.42 seconds for PCCC. Thus, under the offline-constraint protocol, GPKMEANS is about 34.0× faster than LSCK, 30.0× faster than LSCK-HC, and 37.4× faster than PCCC. On the eight datasets with reported COPKMEANS times, GPKMEANS averages 3.49 seconds versus 459.29 seconds for COPKMEANS; several COPKMEANS runs time out or return no feasible assignment. The speedup comes from local-delta updates. Each candidate reassignment updates the SSE term using only the source and target cluster statistics, and updates the constraint term using only groups incident to the moved sample. The group-count cache avoids implied-pair expansion and whole-group rescans, keeping the per-sweep cost close to the sparse form analyzed in Section 4.5.
7 CONCLUSION
This paper presented GPKMEANS, an efficient Group-Penalty k-means method for text clustering with noisy LLM-generated constraints. GPKMEANS represents these constraints as normalized, bounded group penalties and uses cached coordinate descent to evaluate exact local move deltas without repeatedly computing the full objective or expanding groups into implied pairs. We established finite-step convergence and derived robustness bounds that characterize the effect of constraint noise under varying ML and CL penalty coefficients. Across datasets, GPKMEANS achieved relative macro-average improvements of 2.75%, 0.90%, and 1.16% in ACC, NMI, and ARI over the strongest competing result for each metric, while reducing downstream optimization time by 30× relative to the fastest compared constrained-clustering baseline.
Future work should improve the quality of CL generation and study boundary-aware or utility-guided constraint selection, so that LLM calls focus on constraints that are both reliable and likely to change difficult clustering decisions. Moreover, we will investigate extending the framework to streaming text clustering, where new samples arrive continuously.
REFERENCES
[1] Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. 2023. GPT-4 Technical Report. arXiv preprint arXiv:2303.08774 (2023).
[2] Raghavendra Addanki, Sainyam Galhotra, and Barna Saha. 2021. How to Design Robust Algorithms using Noisy Comparison Oracle. Proc. VLDB Endow. 14, 10 (2021), 1703–1716.
[3] Charu C. Aggarwal and ChengXiang Zhai. 2012. A Survey of Text Clustering Algorithms. In Mining Text Data. Springer, 77–128. https://doi.org/10.1007/978-1-4614-3223-4_4
[4] Dimo Angelov. 2020. Top2Vec: Distributed Representations of Topics. CoRR abs/2008.09470 (2020). arXiv:2008.09470
[5] David Arthur and Sergei Vassilvitskii. 2007. k-means++: The Advantages of Careful Seeding. In Proceedings of the Annual ACM-SIAM Symposium on Discrete Algorithms. 1027–1035.
[6] Stephen H. Bach, Daniel Rodriguez, Yintao Liu, Chong Luo, Haidong Shao, Cassandra Axia, Souvik Sen, Alexander J. Ratner, Braden Hancock, Houman Alborzi, Rahul Kuchcal, and Christopher Re. 2019. Snorkel BellH: A Case Study in Deploying Weak Supervision at Industrial Scale. In Proceedings of the International Conference on Management of Data. ACM, 362–375. https://doi.org/10.1145/3299869.3314036
[7] Bahman Bahmani, Benjamin Moseley, Andrea Vattani, Ravi Kumar, and Sergei Vassilvitskii. 2012. Scalable K-Means++. Proceedings of the VLDB Endowment 5, 7 (2012), 622–633. https://doi.org/10.14778/2180912.2180915
[8] Aharon Bar-Hillel, Tomer Hertz, Noam Shental, and Daphna Weinshall. 2003. Learning Distance Functions Using Equivalence Relations. In Proceedings of the International Conference on Machine Learning. 11–18.
[9] Sugato Basu, Arindam Banerjee, and Raymond J. Mooney. 2004. Active Semi-Supervision for Pairwise Constrained Clustering. In Proceedings of the SIAM International Conference on Data Mining. 333–344.
[10] Sugato Basu, Arindam Banerjee, and Raymond J. Mooney. 2004. A Probabilistic Framework for Semi-Supervised Clustering. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. 59–68.
[11] Sugato Basu, Ian Davidson, and Kiri Wagstaff (Eds.). 2008. Constrained Clustering: Advances in Algorithms, Theory, and Applications. Chapman and Hall/CRC.
[12] Philipp Baumann and Dorit S. Hochbaum. 2025. An Algorithm for Clustering with Confidence-Based Must-Link and Cannot-Link Constraints. INFORMS Journal on Computing 37, 4 (2025), 1044–1068. https://doi.org/10.1287/IJOC.2023.0419
[13] Mikhail Bilenko, Sugato Basu, and Raymond J. Mooney. 2004. Integrating Constraints and Metric Learning in Semi-Supervised Clustering. In Proceedings of the International Conference on Machine Learning. 81–88.
[14] Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language Models are Few-Shot Learners. In Advances in Neural Information Processing Systems. 1877–1901.
[15] Inigo Casamueva, Tadas Teminas, Daniela Gerz, Matthew Henderson, and Ivan Vulić. 2020. Efficient Intent Detection with Dual Sentence Encoders. CoRR abs/2003.04807 (2020). arXiv:2003.04807 https://arxiv.org/abs/2003.04807
[16] Varun Chandola, Arindam Banerjee, and Vipin Kumar. 2009. Anomaly Detection: A Survey. Comput. Surveys 41, 3 (2009), 15:1–15:58. https://doi.org/10.1145/1541880.1541882
[17] Olivier Chapelle, Bernhard Schölkopf, and Alexander Zien (Eds.). 2006. Semi-Supervised Learning. MIT Press.
[18] Hao Cheng, Kien A Hua, and Khanh Vu. 2008. Constrained locally weighted clustering. Proc. VLDB Endow. 1, 1 (2008), 90–101.
[19] Ian Davidson and S. S. Ravi. 2005. Clustering with Constraints: Feasibility Issues and the K-Means Algorithm. In Proceedings of the SIAM International Conference on Data Mining.
[20] Dorotlya Demszky, Dana Movshovitz-Attias, Jeongwoo Ko, Alan S. Cowen, Gau-rav Nemade, and Sujith Ravi. 2020. GoEmotions: A Dataset of Fine-Grained Emotions. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, 4040–4054. https://doi.org/10.18653/V1/2020.ACL-MAIN.372
[21] Abhimanyu Dubey, Abhinav Jauhari, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, et al. 2024. The Llama 3 Herd of Models. arXiv preprint arXiv:2407.1783 (2024).
[22] Zijin Feng, Luyang Lin, Lingzhi Wang, Hong Cheng, and Kam-Fai Wong. 2024. LLMEdgeRefine: Enhancing Text Clustering with LLM-Based Boundary Point Refinement. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, EMNLP 2024, Miami, FL, USA, November 12–16, 2024. Yaser Al-Onaizan, Mohit Bansal, and Yun-Nung Chen (Eds.). Association for Computational Linguistics, 18455–18462. https://doi.org/10.18653/V1/2024.EMNLP
MAIN.1025
[23] Jack FitzGerald, Christopher Hench, Charith Peris, Scott Mackie, Kay Rottmann, Ana Sanchez, Aaron Nash, Liam Urbach, Vishesh Kakarala, Richa Singh, Swetha Ranganath, Laurie Crist, Mishra Britan, Wouter Leeuws, Gökhan Tür, and Prem Natarajan. 2023. MASSIVE: A 1M-Example Multilingual Natural Language Understanding Dataset with 51 Typologically-Diverse Languages. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, 4277–4302. https://doi.org/10.18653/V1/2023.ACL-LONG.235
[24] Jiajie Fu, Haitong Tang, Arjit Khan, Sharad Mehrotra, Xiangyu Ke, and Yunjun Gao. 2025. In-context clustering-based entity resolution with large language models: A design space exploration. Proceedings of the ACM on Management of Data 3, 4 (2025), 1–28.
[25] Fabrizio Gilardi, Meysam Alizadeh, and Maël Kubli. 2023. ChatGPT Outperforms Crowd Workers for Text-Annotation Tasks. Proceedings of the National Academy of Sciences 120, 30 (2023), e2305016120.
[26] Maarten Grootendorst. 2022. BERTopic: Neural Topic Modeling with a Class-Based TF-IDF Procedure. CoRR abs/2203.05794 (2022). arXiv:2203.05794
[27] Sudipto Guha, Rajeev Rastogi, and Kyuseok Shim. 1998. CURE: An Efficient Clustering Algorithm for Large Databases. In Proceedings of the ACM SIGMOD International Conference on Management of Data. ACM, 73–84. https://doi.org/10.1145/276304.276312
[28] Anil K. Jain. 2010. Data Clustering: 50 Years Beyond K-Means. Pattern Recognition Letters 31, 8 (2010), 651–666. https://doi.org/10.1016/j.patrec.2009.09.011
[29] Chaoqi Jia, Longkun Guo, Kewen Liao, and Zhigang Lu. 2023. Efficient Algorithm for the k-Means Problem with Must-Link and Cannot-Link Constraints. Tsinghua Science and Technology 28, 6 (2023), 1050–1062. https://doi.org/10.26599/TST.2022.9010056
[30] Chaoqi Jia, Weihong Wu, Longkun Guo, Zhigang Lu, Chao Chen, and Kok-Leong Ong. 2026. Optimized Algorithms for Text Clustering with LLM-Generated Constraints. In Fourteenth AAAI Conference on Artificial Intelligence, Thirty-Eighth Conference on Innovative Applications of Artificial Intelligence, Sixteenth Symposium on Educational Advances in Artificial Intelligence, AAAI 2026, Singapore, January 20–27, 2026, Sven Koenig, Chad Jenkins, and Matthew E. Taylor (Eds.). AAAI Press, 22229–22237. https://doi.org/10.1609/AAAIv40l27.39379
[31] Sepandar D. Kamvar, Dan Klein, and Christopher D. Manning. 2003. Spectral Learning. In Proceedings of the International Joint Conference on Artificial Intelligence. 561–566.
[32] Dan Klein, Sepandar D. Kamvar, and Christopher D. Manning. 2002. From Instance-Level Constraints to Space-Level Constraints: Making the Most of Prior Knowledge in Data Clustering. In Proceedings of the International Conference on Machine Learning. 307–314.
[33] Brian Kulis. 2013. Metric Learning: A Survey. Foundations and Trends in Machine Learning 5, 4 (2013), 287–364.
[34] Stefan Larson, Anish Mahendran, Joseph J. Peper, Christopher Clarke, Andrew Lee, Parker Hill, Jonathan K. Kummerfeld, Kevin Leach, Michael A. Laurenzano, Lingjia Tang, and Jason Mars. 2019. An Evaluation Dataset for Intent Classification and Out-of-Scope Prediction. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing. Association for Computational Linguistics, 1311–1316. https://doi.org/10.18653/V1/D19-1131
[35] Haoran Li, Abhinav Arora, Shuohui Chen, Ancht Gupta, Sonal Gupta, and Yashar Mehdad. 2021. MTOP: A Comprehensive Multilingual Task-Oriented Semantic Parsing Benchmark. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics. Association for Computational Linguistics, 2950–2962. https://doi.org/10.18653/V1/2021.EACL-MAIN.257
[36] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv preprint arXiv:1907.11692 (2019). arXiv:1907.11692
[37] Stuart Lloyd. 1982. Least Squares Quantization in PCM. IEEE Transactions on Information Theory 28, 2 (1982), 129–137.
[38] J. MacQueen. 1967. Some Methods for Classification and Analysis of Multivariate Observations. In Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability. 281–297.
[39] Yu Meng, Yunyi Zhang, Jiaxin Huang, Yu Zhang, and Jiawei Han. 2022. Topic Discovery via Latent Space Clustering of Pretrained Language Model Representations. In Proceedings of the ACM Web Conference 2022. 3143–3152. https://doi.org/10.1145/3485447.3512034
[40] Yida Mu, Peizhen Bai, Kalina Bontcheva, and Xingyi Song. 2024. Addressing topic granularity and hallucination in large language models for topic modelling. arXiv preprint arXiv:2405.00611 (2024).
[41] Niklas Muennighoff, Nouamane Tazi, Loïc Magne, and Nils Reimers. 2023. MTEB: Massive Text Embedding Benchmark. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics. Association for Computational Linguistics, 2006–2029. https://doi.org/10.18653/V1/2023.EACL-MAIN.148
[42] Avanika Narayan, Ines Chami, Laurel J. Orr, and Christopher Ré. 2022. Can Foundation Models Wrangle Your Data? Proc. VLDB Endow. 16, 4 (2022), 738–746.
[43] Nagarajan Natarajan, Inderjit S. Dhillon, Pradeep Ravikumar, and Ambuj Tewari. 2013. Learning with Noisy Labels. In Advances in Neural Information Processing Systems.
[44] Raymond T. Ng and Jiawei Han. 1994. Efficient and Effective Clustering Methods for Spatial Data Mining. In Proceedings of the International Conference on Very Large Data Bases. 144–155.
[45] Feiping Nie, Jingjing Xue, Danyang Wu, Rong Wang, Hui Li, and Xuelong Li. 2022. Coordinate Descent Method for k-means. IEEE Trans. Pattern Anal. Mach. Intell. 44, 5 (2022), 2371–2385.
[46] Alexander Ratner, Stephen H. Bach, Henry Ehrenberg, Jason Fries, Sen Wu, and Christopher Ré. 2020. Snorkel: Rapid Training Data Creation with Weak Supervision. The VLDB Journal 29, 2 (2020), 709–730.
[47] Nils Reimers and Iryna Gurevych. 2019. Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks. In Proceedings of the Conference on Empirical Methods in Natural Language Processing and the International Joint Conference on Natural Language Processing. 3982–3992.
[48] Jairo Diaz Rodriguez. 2025. k-LLMmeans: Summaries as Centroids for Interpretable and Scalable LLM-Based Text Clustering. CoRR abs/2502.09667 (2025). https://doi.org/10.48550/ARXIV.2502.09667 arXiv:2502.09667
[49] Noam Shental, Aharon Bar-Hillel, Tomer Hertz, and Daphna Weinshall. 2004. Computing Gaussian Mixture Models with EM Using Equivalence Constraints. In Advances in Neural Information Processing Systems. 465–472.
[50] Hongjin Su, Weijia Shi, Jungo Kasai, Yizhong Wang, Yushi Hu, Mari Ostendorf, Wen-tau Yih, Noah A. Smith, Luke Zettlemoyer, and Tao Yu. 2023. One Embedder, Any Task: Instruction-Finetuned Text Embeddings. In Proceedings of the Annual Meeting of the Association for Computational Linguistics. 1102–1121.
[51] Xing Su, Shan Xue, Fanzhen Liu, Jia Wu, Jian Yang, Chuan Zhou, Wenbin Hu, Cecile Paris, Surya Nepal, Di Jin, Quan Z. Sheng, and Philip S. Yu. 2024. A Comprehensive Survey on Community Detection with Deep Learning. IEEE Transactions on Neural Networks and Learning Systems 35, 4 (2024), 4682–4702. https://doi.org/10.1109/TNNLS.2021.3137396
[52] Vijay Viswanathan, Kiril Gashteovski, Carolin Lawrence, Tongshuang Wu, and Graham Neubig. 2024. Large Language Models Enable Few-Shot Clustering. Trans. Assoc. Comput. Linguistics 12 (2024), 321–333. https://doi.org/10.1162/
TACL_A_00648
[53] Kiri Wagstaff, Claire Cardie, Seth Rogers, and Stefan Schroedl. 2001. Constrained K-means Clustering with Background Knowledge. In Proceedings of the International Conference on Machine Learning. 577–584.
[54] Jianman Wang, Tim Kraska, Michael J. Franklin, and Jianhua Feng. 2012. CrowdER: Crowdsourcing Entity Resolution. Proc. VLDB Endow. 5, 11 (2012), 1483–1494.
[55] Sheng Wang, Yuan Sun, and Zhifeng Bao. 2020. On the Efficiency of K-Means Clustering: Evaluation, Optimization, and Algorithm Selection. Proc. VLDB Endow. 14, 2 (2020), 163–175.
[56] Xiang Wang and Ian Davidson. 2010. Flexible Constrained Spectral Clustering. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. 563–572.
[57] Junyuan Xie, Ross B. Girshick, and Ali Farhadi. 2016. Unsupervised Deep Embedding for Clustering Analysis. In Proceedings of the International Conference on Machine Learning. 478–487.
[58] Eric P. Xing, Andrew Y. Ng, Michael I. Jordan, and Stuart Russell. 2003. Distance Metric Learning with Application to Clustering with Side-Information. In Advances in Neural Information Processing Systems.
[59] Rui Xu and Donald C. Wunsch II. 2005. Survey of Clustering Algorithms. IEEE Transactions on Neural Networks 16, 3 (2005), 645–678. https://doi.org/10.1109/TNN.2005.845141
[60] Tian Zhang, Raghu Ramakrishnan, and Miron Livny. 1996. BIRCH: An Efficient Data Clustering Method for Very Large Databases. In Proceedings of the ACM SIGMOD International Conference on Management of Data. ACM, 103–114. https://doi.org/10.1145/233269.233324
[61] Xiaotong Zhang and Ying Li. 2025. Improving Clustering with Positive Pairs Generated from LLM-Driven Labels. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, EMNLP 2025, Suzhou, China, November 4-9, 2025, Christos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, and Violet Peng (Eds.). Association for Computational Linguistics, 12202–12218. https://doi.org/10.18653/V1/2025.EMNLP-MAIN.613
[62] Yuwei Zhang, Zihan Wang, and Jingbo Shang. 2023. ClusterLLM: Large Language Models as a Guide for Text Clustering. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, EMNLP 2023, Singapore, December 6-10, 2023, Houda Bouamor, Juan Pino, and Kalika Bali (Eds.). Association for Computational Linguistics, 13903–13920. https://doi.org/10.18653/V1/2023.EMNLP-MAIN.858
TECHNICAL REPORT: ADAPTIVE CONSTRAINT ACQUISITION
Overview. k-means provides an efficient foundation for text clustering, but embedding proximity can miss task-specific semantic boundaries. LLM-generated must-link (ML) and cannot-link (CL) constraints provide semantic guidance, but offline acquisition ignores subsequent clustering feedback and noisy judgments can mislead optimization. We extend GPKMEANS with a feedback loop that couples adaptive constraint acquisition with continued optimization. Neighborhood disagreement, centroid margins and recent reassignments guide anchor selection from the current partition. Group-Closure queries within the accumulating anchor set, whereas Group-Fanout extends queries to nonanchor samples. Accepted relations accumulate into ML connected components and CL clique groups, which enter the objective through normalized, bounded soft penalties. Cached coordinate descent continues from the current assignment after each update. Experiments with Gold and real LLM judgments on nine datasets compare both designs under matched total pair-query and sweep budgets. Updating constraints every two sweeps instead of five improves macro-average ACC by 0.33 and 0.39 percentage points for the LLM Closure and Fanout variants, respectively. Constraint-quality and graph-redundancy analyses reveal how erroneous and redundant relations limit the gains, motivating more reliable and informative queries.
8 EXTENSION DESIGN
8.1 Purpose and relation to the base method
This technical report accompanies the preceding GPKMEANS paper. It supplements the main paper with adaptive constraint acquisition during clustering (Section 8) and additional experiments using Gold and real LLM judgments (Section 9).
Pairwise supervision [53] and active constraint acquisition [9] motivate our extension. The base GPKMEANS workflow acquires constraints offline and optimizes a fixed group-penalty objective. Our extension uses the evolving partition to decide which additional relations to request. Each acquisition is followed by continued optimization of the current assignment, so information obtained in one interval affects both later assignments and later queries. The two variants share the same objective and acquisition rules except for the eligible query endpoints.
The extension queries both ML and CL pair relations, rebuilds their groups after each acquisition, and enforces an exact sweep budget. GPKMEANS uses ML links and separation-set CL construction [30], with a different acquisition budget and stopping schedule. We compare update schedules within the adaptive pipeline at matched total pair-query and sweep budgets.
8.2 Normalized objective and continued optimization
Let be the embedding of sample , and let be its assignment, with every cluster nonempty. The centroid is the mean of the embeddings in cluster . For a group of size , let . The normalized must-link
Algorithm 3: Adaptive group-constraint acquisition
Input: Texts and embeddings, cluster count k, initial assignment z, topology, source, interval , and budgets A, S = 80, B = 2560.
Output: Final assignment z.
1 ; for all i;
2 for do
3 Compute scores from current assignments and movement flags;
4 Grow to anchors;
5 Select fresh topology-eligible pairs ;
6 Obtain Gold or LLM judgments; add all to Q;
7 Accumulate explicit ML/CL answers; unknown answers add no edge;
8 Rebuild ML components and the CL clique partition;
9 ;
10 Continue normalized GPKMEANS for exactly sweeps;
11 for all i;
12 return z;
and cannot-link penalties are
Both terms lie in and act as soft preferences; samples remain individually movable. Writing , the objective is
All runs use and . The optimization starts from the GPKMEANS -means++ initialization [5], without an additional preliminary run to convergence. Following incremental coordinate optimization [45], the solver evaluates exact move costs using cluster statistics and constraint counts, accepts decreasing moves and preserves nonempty clusters. Samples are visited in the original group-size-based, constrained-first order.
At every acquisition step, the current assignment is retained and the caches are rebuilt for the updated groups. The solver then executes exactly complete sweeps, where a sweep visits all samples once. Thus means two complete sweeps between acquisitions, rather than two outer acquisition rounds. Neither labels nor constraints are reset between intervals. After the last interval, the algorithm returns the current partition directly, without a convergence tail or best-round selection. The descent guarantee applies within an interval with fixed groups; adding relations and rebuilding groups can change the objective between intervals.
8.3 Anchor selection from the current partition
For each point, the selector combines three signals:
Here is the empirical rank normalized to [0, 1], with average ranks for ties. The disagreement is the fraction of the point's ten nearest embedding neighbors assigned to other clusters. Let be its squared distance to its assigned centroid and its squared distance to the nearest competing centroid. The relative margin is . The flag indicates a net label change between the start and end of the previous interval and is zero initially. The score favors neighborhood disagreement, small or negative margins, and recent reassignment. It is recomputed from the actual current GPKMEANS state before each query batch.
The total anchor budget is specified as a proportion of the dataset size. Before an interval beginning after completed sweeps, the anchor target is . Previously selected anchors are retained. New anchors are taken from clusters with the fewest existing anchors, prioritizing high-scoring points and using deterministic tie breaking. The current cluster assignments determine these counts; an anchor can therefore change cluster without leaving the anchor set. No ground-truth labels are read by the selector.
8.4 Closure and fanout query topologies
For Group-Closure, both endpoints of a query must be in the cumulative anchor set. For Group-Fanout, at least one endpoint must be an anchor, and the other can be any sample. Both variants visit the ranked anchors in round-robin order and alternate two candidate routes. The cross-cluster route follows embedding-distance order while requiring a different current cluster. The within-cluster route prioritizes candidates with a different nearest competing centroid, then higher point scores, shorter distances and sample IDs. The target split is one half of the batch per route; an exhausted route can be replaced by the other route. The ten-neighbor set used to compute is a scoring neighborhood, not a hard restriction on the query candidate pool.
Every previously queried unordered pair is excluded, including pairs with uncertain or rejected answers. The implementation does not assign semantic labels to the entire corpus or derive a dense relation graph from such labels. Only explicitly queried pairs can create raw ML/CL edges. Because the source changes the evolving clustering, Gold and LLM runs can select different later pairs and anchors even when they start from the same initial partition.
8.5 Semantic judgments and cumulative groups
The Gold oracle returns ML exactly when the selected endpoints have the same benchmark label, and CL otherwise. The LLM setting makes fresh calls to deepseek-v4-f1ash-0731 at temperature zero, with 32 pairs per main request. Each pair directly contains both full texts and a local pair ID. Prompts describe the task's granularity but omit benchmark labels, the official class list and current predicted cluster IDs. Answers explicitly distinguish ML, CL and uncertainty. Valid answers are kept; only missing or conflicting format entries receive one repair request, and explicit semantic uncertainty is not repeatedly challenged. Provider rejections are treated as unknown, and transport failures permit at most three attempts per request. Raw responses are saved before parsing. Only identical request payloads within this experiment share cached responses.
All valid returned relations accumulate, including those already satisfied by the current partition. Unknown answers consume the
Table 10: Dataset statistics: number of texts , number of classes , and embedding dimension .
| Dataset | |||
|---|---|---|---|
| Banking77 [15] | 3,080 | 77 | 768 |
| CLINC(I) [34] | 4,500 | 150 | 768 |
| Massive(I) [23] | 2,974 | 59 | 768 |
| MTOP(I) [35] | 4,386 | 102 | 768 |
| CLINC(D) [34] | 4,500 | 10 | 768 |
| Massive(D) [23] | 2,974 | 18 | 768 |
| MTOP(D) [35] | 4,386 | 11 | 768 |
| GoEmo [20] | 5,940 | 27 | 768 |
| Reddit [41] | 3,217 | 50 | 768 |
pair budget but add no constraint. ML connected components of size at least two become groups under Eq. (26). For CL, repeatedly take the lexicographically first residual edge, append the smallest-ID common neighbor until no extension is possible or size is reached, and remove the resulting clique's edges. This partitions the observed CL edges into edge-disjoint cliques, including two-point groups. Cliques can share vertices but never edges, and no additional CL edges are inferred by transitivity. Each clique uses Eq. (27). Rebuilding groups after acquisition can change the normalization of old relations, even though no raw accepted edge is removed.
9 EXTENSION EXPERIMENTS
9.1 Experimental Setup
The evaluation includes Banking77 [15], CLINC [34], Massive [23], MTOP [35], GoEmotions [20], and Reddit clustering data from the MTEB benchmark [41]. Table 10 summarizes the nine datasets; I/D denote intent/domain clustering. The main paper uses INSTRUCTOR-large [50] for text representations. Here, the embeddings are fixed throughout constraint acquisition and optimization. Matched variants share the same initial partition and use float64 computation.
The experiment fixes the total query budget at 2,560 distinct pairs and the optimization budget at 80 complete sweeps. The final anchor budget is approximately 24.35% of the samples in each dataset. For , acquisition occurs before sweeps 0, 2, ..., 78: 40 batches of 64 pairs. For , it occurs before sweeps 0, 5, ..., 75: 16 batches of 160 pairs. Sweeps with zero moves still count toward the fixed budget. Each LLM configuration therefore has 80 nominal main requests before exact-request cache sharing, retries and format repairs. The evaluation crosses two relation sources (Gold and LLM), two topologies (Closure and Fanout), and two update intervals ( and ) on each dataset.
The schedules share the same total pair-query and sweep budgets while varying batch size and the timing of anchor release. We report accepted relations, group counts and model usage alongside clustering quality to characterize the resulting supervision and acquisition cost. Each configuration is evaluated using the partition saved after its final sweep. ACC, NMI and ARI are percentages. Dataset tables report the mean and standard deviation across runs. Macro results are the unweighted mean of the dataset-level means.
Table 11: Macro clustering scores (%). Closure/Fanout denote the group variants.
| Source | Method | ACC | NMI | ARI | |
|---|---|---|---|---|---|
| Gold | GPKMEANS | - | 58.54 | 65.92 | 46.18 |
| Closure | 5 | 59.38 | 67.06 | 47.69 | |
| Closure | 2 | 59.58 | 67.26 | 48.07 | |
| Fanout | 5 | 59.57 | 67.31 | 48.20 | |
| Fanout | 2 | 59.81 | 67.50 | 48.28 | |
| LLM | GPKMEANS | - | 58.75 | 65.96 | 46.39 |
| Closure | 5 | 58.54 | 66.11 | 46.38 | |
| Closure | 2 | 58.86 | 66.30 | 46.80 | |
| Fanout | 5 | 58.39 | 66.08 | 46.33 | |
| Fanout | 2 | 58.79 | 66.30 | 46.74 |
9.2 Clustering Quality
We compare the overall clustering quality of the two acquisition topologies and examine how it evolves during optimization.
Table 11 shows modest gains from the shorter interval for both sources and both topologies. Gold ACC increases by 0.203 percentage points for closure and 0.239 for fanout. With real LLM judgments, the gains are 0.327 and 0.395 points; the corresponding NMI gains are 0.187 and 0.224, and ARI gains are 0.416 and 0.403. Each ACC comparison improves the dataset mean on six datasets and decreases it on three. Differences are computed before rounding the displayed scores.
The two LLM variants at reach 58.86 and 58.79 ACC, close to the GPKMEANS ACC of 58.75. The GPKMEANS LLM row uses generated constraints; the Gold row uses oracle answers within the GPKMEANS query scopes and source-specific rules.
Figure 7 shows rapid early improvement followed by smaller changes as more relations arrive. Shorter intervals yield more active sweeps, reflecting continued adjustments to newly acquired constraints. The plotted ACC values are computed from saved predictions for evaluation; query selection uses the current partition and embedding geometry.
9.3 Effect of Acquisition Frequency
We examine how shortening the acquisition interval affects clustering quality across datasets. Tables 12 and 13 provide all ACC, NMI and ARI means and standard deviations for the adaptive configurations. In these and the following tables, C/F denote Group-Closure/Group-Fanout and the suffix gives the sweep interval. The dataset-level results reveal variation in the response to acquisition frequency.
Gold benefits on CLINC(D), while Banking77 decreases under both topologies. The variation indicates that acquisition frequency interacts with the embedding geometry, queried relations and task granularity.
With LLM judgments, CLINC(D) gains 1.948 ACC points for closure and 1.859 for fanout when moving from five sweeps to two. Fanout also gains 1.446 points on Massive(D) and 0.881 on Reddit, but loses 0.541 on Banking77 and 0.456 on MTOP(I). No dataset is excluded from the macro averages.
Table 12: Gold oracle results (%): mean standard deviation. C/F denote Closure/Fanout; suffixes indicate the sweep interval.
| Dataset | Metric | C5 | C2 | F5 | F2 |
|---|---|---|---|---|---|
| Banking77 | ACC | ||||
| NMI | |||||
| ARI | |||||
| CLINC(I) | ACC | ||||
| NMI | |||||
| ARI | |||||
| Massive(I) | ACC | ||||
| NMI | |||||
| ARI | |||||
| MTOP(I) | ACC | ||||
| NMI | |||||
| ARI | |||||
| CLINC(D) | ACC | ||||
| NMI | |||||
| ARI | |||||
| Massive(D) | ACC | ||||
| NMI | |||||
| ARI | |||||
| MTOP(D) | ACC | ||||
| NMI | |||||
| ARI | |||||
| GoEmo | ACC | ||||
| NMI | |||||
| ARI | |||||
| ACC | |||||
| NMI | |||||
| ARI |
9.4 Constraint Reliability and Utility
We examine relation correctness, graph redundancy and optimization activity to characterize the supervision provided by the acquired constraints. Table 14 distinguishes queried pairs, accepted edges and penalty groups. Every configuration queries 2,560 pairs, but LLM uncertainty or service rejection can leave some pairs without an edge. Connected-component ML groups and clique-based CL groups are different objects from the raw queried pairs. Closure and fanout produce different group counts, which determine the total constraint contribution together with the per-group penalties.
Table 15 summarizes three diagnostics in addition to relation correctness. An active sweep makes at least one reassignment. The violated fraction measures whether each newly acquired valid relation disagrees with the partition at acquisition time. The ML-cycle fraction counts new ML edges that do not reduce the cumulative number of connected components, including cycles formed within a batch. Since the ML objective depends on components, adding an edge inside an unchanged component alone leaves its group penalty unchanged. These post-hoc diagnostics characterize the relations selected during acquisition.
At , LLM closure and fanout make changes in 78.30 and 79.07 of the 80 sweeps on average, compared with 59.74 and 59.15 at . The last sweep moves 5.93 and 6.19 samples on average, indicating continued optimization activity at the budget endpoint.

Figure 7: Macro ACC over completed sweeps, using saved stage predictions. Lines join saved interval endpoints; all runs end at 80 sweeps and 2,560 queried pairs. Gold and LLM follow their own adaptive trajectories.
Table 13: Fresh DeepSeek results (%): mean ± standard deviation. C/F denote Closure/Fanout; suffixes indicate the sweep interval.
| Dataset | Metric | C5 | C2 | F5 | F2 |
|---|---|---|---|---|---|
| Banking77 | ACC | ||||
| NMI | |||||
| ARI | |||||
| CLINC(l) | ACC | ||||
| NMI | |||||
| ARI | |||||
| Massive(l) | ACC | ||||
| NMI | |||||
| ARI | |||||
| MTOP(l) | ACC | ||||
| NMI | |||||
| ARI | |||||
| CLINC(D) | ACC | ||||
| NMI | |||||
| ARI | |||||
| Massive(D) | ACC | ||||
| NMI | |||||
| ARI | |||||
| MTOP(D) | ACC | ||||
| NMI | |||||
| ARI | |||||
| GoEmo | ACC | ||||
| NMI | |||||
| ARI | |||||
| ACC | |||||
| NMI | |||||
| ARI |
For the two-sweep LLM runs, ML correctness is 42.20% for closure and 53.66% for fanout; CL correctness is 86.64% and 84.03%. Relation correctness is measured against benchmark labels on the queried pairs. The corresponding ML-cycle fractions are 46.90% and 20.51%. Fanout adds connectivity more often, but its LLM ACC remains
Table 14: Final mean counts. Run identifies source, topology and interval. Unknown pairs add no edge; and count ML/CL groups.
| Run | ML edges | CL edges | Unknown | ||
|---|---|---|---|---|---|
| Gold C5 | 695.7 | 1864.3 | 0.0 | 57.0 | 1346.0 |
| Gold C2 | 648.8 | 1911.2 | 0.0 | 50.6 | 1326.4 |
| Gold F5 | 854.6 | 1705.4 | 0.0 | 99.4 | 1414.9 |
| Gold F2 | 779.3 | 1780.7 | 0.0 | 81.7 | 1445.0 |
| LLM C5 | 946.4 | 1601.4 | 12.2 | 9.8 | 1178.2 |
| LLM C2 | 926.9 | 1631.4 | 1.7 | 8.2 | 1141.8 |
| LLM F5 | 973.4 | 1582.2 | 4.4 | 68.1 | 1281.4 |
| LLM F2 | 910.3 | 1643.1 | 6.6 | 54.6 | 1282.0 |
Table 15: Mean activity and relation quality. Active counts sweeps with moves out of 80; Final counts moves in the last sweep. Remaining columns are percentages, as defined in the text.
| Run | Active | Final | Violated | ML cycles | ML correct | CL correct |
|---|---|---|---|---|---|---|
| Gold C5 | 58.48 | 1.89 | 50.46 | 38.76 | 100.00 | 100.00 |
| Gold C2 | 78.48 | 8.41 | 49.21 | 38.79 | 100.00 | 100.00 |
| Gold F5 | 58.19 | 0.96 | 56.66 | 22.83 | 100.00 | 100.00 |
| Gold F2 | 78.67 | 6.04 | 55.08 | 22.86 | 100.00 | 100.00 |
| LLM C5 | 59.74 | 0.41 | 58.05 | 44.77 | 46.92 | 85.33 |
| LLM C2 | 78.30 | 5.93 | 56.03 | 46.90 | 42.20 | 86.64 |
| LLM F5 | 59.15 | 0.48 | 66.52 | 19.81 | 57.98 | 82.63 |
| LLM F2 | 79.07 | 6.19 | 64.92 | 20.51 | 53.66 | 84.03 |
slightly below closure's. New connections can propagate erroneous ML relations, and component merges change group normalization, highlighting the importance of relation reliability alongside connectivity.
9.5 Constraint Acquisition Cost
The experiment recorded 13,768,434 tokens, comprising 12,902,134 prompt tokens and 866,300 output tokens. Token totals are computed from the usage reported by the provider. The ledger includes
Table 16: Recorded token consumption by dataset. Prompt and Output count input and generated tokens, respectively; Total is their sum.
| Dataset | Prompt | Output | Total |
|---|---|---|---|
| Banking77 | 1,690,453 | 97,402 | 1,787,855 |
| CLINC(I) | 1,284,448 | 90,213 | 1,374,661 |
| Massive(I) | 1,276,520 | 101,114 | 1,377,634 |
| MTOP(I) | 1,327,318 | 89,108 | 1,416,426 |
| CLINC(D) | 1,300,012 | 89,657 | 1,389,669 |
| Massive(D) | 1,266,427 | 101,082 | 1,367,509 |
| MTOP(D) | 1,312,098 | 96,024 | 1,408,122 |
| GoEmo | 1,758,624 | 100,700 | 1,859,324 |
| 1,686,234 | 101,000 | 1,787,234 | |
| Total | 12,902,134 | 866,300 | 13,768,434 |
format repair and transport retries, with exact-request cache sharing applied across configurations. Gold consumes no model calls. Table 16 reports the disjoint dataset totals for the valid experiment. Interval-specific request sets can overlap through cache sharing, so summing their attributed costs would double-count some requests.
The final request format was validated with synthetic pairs before benchmark-score analysis. An earlier format that referenced texts through a separate indexed table answered only 8 of 32 synthetic relations correctly and was stopped. Providing both texts directly inside each pair answered 32 of 32 correctly, and the exact final request schema passed a separate 32-pair check. The reported LLM results use only the successful direct-text format; old LLM answers and clustering states were not reused. Valid Gold checkpoints were reusable because their selection and optimization did not depend on the model's request format.
For complete cost accounting, the indexed-format diagnostic used 10,429,175 recorded tokens, and the synthetic checks used 5,641 tokens. Including these diagnostic stages, the recorded consumption was 24,203,250 tokens.
9.6 Discussion
The experiments support incorporating intermediate clustering feedback into constraint acquisition. Under matched pair-query and sweep budgets, the two-sweep schedule improves macro-average ACC, NMI and ARI for both topologies and both relation sources.
Topology affects the structure and quality of the resulting supervision. Fanout reduces redundant ML connections and achieves the highest Gold scores, while closure yields slightly higher LLM ACC at . These observations highlight the value of considering relation correctness together with connectivity and group formation.
Relation noise and late constraint updates remain practical challenges: erroneous ML links can propagate through component merges, and the final updates still trigger reassignments. Future work will investigate reliability-aware selection and adaptive update intervals to obtain informative relations while allowing sufficient optimization after acquisition.