v3s README: add LoRA SFT training plan (InternVL3.5-4B, Ovis2-4B)
Browse files- v3s/README.md +73 -0
v3s/README.md
CHANGED
|
@@ -50,3 +50,76 @@ options, i.e. the "Neither." form.
|
|
| 50 |
- "Absent" means absent from the COCO annotations, which can miss objects (the same assumption as POPE).
|
| 51 |
- Colour labels come from manual inspection of object crops by an AI assistant (one clear dominant colour; objects
|
| 52 |
with an unclear colour were skipped). They are not verified by a person.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
- "Absent" means absent from the COCO annotations, which can miss objects (the same assumption as POPE).
|
| 51 |
- Colour labels come from manual inspection of object crops by an AI assistant (one clear dominant colour; objects
|
| 52 |
with an unclear colour were skipped). They are not verified by a person.
|
| 53 |
+
|
| 54 |
+
## Training plan: LoRA SFT on InternVL3.5-4B and Ovis2-4B
|
| 55 |
+
|
| 56 |
+
**Goal.** Train the SFT baseline on v3s, so that the SFT data has a matched true-premise question for every
|
| 57 |
+
false-premise question. Compare it with the base model, SFT v1 (trap-only data), SFT v2 (unmatched true-premise
|
| 58 |
+
data) and SV-PLT.
|
| 59 |
+
|
| 60 |
+
### Models and data
|
| 61 |
+
|
| 62 |
+
| Model | HF id | Python env | Trainer (VLM-PLT) | Adapter out |
|
| 63 |
+
|---|---|---|---|---|
|
| 64 |
+
| InternVL3.5-4B | `OpenGVLab/InternVL3_5-4B-HF` | `qwen35` | `claude_workspace/python_script/gemma_sft_train.py` | `outputs/prime_v3s/ivl35_4b_v3s_install/adapter` |
|
| 65 |
+
| Ovis2-4B | `AIDC-AI/Ovis2-4B` | `qwen35_ovis` (transformers < 4.50) | `claude_workspace/python_script/ovis2_sft_train.py` | `outputs/prime_v3s/ovis2_4b_v3s_install/adapter` |
|
| 66 |
+
|
| 67 |
+
Data: `sft_train_v3s.jsonl` (fields used: `img_id`, `question`, `response`); image root `data/aipsych/images`
|
| 68 |
+
(unzip `images.zip` there).
|
| 69 |
+
|
| 70 |
+
### Recipe (the same as PRIME v1 / v2; only the data changes)
|
| 71 |
+
|
| 72 |
+
| Setting | Value |
|
| 73 |
+
|---|---|
|
| 74 |
+
| LoRA | r = 16, alpha = 32, dropout = 0.05; attention and MLP projections (q, k, v, o, gate, up, down) of the language model; vision tower and projector frozen |
|
| 75 |
+
| Optimizer | AdamW, constant learning rate 1e-4, no warmup |
|
| 76 |
+
| Epochs / batch | 3 epochs, effective batch 16 (63 steps per epoch, 189 steps) |
|
| 77 |
+
| Loss | next-token cross-entropy on the response tokens only (prompt and image tokens masked) |
|
| 78 |
+
| Precision | bf16, gradient checkpointing |
|
| 79 |
+
| Seeds | seed 0 first; seeds 1 and 2 if the result is used in the paper |
|
| 80 |
+
| Ovis2 only | `--mm-max-len 1024` (stops the 32k padding of `merge_multimodal`) |
|
| 81 |
+
|
| 82 |
+
### Steps
|
| 83 |
+
|
| 84 |
+
1. Train (about 20 min per model on one GPU):
|
| 85 |
+
```bash
|
| 86 |
+
export HF_HOME=/data/hf_cache CUDA_VISIBLE_DEVICES=<gpu>
|
| 87 |
+
/data/xinyuan/anaconda3/envs/qwen35/bin/python claude_workspace/python_script/gemma_sft_train.py \
|
| 88 |
+
--model-id OpenGVLab/InternVL3_5-4B-HF --data outputs/prime_v3_clean/sft_train_v3s.jsonl \
|
| 89 |
+
--out-adapter outputs/prime_v3s/ivl35_4b_v3s_install/adapter --batch-size 16
|
| 90 |
+
/data/xinyuan/anaconda3/envs/qwen35_ovis/bin/python claude_workspace/python_script/ovis2_sft_train.py \
|
| 91 |
+
--model-id AIDC-AI/Ovis2-4B --data outputs/prime_v3_clean/sft_train_v3s.jsonl \
|
| 92 |
+
--out-adapter outputs/prime_v3s/ovis2_4b_v3s_install/adapter --batch-size 16
|
| 93 |
+
```
|
| 94 |
+
2. Check training: the loss falls in each epoch; the adapter file exists; 10 sample answers: "Neither." on a
|
| 95 |
+
false-premise question and the true option on a true-premise question.
|
| 96 |
+
3. Final split (about 40 min per model): copy `claude_workspace/sh_script/model_lane3.sh` to a new lane with a
|
| 97 |
+
condition `prime_v3s` (adapter above), then run `final:prime_v3s` for `KEY=ivl4b` and `KEY=ovis2_4b`.
|
| 98 |
+
4. Full AIpsych 10k (optional, several hours): `sv_full_shards3.sh`-style run with the v3s adapter. The v3s images
|
| 99 |
+
are not in AIpsych, so the full 10k is a clean test for v3s (it is not clean for SFT v1 / v2).
|
| 100 |
+
|
| 101 |
+
### Evaluation (the same protocol as the main table)
|
| 102 |
+
|
| 103 |
+
| Metric | Set | Direction |
|
| 104 |
+
|---|---|---|
|
| 105 |
+
| TS (trap-spotting, official `parse_q1`) | AIpsych probe_500 (final split); full 10k optional | higher |
|
| 106 |
+
| FR (false refusal) and accuracy | 300 true-premise control questions (quadrant template) | FR lower |
|
| 107 |
+
| TS / FR on new wordings | held-out wording set (250 + 250) | TS higher, FR lower |
|
| 108 |
+
| POPE / AMBER / HallusionBench accuracy | 600-question dev subsets | no drop vs base |
|
| 109 |
+
|
| 110 |
+
Compare in one table: base, SFT v1, SFT v2, SFT v3s, SV-PLT (same model).
|
| 111 |
+
|
| 112 |
+
### What to watch
|
| 113 |
+
|
| 114 |
+
- **FR on the control set.** v3s is built to stop "quadrant options -> refuse". The expected FR is far below SFT v1
|
| 115 |
+
(about 100% on these models) and below SFT v2.
|
| 116 |
+
- **TS.** If TS stays high and FR is low, SFT v3s is a strong baseline; the paper claim for SV-PLT must then rest on
|
| 117 |
+
a measured difference (for example held-out wordings, side effects, or no weight change).
|
| 118 |
+
- **Answer form.** The scorer counts "Neither." but not "No." on Q1. Check that the model answers "Neither."
|
| 119 |
+
(not "No.") on AIpsych Q1.
|
| 120 |
+
- **Side effects.** v3s has no existence or description rows. Check POPE / AMBER (yes-ratio and accuracy).
|
| 121 |
+
|
| 122 |
+
### Resources
|
| 123 |
+
|
| 124 |
+
GPUs 1 and 2 (GPU 3 is not used). Keep each GPU at or below about 85 GB. Run every job through the occupier
|
| 125 |
+
protocol (`occ_protocol.sh`). One training job uses about 20-30 GB.
|