AI & ML interests

Training Arabic BERT collaboratively over the internet

CALM Logo

CALM: Collaborative Arabic Language Model

The CALM project is joint effort lead by NCAI in collaboration with Yandex, HuggingFace and UW to train an Arabic language model with volunteers from around the globe. The project is an adaptation of the framework proposed at the NeurIPS 2021 demonstration: Training Transformers Together.

One of the main obstacles facing many researchers in the Arabic NLP community is the lack of computing resources that are needed for training large models. Models with leading performane on Arabic NLP tasks, such as AraBERT, CamelBERT, AraELECTRA, and QARiB, took days to train on TPUs. In the spirit of democratization of AI and community enabling, a core value at NCAI, CALM aims to demonstrate the effectiveness of collaborative training and form a community of volunteers for ANLP researchers with basic level cloud GPUs who wish to train their own models collaboratively.

CALM trains a single BERT model on a dataset that combines MSA, Oscar and Arabic Wikipedia, and dialectal data for the gulf region from existing open source datasets. Each volunteer GPU trains the model locally at its own pace on a portion of the dataset while another portion is being streamed in the background to reduces local memory consumption. Computing the gradients and aggregating them is performed in a distributed manner, based on the computing abilities of each participating volunteer. Details of the distributed training process are further described in the paper Deep Learning in Open Collaborations.

How to participate in training?

To join the collaborative training, all you have to do is to keep a notebook running for at least 15 minutes, you're free to close it after that and join again in another time. There are few steps before running the notebook:

  • 👉 Create an account on Huggingface.
  • 👉 Join the NCAI-CALM Organization on Huggingface through the invitation link shared with you by email.
  • 👉 Get your Access Token, it's later required in the notebook.

How to get my Huggingface Access Token

  • 👉 Go to your HF account.
  • 👉 Go to Settings ⇒ Access Tokens.
  • 👉 Generate a new Access Token and enter any name for "what's this token for".
  • 👉 Select read role.
  • 👉 Copy your access token.
  • 👉 In cell 4, it will ask you for an Access Token, paste it there.

Start training

Pick one of the following methods to run the training code.
NOTE: Kaggle gives you around 40 hrs per week of GPU time, so it's preferred over Colab, unless you have Colab Pro or Colab Pro+.

  • 👉 (recommended)
  • 👉
  • 👉 Running locally: If you have additional local computing GPUs, please visit our discord channel for instructions to set it.

Issues or questions?

Feel free to reach us on Discord if you have any questions 🙂