--- base_model: meta-llama/Meta-Llama-3.1-8B datasets: - orai-nlp/ZelaiHandi - HuggingFaceFW/fineweb language: - eu library_name: transformers pipeline_tag: text-generation --- # Llama-eus-8B, a foundational sub-10 billion parameter LLM for Basque Llama-eus-8B v1.0 is a foundational large language model (LLM) adapted from Meta's [Llama3.1-8B](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B), tailored specifically for the Basque language. Through continual pretraining on a combination of the [ZelaiHandi dataset](https://huggingface.co/datasets/orai-nlp/ZelaiHandi), containing approximately 1.5 billion high-quality Basque tokens, and a selected subset of the [FineWeb dataset](https://huggingface.co/datasets/HuggingFaceFW/fineweb), around 300 million tokens, Llama-eus-8B aims to enhance linguistic performance in Basque while maintaining general English capabilities. The original Meta Llama 3.1 collection of models was trained on 15 trillion tokens, with some multilingual content supporting seven additional languages besides English: French, German, Hindi, Italian, Portuguese, Spanish, and Thai. However, it has limitations for low-resource languages such as Basque, leading to poor performance in formal linguistic competence (correct use of grammar and vocabulary) and functional linguistic competence (the ability to understand and use language in real-world contexts). To address this, Meta-Llama-3.1-8B was used as the base for Llama-eus-8B, which underwent specialized pretraining to improve these competences in Basque. Evaluations show that Llama-eus-8B exhibits notable improvements over Meta-Llama-3.1-8B in Basque for tasks requiring linguistic competence, with minimal degradation in performance for English. ## Model Details ### Model Description - **Developed by:** [Orai NLP Technologies](https://huggingface.co/orai-nlp) - **Model type:** Foundational LLM - **License:** Llama 3.1 is [licensed](https://llama.meta.com/llama3_1/license/) under the Llama 3.1 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved. - **Finetuned from model:** Built with Llama ([Llama3.1-8B](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B)) ## Training Details ### Training Data For continual pre-training (CPT), we leveraged a combination of Basque and English data to enhance linguistic performance in Basque while maintaining general English capabilities. The goal is to improve cross-lingual transfer by retaining the model's proficiency in English. - [**ZelaiHandi**](https://huggingface.co/datasets/orai-nlp/ZelaiHandi) (San Vicente et al., 2024): ZelaiHandi is the largest collection of freely licensed and high-quality Basque texts gathered from selected web sources. This collection comprises approximately 521 million words which correspond to 1.5 billion tokens (Llama 3.1 tokenizer). - [**FineWeb**](https://huggingface.co/datasets/HuggingFaceFW/fineweb) (Penedo et al., 2024): FineWeb consists of more than 15T tokens of cleaned and deduplicated English web data from CommonCrawl. We selected a random subset of around 300 million tokens (Llama 3.1 tokenizer) ### Training Procedure Llama-eus-8B was trained within the 🤗 Transformers ecosystem, utilizing 🤗 Accelerate and DeepSpeed ZeRO for efficient large-scale model training. The process was conducted on the Hyperion system at the Donostia International Physics Center (DIPC), leveraging 8x NVIDIA A100 80GB SXM4 GPUs. The model was trained with a sequence length of 4096 tokens and an effective batch size of approximately 2 million tokens, over 4 epochs, resulting in a total of around 7.2 billion tokens processed. A cosine learning rate schedule was used, with a peak learning rate of 1e-4 and a warm-up phase comprising 10% of the total steps. All remaining hyperparameters followed the configurations established by Touvron et al. (2023). ## Evaluation ### Testing Data To evaluate our model, we created Basque versions of well-established English benchmarks by manually translating a selected subset of these datasets. This approach enabled us to rigorously assess Llama-eus-8B's performance in Basque and directly compare it with its performance in English, providing a comprehensive evaluation of the model's multilingual capabilities. - [**ARC_HT_eu_sample**](https://huggingface.co/datasets/orai-nlp/ARC_HT_eu_sample) (Corral et al., 2024) [25-shot]: A subset of 250 samples manually translated to Basque from the [ARC dataset](https://huggingface.co/datasets/allenai/ai2_arc) (Clark et al., 2018). The corresponding 250 English samples are also provided. The ARC dataset consists of genuine grade-school level, multiple-choice science questions, assembled to encourage research in advanced question-answering. - [**Winogrande_HT_eu_sample**](https://huggingface.co/datasets/orai-nlp/WinoGrande_HT_eu_sample) (Corral et al., 2024) [5-shot]: A subset of 250 samples manually translated to Basque from the [WinoGrande dataset](https://huggingface.co/datasets/allenai/winogrande) (Sakaguchi et al., 2019). The corresponding 250 English samples are also provided. The Winogrande dataset is a collection of 44k problems, inspired by Winograd Schema Challenge, but adjusted to improve the scale and robustness against the dataset-specific bias. Formulated as a fill-in-a-blank task with binary options, the goal is to choose the right option for a given sentence which requires commonsense reasoning. - [**MMLU_HT_eu_sample**](https://huggingface.co/datasets/orai-nlp/MMLU_HT_eu_sample) (Corral et al., 2024) [5-shot]: A subset of 270 samples manually translated to Basque from the [MMLU dataset](https://huggingface.co/datasets/cais/mmlu) (Hendrycks et al., 2020). The corresponding 250 English samples are also provided. The MMLU dataset is a massive multitask test consisting of multiple-choice questions from various branches of knowledge. The test spans subjects in the humanities, social sciences, hard sciences, and other areas that are important for some people to learn. - [**HellaSwag_HT_eu_sample**](https://huggingface.co/datasets/orai-nlp/HellaSwag_HT_eu_sample) (Corral et al., 2024) [10-shot]: A subset of 250 samples manually translated to Basque from the [HellaSwag dataset](https://huggingface.co/datasets/Rowan/hellaswag) (Zellers et al., 2019). The corresponding 250 English samples are also provided. The HellaSwag dataset is a dataset for commonsense NLI. Additionally, we evaluated our model using a suite of already publicly available Basque Benchmarks: - [**BL2MP**](https://huggingface.co/datasets/orai-nlp/bl2mp) (Urbizu et al., 2024) [5-shot]: The BL2MP test set, designed to assess the grammatical knowledge of language Models in the Basque language, inspired by the BLiMP benchmark. - [**Belebele**](https://huggingface.co/datasets/facebook/belebele) (Bandarkar et al.) [5-shot]: Belebele is a multiple-choice machine reading comprehension (MRC) dataset spanning 122 language variants. - [**X-StoryCloze**](https://huggingface.co/datasets/juletxara/xstory_cloze) (Lin et al.) [0-shot]: XStoryCloze consists of the professionally translated version of the English StoryCloze dataset to 10 non-English languages. It is a commonsense reasoning framework for evaluating story understanding, story generation, and script learning - [**BasqueGLUE**](https://huggingface.co/datasets/orai-nlp/basqueGLUE) (Urbizu et al.) [5-shot]: BasqueGLUE is a NLU benchmark for Basque, which has been elaborated from previously existing datasets and following similar criteria to those used for the construction of GLUE and SuperGLUE. - [**EusProficiency**](https://huggingface.co/datasets/HiTZ/EusProficiency) (Etxaniz et al., 2024) [5-shot]: EusProficiency comprises 5,169 exercises on different topics from past EGA exams, the official C1-level certificate of proficiency in Basque. - [**EusReading**](https://huggingface.co/datasets/HiTZ/EusReading) (Etxaniz et al., 2024) [1-shot]: EusReading consists of 352 reading comprehension exercises sourced from the set of past EGA (C1 Basque certificate) exams from 1998 to 2008. - [**EusTrivia**](https://huggingface.co/datasets/HiTZ/EusTrivia) (Etxaniz et al., 2024) [5-shot]: EusTrivia consists of 1,715 trivia questions from multiple online sources. A significant portion of the questions focus specifically on the Basque Country, its language and culture. - [**EusExams**](https://huggingface.co/datasets/HiTZ/EusExams) (Etxaniz et al., 2024) [5-shot]: EusExams is a collection of tests designed to prepare individuals for Public Service examinations conducted by several Basque institutions, including the public health system Osakidetza, the Basque Government, the City Councils of Bilbao and Gasteiz, and the University of the Basque Country (UPV/EHU). ### Results For the evaluation, we compare our model against the [Latxa](https://huggingface.co/papers/2403.20266) models (Etxaniz et al., 2024) to assess its performance and effectiveness in Basque language tasks. Latxa is a family of large language models specifically developed for Basque, with parameter sizes ranging from 7 billion to 70 billion. As the only existing models adapted to Basque, Latxa provides a valuable baseline for our comparison. Additionally, we compare our model against Meta's [Llama 3.1](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B) models (Dubey et al., 2024), including the 8B and 70B versions. Meta-Llama-3.1-8B model serves as the base model for our continual pre-training, providing a baseline for evaluating the improvements achieved through our approach. Model evaluations were conducted with the [LM Evaluation Harness library](https://github.com/EleutherAI/lm-evaluation-harness) from Eleuther AI. We divide the evaluation into sub-10 billion parameter models and over-10 billion parameter models to better understand the performance differences across various model sizes. This distinction allows us for a fairer comparison of our model against both smaller and larger scale models. #### Sub-10 billion parameter results Table 1 and Table 2 present the performance of sub-10 billion parameter models on both Basque and English benchhmarks. We compare our Llama-eus-8B model with the Basque model latxa-7b-v1.2. We also report the results for the base model Meta-Llama-3.1-8B.