Hacker GitHub

← All repos

karpathy/nanoGPT

View on GitHub ↗ ★ 64,364 Python

The simplest, fastest repository for training/finetuning medium-sized GPTs.

49 mentions on Hacker News by 48 people: 9 stories, 40 comments · first 2023-01-03 · latest 2026-09-30

Mentions per year 49 mentions · busiest year 2023 (25)
20082026
  1. …if you want to scale the experiments up at home you need to go faster. Karpathy made optimized https://github.com/karpathy/nanoGPT , but it is tuned for "8XA100 40GB node in about 4 days of training". 13s is a bit overkill here (my machine…
  2. This weekend I just cracked into nanoGPT ( https://github.com/karpathy/nanoGPT ), an older but fabulous learning exercise where you build and train a crappy shakespeare GPT with ~0.8M parameters on a cpu. Results are about what you'd…
    comment by faxmeyourcode · 2025-10-13 · in NanoChat – The best ChatGPT that $100 can buy
  3. Andrej Karpathy's Nano GPT is reasonably accessible and easy to run. https://github.com/karpathy/nanoGPT
    comment by beardyw · 2025-10-10 · in Ask HN: Build Your Own LLM?
  4. ▲ 2
    NanoGPT
    story by nothrowaways · 2025-09-17 · 0 comments
  5. …is probably the most rudimentary, only converting the characters of the input into integers. e.g. https://github.com/karpathy/nanoGPT/blob/master/data/shakesp...
  6. …artifact of a bygone era. Try HuggingFace https://github.com/huggingface/course or Karpathy's intro https://github.com/karpathy/nanoGPT
  7. …on tinystories in stead of Shakespeare. smolGPT also looks inspired by nanoGPT, also from Karpathy: https://github.com/karpathy/nanoGPT/blob/master/train.py
  8. …isn't true. Learning how to train a 124M is just as useful as a 700B, and is possible on a laptop. https://github.com/karpathy/nanoGPT
    comment by fzzzy · 2025-01-30 · in Mistral Small 3
  9. …training pipeline using Shakespeare. [1] The use case for this is learning in simple example. [1] https://github.com/karpathy/nanoGPT
  10. github has a bunch of them for years, the most known from Andrej Karpathy: https://github.com/karpathy/nanoGPT some other have MoE implemented.
  11. …try training your own GPT to have a sense for how it works. I wrote a Rust version of the famous https://github.com/karpathy/nanoGPT (which is in Python) so that I could learn how it's built. I wrote it in Rust because I wanted to improve…
    comment by airstrike · 2025-01-24 · in AI isn't going to kill the software industry
  12. …vanilla gpt from scratch with the same total embeddings size as your control. I would start with https://github.com/karpathy/nanoGPT as a baseline since you can train a toy (GPT2 sized) llm in a couple days on an a100 which are pretty easy…
    comment by mattnewton · 2024-10-24 · in Probably pay attention to tokenizers
  13. ▲ 4
    Tiny Shakespeare, of the good old char-RNN fame
    story by Bluestein · 2024-09-04 · 0 comments
  14. …I wanted to succinctly say "practically, quite a bit". Here's a good little rabbit-hole example: > https://github.com/karpathy/nanoGPT/blob/master/model.py#L45 Karpathy's nanoGPT calling flash attention by checking if…
  15. ▲ 114
    NanoGPT: The simplest, fastest repository for training medium-sized GPTs
    story by ulrischa · 2024-06-11 · 21 comments
  16. …networks (aka "multi-layer perceptron") and to more-sophisticated models like transformers (e.g. https://github.com/karpathy/nanoGPT/blob/325be85d9be8c81b436... ). It's less about combining lots of tiny local linear transformations…
    comment by nerdponx · 2024-05-14 · in GPT-4o
  17. Where is the GPT implementation in JAX? I only found this [1] in PyTorch and NumPy. [1] https://github.com/karpathy/nanoGPT
  18. …Seeing this has inspired me further to consider working on that project again at some point. [0] https://github.com/karpathy/nanoGPT [1] https://en.wikipedia.org/wiki/Trie [2] https://en.wikipedia.org/wiki/N-Triples [3]…
  19. Not sure what you mean with SLM, but https://github.com/karpathy/nanoGPT
  20. The most recent is this, which I believe was made after he left Tesla: https://github.com/karpathy/nanoGPT And it's accompanying video series: https://karpathy.ai/zero-to-hero.html Another example (although I honestly don't remember if he…
  21. ▲ 2
    Ask HN: How LLMs Learn to Be "Generative"?
    story by metalwhale · 2024-02-04 · 2 comments
  22. …there's been in LLMs, has great simple tutorials right there eg. fine-tuning GPT2 with Shakespeare: https://github.com/karpathy/nanoGPT
  23. For training from scratch, maybe a small model like https://github.com/karpathy/nanoGPT or tinyllama. Perhaps with quantization. Fine-tuning is very doable. The hard part is making a novel dataset with input output pairs. You might…
  24. …project[2] is handy if you want to dip your toe into training. 1. https://simonwillison.net/ 2. https://github.com/karpathy/nanoGPT/
  25. …for what it's recreating. (I don't know how fair the comparison to other loc figures mentioned is). https://github.com/karpathy/nanoGPT
  26. …and training code in ~600 lines (although networks have easier logic to code than a compiler). [1] https://github.com/karpathy/nanoGPT
  27. …or in the final linear layer before the softmax. You can see how it’s implemented in nanoGPT: https://github.com/karpathy/nanoGPT/blob/f08abb45bd2285627d1... At training time, probabilities for the next token are computed for each…
    comment by rlanday · 2023-07-25 · in Attention Is Off By One
  28. It would be interesting to see: (1) why a lamini account is required? (2) how this compares to https://github.com/karpathy/nanoGPT
    comment by adr1an · 2023-07-12 · in Free and Fast LLM Finetuning
  29. …system does not contradict his statement. Go look at the GPT training code, here is the exact line: https://github.com/karpathy/nanoGPT/blob/master/train.py#L12... The model is only trained to predict the next token . The training regime…
  30. Thanks, Is there a toy conversational LLM on Github or elsewhere? Something like: https://github.com/karpathy/nanoGPT
  31. ….com/TikkunCreation/5de1df7b24800cc05b482... In particular, you'll probably want to skip to nanoGPT ( https://github.com/karpathy/nanoGPT ) and then maybe if you are interested in a bit more of the theory, Zero to Hero (…
  32. …ithub.com/karpathy/randomfun/blob/master/lectures/m... [4]: https://github.com/karpathy/makemore [5]: https://github.com/karpathy/nanoGPT
    comment by sirodoht · 2023-04-05 · in Neural Networks: Zero to Hero
  33. Correct, the original is GPL 3. To produce this implementation from the LLaMA paper we started from github.com/karpathy/nanoGPT, the LLaMA architecture is really similar to GPT. For instance we added rotary positional encoding starting…
  34. Just playing casually with NanoGPT ( https://github.com/karpathy/nanoGPT ) with a desktop holding a 2080ti, it's really really really clear to me that the path to get to a pre-fine-tuned LLM is remarkably easy. RLHF is the piece above this…
    comment by aliljet · 2023-03-26 · in Using ChatGPT Plugins with LLaMA
  35. ▲ 3
    Ask HN: Open-source projects around LLM (APIs) and GPT?
    story by krishadi · 2023-03-10 · 1 comment
  36. …won't fit in memory. If you could get it to run, it would be extremely slow Worth checking out: https://github.com/karpathy/nanoGPT The associated videos will go into this more, iirc, at the end he said the real GPT-2 would take 5-20…
  37. ▲ 86
    Ask HN: Open-source ChatGPT alternatives?
    story by baobabKoodaa · 2023-02-14 · 58 comments
  38. …his own minimal GPT ( https://github.com/karpathy/minGPT ), and the much smaller version of it ( https://github.com/karpathy/nanoGPT ). But of course, since we are in this blog post I would refer you to this 60 line numpy GPT first (A. to…
    comment by tysam_and · 2023-02-09 · in A GPT in 60 Lines of NumPy
  39. this is pretty small: https://github.com/karpathy/nanoGPT
    comment by sharemywin · 2023-02-09 · in A GPT in 60 Lines of NumPy
  40. Can you please run bench from https://github.com/karpathy/nanoGPT ?
    comment by lostmsu · 2023-01-18 · in Which GPU(s) to get for deep learning
  41. …- Many smart developers try to reduce code, not multiply it: https://github.com/geohot/tinygrad https://github.com/karpathy/nanoGPT - Satisficing https://en.wikipedia.org/wiki/Satisficing - Perfect is the enemy of good…
  42. …size matters a lot more than parameter count, and nanoGPT author is trying to reproduce that here: https://github.com/karpathy/nanoGPT/blob/master/scaling_laws...
    comment by naasking · 2023-01-11 · in NanoGPT
  43. https://github.com/karpathy/nanoGPT#i-only-have-a-macbook > This creates a much smaller Transformer (4 layers, 4 heads, 64 embedding size), runs only on CPU, does not torch.compile the model (torch seems to give an error if you try), only…
    comment by JustSomeNobody · 2023-01-11 · in NanoGPT
  44. …In a real system, what you want to optimize for is accuracy, composability, inventiveness. [0]: https://github.com/karpathy/nanoGPT/blob/master/scaling_laws...
    comment by espadrine · 2023-01-11 · in NanoGPT
  45. I think the link should be: https://github.com/karpathy/nanoGPT
    comment by iamflimflam1 · 2023-01-11 · in NanoGPT
  46. ▲ 1,532
    NanoGPT
    story by trekhleb · 2023-01-11 · 320 comments
  47. ▲ 2
    The simplest, fastest repository for training and fine-tuning medium-sized GPTs
    story by Terretta · 2023-01-10 · 0 comments
  48. what about https://github.com/karpathy/nanoGPT (currently trending on Github)
    comment by ladino · 2023-01-10 · in Microsoft eyes $10B bet on ChatGPT
  49. ▲ 3
    nanoGPT: The simplest repository for training medium-sized GPTs
    story by isoprophlex · 2023-01-03 · 1 comment