Laborator commited on
Commit
d61c0cf
·
verified ·
1 Parent(s): 5c7a78c

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +22 -8
  2. app.py +272 -0
  3. requirements.txt +1 -0
README.md CHANGED
@@ -1,13 +1,27 @@
1
  ---
2
- title: Second Loop
3
- emoji: 📚
4
- colorFrom: purple
5
- colorTo: blue
6
  sdk: gradio
7
- sdk_version: 6.15.2
8
- python_version: '3.13'
9
  app_file: app.py
10
- pinned: false
 
 
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Second Loop · Project hub
3
+ emoji: 🌀
4
+ colorFrom: red
5
+ colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 4.44.0
 
8
  app_file: app.py
9
+ pinned: true
10
+ license: mit
11
+ short_description: Durable correction of memorized LLM errors — hub
12
  ---
13
 
14
+ # Second Loop — Project hub
15
+
16
+ Landing page for the three demo Spaces of the Second Loop project. Each
17
+ linked Space is fully static (no model loaded), all numbers are exact
18
+ outputs of the live experimental runs.
19
+
20
+ - **Part 1 — Scar-Survival** — durable correction of memorized errors
21
+ in a frozen LLM
22
+ - **Part 2 — External Grounding** — defending the correction notebook
23
+ from polluted memory
24
+ - **Part 3 — Thin Channel** — how rarely external truth can arrive
25
+ before calibration collapses
26
+
27
+ GitHub repositories are linked on every card.
app.py ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Second Loop hub Space — landing page linking to the three Part-Spaces:
2
+ Part 1: Scar-Survival (Laborator/scar-survival)
3
+ Part 2: External Grounding (Laborator/external-grounding)
4
+ Part 3: Thin Channel (Laborator/thin-channel)
5
+
6
+ No model, no data — just three cards in MicroLens style. Edit the
7
+ PROJECTS list below to retarget the Space ids."""
8
+
9
+ from __future__ import annotations
10
+
11
+ import gradio as gr
12
+
13
+ AUTHOR = "Serghei Brinza"
14
+ HF_USER = "Laborator"
15
+
16
+ PROJECTS = [
17
+ {
18
+ "part": "Part 1 of 3",
19
+ "title": "Scar-Survival",
20
+ "tagline": "Durable correction of memorized LLM errors",
21
+ "summary": (
22
+ "A frozen Qwen2.5-3B-Instruct, an external notebook of authoritative facts, "
23
+ "and CK-PLUG / DeCK-style contrastive decoding. Tested on 14 sticky-fact "
24
+ "traps, scored by an independent 7B judge across 10 full process reloads."
25
+ ),
26
+ "headline": "0/14 → 14/14 corrected · 100% survival across 10 reloads",
27
+ "icon": "🩹",
28
+ "color": "red",
29
+ "demo_url": f"https://huggingface.co/spaces/{HF_USER}/scar-survival",
30
+ "repo_url": "https://github.com/SergheiBrinza/scar-survival",
31
+ },
32
+ {
33
+ "part": "Part 2 of 3",
34
+ "title": "External Grounding",
35
+ "tagline": "Defending an LLM's correction notebook from polluted memory",
36
+ "summary": (
37
+ "Two guardians at the entrance to the notebook. Guardian 1.0 uses a "
38
+ "same-family clone as arbiter and caps at 64%. Guardian 2.x replaces "
39
+ "the arbiter with live Wikipedia retrieval plus three targeted fixes; "
40
+ "the arc reaches 100% on the same 14 traps."
41
+ ),
42
+ "headline": "50% → 64% → 71% → 86% → 100% across six guardian variants",
43
+ "icon": "🛡️",
44
+ "color": "orange",
45
+ "demo_url": f"https://huggingface.co/spaces/{HF_USER}/external-grounding",
46
+ "repo_url": "https://github.com/SergheiBrinza/external-grounding",
47
+ },
48
+ {
49
+ "part": "Part 3 of 3",
50
+ "title": "Thin Channel",
51
+ "tagline": "How rarely external truth can arrive before calibration collapses",
52
+ "summary": (
53
+ "Frozen Qwen2.5-3B-Instruct + per-topic Beta calibration over 1,646 "
54
+ "resolved ForecastBench questions, swept across 11 reveal schedules "
55
+ "from daily to never. Brier on hold-out is the metric."
56
+ ),
57
+ "headline": "Corridor 0.205–0.220 (any contact) · never collapses to 0.298",
58
+ "icon": "📡",
59
+ "color": "green",
60
+ "demo_url": f"https://huggingface.co/spaces/{HF_USER}/thin-channel",
61
+ "repo_url": "https://github.com/SergheiBrinza/thin-channel",
62
+ },
63
+ ]
64
+
65
+
66
+ CSS = """
67
+ @import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@1,700&family=Inter:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap');
68
+
69
+ :root {
70
+ --bg: #000000; --bg-card: #0A0A0A; --bg-elev: #141414;
71
+ --border: #1F1F1F; --border-strong: #2A2A2A;
72
+ --text: #FFFFFF; --text-mute: #A8A8A8; --text-dim: #6B6B6B;
73
+ --gold: #D4AF37; --gold-hi: #E8C84A;
74
+ --red: #FF2A2A; --green: #1FD160; --orange: #FF8C42;
75
+ --mono: 'JetBrains Mono', ui-monospace, monospace;
76
+ --serif: 'Playfair Display', serif;
77
+ --sans: 'Inter', system-ui, sans-serif;
78
+ }
79
+
80
+ .gradio-container, body {
81
+ background: var(--bg) !important; color: var(--text) !important;
82
+ font-family: var(--sans) !important;
83
+ max-width: 1180px !important; margin: 0 auto !important;
84
+ padding: 20px 24px 60px 24px !important;
85
+ }
86
+ footer, .built-with, .show-api { display: none !important; }
87
+
88
+ /* HUB HEADER */
89
+ .hub-head {
90
+ border: 1px solid var(--border-strong); border-radius: 14px;
91
+ padding: 36px 32px 30px 32px;
92
+ background: linear-gradient(180deg, #0A0A0A 0%, #050505 100%);
93
+ text-align: center;
94
+ margin-bottom: 22px;
95
+ }
96
+ .hub-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.28em;
97
+ color: var(--gold); text-transform: uppercase; margin-bottom: 10px; }
98
+ .hub-title { font-family: var(--serif); font-style: italic; font-weight: 700;
99
+ font-size: 56px; color: var(--text); line-height: 1; margin: 0 0 14px 0; }
100
+ .hub-sub { font-family: var(--mono); font-size: 13px; letter-spacing: 0.16em;
101
+ color: var(--text-mute); text-transform: uppercase; margin-bottom: 22px; }
102
+ .hub-tagline { font-family: var(--sans); font-size: 16px; color: var(--text-mute);
103
+ line-height: 1.6; max-width: 720px; margin: 0 auto 22px auto; }
104
+
105
+ .hub-meta { display: inline-flex; gap: 28px; padding: 14px 24px;
106
+ border: 1px solid var(--border); border-radius: 999px;
107
+ background: rgba(255,255,255,0.02); }
108
+ .hub-meta .item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
109
+ .hub-meta .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em;
110
+ color: var(--text-dim); text-transform: uppercase; }
111
+ .hub-meta .v { font-family: var(--sans); font-size: 14px; font-weight: 700; color: var(--text); }
112
+ .hub-meta .v.italic { font-family: var(--serif); font-style: italic; }
113
+
114
+ /* PROJECT CARDS */
115
+ .project-grid {
116
+ display: grid; grid-template-columns: 1fr; gap: 18px;
117
+ }
118
+ @media (min-width: 1000px) {
119
+ .project-grid { grid-template-columns: 1fr 1fr 1fr; }
120
+ }
121
+
122
+ .project-card {
123
+ background: var(--bg-card);
124
+ border: 1px solid var(--border-strong);
125
+ border-radius: 16px;
126
+ padding: 28px 28px 24px 28px;
127
+ display: flex; flex-direction: column;
128
+ position: relative;
129
+ overflow: hidden;
130
+ transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
131
+ }
132
+ .project-card::before {
133
+ content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
134
+ background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
135
+ opacity: 0.6;
136
+ }
137
+ .project-card:hover {
138
+ transform: translateY(-4px);
139
+ border-color: var(--accent);
140
+ box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 30px var(--accent-glow);
141
+ }
142
+ .proj-red { --accent: var(--red); --accent-glow: rgba(255,42,42,0.25); }
143
+ .proj-orange { --accent: var(--orange); --accent-glow: rgba(255,140,66,0.25); }
144
+ .proj-green { --accent: var(--green); --accent-glow: rgba(31,209,96,0.22); }
145
+
146
+ .proj-icon {
147
+ width: 56px; height: 56px;
148
+ border: 1px solid var(--border-strong);
149
+ border-radius: 12px;
150
+ display: flex; align-items: center; justify-content: center;
151
+ font-size: 28px;
152
+ background: radial-gradient(60% 60% at 50% 40%, #1A1A1A 0%, #050505 100%);
153
+ margin-bottom: 16px;
154
+ }
155
+ .proj-part { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.22em;
156
+ color: var(--accent); text-transform: uppercase; margin-bottom: 6px; }
157
+ .proj-title { font-family: var(--serif); font-style: italic; font-weight: 700;
158
+ font-size: 28px; color: var(--text); line-height: 1.05; margin-bottom: 8px; }
159
+ .proj-tagline { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
160
+ color: var(--text-mute); text-transform: uppercase; line-height: 1.5; margin-bottom: 14px; }
161
+ .proj-headline { font-family: var(--sans); font-size: 14px; color: var(--text);
162
+ font-weight: 700; line-height: 1.45;
163
+ padding: 10px 12px; margin-bottom: 14px;
164
+ border-left: 2px solid var(--accent);
165
+ background: rgba(255,255,255,0.025); }
166
+ .proj-summary { font-family: var(--sans); font-size: 13.5px; color: var(--text-mute);
167
+ line-height: 1.55; margin-bottom: 20px; flex-grow: 1; }
168
+
169
+ .proj-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
170
+ .btn-primary, .btn-secondary {
171
+ flex: 1 1 auto;
172
+ display: inline-flex; align-items: center; justify-content: center; gap: 8px;
173
+ padding: 12px 16px; border-radius: 999px;
174
+ font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em;
175
+ text-transform: uppercase; font-weight: 700; text-decoration: none;
176
+ transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
177
+ white-space: nowrap;
178
+ }
179
+ .btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
180
+ .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 24px var(--accent-glow); }
181
+ .btn-secondary { background: transparent; color: var(--text-mute);
182
+ border: 1px solid var(--border-strong); }
183
+ .btn-secondary:hover { color: var(--text); border-color: var(--gold); }
184
+ .btn-icon { font-size: 12px; }
185
+
186
+ /* FOOTER */
187
+ .foot { margin-top: 32px; padding: 22px 24px;
188
+ border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); }
189
+ .foot .title { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em;
190
+ color: var(--text-dim); text-transform: uppercase; margin-bottom: 10px; }
191
+ .foot .body { font-family: var(--sans); font-size: 13px; color: var(--text-mute); line-height: 1.6; }
192
+ .foot a { color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold); }
193
+ .foot a:hover { color: var(--gold-hi); }
194
+
195
+ .gradio-container .block { background: transparent !important; border: none !important; padding: 0 !important; }
196
+ .gradio-container .form { background: transparent !important; border: none !important; }
197
+ """
198
+
199
+
200
+ def header_html() -> str:
201
+ return f"""
202
+ <div class="hub-head">
203
+ <div class="hub-eyebrow">★ Project hub</div>
204
+ <h1 class="hub-title">Second Loop</h1>
205
+ <div class="hub-sub">Three experiments on durable correction of memorized LLM errors</div>
206
+ <div class="hub-tagline">
207
+ A frozen language model that has memorized an error keeps repeating it,
208
+ even when shown the truth. The Second Loop builds a correction mechanism
209
+ that survives full process reloads, defends it against polluted memory,
210
+ and measures how rarely external truth must arrive before the whole
211
+ self-calibrating system collapses.
212
+ </div>
213
+ <div class="hub-meta">
214
+ <div class="item"><span class="k">Submitted by</span><span class="v italic">{AUTHOR}</span></div>
215
+ <div class="item"><span class="k">Base model</span><span class="v">Qwen2.5-3B-Instruct</span></div>
216
+ <div class="item"><span class="k">License</span><span class="v">MIT</span></div>
217
+ </div>
218
+ </div>
219
+ """
220
+
221
+
222
+ def card_html(p: dict) -> str:
223
+ color_cls = f"proj-{p['color']}"
224
+ return f"""
225
+ <div class="project-card {color_cls}">
226
+ <div class="proj-icon">{p['icon']}</div>
227
+ <div class="proj-part">{p['part']}</div>
228
+ <div class="proj-title">{p['title']}</div>
229
+ <div class="proj-tagline">{p['tagline']}</div>
230
+ <div class="proj-headline">{p['headline']}</div>
231
+ <div class="proj-summary">{p['summary']}</div>
232
+ <div class="proj-actions">
233
+ <a class="btn-primary" href="{p['demo_url']}" target="_blank" rel="noopener">
234
+ <span class="btn-icon">▶</span> Open demo
235
+ </a>
236
+ <a class="btn-secondary" href="{p['repo_url']}" target="_blank" rel="noopener">
237
+ <span class="btn-icon">⇲</span> GitHub
238
+ </a>
239
+ </div>
240
+ </div>
241
+ """
242
+
243
+
244
+ def grid_html() -> str:
245
+ return "<div class='project-grid'>" + "".join(card_html(p) for p in PROJECTS) + "</div>"
246
+
247
+
248
+ def footer_html() -> str:
249
+ return """
250
+ <div class="foot">
251
+ <div class="title">About this hub</div>
252
+ <div class="body">
253
+ Each of the three demo Spaces below is fully static — no model is loaded
254
+ inside any of them. All numbers and verdicts are exact outputs of the
255
+ live experimental runs, bundled into per-Space JSON files. Source code,
256
+ raw per-iteration results, and methodology documents live in the
257
+ GitHub repositories linked on every card.
258
+ </div>
259
+ </div>
260
+ """
261
+
262
+
263
+ with gr.Blocks(css=CSS, theme=gr.themes.Base(), title="Second Loop · Project hub") as demo:
264
+ gr.HTML(header_html())
265
+ gr.HTML(grid_html())
266
+ gr.HTML(footer_html())
267
+
268
+
269
+ if __name__ == "__main__":
270
+ import os
271
+ port = int(os.environ.get("GRADIO_SERVER_PORT", 7860))
272
+ demo.launch(server_name="0.0.0.0", server_port=port)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio>=4.44.0,<5