Many text classification decisions are viable based on constituent excerpts alone. Taking inspiration from the field of multiple instance learning, we present an algorithm for training a neural network to classify text by selecting such excerpts. We show that our approach is also scalable with demonstrated learning against samples with nearly 1M tokens. We evaluate our methods on 7 datasets with emphasis on long-textual collections that far exceed the encoding limit of our base model. We present state-of-the-art results with this algorithm on 3 datasets: identification of political bias in news outlets, trigger warnings in long stories, and demographic characteristics of authors in tweet collections. Furthermore, the model trained on weakly-labeled collections of text (bags) generalizes to accurately classify constituent, smaller instances. Besides a new state-of-the-art for these problems, this approach is one of the few neural methods to excel in these datasets.
Figures & tables
Figure 1: Documents are broken up into excerpts which are encoded with a BERT-style model. In the first pass (dotted line), a selector layer finds extreme points without gradients, saving memory. On a second run with gradients (dark lines), these are passed through the selector layer, a Gumbel-softmax operation, and onto a classifier layer.
Dataset
Bag
Instance
Labels
ILabels
Type
Trigger Warning
Stories
Passages
32
8
Multilabel
CLEF2023
Sources
Articles
3
3
Multiclass
Hyperpartisan
Articles
2
–
Binary
20News
Messages
20
–
Multiclass
Book Text
Summaries
227
–
Multilabel
Eurlex
Legal Acts
4271
–
Multilabel
Table 1: The datasets used in these experiments which include longer documents and collections of text. All include bag labels, while some also include instance labels.
dataset
mean
median
95th
max
clef-23-3a
98
115
152
387
hyperpartisan
749
544
1991
5560
eurlex
738
544
2000
6042
book-text
571
357
1741
13876
20news
355
210
930
28996
clef-23-3b
9173
7250
26993
77625
Table 2: The length of the datasets in RoBERTa tokens
experiment
token_max_length
stride
selector
classifier_type
n_excerpts
num_labels
loss
topk
batch_size
reweight
pan19-occupation
256
64
shared
shared
8
8
cross-entropy
1
8
True
pan23-triggers
256
64
shared
shared
32
32
ZLPR
1
4
False
pan19-birthyear
64
16
feature_tree
feature_tree
8
1
MSE
1
32
False
eurlex
64
16
shared
shared
4271
4271
ZLPR
1
4
False
hyperpartisan
256
64
shared
shared
2
2
cross-entropy
1
8
False
book-text
256
64
shared
shared
227
227
ZLPR
1
8
False
Table 3: Hyperparameters for each experiment
Dataset
Bag (CLEF-3B)
Instance (CLEF-3A)
MAE
Macro-F1
MAE
Macro-F1
Ours
0.22
0.87
0.69
0.39
Frank23 3B
0.32
—
—
–
Frank23 3A
—
—
0.27
–
Table 4: Results for the 2023 political bias dataset.
Dataset
Bag
Instance
Macro-F1
Micro-F1
Average Acc
Ours
0.37
0.75
0.709
Sahin et al. (2023)
0.352
0.74
—
5 fold multiclass
—
—
0.699
Mixtral8x7B
—
—
0.747
Table 5: The performance of classifiers trained on bag-level labels along with performance on instance-labeled datasets for PAN23 trigger warning dataset. Instance-level labels are majority vote decisions for 7 classes from the in-domain subset: violence, death, abduction, racism, homophobia, misogyny, ableism.
Metric
Accuracy
Micro-F1
Dataset
Hyperpartisan
20News
EURLEX
Book Summary
Ours
92.31 ( ±5.2 )
85.25 ( ±.7 )
69.21 ( ±.6 )
58.16 ( ±.5 )
BERT
92.00
84.79
73.09
58.18
BERT+TextRank
91.15
84.99
72.87
58.94
BERT+Random
89.23
84.65
73.22
59.36
Longformer
95.69
83.39
54.53
56.53
Table 6: The performance of classifiers for long document benchmark with its partitions with previous results Park et al. (2022) . Metrics averaged over 5 runs with different seeds. Our results include standard deviation, unlike previously reported benchmark results.
selector
n_excerpts
token_max_length
accuracy
accuracy-std
feature_tree
6
128
0.502
0.411
feature_tree
4
128
0.716
0.044
feature_tree
4
256
0.720
0.066
feature_tree
10
128
0.819
0.006
feature_tree
10
256
0.831
0.008
feature_tree
6
256
0.837
0.012
Table 7: Results from an ablation study on 20News dataset for 5 seeds
Figure 2: Memory usage of algorithms compared with truncation on the PAN 2019 dataset with batch size 1 and no optimizer. Truncation limits appear in all other approaches. Time to perform backpropagation calculated as the number of tokens varies.
Figure 3: UMAP projection of collections of excerpts from various sources in the CLEF23 3B dataset with few neighbors to preserve local structure. The top 3 instances are selected per dimension and average to create the bag score. Selected instances are on the convex hull in classification boundary space of 3 dimensions.
Figure 4: Visualization of selector scores from the age profiling feature tree model. Each histogram is a selector hyperplane and the X-axis is the selector score. Individual selectors specialize to features relevant in age profiling.
Figure 5: An excerpt classified as obvious left bias from a left-bias source with tokenwise attribution under layer integrated gradients. Blue indicates positive attribution toward the selector score, rather than the classification decision. White is near neutral and red contributes against the selector. This excerpt is heavily influenced by "fossil fuel industry."
Macro-F1
Dataset:
Gender
Age
Fame
Occup
Ours
0.783
0.571
0.43
0.549
Radivchev et al. ()
0.726
0.618
0.551
0.515
Table 8: Performance on the PAN 2019 celebrity profiling dataset. Age is scored as a modified classification task with a hit-window ranging from 2-6 years.
Neural language models trained on large crowdsourced corpora frequently exploit spurious surface patterns tied to target labels without true linguistic or causal relevance, boosting benchmark performance while failing on adversarial or out-of-distribution inputs. Existing approaches either require manual specification of the feature vocabulary or automate discovery only partially, leaving the gap between dataset-level correlation and model-level exploitation unaddressed. We present U N M ASK, a fully automated pipeline that discovers, causally verifies, and mitigates spurious correlations in text classifiers without additional human annotation. Given unlabeled training examples, U N M ASK generates candidate surface patterns as executable boolean expressions, filters them through a statistical validation protocol with independent replication, and establishes causal model dependence via verified counterfactual interventions. Causally confirmed features then serve as annotation-free group definitions for Deep Feature Reweighting, eliminating the group labels that standard DFR requires. Applied to BERT and RoBERTa trained on MNLI, our pipeline independently rediscovers established lexical-overlap and negation biases, verifying 9 of 10 features on BERT and 6 on RoBERTa, and improving HANS accuracy by up to 12.58 pp. On CivilComments-WILDS, programmatic groups match the 70.1% worst- group accuracy of hand-labeled DFR (Kirichenko et al., 2023) without demographic annotation. We further demonstrate that the discovery and validation stages generalize to reward model preference data, surfacing interpretable spurious correlations in RewardBench2.
Chidaksh Ravuru, Shashank Srivastava
Department of Computer Science University of North Carolina, Chapel Hill
Large language models (LLMs) struggle to classify text into taxonomies with many semantically similar labels, as the distinctions are domain-specific and not captured by pre-training. To handle large label spaces, a common approach retrieves top-K candidate labels by embedding similarity and prompt the LLM to choose among them. However, top-K retrieval reduces the number of candidates but does not help the model tell similar ones apart. When two similar labels both appear as candidates, the model lacks the signal to choose correctly between them. We propose a framework that (1) identifies which label pairs the model struggles to distinguish, (2) expands the candidate set to include confusable labels, and (3) generates targeted rules to differentiate between similar candidates. The framework requires no fine-tuning, and the generated rules transfer to smaller, cheaper models. On three benchmarks (WOS, Flipkart, LEDGAR), our approach improves Macro F1 by up to 10.0pp over retrieval baselines, with smaller models (2B--20B) gaining up to 11.5pp via cross-model transfer.
Large-scale multi-label text classification assigns a small subset of relevant labels to each document from a vocabulary containing thousands or tens of thousands of candidate labels. Although pretrained language models have improved semantic text representations, most representation-based approaches center their prediction pipelines on a primary encoder or combine auxiliary features within a single ranker. The complementarity between heterogeneous language models therefore remains insufficiently explored. We propose DualMLC, a dual-branch framework that processes the same document through an autoregressive decoder-only language model and a bidirectional encoder. Each branch maintains its own representation pathway and independently estimates relevance scores over the shared label space. DualMLC combines the two score vectors through late logit fusion, allowing shared evidence to reinforce relevant labels and branch-specific evidence to compensate for limitations in the other branch's representation. DualMLC achieves state-of-the-art results on three widely used large-scale multi-label text classification benchmarks. Ablation results further confirm that integrating the heterogeneous predictors produces stronger rankings than either branch alone. The source code is publicly available at https://github.com/huiyegit/DualMLC.
Hui Ye, Jing Zhang, Xiulong Yang +1
Department of Computer Science, Georgia State University, Atlanta, GA 30303, USA · Amazon, San Diego, CA, USA · School of Computer Science, Central China Normal University, Wuhan 430079, China