đ 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 based on Llama3.1 and Qwen2.5, it offers robust and versatile solutions for healthcare research.
⨠Features
- Multiple Model Sizes: Available in 7B, 8B, 70B, and 72B versions.
- Diverse Training: Trained on 20 medical tasks, resulting in a well - rounded healthcare model.
- High Performance: Evaluations show it ranks among the best in its class. When combined with a RAG system, it can achieve or outperform closed models.
- Enhanced Safety: Boosted alignment and safety stages compared to its predecessor, with a medical preference dataset and red - teaming dataset (coming soon).
đĻ Installation
No installation steps are provided in the original document.
đģ Usage Examples
Basic Usage
import transformers
import torch
model_id = "HPAI-BSC/Qwen2.5-Aloe-Beta-72B"
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("<|im_end|>")
]
outputs = pipeline(
prompt,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.7,
top_p=0.8,
top_k=20,
repetition_penalty=1.05
)
print(outputs[0]["generated_text"][len(prompt):])
Advanced Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "HPAI-BSC/Qwen2.5-Aloe-Beta-72B"
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 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."},
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors='pt').to(model.device)
output = model.generate(input_ids, max_new_tokens=256, temperature=0.7, top_p=0.8, top_k=20, repetition_penalty=1.05)
print(tokenizer.decode(output[0], skip_special_tokens=True))
đ 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 Qwen2.5-72B which is released with a Qwen custom license. All modifications are available with a CC BY 4.0 license, making the Aloe Beta models compatible with commercial use. |
Base model |
Qwen2.5-72B |
Paper |
(more coming soon) |
RAG Repository |
https://github.com/HPAI-BSC/prompt_engine |
Model Sources [optional]
No content provided in the original document.
Model Performance
Aloe Beta has been tested on popular healthcare QA datasets, with and without the Medprompt inference technique. It shows competitive performance and achieves SOTA within models of the same size. It has also been evaluated in multiple medical tasks and in the general domain using the OpenLLM Leaderboard benchmark, getting competitive results with current SOTA general models and outperforming medical models.
Uses
Direct Use
Aloe is encouraged for research purposes as a step to build better foundational models for healthcare. In production, it should be used under the supervision of a human expert.
Out-of-Scope Use
These models should not be used for clinical practice, medical diagnosis, or any form of direct or indirect healthcare advice. They are prone to error and can produce toxic content. Using Aloe models for harmful activities such as spam, fraud, or impersonation is strictly prohibited. Minors should not interact with Aloe without supervision.
Bias, Risks, and Limitations
Aloe can produce toxic content and has multiple undesirable biases. Although efforts were made to mitigate this, model safety cannot be fully guaranteed. At least three healthcare - specific risk cases are identified:
- Healthcare professional impersonation: Aloe could be misused to increase the efficacy of fraudulent activities. Preventive actions include public literacy and legislation on AI - generated content disclaimers.
- Medical decision - making without professional supervision: Aloe's high - quality conversational data can facilitate self - delusion. Public literacy on self - diagnosis dangers and output disclaimers are important defenses.
- Access to information on dangerous substances or procedures: LLMs can centralize access to sensitive information, and current alignment efforts are insufficient to control it.
đ§ Technical Details
No specific technical details (more than 50 words of specific technical description) are provided in the original document.
đ License
This model is based on Qwen2.5-72B which is released with a Qwen custom license. All modifications are available with a CC BY 4.0 license, making the Aloe Beta models compatible with commercial use.