You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
demo: train the MNIST MLP as one append-only model table
Rewrite mnist_mlp.py so the whole model and its entire training history live in a
single append-only table model(step, layer, i, j, val): every parameter is a row
tagged by generation, and a training step appends the next generation's rows
rather than mutating anything. Each step is a single SQL statement (forward,
grad(tanh(z),z) backprop, parameter update); evaluation is SQL too (a forward
pass with ROW_NUMBER() for the argmax). Python no longer holds the weights or
computes any gradients — it only sequences the steps.
A 2-layer net can't be one recursive CTE (the recursive relation may be
referenced only once, but W1/W2 are used several times per step) and unrolling
the steps as non-recursive CTEs blows up exponentially (DataFusion inlines CTEs;
no MATERIALIZED). Materialising between steps is therefore host-driven; the thin
loop does exactly that. Reaches ~83% test accuracy over 60 steps.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments