đ Aloe: A Family of Fine-tuned Open Healthcare LLMs
Aloe is a family of fine - tuned open healthcare LLMs. It achieves state - of - the - art performance on several medical tasks. With different model sizes and trained on 20 medical tasks, it's a robust and versatile healthcare model.
đ Quick Start
Use the code below to get started with the model. You can run conversational inference using the Transformers pipeline abstraction, or by leveraging the Auto classes with the generate()
function.
đģ Usage Examples
Basic Usage
import transformers
import torch
model_id = "HPAI-BSC/Llama3.1-Aloe-Beta-8B"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
messages = [
{"role": "system", "content": "You are an expert medical assistant named Aloe, developed by the High Performance Artificial Intelligence Group at Barcelona Supercomputing Center(BSC). You are to be a helpful, respectful, and honest assistant."},
{"role": "user", "content": "Hello."},
]
prompt = pipeline.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
prompt,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9,
)
print(outputs[0]["generated_text"][len(prompt):])
Advanced Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "HPAI-BSC/Llama3.1-Aloe-Beta-8B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "You are an expert med
⨠Features
- Multiple Model Sizes: Aloe Beta is available in four model sizes: 7B, 8B, 70B, and 72B.
- Trained on Diverse Medical Tasks: Trained on 20 medical tasks, resulting in a robust and versatile healthcare model.
- High Performance: Evaluations show Aloe models to be among the best in their class. When combined with a RAG system, it can achieve or even outperform closed - source models.
- Enhanced in Beta Version: The Beta version triples the training data compared to the Alpha version, includes more diverse medical tasks and instructions, and boosts alignment and safety stages.
đ Documentation
Model Details
Model Description
Property |
Details |
Developed by |
HPAI |
Model Type |
Causal decoder - only transformer language model |
Language(s) (NLP) |
English (capable but not formally evaluated on other languages) |
License |
This model is based on Meta Llama 3.1 8B and is governed by the Meta Llama 3 License. All modifications are available with a CC BY 4.0 license, making the Aloe Beta models compatible with commercial use. |
Base model |
[meta - llama/Llama - 3.1 - 8B](https://huggingface.co/meta - llama/Llama - 3.1 - 8B) |
Paper |
(more coming soon) |
RAG Repository |
https://github.com/HPAI-BSC/prompt_engine |
Model Sources [optional]
Model Performance
Aloe Beta has been tested on the most popular healthcare QA datasets, with and without Medprompt inference technique. Results show competitive performance, achieving SOTA within models of the same size. It has also been evaluated in many different medical tasks and in the general domain using the OpenLLM Leaderboard benchmark, getting competitive results.
Uses
Direct Use
We encourage the use of Aloe for research purposes, as a stepping stone to build better foundational models for healthcare. In production, Aloe should always be used under the supervision of a human expert.
Out - of - Scope Use
These models are not to be used for clinical practice, medical diagnosis, or any other form of direct or indirect healthcare advice. Models are prone to error and can produce toxic content. The use of Aloe models for activities harmful to individuals, such as spam, fraud, or impersonation, is strictly prohibited. Minors should not be left alone to interact with Aloe without supervision.
Bias, Risks, and Limitations
Aloe can produce toxic content under the appropriate prompts and includes multiple undesirable biases. We identify at least three risk cases specific to healthcare LLMs:
- Healthcare professional impersonation: A model like Aloe could be used to increase the efficacy of such deceiving activities. Preventive actions include public literacy and legislation.
- Medical decision - making without professional supervision: Aloe can facilitate self - delusion. Public literacy and disclaimers are main defenses.
- Access to information on dangerous substances or procedures: LLMs can centralize access to such information. Model alignment can help but is insufficient.
đ License
This model is based on Meta Llama 3.1 8B and is governed by the Meta Llama 3 License. All our modifications are available with a CC BY 4.0 license, making the Aloe Beta models compatible with commercial use.