Add endoedge_qwen3vl8b_qlora_r512: Qwen3-VL-8B GI adapter, SAGE-benchmarked
Browse files- endoedge_qwen3vl8b_qlora_r512/README.md +106 -0
- endoedge_qwen3vl8b_qlora_r512/adapter_config.json +50 -0
- endoedge_qwen3vl8b_qlora_r512/adapter_model.safetensors +3 -0
- endoedge_qwen3vl8b_qlora_r512/final_step_001200/adapter_config.json +50 -0
- endoedge_qwen3vl8b_qlora_r512/final_step_001200/adapter_model.safetensors +3 -0
endoedge_qwen3vl8b_qlora_r512/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: peft
|
| 3 |
+
base_model: Qwen/Qwen3-VL-8B-Instruct
|
| 4 |
+
tags: [medical, endoscopy, gastroenterology, multimodal, lora, qlora, json-extraction]
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
# endoedge_qwen3vl8b_qlora_r512
|
| 9 |
+
|
| 10 |
+
LoRA adapter for **Qwen3-VL-8B-Instruct** fine-tuned to report gastrointestinal
|
| 11 |
+
endoscopy findings as a single canonical JSON object.
|
| 12 |
+
|
| 13 |
+
| | |
|
| 14 |
+
|---|---|
|
| 15 |
+
| method | QLORA, rank 512, alpha 256 |
|
| 16 |
+
| trainable parameters | 1,396,703,232 (21.81% of total) |
|
| 17 |
+
| adapter size | 2.60 GiB |
|
| 18 |
+
| resident weights (base + adapter) | 10.87 GiB |
|
| 19 |
+
| base model | `Qwen/Qwen3-VL-8B-Instruct`, revision `0c351dd01ed87e9c1b53cbc748cba10e6187ff3b` |
|
| 20 |
+
| checkpoint published | `step_001000` (optimizer step 1000) |
|
| 21 |
+
| training | 1,200 optimizer updates, effective global batch 64, 2xH100 |
|
| 22 |
+
|
| 23 |
+
## Output format
|
| 24 |
+
|
| 25 |
+
The model emits exactly eight keys, in this fixed order, `null` permitted:
|
| 26 |
+
|
| 27 |
+
```json
|
| 28 |
+
{"tract": ..., "landmark": ..., "abnormality_present": ..., "abnormality_type": ...,
|
| 29 |
+
"grade": ..., "prep_quality": ..., "procedure": ..., "instrument_present": ...}
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
Use the prompt it was trained with, or output quality will not match the numbers below:
|
| 33 |
+
|
| 34 |
+
```
|
| 35 |
+
system: You are an expert gastrointestinal endoscopist. You read a single endoscopy
|
| 36 |
+
frame and report your findings as one JSON object.
|
| 37 |
+
user: <image>
|
| 38 |
+
Report the findings in this GI endoscopy frame as a single JSON object with
|
| 39 |
+
exactly these keys, in this order: tract, landmark, abnormality_present,
|
| 40 |
+
abnormality_type, grade, prep_quality, procedure, instrument_present.
|
| 41 |
+
Use null for any key this frame does not establish.
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Results
|
| 45 |
+
|
| 46 |
+
**Held-out population shift — SAGE test split (420 images, South Asian GI endoscopy,
|
| 47 |
+
never seen in training), projected onto SAGE's 18 multi-label classes:**
|
| 48 |
+
|
| 49 |
+
| metric | value |
|
| 50 |
+
|---|---|
|
| 51 |
+
| macro-F1 | **0.2509** |
|
| 52 |
+
| macro-F1, reachable labels only | 0.2657 |
|
| 53 |
+
| micro-F1 | 0.3713 |
|
| 54 |
+
| mAP weighted / macro / micro | 0.389 / 0.262 / 0.317 |
|
| 55 |
+
| schema validity | 1.000 |
|
| 56 |
+
|
| 57 |
+
Published baselines on the same split, trained on HyperKvasir or GastroVision
|
| 58 |
+
(Oli et al. 2026): macro-F1 **0.1164 – 0.2431**.
|
| 59 |
+
|
| 60 |
+
**In-domain** (stratified validation subset, mean per-field macro-F1): 0.6366
|
| 61 |
+
|
| 62 |
+
**Inference** (NVIDIA H100, batch 16, greedy): 662 ms/image, 1.49 img/s,
|
| 63 |
+
peak VRAM 23.17 GiB.
|
| 64 |
+
|
| 65 |
+
## Known limitation
|
| 66 |
+
|
| 67 |
+
On out-of-distribution images the model fills **all eight keys**, including fields the
|
| 68 |
+
frame does not establish — measured unsupported-field fill rate is 1.000 on SAGE.
|
| 69 |
+
Training masked unsupervised fields out of the loss, so the model received no gradient
|
| 70 |
+
teaching it to abstain. Treat every non-null value as an assertion to verify, and gate
|
| 71 |
+
on token confidence if precision matters.
|
| 72 |
+
|
| 73 |
+
## Training data and attribution
|
| 74 |
+
|
| 75 |
+
Trained on LIMUC, GastroVision and HyperKvasir (29,938 images), all **CC BY 4.0**.
|
| 76 |
+
The attribution obligation travels with these weights — if you use them, cite:
|
| 77 |
+
|
| 78 |
+
- Borgli H. et al. *HyperKvasir.* Scientific Data 7, 283 (2020).
|
| 79 |
+
- Jha D. et al. *GastroVision.* ICML ML4MHD Workshop, 2023.
|
| 80 |
+
- Polat G. et al. *LIMUC.* Inflammatory Bowel Diseases, izac196, 2022.
|
| 81 |
+
|
| 82 |
+
Evaluated on SAGE (CC BY-SA 4.0; Oli et al. 2026, arXiv:2606.22144). SAGE was used
|
| 83 |
+
for evaluation only and never for training or model selection, so no ShareAlike
|
| 84 |
+
obligation attaches to these weights.
|
| 85 |
+
|
| 86 |
+
## Intended use
|
| 87 |
+
|
| 88 |
+
Research only. Not a medical device, not validated for clinical use, and not a
|
| 89 |
+
substitute for endoscopist judgement.
|
| 90 |
+
|
| 91 |
+
## Usage
|
| 92 |
+
|
| 93 |
+
```python
|
| 94 |
+
from peft import PeftModel
|
| 95 |
+
from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
|
| 96 |
+
|
| 97 |
+
base = Qwen3VLForConditionalGeneration.from_pretrained(
|
| 98 |
+
"Qwen/Qwen3-VL-8B-Instruct", dtype="bfloat16", device_map="auto")
|
| 99 |
+
model = PeftModel.from_pretrained(base, "GutVLMmodels/experiments_checkpoints", subfolder="endoedge_qwen3vl8b_qlora_r512")
|
| 100 |
+
processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-8B-Instruct")
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
## A note on which checkpoint this is
|
| 104 |
+
|
| 105 |
+
The published adapter is `step_001000`, **not** the last one. Scored on a held-out in-domain validation subset, this run peaked before the end of training and the final step was worse. The step-1200 adapter is in `final_step_001200/` for completeness.
|
| 106 |
+
|
endoedge_qwen3vl8b_qlora_r512/adapter_config.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "Qwen/Qwen3-VL-8B-Instruct",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"layer_replication": null,
|
| 16 |
+
"layers_pattern": null,
|
| 17 |
+
"layers_to_transform": null,
|
| 18 |
+
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 256,
|
| 20 |
+
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.05,
|
| 22 |
+
"lora_ga_config": null,
|
| 23 |
+
"megatron_config": null,
|
| 24 |
+
"megatron_core": "megatron.core",
|
| 25 |
+
"modules_to_save": null,
|
| 26 |
+
"monteclora_config": null,
|
| 27 |
+
"peft_type": "LORA",
|
| 28 |
+
"peft_version": "0.20.0",
|
| 29 |
+
"qalora_group_size": 16,
|
| 30 |
+
"r": 512,
|
| 31 |
+
"rank_pattern": {},
|
| 32 |
+
"revision": null,
|
| 33 |
+
"target_modules": [
|
| 34 |
+
"up_proj",
|
| 35 |
+
"v_proj",
|
| 36 |
+
"k_proj",
|
| 37 |
+
"down_proj",
|
| 38 |
+
"o_proj",
|
| 39 |
+
"q_proj",
|
| 40 |
+
"gate_proj"
|
| 41 |
+
],
|
| 42 |
+
"target_parameters": null,
|
| 43 |
+
"task_type": "CAUSAL_LM",
|
| 44 |
+
"trainable_token_indices": null,
|
| 45 |
+
"use_bdlora": null,
|
| 46 |
+
"use_dora": false,
|
| 47 |
+
"use_qalora": false,
|
| 48 |
+
"use_rslora": false,
|
| 49 |
+
"velora_config": null
|
| 50 |
+
}
|
endoedge_qwen3vl8b_qlora_r512/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c95b1ecb135639c73be25f7d6c6b7b952d1a741d3f05018639494640f87fd64
|
| 3 |
+
size 2793483904
|
endoedge_qwen3vl8b_qlora_r512/final_step_001200/adapter_config.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "Qwen/Qwen3-VL-8B-Instruct",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"layer_replication": null,
|
| 16 |
+
"layers_pattern": null,
|
| 17 |
+
"layers_to_transform": null,
|
| 18 |
+
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 256,
|
| 20 |
+
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.05,
|
| 22 |
+
"lora_ga_config": null,
|
| 23 |
+
"megatron_config": null,
|
| 24 |
+
"megatron_core": "megatron.core",
|
| 25 |
+
"modules_to_save": null,
|
| 26 |
+
"monteclora_config": null,
|
| 27 |
+
"peft_type": "LORA",
|
| 28 |
+
"peft_version": "0.20.0",
|
| 29 |
+
"qalora_group_size": 16,
|
| 30 |
+
"r": 512,
|
| 31 |
+
"rank_pattern": {},
|
| 32 |
+
"revision": null,
|
| 33 |
+
"target_modules": [
|
| 34 |
+
"up_proj",
|
| 35 |
+
"v_proj",
|
| 36 |
+
"k_proj",
|
| 37 |
+
"down_proj",
|
| 38 |
+
"o_proj",
|
| 39 |
+
"q_proj",
|
| 40 |
+
"gate_proj"
|
| 41 |
+
],
|
| 42 |
+
"target_parameters": null,
|
| 43 |
+
"task_type": "CAUSAL_LM",
|
| 44 |
+
"trainable_token_indices": null,
|
| 45 |
+
"use_bdlora": null,
|
| 46 |
+
"use_dora": false,
|
| 47 |
+
"use_qalora": false,
|
| 48 |
+
"use_rslora": false,
|
| 49 |
+
"velora_config": null
|
| 50 |
+
}
|
endoedge_qwen3vl8b_qlora_r512/final_step_001200/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2ced45fb011e24a9e73f828c42ee34e42157d4767f73d5d9628d58d9ede7d6c7
|
| 3 |
+
size 2793483904
|