Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,118 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-classification
|
| 5 |
+
tags:
|
| 6 |
+
- biomedical
|
| 7 |
+
- rag
|
| 8 |
+
- fact-checking
|
| 9 |
+
- nli
|
| 10 |
+
- entailment
|
| 11 |
+
- peft
|
| 12 |
+
- lora
|
| 13 |
+
- medragchecker
|
| 14 |
+
# IMPORTANT:
|
| 15 |
+
# - Do NOT set `base_model` to a local filesystem path. If you want to specify it, use a valid Hugging Face model id (org/name).
|
| 16 |
+
# - Because this repo contains adapters for multiple different base models, `base_model` is intentionally omitted.
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# MedRAGChecker Student Checker — LoRA Adapters
|
| 20 |
+
|
| 21 |
+
This repository hosts **LoRA adapters** for the *checker* component used in the MedRAGChecker project.
|
| 22 |
+
The checker is trained as an NLI-style verifier to classify a **(evidence, claim)** pair into:
|
| 23 |
+
|
| 24 |
+
- **Entail**
|
| 25 |
+
- **Neutral**
|
| 26 |
+
- **Contradict**
|
| 27 |
+
|
| 28 |
+
These adapters are intended for **research and evaluation** (e.g., ensembling multiple checkers trained with different base models and/or training recipes such as SFT vs. GRPO).
|
| 29 |
+
|
| 30 |
+
> This repo contains **adapters only**. You must load each adapter on top of its corresponding **base model**.
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## Contents
|
| 35 |
+
|
| 36 |
+
Each adapter subfolder typically includes:
|
| 37 |
+
|
| 38 |
+
- `adapter_config.json`
|
| 39 |
+
- `adapter_model.safetensors` (or `.bin`)
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## Available adapters
|
| 44 |
+
|
| 45 |
+
All adapters live under the `Checker/` directory:
|
| 46 |
+
|
| 47 |
+
| Adapter subfolder | Base model (HF id) | Training recipe | Notes |
|
| 48 |
+
|---|---|---|---|
|
| 49 |
+
| `Checker/med42-llama3-8b-sft` | `<PUT_BASE_MODEL_ID_HERE>` | SFT | |
|
| 50 |
+
| `Checker/med42-llama3-8b-grpo` | `<PUT_BASE_MODEL_ID_HERE>` | GRPO | |
|
| 51 |
+
| `Checker/meditron-sft` | `<PUT_BASE_MODEL_ID_HERE>` | SFT | |
|
| 52 |
+
| `Checker/meditron-grpo` | `<PUT_BASE_MODEL_ID_HERE>` | GRPO | |
|
| 53 |
+
| `Checker/PMC_LLaMA_13B-sft` | `<PUT_BASE_MODEL_ID_HERE>` | SFT | |
|
| 54 |
+
| `Checker/qwen2-med-7b-sft` | `<PUT_BASE_MODEL_ID_HERE>` | SFT | |
|
| 55 |
+
| `Checker/qwen2-med-7b-grpo` | `<PUT_BASE_MODEL_ID_HERE>` | GRPO | |
|
| 56 |
+
|
| 57 |
+
### How to fill the “Base model (HF id)” column
|
| 58 |
+
|
| 59 |
+
Use a valid Hugging Face Hub model id (format: `org/name`). Examples:
|
| 60 |
+
|
| 61 |
+
- `meta-llama/Meta-Llama-3-8B-Instruct`
|
| 62 |
+
- `Qwen/Qwen2-7B-Instruct`
|
| 63 |
+
|
| 64 |
+
If your base model is **not** available on the Hub (only stored locally), you can either:
|
| 65 |
+
1) upload the base model to a private Hub repo and reference that id here, or
|
| 66 |
+
2) keep this field as `N/A (local)` and document your local loading instructions.
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## Quickstart: load an adapter with PEFT
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 74 |
+
from peft import PeftModel
|
| 75 |
+
|
| 76 |
+
# 1) Choose the base model that matches the adapter you want to use
|
| 77 |
+
base_model_id = "<HF_BASE_MODEL_ID>"
|
| 78 |
+
|
| 79 |
+
# 2) Choose the adapter subfolder inside this repo
|
| 80 |
+
repo_id = "JoyDaJun/Medragchecker-Student-Checker"
|
| 81 |
+
subfolder = "Checker/qwen2-med-7b-sft" # example
|
| 82 |
+
|
| 83 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_id, use_fast=True)
|
| 84 |
+
model = AutoModelForSequenceClassification.from_pretrained(base_model_id)
|
| 85 |
+
model = PeftModel.from_pretrained(model, repo_id, subfolder=subfolder)
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
> If your checker was trained using a **Causal LM** head instead of a sequence classification head,
|
| 89 |
+
replace `AutoModelForSequenceClassification` with `AutoModelForCausalLM` and use the same prompt/template as in training.
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## Ensemble usage (optional)
|
| 94 |
+
|
| 95 |
+
If you trained multiple student checkers, you can ensemble them (e.g., by weighting each checker’s class probabilities using dev-set reliability such as per-class F1).
|
| 96 |
+
This often helps stabilize performance across **Entail / Neutral / Contradict**, especially under class imbalance.
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## Limitations & responsible use
|
| 101 |
+
|
| 102 |
+
- **Not medical advice.** Do not use for clinical decision-making.
|
| 103 |
+
- Outputs may reflect biases or errors from training data and teacher supervision.
|
| 104 |
+
- Please evaluate on your target dataset and report limitations clearly.
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
## Citation
|
| 109 |
+
|
| 110 |
+
If you use these adapters, please cite your MedRAGChecker paper/project:
|
| 111 |
+
|
| 112 |
+
```bibtex
|
| 113 |
+
@article{medragchecker,
|
| 114 |
+
title={MedRAGChecker: A Claim-Level Verification Framework for Biomedical RAG},
|
| 115 |
+
author={...},
|
| 116 |
+
year={2025}
|
| 117 |
+
}
|
| 118 |
+
```
|