Massively multilingual translation models sometimes answer in the wrong language. Asked for French, they drift into English or simply copy the German source. The problem gets worse as the search widens: for German-to-French, raising the beam size from 5 to 20 pushes off-target output from 23.1% to 41.4% (Language-Informed Beam Search Decoding). The strongest current fix runs a language-identification classifier inside every beam step. That fix works, but it makes decoding 3.5x to 7.5x slower. We propose a cheaper fix that rests on one observation. Each target language uses only part of the model's shared subword vocabulary, which we call its token alphabet. If the language the model drifts toward is mostly written with tokens outside that alphabet, then blocking those tokens is enough. Blocking can be done with a precomputed bitmask that costs almost nothing per step.
The second half of the idea is a rule for choosing a decoding strategy. A single number computed from monolingual text, the overlap between the target's token alphabet and a competitor language's, predicts before decoding whether the free mask will suffice. When it will not, the system falls back to classifier-guided search. Selecting a strategy per pair without development data is listed as open in Investigating Multi-Pivot Ensembling. Here the deciding variable is the size and overlap of the effective alphabet, the quantity that alphabet-dependent complexity theory treats as decisive.
Core Claim
For a language $\ell$, let $A_\ell$ be the set of vocabulary tokens that appear at least $c$ times in a monolingual sample of $\ell$. Let $p_{\ell'}$ be the token frequency distribution of a competitor language $\ell'$, meaning the source language or English. Define the expressible overlap
$$\rho(t,\ell') = \sum_{v \in A_t} p_{\ell'}(v),$$
which is the fraction of competitor-language text that could still be written after masking to the target alphabet $A_t$. The claim has two parts.
First, decoding with tokens restricted to $A_t$ removes off-target output roughly in proportion to $1-\rho$. It also adds near-zero latency. The mask is fixed per target language, so checking whether a token is allowed is a single table lookup, which is the same mechanism that Trie Automata for Constrained Decoding uses to beat general automaton engines by 7x per step and 29x in serving throughput.
Second, $\rho$ computed offline is a good enough predictor to route each language pair. Low-overlap pairs, such as targets in Cyrillic, Devanagari, or Hangul script, get the mask. High-overlap pairs, such as German to French, get the mask combined with classifier guidance. The predicted outcome is that most of LiBS's off-target reduction is recovered at a small fraction of its cost.
The role of the theory needs to be stated precisely. Symbolic automata over Unicode interval predicates show that what counts is the number of predicates, not the more than $10^6$ code points (Certified Symbolic Finite Transducers). That result supplies our method for building the mask: script membership becomes a handful of interval tests per token, and the mask is compiled once over the vocabulary. The random-DFA result constrains the design. Random automata over larger alphabets become nearly incompressible, with $\alpha_k \to 1$ (The state complexity of random DFAs). This warns against stateful language detectors defined directly over the full vocabulary, so we keep the mask stateless or limit it to a few character classes. We make no complexity-theoretic claim about translation itself. The contribution is empirical and mechanistic.
Research Program
Mask construction. For each FLORES-101 language we build two nested masks. The script mask comes from Unicode script intervals. The token-alphabet mask $A_\ell$ comes from token counts on a monolingual sample of $\ell$, with threshold $c$, run through the model's own tokenizer.
Three kinds of tokens are always allowed so that hard masking does not destroy legitimate content: digits, punctuation, and any token that occurs in the tokenized source sentence. The last exemption lets named entities and numbers be copied. The source-token exemption creates a known leak for source copying, so we measure copying separately.
Overlap atlas. We compute $\rho(t,\ell')$ for every target and two competitors, English and the source language. This gives a map of which directions an alphabet constraint can protect at all. The atlas is a standalone artifact: it is the alphabet-level counterpart to the pivot-selection tables in On the Importance of Pivot Language Selection.
Router. A single threshold on $\rho$ decides between mask-only decoding and mask plus LiBS-style classifier guidance. The threshold is fit on WMT-10 directions and then frozen before any OPUS-100 or FLORES-101 evaluation.
Soft variant. For high-overlap pairs, we also test a soft version that subtracts a log-penalty $\lambda$ from tokens whose frequency ratio strongly favors the competitor. It uses the same lookup mechanism and is tuned once.
Baselines
The naive reference point is standard beam search on the same multilingual model, M2M-100 at 418M and 1.2B parameters, as used in Contrastive Decoding Reduces Hallucinations. It is run with the target-language tag and beam sizes 5 and 20. This shows how bad the curse is for each pair and lets us test whether masks flatten it.
The strongest existing method is Language-Informed Beam Search (Language-Informed Beam Search Decoding). It folds language-identification scores into the beam objective. The paper reports that it lowers the average off-target rate on WMT-10 from 22.9% to 7.7% (+1.1 BLEU) and on OPUS-100 from 65.8% to 25.3%, at 3.5x to 7.5x the cost of standard search.
That paper's base model may differ from ours, so we rerun LiBS on M2M-100 with the same beam sizes, the same test sets, and the same hardware. We tune its interpolation weight on the same WMT-10 directions, with the same budget of trials we give our $c$, $\lambda$, and router threshold. Beating it means one of two outcomes at matched decoding time. Either we match its off-target rate and BLEU within noise at under 1.3x baseline latency, or we get a lower off-target rate on OPUS-100 at equal latency.
The ablation that isolates the key ingredient is the script-only mask. If it performs as well as the token-alphabet mask, then the token-level alphabet adds nothing over Unicode script, and the overlap statistic is unnecessary. A second ablation replaces the $\rho$-router with an oracle that chooses the best strategy per pair on test data. This bounds how much routing loses compared with perfect selection.
Why not just…?
Why not just rerank the final n-best list with a language identifier? This is the most serious cheap competitor, because it costs one classifier call per finished hypothesis rather than one per step. The beam-curse result suggests it falls short: at beam 20, off-target paths crowd the beam (Language-Informed Beam Search Decoding), so for many sentences no on-target hypothesis may survive to be reranked. Contrastive-decoding work also points out that secondary-model reranking is expensive (Contrastive Decoding Reduces Hallucinations). We run reranking as a baseline and report its oracle ceiling, the share of sentences whose n-best list contains any on-target hypothesis. If that ceiling is high, reranking is a real threat, and we would present the mask as a latency improvement over it rather than a quality improvement.
Why not just apply a hard script mask everywhere and skip the overlap statistic? For targets written in a different script than their competitors, this may be all that is needed, and the script-only ablation tests exactly that. It cannot help German to French, where both languages are written in Latin script, and that is the headline failure case. The question is whether token-level alphabets differ enough there to matter. The atlas answers this directly. If $\rho$ is near 1 for all same-script pairs, the token mask adds nothing beyond the script mask, and we will report that.
Why not just use LiBS everywhere? Its cost of 3.5x to 7.5x in latency is the reason. Whether the router saves that cost depends on how many directions fall into the low-overlap regime, and the atlas measures this before any decoding is run.
Why not just fine-tune the model to stop going off-target? That requires training for each model and can shift quality on other directions. Our method needs no training and works with any model. Fine-tuning is complementary rather than competing, so we do not compare against it under our compute budget.
Proposed Experiments
The first decisive check is whether off-target reduction from masking tracks $1-\rho$ across all WMT-10 and OPUS-100 directions. We measure off-target with the same fastText identifier for every method, so the comparison is consistent, though it is a stand-in for true language identity. We report rank correlation and the fitted slope. A weak correlation would refute the routing story even if masks help on average.
The second check is the beam curse. We plot off-target rate against beam size from 5 to 20 for each regime. For low-$\rho$ targets the curve should be flat under masking. For German to French it should be flattened only by the routed or soft variant.
The third check is quality on FLORES-101, measured with spBLEU and COMET over a diverse set of directions with differing and shared scripts. A hard mask must not lower COMET on sentences that were already on-target. We also separately track entity and number copying fidelity and the source-copy rate.
The fourth check is latency: wall-clock time per sentence and serving throughput at batch 256 against plain beam search and our LiBS rerun.
The proposal fails if any of three things happen: the script mask alone matches every gain, $\rho$ does not predict mask benefit, or masking costs more than 0.5 COMET on on-target sentences.
References
- Language-Informed Beam Search Decoding for Multilingual Machine Translation
- Investigating Multi-Pivot Ensembling with Massively Multilingual Machine Translation Models
- Trie Automata for Constrained Decoding over Large Finite Sets
- Certified Symbolic Finite Transducers: Formalization and Applications to String Analysis
- The state complexity of random DFAs
- On the Importance of Pivot Language Selection for Statistical Machine Translation
- Contrastive Decoding Reduces Hallucinations in Large Multilingual Machine Translation Models