[Paper Review] How Large a Vocabulary Does Text Classification Need? A Variational Approach to Vocabulary Selection
This paper proposes Variational Vocabulary Dropout (VVD), a task-aware method for selecting minimal yet effective vocabularies in text classification by learning word-specific dropout probabilities via Bayesian inference. VVD outperforms frequency-based and other baselines on new metrics, achieving significant compression with minimal accuracy drop.
With the rapid development in deep learning, deep neural networks have been widely adopted in many real-life natural language applications. Under deep neural networks, a pre-defined vocabulary is required to vectorize text inputs. The canonical approach to select pre-defined vocabulary is based on the word frequency, where a threshold is selected to cut off the long tail distribution. However, we observed that such simple approach could easily lead to under-sized vocabulary or over-sized vocabulary issues. Therefore, we are interested in understanding how the end-task classification accuracy is related to the vocabulary size and what is the minimum required vocabulary size to achieve a specific performance. In this paper, we provide a more sophisticated variational vocabulary dropout (VVD) based on variational dropout to perform vocabulary selection, which can intelligently select the subset of the vocabulary to achieve the required performance. To evaluate different algorithms on the newly proposed vocabulary selection problem, we propose two new metrics: Area Under Accuracy-Vocab Curve and Vocab Size under X\% Accuracy Drop. Through extensive experiments on various NLP classification tasks, our variational framework is shown to significantly outperform the frequency-based and other selection baselines on these metrics.
Motivation & Objective
- Address the lack of systematic study on vocabulary selection in text classification, especially its impact on model performance and efficiency.
- Identify the limitations of frequency-based vocabulary pruning, which is task-agnostic and often suboptimal.
- Develop a task-aware vocabulary selection method that dynamically identifies and retains only the most relevant words for the classification task.
- Propose new evaluation metrics to systematically compare vocabulary selection strategies across different performance and size trade-offs.
- Enable efficient training and evaluation of vocabulary selection by introducing adaptive sampling and two-step pruning to reduce computational cost.
Proposed method
- Formalize vocabulary selection as a Bayesian inference problem, learning a dropout probability $p_w$ for each word $w$ in the vocabulary $\mathbb{V}$.
- Use variational dropout to train a neural network with word-specific dropout rates, where lower $p_w$ indicates higher word importance to the task.
- During inference, select a sub-vocabulary $\hat{\mathbb{V}}$ by retaining only words with $p_w$ below a threshold, treating others as null vectors $[0,\dots,0]$.
- Apply a two-step training strategy: first prune rare words via frequency cutoff, then apply VVD on the reduced vocabulary to accelerate convergence.
- Use exponential sampling of vocabulary sizes (e.g., 1, 2, 4, 8, 24, 56, ..., 60K) to efficiently estimate the accuracy-vocabulary curve with $O(\log|\mathbb{V}|)$ evaluations.
- Initialize word embeddings using pre-trained embeddings (e.g., Word2Vec, GloVe) but retrain the full embedding matrix during VVD training.
Experimental results
Research questions
- RQ1How does vocabulary size affect end-task classification accuracy, and what is the minimum vocabulary size required to achieve a target performance?
- RQ2How does task-aware vocabulary selection compare to frequency-based or TF-IDF-based baselines in terms of accuracy and compression ratio?
- RQ3Can a variational Bayesian framework effectively learn word-level importance and guide vocabulary pruning without prior task-specific knowledge?
- RQ4What are the computational trade-offs in training and evaluating such a vocabulary selection method, and how can they be mitigated?
- RQ5Does the proposed method generalize across different NLP tasks and neural architectures (e.g., CNN, BiLSTM) and datasets?
Key findings
- VVD significantly outperforms frequency-based, TF-IDF, and structure lasso baselines on both the Area Under Accuracy-Vocab Curve and Vocab Size under X% Accuracy Drop metrics.
- On the AG-news dataset, VVD achieves 97.6% of the full vocabulary's accuracy with only 2.7% of the vocabulary size (1,600 out of 60K words), compared to 4K words in the frequency-based baseline.
- The proposed two-step training method reduces VVD’s training time substantially, enabling practical deployment despite the stochasticity of variational dropout.
- Exponential sampling of vocabulary sizes enables accurate estimation of the accuracy-vocabulary curve using only $O(\log|\mathbb{V}|)$ evaluations, reducing evaluation time from $O(|\mathbb{V}|)$ to a feasible scale.
- VVD achieves higher sparsity and better compression than frequency-based methods while maintaining or improving accuracy, demonstrating that frequency-based pruning is suboptimal for model efficiency.
- The method is effective across multiple text classification tasks (e.g., document classification, NLI, dialog NLU) and architectures (CNN, BiLSTM), showing broad applicability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.