Instructions to use SinhalaMMLU-SharedTask/team-sinbotics with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use SinhalaMMLU-SharedTask/team-sinbotics with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files12324 unmodified lines2829303132338 unmodified lines42434445464748495051523 unmodified lines56575859# Team SinBotics – Sinhala MMLU Shared Task System## Team24 unmodified lines| [`SinhalaMMLU-SharedTask/team-sinbotics`](https://huggingface.co/SinhalaMMLU-SharedTask/team-sinbotics) | this repo: code, inference script, final predictions, training code, and our LoRA adapter on Qwen3.5-4B in [`adapter/`](https://huggingface.co/SinhalaMMLU-SharedTask/team-sinbotics/tree/main/adapter) (rank 16, combined Sinhala data, 1 epoch; weights, config and tokenizer files) || [`Qwen/Qwen3.5-4B`](https://huggingface.co/Qwen/Qwen3.5-4B) | base model (downloaded by `inference.py` at the pinned revision) |## How to run```bashpip install -r requirements.txt8 unmodified lines- The final file was produced by our package (`training/sinmmlu`, `python -m sinmmlu.evaluate --model configs/models/qwen35_4b_lora_combined.yaml --data test --prompt cot_en_role_think --chat on --max-new-tokens 4096`). `inference.py` is a self-contained copy of that code path. We checked that it builds the same prompt for all 2,238 test questions and processes the reasoning texts the same way.- On our side, the first 300 questions were generated in a separate run and reused, so batches were composed differently. A from-scratch run can therefore differ from `predictions.jsonl` in a few answers.## Results| | ||---|---|| Training validation (2,745 held-out questions from the two training sources, digit prompt) | 44.4% → 54.8% after fine-tuning || Final run | answers stated in the reasoning for 56.0% of questions; the rest hit the 4,096-token limit and are read off after the cue |## Files- `inference.py` – the exact system that produced our final Codabench submission (self-contained; see above)3 unmodified lines- `training/` – data preparation, LoRA training, merging and evaluation code (`sinmmlu` package), configs, the training script and our final run's configuration (`training/README.md`)## CitationThis work uses the SinhalaMMLU dataset: Pramodya et al., EMNLP 2025.123456789101112131415161724 unmodified lines424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192938 unmodified lines1021031041051061071081091101111121131141151161171181191201211221231241253 unmodified lines129130131132133134135136137138---license: apache-2.0language:- sibase_model: Qwen/Qwen3.5-4Blibrary_name: peftpipeline_tag: text-generationtags:- sinhala- multiple-choice- lora- sinhala-mmlu---# Team SinBotics – Sinhala MMLU Shared Task System## Team24 unmodified lines| [`SinhalaMMLU-SharedTask/team-sinbotics`](https://huggingface.co/SinhalaMMLU-SharedTask/team-sinbotics) | this repo: code, inference script, final predictions, training code, and our LoRA adapter on Qwen3.5-4B in [`adapter/`](https://huggingface.co/SinhalaMMLU-SharedTask/team-sinbotics/tree/main/adapter) (rank 16, combined Sinhala data, 1 epoch; weights, config and tokenizer files) || [`Qwen/Qwen3.5-4B`](https://huggingface.co/Qwen/Qwen3.5-4B) | base model (downloaded by `inference.py` at the pinned revision) |## System in detail### Pipeline (per question)1. **Normalise the text.** Unicode NFC, remove zero-width non-joiners (U+200C, an artefact of legacy Sinhala fonts that is much more frequent in the test set than in the training data), keep zero-width joiners (U+200D, needed for conjuncts such as ප්ර), and tidy spaces while keeping line breaks so sub-option lists stay readable.2. **Build the prompt.** It is a single zero-shot user turn with the subject name in English, the original Sinhala question (no translation) and the options numbered 1–4:```textYou are an expert Sri Lankan teacher of {subject}.The following is a multiple choice question in Sinhala about {subject}.Think step by step in English, then choose the correct or most suitable answer from the options 1, 2, 3, 4.End your reply with "Answer: <number>".Question: {question}1. {option 1}2. {option 2}3. {option 3}4. {option 4}```3. **Render the chat template.** We use Qwen3.5's chat template with `enable_thinking=True`, so the model first reasons inside `<think> … </think>`. The template's date is fixed, so the prompt never depends on the run date.4. **Generate the reasoning.** Greedy decoding (`do_sample=False`), at most 4,096 new tokens, with length-sorted batches of 48 and left padding.5. **Read off the answer.** If the reasoning ends with "Answer: N", that statement is cut off. The thinking block is closed with `</think>` if needed, and "\n\nAnswer: " is appended. One forward pass then gives the log-probabilities of the tokens `1`, `2`, `3` and `4` at the next position, and the most probable one is the answer. So every question gets exactly one valid answer, including questions whose reasoning hit the 4,096-token limit. In our final run, 97.4% of the stated answers agree with this read-off answer.### Fine-tuning| | ||---|---|| Method | LoRA (PEFT 0.21.1), rank 16, alpha 32, dropout 0.05 || Target modules | q/k/v/o, gate/up/down, and the Gated-DeltaNet projections in_proj_qkv/in_proj_z/out_proj of all 32 text layers; vision tower not used || Trainable parameters | 30,474,240 || Objective | log P(gold digit) after a plain multiple-choice prompt (`en_instr_nosubject`) whose chat reply is pre-filled with "Answer: ". The loss is on that single token only, so the model is not taught to stop after a digit, and the reasoning prompt above keeps working. || Data | 25,799 training questions: Global-MMLU Sinhala + sinmulu_si, 10% per subject held out for validation (seed 42), questions longer than 1,024 tokens skipped. No shared-task test questions were used. || Optimiser | AdamW, learning rate 1e-4, cosine schedule with 3% warm-up, weight decay 0, gradient clipping 1.0, 32 questions per step, 1 epoch = 807 steps, seed 42 || Precision | bf16 base weights, LoRA weights in fp32 || Hardware / time | 1× NVIDIA RTX 3090 24 GB, 8.8 hours || Merge | `merge_and_unload()`: the merged model has the same architecture and parameter count as the base text model |Validation accuracy (2,745 held-out questions, digit prompt) during training:| Step | 0 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 807 ||---|---|---|---|---|---|---|---|---|---|| Accuracy (%) | 44.4 | 47.4 | 49.9 | 51.7 | 51.7 | 52.8 | 53.2 | 54.5 | 54.8 |### How we got here- **Baseline and prompts.** We first evaluated Gemma-3-4B-it with the prompts of the SinhalaMMLU paper and many variants on our development data: the public training questions, split into a 280-question screening set and a 1,483-question confirmation set. English step-by-step reasoning in the role of a Sri Lankan teacher was the clear winner: 45.6% vs 38.2% for the paper's prompt on the confirmation set.- **Ideas that did not help enough.** Machine translation of the questions into English (NLLB, MADLAD, self-translation) often lost negations ("which is NOT …"). Few-shot examples, calibration, option-order averaging, self-consistency, a negation-check chain and prompt ensembles each changed accuracy by less than our +2-point threshold.- **Fine-tuning.** LoRA adapters on Global-MMLU Sinhala and on sinmulu_si improved Gemma-3-4B-it. In all our runs, validation accuracy peaked after one epoch.- **Final system.** We then moved to Qwen3.5-4B, a newer ≤ 8B open model, trained one LoRA epoch on the combined data, and switched on its thinking mode for the reasoning step.## How to run```bashpip install -r requirements.txt8 unmodified lines- The final file was produced by our package (`training/sinmmlu`, `python -m sinmmlu.evaluate --model configs/models/qwen35_4b_lora_combined.yaml --data test --prompt cot_en_role_think --chat on --max-new-tokens 4096`). `inference.py` is a self-contained copy of that code path. We checked that it builds the same prompt for all 2,238 test questions and processes the reasoning texts the same way.- On our side, the first 300 questions were generated in a separate run and reused, so batches were composed differently. A from-scratch run can therefore differ from `predictions.jsonl` in a few answers.## Final run| | ||---|---|| Questions | 2,238 (easy 642, medium 1,111, hard 485) || Hardware | 1× NVIDIA A100-SXM4 40 GB, CUDA 12.8, Python 3.12, torch 2.8.0, transformers 5.18.0, peft 0.21.1, flash-linear-attention 0.4.0, causal-conv1d 1.7.0 || Settings | bf16, generation batch 48, scoring batch 16, greedy, at most 4,096 new tokens, seed 42 || Answer stated in the reasoning | 56.0% of questions; the rest hit the 4,096-token limit and are read off after the cue || Probability on the four answer tokens | 99.9% on average || Longest input (prompt + reasoning) | 4,865 tokens || Format check | 2,238 lines, one per question, answers "1"–"4", fields `q_no`, `subject`, `category`, `level`, `answer` |The full configuration of this run is in `training/logs/final_run_config.json`.## Limitations- **Long reasoning.** About 44% of the reasoning texts reach the 4,096-token limit before stating an answer. For those questions, the answer is read off from the model's next-token probabilities after a truncated reasoning, which is less reliable.- **Tokenisation.** Sinhala costs many tokens in the Qwen3.5 tokenizer (about 4.8 tokens per word), which makes long questions and the reasoning about them expensive.- **Speed.** Thinking mode makes inference slow: about 5 hours for 2,238 questions on an A100.- **Reproducibility.** Results are deterministic on the same GPU and batch composition. Other GPUs can change a few answers through bf16 rounding.## Files- `inference.py` – the exact system that produced our final Codabench submission (self-contained; see above)3 unmodified lines- `training/` – data preparation, LoRA training, merging and evaluation code (`sinmmlu` package), configs, the training script and our final run's configuration (`training/README.md`)## CitationThis work uses the SinhalaMMLU dataset:> Ashmari Pramodya, Nirasha Nelki, Heshan Shalinda, Chamila Liyanage, Yusuke Sakai, Randil Pushpananda, Ruvan Weerasinghe, Hidetaka Kamigaito, and Taro Watanabe. 2025. SinhalaMMLU: A Comprehensive Benchmark for Evaluating Multitask Language Understanding in Sinhala. In *Proceedings of EMNLP 2025*.Training data: Shivalika Singh et al. 2025. Global MMLU: Understanding and Addressing Cultural and Linguistic Biases in Multilingual Evaluation. In *Proceedings of ACL 2025*.Base model: Qwen Team, [Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) (Apache-2.0).
README.md+83-4