The problem in brief
You get 6,617 English tweets labelled with their overall affect (1 positive, 0 negative), 872 more for validation, 3,357 unlabelled Spanish tweets and 2,687 Spanish test tweets to label. The only model allowed is xlm-roberta-base, a multilingual encoder pretrained on 100 languages; translation tools and other language models are forbidden. This is zero-shot cross-lingual transfer: learn the task in English, apply it in Spanish, and use the unlabelled Spanish text to adapt. Assessment is on "innovation, performance and efficiency". The notebook comes from a third-party repository (github.com/teodora-dimitrova/Singapore-Team-Selection) and the data from github.com/duyngtr16061999/Cross_lingual_sentiment_classification.
About the evaluation. The Spanish test labels were not published with the task. We found that every tweet comes from the public SemEval-2018 Task 1 "E-c" dataset (multi-label emotions, Mohammad et al.), and that the English labels follow an exact rule: label 1 if the tweet is annotated with joy, love, optimism, anticipation or trust, else 0 (this reproduces all 7,489 English labels). Applying the same rule to the Spanish E-c gold file rebuilds the Spanish test labels (48.4 % positive). We used them only to score the final predictions, never to choose anything: every design decision below was made on the English validation set or fixed in advance.
How you are scored
The organisers score the predicted Spanish labels (the notebook computes accuracy on the English validation set, so we use accuracy):
plus a judgement of innovation and efficiency. There is no published threshold. Since the classes are balanced (48.4 % positive in the Spanish test), always predicting one class gives about 50 %.
First look at the data
- Tweets are short: a median of 100 characters in English and 74 in Spanish, often with hashtags and emoji. The notebook truncates to 32 tokens, which cuts the end of many English tweets; 64 tokens keeps almost all of them.
- The two languages share only the label space. The Spanish tweets come from different users and topics, and their emotional vocabulary ("enfadado", "QEPD", "felicidad") never appears in the training data.
- The classes are balanced in all four files, so accuracy is a fair metric and a degenerate model is easy to spot.
A first baseline
The notebook fine-tunes XLM-R with learning rate , 2 epochs, batch 64, 32 tokens. We ran it with one change forced by our memory budget: the word-embedding matrix (250,002 tokens x 768, 192 million of the 278 million parameters) is frozen, which divides the optimizer memory by three. Result: the training loss stays at 0.69 (that is , the loss of a coin flip), the model predicts "positive" for every tweet, English validation accuracy 56.1 % and Spanish 48.4 %.
This is a classic failure. A learning rate of is too large for a pretrained transformer: the first updates destroy the pretrained representations faster than the new classifier head can use them, and the model falls back to predicting the majority class. Values between and , with a warm-up, are the standard range for BERT-like models. With , a linear warm-up over 6 % of the steps and linear decay, the same 2 epochs and 32 tokens give 81.0 % on English validation and 76.6 % in Spanish; 3 epochs and 64 tokens give 84.5 to 86.6 % in English and 77.8 to 79.2 % in Spanish (three runs).
The key idea
Why zero-shot transfer works at all. XLM-R was pretrained with masked-language modelling on text in 100 languages with one shared vocabulary. Nothing told it that "happy" and "feliz" mean the same thing, yet its hidden representations end up roughly aligned across languages, because similar contexts produce similar representations. A classifier trained on English representations therefore partly works on Spanish ones. The gap between English validation (about 85 %) and Spanish test (about 78 %) is the price of the imperfect alignment.
Freeze the word embeddings. Fine-tuning on English moves the embeddings of English tokens only; the Spanish tokens never get a gradient. Unfrozen, the English part of the embedding space drifts away from the Spanish part it was aligned with. Freezing the embedding matrix keeps the shared input space intact, saves two thirds of the optimizer memory, and the 12 transformer layers still adapt to the task. (Full fine-tuning did not fit our 3 GB memory budget, so we could not measure the unfrozen variant.)
Self-training: let the model teach itself Spanish. The unlabelled Spanish corpus is the resource that must be used. Self-training (pseudo-labelling) is the simplest efficient way:
- train on English;
- predict the 3,357 unlabelled Spanish tweets;
- keep the most confident 60 % of each predicted class (about 2,000 tweets, balanced so that the model does not amplify a bias towards one class);
- retrain from the pretrained checkpoint on English plus these pseudo-labelled Spanish tweets, and repeat.
Why does a model improve by learning from its own predictions? Its confident predictions are mostly right (for a reasonably calibrated model, high-confidence predictions are more accurate than the average one), and they are on Spanish text. Retraining on them teaches the model Spanish cues that it could not see in English: when a tweet with "QEPD" (rest in peace) is confidently negative because of the crying emoji, the next model learns that "QEPD" alone is negative. In other words, the decision boundary is pushed into the low-density regions of the Spanish data, the classic cluster assumption of semi-supervised learning. The balanced selection and the restart from the pretrained checkpoint (rather than continuing to train) limit confirmation bias, where a model reinforces its own mistakes.

The figure contains the main methodological lesson of the problem. Self-training improves Spanish by 1.2 to 2.4 points, consistently over two seeds, but the English validation accuracy does not follow (it goes down for seed 0, up for seed 1). A source-language validation set cannot select target-language methods. In a real zero-shot setting you would fix the procedure in advance on principled grounds, or annotate a small Spanish development set. We fixed two rounds and 60 % before looking at any Spanish score.
The full solution
- Tokenise with the XLM-R tokenizer, 64 tokens, padding to the maximum length.
xlm-roberta-basewith a 2-class head; word embeddings frozen.- AdamW, learning rate , weight decay 0.01, batch 32, 6 % linear warm-up then linear decay, 3 epochs.
- Two rounds of self-training on the unlabelled Spanish corpus (top 60 % most confident per predicted class), each round retraining from the pretrained weights on English plus pseudo-labelled Spanish.
- Predict the Spanish test set and write
DT_test_predictions.csv.
p = proba(model, *X_spanish_unlabeled); conf, lab = p.max(1)
for c in (0, 1): # balanced: top 60 % of each predicted class
idx = torch.where(lab == c)[0]
keep[idx[conf[idx].argsort(descending=True)[: int(0.6 * len(idx))]]] = True
model = fit(new_model(), English + Spanish[keep], labels + lab[keep])
Efficiency. One English-only training takes about 2.5 minutes on an Apple laptop GPU; the whole pipeline with two rounds of self-training takes 11.5 minutes, with no extra model and no extra pretraining. Domain-adaptive masked-language-model pretraining on the Spanish corpus would be the next idea, but at a much higher cost for 3,357 short tweets.
Results
Spanish scores use the rebuilt SemEval-2018 labels; they were not used for any choice.
| approach | English validation | Spanish test |
|---|---|---|
| always "positive" | 56.1 % | 48.4 % |
| notebook recipe (lr , 2 epochs, 32 tokens) | 56.1 % | 48.4 % (collapsed) |
| lr + warm-up, 2 epochs, 32 tokens | 81.0 % | 76.6 % |
| same, 3 epochs, 64 tokens (three runs) | 84.5 / 86.6 / 84.9 % | 77.8 / 78.4 / 79.2 % |
| + 1 round of self-training (seeds 0 / 1) | 85.8 / 85.9 % | 79.8 / 80.1 % |
| + 2 rounds of self-training (seeds 0 / 1), final | 84.9 / 86.8 % | 80.8 / 80.4 % |
Our submitted predictions (seed 0) reach 80.8 % on the Spanish test set. Runs on Apple's GPU are not bit-for-bit reproducible even with a fixed seed: identical settings gave 84.5 % and 86.6 % in English, so differences below about 1.5 points are noise.
What to remember
- Fine-tuning a pretrained transformer needs a small learning rate and a warm-up. A loss stuck at and a model predicting one class are the signature of a learning rate that destroyed the pretrained weights.
- Multilingual pretraining gives cross-lingual transfer for free, and freezing the shared word embeddings protects the alignment between languages (and saves memory).
- Unlabelled target data is the key resource. Balanced, confidence-filtered self-training, restarted from the pretrained checkpoint, adds about 2 points at almost no cost.
- Validate where you deploy. English validation accuracy did not predict the Spanish gains; without target labels, fix the method in advance or label a small target sample.
- Look for the source of a dataset. Recognising SemEval-2018 E-c and the exact label rule turned an unscorable exercise into an honest evaluation, used only after all choices were made.