<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Steven Li</title>
    <description>The latest articles on DEV Community by Steven Li (@slixg).</description>
    <link>https://dev.to/slixg</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4241406%2Fe0434047-92da-49cd-9558-0336387fcf8a.png</url>
      <title>DEV Community: Steven Li</title>
      <link>https://dev.to/slixg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/slixg"/>
    <language>en</language>
    <item>
      <title>I built a GPT from scratch in NumPy only – 34 notebooks, no PyTorch</title>
      <dc:creator>Steven Li</dc:creator>
      <pubDate>Thu, 12 Nov 2026 15:52:53 +0000</pubDate>
      <link>https://dev.to/slixg/i-built-a-gpt-from-scratch-in-numpy-only-34-notebooks-no-pytorch-1bjm</link>
      <guid>https://dev.to/slixg/i-built-a-gpt-from-scratch-in-numpy-only-34-notebooks-no-pytorch-1bjm</guid>
      <description>&lt;p&gt;I wanted to understand LLMs below the framework level, so I wrote a 34-chapter tutorial that starts from a single neuron and builds up to a ~10.8M-parameter GPT — tensors, computational graphs, autograd, attention, pre-training, sampling, KV cache, SFT and DPO — using nothing but NumPy. Every chapter is a runnable Jupyter Notebook, everything trains on CPU, and the book is free in English and Chinese.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How is this different from nanoGPT / micrograd?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Those projects are excellent and this book stands on their shoulders. The difference is scope and starting point: it starts from neural-network basics, builds its own tensor / autograd framework in NumPy, and only then gets to GPT — covering pre-training, sampling, KV cache, SFT and DPO in 34 self-contained notebooks. It is a textbook, not just a training script.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Book: &lt;a href="https://gptmini.github.io/from-neuron-to-gpt" rel="noopener noreferrer"&gt;https://gptmini.github.io/from-neuron-to-gpt&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Code: &lt;a href="https://github.com/gptmini/from-neuron-to-gpt" rel="noopener noreferrer"&gt;https://github.com/gptmini/from-neuron-to-gpt&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What the book covers
&lt;/h3&gt;

&lt;p&gt;Part 1 (16 chapters) introduces the fundamentals of neural networks: multilayer perceptrons, loss functions, gradient descent, autograd, learning rates, iterations, batch sizes, epochs, hidden layers, and activation functions — followed by discussions on encoding, embeddings, cross-entropy, recurrent neural networks (RNNs), the Adam optimizer, and learning rate scheduling. After completing this part, you will have built a small, working deep learning framework (&lt;code&gt;src/core&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Part 2 (18 chapters) introduces large language models (LLMs): tokens and positional embeddings; self-attention, causal attention, weighted attention, and multi-head attention; residual connections, normalization, dropout, and model persistence; sampling strategies (temperature, top-k, top-p), stopping criteria, KV caching, and batch inference; and finally, SFT and DPO data preprocessing and training.&lt;/p&gt;

&lt;p&gt;Each chapter is a self-contained, runnable Jupyter notebook, and most chapters end with practice exercises. No GPU required: the default model (context window 256, 6 Transformer modules, 6 attention heads, approximately 10.8 million parameters) can be trained on a laptop’s CPU. The training data uses Karpathy’s tinyshakespeare.&lt;/p&gt;

&lt;h3&gt;
  
  
  Who it is for
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Self-learners and career changers&lt;/strong&gt; who seeking a complete learning path rather than fragmented tutorials.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Engineers already using PyTorch&lt;/strong&gt; who cannot explain autograd or attention mechanisms in detail. You can read relevant chapters (such as autograd and KV caching) separately to reinforce your knowledge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Teachers&lt;/strong&gt; looking for experimental materials. Licensed under the MIT License, each chapter is executable and includes exercises, no GPU budget required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This book is not intended to replace PyTorch. Its purpose is to encourage you to read it before relying on any framework — so that when you actually use a framework, you’ll understand how it works under the hood. Frameworks come and go, but the underlying principles remain constant.&lt;/p&gt;

&lt;p&gt;If you find this book helpful, please star the repository; this will help others discover it. Feel free to submit issues and pull requests, especially for chapters that are unclear — that’s how this book continues to improve.&lt;/p&gt;

</description>
      <category>llm</category>
      <category>gpt</category>
      <category>transformer</category>
    </item>
  </channel>
</rss>
