--- license: apache-2.0 language: - es 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 - TsinghuaC3I/UltraMedical tags: - biomedical - medical - clinical - spanish - llama-3.1 - continual-pretraining - merge widget: - messages: - role: user content: >- Varón de 55 años con dolor torácico opresivo irradiado al brazo izquierdo. ¿Cuál es la prueba diagnóstica inicial más adecuada? A) Radiografía de tórax B) Electrocardiograma de 12 derivaciones C) Ecografía abdominal D) Espirometría Responde solo con la letra de la opción correcta. - messages: - role: user content: Explica el mecanismo de acción de la metformina en la diabetes tipo 2. - messages: - role: user content: >- ¿Cuáles son los efectos adversos más frecuentes de los inhibidores de la ECA? ---

Marmoka-es+it
A Lightweight Spanish Clinical Large Language Model
Built on Llama 3.1


Marmoka is a family of lightweight 8B-parameter clinical LLMs for English and Spanish. Marmoka-es+it is a Spanish member of the family, developed to address the scarcity of high-quality medical data and instructions in Spanish. It was obtained by merging Marmoka-es, a model continually pre-trained on Spanish medical corpora, with Marmoka-it, a model fine-tuned on medical instructions, combining the strengths of both adaptation approaches. Marmoka-es+it consistently outperforms both Llama-3.1-8B-Instruct and Llama3.1-Aloe-Beta-8B on Spanish clinical multiple-choice QA, showing that robust medical LLMs can be developed for languages that remain low-resource in the medical domain.

- 📖 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-es-it-Llama-3.1-8B-Instruct", torch_dtype=torch.bfloat16, device_map="auto", ) messages = [ {"role": "system", "content": "Eres un experto médico. Responde a la pregunta de opción múltiple únicamente con la letra de la opción correcta."}, {"role": "user", "content": "¿Qué déficit vitamínico causa el escorbuto?\nA) Vitamina A\nB) Vitamina B12\nC) Vitamina C\nD) Vitamina 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)**: Spanish - **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
Training settings for Marmoka-es+it.
Param. no. ~8B
Architecture Llama 3.1 (decoder-only)
Base model Llama-3.1-8B-Instruct
Adaptation DAPT + general instructions (Marmoka-es), merged with medical instruction tuning (Marmoka-it)
Medical corpus ~908M (≈1B) words (Spanish)
General instructions 310K (Spanish, Magpie)
Medical instructions (Marmoka-it) 410K (UltraMedical) + 82K general-domain
Marmoka-es training 3 models trained with different hyperparameters on the same corpus, merged
Training framework Axolotl
Merging tool MergeKit
Model selection Casimedicos validation set (EN & ES)
## Training Data

Marmoka-es+it was built in two stages, both starting from Llama-3.1-8B-Instruct. First, Marmoka-es was trained with the hybrid strategy of Sainz et al. (2025), which combines continual domain-adaptive pretraining on Spanish medical corpora with general-domain instructions to avoid catastrophic forgetting. In parallel, Marmoka-it was trained on medical instructions from UltraMedical together with general-domain instructions, merging three models trained with different hyperparameters. Finally, both models were merged into Marmoka-es+it. Unlike traditional DAPT setups, an instruction-tuned model, rather than a base model, was used as the starting point. 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 (deduplication code).

Data sources and sizes used to train Marmoka-es+it.
Type Source Size
Medical corpora (Spanish) WikiMed 16.3M words
PubMed 5.5M words
Medical Crawler 850.7M words
MeSpEn 6.9M words
SciELO 29M words
General-domain instructions Magpie (Llama-3.1-70B-Instruct) 310K instructions
Marmoka-it UltraMedical (medical) 410K instructions
General-domain instructions 82K instructions
# Limitation and Bias

Marmoka-es+it 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.

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.

## Biases ## Disclaimer

Marmoka-es+it 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.

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.

# 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} } ```