-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_taxonomy7.html
More file actions
607 lines (569 loc) · 28.6 KB
/
model_taxonomy7.html
File metadata and controls
607 lines (569 loc) · 28.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>AI Models: Four Lenses — Overview • Table • Quiz</title>
<style>
:root{
--uiuc-navy:#13294B; --uiuc-orange:#E84A27;
--ink:#1f2937; --muted:#6b7280; --bg:#f8fafc; --card:#ffffff; --ring:#e5e7eb;
--blue:#2563eb; --green:#16a34a; --red:#dc2626; --amber:#f59e0b;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif}
a{color:var(--uiuc-navy);text-decoration:none} a:hover{text-decoration:underline}
.wrap{max-width:1200px;margin:24px auto 32px;padding:0 16px}
header h1{margin:0 0 6px 0;font-size:28px;color:var(--uiuc-navy)}
header p{margin:0 0 12px 0;color:var(--muted)}
/* Tabs */
.tabs{display:flex;gap:8px;flex-wrap:wrap;border-bottom:1px solid var(--ring);margin:12px 0 16px}
.tab{border:1px solid var(--ring);border-bottom:none;border-radius:12px 12px 0 0;background:#fff;padding:10px 14px;cursor:pointer}
.tab.active{border-color:var(--uiuc-navy);color:var(--uiuc-navy);box-shadow:0 -1px 0 #fff inset}
.panel{display:none}
.panel.active{display:block}
.panel.default-visible{display:block} /* visible if JS fails */
.card{background:var(--card);border:1px solid var(--ring);border-radius:16px;box-shadow:0 1px 2px rgb(0 0 0 / 6%)}
.card h2{margin:0;padding:16px 16px 0 16px;font-size:18px}
.sub{padding:0 16px 12px;color:var(--muted);font-size:14px}
/* Overview grid */
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
@media (max-width:900px){.grid{grid-template-columns:1fr}}
.lenscard{padding:12px 16px;border-left:6px solid transparent}
.lenscard .row{display:flex;gap:8px;align-items:center;margin-bottom:6px}
.lenscard .title{font-weight:700}
.lenscard .desc{color:var(--muted);font-size:14px;margin-bottom:8px}
.lenscard .pills{display:flex;flex-wrap:wrap;gap:8px}
.pill{border:1px solid var(--ring);background:#fff;border-radius:999px;padding:6px 10px;font-size:13px;cursor:pointer}
.pill:hover{border-color:var(--uiuc-orange)}
.dot{width:10px;height:10px;border-radius:999px;display:inline-block}
.blue{background:var(--blue)} .green{background:var(--green)} .amber{background:var(--amber)} .red{background:var(--red)}
/* Table */
.toolbar{display:flex;flex-wrap:wrap;gap:8px;padding:12px 16px;border-top:1px solid var(--ring)}
.toolbar input[type="search"]{flex:1;min-width:180px;padding:8px 10px;border:1px solid var(--ring);border-radius:10px}
.toolbar select,.toolbar button{padding:8px 10px;border:1px solid var(--ring);border-radius:10px;background:#fff;cursor:pointer}
.toolbar .seg{display:flex;gap:8px;flex-wrap:wrap}
table{width:100%;border-collapse:collapse}
thead th{position:sticky;top:0;background:#f3f4f6;font-weight:600;font-size:14px;color:#374151;border-bottom:1px solid var(--ring);padding:10px;text-align:left;cursor:pointer}
tbody td{border-bottom:1px solid var(--ring);padding:10px;vertical-align:top;font-size:14px}
tbody tr:hover{background:#fafafa}
.tag{display:inline-block;margin:2px 6px 2px 0;padding:2px 8px;border-radius:999px;background:#eef2ff;color:#3730a3;font-size:12px;border:1px solid #e5e7eb}
.mod{display:inline-block;margin:2px 6px 2px 0;padding:2px 8px;border-radius:999px;background:#fff7ed;color:#9a3412;font-size:12px;border:1px solid #fed7aa}
.footer{padding:10px 16px;color:var(--muted);font-size:12px}
/* Quiz */
.quiz{padding:12px 16px 16px}
.q{border-top:1px solid var(--ring);padding:12px 0}
.q h4{margin:0 0 8px 0;font-size:15px}
.choices{display:flex;flex-direction:column;gap:6px}
.choice{display:flex;gap:8px;align-items:flex-start;padding:6px 8px;border:1px solid var(--ring);border-radius:10px;background:#fff;cursor:pointer;transition:border-color .12s, background .12s}
.choice input{margin-top:2px}
.choice.correct{border-color:#16a34a;background:#ecfdf5}
.choice.incorrect{border-color:#dc2626;background:#fef2f2}
.btn{display:inline-block;border:1px solid var(--uiuc-navy);color:#fff;background:var(--uiuc-navy);border-radius:999px;padding:8px 14px;cursor:pointer}
.score{font-weight:700}
/* Debug banner */
#debug-banner{font:14px system-ui; color:#9a3412; background:#fff7ed; border:1px solid #fed7aa; border-radius:8px; padding:8px 12px; display:none; margin-bottom:12px;}
</style>
</head>
<body>
<div class="wrap">
<header>
<h1>AI Models: Four Lenses</h1>
<p>A teaching tool to separate the general idea of an <em>AI model</em> from a useful taxonomy: <strong>Training</strong>, <strong>Architecture</strong>, <strong>Family</strong>, and <strong>Lineage</strong>. Tabs for an overview, a unified table (with CSV export), and a quiz focused on modalities & real tasks.</p>
</header>
<div id="debug-banner"></div>
<!-- TABS -->
<nav class="tabs" id="tabs">
<button class="tab active" data-tab="overview">Overview</button>
<button class="tab" data-tab="table">Unified Table</button>
<button class="tab" data-tab="quiz">Quiz</button>
</nav>
<!-- OVERVIEW (default visible without JS) -->
<section class="panel active default-visible" id="panel-overview">
<div class="card">
<h2 style="padding-bottom:8px;">Lens Overview</h2>
<p class="sub">Click a lens to jump to the table with that lens pre-filtered. Click a pill to search that term.</p>
<div class="grid" id="overview-grid"></div>
<div class="footer" style="padding:12px 16px;">
Want details? Jump to the <a href="#table" onclick="window.goTab && goTab('table')">Unified Table</a> or try the <a href="#quiz" onclick="window.goTab && goTab('quiz')">Quiz</a>.
</div>
</div>
</section>
<!-- TABLE -->
<section class="panel" id="panel-table">
<div class="card">
<h2 style="padding-bottom:0;">Unified Table</h2>
<p class="sub">Sortable, filterable across lenses; export CSV of the current view or the full dataset.</p>
<div class="toolbar">
<input id="table-search" type="search" placeholder="Search all columns…" aria-label="Search table"/>
<select id="modality-filter" aria-label="Filter by modality">
<option value="">All modalities</option>
<option>Text</option><option>Image</option><option>Video</option>
<option>Audio</option><option>Vision</option><option>Multimodal</option><option>Tabular</option>
</select>
<div class="seg" id="lens-filters"></div>
<button id="export-current">Export CSV (current view)</button>
<button id="export-all">Export CSV (entire dataset)</button>
</div>
<div style="overflow:auto; max-height: 520px;">
<table id="data-table">
<thead>
<tr>
<th data-key="lens">Lens</th>
<th data-key="category">Category</th>
<th data-key="term">Term</th>
<th data-key="modality">Modality</th>
<th data-key="examples">Examples</th>
<th data-key="explain">Layman explanation</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div class="footer">Tip: click column headers to sort. Shift-click to multi-sort.</div>
</div>
</section>
<!-- QUIZ -->
<section class="panel" id="panel-quiz">
<div class="card">
<h2 style="padding-bottom:0;">Quiz — Modalities & Uses</h2>
<p class="sub">Instant feedback. Running tally updates as you answer. “New quiz” shuffles.</p>
<div class="quiz">
<div id="quiz-box"></div>
<div style="display:flex;gap:8px;margin-top:12px;align-items:center;">
<button class="btn" id="quiz-new">New quiz</button>
<div class="score" id="quiz-tally" style="margin-left:auto;">Correct: 0 · Attempted: 0</div>
</div>
</div>
</div>
</section>
</div>
<script>
/* ---------------- Utilities ---------------- */
const $ = s => document.querySelector(s);
const $$ = s => Array.from(document.querySelectorAll(s));
function el(tag, attrs={}, ...children){
const n=document.createElement(tag);
for(const [k,v] of Object.entries(attrs)){
if(k==="class") n.className=v;
else if(k==="html") n.innerHTML=v;
else n.setAttribute(k,v);
}
children.flat().forEach(c=>n.append(c));
return n;
}
function debounce(fn,ms=200){let t;return(...a)=>{clearTimeout(t);t=setTimeout(()=>fn(...a),ms)}}
function shuffle(x){ const a=[...x]; for(let i=a.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1)); [a[i],a[j]]=[a[j],a[i]];} return a; }
function pick(n,arr){ const a=[...arr]; const out=[]; while(out.length<n && a.length){ out.push(a.splice(Math.floor(Math.random()*a.length),1)[0]); } return out; }
/* Firefox/extension-safe hash updates */
function safeReplaceHash(name){
try {
if (typeof history?.replaceState === "function") {
history.replaceState(null,"",`#${name}`);
}
} catch (e) {
console.warn("Hash update blocked:", e);
const dbg = $("#debug-banner");
if (dbg){ dbg.style.display = "block"; dbg.textContent = "Note: a browser extension blocked a URL update; app continues in safe mode."; }
}
}
/* ---------------- DATA (edit me) ----------------
Each term is [term, explain, examples, modality]
*/
const DATA = {
lenses: {
Training: {
color:"#2563eb",
desc:"How does the model learn? Strategy used to fit parameters.",
groups:[
{ name:"Supervised", color:"blue", terms:[
["Logistic Regression","Learns from labeled examples to predict categories.","Email spam filters","Tabular"],
["Random Forest","Ensemble of decision trees voting to reduce overfitting.","Risk scoring on tabular data","Tabular"],
["Fine-tuning (pretrained backbone)","Start from a pretrained model and teach a labeled task.","BERT/GPT fine-tunes for classification","Text"]
]},
{ name:"Unsupervised", color:"amber", terms:[
["K-Means","Clusters similar items without labels.","Customer segments","Tabular"],
["PCA","Projects data into fewer directions preserving variance.","Compression/visualization","Tabular"],
["Autoencoder","Compresses then reconstructs to reveal structure.","Anomaly detection","Vision"]
]},
{ name:"Reinforcement", color:"green", terms:[
["DQN","Learns actions via rewards.","Atari agents","Multimodal"],
["AlphaZero-style","Self-play + tree search.","Chess/Go engines","Multimodal"],
["RLHF phase","Human preference signals shape outputs after pretraining.","Chat alignment","Text"]
]},
{ name:"Self-supervised", color:"blue", terms:[
["Masked LM","Predict masked tokens to learn language structure.","BERT pretraining","Text"],
["Next-token prediction","Autoregressively predict the next token.","GPT/Mistral/Gemma pretraining","Text"],
["Contrastive learning","Pull same content together, push different apart.","CLIP, SimCLR for vision","Vision"]
]}
]
},
Architecture: {
color:"#16a34a",
desc:"What is the structural form of the model?",
groups:[
{ name:"Classical", color:"amber", terms:[
["Decision Tree","If-then splits like a flowchart.","Explainable baselines","Tabular"],
["Linear / Logistic Regression","Weighted sums; fast/strong baselines.","Tabular tasks","Tabular"]
]},
{ name:"Neural Nets", color:"green", terms:[
["CNN","Sliding filters capture spatial patterns.","Vision tasks","Vision"],
["RNN / LSTM","Token-by-token with memory state.","Time-series, early NLP","Text"],
["Transformer (Encoder/Decoder)","Attention relates all tokens at once.","Modern LMs & some vision/audio","Multimodal"],
["State-Space Models (SSM) / Mamba","Sequence models with linear-time scaling.","Long-sequence efficiency","Text"]
]},
{ name:"Generative", color:"blue", terms:[
["Autoregressive Decoders","Generate one token/pixel at a time.","GPT-style LMs, PixelCNN","Multimodal"],
["Autoencoder / VAE","Compress→reconstruct to learn latent space.","Denoising, representation learning","Vision"],
["Diffusion (DDPM/Score-based)","Denoise noise step-by-step to sample data.","Stable Diffusion, Imagen, Sora (under the hood)","Image"],
["Latent Diffusion","Run diffusion in a learned latent space for speed.","SDXL / SD3","Image"],
["Flow-based Models","Invertible transforms with exact likelihoods.","RealNVP, Glow","Image"]
]}
]
},
Family: {
color:"#f59e0b",
desc:"Which named family or ecosystem does a model belong to?",
groups:[
{ name:"OpenAI", color:"amber", terms:[
["GPT family","Autoregressive LLMs (e.g., GPT-3.5, GPT-4, o-series).","Chat, tools, code","Text"],
["DALL·E family","Text-to-image diffusion/AR hybrids.","DALL·E 2, DALL·E 3","Image"],
["Sora (video)","Text-to-video generative model (diffusion-like).","Video synthesis","Video"]
]},
{ name:"Anthropic", color:"blue", terms:[
["Claude family","Safety-aligned LLMs with long context.","Opus, Sonnet, Haiku","Text"]
]},
{ name:"Google / DeepMind", color:"blue", terms:[
["Gemini family","Multimodal successors to PaLM.","Text-image-audio-tools","Multimodal"],
["Imagen family","High-fidelity image diffusion.","Imagen / Imagen 2","Image"],
["Veo (video)","Text-to-video generation.","Video synthesis","Video"]
]},
{ name:"Meta", color:"green", terms:[
["LLaMA family","Open(-ish) LLM line with many community variants.","LLaMA-2/3","Text"],
["SAM family","Promptable segmentation models.","Segment Anything","Vision"]
]},
{ name:"Mistral AI (open-source)", color:"green", terms:[
["Mistral family","Efficient small/medium LLMs.","Mistral 7B","Text"],
["Mixtral family","Mixture-of-Experts (MoE) LLMs.","Mixtral 8×7B, 8×22B","Text"]
]},
{ name:"Alibaba", color:"green", terms:[
["Qwen family","Open LLMs across sizes and modalities.","Qwen 2/2.5, Qwen-VL","Multimodal"]
]},
{ name:"Databricks", color:"green", terms:[
["DBRX family","Mixture-of-Experts LLM.","DBRX Instruct","Text"]
]},
{ name:"Microsoft", color:"green", terms:[
["Phi family","Small, data-curated LLMs for efficiency.","Phi-2, Phi-3, Phi-4 mini","Text"]
]},
{ name:"xAI", color:"green", terms:[
["Grok family","LLMs with tool use emphasis.","Grok-1.x","Text"]
]},
{ name:"01.AI", color:"green", terms:[
["Yi family","High-quality open LLMs.","Yi-34B, Yi-1.5","Text"]
]},
{ name:"Cohere", color:"green", terms:[
["Command family","Enterprise-oriented LLMs.","Command-R / R+","Text"]
]},
{ name:"Open-source Vision/Multimodal", color:"green", terms:[
["Stable Diffusion family","Latent diffusion for images.","SD 1.5, SD 2.1, SDXL, SD3","Image"],
["CLIP / OpenCLIP","Text-image embedding models.","Retrieval, alignment","Multimodal"],
["DINOv2","Self-supervised vision backbone.","Feature extraction","Vision"]
]},
{ name:"Independent Audio/Video (closed)", color:"amber", terms:[
["Midjourney","Proprietary TTI (diffusion/AR stack).","MJ v1–v6","Image"],
["Runway Gen family","Text-to-video & image tools.","Gen-1/2/3","Video"],
["Pika","Text-to-video/image.","Pika 1.0/1.5","Video"],
["Suno / Udio","Text-to-music audio models.","Song generation","Audio"]
]}
]
},
Lineage: {
color:"#dc2626",
desc:"How versions evolve: releases, forks, and inherited innovations.",
groups:[
{ name:"OpenAI (LLM & media)", color:"red", terms:[
["GPT-2 → GPT-3 → 3.5 → 4 → o-series","Scaling + instruction tuning + tool use.","Reasoning & safety improve","Text"],
["DALL·E 1 → 2 → 3","From discrete to high-fidelity diffusion.","Better text rendering","Image"],
["Sora (initial)","First public video model iteration.","Longer, coherent clips","Video"]
]},
{ name:"Meta", color:"green", terms:[
["LLaMA 1 → 2 → 3","Open weights and community fine-tunes.","Ecosystem acceleration","Text"]
]},
{ name:"Google / DeepMind", color:"blue", terms:[
["PaLM → PaLM-2 → Gemini","Shift to multimodality + efficiency.","Tool use & long context","Multimodal"],
["Imagen → Imagen 2 → Veo","Image fidelity → video generation.","Photorealism & motion","Image"]
]},
{ name:"Mistral", color:"green", terms:[
["Mistral 7B → Mixtral 8×7B → 8×22B","From dense to MoE scaling.","Latency/quality trade-offs","Text"]
]},
{ name:"Alibaba", color:"green", terms:[
["Qwen 1 → 2 → 2.5","Coverage, multilinguality, tools; VL/Audio variants.","","Multimodal"]
]},
{ name:"Databricks", color:"green", terms:[
["DBRX base → DBRX instruct","Open MoE tuned for RAG.","Enterprise workflows","Text"]
]},
{ name:"Microsoft", color:"green", terms:[
["Phi-1 → 2 → 3 → 4-mini","Data-centric small LLMs.","Edge & low-cost use","Text"]
]},
{ name:"01.AI", color:"green", terms:[
["Yi 34B → Yi-1.5","Open large models tuned for quality.","","Text"]
]},
{ name:"Stable Diffusion (Stability/CompVis)", color:"#2563eb", terms:[
["SD 1.x → SD 2.x → SDXL → SD3","Latent diffusion, larger backbones.","Better text rendering","Image"]
]},
{ name:"Midjourney (closed)", color:"amber", terms:[
["v1 → v2 → v3 → v4 → v5 → v6","Proprietary stack, strong style control.","Artistic TTI","Image"]
]},
{ name:"Video Gen (mixed)", color:"amber", terms:[
["Runway Gen-1 → Gen-2 → Gen-3","Text-to-video quality & temporal coherence.","Short clips","Video"],
["Pika 1.0 → 1.5","Fast iteration on video.","Animated assets","Video"]
]},
{ name:"Emerging Open LLMs", color:"green", terms:[
["DeepSeek V2 → V2.5 → V3","Training efficiency & reasoning focus.","","Text"]
]}
]
}
}
};
/* ---------------- Derived rows ---------------- */
function lensRows(){
const rows=[];
Object.entries(DATA.lenses).forEach(([lens,meta])=>{
meta.groups.forEach(g=>{
g.terms.forEach(([term,explain,examples,mod])=>{
rows.push({lens,category:g.name,term,explain,examples,mod});
});
});
});
return rows;
}
const ALL_ROWS = lensRows();
/* ---------------- Tabs ---------------- */
function goTab(name){
$$("#tabs .tab").forEach(b=>b.classList.toggle("active", b.dataset.tab===name));
$$(".panel").forEach(p=>p.classList.toggle("active", p.id===`panel-${name}`));
if (name==="table") { $("#table-search")?.focus(); }
safeReplaceHash(name);
}
/* ---------------- Overview ---------------- */
function renderOverview(){
const grid=$("#overview-grid"); if(!grid) return;
grid.innerHTML="";
const lensOrder=["Training","Architecture","Family","Lineage"];
lensOrder.forEach(name=>{
const meta=DATA.lenses[name];
const colorClass = name==="Training"?"blue":name==="Architecture"?"green":name==="Family"?"amber":"red";
const rows = ALL_ROWS.filter(r=>r.lens===name);
const topTerms = rows.slice(0,6);
const card=el("div",{class:"lenscard card", style:`border-left-color:${meta.color}`});
const head=el("div",{class:"row"},
el("span",{class:`dot ${colorClass}`}),
el("span",{class:"title"}, name),
el("span",{style:"color:var(--muted);margin-left:auto;font-size:12px;"}, `${rows.length} terms`)
);
const desc=el("div",{class:"desc"}, meta.desc);
const actions=el("div",{}, el("button",{class:"pill", title:`View ${name} in table`}, "Open in Table →"));
actions.querySelector("button").addEventListener("click",()=>{
goTab("table");
$$("#lens-filters input[type=checkbox]").forEach(c=>{ c.checked = (c.value===name); });
renderTable();
});
const pills=el("div",{class:"pills"});
topTerms.forEach(r=>{
const p=el("button",{class:"pill",title:`${r.explain} • Modality: ${r.mod}`}, r.term);
p.addEventListener("click",()=>{
goTab("table");
const ts=$("#table-search"); if(ts){ ts.value=r.term; renderTable(); }
});
pills.append(p);
});
card.append(head,desc,actions,pills);
grid.append(card);
});
}
/* ---------------- Table ---------------- */
const sortState=[];
function renderLensFilters(){
const box=$("#lens-filters"); if(!box) return;
box.innerHTML="";
Object.keys(DATA.lenses).forEach(name=>{
const c=el("input",{type:"checkbox",value:name,checked:true});
const lab=el("label",{},c," "+name);
c.addEventListener("change",renderTable);
box.append(lab);
});
}
function tableRows(){
return ALL_ROWS.map(r=>({lens:r.lens,category:r.category,term:r.term,explain:r.explain,examples:r.examples,modality:r.mod}));
}
let TABLE_DATA = tableRows();
function currentView(){
const ts=$("#table-search"); const mf=$("#modality-filter");
const q=(ts?.value||"").trim().toLowerCase();
const lensEnabled=$$("#lens-filters input[type=checkbox]:checked").map(c=>c.value);
const modSel=mf?.value||"";
let view=TABLE_DATA.filter(r=>lensEnabled.includes(r.lens));
if(modSel) view=view.filter(r=>r.modality===modSel);
if(q) view=view.filter(r=>Object.values(r).join(" ").toLowerCase().includes(q));
let sorted=[...view];
if(sortState.length){
sorted.sort((a,b)=>{
for(const {key,dir} of sortState){
const av=(a[key]??"").toString().toLowerCase();
const bv=(b[key]??"").toString().toLowerCase();
if(av<bv) return dir==="asc"?-1:1;
if(av>bv) return dir==="asc"?1:-1;
} return 0;
});
}
return sorted;
}
function renderTable(){
const tb=$("#data-table tbody"); if(!tb) return;
tb.innerHTML="";
currentView().forEach(r=>{
const tr=el("tr",{},
el("td",{},r.lens),
el("td",{},r.category),
el("td",{},el("span",{class:"tag"},r.term)),
el("td",{},el("span",{class:"mod"},r.modality)),
el("td",{},r.examples||"—"),
el("td",{},r.explain)
); tb.append(tr);
});
}
function initTable(){
renderLensFilters();
$$("#data-table thead th").forEach(th=>{
th.addEventListener("click",e=>{
const key=th.getAttribute("data-key"); const multi=e.shiftKey;
const i=sortState.findIndex(s=>s.key===key);
if(i>=0){ sortState[i].dir=sortState[i].dir==="asc"?"desc":"asc"; }
else{ if(!multi) sortState.length=0; sortState.push({key,dir:"asc"}); }
renderTable();
});
});
$("#table-search")?.addEventListener("input",debounce(renderTable,120));
$("#modality-filter")?.addEventListener("change",renderTable);
$("#export-current")?.addEventListener("click",()=>exportCSV(currentView(),"ai-models-view.csv"));
$("#export-all")?.addEventListener("click",()=>exportCSV(TABLE_DATA,"ai-models-all.csv"));
renderTable();
}
function exportCSV(rows, filename){
if(!rows || !rows.length) { alert("No rows to export."); return; }
const headers=["lens","category","term","modality","examples","explain"];
const esc = s => `"${String(s??"").replace(/"/g,'""')}"`;
const lines = [headers.join(",")].concat(
rows.map(r=>headers.map(h=>esc(r[h])).join(","))
);
const blob = new Blob([lines.join("\n")], {type:"text/csv;charset=utf-8;"});
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url; a.download = filename; a.style.display="none";
document.body.appendChild(a); a.click();
document.body.removeChild(a); URL.revokeObjectURL(url);
}
/* ---------------- Quiz (instant & running tally) ---------------- */
const MODS = ["Text","Image","Video","Audio","Vision","Multimodal","Tabular"];
const USE_CASES = [
{ task:"Summarize a 15-page policy into key bullets", modality:"Text" },
{ task:"Transcribe a lecture recording into notes", modality:"Audio" },
{ task:"Turn a product description into a photoreal image", modality:"Image" },
{ task:"Generate a short explainer clip from a script", modality:"Video" },
{ task:"Detect objects and segment regions in photos", modality:"Vision" },
{ task:"Chat with PDFs and spreadsheets at once", modality:"Multimodal" },
{ task:"Predict customer churn from numeric features", modality:"Tabular" },
{ task:"Rewrite a student email more professionally", modality:"Text" },
{ task:"Create background music for a podcast intro", modality:"Audio" },
{ task:"Upscale and denoise a low-res picture", modality:"Image" },
{ task:"Storyboard → moving video sequence", modality:"Video" },
{ task:"OCR + layout analysis on scanned pages", modality:"Vision" },
{ task:"Answer questions over a slide deck and a CSV", modality:"Multimodal" },
{ task:"Estimate house price from structured fields", modality:"Tabular" }
];
function allTerms(){ return ALL_ROWS.map(r=>({term:r.term, mod:r.mod})); }
const TERMS = allTerms();
let QUIZ=[], tally={correct:0, attempted:0};
function makeQuiz(){
const qs=[];
pick(2, USE_CASES).forEach(u=>{
const wrong = pick(3, MODS.filter(m=>m!==u.modality));
const choices = shuffle([...wrong, u.modality]);
qs.push({type:"usecase_mod", prompt:`Which modality best fits: “${u.task}”?`, answer:u.modality, choices});
});
pick(2, TERMS).forEach(t=>{
const wrong = pick(3, MODS.filter(m=>m!==t.mod));
const choices = shuffle([...wrong, t.mod]);
qs.push({type:"term_mod", prompt:`“${t.term}” is most associated with which modality?`, answer:t.mod, choices});
});
const focusMod = MODS[Math.floor(Math.random()*MODS.length)];
const correctUC = pick(1, USE_CASES.filter(u=>u.modality===focusMod))[0]
|| {task:`A task suited to ${focusMod}`, modality:focusMod};
const distractors = pick(3, USE_CASES.filter(u=>u.modality!==focusMod));
const choicesUC = shuffle([correctUC, ...distractors]).map(u=>u.task);
qs.push({type:"mod_to_usecase", prompt:`Which task best fits the modality “${focusMod}”?`, answer:correctUC.task, choices:choicesUC});
return qs.slice(0,5);
}
function resetTally(){ tally.correct=0; tally.attempted=0; updateTally(); }
function updateTally(){ const t=$("#quiz-tally"); if(t) t.textContent = `Correct: ${tally.correct} · Attempted: ${tally.attempted}`; }
function renderQuiz(){
const box=$("#quiz-box"); if(!box) return;
box.innerHTML="";
resetTally();
QUIZ.forEach((q,qi)=>{
const qdiv=el("div",{class:"q","data-answer":q.answer});
qdiv.append(el("h4",{}, `${qi+1}. ${q.prompt}`));
const choices=el("div",{class:"choices"});
q.choices.forEach((c,ci)=>{
const id=`q${qi}_${ci}`;
const label=el("label",{class:"choice", for:id});
const input=el("input",{type:"radio",name:`q${qi}`,value:c,id});
label.append(input, document.createTextNode(c));
input.addEventListener("change",()=>instantGrade(qdiv, input));
choices.append(label);
});
qdiv.append(choices); box.append(qdiv);
});
}
function instantGrade(qDiv, picked){
const answer=qDiv.getAttribute("data-answer");
const labels=[...qDiv.querySelectorAll(".choice")];
labels.forEach(l=>l.classList.remove("correct","incorrect"));
const correctInput=labels.map(l=>l.querySelector("input")).find(i=>i.value===answer);
if(correctInput) correctInput.closest(".choice").classList.add("correct");
if(picked.value!==answer) picked.closest(".choice").classList.add("incorrect");
const alreadyAttempted = qDiv.hasAttribute("data-attempted");
const wasCorrect = qDiv.getAttribute("data-correct")==="true";
const nowCorrect = picked.value===answer;
if(!alreadyAttempted){ tally.attempted += 1; qDiv.setAttribute("data-attempted","true"); }
if(wasCorrect && !nowCorrect){ tally.correct -= 1; }
if(!wasCorrect && nowCorrect){ tally.correct += 1; }
qDiv.setAttribute("data-correct", nowCorrect ? "true" : "false");
updateTally();
}
/* ---------------- Boot ---------------- */
function init(){
try {
// Tabs
$("#tabs")?.addEventListener("click",(e)=>{
const btn=e.target.closest(".tab"); if(!btn) return;
goTab(btn.dataset.tab);
});
// Render sections
renderOverview();
initTable();
QUIZ = makeQuiz(); renderQuiz();
// Deep link
const hash=(location.hash||"#overview").replace("#","");
if(["overview","table","quiz"].includes(hash)) goTab(hash);
} catch (e){
console.error("Init error:", e);
const dbg = $("#debug-banner");
if (dbg){ dbg.style.display="block"; dbg.textContent = "Something interfered with JavaScript. The page loaded in fallback mode."; }
$("#panel-overview")?.classList.add("active","default-visible");
}
}
document.addEventListener("DOMContentLoaded", init);
</script>
</body>
</html>