fchis commited on
Commit
d27caf1
Β·
verified Β·
1 Parent(s): 5bc5503

Upload pipeline_diagram.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. pipeline_diagram.html +728 -0
pipeline_diagram.html ADDED
@@ -0,0 +1,728 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>BuildSpec Pipeline β€” Data Flow Diagram</title>
7
+ <style>
8
+ * { margin: 0; padding: 0; box-sizing: border-box; }
9
+
10
+ body {
11
+ font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
12
+ background: #0f1117;
13
+ color: #e2e8f0;
14
+ min-height: 100vh;
15
+ padding: 40px 20px;
16
+ }
17
+
18
+ .container {
19
+ max-width: 1100px;
20
+ margin: 0 auto;
21
+ }
22
+
23
+ h1 {
24
+ text-align: center;
25
+ font-size: 1.8em;
26
+ font-weight: 700;
27
+ color: #f1f5f9;
28
+ margin-bottom: 8px;
29
+ letter-spacing: -0.02em;
30
+ }
31
+
32
+ .subtitle {
33
+ text-align: center;
34
+ color: #94a3b8;
35
+ font-size: 0.95em;
36
+ margin-bottom: 50px;
37
+ }
38
+
39
+ /* ── Main pipeline ──────────────────────────────────── */
40
+
41
+ .pipeline {
42
+ display: flex;
43
+ flex-direction: column;
44
+ align-items: center;
45
+ gap: 0;
46
+ }
47
+
48
+ .stage {
49
+ width: 100%;
50
+ max-width: 680px;
51
+ position: relative;
52
+ }
53
+
54
+ .stage-box {
55
+ border-radius: 12px;
56
+ padding: 24px 28px;
57
+ position: relative;
58
+ transition: transform 0.2s, box-shadow 0.2s;
59
+ }
60
+
61
+ .stage-box:hover {
62
+ transform: translateY(-2px);
63
+ box-shadow: 0 8px 30px rgba(0,0,0,0.3);
64
+ }
65
+
66
+ .stage-number {
67
+ position: absolute;
68
+ top: -12px;
69
+ left: 24px;
70
+ background: #0f1117;
71
+ padding: 0 8px;
72
+ font-size: 0.7em;
73
+ font-weight: 700;
74
+ text-transform: uppercase;
75
+ letter-spacing: 0.1em;
76
+ color: #64748b;
77
+ }
78
+
79
+ .stage-title {
80
+ font-size: 1.15em;
81
+ font-weight: 700;
82
+ margin-bottom: 6px;
83
+ display: flex;
84
+ align-items: center;
85
+ gap: 10px;
86
+ }
87
+
88
+ .stage-desc {
89
+ font-size: 0.85em;
90
+ color: #94a3b8;
91
+ line-height: 1.5;
92
+ }
93
+
94
+ .stage-meta {
95
+ display: flex;
96
+ gap: 16px;
97
+ margin-top: 10px;
98
+ flex-wrap: wrap;
99
+ }
100
+
101
+ .meta-tag {
102
+ font-size: 0.75em;
103
+ padding: 3px 10px;
104
+ border-radius: 20px;
105
+ font-weight: 600;
106
+ }
107
+
108
+ /* ── Stage colors ───────────────────────────────────── */
109
+
110
+ .s-input .stage-box {
111
+ background: linear-gradient(135deg, #1e293b, #1a2332);
112
+ border: 1px solid #334155;
113
+ }
114
+ .s-input .stage-title { color: #e2e8f0; }
115
+ .s-input .meta-tag { background: #334155; color: #94a3b8; }
116
+
117
+ .s-planner .stage-box {
118
+ background: linear-gradient(135deg, #172554, #1e3a5f);
119
+ border: 1px solid #1d4ed8;
120
+ }
121
+ .s-planner .stage-title { color: #93c5fd; }
122
+ .s-planner .stage-number { color: #3b82f6; }
123
+ .s-planner .meta-tag { background: #1e3a8a; color: #93c5fd; }
124
+
125
+ .s-compiler .stage-box {
126
+ background: linear-gradient(135deg, #3b1764, #4c1d95);
127
+ border: 1px solid #7c3aed;
128
+ }
129
+ .s-compiler .stage-title { color: #c4b5fd; }
130
+ .s-compiler .stage-number { color: #8b5cf6; }
131
+ .s-compiler .meta-tag { background: #5b21b6; color: #c4b5fd; }
132
+
133
+ .s-generator .stage-box {
134
+ background: linear-gradient(135deg, #064e3b, #065f46);
135
+ border: 1px solid #10b981;
136
+ }
137
+ .s-generator .stage-title { color: #6ee7b7; }
138
+ .s-generator .stage-number { color: #34d399; }
139
+ .s-generator .meta-tag { background: #047857; color: #6ee7b7; }
140
+
141
+ .s-check .stage-box {
142
+ background: linear-gradient(135deg, #422006, #713f12);
143
+ border: 1px solid #f59e0b;
144
+ }
145
+ .s-check .stage-title { color: #fcd34d; }
146
+ .s-check .stage-number { color: #fbbf24; }
147
+ .s-check .meta-tag { background: #92400e; color: #fcd34d; }
148
+
149
+ .s-output .stage-box {
150
+ background: linear-gradient(135deg, #1c1917, #292524);
151
+ border: 1px solid #57534e;
152
+ }
153
+ .s-output .stage-title { color: #e7e5e4; }
154
+ .s-output .meta-tag { background: #44403c; color: #a8a29e; }
155
+
156
+ /* ── Arrows ─────────────────────────────────────────── */
157
+
158
+ .arrow {
159
+ display: flex;
160
+ flex-direction: column;
161
+ align-items: center;
162
+ padding: 6px 0;
163
+ position: relative;
164
+ }
165
+
166
+ .arrow-line {
167
+ width: 2px;
168
+ height: 28px;
169
+ background: linear-gradient(to bottom, #475569, #64748b);
170
+ }
171
+
172
+ .arrow-head {
173
+ width: 0;
174
+ height: 0;
175
+ border-left: 7px solid transparent;
176
+ border-right: 7px solid transparent;
177
+ border-top: 8px solid #64748b;
178
+ }
179
+
180
+ .arrow-label {
181
+ position: absolute;
182
+ right: calc(50% - 340px);
183
+ top: 50%;
184
+ transform: translateY(-50%);
185
+ font-size: 0.72em;
186
+ color: #64748b;
187
+ font-weight: 600;
188
+ text-align: right;
189
+ white-space: nowrap;
190
+ }
191
+
192
+ @media (max-width: 800px) {
193
+ .arrow-label {
194
+ position: static;
195
+ transform: none;
196
+ text-align: center;
197
+ margin-top: 4px;
198
+ }
199
+ }
200
+
201
+ /* ── Data samples ───────────────────────────────────── */
202
+
203
+ .data-sample {
204
+ margin-top: 12px;
205
+ background: rgba(0,0,0,0.3);
206
+ border-radius: 8px;
207
+ padding: 12px 16px;
208
+ font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
209
+ font-size: 0.78em;
210
+ line-height: 1.5;
211
+ color: #cbd5e1;
212
+ overflow-x: auto;
213
+ border: 1px solid rgba(255,255,255,0.06);
214
+ }
215
+
216
+ .data-sample .key { color: #93c5fd; }
217
+ .data-sample .str { color: #86efac; }
218
+ .data-sample .num { color: #fcd34d; }
219
+ .data-sample .bool { color: #f9a8d4; }
220
+ .data-sample .comment { color: #64748b; font-style: italic; }
221
+ .data-sample .php-tag { color: #c4b5fd; }
222
+ .data-sample .php-kw { color: #93c5fd; }
223
+ .data-sample .php-str { color: #86efac; }
224
+ .data-sample .php-cls { color: #fcd34d; }
225
+ .data-sample .err { color: #fca5a5; }
226
+
227
+ /* ── Error branch ───────────────────────────────────── */
228
+
229
+ .error-branch {
230
+ display: flex;
231
+ align-items: center;
232
+ gap: 12px;
233
+ margin-top: 12px;
234
+ }
235
+
236
+ .error-box {
237
+ background: rgba(239, 68, 68, 0.1);
238
+ border: 1px solid #dc2626;
239
+ border-radius: 8px;
240
+ padding: 10px 16px;
241
+ font-size: 0.8em;
242
+ color: #fca5a5;
243
+ flex: 1;
244
+ }
245
+
246
+ .error-arrow {
247
+ color: #dc2626;
248
+ font-size: 1.2em;
249
+ font-weight: bold;
250
+ }
251
+
252
+ .fix-box {
253
+ background: rgba(16, 185, 129, 0.1);
254
+ border: 1px solid #10b981;
255
+ border-radius: 8px;
256
+ padding: 10px 16px;
257
+ font-size: 0.8em;
258
+ color: #6ee7b7;
259
+ flex: 1;
260
+ }
261
+
262
+ /* ── Ontology comparison ────────────────────────────── */
263
+
264
+ .ontology-section {
265
+ max-width: 900px;
266
+ margin: 60px auto 0;
267
+ }
268
+
269
+ .ontology-section h2 {
270
+ text-align: center;
271
+ font-size: 1.3em;
272
+ color: #f1f5f9;
273
+ margin-bottom: 24px;
274
+ }
275
+
276
+ .ontology-compare {
277
+ display: grid;
278
+ grid-template-columns: 1fr 60px 1fr;
279
+ gap: 0;
280
+ align-items: start;
281
+ }
282
+
283
+ @media (max-width: 700px) {
284
+ .ontology-compare {
285
+ grid-template-columns: 1fr;
286
+ gap: 16px;
287
+ }
288
+ .ontology-vs { display: none; }
289
+ }
290
+
291
+ .ontology-card {
292
+ border-radius: 12px;
293
+ padding: 24px;
294
+ }
295
+
296
+ .ontology-card h3 {
297
+ font-size: 1em;
298
+ margin-bottom: 12px;
299
+ display: flex;
300
+ align-items: center;
301
+ gap: 8px;
302
+ }
303
+
304
+ .ontology-card ul {
305
+ list-style: none;
306
+ padding: 0;
307
+ }
308
+
309
+ .ontology-card li {
310
+ font-size: 0.82em;
311
+ padding: 6px 0;
312
+ border-bottom: 1px solid rgba(255,255,255,0.05);
313
+ line-height: 1.4;
314
+ }
315
+
316
+ .ontology-card li:last-child { border-bottom: none; }
317
+
318
+ .card-model {
319
+ background: linear-gradient(135deg, #1e1b4b, #312e81);
320
+ border: 1px solid #4338ca;
321
+ }
322
+ .card-model h3 { color: #a5b4fc; }
323
+ .card-model li { color: #c7d2fe; }
324
+
325
+ .card-dev {
326
+ background: linear-gradient(135deg, #022c22, #064e3b);
327
+ border: 1px solid #059669;
328
+ }
329
+ .card-dev h3 { color: #6ee7b7; }
330
+ .card-dev li { color: #a7f3d0; }
331
+
332
+ .ontology-vs {
333
+ display: flex;
334
+ align-items: center;
335
+ justify-content: center;
336
+ font-size: 1.5em;
337
+ font-weight: 800;
338
+ color: #475569;
339
+ padding-top: 60px;
340
+ }
341
+
342
+ .gap-label {
343
+ text-align: center;
344
+ margin-top: 16px;
345
+ font-size: 0.85em;
346
+ font-weight: 700;
347
+ color: #ef4444;
348
+ letter-spacing: 0.05em;
349
+ }
350
+
351
+ .bridge-label {
352
+ text-align: center;
353
+ margin-top: 8px;
354
+ font-size: 0.85em;
355
+ color: #10b981;
356
+ font-weight: 600;
357
+ }
358
+
359
+ /* ── Output files ───────────────────────────────────── */
360
+
361
+ .file-grid {
362
+ display: grid;
363
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
364
+ gap: 8px;
365
+ margin-top: 12px;
366
+ }
367
+
368
+ .file-item {
369
+ display: flex;
370
+ align-items: center;
371
+ gap: 8px;
372
+ font-size: 0.78em;
373
+ padding: 6px 10px;
374
+ background: rgba(255,255,255,0.04);
375
+ border-radius: 6px;
376
+ font-family: 'SF Mono', 'Fira Code', monospace;
377
+ color: #94a3b8;
378
+ }
379
+
380
+ .file-icon { font-size: 1em; }
381
+
382
+ /* ── Footer ─────────────────────────────────────────── */
383
+
384
+ .footer {
385
+ text-align: center;
386
+ margin-top: 50px;
387
+ color: #475569;
388
+ font-size: 0.8em;
389
+ }
390
+
391
+ .footer a { color: #6366f1; text-decoration: none; }
392
+ .footer a:hover { text-decoration: underline; }
393
+
394
+ /* ── Stats bar ──────────────────────────────────────── */
395
+
396
+ .stats-bar {
397
+ display: flex;
398
+ justify-content: center;
399
+ gap: 32px;
400
+ margin: 40px 0 10px;
401
+ flex-wrap: wrap;
402
+ }
403
+
404
+ .stat {
405
+ text-align: center;
406
+ }
407
+
408
+ .stat-value {
409
+ font-size: 1.8em;
410
+ font-weight: 800;
411
+ background: linear-gradient(135deg, #6366f1, #10b981);
412
+ -webkit-background-clip: text;
413
+ -webkit-text-fill-color: transparent;
414
+ background-clip: text;
415
+ }
416
+
417
+ .stat-label {
418
+ font-size: 0.75em;
419
+ color: #64748b;
420
+ text-transform: uppercase;
421
+ letter-spacing: 0.08em;
422
+ margin-top: 2px;
423
+ }
424
+ </style>
425
+ </head>
426
+ <body>
427
+
428
+ <div class="container">
429
+
430
+ <h1>BuildSpec Pipeline</h1>
431
+ <p class="subtitle">Closing the Ontological Gap in Domain-Specific Code Generation</p>
432
+
433
+ <!-- Stats -->
434
+ <div class="stats-bar">
435
+ <div class="stat">
436
+ <div class="stat-value">49</div>
437
+ <div class="stat-label">Training Examples</div>
438
+ </div>
439
+ <div class="stat">
440
+ <div class="stat-value">26/26</div>
441
+ <div class="stat-label">PHP Valid</div>
442
+ </div>
443
+ <div class="stat">
444
+ <div class="stat-value">20/20</div>
445
+ <div class="stat-label">Pest Tests Pass</div>
446
+ </div>
447
+ <div class="stat">
448
+ <div class="stat-value">0</div>
449
+ <div class="stat-label">Semantic Hallucinations</div>
450
+ </div>
451
+ <div class="stat">
452
+ <div class="stat-value">&lt;1ms</div>
453
+ <div class="stat-label">Spec Validation</div>
454
+ </div>
455
+ </div>
456
+
457
+ <!-- ═══ PIPELINE ═══ -->
458
+
459
+ <div class="pipeline">
460
+
461
+ <!-- Stage 0: Input -->
462
+ <div class="stage s-input">
463
+ <div class="stage-box">
464
+ <div class="stage-title">
465
+ <span>&#x1F4AC;</span> Natural Language Description
466
+ </div>
467
+ <div class="data-sample">
468
+ <span class="str">"Create a REST API for a book library. Books belong to authors.<br>
469
+ Each book has title, isbn (unique), year, pages, status.<br>
470
+ Books can be filtered by status. Soft deletes on books."</span>
471
+ </div>
472
+ </div>
473
+ </div>
474
+
475
+ <!-- Arrow -->
476
+ <div class="arrow">
477
+ <div class="arrow-line"></div>
478
+ <div class="arrow-head"></div>
479
+ <div class="arrow-label">Developer's intent (ambiguous)</div>
480
+ </div>
481
+
482
+ <!-- Stage 1: Planner -->
483
+ <div class="stage s-planner">
484
+ <div class="stage-box">
485
+ <div class="stage-number">Stage 1</div>
486
+ <div class="stage-title">
487
+ <span>&#x1F9E0;</span> Planner &mdash; Ontology Population
488
+ </div>
489
+ <div class="stage-desc">
490
+ Same Qwen2.5-Coder-7B model, few-shot prompted with 2 in-context examples.
491
+ Converts NL into structured BuildSpec JSON &mdash; populating the domain ontology.
492
+ </div>
493
+ <div class="stage-meta">
494
+ <span class="meta-tag">Qwen2.5-Coder-7B</span>
495
+ <span class="meta-tag">Few-shot (2 examples)</span>
496
+ <span class="meta-tag">max_tokens: 6000</span>
497
+ </div>
498
+ <div class="data-sample">
499
+ <span class="comment">// Output: BuildSpec JSON array (explicit domain ontology)</span><br>
500
+ [<br>
501
+ &nbsp;&nbsp;{<br>
502
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="key">"artifact"</span>: <span class="str">"migration"</span>,
503
+ <span class="key">"table"</span>: <span class="str">"authors"</span>,
504
+ <span class="key">"columns"</span>: [...]<br>
505
+ &nbsp;&nbsp;},<br>
506
+ &nbsp;&nbsp;{<br>
507
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="key">"artifact"</span>: <span class="str">"model"</span>,
508
+ <span class="key">"class"</span>: <span class="str">"Book"</span>,<br>
509
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="key">"fillable"</span>: [<span class="str">"title"</span>, <span class="str">"isbn"</span>, <span class="str">"year"</span>],<br>
510
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="key">"relationships"</span>: [{<span class="key">"type"</span>: <span class="str">"BelongsTo"</span>, <span class="key">"model"</span>: <span class="str">"Author"</span>}],<br>
511
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="key">"has_factory"</span>: <span class="bool">true</span>,
512
+ <span class="key">"soft_deletes"</span>: <span class="bool">true</span><br>
513
+ &nbsp;&nbsp;},<br>
514
+ &nbsp;&nbsp;{<span class="key">"artifact"</span>: <span class="str">"controller"</span>, <span class="key">"class"</span>: <span class="str">"BookController"</span>, ...},<br>
515
+ &nbsp;&nbsp;{<span class="key">"artifact"</span>: <span class="str">"resource"</span>, <span class="key">"class"</span>: <span class="str">"BookResource"</span>, ...},<br>
516
+ &nbsp;&nbsp;{<span class="key">"artifact"</span>: <span class="str">"form_request"</span>, <span class="key">"class"</span>: <span class="str">"StoreBookRequest"</span>, ...},<br>
517
+ &nbsp;&nbsp;...<br>
518
+ ]
519
+ </div>
520
+ </div>
521
+ </div>
522
+
523
+ <!-- Arrow -->
524
+ <div class="arrow">
525
+ <div class="arrow-line"></div>
526
+ <div class="arrow-head"></div>
527
+ <div class="arrow-label">BuildSpec JSON (explicit ontology)</div>
528
+ </div>
529
+
530
+ <!-- Stage 2: Compiler -->
531
+ <div class="stage s-compiler">
532
+ <div class="stage-box">
533
+ <div class="stage-number">Stage 2</div>
534
+ <div class="stage-title">
535
+ <span>&#x1F6E1;</span> Spec Compiler &mdash; Ontological Reasoning
536
+ </div>
537
+ <div class="stage-desc">
538
+ Deterministic validation: checks concept completeness, constraint satisfaction,
539
+ cross-reference integrity. Catches errors before the expensive generation step.
540
+ </div>
541
+ <div class="stage-meta">
542
+ <span class="meta-tag">Deterministic</span>
543
+ <span class="meta-tag">&lt; 1ms per spec</span>
544
+ <span class="meta-tag">spec_compiler.py</span>
545
+ </div>
546
+ <div class="error-branch">
547
+ <div class="error-box">
548
+ <span class="err">&#x2718;</span> <code>rules['venue_id']</code> contains <code>'required_on_post'</code>.<br>
549
+ Use <code>conditional_rules</code> dict instead.
550
+ </div>
551
+ <div class="error-arrow">&#x2192;</div>
552
+ <div class="fix-box">
553
+ <span style="color:#10b981;">&#x2714;</span> Fix the spec, not the model.<br>
554
+ Deterministic fix. Retry in &lt;1ms.
555
+ </div>
556
+ </div>
557
+ <div class="stage-meta" style="margin-top:12px;">
558
+ <span class="meta-tag">&#x2713; Required fields</span>
559
+ <span class="meta-tag">&#x2713; Conditional tokens</span>
560
+ <span class="meta-tag">&#x2713; Schema validation</span>
561
+ <span class="meta-tag">&#x2713; Defaults + paths</span>
562
+ </div>
563
+ </div>
564
+ </div>
565
+
566
+ <!-- Arrow -->
567
+ <div class="arrow">
568
+ <div class="arrow-line"></div>
569
+ <div class="arrow-head"></div>
570
+ <div class="arrow-label">Validated specs (ontology-verified)</div>
571
+ </div>
572
+
573
+ <!-- Stage 3: Generator -->
574
+ <div class="stage s-generator">
575
+ <div class="stage-box">
576
+ <div class="stage-number">Stage 3</div>
577
+ <div class="stage-title">
578
+ <span>&#x2699;</span> Code Generator &mdash; Ontology-to-Code
579
+ </div>
580
+ <div class="stage-desc">
581
+ LoRA-adapted model transforms each validated spec into a complete PHP file.
582
+ The model only decides <em>how</em> to generate &mdash; <em>what</em> to generate is fixed by the ontology.
583
+ </div>
584
+ <div class="stage-meta">
585
+ <span class="meta-tag">Qwen2.5-Coder-7B + LoRA</span>
586
+ <span class="meta-tag">adapters_spec_v4</span>
587
+ <span class="meta-tag">~30s per file</span>
588
+ <span class="meta-tag">49 training examples</span>
589
+ </div>
590
+ <div class="data-sample">
591
+ <span class="comment">// Input: one BuildSpec β†’ Output: one PHP file</span><br><br>
592
+ <span class="php-tag">&lt;?php</span><br>
593
+ <span class="php-kw">namespace</span> <span class="php-cls">App\Models</span>;<br><br>
594
+ <span class="php-kw">use</span> Illuminate\Database\Eloquent\Factories\<span class="php-cls">HasFactory</span>;<br>
595
+ <span class="php-kw">use</span> Illuminate\Database\Eloquent\<span class="php-cls">Model</span>;<br>
596
+ <span class="php-kw">use</span> Illuminate\Database\Eloquent\<span class="php-cls">SoftDeletes</span>;<br>
597
+ <span class="php-kw">use</span> Illuminate\Database\Eloquent\Relations\<span class="php-cls">BelongsTo</span>;<br><br>
598
+ <span class="php-kw">class</span> <span class="php-cls">Book</span> <span class="php-kw">extends</span> <span class="php-cls">Model</span><br>
599
+ {<br>
600
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="php-kw">use</span> <span class="php-cls">HasFactory</span>, <span class="php-cls">SoftDeletes</span>;<br><br>
601
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="php-kw">protected</span> $fillable = [<span class="php-str">'title'</span>, <span class="php-str">'isbn'</span>, <span class="php-str">'year'</span>, ...];<br><br>
602
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="php-kw">public function</span> <span class="php-cls">author</span>(): <span class="php-cls">BelongsTo</span><br>
603
+ &nbsp;&nbsp;&nbsp;&nbsp;{<br>
604
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="php-kw">return</span> $this-><span class="php-cls">belongsTo</span>(<span class="php-cls">Author</span>::class);<br>
605
+ &nbsp;&nbsp;&nbsp;&nbsp;}<br>
606
+ }
607
+ </div>
608
+ </div>
609
+ </div>
610
+
611
+ <!-- Arrow -->
612
+ <div class="arrow">
613
+ <div class="arrow-line"></div>
614
+ <div class="arrow-head"></div>
615
+ <div class="arrow-label">Raw PHP files</div>
616
+ </div>
617
+
618
+ <!-- Stage 4: Syntax Check -->
619
+ <div class="stage s-check">
620
+ <div class="stage-box">
621
+ <div class="stage-number">Stage 4</div>
622
+ <div class="stage-title">
623
+ <span>&#x2705;</span> Syntax Validation
624
+ </div>
625
+ <div class="stage-desc">
626
+ <code>php -l</code> on every generated file. Catches syntax errors before the files
627
+ reach the Laravel project.
628
+ </div>
629
+ <div class="stage-meta">
630
+ <span class="meta-tag">php -l</span>
631
+ <span class="meta-tag">26/26 valid (100%)</span>
632
+ </div>
633
+ </div>
634
+ </div>
635
+
636
+ <!-- Arrow -->
637
+ <div class="arrow">
638
+ <div class="arrow-line"></div>
639
+ <div class="arrow-head"></div>
640
+ <div class="arrow-label">Syntax-validated PHP</div>
641
+ </div>
642
+
643
+ <!-- Stage 5: Output -->
644
+ <div class="stage s-output">
645
+ <div class="stage-box">
646
+ <div class="stage-title">
647
+ <span>&#x1F4E6;</span> Laravel Application Files
648
+ </div>
649
+ <div class="file-grid">
650
+ <div class="file-item"><span class="file-icon" style="color:#f59e0b;">&#x25C6;</span> create_books_table.php</div>
651
+ <div class="file-item"><span class="file-icon" style="color:#f59e0b;">&#x25C6;</span> create_authors_table.php</div>
652
+ <div class="file-item"><span class="file-icon" style="color:#6366f1;">&#x25C6;</span> Book.php</div>
653
+ <div class="file-item"><span class="file-icon" style="color:#6366f1;">&#x25C6;</span> Author.php</div>
654
+ <div class="file-item"><span class="file-icon" style="color:#10b981;">&#x25C6;</span> BookController.php</div>
655
+ <div class="file-item"><span class="file-icon" style="color:#10b981;">&#x25C6;</span> AuthorController.php</div>
656
+ <div class="file-item"><span class="file-icon" style="color:#8b5cf6;">&#x25C6;</span> BookResource.php</div>
657
+ <div class="file-item"><span class="file-icon" style="color:#8b5cf6;">&#x25C6;</span> AuthorResource.php</div>
658
+ <div class="file-item"><span class="file-icon" style="color:#ec4899;">&#x25C6;</span> StoreBookRequest.php</div>
659
+ <div class="file-item"><span class="file-icon" style="color:#ef4444;">&#x25C6;</span> BookApiTest.php</div>
660
+ </div>
661
+ <div class="stage-meta" style="margin-top:12px;">
662
+ <span class="meta-tag">20/20 Pest tests pass</span>
663
+ <span class="meta-tag">Ready for Laravel 13.x</span>
664
+ </div>
665
+ </div>
666
+ </div>
667
+
668
+ </div>
669
+
670
+ <!-- ═══ ONTOLOGY COMPARISON ═══ -->
671
+
672
+ <div class="ontology-section">
673
+ <h2>The Ontological Gap</h2>
674
+ <p style="text-align:center; color:#94a3b8; font-size:0.9em; margin-bottom:24px;">
675
+ Semantic hallucinations occur when the model fills prompt gaps from its own pretraining ontology
676
+ </p>
677
+
678
+ <div class="ontology-compare">
679
+
680
+ <!-- Model's ontology -->
681
+ <div class="ontology-card card-model">
682
+ <h3><span>&#x1F916;</span> Model's Implicit Ontology</h3>
683
+ <p style="font-size:0.78em; color:#a5b4fc; margin-bottom:10px;">Learned from pretraining on millions of PHP files</p>
684
+ <ul>
685
+ <li>&#x274C; "Models usually have a <code>user()</code> relationship"</li>
686
+ <li>&#x274C; "Validation includes <code>'optional'</code>"</li>
687
+ <li>&#x274C; "Controllers use closure-based eager loading"</li>
688
+ <li>&#x274C; "Use <code>$request->user()->create()</code>"</li>
689
+ <li>&#x274C; "Resources need <code>->withHttpStatus()</code>"</li>
690
+ </ul>
691
+ </div>
692
+
693
+ <div class="ontology-vs">vs</div>
694
+
695
+ <!-- Developer's ontology -->
696
+ <div class="ontology-card card-dev">
697
+ <h3><span>&#x1F468;&#x200D;&#x1F4BB;</span> Developer's Intended Ontology</h3>
698
+ <p style="font-size:0.78em; color:#6ee7b7; margin-bottom:10px;">Application-specific, made explicit via BuildSpec</p>
699
+ <ul>
700
+ <li>&#x2714; "Book <code>belongsTo</code> Author (not User)"</li>
701
+ <li>&#x2714; "Validation uses <code>'nullable'</code>"</li>
702
+ <li>&#x2714; "Simple array eager loading: <code>['author']</code>"</li>
703
+ <li>&#x2714; "<code>Book::create($request->validated())</code>"</li>
704
+ <li>&#x2714; "<code>response()->json(new BookResource(...))</code>"</li>
705
+ </ul>
706
+ </div>
707
+
708
+ </div>
709
+
710
+ <div class="gap-label">&#x2191; Without BuildSpec: the model fills gaps from its own ontology &#x2192; hallucinations</div>
711
+ <div class="bridge-label">&#x2193; With BuildSpec: developer's ontology is explicit and complete &#x2192; no gaps to fill</div>
712
+ </div>
713
+
714
+ <!-- ═══ FOOTER ═══ -->
715
+
716
+ <div class="footer">
717
+ <p style="margin-bottom:8px;">
718
+ <a href="https://huggingface.co/fchis/Laravel-13x-Qwen2.5-Coder-7B-Instruct-LoRA-Spec">Model</a> &middot;
719
+ <a href="https://huggingface.co/datasets/fchis/laravel-buildspec-training">Dataset</a> &middot;
720
+ <a href="https://github.com/florinel-chis/laravel-ai-gen">GitHub</a>
721
+ </p>
722
+ <p>Florinel Chis &middot; 2026 &middot; Runs entirely on Apple Silicon (M2 Pro 16GB)</p>
723
+ </div>
724
+
725
+ </div>
726
+
727
+ </body>
728
+ </html>