[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74253":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":15,"starSnapshotCount":15,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},74253,"no-magic","no-magic-ai\u002Fno-magic","no-magic-ai","Because `model.fit()` isn't an explanation","https:\u002F\u002Fno-magic-ai.github.io\u002F",null,"Python",1345,105,5,0,8,10,31,24,19.08,"MIT License",false,"main",[25,26,27,28],"ai-algorithms","algorithms","no-dependencies","open-soruce","2026-06-12 02:03:24","[![no-magic](.\u002Fassets\u002Fbanner.png)](https:\u002F\u002Fgithub.com\u002Fno-magic-ai\u002Fno-magic)\n\n---\n\n![Python 3.10+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.10%2B-blue?style=flat-square&logo=python&logoColor=white)\n![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fno-magic-ai\u002Fno-magic?style=flat-square)\n![Algorithms](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Falgorithms-48-orange?style=flat-square)\n![Version](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-v2.0.0-blue?style=flat-square)\n![Zero Dependencies](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdependencies-zero-brightgreen?style=flat-square)\n![PRs Welcome](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPRs-welcome-brightgreen?style=flat-square)\n![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fno-magic-ai\u002Fno-magic?style=flat-square)\n![Last Commit](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flast-commit\u002Fno-magic-ai\u002Fno-magic?style=flat-square)\n![CI](https:\u002F\u002Fgithub.com\u002Fno-magic-ai\u002Fno-magic\u002Factions\u002Fworkflows\u002Fverify.yml\u002Fbadge.svg)\n\n---\n\n# no-magic\n\n**Because `model.fit()` isn't an explanation.**\n\n\u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Ff107ed4c-6905-4063-b3f6-a4a3c2f16c8e\" width=\"100%\" autoplay loop muted playsinline>\u003C\u002Fvideo>\n\n---\n\n## What This Is\n\n`no-magic` is a curated collection of single-file, dependency-free Python implementations of the algorithms that power modern AI. Each script is a complete, runnable program that trains a model from scratch and performs inference — no frameworks, no abstractions, no hidden complexity.\n\nEvery script in this repository is an **executable proof** that these algorithms are simpler than the industry makes them seem. The goal is not to replace PyTorch or TensorFlow — it's to make you dangerous enough to understand what they're doing underneath.\n\n## See It In Action\n\n\u003Cdetails open>\n\u003Csummary>\u003Ch3>01 — Foundations (14 scripts)\u003C\u002Fh3>\u003C\u002Fsummary>\n\u003Ctable>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrogpt.py\">\u003Cb>Autoregressive GPT\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrogpt.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Token-by-token generation\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrornn.py\">\u003Cb>RNN vs GRU\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrornn.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Vanishing gradients and gating\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrolstm.py\">\u003Cb>LSTM\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrolstm.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>4-gate memory highway\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrotokenizer.py\">\u003Cb>BPE Tokenizer\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrotokenizer.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Iterative pair merging → vocabulary\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicroembedding.py\">\u003Cb>Word Embeddings\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroembedding.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Contrastive learning → semantic clusters\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrorag.py\">\u003Cb>RAG Pipeline\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrorag.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Retrieve → augment → generate\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrobert.py\">\u003Cb>BERT\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrobert.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Bidirectional attention + [MASK] prediction\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicroconv.py\">\u003Cb>Convolutional Net\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroconv.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Sliding kernels → feature maps\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicroresnet.py\">\u003Cb>ResNet\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroresnet.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>F(x) + x = gradient highway\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrovit.py\">\u003Cb>Vision Transformer\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrovit.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Image patches as tokens\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrodiffusion.py\">\u003Cb>Diffusion\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrodiffusion.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Noise → data via iterative denoising\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrovae.py\">\u003Cb>VAE\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrovae.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Encode → sample z → decode\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrogan.py\">\u003Cb>GAN\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrogan.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Generator vs discriminator minimax\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"01-foundations\u002Fmicrooptimizer.py\">\u003Cb>Optimizers\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrooptimizer.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>SGD vs Momentum vs Adam convergence\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n**Comparison scripts:** [attention_vs_none.py](01-foundations\u002Fattention_vs_none.py) · [rnn_vs_gru_vs_lstm.py](01-foundations\u002Frnn_vs_gru_vs_lstm.py)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Ch3>02 — Alignment & Training (10 scripts)\u003C\u002Fh3>\u003C\u002Fsummary>\n\u003Ctable>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicrolora.py\">\u003Cb>LoRA Fine-tuning\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrolora.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Low-rank weight injection\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicroqlora.py\">\u003Cb>QLoRA\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroqlora.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>4-bit base + full-precision adapters\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicrodpo.py\">\u003Cb>DPO Alignment\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrodpo.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Preferred vs. rejected → policy update\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicroppo.py\">\u003Cb>PPO (RLHF)\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroppo.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Clipped policy gradient for alignment\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicrogrpo.py\">\u003Cb>GRPO\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrogrpo.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Group-relative rewards, no critic\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicroreinforce.py\">\u003Cb>REINFORCE\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroreinforce.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Log P(a) × reward = gradient\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicromoe.py\">\u003Cb>Mixture of Experts\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicromoe.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Sparse routing to specialist MLPs\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicrobatchnorm.py\">\u003Cb>Batch Normalization\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrobatchnorm.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Normalize activations → stable training\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"02-alignment\u002Fmicrodropout.py\">\u003Cb>Dropout\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrodropout.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Kill neurons → prevent overfitting\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n**Comparison scripts:** [adam_vs_sgd.py](02-alignment\u002Fadam_vs_sgd.py)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Ch3>03 — Systems & Inference (17 scripts)\u003C\u002Fh3>\u003C\u002Fsummary>\n\u003Ctable>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicroattention.py\">\u003Cb>Attention Mechanism\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroattention.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Q·K\u003Csup>T\u003C\u002Fsup> → softmax → weighted V\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicroflash.py\">\u003Cb>Flash Attention\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroflash.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Tiled O(N) memory computation\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrorope.py\">\u003Cb>RoPE\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrorope.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Position via rotation matrices\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrokv.py\">\u003Cb>KV-Cache\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrokv.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Memoize keys\u002Fvalues — stop recomputing\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicropaged.py\">\u003Cb>PagedAttention\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicropaged.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>OS-style paged KV-cache memory\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicroquant.py\">\u003Cb>Quantization\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroquant.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Float32 → Int8 = 4x compression\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrobeam.py\">\u003Cb>Beam Search\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrobeam.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Tree search with top-k pruning\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrocheckpoint.py\">\u003Cb>Checkpointing\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrocheckpoint.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>O(n) → O(√n) memory via recompute\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicroparallel.py\">\u003Cb>Model Parallelism\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroparallel.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Tensor + pipeline across devices\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrossm.py\">\u003Cb>State Space Models\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrossm.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Linear-time selective state transitions\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrovectorsearch.py\">\u003Cb>Vector Search\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrovectorsearch.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Exact vs LSH approximate search\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrobm25.py\">\u003Cb>BM25\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrobm25.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>TF → TF-IDF → BM25 evolution\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrospeculative.py\">\u003Cb>Speculative Decoding\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrospeculative.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Draft fast, verify once\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrocomplexssm.py\">\u003Cb>Complex SSM\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrocomplexssm.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Complex eigenvalues = real + RoPE\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicrodiscretize.py\">\u003Cb>Discretization\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrodiscretize.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Euler vs ZOH vs Trapezoidal\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicroroofline.py\">\u003Cb>Roofline Model\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroroofline.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>SISO → MIMO hardware utilization\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"03-systems\u002Fmicroturboquant.py\">\u003Cb>TurboQuant\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroturboquant.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Data-oblivious quantization via random rotation\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Ch3>04 — Agents & Planning (5 scripts)\u003C\u002Fh3>\u003C\u002Fsummary>\n\u003Ctable>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"04-agents\u002Fmicromcts.py\">\u003Cb>Monte Carlo Tree Search\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicromcts.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>UCB1 tree search + random rollouts\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"04-agents\u002Fmicroreact.py\">\u003Cb>ReAct Agent\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicroreact.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Thought → Action → Observation\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"04-agents\u002Fmicrobandit.py\">\u003Cb>Multi-Armed Bandits\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrobandit.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>ε-greedy vs UCB1 vs Thompson Sampling\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd align=\"center\">\u003Ca href=\"04-agents\u002Fmicrominimax.py\">\u003Cb>Minimax + Alpha-Beta\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicrominimax.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Adversarial search with pruning\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd align=\"center\">\u003Ca href=\"04-agents\u002Fmicromemory.py\">\u003Cb>Memory-Augmented Network\u003C\u002Fb>\u003C\u002Fa>\u003Cbr\u002F>\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fno-magic-ai\u002Fno-magic-viz\u002Fmain\u002Fpreviews\u002Fmicromemory.gif\" width=\"280\"\u002F>\u003Cbr\u002F>\n\u003Csub>Differentiable read\u002Fwrite heads\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003C\u002Fdetails>\n\n> All algorithms have animated visualizations. Full 1080p60 videos in [Releases](https:\u002F\u002Fgithub.com\u002Fno-magic-ai\u002Fno-magic\u002Freleases).\n> Visualization source and rendering: [no-magic-viz](https:\u002F\u002Fgithub.com\u002Fno-magic-ai\u002Fno-magic-viz) — built with [Manim](https:\u002F\u002Fwww.manim.community\u002F).\n\n## Philosophy\n\nModern ML education has a gap. There are thousands of tutorials that teach you to call library functions, and there are academic papers full of notation. What's missing is the middle layer: **the algorithm itself, expressed as readable code**.\n\nThis project follows a strict set of constraints:\n\n- **One file, one algorithm.** Every script is completely self-contained. No imports from local modules, no `utils.py`, no shared libraries.\n- **Zero external dependencies.** Only Python's standard library. If it needs `pip install`, it doesn't belong here.\n- **Train and infer.** Every script includes both the learning loop and generation\u002Fprediction. You see the full lifecycle.\n- **Runs in minutes on a CPU.** No GPU required. No cloud credits. Every script completes on a laptop in reasonable time.\n- **Comments are mandatory, not decorative.** Every script must be readable as a guided walkthrough of the algorithm. We are not optimizing for line count — we are optimizing for understanding. See `CONTRIBUTING.md` for the full commenting standard.\n\n## Who This Is For\n\n- **ML engineers** who use frameworks daily but want to understand the internals they rely on.\n- **Students** transitioning from theory to practice who want to see algorithms as working code, not just equations.\n- **Career switchers** entering ML who need intuition for what's actually happening when they call high-level APIs.\n- **Researchers** who want minimal reference implementations to prototype ideas without framework overhead.\n- **Anyone** who has ever stared at a library call and thought: _\"but what is it actually doing?\"_\n\nThis is not a beginner's introduction to programming. You should be comfortable reading Python and have at least a surface-level familiarity with ML concepts. The scripts will give you the depth.\n\n## What You'll Find Here\n\nThe repository is organized into four tiers based on conceptual dependency:\n\n### 01 — Foundations (14 scripts)\n\nCore algorithms that form the building blocks of modern AI systems. GPT, RNN, LSTM, BERT, CNN, ResNet, ViT, GAN, VAE, diffusion, embeddings, tokenization, RAG, and optimizer comparison. Includes comparison scripts for attention mechanisms and recurrent architectures.\n\nSee [`01-foundations\u002FREADME.md`](01-foundations\u002FREADME.md) for the full algorithm list, timing data, and roadmap.\n\n### 02 — Alignment & Training Techniques (10 scripts)\n\nMethods for steering, fine-tuning, and aligning models after pretraining. LoRA, QLoRA, DPO, PPO, GRPO, REINFORCE, MoE, batch normalization, dropout\u002Fregularization, and optimizer comparison.\n\nSee [`02-alignment\u002FREADME.md`](02-alignment\u002FREADME.md) for the full algorithm list, timing data, and roadmap.\n\n### 03 — Systems & Inference (17 scripts)\n\nThe engineering that makes models fast, small, and deployable. Attention variants, Flash Attention, KV-cache, PagedAttention, RoPE, quantization, beam search, checkpointing, parallelism, SSMs, vector search, BM25, speculative decoding, complex SSM equivalence, discretization methods, and roofline analysis.\n\nSee [`03-systems\u002FREADME.md`](03-systems\u002FREADME.md) for the full algorithm list, timing data, and roadmap.\n\n### 04 — Agents & Planning (5 scripts)\n\nAutonomous reasoning and decision-making. Monte Carlo Tree Search for strategic planning, ReAct agents for tool-augmented reasoning loops, multi-armed bandits for exploration\u002Fexploitation, minimax with alpha-beta pruning for adversarial search, and memory-augmented networks for persistent agent memory.\n\nSee [`04-agents\u002FREADME.md`](04-agents\u002FREADME.md) for the full algorithm list, timing data, and roadmap.\n\n## How to Use This Repo\n\n```bash\n# Clone the repository\ngit clone https:\u002F\u002Fgithub.com\u002Fno-magic-ai\u002Fno-magic.git\ncd no-magic\n\n# Pick any script and run it\npython 01-foundations\u002Fmicrogpt.py\n```\n\nThat's it. No virtual environments, no dependency installation, no configuration. Each script will download any small datasets it needs on first run.\n\n### Minimum Requirements\n\n- Python 3.10+\n- 8 GB RAM\n- Any modern CPU (2019-era or newer)\n\n### Quick Start Path\n\nIf you're working through the scripts systematically, this subset builds core concepts incrementally:\n\n```text\nmicrotokenizer.py     → How text becomes numbers\nmicroembedding.py     → How meaning becomes geometry\nmicrogpt.py           → How sequences become predictions\nmicrornn.py           → How recurrence models sequences\nmicrolstm.py          → How gated memory solves vanishing gradients\nmicrobert.py          → How bidirectional context differs from autoregressive\nmicroconv.py          → How spatial filters extract features\nmicrovit.py           → How transformers see images\nmicrobatchnorm.py     → How normalizing activations stabilizes training\nmicrolora.py          → How fine-tuning works efficiently\nmicrodpo.py           → How preference alignment works\nmicroattention.py     → How attention actually works (all variants)\nmicrorope.py          → How position gets encoded through rotation\nmicroquant.py         → How models get compressed\nmicroflash.py         → How attention gets fast\nmicrossm.py           → How Mamba models bypass attention entirely\nmicrodiscretize.py    → How discretization shapes what SSMs can learn\nmicrocomplexssm.py    → How complex eigenvalues enable rotation (parity)\nmicroroofline.py      → Why more FLOPs can be faster (SISO → MIMO)\nmicroreact.py         → How agents reason with tools\n```\n\nEach tier's README has the full algorithm list with measured run times for that category.\n\n## Learning Resources\n\n### Challenges\n\n\"Predict the behavior\" exercises that test your understanding of the algorithms. 21 challenges covering all 4 tiers — attention, GPT, GAN, DPO, optimizers, discretization, complex SSMs, roofline, tokenizer, embedding, RNN, VAE, LoRA, PPO, MoE, KV-cache, quantization, TurboQuant, SSM, MCTS, and ReAct. Each challenge presents a code snippet and asks you to reason about the output before running it.\n\nSee [`challenges\u002FREADME.md`](challenges\u002FREADME.md) for the full challenge set.\n\n### Flashcards\n\nAnki-compatible flashcard decks for spaced repetition review. 190 cards across 4 tiers (foundations, alignment, systems, agents), covering key concepts, equations, and design decisions from every script.\n\n```bash\n# Generate the Anki deck\npython resources\u002Fflashcards\u002Fgenerate_anki.py\n```\n\nSee [`resources\u002Fflashcards\u002F`](resources\u002Fflashcards\u002F) for the raw card data and generation script.\n\n### Learning Path\n\nStructured tracks for different goals — 7 learning tracks ranging from weekend sprints to a full curriculum. Each track orders scripts by conceptual dependency and includes time estimates, prerequisites, and milestone markers.\n\nSee [`LEARNING_PATH.md`](LEARNING_PATH.md) for the full guide.\n\n### Offline Book (EPUB)\n\nAll 48 scripts compiled into a single EPUB with table of contents, thesis excerpts, tradeoff sections, and full annotated source. Readable on any e-reader, tablet, or phone.\n\n```bash\n# Requires pandoc: brew install pandoc (macOS) or apt install pandoc\nbash scripts\u002Fgenerate-epub.sh\n# Output: build\u002Fno-magic.epub\n```\n\nA pre-built copy is included in every [release](https:\u002F\u002Fgithub.com\u002Fno-magic-ai\u002Fno-magic\u002Freleases).\n\n## Translations\n\nComment translations for 6 languages: Spanish, Portuguese, Chinese, Japanese, Korean, and Hindi. The code stays in English — only comments, docstrings, section headers, and print statements are translated.\n\nSee [`TRANSLATIONS.md`](TRANSLATIONS.md) for full status and contributor guide.\n\nWant to help translate? See the [translation guide](translations\u002FREADME.md).\n\n## Dependency Graph\n\nHow the algorithms connect conceptually. Arrows mean \"understanding A helps with B\" — not code imports (every script is fully self-contained).\n\n```mermaid\ngraph LR\n  %% --- Style definitions ---\n  classDef foundations fill:#4a90d9,stroke:#2c5f8a,color:#fff\n  classDef alignment fill:#e8834a,stroke:#b35f2e,color:#fff\n  classDef systems fill:#5bb55b,stroke:#3a823a,color:#fff\n  classDef agents fill:#9b59b6,stroke:#7d3c98,color:#fff\n\n  %% === 01-FOUNDATIONS ===\n  subgraph F[\"01 — Foundations\"]\n    TOK[\"Tokenizer\"]\n    EMB[\"Embedding\"]\n    OPT[\"Optimizer\"]\n    RNN[\"RNN \u002F GRU\"]\n    CONV[\"Conv Net\"]\n    GPT[\"GPT\"]\n    BERT[\"BERT\"]\n    RAG[\"RAG\"]\n    DIFF[\"Diffusion\"]\n    VAE[\"VAE\"]\n    GAN[\"GAN\"]\n  end\n\n  %% === 02-ALIGNMENT ===\n  subgraph A[\"02 — Alignment\"]\n    BN[\"BatchNorm\"]\n    DROP[\"Dropout\"]\n    LORA[\"LoRA\"]\n    QLORA[\"QLoRA\"]\n    DPO[\"DPO\"]\n    REINF[\"REINFORCE\"]\n    PPO[\"PPO\"]\n    GRPO[\"GRPO\"]\n    MOE[\"MoE\"]\n  end\n\n  %% === 04-AGENTS ===\n  subgraph AG[\"04 — Agents\"]\n    MCTS[\"MCTS\"]\n    REACT[\"ReAct\"]\n  end\n\n  %% === 03-SYSTEMS ===\n  subgraph S[\"03 — Systems\"]\n    ATTN[\"Attention\"]\n    FLASH[\"Flash Attn\"]\n    ROPE[\"RoPE\"]\n    KV[\"KV-Cache\"]\n    PAGED[\"PagedAttn\"]\n    QUANT[\"Quantization\"]\n    BEAM[\"Beam Search\"]\n    CKPT[\"Checkpointing\"]\n    PAR[\"Parallelism\"]\n    SSM[\"SSM \u002F Mamba\"]\n    CSSM[\"Complex SSM\"]\n    DISC[\"Discretize\"]\n    ROOF[\"Roofline\"]\n    TURBO[\"TurboQuant\"]\n  end\n\n  %% --- Foundation internals ---\n  TOK --> GPT\n  EMB --> RAG\n  RNN --> GPT\n  OPT --> GPT\n  GPT --> BERT\n  DIFF -.-> VAE\n  DIFF -.-> GAN\n\n  %% --- Foundations → Alignment ---\n  GPT --> LORA\n  GPT --> DPO\n  GPT --> PPO\n  GPT --> MOE\n  GPT --> GRPO\n  LORA --> QLORA\n  REINF --> PPO\n  REINF --> GRPO\n  OPT --> BN\n  OPT --> DROP\n\n  %% --- Foundations → Systems ---\n  GPT --> ATTN\n  GPT --> KV\n  GPT --> QUANT\n  GPT --> BEAM\n  GPT --> SSM\n  RNN --> SSM\n  ATTN --> FLASH\n  ATTN --> ROPE\n  KV --> PAGED\n\n  %% --- SSM family connections ---\n  SSM --> CSSM\n  SSM --> DISC\n  SSM --> ROOF\n  ROPE -.-> CSSM\n  FLASH -.-> ROOF\n\n  %% --- Cross-tier into QLoRA ---\n  QUANT --> QLORA\n\n  %% --- Quantization family ---\n  QUANT --> TURBO\n  EMB -.-> TURBO\n\n  %% --- Foundations \u002F Alignment → Agents ---\n  REINF --> REACT\n  GPT --> REACT\n\n  %% --- Apply styles ---\n  class TOK,EMB,OPT,RNN,CONV,GPT,BERT,RAG,DIFF,VAE,GAN foundations\n  class BN,DROP,LORA,QLORA,DPO,REINF,PPO,GRPO,MOE alignment\n  class ATTN,FLASH,ROPE,KV,PAGED,QUANT,BEAM,CKPT,PAR,SSM,CSSM,DISC,ROOF,TURBO systems\n  class MCTS,REACT agents\n```\n\n**Legend:** \u003Cspan style=\"color:#4a90d9\">Foundations\u003C\u002Fspan> · \u003Cspan style=\"color:#e8834a\">Alignment\u003C\u002Fspan> · \u003Cspan style=\"color:#5bb55b\">Systems\u003C\u002Fspan> · \u003Cspan style=\"color:#9b59b6\">Agents\u003C\u002Fspan> — Solid arrows = strong prerequisite, dashed arrows = conceptual comparison.\n\n## Related Projects\n\n- [micrograd](https:\u002F\u002Fgithub.com\u002Fkarpathy\u002Fmicrograd) — Karpathy's autograd engine. The `Value` class in `microgpt.py` descends from this.\n- [makemore](https:\u002F\u002Fgithub.com\u002Fkarpathy\u002Fmakemore) — Character-level language modeling. `micrornn.py` covers similar ground in a single comparative file.\n\n## Inspiration & Attribution\n\nThis project is directly inspired by [Andrej Karpathy's](https:\u002F\u002Fgithub.com\u002Fkarpathy) extraordinary work on minimal implementations — particularly [micrograd](https:\u002F\u002Fgithub.com\u002Fkarpathy\u002Fmicrograd), [makemore](https:\u002F\u002Fgithub.com\u002Fkarpathy\u002Fmakemore), and the `microgpt.py` script that demonstrated the entire GPT algorithm in a single dependency-free Python file.\n\nKarpathy proved that there's enormous demand for \"the algorithm, naked.\" `no-magic` extends that philosophy across the full landscape of modern AI\u002FML.\n\n## How This Was Built\n\nIn the spirit of transparency: this repository was co-authored with Claude (Anthropic). I designed the project — which algorithms to include, the four-tier structure, the constraint system, the learning paths, and how each script should be organized — then directed the implementations and verified that every script trains and infers correctly end-to-end on CPU.\n\nThe scope goes beyond code. The animated visualizations (Manim scenes), predict-the-behavior challenges, Anki flashcards, learning path tracks, EPUB generation pipeline, and translation infrastructure were all designed collaboratively — I set the requirements and structure, Claude helped execute. Every artifact was reviewed and validated.\n\nI'm not claiming to have hand-typed every algorithm from scratch. The value of this project is in the curation, the architectural decisions, and the fact that everything works as a self-contained learning resource — from the scripts themselves to the supporting materials that help you internalize what they teach.\n\nThis is how I build in 2026. I'd rather be upfront about it.\n\n## Star History\n\n\u003Ca href=\"https:\u002F\u002Fwww.star-history.com\u002F?repos=Mathews-Tom%2Fno-magic&type=date&legend=top-left\">\n \u003Cpicture>\n   \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fimage?repos=no-magic-ai\u002Fno-magic&type=date&theme=dark&legend=top-left&v=2&new=2\" \u002F>\n   \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fimage?repos=no-magic-ai\u002Fno-magic&type=date&legend=top-left&v=2&new=2\" \u002F>\n   \u003Cimg alt=\"Star History Chart\" src=\"https:\u002F\u002Fapi.star-history.com\u002Fimage?repos=no-magic-ai\u002Fno-magic&type=date&legend=top-left&v=2&new=2\" \u002F>\n \u003C\u002Fpicture>\n\u003C\u002Fa>\n\n## Contributing\n\nContributions are welcome, but the constraints are non-negotiable. See `CONTRIBUTING.md` for the full guidelines. The short version:\n\n- One file. Zero dependencies. Trains and infers.\n- If your PR adds a `requirements.txt`, it will be closed.\n- Quality over quantity. Each script should be the **best possible** minimal implementation of its algorithm.\n\n## License\n\nMIT — use these however you want. Learn from them, teach with them, build on them.\n\n---\n\n_The constraint is the product. Everything else is just efficiency._\n\n_v2.0.0 — March 2026_\n","`no-magic`是一个无依赖的Python项目，旨在通过单文件实现现代AI算法，从头开始训练模型并进行推理。其核心功能包括自回归GPT、RNN与GRU对比、LSTM以及BPE分词器等基础算法的纯Python实现，不使用任何框架或抽象层，确保代码简洁且易于理解。该项目特别适合希望深入了解机器学习和深度学习背后原理的学习者、开发者以及教育工作者使用，帮助他们揭开这些技术看似复杂的面纱，从而更自信地应用现有的高级工具如PyTorch或TensorFlow。",2,"2026-06-11 03:49:41","high_star"]