A Simple and Efficient Model Pruning Method for Conditional Random Fields

Hai Zhao, Chunyu KitIccpol 2009 · DOI

TL;DR

This paper introduces a novel method for pruning Conditional Random Fields (CRFs) by ranking and removing entire "feature groups" rather than individual features. This approach significantly reduces model size and speeds up decoding with minimal performance loss, demonstrating that even highly optimized CRFs are surprisingly redundant.

What Problem Does This Paper Address?

Conditional Random Fields (CRFs) are powerful models for sequence labeling tasks, widely used in natural language processing. However, as datasets grow and models become more complex, CRFs can inflate to contain tens of millions of features. This leads to substantial storage requirements and slow decoding times, making them impractical for some applications. While feature selection methods exist to build smaller models from scratch, this paper focuses on model pruning: reducing the size of an already trained CRF model to improve efficiency without sacrificing accuracy. The challenge is to identify and remove redundant parts of the model effectively.

Methods

The core of this paper is a new ranking metric for "feature groups." Instead of evaluating individual features, the authors group features based on a common condition (rule) that activates them. They then calculate the variance of the weights assigned to features within each group. The intuition is that groups with a wider spread of weights are more informative, as they help distinguish between different labels more confidently.

The proposed method involves:

  1. Defining Feature Groups: Features are grouped based on a shared condition H that triggers them for a specific clique (a set of related variables in the CRF graph). For example, a feature group might consist of all features related to the condition "previous word was 'fire'".
  2. Calculating Variance: For each feature group, the variance of the weights (λ) associated with its constituent features is computed. This variance serves as the ranking score.
  3. Pruning: Feature groups with lower variance scores are progressively removed from the trained CRF model. The authors explore different pruning rates to observe the impact on performance.

This approach differs from traditional feature selection/pruning by considering the structural relationships between features within a group and focusing on "backward feature elimination" (pruning an existing model) rather than "forward feature selection" (building a model from scratch).

Datasets

The experiments were conducted on datasets for two typical Chinese natural language processing tasks:

  • Word Segmentation (WS):
    • AS (from Bakeoff-2)
    • MSRA (from Bakeoff-2)
  • Named Entity Recognition (NER):
    • CityU (from Bakeoff-3)
    • MSRA (from Bakeoff-3)

The paper notes that these datasets were used with carefully selected label sets and feature templates, implying they represent relatively optimized models.

Key Insights and Ideas

  • Feature Groups are Highly Redundant: Even when CRFs are trained with carefully selected label sets and feature templates, the models contain a significant amount of redundancy. A large portion of feature groups can be removed without impacting performance.
  • Variance as an Informative Metric: The variance of feature weights within a group proves to be an effective metric for identifying informative feature groups. Groups with high variance are crucial for accurate predictions.
  • Pruning vs. Feature Selection: The paper highlights that pruning an existing model is a practical approach, especially when dealing with models that have already been optimized through feature selection.
  • Simple Cut-off is Suboptimal: A simple feature count cut-off method (removing features that appear less frequently) leads to a much larger performance drop compared to the proposed variance-based pruning method, even at similar pruning rates.

Key Results

  • High Pruning Rates Achieved: The proposed method allowed for pruning rates of over 65% for WS tasks and over 90% for NER tasks without any significant performance loss.
  • Minimal Performance Degradation: In experiments where a small fraction of features were kept (e.g., 1/50), performance remained above 97% for all tasks.
  • Comparison with Feature Count Cut-off: Figures 2 show that the proposed method significantly outperforms a simple feature count cut-off method, maintaining higher F-scores at comparable pruning rates.

Limitations and Future Work

  • Decoding Speedup Not Explicitly Measured: While the authors state that feature reduction should help decoding speed, they did not provide explicit measurements, noting that decoding speed is highly sensitive to the specific algorithm used.
  • Generalizability of Metric: The paper suggests that the proposed ranking metric, while tested on CRFs, could potentially be extended to other similar learning schemes like Maximum Entropy Markov Models (MEMMs).
  • Ensemble Methods: Future work could explore combining this pruning technique with existing forward feature selection methods or other ensemble schemes.
  • Comparison with Sparse Models: The authors mention that other algorithms naturally produce sparse models (e.g., structured averaged perceptron) and suggest further comparison with these.
  • Computational Resources: The current method requires significant computational resources, and future work could focus on making the process more efficient.

Summary updated

BibTeX
@inproceedings{zhao2009simple,
  author = {Hai Zhao and Chunyu Kit},
  title = {{A Simple and Efficient Model Pruning Method for Conditional Random Fields}},
  booktitle = {Iccpol},
  year = {2009},
  doi = {10.1007/978-3-642-00831-3\_14},
}
Figure