MacMind: a neural network in a HyperCard stack

MacMind is a complete transformer neural network implemented entirely in HyperTalk. Embeddings, positional encoding, self-attention, backpropagation, and gradient descent, all running inside a HyperCard stack.

The task is learning the bit-reversal permutation, the opening step of the FFT. The model discovers the pattern purely through attention and repeated trial and error. By step 193 it was already oscillating between 50%, 75%, and 100% accuracy on successive steps, settling into convergence.

The "intelligence" is 1,216 numbers stored in hidden fields. Save the stack, quit, reopen: the trained model is still there. Option-click any button and read the actual math in the script editor.

Built for HyperCard 2.1, System 7 through Mac OS 9. It's a bit slow but correct.

GitHub has a pre-trained stack, a blank stack you can train yourself, and a Python reference implementation that validates the math:

 
Ha, very cool! So your vocab size is 8? Or, 8+2 for BOS / EOS? Does it learn when to EOS from the data? I had played with porting an MNIST solution to Hypercard or native Python on OS9 but haven't gotten very far.
 
Vocab size is 10 (digits 0–9), sequence length is 8. No BOS/EOS, fixed-length sequences, so the model always knows it’s looking at exactly 8 positions. Keeps things simpler and avoids needing the model to learn when to stop.

I’d love to hear more about your MNIST work. What was the bottleneck, the image handling or the network math? HyperTalk’s floating-point is fine for the math side, the real pain is field I/O since item access is O(n) in the string length. For MacMind’s 1,216 parameters it’s manageable but MNIST’s input dimensionality (784 pixels) would make that rough.
 
Back
Top