初始化项目,由ModelHub XC社区提供模型

Model: HiTZ/Marmoka-en-Llama-3.1-8B-Instruct
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-10-22 13:55:16 +08:00
commit e2cfa45347
12 changed files with 2415 additions and 0 deletions

36
.gitattributes vendored Normal file
View File

@@ -0,0 +1,36 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
tokenizer.json filter=lfs diff=lfs merge=lfs -text

223
README.md Normal file
View File

@@ -0,0 +1,223 @@
---
license: apache-2.0
language:
- en
base_model: meta-llama/Llama-3.1-8B-Instruct
library_name: transformers
pipeline_tag: text-generation
datasets:
- HiTZ/Magpie-Llama-3.1-70B-Instruct-Filtered
tags:
- biomedical
- medical
- clinical
- english
- llama-3.1
- continual-pretraining
- merge
widget:
- messages:
- role: user
content: >-
A 55-year-old man presents with crushing substernal chest pain radiating
to the left arm. Which is the most appropriate initial diagnostic test?
A) Chest X-ray
B) 12-lead ECG
C) Abdominal ultrasound
D) Spirometry
Answer with only the letter of the correct option.
- messages:
- role: user
content: Explain the mechanism of action of metformin in type 2 diabetes.
- messages:
- role: user
content: What are the most common adverse effects of ACE inhibitors?
---
<br>
<div style="text-align: center;">
<img src="https://cdn-uploads.huggingface.co/production/uploads/6560b3ac1338610184656ce0/D60kuTYUI-B7xwf9ep6vD.png" style="height: 175px;display: block;margin-left: auto;margin-right: auto;">
</div>
<h1 style="text-align: center;">
<b>Marmoka-en</b>
<br>
A Lightweight English Clinical Large Language Model
<br>
Built on Llama 3.1
</h1>
<br>
<p style="text-align: justify;">
Marmoka is a family of lightweight 8B-parameter clinical LLMs for English and Spanish. Marmoka-en is the English member of the family. It was developed through continual domain-adaptive pretraining (DAPT) of Llama-3.1-8B-Instruct on English medical corpora, mixed with general-domain instructions to preserve its instruction-following ability. Under a perturbation-based evaluation on English clinical multiple-choice QA, Marmoka-en matches or slightly improves on its general-purpose counterpart.
</p>
- 📖 Paper: [To Adapt or not to Adapt, Rethinking the Value of Medical Knowledge-Aware Large Language Models](https://arxiv.org/abs/2604.06854)
## How to Get Started with the Model
You can use the model with the `transformers` pipeline (it uses the Llama 3.1 chat template):
```python
import torch
from transformers import pipeline
pipe = pipeline(
"text-generation",
model="HiTZ/Marmoka-en-Llama-3.1-8B-Instruct",
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a medical expert. Answer the multiple-choice question with only the letter of the correct option."},
{"role": "user", "content": "Which vitamin deficiency causes scurvy?\nA) Vitamin A\nB) Vitamin B12\nC) Vitamin C\nD) Vitamin D"},
]
outputs = pipe(messages, max_new_tokens=256)
print(outputs[0]["generated_text"][-1]["content"])
```
# Model Description
- **Developed by**: Ane G. Domingo-Aldama, Iker De La Iglesia, Maitane Urruela, Aitziber Atutxa, and Ander Barrena
- **Contact**: [Ane G. Domingo-Aldama](mailto:ane.garciad@ehu.eus) and [Iker De La Iglesia](mailto:iker.delaiglesia@ehu.eus)
- **Language(s) (NLP)**: English
- **License**: apache-2.0
- **Funding**:
- The Spanish Ministry of Science, Innovation and Universities, MCIN/AEI/10.13039/501100011033 projects:
- EDHIA PID2022-136522OB-C22 (also supported by FEDER, UE).
- TRUST-MED PID2025-174880OB-I00 (also supported by FEDER, UE).
- DeepR3 TED2021-130295B-C31 (also supported by the European Union NextGenerationEU/PRTR).
- Basque Government:
- Research group funding IT1570-22.
- HiTZ Center.
- Predoctoral grants: FPU23/03347 (I. De La Iglesia, Spanish Ministry of Science, Innovation and Universities), PRE_2024_1_0224 (A. G. Domingo-Aldama) and PRE_2025_1_0177 (M. Urruela), Basque Government.
## Model Details
<table style="border: 1px; border-collapse: collapse;">
<caption>Training settings for Marmoka-en.</caption>
<tbody>
<tr>
<td>Param. no.</td>
<td>~8B</td>
</tr>
<tr>
<td>Architecture</td>
<td>Llama 3.1 (decoder-only)</td>
</tr>
<tr>
<td>Base model</td>
<td><a href="https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct">Llama-3.1-8B-Instruct</a></td>
</tr>
<tr>
<td>Adaptation</td>
<td>DAPT on medical corpora + general-domain instructions</td>
</tr>
<tr>
<td>Medical corpus</td>
<td>~26B words (English)</td>
</tr>
<tr>
<td>General instructions</td>
<td>1.4M (English, Magpie)</td>
</tr>
<tr>
<td>Marmoka-en training</td>
<td>4 models trained with different hyperparameters (6.5B unique words each), merged</td>
</tr>
<tr>
<td>Training framework</td>
<td><a href="https://github.com/axolotl-ai-cloud/axolotl">Axolotl</a></td>
</tr>
<tr>
<td>Merging tool</td>
<td><a href="https://github.com/arcee-ai/mergekit">MergeKit</a></td>
</tr>
<tr>
<td>Model selection</td>
<td>Casimedicos validation set (EN &amp; ES)</td>
</tr>
</tbody>
</table>
## Training Data
<p style="text-align: justify;">
Marmoka-en was trained with the hybrid strategy of Sainz et al. (2025), which combines continual domain-adaptive pretraining on medical corpora with general-domain instructions to avoid catastrophic forgetting. Unlike traditional DAPT setups, an instruction-tuned model (Llama-3.1-8B-Instruct), rather than a base model, was used as the starting point. Note that this setup includes medical corpora but no dedicated medical instructions; the amount of medical content in the Magpie instructions is minimal. The medical corpora are an updated version of those gathered in De la Iglesia et al. (2025), and were processed and deduplicated using standard approaches (<a href="https://github.com/Maits27/Deduplication">deduplication code</a>).
</p>
<table style="border: 1px; border-collapse: collapse;">
<caption>Data sources and sizes used to train Marmoka-en.</caption>
<thead>
<tr>
<th>Type</th>
<th>Source</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="3">Medical corpora (English)</td>
<td>WikiMed</td>
<td>54.4M words</td>
</tr>
<tr>
<td>PubMed Central (PMC)</td>
<td>25.9B words</td>
</tr>
<tr>
<td>EMEA</td>
<td>12.9M words</td>
</tr>
<tr>
<td>General-domain instructions</td>
<td><a href="https://huggingface.co/datasets/HiTZ/Magpie-Llama-3.1-70B-Instruct-Filtered">Magpie (Llama-3.1-70B-Instruct)</a></td>
<td>1.4M instructions</td>
</tr>
</tbody>
</table>
# Limitation and Bias
<p style="text-align: justify;">Marmoka-en is intended for research purposes. Its evaluation is based on short-form multiple-choice question answering with automated accuracy metrics and without expert clinical adjudication, so the validity of the model's underlying reasoning has not been verified, and these benchmarks may not fully capture genuine medical expertise. It is recommended to validate and test the model for specific applications before using it.</p>
<p style="text-align: justify;">Instruction following and strict output formatting remain a limitation, especially in multi-step tasks such as summarization, where formatting failures were observed. Outputs should be checked whenever a strict format is required.</p>
## Biases
<ul>
<li><strong>Data Collection Bias:</strong> The training data for Marmoka-en was sourced from the web and open datasets, and may not adequately capture the full range of linguistic, demographic, or clinical variability found in real-world medical settings. This may introduce selection bias, and the model might reflect and propagate these biases in its outputs.</li>
<li><strong>Demographic and Linguistic Bias:</strong> Since the training data may not equally represent all demographic groups or linguistic nuances, the model may perform unequally across populations, potentially reinforcing existing health disparities and societal biases.</li>
<li><strong>Unexamined Ethical Considerations:</strong> No further assessments have been conducted to determine whether the training data contains biases or personally identifiable information, nor have the anonymization measures been independently verified. All data sources were previously processed, publicly released, and made available with stated limitations, including steps taken to ensure data quality and privacy compliance.</li>
</ul>
## Disclaimer
<p>Marmoka-en is intended for research purposes and is not approved for clinical use. It must not be used as a medical device or relied upon for diagnostic or therapeutic decision-making, and its outputs should not be interpreted as medical advice. Using the model without rigorous validation poses significant risks, including misinformation, misclassification, and potential harm.</p>
<p>When employed in actual clinical scenarios, all outputs must be independently reviewed and validated by qualified healthcare professionals. We do not take any liability for the use of this model.</p>
# Citing information
```bibtex
@article{domingo2026adapt,
title={To Adapt or not to Adapt, Rethinking the Value of Medical Knowledge-Aware Large Language Models},
author={Domingo-Aldama, Ane G and De La Iglesia, Iker and Urruela, Maitane and Atutxa, Aitziber and Barrena, Ander},
journal={arXiv preprint arXiv:2604.06854},
year={2026}
}
```

40
config.json Normal file
View File

@@ -0,0 +1,40 @@
{
"_name_or_path": "meta-llama/Llama-3.1-8B-Instruct",
"architectures": [
"LlamaForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 128000,
"eos_token_id": [
128001,
128008,
128009
],
"head_dim": 128,
"hidden_act": "silu",
"hidden_size": 4096,
"initializer_range": 0.02,
"intermediate_size": 14336,
"max_position_embeddings": 131072,
"mlp_bias": false,
"model_type": "llama",
"num_attention_heads": 32,
"num_hidden_layers": 32,
"num_key_value_heads": 8,
"pretraining_tp": 1,
"rms_norm_eps": 1e-05,
"rope_scaling": {
"factor": 8.0,
"high_freq_factor": 4.0,
"low_freq_factor": 1.0,
"original_max_position_embeddings": 8192,
"rope_type": "llama3"
},
"rope_theta": 500000.0,
"tie_word_embeddings": false,
"torch_dtype": "bfloat16",
"transformers_version": "4.49.0",
"use_cache": true,
"vocab_size": 128256
}

21
mergekit_config.yml Normal file
View File

@@ -0,0 +1,21 @@
models:
- model: meta-llama/Llama-3.1-8B-Instruct
- model: /data/abarrena/mn5/marmoka-en0-mn5ep2_v1.1
parameters:
density: 0.6
weight: 0.05
- model: /data/abarrena/mn5/marmoka-en1-mn5ep2_v1.1
parameters:
density: 0.6
weight: 0.05
- model: /data/abarrena/mn5/marmoka-en2-mn5ep2_v1.1
parameters:
density: 0.6
weight: 0.05
- model: /data/abarrena/mn5/marmoka-en3-mn5ep2_v1.1
parameters:
density: 0.6
weight: 0.05
merge_method: dare_ties
base_model: meta-llama/Llama-3.1-8B-Instruct
dtype: bfloat16

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bcf64c5df546567778da990ea8ea2635e5a9b01f88cd9d5f9539955887c4a6a7
size 4953586384

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e369f4007d28e4e6bf911d286344a8c798980de84b6e3b3afb8fb2b36c8094f7
size 4999819336

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5877e08424d1894ef6c5ed1d5937a2284aad377fe165fa2907600242a1b2b0b
size 4915916144

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a1ea2570d4acba401480fddcb19fb5e0b0631c28f62e29d647f3ada9b09e26cd
size 1191234472

File diff suppressed because one or more lines are too long

16
special_tokens_map.json Normal file
View File

@@ -0,0 +1,16 @@
{
"bos_token": {
"content": "<|begin_of_text|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"eos_token": {
"content": "<|eot_id|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
}

BIN
tokenizer.json (Stored with Git LFS) Normal file

Binary file not shown.

2063
tokenizer_config.json Normal file

File diff suppressed because it is too large Load Diff