Edit model card

NOTE: CataLlama-v0.2 is out. Please use that one instead.

NOTE: CataLlama-v0.2 is out. Please use that one instead.

CataLlama-v0.1-Instruct-DPO

CataLlama-v0.1-Instruct-DPO is a DPO fine-tune of catallama/CataLlama-v0.1-Instruct-SFT on the catallama/Catalan-DPO dataset.

CataLlama was trained on roughly 445 million new tokens in three separate stages. This is the 3rd and final stage of the training.

The model shows improved proficiency with the Catalan language.

This is an instruction fine-tuned model, optimised with DPO, proficient on the following tasks in Catalan

  • Information extraction (suitable for RAG)
  • Named Entity Recognition (NER)
  • Translation from English to Catalan and Catalan to English
  • Summarization - both short form and long form
  • Sentiment analysis

Model developers Laurentiu Petrea based on Llama-3 from Meta.

Model Architecture CataLlama is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and direct preference optimisation (DPO) to align with human preferences for helpfulness and safety.

License The model uses the llama-3 license available at: https://llama.meta.com/llama3/license

Benchmarks

Benchmark Value
MMLU 5 shot 47.34
GSM8K cot 8 shot 43.29

Use with transformers

See the snippet below for usage with Transformers:

The model follows the same prompt template as Llama-3 Instruct

import transformers
import torch

model_id = "catallama/CataLlama-v0.1-Instruct-DPO"

pipeline = transformers.pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device_map="auto",
)

messages = [
    {"role": "user", "content": "Ei com estàs avui?"},
]

prompt = pipeline.tokenizer.apply_chat_template(
    messages, 
    tokenize=False, 
    add_generation_prompt=True
)

outputs = pipeline(
    prompt,
    max_new_tokens=1024,
    do_sample=True,
    temperature=0.6,
    top_p=0.9,
)

print(outputs[0]["generated_text"][len(prompt):])

Actual Inference Examples

Prompt: Pot Donald Trump sopar amb Juli Cèsar?

Answer: No, Donald Trump no podria sopar amb Juli Cèsar, ja que Juli Cèsar va morir fa més de 2.000 anys i, per tant, no està viu per a poder sopar amb ell. A més, Juli Cèsar va ser un personatge històric i polític de l'antiga Roma, mentre que Donald Trump és el 45è president dels Estats Units, personatges que pertanyen a dues èpoques i cultures diferents. Per tant, la idea de que poguessin sopar junts és absurda i no té cap sentit històric ni lògic.
Prompt: A quina velocitat poden volar els cocodrils?

Answer: Els cocodrils no poden volar, ja que no tenen ales ni cap estructura que els permeti elevar-se per l'aire. Aquestes criatures aquàtiques depenen de la seva força i agilitat per moure's i caçar preses a terra ferma o al riu. No obstant això, poden assolir velocitats notables quan es tracta de fugir o perseguir una presa. El cocodril més ràpid, el cocodril negre africà, pot arribar a assolir velocitats de fins a 40 km/h en terra ferma, tot i que la seva velocitat a l'aigua és molt menor.
Prompt: Explica pas a pas com resoldre l'equació següent: 2x + 10 = 0

Answer:
Per resoldre l'equació 2x + 10 = 0, segueix els passos següents:

1. Aïllar la variable: per fer-ho, hem de restar 10 de tots dos costats de l'equació. Així, tenim:

2x = -10

2. Dividir tots dos costats per 2: això ens permet obtenir una equació en forma d'una sola incògnita. Així, tenim:

x = -5

3. Comprovar: sempre és recomanable comprovar la solució en l'equació original. Substituint x = -5 en 2x + 10 = 0, obtenim:

2(-5) + 10 = -10 + 10 = 0

Com que l'equació es compleix, la solució x = -5 és vàlida.

Training procedure

The model was trained with the same prompt template of Llama-3 Instruct.

The model was trained for two epochs on 4x A100 80GB GPUs using DeepSpeed ZeRO State-3 without CPU offloading.

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 5e-07
  • distributed_type: multi-GPU
  • num_devices: 4
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • lr_scheduler_warmup_steps: 100
  • num_epochs: 1

Intended Use

Note: This model is not intended to beat benchmarks, but to demonstrate techniques for augmenting LLMs on new languages and preserve rare languages as part of our world heritage.

Intended Use Cases Llama 3 is intended for commercial and research use in English. Instruction tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks.

Out-of-scope Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in any other way that is prohibited by the Acceptable Use Policy and Llama 3 Community License. Use in languages other than English**.

**Note: Developers may fine-tune Llama 3 models for languages beyond English provided they comply with the Llama 3 Community License and the Acceptable Use Policy.

Downloads last month
32
Safetensors
Model size
8.03B params
Tensor type
BF16
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for catallama/CataLlama-v0.1-Instruct-DPO

Finetuned
(1)
this model
Quantizations
1 model

Dataset used to train catallama/CataLlama-v0.1-Instruct-DPO

Collection including catallama/CataLlama-v0.1-Instruct-DPO