Skip to main content
QUICK REVIEW

[Paper Review] Cabrita: closing the gap for foreign languages

Celio H. N. Larcher, Marcos Piau|arXiv (Cornell University)|Aug 23, 2023
Topic ModelingComputer Science4 citations
TL;DR

Cabrita proposes a low-cost, efficient method to train high-performing, language-specific LLMs by adapting the tokenizer and performing continuous pre-training on a base model, achieving performance comparable to larger models—demonstrated by openCabrita 3B, a Portuguese-optimized 3B model that matches 7B English models in few-shot tasks while reducing inference cost through tokenization efficiency.

ABSTRACT

The strategy of training the model from scratch in a specific language or domain serves two essential purposes: i) enhancing performance in the particular linguistic or domain context, and ii) ensuring effective tokenization. The main limitation inherent to this approach lies in the associated cost, which can reach six to seven-digit dollar values, depending on the model size and the number of parameters involved. The main solution to overcome the cost challenge is to rely on available pre-trained models, which, despite recent advancements such as the LLaMA and LLaMA-2 models, still demonstrate inefficiency for certain specific domain problems or prove ineffective in scenarios involving conversational memory resources, given the large number of tokens required to represent text. To overcome this issue, we present a methodology named Cabrita, which, as our research demonstrates, successfully addresses the performance and efficient tokenization problem, all at an affordable cost. We believe that this methodology can be applied to any transformer-like architecture model. To validate the study, we conducted continuous pre-training exclusively using Portuguese text on a 3-billion-parameter model known as OpenLLaMA, resulting in a model named openCabrita 3B. The openCabrita 3B also features a new tokenizer that results in a significant reduction in the number of tokens required to represent the text. In our assessment, for few-shot learning tasks, we achieved similar results with this 3B model compared to a traditional continuous pre-training approach as well as to 7B models English pre-trained models.

Motivation & Objective

  • To address the high cost and inefficiency of training language-specific LLMs from scratch, especially for low-resource languages like Portuguese.
  • To improve monolingual performance and reduce inference cost by optimizing tokenization for a specific language.
  • To demonstrate that continuous pre-training with a language-adapted tokenizer can yield performance on par with larger models, even at 3B parameters.
  • To enable efficient deployment of high-performing models in low-resource language settings without relying on expensive, multilingual pre-training.
  • To validate the approach on a 3B-parameter model fine-tuned for Portuguese, showing competitive results across multilingual benchmarks.

Proposed method

  • Adapt the tokenizer for Portuguese by retraining it on a large Portuguese corpus to reduce subword fragmentation and improve token efficiency.
  • Perform continuous pre-training on the OpenLLaMA 3B model using only Portuguese text, preserving the original model weights and only updating embedding layers.
  • Use a modified training recipe that maintains the original LLaMA architecture and hyperparameters while incorporating language-specific data.
  • Introduce a new tokenizer that reduces the number of tokens needed to represent Portuguese text, thereby decreasing inference cost and improving context length efficiency.
  • Train the model end-to-end with a focus on maintaining compatibility with the original model’s embedding space despite tokenizer changes.
  • Evaluate performance using standard NLP benchmarks in both Portuguese and English to assess bilingual capabilities and robustness.
Figure 1: Tokenizer efficiency: the X axis show the number of tokens required to represent 7400 words of the Constitutional law of the USA in English, while the Y axis shows the same, but using a Portuguese translated version. The size of each sphere represents the vocabulary size of each tokenizer.
Figure 1: Tokenizer efficiency: the X axis show the number of tokens required to represent 7400 words of the Constitutional law of the USA in English, while the Y axis shows the same, but using a Portuguese translated version. The size of each sphere represents the vocabulary size of each tokenizer.

Experimental results

Research questions

  • RQ1Can a 3B-parameter language model fine-tuned with continuous pre-training on Portuguese data achieve performance comparable to larger 7B English models?
  • RQ2Does adapting the tokenizer specifically for Portuguese significantly reduce the number of tokens required to represent text, improving inference efficiency?
  • RQ3To what extent does the performance of a language-specific model trained via continuous pre-training with a new tokenizer match or exceed that of multilingual models in monolingual tasks?
  • RQ4How does the model’s performance on English benchmarks compare to that of English-optimized models, indicating bilingual capability and transfer learning potential?
  • RQ5Can the proposed methodology be generalized to other low-resource languages and model sizes without requiring full retraining from scratch?

Key findings

  • The openCabrita 3B model achieves performance on few-shot learning tasks that is comparable to both standard continuous pre-training approaches and 7B English models, despite having only half the parameters.
  • The new tokenizer reduces the number of tokens required to represent Portuguese text, significantly lowering inference cost and improving context efficiency.
  • In English benchmark evaluations, openCabrita 3B performs competitively—matching or exceeding models like GPT-J and LLaMA-7B on several tasks such as HellaSwag and PiQA, with only a minor drop in accuracy.
  • The model maintains consistent output quality across different tokenizers (Open Llama vs. Cabrita), indicating robustness and minimal degradation from tokenizer adaptation.
  • The performance of openCabrita 3B is on par with Sabiá-J (a 7B Portuguese model) and slightly behind Sabiá-7B, demonstrating strong results for a 3B model in a low-resource language setting.
  • The methodology is scalable and applicable to other base models and languages, as evidenced by promising results and the potential for extension to larger models and other underrepresented languages.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.