arnabwithab commited on
Commit
6a87150
·
verified ·
1 Parent(s): 32469ef

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: laya
4
+ tags: [laya, system-one, android, phone-agent, decision-model]
5
+ ---
6
+
7
+ # laya-ac-phone-v1
8
+
9
+ Laya-english (ModernBERT-large, 421M) fully finetuned with RLCD on AndroidControl
10
+ phone-control steps converted to System One decisions (`operation` choice over
11
+ TAP/TYPE/SCROLL/BACK/WAIT/DONE + `done` noul; state = goal + step history).
12
+
13
+ - Train: 18,354 rows, 4 epochs on Kaggle T4 (`eros438/phone-decisions-ac`)
14
+ - Held-out operation accuracy (984 unseen goals): base 0.261 → **0.665**
15
+ - In-sample calibration: acc 0.85, ECE 0.037
16
+
17
+ ```python
18
+ import laya
19
+ agent = laya.load("arnabwithab/laya-ac-phone-v1", device="cuda")
20
+ agent.predict("Goal: ...", {"operation": {"type": "choice",
21
+ "instructions": "Which operation moves this phone task forward?",
22
+ "criteria": {"TAP": "...", "TYPE": "...", "SCROLL": "...",
23
+ "BACK": "...", "WAIT": "...", "DONE": "..."}}})
24
+ ```
25
+
26
+ Serves via `laya-serve` (`LAYA_MODELS` pointing at this repo).
encoder/config.json ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertForMaskedLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 50281,
8
+ "classifier_activation": "gelu",
9
+ "classifier_bias": false,
10
+ "classifier_dropout": 0.0,
11
+ "classifier_pooling": "mean",
12
+ "cls_token_id": 50281,
13
+ "decoder_bias": true,
14
+ "deterministic_flash_attn": false,
15
+ "dtype": "float32",
16
+ "embedding_dropout": 0.0,
17
+ "eos_token_id": 50282,
18
+ "global_attn_every_n_layers": 3,
19
+ "gradient_checkpointing": false,
20
+ "hidden_activation": "gelu",
21
+ "hidden_size": 1024,
22
+ "initializer_cutoff_factor": 2.0,
23
+ "initializer_range": 0.02,
24
+ "intermediate_size": 2624,
25
+ "layer_norm_eps": 1e-05,
26
+ "layer_types": [
27
+ "full_attention",
28
+ "sliding_attention",
29
+ "sliding_attention",
30
+ "full_attention",
31
+ "sliding_attention",
32
+ "sliding_attention",
33
+ "full_attention",
34
+ "sliding_attention",
35
+ "sliding_attention",
36
+ "full_attention",
37
+ "sliding_attention",
38
+ "sliding_attention",
39
+ "full_attention",
40
+ "sliding_attention",
41
+ "sliding_attention",
42
+ "full_attention",
43
+ "sliding_attention",
44
+ "sliding_attention",
45
+ "full_attention",
46
+ "sliding_attention",
47
+ "sliding_attention",
48
+ "full_attention",
49
+ "sliding_attention",
50
+ "sliding_attention",
51
+ "full_attention",
52
+ "sliding_attention",
53
+ "sliding_attention",
54
+ "full_attention"
55
+ ],
56
+ "local_attention": 128,
57
+ "max_position_embeddings": 8192,
58
+ "mlp_bias": false,
59
+ "mlp_dropout": 0.0,
60
+ "model_type": "modernbert",
61
+ "norm_bias": false,
62
+ "norm_eps": 1e-05,
63
+ "num_attention_heads": 16,
64
+ "num_hidden_layers": 28,
65
+ "pad_token_id": 50283,
66
+ "position_embedding_type": "absolute",
67
+ "repad_logits_with_grad": false,
68
+ "rope_parameters": {
69
+ "full_attention": {
70
+ "rope_theta": 160000.0,
71
+ "rope_type": "default"
72
+ },
73
+ "sliding_attention": {
74
+ "rope_theta": 10000.0,
75
+ "rope_type": "default"
76
+ }
77
+ },
78
+ "sep_token_id": 50282,
79
+ "sparse_pred_ignore_index": -100,
80
+ "sparse_prediction": false,
81
+ "tie_word_embeddings": true,
82
+ "transformers_version": "5.16.1",
83
+ "vocab_size": 50368
84
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a26bcdd619356e6810807e2931a620b730ce51b64873181025677716b6cb331e
3
+ size 842609220
questions.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "operation": {
3
+ "type": "choice",
4
+ "instructions": "Which operation moves this phone task forward?",
5
+ "criteria": {
6
+ "TAP": "tap a control on screen",
7
+ "TYPE": "type text into a field",
8
+ "SCROLL": "scroll the screen",
9
+ "BACK": "go back to the previous screen",
10
+ "WAIT": "wait for the screen to settle",
11
+ "DONE": "the goal is already achieved, do nothing"
12
+ }
13
+ },
14
+ "done": {
15
+ "type": "noul",
16
+ "instructions": "Is the phone task complete?"
17
+ }
18
+ }
rl_agent_config.json ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "encoder": "answerdotai/ModernBERT-large",
3
+ "head_layers": 2,
4
+ "max_len": 512,
5
+ "head_max_len": 192,
6
+ "max_prefixes": 6,
7
+ "act_costs": {
8
+ "escalate": 0.5
9
+ },
10
+ "cost_wrong_act": 3.0,
11
+ "amp_dtype": "bf16",
12
+ "model_name": "rl-agent",
13
+ "temperature": [
14
+ 2.3200724124908447,
15
+ 1.0,
16
+ 1.0
17
+ ],
18
+ "training": {
19
+ "updates": 7313,
20
+ "epochs_completed": 1,
21
+ "hours": 1.96,
22
+ "world_size": 1,
23
+ "fine_tuned_from_checkpoint": true,
24
+ "laya_train": {
25
+ "epochs": 4,
26
+ "micro_batch": 8,
27
+ "grad_accum": 8,
28
+ "encoder_lr": 2.5e-05,
29
+ "head_lr": 0.0001,
30
+ "min_lr": 1e-06,
31
+ "weight_decay": 0.01,
32
+ "grad_clip": 1.0,
33
+ "loss": "rlcd",
34
+ "rl_samples": 4,
35
+ "sigma_start": 0.4,
36
+ "sigma_end": 0.1,
37
+ "w_sph": 0.75,
38
+ "w_rps": 1.0,
39
+ "shuffle_options": [],
40
+ "option_layout": null,
41
+ "freeze_encoder": false,
42
+ "calib_max": 400,
43
+ "calib_frac": 0.1,
44
+ "calib_seed": 20260922,
45
+ "seed": 0,
46
+ "max_len": null,
47
+ "head_max_len": null,
48
+ "amp": null,
49
+ "gradient_checkpointing": null,
50
+ "log_every": 100,
51
+ "label_smoothing": 0.0,
52
+ "text_column": "text",
53
+ "label_column": "label",
54
+ "question_id": "label",
55
+ "instructions": null,
56
+ "eval_data": null,
57
+ "target_error": 0.1,
58
+ "min_abstain_n": 10
59
+ },
60
+ "laya_train_calibration": {
61
+ "choice": {
62
+ "items": 197,
63
+ "temperature": 2.3200724124908447,
64
+ "issues": [],
65
+ "accuracy": 0.700507614213198,
66
+ "mean_confidence": 0.7349079253696408
67
+ },
68
+ "score": {
69
+ "items": 0,
70
+ "temperature": 1.0,
71
+ "issues": []
72
+ },
73
+ "noul": {
74
+ "items": 203,
75
+ "temperature": 1.0,
76
+ "issues": [
77
+ "the fit came back unchanged at 1.0 (accuracy 1.00, mean confidence 1.000 on the calibration items), which usually means they gave it nothing to correct; this type's confidences are uncalibrated"
78
+ ],
79
+ "accuracy": 1.0,
80
+ "mean_confidence": 0.9999999999981326
81
+ }
82
+ },
83
+ "train_report": {
84
+ "eval_source": "calibration_slice",
85
+ "eval_mode": "in_sample_calibration",
86
+ "is_held_out": false,
87
+ "eval_items": 400,
88
+ "note": "Metrics reflect in-sample calibration fit, not independent held-out evaluation. Provide --eval for held-out validation.",
89
+ "before": {
90
+ "items": 400,
91
+ "loss": 1.6005,
92
+ "accuracy": 0.4,
93
+ "mean_confidence": 0.6787,
94
+ "ece": 0.2787,
95
+ "brier": 0.7818,
96
+ "brier_top1": 0.3007,
97
+ "by_type": {
98
+ "choice": {
99
+ "items": 197,
100
+ "loss": 2.5345,
101
+ "accuracy": 0.2081,
102
+ "mean_confidence": 0.6239,
103
+ "ece": 0.4157,
104
+ "brier": 1.079,
105
+ "brier_top1": 0.3564
106
+ },
107
+ "noul": {
108
+ "items": 203,
109
+ "loss": 0.6941,
110
+ "accuracy": 0.5862,
111
+ "mean_confidence": 0.732,
112
+ "ece": 0.1485,
113
+ "brier": 0.4934,
114
+ "brier_top1": 0.2467
115
+ }
116
+ }
117
+ },
118
+ "after": {
119
+ "items": 400,
120
+ "loss": 0.4219,
121
+ "accuracy": 0.8525,
122
+ "mean_confidence": 0.8694,
123
+ "ece": 0.0372,
124
+ "brier": 0.2124,
125
+ "brier_top1": 0.0912,
126
+ "by_type": {
127
+ "choice": {
128
+ "items": 197,
129
+ "loss": 0.8566,
130
+ "accuracy": 0.7005,
131
+ "mean_confidence": 0.7349,
132
+ "ece": 0.0755,
133
+ "brier": 0.4313,
134
+ "brier_top1": 0.1852
135
+ },
136
+ "noul": {
137
+ "items": 203,
138
+ "loss": 0.0,
139
+ "accuracy": 1.0,
140
+ "mean_confidence": 1.0,
141
+ "ece": 0.0,
142
+ "brier": 0.0,
143
+ "brier_top1": 0.0
144
+ }
145
+ }
146
+ },
147
+ "comparison": {
148
+ "delta_accuracy": 0.4525,
149
+ "delta_loss": -1.1786,
150
+ "delta_ece": -0.2415,
151
+ "delta_brier": -0.5694,
152
+ "delta_brier_top1": -0.2095,
153
+ "delta_mean_confidence": 0.1907
154
+ },
155
+ "calibration": {
156
+ "choice": {
157
+ "items": 197,
158
+ "temperature": 2.3200724124908447,
159
+ "issues": [],
160
+ "accuracy": 0.700507614213198,
161
+ "mean_confidence": 0.7349079253696408
162
+ },
163
+ "score": {
164
+ "items": 0,
165
+ "temperature": 1.0,
166
+ "issues": []
167
+ },
168
+ "noul": {
169
+ "items": 203,
170
+ "temperature": 1.0,
171
+ "issues": [
172
+ "the fit came back unchanged at 1.0 (accuracy 1.00, mean confidence 1.000 on the calibration items), which usually means they gave it nothing to correct; this type's confidences are uncalibrated"
173
+ ],
174
+ "accuracy": 1.0,
175
+ "mean_confidence": 0.9999999999981326
176
+ }
177
+ },
178
+ "abstention_thresholds": {
179
+ "choice:6-10": 0.8826,
180
+ "noul:2": 1.0
181
+ },
182
+ "training": {
183
+ "epochs": 4,
184
+ "micro_batch": 8,
185
+ "grad_accum": 8,
186
+ "encoder_lr": 2.5e-05,
187
+ "head_lr": 0.0001,
188
+ "min_lr": 1e-06,
189
+ "weight_decay": 0.01,
190
+ "grad_clip": 1.0,
191
+ "loss": "rlcd",
192
+ "rl_samples": 4,
193
+ "sigma_start": 0.4,
194
+ "sigma_end": 0.1,
195
+ "w_sph": 0.75,
196
+ "w_rps": 1.0,
197
+ "shuffle_options": [],
198
+ "option_layout": null,
199
+ "freeze_encoder": false,
200
+ "calib_max": 400,
201
+ "calib_frac": 0.1,
202
+ "calib_seed": 20260922,
203
+ "seed": 0,
204
+ "max_len": null,
205
+ "head_max_len": null,
206
+ "amp": null,
207
+ "gradient_checkpointing": null,
208
+ "log_every": 100,
209
+ "label_smoothing": 0.0,
210
+ "text_column": "text",
211
+ "label_column": "label",
212
+ "question_id": "label",
213
+ "instructions": null,
214
+ "eval_data": null,
215
+ "target_error": 0.1,
216
+ "min_abstain_n": 10
217
+ }
218
+ },
219
+ "abstention_thresholds": {
220
+ "choice:6-10": 0.8826,
221
+ "noul:2": 1.0
222
+ }
223
+ },
224
+ "fine_tuned": true
225
+ }
tokenizer/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "clean_up_tokenization_spaces": true,
3
+ "cls_token": "[CLS]",
4
+ "local_files_only": false,
5
+ "mask_token": "[MASK]",
6
+ "model_input_names": [
7
+ "input_ids",
8
+ "attention_mask"
9
+ ],
10
+ "model_max_length": 8192,
11
+ "pad_token": "[PAD]",
12
+ "sep_token": "[SEP]",
13
+ "tokenizer_class": "PreTrainedTokenizerFast",
14
+ "unk_token": "[UNK]"
15
+ }
train_report.json ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "eval_source": "calibration_slice",
3
+ "eval_mode": "in_sample_calibration",
4
+ "is_held_out": false,
5
+ "eval_items": 400,
6
+ "note": "Metrics reflect in-sample calibration fit, not independent held-out evaluation. Provide --eval for held-out validation.",
7
+ "before": {
8
+ "items": 400,
9
+ "loss": 1.6005,
10
+ "accuracy": 0.4,
11
+ "mean_confidence": 0.6787,
12
+ "ece": 0.2787,
13
+ "brier": 0.7818,
14
+ "brier_top1": 0.3007,
15
+ "by_type": {
16
+ "choice": {
17
+ "items": 197,
18
+ "loss": 2.5345,
19
+ "accuracy": 0.2081,
20
+ "mean_confidence": 0.6239,
21
+ "ece": 0.4157,
22
+ "brier": 1.079,
23
+ "brier_top1": 0.3564
24
+ },
25
+ "noul": {
26
+ "items": 203,
27
+ "loss": 0.6941,
28
+ "accuracy": 0.5862,
29
+ "mean_confidence": 0.732,
30
+ "ece": 0.1485,
31
+ "brier": 0.4934,
32
+ "brier_top1": 0.2467
33
+ }
34
+ }
35
+ },
36
+ "after": {
37
+ "items": 400,
38
+ "loss": 0.4219,
39
+ "accuracy": 0.8525,
40
+ "mean_confidence": 0.8694,
41
+ "ece": 0.0372,
42
+ "brier": 0.2124,
43
+ "brier_top1": 0.0912,
44
+ "by_type": {
45
+ "choice": {
46
+ "items": 197,
47
+ "loss": 0.8566,
48
+ "accuracy": 0.7005,
49
+ "mean_confidence": 0.7349,
50
+ "ece": 0.0755,
51
+ "brier": 0.4313,
52
+ "brier_top1": 0.1852
53
+ },
54
+ "noul": {
55
+ "items": 203,
56
+ "loss": 0.0,
57
+ "accuracy": 1.0,
58
+ "mean_confidence": 1.0,
59
+ "ece": 0.0,
60
+ "brier": 0.0,
61
+ "brier_top1": 0.0
62
+ }
63
+ }
64
+ },
65
+ "comparison": {
66
+ "delta_accuracy": 0.4525,
67
+ "delta_loss": -1.1786,
68
+ "delta_ece": -0.2415,
69
+ "delta_brier": -0.5694,
70
+ "delta_brier_top1": -0.2095,
71
+ "delta_mean_confidence": 0.1907
72
+ },
73
+ "calibration": {
74
+ "choice": {
75
+ "items": 197,
76
+ "temperature": 2.3200724124908447,
77
+ "issues": [],
78
+ "accuracy": 0.700507614213198,
79
+ "mean_confidence": 0.7349079253696408
80
+ },
81
+ "score": {
82
+ "items": 0,
83
+ "temperature": 1.0,
84
+ "issues": []
85
+ },
86
+ "noul": {
87
+ "items": 203,
88
+ "temperature": 1.0,
89
+ "issues": [
90
+ "the fit came back unchanged at 1.0 (accuracy 1.00, mean confidence 1.000 on the calibration items), which usually means they gave it nothing to correct; this type's confidences are uncalibrated"
91
+ ],
92
+ "accuracy": 1.0,
93
+ "mean_confidence": 0.9999999999981326
94
+ }
95
+ },
96
+ "abstention_thresholds": {
97
+ "choice:6-10": 0.8826,
98
+ "noul:2": 1.0
99
+ },
100
+ "training": {
101
+ "epochs": 4,
102
+ "micro_batch": 8,
103
+ "grad_accum": 8,
104
+ "encoder_lr": 2.5e-05,
105
+ "head_lr": 0.0001,
106
+ "min_lr": 1e-06,
107
+ "weight_decay": 0.01,
108
+ "grad_clip": 1.0,
109
+ "loss": "rlcd",
110
+ "rl_samples": 4,
111
+ "sigma_start": 0.4,
112
+ "sigma_end": 0.1,
113
+ "w_sph": 0.75,
114
+ "w_rps": 1.0,
115
+ "shuffle_options": [],
116
+ "option_layout": null,
117
+ "freeze_encoder": false,
118
+ "calib_max": 400,
119
+ "calib_frac": 0.1,
120
+ "calib_seed": 20260922,
121
+ "seed": 0,
122
+ "max_len": null,
123
+ "head_max_len": null,
124
+ "amp": null,
125
+ "gradient_checkpointing": null,
126
+ "log_every": 100,
127
+ "label_smoothing": 0.0,
128
+ "text_column": "text",
129
+ "label_column": "label",
130
+ "question_id": "label",
131
+ "instructions": null,
132
+ "eval_data": null,
133
+ "target_error": 0.1,
134
+ "min_abstain_n": 10
135
+ }
136
+ }