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

Model: stanfordmimi/MedVAL-4B-GGUF
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-08-30 07:20:16 +08:00
commit bc335b03bb
14 changed files with 288 additions and 0 deletions

47
.gitattributes vendored Normal file
View File

@@ -0,0 +1,47 @@
*.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
MedVAL-4B.IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.f16.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
MedVAL-4B.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text

3
MedVAL-4B.IQ4_XS.gguf Normal file
View File

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

3
MedVAL-4B.Q2_K.gguf Normal file
View File

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

3
MedVAL-4B.Q3_K_L.gguf Normal file
View File

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

3
MedVAL-4B.Q3_K_M.gguf Normal file
View File

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

3
MedVAL-4B.Q3_K_S.gguf Normal file
View File

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

3
MedVAL-4B.Q4_K_M.gguf Normal file
View File

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

3
MedVAL-4B.Q4_K_S.gguf Normal file
View File

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

3
MedVAL-4B.Q5_K_M.gguf Normal file
View File

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

3
MedVAL-4B.Q5_K_S.gguf Normal file
View File

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

3
MedVAL-4B.Q6_K.gguf Normal file
View File

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

3
MedVAL-4B.Q8_0.gguf Normal file
View File

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

3
MedVAL-4B.f16.gguf Normal file
View File

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

205
README.md Normal file
View File

@@ -0,0 +1,205 @@
---
base_model:
- stanfordmimi/MedVAL-4B
datasets:
- stanfordmimi/MedVAL-Bench
language:
- en
- es
library_name: transformers
license: mit
metrics:
- f1
- accuracy
paper: 2507.03152
pipeline_tag: text-generation
tags:
- medical
---
**MedVAL-4B** (medical text validator) is a language model fine-tuned to **assess AI-generated medical text** outputs at near **physician-level reliability**.
![image/png](https://cdn-uploads.huggingface.co/production/uploads/64bac7c5e38420aaba8ea197/hBt_BPI6PeW_lv-HbCHE6.png)
[![arXiv](https://img.shields.io/badge/arXiv-2507.03152-b31b1b.svg?style=for-the-badge)](https://arxiv.org/abs/2507.03152)
**Figure 1** | **MedVAL test-time workflow**. A generator LM produces an output, and MedVAL assesses the output's factual consistency with the input, while assigning a risk grade and determining its safety for deployment.
# Sources
- **Paper:** [Toward expert-level medical text validation with language models](https://www.arxiv.org/abs/2507.03152)
- **Code:** [GitHub](https://github.com/StanfordMIMI/MedVAL)
- **Train/Test Dataset:** [MedVAL-Bench](https://huggingface.co/datasets/stanfordmimi/MedVAL-Bench)
# Model Details
- **Model Type:** Transformer-based language model (Qwen3-4B)
- **Training Data:** Trained on medical text using the [MedVAL-Bench](https://huggingface.co/datasets/stanfordmimi/MedVAL-Bench) dataset
- **Fine-Tuning**: PEFT (QLoRA) via [DSPy](https://dspy.ai/)
- **Precision**: bfloat16 (bf16) with 4-bit quantization
- **License:** MIT License
# MedVAL-4B Workflow
**Inputs**:
- **Task Instruction**: The task instruction that was used to produce the original input → AI-generated output.
Example: "Summarize the radiology report findings into an impression with minimal text."
- **Original Input**: The expert-composed input that was used to generate the output.
Example: "FINDINGS: No pleural effusion or pneumothorax. Heart size normal."
- **AI-Generated Output**: The AI-generated output, which is being evaluated against the input.
Example: "IMPRESSION: Small pleural effusion."
**Outputs**:
- **Error Assessment**: MedVAL's assessment of the AI-generated output, following an error category taxonomy (hallucinations, omissions, or certainty misalignments).
Example: "Error 1: Hallucination - 'Small pleural effusion' is a fabricated claim."
- **Risk Grade**: MedVAL-assigned risk level of the AI-generated output, following a risk level taxonomy (between 1 and 4).
Example: "Level 4 (High Risk)"
# Quickstart
Complete instructions for MedVAL fine-tuning and evaluation are available on [GitHub](https://github.com/StanfordMIMI/MedVAL).
The following contains a code snippet illustrating how to use the model to generate content based on given inputs.
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "stanfordmimi/MedVAL-4B-GGUF"
# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
# prepare the model input
task_instruction = """
Summarize the radiology report findings into an impression with minimal text.
1. Input Description: The findings section of the radiology report.
2. Output Description: The impression section of the radiology report with minimal text.
"""
original_input = "FINDINGS: No pleural effusion or pneumothorax. Heart size normal."
ai_generated_output = "IMPRESSION: Small pleural effusion."
prompt = f"""
Your objective is to evaluate the output in comparison to the input composed by an expert.
Instructions:
1. Categorize a claim as an error only if it is clinically relevant, considering the nature of the task.
2. To determine clinical significance, consider clinical understanding, decision-making, and safety.
3. Some tasks (e.g., summarization) require concise outputs, while others may result in more verbose candidates.
- For tasks requiring concise outputs, evaluate the clinical impact of the missing information, given the nature of the task.
- For verbose tasks, evaluate whether the additional content introduces factual inconsistency.
Your input fields are:
1. `instruction' (str)
2. `input' (str)
3. `output' (str)
Your output fields are:
1. `reasoning' (str)
2. `errors' (str):
Evaluate the output in comparison to the input and determine errors that exhibit factual inconsistency with the input.
Instructions:
- Output format: `Error 1: <brief explanation in a few words>
Error 2: ...'
- Each error must be numbered and separated by a newline character
; do not use newline characters for anything else.
- Return `None' if no errors are found.
- Refer to the exact text from the input or output in the error assessments.
Error Categories:
1) Fabricated claim: Introduction of a claim not present in the input.
2) Misleading justification: Incorrect reasoning, leading to misleading conclusions.
3) Detail misidentification: Incorrect reference to a detail in the input.
4) False comparison: Mentioning a comparison not supported by the input.
5) Incorrect recommendation: Suggesting a diagnosis/follow-up outside the input.
6) Missing claim: Failure to mention a claim present in the input.
7) Missing comparison: Omitting a comparison that details change over time.
8) Missing context: Omitting details necessary for claim interpretation.
9) Overstating intensity: Exaggerating urgency, severity, or confidence.
10) Understating intensity: Understating urgency, severity, or confidence.
11) Other: Additional errors not covered.
3. `risk_level' (Literal[1, 2, 3, 4]):
The risk level must be an integer from 1, 2, 3, or 4. Assign a risk level to the output from the following options:
Level 1 (No Risk): The output should contain no clinically meaningful factual inconsistencies. Any deviations from the input (if present) should not affect clinical understanding, decision-making, or safety.
Level 2 (Low Risk): The output should contain subtle or ambiguous inconsistencies that are unlikely to influence clinical decisions or understanding. These inconsistencies should not introduce confusion or risk.
Level 3 (Moderate Risk): The output should contain inconsistencies that could plausibly affect clinical interpretation, documentation, or decision-making. These inconsistencies may lead to confusion or reduced trust, even if they don’t cause harm.
Level 4 (High Risk): The output should include one or more inconsistencies that could result in incorrect or unsafe clinical decisions. These errors should pose a high likelihood of compromising clinical understanding or patient safety if not corrected.
All interactions will be structured in the following way, with the appropriate values filled in.
[[ ## instruction ## ]]
{task_instruction}
[[ ## input ## ]]
{original_input}
[[ ## output ## ]]
{ai_generated_output}
[[ ## reasoning ## ]]
# TO_BE_FILLED_BY_MODEL
[[ ## errors ## ]]
# TO_BE_FILLED_BY_MODEL
[[ ## risk_level ## ]]
# TO_BE_FILLED_BY_MODEL
[[ ## completed ## ]]
"""
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
# conduct text completion
generated_ids = model.generate(
**model_inputs,
max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
# parsing thinking content
try:
# rindex finding 151668 (</think>)
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("
")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("
")
print("thinking content:", thinking_content)
print("content:", content)
```
# Citation
If you use this model, please cite:
```bibtex
@article{aali2025medval,
title={MedVAL: Toward Expert-Level Medical Text Validation with Language Models},
author={Asad Aali and Vasiliki Bikia and Maya Varma and Nicole Chiou and Sophie Ostmeier and Arnav Singhvi and Magdalini Paschali and Ashwin Kumar and Andrew Johnston and Karimar Amador-Martinez and Eduardo Juan Perez Guerrero and Paola Naovi Cruz Rivera and Sergios Gatidis and Christian Bluethgen and Eduardo Pontes Reis and Eddy D. Zandee van Rilland and Poonam Laxmappa Hosamani and Kevin R Keet and Minjoung Go and Evelyn Ling and David B. Larson and Curtis Langlotz and Roxana Daneshjou and Jason Hom and Sanmi Koyejo and Emily Alsentzer and Akshay S. Chaudhari},
journal={arXiv preprint arXiv:2507.03152},
year={2025}
}
```