Rock2346/contradictory-watson-nli
π¬ Contradictory, My Dear Watson β Multilingual NLI Solution Kaggle Competition | Model: mDeBERTa-v3-base-mnli-xnli π Problem Given a premise and hypothesis in one of 15 languages, predict the relationship: 0 = Entailment (hypothesis follows from premise) 1 = Neutral (hypothesis is possible but not certain) 2 = Contradiction (hypothesis contradicts premise) ποΈ Approach Model mDeBERTa-v3-base-mnli-xnli β 279M params, alreadyβ¦ See the full description on the dataset page: https://huggingface.co/datasets/Rock2346/contradictory-watson-nli.
π¬ Contradictory, My Dear Watson β Multilingual NLI Solution
Kaggle Competition | Model: mDeBERTa-v3-base-mnli-xnli
π Problem
Given a premise and hypothesis in one of 15 languages, predict the relationship:
- 0 = Entailment (hypothesis follows from premise)
- 1 = Neutral (hypothesis is possible but not certain)
- 2 = Contradiction (hypothesis contradicts premise)
ποΈ Approach
Model
[mDeBERTa-v3-base-mnli-xnli](https://huggingface.co/MoritzLaurer/mDeBERTa-v3-base-mnli-xnli) β 279M params, already fine-tuned on MultiNLI + XNLI (15 languages, 80.8% XNLI avg)
Strategy
- Baseline: Direct inference with pre-trained model (~75-80% accuracy)
- Fine-tune: 5-fold cross-validation on competition data (+5-10% improvement)
- Ensemble: Weighted average of baseline + fine-tuned predictions
Hyperparameters (from DeBERTaV3 paper)
- Learning rate: 2e-5
- Epochs: 5 (GPU) / 3 (CPU)
- Batch size: 16 (GPU) / 8 (CPU)
- Warmup ratio: 0.1
- Weight decay: 0.06
- Max length: 256
π Files
π Quick Start
Option 1: Kaggle Notebook (Recommended)
- Upload
notebook.ipynbto Kaggle - Enable GPU (Settings β Accelerator β GPU T4 x2)
- Run all cells
- Submit
submission.csv
Option 2: Local / Colab
pip install transformers torch datasets evaluate scikit-learn pandas scipy sentencepiece protobuf accelerate
python train.pyOption 3: Quick Predict (No Training)
pip install transformers torch pandas sentencepiece protobuf
python predict_quick.pyβ οΈ Important Notes
- mDeBERTa does NOT support fp16 β use bf16 or fp32
- Kaggle T4 GPUs don't support bf16 β training runs in fp32 (slower but works fine)
- The model label mapping matches Kaggle:
{0: entailment, 1: neutral, 2: contradiction}
π Dataset Stats
- Train: 12,120 samples | Test: 5,195 samples
- Languages: Arabic, Bulgarian, Chinese, English, French, German, Greek, Hindi, Russian, Spanish, Swahili, Thai, Turkish, Urdu, Vietnamese
- Labels: ~34% entailment, ~32% neutral, ~34% contradiction (balanced)
- English dominant: 57% of training data is English
