<?xml version="1.0"?><!DOCTYPE article SYSTEM "/project/take/software/searchbench_offline_processing/paperxml_generator/aclextractor/src/python/../resource/dtd/paperxml.dtd"><article><header><firstpageheader><page local="1" global="976"/><title>Hierarchical Phrase-Based Translation with Suffix Arrays</title><pubinfo>Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning,pp. 916-985, Prague, June 2001. ©2001 Association for Computational Linguistics</pubinfo><author surname="Lopez" givenname="Adam"><org  name="University of Maryland" country="USA" city="College Park"/></author></firstpageheader><frontmatter><p><b>Hierarchical Phrase-Based Translation with Sufix Arrays</b></p><p><b>Adam Lopez</b></p><p>Computer Science Department Institute for Advanced Computer Studies University of Maryland College Park, MD 20742 USA alopez@cs.umd.edu</p></frontmatter><abstract>A major engineering challenge in statistical machine translation systems is the efficient representation of extremely large translation rulesets. In phrase-based models, this prob­lem can be addressed by storing the training data in memory and using a suffix array as an efficient index to quickly lookup and ex­tract rules on the fly. <i>Hierarchical </i>phrase-based translation introduces the added wrin­kle of source phrases with gaps. Lookup algorithms used for contiguous phrases no longer apply and the best approximate pat­tern matching algorithms are much too slow, taking several minutes per sentence. We describe new lookup algorithms for hierar­chical phrase-based translation that reduce the empirical computation time by nearly two orders of magnitude, making on-the-fly lookup feasible for source phrases with gaps. </abstract></header><body><section number="1" title="Introduction"><p>Current statistical machine translation systems rely on very large rule sets. In phrase-based systems, rules are extracted from parallel corpora containing tens or hundreds of millions of words. This can re­sult in millions of rules using even the most conser­vative extraction heuristics. Efficient algorithms for rule storage and access are necessary for practical decoding algorithms. They are crucial to keeping up with the ever-increasing size of parallel corpora, as well as the introduction of new data sources such as web-mined and comparable corpora.</p><p>Until recently, most approaches to this problem involved substantial tradeoffs. The common prac­tice of test set filtering renders systems impracti­cal for all but batch processing. Tight restrictions on phrase length curtail the power of phrase-based models. However, some promising engineering so­lutions are emerging. Zens and Ney (2007) use a disk-based prefix tree, enabling efficient access to phrase tables much too large to fit in main memory. An alternative approach introduced independently by both Callison-Burch et al. (2005) and Zhang and Vogel (2005) is to store the training data itself in memory, and use a <i>suffix array </i>as an efficient in­dex to look up, extract, and score phrase pairs on the fly. We believe that the latter approach has several important applications (§7).</p><p>So far, these techniques have focused on phrase-based models using <i>contiguous</i><i> </i>phrases (Koehn et al., 2003; Och and Ney, 2004). Some recent models permit <i>discontiguous </i>phrases (Chiang, 2007; Quirk et al., 2005; Simard et al., 2005). Of particular in­terest to us is the hierarchical phrase-based model of Chiang (2007), which has been shown to be supe­rior to phrase-based models. The ruleset extracted by this model is a superset of the ruleset in an equiv­alent phrase-based model, and it is an order of mag­nitude larger. This makes efficient rule representa­tion even more critical. We tackle the problem using the online rule extraction method of Callison-Burch et al. (2005) and Zhang and Vogel (2005).</p><p>The problem statement for our work is: <i>Given </i><i>an</i><i> input sentence, efficiently find all hierarchical phrase-based translation rules for that sentence in the training corpus.</i></p><page local="2" global="977"/><p>We first review suffix arrays (§2) and hierarchical phrase-based translation (§3). We show that the ob­vious approach using state-of-the-art pattern match­ing algorithms is hopelessly inefficient (§4). We then describe a series of algorithms to address this inefficiency (§5). Our algorithms reduce computa­tion time by two orders of magnitude, making the approach feasible (§6). We close with a discussion that describes several applications of our work (§7).</p></section><section number="2" title="Suffix Arrays"><p>A suffix array is a data structure representing all suf­fixes of a corpus in lexicographical order (Manber and Myers, 1993). Formally, for a text T, the ith suffix of T is the substring of the text beginning at position i and continuing to the end of T. This suf­fix can be uniquely identified by the index i of its first word. The suffix array SAT of T is a permuta­tion of [1, |T|] arranged by the lexicographical order of the corresponding suffixes. This representation enables fast lookup of any contiguous substring us­ing binary search. Specifically, all occurrences of a length-m substring can be found in <i>O(m </i>+ log |T|) time (Manber and Myers, 1993). <footnote anchor="1"/></p><p>Callison-Burch et al. (2005) and Zhang and Vogel (2005) use suffix arrays as follows.</p><p>1. Load the source training text F, the suffix array <i>SAF</i>, the target training text <i>E, </i>and the align­ment A into memory.</p><p>2. For each input sentence, look up each substring (phrase) f of the sentence in the suffix array.</p><p>3. For each instance of f found in F, find its aligned phrase e using the phrase extraction method of Koehn et al. (2003).</p><p>4. Compute the relative frequency score p(e| f) of each pair using the count of the extracted pair and the marginal count of f .</p><p>5. Compute the lexical weighting score of the phrase pair using the alignment that gives the best score.</p><footnote label="1">Abouelhoda et al. (2004) show that lookup can be done in optimal O(m) time using some auxiliaray data structures. For our purposes O(m + log |T|) is practical, since for the 27M-word corpus used to carry out our experiments, log |T| ~ 25.</footnote><p>6. Use the scored rules to translate the input sen­tence with a standard decoding algorithm.</p><p>A difficulty with this approach is step 3, which can be quite slow. Its complexity is linear in the num­ber of occurrences of the source phrase f . Both Callison-Burch et al. (2005) and Zhang and Vogel (2005) solve this with sampling. If a source phrase appears more than k times, they sample only k oc­currences for rule extraction. Both papers report that translation performance is nearly identical to ex­tracting all possible phrases when k = 100. <footnote anchor="2"/></p></section><section number="3" title="Hierarchical Phrase-Based Translation"><p>We consider the hierarchical translation model of Chiang (2007). Formally, this model is a syn­chronous context-free grammar. The lexicalized translation rules of the grammar may contain a sin­gle nonterminal symbol, denoted X . We will use a, b, c and d to denote terminal symbols, and u, v, and w to denote (possibly empty) sequences of these ter­minals. We will additionally use <i>a </i>and // to denote (possibly empty) sequences containing both termi­nals and nonterminals.</p><p>A translation rule is written X — a//?. This rule states that a span of the input matching <i>a </i>is replaced by / in translation. We require that a and / con­tain an equal number (possibly zero) of <i>coindexed </i>nonterminals. An example rule with coindexes is X — uXq]vX^w/u'X^v'Xq]w'. When discussing only the source side of such rules, we will leave out the coindexes. For instance, the source side of the above rule will be written <i>uXvXw.</i><footnote anchor="3"/></p><p>For the purposes of this paper, we adhere to the restrictions described by Chiang (2007) for rules ex­tracted from the training data.</p><p>• Rules can contain at most two nonterminals.</p><p>• Rules can contain at most five terminals.</p><p>• Rules can span at most ten words.</p><footnote label="2">A sample size of 100 is actually quite small for many phrases, some of which occur tens or hundreds of thousands of times. It is perhaps surprising that such a small sample size works as well as the full data. However, recent work by Och (2005) and Federico and Bertoldi (2006) has shown that the statistics used by phrase-based systems are not very precise.</footnote><footnote label="3">In the canonical representation of the grammar, source-side coindexes are always in sorted order, making them unambigu­ous.</footnote><page local="3" global="978"/><p>• Nonterminals must span at least two words.</p><p>• Adjacent nonterminals are disallowed in the source side of a rule.</p><p>Expressed more economically, we say that our goal is to search for source phrases in the form u, uXv, or uXvXw, where 1 &lt; |uvw| &lt; 5, and |v| &gt; 0 in the final case. Note that the model also allows rules in the form Xu, uX, XuX, XuXv, and uXvX. However, these rules are lexically identical to other rules, and thus will match the same locations in the source text.</p></section><section number="4" title="The Collocation Problem"><p>On-the-fly lookup using suffix arrays involves an added complication when the rules are in form uXv or uXvXw. Binary search enables fast lookup of contiguous substrings. However, it cannot be used for discontiguous substrings. Consider the rule aXbXc. If we search for this rule in the following logical suffix array fragment, we will find the bold­faced matches.</p><p>Even though these suffixes are in lexicographical order, matching suffixes are interspersed with non-matching suffixes. We will need another algorithm to find the source rules containing at least one X sur­rounded by nonempty sequences of terminal sym­bols.</p><subsection number="4.1" title="Baseline Approach"><p>In the pattern-matching literature, words spanned by the nonterminal symbols of Chiang's grammar are called <i>don't cares </i>and a nonterminal symbol in a query pattern that matches a sequence of don't cares is called a <i>variable length gap. </i>The search prob­lem for patterns containing these gaps is a variant of <i>approximate pattern matching, </i>which has received substantial attention (Navarro, 2001). The best algo­rithm for pattern matching with variable-length gaps in a suffix array is a recent algorithm by Rahman et al. (2006). It works on a pattern w<b>i</b>Xw<b>2</b>X...w/ consisting of / contiguous substrings w1, w2, ...w/, each separated by a gap. The algorithm is straight­forward. After identifying all <i>ui </i>occurrences of each wi in O(|wi| + log |T|) time, collocations that meet the gap constraints are computed using an ef­ficient data structure called a <i>stratified tree </i>(van Emde Boas et al., 1977). <footnote anchor="4"/> Although we refer the reader to the source text for a full description of this data structure, its salient characteristic is that it implements priority queue operations <i>insert </i>and <i>next-element </i>in O(loglog |T|) time. Therefore, the total running time for an algorithm to find all con­tiguous subpatterns and compute their collocations is O<b>(E</b><b>f=i </b>[|w<b>i| </b>+ 1og|T| + U<b>i </b>log log |T|]).</p><p>We can improve on the algorithm of Rahman et al. (2006) using a variation on the idea of hashing. We exploit the fact that our large text is actually a collection of relatively short sentences, and that col­located patterns must occur in the same sentence in order to be considered a rule. Therefore, we can use the sentence id of each subpattern occurrence as a kind of hash key. We create a hash table whose size is exactly the number of sentences in our train­ing corpus. Each location of the partially matched pattern w<b>i </b>X...Xw<b>i </b>is inserted into the hash bucket with the matching sentence id. To find collocated patterns wi+1, we probe the hash table with each of the ui+1 locations for that subpattern. When a match is found, we compare the element with all el­ements in the bucket to see if it is within the window imposed by the phrase length constraints. Theoreti­cally, the worst case for this algorithm occurs when all elements of both sets resolve to the same hash bucket, and we must compare all elements of one set with all elements of the other set. This leads to a worst case complexity of O(^<b>i=1 </b>[|wi| + 1og|T|] + n<b>f=1 </b>ui). However, for real language data the per­formance for sets of any significant size will be <b>/=1 </b>[|wi| + 1og|T| + ui]), since most patterns will occur once in any given sentence.</p></subsection><subsection number="4.2" title="Analysis"><p>It is instructive to compare this with the complex­ity for contiguous phrases. In that case, total lookup time is O(|w| + 1og|T|) for a contiguous pattern w.</p><footnote label="4">Often known in the literature as a van Emde Boas tree or van Emde Boas priority queue.</footnote><table class="main" frame="box" rules="all" border="0" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>c</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>c</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>c</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>c</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>c</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>b</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>d</b></p></td><td class="cell"><p><b>c</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"><p><b>a</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table><page local="4" global="979"/><p>The crucial difference between the contiguous and discontiguous case is the added term <b>/=1 </b>ui. For even moderately frequent subpatterns this term dom­inates complexity.</p><p>To make matters concrete, consider the training corpus used in our experiments (§6), which contains 27M source words. The three most frequent uni-grams occur 1.48M, 1.16M and 688K times - the first two occur on average more than once per sen­tence. In the worst case, looking up a contiguous phrase containing any number and combination of these unigrams requires no more than 25 compari­son operations. In contrast, the worst case scenario for a pattern with a single gap, bookended on either side by the most frequent word, requires over <i>two million </i>operations using our baseline algorithm and over <i>thirteen million </i>using the algorithm of Rahman et al. (2006). A single frequent word in an input sentence is enough to cause noticeable slowdowns, since it can appear in up to 530 hierarchical rules.</p><p>To analyze the cost empirically, we ran our base­line algorithm on the first 50 sentences of the NIST Chinese-English 2003 test set and measured the CPU time taken to compute collocations. We found that, on average, it took 2241.25 seconds (~37 min­utes) <i>per sentence </i>just to compute all of the needed collocations. By comparison, decoding time per sentence is roughly 10 seconds with moderately ag­gressive pruning, using the Python implementation of Chiang (2007).</p></subsection></section><section number="5" title="Solving the Collocation Problem"><p>Clearly, looking up patterns in this way is not prac­tical. To analyze the problem, we measured the amount of CPU time per computation. Cumulative lookup time was dominated by a very small fraction of the computations (Fig. 1). As expected, further analysis showed that these expensive computations all involved one or more very frequent subpatterns. In the worst cases a single collocation took several seconds to compute. However, there is a silver lin­ing. Patterns follow a Zipf distribution, so the num­ber of pattern <i>types </i>that cause the problem is actu­ally quite small. The vast majority of patterns are rare. Therefore, our solution focuses on computa­tions where one or more of the component patterns is frequent. Assume that we are computing a collo-</p><doubt alpha="20.0" length="5" tooSmall="False" monospace="0.0">150K"</doubt><doubt alpha="100.0" length="1" tooSmall="False" monospace="0.0">E</doubt><p>Computations (ranked by time)</p><doubt alpha="50.0" length="2" tooSmall="False" monospace="0.0">_i</doubt><doubt alpha="25.0" length="4" tooSmall="False" monospace="0.0">300K</doubt><p>Figure 1: Ranked computations vs. cumulative time. A small fraction of all computations account for most of the computational time.</p><p>cation of pattern w1X...Xwi and pattern wi+1, and we know all locations ofeach. There are three cases.</p><p>• If both patterns are frequent, we resort to a precomputed intersection (§5.1). We were not aware of any algorithms to substantially im­prove the efficiency of this computation when it is requested on the fly, but precomputation can be done in a single pass over the text at decoder startup.</p><p>• If one pattern is frequent and the other is rare, we use an algorithm whose complexity is de­pendent mainly on the frequency of the rare pattern (§5.2). It can also be used for pairs of rare patterns when one pattern is much rarer than the other.</p><p>• If both patterns are rare, no special algorithms are needed. Any linear algorithm will suffice. However, for reasons described in §5.3, our other collocation algorithms depend on sorted sets, so we use a merge algorithm.</p><p>Finally, in order to cut down on the number of un­necessary computations, we use an efficient method to enumerate the phrases to lookup (§5.4). This method also forms the basis of various caching strategies for additional speedups. We analyze the memory use of our algorithms in §5.5.</p><subsection number="5.1" title="Precomputation"><p>Precomputation of the most expensive collocations can be done in a single pass over the text. As in­put, our algorithm requires the identities of the k most frequent contiguous patterns.<page local="5" global="980"/> <footnote anchor="5"/> It then iterates over the corpus. Whenever a pattern from the list is seen, we push a tuple consisting of its identity and current location onto a queue. Whenever the oldest item on the queue falls outside the maximum phrase length window with respect to the current position, we compute that item's collocation with all succeed­ing patterns (subject to pattern length constraints) and pop it from the queue. We repeat this step for every item that falls outside the window. At the end of each sentence, we compute collocations for any remaining items in the queue and then empty it.</p><p>Our precomputation includes the most frequent U-gram subpatterns. Most of these are unigrams, but in our experiments we found 5-grams among the 1000 most frequent patterns. We precompute the locations of source phrase uXv for any pair u and v that both appear on this list. There is also a small number of patterns uXv that are very fre­quent. We cannot easily obtain a list of these in ad­vance, but we observe that they always consist of a pair u and v of patterns from near the top of the fre­quency list. Therefore we also precompute the loca­tions uXvXw of patterns in which both u and v are among these <i>super-frequent </i>patterns (all unigrams), treating this as the collocation of the frequent pattern uXv and frequent pattern w. We also compute the analagous case for u and vXw.</p></subsection><subsection number="5.2" title="Fast Intersection"><p>For collocations of frequent and rare patterns, we use a fast set intersection method for sorted sets called double binary search (Baeza-Yates, 2004). <footnote anchor="6"/>It is based on the intuition that if one set in a pair of sorted sets is much smaller than the other, then we can compute their intersection efficiently by per­forming a binary search in the larger <i>data set </i>D for each element of the smaller <i>query set </i>Q.</p><p>Double binary search takes this idea a step further. It performs a binary search in D for the median ele­ment of Q. Whether or not the element is found, the search divides both sets into two pairs of smaller sets that can be processed recursively. Detailed analysis and empirical results on an information retrieval task are reported in Baeza-Yates (2004) and Baeza-Yates and Salinger (2005). If |Q| log |D| &lt; |D| then the performance is guaranteed to be sublinear. In prac­tice it is often sublinear even if | Q| log | D| is some­what larger than | D| . In our implementation we sim­ply check for the condition A|Q| log |D| &lt; |D| to decide whether we should use double binary search or the merge algorithm. This check is applied in the recursive cases as well as for the initial inputs. The variable A can be adjusted for performance. We de­termined experimentally that a good value for this parameter is 0.3.</p><footnote label="5">These can be identified using a single traversal over a longest common prefix (LCP) array, an auxiliary data struc­ture of the suffix array, described by Manber and Myers (1993). Since we don't need the LCP array at runtime, we chose to do this computation once offline.</footnote><footnote label="6">Minor modifications are required since we are computing collocation rather than intersection. Due to space constraints, details and proof of correctness are available in Lopez (2007a).</footnote></subsection><subsection number="5.3" title="Obtaining Sorted Sets"><p>Double binary search requires that its input sets be in sorted order. However, the suffix array returns matchings in lexicographical order, not numeric or­der. The algorithm of Rahman et al. (2006) deals with this problem by inserting the unordered items into a stratified tree. This requires O(u log log |T |) time for U items. If we used the same strategy, our algorithm would no longer be sublinear.</p><p>An alternative is to precompute all U-gram occur­rences in order and store them in an inverted index. This can be done in one pass over the data. <footnote anchor="7"/> This approach requires a separate inverted index for each U, up to the maximum U used by the model. The memory cost is one length-| T| array per index.</p><p>In order to avoid the full U| T| cost in memory, our implementation uses a mixed strategy. We keep a precomputed inverted index only for unigrams. For bigrams and larger U-grams, we generate the in­dex on the fly using stratified trees. This results in a superlinear algorithm for intersection. However, we can exploit the fact that we must compute col­locations multiple times for each input U-gram by caching the sorted set after we create it (The caching strategy is described in §5.4). Subsequent computa­tions involving this U-gram can then be done in lin­ear or sublinear time. Therefore, the cost of building the inverted index on the fly is amortized over a large number of computations.</p><footnote label="7">We combine this step with the other precomputations that require a pass over the data, thereby removing a redundant O(|T|) term from the startup cost.</footnote><page local="6" global="981"/></subsection><subsection number="5.4" title="Efficient Enumeration"><p>A major difference between contiguous phrase-based models and hierarchical phrase-based models is the number of rules that potentially apply to an input sentence. To make this concrete, on our data, with an average of 29 words per sentence, there were on average 133 contiguous phrases of length 5 or less that applied. By comparison, there were on av­erage 7557 hierarchical phrases containing up to 5 words. These patterns are obviously highly overlap­ping and we employ an algorithm to exploit this fact. We first describe a baseline algorithm used for con­tiguous phrases (§5.4.1). We then introduce some improvements (§5.4.2) and describe a data structure used by the algorithm (§5.4.3). Finally, we dis­cuss some special cases for discontiguous phrases (§5.4.4).</p><subsubsection number="5.4.1" title="The Zhang-Vogel Algorithm"><p>Zhang and Vogel (2005) present a clever algo­rithm for contiguous phrase searches in a suffix ar­ray. It exploits the fact that for each m-length source phrase that we want to look up, we will also want to look up its (m — 1)-length prefix. They observe that the region of the suffix array containing all suffixes prefixed by ua is a subset of the region containing the suffixes prefixed by u. Therefore, if we enumer­ate the phrases of our sentence in such a way that we always search for u before searching for ua, we can restrict the binary search for ua to the range con­taining the suffixes prefixed by u. If the search for u fails, we do not need to search for ua at all. They show that this approach leads to some time savings for phrase search, although the gains are relatively modest since the search for contiguous phrases is not very expensive to begin with. However, the potential savings in the discontiguous case are much greater.</p></subsubsection><subsubsection number="5.4.2" title="Improvements and Extensions"><p>We can improve on the Zhang-Vogel algorithm. An m-length contiguous phrase aub depends not only on the existence of its prefix au, but also on the existence of its suffix ub. In the contiguous case, we cannot use this information to restrict the starting range of the binary search, but we can check for the existence of ub to decide whether we even need to search for aub at all. This can help us avoid searches that are guaranteed to be fruitless.</p><p>Now consider the discontiguous case. As in the analogous contiguous case, a phrase aab will only exist in the text if its <i>maximal prefix </i>aa and <i>maxi­mal suffix </i>ab both exist in the corpus and overlap at specific positions.<footnote anchor="8"/> Searching for aab is potentially very expensive, so we put all available information to work. Before searching, we require that both aa and ab exist. Additionally, we compute the loca­tion of aab using the locations of both maximal sub­phrases. To see why the latter optimization is useful, consider a phrase abXcd. In our baseline algorithm, we would search for ab and cd, and then perform a computation to see whether these subphrases were collocated within an elastic window. However, if we instead use abXc and bXcd as the basis of the com­putation, we gain two advantages. First, the number elements of each set is likely to be smaller then in the former case. Second, the computation becomes simpler, because we now only need to check to see whether the patterns exactly overlap with a starting offset of one, rather than checking within a window of locations.</p><p>We can improve efficiency even further if we con­sider cases where the same substring occurs more than once within the same sentence, or even in mul­tiple sentences. If the computation required to look up a phrase is expensive, we would like to perform the lookup only once. This requires some mecha­nism for caching. Depending on the situation, we might want to cache only certain subsets of phrases, based on their frequency or difficulty to compute. We would also like the flexibility to combine on-the-fly lookups with a partially precomputed phrase table, as in the online/offline mixture of Zhang and</p><p>Vogel (2005).</p><p>We need a data structure that provides this flex­ibility, in addition to providing fast access to both the maximal prefix and maximal suffix of any phrase that we might consider.</p></subsubsection><subsubsection number="5.4.3" title="Prefix Trees and Suffix Links"><p>Our search optimizations are easily captured in a <i>prefix tree </i>data structure augmented with <i>suffix links. </i>Formally, a prefix tree is an unminimized determin­istic finite-state automaton that recognizes all of the patterns in some set. Each node in the tree repre-<page local="7" global="982"/></p><footnote label="8">Except when a  = X, in which case a  and b must be collo­cated within a window defined by the phrase length constraints.</footnote><doubt alpha="100.0" length="1" tooSmall="False" monospace="0.0">a</doubt><doubt alpha="66.7" length="6" tooSmall="False" monospace="0.0">Case 1</doubt><doubt alpha="18.5" length="27" tooSmall="False" monospace="0.0">b X c (2) d (1)—►»-*-*--*-o</doubt><doubt alpha="43.8" length="16" tooSmall="False" monospace="0.0">\b^jfxjc./d,,(4)</doubt><doubt alpha="0.0" length="2" tooSmall="False" monospace="0.0">1^</doubt><doubt alpha="100.0" length="2" tooSmall="False" monospace="0.0">bX</doubt><doubt alpha="0.0" length="2" tooSmall="False" monospace="0.0">—-</doubt><doubt alpha="23.5" length="17" tooSmall="False" monospace="0.0">c (2) d (1)f-*P-^</doubt><doubt alpha="16.7" length="6" tooSmall="False" monospace="0.0">(i)(4)</doubt><doubt alpha="0.0" length="5" tooSmall="False" monospace="0.0">'----</doubt><doubt alpha="33.3" length="3" tooSmall="False" monospace="0.0">» U</doubt><doubt alpha="0.0" length="3" tooSmall="True" monospace="0.0">/ /</doubt><doubt alpha="60.0" length="5" tooSmall="False" monospace="0.0">fX,/c</doubt><doubt alpha="42.9" length="7" tooSmall="False" monospace="0.0">b X—+p-</doubt><doubt alpha="66.7" length="6" tooSmall="False" monospace="0.0">Case 2</doubt><doubt alpha="18.2" length="11" tooSmall="False" monospace="0.0">c (2) d (1)</doubt><doubt alpha="0.0" length="3" tooSmall="False" monospace="0.0">»»-</doubt><doubt alpha="0.0" length="5" tooSmall="False" monospace="0.0">(3) ^</doubt><doubt alpha="0.0" length="3" tooSmall="False" monospace="0.0">(4)</doubt><p>Figure 2: Illustration of prefix tree construction showing a partial prefix tree, including suffix links. Suppose we are interested in pattern <i>abXcd, </i>represented by node (1). Its prefix is represented by node (2), and node (2)'s suffix is represented by node (3). Therefore, node (1)'s suffix is represented by the node pointed to by the d-edge from node (3), which is node (4). There are two cases. In case 1, node (4) is inactive, so we can mark node (1) inactive and stop. In case 2, node (4) is active, so we compute the collocation of <i>abXc </i>and bXcd with information stored at nodes (2) and (4), using either a precomputed intersection, double binary search, or merge, depending on the size of the sets. If the result is empty, we mark the node inactive. Otherwise, we store the results at node (1) and add its successor patterns to the frontier for the next iteration. This includes all patterns containing exactly one more terminal symbol than the current pattern.</p><p>sents the prefix of a unique pattern from the set that is specified by the concatenation of the edge labels along the path from the root to that node. A suffix link is a pointer from a node representing path <i>aa </i>to the node representing path a. We will use this data structure to record the set of patterns that we have searched for and to cache information for those that were found successfully.</p><p>Our algorithm generates the tree breadth-search along a <i>frontier. </i>In the mth iteration we only search for patterns containing m terminal symbols. Regard­less of whether we find a particular pattern, we cre­ate a node for it in the tree. If the pattern was found in the corpus, its node is marked <i>active. </i>Otherwise, it is marked <i>inactive. </i>For found patterns, we store either the endpoints of the suffix array range con­taining the phrase (if it is contiguous), or the list of locations at which the phrase is found (if it is dis­contiguous). We can also store the extracted rules. <footnote anchor="9"/>Whenever a pattern is successfully found, we add all patterns with m + 1 terminals that are prefixed by it to the frontier for processing in the next iteration.</p><footnote label="9">Conveniently, the implementation of Chiang (2007) uses a prefix tree grammar encoding, as described in Klein and Man­ning (2001). Our implementation decorates this tree with addi­tional information required by our algorithms.</footnote><p>To search for a pattern, we use location infor­mation from its parent node, which represents its maximal prefix. Assuming that the node represents phrase ab, we find the node representing its max­imal suffix by following the b-edge from the node pointed to by its parent node's suffix link. If the node pointed to by this suffix link is inactive, we can mark the node inactive without running a search. When a node is marked inactive, we discontinue search for phrases that are prefixed by the path it represents. The algorithm is illustrated in Figure 2.</p></subsubsection><subsubsection number="5.4.4" title="Special Cases for Phrases with Gaps"><p>A few subtleties arise in the extraction of hierar­chical patterns. Gaps are allowed to occur at the be­ginning or end of a phrase. For instance, we may have a source phrase <i>Xu </i>or uX or even XuX. Al­though each of these phrases requires its own path in the prefix tree, they are lexically identical to phrase u. An analogous situation occurs with the patterns XuXv, <i>uXvX</i>, and uXv. There are two cases that we are concerned with.</p><p>The first case consists of all patterns prefixed with X. The paths to nodes representing these patterns will all contain the X-edge originating at the root node.<page local="8" global="983"/> All of these paths form the <i>shadow sub­tree. </i>Path construction in this subtree proceeds dif­ferently. Because they are lexically identical to their suffixes, they are automatically extended if their suf­fix paths are active, and they inherit location infor­mation of their suffixes.</p><doubt alpha="25.0" length="4" tooSmall="False" monospace="0.0">—+p—</doubt><p>The second case consists of all patterns suffixed with X. Whenever we successfully find a new pat­tern a, we automatically extend it with an X edge, provided that aX is allowed by the model con­straints. The node pointed to by this edge inherits its location information from its parent node (repre­senting the maximal prefix a).</p><p>Note that both special cases occur for patterns in the form XuX.</p><doubt alpha="58.3" length="12" tooSmall="False" monospace="0.0">405 sec/sent</doubt><doubt alpha="0.0" length="1" tooSmall="False" monospace="0.0">—</doubt><doubt alpha="40.0" length="5" tooSmall="False" monospace="0.0">725MB</doubt><doubt alpha="50.0" length="4" tooSmall="False" monospace="0.0">0 MB</doubt></subsubsection></subsection></section><section number="41" title="sec/sent"><doubt alpha="12.5" length="8" tooSmall="False" monospace="0.0">*-----_i</doubt><doubt alpha="0.0" length="6" tooSmall="False" monospace="0.0">0 1000</doubt><p>Number of frequent subpatterns</p><p>Figure 3: Effect of precomputation on memory use and processing time. Here we show only the mem­ory requirements of the precomputed collocations.</p><subsection number="5.5" title="Memory Requirements"><p>As shown in Callison-Burch et al. (2005), we must keep an array for the source text F, its suffix array, the target text <i>E, </i>and alignment A in memory. As­suming that A and E are roughly the size of F, the cost is 4|T|. If we assume that all data use vocabu­laries that can be represented using 32-bit integers, then our 27M word corpus can easily be represented in around 500MB of memory. Adding the inverted index for unigrams increases this by 20%. The main additional cost in memory comes from the storage of the precomputed collocations. This is dependent both on the corpus size and the number of colloca­tions that we choose to precompute. Using detailed timing data from our experiments we were able to simulate the memory-speed tradeoff (Fig. 3). If we include a trigram model trained on our bitext and the Chinese Gigaword corpus, the overall storage costs for our system are approximately 2GB.</p></subsection></section><section number="6" title="Experiments"><p>All of our experiments were performed on Chinese-English in the news domain. We used a large train­ing set consisting of over 1 million sentences from various newswire corpora. This corpus is roughly the same as the one used for large-scale experiments by Chiang et al. (2005). To generate alignments, we used GIZA++ (Och and Ney, 2003). We sym­metrized bidirectional alignments using the grow-diag-final heuristic (Koehn et al., 2003).</p><p>We used the first 50 sentences of the NIST 2003 test set to compute timing results. All of our algo­rithms were implemented in Python 2.4. <footnote anchor="10"/> Timing results are reported for machines with 8GB of mem­ory and 4 3GHz Xeon processors running Red Hat linux 2.6.9. In order to understand the contributions of various improvements, we also ran the system with with various ablations. In the default setting, the prefix tree is constructed for each sentence to guide phrase lookup, and then discarded. To show the effect of caching we also ran the algorithm with­out discarding the prefix tree between sentences, re­sulting in full inter-sentence caching. The results are shown in Table 1. <footnote anchor="11"/></p><p>It is clear from the results that each of the op­timizations is needed to sufficiently reduce lookup time to practical levels. Although this is still rela­tively slow, it is much closer to the decoding time of 10 seconds per sentence than the baseline.</p><footnote label="10">Python is an interpreted language and our implementations do not use any optimization features. It is therefore reasonable to think that a more efficient reimplementation would result in across-the-board speedups.</footnote><footnote label="11">The results shown here do not include the startup time re­quired to load the data structures into memory. In our Python implementation this takes several minutes, which in principle should be amortized over the cost for each sentence. However, just as Zens and Ney (2007) do for phrase tables, we could com­pile our data structures into binary memory-mapped files, which can be read into memory in a matter of seconds. We are cur­rently investigating this option in a C reimplementation.</footnote><page local="9" global="984"/><p>Algorithms</p><p>Secs/Sent Collocations</p><doubt alpha="34.8" length="23" tooSmall="False" monospace="0.0">Baseline 2241.25 325548</doubt><doubt alpha="40.0" length="25" tooSmall="False" monospace="0.0">Prefix Tree 1578.77 69994</doubt><doubt alpha="58.5" length="41" tooSmall="False" monospace="0.0">Prefix Tree + precomputation 696.35 69994</doubt><doubt alpha="55.0" length="40" tooSmall="False" monospace="0.0">Prefix Tree + double binary 405.02 69994</doubt><doubt alpha="64.3" length="56" tooSmall="False" monospace="0.0">Prefix Tree + precomputation + double binary 40.77 69994</doubt><p>Prefix Tree with full caching + precomputation + double binary 30.70 67712</p><p>Table 1: Timing results and number of collocations computed for various combinations of algorithms. The runs using precomputation use the 1000 most frequent patterns.</p></section><section number="7" title="Conclusions and Future Work"><p>Our work solves a seemingly intractable problem and opens up a number of intriguing potential ap­plications. Both Callison-Burch et al. (2005) and Zhang and Vogel (2005) use suffix arrays to relax the length constraints on phrase-based models. Our work enables this in hierarchical phrase-based mod­els. However, we are interested in additional appli­cations.</p><p>Recent work in discriminative learning for many natural language tasks, such as part-of-speech tag­ging and information extraction, has shown that fea­ture engineering plays a critical role in these ap­proaches. However, in machine translation most fea­tures can still be traced back to the IBM Models of 15 years ago (Lopez, 2007b). Recently, Lopez and Resnik (2006) showed that most of the features used in standard phrase-based models do not help very much. Our algorithms enable us to look up phrase pairs <i>in context, </i>which will allow us to compute in­teresting contextual features that can be used in dis­criminative learning algorithms to improve transla­tion accuracy. Essentially, we can use the training data itself as an indirect representation of whatever features we might want to compute. This is not pos­sible with table-based architectures.</p><p>Most of the data structures and algorithms dis­cussed in this paper are widely used in bioinformat-ics, including suffix arrays, prefix trees, and suf­fix links (Gusfield, 1997). As discussed in §4.1, our problem is a variant of the approximate pattern matching problem. A major application of approx­imate pattern matching in bioinformatics is query processing in protein databases for purposes of se­quencing, phylogeny, and motif identification.</p><p>Current MT models, including hierarchical models, translate by breaking the input sentence into small pieces and translating them largely indepen­dently. Using approximate pattern matching algo­rithms, we imagine that machine translation could be treated very much like search in a protein database. In this scenario, the goal is to select training sentences that match the input sentence as closely as possible, under some evaluation function that accounts for both matching and mismatched sequences, as well as possibly other data features. Once we have found the closest sentences we can translate the matched portions in their entirety, re­placing mismatches with appropriate word, phrase, or hierarchical phrase translations as needed. This model would bring statistical machine translation closer to convergence with so-called <i>example-based translation, </i>following current trends (Marcu, 2001; Och, 2002). We intend to explore these ideas in fu­ture work.</p></section><section title="Acknowledgements"><p>I would like to thank Philip Resnik for encour­agement, thoughtful discussions and wise counsel; David Chiang for providing the source code for his translation system; and Nitin Madnani, Smaranda Muresan and the anonymous reviewers for very helpful comments on earlier drafts of this paper. Any errors are my own. This research was supported in part by ONR MURI Contract FCPO.810548265 and the GALE program of the Defense Advanced Research Projects Agency, Contract No. HR0011-06-2-001. Any opinions, findings, conclusions or recommendations expressed in this paper are those of the author and do not necessarily reflect the view of DARPA.</p><page local="10" global="985"/></section><references><p>Mohamed Ibrahim Abouelhoda, Stefan Kurtz, and Enno Ohlebusch. 2004. Replacing suffix trees with en­hanced suffix arrays. <i>Journal of Discrete Algorithms, </i>2(1):53-86, Mar.</p><p>Ricardo Baeza-Yates and Alejandro Salinger. 2005. Ex­perimental analysis of a fast intersection algorithm for sorted sequences. In M. Consens and G. Navarro, ed­itors, <i>Proc. of SPIRE, </i>number 3772 in LNCS, pages 13-24, Berlin. Springer-Verlag.</p><p>Ricardo Baeza-Yates. 2004. A fast intersection algo­rithm for sorted sequences. In <i>Proc. ofCombinatorial Pattern Matching, </i>number 3109 in LNCS, pages 400­408, Berlin. Springer-Verlag.</p><p>Chris Callison-Burch, Colin Bannard, and Josh Shroeder. 2005. Scaling phrase-based statistical machine trans­lation to larger corpora and longer phrases. In <i>Proc. of ACL, </i>pages 255-262, Jun.</p><p>David Chiang, Adam Lopez, Nitin Madnani, Christof Monz, Philip Resnik, and Michael Subotin. 2005. The Hiero machine translation system: Extensions, evalua­tion, and analysis. In <i>Proc. ofHLT-EMLP, </i>pages 779­786, Oct.</p><p>David Chiang. 2007. Hierarchical phrase-based transla­tion. <i>Computational Linguistics, </i>33(2). In press.</p><p>Marcello Federico and Nicola Bertoldi. 2006. How many bits are needed to store probabilities for phrase-based translation? In <i>Proc. of NAACL Workshop on Statistical Machine Translation, </i>pages 94-101, Jun.</p><p>Dan Gusfield. 1997. <i>Algorithms on Strings, Trees, and Sequences. </i>Cambridge University Press.</p><p>Dan Klein and Christopher D. Manning. 2001. Parsing with treebank grammars: Empirical bounds, theoreti­cal models, and the structure of the Penn Treebank. In <i>Proc.</i><i> ofACL-EACL, </i>pages 330-337, Jul.</p><p>Philipp Koehn, Franz Josef Och, and Daniel Marcu. 2003. Statistical phrase-based translation. In <i>Proc. of HLT-NAACL, </i>pages 127-133, May.</p><p>Adam Lopez and Philip Resnik. 2006. Word-based alignment, phrase-based translation: What's the link?</p><p>In <i>Proc. ofAMTA, </i>pages 90-99, Aug.</p><p>Adam Lopez. 2007a. Hierarchical phrase-based trans­lation with suffix arrays. Technical Report 2007-26, University of Maryland Institute for Advanced Com­puter Studies, May.</p><p>Adam Lopez. 2007b. A survey of statistical machine translation. Technical Report 2006-47, University of Maryland Institute for Advanced Computer Studies, Apr.</p><p>Udi Manber and Gene Myers. 1993. Suffix arrays: A new method for on-line string searches. <i>SIAMJournal</i> <i>ofComputing, </i>22(5):935-948.</p><p>Daniel Marcu. 2001. Towards a unified approach to memory- and statistical-based machine translation. In <i>Proc. ofACL-EACL, </i>pages 378-385, Jul.</p><p>Gonzalo Navarro. 2001. A guided tour to approximate string matching. <i>ACM Computing Surveys, </i>33(1):3188, Mar.</p><p>Franz Josef Och and Hermann Ney. 2003. A system­atic comparison of various statistical alignment mod­els. <i>Computational Linguistics, </i>29(1):19-51, Mar.</p><p>Franz Josef Och and Hermann Ney. 2004. The alignment template approach to machine translation. <i>Computa­tional Linguistics, </i>30(4):417-449, Jun.</p><p>Franz Josef Och. 2002. <i>Statistical Machine Transla­tion: From Single-Word Models to Alignment Tem­plates. </i>Ph.D. thesis, RWTH Aachen, Oct.</p><p>Franz Josef Och. 2005. Statistical machine translation: The fabulous present and future. In <i>Proc. </i><i>ofACL</i><i> Workshop on Building and Using Parallel Texts, </i>Jun. Invited talk.</p><p>Chris Quirk, Arul Menezes, and Colin Cherry. 2005. De­pendency treelet translation: Syntactically informed phrasal SMT. In <i>Proc. of ACL, </i>pages 271-279, Jun.</p><p>Mohammad Sohel Rahman, Costas S. Iliopoulos, Inbok Lee, Manal Mohamed, and William F. Smyth. 2006. Finding patterns with variable length gaps or don't cares. In <i>Proc. </i><i>ofCOCOON,</i><i> </i>Aug.</p><p>Michel Simard, Nicola Cancedda, Bruno Cavestro, Marc Dymetman, Eric Gaussier, Cyril Goutte, Kenji Ya-mada, Philippe Langlais, and Arne Mauser. 2005. Translating with non-contiguous phrases. In <i>Proc. of</i> <i>HLT-EMNLP, </i>pages 755-762, Oct.</p><p>Peter van Emde Boas, R. Kaas, andE. Zijlstra. 1977. De­sign and implementation of an efficient priority queue.</p><p><i>Mathematical Systems Theory, </i>10(2):99-127.</p><p>Richard Zens and Hermann Ney. 2007. Efficient phrase-table representation for machine translation with appli­cations to online MT and speech translation. In <i>Proc.</i></p><p><i>ofHLT-NAACL. </i>To appear.</p><p>Ying Zhang and Stephan Vogel. 2005. An efficient phrase-to-phrase alignment model for arbitrarily long phrase and large corpora. In <i>Proc. ofEAMT, </i>May.</p></references></body></article>