AashishAIHub commited on
Commit
1cd23a6
Β·
1 Parent(s): 40645d0

feat: add Stanford CME 295 course and fix AI Engineer module navigation and content

Browse files
CME295-Transformers/index.html ADDED
@@ -0,0 +1,873 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>CME 295: Transformers & Large Language Models</title>
8
+
9
+ <!-- MathJax 3.x -->
10
+ <script>
11
+ MathJax = { tex: { inlineMath: [['$', '$'], ['\\(', '\\)']] } };
12
+ </script>
13
+ <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
14
+
15
+ <style>
16
+ * {
17
+ margin: 0;
18
+ padding: 0;
19
+ box-sizing: border-box;
20
+ }
21
+
22
+ :root {
23
+ --bg: #0f1419;
24
+ --surface: #1a1f2e;
25
+ --text: #e4e6eb;
26
+ --text-dim: #b0b7c3;
27
+ --cyan: #a371f7; /* Themed to Purple for CME295 */
28
+ --orange: #00d4ff; /* Themed to Cyan */
29
+ --green: #2ecc71;
30
+ --yellow: #ffaa00;
31
+ }
32
+
33
+ body {
34
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
35
+ background: var(--bg);
36
+ color: var(--text);
37
+ line-height: 1.6;
38
+ overflow-x: hidden;
39
+ }
40
+
41
+ .container {
42
+ max-width: 1400px;
43
+ margin: 0 auto;
44
+ padding: 20px;
45
+ }
46
+
47
+ header {
48
+ text-align: center;
49
+ margin-bottom: 40px;
50
+ padding: 30px 0;
51
+ border-bottom: 2px solid var(--cyan);
52
+ }
53
+
54
+ h1 {
55
+ font-size: 2.5em;
56
+ background: linear-gradient(135deg, var(--cyan), var(--orange));
57
+ background-clip: text;
58
+ -webkit-background-clip: text;
59
+ -webkit-text-fill-color: transparent;
60
+ margin-bottom: 10px;
61
+ }
62
+
63
+ .subtitle {
64
+ color: var(--text-dim);
65
+ font-size: 1.1em;
66
+ }
67
+
68
+ .dashboard {
69
+ display: none;
70
+ }
71
+
72
+ .dashboard.active {
73
+ display: block;
74
+ }
75
+
76
+ .grid {
77
+ display: grid;
78
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
79
+ gap: 25px;
80
+ margin: 40px 0;
81
+ }
82
+
83
+ .card {
84
+ background: linear-gradient(135deg, rgba(163, 113, 247, 0.1), rgba(0, 212, 255, 0.1));
85
+ border: 2px solid var(--cyan);
86
+ border-radius: 12px;
87
+ padding: 30px;
88
+ cursor: pointer;
89
+ transition: all 0.3s ease;
90
+ text-align: center;
91
+ position: relative;
92
+ }
93
+
94
+ .card:hover {
95
+ transform: translateY(-5px);
96
+ box-shadow: 0 10px 30px rgba(163, 113, 247, 0.2);
97
+ border-color: var(--orange);
98
+ }
99
+
100
+ .card-icon {
101
+ font-size: 3em;
102
+ margin-bottom: 15px;
103
+ }
104
+
105
+ .card h3 {
106
+ color: var(--cyan);
107
+ font-size: 1.5em;
108
+ margin-bottom: 10px;
109
+ }
110
+
111
+ .card p {
112
+ color: var(--text-dim);
113
+ font-size: 0.95em;
114
+ }
115
+
116
+ .category-label {
117
+ display: inline-block;
118
+ margin-top: 10px;
119
+ padding: 5px 12px;
120
+ background: rgba(163, 113, 247, 0.2);
121
+ border-radius: 20px;
122
+ font-size: 0.85em;
123
+ color: #d1b3ff;
124
+ }
125
+
126
+ .module {
127
+ display: none;
128
+ }
129
+
130
+ .module.active {
131
+ display: block;
132
+ animation: fadeIn 0.3s ease;
133
+ }
134
+
135
+ @keyframes fadeIn {
136
+ from { opacity: 0; }
137
+ to { opacity: 1; }
138
+ }
139
+
140
+ .btn-back {
141
+ display: inline-block;
142
+ text-decoration: none;
143
+ padding: 10px 20px;
144
+ background: var(--cyan);
145
+ color: var(--bg);
146
+ border: none;
147
+ border-radius: 6px;
148
+ cursor: pointer;
149
+ font-weight: 600;
150
+ margin-bottom: 25px;
151
+ transition: all 0.3s ease;
152
+ }
153
+
154
+ .btn-back:hover {
155
+ background: var(--orange);
156
+ }
157
+
158
+ .tabs {
159
+ display: flex;
160
+ gap: 10px;
161
+ margin-bottom: 30px;
162
+ flex-wrap: wrap;
163
+ justify-content: center;
164
+ border-bottom: 1px solid rgba(163, 113, 247, 0.2);
165
+ padding-bottom: 15px;
166
+ overflow-x: auto;
167
+ }
168
+
169
+ .tab-btn {
170
+ padding: 10px 20px;
171
+ background: var(--surface);
172
+ color: var(--text);
173
+ border: 2px solid transparent;
174
+ border-radius: 6px;
175
+ cursor: pointer;
176
+ font-size: 0.95em;
177
+ transition: all 0.3s ease;
178
+ font-weight: 500;
179
+ white-space: nowrap;
180
+ }
181
+
182
+ .tab-btn:hover {
183
+ background: rgba(163, 113, 247, 0.1);
184
+ border-color: var(--cyan);
185
+ }
186
+
187
+ .tab-btn.active {
188
+ background: var(--cyan);
189
+ color: var(--bg);
190
+ border-color: var(--cyan);
191
+ }
192
+
193
+ .tab {
194
+ display: none;
195
+ }
196
+
197
+ .tab.active {
198
+ display: block;
199
+ animation: fadeIn 0.3s ease;
200
+ }
201
+
202
+ .section {
203
+ background: var(--surface);
204
+ border: 1px solid rgba(163, 113, 247, 0.2);
205
+ border-radius: 10px;
206
+ padding: 30px;
207
+ margin-bottom: 25px;
208
+ transition: all 0.3s ease;
209
+ }
210
+
211
+ .section:hover {
212
+ border-color: var(--cyan);
213
+ box-shadow: 0 0 20px rgba(163, 113, 247, 0.1);
214
+ }
215
+
216
+ h2 {
217
+ color: var(--cyan);
218
+ font-size: 1.8em;
219
+ margin-bottom: 15px;
220
+ }
221
+
222
+ h3 {
223
+ color: var(--orange);
224
+ font-size: 1.3em;
225
+ margin-top: 20px;
226
+ margin-bottom: 12px;
227
+ }
228
+
229
+ h4 {
230
+ color: var(--green);
231
+ font-size: 1.1em;
232
+ margin-top: 15px;
233
+ margin-bottom: 10px;
234
+ }
235
+
236
+ p {
237
+ margin-bottom: 15px;
238
+ line-height: 1.8;
239
+ }
240
+
241
+ ul {
242
+ margin-left: 20px;
243
+ margin-bottom: 15px;
244
+ }
245
+
246
+ ul li {
247
+ margin-bottom: 8px;
248
+ }
249
+
250
+ .info-box {
251
+ background: linear-gradient(135deg, rgba(163, 113, 247, 0.1), rgba(0, 212, 255, 0.1));
252
+ border: 1px solid var(--cyan);
253
+ border-radius: 8px;
254
+ padding: 20px;
255
+ margin: 20px 0;
256
+ }
257
+
258
+ .box-title {
259
+ color: var(--orange);
260
+ font-weight: 700;
261
+ margin-bottom: 10px;
262
+ font-size: 1.1em;
263
+ }
264
+
265
+ .box-content {
266
+ color: var(--text-dim);
267
+ line-height: 1.7;
268
+ }
269
+
270
+ .formula {
271
+ background: rgba(163, 113, 247, 0.1);
272
+ border: 1px solid var(--cyan);
273
+ border-radius: 8px;
274
+ padding: 20px;
275
+ margin: 20px 0;
276
+ overflow-x: auto;
277
+ line-height: 1.8;
278
+ color: #d1b3ff;
279
+ text-align: center;
280
+ }
281
+
282
+ .code-block {
283
+ background: #0d1117;
284
+ border: 1px solid #30363d;
285
+ border-radius: 8px;
286
+ padding: 20px;
287
+ margin: 20px 0;
288
+ overflow-x: auto;
289
+ font-family: 'Fira Code', 'Consolas', monospace;
290
+ font-size: 0.88em;
291
+ line-height: 1.7;
292
+ white-space: pre-wrap;
293
+ color: #e6edf3;
294
+ }
295
+
296
+ .code-title {
297
+ display: block;
298
+ background: #161b22;
299
+ color: #8b949e;
300
+ padding: 8px 16px;
301
+ border-radius: 8px 8px 0 0;
302
+ border: 1px solid #30363d;
303
+ border-bottom: none;
304
+ font-size: 0.85em;
305
+ font-family: 'Fira Code', monospace;
306
+ margin-top: 20px;
307
+ }
308
+
309
+ .code-title+.code-block {
310
+ margin-top: 0;
311
+ border-radius: 0 0 8px 8px;
312
+ }
313
+
314
+ .code-block .keyword { color: #ff7b72; }
315
+ .code-block .string { color: #a5d6ff; }
316
+ .code-block .comment { color: #8b949e; }
317
+ .code-block .function { color: #d2a8ff; }
318
+ .code-block .builtin { color: #79c0ff; }
319
+ .code-block .number { color: #79c0ff; }
320
+
321
+ .callout {
322
+ border-left: 4px solid;
323
+ padding: 15px;
324
+ margin: 20px 0;
325
+ border-radius: 6px;
326
+ }
327
+
328
+ .callout.tip {
329
+ border-left-color: var(--green);
330
+ background: rgba(46, 204, 113, 0.05);
331
+ }
332
+
333
+ .callout.warning {
334
+ border-left-color: var(--yellow);
335
+ background: rgba(255, 170, 0, 0.05);
336
+ }
337
+
338
+ .callout.insight {
339
+ border-left-color: var(--cyan);
340
+ background: rgba(163, 113, 247, 0.05);
341
+ }
342
+
343
+ .callout-title {
344
+ font-weight: 700;
345
+ margin-bottom: 8px;
346
+ }
347
+
348
+ .list-item {
349
+ display: flex;
350
+ gap: 12px;
351
+ margin: 12px 0;
352
+ padding: 12px;
353
+ background: rgba(163, 113, 247, 0.05);
354
+ border-left: 3px solid var(--cyan);
355
+ border-radius: 4px;
356
+ }
357
+
358
+ .list-num {
359
+ color: var(--orange);
360
+ font-weight: 700;
361
+ min-width: 30px;
362
+ }
363
+
364
+ table {
365
+ width: 100%;
366
+ border-collapse: collapse;
367
+ margin: 20px 0;
368
+ }
369
+
370
+ th, td {
371
+ padding: 12px;
372
+ text-align: left;
373
+ border: 1px solid rgba(163, 113, 247, 0.2);
374
+ }
375
+
376
+ th {
377
+ background: rgba(163, 113, 247, 0.1);
378
+ color: var(--cyan);
379
+ font-weight: 700;
380
+ }
381
+
382
+ @media (max-width: 768px) {
383
+ h1 { font-size: 1.8em; }
384
+ .tabs { flex-direction: column; }
385
+ .tab-btn { width: 100%; }
386
+ .grid { grid-template-columns: 1fr; }
387
+ }
388
+ </style>
389
+ </head>
390
+
391
+ <body>
392
+ <div class="container">
393
+ <!-- MAIN DASHBOARD -->
394
+ <div id="dashboard" class="dashboard active">
395
+ <header>
396
+ <h1>🧠 CME 295: Transformers & LLMs</h1>
397
+ <p class="subtitle">Complete Stanford Course Distillation | From NLP Basics to Agentic AI</p>
398
+ <div style="margin-top: 25px;">
399
+ <a href="../index.html" class="btn-back">← Back to Masterclass</a>
400
+ </div>
401
+ </header>
402
+
403
+ <div style="text-align: center; margin-bottom: 40px;">
404
+ <p style="color: var(--text-dim); font-size: 1.1em; max-width: 800px; margin: 0 auto;">
405
+ Master the architecture that powers modern AI. This comprehensive 9-module curriculum deeply covers NLP fundamentals,
406
+ Transformer internals, advanced LLM tuning, reasoning architectures, and agentic workflows.
407
+ </p>
408
+ </div>
409
+
410
+ <div class="grid" id="modulesGrid"></div>
411
+ </div>
412
+
413
+ <!-- MODULES CONTAINER -->
414
+ <div id="modulesContainer"></div>
415
+ </div>
416
+
417
+ <script>
418
+ const modules = [
419
+ {
420
+ id: "lecture-1",
421
+ title: "The Foundation: NLP & Transformers",
422
+ icon: "πŸ“š",
423
+ category: "NLP Basics",
424
+ color: "#a371f7",
425
+ description: "Tokenization, Word2Vec, RNNs, and the Self-Attention Mechanism that started it all."
426
+ },
427
+ {
428
+ id: "lecture-2",
429
+ title: "Transformer Architectures",
430
+ icon: "πŸ€–",
431
+ category: "Architecture",
432
+ color: "#00d4ff",
433
+ description: "Deep dive into MHA, GQA, RoPE, BERT, and GPT architectures."
434
+ },
435
+ {
436
+ id: "lecture-3",
437
+ title: "Inside Large Language Models",
438
+ icon: "🧠",
439
+ category: "LLM Internals",
440
+ color: "#ffaa00",
441
+ description: "Mixture of Experts, Decoding Strategies, Context Windows, and Prompting."
442
+ },
443
+ {
444
+ id: "lecture-4",
445
+ title: "Training & Tuning LLMs",
446
+ icon: "βš™οΈ",
447
+ category: "Training",
448
+ color: "#2ecc71",
449
+ description: "From Pretraining on massive sets to SFT, LoRA, and memory-saving Quantization."
450
+ },
451
+ {
452
+ id: "lecture-5",
453
+ title: "Aligning LLMs (RLHF/DPO)",
454
+ icon: "βš–οΈ",
455
+ category: "Alignment",
456
+ color: "#f771b6",
457
+ description: "Shaping AI behavior using RLHF, Reward Models, PPO, and DPO."
458
+ },
459
+ {
460
+ id: "lecture-6",
461
+ title: "Reasoning Models",
462
+ icon: "πŸ€”",
463
+ category: "Advanced",
464
+ color: "#ff6b35",
465
+ description: "Test-time compute, System 2 Thinking (o1-style), and GRPO RL formulation."
466
+ },
467
+ {
468
+ id: "lecture-7",
469
+ title: "Agentic LLMs & RAG",
470
+ icon: "πŸ•΅οΈ",
471
+ category: "Agents",
472
+ color: "#00c9a7",
473
+ description: "Augmenting models via Vector databases, Function Calling, and the ReAct loop."
474
+ },
475
+ {
476
+ id: "lecture-8",
477
+ title: "Evaluation & Benchmarks",
478
+ icon: "πŸ“Š",
479
+ category: "Evaluation",
480
+ color: "#a371f7",
481
+ description: "How to objectively measure LLMs using exact benchmarks or LLM-as-a-Judge."
482
+ },
483
+ {
484
+ id: "lecture-9",
485
+ title: "Multimodality & Trends",
486
+ icon: "πŸ‘οΈ",
487
+ category: "Frontier",
488
+ color: "#00d4ff",
489
+ description: "Vision Transformers (ViT), Diffusion models, and the expanding modalities."
490
+ }
491
+ ];
492
+
493
+ const MODULE_CONTENT = {
494
+ "lecture-1": {
495
+ overview: `
496
+ <p>Before Large Language Models, computers needed a way to process human language reliably. This module covers the historic journey from basic NLP processing to the revolutionary architecture that powers modern AI.</p>
497
+ <div class="callout insight">
498
+ <div class="callout-title">The Paradigm Shift</div>
499
+ Historically, RNNs were the deep learning standard for text, but they processed data sequentially, leading to information loss over long sentences (vanishing gradients). The Transformer paper ("Attention Is All You Need", 2017) completely eliminated recurrent layers in favor of the <strong>Self-Attention Mechanism</strong>, allowing the model to look at the entire context simultaneously.
500
+ </div>
501
+ `,
502
+ concepts: `
503
+ <h3>Fundamental NLP Components</h3>
504
+ <div class="list-item">
505
+ <div class="list-num">01</div>
506
+ <div><strong>Tokenization:</strong> Breaking text into digestible chunks. BPE (Byte Pair Encoding) is standard, building common sub-words dynamically instead of mapping pure words, avoiding "Out of Vocabulary" errors.</div>
507
+ </div>
508
+ <div class="list-item">
509
+ <div class="list-num">02</div>
510
+ <div><strong>Word Embeddings (Word2Vec):</strong> Converting words to continuous multi-dimensional vectors where distance indicates semantic similarity (e.g., King - Man + Woman = Queen).</div>
511
+ </div>
512
+ <div class="list-item">
513
+ <div class="list-num">03</div>
514
+ <div><strong>The RNN Bottleneck:</strong> Recurrent networks pass state linearly. In long sentences (like translation), by the time it reaches the end, it has "forgotten" the beginning.</div>
515
+ </div>
516
+ <div class="list-item">
517
+ <div class="list-num">04</div>
518
+ <div><strong>Self-Attention:</strong> The core. For every word in a sequence, the network dynamically computes how relevant every *other* word is relative to it, forming a rich contextual representation.</div>
519
+ </div>
520
+ `,
521
+ math: `
522
+ <h3>The Self-Attention Equation</h3>
523
+ <p>The core mathematical breakthrough that allows parallel processing of context is the Scaled Dot-Product Attention equation.</p>
524
+ <div class="formula">
525
+ $$ \\text{Attention}(Q, K, V) = \\text{softmax}\\left( \\frac{QK^T}{\\sqrt{d_k}} \\right) V $$
526
+ </div>
527
+ <div style="text-align: left; max-width: 600px; margin: 0 auto; color: var(--text-dim);">
528
+ <p><strong>Query (Q):</strong> What the current token is looking for.</p>
529
+ <p><strong>Key (K):</strong> What other tokens offer.</p>
530
+ <p><strong>Value (V):</strong> The actual information represented by the token.</p>
531
+ <p><strong>$\\sqrt{d_k}$:</strong> A scaling factor to prevent gradients from disappearing during softmax.</p>
532
+ </div>
533
+ `,
534
+ code: `
535
+ <span class="code-title">πŸ“„ attention.py</span>
536
+ <div class="code-block"><span class="keyword">import</span> torch
537
+ <span class="keyword">import</span> torch.nn.functional <span class="keyword">as</span> F
538
+ <span class="keyword">import</span> math
539
+
540
+ <span class="keyword">def</span> <span class="function">scaled_dot_product_attention</span>(Q, K, V, mask=<span class="keyword">None</span>):
541
+ <span class="string">"""
542
+ Compute 'Scaled Dot Product Attention'
543
+ """</span>
544
+ d_k = Q.size(-<span class="number">1</span>)
545
+
546
+ <span class="comment"># 1. Compute dot product (scores)</span>
547
+ scores = torch.matmul(Q, K.transpose(-<span class="number">2</span>, -<span class="number">1</span>)) / math.sqrt(d_k)
548
+
549
+ <span class="comment"># 2. Apply masking (essential for autoregressive generation)</span>
550
+ <span class="keyword">if</span> mask <span class="keyword">is</span> <span class="keyword">not</span> <span class="keyword">None</span>:
551
+ scores = scores.masked_fill(mask == <span class="number">0</span>, -<span class="number">1e9</span>)
552
+
553
+ <span class="comment"># 3. Softmax to get probabilities/attention weights</span>
554
+ attention_weights = F.softmax(scores, dim=-<span class="number">1</span>)
555
+
556
+ <span class="comment"># 4. Multiply by values</span>
557
+ output = torch.matmul(attention_weights, V)
558
+
559
+ <span class="keyword">return</span> output, attention_weights</div>
560
+ `
561
+ },
562
+ "lecture-2": {
563
+ overview: `
564
+ <p>The original Transformer architecture has been significantly optimized. This module explores how researchers modified Attention constraints to build faster, larger foundation models.</p>
565
+ <div class="info-box">
566
+ <div class="box-title">Evolution of the Transformer</div>
567
+ <div class="box-content">
568
+ While the original 2017 architecture contained both an <strong>Encoder</strong> and a <strong>Decoder</strong>, modern models generally specialize: BERT uses only the Encoder for classification/understanding, while GPT uses only the Decoder for generative text.
569
+ </div>
570
+ </div>
571
+ `,
572
+ concepts: `
573
+ <h3>Architectural Optimizations</h3>
574
+ <div class="list-item">
575
+ <div class="list-num">01</div>
576
+ <div><strong>Multi-Head Attention (MHA):</strong> Running the attention mechanism multiple times in parallel to capture different semantic relationships (e.g., one head looks for grammatical structure, another for emotional sentiment).</div>
577
+ </div>
578
+ <div class="list-item">
579
+ <div class="list-num">02</div>
580
+ <div><strong>Grouped-Query Attention (GQA):</strong> MHA is extremely memory intensive during generation due to the KV cache. GQA shares Key-Value pairs across multiple query heads to save VRAM.</div>
581
+ </div>
582
+ <div class="list-item">
583
+ <div class="list-num">03</div>
584
+ <div><strong>RoPE (Rotary Position Embeddings):</strong> Instead of adding an absolute sinusoidal position index to a word, RoPE mathematically rotates the token vector to encode its *relative* position, working far better for long contexts.</div>
585
+ </div>
586
+ <div class="list-item">
587
+ <div class="list-num">04</div>
588
+ <div><strong>Flash Attention:</strong> A hardware-aware algorithm that prevents constantly loading/saving huge attention matrices to the GPU's slow HBM memory.</div>
589
+ </div>
590
+ `
591
+ },
592
+ "lecture-3": {
593
+ overview: `
594
+ <p>What makes an LLM "Large" and how do we extract the best performance out of it? This module rips open the generative engine inside models like GPT-4, Llama 3, and Claude.</p>
595
+ `,
596
+ concepts: `
597
+ <h3>LLM Internals & Inference</h3>
598
+ <div class="list-item">
599
+ <div class="list-num">01</div>
600
+ <div><strong>Mixture of Experts (MoE):</strong> Instead of a single massive FFN applied to every token, the model has multiple specialized sub-networks ("experts"). A router network selects the top 2 experts for each specific token. (Used by GPT-4 and Mixtral).</div>
601
+ </div>
602
+ <div class="list-item">
603
+ <div class="list-num">02</div>
604
+ <div><strong>Temperature & Sampling:</strong> LLMs output a probability distribution over the vocabulary. <code>Temperature=0.0</code> picks the absolute most likely token every time (greedy decoding, factual). <code>Temperature=0.8</code> introduces weighted randomness.</div>
605
+ </div>
606
+ <div class="list-item">
607
+ <div class="list-num">03</div>
608
+ <div><strong>Few-Shot Prompting & In-Context Learning:</strong> LLMs can temporarily learn a new task simply by being shown 2-3 examples within the prompt. They don't change weights; they deduce the pattern dynamically.</div>
609
+ </div>
610
+ <div class="list-item">
611
+ <div class="list-num">04</div>
612
+ <div><strong>Chain of Thought (CoT):</strong> Forcing the AI to explain its math/logic step-by-step prior to outputting an answer prevents it from jumping to incorrect sequential conclusions.</div>
613
+ </div>
614
+ `,
615
+ math:`
616
+ <h3>Sampling using Temperature</h3>
617
+ <div class="formula">
618
+ $$ p_i = \\frac{e^{z_i / T}}{\\sum_j e^{z_j / T}} $$
619
+ </div>
620
+ <p style="text-align: center; color: var(--text-dim);">
621
+ Where $T$ is the temperature parameter. As $T \\to 0$, it becomes a deterministic $\\max$ operation.<br>
622
+ As $T \\to \\infty$, the distribution becomes uniform across all possible tokens.
623
+ </p>
624
+ `
625
+ },
626
+ "lecture-4": {
627
+ overview: `
628
+ <p>How are these giant models built? The lifecycle of training a Foundation Model spans months and costs millions.</p>
629
+ `,
630
+ concepts: `
631
+ <h3>The Tuning Lifecycle</h3>
632
+ <div class="list-item">
633
+ <div class="list-num">01</div>
634
+ <div><strong>Pretraining:</strong> The bulk of the expense. The model reads terabytes of unstructured text (Common Crawl, Code, Books) and learns grammar, logic, and facts purely by objective: <em>Predict the next word</em>.</div>
635
+ </div>
636
+ <div class="list-item">
637
+ <div class="list-num">02</div>
638
+ <div><strong>Supervised Finetuning (SFT):</strong> A pretrained model will just autocomplete text. SFT feeds the model tens of thousands of highly curated prompt/response datasets, forcing the model to adopt a "helpful assistant" persona.</div>
639
+ </div>
640
+ <div class="list-item">
641
+ <div class="list-num">03</div>
642
+ <div><strong>LoRA (Low-Rank Adaptation):</strong> Full-parameter finetuning is too expensive. LoRA freezes the original model weights and injects small, trainable "adapter" matrices into the attention layers, dropping GPU requirements from 8xA100s to a single consumer GPU.</div>
643
+ </div>
644
+ <div class="list-item">
645
+ <div class="list-num">04</div>
646
+ <div><strong>Quantization:</strong> Truncating the mathematical precision of the weights from FP16 (16-bit Float) to INT4 (4-bit Integer), dramatically shrinking VRAM requirements so models can run locally without losing severe intelligence (e.g., GGUF, NF4 formats).</div>
647
+ </div>
648
+ `
649
+ },
650
+ "lecture-5": {
651
+ overview: `
652
+ <p>Even an SFT model might generate harmful, politically biased, or unsafe answers. Alignment refers to shaping the model's outputs to heavily mirror human preferences.</p>
653
+ `,
654
+ concepts: `
655
+ <h3>Alignment Techniques</h3>
656
+ <div class="list-item">
657
+ <div class="list-num">01</div>
658
+ <div><strong>RLHF (Reinforcement Learning from Human Feedback):</strong> Traditional approach from ChatGPT (2022). Humans evaluate two model responses. A separate "Reward Model" learns what humans prefer. Then, the LLM is optimized using RL (PPO) against the Reward Model.</div>
659
+ </div>
660
+ <div class="list-item">
661
+ <div class="list-num">02</div>
662
+ <div><strong>PPO (Proximal Policy Optimization):</strong> A stable reinforcement learning algorithm that nudges the model parameters to achieve higher rewards while preventing the model from collapsing into a weird edge case to "game" the reward system explicitly.</div>
663
+ </div>
664
+ <div class="list-item">
665
+ <div class="list-num">03</div>
666
+ <div><strong>DPO (Direct Preference Optimization):</strong> (2023 Breakthrough). Bypasses the complex Reward Model entire. Uses mathematical equivalencies to update the LLM weights directly using the chosen/rejected pairwise data in a simple cross-entropy-like supervised training loop.</div>
667
+ </div>
668
+ `
669
+ },
670
+ "lecture-6": {
671
+ overview: `
672
+ <p>Generative modeling reaches its ceiling when answers require long planning steps. "Reasoning Models" (like DeepSeek R1 and OpenAI o1) use RL to develop an inner monologue.</p>
673
+ <div class="callout tip">
674
+ <div class="callout-title">System 1 vs System 2</div>
675
+ Standard LLMs are "System 1" (instinctual, fast reflexes). Reasoning models unlock "System 2" (methodical, slow, deep thinking).
676
+ </div>
677
+ `,
678
+ concepts: `
679
+ <h3>Advanced Reasoning Dynamics</h3>
680
+ <div class="callout insight">
681
+ <p><strong>Test-Time Compute:</strong> The insight that giving a model more time to generate hidden "thinking tokens" drastically improves its output quality. Unlike parametric training, you can scale intelligence infinitely by simply letting the model think longer.</p>
682
+ </div>
683
+ <div class="list-item">
684
+ <div class="list-num">01</div>
685
+ <div><strong>Verifiable Rewards:</strong> Training models using massive RL loops where the only reward is "does this python code pass the test?" or "does this step arrive at the correct final math answer?", forcing it to develop its own organic strategy.</div>
686
+ </div>
687
+ <div class="list-item">
688
+ <div class="list-num">02</div>
689
+ <div><strong>GRPO (Group Relative Policy Optimization):</strong> Used efficiently by DeepSeek to optimize reasoning models without needing a secondary "critic" model holding up VRAM.</div>
690
+ </div>
691
+ `
692
+ },
693
+ "lecture-7": {
694
+ overview: `
695
+ <p>An LLM is just a brain locked in a vault. Agentic frameworks give it the ability to connect to databases, browse the web, and execute actions.</p>
696
+ `,
697
+ concepts: `
698
+ <h3>Agent & Integration Paradigms</h3>
699
+ <div class="list-item">
700
+ <div class="list-num">01</div>
701
+ <div><strong>RAG (Retrieval-Augmented Generation):</strong> Connecting LLMs to private data. Documents are chunked, embedded via models into vectors, and stored in a Vector DB (like Pinecone). When a user queries, semantic search fetches the most relevant text and injects it into the LLM prompt.</div>
702
+ </div>
703
+ <div class="list-item">
704
+ <div class="list-num">02</div>
705
+ <div><strong>Function Calling (Tool Use):</strong> Models finetuned to halt generation and return a strictly formatted JSON specifying an API name and extracted parameters (e.g., <code>{"name":"get_weather", "location":"Boston"}</code>).</div>
706
+ </div>
707
+ <div class="list-item">
708
+ <div class="list-num">03</div>
709
+ <div><strong>The ReAct Pattern:</strong> A looping prompt structure. The LLM produces a <em>Thought</em> (analysis of goal) β†’ outputs an <em>Action</em> (tool call) β†’ receives an <em>Observation</em> (system result) β†’ repeats until the goal is concluded.</div>
710
+ </div>
711
+ `
712
+ },
713
+ "lecture-8": {
714
+ overview: `
715
+ <p>Evaluating an LLM's intelligence is extremely complex since language is subjective. This module covers benchmarks and the transition to algorithmic judges.</p>
716
+ `,
717
+ concepts: `
718
+ <h3>Evaluation Strategies</h3>
719
+ <div class="list-item">
720
+ <div class="list-num">01</div>
721
+ <div><strong>The Evaluation Crisis:</strong> Exact-match metrics like BLEU or ROUGE are dead β€” they punish an LLM if it uses a synonym or expands intelligently.</div>
722
+ </div>
723
+ <div class="list-item">
724
+ <div class="list-num">02</div>
725
+ <div><strong>LLM-as-a-Judge:</strong> Using a superior model (e.g., GPT-4o) with an explicit grading rubric to read and score responses from a smaller model.</div>
726
+ </div>
727
+ <div class="list-item">
728
+ <div class="list-num">03</div>
729
+ <div><strong>Judge Biases:</strong> Judges suffer from Position Bias (favoring the first model), Verbosity Bias (assuming longer responses are smarter), and Self-Enhancement bias (liking its own answers).</div>
730
+ </div>
731
+ <div class="list-item">
732
+ <div class="list-num">04</div>
733
+ <div><strong>Key Benchmarks:</strong> MMLU (General multi-subject knowledge), GSM8K (Middle school math), HumanEval (Python coding).</div>
734
+ </div>
735
+ `
736
+ },
737
+ "lecture-9": {
738
+ overview: `
739
+ <p>The bleeding edge. The integration of image, audio, and generation models merging into singular foundation interfaces.</p>
740
+ `,
741
+ concepts: `
742
+ <h3>Multimodality & Future Scope</h3>
743
+ <div class="list-item">
744
+ <div class="list-num">01</div>
745
+ <div><strong>Vision Transformers (ViT):</strong> Proving that you don't need CNNs for computer vision. Images are sliced into visual "patches" which are flattened and fed linearly to standard Transformer Attention layers.</div>
746
+ </div>
747
+ <div class="list-item">
748
+ <div class="list-num">02</div>
749
+ <div><strong>Multimodal Models (VLMs):</strong> Models natively trained to accept interwoven text and image inputs (e.g., Claude 3.5 Sonnet, GPT-4o) to reason over diagrams and real-world photos.</div>
750
+ </div>
751
+ <div class="list-item">
752
+ <div class="list-num">03</div>
753
+ <div><strong>Diffusion Convergence:</strong> Future generation where LLMs tightly couple with Diffusion backbones (like Stable Diffusion/Sora) for massive video generation conditioned entirely on LLM reasoning.</div>
754
+ </div>
755
+ `
756
+ }
757
+ };
758
+
759
+ // --- Core Application Logic ---
760
+ function initDashboard() {
761
+ const grid = document.getElementById("modulesGrid");
762
+ const container = document.getElementById("modulesContainer");
763
+
764
+ modules.forEach((module, index) => {
765
+ const card = document.createElement("div");
766
+ card.className = "card";
767
+ card.style.borderColor = module.color;
768
+ card.onclick = () => switchTo(module.id + "-module");
769
+ card.innerHTML = `
770
+ <div class="card-icon">${module.icon}</div>
771
+ <h3>${module.title}</h3>
772
+ <p>${module.description}</p>
773
+ <span class="category-label" style="background: ${module.color}22; color: ${module.color};">${module.category}</span>
774
+ `;
775
+ grid.appendChild(card);
776
+
777
+ const moduleHTML = createModuleHTML(module);
778
+ container.innerHTML += moduleHTML;
779
+ });
780
+ }
781
+
782
+ function createModuleHTML(module) {
783
+ const content = MODULE_CONTENT[module.id] || {};
784
+
785
+ return `
786
+ <div class="module" id="${module.id}-module">
787
+ <button class="btn-back" onclick="switchTo('dashboard')">← Back to Dashboard</button>
788
+ <header>
789
+ <h1>${module.icon} ${module.title}</h1>
790
+ <p class="subtitle">${module.description}</p>
791
+ </header>
792
+
793
+ <div class="tabs">
794
+ <button class="tab-btn active" onclick="switchTab(event, '${module.id}-overview')">Overview</button>
795
+ <button class="tab-btn" onclick="switchTab(event, '${module.id}-concepts')">Key Concepts</button>
796
+ ${content.math ? `<button class="tab-btn" onclick="switchTab(event, '${module.id}-math')">Math & Theory</button>` : ''}
797
+ ${content.applications ? `<button class="tab-btn" onclick="switchTab(event, '${module.id}-applications')">Applications</button>` : ''}
798
+ ${content.code ? `<button class="tab-btn" onclick="switchTab(event, '${module.id}-code')">Code</button>` : ''}
799
+ </div>
800
+
801
+ <div id="${module.id}-overview" class="tab active">
802
+ <div class="section">
803
+ <h2>πŸ“– Overview</h2>
804
+ ${content.overview || '<p>Content in development.</p>'}
805
+ </div>
806
+ </div>
807
+
808
+ <div id="${module.id}-concepts" class="tab">
809
+ <div class="section">
810
+ <h2>🎯 Key Concepts</h2>
811
+ ${content.concepts || '<p>Content in development.</p>'}
812
+ </div>
813
+ </div>
814
+
815
+ ${content.math ? `
816
+ <div id="${module.id}-math" class="tab">
817
+ <div class="section">
818
+ <h2>πŸ“ Math & Theory</h2>
819
+ ${content.math}
820
+ </div>
821
+ </div>` : ''}
822
+
823
+ ${content.applications ? `
824
+ <div id="${module.id}-applications" class="tab">
825
+ <div class="section">
826
+ <h2>🌍 Applications</h2>
827
+ ${content.applications}
828
+ </div>
829
+ </div>` : ''}
830
+
831
+ ${content.code ? `
832
+ <div id="${module.id}-code" class="tab">
833
+ <div class="section">
834
+ <h2>🐍 Implementation</h2>
835
+ ${content.code}
836
+ </div>
837
+ </div>` : ''}
838
+ </div>
839
+ `;
840
+ }
841
+
842
+ function switchTo(target) {
843
+ document.querySelectorAll('.dashboard, .module').forEach(el => {
844
+ el.classList.remove('active');
845
+ });
846
+ const elem = document.getElementById(target);
847
+ if (elem) {
848
+ elem.classList.add('active');
849
+ window.scrollTo(0, 0);
850
+ }
851
+ }
852
+
853
+ function switchTab(e, tabId) {
854
+ const module = e.target.closest('.module');
855
+ if (!module) return;
856
+
857
+ module.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
858
+ module.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
859
+
860
+ const tab = document.getElementById(tabId);
861
+ if (tab) tab.classList.add('active');
862
+ e.target.classList.add('active');
863
+
864
+ if (window.MathJax && window.MathJax.typesetPromise) {
865
+ window.MathJax.typesetPromise([tab]).catch(function (err) { console.log('MathJax typeset:', err); });
866
+ }
867
+ }
868
+
869
+ // Initialize application
870
+ initDashboard();
871
+ </script>
872
+ </body>
873
+ </html>
GenAI-AgenticAI/app.js CHANGED
@@ -137,7 +137,35 @@ const MODULE_CONTENT = {
137
  <tr><td>DeepSeek</td><td>DeepSeek V3, R1</td><td>Exceptional reasoning, competitive with o1</td><td>Math, coding, research</td></tr>
138
  </table>
139
 
140
- <h3>8. Scaling Laws β€” Why Bigger Models Get Smarter</h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  <p><strong>Chinchilla Scaling Law</strong> (Hoffmann et al., 2022): For a compute-optimal model, training tokens should scale proportionally to model parameters. A 70B model should be trained on ~1.4 trillion tokens. Key insight: many earlier models were <strong>undertrained</strong> (too many params, not enough data). LLaMA showed smaller, well-trained models can match larger undertrained ones.</p>
142
  </div>`,
143
  code: `
@@ -1771,7 +1799,16 @@ output = model.generate(inputs, max_new_tokens=<span class="number">100</span>)
1771
  </table>
1772
 
1773
  <h3>3. vLLM β€” The Production Standard</h3>
1774
- <p><strong>PagedAttention</strong> (inspired by OS virtual memory): stores KV cache in non-contiguous memory pages. Traditional serving pre-allocates max KV cache β€” wasting 60-80% of GPU memory. PagedAttention allocates on demand: 3-24x higher throughput. <strong>Continuous batching</strong>: instead of waiting for an entire batch to complete, add new requests as old ones finish. <strong>LoRA serving</strong>: serve multiple LoRA adapters on same base β€” multi-tenant support.</p>
 
 
 
 
 
 
 
 
 
1775
 
1776
  <h3>4. GPU vs API Decision Framework</h3>
1777
  <table>
@@ -2636,57 +2673,120 @@ client = Client()
2636
  });
2637
 
2638
 
2639
- // ─── Dashboard Render ───────────────────────────────────────────────────────
2640
- function renderDashboard() {
2641
- const grid = document.getElementById('modulesGrid');
2642
- grid.innerHTML = modules.map((m, i) => `
2643
- <div class="card stagger stagger-${(i % 8) + 1}" onclick="showModule('${m.id}')">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2644
  <div class="card-icon">${m.icon}</div>
2645
  <h3>${m.title}</h3>
2646
  <p>${m.desc}</p>
2647
- <span class="category-label ${m.catClass}">${m.category}</span>
2648
- </div>`).join('');
 
2649
  }
2650
 
2651
- // ─── Module View ────────────────────────────────────────────────────────────
2652
- function showModule(id) {
2653
- const m = modules.find(x => x.id === id);
2654
- const c = MODULE_CONTENT[id];
2655
- if (!m || !c) return;
 
 
 
2656
 
2657
- document.getElementById('dashboard').classList.remove('active');
 
 
2658
 
 
 
 
 
 
2659
  const container = document.getElementById('modulesContainer');
2660
- container.innerHTML = `
2661
- <div class="module active" id="module-${id}">
2662
- <button class="btn-back" onclick="showDashboard()">← Back to Dashboard</button>
2663
- <header>
2664
- <h1>${m.icon} ${m.title}</h1>
2665
- <p class="subtitle">${m.desc}</p>
2666
- </header>
2667
- <div class="tabs">
2668
- <button class="tab-btn active" onclick="switchTab(event,'concepts-${id}','${id}')">πŸ“– Key Concepts</button>
2669
- <button class="tab-btn" onclick="switchTab(event,'code-${id}','${id}')">πŸ’» Code Examples</button>
2670
- <button class="tab-btn" onclick="switchTab(event,'interview-${id}','${id}')">🎯 Interview Questions</button>
 
 
 
 
 
 
 
 
 
 
2671
  </div>
2672
- <div id="concepts-${id}" class="tab active">${c.concepts || ''}</div>
2673
- <div id="code-${id}" class="tab">${c.code || ''}</div>
2674
- <div id="interview-${id}" class="tab">${c.interview || ''}</div>
2675
- </div>`;
2676
  }
2677
 
2678
  function showDashboard() {
2679
- document.getElementById('modulesContainer').innerHTML = '';
2680
- document.getElementById('dashboard').classList.add('active');
 
 
 
 
 
 
 
 
 
 
2681
  }
2682
 
2683
  function switchTab(event, tabId, moduleId) {
2684
- const module = document.getElementById('module-' + moduleId);
2685
- module.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
2686
- module.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
2687
- document.getElementById(tabId).classList.add('active');
2688
- event.target.classList.add('active');
 
 
 
 
 
 
 
2689
  }
2690
 
2691
- // ─── Init ───────────────────────────────────────────────────────────────────
2692
- document.addEventListener('DOMContentLoaded', renderDashboard);
 
 
 
137
  <tr><td>DeepSeek</td><td>DeepSeek V3, R1</td><td>Exceptional reasoning, competitive with o1</td><td>Math, coding, research</td></tr>
138
  </table>
139
 
140
+ <h3>8. Advanced Decoding Strategies</h3>
141
+ <p>Decoding is the process of generating tokens from probability distributions. Advanced techniques improve coherence and reasoning:</p>
142
+ <table>
143
+ <tr><th>Strategy</th><th>How It Works</th><th>Best For</th></tr>
144
+ <tr><td><strong>SLED</strong></td><td>Speculative LEvel Decoding β€” utilizes smaller "draft" models to verify tokens, speeding up generation.</td><td>Low-latency serving</td></tr>
145
+ <tr><td><strong>Contrastive Decoding</strong></td><td>Generated by subtracting the log-probabilities of an amateur model from an expert model.</td><td>Reducing hallucinations</td></tr>
146
+ <tr><td><strong>Beam Search</strong></td><td>Maintains multiple hypotheses (beams) and selects the sequence with highest overall probability.</td><td>Translation, summarization</td></tr>
147
+ <tr><td><strong>Top-P (Nucleus)</strong></td><td>Samples from the smallest set of tokens whose cumulative probability exceeds P.</td><td>Creative writing</td></tr>
148
+ <tr><td><strong>Typical Sampling</strong></td><td>Favors tokens whose log-probability is close to the average entropy.</td><td>Consistent high-quality text</td></tr>
149
+ </table>
150
+
151
+ <h3>9. Model Distillation β€” 3 Core Types</h3>
152
+ <p>Transferring knowledge from a large teacher (e.g., GPT-4) to a small student model (e.g., LLaMA-1B):</p>
153
+ <ul>
154
+ <li><strong>1. Black-box Distillation:</strong> Use teacher output (labels/text) only. Simplest but less precise.</li>
155
+ <li><strong>2. Multi-teacher Distillation:</strong> Average gradients or outputs from multiple experts to a single student.</li>
156
+ <li><strong>3. Self-distillation:</strong> Using a model to critique and improve its own smaller/earlier versions.</li>
157
+ </ul>
158
+
159
+ <h3>10. Local Development Setups</h3>
160
+ <table>
161
+ <tr><th>Setup</th><th>Key Advantage</th><th>Best For</th></tr>
162
+ <tr><td><strong>llama.cpp</strong></td><td>Pure C++, zero dependencies, runs on CPU/M-series.</td><td>Maximum portability</td></tr>
163
+ <tr><td><strong>MLC-LLM</strong></td><td>Universal deployment via Vulcan/WebGPU/Metal.</td><td>Cross-platform apps</td></tr>
164
+ <tr><td><strong>GPT4All</strong></td><td>Desktop UI, easy installer, local RAG built-in.</td><td>Non-technical users</td></tr>
165
+ <tr><td><strong>LM Studio</strong></td><td>Professional UI, model discovery, local server API.</td><td>Developer productivity</td></tr>
166
+ </table>
167
+
168
+ <h3>11. Scaling Laws β€” Why Bigger Models Get Smarter</h3>
169
  <p><strong>Chinchilla Scaling Law</strong> (Hoffmann et al., 2022): For a compute-optimal model, training tokens should scale proportionally to model parameters. A 70B model should be trained on ~1.4 trillion tokens. Key insight: many earlier models were <strong>undertrained</strong> (too many params, not enough data). LLaMA showed smaller, well-trained models can match larger undertrained ones.</p>
170
  </div>`,
171
  code: `
 
1799
  </table>
1800
 
1801
  <h3>3. vLLM β€” The Production Standard</h3>
1802
+ <p><strong>PagedAttention</strong> (inspired by OS virtual memory): stores KV cache in non-contiguous memory pages. Traditional serving pre-allocates max KV cache β€” wasting 60-80% of GPU memory. PagedAttention allocates on demand: 3-24x higher throughput. <a href="https://arxiv.org/abs/2309.06180" target="_blank" style="color:var(--accent)">[Read the PagedAttention Paper]</a></p>
1803
+
1804
+ <div class="info-box">
1805
+ <div class="box-title">πŸ“˜ Recommended Resources</div>
1806
+ <ul style="margin-top:10px; color:var(--text-muted)">
1807
+ <li><a href="https://github.com/vllm-project/vllm" target="_blank" style="color:var(--accent)">vLLM Project Page</a> β€” High-throughput serving engine.</li>
1808
+ <li><a href="https://github.com/huggingface/text-generation-inference" target="_blank" style="color:var(--accent)">HF TGI Repository</a> β€” Production-ready LLM serving.</li>
1809
+ <li><a href="https://ollama.com" target="_blank" style="color:var(--accent)">Ollama Official Site</a> β€” Best for local development.</li>
1810
+ </ul>
1811
+ </div>
1812
 
1813
  <h3>4. GPU vs API Decision Framework</h3>
1814
  <table>
 
2673
  });
2674
 
2675
 
2676
+ // ─── Dashboard Orchestration ────────────────────────────────────────────────
2677
+ let activeFilter = 'All';
2678
+
2679
+ function renderDashboard(query = '') {
2680
+ const grid = document.getElementById('moduleGrid');
2681
+ const noResults = document.getElementById('noResults');
2682
+ const q = query.toLowerCase().trim();
2683
+
2684
+ const filtered = modules.filter(m => {
2685
+ const matchFilter = activeFilter === 'All' || m.category === activeFilter;
2686
+ const matchSearch = !q || m.title.toLowerCase().includes(q) || m.desc.toLowerCase().includes(q) || m.category.toLowerCase().includes(q);
2687
+ return matchFilter && matchSearch;
2688
+ });
2689
+
2690
+ const statModules = document.getElementById('statModules');
2691
+ if (statModules) statModules.textContent = modules.length;
2692
+
2693
+ if (!grid) return;
2694
+
2695
+ if (filtered.length === 0) {
2696
+ grid.innerHTML = '';
2697
+ if (noResults) noResults.style.display = 'block';
2698
+ return;
2699
+ }
2700
+ if (noResults) noResults.style.display = 'none';
2701
+
2702
+ grid.innerHTML = filtered.map((m, i) => `
2703
+ <div class="card ${m.catClass} stagger stagger-${(i % 8) + 1}" onclick="openModule('${m.id}')">
2704
+ <span class="card-badge">${m.category}</span>
2705
  <div class="card-icon">${m.icon}</div>
2706
  <h3>${m.title}</h3>
2707
  <p>${m.desc}</p>
2708
+ <div class="card-arrow">β†’</div>
2709
+ </div>
2710
+ `).join('');
2711
  }
2712
 
2713
+ function setFilter(cat, btn) {
2714
+ activeFilter = cat;
2715
+ document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
2716
+ if (btn) btn.classList.add('active');
2717
+
2718
+ const searchInput = document.getElementById('searchInput');
2719
+ renderDashboard(searchInput ? searchInput.value : '');
2720
+ }
2721
 
2722
+ function filterModules(q) {
2723
+ renderDashboard(q);
2724
+ }
2725
 
2726
+ function openModule(id) {
2727
+ const m = modules.find(x => x.id === id);
2728
+ const c = MODULE_CONTENT[id] || {};
2729
+
2730
+ const dashboard = document.getElementById('dashboard');
2731
  const container = document.getElementById('modulesContainer');
2732
+
2733
+ if (dashboard) dashboard.classList.remove('active');
2734
+ if (container) {
2735
+ container.classList.add('active');
2736
+ container.innerHTML = `
2737
+ <div class="module active" id="module-${id}">
2738
+ <button class="btn-back" onclick="showDashboard()">← Back to Dashboard</button>
2739
+ <header>
2740
+ <h1>${m.icon} ${m.title}</h1>
2741
+ <p class="subtitle">${m.desc}</p>
2742
+ </header>
2743
+
2744
+ <div class="tabs">
2745
+ <button class="tab-btn active" onclick="switchTab(event,'concepts-${id}','${id}')">πŸ“– Key Concepts</button>
2746
+ <button class="tab-btn" onclick="switchTab(event,'code-${id}','${id}')">πŸ’» Code Examples</button>
2747
+ <button class="tab-btn" onclick="switchTab(event,'interview-${id}','${id}')">🎯 Interview Questions</button>
2748
+ </div>
2749
+
2750
+ <div id="concepts-${id}" class="tab active">${c.concepts || '<p style="color:var(--text-muted);padding:40px 0">Technical concepts for this module are being finalized.</p>'}</div>
2751
+ <div id="code-${id}" class="tab">${c.code || '<p style="color:var(--text-muted);padding:40px 0">Implementation examples are being prepared.</p>'}</div>
2752
+ <div id="interview-${id}" class="tab">${c.interview || '<p style="color:var(--text-muted);padding:40px 0">Interview prep module is in development.</p>'}</div>
2753
  </div>
2754
+ `;
2755
+ }
2756
+ window.scrollTo({ top: 0, behavior: 'smooth' });
 
2757
  }
2758
 
2759
  function showDashboard() {
2760
+ const dashboard = document.getElementById('dashboard');
2761
+ const container = document.getElementById('modulesContainer');
2762
+
2763
+ if (container) {
2764
+ container.classList.remove('active');
2765
+ container.innerHTML = '';
2766
+ }
2767
+ if (dashboard) dashboard.classList.add('active');
2768
+
2769
+ // Refresh the dashboard state
2770
+ const searchInput = document.getElementById('searchInput');
2771
+ renderDashboard(searchInput ? searchInput.value : '');
2772
  }
2773
 
2774
  function switchTab(event, tabId, moduleId) {
2775
+ const mod = document.getElementById('module-' + moduleId);
2776
+ if (!mod) return;
2777
+
2778
+ mod.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
2779
+ mod.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
2780
+
2781
+ const targetTab = document.getElementById(tabId);
2782
+ if (targetTab) targetTab.classList.add('active');
2783
+
2784
+ // Support clicking on icons inside buttons
2785
+ const btn = event.target.closest('.tab-btn');
2786
+ if (btn) btn.classList.add('active');
2787
  }
2788
 
2789
+ // Initial Render
2790
+ document.addEventListener('DOMContentLoaded', () => {
2791
+ renderDashboard();
2792
+ });
GenAI-AgenticAI/index.html CHANGED
@@ -376,94 +376,14 @@
376
 
377
  <div id="modulesContainer"></div>
378
 
379
- <script src="app.js"></script>
380
- <script>
381
- let activeFilter = 'All';
382
-
383
- function renderDashboard(query = '') {
384
- const grid = document.getElementById('moduleGrid');
385
- const noResults = document.getElementById('noResults');
386
- const q = query.toLowerCase().trim();
387
-
388
- const filtered = modules.filter(m => {
389
- const matchFilter = activeFilter === 'All' || m.category === activeFilter;
390
- const matchSearch = !q || m.title.toLowerCase().includes(q) || m.desc.toLowerCase().includes(q) || m.category.toLowerCase().includes(q);
391
- return matchFilter && matchSearch;
392
  });
393
-
394
- document.getElementById('statModules').textContent = modules.length;
395
-
396
- if (filtered.length === 0) {
397
- grid.innerHTML = '';
398
- noResults.style.display = 'block';
399
- return;
400
- }
401
- noResults.style.display = 'none';
402
-
403
- grid.innerHTML = filtered.map(m => `
404
- <div class="card ${m.catClass}" onclick="openModule('${m.id}')">
405
- <span class="card-icon">${m.icon}</span>
406
- <span class="card-badge">${m.category}</span>
407
- <h3>${m.title}</h3>
408
- <p>${m.desc}</p>
409
- <span class="card-arrow">β†’</span>
410
- </div>
411
- `).join('');
412
- }
413
-
414
- function setFilter(cat, btn) {
415
- activeFilter = cat;
416
- document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
417
- btn.classList.add('active');
418
- renderDashboard(document.getElementById('searchInput').value);
419
- }
420
-
421
- function filterModules(q) {
422
- renderDashboard(q);
423
- }
424
-
425
- function openModule(id) {
426
- const m = modules.find(x => x.id === id);
427
- const c = MODULE_CONTENT[id] || {};
428
-
429
- document.getElementById('dashboard').classList.remove('active');
430
-
431
- const container = document.getElementById('modulesContainer');
432
- container.innerHTML = `
433
- <div class="module active" id="module-${id}">
434
- <button class="btn-back" onclick="showDashboard()">← Back to Dashboard</button>
435
- <header>
436
- <h1>${m.icon} ${m.title}</h1>
437
- <p class="subtitle">${m.desc}</p>
438
- </header>
439
- <div class="tabs">
440
- <button class="tab-btn active" onclick="switchTab(event,'concepts-${id}','${id}')">πŸ“– Key Concepts</button>
441
- <button class="tab-btn" onclick="switchTab(event,'code-${id}','${id}')">πŸ’» Code Examples</button>
442
- <button class="tab-btn" onclick="switchTab(event,'interview-${id}','${id}')">🎯 Interview Questions</button>
443
- </div>
444
- <div id="concepts-${id}" class="tab active">${c.concepts || '<p style="color:var(--text-muted);padding:40px 0">Content coming soon.</p>'}</div>
445
- <div id="code-${id}" class="tab">${c.code || '<p style="color:var(--text-muted);padding:40px 0">Code examples coming soon.</p>'}</div>
446
- <div id="interview-${id}" class="tab">${c.interview || '<p style="color:var(--text-muted);padding:40px 0">Interview questions coming soon.</p>'}</div>
447
- </div>`;
448
-
449
- window.scrollTo({ top: 0, behavior: 'smooth' });
450
- }
451
-
452
- function showDashboard() {
453
- document.getElementById('modulesContainer').innerHTML = '';
454
- document.getElementById('dashboard').classList.add('active');
455
- }
456
-
457
- function switchTab(event, tabId, moduleId) {
458
- const mod = document.getElementById('module-' + moduleId);
459
- mod.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
460
- mod.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
461
- document.getElementById(tabId).classList.add('active');
462
- event.target.classList.add('active');
463
- }
464
-
465
- // Init
466
- renderDashboard();
467
- </script>
468
  </body>
469
  </html>
 
376
 
377
  <div id="modulesContainer"></div>
378
 
379
+ <script src="app.js"></script>
380
+ <script>
381
+ // Use a small wrapper to handle page-specific initialization if any
382
+ window.addEventListener('DOMContentLoaded', () => {
383
+ if (typeof renderDashboard === 'function') {
384
+ renderDashboard();
385
+ }
 
 
 
 
 
 
386
  });
387
+ </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  </body>
389
  </html>
README.md CHANGED
@@ -23,6 +23,8 @@ Visit our courses directly in your browser:
23
  - [βš™οΈ Feature Engineering Guide](https://aashishgarg13.github.io/DataScience/feature-engineering/index.html)
24
  - [πŸ€” Prompt Engineering Guide](https://aashishgarg13.github.io/DataScience/prompt-engineering-guide/index.html) - Interactive AI prompting course
25
  - [🧠 Claude Prompt Engineering Guide](https://aashishgarg13.github.io/DataScience/Claude%20Prompt%20Engineering%20Course/index.html) - In-depth guide for Anthropic's Claude models
 
 
26
 
27
  ## πŸ”— Prompt Engineering Resources
28
 
@@ -96,7 +98,20 @@ Essential resources for mastering AI prompt engineering:
96
  - Complex Tool Use & API Integration
97
  - Prompt Versioning & Safety Guardrails
98
 
99
- > πŸ’‘ All projects are pure static websites - no server needed! Open directly in your browser or use a simple static server.
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
  ## πŸ”„ Auto-Update & Integration
102
 
 
23
  - [βš™οΈ Feature Engineering Guide](https://aashishgarg13.github.io/DataScience/feature-engineering/index.html)
24
  - [πŸ€” Prompt Engineering Guide](https://aashishgarg13.github.io/DataScience/prompt-engineering-guide/index.html) - Interactive AI prompting course
25
  - [🧠 Claude Prompt Engineering Guide](https://aashishgarg13.github.io/DataScience/Claude%20Prompt%20Engineering%20Course/index.html) - In-depth guide for Anthropic's Claude models
26
+ - [πŸ€– AI Engineer Masterclass](https://aashishgarg13.github.io/DataScience/GenAI-AgenticAI/index.html) - GenAI, RAG, and Agents
27
+ - [πŸŽ“ CME 295: Transformers](https://aashishgarg13.github.io/DataScience/CME295-Transformers/index.html) - Stanford Course Distillation
28
 
29
  ## πŸ”— Prompt Engineering Resources
30
 
 
98
  - Complex Tool Use & API Integration
99
  - Prompt Versioning & Safety Guardrails
100
 
101
+ ### πŸ€– AI Engineer Masterclass
102
+ - **Location:** `GenAI-AgenticAI/`
103
+ - **Features:**
104
+ - GenAI Fundamentals (SLED, Contrastive Decoding)
105
+ - Context Engineering & RAG
106
+ - Agentic Frameworks (ReAct, Multi-Agent, MCP)
107
+ - Production Deployment (vLLM, TGI, quantization)
108
+
109
+ ### πŸŽ“ CME 295: Transformers & LLMs
110
+ - **Location:** `CME295-Transformers/`
111
+ - **Features:**
112
+ - Stanford Course Distillation (Lecture 1-9)
113
+ - Attention Mechanisms (MHA, GQA, RoPE)
114
+ - Training, Alignment (RLHF, DPO), and Reasoning Models
115
 
116
  ## πŸ”„ Auto-Update & Integration
117
 
index.html CHANGED
@@ -263,6 +263,18 @@
263
  </div>
264
  <div class="card-footer">
265
  <span style="color: #58a6ff">Explore GenAI</span>
 
 
 
 
 
 
 
 
 
 
 
 
266
  <span class="arrow">β†’</span>
267
  </div>
268
  </a>
 
263
  </div>
264
  <div class="card-footer">
265
  <span style="color: #58a6ff">Explore GenAI</span>
266
+ </div>
267
+ </a>
268
+
269
+ <!-- CME 295 Transformers & LLMs -->
270
+ <a href="CME295-Transformers/index.html" class="card genai-card">
271
+ <div>
272
+ <span class="badge" style="background: rgba(163, 113, 247, 0.15); color: #a371f7;">πŸŽ“ Stanford</span>
273
+ <h2>Transformers & LLMs</h2>
274
+ <p>A comprehensive, simple, and understandable guide based on Stanford's CME 295. Master architectures, MoE, SFT, DPO, Reasoning Models, and AI Agents.</p>
275
+ </div>
276
+ <div class="card-footer">
277
+ <span style="color: #a371f7">Master LLMs</span>
278
  <span class="arrow">β†’</span>
279
  </div>
280
  </a>