A Conditional Random Field for Discriminatively-trained Finite-state String Edit Distance

Andrew McCallum, Kedar Bellare, Fernando C. N. PereiraUAI 2005

Abstract

The need to measure sequence similarity arises in information extraction, object identity, data mining, biological sequence analysis, and other domains. This paper presents discriminative string-edit CRFs, a finite-state conditional random field model for edit sequences between strings. Conditional random fields have advantages over generative approaches to this problem, such as pair HMMs or the work of Ristad and Yianilos, because as conditionally-trained methods, they enable the use of complex, arbitrary actions and features of the input strings. As in generative models, the training data does not have to specify the edit sequences between the given string pairs. Unlike generative models, however, our model is trained on both positive and negative instances of string pairs. We present positive experimental results on several data sets.

Introduction

Measuring similarity between strings—such as identifying that "Andrew McCallum" and "A. McCallum" refer to the same entity—is a cornerstone of data cleaning, bioinformatics, and information extraction. Traditional approaches often rely on fixed-cost edit distances (e.g., Levenshtein distance) or generative models like Pair HMMs. While generative models can learn edit costs from data, they suffer from two primary drawbacks: they typically learn only from positive examples (matches), ignoring the discriminative power of "near-miss" mismatches, and they struggle to incorporate complex, overlapping features due to independence assumptions required for tractability.

This paper introduces the String-Edit CRF, a model that combines the structural advantages of finite-state machines (FSMs) with the discriminative power of Conditional Random Fields. By treating alignments as latent variables, the model learns to distinguish matches from mismatches using a rich set of arbitrary features.

Methodology

The core of the approach is a finite-state model where paths represent sequences of edit operations (insertions, deletions, substitutions) between two strings, $x$ and $y$.

Model Structure and Training

Unlike generative models that model the joint probability $p(x, y)$, the String-Edit CRF calculates the conditional probability $p(match | x, y)$. This discriminative framework allows for the inclusion of non-independent features, such as character types (alphabetic vs. numeric) or look-ahead features.

In many real-world scenarios, training data provides labels for string pairs (match/mismatch) but lacks explicit alignment information. The model addresses this by treating the alignment as a latent variable. An Expectation-Maximization (EM) style procedure is employed to discover the alignments that best facilitate discrimination between classes.

Visualization of a latent alignment between two strings, demonstrating the model's ability to skip non-discriminative prefixes.

Feature Engineering and Inference

The CRF framework enables the use of "rich" features, including:

  • Character-level features: Type of character, punctuation, etc.
  • Complex Edits: The model can incorporate "skip" operations, allowing it to ignore specific words (e.g., "Inc." or "Corp.") or parenthesized content if they are deemed non-discriminative.
  • Inference: Marginalization over all possible edit sequences is performed using a 3D dynamic programming table, optimized for performance using diagonal crossing patterns.

Experimental Evaluation

The model was rigorously tested on several benchmarks, including a Restaurant database for duplicate detection and CiteSeer subsets for citation matching.

Performance comparison of CRF Edit Distance against baseline metrics across multiple datasets.

As shown in the results, the CRF Edit Distance consistently outperformed standard and learned generative baselines. For instance, on the "Restaurant Address" dataset, the CRF achieved an F1 score of 0.783, significantly higher than the 0.712 achieved by the best generative model. In citation matching tasks, such as the "Constraint" dataset, it reached an impressive F1 of 0.976.

Discussion and Key Insights

The success of the String-Edit CRF highlights several key principles:

  1. Negative Evidence: Training on mismatches allows the model to learn which similarities are common but non-discriminative (e.g., shared common first names).
  2. Domain-Specific Skips: The ability to learn when to "skip" noisy or irrelevant substrings provides a significant boost in robustness.
  3. Latent Structure Discovery: The model automatically discovers useful alignments through the maximization of the conditional likelihood, removing the need for manually aligned training data.

Limitations

Despite its performance, the model's 3D dynamic programming is computationally more intensive than 2D methods. Additionally, the non-convex nature of the objective function means that careful initialization is required to avoid poor local optima. Future work may explore context-free grammar (CFG) extensions to better handle large-scale substring swaps.

Summary updated

BibTeX
@inproceedings{mccallum2005conditional,
  author = {Andrew McCallum and Kedar Bellare and Fernando C. N. Pereira},
  title = {{A Conditional Random Field for Discriminatively-trained Finite-state String Edit Distance}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2005},
  url = {https://openreview.net/forum?id=BYZW64etI-c},
}
Figure