cdec: A Decoder, Alignment, and Learning Framework for Finite-State and Context-Free Translation Models

Chris Dyer, Adam Lopez, Juri Ganitkevitch, Jonathan Weese, Ferhan Türe, Phil Blunsom, Hendra Setiawan, Vladimir Eidelman, Philip ResnikACL 2010

Abstract

We present cdec, an open source framework for decoding, aligning with, and training a number of statistical machine translation models, including word-based models, phrase-based models, and models based on synchronous context-free grammars. Using a single unified internal representation for translation forests, the decoder strictly separates model-specific translation logic from general rescoring, pruning, and inference algorithms. From this unified representation, the decoder can extract not only the 1- or k-best translations, but also alignments to a reference, or the quantities necessary to drive discriminative training using gradient-based or gradient-free optimization techniques. Its efficient C++ implementation means that memory use and runtime performance are significantly better than comparable decoders.

Introduction

In the late 2000s, the statistical machine translation (SMT) landscape was characterized by a divide between phrase-based and hierarchical models. Researchers typically relied on separate decoders for different model types, leading to significant engineering overhead. Two primary architectural flaws hindered progress:

  1. Tight Coupling: Translation logic was often inextricably linked with language model integration and pruning strategies. Modifying one required deep changes to the other.
  2. Feature Bottlenecks: Existing decoders were optimized for a small number of dense features, making it difficult to scale to the millions of sparse features required for modern discriminative training.

cdec was developed as a high-performance, extensible C++ framework to address these issues by unifying diverse MT models under a single mathematical representation.

The Two-Phase Decoding Pipeline

The fundamental design principle of cdec is the strict separation of translation logic from search and inference. This is achieved through a two-phase pipeline centered on a "translation forest" (a directed hypergraph).

The cdec decoding pipeline, showing the transduction from various inputs to a scored translation hypergraph.

As shown in the figure above, the process begins with Forest Generation. Input sources—whether sentences, lattices, or existing forests—are processed by transducers (e.g., SCFG parsers or phrase-based transducers) to create an unscored hypergraph. This phase is entirely independent of language models or specific pruning heuristics.

The second phase is Rescoring and Inference. Here, general-purpose algorithms for language model integration (via FST rescoring), pruning (such as cube pruning or cube growing), and path extraction are applied to the hypergraph. This decoupling allows researchers to implement a new translation model simply by writing a transducer that outputs a hypergraph, immediately gaining access to all existing rescoring and training tools.

Unified Inference and Alignment

By representing translation deductions as hypergraphs, cdec treats different model types (word-based, phrase-based, SCFG) as the same mathematical object. This unification enables a wide range of inference tasks to be performed using a single set of tools.

Inference and alignment tasks derived from the unified translation hypergraph representation.

The framework utilizes a formal semiring abstraction. By varying the semiring (e.g., Tropical for Viterbi, Log for partition functions, or Expectation for gradients), the same core algorithms can compute 1-best or k-best translations, posterior alignments, and the necessary statistics for discriminative training. This makes cdec not just a decoder, but a comprehensive platform for MT research.

Performance Evaluation

The authors evaluated cdec on the NIST MT03 Chinese-English translation task using a hierarchical phrase-based grammar. When compared to contemporary decoders like Joshua (Java) and Hiero (Python), cdec demonstrated superior efficiency:

  • Speed: cdec decoded sentences in 0.37 seconds on average, significantly faster than Joshua (0.98s) and Hiero (4.04s).
  • Memory: It required only 1.0 GB of RAM, compared to 1.5–2.5 GB for Joshua.
  • Accuracy: All systems achieved comparable BLEU scores (31.4–31.6), confirming that cdec's performance gains do not come at the cost of translation quality.

Conclusion

cdec provides a robust foundation for SMT research by decoupling model implementation from inference. Its support for millions of sparse features and efficient C++ core makes it a powerful tool for large-scale discriminative training. Future work includes more efficient language model integration techniques and the expansion of parallel training pipelines using paradigms like MapReduce.

Summary updated

BibTeX
@inproceedings{dyer2010cdec,
  author = {Chris Dyer and Adam Lopez and Juri Ganitkevitch and Jonathan Weese and Ferhan Türe and Phil Blunsom and Hendra Setiawan and Vladimir Eidelman and Philip Resnik},
  title = {{cdec: A Decoder, Alignment, and Learning Framework for Finite-State and Context-Free Translation Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2010},
  url = {https://openreview.net/forum?id=Hkb8LjldZH},
}
Figure