Hierarchical Phrase-Based Translation with Suffix Arrays
Paper · 2007 · Adam Lopez
Summary
A translation system can learn a rule from words that regularly occur together even when those words are separated by other text. The intervening words can be translated separately, and their translations can be moved to different positions in the output. This flexibility makes the rules useful and makes them difficult to retrieve. An index can quickly find every occurrence of an uninterrupted phrase. A phrase with gaps calls for a different operation: finding where its pieces occur in the right order, near enough to one another, in the same sentence. Adam Lopez studies how to perform that operation as each input arrives, a practical problem for statistical machine translation.
The paper keeps the aligned training sentences in memory and uses a suffix array, an index that sorts the starting positions of text by what follows them. Searches for uninterrupted phrases use this ordering directly. Searches for gapped phrases depend on how common their pieces are. The system prepares the most expensive combinations in advance, searches selectively in a large list when its partner list is small, and scans the lists together when that is cheaper. A prefix tree, which gives patterns with the same beginning a shared path, helps the system avoid impossible searches and reuse the locations it has already found. Longer gapped phrases can frequently be located by overlapping two shorter gapped phrases whose occurrences are already known.
To measure translation speed, the experiments use the first 50 sentences from the NIST 2003 test set for Chinese-to-English news translation. The sentence-based baseline takes 2241.25 seconds per sentence for collocation lookup. The combined method takes 40.77 seconds per sentence with a fresh prefix tree for each input, and 30.70 seconds when the tree is retained across inputs. Those measurements cover lookup after startup. The paper separately puts decoding at approximately 10 seconds per sentence under moderately aggressive pruning, so finding rules still takes substantial time even after the improvement.
The result is about access to translation rules. It shows how an aligned corpus can serve as a practical source of hierarchical rules under the tested settings, without requiring a table containing every extracted rule. The comparison also explains why a fast index for uninterrupted text is only part of the solution. A small set of common patterns accounts for much of the lookup cost, while the large number of overlapping queries creates opportunities to avoid work altogether. The experiments measure the gains from exploiting both properties. Translation quality and the value of using the retrieved examples to calculate new contextual features remain open questions.
Deep dive: Hierarchical Phrase-Based Translation with Suffix Arrays
How suffix arrays, selective precomputation, and fast intersections make it practical to retrieve hierarchical translation rules with gaps. · about 39 minutes to read
The problem and its context
Why the rule inventory becomes an engineering problem
A phrase-based system learns from texts paired with their translations. Word alignments indicate which positions on the source side correspond to positions on the target side. From those links, an extraction procedure can identify larger spans that work as translation units. A source phrase may have several plausible target phrases, and evidence from the corpus gives the system a way to score those choices. The decoder, the part of the system that assembles a translation, needs access to the choices that apply to its current input. This is the setting of Statistical Phrase-Based Translation.
The amount of evidence is part of the difficulty. According to the paper, parallel corpora contain tens or hundreds of millions of words, and even conservative extraction rules can yield inventories with millions of entries. Each additional source of training text can add occurrences of phrases already known and introduce new phrases or translations. The decoder needs only a portion of that inventory for a particular sentence, but obtaining that portion efficiently depends on how the whole collection is represented. The paper mentions web-mined and comparable corpora as reasons to expect the demand for scalable rule access to continue.
One common response was to filter the rule inventory for a known test set. If all inputs are available before translation starts, the system can retain only entries whose source sides could occur in those inputs. The approach fits a batch experiment. A service that receives its next sentence after it has started has a different access problem. Tight limits on phrase length also keep the inventory smaller, at the cost of excluding longer spans that the training data might support. A third approach, described in work by Zens and Ney, stores a large phrase table on disk in a prefix tree so that a system can retrieve entries even when the complete table exceeds available memory.
Callison-Burch and colleagues, and independently Zhang and Vogel, put the corpus itself at the center of the representation. They retain aligned texts and use a suffix array on the source side. When a sentence arrives, they find training occurrences of its phrases, consult the alignments to extract target phrases, and score the resulting pairs. A phrase table records the outcome of extraction in advance. A corpus index preserves the evidence from which the outcome can be produced at query time. The latter arrangement is the starting point for Lopez's work.
What changes when a phrase can have gaps
An ordinary phrase pair ties a consecutive sequence on one side to a consecutive sequence on the other. A hierarchical rule can specify some words directly and reserve slots for spans translated by other rules. A slot can occur in a different relative position on the target side. A single rule can therefore express a recurring arrangement of words while leaving part of its content to another rule. The decoder can apply that arrangement to different spans without requiring a separately memorized phrase pair for each complete string.
The paper situates this form of discontiguity among several approaches, including Dependency Treelet Translation and the work on non-contiguous phrases by Simard and colleagues. Lopez takes the rule formalism from Chiang, who had reported an advantage over phrase-based translation. In the comparison Lopez describes, the hierarchical inventory includes the corresponding contiguous rules and adds rules containing gaps. The resulting inventory is an order of magnitude larger. Both the larger inventory and the new shape of its entries matter for retrieval. The treatment here follows Hierarchical Phrase-Based Translation.
A suffix array works particularly well when a query specifies all the words from its starting position up to the end of the requested phrase. Every matching suffix begins with that exact sequence. Sorting suffixes places those matches together, so one interval can describe them. A gapped query specifies the beginning and then leaves some later positions open. The unspecified words affect the order in which those suffixes are sorted. Among suffixes with the right beginning, those that also contain the later required words at allowed offsets can be scattered throughout the interval.
This changes the work the index must support. Finding where each fixed piece occurs is still straightforward. Determining which occurrences belong together adds a separate computation. The pieces need to start in a single sentence, appear in the required order, leave enough room for each gap, and fit inside the permitted span. Lopez calls this the collocation problem. Here collocation means a set of occurrences satisfying those positional conditions. It refers to an exact decision about locations, even though some of the words at those locations are unconstrained.
What the paper sets out to retrieve
The input to the problem is a sentence to translate, together with a corpus from which rules can be obtained. The desired source patterns are those that could apply to that sentence under the hierarchy's extraction constraints. Each pattern that occurs in the training text can lead to target-side evidence through the alignments. Corpus matching and rule extraction are thus different stages. A source match supplies a place to inspect. The target text and its alignment determine what bilingual rule evidence can be extracted there.
The paper's main contribution is to organize the source-side work. It draws on variable-length gap matching for the baseline and on set intersection for a faster alternative. It also uses a fact specific to translation: the queries come in families. The system needs a short phrase and many extensions of it, often within the same input. A procedure designed to answer one isolated text query would miss the opportunity to use the short phrase to make the longer searches cheaper. The paper treats the order of those searches as part of the algorithm.
The method, step by step
Keep the evidence and index the source words
The system loads the source training text, its suffix array, the target training text, and the links between their word positions. A suffix of a text begins at a word position and continues through the remainder of the text. To store a suffix in the index, the system needs its starting position. The words themselves are already in the corpus. In lexicographic order, two suffixes are compared by their first words, then by the subsequent words needed to decide their order.
SA_T is a lexicographically ordered permutation of [1, |T|].
Here T is the indexed text, |T| is its length in words, and SA_T is its suffix array. The bracketed interval denotes the starting positions from 1 through |T|. A permutation contains each position once. Lexicographic ordering sorts those positions by the suffixes they identify.
To locate a contiguous phrase, the system uses binary search to find the boundaries of the run of suffixes that start with that phrase. The boundaries identify every matching start without copying its position into a new array. This distinction matters when a short phrase occurs extremely often. Finding the boundaries can be fast even when reading every position inside them would be expensive.
O(m + log |T|)
Here O gives an asymptotic bound on the growth of the work, m is the number of words in the query phrase, and |T| is the indexed text length. log denotes a logarithm, and + combines the contributions of query length and corpus size. The bound concerns locating the range of a contiguous match in the suffix array. Visiting the occurrences represented by that range is a further operation.
The paper notes that auxiliary structures can improve the lookup bound to dependence on the query length alone. Lopez considers the ordinary bound practical for the corpus at hand, for which the paper gives log |T| as roughly 25. The pressing cost comes from consulting the positions inside occurrence lists when the pattern has gaps.
O(m)
Here O again denotes an asymptotic bound, and m is the number of words in the contiguous query. This is the bound cited for lookup with auxiliary structures. The paper's design addresses a stage beyond this contiguous lookup.
Define which patterns count as possible rules
A hierarchical rule states what a source span looks like and how to render it on the target side. Words explicitly listed in a rule are called terminals. A nonterminal is a slot into which another derivation fits. This formalism synchronizes the source and target expansions, so a slot on the source side has a corresponding slot on the target side. The underlying formalism is a synchronous context-free grammar.
X → α/β
Here X is the rule's nonterminal category, and → introduces its expansion. The sequence α is the source side and β is the target side, with / separating them. Each sequence can contain both terminals and nonterminals. The two sides contain equal numbers of nonterminal occurrences, and corresponding occurrences are given the same index.
X → uX₁vX₂w/u′X₂v′X₁w′
Here X to the left of → names the category being expanded. The symbols u, v, and w are source word sequences, and u′, v′, and w′ are target word sequences. The prime marks distinguish the target sequences. X₁ and X₂ mark separate slots of the same category, with the subscripts pairing each slot across /, the source–target separator. The target side places the translation from X₂ before the translation from X₁. Some of the word sequences around the slots can be empty.
The positions of those slots explain why retrieving a hierarchical rule starts with a gapped query. A source match for a rule specifies the terminals and reserves spans for the slots. The canonical source representation fixes the order of the slot indices, so discussion of source lookup can omit the indices. That omission is convenient for search. The target side still needs the correspondence when the rule changes the order of the filled slots.
Lopez uses Chiang's restrictions on corpus-extracted rules. A rule can contain at most two nonterminals and at most five terminals, and it can span at most ten words. A nonterminal must cover at least two words. On the source side, two nonterminals cannot be adjacent. The distinction between terminal count and span is important. The terminal count concerns the words named by the pattern. The span includes the words absorbed by the slots.
1 ≤ |uvw| ≤ 5
Here u, v, and w stand for the fixed sequences used in a source pattern, and uvw denotes their concatenation. The vertical bars count the terminals in that concatenation. The ≤ signs give an inclusive lower bound of 1 terminal and upper bound of 5. For patterns with fewer fixed pieces, the unused sequences make no contribution to the count.
|v| > 0
Here v is the fixed sequence between the two gaps of uXvXw. The bars count its words. The > sign and 0 specify that the intervening fixed sequence has to be present, enforcing the rule against adjacent source slots.
The central search cases are an uninterrupted string u, a one-gap string uXv, and a two-gap string uXvXw, where each X is a slot. The grammar also allows slots at the edges. A leading or trailing slot adds a possible rule structure without adding another fixed word to locate in the corpus. The enumeration scheme makes use of this by sharing location information between patterns that have the same fixed material.
Retrieving hierarchical translation rules from aligned text
The steps in order.
Establish a baseline for collocation
Consider a source pattern with fixed words a, b, and c, separated by gaps, written aXbXc. A suffix beginning with a is a candidate. It matches only if positions for b and c can be chosen with legal gaps and within the phrase span. Several suffixes beginning with a may be adjacent in sorted order, but the words inside their gaps can vary. Their lexicographic positions tell the system little about which of them meet the later requirements. The paper illustrates this with matching suffixes interspersed among unsuccessful candidates.
The straightforward strategy is to use the suffix array to obtain the interval for each fixed piece. Then it visits the occurrences and combines them subject to the gap constraints. Lopez describes an algorithm by Rahman and colleagues that uses a stratified tree for this second stage. The tree supports inserting a position and locating the next eligible position in a way that is efficient in the size of the position space. The pattern and its occurrence counts provide the quantities needed to express the cost.
w₁Xw₂X…Xwᵢ…Xwᴵ
Here each wᵢ is a contiguous piece of the query and X separates pieces with a variable-length gap. The indices give the source order, from the initial w₁ through the final piece, written wᴵ to denote the piece indexed by I. The ellipses stand for intervening pieces and their gaps. I is the total number of pieces.
O(log log |T|)
Here O denotes an asymptotic bound, |T| is the number of words in the indexed text, and log log means a logarithm applied to a logarithm. The paper gives this cost for each insert or next-element operation in the stratified tree. It is a per-operation bound.
O(Σᵢ [|wᵢ| + log |T| + nᵢ log log |T|])
Here Σᵢ adds the bracketed costs for pieces indexed from 1 through I. The length |wᵢ| belongs to contiguous piece wᵢ, nᵢ is the number of times it occurs, and |T| is the text length. The first two terms give the suffix-array lookup cost for that piece. The product nᵢ log log |T| describes the cost associated with processing its occurrences in the collocation procedure. O and log have their asymptotic and logarithmic meanings, and the plus signs add the terms.
Lopez builds a baseline adapted to sentence-aligned text. For each partial match, the procedure places its position in a bucket associated with its sentence identifier. It then takes the occurrences of the next fixed piece, uses each occurrence's sentence identifier to retrieve the relevant bucket, and checks its positions against the allowed window. Two occurrences in different sentences can be excluded as soon as their identifiers differ. Within a bucket, the procedure still has to check that the positions are in the right order and meet the distance constraints.
This arrangement has a favorable case when each sentence contributes very few positions for a given piece. It also has a clear worst case. If every relevant location ends up in the same bucket, the procedure can have to consider every combination. The corpus supplies the useful partition. The hashing step alone cannot guarantee how evenly the positions will be distributed.
O(Σᵢ [|wᵢ| + log |T|] + Πᵢ nᵢ)
Here Σᵢ sums over piece indices 1 through I, and Πᵢ multiplies across the same indices. Each |wᵢ| measures a piece's length, each nᵢ counts its occurrences, and |T| measures the text. The sum inside O accounts for locating the component intervals. The product expresses the combinations that may have to be checked in the worst case, and log denotes a logarithm.
O(Σᵢ [|wᵢ| + log |T| + nᵢ])
The symbols again refer to the pieces wᵢ, their counts nᵢ, and the text length |T|. The sum Σᵢ runs from 1 through I, + adds costs, log is a logarithm, and O describes how the work scales. Lopez argues that this behavior is representative for large occurrence sets in actual language data because most patterns occur once in a sentence when they occur there. Even in this favorable case, work on a frequent piece grows with its number of occurrences.
Do the most expensive recurring work in advance
The expensive searches involve common component patterns. When both components are common, each side supplies a long list and there is little advantage in choosing the smaller list as a guide. The paper's answer is to compute selected collocation lists during startup and store the positions. The selection matters. Frequency is highly uneven, so the expensive cases are concentrated among a relatively small collection of pattern types, a property the paper describes through Zipf's law.
The inputs to this stage include a ranked list of frequent contiguous patterns. The paper identifies the patterns offline using a longest common prefix array, an auxiliary structure associated with the suffix array. It gives information about the shared beginnings of neighboring suffixes. A traversal can identify frequent sequences for the list, and the runtime system can use that list after discarding the auxiliary structure. The candidates include sequences of adjacent words of several lengths, each called an n-gram.
During a pass over the source corpus, the algorithm adds each occurrence of a selected pattern to a queue, together with its identity and position. An older entry stays in the queue while a subsequent occurrence can still combine with it within the allowed phrase span. When the scan moves beyond that window, the procedure computes the entry's valid collocations with later patterns and removes it. It processes the remaining entries at the end of the sentence and clears the queue. The window limits the comparisons, and the sentence boundary ensures the stored occurrences are usable as source-side evidence.
For a pattern with a single internal gap, the precomputation stores positions when both fixed pieces belong to the frequent list. Two-gap patterns create a related problem. A partial pattern that already contains a gap can itself be frequent and costly to combine with another frequent piece. The paper observes that its very common one-gap patterns are made from pieces near the top of the frequency list. It uses this observation to cover expensive combinations of a common gapped prefix and a common final piece, as well as the corresponding case with the gapped partial pattern on the right. The especially common pieces used to identify those partial patterns are unigrams.
The stored items are locations of matching source patterns. This is a narrower use of precomputation than storing scored bilingual rules for every possible source query. When a matching source pattern is requested, the target extraction step can still consult the corpus and alignments. The representation thus keeps the work that is especially expensive to repeat while retaining access to the instances for later steps.
Use the smaller list to direct an intersection
If one of the occurrence lists is considerably shorter, a different calculation makes sense. A linear merge advances through the lists in position order and can spend much of its time traversing the larger one. A binary search can jump to the vicinity of a position from the smaller list. The paper adapts a method called double binary search, due to Baeza-Yates, for this purpose.
Begin with the middle position in the smaller list. Search for it in the larger list. The result supplies a division of the larger list whether it finds the position or places it between entries. The median divides the smaller list as well. Positions below the median can be compared with the corresponding lower portion of the larger list, and positions above it with the upper portion. The algorithm repeats the process on these smaller pairs. The division means that successive searches can work with smaller ranges of the larger dataset.
The description starts from ordinary set intersection, where a location qualifies by appearing in both sets. Collocation adapts the test to the relation between positions. In a query made by placing two fixed pieces around a gap, the later position must fall within the allowed distance from the earlier piece. In a query assembled by overlapping shorter phrases, the alignment of the subpatterns can prescribe an exact offset. Lopez notes that these positional tests require modifications to the set intersection procedure. The detailed adaptation and proof are given in a separate technical report.
|Q| log |D| < |D|
Here Q is the smaller query set, D is the larger dataset, and the vertical bars count their elements. log |D| expresses the logarithmic search term in the larger set. Multiplication by |Q| gives the comparison term on the left, and < compares it with the size of D on the right. The paper gives this condition for a guarantee of sublinear performance relative to scanning the larger set.
λ|Q| log |D| < |D|
Here Q, D, the cardinality bars, log, and < have the same meanings. The symbol λ is a tunable multiplier on the search term. The implementation uses this inequality to decide when to try double binary search. The paper reports 0.3 as a good value for λ in its experiments. The decision is applied to recursive pairs as well as to the initial lists, so a branch can use a merge after the initial divisions change the balance of their sizes.
For two short lists, a merge provides a simple way to find the valid combinations. The same operation serves as the fallback when the inequality favors scanning. The decision thus depends on both absolute frequency and relative size. Two rare lists can still be uneven enough that binary search helps. Two frequent lists with many comparable entries are the cases for which the separate precomputation is especially useful.
Put occurrence lists in position order
The suffix array orders occurrences by the text following their starts. Double binary search and merging require an order by the starts themselves. For a phrase whose occurrences are represented by an interval, the entries in that interval may point to positions anywhere in the corpus. Converting the interval into a position-sorted list has a cost of its own. If a fast intersection has to begin by sorting a large list afresh, this preparation can dominate the whole operation.
One option is to store the numerically sorted list for every word and every contiguous phrase length in advance. This is a mapping from each pattern to the positions where it occurs, an inverted index.
n|T|
Here n is the maximum contiguous phrase length covered by the full indexing scheme, and |T| is the number of positions in the text. The product represents the paper's storage cost in array entries for keeping a length-|T| array for each phrase length up through n. The estimate illustrates why indexing every length has a larger memory cost than indexing unigrams alone.
Lopez's implementation prepares the index only for unigrams. Their lists include the very long ones that would be costly to reorder repeatedly. For bigrams and longer phrases, the system obtains the occurrences from the suffix array and uses a stratified tree to produce a sorted set when the need arises. After constructing the set, it can attach it to the cached information for that phrase. The one-time cost can then serve several intersections that use the phrase.
O(n log log |T|)
Here n is the number of items being inserted into the stratified tree, |T| is the text length, and log log denotes a logarithm of a logarithm. O gives the asymptotic bound. In this expression n counts positions in one operation, whereas in the preceding storage expression it denotes the maximum indexed phrase length. The extra factor on n is why the cost of building sorted input can offset a sublinear intersection on its first use.
There are distinct kinds of reuse here. Precomputation selects expensive collocations before the input sentence is known. A prebuilt unigram index stores individual position lists. A longer phrase can acquire a sorted list on demand once its corpus interval is known. The paper combines the startup pass used for the unigram index with the pass for the other precomputations. At query time, the value of an on-demand list depends on how frequently it will be consulted. The enumeration procedure supplies that repeated use.
Search shorter patterns before their extensions
A sentence gives rise to many overlapping patterns. Extending an existing source phrase by one terminal may generate several new queries, and a single shorter pattern may be a component of several longer ones. Lopez starts with an observation from Zhang and Vogel's method for contiguous phrases. If a phrase formed by extending u with the word a occurs, u must occur as well. In the suffix array, the range for ua lies inside the range for u. If the search for u succeeds, it gives a smaller region in which to search. If it fails, every such extension can be dropped.
A corresponding test applies at the other end. The contiguous phrase aub requires both its longest proper prefix au and its longest proper suffix ub, where a and b are words and u is the material they surround. The prefix interval sets the range for binary search. The suffix gives an existence check. If ub has already been searched for and was absent, there is no need to look for aub. This makes search order valuable even for a contiguous candidate whose prefix has matches.
For a gapped phrase, the known prefix and suffix can provide the actual locations from which to compute the extended pattern. Consider abXcd, with fixed words a, b, c, and d and one gap X. A direct search combines occurrences of ab and cd and tests whether their separation is permitted. The longest proper prefix abXc and suffix bXcd each contain more of the final pattern than those two independent pieces do. If the shorter gapped phrases have already been located, the new search can use their occurrence lists.
At a valid match, those two partial phrases agree on the shared material bXc. The suffix begins one word after the prefix. The overlap supplies a specific positional relationship to check, in place of a search over the full range of possible distances between ab and cd. The more specific partial patterns are also likely to have fewer locations. The savings come from both effects: the intersection works with more selective evidence, and the test for a legal combination is simpler.
The minimal pattern with a gap between two single words is a special case. Its maximal subpatterns provide the words on the two sides while leaving the gap unresolved. The lookup still has to determine whether the fixed occurrences fit a legal window. The method therefore uses the available structure of each query: window-based collocation where a gap first has to be established, and exact overlap where previously found subpatterns supply enough information.
Track successful patterns and failures in a prefix tree
A prefix tree represents a pattern by the labels on a path from the root. Patterns with the same beginning share the initial edges. In the translation system, a node records whether its pattern was found. An active node has at least one training match. It can retain the suffix-array interval for a contiguous phrase or the list of matching positions for a gapped one. It can also retain extracted rules. An inactive node records a failed search and allows future queries to use that information.
A suffix link gives access to the path that remains when the first symbol of a node's pattern is removed. The link points to a shorter pattern within the tree. For a candidate obtained by extending a parent with a final word, the parent gives the maximal prefix. To find the maximal suffix, the procedure follows the parent's suffix link and then follows the edge with the candidate's final word. Both dependencies can therefore be read from the same tree, even though they are reached by different paths.
For abXcd, the parent represents abXc. Following the parent's suffix link reaches bXc. The edge labeled d reaches bXcd, the maximal suffix. If the suffix is inactive, the candidate is inactive too. When both subpatterns are active, the procedure combines their position information. It can read a precomputed answer where one is available, or choose an intersection procedure for the lists. A successful result is stored at the new node. An empty result again produces an inactive node.
The tree grows in passes ordered by terminal count. Each pass takes a frontier of patterns to process. A successful pattern can contribute extensions containing one more terminal to the next frontier, subject to the grammar's constraints. An inactive node stops exploration of its descendants. Visiting shorter patterns first also makes their existence and location information available for the maximal-suffix check. The prefix tree already used to encode Chiang's grammar gives Lopez's implementation a place to retain this information.
The tree can be local to a sentence or can persist across inputs. Within a sentence, several queries can lead to the same path or need evidence stored at it. Across sentences, the same words and patterns can recur, allowing the system to reuse their corpus locations and potentially the rules extracted at those locations. The implementation compares a configuration that discards each sentence's tree with one that keeps the tree across the timed inputs.
Reuse fixed-word locations for slots at the edges
A pattern that begins with a slot requires its own path even though the slot adds no fixed word at the beginning. For example, Xu has the same fixed material as u. The paths that begin by following the root's X edge form what the paper calls the shadow subtree. A path in that subtree can be extended when its corresponding suffix is active. It inherits the suffix's location information.
A pattern that ends in a slot can obtain its locations from its parent. Once a pattern has been found, the algorithm can append an X edge if the grammar permits the extension. Its child inherits the parent's locations. For XuX, both edge cases apply. The fixed material can be found once while the tree still represents the distinct rule structures that use it. Inheriting locations concerns where the terminals are anchored. The grammar's restrictions still govern the spans and rule forms considered in extraction.
This treatment also applies to patterns that already contain an internal gap. XuXv and uXvX use the same locations for their fixed material as uXv. Preserving separate paths allows extraction to distinguish the possible placements of the slots. Sharing positions allows search to exploit the common evidence.
Extract and score rules from the training instances
With source locations in hand, the system can consult the target training text and the word alignments. The earlier suffix-array procedure reviewed in the paper uses the phrase extraction method of Koehn and colleagues to obtain aligned target phrases. A source occurrence is a place to apply those alignment checks. Relative frequencies then score competing target phrases for a given source phrase, and lexical weighting provides a score based on the word alignment.
p(ē | f̄) = count(ē, f̄) / count(f̄)
Here f̄ is a source phrase, ē is a target phrase, and p(ē | f̄) is the relative-frequency score for that target phrase given the source. The vertical bar means “given.” The function count measures occurrences, with the comma in count(ē, f̄) indicating the joint count of the extracted pair. The denominator is the marginal count of the source phrase, / denotes division, and = defines the score. The suffix-array procedure reviewed by Lopez uses the best-scoring alignment when assigning the lexical weight.
The paper also explains how earlier systems bounded the work of extracting rules from a very common contiguous phrase. They sampled its occurrences when the total exceeded a chosen limit. Callison-Burch and colleagues and Zhang and Vogel reported that a sample size of 100 gave translation performance close to using all occurrences in their experiments. This result belongs to the earlier contiguous-phrase work. In Lopez's lookup problem, discovering the valid locations of a gapped pattern can already be expensive before a sample of bilingual evidence can be drawn. The collocation algorithms address that earlier cost.
Training for the experiments supplies the paired texts and their alignment. GIZA++ produces alignments in both directions, and the grow-diag-final heuristic combines them. The corpus and source indexes can then be loaded together with the alignment data. The timing comparisons vary how the system finds and reuses source positions, while this basic route from aligned training evidence to translation rules stays in place.
Experiments and results
Corpus, test inputs, and timing conditions
The experiments use news-domain translation from Chinese to English.
More than one million sentences drawn from several newswire corpora make up the training material. The source side contains 27M words. Lopez describes the corpus as roughly the same as the one used in the large-scale Hiero experiments. Bidirectional GIZA++ alignments were symmetrized with grow-diag-final, the procedure that combines the directional alignment links. The relevant earlier system study is The Hiero Machine Translation System.
For timing, the first 50 sentences from the 2003 NIST Chinese–English test set are used. The algorithms were implemented in Python 2.4. According to the paper, each machine ran Red Hat Linux 2 and had 8 GB of memory and four 3 GHz Xeon processors.6.9. Startup, including the time to load the data structures, is outside the table's timings. The measurements describe query processing with the structures available for use.
The comparison uses two metrics. The first is processing time in seconds per sentence for the collocation lookup work. The second is the number of collocation computations performed across the timing run. The timing measures work at the sentence level, while the count describes how frequently the algorithm carried out the operation of combining source-pattern locations. A further measurement ranks individual computations by their cost to show how the total time is distributed.
The baseline is Lopez's sentence-bucket algorithm. It first obtains occurrences of the fixed pieces through the suffix array and then compares locations that share a sentence identifier. Rahman and colleagues' algorithm is discussed and analyzed as a general method for variable-length gaps. The table's baseline measurement comes from the sentence-aware implementation. That distinction matters when reading the reported runtime: the comparison begins with an implementation already exploiting a useful property of parallel training data.
Time and amount of lookup work
With the baseline, collocation computation averages 2241.25 seconds per sentence. The prefix tree brings this to 1578.77 seconds per sentence. Adding precomputation to the prefix tree gives 696.35 seconds per sentence, while adding double binary search to the tree gives 405.02 seconds per sentence. The precomputation runs use the 1000 most frequent patterns. In the combined configuration, the prefix tree, precomputation, and double binary search give 40.77 seconds per sentence. Retaining the tree across sentences gives the lowest reported time, 30.70 seconds per sentence.
Collocation lookup time per sentence on the first 50 NIST 2003 Chinese–English test sentences
Combining precomputation with double binary search gives the fastest lookup when the prefix tree is retained across inputs.
The numbers
| System or setting | seconds per sentence |
|---|---|
| Sentence-bucket baseline | 2241.25 |
| Prefix tree | 1578.77 |
| Prefix tree with precomputation | 696.35 |
| Prefix tree with double binary search | 405.02 |
| Prefix tree with precomputation and double binary search | 40.77 |
| Prefix tree with full caching, precomputation, and double binary search (this paper) | 30.70 |
The prefix tree reduces the count of collocation computations from 325,548 for the baseline to 69,994 on the same test inputs. That count holds for each configuration that builds a fresh tree for each sentence, including the combined configuration. With full caching across sentences, the count is 67,712. The count helps distinguish two sources of improvement. Enumeration changes the amount of work requested. Precomputation and double binary search change the cost of doing that work.
Collocation computations across the first 50 NIST 2003 Chinese–English test sentences
Prefix-tree enumeration accounts for the main reduction in computation count, with a further reduction from caching across inputs.
The numbers
| System or setting | collocation computations |
|---|---|
| Sentence-bucket baseline | 325,548 |
| Prefix tree | 69,994 |
| Prefix tree with precomputation | 69,994 |
| Prefix tree with double binary search | 69,994 |
| Prefix tree with precomputation and double binary search | 69,994 |
| Prefix tree with full caching, precomputation, and double binary search (this paper) | 67,712 |
The paper gives approximately 10 seconds per sentence as a decoding reference point, using Chiang's Python implementation with moderately aggressive pruning. The lookup metrics concern a separate stage. The optimized lookup approaches the scale of decoding far more closely than the baseline does, which supports the feasibility claim. A reader comparing systems should keep the reported intervals separate. The 30.70 seconds per sentence for the best lookup setting covers the collocation work, and the decoding figure describes the decoder under the stated pruning conditions.
Why frequent patterns matter at this scale
The source corpus has unigrams with counts of 1.48M, 1.16M, and 688K for the most frequent, next most frequent, and third most frequent words. Lopez uses the counts to illustrate the difference between locating a suffix-array interval and inspecting locations. The paper estimates that the contiguous lookup example involving those common words needs no more than 25 comparison operations. For a one-gap query bounded on both sides by the most frequent word, the cited worst-case estimates are over two million operations for the sentence-based method and over thirteen million for the method of Rahman and colleagues. These are operation-count illustrations, distinct from the measured seconds per sentence.
One common word in an input can be involved in up to 530 hierarchical rules under the paper's account. Its cost can therefore recur across many collocation requests even when the word appears in a single input position. The paper also gives an indication of how many requests the rule formalism generates. When input sentences averaged 29 words, the average counts for phrases of up to five words were 133 for contiguous phrases and 7,557 for hierarchical phrases. Those figures describe applicable source patterns under the respective counting rules. The signed bilingual rules extracted from the corpus depend on what target evidence those patterns yield.
The memory figures put the timing gains in the context of the proposed representation. Lopez estimates around 500MB for the core corpus structures for the 27M-word source corpus, using 32-bit integers and treating the alignment and target arrays as roughly comparable in size to the source array. The unigram index increases that estimate by 20%. The total then depends on how many frequent collocation lists are stored. Including the trigram component trained on the bitext and Chinese Gigaword, the reported overall storage is approximately 2GB. These figures describe the system's storage requirements and the assumptions behind the estimate.
4|T|
Here |T| is the source corpus length in words, and 4 accounts for the source text, source suffix array, target text, and alignment arrays in the paper's approximation. The product estimates the number of array entries under the comparable-size assumption. The estimate in bytes additionally depends on the representation of each entry.
What the ablations show
The prefix tree reduces the number of searches
The contrast between the baseline and the prefix tree shows how much work disappears when queries are considered in relation to one another. The baseline finds fixed pieces and joins them for the queries it processes. The prefix tree can use a failed lookup to rule out extensions, and it can carry a successful location set forward to any later query that needs it. The comparison also includes the use of maximal prefixes and suffixes to form more selective overlaps. Those changes belong to the enumeration procedure tested as a group.
With the prefix tree alone, the run performs 69,994 collocation computations, compared with 325,548 in the baseline. Its time is still 1578.77 seconds per sentence. The large drop in the operation count and the remaining cost are consistent with the paper's profile of individual computations: a comparatively small fraction accounts for much of the runtime, and the expensive ones involve frequent pieces. Removing many requests can leave some costly joins in the workload. Conversely, the count alone gives each request the same weight even when one completes quickly and another takes several seconds.
Figure 1 orders computations by cost and shows their cumulative time. Its central observation explains the selection of methods in the ablation. The remaining performance problem after enumeration is the treatment of the long lists behind the expensive requests. This is a stronger account than attributing runtime to the overall number of candidate phrases. Candidate volume explains the value of the tree, while the ranked profile points to which of the surviving requests call for a different algorithm.
Precomputation and double binary search address different workloads
The prefix tree with precomputation takes 696.35 seconds per sentence. The tree with double binary search takes 405.02 seconds per sentence. Each run has 69,994 collocation computations according to the table, the same count as the tree alone. The differences in time therefore support the claim that the handling of locations matters even when the enumeration procedure supplies the same workload. A stored answer changes the cost of answering a query with two common components. A search guided by a small list changes the work required when a rare component is paired with a much more frequent one.
With both techniques added to the tree, the time reaches 40.77 seconds per sentence while the count stays at 69,994. That comparison shows why the techniques were combined. Precomputing expensive combinations leaves on-demand requests for which a merge can still traverse a long list. Faster intersection leaves requests whose lists are long on both sides. The combined configuration has a way to handle each of these cases, as well as a merge for requests where a scan is appropriate. The table evaluates the resulting package on the same input set.
A useful detail is that double binary search is a conditional choice. It is selected from the relative sizes of the current sets, with the same criterion applied to recursive subproblems. The ablation that adds it is therefore a comparison of search strategies that rely on both binary search and merging. Likewise, the precomputation setting concerns the chosen frequency list, including its policy for handling expensive gapped partial patterns. The table assigns measurements to settings as used in the implementation. Finer attribution among the internals of each setting would require further comparisons.
Caching across inputs gives an additional gain
The last comparison keeps precomputation and double binary search in use and changes the lifetime of the prefix tree. With a fresh tree per sentence, the resulting time is 40.77 seconds per sentence and the run records 69,994 collocations. Retaining the tree across sentences gives 30.70 seconds per sentence and 67,712 collocations. Earlier inputs can make later lookups cheaper when they cause the system to request patterns whose location evidence is already stored.
The timing and count measure different aspects of the benefit. The count records how many computations the persistent tree avoids. The timing includes the effect of which computations happen to recur. A repeated slow search has more influence on the time than a repeated short one. The aggregate measurements support a gain from keeping the tree across these inputs. They leave the distribution of reuse, including which recurring phrases account for the gain, unspecified.
The comparison also helps distinguish within-sentence reuse from cross-sentence reuse. Every configuration with a prefix tree can use shorter patterns and cached results as it processes the current sentence. The last configuration adds the ability to use results from previous sentences. Much of the observed improvement is already present with the sentence-local tree and the two collocation optimizations. The additional benefit of full caching is measured on top of that starting point.
Precomputation also spends memory
Figure 3 uses detailed timing information to simulate how changing the amount of precomputation affects processing time and storage. The memory plotted there belongs to the stored collocation lists. The corpus, suffix array, target text, and alignments already have their own storage costs. A common pattern can generate a long list of collocations, so adding a pattern to the scope of precomputation affects memory according to the occurrences and combinations that actually exist in the corpus.
This analysis complements the timed settings, which use a fixed selection of 1000 frequent patterns in the runs with precomputation. The timed experiments show what that choice achieves together with the other optimizations. The figure addresses the effect of varying the storage devoted to the prepared lists. Its scope is the tradeoff for that part of the architecture. Total memory also includes the indexes and any retained query information, and the measured time savings concern the tested corpus.
Limitations
Limits identified by Lopez
Lopez describes the optimized search as relatively slow even after the large improvement. The lookup stage still takes 40.77 seconds per sentence with the combined approach and sentence-local caching, or 30.70 seconds with full caching on the timing set. The reference decoding time is approximately 10 seconds per sentence. The relevant achievement is the feasibility of corpus lookup for gapped rules at the tested scale. The measured costs still matter for a system with demanding latency requirements.
Startup is another cost. The paper says the Python implementation takes several minutes to load its data structures. The timing table begins after this startup work. A long-running system can spread the cost across requests, whereas a short run bears a larger share of it per input. Lopez raises the possibility of compiling the structures into memory-mapped binary files and discusses a C reimplementation under investigation. The speed of such a version is prospective. The reported comparison uses the Python implementation.
The paper also marks a boundary around its treatment of double binary search. The conference account gives the idea, its selection criterion, and the role of sorted sets. The modifications needed to turn ordinary intersection into gap-constrained collocation, together with the correctness proof, are assigned to the technical report. The timing experiment shows the behavior of the implemented search. Readers interested in its exact treatment of the collocation constraints need the more detailed algorithmic account.
The conclusion proposes several applications beyond the benchmark. Retaining the corpus lets the system obtain phrase pairs in context, making contextual features a possibility for discriminative learning. Lopez also suggests searching for training sentences that approximately match the input and using matched parts as larger translation units, with word, phrase, or hierarchical rules to handle differences. These proposals describe what the representation could support. Their effects on translation accuracy remain to be measured.
Limits of the experimental evidence
The timing evidence comes from one language direction and domain, on the first 50 test sentences of NIST 2003. The distribution of frequent patterns in the training data and their recurrence in those inputs matter to the methods. Precomputation is valuable when the costly combinations that it saves are requested. Persistent caching benefits when requests repeat across inputs. The measured gains document the Chinese–English news setting. Performance for other domains, languages, corpus sizes, and request sequences remains open.
The paper measures collocation time and computation counts. A separate translation-quality evaluation would be needed to establish the effect of using this representation on the output of a complete system. Earlier reports about sampling contiguous phrases and the earlier comparison of hierarchical and phrase-based translation each answer a different question. The present experiments determine how quickly the implementation can find the source evidence under the tested configuration. They establish no measured quality gain from new contextual features or from retrieving longer hierarchical phrases.
The demonstration uses Chiang's stated limits on the rule shapes, including the caps on terminals and overall span and the minimum length of a gap. These limits influence how many patterns can apply to an input and how wide the precomputation window must be. The paper argues that an on-demand representation creates room to relax length restrictions. Timings for the expanded search space would depend on the new restrictions, especially where longer spans increase the number of valid collocations that have to be represented or examined.
Several favorable properties concern part of a computation. The sublinear result for double binary search assumes appropriately sorted inputs and a suitable balance in list sizes. Producing a sorted list for a longer phrase can incur a superlinear cost on its first use. Caching can spread that cost over later queries, with the benefit depending on reuse. Read alongside the timing results, the bound explains why certain intersections get cheaper. It is a conditional statement about the intersection step, with preparation and output work contributing separately to the cost of a full request.
The persistent-tree experiment also leaves an operational question for longer streams of inputs. Caching successful patterns reuses work and keeps data associated with their nodes. The first 50 test sentences provide a measured timing gain from persistence, while the memory implications of retaining that information over a longer stream remain unmeasured by this comparison. The storage analysis quantifies the core arrays and the effects of precomputing collocations. A long-running cache would have its own memory behavior, depending on how many distinct patterns are retained and what information the implementation stores at each node.
What came after
The citing work takes up several parts of the setting in which Lopez's contribution sits. Some papers concern the software that consumes translation rules. Others focus on how the evidence for those rules is obtained, what kind of rule inventory is worth searching, or how translation can use examples from a corpus. The connections closest to this paper can be understood by following the path from word alignment through rule retrieval to decoding.
The 2009 Joshua paper presents an open-source toolkit for parsing-based machine translation. Parsing-based translation uses a grammar to organize the assembly of a translation. Lopez's procedure supplies rules for a sentence from an aligned corpus, which addresses an input requirement of that kind of system. Joshua's stated contribution is at toolkit scope. The citation situates efficient rule access within the broader engineering of a parsing-based translator. The relevant work is Joshua.
The 2010 cdec paper describes a framework that brings together decoding, alignment, and learning for finite-state and context-free translation. Those responsibilities put the lookup problem in a larger system. Alignment determines the corpus evidence available for extraction, and decoding uses the resulting rules to build candidate translations. Lopez studies the work between those ends for a particular grammar and source index. The citation connects that focused retrieval problem to the broader set of facilities described by cdec.
The 2009 supervised ITG paper addresses word alignment. Its place in the pipeline is upstream of the source lookup procedure. A suffix-array search returns positions in the source corpus, while the alignment at those positions helps determine what target evidence can be extracted. Changing the alignments can therefore change the eligible bilingual rules even when the same source positions are found. The cited follow-up takes alignment quality as its subject, giving a complementary perspective on the training evidence used in Better Word Alignments with Supervised ITG.
The 2010 work on non-hierarchical phrase-based translation explores accuracy with a different rule formalism. Its connection is to the choice that gives Lopez's search problem its shape. Slots inside hierarchical patterns lead to variable-length gaps and to intersections of occurrence lists. Given a different rule inventory, the retrieval system faces different demands. The citation places the efficient implementation of hierarchical retrieval alongside a line of work investigating what can be achieved with non-hierarchical phrases. That line is represented by Accurate Non-Hierarchical Phrase-Based Translation.
The 2010 paper on convergence between translation memory and statistical translation is close to an application that Lopez raises in the conclusion. A translation memory gives a translator access to earlier bilingual examples. Lopez imagines retrieving training sentences that partly match the new input and reusing matched spans while filling the differences through translation rules. Such a design would use the corpus both as a collection of examples and as evidence for smaller translation decisions. The later work examines the relationship between those approaches in Convergence of Translation Memory and Statistical Machine Translation.
The 2018 paper about retrieved translation pieces also puts previously available translation material to work for a new input. Its stated approach uses retrieved pieces to guide neural translation. The point of contact with Lopez's paper is access to useful material at translation time. In Lopez's system, the retrieved locations lead to corpus-derived rules with explicit terminal sequences and slots. The later paper's focus is the use of retrieved pieces as guidance during translation. The citation links that reuse of translation evidence to an earlier approach to finding it efficiently in Guiding Neural Machine Translation with Retrieved Translation Pieces.
These citations locate the paper's contribution at a specific interface. Aligned corpus data already contain the evidence from which rules can be produced, and a decoder needs the portion relevant to the current input. Lopez shows how to make that selective access practical for hierarchical patterns by exploiting common occurrences, unequal list sizes, and repeated structure across queries. The later works place that access problem alongside the separate tasks of improving alignments, organizing translation software, choosing a rule formalism, and using retrieved evidence to guide translation.
Cite
Cite as Adam Lopez. 2007. Hierarchical Phrase-Based Translation with Suffix Arrays. Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning (EMNLP-CoNLL).
@inproceedings{adam2007hierarchical,
title = {{Hierarchical Phrase-Based Translation with Suffix Arrays}},
author = {Adam Lopez},
booktitle = {Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning (EMNLP-CoNLL)},
year = {2007},
url = {https://aclanthology.org/D07-1104/}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/lopez-2007-hierarchical-phrase-based-translation-suffix/