+0.45 Microgpt (karpathy.github.io S:+0.35 )
716 points by tambourine_man 7 hours ago | 119 comments on HN | Moderate positive Editorial · v3.7 · 2026-03-01 06:37:57 0
Summary Scientific Education Advocates
The content is a technical blog post explaining and sharing the source code for 'microgpt', a minimalist GPT implementation. It engages with human rights themes primarily through the lens of sharing scientific knowledge and enabling education (Articles 19 and 27). The evaluation shows a mild to moderate positive lean, reflecting advocacy for open knowledge and participation in scientific advancement.
Article Heatmap
Preamble: ND — Preamble Preamble: No Data — Preamble P Article 1: ND — Freedom, Equality, Brotherhood Article 1: No Data — Freedom, Equality, Brotherhood 1 Article 2: ND — Non-Discrimination Article 2: No Data — Non-Discrimination 2 Article 3: ND — Life, Liberty, Security Article 3: No Data — Life, Liberty, Security 3 Article 4: ND — No Slavery Article 4: No Data — No Slavery 4 Article 5: ND — No Torture Article 5: No Data — No Torture 5 Article 6: ND — Legal Personhood Article 6: No Data — Legal Personhood 6 Article 7: ND — Equality Before Law Article 7: No Data — Equality Before Law 7 Article 8: ND — Right to Remedy Article 8: No Data — Right to Remedy 8 Article 9: ND — No Arbitrary Detention Article 9: No Data — No Arbitrary Detention 9 Article 10: ND — Fair Hearing Article 10: No Data — Fair Hearing 10 Article 11: ND — Presumption of Innocence Article 11: No Data — Presumption of Innocence 11 Article 12: ND — Privacy Article 12: No Data — Privacy 12 Article 13: ND — Freedom of Movement Article 13: No Data — Freedom of Movement 13 Article 14: ND — Asylum Article 14: No Data — Asylum 14 Article 15: ND — Nationality Article 15: No Data — Nationality 15 Article 16: ND — Marriage & Family Article 16: No Data — Marriage & Family 16 Article 17: ND — Property Article 17: No Data — Property 17 Article 18: ND — Freedom of Thought Article 18: No Data — Freedom of Thought 18 Article 19: +0.36 — Freedom of Expression 19 Article 20: ND — Assembly & Association Article 20: No Data — Assembly & Association 20 Article 21: ND — Political Participation Article 21: No Data — Political Participation 21 Article 22: ND — Social Security Article 22: No Data — Social Security 22 Article 23: ND — Work & Equal Pay Article 23: No Data — Work & Equal Pay 23 Article 24: ND — Rest & Leisure Article 24: No Data — Rest & Leisure 24 Article 25: ND — Standard of Living Article 25: No Data — Standard of Living 25 Article 26: ND — Education Article 26: No Data — Education 26 Article 27: +0.46 — Cultural Participation 27 Article 28: ND — Social & International Order Article 28: No Data — Social & International Order 28 Article 29: ND — Duties to Community Article 29: No Data — Duties to Community 29 Article 30: ND — No Destruction of Rights Article 30: No Data — No Destruction of Rights 30
Negative Neutral Positive No Data
Aggregates
Editorial Mean +0.45 Structural Mean +0.35
Weighted Mean +0.41 Unweighted Mean +0.41
Max +0.46 Article 27 Min +0.36 Article 19
Signal 2 No Data 29
Volatility 0.05 (Low)
Negative 0 Channels E: 0.6 S: 0.4
SETL +0.21 Editorial-dominant
FW Ratio 60% 6 facts · 4 inferences
Evidence 4% coverage
2M 29 ND
Theme Radar
Foundation Security Legal Privacy & Movement Personal Expression Economic & Social Cultural Order & Duties Foundation: 0.00 (0 articles) Security: 0.00 (0 articles) Legal: 0.00 (0 articles) Privacy & Movement: 0.00 (0 articles) Personal: 0.00 (0 articles) Expression: 0.36 (1 articles) Economic & Social: 0.00 (0 articles) Cultural: 0.46 (1 articles) Order & Duties: 0.00 (0 articles)
HN Discussion 19 top-level · 12 replies
tithos 2026-03-01 02:13 UTC link
What is the prime use case
colonCapitalDee 2026-03-01 02:25 UTC link
Beautiful work
ViktorRay 2026-03-01 02:36 UTC link
Which license is being used for this?
fulafel 2026-03-01 03:00 UTC link
This could make an interesting language shootout benchmark.
ThrowawayTestr 2026-03-01 03:06 UTC link
This is like those websites that implement an entire retro console in the browser.
dhruv3006 2026-03-01 03:42 UTC link
Karapthy with another gem !
jimbokun 2026-03-01 04:16 UTC link
It’s pretty staggering that a core algorithm simple enough to be expressed in 200 lines of Python can apparently be scaled up to achieve AGI.

Yes with some extra tricks and tweaks. But the core ideas are all here.

red_hare 2026-03-01 04:25 UTC link
This is beautiful and highly readable but, still, I yearn for a detailed line-by-line explainer like the backbone.js source: https://backbonejs.org/docs/backbone.html
subset 2026-03-01 04:25 UTC link
I had good fun transliterating it to Rust as a learning experience (https://github.com/stochastical/microgpt-rs). The trickiest part was working out how to represent the autograd graph data structure with Rust types. I'm finalising some small tweaks to make it run in the browser via WebAssmebly and then compile it up for my blog :) Andrej's code is really quite poetic, I love how much it packs into such a concise program
kelvinjps10 2026-03-01 04:26 UTC link
Why there is multiple comments talking about 1000 c lines, bots?
0xbadcafebee 2026-03-01 04:43 UTC link
Since this post is about art, I'll embed here my favorite LLM art: the IOCCC 2024 prize winner in bot talk, from Adrian Cable (https://www.ioccc.org/2024/cable1/index.html), minus the stdlib headers:

  #define a(_)typedef _##t
  #define _(_)_##printf
  #define x f(i,
  #define N f(k,
  #define u _Pragma("omp parallel for")f(h,
  #define f(u,n)for(I u=0;u<(n);u++)
  #define g(u,s)x s%11%5)N s/6&33)k[u[i]]=(t){(C*)A,A+s*D/4},A+=1088*s;
  
  a(int8_)C;a(in)I;a(floa)F;a(struc){C*c;F*f;}t;enum{Z=32,W=64,E=2*W,D=Z*E,H=86*E,V='}\0'};C*P[V],X[H],Y[D],y[H];a(F
  _)[V];I*_=U" 炾ોİ䃃璱ᝓ၎瓓甧染ɐఛ瓁",U,s,p,f,R,z,$,B[D],open();F*A,*G[2],*T,w,b,c;a()Q[D];_t r,L,J,O[Z],l,a,K,v,k;Q
  m,e[4],d[3],n;I j(I e,F*o,I p,F*v,t*X){w=1e-5;x c=e^V?D:0)w+=r[i]*r[i]/D;x c)o[i]=r[i]/sqrt(w)*i[A+e*D];N $){x
  W)l[k]=w=fmax(fabs(o[i])/~-E,i?w:0);x W)y[i+k*W]=*o++/w;}u p)x $){I _=0,t=h*$+i;N W)_+=X->c[t*W+k]*y[i*W+k];v[h]=
  _*X->f[t]*l[i]+!!i*v[h];}x D-c)i[r]+=v[i];}I main(){A=mmap(0,8e9,1,2,f=open(M,f),0);x 2)~f?i[G]=malloc(3e9):exit(
  puts(M" not found"));x V)i[P]=(C*)A+4,A+=(I)*A;g(&m,V)g(&n,V)g(e,D)g(d,H)for(C*o;;s>=D?$=s=0:p<U||_()("%s",$[P]))if(!
  (*_?$=*++_:0)){if($<3&&p>=U)for(_()("\n\n> "),0<scanf("%[^\n]%*c",Y)?U=*B=1:exit(0),p=_(s)(o=X,"[INST] %s%s [/INST]",s?
  "":"<<SYS>>\n"S"\n<</SYS>>\n\n",Y);z=p-=z;U++[o+=z,B]=f)for(f=0;!f;z-=!f)for(f=V;--f&&f[P][z]|memcmp(f[P],o,z););p<U?
  $=B[p++]:fflush(0);x D)R=$*D+i,r[i]=m->c[R]*m->f[R/W];R=s++;N Z){f=k*D*D,$=W;x 3)j(k,L,D,i?G[~-i]+f+R*D:v,e[i]+k);N
  2)x D)b=sin(w=R/exp(i%E/14.)),c=1[w=cos(w),T=i+++(k?v:*G+f+R*D)],T[1]=b**T+c*w,*T=w**T-c*b;u Z){F*T=O[h],w=0;I A=h*E;x
  s){N E)i[k[L+A]=0,T]+=k[v+A]*k[i*D+*G+A+f]/11;w+=T[i]=exp(T[i]);}x s)N E)k[L+A]+=(T[i]/=k?1:w)*k[i*D+G[1]+A+f];}j(V,L
  ,D,J,e[3]+k);x 2)j(k+Z,L,H,i?K:a,d[i]+k);x H)a[i]*=K[i]/(exp(-a[i])+1);j(V,a,D,L,d[$=H/$,2]+k);}w=j($=W,r,V,k,n);x
  V)w=k[i]>w?k[$=i]:w;}}
coolThingsFirst 2026-03-01 04:44 UTC link
Incredibly fascinating. One thing is that it seems still very conceptual. What id be curious about how good of a micro llm we can train say with 12 hours of training on macbook.
hackersk 2026-03-01 05:26 UTC link
What I find most valuable about this kind of project is how it forces you to understand the entire pipeline end-to-end. When you use PyTorch or JAX, there are dozens of abstractions hiding the actual mechanics. But when you strip it down to ~200 lines, every matrix multiplication and gradient computation has to be intentional.

I tried something similar last year with a much simpler model (not GPT-scale) and the biggest "aha" moment was understanding how the attention mechanism is really just a soft dictionary lookup. The math makes so much more sense when you implement it yourself vs reading papers.

Karpathy has a unique talent for making complex topics feel approachable without dumbing them down. Between this, nanoGPT, and the Zero to Hero series, he has probably done more for ML education than most university programs.

freakynit 2026-03-01 05:45 UTC link
Is there something similar for diffusion models? By the way, this is incredibly useful for learning in depth the core of LLM's.
verma7 2026-03-01 06:00 UTC link
I wrote a C++ translation of it: https://github.com/verma7/microgpt/blob/main/microgpt.cc

2x the number of lines of code (~400L), 10x the speed

The hard part was figuring out how to represent the Value class in C++ (ended up using shared_ptrs).

MattyRad 2026-03-01 06:10 UTC link
Hoenikker had been experimenting with melting and re-freezing ice-nine in the kitchen of his Cape Cod home.

Beautiful, perhaps like ice-nine is beautiful.

teleforce 2026-03-01 06:21 UTC link
Someone has modified microgpt to build a tiny GPT that generates Korean first names, and created a web page that visualizes the entire process [1].

Users can interactively explore the microgpt pipeline end to end, from tokenization until inference.

[1] English GPT lab:

https://ko-microgpt.vercel.app/

znnajdla 2026-03-01 06:22 UTC link
Super useful exercise. My gut tells me that someone will soon figure out how to build micro-LLMs for specialized tasks that have real-world value, and then training LLMs won’t just be for billion dollar companies. Imagine, for example, a hyper-focused model for a specific programming framework (e.g. Laravel, Django, NextJS) trained only on open-source repositories and documentation and carefully optimized with a specialized harness for one task only: writing code for that framework (perhaps in tandem with a commodity frontier model). Could a single programmer or a small team on a household budget afford to train a model that works better/faster than OpenAI/Anthropic/DeepSeek for specialized tasks? My gut tells me this is possible; and I have a feeling that this will become mainstream, and then custom model training becomes the new “software development”.
geerlingguy 2026-03-01 02:20 UTC link
Looks like to learn how a GPT operates, with a real example.
antonvs 2026-03-01 02:27 UTC link
To confuse people who only think in terms of use cases.

Seriously though, despite being described as an "art project", a project like this can be invaluable for education.

keyle 2026-03-01 02:35 UTC link
it's a great learning tool and it shows it can be done concisely.
inerte 2026-03-01 02:54 UTC link
Kaparthy to tell you things you thought were hard in fact fit in a screen.
wasabi991011 2026-03-01 04:18 UTC link
1000 lines??

What is going on in this thread

darkpicnic 2026-03-01 04:25 UTC link
LLMs won’t lead to AGI. Almost by definition, they can’t. The thought experiment I use constantly to explain this:

Train an LLM on all human knowledge up to 1905 and see if it comes up with General Relativity. It won’t.

We’ll need additional breakthroughs in AI.

altcognito 2026-03-01 04:33 UTC link
ask a high end LLM to do it
the_af 2026-03-01 04:41 UTC link
Or even 1000 python lines, also wrong.

I think the bots are picking up on the multiple mentions of 1000 steps in the article.

thatxliner 2026-03-01 05:10 UTC link
wiat what does this do?
ashish01 2026-03-01 05:31 UTC link
That is really beautiful literate program. Seeing it after a long time. Here is a opus generate version of this code - https://ashish01.github.io/microgpt.html
the_arun 2026-03-01 06:26 UTC link
If we can run them on commodity hardware with cpus, nothing like it
Editorial Channel
What the content says
+0.50
Article 27 Cultural Participation
Medium Advocacy Practice
Editorial
+0.50
SETL
+0.22

Content focuses on sharing scientific/technical knowledge (AI/LLM implementation) and providing tools (code) for others to use and learn.

+0.40
Article 19 Freedom of Expression
Medium Advocacy Coverage
Editorial
+0.40
SETL
+0.20

Content is a technical blog post explaining and sharing code for a minimalist GPT implementation, advocating for open knowledge and education in AI.

ND
Preamble Preamble

ND
Article 1 Freedom, Equality, Brotherhood

ND
Article 2 Non-Discrimination

ND
Article 3 Life, Liberty, Security

ND
Article 4 No Slavery

ND
Article 5 No Torture

ND
Article 6 Legal Personhood

ND
Article 7 Equality Before Law

ND
Article 8 Right to Remedy

ND
Article 9 No Arbitrary Detention

ND
Article 10 Fair Hearing

ND
Article 11 Presumption of Innocence

ND
Article 12 Privacy

ND
Article 13 Freedom of Movement

ND
Article 14 Asylum

ND
Article 15 Nationality

ND
Article 16 Marriage & Family

ND
Article 17 Property

ND
Article 18 Freedom of Thought

ND
Article 20 Assembly & Association

ND
Article 21 Political Participation

ND
Article 22 Social Security

ND
Article 23 Work & Equal Pay

ND
Article 24 Rest & Leisure

ND
Article 25 Standard of Living

ND
Article 26 Education

ND
Article 28 Social & International Order

ND
Article 29 Duties to Community

ND
Article 30 No Destruction of Rights

Structural Channel
What the site does
Element Modifier Affects Note
+0.40
Article 27 Cultural Participation
Medium Advocacy Practice
Structural
+0.40
Context Modifier
ND
SETL
+0.22

Site offers free access to educational content and code, enabling participation in cultural/scientific life.

+0.30
Article 19 Freedom of Expression
Medium Advocacy Coverage
Structural
+0.30
Context Modifier
ND
SETL
+0.20

Site provides free access to educational content and code, with links to external repositories (GitHub, Colab) for practical use.

ND
Preamble Preamble

ND
Article 1 Freedom, Equality, Brotherhood

ND
Article 2 Non-Discrimination

ND
Article 3 Life, Liberty, Security

ND
Article 4 No Slavery

ND
Article 5 No Torture

ND
Article 6 Legal Personhood

ND
Article 7 Equality Before Law

ND
Article 8 Right to Remedy

ND
Article 9 No Arbitrary Detention

ND
Article 10 Fair Hearing

ND
Article 11 Presumption of Innocence

ND
Article 12 Privacy

ND
Article 13 Freedom of Movement

ND
Article 14 Asylum

ND
Article 15 Nationality

ND
Article 16 Marriage & Family

ND
Article 17 Property

ND
Article 18 Freedom of Thought

ND
Article 20 Assembly & Association

ND
Article 21 Political Participation

ND
Article 22 Social Security

ND
Article 23 Work & Equal Pay

ND
Article 24 Rest & Leisure

ND
Article 25 Standard of Living

ND
Article 26 Education

ND
Article 28 Social & International Order

ND
Article 29 Duties to Community

ND
Article 30 No Destruction of Rights

Supplementary Signals
How this content communicates, beyond directional lean. Learn more
Epistemic Quality
How well-sourced and evidence-based is this content?
0.82 low claims
Sources
0.9
Evidence
0.8
Uncertainty
0.7
Purpose
1.0
Propaganda Flags
No manipulative rhetoric detected
0 techniques detected
Emotional Tone
Emotional character: positive/negative, intensity, authority
measured
Valence
+0.6
Arousal
0.3
Dominance
0.5
Transparency
Does the content identify its author and disclose interests?
1.00
✓ Author
More signals: context, framing & audience
Solution Orientation
Does this content offer solutions or only describe problems?
0.80 solution oriented
Reader Agency
0.8
Stakeholder Voice
Whose perspectives are represented in this content?
0.50 1 perspective
Speaks: individuals
Temporal Framing
Is this content looking backward, at the present, or forward?
present unspecified
Geographic Scope
What geographic area does this content cover?
global
Complexity
How accessible is this content to a general audience?
technical medium jargon domain specific
Longitudinal 206 HN snapshots · 20 evals
+1 0 −1 HN
Audit Trail 40 entries
2026-03-01 07:45 credit_exhausted Credit balance too low, pausing provider for 30 min - -
2026-03-01 07:29 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 07:29 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 07:24 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 07:24 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 07:12 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 07:12 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral) 0.00
reasoning
Tech tutorial no rights stance
2026-03-01 07:07 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 07:07 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral) 0.00
reasoning
Tech tutorial no rights stance
2026-03-01 06:37 eval_success Evaluated: Moderate positive (0.41) - -
2026-03-01 06:37 eval Evaluated by deepseek-v3.2: +0.41 (Moderate positive) 10,330 tokens
2026-03-01 06:35 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 06:35 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 06:19 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 06:19 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral) 0.00
reasoning
Tech tutorial no rights stance
2026-03-01 05:51 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 05:51 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 05:47 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 05:47 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 05:34 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 05:34 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral) 0.00
reasoning
Tech tutorial no rights stance
2026-03-01 05:07 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 05:07 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 05:03 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 05:03 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral) 0.00
reasoning
Tech tutorial no rights stance
2026-03-01 04:19 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 04:19 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 04:14 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 04:14 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral) 0.00
reasoning
Tech tutorial no rights stance
2026-03-01 04:08 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 04:08 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral) 0.00
reasoning
Tech tutorial no rights stance
2026-03-01 03:30 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 03:30 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 03:24 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 03:24 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral) 0.00
reasoning
ED, neutral tech tutorial
2026-03-01 03:21 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 03:21 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral) 0.00
reasoning
Tech tutorial no rights stance
2026-03-01 02:54 eval_success Lite evaluated: Neutral (0.00) - -
2026-03-01 02:54 eval Evaluated by llama-4-scout-wai: 0.00 (Neutral)
reasoning
ED, neutral tech tutorial
2026-03-01 02:52 eval Evaluated by llama-3.3-70b-wai: 0.00 (Neutral)
reasoning
Tech tutorial no rights stance