Curious Beginner's Guide to LLMs
How large language models can become the operating system of the future
Dear subscribers,
On Thanksgiving Eve, I watched a new talk by Andrej Karparthy, the famous Stanford lecturer and OpenAI founding member. He shared this image about large language models (LLMs) that blew my mind:
The best way to learn something is to explain it to others. So here’s my attempt to explain like I’m five Andrej’s talk along with my personal anecdotes on:
How LLMs work
How LLMs are trained
How LLMs can be tailored to serve a company’s specific use cases
How LLMs can evolve into the operating system of the future
I hope you enjoy this bonus edition of the newsletter!
How LLMs work
An LLM has two files:
A large file with billions of parameters for a neural network model
A tiny file with a few hundred lines of code to run the model
Think of an LLM as a “next word predictor” or a fancy autocomplete. For example, given the words “cat sat on a”, the LLM might predict “mat” with 97% probability.
LLMs can hallucinate. For example, it can invent non-existing URLs or make up math answers. Giving the LLM tools like browsing can help mitigate this, as I’ll cover later.
An example of an LLM is the open-source model LLAMA 2. You can download this model and run it locally on your computer for free.
BONUS: What is a neural network?
Neural networks are like a web of neurons that make decisions and pass messages to each other. Neurons can improve their decision-making over time as they process more data.
How LLMs are trained
Training an LLM involves two stages:
Stage 1: Pretraining
Pretraining compresses the internet into a neural network:
Take 10 terabytes of text from the internet.
Compress this text into a neural network using GPUs and millions of dollars.
Obtain the base model.
Given how costly pretraining is, only a few companies (e.g., OpenAI, Anthropic, Meta, Google) can afford to train base models about once a year.
Stage 2: Finetuning
Fine-tuning is when you refine the base model for your specific use case:
Train the model on 100K+ conversations written by humans. Alternatively, given a list of questions, have humans review and pick the model’s best answers.
Obtain the fine-tuned model.
Run evaluations to refine the model further by finding bad model responses and getting humans to correct them.
Fine-tuning is much less expensive than pretraining and can be completed in a few weeks or months. You can also use LLMs themselves to evaluate another LLM’s answers, but you’ll likely still need humans to check the results. So tl:dr:
Manual human evaluation is key to fine-tuning the LLM’s output.
The difference between open-source and proprietary LLMs
As seen in the chart above, open-source models like LLAMA2 still lag behind proprietary models like GPT4 and Claude in quality. But that doesn’t mean that companies want to rely on proprietary models…
How companies can tailor LLMs for their use case
Andrej didn’t cover this section but I think it’s important to understand.
There are three ways for a company to tailor an LLM for their specific use case:
Keep reading with a 7-day free trial
Subscribe to Creator Economy by Peter Yang to keep reading this post and get 7 days of free access to the full post archives.