ARotting's picture
Publish Interactive differentiable memory read-head inspector
6a2bcc7 verified
Raw History Blame Contribute Delete
9.74 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Memory Tape Pocket Lab</title>
<style>
:root { color-scheme: dark; font-family: Inter, ui-sans-serif, system-ui; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #060817; color: #edf4ff; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; opacity: .55; }
main { position: relative; z-index: 1; width: min(1080px, 92vw); margin: auto;
padding: 72px 0 96px; }
.eyebrow { color: #73e6ff; letter-spacing: .18em; text-transform: uppercase;
font-size: .75rem; font-weight: 800; }
h1 { font-size: clamp(3rem, 8vw, 7rem); line-height: .9; margin: 14px 0 24px;
background: linear-gradient(120deg,#fff,#74e7ff 55%,#b48cff);
-webkit-background-clip: text; color: transparent; }
.lead { max-width: 760px; color: #b8c7e6; font-size: 1.2rem; line-height: 1.65; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 48px; }
a { color: inherit; }
.button { padding: 12px 18px; border-radius: 999px; text-decoration: none;
background: #eaf8ff; color: #07101c; font-weight: 800; }
.button.alt { background: #171d38cc; color: #dce8ff; border: 1px solid #415078; }
.grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; }
.card { border: 1px solid #344269; background: #0c1128dd; border-radius: 24px;
padding: 24px; backdrop-filter: blur(18px); box-shadow: 0 24px 80px #0008; }
h2 { margin-top: 0; }
pre { white-space: pre-wrap; word-break: break-word; color: #a9bddf;
max-height: 520px; overflow: auto; }
ul { max-height: 520px; overflow: auto; padding-left: 1.2rem; color: #a9bddf; }
li { margin: 8px 0; }
input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid #344269;
background: #070b1a; color: white; margin-bottom: 12px; }
@media (max-width: 780px) { .grid { grid-template-columns: 1fr; } }
</style>
</head>
<body>
<canvas id="field"></canvas>
<main>
<div class="eyebrow">Jacob Garcia · Hugging Face Model Foundry</div>
<h1>Memory Tape Pocket Lab</h1>
<p class="lead">Interactive differentiable memory read-head inspector. This showcase backs up the
trained artifacts, measured evaluation, and complete runnable source.</p>
<div class="actions">
<a class="button" href="https://huggingface.co/spaces/ARotting/memory-tape-pocket-lab/tree/main">Explore every file</a>
<a class="button alt" href="https://huggingface.co/ARotting">View the full foundry</a>
</div>
<div class="grid">
<section class="card">
<h2>Verified project card</h2>
<pre># Memory Tape Pocket
Memory Tape Pocket is a compact differentiable-memory retest inspired by the
content-addressing mechanism of Neural Turing Machines. It learns random
key-value associative recall on tapes containing two to eight slots, then faces
unseen tapes with 16 and 32 slots.
The control is a larger fixed-state GRU trained on the same batches. The
interactive Space exposes the complete external tape and the learned read
weight assigned to every slot.
## Verified result
Across three independent training seeds, the 4,673-parameter content-addressed
model achieved **100% exact recall** on 8-, 16-, and 32-slot tapes. At 32 slots,
four times the maximum training length, its read head placed **99.974%** of its
attention on the correct slot.
The larger 5,584-parameter fixed-state GRU reached 13.51% accuracy at eight
slots, 7.66% at 16 slots, and **4.60% at 32 slots**. This benchmark isolates the
inductive bias of external content addressing; it does not claim the tiny model
implements every component of a full Neural Turing Machine.
```bash
uv run python projects/memory-tape-pocket/train.py
uv run pytest tests/test_memory_tape_pocket.py
```
</pre>
<h2>Evaluation snapshot</h2>
<pre>{
&quot;experiment&quot;: &quot;Differentiable content addressing versus fixed-state recall&quot;,
&quot;training_slots&quot;: [
2,
8
],
&quot;results&quot;: {
&quot;memory&quot;: {
&quot;parameters&quot;: 4673,
&quot;runs&quot;: [
{
&quot;seed&quot;: 2281,
&quot;slots_8&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.9999377218191512
},
&quot;slots_16&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.9998665036546299
},
&quot;slots_32&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.9997205645777285
}
},
{
&quot;seed&quot;: 2287,
&quot;slots_8&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.9999373428727267
},
&quot;slots_16&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.9998682647856185
},
&quot;slots_32&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.999723744156654
}
},
{
&quot;seed&quot;: 2293,
&quot;slots_8&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.9999510854540858
},
&quot;slots_16&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.9998970205051592
},
&quot;slots_32&quot;: {
&quot;accuracy&quot;: 1.0,
&quot;examples&quot;: 4096,
&quot;mean_attention_on_correct_slot&quot;: 0.9997834917012369
}
}
],
&quot;accuracy_mean&quot;: {
&quot;slots_8&quot;: 1.0,
&quot;slots_16&quot;: 1.0,
&quot;slots_32&quot;: 1.0
},
&quot;correct_slot_attention_mean&quot;: {
&quot;slots_8&quot;: 0.9999420500486546,
&quot;slots_16&quot;: 0.9998772629818026,
&quot;slots_32&quot;: 0.9997426001452064
}
},
&quot;gru&quot;: {
&quot;parameters&quot;: 5584,
&quot;runs&quot;: [
{
&quot;seed&quot;: 2281,
&quot;slots_8&quot;: {
&quot;accuracy&quot;: 0.132080078125,
&quot;examples&quot;: 4096
},
&quot;slots_16&quot;: {
&quot;accuracy&quot;: 0.083984375,
&quot;examples&quot;: 4096
},
&quot;slots_32&quot;: {
&quot;accuracy&quot;: 0.044677734375,
&quot;examples&quot;: 4096
}
},
{
&quot;seed&quot;: 2287,
&quot;slots_8&quot;: {
&quot;accuracy&quot;: 0.135009765625,
&quot;examples&quot;: 4096
},
&quot;slots_16&quot;: {
&quot;accuracy&quot;: 0.0703125,
&quot;examples&quot;: 4096
},
&quot;slots_32&quot;: {
&quot;accuracy&quot;: 0.046142578125,
&quot;examples&quot;: 4096
}
},
{
&quot;seed&quot;: 2293,
&quot;slots_8&quot;: {
&quot;accuracy&quot;: 0.13818359375,
&quot;examples&quot;: 4096
},
&quot;slots_16&quot;: {
&quot;accuracy&quot;: 0.075439453125,
&quot;examples&quot;: 4096
},
&quot;slots_32&quot;: {
&quot;accuracy&quot;: 0.047119140625,
&quot;examples&quot;: 4096
}
}
],
&quot;accuracy_mean&quot;: {
&quot;slots_8&quot;: 0.13509114583333334,
&quot;slots_16&quot;: 0.07657877604166667,
&quot;slots_32&quot;: 0.045979817708333336
}
}
}
}</pre>
</section>
<section class="card">
<h2>Backed-up artifact tree</h2>
<input id="filter" placeholder="Filter files…" autocomplete="off">
<ul id="files"><li><code>README.md</code></li>
<li><code>__pycache__/app.cpython-311.pyc</code></li>
<li><code>__pycache__/model.cpython-311.pyc</code></li>
<li><code>__pycache__/train.cpython-311.pyc</code></li>
<li><code>app.py</code></li>
<li><code>artifacts/memory-tape-pocket/content_memory.safetensors</code></li>
<li><code>artifacts/memory-tape-pocket/evaluation.json</code></li>
<li><code>artifacts/memory-tape-pocket/fixed_gru.safetensors</code></li>
<li><code>model.py</code></li>
<li><code>requirements.txt</code></li>
<li><code>train.py</code></li></ul>
</section>
</div>
</main>
<script>
const canvas=document.querySelector('#field'),ctx=canvas.getContext('2d');
let dots=[];
function resize(){canvas.width=innerWidth;canvas.height=innerHeight;
dots=Array.from({length:90},()=>({x:Math.random()*innerWidth,
y:Math.random()*innerHeight,vx:(Math.random()-.5)*.35,vy:(Math.random()-.5)*.35}));}
function draw(){ctx.clearRect(0,0,canvas.width,canvas.height);
for(const d of dots){d.x=(d.x+d.vx+innerWidth)%innerWidth;
d.y=(d.y+d.vy+innerHeight)%innerHeight;ctx.fillStyle='#65dcff99';
ctx.beginPath();ctx.arc(d.x,d.y,1.4,0,7);ctx.fill();}requestAnimationFrame(draw);}
addEventListener('resize',resize);resize();draw();
document.querySelector('#filter').addEventListener('input',e=>{
const q=e.target.value.toLowerCase();for(const li of document.querySelectorAll('li'))
li.hidden=!li.textContent.toLowerCase().includes(q);});
</script>
</body>
</html>