HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
rasbt
LLMs-from-scratch
Jupyter Notebook2024–2026
rasbt / LLMs-from-scratch

LLMs-from-scratch

Implement a ChatGPT-like LLM in PyTorch from scratch, step by step

22Distinct people
33Mentions
0Explicit recommenders
108.3KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Implement a ChatGPT-like LLM in PyTorch from scratch, step by step

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 4:00:59 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year33 dated mentions

Observed mentions: 2024-01-27 16:19:42 UTC to 2026-10-26 21:55:12 UTC.

0510152024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 14 mentions; 9 submissions, 5 comments20242025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 14 mentions; 8 submissions, 6 comments20252026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC1495
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC1486
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC514

What Hacker News says

14 sources
This is pretty great. PyTorch uses triton as the backend for torch.compile (the big feature of PyTorch 2.0, and the necessary part for making Flex Attention in the about to be released 2.5 usably fast). Triton's team doesn't support Windows, and, worse yet, does not accept community PRs to enable any sort of support. Here's the github issue: https://github.com/triton-lang/triton/issues/1640 And here's the performance comparison of Flex Attention with and without torch.compile (tldr it's 3x slower than a standard MHA when not compiled): https://github.com/rasbt/LLMs-from-scratch/blob/76e9a9ec02a1... EDIT: after taking a look at the repo, the only thing changed in the "46 commits ahead of [official triton]" is the README. Somewhat sketchy.
In Triton Fork for Windows Support
> Brains do not reason ... They can, at times, and do so best when emotion is not involved. > I'm tired of reading comments from people who keep repeating that LLMs don't think, don't reason, isn't intelligence because it is not human. LLM's represent a category of algorithm. Quite elegant and useful in some circumstances, but an algorithm none the less. A quick search produced this[0] example discussing same. Another reference, which may not be authoritative based on whatever most recent edit the link produces, is[1]: A large language model (LLM) is a computational model capable of language generation or other natural language processing tasks. As language models, LLMs acquire these abilities by learning statistical relationships from vast amounts of text during a self-supervised and semi-supervised training process. > Def
Read the rest
ine what reasoning is to you. Reasoning was the process I went through to formulate this response, doing so with intent to convey meaning as best as I can, and understand as best as possible the message to which I am replying. > Then tell us why LLMs don't reason and why it matters. LLM's do not possess the ability to perform the process detailed above. This is why it matters. 0 - https://github.com/rasbt/LLMs-from-scratch 1 - https://en.wikipedia.org/wiki/Large_language_model
In Inductive or deductive? Rethinking the fundamental reasoning abilities of LLMs
The attention mechanism we implement in this book* is specific to LLMs in terms of the text inputs, but it's fundamentally the same attention mechanism that is used in vision transformers. The only difference is that in LLMs, you turn text into tokens, and convert these tokens into vector embeddings that go into an LLM. In vision transformers, instead of regarding images as tokens, you use an image patch as a token and turn those into vector embeddings (a bit hard to explain without visuals here). In both text or vision context, it's the same attention mechanism, and it both cases it receives vector embeddings. (*Chapter 3, already submitted last week and should be online in the MEAP soon, in the meantime the code along with the notes is also available here: https://github.com/rasbt/LLMs-from-scratch/blob/main/ch03/01...)
In Implementing a ChatGPT-like LLM from scratch, step by step

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.