Georgefifth commited on
Commit
e7f0307
·
verified ·
1 Parent(s): a3ff461

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. index.html +164 -17
  2. style.css +310 -15
index.html CHANGED
@@ -1,19 +1,166 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
  <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width" />
6
+ <title>Tiny Browser Planner — Research Story</title>
7
+ <link rel="stylesheet" href="style.css" />
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <header>
12
+ <h1>A 1B model can explain the correct browser action<br>before it can reliably choose it.</h1>
13
+ <p class="subtitle">Fine-tuning MiniCPM5-1B with LoRA to study what a small model learns about planning.</p>
14
+ <div class="links">
15
+ <a href="https://huggingface.co/Georgefifth/tiny-browser-planner-reason" class="btn">Model</a>
16
+ <a href="https://huggingface.co/datasets/Georgefifth/tiny-browser-planner-data" class="btn">Dataset</a>
17
+ <a href="https://github.com/Georgefifth/tiny-browser-planner" class="btn">Code</a>
18
+ </div>
19
+ </header>
20
+
21
+ <section>
22
+ <h2>The Problem</h2>
23
+ <p>Large browser agents (7B+) are expensive and slow. Can a <strong>1B parameter model</strong> learn to plan browser actions — search, navigate, extract, backtrack — or does it just memorize heuristics?</p>
24
+ <div class="action-box">
25
+ <span class="tag">search</span>
26
+ <span class="tag">open_page</span>
27
+ <span class="tag">extract</span>
28
+ <span class="tag">back</span>
29
+ <span class="tag">refine_search</span>
30
+ <span class="tag">finish</span>
31
+ </div>
32
+ </section>
33
+
34
+ <section>
35
+ <h2>Experiment Timeline</h2>
36
+ <div class="timeline">
37
+ <div class="step">
38
+ <div class="step-num">v1</div>
39
+ <div class="step-body">
40
+ <strong>Linear data</strong> — 1142 samples, perfect regularity
41
+ <div class="result">Learned patterns, couldn't generalize</div>
42
+ </div>
43
+ </div>
44
+ <div class="step">
45
+ <div class="step-num">v2/v3</div>
46
+ <div class="step-body">
47
+ <strong>More data</strong> — 1504 → 1948 samples
48
+ <div class="result">Still 72% — more data didn't help</div>
49
+ </div>
50
+ </div>
51
+ <div class="step">
52
+ <div class="step-num">v4</div>
53
+ <div class="step-body">
54
+ <strong>Hard samples</strong> — 243 targeted examples, 89 decision points
55
+ <div class="result winner">200 quality examples &gt; 2000 generic ones</div>
56
+ </div>
57
+ </div>
58
+ <div class="step highlight">
59
+ <div class="step-num">Ablation</div>
60
+ <div class="step-body">
61
+ <strong>The Action Space Paradox</strong>
62
+ <p>Adding <code>back</code> gave the model a powerful tool — but it over-generalized. Both models (with/without back) learned a single heuristic instead of conditional selection.</p>
63
+ <table>
64
+ <tr><th>Model</th><th>Wrong page</th><th>Paywall</th><th>Standard</th><th>Refine</th><th>Total</th></tr>
65
+ <tr><td>vA (no back)</td><td class="pass">search ✅</td><td class="pass">search ✅</td><td class="pass">extract ✅</td><td class="pass">search ✅</td><td class="pass">11/11</td></tr>
66
+ <tr><td>vB (with back)</td><td class="pass">back ✅</td><td class="warn">back ✅</td><td class="fail">back ❌</td><td class="fail">back ❌</td><td class="fail">4/12</td></tr>
67
+ </table>
68
+ <div class="result insight">More actions → more capability → more confusion. The model trades expressive power for decision quality.</div>
69
+ </div>
70
+ </div>
71
+ <div class="step highlight">
72
+ <div class="step-num">Reason-First</div>
73
+ <div class="step-body">
74
+ <strong>Fixed with 40 samples and 7.8 seconds of training</strong>
75
+ <p>Hypothesis: the model <em>does</em> understand state, but action-only format encourages shortcutting. Forced reasoning before action.</p>
76
+ <div class="format-box">
77
+ <code>Observation → <span class="em">Reason: ...</span> → Action: ...</code>
78
+ </div>
79
+ <table>
80
+ <tr><th>Scenario</th><th>vB (action-only)</th><th>Reason-First</th></tr>
81
+ <tr><td>Wrong page</td><td class="pass">back ✅</td><td class="pass">back ✅</td></tr>
82
+ <tr><td>Paywall</td><td class="warn">1/2</td><td class="pass">back ✅</td></tr>
83
+ <tr><td>Standard page</td><td class="fail">back ❌</td><td class="pass">extract ✅</td></tr>
84
+ <tr><td>Needs refine</td><td class="fail">back ❌</td><td class="pass">refine_search ✅</td></tr>
85
+ <tr><td><strong>Total</strong></td><td class="fail"><strong>4/12</strong></td><td class="pass"><strong>10/12</strong></td></tr>
86
+ </table>
87
+ <div class="result winner">Reasoning eliminates heuristic shortcutting.</div>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </section>
92
+
93
+ <section>
94
+ <h2>Why It Works</h2>
95
+ <div class="example">
96
+ <div class="example-header wrong">Action-Only (vB)</div>
97
+ <div class="example-body">
98
+ <p><strong>Input:</strong> Task: Find Apple stock price — Page shows price prominently</p>
99
+ <p><strong>Output:</strong> <span class="bad">back</span></p>
100
+ <p class="note">Heuristic: "obstacle → back" applied to everything</p>
101
+ </div>
102
+ </div>
103
+ <div class="example">
104
+ <div class="example-header correct">Reason-First</div>
105
+ <div class="example-body">
106
+ <p><strong>Input:</strong> Task: Find Apple stock price — Page shows price prominently</p>
107
+ <p><strong>Output:</strong> <span class="good">Reason: Target information is present on the page</span></p>
108
+ <p><strong>Output:</strong> <span class="good">Action: extract ✅</span></p>
109
+ </div>
110
+ </div>
111
+ <p class="insight">The model already understood the state. The reasoning head exposes that knowledge.</p>
112
+ </section>
113
+
114
+ <section>
115
+ <h3>Key Insights</h3>
116
+ <div class="cards">
117
+ <div class="card">
118
+ <div class="card-icon">📊</div>
119
+ <h4>Data Quality > Quantity</h4>
120
+ <p>200 targeted hard samples outperformed 2000 generic ones.</p>
121
+ </div>
122
+ <div class="card">
123
+ <div class="card-icon">🎯</div>
124
+ <h4>Reasoning > Data</h4>
125
+ <p>40 reason-first samples outperformed 88 action-only samples by fixing heuristic shortcutting.</p>
126
+ </div>
127
+ <div class="card">
128
+ <div class="card-icon">🧠</div>
129
+ <h4>State Understanding</h4>
130
+ <p>Correct reasoning in all passing cases confirms the model understands state — the bottleneck is action selection, not understanding.</p>
131
+ </div>
132
+ </div>
133
+ </section>
134
+
135
+ <section>
136
+ <h3>Try It Yourself</h3>
137
+ <pre><code>from unsloth import FastLanguageModel
138
+ import torch, re
139
+
140
+ model, tokenizer = FastLanguageModel.from_pretrained(
141
+ "Georgefifth/tiny-browser-planner-reason",
142
+ max_seq_length=2048,
143
+ load_in_4bit=True,
144
+ dtype=torch.bfloat16,
145
+ )
146
+ FastLanguageModel.for_inference(model)
147
+
148
+ msgs = [
149
+ {"role": "system", "content": "First reason, then output the action."},
150
+ {"role": "user", "content": "Task: Find Apple stock price\n\nHistory:\n[search] Search completed.\n[open_page] Price displayed prominently at $198\n\nWhat is the next action?"},
151
+ ]
152
+ prompt = tokenizer.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
153
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
154
+ outs = model.generate(**inputs, max_new_tokens=48)
155
+ print(tokenizer.decode(outs[0], skip_special_tokens=True))
156
+ # Output:
157
+ # Reason: Target information is present on the page
158
+ # Action: extract</code></pre>
159
+ </section>
160
+
161
+ <footer>
162
+ <p>Built with <a href="https://huggingface.co/openbmb/MiniCPM5-1B">MiniCPM5-1B</a> + <a href="https://github.com/unslothai/unsloth">Unsloth</a> | <a href="https://huggingface.co/spaces/Georgefifth/tiny-browser-planner">Space</a></p>
163
+ </footer>
164
+ </div>
165
+ </body>
166
  </html>
style.css CHANGED
@@ -1,28 +1,323 @@
 
 
 
 
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
  h1 {
7
- font-size: 16px;
8
- margin-top: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }
10
 
11
  p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
  .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
28
  }
 
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
  body {
8
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
9
+ background: #0a0a0f;
10
+ color: #e0e0e0;
11
+ line-height: 1.7;
12
+ }
13
+
14
+ .container {
15
+ max-width: 800px;
16
+ margin: 0 auto;
17
+ padding: 40px 20px;
18
+ }
19
+
20
+ header {
21
+ text-align: center;
22
+ padding: 60px 0 40px;
23
  }
24
 
25
  h1 {
26
+ font-size: 1.8em;
27
+ font-weight: 700;
28
+ color: #ffffff;
29
+ line-height: 1.3;
30
+ margin-bottom: 16px;
31
+ }
32
+
33
+ .subtitle {
34
+ font-size: 1.05em;
35
+ color: #888;
36
+ margin-bottom: 24px;
37
+ }
38
+
39
+ .links {
40
+ display: flex;
41
+ gap: 12px;
42
+ justify-content: center;
43
+ flex-wrap: wrap;
44
+ }
45
+
46
+ .btn {
47
+ display: inline-block;
48
+ padding: 10px 24px;
49
+ border-radius: 8px;
50
+ background: #1a1a2e;
51
+ color: #e0e0e0;
52
+ text-decoration: none;
53
+ font-weight: 500;
54
+ font-size: 0.9em;
55
+ transition: all 0.2s;
56
+ border: 1px solid #333;
57
+ }
58
+
59
+ .btn:hover {
60
+ background: #2a2a4e;
61
+ border-color: #555;
62
+ }
63
+
64
+ section {
65
+ margin: 40px 0;
66
+ }
67
+
68
+ h2 {
69
+ font-size: 1.3em;
70
+ color: #ffffff;
71
+ margin-bottom: 16px;
72
+ padding-bottom: 8px;
73
+ border-bottom: 1px solid #222;
74
+ }
75
+
76
+ h3 {
77
+ font-size: 1.15em;
78
+ color: #ffffff;
79
+ margin-bottom: 16px;
80
  }
81
 
82
  p {
83
+ margin-bottom: 12px;
84
+ color: #b0b0b0;
85
+ }
86
+
87
+ .action-box {
88
+ display: flex;
89
+ gap: 8px;
90
+ flex-wrap: wrap;
91
+ margin: 16px 0;
92
+ }
93
+
94
+ .tag {
95
+ display: inline-block;
96
+ padding: 4px 14px;
97
+ border-radius: 20px;
98
+ background: #1a1a2e;
99
+ border: 1px solid #333;
100
+ font-size: 0.85em;
101
+ font-family: "SF Mono", "Consolas", monospace;
102
+ color: #99c;
103
+ }
104
+
105
+ .timeline {
106
+ display: flex;
107
+ flex-direction: column;
108
+ gap: 4px;
109
+ }
110
+
111
+ .step {
112
+ display: flex;
113
+ gap: 16px;
114
+ padding: 16px;
115
+ border-radius: 8px;
116
+ background: #111118;
117
+ border: 1px solid #1a1a22;
118
+ transition: all 0.2s;
119
+ }
120
+
121
+ .step.highlight {
122
+ background: #12121e;
123
+ border-color: #2a2a44;
124
+ }
125
+
126
+ .step-num {
127
+ flex-shrink: 0;
128
+ width: 70px;
129
+ font-weight: 700;
130
+ font-size: 0.85em;
131
+ color: #6688cc;
132
+ padding-top: 2px;
133
+ }
134
+
135
+ .step-body {
136
+ flex: 1;
137
+ font-size: 0.92em;
138
+ color: #b0b0b0;
139
+ }
140
+
141
+ .step-body p {
142
+ margin: 8px 0;
143
+ }
144
+
145
+ .step-body code {
146
+ background: #1a1a2e;
147
+ padding: 2px 6px;
148
+ border-radius: 4px;
149
+ font-size: 0.9em;
150
+ color: #aaccff;
151
+ }
152
+
153
+ .result {
154
+ margin-top: 8px;
155
+ padding: 6px 12px;
156
+ border-radius: 6px;
157
+ background: #181822;
158
+ font-size: 0.9em;
159
+ color: #999;
160
+ }
161
+
162
+ .result.winner {
163
+ border-left: 3px solid #4caf50;
164
+ color: #81c784;
165
+ }
166
+
167
+ .result.insight {
168
+ border-left: 3px solid #ff9800;
169
+ color: #ffb74d;
170
+ }
171
+
172
+ table {
173
+ width: 100%;
174
+ border-collapse: collapse;
175
+ margin: 12px 0;
176
+ font-size: 0.9em;
177
+ }
178
+
179
+ th, td {
180
+ padding: 8px 12px;
181
+ text-align: left;
182
+ border-bottom: 1px solid #222;
183
+ }
184
+
185
+ th {
186
+ color: #888;
187
+ font-weight: 600;
188
+ font-size: 0.85em;
189
+ text-transform: uppercase;
190
+ letter-spacing: 0.5px;
191
+ }
192
+
193
+ td.pass { color: #81c784; }
194
+ td.warn { color: #ffb74d; }
195
+ td.fail { color: #ef5350; }
196
+
197
+ .format-box {
198
+ background: #1a1a2e;
199
+ padding: 12px 16px;
200
+ border-radius: 8px;
201
+ margin: 12px 0;
202
+ font-size: 0.9em;
203
+ text-align: center;
204
+ }
205
+
206
+ .format-box .em {
207
+ color: #ffb74d;
208
+ font-weight: 600;
209
+ }
210
+
211
+ .example {
212
+ margin: 16px 0;
213
+ border-radius: 8px;
214
+ overflow: hidden;
215
+ border: 1px solid #222;
216
+ }
217
+
218
+ .example-header {
219
+ padding: 10px 16px;
220
+ font-weight: 600;
221
+ font-size: 0.85em;
222
+ }
223
+
224
+ .example-header.wrong { background: #2a1010; color: #ef5350; }
225
+ .example-header.correct { background: #0a2a10; color: #81c784; }
226
+
227
+ .example-body {
228
+ padding: 16px;
229
+ background: #0e0e14;
230
+ }
231
+
232
+ .example-body p {
233
+ margin-bottom: 4px;
234
+ font-family: "SF Mono", "Consolas", monospace;
235
+ font-size: 0.85em;
236
+ }
237
+
238
+ .bad { color: #ef5350; font-weight: 600; }
239
+ .good { color: #81c784; }
240
+
241
+ .note {
242
+ color: #666 !important;
243
+ font-family: inherit !important;
244
+ font-size: 0.85em !important;
245
+ }
246
+
247
+ .insight {
248
+ font-size: 1em;
249
+ color: #ffb74d;
250
+ font-weight: 500;
251
+ text-align: center;
252
+ padding: 16px;
253
+ }
254
+
255
+ .cards {
256
+ display: grid;
257
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
258
+ gap: 16px;
259
  }
260
 
261
  .card {
262
+ padding: 20px;
263
+ background: #111118;
264
+ border: 1px solid #1a1a22;
265
+ border-radius: 8px;
266
+ }
267
+
268
+ .card-icon {
269
+ font-size: 1.5em;
270
+ margin-bottom: 8px;
271
+ }
272
+
273
+ .card h4 {
274
+ color: #ffffff;
275
+ margin-bottom: 8px;
276
+ font-size: 0.95em;
277
+ }
278
+
279
+ .card p {
280
+ font-size: 0.85em;
281
+ color: #888;
282
+ }
283
+
284
+ pre {
285
+ background: #0e0e14;
286
+ padding: 20px;
287
+ border-radius: 8px;
288
+ overflow-x: auto;
289
+ border: 1px solid #1a1a22;
290
+ }
291
+
292
+ code {
293
+ font-family: "SF Mono", "Consolas", "Liberation Mono", monospace;
294
+ font-size: 0.85em;
295
+ color: #aaccff;
296
+ line-height: 1.6;
297
+ }
298
+
299
+ footer {
300
+ text-align: center;
301
+ padding: 40px 0;
302
+ color: #555;
303
+ font-size: 0.85em;
304
+ }
305
+
306
+ footer a {
307
+ color: #6688cc;
308
+ text-decoration: none;
309
+ }
310
+
311
+ footer a:hover {
312
+ text-decoration: underline;
313
+ }
314
+
315
+ a {
316
+ color: #6688cc;
317
  }
318
 
319
+ @media (max-width: 600px) {
320
+ h1 { font-size: 1.3em; }
321
+ .step { flex-direction: column; gap: 8px; }
322
+ .step-num { width: auto; }
323
  }