AI Pub Profile picture
Aug 30, 2022 19 tweets 7 min read Read on X
// SCALING LAWS, Explained (Part I) //

You've heard "Scale is All You Need", seen graphs with straight lines going down, others muttering that "AGI is coming".

What exactly are scaling laws? What is being scaled? And why is everyone excited (or scared) about them?

1/18
First, a summary in two tweets:

Scaling laws show that large language models' (LLMs') loss decreases when you increase the model's:
- # parameters,
- training data,
- training compute budget

In a mathematically predictable way.

2/18
Why does this matter?

It means we don't need to make theoretical or architectural advances to significantly power up LLMs.

Just let the GPUs rip, baby!

(There's a second, much more important reason at the end of the thread!)

3/18
Now, the details. First, the form of the law:

With L the test loss,

x = one of compute, dataset size, or model parameters, and *not* bottlenecked by the other two, empirically we find

L = C/x^a

For constants C and a that depend on the scaling type (see below!).

4/18
Alternatively we have log L ~ -log(a)*log(x), so a linear relationship on a log-log scale.

(Hence the straight-line log-log charts.)

5/18
What's the loss L, you ask?

It's the "cross-entropy", which in this case is also equal to the (average) log-likelihood. Formula below!

Intuitively, it's the (scaled, -log) chance that your LLM would actually generate your text dataset. You want this chance to be high.

6/18
Now that you get the basics, here's a puzzle:

The scaling law exponents are between 0.05 and 0.1. These exponents are tiny.

Concretely, if you 1,000x'd your training data, your loss would only go down by a factor of 1/(1,000)^0.1 ~ 50%!

So why care about scaling laws?

7/18
Here comes the kicker - why you should *actually* care about scaling laws, why some say "Scale is All You Need", why others say "AGI is coming":

*Minor* improvements in test loss give *massive* generalization and new capabilities for LLMs.

An example from DeepMind:

8/18
DeepMind trained two LLMs, Gopher and Chinchilla.

Chinchilla was trained more efficiently resulting in a cross-entropy of 1.97, vs. Gopher's 2.05 - only a 4% improvement.

Yet Chinchilla blew Gopher out of the water on a range of high-level tasks like high school math.

9/18
Specifically, Chinchilla performed on average 10x better than Gopher on MMLU, a multitask language understanding dataset ranging from exams in professional medicine to high school chemistry.

Chinchilla beat Gopher by over 30x in college physics, with only 4% lower loss!

10/18
This is *real* reason to care about scaling laws, why some say that "AGI is coming". The reasoning chain is:

1. Scale up data, params, GPUs go brrr -->
2. *Minor* yet predictable decrease in model loss -->
3. *Massive* increase in LLM capabilities.

Be afraid! (perhaps)

11/18
That's a wrap on scaling laws! If you read the thread carefully, you now understand:

1. The mathematical form of scaling laws
2. The cross-entropy loss
3. That scaling laws lead to minor improvements in loss...
4. But massive improvements in LLM capabilities

12/18
This thread was an introduction to scaling laws, and largely a walk-through of OpenAI's 2020 paper that discovered them.

Later this week we'll do Part II on the limits of scaling laws, scaling laws and data, and the 2022 Chinchilla paper!

arxiv.org/abs/2001.08361

13/18
To buy the shirt from this thread, made by @ethanCaballero, go here: agiwear.ai

(Not a paid promotion, lol)

14/18
For those new to the channel, a bit about us:

We now do 3 things (with more cooking in the kitchen...):

1) We publish explainer threads like the one you just read. Here's another on Stable Diffusion that blew up last week:

15/18
2) We publish a weekly "Best of AI Twitter" thread - here's last week's:

16/18
3) We're building a job board for ML engineers and SWEs who want to work on ML products - out in a week!

We're also building on a solution to match the above talent with companies building cutting-edge ML products, but that'll take a month or two.



17/18
That's a wrap! Check in later this week for the job board and Part II on scaling laws.

Comments and DMs are always open if there's an explainer thread topic you'd like covered!

Oh, and tomorrow I'll post a thread of resources to learn more about scaling laws.

18/18
To learn more about scaling laws, check out these resources:

19/18

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with AI Pub

AI Pub Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @ai__pub

Apr 11, 2023
// AI Recruiting: Survey //

I help ~25 AI startups recruit top-notch engineers, via the AI Pub Talent Network:

Now helping some with their hiring processes.

ML and software engineers: you're invited to interview. Why do you *not* start the hiring process with a company?

1/2
Some reasons that come to mind:

- Not ready / not the right time to leave current role
- Hiring process is long / a PITA
- Cash or equity comp not transparent
- Comp not high enough
- Product, company, or team isn't compelling

Any others?

2/2
Three others that come to mind:
- Don’t want to relocate
- Company isn’t prestigious enough
- Don’t think they’ll pass the interview or get hired (eg I’m not applying for a job at OpenAI b/c it’d be a waste of time)

3/2
Read 4 tweets
Apr 8, 2023
// Harvey: Legal AGI //

Harvey is an OpenAI-backed GPT-4 startup building AI knowledge workers.

They've signed deals with the largest law firms on earth, and are the fastest-growing LLM startup by revenue I know of.

Everything you need to know about Harvey:

1/10 ImageImageImageImage
Harvey's first product is a GPT-4 powered AI knowledge worker.

Harvey can:
- Generate long-form legal documents
- With niche knowledge of the law
- Answer complex legal questions
- Leveraging millions of documents
- Create firm-specific models

2/10 Image
In the last two months, Harvey rolled out multi-million dollar contracts with the largest law firms in the world.

Two examples:
- Allen & Overy (7th largest law firm on Earth): allenovery.com/en-gb/global/n…
- PwC ($50B rev. firm network): pwc.com/gx/en/news-roo…

Dozens coming.

3/10 ImageImageImage
Read 10 tweets
Mar 21, 2023
// Deep Papers #3: Toolformer //

LLMs like Bing and ChatGPT use external tools like calculators and web search to answer questions.

How do you teach LLMs to *use* these external tools?

Toolformer shows how!

We interviewed the authors :)

Spotify: open.spotify.com/episode/6uXohG…
LLMs can only spit out the next token, given the context.

How then does an LLM even *use* external tools?

In Toolformer, the authors teach LLMs to output:
- an <API> token,
- followed by a request body,
- followed by a <Call API> token.
The API response is then inserted into the context, including an </API> token.

The LLM then uses that as context to keep making next-token predictions!

That's how Toolformer works.
Read 8 tweets
Mar 10, 2023
// Toolformer Podcast: Preview //

Today I'm interviewing the Toolformer authors!

LLMs like Bing (and soon, ChatGPT) can use external tools like calculators or internet search to answer questions.

But how do language models *learn to use* these tools?

1/5 ImageImage
I'll publish a thread this weekend explaining how, but for now:

The most interesting question (& hardest part of the problem) is creating the dataset.

2/5 Image
How do you take a large text dataset like Common Crawl,

and annotate it with API calls at the right points,

To form a dataset teaching an LM *when* to make those API calls?

3/5 ImageImage
Read 5 tweets
Feb 16, 2023
Today: the 7th largest law firm on Earth announced a 3,500-lawyer deal with Harvey, an OpenAI-backed AI Lawyer startup:

See below for:
- Deal details
- Harvey's capabilities (❗)
- Harvey's open roles (I refer talent to them!)

1/6
Allen & Overy, the 2nd-largest law firm in the UK and 7th-largest on Earth, is partnering with Harvey after a 3-month trial of its AI lawyer product.

It is now unrolling Harvey to 3,500+ lawyers in its offices.

Announcement link: allenovery.com/en-gb/global/n…

2/6
Capabilities:

With early access to next-gen text models from OpenAI (😉), Harvey can:

- Answer complex legal questions
- Leveraging millions of documents
- Generate unique work product
- With knowledge of niche law
- Learn from lawyer feedback
- Create firm-specific models

3/6
Read 7 tweets
Feb 14, 2023
// Podcast #2: Hungry Hungry Hippos (H3) //

Stanford researchers just released a new architecture that:

- Beats Transformers at ~1B param scale
- Admits *much* longer context than Transformers

Is H3 the Transformer-killer? More below!

Spotify: open.spotify.com/episode/45eXtV…

1/5 ImageImageImageImage
Hungry Hungry Hippos, aka "H3", functions like a linear RNN, or a long convolution.

The key idea: due to the fast Fourier transform, an H3 layer:

- can be computed in n*log(n) time, with n the context length
- unlike Transformers, which require n^2!

2/5 Image
H3's long context unlocks new AI & product capabilities.

- Long & multifile code generation
- Video understanding
- DNA and genomics
- Long-context chatbots & AI agents

Dan Fu gives an "elevator pitch" for H3 on the podcast:

3/5
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(