Show HN: MacMind – A transformer neural network in HyperCard on a 1989 Macintosh
73 points
5 hours ago
| 4 comments
| github.com
| HN
I trained a transformer in HyperCard. 1,216 parameters. 1989 Macintosh. And yes, it took a while.

MacMind is a complete transformer neural network, embeddings, positional encoding, self-attention, backpropagation, and gradient descent, implemented entirely in HyperTalk, the scripting language Apple shipped with HyperCard in 1987. Every line of code is readable inside HyperCard's script editor. Option-click any button and read the actual math.

The task: learn the bit-reversal permutation, the opening step of the Fast Fourier Transform. The model has no formula to follow. It discovers the positional pattern purely through attention and repeated trial and error. By training step 193, it was oscillating between 50%, 75%, and 100% accuracy on successive steps, settling into convergence like a ball rolling into a bowl.

The whole "intelligence" is 1,216 numbers stored in hidden fields in a HyperCard stack. Save the file, quit, reopen: the trained model is still there, still correct. It runs on anything from System 7 through Mac OS 9.

As a former physics student, and the FFT is an old friend, it sits at the heart of signal processing, quantum mechanics, and wave analysis. I built this because we're at a moment where AI affects all of us but most of us don't understand what it actually does. Backpropagation and attention are math, not magic. And math doesn't care whether it's running on a TPU cluster or a 68030 from 1989.

The repo has a pre-trained stack (step 1,000), a blank stack you can train yourself, and a Python/NumPy reference implementation that validates the math.

edwin
1 hour ago
[-]
There’s something quietly impressive about getting modern AI ideas to run on old hardware (like OP's project or running LLM inference on Windows 3.1 machines). It’s easy to think all the progress is just bigger GPUs and more compute, but moments like that remind you how much of it is just more clever math and algorithms squeezing signal out of limited resources. Feels closer to the spirit of early computing than the current “throw hardware at it” narrative.
reply
hyperhello
3 hours ago
[-]
Hello, if there are no XCMDs it should work adequately in HyperCard Simulator. I am only on my phone but I took a minute to import it.

https://hcsimulator.com/imports/MacMind---Trained-69E0132C

reply
hammer32
1 hour ago
[-]
I had no idea your simulator existed. No XCMDs, correct; everything is pure HyperTalk. I just ran a few training steps and they complete in a second or two. Thank you for importing it!
reply
hyperhello
1 hour ago
[-]
I gotta ask. Your scripts have comments like -- handlers_math.hypertalk.txt at the top. Are you using some kind of build process for a stack?
reply
hammer32
1 hour ago
[-]
More of a copy-paste process. The scripts are written as .txt files in Nova on my Mac Studio, then pasted one at a time into HyperCard's script editor on the classic Mac. The files are kept separate because SimpleText has a 32 KB text limit.
reply
hyperhello
1 hour ago
[-]
As an alternative, you might consider letting Hypercard itself open the text files and 'set the script of' as needed.
reply
hammer32
11 minutes ago
[-]
Yup, that would have been easier. It's been decades since I've done anything with HyperCard. I had to re-take the built-in intro course again :)
reply
gcanyon
3 hours ago
[-]
It's strange to think how modern concepts are only modern because no one thought of them back then. This feels (to me) like the germ theory being transferred back to the ancient greeks.
reply
kdhaskjdhadjk
2 hours ago
[-]
I think it's incredible to see the potential that is still locked up in old hardware. For example the 8088 MPH demo. Amazing what he was able to do with an 8088 and CGA. All this time the hardware had that potential, but it took decades to figure out how to unlock it, long after the hardware was considered obsolete. Imagine the sort of things that might be done later down the road with hardware of 0-20 years ago if somebody really dug into it to that level.
reply
ashleyn
1 hour ago
[-]
Retro console homebrew and demoscene are all about this. There's a lot of fun stuff going on in N64 homebrew right now: https://www.youtube.com/watch?v=rNEo0aQkGnU
reply
tomcam
1 hour ago
[-]
That 8088 MPH demo is a tour de force. Which tells you that the millions of Apple laptops being bricked right now instead of being recycled could have some amazing use if it were possible to wipe them clean and reuse. Sigh.
reply
hammer32
3 hours ago
[-]
Right? Backprop was published in 1986, a year before HyperCard shipped. Attention is newer, but a small model like this was buildable.
reply
anthk
2 hours ago
[-]
Lisp is from 1960's and with s9 you can do even calculus with ease, in an interpreter small enough to fit in two floppies.

On the Greeks, Archimede almost did 'Calculus 0.9'.

reply
DetroitThrow
3 hours ago
[-]
This is very cool. Any more demos of inference output?
reply
hammer32
1 hour ago
[-]
Thanks! The quickest way to try it is the HyperCard Simulator link someone just posted in this thread: https://hcsimulator.com/imports/MacMind---Trained-69E0132C — go to the Inference card, click New Random to fill in 8 digits, then click Permute. The model predicts the bit-reversed permutation of all 8 positions. The pre-trained stack gets all inputs correct.
reply