Machine translation is the computer science task of converting text from one language into another while preserving meaning. It matters because people use it to read websites, communicate across borders, and search information written in languages they do not know. Modern systems do not simply swap words one by one, because grammar, context, and idioms often differ between languages.
Instead, they learn patterns from large collections of translated examples.
Understanding How Machine Translation Works
A translation model first turns a sentence into small units called tokens. A token may be a whole common word, part of a longer word, punctuation, or a special marker. This matters because languages build words in different ways.
A system that only knew complete English words would struggle with names, spelling mistakes, new slang, and long scientific terms. Each token becomes a list of numbers called an embedding.
The numbers do not represent a dictionary definition in a simple way. During training, they become useful signals about how tokens are used near other tokens.
Most modern systems use a transformer. Its attention mechanism helps the model decide which parts of the source sentence matter most at each step. When translating a word with several meanings, attention can connect it to nearby clues.
For example, the English word bank could refer to money or the side of a river. Words elsewhere in the sentence help select the right meaning. Attention is not human understanding.
It is a calculated pattern of numerical weights. Still, it lets the model handle connections across long sentences better than older systems that processed text in a strict left to right sequence.
Training needs many pairs of sentences that people have translated. The model produces a possible target sentence, then compares each predicted token with the known translation. It receives a larger penalty when it gives low probability to the correct next token.
Repeating this process changes billions of internal numerical settings. The system gradually becomes better at predicting likely translations. The data can contain errors, uneven quality, cultural assumptions, or far more examples from one language than another.
Those problems can appear in the output. Languages with less online text often receive less accurate translations because fewer reliable training examples exist.
When a system creates a translation, it predicts one token at a time. A locally likely word can lead the rest of the sentence in the wrong direction, especially when the original sentence is vague. This is why translated text should be checked carefully in medical, legal, safety, and schoolwork settings.
Pay attention to pronouns, negatives, dates, units, names, jokes, and idioms. A translator may produce fluent writing that is subtly wrong.
Students meet these tools in browser pages, subtitles, travel apps, online shops, and chat messages. A useful habit is to compare the translation with the original when possible, then use context and trusted sources to confirm important details.
Key Facts
- Machine translation maps an input sequence x = (x1, x2, ..., xn) to an output sequence y = (y1, y2, ..., ym).
- A tokenizer splits text into words, subwords, or symbols so the model can process it numerically.
- Word or token embeddings convert tokens into vectors, such as cat -> [0.2, -0.7, 0.1, ...].
- Attention weights often use softmax: attention = softmax(QK^T / sqrt(dk))V.
- The model predicts the next translated token using probabilities: P(y_t | y_1, ..., y_{t-1}, x).
- Training reduces error by minimizing loss, often cross-entropy loss = -sum y log(p).
Vocabulary
- Tokenization
- Tokenization is the process of splitting text into smaller units, such as words, subwords, or punctuation marks.
- Embedding
- An embedding is a numerical vector that represents a token so a computer model can compare and process language patterns.
- Neural network
- A neural network is a layered computing system that learns to map inputs to outputs by adjusting many numerical weights.
- Attention
- Attention is a method that lets a model focus more strongly on the most relevant input tokens when producing each output token.
- Training data
- Training data is the collection of example inputs and correct outputs used to teach a machine learning model.
Common Mistakes to Avoid
- Translating word by word, because languages often use different word order, grammar, and expressions.
- Ignoring context, because the same word can have different meanings depending on the surrounding sentence.
- Assuming the highest-probability word is always best, because good translation depends on the whole sentence and later choices can change the best output.
- Thinking the model understands language like a person, because it is mainly learning statistical patterns from examples rather than having human experience.
Practice Questions
- 1 A sentence has 8 input tokens, and a translation model compares each input token with each of 10 output positions using attention. How many input-output attention comparisons are made?
- 2 A tokenizer splits a 120-word paragraph into an average of 1.4 tokens per word. How many tokens are produced?
- 3 Explain why the sentence I saw her duck can be difficult for a machine translation system, and describe what kind of context could help.