Multilingual Multilayer Perceptron

Machine Learning
Introduced by
McCulloch & Pitts / Rumelhart et al. (MLP); multilingual application became standard in NLP from the 2010s onward
Year
2010s
Type
Feedforward neural network (multilingual variant)
Family
Deep learning / NLP / CV

What does it do?

A Multilingual MLP is a feedforward neural network trained on text from two or more languages, relying on shared or aligned input representations — such as multilingual word embeddings or subword vocabularies — so that a single model can process and classify text across languages without separate per-language networks.

The intuition behind the method

A standard MLP maps fixed-size input vectors through stacked linear transformations and nonlinearities to produce an output. When the input vectors are language-agnostic — for example, derived from a shared multilingual embedding space — the same MLP architecture can generalise across languages. The model learns patterns that hold across languages rather than patterns specific to one. If the input space aligns languages well, the hidden layers capture cross-lingual regularities, enabling zero-shot or few-shot transfer to languages seen rarely or not at all during training.

History

Multilayer perceptrons are typically trained by backpropagation, a gradient-based method that extends the single-layer perceptron to networks with hidden layers. Multilingual use of such networks grew once aligned cross-lingual embeddings and shared subword vocabularies made one network across many languages practical. Artetxe et al. (2019) describe a shared-encoder sentence embedding for 93 languages, the kind of fixed-size input this model relies on.

When to use it

Use a multilingual MLP when labelled data exists in one or a few languages, predictions are needed for other languages, and the task is sentence- or document-level, so no positional context within the text is required. It suits a lightweight baseline before committing to a fine-tuned multilingual transformer, or deployments where model size and inference cost are constrained. Avoid it when word order or long-range dependencies determine the label, since sequence models or transformers handle these better. Avoid it also when the target languages are distant from the source languages and the embedding space does not align them well, because zero-shot transfer then tends to fail. It is not suitable for generation, machine translation or span extraction, which need variable-length outputs.

Limitations and considerations

  • Pooling tokens into a single vector discards word order and within-sentence structure, so the model struggles where syntax determines the label.
  • Transfer quality is bounded by the embedding space: if a target language is poorly covered or aligned, the MLP cannot compensate, because it never sees that language's text during training.
  • For morphologically rich languages, the shared subword or embedding vocabulary may split word forms inconsistently across languages, which weakens the aligned input.
  • On many tasks a fine-tuned multilingual transformer has achieved higher accuracy, but the size of the gap depends on the task and data. The MLP's main advantage is cost, and any accuracy gap should be measured on your own held-out languages.
  • The fixed output head cannot produce variable-length outputs, so it does not cover generation, machine translation or span extraction.

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

Strengths

  • The trainable part is only a shallow head on fixed-size vectors, so training is inexpensive once embeddings are computed; the embedding step usually dominates the cost.
  • Parameters are shared across languages, so one set of weights serves all languages rather than one network per language.
  • When the input embedding space aligns languages, a classifier trained on source-language labels can be applied to other languages without target-language labels.
  • Any fixed-size sentence encoder can feed the head, such as LASER or aligned fastText vectors, so the encoder can be changed without changing the head.

Applications

  • Cross-lingual text classification and sentiment analysis using shared multilingual embeddings.
  • Multilingual intent detection in dialogue systems with limited labelled data per language.
  • Language-agnostic document routing or topic labelling across multilingual corpora.
  • Lightweight inference endpoint for multilingual classification when transformer models are too large to deploy.
  • Evaluation of cross-lingual transfer on benchmarks such as XNLI and MLDoc, where a classifier is placed on top of frozen multilingual sentence embeddings, as in Artetxe et al. (2019).

How it works

How it works

1

Text from all target languages is tokenised with one shared vocabulary, such as a multilingual byte-pair encoding (BPE) vocabulary of the kind used by Artetxe et al. (2019). Alternatively, tokens are mapped to a shared multilingual embedding space, such as aligned fastText vectors. The shared vocabulary or space is what places inputs from different languages in compatible positions.

2

Token or sentence-level representations are aggregated into a fixed-size dense vector, either by mean-pooling token vectors or by taking the output of a pre-trained multilingual sentence encoder. Using one embedding layer for all languages lets a single model serve many languages without per-language components. Artetxe et al. (2019) produce such a vector with a single shared BiLSTM encoder trained on parallel corpora.

3

The dense input vector passes through one or more fully connected hidden layers, each applying an affine transform followed by a nonlinear activation such as ReLU. The network parameters are shared across all languages, so gradient updates from every language act on the same weights.

Formula
h^{(l)} = \sigma(W^{(l)} h^{(l-1)} + b^{(l)})
4

A final linear layer projects the last hidden representation to the target output space: class logits for classification, or a scalar for regression. A softmax or sigmoid converts logits to probabilities. For sequence-level tasks, the MLP operates on the pooled sentence embedding rather than on individual tokens.

5

The model is optimised on labelled examples from one or more source languages, typically with a cross-entropy loss for classification. After training it can be evaluated on held-out target languages without target-language labels, which is zero-shot cross-lingual transfer. Whether mixing several languages in training helps depends on the data and should be checked on held-out languages.

Common pitfalls

  • Using monolingual embeddings independently per language and expecting cross-lingual transfer — the embeddings must be aligned or jointly trained.
  • Evaluating only on source-language test data and claiming multilingual performance without testing on target languages.
  • Pooling sequence embeddings naively (e.g., averaging all tokens without masking padding tokens), which distorts representations.
  • Ignoring language imbalance in training data — over-represented languages dominate gradients and the model underperforms on low-resource languages.
  • Treating the MLP as final rather than as a baseline; a fine-tuned multilingual encoder is a natural comparison wherever compute allows.

Frequently asked questions

What kind of input does a multilingual MLP require?

It requires fixed-size dense vectors that represent text in a language-neutral space. Common choices are sentence embeddings from LASER or mean-pooled aligned fastText vectors. The pooled output of a frozen multilingual BERT encoder can also be used as a feature extractor, but its cross-lingual alignment is not guaranteed, so transfer to each target language must be checked on held-out data.

How does it differ from a fine-tuned multilingual transformer?

A multilingual MLP takes pre-computed embeddings as input and trains only a shallow feedforward head. A fine-tuned multilingual transformer such as mBERT updates both the encoder and the classification head on task-specific data. This can give higher accuracy, although the size of the gap depends on the task and data, at the cost of much greater memory and compute.

Can it handle languages not seen during training?

Yes, if the underlying embedding space covers the unseen language. When the embedding places the new language in the same space, the MLP can generalise without retraining. This is zero-shot cross-lingual transfer, and its quality should be measured on held-out data for each target language.

How should I handle class or language imbalance in training?

Apply a class-weighted loss or oversample minority classes. For language imbalance, consider sampling that up-weights low-resource languages, or build mini-batches with balanced per-language counts, so that dominant languages do not crowd out the others.

When should I upgrade from a multilingual MLP to a deeper model?

Consider upgrading when cross-lingual accuracy plateaus below the task requirement, when the task involves sequential dependencies or fine-grained semantics, or when enough compute is available to fine-tune a multilingual transformer such as mBERT.

Related methods

Sources

  1. Artetxe, M., & Schwartz, H. A. (2019). Massively Multilingual Sentence Embeddings for Zero-Shot Cross-Lingual Transfer and Beyond. Transactions of the Association for Computational Linguistics, 7, 597–610.

    Open DOI reference
  2. Multilayer perceptron. Wikipedia.

    Open publication reference