Machine Translation

Machine Learning
Type
NLP text-to-text generation task

What does it do?

Machine translation (MT) is a natural-language-processing task that converts text written in one language into another.

Modern systems are neural sequence-to-sequence models, built on the attention mechanism introduced by Bahdanau et al. (2015) and the transformer architecture of Vaswani et al. (2017).

The intuition behind the method

A text in a language you cannot read is closed to analysis until it is translated. Machine translation automates that step. Rather than translating word by word, a neural model reads the whole source sentence, builds an internal representation of it, and generates the target sentence one unit at a time, attending to the most relevant source positions at each step.

History

Machine translation has developed through rule-based, statistical and, more recently, neural approaches. Bahdanau et al. (2015) introduced an attention mechanism that lets the model learn to align and translate jointly, instead of compressing a source sentence into one fixed vector. Vaswani et al. (2017) proposed the transformer, which relies entirely on attention and forms the basis of much current translation work.

When to use it

Choose machine translation when you hold source-language text that must be read or analysed in another language and a trained model covers that language pair. It is a reasonable first step for general-purpose text. For specialised domains such as legal, medical or technical material, plan for fine-tuning and terminology review before relying on the output. Do not use it when no model exists for the required pair, or when the exact wording of the translation is itself evidence and no expert review is possible.

Limitations and considerations

  • Translation is possible only for language pairs the trained model covers, and coverage differs considerably between languages.
  • A general model can produce fluent but inaccurate terminology in specialised domains, so fine-tuning on in-domain text may be needed.
  • Errors can be subtle: a fluent sentence may omit or alter part of the source meaning, which is hard to detect without a reader who knows both languages.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Attention lets the model align each target word with relevant source positions while generating, rather than relying on a single fixed summary of the sentence (Bahdanau et al., 2015).
  • The transformer relies entirely on attention and does not process the sentence through sequential recurrence (Vaswani et al., 2017), so the model can use the context of the whole sentence at once.
  • The output is fluent target-language text that an analyst can read and check directly.

Applications

  • Reading and analysing non-native-language sources in multilingual research.
  • Translating documents or corpora as a preprocessing step before cross-language analysis.
  • Preparing foreign-language text for downstream NLP tasks, with the translation step recorded.
  • Producing domain-adapted translation for specialised text such as legal, medical or technical material, after fine-tuning and terminology review.

How it works

How it works

1

The source text is split into the units the model works with (words or subword pieces, according to the model's vocabulary) and converted into numerical input. The model must already be trained for the source and target language pair. For specialised text, it may first need fine-tuning on in-domain parallel text. Training and fine-tuning both rely on parallel text, that is, aligned sentence pairs in the source and target languages. The amount required varies with the domain and the language pair, so check whether suitable parallel data exists before planning adaptation.

2

An encoder reads the tokenised source sentence and produces a representation for each source position. In the attention model of Bahdanau et al. (2015), the decoder can look back over these positions, so the whole sentence does not have to be compressed into one fixed vector. In the transformer of Vaswani et al. (2017), the encoder applies self-attention across all positions.

3

A decoder generates the target sentence one unit at a time. At each step it conditions on the units already produced and on attention weights over the source representations, so the alignment between source and target is learned rather than fixed in advance. Decoding is often performed with beam search, which keeps several high-probability partial outputs at each step and returns the best complete candidate. Beam search does not guarantee the most probable full translation, because only a limited number of partial candidates are retained.

4

The output is checked against the source for fidelity, meaning whether the content is kept without additions or omissions, and in the target language for fluency. Automatic overlap scores against reference translations are a common complement; the usual ones are BLEU, which measures n-gram overlap with a reference, and chrF, which measures character n-gram overlap. These scores do not capture whether meaning is preserved, so a high score does not establish adequacy. Scores are comparable only when they are computed on the same test set and language pair. Errors in specialised terminology are inspected directly, and fine-tuning is reconsidered if the general model is not accurate enough for the material.

Common pitfalls

  • Applying a general model to legal, medical or technical text without adaptation can produce confidently worded but incorrect terminology.
  • Assuming a language pair is supported because the source language is widely used. Coverage depends on the specific pair, not on the language alone.
  • Analysing translated text as if it were the original, without recording that translation took place, can carry translation errors into later measurements.

Frequently asked questions

What kind of model does machine translation use?

Modern MT uses neural sequence-to-sequence models. The attention mechanism (Bahdanau et al., 2015) lets the model align source and target as it translates, and the transformer architecture (Vaswani et al., 2017), built entirely on attention, underpins current systems.

Do I need a model for my specific language pair?

Yes. A trained model for the source and target language pair must be available. Without coverage for that pair, the system cannot produce usable translations.

Why might translation quality be poor on my texts?

Specialised-domain material often needs fine-tuning. A general model may translate everyday language well but struggle with domain-specific terminology until it is adapted on in-domain text.

Should I trust the output directly?

Check it. Translated output should be evaluated for fidelity to the source and fluency in the target language before it feeds into further analysis, since errors can be subtle.

Related methods

Sources

  1. Bahdanau, D., Cho, K. & Bengio, Y. (2015). Neural Machine Translation by Jointly Learning to Align and Translate. International Conference on Learning Representations (ICLR).

    Open publication reference
  2. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L. & Polosukhin, I. (2017). Attention Is All You Need. Advances in Neural Information Processing Systems (NeurIPS).

    Open publication reference