-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharchitecture.html
More file actions
272 lines (250 loc) · 11.5 KB
/
Copy patharchitecture.html
File metadata and controls
272 lines (250 loc) · 11.5 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="favicon.png">
<title>Synapse-Graph — Architecture</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
padding: 20px;
min-height: 100vh;
background: #0a0f1a;
font-family: system-ui, -apple-system, sans-serif;
color: #e6eef8;
display: flex;
flex-direction: column;
align-items: center;
}
.container {
max-width: 900px;
width: 100%;
}
h1 {
text-align: center;
margin: 0 0 8px 0;
font-size: 28px;
}
.subtitle {
text-align: center;
color: #6b8aad;
font-size: 14px;
margin-bottom: 20px;
}
.svg-wrapper {
width: 100%;
border-radius: 12px;
overflow: hidden;
border: 1px solid rgba(62, 225, 255, 0.2);
margin-bottom: 20px;
}
svg {
display: block;
width: 100%;
height: auto;
}
.components {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 16px;
}
.component {
background: rgba(15, 25, 45, 0.85);
border: 1px solid rgba(62, 225, 255, 0.15);
border-radius: 12px;
padding: 16px;
transition: all 0.3s ease;
}
.component:hover {
border-color: rgba(62, 225, 255, 0.4);
transform: translateY(-2px);
}
.component-title {
display: flex;
align-items: center;
gap: 10px;
font-size: 16px;
font-weight: 700;
color: #60d4ff;
margin-bottom: 8px;
}
.component-icon {
width: 32px;
height: 32px;
background: rgba(62, 225, 255, 0.2);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
.component-desc {
color: #6b8aad;
font-size: 13px;
line-height: 1.5;
margin-bottom: 10px;
}
.component-files {
background: rgba(0, 10, 20, 0.5);
border-radius: 8px;
padding: 10px;
font-size: 11px;
color: #3ee1ff;
}
a.back {
display: block;
text-align: center;
color: #60d4ff;
text-decoration: none;
margin-top: 20px;
font-size: 14px;
}
a.back:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="container">
<h1>Synapse-Graph Architecture</h1>
<p class="subtitle">Click on any component to see implementation details below</p>
<div class="svg-wrapper">
<svg viewBox="0 0 800 420" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="cardBg" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" stop-color="rgba(62,225,255,0.15)"/>
<stop offset="100%" stop-color="rgba(62,225,255,0.05)"/>
</linearGradient>
<linearGradient id="successBg" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" stop-color="rgba(74,222,128,0.15)"/>
<stop offset="100%" stop-color="rgba(74,222,128,0.05)"/>
</linearGradient>
<linearGradient id="warningBg" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" stop-color="rgba(251,191,36,0.15)"/>
<stop offset="100%" stop-color="rgba(251,191,36,0.05)"/>
</linearGradient>
</defs>
<!-- Dashboard -->
<g transform="translate(50, 80)">
<rect width="140" height="100" rx="10" fill="url(#cardBg)" stroke="#60d4ff" stroke-width="2"/>
<text x="70" y="20" text-anchor="middle" fill="#60d4ff" font-size="10" font-weight="600">OPERATOR</text>
<text x="70" y="38" text-anchor="middle" fill="#e6eef8" font-size="13" font-weight="700">Dashboard</text>
<text x="70" y="56" text-anchor="middle" fill="#6b8aad" font-size="9">Next.js + React</text>
<text x="70" y="70" text-anchor="middle" fill="#6b8aad" font-size="9">@xyflow/react</text>
<text x="70" y="84" text-anchor="middle" fill="#6b8aad" font-size="9">Recharts</text>
</g>
<!-- Arrow: Dashboard to Proxy -->
<line x1="190" y1="130" x2="260" y2="130" stroke="#60d4ff" stroke-width="2"/>
<polygon points="255,126 265,130 255,134" fill="#60d4ff"/>
<text x="225" y="122" text-anchor="middle" fill="#6b8aad" font-size="9">REST + SSE</text>
<!-- Neural Proxy -->
<g transform="translate(270, 90)">
<rect width="200" height="100" rx="10" fill="url(#cardBg)" stroke="#60d4ff" stroke-width="2"/>
<text x="100" y="20" text-anchor="middle" fill="#60d4ff" font-size="10" font-weight="600">NEURAL PROXY</text>
<text x="100" y="38" text-anchor="middle" fill="#e6eef8" font-size="13" font-weight="700">FastAPI Runtime</text>
<text x="100" y="56" text-anchor="middle" fill="#6b8aad" font-size="9">Generation + Tracing</text>
<text x="100" y="70" text-anchor="middle" fill="#6b8aad" font-size="9">Governance + SSE</text>
<text x="100" y="84" text-anchor="middle" fill="#6b8aad" font-size="9">HeadMaskStore</text>
</g>
<!-- Arrows from Proxy -->
<line x1="270" y1="140" x2="270" y2="180" stroke="#60d4ff" stroke-width="2"/>
<line x1="270" y1="180" x2="100" y2="180" stroke="#60d4ff" stroke-width="2"/>
<polygon points="96,176 100,186 104,176" fill="#60d4ff"/>
<line x1="270" y1="190" x2="270" y2="195" stroke="#60d4ff" stroke-width="2"/>
<polygon points="266,191 270,201 274,191" fill="#60d4ff"/>
<line x1="470" y1="140" x2="470" y2="180" stroke="#60d4ff" stroke-width="2"/>
<line x1="470" y1="180" x2="600" y2="180" stroke="#60d4ff" stroke-width="2"/>
<polygon points="596,176 600,186 604,176" fill="#60d4ff"/>
<text x="535" y="175" text-anchor="middle" fill="#6b8aad" font-size="9">Topology + Lineage</text>
<!-- Ollama -->
<g transform="translate(30, 195)">
<rect width="140" height="70" rx="8" fill="url(#successBg)" stroke="#4ade80" stroke-width="2"/>
<text x="70" y="20" text-anchor="middle" fill="#4ade80" font-size="10" font-weight="600">GENERATION</text>
<text x="70" y="38" text-anchor="middle" fill="#e6eef8" font-size="13" font-weight="700">Ollama</text>
<text x="70" y="55" text-anchor="middle" fill="#6b8aad" font-size="10">Local LLM</text>
</g>
<!-- HF Tracer -->
<g transform="translate(200, 195)">
<rect width="140" height="70" rx="8" fill="url(#cardBg)" stroke="#60d4ff" stroke-width="2"/>
<text x="70" y="20" text-anchor="middle" fill="#60d4ff" font-size="10" font-weight="600">TRACING</text>
<text x="70" y="38" text-anchor="middle" fill="#e6eef8" font-size="13" font-weight="700">HF Tracer</text>
<text x="70" y="55" text-anchor="middle" fill="#6b8aad" font-size="10">PyTorch hooks</text>
</g>
<!-- OpenMetadata -->
<g transform="translate(530, 195)">
<rect width="140" height="70" rx="8" fill="url(#warningBg)" stroke="#fbbf24" stroke-width="2"/>
<text x="70" y="20" text-anchor="middle" fill="#fbbf24" font-size="10" font-weight="600">GOVERNANCE</text>
<text x="70" y="38" text-anchor="middle" fill="#e6eef8" font-size="13" font-weight="700">OpenMetadata</text>
<text x="70" y="55" text-anchor="middle" fill="#6b8aad" font-size="10">Topology + Tags</text>
</g>
<!-- DEFECTIVE Tag -->
<g transform="translate(530, 300)">
<rect width="140" height="50" rx="8" fill="rgba(239,68,68,0.15)" stroke="#ef4444" stroke-width="2"/>
<text x="70" y="28" text-anchor="middle" fill="#ef4444" font-size="12" font-weight="700">DEFECTIVE</text>
<text x="70" y="42" text-anchor="middle" fill="#6b8aad" font-size="10">→ Runtime Mask</text>
</g>
<!-- Arrow: OM to DEFECTIVE -->
<line x1="600" y1="265" x2="600" y2="300" stroke="#ef4444" stroke-width="2"/>
<polygon points="596,296 600,306 604,296" fill="#ef4444"/>
<!-- Legend -->
<rect x="30" y="330" width="20" height="14" rx="3" fill="url(#cardBg)" stroke="#60d4ff"/>
<text x="58" y="341" fill="#e6eef8" font-size="10">UI/Data</text>
<rect x="110" y="330" width="20" height="14" rx="3" fill="url(#successBg)" stroke="#4ade80"/>
<text x="138" y="341" fill="#e6eef8" font-size="10">Generation</text>
<rect x="210" y="330" width="20" height="14" rx="3" fill="url(#warningBg)" stroke="#fbbf24"/>
<text x="238" y="341" fill="#e6eef8" font-size="10">OpenMetadata</text>
</svg>
</div>
<div class="components">
<div class="component">
<div class="component-title">
<div class="component-icon">🎨</div>
Operator Dashboard
</div>
<div class="component-desc">Next.js 15 + React 19 dashboard for visualizing neural activity. Uses @xyflow/react for synapse graph visualization and Recharts for activation charts.</div>
<div class="component-files">frontend/components/synapse-dashboard.tsx<br>frontend/components/synapse-graph.tsx</div>
</div>
<div class="component">
<div class="component-title">
<div class="component-icon">⚡</div>
Neural Proxy (FastAPI)
</div>
<div class="component-desc">FastAPI runtime orchestrating generation, hook-based tracing, and OpenMetadata governance. Handles SSE streaming for real-time updates.</div>
<div class="component-files">backend/app/main.py<br>backend/app/inference.py</div>
</div>
<div class="component">
<div class="component-title">
<div class="component-icon">🔥</div>
Ollama (Generation)
</div>
<div class="component-desc">Local LLM via HTTP API. Used as primary generator when available. Falls back to HuggingFace if Ollama is not running.</div>
<div class="component-files">SYNAPSE_OLLAMA_MODEL=qwen2.5:3b-instruct</div>
</div>
<div class="component">
<div class="component-title">
<div class="component-icon">🔍</div>
HuggingFace Tracer
</div>
<div class="component-desc">Hook-based attention tracer using register_forward_hook. Captures per-layer, per-head activations including max_attention_score, l2_norm, top source positions.</div>
<div class="component-files">backend/app/inference.py<br>_register_attention_hooks()</div>
</div>
<div class="component">
<div class="component-title">
<div class="component-icon">🛡️</div>
OpenMetadata (Governance)
</div>
<div class="component-desc">Topology bootstrap creates synthetic entities. Lineage ingestion adds edges. Column-level tagging for DEFECTIVE heads.</div>
<div class="component-files">backend/app/om_client.py<br>SynapseQuarantine.DEFECTIVE</div>
</div>
<div class="component">
<div class="component-title">
<div class="component-icon">🎭</div>
HeadMaskStore
</div>
<div class="component-desc">In-memory store for masked heads. Two-level masking: attention tensor + projection masking. Applied per-layer via _TraceSession.</div>
<div class="component-files">backend/app/inference.py<br>set_masked_heads()</div>
</div>
</div>
<a class="back" href="https://fiscalmindset.github.io/Synapse-Graph/first_frame.html">← Back to Presentation</a>
</div>
</body>
</html>