Nanochat Lets You Build Your Own Hackable LLM

Few people know LLMs (Large Language Models) as thoroughly as [Andrej Karpathy], and luckily for us all he expresses that in useful open-source projects. His latest is nanochat, which he bills as a way to create “the best ChatGPT $100 can buy”.

What is it, exactly? nanochat in a minimal and hackable software project — encapsulated in a single speedrun.sh script — for creating a simple ChatGPT clone from scratch, including web interface. The codebase is about 8,000 lines of clean, readable code with minimal dependencies, making every single part of the process accessible to be tampered with.

An accessible, end-to-end codebase for creating a simple ChatGPT clone makes every part of the process hackable.

The $100 is the cost of doing the computational grunt work of creating the model, which takes about 4 hours on a single NVIDIA 8XH100 GPU node. The result is a 1.9 billion parameter micro-model, trained on some 38 billion tokens from an open dataset. This model is, as [Andrej] describes in his announcement on X, a “little ChatGPT clone you can sort of talk to, and which can write stories/poems, answer simple questions.” A walk-through of what that whole process looks like makes it as easy as possible to get started.

Unsurprisingly, a mere $100 doesn’t create a meaningful competitor to modern commercial offerings. However, significant improvements can be had by scaling up the process. A $1,000 version (detailed here) is far more coherent and capable; able to solve simple math or coding problems and take multiple-choice tests.

[Andrej Karpathy]’s work lends itself well to modification and experimentation, and we’re sure this tool will be no exception. His past work includes a method of training a GPT-2 LLM using only pure C code, and years ago we saw his work on a character-based Recurrent Neural Network (mis)used to generate baroque music by cleverly representing MIDI events as text.

Don’t Believe Planck’s Constant? Measure It Yourself

We aren’t sure if [Looking Glass Universe] didn’t trust the accepted number for Planck’s constant, or just wanted the experience of measuring it herself. Either way, she took some LEDs and worked out the correct figure. Apparently, it hasn’t changed since we first measured it in 1916. But it’s always good to check.

The constant, if you need a refresher, helps explain things like why the color of light changes how the photoelectric effect manifests, and is at the root of quantum physics. LEDs are perfect for this experiment because, of course, they come in different colors. You essentially use a pot to tune down the LED until it just reaches the point where it is dark. Presuming you know the wavelength of the LED, you can estimate Planck’s constant from that and the voltage across the virtually ready-to-light LED. We might have used the potentiometer in a voltage divider configuration, but it should work either way.

The experiment showed that even a disconnected LED emits a few stray photons. But it was still possible to interpret the results. The constant is very tiny, so you’ll want your scientific calculator get do the math or, as she used, Wolfram Alpha.

The first result was off by the alarming amount of 1 x 10-40. No, that’s not alarming at all. That number is amazingly small.

This is a fairly common home physics experiment. You can do it quick, like [Looking Glass] did, or you can build something elaborate.

Continue reading “Don’t Believe Planck’s Constant? Measure It Yourself”