sapienzanlp/Minerva-7B-instruct-v1.0
<div style="text-align: center; display: flex; flex-direction: column; align-items: center;"> <img src="https://huggingface.co/sapienzanlp/Minerva-7B-instruct-v1.0/resolve/main/minerva-logo.png" style="max-width: 550px; height: auto;"> </div>
Model Card for Minerva-7B-instruct-v1.0
Minerva is the first family of LLMs pretrained from scratch on Italian developed by Sapienza NLP in the context of the Future Artificial Intelligence Research (FAIR) project, in collaboration with CINECA and with additional contributions from Babelscape and the CREATIVE PRIN Project. Notably, the Minerva models are truly-open (data and model) Italian-English LLMs, with approximately half of the pretraining data including Italian text.
Description
This is the model card for Minerva-7B-instruct-v1.0, a 7 billion parameter model trained on almost 2.5 trillion tokens (1.14 trillion in Italian, 1.14 trillion in English and 200 billion in code).
This model is part of the Minerva LLM family:
- Minerva-350M-base-v1.0
- Minerva-1B-base-v1.0
- Minerva-3B-base-v1.0
- Minerva-7B-base-v1.0
- Minerva-7B-instruct-v1.0
🚨⚠️🚨 Bias, Risks, and Limitations 🚨⚠️🚨
This section identifies foreseeable harms and misunderstandings.
This is a chat foundation model, subject to model alignment and safety risk mitigation strategies. However, the model may still:
- Overrepresent some viewpoints and underrepresent others
- Contain stereotypes
- Contain personal information
- Generate:
- Racist and sexist content
- Hateful, abusive, or violent language
- Discriminatory or prejudicial language
- Content that may not be appropriate for all settings, including sexual content
- Make errors, including producing incorrect information or historical facts as if it were factual
- Generate irrelevant or repetitive outputs
We are aware of the biases and potential problematic/toxic content that current pretrained large language models exhibit: more specifically, as probabilistic models of (Italian and English) languages, they reflect and amplify the biases of their training data. For more information about this issue, please refer to our survey:
How to use Minerva with Hugging Face transformers
import transformers
import torch
model_id = "sapienzanlp/Minerva-7B-instruct-v1.0"
# Initialize the pipeline.
pipeline = transformers.pipeline(
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
# Input text for the model.
input_conv = [{"role": "user", "content": "Qual è la capitale dell'Italia?"}]
# Compute the outputs.
output = pipeline(
input_conv,
max_new_tokens=128,
)
output[{'generated_text': [{'role': 'user', 'content': "Qual è la capitale dell'Italia?"}, {'role': 'assistant', 'content': "La capitale dell'Italia è Roma."}]}]
Model Architecture
Minerva-7B-base-v1.0 is a Transformer model based on the Mistral architecture. Please look at the configuration file for a detailed breakdown of the hyperparameters we chose for this model.
The Minerva LLM family is composed of:
Model Training
Minerva-7B-base-v1.0 was trained using llm-foundry 0.8.0 from MosaicML. The hyperparameters used are the following:
SFT Training
The SFT model was trained using Llama-Factory. The data mix was the following:
For more details, please check our tech page.
Online DPO Training
This model card is for our DPO model. Direct Preference Optimization (DPO) is a method that refines models based on user feedback, similar to Reinforcement Learning from Human Feedback (RLHF), but without the complexity of reinforcement learning. Online DPO further improves this by allowing real-time adaptation during training, continuously refining the model with new feedback. For training this model, we used the Hugging Face TRL library and Online DPO, with the Skywork/Skywork-Reward-Llama-3.1-8B-v0.2 model as the judge to evaluate and guide optimization. For this stage we used just the prompts from HuggingFaceH4/ultrafeedback_binarized (English), efederici/evol-dpo-ita (Italian) and Babelscape/ALERT translated to Italian, with additional manually curated data for safety.
For more details, please check our tech page.
Model Evaluation
For Minerva's evaluation process, we utilized ITA-Bench, a new evaluation suite to test the capabilities of Italian-speaking models. ITA-Bench is a collection of 18 benchmarks that assess the performance of language models on various tasks, including scientific knowledge, commonsense reasoning, and mathematical problem-solving.
<div style={{ display: 'flex', justifyContent: 'space-around' }}> <img src="https://huggingface.co/sapienzanlp/Minerva-7B-instruct-v1.0/resolve/main/Minerva%20LLMs%20Results.png" alt="Results on instructed models" style={{ width: '45%' }}></img> <img src="https://huggingface.co/sapienzanlp/Minerva-7B-instruct-v1.0/resolve/main/Minerva%20LLMs%20Results%20(1).png" alt="Results on instructed models" style={{ width: '45%' }}></img> </div>
<!-- Italian Data: --> <!-- | Task | Accuracy | | --- | --- | --> <!-- | xcopa (0-shot) | 0.694 | | Hellaswag (5-shot) | 0.5293 | | Belebele (5-shot) | 0.2333 | | TruthfulQA MC 1 (0-shot) | 0.2363 | | TruthfulQA MC 2 (0-shot) | 0.3731 | | M MMLU (5-shot) | 0.2612 | | arc challenge (5-shot) | 0.3268 | -->
<!-- English Data: --> <!-- | Task | Accuracy | | --- | --- | --> <!-- | Hellaswag (5-shot) | 0.6168 | | piqa (5-shot) | 0.7535 | | sciq (5-shot) | 0.925 | | Belebele (5-shot) | 0.2278 | | TruthfulQA MC 1 (0-shot) | 0.2142 | | TruthfulQA MC 2 (0-shot) | 0.3643 | | M MMLU (5-shot) | 0.263 | | arc challenge (5-shot) | 0.3319 | | arc easy (5-shot) | 0.6540 | -->
<!-- ## Training Data
Minerva-7B-base-v1.0 is trained on 1.14T Italian tokens, 1.14T English tokens, and 200B code tokens.
The training data is a mixture of the following datasets:
<!-- We have extracted some statistics on Italian (115B tokens) and English (210B tokens) documents from CulturaX on the selected sources:
Proportion of number of tokens per domain (Italian) <img src="https://github.com/Andrew-Wyn/images/blob/master/minerva/top25urltokensproportionculturaxit.png?raw=true" alt="italian-tok-counts" border="0" width="1800px">
Proportion of number of tokens per domain (English) <img src="https://github.com/Andrew-Wyn/images/blob/master/minerva/top25urltokensproportionculturaxen.png?raw=true" alt="english-tok-counts" border="0" width="1800px"> -->
Tokenizer Fertility
The tokenizer fertility measures the average amount of tokens produced per tokenized word. A tokenizer displaying high fertility values in a particular language typically indicates that it segments words in that language extensively. The tokenizer fertility is strictly correlated with the inference speed of the model with respect to a specific language, as higher values mean longer sequences of tokens to generate and thus lower inference speed.
Fertility computed over a sample of Cultura X (CX) data and Wikipedia (Wp):
<!-- ## Notice
Minerva-7B-base-v1.0 is a pretrained base model and, therefore, has no moderation mechanisms. -->
The Sapienza NLP Team
🧭 Project Lead and Coordination
- _Roberto Navigli_: project lead and coordination; model analysis, evaluation and selection, safety and guardrailing, conversations.
🤖 Model Development
- _Edoardo Barba_: pre-training, post-training, data analysis, prompt engineering.
- _Simone Conia_: pre-training, post-training, evaluation, model, and data analysis.
- _Pere-Lluís Huguet Cabot_: data processing, filtering,g and deduplication, preference modeling.
- _Luca Moroni_: data analysis, evaluation, post-training.
- _Riccardo Orlando_: pre-training process and data processing.
👮 Safety and Guardrailing
- _Stefan Bejgu_: safety and guardrailing.
- _Federico Martelli_: synthetic prompt generation, model and safety analysis.
- _Ciro Porcaro_: additional safety prompts.
- _Alessandro Scirè_: safety and guardrailing.
- _Simone Stirpe_: additional safety prompts.
- _Simone Tedeschi_: English dataset for safety evaluation.
Special thanks for their support
- Giuseppe Fiameni, Nvidia
- Sergio Orlandini, CINECA
Acknowledgments
This work was funded by the PNRR MUR project PE0000013-FAIR and the CREATIVE PRIN project, which is funded by the MUR Progetti di Rilevante Interesse Nazionale programme (PRIN 2020). We acknowledge the CINECA award "IscB_medit" under the ISCRA initiative for the availability of high-performance computing resources and support.
