CoolFace
Modelpublic

McGill-NLP/AfriqueQwen3.5-4B-ExtendedCM

sourceHugging Facecc-by-4.0updated 3mo agoView on Hugging Face
0likes110downloads
Model Card

AfriqueQwen3.5-4B-ExtendedCM

Model Overview

AfriqueQwen3.5-4B-ExtendedCM is part of the AfriqueLLM suite, a collection of open language models adapted to 20 African languages through continued pre-training (CPT) on ~34B tokens. This model is based on Qwen/Qwen3.5-4B-Base and has been specifically adapted for improved performance on African languages while maintaining strong capabilities in high-resource languages.

This is an extended continued pre-training variant of AfriqueQwen3.5-4B, trained with 5x more code and math data (5B tokens each of CornStack-Python and FineMath, compared to 1B each in the standard version). This results in modest additional gains on reasoning-related benchmarks.

Key Features

  • —Type: Causal Language Model (Base/Pre-trained)
  • —Base Model: Qwen 3.5 4B
  • —Parameters: 4B
  • —Context Length: 32,768 tokens (native)
  • —Training Tokens: ~34B tokens of carefully curated multilingual data

Supported Languages

AfriqueQwen3.5-4B-ExtendedCM has been adapted for the following 20 African languages:

LanguageCodeFamilyScript
Afrikaansafr_LatnGermanicLatin
Swahiliswh_LatnBantuLatin
Moroccan Arabicary_ArabSemiticArabic
Somalisom_LatnCushiticLatin
Amharicamh_EthiSemiticEthiopic
Egyptian Arabicarz_ArabSemiticArabic
Hausahau_LatnChadicLatin
Kinyarwandakin_LatnBantuLatin
Zuluzul_LatnBantuLatin
Igboibo_LatnVolta-NigerLatin
Plateau Malagasyplt_LatnAustronesianLatin
Xhosaxho_LatnBantuLatin
Shonasna_LatnBantuLatin
Yorubayor_LatnVolta-NigerLatin
Nyanjanya_LatnBantuLatin
Southern Sothosot_LatnBantuLatin
Tigrinyatir_EthiSemiticEthiopic
Tunisian Arabicaeb_ArabSemiticArabic
Oromogaz_LatnCushiticLatin
Tswanatsn_LatnBantuLatin

High-resource languages used for catastrophic forgetting mitigation: English, French, Portuguese, Arabic

Training Data

Our training corpus combines multiple high-quality sources:

  • —African Monolingual Data (~22.8B tokens): FineWeb2, WURA, and MADLAD-400
  • —Code (~1B tokens): CornStack-Python for reasoning capabilities
  • —Mathematics (~1B tokens): FineMath-4+ for mathematical understanding
  • —Synthetic Data (~324M tokens): GPT-4.1 translated domain-specific content across 10 domains

We use UniMax sampling to create a balanced distribution, capping high-resource languages at approximately 1B tokens and upsampling lower-resource languages for up to five epochs.

Quickstart

python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "McGill-NLP/AfriqueQwen3.5-4B-ExtendedCM"

# Load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)

# Prepare the model input
prompt = "Bawo ni o ṣe n ṣe?"  # Yoruba: "How are you doing?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

# Generate text
generated_ids = model.generate(
    **inputs,
    max_new_tokens=100,
)
output = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
print(output)

Deployment

For deployment, you can use vllm or sglang to create an OpenAI-compatible API endpoint:

vLLM:

shell
vllm serve McGill-NLP/AfriqueQwen3.5-4B-ExtendedCM

SGLang:

shell
python -m sglang.launch_server --model-path McGill-NLP/AfriqueQwen3.5-4B-ExtendedCM

Training Details

Hyperparameters

  • —Learning Rate: 5e-5 (with warmup and cosine decay)
  • —Context Length: 16,384 tokens
  • —Optimizer: AdamW
  • —Precision: BF16 mixed precision

Infrastructure

Training was conducted using the LLaMA-Factory framework on up to 64 NVIDIA H100 GPUs with:

  • —DeepSpeed ZeRO-1/ZeRO-2
  • —Flash Attention 3
  • —Sequence packing
  • —Liger Kernel optimizations

Evaluation

All AfriqueLLM models are evaluated on multiple multilingual benchmarks. FLORES is reported only in the English-to-target direction (eng->xxx):

ModelAfriMGSMAfriMMLUAfriXNLIBelebeleFLORES (eng->xxx)INJONGSIB-200OverallΔ (Δ %)
Gemma3-4B10.2433.8937.7645.7935.3655.5263.5940.31
AfriqueGemma-4B14.8636.7339.6250.5254.9569.2869.2147.88+7.6 (18.8%)
Gemma3-12B25.2148.7644.0168.8444.0973.5379.1754.80
AfriqueGemma-12B32.1449.4744.6068.6565.0476.7975.0858.82+4.0 (7.3%)
Qwen3-4B8.2633.8437.1241.5020.1621.6957.8831.49
AfriqueQwen-4B33.0943.0444.8863.6259.8265.3474.7754.94+23.4 (74.4%)
Qwen3.5-4B20.7938.6340.3655.8232.0659.4374.9646.01
AfriqueQwen3.5-4B30.4743.6641.0566.0163.5575.4679.6657.12+11.1 (24.2%)
<u>AfriqueQwen3.5-4B-ExtendedCM</u><u>34.17</u><u>45.26</u><u>41.94</u><u>66.45</u><u>63.76</u><u>75.97</u><u>80.52</u><u>58.30</u><u>+1.2 (2.1%)</u>
AfriqueQwen3.5-4B-50Langs34.0645.2341.7966.8364.5675.8279.8358.30+0.0 (0.0%)
Qwen3-8B11.2236.5638.2444.6321.1329.4753.0633.47
AfriqueQwen-8B39.6846.9145.9968.4662.1873.3677.0059.08+25.6 (76.5%)
Qwen3-14B16.6039.6643.2250.7423.6141.8066.2940.27
[AfriqueQwen-14B](https://huggingface.co/McGill-NLP/AfriqueQwen-14B)45.0152.2249.0174.6363.7777.8082.6363.58+23.3 (57.9%)
Llama3.1-8B8.1432.2737.9040.9526.6941.3759.9935.33
AfriqueLlama-8B17.5136.5737.3950.5163.6071.1769.1449.41+14.1 (39.9%)
Lugha-Llama-8B-wura9.4637.0039.2447.8649.9062.3075.8145.94
Gemma3-27B35.3755.4746.8574.8148.4179.7084.3460.71

Additional-Language Evaluation

This table averages only evaluated African languages outside the first 20-language CPT set: Ewe, Lingala, Ganda, Twi, and Wolof. Benchmark cells average the available languages for that benchmark; FLORES is English-to-target only (eng->xxx).

ModelAfriMGSMAfriMMLUAfriXNLIBelebeleFLORES (eng->xxx)INJONGSIB-200AvgΔ (Δ %)
Qwen3.5-4B8.3032.3534.3036.9022.2033.2758.9632.33
AfriqueQwen3.5-4B7.5231.1733.5635.8226.2833.1056.6632.02-0.31 (-1.0%)
<u>AfriqueQwen3.5-4B-ExtendedCM</u><u>8.13</u><u>32.72</u><u>33.74</u><u>36.76</u><u>24.06</u><u>32.41</u><u>56.00</u><u>31.97</u><u>-0.05 (-0.2%)</u>
AfriqueQwen3.5-4B-50Langs21.0737.6536.3151.5656.3361.3775.7548.58+16.61 (+52.0%)

Model Variants

Citation

If you find our work helpful, please cite:

bibtex
@misc{yu2026afriquellmdatamixingmodel,
      title={AfriqueLLM: How Data Mixing and Model Architecture Impact Continued Pre-training for African Languages}, 
      author={Hao Yu and Tianyi Xu and Michael A. Hedderich and Wassim Hamidouche and Syed Waqas Zamir and David Ifeoluwa Adelani},
      year={2026},
      eprint={2601.06395},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2601.06395}, 
}

License

This model is released under the CC BY 4.0 License. Please review the license terms before use.

Acknowledgments

We thank the creators of the base models, datasets and compute resources that made this work possible, including Mila, Compute Canada, Microsoft, the FineWeb team, WURA, MADLAD-400 and etc..