model-index:
- name: lince-zero
results: []
license: apache-2.0
language:
- es
thumbnail: https://huggingface.co/clibrain/lince-zero/resolve/main/LINCE-CLIBRAIN-HD.jpg
pipeline_tag: text-generation
datasets:
- tatsu-lab/alpaca
- databricks/databricks-dolly-15k
library_name: transformers
LINCE ZERO (Llm for Instructions from Natural Corpus en Español) is a state-of-the-art Spanish instruction language model. Developed by Clibrain, it is a causal decoder-only model with 7B parameters. LINCE-ZERO is based on Falcon-7B and has been fine-tuned using an augmented combination of the Alpaca and Dolly datasets, both translated into Spanish.
The model is released under the Apache 2.0 license.
Model Card for LINCE-ZERO
Table of Contents
- Model Details
- Uses
- Bias, Risks, and Limitations
- Training Details
- Evaluation
- Model Examination
- Environmental Impact
- Technical Specifications
- Citation
- Contact
- How to Get Started with the Model
Model Details
Model Description
LINCE-ZERO (Llm for Instructions from Natural Corpus en Español) is a state-of-the-art Spanish instruction language model. Developed by Clibrain, it is a causal decoder-only model with 7B parameters. LINCE-ZERO is based on **Falcon-7B** and has been fine-tuned using an augmented combination of the Alpaca and Dolly datasets, both translated into Spanish.
- Developed by: Clibrain
- Model type: Language model, instruction model, causal decoder-only
- Language(s) (NLP): es
- License: apache-2.0
- Parent Model: https://huggingface.co/tiiuae/falcon-7b
- Resources for more information: Paper coming soon
Model Sources
- Paper: Coming soon!
- Demo: Coming soon!
Uses
Direct Use
LINCE-ZERO's fine-tuning on an instructions dataset enables it to follow natural language instructions in Spanish. The direct use cases include virtual assistants and content generation.
Please note that running inference with LINCE-ZERO efficiently requires a minimum of XGB of memory.
Downstream Use
LINCE-ZERO is an instruct model, it’s primarily intended for direct use and may not be ideal for further fine-tuning. It serves as a general model suitable for a wide range of applications. However, for specific use cases within certain domains, fine-tuning with domain-specific data may improve LINCE-ZERO's performance.
Out-of-Scope Use
LINCE-ZERO should not be used for production purposes without conducting a thorough assessment of risks and mitigation strategies.
Bias, Risks, and Limitations
LINCE-ZERO has limitations associated with both the underlying language model and the instruction tuning data. It is crucial to acknowledge that predictions generated by the model may inadvertently exhibit common deficiencies of language models, including hallucination, toxicity, and perpetuate harmful stereotypes across protected classes, identity characteristics, and sensitive, social, and occupational groups.
Since the model has been fine-tuned on translated versions of the Alpaca and Dolly datasets, it has potentially inherited certain limitations and biases:
- Alpaca: The Alpaca dataset is generated by a language model (
text-davinci-003
) and inevitably contains some errors or biases inherent in that model. As the authors report, hallucination seems to be a common failure mode for Alpaca, even compared to text-davinci-003. - Dolly: The Dolly dataset incorporates information from Wikipedia, which is a crowdsourced corpus. Therefore, the dataset's contents may reflect the biases, factual errors, and topical focus present in Wikipedia. Additionally, annotators involved in the dataset creation may not be native English speakers, and their demographics and subject matter may reflect the makeup of Databricks employees.
Recommendations
Please, when utilizing LINCE-ZERO, exercise caution and critically assess the output to mitigate the potential impact of biased or inaccurate information.
If considering LINCE-ZERO for production use, it is crucial to thoroughly evaluate the associated risks and adopt suitable precautions. Conduct a comprehensive assessment to address any potential biases and ensure compliance with legal and ethical standards.
Training Details
Training Data
LINCE-ZERO is based on Falcon-7B and has been fine-tuned using an augmented combination of the Alpaca and Dolly datasets, both translated into Spanish.
Alpaca is a 24.2 MB dataset of 52,002 instructions and demonstrations in English. It was generated by OpenAI's text-davinci-003
engine using the data generation pipeline from the Self-Instruct framework with some modifications. For further details, refer to Alpaca's Data Card.
Dolly is a 13.1 MB dataset of 15,011 instruction-following records in American English. It was generated by thousands of Databricks employees, who were requested to provide reference texts copied from Wikipedia for specific categories. To learn more, consult Dolly’s Data Card.
Training Procedure
For detailed information about the model architecture and compute infrastructure, please refer to the Technical Specifications section.
Preprocessing
To prepare the training data, both the Alpaca and Dolly datasets, originally in English, were translated into Spanish using …
The data was tokenized using LINCE-ZERO’s tokenizer, which is based on the Falcon-7B/40B tokenizer.
Training Hyperparameters
More information needed
Speeds, Sizes, Times
More information needed (throughput, start/end time, checkpoint size if relevant, etc.)
Evaluation
Testing Data, Factors & Metrics
Testing Data
The model has been tested on a X% of the augmented combination of Alpaca (24.2 MB) and Dolly (13.1 MB) translated into Spanish.
Metrics
Since LINCE-ZERO is an instruction model, the metrics used to evaluate it are:
- X:
Results
Paper coming soon. Meanwhile, check the OpenLLM Leaderboard.
Technical Specifications
Model Architecture and Objective
LINCE-ZERO is a causal decoder-only model trained on a causal language modeling task. Its objective is to predict the next token in a sequence based on the context provided.
The architecture of LINCE-ZERO is based on Falcon-7B, which itself is adapted from the GPT-3 paper (Brown et al., 2020) with the following modifications:
- Positional embeddings: rotary (Su et al., 2021);
- Attention: multiquery (Shazeer et al., 2019) and FlashAttention (Dao et al., 2022);
- Decoder-block: parallel attention/MLP with a single-layer norm.
Compute Infrastructure
Hardware
LINCE-ZERO was trained on AWS SageMaker, on ... GPUs in ... instances.
Software
More information needed
Environmental Impact
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: More information needed
- Hours used: More information needed
- Cloud Provider: More information needed
- Compute Region: More information needed
- Carbon Emitted: More information needed
Citation
There is a paper coming soon! Meanwhile, when using LINCE-ZERO please use the following information to cite:
@article{lince-zero,
title={{LINCE}: Llm for Instructions from Natural Corpus en Español},
author={},
year={2023}
}
Contact
How to Get Started with LINCE-ZERO
Use the code below to get started with LINCE-ZERO 🔥
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoTokenizer
model_id = "clibrain/lince-zero"
model = AutoModelForCausalLM.from_pretrained(model_id).to("cuda")
tokenizer = AutoTokenizer.from_pretrained(model_id)
def create_instruction(instruction, input_data=None, context=None):
sections = {
"Instrucción": instruction,
"Entrada": input_data,
"Contexto": context,
}
system_prompt = "A continuación hay una instrucción que describe una tarea, junto con una entrada que proporciona más contexto. Escriba una respuesta que complete adecuadamente la solicitud.\n\n"
prompt = system_prompt
for title, content in sections.items():
if content is not None:
prompt += f"### {title}:\n{content}\n\n"
prompt += "### Respuesta:\n"
return prompt
def generate(
instruction,
input=None,
context=None,
max_new_tokens=128,
temperature=0.1,
top_p=0.75,
top_k=40,
num_beams=4,
**kwargs
):
prompt = create_instruction(instruction, input, context)
print(prompt)
inputs = tokenizer(prompt, return_tensors="pt")
input_ids = inputs["input_ids"].to("cuda")
attention_mask = inputs["attention_mask"].to("cuda")
generation_config = GenerationConfig(
temperature=temperature,
top_p=top_p,
top_k=top_k,
num_beams=num_beams,
**kwargs,
)
with torch.no_grad():
generation_output = model.generate(
input_ids=input_ids,
attention_mask=attention_mask,
generation_config=generation_config,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=max_new_tokens,
early_stopping=True
)
s = generation_output.sequences[0]
output = tokenizer.decode(s)
return output.split("### Respuesta:")[1].lstrip("\n")
instruction = "Dame una lista de lugares a visitar en España."
print(generate(instruction))