jbarney commited on
Commit
a976b66
·
verified ·
1 Parent(s): 42eba74

circuit-vl-4b: LoRA + pointer head on Qwen3-VL-4B-Instruct, best step 500

Browse files
README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: peft
4
+ base_model: Qwen/Qwen3-VL-4B-Instruct
5
+ base_model_relation: adapter
6
+ pipeline_tag: image-text-to-text
7
+ language:
8
+ - en
9
+ tags:
10
+ - decision-model
11
+ - system-one
12
+ - calibration
13
+ - typesafe
14
+ - decision-circuits
15
+ - lora
16
+ - vision
17
+ ---
18
+
19
+ # circuit-vl-4b
20
+
21
+ A **System One** decision model for images: a state that carries one or
22
+ more images (video as sampled frames) plus optional text, typed questions
23
+ in, calibrated probability distributions out, one forward pass, no text
24
+ generation. It is the vision member of the circuit family behind
25
+ [decision-circuits](https://decisioncircuits.com); the text members are
26
+ [circuit-1.7b](https://huggingface.co/jbarney/circuit-1.7b) and
27
+ [circuit-8b](https://huggingface.co/jbarney/circuit-8b).
28
+
29
+ `circuit-vl-4b` is a LoRA adapter on the language model of
30
+ `Qwen/Qwen3-VL-4B-Instruct` (vision encoder frozen and untouched) plus the
31
+ same pointer readout head as the text models. Each option is wrapped in
32
+ delimiter tokens and the sequence ends with a decide token; the head scores
33
+ every option's closing delimiter against the decide token and applies
34
+ softmax. Trained with cross-entropy against outcome labels, so calibration
35
+ is learned. No cap on the number of options, unlike letter-logit prompting.
36
+
37
+ ## Results
38
+
39
+ Vision generalization grid: rendered receipts, bar charts, tables, forms,
40
+ and shape scenes, with every label computed by the code that drew the
41
+ image. Operations: extract, read, classify, compare, count, consistency,
42
+ negation. 300 held-out items, accuracy / ECE (15 bins).
43
+
44
+ | model | vision grid | ms per item, RTX A6000 |
45
+ |---|---|---|
46
+ | Qwen3-VL-4B-Instruct, raw, letter logits | 96.0% / 0.041 | 61 |
47
+ | **circuit-vl-4b** | **98.3% / 0.018** | 90 |
48
+
49
+ Per cell the fine-tune is at 100% on every receipt, form, and chart family,
50
+ 93% on counting rows in tables, and 97% on negated questions about scenes.
51
+
52
+ Caveats. The grid is ours, so this is held-out items, not held-out
53
+ structure; the training set is small (1,083 items); and on the handful of
54
+ items rendered to be undecidable (a blurred field under a comparison
55
+ question) the model answers with mean confidence 0.93 where it should be
56
+ near 0.5. As with the text models, calibration on ambiguity is the open
57
+ problem, and it is why decision circuits put an uncertainty band around
58
+ every threshold.
59
+
60
+ ## Training
61
+
62
+ - Base: `Qwen/Qwen3-VL-4B-Instruct` (Apache 2.0), frozen. LoRA rank 16,
63
+ alpha 32, on the language model's attention and MLP projections only
64
+ (33M params). Pointer head: two 2560 x 256 linear maps.
65
+ - Data: the vision grid (`python -m s1proto.data.vision_grid` in the
66
+ [circuit](https://github.com/Barneyjm/circuit) repo), 1,083 train and
67
+ 117 validation items, labels computed at render time, about 5% rendered
68
+ ambiguous with soft 0.5 labels. No teacher-model outputs.
69
+ - 2 epochs, batch 4, max 1,536 tokens, lr 1e-4 (LoRA) / 1e-3 (head), bf16
70
+ with gradient checkpointing, soft-target cross-entropy, early stopping on
71
+ validation ECE (best at step 500: ECE 0.016, accuracy 98.3%). 7 minutes on
72
+ one RTX A6000.
73
+
74
+ ## Use
75
+
76
+ Score a JSONL of `{"state": {"image": path, "text": ...}, "question": ...}`
77
+ items with the circuit repo's evaluator:
78
+
79
+ ```bash
80
+ uv run python scripts/eval_vision.py data/vision/grid/eval.jsonl --lora runs/circuit-vl-4b --out results/vgrid.json
81
+ ```
82
+
83
+ Files: `adapter/` (PEFT LoRA, language-model targets), `head.pt` (pointer
84
+ head, keys `q.weight`, `k.weight`), `config.json` (base, hidden size, head
85
+ type, layout, modality, training args). The HTTP service in the repo serves
86
+ the text models today; image states over `POST /v1/systemone` are the next
87
+ step for this one.
88
+
89
+ ## Intended use and limits
90
+
91
+ Research and evaluation of calibrated decision models over documents,
92
+ charts, forms, and photos. Not a production system for decisions that affect
93
+ people. Trained on rendered synthetic documents; expect a drop on
94
+ photographs of real paperwork until real data is in the mix. English only.
95
+
96
+ ## License
97
+
98
+ Adapter and head: Apache 2.0. Base model: Apache 2.0 (Qwen3-VL).
adapter/README.md ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-VL-4B-Instruct
3
+ library_name: peft
4
+ tags:
5
+ - base_model:adapter:Qwen/Qwen3-VL-4B-Instruct
6
+ - lora
7
+ - transformers
8
+ ---
9
+
10
+ # Model Card for Model ID
11
+
12
+ <!-- Provide a quick summary of what the model is/does. -->
13
+
14
+
15
+
16
+ ## Model Details
17
+
18
+ ### Model Description
19
+
20
+ <!-- Provide a longer summary of what this model is. -->
21
+
22
+
23
+
24
+ - **Developed by:** [More Information Needed]
25
+ - **Funded by [optional]:** [More Information Needed]
26
+ - **Shared by [optional]:** [More Information Needed]
27
+ - **Model type:** [More Information Needed]
28
+ - **Language(s) (NLP):** [More Information Needed]
29
+ - **License:** [More Information Needed]
30
+ - **Finetuned from model [optional]:** [More Information Needed]
31
+
32
+ ### Model Sources [optional]
33
+
34
+ <!-- Provide the basic links for the model. -->
35
+
36
+ - **Repository:** [More Information Needed]
37
+ - **Paper [optional]:** [More Information Needed]
38
+ - **Demo [optional]:** [More Information Needed]
39
+
40
+ ## Uses
41
+
42
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
43
+
44
+ ### Direct Use
45
+
46
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
47
+
48
+ [More Information Needed]
49
+
50
+ ### Downstream Use [optional]
51
+
52
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
53
+
54
+ [More Information Needed]
55
+
56
+ ### Out-of-Scope Use
57
+
58
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
59
+
60
+ [More Information Needed]
61
+
62
+ ## Bias, Risks, and Limitations
63
+
64
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
65
+
66
+ [More Information Needed]
67
+
68
+ ### Recommendations
69
+
70
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
71
+
72
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
73
+
74
+ ## How to Get Started with the Model
75
+
76
+ Use the code below to get started with the model.
77
+
78
+ [More Information Needed]
79
+
80
+ ## Training Details
81
+
82
+ ### Training Data
83
+
84
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
85
+
86
+ [More Information Needed]
87
+
88
+ ### Training Procedure
89
+
90
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
91
+
92
+ #### Preprocessing [optional]
93
+
94
+ [More Information Needed]
95
+
96
+
97
+ #### Training Hyperparameters
98
+
99
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
100
+
101
+ #### Speeds, Sizes, Times [optional]
102
+
103
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
104
+
105
+ [More Information Needed]
106
+
107
+ ## Evaluation
108
+
109
+ <!-- This section describes the evaluation protocols and provides the results. -->
110
+
111
+ ### Testing Data, Factors & Metrics
112
+
113
+ #### Testing Data
114
+
115
+ <!-- This should link to a Dataset Card if possible. -->
116
+
117
+ [More Information Needed]
118
+
119
+ #### Factors
120
+
121
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
122
+
123
+ [More Information Needed]
124
+
125
+ #### Metrics
126
+
127
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
128
+
129
+ [More Information Needed]
130
+
131
+ ### Results
132
+
133
+ [More Information Needed]
134
+
135
+ #### Summary
136
+
137
+
138
+
139
+ ## Model Examination [optional]
140
+
141
+ <!-- Relevant interpretability work for the model goes here -->
142
+
143
+ [More Information Needed]
144
+
145
+ ## Environmental Impact
146
+
147
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
148
+
149
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
150
+
151
+ - **Hardware Type:** [More Information Needed]
152
+ - **Hours used:** [More Information Needed]
153
+ - **Cloud Provider:** [More Information Needed]
154
+ - **Compute Region:** [More Information Needed]
155
+ - **Carbon Emitted:** [More Information Needed]
156
+
157
+ ## Technical Specifications [optional]
158
+
159
+ ### Model Architecture and Objective
160
+
161
+ [More Information Needed]
162
+
163
+ ### Compute Infrastructure
164
+
165
+ [More Information Needed]
166
+
167
+ #### Hardware
168
+
169
+ [More Information Needed]
170
+
171
+ #### Software
172
+
173
+ [More Information Needed]
174
+
175
+ ## Citation [optional]
176
+
177
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
178
+
179
+ **BibTeX:**
180
+
181
+ [More Information Needed]
182
+
183
+ **APA:**
184
+
185
+ [More Information Needed]
186
+
187
+ ## Glossary [optional]
188
+
189
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
190
+
191
+ [More Information Needed]
192
+
193
+ ## More Information [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Authors [optional]
198
+
199
+ [More Information Needed]
200
+
201
+ ## Model Card Contact
202
+
203
+ [More Information Needed]
204
+ ### Framework versions
205
+
206
+ - PEFT 0.21.0
adapter/adapter_config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "Qwen3VLForConditionalGeneration",
7
+ "parent_library": "transformers.models.qwen3_vl.modeling_qwen3_vl"
8
+ },
9
+ "base_model_name_or_path": "Qwen/Qwen3-VL-4B-Instruct",
10
+ "bias": "none",
11
+ "corda_config": null,
12
+ "ensure_weight_tying": false,
13
+ "eva_config": null,
14
+ "exclude_modules": null,
15
+ "fan_in_fan_out": false,
16
+ "inference_mode": true,
17
+ "init_lora_weights": true,
18
+ "kasa_config": null,
19
+ "layer_replication": null,
20
+ "layers_pattern": null,
21
+ "layers_to_transform": null,
22
+ "loftq_config": {},
23
+ "lora_alpha": 32,
24
+ "lora_bias": false,
25
+ "lora_dropout": 0.05,
26
+ "lora_ga_config": null,
27
+ "megatron_config": null,
28
+ "megatron_core": "megatron.core",
29
+ "modules_to_save": null,
30
+ "monteclora_config": null,
31
+ "peft_type": "LORA",
32
+ "peft_version": "0.21.0",
33
+ "qalora_group_size": 16,
34
+ "r": 16,
35
+ "rank_pattern": {},
36
+ "revision": null,
37
+ "target_modules": ".*language_model.*\\.(q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj)",
38
+ "target_parameters": null,
39
+ "task_type": null,
40
+ "trainable_token_indices": null,
41
+ "use_bdlora": null,
42
+ "use_dora": false,
43
+ "use_qalora": false,
44
+ "use_rslora": false,
45
+ "velora_config": null
46
+ }
adapter/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68245b4578a66fe3bd273dd3c1f4a44b9f1c584b4446dc343b47f011f1d47324
3
+ size 132195448
config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base": "Qwen/Qwen3-VL-4B-Instruct",
3
+ "hidden": 2560,
4
+ "head": "pointer",
5
+ "head_size": 256,
6
+ "head_dim": 256,
7
+ "layout": "pointer",
8
+ "load_4bit": false,
9
+ "modality": "vision",
10
+ "best": {
11
+ "ece": 0.015816945805508867,
12
+ "accuracy": 0.9829059829059829,
13
+ "kl": 0.027667189338858887,
14
+ "step": 500
15
+ },
16
+ "args": {
17
+ "model": "Qwen/Qwen3-VL-4B-Instruct",
18
+ "data": "data/vision/grid/train.jsonl",
19
+ "out": "runs/circuit-vl-4b",
20
+ "epochs": 2,
21
+ "batch": 4,
22
+ "lr": 0.0001,
23
+ "head_lr": 0.001,
24
+ "rank": 16,
25
+ "max_length": 1536,
26
+ "val_frac": 0.1,
27
+ "eval_every": 100,
28
+ "limit": null,
29
+ "seed": 0,
30
+ "dtype": "bfloat16",
31
+ "grad_checkpoint": true,
32
+ "wandb": "s1proto",
33
+ "run_name": "circuit-vl-4b",
34
+ "resume": false,
35
+ "head": "pointer",
36
+ "load_4bit": false,
37
+ "modality": "vision",
38
+ "exclude_family": null
39
+ }
40
+ }
head.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da12c989d8e688b22cb3a69618ba54324e5a469c61d7028538fd211bd8dfa604
3
+ size 5244685