Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
base_model: Qwen/Qwen3-4B
|
| 4 |
+
tags:
|
| 5 |
+
- clinvar
|
| 6 |
+
- acmg
|
| 7 |
+
- variant-classification
|
| 8 |
+
- dual-head
|
| 9 |
+
- sentence-classification
|
| 10 |
+
- text-classification
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# LLM4Variants-Qwen3-4B
|
| 14 |
+
|
| 15 |
+
Dual-head sentence classifier for **ACMG evidence-code + strength** prediction on
|
| 16 |
+
ClinVar submission comments. This is rank **#1** of the grid search (ranked by
|
| 17 |
+
joint test accuracy).
|
| 18 |
+
|
| 19 |
+
The model wraps the backbone **`Qwen/Qwen3-4B`** with two heads on top of mean-pooled
|
| 20 |
+
hidden states:
|
| 21 |
+
|
| 22 |
+
- **code head** — 28-way ACMG evidence code (`PVS1, PS1–PS4, PM1–PM6, PP1–PP5,
|
| 23 |
+
BA1, BS1–BS4, BP1–BP7` + `NO_KEYWORD`)
|
| 24 |
+
- **strength head** — 6-way strength, conditioned on a learned embedding of the
|
| 25 |
+
predicted code (`Supporting, Moderate, Strong, VeryStrong, NotMet, NoStrength`)
|
| 26 |
+
|
| 27 |
+
## Test metrics
|
| 28 |
+
|
| 29 |
+
| Metric | Value |
|
| 30 |
+
|---|---:|
|
| 31 |
+
| Code accuracy | 0.9309 |
|
| 32 |
+
| Strength accuracy | 0.9374 |
|
| 33 |
+
| Joint accuracy | 0.8822 |
|
| 34 |
+
| Strength acc \| correct code | 0.9477 |
|
| 35 |
+
| Code weighted-F1 | 0.9307 |
|
| 36 |
+
| Strength weighted-F1 | 0.9351 |
|
| 37 |
+
|
| 38 |
+
## Training configuration
|
| 39 |
+
|
| 40 |
+
| Hyperparameter | Value |
|
| 41 |
+
|---|---|
|
| 42 |
+
| Learning rate | 0.0001 |
|
| 43 |
+
| Effective batch size | 128 |
|
| 44 |
+
| Epochs | 8 |
|
| 45 |
+
| Max length | 256 |
|
| 46 |
+
| λ (strength loss) | 1.0 |
|
| 47 |
+
| Code emb dim | 64 |
|
| 48 |
+
| Negative ratio | 0.25 |
|
| 49 |
+
| Seed | 42 |
|
| 50 |
+
| Train / val / test size | 19161 / 1278 / 5110 |
|
| 51 |
+
|
| 52 |
+
## Files
|
| 53 |
+
|
| 54 |
+
- `model.safetensors` — full state dict (backbone + `code_head` +
|
| 55 |
+
`code_embeddings` + `strength_head`).
|
| 56 |
+
- `label_mappings.json` — `keyword2id` / `strength2id` (and reverse).
|
| 57 |
+
- tokenizer files + `chat_template.jinja`.
|
| 58 |
+
|
| 59 |
+
## Loading
|
| 60 |
+
|
| 61 |
+
This is a custom `nn.Module` (`DualHeadLLM`), not a `transformers`
|
| 62 |
+
`AutoModel`. Reconstruct the module (see `train_dual_head.py`), then load the
|
| 63 |
+
weights:
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
from safetensors.torch import load_file
|
| 67 |
+
from huggingface_hub import hf_hub_download
|
| 68 |
+
|
| 69 |
+
model = DualHeadLLM("Qwen/Qwen3-4B", num_keywords=28, num_strengths=6)
|
| 70 |
+
state = load_file(hf_hub_download("HFXM/LLM4Variants-Qwen3-4B", "model.safetensors"))
|
| 71 |
+
model.load_state_dict(state)
|
| 72 |
+
```
|