Show HN: MacMind – A transformer neural network in HyperCard on a 1989 Macintosh
TL;DR Highlight
This is an educational project implementing a single-layer Transformer with 1,216 parameters in the scripting language HyperTalk (1987) and training it on a real Macintosh SE/30. It demonstrates that the core mathematics of modern LLMs works the same on hardware from 30 years ago.
Who Should Read
Developers or beginners in AI who want to deeply understand the internal workings of Transformers and backpropagation visually and at the code level. Particularly suitable for those who want to dissect all the formulas without a black box.
Core Mechanics
- This project implements a complete Transformer neural network in HyperTalk (a scripting language for HyperCard created in 1987). It operates with pure scripts without compiled code or external libraries, despite not being designed for matrix operations.
- The model size is a single-layer, single-head Transformer with 1,216 parameters. While extremely small compared to GPT-4's approximately 1 trillion parameters, the mathematics of the training loop – forward pass → loss calculation → backward pass → weight update – is completely identical.
- The learning task is bit-reversal permutation, the first step of the Fast Fourier Transform (FFT), which rearranges the order by reversing the binary representation of each position index. For example, in a sequence of 8 elements, position 1 (001) moves to position 4 (100).
- The implementation includes token embedding (converting tokens to vectors), positional encoding (adding positional information), scaled dot-product self-attention (query-key-value based attention), cross-entropy loss, complete backpropagation, and stochastic gradient descent.
- You can directly see the actual formula code behind the buttons by Option-clicking in HyperCard's script editor. Learning rate changes, task replacements, and model size adjustments can all be done directly within the GUI, clearly demonstrating its purpose as a learning tool.
- The purpose of the creation is to prove that 'AI is not magic, but mathematics'. It conveys the message that the mathematics is the same whether backpropagation and attention run on a TPU cluster or a 1987 68000 processor.
- It was actually trained on a 1989 Macintosh SE/30, and a validation script written in Python (validate.py) is also provided.
Evidence
- There was a reaction that driving modern AI ideas on old hardware (like this project or running LLM inference on Windows 3.1) 'reminds us that progress is not just about bigger GPUs and more computing, but about smarter mathematics and algorithms'. It is considered closer to the spirit of early computing than the current trend of 'throwing hardware at the problem'.
- Someone who first studied backpropagation in 1988 and simultaneously fell in love with HyperCard programming reminisced, saying 'this project evokes the elegant tools of that era'.
- Information was shared that it can be run in the HyperCard Simulator (hcsimulator.com). It works well enough in the simulator even without XCMD (external compile command), and a directly imported link (https://hcsimulator.com/imports/MacMind---Trained-69E0132C) was provided.
- There was a comment asking where the source code of the actual HyperCard stack (.img file) is, as only the Python validation script is in the GitHub repository. This reflects the interest of developers who want to see the HyperTalk code directly.
- There was a philosophical comment that 'modern concepts are modern simply because no one thought of them at the time', and that this project feels like delivering germ theory to ancient Greece. It provides context that technological advancement is the advancement of means of implementation rather than the invention of fundamental concepts.
How to Apply
- If you want to study the mathematics of Transformer attention and backpropagation not in theory but in actual working code, open MacMind directly in the HyperCard Simulator (hcsimulator.com) and step through the formula implementation code by Option-clicking each button. It is implemented with pure formulas without external libraries, allowing for a clear understanding of the concepts.
- When explaining the Transformer learning process to junior developers or non-ML backend developers, you can use MacMind's learning task (bit-reversal permutation) and 1,216 parameter model as an example to intuitively explain the 'forward pass → loss → backward pass → weight update' loop.
- If you want to quickly experiment with the impact of hyperparameters such as learning rate and model size, you can modify the values in the HyperCard script editor and rerun. The experimental environment is completely transparent, making it easy to track the impact of each change on the results.
Terminology
Related Papers
Is One Layer Enough? A Single Transformer Layer Matches Full-Parameter RL Train
LLM의 RL 후처리 학습(post-training)에서 성능 향상의 대부분이 중간 레이어 소수에 집중되며, 단 하나의 레이어만 학습해도 전체 파라미터 학습과 비슷하거나 더 나은 결과를 낼 수 있다는 연구 결과. 이는 RL 학습 비용을 대폭 줄일 수 있는 가능성을 시사한다.
Knowledge Distillation of Black-Box Large Language Models (2024)
GPT-4 같은 내부 구조에 접근할 수 없는 독점 LLM에서 작은 모델로 지식을 효과적으로 전달하는 Proxy-KD 기법을 소개하는 논문으로, 전통적인 White-Box 방식보다 성능이 높다는 점에서 주목할 만하다.
Show HN: NanoEuler – GPT-2 scale model in pure C/CUDA from scratch
PyTorch나 autograd 없이 C와 CUDA만으로 GPT-2 수준의 LLM을 처음부터 구현한 교육용 프로젝트로, 역전파·BPE 토크나이저·FlashAttention까지 직접 손으로 작성했다.
Show HN: Neural Particle Automata
고정된 격자 대신 움직이는 파티클 위에서 동작하는 Neural Cellular Automata의 확장 버전으로, 형태 생성·포인트 클라우드 분류·텍스처 합성 등 다양한 작업에서 자기조직화 동작을 학습할 수 있다.
The annotated PyTorch training loop
PyTorch 학습 루프의 각 코드 줄이 왜 그 위치에 있어야 하는지, 순서를 바꾸거나 빠뜨렸을 때 어떤 문제가 생기는지를 단계별로 설명한 심층 가이드다.
When Good Verifiers Go Bad: Self-Improving VLMs Can Regress on New Tasks
VLM 자가학습 루프에서 verifier가 특정 태스크에 맞지 않으면 학습할수록 오히려 성능이 떨어지는데, DPO 손실값은 멀쩡히 내려가서 눈치채기도 어렵다.