/ Модель

Характеристики

Контекст
8 192 токена
Параметры
7,5 млрд
Размер весов
16,1 ГБ
Лицензия
CC BY-NC 4.0
Архитектура
llama · dense
Опубликована
30 июн 2024

llama-3-meerkat-8b-v1.0

Генерация текстаТекст → текст3 профессии

Meerkat-8B — дообученная медицинская языковая модель для ответов на медицинские вопросы и решения экзаменационных задач.

854скачиваний за 30 дней10лайковвеса обновлены7 мая 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Meerkat-8B версии 1.0 — медицинская диалоговая модель семейства Meerkat, разработанная на основе Meta Llama-3-8B-Instruct и дообученная на синтетических рассуждениях по 18 медицинским учебникам и наборах инструкций. Это плотная авторегрессионная модель Llama с 7,5 млрд параметров, рассчитанная на контекст до 8192 токенов и работающая с текстом.

Модель предназначена для ответов на медицинские вопросы, решения задач формата USMLE и других тестов с выбором ответа, а также для следования разнообразным инструкциям. В README описана оценка на семи медицинских бенчмарках, включая MedQA, MedMCQA и MMLU-Medical. Лицензия CC BY-NC 4.0 разрешает использование с указанием авторства, но ограничивает коммерческое применение.

Модель может помогать разбирать учебные и экзаменационные задачи, однако её ответы не следует считать заменой профессиональной медицинской оценки. Результаты зависят от формулировки запроса; для воспроизведения результатов бенчмарков авторы рекомендуют использовать системные сообщения, применявшиеся при обучении.

Сценарии применения

  • решение вопросов формата USMLE
  • ответы на медицинские тесты с выбором ответа
  • подготовка к MedQA и MedMCQA
  • разбор учебных вопросов по медицине
  • ответы на инструкции по медицинской тематике

Ограничения

Ответы могут содержать ошибки и не заменяют консультацию медицинского специалиста. Для воспроизведения результатов бенчмарков рекомендуется использовать системные сообщения из обучения; лицензия запрещает коммерческое использование.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Meerkat-8B (Version 1.0)

🚀 Meerkat-8B is a new instruction-tuned medical AI system of the Meerkat model family. The model was based on the Meta's Llama-3-8B-Instruct model and fine-tuned using our new synthetic dataset consisting of high-quality chain-of-thought reasoning paths sourced from 18 medical textbooks, along with diverse instruction-following datasets. This equips the model with high-level medical reasoning capabilities required for solving complex medical problems. For further insights into our model, please refer to our paper!

📄 Paper: Small Language Models Learn Enhanced Reasoning Skills from Medical Textbooks

Quick Start

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "dmis-lab/llama-3-meerkat-8b-v1.0"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,  # You can choose to use this when there's not enough GPU memory available.
    device_map="auto",
)

# Multi-turn dialogue example
messages =[
    {"role": "system", "content": "You are a helpful doctor or healthcare professional. Guide the conversation to provide useful, complete, and scientifically-grounded answers to user questions. You have the option to compose a concise, single-turn conversation if the user's input is comprehensive to provide accurate answers. However, if essential details are missing, you should engage in a multi-turn dialogue, asking follow-up questions to gather a thorough medical history and records.\n\n"},
    {"role": "user", "content": "Hello, doctor. I'm really concerned about my 10-year-old son. We recently discovered a painless mass in his left testicle, so we brought him to the pediatrician."},
    {"role": "assistant", "content": "I understand your concern. Let's gather some more information. Has your son experienced any other symptoms along with the mass?"},
    {"role": "user", "content": "Other than the mass, my son hasn't shown any symptoms. He's been his usual self, playing and eating normally."}
]

input_ids = tokenizer.apply_chat_template(
    messages,
    add_generation_prompt=True,
    return_tensors="pt"
).to(model.device)

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

outputs = model.generate(
    input_ids,
    max_new_tokens=1000,
    eos_token_id=terminators,
    do_sample=True,
    temperature=0.7,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))

Prompt Details

To reproduce the results reported in our paper, it is advisable to utilize the identical system messages used during model training. Please refer to the guidelines detailed below.

USMLE

When solving USMLE-style questions such as MedQA and MedBullets, use the following system message:

messages = [
    {"role": "system", "content": "The following is a multiple-choice question about medical knowledge. Solve this in a step-by-step fashion, starting by summarizing the available information. Output a single option from the given options as the final answer. You are strongly required to follow the specified output format; conclude your response with the phrase \"the answer is ([option_id]) [answer_string]\".\n\n"},
    {"role": "user", "content": "Two weeks after undergoing an emergency cardiac catherization with stenting for unstable angina pectoris, a 61-year-old man has decreased urinary output and malaise. He has type 2 diabetes mellitus and osteoarthritis of the hips. Prior to admission, his medications were insulin and naproxen. He was also started on aspirin, clopidogrel, and metoprolol after the coronary intervention. His temperature is 38\u00b0C (100.4\u00b0F), pulse is 93/min, and blood pressure is 125/85 mm Hg. Examination shows mottled, reticulated purplish discoloration of the feet. Laboratory studies show:\nHemoglobin count 14 g/dL\nLeukocyte count 16,400/mm3\nSegmented neutrophils 56%\nEosinophils 11%\nLymphocytes 31%\nMonocytes 2%\nPlatelet count 260,000/mm3\nErythrocyte sedimentation rate 68 mm/h\nSerum\nUrea nitrogen 25 mg/dL\nCreatinine 4.2 mg/dL\nRenal biopsy shows intravascular spindle-shaped vacuoles. Which of the following is the most likely cause of this patient's symptoms?\" (A) Renal papillary necrosis (B) Cholesterol embolization (C) Eosinophilic granulomatosis with polyangiitis (D) Polyarteritis nodosa"},
]

The model generates reasoning paths to solve the problem and then sequentially provides the predicted answers. Since the model ends its response with "the answer is," it is straightforward to extract the predicted answer for comparison with the actual answer.

Multiple-choice Exams

For other types of multiple-choice exams such as MedMCQA or MMLU, use the following simple system message:

messages = [
    {"role": "system", "content": "Answer the multiple-choice question about medical knowledge.\n\n"},
    {"role": "user", "content": "In a Robertsonian translocation fusion occurs at the: (A) telomeres. (B) centromeres. (C) histones. (D) ends of the long arms."},
]

Other Use Cases

Our model was trained using the AlpaCare instruction dataset comprising 52K examples, to enhance its generalization capabilities across diverse user prompts. Feel free to design and test your prompts and to share your thoughts with us, whether the model exceeds expectations or falls short!

Reproducing MedQA Performance with vLLM

Here is an example code for fast model evaluation in MedQA using vLLM. To adapt this code for other datasets like MedMCQA or MMLU, simply modify the instructions and update the dataset paths as needed.

import re
from datasets import load_dataset
from vllm import LLM, SamplingParams
USMLE_INSTRUCTION = (
    "The following is a multiple-choice question about medical knowledge. Solve this in"
    " a step-by-step fashion, starting by summarizing the available information. Output"
    " a single option from the given options as the final answer. You are strongly"
    " required to follow the specified output format; conclude your response with the"
    ' phrase "the answer is ([option_id]) [answer_string]".\n\n'
)
llm = LLM(
    model="dmis-lab/llama-3-meerkat-8b-v1.0",
    dtype="bfloat16",
    gpu_memory_utilization=0.9,
    max_model_len=2048,
    trust_remote_code=True,
    tensor_parallel_size=1
)

tokenizer = llm.get_tokenizer()

inputs, labels = [], []
for sample in load_dataset(
    "GBaker/MedQA-USMLE-4-options", split="test", trust_remote_code=True
):
    options = sorted(sample["options"].items())
    options = " ".join(map(lambda x: f"({x[0]}) {x[1]}", options))
    content = tokenizer.apply_chat_template(
        [{"role": "system", "content": USMLE_INSTRUCTION}, {"role": "user", "content": sample["question"] + " " + options}],
        add_generation_prompt=True,
        tokenize=False,
    )
    inputs.append(content)
    labels.append(sample["answer_idx"])

generated = llm.generate(
    inputs,
    SamplingParams(
        temperature=0.0,
        stop_token_ids=[tokenizer.vocab["<|eot_id|>"]],
        max_tokens=1024,
    ),
)
def extract_answer(text: str, options: str = "ABCD") -> str:
    return (re.findall(rf"he answer is \(([{options}])\)", text) or [options[0]])[-1]

correctness = []

for g, l in zip(generated, labels):
    correctness.append(extract_answer(g.outputs[0].text) == l)

print(sum(correctness) / len(correctness))

Evaluation

We tested models on seven medical benchmarks: MedQA, USMLE sample test, Medbullets-4, Medbullets-5 , MedMCQA, MMLU-Medical, and JAMA Clinical Challenge.

ModelAverageMedQAUSMLEMedbullets-4Medbullets-5MedMCQAMMLU-Medical
GPT-476.681.486.668.863.372.487.1
GPT-3.554.853.658.551.047.451.067.3
MediTron-70B (Ensemble, 5 runs)-70.2---66.078.0
Open-source (7B)
MediTron-7B51.050.244.651.145.557.956.7
BioMistral-7B55.454.351.452.348.761.164.6
Meerkat-7B62.670.670.358.752.960.670.5
Meerkat-8B (New)67.374.074.262.355.562.775.2

Please note that the scores in MMLU-Medical were calculated based on the average accuracies across six medical-related subjects in the original MMLU benchmark, and each result for a single subject is presented below.

ModelAverageCliniq KnowledgeMedical GeneticsAnatomyProfessional MedicineCollege BiologyCollege Medicine
GPT-487.186.492.080.093.893.876.3
GPT-3.567.368.768.060.769.972.963.6
MediTron-70B (Ensemble, 5 runs)78.075.585.969.482.386.768.0
Open-source (7B)
MediTron-7B56.757.763.856.956.057.148.9
BioMistral-7B64.659.964.056.560.459.054.7
Meerkat-7B70.571.674.863.277.370.865.2
Meerkat-8B (New)75.274.376.774.875.376.174.3

Reference

Please see the information below to cite our paper.

@article{kim2025small,
  title={Small language models learn enhanced reasoning skills from medical textbooks},
  author={Kim, Hyunjae and Hwang, Hyeon and Lee, Jiwoo and Park, Sihyeon and Kim, Dain and Lee, Taewhoo and Yoon, Chanwoong and Sohn, Jiwoong and Park, Jungwoo and Reykhart, Olga and Fetherston, Thomas and Choi, Donghee and Kwak, Soo Heon and Chen, Qingyu and Kang, Jaewoo},
  journal={npj Digital Medicine},
  volume={8},
  number={1},
  pages={240},
  year={2025},
  publisher={Nature Publishing Group UK London}
}

Acknowledgement

Research supported with Cloud TPUs from Google’s TPU Research Cloud (TRC).

Contact

Feel free to email hyunjae-kim@korea.ac.kr or hyunjae.kim@yale.edu if you have any questions.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Можно запустить

Подбираем GPU…

Класс архитектуры
LlamaForCausalLM
Ревизия весов
ba8405f

0 моделей